aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc (renamed from Documentation/ABI/testing/sysfs-class-usb_host)4
-rw-r--r--Documentation/ABI/testing/sysfs-devices-cache_disable18
-rw-r--r--Documentation/ABI/testing/sysfs-devices-system-cpu156
-rw-r--r--Documentation/cputopology.txt47
-rw-r--r--Documentation/feature-removal-schedule.txt8
-rw-r--r--Documentation/filesystems/ext4.txt8
-rw-r--r--Documentation/flexible-arrays.txt43
-rw-r--r--Documentation/hwmon/sysfs-interface57
-rw-r--r--Documentation/lguest/lguest.c1
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt2
-rw-r--r--Documentation/trace/ftrace.txt2
-rw-r--r--Documentation/vm/hwpoison.txt136
-rw-r--r--MAINTAINERS158
-rw-r--r--Makefile2
-rw-r--r--arch/arm/configs/n8x0_defconfig2
-rw-r--r--arch/arm/configs/omap3_beagle_defconfig1
-rw-r--r--arch/arm/configs/u300_defconfig94
-rw-r--r--arch/arm/include/asm/cacheflush.h5
-rw-r--r--arch/arm/include/asm/elf.h3
-rw-r--r--arch/arm/include/asm/tlbflush.h3
-rw-r--r--arch/arm/kernel/entry-armv.S28
-rw-r--r--arch/arm/kernel/entry-header.S15
-rw-r--r--arch/arm/kernel/process.c9
-rw-r--r--arch/arm/kernel/signal.c41
-rw-r--r--arch/arm/kernel/signal.h4
-rw-r--r--arch/arm/kernel/traps.c4
-rw-r--r--arch/arm/kernel/unwind.c9
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c2
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h9
-rw-r--r--arch/arm/mach-ep93xx/core.c1
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c2
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h1
-rw-r--r--arch/arm/mach-integrator/include/mach/memory.h1
-rw-r--r--arch/arm/mach-mx2/clock_imx27.c8
-rw-r--r--arch/arm/mach-mx2/pcm038.c96
-rw-r--r--arch/arm/mach-mx2/pcm970-baseboard.c2
-rw-r--r--arch/arm/mach-mx25/devices.c19
-rw-r--r--arch/arm/mach-mx25/mx25pdk.c25
-rw-r--r--arch/arm/mach-mx3/clock-imx35.c2
-rw-r--r--arch/arm/mach-mx3/clock.c2
-rw-r--r--arch/arm/mach-mx3/devices.c24
-rw-r--r--arch/arm/mach-mx3/devices.h6
-rw-r--r--arch/arm/mach-mx3/mm.c2
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c6
-rw-r--r--arch/arm/mach-omap1/board-generic.c8
-rw-r--r--arch/arm/mach-omap1/board-innovator.c20
-rw-r--r--arch/arm/mach-omap1/board-palmte.c8
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c8
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c8
-rw-r--r--arch/arm/mach-omap1/board-sx1.c8
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c8
-rw-r--r--arch/arm/mach-omap1/serial.c26
-rw-r--r--arch/arm/mach-omap2/Kconfig12
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c4
-rw-r--r--arch/arm/mach-omap2/board-ldp.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c4
-rw-r--r--arch/arm/mach-omap2/board-rx51.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom2.c6
-rw-r--r--arch/arm/mach-omap2/clock24xx.c1
-rw-r--r--arch/arm/mach-omap2/clockdomain.c74
-rw-r--r--arch/arm/mach-omap2/io.c2
-rw-r--r--arch/arm/mach-omap2/pm34xx.c7
-rw-r--r--arch/arm/mach-omap2/serial.c10
-rw-r--r--arch/arm/mach-pxa/cm-x300.c38
-rw-r--r--arch/arm/mach-pxa/spitz.c39
-rw-r--r--arch/arm/mach-realview/core.h2
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb1176.h5
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb11mp.h12
-rw-r--r--arch/arm/mach-realview/include/mach/platform.h15
-rw-r--r--arch/arm/mach-realview/include/mach/system.h10
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c11
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c16
-rw-r--r--arch/arm/mach-s3c2410/gpio.c1
-rw-r--r--arch/arm/mach-s3c2410/include/mach/dma.h7
-rw-r--r--arch/arm/mach-s3c2440/Kconfig1
-rw-r--r--arch/arm/mach-s3c2440/mach-mini2440.c4
-rw-r--r--arch/arm/mach-s3c6400/include/mach/dma.h5
-rw-r--r--arch/arm/mm/Kconfig5
-rw-r--r--arch/arm/mm/context.c5
-rw-r--r--arch/arm/mm/dma-mapping.c4
-rw-r--r--arch/arm/mm/flush.c31
-rw-r--r--arch/arm/mm/init.c20
-rw-r--r--arch/arm/mm/mmu.c7
-rw-r--r--arch/arm/mm/proc-v6.S7
-rw-r--r--arch/arm/mm/proc-v7.S7
-rw-r--r--arch/arm/oprofile/op_model_v6.c3
-rw-r--r--arch/arm/plat-omap/dma.c33
-rw-r--r--arch/arm/plat-omap/include/mach/keypad.h5
-rw-r--r--arch/arm/plat-omap/iommu.c2
-rw-r--r--arch/arm/plat-omap/mcbsp.c2
-rw-r--r--arch/arm/plat-s3c24xx/adc.c2
-rw-r--r--arch/arm/plat-s3c24xx/cpu.c10
-rw-r--r--arch/arm/plat-s3c24xx/dma.c6
-rw-r--r--arch/arm/plat-s3c24xx/gpio.c1
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h9
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/s3c2410.h1
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/regs-clock.h4
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-clock.c3
-rw-r--r--arch/avr32/mach-at32ap/include/mach/cpu.h3
-rw-r--r--arch/frv/kernel/signal.c2
-rw-r--r--arch/ia64/include/asm/spinlock.h62
-rw-r--r--arch/ia64/include/asm/spinlock_types.h2
-rw-r--r--arch/ia64/kernel/mca.c104
-rw-r--r--arch/ia64/kernel/unaligned.c6
-rw-r--r--arch/ia64/mm/tlb.c24
-rw-r--r--arch/ia64/pci/pci.c9
-rw-r--r--arch/ia64/sn/kernel/io_common.c8
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c7
-rw-r--r--arch/m68k/Kconfig6
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mips/alchemy/common/irq.c34
-rw-r--r--arch/mips/alchemy/mtx-1/board_setup.c3
-rw-r--r--arch/mips/ar7/platform.c9
-rw-r--r--arch/mips/bcm63xx/Makefile2
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c3
-rw-r--r--arch/mips/bcm63xx/cpu.c3
-rw-r--r--arch/mips/bcm63xx/dev-uart.c2
-rw-r--r--arch/mips/bcm63xx/dev-wdt.c37
-rw-r--r--arch/mips/bcm63xx/setup.c4
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c224
-rw-r--r--arch/mips/cavium-octeon/smp.c5
-rw-r--r--arch/mips/include/asm/fixmap.h4
-rw-r--r--arch/mips/include/asm/gcmpregs.h18
-rw-r--r--arch/mips/include/asm/gic.h188
-rw-r--r--arch/mips/include/asm/mach-ar7/ar7.h3
-rw-r--r--arch/mips/include/asm/mach-au1x00/gpio-au1000.h2
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h6
-rw-r--r--arch/mips/include/asm/mach-ip27/topology.h4
-rw-r--r--arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h3
-rw-r--r--arch/mips/include/asm/mmu_context.h13
-rw-r--r--arch/mips/include/asm/setup.h2
-rw-r--r--arch/mips/include/asm/smtc_ipi.h1
-rw-r--r--arch/mips/include/asm/spram.h10
-rw-r--r--arch/mips/include/asm/thread_info.h9
-rw-r--r--arch/mips/jazz/irq.c2
-rw-r--r--arch/mips/kernel/cevt-bcm1480.c2
-rw-r--r--arch/mips/kernel/cevt-ds1287.c2
-rw-r--r--arch/mips/kernel/cevt-gt641xx.c2
-rw-r--r--arch/mips/kernel/cevt-r4k.c2
-rw-r--r--arch/mips/kernel/cevt-sb1250.c2
-rw-r--r--arch/mips/kernel/cevt-txx9.c2
-rw-r--r--arch/mips/kernel/cpu-probe.c8
-rw-r--r--arch/mips/kernel/head.S1
-rw-r--r--arch/mips/kernel/i8253.c2
-rw-r--r--arch/mips/kernel/irq-gic.c114
-rw-r--r--arch/mips/kernel/linux32.c6
-rw-r--r--arch/mips/kernel/scall64-o32.S4
-rw-r--r--arch/mips/kernel/smtc.c34
-rw-r--r--arch/mips/kernel/spram.c5
-rw-r--r--arch/mips/kernel/vpe.c2
-rw-r--r--arch/mips/loongson/common/irq.c1
-rw-r--r--arch/mips/math-emu/dp_simple.c13
-rw-r--r--arch/mips/math-emu/sp_simple.c11
-rw-r--r--arch/mips/mm/init.c6
-rw-r--r--arch/mips/mti-malta/malta-amon.c7
-rw-r--r--arch/mips/mti-malta/malta-int.c119
-rw-r--r--arch/mips/mti-malta/malta-pci.c27
-rw-r--r--arch/mips/nxp/pnx8550/common/int.c2
-rw-r--r--arch/mips/nxp/pnx8550/common/time.c4
-rw-r--r--arch/mips/oprofile/op_model_loongson2.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/mips/sni/time.c2
-rw-r--r--arch/mips/txx9/generic/setup.c5
-rw-r--r--arch/powerpc/boot/dts/cm5200.dts1
-rw-r--r--arch/powerpc/boot/dts/digsy_mtc.dts1
-rw-r--r--arch/powerpc/boot/dts/lite5200.dts2
-rw-r--r--arch/powerpc/boot/dts/lite5200b.dts2
-rw-r--r--arch/powerpc/boot/dts/media5200.dts2
-rw-r--r--arch/powerpc/boot/dts/motionpro.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc5121ads.dts3
-rw-r--r--arch/powerpc/boot/dts/mucmc52.dts332
-rw-r--r--arch/powerpc/boot/dts/pcm030.dts2
-rw-r--r--arch/powerpc/boot/dts/pcm032.dts2
-rw-r--r--arch/powerpc/boot/dts/tqm5200.dts1
-rw-r--r--arch/powerpc/boot/dts/uc101.dts284
-rw-r--r--arch/powerpc/configs/52xx/cm5200_defconfig136
-rw-r--r--arch/powerpc/configs/52xx/lite5200b_defconfig153
-rw-r--r--arch/powerpc/configs/52xx/motionpro_defconfig146
-rw-r--r--arch/powerpc/configs/52xx/pcm030_defconfig142
-rw-r--r--arch/powerpc/configs/52xx/tqm5200_defconfig148
-rw-r--r--arch/powerpc/configs/mpc5200_defconfig192
-rw-r--r--arch/powerpc/configs/ppc64e_defconfig2199
-rw-r--r--arch/powerpc/include/asm/firmware.h10
-rw-r--r--arch/powerpc/kernel/cputable.c2
-rw-r--r--arch/powerpc/kernel/entry_64.S44
-rw-r--r--arch/powerpc/kernel/kgdb.c6
-rw-r--r--arch/powerpc/kernel/pci-common.c2
-rw-r--r--arch/powerpc/kernel/pci_64.c2
-rw-r--r--arch/powerpc/kernel/perf_event.c17
-rw-r--r--arch/powerpc/kernel/process.c12
-rw-r--r--arch/powerpc/kernel/setup_64.c1
-rw-r--r--arch/powerpc/kernel/vdso.c11
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S4
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S1
-rw-r--r--arch/powerpc/mm/slb_low.S10
-rw-r--r--arch/powerpc/platforms/52xx/mpc5200_simple.c2
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c2
-rw-r--r--arch/powerpc/platforms/iseries/Makefile11
-rw-r--r--arch/powerpc/platforms/iseries/dt.c56
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c7
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c3
-rw-r--r--arch/powerpc/xmon/xmon.c20
-rw-r--r--arch/s390/include/asm/cputime.h6
-rw-r--r--arch/s390/kernel/ipl.c7
-rw-r--r--arch/s390/kernel/smp.c7
-rw-r--r--arch/s390/kernel/swsusp_asm64.S2
-rw-r--r--arch/sh/Kconfig6
-rw-r--r--arch/sh/Makefile3
-rw-r--r--arch/sh/boards/mach-landisk/gio.c10
-rw-r--r--arch/sh/boards/mach-rsk/devices-rsk7203.c4
-rw-r--r--arch/sh/boards/mach-rsk/setup.c23
-rw-r--r--arch/sh/boot/Makefile6
-rw-r--r--arch/sh/kernel/dwarf.c22
-rw-r--r--arch/sh/kernel/irq.c3
-rw-r--r--arch/sh/kernel/sh_ksyms_32.c14
-rw-r--r--arch/sh/mm/Kconfig2
-rw-r--r--arch/sh/mm/cache-sh4.c22
-rw-r--r--arch/sh/mm/cache.c10
-rw-r--r--arch/x86/Kconfig4
-rw-r--r--arch/x86/Kconfig.cpu2
-rw-r--r--arch/x86/Makefile1
-rw-r--r--arch/x86/boot/setup.ld3
-rw-r--r--arch/x86/crypto/aesni-intel_glue.c10
-rw-r--r--arch/x86/ia32/ia32entry.S5
-rw-r--r--arch/x86/include/asm/topology.h1
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h23
-rw-r--r--arch/x86/kernel/acpi/realmode/wakeup.lds.S7
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c8
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c3
-rw-r--r--arch/x86/kernel/crash_dump_32.c19
-rw-r--r--arch/x86/kernel/efi.c2
-rw-r--r--arch/x86/kernel/irq.c4
-rw-r--r--arch/x86/kernel/tlb_uv.c9
-rw-r--r--arch/x86/kernel/vmlinux.lds.S20
-rw-r--r--arch/x86/kvm/i8254.c2
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/mmu.c16
-rw-r--r--arch/x86/xen/enlighten.c3
-rw-r--r--block/blk-core.c2
-rw-r--r--crypto/async_tx/async_pq.c60
-rw-r--r--crypto/async_tx/async_raid6_recov.c100
-rw-r--r--crypto/async_tx/async_xor.c18
-rw-r--r--drivers/acpi/Kconfig4
-rw-r--r--drivers/acpi/ac.c1
-rw-r--r--drivers/acpi/button.c3
-rw-r--r--drivers/acpi/pci_root.c11
-rw-r--r--drivers/acpi/video.c7
-rw-r--r--drivers/acpi/video_detect.c2
-rw-r--r--drivers/ata/ahci.c3
-rw-r--r--drivers/ata/libata-core.c12
-rw-r--r--drivers/ata/libata-eh.c6
-rw-r--r--drivers/ata/pata_atiixp.c2
-rw-r--r--drivers/ata/pata_sc1200.c3
-rw-r--r--drivers/ata/pata_via.c2
-rw-r--r--drivers/ata/sata_mv.c29
-rw-r--r--drivers/ata/sata_nv.c18
-rw-r--r--drivers/base/bus.c17
-rw-r--r--drivers/base/driver.c2
-rw-r--r--drivers/base/platform.c6
-rw-r--r--drivers/base/power/main.c1
-rw-r--r--drivers/base/power/runtime.c4
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/virtio_blk.c39
-rw-r--r--drivers/char/Kconfig6
-rw-r--r--drivers/char/hw_random/virtio-rng.c3
-rw-r--r--drivers/char/virtio_console.c1
-rw-r--r--drivers/char/vt_ioctl.c2
-rw-r--r--drivers/cpuidle/cpuidle.c5
-rw-r--r--drivers/crypto/padlock-sha.c14
-rw-r--r--drivers/edac/amd64_edac.c8
-rw-r--r--drivers/edac/i5000_edac.c7
-rw-r--r--drivers/edac/i5400_edac.c89
-rw-r--r--drivers/edac/mpc85xx_edac.c2
-rw-r--r--drivers/gpio/twl4030-gpio.c5
-rw-r--r--drivers/gpu/drm/drm_edid.c15
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c42
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c5
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c25
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c7
-rw-r--r--drivers/hwmon/dme1737.c29
-rw-r--r--drivers/hwmon/fschmd.c2
-rw-r--r--drivers/hwmon/hp_accel.c5
-rw-r--r--drivers/hwmon/it87.c5
-rw-r--r--drivers/i2c/busses/i2c-imx.c86
-rw-r--r--drivers/i2c/busses/i2c-mpc.c10
-rw-r--r--drivers/ide/atiixp.c2
-rw-r--r--drivers/ide/cmd64x.c6
-rw-r--r--drivers/input/input.c65
-rw-r--r--drivers/input/keyboard/atkbd.c132
-rw-r--r--drivers/input/keyboard/gpio_keys.c1
-rw-r--r--drivers/input/misc/Kconfig1
-rw-r--r--drivers/input/misc/hp_sdc_rtc.c2
-rw-r--r--drivers/input/mouse/logips2pp.c2
-rw-r--r--drivers/input/mouse/synaptics.c10
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h13
-rw-r--r--drivers/input/serio/i8042.c35
-rw-r--r--drivers/isdn/i4l/isdn_net.h6
-rw-r--r--drivers/macintosh/via-pmu.c40
-rw-r--r--drivers/md/Makefile22
-rw-r--r--drivers/md/bitmap.c9
-rw-r--r--drivers/md/dm-exception-store.c38
-rw-r--r--drivers/md/dm-exception-store.h8
-rw-r--r--drivers/md/dm-log-userspace-base.c2
-rw-r--r--drivers/md/dm-snap-persistent.c16
-rw-r--r--drivers/md/dm-snap.c25
-rw-r--r--drivers/md/dm.c11
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/md/raid1.c6
-rw-r--r--drivers/md/raid10.c5
-rw-r--r--drivers/md/raid5.c182
-rw-r--r--drivers/md/raid5.h14
-rw-r--r--drivers/md/raid6altivec.uc2
-rw-r--r--drivers/md/raid6int.uc2
-rw-r--r--drivers/md/raid6test/Makefile42
-rw-r--r--drivers/md/unroll.awk20
-rw-r--r--drivers/md/unroll.pl24
-rw-r--r--drivers/mfd/twl4030-core.c2
-rw-r--r--drivers/mfd/wm831x-irq.c3
-rw-r--r--drivers/mmc/host/at91_mci.c1
-rw-r--r--drivers/mmc/host/omap_hsmmc.c2
-rw-r--r--drivers/mtd/ubi/build.c3
-rw-r--r--drivers/mtd/ubi/scan.c7
-rw-r--r--drivers/mtd/ubi/scan.h2
-rw-r--r--drivers/net/Kconfig11
-rw-r--r--drivers/net/Makefile10
-rw-r--r--drivers/net/acenic.c3
-rw-r--r--drivers/net/au1000_eth.c1
-rw-r--r--drivers/net/benet/be_cmds.c33
-rw-r--r--drivers/net/benet/be_cmds.h5
-rw-r--r--drivers/net/benet/be_main.c27
-rw-r--r--drivers/net/bnx2.h9
-rw-r--r--drivers/net/bonding/bond_main.c10
-rw-r--r--drivers/net/can/sja1000/sja1000_of_platform.c1
-rw-r--r--drivers/net/cnic.c6
-rw-r--r--drivers/net/davinci_emac.c36
-rw-r--r--drivers/net/dm9000.h2
-rw-r--r--drivers/net/e100.c26
-rw-r--r--drivers/net/e1000e/defines.h2
-rw-r--r--drivers/net/e1000e/e1000.h26
-rw-r--r--drivers/net/e1000e/hw.h3
-rw-r--r--drivers/net/e1000e/ich8lan.c628
-rw-r--r--drivers/net/e1000e/phy.c476
-rw-r--r--drivers/net/ethoc.c24
-rw-r--r--drivers/net/fec.c2
-rw-r--r--drivers/net/fec_mpc52xx.c6
-rw-r--r--drivers/net/fec_mpc52xx_phy.c1
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c1
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c1
-rw-r--r--drivers/net/fs_enet/mii-fec.c1
-rw-r--r--drivers/net/fsl_pq_mdio.c1
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/ibm_newemac/core.c9
-rw-r--r--drivers/net/ibm_newemac/emac.h1
-rw-r--r--drivers/net/ifb.c3
-rw-r--r--drivers/net/igb/igb_ethtool.c35
-rw-r--r--drivers/net/igbvf/ethtool.c30
-rw-r--r--drivers/net/irda/sa1100_ir.c7
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c22
-rw-r--r--drivers/net/ixp2000/enp2611.c18
-rw-r--r--drivers/net/ixp2000/ixpdev.c11
-rw-r--r--drivers/net/ks8851.c42
-rw-r--r--drivers/net/ks8851.h1
-rw-r--r--drivers/net/mlx4/main.c1
-rw-r--r--drivers/net/myri10ge/myri10ge.c17
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h1
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c14
-rw-r--r--drivers/net/netxen/netxen_nic_init.c8
-rw-r--r--drivers/net/netxen/netxen_nic_main.c4
-rw-r--r--drivers/net/niu.c2
-rw-r--r--drivers/net/pcmcia/3c574_cs.c13
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/phy/mdio-gpio.c1
-rw-r--r--drivers/net/pppoe.c129
-rw-r--r--drivers/net/qlge/qlge.h11
-rw-r--r--drivers/net/qlge/qlge_main.c175
-rw-r--r--drivers/net/qlge/qlge_mpi.c116
-rw-r--r--drivers/net/r8169.c1002
-rw-r--r--drivers/net/sfc/rx.c9
-rw-r--r--drivers/net/sh_eth.c1
-rw-r--r--drivers/net/sky2.c2
-rw-r--r--drivers/net/stmmac/Kconfig53
-rw-r--r--drivers/net/stmmac/Makefile4
-rw-r--r--drivers/net/stmmac/common.h330
-rw-r--r--drivers/net/stmmac/descs.h163
-rw-r--r--drivers/net/stmmac/gmac.c693
-rw-r--r--drivers/net/stmmac/gmac.h204
-rw-r--r--drivers/net/stmmac/mac100.c517
-rw-r--r--drivers/net/stmmac/mac100.h116
-rw-r--r--drivers/net/stmmac/stmmac.h98
-rw-r--r--drivers/net/stmmac/stmmac_ethtool.c395
-rw-r--r--drivers/net/stmmac/stmmac_main.c2204
-rw-r--r--drivers/net/stmmac/stmmac_mdio.c217
-rw-r--r--drivers/net/stmmac/stmmac_timer.c140
-rw-r--r--drivers/net/stmmac/stmmac_timer.h41
-rw-r--r--drivers/net/tokenring/ibmtr.c11
-rw-r--r--drivers/net/usb/dm9601.c4
-rw-r--r--drivers/net/usb/pegasus.c13
-rw-r--r--drivers/net/usb/pegasus.h6
-rw-r--r--drivers/net/usb/rndis_host.c6
-rw-r--r--drivers/net/virtio_net.c17
-rw-r--r--drivers/net/vmxnet3/Makefile35
-rw-r--r--drivers/net/vmxnet3/upt1_defs.h96
-rw-r--r--drivers/net/vmxnet3/vmxnet3_defs.h535
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c2574
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c566
-rw-r--r--drivers/net/vmxnet3/vmxnet3_int.h389
-rw-r--r--drivers/net/wan/hdlc_cisco.c18
-rw-r--r--drivers/net/wireless/adm8211.h2
-rw-r--r--drivers/net/wireless/airo.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c2
-rw-r--r--drivers/net/wireless/b43/b43.h168
-rw-r--r--drivers/net/wireless/b43/dma.c15
-rw-r--r--drivers/net/wireless/b43/leds.c4
-rw-r--r--drivers/net/wireless/b43/leds.h5
-rw-r--r--drivers/net/wireless/b43/main.c6
-rw-r--r--drivers/net/wireless/b43/pio.c78
-rw-r--r--drivers/net/wireless/b43/rfkill.c3
-rw-r--r--drivers/net/wireless/b43/xmit.c5
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c5
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c2
-rw-r--r--drivers/net/wireless/ipw2x00/libipw.h1
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_module.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c2
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c1
-rw-r--r--drivers/net/wireless/libertas/if_spi.c10
-rw-r--r--drivers/net/wireless/libertas/if_usb.c2
-rw-r--r--drivers/net/wireless/ray_cs.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c5
-rw-r--r--drivers/net/znet.c8
-rw-r--r--drivers/of/of_mdio.c13
-rw-r--r--drivers/pci/quirks.c6
-rw-r--r--drivers/pci/setup-bus.c13
-rw-r--r--drivers/pcmcia/cistpl.c20
-rw-r--r--drivers/pcmcia/cs.c69
-rw-r--r--drivers/pcmcia/cs_internal.h3
-rw-r--r--drivers/pcmcia/ds.c8
-rw-r--r--drivers/pcmcia/i82365.c4
-rw-r--r--drivers/pcmcia/m32r_cfc.c10
-rw-r--r--drivers/pcmcia/m32r_pcc.c10
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c15
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c2
-rw-r--r--drivers/pcmcia/pd6729.c6
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c3
-rw-r--r--drivers/pcmcia/soc_common.c5
-rw-r--r--drivers/pcmcia/socket_sysfs.c2
-rw-r--r--drivers/pcmcia/tcic.c4
-rw-r--r--drivers/pcmcia/yenta_socket.c12
-rw-r--r--drivers/platform/x86/eeepc-laptop.c31
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c2
-rw-r--r--drivers/s390/char/sclp_async.c47
-rw-r--r--drivers/s390/net/smsgiucv.c7
-rw-r--r--drivers/s390/scsi/zfcp_aux.c11
-rw-r--r--drivers/s390/scsi/zfcp_erp.c22
-rw-r--r--drivers/s390/scsi/zfcp_ext.h1
-rw-r--r--drivers/s390/scsi/zfcp_fc.c11
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c13
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c1
-rw-r--r--drivers/scsi/dpt_i2o.c4
-rw-r--r--drivers/scsi/scsi_scan.c2
-rw-r--r--drivers/scsi/scsi_sysfs.c7
-rw-r--r--drivers/serial/8250_pci.c78
-rw-r--r--drivers/serial/atmel_serial.c2
-rw-r--r--drivers/serial/mpc52xx_uart.c2
-rw-r--r--drivers/serial/serial_cs.c8
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/staging/android/Kconfig1
-rw-r--r--drivers/staging/b3dfg/b3dfg.c1
-rw-r--r--drivers/staging/comedi/drivers/me_daq.c1
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c1
-rw-r--r--drivers/staging/comedi/drivers/ni_pcidio.c1
-rw-r--r--drivers/staging/et131x/et1310_address_map.h2
-rw-r--r--drivers/staging/et131x/et1310_rx.c20
-rw-r--r--drivers/staging/hv/ChannelMgmt.h3
-rw-r--r--drivers/staging/hv/NetVsc.c10
-rw-r--r--drivers/staging/hv/TODO6
-rw-r--r--drivers/staging/hv/osd.c1
-rw-r--r--drivers/staging/hv/osd.h1
-rw-r--r--drivers/staging/hv/vmbus_drv.c28
-rw-r--r--drivers/staging/iio/industrialio-core.c2
-rw-r--r--drivers/staging/otus/Kconfig2
-rw-r--r--drivers/staging/panel/panel.c13
-rw-r--r--drivers/staging/poch/poch.c1
-rw-r--r--drivers/staging/rt2860/Kconfig2
-rw-r--r--drivers/staging/rt2860/common/cmm_data_2860.c2
-rw-r--r--drivers/staging/rt2860/common/cmm_info.c1
-rw-r--r--drivers/staging/rt2860/rt_linux.c1
-rw-r--r--drivers/staging/rt2870/Kconfig2
-rw-r--r--drivers/staging/rt3090/Kconfig2
-rw-r--r--drivers/staging/rt3090/common/cmm_info.c1
-rw-r--r--drivers/staging/rt3090/rt_linux.c1
-rw-r--r--drivers/staging/rtl8187se/Kconfig2
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c4
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_module.c4
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c12
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c17
-rw-r--r--drivers/staging/rtl8192e/Kconfig2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c8
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_module.c8
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c19
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c21
-rw-r--r--drivers/staging/rtl8192su/Kconfig2
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c4
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_module.c4
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c15
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c17
-rw-r--r--drivers/staging/sep/sep_driver.c1
-rw-r--r--drivers/staging/stlc45xx/Kconfig8
-rw-r--r--drivers/staging/stlc45xx/Makefile1
-rw-r--r--drivers/staging/stlc45xx/stlc45xx.c2594
-rw-r--r--drivers/staging/stlc45xx/stlc45xx.h283
-rw-r--r--drivers/staging/stlc45xx/stlc45xx_lmac.h434
-rw-r--r--drivers/staging/vme/bridges/vme_ca91cx42.c1
-rw-r--r--drivers/staging/vme/bridges/vme_tsi148.c1
-rw-r--r--drivers/staging/vt6656/main_usb.c1
-rw-r--r--drivers/staging/winbond/Kconfig2
-rw-r--r--drivers/staging/wlan-ng/Kconfig2
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/ether.c9
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c2
-rw-r--r--drivers/usb/host/ehci-sched.c12
-rw-r--r--drivers/usb/host/r8a66597-hcd.c23
-rw-r--r--drivers/usb/host/whci/asl.c23
-rw-r--r--drivers/usb/host/whci/pzl.c24
-rw-r--r--drivers/usb/serial/option.c8
-rw-r--r--drivers/usb/serial/sierra.c38
-rw-r--r--drivers/usb/storage/transport.c17
-rw-r--r--drivers/usb/wusbcore/security.c41
-rw-r--r--drivers/virtio/virtio_balloon.c3
-rw-r--r--drivers/virtio/virtio_pci.c27
-rw-r--r--drivers/virtio/virtio_ring.c3
-rw-r--r--firmware/Makefile6
-rw-r--r--firmware/WHENCE4
-rw-r--r--firmware/cis/PE-200.cis.ihex9
-rw-r--r--firmware/cis/SW_555_SER.cis.ihex12
-rw-r--r--firmware/cis/SW_7xx_SER.cis.ihex13
-rw-r--r--firmware/cis/SW_8xx_SER.cis.ihex13
-rw-r--r--fs/9p/vfs_dir.c93
-rw-r--r--fs/9p/vfs_inode.c5
-rw-r--r--fs/Kconfig4
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/btrfs/acl.c6
-rw-r--r--fs/btrfs/btrfs_inode.h6
-rw-r--r--fs/btrfs/ctree.h4
-rw-r--r--fs/btrfs/disk-io.c2
-rw-r--r--fs/btrfs/extent-tree.c17
-rw-r--r--fs/btrfs/file.c41
-rw-r--r--fs/btrfs/inode.c33
-rw-r--r--fs/btrfs/super.c9
-rw-r--r--fs/btrfs/transaction.c45
-rw-r--r--fs/btrfs/transaction.h5
-rw-r--r--fs/btrfs/tree-log.c48
-rw-r--r--fs/btrfs/tree-log.h3
-rw-r--r--fs/btrfs/xattr.c2
-rw-r--r--fs/cifs/connect.c3
-rw-r--r--fs/dlm/lowcomms.c36
-rw-r--r--fs/ext4/ext4.h1
-rw-r--r--fs/ext4/super.c20
-rw-r--r--fs/hfs/btree.c5
-rw-r--r--fs/hfsplus/wrapper.c4
-rw-r--r--fs/nfs/dir.c2
-rw-r--r--fs/nfs/direct.c1
-rw-r--r--fs/nfs/nfs4proc.c15
-rw-r--r--fs/nfs/nfs4xdr.c1
-rw-r--r--fs/nfs/super.c1
-rw-r--r--fs/nilfs2/btnode.c4
-rw-r--r--fs/nilfs2/segment.c17
-rw-r--r--fs/notify/dnotify/dnotify.c3
-rw-r--r--fs/notify/inode_mark.c6
-rw-r--r--fs/notify/notification.c2
-rw-r--r--fs/pipe.c41
-rw-r--r--fs/proc/meminfo.c2
-rw-r--r--fs/sysfs/dir.c3
-rw-r--r--fs/sysfs/file.c14
-rw-r--r--fs/xfs/linux-2.6/xfs_quotaops.c2
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c1
-rw-r--r--fs/xfs/xfs_ialloc.c1
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/cpufreq.h7
-rw-r--r--include/linux/device.h4
-rw-r--r--include/linux/moduleparam.h1
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/pci_ids.h13
-rw-r--r--include/linux/perf_event.h4
-rw-r--r--include/linux/prctl.h12
-rw-r--r--include/linux/rcutree.h6
-rw-r--r--include/linux/skbuff.h6
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/topology.h4
-rw-r--r--include/linux/trace_seq.h2
-rw-r--r--include/linux/virtio_9p.h1
-rw-r--r--include/linux/virtio_balloon.h1
-rw-r--r--include/linux/virtio_blk.h5
-rw-r--r--include/linux/virtio_console.h1
-rw-r--r--include/linux/virtio_net.h1
-rw-r--r--include/linux/virtio_rng.h1
-rw-r--r--include/net/9p/client.h7
-rw-r--r--include/net/inet_timewait_sock.h8
-rw-r--r--include/net/ip_fib.h3
-rw-r--r--include/net/mac80211.h2
-rw-r--r--include/net/sock.h10
-rw-r--r--include/pcmcia/ss.h4
-rw-r--r--init/Kconfig2
-rw-r--r--kernel/cgroup.c8
-rw-r--r--kernel/exit.c4
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/futex.c20
-rw-r--r--kernel/params.c17
-rw-r--r--kernel/perf_event.c66
-rw-r--r--kernel/power/hibernate.c11
-rw-r--r--kernel/power/suspend_test.c5
-rw-r--r--kernel/power/swap.c43
-rw-r--r--kernel/rcutree.c44
-rw-r--r--kernel/rcutree.h10
-rw-r--r--kernel/rcutree_plugin.h46
-rw-r--r--kernel/sched.c22
-rw-r--r--kernel/sched_fair.c27
-rw-r--r--kernel/sys.c25
-rw-r--r--kernel/sysctl_check.c2
-rw-r--r--kernel/trace/ftrace.c2
-rw-r--r--kernel/trace/ring_buffer.c12
-rw-r--r--kernel/trace/trace.c8
-rw-r--r--kernel/trace/trace_output.c5
-rw-r--r--kernel/workqueue.c23
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--mm/Kconfig4
-rw-r--r--mm/backing-dev.c16
-rw-r--r--mm/memory-failure.c59
-rw-r--r--mm/memory.c14
-rw-r--r--mm/mempolicy.c13
-rw-r--r--mm/nommu.c6
-rw-r--r--mm/page_alloc.c3
-rw-r--r--mm/percpu.c30
-rw-r--r--mm/swapfile.c3
-rw-r--r--mm/vmscan.c14
-rw-r--r--net/9p/client.c5
-rw-r--r--net/9p/trans_virtio.c1
-rw-r--r--net/bluetooth/hci_sysfs.c4
-rw-r--r--net/bluetooth/l2cap.c9
-rw-r--r--net/core/datagram.c10
-rw-r--r--net/core/pktgen.c15
-rw-r--r--net/ipv4/fib_frontend.c5
-rw-r--r--net/ipv4/inet_connection_sock.c34
-rw-r--r--net/ipv4/ip_gre.c28
-rw-r--r--net/ipv4/ip_sockglue.c7
-rw-r--r--net/ipv4/raw.c24
-rw-r--r--net/ipv4/route.c8
-rw-r--r--net/ipv4/tcp.c59
-rw-r--r--net/ipv4/tcp_minisocks.c4
-rw-r--r--net/ipv4/udp.c77
-rw-r--r--net/ipv6/ipv6_sockglue.c6
-rw-r--r--net/ipv6/udp.c4
-rw-r--r--net/mac80211/agg-tx.c19
-rw-r--r--net/mac80211/cfg.c6
-rw-r--r--net/mac80211/ht.c2
-rw-r--r--net/mac80211/ibss.c14
-rw-r--r--net/mac80211/mesh_hwmp.c2
-rw-r--r--net/mac80211/mlme.c3
-rw-r--r--net/mac80211/rx.c12
-rw-r--r--net/mac80211/sta_info.c2
-rw-r--r--net/mac80211/tx.c5
-rw-r--r--net/mac80211/util.c4
-rw-r--r--net/packet/af_packet.c5
-rw-r--r--net/sched/act_pedit.c2
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sunrpc/svcsock.c10
-rw-r--r--net/unix/af_unix.c2
-rw-r--r--net/wireless/core.h1
-rw-r--r--net/wireless/mlme.c9
-rw-r--r--net/wireless/nl80211.c3
-rw-r--r--net/wireless/sme.c24
-rwxr-xr-xscripts/checkpatch.pl84
-rwxr-xr-xscripts/get_maintainer.pl37
-rw-r--r--security/keys/keyctl.c2
-rw-r--r--sound/core/pcm.c5
-rw-r--r--sound/drivers/dummy.c4
-rw-r--r--sound/drivers/pcsp/pcsp_lib.c65
-rw-r--r--sound/drivers/pcsp/pcsp_mixer.c2
-rw-r--r--sound/parisc/harmony.c6
-rw-r--r--sound/pci/Kconfig1
-rw-r--r--sound/pci/ali5451/ali5451.c2
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/pci/hda/patch_realtek.c7
-rw-r--r--sound/pci/via82xx.c59
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c21
-rw-r--r--sound/pcmcia/vx/vxpocket.c21
-rw-r--r--sound/ppc/Kconfig2
-rw-r--r--sound/soc/omap/Kconfig13
-rw-r--r--sound/soc/s3c24xx/s3c24xx-pcm.c17
-rw-r--r--sound/soc/soc-core.c11
-rw-r--r--sound/soc/soc-dapm.c2
-rw-r--r--sound/usb/caiaq/audio.c16
-rw-r--r--sound/usb/caiaq/device.c2
-rw-r--r--tools/perf/Makefile15
-rw-r--r--tools/perf/util/symbol.c6
-rw-r--r--tools/perf/util/symbol.h10
-rw-r--r--virt/kvm/kvm_main.c7
710 files changed, 20552 insertions, 7285 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-usb_host b/Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc
index 46b66ad1f1b4..4e8106f7cfd9 100644
--- a/Documentation/ABI/testing/sysfs-class-usb_host
+++ b/Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc
@@ -1,4 +1,4 @@
1What: /sys/class/usb_host/usb_hostN/wusb_chid 1What: /sys/class/uwb_rc/uwbN/wusbhc/wusb_chid
2Date: July 2008 2Date: July 2008
3KernelVersion: 2.6.27 3KernelVersion: 2.6.27
4Contact: David Vrabel <david.vrabel@csr.com> 4Contact: David Vrabel <david.vrabel@csr.com>
@@ -9,7 +9,7 @@ Description:
9 9
10 Set an all zero CHID to stop the host controller. 10 Set an all zero CHID to stop the host controller.
11 11
12What: /sys/class/usb_host/usb_hostN/wusb_trust_timeout 12What: /sys/class/uwb_rc/uwbN/wusbhc/wusb_trust_timeout
13Date: July 2008 13Date: July 2008
14KernelVersion: 2.6.27 14KernelVersion: 2.6.27
15Contact: David Vrabel <david.vrabel@csr.com> 15Contact: David Vrabel <david.vrabel@csr.com>
diff --git a/Documentation/ABI/testing/sysfs-devices-cache_disable b/Documentation/ABI/testing/sysfs-devices-cache_disable
deleted file mode 100644
index 175bb4f70512..000000000000
--- a/Documentation/ABI/testing/sysfs-devices-cache_disable
+++ /dev/null
@@ -1,18 +0,0 @@
1What: /sys/devices/system/cpu/cpu*/cache/index*/cache_disable_X
2Date: August 2008
3KernelVersion: 2.6.27
4Contact: mark.langsdorf@amd.com
5Description: These files exist in every cpu's cache index directories.
6 There are currently 2 cache_disable_# files in each
7 directory. Reading from these files on a supported
8 processor will return that cache disable index value
9 for that processor and node. Writing to one of these
10 files will cause the specificed cache index to be disabled.
11
12 Currently, only AMD Family 10h Processors support cache index
13 disable, and only for their L3 caches. See the BIOS and
14 Kernel Developer's Guide at
15 http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/31116-Public-GH-BKDG_3.20_2-4-09.pdf
16 for formatting information and other details on the
17 cache index disable.
18Users: joachim.deguara@amd.com
diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
new file mode 100644
index 000000000000..a703b9e9aeb9
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -0,0 +1,156 @@
1What: /sys/devices/system/cpu/
2Date: pre-git history
3Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
4Description:
5 A collection of both global and individual CPU attributes
6
7 Individual CPU attributes are contained in subdirectories
8 named by the kernel's logical CPU number, e.g.:
9
10 /sys/devices/system/cpu/cpu#/
11
12What: /sys/devices/system/cpu/sched_mc_power_savings
13 /sys/devices/system/cpu/sched_smt_power_savings
14Date: June 2006
15Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
16Description: Discover and adjust the kernel's multi-core scheduler support.
17
18 Possible values are:
19
20 0 - No power saving load balance (default value)
21 1 - Fill one thread/core/package first for long running threads
22 2 - Also bias task wakeups to semi-idle cpu package for power
23 savings
24
25 sched_mc_power_savings is dependent upon SCHED_MC, which is
26 itself architecture dependent.
27
28 sched_smt_power_savings is dependent upon SCHED_SMT, which
29 is itself architecture dependent.
30
31 The two files are independent of each other. It is possible
32 that one file may be present without the other.
33
34 Introduced by git commit 5c45bf27.
35
36
37What: /sys/devices/system/cpu/kernel_max
38 /sys/devices/system/cpu/offline
39 /sys/devices/system/cpu/online
40 /sys/devices/system/cpu/possible
41 /sys/devices/system/cpu/present
42Date: December 2008
43Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
44Description: CPU topology files that describe kernel limits related to
45 hotplug. Briefly:
46
47 kernel_max: the maximum cpu index allowed by the kernel
48 configuration.
49
50 offline: cpus that are not online because they have been
51 HOTPLUGGED off or exceed the limit of cpus allowed by the
52 kernel configuration (kernel_max above).
53
54 online: cpus that are online and being scheduled.
55
56 possible: cpus that have been allocated resources and can be
57 brought online if they are present.
58
59 present: cpus that have been identified as being present in
60 the system.
61
62 See Documentation/cputopology.txt for more information.
63
64
65
66What: /sys/devices/system/cpu/cpu#/node
67Date: October 2009
68Contact: Linux memory management mailing list <linux-mm@kvack.org>
69Description: Discover NUMA node a CPU belongs to
70
71 When CONFIG_NUMA is enabled, a symbolic link that points
72 to the corresponding NUMA node directory.
73
74 For example, the following symlink is created for cpu42
75 in NUMA node 2:
76
77 /sys/devices/system/cpu/cpu42/node2 -> ../../node/node2
78
79
80What: /sys/devices/system/cpu/cpu#/topology/core_id
81 /sys/devices/system/cpu/cpu#/topology/core_siblings
82 /sys/devices/system/cpu/cpu#/topology/core_siblings_list
83 /sys/devices/system/cpu/cpu#/topology/physical_package_id
84 /sys/devices/system/cpu/cpu#/topology/thread_siblings
85 /sys/devices/system/cpu/cpu#/topology/thread_siblings_list
86Date: December 2008
87Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
88Description: CPU topology files that describe a logical CPU's relationship
89 to other cores and threads in the same physical package.
90
91 One cpu# directory is created per logical CPU in the system,
92 e.g. /sys/devices/system/cpu/cpu42/.
93
94 Briefly, the files above are:
95
96 core_id: the CPU core ID of cpu#. Typically it is the
97 hardware platform's identifier (rather than the kernel's).
98 The actual value is architecture and platform dependent.
99
100 core_siblings: internal kernel map of cpu#'s hardware threads
101 within the same physical_package_id.
102
103 core_siblings_list: human-readable list of the logical CPU
104 numbers within the same physical_package_id as cpu#.
105
106 physical_package_id: physical package id of cpu#. Typically
107 corresponds to a physical socket number, but the actual value
108 is architecture and platform dependent.
109
110 thread_siblings: internel kernel map of cpu#'s hardware
111 threads within the same core as cpu#
112
113 thread_siblings_list: human-readable list of cpu#'s hardware
114 threads within the same core as cpu#
115
116 See Documentation/cputopology.txt for more information.
117
118
119What: /sys/devices/system/cpu/cpuidle/current_driver
120 /sys/devices/system/cpu/cpuidle/current_governer_ro
121Date: September 2007
122Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
123Description: Discover cpuidle policy and mechanism
124
125 Various CPUs today support multiple idle levels that are
126 differentiated by varying exit latencies and power
127 consumption during idle.
128
129 Idle policy (governor) is differentiated from idle mechanism
130 (driver)
131
132 current_driver: displays current idle mechanism
133
134 current_governor_ro: displays current idle policy
135
136 See files in Documentation/cpuidle/ for more information.
137
138
139What: /sys/devices/system/cpu/cpu*/cache/index*/cache_disable_X
140Date: August 2008
141KernelVersion: 2.6.27
142Contact: mark.langsdorf@amd.com
143Description: These files exist in every cpu's cache index directories.
144 There are currently 2 cache_disable_# files in each
145 directory. Reading from these files on a supported
146 processor will return that cache disable index value
147 for that processor and node. Writing to one of these
148 files will cause the specificed cache index to be disabled.
149
150 Currently, only AMD Family 10h Processors support cache index
151 disable, and only for their L3 caches. See the BIOS and
152 Kernel Developer's Guide at
153 http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/31116-Public-GH-BKDG_3.20_2-4-09.pdf
154 for formatting information and other details on the
155 cache index disable.
156Users: joachim.deguara@amd.com
diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt
index b41f3e58aefa..f1c5c4bccd3e 100644
--- a/Documentation/cputopology.txt
+++ b/Documentation/cputopology.txt
@@ -1,15 +1,28 @@
1 1
2Export cpu topology info via sysfs. Items (attributes) are similar 2Export CPU topology info via sysfs. Items (attributes) are similar
3to /proc/cpuinfo. 3to /proc/cpuinfo.
4 4
51) /sys/devices/system/cpu/cpuX/topology/physical_package_id: 51) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
6represent the physical package id of cpu X; 6
7 physical package id of cpuX. Typically corresponds to a physical
8 socket number, but the actual value is architecture and platform
9 dependent.
10
72) /sys/devices/system/cpu/cpuX/topology/core_id: 112) /sys/devices/system/cpu/cpuX/topology/core_id:
8represent the cpu core id to cpu X; 12
13 the CPU core ID of cpuX. Typically it is the hardware platform's
14 identifier (rather than the kernel's). The actual value is
15 architecture and platform dependent.
16
93) /sys/devices/system/cpu/cpuX/topology/thread_siblings: 173) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
10represent the thread siblings to cpu X in the same core; 18
19 internel kernel map of cpuX's hardware threads within the same
20 core as cpuX
21
114) /sys/devices/system/cpu/cpuX/topology/core_siblings: 224) /sys/devices/system/cpu/cpuX/topology/core_siblings:
12represent the thread siblings to cpu X in the same physical package; 23
24 internal kernel map of cpuX's hardware threads within the same
25 physical_package_id.
13 26
14To implement it in an architecture-neutral way, a new source file, 27To implement it in an architecture-neutral way, a new source file,
15drivers/base/topology.c, is to export the 4 attributes. 28drivers/base/topology.c, is to export the 4 attributes.
@@ -32,32 +45,32 @@ not defined by include/asm-XXX/topology.h:
323) thread_siblings: just the given CPU 453) thread_siblings: just the given CPU
334) core_siblings: just the given CPU 464) core_siblings: just the given CPU
34 47
35Additionally, cpu topology information is provided under 48Additionally, CPU topology information is provided under
36/sys/devices/system/cpu and includes these files. The internal 49/sys/devices/system/cpu and includes these files. The internal
37source for the output is in brackets ("[]"). 50source for the output is in brackets ("[]").
38 51
39 kernel_max: the maximum cpu index allowed by the kernel configuration. 52 kernel_max: the maximum CPU index allowed by the kernel configuration.
40 [NR_CPUS-1] 53 [NR_CPUS-1]
41 54
42 offline: cpus that are not online because they have been 55 offline: CPUs that are not online because they have been
43 HOTPLUGGED off (see cpu-hotplug.txt) or exceed the limit 56 HOTPLUGGED off (see cpu-hotplug.txt) or exceed the limit
44 of cpus allowed by the kernel configuration (kernel_max 57 of CPUs allowed by the kernel configuration (kernel_max
45 above). [~cpu_online_mask + cpus >= NR_CPUS] 58 above). [~cpu_online_mask + cpus >= NR_CPUS]
46 59
47 online: cpus that are online and being scheduled [cpu_online_mask] 60 online: CPUs that are online and being scheduled [cpu_online_mask]
48 61
49 possible: cpus that have been allocated resources and can be 62 possible: CPUs that have been allocated resources and can be
50 brought online if they are present. [cpu_possible_mask] 63 brought online if they are present. [cpu_possible_mask]
51 64
52 present: cpus that have been identified as being present in the 65 present: CPUs that have been identified as being present in the
53 system. [cpu_present_mask] 66 system. [cpu_present_mask]
54 67
55The format for the above output is compatible with cpulist_parse() 68The format for the above output is compatible with cpulist_parse()
56[see <linux/cpumask.h>]. Some examples follow. 69[see <linux/cpumask.h>]. Some examples follow.
57 70
58In this example, there are 64 cpus in the system but cpus 32-63 exceed 71In this example, there are 64 CPUs in the system but cpus 32-63 exceed
59the kernel max which is limited to 0..31 by the NR_CPUS config option 72the kernel max which is limited to 0..31 by the NR_CPUS config option
60being 32. Note also that cpus 2 and 4-31 are not online but could be 73being 32. Note also that CPUs 2 and 4-31 are not online but could be
61brought online as they are both present and possible. 74brought online as they are both present and possible.
62 75
63 kernel_max: 31 76 kernel_max: 31
@@ -67,8 +80,8 @@ brought online as they are both present and possible.
67 present: 0-31 80 present: 0-31
68 81
69In this example, the NR_CPUS config option is 128, but the kernel was 82In this example, the NR_CPUS config option is 128, but the kernel was
70started with possible_cpus=144. There are 4 cpus in the system and cpu2 83started with possible_cpus=144. There are 4 CPUs in the system and cpu2
71was manually taken offline (and is the only cpu that can be brought 84was manually taken offline (and is the only CPU that can be brought
72online.) 85online.)
73 86
74 kernel_max: 127 87 kernel_max: 127
@@ -78,4 +91,4 @@ online.)
78 present: 0-3 91 present: 0-3
79 92
80See cpu-hotplug.txt for the possible_cpus=NUM kernel start parameter 93See cpu-hotplug.txt for the possible_cpus=NUM kernel start parameter
81as well as more information on the various cpumask's. 94as well as more information on the various cpumasks.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 04e6c819b28a..bc693fffabe0 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -418,6 +418,14 @@ When: 2.6.33
418Why: Should be implemented in userspace, policy daemon. 418Why: Should be implemented in userspace, policy daemon.
419Who: Johannes Berg <johannes@sipsolutions.net> 419Who: Johannes Berg <johannes@sipsolutions.net>
420 420
421---------------------------
422
423What: CONFIG_INOTIFY
424When: 2.6.33
425Why: last user (audit) will be converted to the newer more generic
426 and more easily maintained fsnotify subsystem
427Who: Eric Paris <eparis@redhat.com>
428
421---------------------------- 429----------------------------
422 430
423What: lock_policy_rwsem_* and unlock_policy_rwsem_* will not be 431What: lock_policy_rwsem_* and unlock_policy_rwsem_* will not be
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index bf4f4b7e11b3..6d94e0696f8c 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -134,9 +134,15 @@ ro Mount filesystem read only. Note that ext4 will
134 mount options "ro,noload" can be used to prevent 134 mount options "ro,noload" can be used to prevent
135 writes to the filesystem. 135 writes to the filesystem.
136 136
137journal_checksum Enable checksumming of the journal transactions.
138 This will allow the recovery code in e2fsck and the
139 kernel to detect corruption in the kernel. It is a
140 compatible change and will be ignored by older kernels.
141
137journal_async_commit Commit block can be written to disk without waiting 142journal_async_commit Commit block can be written to disk without waiting
138 for descriptor blocks. If enabled older kernels cannot 143 for descriptor blocks. If enabled older kernels cannot
139 mount the device. 144 mount the device. This will enable 'journal_checksum'
145 internally.
140 146
141journal=update Update the ext4 file system's journal to the current 147journal=update Update the ext4 file system's journal to the current
142 format. 148 format.
diff --git a/Documentation/flexible-arrays.txt b/Documentation/flexible-arrays.txt
index 84eb26808dee..cb8a3a00cc92 100644
--- a/Documentation/flexible-arrays.txt
+++ b/Documentation/flexible-arrays.txt
@@ -1,5 +1,5 @@
1Using flexible arrays in the kernel 1Using flexible arrays in the kernel
2Last updated for 2.6.31 2Last updated for 2.6.32
3Jonathan Corbet <corbet@lwn.net> 3Jonathan Corbet <corbet@lwn.net>
4 4
5Large contiguous memory allocations can be unreliable in the Linux kernel. 5Large contiguous memory allocations can be unreliable in the Linux kernel.
@@ -40,6 +40,13 @@ argument is passed directly to the internal memory allocation calls. With
40the current code, using flags to ask for high memory is likely to lead to 40the current code, using flags to ask for high memory is likely to lead to
41notably unpleasant side effects. 41notably unpleasant side effects.
42 42
43It is also possible to define flexible arrays at compile time with:
44
45 DEFINE_FLEX_ARRAY(name, element_size, total);
46
47This macro will result in a definition of an array with the given name; the
48element size and total will be checked for validity at compile time.
49
43Storing data into a flexible array is accomplished with a call to: 50Storing data into a flexible array is accomplished with a call to:
44 51
45 int flex_array_put(struct flex_array *array, unsigned int element_nr, 52 int flex_array_put(struct flex_array *array, unsigned int element_nr,
@@ -76,16 +83,30 @@ particular element has never been allocated.
76Note that it is possible to get back a valid pointer for an element which 83Note that it is possible to get back a valid pointer for an element which
77has never been stored in the array. Memory for array elements is allocated 84has never been stored in the array. Memory for array elements is allocated
78one page at a time; a single allocation could provide memory for several 85one page at a time; a single allocation could provide memory for several
79adjacent elements. The flexible array code does not know if a specific 86adjacent elements. Flexible array elements are normally initialized to the
80element has been written; it only knows if the associated memory is 87value FLEX_ARRAY_FREE (defined as 0x6c in <linux/poison.h>), so errors
81present. So a flex_array_get() call on an element which was never stored 88involving that number probably result from use of unstored array entries.
82in the array has the potential to return a pointer to random data. If the 89Note that, if array elements are allocated with __GFP_ZERO, they will be
83caller does not have a separate way to know which elements were actually 90initialized to zero and this poisoning will not happen.
84stored, it might be wise, at least, to add GFP_ZERO to the flags argument 91
85to ensure that all elements are zeroed. 92Individual elements in the array can be cleared with:
86 93
87There is no way to remove a single element from the array. It is possible, 94 int flex_array_clear(struct flex_array *array, unsigned int element_nr);
88though, to remove all elements with a call to: 95
96This function will set the given element to FLEX_ARRAY_FREE and return
97zero. If storage for the indicated element is not allocated for the array,
98flex_array_clear() will return -EINVAL instead. Note that clearing an
99element does not release the storage associated with it; to reduce the
100allocated size of an array, call:
101
102 int flex_array_shrink(struct flex_array *array);
103
104The return value will be the number of pages of memory actually freed.
105This function works by scanning the array for pages containing nothing but
106FLEX_ARRAY_FREE bytes, so (1) it can be expensive, and (2) it will not work
107if the array's pages are allocated with __GFP_ZERO.
108
109It is possible to remove all elements of an array with a call to:
89 110
90 void flex_array_free_parts(struct flex_array *array); 111 void flex_array_free_parts(struct flex_array *array);
91 112
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
index dcbd502c8792..82def883361b 100644
--- a/Documentation/hwmon/sysfs-interface
+++ b/Documentation/hwmon/sysfs-interface
@@ -353,10 +353,20 @@ power[1-*]_average Average power use
353 Unit: microWatt 353 Unit: microWatt
354 RO 354 RO
355 355
356power[1-*]_average_interval Power use averaging interval 356power[1-*]_average_interval Power use averaging interval. A poll
357 notification is sent to this file if the
358 hardware changes the averaging interval.
357 Unit: milliseconds 359 Unit: milliseconds
358 RW 360 RW
359 361
362power[1-*]_average_interval_max Maximum power use averaging interval
363 Unit: milliseconds
364 RO
365
366power[1-*]_average_interval_min Minimum power use averaging interval
367 Unit: milliseconds
368 RO
369
360power[1-*]_average_highest Historical average maximum power use 370power[1-*]_average_highest Historical average maximum power use
361 Unit: microWatt 371 Unit: microWatt
362 RO 372 RO
@@ -365,6 +375,18 @@ power[1-*]_average_lowest Historical average minimum power use
365 Unit: microWatt 375 Unit: microWatt
366 RO 376 RO
367 377
378power[1-*]_average_max A poll notification is sent to
379 power[1-*]_average when power use
380 rises above this value.
381 Unit: microWatt
382 RW
383
384power[1-*]_average_min A poll notification is sent to
385 power[1-*]_average when power use
386 sinks below this value.
387 Unit: microWatt
388 RW
389
368power[1-*]_input Instantaneous power use 390power[1-*]_input Instantaneous power use
369 Unit: microWatt 391 Unit: microWatt
370 RO 392 RO
@@ -381,6 +403,39 @@ power[1-*]_reset_history Reset input_highest, input_lowest,
381 average_highest and average_lowest. 403 average_highest and average_lowest.
382 WO 404 WO
383 405
406power[1-*]_accuracy Accuracy of the power meter.
407 Unit: Percent
408 RO
409
410power[1-*]_alarm 1 if the system is drawing more power than the
411 cap allows; 0 otherwise. A poll notification is
412 sent to this file when the power use exceeds the
413 cap. This file only appears if the cap is known
414 to be enforced by hardware.
415 RO
416
417power[1-*]_cap If power use rises above this limit, the
418 system should take action to reduce power use.
419 A poll notification is sent to this file if the
420 cap is changed by the hardware. The *_cap
421 files only appear if the cap is known to be
422 enforced by hardware.
423 Unit: microWatt
424 RW
425
426power[1-*]_cap_hyst Margin of hysteresis built around capping and
427 notification.
428 Unit: microWatt
429 RW
430
431power[1-*]_cap_max Maximum cap that can be set.
432 Unit: microWatt
433 RO
434
435power[1-*]_cap_min Minimum cap that can be set.
436 Unit: microWatt
437 RO
438
384********** 439**********
385* Energy * 440* Energy *
386********** 441**********
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index ba9373f82ab5..098de5bce00a 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -42,7 +42,6 @@
42#include <signal.h> 42#include <signal.h>
43#include "linux/lguest_launcher.h" 43#include "linux/lguest_launcher.h"
44#include "linux/virtio_config.h" 44#include "linux/virtio_config.h"
45#include <linux/virtio_ids.h>
46#include "linux/virtio_net.h" 45#include "linux/virtio_net.h"
47#include "linux/virtio_blk.h" 46#include "linux/virtio_blk.h"
48#include "linux/virtio_console.h" 47#include "linux/virtio_console.h"
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 1c8eb4518ce0..fd9a2f67edf2 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -522,7 +522,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
522 pcm_devs - Number of PCM devices assigned to each card 522 pcm_devs - Number of PCM devices assigned to each card
523 (default = 1, up to 4) 523 (default = 1, up to 4)
524 pcm_substreams - Number of PCM substreams assigned to each PCM 524 pcm_substreams - Number of PCM substreams assigned to each PCM
525 (default = 8, up to 16) 525 (default = 8, up to 128)
526 hrtimer - Use hrtimer (=1, default) or system timer (=0) 526 hrtimer - Use hrtimer (=1, default) or system timer (=0)
527 fake_buffer - Fake buffer allocations (default = 1) 527 fake_buffer - Fake buffer allocations (default = 1)
528 528
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index 957b22fde2df..8179692fbb90 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -1231,6 +1231,7 @@ something like this simple program:
1231#include <sys/stat.h> 1231#include <sys/stat.h>
1232#include <fcntl.h> 1232#include <fcntl.h>
1233#include <unistd.h> 1233#include <unistd.h>
1234#include <string.h>
1234 1235
1235#define _STR(x) #x 1236#define _STR(x) #x
1236#define STR(x) _STR(x) 1237#define STR(x) _STR(x)
@@ -1265,6 +1266,7 @@ const char *find_debugfs(void)
1265 return NULL; 1266 return NULL;
1266 } 1267 }
1267 1268
1269 strcat(debugfs, "/tracing/");
1268 debugfs_found = 1; 1270 debugfs_found = 1;
1269 1271
1270 return debugfs; 1272 return debugfs;
diff --git a/Documentation/vm/hwpoison.txt b/Documentation/vm/hwpoison.txt
new file mode 100644
index 000000000000..3ffadf8da61f
--- /dev/null
+++ b/Documentation/vm/hwpoison.txt
@@ -0,0 +1,136 @@
1What is hwpoison?
2
3Upcoming Intel CPUs have support for recovering from some memory errors
4(``MCA recovery''). This requires the OS to declare a page "poisoned",
5kill the processes associated with it and avoid using it in the future.
6
7This patchkit implements the necessary infrastructure in the VM.
8
9To quote the overview comment:
10
11 * High level machine check handler. Handles pages reported by the
12 * hardware as being corrupted usually due to a 2bit ECC memory or cache
13 * failure.
14 *
15 * This focusses on pages detected as corrupted in the background.
16 * When the current CPU tries to consume corruption the currently
17 * running process can just be killed directly instead. This implies
18 * that if the error cannot be handled for some reason it's safe to
19 * just ignore it because no corruption has been consumed yet. Instead
20 * when that happens another machine check will happen.
21 *
22 * Handles page cache pages in various states. The tricky part
23 * here is that we can access any page asynchronous to other VM
24 * users, because memory failures could happen anytime and anywhere,
25 * possibly violating some of their assumptions. This is why this code
26 * has to be extremely careful. Generally it tries to use normal locking
27 * rules, as in get the standard locks, even if that means the
28 * error handling takes potentially a long time.
29 *
30 * Some of the operations here are somewhat inefficient and have non
31 * linear algorithmic complexity, because the data structures have not
32 * been optimized for this case. This is in particular the case
33 * for the mapping from a vma to a process. Since this case is expected
34 * to be rare we hope we can get away with this.
35
36The code consists of a the high level handler in mm/memory-failure.c,
37a new page poison bit and various checks in the VM to handle poisoned
38pages.
39
40The main target right now is KVM guests, but it works for all kinds
41of applications. KVM support requires a recent qemu-kvm release.
42
43For the KVM use there was need for a new signal type so that
44KVM can inject the machine check into the guest with the proper
45address. This in theory allows other applications to handle
46memory failures too. The expection is that near all applications
47won't do that, but some very specialized ones might.
48
49---
50
51There are two (actually three) modi memory failure recovery can be in:
52
53vm.memory_failure_recovery sysctl set to zero:
54 All memory failures cause a panic. Do not attempt recovery.
55 (on x86 this can be also affected by the tolerant level of the
56 MCE subsystem)
57
58early kill
59 (can be controlled globally and per process)
60 Send SIGBUS to the application as soon as the error is detected
61 This allows applications who can process memory errors in a gentle
62 way (e.g. drop affected object)
63 This is the mode used by KVM qemu.
64
65late kill
66 Send SIGBUS when the application runs into the corrupted page.
67 This is best for memory error unaware applications and default
68 Note some pages are always handled as late kill.
69
70---
71
72User control:
73
74vm.memory_failure_recovery
75 See sysctl.txt
76
77vm.memory_failure_early_kill
78 Enable early kill mode globally
79
80PR_MCE_KILL
81 Set early/late kill mode/revert to system default
82 arg1: PR_MCE_KILL_CLEAR: Revert to system default
83 arg1: PR_MCE_KILL_SET: arg2 defines thread specific mode
84 PR_MCE_KILL_EARLY: Early kill
85 PR_MCE_KILL_LATE: Late kill
86 PR_MCE_KILL_DEFAULT: Use system global default
87PR_MCE_KILL_GET
88 return current mode
89
90
91---
92
93Testing:
94
95madvise(MADV_POISON, ....)
96 (as root)
97 Poison a page in the process for testing
98
99
100hwpoison-inject module through debugfs
101 /sys/debug/hwpoison/corrupt-pfn
102
103Inject hwpoison fault at PFN echoed into this file
104
105
106Architecture specific MCE injector
107
108x86 has mce-inject, mce-test
109
110Some portable hwpoison test programs in mce-test, see blow.
111
112---
113
114References:
115
116http://halobates.de/mce-lc09-2.pdf
117 Overview presentation from LinuxCon 09
118
119git://git.kernel.org/pub/scm/utils/cpu/mce/mce-test.git
120 Test suite (hwpoison specific portable tests in tsrc)
121
122git://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git
123 x86 specific injector
124
125
126---
127
128Limitations:
129
130- Not all page types are supported and never will. Most kernel internal
131objects cannot be recovered, only LRU pages for now.
132- Right now hugepage support is missing.
133
134---
135Andi Kleen, Oct 2009
136
diff --git a/MAINTAINERS b/MAINTAINERS
index d5eb8c13ef05..a1a2aceca5bd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -65,43 +65,51 @@ trivial patch so apply some common sense.
65 65
668. Happy hacking. 668. Happy hacking.
67 67
68 ----------------------------------- 68Descriptions of section entries:
69 69
70Maintainers List (try to look for most precise areas first) 70 P: Person (obsolete)
71 M: Mail patches to: FullName <address@domain>
72 L: Mailing list that is relevant to this area
73 W: Web-page with status/info
74 T: SCM tree type and location. Type is one of: git, hg, quilt, stgit.
75 S: Status, one of the following:
76 Supported: Someone is actually paid to look after this.
77 Maintained: Someone actually looks after it.
78 Odd Fixes: It has a maintainer but they don't have time to do
79 much other than throw the odd patch in. See below..
80 Orphan: No current maintainer [but maybe you could take the
81 role as you write your new code].
82 Obsolete: Old code. Something tagged obsolete generally means
83 it has been replaced by a better system and you
84 should be using that.
85 F: Files and directories with wildcard patterns.
86 A trailing slash includes all files and subdirectory files.
87 F: drivers/net/ all files in and below drivers/net
88 F: drivers/net/* all files in drivers/net, but not below
89 F: */net/* all files in "any top level directory"/net
90 One pattern per line. Multiple F: lines acceptable.
91 X: Files and directories that are NOT maintained, same rules as F:
92 Files exclusions are tested before file matches.
93 Can be useful for excluding a specific subdirectory, for instance:
94 F: net/
95 X: net/ipv6/
96 matches all files in and below net excluding net/ipv6/
97 K: Keyword perl extended regex pattern to match content in a
98 patch or file. For instance:
99 K: of_get_profile
100 matches patches or files that contain "of_get_profile"
101 K: \b(printk|pr_(info|err))\b
102 matches patches or files that contain one or more of the words
103 printk, pr_info or pr_err
104 One regex pattern per line. Multiple K: lines acceptable.
71 105
72Note: For the hard of thinking, this list is meant to remain in alphabetical 106Note: For the hard of thinking, this list is meant to remain in alphabetical
73order. If you could add yourselves to it in alphabetical order that would be 107order. If you could add yourselves to it in alphabetical order that would be
74so much easier [Ed] 108so much easier [Ed]
75 109
76P: Person (obsolete) 110Maintainers List (try to look for most precise areas first)
77M: Mail patches to: FullName <address@domain>
78L: Mailing list that is relevant to this area
79W: Web-page with status/info
80T: SCM tree type and location. Type is one of: git, hg, quilt, stgit.
81S: Status, one of the following:
82
83 Supported: Someone is actually paid to look after this.
84 Maintained: Someone actually looks after it.
85 Odd Fixes: It has a maintainer but they don't have time to do
86 much other than throw the odd patch in. See below..
87 Orphan: No current maintainer [but maybe you could take the
88 role as you write your new code].
89 Obsolete: Old code. Something tagged obsolete generally means
90 it has been replaced by a better system and you
91 should be using that.
92 111
93F: Files and directories with wildcard patterns. 112 -----------------------------------
94 A trailing slash includes all files and subdirectory files.
95 F: drivers/net/ all files in and below drivers/net
96 F: drivers/net/* all files in drivers/net, but not below
97 F: */net/* all files in "any top level directory"/net
98 One pattern per line. Multiple F: lines acceptable.
99X: Files and directories that are NOT maintained, same rules as F:
100 Files exclusions are tested before file matches.
101 Can be useful for excluding a specific subdirectory, for instance:
102 F: net/
103 X: net/ipv6/
104 matches all files in and below net excluding net/ipv6/
105 113
1063C505 NETWORK DRIVER 1143C505 NETWORK DRIVER
107M: Philip Blundell <philb@gnu.org> 115M: Philip Blundell <philb@gnu.org>
@@ -992,7 +1000,7 @@ F: drivers/net/atlx/
992 1000
993ATM 1001ATM
994M: Chas Williams <chas@cmf.nrl.navy.mil> 1002M: Chas Williams <chas@cmf.nrl.navy.mil>
995L: linux-atm-general@lists.sourceforge.net (subscribers-only) 1003L: linux-atm-general@lists.sourceforge.net (moderated for non-subscribers)
996L: netdev@vger.kernel.org 1004L: netdev@vger.kernel.org
997W: http://linux-atm.sourceforge.net 1005W: http://linux-atm.sourceforge.net
998S: Maintained 1006S: Maintained
@@ -1480,6 +1488,7 @@ F: mm/*cgroup*
1480 1488
1481CORETEMP HARDWARE MONITORING DRIVER 1489CORETEMP HARDWARE MONITORING DRIVER
1482M: Rudolf Marek <r.marek@assembler.cz> 1490M: Rudolf Marek <r.marek@assembler.cz>
1491M: Huaxu Wan <huaxu.wan@intel.com>
1483L: lm-sensors@lm-sensors.org 1492L: lm-sensors@lm-sensors.org
1484S: Maintained 1493S: Maintained
1485F: Documentation/hwmon/coretemp 1494F: Documentation/hwmon/coretemp
@@ -2151,7 +2160,7 @@ S: Supported
2151F: arch/powerpc/sysdev/qe_lib/ 2160F: arch/powerpc/sysdev/qe_lib/
2152F: arch/powerpc/include/asm/*qe.h 2161F: arch/powerpc/include/asm/*qe.h
2153 2162
2154FREESCALE USB PERIPHERIAL DRIVERS 2163FREESCALE USB PERIPHERAL DRIVERS
2155M: Li Yang <leoli@freescale.com> 2164M: Li Yang <leoli@freescale.com>
2156L: linux-usb@vger.kernel.org 2165L: linux-usb@vger.kernel.org
2157L: linuxppc-dev@ozlabs.org 2166L: linuxppc-dev@ozlabs.org
@@ -2202,18 +2211,6 @@ F: Documentation/filesystems/caching/
2202F: fs/fscache/ 2211F: fs/fscache/
2203F: include/linux/fscache*.h 2212F: include/linux/fscache*.h
2204 2213
2205TRACING
2206M: Steven Rostedt <rostedt@goodmis.org>
2207M: Frederic Weisbecker <fweisbec@gmail.com>
2208M: Ingo Molnar <mingo@redhat.com>
2209T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git tracing/core
2210S: Maintained
2211F: Documentation/trace/ftrace.txt
2212F: arch/*/*/*/ftrace.h
2213F: arch/*/kernel/ftrace.c
2214F: include/*/ftrace.h include/trace/ include/linux/trace*.h
2215F: kernel/trace/
2216
2217FUJITSU FR-V (FRV) PORT 2214FUJITSU FR-V (FRV) PORT
2218M: David Howells <dhowells@redhat.com> 2215M: David Howells <dhowells@redhat.com>
2219S: Maintained 2216S: Maintained
@@ -2272,9 +2269,8 @@ S: Maintained
2272F: include/asm-generic 2269F: include/asm-generic
2273 2270
2274GENERIC UIO DRIVER FOR PCI DEVICES 2271GENERIC UIO DRIVER FOR PCI DEVICES
2275M: Michael S. Tsirkin <mst@redhat.com> 2272M: "Michael S. Tsirkin" <mst@redhat.com>
2276L: kvm@vger.kernel.org 2273L: kvm@vger.kernel.org
2277L: linux-kernel@vger.kernel.org
2278S: Supported 2274S: Supported
2279F: drivers/uio/uio_pci_generic.c 2275F: drivers/uio/uio_pci_generic.c
2280 2276
@@ -3004,8 +3000,8 @@ F: scripts/Makefile.*
3004 3000
3005KERNEL JANITORS 3001KERNEL JANITORS
3006L: kernel-janitors@vger.kernel.org 3002L: kernel-janitors@vger.kernel.org
3007W: http://www.kerneljanitors.org/ 3003W: http://janitor.kernelnewbies.org/
3008S: Maintained 3004S: Odd Fixes
3009 3005
3010KERNEL NFSD, SUNRPC, AND LOCKD SERVERS 3006KERNEL NFSD, SUNRPC, AND LOCKD SERVERS
3011M: "J. Bruce Fields" <bfields@fieldses.org> 3007M: "J. Bruce Fields" <bfields@fieldses.org>
@@ -3667,6 +3663,7 @@ NETWORKING [GENERAL]
3667M: "David S. Miller" <davem@davemloft.net> 3663M: "David S. Miller" <davem@davemloft.net>
3668L: netdev@vger.kernel.org 3664L: netdev@vger.kernel.org
3669W: http://www.linuxfoundation.org/en/Net 3665W: http://www.linuxfoundation.org/en/Net
3666W: http://patchwork.ozlabs.org/project/netdev/list/
3670T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git 3667T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
3671S: Maintained 3668S: Maintained
3672F: net/ 3669F: net/
@@ -3784,7 +3781,7 @@ F: drivers/video/riva/
3784F: drivers/video/nvidia/ 3781F: drivers/video/nvidia/
3785 3782
3786OMAP SUPPORT 3783OMAP SUPPORT
3787M: "Tony Lindgren <tony@atomide.com>" <tony@atomide.com> 3784M: Tony Lindgren <tony@atomide.com>
3788L: linux-omap@vger.kernel.org 3785L: linux-omap@vger.kernel.org
3789W: http://www.muru.com/linux/omap/ 3786W: http://www.muru.com/linux/omap/
3790W: http://linux.omap.com/ 3787W: http://linux.omap.com/
@@ -3889,6 +3886,15 @@ S: Maintained
3889F: Documentation/i2c/busses/i2c-ocores 3886F: Documentation/i2c/busses/i2c-ocores
3890F: drivers/i2c/busses/i2c-ocores.c 3887F: drivers/i2c/busses/i2c-ocores.c
3891 3888
3889OPEN FIRMWARE AND FLATTENED DEVICE TREE
3890M: Grant Likely <grant.likely@secretlab.ca>
3891L: devicetree-discuss@lists.ozlabs.org
3892W: http://fdt.secretlab.ca
3893S: Maintained
3894F: drivers/of
3895F: include/linux/of*.h
3896K: of_get_property
3897
3892OPROFILE 3898OPROFILE
3893M: Robert Richter <robert.richter@amd.com> 3899M: Robert Richter <robert.richter@amd.com>
3894L: oprofile-list@lists.sf.net 3900L: oprofile-list@lists.sf.net
@@ -4324,7 +4330,7 @@ F: drivers/video/aty/aty128fb.c
4324RALINK RT2X00 WIRELESS LAN DRIVER 4330RALINK RT2X00 WIRELESS LAN DRIVER
4325P: rt2x00 project 4331P: rt2x00 project
4326L: linux-wireless@vger.kernel.org 4332L: linux-wireless@vger.kernel.org
4327L: users@rt2x00.serialmonkey.com 4333L: users@rt2x00.serialmonkey.com (moderated for non-subscribers)
4328W: http://rt2x00.serialmonkey.com/ 4334W: http://rt2x00.serialmonkey.com/
4329S: Maintained 4335S: Maintained
4330T: git git://git.kernel.org/pub/scm/linux/kernel/git/ivd/rt2x00.git 4336T: git git://git.kernel.org/pub/scm/linux/kernel/git/ivd/rt2x00.git
@@ -4533,12 +4539,11 @@ F: kernel/sched*
4533F: include/linux/sched.h 4539F: include/linux/sched.h
4534 4540
4535SCORE ARCHITECTURE 4541SCORE ARCHITECTURE
4536P: Chen Liqin 4542M: Chen Liqin <liqin.chen@sunplusct.com>
4537M: liqin.chen@sunplusct.com 4543M: Lennox Wu <lennox.wu@gmail.com>
4538P: Lennox Wu
4539M: lennox.wu@gmail.com
4540W: http://www.sunplusct.com 4544W: http://www.sunplusct.com
4541S: Supported 4545S: Supported
4546F: arch/score/
4542 4547
4543SCSI CDROM DRIVER 4548SCSI CDROM DRIVER
4544M: Jens Axboe <axboe@kernel.dk> 4549M: Jens Axboe <axboe@kernel.dk>
@@ -4611,20 +4616,20 @@ S: Maintained
4611F: drivers/mmc/host/sdricoh_cs.c 4616F: drivers/mmc/host/sdricoh_cs.c
4612 4617
4613SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER 4618SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER
4614S: Orphan 4619S: Orphan
4615L: linux-mmc@vger.kernel.org 4620L: linux-mmc@vger.kernel.org
4616F: drivers/mmc/host/sdhci.* 4621F: drivers/mmc/host/sdhci.*
4617 4622
4618SECURE DIGITAL HOST CONTROLLER INTERFACE, OPEN FIRMWARE BINDINGS (SDHCI-OF) 4623SECURE DIGITAL HOST CONTROLLER INTERFACE, OPEN FIRMWARE BINDINGS (SDHCI-OF)
4619M: Anton Vorontsov <avorontsov@ru.mvista.com> 4624M: Anton Vorontsov <avorontsov@ru.mvista.com>
4620L: linuxppc-dev@ozlabs.org 4625L: linuxppc-dev@ozlabs.org
4621L: linux-mmc@vger.kernel.org 4626L: linux-mmc@vger.kernel.org
4622S: Maintained 4627S: Maintained
4623F: drivers/mmc/host/sdhci-of.* 4628F: drivers/mmc/host/sdhci-of.*
4624 4629
4625SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER 4630SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER
4626M: Ben Dooks <ben-linux@fluff.org> 4631M: Ben Dooks <ben-linux@fluff.org>
4627L: linux-mmc@vger.kernel.org 4632L: linux-mmc@vger.kernel.org
4628S: Maintained 4633S: Maintained
4629F: drivers/mmc/host/sdhci-s3c.c 4634F: drivers/mmc/host/sdhci-s3c.c
4630 4635
@@ -4727,8 +4732,7 @@ F: drivers/usb/gadget/lh7a40*
4727F: drivers/usb/host/ohci-lh7a40* 4732F: drivers/usb/host/ohci-lh7a40*
4728 4733
4729SIMPLE FIRMWARE INTERFACE (SFI) 4734SIMPLE FIRMWARE INTERFACE (SFI)
4730P: Len Brown 4735M: Len Brown <lenb@kernel.org>
4731M: lenb@kernel.org
4732L: sfi-devel@simplefirmware.org 4736L: sfi-devel@simplefirmware.org
4733W: http://simplefirmware.org/ 4737W: http://simplefirmware.org/
4734T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.git 4738T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.git
@@ -5176,6 +5180,20 @@ L: tpmdd-devel@lists.sourceforge.net (moderated for non-subscribers)
5176S: Maintained 5180S: Maintained
5177F: drivers/char/tpm/ 5181F: drivers/char/tpm/
5178 5182
5183TRACING
5184M: Steven Rostedt <rostedt@goodmis.org>
5185M: Frederic Weisbecker <fweisbec@gmail.com>
5186M: Ingo Molnar <mingo@redhat.com>
5187T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git tracing/core
5188S: Maintained
5189F: Documentation/trace/ftrace.txt
5190F: arch/*/*/*/ftrace.h
5191F: arch/*/kernel/ftrace.c
5192F: include/*/ftrace.h
5193F: include/linux/trace*.h
5194F: include/trace/
5195F: kernel/trace/
5196
5179TRIVIAL PATCHES 5197TRIVIAL PATCHES
5180M: Jiri Kosina <trivial@kernel.org> 5198M: Jiri Kosina <trivial@kernel.org>
5181T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial.git 5199T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial.git
@@ -5664,6 +5682,13 @@ S: Maintained
5664F: drivers/vlynq/vlynq.c 5682F: drivers/vlynq/vlynq.c
5665F: include/linux/vlynq.h 5683F: include/linux/vlynq.h
5666 5684
5685VMWARE VMXNET3 ETHERNET DRIVER
5686M: Shreyas Bhatewara <sbhatewara@vmware.com>
5687M: VMware, Inc. <pv-drivers@vmware.com>
5688L: netdev@vger.kernel.org
5689S: Maintained
5690F: drivers/net/vmxnet3/
5691
5667VOLTAGE AND CURRENT REGULATOR FRAMEWORK 5692VOLTAGE AND CURRENT REGULATOR FRAMEWORK
5668M: Liam Girdwood <lrg@slimlogic.co.uk> 5693M: Liam Girdwood <lrg@slimlogic.co.uk>
5669M: Mark Brown <broonie@opensource.wolfsonmicro.com> 5694M: Mark Brown <broonie@opensource.wolfsonmicro.com>
@@ -5735,8 +5760,7 @@ S: Maintained
5735F: drivers/scsi/wd7000.c 5760F: drivers/scsi/wd7000.c
5736 5761
5737WINBOND CIR DRIVER 5762WINBOND CIR DRIVER
5738P: David Härdeman 5763M: David Härdeman <david@hardeman.nu>
5739M: david@hardeman.nu
5740S: Maintained 5764S: Maintained
5741F: drivers/input/misc/winbond-cir.c 5765F: drivers/input/misc/winbond-cir.c
5742 5766
@@ -5793,9 +5817,7 @@ F: drivers/input/touchscreen/*wm97*
5793F: include/linux/wm97xx.h 5817F: include/linux/wm97xx.h
5794 5818
5795WOLFSON MICROELECTRONICS PMIC DRIVERS 5819WOLFSON MICROELECTRONICS PMIC DRIVERS
5796P: Mark Brown 5820M: Mark Brown <broonie@opensource.wolfsonmicro.com>
5797M: broonie@opensource.wolfsonmicro.com
5798L: linux-kernel@vger.kernel.org
5799T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus 5821T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus
5800W: http://opensource.wolfsonmicro.com/node/8 5822W: http://opensource.wolfsonmicro.com/node/8
5801S: Supported 5823S: Supported
diff --git a/Makefile b/Makefile
index 326791575b0a..b4c04f734e56 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 32 3SUBLEVEL = 32
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc6
5NAME = Man-Eating Seals of Antiquity 5NAME = Man-Eating Seals of Antiquity
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/configs/n8x0_defconfig b/arch/arm/configs/n8x0_defconfig
index 8da75dede52e..264f52b5c52d 100644
--- a/arch/arm/configs/n8x0_defconfig
+++ b/arch/arm/configs/n8x0_defconfig
@@ -304,7 +304,7 @@ CONFIG_ALIGNMENT_TRAP=y
304CONFIG_ZBOOT_ROM_TEXT=0x10C08000 304CONFIG_ZBOOT_ROM_TEXT=0x10C08000
305CONFIG_ZBOOT_ROM_BSS=0x10200000 305CONFIG_ZBOOT_ROM_BSS=0x10200000
306# CONFIG_ZBOOT_ROM is not set 306# CONFIG_ZBOOT_ROM is not set
307CONFIG_CMDLINE="root=1f03 rootfstype=jffs2 console=ttyS0,115200n8" 307CONFIG_CMDLINE="root=1f03 rootfstype=jffs2 console=ttyS2,115200n8"
308# CONFIG_XIP_KERNEL is not set 308# CONFIG_XIP_KERNEL is not set
309# CONFIG_KEXEC is not set 309# CONFIG_KEXEC is not set
310 310
diff --git a/arch/arm/configs/omap3_beagle_defconfig b/arch/arm/configs/omap3_beagle_defconfig
index 357d4021e2d0..b3c8cce0f8fb 100644
--- a/arch/arm/configs/omap3_beagle_defconfig
+++ b/arch/arm/configs/omap3_beagle_defconfig
@@ -969,7 +969,6 @@ CONFIG_USB_ETH_RNDIS=y
969# 969#
970CONFIG_USB_OTG_UTILS=y 970CONFIG_USB_OTG_UTILS=y
971# CONFIG_USB_GPIO_VBUS is not set 971# CONFIG_USB_GPIO_VBUS is not set
972# CONFIG_ISP1301_OMAP is not set
973CONFIG_TWL4030_USB=y 972CONFIG_TWL4030_USB=y
974# CONFIG_NOP_USB_XCEIV is not set 973# CONFIG_NOP_USB_XCEIV is not set
975CONFIG_MMC=y 974CONFIG_MMC=y
diff --git a/arch/arm/configs/u300_defconfig b/arch/arm/configs/u300_defconfig
index 7d61ae6e75da..953ba0297fc4 100644
--- a/arch/arm/configs/u300_defconfig
+++ b/arch/arm/configs/u300_defconfig
@@ -1,14 +1,14 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc3 3# Linux kernel version: 2.6.32-rc5
4# Thu Jul 16 23:36:10 2009 4# Sat Oct 17 23:32:24 2009
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y 8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y 9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y 11CONFIG_HAVE_TCM=y
12CONFIG_GENERIC_HARDIRQS=y 12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_STACKTRACE_SUPPORT=y 13CONFIG_STACKTRACE_SUPPORT=y
14CONFIG_HAVE_LATENCYTOP_SUPPORT=y 14CONFIG_HAVE_LATENCYTOP_SUPPORT=y
@@ -44,11 +44,12 @@ CONFIG_SYSVIPC_SYSCTL=y
44# 44#
45# RCU Subsystem 45# RCU Subsystem
46# 46#
47CONFIG_CLASSIC_RCU=y 47CONFIG_TREE_RCU=y
48# CONFIG_TREE_RCU is not set 48# CONFIG_TREE_PREEMPT_RCU is not set
49# CONFIG_PREEMPT_RCU is not set 49# CONFIG_RCU_TRACE is not set
50CONFIG_RCU_FANOUT=32
51# CONFIG_RCU_FANOUT_EXACT is not set
50# CONFIG_TREE_RCU_TRACE is not set 52# CONFIG_TREE_RCU_TRACE is not set
51# CONFIG_PREEMPT_RCU_TRACE is not set
52# CONFIG_IKCONFIG is not set 53# CONFIG_IKCONFIG is not set
53CONFIG_LOG_BUF_SHIFT=14 54CONFIG_LOG_BUF_SHIFT=14
54# CONFIG_GROUP_SCHED is not set 55# CONFIG_GROUP_SCHED is not set
@@ -80,17 +81,15 @@ CONFIG_SHMEM=y
80# CONFIG_AIO is not set 81# CONFIG_AIO is not set
81 82
82# 83#
83# Performance Counters 84# Kernel Performance Events And Counters
84# 85#
85# CONFIG_VM_EVENT_COUNTERS is not set 86# CONFIG_VM_EVENT_COUNTERS is not set
86CONFIG_SLUB_DEBUG=y 87CONFIG_SLUB_DEBUG=y
87# CONFIG_STRIP_ASM_SYMS is not set
88CONFIG_COMPAT_BRK=y 88CONFIG_COMPAT_BRK=y
89# CONFIG_SLAB is not set 89# CONFIG_SLAB is not set
90CONFIG_SLUB=y 90CONFIG_SLUB=y
91# CONFIG_SLOB is not set 91# CONFIG_SLOB is not set
92# CONFIG_PROFILING is not set 92# CONFIG_PROFILING is not set
93# CONFIG_MARKERS is not set
94CONFIG_HAVE_OPROFILE=y 93CONFIG_HAVE_OPROFILE=y
95# CONFIG_KPROBES is not set 94# CONFIG_KPROBES is not set
96CONFIG_HAVE_KPROBES=y 95CONFIG_HAVE_KPROBES=y
@@ -133,6 +132,7 @@ CONFIG_DEFAULT_IOSCHED="deadline"
133# 132#
134# System Type 133# System Type
135# 134#
135CONFIG_MMU=y
136# CONFIG_ARCH_AAEC2000 is not set 136# CONFIG_ARCH_AAEC2000 is not set
137# CONFIG_ARCH_INTEGRATOR is not set 137# CONFIG_ARCH_INTEGRATOR is not set
138# CONFIG_ARCH_REALVIEW is not set 138# CONFIG_ARCH_REALVIEW is not set
@@ -147,6 +147,7 @@ CONFIG_DEFAULT_IOSCHED="deadline"
147# CONFIG_ARCH_STMP3XXX is not set 147# CONFIG_ARCH_STMP3XXX is not set
148# CONFIG_ARCH_NETX is not set 148# CONFIG_ARCH_NETX is not set
149# CONFIG_ARCH_H720X is not set 149# CONFIG_ARCH_H720X is not set
150# CONFIG_ARCH_NOMADIK is not set
150# CONFIG_ARCH_IOP13XX is not set 151# CONFIG_ARCH_IOP13XX is not set
151# CONFIG_ARCH_IOP32X is not set 152# CONFIG_ARCH_IOP32X is not set
152# CONFIG_ARCH_IOP33X is not set 153# CONFIG_ARCH_IOP33X is not set
@@ -169,11 +170,13 @@ CONFIG_DEFAULT_IOSCHED="deadline"
169# CONFIG_ARCH_SA1100 is not set 170# CONFIG_ARCH_SA1100 is not set
170# CONFIG_ARCH_S3C2410 is not set 171# CONFIG_ARCH_S3C2410 is not set
171# CONFIG_ARCH_S3C64XX is not set 172# CONFIG_ARCH_S3C64XX is not set
173# CONFIG_ARCH_S5PC1XX is not set
172# CONFIG_ARCH_SHARK is not set 174# CONFIG_ARCH_SHARK is not set
173# CONFIG_ARCH_LH7A40X is not set 175# CONFIG_ARCH_LH7A40X is not set
174CONFIG_ARCH_U300=y 176CONFIG_ARCH_U300=y
175# CONFIG_ARCH_DAVINCI is not set 177# CONFIG_ARCH_DAVINCI is not set
176# CONFIG_ARCH_OMAP is not set 178# CONFIG_ARCH_OMAP is not set
179# CONFIG_ARCH_BCMRING is not set
177 180
178# 181#
179# ST-Ericsson AB U300/U330/U335/U365 Platform 182# ST-Ericsson AB U300/U330/U335/U365 Platform
@@ -195,6 +198,7 @@ CONFIG_MACH_U300_BS335=y
195CONFIG_MACH_U300_DUAL_RAM=y 198CONFIG_MACH_U300_DUAL_RAM=y
196CONFIG_U300_DEBUG=y 199CONFIG_U300_DEBUG=y
197# CONFIG_MACH_U300_SEMI_IS_SHARED is not set 200# CONFIG_MACH_U300_SEMI_IS_SHARED is not set
201CONFIG_MACH_U300_SPIDUMMY=y
198 202
199# 203#
200# All the settings below must match the bootloader's settings 204# All the settings below must match the bootloader's settings
@@ -207,7 +211,7 @@ CONFIG_CPU_32=y
207CONFIG_CPU_ARM926T=y 211CONFIG_CPU_ARM926T=y
208CONFIG_CPU_32v5=y 212CONFIG_CPU_32v5=y
209CONFIG_CPU_ABRT_EV5TJ=y 213CONFIG_CPU_ABRT_EV5TJ=y
210CONFIG_CPU_PABRT_NOIFAR=y 214CONFIG_CPU_PABRT_LEGACY=y
211CONFIG_CPU_CACHE_VIVT=y 215CONFIG_CPU_CACHE_VIVT=y
212CONFIG_CPU_COPY_V4WB=y 216CONFIG_CPU_COPY_V4WB=y
213CONFIG_CPU_TLB_V4WBI=y 217CONFIG_CPU_TLB_V4WBI=y
@@ -222,6 +226,7 @@ CONFIG_ARM_THUMB=y
222# CONFIG_CPU_DCACHE_DISABLE is not set 226# CONFIG_CPU_DCACHE_DISABLE is not set
223# CONFIG_CPU_DCACHE_WRITETHROUGH is not set 227# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
224# CONFIG_CPU_CACHE_ROUND_ROBIN is not set 228# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
229CONFIG_ARM_L1_CACHE_SHIFT=5
225CONFIG_ARM_VIC=y 230CONFIG_ARM_VIC=y
226CONFIG_ARM_VIC_NR=2 231CONFIG_ARM_VIC_NR=2
227CONFIG_COMMON_CLKDEV=y 232CONFIG_COMMON_CLKDEV=y
@@ -245,6 +250,8 @@ CONFIG_VMSPLIT_3G=y
245# CONFIG_VMSPLIT_2G is not set 250# CONFIG_VMSPLIT_2G is not set
246# CONFIG_VMSPLIT_1G is not set 251# CONFIG_VMSPLIT_1G is not set
247CONFIG_PAGE_OFFSET=0xC0000000 252CONFIG_PAGE_OFFSET=0xC0000000
253# CONFIG_PREEMPT_NONE is not set
254# CONFIG_PREEMPT_VOLUNTARY is not set
248CONFIG_PREEMPT=y 255CONFIG_PREEMPT=y
249CONFIG_HZ=100 256CONFIG_HZ=100
250CONFIG_AEABI=y 257CONFIG_AEABI=y
@@ -265,6 +272,7 @@ CONFIG_ZONE_DMA_FLAG=0
265CONFIG_VIRT_TO_BUS=y 272CONFIG_VIRT_TO_BUS=y
266CONFIG_HAVE_MLOCK=y 273CONFIG_HAVE_MLOCK=y
267CONFIG_HAVE_MLOCKED_PAGE_BIT=y 274CONFIG_HAVE_MLOCKED_PAGE_BIT=y
275# CONFIG_KSM is not set
268CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 276CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
269CONFIG_ALIGNMENT_TRAP=y 277CONFIG_ALIGNMENT_TRAP=y
270# CONFIG_UACCESS_WITH_MEMCPY is not set 278# CONFIG_UACCESS_WITH_MEMCPY is not set
@@ -313,6 +321,7 @@ CONFIG_PM=y
313# CONFIG_PM_DEBUG is not set 321# CONFIG_PM_DEBUG is not set
314# CONFIG_SUSPEND is not set 322# CONFIG_SUSPEND is not set
315# CONFIG_APM_EMULATION is not set 323# CONFIG_APM_EMULATION is not set
324# CONFIG_PM_RUNTIME is not set
316CONFIG_ARCH_SUSPEND_POSSIBLE=y 325CONFIG_ARCH_SUSPEND_POSSIBLE=y
317CONFIG_NET=y 326CONFIG_NET=y
318 327
@@ -351,6 +360,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
351# CONFIG_NETFILTER is not set 360# CONFIG_NETFILTER is not set
352# CONFIG_IP_DCCP is not set 361# CONFIG_IP_DCCP is not set
353# CONFIG_IP_SCTP is not set 362# CONFIG_IP_SCTP is not set
363# CONFIG_RDS is not set
354# CONFIG_TIPC is not set 364# CONFIG_TIPC is not set
355# CONFIG_ATM is not set 365# CONFIG_ATM is not set
356# CONFIG_BRIDGE is not set 366# CONFIG_BRIDGE is not set
@@ -391,6 +401,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
391# Generic Driver Options 401# Generic Driver Options
392# 402#
393CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 403CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
404# CONFIG_DEVTMPFS is not set
394CONFIG_STANDALONE=y 405CONFIG_STANDALONE=y
395# CONFIG_PREVENT_FIRMWARE_BUILD is not set 406# CONFIG_PREVENT_FIRMWARE_BUILD is not set
396CONFIG_FW_LOADER=y 407CONFIG_FW_LOADER=y
@@ -402,9 +413,9 @@ CONFIG_EXTRA_FIRMWARE=""
402# CONFIG_CONNECTOR is not set 413# CONFIG_CONNECTOR is not set
403CONFIG_MTD=y 414CONFIG_MTD=y
404# CONFIG_MTD_DEBUG is not set 415# CONFIG_MTD_DEBUG is not set
416# CONFIG_MTD_TESTS is not set
405# CONFIG_MTD_CONCAT is not set 417# CONFIG_MTD_CONCAT is not set
406CONFIG_MTD_PARTITIONS=y 418CONFIG_MTD_PARTITIONS=y
407# CONFIG_MTD_TESTS is not set
408# CONFIG_MTD_REDBOOT_PARTS is not set 419# CONFIG_MTD_REDBOOT_PARTS is not set
409CONFIG_MTD_CMDLINE_PARTS=y 420CONFIG_MTD_CMDLINE_PARTS=y
410# CONFIG_MTD_AFS_PARTS is not set 421# CONFIG_MTD_AFS_PARTS is not set
@@ -453,6 +464,7 @@ CONFIG_MTD_CFI_I2=y
453# 464#
454# CONFIG_MTD_DATAFLASH is not set 465# CONFIG_MTD_DATAFLASH is not set
455# CONFIG_MTD_M25P80 is not set 466# CONFIG_MTD_M25P80 is not set
467# CONFIG_MTD_SST25L is not set
456# CONFIG_MTD_SLRAM is not set 468# CONFIG_MTD_SLRAM is not set
457# CONFIG_MTD_PHRAM is not set 469# CONFIG_MTD_PHRAM is not set
458# CONFIG_MTD_MTDRAM is not set 470# CONFIG_MTD_MTDRAM is not set
@@ -520,6 +532,7 @@ CONFIG_HAVE_IDE=y
520# CONFIG_MD is not set 532# CONFIG_MD is not set
521# CONFIG_NETDEVICES is not set 533# CONFIG_NETDEVICES is not set
522# CONFIG_ISDN is not set 534# CONFIG_ISDN is not set
535# CONFIG_PHONE is not set
523 536
524# 537#
525# Input device support 538# Input device support
@@ -540,12 +553,16 @@ CONFIG_INPUT_EVDEV=y
540# Input Device Drivers 553# Input Device Drivers
541# 554#
542CONFIG_INPUT_KEYBOARD=y 555CONFIG_INPUT_KEYBOARD=y
556# CONFIG_KEYBOARD_ADP5588 is not set
543# CONFIG_KEYBOARD_ATKBD is not set 557# CONFIG_KEYBOARD_ATKBD is not set
558# CONFIG_QT2160 is not set
544# CONFIG_KEYBOARD_LKKBD is not set 559# CONFIG_KEYBOARD_LKKBD is not set
545# CONFIG_KEYBOARD_GPIO is not set 560# CONFIG_KEYBOARD_GPIO is not set
546# CONFIG_KEYBOARD_MATRIX is not set 561# CONFIG_KEYBOARD_MATRIX is not set
547# CONFIG_KEYBOARD_LM8323 is not set 562# CONFIG_KEYBOARD_LM8323 is not set
563# CONFIG_KEYBOARD_MAX7359 is not set
548# CONFIG_KEYBOARD_NEWTON is not set 564# CONFIG_KEYBOARD_NEWTON is not set
565# CONFIG_KEYBOARD_OPENCORES is not set
549# CONFIG_KEYBOARD_STOWAWAY is not set 566# CONFIG_KEYBOARD_STOWAWAY is not set
550# CONFIG_KEYBOARD_SUNKBD is not set 567# CONFIG_KEYBOARD_SUNKBD is not set
551# CONFIG_KEYBOARD_XTKBD is not set 568# CONFIG_KEYBOARD_XTKBD is not set
@@ -597,6 +614,7 @@ CONFIG_LEGACY_PTY_COUNT=16
597# CONFIG_TCG_TPM is not set 614# CONFIG_TCG_TPM is not set
598CONFIG_I2C=y 615CONFIG_I2C=y
599CONFIG_I2C_BOARDINFO=y 616CONFIG_I2C_BOARDINFO=y
617CONFIG_I2C_COMPAT=y
600# CONFIG_I2C_CHARDEV is not set 618# CONFIG_I2C_CHARDEV is not set
601CONFIG_I2C_HELPER_AUTO=y 619CONFIG_I2C_HELPER_AUTO=y
602 620
@@ -629,9 +647,6 @@ CONFIG_I2C_STU300=y
629# Miscellaneous I2C Chip support 647# Miscellaneous I2C Chip support
630# 648#
631# CONFIG_DS1682 is not set 649# CONFIG_DS1682 is not set
632# CONFIG_SENSORS_PCF8574 is not set
633# CONFIG_PCF8575 is not set
634# CONFIG_SENSORS_PCA9539 is not set
635# CONFIG_SENSORS_TSL2550 is not set 650# CONFIG_SENSORS_TSL2550 is not set
636# CONFIG_I2C_DEBUG_CORE is not set 651# CONFIG_I2C_DEBUG_CORE is not set
637# CONFIG_I2C_DEBUG_ALGO is not set 652# CONFIG_I2C_DEBUG_ALGO is not set
@@ -653,16 +668,21 @@ CONFIG_SPI_PL022=y
653# 668#
654# CONFIG_SPI_SPIDEV is not set 669# CONFIG_SPI_SPIDEV is not set
655# CONFIG_SPI_TLE62X0 is not set 670# CONFIG_SPI_TLE62X0 is not set
671
672#
673# PPS support
674#
675# CONFIG_PPS is not set
656# CONFIG_W1 is not set 676# CONFIG_W1 is not set
657CONFIG_POWER_SUPPLY=y 677CONFIG_POWER_SUPPLY=y
658# CONFIG_POWER_SUPPLY_DEBUG is not set 678# CONFIG_POWER_SUPPLY_DEBUG is not set
659# CONFIG_PDA_POWER is not set 679# CONFIG_PDA_POWER is not set
660# CONFIG_BATTERY_DS2760 is not set 680# CONFIG_BATTERY_DS2760 is not set
681# CONFIG_BATTERY_DS2782 is not set
661# CONFIG_BATTERY_BQ27x00 is not set 682# CONFIG_BATTERY_BQ27x00 is not set
662# CONFIG_BATTERY_MAX17040 is not set 683# CONFIG_BATTERY_MAX17040 is not set
663# CONFIG_HWMON is not set 684# CONFIG_HWMON is not set
664# CONFIG_THERMAL is not set 685# CONFIG_THERMAL is not set
665# CONFIG_THERMAL_HWMON is not set
666CONFIG_WATCHDOG=y 686CONFIG_WATCHDOG=y
667# CONFIG_WATCHDOG_NOWAYOUT is not set 687# CONFIG_WATCHDOG_NOWAYOUT is not set
668 688
@@ -690,10 +710,24 @@ CONFIG_SSB_POSSIBLE=y
690# CONFIG_MFD_TC6387XB is not set 710# CONFIG_MFD_TC6387XB is not set
691# CONFIG_PMIC_DA903X is not set 711# CONFIG_PMIC_DA903X is not set
692# CONFIG_MFD_WM8400 is not set 712# CONFIG_MFD_WM8400 is not set
713# CONFIG_MFD_WM831X is not set
693# CONFIG_MFD_WM8350_I2C is not set 714# CONFIG_MFD_WM8350_I2C is not set
694# CONFIG_MFD_PCF50633 is not set 715# CONFIG_MFD_PCF50633 is not set
716# CONFIG_MFD_MC13783 is not set
695CONFIG_AB3100_CORE=y 717CONFIG_AB3100_CORE=y
718CONFIG_AB3100_OTP=y
696# CONFIG_EZX_PCAP is not set 719# CONFIG_EZX_PCAP is not set
720CONFIG_REGULATOR=y
721# CONFIG_REGULATOR_DEBUG is not set
722# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
723# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
724# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
725# CONFIG_REGULATOR_BQ24022 is not set
726# CONFIG_REGULATOR_MAX1586 is not set
727# CONFIG_REGULATOR_LP3971 is not set
728CONFIG_REGULATOR_AB3100=y
729# CONFIG_REGULATOR_TPS65023 is not set
730# CONFIG_REGULATOR_TPS6507X is not set
697# CONFIG_MEDIA_SUPPORT is not set 731# CONFIG_MEDIA_SUPPORT is not set
698 732
699# 733#
@@ -792,9 +826,10 @@ CONFIG_MMC_BLOCK_BOUNCE=y
792# 826#
793CONFIG_MMC_ARMMMCI=y 827CONFIG_MMC_ARMMMCI=y
794# CONFIG_MMC_SDHCI is not set 828# CONFIG_MMC_SDHCI is not set
829# CONFIG_MMC_AT91 is not set
830# CONFIG_MMC_ATMELMCI is not set
795# CONFIG_MMC_SPI is not set 831# CONFIG_MMC_SPI is not set
796# CONFIG_MEMSTICK is not set 832# CONFIG_MEMSTICK is not set
797# CONFIG_ACCESSIBILITY is not set
798CONFIG_NEW_LEDS=y 833CONFIG_NEW_LEDS=y
799CONFIG_LEDS_CLASS=y 834CONFIG_LEDS_CLASS=y
800 835
@@ -820,10 +855,10 @@ CONFIG_LEDS_TRIGGER_BACKLIGHT=y
820# 855#
821# iptables trigger is under Netfilter config (LED target) 856# iptables trigger is under Netfilter config (LED target)
822# 857#
858# CONFIG_ACCESSIBILITY is not set
823CONFIG_RTC_LIB=y 859CONFIG_RTC_LIB=y
824CONFIG_RTC_CLASS=y 860CONFIG_RTC_CLASS=y
825CONFIG_RTC_HCTOSYS=y 861# CONFIG_RTC_HCTOSYS is not set
826CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
827# CONFIG_RTC_DEBUG is not set 862# CONFIG_RTC_DEBUG is not set
828 863
829# 864#
@@ -863,6 +898,7 @@ CONFIG_RTC_INTF_DEV=y
863# CONFIG_RTC_DRV_R9701 is not set 898# CONFIG_RTC_DRV_R9701 is not set
864# CONFIG_RTC_DRV_RS5C348 is not set 899# CONFIG_RTC_DRV_RS5C348 is not set
865# CONFIG_RTC_DRV_DS3234 is not set 900# CONFIG_RTC_DRV_DS3234 is not set
901# CONFIG_RTC_DRV_PCF2123 is not set
866 902
867# 903#
868# Platform RTC drivers 904# Platform RTC drivers
@@ -878,27 +914,25 @@ CONFIG_RTC_INTF_DEV=y
878# CONFIG_RTC_DRV_M48T59 is not set 914# CONFIG_RTC_DRV_M48T59 is not set
879# CONFIG_RTC_DRV_BQ4802 is not set 915# CONFIG_RTC_DRV_BQ4802 is not set
880# CONFIG_RTC_DRV_V3020 is not set 916# CONFIG_RTC_DRV_V3020 is not set
917CONFIG_RTC_DRV_AB3100=y
881 918
882# 919#
883# on-CPU RTC drivers 920# on-CPU RTC drivers
884# 921#
885# CONFIG_RTC_DRV_PL030 is not set 922# CONFIG_RTC_DRV_PL030 is not set
886# CONFIG_RTC_DRV_PL031 is not set 923# CONFIG_RTC_DRV_PL031 is not set
924CONFIG_RTC_DRV_COH901331=y
887CONFIG_DMADEVICES=y 925CONFIG_DMADEVICES=y
888 926
889# 927#
890# DMA Devices 928# DMA Devices
891# 929#
892# CONFIG_AUXDISPLAY is not set 930# CONFIG_AUXDISPLAY is not set
893CONFIG_REGULATOR=y
894# CONFIG_REGULATOR_DEBUG is not set
895# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
896# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
897# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
898# CONFIG_REGULATOR_BQ24022 is not set
899# CONFIG_REGULATOR_MAX1586 is not set
900# CONFIG_REGULATOR_LP3971 is not set
901# CONFIG_UIO is not set 931# CONFIG_UIO is not set
932
933#
934# TI VLYNQ
935#
902# CONFIG_STAGING is not set 936# CONFIG_STAGING is not set
903 937
904# 938#
@@ -913,6 +947,7 @@ CONFIG_REGULATOR=y
913# CONFIG_XFS_FS is not set 947# CONFIG_XFS_FS is not set
914# CONFIG_OCFS2_FS is not set 948# CONFIG_OCFS2_FS is not set
915# CONFIG_BTRFS_FS is not set 949# CONFIG_BTRFS_FS is not set
950# CONFIG_NILFS2_FS is not set
916CONFIG_FILE_LOCKING=y 951CONFIG_FILE_LOCKING=y
917CONFIG_FSNOTIFY=y 952CONFIG_FSNOTIFY=y
918# CONFIG_DNOTIFY is not set 953# CONFIG_DNOTIFY is not set
@@ -975,7 +1010,6 @@ CONFIG_MISC_FILESYSTEMS=y
975# CONFIG_ROMFS_FS is not set 1010# CONFIG_ROMFS_FS is not set
976# CONFIG_SYSV_FS is not set 1011# CONFIG_SYSV_FS is not set
977# CONFIG_UFS_FS is not set 1012# CONFIG_UFS_FS is not set
978# CONFIG_NILFS2_FS is not set
979# CONFIG_NETWORK_FILESYSTEMS is not set 1013# CONFIG_NETWORK_FILESYSTEMS is not set
980 1014
981# 1015#
@@ -1033,6 +1067,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1033CONFIG_ENABLE_MUST_CHECK=y 1067CONFIG_ENABLE_MUST_CHECK=y
1034CONFIG_FRAME_WARN=1024 1068CONFIG_FRAME_WARN=1024
1035# CONFIG_MAGIC_SYSRQ is not set 1069# CONFIG_MAGIC_SYSRQ is not set
1070# CONFIG_STRIP_ASM_SYMS is not set
1036# CONFIG_UNUSED_SYMBOLS is not set 1071# CONFIG_UNUSED_SYMBOLS is not set
1037# CONFIG_DEBUG_FS is not set 1072# CONFIG_DEBUG_FS is not set
1038# CONFIG_HEADERS_CHECK is not set 1073# CONFIG_HEADERS_CHECK is not set
@@ -1066,11 +1101,13 @@ CONFIG_DEBUG_INFO=y
1066# CONFIG_DEBUG_LIST is not set 1101# CONFIG_DEBUG_LIST is not set
1067# CONFIG_DEBUG_SG is not set 1102# CONFIG_DEBUG_SG is not set
1068# CONFIG_DEBUG_NOTIFIERS is not set 1103# CONFIG_DEBUG_NOTIFIERS is not set
1104# CONFIG_DEBUG_CREDENTIALS is not set
1069# CONFIG_BOOT_PRINTK_DELAY is not set 1105# CONFIG_BOOT_PRINTK_DELAY is not set
1070# CONFIG_RCU_TORTURE_TEST is not set 1106# CONFIG_RCU_TORTURE_TEST is not set
1071# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1107# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1072# CONFIG_BACKTRACE_SELF_TEST is not set 1108# CONFIG_BACKTRACE_SELF_TEST is not set
1073# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1109# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1110# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1074# CONFIG_FAULT_INJECTION is not set 1111# CONFIG_FAULT_INJECTION is not set
1075# CONFIG_LATENCYTOP is not set 1112# CONFIG_LATENCYTOP is not set
1076# CONFIG_SYSCTL_SYSCALL_CHECK is not set 1113# CONFIG_SYSCTL_SYSCALL_CHECK is not set
@@ -1121,6 +1158,7 @@ CONFIG_GENERIC_FIND_LAST_BIT=y
1121# CONFIG_CRC32 is not set 1158# CONFIG_CRC32 is not set
1122# CONFIG_CRC7 is not set 1159# CONFIG_CRC7 is not set
1123# CONFIG_LIBCRC32C is not set 1160# CONFIG_LIBCRC32C is not set
1161CONFIG_GENERIC_ALLOCATOR=y
1124CONFIG_HAS_IOMEM=y 1162CONFIG_HAS_IOMEM=y
1125CONFIG_HAS_IOPORT=y 1163CONFIG_HAS_IOPORT=y
1126CONFIG_HAS_DMA=y 1164CONFIG_HAS_DMA=y
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index fd03fb63a332..3d0cdd21b882 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -414,9 +414,14 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
414 414
415static inline void __flush_icache_all(void) 415static inline void __flush_icache_all(void)
416{ 416{
417#ifdef CONFIG_ARM_ERRATA_411920
418 extern void v6_icache_inval_all(void);
419 v6_icache_inval_all();
420#else
417 asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n" 421 asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n"
418 : 422 :
419 : "r" (0)); 423 : "r" (0));
424#endif
420} 425}
421 426
422#define ARCH_HAS_FLUSH_ANON_PAGE 427#define ARCH_HAS_FLUSH_ANON_PAGE
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index c3b911ee9151..6aac3f5bb2f3 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -98,6 +98,9 @@ extern int elf_check_arch(const struct elf32_hdr *);
98extern int arm_elf_read_implies_exec(const struct elf32_hdr *, int); 98extern int arm_elf_read_implies_exec(const struct elf32_hdr *, int);
99#define elf_read_implies_exec(ex,stk) arm_elf_read_implies_exec(&(ex), stk) 99#define elf_read_implies_exec(ex,stk) arm_elf_read_implies_exec(&(ex), stk)
100 100
101int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
102#define ELF_CORE_COPY_TASK_REGS dump_task_regs
103
101#define USE_ELF_CORE_DUMP 104#define USE_ELF_CORE_DUMP
102#define ELF_EXEC_PAGESIZE 4096 105#define ELF_EXEC_PAGESIZE 4096
103 106
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index a45ab5dd8255..c2f1605de359 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -350,7 +350,7 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
350 if (tlb_flag(TLB_WB)) 350 if (tlb_flag(TLB_WB))
351 dsb(); 351 dsb();
352 352
353 if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm))) { 353 if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) {
354 if (tlb_flag(TLB_V3_FULL)) 354 if (tlb_flag(TLB_V3_FULL))
355 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc"); 355 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
356 if (tlb_flag(TLB_V4_U_FULL)) 356 if (tlb_flag(TLB_V4_U_FULL))
@@ -360,6 +360,7 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
360 if (tlb_flag(TLB_V4_I_FULL)) 360 if (tlb_flag(TLB_V4_I_FULL))
361 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); 361 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
362 } 362 }
363 put_cpu();
363 364
364 if (tlb_flag(TLB_V6_U_ASID)) 365 if (tlb_flag(TLB_V6_U_ASID))
365 asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc"); 366 asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc");
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 322410be573c..0022b4d57f8b 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -608,33 +608,33 @@ call_fpe:
608 THUMB( add pc, r8 ) 608 THUMB( add pc, r8 )
609 nop 609 nop
610 610
611 W(mov) pc, lr @ CP#0 611 movw_pc lr @ CP#0
612 W(b) do_fpe @ CP#1 (FPE) 612 W(b) do_fpe @ CP#1 (FPE)
613 W(b) do_fpe @ CP#2 (FPE) 613 W(b) do_fpe @ CP#2 (FPE)
614 W(mov) pc, lr @ CP#3 614 movw_pc lr @ CP#3
615#ifdef CONFIG_CRUNCH 615#ifdef CONFIG_CRUNCH
616 b crunch_task_enable @ CP#4 (MaverickCrunch) 616 b crunch_task_enable @ CP#4 (MaverickCrunch)
617 b crunch_task_enable @ CP#5 (MaverickCrunch) 617 b crunch_task_enable @ CP#5 (MaverickCrunch)
618 b crunch_task_enable @ CP#6 (MaverickCrunch) 618 b crunch_task_enable @ CP#6 (MaverickCrunch)
619#else 619#else
620 W(mov) pc, lr @ CP#4 620 movw_pc lr @ CP#4
621 W(mov) pc, lr @ CP#5 621 movw_pc lr @ CP#5
622 W(mov) pc, lr @ CP#6 622 movw_pc lr @ CP#6
623#endif 623#endif
624 W(mov) pc, lr @ CP#7 624 movw_pc lr @ CP#7
625 W(mov) pc, lr @ CP#8 625 movw_pc lr @ CP#8
626 W(mov) pc, lr @ CP#9 626 movw_pc lr @ CP#9
627#ifdef CONFIG_VFP 627#ifdef CONFIG_VFP
628 W(b) do_vfp @ CP#10 (VFP) 628 W(b) do_vfp @ CP#10 (VFP)
629 W(b) do_vfp @ CP#11 (VFP) 629 W(b) do_vfp @ CP#11 (VFP)
630#else 630#else
631 W(mov) pc, lr @ CP#10 (VFP) 631 movw_pc lr @ CP#10 (VFP)
632 W(mov) pc, lr @ CP#11 (VFP) 632 movw_pc lr @ CP#11 (VFP)
633#endif 633#endif
634 W(mov) pc, lr @ CP#12 634 movw_pc lr @ CP#12
635 W(mov) pc, lr @ CP#13 635 movw_pc lr @ CP#13
636 W(mov) pc, lr @ CP#14 (Debug) 636 movw_pc lr @ CP#14 (Debug)
637 W(mov) pc, lr @ CP#15 (Control) 637 movw_pc lr @ CP#15 (Control)
638 638
639#ifdef CONFIG_NEON 639#ifdef CONFIG_NEON
640 .align 6 640 .align 6
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index ac34c0d9384b..7e9ed1eea40a 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -110,6 +110,13 @@
110 mov \rd, sp, lsr #13 110 mov \rd, sp, lsr #13
111 mov \rd, \rd, lsl #13 111 mov \rd, \rd, lsl #13
112 .endm 112 .endm
113
114 @
115 @ 32-bit wide "mov pc, reg"
116 @
117 .macro movw_pc, reg
118 mov pc, \reg
119 .endm
113#else /* CONFIG_THUMB2_KERNEL */ 120#else /* CONFIG_THUMB2_KERNEL */
114 .macro svc_exit, rpsr 121 .macro svc_exit, rpsr
115 clrex @ clear the exclusive monitor 122 clrex @ clear the exclusive monitor
@@ -146,6 +153,14 @@
146 lsr \rd, \rd, #13 153 lsr \rd, \rd, #13
147 mov \rd, \rd, lsl #13 154 mov \rd, \rd, lsl #13
148 .endm 155 .endm
156
157 @
158 @ 32-bit wide "mov pc, reg"
159 @
160 .macro movw_pc, reg
161 mov pc, \reg
162 nop
163 .endm
149#endif /* !CONFIG_THUMB2_KERNEL */ 164#endif /* !CONFIG_THUMB2_KERNEL */
150 165
151/* 166/*
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 790fbee92ec5..0d96d0171c05 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -328,6 +328,15 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
328} 328}
329 329
330/* 330/*
331 * Fill in the task's elfregs structure for a core dump.
332 */
333int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs)
334{
335 elf_core_copy_regs(elfregs, task_pt_regs(t));
336 return 1;
337}
338
339/*
331 * fill in the fpe structure for a core dump... 340 * fill in the fpe structure for a core dump...
332 */ 341 */
333int dump_fpu (struct pt_regs *regs, struct user_fp *fp) 342int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 1423a3419789..2a573d4fea24 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/kernel/signal.c 2 * linux/arch/arm/kernel/signal.c
3 * 3 *
4 * Copyright (C) 1995-2002 Russell King 4 * Copyright (C) 1995-2009 Russell King
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * 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 7 * it under the terms of the GNU General Public License version 2 as
@@ -29,6 +29,7 @@
29 */ 29 */
30#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 30#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE))
31#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 31#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE))
32#define SWI_SYS_RESTART (0xef000000|__NR_restart_syscall|__NR_OABI_SYSCALL_BASE)
32 33
33/* 34/*
34 * With EABI, the syscall number has to be loaded into r7. 35 * With EABI, the syscall number has to be loaded into r7.
@@ -49,6 +50,18 @@ const unsigned long sigreturn_codes[7] = {
49}; 50};
50 51
51/* 52/*
53 * Either we support OABI only, or we have EABI with the OABI
54 * compat layer enabled. In the later case we don't know if
55 * user space is EABI or not, and if not we must not clobber r7.
56 * Always using the OABI syscall solves that issue and works for
57 * all those cases.
58 */
59const unsigned long syscall_restart_code[2] = {
60 SWI_SYS_RESTART, /* swi __NR_restart_syscall */
61 0xe49df004, /* ldr pc, [sp], #4 */
62};
63
64/*
52 * atomically swap in the new signal mask, and wait for a signal. 65 * atomically swap in the new signal mask, and wait for a signal.
53 */ 66 */
54asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) 67asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask)
@@ -645,32 +658,12 @@ static void do_signal(struct pt_regs *regs, int syscall)
645 regs->ARM_pc -= 4; 658 regs->ARM_pc -= 4;
646#else 659#else
647 u32 __user *usp; 660 u32 __user *usp;
648 u32 swival = __NR_restart_syscall;
649 661
650 regs->ARM_sp -= 12; 662 regs->ARM_sp -= 4;
651 usp = (u32 __user *)regs->ARM_sp; 663 usp = (u32 __user *)regs->ARM_sp;
652 664
653 /* 665 put_user(regs->ARM_pc, usp);
654 * Either we supports OABI only, or we have 666 regs->ARM_pc = KERN_RESTART_CODE;
655 * EABI with the OABI compat layer enabled.
656 * In the later case we don't know if user
657 * space is EABI or not, and if not we must
658 * not clobber r7. Always using the OABI
659 * syscall solves that issue and works for
660 * all those cases.
661 */
662 swival = swival - __NR_SYSCALL_BASE + __NR_OABI_SYSCALL_BASE;
663
664 put_user(regs->ARM_pc, &usp[0]);
665 /* swi __NR_restart_syscall */
666 put_user(0xef000000 | swival, &usp[1]);
667 /* ldr pc, [sp], #12 */
668 put_user(0xe49df00c, &usp[2]);
669
670 flush_icache_range((unsigned long)usp,
671 (unsigned long)(usp + 3));
672
673 regs->ARM_pc = regs->ARM_sp + 4;
674#endif 667#endif
675 } 668 }
676 } 669 }
diff --git a/arch/arm/kernel/signal.h b/arch/arm/kernel/signal.h
index 27beece15502..6fcfe8398aa4 100644
--- a/arch/arm/kernel/signal.h
+++ b/arch/arm/kernel/signal.h
@@ -1,12 +1,14 @@
1/* 1/*
2 * linux/arch/arm/kernel/signal.h 2 * linux/arch/arm/kernel/signal.h
3 * 3 *
4 * Copyright (C) 2005 Russell King. 4 * Copyright (C) 2005-2009 Russell King.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * 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 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500) 10#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500)
11#define KERN_RESTART_CODE (KERN_SIGRETURN_CODE + sizeof(sigreturn_codes))
11 12
12extern const unsigned long sigreturn_codes[7]; 13extern const unsigned long sigreturn_codes[7];
14extern const unsigned long syscall_restart_code[2];
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index f838f36eb702..95718a6b50a6 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/kernel/traps.c 2 * linux/arch/arm/kernel/traps.c
3 * 3 *
4 * Copyright (C) 1995-2002 Russell King 4 * Copyright (C) 1995-2009 Russell King
5 * Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds 5 * Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds
6 * 6 *
7 * 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
@@ -751,6 +751,8 @@ void __init early_trap_init(void)
751 */ 751 */
752 memcpy((void *)KERN_SIGRETURN_CODE, sigreturn_codes, 752 memcpy((void *)KERN_SIGRETURN_CODE, sigreturn_codes,
753 sizeof(sigreturn_codes)); 753 sizeof(sigreturn_codes));
754 memcpy((void *)KERN_RESTART_CODE, syscall_restart_code,
755 sizeof(syscall_restart_code));
754 756
755 flush_icache_range(vectors, vectors + PAGE_SIZE); 757 flush_icache_range(vectors, vectors + PAGE_SIZE);
756 modify_domain(DOMAIN_USER, DOMAIN_CLIENT); 758 modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index 39baf1128bfa..786ac2b6914a 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -26,6 +26,15 @@
26 * http://infocenter.arm.com/help/topic/com.arm.doc.subset.swdev.abi/index.html 26 * http://infocenter.arm.com/help/topic/com.arm.doc.subset.swdev.abi/index.html
27 */ 27 */
28 28
29#if !defined (__ARM_EABI__)
30#warning Your compiler does not have EABI support.
31#warning ARM unwind is known to compile only with EABI compilers.
32#warning Change compiler or disable ARM_UNWIND option.
33#elif (__GNUC__ == 4 && __GNUC_MINOR__ <= 2)
34#warning Your compiler is too buggy; it is known to not compile ARM unwind support.
35#warning Change compiler or disable ARM_UNWIND option.
36#endif
37
29#include <linux/kernel.h> 38#include <linux/kernel.h>
30#include <linux/init.h> 39#include <linux/init.h>
31#include <linux/module.h> 40#include <linux/module.h>
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index d581cff80c4c..332b784050b2 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -838,7 +838,7 @@ static void __init at91_add_device_rtt(void)
838 * Watchdog 838 * Watchdog
839 * -------------------------------------------------------------------- */ 839 * -------------------------------------------------------------------- */
840 840
841#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) 841#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
842static struct platform_device at91sam9g45_wdt_device = { 842static struct platform_device at91sam9g45_wdt_device = {
843 .name = "at91_wdt", 843 .name = "at91_wdt",
844 .id = -1, 844 .id = -1,
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 34a9502c48bc..c22df30ed5e5 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -25,6 +25,8 @@
25#define ARCH_ID_AT91SAM9G20 0x019905a0 25#define ARCH_ID_AT91SAM9G20 0x019905a0
26#define ARCH_ID_AT91SAM9RL64 0x019b03a0 26#define ARCH_ID_AT91SAM9RL64 0x019b03a0
27#define ARCH_ID_AT91SAM9G45 0x819b05a0 27#define ARCH_ID_AT91SAM9G45 0x819b05a0
28#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */
29#define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */
28#define ARCH_ID_AT91CAP9 0x039A03A0 30#define ARCH_ID_AT91CAP9 0x039A03A0
29 31
30#define ARCH_ID_AT91SAM9XE128 0x329973a0 32#define ARCH_ID_AT91SAM9XE128 0x329973a0
@@ -41,6 +43,11 @@ static inline unsigned long at91_cpu_identify(void)
41 return (at91_sys_read(AT91_DBGU_CIDR) & ~AT91_CIDR_VERSION); 43 return (at91_sys_read(AT91_DBGU_CIDR) & ~AT91_CIDR_VERSION);
42} 44}
43 45
46static inline unsigned long at91_cpu_fully_identify(void)
47{
48 return at91_sys_read(AT91_DBGU_CIDR);
49}
50
44#define ARCH_EXID_AT91SAM9M11 0x00000001 51#define ARCH_EXID_AT91SAM9M11 0x00000001
45#define ARCH_EXID_AT91SAM9M10 0x00000002 52#define ARCH_EXID_AT91SAM9M10 0x00000002
46#define ARCH_EXID_AT91SAM9G45 0x00000004 53#define ARCH_EXID_AT91SAM9G45 0x00000004
@@ -118,8 +125,10 @@ static inline unsigned long at91cap9_rev_identify(void)
118 125
119#ifdef CONFIG_ARCH_AT91SAM9G45 126#ifdef CONFIG_ARCH_AT91SAM9G45
120#define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45) 127#define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45)
128#define cpu_is_at91sam9g45es() (at91_cpu_fully_identify() == ARCH_ID_AT91SAM9G45ES)
121#else 129#else
122#define cpu_is_at91sam9g45() (0) 130#define cpu_is_at91sam9g45() (0)
131#define cpu_is_at91sam9g45es() (0)
123#endif 132#endif
124 133
125#ifdef CONFIG_ARCH_AT91CAP9 134#ifdef CONFIG_ARCH_AT91CAP9
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index f95dc160c34b..b4357c388d2e 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -206,7 +206,6 @@ static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc)
206 for (i = 0; i < 8; i++) { 206 for (i = 0; i < 8; i++) {
207 if (status & (1 << i)) { 207 if (status & (1 << i)) {
208 int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_B(0)) + i; 208 int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_B(0)) + i;
209 desc = irq_desc + gpio_irq;
210 generic_handle_irq(gpio_irq); 209 generic_handle_irq(gpio_irq);
211 } 210 }
212 } 211 }
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index ca71cf1a72a0..a4a7be308000 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -112,7 +112,7 @@ static void __init edb93xx_register_i2c(void)
112 ARRAY_SIZE(edb93xxa_i2c_board_info)); 112 ARRAY_SIZE(edb93xxa_i2c_board_info));
113 } else if (machine_is_edb9307() || machine_is_edb9312() || 113 } else if (machine_is_edb9307() || machine_is_edb9312() ||
114 machine_is_edb9315()) { 114 machine_is_edb9315()) {
115 ep93xx_register_i2c(&edb93xx_i2c_gpio_data 115 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
116 edb93xx_i2c_board_info, 116 edb93xx_i2c_board_info,
117 ARRAY_SIZE(edb93xx_i2c_board_info)); 117 ARRAY_SIZE(edb93xx_i2c_board_info));
118 } 118 }
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index a3ec33fd79d4..469fd968d517 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -17,7 +17,6 @@ struct ep93xx_eth_data
17 17
18void ep93xx_map_io(void); 18void ep93xx_map_io(void);
19void ep93xx_init_irq(void); 19void ep93xx_init_irq(void);
20void ep93xx_init_time(unsigned long);
21 20
22/* EP93xx System Controller software locked register write */ 21/* EP93xx System Controller software locked register write */
23void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg); 22void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg);
diff --git a/arch/arm/mach-integrator/include/mach/memory.h b/arch/arm/mach-integrator/include/mach/memory.h
index 2b2e7a110724..4891828454f5 100644
--- a/arch/arm/mach-integrator/include/mach/memory.h
+++ b/arch/arm/mach-integrator/include/mach/memory.h
@@ -28,5 +28,6 @@
28#define BUS_OFFSET UL(0x80000000) 28#define BUS_OFFSET UL(0x80000000)
29#define __virt_to_bus(x) ((x) - PAGE_OFFSET + BUS_OFFSET) 29#define __virt_to_bus(x) ((x) - PAGE_OFFSET + BUS_OFFSET)
30#define __bus_to_virt(x) ((x) - BUS_OFFSET + PAGE_OFFSET) 30#define __bus_to_virt(x) ((x) - BUS_OFFSET + PAGE_OFFSET)
31#define __pfn_to_bus(x) (((x) << PAGE_SHIFT) + BUS_OFFSET)
31 32
32#endif 33#endif
diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
index 4089951acb47..ff5e33298914 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -638,9 +638,9 @@ static struct clk_lookup lookups[] = {
638 _REGISTER_CLOCK("mxc-mmc.0", NULL, sdhc1_clk) 638 _REGISTER_CLOCK("mxc-mmc.0", NULL, sdhc1_clk)
639 _REGISTER_CLOCK("mxc-mmc.1", NULL, sdhc2_clk) 639 _REGISTER_CLOCK("mxc-mmc.1", NULL, sdhc2_clk)
640 _REGISTER_CLOCK("mxc-mmc.2", NULL, sdhc3_clk) 640 _REGISTER_CLOCK("mxc-mmc.2", NULL, sdhc3_clk)
641 _REGISTER_CLOCK(NULL, "cspi1", cspi1_clk) 641 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk)
642 _REGISTER_CLOCK(NULL, "cspi2", cspi2_clk) 642 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
643 _REGISTER_CLOCK(NULL, "cspi3", cspi3_clk) 643 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk)
644 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 644 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
645 _REGISTER_CLOCK(NULL, "csi", csi_clk) 645 _REGISTER_CLOCK(NULL, "csi", csi_clk)
646 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk) 646 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk)
@@ -665,7 +665,7 @@ static struct clk_lookup lookups[] = {
665 _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk) 665 _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
666 _REGISTER_CLOCK(NULL, "ata", ata_clk) 666 _REGISTER_CLOCK(NULL, "ata", ata_clk)
667 _REGISTER_CLOCK(NULL, "mstick", mstick_clk) 667 _REGISTER_CLOCK(NULL, "mstick", mstick_clk)
668 _REGISTER_CLOCK(NULL, "wdog", wdog_clk) 668 _REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
669 _REGISTER_CLOCK(NULL, "gpio", gpio_clk) 669 _REGISTER_CLOCK(NULL, "gpio", gpio_clk)
670 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 670 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
671 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 671 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c
index ee65dda584cf..906d59b0a7aa 100644
--- a/arch/arm/mach-mx2/pcm038.c
+++ b/arch/arm/mach-mx2/pcm038.c
@@ -23,6 +23,10 @@
23#include <linux/mtd/plat-ram.h> 23#include <linux/mtd/plat-ram.h>
24#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/regulator/machine.h>
27#include <linux/mfd/mc13783.h>
28#include <linux/spi/spi.h>
29#include <linux/irq.h>
26 30
27#include <asm/mach-types.h> 31#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
@@ -35,6 +39,7 @@
35#include <mach/iomux.h> 39#include <mach/iomux.h>
36#include <mach/imx-uart.h> 40#include <mach/imx-uart.h>
37#include <mach/mxc_nand.h> 41#include <mach/mxc_nand.h>
42#include <mach/spi.h>
38 43
39#include "devices.h" 44#include "devices.h"
40 45
@@ -78,8 +83,6 @@ static int pcm038_pins[] = {
78 PC6_PF_I2C2_SCL, 83 PC6_PF_I2C2_SCL,
79 /* SPI1 */ 84 /* SPI1 */
80 PD25_PF_CSPI1_RDY, 85 PD25_PF_CSPI1_RDY,
81 PD27_PF_CSPI1_SS1,
82 PD28_PF_CSPI1_SS0,
83 PD29_PF_CSPI1_SCLK, 86 PD29_PF_CSPI1_SCLK,
84 PD30_PF_CSPI1_MISO, 87 PD30_PF_CSPI1_MISO,
85 PD31_PF_CSPI1_MOSI, 88 PD31_PF_CSPI1_MOSI,
@@ -196,6 +199,86 @@ static struct i2c_board_info pcm038_i2c_devices[] = {
196 } 199 }
197}; 200};
198 201
202static int pcm038_spi_cs[] = {GPIO_PORTD + 28};
203
204static struct spi_imx_master pcm038_spi_0_data = {
205 .chipselect = pcm038_spi_cs,
206 .num_chipselect = ARRAY_SIZE(pcm038_spi_cs),
207};
208
209static struct regulator_consumer_supply sdhc1_consumers[] = {
210 {
211 .dev = &mxc_sdhc_device1.dev,
212 .supply = "sdhc_vcc",
213 },
214};
215
216static struct regulator_init_data sdhc1_data = {
217 .constraints = {
218 .min_uV = 3000000,
219 .max_uV = 3400000,
220 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
221 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
222 .valid_modes_mask = REGULATOR_MODE_NORMAL |
223 REGULATOR_MODE_FAST,
224 .always_on = 0,
225 .boot_on = 0,
226 },
227 .num_consumer_supplies = ARRAY_SIZE(sdhc1_consumers),
228 .consumer_supplies = sdhc1_consumers,
229};
230
231static struct regulator_consumer_supply cam_consumers[] = {
232 {
233 .dev = NULL,
234 .supply = "imx_cam_vcc",
235 },
236};
237
238static struct regulator_init_data cam_data = {
239 .constraints = {
240 .min_uV = 3000000,
241 .max_uV = 3400000,
242 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
243 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
244 .valid_modes_mask = REGULATOR_MODE_NORMAL |
245 REGULATOR_MODE_FAST,
246 .always_on = 0,
247 .boot_on = 0,
248 },
249 .num_consumer_supplies = ARRAY_SIZE(cam_consumers),
250 .consumer_supplies = cam_consumers,
251};
252
253struct mc13783_regulator_init_data pcm038_regulators[] = {
254 {
255 .id = MC13783_REGU_VCAM,
256 .init_data = &cam_data,
257 }, {
258 .id = MC13783_REGU_VMMC1,
259 .init_data = &sdhc1_data,
260 },
261};
262
263static struct mc13783_platform_data pcm038_pmic = {
264 .regulators = pcm038_regulators,
265 .num_regulators = ARRAY_SIZE(pcm038_regulators),
266 .flags = MC13783_USE_ADC | MC13783_USE_REGULATOR |
267 MC13783_USE_TOUCHSCREEN,
268};
269
270static struct spi_board_info pcm038_spi_board_info[] __initdata = {
271 {
272 .modalias = "mc13783",
273 .irq = IRQ_GPIOB(23),
274 .max_speed_hz = 300000,
275 .bus_num = 0,
276 .chip_select = 0,
277 .platform_data = &pcm038_pmic,
278 .mode = SPI_CS_HIGH,
279 }
280};
281
199static void __init pcm038_init(void) 282static void __init pcm038_init(void)
200{ 283{
201 mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins), 284 mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins),
@@ -219,6 +302,15 @@ static void __init pcm038_init(void)
219 /* PE18 for user-LED D40 */ 302 /* PE18 for user-LED D40 */
220 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT); 303 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT);
221 304
305 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
306
307 /* MC13783 IRQ */
308 mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN);
309
310 mxc_register_device(&mxc_spi_device0, &pcm038_spi_0_data);
311 spi_register_board_info(pcm038_spi_board_info,
312 ARRAY_SIZE(pcm038_spi_board_info));
313
222 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 314 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
223 315
224#ifdef CONFIG_MACH_PCM970_BASEBOARD 316#ifdef CONFIG_MACH_PCM970_BASEBOARD
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-mx2/pcm970-baseboard.c
index c261f59b0b4c..3cb7f457e5d0 100644
--- a/arch/arm/mach-mx2/pcm970-baseboard.c
+++ b/arch/arm/mach-mx2/pcm970-baseboard.c
@@ -39,7 +39,6 @@ static int pcm970_pins[] = {
39 PB7_PF_SD2_D3, 39 PB7_PF_SD2_D3,
40 PB8_PF_SD2_CMD, 40 PB8_PF_SD2_CMD,
41 PB9_PF_SD2_CLK, 41 PB9_PF_SD2_CLK,
42 GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN, /* card detect */
43 /* display */ 42 /* display */
44 PA5_PF_LSCLK, 43 PA5_PF_LSCLK,
45 PA6_PF_LD0, 44 PA6_PF_LD0,
@@ -228,6 +227,7 @@ void __init pcm970_baseboard_init(void)
228 "PCM970"); 227 "PCM970");
229 228
230 mxc_register_device(&mxc_fb_device, &pcm038_fb_data); 229 mxc_register_device(&mxc_fb_device, &pcm038_fb_data);
230 mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
231 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); 231 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
232 platform_device_register(&pcm970_sja1000); 232 platform_device_register(&pcm970_sja1000);
233} 233}
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
index eb12de1da42d..63511de3a559 100644
--- a/arch/arm/mach-mx25/devices.c
+++ b/arch/arm/mach-mx25/devices.c
@@ -1,4 +1,23 @@
1/*
2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18
1#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/dma-mapping.h>
2#include <linux/gpio.h> 21#include <linux/gpio.h>
3#include <mach/mx25.h> 22#include <mach/mx25.h>
4#include <mach/irqs.h> 23#include <mach/irqs.h>
diff --git a/arch/arm/mach-mx25/mx25pdk.c b/arch/arm/mach-mx25/mx25pdk.c
index 92aa4fd19d99..d23ae571c03f 100644
--- a/arch/arm/mach-mx25/mx25pdk.c
+++ b/arch/arm/mach-mx25/mx25pdk.c
@@ -1,3 +1,21 @@
1/*
2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18
1#include <linux/types.h> 19#include <linux/types.h>
2#include <linux/init.h> 20#include <linux/init.h>
3#include <linux/clk.h> 21#include <linux/clk.h>
@@ -23,19 +41,12 @@ static struct imxuart_platform_data uart_pdata = {
23 .flags = IMXUART_HAVE_RTSCTS, 41 .flags = IMXUART_HAVE_RTSCTS,
24}; 42};
25 43
26static struct mxc_nand_platform_data nand_board_info = {
27 .width = 1,
28 .hw_ecc = 1,
29};
30
31static void __init mx25pdk_init(void) 44static void __init mx25pdk_init(void)
32{ 45{
33 mxc_register_device(&mxc_uart_device0, &uart_pdata); 46 mxc_register_device(&mxc_uart_device0, &uart_pdata);
34 mxc_register_device(&mxc_usbh2, NULL); 47 mxc_register_device(&mxc_usbh2, NULL);
35 mxc_register_device(&mxc_nand_device, &nand_board_info);
36} 48}
37 49
38
39static void __init mx25pdk_timer_init(void) 50static void __init mx25pdk_timer_init(void)
40{ 51{
41 mx25_clocks_init(26000000); 52 mx25_clocks_init(26000000);
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index fe5c4217322e..c595260ec1f9 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -443,7 +443,7 @@ static struct clk_lookup lookups[] = {
443 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk) 443 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)
444 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk) 444 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
445 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk) 445 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk)
446 _REGISTER_CLOCK("mxc_wdt.0", NULL, wdog_clk) 446 _REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
447 _REGISTER_CLOCK(NULL, "max", max_clk) 447 _REGISTER_CLOCK(NULL, "max", max_clk)
448 _REGISTER_CLOCK(NULL, "admux", admux_clk) 448 _REGISTER_CLOCK(NULL, "admux", admux_clk)
449 _REGISTER_CLOCK(NULL, "csi", csi_clk) 449 _REGISTER_CLOCK(NULL, "csi", csi_clk)
diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index 06bd6180bfc3..b2a3bcf8266e 100644
--- a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -530,7 +530,7 @@ static struct clk_lookup lookups[] = {
530 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk) 530 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk)
531 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 531 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
532 _REGISTER_CLOCK(NULL, "pwm", pwm_clk) 532 _REGISTER_CLOCK(NULL, "pwm", pwm_clk)
533 _REGISTER_CLOCK(NULL, "wdog", wdog_clk) 533 _REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
534 _REGISTER_CLOCK(NULL, "rtc", rtc_clk) 534 _REGISTER_CLOCK(NULL, "rtc", rtc_clk)
535 _REGISTER_CLOCK(NULL, "epit", epit1_clk) 535 _REGISTER_CLOCK(NULL, "epit", epit1_clk)
536 _REGISTER_CLOCK(NULL, "epit", epit2_clk) 536 _REGISTER_CLOCK(NULL, "epit", epit2_clk)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index 8a577f367250..e6abe181b967 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -459,7 +459,7 @@ struct platform_device mxc_usbh2 = {
459 * SPI master controller 459 * SPI master controller
460 * 3 channels 460 * 3 channels
461 */ 461 */
462static struct resource imx_spi_0_resources[] = { 462static struct resource mxc_spi_0_resources[] = {
463 { 463 {
464 .start = CSPI1_BASE_ADDR, 464 .start = CSPI1_BASE_ADDR,
465 .end = CSPI1_BASE_ADDR + SZ_4K - 1, 465 .end = CSPI1_BASE_ADDR + SZ_4K - 1,
@@ -471,7 +471,7 @@ static struct resource imx_spi_0_resources[] = {
471 }, 471 },
472}; 472};
473 473
474static struct resource imx_spi_1_resources[] = { 474static struct resource mxc_spi_1_resources[] = {
475 { 475 {
476 .start = CSPI2_BASE_ADDR, 476 .start = CSPI2_BASE_ADDR,
477 .end = CSPI2_BASE_ADDR + SZ_4K - 1, 477 .end = CSPI2_BASE_ADDR + SZ_4K - 1,
@@ -483,7 +483,7 @@ static struct resource imx_spi_1_resources[] = {
483 }, 483 },
484}; 484};
485 485
486static struct resource imx_spi_2_resources[] = { 486static struct resource mxc_spi_2_resources[] = {
487 { 487 {
488 .start = CSPI3_BASE_ADDR, 488 .start = CSPI3_BASE_ADDR,
489 .end = CSPI3_BASE_ADDR + SZ_4K - 1, 489 .end = CSPI3_BASE_ADDR + SZ_4K - 1,
@@ -495,25 +495,25 @@ static struct resource imx_spi_2_resources[] = {
495 }, 495 },
496}; 496};
497 497
498struct platform_device imx_spi_device0 = { 498struct platform_device mxc_spi_device0 = {
499 .name = "spi_imx", 499 .name = "spi_imx",
500 .id = 0, 500 .id = 0,
501 .num_resources = ARRAY_SIZE(imx_spi_0_resources), 501 .num_resources = ARRAY_SIZE(mxc_spi_0_resources),
502 .resource = imx_spi_0_resources, 502 .resource = mxc_spi_0_resources,
503}; 503};
504 504
505struct platform_device imx_spi_device1 = { 505struct platform_device mxc_spi_device1 = {
506 .name = "spi_imx", 506 .name = "spi_imx",
507 .id = 1, 507 .id = 1,
508 .num_resources = ARRAY_SIZE(imx_spi_1_resources), 508 .num_resources = ARRAY_SIZE(mxc_spi_1_resources),
509 .resource = imx_spi_1_resources, 509 .resource = mxc_spi_1_resources,
510}; 510};
511 511
512struct platform_device imx_spi_device2 = { 512struct platform_device mxc_spi_device2 = {
513 .name = "spi_imx", 513 .name = "spi_imx",
514 .id = 2, 514 .id = 2,
515 .num_resources = ARRAY_SIZE(imx_spi_2_resources), 515 .num_resources = ARRAY_SIZE(mxc_spi_2_resources),
516 .resource = imx_spi_2_resources, 516 .resource = mxc_spi_2_resources,
517}; 517};
518 518
519#ifdef CONFIG_ARCH_MX35 519#ifdef CONFIG_ARCH_MX35
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 79f2be45d139..ab87419dc9a0 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -20,7 +20,7 @@ extern struct platform_device mxc_otg_host;
20extern struct platform_device mxc_usbh1; 20extern struct platform_device mxc_usbh1;
21extern struct platform_device mxc_usbh2; 21extern struct platform_device mxc_usbh2;
22extern struct platform_device mxc_rnga_device; 22extern struct platform_device mxc_rnga_device;
23extern struct platform_device imx_spi_device0; 23extern struct platform_device mxc_spi_device0;
24extern struct platform_device imx_spi_device1; 24extern struct platform_device mxc_spi_device1;
25extern struct platform_device imx_spi_device2; 25extern struct platform_device mxc_spi_device2;
26 26
diff --git a/arch/arm/mach-mx3/mm.c b/arch/arm/mach-mx3/mm.c
index ad5a1122d765..bedf5b8d976a 100644
--- a/arch/arm/mach-mx3/mm.c
+++ b/arch/arm/mach-mx3/mm.c
@@ -81,6 +81,7 @@ void __init mx31_map_io(void)
81 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 81 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
82} 82}
83 83
84#ifdef CONFIG_ARCH_MX35
84void __init mx35_map_io(void) 85void __init mx35_map_io(void)
85{ 86{
86 mxc_set_cpu_type(MXC_CPU_MX35); 87 mxc_set_cpu_type(MXC_CPU_MX35);
@@ -89,6 +90,7 @@ void __init mx35_map_io(void)
89 90
90 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 91 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
91} 92}
93#endif
92 94
93void __init mx31_init_irq(void) 95void __init mx31_init_irq(void)
94{ 96{
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 42920f9c1a11..8ad5cc3e83e3 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -219,6 +219,10 @@ static struct platform_device *ams_delta_devices[] __initdata = {
219 219
220static void __init ams_delta_init(void) 220static void __init ams_delta_init(void)
221{ 221{
222 /* mux pins for uarts */
223 omap_cfg_reg(UART1_TX);
224 omap_cfg_reg(UART1_RTS);
225
222 iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc)); 226 iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
223 227
224 omap_board_config = ams_delta_config; 228 omap_board_config = ams_delta_config;
@@ -231,6 +235,8 @@ static void __init ams_delta_init(void)
231 235
232 omap_usb_init(&ams_delta_usb_config); 236 omap_usb_init(&ams_delta_usb_config);
233 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); 237 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
238
239 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
234} 240}
235 241
236static struct plat_serial8250_port ams_delta_modem_ports[] = { 242static struct plat_serial8250_port ams_delta_modem_ports[] = {
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index fb47239da72f..6c8a41f20e51 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -64,6 +64,14 @@ static void __init omap_generic_init(void)
64{ 64{
65#ifdef CONFIG_ARCH_OMAP15XX 65#ifdef CONFIG_ARCH_OMAP15XX
66 if (cpu_is_omap15xx()) { 66 if (cpu_is_omap15xx()) {
67 /* mux pins for uarts */
68 omap_cfg_reg(UART1_TX);
69 omap_cfg_reg(UART1_RTS);
70 omap_cfg_reg(UART2_TX);
71 omap_cfg_reg(UART2_RTS);
72 omap_cfg_reg(UART3_TX);
73 omap_cfg_reg(UART3_RX);
74
67 omap_usb_init(&generic1510_usb_config); 75 omap_usb_init(&generic1510_usb_config);
68 } 76 }
69#endif 77#endif
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index cc2abbb2d0f4..cd6c39514826 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -376,6 +376,26 @@ static void __init innovator_init(void)
376{ 376{
377#ifdef CONFIG_ARCH_OMAP15XX 377#ifdef CONFIG_ARCH_OMAP15XX
378 if (cpu_is_omap1510()) { 378 if (cpu_is_omap1510()) {
379 unsigned char reg;
380
381 /* mux pins for uarts */
382 omap_cfg_reg(UART1_TX);
383 omap_cfg_reg(UART1_RTS);
384 omap_cfg_reg(UART2_TX);
385 omap_cfg_reg(UART2_RTS);
386 omap_cfg_reg(UART3_TX);
387 omap_cfg_reg(UART3_RX);
388
389 reg = fpga_read(OMAP1510_FPGA_POWER);
390 reg |= OMAP1510_FPGA_PCR_COM1_EN;
391 fpga_write(reg, OMAP1510_FPGA_POWER);
392 udelay(10);
393
394 reg = fpga_read(OMAP1510_FPGA_POWER);
395 reg |= OMAP1510_FPGA_PCR_COM2_EN;
396 fpga_write(reg, OMAP1510_FPGA_POWER);
397 udelay(10);
398
379 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices)); 399 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
380 spi_register_board_info(innovator1510_boardinfo, 400 spi_register_board_info(innovator1510_boardinfo,
381 ARRAY_SIZE(innovator1510_boardinfo)); 401 ARRAY_SIZE(innovator1510_boardinfo));
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 90dd0431b0dc..4de258420f39 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -342,6 +342,14 @@ static void __init palmte_misc_gpio_setup(void)
342 342
343static void __init omap_palmte_init(void) 343static void __init omap_palmte_init(void)
344{ 344{
345 /* mux pins for uarts */
346 omap_cfg_reg(UART1_TX);
347 omap_cfg_reg(UART1_RTS);
348 omap_cfg_reg(UART2_TX);
349 omap_cfg_reg(UART2_RTS);
350 omap_cfg_reg(UART3_TX);
351 omap_cfg_reg(UART3_RX);
352
345 omap_board_config = palmte_config; 353 omap_board_config = palmte_config;
346 omap_board_config_size = ARRAY_SIZE(palmte_config); 354 omap_board_config_size = ARRAY_SIZE(palmte_config);
347 355
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 8256139891ff..d972cf941b76 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -289,6 +289,14 @@ static void __init omap_mpu_wdt_mode(int mode) {
289 289
290static void __init omap_palmtt_init(void) 290static void __init omap_palmtt_init(void)
291{ 291{
292 /* mux pins for uarts */
293 omap_cfg_reg(UART1_TX);
294 omap_cfg_reg(UART1_RTS);
295 omap_cfg_reg(UART2_TX);
296 omap_cfg_reg(UART2_RTS);
297 omap_cfg_reg(UART3_TX);
298 omap_cfg_reg(UART3_RX);
299
292 omap_mpu_wdt_mode(0); 300 omap_mpu_wdt_mode(0);
293 301
294 omap_board_config = palmtt_config; 302 omap_board_config = palmtt_config;
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 81b6bde1c5a3..986bd4df0e97 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -307,6 +307,14 @@ palmz71_gpio_setup(int early)
307static void __init 307static void __init
308omap_palmz71_init(void) 308omap_palmz71_init(void)
309{ 309{
310 /* mux pins for uarts */
311 omap_cfg_reg(UART1_TX);
312 omap_cfg_reg(UART1_RTS);
313 omap_cfg_reg(UART2_TX);
314 omap_cfg_reg(UART2_RTS);
315 omap_cfg_reg(UART3_TX);
316 omap_cfg_reg(UART3_RX);
317
310 palmz71_gpio_setup(1); 318 palmz71_gpio_setup(1);
311 omap_mpu_wdt_mode(0); 319 omap_mpu_wdt_mode(0);
312 320
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 02c85ca2e1df..056ae64e0f55 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -377,6 +377,14 @@ static struct omap_board_config_kernel sx1_config[] __initdata = {
377 377
378static void __init omap_sx1_init(void) 378static void __init omap_sx1_init(void)
379{ 379{
380 /* mux pins for uarts */
381 omap_cfg_reg(UART1_TX);
382 omap_cfg_reg(UART1_RTS);
383 omap_cfg_reg(UART2_TX);
384 omap_cfg_reg(UART2_RTS);
385 omap_cfg_reg(UART3_TX);
386 omap_cfg_reg(UART3_RX);
387
380 platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices)); 388 platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
381 389
382 omap_board_config = sx1_config; 390 omap_board_config = sx1_config;
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index c06e7a553472..07b07522d5bf 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -152,6 +152,14 @@ static void __init voiceblue_init_irq(void)
152 152
153static void __init voiceblue_init(void) 153static void __init voiceblue_init(void)
154{ 154{
155 /* mux pins for uarts */
156 omap_cfg_reg(UART1_TX);
157 omap_cfg_reg(UART1_RTS);
158 omap_cfg_reg(UART2_TX);
159 omap_cfg_reg(UART2_RTS);
160 omap_cfg_reg(UART3_TX);
161 omap_cfg_reg(UART3_RX);
162
155 /* Watchdog */ 163 /* Watchdog */
156 gpio_request(0, "Watchdog"); 164 gpio_request(0, "Watchdog");
157 /* smc91x reset */ 165 /* smc91x reset */
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index d496e50fec40..d23979bc0fd5 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -131,8 +131,6 @@ void __init omap_serial_init(void)
131 } 131 }
132 132
133 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { 133 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
134 unsigned char reg;
135
136 switch (i) { 134 switch (i) {
137 case 0: 135 case 0:
138 uart1_ck = clk_get(NULL, "uart1_ck"); 136 uart1_ck = clk_get(NULL, "uart1_ck");
@@ -143,16 +141,6 @@ void __init omap_serial_init(void)
143 if (cpu_is_omap15xx()) 141 if (cpu_is_omap15xx())
144 clk_set_rate(uart1_ck, 12000000); 142 clk_set_rate(uart1_ck, 12000000);
145 } 143 }
146 if (cpu_is_omap15xx()) {
147 omap_cfg_reg(UART1_TX);
148 omap_cfg_reg(UART1_RTS);
149 if (machine_is_omap_innovator()) {
150 reg = fpga_read(OMAP1510_FPGA_POWER);
151 reg |= OMAP1510_FPGA_PCR_COM1_EN;
152 fpga_write(reg, OMAP1510_FPGA_POWER);
153 udelay(10);
154 }
155 }
156 break; 144 break;
157 case 1: 145 case 1:
158 uart2_ck = clk_get(NULL, "uart2_ck"); 146 uart2_ck = clk_get(NULL, "uart2_ck");
@@ -165,16 +153,6 @@ void __init omap_serial_init(void)
165 else 153 else
166 clk_set_rate(uart2_ck, 48000000); 154 clk_set_rate(uart2_ck, 48000000);
167 } 155 }
168 if (cpu_is_omap15xx()) {
169 omap_cfg_reg(UART2_TX);
170 omap_cfg_reg(UART2_RTS);
171 if (machine_is_omap_innovator()) {
172 reg = fpga_read(OMAP1510_FPGA_POWER);
173 reg |= OMAP1510_FPGA_PCR_COM2_EN;
174 fpga_write(reg, OMAP1510_FPGA_POWER);
175 udelay(10);
176 }
177 }
178 break; 156 break;
179 case 2: 157 case 2:
180 uart3_ck = clk_get(NULL, "uart3_ck"); 158 uart3_ck = clk_get(NULL, "uart3_ck");
@@ -185,10 +163,6 @@ void __init omap_serial_init(void)
185 if (cpu_is_omap15xx()) 163 if (cpu_is_omap15xx())
186 clk_set_rate(uart3_ck, 12000000); 164 clk_set_rate(uart3_ck, 12000000);
187 } 165 }
188 if (cpu_is_omap15xx()) {
189 omap_cfg_reg(UART3_TX);
190 omap_cfg_reg(UART3_RX);
191 }
192 break; 166 break;
193 } 167 }
194 omap_serial_reset(&serial_platform_data[i]); 168 omap_serial_reset(&serial_platform_data[i]);
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 75b1c7efae7e..aad194f61a33 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -73,9 +73,21 @@ config MACH_OMAP_3430SDP
73 bool "OMAP 3430 SDP board" 73 bool "OMAP 3430 SDP board"
74 depends on ARCH_OMAP3 && ARCH_OMAP34XX 74 depends on ARCH_OMAP3 && ARCH_OMAP34XX
75 75
76config MACH_NOKIA_N800
77 bool
78
79config MACH_NOKIA_N810
80 bool
81
82config MACH_NOKIA_N810_WIMAX
83 bool
84
76config MACH_NOKIA_N8X0 85config MACH_NOKIA_N8X0
77 bool "Nokia N800/N810" 86 bool "Nokia N800/N810"
78 depends on ARCH_OMAP2420 87 depends on ARCH_OMAP2420
88 select MACH_NOKIA_N800
89 select MACH_NOKIA_N810
90 select MACH_NOKIA_N810_WIMAX
79 91
80config MACH_NOKIA_RX51 92config MACH_NOKIA_RX51
81 bool "Nokia RX-51 board" 93 bool "Nokia RX-51 board"
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index efaf053eba85..0acb5560229c 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -17,6 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/input.h> 19#include <linux/input.h>
20#include <linux/input/matrix_keypad.h>
20#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
21#include <linux/spi/ads7846.h> 22#include <linux/spi/ads7846.h>
22#include <linux/i2c/twl4030.h> 23#include <linux/i2c/twl4030.h>
@@ -38,7 +39,6 @@
38#include <mach/gpmc.h> 39#include <mach/gpmc.h>
39 40
40#include <mach/control.h> 41#include <mach/control.h>
41#include <mach/keypad.h>
42#include <mach/gpmc-smc91x.h> 42#include <mach/gpmc-smc91x.h>
43 43
44#include "sdram-qimonda-hyb18m512160af-6.h" 44#include "sdram-qimonda-hyb18m512160af-6.h"
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index eb37c40ea83a..609a5a4a7e29 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -58,6 +58,8 @@ static void __init gic_init_irq(void)
58 58
59static void __init omap_4430sdp_init_irq(void) 59static void __init omap_4430sdp_init_irq(void)
60{ 60{
61 omap_board_config = sdp4430_config;
62 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
61 omap2_init_common_hw(NULL, NULL); 63 omap2_init_common_hw(NULL, NULL);
62#ifdef CONFIG_OMAP_32K_TIMER 64#ifdef CONFIG_OMAP_32K_TIMER
63 omap2_gp_clockevent_set_gptimer(1); 65 omap2_gp_clockevent_set_gptimer(1);
@@ -70,8 +72,6 @@ static void __init omap_4430sdp_init_irq(void)
70static void __init omap_4430sdp_init(void) 72static void __init omap_4430sdp_init(void)
71{ 73{
72 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 74 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
73 omap_board_config = sdp4430_config;
74 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
75 omap_serial_init(); 75 omap_serial_init();
76} 76}
77 77
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d110a7fdfbd8..d57ec2f4d0a9 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -16,6 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/input/matrix_keypad.h>
19#include <linux/gpio_keys.h> 20#include <linux/gpio_keys.h>
20#include <linux/workqueue.h> 21#include <linux/workqueue.h>
21#include <linux/err.h> 22#include <linux/err.h>
@@ -41,7 +42,6 @@
41#include <asm/delay.h> 42#include <asm/delay.h>
42#include <mach/control.h> 43#include <mach/control.h>
43#include <mach/usb.h> 44#include <mach/usb.h>
44#include <mach/keypad.h>
45 45
46#include "mmc-twl4030.h" 46#include "mmc-twl4030.h"
47 47
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index e4ec0c591216..4c4d7f8dbd72 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -20,6 +20,7 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/input/matrix_keypad.h>
23#include <linux/leds.h> 24#include <linux/leds.h>
24 25
25#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
@@ -37,7 +38,6 @@
37#include <mach/usb.h> 38#include <mach/usb.h>
38#include <mach/common.h> 39#include <mach/common.h>
39#include <mach/mcspi.h> 40#include <mach/mcspi.h>
40#include <mach/keypad.h>
41 41
42#include "sdram-micron-mt46h32m32lf-6.h" 42#include "sdram-micron-mt46h32m32lf-6.h"
43#include "mmc-twl4030.h" 43#include "mmc-twl4030.h"
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 7f6bf8772af7..5326e0d61597 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -27,6 +27,7 @@
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl4030.h>
28#include <linux/leds.h> 28#include <linux/leds.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/input/matrix_keypad.h>
30#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
@@ -39,7 +40,6 @@
39#include <mach/hardware.h> 40#include <mach/hardware.h>
40#include <mach/mcspi.h> 41#include <mach/mcspi.h>
41#include <mach/usb.h> 42#include <mach/usb.h>
42#include <mach/keypad.h>
43#include <mach/mux.h> 43#include <mach/mux.h>
44 44
45#include "sdram-micron-mt46h32m32lf-6.h" 45#include "sdram-micron-mt46h32m32lf-6.h"
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index c1af5326e92f..e34d96a825e3 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/input.h> 14#include <linux/input.h>
15#include <linux/input/matrix_keypad.h>
15#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
16#include <linux/i2c.h> 17#include <linux/i2c.h>
17#include <linux/i2c/twl4030.h> 18#include <linux/i2c/twl4030.h>
@@ -27,7 +28,6 @@
27#include <mach/common.h> 28#include <mach/common.h>
28#include <mach/dma.h> 29#include <mach/dma.h>
29#include <mach/gpmc.h> 30#include <mach/gpmc.h>
30#include <mach/keypad.h>
31#include <mach/onenand.h> 31#include <mach/onenand.h>
32#include <mach/gpmc-smc91x.h> 32#include <mach/gpmc-smc91x.h>
33 33
@@ -444,7 +444,7 @@ static int __init rx51_i2c_init(void)
444 rx51_twldata.vaux3 = &rx51_vaux3_cam; 444 rx51_twldata.vaux3 = &rx51_vaux3_cam;
445 rx51_twldata.vmmc2 = &rx51_vmmc2; 445 rx51_twldata.vmmc2 = &rx51_vmmc2;
446 } 446 }
447 omap_register_i2c_bus(1, 2600, rx51_peripherals_i2c_board_info_1, 447 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
448 ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); 448 ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
449 omap_register_i2c_bus(2, 100, NULL, 0); 449 omap_register_i2c_bus(2, 100, NULL, 0);
450 omap_register_i2c_bus(3, 400, NULL, 0); 450 omap_register_i2c_bus(3, 400, NULL, 0);
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index f9196c3b1a7b..78869a9a1cc2 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -26,7 +26,6 @@
26#include <mach/mux.h> 26#include <mach/mux.h>
27#include <mach/board.h> 27#include <mach/board.h>
28#include <mach/common.h> 28#include <mach/common.h>
29#include <mach/keypad.h>
30#include <mach/dma.h> 29#include <mach/dma.h>
31#include <mach/gpmc.h> 30#include <mach/gpmc.h>
32#include <mach/usb.h> 31#include <mach/usb.h>
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index b7b32208ced7..ea00486a5e53 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/input.h> 15#include <linux/input.h>
16#include <linux/input/matrix_keypad.h>
16#include <linux/gpio.h> 17#include <linux/gpio.h>
17#include <linux/i2c/twl4030.h> 18#include <linux/i2c/twl4030.h>
18#include <linux/regulator/machine.h> 19#include <linux/regulator/machine.h>
@@ -22,9 +23,9 @@
22 23
23#include <mach/common.h> 24#include <mach/common.h>
24#include <mach/usb.h> 25#include <mach/usb.h>
25#include <mach/keypad.h>
26 26
27#include "mmc-twl4030.h" 27#include "mmc-twl4030.h"
28#include "sdram-micron-mt46h32m32lf-6.h"
28 29
29/* Zoom2 has Qwerty keyboard*/ 30/* Zoom2 has Qwerty keyboard*/
30static int board_keymap[] = { 31static int board_keymap[] = {
@@ -213,7 +214,8 @@ static void __init omap_zoom2_init_irq(void)
213{ 214{
214 omap_board_config = zoom2_config; 215 omap_board_config = zoom2_config;
215 omap_board_config_size = ARRAY_SIZE(zoom2_config); 216 omap_board_config_size = ARRAY_SIZE(zoom2_config);
216 omap2_init_common_hw(NULL, NULL); 217 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
218 mt46h32m32lf6_sdrc_params);
217 omap_init_irq(); 219 omap_init_irq();
218 omap_gpio_init(); 220 omap_gpio_init();
219} 221}
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index bc5d3ac66611..e2dbedd581e8 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -769,6 +769,7 @@ int __init omap2_clk_init(void)
769 if (c->cpu & cpu_mask) { 769 if (c->cpu & cpu_mask) {
770 clkdev_add(&c->lk); 770 clkdev_add(&c->lk);
771 clk_register(c->lk.clk); 771 clk_register(c->lk.clk);
772 omap2_init_clk_clkdm(c->lk.clk);
772 } 773 }
773 774
774 /* Check the MPU rate set by bootloader */ 775 /* Check the MPU rate set by bootloader */
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 4ef7b4f5474e..58aff8485df9 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -137,6 +137,36 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
137 } 137 }
138} 138}
139 139
140/*
141 * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit
142 * @clkdm: struct clockdomain *
143 * @enable: int 0 to disable, 1 to enable
144 *
145 * Internal helper for actually switching the bit that controls hwsup
146 * idle transitions for clkdm.
147 */
148static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable)
149{
150 u32 v;
151
152 if (cpu_is_omap24xx()) {
153 if (enable)
154 v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
155 else
156 v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
157 } else if (cpu_is_omap34xx()) {
158 if (enable)
159 v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
160 else
161 v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
162 } else {
163 BUG();
164 }
165
166 cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
167 v << __ffs(clkdm->clktrctrl_mask),
168 clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
169}
140 170
141static struct clockdomain *_clkdm_lookup(const char *name) 171static struct clockdomain *_clkdm_lookup(const char *name)
142{ 172{
@@ -456,8 +486,6 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
456 */ 486 */
457void omap2_clkdm_allow_idle(struct clockdomain *clkdm) 487void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
458{ 488{
459 u32 v;
460
461 if (!clkdm) 489 if (!clkdm)
462 return; 490 return;
463 491
@@ -473,18 +501,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
473 if (atomic_read(&clkdm->usecount) > 0) 501 if (atomic_read(&clkdm->usecount) > 0)
474 _clkdm_add_autodeps(clkdm); 502 _clkdm_add_autodeps(clkdm);
475 503
476 if (cpu_is_omap24xx()) 504 _omap2_clkdm_set_hwsup(clkdm, 1);
477 v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
478 else if (cpu_is_omap34xx())
479 v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
480 else
481 BUG();
482
483
484 cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
485 v << __ffs(clkdm->clktrctrl_mask),
486 clkdm->pwrdm.ptr->prcm_offs,
487 CM_CLKSTCTRL);
488 505
489 pwrdm_clkdm_state_switch(clkdm); 506 pwrdm_clkdm_state_switch(clkdm);
490} 507}
@@ -500,8 +517,6 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
500 */ 517 */
501void omap2_clkdm_deny_idle(struct clockdomain *clkdm) 518void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
502{ 519{
503 u32 v;
504
505 if (!clkdm) 520 if (!clkdm)
506 return; 521 return;
507 522
@@ -514,16 +529,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
514 pr_debug("clockdomain: disabling automatic idle transitions for %s\n", 529 pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
515 clkdm->name); 530 clkdm->name);
516 531
517 if (cpu_is_omap24xx()) 532 _omap2_clkdm_set_hwsup(clkdm, 0);
518 v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
519 else if (cpu_is_omap34xx())
520 v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
521 else
522 BUG();
523
524 cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
525 v << __ffs(clkdm->clktrctrl_mask),
526 clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
527 533
528 if (atomic_read(&clkdm->usecount) > 0) 534 if (atomic_read(&clkdm->usecount) > 0)
529 _clkdm_del_autodeps(clkdm); 535 _clkdm_del_autodeps(clkdm);
@@ -569,10 +575,14 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
569 v = omap2_clkdm_clktrctrl_read(clkdm); 575 v = omap2_clkdm_clktrctrl_read(clkdm);
570 576
571 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || 577 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
572 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) 578 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
579 /* Disable HW transitions when we are changing deps */
580 _omap2_clkdm_set_hwsup(clkdm, 0);
573 _clkdm_add_autodeps(clkdm); 581 _clkdm_add_autodeps(clkdm);
574 else 582 _omap2_clkdm_set_hwsup(clkdm, 1);
583 } else {
575 omap2_clkdm_wakeup(clkdm); 584 omap2_clkdm_wakeup(clkdm);
585 }
576 586
577 pwrdm_wait_transition(clkdm->pwrdm.ptr); 587 pwrdm_wait_transition(clkdm->pwrdm.ptr);
578 pwrdm_clkdm_state_switch(clkdm); 588 pwrdm_clkdm_state_switch(clkdm);
@@ -623,10 +633,14 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
623 v = omap2_clkdm_clktrctrl_read(clkdm); 633 v = omap2_clkdm_clktrctrl_read(clkdm);
624 634
625 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || 635 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
626 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) 636 (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
637 /* Disable HW transitions when we are changing deps */
638 _omap2_clkdm_set_hwsup(clkdm, 0);
627 _clkdm_del_autodeps(clkdm); 639 _clkdm_del_autodeps(clkdm);
628 else 640 _omap2_clkdm_set_hwsup(clkdm, 1);
641 } else {
629 omap2_clkdm_sleep(clkdm); 642 omap2_clkdm_sleep(clkdm);
643 }
630 644
631 pwrdm_clkdm_state_switch(clkdm); 645 pwrdm_clkdm_state_switch(clkdm);
632 646
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index e3a3bad1d84f..56be87d13edb 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -302,7 +302,9 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
302 pwrdm_init(powerdomains_omap); 302 pwrdm_init(powerdomains_omap);
303 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); 303 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
304 omap2_clk_init(); 304 omap2_clk_init();
305#endif
305 omap_serial_early_init(); 306 omap_serial_early_init();
307#ifndef CONFIG_ARCH_OMAP4
306 omap_hwmod_late_init(); 308 omap_hwmod_late_init();
307 omap_pm_if_init(); 309 omap_pm_if_init();
308 omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 310 omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 378c2f618358..89463190923a 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -639,14 +639,15 @@ static void __init prcm_setup_regs(void)
639 prm_write_mod_reg(OMAP3430_IO_EN | OMAP3430_WKUP_EN, 639 prm_write_mod_reg(OMAP3430_IO_EN | OMAP3430_WKUP_EN,
640 OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 640 OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
641 641
642 /* Enable GPIO wakeups in PER */ 642 /* Enable wakeups in PER */
643 prm_write_mod_reg(OMAP3430_EN_GPIO2 | OMAP3430_EN_GPIO3 | 643 prm_write_mod_reg(OMAP3430_EN_GPIO2 | OMAP3430_EN_GPIO3 |
644 OMAP3430_EN_GPIO4 | OMAP3430_EN_GPIO5 | 644 OMAP3430_EN_GPIO4 | OMAP3430_EN_GPIO5 |
645 OMAP3430_EN_GPIO6, OMAP3430_PER_MOD, PM_WKEN); 645 OMAP3430_EN_GPIO6 | OMAP3430_EN_UART3,
646 OMAP3430_PER_MOD, PM_WKEN);
646 /* and allow them to wake up MPU */ 647 /* and allow them to wake up MPU */
647 prm_write_mod_reg(OMAP3430_GRPSEL_GPIO2 | OMAP3430_EN_GPIO3 | 648 prm_write_mod_reg(OMAP3430_GRPSEL_GPIO2 | OMAP3430_EN_GPIO3 |
648 OMAP3430_GRPSEL_GPIO4 | OMAP3430_EN_GPIO5 | 649 OMAP3430_GRPSEL_GPIO4 | OMAP3430_EN_GPIO5 |
649 OMAP3430_GRPSEL_GPIO6, 650 OMAP3430_GRPSEL_GPIO6 | OMAP3430_EN_UART3,
650 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL); 651 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL);
651 652
652 /* Don't attach IVA interrupts */ 653 /* Don't attach IVA interrupts */
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index ae2186892c85..54dfeb5d5667 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -109,16 +109,6 @@ static struct plat_serial8250_port serial_platform_data2[] = {
109 .regshift = 2, 109 .regshift = 2,
110 .uartclk = OMAP24XX_BASE_BAUD * 16, 110 .uartclk = OMAP24XX_BASE_BAUD * 16,
111 }, { 111 }, {
112#ifdef CONFIG_ARCH_OMAP4
113 .membase = OMAP2_IO_ADDRESS(OMAP_UART4_BASE),
114 .mapbase = OMAP_UART4_BASE,
115 .irq = 70,
116 .flags = UPF_BOOT_AUTOCONF,
117 .iotype = UPIO_MEM,
118 .regshift = 2,
119 .uartclk = OMAP24XX_BASE_BAUD * 16,
120 }, {
121#endif
122 .flags = 0 112 .flags = 0
123 } 113 }
124}; 114};
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index aac2cda60e09..102916f1e465 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -43,10 +43,10 @@
43 43
44#define CM_X300_ETH_PHYS 0x08000010 44#define CM_X300_ETH_PHYS 0x08000010
45 45
46#define GPIO82_MMC2_IRQ (82) 46#define GPIO82_MMC_IRQ (82)
47#define GPIO85_MMC2_WP (85) 47#define GPIO85_MMC_WP (85)
48 48
49#define CM_X300_MMC2_IRQ IRQ_GPIO(GPIO82_MMC2_IRQ) 49#define CM_X300_MMC_IRQ IRQ_GPIO(GPIO82_MMC_IRQ)
50 50
51#define GPIO95_RTC_CS (95) 51#define GPIO95_RTC_CS (95)
52#define GPIO96_RTC_WR (96) 52#define GPIO96_RTC_WR (96)
@@ -292,37 +292,37 @@ static inline void cm_x300_init_nand(void) {}
292#endif 292#endif
293 293
294#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) 294#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
295/* The first MMC slot of CM-X300 is hardwired to Libertas card and has 295static struct pxamci_platform_data cm_x300_mci_platform_data = {
296 .detect_delay = 20,
297 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
298 .gpio_card_detect = GPIO82_MMC_IRQ,
299 .gpio_card_ro = GPIO85_MMC_WP,
300 .gpio_power = -1,
301};
302
303/* The second MMC slot of CM-X300 is hardwired to Libertas card and has
296 no detection/ro pins */ 304 no detection/ro pins */
297static int cm_x300_mci_init(struct device *dev, 305static int cm_x300_mci2_init(struct device *dev,
298 irq_handler_t cm_x300_detect_int, 306 irq_handler_t cm_x300_detect_int,
299 void *data) 307 void *data)
300{ 308{
301 return 0; 309 return 0;
302} 310}
303 311
304static void cm_x300_mci_exit(struct device *dev, void *data) 312static void cm_x300_mci2_exit(struct device *dev, void *data)
305{ 313{
306} 314}
307 315
308static struct pxamci_platform_data cm_x300_mci_platform_data = { 316static struct pxamci_platform_data cm_x300_mci2_platform_data = {
309 .detect_delay = 20, 317 .detect_delay = 20,
310 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 318 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
311 .init = cm_x300_mci_init, 319 .init = cm_x300_mci2_init,
312 .exit = cm_x300_mci_exit, 320 .exit = cm_x300_mci2_exit,
313 .gpio_card_detect = -1, 321 .gpio_card_detect = -1,
314 .gpio_card_ro = -1, 322 .gpio_card_ro = -1,
315 .gpio_power = -1, 323 .gpio_power = -1,
316}; 324};
317 325
318static struct pxamci_platform_data cm_x300_mci2_platform_data = {
319 .detect_delay = 20,
320 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
321 .gpio_card_detect = GPIO82_MMC2_IRQ,
322 .gpio_card_ro = GPIO85_MMC2_WP,
323 .gpio_power = -1,
324};
325
326static void __init cm_x300_init_mmc(void) 326static void __init cm_x300_init_mmc(void)
327{ 327{
328 pxa_set_mci_info(&cm_x300_mci_platform_data); 328 pxa_set_mci_info(&cm_x300_mci_platform_data);
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index ee8d6038ce82..82ff5733e4dc 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/gpio_keys.h>
18#include <linux/gpio.h> 19#include <linux/gpio.h>
19#include <linux/leds.h> 20#include <linux/leds.h>
20#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
@@ -375,6 +376,43 @@ static struct platform_device spitzkbd_device = {
375}; 376};
376 377
377 378
379static struct gpio_keys_button spitz_gpio_keys[] = {
380 {
381 .type = EV_PWR,
382 .code = KEY_SUSPEND,
383 .gpio = SPITZ_GPIO_ON_KEY,
384 .desc = "On/Off",
385 .wakeup = 1,
386 },
387 /* Two buttons detecting the lid state */
388 {
389 .type = EV_SW,
390 .code = 0,
391 .gpio = SPITZ_GPIO_SWA,
392 .desc = "Display Down",
393 },
394 {
395 .type = EV_SW,
396 .code = 1,
397 .gpio = SPITZ_GPIO_SWB,
398 .desc = "Lid Closed",
399 },
400};
401
402static struct gpio_keys_platform_data spitz_gpio_keys_platform_data = {
403 .buttons = spitz_gpio_keys,
404 .nbuttons = ARRAY_SIZE(spitz_gpio_keys),
405};
406
407static struct platform_device spitz_gpio_keys_device = {
408 .name = "gpio-keys",
409 .id = -1,
410 .dev = {
411 .platform_data = &spitz_gpio_keys_platform_data,
412 },
413};
414
415
378/* 416/*
379 * Spitz LEDs 417 * Spitz LEDs
380 */ 418 */
@@ -689,6 +727,7 @@ static struct platform_device sharpsl_rom_device = {
689static struct platform_device *devices[] __initdata = { 727static struct platform_device *devices[] __initdata = {
690 &spitzscoop_device, 728 &spitzscoop_device,
691 &spitzkbd_device, 729 &spitzkbd_device,
730 &spitz_gpio_keys_device,
692 &spitzled_device, 731 &spitzled_device,
693 &sharpsl_nand_device, 732 &sharpsl_nand_device,
694 &sharpsl_rom_device, 733 &sharpsl_rom_device,
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 46cd6acb4d40..699671fa6e0b 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -61,5 +61,5 @@ extern void realview_timer_init(unsigned int timer_irq);
61extern int realview_flash_register(struct resource *res, u32 num); 61extern int realview_flash_register(struct resource *res, u32 num);
62extern int realview_eth_register(const char *name, struct resource *res); 62extern int realview_eth_register(const char *name, struct resource *res);
63extern int realview_usb_register(struct resource *res); 63extern int realview_usb_register(struct resource *res);
64 64extern void (*realview_reset)(char);
65#endif 65#endif
diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
index 98f8e7eeacc2..34b80b7d40b8 100644
--- a/arch/arm/mach-realview/include/mach/board-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -73,4 +73,9 @@
73#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000 /* GIC distributor, on FPGA */ 73#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000 /* GIC distributor, on FPGA */
74#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */ 74#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */
75 75
76/*
77 * Control register SYS_RESETCTL is set to 1 to force a soft reset
78 */
79#define REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL 0x0100
80
76#endif /* __ASM_ARCH_BOARD_PB1176_H */ 81#endif /* __ASM_ARCH_BOARD_PB1176_H */
diff --git a/arch/arm/mach-realview/include/mach/board-pb11mp.h b/arch/arm/mach-realview/include/mach/board-pb11mp.h
index f0d68e0fea01..7abf918b77e9 100644
--- a/arch/arm/mach-realview/include/mach/board-pb11mp.h
+++ b/arch/arm/mach-realview/include/mach/board-pb11mp.h
@@ -81,4 +81,16 @@
81#define REALVIEW_TC11MP_GIC_DIST_BASE 0x1F001000 /* Test chip interrupt controller distributor */ 81#define REALVIEW_TC11MP_GIC_DIST_BASE 0x1F001000 /* Test chip interrupt controller distributor */
82#define REALVIEW_TC11MP_L220_BASE 0x1F002000 /* L220 registers */ 82#define REALVIEW_TC11MP_L220_BASE 0x1F002000 /* L220 registers */
83 83
84 /*
85 * Values for REALVIEW_SYS_RESET_CTRL
86 */
87#define REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR 0x01
88#define REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGINIT 0x02
89#define REALVIEW_PB11MP_SYS_CTRL_RESET_DLLRESET 0x03
90#define REALVIEW_PB11MP_SYS_CTRL_RESET_PLLRESET 0x04
91#define REALVIEW_PB11MP_SYS_CTRL_RESET_POR 0x05
92#define REALVIEW_PB11MP_SYS_CTRL_RESET_DoC 0x06
93
94#define REALVIEW_PB11MP_SYS_CTRL_LED (1 << 0)
95
84#endif /* __ASM_ARCH_BOARD_PB11MP_H */ 96#endif /* __ASM_ARCH_BOARD_PB11MP_H */
diff --git a/arch/arm/mach-realview/include/mach/platform.h b/arch/arm/mach-realview/include/mach/platform.h
index c8f50835fed2..4f46bf71e752 100644
--- a/arch/arm/mach-realview/include/mach/platform.h
+++ b/arch/arm/mach-realview/include/mach/platform.h
@@ -119,19 +119,6 @@
119#define REALVIEW_SYS_TEST_OSC3 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC3_OFFSET) 119#define REALVIEW_SYS_TEST_OSC3 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC3_OFFSET)
120#define REALVIEW_SYS_TEST_OSC4 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC4_OFFSET) 120#define REALVIEW_SYS_TEST_OSC4 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC4_OFFSET)
121 121
122/*
123 * Values for REALVIEW_SYS_RESET_CTRL
124 */
125#define REALVIEW_SYS_CTRL_RESET_CONFIGCLR 0x01
126#define REALVIEW_SYS_CTRL_RESET_CONFIGINIT 0x02
127#define REALVIEW_SYS_CTRL_RESET_DLLRESET 0x03
128#define REALVIEW_SYS_CTRL_RESET_PLLRESET 0x04
129#define REALVIEW_SYS_CTRL_RESET_POR 0x05
130#define REALVIEW_SYS_CTRL_RESET_DoC 0x06
131
132#define REALVIEW_SYS_CTRL_LED (1 << 0)
133
134
135/* ------------------------------------------------------------------------ 122/* ------------------------------------------------------------------------
136 * RealView control registers 123 * RealView control registers
137 * ------------------------------------------------------------------------ 124 * ------------------------------------------------------------------------
@@ -153,7 +140,7 @@
153 * SYS_CLD, SYS_BOOTCS 140 * SYS_CLD, SYS_BOOTCS
154 */ 141 */
155#define REALVIEW_SYS_LOCK_LOCKED (1 << 16) 142#define REALVIEW_SYS_LOCK_LOCKED (1 << 16)
156#define REALVIEW_SYS_LOCKVAL_MASK 0xFFFF /* write 0xA05F to enable write access */ 143#define REALVIEW_SYS_LOCKVAL_MASK 0xA05F /* Enable write access */
157 144
158/* 145/*
159 * REALVIEW_SYS_FLASH 146 * REALVIEW_SYS_FLASH
diff --git a/arch/arm/mach-realview/include/mach/system.h b/arch/arm/mach-realview/include/mach/system.h
index 1a15a441e027..a30f2e3ec178 100644
--- a/arch/arm/mach-realview/include/mach/system.h
+++ b/arch/arm/mach-realview/include/mach/system.h
@@ -25,6 +25,8 @@
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/platform.h> 26#include <mach/platform.h>
27 27
28void (*realview_reset)(char mode);
29
28static inline void arch_idle(void) 30static inline void arch_idle(void)
29{ 31{
30 /* 32 /*
@@ -36,16 +38,12 @@ static inline void arch_idle(void)
36 38
37static inline void arch_reset(char mode, const char *cmd) 39static inline void arch_reset(char mode, const char *cmd)
38{ 40{
39 void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_RESETCTL_OFFSET;
40 unsigned int val;
41
42 /* 41 /*
43 * To reset, we hit the on-board reset register 42 * To reset, we hit the on-board reset register
44 * in the system FPGA 43 * in the system FPGA
45 */ 44 */
46 val = __raw_readl(hdr_ctrl); 45 if (realview_reset)
47 val |= REALVIEW_SYS_CTRL_RESET_CONFIGCLR; 46 realview_reset(mode);
48 __raw_writel(val, hdr_ctrl);
49} 47}
50 48
51#endif 49#endif
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index 2817fe099319..a6ba147692c1 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -290,6 +290,16 @@ static struct sys_timer realview_pb1176_timer = {
290 .init = realview_pb1176_timer_init, 290 .init = realview_pb1176_timer_init,
291}; 291};
292 292
293static void realview_pb1176_reset(char mode)
294{
295 void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) +
296 REALVIEW_SYS_RESETCTL_OFFSET;
297 void __iomem *rst_hdr_ctrl = __io_address(REALVIEW_SYS_BASE) +
298 REALVIEW_SYS_LOCK_OFFSET;
299 __raw_writel(REALVIEW_SYS_LOCKVAL_MASK, rst_hdr_ctrl);
300 __raw_writel(REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL, hdr_ctrl);
301}
302
293static void __init realview_pb1176_init(void) 303static void __init realview_pb1176_init(void)
294{ 304{
295 int i; 305 int i;
@@ -313,6 +323,7 @@ static void __init realview_pb1176_init(void)
313#ifdef CONFIG_LEDS 323#ifdef CONFIG_LEDS
314 leds_event = realview_leds_event; 324 leds_event = realview_leds_event;
315#endif 325#endif
326 realview_reset = realview_pb1176_reset;
316} 327}
317 328
318MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176") 329MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 94680fcf726d..070d284ce96e 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -299,6 +299,21 @@ static struct sys_timer realview_pb11mp_timer = {
299 .init = realview_pb11mp_timer_init, 299 .init = realview_pb11mp_timer_init,
300}; 300};
301 301
302static void realview_pb11mp_reset(char mode)
303{
304 void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) +
305 REALVIEW_SYS_RESETCTL_OFFSET;
306 unsigned int val;
307
308 /*
309 * To reset, we hit the on-board reset register
310 * in the system FPGA
311 */
312 val = __raw_readl(hdr_ctrl);
313 val |= REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR;
314 __raw_writel(val, hdr_ctrl);
315}
316
302static void __init realview_pb11mp_init(void) 317static void __init realview_pb11mp_init(void)
303{ 318{
304 int i; 319 int i;
@@ -324,6 +339,7 @@ static void __init realview_pb11mp_init(void)
324#ifdef CONFIG_LEDS 339#ifdef CONFIG_LEDS
325 leds_event = realview_leds_event; 340 leds_event = realview_leds_event;
326#endif 341#endif
342 realview_reset = realview_pb11mp_reset;
327} 343}
328 344
329MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") 345MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
diff --git a/arch/arm/mach-s3c2410/gpio.c b/arch/arm/mach-s3c2410/gpio.c
index 7974afca297c..9664e011dae2 100644
--- a/arch/arm/mach-s3c2410/gpio.c
+++ b/arch/arm/mach-s3c2410/gpio.c
@@ -28,6 +28,7 @@
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/gpio-fns.h>
31#include <asm/irq.h> 32#include <asm/irq.h>
32 33
33#include <mach/regs-gpio.h> 34#include <mach/regs-gpio.h>
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c2410/include/mach/dma.h
index c3a2629e0ded..92e2687009ea 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -110,6 +110,8 @@ enum s3c2410_dma_loadst {
110 * waiting for reloads */ 110 * waiting for reloads */
111#define S3C2410_DMAF_AUTOSTART (1<<1) /* auto-start if buffer queued */ 111#define S3C2410_DMAF_AUTOSTART (1<<1) /* auto-start if buffer queued */
112 112
113#define S3C2410_DMAF_CIRCULAR (1 << 2) /* no circular dma support */
114
113/* dma buffer */ 115/* dma buffer */
114 116
115struct s3c2410_dma_buf; 117struct s3c2410_dma_buf;
@@ -194,4 +196,9 @@ struct s3c2410_dma_chan {
194 196
195typedef unsigned long dma_device_t; 197typedef unsigned long dma_device_t;
196 198
199static inline bool s3c_dma_has_circular(void)
200{
201 return false;
202}
203
197#endif /* __ASM_ARCH_DMA_H */ 204#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index d7bba919a77e..a8b69d77571b 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -103,6 +103,7 @@ config MACH_MINI2440
103 select LEDS_TRIGGER_BACKLIGHT 103 select LEDS_TRIGGER_BACKLIGHT
104 select SND_S3C24XX_SOC_S3C24XX_UDA134X 104 select SND_S3C24XX_SOC_S3C24XX_UDA134X
105 select S3C_DEV_NAND 105 select S3C_DEV_NAND
106 select S3C_DEV_USB_HOST
106 help 107 help
107 Say Y here to select support for the MINI2440. Is a 10cm x 10cm board 108 Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
108 available via various sources. It can come with a 3.5" or 7" touch LCD. 109 available via various sources. It can come with a 3.5" or 7" touch LCD.
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index ec71a6965786..1c3382fefdd2 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -144,7 +144,7 @@ static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
144 .type = (S3C2410_LCDCON1_TFT16BPP |\ 144 .type = (S3C2410_LCDCON1_TFT16BPP |\
145 S3C2410_LCDCON1_TFT) 145 S3C2410_LCDCON1_TFT)
146 146
147struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = { 147static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
148 [0] = { /* mini2440 + 3.5" TFT + touchscreen */ 148 [0] = { /* mini2440 + 3.5" TFT + touchscreen */
149 _LCD_DECLARE( 149 _LCD_DECLARE(
150 7, /* The 3.5 is quite fast */ 150 7, /* The 3.5 is quite fast */
@@ -191,7 +191,7 @@ struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
191#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2)) 191#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
192#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2)) 192#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
193 193
194struct s3c2410fb_mach_info mini2440_fb_info __initdata = { 194static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
195 .displays = &mini2440_lcd_cfg[0], /* not constant! see init */ 195 .displays = &mini2440_lcd_cfg[0], /* not constant! see init */
196 .num_displays = 1, 196 .num_displays = 1,
197 .default_display = 0, 197 .default_display = 0,
diff --git a/arch/arm/mach-s3c6400/include/mach/dma.h b/arch/arm/mach-s3c6400/include/mach/dma.h
index 1067619f0ba0..004edab23954 100644
--- a/arch/arm/mach-s3c6400/include/mach/dma.h
+++ b/arch/arm/mach-s3c6400/include/mach/dma.h
@@ -68,6 +68,11 @@ static __inline__ int s3c_dma_has_circular(void)
68 68
69#define S3C2410_DMAF_CIRCULAR (1 << 0) 69#define S3C2410_DMAF_CIRCULAR (1 << 0)
70 70
71static inline bool s3c_dma_has_circular(void)
72{
73 return false;
74}
75
71#include <plat/dma.h> 76#include <plat/dma.h>
72 77
73#endif /* __ASM_ARCH_IRQ_H */ 78#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index e993140edd88..9264d814cd7a 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -122,10 +122,7 @@ config CPU_ARM920T
122 select CPU_TLB_V4WBI if MMU 122 select CPU_TLB_V4WBI if MMU
123 help 123 help
124 The ARM920T is licensed to be produced by numerous vendors, 124 The ARM920T is licensed to be produced by numerous vendors,
125 and is used in the Maverick EP9312 and the Samsung S3C2410. 125 and is used in the Cirrus EP93xx and the Samsung S3C2410.
126
127 More information on the Maverick EP9312 at
128 <http://linuxdevices.com/products/PD2382866068.html>.
129 126
130 Say Y if you want support for the ARM920T processor. 127 Say Y if you want support for the ARM920T processor.
131 Otherwise, say N. 128 Otherwise, say N.
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index 6bda76a43199..a9e22e31eaa1 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -50,10 +50,7 @@ void __new_context(struct mm_struct *mm)
50 isb(); 50 isb();
51 flush_tlb_all(); 51 flush_tlb_all();
52 if (icache_is_vivt_asid_tagged()) { 52 if (icache_is_vivt_asid_tagged()) {
53 asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n" 53 __flush_icache_all();
54 "mcr p15, 0, %0, c7, c5, 6 @ flush BTAC/BTB\n"
55 :
56 : "r" (0));
57 dsb(); 54 dsb();
58 } 55 }
59 } 56 }
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index b30925fcbcdc..b9590a7085ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -205,7 +205,7 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
205 205
206 order = get_order(size); 206 order = get_order(size);
207 207
208 if (mask != 0xffffffff) 208 if (mask < 0xffffffffULL)
209 gfp |= GFP_DMA; 209 gfp |= GFP_DMA;
210 210
211 page = alloc_pages(gfp, order); 211 page = alloc_pages(gfp, order);
@@ -289,7 +289,7 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
289 if (!mask) 289 if (!mask)
290 goto error; 290 goto error;
291 291
292 if (mask != 0xffffffff) 292 if (mask < 0xffffffffULL)
293 gfp |= GFP_DMA; 293 gfp |= GFP_DMA;
294 virt = kmalloc(size, gfp); 294 virt = kmalloc(size, gfp);
295 if (!virt) 295 if (!virt)
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index b27942909b23..7f294f307c83 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -18,10 +18,6 @@
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
25#ifdef CONFIG_CPU_CACHE_VIPT 21#ifdef CONFIG_CPU_CACHE_VIPT
26 22
27#define ALIAS_FLUSH_START 0xffff4000 23#define ALIAS_FLUSH_START 0xffff4000
@@ -35,16 +31,11 @@ static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
35 flush_tlb_kernel_page(to); 31 flush_tlb_kernel_page(to);
36 32
37 asm( "mcrr p15, 0, %1, %0, c14\n" 33 asm( "mcrr p15, 0, %1, %0, c14\n"
38 " mcr p15, 0, %2, c7, c10, 4\n" 34 " mcr p15, 0, %2, c7, c10, 4"
39#ifndef CONFIG_ARM_ERRATA_411920
40 " mcr p15, 0, %2, c7, c5, 0\n"
41#endif
42 : 35 :
43 : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES), "r" (zero) 36 : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES), "r" (zero)
44 : "cc"); 37 : "cc");
45#ifdef CONFIG_ARM_ERRATA_411920 38 __flush_icache_all();
46 v6_icache_inval_all();
47#endif
48} 39}
49 40
50void flush_cache_mm(struct mm_struct *mm) 41void flush_cache_mm(struct mm_struct *mm)
@@ -57,16 +48,11 @@ void flush_cache_mm(struct mm_struct *mm)
57 48
58 if (cache_is_vipt_aliasing()) { 49 if (cache_is_vipt_aliasing()) {
59 asm( "mcr p15, 0, %0, c7, c14, 0\n" 50 asm( "mcr p15, 0, %0, c7, c14, 0\n"
60 " mcr p15, 0, %0, c7, c10, 4\n" 51 " mcr p15, 0, %0, c7, c10, 4"
61#ifndef CONFIG_ARM_ERRATA_411920
62 " mcr p15, 0, %0, c7, c5, 0\n"
63#endif
64 : 52 :
65 : "r" (0) 53 : "r" (0)
66 : "cc"); 54 : "cc");
67#ifdef CONFIG_ARM_ERRATA_411920 55 __flush_icache_all();
68 v6_icache_inval_all();
69#endif
70 } 56 }
71} 57}
72 58
@@ -81,16 +67,11 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned
81 67
82 if (cache_is_vipt_aliasing()) { 68 if (cache_is_vipt_aliasing()) {
83 asm( "mcr p15, 0, %0, c7, c14, 0\n" 69 asm( "mcr p15, 0, %0, c7, c14, 0\n"
84 " mcr p15, 0, %0, c7, c10, 4\n" 70 " mcr p15, 0, %0, c7, c10, 4"
85#ifndef CONFIG_ARM_ERRATA_411920
86 " mcr p15, 0, %0, c7, c5, 0\n"
87#endif
88 : 71 :
89 : "r" (0) 72 : "r" (0)
90 : "cc"); 73 : "cc");
91#ifdef CONFIG_ARM_ERRATA_411920 74 __flush_icache_all();
92 v6_icache_inval_all();
93#endif
94 } 75 }
95} 76}
96 77
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 40940d7ce4ff..52c40d155672 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -273,7 +273,6 @@ static void __init bootmem_init_node(int node, struct meminfo *mi,
273 struct membank *bank = &mi->bank[i]; 273 struct membank *bank = &mi->bank[i];
274 if (!bank->highmem) 274 if (!bank->highmem)
275 free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); 275 free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank));
276 memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank));
277 } 276 }
278 277
279 /* 278 /*
@@ -370,6 +369,19 @@ int pfn_valid(unsigned long pfn)
370 return 0; 369 return 0;
371} 370}
372EXPORT_SYMBOL(pfn_valid); 371EXPORT_SYMBOL(pfn_valid);
372
373static void arm_memory_present(struct meminfo *mi, int node)
374{
375}
376#else
377static void arm_memory_present(struct meminfo *mi, int node)
378{
379 int i;
380 for_each_nodebank(i, mi, node) {
381 struct membank *bank = &mi->bank[i];
382 memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank));
383 }
384}
373#endif 385#endif
374 386
375static int __init meminfo_cmp(const void *_a, const void *_b) 387static int __init meminfo_cmp(const void *_a, const void *_b)
@@ -427,6 +439,12 @@ void __init bootmem_init(void)
427 */ 439 */
428 if (node == initrd_node) 440 if (node == initrd_node)
429 bootmem_reserve_initrd(node); 441 bootmem_reserve_initrd(node);
442
443 /*
444 * Sparsemem tries to allocate bootmem in memory_present(),
445 * so must be done after the fixed reservations
446 */
447 arm_memory_present(mi, node);
430 } 448 }
431 449
432 /* 450 /*
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 02243eeccf50..ea67be0223ac 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -117,6 +117,13 @@ static void __init early_cachepolicy(char **p)
117 } 117 }
118 if (i == ARRAY_SIZE(cache_policies)) 118 if (i == ARRAY_SIZE(cache_policies))
119 printk(KERN_ERR "ERROR: unknown or unsupported cache policy\n"); 119 printk(KERN_ERR "ERROR: unknown or unsupported cache policy\n");
120 /*
121 * This restriction is partly to do with the way we boot; it is
122 * unpredictable to have memory mapped using two different sets of
123 * memory attributes (shared, type, and cache attribs). We can not
124 * change these attributes once the initial assembly has setup the
125 * page tables.
126 */
120 if (cpu_architecture() >= CPU_ARCH_ARMv6) { 127 if (cpu_architecture() >= CPU_ARCH_ARMv6) {
121 printk(KERN_WARNING "Only cachepolicy=writeback supported on ARMv6 and later\n"); 128 printk(KERN_WARNING "Only cachepolicy=writeback supported on ARMv6 and later\n");
122 cachepolicy = CPOLICY_WRITEBACK; 129 cachepolicy = CPOLICY_WRITEBACK;
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 194737d60a22..70f75d2e3ead 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -32,8 +32,10 @@
32 32
33#ifndef CONFIG_SMP 33#ifndef CONFIG_SMP
34#define TTB_FLAGS TTB_RGN_WBWA 34#define TTB_FLAGS TTB_RGN_WBWA
35#define PMD_FLAGS PMD_SECT_WB
35#else 36#else
36#define TTB_FLAGS TTB_RGN_WBWA|TTB_S 37#define TTB_FLAGS TTB_RGN_WBWA|TTB_S
38#define PMD_FLAGS PMD_SECT_WBWA|PMD_SECT_S
37#endif 39#endif
38 40
39ENTRY(cpu_v6_proc_init) 41ENTRY(cpu_v6_proc_init)
@@ -222,10 +224,9 @@ __v6_proc_info:
222 .long 0x0007b000 224 .long 0x0007b000
223 .long 0x0007f000 225 .long 0x0007f000
224 .long PMD_TYPE_SECT | \ 226 .long PMD_TYPE_SECT | \
225 PMD_SECT_BUFFERABLE | \
226 PMD_SECT_CACHEABLE | \
227 PMD_SECT_AP_WRITE | \ 227 PMD_SECT_AP_WRITE | \
228 PMD_SECT_AP_READ 228 PMD_SECT_AP_READ | \
229 PMD_FLAGS
229 .long PMD_TYPE_SECT | \ 230 .long PMD_TYPE_SECT | \
230 PMD_SECT_XN | \ 231 PMD_SECT_XN | \
231 PMD_SECT_AP_WRITE | \ 232 PMD_SECT_AP_WRITE | \
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 23ebcf6eab9f..eeeed01ee44a 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -33,9 +33,11 @@
33#ifndef CONFIG_SMP 33#ifndef CONFIG_SMP
34/* PTWs cacheable, inner WB not shareable, outer WB not shareable */ 34/* PTWs cacheable, inner WB not shareable, outer WB not shareable */
35#define TTB_FLAGS TTB_IRGN_WB|TTB_RGN_OC_WB 35#define TTB_FLAGS TTB_IRGN_WB|TTB_RGN_OC_WB
36#define PMD_FLAGS PMD_SECT_WB
36#else 37#else
37/* PTWs cacheable, inner WBWA shareable, outer WBWA not shareable */ 38/* PTWs cacheable, inner WBWA shareable, outer WBWA not shareable */
38#define TTB_FLAGS TTB_IRGN_WBWA|TTB_S|TTB_NOS|TTB_RGN_OC_WBWA 39#define TTB_FLAGS TTB_IRGN_WBWA|TTB_S|TTB_NOS|TTB_RGN_OC_WBWA
40#define PMD_FLAGS PMD_SECT_WBWA|PMD_SECT_S
39#endif 41#endif
40 42
41ENTRY(cpu_v7_proc_init) 43ENTRY(cpu_v7_proc_init)
@@ -326,10 +328,9 @@ __v7_proc_info:
326 .long 0x000f0000 @ Required ID value 328 .long 0x000f0000 @ Required ID value
327 .long 0x000f0000 @ Mask for ID 329 .long 0x000f0000 @ Mask for ID
328 .long PMD_TYPE_SECT | \ 330 .long PMD_TYPE_SECT | \
329 PMD_SECT_BUFFERABLE | \
330 PMD_SECT_CACHEABLE | \
331 PMD_SECT_AP_WRITE | \ 331 PMD_SECT_AP_WRITE | \
332 PMD_SECT_AP_READ 332 PMD_SECT_AP_READ | \
333 PMD_FLAGS
333 .long PMD_TYPE_SECT | \ 334 .long PMD_TYPE_SECT | \
334 PMD_SECT_XN | \ 335 PMD_SECT_XN | \
335 PMD_SECT_AP_WRITE | \ 336 PMD_SECT_AP_WRITE | \
diff --git a/arch/arm/oprofile/op_model_v6.c b/arch/arm/oprofile/op_model_v6.c
index fe581383d3e2..f7d2ec5ee9a1 100644
--- a/arch/arm/oprofile/op_model_v6.c
+++ b/arch/arm/oprofile/op_model_v6.c
@@ -33,6 +33,9 @@ static int irqs[] = {
33#ifdef CONFIG_ARCH_OMAP2 33#ifdef CONFIG_ARCH_OMAP2
34 3, 34 3,
35#endif 35#endif
36#ifdef CONFIG_ARCH_BCMRING
37 IRQ_PMUIRQ, /* for BCMRING, ARM PMU interrupt is 43 */
38#endif
36}; 39};
37 40
38static void armv6_pmu_stop(void) 41static void armv6_pmu_stop(void)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index fd3154ae69b1..b53125f41293 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -829,10 +829,10 @@ EXPORT_SYMBOL(omap_free_dma);
829 * 829 *
830 * @param arb_rate 830 * @param arb_rate
831 * @param max_fifo_depth 831 * @param max_fifo_depth
832 * @param tparams - Number of thereads to reserve : DMA_THREAD_RESERVE_NORM 832 * @param tparams - Number of threads to reserve : DMA_THREAD_RESERVE_NORM
833 * DMA_THREAD_RESERVE_ONET 833 * DMA_THREAD_RESERVE_ONET
834 * DMA_THREAD_RESERVE_TWOT 834 * DMA_THREAD_RESERVE_TWOT
835 * DMA_THREAD_RESERVE_THREET 835 * DMA_THREAD_RESERVE_THREET
836 */ 836 */
837void 837void
838omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams) 838omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
@@ -844,11 +844,14 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
844 return; 844 return;
845 } 845 }
846 846
847 if (max_fifo_depth == 0)
848 max_fifo_depth = 1;
847 if (arb_rate == 0) 849 if (arb_rate == 0)
848 arb_rate = 1; 850 arb_rate = 1;
849 851
850 reg = (arb_rate & 0xff) << 16; 852 reg = 0xff & max_fifo_depth;
851 reg |= (0xff & max_fifo_depth); 853 reg |= (0x3 & tparams) << 12;
854 reg |= (arb_rate & 0xff) << 16;
852 855
853 dma_write(reg, GCR); 856 dma_write(reg, GCR);
854} 857}
@@ -975,6 +978,14 @@ void omap_stop_dma(int lch)
975{ 978{
976 u32 l; 979 u32 l;
977 980
981 /* Disable all interrupts on the channel */
982 if (cpu_class_is_omap1())
983 dma_write(0, CICR(lch));
984
985 l = dma_read(CCR(lch));
986 l &= ~OMAP_DMA_CCR_EN;
987 dma_write(l, CCR(lch));
988
978 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 989 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
979 int next_lch, cur_lch = lch; 990 int next_lch, cur_lch = lch;
980 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT]; 991 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT];
@@ -992,18 +1003,8 @@ void omap_stop_dma(int lch)
992 next_lch = dma_chan[cur_lch].next_lch; 1003 next_lch = dma_chan[cur_lch].next_lch;
993 cur_lch = next_lch; 1004 cur_lch = next_lch;
994 } while (next_lch != -1); 1005 } while (next_lch != -1);
995
996 return;
997 } 1006 }
998 1007
999 /* Disable all interrupts on the channel */
1000 if (cpu_class_is_omap1())
1001 dma_write(0, CICR(lch));
1002
1003 l = dma_read(CCR(lch));
1004 l &= ~OMAP_DMA_CCR_EN;
1005 dma_write(l, CCR(lch));
1006
1007 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; 1008 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
1008} 1009}
1009EXPORT_SYMBOL(omap_stop_dma); 1010EXPORT_SYMBOL(omap_stop_dma);
diff --git a/arch/arm/plat-omap/include/mach/keypad.h b/arch/arm/plat-omap/include/mach/keypad.h
index d91b9be334ff..3ae52ccc793c 100644
--- a/arch/arm/plat-omap/include/mach/keypad.h
+++ b/arch/arm/plat-omap/include/mach/keypad.h
@@ -10,7 +10,7 @@
10#ifndef ASMARM_ARCH_KEYPAD_H 10#ifndef ASMARM_ARCH_KEYPAD_H
11#define ASMARM_ARCH_KEYPAD_H 11#define ASMARM_ARCH_KEYPAD_H
12 12
13#include <linux/input/matrix_keypad.h> 13#warning: Please update the board to use matrix_keypad.h instead
14 14
15struct omap_kp_platform_data { 15struct omap_kp_platform_data {
16 int rows; 16 int rows;
@@ -37,6 +37,9 @@ struct omap_kp_platform_data {
37 37
38#define KEY_PERSISTENT 0x00800000 38#define KEY_PERSISTENT 0x00800000
39#define KEYNUM_MASK 0x00EFFFFF 39#define KEYNUM_MASK 0x00EFFFFF
40#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
41#define PERSISTENT_KEY(col, row) (((col) << 28) | ((row) << 24) | \
42 KEY_PERSISTENT)
40 43
41#endif 44#endif
42 45
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index 4b6012707307..94584f167a82 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -664,7 +664,7 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da)
664 nent = 1; /* for the next L1 entry */ 664 nent = 1; /* for the next L1 entry */
665 } else { 665 } else {
666 bytes = IOPGD_SIZE; 666 bytes = IOPGD_SIZE;
667 if (*iopgd & IOPGD_SUPER) { 667 if ((*iopgd & IOPGD_SUPER) == IOPGD_SUPER) {
668 nent *= 16; 668 nent *= 16;
669 /* rewind to the 1st entry */ 669 /* rewind to the 1st entry */
670 iopgd = (u32 *)((u32)iopgd & IOSUPER_MASK); 670 iopgd = (u32 *)((u32)iopgd & IOSUPER_MASK);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 88ac9768f1c1..e664b912d7bb 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -595,7 +595,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
595 rx &= 1; 595 rx &= 1;
596 if (cpu_is_omap2430() || cpu_is_omap34xx()) { 596 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
597 w = OMAP_MCBSP_READ(io_base, RCCR); 597 w = OMAP_MCBSP_READ(io_base, RCCR);
598 w |= (tx ? RDISABLE : 0); 598 w |= (rx ? RDISABLE : 0);
599 OMAP_MCBSP_WRITE(io_base, RCCR, w); 599 OMAP_MCBSP_WRITE(io_base, RCCR, w);
600 } 600 }
601 w = OMAP_MCBSP_READ(io_base, SPCR1); 601 w = OMAP_MCBSP_READ(io_base, SPCR1);
diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c
index 4d36b784fb8b..df47322492d5 100644
--- a/arch/arm/plat-s3c24xx/adc.c
+++ b/arch/arm/plat-s3c24xx/adc.c
@@ -189,7 +189,7 @@ int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch)
189err: 189err:
190 return ret; 190 return ret;
191} 191}
192EXPORT_SYMBOL_GPL(s3c_adc_convert); 192EXPORT_SYMBOL_GPL(s3c_adc_read);
193 193
194static void s3c_adc_default_select(struct s3c_adc_client *client, 194static void s3c_adc_default_select(struct s3c_adc_client *client,
195 unsigned select) 195 unsigned select)
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index 5447e60f3936..4af9dd948793 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -61,6 +61,7 @@ static const char name_s3c2410[] = "S3C2410";
61static const char name_s3c2412[] = "S3C2412"; 61static const char name_s3c2412[] = "S3C2412";
62static const char name_s3c2440[] = "S3C2440"; 62static const char name_s3c2440[] = "S3C2440";
63static const char name_s3c2442[] = "S3C2442"; 63static const char name_s3c2442[] = "S3C2442";
64static const char name_s3c2442b[] = "S3C2442B";
64static const char name_s3c2443[] = "S3C2443"; 65static const char name_s3c2443[] = "S3C2443";
65static const char name_s3c2410a[] = "S3C2410A"; 66static const char name_s3c2410a[] = "S3C2410A";
66static const char name_s3c2440a[] = "S3C2440A"; 67static const char name_s3c2440a[] = "S3C2440A";
@@ -112,6 +113,15 @@ static struct cpu_table cpu_ids[] __initdata = {
112 .name = name_s3c2442 113 .name = name_s3c2442
113 }, 114 },
114 { 115 {
116 .idcode = 0x32440aab,
117 .idmask = 0xffffffff,
118 .map_io = s3c244x_map_io,
119 .init_clocks = s3c244x_init_clocks,
120 .init_uarts = s3c244x_init_uarts,
121 .init = s3c2442_init,
122 .name = name_s3c2442b
123 },
124 {
115 .idcode = 0x32412001, 125 .idcode = 0x32412001,
116 .idmask = 0xffffffff, 126 .idmask = 0xffffffff,
117 .map_io = s3c2412_map_io, 127 .map_io = s3c2412_map_io,
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 196b19123653..f046f8c51084 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -208,14 +208,14 @@ s3c2410_dma_loadbuffer(struct s3c2410_dma_chan *chan,
208{ 208{
209 unsigned long reload; 209 unsigned long reload;
210 210
211 pr_debug("s3c2410_chan_loadbuffer: loading buff %p (0x%08lx,0x%06x)\n",
212 buf, (unsigned long)buf->data, buf->size);
213
214 if (buf == NULL) { 211 if (buf == NULL) {
215 dmawarn("buffer is NULL\n"); 212 dmawarn("buffer is NULL\n");
216 return -EINVAL; 213 return -EINVAL;
217 } 214 }
218 215
216 pr_debug("s3c2410_chan_loadbuffer: loading buff %p (0x%08lx,0x%06x)\n",
217 buf, (unsigned long)buf->data, buf->size);
218
219 /* check the state of the channel before we do anything */ 219 /* check the state of the channel before we do anything */
220 220
221 if (chan->load_state == S3C2410_DMALOAD_1LOADED) { 221 if (chan->load_state == S3C2410_DMALOAD_1LOADED) {
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c
index 95df059b5a1d..5467470badfd 100644
--- a/arch/arm/plat-s3c24xx/gpio.c
+++ b/arch/arm/plat-s3c24xx/gpio.c
@@ -29,6 +29,7 @@
29#include <linux/io.h> 29#include <linux/io.h>
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/gpio-fns.h>
32#include <asm/irq.h> 33#include <asm/irq.h>
33 34
34#include <mach/regs-gpio.h> 35#include <mach/regs-gpio.h>
diff --git a/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h b/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
index efeb025affc7..c776120b99e6 100644
--- a/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-s3c24xx/include/plat/cpu-freq-core.h
@@ -222,7 +222,9 @@ extern struct clk *s3c_cpufreq_clk_get(struct device *, const char *);
222/* S3C2410 and compatible exported functions */ 222/* S3C2410 and compatible exported functions */
223 223
224extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg); 224extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
225extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg);
225 226
227#ifdef CONFIG_S3C2410_IOTIMING
226extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg, 228extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
227 struct s3c_iotimings *iot); 229 struct s3c_iotimings *iot);
228 230
@@ -231,8 +233,11 @@ extern int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
231 233
232extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg, 234extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
233 struct s3c_iotimings *iot); 235 struct s3c_iotimings *iot);
234 236#else
235extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg); 237#define s3c2410_iotiming_calc NULL
238#define s3c2410_iotiming_get NULL
239#define s3c2410_iotiming_set NULL
240#endif /* CONFIG_S3C2410_IOTIMING */
236 241
237/* S3C2412 compatible routines */ 242/* S3C2412 compatible routines */
238 243
diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c2410.h b/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
index b6deeef8f663..82ab4aad1bbe 100644
--- a/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
+++ b/arch/arm/plat-s3c24xx/include/plat/s3c2410.h
@@ -27,6 +27,7 @@ extern void s3c2410_init_clocks(int xtal);
27#define s3c2410_init_uarts NULL 27#define s3c2410_init_uarts NULL
28#define s3c2410_map_io NULL 28#define s3c2410_map_io NULL
29#define s3c2410_init NULL 29#define s3c2410_init NULL
30#define s3c2410a_init NULL
30#endif 31#endif
31 32
32extern int s3c2410_baseclk_add(void); 33extern int s3c2410_baseclk_add(void);
diff --git a/arch/arm/plat-s3c64xx/include/plat/regs-clock.h b/arch/arm/plat-s3c64xx/include/plat/regs-clock.h
index a8777a755dfa..ff46e7fa957a 100644
--- a/arch/arm/plat-s3c64xx/include/plat/regs-clock.h
+++ b/arch/arm/plat-s3c64xx/include/plat/regs-clock.h
@@ -51,8 +51,8 @@
51#define S3C6400_CLKDIV0_HCLK_SHIFT (8) 51#define S3C6400_CLKDIV0_HCLK_SHIFT (8)
52#define S3C6400_CLKDIV0_MPLL_MASK (0x1 << 4) 52#define S3C6400_CLKDIV0_MPLL_MASK (0x1 << 4)
53#define S3C6400_CLKDIV0_MPLL_SHIFT (4) 53#define S3C6400_CLKDIV0_MPLL_SHIFT (4)
54#define S3C6400_CLKDIV0_ARM_MASK (0x3 << 0) 54#define S3C6400_CLKDIV0_ARM_MASK (0x7 << 0)
55#define S3C6410_CLKDIV0_ARM_MASK (0x7 << 0) 55#define S3C6410_CLKDIV0_ARM_MASK (0xf << 0)
56#define S3C6400_CLKDIV0_ARM_SHIFT (0) 56#define S3C6400_CLKDIV0_ARM_SHIFT (0)
57 57
58/* CLKDIV1 */ 58/* CLKDIV1 */
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c
index 9745852261e0..6ffa21eb1b91 100644
--- a/arch/arm/plat-s3c64xx/s3c6400-clock.c
+++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c
@@ -677,6 +677,9 @@ void __init_or_cpufreq s3c6400_setup_clocks(void)
677 677
678 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); 678 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
679 679
680 /* For now assume the mux always selects the crystal */
681 clk_ext_xtal_mux.parent = xtal_clk;
682
680 epll = s3c6400_get_epll(xtal); 683 epll = s3c6400_get_epll(xtal);
681 mpll = s3c6400_get_pll(xtal, __raw_readl(S3C_MPLL_CON)); 684 mpll = s3c6400_get_pll(xtal, __raw_readl(S3C_MPLL_CON));
682 apll = s3c6400_get_pll(xtal, __raw_readl(S3C_APLL_CON)); 685 apll = s3c6400_get_pll(xtal, __raw_readl(S3C_APLL_CON));
diff --git a/arch/avr32/mach-at32ap/include/mach/cpu.h b/arch/avr32/mach-at32ap/include/mach/cpu.h
index 44d0bfa1f409..9c96a130f3a8 100644
--- a/arch/avr32/mach-at32ap/include/mach/cpu.h
+++ b/arch/avr32/mach-at32ap/include/mach/cpu.h
@@ -31,5 +31,8 @@
31#define cpu_is_at91sam9263() (0) 31#define cpu_is_at91sam9263() (0)
32#define cpu_is_at91sam9rl() (0) 32#define cpu_is_at91sam9rl() (0)
33#define cpu_is_at91cap9() (0) 33#define cpu_is_at91cap9() (0)
34#define cpu_is_at91sam9g10() (0)
35#define cpu_is_at91sam9g45() (0)
36#define cpu_is_at91sam9g45es() (0)
34 37
35#endif /* __ASM_ARCH_CPU_H */ 38#endif /* __ASM_ARCH_CPU_H */
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index 6b0a2b6fed6a..0974c0ecc594 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -527,7 +527,7 @@ static void do_signal(void)
527 527
528no_signal: 528no_signal:
529 /* Did we come from a system call? */ 529 /* Did we come from a system call? */
530 if (__frame->syscallno >= 0) { 530 if (__frame->syscallno != -1) {
531 /* Restart the system call - no handlers present */ 531 /* Restart the system call - no handlers present */
532 switch (__frame->gr8) { 532 switch (__frame->gr8) {
533 case -ERESTARTNOHAND: 533 case -ERESTARTNOHAND:
diff --git a/arch/ia64/include/asm/spinlock.h b/arch/ia64/include/asm/spinlock.h
index 30bb930e1111..239ecdc9516d 100644
--- a/arch/ia64/include/asm/spinlock.h
+++ b/arch/ia64/include/asm/spinlock.h
@@ -25,61 +25,82 @@
25 * by atomically noting the tail and incrementing it by one (thus adding 25 * by atomically noting the tail and incrementing it by one (thus adding
26 * ourself to the queue and noting our position), then waiting until the head 26 * ourself to the queue and noting our position), then waiting until the head
27 * becomes equal to the the initial value of the tail. 27 * becomes equal to the the initial value of the tail.
28 * The pad bits in the middle are used to prevent the next_ticket number
29 * overflowing into the now_serving number.
28 * 30 *
29 * 63 32 31 0 31 * 31 17 16 15 14 0
30 * +----------------------------------------------------+ 32 * +----------------------------------------------------+
31 * | next_ticket_number | now_serving | 33 * | now_serving | padding | next_ticket |
32 * +----------------------------------------------------+ 34 * +----------------------------------------------------+
33 */ 35 */
34 36
35#define TICKET_SHIFT 32 37#define TICKET_SHIFT 17
38#define TICKET_BITS 15
39#define TICKET_MASK ((1 << TICKET_BITS) - 1)
36 40
37static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock) 41static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
38{ 42{
39 int *p = (int *)&lock->lock, turn, now_serving; 43 int *p = (int *)&lock->lock, ticket, serve;
40 44
41 now_serving = *p; 45 ticket = ia64_fetchadd(1, p, acq);
42 turn = ia64_fetchadd(1, p+1, acq);
43 46
44 if (turn == now_serving) 47 if (!(((ticket >> TICKET_SHIFT) ^ ticket) & TICKET_MASK))
45 return; 48 return;
46 49
47 do { 50 ia64_invala();
51
52 for (;;) {
53 asm volatile ("ld4.c.nc %0=[%1]" : "=r"(serve) : "r"(p) : "memory");
54
55 if (!(((serve >> TICKET_SHIFT) ^ ticket) & TICKET_MASK))
56 return;
48 cpu_relax(); 57 cpu_relax();
49 } while (ACCESS_ONCE(*p) != turn); 58 }
50} 59}
51 60
52static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock) 61static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
53{ 62{
54 long tmp = ACCESS_ONCE(lock->lock), try; 63 int tmp = ACCESS_ONCE(lock->lock);
55
56 if (!(((tmp >> TICKET_SHIFT) ^ tmp) & ((1L << TICKET_SHIFT) - 1))) {
57 try = tmp + (1L << TICKET_SHIFT);
58 64
59 return ia64_cmpxchg(acq, &lock->lock, tmp, try, sizeof (tmp)) == tmp; 65 if (!(((tmp >> TICKET_SHIFT) ^ tmp) & TICKET_MASK))
60 } 66 return ia64_cmpxchg(acq, &lock->lock, tmp, tmp + 1, sizeof (tmp)) == tmp;
61 return 0; 67 return 0;
62} 68}
63 69
64static __always_inline void __ticket_spin_unlock(raw_spinlock_t *lock) 70static __always_inline void __ticket_spin_unlock(raw_spinlock_t *lock)
65{ 71{
66 int *p = (int *)&lock->lock; 72 unsigned short *p = (unsigned short *)&lock->lock + 1, tmp;
67 73
68 (void)ia64_fetchadd(1, p, rel); 74 asm volatile ("ld2.bias %0=[%1]" : "=r"(tmp) : "r"(p));
75 ACCESS_ONCE(*p) = (tmp + 2) & ~1;
76}
77
78static __always_inline void __ticket_spin_unlock_wait(raw_spinlock_t *lock)
79{
80 int *p = (int *)&lock->lock, ticket;
81
82 ia64_invala();
83
84 for (;;) {
85 asm volatile ("ld4.c.nc %0=[%1]" : "=r"(ticket) : "r"(p) : "memory");
86 if (!(((ticket >> TICKET_SHIFT) ^ ticket) & TICKET_MASK))
87 return;
88 cpu_relax();
89 }
69} 90}
70 91
71static inline int __ticket_spin_is_locked(raw_spinlock_t *lock) 92static inline int __ticket_spin_is_locked(raw_spinlock_t *lock)
72{ 93{
73 long tmp = ACCESS_ONCE(lock->lock); 94 long tmp = ACCESS_ONCE(lock->lock);
74 95
75 return !!(((tmp >> TICKET_SHIFT) ^ tmp) & ((1L << TICKET_SHIFT) - 1)); 96 return !!(((tmp >> TICKET_SHIFT) ^ tmp) & TICKET_MASK);
76} 97}
77 98
78static inline int __ticket_spin_is_contended(raw_spinlock_t *lock) 99static inline int __ticket_spin_is_contended(raw_spinlock_t *lock)
79{ 100{
80 long tmp = ACCESS_ONCE(lock->lock); 101 long tmp = ACCESS_ONCE(lock->lock);
81 102
82 return (((tmp >> TICKET_SHIFT) - tmp) & ((1L << TICKET_SHIFT) - 1)) > 1; 103 return ((tmp - (tmp >> TICKET_SHIFT)) & TICKET_MASK) > 1;
83} 104}
84 105
85static inline int __raw_spin_is_locked(raw_spinlock_t *lock) 106static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
@@ -116,8 +137,7 @@ static __always_inline void __raw_spin_lock_flags(raw_spinlock_t *lock,
116 137
117static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) 138static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
118{ 139{
119 while (__raw_spin_is_locked(lock)) 140 __ticket_spin_unlock_wait(lock);
120 cpu_relax();
121} 141}
122 142
123#define __raw_read_can_lock(rw) (*(volatile int *)(rw) >= 0) 143#define __raw_read_can_lock(rw) (*(volatile int *)(rw) >= 0)
diff --git a/arch/ia64/include/asm/spinlock_types.h b/arch/ia64/include/asm/spinlock_types.h
index b61d136d9bc2..474e46f1ab4a 100644
--- a/arch/ia64/include/asm/spinlock_types.h
+++ b/arch/ia64/include/asm/spinlock_types.h
@@ -6,7 +6,7 @@
6#endif 6#endif
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned long lock; 9 volatile unsigned int lock;
10} raw_spinlock_t; 10} raw_spinlock_t;
11 11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 } 12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index d2877a7bfe2e..496ac7a99488 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -887,6 +887,60 @@ ia64_mca_modify_comm(const struct task_struct *previous_current)
887 memcpy(current->comm, comm, sizeof(current->comm)); 887 memcpy(current->comm, comm, sizeof(current->comm));
888} 888}
889 889
890static void
891finish_pt_regs(struct pt_regs *regs, const pal_min_state_area_t *ms,
892 unsigned long *nat)
893{
894 const u64 *bank;
895
896 /* If ipsr.ic then use pmsa_{iip,ipsr,ifs}, else use
897 * pmsa_{xip,xpsr,xfs}
898 */
899 if (ia64_psr(regs)->ic) {
900 regs->cr_iip = ms->pmsa_iip;
901 regs->cr_ipsr = ms->pmsa_ipsr;
902 regs->cr_ifs = ms->pmsa_ifs;
903 } else {
904 regs->cr_iip = ms->pmsa_xip;
905 regs->cr_ipsr = ms->pmsa_xpsr;
906 regs->cr_ifs = ms->pmsa_xfs;
907 }
908 regs->pr = ms->pmsa_pr;
909 regs->b0 = ms->pmsa_br0;
910 regs->ar_rsc = ms->pmsa_rsc;
911 copy_reg(&ms->pmsa_gr[1-1], ms->pmsa_nat_bits, &regs->r1, nat);
912 copy_reg(&ms->pmsa_gr[2-1], ms->pmsa_nat_bits, &regs->r2, nat);
913 copy_reg(&ms->pmsa_gr[3-1], ms->pmsa_nat_bits, &regs->r3, nat);
914 copy_reg(&ms->pmsa_gr[8-1], ms->pmsa_nat_bits, &regs->r8, nat);
915 copy_reg(&ms->pmsa_gr[9-1], ms->pmsa_nat_bits, &regs->r9, nat);
916 copy_reg(&ms->pmsa_gr[10-1], ms->pmsa_nat_bits, &regs->r10, nat);
917 copy_reg(&ms->pmsa_gr[11-1], ms->pmsa_nat_bits, &regs->r11, nat);
918 copy_reg(&ms->pmsa_gr[12-1], ms->pmsa_nat_bits, &regs->r12, nat);
919 copy_reg(&ms->pmsa_gr[13-1], ms->pmsa_nat_bits, &regs->r13, nat);
920 copy_reg(&ms->pmsa_gr[14-1], ms->pmsa_nat_bits, &regs->r14, nat);
921 copy_reg(&ms->pmsa_gr[15-1], ms->pmsa_nat_bits, &regs->r15, nat);
922 if (ia64_psr(regs)->bn)
923 bank = ms->pmsa_bank1_gr;
924 else
925 bank = ms->pmsa_bank0_gr;
926 copy_reg(&bank[16-16], ms->pmsa_nat_bits, &regs->r16, nat);
927 copy_reg(&bank[17-16], ms->pmsa_nat_bits, &regs->r17, nat);
928 copy_reg(&bank[18-16], ms->pmsa_nat_bits, &regs->r18, nat);
929 copy_reg(&bank[19-16], ms->pmsa_nat_bits, &regs->r19, nat);
930 copy_reg(&bank[20-16], ms->pmsa_nat_bits, &regs->r20, nat);
931 copy_reg(&bank[21-16], ms->pmsa_nat_bits, &regs->r21, nat);
932 copy_reg(&bank[22-16], ms->pmsa_nat_bits, &regs->r22, nat);
933 copy_reg(&bank[23-16], ms->pmsa_nat_bits, &regs->r23, nat);
934 copy_reg(&bank[24-16], ms->pmsa_nat_bits, &regs->r24, nat);
935 copy_reg(&bank[25-16], ms->pmsa_nat_bits, &regs->r25, nat);
936 copy_reg(&bank[26-16], ms->pmsa_nat_bits, &regs->r26, nat);
937 copy_reg(&bank[27-16], ms->pmsa_nat_bits, &regs->r27, nat);
938 copy_reg(&bank[28-16], ms->pmsa_nat_bits, &regs->r28, nat);
939 copy_reg(&bank[29-16], ms->pmsa_nat_bits, &regs->r29, nat);
940 copy_reg(&bank[30-16], ms->pmsa_nat_bits, &regs->r30, nat);
941 copy_reg(&bank[31-16], ms->pmsa_nat_bits, &regs->r31, nat);
942}
943
890/* On entry to this routine, we are running on the per cpu stack, see 944/* On entry to this routine, we are running on the per cpu stack, see
891 * mca_asm.h. The original stack has not been touched by this event. Some of 945 * mca_asm.h. The original stack has not been touched by this event. Some of
892 * the original stack's registers will be in the RBS on this stack. This stack 946 * the original stack's registers will be in the RBS on this stack. This stack
@@ -921,7 +975,6 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
921 u64 r12 = ms->pmsa_gr[12-1], r13 = ms->pmsa_gr[13-1]; 975 u64 r12 = ms->pmsa_gr[12-1], r13 = ms->pmsa_gr[13-1];
922 u64 ar_bspstore = regs->ar_bspstore; 976 u64 ar_bspstore = regs->ar_bspstore;
923 u64 ar_bsp = regs->ar_bspstore + (loadrs >> 16); 977 u64 ar_bsp = regs->ar_bspstore + (loadrs >> 16);
924 const u64 *bank;
925 const char *msg; 978 const char *msg;
926 int cpu = smp_processor_id(); 979 int cpu = smp_processor_id();
927 980
@@ -1024,54 +1077,9 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
1024 p = (char *)r12 - sizeof(*regs); 1077 p = (char *)r12 - sizeof(*regs);
1025 old_regs = (struct pt_regs *)p; 1078 old_regs = (struct pt_regs *)p;
1026 memcpy(old_regs, regs, sizeof(*regs)); 1079 memcpy(old_regs, regs, sizeof(*regs));
1027 /* If ipsr.ic then use pmsa_{iip,ipsr,ifs}, else use
1028 * pmsa_{xip,xpsr,xfs}
1029 */
1030 if (ia64_psr(regs)->ic) {
1031 old_regs->cr_iip = ms->pmsa_iip;
1032 old_regs->cr_ipsr = ms->pmsa_ipsr;
1033 old_regs->cr_ifs = ms->pmsa_ifs;
1034 } else {
1035 old_regs->cr_iip = ms->pmsa_xip;
1036 old_regs->cr_ipsr = ms->pmsa_xpsr;
1037 old_regs->cr_ifs = ms->pmsa_xfs;
1038 }
1039 old_regs->pr = ms->pmsa_pr;
1040 old_regs->b0 = ms->pmsa_br0;
1041 old_regs->loadrs = loadrs; 1080 old_regs->loadrs = loadrs;
1042 old_regs->ar_rsc = ms->pmsa_rsc;
1043 old_unat = old_regs->ar_unat; 1081 old_unat = old_regs->ar_unat;
1044 copy_reg(&ms->pmsa_gr[1-1], ms->pmsa_nat_bits, &old_regs->r1, &old_unat); 1082 finish_pt_regs(old_regs, ms, &old_unat);
1045 copy_reg(&ms->pmsa_gr[2-1], ms->pmsa_nat_bits, &old_regs->r2, &old_unat);
1046 copy_reg(&ms->pmsa_gr[3-1], ms->pmsa_nat_bits, &old_regs->r3, &old_unat);
1047 copy_reg(&ms->pmsa_gr[8-1], ms->pmsa_nat_bits, &old_regs->r8, &old_unat);
1048 copy_reg(&ms->pmsa_gr[9-1], ms->pmsa_nat_bits, &old_regs->r9, &old_unat);
1049 copy_reg(&ms->pmsa_gr[10-1], ms->pmsa_nat_bits, &old_regs->r10, &old_unat);
1050 copy_reg(&ms->pmsa_gr[11-1], ms->pmsa_nat_bits, &old_regs->r11, &old_unat);
1051 copy_reg(&ms->pmsa_gr[12-1], ms->pmsa_nat_bits, &old_regs->r12, &old_unat);
1052 copy_reg(&ms->pmsa_gr[13-1], ms->pmsa_nat_bits, &old_regs->r13, &old_unat);
1053 copy_reg(&ms->pmsa_gr[14-1], ms->pmsa_nat_bits, &old_regs->r14, &old_unat);
1054 copy_reg(&ms->pmsa_gr[15-1], ms->pmsa_nat_bits, &old_regs->r15, &old_unat);
1055 if (ia64_psr(old_regs)->bn)
1056 bank = ms->pmsa_bank1_gr;
1057 else
1058 bank = ms->pmsa_bank0_gr;
1059 copy_reg(&bank[16-16], ms->pmsa_nat_bits, &old_regs->r16, &old_unat);
1060 copy_reg(&bank[17-16], ms->pmsa_nat_bits, &old_regs->r17, &old_unat);
1061 copy_reg(&bank[18-16], ms->pmsa_nat_bits, &old_regs->r18, &old_unat);
1062 copy_reg(&bank[19-16], ms->pmsa_nat_bits, &old_regs->r19, &old_unat);
1063 copy_reg(&bank[20-16], ms->pmsa_nat_bits, &old_regs->r20, &old_unat);
1064 copy_reg(&bank[21-16], ms->pmsa_nat_bits, &old_regs->r21, &old_unat);
1065 copy_reg(&bank[22-16], ms->pmsa_nat_bits, &old_regs->r22, &old_unat);
1066 copy_reg(&bank[23-16], ms->pmsa_nat_bits, &old_regs->r23, &old_unat);
1067 copy_reg(&bank[24-16], ms->pmsa_nat_bits, &old_regs->r24, &old_unat);
1068 copy_reg(&bank[25-16], ms->pmsa_nat_bits, &old_regs->r25, &old_unat);
1069 copy_reg(&bank[26-16], ms->pmsa_nat_bits, &old_regs->r26, &old_unat);
1070 copy_reg(&bank[27-16], ms->pmsa_nat_bits, &old_regs->r27, &old_unat);
1071 copy_reg(&bank[28-16], ms->pmsa_nat_bits, &old_regs->r28, &old_unat);
1072 copy_reg(&bank[29-16], ms->pmsa_nat_bits, &old_regs->r29, &old_unat);
1073 copy_reg(&bank[30-16], ms->pmsa_nat_bits, &old_regs->r30, &old_unat);
1074 copy_reg(&bank[31-16], ms->pmsa_nat_bits, &old_regs->r31, &old_unat);
1075 1083
1076 /* Next stack a struct switch_stack. mca_asm.S built a partial 1084 /* Next stack a struct switch_stack. mca_asm.S built a partial
1077 * switch_stack, copy it and fill in the blanks using pt_regs and 1085 * switch_stack, copy it and fill in the blanks using pt_regs and
@@ -1141,6 +1149,8 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
1141no_mod: 1149no_mod:
1142 mprintk(KERN_INFO "cpu %d, %s %s, original stack not modified\n", 1150 mprintk(KERN_INFO "cpu %d, %s %s, original stack not modified\n",
1143 smp_processor_id(), type, msg); 1151 smp_processor_id(), type, msg);
1152 old_unat = regs->ar_unat;
1153 finish_pt_regs(regs, ms, &old_unat);
1144 return previous_current; 1154 return previous_current;
1145} 1155}
1146 1156
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index 6db08599ebbc..776dd40397e2 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -60,7 +60,6 @@ dump (const char *str, void *vp, size_t len)
60 */ 60 */
61int no_unaligned_warning; 61int no_unaligned_warning;
62int unaligned_dump_stack; 62int unaligned_dump_stack;
63static int noprint_warning;
64 63
65/* 64/*
66 * For M-unit: 65 * For M-unit:
@@ -1357,9 +1356,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1357 /* watch for command names containing %s */ 1356 /* watch for command names containing %s */
1358 printk(KERN_WARNING "%s", buf); 1357 printk(KERN_WARNING "%s", buf);
1359 } else { 1358 } else {
1360 if (no_unaligned_warning && !noprint_warning) { 1359 if (no_unaligned_warning) {
1361 noprint_warning = 1; 1360 printk_once(KERN_WARNING "%s(%d) encountered an "
1362 printk(KERN_WARNING "%s(%d) encountered an "
1363 "unaligned exception which required\n" 1361 "unaligned exception which required\n"
1364 "kernel assistance, which degrades " 1362 "kernel assistance, which degrades "
1365 "the performance of the application.\n" 1363 "the performance of the application.\n"
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index f426dc78d959..ee09d261f2e6 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -100,24 +100,36 @@ wrap_mmu_context (struct mm_struct *mm)
100 * this primitive it can be moved up to a spinaphore.h header. 100 * this primitive it can be moved up to a spinaphore.h header.
101 */ 101 */
102struct spinaphore { 102struct spinaphore {
103 atomic_t cur; 103 unsigned long ticket;
104 unsigned long serve;
104}; 105};
105 106
106static inline void spinaphore_init(struct spinaphore *ss, int val) 107static inline void spinaphore_init(struct spinaphore *ss, int val)
107{ 108{
108 atomic_set(&ss->cur, val); 109 ss->ticket = 0;
110 ss->serve = val;
109} 111}
110 112
111static inline void down_spin(struct spinaphore *ss) 113static inline void down_spin(struct spinaphore *ss)
112{ 114{
113 while (unlikely(!atomic_add_unless(&ss->cur, -1, 0))) 115 unsigned long t = ia64_fetchadd(1, &ss->ticket, acq), serve;
114 while (atomic_read(&ss->cur) == 0) 116
115 cpu_relax(); 117 if (time_before(t, ss->serve))
118 return;
119
120 ia64_invala();
121
122 for (;;) {
123 asm volatile ("ld4.c.nc %0=[%1]" : "=r"(serve) : "r"(&ss->serve) : "memory");
124 if (time_before(t, serve))
125 return;
126 cpu_relax();
127 }
116} 128}
117 129
118static inline void up_spin(struct spinaphore *ss) 130static inline void up_spin(struct spinaphore *ss)
119{ 131{
120 atomic_add(1, &ss->cur); 132 ia64_fetchadd(1, &ss->serve, rel);
121} 133}
122 134
123static struct spinaphore ptcg_sem; 135static struct spinaphore ptcg_sem;
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 7de76dd352fe..c0fca2c1c858 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -56,10 +56,13 @@ int raw_pci_read(unsigned int seg, unsigned int bus, unsigned int devfn,
56 if ((seg | reg) <= 255) { 56 if ((seg | reg) <= 255) {
57 addr = PCI_SAL_ADDRESS(seg, bus, devfn, reg); 57 addr = PCI_SAL_ADDRESS(seg, bus, devfn, reg);
58 mode = 0; 58 mode = 0;
59 } else { 59 } else if (sal_revision >= SAL_VERSION_CODE(3,2)) {
60 addr = PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg); 60 addr = PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg);
61 mode = 1; 61 mode = 1;
62 } else {
63 return -EINVAL;
62 } 64 }
65
63 result = ia64_sal_pci_config_read(addr, mode, len, &data); 66 result = ia64_sal_pci_config_read(addr, mode, len, &data);
64 if (result != 0) 67 if (result != 0)
65 return -EINVAL; 68 return -EINVAL;
@@ -80,9 +83,11 @@ int raw_pci_write(unsigned int seg, unsigned int bus, unsigned int devfn,
80 if ((seg | reg) <= 255) { 83 if ((seg | reg) <= 255) {
81 addr = PCI_SAL_ADDRESS(seg, bus, devfn, reg); 84 addr = PCI_SAL_ADDRESS(seg, bus, devfn, reg);
82 mode = 0; 85 mode = 0;
83 } else { 86 } else if (sal_revision >= SAL_VERSION_CODE(3,2)) {
84 addr = PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg); 87 addr = PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg);
85 mode = 1; 88 mode = 1;
89 } else {
90 return -EINVAL;
86 } 91 }
87 result = ia64_sal_pci_config_write(addr, mode, len, value); 92 result = ia64_sal_pci_config_write(addr, mode, len, value);
88 if (result != 0) 93 if (result != 0)
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 25831c47c579..308e6595110e 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -119,7 +119,6 @@ sn_pcidev_info_get(struct pci_dev *dev)
119 * Additionally note that the struct sn_flush_device_war also has to be 119 * Additionally note that the struct sn_flush_device_war also has to be
120 * removed from arch/ia64/sn/include/xtalk/hubdev.h 120 * removed from arch/ia64/sn/include/xtalk/hubdev.h
121 */ 121 */
122static u8 war_implemented = 0;
123 122
124static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device, 123static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
125 struct sn_flush_device_common *common) 124 struct sn_flush_device_common *common)
@@ -128,11 +127,8 @@ static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
128 struct sn_flush_device_war *dev_entry; 127 struct sn_flush_device_war *dev_entry;
129 struct ia64_sal_retval isrv = {0,0,0,0}; 128 struct ia64_sal_retval isrv = {0,0,0,0};
130 129
131 if (!war_implemented) { 130 printk_once(KERN_WARNING
132 printk(KERN_WARNING "PROM version < 4.50 -- implementing old " 131 "PROM version < 4.50 -- implementing old PROM flush WAR\n");
133 "PROM flush WAR\n");
134 war_implemented = 1;
135 }
136 132
137 war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL); 133 war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL);
138 BUG_ON(!war_list); 134 BUG_ON(!war_list);
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 4c7e74790958..55ac3c4e11d2 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -786,17 +786,18 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
786 break; 786 break;
787 787
788 case SN_HWPERF_GET_OBJ_NODE: 788 case SN_HWPERF_GET_OBJ_NODE:
789 if (a.sz != sizeof(u64) || a.arg < 0) { 789 i = a.arg;
790 if (a.sz != sizeof(u64) || i < 0) {
790 r = -EINVAL; 791 r = -EINVAL;
791 goto error; 792 goto error;
792 } 793 }
793 if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { 794 if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) {
794 if (a.arg >= nobj) { 795 if (i >= nobj) {
795 r = -EINVAL; 796 r = -EINVAL;
796 vfree(objs); 797 vfree(objs);
797 goto error; 798 goto error;
798 } 799 }
799 if (objs[(i = a.arg)].id != a.arg) { 800 if (objs[i].id != a.arg) {
800 for (i = 0; i < nobj; i++) { 801 for (i = 0; i < nobj; i++) {
801 if (objs[i].id == a.arg) 802 if (objs[i].id == a.arg)
802 break; 803 break;
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 29dd8489ffec..ecdc19a299b2 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -561,7 +561,7 @@ config HPAPCI
561 561
562config MVME147_SCC 562config MVME147_SCC
563 bool "SCC support for MVME147 serial ports" 563 bool "SCC support for MVME147 serial ports"
564 depends on MVME147 564 depends on MVME147 && BROKEN
565 help 565 help
566 This is the driver for the serial ports on the Motorola MVME147 566 This is the driver for the serial ports on the Motorola MVME147
567 boards. Everyone using one of these boards should say Y here. 567 boards. Everyone using one of these boards should say Y here.
@@ -576,14 +576,14 @@ config SERIAL167
576 576
577config MVME162_SCC 577config MVME162_SCC
578 bool "SCC support for MVME162 serial ports" 578 bool "SCC support for MVME162 serial ports"
579 depends on MVME16x 579 depends on MVME16x && BROKEN
580 help 580 help
581 This is the driver for the serial ports on the Motorola MVME162 and 581 This is the driver for the serial ports on the Motorola MVME162 and
582 172 boards. Everyone using one of these boards should say Y here. 582 172 boards. Everyone using one of these boards should say Y here.
583 583
584config BVME6000_SCC 584config BVME6000_SCC
585 bool "SCC support for BVME6000 serial ports" 585 bool "SCC support for BVME6000 serial ports"
586 depends on BVME6000 586 depends on BVME6000 && BROKEN
587 help 587 help
588 This is the driver for the serial ports on the BVME4000 and BVME6000 588 This is the driver for the serial ports on the BVME4000 and BVME6000
589 boards from BVM Ltd. Everyone using one of these boards should say 589 boards from BVM Ltd. Everyone using one of these boards should say
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 705a7a9170f3..03bd56a2fb6e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1012,9 +1012,9 @@ config BOOT_ELF32
1012 1012
1013config MIPS_L1_CACHE_SHIFT 1013config MIPS_L1_CACHE_SHIFT
1014 int 1014 int
1015 default "4" if MACH_DECSTATION || MIKROTIK_RB532 1015 default "4" if MACH_DECSTATION || MIKROTIK_RB532 || PMC_MSP4200_EVAL
1016 default "6" if MIPS_CPU_SCACHE
1016 default "7" if SGI_IP22 || SGI_IP27 || SGI_IP28 || SNI_RM || CPU_CAVIUM_OCTEON 1017 default "7" if SGI_IP22 || SGI_IP27 || SGI_IP28 || SNI_RM || CPU_CAVIUM_OCTEON
1017 default "4" if PMC_MSP4200_EVAL
1018 default "5" 1018 default "5"
1019 1019
1020config HAVE_STD_PC_SERIAL_PORT 1020config HAVE_STD_PC_SERIAL_PORT
diff --git a/arch/mips/alchemy/common/irq.c b/arch/mips/alchemy/common/irq.c
index c88c821b4c36..d670928afcfd 100644
--- a/arch/mips/alchemy/common/irq.c
+++ b/arch/mips/alchemy/common/irq.c
@@ -354,6 +354,28 @@ static void au1x_ic1_ack(unsigned int irq_nr)
354 au_sync(); 354 au_sync();
355} 355}
356 356
357static void au1x_ic0_maskack(unsigned int irq_nr)
358{
359 unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
360
361 au_writel(1 << bit, IC0_WAKECLR);
362 au_writel(1 << bit, IC0_MASKCLR);
363 au_writel(1 << bit, IC0_RISINGCLR);
364 au_writel(1 << bit, IC0_FALLINGCLR);
365 au_sync();
366}
367
368static void au1x_ic1_maskack(unsigned int irq_nr)
369{
370 unsigned int bit = irq_nr - AU1000_INTC1_INT_BASE;
371
372 au_writel(1 << bit, IC1_WAKECLR);
373 au_writel(1 << bit, IC1_MASKCLR);
374 au_writel(1 << bit, IC1_RISINGCLR);
375 au_writel(1 << bit, IC1_FALLINGCLR);
376 au_sync();
377}
378
357static int au1x_ic1_setwake(unsigned int irq, unsigned int on) 379static int au1x_ic1_setwake(unsigned int irq, unsigned int on)
358{ 380{
359 unsigned int bit = irq - AU1000_INTC1_INT_BASE; 381 unsigned int bit = irq - AU1000_INTC1_INT_BASE;
@@ -379,25 +401,21 @@ static int au1x_ic1_setwake(unsigned int irq, unsigned int on)
379/* 401/*
380 * irq_chips for both ICs; this way the mask handlers can be 402 * irq_chips for both ICs; this way the mask handlers can be
381 * as short as possible. 403 * as short as possible.
382 *
383 * NOTE: the ->ack() callback is used by the handle_edge_irq
384 * flowhandler only, the ->mask_ack() one by handle_level_irq,
385 * so no need for an irq_chip for each type of irq (level/edge).
386 */ 404 */
387static struct irq_chip au1x_ic0_chip = { 405static struct irq_chip au1x_ic0_chip = {
388 .name = "Alchemy-IC0", 406 .name = "Alchemy-IC0",
389 .ack = au1x_ic0_ack, /* edge */ 407 .ack = au1x_ic0_ack,
390 .mask = au1x_ic0_mask, 408 .mask = au1x_ic0_mask,
391 .mask_ack = au1x_ic0_mask, /* level */ 409 .mask_ack = au1x_ic0_maskack,
392 .unmask = au1x_ic0_unmask, 410 .unmask = au1x_ic0_unmask,
393 .set_type = au1x_ic_settype, 411 .set_type = au1x_ic_settype,
394}; 412};
395 413
396static struct irq_chip au1x_ic1_chip = { 414static struct irq_chip au1x_ic1_chip = {
397 .name = "Alchemy-IC1", 415 .name = "Alchemy-IC1",
398 .ack = au1x_ic1_ack, /* edge */ 416 .ack = au1x_ic1_ack,
399 .mask = au1x_ic1_mask, 417 .mask = au1x_ic1_mask,
400 .mask_ack = au1x_ic1_mask, /* level */ 418 .mask_ack = au1x_ic1_maskack,
401 .unmask = au1x_ic1_unmask, 419 .unmask = au1x_ic1_unmask,
402 .set_type = au1x_ic_settype, 420 .set_type = au1x_ic_settype,
403 .set_wake = au1x_ic1_setwake, 421 .set_wake = au1x_ic1_setwake,
diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c
index cc32c69a74ad..45b61c9b82b9 100644
--- a/arch/mips/alchemy/mtx-1/board_setup.c
+++ b/arch/mips/alchemy/mtx-1/board_setup.c
@@ -69,6 +69,7 @@ void __init board_setup(void)
69#else 69#else
70 au_writel(0xf, Au1500_PCI_CFG); 70 au_writel(0xf, Au1500_PCI_CFG);
71#endif 71#endif
72 board_pci_idsel = mtx1_pci_idsel;
72#endif 73#endif
73 74
74 /* Initialize sys_pinfunc */ 75 /* Initialize sys_pinfunc */
@@ -85,8 +86,6 @@ void __init board_setup(void)
85 alchemy_gpio_direction_output(211, 1); /* green on */ 86 alchemy_gpio_direction_output(211, 1); /* green on */
86 alchemy_gpio_direction_output(212, 0); /* red off */ 87 alchemy_gpio_direction_output(212, 0); /* red off */
87 88
88 board_pci_idsel = mtx1_pci_idsel;
89
90 printk(KERN_INFO "4G Systems MTX-1 Board\n"); 89 printk(KERN_INFO "4G Systems MTX-1 Board\n");
91} 90}
92 91
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index e2278c04459d..835f3f0319ca 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -503,6 +503,7 @@ static int __init ar7_register_devices(void)
503{ 503{
504 u16 chip_id; 504 u16 chip_id;
505 int res; 505 int res;
506 u32 *bootcr, val;
506#ifdef CONFIG_SERIAL_8250 507#ifdef CONFIG_SERIAL_8250
507 static struct uart_port uart_port[2]; 508 static struct uart_port uart_port[2];
508 509
@@ -595,7 +596,13 @@ static int __init ar7_register_devices(void)
595 596
596 ar7_wdt_res.end = ar7_wdt_res.start + 0x20; 597 ar7_wdt_res.end = ar7_wdt_res.start + 0x20;
597 598
598 res = platform_device_register(&ar7_wdt); 599 bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
600 val = *bootcr;
601 iounmap(bootcr);
602
603 /* Register watchdog only if enabled in hardware */
604 if (val & AR7_WDT_HW_ENA)
605 res = platform_device_register(&ar7_wdt);
599 606
600 return res; 607 return res;
601} 608}
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index c146d1ededed..00064b660809 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,5 +1,5 @@
1obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ 1obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
2 dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o 2 dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o
3obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 3obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
4 4
5obj-y += boards/ 5obj-y += boards/
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 78e155d21be6..05a35cf5963d 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -24,7 +24,6 @@
24#include <bcm63xx_dev_enet.h> 24#include <bcm63xx_dev_enet.h>
25#include <bcm63xx_dev_dsp.h> 25#include <bcm63xx_dev_dsp.h>
26#include <bcm63xx_dev_pcmcia.h> 26#include <bcm63xx_dev_pcmcia.h>
27#include <bcm63xx_dev_uart.h>
28#include <board_bcm963xx.h> 27#include <board_bcm963xx.h>
29 28
30#define PFX "board_bcm963xx: " 29#define PFX "board_bcm963xx: "
@@ -794,8 +793,6 @@ int __init board_register_devices(void)
794{ 793{
795 u32 val; 794 u32 val;
796 795
797 bcm63xx_uart_register();
798
799 if (board.has_pccard) 796 if (board.has_pccard)
800 bcm63xx_pcmcia_register(); 797 bcm63xx_pcmcia_register();
801 798
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index 6dc43f0483e8..70378bb5e3f9 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -10,6 +10,7 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/cpu.h> 12#include <linux/cpu.h>
13#include <asm/cpu-info.h>
13#include <bcm63xx_cpu.h> 14#include <bcm63xx_cpu.h>
14#include <bcm63xx_regs.h> 15#include <bcm63xx_regs.h>
15#include <bcm63xx_io.h> 16#include <bcm63xx_io.h>
@@ -284,6 +285,7 @@ void __init bcm63xx_cpu_init(void)
284{ 285{
285 unsigned int tmp, expected_cpu_id; 286 unsigned int tmp, expected_cpu_id;
286 struct cpuinfo_mips *c = &current_cpu_data; 287 struct cpuinfo_mips *c = &current_cpu_data;
288 unsigned int cpu = smp_processor_id();
287 289
288 /* soc registers location depends on cpu type */ 290 /* soc registers location depends on cpu type */
289 expected_cpu_id = 0; 291 expected_cpu_id = 0;
@@ -293,6 +295,7 @@ void __init bcm63xx_cpu_init(void)
293 * BCM6338 as the same PrId as BCM3302 see arch/mips/kernel/cpu-probe.c 295 * BCM6338 as the same PrId as BCM3302 see arch/mips/kernel/cpu-probe.c
294 */ 296 */
295 case CPU_BCM3302: 297 case CPU_BCM3302:
298 __cpu_name[cpu] = "Broadcom BCM6338";
296 expected_cpu_id = BCM6338_CPU_ID; 299 expected_cpu_id = BCM6338_CPU_ID;
297 bcm63xx_regs_base = bcm96338_regs_base; 300 bcm63xx_regs_base = bcm96338_regs_base;
298 bcm63xx_irqs = bcm96338_irqs; 301 bcm63xx_irqs = bcm96338_irqs;
diff --git a/arch/mips/bcm63xx/dev-uart.c b/arch/mips/bcm63xx/dev-uart.c
index 5f3d89c4a988..b0519461ad9b 100644
--- a/arch/mips/bcm63xx/dev-uart.c
+++ b/arch/mips/bcm63xx/dev-uart.c
@@ -10,7 +10,6 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <bcm63xx_cpu.h> 12#include <bcm63xx_cpu.h>
13#include <bcm63xx_dev_uart.h>
14 13
15static struct resource uart_resources[] = { 14static struct resource uart_resources[] = {
16 { 15 {
@@ -39,3 +38,4 @@ int __init bcm63xx_uart_register(void)
39 uart_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0); 38 uart_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0);
40 return platform_device_register(&bcm63xx_uart_device); 39 return platform_device_register(&bcm63xx_uart_device);
41} 40}
41arch_initcall(bcm63xx_uart_register);
diff --git a/arch/mips/bcm63xx/dev-wdt.c b/arch/mips/bcm63xx/dev-wdt.c
new file mode 100644
index 000000000000..3e6c716a4c11
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-wdt.c
@@ -0,0 +1,37 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/platform_device.h>
12#include <bcm63xx_cpu.h>
13
14static struct resource wdt_resources[] = {
15 {
16 .start = -1, /* filled at runtime */
17 .end = -1, /* filled at runtime */
18 .flags = IORESOURCE_MEM,
19 },
20};
21
22static struct platform_device bcm63xx_wdt_device = {
23 .name = "bcm63xx-wdt",
24 .id = 0,
25 .num_resources = ARRAY_SIZE(wdt_resources),
26 .resource = wdt_resources,
27};
28
29int __init bcm63xx_wdt_register(void)
30{
31 wdt_resources[0].start = bcm63xx_regset_address(RSET_WDT);
32 wdt_resources[0].end = wdt_resources[0].start;
33 wdt_resources[0].end += RSET_WDT_SIZE - 1;
34
35 return platform_device_register(&bcm63xx_wdt_device);
36}
37arch_initcall(bcm63xx_wdt_register);
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c
index b18a0ca926fa..d0056598fbfc 100644
--- a/arch/mips/bcm63xx/setup.c
+++ b/arch/mips/bcm63xx/setup.c
@@ -75,7 +75,9 @@ void bcm63xx_machine_reboot(void)
75 bcm6348_a1_reboot(); 75 bcm6348_a1_reboot();
76 76
77 printk(KERN_INFO "triggering watchdog soft-reset...\n"); 77 printk(KERN_INFO "triggering watchdog soft-reset...\n");
78 bcm_perf_writel(SYS_PLL_SOFT_RESET, PERF_SYS_PLL_CTL_REG); 78 reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
79 reg |= SYS_PLL_SOFT_RESET;
80 bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG);
79 while (1) 81 while (1)
80 ; 82 ;
81} 83}
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 384f1842bfb1..6f2acf09328d 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -17,6 +17,15 @@ DEFINE_RWLOCK(octeon_irq_ciu0_rwlock);
17DEFINE_RWLOCK(octeon_irq_ciu1_rwlock); 17DEFINE_RWLOCK(octeon_irq_ciu1_rwlock);
18DEFINE_SPINLOCK(octeon_irq_msi_lock); 18DEFINE_SPINLOCK(octeon_irq_msi_lock);
19 19
20static int octeon_coreid_for_cpu(int cpu)
21{
22#ifdef CONFIG_SMP
23 return cpu_logical_map(cpu);
24#else
25 return cvmx_get_core_num();
26#endif
27}
28
20static void octeon_irq_core_ack(unsigned int irq) 29static void octeon_irq_core_ack(unsigned int irq)
21{ 30{
22 unsigned int bit = irq - OCTEON_IRQ_SW0; 31 unsigned int bit = irq - OCTEON_IRQ_SW0;
@@ -152,11 +161,10 @@ static void octeon_irq_ciu0_disable(unsigned int irq)
152 int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */ 161 int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */
153 unsigned long flags; 162 unsigned long flags;
154 uint64_t en0; 163 uint64_t en0;
155#ifdef CONFIG_SMP
156 int cpu; 164 int cpu;
157 write_lock_irqsave(&octeon_irq_ciu0_rwlock, flags); 165 write_lock_irqsave(&octeon_irq_ciu0_rwlock, flags);
158 for_each_online_cpu(cpu) { 166 for_each_online_cpu(cpu) {
159 int coreid = cpu_logical_map(cpu); 167 int coreid = octeon_coreid_for_cpu(cpu);
160 en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)); 168 en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
161 en0 &= ~(1ull << bit); 169 en0 &= ~(1ull << bit);
162 cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0); 170 cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);
@@ -167,26 +175,57 @@ static void octeon_irq_ciu0_disable(unsigned int irq)
167 */ 175 */
168 cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2)); 176 cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2));
169 write_unlock_irqrestore(&octeon_irq_ciu0_rwlock, flags); 177 write_unlock_irqrestore(&octeon_irq_ciu0_rwlock, flags);
170#else 178}
171 int coreid = cvmx_get_core_num(); 179
172 local_irq_save(flags); 180/*
173 en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)); 181 * Enable the irq on the current core for chips that have the EN*_W1{S,C}
174 en0 &= ~(1ull << bit); 182 * registers.
175 cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0); 183 */
176 cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)); 184static void octeon_irq_ciu0_enable_v2(unsigned int irq)
177 local_irq_restore(flags); 185{
178#endif 186 int index = cvmx_get_core_num() * 2;
187 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
188
189 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
190}
191
192/*
193 * Disable the irq on the current core for chips that have the EN*_W1{S,C}
194 * registers.
195 */
196static void octeon_irq_ciu0_disable_v2(unsigned int irq)
197{
198 int index = cvmx_get_core_num() * 2;
199 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
200
201 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
202}
203
204/*
205 * Disable the irq on the all cores for chips that have the EN*_W1{S,C}
206 * registers.
207 */
208static void octeon_irq_ciu0_disable_all_v2(unsigned int irq)
209{
210 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
211 int index;
212 int cpu;
213 for_each_online_cpu(cpu) {
214 index = octeon_coreid_for_cpu(cpu) * 2;
215 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
216 }
179} 217}
180 218
181#ifdef CONFIG_SMP 219#ifdef CONFIG_SMP
182static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *dest) 220static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *dest)
183{ 221{
184 int cpu; 222 int cpu;
223 unsigned long flags;
185 int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */ 224 int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */
186 225
187 write_lock(&octeon_irq_ciu0_rwlock); 226 write_lock_irqsave(&octeon_irq_ciu0_rwlock, flags);
188 for_each_online_cpu(cpu) { 227 for_each_online_cpu(cpu) {
189 int coreid = cpu_logical_map(cpu); 228 int coreid = octeon_coreid_for_cpu(cpu);
190 uint64_t en0 = 229 uint64_t en0 =
191 cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)); 230 cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
192 if (cpumask_test_cpu(cpu, dest)) 231 if (cpumask_test_cpu(cpu, dest))
@@ -200,11 +239,45 @@ static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *
200 * of them are done. 239 * of them are done.
201 */ 240 */
202 cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2)); 241 cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2));
203 write_unlock(&octeon_irq_ciu0_rwlock); 242 write_unlock_irqrestore(&octeon_irq_ciu0_rwlock, flags);
204 243
205 return 0; 244 return 0;
206} 245}
246
247/*
248 * Set affinity for the irq for chips that have the EN*_W1{S,C}
249 * registers.
250 */
251static int octeon_irq_ciu0_set_affinity_v2(unsigned int irq,
252 const struct cpumask *dest)
253{
254 int cpu;
255 int index;
256 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
257 for_each_online_cpu(cpu) {
258 index = octeon_coreid_for_cpu(cpu) * 2;
259 if (cpumask_test_cpu(cpu, dest))
260 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
261 else
262 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
263 }
264 return 0;
265}
266#endif
267
268/*
269 * Newer octeon chips have support for lockless CIU operation.
270 */
271static struct irq_chip octeon_irq_chip_ciu0_v2 = {
272 .name = "CIU0",
273 .enable = octeon_irq_ciu0_enable_v2,
274 .disable = octeon_irq_ciu0_disable_all_v2,
275 .ack = octeon_irq_ciu0_disable_v2,
276 .eoi = octeon_irq_ciu0_enable_v2,
277#ifdef CONFIG_SMP
278 .set_affinity = octeon_irq_ciu0_set_affinity_v2,
207#endif 279#endif
280};
208 281
209static struct irq_chip octeon_irq_chip_ciu0 = { 282static struct irq_chip octeon_irq_chip_ciu0 = {
210 .name = "CIU0", 283 .name = "CIU0",
@@ -269,11 +342,10 @@ static void octeon_irq_ciu1_disable(unsigned int irq)
269 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */ 342 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */
270 unsigned long flags; 343 unsigned long flags;
271 uint64_t en1; 344 uint64_t en1;
272#ifdef CONFIG_SMP
273 int cpu; 345 int cpu;
274 write_lock_irqsave(&octeon_irq_ciu1_rwlock, flags); 346 write_lock_irqsave(&octeon_irq_ciu1_rwlock, flags);
275 for_each_online_cpu(cpu) { 347 for_each_online_cpu(cpu) {
276 int coreid = cpu_logical_map(cpu); 348 int coreid = octeon_coreid_for_cpu(cpu);
277 en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1)); 349 en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
278 en1 &= ~(1ull << bit); 350 en1 &= ~(1ull << bit);
279 cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1); 351 cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);
@@ -284,26 +356,58 @@ static void octeon_irq_ciu1_disable(unsigned int irq)
284 */ 356 */
285 cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1)); 357 cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1));
286 write_unlock_irqrestore(&octeon_irq_ciu1_rwlock, flags); 358 write_unlock_irqrestore(&octeon_irq_ciu1_rwlock, flags);
287#else 359}
288 int coreid = cvmx_get_core_num(); 360
289 local_irq_save(flags); 361/*
290 en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1)); 362 * Enable the irq on the current core for chips that have the EN*_W1{S,C}
291 en1 &= ~(1ull << bit); 363 * registers.
292 cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1); 364 */
293 cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1)); 365static void octeon_irq_ciu1_enable_v2(unsigned int irq)
294 local_irq_restore(flags); 366{
295#endif 367 int index = cvmx_get_core_num() * 2 + 1;
368 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
369
370 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
371}
372
373/*
374 * Disable the irq on the current core for chips that have the EN*_W1{S,C}
375 * registers.
376 */
377static void octeon_irq_ciu1_disable_v2(unsigned int irq)
378{
379 int index = cvmx_get_core_num() * 2 + 1;
380 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
381
382 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
383}
384
385/*
386 * Disable the irq on the all cores for chips that have the EN*_W1{S,C}
387 * registers.
388 */
389static void octeon_irq_ciu1_disable_all_v2(unsigned int irq)
390{
391 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
392 int index;
393 int cpu;
394 for_each_online_cpu(cpu) {
395 index = octeon_coreid_for_cpu(cpu) * 2 + 1;
396 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
397 }
296} 398}
297 399
298#ifdef CONFIG_SMP 400#ifdef CONFIG_SMP
299static int octeon_irq_ciu1_set_affinity(unsigned int irq, const struct cpumask *dest) 401static int octeon_irq_ciu1_set_affinity(unsigned int irq,
402 const struct cpumask *dest)
300{ 403{
301 int cpu; 404 int cpu;
405 unsigned long flags;
302 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */ 406 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */
303 407
304 write_lock(&octeon_irq_ciu1_rwlock); 408 write_lock_irqsave(&octeon_irq_ciu1_rwlock, flags);
305 for_each_online_cpu(cpu) { 409 for_each_online_cpu(cpu) {
306 int coreid = cpu_logical_map(cpu); 410 int coreid = octeon_coreid_for_cpu(cpu);
307 uint64_t en1 = 411 uint64_t en1 =
308 cvmx_read_csr(CVMX_CIU_INTX_EN1 412 cvmx_read_csr(CVMX_CIU_INTX_EN1
309 (coreid * 2 + 1)); 413 (coreid * 2 + 1));
@@ -318,12 +422,46 @@ static int octeon_irq_ciu1_set_affinity(unsigned int irq, const struct cpumask *
318 * of them are done. 422 * of them are done.
319 */ 423 */
320 cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1)); 424 cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1));
321 write_unlock(&octeon_irq_ciu1_rwlock); 425 write_unlock_irqrestore(&octeon_irq_ciu1_rwlock, flags);
426
427 return 0;
428}
322 429
430/*
431 * Set affinity for the irq for chips that have the EN*_W1{S,C}
432 * registers.
433 */
434static int octeon_irq_ciu1_set_affinity_v2(unsigned int irq,
435 const struct cpumask *dest)
436{
437 int cpu;
438 int index;
439 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
440 for_each_online_cpu(cpu) {
441 index = octeon_coreid_for_cpu(cpu) * 2 + 1;
442 if (cpumask_test_cpu(cpu, dest))
443 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
444 else
445 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
446 }
323 return 0; 447 return 0;
324} 448}
325#endif 449#endif
326 450
451/*
452 * Newer octeon chips have support for lockless CIU operation.
453 */
454static struct irq_chip octeon_irq_chip_ciu1_v2 = {
455 .name = "CIU0",
456 .enable = octeon_irq_ciu1_enable_v2,
457 .disable = octeon_irq_ciu1_disable_all_v2,
458 .ack = octeon_irq_ciu1_disable_v2,
459 .eoi = octeon_irq_ciu1_enable_v2,
460#ifdef CONFIG_SMP
461 .set_affinity = octeon_irq_ciu1_set_affinity_v2,
462#endif
463};
464
327static struct irq_chip octeon_irq_chip_ciu1 = { 465static struct irq_chip octeon_irq_chip_ciu1 = {
328 .name = "CIU1", 466 .name = "CIU1",
329 .enable = octeon_irq_ciu1_enable, 467 .enable = octeon_irq_ciu1_enable,
@@ -420,6 +558,8 @@ static struct irq_chip octeon_irq_chip_msi = {
420void __init arch_init_irq(void) 558void __init arch_init_irq(void)
421{ 559{
422 int irq; 560 int irq;
561 struct irq_chip *chip0;
562 struct irq_chip *chip1;
423 563
424#ifdef CONFIG_SMP 564#ifdef CONFIG_SMP
425 /* Set the default affinity to the boot cpu. */ 565 /* Set the default affinity to the boot cpu. */
@@ -430,6 +570,16 @@ void __init arch_init_irq(void)
430 if (NR_IRQS < OCTEON_IRQ_LAST) 570 if (NR_IRQS < OCTEON_IRQ_LAST)
431 pr_err("octeon_irq_init: NR_IRQS is set too low\n"); 571 pr_err("octeon_irq_init: NR_IRQS is set too low\n");
432 572
573 if (OCTEON_IS_MODEL(OCTEON_CN58XX_PASS2_X) ||
574 OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) ||
575 OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X)) {
576 chip0 = &octeon_irq_chip_ciu0_v2;
577 chip1 = &octeon_irq_chip_ciu1_v2;
578 } else {
579 chip0 = &octeon_irq_chip_ciu0;
580 chip1 = &octeon_irq_chip_ciu1;
581 }
582
433 /* 0 - 15 reserved for i8259 master and slave controller. */ 583 /* 0 - 15 reserved for i8259 master and slave controller. */
434 584
435 /* 17 - 23 Mips internal */ 585 /* 17 - 23 Mips internal */
@@ -440,14 +590,12 @@ void __init arch_init_irq(void)
440 590
441 /* 24 - 87 CIU_INT_SUM0 */ 591 /* 24 - 87 CIU_INT_SUM0 */
442 for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_BOOTDMA; irq++) { 592 for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_BOOTDMA; irq++) {
443 set_irq_chip_and_handler(irq, &octeon_irq_chip_ciu0, 593 set_irq_chip_and_handler(irq, chip0, handle_percpu_irq);
444 handle_percpu_irq);
445 } 594 }
446 595
447 /* 88 - 151 CIU_INT_SUM1 */ 596 /* 88 - 151 CIU_INT_SUM1 */
448 for (irq = OCTEON_IRQ_WDOG0; irq <= OCTEON_IRQ_RESERVED151; irq++) { 597 for (irq = OCTEON_IRQ_WDOG0; irq <= OCTEON_IRQ_RESERVED151; irq++) {
449 set_irq_chip_and_handler(irq, &octeon_irq_chip_ciu1, 598 set_irq_chip_and_handler(irq, chip1, handle_percpu_irq);
450 handle_percpu_irq);
451 } 599 }
452 600
453#ifdef CONFIG_PCI_MSI 601#ifdef CONFIG_PCI_MSI
@@ -505,14 +653,10 @@ asmlinkage void plat_irq_dispatch(void)
505#ifdef CONFIG_HOTPLUG_CPU 653#ifdef CONFIG_HOTPLUG_CPU
506static int is_irq_enabled_on_cpu(unsigned int irq, unsigned int cpu) 654static int is_irq_enabled_on_cpu(unsigned int irq, unsigned int cpu)
507{ 655{
508 unsigned int isset; 656 unsigned int isset;
509#ifdef CONFIG_SMP 657 int coreid = octeon_coreid_for_cpu(cpu);
510 int coreid = cpu_logical_map(cpu);
511#else
512 int coreid = cvmx_get_core_num();
513#endif
514 int bit = (irq < OCTEON_IRQ_WDOG0) ? 658 int bit = (irq < OCTEON_IRQ_WDOG0) ?
515 irq - OCTEON_IRQ_WORKQ0 : irq - OCTEON_IRQ_WDOG0; 659 irq - OCTEON_IRQ_WORKQ0 : irq - OCTEON_IRQ_WDOG0;
516 if (irq < 64) { 660 if (irq < 64) {
517 isset = (cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)) & 661 isset = (cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)) &
518 (1ull << bit)) >> bit; 662 (1ull << bit)) >> bit;
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 32d51a31dc48..c198efdf583e 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -65,11 +65,12 @@ void octeon_send_ipi_single(int cpu, unsigned int action)
65 cvmx_write_csr(CVMX_CIU_MBOX_SETX(coreid), action); 65 cvmx_write_csr(CVMX_CIU_MBOX_SETX(coreid), action);
66} 66}
67 67
68static inline void octeon_send_ipi_mask(cpumask_t mask, unsigned int action) 68static inline void octeon_send_ipi_mask(const struct cpumask *mask,
69 unsigned int action)
69{ 70{
70 unsigned int i; 71 unsigned int i;
71 72
72 for_each_cpu_mask(i, mask) 73 for_each_cpu_mask(i, *mask)
73 octeon_send_ipi_single(i, action); 74 octeon_send_ipi_single(i, action);
74} 75}
75 76
diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h
index efeddc8db8b1..0b89b83e2055 100644
--- a/arch/mips/include/asm/fixmap.h
+++ b/arch/mips/include/asm/fixmap.h
@@ -48,9 +48,9 @@ enum fixed_addresses {
48#define FIX_N_COLOURS 8 48#define FIX_N_COLOURS 8
49 FIX_CMAP_BEGIN, 49 FIX_CMAP_BEGIN,
50#ifdef CONFIG_MIPS_MT_SMTC 50#ifdef CONFIG_MIPS_MT_SMTC
51 FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS), 51 FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS * 2),
52#else 52#else
53 FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS, 53 FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * 2),
54#endif 54#endif
55#ifdef CONFIG_HIGHMEM 55#ifdef CONFIG_HIGHMEM
56 /* reserved pte's for temporary kernel mappings */ 56 /* reserved pte's for temporary kernel mappings */
diff --git a/arch/mips/include/asm/gcmpregs.h b/arch/mips/include/asm/gcmpregs.h
index 36fd969d64d6..c0cf76a2ca89 100644
--- a/arch/mips/include/asm/gcmpregs.h
+++ b/arch/mips/include/asm/gcmpregs.h
@@ -19,15 +19,20 @@
19#define GCMP_GDB_OFS 0x8000 /* Global Debug Block */ 19#define GCMP_GDB_OFS 0x8000 /* Global Debug Block */
20 20
21/* Offsets to individual GCMP registers from GCMP base */ 21/* Offsets to individual GCMP registers from GCMP base */
22#define GCMPOFS(block, tag, reg) (GCMP_##block##_OFS + GCMP_##tag##_##reg##_OFS) 22#define GCMPOFS(block, tag, reg) \
23 (GCMP_##block##_OFS + GCMP_##tag##_##reg##_OFS)
24#define GCMPOFSn(block, tag, reg, n) \
25 (GCMP_##block##_OFS + GCMP_##tag##_##reg##_OFS(n))
23 26
24#define GCMPGCBOFS(reg) GCMPOFS(GCB, GCB, reg) 27#define GCMPGCBOFS(reg) GCMPOFS(GCB, GCB, reg)
28#define GCMPGCBOFSn(reg, n) GCMPOFSn(GCB, GCB, reg, n)
25#define GCMPCLCBOFS(reg) GCMPOFS(CLCB, CCB, reg) 29#define GCMPCLCBOFS(reg) GCMPOFS(CLCB, CCB, reg)
26#define GCMPCOCBOFS(reg) GCMPOFS(COCB, CCB, reg) 30#define GCMPCOCBOFS(reg) GCMPOFS(COCB, CCB, reg)
27#define GCMPGDBOFS(reg) GCMPOFS(GDB, GDB, reg) 31#define GCMPGDBOFS(reg) GCMPOFS(GDB, GDB, reg)
28 32
29/* GCMP register access */ 33/* GCMP register access */
30#define GCMPGCB(reg) REGP(_gcmp_base, GCMPGCBOFS(reg)) 34#define GCMPGCB(reg) REGP(_gcmp_base, GCMPGCBOFS(reg))
35#define GCMPGCBn(reg, n) REGP(_gcmp_base, GCMPGCBOFSn(reg, n))
31#define GCMPCLCB(reg) REGP(_gcmp_base, GCMPCLCBOFS(reg)) 36#define GCMPCLCB(reg) REGP(_gcmp_base, GCMPCLCBOFS(reg))
32#define GCMPCOCB(reg) REGP(_gcmp_base, GCMPCOCBOFS(reg)) 37#define GCMPCOCB(reg) REGP(_gcmp_base, GCMPCOCBOFS(reg))
33#define GCMPGDB(reg) REGP(_gcmp_base, GCMPGDBOFS(reg)) 38#define GCMPGDB(reg) REGP(_gcmp_base, GCMPGDBOFS(reg))
@@ -49,10 +54,10 @@
49#define GCMP_GCB_GCMPB_GCMPBASE_MSK GCMPGCBMSK(GCMPB_GCMPBASE, 17) 54#define GCMP_GCB_GCMPB_GCMPBASE_MSK GCMPGCBMSK(GCMPB_GCMPBASE, 17)
50#define GCMP_GCB_GCMPB_CMDEFTGT_SHF 0 55#define GCMP_GCB_GCMPB_CMDEFTGT_SHF 0
51#define GCMP_GCB_GCMPB_CMDEFTGT_MSK GCMPGCBMSK(GCMPB_CMDEFTGT, 2) 56#define GCMP_GCB_GCMPB_CMDEFTGT_MSK GCMPGCBMSK(GCMPB_CMDEFTGT, 2)
52#define GCMP_GCB_GCMPB_CMDEFTGT_MEM 0 57#define GCMP_GCB_GCMPB_CMDEFTGT_DISABLED 0
53#define GCMP_GCB_GCMPB_CMDEFTGT_MEM1 1 58#define GCMP_GCB_GCMPB_CMDEFTGT_MEM 1
54#define GCMP_GCB_GCMPB_CMDEFTGT_IOCU1 2 59#define GCMP_GCB_GCMPB_CMDEFTGT_IOCU1 2
55#define GCMP_GCB_GCMPB_CMDEFTGT_IOCU2 3 60#define GCMP_GCB_GCMPB_CMDEFTGT_IOCU2 3
56#define GCMP_GCB_CCMC_OFS 0x0010 /* Global CM Control */ 61#define GCMP_GCB_CCMC_OFS 0x0010 /* Global CM Control */
57#define GCMP_GCB_GCSRAP_OFS 0x0020 /* Global CSR Access Privilege */ 62#define GCMP_GCB_GCSRAP_OFS 0x0020 /* Global CSR Access Privilege */
58#define GCMP_GCB_GCSRAP_CMACCESS_SHF 0 63#define GCMP_GCB_GCSRAP_CMACCESS_SHF 0
@@ -115,5 +120,6 @@
115#define GCMP_CCB_DBGGROUP_OFS 0x0100 /* DebugBreak Group */ 120#define GCMP_CCB_DBGGROUP_OFS 0x0100 /* DebugBreak Group */
116 121
117extern int __init gcmp_probe(unsigned long, unsigned long); 122extern int __init gcmp_probe(unsigned long, unsigned long);
118 123extern int __init gcmp_niocu(void);
124extern void __init gcmp_setregion(int, unsigned long, unsigned long, int);
119#endif /* _ASM_GCMPREGS_H */ 125#endif /* _ASM_GCMPREGS_H */
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index a8f57341f123..9b9436a4d816 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -12,7 +12,6 @@
12#define _ASM_GICREGS_H 12#define _ASM_GICREGS_H
13 13
14#undef GICISBYTELITTLEENDIAN 14#undef GICISBYTELITTLEENDIAN
15#define GICISWORDLITTLEENDIAN
16 15
17/* Constants */ 16/* Constants */
18#define GIC_POL_POS 1 17#define GIC_POL_POS 1
@@ -20,11 +19,7 @@
20#define GIC_TRIG_EDGE 1 19#define GIC_TRIG_EDGE 1
21#define GIC_TRIG_LEVEL 0 20#define GIC_TRIG_LEVEL 0
22 21
23#ifdef CONFIG_SMP
24#define GIC_NUM_INTRS (24 + NR_CPUS * 2) 22#define GIC_NUM_INTRS (24 + NR_CPUS * 2)
25#else
26#define GIC_NUM_INTRS 32
27#endif
28 23
29#define MSK(n) ((1 << (n)) - 1) 24#define MSK(n) ((1 << (n)) - 1)
30#define REG32(addr) (*(volatile unsigned int *) (addr)) 25#define REG32(addr) (*(volatile unsigned int *) (addr))
@@ -70,13 +65,13 @@
70#define USM_VISIBLE_SECTION_SIZE 0x10000 65#define USM_VISIBLE_SECTION_SIZE 0x10000
71 66
72/* Register Map for Shared Section */ 67/* Register Map for Shared Section */
73#if defined(CONFIG_CPU_LITTLE_ENDIAN) || defined(GICISWORDLITTLEENDIAN)
74 68
75#define GIC_SH_CONFIG_OFS 0x0000 69#define GIC_SH_CONFIG_OFS 0x0000
76 70
77/* Shared Global Counter */ 71/* Shared Global Counter */
78#define GIC_SH_COUNTER_31_00_OFS 0x0010 72#define GIC_SH_COUNTER_31_00_OFS 0x0010
79#define GIC_SH_COUNTER_63_32_OFS 0x0014 73#define GIC_SH_COUNTER_63_32_OFS 0x0014
74#define GIC_SH_REVISIONID_OFS 0x0020
80 75
81/* Interrupt Polarity */ 76/* Interrupt Polarity */
82#define GIC_SH_POL_31_0_OFS 0x0100 77#define GIC_SH_POL_31_0_OFS 0x0100
@@ -164,24 +159,31 @@
164 (GIC_SH_INTR_MAP_TO_VPE_BASE_OFS + (32 * (intr)) + (((vpe) / 32) * 4)) 159 (GIC_SH_INTR_MAP_TO_VPE_BASE_OFS + (32 * (intr)) + (((vpe) / 32) * 4))
165#define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32)) 160#define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32))
166 161
162/* Convert an interrupt number to a byte offset/bit for multi-word registers */
163#define GIC_INTR_OFS(intr) (((intr) / 32)*4)
164#define GIC_INTR_BIT(intr) ((intr) % 32)
165
167/* Polarity : Reset Value is always 0 */ 166/* Polarity : Reset Value is always 0 */
168#define GIC_SH_SET_POLARITY_OFS 0x0100 167#define GIC_SH_SET_POLARITY_OFS 0x0100
169#define GIC_SET_POLARITY(intr, pol) \ 168#define GIC_SET_POLARITY(intr, pol) \
170 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + (((intr) / 32) * 4)), (pol) << ((intr) % 32)) 169 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + \
170 GIC_INTR_OFS(intr)), (pol) << GIC_INTR_BIT(intr))
171 171
172/* Triggering : Reset Value is always 0 */ 172/* Triggering : Reset Value is always 0 */
173#define GIC_SH_SET_TRIGGER_OFS 0x0180 173#define GIC_SH_SET_TRIGGER_OFS 0x0180
174#define GIC_SET_TRIGGER(intr, trig) \ 174#define GIC_SET_TRIGGER(intr, trig) \
175 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + (((intr) / 32) * 4)), (trig) << ((intr) % 32)) 175 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + \
176 GIC_INTR_OFS(intr)), (trig) << GIC_INTR_BIT(intr))
176 177
177/* Mask manipulation */ 178/* Mask manipulation */
178#define GIC_SH_SMASK_OFS 0x0380 179#define GIC_SH_SMASK_OFS 0x0380
179#define GIC_SET_INTR_MASK(intr, val) \ 180#define GIC_SET_INTR_MASK(intr) \
180 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_SMASK_OFS + (((intr) / 32) * 4)), ((val) << ((intr) % 32))) 181 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_SMASK_OFS + \
181 182 GIC_INTR_OFS(intr)), 1 << GIC_INTR_BIT(intr))
182#define GIC_SH_RMASK_OFS 0x0300 183#define GIC_SH_RMASK_OFS 0x0300
183#define GIC_CLR_INTR_MASK(intr, val) \ 184#define GIC_CLR_INTR_MASK(intr) \
184 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + (((intr) / 32) * 4)), ((val) << ((intr) % 32))) 185 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + \
186 GIC_INTR_OFS(intr)), 1 << GIC_INTR_BIT(intr))
185 187
186/* Register Map for Local Section */ 188/* Register Map for Local Section */
187#define GIC_VPE_CTL_OFS 0x0000 189#define GIC_VPE_CTL_OFS 0x0000
@@ -219,161 +221,6 @@
219#define GIC_UMV_SH_COUNTER_31_00_OFS 0x0000 221#define GIC_UMV_SH_COUNTER_31_00_OFS 0x0000
220#define GIC_UMV_SH_COUNTER_63_32_OFS 0x0004 222#define GIC_UMV_SH_COUNTER_63_32_OFS 0x0004
221 223
222#else /* CONFIG_CPU_BIG_ENDIAN */
223
224#define GIC_SH_CONFIG_OFS 0x0000
225
226/* Shared Global Counter */
227#define GIC_SH_COUNTER_31_00_OFS 0x0014
228#define GIC_SH_COUNTER_63_32_OFS 0x0010
229
230/* Interrupt Polarity */
231#define GIC_SH_POL_31_0_OFS 0x0104
232#define GIC_SH_POL_63_32_OFS 0x0100
233#define GIC_SH_POL_95_64_OFS 0x010c
234#define GIC_SH_POL_127_96_OFS 0x0108
235#define GIC_SH_POL_159_128_OFS 0x0114
236#define GIC_SH_POL_191_160_OFS 0x0110
237#define GIC_SH_POL_223_192_OFS 0x011c
238#define GIC_SH_POL_255_224_OFS 0x0118
239
240/* Edge/Level Triggering */
241#define GIC_SH_TRIG_31_0_OFS 0x0184
242#define GIC_SH_TRIG_63_32_OFS 0x0180
243#define GIC_SH_TRIG_95_64_OFS 0x018c
244#define GIC_SH_TRIG_127_96_OFS 0x0188
245#define GIC_SH_TRIG_159_128_OFS 0x0194
246#define GIC_SH_TRIG_191_160_OFS 0x0190
247#define GIC_SH_TRIG_223_192_OFS 0x019c
248#define GIC_SH_TRIG_255_224_OFS 0x0198
249
250/* Dual Edge Triggering */
251#define GIC_SH_DUAL_31_0_OFS 0x0204
252#define GIC_SH_DUAL_63_32_OFS 0x0200
253#define GIC_SH_DUAL_95_64_OFS 0x020c
254#define GIC_SH_DUAL_127_96_OFS 0x0208
255#define GIC_SH_DUAL_159_128_OFS 0x0214
256#define GIC_SH_DUAL_191_160_OFS 0x0210
257#define GIC_SH_DUAL_223_192_OFS 0x021c
258#define GIC_SH_DUAL_255_224_OFS 0x0218
259
260/* Set/Clear corresponding bit in Edge Detect Register */
261#define GIC_SH_WEDGE_OFS 0x0280
262
263/* Reset Mask - Disables Interrupt */
264#define GIC_SH_RMASK_31_0_OFS 0x0304
265#define GIC_SH_RMASK_63_32_OFS 0x0300
266#define GIC_SH_RMASK_95_64_OFS 0x030c
267#define GIC_SH_RMASK_127_96_OFS 0x0308
268#define GIC_SH_RMASK_159_128_OFS 0x0314
269#define GIC_SH_RMASK_191_160_OFS 0x0310
270#define GIC_SH_RMASK_223_192_OFS 0x031c
271#define GIC_SH_RMASK_255_224_OFS 0x0318
272
273/* Set Mask (WO) - Enables Interrupt */
274#define GIC_SH_SMASK_31_0_OFS 0x0384
275#define GIC_SH_SMASK_63_32_OFS 0x0380
276#define GIC_SH_SMASK_95_64_OFS 0x038c
277#define GIC_SH_SMASK_127_96_OFS 0x0388
278#define GIC_SH_SMASK_159_128_OFS 0x0394
279#define GIC_SH_SMASK_191_160_OFS 0x0390
280#define GIC_SH_SMASK_223_192_OFS 0x039c
281#define GIC_SH_SMASK_255_224_OFS 0x0398
282
283/* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */
284#define GIC_SH_MASK_31_0_OFS 0x0404
285#define GIC_SH_MASK_63_32_OFS 0x0400
286#define GIC_SH_MASK_95_64_OFS 0x040c
287#define GIC_SH_MASK_127_96_OFS 0x0408
288#define GIC_SH_MASK_159_128_OFS 0x0414
289#define GIC_SH_MASK_191_160_OFS 0x0410
290#define GIC_SH_MASK_223_192_OFS 0x041c
291#define GIC_SH_MASK_255_224_OFS 0x0418
292
293/* Pending Global Interrupts (RO) */
294#define GIC_SH_PEND_31_0_OFS 0x0484
295#define GIC_SH_PEND_63_32_OFS 0x0480
296#define GIC_SH_PEND_95_64_OFS 0x048c
297#define GIC_SH_PEND_127_96_OFS 0x0488
298#define GIC_SH_PEND_159_128_OFS 0x0494
299#define GIC_SH_PEND_191_160_OFS 0x0490
300#define GIC_SH_PEND_223_192_OFS 0x049c
301#define GIC_SH_PEND_255_224_OFS 0x0498
302
303#define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500
304
305/* Maps Interrupt X to a Pin */
306#define GIC_SH_MAP_TO_PIN(intr) \
307 (GIC_SH_INTR_MAP_TO_PIN_BASE_OFS + (4 * intr))
308
309#define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2004
310
311/*
312 * Maps Interrupt X to a VPE. This is more complex than the LE case, as
313 * odd and even registers need to be transposed. It does work - trust me!
314 */
315#define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \
316 (GIC_SH_INTR_MAP_TO_VPE_BASE_OFS + (32 * (intr)) + \
317 (((((vpe) / 32) ^ 1) - 1) * 4))
318#define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32))
319
320/* Polarity */
321#define GIC_SH_SET_POLARITY_OFS 0x0100
322#define GIC_SET_POLARITY(intr, pol) \
323 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), (pol) << ((intr) % 32))
324
325/* Triggering */
326#define GIC_SH_SET_TRIGGER_OFS 0x0180
327#define GIC_SET_TRIGGER(intr, trig) \
328 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), (trig) << ((intr) % 32))
329
330/* Mask manipulation */
331#define GIC_SH_SMASK_OFS 0x0380
332#define GIC_SET_INTR_MASK(intr, val) \
333 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_SMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
334
335#define GIC_SH_RMASK_OFS 0x0300
336#define GIC_CLR_INTR_MASK(intr, val) \
337 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
338
339/* Register Map for Local Section */
340#define GIC_VPE_CTL_OFS 0x0000
341#define GIC_VPE_PEND_OFS 0x0004
342#define GIC_VPE_MASK_OFS 0x0008
343#define GIC_VPE_RMASK_OFS 0x000c
344#define GIC_VPE_SMASK_OFS 0x0010
345#define GIC_VPE_WD_MAP_OFS 0x0040
346#define GIC_VPE_COMPARE_MAP_OFS 0x0044
347#define GIC_VPE_TIMER_MAP_OFS 0x0048
348#define GIC_VPE_PERFCTR_MAP_OFS 0x0050
349#define GIC_VPE_SWINT0_MAP_OFS 0x0054
350#define GIC_VPE_SWINT1_MAP_OFS 0x0058
351#define GIC_VPE_OTHER_ADDR_OFS 0x0080
352#define GIC_VPE_WD_CONFIG0_OFS 0x0090
353#define GIC_VPE_WD_COUNT0_OFS 0x0094
354#define GIC_VPE_WD_INITIAL0_OFS 0x0098
355#define GIC_VPE_COMPARE_LO_OFS 0x00a4
356#define GIC_VPE_COMPARE_HI_OFS 0x00a0
357
358#define GIC_VPE_EIC_SHADOW_SET_BASE 0x0100
359#define GIC_VPE_EIC_SS(intr) \
360 (GIC_EIC_SHADOW_SET_BASE + (4 * intr))
361
362#define GIC_VPE_EIC_VEC_BASE 0x0800
363#define GIC_VPE_EIC_VEC(intr) \
364 (GIC_VPE_EIC_VEC_BASE + (4 * intr))
365
366#define GIC_VPE_TENABLE_NMI_OFS 0x1000
367#define GIC_VPE_TENABLE_YQ_OFS 0x1004
368#define GIC_VPE_TENABLE_INT_31_0_OFS 0x1080
369#define GIC_VPE_TENABLE_INT_63_32_OFS 0x1084
370
371/* User Mode Visible Section Register Map */
372#define GIC_UMV_SH_COUNTER_31_00_OFS 0x0004
373#define GIC_UMV_SH_COUNTER_63_32_OFS 0x0000
374
375#endif /* !LE */
376
377/* Masks */ 224/* Masks */
378#define GIC_SH_CONFIG_COUNTSTOP_SHF 28 225#define GIC_SH_CONFIG_COUNTSTOP_SHF 28
379#define GIC_SH_CONFIG_COUNTSTOP_MSK (MSK(1) << GIC_SH_CONFIG_COUNTSTOP_SHF) 226#define GIC_SH_CONFIG_COUNTSTOP_MSK (MSK(1) << GIC_SH_CONFIG_COUNTSTOP_SHF)
@@ -473,12 +320,13 @@ struct gic_intrmask_regs {
473 * in building ipi_map. 320 * in building ipi_map.
474 */ 321 */
475struct gic_intr_map { 322struct gic_intr_map {
476 unsigned int intrnum; /* Ext Intr Num */
477 unsigned int cpunum; /* Directed to this CPU */ 323 unsigned int cpunum; /* Directed to this CPU */
478 unsigned int pin; /* Directed to this Pin */ 324 unsigned int pin; /* Directed to this Pin */
479 unsigned int polarity; /* Polarity : +/- */ 325 unsigned int polarity; /* Polarity : +/- */
480 unsigned int trigtype; /* Trigger : Edge/Levl */ 326 unsigned int trigtype; /* Trigger : Edge/Levl */
481 unsigned int ipiflag; /* Is used for IPI ? */ 327 unsigned int flags; /* Misc flags */
328#define GIC_FLAG_IPI 0x01
329#define GIC_FLAG_TRANSPARENT 0x02
482}; 330};
483 331
484extern void gic_init(unsigned long gic_base_addr, 332extern void gic_init(unsigned long gic_base_addr,
diff --git a/arch/mips/include/asm/mach-ar7/ar7.h b/arch/mips/include/asm/mach-ar7/ar7.h
index de71694614de..21cbbc706448 100644
--- a/arch/mips/include/asm/mach-ar7/ar7.h
+++ b/arch/mips/include/asm/mach-ar7/ar7.h
@@ -78,6 +78,9 @@
78#define AR7_REF_CLOCK 25000000 78#define AR7_REF_CLOCK 25000000
79#define AR7_XTAL_CLOCK 24000000 79#define AR7_XTAL_CLOCK 24000000
80 80
81/* DCL */
82#define AR7_WDT_HW_ENA 0x10
83
81struct plat_cpmac_data { 84struct plat_cpmac_data {
82 int reset_bit; 85 int reset_bit;
83 int power_bit; 86 int power_bit;
diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
index feea00148b5d..91595fa89034 100644
--- a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
+++ b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
@@ -104,6 +104,8 @@ static inline int au1100_gpio2_to_irq(int gpio)
104 104
105 if ((gpio >= 8) && (gpio <= 15)) 105 if ((gpio >= 8) && (gpio <= 15))
106 return MAKE_IRQ(0, 29); /* shared GPIO208_215 */ 106 return MAKE_IRQ(0, 29); /* shared GPIO208_215 */
107
108 return -ENXIO;
107} 109}
108 110
109#ifdef CONFIG_SOC_AU1100 111#ifdef CONFIG_SOC_AU1100
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h
deleted file mode 100644
index bf348f573bbc..000000000000
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef BCM63XX_DEV_UART_H_
2#define BCM63XX_DEV_UART_H_
3
4int bcm63xx_uart_register(void);
5
6#endif /* BCM63XX_DEV_UART_H_ */
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index f6837422fe65..09a59bcc1b07 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -44,8 +44,8 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
44 .busy_factor = 32, \ 44 .busy_factor = 32, \
45 .imbalance_pct = 125, \ 45 .imbalance_pct = 125, \
46 .cache_nice_tries = 1, \ 46 .cache_nice_tries = 1, \
47 .flags = SD_LOAD_BALANCE \ 47 .flags = SD_LOAD_BALANCE | \
48 | SD_BALANCE_EXEC \ 48 SD_BALANCE_EXEC, \
49 .last_balance = jiffies, \ 49 .last_balance = jiffies, \
50 .balance_interval = 1, \ 50 .balance_interval = 1, \
51 .nr_balance_failed = 0, \ 51 .nr_balance_failed = 0, \
diff --git a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
index ce5b6e270e3f..9947e57c91de 100644
--- a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
@@ -29,7 +29,7 @@
29#define cpu_has_cache_cdex_p 0 29#define cpu_has_cache_cdex_p 0
30#define cpu_has_cache_cdex_s 0 30#define cpu_has_cache_cdex_s 0
31#define cpu_has_counter 1 31#define cpu_has_counter 1
32#define cpu_has_dc_aliases 1 32#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
33#define cpu_has_divec 0 33#define cpu_has_divec 0
34#define cpu_has_dsp 0 34#define cpu_has_dsp 0
35#define cpu_has_ejtag 0 35#define cpu_has_ejtag 0
@@ -54,6 +54,5 @@
54#define cpu_has_vce 0 54#define cpu_has_vce 0
55#define cpu_has_vtag_icache 0 55#define cpu_has_vtag_icache 0
56#define cpu_has_watch 1 56#define cpu_has_watch 1
57#define cpu_icache_snoops_remote_store 1
58 57
59#endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */ 58#endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index d9743536a621..6083db586500 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -16,6 +16,7 @@
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/hazards.h>
19#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
20#ifdef CONFIG_MIPS_MT_SMTC 21#ifdef CONFIG_MIPS_MT_SMTC
21#include <asm/mipsmtregs.h> 22#include <asm/mipsmtregs.h>
@@ -36,11 +37,13 @@ extern unsigned long pgd_current[];
36#ifdef CONFIG_32BIT 37#ifdef CONFIG_32BIT
37#define TLBMISS_HANDLER_SETUP() \ 38#define TLBMISS_HANDLER_SETUP() \
38 write_c0_context((unsigned long) smp_processor_id() << 25); \ 39 write_c0_context((unsigned long) smp_processor_id() << 25); \
40 back_to_back_c0_hazard(); \
39 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 41 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
40#endif 42#endif
41#ifdef CONFIG_64BIT 43#ifdef CONFIG_64BIT
42#define TLBMISS_HANDLER_SETUP() \ 44#define TLBMISS_HANDLER_SETUP() \
43 write_c0_context((unsigned long) smp_processor_id() << 26); \ 45 write_c0_context((unsigned long) smp_processor_id() << 26); \
46 back_to_back_c0_hazard(); \
44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 47 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
45#endif 48#endif
46 49
@@ -165,12 +168,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
165 * having ASID_MASK smaller than the hardware maximum, 168 * having ASID_MASK smaller than the hardware maximum,
166 * make sure no "soft" bits become "hard"... 169 * make sure no "soft" bits become "hard"...
167 */ 170 */
168 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) 171 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) |
169 | (cpu_context(cpu, next) & ASID_MASK)); 172 cpu_asid(cpu, next));
170 ehb(); /* Make sure it propagates to TCStatus */ 173 ehb(); /* Make sure it propagates to TCStatus */
171 evpe(mtflags); 174 evpe(mtflags);
172#else 175#else
173 write_c0_entryhi(cpu_context(cpu, next)); 176 write_c0_entryhi(cpu_asid(cpu, next));
174#endif /* CONFIG_MIPS_MT_SMTC */ 177#endif /* CONFIG_MIPS_MT_SMTC */
175 TLBMISS_HANDLER_SETUP_PGD(next->pgd); 178 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
176 179
@@ -226,11 +229,11 @@ activate_mm(struct mm_struct *prev, struct mm_struct *next)
226 } 229 }
227 /* See comments for similar code above */ 230 /* See comments for similar code above */
228 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) | 231 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) |
229 (cpu_context(cpu, next) & ASID_MASK)); 232 cpu_asid(cpu, next));
230 ehb(); /* Make sure it propagates to TCStatus */ 233 ehb(); /* Make sure it propagates to TCStatus */
231 evpe(mtflags); 234 evpe(mtflags);
232#else 235#else
233 write_c0_entryhi(cpu_context(cpu, next)); 236 write_c0_entryhi(cpu_asid(cpu, next));
234#endif /* CONFIG_MIPS_MT_SMTC */ 237#endif /* CONFIG_MIPS_MT_SMTC */
235 TLBMISS_HANDLER_SETUP_PGD(next->pgd); 238 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
236 239
diff --git a/arch/mips/include/asm/setup.h b/arch/mips/include/asm/setup.h
index e600cedda976..50511aac04e9 100644
--- a/arch/mips/include/asm/setup.h
+++ b/arch/mips/include/asm/setup.h
@@ -1,7 +1,7 @@
1#ifndef _MIPS_SETUP_H 1#ifndef _MIPS_SETUP_H
2#define _MIPS_SETUP_H 2#define _MIPS_SETUP_H
3 3
4#define COMMAND_LINE_SIZE 256 4#define COMMAND_LINE_SIZE 4096
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7extern void setup_early_printk(void); 7extern void setup_early_printk(void);
diff --git a/arch/mips/include/asm/smtc_ipi.h b/arch/mips/include/asm/smtc_ipi.h
index 8ce517574340..15278dbd7e79 100644
--- a/arch/mips/include/asm/smtc_ipi.h
+++ b/arch/mips/include/asm/smtc_ipi.h
@@ -45,6 +45,7 @@ struct smtc_ipi_q {
45 spinlock_t lock; 45 spinlock_t lock;
46 struct smtc_ipi *tail; 46 struct smtc_ipi *tail;
47 int depth; 47 int depth;
48 int resched_flag; /* reschedule already queued */
48}; 49};
49 50
50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p) 51static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
diff --git a/arch/mips/include/asm/spram.h b/arch/mips/include/asm/spram.h
new file mode 100644
index 000000000000..0b89006e4907
--- /dev/null
+++ b/arch/mips/include/asm/spram.h
@@ -0,0 +1,10 @@
1#ifndef _MIPS_SPRAM_H
2#define _MIPS_SPRAM_H
3
4#ifdef CONFIG_CPU_MIPSR2
5extern __init void spram_config(void);
6#else
7static inline void spram_config(void) { };
8#endif /* CONFIG_CPU_MIPSR2 */
9
10#endif /* _MIPS_SPRAM_H */
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 01cc1630b66c..845da2107ed1 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -86,14 +86,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
86#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 86#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
87 87
88#ifdef CONFIG_DEBUG_STACK_USAGE 88#ifdef CONFIG_DEBUG_STACK_USAGE
89#define alloc_thread_info(tsk) \ 89#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
90({ \
91 struct thread_info *ret; \
92 \
93 ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
94 \
95 ret; \
96})
97#else 90#else
98#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) 91#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
99#endif 92#endif
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 7fd170d007e7..7bd32d04c2cc 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -134,7 +134,7 @@ static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id)
134 134
135static struct irqaction r4030_timer_irqaction = { 135static struct irqaction r4030_timer_irqaction = {
136 .handler = r4030_timer_interrupt, 136 .handler = r4030_timer_interrupt,
137 .flags = IRQF_DISABLED, 137 .flags = IRQF_DISABLED | IRQF_TIMER,
138 .name = "R4030 timer", 138 .name = "R4030 timer",
139}; 139};
140 140
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
index e02f79b1eb51..bfea327c636c 100644
--- a/arch/mips/kernel/cevt-bcm1480.c
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -144,7 +144,7 @@ void __cpuinit sb1480_clockevent_init(void)
144 bcm1480_unmask_irq(cpu, irq); 144 bcm1480_unmask_irq(cpu, irq);
145 145
146 action->handler = sibyte_counter_handler; 146 action->handler = sibyte_counter_handler;
147 action->flags = IRQF_DISABLED | IRQF_PERCPU; 147 action->flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER;
148 action->name = name; 148 action->name = name;
149 action->dev_id = cd; 149 action->dev_id = cd;
150 150
diff --git a/arch/mips/kernel/cevt-ds1287.c b/arch/mips/kernel/cevt-ds1287.c
index 6996da4d74a2..00a4da277cbb 100644
--- a/arch/mips/kernel/cevt-ds1287.c
+++ b/arch/mips/kernel/cevt-ds1287.c
@@ -107,7 +107,7 @@ static irqreturn_t ds1287_interrupt(int irq, void *dev_id)
107 107
108static struct irqaction ds1287_irqaction = { 108static struct irqaction ds1287_irqaction = {
109 .handler = ds1287_interrupt, 109 .handler = ds1287_interrupt,
110 .flags = IRQF_DISABLED | IRQF_PERCPU, 110 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER,
111 .name = "ds1287", 111 .name = "ds1287",
112}; 112};
113 113
diff --git a/arch/mips/kernel/cevt-gt641xx.c b/arch/mips/kernel/cevt-gt641xx.c
index 92351e00ae0e..f5d265eb6eae 100644
--- a/arch/mips/kernel/cevt-gt641xx.c
+++ b/arch/mips/kernel/cevt-gt641xx.c
@@ -113,7 +113,7 @@ static irqreturn_t gt641xx_timer0_interrupt(int irq, void *dev_id)
113 113
114static struct irqaction gt641xx_timer0_irqaction = { 114static struct irqaction gt641xx_timer0_irqaction = {
115 .handler = gt641xx_timer0_interrupt, 115 .handler = gt641xx_timer0_interrupt,
116 .flags = IRQF_DISABLED | IRQF_PERCPU, 116 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER,
117 .name = "gt641xx_timer0", 117 .name = "gt641xx_timer0",
118}; 118};
119 119
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 2652362ce047..b469ad05d520 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -83,7 +83,7 @@ out:
83 83
84struct irqaction c0_compare_irqaction = { 84struct irqaction c0_compare_irqaction = {
85 .handler = c0_compare_interrupt, 85 .handler = c0_compare_interrupt,
86 .flags = IRQF_DISABLED | IRQF_PERCPU, 86 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER,
87 .name = "timer", 87 .name = "timer",
88}; 88};
89 89
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
index ac5903d1b20e..da78eeaea6e8 100644
--- a/arch/mips/kernel/cevt-sb1250.c
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -143,7 +143,7 @@ void __cpuinit sb1250_clockevent_init(void)
143 sb1250_unmask_irq(cpu, irq); 143 sb1250_unmask_irq(cpu, irq);
144 144
145 action->handler = sibyte_counter_handler; 145 action->handler = sibyte_counter_handler;
146 action->flags = IRQF_DISABLED | IRQF_PERCPU; 146 action->flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER;
147 action->name = name; 147 action->name = name;
148 action->dev_id = cd; 148 action->dev_id = cd;
149 149
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
index 0037f21baf0d..218ee6bda935 100644
--- a/arch/mips/kernel/cevt-txx9.c
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -146,7 +146,7 @@ static irqreturn_t txx9tmr_interrupt(int irq, void *dev_id)
146 146
147static struct irqaction txx9tmr_irq = { 147static struct irqaction txx9tmr_irq = {
148 .handler = txx9tmr_interrupt, 148 .handler = txx9tmr_interrupt,
149 .flags = IRQF_DISABLED | IRQF_PERCPU, 149 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER,
150 .name = "txx9tmr", 150 .name = "txx9tmr",
151 .dev_id = &txx9_clock_event_device, 151 .dev_id = &txx9_clock_event_device,
152}; 152};
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index f709657e4dcd..7a51866068a4 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -23,7 +23,7 @@
23#include <asm/mipsregs.h> 23#include <asm/mipsregs.h>
24#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/watch.h> 25#include <asm/watch.h>
26 26#include <asm/spram.h>
27/* 27/*
28 * Not all of the MIPS CPUs have the "wait" instruction available. Moreover, 28 * Not all of the MIPS CPUs have the "wait" instruction available. Moreover,
29 * the implementation of the "wait" feature differs between CPU families. This 29 * the implementation of the "wait" feature differs between CPU families. This
@@ -711,12 +711,6 @@ static void __cpuinit decode_configs(struct cpuinfo_mips *c)
711 mips_probe_watch_registers(c); 711 mips_probe_watch_registers(c);
712} 712}
713 713
714#ifdef CONFIG_CPU_MIPSR2
715extern void spram_config(void);
716#else
717static inline void spram_config(void) {}
718#endif
719
720static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) 714static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
721{ 715{
722 decode_configs(c); 716 decode_configs(c);
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 531ce7b16124..ea695d9605e9 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -191,6 +191,7 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
191 /* Set the SP after an empty pt_regs. */ 191 /* Set the SP after an empty pt_regs. */
192 PTR_LI sp, _THREAD_SIZE - 32 - PT_SIZE 192 PTR_LI sp, _THREAD_SIZE - 32 - PT_SIZE
193 PTR_ADDU sp, $28 193 PTR_ADDU sp, $28
194 back_to_back_c0_hazard
194 set_saved_sp sp, t0, t1 195 set_saved_sp sp, t0, t1
195 PTR_SUBU sp, 4 * SZREG # init stack pointer 196 PTR_SUBU sp, 4 * SZREG # init stack pointer
196 197
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c
index f7d8d5d0ddbf..ed5c441615e4 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/i8253.c
@@ -98,7 +98,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
98 98
99static struct irqaction irq0 = { 99static struct irqaction irq0 = {
100 .handler = timer_interrupt, 100 .handler = timer_interrupt,
101 .flags = IRQF_DISABLED | IRQF_NOBALANCING, 101 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
102 .name = "timer" 102 .name = "timer"
103}; 103};
104 104
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index d2072cd38592..b181f2f0ea8e 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -14,38 +14,23 @@
14 14
15 15
16static unsigned long _gic_base; 16static unsigned long _gic_base;
17static unsigned int _irqbase, _mapsize, numvpes, numintrs; 17static unsigned int _irqbase;
18static struct gic_intr_map *_intrmap; 18static unsigned int gic_irq_flags[GIC_NUM_INTRS];
19#define GIC_IRQ_FLAG_EDGE 0x0001
19 20
20static struct gic_pcpu_mask pcpu_masks[NR_CPUS]; 21struct gic_pcpu_mask pcpu_masks[NR_CPUS];
21static struct gic_pending_regs pending_regs[NR_CPUS]; 22static struct gic_pending_regs pending_regs[NR_CPUS];
22static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; 23static struct gic_intrmask_regs intrmask_regs[NR_CPUS];
23 24
24#define gic_wedgeb2bok 0 /*
25 * Can GIC handle b2b writes to wedge register?
26 */
27#if gic_wedgeb2bok == 0
28static DEFINE_SPINLOCK(gic_wedgeb2b_lock);
29#endif
30
31void gic_send_ipi(unsigned int intr) 25void gic_send_ipi(unsigned int intr)
32{ 26{
33#if gic_wedgeb2bok == 0
34 unsigned long flags;
35#endif
36 pr_debug("CPU%d: %s status %08x\n", smp_processor_id(), __func__, 27 pr_debug("CPU%d: %s status %08x\n", smp_processor_id(), __func__,
37 read_c0_status()); 28 read_c0_status());
38 if (!gic_wedgeb2bok)
39 spin_lock_irqsave(&gic_wedgeb2b_lock, flags);
40 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), 0x80000000 | intr); 29 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), 0x80000000 | intr);
41 if (!gic_wedgeb2bok) {
42 (void) GIC_REG(SHARED, GIC_SH_CONFIG);
43 spin_unlock_irqrestore(&gic_wedgeb2b_lock, flags);
44 }
45} 30}
46 31
47/* This is Malta specific and needs to be exported */ 32/* This is Malta specific and needs to be exported */
48static void vpe_local_setup(unsigned int numvpes) 33static void __init vpe_local_setup(unsigned int numvpes)
49{ 34{
50 int i; 35 int i;
51 unsigned long timer_interrupt = 5, perf_interrupt = 5; 36 unsigned long timer_interrupt = 5, perf_interrupt = 5;
@@ -105,44 +90,34 @@ unsigned int gic_get_int(void)
105 90
106static unsigned int gic_irq_startup(unsigned int irq) 91static unsigned int gic_irq_startup(unsigned int irq)
107{ 92{
108 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
109 irq -= _irqbase; 93 irq -= _irqbase;
110 GIC_SET_INTR_MASK(irq, 1); 94 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
95 GIC_SET_INTR_MASK(irq);
111 return 0; 96 return 0;
112} 97}
113 98
114static void gic_irq_ack(unsigned int irq) 99static void gic_irq_ack(unsigned int irq)
115{ 100{
116#if gic_wedgeb2bok == 0
117 unsigned long flags;
118#endif
119 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
120 irq -= _irqbase; 101 irq -= _irqbase;
121 GIC_CLR_INTR_MASK(irq, 1); 102 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
103 GIC_CLR_INTR_MASK(irq);
122 104
123 if (_intrmap[irq].trigtype == GIC_TRIG_EDGE) { 105 if (gic_irq_flags[irq] & GIC_IRQ_FLAG_EDGE)
124 if (!gic_wedgeb2bok)
125 spin_lock_irqsave(&gic_wedgeb2b_lock, flags);
126 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq); 106 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq);
127 if (!gic_wedgeb2bok) {
128 (void) GIC_REG(SHARED, GIC_SH_CONFIG);
129 spin_unlock_irqrestore(&gic_wedgeb2b_lock, flags);
130 }
131 }
132} 107}
133 108
134static void gic_mask_irq(unsigned int irq) 109static void gic_mask_irq(unsigned int irq)
135{ 110{
136 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
137 irq -= _irqbase; 111 irq -= _irqbase;
138 GIC_CLR_INTR_MASK(irq, 1); 112 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
113 GIC_CLR_INTR_MASK(irq);
139} 114}
140 115
141static void gic_unmask_irq(unsigned int irq) 116static void gic_unmask_irq(unsigned int irq)
142{ 117{
143 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
144 irq -= _irqbase; 118 irq -= _irqbase;
145 GIC_SET_INTR_MASK(irq, 1); 119 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);
120 GIC_SET_INTR_MASK(irq);
146} 121}
147 122
148#ifdef CONFIG_SMP 123#ifdef CONFIG_SMP
@@ -155,9 +130,8 @@ static int gic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
155 unsigned long flags; 130 unsigned long flags;
156 int i; 131 int i;
157 132
158 pr_debug(KERN_DEBUG "%s called\n", __func__);
159 irq -= _irqbase; 133 irq -= _irqbase;
160 134 pr_debug(KERN_DEBUG "%s(%d) called\n", __func__, irq);
161 cpumask_and(&tmp, cpumask, cpu_online_mask); 135 cpumask_and(&tmp, cpumask, cpu_online_mask);
162 if (cpus_empty(tmp)) 136 if (cpus_empty(tmp))
163 return -1; 137 return -1;
@@ -168,13 +142,6 @@ static int gic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
168 /* Re-route this IRQ */ 142 /* Re-route this IRQ */
169 GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp)); 143 GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
170 144
171 /*
172 * FIXME: assumption that _intrmap is ordered and has no holes
173 */
174
175 /* Update the intr_map */
176 _intrmap[irq].cpunum = first_cpu(tmp);
177
178 /* Update the pcpu_masks */ 145 /* Update the pcpu_masks */
179 for (i = 0; i < NR_CPUS; i++) 146 for (i = 0; i < NR_CPUS; i++)
180 clear_bit(irq, pcpu_masks[i].pcpu_mask); 147 clear_bit(irq, pcpu_masks[i].pcpu_mask);
@@ -201,8 +168,9 @@ static struct irq_chip gic_irq_controller = {
201#endif 168#endif
202}; 169};
203 170
204static void __init setup_intr(unsigned int intr, unsigned int cpu, 171static void __init gic_setup_intr(unsigned int intr, unsigned int cpu,
205 unsigned int pin, unsigned int polarity, unsigned int trigtype) 172 unsigned int pin, unsigned int polarity, unsigned int trigtype,
173 unsigned int flags)
206{ 174{
207 /* Setup Intr to Pin mapping */ 175 /* Setup Intr to Pin mapping */
208 if (pin & GIC_MAP_TO_NMI_MSK) { 176 if (pin & GIC_MAP_TO_NMI_MSK) {
@@ -227,38 +195,43 @@ static void __init setup_intr(unsigned int intr, unsigned int cpu,
227 GIC_SET_TRIGGER(intr, trigtype); 195 GIC_SET_TRIGGER(intr, trigtype);
228 196
229 /* Init Intr Masks */ 197 /* Init Intr Masks */
230 GIC_SET_INTR_MASK(intr, 0); 198 GIC_CLR_INTR_MASK(intr);
199 /* Initialise per-cpu Interrupt software masks */
200 if (flags & GIC_FLAG_IPI)
201 set_bit(intr, pcpu_masks[cpu].pcpu_mask);
202 if (flags & GIC_FLAG_TRANSPARENT)
203 GIC_SET_INTR_MASK(intr);
204 if (trigtype == GIC_TRIG_EDGE)
205 gic_irq_flags[intr] |= GIC_IRQ_FLAG_EDGE;
231} 206}
232 207
233static void __init gic_basic_init(void) 208static void __init gic_basic_init(int numintrs, int numvpes,
209 struct gic_intr_map *intrmap, int mapsize)
234{ 210{
235 unsigned int i, cpu; 211 unsigned int i, cpu;
236 212
237 /* Setup defaults */ 213 /* Setup defaults */
238 for (i = 0; i < GIC_NUM_INTRS; i++) { 214 for (i = 0; i < numintrs; i++) {
239 GIC_SET_POLARITY(i, GIC_POL_POS); 215 GIC_SET_POLARITY(i, GIC_POL_POS);
240 GIC_SET_TRIGGER(i, GIC_TRIG_LEVEL); 216 GIC_SET_TRIGGER(i, GIC_TRIG_LEVEL);
241 GIC_SET_INTR_MASK(i, 0); 217 GIC_CLR_INTR_MASK(i);
218 if (i < GIC_NUM_INTRS)
219 gic_irq_flags[i] = 0;
242 } 220 }
243 221
244 /* Setup specifics */ 222 /* Setup specifics */
245 for (i = 0; i < _mapsize; i++) { 223 for (i = 0; i < mapsize; i++) {
246 cpu = _intrmap[i].cpunum; 224 cpu = intrmap[i].cpunum;
247 if (cpu == X) 225 if (cpu == X)
248 continue; 226 continue;
249 227 if (cpu == 0 && i != 0 && intrmap[i].flags == 0)
250 if (cpu == 0 && i != 0 && _intrmap[i].intrnum == 0 &&
251 _intrmap[i].ipiflag == 0)
252 continue; 228 continue;
253 229 gic_setup_intr(i,
254 setup_intr(_intrmap[i].intrnum, 230 intrmap[i].cpunum,
255 _intrmap[i].cpunum, 231 intrmap[i].pin,
256 _intrmap[i].pin, 232 intrmap[i].polarity,
257 _intrmap[i].polarity, 233 intrmap[i].trigtype,
258 _intrmap[i].trigtype); 234 intrmap[i].flags);
259 /* Initialise per-cpu Interrupt software masks */
260 if (_intrmap[i].ipiflag)
261 set_bit(_intrmap[i].intrnum, pcpu_masks[cpu].pcpu_mask);
262 } 235 }
263 236
264 vpe_local_setup(numvpes); 237 vpe_local_setup(numvpes);
@@ -273,12 +246,11 @@ void __init gic_init(unsigned long gic_base_addr,
273 unsigned int irqbase) 246 unsigned int irqbase)
274{ 247{
275 unsigned int gicconfig; 248 unsigned int gicconfig;
249 int numvpes, numintrs;
276 250
277 _gic_base = (unsigned long) ioremap_nocache(gic_base_addr, 251 _gic_base = (unsigned long) ioremap_nocache(gic_base_addr,
278 gic_addrspace_size); 252 gic_addrspace_size);
279 _irqbase = irqbase; 253 _irqbase = irqbase;
280 _intrmap = intr_map;
281 _mapsize = intr_map_size;
282 254
283 GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), gicconfig); 255 GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), gicconfig);
284 numintrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >> 256 numintrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>
@@ -290,5 +262,5 @@ void __init gic_init(unsigned long gic_base_addr,
290 262
291 pr_debug("%s called\n", __func__); 263 pr_debug("%s called\n", __func__);
292 264
293 gic_basic_init(); 265 gic_basic_init(numintrs, numvpes, intr_map, intr_map_size);
294} 266}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 6242bc68add7..b77fefaff9da 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -428,3 +428,9 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
428 return do_fork(clone_flags, newsp, &regs, 0, 428 return do_fork(clone_flags, newsp, &regs, 0,
429 parent_tidptr, child_tidptr); 429 parent_tidptr, child_tidptr);
430} 430}
431
432asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
433 size_t len)
434{
435 return sys_lookup_dcookie(merge_64(a0, a1), buf, len);
436}
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 9bbf9775e0bd..14dde4ca932e 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -450,7 +450,7 @@ sys_call_table:
450 PTR sys_io_submit 450 PTR sys_io_submit
451 PTR sys_io_cancel /* 4245 */ 451 PTR sys_io_cancel /* 4245 */
452 PTR sys_exit_group 452 PTR sys_exit_group
453 PTR sys_lookup_dcookie 453 PTR sys32_lookup_dcookie
454 PTR sys_epoll_create 454 PTR sys_epoll_create
455 PTR sys_epoll_ctl 455 PTR sys_epoll_ctl
456 PTR sys_epoll_wait /* 4250 */ 456 PTR sys_epoll_wait /* 4250 */
@@ -505,7 +505,7 @@ sys_call_table:
505 PTR sys_fchmodat 505 PTR sys_fchmodat
506 PTR sys_faccessat /* 4300 */ 506 PTR sys_faccessat /* 4300 */
507 PTR compat_sys_pselect6 507 PTR compat_sys_pselect6
508 PTR sys_ppoll 508 PTR compat_sys_ppoll
509 PTR sys_unshare 509 PTR sys_unshare
510 PTR sys_splice 510 PTR sys_splice
511 PTR sys32_sync_file_range /* 4305 */ 511 PTR sys32_sync_file_range /* 4305 */
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 4d181df44a40..24630fd8ef60 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -75,7 +75,6 @@ unsigned long irq_hwmask[NR_IRQS];
75 75
76asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; 76asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
77 77
78
79/* 78/*
80 * Number of InterProcessor Interrupt (IPI) message buffers to allocate 79 * Number of InterProcessor Interrupt (IPI) message buffers to allocate
81 */ 80 */
@@ -388,6 +387,7 @@ void smtc_prepare_cpus(int cpus)
388 IPIQ[i].head = IPIQ[i].tail = NULL; 387 IPIQ[i].head = IPIQ[i].tail = NULL;
389 spin_lock_init(&IPIQ[i].lock); 388 spin_lock_init(&IPIQ[i].lock);
390 IPIQ[i].depth = 0; 389 IPIQ[i].depth = 0;
390 IPIQ[i].resched_flag = 0; /* No reschedules queued initially */
391 } 391 }
392 392
393 /* cpu_data index starts at zero */ 393 /* cpu_data index starts at zero */
@@ -741,11 +741,24 @@ void smtc_forward_irq(unsigned int irq)
741static void smtc_ipi_qdump(void) 741static void smtc_ipi_qdump(void)
742{ 742{
743 int i; 743 int i;
744 struct smtc_ipi *temp;
744 745
745 for (i = 0; i < NR_CPUS ;i++) { 746 for (i = 0; i < NR_CPUS ;i++) {
746 printk("IPIQ[%d]: head = 0x%x, tail = 0x%x, depth = %d\n", 747 pr_info("IPIQ[%d]: head = 0x%x, tail = 0x%x, depth = %d\n",
747 i, (unsigned)IPIQ[i].head, (unsigned)IPIQ[i].tail, 748 i, (unsigned)IPIQ[i].head, (unsigned)IPIQ[i].tail,
748 IPIQ[i].depth); 749 IPIQ[i].depth);
750 temp = IPIQ[i].head;
751
752 while (temp != IPIQ[i].tail) {
753 pr_debug("%d %d %d: ", temp->type, temp->dest,
754 (int)temp->arg);
755#ifdef SMTC_IPI_DEBUG
756 pr_debug("%u %lu\n", temp->sender, temp->stamp);
757#else
758 pr_debug("\n");
759#endif
760 temp = temp->flink;
761 }
749 } 762 }
750} 763}
751 764
@@ -784,11 +797,16 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
784 int mtflags; 797 int mtflags;
785 unsigned long tcrestart; 798 unsigned long tcrestart;
786 extern void r4k_wait_irqoff(void), __pastwait(void); 799 extern void r4k_wait_irqoff(void), __pastwait(void);
800 int set_resched_flag = (type == LINUX_SMP_IPI &&
801 action == SMP_RESCHEDULE_YOURSELF);
787 802
788 if (cpu == smp_processor_id()) { 803 if (cpu == smp_processor_id()) {
789 printk("Cannot Send IPI to self!\n"); 804 printk("Cannot Send IPI to self!\n");
790 return; 805 return;
791 } 806 }
807 if (set_resched_flag && IPIQ[cpu].resched_flag != 0)
808 return; /* There is a reschedule queued already */
809
792 /* Set up a descriptor, to be delivered either promptly or queued */ 810 /* Set up a descriptor, to be delivered either promptly or queued */
793 pipi = smtc_ipi_dq(&freeIPIq); 811 pipi = smtc_ipi_dq(&freeIPIq);
794 if (pipi == NULL) { 812 if (pipi == NULL) {
@@ -801,6 +819,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
801 pipi->dest = cpu; 819 pipi->dest = cpu;
802 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) { 820 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
803 /* If not on same VPE, enqueue and send cross-VPE interrupt */ 821 /* If not on same VPE, enqueue and send cross-VPE interrupt */
822 IPIQ[cpu].resched_flag |= set_resched_flag;
804 smtc_ipi_nq(&IPIQ[cpu], pipi); 823 smtc_ipi_nq(&IPIQ[cpu], pipi);
805 LOCK_CORE_PRA(); 824 LOCK_CORE_PRA();
806 settc(cpu_data[cpu].tc_id); 825 settc(cpu_data[cpu].tc_id);
@@ -847,6 +866,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
847 */ 866 */
848 write_tc_c0_tchalt(0); 867 write_tc_c0_tchalt(0);
849 UNLOCK_CORE_PRA(); 868 UNLOCK_CORE_PRA();
869 IPIQ[cpu].resched_flag |= set_resched_flag;
850 smtc_ipi_nq(&IPIQ[cpu], pipi); 870 smtc_ipi_nq(&IPIQ[cpu], pipi);
851 } else { 871 } else {
852postdirect: 872postdirect:
@@ -996,12 +1016,15 @@ void deferred_smtc_ipi(void)
996 * already enabled. 1016 * already enabled.
997 */ 1017 */
998 local_irq_save(flags); 1018 local_irq_save(flags);
999
1000 spin_lock(&q->lock); 1019 spin_lock(&q->lock);
1001 pipi = __smtc_ipi_dq(q); 1020 pipi = __smtc_ipi_dq(q);
1002 spin_unlock(&q->lock); 1021 spin_unlock(&q->lock);
1003 if (pipi != NULL) 1022 if (pipi != NULL) {
1023 if (pipi->type == LINUX_SMP_IPI &&
1024 (int)pipi->arg == SMP_RESCHEDULE_YOURSELF)
1025 IPIQ[cpu].resched_flag = 0;
1004 ipi_decode(pipi); 1026 ipi_decode(pipi);
1027 }
1005 /* 1028 /*
1006 * The use of the __raw_local restore isn't 1029 * The use of the __raw_local restore isn't
1007 * as obviously necessary here as in smtc_ipi_replay(), 1030 * as obviously necessary here as in smtc_ipi_replay(),
@@ -1082,6 +1105,9 @@ static irqreturn_t ipi_interrupt(int irq, void *dev_idm)
1082 * with interrupts off 1105 * with interrupts off
1083 */ 1106 */
1084 local_irq_save(flags); 1107 local_irq_save(flags);
1108 if (pipi->type == LINUX_SMP_IPI &&
1109 (int)pipi->arg == SMP_RESCHEDULE_YOURSELF)
1110 IPIQ[cpu].resched_flag = 0;
1085 ipi_decode(pipi); 1111 ipi_decode(pipi);
1086 local_irq_restore(flags); 1112 local_irq_restore(flags);
1087 } 1113 }
diff --git a/arch/mips/kernel/spram.c b/arch/mips/kernel/spram.c
index 6ddb507a87ef..1821d12a6410 100644
--- a/arch/mips/kernel/spram.c
+++ b/arch/mips/kernel/spram.c
@@ -13,7 +13,6 @@
13#include <linux/ptrace.h> 13#include <linux/ptrace.h>
14#include <linux/stddef.h> 14#include <linux/stddef.h>
15 15
16#include <asm/cpu.h>
17#include <asm/fpu.h> 16#include <asm/fpu.h>
18#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
19#include <asm/system.h> 18#include <asm/system.h>
@@ -198,8 +197,7 @@ static __cpuinit void probe_spram(char *type,
198 offset += 2 * SPRAM_TAG_STRIDE; 197 offset += 2 * SPRAM_TAG_STRIDE;
199 } 198 }
200} 199}
201 200void __cpuinit spram_config(void)
202__cpuinit void spram_config(void)
203{ 201{
204 struct cpuinfo_mips *c = &current_cpu_data; 202 struct cpuinfo_mips *c = &current_cpu_data;
205 unsigned int config0; 203 unsigned int config0;
@@ -208,6 +206,7 @@ __cpuinit void spram_config(void)
208 case CPU_24K: 206 case CPU_24K:
209 case CPU_34K: 207 case CPU_34K:
210 case CPU_74K: 208 case CPU_74K:
209 case CPU_1004K:
211 config0 = read_c0_config(); 210 config0 = read_c0_config();
212 /* FIXME: addresses are Malta specific */ 211 /* FIXME: addresses are Malta specific */
213 if (config0 & (1<<24)) { 212 if (config0 & (1<<24)) {
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 03092ab2a296..60477529362e 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1116,8 +1116,6 @@ static int vpe_open(struct inode *inode, struct file *filp)
1116 v->shared_ptr = NULL; 1116 v->shared_ptr = NULL;
1117 v->__start = 0; 1117 v->__start = 0;
1118 1118
1119 unlock_kernel();
1120
1121 return 0; 1119 return 0;
1122} 1120}
1123 1121
diff --git a/arch/mips/loongson/common/irq.c b/arch/mips/loongson/common/irq.c
index f368c735cbd3..b32b4a3e5137 100644
--- a/arch/mips/loongson/common/irq.c
+++ b/arch/mips/loongson/common/irq.c
@@ -55,7 +55,6 @@ void __init arch_init_irq(void)
55 * int-handler is not on bootstrap 55 * int-handler is not on bootstrap
56 */ 56 */
57 clear_c0_status(ST0_IM | ST0_BEV); 57 clear_c0_status(ST0_IM | ST0_BEV);
58 local_irq_disable();
59 58
60 /* setting irq trigger mode */ 59 /* setting irq trigger mode */
61 set_irq_trigger_mode(); 60 set_irq_trigger_mode();
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c
index 1c555e6c6a9f..d9ae1dbabda7 100644
--- a/arch/mips/math-emu/dp_simple.c
+++ b/arch/mips/math-emu/dp_simple.c
@@ -62,8 +62,6 @@ ieee754dp ieee754dp_neg(ieee754dp x)
62 return ieee754dp_nanxcpt(y, "neg"); 62 return ieee754dp_nanxcpt(y, "neg");
63 } 63 }
64 64
65 if (ieee754dp_isnan(x)) /* but not infinity */
66 return ieee754dp_nanxcpt(x, "neg", x);
67 return x; 65 return x;
68} 66}
69 67
@@ -76,15 +74,12 @@ ieee754dp ieee754dp_abs(ieee754dp x)
76 CLEARCX; 74 CLEARCX;
77 FLUSHXDP; 75 FLUSHXDP;
78 76
77 /* Clear sign ALWAYS, irrespective of NaN */
78 DPSIGN(x) = 0;
79
79 if (xc == IEEE754_CLASS_SNAN) { 80 if (xc == IEEE754_CLASS_SNAN) {
80 SETCX(IEEE754_INVALID_OPERATION); 81 return ieee754dp_nanxcpt(ieee754dp_indef(), "abs");
81 return ieee754dp_nanxcpt(ieee754dp_indef(), "neg");
82 } 82 }
83 83
84 if (ieee754dp_isnan(x)) /* but not infinity */
85 return ieee754dp_nanxcpt(x, "abs", x);
86
87 /* quick fix up */
88 DPSIGN(x) = 0;
89 return x; 84 return x;
90} 85}
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index 770f0f4677cd..3175477d36f6 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.c
@@ -62,8 +62,6 @@ ieee754sp ieee754sp_neg(ieee754sp x)
62 return ieee754sp_nanxcpt(y, "neg"); 62 return ieee754sp_nanxcpt(y, "neg");
63 } 63 }
64 64
65 if (ieee754sp_isnan(x)) /* but not infinity */
66 return ieee754sp_nanxcpt(x, "neg", x);
67 return x; 65 return x;
68} 66}
69 67
@@ -76,15 +74,12 @@ ieee754sp ieee754sp_abs(ieee754sp x)
76 CLEARCX; 74 CLEARCX;
77 FLUSHXSP; 75 FLUSHXSP;
78 76
77 /* Clear sign ALWAYS, irrespective of NaN */
78 SPSIGN(x) = 0;
79
79 if (xc == IEEE754_CLASS_SNAN) { 80 if (xc == IEEE754_CLASS_SNAN) {
80 SETCX(IEEE754_INVALID_OPERATION);
81 return ieee754sp_nanxcpt(ieee754sp_indef(), "abs"); 81 return ieee754sp_nanxcpt(ieee754sp_indef(), "abs");
82 } 82 }
83 83
84 if (ieee754sp_isnan(x)) /* but not infinity */
85 return ieee754sp_nanxcpt(x, "abs", x);
86
87 /* quick fix up */
88 SPSIGN(x) = 0;
89 return x; 84 return x;
90} 85}
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 15aa1902a788..8d1f4f363049 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -27,6 +27,7 @@
27#include <linux/swap.h> 27#include <linux/swap.h>
28#include <linux/proc_fs.h> 28#include <linux/proc_fs.h>
29#include <linux/pfn.h> 29#include <linux/pfn.h>
30#include <linux/hardirq.h>
30 31
31#include <asm/asm-offsets.h> 32#include <asm/asm-offsets.h>
32#include <asm/bootinfo.h> 33#include <asm/bootinfo.h>
@@ -132,7 +133,10 @@ void *kmap_coherent(struct page *page, unsigned long addr)
132 inc_preempt_count(); 133 inc_preempt_count();
133 idx = (addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1); 134 idx = (addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1);
134#ifdef CONFIG_MIPS_MT_SMTC 135#ifdef CONFIG_MIPS_MT_SMTC
135 idx += FIX_N_COLOURS * smp_processor_id(); 136 idx += FIX_N_COLOURS * smp_processor_id() +
137 (in_interrupt() ? (FIX_N_COLOURS * NR_CPUS) : 0);
138#else
139 idx += in_interrupt() ? FIX_N_COLOURS : 0;
136#endif 140#endif
137 vaddr = __fix_to_virt(FIX_CMAP_END - idx); 141 vaddr = __fix_to_virt(FIX_CMAP_END - idx);
138 pte = mk_pte(page, PAGE_KERNEL); 142 pte = mk_pte(page, PAGE_KERNEL);
diff --git a/arch/mips/mti-malta/malta-amon.c b/arch/mips/mti-malta/malta-amon.c
index df9e526312a2..469d9b0cee6d 100644
--- a/arch/mips/mti-malta/malta-amon.c
+++ b/arch/mips/mti-malta/malta-amon.c
@@ -70,11 +70,12 @@ void amon_cpu_start(int cpu,
70 launch->sp = sp; 70 launch->sp = sp;
71 launch->a0 = a0; 71 launch->a0 = a0;
72 72
73 /* Make sure target sees parameters before the go bit */ 73 smp_wmb(); /* Target must see parameters before go */
74 smp_mb();
75
76 launch->flags |= LAUNCH_FGO; 74 launch->flags |= LAUNCH_FGO;
75 smp_wmb(); /* Target must see go before we poll */
76
77 while ((launch->flags & LAUNCH_FGONE) == 0) 77 while ((launch->flags & LAUNCH_FGONE) == 0)
78 ; 78 ;
79 smp_rmb(); /* Target will be updating flags soon */
79 pr_debug("launch: cpu%d gone!\n", cpu); 80 pr_debug("launch: cpu%d gone!\n", cpu);
80} 81}
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 3e0a9b35ba5c..4c3fca18a171 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -87,7 +87,7 @@ static inline int mips_pcibios_iack(void)
87 dummy = BONITO_PCIMAP_CFG; 87 dummy = BONITO_PCIMAP_CFG;
88 iob(); /* sync */ 88 iob(); /* sync */
89 89
90 irq = readl((u32 *)_pcictrl_bonito_pcicfg); 90 irq = __raw_readl((u32 *)_pcictrl_bonito_pcicfg);
91 iob(); /* sync */ 91 iob(); /* sync */
92 irq &= 0xff; 92 irq &= 0xff;
93 BONITO_PCIMAP_CFG = 0; 93 BONITO_PCIMAP_CFG = 0;
@@ -379,38 +379,43 @@ static msc_irqmap_t __initdata msc_eicirqmap[] = {
379 379
380static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap); 380static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
381 381
382#if defined(CONFIG_MIPS_MT_SMP)
383/* 382/*
384 * This GIC specific tabular array defines the association between External 383 * This GIC specific tabular array defines the association between External
385 * Interrupts and CPUs/Core Interrupts. The nature of the External 384 * Interrupts and CPUs/Core Interrupts. The nature of the External
386 * Interrupts is also defined here - polarity/trigger. 385 * Interrupts is also defined here - polarity/trigger.
387 */ 386 */
387
388#define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
388static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = { 389static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
389 { GIC_EXT_INTR(0), X, X, X, X, 0 }, 390 { X, X, X, X, 0 },
390 { GIC_EXT_INTR(1), X, X, X, X, 0 }, 391 { X, X, X, X, 0 },
391 { GIC_EXT_INTR(2), X, X, X, X, 0 }, 392 { X, X, X, X, 0 },
392 { GIC_EXT_INTR(3), 0, GIC_CPU_INT0, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 393 { 0, GIC_CPU_INT0, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
393 { GIC_EXT_INTR(4), 0, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 394 { 0, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
394 { GIC_EXT_INTR(5), 0, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 395 { 0, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
395 { GIC_EXT_INTR(6), 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 396 { 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
396 { GIC_EXT_INTR(7), 0, GIC_CPU_INT4, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 397 { 0, GIC_CPU_INT4, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
397 { GIC_EXT_INTR(8), 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 398 { 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
398 { GIC_EXT_INTR(9), 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 399 { 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
399 { GIC_EXT_INTR(10), X, X, X, X, 0 }, 400 { X, X, X, X, 0 },
400 { GIC_EXT_INTR(11), X, X, X, X, 0 }, 401 { X, X, X, X, 0 },
401 { GIC_EXT_INTR(12), 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 402 { 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
402 { GIC_EXT_INTR(13), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 403 { 0, GIC_CPU_NMI, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
403 { GIC_EXT_INTR(14), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, 404 { 0, GIC_CPU_NMI, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },
404 { GIC_EXT_INTR(15), X, X, X, X, 0 }, 405 { X, X, X, X, 0 },
405/* This is the end of the general interrupts now we do IPI ones */ 406 /* The remainder of this table is initialised by fill_ipi_map */
406}; 407};
407#endif
408 408
409/* 409/*
410 * GCMP needs to be detected before any SMP initialisation 410 * GCMP needs to be detected before any SMP initialisation
411 */ 411 */
412int __init gcmp_probe(unsigned long addr, unsigned long size) 412int __init gcmp_probe(unsigned long addr, unsigned long size)
413{ 413{
414 if (mips_revision_sconid != MIPS_REVISION_SCON_ROCIT) {
415 gcmp_present = 0;
416 return gcmp_present;
417 }
418
414 if (gcmp_present >= 0) 419 if (gcmp_present >= 0)
415 return gcmp_present; 420 return gcmp_present;
416 421
@@ -419,20 +424,35 @@ int __init gcmp_probe(unsigned long addr, unsigned long size)
419 gcmp_present = (GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) == GCMP_BASE_ADDR; 424 gcmp_present = (GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) == GCMP_BASE_ADDR;
420 425
421 if (gcmp_present) 426 if (gcmp_present)
422 printk(KERN_DEBUG "GCMP present\n"); 427 pr_debug("GCMP present\n");
423 return gcmp_present; 428 return gcmp_present;
424} 429}
425 430
431/* Return the number of IOCU's present */
432int __init gcmp_niocu(void)
433{
434 return gcmp_present ?
435 (GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >> GCMP_GCB_GC_NUMIOCU_SHF :
436 0;
437}
438
439/* Set GCMP region attributes */
440void __init gcmp_setregion(int region, unsigned long base,
441 unsigned long mask, int type)
442{
443 GCMPGCBn(CMxBASE, region) = base;
444 GCMPGCBn(CMxMASK, region) = mask | type;
445}
446
426#if defined(CONFIG_MIPS_MT_SMP) 447#if defined(CONFIG_MIPS_MT_SMP)
427static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin) 448static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin)
428{ 449{
429 int intr = baseintr + cpu; 450 int intr = baseintr + cpu;
430 gic_intr_map[intr].intrnum = GIC_EXT_INTR(intr);
431 gic_intr_map[intr].cpunum = cpu; 451 gic_intr_map[intr].cpunum = cpu;
432 gic_intr_map[intr].pin = cpupin; 452 gic_intr_map[intr].pin = cpupin;
433 gic_intr_map[intr].polarity = GIC_POL_POS; 453 gic_intr_map[intr].polarity = GIC_POL_POS;
434 gic_intr_map[intr].trigtype = GIC_TRIG_EDGE; 454 gic_intr_map[intr].trigtype = GIC_TRIG_EDGE;
435 gic_intr_map[intr].ipiflag = 1; 455 gic_intr_map[intr].flags = GIC_FLAG_IPI;
436 ipi_map[cpu] |= (1 << (cpupin + 2)); 456 ipi_map[cpu] |= (1 << (cpupin + 2));
437} 457}
438 458
@@ -447,6 +467,12 @@ static void __init fill_ipi_map(void)
447} 467}
448#endif 468#endif
449 469
470void __init arch_init_ipiirq(int irq, struct irqaction *action)
471{
472 setup_irq(irq, action);
473 set_irq_handler(irq, handle_percpu_irq);
474}
475
450void __init arch_init_irq(void) 476void __init arch_init_irq(void)
451{ 477{
452 init_i8259_irqs(); 478 init_i8259_irqs();
@@ -458,12 +484,17 @@ void __init arch_init_irq(void)
458 GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; 484 GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK;
459 gic_present = 1; 485 gic_present = 1;
460 } else { 486 } else {
461 _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE, MSC01_BIU_ADDRSPACE_SZ); 487 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) {
462 gic_present = (REG(_msc01_biu_base, MSC01_SC_CFG) & 488 _msc01_biu_base = (unsigned long)
463 MSC01_SC_CFG_GICPRES_MSK) >> MSC01_SC_CFG_GICPRES_SHF; 489 ioremap_nocache(MSC01_BIU_REG_BASE,
490 MSC01_BIU_ADDRSPACE_SZ);
491 gic_present = (REG(_msc01_biu_base, MSC01_SC_CFG) &
492 MSC01_SC_CFG_GICPRES_MSK) >>
493 MSC01_SC_CFG_GICPRES_SHF;
494 }
464 } 495 }
465 if (gic_present) 496 if (gic_present)
466 printk(KERN_DEBUG "GIC present\n"); 497 pr_debug("GIC present\n");
467 498
468 switch (mips_revision_sconid) { 499 switch (mips_revision_sconid) {
469 case MIPS_REVISION_SCON_SOCIT: 500 case MIPS_REVISION_SCON_SOCIT:
@@ -526,16 +557,16 @@ void __init arch_init_irq(void)
526 &corehi_irqaction); 557 &corehi_irqaction);
527 } 558 }
528 559
529#if defined(CONFIG_MIPS_MT_SMP)
530 if (gic_present) { 560 if (gic_present) {
531 /* FIXME */ 561 /* FIXME */
532 int i; 562 int i;
533 563#if defined(CONFIG_MIPS_MT_SMP)
534 gic_call_int_base = GIC_NUM_INTRS - NR_CPUS; 564 gic_call_int_base = GIC_NUM_INTRS - NR_CPUS;
535 gic_resched_int_base = gic_call_int_base - NR_CPUS; 565 gic_resched_int_base = gic_call_int_base - NR_CPUS;
536
537 fill_ipi_map(); 566 fill_ipi_map();
538 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); 567#endif
568 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map,
569 ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE);
539 if (!gcmp_present) { 570 if (!gcmp_present) {
540 /* Enable the GIC */ 571 /* Enable the GIC */
541 i = REG(_msc01_biu_base, MSC01_SC_CFG); 572 i = REG(_msc01_biu_base, MSC01_SC_CFG);
@@ -543,7 +574,7 @@ void __init arch_init_irq(void)
543 (i | (0x1 << MSC01_SC_CFG_GICENA_SHF)); 574 (i | (0x1 << MSC01_SC_CFG_GICENA_SHF));
544 pr_debug("GIC Enabled\n"); 575 pr_debug("GIC Enabled\n");
545 } 576 }
546 577#if defined(CONFIG_MIPS_MT_SMP)
547 /* set up ipi interrupts */ 578 /* set up ipi interrupts */
548 if (cpu_has_vint) { 579 if (cpu_has_vint) {
549 set_vi_handler(MIPSCPU_INT_IPI0, malta_ipi_irqdispatch); 580 set_vi_handler(MIPSCPU_INT_IPI0, malta_ipi_irqdispatch);
@@ -556,16 +587,14 @@ void __init arch_init_irq(void)
556 write_c0_status(0x1100dc00); 587 write_c0_status(0x1100dc00);
557 printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); 588 printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status());
558 for (i = 0; i < NR_CPUS; i++) { 589 for (i = 0; i < NR_CPUS; i++) {
559 setup_irq(MIPS_GIC_IRQ_BASE + 590 arch_init_ipiirq(MIPS_GIC_IRQ_BASE +
560 GIC_RESCHED_INT(i), &irq_resched); 591 GIC_RESCHED_INT(i), &irq_resched);
561 setup_irq(MIPS_GIC_IRQ_BASE + 592 arch_init_ipiirq(MIPS_GIC_IRQ_BASE +
562 GIC_CALL_INT(i), &irq_call); 593 GIC_CALL_INT(i), &irq_call);
563 set_irq_handler(MIPS_GIC_IRQ_BASE +
564 GIC_RESCHED_INT(i), handle_percpu_irq);
565 set_irq_handler(MIPS_GIC_IRQ_BASE +
566 GIC_CALL_INT(i), handle_percpu_irq);
567 } 594 }
595#endif
568 } else { 596 } else {
597#if defined(CONFIG_MIPS_MT_SMP)
569 /* set up ipi interrupts */ 598 /* set up ipi interrupts */
570 if (cpu_has_veic) { 599 if (cpu_has_veic) {
571 set_vi_handler (MSC01E_INT_SW0, ipi_resched_dispatch); 600 set_vi_handler (MSC01E_INT_SW0, ipi_resched_dispatch);
@@ -580,14 +609,10 @@ void __init arch_init_irq(void)
580 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ; 609 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ;
581 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ; 610 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ;
582 } 611 }
583 612 arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched);
584 setup_irq(cpu_ipi_resched_irq, &irq_resched); 613 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call);
585 setup_irq(cpu_ipi_call_irq, &irq_call);
586
587 set_irq_handler(cpu_ipi_resched_irq, handle_percpu_irq);
588 set_irq_handler(cpu_ipi_call_irq, handle_percpu_irq);
589 }
590#endif 614#endif
615 }
591} 616}
592 617
593void malta_be_init(void) 618void malta_be_init(void)
diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c
index b9743190609a..2fbfa1a8c3a9 100644
--- a/arch/mips/mti-malta/malta-pci.c
+++ b/arch/mips/mti-malta/malta-pci.c
@@ -27,7 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28 28
29#include <asm/gt64120.h> 29#include <asm/gt64120.h>
30 30#include <asm/gcmpregs.h>
31#include <asm/mips-boards/generic.h> 31#include <asm/mips-boards/generic.h>
32#include <asm/mips-boards/bonito64.h> 32#include <asm/mips-boards/bonito64.h>
33#include <asm/mips-boards/msc01_pci.h> 33#include <asm/mips-boards/msc01_pci.h>
@@ -201,7 +201,11 @@ void __init mips_pcibios_init(void)
201 msc_mem_resource.start = start & mask; 201 msc_mem_resource.start = start & mask;
202 msc_mem_resource.end = (start & mask) | ~mask; 202 msc_mem_resource.end = (start & mask) | ~mask;
203 msc_controller.mem_offset = (start & mask) - (map & mask); 203 msc_controller.mem_offset = (start & mask) - (map & mask);
204 204#ifdef CONFIG_MIPS_CMP
205 if (gcmp_niocu())
206 gcmp_setregion(0, start, mask,
207 GCMP_GCB_GCMPB_CMDEFTGT_IOCU1);
208#endif
205 MSC_READ(MSC01_PCI_SC2PIOBASL, start); 209 MSC_READ(MSC01_PCI_SC2PIOBASL, start);
206 MSC_READ(MSC01_PCI_SC2PIOMSKL, mask); 210 MSC_READ(MSC01_PCI_SC2PIOMSKL, mask);
207 MSC_READ(MSC01_PCI_SC2PIOMAPL, map); 211 MSC_READ(MSC01_PCI_SC2PIOMAPL, map);
@@ -209,7 +213,11 @@ void __init mips_pcibios_init(void)
209 msc_io_resource.end = (map & mask) | ~mask; 213 msc_io_resource.end = (map & mask) | ~mask;
210 msc_controller.io_offset = 0; 214 msc_controller.io_offset = 0;
211 ioport_resource.end = ~mask; 215 ioport_resource.end = ~mask;
212 216#ifdef CONFIG_MIPS_CMP
217 if (gcmp_niocu())
218 gcmp_setregion(1, start, mask,
219 GCMP_GCB_GCMPB_CMDEFTGT_IOCU1);
220#endif
213 /* If ranges overlap I/O takes precedence. */ 221 /* If ranges overlap I/O takes precedence. */
214 start = start & mask; 222 start = start & mask;
215 end = start | ~mask; 223 end = start | ~mask;
@@ -241,3 +249,16 @@ void __init mips_pcibios_init(void)
241 249
242 register_pci_controller(controller); 250 register_pci_controller(controller);
243} 251}
252
253/* Enable PCI 2.1 compatibility in PIIX4 */
254static void __init quirk_dlcsetup(struct pci_dev *dev)
255{
256 u8 odlc, ndlc;
257 (void) pci_read_config_byte(dev, 0x82, &odlc);
258 /* Enable passive releases and delayed transaction */
259 ndlc = odlc | 7;
260 (void) pci_write_config_byte(dev, 0x82, ndlc);
261}
262
263DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
264 quirk_dlcsetup);
diff --git a/arch/mips/nxp/pnx8550/common/int.c b/arch/mips/nxp/pnx8550/common/int.c
index f080f114a1bf..7aca7d5375e5 100644
--- a/arch/mips/nxp/pnx8550/common/int.c
+++ b/arch/mips/nxp/pnx8550/common/int.c
@@ -172,7 +172,7 @@ static struct irqaction gic_action = {
172 172
173static struct irqaction timer_action = { 173static struct irqaction timer_action = {
174 .handler = no_action, 174 .handler = no_action,
175 .flags = IRQF_DISABLED, 175 .flags = IRQF_DISABLED | IRQF_TIMER,
176 .name = "Timer", 176 .name = "Timer",
177}; 177};
178 178
diff --git a/arch/mips/nxp/pnx8550/common/time.c b/arch/mips/nxp/pnx8550/common/time.c
index 18b192784877..8836c6203df0 100644
--- a/arch/mips/nxp/pnx8550/common/time.c
+++ b/arch/mips/nxp/pnx8550/common/time.c
@@ -59,7 +59,7 @@ static irqreturn_t pnx8xxx_timer_interrupt(int irq, void *dev_id)
59 59
60static struct irqaction pnx8xxx_timer_irq = { 60static struct irqaction pnx8xxx_timer_irq = {
61 .handler = pnx8xxx_timer_interrupt, 61 .handler = pnx8xxx_timer_interrupt,
62 .flags = IRQF_DISABLED | IRQF_PERCPU, 62 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER,
63 .name = "pnx8xxx_timer", 63 .name = "pnx8xxx_timer",
64}; 64};
65 65
@@ -72,7 +72,7 @@ static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
72 72
73static struct irqaction monotonic_irqaction = { 73static struct irqaction monotonic_irqaction = {
74 .handler = monotonic_interrupt, 74 .handler = monotonic_interrupt,
75 .flags = IRQF_DISABLED, 75 .flags = IRQF_DISABLED | IRQF_TIMER,
76 .name = "Monotonic timer", 76 .name = "Monotonic timer",
77}; 77};
78 78
diff --git a/arch/mips/oprofile/op_model_loongson2.c b/arch/mips/oprofile/op_model_loongson2.c
index deed1d5d4982..575cd1473475 100644
--- a/arch/mips/oprofile/op_model_loongson2.c
+++ b/arch/mips/oprofile/op_model_loongson2.c
@@ -22,7 +22,7 @@
22 * otherwise, the oprofile tool will not recognize this and complain about 22 * otherwise, the oprofile tool will not recognize this and complain about
23 * "cpu_type 'unset' is not valid". 23 * "cpu_type 'unset' is not valid".
24 */ 24 */
25#define LOONGSON2_CPU_TYPE "mips/godson2" 25#define LOONGSON2_CPU_TYPE "mips/loongson2"
26 26
27#define LOONGSON2_COUNTER1_EVENT(event) ((event & 0x0f) << 5) 27#define LOONGSON2_COUNTER1_EVENT(event) ((event & 0x0f) << 5)
28#define LOONGSON2_COUNTER2_EVENT(event) ((event & 0x0f) << 9) 28#define LOONGSON2_COUNTER2_EVENT(event) ((event & 0x0f) << 9)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 6d0e59ffba2e..d6802d6d1f82 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -105,7 +105,7 @@ static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
105 105
106struct irqaction hub_rt_irqaction = { 106struct irqaction hub_rt_irqaction = {
107 .handler = hub_rt_counter_handler, 107 .handler = hub_rt_counter_handler,
108 .flags = IRQF_DISABLED | IRQF_PERCPU, 108 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER,
109 .name = "hub-rt", 109 .name = "hub-rt",
110}; 110};
111 111
diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
index 62df6a598e0a..f3b60e671207 100644
--- a/arch/mips/sni/time.c
+++ b/arch/mips/sni/time.c
@@ -67,7 +67,7 @@ static irqreturn_t a20r_interrupt(int irq, void *dev_id)
67 67
68static struct irqaction a20r_irqaction = { 68static struct irqaction a20r_irqaction = {
69 .handler = a20r_interrupt, 69 .handler = a20r_interrupt,
70 .flags = IRQF_DISABLED | IRQF_PERCPU, 70 .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER,
71 .name = "a20r-timer", 71 .name = "a20r-timer",
72}; 72};
73 73
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index c860810722c0..e10184c1b3e1 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -85,7 +85,7 @@ int txx9_ccfg_toeon __initdata = 1;
85struct clk *clk_get(struct device *dev, const char *id) 85struct clk *clk_get(struct device *dev, const char *id)
86{ 86{
87 if (!strcmp(id, "spi-baseclk")) 87 if (!strcmp(id, "spi-baseclk"))
88 return (struct clk *)((unsigned long)txx9_gbus_clock / 2 / 4); 88 return (struct clk *)((unsigned long)txx9_gbus_clock / 2 / 2);
89 if (!strcmp(id, "imbus_clk")) 89 if (!strcmp(id, "imbus_clk"))
90 return (struct clk *)((unsigned long)txx9_gbus_clock / 2); 90 return (struct clk *)((unsigned long)txx9_gbus_clock / 2);
91 return ERR_PTR(-ENOENT); 91 return ERR_PTR(-ENOENT);
@@ -817,7 +817,8 @@ void __init txx9_iocled_init(unsigned long baseaddr,
817out_pdev: 817out_pdev:
818 platform_device_put(pdev); 818 platform_device_put(pdev);
819out_gpio: 819out_gpio:
820 gpio_remove(&iocled->chip); 820 if (gpiochip_remove(&iocled->chip))
821 return;
821out_unmap: 822out_unmap:
822 iounmap(iocled->mmioaddr); 823 iounmap(iocled->mmioaddr);
823out_free: 824out_free:
diff --git a/arch/powerpc/boot/dts/cm5200.dts b/arch/powerpc/boot/dts/cm5200.dts
index cee8080aa245..dd3860846f15 100644
--- a/arch/powerpc/boot/dts/cm5200.dts
+++ b/arch/powerpc/boot/dts/cm5200.dts
@@ -210,7 +210,6 @@
210 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 210 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
211 reg = <0x3d40 0x40>; 211 reg = <0x3d40 0x40>;
212 interrupts = <2 16 0>; 212 interrupts = <2 16 0>;
213 fsl5200-clocking;
214 }; 213 };
215 214
216 sram@8000 { 215 sram@8000 {
diff --git a/arch/powerpc/boot/dts/digsy_mtc.dts b/arch/powerpc/boot/dts/digsy_mtc.dts
index 4c36186ef946..8e9be6bfe23e 100644
--- a/arch/powerpc/boot/dts/digsy_mtc.dts
+++ b/arch/powerpc/boot/dts/digsy_mtc.dts
@@ -199,7 +199,6 @@
199 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 199 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
200 reg = <0x3d00 0x40>; 200 reg = <0x3d00 0x40>;
201 interrupts = <2 15 0>; 201 interrupts = <2 15 0>;
202 fsl5200-clocking;
203 202
204 rtc@50 { 203 rtc@50 {
205 compatible = "at,24c08"; 204 compatible = "at,24c08";
diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
index de30b3f9eb26..82ff2b13bc37 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -247,7 +247,6 @@
247 compatible = "fsl,mpc5200-i2c","fsl-i2c"; 247 compatible = "fsl,mpc5200-i2c","fsl-i2c";
248 reg = <0x3d00 0x40>; 248 reg = <0x3d00 0x40>;
249 interrupts = <2 15 0>; 249 interrupts = <2 15 0>;
250 fsl5200-clocking;
251 }; 250 };
252 251
253 i2c@3d40 { 252 i2c@3d40 {
@@ -256,7 +255,6 @@
256 compatible = "fsl,mpc5200-i2c","fsl-i2c"; 255 compatible = "fsl,mpc5200-i2c","fsl-i2c";
257 reg = <0x3d40 0x40>; 256 reg = <0x3d40 0x40>;
258 interrupts = <2 16 0>; 257 interrupts = <2 16 0>;
259 fsl5200-clocking;
260 }; 258 };
261 sram@8000 { 259 sram@8000 {
262 compatible = "fsl,mpc5200-sram"; 260 compatible = "fsl,mpc5200-sram";
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
index d13cb11ce623..e45a63be3a86 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -251,7 +251,6 @@
251 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 251 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
252 reg = <0x3d00 0x40>; 252 reg = <0x3d00 0x40>;
253 interrupts = <2 15 0>; 253 interrupts = <2 15 0>;
254 fsl5200-clocking;
255 }; 254 };
256 255
257 i2c@3d40 { 256 i2c@3d40 {
@@ -260,7 +259,6 @@
260 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 259 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
261 reg = <0x3d40 0x40>; 260 reg = <0x3d40 0x40>;
262 interrupts = <2 16 0>; 261 interrupts = <2 16 0>;
263 fsl5200-clocking;
264 }; 262 };
265 263
266 sram@8000 { 264 sram@8000 {
diff --git a/arch/powerpc/boot/dts/media5200.dts b/arch/powerpc/boot/dts/media5200.dts
index e297d8b41875..0c3902bc5b6a 100644
--- a/arch/powerpc/boot/dts/media5200.dts
+++ b/arch/powerpc/boot/dts/media5200.dts
@@ -223,7 +223,6 @@
223 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 223 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
224 reg = <0x3d00 0x40>; 224 reg = <0x3d00 0x40>;
225 interrupts = <2 15 0>; 225 interrupts = <2 15 0>;
226 fsl5200-clocking;
227 }; 226 };
228 227
229 i2c@3d40 { 228 i2c@3d40 {
@@ -232,7 +231,6 @@
232 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 231 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
233 reg = <0x3d40 0x40>; 232 reg = <0x3d40 0x40>;
234 interrupts = <2 16 0>; 233 interrupts = <2 16 0>;
235 fsl5200-clocking;
236 }; 234 };
237 235
238 sram@8000 { 236 sram@8000 {
diff --git a/arch/powerpc/boot/dts/motionpro.dts b/arch/powerpc/boot/dts/motionpro.dts
index 7be8ca038676..6ca4fc144a33 100644
--- a/arch/powerpc/boot/dts/motionpro.dts
+++ b/arch/powerpc/boot/dts/motionpro.dts
@@ -222,7 +222,6 @@
222 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 222 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
223 reg = <0x3d40 0x40>; 223 reg = <0x3d40 0x40>;
224 interrupts = <2 16 0>; 224 interrupts = <2 16 0>;
225 fsl5200-clocking;
226 225
227 rtc@68 { 226 rtc@68 {
228 compatible = "dallas,ds1339"; 227 compatible = "dallas,ds1339";
diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
index c2b8dbfab79e..c353dac33416 100644
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -209,7 +209,6 @@
209 reg = <0x1700 0x20>; 209 reg = <0x1700 0x20>;
210 interrupts = <9 0x8>; 210 interrupts = <9 0x8>;
211 interrupt-parent = < &ipic >; 211 interrupt-parent = < &ipic >;
212 fsl5200-clocking;
213 }; 212 };
214 213
215 i2c@1720 { 214 i2c@1720 {
@@ -220,7 +219,6 @@
220 reg = <0x1720 0x20>; 219 reg = <0x1720 0x20>;
221 interrupts = <10 0x8>; 220 interrupts = <10 0x8>;
222 interrupt-parent = < &ipic >; 221 interrupt-parent = < &ipic >;
223 fsl5200-clocking;
224 }; 222 };
225 223
226 i2c@1740 { 224 i2c@1740 {
@@ -231,7 +229,6 @@
231 reg = <0x1740 0x20>; 229 reg = <0x1740 0x20>;
232 interrupts = <11 0x8>; 230 interrupts = <11 0x8>;
233 interrupt-parent = < &ipic >; 231 interrupt-parent = < &ipic >;
234 fsl5200-clocking;
235 }; 232 };
236 233
237 i2ccontrol@1760 { 234 i2ccontrol@1760 {
diff --git a/arch/powerpc/boot/dts/mucmc52.dts b/arch/powerpc/boot/dts/mucmc52.dts
new file mode 100644
index 000000000000..b72a7581d798
--- /dev/null
+++ b/arch/powerpc/boot/dts/mucmc52.dts
@@ -0,0 +1,332 @@
1/*
2 * Manroland mucmc52 board Device Tree Source
3 *
4 * Copyright (C) 2009 DENX Software Engineering GmbH
5 * Heiko Schocher <hs@denx.de>
6 * Copyright 2006-2007 Secret Lab Technologies Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14/dts-v1/;
15
16/ {
17 model = "manroland,mucmc52";
18 compatible = "manroland,mucmc52";
19 #address-cells = <1>;
20 #size-cells = <1>;
21 interrupt-parent = <&mpc5200_pic>;
22
23 cpus {
24 #address-cells = <1>;
25 #size-cells = <0>;
26
27 PowerPC,5200@0 {
28 device_type = "cpu";
29 reg = <0>;
30 d-cache-line-size = <32>;
31 i-cache-line-size = <32>;
32 d-cache-size = <0x4000>; // L1, 16K
33 i-cache-size = <0x4000>; // L1, 16K
34 timebase-frequency = <0>; // from bootloader
35 bus-frequency = <0>; // from bootloader
36 clock-frequency = <0>; // from bootloader
37 };
38 };
39
40 memory {
41 device_type = "memory";
42 reg = <0x00000000 0x04000000>; // 64MB
43 };
44
45 soc5200@f0000000 {
46 #address-cells = <1>;
47 #size-cells = <1>;
48 compatible = "fsl,mpc5200b-immr";
49 ranges = <0 0xf0000000 0x0000c000>;
50 reg = <0xf0000000 0x00000100>;
51 bus-frequency = <0>; // from bootloader
52 system-frequency = <0>; // from bootloader
53
54 cdm@200 {
55 compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm";
56 reg = <0x200 0x38>;
57 };
58
59 mpc5200_pic: interrupt-controller@500 {
60 // 5200 interrupts are encoded into two levels;
61 interrupt-controller;
62 #interrupt-cells = <3>;
63 compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic";
64 reg = <0x500 0x80>;
65 };
66
67 gpt0: timer@600 { // GPT 0 in GPIO mode
68 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
69 reg = <0x600 0x10>;
70 interrupts = <1 9 0>;
71 gpio-controller;
72 #gpio-cells = <2>;
73 };
74
75 gpt1: timer@610 { // General Purpose Timer in GPIO mode
76 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
77 reg = <0x610 0x10>;
78 interrupts = <1 10 0>;
79 gpio-controller;
80 #gpio-cells = <2>;
81 };
82
83 gpt2: timer@620 { // General Purpose Timer in GPIO mode
84 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
85 reg = <0x620 0x10>;
86 interrupts = <1 11 0>;
87 gpio-controller;
88 #gpio-cells = <2>;
89 };
90
91 gpt3: timer@630 { // General Purpose Timer in GPIO mode
92 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
93 reg = <0x630 0x10>;
94 interrupts = <1 12 0>;
95 gpio-controller;
96 #gpio-cells = <2>;
97 };
98
99 gpio_simple: gpio@b00 {
100 compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio";
101 reg = <0xb00 0x40>;
102 interrupts = <1 7 0>;
103 gpio-controller;
104 #gpio-cells = <2>;
105 };
106
107 gpio_wkup: gpio@c00 {
108 compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup";
109 reg = <0xc00 0x40>;
110 interrupts = <1 8 0 0 3 0>;
111 gpio-controller;
112 #gpio-cells = <2>;
113 };
114
115 dma-controller@1200 {
116 compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm";
117 reg = <0x1200 0x80>;
118 interrupts = <3 0 0 3 1 0 3 2 0 3 3 0
119 3 4 0 3 5 0 3 6 0 3 7 0
120 3 8 0 3 9 0 3 10 0 3 11 0
121 3 12 0 3 13 0 3 14 0 3 15 0>;
122 };
123
124 xlb@1f00 {
125 compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb";
126 reg = <0x1f00 0x100>;
127 };
128
129 serial@2000 { /* PSC1 in UART mode */
130 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
131 reg = <0x2000 0x100>;
132 interrupts = <2 1 0>;
133 };
134
135 serial@2200 { /* PSC2 in UART mode */
136 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
137 reg = <0x2200 0x100>;
138 interrupts = <2 2 0>;
139 };
140
141 serial@2c00 { /* PSC6 in UART mode */
142 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
143 reg = <0x2c00 0x100>;
144 interrupts = <2 4 0>;
145 };
146
147 ethernet@3000 {
148 compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec";
149 reg = <0x3000 0x400>;
150 local-mac-address = [ 00 00 00 00 00 00 ];
151 interrupts = <2 5 0>;
152 phy-handle = <&phy0>;
153 };
154
155 mdio@3000 {
156 #address-cells = <1>;
157 #size-cells = <0>;
158 compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio";
159 reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts
160 interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co.
161
162 phy0: ethernet-phy@0 {
163 compatible = "intel,lxt971";
164 reg = <0>;
165 };
166 };
167
168 ata@3a00 {
169 compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata";
170 reg = <0x3a00 0x100>;
171 interrupts = <2 7 0>;
172 };
173
174 i2c@3d40 {
175 #address-cells = <1>;
176 #size-cells = <0>;
177 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
178 reg = <0x3d40 0x40>;
179 interrupts = <2 16 0>;
180 hwmon@2c {
181 compatible = "ad,adm9240";
182 reg = <0x2c>;
183 };
184 rtc@51 {
185 compatible = "nxp,pcf8563";
186 reg = <0x51>;
187 };
188 };
189
190 sram@8000 {
191 compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram";
192 reg = <0x8000 0x4000>;
193 };
194 };
195
196 pci@f0000d00 {
197 #interrupt-cells = <1>;
198 #size-cells = <2>;
199 #address-cells = <3>;
200 device_type = "pci";
201 compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci";
202 reg = <0xf0000d00 0x100>;
203 interrupt-map-mask = <0xf800 0 0 7>;
204 interrupt-map = <
205 /* IDSEL 0x10 */
206 0x8000 0 0 1 &mpc5200_pic 0 3 3
207 0x8000 0 0 2 &mpc5200_pic 0 3 3
208 0x8000 0 0 3 &mpc5200_pic 0 2 3
209 0x8000 0 0 4 &mpc5200_pic 0 1 3
210 >;
211 clock-frequency = <0>; // From boot loader
212 interrupts = <2 8 0 2 9 0 2 10 0>;
213 bus-range = <0 0>;
214 ranges = <0x42000000 0 0x60000000 0x60000000 0 0x10000000
215 0x02000000 0 0x90000000 0x90000000 0 0x10000000
216 0x01000000 0 0x00000000 0xa0000000 0 0x01000000>;
217 };
218
219 localbus {
220 compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";
221
222 #address-cells = <2>;
223 #size-cells = <1>;
224
225 ranges = <0 0 0xff800000 0x00800000
226 1 0 0x80000000 0x00800000
227 3 0 0x80000000 0x00800000>;
228
229 flash@0,0 {
230 compatible = "cfi-flash";
231 reg = <0 0 0x00800000>;
232 bank-width = <4>;
233 device-width = <2>;
234 #size-cells = <1>;
235 #address-cells = <1>;
236 partition@0 {
237 label = "DTS";
238 reg = <0x0 0x00100000>;
239 };
240 partition@100000 {
241 label = "Kernel";
242 reg = <0x100000 0x00200000>;
243 };
244 partition@300000 {
245 label = "RootFS";
246 reg = <0x00300000 0x00200000>;
247 };
248 partition@500000 {
249 label = "user";
250 reg = <0x00500000 0x00200000>;
251 };
252 partition@700000 {
253 label = "U-Boot";
254 reg = <0x00700000 0x00040000>;
255 };
256 partition@740000 {
257 label = "Env";
258 reg = <0x00740000 0x00020000>;
259 };
260 partition@760000 {
261 label = "red. Env";
262 reg = <0x00760000 0x00020000>;
263 };
264 partition@780000 {
265 label = "reserve";
266 reg = <0x00780000 0x00080000>;
267 };
268 };
269
270 simple100: gpio-controller-100@3,600100 {
271 compatible = "manroland,mucmc52-aux-gpio";
272 reg = <3 0x00600100 0x1>;
273 gpio-controller;
274 #gpio-cells = <2>;
275 };
276 simple104: gpio-controller-104@3,600104 {
277 compatible = "manroland,mucmc52-aux-gpio";
278 reg = <3 0x00600104 0x1>;
279 gpio-controller;
280 #gpio-cells = <2>;
281 };
282 simple200: gpio-controller-200@3,600200 {
283 compatible = "manroland,mucmc52-aux-gpio";
284 reg = <3 0x00600200 0x1>;
285 gpio-controller;
286 #gpio-cells = <2>;
287 };
288 simple201: gpio-controller-201@3,600201 {
289 compatible = "manroland,mucmc52-aux-gpio";
290 reg = <3 0x00600201 0x1>;
291 gpio-controller;
292 #gpio-cells = <2>;
293 };
294 simple202: gpio-controller-202@3,600202 {
295 compatible = "manroland,mucmc52-aux-gpio";
296 reg = <3 0x00600202 0x1>;
297 gpio-controller;
298 #gpio-cells = <2>;
299 };
300 simple203: gpio-controller-203@3,600203 {
301 compatible = "manroland,mucmc52-aux-gpio";
302 reg = <3 0x00600203 0x1>;
303 gpio-controller;
304 #gpio-cells = <2>;
305 };
306 simple204: gpio-controller-204@3,600204 {
307 compatible = "manroland,mucmc52-aux-gpio";
308 reg = <3 0x00600204 0x1>;
309 gpio-controller;
310 #gpio-cells = <2>;
311 };
312 simple206: gpio-controller-206@3,600206 {
313 compatible = "manroland,mucmc52-aux-gpio";
314 reg = <3 0x00600206 0x1>;
315 gpio-controller;
316 #gpio-cells = <2>;
317 };
318 simple207: gpio-controller-207@3,600207 {
319 compatible = "manroland,mucmc52-aux-gpio";
320 reg = <3 0x00600207 0x1>;
321 gpio-controller;
322 #gpio-cells = <2>;
323 };
324 simple20f: gpio-controller-20f@3,60020f {
325 compatible = "manroland,mucmc52-aux-gpio";
326 reg = <3 0x0060020f 0x1>;
327 gpio-controller;
328 #gpio-cells = <2>;
329 };
330
331 };
332};
diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 30bfdc04c6df..8a4ec30b21ae 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -244,7 +244,6 @@
244 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 244 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
245 reg = <0x3d00 0x40>; 245 reg = <0x3d00 0x40>;
246 interrupts = <2 15 0>; 246 interrupts = <2 15 0>;
247 fsl5200-clocking;
248 }; 247 };
249 248
250 i2c@3d40 { 249 i2c@3d40 {
@@ -253,7 +252,6 @@
253 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 252 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
254 reg = <0x3d40 0x40>; 253 reg = <0x3d40 0x40>;
255 interrupts = <2 16 0>; 254 interrupts = <2 16 0>;
256 fsl5200-clocking;
257 rtc@51 { 255 rtc@51 {
258 compatible = "nxp,pcf8563"; 256 compatible = "nxp,pcf8563";
259 reg = <0x51>; 257 reg = <0x51>;
diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
index 030042678392..85d857a5d46e 100644
--- a/arch/powerpc/boot/dts/pcm032.dts
+++ b/arch/powerpc/boot/dts/pcm032.dts
@@ -244,7 +244,6 @@
244 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 244 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
245 reg = <0x3d00 0x40>; 245 reg = <0x3d00 0x40>;
246 interrupts = <2 15 0>; 246 interrupts = <2 15 0>;
247 fsl5200-clocking;
248 }; 247 };
249 248
250 i2c@3d40 { 249 i2c@3d40 {
@@ -253,7 +252,6 @@
253 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 252 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
254 reg = <0x3d40 0x40>; 253 reg = <0x3d40 0x40>;
255 interrupts = <2 16 0>; 254 interrupts = <2 16 0>;
256 fsl5200-clocking;
257 rtc@51 { 255 rtc@51 {
258 compatible = "nxp,pcf8563"; 256 compatible = "nxp,pcf8563";
259 reg = <0x51>; 257 reg = <0x51>;
diff --git a/arch/powerpc/boot/dts/tqm5200.dts b/arch/powerpc/boot/dts/tqm5200.dts
index c9590b58b7b0..1db07f6cf133 100644
--- a/arch/powerpc/boot/dts/tqm5200.dts
+++ b/arch/powerpc/boot/dts/tqm5200.dts
@@ -160,7 +160,6 @@
160 compatible = "fsl,mpc5200-i2c","fsl-i2c"; 160 compatible = "fsl,mpc5200-i2c","fsl-i2c";
161 reg = <0x3d40 0x40>; 161 reg = <0x3d40 0x40>;
162 interrupts = <2 16 0>; 162 interrupts = <2 16 0>;
163 fsl5200-clocking;
164 163
165 rtc@68 { 164 rtc@68 {
166 compatible = "dallas,ds1307"; 165 compatible = "dallas,ds1307";
diff --git a/arch/powerpc/boot/dts/uc101.dts b/arch/powerpc/boot/dts/uc101.dts
new file mode 100644
index 000000000000..019264c62904
--- /dev/null
+++ b/arch/powerpc/boot/dts/uc101.dts
@@ -0,0 +1,284 @@
1/*
2 * Manroland uc101 board Device Tree Source
3 *
4 * Copyright (C) 2009 DENX Software Engineering GmbH
5 * Heiko Schocher <hs@denx.de>
6 * Copyright 2006-2007 Secret Lab Technologies Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14/dts-v1/;
15
16/ {
17 model = "manroland,uc101";
18 compatible = "manroland,uc101";
19 #address-cells = <1>;
20 #size-cells = <1>;
21 interrupt-parent = <&mpc5200_pic>;
22
23 cpus {
24 #address-cells = <1>;
25 #size-cells = <0>;
26
27 PowerPC,5200@0 {
28 device_type = "cpu";
29 reg = <0>;
30 d-cache-line-size = <32>;
31 i-cache-line-size = <32>;
32 d-cache-size = <0x4000>; // L1, 16K
33 i-cache-size = <0x4000>; // L1, 16K
34 timebase-frequency = <0>; // from bootloader
35 bus-frequency = <0>; // from bootloader
36 clock-frequency = <0>; // from bootloader
37 };
38 };
39
40 memory {
41 device_type = "memory";
42 reg = <0x00000000 0x04000000>; // 64MB
43 };
44
45 soc5200@f0000000 {
46 #address-cells = <1>;
47 #size-cells = <1>;
48 compatible = "fsl,mpc5200b-immr";
49 ranges = <0 0xf0000000 0x0000c000>;
50 reg = <0xf0000000 0x00000100>;
51 bus-frequency = <0>; // from bootloader
52 system-frequency = <0>; // from bootloader
53
54 cdm@200 {
55 compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm";
56 reg = <0x200 0x38>;
57 };
58
59 mpc5200_pic: interrupt-controller@500 {
60 // 5200 interrupts are encoded into two levels;
61 interrupt-controller;
62 #interrupt-cells = <3>;
63 compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic";
64 reg = <0x500 0x80>;
65 };
66
67 gpt0: timer@600 { // General Purpose Timer in GPIO mode
68 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
69 reg = <0x600 0x10>;
70 interrupts = <1 9 0>;
71 gpio-controller;
72 #gpio-cells = <2>;
73 };
74
75 gpt1: timer@610 { // General Purpose Timer in GPIO mode
76 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
77 reg = <0x610 0x10>;
78 interrupts = <1 10 0>;
79 gpio-controller;
80 #gpio-cells = <2>;
81 };
82
83 gpt2: timer@620 { // General Purpose Timer in GPIO mode
84 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
85 reg = <0x620 0x10>;
86 interrupts = <1 11 0>;
87 gpio-controller;
88 #gpio-cells = <2>;
89 };
90
91 gpt3: timer@630 { // General Purpose Timer in GPIO mode
92 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
93 reg = <0x630 0x10>;
94 interrupts = <1 12 0>;
95 gpio-controller;
96 #gpio-cells = <2>;
97 };
98
99 gpt4: timer@640 { // General Purpose Timer in GPIO mode
100 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
101 reg = <0x640 0x10>;
102 interrupts = <1 13 0>;
103 gpio-controller;
104 #gpio-cells = <2>;
105 };
106
107 gpt5: timer@650 { // General Purpose Timer in GPIO mode
108 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
109 reg = <0x650 0x10>;
110 interrupts = <1 14 0>;
111 gpio-controller;
112 #gpio-cells = <2>;
113 };
114
115 gpt6: timer@660 { // General Purpose Timer in GPIO mode
116 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
117 reg = <0x660 0x10>;
118 interrupts = <1 15 0>;
119 gpio-controller;
120 #gpio-cells = <2>;
121 };
122
123 gpt7: timer@670 { // General Purpose Timer in GPIO mode
124 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
125 reg = <0x670 0x10>;
126 interrupts = <1 16 0>;
127 gpio-controller;
128 #gpio-cells = <2>;
129 };
130
131 gpio_simple: gpio@b00 {
132 compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio";
133 reg = <0xb00 0x40>;
134 interrupts = <1 7 0>;
135 gpio-controller;
136 #gpio-cells = <2>;
137 };
138
139 gpio_wkup: gpio@c00 {
140 compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup";
141 reg = <0xc00 0x40>;
142 interrupts = <1 8 0 0 3 0>;
143 gpio-controller;
144 #gpio-cells = <2>;
145 };
146
147 dma-controller@1200 {
148 compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm";
149 reg = <0x1200 0x80>;
150 interrupts = <3 0 0 3 1 0 3 2 0 3 3 0
151 3 4 0 3 5 0 3 6 0 3 7 0
152 3 8 0 3 9 0 3 10 0 3 11 0
153 3 12 0 3 13 0 3 14 0 3 15 0>;
154 };
155
156 xlb@1f00 {
157 compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb";
158 reg = <0x1f00 0x100>;
159 };
160
161 serial@2000 { /* PSC1 in UART mode */
162 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
163 reg = <0x2000 0x100>;
164 interrupts = <2 1 0>;
165 };
166
167 serial@2200 { /* PSC2 in UART mode */
168 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
169 reg = <0x2200 0x100>;
170 interrupts = <2 2 0>;
171 };
172
173 serial@2c00 { /* PSC6 in UART mode */
174 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
175 reg = <0x2c00 0x100>;
176 interrupts = <2 4 0>;
177 };
178
179 ethernet@3000 {
180 compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec";
181 reg = <0x3000 0x400>;
182 local-mac-address = [ 00 00 00 00 00 00 ];
183 interrupts = <2 5 0>;
184 phy-handle = <&phy0>;
185 };
186
187 mdio@3000 {
188 #address-cells = <1>;
189 #size-cells = <0>;
190 compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio";
191 reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts
192 interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co.
193
194 phy0: ethernet-phy@0 {
195 compatible = "intel,lxt971";
196 reg = <0>;
197 };
198 };
199
200 ata@3a00 {
201 compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata";
202 reg = <0x3a00 0x100>;
203 interrupts = <2 7 0>;
204 };
205
206 i2c@3d40 {
207 #address-cells = <1>;
208 #size-cells = <0>;
209 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
210 reg = <0x3d40 0x40>;
211 interrupts = <2 16 0>;
212 fsl,preserve-clocking;
213 clock-frequency = <400000>;
214
215 hwmon@2c {
216 compatible = "ad,adm9240";
217 reg = <0x2c>;
218 };
219 rtc@51 {
220 compatible = "nxp,pcf8563";
221 reg = <0x51>;
222 };
223 };
224
225 sram@8000 {
226 compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram";
227 reg = <0x8000 0x4000>;
228 };
229 };
230
231 localbus {
232 compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";
233
234 #address-cells = <2>;
235 #size-cells = <1>;
236
237 ranges = <0 0 0xff800000 0x00800000
238 1 0 0x80000000 0x00800000
239 3 0 0x80000000 0x00800000>;
240
241 flash@0,0 {
242 compatible = "cfi-flash";
243 reg = <0 0 0x00800000>;
244 bank-width = <2>;
245 device-width = <2>;
246 #size-cells = <1>;
247 #address-cells = <1>;
248
249 partition@0 {
250 label = "DTS";
251 reg = <0x0 0x00100000>;
252 };
253 partition@100000 {
254 label = "Kernel";
255 reg = <0x100000 0x00200000>;
256 };
257 partition@300000 {
258 label = "RootFS";
259 reg = <0x00300000 0x00200000>;
260 };
261 partition@500000 {
262 label = "user";
263 reg = <0x00500000 0x00200000>;
264 };
265 partition@700000 {
266 label = "U-Boot";
267 reg = <0x00700000 0x00040000>;
268 };
269 partition@740000 {
270 label = "Env";
271 reg = <0x00740000 0x00010000>;
272 };
273 partition@750000 {
274 label = "red. Env";
275 reg = <0x00750000 0x00010000>;
276 };
277 partition@760000 {
278 label = "reserve";
279 reg = <0x00760000 0x000a0000>;
280 };
281 };
282
283 };
284};
diff --git a/arch/powerpc/configs/52xx/cm5200_defconfig b/arch/powerpc/configs/52xx/cm5200_defconfig
index 3838b77b8116..0396ce7bffc6 100644
--- a/arch/powerpc/configs/52xx/cm5200_defconfig
+++ b/arch/powerpc/configs/52xx/cm5200_defconfig
@@ -1,25 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc2 3# Linux kernel version: 2.6.32-rc4
4# Sat Apr 18 00:47:44 2009 4# Thu Oct 15 10:33:22 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
8# 8#
9# Processor support 9# Processor support
10# 10#
11CONFIG_6xx=y 11CONFIG_PPC_BOOK3S_32=y
12# CONFIG_PPC_85xx is not set 12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set 13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set 14# CONFIG_40x is not set
15# CONFIG_44x is not set 15# CONFIG_44x is not set
16# CONFIG_E200 is not set 16# CONFIG_E200 is not set
17CONFIG_PPC_BOOK3S=y 17CONFIG_PPC_BOOK3S=y
18CONFIG_6xx=y
18CONFIG_PPC_FPU=y 19CONFIG_PPC_FPU=y
19# CONFIG_ALTIVEC is not set 20# CONFIG_ALTIVEC is not set
20CONFIG_PPC_STD_MMU=y 21CONFIG_PPC_STD_MMU=y
21CONFIG_PPC_STD_MMU_32=y 22CONFIG_PPC_STD_MMU_32=y
22# CONFIG_PPC_MM_SLICES is not set 23# CONFIG_PPC_MM_SLICES is not set
24CONFIG_PPC_HAVE_PMU_SUPPORT=y
23# CONFIG_SMP is not set 25# CONFIG_SMP is not set
24CONFIG_PPC32=y 26CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32 27CONFIG_WORD_SIZE=32
@@ -30,15 +32,17 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 32CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 33CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 34CONFIG_GENERIC_HARDIRQS=y
35CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 36# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
37# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
34CONFIG_IRQ_PER_CPU=y 38CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y 39CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y 40CONFIG_HAVE_LATENCYTOP_SUPPORT=y
41CONFIG_TRACE_IRQFLAGS_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y 42CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y 43CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y 44CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y 45CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y 46CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set 47# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y 48CONFIG_PPC=y
@@ -52,11 +56,13 @@ CONFIG_OF=y
52# CONFIG_GENERIC_TBSYNC is not set 56# CONFIG_GENERIC_TBSYNC is not set
53CONFIG_AUDIT_ARCH=y 57CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y 58CONFIG_GENERIC_BUG=y
59CONFIG_DTC=y
55CONFIG_DEFAULT_UIMAGE=y 60CONFIG_DEFAULT_UIMAGE=y
56# CONFIG_PPC_DCR_NATIVE is not set 61# CONFIG_PPC_DCR_NATIVE is not set
57# CONFIG_PPC_DCR_MMIO is not set 62# CONFIG_PPC_DCR_MMIO is not set
58CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 63CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
59CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 64CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
65CONFIG_CONSTRUCTORS=y
60 66
61# 67#
62# General setup 68# General setup
@@ -77,11 +83,12 @@ CONFIG_SYSVIPC_SYSCTL=y
77# 83#
78# RCU Subsystem 84# RCU Subsystem
79# 85#
80CONFIG_CLASSIC_RCU=y 86CONFIG_TREE_RCU=y
81# CONFIG_TREE_RCU is not set 87# CONFIG_TREE_PREEMPT_RCU is not set
82# CONFIG_PREEMPT_RCU is not set 88# CONFIG_RCU_TRACE is not set
89CONFIG_RCU_FANOUT=32
90# CONFIG_RCU_FANOUT_EXACT is not set
83# CONFIG_TREE_RCU_TRACE is not set 91# CONFIG_TREE_RCU_TRACE is not set
84# CONFIG_PREEMPT_RCU_TRACE is not set
85# CONFIG_IKCONFIG is not set 92# CONFIG_IKCONFIG is not set
86CONFIG_LOG_BUF_SHIFT=14 93CONFIG_LOG_BUF_SHIFT=14
87CONFIG_GROUP_SCHED=y 94CONFIG_GROUP_SCHED=y
@@ -105,7 +112,6 @@ CONFIG_ANON_INODES=y
105CONFIG_EMBEDDED=y 112CONFIG_EMBEDDED=y
106# CONFIG_SYSCTL_SYSCALL is not set 113# CONFIG_SYSCTL_SYSCALL is not set
107# CONFIG_KALLSYMS is not set 114# CONFIG_KALLSYMS is not set
108# CONFIG_STRIP_ASM_SYMS is not set
109CONFIG_HOTPLUG=y 115CONFIG_HOTPLUG=y
110CONFIG_PRINTK=y 116CONFIG_PRINTK=y
111CONFIG_BUG=y 117CONFIG_BUG=y
@@ -118,6 +124,13 @@ CONFIG_TIMERFD=y
118CONFIG_EVENTFD=y 124CONFIG_EVENTFD=y
119CONFIG_SHMEM=y 125CONFIG_SHMEM=y
120CONFIG_AIO=y 126CONFIG_AIO=y
127CONFIG_HAVE_PERF_EVENTS=y
128
129#
130# Kernel Performance Events And Counters
131#
132# CONFIG_PERF_EVENTS is not set
133# CONFIG_PERF_COUNTERS is not set
121CONFIG_VM_EVENT_COUNTERS=y 134CONFIG_VM_EVENT_COUNTERS=y
122CONFIG_SLUB_DEBUG=y 135CONFIG_SLUB_DEBUG=y
123CONFIG_COMPAT_BRK=y 136CONFIG_COMPAT_BRK=y
@@ -125,14 +138,19 @@ CONFIG_COMPAT_BRK=y
125CONFIG_SLUB=y 138CONFIG_SLUB=y
126# CONFIG_SLOB is not set 139# CONFIG_SLOB is not set
127# CONFIG_PROFILING is not set 140# CONFIG_PROFILING is not set
128# CONFIG_MARKERS is not set
129CONFIG_HAVE_OPROFILE=y 141CONFIG_HAVE_OPROFILE=y
130CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 142CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
131CONFIG_HAVE_IOREMAP_PROT=y 143CONFIG_HAVE_IOREMAP_PROT=y
132CONFIG_HAVE_KPROBES=y 144CONFIG_HAVE_KPROBES=y
133CONFIG_HAVE_KRETPROBES=y 145CONFIG_HAVE_KRETPROBES=y
134CONFIG_HAVE_ARCH_TRACEHOOK=y 146CONFIG_HAVE_ARCH_TRACEHOOK=y
147CONFIG_HAVE_DMA_ATTRS=y
135CONFIG_HAVE_CLK=y 148CONFIG_HAVE_CLK=y
149CONFIG_HAVE_DMA_API_DEBUG=y
150
151#
152# GCOV-based kernel profiling
153#
136# CONFIG_SLOW_WORK is not set 154# CONFIG_SLOW_WORK is not set
137# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 155# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
138CONFIG_SLABINFO=y 156CONFIG_SLABINFO=y
@@ -140,7 +158,7 @@ CONFIG_RT_MUTEXES=y
140CONFIG_BASE_SMALL=0 158CONFIG_BASE_SMALL=0
141# CONFIG_MODULES is not set 159# CONFIG_MODULES is not set
142CONFIG_BLOCK=y 160CONFIG_BLOCK=y
143# CONFIG_LBD is not set 161CONFIG_LBDAF=y
144# CONFIG_BLK_DEV_BSG is not set 162# CONFIG_BLK_DEV_BSG is not set
145# CONFIG_BLK_DEV_INTEGRITY is not set 163# CONFIG_BLK_DEV_INTEGRITY is not set
146 164
@@ -219,11 +237,13 @@ CONFIG_BINFMT_ELF=y
219# CONFIG_HAVE_AOUT is not set 237# CONFIG_HAVE_AOUT is not set
220# CONFIG_BINFMT_MISC is not set 238# CONFIG_BINFMT_MISC is not set
221# CONFIG_IOMMU_HELPER is not set 239# CONFIG_IOMMU_HELPER is not set
240# CONFIG_SWIOTLB is not set
222CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 241CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
223CONFIG_ARCH_HAS_WALK_MEMORY=y 242CONFIG_ARCH_HAS_WALK_MEMORY=y
224CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y 243CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
225# CONFIG_KEXEC is not set 244# CONFIG_KEXEC is not set
226# CONFIG_CRASH_DUMP is not set 245# CONFIG_CRASH_DUMP is not set
246CONFIG_MAX_ACTIVE_REGIONS=32
227CONFIG_ARCH_FLATMEM_ENABLE=y 247CONFIG_ARCH_FLATMEM_ENABLE=y
228CONFIG_ARCH_POPULATES_NODE_MAP=y 248CONFIG_ARCH_POPULATES_NODE_MAP=y
229CONFIG_SELECT_MEMORY_MODEL=y 249CONFIG_SELECT_MEMORY_MODEL=y
@@ -239,9 +259,10 @@ CONFIG_MIGRATION=y
239CONFIG_ZONE_DMA_FLAG=1 259CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y 260CONFIG_BOUNCE=y
241CONFIG_VIRT_TO_BUS=y 261CONFIG_VIRT_TO_BUS=y
242CONFIG_UNEVICTABLE_LRU=y
243CONFIG_HAVE_MLOCK=y 262CONFIG_HAVE_MLOCK=y
244CONFIG_HAVE_MLOCKED_PAGE_BIT=y 263CONFIG_HAVE_MLOCKED_PAGE_BIT=y
264# CONFIG_KSM is not set
265CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
245CONFIG_PPC_4K_PAGES=y 266CONFIG_PPC_4K_PAGES=y
246# CONFIG_PPC_16K_PAGES is not set 267# CONFIG_PPC_16K_PAGES is not set
247# CONFIG_PPC_64K_PAGES is not set 268# CONFIG_PPC_64K_PAGES is not set
@@ -252,6 +273,7 @@ CONFIG_PROC_DEVICETREE=y
252CONFIG_EXTRA_TARGETS="" 273CONFIG_EXTRA_TARGETS=""
253CONFIG_PM=y 274CONFIG_PM=y
254# CONFIG_PM_DEBUG is not set 275# CONFIG_PM_DEBUG is not set
276# CONFIG_PM_RUNTIME is not set
255CONFIG_SECCOMP=y 277CONFIG_SECCOMP=y
256CONFIG_ISA_DMA_API=y 278CONFIG_ISA_DMA_API=y
257 279
@@ -328,6 +350,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
328# CONFIG_NETFILTER is not set 350# CONFIG_NETFILTER is not set
329# CONFIG_IP_DCCP is not set 351# CONFIG_IP_DCCP is not set
330# CONFIG_IP_SCTP is not set 352# CONFIG_IP_SCTP is not set
353# CONFIG_RDS is not set
331# CONFIG_TIPC is not set 354# CONFIG_TIPC is not set
332# CONFIG_ATM is not set 355# CONFIG_ATM is not set
333# CONFIG_BRIDGE is not set 356# CONFIG_BRIDGE is not set
@@ -342,6 +365,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
342# CONFIG_ECONET is not set 365# CONFIG_ECONET is not set
343# CONFIG_WAN_ROUTER is not set 366# CONFIG_WAN_ROUTER is not set
344# CONFIG_PHONET is not set 367# CONFIG_PHONET is not set
368# CONFIG_IEEE802154 is not set
345# CONFIG_NET_SCHED is not set 369# CONFIG_NET_SCHED is not set
346# CONFIG_DCB is not set 370# CONFIG_DCB is not set
347 371
@@ -367,6 +391,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
367# Generic Driver Options 391# Generic Driver Options
368# 392#
369CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 393CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
394# CONFIG_DEVTMPFS is not set
370CONFIG_STANDALONE=y 395CONFIG_STANDALONE=y
371CONFIG_PREVENT_FIRMWARE_BUILD=y 396CONFIG_PREVENT_FIRMWARE_BUILD=y
372# CONFIG_FW_LOADER is not set 397# CONFIG_FW_LOADER is not set
@@ -457,6 +482,7 @@ CONFIG_MTD_PHYSMAP_OF=y
457# CONFIG_MTD_UBI is not set 482# CONFIG_MTD_UBI is not set
458CONFIG_OF_DEVICE=y 483CONFIG_OF_DEVICE=y
459CONFIG_OF_I2C=y 484CONFIG_OF_I2C=y
485CONFIG_OF_MDIO=y
460# CONFIG_PARPORT is not set 486# CONFIG_PARPORT is not set
461CONFIG_BLK_DEV=y 487CONFIG_BLK_DEV=y
462# CONFIG_BLK_DEV_FD is not set 488# CONFIG_BLK_DEV_FD is not set
@@ -495,10 +521,6 @@ CONFIG_BLK_DEV_SD=y
495# CONFIG_BLK_DEV_SR is not set 521# CONFIG_BLK_DEV_SR is not set
496CONFIG_CHR_DEV_SG=y 522CONFIG_CHR_DEV_SG=y
497# CONFIG_CHR_DEV_SCH is not set 523# CONFIG_CHR_DEV_SCH is not set
498
499#
500# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
501#
502# CONFIG_SCSI_MULTI_LUN is not set 524# CONFIG_SCSI_MULTI_LUN is not set
503# CONFIG_SCSI_CONSTANTS is not set 525# CONFIG_SCSI_CONSTANTS is not set
504# CONFIG_SCSI_LOGGING is not set 526# CONFIG_SCSI_LOGGING is not set
@@ -519,7 +541,6 @@ CONFIG_CHR_DEV_SG=y
519# CONFIG_MD is not set 541# CONFIG_MD is not set
520# CONFIG_MACINTOSH_DRIVERS is not set 542# CONFIG_MACINTOSH_DRIVERS is not set
521CONFIG_NETDEVICES=y 543CONFIG_NETDEVICES=y
522CONFIG_COMPAT_NET_DEV_OPS=y
523# CONFIG_DUMMY is not set 544# CONFIG_DUMMY is not set
524# CONFIG_BONDING is not set 545# CONFIG_BONDING is not set
525# CONFIG_MACVLAN is not set 546# CONFIG_MACVLAN is not set
@@ -558,14 +579,14 @@ CONFIG_NET_ETHERNET=y
558# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set 579# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
559# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 580# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
560# CONFIG_B44 is not set 581# CONFIG_B44 is not set
582# CONFIG_KS8842 is not set
583# CONFIG_KS8851_MLL is not set
561CONFIG_FEC_MPC52xx=y 584CONFIG_FEC_MPC52xx=y
562CONFIG_FEC_MPC52xx_MDIO=y 585CONFIG_FEC_MPC52xx_MDIO=y
586# CONFIG_XILINX_EMACLITE is not set
563# CONFIG_NETDEV_1000 is not set 587# CONFIG_NETDEV_1000 is not set
564# CONFIG_NETDEV_10000 is not set 588# CONFIG_NETDEV_10000 is not set
565 589CONFIG_WLAN=y
566#
567# Wireless LAN
568#
569# CONFIG_WLAN_PRE80211 is not set 590# CONFIG_WLAN_PRE80211 is not set
570# CONFIG_WLAN_80211 is not set 591# CONFIG_WLAN_80211 is not set
571 592
@@ -636,6 +657,7 @@ CONFIG_LEGACY_PTY_COUNT=256
636# CONFIG_TCG_TPM is not set 657# CONFIG_TCG_TPM is not set
637CONFIG_I2C=y 658CONFIG_I2C=y
638CONFIG_I2C_BOARDINFO=y 659CONFIG_I2C_BOARDINFO=y
660CONFIG_I2C_COMPAT=y
639CONFIG_I2C_CHARDEV=y 661CONFIG_I2C_CHARDEV=y
640CONFIG_I2C_HELPER_AUTO=y 662CONFIG_I2C_HELPER_AUTO=y
641 663
@@ -646,6 +668,7 @@ CONFIG_I2C_HELPER_AUTO=y
646# 668#
647# I2C system bus drivers (mostly embedded / system-on-chip) 669# I2C system bus drivers (mostly embedded / system-on-chip)
648# 670#
671# CONFIG_I2C_DESIGNWARE is not set
649CONFIG_I2C_MPC=y 672CONFIG_I2C_MPC=y
650# CONFIG_I2C_OCORES is not set 673# CONFIG_I2C_OCORES is not set
651# CONFIG_I2C_SIMTEC is not set 674# CONFIG_I2C_SIMTEC is not set
@@ -666,23 +689,23 @@ CONFIG_I2C_MPC=y
666# Miscellaneous I2C Chip support 689# Miscellaneous I2C Chip support
667# 690#
668# CONFIG_DS1682 is not set 691# CONFIG_DS1682 is not set
669# CONFIG_SENSORS_PCF8574 is not set
670# CONFIG_PCF8575 is not set
671# CONFIG_SENSORS_PCA9539 is not set
672# CONFIG_SENSORS_MAX6875 is not set
673# CONFIG_SENSORS_TSL2550 is not set 692# CONFIG_SENSORS_TSL2550 is not set
674# CONFIG_I2C_DEBUG_CORE is not set 693# CONFIG_I2C_DEBUG_CORE is not set
675# CONFIG_I2C_DEBUG_ALGO is not set 694# CONFIG_I2C_DEBUG_ALGO is not set
676# CONFIG_I2C_DEBUG_BUS is not set 695# CONFIG_I2C_DEBUG_BUS is not set
677# CONFIG_I2C_DEBUG_CHIP is not set 696# CONFIG_I2C_DEBUG_CHIP is not set
678# CONFIG_SPI is not set 697# CONFIG_SPI is not set
698
699#
700# PPS support
701#
702# CONFIG_PPS is not set
679CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 703CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
680# CONFIG_GPIOLIB is not set 704# CONFIG_GPIOLIB is not set
681# CONFIG_W1 is not set 705# CONFIG_W1 is not set
682# CONFIG_POWER_SUPPLY is not set 706# CONFIG_POWER_SUPPLY is not set
683# CONFIG_HWMON is not set 707# CONFIG_HWMON is not set
684# CONFIG_THERMAL is not set 708# CONFIG_THERMAL is not set
685# CONFIG_THERMAL_HWMON is not set
686CONFIG_WATCHDOG=y 709CONFIG_WATCHDOG=y
687# CONFIG_WATCHDOG_NOWAYOUT is not set 710# CONFIG_WATCHDOG_NOWAYOUT is not set
688 711
@@ -713,25 +736,12 @@ CONFIG_SSB_POSSIBLE=y
713# CONFIG_MFD_TMIO is not set 736# CONFIG_MFD_TMIO is not set
714# CONFIG_PMIC_DA903X is not set 737# CONFIG_PMIC_DA903X is not set
715# CONFIG_MFD_WM8400 is not set 738# CONFIG_MFD_WM8400 is not set
739# CONFIG_MFD_WM831X is not set
716# CONFIG_MFD_WM8350_I2C is not set 740# CONFIG_MFD_WM8350_I2C is not set
717# CONFIG_MFD_PCF50633 is not set 741# CONFIG_MFD_PCF50633 is not set
742# CONFIG_AB3100_CORE is not set
718# CONFIG_REGULATOR is not set 743# CONFIG_REGULATOR is not set
719 744# CONFIG_MEDIA_SUPPORT is not set
720#
721# Multimedia devices
722#
723
724#
725# Multimedia core support
726#
727# CONFIG_VIDEO_DEV is not set
728# CONFIG_DVB_CORE is not set
729# CONFIG_VIDEO_MEDIA is not set
730
731#
732# Multimedia drivers
733#
734# CONFIG_DAB is not set
735 745
736# 746#
737# Graphics support 747# Graphics support
@@ -775,11 +785,12 @@ CONFIG_USB_DEVICEFS=y
775# CONFIG_USB_OXU210HP_HCD is not set 785# CONFIG_USB_OXU210HP_HCD is not set
776# CONFIG_USB_ISP116X_HCD is not set 786# CONFIG_USB_ISP116X_HCD is not set
777# CONFIG_USB_ISP1760_HCD is not set 787# CONFIG_USB_ISP1760_HCD is not set
788# CONFIG_USB_ISP1362_HCD is not set
778CONFIG_USB_OHCI_HCD=y 789CONFIG_USB_OHCI_HCD=y
779CONFIG_USB_OHCI_HCD_PPC_SOC=y 790CONFIG_USB_OHCI_HCD_PPC_SOC=y
780CONFIG_USB_OHCI_HCD_PPC_OF=y
781CONFIG_USB_OHCI_HCD_PPC_OF_BE=y 791CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
782# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set 792# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
793CONFIG_USB_OHCI_HCD_PPC_OF=y
783CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y 794CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
784CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y 795CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
785# CONFIG_USB_OHCI_LITTLE_ENDIAN is not set 796# CONFIG_USB_OHCI_LITTLE_ENDIAN is not set
@@ -866,6 +877,10 @@ CONFIG_USB_STORAGE=y
866# CONFIG_DMADEVICES is not set 877# CONFIG_DMADEVICES is not set
867# CONFIG_AUXDISPLAY is not set 878# CONFIG_AUXDISPLAY is not set
868# CONFIG_UIO is not set 879# CONFIG_UIO is not set
880
881#
882# TI VLYNQ
883#
869# CONFIG_STAGING is not set 884# CONFIG_STAGING is not set
870 885
871# 886#
@@ -885,10 +900,13 @@ CONFIG_FS_MBCACHE=y
885# CONFIG_REISERFS_FS is not set 900# CONFIG_REISERFS_FS is not set
886# CONFIG_JFS_FS is not set 901# CONFIG_JFS_FS is not set
887# CONFIG_FS_POSIX_ACL is not set 902# CONFIG_FS_POSIX_ACL is not set
888CONFIG_FILE_LOCKING=y
889# CONFIG_XFS_FS is not set 903# CONFIG_XFS_FS is not set
904# CONFIG_GFS2_FS is not set
890# CONFIG_OCFS2_FS is not set 905# CONFIG_OCFS2_FS is not set
891# CONFIG_BTRFS_FS is not set 906# CONFIG_BTRFS_FS is not set
907# CONFIG_NILFS2_FS is not set
908CONFIG_FILE_LOCKING=y
909CONFIG_FSNOTIFY=y
892CONFIG_DNOTIFY=y 910CONFIG_DNOTIFY=y
893CONFIG_INOTIFY=y 911CONFIG_INOTIFY=y
894CONFIG_INOTIFY_USER=y 912CONFIG_INOTIFY_USER=y
@@ -959,12 +977,12 @@ CONFIG_CRAMFS=y
959# CONFIG_ROMFS_FS is not set 977# CONFIG_ROMFS_FS is not set
960# CONFIG_SYSV_FS is not set 978# CONFIG_SYSV_FS is not set
961# CONFIG_UFS_FS is not set 979# CONFIG_UFS_FS is not set
962# CONFIG_NILFS2_FS is not set
963CONFIG_NETWORK_FILESYSTEMS=y 980CONFIG_NETWORK_FILESYSTEMS=y
964CONFIG_NFS_FS=y 981CONFIG_NFS_FS=y
965CONFIG_NFS_V3=y 982CONFIG_NFS_V3=y
966# CONFIG_NFS_V3_ACL is not set 983# CONFIG_NFS_V3_ACL is not set
967CONFIG_NFS_V4=y 984CONFIG_NFS_V4=y
985# CONFIG_NFS_V4_1 is not set
968CONFIG_ROOT_NFS=y 986CONFIG_ROOT_NFS=y
969# CONFIG_NFSD is not set 987# CONFIG_NFSD is not set
970CONFIG_LOCKD=y 988CONFIG_LOCKD=y
@@ -1064,6 +1082,7 @@ CONFIG_HAS_IOPORT=y
1064CONFIG_HAS_DMA=y 1082CONFIG_HAS_DMA=y
1065CONFIG_HAVE_LMB=y 1083CONFIG_HAVE_LMB=y
1066CONFIG_NLATTR=y 1084CONFIG_NLATTR=y
1085CONFIG_GENERIC_ATOMIC64=y
1067 1086
1068# 1087#
1069# Kernel hacking 1088# Kernel hacking
@@ -1073,6 +1092,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1073CONFIG_ENABLE_MUST_CHECK=y 1092CONFIG_ENABLE_MUST_CHECK=y
1074CONFIG_FRAME_WARN=1024 1093CONFIG_FRAME_WARN=1024
1075# CONFIG_MAGIC_SYSRQ is not set 1094# CONFIG_MAGIC_SYSRQ is not set
1095# CONFIG_STRIP_ASM_SYMS is not set
1076# CONFIG_UNUSED_SYMBOLS is not set 1096# CONFIG_UNUSED_SYMBOLS is not set
1077# CONFIG_DEBUG_FS is not set 1097# CONFIG_DEBUG_FS is not set
1078# CONFIG_HEADERS_CHECK is not set 1098# CONFIG_HEADERS_CHECK is not set
@@ -1090,10 +1110,14 @@ CONFIG_SCHED_DEBUG=y
1090# CONFIG_DEBUG_OBJECTS is not set 1110# CONFIG_DEBUG_OBJECTS is not set
1091# CONFIG_SLUB_DEBUG_ON is not set 1111# CONFIG_SLUB_DEBUG_ON is not set
1092# CONFIG_SLUB_STATS is not set 1112# CONFIG_SLUB_STATS is not set
1113# CONFIG_DEBUG_KMEMLEAK is not set
1093# CONFIG_DEBUG_RT_MUTEXES is not set 1114# CONFIG_DEBUG_RT_MUTEXES is not set
1094# CONFIG_RT_MUTEX_TESTER is not set 1115# CONFIG_RT_MUTEX_TESTER is not set
1095# CONFIG_DEBUG_SPINLOCK is not set 1116# CONFIG_DEBUG_SPINLOCK is not set
1096# CONFIG_DEBUG_MUTEXES is not set 1117# CONFIG_DEBUG_MUTEXES is not set
1118# CONFIG_DEBUG_LOCK_ALLOC is not set
1119# CONFIG_PROVE_LOCKING is not set
1120# CONFIG_LOCK_STAT is not set
1097# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1121# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1098# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1122# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1099# CONFIG_DEBUG_KOBJECT is not set 1123# CONFIG_DEBUG_KOBJECT is not set
@@ -1105,11 +1129,12 @@ CONFIG_SCHED_DEBUG=y
1105# CONFIG_DEBUG_LIST is not set 1129# CONFIG_DEBUG_LIST is not set
1106# CONFIG_DEBUG_SG is not set 1130# CONFIG_DEBUG_SG is not set
1107# CONFIG_DEBUG_NOTIFIERS is not set 1131# CONFIG_DEBUG_NOTIFIERS is not set
1108# CONFIG_BOOT_PRINTK_DELAY is not set 1132# CONFIG_DEBUG_CREDENTIALS is not set
1109# CONFIG_RCU_TORTURE_TEST is not set 1133# CONFIG_RCU_TORTURE_TEST is not set
1110# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1134# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1111# CONFIG_BACKTRACE_SELF_TEST is not set 1135# CONFIG_BACKTRACE_SELF_TEST is not set
1112# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1136# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1137# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1113# CONFIG_FAULT_INJECTION is not set 1138# CONFIG_FAULT_INJECTION is not set
1114# CONFIG_LATENCYTOP is not set 1139# CONFIG_LATENCYTOP is not set
1115# CONFIG_DEBUG_PAGEALLOC is not set 1140# CONFIG_DEBUG_PAGEALLOC is not set
@@ -1118,23 +1143,25 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1118CONFIG_HAVE_DYNAMIC_FTRACE=y 1143CONFIG_HAVE_DYNAMIC_FTRACE=y
1119CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1144CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1120CONFIG_TRACING_SUPPORT=y 1145CONFIG_TRACING_SUPPORT=y
1121 1146CONFIG_FTRACE=y
1122#
1123# Tracers
1124#
1125# CONFIG_FUNCTION_TRACER is not set 1147# CONFIG_FUNCTION_TRACER is not set
1148# CONFIG_IRQSOFF_TRACER is not set
1126# CONFIG_SCHED_TRACER is not set 1149# CONFIG_SCHED_TRACER is not set
1127# CONFIG_CONTEXT_SWITCH_TRACER is not set 1150# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1128# CONFIG_EVENT_TRACER is not set
1129# CONFIG_BOOT_TRACER is not set 1151# CONFIG_BOOT_TRACER is not set
1130# CONFIG_TRACE_BRANCH_PROFILING is not set 1152CONFIG_BRANCH_PROFILE_NONE=y
1153# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1154# CONFIG_PROFILE_ALL_BRANCHES is not set
1131# CONFIG_STACK_TRACER is not set 1155# CONFIG_STACK_TRACER is not set
1132# CONFIG_KMEMTRACE is not set 1156# CONFIG_KMEMTRACE is not set
1133# CONFIG_WORKQUEUE_TRACER is not set 1157# CONFIG_WORKQUEUE_TRACER is not set
1134# CONFIG_BLK_DEV_IO_TRACE is not set 1158# CONFIG_BLK_DEV_IO_TRACE is not set
1159# CONFIG_DMA_API_DEBUG is not set
1135# CONFIG_SAMPLES is not set 1160# CONFIG_SAMPLES is not set
1136CONFIG_HAVE_ARCH_KGDB=y 1161CONFIG_HAVE_ARCH_KGDB=y
1137# CONFIG_KGDB is not set 1162# CONFIG_KGDB is not set
1163# CONFIG_PPC_DISABLE_WERROR is not set
1164CONFIG_PPC_WERROR=y
1138CONFIG_PRINT_STACK_DEPTH=64 1165CONFIG_PRINT_STACK_DEPTH=64
1139# CONFIG_DEBUG_STACKOVERFLOW is not set 1166# CONFIG_DEBUG_STACKOVERFLOW is not set
1140# CONFIG_DEBUG_STACK_USAGE is not set 1167# CONFIG_DEBUG_STACK_USAGE is not set
@@ -1159,7 +1186,6 @@ CONFIG_CRYPTO=y
1159# 1186#
1160# Crypto core or helper 1187# Crypto core or helper
1161# 1188#
1162# CONFIG_CRYPTO_FIPS is not set
1163CONFIG_CRYPTO_ALGAPI=y 1189CONFIG_CRYPTO_ALGAPI=y
1164CONFIG_CRYPTO_ALGAPI2=y 1190CONFIG_CRYPTO_ALGAPI2=y
1165CONFIG_CRYPTO_AEAD2=y 1191CONFIG_CRYPTO_AEAD2=y
@@ -1200,11 +1226,13 @@ CONFIG_CRYPTO_PCBC=y
1200# 1226#
1201# CONFIG_CRYPTO_HMAC is not set 1227# CONFIG_CRYPTO_HMAC is not set
1202# CONFIG_CRYPTO_XCBC is not set 1228# CONFIG_CRYPTO_XCBC is not set
1229# CONFIG_CRYPTO_VMAC is not set
1203 1230
1204# 1231#
1205# Digest 1232# Digest
1206# 1233#
1207# CONFIG_CRYPTO_CRC32C is not set 1234# CONFIG_CRYPTO_CRC32C is not set
1235# CONFIG_CRYPTO_GHASH is not set
1208# CONFIG_CRYPTO_MD4 is not set 1236# CONFIG_CRYPTO_MD4 is not set
1209CONFIG_CRYPTO_MD5=y 1237CONFIG_CRYPTO_MD5=y
1210# CONFIG_CRYPTO_MICHAEL_MIC is not set 1238# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/powerpc/configs/52xx/lite5200b_defconfig b/arch/powerpc/configs/52xx/lite5200b_defconfig
index 29b0f34488f5..f5c07fd72239 100644
--- a/arch/powerpc/configs/52xx/lite5200b_defconfig
+++ b/arch/powerpc/configs/52xx/lite5200b_defconfig
@@ -1,25 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc2 3# Linux kernel version: 2.6.32-rc4
4# Sat Apr 18 00:48:04 2009 4# Thu Oct 15 10:33:24 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
8# 8#
9# Processor support 9# Processor support
10# 10#
11CONFIG_6xx=y 11CONFIG_PPC_BOOK3S_32=y
12# CONFIG_PPC_85xx is not set 12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set 13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set 14# CONFIG_40x is not set
15# CONFIG_44x is not set 15# CONFIG_44x is not set
16# CONFIG_E200 is not set 16# CONFIG_E200 is not set
17CONFIG_PPC_BOOK3S=y 17CONFIG_PPC_BOOK3S=y
18CONFIG_6xx=y
18CONFIG_PPC_FPU=y 19CONFIG_PPC_FPU=y
19# CONFIG_ALTIVEC is not set 20# CONFIG_ALTIVEC is not set
20CONFIG_PPC_STD_MMU=y 21CONFIG_PPC_STD_MMU=y
21CONFIG_PPC_STD_MMU_32=y 22CONFIG_PPC_STD_MMU_32=y
22# CONFIG_PPC_MM_SLICES is not set 23# CONFIG_PPC_MM_SLICES is not set
24CONFIG_PPC_HAVE_PMU_SUPPORT=y
23# CONFIG_SMP is not set 25# CONFIG_SMP is not set
24CONFIG_PPC32=y 26CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32 27CONFIG_WORD_SIZE=32
@@ -30,15 +32,17 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 32CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 33CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 34CONFIG_GENERIC_HARDIRQS=y
35CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 36# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
37# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
34CONFIG_IRQ_PER_CPU=y 38CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y 39CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y 40CONFIG_HAVE_LATENCYTOP_SUPPORT=y
41CONFIG_TRACE_IRQFLAGS_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y 42CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y 43CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y 44CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y 45CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y 46CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set 47# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y 48CONFIG_PPC=y
@@ -52,12 +56,14 @@ CONFIG_OF=y
52# CONFIG_GENERIC_TBSYNC is not set 56# CONFIG_GENERIC_TBSYNC is not set
53CONFIG_AUDIT_ARCH=y 57CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y 58CONFIG_GENERIC_BUG=y
59CONFIG_DTC=y
55CONFIG_DEFAULT_UIMAGE=y 60CONFIG_DEFAULT_UIMAGE=y
56CONFIG_ARCH_SUSPEND_POSSIBLE=y 61CONFIG_ARCH_SUSPEND_POSSIBLE=y
57# CONFIG_PPC_DCR_NATIVE is not set 62# CONFIG_PPC_DCR_NATIVE is not set
58# CONFIG_PPC_DCR_MMIO is not set 63# CONFIG_PPC_DCR_MMIO is not set
59CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 64CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
60CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 65CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
66CONFIG_CONSTRUCTORS=y
61 67
62# 68#
63# General setup 69# General setup
@@ -78,11 +84,12 @@ CONFIG_SYSVIPC_SYSCTL=y
78# 84#
79# RCU Subsystem 85# RCU Subsystem
80# 86#
81CONFIG_CLASSIC_RCU=y 87CONFIG_TREE_RCU=y
82# CONFIG_TREE_RCU is not set 88# CONFIG_TREE_PREEMPT_RCU is not set
83# CONFIG_PREEMPT_RCU is not set 89# CONFIG_RCU_TRACE is not set
90CONFIG_RCU_FANOUT=32
91# CONFIG_RCU_FANOUT_EXACT is not set
84# CONFIG_TREE_RCU_TRACE is not set 92# CONFIG_TREE_RCU_TRACE is not set
85# CONFIG_PREEMPT_RCU_TRACE is not set
86# CONFIG_IKCONFIG is not set 93# CONFIG_IKCONFIG is not set
87CONFIG_LOG_BUF_SHIFT=14 94CONFIG_LOG_BUF_SHIFT=14
88CONFIG_GROUP_SCHED=y 95CONFIG_GROUP_SCHED=y
@@ -106,7 +113,6 @@ CONFIG_ANON_INODES=y
106CONFIG_EMBEDDED=y 113CONFIG_EMBEDDED=y
107# CONFIG_SYSCTL_SYSCALL is not set 114# CONFIG_SYSCTL_SYSCALL is not set
108# CONFIG_KALLSYMS is not set 115# CONFIG_KALLSYMS is not set
109# CONFIG_STRIP_ASM_SYMS is not set
110CONFIG_HOTPLUG=y 116CONFIG_HOTPLUG=y
111CONFIG_PRINTK=y 117CONFIG_PRINTK=y
112CONFIG_BUG=y 118CONFIG_BUG=y
@@ -119,6 +125,13 @@ CONFIG_TIMERFD=y
119CONFIG_EVENTFD=y 125CONFIG_EVENTFD=y
120CONFIG_SHMEM=y 126CONFIG_SHMEM=y
121CONFIG_AIO=y 127CONFIG_AIO=y
128CONFIG_HAVE_PERF_EVENTS=y
129
130#
131# Kernel Performance Events And Counters
132#
133# CONFIG_PERF_EVENTS is not set
134# CONFIG_PERF_COUNTERS is not set
122CONFIG_VM_EVENT_COUNTERS=y 135CONFIG_VM_EVENT_COUNTERS=y
123CONFIG_PCI_QUIRKS=y 136CONFIG_PCI_QUIRKS=y
124CONFIG_SLUB_DEBUG=y 137CONFIG_SLUB_DEBUG=y
@@ -127,14 +140,19 @@ CONFIG_COMPAT_BRK=y
127CONFIG_SLUB=y 140CONFIG_SLUB=y
128# CONFIG_SLOB is not set 141# CONFIG_SLOB is not set
129# CONFIG_PROFILING is not set 142# CONFIG_PROFILING is not set
130# CONFIG_MARKERS is not set
131CONFIG_HAVE_OPROFILE=y 143CONFIG_HAVE_OPROFILE=y
132CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 144CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
133CONFIG_HAVE_IOREMAP_PROT=y 145CONFIG_HAVE_IOREMAP_PROT=y
134CONFIG_HAVE_KPROBES=y 146CONFIG_HAVE_KPROBES=y
135CONFIG_HAVE_KRETPROBES=y 147CONFIG_HAVE_KRETPROBES=y
136CONFIG_HAVE_ARCH_TRACEHOOK=y 148CONFIG_HAVE_ARCH_TRACEHOOK=y
149CONFIG_HAVE_DMA_ATTRS=y
137CONFIG_HAVE_CLK=y 150CONFIG_HAVE_CLK=y
151CONFIG_HAVE_DMA_API_DEBUG=y
152
153#
154# GCOV-based kernel profiling
155#
138# CONFIG_SLOW_WORK is not set 156# CONFIG_SLOW_WORK is not set
139# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 157# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
140CONFIG_SLABINFO=y 158CONFIG_SLABINFO=y
@@ -147,7 +165,7 @@ CONFIG_MODULE_UNLOAD=y
147# CONFIG_MODVERSIONS is not set 165# CONFIG_MODVERSIONS is not set
148# CONFIG_MODULE_SRCVERSION_ALL is not set 166# CONFIG_MODULE_SRCVERSION_ALL is not set
149CONFIG_BLOCK=y 167CONFIG_BLOCK=y
150# CONFIG_LBD is not set 168CONFIG_LBDAF=y
151# CONFIG_BLK_DEV_BSG is not set 169# CONFIG_BLK_DEV_BSG is not set
152# CONFIG_BLK_DEV_INTEGRITY is not set 170# CONFIG_BLK_DEV_INTEGRITY is not set
153 171
@@ -228,11 +246,13 @@ CONFIG_BINFMT_ELF=y
228# CONFIG_HAVE_AOUT is not set 246# CONFIG_HAVE_AOUT is not set
229# CONFIG_BINFMT_MISC is not set 247# CONFIG_BINFMT_MISC is not set
230# CONFIG_IOMMU_HELPER is not set 248# CONFIG_IOMMU_HELPER is not set
249# CONFIG_SWIOTLB is not set
231CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 250CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
232CONFIG_ARCH_HAS_WALK_MEMORY=y 251CONFIG_ARCH_HAS_WALK_MEMORY=y
233CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y 252CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
234# CONFIG_KEXEC is not set 253# CONFIG_KEXEC is not set
235# CONFIG_CRASH_DUMP is not set 254# CONFIG_CRASH_DUMP is not set
255CONFIG_MAX_ACTIVE_REGIONS=32
236CONFIG_ARCH_FLATMEM_ENABLE=y 256CONFIG_ARCH_FLATMEM_ENABLE=y
237CONFIG_ARCH_POPULATES_NODE_MAP=y 257CONFIG_ARCH_POPULATES_NODE_MAP=y
238CONFIG_SELECT_MEMORY_MODEL=y 258CONFIG_SELECT_MEMORY_MODEL=y
@@ -248,9 +268,10 @@ CONFIG_MIGRATION=y
248CONFIG_ZONE_DMA_FLAG=1 268CONFIG_ZONE_DMA_FLAG=1
249CONFIG_BOUNCE=y 269CONFIG_BOUNCE=y
250CONFIG_VIRT_TO_BUS=y 270CONFIG_VIRT_TO_BUS=y
251CONFIG_UNEVICTABLE_LRU=y
252CONFIG_HAVE_MLOCK=y 271CONFIG_HAVE_MLOCK=y
253CONFIG_HAVE_MLOCKED_PAGE_BIT=y 272CONFIG_HAVE_MLOCKED_PAGE_BIT=y
273# CONFIG_KSM is not set
274CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
254CONFIG_PPC_4K_PAGES=y 275CONFIG_PPC_4K_PAGES=y
255# CONFIG_PPC_16K_PAGES is not set 276# CONFIG_PPC_16K_PAGES is not set
256# CONFIG_PPC_64K_PAGES is not set 277# CONFIG_PPC_64K_PAGES is not set
@@ -264,6 +285,7 @@ CONFIG_PM=y
264CONFIG_PM_SLEEP=y 285CONFIG_PM_SLEEP=y
265CONFIG_SUSPEND=y 286CONFIG_SUSPEND=y
266CONFIG_SUSPEND_FREEZER=y 287CONFIG_SUSPEND_FREEZER=y
288# CONFIG_PM_RUNTIME is not set
267CONFIG_SECCOMP=y 289CONFIG_SECCOMP=y
268CONFIG_ISA_DMA_API=y 290CONFIG_ISA_DMA_API=y
269 291
@@ -348,6 +370,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
348# CONFIG_NETFILTER is not set 370# CONFIG_NETFILTER is not set
349# CONFIG_IP_DCCP is not set 371# CONFIG_IP_DCCP is not set
350# CONFIG_IP_SCTP is not set 372# CONFIG_IP_SCTP is not set
373# CONFIG_RDS is not set
351# CONFIG_TIPC is not set 374# CONFIG_TIPC is not set
352# CONFIG_ATM is not set 375# CONFIG_ATM is not set
353# CONFIG_BRIDGE is not set 376# CONFIG_BRIDGE is not set
@@ -362,6 +385,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
362# CONFIG_ECONET is not set 385# CONFIG_ECONET is not set
363# CONFIG_WAN_ROUTER is not set 386# CONFIG_WAN_ROUTER is not set
364# CONFIG_PHONET is not set 387# CONFIG_PHONET is not set
388# CONFIG_IEEE802154 is not set
365# CONFIG_NET_SCHED is not set 389# CONFIG_NET_SCHED is not set
366# CONFIG_DCB is not set 390# CONFIG_DCB is not set
367 391
@@ -387,6 +411,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
387# Generic Driver Options 411# Generic Driver Options
388# 412#
389CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 413CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
414# CONFIG_DEVTMPFS is not set
390CONFIG_STANDALONE=y 415CONFIG_STANDALONE=y
391CONFIG_PREVENT_FIRMWARE_BUILD=y 416CONFIG_PREVENT_FIRMWARE_BUILD=y
392# CONFIG_FW_LOADER is not set 417# CONFIG_FW_LOADER is not set
@@ -397,6 +422,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
397# CONFIG_MTD is not set 422# CONFIG_MTD is not set
398CONFIG_OF_DEVICE=y 423CONFIG_OF_DEVICE=y
399CONFIG_OF_I2C=y 424CONFIG_OF_I2C=y
425CONFIG_OF_MDIO=y
400# CONFIG_PARPORT is not set 426# CONFIG_PARPORT is not set
401CONFIG_BLK_DEV=y 427CONFIG_BLK_DEV=y
402# CONFIG_BLK_DEV_FD is not set 428# CONFIG_BLK_DEV_FD is not set
@@ -431,7 +457,9 @@ CONFIG_MISC_DEVICES=y
431# 457#
432# CONFIG_EEPROM_AT24 is not set 458# CONFIG_EEPROM_AT24 is not set
433# CONFIG_EEPROM_LEGACY is not set 459# CONFIG_EEPROM_LEGACY is not set
460# CONFIG_EEPROM_MAX6875 is not set
434# CONFIG_EEPROM_93CX6 is not set 461# CONFIG_EEPROM_93CX6 is not set
462# CONFIG_CB710_CORE is not set
435CONFIG_HAVE_IDE=y 463CONFIG_HAVE_IDE=y
436# CONFIG_IDE is not set 464# CONFIG_IDE is not set
437 465
@@ -454,10 +482,6 @@ CONFIG_BLK_DEV_SD=y
454# CONFIG_BLK_DEV_SR is not set 482# CONFIG_BLK_DEV_SR is not set
455# CONFIG_CHR_DEV_SG is not set 483# CONFIG_CHR_DEV_SG is not set
456# CONFIG_CHR_DEV_SCH is not set 484# CONFIG_CHR_DEV_SCH is not set
457
458#
459# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
460#
461# CONFIG_SCSI_MULTI_LUN is not set 485# CONFIG_SCSI_MULTI_LUN is not set
462# CONFIG_SCSI_CONSTANTS is not set 486# CONFIG_SCSI_CONSTANTS is not set
463# CONFIG_SCSI_LOGGING is not set 487# CONFIG_SCSI_LOGGING is not set
@@ -475,6 +499,8 @@ CONFIG_SCSI_WAIT_SCAN=m
475CONFIG_SCSI_LOWLEVEL=y 499CONFIG_SCSI_LOWLEVEL=y
476# CONFIG_ISCSI_TCP is not set 500# CONFIG_ISCSI_TCP is not set
477# CONFIG_SCSI_CXGB3_ISCSI is not set 501# CONFIG_SCSI_CXGB3_ISCSI is not set
502# CONFIG_SCSI_BNX2_ISCSI is not set
503# CONFIG_BE2ISCSI is not set
478# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 504# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
479# CONFIG_SCSI_3W_9XXX is not set 505# CONFIG_SCSI_3W_9XXX is not set
480# CONFIG_SCSI_ACARD is not set 506# CONFIG_SCSI_ACARD is not set
@@ -483,6 +509,7 @@ CONFIG_SCSI_LOWLEVEL=y
483# CONFIG_SCSI_AIC7XXX_OLD is not set 509# CONFIG_SCSI_AIC7XXX_OLD is not set
484# CONFIG_SCSI_AIC79XX is not set 510# CONFIG_SCSI_AIC79XX is not set
485# CONFIG_SCSI_AIC94XX is not set 511# CONFIG_SCSI_AIC94XX is not set
512# CONFIG_SCSI_MVSAS is not set
486# CONFIG_SCSI_DPT_I2O is not set 513# CONFIG_SCSI_DPT_I2O is not set
487# CONFIG_SCSI_ADVANSYS is not set 514# CONFIG_SCSI_ADVANSYS is not set
488# CONFIG_SCSI_ARCMSR is not set 515# CONFIG_SCSI_ARCMSR is not set
@@ -502,7 +529,6 @@ CONFIG_SCSI_LOWLEVEL=y
502# CONFIG_SCSI_IPS is not set 529# CONFIG_SCSI_IPS is not set
503# CONFIG_SCSI_INITIO is not set 530# CONFIG_SCSI_INITIO is not set
504# CONFIG_SCSI_INIA100 is not set 531# CONFIG_SCSI_INIA100 is not set
505# CONFIG_SCSI_MVSAS is not set
506# CONFIG_SCSI_STEX is not set 532# CONFIG_SCSI_STEX is not set
507# CONFIG_SCSI_SYM53C8XX_2 is not set 533# CONFIG_SCSI_SYM53C8XX_2 is not set
508# CONFIG_SCSI_IPR is not set 534# CONFIG_SCSI_IPR is not set
@@ -514,11 +540,14 @@ CONFIG_SCSI_LOWLEVEL=y
514# CONFIG_SCSI_DC390T is not set 540# CONFIG_SCSI_DC390T is not set
515# CONFIG_SCSI_NSP32 is not set 541# CONFIG_SCSI_NSP32 is not set
516# CONFIG_SCSI_DEBUG is not set 542# CONFIG_SCSI_DEBUG is not set
543# CONFIG_SCSI_PMCRAID is not set
517# CONFIG_SCSI_SRP is not set 544# CONFIG_SCSI_SRP is not set
545# CONFIG_SCSI_BFA_FC is not set
518# CONFIG_SCSI_DH is not set 546# CONFIG_SCSI_DH is not set
519# CONFIG_SCSI_OSD_INITIATOR is not set 547# CONFIG_SCSI_OSD_INITIATOR is not set
520CONFIG_ATA=y 548CONFIG_ATA=y
521# CONFIG_ATA_NONSTANDARD is not set 549# CONFIG_ATA_NONSTANDARD is not set
550CONFIG_ATA_VERBOSE_ERROR=y
522CONFIG_SATA_PMP=y 551CONFIG_SATA_PMP=y
523# CONFIG_SATA_AHCI is not set 552# CONFIG_SATA_AHCI is not set
524# CONFIG_SATA_SIL24 is not set 553# CONFIG_SATA_SIL24 is not set
@@ -540,6 +569,7 @@ CONFIG_ATA_SFF=y
540# CONFIG_PATA_ALI is not set 569# CONFIG_PATA_ALI is not set
541# CONFIG_PATA_AMD is not set 570# CONFIG_PATA_AMD is not set
542# CONFIG_PATA_ARTOP is not set 571# CONFIG_PATA_ARTOP is not set
572# CONFIG_PATA_ATP867X is not set
543# CONFIG_PATA_ATIIXP is not set 573# CONFIG_PATA_ATIIXP is not set
544# CONFIG_PATA_CMD640_PCI is not set 574# CONFIG_PATA_CMD640_PCI is not set
545# CONFIG_PATA_CMD64X is not set 575# CONFIG_PATA_CMD64X is not set
@@ -568,6 +598,7 @@ CONFIG_PATA_MPC52xx=y
568# CONFIG_PATA_OPTIDMA is not set 598# CONFIG_PATA_OPTIDMA is not set
569# CONFIG_PATA_PDC_OLD is not set 599# CONFIG_PATA_PDC_OLD is not set
570# CONFIG_PATA_RADISYS is not set 600# CONFIG_PATA_RADISYS is not set
601# CONFIG_PATA_RDC is not set
571# CONFIG_PATA_RZ1000 is not set 602# CONFIG_PATA_RZ1000 is not set
572# CONFIG_PATA_SC1200 is not set 603# CONFIG_PATA_SC1200 is not set
573# CONFIG_PATA_SERVERWORKS is not set 604# CONFIG_PATA_SERVERWORKS is not set
@@ -586,14 +617,17 @@ CONFIG_PATA_MPC52xx=y
586# 617#
587 618
588# 619#
589# Enable only one of the two stacks, unless you know what you are doing 620# You can enable one or both FireWire driver stacks.
621#
622
623#
624# See the help texts for more information.
590# 625#
591# CONFIG_FIREWIRE is not set 626# CONFIG_FIREWIRE is not set
592# CONFIG_IEEE1394 is not set 627# CONFIG_IEEE1394 is not set
593# CONFIG_I2O is not set 628# CONFIG_I2O is not set
594# CONFIG_MACINTOSH_DRIVERS is not set 629# CONFIG_MACINTOSH_DRIVERS is not set
595CONFIG_NETDEVICES=y 630CONFIG_NETDEVICES=y
596CONFIG_COMPAT_NET_DEV_OPS=y
597# CONFIG_DUMMY is not set 631# CONFIG_DUMMY is not set
598# CONFIG_BONDING is not set 632# CONFIG_BONDING is not set
599# CONFIG_MACVLAN is not set 633# CONFIG_MACVLAN is not set
@@ -640,9 +674,12 @@ CONFIG_NET_ETHERNET=y
640# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 674# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
641# CONFIG_NET_PCI is not set 675# CONFIG_NET_PCI is not set
642# CONFIG_B44 is not set 676# CONFIG_B44 is not set
677# CONFIG_KS8842 is not set
678# CONFIG_KS8851_MLL is not set
643CONFIG_FEC_MPC52xx=y 679CONFIG_FEC_MPC52xx=y
644CONFIG_FEC_MPC52xx_MDIO=y 680CONFIG_FEC_MPC52xx_MDIO=y
645# CONFIG_ATL2 is not set 681# CONFIG_ATL2 is not set
682# CONFIG_XILINX_EMACLITE is not set
646CONFIG_NETDEV_1000=y 683CONFIG_NETDEV_1000=y
647# CONFIG_ACENIC is not set 684# CONFIG_ACENIC is not set
648# CONFIG_DL2K is not set 685# CONFIG_DL2K is not set
@@ -661,6 +698,8 @@ CONFIG_NETDEV_1000=y
661# CONFIG_VIA_VELOCITY is not set 698# CONFIG_VIA_VELOCITY is not set
662# CONFIG_TIGON3 is not set 699# CONFIG_TIGON3 is not set
663# CONFIG_BNX2 is not set 700# CONFIG_BNX2 is not set
701# CONFIG_CNIC is not set
702# CONFIG_MV643XX_ETH is not set
664# CONFIG_QLA3XXX is not set 703# CONFIG_QLA3XXX is not set
665# CONFIG_ATL1 is not set 704# CONFIG_ATL1 is not set
666# CONFIG_ATL1E is not set 705# CONFIG_ATL1E is not set
@@ -686,10 +725,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
686# CONFIG_SFC is not set 725# CONFIG_SFC is not set
687# CONFIG_BE2NET is not set 726# CONFIG_BE2NET is not set
688# CONFIG_TR is not set 727# CONFIG_TR is not set
689 728CONFIG_WLAN=y
690#
691# Wireless LAN
692#
693# CONFIG_WLAN_PRE80211 is not set 729# CONFIG_WLAN_PRE80211 is not set
694# CONFIG_WLAN_80211 is not set 730# CONFIG_WLAN_80211 is not set
695 731
@@ -759,6 +795,7 @@ CONFIG_GEN_RTC=y
759CONFIG_DEVPORT=y 795CONFIG_DEVPORT=y
760CONFIG_I2C=y 796CONFIG_I2C=y
761CONFIG_I2C_BOARDINFO=y 797CONFIG_I2C_BOARDINFO=y
798CONFIG_I2C_COMPAT=y
762CONFIG_I2C_CHARDEV=y 799CONFIG_I2C_CHARDEV=y
763CONFIG_I2C_HELPER_AUTO=y 800CONFIG_I2C_HELPER_AUTO=y
764 801
@@ -787,6 +824,7 @@ CONFIG_I2C_HELPER_AUTO=y
787# 824#
788# I2C system bus drivers (mostly embedded / system-on-chip) 825# I2C system bus drivers (mostly embedded / system-on-chip)
789# 826#
827# CONFIG_I2C_DESIGNWARE is not set
790CONFIG_I2C_MPC=y 828CONFIG_I2C_MPC=y
791# CONFIG_I2C_OCORES is not set 829# CONFIG_I2C_OCORES is not set
792# CONFIG_I2C_SIMTEC is not set 830# CONFIG_I2C_SIMTEC is not set
@@ -812,23 +850,23 @@ CONFIG_I2C_MPC=y
812# Miscellaneous I2C Chip support 850# Miscellaneous I2C Chip support
813# 851#
814# CONFIG_DS1682 is not set 852# CONFIG_DS1682 is not set
815# CONFIG_SENSORS_PCF8574 is not set
816# CONFIG_PCF8575 is not set
817# CONFIG_SENSORS_PCA9539 is not set
818# CONFIG_SENSORS_MAX6875 is not set
819# CONFIG_SENSORS_TSL2550 is not set 853# CONFIG_SENSORS_TSL2550 is not set
820# CONFIG_I2C_DEBUG_CORE is not set 854# CONFIG_I2C_DEBUG_CORE is not set
821# CONFIG_I2C_DEBUG_ALGO is not set 855# CONFIG_I2C_DEBUG_ALGO is not set
822# CONFIG_I2C_DEBUG_BUS is not set 856# CONFIG_I2C_DEBUG_BUS is not set
823# CONFIG_I2C_DEBUG_CHIP is not set 857# CONFIG_I2C_DEBUG_CHIP is not set
824# CONFIG_SPI is not set 858# CONFIG_SPI is not set
859
860#
861# PPS support
862#
863# CONFIG_PPS is not set
825CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 864CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
826# CONFIG_GPIOLIB is not set 865# CONFIG_GPIOLIB is not set
827# CONFIG_W1 is not set 866# CONFIG_W1 is not set
828# CONFIG_POWER_SUPPLY is not set 867# CONFIG_POWER_SUPPLY is not set
829# CONFIG_HWMON is not set 868# CONFIG_HWMON is not set
830# CONFIG_THERMAL is not set 869# CONFIG_THERMAL is not set
831# CONFIG_THERMAL_HWMON is not set
832# CONFIG_WATCHDOG is not set 870# CONFIG_WATCHDOG is not set
833CONFIG_SSB_POSSIBLE=y 871CONFIG_SSB_POSSIBLE=y
834 872
@@ -847,30 +885,18 @@ CONFIG_SSB_POSSIBLE=y
847# CONFIG_MFD_TMIO is not set 885# CONFIG_MFD_TMIO is not set
848# CONFIG_PMIC_DA903X is not set 886# CONFIG_PMIC_DA903X is not set
849# CONFIG_MFD_WM8400 is not set 887# CONFIG_MFD_WM8400 is not set
888# CONFIG_MFD_WM831X is not set
850# CONFIG_MFD_WM8350_I2C is not set 889# CONFIG_MFD_WM8350_I2C is not set
851# CONFIG_MFD_PCF50633 is not set 890# CONFIG_MFD_PCF50633 is not set
891# CONFIG_AB3100_CORE is not set
852# CONFIG_REGULATOR is not set 892# CONFIG_REGULATOR is not set
853 893# CONFIG_MEDIA_SUPPORT is not set
854#
855# Multimedia devices
856#
857
858#
859# Multimedia core support
860#
861# CONFIG_VIDEO_DEV is not set
862# CONFIG_DVB_CORE is not set
863# CONFIG_VIDEO_MEDIA is not set
864
865#
866# Multimedia drivers
867#
868# CONFIG_DAB is not set
869 894
870# 895#
871# Graphics support 896# Graphics support
872# 897#
873# CONFIG_AGP is not set 898# CONFIG_AGP is not set
899CONFIG_VGA_ARB=y
874# CONFIG_DRM is not set 900# CONFIG_DRM is not set
875# CONFIG_VGASTATE is not set 901# CONFIG_VGASTATE is not set
876CONFIG_VIDEO_OUTPUT_CONTROL=m 902CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -913,6 +939,10 @@ CONFIG_USB_ARCH_HAS_EHCI=y
913# CONFIG_DMADEVICES is not set 939# CONFIG_DMADEVICES is not set
914# CONFIG_AUXDISPLAY is not set 940# CONFIG_AUXDISPLAY is not set
915# CONFIG_UIO is not set 941# CONFIG_UIO is not set
942
943#
944# TI VLYNQ
945#
916# CONFIG_STAGING is not set 946# CONFIG_STAGING is not set
917 947
918# 948#
@@ -932,10 +962,13 @@ CONFIG_FS_MBCACHE=y
932# CONFIG_REISERFS_FS is not set 962# CONFIG_REISERFS_FS is not set
933# CONFIG_JFS_FS is not set 963# CONFIG_JFS_FS is not set
934# CONFIG_FS_POSIX_ACL is not set 964# CONFIG_FS_POSIX_ACL is not set
935CONFIG_FILE_LOCKING=y
936# CONFIG_XFS_FS is not set 965# CONFIG_XFS_FS is not set
966# CONFIG_GFS2_FS is not set
937# CONFIG_OCFS2_FS is not set 967# CONFIG_OCFS2_FS is not set
938# CONFIG_BTRFS_FS is not set 968# CONFIG_BTRFS_FS is not set
969# CONFIG_NILFS2_FS is not set
970CONFIG_FILE_LOCKING=y
971CONFIG_FSNOTIFY=y
939CONFIG_DNOTIFY=y 972CONFIG_DNOTIFY=y
940CONFIG_INOTIFY=y 973CONFIG_INOTIFY=y
941CONFIG_INOTIFY_USER=y 974CONFIG_INOTIFY_USER=y
@@ -992,12 +1025,12 @@ CONFIG_MISC_FILESYSTEMS=y
992# CONFIG_ROMFS_FS is not set 1025# CONFIG_ROMFS_FS is not set
993# CONFIG_SYSV_FS is not set 1026# CONFIG_SYSV_FS is not set
994# CONFIG_UFS_FS is not set 1027# CONFIG_UFS_FS is not set
995# CONFIG_NILFS2_FS is not set
996CONFIG_NETWORK_FILESYSTEMS=y 1028CONFIG_NETWORK_FILESYSTEMS=y
997CONFIG_NFS_FS=y 1029CONFIG_NFS_FS=y
998CONFIG_NFS_V3=y 1030CONFIG_NFS_V3=y
999# CONFIG_NFS_V3_ACL is not set 1031# CONFIG_NFS_V3_ACL is not set
1000CONFIG_NFS_V4=y 1032CONFIG_NFS_V4=y
1033# CONFIG_NFS_V4_1 is not set
1001CONFIG_ROOT_NFS=y 1034CONFIG_ROOT_NFS=y
1002# CONFIG_NFSD is not set 1035# CONFIG_NFSD is not set
1003CONFIG_LOCKD=y 1036CONFIG_LOCKD=y
@@ -1041,6 +1074,7 @@ CONFIG_HAS_IOPORT=y
1041CONFIG_HAS_DMA=y 1074CONFIG_HAS_DMA=y
1042CONFIG_HAVE_LMB=y 1075CONFIG_HAVE_LMB=y
1043CONFIG_NLATTR=y 1076CONFIG_NLATTR=y
1077CONFIG_GENERIC_ATOMIC64=y
1044 1078
1045# 1079#
1046# Kernel hacking 1080# Kernel hacking
@@ -1050,6 +1084,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1050CONFIG_ENABLE_MUST_CHECK=y 1084CONFIG_ENABLE_MUST_CHECK=y
1051CONFIG_FRAME_WARN=1024 1085CONFIG_FRAME_WARN=1024
1052# CONFIG_MAGIC_SYSRQ is not set 1086# CONFIG_MAGIC_SYSRQ is not set
1087# CONFIG_STRIP_ASM_SYMS is not set
1053# CONFIG_UNUSED_SYMBOLS is not set 1088# CONFIG_UNUSED_SYMBOLS is not set
1054# CONFIG_DEBUG_FS is not set 1089# CONFIG_DEBUG_FS is not set
1055# CONFIG_HEADERS_CHECK is not set 1090# CONFIG_HEADERS_CHECK is not set
@@ -1067,10 +1102,14 @@ CONFIG_SCHED_DEBUG=y
1067# CONFIG_DEBUG_OBJECTS is not set 1102# CONFIG_DEBUG_OBJECTS is not set
1068# CONFIG_SLUB_DEBUG_ON is not set 1103# CONFIG_SLUB_DEBUG_ON is not set
1069# CONFIG_SLUB_STATS is not set 1104# CONFIG_SLUB_STATS is not set
1105# CONFIG_DEBUG_KMEMLEAK is not set
1070# CONFIG_DEBUG_RT_MUTEXES is not set 1106# CONFIG_DEBUG_RT_MUTEXES is not set
1071# CONFIG_RT_MUTEX_TESTER is not set 1107# CONFIG_RT_MUTEX_TESTER is not set
1072# CONFIG_DEBUG_SPINLOCK is not set 1108# CONFIG_DEBUG_SPINLOCK is not set
1073# CONFIG_DEBUG_MUTEXES is not set 1109# CONFIG_DEBUG_MUTEXES is not set
1110# CONFIG_DEBUG_LOCK_ALLOC is not set
1111# CONFIG_PROVE_LOCKING is not set
1112# CONFIG_LOCK_STAT is not set
1074# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1113# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1075# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1114# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1076# CONFIG_DEBUG_KOBJECT is not set 1115# CONFIG_DEBUG_KOBJECT is not set
@@ -1082,11 +1121,12 @@ CONFIG_DEBUG_INFO=y
1082# CONFIG_DEBUG_LIST is not set 1121# CONFIG_DEBUG_LIST is not set
1083# CONFIG_DEBUG_SG is not set 1122# CONFIG_DEBUG_SG is not set
1084# CONFIG_DEBUG_NOTIFIERS is not set 1123# CONFIG_DEBUG_NOTIFIERS is not set
1085# CONFIG_BOOT_PRINTK_DELAY is not set 1124# CONFIG_DEBUG_CREDENTIALS is not set
1086# CONFIG_RCU_TORTURE_TEST is not set 1125# CONFIG_RCU_TORTURE_TEST is not set
1087# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1126# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1088# CONFIG_BACKTRACE_SELF_TEST is not set 1127# CONFIG_BACKTRACE_SELF_TEST is not set
1089# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1128# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1129# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1090# CONFIG_FAULT_INJECTION is not set 1130# CONFIG_FAULT_INJECTION is not set
1091# CONFIG_LATENCYTOP is not set 1131# CONFIG_LATENCYTOP is not set
1092# CONFIG_DEBUG_PAGEALLOC is not set 1132# CONFIG_DEBUG_PAGEALLOC is not set
@@ -1095,23 +1135,25 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1095CONFIG_HAVE_DYNAMIC_FTRACE=y 1135CONFIG_HAVE_DYNAMIC_FTRACE=y
1096CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1136CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1097CONFIG_TRACING_SUPPORT=y 1137CONFIG_TRACING_SUPPORT=y
1098 1138CONFIG_FTRACE=y
1099#
1100# Tracers
1101#
1102# CONFIG_FUNCTION_TRACER is not set 1139# CONFIG_FUNCTION_TRACER is not set
1140# CONFIG_IRQSOFF_TRACER is not set
1103# CONFIG_SCHED_TRACER is not set 1141# CONFIG_SCHED_TRACER is not set
1104# CONFIG_CONTEXT_SWITCH_TRACER is not set 1142# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1105# CONFIG_EVENT_TRACER is not set
1106# CONFIG_BOOT_TRACER is not set 1143# CONFIG_BOOT_TRACER is not set
1107# CONFIG_TRACE_BRANCH_PROFILING is not set 1144CONFIG_BRANCH_PROFILE_NONE=y
1145# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1146# CONFIG_PROFILE_ALL_BRANCHES is not set
1108# CONFIG_STACK_TRACER is not set 1147# CONFIG_STACK_TRACER is not set
1109# CONFIG_KMEMTRACE is not set 1148# CONFIG_KMEMTRACE is not set
1110# CONFIG_WORKQUEUE_TRACER is not set 1149# CONFIG_WORKQUEUE_TRACER is not set
1111# CONFIG_BLK_DEV_IO_TRACE is not set 1150# CONFIG_BLK_DEV_IO_TRACE is not set
1151# CONFIG_DMA_API_DEBUG is not set
1112# CONFIG_SAMPLES is not set 1152# CONFIG_SAMPLES is not set
1113CONFIG_HAVE_ARCH_KGDB=y 1153CONFIG_HAVE_ARCH_KGDB=y
1114# CONFIG_KGDB is not set 1154# CONFIG_KGDB is not set
1155# CONFIG_PPC_DISABLE_WERROR is not set
1156CONFIG_PPC_WERROR=y
1115CONFIG_PRINT_STACK_DEPTH=64 1157CONFIG_PRINT_STACK_DEPTH=64
1116# CONFIG_DEBUG_STACKOVERFLOW is not set 1158# CONFIG_DEBUG_STACKOVERFLOW is not set
1117# CONFIG_DEBUG_STACK_USAGE is not set 1159# CONFIG_DEBUG_STACK_USAGE is not set
@@ -1136,7 +1178,6 @@ CONFIG_CRYPTO=y
1136# 1178#
1137# Crypto core or helper 1179# Crypto core or helper
1138# 1180#
1139# CONFIG_CRYPTO_FIPS is not set
1140CONFIG_CRYPTO_ALGAPI=y 1181CONFIG_CRYPTO_ALGAPI=y
1141CONFIG_CRYPTO_ALGAPI2=y 1182CONFIG_CRYPTO_ALGAPI2=y
1142CONFIG_CRYPTO_AEAD2=y 1183CONFIG_CRYPTO_AEAD2=y
@@ -1178,11 +1219,13 @@ CONFIG_CRYPTO_CBC=y
1178# 1219#
1179# CONFIG_CRYPTO_HMAC is not set 1220# CONFIG_CRYPTO_HMAC is not set
1180# CONFIG_CRYPTO_XCBC is not set 1221# CONFIG_CRYPTO_XCBC is not set
1222# CONFIG_CRYPTO_VMAC is not set
1181 1223
1182# 1224#
1183# Digest 1225# Digest
1184# 1226#
1185# CONFIG_CRYPTO_CRC32C is not set 1227# CONFIG_CRYPTO_CRC32C is not set
1228# CONFIG_CRYPTO_GHASH is not set
1186# CONFIG_CRYPTO_MD4 is not set 1229# CONFIG_CRYPTO_MD4 is not set
1187CONFIG_CRYPTO_MD5=y 1230CONFIG_CRYPTO_MD5=y
1188# CONFIG_CRYPTO_MICHAEL_MIC is not set 1231# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/powerpc/configs/52xx/motionpro_defconfig b/arch/powerpc/configs/52xx/motionpro_defconfig
index 07b6b266ea95..4f77a1bdc8f9 100644
--- a/arch/powerpc/configs/52xx/motionpro_defconfig
+++ b/arch/powerpc/configs/52xx/motionpro_defconfig
@@ -1,25 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc2 3# Linux kernel version: 2.6.32-rc4
4# Sat Apr 18 00:48:22 2009 4# Thu Oct 15 10:33:22 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
8# 8#
9# Processor support 9# Processor support
10# 10#
11CONFIG_6xx=y 11CONFIG_PPC_BOOK3S_32=y
12# CONFIG_PPC_85xx is not set 12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set 13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set 14# CONFIG_40x is not set
15# CONFIG_44x is not set 15# CONFIG_44x is not set
16# CONFIG_E200 is not set 16# CONFIG_E200 is not set
17CONFIG_PPC_BOOK3S=y 17CONFIG_PPC_BOOK3S=y
18CONFIG_6xx=y
18CONFIG_PPC_FPU=y 19CONFIG_PPC_FPU=y
19# CONFIG_ALTIVEC is not set 20# CONFIG_ALTIVEC is not set
20CONFIG_PPC_STD_MMU=y 21CONFIG_PPC_STD_MMU=y
21CONFIG_PPC_STD_MMU_32=y 22CONFIG_PPC_STD_MMU_32=y
22# CONFIG_PPC_MM_SLICES is not set 23# CONFIG_PPC_MM_SLICES is not set
24CONFIG_PPC_HAVE_PMU_SUPPORT=y
23# CONFIG_SMP is not set 25# CONFIG_SMP is not set
24CONFIG_PPC32=y 26CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32 27CONFIG_WORD_SIZE=32
@@ -30,15 +32,17 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 32CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 33CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 34CONFIG_GENERIC_HARDIRQS=y
35CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 36# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
37# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
34CONFIG_IRQ_PER_CPU=y 38CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y 39CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y 40CONFIG_HAVE_LATENCYTOP_SUPPORT=y
41CONFIG_TRACE_IRQFLAGS_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y 42CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y 43CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y 44CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y 45CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y 46CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set 47# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y 48CONFIG_PPC=y
@@ -52,11 +56,13 @@ CONFIG_OF=y
52# CONFIG_GENERIC_TBSYNC is not set 56# CONFIG_GENERIC_TBSYNC is not set
53CONFIG_AUDIT_ARCH=y 57CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y 58CONFIG_GENERIC_BUG=y
59CONFIG_DTC=y
55CONFIG_DEFAULT_UIMAGE=y 60CONFIG_DEFAULT_UIMAGE=y
56# CONFIG_PPC_DCR_NATIVE is not set 61# CONFIG_PPC_DCR_NATIVE is not set
57# CONFIG_PPC_DCR_MMIO is not set 62# CONFIG_PPC_DCR_MMIO is not set
58CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 63CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
59CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 64CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
65CONFIG_CONSTRUCTORS=y
60 66
61# 67#
62# General setup 68# General setup
@@ -77,11 +83,12 @@ CONFIG_SYSVIPC_SYSCTL=y
77# 83#
78# RCU Subsystem 84# RCU Subsystem
79# 85#
80CONFIG_CLASSIC_RCU=y 86CONFIG_TREE_RCU=y
81# CONFIG_TREE_RCU is not set 87# CONFIG_TREE_PREEMPT_RCU is not set
82# CONFIG_PREEMPT_RCU is not set 88# CONFIG_RCU_TRACE is not set
89CONFIG_RCU_FANOUT=32
90# CONFIG_RCU_FANOUT_EXACT is not set
83# CONFIG_TREE_RCU_TRACE is not set 91# CONFIG_TREE_RCU_TRACE is not set
84# CONFIG_PREEMPT_RCU_TRACE is not set
85# CONFIG_IKCONFIG is not set 92# CONFIG_IKCONFIG is not set
86CONFIG_LOG_BUF_SHIFT=14 93CONFIG_LOG_BUF_SHIFT=14
87CONFIG_GROUP_SCHED=y 94CONFIG_GROUP_SCHED=y
@@ -105,7 +112,6 @@ CONFIG_ANON_INODES=y
105CONFIG_EMBEDDED=y 112CONFIG_EMBEDDED=y
106# CONFIG_SYSCTL_SYSCALL is not set 113# CONFIG_SYSCTL_SYSCALL is not set
107# CONFIG_KALLSYMS is not set 114# CONFIG_KALLSYMS is not set
108# CONFIG_STRIP_ASM_SYMS is not set
109CONFIG_HOTPLUG=y 115CONFIG_HOTPLUG=y
110CONFIG_PRINTK=y 116CONFIG_PRINTK=y
111CONFIG_BUG=y 117CONFIG_BUG=y
@@ -118,6 +124,13 @@ CONFIG_TIMERFD=y
118CONFIG_EVENTFD=y 124CONFIG_EVENTFD=y
119CONFIG_SHMEM=y 125CONFIG_SHMEM=y
120CONFIG_AIO=y 126CONFIG_AIO=y
127CONFIG_HAVE_PERF_EVENTS=y
128
129#
130# Kernel Performance Events And Counters
131#
132# CONFIG_PERF_EVENTS is not set
133# CONFIG_PERF_COUNTERS is not set
121CONFIG_VM_EVENT_COUNTERS=y 134CONFIG_VM_EVENT_COUNTERS=y
122CONFIG_SLUB_DEBUG=y 135CONFIG_SLUB_DEBUG=y
123CONFIG_COMPAT_BRK=y 136CONFIG_COMPAT_BRK=y
@@ -125,14 +138,19 @@ CONFIG_COMPAT_BRK=y
125CONFIG_SLUB=y 138CONFIG_SLUB=y
126# CONFIG_SLOB is not set 139# CONFIG_SLOB is not set
127# CONFIG_PROFILING is not set 140# CONFIG_PROFILING is not set
128# CONFIG_MARKERS is not set
129CONFIG_HAVE_OPROFILE=y 141CONFIG_HAVE_OPROFILE=y
130CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 142CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
131CONFIG_HAVE_IOREMAP_PROT=y 143CONFIG_HAVE_IOREMAP_PROT=y
132CONFIG_HAVE_KPROBES=y 144CONFIG_HAVE_KPROBES=y
133CONFIG_HAVE_KRETPROBES=y 145CONFIG_HAVE_KRETPROBES=y
134CONFIG_HAVE_ARCH_TRACEHOOK=y 146CONFIG_HAVE_ARCH_TRACEHOOK=y
147CONFIG_HAVE_DMA_ATTRS=y
135CONFIG_HAVE_CLK=y 148CONFIG_HAVE_CLK=y
149CONFIG_HAVE_DMA_API_DEBUG=y
150
151#
152# GCOV-based kernel profiling
153#
136# CONFIG_SLOW_WORK is not set 154# CONFIG_SLOW_WORK is not set
137# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 155# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
138CONFIG_SLABINFO=y 156CONFIG_SLABINFO=y
@@ -140,7 +158,7 @@ CONFIG_RT_MUTEXES=y
140CONFIG_BASE_SMALL=0 158CONFIG_BASE_SMALL=0
141# CONFIG_MODULES is not set 159# CONFIG_MODULES is not set
142CONFIG_BLOCK=y 160CONFIG_BLOCK=y
143# CONFIG_LBD is not set 161CONFIG_LBDAF=y
144# CONFIG_BLK_DEV_BSG is not set 162# CONFIG_BLK_DEV_BSG is not set
145# CONFIG_BLK_DEV_INTEGRITY is not set 163# CONFIG_BLK_DEV_INTEGRITY is not set
146 164
@@ -220,11 +238,13 @@ CONFIG_BINFMT_ELF=y
220# CONFIG_HAVE_AOUT is not set 238# CONFIG_HAVE_AOUT is not set
221# CONFIG_BINFMT_MISC is not set 239# CONFIG_BINFMT_MISC is not set
222# CONFIG_IOMMU_HELPER is not set 240# CONFIG_IOMMU_HELPER is not set
241# CONFIG_SWIOTLB is not set
223CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 242CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
224CONFIG_ARCH_HAS_WALK_MEMORY=y 243CONFIG_ARCH_HAS_WALK_MEMORY=y
225CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y 244CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
226# CONFIG_KEXEC is not set 245# CONFIG_KEXEC is not set
227# CONFIG_CRASH_DUMP is not set 246# CONFIG_CRASH_DUMP is not set
247CONFIG_MAX_ACTIVE_REGIONS=32
228CONFIG_ARCH_FLATMEM_ENABLE=y 248CONFIG_ARCH_FLATMEM_ENABLE=y
229CONFIG_ARCH_POPULATES_NODE_MAP=y 249CONFIG_ARCH_POPULATES_NODE_MAP=y
230CONFIG_SELECT_MEMORY_MODEL=y 250CONFIG_SELECT_MEMORY_MODEL=y
@@ -240,9 +260,10 @@ CONFIG_MIGRATION=y
240CONFIG_ZONE_DMA_FLAG=1 260CONFIG_ZONE_DMA_FLAG=1
241CONFIG_BOUNCE=y 261CONFIG_BOUNCE=y
242CONFIG_VIRT_TO_BUS=y 262CONFIG_VIRT_TO_BUS=y
243CONFIG_UNEVICTABLE_LRU=y
244CONFIG_HAVE_MLOCK=y 263CONFIG_HAVE_MLOCK=y
245CONFIG_HAVE_MLOCKED_PAGE_BIT=y 264CONFIG_HAVE_MLOCKED_PAGE_BIT=y
265# CONFIG_KSM is not set
266CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
246CONFIG_PPC_4K_PAGES=y 267CONFIG_PPC_4K_PAGES=y
247# CONFIG_PPC_16K_PAGES is not set 268# CONFIG_PPC_16K_PAGES is not set
248# CONFIG_PPC_64K_PAGES is not set 269# CONFIG_PPC_64K_PAGES is not set
@@ -253,6 +274,7 @@ CONFIG_PROC_DEVICETREE=y
253CONFIG_EXTRA_TARGETS="" 274CONFIG_EXTRA_TARGETS=""
254CONFIG_PM=y 275CONFIG_PM=y
255# CONFIG_PM_DEBUG is not set 276# CONFIG_PM_DEBUG is not set
277# CONFIG_PM_RUNTIME is not set
256CONFIG_SECCOMP=y 278CONFIG_SECCOMP=y
257CONFIG_ISA_DMA_API=y 279CONFIG_ISA_DMA_API=y
258 280
@@ -329,6 +351,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
329# CONFIG_NETFILTER is not set 351# CONFIG_NETFILTER is not set
330# CONFIG_IP_DCCP is not set 352# CONFIG_IP_DCCP is not set
331# CONFIG_IP_SCTP is not set 353# CONFIG_IP_SCTP is not set
354# CONFIG_RDS is not set
332# CONFIG_TIPC is not set 355# CONFIG_TIPC is not set
333# CONFIG_ATM is not set 356# CONFIG_ATM is not set
334# CONFIG_BRIDGE is not set 357# CONFIG_BRIDGE is not set
@@ -343,6 +366,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
343# CONFIG_ECONET is not set 366# CONFIG_ECONET is not set
344# CONFIG_WAN_ROUTER is not set 367# CONFIG_WAN_ROUTER is not set
345# CONFIG_PHONET is not set 368# CONFIG_PHONET is not set
369# CONFIG_IEEE802154 is not set
346# CONFIG_NET_SCHED is not set 370# CONFIG_NET_SCHED is not set
347# CONFIG_DCB is not set 371# CONFIG_DCB is not set
348 372
@@ -368,6 +392,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
368# Generic Driver Options 392# Generic Driver Options
369# 393#
370CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 394CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
395# CONFIG_DEVTMPFS is not set
371CONFIG_STANDALONE=y 396CONFIG_STANDALONE=y
372CONFIG_PREVENT_FIRMWARE_BUILD=y 397CONFIG_PREVENT_FIRMWARE_BUILD=y
373# CONFIG_FW_LOADER is not set 398# CONFIG_FW_LOADER is not set
@@ -458,6 +483,7 @@ CONFIG_MTD_ROM=y
458# CONFIG_MTD_UBI is not set 483# CONFIG_MTD_UBI is not set
459CONFIG_OF_DEVICE=y 484CONFIG_OF_DEVICE=y
460CONFIG_OF_I2C=y 485CONFIG_OF_I2C=y
486CONFIG_OF_MDIO=y
461# CONFIG_PARPORT is not set 487# CONFIG_PARPORT is not set
462CONFIG_BLK_DEV=y 488CONFIG_BLK_DEV=y
463# CONFIG_BLK_DEV_FD is not set 489# CONFIG_BLK_DEV_FD is not set
@@ -483,6 +509,7 @@ CONFIG_MISC_DEVICES=y
483# 509#
484# CONFIG_EEPROM_AT24 is not set 510# CONFIG_EEPROM_AT24 is not set
485CONFIG_EEPROM_LEGACY=y 511CONFIG_EEPROM_LEGACY=y
512# CONFIG_EEPROM_MAX6875 is not set
486# CONFIG_EEPROM_93CX6 is not set 513# CONFIG_EEPROM_93CX6 is not set
487CONFIG_HAVE_IDE=y 514CONFIG_HAVE_IDE=y
488# CONFIG_IDE is not set 515# CONFIG_IDE is not set
@@ -506,10 +533,6 @@ CONFIG_BLK_DEV_SD=y
506# CONFIG_BLK_DEV_SR is not set 533# CONFIG_BLK_DEV_SR is not set
507CONFIG_CHR_DEV_SG=y 534CONFIG_CHR_DEV_SG=y
508# CONFIG_CHR_DEV_SCH is not set 535# CONFIG_CHR_DEV_SCH is not set
509
510#
511# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
512#
513# CONFIG_SCSI_MULTI_LUN is not set 536# CONFIG_SCSI_MULTI_LUN is not set
514# CONFIG_SCSI_CONSTANTS is not set 537# CONFIG_SCSI_CONSTANTS is not set
515# CONFIG_SCSI_LOGGING is not set 538# CONFIG_SCSI_LOGGING is not set
@@ -532,6 +555,7 @@ CONFIG_SCSI_LOWLEVEL=y
532# CONFIG_SCSI_OSD_INITIATOR is not set 555# CONFIG_SCSI_OSD_INITIATOR is not set
533CONFIG_ATA=y 556CONFIG_ATA=y
534# CONFIG_ATA_NONSTANDARD is not set 557# CONFIG_ATA_NONSTANDARD is not set
558CONFIG_ATA_VERBOSE_ERROR=y
535CONFIG_SATA_PMP=y 559CONFIG_SATA_PMP=y
536CONFIG_ATA_SFF=y 560CONFIG_ATA_SFF=y
537# CONFIG_SATA_MV is not set 561# CONFIG_SATA_MV is not set
@@ -540,7 +564,6 @@ CONFIG_PATA_MPC52xx=y
540# CONFIG_MD is not set 564# CONFIG_MD is not set
541# CONFIG_MACINTOSH_DRIVERS is not set 565# CONFIG_MACINTOSH_DRIVERS is not set
542CONFIG_NETDEVICES=y 566CONFIG_NETDEVICES=y
543CONFIG_COMPAT_NET_DEV_OPS=y
544# CONFIG_DUMMY is not set 567# CONFIG_DUMMY is not set
545# CONFIG_BONDING is not set 568# CONFIG_BONDING is not set
546# CONFIG_MACVLAN is not set 569# CONFIG_MACVLAN is not set
@@ -579,14 +602,14 @@ CONFIG_MII=y
579# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set 602# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
580# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 603# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
581# CONFIG_B44 is not set 604# CONFIG_B44 is not set
605# CONFIG_KS8842 is not set
606# CONFIG_KS8851_MLL is not set
582CONFIG_FEC_MPC52xx=y 607CONFIG_FEC_MPC52xx=y
583CONFIG_FEC_MPC52xx_MDIO=y 608CONFIG_FEC_MPC52xx_MDIO=y
609# CONFIG_XILINX_EMACLITE is not set
584# CONFIG_NETDEV_1000 is not set 610# CONFIG_NETDEV_1000 is not set
585# CONFIG_NETDEV_10000 is not set 611# CONFIG_NETDEV_10000 is not set
586 612CONFIG_WLAN=y
587#
588# Wireless LAN
589#
590# CONFIG_WLAN_PRE80211 is not set 613# CONFIG_WLAN_PRE80211 is not set
591# CONFIG_WLAN_80211 is not set 614# CONFIG_WLAN_80211 is not set
592 615
@@ -647,6 +670,7 @@ CONFIG_LEGACY_PTY_COUNT=256
647# CONFIG_TCG_TPM is not set 670# CONFIG_TCG_TPM is not set
648CONFIG_I2C=y 671CONFIG_I2C=y
649CONFIG_I2C_BOARDINFO=y 672CONFIG_I2C_BOARDINFO=y
673CONFIG_I2C_COMPAT=y
650CONFIG_I2C_CHARDEV=y 674CONFIG_I2C_CHARDEV=y
651CONFIG_I2C_HELPER_AUTO=y 675CONFIG_I2C_HELPER_AUTO=y
652 676
@@ -657,6 +681,7 @@ CONFIG_I2C_HELPER_AUTO=y
657# 681#
658# I2C system bus drivers (mostly embedded / system-on-chip) 682# I2C system bus drivers (mostly embedded / system-on-chip)
659# 683#
684# CONFIG_I2C_DESIGNWARE is not set
660CONFIG_I2C_MPC=y 685CONFIG_I2C_MPC=y
661# CONFIG_I2C_OCORES is not set 686# CONFIG_I2C_OCORES is not set
662# CONFIG_I2C_SIMTEC is not set 687# CONFIG_I2C_SIMTEC is not set
@@ -676,22 +701,28 @@ CONFIG_I2C_MPC=y
676# Miscellaneous I2C Chip support 701# Miscellaneous I2C Chip support
677# 702#
678# CONFIG_DS1682 is not set 703# CONFIG_DS1682 is not set
679# CONFIG_SENSORS_PCF8574 is not set
680# CONFIG_PCF8575 is not set
681# CONFIG_SENSORS_PCA9539 is not set
682# CONFIG_SENSORS_MAX6875 is not set
683# CONFIG_SENSORS_TSL2550 is not set 704# CONFIG_SENSORS_TSL2550 is not set
684# CONFIG_I2C_DEBUG_CORE is not set 705# CONFIG_I2C_DEBUG_CORE is not set
685# CONFIG_I2C_DEBUG_ALGO is not set 706# CONFIG_I2C_DEBUG_ALGO is not set
686# CONFIG_I2C_DEBUG_BUS is not set 707# CONFIG_I2C_DEBUG_BUS is not set
687# CONFIG_I2C_DEBUG_CHIP is not set 708# CONFIG_I2C_DEBUG_CHIP is not set
688# CONFIG_SPI is not set 709# CONFIG_SPI is not set
710
711#
712# PPS support
713#
714# CONFIG_PPS is not set
689CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 715CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
690# CONFIG_GPIOLIB is not set 716# CONFIG_GPIOLIB is not set
691# CONFIG_W1 is not set 717# CONFIG_W1 is not set
692# CONFIG_POWER_SUPPLY is not set 718# CONFIG_POWER_SUPPLY is not set
693CONFIG_HWMON=y 719CONFIG_HWMON=y
694# CONFIG_HWMON_VID is not set 720# CONFIG_HWMON_VID is not set
721# CONFIG_HWMON_DEBUG_CHIP is not set
722
723#
724# Native drivers
725#
695# CONFIG_SENSORS_AD7414 is not set 726# CONFIG_SENSORS_AD7414 is not set
696# CONFIG_SENSORS_AD7418 is not set 727# CONFIG_SENSORS_AD7418 is not set
697# CONFIG_SENSORS_ADM1021 is not set 728# CONFIG_SENSORS_ADM1021 is not set
@@ -738,6 +769,8 @@ CONFIG_HWMON=y
738# CONFIG_SENSORS_SMSC47B397 is not set 769# CONFIG_SENSORS_SMSC47B397 is not set
739# CONFIG_SENSORS_ADS7828 is not set 770# CONFIG_SENSORS_ADS7828 is not set
740# CONFIG_SENSORS_THMC50 is not set 771# CONFIG_SENSORS_THMC50 is not set
772# CONFIG_SENSORS_TMP401 is not set
773# CONFIG_SENSORS_TMP421 is not set
741# CONFIG_SENSORS_VT1211 is not set 774# CONFIG_SENSORS_VT1211 is not set
742# CONFIG_SENSORS_W83781D is not set 775# CONFIG_SENSORS_W83781D is not set
743# CONFIG_SENSORS_W83791D is not set 776# CONFIG_SENSORS_W83791D is not set
@@ -747,9 +780,7 @@ CONFIG_HWMON=y
747# CONFIG_SENSORS_W83L786NG is not set 780# CONFIG_SENSORS_W83L786NG is not set
748# CONFIG_SENSORS_W83627HF is not set 781# CONFIG_SENSORS_W83627HF is not set
749# CONFIG_SENSORS_W83627EHF is not set 782# CONFIG_SENSORS_W83627EHF is not set
750# CONFIG_HWMON_DEBUG_CHIP is not set
751# CONFIG_THERMAL is not set 783# CONFIG_THERMAL is not set
752# CONFIG_THERMAL_HWMON is not set
753CONFIG_WATCHDOG=y 784CONFIG_WATCHDOG=y
754# CONFIG_WATCHDOG_NOWAYOUT is not set 785# CONFIG_WATCHDOG_NOWAYOUT is not set
755 786
@@ -775,25 +806,12 @@ CONFIG_SSB_POSSIBLE=y
775# CONFIG_MFD_TMIO is not set 806# CONFIG_MFD_TMIO is not set
776# CONFIG_PMIC_DA903X is not set 807# CONFIG_PMIC_DA903X is not set
777# CONFIG_MFD_WM8400 is not set 808# CONFIG_MFD_WM8400 is not set
809# CONFIG_MFD_WM831X is not set
778# CONFIG_MFD_WM8350_I2C is not set 810# CONFIG_MFD_WM8350_I2C is not set
779# CONFIG_MFD_PCF50633 is not set 811# CONFIG_MFD_PCF50633 is not set
812# CONFIG_AB3100_CORE is not set
780# CONFIG_REGULATOR is not set 813# CONFIG_REGULATOR is not set
781 814# CONFIG_MEDIA_SUPPORT is not set
782#
783# Multimedia devices
784#
785
786#
787# Multimedia core support
788#
789# CONFIG_VIDEO_DEV is not set
790# CONFIG_DVB_CORE is not set
791# CONFIG_VIDEO_MEDIA is not set
792
793#
794# Multimedia drivers
795#
796CONFIG_DAB=y
797 815
798# 816#
799# Graphics support 817# Graphics support
@@ -817,7 +835,7 @@ CONFIG_LEDS_CLASS=y
817# 835#
818# LED drivers 836# LED drivers
819# 837#
820# CONFIG_LEDS_LP5521 is not set 838# CONFIG_LEDS_LP3944 is not set
821# CONFIG_LEDS_PCA955X is not set 839# CONFIG_LEDS_PCA955X is not set
822# CONFIG_LEDS_BD2802 is not set 840# CONFIG_LEDS_BD2802 is not set
823 841
@@ -866,6 +884,7 @@ CONFIG_RTC_DRV_DS1307=y
866# CONFIG_RTC_DRV_S35390A is not set 884# CONFIG_RTC_DRV_S35390A is not set
867# CONFIG_RTC_DRV_FM3130 is not set 885# CONFIG_RTC_DRV_FM3130 is not set
868# CONFIG_RTC_DRV_RX8581 is not set 886# CONFIG_RTC_DRV_RX8581 is not set
887# CONFIG_RTC_DRV_RX8025 is not set
869 888
870# 889#
871# SPI RTC drivers 890# SPI RTC drivers
@@ -893,6 +912,10 @@ CONFIG_RTC_DRV_DS1307=y
893# CONFIG_DMADEVICES is not set 912# CONFIG_DMADEVICES is not set
894# CONFIG_AUXDISPLAY is not set 913# CONFIG_AUXDISPLAY is not set
895# CONFIG_UIO is not set 914# CONFIG_UIO is not set
915
916#
917# TI VLYNQ
918#
896# CONFIG_STAGING is not set 919# CONFIG_STAGING is not set
897 920
898# 921#
@@ -912,10 +935,13 @@ CONFIG_FS_MBCACHE=y
912# CONFIG_REISERFS_FS is not set 935# CONFIG_REISERFS_FS is not set
913# CONFIG_JFS_FS is not set 936# CONFIG_JFS_FS is not set
914# CONFIG_FS_POSIX_ACL is not set 937# CONFIG_FS_POSIX_ACL is not set
915CONFIG_FILE_LOCKING=y
916# CONFIG_XFS_FS is not set 938# CONFIG_XFS_FS is not set
939# CONFIG_GFS2_FS is not set
917# CONFIG_OCFS2_FS is not set 940# CONFIG_OCFS2_FS is not set
918# CONFIG_BTRFS_FS is not set 941# CONFIG_BTRFS_FS is not set
942# CONFIG_NILFS2_FS is not set
943CONFIG_FILE_LOCKING=y
944CONFIG_FSNOTIFY=y
919CONFIG_DNOTIFY=y 945CONFIG_DNOTIFY=y
920CONFIG_INOTIFY=y 946CONFIG_INOTIFY=y
921CONFIG_INOTIFY_USER=y 947CONFIG_INOTIFY_USER=y
@@ -986,12 +1012,12 @@ CONFIG_CRAMFS=y
986# CONFIG_ROMFS_FS is not set 1012# CONFIG_ROMFS_FS is not set
987# CONFIG_SYSV_FS is not set 1013# CONFIG_SYSV_FS is not set
988# CONFIG_UFS_FS is not set 1014# CONFIG_UFS_FS is not set
989# CONFIG_NILFS2_FS is not set
990CONFIG_NETWORK_FILESYSTEMS=y 1015CONFIG_NETWORK_FILESYSTEMS=y
991CONFIG_NFS_FS=y 1016CONFIG_NFS_FS=y
992CONFIG_NFS_V3=y 1017CONFIG_NFS_V3=y
993# CONFIG_NFS_V3_ACL is not set 1018# CONFIG_NFS_V3_ACL is not set
994CONFIG_NFS_V4=y 1019CONFIG_NFS_V4=y
1020# CONFIG_NFS_V4_1 is not set
995CONFIG_ROOT_NFS=y 1021CONFIG_ROOT_NFS=y
996# CONFIG_NFSD is not set 1022# CONFIG_NFSD is not set
997CONFIG_LOCKD=y 1023CONFIG_LOCKD=y
@@ -1091,6 +1117,7 @@ CONFIG_HAS_IOPORT=y
1091CONFIG_HAS_DMA=y 1117CONFIG_HAS_DMA=y
1092CONFIG_HAVE_LMB=y 1118CONFIG_HAVE_LMB=y
1093CONFIG_NLATTR=y 1119CONFIG_NLATTR=y
1120CONFIG_GENERIC_ATOMIC64=y
1094 1121
1095# 1122#
1096# Kernel hacking 1123# Kernel hacking
@@ -1100,6 +1127,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1100CONFIG_ENABLE_MUST_CHECK=y 1127CONFIG_ENABLE_MUST_CHECK=y
1101CONFIG_FRAME_WARN=1024 1128CONFIG_FRAME_WARN=1024
1102# CONFIG_MAGIC_SYSRQ is not set 1129# CONFIG_MAGIC_SYSRQ is not set
1130# CONFIG_STRIP_ASM_SYMS is not set
1103# CONFIG_UNUSED_SYMBOLS is not set 1131# CONFIG_UNUSED_SYMBOLS is not set
1104# CONFIG_DEBUG_FS is not set 1132# CONFIG_DEBUG_FS is not set
1105# CONFIG_HEADERS_CHECK is not set 1133# CONFIG_HEADERS_CHECK is not set
@@ -1117,10 +1145,14 @@ CONFIG_SCHED_DEBUG=y
1117# CONFIG_DEBUG_OBJECTS is not set 1145# CONFIG_DEBUG_OBJECTS is not set
1118# CONFIG_SLUB_DEBUG_ON is not set 1146# CONFIG_SLUB_DEBUG_ON is not set
1119# CONFIG_SLUB_STATS is not set 1147# CONFIG_SLUB_STATS is not set
1148# CONFIG_DEBUG_KMEMLEAK is not set
1120# CONFIG_DEBUG_RT_MUTEXES is not set 1149# CONFIG_DEBUG_RT_MUTEXES is not set
1121# CONFIG_RT_MUTEX_TESTER is not set 1150# CONFIG_RT_MUTEX_TESTER is not set
1122# CONFIG_DEBUG_SPINLOCK is not set 1151# CONFIG_DEBUG_SPINLOCK is not set
1123# CONFIG_DEBUG_MUTEXES is not set 1152# CONFIG_DEBUG_MUTEXES is not set
1153# CONFIG_DEBUG_LOCK_ALLOC is not set
1154# CONFIG_PROVE_LOCKING is not set
1155# CONFIG_LOCK_STAT is not set
1124# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1156# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1125# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1157# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1126# CONFIG_DEBUG_KOBJECT is not set 1158# CONFIG_DEBUG_KOBJECT is not set
@@ -1132,11 +1164,12 @@ CONFIG_DEBUG_INFO=y
1132# CONFIG_DEBUG_LIST is not set 1164# CONFIG_DEBUG_LIST is not set
1133# CONFIG_DEBUG_SG is not set 1165# CONFIG_DEBUG_SG is not set
1134# CONFIG_DEBUG_NOTIFIERS is not set 1166# CONFIG_DEBUG_NOTIFIERS is not set
1135# CONFIG_BOOT_PRINTK_DELAY is not set 1167# CONFIG_DEBUG_CREDENTIALS is not set
1136# CONFIG_RCU_TORTURE_TEST is not set 1168# CONFIG_RCU_TORTURE_TEST is not set
1137# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1169# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1138# CONFIG_BACKTRACE_SELF_TEST is not set 1170# CONFIG_BACKTRACE_SELF_TEST is not set
1139# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1171# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1172# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1140# CONFIG_FAULT_INJECTION is not set 1173# CONFIG_FAULT_INJECTION is not set
1141# CONFIG_LATENCYTOP is not set 1174# CONFIG_LATENCYTOP is not set
1142# CONFIG_DEBUG_PAGEALLOC is not set 1175# CONFIG_DEBUG_PAGEALLOC is not set
@@ -1145,23 +1178,25 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1145CONFIG_HAVE_DYNAMIC_FTRACE=y 1178CONFIG_HAVE_DYNAMIC_FTRACE=y
1146CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1179CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1147CONFIG_TRACING_SUPPORT=y 1180CONFIG_TRACING_SUPPORT=y
1148 1181CONFIG_FTRACE=y
1149#
1150# Tracers
1151#
1152# CONFIG_FUNCTION_TRACER is not set 1182# CONFIG_FUNCTION_TRACER is not set
1183# CONFIG_IRQSOFF_TRACER is not set
1153# CONFIG_SCHED_TRACER is not set 1184# CONFIG_SCHED_TRACER is not set
1154# CONFIG_CONTEXT_SWITCH_TRACER is not set 1185# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1155# CONFIG_EVENT_TRACER is not set
1156# CONFIG_BOOT_TRACER is not set 1186# CONFIG_BOOT_TRACER is not set
1157# CONFIG_TRACE_BRANCH_PROFILING is not set 1187CONFIG_BRANCH_PROFILE_NONE=y
1188# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1189# CONFIG_PROFILE_ALL_BRANCHES is not set
1158# CONFIG_STACK_TRACER is not set 1190# CONFIG_STACK_TRACER is not set
1159# CONFIG_KMEMTRACE is not set 1191# CONFIG_KMEMTRACE is not set
1160# CONFIG_WORKQUEUE_TRACER is not set 1192# CONFIG_WORKQUEUE_TRACER is not set
1161# CONFIG_BLK_DEV_IO_TRACE is not set 1193# CONFIG_BLK_DEV_IO_TRACE is not set
1194# CONFIG_DMA_API_DEBUG is not set
1162# CONFIG_SAMPLES is not set 1195# CONFIG_SAMPLES is not set
1163CONFIG_HAVE_ARCH_KGDB=y 1196CONFIG_HAVE_ARCH_KGDB=y
1164# CONFIG_KGDB is not set 1197# CONFIG_KGDB is not set
1198# CONFIG_PPC_DISABLE_WERROR is not set
1199CONFIG_PPC_WERROR=y
1165CONFIG_PRINT_STACK_DEPTH=64 1200CONFIG_PRINT_STACK_DEPTH=64
1166# CONFIG_DEBUG_STACKOVERFLOW is not set 1201# CONFIG_DEBUG_STACKOVERFLOW is not set
1167# CONFIG_DEBUG_STACK_USAGE is not set 1202# CONFIG_DEBUG_STACK_USAGE is not set
@@ -1186,7 +1221,6 @@ CONFIG_CRYPTO=y
1186# 1221#
1187# Crypto core or helper 1222# Crypto core or helper
1188# 1223#
1189# CONFIG_CRYPTO_FIPS is not set
1190CONFIG_CRYPTO_ALGAPI=y 1224CONFIG_CRYPTO_ALGAPI=y
1191CONFIG_CRYPTO_ALGAPI2=y 1225CONFIG_CRYPTO_ALGAPI2=y
1192CONFIG_CRYPTO_AEAD2=y 1226CONFIG_CRYPTO_AEAD2=y
@@ -1227,11 +1261,13 @@ CONFIG_CRYPTO_PCBC=y
1227# 1261#
1228# CONFIG_CRYPTO_HMAC is not set 1262# CONFIG_CRYPTO_HMAC is not set
1229# CONFIG_CRYPTO_XCBC is not set 1263# CONFIG_CRYPTO_XCBC is not set
1264# CONFIG_CRYPTO_VMAC is not set
1230 1265
1231# 1266#
1232# Digest 1267# Digest
1233# 1268#
1234# CONFIG_CRYPTO_CRC32C is not set 1269# CONFIG_CRYPTO_CRC32C is not set
1270# CONFIG_CRYPTO_GHASH is not set
1235# CONFIG_CRYPTO_MD4 is not set 1271# CONFIG_CRYPTO_MD4 is not set
1236CONFIG_CRYPTO_MD5=y 1272CONFIG_CRYPTO_MD5=y
1237# CONFIG_CRYPTO_MICHAEL_MIC is not set 1273# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/powerpc/configs/52xx/pcm030_defconfig b/arch/powerpc/configs/52xx/pcm030_defconfig
index afb1a3d1ef0a..f9168c1a2fa5 100644
--- a/arch/powerpc/configs/52xx/pcm030_defconfig
+++ b/arch/powerpc/configs/52xx/pcm030_defconfig
@@ -1,25 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc2 3# Linux kernel version: 2.6.32-rc4
4# Sat Apr 18 00:48:42 2009 4# Thu Oct 15 10:33:25 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
8# 8#
9# Processor support 9# Processor support
10# 10#
11CONFIG_6xx=y 11CONFIG_PPC_BOOK3S_32=y
12# CONFIG_PPC_85xx is not set 12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set 13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set 14# CONFIG_40x is not set
15# CONFIG_44x is not set 15# CONFIG_44x is not set
16# CONFIG_E200 is not set 16# CONFIG_E200 is not set
17CONFIG_PPC_BOOK3S=y 17CONFIG_PPC_BOOK3S=y
18CONFIG_6xx=y
18CONFIG_PPC_FPU=y 19CONFIG_PPC_FPU=y
19# CONFIG_ALTIVEC is not set 20# CONFIG_ALTIVEC is not set
20CONFIG_PPC_STD_MMU=y 21CONFIG_PPC_STD_MMU=y
21CONFIG_PPC_STD_MMU_32=y 22CONFIG_PPC_STD_MMU_32=y
22# CONFIG_PPC_MM_SLICES is not set 23# CONFIG_PPC_MM_SLICES is not set
24CONFIG_PPC_HAVE_PMU_SUPPORT=y
23# CONFIG_SMP is not set 25# CONFIG_SMP is not set
24CONFIG_PPC32=y 26CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32 27CONFIG_WORD_SIZE=32
@@ -30,15 +32,17 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 32CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 33CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 34CONFIG_GENERIC_HARDIRQS=y
35CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 36# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
37# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
34CONFIG_IRQ_PER_CPU=y 38CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y 39CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y 40CONFIG_HAVE_LATENCYTOP_SUPPORT=y
41CONFIG_TRACE_IRQFLAGS_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y 42CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y 43CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y 44CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y 45CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y 46CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set 47# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y 48CONFIG_PPC=y
@@ -52,11 +56,13 @@ CONFIG_OF=y
52# CONFIG_GENERIC_TBSYNC is not set 56# CONFIG_GENERIC_TBSYNC is not set
53CONFIG_AUDIT_ARCH=y 57CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y 58CONFIG_GENERIC_BUG=y
59CONFIG_DTC=y
55CONFIG_DEFAULT_UIMAGE=y 60CONFIG_DEFAULT_UIMAGE=y
56# CONFIG_PPC_DCR_NATIVE is not set 61# CONFIG_PPC_DCR_NATIVE is not set
57# CONFIG_PPC_DCR_MMIO is not set 62# CONFIG_PPC_DCR_MMIO is not set
58CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 63CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
59CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 64CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
65CONFIG_CONSTRUCTORS=y
60 66
61# 67#
62# General setup 68# General setup
@@ -79,11 +85,12 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
79# 85#
80# RCU Subsystem 86# RCU Subsystem
81# 87#
82CONFIG_CLASSIC_RCU=y 88CONFIG_TREE_RCU=y
83# CONFIG_TREE_RCU is not set 89# CONFIG_TREE_PREEMPT_RCU is not set
84# CONFIG_PREEMPT_RCU is not set 90# CONFIG_RCU_TRACE is not set
91CONFIG_RCU_FANOUT=32
92# CONFIG_RCU_FANOUT_EXACT is not set
85# CONFIG_TREE_RCU_TRACE is not set 93# CONFIG_TREE_RCU_TRACE is not set
86# CONFIG_PREEMPT_RCU_TRACE is not set
87CONFIG_IKCONFIG=y 94CONFIG_IKCONFIG=y
88CONFIG_IKCONFIG_PROC=y 95CONFIG_IKCONFIG_PROC=y
89CONFIG_LOG_BUF_SHIFT=14 96CONFIG_LOG_BUF_SHIFT=14
@@ -105,7 +112,6 @@ CONFIG_EMBEDDED=y
105# CONFIG_SYSCTL_SYSCALL is not set 112# CONFIG_SYSCTL_SYSCALL is not set
106CONFIG_KALLSYMS=y 113CONFIG_KALLSYMS=y
107# CONFIG_KALLSYMS_EXTRA_PASS is not set 114# CONFIG_KALLSYMS_EXTRA_PASS is not set
108# CONFIG_STRIP_ASM_SYMS is not set
109CONFIG_HOTPLUG=y 115CONFIG_HOTPLUG=y
110CONFIG_PRINTK=y 116CONFIG_PRINTK=y
111CONFIG_BUG=y 117CONFIG_BUG=y
@@ -118,6 +124,13 @@ CONFIG_TIMERFD=y
118CONFIG_EVENTFD=y 124CONFIG_EVENTFD=y
119CONFIG_SHMEM=y 125CONFIG_SHMEM=y
120CONFIG_AIO=y 126CONFIG_AIO=y
127CONFIG_HAVE_PERF_EVENTS=y
128
129#
130# Kernel Performance Events And Counters
131#
132# CONFIG_PERF_EVENTS is not set
133# CONFIG_PERF_COUNTERS is not set
121# CONFIG_VM_EVENT_COUNTERS is not set 134# CONFIG_VM_EVENT_COUNTERS is not set
122CONFIG_PCI_QUIRKS=y 135CONFIG_PCI_QUIRKS=y
123CONFIG_COMPAT_BRK=y 136CONFIG_COMPAT_BRK=y
@@ -125,7 +138,6 @@ CONFIG_SLAB=y
125# CONFIG_SLUB is not set 138# CONFIG_SLUB is not set
126# CONFIG_SLOB is not set 139# CONFIG_SLOB is not set
127# CONFIG_PROFILING is not set 140# CONFIG_PROFILING is not set
128# CONFIG_MARKERS is not set
129CONFIG_HAVE_OPROFILE=y 141CONFIG_HAVE_OPROFILE=y
130# CONFIG_KPROBES is not set 142# CONFIG_KPROBES is not set
131CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 143CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -133,7 +145,13 @@ CONFIG_HAVE_IOREMAP_PROT=y
133CONFIG_HAVE_KPROBES=y 145CONFIG_HAVE_KPROBES=y
134CONFIG_HAVE_KRETPROBES=y 146CONFIG_HAVE_KRETPROBES=y
135CONFIG_HAVE_ARCH_TRACEHOOK=y 147CONFIG_HAVE_ARCH_TRACEHOOK=y
148CONFIG_HAVE_DMA_ATTRS=y
136CONFIG_HAVE_CLK=y 149CONFIG_HAVE_CLK=y
150CONFIG_HAVE_DMA_API_DEBUG=y
151
152#
153# GCOV-based kernel profiling
154#
137# CONFIG_SLOW_WORK is not set 155# CONFIG_SLOW_WORK is not set
138# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 156# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
139CONFIG_SLABINFO=y 157CONFIG_SLABINFO=y
@@ -146,7 +164,7 @@ CONFIG_MODULE_UNLOAD=y
146# CONFIG_MODVERSIONS is not set 164# CONFIG_MODVERSIONS is not set
147# CONFIG_MODULE_SRCVERSION_ALL is not set 165# CONFIG_MODULE_SRCVERSION_ALL is not set
148CONFIG_BLOCK=y 166CONFIG_BLOCK=y
149# CONFIG_LBD is not set 167CONFIG_LBDAF=y
150# CONFIG_BLK_DEV_BSG is not set 168# CONFIG_BLK_DEV_BSG is not set
151# CONFIG_BLK_DEV_INTEGRITY is not set 169# CONFIG_BLK_DEV_INTEGRITY is not set
152 170
@@ -227,11 +245,13 @@ CONFIG_BINFMT_ELF=y
227# CONFIG_HAVE_AOUT is not set 245# CONFIG_HAVE_AOUT is not set
228# CONFIG_BINFMT_MISC is not set 246# CONFIG_BINFMT_MISC is not set
229# CONFIG_IOMMU_HELPER is not set 247# CONFIG_IOMMU_HELPER is not set
248# CONFIG_SWIOTLB is not set
230CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 249CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
231CONFIG_ARCH_HAS_WALK_MEMORY=y 250CONFIG_ARCH_HAS_WALK_MEMORY=y
232CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y 251CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
233# CONFIG_KEXEC is not set 252# CONFIG_KEXEC is not set
234# CONFIG_CRASH_DUMP is not set 253# CONFIG_CRASH_DUMP is not set
254CONFIG_MAX_ACTIVE_REGIONS=32
235CONFIG_ARCH_FLATMEM_ENABLE=y 255CONFIG_ARCH_FLATMEM_ENABLE=y
236CONFIG_ARCH_POPULATES_NODE_MAP=y 256CONFIG_ARCH_POPULATES_NODE_MAP=y
237CONFIG_SELECT_MEMORY_MODEL=y 257CONFIG_SELECT_MEMORY_MODEL=y
@@ -247,9 +267,10 @@ CONFIG_MIGRATION=y
247CONFIG_ZONE_DMA_FLAG=1 267CONFIG_ZONE_DMA_FLAG=1
248CONFIG_BOUNCE=y 268CONFIG_BOUNCE=y
249CONFIG_VIRT_TO_BUS=y 269CONFIG_VIRT_TO_BUS=y
250CONFIG_UNEVICTABLE_LRU=y
251CONFIG_HAVE_MLOCK=y 270CONFIG_HAVE_MLOCK=y
252CONFIG_HAVE_MLOCKED_PAGE_BIT=y 271CONFIG_HAVE_MLOCKED_PAGE_BIT=y
272# CONFIG_KSM is not set
273CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
253CONFIG_PPC_4K_PAGES=y 274CONFIG_PPC_4K_PAGES=y
254# CONFIG_PPC_16K_PAGES is not set 275# CONFIG_PPC_16K_PAGES is not set
255# CONFIG_PPC_64K_PAGES is not set 276# CONFIG_PPC_64K_PAGES is not set
@@ -336,6 +357,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
336# CONFIG_NETFILTER is not set 357# CONFIG_NETFILTER is not set
337# CONFIG_IP_DCCP is not set 358# CONFIG_IP_DCCP is not set
338# CONFIG_IP_SCTP is not set 359# CONFIG_IP_SCTP is not set
360# CONFIG_RDS is not set
339# CONFIG_TIPC is not set 361# CONFIG_TIPC is not set
340# CONFIG_ATM is not set 362# CONFIG_ATM is not set
341# CONFIG_BRIDGE is not set 363# CONFIG_BRIDGE is not set
@@ -350,6 +372,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
350# CONFIG_ECONET is not set 372# CONFIG_ECONET is not set
351# CONFIG_WAN_ROUTER is not set 373# CONFIG_WAN_ROUTER is not set
352# CONFIG_PHONET is not set 374# CONFIG_PHONET is not set
375# CONFIG_IEEE802154 is not set
353# CONFIG_NET_SCHED is not set 376# CONFIG_NET_SCHED is not set
354# CONFIG_DCB is not set 377# CONFIG_DCB is not set
355 378
@@ -375,6 +398,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
375# Generic Driver Options 398# Generic Driver Options
376# 399#
377CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 400CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
401# CONFIG_DEVTMPFS is not set
378CONFIG_STANDALONE=y 402CONFIG_STANDALONE=y
379CONFIG_PREVENT_FIRMWARE_BUILD=y 403CONFIG_PREVENT_FIRMWARE_BUILD=y
380# CONFIG_FW_LOADER is not set 404# CONFIG_FW_LOADER is not set
@@ -382,9 +406,9 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
382# CONFIG_CONNECTOR is not set 406# CONFIG_CONNECTOR is not set
383CONFIG_MTD=y 407CONFIG_MTD=y
384# CONFIG_MTD_DEBUG is not set 408# CONFIG_MTD_DEBUG is not set
409# CONFIG_MTD_TESTS is not set
385# CONFIG_MTD_CONCAT is not set 410# CONFIG_MTD_CONCAT is not set
386CONFIG_MTD_PARTITIONS=y 411CONFIG_MTD_PARTITIONS=y
387# CONFIG_MTD_TESTS is not set
388# CONFIG_MTD_REDBOOT_PARTS is not set 412# CONFIG_MTD_REDBOOT_PARTS is not set
389CONFIG_MTD_CMDLINE_PARTS=y 413CONFIG_MTD_CMDLINE_PARTS=y
390# CONFIG_MTD_OF_PARTS is not set 414# CONFIG_MTD_OF_PARTS is not set
@@ -467,6 +491,7 @@ CONFIG_MTD_PHYSMAP=y
467# CONFIG_MTD_UBI is not set 491# CONFIG_MTD_UBI is not set
468CONFIG_OF_DEVICE=y 492CONFIG_OF_DEVICE=y
469CONFIG_OF_I2C=y 493CONFIG_OF_I2C=y
494CONFIG_OF_MDIO=y
470# CONFIG_PARPORT is not set 495# CONFIG_PARPORT is not set
471# CONFIG_BLK_DEV is not set 496# CONFIG_BLK_DEV is not set
472# CONFIG_MISC_DEVICES is not set 497# CONFIG_MISC_DEVICES is not set
@@ -492,10 +517,6 @@ CONFIG_BLK_DEV_SD=m
492# CONFIG_BLK_DEV_SR is not set 517# CONFIG_BLK_DEV_SR is not set
493# CONFIG_CHR_DEV_SG is not set 518# CONFIG_CHR_DEV_SG is not set
494# CONFIG_CHR_DEV_SCH is not set 519# CONFIG_CHR_DEV_SCH is not set
495
496#
497# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
498#
499# CONFIG_SCSI_MULTI_LUN is not set 520# CONFIG_SCSI_MULTI_LUN is not set
500# CONFIG_SCSI_CONSTANTS is not set 521# CONFIG_SCSI_CONSTANTS is not set
501# CONFIG_SCSI_LOGGING is not set 522# CONFIG_SCSI_LOGGING is not set
@@ -515,6 +536,7 @@ CONFIG_SCSI_WAIT_SCAN=m
515# CONFIG_SCSI_OSD_INITIATOR is not set 536# CONFIG_SCSI_OSD_INITIATOR is not set
516CONFIG_ATA=m 537CONFIG_ATA=m
517# CONFIG_ATA_NONSTANDARD is not set 538# CONFIG_ATA_NONSTANDARD is not set
539CONFIG_ATA_VERBOSE_ERROR=y
518CONFIG_SATA_PMP=y 540CONFIG_SATA_PMP=y
519# CONFIG_SATA_AHCI is not set 541# CONFIG_SATA_AHCI is not set
520# CONFIG_SATA_SIL24 is not set 542# CONFIG_SATA_SIL24 is not set
@@ -536,6 +558,7 @@ CONFIG_ATA_SFF=y
536# CONFIG_PATA_ALI is not set 558# CONFIG_PATA_ALI is not set
537# CONFIG_PATA_AMD is not set 559# CONFIG_PATA_AMD is not set
538# CONFIG_PATA_ARTOP is not set 560# CONFIG_PATA_ARTOP is not set
561# CONFIG_PATA_ATP867X is not set
539# CONFIG_PATA_ATIIXP is not set 562# CONFIG_PATA_ATIIXP is not set
540# CONFIG_PATA_CMD640_PCI is not set 563# CONFIG_PATA_CMD640_PCI is not set
541# CONFIG_PATA_CMD64X is not set 564# CONFIG_PATA_CMD64X is not set
@@ -564,6 +587,7 @@ CONFIG_PATA_MPC52xx=m
564# CONFIG_PATA_OPTIDMA is not set 587# CONFIG_PATA_OPTIDMA is not set
565# CONFIG_PATA_PDC_OLD is not set 588# CONFIG_PATA_PDC_OLD is not set
566# CONFIG_PATA_RADISYS is not set 589# CONFIG_PATA_RADISYS is not set
590# CONFIG_PATA_RDC is not set
567# CONFIG_PATA_RZ1000 is not set 591# CONFIG_PATA_RZ1000 is not set
568# CONFIG_PATA_SC1200 is not set 592# CONFIG_PATA_SC1200 is not set
569# CONFIG_PATA_SERVERWORKS is not set 593# CONFIG_PATA_SERVERWORKS is not set
@@ -582,14 +606,17 @@ CONFIG_PATA_MPC52xx=m
582# 606#
583 607
584# 608#
585# Enable only one of the two stacks, unless you know what you are doing 609# You can enable one or both FireWire driver stacks.
610#
611
612#
613# See the help texts for more information.
586# 614#
587# CONFIG_FIREWIRE is not set 615# CONFIG_FIREWIRE is not set
588# CONFIG_IEEE1394 is not set 616# CONFIG_IEEE1394 is not set
589# CONFIG_I2O is not set 617# CONFIG_I2O is not set
590# CONFIG_MACINTOSH_DRIVERS is not set 618# CONFIG_MACINTOSH_DRIVERS is not set
591CONFIG_NETDEVICES=y 619CONFIG_NETDEVICES=y
592CONFIG_COMPAT_NET_DEV_OPS=y
593# CONFIG_DUMMY is not set 620# CONFIG_DUMMY is not set
594# CONFIG_BONDING is not set 621# CONFIG_BONDING is not set
595# CONFIG_MACVLAN is not set 622# CONFIG_MACVLAN is not set
@@ -636,16 +663,16 @@ CONFIG_MII=y
636# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 663# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
637# CONFIG_NET_PCI is not set 664# CONFIG_NET_PCI is not set
638# CONFIG_B44 is not set 665# CONFIG_B44 is not set
666# CONFIG_KS8842 is not set
667# CONFIG_KS8851_MLL is not set
639CONFIG_FEC_MPC52xx=y 668CONFIG_FEC_MPC52xx=y
640CONFIG_FEC_MPC52xx_MDIO=y 669CONFIG_FEC_MPC52xx_MDIO=y
641# CONFIG_ATL2 is not set 670# CONFIG_ATL2 is not set
671# CONFIG_XILINX_EMACLITE is not set
642# CONFIG_NETDEV_1000 is not set 672# CONFIG_NETDEV_1000 is not set
643# CONFIG_NETDEV_10000 is not set 673# CONFIG_NETDEV_10000 is not set
644# CONFIG_TR is not set 674# CONFIG_TR is not set
645 675CONFIG_WLAN=y
646#
647# Wireless LAN
648#
649# CONFIG_WLAN_PRE80211 is not set 676# CONFIG_WLAN_PRE80211 is not set
650# CONFIG_WLAN_80211 is not set 677# CONFIG_WLAN_80211 is not set
651 678
@@ -722,6 +749,7 @@ CONFIG_HW_RANDOM=y
722CONFIG_DEVPORT=y 749CONFIG_DEVPORT=y
723CONFIG_I2C=y 750CONFIG_I2C=y
724CONFIG_I2C_BOARDINFO=y 751CONFIG_I2C_BOARDINFO=y
752CONFIG_I2C_COMPAT=y
725CONFIG_I2C_CHARDEV=y 753CONFIG_I2C_CHARDEV=y
726CONFIG_I2C_HELPER_AUTO=y 754CONFIG_I2C_HELPER_AUTO=y
727 755
@@ -750,6 +778,7 @@ CONFIG_I2C_HELPER_AUTO=y
750# 778#
751# I2C system bus drivers (mostly embedded / system-on-chip) 779# I2C system bus drivers (mostly embedded / system-on-chip)
752# 780#
781# CONFIG_I2C_DESIGNWARE is not set
753CONFIG_I2C_MPC=y 782CONFIG_I2C_MPC=y
754# CONFIG_I2C_OCORES is not set 783# CONFIG_I2C_OCORES is not set
755# CONFIG_I2C_SIMTEC is not set 784# CONFIG_I2C_SIMTEC is not set
@@ -776,23 +805,23 @@ CONFIG_I2C_MPC=y
776# Miscellaneous I2C Chip support 805# Miscellaneous I2C Chip support
777# 806#
778# CONFIG_DS1682 is not set 807# CONFIG_DS1682 is not set
779# CONFIG_SENSORS_PCF8574 is not set
780# CONFIG_PCF8575 is not set
781# CONFIG_SENSORS_PCA9539 is not set
782# CONFIG_SENSORS_MAX6875 is not set
783# CONFIG_SENSORS_TSL2550 is not set 808# CONFIG_SENSORS_TSL2550 is not set
784# CONFIG_I2C_DEBUG_CORE is not set 809# CONFIG_I2C_DEBUG_CORE is not set
785# CONFIG_I2C_DEBUG_ALGO is not set 810# CONFIG_I2C_DEBUG_ALGO is not set
786# CONFIG_I2C_DEBUG_BUS is not set 811# CONFIG_I2C_DEBUG_BUS is not set
787# CONFIG_I2C_DEBUG_CHIP is not set 812# CONFIG_I2C_DEBUG_CHIP is not set
788# CONFIG_SPI is not set 813# CONFIG_SPI is not set
814
815#
816# PPS support
817#
818# CONFIG_PPS is not set
789CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 819CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
790# CONFIG_GPIOLIB is not set 820# CONFIG_GPIOLIB is not set
791# CONFIG_W1 is not set 821# CONFIG_W1 is not set
792# CONFIG_POWER_SUPPLY is not set 822# CONFIG_POWER_SUPPLY is not set
793# CONFIG_HWMON is not set 823# CONFIG_HWMON is not set
794# CONFIG_THERMAL is not set 824# CONFIG_THERMAL is not set
795# CONFIG_THERMAL_HWMON is not set
796# CONFIG_WATCHDOG is not set 825# CONFIG_WATCHDOG is not set
797CONFIG_SSB_POSSIBLE=y 826CONFIG_SSB_POSSIBLE=y
798 827
@@ -811,30 +840,18 @@ CONFIG_SSB_POSSIBLE=y
811# CONFIG_MFD_TMIO is not set 840# CONFIG_MFD_TMIO is not set
812# CONFIG_PMIC_DA903X is not set 841# CONFIG_PMIC_DA903X is not set
813# CONFIG_MFD_WM8400 is not set 842# CONFIG_MFD_WM8400 is not set
843# CONFIG_MFD_WM831X is not set
814# CONFIG_MFD_WM8350_I2C is not set 844# CONFIG_MFD_WM8350_I2C is not set
815# CONFIG_MFD_PCF50633 is not set 845# CONFIG_MFD_PCF50633 is not set
846# CONFIG_AB3100_CORE is not set
816# CONFIG_REGULATOR is not set 847# CONFIG_REGULATOR is not set
817 848# CONFIG_MEDIA_SUPPORT is not set
818#
819# Multimedia devices
820#
821
822#
823# Multimedia core support
824#
825# CONFIG_VIDEO_DEV is not set
826# CONFIG_DVB_CORE is not set
827# CONFIG_VIDEO_MEDIA is not set
828
829#
830# Multimedia drivers
831#
832# CONFIG_DAB is not set
833 849
834# 850#
835# Graphics support 851# Graphics support
836# 852#
837# CONFIG_AGP is not set 853# CONFIG_AGP is not set
854CONFIG_VGA_ARB=y
838# CONFIG_DRM is not set 855# CONFIG_DRM is not set
839# CONFIG_VGASTATE is not set 856# CONFIG_VGASTATE is not set
840# CONFIG_VIDEO_OUTPUT_CONTROL is not set 857# CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -871,15 +888,17 @@ CONFIG_USB_DEVICEFS=y
871# USB Host Controller Drivers 888# USB Host Controller Drivers
872# 889#
873# CONFIG_USB_C67X00_HCD is not set 890# CONFIG_USB_C67X00_HCD is not set
891# CONFIG_USB_XHCI_HCD is not set
874# CONFIG_USB_EHCI_HCD is not set 892# CONFIG_USB_EHCI_HCD is not set
875# CONFIG_USB_OXU210HP_HCD is not set 893# CONFIG_USB_OXU210HP_HCD is not set
876# CONFIG_USB_ISP116X_HCD is not set 894# CONFIG_USB_ISP116X_HCD is not set
877# CONFIG_USB_ISP1760_HCD is not set 895# CONFIG_USB_ISP1760_HCD is not set
896# CONFIG_USB_ISP1362_HCD is not set
878CONFIG_USB_OHCI_HCD=m 897CONFIG_USB_OHCI_HCD=m
879# CONFIG_USB_OHCI_HCD_PPC_SOC is not set 898# CONFIG_USB_OHCI_HCD_PPC_SOC is not set
880CONFIG_USB_OHCI_HCD_PPC_OF=y
881CONFIG_USB_OHCI_HCD_PPC_OF_BE=y 899CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
882# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set 900# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
901CONFIG_USB_OHCI_HCD_PPC_OF=y
883# CONFIG_USB_OHCI_HCD_PCI is not set 902# CONFIG_USB_OHCI_HCD_PCI is not set
884CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y 903CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
885CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y 904CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
@@ -995,6 +1014,7 @@ CONFIG_RTC_DRV_PCF8563=m
995# CONFIG_RTC_DRV_S35390A is not set 1014# CONFIG_RTC_DRV_S35390A is not set
996# CONFIG_RTC_DRV_FM3130 is not set 1015# CONFIG_RTC_DRV_FM3130 is not set
997# CONFIG_RTC_DRV_RX8581 is not set 1016# CONFIG_RTC_DRV_RX8581 is not set
1017# CONFIG_RTC_DRV_RX8025 is not set
998 1018
999# 1019#
1000# SPI RTC drivers 1020# SPI RTC drivers
@@ -1022,6 +1042,10 @@ CONFIG_RTC_DRV_PCF8563=m
1022# CONFIG_DMADEVICES is not set 1042# CONFIG_DMADEVICES is not set
1023# CONFIG_AUXDISPLAY is not set 1043# CONFIG_AUXDISPLAY is not set
1024# CONFIG_UIO is not set 1044# CONFIG_UIO is not set
1045
1046#
1047# TI VLYNQ
1048#
1025# CONFIG_STAGING is not set 1049# CONFIG_STAGING is not set
1026 1050
1027# 1051#
@@ -1041,12 +1065,16 @@ CONFIG_FS_MBCACHE=m
1041# CONFIG_REISERFS_FS is not set 1065# CONFIG_REISERFS_FS is not set
1042# CONFIG_JFS_FS is not set 1066# CONFIG_JFS_FS is not set
1043# CONFIG_FS_POSIX_ACL is not set 1067# CONFIG_FS_POSIX_ACL is not set
1044CONFIG_FILE_LOCKING=y
1045# CONFIG_XFS_FS is not set 1068# CONFIG_XFS_FS is not set
1069# CONFIG_GFS2_FS is not set
1046# CONFIG_OCFS2_FS is not set 1070# CONFIG_OCFS2_FS is not set
1047# CONFIG_BTRFS_FS is not set 1071# CONFIG_BTRFS_FS is not set
1072# CONFIG_NILFS2_FS is not set
1073CONFIG_FILE_LOCKING=y
1074CONFIG_FSNOTIFY=y
1048# CONFIG_DNOTIFY is not set 1075# CONFIG_DNOTIFY is not set
1049# CONFIG_INOTIFY is not set 1076# CONFIG_INOTIFY is not set
1077CONFIG_INOTIFY_USER=y
1050# CONFIG_QUOTA is not set 1078# CONFIG_QUOTA is not set
1051# CONFIG_AUTOFS_FS is not set 1079# CONFIG_AUTOFS_FS is not set
1052# CONFIG_AUTOFS4_FS is not set 1080# CONFIG_AUTOFS4_FS is not set
@@ -1114,7 +1142,6 @@ CONFIG_JFFS2_RTIME=y
1114# CONFIG_ROMFS_FS is not set 1142# CONFIG_ROMFS_FS is not set
1115# CONFIG_SYSV_FS is not set 1143# CONFIG_SYSV_FS is not set
1116# CONFIG_UFS_FS is not set 1144# CONFIG_UFS_FS is not set
1117# CONFIG_NILFS2_FS is not set
1118CONFIG_NETWORK_FILESYSTEMS=y 1145CONFIG_NETWORK_FILESYSTEMS=y
1119CONFIG_NFS_FS=y 1146CONFIG_NFS_FS=y
1120CONFIG_NFS_V3=y 1147CONFIG_NFS_V3=y
@@ -1201,6 +1228,7 @@ CONFIG_HAS_IOPORT=y
1201CONFIG_HAS_DMA=y 1228CONFIG_HAS_DMA=y
1202CONFIG_HAVE_LMB=y 1229CONFIG_HAVE_LMB=y
1203CONFIG_NLATTR=y 1230CONFIG_NLATTR=y
1231CONFIG_GENERIC_ATOMIC64=y
1204 1232
1205# 1233#
1206# Kernel hacking 1234# Kernel hacking
@@ -1210,6 +1238,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1210CONFIG_ENABLE_MUST_CHECK=y 1238CONFIG_ENABLE_MUST_CHECK=y
1211CONFIG_FRAME_WARN=1024 1239CONFIG_FRAME_WARN=1024
1212# CONFIG_MAGIC_SYSRQ is not set 1240# CONFIG_MAGIC_SYSRQ is not set
1241# CONFIG_STRIP_ASM_SYMS is not set
1213# CONFIG_UNUSED_SYMBOLS is not set 1242# CONFIG_UNUSED_SYMBOLS is not set
1214# CONFIG_DEBUG_FS is not set 1243# CONFIG_DEBUG_FS is not set
1215# CONFIG_HEADERS_CHECK is not set 1244# CONFIG_HEADERS_CHECK is not set
@@ -1223,23 +1252,12 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1223CONFIG_HAVE_DYNAMIC_FTRACE=y 1252CONFIG_HAVE_DYNAMIC_FTRACE=y
1224CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1253CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1225CONFIG_TRACING_SUPPORT=y 1254CONFIG_TRACING_SUPPORT=y
1226 1255# CONFIG_FTRACE is not set
1227# 1256# CONFIG_DMA_API_DEBUG is not set
1228# Tracers
1229#
1230# CONFIG_FUNCTION_TRACER is not set
1231# CONFIG_PREEMPT_TRACER is not set
1232# CONFIG_SCHED_TRACER is not set
1233# CONFIG_CONTEXT_SWITCH_TRACER is not set
1234# CONFIG_EVENT_TRACER is not set
1235# CONFIG_BOOT_TRACER is not set
1236# CONFIG_TRACE_BRANCH_PROFILING is not set
1237# CONFIG_STACK_TRACER is not set
1238# CONFIG_KMEMTRACE is not set
1239# CONFIG_WORKQUEUE_TRACER is not set
1240# CONFIG_BLK_DEV_IO_TRACE is not set
1241# CONFIG_SAMPLES is not set 1257# CONFIG_SAMPLES is not set
1242CONFIG_HAVE_ARCH_KGDB=y 1258CONFIG_HAVE_ARCH_KGDB=y
1259# CONFIG_PPC_DISABLE_WERROR is not set
1260CONFIG_PPC_WERROR=y
1243CONFIG_PRINT_STACK_DEPTH=64 1261CONFIG_PRINT_STACK_DEPTH=64
1244# CONFIG_IRQSTACKS is not set 1262# CONFIG_IRQSTACKS is not set
1245# CONFIG_BOOTX_TEXT is not set 1263# CONFIG_BOOTX_TEXT is not set
diff --git a/arch/powerpc/configs/52xx/tqm5200_defconfig b/arch/powerpc/configs/52xx/tqm5200_defconfig
index 8585c7c12861..75c835c2ae66 100644
--- a/arch/powerpc/configs/52xx/tqm5200_defconfig
+++ b/arch/powerpc/configs/52xx/tqm5200_defconfig
@@ -1,25 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc2 3# Linux kernel version: 2.6.32-rc4
4# Sat Apr 18 00:48:57 2009 4# Thu Oct 15 10:33:23 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
8# 8#
9# Processor support 9# Processor support
10# 10#
11CONFIG_6xx=y 11CONFIG_PPC_BOOK3S_32=y
12# CONFIG_PPC_85xx is not set 12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set 13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set 14# CONFIG_40x is not set
15# CONFIG_44x is not set 15# CONFIG_44x is not set
16# CONFIG_E200 is not set 16# CONFIG_E200 is not set
17CONFIG_PPC_BOOK3S=y 17CONFIG_PPC_BOOK3S=y
18CONFIG_6xx=y
18CONFIG_PPC_FPU=y 19CONFIG_PPC_FPU=y
19# CONFIG_ALTIVEC is not set 20# CONFIG_ALTIVEC is not set
20CONFIG_PPC_STD_MMU=y 21CONFIG_PPC_STD_MMU=y
21CONFIG_PPC_STD_MMU_32=y 22CONFIG_PPC_STD_MMU_32=y
22# CONFIG_PPC_MM_SLICES is not set 23# CONFIG_PPC_MM_SLICES is not set
24CONFIG_PPC_HAVE_PMU_SUPPORT=y
23# CONFIG_SMP is not set 25# CONFIG_SMP is not set
24CONFIG_PPC32=y 26CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32 27CONFIG_WORD_SIZE=32
@@ -30,15 +32,17 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 32CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 33CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 34CONFIG_GENERIC_HARDIRQS=y
35CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 36# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
37# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
34CONFIG_IRQ_PER_CPU=y 38CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y 39CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y 40CONFIG_HAVE_LATENCYTOP_SUPPORT=y
41CONFIG_TRACE_IRQFLAGS_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y 42CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y 43CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y 44CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y 45CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y 46CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set 47# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y 48CONFIG_PPC=y
@@ -52,11 +56,13 @@ CONFIG_OF=y
52# CONFIG_GENERIC_TBSYNC is not set 56# CONFIG_GENERIC_TBSYNC is not set
53CONFIG_AUDIT_ARCH=y 57CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y 58CONFIG_GENERIC_BUG=y
59CONFIG_DTC=y
55CONFIG_DEFAULT_UIMAGE=y 60CONFIG_DEFAULT_UIMAGE=y
56# CONFIG_PPC_DCR_NATIVE is not set 61# CONFIG_PPC_DCR_NATIVE is not set
57# CONFIG_PPC_DCR_MMIO is not set 62# CONFIG_PPC_DCR_MMIO is not set
58CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 63CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
59CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 64CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
65CONFIG_CONSTRUCTORS=y
60 66
61# 67#
62# General setup 68# General setup
@@ -77,11 +83,12 @@ CONFIG_SYSVIPC_SYSCTL=y
77# 83#
78# RCU Subsystem 84# RCU Subsystem
79# 85#
80CONFIG_CLASSIC_RCU=y 86CONFIG_TREE_RCU=y
81# CONFIG_TREE_RCU is not set 87# CONFIG_TREE_PREEMPT_RCU is not set
82# CONFIG_PREEMPT_RCU is not set 88# CONFIG_RCU_TRACE is not set
89CONFIG_RCU_FANOUT=32
90# CONFIG_RCU_FANOUT_EXACT is not set
83# CONFIG_TREE_RCU_TRACE is not set 91# CONFIG_TREE_RCU_TRACE is not set
84# CONFIG_PREEMPT_RCU_TRACE is not set
85# CONFIG_IKCONFIG is not set 92# CONFIG_IKCONFIG is not set
86CONFIG_LOG_BUF_SHIFT=14 93CONFIG_LOG_BUF_SHIFT=14
87CONFIG_GROUP_SCHED=y 94CONFIG_GROUP_SCHED=y
@@ -105,7 +112,6 @@ CONFIG_ANON_INODES=y
105CONFIG_EMBEDDED=y 112CONFIG_EMBEDDED=y
106# CONFIG_SYSCTL_SYSCALL is not set 113# CONFIG_SYSCTL_SYSCALL is not set
107# CONFIG_KALLSYMS is not set 114# CONFIG_KALLSYMS is not set
108# CONFIG_STRIP_ASM_SYMS is not set
109CONFIG_HOTPLUG=y 115CONFIG_HOTPLUG=y
110CONFIG_PRINTK=y 116CONFIG_PRINTK=y
111CONFIG_BUG=y 117CONFIG_BUG=y
@@ -118,6 +124,13 @@ CONFIG_TIMERFD=y
118CONFIG_EVENTFD=y 124CONFIG_EVENTFD=y
119CONFIG_SHMEM=y 125CONFIG_SHMEM=y
120CONFIG_AIO=y 126CONFIG_AIO=y
127CONFIG_HAVE_PERF_EVENTS=y
128
129#
130# Kernel Performance Events And Counters
131#
132# CONFIG_PERF_EVENTS is not set
133# CONFIG_PERF_COUNTERS is not set
121CONFIG_VM_EVENT_COUNTERS=y 134CONFIG_VM_EVENT_COUNTERS=y
122CONFIG_SLUB_DEBUG=y 135CONFIG_SLUB_DEBUG=y
123CONFIG_COMPAT_BRK=y 136CONFIG_COMPAT_BRK=y
@@ -125,14 +138,19 @@ CONFIG_COMPAT_BRK=y
125CONFIG_SLUB=y 138CONFIG_SLUB=y
126# CONFIG_SLOB is not set 139# CONFIG_SLOB is not set
127# CONFIG_PROFILING is not set 140# CONFIG_PROFILING is not set
128# CONFIG_MARKERS is not set
129CONFIG_HAVE_OPROFILE=y 141CONFIG_HAVE_OPROFILE=y
130CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 142CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
131CONFIG_HAVE_IOREMAP_PROT=y 143CONFIG_HAVE_IOREMAP_PROT=y
132CONFIG_HAVE_KPROBES=y 144CONFIG_HAVE_KPROBES=y
133CONFIG_HAVE_KRETPROBES=y 145CONFIG_HAVE_KRETPROBES=y
134CONFIG_HAVE_ARCH_TRACEHOOK=y 146CONFIG_HAVE_ARCH_TRACEHOOK=y
147CONFIG_HAVE_DMA_ATTRS=y
135CONFIG_HAVE_CLK=y 148CONFIG_HAVE_CLK=y
149CONFIG_HAVE_DMA_API_DEBUG=y
150
151#
152# GCOV-based kernel profiling
153#
136# CONFIG_SLOW_WORK is not set 154# CONFIG_SLOW_WORK is not set
137# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 155# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
138CONFIG_SLABINFO=y 156CONFIG_SLABINFO=y
@@ -145,7 +163,7 @@ CONFIG_MODULE_UNLOAD=y
145CONFIG_MODVERSIONS=y 163CONFIG_MODVERSIONS=y
146# CONFIG_MODULE_SRCVERSION_ALL is not set 164# CONFIG_MODULE_SRCVERSION_ALL is not set
147CONFIG_BLOCK=y 165CONFIG_BLOCK=y
148# CONFIG_LBD is not set 166CONFIG_LBDAF=y
149# CONFIG_BLK_DEV_BSG is not set 167# CONFIG_BLK_DEV_BSG is not set
150# CONFIG_BLK_DEV_INTEGRITY is not set 168# CONFIG_BLK_DEV_INTEGRITY is not set
151 169
@@ -225,11 +243,13 @@ CONFIG_BINFMT_ELF=y
225# CONFIG_HAVE_AOUT is not set 243# CONFIG_HAVE_AOUT is not set
226# CONFIG_BINFMT_MISC is not set 244# CONFIG_BINFMT_MISC is not set
227# CONFIG_IOMMU_HELPER is not set 245# CONFIG_IOMMU_HELPER is not set
246# CONFIG_SWIOTLB is not set
228CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 247CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
229CONFIG_ARCH_HAS_WALK_MEMORY=y 248CONFIG_ARCH_HAS_WALK_MEMORY=y
230CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y 249CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
231# CONFIG_KEXEC is not set 250# CONFIG_KEXEC is not set
232# CONFIG_CRASH_DUMP is not set 251# CONFIG_CRASH_DUMP is not set
252CONFIG_MAX_ACTIVE_REGIONS=32
233CONFIG_ARCH_FLATMEM_ENABLE=y 253CONFIG_ARCH_FLATMEM_ENABLE=y
234CONFIG_ARCH_POPULATES_NODE_MAP=y 254CONFIG_ARCH_POPULATES_NODE_MAP=y
235CONFIG_SELECT_MEMORY_MODEL=y 255CONFIG_SELECT_MEMORY_MODEL=y
@@ -245,9 +265,10 @@ CONFIG_MIGRATION=y
245CONFIG_ZONE_DMA_FLAG=1 265CONFIG_ZONE_DMA_FLAG=1
246CONFIG_BOUNCE=y 266CONFIG_BOUNCE=y
247CONFIG_VIRT_TO_BUS=y 267CONFIG_VIRT_TO_BUS=y
248CONFIG_UNEVICTABLE_LRU=y
249CONFIG_HAVE_MLOCK=y 268CONFIG_HAVE_MLOCK=y
250CONFIG_HAVE_MLOCKED_PAGE_BIT=y 269CONFIG_HAVE_MLOCKED_PAGE_BIT=y
270# CONFIG_KSM is not set
271CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
251CONFIG_PPC_4K_PAGES=y 272CONFIG_PPC_4K_PAGES=y
252# CONFIG_PPC_16K_PAGES is not set 273# CONFIG_PPC_16K_PAGES is not set
253# CONFIG_PPC_64K_PAGES is not set 274# CONFIG_PPC_64K_PAGES is not set
@@ -258,6 +279,7 @@ CONFIG_PROC_DEVICETREE=y
258CONFIG_EXTRA_TARGETS="" 279CONFIG_EXTRA_TARGETS=""
259CONFIG_PM=y 280CONFIG_PM=y
260# CONFIG_PM_DEBUG is not set 281# CONFIG_PM_DEBUG is not set
282# CONFIG_PM_RUNTIME is not set
261CONFIG_SECCOMP=y 283CONFIG_SECCOMP=y
262CONFIG_ISA_DMA_API=y 284CONFIG_ISA_DMA_API=y
263 285
@@ -334,6 +356,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
334# CONFIG_NETFILTER is not set 356# CONFIG_NETFILTER is not set
335# CONFIG_IP_DCCP is not set 357# CONFIG_IP_DCCP is not set
336# CONFIG_IP_SCTP is not set 358# CONFIG_IP_SCTP is not set
359# CONFIG_RDS is not set
337# CONFIG_TIPC is not set 360# CONFIG_TIPC is not set
338# CONFIG_ATM is not set 361# CONFIG_ATM is not set
339# CONFIG_BRIDGE is not set 362# CONFIG_BRIDGE is not set
@@ -348,6 +371,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
348# CONFIG_ECONET is not set 371# CONFIG_ECONET is not set
349# CONFIG_WAN_ROUTER is not set 372# CONFIG_WAN_ROUTER is not set
350# CONFIG_PHONET is not set 373# CONFIG_PHONET is not set
374# CONFIG_IEEE802154 is not set
351# CONFIG_NET_SCHED is not set 375# CONFIG_NET_SCHED is not set
352# CONFIG_DCB is not set 376# CONFIG_DCB is not set
353 377
@@ -373,6 +397,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
373# Generic Driver Options 397# Generic Driver Options
374# 398#
375CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 399CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
400# CONFIG_DEVTMPFS is not set
376CONFIG_STANDALONE=y 401CONFIG_STANDALONE=y
377CONFIG_PREVENT_FIRMWARE_BUILD=y 402CONFIG_PREVENT_FIRMWARE_BUILD=y
378# CONFIG_FW_LOADER is not set 403# CONFIG_FW_LOADER is not set
@@ -382,9 +407,9 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
382# CONFIG_CONNECTOR is not set 407# CONFIG_CONNECTOR is not set
383CONFIG_MTD=y 408CONFIG_MTD=y
384# CONFIG_MTD_DEBUG is not set 409# CONFIG_MTD_DEBUG is not set
410# CONFIG_MTD_TESTS is not set
385CONFIG_MTD_CONCAT=y 411CONFIG_MTD_CONCAT=y
386CONFIG_MTD_PARTITIONS=y 412CONFIG_MTD_PARTITIONS=y
387# CONFIG_MTD_TESTS is not set
388# CONFIG_MTD_REDBOOT_PARTS is not set 413# CONFIG_MTD_REDBOOT_PARTS is not set
389CONFIG_MTD_CMDLINE_PARTS=y 414CONFIG_MTD_CMDLINE_PARTS=y
390# CONFIG_MTD_OF_PARTS is not set 415# CONFIG_MTD_OF_PARTS is not set
@@ -464,6 +489,7 @@ CONFIG_MTD_PHYSMAP_OF=y
464# CONFIG_MTD_UBI is not set 489# CONFIG_MTD_UBI is not set
465CONFIG_OF_DEVICE=y 490CONFIG_OF_DEVICE=y
466CONFIG_OF_I2C=y 491CONFIG_OF_I2C=y
492CONFIG_OF_MDIO=y
467# CONFIG_PARPORT is not set 493# CONFIG_PARPORT is not set
468CONFIG_BLK_DEV=y 494CONFIG_BLK_DEV=y
469# CONFIG_BLK_DEV_FD is not set 495# CONFIG_BLK_DEV_FD is not set
@@ -502,10 +528,6 @@ CONFIG_BLK_DEV_SD=y
502# CONFIG_BLK_DEV_SR is not set 528# CONFIG_BLK_DEV_SR is not set
503CONFIG_CHR_DEV_SG=y 529CONFIG_CHR_DEV_SG=y
504# CONFIG_CHR_DEV_SCH is not set 530# CONFIG_CHR_DEV_SCH is not set
505
506#
507# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
508#
509# CONFIG_SCSI_MULTI_LUN is not set 531# CONFIG_SCSI_MULTI_LUN is not set
510# CONFIG_SCSI_CONSTANTS is not set 532# CONFIG_SCSI_CONSTANTS is not set
511# CONFIG_SCSI_LOGGING is not set 533# CONFIG_SCSI_LOGGING is not set
@@ -529,6 +551,7 @@ CONFIG_SCSI_LOWLEVEL=y
529# CONFIG_SCSI_OSD_INITIATOR is not set 551# CONFIG_SCSI_OSD_INITIATOR is not set
530CONFIG_ATA=y 552CONFIG_ATA=y
531# CONFIG_ATA_NONSTANDARD is not set 553# CONFIG_ATA_NONSTANDARD is not set
554CONFIG_ATA_VERBOSE_ERROR=y
532CONFIG_SATA_PMP=y 555CONFIG_SATA_PMP=y
533CONFIG_ATA_SFF=y 556CONFIG_ATA_SFF=y
534# CONFIG_SATA_MV is not set 557# CONFIG_SATA_MV is not set
@@ -538,7 +561,6 @@ CONFIG_PATA_PLATFORM=y
538# CONFIG_MD is not set 561# CONFIG_MD is not set
539# CONFIG_MACINTOSH_DRIVERS is not set 562# CONFIG_MACINTOSH_DRIVERS is not set
540CONFIG_NETDEVICES=y 563CONFIG_NETDEVICES=y
541CONFIG_COMPAT_NET_DEV_OPS=y
542# CONFIG_DUMMY is not set 564# CONFIG_DUMMY is not set
543# CONFIG_BONDING is not set 565# CONFIG_BONDING is not set
544# CONFIG_MACVLAN is not set 566# CONFIG_MACVLAN is not set
@@ -577,14 +599,14 @@ CONFIG_NET_ETHERNET=y
577# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set 599# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
578# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 600# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
579# CONFIG_B44 is not set 601# CONFIG_B44 is not set
602# CONFIG_KS8842 is not set
603# CONFIG_KS8851_MLL is not set
580CONFIG_FEC_MPC52xx=y 604CONFIG_FEC_MPC52xx=y
581CONFIG_FEC_MPC52xx_MDIO=y 605CONFIG_FEC_MPC52xx_MDIO=y
606# CONFIG_XILINX_EMACLITE is not set
582# CONFIG_NETDEV_1000 is not set 607# CONFIG_NETDEV_1000 is not set
583# CONFIG_NETDEV_10000 is not set 608# CONFIG_NETDEV_10000 is not set
584 609CONFIG_WLAN=y
585#
586# Wireless LAN
587#
588# CONFIG_WLAN_PRE80211 is not set 610# CONFIG_WLAN_PRE80211 is not set
589# CONFIG_WLAN_80211 is not set 611# CONFIG_WLAN_80211 is not set
590 612
@@ -654,6 +676,7 @@ CONFIG_LEGACY_PTY_COUNT=256
654# CONFIG_TCG_TPM is not set 676# CONFIG_TCG_TPM is not set
655CONFIG_I2C=y 677CONFIG_I2C=y
656CONFIG_I2C_BOARDINFO=y 678CONFIG_I2C_BOARDINFO=y
679CONFIG_I2C_COMPAT=y
657CONFIG_I2C_CHARDEV=y 680CONFIG_I2C_CHARDEV=y
658CONFIG_I2C_HELPER_AUTO=y 681CONFIG_I2C_HELPER_AUTO=y
659 682
@@ -664,6 +687,7 @@ CONFIG_I2C_HELPER_AUTO=y
664# 687#
665# I2C system bus drivers (mostly embedded / system-on-chip) 688# I2C system bus drivers (mostly embedded / system-on-chip)
666# 689#
690# CONFIG_I2C_DESIGNWARE is not set
667CONFIG_I2C_MPC=y 691CONFIG_I2C_MPC=y
668# CONFIG_I2C_OCORES is not set 692# CONFIG_I2C_OCORES is not set
669# CONFIG_I2C_SIMTEC is not set 693# CONFIG_I2C_SIMTEC is not set
@@ -685,22 +709,28 @@ CONFIG_I2C_MPC=y
685# Miscellaneous I2C Chip support 709# Miscellaneous I2C Chip support
686# 710#
687# CONFIG_DS1682 is not set 711# CONFIG_DS1682 is not set
688# CONFIG_SENSORS_PCF8574 is not set
689# CONFIG_PCF8575 is not set
690# CONFIG_SENSORS_PCA9539 is not set
691# CONFIG_SENSORS_MAX6875 is not set
692# CONFIG_SENSORS_TSL2550 is not set 712# CONFIG_SENSORS_TSL2550 is not set
693# CONFIG_I2C_DEBUG_CORE is not set 713# CONFIG_I2C_DEBUG_CORE is not set
694# CONFIG_I2C_DEBUG_ALGO is not set 714# CONFIG_I2C_DEBUG_ALGO is not set
695# CONFIG_I2C_DEBUG_BUS is not set 715# CONFIG_I2C_DEBUG_BUS is not set
696# CONFIG_I2C_DEBUG_CHIP is not set 716# CONFIG_I2C_DEBUG_CHIP is not set
697# CONFIG_SPI is not set 717# CONFIG_SPI is not set
718
719#
720# PPS support
721#
722# CONFIG_PPS is not set
698CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 723CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
699# CONFIG_GPIOLIB is not set 724# CONFIG_GPIOLIB is not set
700# CONFIG_W1 is not set 725# CONFIG_W1 is not set
701# CONFIG_POWER_SUPPLY is not set 726# CONFIG_POWER_SUPPLY is not set
702CONFIG_HWMON=y 727CONFIG_HWMON=y
703# CONFIG_HWMON_VID is not set 728# CONFIG_HWMON_VID is not set
729# CONFIG_HWMON_DEBUG_CHIP is not set
730
731#
732# Native drivers
733#
704# CONFIG_SENSORS_AD7414 is not set 734# CONFIG_SENSORS_AD7414 is not set
705# CONFIG_SENSORS_AD7418 is not set 735# CONFIG_SENSORS_AD7418 is not set
706# CONFIG_SENSORS_ADM1021 is not set 736# CONFIG_SENSORS_ADM1021 is not set
@@ -747,6 +777,8 @@ CONFIG_HWMON=y
747# CONFIG_SENSORS_SMSC47B397 is not set 777# CONFIG_SENSORS_SMSC47B397 is not set
748# CONFIG_SENSORS_ADS7828 is not set 778# CONFIG_SENSORS_ADS7828 is not set
749# CONFIG_SENSORS_THMC50 is not set 779# CONFIG_SENSORS_THMC50 is not set
780# CONFIG_SENSORS_TMP401 is not set
781# CONFIG_SENSORS_TMP421 is not set
750# CONFIG_SENSORS_VT1211 is not set 782# CONFIG_SENSORS_VT1211 is not set
751# CONFIG_SENSORS_W83781D is not set 783# CONFIG_SENSORS_W83781D is not set
752# CONFIG_SENSORS_W83791D is not set 784# CONFIG_SENSORS_W83791D is not set
@@ -756,9 +788,7 @@ CONFIG_HWMON=y
756# CONFIG_SENSORS_W83L786NG is not set 788# CONFIG_SENSORS_W83L786NG is not set
757# CONFIG_SENSORS_W83627HF is not set 789# CONFIG_SENSORS_W83627HF is not set
758# CONFIG_SENSORS_W83627EHF is not set 790# CONFIG_SENSORS_W83627EHF is not set
759# CONFIG_HWMON_DEBUG_CHIP is not set
760# CONFIG_THERMAL is not set 791# CONFIG_THERMAL is not set
761# CONFIG_THERMAL_HWMON is not set
762CONFIG_WATCHDOG=y 792CONFIG_WATCHDOG=y
763# CONFIG_WATCHDOG_NOWAYOUT is not set 793# CONFIG_WATCHDOG_NOWAYOUT is not set
764 794
@@ -789,25 +819,12 @@ CONFIG_SSB_POSSIBLE=y
789# CONFIG_MFD_TMIO is not set 819# CONFIG_MFD_TMIO is not set
790# CONFIG_PMIC_DA903X is not set 820# CONFIG_PMIC_DA903X is not set
791# CONFIG_MFD_WM8400 is not set 821# CONFIG_MFD_WM8400 is not set
822# CONFIG_MFD_WM831X is not set
792# CONFIG_MFD_WM8350_I2C is not set 823# CONFIG_MFD_WM8350_I2C is not set
793# CONFIG_MFD_PCF50633 is not set 824# CONFIG_MFD_PCF50633 is not set
825# CONFIG_AB3100_CORE is not set
794# CONFIG_REGULATOR is not set 826# CONFIG_REGULATOR is not set
795 827# CONFIG_MEDIA_SUPPORT is not set
796#
797# Multimedia devices
798#
799
800#
801# Multimedia core support
802#
803# CONFIG_VIDEO_DEV is not set
804# CONFIG_DVB_CORE is not set
805# CONFIG_VIDEO_MEDIA is not set
806
807#
808# Multimedia drivers
809#
810# CONFIG_DAB is not set
811 828
812# 829#
813# Graphics support 830# Graphics support
@@ -851,11 +868,12 @@ CONFIG_USB_MON=y
851# CONFIG_USB_OXU210HP_HCD is not set 868# CONFIG_USB_OXU210HP_HCD is not set
852# CONFIG_USB_ISP116X_HCD is not set 869# CONFIG_USB_ISP116X_HCD is not set
853# CONFIG_USB_ISP1760_HCD is not set 870# CONFIG_USB_ISP1760_HCD is not set
871# CONFIG_USB_ISP1362_HCD is not set
854CONFIG_USB_OHCI_HCD=y 872CONFIG_USB_OHCI_HCD=y
855CONFIG_USB_OHCI_HCD_PPC_SOC=y 873CONFIG_USB_OHCI_HCD_PPC_SOC=y
856CONFIG_USB_OHCI_HCD_PPC_OF=y
857CONFIG_USB_OHCI_HCD_PPC_OF_BE=y 874CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
858# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set 875# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
876CONFIG_USB_OHCI_HCD_PPC_OF=y
859CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y 877CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
860CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y 878CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
861# CONFIG_USB_OHCI_LITTLE_ENDIAN is not set 879# CONFIG_USB_OHCI_LITTLE_ENDIAN is not set
@@ -969,6 +987,7 @@ CONFIG_RTC_DRV_DS1307=y
969# CONFIG_RTC_DRV_S35390A is not set 987# CONFIG_RTC_DRV_S35390A is not set
970# CONFIG_RTC_DRV_FM3130 is not set 988# CONFIG_RTC_DRV_FM3130 is not set
971# CONFIG_RTC_DRV_RX8581 is not set 989# CONFIG_RTC_DRV_RX8581 is not set
990# CONFIG_RTC_DRV_RX8025 is not set
972 991
973# 992#
974# SPI RTC drivers 993# SPI RTC drivers
@@ -996,6 +1015,10 @@ CONFIG_RTC_DRV_DS1307=y
996# CONFIG_DMADEVICES is not set 1015# CONFIG_DMADEVICES is not set
997# CONFIG_AUXDISPLAY is not set 1016# CONFIG_AUXDISPLAY is not set
998# CONFIG_UIO is not set 1017# CONFIG_UIO is not set
1018
1019#
1020# TI VLYNQ
1021#
999# CONFIG_STAGING is not set 1022# CONFIG_STAGING is not set
1000 1023
1001# 1024#
@@ -1015,10 +1038,13 @@ CONFIG_FS_MBCACHE=y
1015# CONFIG_REISERFS_FS is not set 1038# CONFIG_REISERFS_FS is not set
1016# CONFIG_JFS_FS is not set 1039# CONFIG_JFS_FS is not set
1017# CONFIG_FS_POSIX_ACL is not set 1040# CONFIG_FS_POSIX_ACL is not set
1018CONFIG_FILE_LOCKING=y
1019# CONFIG_XFS_FS is not set 1041# CONFIG_XFS_FS is not set
1042# CONFIG_GFS2_FS is not set
1020# CONFIG_OCFS2_FS is not set 1043# CONFIG_OCFS2_FS is not set
1021# CONFIG_BTRFS_FS is not set 1044# CONFIG_BTRFS_FS is not set
1045# CONFIG_NILFS2_FS is not set
1046CONFIG_FILE_LOCKING=y
1047CONFIG_FSNOTIFY=y
1022CONFIG_DNOTIFY=y 1048CONFIG_DNOTIFY=y
1023CONFIG_INOTIFY=y 1049CONFIG_INOTIFY=y
1024CONFIG_INOTIFY_USER=y 1050CONFIG_INOTIFY_USER=y
@@ -1089,12 +1115,12 @@ CONFIG_CRAMFS=y
1089# CONFIG_ROMFS_FS is not set 1115# CONFIG_ROMFS_FS is not set
1090# CONFIG_SYSV_FS is not set 1116# CONFIG_SYSV_FS is not set
1091# CONFIG_UFS_FS is not set 1117# CONFIG_UFS_FS is not set
1092# CONFIG_NILFS2_FS is not set
1093CONFIG_NETWORK_FILESYSTEMS=y 1118CONFIG_NETWORK_FILESYSTEMS=y
1094CONFIG_NFS_FS=y 1119CONFIG_NFS_FS=y
1095CONFIG_NFS_V3=y 1120CONFIG_NFS_V3=y
1096# CONFIG_NFS_V3_ACL is not set 1121# CONFIG_NFS_V3_ACL is not set
1097CONFIG_NFS_V4=y 1122CONFIG_NFS_V4=y
1123# CONFIG_NFS_V4_1 is not set
1098CONFIG_ROOT_NFS=y 1124CONFIG_ROOT_NFS=y
1099# CONFIG_NFSD is not set 1125# CONFIG_NFSD is not set
1100CONFIG_LOCKD=y 1126CONFIG_LOCKD=y
@@ -1194,6 +1220,7 @@ CONFIG_HAS_IOPORT=y
1194CONFIG_HAS_DMA=y 1220CONFIG_HAS_DMA=y
1195CONFIG_HAVE_LMB=y 1221CONFIG_HAVE_LMB=y
1196CONFIG_NLATTR=y 1222CONFIG_NLATTR=y
1223CONFIG_GENERIC_ATOMIC64=y
1197 1224
1198# 1225#
1199# Kernel hacking 1226# Kernel hacking
@@ -1203,6 +1230,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1203CONFIG_ENABLE_MUST_CHECK=y 1230CONFIG_ENABLE_MUST_CHECK=y
1204CONFIG_FRAME_WARN=1024 1231CONFIG_FRAME_WARN=1024
1205# CONFIG_MAGIC_SYSRQ is not set 1232# CONFIG_MAGIC_SYSRQ is not set
1233# CONFIG_STRIP_ASM_SYMS is not set
1206# CONFIG_UNUSED_SYMBOLS is not set 1234# CONFIG_UNUSED_SYMBOLS is not set
1207# CONFIG_DEBUG_FS is not set 1235# CONFIG_DEBUG_FS is not set
1208# CONFIG_HEADERS_CHECK is not set 1236# CONFIG_HEADERS_CHECK is not set
@@ -1220,10 +1248,14 @@ CONFIG_SCHED_DEBUG=y
1220# CONFIG_DEBUG_OBJECTS is not set 1248# CONFIG_DEBUG_OBJECTS is not set
1221# CONFIG_SLUB_DEBUG_ON is not set 1249# CONFIG_SLUB_DEBUG_ON is not set
1222# CONFIG_SLUB_STATS is not set 1250# CONFIG_SLUB_STATS is not set
1251# CONFIG_DEBUG_KMEMLEAK is not set
1223# CONFIG_DEBUG_RT_MUTEXES is not set 1252# CONFIG_DEBUG_RT_MUTEXES is not set
1224# CONFIG_RT_MUTEX_TESTER is not set 1253# CONFIG_RT_MUTEX_TESTER is not set
1225# CONFIG_DEBUG_SPINLOCK is not set 1254# CONFIG_DEBUG_SPINLOCK is not set
1226# CONFIG_DEBUG_MUTEXES is not set 1255# CONFIG_DEBUG_MUTEXES is not set
1256# CONFIG_DEBUG_LOCK_ALLOC is not set
1257# CONFIG_PROVE_LOCKING is not set
1258# CONFIG_LOCK_STAT is not set
1227# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1259# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1228# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1260# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1229# CONFIG_DEBUG_KOBJECT is not set 1261# CONFIG_DEBUG_KOBJECT is not set
@@ -1235,11 +1267,12 @@ CONFIG_DEBUG_INFO=y
1235# CONFIG_DEBUG_LIST is not set 1267# CONFIG_DEBUG_LIST is not set
1236# CONFIG_DEBUG_SG is not set 1268# CONFIG_DEBUG_SG is not set
1237# CONFIG_DEBUG_NOTIFIERS is not set 1269# CONFIG_DEBUG_NOTIFIERS is not set
1238# CONFIG_BOOT_PRINTK_DELAY is not set 1270# CONFIG_DEBUG_CREDENTIALS is not set
1239# CONFIG_RCU_TORTURE_TEST is not set 1271# CONFIG_RCU_TORTURE_TEST is not set
1240# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1272# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1241# CONFIG_BACKTRACE_SELF_TEST is not set 1273# CONFIG_BACKTRACE_SELF_TEST is not set
1242# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1274# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1275# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1243# CONFIG_FAULT_INJECTION is not set 1276# CONFIG_FAULT_INJECTION is not set
1244# CONFIG_LATENCYTOP is not set 1277# CONFIG_LATENCYTOP is not set
1245# CONFIG_DEBUG_PAGEALLOC is not set 1278# CONFIG_DEBUG_PAGEALLOC is not set
@@ -1248,23 +1281,25 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1248CONFIG_HAVE_DYNAMIC_FTRACE=y 1281CONFIG_HAVE_DYNAMIC_FTRACE=y
1249CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1282CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1250CONFIG_TRACING_SUPPORT=y 1283CONFIG_TRACING_SUPPORT=y
1251 1284CONFIG_FTRACE=y
1252#
1253# Tracers
1254#
1255# CONFIG_FUNCTION_TRACER is not set 1285# CONFIG_FUNCTION_TRACER is not set
1286# CONFIG_IRQSOFF_TRACER is not set
1256# CONFIG_SCHED_TRACER is not set 1287# CONFIG_SCHED_TRACER is not set
1257# CONFIG_CONTEXT_SWITCH_TRACER is not set 1288# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1258# CONFIG_EVENT_TRACER is not set
1259# CONFIG_BOOT_TRACER is not set 1289# CONFIG_BOOT_TRACER is not set
1260# CONFIG_TRACE_BRANCH_PROFILING is not set 1290CONFIG_BRANCH_PROFILE_NONE=y
1291# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1292# CONFIG_PROFILE_ALL_BRANCHES is not set
1261# CONFIG_STACK_TRACER is not set 1293# CONFIG_STACK_TRACER is not set
1262# CONFIG_KMEMTRACE is not set 1294# CONFIG_KMEMTRACE is not set
1263# CONFIG_WORKQUEUE_TRACER is not set 1295# CONFIG_WORKQUEUE_TRACER is not set
1264# CONFIG_BLK_DEV_IO_TRACE is not set 1296# CONFIG_BLK_DEV_IO_TRACE is not set
1297# CONFIG_DMA_API_DEBUG is not set
1265# CONFIG_SAMPLES is not set 1298# CONFIG_SAMPLES is not set
1266CONFIG_HAVE_ARCH_KGDB=y 1299CONFIG_HAVE_ARCH_KGDB=y
1267# CONFIG_KGDB is not set 1300# CONFIG_KGDB is not set
1301# CONFIG_PPC_DISABLE_WERROR is not set
1302CONFIG_PPC_WERROR=y
1268CONFIG_PRINT_STACK_DEPTH=64 1303CONFIG_PRINT_STACK_DEPTH=64
1269# CONFIG_DEBUG_STACKOVERFLOW is not set 1304# CONFIG_DEBUG_STACKOVERFLOW is not set
1270# CONFIG_DEBUG_STACK_USAGE is not set 1305# CONFIG_DEBUG_STACK_USAGE is not set
@@ -1289,7 +1324,6 @@ CONFIG_CRYPTO=y
1289# 1324#
1290# Crypto core or helper 1325# Crypto core or helper
1291# 1326#
1292# CONFIG_CRYPTO_FIPS is not set
1293CONFIG_CRYPTO_ALGAPI=y 1327CONFIG_CRYPTO_ALGAPI=y
1294CONFIG_CRYPTO_ALGAPI2=y 1328CONFIG_CRYPTO_ALGAPI2=y
1295CONFIG_CRYPTO_AEAD2=y 1329CONFIG_CRYPTO_AEAD2=y
@@ -1331,11 +1365,13 @@ CONFIG_CRYPTO_PCBC=y
1331# 1365#
1332# CONFIG_CRYPTO_HMAC is not set 1366# CONFIG_CRYPTO_HMAC is not set
1333# CONFIG_CRYPTO_XCBC is not set 1367# CONFIG_CRYPTO_XCBC is not set
1368# CONFIG_CRYPTO_VMAC is not set
1334 1369
1335# 1370#
1336# Digest 1371# Digest
1337# 1372#
1338# CONFIG_CRYPTO_CRC32C is not set 1373# CONFIG_CRYPTO_CRC32C is not set
1374# CONFIG_CRYPTO_GHASH is not set
1339# CONFIG_CRYPTO_MD4 is not set 1375# CONFIG_CRYPTO_MD4 is not set
1340CONFIG_CRYPTO_MD5=y 1376CONFIG_CRYPTO_MD5=y
1341# CONFIG_CRYPTO_MICHAEL_MIC is not set 1377# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/powerpc/configs/mpc5200_defconfig b/arch/powerpc/configs/mpc5200_defconfig
index aaa4416660e9..523d5fe18c0e 100644
--- a/arch/powerpc/configs/mpc5200_defconfig
+++ b/arch/powerpc/configs/mpc5200_defconfig
@@ -1,25 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc2 3# Linux kernel version: 2.6.32-rc4
4# Mon Apr 20 11:06:25 2009 4# Thu Oct 15 10:33:21 2009
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
8# 8#
9# Processor support 9# Processor support
10# 10#
11CONFIG_6xx=y 11CONFIG_PPC_BOOK3S_32=y
12# CONFIG_PPC_85xx is not set 12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set 13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set 14# CONFIG_40x is not set
15# CONFIG_44x is not set 15# CONFIG_44x is not set
16# CONFIG_E200 is not set 16# CONFIG_E200 is not set
17CONFIG_PPC_BOOK3S=y 17CONFIG_PPC_BOOK3S=y
18CONFIG_6xx=y
18CONFIG_PPC_FPU=y 19CONFIG_PPC_FPU=y
19# CONFIG_ALTIVEC is not set 20# CONFIG_ALTIVEC is not set
20CONFIG_PPC_STD_MMU=y 21CONFIG_PPC_STD_MMU=y
21CONFIG_PPC_STD_MMU_32=y 22CONFIG_PPC_STD_MMU_32=y
22# CONFIG_PPC_MM_SLICES is not set 23# CONFIG_PPC_MM_SLICES is not set
24CONFIG_PPC_HAVE_PMU_SUPPORT=y
23# CONFIG_SMP is not set 25# CONFIG_SMP is not set
24CONFIG_PPC32=y 26CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32 27CONFIG_WORD_SIZE=32
@@ -30,15 +32,17 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 32CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 33CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 34CONFIG_GENERIC_HARDIRQS=y
35CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set 36# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
37# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
34CONFIG_IRQ_PER_CPU=y 38CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y 39CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y 40CONFIG_HAVE_LATENCYTOP_SUPPORT=y
41CONFIG_TRACE_IRQFLAGS_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y 42CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y 43CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y 44CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y 45CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y 46CONFIG_GENERIC_FIND_NEXT_BIT=y
43CONFIG_GENERIC_GPIO=y 47CONFIG_GENERIC_GPIO=y
44# CONFIG_ARCH_NO_VIRT_TO_BUS is not set 48# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
@@ -53,12 +57,14 @@ CONFIG_OF=y
53# CONFIG_GENERIC_TBSYNC is not set 57# CONFIG_GENERIC_TBSYNC is not set
54CONFIG_AUDIT_ARCH=y 58CONFIG_AUDIT_ARCH=y
55CONFIG_GENERIC_BUG=y 59CONFIG_GENERIC_BUG=y
60CONFIG_DTC=y
56CONFIG_DEFAULT_UIMAGE=y 61CONFIG_DEFAULT_UIMAGE=y
57CONFIG_ARCH_SUSPEND_POSSIBLE=y 62CONFIG_ARCH_SUSPEND_POSSIBLE=y
58# CONFIG_PPC_DCR_NATIVE is not set 63# CONFIG_PPC_DCR_NATIVE is not set
59# CONFIG_PPC_DCR_MMIO is not set 64# CONFIG_PPC_DCR_MMIO is not set
60CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 65CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
61CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 66CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
67CONFIG_CONSTRUCTORS=y
62 68
63# 69#
64# General setup 70# General setup
@@ -79,11 +85,12 @@ CONFIG_SYSVIPC_SYSCTL=y
79# 85#
80# RCU Subsystem 86# RCU Subsystem
81# 87#
82CONFIG_CLASSIC_RCU=y 88CONFIG_TREE_RCU=y
83# CONFIG_TREE_RCU is not set 89# CONFIG_TREE_PREEMPT_RCU is not set
84# CONFIG_PREEMPT_RCU is not set 90# CONFIG_RCU_TRACE is not set
91CONFIG_RCU_FANOUT=32
92# CONFIG_RCU_FANOUT_EXACT is not set
85# CONFIG_TREE_RCU_TRACE is not set 93# CONFIG_TREE_RCU_TRACE is not set
86# CONFIG_PREEMPT_RCU_TRACE is not set
87# CONFIG_IKCONFIG is not set 94# CONFIG_IKCONFIG is not set
88CONFIG_LOG_BUF_SHIFT=14 95CONFIG_LOG_BUF_SHIFT=14
89# CONFIG_GROUP_SCHED is not set 96# CONFIG_GROUP_SCHED is not set
@@ -103,7 +110,6 @@ CONFIG_ANON_INODES=y
103CONFIG_EMBEDDED=y 110CONFIG_EMBEDDED=y
104# CONFIG_SYSCTL_SYSCALL is not set 111# CONFIG_SYSCTL_SYSCALL is not set
105# CONFIG_KALLSYMS is not set 112# CONFIG_KALLSYMS is not set
106# CONFIG_STRIP_ASM_SYMS is not set
107CONFIG_HOTPLUG=y 113CONFIG_HOTPLUG=y
108CONFIG_PRINTK=y 114CONFIG_PRINTK=y
109CONFIG_BUG=y 115CONFIG_BUG=y
@@ -116,6 +122,13 @@ CONFIG_TIMERFD=y
116CONFIG_EVENTFD=y 122CONFIG_EVENTFD=y
117CONFIG_SHMEM=y 123CONFIG_SHMEM=y
118CONFIG_AIO=y 124CONFIG_AIO=y
125CONFIG_HAVE_PERF_EVENTS=y
126
127#
128# Kernel Performance Events And Counters
129#
130# CONFIG_PERF_EVENTS is not set
131# CONFIG_PERF_COUNTERS is not set
119CONFIG_VM_EVENT_COUNTERS=y 132CONFIG_VM_EVENT_COUNTERS=y
120CONFIG_PCI_QUIRKS=y 133CONFIG_PCI_QUIRKS=y
121CONFIG_SLUB_DEBUG=y 134CONFIG_SLUB_DEBUG=y
@@ -124,14 +137,19 @@ CONFIG_COMPAT_BRK=y
124CONFIG_SLUB=y 137CONFIG_SLUB=y
125# CONFIG_SLOB is not set 138# CONFIG_SLOB is not set
126# CONFIG_PROFILING is not set 139# CONFIG_PROFILING is not set
127# CONFIG_MARKERS is not set
128CONFIG_HAVE_OPROFILE=y 140CONFIG_HAVE_OPROFILE=y
129CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 141CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
130CONFIG_HAVE_IOREMAP_PROT=y 142CONFIG_HAVE_IOREMAP_PROT=y
131CONFIG_HAVE_KPROBES=y 143CONFIG_HAVE_KPROBES=y
132CONFIG_HAVE_KRETPROBES=y 144CONFIG_HAVE_KRETPROBES=y
133CONFIG_HAVE_ARCH_TRACEHOOK=y 145CONFIG_HAVE_ARCH_TRACEHOOK=y
146CONFIG_HAVE_DMA_ATTRS=y
134CONFIG_HAVE_CLK=y 147CONFIG_HAVE_CLK=y
148CONFIG_HAVE_DMA_API_DEBUG=y
149
150#
151# GCOV-based kernel profiling
152#
135# CONFIG_SLOW_WORK is not set 153# CONFIG_SLOW_WORK is not set
136# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 154# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
137CONFIG_SLABINFO=y 155CONFIG_SLABINFO=y
@@ -144,7 +162,7 @@ CONFIG_MODULE_UNLOAD=y
144# CONFIG_MODVERSIONS is not set 162# CONFIG_MODVERSIONS is not set
145# CONFIG_MODULE_SRCVERSION_ALL is not set 163# CONFIG_MODULE_SRCVERSION_ALL is not set
146CONFIG_BLOCK=y 164CONFIG_BLOCK=y
147# CONFIG_LBD is not set 165CONFIG_LBDAF=y
148# CONFIG_BLK_DEV_BSG is not set 166# CONFIG_BLK_DEV_BSG is not set
149# CONFIG_BLK_DEV_INTEGRITY is not set 167# CONFIG_BLK_DEV_INTEGRITY is not set
150 168
@@ -205,7 +223,7 @@ CONFIG_RTAS_PROC=y
205CONFIG_PPC_BESTCOMM=y 223CONFIG_PPC_BESTCOMM=y
206CONFIG_PPC_BESTCOMM_ATA=y 224CONFIG_PPC_BESTCOMM_ATA=y
207CONFIG_PPC_BESTCOMM_FEC=y 225CONFIG_PPC_BESTCOMM_FEC=y
208# CONFIG_SIMPLE_GPIO is not set 226CONFIG_SIMPLE_GPIO=y
209 227
210# 228#
211# Kernel options 229# Kernel options
@@ -229,11 +247,13 @@ CONFIG_BINFMT_ELF=y
229# CONFIG_HAVE_AOUT is not set 247# CONFIG_HAVE_AOUT is not set
230# CONFIG_BINFMT_MISC is not set 248# CONFIG_BINFMT_MISC is not set
231# CONFIG_IOMMU_HELPER is not set 249# CONFIG_IOMMU_HELPER is not set
250# CONFIG_SWIOTLB is not set
232CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 251CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
233CONFIG_ARCH_HAS_WALK_MEMORY=y 252CONFIG_ARCH_HAS_WALK_MEMORY=y
234CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y 253CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
235# CONFIG_KEXEC is not set 254# CONFIG_KEXEC is not set
236# CONFIG_CRASH_DUMP is not set 255# CONFIG_CRASH_DUMP is not set
256CONFIG_MAX_ACTIVE_REGIONS=32
237CONFIG_ARCH_FLATMEM_ENABLE=y 257CONFIG_ARCH_FLATMEM_ENABLE=y
238CONFIG_ARCH_POPULATES_NODE_MAP=y 258CONFIG_ARCH_POPULATES_NODE_MAP=y
239CONFIG_SELECT_MEMORY_MODEL=y 259CONFIG_SELECT_MEMORY_MODEL=y
@@ -249,9 +269,10 @@ CONFIG_MIGRATION=y
249CONFIG_ZONE_DMA_FLAG=1 269CONFIG_ZONE_DMA_FLAG=1
250CONFIG_BOUNCE=y 270CONFIG_BOUNCE=y
251CONFIG_VIRT_TO_BUS=y 271CONFIG_VIRT_TO_BUS=y
252CONFIG_UNEVICTABLE_LRU=y
253CONFIG_HAVE_MLOCK=y 272CONFIG_HAVE_MLOCK=y
254CONFIG_HAVE_MLOCKED_PAGE_BIT=y 273CONFIG_HAVE_MLOCKED_PAGE_BIT=y
274# CONFIG_KSM is not set
275CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
255CONFIG_PPC_4K_PAGES=y 276CONFIG_PPC_4K_PAGES=y
256# CONFIG_PPC_16K_PAGES is not set 277# CONFIG_PPC_16K_PAGES is not set
257# CONFIG_PPC_64K_PAGES is not set 278# CONFIG_PPC_64K_PAGES is not set
@@ -265,6 +286,7 @@ CONFIG_PM=y
265CONFIG_PM_SLEEP=y 286CONFIG_PM_SLEEP=y
266CONFIG_SUSPEND=y 287CONFIG_SUSPEND=y
267CONFIG_SUSPEND_FREEZER=y 288CONFIG_SUSPEND_FREEZER=y
289# CONFIG_PM_RUNTIME is not set
268CONFIG_SECCOMP=y 290CONFIG_SECCOMP=y
269CONFIG_ISA_DMA_API=y 291CONFIG_ISA_DMA_API=y
270 292
@@ -349,6 +371,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
349# CONFIG_NETFILTER is not set 371# CONFIG_NETFILTER is not set
350# CONFIG_IP_DCCP is not set 372# CONFIG_IP_DCCP is not set
351# CONFIG_IP_SCTP is not set 373# CONFIG_IP_SCTP is not set
374# CONFIG_RDS is not set
352# CONFIG_TIPC is not set 375# CONFIG_TIPC is not set
353# CONFIG_ATM is not set 376# CONFIG_ATM is not set
354# CONFIG_BRIDGE is not set 377# CONFIG_BRIDGE is not set
@@ -363,6 +386,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
363# CONFIG_ECONET is not set 386# CONFIG_ECONET is not set
364# CONFIG_WAN_ROUTER is not set 387# CONFIG_WAN_ROUTER is not set
365# CONFIG_PHONET is not set 388# CONFIG_PHONET is not set
389# CONFIG_IEEE802154 is not set
366# CONFIG_NET_SCHED is not set 390# CONFIG_NET_SCHED is not set
367# CONFIG_DCB is not set 391# CONFIG_DCB is not set
368 392
@@ -388,6 +412,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
388# Generic Driver Options 412# Generic Driver Options
389# 413#
390CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 414CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
415# CONFIG_DEVTMPFS is not set
391CONFIG_STANDALONE=y 416CONFIG_STANDALONE=y
392CONFIG_PREVENT_FIRMWARE_BUILD=y 417CONFIG_PREVENT_FIRMWARE_BUILD=y
393# CONFIG_FW_LOADER is not set 418# CONFIG_FW_LOADER is not set
@@ -397,9 +422,9 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
397# CONFIG_CONNECTOR is not set 422# CONFIG_CONNECTOR is not set
398CONFIG_MTD=y 423CONFIG_MTD=y
399# CONFIG_MTD_DEBUG is not set 424# CONFIG_MTD_DEBUG is not set
425# CONFIG_MTD_TESTS is not set
400CONFIG_MTD_CONCAT=y 426CONFIG_MTD_CONCAT=y
401CONFIG_MTD_PARTITIONS=y 427CONFIG_MTD_PARTITIONS=y
402# CONFIG_MTD_TESTS is not set
403# CONFIG_MTD_REDBOOT_PARTS is not set 428# CONFIG_MTD_REDBOOT_PARTS is not set
404CONFIG_MTD_CMDLINE_PARTS=y 429CONFIG_MTD_CMDLINE_PARTS=y
405CONFIG_MTD_OF_PARTS=y 430CONFIG_MTD_OF_PARTS=y
@@ -458,6 +483,7 @@ CONFIG_MTD_PHYSMAP_OF=y
458# CONFIG_MTD_PMC551 is not set 483# CONFIG_MTD_PMC551 is not set
459# CONFIG_MTD_DATAFLASH is not set 484# CONFIG_MTD_DATAFLASH is not set
460# CONFIG_MTD_M25P80 is not set 485# CONFIG_MTD_M25P80 is not set
486# CONFIG_MTD_SST25L is not set
461# CONFIG_MTD_SLRAM is not set 487# CONFIG_MTD_SLRAM is not set
462# CONFIG_MTD_PHRAM is not set 488# CONFIG_MTD_PHRAM is not set
463# CONFIG_MTD_MTDRAM is not set 489# CONFIG_MTD_MTDRAM is not set
@@ -493,6 +519,7 @@ CONFIG_OF_DEVICE=y
493CONFIG_OF_GPIO=y 519CONFIG_OF_GPIO=y
494CONFIG_OF_I2C=y 520CONFIG_OF_I2C=y
495CONFIG_OF_SPI=y 521CONFIG_OF_SPI=y
522CONFIG_OF_MDIO=y
496# CONFIG_PARPORT is not set 523# CONFIG_PARPORT is not set
497CONFIG_BLK_DEV=y 524CONFIG_BLK_DEV=y
498# CONFIG_BLK_DEV_FD is not set 525# CONFIG_BLK_DEV_FD is not set
@@ -529,7 +556,9 @@ CONFIG_MISC_DEVICES=y
529CONFIG_EEPROM_AT24=y 556CONFIG_EEPROM_AT24=y
530# CONFIG_EEPROM_AT25 is not set 557# CONFIG_EEPROM_AT25 is not set
531# CONFIG_EEPROM_LEGACY is not set 558# CONFIG_EEPROM_LEGACY is not set
559# CONFIG_EEPROM_MAX6875 is not set
532# CONFIG_EEPROM_93CX6 is not set 560# CONFIG_EEPROM_93CX6 is not set
561# CONFIG_CB710_CORE is not set
533CONFIG_HAVE_IDE=y 562CONFIG_HAVE_IDE=y
534# CONFIG_IDE is not set 563# CONFIG_IDE is not set
535 564
@@ -552,10 +581,6 @@ CONFIG_BLK_DEV_SD=y
552# CONFIG_BLK_DEV_SR is not set 581# CONFIG_BLK_DEV_SR is not set
553CONFIG_CHR_DEV_SG=y 582CONFIG_CHR_DEV_SG=y
554# CONFIG_CHR_DEV_SCH is not set 583# CONFIG_CHR_DEV_SCH is not set
555
556#
557# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
558#
559# CONFIG_SCSI_MULTI_LUN is not set 584# CONFIG_SCSI_MULTI_LUN is not set
560# CONFIG_SCSI_CONSTANTS is not set 585# CONFIG_SCSI_CONSTANTS is not set
561# CONFIG_SCSI_LOGGING is not set 586# CONFIG_SCSI_LOGGING is not set
@@ -572,6 +597,8 @@ CONFIG_SCSI_WAIT_SCAN=m
572# CONFIG_SCSI_SRP_ATTRS is not set 597# CONFIG_SCSI_SRP_ATTRS is not set
573CONFIG_SCSI_LOWLEVEL=y 598CONFIG_SCSI_LOWLEVEL=y
574# CONFIG_ISCSI_TCP is not set 599# CONFIG_ISCSI_TCP is not set
600# CONFIG_SCSI_BNX2_ISCSI is not set
601# CONFIG_BE2ISCSI is not set
575# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 602# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
576# CONFIG_SCSI_3W_9XXX is not set 603# CONFIG_SCSI_3W_9XXX is not set
577# CONFIG_SCSI_ACARD is not set 604# CONFIG_SCSI_ACARD is not set
@@ -580,6 +607,7 @@ CONFIG_SCSI_LOWLEVEL=y
580# CONFIG_SCSI_AIC7XXX_OLD is not set 607# CONFIG_SCSI_AIC7XXX_OLD is not set
581# CONFIG_SCSI_AIC79XX is not set 608# CONFIG_SCSI_AIC79XX is not set
582# CONFIG_SCSI_AIC94XX is not set 609# CONFIG_SCSI_AIC94XX is not set
610# CONFIG_SCSI_MVSAS is not set
583# CONFIG_SCSI_DPT_I2O is not set 611# CONFIG_SCSI_DPT_I2O is not set
584# CONFIG_SCSI_ADVANSYS is not set 612# CONFIG_SCSI_ADVANSYS is not set
585# CONFIG_SCSI_ARCMSR is not set 613# CONFIG_SCSI_ARCMSR is not set
@@ -599,7 +627,6 @@ CONFIG_SCSI_LOWLEVEL=y
599# CONFIG_SCSI_IPS is not set 627# CONFIG_SCSI_IPS is not set
600# CONFIG_SCSI_INITIO is not set 628# CONFIG_SCSI_INITIO is not set
601# CONFIG_SCSI_INIA100 is not set 629# CONFIG_SCSI_INIA100 is not set
602# CONFIG_SCSI_MVSAS is not set
603# CONFIG_SCSI_STEX is not set 630# CONFIG_SCSI_STEX is not set
604# CONFIG_SCSI_SYM53C8XX_2 is not set 631# CONFIG_SCSI_SYM53C8XX_2 is not set
605# CONFIG_SCSI_IPR is not set 632# CONFIG_SCSI_IPR is not set
@@ -611,11 +638,14 @@ CONFIG_SCSI_LOWLEVEL=y
611# CONFIG_SCSI_DC390T is not set 638# CONFIG_SCSI_DC390T is not set
612# CONFIG_SCSI_NSP32 is not set 639# CONFIG_SCSI_NSP32 is not set
613# CONFIG_SCSI_DEBUG is not set 640# CONFIG_SCSI_DEBUG is not set
641# CONFIG_SCSI_PMCRAID is not set
614# CONFIG_SCSI_SRP is not set 642# CONFIG_SCSI_SRP is not set
643# CONFIG_SCSI_BFA_FC is not set
615# CONFIG_SCSI_DH is not set 644# CONFIG_SCSI_DH is not set
616# CONFIG_SCSI_OSD_INITIATOR is not set 645# CONFIG_SCSI_OSD_INITIATOR is not set
617CONFIG_ATA=y 646CONFIG_ATA=y
618# CONFIG_ATA_NONSTANDARD is not set 647# CONFIG_ATA_NONSTANDARD is not set
648CONFIG_ATA_VERBOSE_ERROR=y
619CONFIG_SATA_PMP=y 649CONFIG_SATA_PMP=y
620# CONFIG_SATA_AHCI is not set 650# CONFIG_SATA_AHCI is not set
621# CONFIG_SATA_SIL24 is not set 651# CONFIG_SATA_SIL24 is not set
@@ -637,6 +667,7 @@ CONFIG_ATA_SFF=y
637# CONFIG_PATA_ALI is not set 667# CONFIG_PATA_ALI is not set
638# CONFIG_PATA_AMD is not set 668# CONFIG_PATA_AMD is not set
639# CONFIG_PATA_ARTOP is not set 669# CONFIG_PATA_ARTOP is not set
670# CONFIG_PATA_ATP867X is not set
640# CONFIG_PATA_ATIIXP is not set 671# CONFIG_PATA_ATIIXP is not set
641# CONFIG_PATA_CMD640_PCI is not set 672# CONFIG_PATA_CMD640_PCI is not set
642# CONFIG_PATA_CMD64X is not set 673# CONFIG_PATA_CMD64X is not set
@@ -665,6 +696,7 @@ CONFIG_PATA_MPC52xx=y
665# CONFIG_PATA_OPTIDMA is not set 696# CONFIG_PATA_OPTIDMA is not set
666# CONFIG_PATA_PDC_OLD is not set 697# CONFIG_PATA_PDC_OLD is not set
667# CONFIG_PATA_RADISYS is not set 698# CONFIG_PATA_RADISYS is not set
699# CONFIG_PATA_RDC is not set
668# CONFIG_PATA_RZ1000 is not set 700# CONFIG_PATA_RZ1000 is not set
669# CONFIG_PATA_SC1200 is not set 701# CONFIG_PATA_SC1200 is not set
670# CONFIG_PATA_SERVERWORKS is not set 702# CONFIG_PATA_SERVERWORKS is not set
@@ -684,14 +716,17 @@ CONFIG_PATA_PLATFORM=y
684# 716#
685 717
686# 718#
687# Enable only one of the two stacks, unless you know what you are doing 719# You can enable one or both FireWire driver stacks.
720#
721
722#
723# See the help texts for more information.
688# 724#
689# CONFIG_FIREWIRE is not set 725# CONFIG_FIREWIRE is not set
690# CONFIG_IEEE1394 is not set 726# CONFIG_IEEE1394 is not set
691# CONFIG_I2O is not set 727# CONFIG_I2O is not set
692# CONFIG_MACINTOSH_DRIVERS is not set 728# CONFIG_MACINTOSH_DRIVERS is not set
693CONFIG_NETDEVICES=y 729CONFIG_NETDEVICES=y
694CONFIG_COMPAT_NET_DEV_OPS=y
695# CONFIG_DUMMY is not set 730# CONFIG_DUMMY is not set
696# CONFIG_BONDING is not set 731# CONFIG_BONDING is not set
697# CONFIG_MACVLAN is not set 732# CONFIG_MACVLAN is not set
@@ -739,16 +774,17 @@ CONFIG_NET_ETHERNET=y
739# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 774# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
740# CONFIG_NET_PCI is not set 775# CONFIG_NET_PCI is not set
741# CONFIG_B44 is not set 776# CONFIG_B44 is not set
777# CONFIG_KS8842 is not set
778# CONFIG_KS8851 is not set
779# CONFIG_KS8851_MLL is not set
742CONFIG_FEC_MPC52xx=y 780CONFIG_FEC_MPC52xx=y
743CONFIG_FEC_MPC52xx_MDIO=y 781CONFIG_FEC_MPC52xx_MDIO=y
744# CONFIG_ATL2 is not set 782# CONFIG_ATL2 is not set
783# CONFIG_XILINX_EMACLITE is not set
745# CONFIG_NETDEV_1000 is not set 784# CONFIG_NETDEV_1000 is not set
746# CONFIG_NETDEV_10000 is not set 785# CONFIG_NETDEV_10000 is not set
747# CONFIG_TR is not set 786# CONFIG_TR is not set
748 787CONFIG_WLAN=y
749#
750# Wireless LAN
751#
752# CONFIG_WLAN_PRE80211 is not set 788# CONFIG_WLAN_PRE80211 is not set
753# CONFIG_WLAN_80211 is not set 789# CONFIG_WLAN_80211 is not set
754 790
@@ -854,6 +890,7 @@ CONFIG_LEGACY_PTY_COUNT=256
854CONFIG_DEVPORT=y 890CONFIG_DEVPORT=y
855CONFIG_I2C=y 891CONFIG_I2C=y
856CONFIG_I2C_BOARDINFO=y 892CONFIG_I2C_BOARDINFO=y
893CONFIG_I2C_COMPAT=y
857CONFIG_I2C_CHARDEV=y 894CONFIG_I2C_CHARDEV=y
858CONFIG_I2C_HELPER_AUTO=y 895CONFIG_I2C_HELPER_AUTO=y
859CONFIG_I2C_ALGOBIT=y 896CONFIG_I2C_ALGOBIT=y
@@ -883,6 +920,7 @@ CONFIG_I2C_ALGOBIT=y
883# 920#
884# I2C system bus drivers (mostly embedded / system-on-chip) 921# I2C system bus drivers (mostly embedded / system-on-chip)
885# 922#
923# CONFIG_I2C_DESIGNWARE is not set
886# CONFIG_I2C_GPIO is not set 924# CONFIG_I2C_GPIO is not set
887CONFIG_I2C_MPC=y 925CONFIG_I2C_MPC=y
888# CONFIG_I2C_OCORES is not set 926# CONFIG_I2C_OCORES is not set
@@ -910,10 +948,6 @@ CONFIG_I2C_MPC=y
910# Miscellaneous I2C Chip support 948# Miscellaneous I2C Chip support
911# 949#
912# CONFIG_DS1682 is not set 950# CONFIG_DS1682 is not set
913# CONFIG_SENSORS_PCF8574 is not set
914# CONFIG_PCF8575 is not set
915# CONFIG_SENSORS_PCA9539 is not set
916# CONFIG_SENSORS_MAX6875 is not set
917# CONFIG_SENSORS_TSL2550 is not set 951# CONFIG_SENSORS_TSL2550 is not set
918# CONFIG_I2C_DEBUG_CORE is not set 952# CONFIG_I2C_DEBUG_CORE is not set
919# CONFIG_I2C_DEBUG_ALGO is not set 953# CONFIG_I2C_DEBUG_ALGO is not set
@@ -935,6 +969,11 @@ CONFIG_SPI_MPC52xx_PSC=m
935# 969#
936CONFIG_SPI_SPIDEV=m 970CONFIG_SPI_SPIDEV=m
937# CONFIG_SPI_TLE62X0 is not set 971# CONFIG_SPI_TLE62X0 is not set
972
973#
974# PPS support
975#
976# CONFIG_PPS is not set
938CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 977CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
939CONFIG_ARCH_REQUIRE_GPIOLIB=y 978CONFIG_ARCH_REQUIRE_GPIOLIB=y
940CONFIG_GPIOLIB=y 979CONFIG_GPIOLIB=y
@@ -957,16 +996,27 @@ CONFIG_GPIOLIB=y
957# PCI GPIO expanders: 996# PCI GPIO expanders:
958# 997#
959# CONFIG_GPIO_BT8XX is not set 998# CONFIG_GPIO_BT8XX is not set
999# CONFIG_GPIO_LANGWELL is not set
960 1000
961# 1001#
962# SPI GPIO expanders: 1002# SPI GPIO expanders:
963# 1003#
964# CONFIG_GPIO_MAX7301 is not set 1004# CONFIG_GPIO_MAX7301 is not set
965# CONFIG_GPIO_MCP23S08 is not set 1005# CONFIG_GPIO_MCP23S08 is not set
1006# CONFIG_GPIO_MC33880 is not set
1007
1008#
1009# AC97 GPIO expanders:
1010#
966# CONFIG_W1 is not set 1011# CONFIG_W1 is not set
967# CONFIG_POWER_SUPPLY is not set 1012# CONFIG_POWER_SUPPLY is not set
968CONFIG_HWMON=y 1013CONFIG_HWMON=y
969# CONFIG_HWMON_VID is not set 1014# CONFIG_HWMON_VID is not set
1015# CONFIG_HWMON_DEBUG_CHIP is not set
1016
1017#
1018# Native drivers
1019#
970# CONFIG_SENSORS_AD7414 is not set 1020# CONFIG_SENSORS_AD7414 is not set
971# CONFIG_SENSORS_AD7418 is not set 1021# CONFIG_SENSORS_AD7418 is not set
972# CONFIG_SENSORS_ADCXX is not set 1022# CONFIG_SENSORS_ADCXX is not set
@@ -1019,6 +1069,8 @@ CONFIG_HWMON=y
1019# CONFIG_SENSORS_SMSC47B397 is not set 1069# CONFIG_SENSORS_SMSC47B397 is not set
1020# CONFIG_SENSORS_ADS7828 is not set 1070# CONFIG_SENSORS_ADS7828 is not set
1021# CONFIG_SENSORS_THMC50 is not set 1071# CONFIG_SENSORS_THMC50 is not set
1072# CONFIG_SENSORS_TMP401 is not set
1073# CONFIG_SENSORS_TMP421 is not set
1022# CONFIG_SENSORS_VIA686A is not set 1074# CONFIG_SENSORS_VIA686A is not set
1023# CONFIG_SENSORS_VT1211 is not set 1075# CONFIG_SENSORS_VT1211 is not set
1024# CONFIG_SENSORS_VT8231 is not set 1076# CONFIG_SENSORS_VT8231 is not set
@@ -1031,9 +1083,7 @@ CONFIG_HWMON=y
1031# CONFIG_SENSORS_W83627HF is not set 1083# CONFIG_SENSORS_W83627HF is not set
1032# CONFIG_SENSORS_W83627EHF is not set 1084# CONFIG_SENSORS_W83627EHF is not set
1033# CONFIG_SENSORS_LIS3_SPI is not set 1085# CONFIG_SENSORS_LIS3_SPI is not set
1034# CONFIG_HWMON_DEBUG_CHIP is not set
1035# CONFIG_THERMAL is not set 1086# CONFIG_THERMAL is not set
1036# CONFIG_THERMAL_HWMON is not set
1037CONFIG_WATCHDOG=y 1087CONFIG_WATCHDOG=y
1038# CONFIG_WATCHDOG_NOWAYOUT is not set 1088# CONFIG_WATCHDOG_NOWAYOUT is not set
1039 1089
@@ -1073,31 +1123,20 @@ CONFIG_SSB_POSSIBLE=y
1073# CONFIG_MFD_TMIO is not set 1123# CONFIG_MFD_TMIO is not set
1074# CONFIG_PMIC_DA903X is not set 1124# CONFIG_PMIC_DA903X is not set
1075# CONFIG_MFD_WM8400 is not set 1125# CONFIG_MFD_WM8400 is not set
1126# CONFIG_MFD_WM831X is not set
1076# CONFIG_MFD_WM8350_I2C is not set 1127# CONFIG_MFD_WM8350_I2C is not set
1077# CONFIG_MFD_PCF50633 is not set 1128# CONFIG_MFD_PCF50633 is not set
1129# CONFIG_MFD_MC13783 is not set
1130# CONFIG_AB3100_CORE is not set
1131# CONFIG_EZX_PCAP is not set
1078# CONFIG_REGULATOR is not set 1132# CONFIG_REGULATOR is not set
1079 1133# CONFIG_MEDIA_SUPPORT is not set
1080#
1081# Multimedia devices
1082#
1083
1084#
1085# Multimedia core support
1086#
1087# CONFIG_VIDEO_DEV is not set
1088# CONFIG_DVB_CORE is not set
1089# CONFIG_VIDEO_MEDIA is not set
1090
1091#
1092# Multimedia drivers
1093#
1094CONFIG_DAB=y
1095# CONFIG_USB_DABUSB is not set
1096 1134
1097# 1135#
1098# Graphics support 1136# Graphics support
1099# 1137#
1100# CONFIG_AGP is not set 1138# CONFIG_AGP is not set
1139CONFIG_VGA_ARB=y
1101CONFIG_DRM=y 1140CONFIG_DRM=y
1102# CONFIG_DRM_TDFX is not set 1141# CONFIG_DRM_TDFX is not set
1103# CONFIG_DRM_R128 is not set 1142# CONFIG_DRM_R128 is not set
@@ -1167,6 +1206,7 @@ CONFIG_FB_RADEON_BACKLIGHT=y
1167# CONFIG_FB_BROADSHEET is not set 1206# CONFIG_FB_BROADSHEET is not set
1168CONFIG_BACKLIGHT_LCD_SUPPORT=y 1207CONFIG_BACKLIGHT_LCD_SUPPORT=y
1169CONFIG_LCD_CLASS_DEVICE=m 1208CONFIG_LCD_CLASS_DEVICE=m
1209# CONFIG_LCD_LMS283GF05 is not set
1170# CONFIG_LCD_LTV350QV is not set 1210# CONFIG_LCD_LTV350QV is not set
1171# CONFIG_LCD_ILI9320 is not set 1211# CONFIG_LCD_ILI9320 is not set
1172# CONFIG_LCD_TDO24M is not set 1212# CONFIG_LCD_TDO24M is not set
@@ -1198,7 +1238,6 @@ CONFIG_LOGO_LINUX_CLUT224=y
1198# CONFIG_SOUND is not set 1238# CONFIG_SOUND is not set
1199CONFIG_HID_SUPPORT=y 1239CONFIG_HID_SUPPORT=y
1200CONFIG_HID=y 1240CONFIG_HID=y
1201# CONFIG_HID_DEBUG is not set
1202# CONFIG_HIDRAW is not set 1241# CONFIG_HIDRAW is not set
1203 1242
1204# 1243#
@@ -1217,10 +1256,11 @@ CONFIG_HID_BELKIN=y
1217CONFIG_HID_CHERRY=y 1256CONFIG_HID_CHERRY=y
1218# CONFIG_HID_CHICONY is not set 1257# CONFIG_HID_CHICONY is not set
1219CONFIG_HID_CYPRESS=y 1258CONFIG_HID_CYPRESS=y
1220# CONFIG_DRAGONRISE_FF is not set 1259# CONFIG_HID_DRAGONRISE is not set
1221CONFIG_HID_EZKEY=y 1260CONFIG_HID_EZKEY=y
1222# CONFIG_HID_KYE is not set 1261# CONFIG_HID_KYE is not set
1223# CONFIG_HID_GYRATION is not set 1262# CONFIG_HID_GYRATION is not set
1263# CONFIG_HID_TWINHAN is not set
1224# CONFIG_HID_KENSINGTON is not set 1264# CONFIG_HID_KENSINGTON is not set
1225# CONFIG_HID_LOGITECH is not set 1265# CONFIG_HID_LOGITECH is not set
1226# CONFIG_HID_MICROSOFT is not set 1266# CONFIG_HID_MICROSOFT is not set
@@ -1231,10 +1271,11 @@ CONFIG_HID_EZKEY=y
1231# CONFIG_HID_SAMSUNG is not set 1271# CONFIG_HID_SAMSUNG is not set
1232# CONFIG_HID_SONY is not set 1272# CONFIG_HID_SONY is not set
1233# CONFIG_HID_SUNPLUS is not set 1273# CONFIG_HID_SUNPLUS is not set
1234# CONFIG_GREENASIA_FF is not set 1274# CONFIG_HID_GREENASIA is not set
1275# CONFIG_HID_SMARTJOYPLUS is not set
1235# CONFIG_HID_TOPSEED is not set 1276# CONFIG_HID_TOPSEED is not set
1236# CONFIG_THRUSTMASTER_FF is not set 1277# CONFIG_HID_THRUSTMASTER is not set
1237# CONFIG_ZEROPLUS_FF is not set 1278# CONFIG_HID_ZEROPLUS is not set
1238CONFIG_USB_SUPPORT=y 1279CONFIG_USB_SUPPORT=y
1239CONFIG_USB_ARCH_HAS_HCD=y 1280CONFIG_USB_ARCH_HAS_HCD=y
1240CONFIG_USB_ARCH_HAS_OHCI=y 1281CONFIG_USB_ARCH_HAS_OHCI=y
@@ -1261,15 +1302,17 @@ CONFIG_USB_MON=y
1261# USB Host Controller Drivers 1302# USB Host Controller Drivers
1262# 1303#
1263# CONFIG_USB_C67X00_HCD is not set 1304# CONFIG_USB_C67X00_HCD is not set
1305# CONFIG_USB_XHCI_HCD is not set
1264# CONFIG_USB_EHCI_HCD is not set 1306# CONFIG_USB_EHCI_HCD is not set
1265# CONFIG_USB_OXU210HP_HCD is not set 1307# CONFIG_USB_OXU210HP_HCD is not set
1266# CONFIG_USB_ISP116X_HCD is not set 1308# CONFIG_USB_ISP116X_HCD is not set
1267# CONFIG_USB_ISP1760_HCD is not set 1309# CONFIG_USB_ISP1760_HCD is not set
1310# CONFIG_USB_ISP1362_HCD is not set
1268CONFIG_USB_OHCI_HCD=y 1311CONFIG_USB_OHCI_HCD=y
1269CONFIG_USB_OHCI_HCD_PPC_SOC=y 1312CONFIG_USB_OHCI_HCD_PPC_SOC=y
1270CONFIG_USB_OHCI_HCD_PPC_OF=y
1271CONFIG_USB_OHCI_HCD_PPC_OF_BE=y 1313CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
1272# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set 1314# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
1315CONFIG_USB_OHCI_HCD_PPC_OF=y
1273CONFIG_USB_OHCI_HCD_PCI=y 1316CONFIG_USB_OHCI_HCD_PCI=y
1274CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y 1317CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
1275CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y 1318CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
@@ -1400,6 +1443,7 @@ CONFIG_RTC_DRV_DS1307=y
1400# CONFIG_RTC_DRV_S35390A is not set 1443# CONFIG_RTC_DRV_S35390A is not set
1401# CONFIG_RTC_DRV_FM3130 is not set 1444# CONFIG_RTC_DRV_FM3130 is not set
1402# CONFIG_RTC_DRV_RX8581 is not set 1445# CONFIG_RTC_DRV_RX8581 is not set
1446# CONFIG_RTC_DRV_RX8025 is not set
1403 1447
1404# 1448#
1405# SPI RTC drivers 1449# SPI RTC drivers
@@ -1411,6 +1455,7 @@ CONFIG_RTC_DRV_DS1307=y
1411# CONFIG_RTC_DRV_R9701 is not set 1455# CONFIG_RTC_DRV_R9701 is not set
1412# CONFIG_RTC_DRV_RS5C348 is not set 1456# CONFIG_RTC_DRV_RS5C348 is not set
1413# CONFIG_RTC_DRV_DS3234 is not set 1457# CONFIG_RTC_DRV_DS3234 is not set
1458# CONFIG_RTC_DRV_PCF2123 is not set
1414 1459
1415# 1460#
1416# Platform RTC drivers 1461# Platform RTC drivers
@@ -1434,6 +1479,10 @@ CONFIG_RTC_DRV_DS1307=y
1434# CONFIG_DMADEVICES is not set 1479# CONFIG_DMADEVICES is not set
1435# CONFIG_AUXDISPLAY is not set 1480# CONFIG_AUXDISPLAY is not set
1436# CONFIG_UIO is not set 1481# CONFIG_UIO is not set
1482
1483#
1484# TI VLYNQ
1485#
1437# CONFIG_STAGING is not set 1486# CONFIG_STAGING is not set
1438 1487
1439# 1488#
@@ -1453,10 +1502,13 @@ CONFIG_FS_MBCACHE=y
1453# CONFIG_REISERFS_FS is not set 1502# CONFIG_REISERFS_FS is not set
1454# CONFIG_JFS_FS is not set 1503# CONFIG_JFS_FS is not set
1455# CONFIG_FS_POSIX_ACL is not set 1504# CONFIG_FS_POSIX_ACL is not set
1456CONFIG_FILE_LOCKING=y
1457# CONFIG_XFS_FS is not set 1505# CONFIG_XFS_FS is not set
1506# CONFIG_GFS2_FS is not set
1458# CONFIG_OCFS2_FS is not set 1507# CONFIG_OCFS2_FS is not set
1459# CONFIG_BTRFS_FS is not set 1508# CONFIG_BTRFS_FS is not set
1509# CONFIG_NILFS2_FS is not set
1510CONFIG_FILE_LOCKING=y
1511CONFIG_FSNOTIFY=y
1460CONFIG_DNOTIFY=y 1512CONFIG_DNOTIFY=y
1461CONFIG_INOTIFY=y 1513CONFIG_INOTIFY=y
1462CONFIG_INOTIFY_USER=y 1514CONFIG_INOTIFY_USER=y
@@ -1533,12 +1585,12 @@ CONFIG_CRAMFS=y
1533# CONFIG_ROMFS_FS is not set 1585# CONFIG_ROMFS_FS is not set
1534# CONFIG_SYSV_FS is not set 1586# CONFIG_SYSV_FS is not set
1535# CONFIG_UFS_FS is not set 1587# CONFIG_UFS_FS is not set
1536# CONFIG_NILFS2_FS is not set
1537CONFIG_NETWORK_FILESYSTEMS=y 1588CONFIG_NETWORK_FILESYSTEMS=y
1538CONFIG_NFS_FS=y 1589CONFIG_NFS_FS=y
1539CONFIG_NFS_V3=y 1590CONFIG_NFS_V3=y
1540# CONFIG_NFS_V3_ACL is not set 1591# CONFIG_NFS_V3_ACL is not set
1541CONFIG_NFS_V4=y 1592CONFIG_NFS_V4=y
1593# CONFIG_NFS_V4_1 is not set
1542CONFIG_ROOT_NFS=y 1594CONFIG_ROOT_NFS=y
1543# CONFIG_NFSD is not set 1595# CONFIG_NFSD is not set
1544CONFIG_LOCKD=y 1596CONFIG_LOCKD=y
@@ -1624,6 +1676,7 @@ CONFIG_HAS_IOPORT=y
1624CONFIG_HAS_DMA=y 1676CONFIG_HAS_DMA=y
1625CONFIG_HAVE_LMB=y 1677CONFIG_HAVE_LMB=y
1626CONFIG_NLATTR=y 1678CONFIG_NLATTR=y
1679CONFIG_GENERIC_ATOMIC64=y
1627 1680
1628# 1681#
1629# Kernel hacking 1682# Kernel hacking
@@ -1633,6 +1686,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1633CONFIG_ENABLE_MUST_CHECK=y 1686CONFIG_ENABLE_MUST_CHECK=y
1634CONFIG_FRAME_WARN=1024 1687CONFIG_FRAME_WARN=1024
1635# CONFIG_MAGIC_SYSRQ is not set 1688# CONFIG_MAGIC_SYSRQ is not set
1689# CONFIG_STRIP_ASM_SYMS is not set
1636# CONFIG_UNUSED_SYMBOLS is not set 1690# CONFIG_UNUSED_SYMBOLS is not set
1637# CONFIG_DEBUG_FS is not set 1691# CONFIG_DEBUG_FS is not set
1638# CONFIG_HEADERS_CHECK is not set 1692# CONFIG_HEADERS_CHECK is not set
@@ -1650,10 +1704,14 @@ CONFIG_SCHED_DEBUG=y
1650# CONFIG_DEBUG_OBJECTS is not set 1704# CONFIG_DEBUG_OBJECTS is not set
1651# CONFIG_SLUB_DEBUG_ON is not set 1705# CONFIG_SLUB_DEBUG_ON is not set
1652# CONFIG_SLUB_STATS is not set 1706# CONFIG_SLUB_STATS is not set
1707# CONFIG_DEBUG_KMEMLEAK is not set
1653# CONFIG_DEBUG_RT_MUTEXES is not set 1708# CONFIG_DEBUG_RT_MUTEXES is not set
1654# CONFIG_RT_MUTEX_TESTER is not set 1709# CONFIG_RT_MUTEX_TESTER is not set
1655# CONFIG_DEBUG_SPINLOCK is not set 1710# CONFIG_DEBUG_SPINLOCK is not set
1656# CONFIG_DEBUG_MUTEXES is not set 1711# CONFIG_DEBUG_MUTEXES is not set
1712# CONFIG_DEBUG_LOCK_ALLOC is not set
1713# CONFIG_PROVE_LOCKING is not set
1714# CONFIG_LOCK_STAT is not set
1657# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1715# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1658# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1716# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1659# CONFIG_DEBUG_KOBJECT is not set 1717# CONFIG_DEBUG_KOBJECT is not set
@@ -1665,11 +1723,12 @@ CONFIG_DEBUG_INFO=y
1665# CONFIG_DEBUG_LIST is not set 1723# CONFIG_DEBUG_LIST is not set
1666# CONFIG_DEBUG_SG is not set 1724# CONFIG_DEBUG_SG is not set
1667# CONFIG_DEBUG_NOTIFIERS is not set 1725# CONFIG_DEBUG_NOTIFIERS is not set
1668# CONFIG_BOOT_PRINTK_DELAY is not set 1726# CONFIG_DEBUG_CREDENTIALS is not set
1669# CONFIG_RCU_TORTURE_TEST is not set 1727# CONFIG_RCU_TORTURE_TEST is not set
1670# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1728# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1671# CONFIG_BACKTRACE_SELF_TEST is not set 1729# CONFIG_BACKTRACE_SELF_TEST is not set
1672# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1730# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1731# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1673# CONFIG_FAULT_INJECTION is not set 1732# CONFIG_FAULT_INJECTION is not set
1674# CONFIG_LATENCYTOP is not set 1733# CONFIG_LATENCYTOP is not set
1675# CONFIG_DEBUG_PAGEALLOC is not set 1734# CONFIG_DEBUG_PAGEALLOC is not set
@@ -1678,23 +1737,25 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1678CONFIG_HAVE_DYNAMIC_FTRACE=y 1737CONFIG_HAVE_DYNAMIC_FTRACE=y
1679CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1738CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1680CONFIG_TRACING_SUPPORT=y 1739CONFIG_TRACING_SUPPORT=y
1681 1740CONFIG_FTRACE=y
1682#
1683# Tracers
1684#
1685# CONFIG_FUNCTION_TRACER is not set 1741# CONFIG_FUNCTION_TRACER is not set
1742# CONFIG_IRQSOFF_TRACER is not set
1686# CONFIG_SCHED_TRACER is not set 1743# CONFIG_SCHED_TRACER is not set
1687# CONFIG_CONTEXT_SWITCH_TRACER is not set 1744# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1688# CONFIG_EVENT_TRACER is not set
1689# CONFIG_BOOT_TRACER is not set 1745# CONFIG_BOOT_TRACER is not set
1690# CONFIG_TRACE_BRANCH_PROFILING is not set 1746CONFIG_BRANCH_PROFILE_NONE=y
1747# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1748# CONFIG_PROFILE_ALL_BRANCHES is not set
1691# CONFIG_STACK_TRACER is not set 1749# CONFIG_STACK_TRACER is not set
1692# CONFIG_KMEMTRACE is not set 1750# CONFIG_KMEMTRACE is not set
1693# CONFIG_WORKQUEUE_TRACER is not set 1751# CONFIG_WORKQUEUE_TRACER is not set
1694# CONFIG_BLK_DEV_IO_TRACE is not set 1752# CONFIG_BLK_DEV_IO_TRACE is not set
1753# CONFIG_DMA_API_DEBUG is not set
1695# CONFIG_SAMPLES is not set 1754# CONFIG_SAMPLES is not set
1696CONFIG_HAVE_ARCH_KGDB=y 1755CONFIG_HAVE_ARCH_KGDB=y
1697# CONFIG_KGDB is not set 1756# CONFIG_KGDB is not set
1757# CONFIG_PPC_DISABLE_WERROR is not set
1758CONFIG_PPC_WERROR=y
1698CONFIG_PRINT_STACK_DEPTH=64 1759CONFIG_PRINT_STACK_DEPTH=64
1699# CONFIG_DEBUG_STACKOVERFLOW is not set 1760# CONFIG_DEBUG_STACKOVERFLOW is not set
1700# CONFIG_DEBUG_STACK_USAGE is not set 1761# CONFIG_DEBUG_STACK_USAGE is not set
@@ -1719,7 +1780,6 @@ CONFIG_CRYPTO=y
1719# 1780#
1720# Crypto core or helper 1781# Crypto core or helper
1721# 1782#
1722# CONFIG_CRYPTO_FIPS is not set
1723CONFIG_CRYPTO_ALGAPI=y 1783CONFIG_CRYPTO_ALGAPI=y
1724CONFIG_CRYPTO_ALGAPI2=y 1784CONFIG_CRYPTO_ALGAPI2=y
1725CONFIG_CRYPTO_AEAD2=y 1785CONFIG_CRYPTO_AEAD2=y
@@ -1761,11 +1821,13 @@ CONFIG_CRYPTO_CBC=y
1761# 1821#
1762# CONFIG_CRYPTO_HMAC is not set 1822# CONFIG_CRYPTO_HMAC is not set
1763# CONFIG_CRYPTO_XCBC is not set 1823# CONFIG_CRYPTO_XCBC is not set
1824# CONFIG_CRYPTO_VMAC is not set
1764 1825
1765# 1826#
1766# Digest 1827# Digest
1767# 1828#
1768# CONFIG_CRYPTO_CRC32C is not set 1829# CONFIG_CRYPTO_CRC32C is not set
1830# CONFIG_CRYPTO_GHASH is not set
1769# CONFIG_CRYPTO_MD4 is not set 1831# CONFIG_CRYPTO_MD4 is not set
1770CONFIG_CRYPTO_MD5=y 1832CONFIG_CRYPTO_MD5=y
1771# CONFIG_CRYPTO_MICHAEL_MIC is not set 1833# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig
new file mode 100644
index 000000000000..18af46036258
--- /dev/null
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -0,0 +1,2199 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.32-rc5
4# Fri Oct 16 11:37:15 2009
5#
6CONFIG_PPC64=y
7
8#
9# Processor support
10#
11# CONFIG_PPC_BOOK3S_64 is not set
12CONFIG_PPC_BOOK3E_64=y
13CONFIG_PPC_BOOK3E=y
14CONFIG_PPC_FPU=y
15CONFIG_BOOKE=y
16CONFIG_PPC_MMU_NOHASH=y
17CONFIG_PPC_MMU_NOHASH_64=y
18CONFIG_PPC_BOOK3E_MMU=y
19# CONFIG_PPC_MM_SLICES is not set
20CONFIG_VIRT_CPU_ACCOUNTING=y
21CONFIG_PPC_HAVE_PMU_SUPPORT=y
22CONFIG_PPC_PERF_CTRS=y
23CONFIG_SMP=y
24CONFIG_NR_CPUS=32
25CONFIG_64BIT=y
26CONFIG_WORD_SIZE=64
27CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
28CONFIG_MMU=y
29CONFIG_GENERIC_CMOS_UPDATE=y
30CONFIG_GENERIC_TIME=y
31CONFIG_GENERIC_TIME_VSYSCALL=y
32CONFIG_GENERIC_CLOCKEVENTS=y
33CONFIG_GENERIC_HARDIRQS=y
34CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
35CONFIG_HAVE_SETUP_PER_CPU_AREA=y
36CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
37CONFIG_IRQ_PER_CPU=y
38CONFIG_STACKTRACE_SUPPORT=y
39CONFIG_HAVE_LATENCYTOP_SUPPORT=y
40CONFIG_TRACE_IRQFLAGS_SUPPORT=y
41CONFIG_LOCKDEP_SUPPORT=y
42CONFIG_RWSEM_XCHGADD_ALGORITHM=y
43CONFIG_ARCH_HAS_ILOG2_U32=y
44CONFIG_ARCH_HAS_ILOG2_U64=y
45CONFIG_GENERIC_HWEIGHT=y
46CONFIG_GENERIC_FIND_NEXT_BIT=y
47CONFIG_ARCH_NO_VIRT_TO_BUS=y
48CONFIG_PPC=y
49CONFIG_EARLY_PRINTK=y
50CONFIG_COMPAT=y
51CONFIG_SYSVIPC_COMPAT=y
52CONFIG_SCHED_OMIT_FRAME_POINTER=y
53CONFIG_ARCH_MAY_HAVE_PC_FDC=y
54CONFIG_PPC_OF=y
55CONFIG_OF=y
56# CONFIG_PPC_UDBG_16550 is not set
57# CONFIG_GENERIC_TBSYNC is not set
58CONFIG_AUDIT_ARCH=y
59CONFIG_GENERIC_BUG=y
60CONFIG_DTC=y
61# CONFIG_DEFAULT_UIMAGE is not set
62# CONFIG_PPC_DCR_NATIVE is not set
63# CONFIG_PPC_DCR_MMIO is not set
64# CONFIG_PPC_OF_PLATFORM_PCI is not set
65CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
66CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
67CONFIG_CONSTRUCTORS=y
68
69#
70# General setup
71#
72CONFIG_EXPERIMENTAL=y
73CONFIG_LOCK_KERNEL=y
74CONFIG_INIT_ENV_ARG_LIMIT=32
75CONFIG_LOCALVERSION=""
76CONFIG_LOCALVERSION_AUTO=y
77CONFIG_SWAP=y
78CONFIG_SYSVIPC=y
79CONFIG_SYSVIPC_SYSCTL=y
80CONFIG_POSIX_MQUEUE=y
81CONFIG_POSIX_MQUEUE_SYSCTL=y
82# CONFIG_BSD_PROCESS_ACCT is not set
83CONFIG_TASKSTATS=y
84CONFIG_TASK_DELAY_ACCT=y
85# CONFIG_TASK_XACCT is not set
86# CONFIG_AUDIT is not set
87
88#
89# RCU Subsystem
90#
91CONFIG_TREE_RCU=y
92# CONFIG_TREE_PREEMPT_RCU is not set
93# CONFIG_RCU_TRACE is not set
94CONFIG_RCU_FANOUT=64
95# CONFIG_RCU_FANOUT_EXACT is not set
96# CONFIG_TREE_RCU_TRACE is not set
97CONFIG_IKCONFIG=y
98CONFIG_IKCONFIG_PROC=y
99CONFIG_LOG_BUF_SHIFT=17
100# CONFIG_GROUP_SCHED is not set
101CONFIG_CGROUPS=y
102# CONFIG_CGROUP_DEBUG is not set
103# CONFIG_CGROUP_NS is not set
104# CONFIG_CGROUP_FREEZER is not set
105# CONFIG_CGROUP_DEVICE is not set
106CONFIG_CPUSETS=y
107CONFIG_PROC_PID_CPUSET=y
108# CONFIG_CGROUP_CPUACCT is not set
109# CONFIG_RESOURCE_COUNTERS is not set
110CONFIG_SYSFS_DEPRECATED=y
111CONFIG_SYSFS_DEPRECATED_V2=y
112CONFIG_RELAY=y
113CONFIG_NAMESPACES=y
114# CONFIG_UTS_NS is not set
115# CONFIG_IPC_NS is not set
116# CONFIG_USER_NS is not set
117# CONFIG_PID_NS is not set
118# CONFIG_NET_NS is not set
119CONFIG_BLK_DEV_INITRD=y
120CONFIG_INITRAMFS_SOURCE=""
121CONFIG_RD_GZIP=y
122CONFIG_RD_BZIP2=y
123CONFIG_RD_LZMA=y
124CONFIG_CC_OPTIMIZE_FOR_SIZE=y
125CONFIG_SYSCTL=y
126CONFIG_ANON_INODES=y
127# CONFIG_EMBEDDED is not set
128CONFIG_SYSCTL_SYSCALL=y
129CONFIG_KALLSYMS=y
130CONFIG_KALLSYMS_ALL=y
131# CONFIG_KALLSYMS_EXTRA_PASS is not set
132CONFIG_HOTPLUG=y
133CONFIG_PRINTK=y
134CONFIG_BUG=y
135CONFIG_ELF_CORE=y
136CONFIG_BASE_FULL=y
137CONFIG_FUTEX=y
138CONFIG_EPOLL=y
139CONFIG_SIGNALFD=y
140CONFIG_TIMERFD=y
141CONFIG_EVENTFD=y
142CONFIG_SHMEM=y
143CONFIG_AIO=y
144CONFIG_HAVE_PERF_EVENTS=y
145
146#
147# Kernel Performance Events And Counters
148#
149CONFIG_PERF_EVENTS=y
150CONFIG_EVENT_PROFILE=y
151# CONFIG_PERF_COUNTERS is not set
152# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
153CONFIG_VM_EVENT_COUNTERS=y
154CONFIG_PCI_QUIRKS=y
155CONFIG_SLUB_DEBUG=y
156# CONFIG_COMPAT_BRK is not set
157# CONFIG_SLAB is not set
158CONFIG_SLUB=y
159# CONFIG_SLOB is not set
160CONFIG_PROFILING=y
161CONFIG_TRACEPOINTS=y
162CONFIG_OPROFILE=y
163CONFIG_HAVE_OPROFILE=y
164# CONFIG_KPROBES is not set
165CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
166CONFIG_HAVE_SYSCALL_WRAPPERS=y
167CONFIG_HAVE_IOREMAP_PROT=y
168CONFIG_HAVE_KPROBES=y
169CONFIG_HAVE_KRETPROBES=y
170CONFIG_HAVE_ARCH_TRACEHOOK=y
171CONFIG_HAVE_DMA_ATTRS=y
172CONFIG_USE_GENERIC_SMP_HELPERS=y
173CONFIG_HAVE_DMA_API_DEBUG=y
174
175#
176# GCOV-based kernel profiling
177#
178# CONFIG_GCOV_KERNEL is not set
179CONFIG_SLOW_WORK=y
180# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
181CONFIG_SLABINFO=y
182CONFIG_RT_MUTEXES=y
183CONFIG_BASE_SMALL=0
184CONFIG_MODULES=y
185# CONFIG_MODULE_FORCE_LOAD is not set
186CONFIG_MODULE_UNLOAD=y
187# CONFIG_MODULE_FORCE_UNLOAD is not set
188CONFIG_MODVERSIONS=y
189CONFIG_MODULE_SRCVERSION_ALL=y
190CONFIG_STOP_MACHINE=y
191CONFIG_BLOCK=y
192CONFIG_BLK_DEV_BSG=y
193# CONFIG_BLK_DEV_INTEGRITY is not set
194CONFIG_BLOCK_COMPAT=y
195
196#
197# IO Schedulers
198#
199CONFIG_IOSCHED_NOOP=y
200CONFIG_IOSCHED_AS=y
201CONFIG_IOSCHED_DEADLINE=y
202CONFIG_IOSCHED_CFQ=y
203CONFIG_DEFAULT_AS=y
204# CONFIG_DEFAULT_DEADLINE is not set
205# CONFIG_DEFAULT_CFQ is not set
206# CONFIG_DEFAULT_NOOP is not set
207CONFIG_DEFAULT_IOSCHED="anticipatory"
208# CONFIG_FREEZER is not set
209
210#
211# Platform support
212#
213# CONFIG_PPC_CELL is not set
214# CONFIG_PPC_CELL_NATIVE is not set
215# CONFIG_PQ2ADS is not set
216CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
217# CONFIG_IPIC is not set
218# CONFIG_MPIC is not set
219# CONFIG_MPIC_WEIRD is not set
220# CONFIG_PPC_I8259 is not set
221# CONFIG_U3_DART is not set
222# CONFIG_PPC_RTAS is not set
223# CONFIG_MMIO_NVRAM is not set
224# CONFIG_PPC_MPC106 is not set
225# CONFIG_PPC_970_NAP is not set
226# CONFIG_PPC_INDIRECT_IO is not set
227# CONFIG_GENERIC_IOMAP is not set
228CONFIG_CPU_FREQ=y
229CONFIG_CPU_FREQ_TABLE=y
230# CONFIG_CPU_FREQ_DEBUG is not set
231CONFIG_CPU_FREQ_STAT=y
232# CONFIG_CPU_FREQ_STAT_DETAILS is not set
233CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
234# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
235# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
236# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
237# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
238CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
239CONFIG_CPU_FREQ_GOV_POWERSAVE=y
240CONFIG_CPU_FREQ_GOV_USERSPACE=y
241# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
242# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
243
244#
245# CPU Frequency drivers
246#
247# CONFIG_FSL_ULI1575 is not set
248# CONFIG_SIMPLE_GPIO is not set
249
250#
251# Kernel options
252#
253CONFIG_TICK_ONESHOT=y
254CONFIG_NO_HZ=y
255CONFIG_HIGH_RES_TIMERS=y
256CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
257# CONFIG_HZ_100 is not set
258CONFIG_HZ_250=y
259# CONFIG_HZ_300 is not set
260# CONFIG_HZ_1000 is not set
261CONFIG_HZ=250
262CONFIG_SCHED_HRTICK=y
263CONFIG_PREEMPT_NONE=y
264# CONFIG_PREEMPT_VOLUNTARY is not set
265# CONFIG_PREEMPT is not set
266CONFIG_BINFMT_ELF=y
267CONFIG_COMPAT_BINFMT_ELF=y
268# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
269# CONFIG_HAVE_AOUT is not set
270CONFIG_BINFMT_MISC=m
271CONFIG_IOMMU_VMERGE=y
272CONFIG_IOMMU_HELPER=y
273# CONFIG_SWIOTLB is not set
274CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
275CONFIG_ARCH_HAS_WALK_MEMORY=y
276CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
277# CONFIG_CRASH_DUMP is not set
278CONFIG_IRQ_ALL_CPUS=y
279# CONFIG_NUMA is not set
280CONFIG_MAX_ACTIVE_REGIONS=256
281CONFIG_ARCH_SELECT_MEMORY_MODEL=y
282CONFIG_ARCH_FLATMEM_ENABLE=y
283CONFIG_ARCH_SPARSEMEM_ENABLE=y
284CONFIG_ARCH_POPULATES_NODE_MAP=y
285CONFIG_SELECT_MEMORY_MODEL=y
286# CONFIG_FLATMEM_MANUAL is not set
287# CONFIG_DISCONTIGMEM_MANUAL is not set
288CONFIG_SPARSEMEM_MANUAL=y
289CONFIG_SPARSEMEM=y
290CONFIG_HAVE_MEMORY_PRESENT=y
291CONFIG_SPARSEMEM_EXTREME=y
292CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
293CONFIG_SPARSEMEM_VMEMMAP=y
294# CONFIG_MEMORY_HOTPLUG is not set
295CONFIG_PAGEFLAGS_EXTENDED=y
296CONFIG_SPLIT_PTLOCK_CPUS=4
297CONFIG_MIGRATION=y
298CONFIG_PHYS_ADDR_T_64BIT=y
299CONFIG_ZONE_DMA_FLAG=1
300CONFIG_BOUNCE=y
301CONFIG_HAVE_MLOCK=y
302CONFIG_HAVE_MLOCKED_PAGE_BIT=y
303# CONFIG_KSM is not set
304CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
305# CONFIG_PPC_HAS_HASH_64K is not set
306CONFIG_PPC_4K_PAGES=y
307# CONFIG_PPC_16K_PAGES is not set
308# CONFIG_PPC_64K_PAGES is not set
309# CONFIG_PPC_256K_PAGES is not set
310CONFIG_FORCE_MAX_ZONEORDER=13
311# CONFIG_SCHED_SMT is not set
312CONFIG_PROC_DEVICETREE=y
313# CONFIG_CMDLINE_BOOL is not set
314CONFIG_EXTRA_TARGETS=""
315# CONFIG_PM is not set
316CONFIG_SECCOMP=y
317CONFIG_ISA_DMA_API=y
318
319#
320# Bus options
321#
322CONFIG_ZONE_DMA=y
323CONFIG_GENERIC_ISA_DMA=y
324# CONFIG_PPC_INDIRECT_PCI is not set
325CONFIG_PCI=y
326CONFIG_PCI_DOMAINS=y
327CONFIG_PCI_SYSCALL=y
328# CONFIG_PCIEPORTBUS is not set
329CONFIG_ARCH_SUPPORTS_MSI=y
330CONFIG_PCI_MSI=y
331# CONFIG_PCI_LEGACY is not set
332# CONFIG_PCI_DEBUG is not set
333# CONFIG_PCI_STUB is not set
334# CONFIG_PCI_IOV is not set
335CONFIG_PCCARD=y
336# CONFIG_PCMCIA_DEBUG is not set
337CONFIG_PCMCIA=y
338CONFIG_PCMCIA_LOAD_CIS=y
339CONFIG_PCMCIA_IOCTL=y
340CONFIG_CARDBUS=y
341
342#
343# PC-card bridges
344#
345# CONFIG_YENTA is not set
346# CONFIG_PD6729 is not set
347# CONFIG_I82092 is not set
348CONFIG_HOTPLUG_PCI=m
349# CONFIG_HOTPLUG_PCI_FAKE is not set
350# CONFIG_HOTPLUG_PCI_CPCI is not set
351# CONFIG_HOTPLUG_PCI_SHPC is not set
352# CONFIG_HAS_RAPIDIO is not set
353# CONFIG_RELOCATABLE is not set
354CONFIG_PAGE_OFFSET=0xc000000000000000
355CONFIG_KERNEL_START=0xc000000000000000
356CONFIG_PHYSICAL_START=0x00000000
357CONFIG_NET=y
358CONFIG_COMPAT_NETLINK_MESSAGES=y
359
360#
361# Networking options
362#
363CONFIG_PACKET=y
364# CONFIG_PACKET_MMAP is not set
365CONFIG_UNIX=y
366CONFIG_XFRM=y
367CONFIG_XFRM_USER=m
368# CONFIG_XFRM_SUB_POLICY is not set
369# CONFIG_XFRM_MIGRATE is not set
370# CONFIG_XFRM_STATISTICS is not set
371CONFIG_XFRM_IPCOMP=m
372CONFIG_NET_KEY=m
373# CONFIG_NET_KEY_MIGRATE is not set
374CONFIG_INET=y
375CONFIG_IP_MULTICAST=y
376# CONFIG_IP_ADVANCED_ROUTER is not set
377CONFIG_IP_FIB_HASH=y
378CONFIG_IP_PNP=y
379CONFIG_IP_PNP_DHCP=y
380CONFIG_IP_PNP_BOOTP=y
381# CONFIG_IP_PNP_RARP is not set
382CONFIG_NET_IPIP=y
383# CONFIG_NET_IPGRE is not set
384# CONFIG_IP_MROUTE is not set
385# CONFIG_ARPD is not set
386CONFIG_SYN_COOKIES=y
387CONFIG_INET_AH=m
388CONFIG_INET_ESP=m
389CONFIG_INET_IPCOMP=m
390CONFIG_INET_XFRM_TUNNEL=m
391CONFIG_INET_TUNNEL=y
392CONFIG_INET_XFRM_MODE_TRANSPORT=y
393CONFIG_INET_XFRM_MODE_TUNNEL=y
394CONFIG_INET_XFRM_MODE_BEET=y
395CONFIG_INET_LRO=y
396CONFIG_INET_DIAG=y
397CONFIG_INET_TCP_DIAG=y
398# CONFIG_TCP_CONG_ADVANCED is not set
399CONFIG_TCP_CONG_CUBIC=y
400CONFIG_DEFAULT_TCP_CONG="cubic"
401# CONFIG_TCP_MD5SIG is not set
402# CONFIG_IPV6 is not set
403# CONFIG_NETWORK_SECMARK is not set
404CONFIG_NETFILTER=y
405# CONFIG_NETFILTER_DEBUG is not set
406CONFIG_NETFILTER_ADVANCED=y
407
408#
409# Core Netfilter Configuration
410#
411CONFIG_NETFILTER_NETLINK=m
412CONFIG_NETFILTER_NETLINK_QUEUE=m
413CONFIG_NETFILTER_NETLINK_LOG=m
414CONFIG_NF_CONNTRACK=m
415CONFIG_NF_CT_ACCT=y
416CONFIG_NF_CONNTRACK_MARK=y
417CONFIG_NF_CONNTRACK_EVENTS=y
418# CONFIG_NF_CT_PROTO_DCCP is not set
419CONFIG_NF_CT_PROTO_GRE=m
420CONFIG_NF_CT_PROTO_SCTP=m
421# CONFIG_NF_CT_PROTO_UDPLITE is not set
422CONFIG_NF_CONNTRACK_AMANDA=m
423CONFIG_NF_CONNTRACK_FTP=m
424CONFIG_NF_CONNTRACK_H323=m
425CONFIG_NF_CONNTRACK_IRC=m
426CONFIG_NF_CONNTRACK_NETBIOS_NS=m
427CONFIG_NF_CONNTRACK_PPTP=m
428# CONFIG_NF_CONNTRACK_SANE is not set
429CONFIG_NF_CONNTRACK_SIP=m
430CONFIG_NF_CONNTRACK_TFTP=m
431CONFIG_NF_CT_NETLINK=m
432CONFIG_NETFILTER_TPROXY=m
433CONFIG_NETFILTER_XTABLES=m
434CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
435CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
436CONFIG_NETFILTER_XT_TARGET_DSCP=m
437CONFIG_NETFILTER_XT_TARGET_HL=m
438CONFIG_NETFILTER_XT_TARGET_MARK=m
439CONFIG_NETFILTER_XT_TARGET_NFLOG=m
440CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
441CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
442CONFIG_NETFILTER_XT_TARGET_RATEEST=m
443CONFIG_NETFILTER_XT_TARGET_TPROXY=m
444CONFIG_NETFILTER_XT_TARGET_TRACE=m
445CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
446CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
447# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
448CONFIG_NETFILTER_XT_MATCH_COMMENT=m
449CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
450CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
451CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
452CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
453CONFIG_NETFILTER_XT_MATCH_DCCP=m
454CONFIG_NETFILTER_XT_MATCH_DSCP=m
455CONFIG_NETFILTER_XT_MATCH_ESP=m
456CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
457CONFIG_NETFILTER_XT_MATCH_HELPER=m
458CONFIG_NETFILTER_XT_MATCH_HL=m
459CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
460CONFIG_NETFILTER_XT_MATCH_LENGTH=m
461CONFIG_NETFILTER_XT_MATCH_LIMIT=m
462CONFIG_NETFILTER_XT_MATCH_MAC=m
463CONFIG_NETFILTER_XT_MATCH_MARK=m
464CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
465CONFIG_NETFILTER_XT_MATCH_OWNER=m
466CONFIG_NETFILTER_XT_MATCH_POLICY=m
467CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
468CONFIG_NETFILTER_XT_MATCH_QUOTA=m
469CONFIG_NETFILTER_XT_MATCH_RATEEST=m
470CONFIG_NETFILTER_XT_MATCH_REALM=m
471CONFIG_NETFILTER_XT_MATCH_RECENT=m
472# CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT is not set
473CONFIG_NETFILTER_XT_MATCH_SCTP=m
474CONFIG_NETFILTER_XT_MATCH_SOCKET=m
475CONFIG_NETFILTER_XT_MATCH_STATE=m
476CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
477CONFIG_NETFILTER_XT_MATCH_STRING=m
478CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
479# CONFIG_NETFILTER_XT_MATCH_TIME is not set
480CONFIG_NETFILTER_XT_MATCH_U32=m
481# CONFIG_NETFILTER_XT_MATCH_OSF is not set
482# CONFIG_IP_VS is not set
483
484#
485# IP: Netfilter Configuration
486#
487CONFIG_NF_DEFRAG_IPV4=m
488CONFIG_NF_CONNTRACK_IPV4=m
489CONFIG_NF_CONNTRACK_PROC_COMPAT=y
490CONFIG_IP_NF_QUEUE=m
491CONFIG_IP_NF_IPTABLES=m
492CONFIG_IP_NF_MATCH_ADDRTYPE=m
493CONFIG_IP_NF_MATCH_AH=m
494CONFIG_IP_NF_MATCH_ECN=m
495CONFIG_IP_NF_MATCH_TTL=m
496CONFIG_IP_NF_FILTER=m
497CONFIG_IP_NF_TARGET_REJECT=m
498CONFIG_IP_NF_TARGET_LOG=m
499CONFIG_IP_NF_TARGET_ULOG=m
500CONFIG_NF_NAT=m
501CONFIG_NF_NAT_NEEDED=y
502CONFIG_IP_NF_TARGET_MASQUERADE=m
503CONFIG_IP_NF_TARGET_NETMAP=m
504CONFIG_IP_NF_TARGET_REDIRECT=m
505CONFIG_NF_NAT_SNMP_BASIC=m
506CONFIG_NF_NAT_PROTO_GRE=m
507CONFIG_NF_NAT_PROTO_SCTP=m
508CONFIG_NF_NAT_FTP=m
509CONFIG_NF_NAT_IRC=m
510CONFIG_NF_NAT_TFTP=m
511CONFIG_NF_NAT_AMANDA=m
512CONFIG_NF_NAT_PPTP=m
513CONFIG_NF_NAT_H323=m
514CONFIG_NF_NAT_SIP=m
515CONFIG_IP_NF_MANGLE=m
516CONFIG_IP_NF_TARGET_CLUSTERIP=m
517CONFIG_IP_NF_TARGET_ECN=m
518CONFIG_IP_NF_TARGET_TTL=m
519CONFIG_IP_NF_RAW=m
520CONFIG_IP_NF_ARPTABLES=m
521CONFIG_IP_NF_ARPFILTER=m
522CONFIG_IP_NF_ARP_MANGLE=m
523# CONFIG_IP_DCCP is not set
524# CONFIG_IP_SCTP is not set
525# CONFIG_RDS is not set
526# CONFIG_TIPC is not set
527# CONFIG_ATM is not set
528# CONFIG_BRIDGE is not set
529# CONFIG_NET_DSA is not set
530# CONFIG_VLAN_8021Q is not set
531# CONFIG_DECNET is not set
532CONFIG_LLC=y
533# CONFIG_LLC2 is not set
534# CONFIG_IPX is not set
535# CONFIG_ATALK is not set
536# CONFIG_X25 is not set
537# CONFIG_LAPB is not set
538# CONFIG_ECONET is not set
539# CONFIG_WAN_ROUTER is not set
540# CONFIG_PHONET is not set
541# CONFIG_IEEE802154 is not set
542# CONFIG_NET_SCHED is not set
543CONFIG_NET_CLS_ROUTE=y
544# CONFIG_DCB is not set
545
546#
547# Network testing
548#
549# CONFIG_NET_PKTGEN is not set
550# CONFIG_NET_DROP_MONITOR is not set
551# CONFIG_HAMRADIO is not set
552# CONFIG_CAN is not set
553# CONFIG_IRDA is not set
554# CONFIG_BT is not set
555# CONFIG_AF_RXRPC is not set
556CONFIG_WIRELESS=y
557# CONFIG_CFG80211 is not set
558CONFIG_CFG80211_DEFAULT_PS_VALUE=0
559CONFIG_WIRELESS_OLD_REGULATORY=y
560CONFIG_WIRELESS_EXT=y
561CONFIG_WIRELESS_EXT_SYSFS=y
562# CONFIG_LIB80211 is not set
563
564#
565# CFG80211 needs to be enabled for MAC80211
566#
567# CONFIG_WIMAX is not set
568# CONFIG_RFKILL is not set
569# CONFIG_NET_9P is not set
570
571#
572# Device Drivers
573#
574
575#
576# Generic Driver Options
577#
578CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
579# CONFIG_DEVTMPFS is not set
580CONFIG_STANDALONE=y
581CONFIG_PREVENT_FIRMWARE_BUILD=y
582CONFIG_FW_LOADER=y
583CONFIG_FIRMWARE_IN_KERNEL=y
584CONFIG_EXTRA_FIRMWARE=""
585# CONFIG_DEBUG_DRIVER is not set
586# CONFIG_DEBUG_DEVRES is not set
587# CONFIG_SYS_HYPERVISOR is not set
588# CONFIG_CONNECTOR is not set
589# CONFIG_MTD is not set
590CONFIG_OF_DEVICE=y
591CONFIG_OF_I2C=y
592CONFIG_OF_MDIO=y
593# CONFIG_PARPORT is not set
594CONFIG_BLK_DEV=y
595CONFIG_BLK_DEV_FD=y
596# CONFIG_BLK_CPQ_CISS_DA is not set
597# CONFIG_BLK_DEV_DAC960 is not set
598# CONFIG_BLK_DEV_UMEM is not set
599# CONFIG_BLK_DEV_COW_COMMON is not set
600CONFIG_BLK_DEV_LOOP=y
601# CONFIG_BLK_DEV_CRYPTOLOOP is not set
602CONFIG_BLK_DEV_NBD=m
603# CONFIG_BLK_DEV_SX8 is not set
604# CONFIG_BLK_DEV_UB is not set
605CONFIG_BLK_DEV_RAM=y
606CONFIG_BLK_DEV_RAM_COUNT=16
607CONFIG_BLK_DEV_RAM_SIZE=65536
608# CONFIG_BLK_DEV_XIP is not set
609# CONFIG_CDROM_PKTCDVD is not set
610# CONFIG_ATA_OVER_ETH is not set
611# CONFIG_BLK_DEV_HD is not set
612CONFIG_MISC_DEVICES=y
613# CONFIG_PHANTOM is not set
614# CONFIG_SGI_IOC4 is not set
615# CONFIG_TIFM_CORE is not set
616# CONFIG_ICS932S401 is not set
617# CONFIG_ENCLOSURE_SERVICES is not set
618# CONFIG_HP_ILO is not set
619# CONFIG_ISL29003 is not set
620# CONFIG_C2PORT is not set
621
622#
623# EEPROM support
624#
625# CONFIG_EEPROM_AT24 is not set
626# CONFIG_EEPROM_LEGACY is not set
627# CONFIG_EEPROM_MAX6875 is not set
628# CONFIG_EEPROM_93CX6 is not set
629# CONFIG_CB710_CORE is not set
630CONFIG_HAVE_IDE=y
631CONFIG_IDE=y
632
633#
634# Please see Documentation/ide/ide.txt for help/info on IDE drives
635#
636CONFIG_IDE_XFER_MODE=y
637CONFIG_IDE_TIMINGS=y
638CONFIG_IDE_ATAPI=y
639# CONFIG_BLK_DEV_IDE_SATA is not set
640CONFIG_IDE_GD=y
641CONFIG_IDE_GD_ATA=y
642# CONFIG_IDE_GD_ATAPI is not set
643# CONFIG_BLK_DEV_IDECS is not set
644# CONFIG_BLK_DEV_DELKIN is not set
645CONFIG_BLK_DEV_IDECD=y
646CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
647# CONFIG_BLK_DEV_IDETAPE is not set
648# CONFIG_IDE_TASK_IOCTL is not set
649CONFIG_IDE_PROC_FS=y
650
651#
652# IDE chipset support/bugfixes
653#
654# CONFIG_BLK_DEV_PLATFORM is not set
655CONFIG_BLK_DEV_IDEDMA_SFF=y
656
657#
658# PCI IDE chipsets support
659#
660CONFIG_BLK_DEV_IDEPCI=y
661CONFIG_IDEPCI_PCIBUS_ORDER=y
662# CONFIG_BLK_DEV_OFFBOARD is not set
663CONFIG_BLK_DEV_GENERIC=y
664# CONFIG_BLK_DEV_OPTI621 is not set
665CONFIG_BLK_DEV_IDEDMA_PCI=y
666# CONFIG_BLK_DEV_AEC62XX is not set
667# CONFIG_BLK_DEV_ALI15X3 is not set
668CONFIG_BLK_DEV_AMD74XX=y
669# CONFIG_BLK_DEV_CMD64X is not set
670# CONFIG_BLK_DEV_TRIFLEX is not set
671# CONFIG_BLK_DEV_CS5520 is not set
672# CONFIG_BLK_DEV_CS5530 is not set
673# CONFIG_BLK_DEV_HPT366 is not set
674# CONFIG_BLK_DEV_JMICRON is not set
675# CONFIG_BLK_DEV_SC1200 is not set
676# CONFIG_BLK_DEV_PIIX is not set
677# CONFIG_BLK_DEV_IT8172 is not set
678# CONFIG_BLK_DEV_IT8213 is not set
679# CONFIG_BLK_DEV_IT821X is not set
680# CONFIG_BLK_DEV_NS87415 is not set
681# CONFIG_BLK_DEV_PDC202XX_OLD is not set
682# CONFIG_BLK_DEV_PDC202XX_NEW is not set
683# CONFIG_BLK_DEV_SVWKS is not set
684# CONFIG_BLK_DEV_SIIMAGE is not set
685# CONFIG_BLK_DEV_SL82C105 is not set
686# CONFIG_BLK_DEV_SLC90E66 is not set
687# CONFIG_BLK_DEV_TRM290 is not set
688# CONFIG_BLK_DEV_VIA82CXXX is not set
689# CONFIG_BLK_DEV_TC86C001 is not set
690CONFIG_BLK_DEV_IDEDMA=y
691
692#
693# SCSI device support
694#
695# CONFIG_RAID_ATTRS is not set
696CONFIG_SCSI=y
697CONFIG_SCSI_DMA=y
698# CONFIG_SCSI_TGT is not set
699CONFIG_SCSI_NETLINK=y
700CONFIG_SCSI_PROC_FS=y
701
702#
703# SCSI support type (disk, tape, CD-ROM)
704#
705CONFIG_BLK_DEV_SD=y
706CONFIG_CHR_DEV_ST=y
707# CONFIG_CHR_DEV_OSST is not set
708CONFIG_BLK_DEV_SR=y
709CONFIG_BLK_DEV_SR_VENDOR=y
710CONFIG_CHR_DEV_SG=y
711# CONFIG_CHR_DEV_SCH is not set
712CONFIG_SCSI_MULTI_LUN=y
713CONFIG_SCSI_CONSTANTS=y
714# CONFIG_SCSI_LOGGING is not set
715# CONFIG_SCSI_SCAN_ASYNC is not set
716CONFIG_SCSI_WAIT_SCAN=m
717
718#
719# SCSI Transports
720#
721CONFIG_SCSI_SPI_ATTRS=y
722CONFIG_SCSI_FC_ATTRS=y
723CONFIG_SCSI_ISCSI_ATTRS=m
724# CONFIG_SCSI_SAS_ATTRS is not set
725# CONFIG_SCSI_SAS_LIBSAS is not set
726CONFIG_SCSI_SRP_ATTRS=y
727CONFIG_SCSI_LOWLEVEL=y
728# CONFIG_ISCSI_TCP is not set
729# CONFIG_SCSI_CXGB3_ISCSI is not set
730# CONFIG_SCSI_BNX2_ISCSI is not set
731# CONFIG_BE2ISCSI is not set
732# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
733# CONFIG_SCSI_3W_9XXX is not set
734# CONFIG_SCSI_ACARD is not set
735# CONFIG_SCSI_AACRAID is not set
736# CONFIG_SCSI_AIC7XXX is not set
737# CONFIG_SCSI_AIC7XXX_OLD is not set
738# CONFIG_SCSI_AIC79XX is not set
739# CONFIG_SCSI_AIC94XX is not set
740# CONFIG_SCSI_MVSAS is not set
741# CONFIG_SCSI_ARCMSR is not set
742# CONFIG_MEGARAID_NEWGEN is not set
743# CONFIG_MEGARAID_LEGACY is not set
744# CONFIG_MEGARAID_SAS is not set
745# CONFIG_SCSI_MPT2SAS is not set
746# CONFIG_SCSI_HPTIOP is not set
747# CONFIG_LIBFC is not set
748# CONFIG_LIBFCOE is not set
749# CONFIG_FCOE is not set
750# CONFIG_SCSI_DMX3191D is not set
751# CONFIG_SCSI_EATA is not set
752# CONFIG_SCSI_FUTURE_DOMAIN is not set
753# CONFIG_SCSI_GDTH is not set
754# CONFIG_SCSI_IPS is not set
755# CONFIG_SCSI_INITIO is not set
756# CONFIG_SCSI_INIA100 is not set
757# CONFIG_SCSI_STEX is not set
758CONFIG_SCSI_SYM53C8XX_2=y
759CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
760CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
761CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
762CONFIG_SCSI_SYM53C8XX_MMIO=y
763CONFIG_SCSI_IPR=y
764CONFIG_SCSI_IPR_TRACE=y
765CONFIG_SCSI_IPR_DUMP=y
766# CONFIG_SCSI_QLOGIC_1280 is not set
767# CONFIG_SCSI_QLA_FC is not set
768# CONFIG_SCSI_QLA_ISCSI is not set
769CONFIG_SCSI_LPFC=m
770# CONFIG_SCSI_LPFC_DEBUG_FS is not set
771# CONFIG_SCSI_DC395x is not set
772# CONFIG_SCSI_DC390T is not set
773CONFIG_SCSI_DEBUG=m
774# CONFIG_SCSI_PMCRAID is not set
775# CONFIG_SCSI_SRP is not set
776# CONFIG_SCSI_BFA_FC is not set
777# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
778# CONFIG_SCSI_DH is not set
779# CONFIG_SCSI_OSD_INITIATOR is not set
780CONFIG_ATA=y
781# CONFIG_ATA_NONSTANDARD is not set
782CONFIG_ATA_VERBOSE_ERROR=y
783CONFIG_SATA_PMP=y
784# CONFIG_SATA_AHCI is not set
785CONFIG_SATA_SIL24=y
786CONFIG_ATA_SFF=y
787CONFIG_SATA_SVW=y
788# CONFIG_ATA_PIIX is not set
789# CONFIG_SATA_MV is not set
790# CONFIG_SATA_NV is not set
791# CONFIG_PDC_ADMA is not set
792# CONFIG_SATA_QSTOR is not set
793# CONFIG_SATA_PROMISE is not set
794# CONFIG_SATA_SX4 is not set
795# CONFIG_SATA_SIL is not set
796# CONFIG_SATA_SIS is not set
797# CONFIG_SATA_ULI is not set
798# CONFIG_SATA_VIA is not set
799# CONFIG_SATA_VITESSE is not set
800# CONFIG_SATA_INIC162X is not set
801# CONFIG_PATA_ALI is not set
802# CONFIG_PATA_AMD is not set
803# CONFIG_PATA_ARTOP is not set
804# CONFIG_PATA_ATP867X is not set
805# CONFIG_PATA_ATIIXP is not set
806# CONFIG_PATA_CMD640_PCI is not set
807# CONFIG_PATA_CMD64X is not set
808# CONFIG_PATA_CS5520 is not set
809# CONFIG_PATA_CS5530 is not set
810# CONFIG_PATA_CYPRESS is not set
811# CONFIG_PATA_EFAR is not set
812# CONFIG_ATA_GENERIC is not set
813# CONFIG_PATA_HPT366 is not set
814# CONFIG_PATA_HPT37X is not set
815# CONFIG_PATA_HPT3X2N is not set
816# CONFIG_PATA_HPT3X3 is not set
817# CONFIG_PATA_IT821X is not set
818# CONFIG_PATA_IT8213 is not set
819# CONFIG_PATA_JMICRON is not set
820# CONFIG_PATA_TRIFLEX is not set
821# CONFIG_PATA_MARVELL is not set
822# CONFIG_PATA_MPIIX is not set
823# CONFIG_PATA_OLDPIIX is not set
824# CONFIG_PATA_NETCELL is not set
825# CONFIG_PATA_NINJA32 is not set
826# CONFIG_PATA_NS87410 is not set
827# CONFIG_PATA_NS87415 is not set
828# CONFIG_PATA_OPTI is not set
829# CONFIG_PATA_OPTIDMA is not set
830# CONFIG_PATA_PCMCIA is not set
831# CONFIG_PATA_PDC_OLD is not set
832# CONFIG_PATA_RADISYS is not set
833# CONFIG_PATA_RDC is not set
834# CONFIG_PATA_RZ1000 is not set
835# CONFIG_PATA_SC1200 is not set
836# CONFIG_PATA_SERVERWORKS is not set
837# CONFIG_PATA_PDC2027X is not set
838# CONFIG_PATA_SIL680 is not set
839# CONFIG_PATA_SIS is not set
840# CONFIG_PATA_VIA is not set
841# CONFIG_PATA_WINBOND is not set
842# CONFIG_PATA_PLATFORM is not set
843# CONFIG_PATA_SCH is not set
844CONFIG_MD=y
845CONFIG_BLK_DEV_MD=y
846CONFIG_MD_AUTODETECT=y
847CONFIG_MD_LINEAR=y
848CONFIG_MD_RAID0=y
849CONFIG_MD_RAID1=y
850CONFIG_MD_RAID10=y
851CONFIG_MD_RAID456=y
852# CONFIG_MULTICORE_RAID456 is not set
853CONFIG_MD_RAID6_PQ=y
854# CONFIG_ASYNC_RAID6_TEST is not set
855CONFIG_MD_MULTIPATH=m
856CONFIG_MD_FAULTY=m
857CONFIG_BLK_DEV_DM=y
858# CONFIG_DM_DEBUG is not set
859CONFIG_DM_CRYPT=m
860CONFIG_DM_SNAPSHOT=m
861CONFIG_DM_MIRROR=m
862# CONFIG_DM_LOG_USERSPACE is not set
863CONFIG_DM_ZERO=m
864CONFIG_DM_MULTIPATH=m
865# CONFIG_DM_MULTIPATH_QL is not set
866# CONFIG_DM_MULTIPATH_ST is not set
867# CONFIG_DM_DELAY is not set
868# CONFIG_DM_UEVENT is not set
869# CONFIG_FUSION is not set
870
871#
872# IEEE 1394 (FireWire) support
873#
874
875#
876# You can enable one or both FireWire driver stacks.
877#
878
879#
880# See the help texts for more information.
881#
882# CONFIG_FIREWIRE is not set
883CONFIG_IEEE1394=y
884CONFIG_IEEE1394_OHCI1394=y
885# CONFIG_IEEE1394_PCILYNX is not set
886CONFIG_IEEE1394_SBP2=m
887CONFIG_IEEE1394_ETH1394_ROM_ENTRY=y
888CONFIG_IEEE1394_ETH1394=m
889CONFIG_IEEE1394_RAWIO=y
890CONFIG_IEEE1394_VIDEO1394=m
891CONFIG_IEEE1394_DV1394=m
892# CONFIG_IEEE1394_VERBOSEDEBUG is not set
893# CONFIG_I2O is not set
894CONFIG_MACINTOSH_DRIVERS=y
895# CONFIG_MAC_EMUMOUSEBTN is not set
896CONFIG_WINDFARM=y
897CONFIG_NETDEVICES=y
898CONFIG_DUMMY=m
899CONFIG_BONDING=m
900# CONFIG_MACVLAN is not set
901# CONFIG_EQUALIZER is not set
902CONFIG_TUN=m
903# CONFIG_VETH is not set
904# CONFIG_ARCNET is not set
905CONFIG_PHYLIB=y
906
907#
908# MII PHY device drivers
909#
910CONFIG_MARVELL_PHY=y
911# CONFIG_DAVICOM_PHY is not set
912# CONFIG_QSEMI_PHY is not set
913# CONFIG_LXT_PHY is not set
914# CONFIG_CICADA_PHY is not set
915# CONFIG_VITESSE_PHY is not set
916# CONFIG_SMSC_PHY is not set
917CONFIG_BROADCOM_PHY=m
918# CONFIG_ICPLUS_PHY is not set
919# CONFIG_REALTEK_PHY is not set
920# CONFIG_NATIONAL_PHY is not set
921# CONFIG_STE10XP is not set
922# CONFIG_LSI_ET1011C_PHY is not set
923# CONFIG_FIXED_PHY is not set
924# CONFIG_MDIO_BITBANG is not set
925CONFIG_NET_ETHERNET=y
926CONFIG_MII=y
927# CONFIG_HAPPYMEAL is not set
928CONFIG_SUNGEM=y
929# CONFIG_CASSINI is not set
930CONFIG_NET_VENDOR_3COM=y
931CONFIG_VORTEX=y
932# CONFIG_TYPHOON is not set
933# CONFIG_ETHOC is not set
934# CONFIG_DNET is not set
935# CONFIG_NET_TULIP is not set
936# CONFIG_HP100 is not set
937# CONFIG_IBM_NEW_EMAC_ZMII is not set
938# CONFIG_IBM_NEW_EMAC_RGMII is not set
939# CONFIG_IBM_NEW_EMAC_TAH is not set
940# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
941# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
942# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
943# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
944CONFIG_NET_PCI=y
945CONFIG_PCNET32=y
946# CONFIG_AMD8111_ETH is not set
947# CONFIG_ADAPTEC_STARFIRE is not set
948# CONFIG_B44 is not set
949# CONFIG_FORCEDETH is not set
950CONFIG_E100=y
951# CONFIG_FEALNX is not set
952# CONFIG_NATSEMI is not set
953# CONFIG_NE2K_PCI is not set
954# CONFIG_8139CP is not set
955# CONFIG_8139TOO is not set
956# CONFIG_R6040 is not set
957# CONFIG_SIS900 is not set
958# CONFIG_EPIC100 is not set
959# CONFIG_SMSC9420 is not set
960# CONFIG_SUNDANCE is not set
961# CONFIG_TLAN is not set
962# CONFIG_KS8842 is not set
963# CONFIG_KS8851_MLL is not set
964# CONFIG_VIA_RHINE is not set
965# CONFIG_SC92031 is not set
966# CONFIG_ATL2 is not set
967CONFIG_NETDEV_1000=y
968CONFIG_ACENIC=y
969CONFIG_ACENIC_OMIT_TIGON_I=y
970# CONFIG_DL2K is not set
971CONFIG_E1000=y
972# CONFIG_E1000E is not set
973# CONFIG_IP1000 is not set
974# CONFIG_IGB is not set
975# CONFIG_IGBVF is not set
976# CONFIG_NS83820 is not set
977# CONFIG_HAMACHI is not set
978# CONFIG_YELLOWFIN is not set
979# CONFIG_R8169 is not set
980# CONFIG_SIS190 is not set
981# CONFIG_SKGE is not set
982# CONFIG_SKY2 is not set
983# CONFIG_VIA_VELOCITY is not set
984CONFIG_TIGON3=y
985# CONFIG_BNX2 is not set
986# CONFIG_CNIC is not set
987# CONFIG_QLA3XXX is not set
988# CONFIG_ATL1 is not set
989# CONFIG_ATL1E is not set
990# CONFIG_ATL1C is not set
991# CONFIG_JME is not set
992CONFIG_NETDEV_10000=y
993# CONFIG_CHELSIO_T1 is not set
994CONFIG_CHELSIO_T3_DEPENDS=y
995# CONFIG_CHELSIO_T3 is not set
996# CONFIG_ENIC is not set
997# CONFIG_IXGBE is not set
998CONFIG_IXGB=m
999# CONFIG_S2IO is not set
1000# CONFIG_VXGE is not set
1001# CONFIG_MYRI10GE is not set
1002# CONFIG_NETXEN_NIC is not set
1003# CONFIG_NIU is not set
1004# CONFIG_MLX4_EN is not set
1005# CONFIG_MLX4_CORE is not set
1006# CONFIG_TEHUTI is not set
1007# CONFIG_BNX2X is not set
1008# CONFIG_QLGE is not set
1009# CONFIG_SFC is not set
1010# CONFIG_BE2NET is not set
1011CONFIG_TR=y
1012CONFIG_IBMOL=y
1013# CONFIG_3C359 is not set
1014# CONFIG_TMS380TR is not set
1015CONFIG_WLAN=y
1016# CONFIG_WLAN_PRE80211 is not set
1017# CONFIG_WLAN_80211 is not set
1018
1019#
1020# Enable WiMAX (Networking options) to see the WiMAX drivers
1021#
1022
1023#
1024# USB Network Adapters
1025#
1026# CONFIG_USB_CATC is not set
1027# CONFIG_USB_KAWETH is not set
1028# CONFIG_USB_PEGASUS is not set
1029# CONFIG_USB_RTL8150 is not set
1030# CONFIG_USB_USBNET is not set
1031# CONFIG_NET_PCMCIA is not set
1032# CONFIG_WAN is not set
1033# CONFIG_FDDI is not set
1034# CONFIG_HIPPI is not set
1035CONFIG_PPP=m
1036# CONFIG_PPP_MULTILINK is not set
1037# CONFIG_PPP_FILTER is not set
1038CONFIG_PPP_ASYNC=m
1039CONFIG_PPP_SYNC_TTY=m
1040CONFIG_PPP_DEFLATE=m
1041CONFIG_PPP_BSDCOMP=m
1042# CONFIG_PPP_MPPE is not set
1043CONFIG_PPPOE=m
1044# CONFIG_PPPOL2TP is not set
1045# CONFIG_SLIP is not set
1046CONFIG_SLHC=m
1047# CONFIG_NET_FC is not set
1048CONFIG_NETCONSOLE=y
1049# CONFIG_NETCONSOLE_DYNAMIC is not set
1050CONFIG_NETPOLL=y
1051CONFIG_NETPOLL_TRAP=y
1052CONFIG_NET_POLL_CONTROLLER=y
1053# CONFIG_ISDN is not set
1054# CONFIG_PHONE is not set
1055
1056#
1057# Input device support
1058#
1059CONFIG_INPUT=y
1060# CONFIG_INPUT_FF_MEMLESS is not set
1061# CONFIG_INPUT_POLLDEV is not set
1062
1063#
1064# Userland interfaces
1065#
1066CONFIG_INPUT_MOUSEDEV=y
1067# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
1068CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
1069CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
1070# CONFIG_INPUT_JOYDEV is not set
1071CONFIG_INPUT_EVDEV=m
1072# CONFIG_INPUT_EVBUG is not set
1073
1074#
1075# Input Device Drivers
1076#
1077CONFIG_INPUT_KEYBOARD=y
1078# CONFIG_KEYBOARD_ADP5588 is not set
1079CONFIG_KEYBOARD_ATKBD=y
1080# CONFIG_QT2160 is not set
1081# CONFIG_KEYBOARD_LKKBD is not set
1082# CONFIG_KEYBOARD_MAX7359 is not set
1083# CONFIG_KEYBOARD_NEWTON is not set
1084# CONFIG_KEYBOARD_OPENCORES is not set
1085# CONFIG_KEYBOARD_STOWAWAY is not set
1086# CONFIG_KEYBOARD_SUNKBD is not set
1087# CONFIG_KEYBOARD_XTKBD is not set
1088CONFIG_INPUT_MOUSE=y
1089CONFIG_MOUSE_PS2=y
1090CONFIG_MOUSE_PS2_ALPS=y
1091CONFIG_MOUSE_PS2_LOGIPS2PP=y
1092CONFIG_MOUSE_PS2_SYNAPTICS=y
1093CONFIG_MOUSE_PS2_TRACKPOINT=y
1094# CONFIG_MOUSE_PS2_ELANTECH is not set
1095# CONFIG_MOUSE_PS2_SENTELIC is not set
1096# CONFIG_MOUSE_PS2_TOUCHKIT is not set
1097# CONFIG_MOUSE_SERIAL is not set
1098# CONFIG_MOUSE_APPLETOUCH is not set
1099# CONFIG_MOUSE_BCM5974 is not set
1100# CONFIG_MOUSE_VSXXXAA is not set
1101# CONFIG_MOUSE_SYNAPTICS_I2C is not set
1102# CONFIG_INPUT_JOYSTICK is not set
1103# CONFIG_INPUT_TABLET is not set
1104# CONFIG_INPUT_TOUCHSCREEN is not set
1105CONFIG_INPUT_MISC=y
1106# CONFIG_INPUT_ATI_REMOTE is not set
1107# CONFIG_INPUT_ATI_REMOTE2 is not set
1108# CONFIG_INPUT_KEYSPAN_REMOTE is not set
1109# CONFIG_INPUT_POWERMATE is not set
1110# CONFIG_INPUT_YEALINK is not set
1111# CONFIG_INPUT_CM109 is not set
1112# CONFIG_INPUT_UINPUT is not set
1113
1114#
1115# Hardware I/O ports
1116#
1117CONFIG_SERIO=y
1118CONFIG_SERIO_I8042=y
1119# CONFIG_SERIO_SERPORT is not set
1120# CONFIG_SERIO_PCIPS2 is not set
1121CONFIG_SERIO_LIBPS2=y
1122# CONFIG_SERIO_RAW is not set
1123# CONFIG_SERIO_XILINX_XPS_PS2 is not set
1124# CONFIG_GAMEPORT is not set
1125
1126#
1127# Character devices
1128#
1129CONFIG_VT=y
1130CONFIG_CONSOLE_TRANSLATIONS=y
1131CONFIG_VT_CONSOLE=y
1132CONFIG_HW_CONSOLE=y
1133CONFIG_VT_HW_CONSOLE_BINDING=y
1134CONFIG_DEVKMEM=y
1135# CONFIG_SERIAL_NONSTANDARD is not set
1136# CONFIG_NOZOMI is not set
1137
1138#
1139# Serial drivers
1140#
1141CONFIG_SERIAL_8250=y
1142CONFIG_SERIAL_8250_CONSOLE=y
1143CONFIG_SERIAL_8250_PCI=y
1144# CONFIG_SERIAL_8250_CS is not set
1145CONFIG_SERIAL_8250_NR_UARTS=4
1146CONFIG_SERIAL_8250_RUNTIME_UARTS=4
1147# CONFIG_SERIAL_8250_EXTENDED is not set
1148
1149#
1150# Non-8250 serial port support
1151#
1152CONFIG_SERIAL_CORE=y
1153CONFIG_SERIAL_CORE_CONSOLE=y
1154# CONFIG_SERIAL_JSM is not set
1155# CONFIG_SERIAL_OF_PLATFORM is not set
1156CONFIG_UNIX98_PTYS=y
1157# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
1158CONFIG_LEGACY_PTYS=y
1159CONFIG_LEGACY_PTY_COUNT=256
1160# CONFIG_HVC_UDBG is not set
1161# CONFIG_IPMI_HANDLER is not set
1162# CONFIG_HW_RANDOM is not set
1163# CONFIG_R3964 is not set
1164# CONFIG_APPLICOM is not set
1165
1166#
1167# PCMCIA character devices
1168#
1169# CONFIG_SYNCLINK_CS is not set
1170# CONFIG_CARDMAN_4000 is not set
1171# CONFIG_CARDMAN_4040 is not set
1172# CONFIG_IPWIRELESS is not set
1173CONFIG_RAW_DRIVER=y
1174CONFIG_MAX_RAW_DEVS=256
1175# CONFIG_HANGCHECK_TIMER is not set
1176# CONFIG_TCG_TPM is not set
1177CONFIG_DEVPORT=y
1178CONFIG_I2C=y
1179CONFIG_I2C_BOARDINFO=y
1180CONFIG_I2C_COMPAT=y
1181CONFIG_I2C_CHARDEV=y
1182CONFIG_I2C_HELPER_AUTO=y
1183CONFIG_I2C_ALGOBIT=y
1184
1185#
1186# I2C Hardware Bus support
1187#
1188
1189#
1190# PC SMBus host controller drivers
1191#
1192# CONFIG_I2C_ALI1535 is not set
1193# CONFIG_I2C_ALI1563 is not set
1194# CONFIG_I2C_ALI15X3 is not set
1195# CONFIG_I2C_AMD756 is not set
1196CONFIG_I2C_AMD8111=y
1197# CONFIG_I2C_I801 is not set
1198# CONFIG_I2C_ISCH is not set
1199# CONFIG_I2C_PIIX4 is not set
1200# CONFIG_I2C_NFORCE2 is not set
1201# CONFIG_I2C_SIS5595 is not set
1202# CONFIG_I2C_SIS630 is not set
1203# CONFIG_I2C_SIS96X is not set
1204# CONFIG_I2C_VIA is not set
1205# CONFIG_I2C_VIAPRO is not set
1206
1207#
1208# I2C system bus drivers (mostly embedded / system-on-chip)
1209#
1210# CONFIG_I2C_OCORES is not set
1211# CONFIG_I2C_SIMTEC is not set
1212
1213#
1214# External I2C/SMBus adapter drivers
1215#
1216# CONFIG_I2C_PARPORT_LIGHT is not set
1217# CONFIG_I2C_TAOS_EVM is not set
1218# CONFIG_I2C_TINY_USB is not set
1219
1220#
1221# Graphics adapter I2C/DDC channel drivers
1222#
1223# CONFIG_I2C_VOODOO3 is not set
1224
1225#
1226# Other I2C/SMBus bus drivers
1227#
1228# CONFIG_I2C_PCA_PLATFORM is not set
1229# CONFIG_I2C_STUB is not set
1230
1231#
1232# Miscellaneous I2C Chip support
1233#
1234# CONFIG_DS1682 is not set
1235# CONFIG_SENSORS_TSL2550 is not set
1236# CONFIG_I2C_DEBUG_CORE is not set
1237# CONFIG_I2C_DEBUG_ALGO is not set
1238# CONFIG_I2C_DEBUG_BUS is not set
1239# CONFIG_I2C_DEBUG_CHIP is not set
1240# CONFIG_SPI is not set
1241
1242#
1243# PPS support
1244#
1245# CONFIG_PPS is not set
1246CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
1247# CONFIG_GPIOLIB is not set
1248# CONFIG_W1 is not set
1249# CONFIG_POWER_SUPPLY is not set
1250# CONFIG_HWMON is not set
1251# CONFIG_THERMAL is not set
1252# CONFIG_WATCHDOG is not set
1253CONFIG_SSB_POSSIBLE=y
1254
1255#
1256# Sonics Silicon Backplane
1257#
1258# CONFIG_SSB is not set
1259
1260#
1261# Multifunction device drivers
1262#
1263# CONFIG_MFD_CORE is not set
1264# CONFIG_MFD_SM501 is not set
1265# CONFIG_HTC_PASIC3 is not set
1266# CONFIG_TWL4030_CORE is not set
1267# CONFIG_MFD_TMIO is not set
1268# CONFIG_PMIC_DA903X is not set
1269# CONFIG_MFD_WM8400 is not set
1270# CONFIG_MFD_WM831X is not set
1271# CONFIG_MFD_WM8350_I2C is not set
1272# CONFIG_MFD_PCF50633 is not set
1273# CONFIG_AB3100_CORE is not set
1274# CONFIG_REGULATOR is not set
1275# CONFIG_MEDIA_SUPPORT is not set
1276
1277#
1278# Graphics support
1279#
1280# CONFIG_AGP is not set
1281CONFIG_VGA_ARB=y
1282# CONFIG_DRM is not set
1283# CONFIG_VGASTATE is not set
1284CONFIG_VIDEO_OUTPUT_CONTROL=m
1285CONFIG_FB=y
1286CONFIG_FIRMWARE_EDID=y
1287CONFIG_FB_DDC=y
1288# CONFIG_FB_BOOT_VESA_SUPPORT is not set
1289CONFIG_FB_CFB_FILLRECT=y
1290CONFIG_FB_CFB_COPYAREA=y
1291CONFIG_FB_CFB_IMAGEBLIT=y
1292# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1293# CONFIG_FB_SYS_FILLRECT is not set
1294# CONFIG_FB_SYS_COPYAREA is not set
1295# CONFIG_FB_SYS_IMAGEBLIT is not set
1296# CONFIG_FB_FOREIGN_ENDIAN is not set
1297# CONFIG_FB_SYS_FOPS is not set
1298# CONFIG_FB_SVGALIB is not set
1299CONFIG_FB_MACMODES=y
1300CONFIG_FB_BACKLIGHT=y
1301CONFIG_FB_MODE_HELPERS=y
1302CONFIG_FB_TILEBLITTING=y
1303
1304#
1305# Frame buffer hardware drivers
1306#
1307# CONFIG_FB_CIRRUS is not set
1308# CONFIG_FB_PM2 is not set
1309# CONFIG_FB_CYBER2000 is not set
1310CONFIG_FB_OF=y
1311# CONFIG_FB_ASILIANT is not set
1312# CONFIG_FB_IMSTT is not set
1313# CONFIG_FB_VGA16 is not set
1314# CONFIG_FB_S1D13XXX is not set
1315# CONFIG_FB_NVIDIA is not set
1316# CONFIG_FB_RIVA is not set
1317CONFIG_FB_MATROX=y
1318CONFIG_FB_MATROX_MILLENIUM=y
1319CONFIG_FB_MATROX_MYSTIQUE=y
1320CONFIG_FB_MATROX_G=y
1321CONFIG_FB_MATROX_I2C=m
1322CONFIG_FB_MATROX_MAVEN=m
1323CONFIG_FB_RADEON=y
1324CONFIG_FB_RADEON_I2C=y
1325CONFIG_FB_RADEON_BACKLIGHT=y
1326# CONFIG_FB_RADEON_DEBUG is not set
1327# CONFIG_FB_ATY128 is not set
1328# CONFIG_FB_ATY is not set
1329# CONFIG_FB_S3 is not set
1330# CONFIG_FB_SAVAGE is not set
1331# CONFIG_FB_SIS is not set
1332# CONFIG_FB_VIA is not set
1333# CONFIG_FB_NEOMAGIC is not set
1334# CONFIG_FB_KYRO is not set
1335# CONFIG_FB_3DFX is not set
1336# CONFIG_FB_VOODOO1 is not set
1337# CONFIG_FB_VT8623 is not set
1338# CONFIG_FB_TRIDENT is not set
1339# CONFIG_FB_ARK is not set
1340# CONFIG_FB_PM3 is not set
1341# CONFIG_FB_CARMINE is not set
1342CONFIG_FB_IBM_GXT4500=y
1343# CONFIG_FB_VIRTUAL is not set
1344# CONFIG_FB_METRONOME is not set
1345# CONFIG_FB_MB862XX is not set
1346# CONFIG_FB_BROADSHEET is not set
1347CONFIG_BACKLIGHT_LCD_SUPPORT=y
1348CONFIG_LCD_CLASS_DEVICE=y
1349# CONFIG_LCD_ILI9320 is not set
1350# CONFIG_LCD_PLATFORM is not set
1351CONFIG_BACKLIGHT_CLASS_DEVICE=y
1352CONFIG_BACKLIGHT_GENERIC=y
1353
1354#
1355# Display device support
1356#
1357CONFIG_DISPLAY_SUPPORT=y
1358
1359#
1360# Display hardware drivers
1361#
1362
1363#
1364# Console display driver support
1365#
1366# CONFIG_VGA_CONSOLE is not set
1367CONFIG_DUMMY_CONSOLE=y
1368CONFIG_FRAMEBUFFER_CONSOLE=y
1369# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1370# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1371# CONFIG_FONTS is not set
1372CONFIG_FONT_8x8=y
1373CONFIG_FONT_8x16=y
1374CONFIG_LOGO=y
1375CONFIG_LOGO_LINUX_MONO=y
1376CONFIG_LOGO_LINUX_VGA16=y
1377CONFIG_LOGO_LINUX_CLUT224=y
1378CONFIG_SOUND=m
1379CONFIG_SOUND_OSS_CORE=y
1380CONFIG_SOUND_OSS_CORE_PRECLAIM=y
1381CONFIG_SND=m
1382CONFIG_SND_TIMER=m
1383CONFIG_SND_PCM=m
1384CONFIG_SND_SEQUENCER=m
1385CONFIG_SND_SEQ_DUMMY=m
1386CONFIG_SND_OSSEMUL=y
1387CONFIG_SND_MIXER_OSS=m
1388CONFIG_SND_PCM_OSS=m
1389CONFIG_SND_PCM_OSS_PLUGINS=y
1390CONFIG_SND_SEQUENCER_OSS=y
1391# CONFIG_SND_HRTIMER is not set
1392# CONFIG_SND_DYNAMIC_MINORS is not set
1393CONFIG_SND_SUPPORT_OLD_API=y
1394CONFIG_SND_VERBOSE_PROCFS=y
1395# CONFIG_SND_VERBOSE_PRINTK is not set
1396# CONFIG_SND_DEBUG is not set
1397# CONFIG_SND_RAWMIDI_SEQ is not set
1398# CONFIG_SND_OPL3_LIB_SEQ is not set
1399# CONFIG_SND_OPL4_LIB_SEQ is not set
1400# CONFIG_SND_SBAWE_SEQ is not set
1401# CONFIG_SND_EMU10K1_SEQ is not set
1402CONFIG_SND_DRIVERS=y
1403# CONFIG_SND_DUMMY is not set
1404# CONFIG_SND_VIRMIDI is not set
1405# CONFIG_SND_MTPAV is not set
1406# CONFIG_SND_SERIAL_U16550 is not set
1407# CONFIG_SND_MPU401 is not set
1408CONFIG_SND_PCI=y
1409# CONFIG_SND_AD1889 is not set
1410# CONFIG_SND_ALS300 is not set
1411# CONFIG_SND_ALS4000 is not set
1412# CONFIG_SND_ALI5451 is not set
1413# CONFIG_SND_ATIIXP is not set
1414# CONFIG_SND_ATIIXP_MODEM is not set
1415# CONFIG_SND_AU8810 is not set
1416# CONFIG_SND_AU8820 is not set
1417# CONFIG_SND_AU8830 is not set
1418# CONFIG_SND_AW2 is not set
1419# CONFIG_SND_AZT3328 is not set
1420# CONFIG_SND_BT87X is not set
1421# CONFIG_SND_CA0106 is not set
1422# CONFIG_SND_CMIPCI is not set
1423# CONFIG_SND_OXYGEN is not set
1424# CONFIG_SND_CS4281 is not set
1425# CONFIG_SND_CS46XX is not set
1426# CONFIG_SND_CS5530 is not set
1427# CONFIG_SND_CTXFI is not set
1428# CONFIG_SND_DARLA20 is not set
1429# CONFIG_SND_GINA20 is not set
1430# CONFIG_SND_LAYLA20 is not set
1431# CONFIG_SND_DARLA24 is not set
1432# CONFIG_SND_GINA24 is not set
1433# CONFIG_SND_LAYLA24 is not set
1434# CONFIG_SND_MONA is not set
1435# CONFIG_SND_MIA is not set
1436# CONFIG_SND_ECHO3G is not set
1437# CONFIG_SND_INDIGO is not set
1438# CONFIG_SND_INDIGOIO is not set
1439# CONFIG_SND_INDIGODJ is not set
1440# CONFIG_SND_INDIGOIOX is not set
1441# CONFIG_SND_INDIGODJX is not set
1442# CONFIG_SND_EMU10K1 is not set
1443# CONFIG_SND_EMU10K1X is not set
1444# CONFIG_SND_ENS1370 is not set
1445# CONFIG_SND_ENS1371 is not set
1446# CONFIG_SND_ES1938 is not set
1447# CONFIG_SND_ES1968 is not set
1448# CONFIG_SND_FM801 is not set
1449# CONFIG_SND_HDA_INTEL is not set
1450# CONFIG_SND_HDSP is not set
1451# CONFIG_SND_HDSPM is not set
1452# CONFIG_SND_HIFIER is not set
1453# CONFIG_SND_ICE1712 is not set
1454# CONFIG_SND_ICE1724 is not set
1455# CONFIG_SND_INTEL8X0 is not set
1456# CONFIG_SND_INTEL8X0M is not set
1457# CONFIG_SND_KORG1212 is not set
1458# CONFIG_SND_LX6464ES is not set
1459# CONFIG_SND_MAESTRO3 is not set
1460# CONFIG_SND_MIXART is not set
1461# CONFIG_SND_NM256 is not set
1462# CONFIG_SND_PCXHR is not set
1463# CONFIG_SND_RIPTIDE is not set
1464# CONFIG_SND_RME32 is not set
1465# CONFIG_SND_RME96 is not set
1466# CONFIG_SND_RME9652 is not set
1467# CONFIG_SND_SONICVIBES is not set
1468# CONFIG_SND_TRIDENT is not set
1469# CONFIG_SND_VIA82XX is not set
1470# CONFIG_SND_VIA82XX_MODEM is not set
1471# CONFIG_SND_VIRTUOSO is not set
1472# CONFIG_SND_VX222 is not set
1473# CONFIG_SND_YMFPCI is not set
1474CONFIG_SND_PPC=y
1475CONFIG_SND_USB=y
1476# CONFIG_SND_USB_AUDIO is not set
1477# CONFIG_SND_USB_USX2Y is not set
1478# CONFIG_SND_USB_CAIAQ is not set
1479CONFIG_SND_PCMCIA=y
1480# CONFIG_SND_VXPOCKET is not set
1481# CONFIG_SND_PDAUDIOCF is not set
1482# CONFIG_SND_SOC is not set
1483# CONFIG_SOUND_PRIME is not set
1484CONFIG_HID_SUPPORT=y
1485CONFIG_HID=y
1486# CONFIG_HIDRAW is not set
1487
1488#
1489# USB Input Devices
1490#
1491CONFIG_USB_HID=y
1492# CONFIG_HID_PID is not set
1493CONFIG_USB_HIDDEV=y
1494
1495#
1496# Special HID drivers
1497#
1498CONFIG_HID_A4TECH=y
1499CONFIG_HID_APPLE=y
1500CONFIG_HID_BELKIN=y
1501CONFIG_HID_CHERRY=y
1502CONFIG_HID_CHICONY=y
1503CONFIG_HID_CYPRESS=y
1504CONFIG_HID_DRAGONRISE=y
1505# CONFIG_DRAGONRISE_FF is not set
1506CONFIG_HID_EZKEY=y
1507CONFIG_HID_KYE=y
1508CONFIG_HID_GYRATION=y
1509CONFIG_HID_TWINHAN=y
1510CONFIG_HID_KENSINGTON=y
1511CONFIG_HID_LOGITECH=y
1512# CONFIG_LOGITECH_FF is not set
1513# CONFIG_LOGIRUMBLEPAD2_FF is not set
1514CONFIG_HID_MICROSOFT=y
1515CONFIG_HID_MONTEREY=y
1516CONFIG_HID_NTRIG=y
1517CONFIG_HID_PANTHERLORD=y
1518# CONFIG_PANTHERLORD_FF is not set
1519CONFIG_HID_PETALYNX=y
1520CONFIG_HID_SAMSUNG=y
1521CONFIG_HID_SONY=y
1522CONFIG_HID_SUNPLUS=y
1523CONFIG_HID_GREENASIA=y
1524# CONFIG_GREENASIA_FF is not set
1525CONFIG_HID_SMARTJOYPLUS=y
1526# CONFIG_SMARTJOYPLUS_FF is not set
1527CONFIG_HID_TOPSEED=y
1528CONFIG_HID_THRUSTMASTER=y
1529# CONFIG_THRUSTMASTER_FF is not set
1530CONFIG_HID_ZEROPLUS=y
1531# CONFIG_ZEROPLUS_FF is not set
1532CONFIG_USB_SUPPORT=y
1533CONFIG_USB_ARCH_HAS_HCD=y
1534CONFIG_USB_ARCH_HAS_OHCI=y
1535CONFIG_USB_ARCH_HAS_EHCI=y
1536CONFIG_USB=y
1537# CONFIG_USB_DEBUG is not set
1538# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1539
1540#
1541# Miscellaneous USB options
1542#
1543CONFIG_USB_DEVICEFS=y
1544CONFIG_USB_DEVICE_CLASS=y
1545# CONFIG_USB_DYNAMIC_MINORS is not set
1546# CONFIG_USB_OTG is not set
1547# CONFIG_USB_MON is not set
1548# CONFIG_USB_WUSB is not set
1549# CONFIG_USB_WUSB_CBAF is not set
1550
1551#
1552# USB Host Controller Drivers
1553#
1554# CONFIG_USB_C67X00_HCD is not set
1555# CONFIG_USB_XHCI_HCD is not set
1556CONFIG_USB_EHCI_HCD=y
1557# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1558CONFIG_USB_EHCI_TT_NEWSCHED=y
1559# CONFIG_USB_EHCI_HCD_PPC_OF is not set
1560# CONFIG_USB_OXU210HP_HCD is not set
1561# CONFIG_USB_ISP116X_HCD is not set
1562# CONFIG_USB_ISP1760_HCD is not set
1563# CONFIG_USB_ISP1362_HCD is not set
1564CONFIG_USB_OHCI_HCD=y
1565# CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set
1566# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
1567# CONFIG_USB_OHCI_HCD_PPC_OF is not set
1568# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1569# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1570CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1571# CONFIG_USB_UHCI_HCD is not set
1572# CONFIG_USB_SL811_HCD is not set
1573# CONFIG_USB_R8A66597_HCD is not set
1574# CONFIG_USB_WHCI_HCD is not set
1575# CONFIG_USB_HWA_HCD is not set
1576
1577#
1578# USB Device Class drivers
1579#
1580# CONFIG_USB_ACM is not set
1581# CONFIG_USB_PRINTER is not set
1582# CONFIG_USB_WDM is not set
1583# CONFIG_USB_TMC is not set
1584
1585#
1586# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1587#
1588
1589#
1590# also be needed; see USB_STORAGE Help for more info
1591#
1592CONFIG_USB_STORAGE=m
1593# CONFIG_USB_STORAGE_DEBUG is not set
1594# CONFIG_USB_STORAGE_DATAFAB is not set
1595# CONFIG_USB_STORAGE_FREECOM is not set
1596# CONFIG_USB_STORAGE_ISD200 is not set
1597# CONFIG_USB_STORAGE_USBAT is not set
1598# CONFIG_USB_STORAGE_SDDR09 is not set
1599# CONFIG_USB_STORAGE_SDDR55 is not set
1600# CONFIG_USB_STORAGE_JUMPSHOT is not set
1601# CONFIG_USB_STORAGE_ALAUDA is not set
1602# CONFIG_USB_STORAGE_ONETOUCH is not set
1603# CONFIG_USB_STORAGE_KARMA is not set
1604# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1605# CONFIG_USB_LIBUSUAL is not set
1606
1607#
1608# USB Imaging devices
1609#
1610# CONFIG_USB_MDC800 is not set
1611# CONFIG_USB_MICROTEK is not set
1612
1613#
1614# USB port drivers
1615#
1616# CONFIG_USB_SERIAL is not set
1617
1618#
1619# USB Miscellaneous drivers
1620#
1621# CONFIG_USB_EMI62 is not set
1622# CONFIG_USB_EMI26 is not set
1623# CONFIG_USB_ADUTUX is not set
1624# CONFIG_USB_SEVSEG is not set
1625# CONFIG_USB_RIO500 is not set
1626# CONFIG_USB_LEGOTOWER is not set
1627# CONFIG_USB_LCD is not set
1628# CONFIG_USB_BERRY_CHARGE is not set
1629# CONFIG_USB_LED is not set
1630# CONFIG_USB_CYPRESS_CY7C63 is not set
1631# CONFIG_USB_CYTHERM is not set
1632# CONFIG_USB_IDMOUSE is not set
1633# CONFIG_USB_FTDI_ELAN is not set
1634CONFIG_USB_APPLEDISPLAY=m
1635# CONFIG_USB_SISUSBVGA is not set
1636# CONFIG_USB_LD is not set
1637# CONFIG_USB_TRANCEVIBRATOR is not set
1638# CONFIG_USB_IOWARRIOR is not set
1639# CONFIG_USB_TEST is not set
1640# CONFIG_USB_ISIGHTFW is not set
1641# CONFIG_USB_VST is not set
1642# CONFIG_USB_GADGET is not set
1643
1644#
1645# OTG and related infrastructure
1646#
1647# CONFIG_NOP_USB_XCEIV is not set
1648# CONFIG_UWB is not set
1649# CONFIG_MMC is not set
1650# CONFIG_MEMSTICK is not set
1651# CONFIG_NEW_LEDS is not set
1652# CONFIG_ACCESSIBILITY is not set
1653CONFIG_INFINIBAND=m
1654# CONFIG_INFINIBAND_USER_MAD is not set
1655# CONFIG_INFINIBAND_USER_ACCESS is not set
1656CONFIG_INFINIBAND_ADDR_TRANS=y
1657CONFIG_INFINIBAND_MTHCA=m
1658CONFIG_INFINIBAND_MTHCA_DEBUG=y
1659# CONFIG_INFINIBAND_IPATH is not set
1660# CONFIG_INFINIBAND_AMSO1100 is not set
1661# CONFIG_MLX4_INFINIBAND is not set
1662# CONFIG_INFINIBAND_NES is not set
1663CONFIG_INFINIBAND_IPOIB=m
1664# CONFIG_INFINIBAND_IPOIB_CM is not set
1665CONFIG_INFINIBAND_IPOIB_DEBUG=y
1666# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
1667# CONFIG_INFINIBAND_SRP is not set
1668CONFIG_INFINIBAND_ISER=m
1669CONFIG_EDAC=y
1670
1671#
1672# Reporting subsystems
1673#
1674# CONFIG_EDAC_DEBUG is not set
1675CONFIG_EDAC_MM_EDAC=y
1676# CONFIG_EDAC_CPC925 is not set
1677CONFIG_RTC_LIB=y
1678CONFIG_RTC_CLASS=y
1679CONFIG_RTC_HCTOSYS=y
1680CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1681# CONFIG_RTC_DEBUG is not set
1682
1683#
1684# RTC interfaces
1685#
1686CONFIG_RTC_INTF_SYSFS=y
1687CONFIG_RTC_INTF_PROC=y
1688CONFIG_RTC_INTF_DEV=y
1689# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1690# CONFIG_RTC_DRV_TEST is not set
1691
1692#
1693# I2C RTC drivers
1694#
1695CONFIG_RTC_DRV_DS1307=y
1696# CONFIG_RTC_DRV_DS1374 is not set
1697# CONFIG_RTC_DRV_DS1672 is not set
1698# CONFIG_RTC_DRV_MAX6900 is not set
1699# CONFIG_RTC_DRV_RS5C372 is not set
1700# CONFIG_RTC_DRV_ISL1208 is not set
1701# CONFIG_RTC_DRV_X1205 is not set
1702# CONFIG_RTC_DRV_PCF8563 is not set
1703# CONFIG_RTC_DRV_PCF8583 is not set
1704# CONFIG_RTC_DRV_M41T80 is not set
1705# CONFIG_RTC_DRV_S35390A is not set
1706# CONFIG_RTC_DRV_FM3130 is not set
1707# CONFIG_RTC_DRV_RX8581 is not set
1708# CONFIG_RTC_DRV_RX8025 is not set
1709
1710#
1711# SPI RTC drivers
1712#
1713
1714#
1715# Platform RTC drivers
1716#
1717# CONFIG_RTC_DRV_CMOS is not set
1718# CONFIG_RTC_DRV_DS1286 is not set
1719# CONFIG_RTC_DRV_DS1511 is not set
1720# CONFIG_RTC_DRV_DS1553 is not set
1721# CONFIG_RTC_DRV_DS1742 is not set
1722# CONFIG_RTC_DRV_STK17TA8 is not set
1723# CONFIG_RTC_DRV_M48T86 is not set
1724# CONFIG_RTC_DRV_M48T35 is not set
1725# CONFIG_RTC_DRV_M48T59 is not set
1726# CONFIG_RTC_DRV_BQ4802 is not set
1727# CONFIG_RTC_DRV_V3020 is not set
1728
1729#
1730# on-CPU RTC drivers
1731#
1732# CONFIG_RTC_DRV_GENERIC is not set
1733# CONFIG_DMADEVICES is not set
1734# CONFIG_AUXDISPLAY is not set
1735# CONFIG_UIO is not set
1736
1737#
1738# TI VLYNQ
1739#
1740# CONFIG_STAGING is not set
1741
1742#
1743# File systems
1744#
1745CONFIG_EXT2_FS=y
1746CONFIG_EXT2_FS_XATTR=y
1747CONFIG_EXT2_FS_POSIX_ACL=y
1748CONFIG_EXT2_FS_SECURITY=y
1749CONFIG_EXT2_FS_XIP=y
1750CONFIG_EXT3_FS=y
1751# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1752CONFIG_EXT3_FS_XATTR=y
1753CONFIG_EXT3_FS_POSIX_ACL=y
1754CONFIG_EXT3_FS_SECURITY=y
1755CONFIG_EXT4_FS=y
1756CONFIG_EXT4_FS_XATTR=y
1757CONFIG_EXT4_FS_POSIX_ACL=y
1758CONFIG_EXT4_FS_SECURITY=y
1759# CONFIG_EXT4_DEBUG is not set
1760CONFIG_FS_XIP=y
1761CONFIG_JBD=y
1762# CONFIG_JBD_DEBUG is not set
1763CONFIG_JBD2=y
1764# CONFIG_JBD2_DEBUG is not set
1765CONFIG_FS_MBCACHE=y
1766CONFIG_REISERFS_FS=y
1767# CONFIG_REISERFS_CHECK is not set
1768# CONFIG_REISERFS_PROC_INFO is not set
1769CONFIG_REISERFS_FS_XATTR=y
1770CONFIG_REISERFS_FS_POSIX_ACL=y
1771CONFIG_REISERFS_FS_SECURITY=y
1772CONFIG_JFS_FS=y
1773CONFIG_JFS_POSIX_ACL=y
1774CONFIG_JFS_SECURITY=y
1775# CONFIG_JFS_DEBUG is not set
1776# CONFIG_JFS_STATISTICS is not set
1777CONFIG_FS_POSIX_ACL=y
1778CONFIG_XFS_FS=m
1779# CONFIG_XFS_QUOTA is not set
1780CONFIG_XFS_POSIX_ACL=y
1781# CONFIG_XFS_RT is not set
1782# CONFIG_XFS_DEBUG is not set
1783# CONFIG_GFS2_FS is not set
1784# CONFIG_OCFS2_FS is not set
1785# CONFIG_BTRFS_FS is not set
1786# CONFIG_NILFS2_FS is not set
1787CONFIG_FILE_LOCKING=y
1788CONFIG_FSNOTIFY=y
1789CONFIG_DNOTIFY=y
1790CONFIG_INOTIFY=y
1791CONFIG_INOTIFY_USER=y
1792# CONFIG_QUOTA is not set
1793# CONFIG_AUTOFS_FS is not set
1794CONFIG_AUTOFS4_FS=m
1795# CONFIG_FUSE_FS is not set
1796
1797#
1798# Caches
1799#
1800# CONFIG_FSCACHE is not set
1801
1802#
1803# CD-ROM/DVD Filesystems
1804#
1805CONFIG_ISO9660_FS=y
1806# CONFIG_JOLIET is not set
1807# CONFIG_ZISOFS is not set
1808CONFIG_UDF_FS=m
1809CONFIG_UDF_NLS=y
1810
1811#
1812# DOS/FAT/NT Filesystems
1813#
1814CONFIG_FAT_FS=y
1815CONFIG_MSDOS_FS=y
1816CONFIG_VFAT_FS=y
1817CONFIG_FAT_DEFAULT_CODEPAGE=437
1818CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1819# CONFIG_NTFS_FS is not set
1820
1821#
1822# Pseudo filesystems
1823#
1824CONFIG_PROC_FS=y
1825CONFIG_PROC_KCORE=y
1826CONFIG_PROC_SYSCTL=y
1827CONFIG_PROC_PAGE_MONITOR=y
1828CONFIG_SYSFS=y
1829CONFIG_TMPFS=y
1830# CONFIG_TMPFS_POSIX_ACL is not set
1831# CONFIG_HUGETLBFS is not set
1832# CONFIG_HUGETLB_PAGE is not set
1833# CONFIG_CONFIGFS_FS is not set
1834CONFIG_MISC_FILESYSTEMS=y
1835# CONFIG_ADFS_FS is not set
1836# CONFIG_AFFS_FS is not set
1837CONFIG_HFS_FS=m
1838CONFIG_HFSPLUS_FS=m
1839# CONFIG_BEFS_FS is not set
1840# CONFIG_BFS_FS is not set
1841# CONFIG_EFS_FS is not set
1842CONFIG_CRAMFS=y
1843# CONFIG_SQUASHFS is not set
1844# CONFIG_VXFS_FS is not set
1845# CONFIG_MINIX_FS is not set
1846# CONFIG_OMFS_FS is not set
1847# CONFIG_HPFS_FS is not set
1848# CONFIG_QNX4FS_FS is not set
1849# CONFIG_ROMFS_FS is not set
1850# CONFIG_SYSV_FS is not set
1851# CONFIG_UFS_FS is not set
1852CONFIG_NETWORK_FILESYSTEMS=y
1853CONFIG_NFS_FS=y
1854CONFIG_NFS_V3=y
1855CONFIG_NFS_V3_ACL=y
1856CONFIG_NFS_V4=y
1857# CONFIG_NFS_V4_1 is not set
1858CONFIG_ROOT_NFS=y
1859CONFIG_NFSD=m
1860CONFIG_NFSD_V2_ACL=y
1861CONFIG_NFSD_V3=y
1862CONFIG_NFSD_V3_ACL=y
1863CONFIG_NFSD_V4=y
1864CONFIG_LOCKD=y
1865CONFIG_LOCKD_V4=y
1866CONFIG_EXPORTFS=m
1867CONFIG_NFS_ACL_SUPPORT=y
1868CONFIG_NFS_COMMON=y
1869CONFIG_SUNRPC=y
1870CONFIG_SUNRPC_GSS=y
1871CONFIG_SUNRPC_XPRT_RDMA=m
1872CONFIG_RPCSEC_GSS_KRB5=y
1873CONFIG_RPCSEC_GSS_SPKM3=m
1874# CONFIG_SMB_FS is not set
1875CONFIG_CIFS=m
1876# CONFIG_CIFS_STATS is not set
1877# CONFIG_CIFS_WEAK_PW_HASH is not set
1878CONFIG_CIFS_XATTR=y
1879CONFIG_CIFS_POSIX=y
1880# CONFIG_CIFS_DEBUG2 is not set
1881# CONFIG_CIFS_EXPERIMENTAL is not set
1882# CONFIG_NCP_FS is not set
1883# CONFIG_CODA_FS is not set
1884# CONFIG_AFS_FS is not set
1885
1886#
1887# Partition Types
1888#
1889CONFIG_PARTITION_ADVANCED=y
1890# CONFIG_ACORN_PARTITION is not set
1891# CONFIG_OSF_PARTITION is not set
1892# CONFIG_AMIGA_PARTITION is not set
1893# CONFIG_ATARI_PARTITION is not set
1894CONFIG_MAC_PARTITION=y
1895CONFIG_MSDOS_PARTITION=y
1896# CONFIG_BSD_DISKLABEL is not set
1897# CONFIG_MINIX_SUBPARTITION is not set
1898# CONFIG_SOLARIS_X86_PARTITION is not set
1899# CONFIG_UNIXWARE_DISKLABEL is not set
1900# CONFIG_LDM_PARTITION is not set
1901# CONFIG_SGI_PARTITION is not set
1902# CONFIG_ULTRIX_PARTITION is not set
1903# CONFIG_SUN_PARTITION is not set
1904# CONFIG_KARMA_PARTITION is not set
1905# CONFIG_EFI_PARTITION is not set
1906# CONFIG_SYSV68_PARTITION is not set
1907CONFIG_NLS=y
1908CONFIG_NLS_DEFAULT="iso8859-1"
1909CONFIG_NLS_CODEPAGE_437=y
1910CONFIG_NLS_CODEPAGE_737=m
1911CONFIG_NLS_CODEPAGE_775=m
1912CONFIG_NLS_CODEPAGE_850=m
1913CONFIG_NLS_CODEPAGE_852=m
1914CONFIG_NLS_CODEPAGE_855=m
1915CONFIG_NLS_CODEPAGE_857=m
1916CONFIG_NLS_CODEPAGE_860=m
1917CONFIG_NLS_CODEPAGE_861=m
1918CONFIG_NLS_CODEPAGE_862=m
1919CONFIG_NLS_CODEPAGE_863=m
1920CONFIG_NLS_CODEPAGE_864=m
1921CONFIG_NLS_CODEPAGE_865=m
1922CONFIG_NLS_CODEPAGE_866=m
1923CONFIG_NLS_CODEPAGE_869=m
1924CONFIG_NLS_CODEPAGE_936=m
1925CONFIG_NLS_CODEPAGE_950=m
1926CONFIG_NLS_CODEPAGE_932=m
1927CONFIG_NLS_CODEPAGE_949=m
1928CONFIG_NLS_CODEPAGE_874=m
1929CONFIG_NLS_ISO8859_8=m
1930CONFIG_NLS_CODEPAGE_1250=m
1931CONFIG_NLS_CODEPAGE_1251=m
1932CONFIG_NLS_ASCII=m
1933CONFIG_NLS_ISO8859_1=y
1934CONFIG_NLS_ISO8859_2=m
1935CONFIG_NLS_ISO8859_3=m
1936CONFIG_NLS_ISO8859_4=m
1937CONFIG_NLS_ISO8859_5=m
1938CONFIG_NLS_ISO8859_6=m
1939CONFIG_NLS_ISO8859_7=m
1940CONFIG_NLS_ISO8859_9=m
1941CONFIG_NLS_ISO8859_13=m
1942CONFIG_NLS_ISO8859_14=m
1943CONFIG_NLS_ISO8859_15=m
1944CONFIG_NLS_KOI8_R=m
1945CONFIG_NLS_KOI8_U=m
1946CONFIG_NLS_UTF8=m
1947# CONFIG_DLM is not set
1948CONFIG_BINARY_PRINTF=y
1949
1950#
1951# Library routines
1952#
1953CONFIG_BITREVERSE=y
1954CONFIG_GENERIC_FIND_LAST_BIT=y
1955CONFIG_CRC_CCITT=m
1956CONFIG_CRC16=y
1957CONFIG_CRC_T10DIF=y
1958CONFIG_CRC_ITU_T=m
1959CONFIG_CRC32=y
1960# CONFIG_CRC7 is not set
1961CONFIG_LIBCRC32C=m
1962CONFIG_ZLIB_INFLATE=y
1963CONFIG_ZLIB_DEFLATE=m
1964CONFIG_LZO_COMPRESS=m
1965CONFIG_LZO_DECOMPRESS=m
1966CONFIG_DECOMPRESS_GZIP=y
1967CONFIG_DECOMPRESS_BZIP2=y
1968CONFIG_DECOMPRESS_LZMA=y
1969CONFIG_TEXTSEARCH=y
1970CONFIG_TEXTSEARCH_KMP=m
1971CONFIG_TEXTSEARCH_BM=m
1972CONFIG_TEXTSEARCH_FSM=m
1973CONFIG_HAS_IOMEM=y
1974CONFIG_HAS_IOPORT=y
1975CONFIG_HAS_DMA=y
1976CONFIG_HAVE_LMB=y
1977CONFIG_NLATTR=y
1978
1979#
1980# Kernel hacking
1981#
1982# CONFIG_PRINTK_TIME is not set
1983CONFIG_ENABLE_WARN_DEPRECATED=y
1984CONFIG_ENABLE_MUST_CHECK=y
1985CONFIG_FRAME_WARN=2048
1986CONFIG_MAGIC_SYSRQ=y
1987# CONFIG_STRIP_ASM_SYMS is not set
1988# CONFIG_UNUSED_SYMBOLS is not set
1989CONFIG_DEBUG_FS=y
1990# CONFIG_HEADERS_CHECK is not set
1991CONFIG_DEBUG_KERNEL=y
1992# CONFIG_DEBUG_SHIRQ is not set
1993CONFIG_DETECT_SOFTLOCKUP=y
1994# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1995CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1996CONFIG_DETECT_HUNG_TASK=y
1997# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
1998CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1999CONFIG_SCHED_DEBUG=y
2000CONFIG_SCHEDSTATS=y
2001# CONFIG_TIMER_STATS is not set
2002# CONFIG_DEBUG_OBJECTS is not set
2003# CONFIG_SLUB_DEBUG_ON is not set
2004# CONFIG_SLUB_STATS is not set
2005# CONFIG_DEBUG_KMEMLEAK is not set
2006# CONFIG_DEBUG_RT_MUTEXES is not set
2007# CONFIG_RT_MUTEX_TESTER is not set
2008# CONFIG_DEBUG_SPINLOCK is not set
2009CONFIG_DEBUG_MUTEXES=y
2010# CONFIG_DEBUG_LOCK_ALLOC is not set
2011# CONFIG_PROVE_LOCKING is not set
2012# CONFIG_LOCK_STAT is not set
2013CONFIG_TRACE_IRQFLAGS=y
2014# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
2015# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
2016CONFIG_STACKTRACE=y
2017# CONFIG_DEBUG_KOBJECT is not set
2018CONFIG_DEBUG_BUGVERBOSE=y
2019# CONFIG_DEBUG_INFO is not set
2020# CONFIG_DEBUG_VM is not set
2021# CONFIG_DEBUG_WRITECOUNT is not set
2022CONFIG_DEBUG_MEMORY_INIT=y
2023# CONFIG_DEBUG_LIST is not set
2024# CONFIG_DEBUG_SG is not set
2025# CONFIG_DEBUG_NOTIFIERS is not set
2026# CONFIG_DEBUG_CREDENTIALS is not set
2027# CONFIG_RCU_TORTURE_TEST is not set
2028# CONFIG_RCU_CPU_STALL_DETECTOR is not set
2029# CONFIG_BACKTRACE_SELF_TEST is not set
2030# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
2031# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
2032# CONFIG_FAULT_INJECTION is not set
2033CONFIG_LATENCYTOP=y
2034CONFIG_SYSCTL_SYSCALL_CHECK=y
2035# CONFIG_DEBUG_PAGEALLOC is not set
2036CONFIG_NOP_TRACER=y
2037CONFIG_HAVE_FUNCTION_TRACER=y
2038CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
2039CONFIG_HAVE_DYNAMIC_FTRACE=y
2040CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
2041CONFIG_TRACER_MAX_TRACE=y
2042CONFIG_RING_BUFFER=y
2043CONFIG_EVENT_TRACING=y
2044CONFIG_CONTEXT_SWITCH_TRACER=y
2045CONFIG_RING_BUFFER_ALLOW_SWAP=y
2046CONFIG_TRACING=y
2047CONFIG_GENERIC_TRACER=y
2048CONFIG_TRACING_SUPPORT=y
2049CONFIG_FTRACE=y
2050# CONFIG_FUNCTION_TRACER is not set
2051CONFIG_IRQSOFF_TRACER=y
2052CONFIG_SCHED_TRACER=y
2053# CONFIG_BOOT_TRACER is not set
2054CONFIG_BRANCH_PROFILE_NONE=y
2055# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
2056# CONFIG_PROFILE_ALL_BRANCHES is not set
2057# CONFIG_STACK_TRACER is not set
2058# CONFIG_KMEMTRACE is not set
2059# CONFIG_WORKQUEUE_TRACER is not set
2060CONFIG_BLK_DEV_IO_TRACE=y
2061# CONFIG_FTRACE_STARTUP_TEST is not set
2062# CONFIG_RING_BUFFER_BENCHMARK is not set
2063# CONFIG_DYNAMIC_DEBUG is not set
2064# CONFIG_DMA_API_DEBUG is not set
2065# CONFIG_SAMPLES is not set
2066CONFIG_HAVE_ARCH_KGDB=y
2067# CONFIG_KGDB is not set
2068# CONFIG_PPC_DISABLE_WERROR is not set
2069CONFIG_PPC_WERROR=y
2070CONFIG_PRINT_STACK_DEPTH=64
2071CONFIG_DEBUG_STACKOVERFLOW=y
2072CONFIG_DEBUG_STACK_USAGE=y
2073# CONFIG_PPC_EMULATED_STATS is not set
2074CONFIG_CODE_PATCHING_SELFTEST=y
2075CONFIG_FTR_FIXUP_SELFTEST=y
2076CONFIG_MSI_BITMAP_SELFTEST=y
2077CONFIG_XMON=y
2078# CONFIG_XMON_DEFAULT is not set
2079CONFIG_XMON_DISASSEMBLY=y
2080CONFIG_DEBUGGER=y
2081CONFIG_IRQSTACKS=y
2082# CONFIG_VIRQ_DEBUG is not set
2083# CONFIG_PPC_EARLY_DEBUG is not set
2084
2085#
2086# Security options
2087#
2088# CONFIG_KEYS is not set
2089# CONFIG_SECURITY is not set
2090# CONFIG_SECURITYFS is not set
2091# CONFIG_SECURITY_FILE_CAPABILITIES is not set
2092CONFIG_XOR_BLOCKS=y
2093CONFIG_ASYNC_CORE=y
2094CONFIG_ASYNC_MEMCPY=y
2095CONFIG_ASYNC_XOR=y
2096CONFIG_ASYNC_PQ=y
2097CONFIG_ASYNC_RAID6_RECOV=y
2098CONFIG_CRYPTO=y
2099
2100#
2101# Crypto core or helper
2102#
2103CONFIG_CRYPTO_ALGAPI=y
2104CONFIG_CRYPTO_ALGAPI2=y
2105CONFIG_CRYPTO_AEAD=m
2106CONFIG_CRYPTO_AEAD2=y
2107CONFIG_CRYPTO_BLKCIPHER=y
2108CONFIG_CRYPTO_BLKCIPHER2=y
2109CONFIG_CRYPTO_HASH=y
2110CONFIG_CRYPTO_HASH2=y
2111CONFIG_CRYPTO_RNG=m
2112CONFIG_CRYPTO_RNG2=y
2113CONFIG_CRYPTO_PCOMP=y
2114CONFIG_CRYPTO_MANAGER=y
2115CONFIG_CRYPTO_MANAGER2=y
2116CONFIG_CRYPTO_GF128MUL=m
2117CONFIG_CRYPTO_NULL=m
2118CONFIG_CRYPTO_WORKQUEUE=y
2119# CONFIG_CRYPTO_CRYPTD is not set
2120CONFIG_CRYPTO_AUTHENC=m
2121CONFIG_CRYPTO_TEST=m
2122
2123#
2124# Authenticated Encryption with Associated Data
2125#
2126CONFIG_CRYPTO_CCM=m
2127CONFIG_CRYPTO_GCM=m
2128CONFIG_CRYPTO_SEQIV=m
2129
2130#
2131# Block modes
2132#
2133CONFIG_CRYPTO_CBC=y
2134CONFIG_CRYPTO_CTR=m
2135# CONFIG_CRYPTO_CTS is not set
2136CONFIG_CRYPTO_ECB=m
2137# CONFIG_CRYPTO_LRW is not set
2138CONFIG_CRYPTO_PCBC=m
2139# CONFIG_CRYPTO_XTS is not set
2140
2141#
2142# Hash modes
2143#
2144CONFIG_CRYPTO_HMAC=y
2145# CONFIG_CRYPTO_XCBC is not set
2146# CONFIG_CRYPTO_VMAC is not set
2147
2148#
2149# Digest
2150#
2151CONFIG_CRYPTO_CRC32C=m
2152CONFIG_CRYPTO_GHASH=m
2153CONFIG_CRYPTO_MD4=m
2154CONFIG_CRYPTO_MD5=y
2155CONFIG_CRYPTO_MICHAEL_MIC=m
2156# CONFIG_CRYPTO_RMD128 is not set
2157# CONFIG_CRYPTO_RMD160 is not set
2158# CONFIG_CRYPTO_RMD256 is not set
2159# CONFIG_CRYPTO_RMD320 is not set
2160CONFIG_CRYPTO_SHA1=m
2161CONFIG_CRYPTO_SHA256=m
2162CONFIG_CRYPTO_SHA512=m
2163CONFIG_CRYPTO_TGR192=m
2164CONFIG_CRYPTO_WP512=m
2165
2166#
2167# Ciphers
2168#
2169CONFIG_CRYPTO_AES=m
2170CONFIG_CRYPTO_ANUBIS=m
2171CONFIG_CRYPTO_ARC4=m
2172CONFIG_CRYPTO_BLOWFISH=m
2173# CONFIG_CRYPTO_CAMELLIA is not set
2174CONFIG_CRYPTO_CAST5=m
2175CONFIG_CRYPTO_CAST6=m
2176CONFIG_CRYPTO_DES=y
2177# CONFIG_CRYPTO_FCRYPT is not set
2178CONFIG_CRYPTO_KHAZAD=m
2179CONFIG_CRYPTO_SALSA20=m
2180# CONFIG_CRYPTO_SEED is not set
2181CONFIG_CRYPTO_SERPENT=m
2182CONFIG_CRYPTO_TEA=m
2183CONFIG_CRYPTO_TWOFISH=m
2184CONFIG_CRYPTO_TWOFISH_COMMON=m
2185
2186#
2187# Compression
2188#
2189CONFIG_CRYPTO_DEFLATE=m
2190# CONFIG_CRYPTO_ZLIB is not set
2191CONFIG_CRYPTO_LZO=m
2192
2193#
2194# Random Number Generation
2195#
2196# CONFIG_CRYPTO_ANSI_CPRNG is not set
2197# CONFIG_CRYPTO_HW is not set
2198# CONFIG_PPC_CLOCK is not set
2199# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
index 3a179827528d..20778a405d7a 100644
--- a/arch/powerpc/include/asm/firmware.h
+++ b/arch/powerpc/include/asm/firmware.h
@@ -37,7 +37,7 @@
37#define FW_FEATURE_VIO ASM_CONST(0x0000000000004000) 37#define FW_FEATURE_VIO ASM_CONST(0x0000000000004000)
38#define FW_FEATURE_RDMA ASM_CONST(0x0000000000008000) 38#define FW_FEATURE_RDMA ASM_CONST(0x0000000000008000)
39#define FW_FEATURE_LLAN ASM_CONST(0x0000000000010000) 39#define FW_FEATURE_LLAN ASM_CONST(0x0000000000010000)
40#define FW_FEATURE_BULK ASM_CONST(0x0000000000020000) 40#define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0000000000020000)
41#define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000) 41#define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000)
42#define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000) 42#define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000)
43#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000) 43#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000)
@@ -45,8 +45,7 @@
45#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) 45#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000)
46#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000) 46#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)
47#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000) 47#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000)
48#define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0000000002000000) 48#define FW_FEATURE_CMO ASM_CONST(0x0000000002000000)
49#define FW_FEATURE_CMO ASM_CONST(0x0000000004000000)
50 49
51#ifndef __ASSEMBLY__ 50#ifndef __ASSEMBLY__
52 51
@@ -58,8 +57,9 @@ enum {
58 FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT | 57 FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT |
59 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | 58 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
60 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | 59 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
61 FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | 60 FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR |
62 FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | FW_FEATURE_CMO, 61 FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
62 FW_FEATURE_CMO,
63 FW_FEATURE_PSERIES_ALWAYS = 0, 63 FW_FEATURE_PSERIES_ALWAYS = 0,
64 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, 64 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
65 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, 65 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 0b9c9135922e..03c862b6a9c4 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -711,6 +711,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
711 .cpu_setup = __setup_cpu_750, 711 .cpu_setup = __setup_cpu_750,
712 .machine_check = machine_check_generic, 712 .machine_check = machine_check_generic,
713 .platform = "ppc750", 713 .platform = "ppc750",
714 .oprofile_cpu_type = "ppc/750",
715 .oprofile_type = PPC_OPROFILE_G4,
714 }, 716 },
715 { /* 745/755 */ 717 { /* 745/755 */
716 .pvr_mask = 0xfffff000, 718 .pvr_mask = 0xfffff000,
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 900e0eea0099..9763267e38b4 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -658,42 +658,43 @@ do_work:
658 cmpdi r0,0 658 cmpdi r0,0
659 crandc eq,cr1*4+eq,eq 659 crandc eq,cr1*4+eq,eq
660 bne restore 660 bne restore
661 /* here we are preempting the current task */ 661
6621: 662 /* Here we are preempting the current task.
663#ifdef CONFIG_TRACE_IRQFLAGS 663 *
664 bl .trace_hardirqs_on 664 * Ensure interrupts are soft-disabled. We also properly mark
665 /* Note: we just clobbered r10 which used to contain the previous 665 * the PACA to reflect the fact that they are hard-disabled
666 * MSR before the hard-disabling done by the caller of do_work. 666 * and trace the change
667 * We don't have that value anymore, but it doesn't matter as
668 * we will hard-enable unconditionally, we can just reload the
669 * current MSR into r10
670 */ 667 */
671 mfmsr r10 668 li r0,0
672#endif /* CONFIG_TRACE_IRQFLAGS */
673 li r0,1
674 stb r0,PACASOFTIRQEN(r13) 669 stb r0,PACASOFTIRQEN(r13)
675 stb r0,PACAHARDIRQEN(r13) 670 stb r0,PACAHARDIRQEN(r13)
671 TRACE_DISABLE_INTS
672
673 /* Call the scheduler with soft IRQs off */
6741: bl .preempt_schedule_irq
675
676 /* Hard-disable interrupts again (and update PACA) */
676#ifdef CONFIG_PPC_BOOK3E 677#ifdef CONFIG_PPC_BOOK3E
677 wrteei 1
678 bl .preempt_schedule
679 wrteei 0 678 wrteei 0
680#else 679#else
681 ori r10,r10,MSR_EE
682 mtmsrd r10,1 /* reenable interrupts */
683 bl .preempt_schedule
684 mfmsr r10 680 mfmsr r10
685 clrrdi r9,r1,THREAD_SHIFT 681 rldicl r10,r10,48,1
686 rldicl r10,r10,48,1 /* disable interrupts again */
687 rotldi r10,r10,16 682 rotldi r10,r10,16
688 mtmsrd r10,1 683 mtmsrd r10,1
689#endif /* CONFIG_PPC_BOOK3E */ 684#endif /* CONFIG_PPC_BOOK3E */
685 li r0,0
686 stb r0,PACAHARDIRQEN(r13)
687
688 /* Re-test flags and eventually loop */
689 clrrdi r9,r1,THREAD_SHIFT
690 ld r4,TI_FLAGS(r9) 690 ld r4,TI_FLAGS(r9)
691 andi. r0,r4,_TIF_NEED_RESCHED 691 andi. r0,r4,_TIF_NEED_RESCHED
692 bne 1b 692 bne 1b
693 b restore 693 b restore
694 694
695user_work: 695user_work:
696#endif 696#endif /* CONFIG_PREEMPT */
697
697 /* Enable interrupts */ 698 /* Enable interrupts */
698#ifdef CONFIG_PPC_BOOK3E 699#ifdef CONFIG_PPC_BOOK3E
699 wrteei 1 700 wrteei 1
@@ -1038,8 +1039,7 @@ _GLOBAL(mod_return_to_handler)
1038 * We are in a module using the module's TOC. 1039 * We are in a module using the module's TOC.
1039 * Switch to our TOC to run inside the core kernel. 1040 * Switch to our TOC to run inside the core kernel.
1040 */ 1041 */
1041 LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler) 1042 ld r2, PACATOC(r13)
1042 ld r2, 8(r4)
1043 1043
1044 bl .ftrace_return_to_handler 1044 bl .ftrace_return_to_handler
1045 nop 1045 nop
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index fe8f71dd0b3f..641c74bb8e27 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -282,12 +282,6 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
282{ 282{
283 unsigned long *ptr = gdb_regs; 283 unsigned long *ptr = gdb_regs;
284 int reg; 284 int reg;
285#ifdef CONFIG_SPE
286 union {
287 u32 v32[2];
288 u64 v64;
289 } acc;
290#endif
291 285
292 for (reg = 0; reg < 32; reg++) 286 for (reg = 0; reg < 32; reg++)
293 UNPACK64(regs->gpr[reg], ptr); 287 UNPACK64(regs->gpr[reg], ptr);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index bb8209e34931..e8dfdbd9327a 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1190,7 +1190,7 @@ EXPORT_SYMBOL(pcibios_align_resource);
1190 * Reparent resource children of pr that conflict with res 1190 * Reparent resource children of pr that conflict with res
1191 * under res, and make res replace those children. 1191 * under res, and make res replace those children.
1192 */ 1192 */
1193static int __init reparent_resources(struct resource *parent, 1193static int reparent_resources(struct resource *parent,
1194 struct resource *res) 1194 struct resource *res)
1195{ 1195{
1196 struct resource *p, **pp; 1196 struct resource *p, **pp;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index ba949a2c93ac..ccf56ac92de5 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -97,7 +97,9 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
97 * to do an appropriate TLB flush here too 97 * to do an appropriate TLB flush here too
98 */ 98 */
99 if (bus->self) { 99 if (bus->self) {
100#ifdef CONFIG_PPC_STD_MMU_64
100 struct resource *res = bus->resource[0]; 101 struct resource *res = bus->resource[0];
102#endif
101 103
102 pr_debug("IO unmapping for PCI-PCI bridge %s\n", 104 pr_debug("IO unmapping for PCI-PCI bridge %s\n",
103 pci_name(bus->self)); 105 pci_name(bus->self));
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index bbcbae183e92..87f1663584b0 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -116,20 +116,23 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
116static inline u32 perf_get_misc_flags(struct pt_regs *regs) 116static inline u32 perf_get_misc_flags(struct pt_regs *regs)
117{ 117{
118 unsigned long mmcra = regs->dsisr; 118 unsigned long mmcra = regs->dsisr;
119 unsigned long sihv = MMCRA_SIHV;
120 unsigned long sipr = MMCRA_SIPR;
119 121
120 if (TRAP(regs) != 0xf00) 122 if (TRAP(regs) != 0xf00)
121 return 0; /* not a PMU interrupt */ 123 return 0; /* not a PMU interrupt */
122 124
123 if (ppmu->flags & PPMU_ALT_SIPR) { 125 if (ppmu->flags & PPMU_ALT_SIPR) {
124 if (mmcra & POWER6_MMCRA_SIHV) 126 sihv = POWER6_MMCRA_SIHV;
125 return PERF_RECORD_MISC_HYPERVISOR; 127 sipr = POWER6_MMCRA_SIPR;
126 return (mmcra & POWER6_MMCRA_SIPR) ?
127 PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL;
128 } 128 }
129 if (mmcra & MMCRA_SIHV) 129
130 /* PR has priority over HV, so order below is important */
131 if (mmcra & sipr)
132 return PERF_RECORD_MISC_USER;
133 if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV))
130 return PERF_RECORD_MISC_HYPERVISOR; 134 return PERF_RECORD_MISC_HYPERVISOR;
131 return (mmcra & MMCRA_SIPR) ? PERF_RECORD_MISC_USER : 135 return PERF_RECORD_MISC_KERNEL;
132 PERF_RECORD_MISC_KERNEL;
133} 136}
134 137
135/* 138/*
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 1168c5f440ab..c930ac38e59f 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1016,9 +1016,13 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1016#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1016#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1017 int curr_frame = current->curr_ret_stack; 1017 int curr_frame = current->curr_ret_stack;
1018 extern void return_to_handler(void); 1018 extern void return_to_handler(void);
1019 unsigned long addr = (unsigned long)return_to_handler; 1019 unsigned long rth = (unsigned long)return_to_handler;
1020 unsigned long mrth = -1;
1020#ifdef CONFIG_PPC64 1021#ifdef CONFIG_PPC64
1021 addr = *(unsigned long*)addr; 1022 extern void mod_return_to_handler(void);
1023 rth = *(unsigned long *)rth;
1024 mrth = (unsigned long)mod_return_to_handler;
1025 mrth = *(unsigned long *)mrth;
1022#endif 1026#endif
1023#endif 1027#endif
1024 1028
@@ -1044,7 +1048,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1044 if (!firstframe || ip != lr) { 1048 if (!firstframe || ip != lr) {
1045 printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); 1049 printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
1046#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1050#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1047 if (ip == addr && curr_frame >= 0) { 1051 if ((ip == rth || ip == mrth) && curr_frame >= 0) {
1048 printk(" (%pS)", 1052 printk(" (%pS)",
1049 (void *)current->ret_stack[curr_frame].ret); 1053 (void *)current->ret_stack[curr_frame].ret);
1050 curr_frame--; 1054 curr_frame--;
@@ -1168,7 +1172,7 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
1168 unsigned long base = mm->brk; 1172 unsigned long base = mm->brk;
1169 unsigned long ret; 1173 unsigned long ret;
1170 1174
1171#ifdef CONFIG_PPC64 1175#ifdef CONFIG_PPC_STD_MMU_64
1172 /* 1176 /*
1173 * If we are using 1TB segments and we are allowed to randomise 1177 * If we are using 1TB segments and we are allowed to randomise
1174 * the heap, we can put it above 1TB so it is backed by a 1TB 1178 * the heap, we can put it above 1TB so it is backed by a 1TB
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 797ea95aae2e..04f638d82fb3 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -57,7 +57,6 @@
57#include <asm/cache.h> 57#include <asm/cache.h>
58#include <asm/page.h> 58#include <asm/page.h>
59#include <asm/mmu.h> 59#include <asm/mmu.h>
60#include <asm/mmu-hash64.h>
61#include <asm/firmware.h> 60#include <asm/firmware.h>
62#include <asm/xmon.h> 61#include <asm/xmon.h>
63#include <asm/udbg.h> 62#include <asm/udbg.h>
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 94e2df3cae07..137dc22afa42 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -50,6 +50,9 @@
50/* Max supported size for symbol names */ 50/* Max supported size for symbol names */
51#define MAX_SYMNAME 64 51#define MAX_SYMNAME 64
52 52
53/* The alignment of the vDSO */
54#define VDSO_ALIGNMENT (1 << 16)
55
53extern char vdso32_start, vdso32_end; 56extern char vdso32_start, vdso32_end;
54static void *vdso32_kbase = &vdso32_start; 57static void *vdso32_kbase = &vdso32_start;
55static unsigned int vdso32_pages; 58static unsigned int vdso32_pages;
@@ -231,15 +234,21 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
231 * pick a base address for the vDSO in process space. We try to put it 234 * pick a base address for the vDSO in process space. We try to put it
232 * at vdso_base which is the "natural" base for it, but we might fail 235 * at vdso_base which is the "natural" base for it, but we might fail
233 * and end up putting it elsewhere. 236 * and end up putting it elsewhere.
237 * Add enough to the size so that the result can be aligned.
234 */ 238 */
235 down_write(&mm->mmap_sem); 239 down_write(&mm->mmap_sem);
236 vdso_base = get_unmapped_area(NULL, vdso_base, 240 vdso_base = get_unmapped_area(NULL, vdso_base,
237 vdso_pages << PAGE_SHIFT, 0, 0); 241 (vdso_pages << PAGE_SHIFT) +
242 ((VDSO_ALIGNMENT - 1) & PAGE_MASK),
243 0, 0);
238 if (IS_ERR_VALUE(vdso_base)) { 244 if (IS_ERR_VALUE(vdso_base)) {
239 rc = vdso_base; 245 rc = vdso_base;
240 goto fail_mmapsem; 246 goto fail_mmapsem;
241 } 247 }
242 248
249 /* Add required alignment. */
250 vdso_base = ALIGN(vdso_base, VDSO_ALIGNMENT);
251
243 /* 252 /*
244 * Put vDSO base into mm struct. We need to do this before calling 253 * Put vDSO base into mm struct. We need to do this before calling
245 * install_special_mapping or the perf counter mmap tracking code 254 * install_special_mapping or the perf counter mmap tracking code
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index 904ef1360dd7..0546bcd49cd0 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -25,7 +25,7 @@ SECTIONS
25 . = ALIGN(16); 25 . = ALIGN(16);
26 .text : { 26 .text : {
27 *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) 27 *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*)
28 } 28 } :text
29 PROVIDE(__etext = .); 29 PROVIDE(__etext = .);
30 PROVIDE(_etext = .); 30 PROVIDE(_etext = .);
31 PROVIDE(etext = .); 31 PROVIDE(etext = .);
@@ -56,7 +56,7 @@ SECTIONS
56 .fixup : { *(.fixup) } 56 .fixup : { *(.fixup) }
57 57
58 .dynamic : { *(.dynamic) } :text :dynamic 58 .dynamic : { *(.dynamic) } :text :dynamic
59 .got : { *(.got) } 59 .got : { *(.got) } :text
60 .plt : { *(.plt) } 60 .plt : { *(.plt) }
61 61
62 _end = .; 62 _end = .;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index f56429362a12..27735a7ac12b 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -236,6 +236,7 @@ SECTIONS
236 READ_MOSTLY_DATA(L1_CACHE_BYTES) 236 READ_MOSTLY_DATA(L1_CACHE_BYTES)
237 } 237 }
238 238
239 . = ALIGN(PAGE_SIZE);
239 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { 240 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
240 NOSAVE_DATA 241 NOSAVE_DATA
241 } 242 }
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index bc44dc4b5c67..95ce35581696 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -72,19 +72,17 @@ _GLOBAL(slb_miss_kernel_load_vmemmap)
721: 721:
73#endif /* CONFIG_SPARSEMEM_VMEMMAP */ 73#endif /* CONFIG_SPARSEMEM_VMEMMAP */
74 74
75 /* vmalloc/ioremap mapping encoding bits, the "li" instructions below 75 /* vmalloc mapping gets the encoding from the PACA as the mapping
76 * will be patched by the kernel at boot 76 * can be demoted from 64K -> 4K dynamically on some machines
77 */ 77 */
78BEGIN_FTR_SECTION
79 /* check whether this is in vmalloc or ioremap space */
80 clrldi r11,r10,48 78 clrldi r11,r10,48
81 cmpldi r11,(VMALLOC_SIZE >> 28) - 1 79 cmpldi r11,(VMALLOC_SIZE >> 28) - 1
82 bgt 5f 80 bgt 5f
83 lhz r11,PACAVMALLOCSLLP(r13) 81 lhz r11,PACAVMALLOCSLLP(r13)
84 b 6f 82 b 6f
855: 835:
86END_FTR_SECTION_IFCLR(CPU_FTR_CI_LARGE_PAGE) 84 /* IO mapping */
87_GLOBAL(slb_miss_kernel_load_io) 85 _GLOBAL(slb_miss_kernel_load_io)
88 li r11,0 86 li r11,0
896: 876:
90BEGIN_FTR_SECTION 88BEGIN_FTR_SECTION
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c
index c31e5b534f0a..d45be5b5ad49 100644
--- a/arch/powerpc/platforms/52xx/mpc5200_simple.c
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -51,6 +51,8 @@ static void __init mpc5200_simple_setup_arch(void)
51/* list of the supported boards */ 51/* list of the supported boards */
52static char *board[] __initdata = { 52static char *board[] __initdata = {
53 "intercontrol,digsy-mtc", 53 "intercontrol,digsy-mtc",
54 "manroland,mucmc52",
55 "manroland,uc101",
54 "phytec,pcm030", 56 "phytec,pcm030",
55 "phytec,pcm032", 57 "phytec,pcm032",
56 "promess,motionpro", 58 "promess,motionpro",
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index aca5741ddc67..a86c34b3bb84 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -365,7 +365,7 @@ static int axon_msi_probe(struct of_device *device,
365 printk(KERN_ERR 365 printk(KERN_ERR
366 "axon_msi: couldn't parse dcr properties on %s\n", 366 "axon_msi: couldn't parse dcr properties on %s\n",
367 dn->full_name); 367 dn->full_name);
368 goto out; 368 goto out_free_msic;
369 } 369 }
370 370
371 msic->dcr_host = dcr_map(dn, dcr_base, dcr_len); 371 msic->dcr_host = dcr_map(dn, dcr_base, dcr_len);
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index cc7161ff1666..ce014928d460 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -1,18 +1,9 @@
1EXTRA_CFLAGS += -mno-minimal-toc 1EXTRA_CFLAGS += -mno-minimal-toc
2 2
3extra-y += dt.o
4
5obj-y += exception.o 3obj-y += exception.o
6obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \ 4obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt.o mf.o lpevents.o \
7 hvcall.o proc.o htab.o iommu.o misc.o irq.o 5 hvcall.o proc.o htab.o iommu.o misc.o irq.o
8obj-$(CONFIG_PCI) += pci.o 6obj-$(CONFIG_PCI) += pci.o
9obj-$(CONFIG_SMP) += smp.o 7obj-$(CONFIG_SMP) += smp.o
10obj-$(CONFIG_VIOPATH) += viopath.o vio.o 8obj-$(CONFIG_VIOPATH) += viopath.o vio.o
11obj-$(CONFIG_MODULES) += ksyms.o 9obj-$(CONFIG_MODULES) += ksyms.o
12
13quiet_cmd_dt_strings = DT_STR $@
14 cmd_dt_strings = $(OBJCOPY) --rename-section .rodata.str1.8=.dt_strings \
15 $< $@
16
17$(obj)/dt_mod.o: $(obj)/dt.o
18 $(call if_changed,dt_strings)
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
index c5a87a72057b..7f45a51fe793 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -51,11 +51,16 @@
51 51
52/* 52/*
53 * These are created by the linker script at the start and end 53 * These are created by the linker script at the start and end
54 * of the section containing all the strings from this file. 54 * of the section containing all the strings marked with the DS macro.
55 */ 55 */
56extern char __dt_strings_start[]; 56extern char __dt_strings_start[];
57extern char __dt_strings_end[]; 57extern char __dt_strings_end[];
58 58
59#define DS(s) ({ \
60 static const char __s[] __attribute__((section(".dt_strings"))) = s; \
61 __s; \
62})
63
59struct iseries_flat_dt { 64struct iseries_flat_dt {
60 struct boot_param_header header; 65 struct boot_param_header header;
61 u64 reserve_map[2]; 66 u64 reserve_map[2];
@@ -64,9 +69,8 @@ struct iseries_flat_dt {
64static void * __initdata dt_data; 69static void * __initdata dt_data;
65 70
66/* 71/*
67 * Putting these strings here keeps them out of the section 72 * Putting these strings here keeps them out of the .dt_strings section
68 * that we rename to .dt_strings using objcopy and capture 73 * that we capture for the strings blob of the flattened device tree.
69 * for the strings blob of the flattened device tree.
70 */ 74 */
71static char __initdata device_type_cpu[] = "cpu"; 75static char __initdata device_type_cpu[] = "cpu";
72static char __initdata device_type_memory[] = "memory"; 76static char __initdata device_type_memory[] = "memory";
@@ -173,7 +177,7 @@ static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name)
173 177
174#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE) 178#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
175 179
176static void __init dt_prop(struct iseries_flat_dt *dt, const char *name, 180static void __init __dt_prop(struct iseries_flat_dt *dt, const char *name,
177 const void *data, int len) 181 const void *data, int len)
178{ 182{
179 unsigned long offset; 183 unsigned long offset;
@@ -191,44 +195,32 @@ static void __init dt_prop(struct iseries_flat_dt *dt, const char *name,
191 /* The actual data. */ 195 /* The actual data. */
192 dt_push_bytes(dt, data, len); 196 dt_push_bytes(dt, data, len);
193} 197}
198#define dt_prop(dt, name, data, len) __dt_prop((dt), DS(name), (data), (len))
194 199
195static void __init dt_prop_str(struct iseries_flat_dt *dt, const char *name, 200#define dt_prop_str(dt, name, data) \
196 const char *data) 201 dt_prop((dt), name, (data), strlen((data)) + 1); /* + 1 for NULL */
197{
198 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
199}
200 202
201static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name, 203static void __init __dt_prop_u32(struct iseries_flat_dt *dt, const char *name,
202 u32 data) 204 u32 data)
203{ 205{
204 dt_prop(dt, name, &data, sizeof(u32)); 206 __dt_prop(dt, name, &data, sizeof(u32));
205} 207}
208#define dt_prop_u32(dt, name, data) __dt_prop_u32((dt), DS(name), (data))
206 209
207static void __init __maybe_unused dt_prop_u64(struct iseries_flat_dt *dt, 210static void __init __maybe_unused __dt_prop_u64(struct iseries_flat_dt *dt,
208 const char *name, 211 const char *name, u64 data)
209 u64 data)
210{ 212{
211 dt_prop(dt, name, &data, sizeof(u64)); 213 __dt_prop(dt, name, &data, sizeof(u64));
212} 214}
215#define dt_prop_u64(dt, name, data) __dt_prop_u64((dt), DS(name), (data))
213 216
214static void __init dt_prop_u64_list(struct iseries_flat_dt *dt, 217#define dt_prop_u64_list(dt, name, data, n) \
215 const char *name, u64 *data, int n) 218 dt_prop((dt), name, (data), sizeof(u64) * (n))
216{
217 dt_prop(dt, name, data, sizeof(u64) * n);
218}
219 219
220static void __init dt_prop_u32_list(struct iseries_flat_dt *dt, 220#define dt_prop_u32_list(dt, name, data, n) \
221 const char *name, u32 *data, int n) 221 dt_prop((dt), name, (data), sizeof(u32) * (n))
222{
223 dt_prop(dt, name, data, sizeof(u32) * n);
224}
225 222
226#ifdef notyet 223#define dt_prop_empty(dt, name) dt_prop((dt), name, NULL, 0)
227static void __init dt_prop_empty(struct iseries_flat_dt *dt, const char *name)
228{
229 dt_prop(dt, name, NULL, 0);
230}
231#endif
232 224
233static void __init dt_cpus(struct iseries_flat_dt *dt) 225static void __init dt_cpus(struct iseries_flat_dt *dt)
234{ 226{
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 21226b74c9b2..414ca9849f23 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -540,8 +540,11 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
540 /* Make sure IRQ is disabled */ 540 /* Make sure IRQ is disabled */
541 kw_write_reg(reg_ier, 0); 541 kw_write_reg(reg_ier, 0);
542 542
543 /* Request chip interrupt */ 543 /* Request chip interrupt. We set IRQF_TIMER because we don't
544 if (request_irq(host->irq, kw_i2c_irq, 0, "keywest i2c", host)) 544 * want that interrupt disabled between the 2 passes of driver
545 * suspend or we'll have issues running the pfuncs
546 */
547 if (request_irq(host->irq, kw_i2c_irq, IRQF_TIMER, "keywest i2c", host))
545 host->irq = NO_IRQ; 548 host->irq = NO_IRQ;
546 549
547 printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n", 550 printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n",
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 5a707da3f5c2..0a14d8cd314f 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -51,11 +51,10 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
51 {FW_FEATURE_VIO, "hcall-vio"}, 51 {FW_FEATURE_VIO, "hcall-vio"},
52 {FW_FEATURE_RDMA, "hcall-rdma"}, 52 {FW_FEATURE_RDMA, "hcall-rdma"},
53 {FW_FEATURE_LLAN, "hcall-lLAN"}, 53 {FW_FEATURE_LLAN, "hcall-lLAN"},
54 {FW_FEATURE_BULK, "hcall-bulk"}, 54 {FW_FEATURE_BULK_REMOVE, "hcall-bulk"},
55 {FW_FEATURE_XDABR, "hcall-xdabr"}, 55 {FW_FEATURE_XDABR, "hcall-xdabr"},
56 {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, 56 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
57 {FW_FEATURE_SPLPAR, "hcall-splpar"}, 57 {FW_FEATURE_SPLPAR, "hcall-splpar"},
58 {FW_FEATURE_BULK_REMOVE, "hcall-bulk"},
59}; 58};
60 59
61/* Build up the firmware features bitmask using the contents of 60/* Build up the firmware features bitmask using the contents of
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index c6f0a71b405e..bdbe96c8a7e4 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -517,6 +517,15 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
517 in_xmon = 0; 517 in_xmon = 0;
518#endif 518#endif
519 519
520#ifdef CONFIG_BOOKE
521 if (regs->msr & MSR_DE) {
522 bp = at_breakpoint(regs->nip);
523 if (bp != NULL) {
524 regs->nip = (unsigned long) &bp->instr[0];
525 atomic_inc(&bp->ref_count);
526 }
527 }
528#else
520 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) { 529 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) {
521 bp = at_breakpoint(regs->nip); 530 bp = at_breakpoint(regs->nip);
522 if (bp != NULL) { 531 if (bp != NULL) {
@@ -530,7 +539,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
530 } 539 }
531 } 540 }
532 } 541 }
533 542#endif
534 insert_cpu_bpts(); 543 insert_cpu_bpts();
535 544
536 local_irq_restore(flags); 545 local_irq_restore(flags);
@@ -894,6 +903,14 @@ cmds(struct pt_regs *excp)
894 } 903 }
895} 904}
896 905
906#ifdef CONFIG_BOOKE
907static int do_step(struct pt_regs *regs)
908{
909 regs->msr |= MSR_DE;
910 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
911 return 1;
912}
913#else
897/* 914/*
898 * Step a single instruction. 915 * Step a single instruction.
899 * Some instructions we emulate, others we execute with MSR_SE set. 916 * Some instructions we emulate, others we execute with MSR_SE set.
@@ -924,6 +941,7 @@ static int do_step(struct pt_regs *regs)
924 regs->msr |= MSR_SE; 941 regs->msr |= MSR_SE;
925 return 1; 942 return 1;
926} 943}
944#endif
927 945
928static void bootcmds(void) 946static void bootcmds(void)
929{ 947{
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 24b1244aadb9..f23961ada7fb 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -78,7 +78,7 @@ cputime64_to_jiffies64(cputime64_t cputime)
78static inline unsigned int 78static inline unsigned int
79cputime_to_msecs(const cputime_t cputime) 79cputime_to_msecs(const cputime_t cputime)
80{ 80{
81 return __div(cputime, 4096000); 81 return cputime_div(cputime, 4096000);
82} 82}
83 83
84static inline cputime_t 84static inline cputime_t
@@ -160,7 +160,7 @@ cputime_to_timeval(const cputime_t cputime, struct timeval *value)
160static inline clock_t 160static inline clock_t
161cputime_to_clock_t(cputime_t cputime) 161cputime_to_clock_t(cputime_t cputime)
162{ 162{
163 return __div(cputime, 4096000000ULL / USER_HZ); 163 return cputime_div(cputime, 4096000000ULL / USER_HZ);
164} 164}
165 165
166static inline cputime_t 166static inline cputime_t
@@ -175,7 +175,7 @@ clock_t_to_cputime(unsigned long x)
175static inline clock_t 175static inline clock_t
176cputime64_to_clock_t(cputime64_t cputime) 176cputime64_to_clock_t(cputime64_t cputime)
177{ 177{
178 return __div(cputime, 4096000000ULL / USER_HZ); 178 return cputime_div(cputime, 4096000000ULL / USER_HZ);
179} 179}
180 180
181struct s390_idle_data { 181struct s390_idle_data {
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index ee57a42e6e93..4890ac6d7faa 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -1595,10 +1595,9 @@ static void stop_run(struct shutdown_trigger *trigger)
1595{ 1595{
1596 if (strcmp(trigger->name, ON_PANIC_STR) == 0) 1596 if (strcmp(trigger->name, ON_PANIC_STR) == 0)
1597 disabled_wait((unsigned long) __builtin_return_address(0)); 1597 disabled_wait((unsigned long) __builtin_return_address(0));
1598 else { 1598 while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy)
1599 signal_processor(smp_processor_id(), sigp_stop); 1599 cpu_relax();
1600 for (;;); 1600 for (;;);
1601 }
1602} 1601}
1603 1602
1604static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR, 1603static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR,
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index c932caa5e850..93e52039321b 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -76,7 +76,6 @@ static int cpu_stopped(int cpu)
76 __u32 status; 76 __u32 status;
77 77
78 switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) { 78 switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) {
79 case sigp_order_code_accepted:
80 case sigp_status_stored: 79 case sigp_status_stored:
81 /* Check for stopped and check stop state */ 80 /* Check for stopped and check stop state */
82 if (status & 0x50) 81 if (status & 0x50)
@@ -638,6 +637,8 @@ void __cpu_die(unsigned int cpu)
638 /* Wait until target cpu is down */ 637 /* Wait until target cpu is down */
639 while (!cpu_stopped(cpu)) 638 while (!cpu_stopped(cpu))
640 cpu_relax(); 639 cpu_relax();
640 while (signal_processor_p(0, cpu, sigp_set_prefix) == sigp_busy)
641 udelay(10);
641 smp_free_lowcore(cpu); 642 smp_free_lowcore(cpu);
642 pr_info("Processor %d stopped\n", cpu); 643 pr_info("Processor %d stopped\n", cpu);
643} 644}
@@ -645,8 +646,8 @@ void __cpu_die(unsigned int cpu)
645void cpu_die(void) 646void cpu_die(void)
646{ 647{
647 idle_task_exit(); 648 idle_task_exit();
648 signal_processor(smp_processor_id(), sigp_stop); 649 while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy)
649 BUG(); 650 cpu_relax();
650 for (;;); 651 for (;;);
651} 652}
652 653
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index 7c8653e27db6..0c26cc1898ec 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -199,6 +199,7 @@ pgm_check_entry:
199 brc 2,4b /* busy, try again */ 199 brc 2,4b /* busy, try again */
2005: 2005:
201 sigp %r9,%r2,__SIGP_STOP /* stop resume (current) CPU */ 201 sigp %r9,%r2,__SIGP_STOP /* stop resume (current) CPU */
202 brc 2,5b /* busy, try again */
2026: j 6b 2036: j 6b
203 204
204restart_suspend: 205restart_suspend:
@@ -206,6 +207,7 @@ restart_suspend:
206 llgh %r2,0(%r1) 207 llgh %r2,0(%r1)
2077: 2087:
208 sigp %r9,%r2,__SIGP_SENSE /* Wait for resume CPU */ 209 sigp %r9,%r2,__SIGP_SENSE /* Wait for resume CPU */
210 brc 8,7b /* accepted, status 0, still running */
209 brc 2,7b /* busy, try again */ 211 brc 2,7b /* busy, try again */
210 tmll %r9,0x40 /* Test if resume CPU is stopped */ 212 tmll %r9,0x40 /* Test if resume CPU is stopped */
211 jz 7b 213 jz 7b
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index b940424f8ccc..88cdeb9f72d9 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -37,7 +37,6 @@ config SUPERH32
37 select HAVE_FTRACE_MCOUNT_RECORD 37 select HAVE_FTRACE_MCOUNT_RECORD
38 select HAVE_DYNAMIC_FTRACE 38 select HAVE_DYNAMIC_FTRACE
39 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 39 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
40 select HAVE_FTRACE_SYSCALLS
41 select HAVE_FUNCTION_GRAPH_TRACER 40 select HAVE_FUNCTION_GRAPH_TRACER
42 select HAVE_ARCH_KGDB 41 select HAVE_ARCH_KGDB
43 select ARCH_HIBERNATION_POSSIBLE if MMU 42 select ARCH_HIBERNATION_POSSIBLE if MMU
@@ -122,6 +121,9 @@ config SYS_SUPPORTS_APM_EMULATION
122 bool 121 bool
123 select ARCH_SUSPEND_POSSIBLE 122 select ARCH_SUSPEND_POSSIBLE
124 123
124config SYS_SUPPORTS_HUGETLBFS
125 bool
126
125config SYS_SUPPORTS_SMP 127config SYS_SUPPORTS_SMP
126 bool 128 bool
127 129
@@ -196,6 +198,7 @@ config CPU_SH4
196 select CPU_HAS_SR_RB 198 select CPU_HAS_SR_RB
197 select CPU_HAS_FPU if !CPU_SH4AL_DSP 199 select CPU_HAS_FPU if !CPU_SH4AL_DSP
198 select SYS_SUPPORTS_TMU 200 select SYS_SUPPORTS_TMU
201 select SYS_SUPPORTS_HUGETLBFS if MMU
199 202
200config CPU_SH4A 203config CPU_SH4A
201 bool 204 bool
@@ -210,6 +213,7 @@ config CPU_SH5
210 bool 213 bool
211 select CPU_HAS_FPU 214 select CPU_HAS_FPU
212 select SYS_SUPPORTS_TMU 215 select SYS_SUPPORTS_TMU
216 select SYS_SUPPORTS_HUGETLBFS if MMU
213 217
214config CPU_SHX2 218config CPU_SHX2
215 bool 219 bool
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index fc51a918b31a..66e40aabc600 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -199,7 +199,7 @@ endif
199libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) 199libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
200libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) 200libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
201 201
202BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec \ 202BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec uImage.bin \
203 zImage vmlinux.srec romImage 203 zImage vmlinux.srec romImage
204PHONY += maketools $(BOOT_TARGETS) FORCE 204PHONY += maketools $(BOOT_TARGETS) FORCE
205 205
@@ -225,6 +225,7 @@ define archhelp
225 @echo ' vmlinux.srec - Create an ELF S-record' 225 @echo ' vmlinux.srec - Create an ELF S-record'
226 @echo '* uImage - Alias to bootable U-Boot image' 226 @echo '* uImage - Alias to bootable U-Boot image'
227 @echo ' uImage.srec - Create an S-record for U-Boot' 227 @echo ' uImage.srec - Create an S-record for U-Boot'
228 @echo ' uImage.bin - Kernel-only image for U-Boot (bin)'
228 @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)' 229 @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)'
229 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' 230 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)'
230 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)' 231 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)'
diff --git a/arch/sh/boards/mach-landisk/gio.c b/arch/sh/boards/mach-landisk/gio.c
index 25cdf7358000..528013188196 100644
--- a/arch/sh/boards/mach-landisk/gio.c
+++ b/arch/sh/boards/mach-landisk/gio.c
@@ -14,7 +14,6 @@
14 */ 14 */
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/smp_lock.h>
18#include <linux/kdev_t.h> 17#include <linux/kdev_t.h>
19#include <linux/cdev.h> 18#include <linux/cdev.h>
20#include <linux/fs.h> 19#include <linux/fs.h>
@@ -35,7 +34,7 @@ static int gio_open(struct inode *inode, struct file *filp)
35 int minor; 34 int minor;
36 int ret = -ENOENT; 35 int ret = -ENOENT;
37 36
38 lock_kernel(); 37 preempt_disable();
39 minor = MINOR(inode->i_rdev); 38 minor = MINOR(inode->i_rdev);
40 if (minor < DEVCOUNT) { 39 if (minor < DEVCOUNT) {
41 if (openCnt > 0) { 40 if (openCnt > 0) {
@@ -45,7 +44,7 @@ static int gio_open(struct inode *inode, struct file *filp)
45 ret = 0; 44 ret = 0;
46 } 45 }
47 } 46 }
48 unlock_kernel(); 47 preempt_enable();
49 return ret; 48 return ret;
50} 49}
51 50
@@ -60,8 +59,7 @@ static int gio_close(struct inode *inode, struct file *filp)
60 return 0; 59 return 0;
61} 60}
62 61
63static int gio_ioctl(struct inode *inode, struct file *filp, 62static long gio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
64 unsigned int cmd, unsigned long arg)
65{ 63{
66 unsigned int data; 64 unsigned int data;
67 static unsigned int addr = 0; 65 static unsigned int addr = 0;
@@ -129,7 +127,7 @@ static const struct file_operations gio_fops = {
129 .owner = THIS_MODULE, 127 .owner = THIS_MODULE,
130 .open = gio_open, /* open */ 128 .open = gio_open, /* open */
131 .release = gio_close, /* release */ 129 .release = gio_close, /* release */
132 .ioctl = gio_ioctl, /* ioctl */ 130 .unlocked_ioctl = gio_ioctl,
133}; 131};
134 132
135static int __init gio_init(void) 133static int __init gio_init(void)
diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c
index 4af3a771c058..c37617e63220 100644
--- a/arch/sh/boards/mach-rsk/devices-rsk7203.c
+++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c
@@ -11,10 +11,6 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/map.h>
18#include <linux/smsc911x.h> 14#include <linux/smsc911x.h>
19#include <linux/gpio.h> 15#include <linux/gpio.h>
20#include <linux/leds.h> 16#include <linux/leds.h>
diff --git a/arch/sh/boards/mach-rsk/setup.c b/arch/sh/boards/mach-rsk/setup.c
index af64d030a5c7..a5c0df785bfe 100644
--- a/arch/sh/boards/mach-rsk/setup.c
+++ b/arch/sh/boards/mach-rsk/setup.c
@@ -15,14 +15,12 @@
15#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
16#include <linux/mtd/partitions.h> 16#include <linux/mtd/partitions.h>
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#ifdef CONFIG_MTD
18#include <linux/mtd/map.h> 19#include <linux/mtd/map.h>
20#endif
19#include <asm/machvec.h> 21#include <asm/machvec.h>
20#include <asm/io.h> 22#include <asm/io.h>
21 23
22static const char *probes[] = { "cmdlinepart", NULL };
23
24static struct mtd_partition *parsed_partitions;
25
26static struct mtd_partition rsk_partitions[] = { 24static struct mtd_partition rsk_partitions[] = {
27 { 25 {
28 .name = "Bootloader", 26 .name = "Bootloader",
@@ -41,6 +39,8 @@ static struct mtd_partition rsk_partitions[] = {
41}; 39};
42 40
43static struct physmap_flash_data flash_data = { 41static struct physmap_flash_data flash_data = {
42 .parts = rsk_partitions,
43 .nr_parts = ARRAY_SIZE(rsk_partitions),
44 .width = 2, 44 .width = 2,
45}; 45};
46 46
@@ -60,7 +60,8 @@ static struct platform_device flash_device = {
60 }, 60 },
61}; 61};
62 62
63static struct mtd_info *flash_mtd; 63#ifdef CONFIG_MTD
64static const char *probes[] = { "cmdlinepart", NULL };
64 65
65static struct map_info rsk_flash_map = { 66static struct map_info rsk_flash_map = {
66 .name = "RSK+ Flash", 67 .name = "RSK+ Flash",
@@ -68,6 +69,10 @@ static struct map_info rsk_flash_map = {
68 .bankwidth = 2, 69 .bankwidth = 2,
69}; 70};
70 71
72static struct mtd_info *flash_mtd;
73
74static struct mtd_partition *parsed_partitions;
75
71static void __init set_mtd_partitions(void) 76static void __init set_mtd_partitions(void)
72{ 77{
73 int nr_parts = 0; 78 int nr_parts = 0;
@@ -77,14 +82,14 @@ static void __init set_mtd_partitions(void)
77 nr_parts = parse_mtd_partitions(flash_mtd, probes, 82 nr_parts = parse_mtd_partitions(flash_mtd, probes,
78 &parsed_partitions, 0); 83 &parsed_partitions, 0);
79 /* If there is no partition table, used the hard coded table */ 84 /* If there is no partition table, used the hard coded table */
80 if (nr_parts <= 0) { 85 if (nr_parts > 0) {
81 flash_data.parts = rsk_partitions;
82 flash_data.nr_parts = ARRAY_SIZE(rsk_partitions);
83 } else {
84 flash_data.nr_parts = nr_parts; 86 flash_data.nr_parts = nr_parts;
85 flash_data.parts = parsed_partitions; 87 flash_data.parts = parsed_partitions;
86 } 88 }
87} 89}
90#else
91static inline void set_mtd_partitions(void) {}
92#endif
88 93
89static struct platform_device *rsk_devices[] __initdata = { 94static struct platform_device *rsk_devices[] __initdata = {
90 &flash_device, 95 &flash_device,
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index a1316872be6f..cb8cf5572e79 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -20,11 +20,12 @@ CONFIG_BOOT_LINK_OFFSET ?= 0x00800000
20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000 20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000
21CONFIG_ENTRY_OFFSET ?= 0x00001000 21CONFIG_ENTRY_OFFSET ?= 0x00001000
22 22
23suffix-y := bin
23suffix-$(CONFIG_KERNEL_GZIP) := gz 24suffix-$(CONFIG_KERNEL_GZIP) := gz
24suffix-$(CONFIG_KERNEL_BZIP2) := bz2 25suffix-$(CONFIG_KERNEL_BZIP2) := bz2
25suffix-$(CONFIG_KERNEL_LZMA) := lzma 26suffix-$(CONFIG_KERNEL_LZMA) := lzma
26 27
27targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma 28targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma uImage.bin
28extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma 29extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma
29subdir- := compressed romimage 30subdir- := compressed romimage
30 31
@@ -88,6 +89,9 @@ $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
88$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma 89$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
89 $(call if_changed,uimage,lzma) 90 $(call if_changed,uimage,lzma)
90 91
92$(obj)/uImage.bin: $(obj)/vmlinux.bin
93 $(call if_changed,uimage,none)
94
91OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec 95OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
92$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux 96$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
93 $(call if_changed,objcopy) 97 $(call if_changed,objcopy)
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 03b3616c80a5..2d07084e4882 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -20,6 +20,7 @@
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/mempool.h> 21#include <linux/mempool.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/ftrace.h>
23#include <asm/dwarf.h> 24#include <asm/dwarf.h>
24#include <asm/unwinder.h> 25#include <asm/unwinder.h>
25#include <asm/sections.h> 26#include <asm/sections.h>
@@ -557,6 +558,27 @@ struct dwarf_frame * dwarf_unwind_stack(unsigned long pc,
557 if (!pc && !prev) 558 if (!pc && !prev)
558 pc = (unsigned long)current_text_addr(); 559 pc = (unsigned long)current_text_addr();
559 560
561#ifdef CONFIG_FUNCTION_GRAPH_TRACER
562 /*
563 * If our stack has been patched by the function graph tracer
564 * then we might see the address of return_to_handler() where we
565 * expected to find the real return address.
566 */
567 if (pc == (unsigned long)&return_to_handler) {
568 int index = current->curr_ret_stack;
569
570 /*
571 * We currently have no way of tracking how many
572 * return_to_handler()'s we've seen. If there is more
573 * than one patched return address on our stack,
574 * complain loudly.
575 */
576 WARN_ON(index > 0);
577
578 pc = current->ret_stack[index].ret;
579 }
580#endif
581
560 frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC); 582 frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC);
561 if (!frame) { 583 if (!frame) {
562 printk(KERN_ERR "Unable to allocate a dwarf frame\n"); 584 printk(KERN_ERR "Unable to allocate a dwarf frame\n");
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 7cb933ba4957..eac7da772fc2 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel_stat.h> 12#include <linux/kernel_stat.h>
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/ftrace.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
15#include <asm/machvec.h> 16#include <asm/machvec.h>
16#include <asm/uaccess.h> 17#include <asm/uaccess.h>
@@ -106,7 +107,7 @@ static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
106static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly; 107static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
107#endif 108#endif
108 109
109asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs) 110asmlinkage __irq_entry int do_IRQ(unsigned int irq, struct pt_regs *regs)
110{ 111{
111 struct pt_regs *old_regs = set_irq_regs(regs); 112 struct pt_regs *old_regs = set_irq_regs(regs);
112#ifdef CONFIG_IRQSTACKS 113#ifdef CONFIG_IRQSTACKS
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c
index 86c270428357..444cce3ae921 100644
--- a/arch/sh/kernel/sh_ksyms_32.c
+++ b/arch/sh/kernel/sh_ksyms_32.c
@@ -85,6 +85,20 @@ DECLARE_EXPORT(__movstr_i4_even);
85DECLARE_EXPORT(__movstr_i4_odd); 85DECLARE_EXPORT(__movstr_i4_odd);
86DECLARE_EXPORT(__movstrSI12_i4); 86DECLARE_EXPORT(__movstrSI12_i4);
87DECLARE_EXPORT(__movmem); 87DECLARE_EXPORT(__movmem);
88DECLARE_EXPORT(__movmemSI8);
89DECLARE_EXPORT(__movmemSI12);
90DECLARE_EXPORT(__movmemSI16);
91DECLARE_EXPORT(__movmemSI20);
92DECLARE_EXPORT(__movmemSI24);
93DECLARE_EXPORT(__movmemSI28);
94DECLARE_EXPORT(__movmemSI32);
95DECLARE_EXPORT(__movmemSI36);
96DECLARE_EXPORT(__movmemSI40);
97DECLARE_EXPORT(__movmemSI44);
98DECLARE_EXPORT(__movmemSI48);
99DECLARE_EXPORT(__movmemSI52);
100DECLARE_EXPORT(__movmemSI56);
101DECLARE_EXPORT(__movmemSI60);
88DECLARE_EXPORT(__movmem_i4_even); 102DECLARE_EXPORT(__movmem_i4_even);
89DECLARE_EXPORT(__movmem_i4_odd); 103DECLARE_EXPORT(__movmem_i4_odd);
90DECLARE_EXPORT(__movmemSI12_i4); 104DECLARE_EXPORT(__movmemSI12_i4);
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 64dc1ad59801..7f7b52f9beba 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -227,7 +227,7 @@ endchoice
227 227
228choice 228choice
229 prompt "HugeTLB page size" 229 prompt "HugeTLB page size"
230 depends on HUGETLB_PAGE && (CPU_SH4 || CPU_SH5) && MMU 230 depends on HUGETLB_PAGE
231 default HUGETLB_PAGE_SIZE_1MB if PAGE_SIZE_64KB 231 default HUGETLB_PAGE_SIZE_1MB if PAGE_SIZE_64KB
232 default HUGETLB_PAGE_SIZE_64K 232 default HUGETLB_PAGE_SIZE_64K
233 233
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index a98c7d8984fa..519e2d16cd06 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -26,7 +26,7 @@
26#define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */ 26#define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */
27#define MAX_ICACHE_PAGES 32 27#define MAX_ICACHE_PAGES 32
28 28
29static void __flush_cache_4096(unsigned long addr, unsigned long phys, 29static void __flush_cache_one(unsigned long addr, unsigned long phys,
30 unsigned long exec_offset); 30 unsigned long exec_offset);
31 31
32/* 32/*
@@ -89,8 +89,7 @@ static void __uses_jump_to_uncached sh4_flush_icache_range(void *args)
89 local_irq_restore(flags); 89 local_irq_restore(flags);
90} 90}
91 91
92static inline void flush_cache_4096(unsigned long start, 92static inline void flush_cache_one(unsigned long start, unsigned long phys)
93 unsigned long phys)
94{ 93{
95 unsigned long flags, exec_offset = 0; 94 unsigned long flags, exec_offset = 0;
96 95
@@ -103,8 +102,7 @@ static inline void flush_cache_4096(unsigned long start,
103 exec_offset = 0x20000000; 102 exec_offset = 0x20000000;
104 103
105 local_irq_save(flags); 104 local_irq_save(flags);
106 __flush_cache_4096(start | SH_CACHE_ASSOC, 105 __flush_cache_one(start | SH_CACHE_ASSOC, P1SEGADDR(phys), exec_offset);
107 P1SEGADDR(phys), exec_offset);
108 local_irq_restore(flags); 106 local_irq_restore(flags);
109} 107}
110 108
@@ -129,8 +127,8 @@ static void sh4_flush_dcache_page(void *arg)
129 127
130 /* Loop all the D-cache */ 128 /* Loop all the D-cache */
131 n = boot_cpu_data.dcache.n_aliases; 129 n = boot_cpu_data.dcache.n_aliases;
132 for (i = 0; i < n; i++, addr += 4096) 130 for (i = 0; i < n; i++, addr += PAGE_SIZE)
133 flush_cache_4096(addr, phys); 131 flush_cache_one(addr, phys);
134 } 132 }
135 133
136 wmb(); 134 wmb();
@@ -318,11 +316,11 @@ static void sh4_flush_cache_page(void *args)
318 /* We only need to flush D-cache when we have alias */ 316 /* We only need to flush D-cache when we have alias */
319 if ((address^phys) & alias_mask) { 317 if ((address^phys) & alias_mask) {
320 /* Loop 4K of the D-cache */ 318 /* Loop 4K of the D-cache */
321 flush_cache_4096( 319 flush_cache_one(
322 CACHE_OC_ADDRESS_ARRAY | (address & alias_mask), 320 CACHE_OC_ADDRESS_ARRAY | (address & alias_mask),
323 phys); 321 phys);
324 /* Loop another 4K of the D-cache */ 322 /* Loop another 4K of the D-cache */
325 flush_cache_4096( 323 flush_cache_one(
326 CACHE_OC_ADDRESS_ARRAY | (phys & alias_mask), 324 CACHE_OC_ADDRESS_ARRAY | (phys & alias_mask),
327 phys); 325 phys);
328 } 326 }
@@ -337,7 +335,7 @@ static void sh4_flush_cache_page(void *args)
337 * kernel has never executed the code through its identity 335 * kernel has never executed the code through its identity
338 * translation. 336 * translation.
339 */ 337 */
340 flush_cache_4096( 338 flush_cache_one(
341 CACHE_IC_ADDRESS_ARRAY | (address & alias_mask), 339 CACHE_IC_ADDRESS_ARRAY | (address & alias_mask),
342 phys); 340 phys);
343 } 341 }
@@ -393,7 +391,7 @@ static void sh4_flush_cache_range(void *args)
393} 391}
394 392
395/** 393/**
396 * __flush_cache_4096 394 * __flush_cache_one
397 * 395 *
398 * @addr: address in memory mapped cache array 396 * @addr: address in memory mapped cache array
399 * @phys: P1 address to flush (has to match tags if addr has 'A' bit 397 * @phys: P1 address to flush (has to match tags if addr has 'A' bit
@@ -406,7 +404,7 @@ static void sh4_flush_cache_range(void *args)
406 * operation (purge/write-back) is selected by the lower 2 bits of 404 * operation (purge/write-back) is selected by the lower 2 bits of
407 * 'phys'. 405 * 'phys'.
408 */ 406 */
409static void __flush_cache_4096(unsigned long addr, unsigned long phys, 407static void __flush_cache_one(unsigned long addr, unsigned long phys,
410 unsigned long exec_offset) 408 unsigned long exec_offset)
411{ 409{
412 int way_count; 410 int way_count;
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index 5e1091be9dc4..a2dc7f9ecc51 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -265,6 +265,8 @@ static void __init emit_cache_params(void)
265 265
266void __init cpu_cache_init(void) 266void __init cpu_cache_init(void)
267{ 267{
268 unsigned int cache_disabled = !(__raw_readl(CCR) & CCR_CACHE_ENABLE);
269
268 compute_alias(&boot_cpu_data.icache); 270 compute_alias(&boot_cpu_data.icache);
269 compute_alias(&boot_cpu_data.dcache); 271 compute_alias(&boot_cpu_data.dcache);
270 compute_alias(&boot_cpu_data.scache); 272 compute_alias(&boot_cpu_data.scache);
@@ -273,6 +275,13 @@ void __init cpu_cache_init(void)
273 __flush_purge_region = noop__flush_region; 275 __flush_purge_region = noop__flush_region;
274 __flush_invalidate_region = noop__flush_region; 276 __flush_invalidate_region = noop__flush_region;
275 277
278 /*
279 * No flushing is necessary in the disabled cache case so we can
280 * just keep the noop functions in local_flush_..() and __flush_..()
281 */
282 if (unlikely(cache_disabled))
283 goto skip;
284
276 if (boot_cpu_data.family == CPU_FAMILY_SH2) { 285 if (boot_cpu_data.family == CPU_FAMILY_SH2) {
277 extern void __weak sh2_cache_init(void); 286 extern void __weak sh2_cache_init(void);
278 287
@@ -312,5 +321,6 @@ void __init cpu_cache_init(void)
312 sh5_cache_init(); 321 sh5_cache_init();
313 } 322 }
314 323
324skip:
315 emit_cache_params(); 325 emit_cache_params();
316} 326}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 07e01149e3bf..72ace9515a07 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1443,12 +1443,8 @@ config SECCOMP
1443 1443
1444 If unsure, say Y. Only embedded should say N here. 1444 If unsure, say Y. Only embedded should say N here.
1445 1445
1446config CC_STACKPROTECTOR_ALL
1447 bool
1448
1449config CC_STACKPROTECTOR 1446config CC_STACKPROTECTOR
1450 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" 1447 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
1451 select CC_STACKPROTECTOR_ALL
1452 ---help--- 1448 ---help---
1453 This option turns on the -fstack-protector GCC feature. This 1449 This option turns on the -fstack-protector GCC feature. This
1454 feature puts, at the beginning of functions, a canary value on 1450 feature puts, at the beginning of functions, a canary value on
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index f2824fb8c79c..2649840d888f 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -400,7 +400,7 @@ config X86_TSC
400 400
401config X86_CMPXCHG64 401config X86_CMPXCHG64
402 def_bool y 402 def_bool y
403 depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MATOM 403 depends on !M386 && !M486
404 404
405# this should be set for all -march=.. options where the compiler 405# this should be set for all -march=.. options where the compiler
406# generates cmov. 406# generates cmov.
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index a012ee8ef803..d2d24c9ee64d 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -76,7 +76,6 @@ ifdef CONFIG_CC_STACKPROTECTOR
76 cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh 76 cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh
77 ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(biarch)),y) 77 ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(biarch)),y)
78 stackp-y := -fstack-protector 78 stackp-y := -fstack-protector
79 stackp-$(CONFIG_CC_STACKPROTECTOR_ALL) += -fstack-protector-all
80 KBUILD_CFLAGS += $(stackp-y) 79 KBUILD_CFLAGS += $(stackp-y)
81 else 80 else
82 $(warning stack protector enabled but no compiler support) 81 $(warning stack protector enabled but no compiler support)
diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld
index 0f6ec455a2b1..03c0683636b6 100644
--- a/arch/x86/boot/setup.ld
+++ b/arch/x86/boot/setup.ld
@@ -53,6 +53,9 @@ SECTIONS
53 53
54 /DISCARD/ : { *(.note*) } 54 /DISCARD/ : { *(.note*) }
55 55
56 /*
57 * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
58 */
56 . = ASSERT(_end <= 0x8000, "Setup too big!"); 59 . = ASSERT(_end <= 0x8000, "Setup too big!");
57 . = ASSERT(hdr == 0x1f1, "The setup header has the wrong offset!"); 60 . = ASSERT(hdr == 0x1f1, "The setup header has the wrong offset!");
58 /* Necessary for the very-old-loader check to work... */ 61 /* Necessary for the very-old-loader check to work... */
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 585edebe12cf..49c552c060e9 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -82,7 +82,7 @@ static int aes_set_key_common(struct crypto_tfm *tfm, void *raw_ctx,
82 return -EINVAL; 82 return -EINVAL;
83 } 83 }
84 84
85 if (irq_fpu_usable()) 85 if (!irq_fpu_usable())
86 err = crypto_aes_expand_key(ctx, in_key, key_len); 86 err = crypto_aes_expand_key(ctx, in_key, key_len);
87 else { 87 else {
88 kernel_fpu_begin(); 88 kernel_fpu_begin();
@@ -103,7 +103,7 @@ static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
103{ 103{
104 struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); 104 struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm));
105 105
106 if (irq_fpu_usable()) 106 if (!irq_fpu_usable())
107 crypto_aes_encrypt_x86(ctx, dst, src); 107 crypto_aes_encrypt_x86(ctx, dst, src);
108 else { 108 else {
109 kernel_fpu_begin(); 109 kernel_fpu_begin();
@@ -116,7 +116,7 @@ static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
116{ 116{
117 struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); 117 struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm));
118 118
119 if (irq_fpu_usable()) 119 if (!irq_fpu_usable())
120 crypto_aes_decrypt_x86(ctx, dst, src); 120 crypto_aes_decrypt_x86(ctx, dst, src);
121 else { 121 else {
122 kernel_fpu_begin(); 122 kernel_fpu_begin();
@@ -342,7 +342,7 @@ static int ablk_encrypt(struct ablkcipher_request *req)
342 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); 342 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req);
343 struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); 343 struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm);
344 344
345 if (irq_fpu_usable()) { 345 if (!irq_fpu_usable()) {
346 struct ablkcipher_request *cryptd_req = 346 struct ablkcipher_request *cryptd_req =
347 ablkcipher_request_ctx(req); 347 ablkcipher_request_ctx(req);
348 memcpy(cryptd_req, req, sizeof(*req)); 348 memcpy(cryptd_req, req, sizeof(*req));
@@ -363,7 +363,7 @@ static int ablk_decrypt(struct ablkcipher_request *req)
363 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); 363 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req);
364 struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); 364 struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm);
365 365
366 if (irq_fpu_usable()) { 366 if (!irq_fpu_usable()) {
367 struct ablkcipher_request *cryptd_req = 367 struct ablkcipher_request *cryptd_req =
368 ablkcipher_request_ctx(req); 368 ablkcipher_request_ctx(req);
369 memcpy(cryptd_req, req, sizeof(*req)); 369 memcpy(cryptd_req, req, sizeof(*req));
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 1733f9f65e82..581b0568fe19 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -204,7 +204,7 @@ sysexit_from_sys_call:
204 movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ 204 movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */
205 .endm 205 .endm
206 206
207 .macro auditsys_exit exit,ebpsave=RBP 207 .macro auditsys_exit exit
208 testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10) 208 testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
209 jnz ia32_ret_from_sys_call 209 jnz ia32_ret_from_sys_call
210 TRACE_IRQS_ON 210 TRACE_IRQS_ON
@@ -217,7 +217,6 @@ sysexit_from_sys_call:
217 call audit_syscall_exit 217 call audit_syscall_exit
218 GET_THREAD_INFO(%r10) 218 GET_THREAD_INFO(%r10)
219 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */ 219 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */
220 movl \ebpsave-ARGOFFSET(%rsp),%ebp /* reload user register value */
221 movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi 220 movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
222 cli 221 cli
223 TRACE_IRQS_OFF 222 TRACE_IRQS_OFF
@@ -351,7 +350,7 @@ cstar_auditsys:
351 jmp cstar_dispatch 350 jmp cstar_dispatch
352 351
353sysretl_audit: 352sysretl_audit:
354 auditsys_exit sysretl_from_sys_call, RCX /* user %ebp in RCX slot */ 353 auditsys_exit sysretl_from_sys_call
355#endif 354#endif
356 355
357cstar_tracesys: 356cstar_tracesys:
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 25a92842dd99..d823c245f63b 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -143,6 +143,7 @@ extern unsigned long node_remap_size[];
143 | 1*SD_BALANCE_FORK \ 143 | 1*SD_BALANCE_FORK \
144 | 0*SD_BALANCE_WAKE \ 144 | 0*SD_BALANCE_WAKE \
145 | 1*SD_WAKE_AFFINE \ 145 | 1*SD_WAKE_AFFINE \
146 | 1*SD_PREFER_LOCAL \
146 | 0*SD_SHARE_CPUPOWER \ 147 | 0*SD_SHARE_CPUPOWER \
147 | 0*SD_POWERSAVINGS_BALANCE \ 148 | 0*SD_POWERSAVINGS_BALANCE \
148 | 0*SD_SHARE_PKG_RESOURCES \ 149 | 0*SD_SHARE_PKG_RESOURCES \
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index 04eb6c958b9d..d1414af98559 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -19,6 +19,8 @@
19#include <asm/types.h> 19#include <asm/types.h>
20#include <asm/percpu.h> 20#include <asm/percpu.h>
21#include <asm/uv/uv_mmrs.h> 21#include <asm/uv/uv_mmrs.h>
22#include <asm/irq_vectors.h>
23#include <asm/io_apic.h>
22 24
23 25
24/* 26/*
@@ -114,7 +116,7 @@
114/* 116/*
115 * The largest possible NASID of a C or M brick (+ 2) 117 * The largest possible NASID of a C or M brick (+ 2)
116 */ 118 */
117#define UV_MAX_NASID_VALUE (UV_MAX_NUMALINK_NODES * 2) 119#define UV_MAX_NASID_VALUE (UV_MAX_NUMALINK_BLADES * 2)
118 120
119struct uv_scir_s { 121struct uv_scir_s {
120 struct timer_list timer; 122 struct timer_list timer;
@@ -230,6 +232,20 @@ static inline unsigned long uv_gpa(void *v)
230 return uv_soc_phys_ram_to_gpa(__pa(v)); 232 return uv_soc_phys_ram_to_gpa(__pa(v));
231} 233}
232 234
235/* gnode -> pnode */
236static inline unsigned long uv_gpa_to_gnode(unsigned long gpa)
237{
238 return gpa >> uv_hub_info->m_val;
239}
240
241/* gpa -> pnode */
242static inline int uv_gpa_to_pnode(unsigned long gpa)
243{
244 unsigned long n_mask = (1UL << uv_hub_info->n_val) - 1;
245
246 return uv_gpa_to_gnode(gpa) & n_mask;
247}
248
233/* pnode, offset --> socket virtual */ 249/* pnode, offset --> socket virtual */
234static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset) 250static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
235{ 251{
@@ -421,9 +437,14 @@ static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
421static inline void uv_hub_send_ipi(int pnode, int apicid, int vector) 437static inline void uv_hub_send_ipi(int pnode, int apicid, int vector)
422{ 438{
423 unsigned long val; 439 unsigned long val;
440 unsigned long dmode = dest_Fixed;
441
442 if (vector == NMI_VECTOR)
443 dmode = dest_NMI;
424 444
425 val = (1UL << UVH_IPI_INT_SEND_SHFT) | 445 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
426 ((apicid) << UVH_IPI_INT_APIC_ID_SHFT) | 446 ((apicid) << UVH_IPI_INT_APIC_ID_SHFT) |
447 (dmode << UVH_IPI_INT_DELIVERY_MODE_SHFT) |
427 (vector << UVH_IPI_INT_VECTOR_SHFT); 448 (vector << UVH_IPI_INT_VECTOR_SHFT);
428 uv_write_global_mmr64(pnode, UVH_IPI_INT, val); 449 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
429} 450}
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.lds.S b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
index 0e50e1e5c573..060fff8f5c5b 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.lds.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
@@ -56,6 +56,9 @@ SECTIONS
56 /DISCARD/ : { 56 /DISCARD/ : {
57 *(.note*) 57 *(.note*)
58 } 58 }
59}
60 59
61ASSERT(_end <= WAKEUP_SIZE, "Wakeup too big!"); 60 /*
61 * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
62 */
63 . = ASSERT(_end <= WAKEUP_SIZE, "Wakeup too big!");
64}
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index f5f5886a6b53..326c25477d3d 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -352,14 +352,14 @@ static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
352 352
353 for (i = 0; i < ARRAY_SIZE(redir_addrs); i++) { 353 for (i = 0; i < ARRAY_SIZE(redir_addrs); i++) {
354 alias.v = uv_read_local_mmr(redir_addrs[i].alias); 354 alias.v = uv_read_local_mmr(redir_addrs[i].alias);
355 if (alias.s.base == 0) { 355 if (alias.s.enable && alias.s.base == 0) {
356 *size = (1UL << alias.s.m_alias); 356 *size = (1UL << alias.s.m_alias);
357 redirect.v = uv_read_local_mmr(redir_addrs[i].redirect); 357 redirect.v = uv_read_local_mmr(redir_addrs[i].redirect);
358 *base = (unsigned long)redirect.s.dest_base << DEST_SHIFT; 358 *base = (unsigned long)redirect.s.dest_base << DEST_SHIFT;
359 return; 359 return;
360 } 360 }
361 } 361 }
362 BUG(); 362 *base = *size = 0;
363} 363}
364 364
365enum map_type {map_wb, map_uc}; 365enum map_type {map_wb, map_uc};
@@ -619,12 +619,12 @@ void __init uv_system_init(void)
619 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base; 619 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base;
620 uv_cpu_hub_info(cpu)->lowmem_remap_top = lowmem_redir_size; 620 uv_cpu_hub_info(cpu)->lowmem_remap_top = lowmem_redir_size;
621 uv_cpu_hub_info(cpu)->m_val = m_val; 621 uv_cpu_hub_info(cpu)->m_val = m_val;
622 uv_cpu_hub_info(cpu)->n_val = m_val; 622 uv_cpu_hub_info(cpu)->n_val = n_val;
623 uv_cpu_hub_info(cpu)->numa_blade_id = blade; 623 uv_cpu_hub_info(cpu)->numa_blade_id = blade;
624 uv_cpu_hub_info(cpu)->blade_processor_id = lcpu; 624 uv_cpu_hub_info(cpu)->blade_processor_id = lcpu;
625 uv_cpu_hub_info(cpu)->pnode = pnode; 625 uv_cpu_hub_info(cpu)->pnode = pnode;
626 uv_cpu_hub_info(cpu)->pnode_mask = pnode_mask; 626 uv_cpu_hub_info(cpu)->pnode_mask = pnode_mask;
627 uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1; 627 uv_cpu_hub_info(cpu)->gpa_mask = (1UL << (m_val + n_val)) - 1;
628 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper; 628 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
629 uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra; 629 uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra;
630 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base; 630 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index b1598a9436d0..721a77ca8115 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1214,7 +1214,8 @@ static int __cpuinit mce_cap_init(void)
1214 rdmsrl(MSR_IA32_MCG_CAP, cap); 1214 rdmsrl(MSR_IA32_MCG_CAP, cap);
1215 1215
1216 b = cap & MCG_BANKCNT_MASK; 1216 b = cap & MCG_BANKCNT_MASK;
1217 printk(KERN_INFO "mce: CPU supports %d MCE banks\n", b); 1217 if (!banks)
1218 printk(KERN_INFO "mce: CPU supports %d MCE banks\n", b);
1218 1219
1219 if (b > MAX_NR_BANKS) { 1220 if (b > MAX_NR_BANKS) {
1220 printk(KERN_WARNING 1221 printk(KERN_WARNING
diff --git a/arch/x86/kernel/crash_dump_32.c b/arch/x86/kernel/crash_dump_32.c
index f7cdb3b457aa..cd97ce18c29d 100644
--- a/arch/x86/kernel/crash_dump_32.c
+++ b/arch/x86/kernel/crash_dump_32.c
@@ -16,6 +16,22 @@ static void *kdump_buf_page;
16/* Stores the physical address of elf header of crash image. */ 16/* Stores the physical address of elf header of crash image. */
17unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; 17unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
18 18
19static inline bool is_crashed_pfn_valid(unsigned long pfn)
20{
21#ifndef CONFIG_X86_PAE
22 /*
23 * non-PAE kdump kernel executed from a PAE one will crop high pte
24 * bits and poke unwanted space counting again from address 0, we
25 * don't want that. pte must fit into unsigned long. In fact the
26 * test checks high 12 bits for being zero (pfn will be shifted left
27 * by PAGE_SHIFT).
28 */
29 return pte_pfn(pfn_pte(pfn, __pgprot(0))) == pfn;
30#else
31 return true;
32#endif
33}
34
19/** 35/**
20 * copy_oldmem_page - copy one page from "oldmem" 36 * copy_oldmem_page - copy one page from "oldmem"
21 * @pfn: page frame number to be copied 37 * @pfn: page frame number to be copied
@@ -41,6 +57,9 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
41 if (!csize) 57 if (!csize)
42 return 0; 58 return 0;
43 59
60 if (!is_crashed_pfn_valid(pfn))
61 return -EFAULT;
62
44 vaddr = kmap_atomic_pfn(pfn, KM_PTE0); 63 vaddr = kmap_atomic_pfn(pfn, KM_PTE0);
45 64
46 if (!userbuf) { 65 if (!userbuf) {
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index ad5bd988fb79..cdcfb122f256 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -454,8 +454,10 @@ void __init efi_init(void)
454 if (add_efi_memmap) 454 if (add_efi_memmap)
455 do_add_efi_memmap(); 455 do_add_efi_memmap();
456 456
457#ifdef CONFIG_X86_32
457 x86_platform.get_wallclock = efi_get_time; 458 x86_platform.get_wallclock = efi_get_time;
458 x86_platform.set_wallclock = efi_set_rtc_mmss; 459 x86_platform.set_wallclock = efi_set_rtc_mmss;
460#endif
459 461
460 /* Setup for EFI runtime service */ 462 /* Setup for EFI runtime service */
461 reboot_type = BOOT_EFI; 463 reboot_type = BOOT_EFI;
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 74656d1d4e30..04bbd5278568 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -63,10 +63,10 @@ static int show_other_interrupts(struct seq_file *p, int prec)
63 for_each_online_cpu(j) 63 for_each_online_cpu(j)
64 seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); 64 seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count);
65 seq_printf(p, " Spurious interrupts\n"); 65 seq_printf(p, " Spurious interrupts\n");
66 seq_printf(p, "%*s: ", prec, "CNT"); 66 seq_printf(p, "%*s: ", prec, "PMI");
67 for_each_online_cpu(j) 67 for_each_online_cpu(j)
68 seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs); 68 seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs);
69 seq_printf(p, " Performance counter interrupts\n"); 69 seq_printf(p, " Performance monitoring interrupts\n");
70 seq_printf(p, "%*s: ", prec, "PND"); 70 seq_printf(p, "%*s: ", prec, "PND");
71 for_each_online_cpu(j) 71 for_each_online_cpu(j)
72 seq_printf(p, "%10u ", irq_stats(j)->apic_pending_irqs); 72 seq_printf(p, "%10u ", irq_stats(j)->apic_pending_irqs);
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 503c1f2e8835..1740c85e24bb 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -23,8 +23,6 @@
23static struct bau_control **uv_bau_table_bases __read_mostly; 23static struct bau_control **uv_bau_table_bases __read_mostly;
24static int uv_bau_retry_limit __read_mostly; 24static int uv_bau_retry_limit __read_mostly;
25 25
26/* position of pnode (which is nasid>>1): */
27static int uv_nshift __read_mostly;
28/* base pnode in this partition */ 26/* base pnode in this partition */
29static int uv_partition_base_pnode __read_mostly; 27static int uv_partition_base_pnode __read_mostly;
30 28
@@ -723,7 +721,7 @@ uv_activation_descriptor_init(int node, int pnode)
723 BUG_ON(!adp); 721 BUG_ON(!adp);
724 722
725 pa = uv_gpa(adp); /* need the real nasid*/ 723 pa = uv_gpa(adp); /* need the real nasid*/
726 n = pa >> uv_nshift; 724 n = uv_gpa_to_pnode(pa);
727 m = pa & uv_mmask; 725 m = pa & uv_mmask;
728 726
729 uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE, 727 uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE,
@@ -778,7 +776,7 @@ uv_payload_queue_init(int node, int pnode, struct bau_control *bau_tablesp)
778 * need the pnode of where the memory was really allocated 776 * need the pnode of where the memory was really allocated
779 */ 777 */
780 pa = uv_gpa(pqp); 778 pa = uv_gpa(pqp);
781 pn = pa >> uv_nshift; 779 pn = uv_gpa_to_pnode(pa);
782 uv_write_global_mmr64(pnode, 780 uv_write_global_mmr64(pnode,
783 UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST, 781 UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST,
784 ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) | 782 ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) |
@@ -843,8 +841,7 @@ static int __init uv_bau_init(void)
843 GFP_KERNEL, cpu_to_node(cur_cpu)); 841 GFP_KERNEL, cpu_to_node(cur_cpu));
844 842
845 uv_bau_retry_limit = 1; 843 uv_bau_retry_limit = 1;
846 uv_nshift = uv_hub_info->n_val; 844 uv_mmask = (1UL << uv_hub_info->m_val) - 1;
847 uv_mmask = (1UL << uv_hub_info->n_val) - 1;
848 nblades = uv_num_possible_blades(); 845 nblades = uv_num_possible_blades();
849 846
850 uv_bau_table_bases = (struct bau_control **) 847 uv_bau_table_bases = (struct bau_control **)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 8d6001ad8d8d..3c68fe2d46cf 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -305,8 +305,11 @@ SECTIONS
305 305
306 306
307#ifdef CONFIG_X86_32 307#ifdef CONFIG_X86_32
308ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE), 308/*
309 "kernel image bigger than KERNEL_IMAGE_SIZE"); 309 * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
310 */
311. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
312 "kernel image bigger than KERNEL_IMAGE_SIZE");
310#else 313#else
311/* 314/*
312 * Per-cpu symbols which need to be offset from __per_cpu_load 315 * Per-cpu symbols which need to be offset from __per_cpu_load
@@ -319,12 +322,12 @@ INIT_PER_CPU(irq_stack_union);
319/* 322/*
320 * Build-time check on the image size: 323 * Build-time check on the image size:
321 */ 324 */
322ASSERT((_end - _text <= KERNEL_IMAGE_SIZE), 325. = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
323 "kernel image bigger than KERNEL_IMAGE_SIZE"); 326 "kernel image bigger than KERNEL_IMAGE_SIZE");
324 327
325#ifdef CONFIG_SMP 328#ifdef CONFIG_SMP
326ASSERT((per_cpu__irq_stack_union == 0), 329. = ASSERT((per_cpu__irq_stack_union == 0),
327 "irq_stack_union is not at start of per-cpu area"); 330 "irq_stack_union is not at start of per-cpu area");
328#endif 331#endif
329 332
330#endif /* CONFIG_X86_32 */ 333#endif /* CONFIG_X86_32 */
@@ -332,6 +335,7 @@ ASSERT((per_cpu__irq_stack_union == 0),
332#ifdef CONFIG_KEXEC 335#ifdef CONFIG_KEXEC
333#include <asm/kexec.h> 336#include <asm/kexec.h>
334 337
335ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE, 338. = ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
336 "kexec control code size is too big"); 339 "kexec control code size is too big");
337#endif 340#endif
341
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 82ad523b4901..144e7f60b5e2 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -116,7 +116,7 @@ static s64 __kpit_elapsed(struct kvm *kvm)
116 * itself with the initial count and continues counting 116 * itself with the initial count and continues counting
117 * from there. 117 * from there.
118 */ 118 */
119 remaining = hrtimer_expires_remaining(&ps->pit_timer.timer); 119 remaining = hrtimer_get_remaining(&ps->pit_timer.timer);
120 elapsed = ps->pit_timer.period - ktime_to_ns(remaining); 120 elapsed = ps->pit_timer.period - ktime_to_ns(remaining);
121 elapsed = mod_64(elapsed, ps->pit_timer.period); 121 elapsed = mod_64(elapsed, ps->pit_timer.period);
122 122
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 7024224f0fc8..23c217692ea9 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -521,7 +521,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
521 if (apic_get_reg(apic, APIC_TMICT) == 0) 521 if (apic_get_reg(apic, APIC_TMICT) == 0)
522 return 0; 522 return 0;
523 523
524 remaining = hrtimer_expires_remaining(&apic->lapic_timer.timer); 524 remaining = hrtimer_get_remaining(&apic->lapic_timer.timer);
525 if (ktime_to_ns(remaining) < 0) 525 if (ktime_to_ns(remaining) < 0)
526 remaining = ktime_set(0, 0); 526 remaining = ktime_set(0, 0);
527 527
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 685a4ffac8e6..818b92ad82cf 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -748,7 +748,8 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)
748 return write_protected; 748 return write_protected;
749} 749}
750 750
751static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 751static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
752 unsigned long data)
752{ 753{
753 u64 *spte; 754 u64 *spte;
754 int need_tlb_flush = 0; 755 int need_tlb_flush = 0;
@@ -763,7 +764,8 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)
763 return need_tlb_flush; 764 return need_tlb_flush;
764} 765}
765 766
766static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 767static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
768 unsigned long data)
767{ 769{
768 int need_flush = 0; 770 int need_flush = 0;
769 u64 *spte, new_spte; 771 u64 *spte, new_spte;
@@ -799,9 +801,10 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)
799 return 0; 801 return 0;
800} 802}
801 803
802static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, u64 data, 804static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
805 unsigned long data,
803 int (*handler)(struct kvm *kvm, unsigned long *rmapp, 806 int (*handler)(struct kvm *kvm, unsigned long *rmapp,
804 u64 data)) 807 unsigned long data))
805{ 808{
806 int i, j; 809 int i, j;
807 int retval = 0; 810 int retval = 0;
@@ -846,10 +849,11 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
846 849
847void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) 850void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
848{ 851{
849 kvm_handle_hva(kvm, hva, (u64)&pte, kvm_set_pte_rmapp); 852 kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp);
850} 853}
851 854
852static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 855static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
856 unsigned long data)
853{ 857{
854 u64 *spte; 858 u64 *spte;
855 int young = 0; 859 int young = 0;
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 3439616d69f1..23a4d80fb39e 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1075,6 +1075,8 @@ asmlinkage void __init xen_start_kernel(void)
1075 * Set up some pagetable state before starting to set any ptes. 1075 * Set up some pagetable state before starting to set any ptes.
1076 */ 1076 */
1077 1077
1078 xen_init_mmu_ops();
1079
1078 /* Prevent unwanted bits from being set in PTEs. */ 1080 /* Prevent unwanted bits from being set in PTEs. */
1079 __supported_pte_mask &= ~_PAGE_GLOBAL; 1081 __supported_pte_mask &= ~_PAGE_GLOBAL;
1080 if (!xen_initial_domain()) 1082 if (!xen_initial_domain())
@@ -1099,7 +1101,6 @@ asmlinkage void __init xen_start_kernel(void)
1099 */ 1101 */
1100 xen_setup_stackprotector(); 1102 xen_setup_stackprotector();
1101 1103
1102 xen_init_mmu_ops();
1103 xen_init_irq_ops(); 1104 xen_init_irq_ops();
1104 xen_init_cpuid_mask(); 1105 xen_init_cpuid_mask();
1105 1106
diff --git a/block/blk-core.c b/block/blk-core.c
index ac0fa10f8fa5..71da5111120c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1161,7 +1161,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
1161 const unsigned int ff = bio->bi_rw & REQ_FAILFAST_MASK; 1161 const unsigned int ff = bio->bi_rw & REQ_FAILFAST_MASK;
1162 int rw_flags; 1162 int rw_flags;
1163 1163
1164 if (bio_rw_flagged(bio, BIO_RW_BARRIER) && bio_has_data(bio) && 1164 if (bio_rw_flagged(bio, BIO_RW_BARRIER) &&
1165 (q->next_ordered == QUEUE_ORDERED_NONE)) { 1165 (q->next_ordered == QUEUE_ORDERED_NONE)) {
1166 bio_endio(bio, -EOPNOTSUPP); 1166 bio_endio(bio, -EOPNOTSUPP);
1167 return 0; 1167 return 0;
diff --git a/crypto/async_tx/async_pq.c b/crypto/async_tx/async_pq.c
index b88db6d1dc65..6b5cc4fba59f 100644
--- a/crypto/async_tx/async_pq.c
+++ b/crypto/async_tx/async_pq.c
@@ -26,14 +26,10 @@
26#include <linux/async_tx.h> 26#include <linux/async_tx.h>
27 27
28/** 28/**
29 * scribble - space to hold throwaway P buffer for synchronous gen_syndrome 29 * pq_scribble_page - space to hold throwaway P or Q buffer for
30 * synchronous gen_syndrome
30 */ 31 */
31static struct page *scribble; 32static struct page *pq_scribble_page;
32
33static bool is_raid6_zero_block(struct page *p)
34{
35 return p == (void *) raid6_empty_zero_page;
36}
37 33
38/* the struct page *blocks[] parameter passed to async_gen_syndrome() 34/* the struct page *blocks[] parameter passed to async_gen_syndrome()
39 * and async_syndrome_val() contains the 'P' destination address at 35 * and async_syndrome_val() contains the 'P' destination address at
@@ -83,7 +79,7 @@ do_async_gen_syndrome(struct dma_chan *chan, struct page **blocks,
83 * sources and update the coefficients accordingly 79 * sources and update the coefficients accordingly
84 */ 80 */
85 for (i = 0, idx = 0; i < src_cnt; i++) { 81 for (i = 0, idx = 0; i < src_cnt; i++) {
86 if (is_raid6_zero_block(blocks[i])) 82 if (blocks[i] == NULL)
87 continue; 83 continue;
88 dma_src[idx] = dma_map_page(dma->dev, blocks[i], offset, len, 84 dma_src[idx] = dma_map_page(dma->dev, blocks[i], offset, len,
89 DMA_TO_DEVICE); 85 DMA_TO_DEVICE);
@@ -160,9 +156,9 @@ do_sync_gen_syndrome(struct page **blocks, unsigned int offset, int disks,
160 srcs = (void **) blocks; 156 srcs = (void **) blocks;
161 157
162 for (i = 0; i < disks; i++) { 158 for (i = 0; i < disks; i++) {
163 if (is_raid6_zero_block(blocks[i])) { 159 if (blocks[i] == NULL) {
164 BUG_ON(i > disks - 3); /* P or Q can't be zero */ 160 BUG_ON(i > disks - 3); /* P or Q can't be zero */
165 srcs[i] = blocks[i]; 161 srcs[i] = (void*)raid6_empty_zero_page;
166 } else 162 } else
167 srcs[i] = page_address(blocks[i]) + offset; 163 srcs[i] = page_address(blocks[i]) + offset;
168 } 164 }
@@ -186,10 +182,14 @@ do_sync_gen_syndrome(struct page **blocks, unsigned int offset, int disks,
186 * blocks[disks-1] to NULL. When P or Q is omitted 'len' must be <= 182 * blocks[disks-1] to NULL. When P or Q is omitted 'len' must be <=
187 * PAGE_SIZE as a temporary buffer of this size is used in the 183 * PAGE_SIZE as a temporary buffer of this size is used in the
188 * synchronous path. 'disks' always accounts for both destination 184 * synchronous path. 'disks' always accounts for both destination
189 * buffers. 185 * buffers. If any source buffers (blocks[i] where i < disks - 2) are
186 * set to NULL those buffers will be replaced with the raid6_zero_page
187 * in the synchronous path and omitted in the hardware-asynchronous
188 * path.
190 * 189 *
191 * 'blocks' note: if submit->scribble is NULL then the contents of 190 * 'blocks' note: if submit->scribble is NULL then the contents of
192 * 'blocks' may be overridden 191 * 'blocks' may be overwritten to perform address conversions
192 * (dma_map_page() or page_address()).
193 */ 193 */
194struct dma_async_tx_descriptor * 194struct dma_async_tx_descriptor *
195async_gen_syndrome(struct page **blocks, unsigned int offset, int disks, 195async_gen_syndrome(struct page **blocks, unsigned int offset, int disks,
@@ -227,11 +227,11 @@ async_gen_syndrome(struct page **blocks, unsigned int offset, int disks,
227 async_tx_quiesce(&submit->depend_tx); 227 async_tx_quiesce(&submit->depend_tx);
228 228
229 if (!P(blocks, disks)) { 229 if (!P(blocks, disks)) {
230 P(blocks, disks) = scribble; 230 P(blocks, disks) = pq_scribble_page;
231 BUG_ON(len + offset > PAGE_SIZE); 231 BUG_ON(len + offset > PAGE_SIZE);
232 } 232 }
233 if (!Q(blocks, disks)) { 233 if (!Q(blocks, disks)) {
234 Q(blocks, disks) = scribble; 234 Q(blocks, disks) = pq_scribble_page;
235 BUG_ON(len + offset > PAGE_SIZE); 235 BUG_ON(len + offset > PAGE_SIZE);
236 } 236 }
237 do_sync_gen_syndrome(blocks, offset, disks, len, submit); 237 do_sync_gen_syndrome(blocks, offset, disks, len, submit);
@@ -265,8 +265,10 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks,
265 len); 265 len);
266 struct dma_device *device = chan ? chan->device : NULL; 266 struct dma_device *device = chan ? chan->device : NULL;
267 struct dma_async_tx_descriptor *tx; 267 struct dma_async_tx_descriptor *tx;
268 unsigned char coefs[disks-2];
268 enum dma_ctrl_flags dma_flags = submit->cb_fn ? DMA_PREP_INTERRUPT : 0; 269 enum dma_ctrl_flags dma_flags = submit->cb_fn ? DMA_PREP_INTERRUPT : 0;
269 dma_addr_t *dma_src = NULL; 270 dma_addr_t *dma_src = NULL;
271 int src_cnt = 0;
270 272
271 BUG_ON(disks < 4); 273 BUG_ON(disks < 4);
272 274
@@ -285,22 +287,32 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks,
285 __func__, disks, len); 287 __func__, disks, len);
286 if (!P(blocks, disks)) 288 if (!P(blocks, disks))
287 dma_flags |= DMA_PREP_PQ_DISABLE_P; 289 dma_flags |= DMA_PREP_PQ_DISABLE_P;
290 else
291 pq[0] = dma_map_page(dev, P(blocks, disks),
292 offset, len,
293 DMA_TO_DEVICE);
288 if (!Q(blocks, disks)) 294 if (!Q(blocks, disks))
289 dma_flags |= DMA_PREP_PQ_DISABLE_Q; 295 dma_flags |= DMA_PREP_PQ_DISABLE_Q;
296 else
297 pq[1] = dma_map_page(dev, Q(blocks, disks),
298 offset, len,
299 DMA_TO_DEVICE);
300
290 if (submit->flags & ASYNC_TX_FENCE) 301 if (submit->flags & ASYNC_TX_FENCE)
291 dma_flags |= DMA_PREP_FENCE; 302 dma_flags |= DMA_PREP_FENCE;
292 for (i = 0; i < disks; i++) 303 for (i = 0; i < disks-2; i++)
293 if (likely(blocks[i])) { 304 if (likely(blocks[i])) {
294 BUG_ON(is_raid6_zero_block(blocks[i])); 305 dma_src[src_cnt] = dma_map_page(dev, blocks[i],
295 dma_src[i] = dma_map_page(dev, blocks[i], 306 offset, len,
296 offset, len, 307 DMA_TO_DEVICE);
297 DMA_TO_DEVICE); 308 coefs[src_cnt] = raid6_gfexp[i];
309 src_cnt++;
298 } 310 }
299 311
300 for (;;) { 312 for (;;) {
301 tx = device->device_prep_dma_pq_val(chan, pq, dma_src, 313 tx = device->device_prep_dma_pq_val(chan, pq, dma_src,
302 disks - 2, 314 src_cnt,
303 raid6_gfexp, 315 coefs,
304 len, pqres, 316 len, pqres,
305 dma_flags); 317 dma_flags);
306 if (likely(tx)) 318 if (likely(tx))
@@ -373,9 +385,9 @@ EXPORT_SYMBOL_GPL(async_syndrome_val);
373 385
374static int __init async_pq_init(void) 386static int __init async_pq_init(void)
375{ 387{
376 scribble = alloc_page(GFP_KERNEL); 388 pq_scribble_page = alloc_page(GFP_KERNEL);
377 389
378 if (scribble) 390 if (pq_scribble_page)
379 return 0; 391 return 0;
380 392
381 pr_err("%s: failed to allocate required spare page\n", __func__); 393 pr_err("%s: failed to allocate required spare page\n", __func__);
@@ -385,7 +397,7 @@ static int __init async_pq_init(void)
385 397
386static void __exit async_pq_exit(void) 398static void __exit async_pq_exit(void)
387{ 399{
388 put_page(scribble); 400 put_page(pq_scribble_page);
389} 401}
390 402
391module_init(async_pq_init); 403module_init(async_pq_init);
diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_raid6_recov.c
index 6d73dde4786d..943f2abac9b4 100644
--- a/crypto/async_tx/async_raid6_recov.c
+++ b/crypto/async_tx/async_raid6_recov.c
@@ -131,8 +131,8 @@ async_mult(struct page *dest, struct page *src, u8 coef, size_t len,
131} 131}
132 132
133static struct dma_async_tx_descriptor * 133static struct dma_async_tx_descriptor *
134__2data_recov_4(size_t bytes, int faila, int failb, struct page **blocks, 134__2data_recov_4(int disks, size_t bytes, int faila, int failb,
135 struct async_submit_ctl *submit) 135 struct page **blocks, struct async_submit_ctl *submit)
136{ 136{
137 struct dma_async_tx_descriptor *tx = NULL; 137 struct dma_async_tx_descriptor *tx = NULL;
138 struct page *p, *q, *a, *b; 138 struct page *p, *q, *a, *b;
@@ -143,8 +143,8 @@ __2data_recov_4(size_t bytes, int faila, int failb, struct page **blocks,
143 void *cb_param = submit->cb_param; 143 void *cb_param = submit->cb_param;
144 void *scribble = submit->scribble; 144 void *scribble = submit->scribble;
145 145
146 p = blocks[4-2]; 146 p = blocks[disks-2];
147 q = blocks[4-1]; 147 q = blocks[disks-1];
148 148
149 a = blocks[faila]; 149 a = blocks[faila];
150 b = blocks[failb]; 150 b = blocks[failb];
@@ -170,8 +170,8 @@ __2data_recov_4(size_t bytes, int faila, int failb, struct page **blocks,
170} 170}
171 171
172static struct dma_async_tx_descriptor * 172static struct dma_async_tx_descriptor *
173__2data_recov_5(size_t bytes, int faila, int failb, struct page **blocks, 173__2data_recov_5(int disks, size_t bytes, int faila, int failb,
174 struct async_submit_ctl *submit) 174 struct page **blocks, struct async_submit_ctl *submit)
175{ 175{
176 struct dma_async_tx_descriptor *tx = NULL; 176 struct dma_async_tx_descriptor *tx = NULL;
177 struct page *p, *q, *g, *dp, *dq; 177 struct page *p, *q, *g, *dp, *dq;
@@ -181,21 +181,22 @@ __2data_recov_5(size_t bytes, int faila, int failb, struct page **blocks,
181 dma_async_tx_callback cb_fn = submit->cb_fn; 181 dma_async_tx_callback cb_fn = submit->cb_fn;
182 void *cb_param = submit->cb_param; 182 void *cb_param = submit->cb_param;
183 void *scribble = submit->scribble; 183 void *scribble = submit->scribble;
184 int uninitialized_var(good); 184 int good_srcs, good, i;
185 int i;
186 185
187 for (i = 0; i < 3; i++) { 186 good_srcs = 0;
187 good = -1;
188 for (i = 0; i < disks-2; i++) {
189 if (blocks[i] == NULL)
190 continue;
188 if (i == faila || i == failb) 191 if (i == faila || i == failb)
189 continue; 192 continue;
190 else { 193 good = i;
191 good = i; 194 good_srcs++;
192 break;
193 }
194 } 195 }
195 BUG_ON(i >= 3); 196 BUG_ON(good_srcs > 1);
196 197
197 p = blocks[5-2]; 198 p = blocks[disks-2];
198 q = blocks[5-1]; 199 q = blocks[disks-1];
199 g = blocks[good]; 200 g = blocks[good];
200 201
201 /* Compute syndrome with zero for the missing data pages 202 /* Compute syndrome with zero for the missing data pages
@@ -263,10 +264,10 @@ __2data_recov_n(int disks, size_t bytes, int faila, int failb,
263 * delta p and delta q 264 * delta p and delta q
264 */ 265 */
265 dp = blocks[faila]; 266 dp = blocks[faila];
266 blocks[faila] = (void *)raid6_empty_zero_page; 267 blocks[faila] = NULL;
267 blocks[disks-2] = dp; 268 blocks[disks-2] = dp;
268 dq = blocks[failb]; 269 dq = blocks[failb];
269 blocks[failb] = (void *)raid6_empty_zero_page; 270 blocks[failb] = NULL;
270 blocks[disks-1] = dq; 271 blocks[disks-1] = dq;
271 272
272 init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); 273 init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble);
@@ -323,6 +324,8 @@ struct dma_async_tx_descriptor *
323async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb, 324async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
324 struct page **blocks, struct async_submit_ctl *submit) 325 struct page **blocks, struct async_submit_ctl *submit)
325{ 326{
327 int non_zero_srcs, i;
328
326 BUG_ON(faila == failb); 329 BUG_ON(faila == failb);
327 if (failb < faila) 330 if (failb < faila)
328 swap(faila, failb); 331 swap(faila, failb);
@@ -334,11 +337,13 @@ async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
334 */ 337 */
335 if (!submit->scribble) { 338 if (!submit->scribble) {
336 void **ptrs = (void **) blocks; 339 void **ptrs = (void **) blocks;
337 int i;
338 340
339 async_tx_quiesce(&submit->depend_tx); 341 async_tx_quiesce(&submit->depend_tx);
340 for (i = 0; i < disks; i++) 342 for (i = 0; i < disks; i++)
341 ptrs[i] = page_address(blocks[i]); 343 if (blocks[i] == NULL)
344 ptrs[i] = (void *) raid6_empty_zero_page;
345 else
346 ptrs[i] = page_address(blocks[i]);
342 347
343 raid6_2data_recov(disks, bytes, faila, failb, ptrs); 348 raid6_2data_recov(disks, bytes, faila, failb, ptrs);
344 349
@@ -347,19 +352,30 @@ async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
347 return NULL; 352 return NULL;
348 } 353 }
349 354
350 switch (disks) { 355 non_zero_srcs = 0;
351 case 4: 356 for (i = 0; i < disks-2 && non_zero_srcs < 4; i++)
357 if (blocks[i])
358 non_zero_srcs++;
359 switch (non_zero_srcs) {
360 case 0:
361 case 1:
362 /* There must be at least 2 sources - the failed devices. */
363 BUG();
364
365 case 2:
352 /* dma devices do not uniformly understand a zero source pq 366 /* dma devices do not uniformly understand a zero source pq
353 * operation (in contrast to the synchronous case), so 367 * operation (in contrast to the synchronous case), so
354 * explicitly handle the 4 disk special case 368 * explicitly handle the special case of a 4 disk array with
369 * both data disks missing.
355 */ 370 */
356 return __2data_recov_4(bytes, faila, failb, blocks, submit); 371 return __2data_recov_4(disks, bytes, faila, failb, blocks, submit);
357 case 5: 372 case 3:
358 /* dma devices do not uniformly understand a single 373 /* dma devices do not uniformly understand a single
359 * source pq operation (in contrast to the synchronous 374 * source pq operation (in contrast to the synchronous
360 * case), so explicitly handle the 5 disk special case 375 * case), so explicitly handle the special case of a 5 disk
376 * array with 2 of 3 data disks missing.
361 */ 377 */
362 return __2data_recov_5(bytes, faila, failb, blocks, submit); 378 return __2data_recov_5(disks, bytes, faila, failb, blocks, submit);
363 default: 379 default:
364 return __2data_recov_n(disks, bytes, faila, failb, blocks, submit); 380 return __2data_recov_n(disks, bytes, faila, failb, blocks, submit);
365 } 381 }
@@ -385,6 +401,7 @@ async_raid6_datap_recov(int disks, size_t bytes, int faila,
385 dma_async_tx_callback cb_fn = submit->cb_fn; 401 dma_async_tx_callback cb_fn = submit->cb_fn;
386 void *cb_param = submit->cb_param; 402 void *cb_param = submit->cb_param;
387 void *scribble = submit->scribble; 403 void *scribble = submit->scribble;
404 int good_srcs, good, i;
388 struct page *srcs[2]; 405 struct page *srcs[2];
389 406
390 pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes); 407 pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes);
@@ -394,11 +411,13 @@ async_raid6_datap_recov(int disks, size_t bytes, int faila,
394 */ 411 */
395 if (!scribble) { 412 if (!scribble) {
396 void **ptrs = (void **) blocks; 413 void **ptrs = (void **) blocks;
397 int i;
398 414
399 async_tx_quiesce(&submit->depend_tx); 415 async_tx_quiesce(&submit->depend_tx);
400 for (i = 0; i < disks; i++) 416 for (i = 0; i < disks; i++)
401 ptrs[i] = page_address(blocks[i]); 417 if (blocks[i] == NULL)
418 ptrs[i] = (void*)raid6_empty_zero_page;
419 else
420 ptrs[i] = page_address(blocks[i]);
402 421
403 raid6_datap_recov(disks, bytes, faila, ptrs); 422 raid6_datap_recov(disks, bytes, faila, ptrs);
404 423
@@ -407,6 +426,20 @@ async_raid6_datap_recov(int disks, size_t bytes, int faila,
407 return NULL; 426 return NULL;
408 } 427 }
409 428
429 good_srcs = 0;
430 good = -1;
431 for (i = 0; i < disks-2; i++) {
432 if (i == faila)
433 continue;
434 if (blocks[i]) {
435 good = i;
436 good_srcs++;
437 if (good_srcs > 1)
438 break;
439 }
440 }
441 BUG_ON(good_srcs == 0);
442
410 p = blocks[disks-2]; 443 p = blocks[disks-2];
411 q = blocks[disks-1]; 444 q = blocks[disks-1];
412 445
@@ -414,14 +447,13 @@ async_raid6_datap_recov(int disks, size_t bytes, int faila,
414 * Use the dead data page as temporary storage for delta q 447 * Use the dead data page as temporary storage for delta q
415 */ 448 */
416 dq = blocks[faila]; 449 dq = blocks[faila];
417 blocks[faila] = (void *)raid6_empty_zero_page; 450 blocks[faila] = NULL;
418 blocks[disks-1] = dq; 451 blocks[disks-1] = dq;
419 452
420 /* in the 4 disk case we only need to perform a single source 453 /* in the 4-disk case we only need to perform a single source
421 * multiplication 454 * multiplication with the one good data block.
422 */ 455 */
423 if (disks == 4) { 456 if (good_srcs == 1) {
424 int good = faila == 0 ? 1 : 0;
425 struct page *g = blocks[good]; 457 struct page *g = blocks[good];
426 458
427 init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, 459 init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL,
diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c
index b459a9034aac..79182dcb91b7 100644
--- a/crypto/async_tx/async_xor.c
+++ b/crypto/async_tx/async_xor.c
@@ -44,20 +44,23 @@ do_async_xor(struct dma_chan *chan, struct page *dest, struct page **src_list,
44 void *cb_param_orig = submit->cb_param; 44 void *cb_param_orig = submit->cb_param;
45 enum async_tx_flags flags_orig = submit->flags; 45 enum async_tx_flags flags_orig = submit->flags;
46 enum dma_ctrl_flags dma_flags; 46 enum dma_ctrl_flags dma_flags;
47 int xor_src_cnt; 47 int xor_src_cnt = 0;
48 dma_addr_t dma_dest; 48 dma_addr_t dma_dest;
49 49
50 /* map the dest bidrectional in case it is re-used as a source */ 50 /* map the dest bidrectional in case it is re-used as a source */
51 dma_dest = dma_map_page(dma->dev, dest, offset, len, DMA_BIDIRECTIONAL); 51 dma_dest = dma_map_page(dma->dev, dest, offset, len, DMA_BIDIRECTIONAL);
52 for (i = 0; i < src_cnt; i++) { 52 for (i = 0; i < src_cnt; i++) {
53 /* only map the dest once */ 53 /* only map the dest once */
54 if (!src_list[i])
55 continue;
54 if (unlikely(src_list[i] == dest)) { 56 if (unlikely(src_list[i] == dest)) {
55 dma_src[i] = dma_dest; 57 dma_src[xor_src_cnt++] = dma_dest;
56 continue; 58 continue;
57 } 59 }
58 dma_src[i] = dma_map_page(dma->dev, src_list[i], offset, 60 dma_src[xor_src_cnt++] = dma_map_page(dma->dev, src_list[i], offset,
59 len, DMA_TO_DEVICE); 61 len, DMA_TO_DEVICE);
60 } 62 }
63 src_cnt = xor_src_cnt;
61 64
62 while (src_cnt) { 65 while (src_cnt) {
63 submit->flags = flags_orig; 66 submit->flags = flags_orig;
@@ -123,7 +126,7 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
123 int src_cnt, size_t len, struct async_submit_ctl *submit) 126 int src_cnt, size_t len, struct async_submit_ctl *submit)
124{ 127{
125 int i; 128 int i;
126 int xor_src_cnt; 129 int xor_src_cnt = 0;
127 int src_off = 0; 130 int src_off = 0;
128 void *dest_buf; 131 void *dest_buf;
129 void **srcs; 132 void **srcs;
@@ -135,8 +138,9 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
135 138
136 /* convert to buffer pointers */ 139 /* convert to buffer pointers */
137 for (i = 0; i < src_cnt; i++) 140 for (i = 0; i < src_cnt; i++)
138 srcs[i] = page_address(src_list[i]) + offset; 141 if (src_list[i])
139 142 srcs[xor_src_cnt++] = page_address(src_list[i]) + offset;
143 src_cnt = xor_src_cnt;
140 /* set destination address */ 144 /* set destination address */
141 dest_buf = page_address(dest) + offset; 145 dest_buf = page_address(dest) + offset;
142 146
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 0ed42d8870c7..93d2c7971df6 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -218,10 +218,10 @@ config ACPI_PROCESSOR_AGGREGATOR
218 depends on X86 218 depends on X86
219 help 219 help
220 ACPI 4.0 defines processor Aggregator, which enables OS to perform 220 ACPI 4.0 defines processor Aggregator, which enables OS to perform
221 specfic processor configuration and control that applies to all 221 specific processor configuration and control that applies to all
222 processors in the platform. Currently only logical processor idling 222 processors in the platform. Currently only logical processor idling
223 is defined, which is to reduce power consumption. This driver 223 is defined, which is to reduce power consumption. This driver
224 support the new device. 224 supports the new device.
225 225
226config ACPI_THERMAL 226config ACPI_THERMAL
227 tristate "Thermal Zone" 227 tristate "Thermal Zone"
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 98b9690b0159..b6ed60b57b0d 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -245,6 +245,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
245 acpi_bus_generate_netlink_event(device->pnp.device_class, 245 acpi_bus_generate_netlink_event(device->pnp.device_class,
246 dev_name(&device->dev), event, 246 dev_name(&device->dev), event,
247 (u32) ac->state); 247 (u32) ac->state);
248 acpi_notifier_call_chain(device, event, (u32) ac->state);
248#ifdef CONFIG_ACPI_SYSFS_POWER 249#ifdef CONFIG_ACPI_SYSFS_POWER
249 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 250 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
250#endif 251#endif
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 9335b87c5174..0c9c6a9a002c 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -251,6 +251,9 @@ int acpi_lid_open(void)
251 acpi_status status; 251 acpi_status status;
252 unsigned long long state; 252 unsigned long long state;
253 253
254 if (!lid_device)
255 return -ENODEV;
256
254 status = acpi_evaluate_integer(lid_device->handle, "_LID", NULL, 257 status = acpi_evaluate_integer(lid_device->handle, "_LID", NULL,
255 &state); 258 &state);
256 if (ACPI_FAILURE(status)) 259 if (ACPI_FAILURE(status))
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 31122214e0ec..1af808171d46 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -389,6 +389,17 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
389 389
390 pbus = pdev->subordinate; 390 pbus = pdev->subordinate;
391 pci_dev_put(pdev); 391 pci_dev_put(pdev);
392
393 /*
394 * This function may be called for a non-PCI device that has a
395 * PCI parent (eg. a disk under a PCI SATA controller). In that
396 * case pdev->subordinate will be NULL for the parent.
397 */
398 if (!pbus) {
399 dev_dbg(&pdev->dev, "Not a PCI-to-PCI bridge\n");
400 pdev = NULL;
401 break;
402 }
392 } 403 }
393out: 404out:
394 list_for_each_entry_safe(node, tmp, &device_list, node) 405 list_for_each_entry_safe(node, tmp, &device_list, node)
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index f6e54bf8dd96..64e3c581b7a9 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1109,7 +1109,12 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
1109 */ 1109 */
1110 1110
1111 /* Does this device support video switching? */ 1111 /* Does this device support video switching? */
1112 if (video->cap._DOS) { 1112 if (video->cap._DOS || video->cap._DOD) {
1113 if (!video->cap._DOS) {
1114 printk(KERN_WARNING FW_BUG
1115 "ACPI(%s) defines _DOD but not _DOS\n",
1116 acpi_device_bid(video->device));
1117 }
1113 video->flags.multihead = 1; 1118 video->flags.multihead = 1;
1114 status = 0; 1119 status = 0;
1115 } 1120 }
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 7032f25da9b5..575593a8b4e6 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -84,7 +84,7 @@ long acpi_is_video_device(struct acpi_device *device)
84 return 0; 84 return 0;
85 85
86 /* Does this device able to support video switching ? */ 86 /* Does this device able to support video switching ? */
87 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && 87 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) ||
88 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) 88 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy)))
89 video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; 89 video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
90 90
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index b1a257746a19..a06f5d6375a8 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -575,7 +575,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
575 { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb700 }, /* ATI SB700/800 */ 575 { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb700 }, /* ATI SB700/800 */
576 576
577 /* AMD */ 577 /* AMD */
578 { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD SB900 */ 578 { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */
579 /* AMD is using RAID class only for ahci controllers */ 579 /* AMD is using RAID class only for ahci controllers */
580 { PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 580 { PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
581 PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci }, 581 PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci },
@@ -605,6 +605,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
605 { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci_yesncq }, /* MCP67 */ 605 { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci_yesncq }, /* MCP67 */
606 { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci_yesncq }, /* MCP67 */ 606 { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci_yesncq }, /* MCP67 */
607 { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci_yesncq }, /* MCP67 */ 607 { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci_yesncq }, /* MCP67 */
608 { PCI_VDEVICE(NVIDIA, 0x0580), board_ahci_yesncq }, /* Linux ID */
608 { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci_yesncq }, /* MCP73 */ 609 { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci_yesncq }, /* MCP73 */
609 { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci_yesncq }, /* MCP73 */ 610 { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci_yesncq }, /* MCP73 */
610 { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci_yesncq }, /* MCP73 */ 611 { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci_yesncq }, /* MCP73 */
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b525a0981348..d7f0f1b1ae3e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5028,12 +5028,14 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5028 qc->flags |= ATA_QCFLAG_FAILED; 5028 qc->flags |= ATA_QCFLAG_FAILED;
5029 5029
5030 if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { 5030 if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
5031 if (!ata_tag_internal(qc->tag)) { 5031 /* always fill result TF for failed qc */
5032 /* always fill result TF for failed qc */ 5032 fill_result_tf(qc);
5033 fill_result_tf(qc); 5033
5034 if (!ata_tag_internal(qc->tag))
5034 ata_qc_schedule_eh(qc); 5035 ata_qc_schedule_eh(qc);
5035 return; 5036 else
5036 } 5037 __ata_qc_complete(qc);
5038 return;
5037 } 5039 }
5038 5040
5039 WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); 5041 WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 0a97822da211..bba2ae5df1c2 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2981,12 +2981,14 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2981 * device detection messages backwards. 2981 * device detection messages backwards.
2982 */ 2982 */
2983 ata_for_each_dev(dev, link, ALL) { 2983 ata_for_each_dev(dev, link, ALL) {
2984 if (!(new_mask & (1 << dev->devno)) || 2984 if (!(new_mask & (1 << dev->devno)))
2985 dev->class == ATA_DEV_PMP)
2986 continue; 2985 continue;
2987 2986
2988 dev->class = ehc->classes[dev->devno]; 2987 dev->class = ehc->classes[dev->devno];
2989 2988
2989 if (dev->class == ATA_DEV_PMP)
2990 continue;
2991
2990 ehc->i.flags |= ATA_EHI_PRINTINFO; 2992 ehc->i.flags |= ATA_EHI_PRINTINFO;
2991 rc = ata_dev_configure(dev); 2993 rc = ata_dev_configure(dev);
2992 ehc->i.flags &= ~ATA_EHI_PRINTINFO; 2994 ehc->i.flags &= ~ATA_EHI_PRINTINFO;
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index aa4b3f6ae771..ae4454d4e955 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -246,7 +246,7 @@ static const struct pci_device_id atiixp[] = {
246 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), }, 246 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), },
247 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), }, 247 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), },
248 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), }, 248 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), },
249 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_SB900_IDE), }, 249 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_HUDSON2_IDE), },
250 250
251 { }, 251 { },
252}; 252};
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index f49814d6fd2e..3bbed8322ecf 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -235,8 +235,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
235 .udma_mask = ATA_UDMA2, 235 .udma_mask = ATA_UDMA2,
236 .port_ops = &sc1200_port_ops 236 .port_ops = &sc1200_port_ops
237 }; 237 };
238 /* Can't enable port 2 yet, see top comments */ 238 const struct ata_port_info *ppi[] = { &info, NULL };
239 const struct ata_port_info *ppi[] = { &info, };
240 239
241 return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); 240 return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL);
242} 241}
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 45657cacec43..88984b803d6d 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -111,7 +111,7 @@ static const struct via_isa_bridge {
111 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 111 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
112 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, 112 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA },
113 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, 113 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
114 { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, 114 { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
115 { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 115 { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
116 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 116 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
117 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 117 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 17f9ff9067a2..6f5093b7c8c5 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1382,6 +1382,25 @@ static int mv_qc_defer(struct ata_queued_cmd *qc)
1382 */ 1382 */
1383 if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) 1383 if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH)
1384 return ATA_DEFER_PORT; 1384 return ATA_DEFER_PORT;
1385
1386 /* PIO commands need exclusive link: no other commands [DMA or PIO]
1387 * can run concurrently.
1388 * set excl_link when we want to send a PIO command in DMA mode
1389 * or a non-NCQ command in NCQ mode.
1390 * When we receive a command from that link, and there are no
1391 * outstanding commands, mark a flag to clear excl_link and let
1392 * the command go through.
1393 */
1394 if (unlikely(ap->excl_link)) {
1395 if (link == ap->excl_link) {
1396 if (ap->nr_active_links)
1397 return ATA_DEFER_PORT;
1398 qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
1399 return 0;
1400 } else
1401 return ATA_DEFER_PORT;
1402 }
1403
1385 /* 1404 /*
1386 * If the port is completely idle, then allow the new qc. 1405 * If the port is completely idle, then allow the new qc.
1387 */ 1406 */
@@ -1395,8 +1414,14 @@ static int mv_qc_defer(struct ata_queued_cmd *qc)
1395 * doesn't allow it. 1414 * doesn't allow it.
1396 */ 1415 */
1397 if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && 1416 if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) &&
1398 (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol)) 1417 (pp->pp_flags & MV_PP_FLAG_NCQ_EN)) {
1399 return 0; 1418 if (ata_is_ncq(qc->tf.protocol))
1419 return 0;
1420 else {
1421 ap->excl_link = link;
1422 return ATA_DEFER_PORT;
1423 }
1424 }
1400 1425
1401 return ATA_DEFER_PORT; 1426 return ATA_DEFER_PORT;
1402} 1427}
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 86a40582999c..1eb4e020eb5c 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1594,9 +1594,21 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
1594 !ata_dev_enabled(link->device)) 1594 !ata_dev_enabled(link->device))
1595 sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, 1595 sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
1596 NULL, NULL); 1596 NULL, NULL);
1597 else if (!(ehc->i.flags & ATA_EHI_QUIET)) 1597 else {
1598 ata_link_printk(link, KERN_INFO, 1598 const unsigned long *timing = sata_ehc_deb_timing(ehc);
1599 "nv: skipping hardreset on occupied port\n"); 1599 int rc;
1600
1601 if (!(ehc->i.flags & ATA_EHI_QUIET))
1602 ata_link_printk(link, KERN_INFO, "nv: skipping "
1603 "hardreset on occupied port\n");
1604
1605 /* make sure the link is online */
1606 rc = sata_link_resume(link, timing, deadline);
1607 /* whine about phy resume failure but proceed */
1608 if (rc && rc != -EOPNOTSUPP)
1609 ata_link_printk(link, KERN_WARNING, "failed to resume "
1610 "link (errno=%d)\n", rc);
1611 }
1600 1612
1601 /* device signature acquisition is unreliable */ 1613 /* device signature acquisition is unreliable */
1602 return -EAGAIN; 1614 return -EAGAIN;
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 973bf2ad4e0d..63c143e54a57 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -689,15 +689,19 @@ int bus_add_driver(struct device_driver *drv)
689 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", 689 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
690 __func__, drv->name); 690 __func__, drv->name);
691 } 691 }
692 error = add_bind_files(drv); 692
693 if (error) { 693 if (!drv->suppress_bind_attrs) {
694 /* Ditto */ 694 error = add_bind_files(drv);
695 printk(KERN_ERR "%s: add_bind_files(%s) failed\n", 695 if (error) {
696 __func__, drv->name); 696 /* Ditto */
697 printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
698 __func__, drv->name);
699 }
697 } 700 }
698 701
699 kobject_uevent(&priv->kobj, KOBJ_ADD); 702 kobject_uevent(&priv->kobj, KOBJ_ADD);
700 return 0; 703 return 0;
704
701out_unregister: 705out_unregister:
702 kfree(drv->p); 706 kfree(drv->p);
703 drv->p = NULL; 707 drv->p = NULL;
@@ -720,7 +724,8 @@ void bus_remove_driver(struct device_driver *drv)
720 if (!drv->bus) 724 if (!drv->bus)
721 return; 725 return;
722 726
723 remove_bind_files(drv); 727 if (!drv->suppress_bind_attrs)
728 remove_bind_files(drv);
724 driver_remove_attrs(drv->bus, drv); 729 driver_remove_attrs(drv->bus, drv);
725 driver_remove_file(drv, &driver_attr_uevent); 730 driver_remove_file(drv, &driver_attr_uevent);
726 klist_remove(&drv->p->knode_bus); 731 klist_remove(&drv->p->knode_bus);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index ed2ebd3c287d..f367885a7646 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -236,7 +236,7 @@ int driver_register(struct device_driver *drv)
236 put_driver(other); 236 put_driver(other);
237 printk(KERN_ERR "Error: Driver '%s' is already registered, " 237 printk(KERN_ERR "Error: Driver '%s' is already registered, "
238 "aborting...\n", drv->name); 238 "aborting...\n", drv->name);
239 return -EEXIST; 239 return -EBUSY;
240 } 240 }
241 241
242 ret = bus_add_driver(drv); 242 ret = bus_add_driver(drv);
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index ed156a13aa40..4fa954b07ac4 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -521,11 +521,15 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,
521{ 521{
522 int retval, code; 522 int retval, code;
523 523
524 /* make sure driver won't have bind/unbind attributes */
525 drv->driver.suppress_bind_attrs = true;
526
524 /* temporary section violation during probe() */ 527 /* temporary section violation during probe() */
525 drv->probe = probe; 528 drv->probe = probe;
526 retval = code = platform_driver_register(drv); 529 retval = code = platform_driver_register(drv);
527 530
528 /* Fixup that section violation, being paranoid about code scanning 531 /*
532 * Fixup that section violation, being paranoid about code scanning
529 * the list of drivers in order to probe new devices. Check to see 533 * the list of drivers in order to probe new devices. Check to see
530 * if the probe was successful, and make sure any forced probes of 534 * if the probe was successful, and make sure any forced probes of
531 * new devices fail. 535 * new devices fail.
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e0dc4071e088..8aa2443182d5 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -511,6 +511,7 @@ static void dpm_complete(pm_message_t state)
511 511
512 INIT_LIST_HEAD(&list); 512 INIT_LIST_HEAD(&list);
513 mutex_lock(&dpm_list_mtx); 513 mutex_lock(&dpm_list_mtx);
514 transition_started = false;
514 while (!list_empty(&dpm_list)) { 515 while (!list_empty(&dpm_list)) {
515 struct device *dev = to_device(dpm_list.prev); 516 struct device *dev = to_device(dpm_list.prev);
516 517
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 38556f6cc22d..a770498a74ec 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -51,8 +51,6 @@ static int __pm_runtime_idle(struct device *dev)
51{ 51{
52 int retval = 0; 52 int retval = 0;
53 53
54 dev_dbg(dev, "__pm_runtime_idle()!\n");
55
56 if (dev->power.runtime_error) 54 if (dev->power.runtime_error)
57 retval = -EINVAL; 55 retval = -EINVAL;
58 else if (dev->power.idle_notification) 56 else if (dev->power.idle_notification)
@@ -93,8 +91,6 @@ static int __pm_runtime_idle(struct device *dev)
93 wake_up_all(&dev->power.wait_queue); 91 wake_up_all(&dev->power.wait_queue);
94 92
95 out: 93 out:
96 dev_dbg(dev, "__pm_runtime_idle() returns %d!\n", retval);
97
98 return retval; 94 return retval;
99} 95}
100 96
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index edda9ea7c626..bd112c8c7bcd 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -949,7 +949,7 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
949 lo->lo_state = Lo_unbound; 949 lo->lo_state = Lo_unbound;
950 /* This is safe: open() is still holding a reference. */ 950 /* This is safe: open() is still holding a reference. */
951 module_put(THIS_MODULE); 951 module_put(THIS_MODULE);
952 if (max_part > 0) 952 if (max_part > 0 && bdev)
953 ioctl_by_bdev(bdev, BLKRRPART, 0); 953 ioctl_by_bdev(bdev, BLKRRPART, 0);
954 mutex_unlock(&lo->lo_ctl_mutex); 954 mutex_unlock(&lo->lo_ctl_mutex);
955 /* 955 /*
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 43f19389647a..51042f0ba7e1 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -3,7 +3,6 @@
3#include <linux/blkdev.h> 3#include <linux/blkdev.h>
4#include <linux/hdreg.h> 4#include <linux/hdreg.h>
5#include <linux/virtio.h> 5#include <linux/virtio.h>
6#include <linux/virtio_ids.h>
7#include <linux/virtio_blk.h> 6#include <linux/virtio_blk.h>
8#include <linux/scatterlist.h> 7#include <linux/scatterlist.h>
9 8
@@ -183,34 +182,6 @@ static void do_virtblk_request(struct request_queue *q)
183 vblk->vq->vq_ops->kick(vblk->vq); 182 vblk->vq->vq_ops->kick(vblk->vq);
184} 183}
185 184
186/* return ATA identify data
187 */
188static int virtblk_identify(struct gendisk *disk, void *argp)
189{
190 struct virtio_blk *vblk = disk->private_data;
191 void *opaque;
192 int err = -ENOMEM;
193
194 opaque = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL);
195 if (!opaque)
196 goto out;
197
198 err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY,
199 offsetof(struct virtio_blk_config, identify), opaque,
200 VIRTIO_BLK_ID_BYTES);
201
202 if (err)
203 goto out_kfree;
204
205 if (copy_to_user(argp, opaque, VIRTIO_BLK_ID_BYTES))
206 err = -EFAULT;
207
208out_kfree:
209 kfree(opaque);
210out:
211 return err;
212}
213
214static void virtblk_prepare_flush(struct request_queue *q, struct request *req) 185static void virtblk_prepare_flush(struct request_queue *q, struct request *req)
215{ 186{
216 req->cmd_type = REQ_TYPE_LINUX_BLOCK; 187 req->cmd_type = REQ_TYPE_LINUX_BLOCK;
@@ -222,10 +193,6 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
222{ 193{
223 struct gendisk *disk = bdev->bd_disk; 194 struct gendisk *disk = bdev->bd_disk;
224 struct virtio_blk *vblk = disk->private_data; 195 struct virtio_blk *vblk = disk->private_data;
225 void __user *argp = (void __user *)data;
226
227 if (cmd == HDIO_GET_IDENTITY)
228 return virtblk_identify(disk, argp);
229 196
230 /* 197 /*
231 * Only allow the generic SCSI ioctls if the host can support it. 198 * Only allow the generic SCSI ioctls if the host can support it.
@@ -233,7 +200,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
233 if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) 200 if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
234 return -ENOTTY; 201 return -ENOTTY;
235 202
236 return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); 203 return scsi_cmd_ioctl(disk->queue, disk, mode, cmd,
204 (void __user *)data);
237} 205}
238 206
239/* We provide getgeo only to please some old bootloader/partitioning tools */ 207/* We provide getgeo only to please some old bootloader/partitioning tools */
@@ -332,7 +300,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
332 } 300 }
333 301
334 vblk->disk->queue->queuedata = vblk; 302 vblk->disk->queue->queuedata = vblk;
335 queue_flag_set_unlocked(QUEUE_FLAG_VIRT, vblk->disk->queue);
336 303
337 if (index < 26) { 304 if (index < 26) {
338 sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); 305 sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26);
@@ -445,7 +412,7 @@ static struct virtio_device_id id_table[] = {
445static unsigned int features[] = { 412static unsigned int features[] = {
446 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, 413 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
447 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, 414 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
448 VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_IDENTIFY, VIRTIO_BLK_F_FLUSH 415 VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH
449}; 416};
450 417
451/* 418/*
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 08a6f50ae791..6aad99ec4e0f 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -323,7 +323,7 @@ config SPECIALIX
323 323
324config SX 324config SX
325 tristate "Specialix SX (and SI) card support" 325 tristate "Specialix SX (and SI) card support"
326 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) 326 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN
327 help 327 help
328 This is a driver for the SX and SI multiport serial cards. 328 This is a driver for the SX and SI multiport serial cards.
329 Please read the file <file:Documentation/serial/sx.txt> for details. 329 Please read the file <file:Documentation/serial/sx.txt> for details.
@@ -334,7 +334,7 @@ config SX
334 334
335config RIO 335config RIO
336 tristate "Specialix RIO system support" 336 tristate "Specialix RIO system support"
337 depends on SERIAL_NONSTANDARD 337 depends on SERIAL_NONSTANDARD && BROKEN
338 help 338 help
339 This is a driver for the Specialix RIO, a smart serial card which 339 This is a driver for the Specialix RIO, a smart serial card which
340 drives an outboard box that can support up to 128 ports. Product 340 drives an outboard box that can support up to 128 ports. Product
@@ -395,7 +395,7 @@ config NOZOMI
395 395
396config A2232 396config A2232
397 tristate "Commodore A2232 serial support (EXPERIMENTAL)" 397 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
398 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP 398 depends on EXPERIMENTAL && ZORRO && BROKEN
399 ---help--- 399 ---help---
400 This option supports the 2232 7-port serial card shipped with the 400 This option supports the 2232 7-port serial card shipped with the
401 Amiga 2000 and other Zorro-bus machines, dating from 1989. At 401 Amiga 2000 and other Zorro-bus machines, dating from 1989. At
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 962968f05b94..915157fcff98 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -21,7 +21,6 @@
21#include <linux/scatterlist.h> 21#include <linux/scatterlist.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/virtio.h> 23#include <linux/virtio.h>
24#include <linux/virtio_ids.h>
25#include <linux/virtio_rng.h> 24#include <linux/virtio_rng.h>
26 25
27/* The host will fill any buffer we give it with sweet, sweet randomness. We 26/* The host will fill any buffer we give it with sweet, sweet randomness. We
@@ -117,7 +116,7 @@ static int virtrng_probe(struct virtio_device *vdev)
117 return 0; 116 return 0;
118} 117}
119 118
120static void virtrng_remove(struct virtio_device *vdev) 119static void __devexit virtrng_remove(struct virtio_device *vdev)
121{ 120{
122 vdev->config->reset(vdev); 121 vdev->config->reset(vdev);
123 hwrng_unregister(&virtio_hwrng); 122 hwrng_unregister(&virtio_hwrng);
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 0d328b59568d..a035ae39a359 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -31,7 +31,6 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/virtio.h> 33#include <linux/virtio.h>
34#include <linux/virtio_ids.h>
35#include <linux/virtio_console.h> 34#include <linux/virtio_console.h>
36#include "hvc_console.h" 35#include "hvc_console.h"
37 36
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 6b36ee56e6fe..ed86d3bf249a 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -1532,7 +1532,7 @@ long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
1532 1532
1533 case PIO_UNIMAP: 1533 case PIO_UNIMAP:
1534 case GIO_UNIMAP: 1534 case GIO_UNIMAP:
1535 ret = do_unimap_ioctl(cmd, up, perm, vc); 1535 ret = compat_unimap_ioctl(cmd, up, perm, vc);
1536 break; 1536 break;
1537 1537
1538 /* 1538 /*
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index ad41f19b8e3f..12fdd3987a36 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -76,8 +76,11 @@ static void cpuidle_idle_call(void)
76#endif 76#endif
77 /* ask the governor for the next state */ 77 /* ask the governor for the next state */
78 next_state = cpuidle_curr_governor->select(dev); 78 next_state = cpuidle_curr_governor->select(dev);
79 if (need_resched()) 79 if (need_resched()) {
80 local_irq_enable();
80 return; 81 return;
82 }
83
81 target_state = &dev->states[next_state]; 84 target_state = &dev->states[next_state];
82 85
83 /* enter the state and update stats */ 86 /* enter the state and update stats */
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
index 76cb6b345e7b..0af80577dc7b 100644
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
@@ -24,6 +24,12 @@
24#include <asm/i387.h> 24#include <asm/i387.h>
25#include "padlock.h" 25#include "padlock.h"
26 26
27#ifdef CONFIG_64BIT
28#define STACK_ALIGN 16
29#else
30#define STACK_ALIGN 4
31#endif
32
27struct padlock_sha_desc { 33struct padlock_sha_desc {
28 struct shash_desc fallback; 34 struct shash_desc fallback;
29}; 35};
@@ -64,7 +70,9 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in,
64 /* We can't store directly to *out as it may be unaligned. */ 70 /* We can't store directly to *out as it may be unaligned. */
65 /* BTW Don't reduce the buffer size below 128 Bytes! 71 /* BTW Don't reduce the buffer size below 128 Bytes!
66 * PadLock microcode needs it that big. */ 72 * PadLock microcode needs it that big. */
67 char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); 73 char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__
74 ((aligned(STACK_ALIGN)));
75 char *result = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
68 struct padlock_sha_desc *dctx = shash_desc_ctx(desc); 76 struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
69 struct sha1_state state; 77 struct sha1_state state;
70 unsigned int space; 78 unsigned int space;
@@ -128,7 +136,9 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in,
128 /* We can't store directly to *out as it may be unaligned. */ 136 /* We can't store directly to *out as it may be unaligned. */
129 /* BTW Don't reduce the buffer size below 128 Bytes! 137 /* BTW Don't reduce the buffer size below 128 Bytes!
130 * PadLock microcode needs it that big. */ 138 * PadLock microcode needs it that big. */
131 char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); 139 char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__
140 ((aligned(STACK_ALIGN)));
141 char *result = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
132 struct padlock_sha_desc *dctx = shash_desc_ctx(desc); 142 struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
133 struct sha256_state state; 143 struct sha256_state state;
134 unsigned int space; 144 unsigned int space;
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 4f4ac82382f7..d4560d9d5a83 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1122,7 +1122,7 @@ static void k8_read_dram_base_limit(struct amd64_pvt *pvt, int dram)
1122 debugf0("Reading K8_DRAM_BASE_LOW failed\n"); 1122 debugf0("Reading K8_DRAM_BASE_LOW failed\n");
1123 1123
1124 /* Extract parts into separate data entries */ 1124 /* Extract parts into separate data entries */
1125 pvt->dram_base[dram] = ((u64) low & 0xFFFF0000) << 24; 1125 pvt->dram_base[dram] = ((u64) low & 0xFFFF0000) << 8;
1126 pvt->dram_IntlvEn[dram] = (low >> 8) & 0x7; 1126 pvt->dram_IntlvEn[dram] = (low >> 8) & 0x7;
1127 pvt->dram_rw_en[dram] = (low & 0x3); 1127 pvt->dram_rw_en[dram] = (low & 0x3);
1128 1128
@@ -1135,7 +1135,7 @@ static void k8_read_dram_base_limit(struct amd64_pvt *pvt, int dram)
1135 * Extract parts into separate data entries. Limit is the HIGHEST memory 1135 * Extract parts into separate data entries. Limit is the HIGHEST memory
1136 * location of the region, so lower 24 bits need to be all ones 1136 * location of the region, so lower 24 bits need to be all ones
1137 */ 1137 */
1138 pvt->dram_limit[dram] = (((u64) low & 0xFFFF0000) << 24) | 0x00FFFFFF; 1138 pvt->dram_limit[dram] = (((u64) low & 0xFFFF0000) << 8) | 0x00FFFFFF;
1139 pvt->dram_IntlvSel[dram] = (low >> 8) & 0x7; 1139 pvt->dram_IntlvSel[dram] = (low >> 8) & 0x7;
1140 pvt->dram_DstNode[dram] = (low & 0x7); 1140 pvt->dram_DstNode[dram] = (low & 0x7);
1141} 1141}
@@ -1369,7 +1369,7 @@ static void f10_read_dram_base_limit(struct amd64_pvt *pvt, int dram)
1369 pvt->dram_IntlvEn[dram] = (low_base >> 8) & 0x7; 1369 pvt->dram_IntlvEn[dram] = (low_base >> 8) & 0x7;
1370 1370
1371 pvt->dram_base[dram] = (((u64)high_base & 0x000000FF) << 40) | 1371 pvt->dram_base[dram] = (((u64)high_base & 0x000000FF) << 40) |
1372 (((u64)low_base & 0xFFFF0000) << 24); 1372 (((u64)low_base & 0xFFFF0000) << 8);
1373 1373
1374 low_offset = K8_DRAM_LIMIT_LOW + (dram << 3); 1374 low_offset = K8_DRAM_LIMIT_LOW + (dram << 3);
1375 high_offset = F10_DRAM_LIMIT_HIGH + (dram << 3); 1375 high_offset = F10_DRAM_LIMIT_HIGH + (dram << 3);
@@ -1391,7 +1391,7 @@ static void f10_read_dram_base_limit(struct amd64_pvt *pvt, int dram)
1391 * memory location of the region, so low 24 bits need to be all ones. 1391 * memory location of the region, so low 24 bits need to be all ones.
1392 */ 1392 */
1393 pvt->dram_limit[dram] = (((u64)high_limit & 0x000000FF) << 40) | 1393 pvt->dram_limit[dram] = (((u64)high_limit & 0x000000FF) << 40) |
1394 (((u64) low_limit & 0xFFFF0000) << 24) | 1394 (((u64) low_limit & 0xFFFF0000) << 8) |
1395 0x00FFFFFF; 1395 0x00FFFFFF;
1396} 1396}
1397 1397
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index d335086f4a26..77a9579d7167 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1173,7 +1173,7 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci)
1173 pci_read_config_word(pvt->branch_1, where, 1173 pci_read_config_word(pvt->branch_1, where,
1174 &pvt->b1_mtr[slot_row]); 1174 &pvt->b1_mtr[slot_row]);
1175 debugf2("MTR%d where=0x%x B1 value=0x%x\n", slot_row, 1175 debugf2("MTR%d where=0x%x B1 value=0x%x\n", slot_row,
1176 where, pvt->b0_mtr[slot_row]); 1176 where, pvt->b1_mtr[slot_row]);
1177 } else { 1177 } else {
1178 pvt->b1_mtr[slot_row] = 0; 1178 pvt->b1_mtr[slot_row] = 0;
1179 } 1179 }
@@ -1232,7 +1232,7 @@ static int i5000_init_csrows(struct mem_ctl_info *mci)
1232 struct csrow_info *p_csrow; 1232 struct csrow_info *p_csrow;
1233 int empty, channel_count; 1233 int empty, channel_count;
1234 int max_csrows; 1234 int max_csrows;
1235 int mtr; 1235 int mtr, mtr1;
1236 int csrow_megs; 1236 int csrow_megs;
1237 int channel; 1237 int channel;
1238 int csrow; 1238 int csrow;
@@ -1251,9 +1251,10 @@ static int i5000_init_csrows(struct mem_ctl_info *mci)
1251 1251
1252 /* use branch 0 for the basis */ 1252 /* use branch 0 for the basis */
1253 mtr = pvt->b0_mtr[csrow >> 1]; 1253 mtr = pvt->b0_mtr[csrow >> 1];
1254 mtr1 = pvt->b1_mtr[csrow >> 1];
1254 1255
1255 /* if no DIMMS on this row, continue */ 1256 /* if no DIMMS on this row, continue */
1256 if (!MTR_DIMMS_PRESENT(mtr)) 1257 if (!MTR_DIMMS_PRESENT(mtr) && !MTR_DIMMS_PRESENT(mtr1))
1257 continue; 1258 continue;
1258 1259
1259 /* FAKE OUT VALUES, FIXME */ 1260 /* FAKE OUT VALUES, FIXME */
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c
index b08b6d8e2dc7..f99d10655ed4 100644
--- a/drivers/edac/i5400_edac.c
+++ b/drivers/edac/i5400_edac.c
@@ -46,9 +46,10 @@
46/* Limits for i5400 */ 46/* Limits for i5400 */
47#define NUM_MTRS_PER_BRANCH 4 47#define NUM_MTRS_PER_BRANCH 4
48#define CHANNELS_PER_BRANCH 2 48#define CHANNELS_PER_BRANCH 2
49#define MAX_DIMMS_PER_CHANNEL NUM_MTRS_PER_BRANCH
49#define MAX_CHANNELS 4 50#define MAX_CHANNELS 4
50#define MAX_DIMMS (MAX_CHANNELS * 4) /* Up to 4 DIMM's per channel */ 51/* max possible csrows per channel */
51#define MAX_CSROWS (MAX_DIMMS * 2) /* max possible csrows per channel */ 52#define MAX_CSROWS (MAX_DIMMS_PER_CHANNEL)
52 53
53/* Device 16, 54/* Device 16,
54 * Function 0: System Address 55 * Function 0: System Address
@@ -331,7 +332,6 @@ static const struct i5400_dev_info i5400_devs[] = {
331 332
332struct i5400_dimm_info { 333struct i5400_dimm_info {
333 int megabytes; /* size, 0 means not present */ 334 int megabytes; /* size, 0 means not present */
334 int dual_rank;
335}; 335};
336 336
337/* driver private data structure */ 337/* driver private data structure */
@@ -849,11 +849,9 @@ static int determine_mtr(struct i5400_pvt *pvt, int csrow, int channel)
849 int n; 849 int n;
850 850
851 /* There is one MTR for each slot pair of FB-DIMMs, 851 /* There is one MTR for each slot pair of FB-DIMMs,
852 Each slot may have one or two ranks (2 csrows),
853 Each slot pair may be at branch 0 or branch 1. 852 Each slot pair may be at branch 0 or branch 1.
854 So, csrow should be divided by eight
855 */ 853 */
856 n = csrow >> 3; 854 n = csrow;
857 855
858 if (n >= NUM_MTRS_PER_BRANCH) { 856 if (n >= NUM_MTRS_PER_BRANCH) {
859 debugf0("ERROR: trying to access an invalid csrow: %d\n", 857 debugf0("ERROR: trying to access an invalid csrow: %d\n",
@@ -905,25 +903,22 @@ static void handle_channel(struct i5400_pvt *pvt, int csrow, int channel,
905 amb_present_reg = determine_amb_present_reg(pvt, channel); 903 amb_present_reg = determine_amb_present_reg(pvt, channel);
906 904
907 /* Determine if there is a DIMM present in this DIMM slot */ 905 /* Determine if there is a DIMM present in this DIMM slot */
908 if (amb_present_reg & (1 << (csrow >> 1))) { 906 if (amb_present_reg & (1 << csrow)) {
909 dinfo->dual_rank = MTR_DIMM_RANK(mtr); 907 /* Start with the number of bits for a Bank
910 908 * on the DRAM */
911 if (!((dinfo->dual_rank == 0) && 909 addrBits = MTR_DRAM_BANKS_ADDR_BITS(mtr);
912 ((csrow & 0x1) == 0x1))) { 910 /* Add thenumber of ROW bits */
913 /* Start with the number of bits for a Bank 911 addrBits += MTR_DIMM_ROWS_ADDR_BITS(mtr);
914 * on the DRAM */ 912 /* add the number of COLUMN bits */
915 addrBits = MTR_DRAM_BANKS_ADDR_BITS(mtr); 913 addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr);
916 /* Add thenumber of ROW bits */ 914 /* add the number of RANK bits */
917 addrBits += MTR_DIMM_ROWS_ADDR_BITS(mtr); 915 addrBits += MTR_DIMM_RANK(mtr);
918 /* add the number of COLUMN bits */ 916
919 addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr); 917 addrBits += 6; /* add 64 bits per DIMM */
920 918 addrBits -= 20; /* divide by 2^^20 */
921 addrBits += 6; /* add 64 bits per DIMM */ 919 addrBits -= 3; /* 8 bits per bytes */
922 addrBits -= 20; /* divide by 2^^20 */ 920
923 addrBits -= 3; /* 8 bits per bytes */ 921 dinfo->megabytes = 1 << addrBits;
924
925 dinfo->megabytes = 1 << addrBits;
926 }
927 } 922 }
928 } 923 }
929} 924}
@@ -951,12 +946,12 @@ static void calculate_dimm_size(struct i5400_pvt *pvt)
951 return; 946 return;
952 } 947 }
953 948
954 /* Scan all the actual CSROWS (which is # of DIMMS * 2) 949 /* Scan all the actual CSROWS
955 * and calculate the information for each DIMM 950 * and calculate the information for each DIMM
956 * Start with the highest csrow first, to display it first 951 * Start with the highest csrow first, to display it first
957 * and work toward the 0th csrow 952 * and work toward the 0th csrow
958 */ 953 */
959 max_csrows = pvt->maxdimmperch * 2; 954 max_csrows = pvt->maxdimmperch;
960 for (csrow = max_csrows - 1; csrow >= 0; csrow--) { 955 for (csrow = max_csrows - 1; csrow >= 0; csrow--) {
961 956
962 /* on an odd csrow, first output a 'boundary' marker, 957 /* on an odd csrow, first output a 'boundary' marker,
@@ -1064,7 +1059,7 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci)
1064 1059
1065 /* Get the set of MTR[0-3] regs by each branch */ 1060 /* Get the set of MTR[0-3] regs by each branch */
1066 for (slot_row = 0; slot_row < NUM_MTRS_PER_BRANCH; slot_row++) { 1061 for (slot_row = 0; slot_row < NUM_MTRS_PER_BRANCH; slot_row++) {
1067 int where = MTR0 + (slot_row * sizeof(u32)); 1062 int where = MTR0 + (slot_row * sizeof(u16));
1068 1063
1069 /* Branch 0 set of MTR registers */ 1064 /* Branch 0 set of MTR registers */
1070 pci_read_config_word(pvt->branch_0, where, 1065 pci_read_config_word(pvt->branch_0, where,
@@ -1146,7 +1141,7 @@ static int i5400_init_csrows(struct mem_ctl_info *mci)
1146 pvt = mci->pvt_info; 1141 pvt = mci->pvt_info;
1147 1142
1148 channel_count = pvt->maxch; 1143 channel_count = pvt->maxch;
1149 max_csrows = pvt->maxdimmperch * 2; 1144 max_csrows = pvt->maxdimmperch;
1150 1145
1151 empty = 1; /* Assume NO memory */ 1146 empty = 1; /* Assume NO memory */
1152 1147
@@ -1215,28 +1210,6 @@ static void i5400_enable_error_reporting(struct mem_ctl_info *mci)
1215} 1210}
1216 1211
1217/* 1212/*
1218 * i5400_get_dimm_and_channel_counts(pdev, &num_csrows, &num_channels)
1219 *
1220 * ask the device how many channels are present and how many CSROWS
1221 * as well
1222 */
1223static void i5400_get_dimm_and_channel_counts(struct pci_dev *pdev,
1224 int *num_dimms_per_channel,
1225 int *num_channels)
1226{
1227 u8 value;
1228
1229 /* Need to retrieve just how many channels and dimms per channel are
1230 * supported on this memory controller
1231 */
1232 pci_read_config_byte(pdev, MAXDIMMPERCH, &value);
1233 *num_dimms_per_channel = (int)value * 2;
1234
1235 pci_read_config_byte(pdev, MAXCH, &value);
1236 *num_channels = (int)value;
1237}
1238
1239/*
1240 * i5400_probe1 Probe for ONE instance of device to see if it is 1213 * i5400_probe1 Probe for ONE instance of device to see if it is
1241 * present. 1214 * present.
1242 * return: 1215 * return:
@@ -1263,22 +1236,16 @@ static int i5400_probe1(struct pci_dev *pdev, int dev_idx)
1263 if (PCI_FUNC(pdev->devfn) != 0) 1236 if (PCI_FUNC(pdev->devfn) != 0)
1264 return -ENODEV; 1237 return -ENODEV;
1265 1238
1266 /* Ask the devices for the number of CSROWS and CHANNELS so 1239 /* As we don't have a motherboard identification routine to determine
1267 * that we can calculate the memory resources, etc
1268 *
1269 * The Chipset will report what it can handle which will be greater
1270 * or equal to what the motherboard manufacturer will implement.
1271 *
1272 * As we don't have a motherboard identification routine to determine
1273 * actual number of slots/dimms per channel, we thus utilize the 1240 * actual number of slots/dimms per channel, we thus utilize the
1274 * resource as specified by the chipset. Thus, we might have 1241 * resource as specified by the chipset. Thus, we might have
1275 * have more DIMMs per channel than actually on the mobo, but this 1242 * have more DIMMs per channel than actually on the mobo, but this
1276 * allows the driver to support upto the chipset max, without 1243 * allows the driver to support upto the chipset max, without
1277 * some fancy mobo determination. 1244 * some fancy mobo determination.
1278 */ 1245 */
1279 i5400_get_dimm_and_channel_counts(pdev, &num_dimms_per_channel, 1246 num_dimms_per_channel = MAX_DIMMS_PER_CHANNEL;
1280 &num_channels); 1247 num_channels = MAX_CHANNELS;
1281 num_csrows = num_dimms_per_channel * 2; 1248 num_csrows = num_dimms_per_channel;
1282 1249
1283 debugf0("MC: %s(): Number of - Channels= %d DIMMS= %d CSROWS= %d\n", 1250 debugf0("MC: %s(): Number of - Channels= %d DIMMS= %d CSROWS= %d\n",
1284 __func__, num_channels, num_dimms_per_channel, num_csrows); 1251 __func__, num_channels, num_dimms_per_channel, num_csrows);
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 157f6504f25e..cf27402af97b 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -26,7 +26,9 @@
26#include "mpc85xx_edac.h" 26#include "mpc85xx_edac.h"
27 27
28static int edac_dev_idx; 28static int edac_dev_idx;
29#ifdef CONFIG_PCI
29static int edac_pci_idx; 30static int edac_pci_idx;
31#endif
30static int edac_mc_idx; 32static int edac_mc_idx;
31 33
32static u32 orig_ddr_err_disable; 34static u32 orig_ddr_err_disable;
diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c
index afad14792141..49384a7c5492 100644
--- a/drivers/gpio/twl4030-gpio.c
+++ b/drivers/gpio/twl4030-gpio.c
@@ -460,7 +460,8 @@ no_irqs:
460 return ret; 460 return ret;
461} 461}
462 462
463static int __devexit gpio_twl4030_remove(struct platform_device *pdev) 463/* Cannot use __devexit as gpio_twl4030_probe() calls us */
464static int gpio_twl4030_remove(struct platform_device *pdev)
464{ 465{
465 struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; 466 struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data;
466 int status; 467 int status;
@@ -493,7 +494,7 @@ static struct platform_driver gpio_twl4030_driver = {
493 .driver.name = "twl4030_gpio", 494 .driver.name = "twl4030_gpio",
494 .driver.owner = THIS_MODULE, 495 .driver.owner = THIS_MODULE,
495 .probe = gpio_twl4030_probe, 496 .probe = gpio_twl4030_probe,
496 .remove = __devexit_p(gpio_twl4030_remove), 497 .remove = gpio_twl4030_remove,
497}; 498};
498 499
499static int __init gpio_twl4030_init(void) 500static int __init gpio_twl4030_init(void)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3c0d2b3aed76..cea665d86dd3 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -626,6 +626,12 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
626 return NULL; 626 return NULL;
627 } 627 }
628 628
629 /* it is incorrect if hsync/vsync width is zero */
630 if (!hsync_pulse_width || !vsync_pulse_width) {
631 DRM_DEBUG_KMS("Incorrect Detailed timing. "
632 "Wrong Hsync/Vsync pulse width\n");
633 return NULL;
634 }
629 mode = drm_mode_create(dev); 635 mode = drm_mode_create(dev);
630 if (!mode) 636 if (!mode)
631 return NULL; 637 return NULL;
@@ -647,6 +653,15 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
647 mode->vsync_end = mode->vsync_start + vsync_pulse_width; 653 mode->vsync_end = mode->vsync_start + vsync_pulse_width;
648 mode->vtotal = mode->vdisplay + vblank; 654 mode->vtotal = mode->vdisplay + vblank;
649 655
656 /* perform the basic check for the detailed timing */
657 if (mode->hsync_end > mode->htotal ||
658 mode->vsync_end > mode->vtotal) {
659 drm_mode_destroy(dev, mode);
660 DRM_DEBUG_KMS("Incorrect detailed timing. "
661 "Sync is beyond the blank.\n");
662 return NULL;
663 }
664
650 drm_mode_set_name(mode); 665 drm_mode_set_name(mode);
651 666
652 if (pt->misc & DRM_EDID_PT_INTERLACED) 667 if (pt->misc & DRM_EDID_PT_INTERLACED)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 23dc9c115fd9..9c924614c418 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -454,22 +454,39 @@ out_free:
454} 454}
455EXPORT_SYMBOL(drm_fb_helper_init_crtc_count); 455EXPORT_SYMBOL(drm_fb_helper_init_crtc_count);
456 456
457static void setcolreg(struct drm_crtc *crtc, u16 red, u16 green, 457static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
458 u16 blue, u16 regno, struct fb_info *info) 458 u16 blue, u16 regno, struct fb_info *info)
459{ 459{
460 struct drm_fb_helper *fb_helper = info->par; 460 struct drm_fb_helper *fb_helper = info->par;
461 struct drm_framebuffer *fb = fb_helper->fb; 461 struct drm_framebuffer *fb = fb_helper->fb;
462 int pindex; 462 int pindex;
463 463
464 if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
465 u32 *palette;
466 u32 value;
467 /* place color in psuedopalette */
468 if (regno > 16)
469 return -EINVAL;
470 palette = (u32 *)info->pseudo_palette;
471 red >>= (16 - info->var.red.length);
472 green >>= (16 - info->var.green.length);
473 blue >>= (16 - info->var.blue.length);
474 value = (red << info->var.red.offset) |
475 (green << info->var.green.offset) |
476 (blue << info->var.blue.offset);
477 palette[regno] = value;
478 return 0;
479 }
480
464 pindex = regno; 481 pindex = regno;
465 482
466 if (fb->bits_per_pixel == 16) { 483 if (fb->bits_per_pixel == 16) {
467 pindex = regno << 3; 484 pindex = regno << 3;
468 485
469 if (fb->depth == 16 && regno > 63) 486 if (fb->depth == 16 && regno > 63)
470 return; 487 return -EINVAL;
471 if (fb->depth == 15 && regno > 31) 488 if (fb->depth == 15 && regno > 31)
472 return; 489 return -EINVAL;
473 490
474 if (fb->depth == 16) { 491 if (fb->depth == 16) {
475 u16 r, g, b; 492 u16 r, g, b;
@@ -493,13 +510,7 @@ static void setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
493 510
494 if (fb->depth != 16) 511 if (fb->depth != 16)
495 fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex); 512 fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex);
496 513 return 0;
497 if (regno < 16 && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
498 ((u32 *) fb->pseudo_palette)[regno] =
499 (regno << info->var.red.offset) |
500 (regno << info->var.green.offset) |
501 (regno << info->var.blue.offset);
502 }
503} 514}
504 515
505int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) 516int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
@@ -536,7 +547,9 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
536 if (transp) 547 if (transp)
537 htransp = *transp++; 548 htransp = *transp++;
538 549
539 setcolreg(crtc, hred, hgreen, hblue, start++, info); 550 rc = setcolreg(crtc, hred, hgreen, hblue, start++, info);
551 if (rc)
552 return rc;
540 } 553 }
541 crtc_funcs->load_lut(crtc); 554 crtc_funcs->load_lut(crtc);
542 } 555 }
@@ -555,6 +568,7 @@ int drm_fb_helper_setcolreg(unsigned regno,
555 struct drm_device *dev = fb_helper->dev; 568 struct drm_device *dev = fb_helper->dev;
556 struct drm_crtc *crtc; 569 struct drm_crtc *crtc;
557 int i; 570 int i;
571 int ret;
558 572
559 if (regno > 255) 573 if (regno > 255)
560 return 1; 574 return 1;
@@ -568,8 +582,10 @@ int drm_fb_helper_setcolreg(unsigned regno,
568 if (i == fb_helper->crtc_count) 582 if (i == fb_helper->crtc_count)
569 continue; 583 continue;
570 584
585 ret = setcolreg(crtc, red, green, blue, regno, info);
586 if (ret)
587 return ret;
571 588
572 setcolreg(crtc, red, green, blue, regno, info);
573 crtc_funcs->load_lut(crtc); 589 crtc_funcs->load_lut(crtc);
574 } 590 }
575 return 0; 591 return 0;
@@ -928,7 +944,7 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
928{ 944{
929 info->fix.type = FB_TYPE_PACKED_PIXELS; 945 info->fix.type = FB_TYPE_PACKED_PIXELS;
930 info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR : 946 info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR :
931 FB_VISUAL_DIRECTCOLOR; 947 FB_VISUAL_TRUECOLOR;
932 info->fix.type_aux = 0; 948 info->fix.type_aux = 0;
933 info->fix.xpanstep = 1; /* doing it in hw */ 949 info->fix.xpanstep = 1; /* doing it in hw */
934 info->fix.ypanstep = 1; /* doing it in hw */ 950 info->fix.ypanstep = 1; /* doing it in hw */
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index b93814c0d3e2..7f436ec075f6 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -89,7 +89,8 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
89 pci_set_power_state(dev->pdev, PCI_D3hot); 89 pci_set_power_state(dev->pdev, PCI_D3hot);
90 } 90 }
91 91
92 dev_priv->suspended = 1; 92 /* Modeset on resume, not lid events */
93 dev_priv->modeset_on_lid = 0;
93 94
94 return 0; 95 return 0;
95} 96}
@@ -124,7 +125,7 @@ static int i915_resume(struct drm_device *dev)
124 drm_helper_resume_force_mode(dev); 125 drm_helper_resume_force_mode(dev);
125 } 126 }
126 127
127 dev_priv->suspended = 0; 128 dev_priv->modeset_on_lid = 0;
128 129
129 return ret; 130 return ret;
130} 131}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6035d3dae851..c5df2234418d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -274,7 +274,7 @@ typedef struct drm_i915_private {
274 struct drm_i915_display_funcs display; 274 struct drm_i915_display_funcs display;
275 275
276 /* Register state */ 276 /* Register state */
277 bool suspended; 277 bool modeset_on_lid;
278 u8 saveLBB; 278 u8 saveLBB;
279 u32 saveDSPACNTR; 279 u32 saveDSPACNTR;
280 u32 saveDSPBCNTR; 280 u32 saveDSPBCNTR;
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 98ae3d73577e..808bbe412ba8 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -656,6 +656,15 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
656 return 0; 656 return 0;
657} 657}
658 658
659/*
660 * Lid events. Note the use of 'modeset_on_lid':
661 * - we set it on lid close, and reset it on open
662 * - we use it as a "only once" bit (ie we ignore
663 * duplicate events where it was already properly
664 * set/reset)
665 * - the suspend/resume paths will also set it to
666 * zero, since they restore the mode ("lid open").
667 */
659static int intel_lid_notify(struct notifier_block *nb, unsigned long val, 668static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
660 void *unused) 669 void *unused)
661{ 670{
@@ -663,13 +672,19 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
663 container_of(nb, struct drm_i915_private, lid_notifier); 672 container_of(nb, struct drm_i915_private, lid_notifier);
664 struct drm_device *dev = dev_priv->dev; 673 struct drm_device *dev = dev_priv->dev;
665 674
666 if (acpi_lid_open() && !dev_priv->suspended) { 675 if (!acpi_lid_open()) {
667 mutex_lock(&dev->mode_config.mutex); 676 dev_priv->modeset_on_lid = 1;
668 drm_helper_resume_force_mode(dev); 677 return NOTIFY_OK;
669 mutex_unlock(&dev->mode_config.mutex);
670 } 678 }
671 679
672 drm_sysfs_hotplug_event(dev_priv->dev); 680 if (!dev_priv->modeset_on_lid)
681 return NOTIFY_OK;
682
683 dev_priv->modeset_on_lid = 0;
684
685 mutex_lock(&dev->mode_config.mutex);
686 drm_helper_resume_force_mode(dev);
687 mutex_unlock(&dev->mode_config.mutex);
673 688
674 return NOTIFY_OK; 689 return NOTIFY_OK;
675} 690}
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 3d667031de6e..df988142e6b0 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -582,10 +582,9 @@ int radeon_device_init(struct radeon_device *rdev,
582 DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size); 582 DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size);
583 583
584 /* if we have > 1 VGA cards, then disable the radeon VGA resources */ 584 /* if we have > 1 VGA cards, then disable the radeon VGA resources */
585 r = vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); 585 /* this will fail for cards that aren't VGA class devices, just
586 if (r) { 586 * ignore it */
587 return -EINVAL; 587 vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
588 }
589 588
590 r = radeon_init(rdev); 589 r = radeon_init(rdev);
591 if (r) 590 if (r)
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index 2c2cb1ec94c5..27d62574284f 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -572,7 +572,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
572 572
573 /* Sample register contents every 1 sec */ 573 /* Sample register contents every 1 sec */
574 if (time_after(jiffies, data->last_update + HZ) || !data->valid) { 574 if (time_after(jiffies, data->last_update + HZ) || !data->valid) {
575 if (data->type != sch5027) { 575 if (data->type == dme1737) {
576 data->vid = dme1737_read(data, DME1737_REG_VID) & 576 data->vid = dme1737_read(data, DME1737_REG_VID) &
577 0x3f; 577 0x3f;
578 } 578 }
@@ -1621,9 +1621,6 @@ static struct attribute *dme1737_misc_attr[] = {
1621 &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, 1621 &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
1622 &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, 1622 &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
1623 &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, 1623 &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
1624 /* Misc */
1625 &dev_attr_vrm.attr,
1626 &dev_attr_cpu0_vid.attr,
1627 NULL 1624 NULL
1628}; 1625};
1629 1626
@@ -1631,6 +1628,18 @@ static const struct attribute_group dme1737_misc_group = {
1631 .attrs = dme1737_misc_attr, 1628 .attrs = dme1737_misc_attr,
1632}; 1629};
1633 1630
1631/* The following struct holds VID-related attributes. Their creation
1632 depends on the chip type which is determined during module load. */
1633static struct attribute *dme1737_vid_attr[] = {
1634 &dev_attr_vrm.attr,
1635 &dev_attr_cpu0_vid.attr,
1636 NULL
1637};
1638
1639static const struct attribute_group dme1737_vid_group = {
1640 .attrs = dme1737_vid_attr,
1641};
1642
1634/* The following structs hold the PWM attributes, some of which are optional. 1643/* The following structs hold the PWM attributes, some of which are optional.
1635 * Their creation depends on the chip configuration which is determined during 1644 * Their creation depends on the chip configuration which is determined during
1636 * module load. */ 1645 * module load. */
@@ -1902,6 +1911,9 @@ static void dme1737_remove_files(struct device *dev)
1902 if (data->type != sch5027) { 1911 if (data->type != sch5027) {
1903 sysfs_remove_group(&dev->kobj, &dme1737_misc_group); 1912 sysfs_remove_group(&dev->kobj, &dme1737_misc_group);
1904 } 1913 }
1914 if (data->type == dme1737) {
1915 sysfs_remove_group(&dev->kobj, &dme1737_vid_group);
1916 }
1905 1917
1906 sysfs_remove_group(&dev->kobj, &dme1737_group); 1918 sysfs_remove_group(&dev->kobj, &dme1737_group);
1907 1919
@@ -1933,6 +1945,13 @@ static int dme1737_create_files(struct device *dev)
1933 goto exit_remove; 1945 goto exit_remove;
1934 } 1946 }
1935 1947
1948 /* Create VID-related sysfs attributes */
1949 if ((data->type == dme1737) &&
1950 (err = sysfs_create_group(&dev->kobj,
1951 &dme1737_vid_group))) {
1952 goto exit_remove;
1953 }
1954
1936 /* Create fan sysfs attributes */ 1955 /* Create fan sysfs attributes */
1937 for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { 1956 for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
1938 if (data->has_fan & (1 << ix)) { 1957 if (data->has_fan & (1 << ix)) {
@@ -2127,7 +2146,7 @@ static int dme1737_init_device(struct device *dev)
2127 data->pwm_acz[2] = 4; /* pwm3 -> zone3 */ 2146 data->pwm_acz[2] = 4; /* pwm3 -> zone3 */
2128 2147
2129 /* Set VRM */ 2148 /* Set VRM */
2130 if (data->type != sch5027) { 2149 if (data->type == dme1737) {
2131 data->vrm = vid_which_vrm(); 2150 data->vrm = vid_which_vrm();
2132 } 2151 }
2133 2152
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index 2a7a85a6dc36..da1b1f9488af 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -819,7 +819,7 @@ static int watchdog_release(struct inode *inode, struct file *filp)
819static ssize_t watchdog_write(struct file *filp, const char __user *buf, 819static ssize_t watchdog_write(struct file *filp, const char __user *buf,
820 size_t count, loff_t *offset) 820 size_t count, loff_t *offset)
821{ 821{
822 size_t ret; 822 int ret;
823 struct fschmd_data *data = filp->private_data; 823 struct fschmd_data *data = filp->private_data;
824 824
825 if (count) { 825 if (count) {
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index 6679854c85b0..be475e844c2a 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -197,11 +197,13 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
197 AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left), 197 AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left),
198 AXIS_DMI_MATCH("HP2140", "HP 2140", xy_swap_inverted), 198 AXIS_DMI_MATCH("HP2140", "HP 2140", xy_swap_inverted),
199 AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd), 199 AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd),
200 AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), 200 AXIS_DMI_MATCH("NC6730b", "HP Compaq 6730b", xy_rotated_left_usd),
201 AXIS_DMI_MATCH("NC6730s", "HP Compaq 6730s", xy_swap),
201 AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), 202 AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
202 AXIS_DMI_MATCH("NC6710x", "HP Compaq 6710", xy_swap_yz_inverted), 203 AXIS_DMI_MATCH("NC6710x", "HP Compaq 6710", xy_swap_yz_inverted),
203 AXIS_DMI_MATCH("NC6715x", "HP Compaq 6715", y_inverted), 204 AXIS_DMI_MATCH("NC6715x", "HP Compaq 6715", y_inverted),
204 AXIS_DMI_MATCH("NC693xx", "HP EliteBook 693", xy_rotated_right), 205 AXIS_DMI_MATCH("NC693xx", "HP EliteBook 693", xy_rotated_right),
206 AXIS_DMI_MATCH("NC693xx", "HP EliteBook 853", xy_swap),
205 /* Intel-based HP Pavilion dv5 */ 207 /* Intel-based HP Pavilion dv5 */
206 AXIS_DMI_MATCH2("HPDV5_I", 208 AXIS_DMI_MATCH2("HPDV5_I",
207 PRODUCT_NAME, "HP Pavilion dv5", 209 PRODUCT_NAME, "HP Pavilion dv5",
@@ -214,6 +216,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
214 y_inverted), 216 y_inverted),
215 AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted), 217 AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted),
216 AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted), 218 AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted),
219 AXIS_DMI_MATCH("HDX18", "HP HDX 18", x_inverted),
217 { NULL, } 220 { NULL, }
218/* Laptop models without axis info (yet): 221/* Laptop models without axis info (yet):
219 * "NC6910" "HP Compaq 6910" 222 * "NC6910" "HP Compaq 6910"
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index ffeb2a10e1a7..a3749cb0f181 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1028,12 +1028,11 @@ static int __init it87_find(unsigned short *address,
1028 chip_type, *address, sio_data->revision); 1028 chip_type, *address, sio_data->revision);
1029 1029
1030 /* Read GPIO config and VID value from LDN 7 (GPIO) */ 1030 /* Read GPIO config and VID value from LDN 7 (GPIO) */
1031 if (chip_type != IT8705F_DEVID) { 1031 if (sio_data->type != it87) {
1032 int reg; 1032 int reg;
1033 1033
1034 superio_select(GPIO); 1034 superio_select(GPIO);
1035 if ((chip_type == it8718) || 1035 if (sio_data->type == it8718 || sio_data->type == it8720)
1036 (chip_type == it8720))
1037 sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); 1036 sio_data->vid_value = superio_inb(IT87_SIO_VID_REG);
1038 1037
1039 reg = superio_inb(IT87_SIO_PINX2_REG); 1038 reg = superio_inb(IT87_SIO_PINX2_REG);
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 4afba3ec2a61..e3654d683e15 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -120,19 +120,26 @@ struct imx_i2c_struct {
120 wait_queue_head_t queue; 120 wait_queue_head_t queue;
121 unsigned long i2csr; 121 unsigned long i2csr;
122 unsigned int disable_delay; 122 unsigned int disable_delay;
123 int stopped;
124 unsigned int ifdr; /* IMX_I2C_IFDR */
123}; 125};
124 126
125/** Functions for IMX I2C adapter driver *************************************** 127/** Functions for IMX I2C adapter driver ***************************************
126*******************************************************************************/ 128*******************************************************************************/
127 129
128static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx) 130static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
129{ 131{
130 unsigned long orig_jiffies = jiffies; 132 unsigned long orig_jiffies = jiffies;
133 unsigned int temp;
131 134
132 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); 135 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
133 136
134 /* wait for bus not busy */ 137 while (1) {
135 while (readb(i2c_imx->base + IMX_I2C_I2SR) & I2SR_IBB) { 138 temp = readb(i2c_imx->base + IMX_I2C_I2SR);
139 if (for_busy && (temp & I2SR_IBB))
140 break;
141 if (!for_busy && !(temp & I2SR_IBB))
142 break;
136 if (signal_pending(current)) { 143 if (signal_pending(current)) {
137 dev_dbg(&i2c_imx->adapter.dev, 144 dev_dbg(&i2c_imx->adapter.dev,
138 "<%s> I2C Interrupted\n", __func__); 145 "<%s> I2C Interrupted\n", __func__);
@@ -179,41 +186,62 @@ static int i2c_imx_acked(struct imx_i2c_struct *i2c_imx)
179 return 0; 186 return 0;
180} 187}
181 188
182static void i2c_imx_start(struct imx_i2c_struct *i2c_imx) 189static int i2c_imx_start(struct imx_i2c_struct *i2c_imx)
183{ 190{
184 unsigned int temp = 0; 191 unsigned int temp = 0;
192 int result;
185 193
186 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); 194 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
187 195
196 clk_enable(i2c_imx->clk);
197 writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR);
188 /* Enable I2C controller */ 198 /* Enable I2C controller */
199 writeb(0, i2c_imx->base + IMX_I2C_I2SR);
189 writeb(I2CR_IEN, i2c_imx->base + IMX_I2C_I2CR); 200 writeb(I2CR_IEN, i2c_imx->base + IMX_I2C_I2CR);
201
202 /* Wait controller to be stable */
203 udelay(50);
204
190 /* Start I2C transaction */ 205 /* Start I2C transaction */
191 temp = readb(i2c_imx->base + IMX_I2C_I2CR); 206 temp = readb(i2c_imx->base + IMX_I2C_I2CR);
192 temp |= I2CR_MSTA; 207 temp |= I2CR_MSTA;
193 writeb(temp, i2c_imx->base + IMX_I2C_I2CR); 208 writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
209 result = i2c_imx_bus_busy(i2c_imx, 1);
210 if (result)
211 return result;
212 i2c_imx->stopped = 0;
213
194 temp |= I2CR_IIEN | I2CR_MTX | I2CR_TXAK; 214 temp |= I2CR_IIEN | I2CR_MTX | I2CR_TXAK;
195 writeb(temp, i2c_imx->base + IMX_I2C_I2CR); 215 writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
216 return result;
196} 217}
197 218
198static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) 219static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
199{ 220{
200 unsigned int temp = 0; 221 unsigned int temp = 0;
201 222
202 /* Stop I2C transaction */ 223 if (!i2c_imx->stopped) {
203 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); 224 /* Stop I2C transaction */
204 temp = readb(i2c_imx->base + IMX_I2C_I2CR); 225 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
205 temp &= ~I2CR_MSTA; 226 temp = readb(i2c_imx->base + IMX_I2C_I2CR);
206 writeb(temp, i2c_imx->base + IMX_I2C_I2CR); 227 temp &= ~(I2CR_MSTA | I2CR_MTX);
207 /* setup chip registers to defaults */ 228 writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
208 writeb(I2CR_IEN, i2c_imx->base + IMX_I2C_I2CR); 229 i2c_imx->stopped = 1;
209 writeb(0, i2c_imx->base + IMX_I2C_I2SR); 230 }
210 /* 231 if (cpu_is_mx1()) {
211 * This delay caused by an i.MXL hardware bug. 232 /*
212 * If no (or too short) delay, no "STOP" bit will be generated. 233 * This delay caused by an i.MXL hardware bug.
213 */ 234 * If no (or too short) delay, no "STOP" bit will be generated.
214 udelay(i2c_imx->disable_delay); 235 */
236 udelay(i2c_imx->disable_delay);
237 }
238
239 if (!i2c_imx->stopped)
240 i2c_imx_bus_busy(i2c_imx, 0);
241
215 /* Disable I2C controller */ 242 /* Disable I2C controller */
216 writeb(0, i2c_imx->base + IMX_I2C_I2CR); 243 writeb(0, i2c_imx->base + IMX_I2C_I2CR);
244 clk_disable(i2c_imx->clk);
217} 245}
218 246
219static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, 247static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
@@ -233,8 +261,8 @@ static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
233 else 261 else
234 for (i = 0; i2c_clk_div[i][0] < div; i++); 262 for (i = 0; i2c_clk_div[i][0] < div; i++);
235 263
236 /* Write divider value to register */ 264 /* Store divider value */
237 writeb(i2c_clk_div[i][1], i2c_imx->base + IMX_I2C_IFDR); 265 i2c_imx->ifdr = i2c_clk_div[i][1];
238 266
239 /* 267 /*
240 * There dummy delay is calculated. 268 * There dummy delay is calculated.
@@ -341,11 +369,15 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs)
341 if (result) 369 if (result)
342 return result; 370 return result;
343 if (i == (msgs->len - 1)) { 371 if (i == (msgs->len - 1)) {
372 /* It must generate STOP before read I2DR to prevent
373 controller from generating another clock cycle */
344 dev_dbg(&i2c_imx->adapter.dev, 374 dev_dbg(&i2c_imx->adapter.dev,
345 "<%s> clear MSTA\n", __func__); 375 "<%s> clear MSTA\n", __func__);
346 temp = readb(i2c_imx->base + IMX_I2C_I2CR); 376 temp = readb(i2c_imx->base + IMX_I2C_I2CR);
347 temp &= ~I2CR_MSTA; 377 temp &= ~(I2CR_MSTA | I2CR_MTX);
348 writeb(temp, i2c_imx->base + IMX_I2C_I2CR); 378 writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
379 i2c_imx_bus_busy(i2c_imx, 0);
380 i2c_imx->stopped = 1;
349 } else if (i == (msgs->len - 2)) { 381 } else if (i == (msgs->len - 2)) {
350 dev_dbg(&i2c_imx->adapter.dev, 382 dev_dbg(&i2c_imx->adapter.dev,
351 "<%s> set TXAK\n", __func__); 383 "<%s> set TXAK\n", __func__);
@@ -370,14 +402,11 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
370 402
371 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); 403 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
372 404
373 /* Check if i2c bus is not busy */ 405 /* Start I2C transfer */
374 result = i2c_imx_bus_busy(i2c_imx); 406 result = i2c_imx_start(i2c_imx);
375 if (result) 407 if (result)
376 goto fail0; 408 goto fail0;
377 409
378 /* Start I2C transfer */
379 i2c_imx_start(i2c_imx);
380
381 /* read/write data */ 410 /* read/write data */
382 for (i = 0; i < num; i++) { 411 for (i = 0; i < num; i++) {
383 if (i) { 412 if (i) {
@@ -386,6 +415,9 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
386 temp = readb(i2c_imx->base + IMX_I2C_I2CR); 415 temp = readb(i2c_imx->base + IMX_I2C_I2CR);
387 temp |= I2CR_RSTA; 416 temp |= I2CR_RSTA;
388 writeb(temp, i2c_imx->base + IMX_I2C_I2CR); 417 writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
418 result = i2c_imx_bus_busy(i2c_imx, 1);
419 if (result)
420 goto fail0;
389 } 421 }
390 dev_dbg(&i2c_imx->adapter.dev, 422 dev_dbg(&i2c_imx->adapter.dev,
391 "<%s> transfer message: %d\n", __func__, i); 423 "<%s> transfer message: %d\n", __func__, i);
@@ -500,7 +532,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
500 dev_err(&pdev->dev, "can't get I2C clock\n"); 532 dev_err(&pdev->dev, "can't get I2C clock\n");
501 goto fail3; 533 goto fail3;
502 } 534 }
503 clk_enable(i2c_imx->clk);
504 535
505 /* Request IRQ */ 536 /* Request IRQ */
506 ret = request_irq(i2c_imx->irq, i2c_imx_isr, 0, pdev->name, i2c_imx); 537 ret = request_irq(i2c_imx->irq, i2c_imx_isr, 0, pdev->name, i2c_imx);
@@ -549,7 +580,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
549fail5: 580fail5:
550 free_irq(i2c_imx->irq, i2c_imx); 581 free_irq(i2c_imx->irq, i2c_imx);
551fail4: 582fail4:
552 clk_disable(i2c_imx->clk);
553 clk_put(i2c_imx->clk); 583 clk_put(i2c_imx->clk);
554fail3: 584fail3:
555 release_mem_region(i2c_imx->res->start, resource_size(res)); 585 release_mem_region(i2c_imx->res->start, resource_size(res));
@@ -586,8 +616,6 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
586 if (pdata && pdata->exit) 616 if (pdata && pdata->exit)
587 pdata->exit(&pdev->dev); 617 pdata->exit(&pdev->dev);
588 618
589 /* Disable I2C clock */
590 clk_disable(i2c_imx->clk);
591 clk_put(i2c_imx->clk); 619 clk_put(i2c_imx->clk);
592 620
593 release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res)); 621 release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res));
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index d325e86e3103..f627001108b8 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -365,9 +365,6 @@ static int mpc_write(struct mpc_i2c *i2c, int target,
365 unsigned timeout = i2c->adap.timeout; 365 unsigned timeout = i2c->adap.timeout;
366 u32 flags = restart ? CCR_RSTA : 0; 366 u32 flags = restart ? CCR_RSTA : 0;
367 367
368 /* Start with MEN */
369 if (!restart)
370 writeccr(i2c, CCR_MEN);
371 /* Start as master */ 368 /* Start as master */
372 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags); 369 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
373 /* Write target byte */ 370 /* Write target byte */
@@ -396,9 +393,6 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
396 int i, result; 393 int i, result;
397 u32 flags = restart ? CCR_RSTA : 0; 394 u32 flags = restart ? CCR_RSTA : 0;
398 395
399 /* Start with MEN */
400 if (!restart)
401 writeccr(i2c, CCR_MEN);
402 /* Switch to read - restart */ 396 /* Switch to read - restart */
403 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags); 397 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
404 /* Write target address byte - this time with the read flag set */ 398 /* Write target address byte - this time with the read flag set */
@@ -425,9 +419,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
425 /* Generate txack on next to last byte */ 419 /* Generate txack on next to last byte */
426 if (i == length - 2) 420 if (i == length - 2)
427 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_TXAK); 421 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_TXAK);
428 /* Generate stop on last byte */ 422 /* Do not generate stop on last byte */
429 if (i == length - 1) 423 if (i == length - 1)
430 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_TXAK); 424 writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX);
431 data[i] = readb(i2c->base + MPC_I2C_DR); 425 data[i] = readb(i2c->base + MPC_I2C_DR);
432 } 426 }
433 427
diff --git a/drivers/ide/atiixp.c b/drivers/ide/atiixp.c
index 6396c3ad3252..837322b10a4c 100644
--- a/drivers/ide/atiixp.c
+++ b/drivers/ide/atiixp.c
@@ -177,7 +177,7 @@ static const struct pci_device_id atiixp_pci_tbl[] = {
177 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), 0 }, 177 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), 0 },
178 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), 1 }, 178 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), 1 },
179 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), 0 }, 179 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), 0 },
180 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_SB900_IDE), 0 }, 180 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_HUDSON2_IDE), 0 },
181 { 0, }, 181 { 0, },
182}; 182};
183MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); 183MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c
index 680e5975217f..ca0c46f6580a 100644
--- a/drivers/ide/cmd64x.c
+++ b/drivers/ide/cmd64x.c
@@ -379,7 +379,8 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
379 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 379 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}},
380 .port_ops = &cmd64x_port_ops, 380 .port_ops = &cmd64x_port_ops,
381 .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | 381 .host_flags = IDE_HFLAG_CLEAR_SIMPLEX |
382 IDE_HFLAG_ABUSE_PREFETCH, 382 IDE_HFLAG_ABUSE_PREFETCH |
383 IDE_HFLAG_SERIALIZE,
383 .pio_mask = ATA_PIO5, 384 .pio_mask = ATA_PIO5,
384 .mwdma_mask = ATA_MWDMA2, 385 .mwdma_mask = ATA_MWDMA2,
385 .udma_mask = 0x00, /* no udma */ 386 .udma_mask = 0x00, /* no udma */
@@ -389,7 +390,8 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
389 .init_chipset = init_chipset_cmd64x, 390 .init_chipset = init_chipset_cmd64x,
390 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 391 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
391 .port_ops = &cmd648_port_ops, 392 .port_ops = &cmd648_port_ops,
392 .host_flags = IDE_HFLAG_ABUSE_PREFETCH, 393 .host_flags = IDE_HFLAG_ABUSE_PREFETCH |
394 IDE_HFLAG_SERIALIZE,
393 .pio_mask = ATA_PIO5, 395 .pio_mask = ATA_PIO5,
394 .mwdma_mask = ATA_MWDMA2, 396 .mwdma_mask = ATA_MWDMA2,
395 .udma_mask = ATA_UDMA2, 397 .udma_mask = ATA_UDMA2,
diff --git a/drivers/input/input.c b/drivers/input/input.c
index c6f88ebb40c7..cc763c96fada 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -782,10 +782,29 @@ static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait)
782 return 0; 782 return 0;
783} 783}
784 784
785union input_seq_state {
786 struct {
787 unsigned short pos;
788 bool mutex_acquired;
789 };
790 void *p;
791};
792
785static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos) 793static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos)
786{ 794{
787 if (mutex_lock_interruptible(&input_mutex)) 795 union input_seq_state *state = (union input_seq_state *)&seq->private;
788 return NULL; 796 int error;
797
798 /* We need to fit into seq->private pointer */
799 BUILD_BUG_ON(sizeof(union input_seq_state) != sizeof(seq->private));
800
801 error = mutex_lock_interruptible(&input_mutex);
802 if (error) {
803 state->mutex_acquired = false;
804 return ERR_PTR(error);
805 }
806
807 state->mutex_acquired = true;
789 808
790 return seq_list_start(&input_dev_list, *pos); 809 return seq_list_start(&input_dev_list, *pos);
791} 810}
@@ -795,9 +814,12 @@ static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos)
795 return seq_list_next(v, &input_dev_list, pos); 814 return seq_list_next(v, &input_dev_list, pos);
796} 815}
797 816
798static void input_devices_seq_stop(struct seq_file *seq, void *v) 817static void input_seq_stop(struct seq_file *seq, void *v)
799{ 818{
800 mutex_unlock(&input_mutex); 819 union input_seq_state *state = (union input_seq_state *)&seq->private;
820
821 if (state->mutex_acquired)
822 mutex_unlock(&input_mutex);
801} 823}
802 824
803static void input_seq_print_bitmap(struct seq_file *seq, const char *name, 825static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
@@ -861,7 +883,7 @@ static int input_devices_seq_show(struct seq_file *seq, void *v)
861static const struct seq_operations input_devices_seq_ops = { 883static const struct seq_operations input_devices_seq_ops = {
862 .start = input_devices_seq_start, 884 .start = input_devices_seq_start,
863 .next = input_devices_seq_next, 885 .next = input_devices_seq_next,
864 .stop = input_devices_seq_stop, 886 .stop = input_seq_stop,
865 .show = input_devices_seq_show, 887 .show = input_devices_seq_show,
866}; 888};
867 889
@@ -881,40 +903,49 @@ static const struct file_operations input_devices_fileops = {
881 903
882static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos) 904static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos)
883{ 905{
884 if (mutex_lock_interruptible(&input_mutex)) 906 union input_seq_state *state = (union input_seq_state *)&seq->private;
885 return NULL; 907 int error;
908
909 /* We need to fit into seq->private pointer */
910 BUILD_BUG_ON(sizeof(union input_seq_state) != sizeof(seq->private));
911
912 error = mutex_lock_interruptible(&input_mutex);
913 if (error) {
914 state->mutex_acquired = false;
915 return ERR_PTR(error);
916 }
917
918 state->mutex_acquired = true;
919 state->pos = *pos;
886 920
887 seq->private = (void *)(unsigned long)*pos;
888 return seq_list_start(&input_handler_list, *pos); 921 return seq_list_start(&input_handler_list, *pos);
889} 922}
890 923
891static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos) 924static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos)
892{ 925{
893 seq->private = (void *)(unsigned long)(*pos + 1); 926 union input_seq_state *state = (union input_seq_state *)&seq->private;
894 return seq_list_next(v, &input_handler_list, pos);
895}
896 927
897static void input_handlers_seq_stop(struct seq_file *seq, void *v) 928 state->pos = *pos + 1;
898{ 929 return seq_list_next(v, &input_handler_list, pos);
899 mutex_unlock(&input_mutex);
900} 930}
901 931
902static int input_handlers_seq_show(struct seq_file *seq, void *v) 932static int input_handlers_seq_show(struct seq_file *seq, void *v)
903{ 933{
904 struct input_handler *handler = container_of(v, struct input_handler, node); 934 struct input_handler *handler = container_of(v, struct input_handler, node);
935 union input_seq_state *state = (union input_seq_state *)&seq->private;
905 936
906 seq_printf(seq, "N: Number=%ld Name=%s", 937 seq_printf(seq, "N: Number=%u Name=%s", state->pos, handler->name);
907 (unsigned long)seq->private, handler->name);
908 if (handler->fops) 938 if (handler->fops)
909 seq_printf(seq, " Minor=%d", handler->minor); 939 seq_printf(seq, " Minor=%d", handler->minor);
910 seq_putc(seq, '\n'); 940 seq_putc(seq, '\n');
911 941
912 return 0; 942 return 0;
913} 943}
944
914static const struct seq_operations input_handlers_seq_ops = { 945static const struct seq_operations input_handlers_seq_ops = {
915 .start = input_handlers_seq_start, 946 .start = input_handlers_seq_start,
916 .next = input_handlers_seq_next, 947 .next = input_handlers_seq_next,
917 .stop = input_handlers_seq_stop, 948 .stop = input_seq_stop,
918 .show = input_handlers_seq_show, 949 .show = input_handlers_seq_show,
919}; 950};
920 951
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 4709e15af607..4452eabbee6d 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -233,6 +233,7 @@ struct atkbd {
233 */ 233 */
234static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); 234static void (*atkbd_platform_fixup)(struct atkbd *, const void *data);
235static void *atkbd_platform_fixup_data; 235static void *atkbd_platform_fixup_data;
236static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int);
236 237
237static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, 238static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
238 ssize_t (*handler)(struct atkbd *, char *)); 239 ssize_t (*handler)(struct atkbd *, char *));
@@ -393,6 +394,9 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
393 394
394 input_event(dev, EV_MSC, MSC_RAW, code); 395 input_event(dev, EV_MSC, MSC_RAW, code);
395 396
397 if (atkbd_platform_scancode_fixup)
398 code = atkbd_platform_scancode_fixup(atkbd, code);
399
396 if (atkbd->translated) { 400 if (atkbd->translated) {
397 401
398 if (atkbd->emul || atkbd_need_xlate(atkbd->xl_bit, code)) { 402 if (atkbd->emul || atkbd_need_xlate(atkbd->xl_bit, code)) {
@@ -574,11 +578,22 @@ static void atkbd_event_work(struct work_struct *work)
574 578
575 mutex_lock(&atkbd->event_mutex); 579 mutex_lock(&atkbd->event_mutex);
576 580
577 if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) 581 if (!atkbd->enabled) {
578 atkbd_set_leds(atkbd); 582 /*
583 * Serio ports are resumed asynchronously so while driver core
584 * thinks that device is already fully operational in reality
585 * it may not be ready yet. In this case we need to keep
586 * rescheduling till reconnect completes.
587 */
588 schedule_delayed_work(&atkbd->event_work,
589 msecs_to_jiffies(100));
590 } else {
591 if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask))
592 atkbd_set_leds(atkbd);
579 593
580 if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) 594 if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask))
581 atkbd_set_repeat_rate(atkbd); 595 atkbd_set_repeat_rate(atkbd);
596 }
582 597
583 mutex_unlock(&atkbd->event_mutex); 598 mutex_unlock(&atkbd->event_mutex);
584} 599}
@@ -770,6 +785,30 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra
770 return 3; 785 return 3;
771} 786}
772 787
788static int atkbd_reset_state(struct atkbd *atkbd)
789{
790 struct ps2dev *ps2dev = &atkbd->ps2dev;
791 unsigned char param[1];
792
793/*
794 * Set the LEDs to a predefined state (all off).
795 */
796
797 param[0] = 0;
798 if (ps2_command(ps2dev, param, ATKBD_CMD_SETLEDS))
799 return -1;
800
801/*
802 * Set autorepeat to fastest possible.
803 */
804
805 param[0] = 0;
806 if (ps2_command(ps2dev, param, ATKBD_CMD_SETREP))
807 return -1;
808
809 return 0;
810}
811
773static int atkbd_activate(struct atkbd *atkbd) 812static int atkbd_activate(struct atkbd *atkbd)
774{ 813{
775 struct ps2dev *ps2dev = &atkbd->ps2dev; 814 struct ps2dev *ps2dev = &atkbd->ps2dev;
@@ -852,29 +891,6 @@ static unsigned int atkbd_hp_forced_release_keys[] = {
852}; 891};
853 892
854/* 893/*
855 * Inventec system with broken key release on volume keys
856 */
857static unsigned int atkbd_inventec_forced_release_keys[] = {
858 0xae, 0xb0, -1U
859};
860
861/*
862 * Perform fixup for HP Pavilion ZV6100 laptop that doesn't generate release
863 * for its volume buttons
864 */
865static unsigned int atkbd_hp_zv6100_forced_release_keys[] = {
866 0xae, 0xb0, -1U
867};
868
869/*
870 * Perform fixup for HP (Compaq) Presario R4000 R4100 R4200 that don't generate
871 * release for their volume buttons
872 */
873static unsigned int atkbd_hp_r4000_forced_release_keys[] = {
874 0xae, 0xb0, -1U
875};
876
877/*
878 * Samsung NC10,NC20 with Fn+F? key release not working 894 * Samsung NC10,NC20 with Fn+F? key release not working
879 */ 895 */
880static unsigned int atkbd_samsung_forced_release_keys[] = { 896static unsigned int atkbd_samsung_forced_release_keys[] = {
@@ -882,14 +898,6 @@ static unsigned int atkbd_samsung_forced_release_keys[] = {
882}; 898};
883 899
884/* 900/*
885 * The volume up and volume down special keys on a Fujitsu Amilo PA 1510 laptop
886 * do not generate release events so we have to do it ourselves.
887 */
888static unsigned int atkbd_amilo_pa1510_forced_release_keys[] = {
889 0xb0, 0xae, -1U
890};
891
892/*
893 * Amilo Pi 3525 key release for Fn+Volume keys not working 901 * Amilo Pi 3525 key release for Fn+Volume keys not working
894 */ 902 */
895static unsigned int atkbd_amilo_pi3525_forced_release_keys[] = { 903static unsigned int atkbd_amilo_pi3525_forced_release_keys[] = {
@@ -911,6 +919,30 @@ static unsigned int atkdb_soltech_ta12_forced_release_keys[] = {
911}; 919};
912 920
913/* 921/*
922 * Many notebooks don't send key release event for volume up/down
923 * keys, with key list below common among them
924 */
925static unsigned int atkbd_volume_forced_release_keys[] = {
926 0xae, 0xb0, -1U
927};
928
929/*
930 * OQO 01+ multimedia keys (64--66) generate e0 6x upon release whereas
931 * they should be generating e4-e6 (0x80 | code).
932 */
933static unsigned int atkbd_oqo_01plus_scancode_fixup(struct atkbd *atkbd,
934 unsigned int code)
935{
936 if (atkbd->translated && atkbd->emul == 1 &&
937 (code == 0x64 || code == 0x65 || code == 0x66)) {
938 atkbd->emul = 0;
939 code |= 0x80;
940 }
941
942 return code;
943}
944
945/*
914 * atkbd_set_keycode_table() initializes keyboard's keycode table 946 * atkbd_set_keycode_table() initializes keyboard's keycode table
915 * according to the selected scancode set 947 * according to the selected scancode set
916 */ 948 */
@@ -1087,6 +1119,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
1087 } 1119 }
1088 1120
1089 atkbd->set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra); 1121 atkbd->set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra);
1122 atkbd_reset_state(atkbd);
1090 atkbd_activate(atkbd); 1123 atkbd_activate(atkbd);
1091 1124
1092 } else { 1125 } else {
@@ -1267,6 +1300,7 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
1267 1300
1268 atkbd->dev = new_dev; 1301 atkbd->dev = new_dev;
1269 atkbd->set = atkbd_select_set(atkbd, atkbd->set, value); 1302 atkbd->set = atkbd_select_set(atkbd, atkbd->set, value);
1303 atkbd_reset_state(atkbd);
1270 atkbd_activate(atkbd); 1304 atkbd_activate(atkbd);
1271 atkbd_set_keycode_table(atkbd); 1305 atkbd_set_keycode_table(atkbd);
1272 atkbd_set_device_attrs(atkbd); 1306 atkbd_set_device_attrs(atkbd);
@@ -1513,6 +1547,13 @@ static int __init atkbd_setup_forced_release(const struct dmi_system_id *id)
1513 return 0; 1547 return 0;
1514} 1548}
1515 1549
1550static int __init atkbd_setup_scancode_fixup(const struct dmi_system_id *id)
1551{
1552 atkbd_platform_scancode_fixup = id->driver_data;
1553
1554 return 0;
1555}
1556
1516static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { 1557static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1517 { 1558 {
1518 .ident = "Dell Laptop", 1559 .ident = "Dell Laptop",
@@ -1548,7 +1589,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1548 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"), 1589 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"),
1549 }, 1590 },
1550 .callback = atkbd_setup_forced_release, 1591 .callback = atkbd_setup_forced_release,
1551 .driver_data = atkbd_hp_zv6100_forced_release_keys, 1592 .driver_data = atkbd_volume_forced_release_keys,
1552 }, 1593 },
1553 { 1594 {
1554 .ident = "HP Presario R4000", 1595 .ident = "HP Presario R4000",
@@ -1557,7 +1598,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1557 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"), 1598 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"),
1558 }, 1599 },
1559 .callback = atkbd_setup_forced_release, 1600 .callback = atkbd_setup_forced_release,
1560 .driver_data = atkbd_hp_r4000_forced_release_keys, 1601 .driver_data = atkbd_volume_forced_release_keys,
1561 }, 1602 },
1562 { 1603 {
1563 .ident = "HP Presario R4100", 1604 .ident = "HP Presario R4100",
@@ -1566,7 +1607,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1566 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"), 1607 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"),
1567 }, 1608 },
1568 .callback = atkbd_setup_forced_release, 1609 .callback = atkbd_setup_forced_release,
1569 .driver_data = atkbd_hp_r4000_forced_release_keys, 1610 .driver_data = atkbd_volume_forced_release_keys,
1570 }, 1611 },
1571 { 1612 {
1572 .ident = "HP Presario R4200", 1613 .ident = "HP Presario R4200",
@@ -1575,7 +1616,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1575 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"), 1616 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"),
1576 }, 1617 },
1577 .callback = atkbd_setup_forced_release, 1618 .callback = atkbd_setup_forced_release,
1578 .driver_data = atkbd_hp_r4000_forced_release_keys, 1619 .driver_data = atkbd_volume_forced_release_keys,
1579 }, 1620 },
1580 { 1621 {
1581 .ident = "Inventec Symphony", 1622 .ident = "Inventec Symphony",
@@ -1584,7 +1625,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1584 DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"), 1625 DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"),
1585 }, 1626 },
1586 .callback = atkbd_setup_forced_release, 1627 .callback = atkbd_setup_forced_release,
1587 .driver_data = atkbd_inventec_forced_release_keys, 1628 .driver_data = atkbd_volume_forced_release_keys,
1588 }, 1629 },
1589 { 1630 {
1590 .ident = "Samsung NC10", 1631 .ident = "Samsung NC10",
@@ -1620,7 +1661,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1620 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 1510"), 1661 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 1510"),
1621 }, 1662 },
1622 .callback = atkbd_setup_forced_release, 1663 .callback = atkbd_setup_forced_release,
1623 .driver_data = atkbd_amilo_pa1510_forced_release_keys, 1664 .driver_data = atkbd_volume_forced_release_keys,
1624 }, 1665 },
1625 { 1666 {
1626 .ident = "Fujitsu Amilo Pi 3525", 1667 .ident = "Fujitsu Amilo Pi 3525",
@@ -1649,6 +1690,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1649 .callback = atkbd_setup_forced_release, 1690 .callback = atkbd_setup_forced_release,
1650 .driver_data = atkdb_soltech_ta12_forced_release_keys, 1691 .driver_data = atkdb_soltech_ta12_forced_release_keys,
1651 }, 1692 },
1693 {
1694 .ident = "OQO Model 01+",
1695 .matches = {
1696 DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
1697 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
1698 },
1699 .callback = atkbd_setup_scancode_fixup,
1700 .driver_data = atkbd_oqo_01plus_scancode_fixup,
1701 },
1652 { } 1702 { }
1653}; 1703};
1654 1704
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index a88aff3816a0..77d130914259 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -147,6 +147,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
147 } 147 }
148 148
149 error = request_irq(irq, gpio_keys_isr, 149 error = request_irq(irq, gpio_keys_isr,
150 IRQF_SHARED |
150 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 151 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
151 button->desc ? button->desc : "gpio_keys", 152 button->desc ? button->desc : "gpio_keys",
152 bdata); 153 bdata);
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 02f4f8f1db6f..a9bb2544b2de 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -227,6 +227,7 @@ config INPUT_WINBOND_CIR
227 depends on X86 && PNP 227 depends on X86 && PNP
228 select NEW_LEDS 228 select NEW_LEDS
229 select LEDS_CLASS 229 select LEDS_CLASS
230 select LEDS_TRIGGERS
230 select BITREVERSE 231 select BITREVERSE
231 help 232 help
232 Say Y here if you want to use the IR remote functionality found 233 Say Y here if you want to use the IR remote functionality found
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index 216a559f55ea..ea821b546969 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -209,7 +209,7 @@ static inline int hp_sdc_rtc_read_rt(struct timeval *res) {
209 209
210/* Read the i8042 fast handshake timer */ 210/* Read the i8042 fast handshake timer */
211static inline int hp_sdc_rtc_read_fhs(struct timeval *res) { 211static inline int hp_sdc_rtc_read_fhs(struct timeval *res) {
212 uint64_t raw; 212 int64_t raw;
213 unsigned int tenms; 213 unsigned int tenms;
214 214
215 raw = hp_sdc_rtc_read_i8042timer(HP_SDC_CMD_LOAD_FHS, 2); 215 raw = hp_sdc_rtc_read_i8042timer(HP_SDC_CMD_LOAD_FHS, 2);
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index de745d751162..ab5dc5f5fd83 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -219,7 +219,7 @@ static const struct ps2pp_info *get_model_info(unsigned char model)
219 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | 219 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
220 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL }, 220 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL },
221 { 72, PS2PP_KIND_TRACKMAN, 0 }, /* T-CH11: TrackMan Marble */ 221 { 72, PS2PP_KIND_TRACKMAN, 0 }, /* T-CH11: TrackMan Marble */
222 { 73, 0, PS2PP_SIDE_BTN }, 222 { 73, PS2PP_KIND_TRACKMAN, PS2PP_SIDE_BTN }, /* TrackMan FX */
223 { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 223 { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
224 { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 224 { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
225 { 79, PS2PP_KIND_TRACKMAN, PS2PP_WHEEL }, /* TrackMan with wheel */ 225 { 79, PS2PP_KIND_TRACKMAN, PS2PP_WHEEL }, /* TrackMan with wheel */
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index b66ff1ac7dea..f4a61252bcc9 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -652,6 +652,16 @@ static const struct dmi_system_id toshiba_dmi_table[] = {
652 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 652 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
653 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), 653 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"),
654 }, 654 },
655
656 },
657 {
658 .ident = "Toshiba Portege M300",
659 .matches = {
660 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
661 DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"),
662 DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"),
663 },
664
655 }, 665 },
656 { } 666 { }
657}; 667};
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index a39bc4eb902b..a537925f7651 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -327,6 +327,17 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
327 }, 327 },
328 }, 328 },
329 { 329 {
330 /*
331 * Reset and GET ID commands issued via KBD port are
332 * sometimes being delivered to AUX3.
333 */
334 .ident = "Sony Vaio FZ-240E",
335 .matches = {
336 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
337 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
338 },
339 },
340 {
330 .ident = "Amoi M636/A737", 341 .ident = "Amoi M636/A737",
331 .matches = { 342 .matches = {
332 DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."), 343 DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
@@ -661,7 +672,7 @@ static void i8042_pnp_exit(void)
661static int __init i8042_pnp_init(void) 672static int __init i8042_pnp_init(void)
662{ 673{
663 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; 674 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
664 int pnp_data_busted = false; 675 bool pnp_data_busted = false;
665 int err; 676 int err;
666 677
667#ifdef CONFIG_X86 678#ifdef CONFIG_X86
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index a31578170ccc..1df02d25aca5 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -836,17 +836,32 @@ static int i8042_controller_selftest(void)
836static int i8042_controller_init(void) 836static int i8042_controller_init(void)
837{ 837{
838 unsigned long flags; 838 unsigned long flags;
839 int n = 0;
840 unsigned char ctr[2];
839 841
840/* 842/*
841 * Save the CTR for restoral on unload / reboot. 843 * Save the CTR for restore on unload / reboot.
842 */ 844 */
843 845
844 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_RCTR)) { 846 do {
845 printk(KERN_ERR "i8042.c: Can't read CTR while initializing i8042.\n"); 847 if (n >= 10) {
846 return -EIO; 848 printk(KERN_ERR
847 } 849 "i8042.c: Unable to get stable CTR read.\n");
850 return -EIO;
851 }
852
853 if (n != 0)
854 udelay(50);
855
856 if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) {
857 printk(KERN_ERR
858 "i8042.c: Can't read CTR while initializing i8042.\n");
859 return -EIO;
860 }
848 861
849 i8042_initial_ctr = i8042_ctr; 862 } while (n < 2 || ctr[0] != ctr[1]);
863
864 i8042_initial_ctr = i8042_ctr = ctr[0];
850 865
851/* 866/*
852 * Disable the keyboard interface and interrupt. 867 * Disable the keyboard interface and interrupt.
@@ -895,6 +910,12 @@ static int i8042_controller_init(void)
895 return -EIO; 910 return -EIO;
896 } 911 }
897 912
913/*
914 * Flush whatever accumulated while we were disabling keyboard port.
915 */
916
917 i8042_flush();
918
898 return 0; 919 return 0;
899} 920}
900 921
@@ -914,7 +935,7 @@ static void i8042_controller_reset(void)
914 i8042_ctr |= I8042_CTR_KBDDIS | I8042_CTR_AUXDIS; 935 i8042_ctr |= I8042_CTR_KBDDIS | I8042_CTR_AUXDIS;
915 i8042_ctr &= ~(I8042_CTR_KBDINT | I8042_CTR_AUXINT); 936 i8042_ctr &= ~(I8042_CTR_KBDINT | I8042_CTR_AUXINT);
916 937
917 if (i8042_command(&i8042_initial_ctr, I8042_CMD_CTL_WCTR)) 938 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR))
918 printk(KERN_WARNING "i8042.c: Can't write CTR while resetting.\n"); 939 printk(KERN_WARNING "i8042.c: Can't write CTR while resetting.\n");
919 940
920/* 941/*
diff --git a/drivers/isdn/i4l/isdn_net.h b/drivers/isdn/i4l/isdn_net.h
index 74032d0881ef..7511f08effa5 100644
--- a/drivers/isdn/i4l/isdn_net.h
+++ b/drivers/isdn/i4l/isdn_net.h
@@ -83,19 +83,19 @@ static __inline__ isdn_net_local * isdn_net_get_locked_lp(isdn_net_dev *nd)
83 83
84 spin_lock_irqsave(&nd->queue_lock, flags); 84 spin_lock_irqsave(&nd->queue_lock, flags);
85 lp = nd->queue; /* get lp on top of queue */ 85 lp = nd->queue; /* get lp on top of queue */
86 spin_lock(&nd->queue->xmit_lock);
87 while (isdn_net_lp_busy(nd->queue)) { 86 while (isdn_net_lp_busy(nd->queue)) {
88 spin_unlock(&nd->queue->xmit_lock);
89 nd->queue = nd->queue->next; 87 nd->queue = nd->queue->next;
90 if (nd->queue == lp) { /* not found -- should never happen */ 88 if (nd->queue == lp) { /* not found -- should never happen */
91 lp = NULL; 89 lp = NULL;
92 goto errout; 90 goto errout;
93 } 91 }
94 spin_lock(&nd->queue->xmit_lock);
95 } 92 }
96 lp = nd->queue; 93 lp = nd->queue;
97 nd->queue = nd->queue->next; 94 nd->queue = nd->queue->next;
95 spin_unlock_irqrestore(&nd->queue_lock, flags);
96 spin_lock(&lp->xmit_lock);
98 local_bh_disable(); 97 local_bh_disable();
98 return lp;
99errout: 99errout:
100 spin_unlock_irqrestore(&nd->queue_lock, flags); 100 spin_unlock_irqrestore(&nd->queue_lock, flags);
101 return lp; 101 return lp;
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index b40fb9b6c862..6f308a4757ee 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -405,7 +405,11 @@ static int __init via_pmu_start(void)
405 printk(KERN_ERR "via-pmu: can't map interrupt\n"); 405 printk(KERN_ERR "via-pmu: can't map interrupt\n");
406 return -ENODEV; 406 return -ENODEV;
407 } 407 }
408 if (request_irq(irq, via_pmu_interrupt, 0, "VIA-PMU", (void *)0)) { 408 /* We set IRQF_TIMER because we don't want the interrupt to be disabled
409 * between the 2 passes of driver suspend, we control our own disabling
410 * for that one
411 */
412 if (request_irq(irq, via_pmu_interrupt, IRQF_TIMER, "VIA-PMU", (void *)0)) {
409 printk(KERN_ERR "via-pmu: can't request irq %d\n", irq); 413 printk(KERN_ERR "via-pmu: can't request irq %d\n", irq);
410 return -ENODEV; 414 return -ENODEV;
411 } 415 }
@@ -419,7 +423,7 @@ static int __init via_pmu_start(void)
419 gpio_irq = irq_of_parse_and_map(gpio_node, 0); 423 gpio_irq = irq_of_parse_and_map(gpio_node, 0);
420 424
421 if (gpio_irq != NO_IRQ) { 425 if (gpio_irq != NO_IRQ) {
422 if (request_irq(gpio_irq, gpio1_interrupt, 0, 426 if (request_irq(gpio_irq, gpio1_interrupt, IRQF_TIMER,
423 "GPIO1 ADB", (void *)0)) 427 "GPIO1 ADB", (void *)0))
424 printk(KERN_ERR "pmu: can't get irq %d" 428 printk(KERN_ERR "pmu: can't get irq %d"
425 " (GPIO1)\n", gpio_irq); 429 " (GPIO1)\n", gpio_irq);
@@ -925,8 +929,7 @@ proc_write_options(struct file *file, const char __user *buffer,
925 929
926#ifdef CONFIG_ADB 930#ifdef CONFIG_ADB
927/* Send an ADB command */ 931/* Send an ADB command */
928static int 932static int pmu_send_request(struct adb_request *req, int sync)
929pmu_send_request(struct adb_request *req, int sync)
930{ 933{
931 int i, ret; 934 int i, ret;
932 935
@@ -1005,16 +1008,11 @@ pmu_send_request(struct adb_request *req, int sync)
1005} 1008}
1006 1009
1007/* Enable/disable autopolling */ 1010/* Enable/disable autopolling */
1008static int 1011static int __pmu_adb_autopoll(int devs)
1009pmu_adb_autopoll(int devs)
1010{ 1012{
1011 struct adb_request req; 1013 struct adb_request req;
1012 1014
1013 if ((vias == NULL) || (!pmu_fully_inited) || !pmu_has_adb)
1014 return -ENXIO;
1015
1016 if (devs) { 1015 if (devs) {
1017 adb_dev_map = devs;
1018 pmu_request(&req, NULL, 5, PMU_ADB_CMD, 0, 0x86, 1016 pmu_request(&req, NULL, 5, PMU_ADB_CMD, 0, 0x86,
1019 adb_dev_map >> 8, adb_dev_map); 1017 adb_dev_map >> 8, adb_dev_map);
1020 pmu_adb_flags = 2; 1018 pmu_adb_flags = 2;
@@ -1027,9 +1025,17 @@ pmu_adb_autopoll(int devs)
1027 return 0; 1025 return 0;
1028} 1026}
1029 1027
1028static int pmu_adb_autopoll(int devs)
1029{
1030 if ((vias == NULL) || (!pmu_fully_inited) || !pmu_has_adb)
1031 return -ENXIO;
1032
1033 adb_dev_map = devs;
1034 return __pmu_adb_autopoll(devs);
1035}
1036
1030/* Reset the ADB bus */ 1037/* Reset the ADB bus */
1031static int 1038static int pmu_adb_reset_bus(void)
1032pmu_adb_reset_bus(void)
1033{ 1039{
1034 struct adb_request req; 1040 struct adb_request req;
1035 int save_autopoll = adb_dev_map; 1041 int save_autopoll = adb_dev_map;
@@ -1038,13 +1044,13 @@ pmu_adb_reset_bus(void)
1038 return -ENXIO; 1044 return -ENXIO;
1039 1045
1040 /* anyone got a better idea?? */ 1046 /* anyone got a better idea?? */
1041 pmu_adb_autopoll(0); 1047 __pmu_adb_autopoll(0);
1042 1048
1043 req.nbytes = 5; 1049 req.nbytes = 4;
1044 req.done = NULL; 1050 req.done = NULL;
1045 req.data[0] = PMU_ADB_CMD; 1051 req.data[0] = PMU_ADB_CMD;
1046 req.data[1] = 0; 1052 req.data[1] = ADB_BUSRESET;
1047 req.data[2] = ADB_BUSRESET; 1053 req.data[2] = 0;
1048 req.data[3] = 0; 1054 req.data[3] = 0;
1049 req.data[4] = 0; 1055 req.data[4] = 0;
1050 req.reply_len = 0; 1056 req.reply_len = 0;
@@ -1056,7 +1062,7 @@ pmu_adb_reset_bus(void)
1056 pmu_wait_complete(&req); 1062 pmu_wait_complete(&req);
1057 1063
1058 if (save_autopoll != 0) 1064 if (save_autopoll != 0)
1059 pmu_adb_autopoll(save_autopoll); 1065 __pmu_adb_autopoll(save_autopoll);
1060 1066
1061 return 0; 1067 return 0;
1062} 1068}
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index 1dc4185bd781..e355e7f6a536 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -46,7 +46,7 @@ obj-$(CONFIG_DM_LOG_USERSPACE) += dm-log-userspace.o
46obj-$(CONFIG_DM_ZERO) += dm-zero.o 46obj-$(CONFIG_DM_ZERO) += dm-zero.o
47 47
48quiet_cmd_unroll = UNROLL $@ 48quiet_cmd_unroll = UNROLL $@
49 cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \ 49 cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \
50 < $< > $@ || ( rm -f $@ && exit 1 ) 50 < $< > $@ || ( rm -f $@ && exit 1 )
51 51
52ifeq ($(CONFIG_ALTIVEC),y) 52ifeq ($(CONFIG_ALTIVEC),y)
@@ -59,56 +59,56 @@ endif
59 59
60targets += raid6int1.c 60targets += raid6int1.c
61$(obj)/raid6int1.c: UNROLL := 1 61$(obj)/raid6int1.c: UNROLL := 1
62$(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE 62$(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE
63 $(call if_changed,unroll) 63 $(call if_changed,unroll)
64 64
65targets += raid6int2.c 65targets += raid6int2.c
66$(obj)/raid6int2.c: UNROLL := 2 66$(obj)/raid6int2.c: UNROLL := 2
67$(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE 67$(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE
68 $(call if_changed,unroll) 68 $(call if_changed,unroll)
69 69
70targets += raid6int4.c 70targets += raid6int4.c
71$(obj)/raid6int4.c: UNROLL := 4 71$(obj)/raid6int4.c: UNROLL := 4
72$(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE 72$(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE
73 $(call if_changed,unroll) 73 $(call if_changed,unroll)
74 74
75targets += raid6int8.c 75targets += raid6int8.c
76$(obj)/raid6int8.c: UNROLL := 8 76$(obj)/raid6int8.c: UNROLL := 8
77$(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE 77$(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE
78 $(call if_changed,unroll) 78 $(call if_changed,unroll)
79 79
80targets += raid6int16.c 80targets += raid6int16.c
81$(obj)/raid6int16.c: UNROLL := 16 81$(obj)/raid6int16.c: UNROLL := 16
82$(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE 82$(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE
83 $(call if_changed,unroll) 83 $(call if_changed,unroll)
84 84
85targets += raid6int32.c 85targets += raid6int32.c
86$(obj)/raid6int32.c: UNROLL := 32 86$(obj)/raid6int32.c: UNROLL := 32
87$(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE 87$(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE
88 $(call if_changed,unroll) 88 $(call if_changed,unroll)
89 89
90CFLAGS_raid6altivec1.o += $(altivec_flags) 90CFLAGS_raid6altivec1.o += $(altivec_flags)
91targets += raid6altivec1.c 91targets += raid6altivec1.c
92$(obj)/raid6altivec1.c: UNROLL := 1 92$(obj)/raid6altivec1.c: UNROLL := 1
93$(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE 93$(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE
94 $(call if_changed,unroll) 94 $(call if_changed,unroll)
95 95
96CFLAGS_raid6altivec2.o += $(altivec_flags) 96CFLAGS_raid6altivec2.o += $(altivec_flags)
97targets += raid6altivec2.c 97targets += raid6altivec2.c
98$(obj)/raid6altivec2.c: UNROLL := 2 98$(obj)/raid6altivec2.c: UNROLL := 2
99$(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE 99$(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE
100 $(call if_changed,unroll) 100 $(call if_changed,unroll)
101 101
102CFLAGS_raid6altivec4.o += $(altivec_flags) 102CFLAGS_raid6altivec4.o += $(altivec_flags)
103targets += raid6altivec4.c 103targets += raid6altivec4.c
104$(obj)/raid6altivec4.c: UNROLL := 4 104$(obj)/raid6altivec4.c: UNROLL := 4
105$(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE 105$(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE
106 $(call if_changed,unroll) 106 $(call if_changed,unroll)
107 107
108CFLAGS_raid6altivec8.o += $(altivec_flags) 108CFLAGS_raid6altivec8.o += $(altivec_flags)
109targets += raid6altivec8.c 109targets += raid6altivec8.c
110$(obj)/raid6altivec8.c: UNROLL := 8 110$(obj)/raid6altivec8.c: UNROLL := 8
111$(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE 111$(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE
112 $(call if_changed,unroll) 112 $(call if_changed,unroll)
113 113
114quiet_cmd_mktable = TABLE $@ 114quiet_cmd_mktable = TABLE $@
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 6986b0059d23..60e2b322db11 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1624,10 +1624,11 @@ int bitmap_create(mddev_t *mddev)
1624 bitmap->offset = mddev->bitmap_offset; 1624 bitmap->offset = mddev->bitmap_offset;
1625 if (file) { 1625 if (file) {
1626 get_file(file); 1626 get_file(file);
1627 do_sync_mapping_range(file->f_mapping, 0, LLONG_MAX, 1627 /* As future accesses to this file will use bmap,
1628 SYNC_FILE_RANGE_WAIT_BEFORE | 1628 * and bypass the page cache, we must sync the file
1629 SYNC_FILE_RANGE_WRITE | 1629 * first.
1630 SYNC_FILE_RANGE_WAIT_AFTER); 1630 */
1631 vfs_fsync(file, file->f_dentry, 1);
1631 } 1632 }
1632 /* read superblock from bitmap file (this sets bitmap->chunksize) */ 1633 /* read superblock from bitmap file (this sets bitmap->chunksize) */
1633 err = bitmap_read_sb(bitmap); 1634 err = bitmap_read_sb(bitmap);
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 556acff3952f..7dbe652efb5a 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -138,16 +138,6 @@ int dm_exception_store_type_unregister(struct dm_exception_store_type *type)
138} 138}
139EXPORT_SYMBOL(dm_exception_store_type_unregister); 139EXPORT_SYMBOL(dm_exception_store_type_unregister);
140 140
141/*
142 * Round a number up to the nearest 'size' boundary. size must
143 * be a power of 2.
144 */
145static ulong round_up(ulong n, ulong size)
146{
147 size--;
148 return (n + size) & ~size;
149}
150
151static int set_chunk_size(struct dm_exception_store *store, 141static int set_chunk_size(struct dm_exception_store *store,
152 const char *chunk_size_arg, char **error) 142 const char *chunk_size_arg, char **error)
153{ 143{
@@ -155,7 +145,8 @@ static int set_chunk_size(struct dm_exception_store *store,
155 char *value; 145 char *value;
156 146
157 chunk_size_ulong = simple_strtoul(chunk_size_arg, &value, 10); 147 chunk_size_ulong = simple_strtoul(chunk_size_arg, &value, 10);
158 if (*chunk_size_arg == '\0' || *value != '\0') { 148 if (*chunk_size_arg == '\0' || *value != '\0' ||
149 chunk_size_ulong > UINT_MAX) {
159 *error = "Invalid chunk size"; 150 *error = "Invalid chunk size";
160 return -EINVAL; 151 return -EINVAL;
161 } 152 }
@@ -165,40 +156,35 @@ static int set_chunk_size(struct dm_exception_store *store,
165 return 0; 156 return 0;
166 } 157 }
167 158
168 /* 159 return dm_exception_store_set_chunk_size(store,
169 * Chunk size must be multiple of page size. Silently 160 (unsigned) chunk_size_ulong,
170 * round up if it's not.
171 */
172 chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9);
173
174 return dm_exception_store_set_chunk_size(store, chunk_size_ulong,
175 error); 161 error);
176} 162}
177 163
178int dm_exception_store_set_chunk_size(struct dm_exception_store *store, 164int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
179 unsigned long chunk_size_ulong, 165 unsigned chunk_size,
180 char **error) 166 char **error)
181{ 167{
182 /* Check chunk_size is a power of 2 */ 168 /* Check chunk_size is a power of 2 */
183 if (!is_power_of_2(chunk_size_ulong)) { 169 if (!is_power_of_2(chunk_size)) {
184 *error = "Chunk size is not a power of 2"; 170 *error = "Chunk size is not a power of 2";
185 return -EINVAL; 171 return -EINVAL;
186 } 172 }
187 173
188 /* Validate the chunk size against the device block size */ 174 /* Validate the chunk size against the device block size */
189 if (chunk_size_ulong % (bdev_logical_block_size(store->cow->bdev) >> 9)) { 175 if (chunk_size % (bdev_logical_block_size(store->cow->bdev) >> 9)) {
190 *error = "Chunk size is not a multiple of device blocksize"; 176 *error = "Chunk size is not a multiple of device blocksize";
191 return -EINVAL; 177 return -EINVAL;
192 } 178 }
193 179
194 if (chunk_size_ulong > INT_MAX >> SECTOR_SHIFT) { 180 if (chunk_size > INT_MAX >> SECTOR_SHIFT) {
195 *error = "Chunk size is too high"; 181 *error = "Chunk size is too high";
196 return -EINVAL; 182 return -EINVAL;
197 } 183 }
198 184
199 store->chunk_size = chunk_size_ulong; 185 store->chunk_size = chunk_size;
200 store->chunk_mask = chunk_size_ulong - 1; 186 store->chunk_mask = chunk_size - 1;
201 store->chunk_shift = ffs(chunk_size_ulong) - 1; 187 store->chunk_shift = ffs(chunk_size) - 1;
202 188
203 return 0; 189 return 0;
204} 190}
@@ -251,7 +237,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
251 237
252 r = set_chunk_size(tmp_store, argv[2], &ti->error); 238 r = set_chunk_size(tmp_store, argv[2], &ti->error);
253 if (r) 239 if (r)
254 goto bad_cow; 240 goto bad_ctr;
255 241
256 r = type->ctr(tmp_store, 0, NULL); 242 r = type->ctr(tmp_store, 0, NULL);
257 if (r) { 243 if (r) {
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index 812c71872ba0..8a223a48802c 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -101,9 +101,9 @@ struct dm_exception_store {
101 struct dm_dev *cow; 101 struct dm_dev *cow;
102 102
103 /* Size of data blocks saved - must be a power of 2 */ 103 /* Size of data blocks saved - must be a power of 2 */
104 chunk_t chunk_size; 104 unsigned chunk_size;
105 chunk_t chunk_mask; 105 unsigned chunk_mask;
106 chunk_t chunk_shift; 106 unsigned chunk_shift;
107 107
108 void *context; 108 void *context;
109}; 109};
@@ -169,7 +169,7 @@ int dm_exception_store_type_register(struct dm_exception_store_type *type);
169int dm_exception_store_type_unregister(struct dm_exception_store_type *type); 169int dm_exception_store_type_unregister(struct dm_exception_store_type *type);
170 170
171int dm_exception_store_set_chunk_size(struct dm_exception_store *store, 171int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
172 unsigned long chunk_size_ulong, 172 unsigned chunk_size,
173 char **error); 173 char **error);
174 174
175int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, 175int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c
index 652bd33109e3..7ac2c1450d10 100644
--- a/drivers/md/dm-log-userspace-base.c
+++ b/drivers/md/dm-log-userspace-base.c
@@ -156,7 +156,7 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti,
156 } 156 }
157 157
158 /* The ptr value is sufficient for local unique id */ 158 /* The ptr value is sufficient for local unique id */
159 lc->luid = (uint64_t)lc; 159 lc->luid = (unsigned long)lc;
160 160
161 lc->ti = ti; 161 lc->ti = ti;
162 162
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index d5b2e08750d5..0c746420c008 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -284,12 +284,13 @@ static int read_header(struct pstore *ps, int *new_snapshot)
284{ 284{
285 int r; 285 int r;
286 struct disk_header *dh; 286 struct disk_header *dh;
287 chunk_t chunk_size; 287 unsigned chunk_size;
288 int chunk_size_supplied = 1; 288 int chunk_size_supplied = 1;
289 char *chunk_err; 289 char *chunk_err;
290 290
291 /* 291 /*
292 * Use default chunk size (or hardsect_size, if larger) if none supplied 292 * Use default chunk size (or logical_block_size, if larger)
293 * if none supplied
293 */ 294 */
294 if (!ps->store->chunk_size) { 295 if (!ps->store->chunk_size) {
295 ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS, 296 ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS,
@@ -334,10 +335,9 @@ static int read_header(struct pstore *ps, int *new_snapshot)
334 return 0; 335 return 0;
335 336
336 if (chunk_size_supplied) 337 if (chunk_size_supplied)
337 DMWARN("chunk size %llu in device metadata overrides " 338 DMWARN("chunk size %u in device metadata overrides "
338 "table chunk size of %llu.", 339 "table chunk size of %u.",
339 (unsigned long long)chunk_size, 340 chunk_size, ps->store->chunk_size);
340 (unsigned long long)ps->store->chunk_size);
341 341
342 /* We had a bogus chunk_size. Fix stuff up. */ 342 /* We had a bogus chunk_size. Fix stuff up. */
343 free_area(ps); 343 free_area(ps);
@@ -345,8 +345,8 @@ static int read_header(struct pstore *ps, int *new_snapshot)
345 r = dm_exception_store_set_chunk_size(ps->store, chunk_size, 345 r = dm_exception_store_set_chunk_size(ps->store, chunk_size,
346 &chunk_err); 346 &chunk_err);
347 if (r) { 347 if (r) {
348 DMERR("invalid on-disk chunk size %llu: %s.", 348 DMERR("invalid on-disk chunk size %u: %s.",
349 (unsigned long long)chunk_size, chunk_err); 349 chunk_size, chunk_err);
350 return r; 350 return r;
351 } 351 }
352 352
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 57f1bf7f3b7a..3a3ba46e6d4b 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -296,6 +296,7 @@ static void __insert_origin(struct origin *o)
296 */ 296 */
297static int register_snapshot(struct dm_snapshot *snap) 297static int register_snapshot(struct dm_snapshot *snap)
298{ 298{
299 struct dm_snapshot *l;
299 struct origin *o, *new_o; 300 struct origin *o, *new_o;
300 struct block_device *bdev = snap->origin->bdev; 301 struct block_device *bdev = snap->origin->bdev;
301 302
@@ -319,7 +320,11 @@ static int register_snapshot(struct dm_snapshot *snap)
319 __insert_origin(o); 320 __insert_origin(o);
320 } 321 }
321 322
322 list_add_tail(&snap->list, &o->snapshots); 323 /* Sort the list according to chunk size, largest-first smallest-last */
324 list_for_each_entry(l, &o->snapshots, list)
325 if (l->store->chunk_size < snap->store->chunk_size)
326 break;
327 list_add_tail(&snap->list, &l->list);
323 328
324 up_write(&_origins_lock); 329 up_write(&_origins_lock);
325 return 0; 330 return 0;
@@ -668,6 +673,11 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
668 bio_list_init(&s->queued_bios); 673 bio_list_init(&s->queued_bios);
669 INIT_WORK(&s->queued_bios_work, flush_queued_bios); 674 INIT_WORK(&s->queued_bios_work, flush_queued_bios);
670 675
676 if (!s->store->chunk_size) {
677 ti->error = "Chunk size not set";
678 goto bad_load_and_register;
679 }
680
671 /* Add snapshot to the list of snapshots for this origin */ 681 /* Add snapshot to the list of snapshots for this origin */
672 /* Exceptions aren't triggered till snapshot_resume() is called */ 682 /* Exceptions aren't triggered till snapshot_resume() is called */
673 if (register_snapshot(s)) { 683 if (register_snapshot(s)) {
@@ -951,7 +961,7 @@ static void start_copy(struct dm_snap_pending_exception *pe)
951 961
952 src.bdev = bdev; 962 src.bdev = bdev;
953 src.sector = chunk_to_sector(s->store, pe->e.old_chunk); 963 src.sector = chunk_to_sector(s->store, pe->e.old_chunk);
954 src.count = min(s->store->chunk_size, dev_size - src.sector); 964 src.count = min((sector_t)s->store->chunk_size, dev_size - src.sector);
955 965
956 dest.bdev = s->store->cow->bdev; 966 dest.bdev = s->store->cow->bdev;
957 dest.sector = chunk_to_sector(s->store, pe->e.new_chunk); 967 dest.sector = chunk_to_sector(s->store, pe->e.new_chunk);
@@ -1142,6 +1152,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
1142 unsigned sz = 0; 1152 unsigned sz = 0;
1143 struct dm_snapshot *snap = ti->private; 1153 struct dm_snapshot *snap = ti->private;
1144 1154
1155 down_write(&snap->lock);
1156
1145 switch (type) { 1157 switch (type) {
1146 case STATUSTYPE_INFO: 1158 case STATUSTYPE_INFO:
1147 if (!snap->valid) 1159 if (!snap->valid)
@@ -1173,6 +1185,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
1173 break; 1185 break;
1174 } 1186 }
1175 1187
1188 up_write(&snap->lock);
1189
1176 return 0; 1190 return 0;
1177} 1191}
1178 1192
@@ -1388,7 +1402,7 @@ static void origin_resume(struct dm_target *ti)
1388 struct dm_dev *dev = ti->private; 1402 struct dm_dev *dev = ti->private;
1389 struct dm_snapshot *snap; 1403 struct dm_snapshot *snap;
1390 struct origin *o; 1404 struct origin *o;
1391 chunk_t chunk_size = 0; 1405 unsigned chunk_size = 0;
1392 1406
1393 down_read(&_origins_lock); 1407 down_read(&_origins_lock);
1394 o = __lookup_origin(dev->bdev); 1408 o = __lookup_origin(dev->bdev);
@@ -1465,7 +1479,7 @@ static int __init dm_snapshot_init(void)
1465 r = dm_register_target(&snapshot_target); 1479 r = dm_register_target(&snapshot_target);
1466 if (r) { 1480 if (r) {
1467 DMERR("snapshot target register failed %d", r); 1481 DMERR("snapshot target register failed %d", r);
1468 return r; 1482 goto bad_register_snapshot_target;
1469 } 1483 }
1470 1484
1471 r = dm_register_target(&origin_target); 1485 r = dm_register_target(&origin_target);
@@ -1522,6 +1536,9 @@ bad2:
1522 dm_unregister_target(&origin_target); 1536 dm_unregister_target(&origin_target);
1523bad1: 1537bad1:
1524 dm_unregister_target(&snapshot_target); 1538 dm_unregister_target(&snapshot_target);
1539
1540bad_register_snapshot_target:
1541 dm_exception_store_exit();
1525 return r; 1542 return r;
1526} 1543}
1527 1544
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 376f1ab48a24..724efc63904d 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -47,6 +47,7 @@ struct dm_io {
47 atomic_t io_count; 47 atomic_t io_count;
48 struct bio *bio; 48 struct bio *bio;
49 unsigned long start_time; 49 unsigned long start_time;
50 spinlock_t endio_lock;
50}; 51};
51 52
52/* 53/*
@@ -578,8 +579,12 @@ static void dec_pending(struct dm_io *io, int error)
578 struct mapped_device *md = io->md; 579 struct mapped_device *md = io->md;
579 580
580 /* Push-back supersedes any I/O errors */ 581 /* Push-back supersedes any I/O errors */
581 if (error && !(io->error > 0 && __noflush_suspending(md))) 582 if (unlikely(error)) {
582 io->error = error; 583 spin_lock_irqsave(&io->endio_lock, flags);
584 if (!(io->error > 0 && __noflush_suspending(md)))
585 io->error = error;
586 spin_unlock_irqrestore(&io->endio_lock, flags);
587 }
583 588
584 if (atomic_dec_and_test(&io->io_count)) { 589 if (atomic_dec_and_test(&io->io_count)) {
585 if (io->error == DM_ENDIO_REQUEUE) { 590 if (io->error == DM_ENDIO_REQUEUE) {
@@ -1226,6 +1231,7 @@ static void __split_and_process_bio(struct mapped_device *md, struct bio *bio)
1226 atomic_set(&ci.io->io_count, 1); 1231 atomic_set(&ci.io->io_count, 1);
1227 ci.io->bio = bio; 1232 ci.io->bio = bio;
1228 ci.io->md = md; 1233 ci.io->md = md;
1234 spin_lock_init(&ci.io->endio_lock);
1229 ci.sector = bio->bi_sector; 1235 ci.sector = bio->bi_sector;
1230 ci.sector_count = bio_sectors(bio); 1236 ci.sector_count = bio_sectors(bio);
1231 if (unlikely(bio_empty_barrier(bio))) 1237 if (unlikely(bio_empty_barrier(bio)))
@@ -1822,6 +1828,7 @@ static struct mapped_device *alloc_dev(int minor)
1822bad_bdev: 1828bad_bdev:
1823 destroy_workqueue(md->wq); 1829 destroy_workqueue(md->wq);
1824bad_thread: 1830bad_thread:
1831 del_gendisk(md->disk);
1825 put_disk(md->disk); 1832 put_disk(md->disk);
1826bad_disk: 1833bad_disk:
1827 blk_cleanup_queue(md->queue); 1834 blk_cleanup_queue(md->queue);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 26ba42a79129..10eb1fce975e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2631,7 +2631,7 @@ static void analyze_sbs(mddev_t * mddev)
2631 rdev->desc_nr = i++; 2631 rdev->desc_nr = i++;
2632 rdev->raid_disk = rdev->desc_nr; 2632 rdev->raid_disk = rdev->desc_nr;
2633 set_bit(In_sync, &rdev->flags); 2633 set_bit(In_sync, &rdev->flags);
2634 } else if (rdev->raid_disk >= mddev->raid_disks) { 2634 } else if (rdev->raid_disk >= (mddev->raid_disks - min(0, mddev->delta_disks))) {
2635 rdev->raid_disk = -1; 2635 rdev->raid_disk = -1;
2636 clear_bit(In_sync, &rdev->flags); 2636 clear_bit(In_sync, &rdev->flags);
2637 } 2637 }
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index d1b9bd5fd4f6..a053423785c9 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -64,7 +64,7 @@ static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data)
64 64
65 /* allocate a r1bio with room for raid_disks entries in the bios array */ 65 /* allocate a r1bio with room for raid_disks entries in the bios array */
66 r1_bio = kzalloc(size, gfp_flags); 66 r1_bio = kzalloc(size, gfp_flags);
67 if (!r1_bio) 67 if (!r1_bio && pi->mddev)
68 unplug_slaves(pi->mddev); 68 unplug_slaves(pi->mddev);
69 69
70 return r1_bio; 70 return r1_bio;
@@ -1683,6 +1683,7 @@ static void raid1d(mddev_t *mddev)
1683 generic_make_request(bio); 1683 generic_make_request(bio);
1684 } 1684 }
1685 } 1685 }
1686 cond_resched();
1686 } 1687 }
1687 if (unplug) 1688 if (unplug)
1688 unplug_slaves(mddev); 1689 unplug_slaves(mddev);
@@ -1978,13 +1979,14 @@ static int run(mddev_t *mddev)
1978 conf->poolinfo = kmalloc(sizeof(*conf->poolinfo), GFP_KERNEL); 1979 conf->poolinfo = kmalloc(sizeof(*conf->poolinfo), GFP_KERNEL);
1979 if (!conf->poolinfo) 1980 if (!conf->poolinfo)
1980 goto out_no_mem; 1981 goto out_no_mem;
1981 conf->poolinfo->mddev = mddev; 1982 conf->poolinfo->mddev = NULL;
1982 conf->poolinfo->raid_disks = mddev->raid_disks; 1983 conf->poolinfo->raid_disks = mddev->raid_disks;
1983 conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, 1984 conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc,
1984 r1bio_pool_free, 1985 r1bio_pool_free,
1985 conf->poolinfo); 1986 conf->poolinfo);
1986 if (!conf->r1bio_pool) 1987 if (!conf->r1bio_pool)
1987 goto out_no_mem; 1988 goto out_no_mem;
1989 conf->poolinfo->mddev = mddev;
1988 1990
1989 spin_lock_init(&conf->device_lock); 1991 spin_lock_init(&conf->device_lock);
1990 mddev->queue->queue_lock = &conf->device_lock; 1992 mddev->queue->queue_lock = &conf->device_lock;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 51c4c5c4d87a..c2cb7b87b440 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -68,7 +68,7 @@ static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
68 68
69 /* allocate a r10bio with room for raid_disks entries in the bios array */ 69 /* allocate a r10bio with room for raid_disks entries in the bios array */
70 r10_bio = kzalloc(size, gfp_flags); 70 r10_bio = kzalloc(size, gfp_flags);
71 if (!r10_bio) 71 if (!r10_bio && conf->mddev)
72 unplug_slaves(conf->mddev); 72 unplug_slaves(conf->mddev);
73 73
74 return r10_bio; 74 return r10_bio;
@@ -1632,6 +1632,7 @@ static void raid10d(mddev_t *mddev)
1632 generic_make_request(bio); 1632 generic_make_request(bio);
1633 } 1633 }
1634 } 1634 }
1635 cond_resched();
1635 } 1636 }
1636 if (unplug) 1637 if (unplug)
1637 unplug_slaves(mddev); 1638 unplug_slaves(mddev);
@@ -2095,7 +2096,6 @@ static int run(mddev_t *mddev)
2095 if (!conf->tmppage) 2096 if (!conf->tmppage)
2096 goto out_free_conf; 2097 goto out_free_conf;
2097 2098
2098 conf->mddev = mddev;
2099 conf->raid_disks = mddev->raid_disks; 2099 conf->raid_disks = mddev->raid_disks;
2100 conf->near_copies = nc; 2100 conf->near_copies = nc;
2101 conf->far_copies = fc; 2101 conf->far_copies = fc;
@@ -2132,6 +2132,7 @@ static int run(mddev_t *mddev)
2132 goto out_free_conf; 2132 goto out_free_conf;
2133 } 2133 }
2134 2134
2135 conf->mddev = mddev;
2135 spin_lock_init(&conf->device_lock); 2136 spin_lock_init(&conf->device_lock);
2136 mddev->queue->queue_lock = &conf->device_lock; 2137 mddev->queue->queue_lock = &conf->device_lock;
2137 2138
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 94829804ab7f..81abefc172d9 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -156,13 +156,16 @@ static inline int raid6_next_disk(int disk, int raid_disks)
156static int raid6_idx_to_slot(int idx, struct stripe_head *sh, 156static int raid6_idx_to_slot(int idx, struct stripe_head *sh,
157 int *count, int syndrome_disks) 157 int *count, int syndrome_disks)
158{ 158{
159 int slot; 159 int slot = *count;
160 160
161 if (sh->ddf_layout)
162 (*count)++;
161 if (idx == sh->pd_idx) 163 if (idx == sh->pd_idx)
162 return syndrome_disks; 164 return syndrome_disks;
163 if (idx == sh->qd_idx) 165 if (idx == sh->qd_idx)
164 return syndrome_disks + 1; 166 return syndrome_disks + 1;
165 slot = (*count)++; 167 if (!sh->ddf_layout)
168 (*count)++;
166 return slot; 169 return slot;
167} 170}
168 171
@@ -717,7 +720,7 @@ static int set_syndrome_sources(struct page **srcs, struct stripe_head *sh)
717 int i; 720 int i;
718 721
719 for (i = 0; i < disks; i++) 722 for (i = 0; i < disks; i++)
720 srcs[i] = (void *)raid6_empty_zero_page; 723 srcs[i] = NULL;
721 724
722 count = 0; 725 count = 0;
723 i = d0_idx; 726 i = d0_idx;
@@ -727,9 +730,8 @@ static int set_syndrome_sources(struct page **srcs, struct stripe_head *sh)
727 srcs[slot] = sh->dev[i].page; 730 srcs[slot] = sh->dev[i].page;
728 i = raid6_next_disk(i, disks); 731 i = raid6_next_disk(i, disks);
729 } while (i != d0_idx); 732 } while (i != d0_idx);
730 BUG_ON(count != syndrome_disks);
731 733
732 return count; 734 return syndrome_disks;
733} 735}
734 736
735static struct dma_async_tx_descriptor * 737static struct dma_async_tx_descriptor *
@@ -814,7 +816,7 @@ ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu *percpu)
814 * slot number conversion for 'faila' and 'failb' 816 * slot number conversion for 'faila' and 'failb'
815 */ 817 */
816 for (i = 0; i < disks ; i++) 818 for (i = 0; i < disks ; i++)
817 blocks[i] = (void *)raid6_empty_zero_page; 819 blocks[i] = NULL;
818 count = 0; 820 count = 0;
819 i = d0_idx; 821 i = d0_idx;
820 do { 822 do {
@@ -828,7 +830,6 @@ ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu *percpu)
828 failb = slot; 830 failb = slot;
829 i = raid6_next_disk(i, disks); 831 i = raid6_next_disk(i, disks);
830 } while (i != d0_idx); 832 } while (i != d0_idx);
831 BUG_ON(count != syndrome_disks);
832 833
833 BUG_ON(faila == failb); 834 BUG_ON(faila == failb);
834 if (failb < faila) 835 if (failb < faila)
@@ -845,7 +846,7 @@ ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu *percpu)
845 init_async_submit(&submit, ASYNC_TX_FENCE, NULL, 846 init_async_submit(&submit, ASYNC_TX_FENCE, NULL,
846 ops_complete_compute, sh, 847 ops_complete_compute, sh,
847 to_addr_conv(sh, percpu)); 848 to_addr_conv(sh, percpu));
848 return async_gen_syndrome(blocks, 0, count+2, 849 return async_gen_syndrome(blocks, 0, syndrome_disks+2,
849 STRIPE_SIZE, &submit); 850 STRIPE_SIZE, &submit);
850 } else { 851 } else {
851 struct page *dest; 852 struct page *dest;
@@ -1139,7 +1140,7 @@ static void ops_run_check_pq(struct stripe_head *sh, struct raid5_percpu *percpu
1139 &sh->ops.zero_sum_result, percpu->spare_page, &submit); 1140 &sh->ops.zero_sum_result, percpu->spare_page, &submit);
1140} 1141}
1141 1142
1142static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) 1143static void __raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
1143{ 1144{
1144 int overlap_clear = 0, i, disks = sh->disks; 1145 int overlap_clear = 0, i, disks = sh->disks;
1145 struct dma_async_tx_descriptor *tx = NULL; 1146 struct dma_async_tx_descriptor *tx = NULL;
@@ -1204,22 +1205,55 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
1204 put_cpu(); 1205 put_cpu();
1205} 1206}
1206 1207
1208#ifdef CONFIG_MULTICORE_RAID456
1209static void async_run_ops(void *param, async_cookie_t cookie)
1210{
1211 struct stripe_head *sh = param;
1212 unsigned long ops_request = sh->ops.request;
1213
1214 clear_bit_unlock(STRIPE_OPS_REQ_PENDING, &sh->state);
1215 wake_up(&sh->ops.wait_for_ops);
1216
1217 __raid_run_ops(sh, ops_request);
1218 release_stripe(sh);
1219}
1220
1221static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
1222{
1223 /* since handle_stripe can be called outside of raid5d context
1224 * we need to ensure sh->ops.request is de-staged before another
1225 * request arrives
1226 */
1227 wait_event(sh->ops.wait_for_ops,
1228 !test_and_set_bit_lock(STRIPE_OPS_REQ_PENDING, &sh->state));
1229 sh->ops.request = ops_request;
1230
1231 atomic_inc(&sh->count);
1232 async_schedule(async_run_ops, sh);
1233}
1234#else
1235#define raid_run_ops __raid_run_ops
1236#endif
1237
1207static int grow_one_stripe(raid5_conf_t *conf) 1238static int grow_one_stripe(raid5_conf_t *conf)
1208{ 1239{
1209 struct stripe_head *sh; 1240 struct stripe_head *sh;
1241 int disks = max(conf->raid_disks, conf->previous_raid_disks);
1210 sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL); 1242 sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL);
1211 if (!sh) 1243 if (!sh)
1212 return 0; 1244 return 0;
1213 memset(sh, 0, sizeof(*sh) + (conf->raid_disks-1)*sizeof(struct r5dev)); 1245 memset(sh, 0, sizeof(*sh) + (disks-1)*sizeof(struct r5dev));
1214 sh->raid_conf = conf; 1246 sh->raid_conf = conf;
1215 spin_lock_init(&sh->lock); 1247 spin_lock_init(&sh->lock);
1248 #ifdef CONFIG_MULTICORE_RAID456
1249 init_waitqueue_head(&sh->ops.wait_for_ops);
1250 #endif
1216 1251
1217 if (grow_buffers(sh, conf->raid_disks)) { 1252 if (grow_buffers(sh, disks)) {
1218 shrink_buffers(sh, conf->raid_disks); 1253 shrink_buffers(sh, disks);
1219 kmem_cache_free(conf->slab_cache, sh); 1254 kmem_cache_free(conf->slab_cache, sh);
1220 return 0; 1255 return 0;
1221 } 1256 }
1222 sh->disks = conf->raid_disks;
1223 /* we just created an active stripe so... */ 1257 /* we just created an active stripe so... */
1224 atomic_set(&sh->count, 1); 1258 atomic_set(&sh->count, 1);
1225 atomic_inc(&conf->active_stripes); 1259 atomic_inc(&conf->active_stripes);
@@ -1231,7 +1265,7 @@ static int grow_one_stripe(raid5_conf_t *conf)
1231static int grow_stripes(raid5_conf_t *conf, int num) 1265static int grow_stripes(raid5_conf_t *conf, int num)
1232{ 1266{
1233 struct kmem_cache *sc; 1267 struct kmem_cache *sc;
1234 int devs = conf->raid_disks; 1268 int devs = max(conf->raid_disks, conf->previous_raid_disks);
1235 1269
1236 sprintf(conf->cache_name[0], 1270 sprintf(conf->cache_name[0],
1237 "raid%d-%s", conf->level, mdname(conf->mddev)); 1271 "raid%d-%s", conf->level, mdname(conf->mddev));
@@ -1329,6 +1363,9 @@ static int resize_stripes(raid5_conf_t *conf, int newsize)
1329 1363
1330 nsh->raid_conf = conf; 1364 nsh->raid_conf = conf;
1331 spin_lock_init(&nsh->lock); 1365 spin_lock_init(&nsh->lock);
1366 #ifdef CONFIG_MULTICORE_RAID456
1367 init_waitqueue_head(&nsh->ops.wait_for_ops);
1368 #endif
1332 1369
1333 list_add(&nsh->lru, &newstripes); 1370 list_add(&nsh->lru, &newstripes);
1334 } 1371 }
@@ -1899,10 +1936,15 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
1899 case ALGORITHM_PARITY_N: 1936 case ALGORITHM_PARITY_N:
1900 break; 1937 break;
1901 case ALGORITHM_ROTATING_N_CONTINUE: 1938 case ALGORITHM_ROTATING_N_CONTINUE:
1939 /* Like left_symmetric, but P is before Q */
1902 if (sh->pd_idx == 0) 1940 if (sh->pd_idx == 0)
1903 i--; /* P D D D Q */ 1941 i--; /* P D D D Q */
1904 else if (i > sh->pd_idx) 1942 else {
1905 i -= 2; /* D D Q P D */ 1943 /* D D Q P D */
1944 if (i < sh->pd_idx)
1945 i += raid_disks;
1946 i -= (sh->pd_idx + 1);
1947 }
1906 break; 1948 break;
1907 case ALGORITHM_LEFT_ASYMMETRIC_6: 1949 case ALGORITHM_LEFT_ASYMMETRIC_6:
1908 case ALGORITHM_RIGHT_ASYMMETRIC_6: 1950 case ALGORITHM_RIGHT_ASYMMETRIC_6:
@@ -2896,7 +2938,7 @@ static void handle_stripe_expansion(raid5_conf_t *conf, struct stripe_head *sh,
2896 * 2938 *
2897 */ 2939 */
2898 2940
2899static bool handle_stripe5(struct stripe_head *sh) 2941static void handle_stripe5(struct stripe_head *sh)
2900{ 2942{
2901 raid5_conf_t *conf = sh->raid_conf; 2943 raid5_conf_t *conf = sh->raid_conf;
2902 int disks = sh->disks, i; 2944 int disks = sh->disks, i;
@@ -3167,11 +3209,9 @@ static bool handle_stripe5(struct stripe_head *sh)
3167 ops_run_io(sh, &s); 3209 ops_run_io(sh, &s);
3168 3210
3169 return_io(return_bi); 3211 return_io(return_bi);
3170
3171 return blocked_rdev == NULL;
3172} 3212}
3173 3213
3174static bool handle_stripe6(struct stripe_head *sh) 3214static void handle_stripe6(struct stripe_head *sh)
3175{ 3215{
3176 raid5_conf_t *conf = sh->raid_conf; 3216 raid5_conf_t *conf = sh->raid_conf;
3177 int disks = sh->disks; 3217 int disks = sh->disks;
@@ -3455,17 +3495,14 @@ static bool handle_stripe6(struct stripe_head *sh)
3455 ops_run_io(sh, &s); 3495 ops_run_io(sh, &s);
3456 3496
3457 return_io(return_bi); 3497 return_io(return_bi);
3458
3459 return blocked_rdev == NULL;
3460} 3498}
3461 3499
3462/* returns true if the stripe was handled */ 3500static void handle_stripe(struct stripe_head *sh)
3463static bool handle_stripe(struct stripe_head *sh)
3464{ 3501{
3465 if (sh->raid_conf->level == 6) 3502 if (sh->raid_conf->level == 6)
3466 return handle_stripe6(sh); 3503 handle_stripe6(sh);
3467 else 3504 else
3468 return handle_stripe5(sh); 3505 handle_stripe5(sh);
3469} 3506}
3470 3507
3471static void raid5_activate_delayed(raid5_conf_t *conf) 3508static void raid5_activate_delayed(raid5_conf_t *conf)
@@ -3503,9 +3540,10 @@ static void unplug_slaves(mddev_t *mddev)
3503{ 3540{
3504 raid5_conf_t *conf = mddev->private; 3541 raid5_conf_t *conf = mddev->private;
3505 int i; 3542 int i;
3543 int devs = max(conf->raid_disks, conf->previous_raid_disks);
3506 3544
3507 rcu_read_lock(); 3545 rcu_read_lock();
3508 for (i = 0; i < conf->raid_disks; i++) { 3546 for (i = 0; i < devs; i++) {
3509 mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); 3547 mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev);
3510 if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) { 3548 if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) {
3511 struct request_queue *r_queue = bdev_get_queue(rdev->bdev); 3549 struct request_queue *r_queue = bdev_get_queue(rdev->bdev);
@@ -4277,9 +4315,7 @@ static inline sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *ski
4277 clear_bit(STRIPE_INSYNC, &sh->state); 4315 clear_bit(STRIPE_INSYNC, &sh->state);
4278 spin_unlock(&sh->lock); 4316 spin_unlock(&sh->lock);
4279 4317
4280 /* wait for any blocked device to be handled */ 4318 handle_stripe(sh);
4281 while (unlikely(!handle_stripe(sh)))
4282 ;
4283 release_stripe(sh); 4319 release_stripe(sh);
4284 4320
4285 return STRIPE_SECTORS; 4321 return STRIPE_SECTORS;
@@ -4349,37 +4385,6 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
4349 return handled; 4385 return handled;
4350} 4386}
4351 4387
4352#ifdef CONFIG_MULTICORE_RAID456
4353static void __process_stripe(void *param, async_cookie_t cookie)
4354{
4355 struct stripe_head *sh = param;
4356
4357 handle_stripe(sh);
4358 release_stripe(sh);
4359}
4360
4361static void process_stripe(struct stripe_head *sh, struct list_head *domain)
4362{
4363 async_schedule_domain(__process_stripe, sh, domain);
4364}
4365
4366static void synchronize_stripe_processing(struct list_head *domain)
4367{
4368 async_synchronize_full_domain(domain);
4369}
4370#else
4371static void process_stripe(struct stripe_head *sh, struct list_head *domain)
4372{
4373 handle_stripe(sh);
4374 release_stripe(sh);
4375 cond_resched();
4376}
4377
4378static void synchronize_stripe_processing(struct list_head *domain)
4379{
4380}
4381#endif
4382
4383 4388
4384/* 4389/*
4385 * This is our raid5 kernel thread. 4390 * This is our raid5 kernel thread.
@@ -4393,7 +4398,6 @@ static void raid5d(mddev_t *mddev)
4393 struct stripe_head *sh; 4398 struct stripe_head *sh;
4394 raid5_conf_t *conf = mddev->private; 4399 raid5_conf_t *conf = mddev->private;
4395 int handled; 4400 int handled;
4396 LIST_HEAD(raid_domain);
4397 4401
4398 pr_debug("+++ raid5d active\n"); 4402 pr_debug("+++ raid5d active\n");
4399 4403
@@ -4430,7 +4434,9 @@ static void raid5d(mddev_t *mddev)
4430 spin_unlock_irq(&conf->device_lock); 4434 spin_unlock_irq(&conf->device_lock);
4431 4435
4432 handled++; 4436 handled++;
4433 process_stripe(sh, &raid_domain); 4437 handle_stripe(sh);
4438 release_stripe(sh);
4439 cond_resched();
4434 4440
4435 spin_lock_irq(&conf->device_lock); 4441 spin_lock_irq(&conf->device_lock);
4436 } 4442 }
@@ -4438,7 +4444,6 @@ static void raid5d(mddev_t *mddev)
4438 4444
4439 spin_unlock_irq(&conf->device_lock); 4445 spin_unlock_irq(&conf->device_lock);
4440 4446
4441 synchronize_stripe_processing(&raid_domain);
4442 async_tx_issue_pending_all(); 4447 async_tx_issue_pending_all();
4443 unplug_slaves(mddev); 4448 unplug_slaves(mddev);
4444 4449
@@ -4558,13 +4563,9 @@ raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks)
4558 4563
4559 if (!sectors) 4564 if (!sectors)
4560 sectors = mddev->dev_sectors; 4565 sectors = mddev->dev_sectors;
4561 if (!raid_disks) { 4566 if (!raid_disks)
4562 /* size is defined by the smallest of previous and new size */ 4567 /* size is defined by the smallest of previous and new size */
4563 if (conf->raid_disks < conf->previous_raid_disks) 4568 raid_disks = min(conf->raid_disks, conf->previous_raid_disks);
4564 raid_disks = conf->raid_disks;
4565 else
4566 raid_disks = conf->previous_raid_disks;
4567 }
4568 4569
4569 sectors &= ~((sector_t)mddev->chunk_sectors - 1); 4570 sectors &= ~((sector_t)mddev->chunk_sectors - 1);
4570 sectors &= ~((sector_t)mddev->new_chunk_sectors - 1); 4571 sectors &= ~((sector_t)mddev->new_chunk_sectors - 1);
@@ -4665,7 +4666,7 @@ static int raid5_alloc_percpu(raid5_conf_t *conf)
4665 } 4666 }
4666 per_cpu_ptr(conf->percpu, cpu)->spare_page = spare_page; 4667 per_cpu_ptr(conf->percpu, cpu)->spare_page = spare_page;
4667 } 4668 }
4668 scribble = kmalloc(scribble_len(conf->raid_disks), GFP_KERNEL); 4669 scribble = kmalloc(conf->scribble_len, GFP_KERNEL);
4669 if (!scribble) { 4670 if (!scribble) {
4670 err = -ENOMEM; 4671 err = -ENOMEM;
4671 break; 4672 break;
@@ -4686,7 +4687,7 @@ static int raid5_alloc_percpu(raid5_conf_t *conf)
4686static raid5_conf_t *setup_conf(mddev_t *mddev) 4687static raid5_conf_t *setup_conf(mddev_t *mddev)
4687{ 4688{
4688 raid5_conf_t *conf; 4689 raid5_conf_t *conf;
4689 int raid_disk, memory; 4690 int raid_disk, memory, max_disks;
4690 mdk_rdev_t *rdev; 4691 mdk_rdev_t *rdev;
4691 struct disk_info *disk; 4692 struct disk_info *disk;
4692 4693
@@ -4722,15 +4723,28 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
4722 conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL); 4723 conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL);
4723 if (conf == NULL) 4724 if (conf == NULL)
4724 goto abort; 4725 goto abort;
4726 spin_lock_init(&conf->device_lock);
4727 init_waitqueue_head(&conf->wait_for_stripe);
4728 init_waitqueue_head(&conf->wait_for_overlap);
4729 INIT_LIST_HEAD(&conf->handle_list);
4730 INIT_LIST_HEAD(&conf->hold_list);
4731 INIT_LIST_HEAD(&conf->delayed_list);
4732 INIT_LIST_HEAD(&conf->bitmap_list);
4733 INIT_LIST_HEAD(&conf->inactive_list);
4734 atomic_set(&conf->active_stripes, 0);
4735 atomic_set(&conf->preread_active_stripes, 0);
4736 atomic_set(&conf->active_aligned_reads, 0);
4737 conf->bypass_threshold = BYPASS_THRESHOLD;
4725 4738
4726 conf->raid_disks = mddev->raid_disks; 4739 conf->raid_disks = mddev->raid_disks;
4727 conf->scribble_len = scribble_len(conf->raid_disks);
4728 if (mddev->reshape_position == MaxSector) 4740 if (mddev->reshape_position == MaxSector)
4729 conf->previous_raid_disks = mddev->raid_disks; 4741 conf->previous_raid_disks = mddev->raid_disks;
4730 else 4742 else
4731 conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks; 4743 conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks;
4744 max_disks = max(conf->raid_disks, conf->previous_raid_disks);
4745 conf->scribble_len = scribble_len(max_disks);
4732 4746
4733 conf->disks = kzalloc(conf->raid_disks * sizeof(struct disk_info), 4747 conf->disks = kzalloc(max_disks * sizeof(struct disk_info),
4734 GFP_KERNEL); 4748 GFP_KERNEL);
4735 if (!conf->disks) 4749 if (!conf->disks)
4736 goto abort; 4750 goto abort;
@@ -4744,24 +4758,11 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
4744 if (raid5_alloc_percpu(conf) != 0) 4758 if (raid5_alloc_percpu(conf) != 0)
4745 goto abort; 4759 goto abort;
4746 4760
4747 spin_lock_init(&conf->device_lock);
4748 init_waitqueue_head(&conf->wait_for_stripe);
4749 init_waitqueue_head(&conf->wait_for_overlap);
4750 INIT_LIST_HEAD(&conf->handle_list);
4751 INIT_LIST_HEAD(&conf->hold_list);
4752 INIT_LIST_HEAD(&conf->delayed_list);
4753 INIT_LIST_HEAD(&conf->bitmap_list);
4754 INIT_LIST_HEAD(&conf->inactive_list);
4755 atomic_set(&conf->active_stripes, 0);
4756 atomic_set(&conf->preread_active_stripes, 0);
4757 atomic_set(&conf->active_aligned_reads, 0);
4758 conf->bypass_threshold = BYPASS_THRESHOLD;
4759
4760 pr_debug("raid5: run(%s) called.\n", mdname(mddev)); 4761 pr_debug("raid5: run(%s) called.\n", mdname(mddev));
4761 4762
4762 list_for_each_entry(rdev, &mddev->disks, same_set) { 4763 list_for_each_entry(rdev, &mddev->disks, same_set) {
4763 raid_disk = rdev->raid_disk; 4764 raid_disk = rdev->raid_disk;
4764 if (raid_disk >= conf->raid_disks 4765 if (raid_disk >= max_disks
4765 || raid_disk < 0) 4766 || raid_disk < 0)
4766 continue; 4767 continue;
4767 disk = conf->disks + raid_disk; 4768 disk = conf->disks + raid_disk;
@@ -4793,7 +4794,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
4793 } 4794 }
4794 4795
4795 memory = conf->max_nr_stripes * (sizeof(struct stripe_head) + 4796 memory = conf->max_nr_stripes * (sizeof(struct stripe_head) +
4796 conf->raid_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; 4797 max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024;
4797 if (grow_stripes(conf, conf->max_nr_stripes)) { 4798 if (grow_stripes(conf, conf->max_nr_stripes)) {
4798 printk(KERN_ERR 4799 printk(KERN_ERR
4799 "raid5: couldn't allocate %dkB for buffers\n", memory); 4800 "raid5: couldn't allocate %dkB for buffers\n", memory);
@@ -4918,7 +4919,8 @@ static int run(mddev_t *mddev)
4918 test_bit(In_sync, &rdev->flags)) 4919 test_bit(In_sync, &rdev->flags))
4919 working_disks++; 4920 working_disks++;
4920 4921
4921 mddev->degraded = conf->raid_disks - working_disks; 4922 mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks)
4923 - working_disks);
4922 4924
4923 if (mddev->degraded > conf->max_degraded) { 4925 if (mddev->degraded > conf->max_degraded) {
4924 printk(KERN_ERR "raid5: not enough operational devices for %s" 4926 printk(KERN_ERR "raid5: not enough operational devices for %s"
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 2390e0e83daf..dd708359b451 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -214,12 +214,20 @@ struct stripe_head {
214 int disks; /* disks in stripe */ 214 int disks; /* disks in stripe */
215 enum check_states check_state; 215 enum check_states check_state;
216 enum reconstruct_states reconstruct_state; 216 enum reconstruct_states reconstruct_state;
217 /* stripe_operations 217 /**
218 * struct stripe_operations
218 * @target - STRIPE_OP_COMPUTE_BLK target 219 * @target - STRIPE_OP_COMPUTE_BLK target
220 * @target2 - 2nd compute target in the raid6 case
221 * @zero_sum_result - P and Q verification flags
222 * @request - async service request flags for raid_run_ops
219 */ 223 */
220 struct stripe_operations { 224 struct stripe_operations {
221 int target, target2; 225 int target, target2;
222 enum sum_check_flags zero_sum_result; 226 enum sum_check_flags zero_sum_result;
227 #ifdef CONFIG_MULTICORE_RAID456
228 unsigned long request;
229 wait_queue_head_t wait_for_ops;
230 #endif
223 } ops; 231 } ops;
224 struct r5dev { 232 struct r5dev {
225 struct bio req; 233 struct bio req;
@@ -294,6 +302,8 @@ struct r6_state {
294#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */ 302#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
295#define STRIPE_BIOFILL_RUN 14 303#define STRIPE_BIOFILL_RUN 14
296#define STRIPE_COMPUTE_RUN 15 304#define STRIPE_COMPUTE_RUN 15
305#define STRIPE_OPS_REQ_PENDING 16
306
297/* 307/*
298 * Operation request flags 308 * Operation request flags
299 */ 309 */
@@ -478,7 +488,7 @@ static inline int algorithm_valid_raid6(int layout)
478{ 488{
479 return (layout >= 0 && layout <= 5) 489 return (layout >= 0 && layout <= 5)
480 || 490 ||
481 (layout == 8 || layout == 10) 491 (layout >= 8 && layout <= 10)
482 || 492 ||
483 (layout >= 16 && layout <= 20); 493 (layout >= 16 && layout <= 20);
484} 494}
diff --git a/drivers/md/raid6altivec.uc b/drivers/md/raid6altivec.uc
index 699dfeee4944..2654d5c854be 100644
--- a/drivers/md/raid6altivec.uc
+++ b/drivers/md/raid6altivec.uc
@@ -15,7 +15,7 @@
15 * 15 *
16 * $#-way unrolled portable integer math RAID-6 instruction set 16 * $#-way unrolled portable integer math RAID-6 instruction set
17 * 17 *
18 * This file is postprocessed using unroll.pl 18 * This file is postprocessed using unroll.awk
19 * 19 *
20 * <benh> hpa: in process, 20 * <benh> hpa: in process,
21 * you can just "steal" the vec unit with enable_kernel_altivec() (but 21 * you can just "steal" the vec unit with enable_kernel_altivec() (but
diff --git a/drivers/md/raid6int.uc b/drivers/md/raid6int.uc
index f9bf9cba357f..d1e276a14fab 100644
--- a/drivers/md/raid6int.uc
+++ b/drivers/md/raid6int.uc
@@ -15,7 +15,7 @@
15 * 15 *
16 * $#-way unrolled portable integer math RAID-6 instruction set 16 * $#-way unrolled portable integer math RAID-6 instruction set
17 * 17 *
18 * This file is postprocessed using unroll.pl 18 * This file is postprocessed using unroll.awk
19 */ 19 */
20 20
21#include <linux/raid/pq.h> 21#include <linux/raid/pq.h>
diff --git a/drivers/md/raid6test/Makefile b/drivers/md/raid6test/Makefile
index 58ffdf4f5161..2874cbef529d 100644
--- a/drivers/md/raid6test/Makefile
+++ b/drivers/md/raid6test/Makefile
@@ -7,7 +7,7 @@ CC = gcc
7OPTFLAGS = -O2 # Adjust as desired 7OPTFLAGS = -O2 # Adjust as desired
8CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) 8CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS)
9LD = ld 9LD = ld
10PERL = perl 10AWK = awk
11AR = ar 11AR = ar
12RANLIB = ranlib 12RANLIB = ranlib
13 13
@@ -35,35 +35,35 @@ raid6.a: raid6int1.o raid6int2.o raid6int4.o raid6int8.o raid6int16.o \
35raid6test: test.c raid6.a 35raid6test: test.c raid6.a
36 $(CC) $(CFLAGS) -o raid6test $^ 36 $(CC) $(CFLAGS) -o raid6test $^
37 37
38raid6altivec1.c: raid6altivec.uc ../unroll.pl 38raid6altivec1.c: raid6altivec.uc ../unroll.awk
39 $(PERL) ../unroll.pl 1 < raid6altivec.uc > $@ 39 $(AWK) ../unroll.awk -vN=1 < raid6altivec.uc > $@
40 40
41raid6altivec2.c: raid6altivec.uc ../unroll.pl 41raid6altivec2.c: raid6altivec.uc ../unroll.awk
42 $(PERL) ../unroll.pl 2 < raid6altivec.uc > $@ 42 $(AWK) ../unroll.awk -vN=2 < raid6altivec.uc > $@
43 43
44raid6altivec4.c: raid6altivec.uc ../unroll.pl 44raid6altivec4.c: raid6altivec.uc ../unroll.awk
45 $(PERL) ../unroll.pl 4 < raid6altivec.uc > $@ 45 $(AWK) ../unroll.awk -vN=4 < raid6altivec.uc > $@
46 46
47raid6altivec8.c: raid6altivec.uc ../unroll.pl 47raid6altivec8.c: raid6altivec.uc ../unroll.awk
48 $(PERL) ../unroll.pl 8 < raid6altivec.uc > $@ 48 $(AWK) ../unroll.awk -vN=8 < raid6altivec.uc > $@
49 49
50raid6int1.c: raid6int.uc ../unroll.pl 50raid6int1.c: raid6int.uc ../unroll.awk
51 $(PERL) ../unroll.pl 1 < raid6int.uc > $@ 51 $(AWK) ../unroll.awk -vN=1 < raid6int.uc > $@
52 52
53raid6int2.c: raid6int.uc ../unroll.pl 53raid6int2.c: raid6int.uc ../unroll.awk
54 $(PERL) ../unroll.pl 2 < raid6int.uc > $@ 54 $(AWK) ../unroll.awk -vN=2 < raid6int.uc > $@
55 55
56raid6int4.c: raid6int.uc ../unroll.pl 56raid6int4.c: raid6int.uc ../unroll.awk
57 $(PERL) ../unroll.pl 4 < raid6int.uc > $@ 57 $(AWK) ../unroll.awk -vN=4 < raid6int.uc > $@
58 58
59raid6int8.c: raid6int.uc ../unroll.pl 59raid6int8.c: raid6int.uc ../unroll.awk
60 $(PERL) ../unroll.pl 8 < raid6int.uc > $@ 60 $(AWK) ../unroll.awk -vN=8 < raid6int.uc > $@
61 61
62raid6int16.c: raid6int.uc ../unroll.pl 62raid6int16.c: raid6int.uc ../unroll.awk
63 $(PERL) ../unroll.pl 16 < raid6int.uc > $@ 63 $(AWK) ../unroll.awk -vN=16 < raid6int.uc > $@
64 64
65raid6int32.c: raid6int.uc ../unroll.pl 65raid6int32.c: raid6int.uc ../unroll.awk
66 $(PERL) ../unroll.pl 32 < raid6int.uc > $@ 66 $(AWK) ../unroll.awk -vN=32 < raid6int.uc > $@
67 67
68raid6tables.c: mktables 68raid6tables.c: mktables
69 ./mktables > raid6tables.c 69 ./mktables > raid6tables.c
diff --git a/drivers/md/unroll.awk b/drivers/md/unroll.awk
new file mode 100644
index 000000000000..c6aa03631df8
--- /dev/null
+++ b/drivers/md/unroll.awk
@@ -0,0 +1,20 @@
1
2# This filter requires one command line option of form -vN=n
3# where n must be a decimal number.
4#
5# Repeat each input line containing $$ n times, replacing $$ with 0...n-1.
6# Replace each $# with n, and each $* with a single $.
7
8BEGIN {
9 n = N + 0
10}
11{
12 if (/\$\$/) { rep = n } else { rep = 1 }
13 for (i = 0; i < rep; ++i) {
14 tmp = $0
15 gsub(/\$\$/, i, tmp)
16 gsub(/\$\#/, n, tmp)
17 gsub(/\$\*/, "$", tmp)
18 print tmp
19 }
20}
diff --git a/drivers/md/unroll.pl b/drivers/md/unroll.pl
deleted file mode 100644
index 3acc710a20ea..000000000000
--- a/drivers/md/unroll.pl
+++ /dev/null
@@ -1,24 +0,0 @@
1#!/usr/bin/perl
2#
3# Take a piece of C code and for each line which contains the sequence $$
4# repeat n times with $ replaced by 0...n-1; the sequence $# is replaced
5# by the unrolling factor, and $* with a single $
6#
7
8($n) = @ARGV;
9$n += 0;
10
11while ( defined($line = <STDIN>) ) {
12 if ( $line =~ /\$\$/ ) {
13 $rep = $n;
14 } else {
15 $rep = 1;
16 }
17 for ( $i = 0 ; $i < $rep ; $i++ ) {
18 $tmp = $line;
19 $tmp =~ s/\$\$/$i/g;
20 $tmp =~ s/\$\#/$n/g;
21 $tmp =~ s/\$\*/\$/g;
22 print $tmp;
23 }
24}
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index e832e975da60..a1c47ee95c0e 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -795,7 +795,7 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
795 twl->client = i2c_new_dummy(client->adapter, 795 twl->client = i2c_new_dummy(client->adapter,
796 twl->address); 796 twl->address);
797 if (!twl->client) { 797 if (!twl->client) {
798 dev_err(&twl->client->dev, 798 dev_err(&client->dev,
799 "can't attach client %d\n", i); 799 "can't attach client %d\n", i);
800 status = -ENOMEM; 800 status = -ENOMEM;
801 goto fail; 801 goto fail;
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c
index d3015dfb9134..ac056ea6b66e 100644
--- a/drivers/mfd/wm831x-irq.c
+++ b/drivers/mfd/wm831x-irq.c
@@ -507,6 +507,8 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
507{ 507{
508 int i, ret; 508 int i, ret;
509 509
510 mutex_init(&wm831x->irq_lock);
511
510 if (!irq) { 512 if (!irq) {
511 dev_warn(wm831x->dev, 513 dev_warn(wm831x->dev,
512 "No interrupt specified - functionality limited\n"); 514 "No interrupt specified - functionality limited\n");
@@ -521,7 +523,6 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
521 } 523 }
522 524
523 wm831x->irq = irq; 525 wm831x->irq = irq;
524 mutex_init(&wm831x->irq_lock);
525 INIT_WORK(&wm831x->irq_work, wm831x_irq_worker); 526 INIT_WORK(&wm831x->irq_work, wm831x_irq_worker);
526 527
527 /* Mask the individual interrupt sources */ 528 /* Mask the individual interrupt sources */
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index e556d42cc45a..63924e0c7ea9 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -72,7 +72,6 @@
72#include <asm/irq.h> 72#include <asm/irq.h>
73#include <asm/gpio.h> 73#include <asm/gpio.h>
74 74
75#include <asm/mach/mmc.h>
76#include <mach/board.h> 75#include <mach/board.h>
77#include <mach/cpu.h> 76#include <mach/cpu.h>
78#include <mach/at91_mci.h> 77#include <mach/at91_mci.h>
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4487cc097911..0aecaaebef3d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2013,7 +2013,7 @@ static struct platform_driver omap_hsmmc_driver = {
2013static int __init omap_hsmmc_init(void) 2013static int __init omap_hsmmc_init(void)
2014{ 2014{
2015 /* Register the MMC driver */ 2015 /* Register the MMC driver */
2016 return platform_driver_register(&omap_hsmmc_driver); 2016 return platform_driver_probe(&omap_hsmmc_driver, omap_hsmmc_probe);
2017} 2017}
2018 2018
2019static void __exit omap_hsmmc_cleanup(void) 2019static void __exit omap_hsmmc_cleanup(void)
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index e1f7d0a78b9d..14cec04c34f9 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -42,6 +42,7 @@
42#include <linux/log2.h> 42#include <linux/log2.h>
43#include <linux/kthread.h> 43#include <linux/kthread.h>
44#include <linux/reboot.h> 44#include <linux/reboot.h>
45#include <linux/kernel.h>
45#include "ubi.h" 46#include "ubi.h"
46 47
47/* Maximum length of the 'mtd=' parameter */ 48/* Maximum length of the 'mtd=' parameter */
@@ -1257,7 +1258,7 @@ static int __init bytes_str_to_int(const char *str)
1257 unsigned long result; 1258 unsigned long result;
1258 1259
1259 result = simple_strtoul(str, &endp, 0); 1260 result = simple_strtoul(str, &endp, 0);
1260 if (str == endp || result < 0) { 1261 if (str == endp || result >= INT_MAX) {
1261 printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n", 1262 printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n",
1262 str); 1263 str);
1263 return -EINVAL; 1264 return -EINVAL;
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index e7161adc419d..90af61a2c3e4 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -794,16 +794,15 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
794 * number. 794 * number.
795 */ 795 */
796 image_seq = be32_to_cpu(ech->image_seq); 796 image_seq = be32_to_cpu(ech->image_seq);
797 if (!si->image_seq_set) { 797 if (!ubi->image_seq && image_seq)
798 ubi->image_seq = image_seq; 798 ubi->image_seq = image_seq;
799 si->image_seq_set = 1; 799 if (ubi->image_seq && image_seq &&
800 } else if (ubi->image_seq && ubi->image_seq != image_seq) { 800 ubi->image_seq != image_seq) {
801 ubi_err("bad image sequence number %d in PEB %d, " 801 ubi_err("bad image sequence number %d in PEB %d, "
802 "expected %d", image_seq, pnum, ubi->image_seq); 802 "expected %d", image_seq, pnum, ubi->image_seq);
803 ubi_dbg_dump_ec_hdr(ech); 803 ubi_dbg_dump_ec_hdr(ech);
804 return -EINVAL; 804 return -EINVAL;
805 } 805 }
806
807 } 806 }
808 807
809 /* OK, we've done with the EC header, let's look at the VID header */ 808 /* OK, we've done with the EC header, let's look at the VID header */
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h
index bab31695dace..ff179ad7ca55 100644
--- a/drivers/mtd/ubi/scan.h
+++ b/drivers/mtd/ubi/scan.h
@@ -103,7 +103,6 @@ struct ubi_scan_volume {
103 * @ec_sum: a temporary variable used when calculating @mean_ec 103 * @ec_sum: a temporary variable used when calculating @mean_ec
104 * @ec_count: a temporary variable used when calculating @mean_ec 104 * @ec_count: a temporary variable used when calculating @mean_ec
105 * @corr_count: count of corrupted PEBs 105 * @corr_count: count of corrupted PEBs
106 * @image_seq_set: indicates @ubi->image_seq is known
107 * 106 *
108 * This data structure contains the result of scanning and may be used by other 107 * This data structure contains the result of scanning and may be used by other
109 * UBI sub-systems to build final UBI data structures, further error-recovery 108 * UBI sub-systems to build final UBI data structures, further error-recovery
@@ -127,7 +126,6 @@ struct ubi_scan_info {
127 uint64_t ec_sum; 126 uint64_t ec_sum;
128 int ec_count; 127 int ec_count;
129 int corr_count; 128 int corr_count;
130 int image_seq_set;
131}; 129};
132 130
133struct ubi_device; 131struct ubi_device;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 712776089b46..e19ca4bb7510 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1741,6 +1741,7 @@ config KS8851
1741config KS8851_MLL 1741config KS8851_MLL
1742 tristate "Micrel KS8851 MLL" 1742 tristate "Micrel KS8851 MLL"
1743 depends on HAS_IOMEM 1743 depends on HAS_IOMEM
1744 select MII
1744 help 1745 help
1745 This platform driver is for Micrel KS8851 Address/data bus 1746 This platform driver is for Micrel KS8851 Address/data bus
1746 multiplexed network chip. 1747 multiplexed network chip.
@@ -2482,6 +2483,8 @@ config S6GMAC
2482 To compile this driver as a module, choose M here. The module 2483 To compile this driver as a module, choose M here. The module
2483 will be called s6gmac. 2484 will be called s6gmac.
2484 2485
2486source "drivers/net/stmmac/Kconfig"
2487
2485endif # NETDEV_1000 2488endif # NETDEV_1000
2486 2489
2487# 2490#
@@ -3230,4 +3233,12 @@ config VIRTIO_NET
3230 This is the virtual network driver for virtio. It can be used with 3233 This is the virtual network driver for virtio. It can be used with
3231 lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. 3234 lguest or QEMU based VMMs (like KVM or Xen). Say Y or M.
3232 3235
3236config VMXNET3
3237 tristate "VMware VMXNET3 ethernet driver"
3238 depends on PCI && X86 && INET
3239 help
3240 This driver supports VMware's vmxnet3 virtual ethernet NIC.
3241 To compile this driver as a module, choose M here: the
3242 module will be called vmxnet3.
3243
3233endif # NETDEVICES 3244endif # NETDEVICES
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index d866b8cf65d1..246323d7f161 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -2,6 +2,10 @@
2# Makefile for the Linux network (ethercard) device drivers. 2# Makefile for the Linux network (ethercard) device drivers.
3# 3#
4 4
5obj-$(CONFIG_MII) += mii.o
6obj-$(CONFIG_MDIO) += mdio.o
7obj-$(CONFIG_PHYLIB) += phy/
8
5obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o 9obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
6 10
7obj-$(CONFIG_E1000) += e1000/ 11obj-$(CONFIG_E1000) += e1000/
@@ -26,6 +30,7 @@ obj-$(CONFIG_TEHUTI) += tehuti.o
26obj-$(CONFIG_ENIC) += enic/ 30obj-$(CONFIG_ENIC) += enic/
27obj-$(CONFIG_JME) += jme.o 31obj-$(CONFIG_JME) += jme.o
28obj-$(CONFIG_BE2NET) += benet/ 32obj-$(CONFIG_BE2NET) += benet/
33obj-$(CONFIG_VMXNET3) += vmxnet3/
29 34
30gianfar_driver-objs := gianfar.o \ 35gianfar_driver-objs := gianfar.o \
31 gianfar_ethtool.o \ 36 gianfar_ethtool.o \
@@ -95,15 +100,12 @@ obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o
95obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o 100obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o
96obj-$(CONFIG_RIONET) += rionet.o 101obj-$(CONFIG_RIONET) += rionet.o
97obj-$(CONFIG_SH_ETH) += sh_eth.o 102obj-$(CONFIG_SH_ETH) += sh_eth.o
103obj-$(CONFIG_STMMAC_ETH) += stmmac/
98 104
99# 105#
100# end link order section 106# end link order section
101# 107#
102 108
103obj-$(CONFIG_MII) += mii.o
104obj-$(CONFIG_MDIO) += mdio.o
105obj-$(CONFIG_PHYLIB) += phy/
106
107obj-$(CONFIG_SUNDANCE) += sundance.o 109obj-$(CONFIG_SUNDANCE) += sundance.o
108obj-$(CONFIG_HAMACHI) += hamachi.o 110obj-$(CONFIG_HAMACHI) += hamachi.o
109obj-$(CONFIG_NET) += Space.o loopback.o 111obj-$(CONFIG_NET) += Space.o loopback.o
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 5f0b05c2d71f..d82a9a994753 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -1209,7 +1209,8 @@ static int __devinit ace_init(struct net_device *dev)
1209 memset(ap->info, 0, sizeof(struct ace_info)); 1209 memset(ap->info, 0, sizeof(struct ace_info));
1210 memset(ap->skb, 0, sizeof(struct ace_skb)); 1210 memset(ap->skb, 0, sizeof(struct ace_skb));
1211 1211
1212 if (ace_load_firmware(dev)) 1212 ecode = ace_load_firmware(dev);
1213 if (ecode)
1213 goto init_error; 1214 goto init_error;
1214 1215
1215 ap->fw_running = 0; 1216 ap->fw_running = 0;
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 04f63c77071d..ce6f1ac25df8 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -34,6 +34,7 @@
34 * 34 *
35 * 35 *
36 */ 36 */
37#include <linux/capability.h>
37#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
38#include <linux/module.h> 39#include <linux/module.h>
39#include <linux/kernel.h> 40#include <linux/kernel.h>
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 89876ade5e33..28a0eda92680 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -243,15 +243,26 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
243 243
244int be_cmd_POST(struct be_adapter *adapter) 244int be_cmd_POST(struct be_adapter *adapter)
245{ 245{
246 u16 stage, error; 246 u16 stage;
247 int status, timeout = 0;
247 248
248 error = be_POST_stage_get(adapter, &stage); 249 do {
249 if (error || stage != POST_STAGE_ARMFW_RDY) { 250 status = be_POST_stage_get(adapter, &stage);
250 dev_err(&adapter->pdev->dev, "POST failed.\n"); 251 if (status) {
251 return -1; 252 dev_err(&adapter->pdev->dev, "POST error; stage=0x%x\n",
252 } 253 stage);
254 return -1;
255 } else if (stage != POST_STAGE_ARMFW_RDY) {
256 set_current_state(TASK_INTERRUPTIBLE);
257 schedule_timeout(2 * HZ);
258 timeout += 2;
259 } else {
260 return 0;
261 }
262 } while (timeout < 20);
253 263
254 return 0; 264 dev_err(&adapter->pdev->dev, "POST timeout; stage=0x%x\n", stage);
265 return -1;
255} 266}
256 267
257static inline void *embedded_payload(struct be_mcc_wrb *wrb) 268static inline void *embedded_payload(struct be_mcc_wrb *wrb)
@@ -729,8 +740,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
729/* Create an rx filtering policy configuration on an i/f 740/* Create an rx filtering policy configuration on an i/f
730 * Uses mbox 741 * Uses mbox
731 */ 742 */
732int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac, 743int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
733 bool pmac_invalid, u32 *if_handle, u32 *pmac_id) 744 u8 *mac, bool pmac_invalid, u32 *if_handle, u32 *pmac_id)
734{ 745{
735 struct be_mcc_wrb *wrb; 746 struct be_mcc_wrb *wrb;
736 struct be_cmd_req_if_create *req; 747 struct be_cmd_req_if_create *req;
@@ -746,8 +757,8 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac,
746 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 757 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
747 OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req)); 758 OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req));
748 759
749 req->capability_flags = cpu_to_le32(flags); 760 req->capability_flags = cpu_to_le32(cap_flags);
750 req->enable_flags = cpu_to_le32(flags); 761 req->enable_flags = cpu_to_le32(en_flags);
751 req->pmac_invalid = pmac_invalid; 762 req->pmac_invalid = pmac_invalid;
752 if (!pmac_invalid) 763 if (!pmac_invalid)
753 memcpy(req->mac_addr, mac, ETH_ALEN); 764 memcpy(req->mac_addr, mac, ETH_ALEN);
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index a86f917f85f4..49953787e41c 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -720,8 +720,9 @@ extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
720extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, 720extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
721 u32 if_id, u32 *pmac_id); 721 u32 if_id, u32 *pmac_id);
722extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id); 722extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id);
723extern int be_cmd_if_create(struct be_adapter *adapter, u32 if_flags, u8 *mac, 723extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags,
724 bool pmac_invalid, u32 *if_handle, u32 *pmac_id); 724 u32 en_flags, u8 *mac, bool pmac_invalid,
725 u32 *if_handle, u32 *pmac_id);
725extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle); 726extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle);
726extern int be_cmd_eq_create(struct be_adapter *adapter, 727extern int be_cmd_eq_create(struct be_adapter *adapter,
727 struct be_queue_info *eq, int eq_delay); 728 struct be_queue_info *eq, int eq_delay);
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 6d5e81f7046f..1f941f027718 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1620,19 +1620,22 @@ static int be_open(struct net_device *netdev)
1620static int be_setup(struct be_adapter *adapter) 1620static int be_setup(struct be_adapter *adapter)
1621{ 1621{
1622 struct net_device *netdev = adapter->netdev; 1622 struct net_device *netdev = adapter->netdev;
1623 u32 if_flags; 1623 u32 cap_flags, en_flags;
1624 int status; 1624 int status;
1625 1625
1626 if_flags = BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PROMISCUOUS | 1626 cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST |
1627 BE_IF_FLAGS_MCAST_PROMISCUOUS | BE_IF_FLAGS_UNTAGGED | 1627 BE_IF_FLAGS_MCAST_PROMISCUOUS |
1628 BE_IF_FLAGS_PASS_L3L4_ERRORS; 1628 BE_IF_FLAGS_PROMISCUOUS |
1629 status = be_cmd_if_create(adapter, if_flags, netdev->dev_addr, 1629 BE_IF_FLAGS_PASS_L3L4_ERRORS;
1630 false/* pmac_invalid */, &adapter->if_handle, 1630 en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST |
1631 &adapter->pmac_id); 1631 BE_IF_FLAGS_PASS_L3L4_ERRORS;
1632
1633 status = be_cmd_if_create(adapter, cap_flags, en_flags,
1634 netdev->dev_addr, false/* pmac_invalid */,
1635 &adapter->if_handle, &adapter->pmac_id);
1632 if (status != 0) 1636 if (status != 0)
1633 goto do_none; 1637 goto do_none;
1634 1638
1635
1636 status = be_tx_queues_create(adapter); 1639 status = be_tx_queues_create(adapter);
1637 if (status != 0) 1640 if (status != 0)
1638 goto if_destroy; 1641 goto if_destroy;
@@ -2055,6 +2058,10 @@ static int be_hw_up(struct be_adapter *adapter)
2055 if (status) 2058 if (status)
2056 return status; 2059 return status;
2057 2060
2061 status = be_cmd_reset_function(adapter);
2062 if (status)
2063 return status;
2064
2058 status = be_cmd_get_fw_ver(adapter, adapter->fw_ver); 2065 status = be_cmd_get_fw_ver(adapter, adapter->fw_ver);
2059 if (status) 2066 if (status)
2060 return status; 2067 return status;
@@ -2108,10 +2115,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
2108 if (status) 2115 if (status)
2109 goto free_netdev; 2116 goto free_netdev;
2110 2117
2111 status = be_cmd_reset_function(adapter);
2112 if (status)
2113 goto ctrl_clean;
2114
2115 status = be_stats_init(adapter); 2118 status = be_stats_init(adapter);
2116 if (status) 2119 if (status)
2117 goto ctrl_clean; 2120 goto ctrl_clean;
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 6c7f795d12de..a4d83409f205 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -361,9 +361,12 @@ struct l2_fhdr {
361#define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE (1<<28) 361#define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE (1<<28)
362 362
363#define BNX2_L2CTX_HOST_BDIDX 0x00000004 363#define BNX2_L2CTX_HOST_BDIDX 0x00000004
364#define BNX2_L2CTX_STATUSB_NUM_SHIFT 16 364#define BNX2_L2CTX_L5_STATUSB_NUM_SHIFT 16
365#define BNX2_L2CTX_STATUSB_NUM(sb_id) \ 365#define BNX2_L2CTX_L2_STATUSB_NUM_SHIFT 24
366 (((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_STATUSB_NUM_SHIFT) : 0) 366#define BNX2_L2CTX_L5_STATUSB_NUM(sb_id) \
367 (((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_L5_STATUSB_NUM_SHIFT) : 0)
368#define BNX2_L2CTX_L2_STATUSB_NUM(sb_id) \
369 (((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_L2_STATUSB_NUM_SHIFT) : 0)
367#define BNX2_L2CTX_HOST_BSEQ 0x00000008 370#define BNX2_L2CTX_HOST_BSEQ 0x00000008
368#define BNX2_L2CTX_NX_BSEQ 0x0000000c 371#define BNX2_L2CTX_NX_BSEQ 0x0000000c
369#define BNX2_L2CTX_NX_BDHADDR_HI 0x00000010 372#define BNX2_L2CTX_NX_BDHADDR_HI 0x00000010
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 69c5b15e22da..40fb5eefc72e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -691,7 +691,7 @@ static int bond_check_dev_link(struct bonding *bond,
691 struct net_device *slave_dev, int reporting) 691 struct net_device *slave_dev, int reporting)
692{ 692{
693 const struct net_device_ops *slave_ops = slave_dev->netdev_ops; 693 const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
694 static int (*ioctl)(struct net_device *, struct ifreq *, int); 694 int (*ioctl)(struct net_device *, struct ifreq *, int);
695 struct ifreq ifr; 695 struct ifreq ifr;
696 struct mii_ioctl_data *mii; 696 struct mii_ioctl_data *mii;
697 697
@@ -3665,10 +3665,10 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb,
3665 3665
3666 if (skb->protocol == htons(ETH_P_IP)) { 3666 if (skb->protocol == htons(ETH_P_IP)) {
3667 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ 3667 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
3668 (data->h_dest[5] ^ bond_dev->dev_addr[5])) % count; 3668 (data->h_dest[5] ^ data->h_source[5])) % count;
3669 } 3669 }
3670 3670
3671 return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; 3671 return (data->h_dest[5] ^ data->h_source[5]) % count;
3672} 3672}
3673 3673
3674/* 3674/*
@@ -3695,7 +3695,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
3695 3695
3696 } 3696 }
3697 3697
3698 return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; 3698 return (data->h_dest[5] ^ data->h_source[5]) % count;
3699} 3699}
3700 3700
3701/* 3701/*
@@ -3706,7 +3706,7 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb,
3706{ 3706{
3707 struct ethhdr *data = (struct ethhdr *)skb->data; 3707 struct ethhdr *data = (struct ethhdr *)skb->data;
3708 3708
3709 return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; 3709 return (data->h_dest[5] ^ data->h_source[5]) % count;
3710} 3710}
3711 3711
3712/*-------------------------- Device entry points ----------------------------*/ 3712/*-------------------------- Device entry points ----------------------------*/
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index 3373560405ba..9dd076a626a5 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -213,6 +213,7 @@ static struct of_device_id __devinitdata sja1000_ofp_table[] = {
213 {.compatible = "nxp,sja1000"}, 213 {.compatible = "nxp,sja1000"},
214 {}, 214 {},
215}; 215};
216MODULE_DEVICE_TABLE(of, sja1000_ofp_table);
216 217
217static struct of_platform_driver sja1000_ofp_driver = { 218static struct of_platform_driver sja1000_ofp_driver = {
218 .owner = THIS_MODULE, 219 .owner = THIS_MODULE,
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 46c87ec7960c..3bf1b04f2cab 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2264,9 +2264,9 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev)
2264 cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_CTX_TYPE, val); 2264 cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_CTX_TYPE, val);
2265 2265
2266 if (sb_id == 0) 2266 if (sb_id == 0)
2267 val = 2 << BNX2_L2CTX_STATUSB_NUM_SHIFT; 2267 val = 2 << BNX2_L2CTX_L2_STATUSB_NUM_SHIFT;
2268 else 2268 else
2269 val = BNX2_L2CTX_STATUSB_NUM(sb_id); 2269 val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id);
2270 cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val); 2270 cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val);
2271 2271
2272 rxbd = (struct rx_bd *) (cp->l2_ring + BCM_PAGE_SIZE); 2272 rxbd = (struct rx_bd *) (cp->l2_ring + BCM_PAGE_SIZE);
@@ -2423,7 +2423,7 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
2423 cp->int_num = 0; 2423 cp->int_num = 0;
2424 if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { 2424 if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) {
2425 u32 sb_id = cp->status_blk_num; 2425 u32 sb_id = cp->status_blk_num;
2426 u32 sb = BNX2_L2CTX_STATUSB_NUM(sb_id); 2426 u32 sb = BNX2_L2CTX_L5_STATUSB_NUM(sb_id);
2427 2427
2428 cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; 2428 cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT;
2429 cnic_ctx_wr(dev, cp->kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); 2429 cnic_ctx_wr(dev, cp->kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb);
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 65a2d0ba64e2..f72c56dec33c 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -333,6 +333,9 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";
333#define EMAC_DM646X_MAC_EOI_C0_RXEN (0x01) 333#define EMAC_DM646X_MAC_EOI_C0_RXEN (0x01)
334#define EMAC_DM646X_MAC_EOI_C0_TXEN (0x02) 334#define EMAC_DM646X_MAC_EOI_C0_TXEN (0x02)
335 335
336/* EMAC Stats Clear Mask */
337#define EMAC_STATS_CLR_MASK (0xFFFFFFFF)
338
336/** net_buf_obj: EMAC network bufferdata structure 339/** net_buf_obj: EMAC network bufferdata structure
337 * 340 *
338 * EMAC network buffer data structure 341 * EMAC network buffer data structure
@@ -2548,40 +2551,49 @@ static int emac_dev_stop(struct net_device *ndev)
2548static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) 2551static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev)
2549{ 2552{
2550 struct emac_priv *priv = netdev_priv(ndev); 2553 struct emac_priv *priv = netdev_priv(ndev);
2554 u32 mac_control;
2555 u32 stats_clear_mask;
2551 2556
2552 /* update emac hardware stats and reset the registers*/ 2557 /* update emac hardware stats and reset the registers*/
2553 2558
2559 mac_control = emac_read(EMAC_MACCONTROL);
2560
2561 if (mac_control & EMAC_MACCONTROL_GMIIEN)
2562 stats_clear_mask = EMAC_STATS_CLR_MASK;
2563 else
2564 stats_clear_mask = 0;
2565
2554 priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES); 2566 priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES);
2555 emac_write(EMAC_RXMCASTFRAMES, EMAC_ALL_MULTI_REG_VALUE); 2567 emac_write(EMAC_RXMCASTFRAMES, stats_clear_mask);
2556 2568
2557 priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) + 2569 priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) +
2558 emac_read(EMAC_TXSINGLECOLL) + 2570 emac_read(EMAC_TXSINGLECOLL) +
2559 emac_read(EMAC_TXMULTICOLL)); 2571 emac_read(EMAC_TXMULTICOLL));
2560 emac_write(EMAC_TXCOLLISION, EMAC_ALL_MULTI_REG_VALUE); 2572 emac_write(EMAC_TXCOLLISION, stats_clear_mask);
2561 emac_write(EMAC_TXSINGLECOLL, EMAC_ALL_MULTI_REG_VALUE); 2573 emac_write(EMAC_TXSINGLECOLL, stats_clear_mask);
2562 emac_write(EMAC_TXMULTICOLL, EMAC_ALL_MULTI_REG_VALUE); 2574 emac_write(EMAC_TXMULTICOLL, stats_clear_mask);
2563 2575
2564 priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + 2576 priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) +
2565 emac_read(EMAC_RXJABBER) + 2577 emac_read(EMAC_RXJABBER) +
2566 emac_read(EMAC_RXUNDERSIZED)); 2578 emac_read(EMAC_RXUNDERSIZED));
2567 emac_write(EMAC_RXOVERSIZED, EMAC_ALL_MULTI_REG_VALUE); 2579 emac_write(EMAC_RXOVERSIZED, stats_clear_mask);
2568 emac_write(EMAC_RXJABBER, EMAC_ALL_MULTI_REG_VALUE); 2580 emac_write(EMAC_RXJABBER, stats_clear_mask);
2569 emac_write(EMAC_RXUNDERSIZED, EMAC_ALL_MULTI_REG_VALUE); 2581 emac_write(EMAC_RXUNDERSIZED, stats_clear_mask);
2570 2582
2571 priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + 2583 priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) +
2572 emac_read(EMAC_RXMOFOVERRUNS)); 2584 emac_read(EMAC_RXMOFOVERRUNS));
2573 emac_write(EMAC_RXSOFOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); 2585 emac_write(EMAC_RXSOFOVERRUNS, stats_clear_mask);
2574 emac_write(EMAC_RXMOFOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); 2586 emac_write(EMAC_RXMOFOVERRUNS, stats_clear_mask);
2575 2587
2576 priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); 2588 priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS);
2577 emac_write(EMAC_RXDMAOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); 2589 emac_write(EMAC_RXDMAOVERRUNS, stats_clear_mask);
2578 2590
2579 priv->net_dev_stats.tx_carrier_errors += 2591 priv->net_dev_stats.tx_carrier_errors +=
2580 emac_read(EMAC_TXCARRIERSENSE); 2592 emac_read(EMAC_TXCARRIERSENSE);
2581 emac_write(EMAC_TXCARRIERSENSE, EMAC_ALL_MULTI_REG_VALUE); 2593 emac_write(EMAC_TXCARRIERSENSE, stats_clear_mask);
2582 2594
2583 priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); 2595 priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN);
2584 emac_write(EMAC_TXUNDERRUN, EMAC_ALL_MULTI_REG_VALUE); 2596 emac_write(EMAC_TXUNDERRUN, stats_clear_mask);
2585 2597
2586 return &priv->net_dev_stats; 2598 return &priv->net_dev_stats;
2587} 2599}
diff --git a/drivers/net/dm9000.h b/drivers/net/dm9000.h
index 80817c2edfb3..fb1c924d79b4 100644
--- a/drivers/net/dm9000.h
+++ b/drivers/net/dm9000.h
@@ -50,7 +50,7 @@
50#define DM9000_RCSR 0x32 50#define DM9000_RCSR 0x32
51 51
52#define CHIPR_DM9000A 0x19 52#define CHIPR_DM9000A 0x19
53#define CHIPR_DM9000B 0x1B 53#define CHIPR_DM9000B 0x1A
54 54
55#define DM9000_MRCMDX 0xF0 55#define DM9000_MRCMDX 0xF0
56#define DM9000_MRCMD 0xF2 56#define DM9000_MRCMD 0xF2
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 5d2f48f02251..3c29a20b751e 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1427,19 +1427,31 @@ static int e100_phy_init(struct nic *nic)
1427 } else 1427 } else
1428 DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id); 1428 DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id);
1429 1429
1430 /* Isolate all the PHY ids */
1431 for (addr = 0; addr < 32; addr++)
1432 mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE);
1433 /* Select the discovered PHY */
1434 bmcr &= ~BMCR_ISOLATE;
1435 mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr);
1436
1437 /* Get phy ID */ 1430 /* Get phy ID */
1438 id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1); 1431 id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1);
1439 id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2); 1432 id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2);
1440 nic->phy = (u32)id_hi << 16 | (u32)id_lo; 1433 nic->phy = (u32)id_hi << 16 | (u32)id_lo;
1441 DPRINTK(HW, DEBUG, "phy ID = 0x%08X\n", nic->phy); 1434 DPRINTK(HW, DEBUG, "phy ID = 0x%08X\n", nic->phy);
1442 1435
1436 /* Select the phy and isolate the rest */
1437 for (addr = 0; addr < 32; addr++) {
1438 if (addr != nic->mii.phy_id) {
1439 mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE);
1440 } else if (nic->phy != phy_82552_v) {
1441 bmcr = mdio_read(netdev, addr, MII_BMCR);
1442 mdio_write(netdev, addr, MII_BMCR,
1443 bmcr & ~BMCR_ISOLATE);
1444 }
1445 }
1446 /*
1447 * Workaround for 82552:
1448 * Clear the ISOLATE bit on selected phy_id last (mirrored on all
1449 * other phy_id's) using bmcr value from addr discovery loop above.
1450 */
1451 if (nic->phy == phy_82552_v)
1452 mdio_write(netdev, nic->mii.phy_id, MII_BMCR,
1453 bmcr & ~BMCR_ISOLATE);
1454
1443 /* Handle National tx phys */ 1455 /* Handle National tx phys */
1444#define NCS_PHY_MODEL_MASK 0xFFF0FFFF 1456#define NCS_PHY_MODEL_MASK 0xFFF0FFFF
1445 if ((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) { 1457 if ((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) {
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index c0f185beb8bc..1190167a8b3d 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -76,6 +76,7 @@
76/* Extended Device Control */ 76/* Extended Device Control */
77#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Definable Pin 7 */ 77#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Definable Pin 7 */
78#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ 78#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */
79#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */
79#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ 80#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */
80#define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */ 81#define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */
81#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 82#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
@@ -347,6 +348,7 @@
347/* Extended Configuration Control and Size */ 348/* Extended Configuration Control and Size */
348#define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 349#define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020
349#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 350#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001
351#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008
350#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 352#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020
351#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000 353#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000
352#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16 354#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index 981936c1fb46..189dfa2d6c76 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -141,6 +141,20 @@ struct e1000_info;
141#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ 141#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */
142#define HV_TNCRS_LOWER PHY_REG(778, 30) 142#define HV_TNCRS_LOWER PHY_REG(778, 30)
143 143
144/* BM PHY Copper Specific Status */
145#define BM_CS_STATUS 17
146#define BM_CS_STATUS_LINK_UP 0x0400
147#define BM_CS_STATUS_RESOLVED 0x0800
148#define BM_CS_STATUS_SPEED_MASK 0xC000
149#define BM_CS_STATUS_SPEED_1000 0x8000
150
151/* 82577 Mobile Phy Status Register */
152#define HV_M_STATUS 26
153#define HV_M_STATUS_AUTONEG_COMPLETE 0x1000
154#define HV_M_STATUS_SPEED_MASK 0x0300
155#define HV_M_STATUS_SPEED_1000 0x0200
156#define HV_M_STATUS_LINK_UP 0x0040
157
144enum e1000_boards { 158enum e1000_boards {
145 board_82571, 159 board_82571,
146 board_82572, 160 board_82572,
@@ -519,9 +533,13 @@ extern s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw);
519extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw); 533extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw);
520extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw); 534extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw);
521extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data); 535extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
536extern s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset,
537 u16 *data);
522extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw); 538extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw);
523extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active); 539extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active);
524extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data); 540extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
541extern s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset,
542 u16 data);
525extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw); 543extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw);
526extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw); 544extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw);
527extern s32 e1000e_get_cfg_done(struct e1000_hw *hw); 545extern s32 e1000e_get_cfg_done(struct e1000_hw *hw);
@@ -538,7 +556,11 @@ extern s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data);
538extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); 556extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data);
539extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); 557extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
540extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); 558extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
559extern s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset,
560 u16 data);
541extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); 561extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
562extern s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset,
563 u16 *data);
542extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, 564extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
543 u32 usec_interval, bool *success); 565 u32 usec_interval, bool *success);
544extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw); 566extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
@@ -546,7 +568,11 @@ extern s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
546extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); 568extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
547extern s32 e1000e_check_downshift(struct e1000_hw *hw); 569extern s32 e1000e_check_downshift(struct e1000_hw *hw);
548extern s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data); 570extern s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data);
571extern s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset,
572 u16 *data);
549extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); 573extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data);
574extern s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset,
575 u16 data);
550extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow); 576extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow);
551extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); 577extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw);
552extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); 578extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw);
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index fd44d9f90769..aaea41ef794d 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -764,11 +764,13 @@ struct e1000_phy_operations {
764 s32 (*get_cable_length)(struct e1000_hw *); 764 s32 (*get_cable_length)(struct e1000_hw *);
765 s32 (*get_phy_info)(struct e1000_hw *); 765 s32 (*get_phy_info)(struct e1000_hw *);
766 s32 (*read_phy_reg)(struct e1000_hw *, u32, u16 *); 766 s32 (*read_phy_reg)(struct e1000_hw *, u32, u16 *);
767 s32 (*read_phy_reg_locked)(struct e1000_hw *, u32, u16 *);
767 void (*release_phy)(struct e1000_hw *); 768 void (*release_phy)(struct e1000_hw *);
768 s32 (*reset_phy)(struct e1000_hw *); 769 s32 (*reset_phy)(struct e1000_hw *);
769 s32 (*set_d0_lplu_state)(struct e1000_hw *, bool); 770 s32 (*set_d0_lplu_state)(struct e1000_hw *, bool);
770 s32 (*set_d3_lplu_state)(struct e1000_hw *, bool); 771 s32 (*set_d3_lplu_state)(struct e1000_hw *, bool);
771 s32 (*write_phy_reg)(struct e1000_hw *, u32, u16); 772 s32 (*write_phy_reg)(struct e1000_hw *, u32, u16);
773 s32 (*write_phy_reg_locked)(struct e1000_hw *, u32, u16);
772 s32 (*cfg_on_link_up)(struct e1000_hw *); 774 s32 (*cfg_on_link_up)(struct e1000_hw *);
773}; 775};
774 776
@@ -901,6 +903,7 @@ struct e1000_shadow_ram {
901struct e1000_dev_spec_ich8lan { 903struct e1000_dev_spec_ich8lan {
902 bool kmrn_lock_loss_workaround_enabled; 904 bool kmrn_lock_loss_workaround_enabled;
903 struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS]; 905 struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS];
906 bool nvm_k1_enabled;
904}; 907};
905 908
906struct e1000_hw { 909struct e1000_hw {
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 99df2abf82a9..51ddb04ab195 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -122,6 +122,27 @@
122 122
123#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ 123#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */
124 124
125#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */
126
127/* SMBus Address Phy Register */
128#define HV_SMB_ADDR PHY_REG(768, 26)
129#define HV_SMB_ADDR_PEC_EN 0x0200
130#define HV_SMB_ADDR_VALID 0x0080
131
132/* Strapping Option Register - RO */
133#define E1000_STRAP 0x0000C
134#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
135#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
136
137/* OEM Bits Phy Register */
138#define HV_OEM_BITS PHY_REG(768, 25)
139#define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */
140#define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */
141#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
142
143#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
144#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */
145
125/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ 146/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
126/* Offset 04h HSFSTS */ 147/* Offset 04h HSFSTS */
127union ich8_hws_flash_status { 148union ich8_hws_flash_status {
@@ -200,6 +221,10 @@ static s32 e1000_setup_led_pchlan(struct e1000_hw *hw);
200static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw); 221static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw);
201static s32 e1000_led_on_pchlan(struct e1000_hw *hw); 222static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
202static s32 e1000_led_off_pchlan(struct e1000_hw *hw); 223static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
224static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
225static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
226static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
227static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
203 228
204static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) 229static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
205{ 230{
@@ -242,7 +267,11 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
242 267
243 phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; 268 phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan;
244 phy->ops.read_phy_reg = e1000_read_phy_reg_hv; 269 phy->ops.read_phy_reg = e1000_read_phy_reg_hv;
270 phy->ops.read_phy_reg_locked = e1000_read_phy_reg_hv_locked;
271 phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan;
272 phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan;
245 phy->ops.write_phy_reg = e1000_write_phy_reg_hv; 273 phy->ops.write_phy_reg = e1000_write_phy_reg_hv;
274 phy->ops.write_phy_reg_locked = e1000_write_phy_reg_hv_locked;
246 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 275 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
247 276
248 phy->id = e1000_phy_unknown; 277 phy->id = e1000_phy_unknown;
@@ -303,6 +332,8 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
303 case IGP03E1000_E_PHY_ID: 332 case IGP03E1000_E_PHY_ID:
304 phy->type = e1000_phy_igp_3; 333 phy->type = e1000_phy_igp_3;
305 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 334 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
335 phy->ops.read_phy_reg_locked = e1000e_read_phy_reg_igp_locked;
336 phy->ops.write_phy_reg_locked = e1000e_write_phy_reg_igp_locked;
306 break; 337 break;
307 case IFE_E_PHY_ID: 338 case IFE_E_PHY_ID:
308 case IFE_PLUS_E_PHY_ID: 339 case IFE_PLUS_E_PHY_ID:
@@ -469,14 +500,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
469 goto out; 500 goto out;
470 } 501 }
471 502
472 if (hw->mac.type == e1000_pchlan) {
473 ret_val = e1000e_write_kmrn_reg(hw,
474 E1000_KMRNCTRLSTA_K1_CONFIG,
475 E1000_KMRNCTRLSTA_K1_ENABLE);
476 if (ret_val)
477 goto out;
478 }
479
480 /* 503 /*
481 * First we want to see if the MII Status Register reports 504 * First we want to see if the MII Status Register reports
482 * link. If so, then we want to get the current speed/duplex 505 * link. If so, then we want to get the current speed/duplex
@@ -486,6 +509,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
486 if (ret_val) 509 if (ret_val)
487 goto out; 510 goto out;
488 511
512 if (hw->mac.type == e1000_pchlan) {
513 ret_val = e1000_k1_gig_workaround_hv(hw, link);
514 if (ret_val)
515 goto out;
516 }
517
489 if (!link) 518 if (!link)
490 goto out; /* No link detected */ 519 goto out; /* No link detected */
491 520
@@ -568,12 +597,39 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
568static DEFINE_MUTEX(nvm_mutex); 597static DEFINE_MUTEX(nvm_mutex);
569 598
570/** 599/**
600 * e1000_acquire_nvm_ich8lan - Acquire NVM mutex
601 * @hw: pointer to the HW structure
602 *
603 * Acquires the mutex for performing NVM operations.
604 **/
605static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw)
606{
607 mutex_lock(&nvm_mutex);
608
609 return 0;
610}
611
612/**
613 * e1000_release_nvm_ich8lan - Release NVM mutex
614 * @hw: pointer to the HW structure
615 *
616 * Releases the mutex used while performing NVM operations.
617 **/
618static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
619{
620 mutex_unlock(&nvm_mutex);
621
622 return;
623}
624
625static DEFINE_MUTEX(swflag_mutex);
626
627/**
571 * e1000_acquire_swflag_ich8lan - Acquire software control flag 628 * e1000_acquire_swflag_ich8lan - Acquire software control flag
572 * @hw: pointer to the HW structure 629 * @hw: pointer to the HW structure
573 * 630 *
574 * Acquires the software control flag for performing NVM and PHY 631 * Acquires the software control flag for performing PHY and select
575 * operations. This is a function pointer entry point only called by 632 * MAC CSR accesses.
576 * read/write routines for the PHY and NVM parts.
577 **/ 633 **/
578static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) 634static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
579{ 635{
@@ -582,7 +638,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
582 638
583 might_sleep(); 639 might_sleep();
584 640
585 mutex_lock(&nvm_mutex); 641 mutex_lock(&swflag_mutex);
586 642
587 while (timeout) { 643 while (timeout) {
588 extcnf_ctrl = er32(EXTCNF_CTRL); 644 extcnf_ctrl = er32(EXTCNF_CTRL);
@@ -599,7 +655,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
599 goto out; 655 goto out;
600 } 656 }
601 657
602 timeout = PHY_CFG_TIMEOUT * 2; 658 timeout = SW_FLAG_TIMEOUT;
603 659
604 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; 660 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
605 ew32(EXTCNF_CTRL, extcnf_ctrl); 661 ew32(EXTCNF_CTRL, extcnf_ctrl);
@@ -623,7 +679,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
623 679
624out: 680out:
625 if (ret_val) 681 if (ret_val)
626 mutex_unlock(&nvm_mutex); 682 mutex_unlock(&swflag_mutex);
627 683
628 return ret_val; 684 return ret_val;
629} 685}
@@ -632,9 +688,8 @@ out:
632 * e1000_release_swflag_ich8lan - Release software control flag 688 * e1000_release_swflag_ich8lan - Release software control flag
633 * @hw: pointer to the HW structure 689 * @hw: pointer to the HW structure
634 * 690 *
635 * Releases the software control flag for performing NVM and PHY operations. 691 * Releases the software control flag for performing PHY and select
636 * This is a function pointer entry point only called by read/write 692 * MAC CSR accesses.
637 * routines for the PHY and NVM parts.
638 **/ 693 **/
639static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) 694static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
640{ 695{
@@ -644,7 +699,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
644 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 699 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
645 ew32(EXTCNF_CTRL, extcnf_ctrl); 700 ew32(EXTCNF_CTRL, extcnf_ctrl);
646 701
647 mutex_unlock(&nvm_mutex); 702 mutex_unlock(&swflag_mutex);
703
704 return;
648} 705}
649 706
650/** 707/**
@@ -752,6 +809,326 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
752} 809}
753 810
754/** 811/**
812 * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration
813 * @hw: pointer to the HW structure
814 *
815 * SW should configure the LCD from the NVM extended configuration region
816 * as a workaround for certain parts.
817 **/
818static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
819{
820 struct e1000_phy_info *phy = &hw->phy;
821 u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask;
822 s32 ret_val;
823 u16 word_addr, reg_data, reg_addr, phy_page = 0;
824
825 ret_val = hw->phy.ops.acquire_phy(hw);
826 if (ret_val)
827 return ret_val;
828
829 /*
830 * Initialize the PHY from the NVM on ICH platforms. This
831 * is needed due to an issue where the NVM configuration is
832 * not properly autoloaded after power transitions.
833 * Therefore, after each PHY reset, we will load the
834 * configuration data out of the NVM manually.
835 */
836 if ((hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) ||
837 (hw->mac.type == e1000_pchlan)) {
838 struct e1000_adapter *adapter = hw->adapter;
839
840 /* Check if SW needs to configure the PHY */
841 if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) ||
842 (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) ||
843 (hw->mac.type == e1000_pchlan))
844 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
845 else
846 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
847
848 data = er32(FEXTNVM);
849 if (!(data & sw_cfg_mask))
850 goto out;
851
852 /* Wait for basic configuration completes before proceeding */
853 e1000_lan_init_done_ich8lan(hw);
854
855 /*
856 * Make sure HW does not configure LCD from PHY
857 * extended configuration before SW configuration
858 */
859 data = er32(EXTCNF_CTRL);
860 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
861 goto out;
862
863 cnf_size = er32(EXTCNF_SIZE);
864 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
865 cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT;
866 if (!cnf_size)
867 goto out;
868
869 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
870 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
871
872 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
873 (hw->mac.type == e1000_pchlan)) {
874 /*
875 * HW configures the SMBus address and LEDs when the
876 * OEM and LCD Write Enable bits are set in the NVM.
877 * When both NVM bits are cleared, SW will configure
878 * them instead.
879 */
880 data = er32(STRAP);
881 data &= E1000_STRAP_SMBUS_ADDRESS_MASK;
882 reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT;
883 reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
884 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR,
885 reg_data);
886 if (ret_val)
887 goto out;
888
889 data = er32(LEDCTL);
890 ret_val = e1000_write_phy_reg_hv_locked(hw,
891 HV_LED_CONFIG,
892 (u16)data);
893 if (ret_val)
894 goto out;
895 }
896 /* Configure LCD from extended configuration region. */
897
898 /* cnf_base_addr is in DWORD */
899 word_addr = (u16)(cnf_base_addr << 1);
900
901 for (i = 0; i < cnf_size; i++) {
902 ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1,
903 &reg_data);
904 if (ret_val)
905 goto out;
906
907 ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1),
908 1, &reg_addr);
909 if (ret_val)
910 goto out;
911
912 /* Save off the PHY page for future writes. */
913 if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) {
914 phy_page = reg_data;
915 continue;
916 }
917
918 reg_addr &= PHY_REG_MASK;
919 reg_addr |= phy_page;
920
921 ret_val = phy->ops.write_phy_reg_locked(hw,
922 (u32)reg_addr,
923 reg_data);
924 if (ret_val)
925 goto out;
926 }
927 }
928
929out:
930 hw->phy.ops.release_phy(hw);
931 return ret_val;
932}
933
934/**
935 * e1000_k1_gig_workaround_hv - K1 Si workaround
936 * @hw: pointer to the HW structure
937 * @link: link up bool flag
938 *
939 * If K1 is enabled for 1Gbps, the MAC might stall when transitioning
940 * from a lower speed. This workaround disables K1 whenever link is at 1Gig
941 * If link is down, the function will restore the default K1 setting located
942 * in the NVM.
943 **/
944static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
945{
946 s32 ret_val = 0;
947 u16 status_reg = 0;
948 bool k1_enable = hw->dev_spec.ich8lan.nvm_k1_enabled;
949
950 if (hw->mac.type != e1000_pchlan)
951 goto out;
952
953 /* Wrap the whole flow with the sw flag */
954 ret_val = hw->phy.ops.acquire_phy(hw);
955 if (ret_val)
956 goto out;
957
958 /* Disable K1 when link is 1Gbps, otherwise use the NVM setting */
959 if (link) {
960 if (hw->phy.type == e1000_phy_82578) {
961 ret_val = hw->phy.ops.read_phy_reg_locked(hw,
962 BM_CS_STATUS,
963 &status_reg);
964 if (ret_val)
965 goto release;
966
967 status_reg &= BM_CS_STATUS_LINK_UP |
968 BM_CS_STATUS_RESOLVED |
969 BM_CS_STATUS_SPEED_MASK;
970
971 if (status_reg == (BM_CS_STATUS_LINK_UP |
972 BM_CS_STATUS_RESOLVED |
973 BM_CS_STATUS_SPEED_1000))
974 k1_enable = false;
975 }
976
977 if (hw->phy.type == e1000_phy_82577) {
978 ret_val = hw->phy.ops.read_phy_reg_locked(hw,
979 HV_M_STATUS,
980 &status_reg);
981 if (ret_val)
982 goto release;
983
984 status_reg &= HV_M_STATUS_LINK_UP |
985 HV_M_STATUS_AUTONEG_COMPLETE |
986 HV_M_STATUS_SPEED_MASK;
987
988 if (status_reg == (HV_M_STATUS_LINK_UP |
989 HV_M_STATUS_AUTONEG_COMPLETE |
990 HV_M_STATUS_SPEED_1000))
991 k1_enable = false;
992 }
993
994 /* Link stall fix for link up */
995 ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19),
996 0x0100);
997 if (ret_val)
998 goto release;
999
1000 } else {
1001 /* Link stall fix for link down */
1002 ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19),
1003 0x4100);
1004 if (ret_val)
1005 goto release;
1006 }
1007
1008 ret_val = e1000_configure_k1_ich8lan(hw, k1_enable);
1009
1010release:
1011 hw->phy.ops.release_phy(hw);
1012out:
1013 return ret_val;
1014}
1015
1016/**
1017 * e1000_configure_k1_ich8lan - Configure K1 power state
1018 * @hw: pointer to the HW structure
1019 * @enable: K1 state to configure
1020 *
1021 * Configure the K1 power state based on the provided parameter.
1022 * Assumes semaphore already acquired.
1023 *
1024 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1025 **/
1026static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
1027{
1028 s32 ret_val = 0;
1029 u32 ctrl_reg = 0;
1030 u32 ctrl_ext = 0;
1031 u32 reg = 0;
1032 u16 kmrn_reg = 0;
1033
1034 ret_val = e1000e_read_kmrn_reg_locked(hw,
1035 E1000_KMRNCTRLSTA_K1_CONFIG,
1036 &kmrn_reg);
1037 if (ret_val)
1038 goto out;
1039
1040 if (k1_enable)
1041 kmrn_reg |= E1000_KMRNCTRLSTA_K1_ENABLE;
1042 else
1043 kmrn_reg &= ~E1000_KMRNCTRLSTA_K1_ENABLE;
1044
1045 ret_val = e1000e_write_kmrn_reg_locked(hw,
1046 E1000_KMRNCTRLSTA_K1_CONFIG,
1047 kmrn_reg);
1048 if (ret_val)
1049 goto out;
1050
1051 udelay(20);
1052 ctrl_ext = er32(CTRL_EXT);
1053 ctrl_reg = er32(CTRL);
1054
1055 reg = ctrl_reg & ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
1056 reg |= E1000_CTRL_FRCSPD;
1057 ew32(CTRL, reg);
1058
1059 ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS);
1060 udelay(20);
1061 ew32(CTRL, ctrl_reg);
1062 ew32(CTRL_EXT, ctrl_ext);
1063 udelay(20);
1064
1065out:
1066 return ret_val;
1067}
1068
1069/**
1070 * e1000_oem_bits_config_ich8lan - SW-based LCD Configuration
1071 * @hw: pointer to the HW structure
1072 * @d0_state: boolean if entering d0 or d3 device state
1073 *
1074 * SW will configure Gbe Disable and LPLU based on the NVM. The four bits are
1075 * collectively called OEM bits. The OEM Write Enable bit and SW Config bit
1076 * in NVM determines whether HW should configure LPLU and Gbe Disable.
1077 **/
1078static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1079{
1080 s32 ret_val = 0;
1081 u32 mac_reg;
1082 u16 oem_reg;
1083
1084 if (hw->mac.type != e1000_pchlan)
1085 return ret_val;
1086
1087 ret_val = hw->phy.ops.acquire_phy(hw);
1088 if (ret_val)
1089 return ret_val;
1090
1091 mac_reg = er32(EXTCNF_CTRL);
1092 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)
1093 goto out;
1094
1095 mac_reg = er32(FEXTNVM);
1096 if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M))
1097 goto out;
1098
1099 mac_reg = er32(PHY_CTRL);
1100
1101 ret_val = hw->phy.ops.read_phy_reg_locked(hw, HV_OEM_BITS, &oem_reg);
1102 if (ret_val)
1103 goto out;
1104
1105 oem_reg &= ~(HV_OEM_BITS_GBE_DIS | HV_OEM_BITS_LPLU);
1106
1107 if (d0_state) {
1108 if (mac_reg & E1000_PHY_CTRL_GBE_DISABLE)
1109 oem_reg |= HV_OEM_BITS_GBE_DIS;
1110
1111 if (mac_reg & E1000_PHY_CTRL_D0A_LPLU)
1112 oem_reg |= HV_OEM_BITS_LPLU;
1113 } else {
1114 if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE)
1115 oem_reg |= HV_OEM_BITS_GBE_DIS;
1116
1117 if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU)
1118 oem_reg |= HV_OEM_BITS_LPLU;
1119 }
1120 /* Restart auto-neg to activate the bits */
1121 oem_reg |= HV_OEM_BITS_RESTART_AN;
1122 ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg);
1123
1124out:
1125 hw->phy.ops.release_phy(hw);
1126
1127 return ret_val;
1128}
1129
1130
1131/**
755 * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be 1132 * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be
756 * done after every PHY reset. 1133 * done after every PHY reset.
757 **/ 1134 **/
@@ -791,10 +1168,20 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
791 ret_val = hw->phy.ops.acquire_phy(hw); 1168 ret_val = hw->phy.ops.acquire_phy(hw);
792 if (ret_val) 1169 if (ret_val)
793 return ret_val; 1170 return ret_val;
1171
794 hw->phy.addr = 1; 1172 hw->phy.addr = 1;
795 e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0); 1173 ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
1174 if (ret_val)
1175 goto out;
796 hw->phy.ops.release_phy(hw); 1176 hw->phy.ops.release_phy(hw);
797 1177
1178 /*
1179 * Configure the K1 Si workaround during phy reset assuming there is
1180 * link so that it disables K1 if link is in 1Gbps.
1181 */
1182 ret_val = e1000_k1_gig_workaround_hv(hw, true);
1183
1184out:
798 return ret_val; 1185 return ret_val;
799} 1186}
800 1187
@@ -840,11 +1227,8 @@ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
840 **/ 1227 **/
841static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) 1228static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
842{ 1229{
843 struct e1000_phy_info *phy = &hw->phy; 1230 s32 ret_val = 0;
844 u32 i; 1231 u16 reg;
845 u32 data, cnf_size, cnf_base_addr, sw_cfg_mask;
846 s32 ret_val;
847 u16 word_addr, reg_data, reg_addr, phy_page = 0;
848 1232
849 ret_val = e1000e_phy_hw_reset_generic(hw); 1233 ret_val = e1000e_phy_hw_reset_generic(hw);
850 if (ret_val) 1234 if (ret_val)
@@ -859,81 +1243,20 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
859 return ret_val; 1243 return ret_val;
860 } 1244 }
861 1245
862 /* 1246 /* Dummy read to clear the phy wakeup bit after lcd reset */
863 * Initialize the PHY from the NVM on ICH platforms. This 1247 if (hw->mac.type == e1000_pchlan)
864 * is needed due to an issue where the NVM configuration is 1248 e1e_rphy(hw, BM_WUC, &reg);
865 * not properly autoloaded after power transitions.
866 * Therefore, after each PHY reset, we will load the
867 * configuration data out of the NVM manually.
868 */
869 if (hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) {
870 struct e1000_adapter *adapter = hw->adapter;
871
872 /* Check if SW needs configure the PHY */
873 if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) ||
874 (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M))
875 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
876 else
877 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
878
879 data = er32(FEXTNVM);
880 if (!(data & sw_cfg_mask))
881 return 0;
882
883 /* Wait for basic configuration completes before proceeding */
884 e1000_lan_init_done_ich8lan(hw);
885
886 /*
887 * Make sure HW does not configure LCD from PHY
888 * extended configuration before SW configuration
889 */
890 data = er32(EXTCNF_CTRL);
891 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
892 return 0;
893
894 cnf_size = er32(EXTCNF_SIZE);
895 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
896 cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT;
897 if (!cnf_size)
898 return 0;
899
900 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
901 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
902
903 /* Configure LCD from extended configuration region. */
904
905 /* cnf_base_addr is in DWORD */
906 word_addr = (u16)(cnf_base_addr << 1);
907
908 for (i = 0; i < cnf_size; i++) {
909 ret_val = e1000_read_nvm(hw,
910 (word_addr + i * 2),
911 1,
912 &reg_data);
913 if (ret_val)
914 return ret_val;
915
916 ret_val = e1000_read_nvm(hw,
917 (word_addr + i * 2 + 1),
918 1,
919 &reg_addr);
920 if (ret_val)
921 return ret_val;
922
923 /* Save off the PHY page for future writes. */
924 if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) {
925 phy_page = reg_data;
926 continue;
927 }
928 1249
929 reg_addr |= phy_page; 1250 /* Configure the LCD with the extended configuration region in NVM */
1251 ret_val = e1000_sw_lcd_config_ich8lan(hw);
1252 if (ret_val)
1253 goto out;
930 1254
931 ret_val = e1e_wphy(hw, (u32)reg_addr, reg_data); 1255 /* Configure the LCD with the OEM bits in NVM */
932 if (ret_val) 1256 if (hw->mac.type == e1000_pchlan)
933 return ret_val; 1257 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
934 }
935 }
936 1258
1259out:
937 return 0; 1260 return 0;
938} 1261}
939 1262
@@ -1054,6 +1377,38 @@ static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw)
1054} 1377}
1055 1378
1056/** 1379/**
1380 * e1000_set_lplu_state_pchlan - Set Low Power Link Up state
1381 * @hw: pointer to the HW structure
1382 * @active: true to enable LPLU, false to disable
1383 *
1384 * Sets the LPLU state according to the active flag. For PCH, if OEM write
1385 * bit are disabled in the NVM, writing the LPLU bits in the MAC will not set
1386 * the phy speed. This function will manually set the LPLU bit and restart
1387 * auto-neg as hw would do. D3 and D0 LPLU will call the same function
1388 * since it configures the same bit.
1389 **/
1390static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active)
1391{
1392 s32 ret_val = 0;
1393 u16 oem_reg;
1394
1395 ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg);
1396 if (ret_val)
1397 goto out;
1398
1399 if (active)
1400 oem_reg |= HV_OEM_BITS_LPLU;
1401 else
1402 oem_reg &= ~HV_OEM_BITS_LPLU;
1403
1404 oem_reg |= HV_OEM_BITS_RESTART_AN;
1405 ret_val = e1e_wphy(hw, HV_OEM_BITS, oem_reg);
1406
1407out:
1408 return ret_val;
1409}
1410
1411/**
1057 * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state 1412 * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state
1058 * @hw: pointer to the HW structure 1413 * @hw: pointer to the HW structure
1059 * @active: TRUE to enable LPLU, FALSE to disable 1414 * @active: TRUE to enable LPLU, FALSE to disable
@@ -1314,12 +1669,11 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1314 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || 1669 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
1315 (words == 0)) { 1670 (words == 0)) {
1316 hw_dbg(hw, "nvm parameter(s) out of bounds\n"); 1671 hw_dbg(hw, "nvm parameter(s) out of bounds\n");
1317 return -E1000_ERR_NVM; 1672 ret_val = -E1000_ERR_NVM;
1673 goto out;
1318 } 1674 }
1319 1675
1320 ret_val = e1000_acquire_swflag_ich8lan(hw); 1676 nvm->ops.acquire_nvm(hw);
1321 if (ret_val)
1322 goto out;
1323 1677
1324 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1678 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1325 if (ret_val) { 1679 if (ret_val) {
@@ -1345,7 +1699,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1345 } 1699 }
1346 } 1700 }
1347 1701
1348 e1000_release_swflag_ich8lan(hw); 1702 nvm->ops.release_nvm(hw);
1349 1703
1350out: 1704out:
1351 if (ret_val) 1705 if (ret_val)
@@ -1603,11 +1957,15 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1603 return -E1000_ERR_NVM; 1957 return -E1000_ERR_NVM;
1604 } 1958 }
1605 1959
1960 nvm->ops.acquire_nvm(hw);
1961
1606 for (i = 0; i < words; i++) { 1962 for (i = 0; i < words; i++) {
1607 dev_spec->shadow_ram[offset+i].modified = 1; 1963 dev_spec->shadow_ram[offset+i].modified = 1;
1608 dev_spec->shadow_ram[offset+i].value = data[i]; 1964 dev_spec->shadow_ram[offset+i].value = data[i];
1609 } 1965 }
1610 1966
1967 nvm->ops.release_nvm(hw);
1968
1611 return 0; 1969 return 0;
1612} 1970}
1613 1971
@@ -1637,9 +1995,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1637 if (nvm->type != e1000_nvm_flash_sw) 1995 if (nvm->type != e1000_nvm_flash_sw)
1638 goto out; 1996 goto out;
1639 1997
1640 ret_val = e1000_acquire_swflag_ich8lan(hw); 1998 nvm->ops.acquire_nvm(hw);
1641 if (ret_val)
1642 goto out;
1643 1999
1644 /* 2000 /*
1645 * We're writing to the opposite bank so if we're on bank 1, 2001 * We're writing to the opposite bank so if we're on bank 1,
@@ -1657,7 +2013,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1657 old_bank_offset = 0; 2013 old_bank_offset = 0;
1658 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); 2014 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
1659 if (ret_val) { 2015 if (ret_val) {
1660 e1000_release_swflag_ich8lan(hw); 2016 nvm->ops.release_nvm(hw);
1661 goto out; 2017 goto out;
1662 } 2018 }
1663 } else { 2019 } else {
@@ -1665,7 +2021,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1665 new_bank_offset = 0; 2021 new_bank_offset = 0;
1666 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); 2022 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
1667 if (ret_val) { 2023 if (ret_val) {
1668 e1000_release_swflag_ich8lan(hw); 2024 nvm->ops.release_nvm(hw);
1669 goto out; 2025 goto out;
1670 } 2026 }
1671 } 2027 }
@@ -1723,7 +2079,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1723 if (ret_val) { 2079 if (ret_val) {
1724 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ 2080 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
1725 hw_dbg(hw, "Flash commit failed.\n"); 2081 hw_dbg(hw, "Flash commit failed.\n");
1726 e1000_release_swflag_ich8lan(hw); 2082 nvm->ops.release_nvm(hw);
1727 goto out; 2083 goto out;
1728 } 2084 }
1729 2085
@@ -1736,7 +2092,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1736 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; 2092 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
1737 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); 2093 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
1738 if (ret_val) { 2094 if (ret_val) {
1739 e1000_release_swflag_ich8lan(hw); 2095 nvm->ops.release_nvm(hw);
1740 goto out; 2096 goto out;
1741 } 2097 }
1742 data &= 0xBFFF; 2098 data &= 0xBFFF;
@@ -1744,7 +2100,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1744 act_offset * 2 + 1, 2100 act_offset * 2 + 1,
1745 (u8)(data >> 8)); 2101 (u8)(data >> 8));
1746 if (ret_val) { 2102 if (ret_val) {
1747 e1000_release_swflag_ich8lan(hw); 2103 nvm->ops.release_nvm(hw);
1748 goto out; 2104 goto out;
1749 } 2105 }
1750 2106
@@ -1757,7 +2113,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1757 act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; 2113 act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
1758 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); 2114 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
1759 if (ret_val) { 2115 if (ret_val) {
1760 e1000_release_swflag_ich8lan(hw); 2116 nvm->ops.release_nvm(hw);
1761 goto out; 2117 goto out;
1762 } 2118 }
1763 2119
@@ -1767,7 +2123,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1767 dev_spec->shadow_ram[i].value = 0xFFFF; 2123 dev_spec->shadow_ram[i].value = 0xFFFF;
1768 } 2124 }
1769 2125
1770 e1000_release_swflag_ich8lan(hw); 2126 nvm->ops.release_nvm(hw);
1771 2127
1772 /* 2128 /*
1773 * Reload the EEPROM, or else modifications will not appear 2129 * Reload the EEPROM, or else modifications will not appear
@@ -1831,14 +2187,12 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
1831 **/ 2187 **/
1832void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) 2188void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
1833{ 2189{
2190 struct e1000_nvm_info *nvm = &hw->nvm;
1834 union ich8_flash_protected_range pr0; 2191 union ich8_flash_protected_range pr0;
1835 union ich8_hws_flash_status hsfsts; 2192 union ich8_hws_flash_status hsfsts;
1836 u32 gfpreg; 2193 u32 gfpreg;
1837 s32 ret_val;
1838 2194
1839 ret_val = e1000_acquire_swflag_ich8lan(hw); 2195 nvm->ops.acquire_nvm(hw);
1840 if (ret_val)
1841 return;
1842 2196
1843 gfpreg = er32flash(ICH_FLASH_GFPREG); 2197 gfpreg = er32flash(ICH_FLASH_GFPREG);
1844 2198
@@ -1859,7 +2213,7 @@ void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
1859 hsfsts.hsf_status.flockdn = true; 2213 hsfsts.hsf_status.flockdn = true;
1860 ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); 2214 ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
1861 2215
1862 e1000_release_swflag_ich8lan(hw); 2216 nvm->ops.release_nvm(hw);
1863} 2217}
1864 2218
1865/** 2219/**
@@ -2229,6 +2583,8 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw)
2229 **/ 2583 **/
2230static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) 2584static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2231{ 2585{
2586 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2587 u16 reg;
2232 u32 ctrl, icr, kab; 2588 u32 ctrl, icr, kab;
2233 s32 ret_val; 2589 s32 ret_val;
2234 2590
@@ -2263,6 +2619,18 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2263 ew32(PBS, E1000_PBS_16K); 2619 ew32(PBS, E1000_PBS_16K);
2264 } 2620 }
2265 2621
2622 if (hw->mac.type == e1000_pchlan) {
2623 /* Save the NVM K1 bit setting*/
2624 ret_val = e1000_read_nvm(hw, E1000_NVM_K1_CONFIG, 1, &reg);
2625 if (ret_val)
2626 return ret_val;
2627
2628 if (reg & E1000_NVM_K1_ENABLE)
2629 dev_spec->nvm_k1_enabled = true;
2630 else
2631 dev_spec->nvm_k1_enabled = false;
2632 }
2633
2266 ctrl = er32(CTRL); 2634 ctrl = er32(CTRL);
2267 2635
2268 if (!e1000_check_reset_block(hw)) { 2636 if (!e1000_check_reset_block(hw)) {
@@ -2304,7 +2672,19 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2304 hw_dbg(hw, "Auto Read Done did not complete\n"); 2672 hw_dbg(hw, "Auto Read Done did not complete\n");
2305 } 2673 }
2306 } 2674 }
2675 /* Dummy read to clear the phy wakeup bit after lcd reset */
2676 if (hw->mac.type == e1000_pchlan)
2677 e1e_rphy(hw, BM_WUC, &reg);
2307 2678
2679 ret_val = e1000_sw_lcd_config_ich8lan(hw);
2680 if (ret_val)
2681 goto out;
2682
2683 if (hw->mac.type == e1000_pchlan) {
2684 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
2685 if (ret_val)
2686 goto out;
2687 }
2308 /* 2688 /*
2309 * For PCH, this write will make sure that any noise 2689 * For PCH, this write will make sure that any noise
2310 * will be detected as a CRC error and be dropped rather than show up 2690 * will be detected as a CRC error and be dropped rather than show up
@@ -2323,6 +2703,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2323 if (hw->mac.type == e1000_pchlan) 2703 if (hw->mac.type == e1000_pchlan)
2324 ret_val = e1000_hv_phy_workarounds_ich8lan(hw); 2704 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2325 2705
2706out:
2326 return ret_val; 2707 return ret_val;
2327} 2708}
2328 2709
@@ -2627,14 +3008,6 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed,
2627 if (ret_val) 3008 if (ret_val)
2628 return ret_val; 3009 return ret_val;
2629 3010
2630 if ((hw->mac.type == e1000_pchlan) && (*speed == SPEED_1000)) {
2631 ret_val = e1000e_write_kmrn_reg(hw,
2632 E1000_KMRNCTRLSTA_K1_CONFIG,
2633 E1000_KMRNCTRLSTA_K1_DISABLE);
2634 if (ret_val)
2635 return ret_val;
2636 }
2637
2638 if ((hw->mac.type == e1000_ich8lan) && 3011 if ((hw->mac.type == e1000_ich8lan) &&
2639 (hw->phy.type == e1000_phy_igp_3) && 3012 (hw->phy.type == e1000_phy_igp_3) &&
2640 (*speed == SPEED_1000)) { 3013 (*speed == SPEED_1000)) {
@@ -2843,9 +3216,8 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
2843 E1000_PHY_CTRL_GBE_DISABLE; 3216 E1000_PHY_CTRL_GBE_DISABLE;
2844 ew32(PHY_CTRL, phy_ctrl); 3217 ew32(PHY_CTRL, phy_ctrl);
2845 3218
2846 /* Workaround SWFLAG unexpectedly set during S0->Sx */
2847 if (hw->mac.type == e1000_pchlan) 3219 if (hw->mac.type == e1000_pchlan)
2848 udelay(500); 3220 e1000_phy_hw_reset_ich8lan(hw);
2849 default: 3221 default:
2850 break; 3222 break;
2851 } 3223 }
@@ -3113,9 +3485,9 @@ static struct e1000_phy_operations ich8_phy_ops = {
3113}; 3485};
3114 3486
3115static struct e1000_nvm_operations ich8_nvm_ops = { 3487static struct e1000_nvm_operations ich8_nvm_ops = {
3116 .acquire_nvm = e1000_acquire_swflag_ich8lan, 3488 .acquire_nvm = e1000_acquire_nvm_ich8lan,
3117 .read_nvm = e1000_read_nvm_ich8lan, 3489 .read_nvm = e1000_read_nvm_ich8lan,
3118 .release_nvm = e1000_release_swflag_ich8lan, 3490 .release_nvm = e1000_release_nvm_ich8lan,
3119 .update_nvm = e1000_update_nvm_checksum_ich8lan, 3491 .update_nvm = e1000_update_nvm_checksum_ich8lan,
3120 .valid_led_default = e1000_valid_led_default_ich8lan, 3492 .valid_led_default = e1000_valid_led_default_ich8lan,
3121 .validate_nvm = e1000_validate_nvm_checksum_ich8lan, 3493 .validate_nvm = e1000_validate_nvm_checksum_ich8lan,
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 994401fd0664..03175b3a2c9e 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -95,13 +95,6 @@ static const u16 e1000_igp_2_cable_length_table[] =
95/* BM PHY Copper Specific Control 1 */ 95/* BM PHY Copper Specific Control 1 */
96#define BM_CS_CTRL1 16 96#define BM_CS_CTRL1 16
97 97
98/* BM PHY Copper Specific Status */
99#define BM_CS_STATUS 17
100#define BM_CS_STATUS_LINK_UP 0x0400
101#define BM_CS_STATUS_RESOLVED 0x0800
102#define BM_CS_STATUS_SPEED_MASK 0xC000
103#define BM_CS_STATUS_SPEED_1000 0x8000
104
105#define HV_MUX_DATA_CTRL PHY_REG(776, 16) 98#define HV_MUX_DATA_CTRL PHY_REG(776, 16)
106#define HV_MUX_DATA_CTRL_GEN_TO_MAC 0x0400 99#define HV_MUX_DATA_CTRL_GEN_TO_MAC 0x0400
107#define HV_MUX_DATA_CTRL_FORCE_SPEED 0x0004 100#define HV_MUX_DATA_CTRL_FORCE_SPEED 0x0004
@@ -164,16 +157,25 @@ s32 e1000e_get_phy_id(struct e1000_hw *hw)
164 * MDIC mode. No harm in trying again in this case since 157 * MDIC mode. No harm in trying again in this case since
165 * the PHY ID is unknown at this point anyway 158 * the PHY ID is unknown at this point anyway
166 */ 159 */
160 ret_val = phy->ops.acquire_phy(hw);
161 if (ret_val)
162 goto out;
167 ret_val = e1000_set_mdio_slow_mode_hv(hw, true); 163 ret_val = e1000_set_mdio_slow_mode_hv(hw, true);
168 if (ret_val) 164 if (ret_val)
169 goto out; 165 goto out;
166 phy->ops.release_phy(hw);
170 167
171 retry_count++; 168 retry_count++;
172 } 169 }
173out: 170out:
174 /* Revert to MDIO fast mode, if applicable */ 171 /* Revert to MDIO fast mode, if applicable */
175 if (retry_count) 172 if (retry_count) {
173 ret_val = phy->ops.acquire_phy(hw);
174 if (ret_val)
175 return ret_val;
176 ret_val = e1000_set_mdio_slow_mode_hv(hw, false); 176 ret_val = e1000_set_mdio_slow_mode_hv(hw, false);
177 phy->ops.release_phy(hw);
178 }
177 179
178 return ret_val; 180 return ret_val;
179} 181}
@@ -354,94 +356,173 @@ s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
354} 356}
355 357
356/** 358/**
357 * e1000e_read_phy_reg_igp - Read igp PHY register 359 * __e1000e_read_phy_reg_igp - Read igp PHY register
358 * @hw: pointer to the HW structure 360 * @hw: pointer to the HW structure
359 * @offset: register offset to be read 361 * @offset: register offset to be read
360 * @data: pointer to the read data 362 * @data: pointer to the read data
363 * @locked: semaphore has already been acquired or not
361 * 364 *
362 * Acquires semaphore, if necessary, then reads the PHY register at offset 365 * Acquires semaphore, if necessary, then reads the PHY register at offset
363 * and storing the retrieved information in data. Release any acquired 366 * and stores the retrieved information in data. Release any acquired
364 * semaphores before exiting. 367 * semaphores before exiting.
365 **/ 368 **/
366s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) 369static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data,
370 bool locked)
367{ 371{
368 s32 ret_val; 372 s32 ret_val = 0;
369 373
370 ret_val = hw->phy.ops.acquire_phy(hw); 374 if (!locked) {
371 if (ret_val) 375 if (!(hw->phy.ops.acquire_phy))
372 return ret_val; 376 goto out;
377
378 ret_val = hw->phy.ops.acquire_phy(hw);
379 if (ret_val)
380 goto out;
381 }
373 382
374 if (offset > MAX_PHY_MULTI_PAGE_REG) { 383 if (offset > MAX_PHY_MULTI_PAGE_REG) {
375 ret_val = e1000e_write_phy_reg_mdic(hw, 384 ret_val = e1000e_write_phy_reg_mdic(hw,
376 IGP01E1000_PHY_PAGE_SELECT, 385 IGP01E1000_PHY_PAGE_SELECT,
377 (u16)offset); 386 (u16)offset);
378 if (ret_val) { 387 if (ret_val)
379 hw->phy.ops.release_phy(hw); 388 goto release;
380 return ret_val;
381 }
382 } 389 }
383 390
384 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 391 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
385 data); 392 data);
386
387 hw->phy.ops.release_phy(hw);
388 393
394release:
395 if (!locked)
396 hw->phy.ops.release_phy(hw);
397out:
389 return ret_val; 398 return ret_val;
390} 399}
391 400
392/** 401/**
402 * e1000e_read_phy_reg_igp - Read igp PHY register
403 * @hw: pointer to the HW structure
404 * @offset: register offset to be read
405 * @data: pointer to the read data
406 *
407 * Acquires semaphore then reads the PHY register at offset and stores the
408 * retrieved information in data.
409 * Release the acquired semaphore before exiting.
410 **/
411s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
412{
413 return __e1000e_read_phy_reg_igp(hw, offset, data, false);
414}
415
416/**
417 * e1000e_read_phy_reg_igp_locked - Read igp PHY register
418 * @hw: pointer to the HW structure
419 * @offset: register offset to be read
420 * @data: pointer to the read data
421 *
422 * Reads the PHY register at offset and stores the retrieved information
423 * in data. Assumes semaphore already acquired.
424 **/
425s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data)
426{
427 return __e1000e_read_phy_reg_igp(hw, offset, data, true);
428}
429
430/**
393 * e1000e_write_phy_reg_igp - Write igp PHY register 431 * e1000e_write_phy_reg_igp - Write igp PHY register
394 * @hw: pointer to the HW structure 432 * @hw: pointer to the HW structure
395 * @offset: register offset to write to 433 * @offset: register offset to write to
396 * @data: data to write at register offset 434 * @data: data to write at register offset
435 * @locked: semaphore has already been acquired or not
397 * 436 *
398 * Acquires semaphore, if necessary, then writes the data to PHY register 437 * Acquires semaphore, if necessary, then writes the data to PHY register
399 * at the offset. Release any acquired semaphores before exiting. 438 * at the offset. Release any acquired semaphores before exiting.
400 **/ 439 **/
401s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) 440static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data,
441 bool locked)
402{ 442{
403 s32 ret_val; 443 s32 ret_val = 0;
404 444
405 ret_val = hw->phy.ops.acquire_phy(hw); 445 if (!locked) {
406 if (ret_val) 446 if (!(hw->phy.ops.acquire_phy))
407 return ret_val; 447 goto out;
448
449 ret_val = hw->phy.ops.acquire_phy(hw);
450 if (ret_val)
451 goto out;
452 }
408 453
409 if (offset > MAX_PHY_MULTI_PAGE_REG) { 454 if (offset > MAX_PHY_MULTI_PAGE_REG) {
410 ret_val = e1000e_write_phy_reg_mdic(hw, 455 ret_val = e1000e_write_phy_reg_mdic(hw,
411 IGP01E1000_PHY_PAGE_SELECT, 456 IGP01E1000_PHY_PAGE_SELECT,
412 (u16)offset); 457 (u16)offset);
413 if (ret_val) { 458 if (ret_val)
414 hw->phy.ops.release_phy(hw); 459 goto release;
415 return ret_val;
416 }
417 } 460 }
418 461
419 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 462 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
420 data); 463 data);
421 464
422 hw->phy.ops.release_phy(hw); 465release:
466 if (!locked)
467 hw->phy.ops.release_phy(hw);
423 468
469out:
424 return ret_val; 470 return ret_val;
425} 471}
426 472
427/** 473/**
428 * e1000e_read_kmrn_reg - Read kumeran register 474 * e1000e_write_phy_reg_igp - Write igp PHY register
475 * @hw: pointer to the HW structure
476 * @offset: register offset to write to
477 * @data: data to write at register offset
478 *
479 * Acquires semaphore then writes the data to PHY register
480 * at the offset. Release any acquired semaphores before exiting.
481 **/
482s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
483{
484 return __e1000e_write_phy_reg_igp(hw, offset, data, false);
485}
486
487/**
488 * e1000e_write_phy_reg_igp_locked - Write igp PHY register
489 * @hw: pointer to the HW structure
490 * @offset: register offset to write to
491 * @data: data to write at register offset
492 *
493 * Writes the data to PHY register at the offset.
494 * Assumes semaphore already acquired.
495 **/
496s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data)
497{
498 return __e1000e_write_phy_reg_igp(hw, offset, data, true);
499}
500
501/**
502 * __e1000_read_kmrn_reg - Read kumeran register
429 * @hw: pointer to the HW structure 503 * @hw: pointer to the HW structure
430 * @offset: register offset to be read 504 * @offset: register offset to be read
431 * @data: pointer to the read data 505 * @data: pointer to the read data
506 * @locked: semaphore has already been acquired or not
432 * 507 *
433 * Acquires semaphore, if necessary. Then reads the PHY register at offset 508 * Acquires semaphore, if necessary. Then reads the PHY register at offset
434 * using the kumeran interface. The information retrieved is stored in data. 509 * using the kumeran interface. The information retrieved is stored in data.
435 * Release any acquired semaphores before exiting. 510 * Release any acquired semaphores before exiting.
436 **/ 511 **/
437s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) 512static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data,
513 bool locked)
438{ 514{
439 u32 kmrnctrlsta; 515 u32 kmrnctrlsta;
440 s32 ret_val; 516 s32 ret_val = 0;
441 517
442 ret_val = hw->phy.ops.acquire_phy(hw); 518 if (!locked) {
443 if (ret_val) 519 if (!(hw->phy.ops.acquire_phy))
444 return ret_val; 520 goto out;
521
522 ret_val = hw->phy.ops.acquire_phy(hw);
523 if (ret_val)
524 goto out;
525 }
445 526
446 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 527 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
447 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; 528 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
@@ -452,41 +533,111 @@ s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
452 kmrnctrlsta = er32(KMRNCTRLSTA); 533 kmrnctrlsta = er32(KMRNCTRLSTA);
453 *data = (u16)kmrnctrlsta; 534 *data = (u16)kmrnctrlsta;
454 535
455 hw->phy.ops.release_phy(hw); 536 if (!locked)
537 hw->phy.ops.release_phy(hw);
456 538
539out:
457 return ret_val; 540 return ret_val;
458} 541}
459 542
460/** 543/**
461 * e1000e_write_kmrn_reg - Write kumeran register 544 * e1000e_read_kmrn_reg - Read kumeran register
545 * @hw: pointer to the HW structure
546 * @offset: register offset to be read
547 * @data: pointer to the read data
548 *
549 * Acquires semaphore then reads the PHY register at offset using the
550 * kumeran interface. The information retrieved is stored in data.
551 * Release the acquired semaphore before exiting.
552 **/
553s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
554{
555 return __e1000_read_kmrn_reg(hw, offset, data, false);
556}
557
558/**
559 * e1000e_read_kmrn_reg_locked - Read kumeran register
560 * @hw: pointer to the HW structure
561 * @offset: register offset to be read
562 * @data: pointer to the read data
563 *
564 * Reads the PHY register at offset using the kumeran interface. The
565 * information retrieved is stored in data.
566 * Assumes semaphore already acquired.
567 **/
568s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data)
569{
570 return __e1000_read_kmrn_reg(hw, offset, data, true);
571}
572
573/**
574 * __e1000_write_kmrn_reg - Write kumeran register
462 * @hw: pointer to the HW structure 575 * @hw: pointer to the HW structure
463 * @offset: register offset to write to 576 * @offset: register offset to write to
464 * @data: data to write at register offset 577 * @data: data to write at register offset
578 * @locked: semaphore has already been acquired or not
465 * 579 *
466 * Acquires semaphore, if necessary. Then write the data to PHY register 580 * Acquires semaphore, if necessary. Then write the data to PHY register
467 * at the offset using the kumeran interface. Release any acquired semaphores 581 * at the offset using the kumeran interface. Release any acquired semaphores
468 * before exiting. 582 * before exiting.
469 **/ 583 **/
470s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) 584static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data,
585 bool locked)
471{ 586{
472 u32 kmrnctrlsta; 587 u32 kmrnctrlsta;
473 s32 ret_val; 588 s32 ret_val = 0;
474 589
475 ret_val = hw->phy.ops.acquire_phy(hw); 590 if (!locked) {
476 if (ret_val) 591 if (!(hw->phy.ops.acquire_phy))
477 return ret_val; 592 goto out;
593
594 ret_val = hw->phy.ops.acquire_phy(hw);
595 if (ret_val)
596 goto out;
597 }
478 598
479 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 599 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
480 E1000_KMRNCTRLSTA_OFFSET) | data; 600 E1000_KMRNCTRLSTA_OFFSET) | data;
481 ew32(KMRNCTRLSTA, kmrnctrlsta); 601 ew32(KMRNCTRLSTA, kmrnctrlsta);
482 602
483 udelay(2); 603 udelay(2);
484 hw->phy.ops.release_phy(hw);
485 604
605 if (!locked)
606 hw->phy.ops.release_phy(hw);
607
608out:
486 return ret_val; 609 return ret_val;
487} 610}
488 611
489/** 612/**
613 * e1000e_write_kmrn_reg - Write kumeran register
614 * @hw: pointer to the HW structure
615 * @offset: register offset to write to
616 * @data: data to write at register offset
617 *
618 * Acquires semaphore then writes the data to the PHY register at the offset
619 * using the kumeran interface. Release the acquired semaphore before exiting.
620 **/
621s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
622{
623 return __e1000_write_kmrn_reg(hw, offset, data, false);
624}
625
626/**
627 * e1000e_write_kmrn_reg_locked - Write kumeran register
628 * @hw: pointer to the HW structure
629 * @offset: register offset to write to
630 * @data: data to write at register offset
631 *
632 * Write the data to PHY register at the offset using the kumeran interface.
633 * Assumes semaphore already acquired.
634 **/
635s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data)
636{
637 return __e1000_write_kmrn_reg(hw, offset, data, true);
638}
639
640/**
490 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link 641 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
491 * @hw: pointer to the HW structure 642 * @hw: pointer to the HW structure
492 * 643 *
@@ -2105,6 +2256,10 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2105 u32 page = offset >> IGP_PAGE_SHIFT; 2256 u32 page = offset >> IGP_PAGE_SHIFT;
2106 u32 page_shift = 0; 2257 u32 page_shift = 0;
2107 2258
2259 ret_val = hw->phy.ops.acquire_phy(hw);
2260 if (ret_val)
2261 return ret_val;
2262
2108 /* Page 800 works differently than the rest so it has its own func */ 2263 /* Page 800 works differently than the rest so it has its own func */
2109 if (page == BM_WUC_PAGE) { 2264 if (page == BM_WUC_PAGE) {
2110 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, 2265 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data,
@@ -2112,10 +2267,6 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2112 goto out; 2267 goto out;
2113 } 2268 }
2114 2269
2115 ret_val = hw->phy.ops.acquire_phy(hw);
2116 if (ret_val)
2117 goto out;
2118
2119 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); 2270 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
2120 2271
2121 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2272 if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -2135,18 +2286,15 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2135 /* Page is shifted left, PHY expects (page x 32) */ 2286 /* Page is shifted left, PHY expects (page x 32) */
2136 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, 2287 ret_val = e1000e_write_phy_reg_mdic(hw, page_select,
2137 (page << page_shift)); 2288 (page << page_shift));
2138 if (ret_val) { 2289 if (ret_val)
2139 hw->phy.ops.release_phy(hw);
2140 goto out; 2290 goto out;
2141 }
2142 } 2291 }
2143 2292
2144 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 2293 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
2145 data); 2294 data);
2146 2295
2147 hw->phy.ops.release_phy(hw);
2148
2149out: 2296out:
2297 hw->phy.ops.release_phy(hw);
2150 return ret_val; 2298 return ret_val;
2151} 2299}
2152 2300
@@ -2167,6 +2315,10 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2167 u32 page = offset >> IGP_PAGE_SHIFT; 2315 u32 page = offset >> IGP_PAGE_SHIFT;
2168 u32 page_shift = 0; 2316 u32 page_shift = 0;
2169 2317
2318 ret_val = hw->phy.ops.acquire_phy(hw);
2319 if (ret_val)
2320 return ret_val;
2321
2170 /* Page 800 works differently than the rest so it has its own func */ 2322 /* Page 800 works differently than the rest so it has its own func */
2171 if (page == BM_WUC_PAGE) { 2323 if (page == BM_WUC_PAGE) {
2172 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, 2324 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data,
@@ -2174,10 +2326,6 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2174 goto out; 2326 goto out;
2175 } 2327 }
2176 2328
2177 ret_val = hw->phy.ops.acquire_phy(hw);
2178 if (ret_val)
2179 goto out;
2180
2181 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); 2329 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
2182 2330
2183 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2331 if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -2197,17 +2345,14 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2197 /* Page is shifted left, PHY expects (page x 32) */ 2345 /* Page is shifted left, PHY expects (page x 32) */
2198 ret_val = e1000e_write_phy_reg_mdic(hw, page_select, 2346 ret_val = e1000e_write_phy_reg_mdic(hw, page_select,
2199 (page << page_shift)); 2347 (page << page_shift));
2200 if (ret_val) { 2348 if (ret_val)
2201 hw->phy.ops.release_phy(hw);
2202 goto out; 2349 goto out;
2203 }
2204 } 2350 }
2205 2351
2206 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 2352 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
2207 data); 2353 data);
2208 hw->phy.ops.release_phy(hw);
2209
2210out: 2354out:
2355 hw->phy.ops.release_phy(hw);
2211 return ret_val; 2356 return ret_val;
2212} 2357}
2213 2358
@@ -2226,17 +2371,17 @@ s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data)
2226 s32 ret_val; 2371 s32 ret_val;
2227 u16 page = (u16)(offset >> IGP_PAGE_SHIFT); 2372 u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
2228 2373
2374 ret_val = hw->phy.ops.acquire_phy(hw);
2375 if (ret_val)
2376 return ret_val;
2377
2229 /* Page 800 works differently than the rest so it has its own func */ 2378 /* Page 800 works differently than the rest so it has its own func */
2230 if (page == BM_WUC_PAGE) { 2379 if (page == BM_WUC_PAGE) {
2231 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, 2380 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data,
2232 true); 2381 true);
2233 return ret_val; 2382 goto out;
2234 } 2383 }
2235 2384
2236 ret_val = hw->phy.ops.acquire_phy(hw);
2237 if (ret_val)
2238 return ret_val;
2239
2240 hw->phy.addr = 1; 2385 hw->phy.addr = 1;
2241 2386
2242 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2387 if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -2245,16 +2390,14 @@ s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data)
2245 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, 2390 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
2246 page); 2391 page);
2247 2392
2248 if (ret_val) { 2393 if (ret_val)
2249 hw->phy.ops.release_phy(hw); 2394 goto out;
2250 return ret_val;
2251 }
2252 } 2395 }
2253 2396
2254 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 2397 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
2255 data); 2398 data);
2399out:
2256 hw->phy.ops.release_phy(hw); 2400 hw->phy.ops.release_phy(hw);
2257
2258 return ret_val; 2401 return ret_val;
2259} 2402}
2260 2403
@@ -2272,17 +2415,17 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
2272 s32 ret_val; 2415 s32 ret_val;
2273 u16 page = (u16)(offset >> IGP_PAGE_SHIFT); 2416 u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
2274 2417
2418 ret_val = hw->phy.ops.acquire_phy(hw);
2419 if (ret_val)
2420 return ret_val;
2421
2275 /* Page 800 works differently than the rest so it has its own func */ 2422 /* Page 800 works differently than the rest so it has its own func */
2276 if (page == BM_WUC_PAGE) { 2423 if (page == BM_WUC_PAGE) {
2277 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, 2424 ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data,
2278 false); 2425 false);
2279 return ret_val; 2426 goto out;
2280 } 2427 }
2281 2428
2282 ret_val = hw->phy.ops.acquire_phy(hw);
2283 if (ret_val)
2284 return ret_val;
2285
2286 hw->phy.addr = 1; 2429 hw->phy.addr = 1;
2287 2430
2288 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2431 if (offset > MAX_PHY_MULTI_PAGE_REG) {
@@ -2290,17 +2433,15 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
2290 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, 2433 ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
2291 page); 2434 page);
2292 2435
2293 if (ret_val) { 2436 if (ret_val)
2294 hw->phy.ops.release_phy(hw); 2437 goto out;
2295 return ret_val;
2296 }
2297 } 2438 }
2298 2439
2299 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 2440 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
2300 data); 2441 data);
2301 2442
2443out:
2302 hw->phy.ops.release_phy(hw); 2444 hw->phy.ops.release_phy(hw);
2303
2304 return ret_val; 2445 return ret_val;
2305} 2446}
2306 2447
@@ -2320,6 +2461,8 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
2320 * 3) Write the address using the address opcode (0x11) 2461 * 3) Write the address using the address opcode (0x11)
2321 * 4) Read or write the data using the data opcode (0x12) 2462 * 4) Read or write the data using the data opcode (0x12)
2322 * 5) Restore 769_17.2 to its original value 2463 * 5) Restore 769_17.2 to its original value
2464 *
2465 * Assumes semaphore already acquired.
2323 **/ 2466 **/
2324static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, 2467static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
2325 u16 *data, bool read) 2468 u16 *data, bool read)
@@ -2327,20 +2470,12 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
2327 s32 ret_val; 2470 s32 ret_val;
2328 u16 reg = BM_PHY_REG_NUM(offset); 2471 u16 reg = BM_PHY_REG_NUM(offset);
2329 u16 phy_reg = 0; 2472 u16 phy_reg = 0;
2330 u8 phy_acquired = 1;
2331
2332 2473
2333 /* Gig must be disabled for MDIO accesses to page 800 */ 2474 /* Gig must be disabled for MDIO accesses to page 800 */
2334 if ((hw->mac.type == e1000_pchlan) && 2475 if ((hw->mac.type == e1000_pchlan) &&
2335 (!(er32(PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE))) 2476 (!(er32(PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE)))
2336 hw_dbg(hw, "Attempting to access page 800 while gig enabled\n"); 2477 hw_dbg(hw, "Attempting to access page 800 while gig enabled\n");
2337 2478
2338 ret_val = hw->phy.ops.acquire_phy(hw);
2339 if (ret_val) {
2340 phy_acquired = 0;
2341 goto out;
2342 }
2343
2344 /* All operations in this function are phy address 1 */ 2479 /* All operations in this function are phy address 1 */
2345 hw->phy.addr = 1; 2480 hw->phy.addr = 1;
2346 2481
@@ -2397,8 +2532,6 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
2397 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); 2532 ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg);
2398 2533
2399out: 2534out:
2400 if (phy_acquired == 1)
2401 hw->phy.ops.release_phy(hw);
2402 return ret_val; 2535 return ret_val;
2403} 2536}
2404 2537
@@ -2439,52 +2572,63 @@ static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
2439 return 0; 2572 return 0;
2440} 2573}
2441 2574
2575/**
2576 * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode
2577 * @hw: pointer to the HW structure
2578 * @slow: true for slow mode, false for normal mode
2579 *
2580 * Assumes semaphore already acquired.
2581 **/
2442s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow) 2582s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow)
2443{ 2583{
2444 s32 ret_val = 0; 2584 s32 ret_val = 0;
2445 u16 data = 0; 2585 u16 data = 0;
2446 2586
2447 ret_val = hw->phy.ops.acquire_phy(hw);
2448 if (ret_val)
2449 return ret_val;
2450
2451 /* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */ 2587 /* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */
2452 hw->phy.addr = 1; 2588 hw->phy.addr = 1;
2453 ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 2589 ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT,
2454 (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); 2590 (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT));
2455 if (ret_val) { 2591 if (ret_val)
2456 hw->phy.ops.release_phy(hw); 2592 goto out;
2457 return ret_val; 2593
2458 }
2459 ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1, 2594 ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1,
2460 (0x2180 | (slow << 10))); 2595 (0x2180 | (slow << 10)));
2596 if (ret_val)
2597 goto out;
2461 2598
2462 /* dummy read when reverting to fast mode - throw away result */ 2599 /* dummy read when reverting to fast mode - throw away result */
2463 if (!slow) 2600 if (!slow)
2464 e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data); 2601 ret_val = e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data);
2465
2466 hw->phy.ops.release_phy(hw);
2467 2602
2603out:
2468 return ret_val; 2604 return ret_val;
2469} 2605}
2470 2606
2471/** 2607/**
2472 * e1000_read_phy_reg_hv - Read HV PHY register 2608 * __e1000_read_phy_reg_hv - Read HV PHY register
2473 * @hw: pointer to the HW structure 2609 * @hw: pointer to the HW structure
2474 * @offset: register offset to be read 2610 * @offset: register offset to be read
2475 * @data: pointer to the read data 2611 * @data: pointer to the read data
2612 * @locked: semaphore has already been acquired or not
2476 * 2613 *
2477 * Acquires semaphore, if necessary, then reads the PHY register at offset 2614 * Acquires semaphore, if necessary, then reads the PHY register at offset
2478 * and storing the retrieved information in data. Release any acquired 2615 * and stores the retrieved information in data. Release any acquired
2479 * semaphore before exiting. 2616 * semaphore before exiting.
2480 **/ 2617 **/
2481s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) 2618static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
2619 bool locked)
2482{ 2620{
2483 s32 ret_val; 2621 s32 ret_val;
2484 u16 page = BM_PHY_REG_PAGE(offset); 2622 u16 page = BM_PHY_REG_PAGE(offset);
2485 u16 reg = BM_PHY_REG_NUM(offset); 2623 u16 reg = BM_PHY_REG_NUM(offset);
2486 bool in_slow_mode = false; 2624 bool in_slow_mode = false;
2487 2625
2626 if (!locked) {
2627 ret_val = hw->phy.ops.acquire_phy(hw);
2628 if (ret_val)
2629 return ret_val;
2630 }
2631
2488 /* Workaround failure in MDIO access while cable is disconnected */ 2632 /* Workaround failure in MDIO access while cable is disconnected */
2489 if ((hw->phy.type == e1000_phy_82577) && 2633 if ((hw->phy.type == e1000_phy_82577) &&
2490 !(er32(STATUS) & E1000_STATUS_LU)) { 2634 !(er32(STATUS) & E1000_STATUS_LU)) {
@@ -2508,10 +2652,6 @@ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data)
2508 goto out; 2652 goto out;
2509 } 2653 }
2510 2654
2511 ret_val = hw->phy.ops.acquire_phy(hw);
2512 if (ret_val)
2513 goto out;
2514
2515 hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); 2655 hw->phy.addr = e1000_get_phy_addr_for_hv_page(page);
2516 2656
2517 if (page == HV_INTC_FC_PAGE_START) 2657 if (page == HV_INTC_FC_PAGE_START)
@@ -2529,42 +2669,76 @@ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data)
2529 ret_val = e1000e_write_phy_reg_mdic(hw, 2669 ret_val = e1000e_write_phy_reg_mdic(hw,
2530 IGP01E1000_PHY_PAGE_SELECT, 2670 IGP01E1000_PHY_PAGE_SELECT,
2531 (page << IGP_PAGE_SHIFT)); 2671 (page << IGP_PAGE_SHIFT));
2532 if (ret_val) {
2533 hw->phy.ops.release_phy(hw);
2534 goto out;
2535 }
2536 hw->phy.addr = phy_addr; 2672 hw->phy.addr = phy_addr;
2537 } 2673 }
2538 } 2674 }
2539 2675
2540 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, 2676 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
2541 data); 2677 data);
2542 hw->phy.ops.release_phy(hw);
2543
2544out: 2678out:
2545 /* Revert to MDIO fast mode, if applicable */ 2679 /* Revert to MDIO fast mode, if applicable */
2546 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) 2680 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
2547 ret_val = e1000_set_mdio_slow_mode_hv(hw, false); 2681 ret_val = e1000_set_mdio_slow_mode_hv(hw, false);
2548 2682
2683 if (!locked)
2684 hw->phy.ops.release_phy(hw);
2685
2549 return ret_val; 2686 return ret_val;
2550} 2687}
2551 2688
2552/** 2689/**
2553 * e1000_write_phy_reg_hv - Write HV PHY register 2690 * e1000_read_phy_reg_hv - Read HV PHY register
2691 * @hw: pointer to the HW structure
2692 * @offset: register offset to be read
2693 * @data: pointer to the read data
2694 *
2695 * Acquires semaphore then reads the PHY register at offset and stores
2696 * the retrieved information in data. Release the acquired semaphore
2697 * before exiting.
2698 **/
2699s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data)
2700{
2701 return __e1000_read_phy_reg_hv(hw, offset, data, false);
2702}
2703
2704/**
2705 * e1000_read_phy_reg_hv_locked - Read HV PHY register
2706 * @hw: pointer to the HW structure
2707 * @offset: register offset to be read
2708 * @data: pointer to the read data
2709 *
2710 * Reads the PHY register at offset and stores the retrieved information
2711 * in data. Assumes semaphore already acquired.
2712 **/
2713s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data)
2714{
2715 return __e1000_read_phy_reg_hv(hw, offset, data, true);
2716}
2717
2718/**
2719 * __e1000_write_phy_reg_hv - Write HV PHY register
2554 * @hw: pointer to the HW structure 2720 * @hw: pointer to the HW structure
2555 * @offset: register offset to write to 2721 * @offset: register offset to write to
2556 * @data: data to write at register offset 2722 * @data: data to write at register offset
2723 * @locked: semaphore has already been acquired or not
2557 * 2724 *
2558 * Acquires semaphore, if necessary, then writes the data to PHY register 2725 * Acquires semaphore, if necessary, then writes the data to PHY register
2559 * at the offset. Release any acquired semaphores before exiting. 2726 * at the offset. Release any acquired semaphores before exiting.
2560 **/ 2727 **/
2561s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) 2728static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
2729 bool locked)
2562{ 2730{
2563 s32 ret_val; 2731 s32 ret_val;
2564 u16 page = BM_PHY_REG_PAGE(offset); 2732 u16 page = BM_PHY_REG_PAGE(offset);
2565 u16 reg = BM_PHY_REG_NUM(offset); 2733 u16 reg = BM_PHY_REG_NUM(offset);
2566 bool in_slow_mode = false; 2734 bool in_slow_mode = false;
2567 2735
2736 if (!locked) {
2737 ret_val = hw->phy.ops.acquire_phy(hw);
2738 if (ret_val)
2739 return ret_val;
2740 }
2741
2568 /* Workaround failure in MDIO access while cable is disconnected */ 2742 /* Workaround failure in MDIO access while cable is disconnected */
2569 if ((hw->phy.type == e1000_phy_82577) && 2743 if ((hw->phy.type == e1000_phy_82577) &&
2570 !(er32(STATUS) & E1000_STATUS_LU)) { 2744 !(er32(STATUS) & E1000_STATUS_LU)) {
@@ -2588,10 +2762,6 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
2588 goto out; 2762 goto out;
2589 } 2763 }
2590 2764
2591 ret_val = hw->phy.ops.acquire_phy(hw);
2592 if (ret_val)
2593 goto out;
2594
2595 hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); 2765 hw->phy.addr = e1000_get_phy_addr_for_hv_page(page);
2596 2766
2597 if (page == HV_INTC_FC_PAGE_START) 2767 if (page == HV_INTC_FC_PAGE_START)
@@ -2607,15 +2777,10 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
2607 ((MAX_PHY_REG_ADDRESS & reg) == 0) && 2777 ((MAX_PHY_REG_ADDRESS & reg) == 0) &&
2608 (data & (1 << 11))) { 2778 (data & (1 << 11))) {
2609 u16 data2 = 0x7EFF; 2779 u16 data2 = 0x7EFF;
2610 hw->phy.ops.release_phy(hw);
2611 ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3, 2780 ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3,
2612 &data2, false); 2781 &data2, false);
2613 if (ret_val) 2782 if (ret_val)
2614 goto out; 2783 goto out;
2615
2616 ret_val = hw->phy.ops.acquire_phy(hw);
2617 if (ret_val)
2618 goto out;
2619 } 2784 }
2620 2785
2621 if (reg > MAX_PHY_MULTI_PAGE_REG) { 2786 if (reg > MAX_PHY_MULTI_PAGE_REG) {
@@ -2630,27 +2795,53 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
2630 ret_val = e1000e_write_phy_reg_mdic(hw, 2795 ret_val = e1000e_write_phy_reg_mdic(hw,
2631 IGP01E1000_PHY_PAGE_SELECT, 2796 IGP01E1000_PHY_PAGE_SELECT,
2632 (page << IGP_PAGE_SHIFT)); 2797 (page << IGP_PAGE_SHIFT));
2633 if (ret_val) {
2634 hw->phy.ops.release_phy(hw);
2635 goto out;
2636 }
2637 hw->phy.addr = phy_addr; 2798 hw->phy.addr = phy_addr;
2638 } 2799 }
2639 } 2800 }
2640 2801
2641 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, 2802 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
2642 data); 2803 data);
2643 hw->phy.ops.release_phy(hw);
2644 2804
2645out: 2805out:
2646 /* Revert to MDIO fast mode, if applicable */ 2806 /* Revert to MDIO fast mode, if applicable */
2647 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) 2807 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
2648 ret_val = e1000_set_mdio_slow_mode_hv(hw, false); 2808 ret_val = e1000_set_mdio_slow_mode_hv(hw, false);
2649 2809
2810 if (!locked)
2811 hw->phy.ops.release_phy(hw);
2812
2650 return ret_val; 2813 return ret_val;
2651} 2814}
2652 2815
2653/** 2816/**
2817 * e1000_write_phy_reg_hv - Write HV PHY register
2818 * @hw: pointer to the HW structure
2819 * @offset: register offset to write to
2820 * @data: data to write at register offset
2821 *
2822 * Acquires semaphore then writes the data to PHY register at the offset.
2823 * Release the acquired semaphores before exiting.
2824 **/
2825s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
2826{
2827 return __e1000_write_phy_reg_hv(hw, offset, data, false);
2828}
2829
2830/**
2831 * e1000_write_phy_reg_hv_locked - Write HV PHY register
2832 * @hw: pointer to the HW structure
2833 * @offset: register offset to write to
2834 * @data: data to write at register offset
2835 *
2836 * Writes the data to PHY register at the offset. Assumes semaphore
2837 * already acquired.
2838 **/
2839s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data)
2840{
2841 return __e1000_write_phy_reg_hv(hw, offset, data, true);
2842}
2843
2844/**
2654 * e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page 2845 * e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page
2655 * @page: page to be accessed 2846 * @page: page to be accessed
2656 **/ 2847 **/
@@ -2671,10 +2862,9 @@ static u32 e1000_get_phy_addr_for_hv_page(u32 page)
2671 * @data: pointer to the data to be read or written 2862 * @data: pointer to the data to be read or written
2672 * @read: determines if operation is read or written 2863 * @read: determines if operation is read or written
2673 * 2864 *
2674 * Acquires semaphore, if necessary, then reads the PHY register at offset 2865 * Reads the PHY register at offset and stores the retreived information
2675 * and storing the retreived information in data. Release any acquired 2866 * in data. Assumes semaphore already acquired. Note that the procedure
2676 * semaphores before exiting. Note that the procedure to read these regs 2867 * to read these regs uses the address port and data port to read/write.
2677 * uses the address port and data port to read/write.
2678 **/ 2868 **/
2679static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, 2869static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
2680 u16 *data, bool read) 2870 u16 *data, bool read)
@@ -2682,20 +2872,12 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
2682 s32 ret_val; 2872 s32 ret_val;
2683 u32 addr_reg = 0; 2873 u32 addr_reg = 0;
2684 u32 data_reg = 0; 2874 u32 data_reg = 0;
2685 u8 phy_acquired = 1;
2686 2875
2687 /* This takes care of the difference with desktop vs mobile phy */ 2876 /* This takes care of the difference with desktop vs mobile phy */
2688 addr_reg = (hw->phy.type == e1000_phy_82578) ? 2877 addr_reg = (hw->phy.type == e1000_phy_82578) ?
2689 I82578_ADDR_REG : I82577_ADDR_REG; 2878 I82578_ADDR_REG : I82577_ADDR_REG;
2690 data_reg = addr_reg + 1; 2879 data_reg = addr_reg + 1;
2691 2880
2692 ret_val = hw->phy.ops.acquire_phy(hw);
2693 if (ret_val) {
2694 hw_dbg(hw, "Could not acquire PHY\n");
2695 phy_acquired = 0;
2696 goto out;
2697 }
2698
2699 /* All operations in this function are phy address 2 */ 2881 /* All operations in this function are phy address 2 */
2700 hw->phy.addr = 2; 2882 hw->phy.addr = 2;
2701 2883
@@ -2718,8 +2900,6 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
2718 } 2900 }
2719 2901
2720out: 2902out:
2721 if (phy_acquired == 1)
2722 hw->phy.ops.release_phy(hw);
2723 return ret_val; 2903 return ret_val;
2724} 2904}
2725 2905
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 96f5b2a2d2c5..f7d9ac8324cb 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -223,24 +223,25 @@ struct ethoc_bd {
223 u32 addr; 223 u32 addr;
224}; 224};
225 225
226static u32 ethoc_read(struct ethoc *dev, loff_t offset) 226static inline u32 ethoc_read(struct ethoc *dev, loff_t offset)
227{ 227{
228 return ioread32(dev->iobase + offset); 228 return ioread32(dev->iobase + offset);
229} 229}
230 230
231static void ethoc_write(struct ethoc *dev, loff_t offset, u32 data) 231static inline void ethoc_write(struct ethoc *dev, loff_t offset, u32 data)
232{ 232{
233 iowrite32(data, dev->iobase + offset); 233 iowrite32(data, dev->iobase + offset);
234} 234}
235 235
236static void ethoc_read_bd(struct ethoc *dev, int index, struct ethoc_bd *bd) 236static inline void ethoc_read_bd(struct ethoc *dev, int index,
237 struct ethoc_bd *bd)
237{ 238{
238 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); 239 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
239 bd->stat = ethoc_read(dev, offset + 0); 240 bd->stat = ethoc_read(dev, offset + 0);
240 bd->addr = ethoc_read(dev, offset + 4); 241 bd->addr = ethoc_read(dev, offset + 4);
241} 242}
242 243
243static void ethoc_write_bd(struct ethoc *dev, int index, 244static inline void ethoc_write_bd(struct ethoc *dev, int index,
244 const struct ethoc_bd *bd) 245 const struct ethoc_bd *bd)
245{ 246{
246 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); 247 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
@@ -248,33 +249,33 @@ static void ethoc_write_bd(struct ethoc *dev, int index,
248 ethoc_write(dev, offset + 4, bd->addr); 249 ethoc_write(dev, offset + 4, bd->addr);
249} 250}
250 251
251static void ethoc_enable_irq(struct ethoc *dev, u32 mask) 252static inline void ethoc_enable_irq(struct ethoc *dev, u32 mask)
252{ 253{
253 u32 imask = ethoc_read(dev, INT_MASK); 254 u32 imask = ethoc_read(dev, INT_MASK);
254 imask |= mask; 255 imask |= mask;
255 ethoc_write(dev, INT_MASK, imask); 256 ethoc_write(dev, INT_MASK, imask);
256} 257}
257 258
258static void ethoc_disable_irq(struct ethoc *dev, u32 mask) 259static inline void ethoc_disable_irq(struct ethoc *dev, u32 mask)
259{ 260{
260 u32 imask = ethoc_read(dev, INT_MASK); 261 u32 imask = ethoc_read(dev, INT_MASK);
261 imask &= ~mask; 262 imask &= ~mask;
262 ethoc_write(dev, INT_MASK, imask); 263 ethoc_write(dev, INT_MASK, imask);
263} 264}
264 265
265static void ethoc_ack_irq(struct ethoc *dev, u32 mask) 266static inline void ethoc_ack_irq(struct ethoc *dev, u32 mask)
266{ 267{
267 ethoc_write(dev, INT_SOURCE, mask); 268 ethoc_write(dev, INT_SOURCE, mask);
268} 269}
269 270
270static void ethoc_enable_rx_and_tx(struct ethoc *dev) 271static inline void ethoc_enable_rx_and_tx(struct ethoc *dev)
271{ 272{
272 u32 mode = ethoc_read(dev, MODER); 273 u32 mode = ethoc_read(dev, MODER);
273 mode |= MODER_RXEN | MODER_TXEN; 274 mode |= MODER_RXEN | MODER_TXEN;
274 ethoc_write(dev, MODER, mode); 275 ethoc_write(dev, MODER, mode);
275} 276}
276 277
277static void ethoc_disable_rx_and_tx(struct ethoc *dev) 278static inline void ethoc_disable_rx_and_tx(struct ethoc *dev)
278{ 279{
279 u32 mode = ethoc_read(dev, MODER); 280 u32 mode = ethoc_read(dev, MODER);
280 mode &= ~(MODER_RXEN | MODER_TXEN); 281 mode &= ~(MODER_RXEN | MODER_TXEN);
@@ -508,7 +509,7 @@ static irqreturn_t ethoc_interrupt(int irq, void *dev_id)
508 return IRQ_NONE; 509 return IRQ_NONE;
509 } 510 }
510 511
511 ethoc_ack_irq(priv, INT_MASK_ALL); 512 ethoc_ack_irq(priv, pending);
512 513
513 if (pending & INT_MASK_BUSY) { 514 if (pending & INT_MASK_BUSY) {
514 dev_err(&dev->dev, "packet dropped\n"); 515 dev_err(&dev->dev, "packet dropped\n");
@@ -664,7 +665,8 @@ static int ethoc_open(struct net_device *dev)
664 return ret; 665 return ret;
665 666
666 /* calculate the number of TX/RX buffers, maximum 128 supported */ 667 /* calculate the number of TX/RX buffers, maximum 128 supported */
667 num_bd = min(128, (dev->mem_end - dev->mem_start + 1) / ETHOC_BUFSIZ); 668 num_bd = min_t(unsigned int,
669 128, (dev->mem_end - dev->mem_start + 1) / ETHOC_BUFSIZ);
668 priv->num_tx = max(min_tx, num_bd / 4); 670 priv->num_tx = max(min_tx, num_bd / 4);
669 priv->num_rx = num_bd - priv->num_tx; 671 priv->num_rx = num_bd - priv->num_tx;
670 ethoc_write(priv, TX_BD_NUM, priv->num_tx); 672 ethoc_write(priv, TX_BD_NUM, priv->num_tx);
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 29234380e6c6..16a1d58419d9 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1654,7 +1654,7 @@ static const struct net_device_ops fec_netdev_ops = {
1654 * 1654 *
1655 * index is only used in legacy code 1655 * index is only used in legacy code
1656 */ 1656 */
1657int __init fec_enet_init(struct net_device *dev, int index) 1657static int fec_enet_init(struct net_device *dev, int index)
1658{ 1658{
1659 struct fec_enet_private *fep = netdev_priv(dev); 1659 struct fec_enet_private *fep = netdev_priv(dev);
1660 struct bufdesc *cbd_base; 1660 struct bufdesc *cbd_base;
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index c40113f58963..66dace6d324f 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -759,12 +759,6 @@ static void mpc52xx_fec_reset(struct net_device *dev)
759 759
760 mpc52xx_fec_hw_init(dev); 760 mpc52xx_fec_hw_init(dev);
761 761
762 if (priv->phydev) {
763 phy_stop(priv->phydev);
764 phy_write(priv->phydev, MII_BMCR, BMCR_RESET);
765 phy_start(priv->phydev);
766 }
767
768 bcom_fec_rx_reset(priv->rx_dmatsk); 762 bcom_fec_rx_reset(priv->rx_dmatsk);
769 bcom_fec_tx_reset(priv->tx_dmatsk); 763 bcom_fec_tx_reset(priv->tx_dmatsk);
770 764
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c
index 31e6d62b785d..ee0f3c6d3f88 100644
--- a/drivers/net/fec_mpc52xx_phy.c
+++ b/drivers/net/fec_mpc52xx_phy.c
@@ -155,6 +155,7 @@ static struct of_device_id mpc52xx_fec_mdio_match[] = {
155 { .compatible = "mpc5200b-fec-phy", }, 155 { .compatible = "mpc5200b-fec-phy", },
156 {} 156 {}
157}; 157};
158MODULE_DEVICE_TABLE(of, mpc52xx_fec_mdio_match);
158 159
159struct of_platform_driver mpc52xx_fec_mdio_driver = { 160struct of_platform_driver mpc52xx_fec_mdio_driver = {
160 .name = "mpc5200b-fec-phy", 161 .name = "mpc5200b-fec-phy",
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 2bc2d2b20644..ec2f5034457f 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1110,6 +1110,7 @@ static struct of_device_id fs_enet_match[] = {
1110#endif 1110#endif
1111 {} 1111 {}
1112}; 1112};
1113MODULE_DEVICE_TABLE(of, fs_enet_match);
1113 1114
1114static struct of_platform_driver fs_enet_driver = { 1115static struct of_platform_driver fs_enet_driver = {
1115 .name = "fs_enet", 1116 .name = "fs_enet",
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index 93b481b0e3c7..24ff9f43a62b 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -221,6 +221,7 @@ static struct of_device_id fs_enet_mdio_bb_match[] = {
221 }, 221 },
222 {}, 222 {},
223}; 223};
224MODULE_DEVICE_TABLE(of, fs_enet_mdio_bb_match);
224 225
225static struct of_platform_driver fs_enet_bb_mdio_driver = { 226static struct of_platform_driver fs_enet_bb_mdio_driver = {
226 .name = "fsl-bb-mdio", 227 .name = "fsl-bb-mdio",
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index a2d69c1cd07e..96eba4280c5c 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -219,6 +219,7 @@ static struct of_device_id fs_enet_mdio_fec_match[] = {
219#endif 219#endif
220 {}, 220 {},
221}; 221};
222MODULE_DEVICE_TABLE(of, fs_enet_mdio_fec_match);
222 223
223static struct of_platform_driver fs_enet_fec_mdio_driver = { 224static struct of_platform_driver fs_enet_fec_mdio_driver = {
224 .name = "fsl-fec-mdio", 225 .name = "fsl-fec-mdio",
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index d167090248e2..6ac464866972 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -407,6 +407,7 @@ static struct of_device_id fsl_pq_mdio_match[] = {
407 }, 407 },
408 {}, 408 {},
409}; 409};
410MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
410 411
411static struct of_platform_driver fsl_pq_mdio_driver = { 412static struct of_platform_driver fsl_pq_mdio_driver = {
412 .name = "fsl-pq_mdio", 413 .name = "fsl-pq_mdio",
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 1e5289ffef6f..5bf31f1509c9 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -2325,9 +2325,6 @@ static irqreturn_t gfar_error(int irq, void *dev_id)
2325 return IRQ_HANDLED; 2325 return IRQ_HANDLED;
2326} 2326}
2327 2327
2328/* work with hotplug and coldplug */
2329MODULE_ALIAS("platform:fsl-gianfar");
2330
2331static struct of_device_id gfar_match[] = 2328static struct of_device_id gfar_match[] =
2332{ 2329{
2333 { 2330 {
@@ -2336,6 +2333,7 @@ static struct of_device_id gfar_match[] =
2336 }, 2333 },
2337 {}, 2334 {},
2338}; 2335};
2336MODULE_DEVICE_TABLE(of, gfar_match);
2339 2337
2340/* Structure for a device driver */ 2338/* Structure for a device driver */
2341static struct of_platform_driver gfar_driver = { 2339static struct of_platform_driver gfar_driver = {
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 89c82c5e63e4..3fae87559791 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -24,6 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <linux/module.h>
27#include <linux/sched.h> 28#include <linux/sched.h>
28#include <linux/string.h> 29#include <linux/string.h>
29#include <linux/errno.h> 30#include <linux/errno.h>
@@ -443,7 +444,7 @@ static u32 __emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_s
443 ret |= EMAC_MR1_TFS_2K; 444 ret |= EMAC_MR1_TFS_2K;
444 break; 445 break;
445 default: 446 default:
446 printk(KERN_WARNING "%s: Unknown Rx FIFO size %d\n", 447 printk(KERN_WARNING "%s: Unknown Tx FIFO size %d\n",
447 dev->ndev->name, tx_size); 448 dev->ndev->name, tx_size);
448 } 449 }
449 450
@@ -470,6 +471,9 @@ static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_
470 DBG2(dev, "__emac4_calc_base_mr1" NL); 471 DBG2(dev, "__emac4_calc_base_mr1" NL);
471 472
472 switch(tx_size) { 473 switch(tx_size) {
474 case 16384:
475 ret |= EMAC4_MR1_TFS_16K;
476 break;
473 case 4096: 477 case 4096:
474 ret |= EMAC4_MR1_TFS_4K; 478 ret |= EMAC4_MR1_TFS_4K;
475 break; 479 break;
@@ -477,7 +481,7 @@ static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_
477 ret |= EMAC4_MR1_TFS_2K; 481 ret |= EMAC4_MR1_TFS_2K;
478 break; 482 break;
479 default: 483 default:
480 printk(KERN_WARNING "%s: Unknown Rx FIFO size %d\n", 484 printk(KERN_WARNING "%s: Unknown Tx FIFO size %d\n",
481 dev->ndev->name, tx_size); 485 dev->ndev->name, tx_size);
482 } 486 }
483 487
@@ -2985,6 +2989,7 @@ static struct of_device_id emac_match[] =
2985 }, 2989 },
2986 {}, 2990 {},
2987}; 2991};
2992MODULE_DEVICE_TABLE(of, emac_match);
2988 2993
2989static struct of_platform_driver emac_driver = { 2994static struct of_platform_driver emac_driver = {
2990 .name = "emac", 2995 .name = "emac",
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 0afc2cf5c52b..d34adf99fc6a 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -153,6 +153,7 @@ struct emac_regs {
153#define EMAC4_MR1_RFS_16K 0x00280000 153#define EMAC4_MR1_RFS_16K 0x00280000
154#define EMAC4_MR1_TFS_2K 0x00020000 154#define EMAC4_MR1_TFS_2K 0x00020000
155#define EMAC4_MR1_TFS_4K 0x00030000 155#define EMAC4_MR1_TFS_4K 0x00030000
156#define EMAC4_MR1_TFS_16K 0x00050000
156#define EMAC4_MR1_TR 0x00008000 157#define EMAC4_MR1_TR 0x00008000
157#define EMAC4_MR1_MWSW_001 0x00001000 158#define EMAC4_MR1_MWSW_001 0x00001000
158#define EMAC4_MR1_JPSM 0x00000800 159#define EMAC4_MR1_JPSM 0x00000800
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 801f088c134f..030913f8bd26 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -98,12 +98,13 @@ static void ri_tasklet(unsigned long dev)
98 stats->tx_packets++; 98 stats->tx_packets++;
99 stats->tx_bytes +=skb->len; 99 stats->tx_bytes +=skb->len;
100 100
101 skb->dev = __dev_get_by_index(&init_net, skb->iif); 101 skb->dev = dev_get_by_index(&init_net, skb->iif);
102 if (!skb->dev) { 102 if (!skb->dev) {
103 dev_kfree_skb(skb); 103 dev_kfree_skb(skb);
104 stats->tx_dropped++; 104 stats->tx_dropped++;
105 break; 105 break;
106 } 106 }
107 dev_put(skb->dev);
107 skb->iif = _dev->ifindex; 108 skb->iif = _dev->ifindex;
108 109
109 if (from & AT_EGRESS) { 110 if (from & AT_EGRESS) {
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index deaea8fa1032..b243ed3b0c36 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -732,7 +732,7 @@ static int igb_set_ringparam(struct net_device *netdev,
732{ 732{
733 struct igb_adapter *adapter = netdev_priv(netdev); 733 struct igb_adapter *adapter = netdev_priv(netdev);
734 struct igb_ring *temp_ring; 734 struct igb_ring *temp_ring;
735 int i, err; 735 int i, err = 0;
736 u32 new_rx_count, new_tx_count; 736 u32 new_rx_count, new_tx_count;
737 737
738 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 738 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
@@ -752,18 +752,30 @@ static int igb_set_ringparam(struct net_device *netdev,
752 return 0; 752 return 0;
753 } 753 }
754 754
755 while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
756 msleep(1);
757
758 if (!netif_running(adapter->netdev)) {
759 for (i = 0; i < adapter->num_tx_queues; i++)
760 adapter->tx_ring[i].count = new_tx_count;
761 for (i = 0; i < adapter->num_rx_queues; i++)
762 adapter->rx_ring[i].count = new_rx_count;
763 adapter->tx_ring_count = new_tx_count;
764 adapter->rx_ring_count = new_rx_count;
765 goto clear_reset;
766 }
767
755 if (adapter->num_tx_queues > adapter->num_rx_queues) 768 if (adapter->num_tx_queues > adapter->num_rx_queues)
756 temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring)); 769 temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring));
757 else 770 else
758 temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring)); 771 temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring));
759 if (!temp_ring)
760 return -ENOMEM;
761 772
762 while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) 773 if (!temp_ring) {
763 msleep(1); 774 err = -ENOMEM;
775 goto clear_reset;
776 }
764 777
765 if (netif_running(adapter->netdev)) 778 igb_down(adapter);
766 igb_down(adapter);
767 779
768 /* 780 /*
769 * We can't just free everything and then setup again, 781 * We can't just free everything and then setup again,
@@ -820,14 +832,11 @@ static int igb_set_ringparam(struct net_device *netdev,
820 832
821 adapter->rx_ring_count = new_rx_count; 833 adapter->rx_ring_count = new_rx_count;
822 } 834 }
823
824 err = 0;
825err_setup: 835err_setup:
826 if (netif_running(adapter->netdev)) 836 igb_up(adapter);
827 igb_up(adapter);
828
829 clear_bit(__IGB_RESETTING, &adapter->state);
830 vfree(temp_ring); 837 vfree(temp_ring);
838clear_reset:
839 clear_bit(__IGB_RESETTING, &adapter->state);
831 return err; 840 return err;
832} 841}
833 842
diff --git a/drivers/net/igbvf/ethtool.c b/drivers/net/igbvf/ethtool.c
index ee17a097d1ca..c68265bd0d1a 100644
--- a/drivers/net/igbvf/ethtool.c
+++ b/drivers/net/igbvf/ethtool.c
@@ -279,7 +279,7 @@ static int igbvf_set_ringparam(struct net_device *netdev,
279{ 279{
280 struct igbvf_adapter *adapter = netdev_priv(netdev); 280 struct igbvf_adapter *adapter = netdev_priv(netdev);
281 struct igbvf_ring *temp_ring; 281 struct igbvf_ring *temp_ring;
282 int err; 282 int err = 0;
283 u32 new_rx_count, new_tx_count; 283 u32 new_rx_count, new_tx_count;
284 284
285 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 285 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
@@ -299,15 +299,22 @@ static int igbvf_set_ringparam(struct net_device *netdev,
299 return 0; 299 return 0;
300 } 300 }
301 301
302 temp_ring = vmalloc(sizeof(struct igbvf_ring));
303 if (!temp_ring)
304 return -ENOMEM;
305
306 while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state)) 302 while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state))
307 msleep(1); 303 msleep(1);
308 304
309 if (netif_running(adapter->netdev)) 305 if (!netif_running(adapter->netdev)) {
310 igbvf_down(adapter); 306 adapter->tx_ring->count = new_tx_count;
307 adapter->rx_ring->count = new_rx_count;
308 goto clear_reset;
309 }
310
311 temp_ring = vmalloc(sizeof(struct igbvf_ring));
312 if (!temp_ring) {
313 err = -ENOMEM;
314 goto clear_reset;
315 }
316
317 igbvf_down(adapter);
311 318
312 /* 319 /*
313 * We can't just free everything and then setup again, 320 * We can't just free everything and then setup again,
@@ -339,14 +346,11 @@ static int igbvf_set_ringparam(struct net_device *netdev,
339 346
340 memcpy(adapter->rx_ring, temp_ring,sizeof(struct igbvf_ring)); 347 memcpy(adapter->rx_ring, temp_ring,sizeof(struct igbvf_ring));
341 } 348 }
342
343 err = 0;
344err_setup: 349err_setup:
345 if (netif_running(adapter->netdev)) 350 igbvf_up(adapter);
346 igbvf_up(adapter);
347
348 clear_bit(__IGBVF_RESETTING, &adapter->state);
349 vfree(temp_ring); 351 vfree(temp_ring);
352clear_reset:
353 clear_bit(__IGBVF_RESETTING, &adapter->state);
350 return err; 354 return err;
351} 355}
352 356
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 38bf7cf2256d..c412e8026173 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -232,8 +232,11 @@ static int sa1100_irda_startup(struct sa1100_irda *si)
232 /* 232 /*
233 * Ensure that the ports for this device are setup correctly. 233 * Ensure that the ports for this device are setup correctly.
234 */ 234 */
235 if (si->pdata->startup) 235 if (si->pdata->startup) {
236 si->pdata->startup(si->dev); 236 ret = si->pdata->startup(si->dev);
237 if (ret)
238 return ret;
239 }
237 240
238 /* 241 /*
239 * Configure PPC for IRDA - we want to drive TXD2 low. 242 * Configure PPC for IRDA - we want to drive TXD2 low.
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index fa314cb005a4..856c18c207f3 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -798,7 +798,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
798{ 798{
799 struct ixgbe_adapter *adapter = netdev_priv(netdev); 799 struct ixgbe_adapter *adapter = netdev_priv(netdev);
800 struct ixgbe_ring *temp_tx_ring, *temp_rx_ring; 800 struct ixgbe_ring *temp_tx_ring, *temp_rx_ring;
801 int i, err; 801 int i, err = 0;
802 u32 new_rx_count, new_tx_count; 802 u32 new_rx_count, new_tx_count;
803 bool need_update = false; 803 bool need_update = false;
804 804
@@ -822,6 +822,16 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
822 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) 822 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
823 msleep(1); 823 msleep(1);
824 824
825 if (!netif_running(adapter->netdev)) {
826 for (i = 0; i < adapter->num_tx_queues; i++)
827 adapter->tx_ring[i].count = new_tx_count;
828 for (i = 0; i < adapter->num_rx_queues; i++)
829 adapter->rx_ring[i].count = new_rx_count;
830 adapter->tx_ring_count = new_tx_count;
831 adapter->rx_ring_count = new_rx_count;
832 goto err_setup;
833 }
834
825 temp_tx_ring = kcalloc(adapter->num_tx_queues, 835 temp_tx_ring = kcalloc(adapter->num_tx_queues,
826 sizeof(struct ixgbe_ring), GFP_KERNEL); 836 sizeof(struct ixgbe_ring), GFP_KERNEL);
827 if (!temp_tx_ring) { 837 if (!temp_tx_ring) {
@@ -879,8 +889,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
879 889
880 /* if rings need to be updated, here's the place to do it in one shot */ 890 /* if rings need to be updated, here's the place to do it in one shot */
881 if (need_update) { 891 if (need_update) {
882 if (netif_running(netdev)) 892 ixgbe_down(adapter);
883 ixgbe_down(adapter);
884 893
885 /* tx */ 894 /* tx */
886 if (new_tx_count != adapter->tx_ring_count) { 895 if (new_tx_count != adapter->tx_ring_count) {
@@ -897,13 +906,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
897 temp_rx_ring = NULL; 906 temp_rx_ring = NULL;
898 adapter->rx_ring_count = new_rx_count; 907 adapter->rx_ring_count = new_rx_count;
899 } 908 }
900 }
901
902 /* success! */
903 err = 0;
904 if (netif_running(netdev))
905 ixgbe_up(adapter); 909 ixgbe_up(adapter);
906 910 }
907err_setup: 911err_setup:
908 clear_bit(__IXGBE_RESETTING, &adapter->state); 912 clear_bit(__IXGBE_RESETTING, &adapter->state);
909 return err; 913 return err;
diff --git a/drivers/net/ixp2000/enp2611.c b/drivers/net/ixp2000/enp2611.c
index b02a981c87a8..34a6cfd17930 100644
--- a/drivers/net/ixp2000/enp2611.c
+++ b/drivers/net/ixp2000/enp2611.c
@@ -119,24 +119,9 @@ static struct ixp2400_msf_parameters enp2611_msf_parameters =
119 } 119 }
120}; 120};
121 121
122struct enp2611_ixpdev_priv
123{
124 struct ixpdev_priv ixpdev_priv;
125 struct net_device_stats stats;
126};
127
128static struct net_device *nds[3]; 122static struct net_device *nds[3];
129static struct timer_list link_check_timer; 123static struct timer_list link_check_timer;
130 124
131static struct net_device_stats *enp2611_get_stats(struct net_device *dev)
132{
133 struct enp2611_ixpdev_priv *ip = netdev_priv(dev);
134
135 pm3386_get_stats(ip->ixpdev_priv.channel, &(ip->stats));
136
137 return &(ip->stats);
138}
139
140/* @@@ Poll the SFP moddef0 line too. */ 125/* @@@ Poll the SFP moddef0 line too. */
141/* @@@ Try to use the pm3386 DOOL interrupt as well. */ 126/* @@@ Try to use the pm3386 DOOL interrupt as well. */
142static void enp2611_check_link_status(unsigned long __dummy) 127static void enp2611_check_link_status(unsigned long __dummy)
@@ -203,14 +188,13 @@ static int __init enp2611_init_module(void)
203 188
204 ports = pm3386_port_count(); 189 ports = pm3386_port_count();
205 for (i = 0; i < ports; i++) { 190 for (i = 0; i < ports; i++) {
206 nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv)); 191 nds[i] = ixpdev_alloc(i, sizeof(struct ixpdev_priv));
207 if (nds[i] == NULL) { 192 if (nds[i] == NULL) {
208 while (--i >= 0) 193 while (--i >= 0)
209 free_netdev(nds[i]); 194 free_netdev(nds[i]);
210 return -ENOMEM; 195 return -ENOMEM;
211 } 196 }
212 197
213 nds[i]->get_stats = enp2611_get_stats;
214 pm3386_init_port(i); 198 pm3386_init_port(i);
215 pm3386_get_mac(i, nds[i]->dev_addr); 199 pm3386_get_mac(i, nds[i]->dev_addr);
216 } 200 }
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index 127243461a51..9aee0cc922c9 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -21,6 +21,7 @@
21#include "ixp2400_tx.ucode" 21#include "ixp2400_tx.ucode"
22#include "ixpdev_priv.h" 22#include "ixpdev_priv.h"
23#include "ixpdev.h" 23#include "ixpdev.h"
24#include "pm3386.h"
24 25
25#define DRV_MODULE_VERSION "0.2" 26#define DRV_MODULE_VERSION "0.2"
26 27
@@ -271,6 +272,15 @@ static int ixpdev_close(struct net_device *dev)
271 return 0; 272 return 0;
272} 273}
273 274
275static struct net_device_stats *ixpdev_get_stats(struct net_device *dev)
276{
277 struct ixpdev_priv *ip = netdev_priv(dev);
278
279 pm3386_get_stats(ip->channel, &(dev->stats));
280
281 return &(dev->stats);
282}
283
274static const struct net_device_ops ixpdev_netdev_ops = { 284static const struct net_device_ops ixpdev_netdev_ops = {
275 .ndo_open = ixpdev_open, 285 .ndo_open = ixpdev_open,
276 .ndo_stop = ixpdev_close, 286 .ndo_stop = ixpdev_close,
@@ -278,6 +288,7 @@ static const struct net_device_ops ixpdev_netdev_ops = {
278 .ndo_change_mtu = eth_change_mtu, 288 .ndo_change_mtu = eth_change_mtu,
279 .ndo_validate_addr = eth_validate_addr, 289 .ndo_validate_addr = eth_validate_addr,
280 .ndo_set_mac_address = eth_mac_addr, 290 .ndo_set_mac_address = eth_mac_addr,
291 .ndo_get_stats = ixpdev_get_stats,
281#ifdef CONFIG_NET_POLL_CONTROLLER 292#ifdef CONFIG_NET_POLL_CONTROLLER
282 .ndo_poll_controller = ixpdev_poll_controller, 293 .ndo_poll_controller = ixpdev_poll_controller,
283#endif 294#endif
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 237835864357..a23f739d222f 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -171,6 +171,36 @@ static void ks8851_wrreg16(struct ks8851_net *ks, unsigned reg, unsigned val)
171} 171}
172 172
173/** 173/**
174 * ks8851_wrreg8 - write 8bit register value to chip
175 * @ks: The chip state
176 * @reg: The register address
177 * @val: The value to write
178 *
179 * Issue a write to put the value @val into the register specified in @reg.
180 */
181static void ks8851_wrreg8(struct ks8851_net *ks, unsigned reg, unsigned val)
182{
183 struct spi_transfer *xfer = &ks->spi_xfer1;
184 struct spi_message *msg = &ks->spi_msg1;
185 __le16 txb[2];
186 int ret;
187 int bit;
188
189 bit = 1 << (reg & 3);
190
191 txb[0] = cpu_to_le16(MK_OP(bit, reg) | KS_SPIOP_WR);
192 txb[1] = val;
193
194 xfer->tx_buf = txb;
195 xfer->rx_buf = NULL;
196 xfer->len = 3;
197
198 ret = spi_sync(ks->spidev, msg);
199 if (ret < 0)
200 ks_err(ks, "spi_sync() failed\n");
201}
202
203/**
174 * ks8851_rx_1msg - select whether to use one or two messages for spi read 204 * ks8851_rx_1msg - select whether to use one or two messages for spi read
175 * @ks: The device structure 205 * @ks: The device structure
176 * 206 *
@@ -322,13 +352,12 @@ static void ks8851_soft_reset(struct ks8851_net *ks, unsigned op)
322static int ks8851_write_mac_addr(struct net_device *dev) 352static int ks8851_write_mac_addr(struct net_device *dev)
323{ 353{
324 struct ks8851_net *ks = netdev_priv(dev); 354 struct ks8851_net *ks = netdev_priv(dev);
325 u16 *mcp = (u16 *)dev->dev_addr; 355 int i;
326 356
327 mutex_lock(&ks->lock); 357 mutex_lock(&ks->lock);
328 358
329 ks8851_wrreg16(ks, KS_MARL, mcp[0]); 359 for (i = 0; i < ETH_ALEN; i++)
330 ks8851_wrreg16(ks, KS_MARM, mcp[1]); 360 ks8851_wrreg8(ks, KS_MAR(i), dev->dev_addr[i]);
331 ks8851_wrreg16(ks, KS_MARH, mcp[2]);
332 361
333 mutex_unlock(&ks->lock); 362 mutex_unlock(&ks->lock);
334 363
@@ -951,7 +980,7 @@ static void ks8851_set_rx_mode(struct net_device *dev)
951 mcptr = mcptr->next; 980 mcptr = mcptr->next;
952 } 981 }
953 982
954 rxctrl.rxcr1 = RXCR1_RXME | RXCR1_RXAE | RXCR1_RXPAFMA; 983 rxctrl.rxcr1 = RXCR1_RXME | RXCR1_RXPAFMA;
955 } else { 984 } else {
956 /* just accept broadcast / unicast */ 985 /* just accept broadcast / unicast */
957 rxctrl.rxcr1 = RXCR1_RXPAFMA; 986 rxctrl.rxcr1 = RXCR1_RXPAFMA;
@@ -1239,6 +1268,9 @@ static int __devinit ks8851_probe(struct spi_device *spi)
1239 ndev->netdev_ops = &ks8851_netdev_ops; 1268 ndev->netdev_ops = &ks8851_netdev_ops;
1240 ndev->irq = spi->irq; 1269 ndev->irq = spi->irq;
1241 1270
1271 /* issue a global soft reset to reset the device. */
1272 ks8851_soft_reset(ks, GRR_GSR);
1273
1242 /* simple check for a valid chip being connected to the bus */ 1274 /* simple check for a valid chip being connected to the bus */
1243 1275
1244 if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { 1276 if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) {
diff --git a/drivers/net/ks8851.h b/drivers/net/ks8851.h
index 85abe147afbf..f52c312cc356 100644
--- a/drivers/net/ks8851.h
+++ b/drivers/net/ks8851.h
@@ -16,6 +16,7 @@
16#define CCR_32PIN (1 << 0) 16#define CCR_32PIN (1 << 0)
17 17
18/* MAC address registers */ 18/* MAC address registers */
19#define KS_MAR(_m) 0x15 - (_m)
19#define KS_MARL 0x10 20#define KS_MARL 0x10
20#define KS_MARM 0x12 21#define KS_MARM 0x12
21#define KS_MARH 0x14 22#define KS_MARH 0x14
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 5dd7225b178e..291a505fd4fc 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -1282,6 +1282,7 @@ static struct pci_device_id mlx4_pci_table[] = {
1282 { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ 1282 { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */
1283 { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ 1283 { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */
1284 { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ 1284 { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/
1285 { PCI_VDEVICE(MELLANOX, 0x6746) }, /* MT26438 ConnectX EN 40GigE PCIe gen2 5GT/s */
1285 { PCI_VDEVICE(MELLANOX, 0x676e) }, /* MT26478 ConnectX2 40GigE PCIe gen2 */ 1286 { PCI_VDEVICE(MELLANOX, 0x676e) }, /* MT26478 ConnectX2 40GigE PCIe gen2 */
1286 { 0, } 1287 { 0, }
1287}; 1288};
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 6930c87f362e..f3624517cb0e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -75,7 +75,7 @@
75#include "myri10ge_mcp.h" 75#include "myri10ge_mcp.h"
76#include "myri10ge_mcp_gen_header.h" 76#include "myri10ge_mcp_gen_header.h"
77 77
78#define MYRI10GE_VERSION_STR "1.5.0-1.432" 78#define MYRI10GE_VERSION_STR "1.5.1-1.451"
79 79
80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
81MODULE_AUTHOR("Maintainer: help@myri.com"); 81MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -1624,10 +1624,21 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
1624 return 0; 1624 return 0;
1625 } 1625 }
1626 } 1626 }
1627 if (*ptr == 'R' || *ptr == 'Q') { 1627 if (*ptr == '2')
1628 /* We've found either an XFP or quad ribbon fiber */ 1628 ptr++;
1629 if (*ptr == 'R' || *ptr == 'Q' || *ptr == 'S') {
1630 /* We've found either an XFP, quad ribbon fiber, or SFP+ */
1629 cmd->port = PORT_FIBRE; 1631 cmd->port = PORT_FIBRE;
1632 cmd->supported |= SUPPORTED_FIBRE;
1633 cmd->advertising |= ADVERTISED_FIBRE;
1634 } else {
1635 cmd->port = PORT_OTHER;
1630 } 1636 }
1637 if (*ptr == 'R' || *ptr == 'S')
1638 cmd->transceiver = XCVR_EXTERNAL;
1639 else
1640 cmd->transceiver = XCVR_INTERNAL;
1641
1631 return 0; 1642 return 0;
1632} 1643}
1633 1644
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 7a7177421d7c..1c46da632125 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -419,6 +419,7 @@ enum {
419#define NETXEN_CRB_ROMUSB \ 419#define NETXEN_CRB_ROMUSB \
420 NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_ROMUSB) 420 NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_ROMUSB)
421#define NETXEN_CRB_I2Q NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2Q) 421#define NETXEN_CRB_I2Q NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2Q)
422#define NETXEN_CRB_I2C0 NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2C0)
422#define NETXEN_CRB_SMB NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_SMB) 423#define NETXEN_CRB_SMB NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_SMB)
423#define NETXEN_CRB_MAX NETXEN_PCI_CRB_WINDOW(64) 424#define NETXEN_CRB_MAX NETXEN_PCI_CRB_WINDOW(64)
424 425
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 32314000dfcd..3185a98b0917 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1901,22 +1901,16 @@ netxen_setup_hwops(struct netxen_adapter *adapter)
1901 1901
1902int netxen_nic_get_board_info(struct netxen_adapter *adapter) 1902int netxen_nic_get_board_info(struct netxen_adapter *adapter)
1903{ 1903{
1904 int offset, board_type, magic, header_version; 1904 int offset, board_type, magic;
1905 struct pci_dev *pdev = adapter->pdev; 1905 struct pci_dev *pdev = adapter->pdev;
1906 1906
1907 offset = NX_FW_MAGIC_OFFSET; 1907 offset = NX_FW_MAGIC_OFFSET;
1908 if (netxen_rom_fast_read(adapter, offset, &magic)) 1908 if (netxen_rom_fast_read(adapter, offset, &magic))
1909 return -EIO; 1909 return -EIO;
1910 1910
1911 offset = NX_HDR_VERSION_OFFSET; 1911 if (magic != NETXEN_BDINFO_MAGIC) {
1912 if (netxen_rom_fast_read(adapter, offset, &header_version)) 1912 dev_err(&pdev->dev, "invalid board config, magic=%08x\n",
1913 return -EIO; 1913 magic);
1914
1915 if (magic != NETXEN_BDINFO_MAGIC ||
1916 header_version != NETXEN_BDINFO_VERSION) {
1917 dev_err(&pdev->dev,
1918 "invalid board config, magic=%08x, version=%08x\n",
1919 magic, header_version);
1920 return -EIO; 1914 return -EIO;
1921 } 1915 }
1922 1916
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 91c2bc61c8eb..e40b914d6faf 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -531,6 +531,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
531 continue; 531 continue;
532 532
533 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 533 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
534 if (off == (NETXEN_CRB_I2C0 + 0x1c))
535 continue;
534 /* do not reset PCI */ 536 /* do not reset PCI */
535 if (off == (ROMUSB_GLB + 0xbc)) 537 if (off == (ROMUSB_GLB + 0xbc))
536 continue; 538 continue;
@@ -553,12 +555,6 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
553 continue; 555 continue;
554 } 556 }
555 557
556 if (off == NETXEN_ADDR_ERROR) {
557 printk(KERN_ERR "%s: Err: Unknown addr: 0x%08x\n",
558 netxen_nic_driver_name, buf[i].addr);
559 continue;
560 }
561
562 init_delay = 1; 558 init_delay = 1;
563 /* After writing this register, HW needs time for CRB */ 559 /* After writing this register, HW needs time for CRB */
564 /* to quiet down (else crb_window returns 0xffffffff) */ 560 /* to quiet down (else crb_window returns 0xffffffff) */
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 9b9eab107704..0b4a56a8c8d5 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -595,7 +595,8 @@ netxen_setup_pci_map(struct netxen_adapter *adapter)
595 void __iomem *mem_ptr2 = NULL; 595 void __iomem *mem_ptr2 = NULL;
596 void __iomem *db_ptr = NULL; 596 void __iomem *db_ptr = NULL;
597 597
598 unsigned long mem_base, mem_len, db_base, db_len = 0, pci_len0 = 0; 598 resource_size_t mem_base, db_base;
599 unsigned long mem_len, db_len = 0, pci_len0 = 0;
599 600
600 struct pci_dev *pdev = adapter->pdev; 601 struct pci_dev *pdev = adapter->pdev;
601 int pci_func = adapter->ahw.pci_func; 602 int pci_func = adapter->ahw.pci_func;
@@ -1918,6 +1919,7 @@ static void netxen_tx_timeout_task(struct work_struct *work)
1918 1919
1919request_reset: 1920request_reset:
1920 adapter->need_fw_reset = 1; 1921 adapter->need_fw_reset = 1;
1922 clear_bit(__NX_RESETTING, &adapter->state);
1921} 1923}
1922 1924
1923struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) 1925struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index f9364d0678f2..d6c7ac68f6ea 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -3545,7 +3545,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3545 rp->rcr_index = index; 3545 rp->rcr_index = index;
3546 3546
3547 skb_reserve(skb, NET_IP_ALIGN); 3547 skb_reserve(skb, NET_IP_ALIGN);
3548 __pskb_pull_tail(skb, min(len, NIU_RXPULL_MAX)); 3548 __pskb_pull_tail(skb, min(len, VLAN_ETH_HLEN));
3549 3549
3550 rp->rx_packets++; 3550 rp->rx_packets++;
3551 rp->rx_bytes += skb->len; 3551 rp->rx_bytes += skb->len;
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index ee8ad3e180dd..b58965a2b3ae 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -251,6 +251,7 @@ static void el3_tx_timeout(struct net_device *dev);
251static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 251static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
252static const struct ethtool_ops netdev_ethtool_ops; 252static const struct ethtool_ops netdev_ethtool_ops;
253static void set_rx_mode(struct net_device *dev); 253static void set_rx_mode(struct net_device *dev);
254static void set_multicast_list(struct net_device *dev);
254 255
255static void tc574_detach(struct pcmcia_device *p_dev); 256static void tc574_detach(struct pcmcia_device *p_dev);
256 257
@@ -266,7 +267,7 @@ static const struct net_device_ops el3_netdev_ops = {
266 .ndo_tx_timeout = el3_tx_timeout, 267 .ndo_tx_timeout = el3_tx_timeout,
267 .ndo_get_stats = el3_get_stats, 268 .ndo_get_stats = el3_get_stats,
268 .ndo_do_ioctl = el3_ioctl, 269 .ndo_do_ioctl = el3_ioctl,
269 .ndo_set_multicast_list = set_rx_mode, 270 .ndo_set_multicast_list = set_multicast_list,
270 .ndo_change_mtu = eth_change_mtu, 271 .ndo_change_mtu = eth_change_mtu,
271 .ndo_set_mac_address = eth_mac_addr, 272 .ndo_set_mac_address = eth_mac_addr,
272 .ndo_validate_addr = eth_validate_addr, 273 .ndo_validate_addr = eth_validate_addr,
@@ -1161,6 +1162,16 @@ static void set_rx_mode(struct net_device *dev)
1161 outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD); 1162 outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD);
1162} 1163}
1163 1164
1165static void set_multicast_list(struct net_device *dev)
1166{
1167 struct el3_private *lp = netdev_priv(dev);
1168 unsigned long flags;
1169
1170 spin_lock_irqsave(&lp->window_lock, flags);
1171 set_rx_mode(dev);
1172 spin_unlock_irqrestore(&lp->window_lock, flags);
1173}
1174
1164static int el3_close(struct net_device *dev) 1175static int el3_close(struct net_device *dev)
1165{ 1176{
1166 unsigned int ioaddr = dev->base_addr; 1177 unsigned int ioaddr = dev->base_addr;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index bd3447f04902..94c9ad2746bc 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1760,7 +1760,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1760 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"), 1760 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"),
1761 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), 1761 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"),
1762 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"), 1762 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"),
1763 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), 1763 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "cis/PE-200.cis"),
1764 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"), 1764 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"),
1765 PCMCIA_DEVICE_PROD_ID12("Ethernet", "CF Size PC Card", 0x00b2e941, 0x43ac239b), 1765 PCMCIA_DEVICE_PROD_ID12("Ethernet", "CF Size PC Card", 0x00b2e941, 0x43ac239b),
1766 PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0", 1766 PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0",
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 250e10f2c35b..8659d341e769 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -238,6 +238,7 @@ static struct of_device_id mdio_ofgpio_match[] = {
238 }, 238 },
239 {}, 239 {},
240}; 240};
241MODULE_DEVICE_TABLE(of, mdio_ofgpio_match);
241 242
242static struct of_platform_driver mdio_ofgpio_driver = { 243static struct of_platform_driver mdio_ofgpio_driver = {
243 .name = "mdio-gpio", 244 .name = "mdio-gpio",
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 7cbf6f9b51de..2559991eea6a 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -111,9 +111,6 @@ struct pppoe_net {
111 rwlock_t hash_lock; 111 rwlock_t hash_lock;
112}; 112};
113 113
114/* to eliminate a race btw pppoe_flush_dev and pppoe_release */
115static DEFINE_SPINLOCK(flush_lock);
116
117/* 114/*
118 * PPPoE could be in the following stages: 115 * PPPoE could be in the following stages:
119 * 1) Discovery stage (to obtain remote MAC and Session ID) 116 * 1) Discovery stage (to obtain remote MAC and Session ID)
@@ -303,45 +300,48 @@ static void pppoe_flush_dev(struct net_device *dev)
303 write_lock_bh(&pn->hash_lock); 300 write_lock_bh(&pn->hash_lock);
304 for (i = 0; i < PPPOE_HASH_SIZE; i++) { 301 for (i = 0; i < PPPOE_HASH_SIZE; i++) {
305 struct pppox_sock *po = pn->hash_table[i]; 302 struct pppox_sock *po = pn->hash_table[i];
303 struct sock *sk;
306 304
307 while (po != NULL) { 305 while (po) {
308 struct sock *sk; 306 while (po && po->pppoe_dev != dev) {
309 if (po->pppoe_dev != dev) {
310 po = po->next; 307 po = po->next;
311 continue;
312 } 308 }
309
310 if (!po)
311 break;
312
313 sk = sk_pppox(po); 313 sk = sk_pppox(po);
314 spin_lock(&flush_lock);
315 po->pppoe_dev = NULL;
316 spin_unlock(&flush_lock);
317 dev_put(dev);
318 314
319 /* We always grab the socket lock, followed by the 315 /* We always grab the socket lock, followed by the
320 * hash_lock, in that order. Since we should 316 * hash_lock, in that order. Since we should hold the
321 * hold the sock lock while doing any unbinding, 317 * sock lock while doing any unbinding, we need to
322 * we need to release the lock we're holding. 318 * release the lock we're holding. Hold a reference to
323 * Hold a reference to the sock so it doesn't disappear 319 * the sock so it doesn't disappear as we're jumping
324 * as we're jumping between locks. 320 * between locks.
325 */ 321 */
326 322
327 sock_hold(sk); 323 sock_hold(sk);
328
329 write_unlock_bh(&pn->hash_lock); 324 write_unlock_bh(&pn->hash_lock);
330 lock_sock(sk); 325 lock_sock(sk);
331 326
332 if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { 327 if (po->pppoe_dev == dev
328 && sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
333 pppox_unbind_sock(sk); 329 pppox_unbind_sock(sk);
334 sk->sk_state = PPPOX_ZOMBIE; 330 sk->sk_state = PPPOX_ZOMBIE;
335 sk->sk_state_change(sk); 331 sk->sk_state_change(sk);
332 po->pppoe_dev = NULL;
333 dev_put(dev);
336 } 334 }
337 335
338 release_sock(sk); 336 release_sock(sk);
339 sock_put(sk); 337 sock_put(sk);
340 338
341 /* Restart scan at the beginning of this hash chain. 339 /* Restart the process from the start of the current
342 * While the lock was dropped the chain contents may 340 * hash chain. We dropped locks so the world may have
343 * have changed. 341 * change from underneath us.
344 */ 342 */
343
344 BUG_ON(pppoe_pernet(dev_net(dev)) == NULL);
345 write_lock_bh(&pn->hash_lock); 345 write_lock_bh(&pn->hash_lock);
346 po = pn->hash_table[i]; 346 po = pn->hash_table[i];
347 } 347 }
@@ -388,11 +388,16 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
388 struct pppox_sock *po = pppox_sk(sk); 388 struct pppox_sock *po = pppox_sk(sk);
389 struct pppox_sock *relay_po; 389 struct pppox_sock *relay_po;
390 390
391 /* Backlog receive. Semantics of backlog rcv preclude any code from
392 * executing in lock_sock()/release_sock() bounds; meaning sk->sk_state
393 * can't change.
394 */
395
391 if (sk->sk_state & PPPOX_BOUND) { 396 if (sk->sk_state & PPPOX_BOUND) {
392 ppp_input(&po->chan, skb); 397 ppp_input(&po->chan, skb);
393 } else if (sk->sk_state & PPPOX_RELAY) { 398 } else if (sk->sk_state & PPPOX_RELAY) {
394 relay_po = get_item_by_addr(dev_net(po->pppoe_dev), 399 relay_po = get_item_by_addr(sock_net(sk),
395 &po->pppoe_relay); 400 &po->pppoe_relay);
396 if (relay_po == NULL) 401 if (relay_po == NULL)
397 goto abort_kfree; 402 goto abort_kfree;
398 403
@@ -447,6 +452,10 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
447 goto drop; 452 goto drop;
448 453
449 pn = pppoe_pernet(dev_net(dev)); 454 pn = pppoe_pernet(dev_net(dev));
455
456 /* Note that get_item does a sock_hold(), so sk_pppox(po)
457 * is known to be safe.
458 */
450 po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); 459 po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
451 if (!po) 460 if (!po)
452 goto drop; 461 goto drop;
@@ -561,6 +570,7 @@ static int pppoe_release(struct socket *sock)
561 struct sock *sk = sock->sk; 570 struct sock *sk = sock->sk;
562 struct pppox_sock *po; 571 struct pppox_sock *po;
563 struct pppoe_net *pn; 572 struct pppoe_net *pn;
573 struct net *net = NULL;
564 574
565 if (!sk) 575 if (!sk)
566 return 0; 576 return 0;
@@ -571,44 +581,28 @@ static int pppoe_release(struct socket *sock)
571 return -EBADF; 581 return -EBADF;
572 } 582 }
573 583
584 po = pppox_sk(sk);
585
586 if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
587 dev_put(po->pppoe_dev);
588 po->pppoe_dev = NULL;
589 }
590
574 pppox_unbind_sock(sk); 591 pppox_unbind_sock(sk);
575 592
576 /* Signal the death of the socket. */ 593 /* Signal the death of the socket. */
577 sk->sk_state = PPPOX_DEAD; 594 sk->sk_state = PPPOX_DEAD;
578 595
579 /* 596 net = sock_net(sk);
580 * pppoe_flush_dev could lead to a race with 597 pn = pppoe_pernet(net);
581 * this routine so we use flush_lock to eliminate
582 * such a case (we only need per-net specific data)
583 */
584 spin_lock(&flush_lock);
585 po = pppox_sk(sk);
586 if (!po->pppoe_dev) {
587 spin_unlock(&flush_lock);
588 goto out;
589 }
590 pn = pppoe_pernet(dev_net(po->pppoe_dev));
591 spin_unlock(&flush_lock);
592 598
593 /* 599 /*
594 * protect "po" from concurrent updates 600 * protect "po" from concurrent updates
595 * on pppoe_flush_dev 601 * on pppoe_flush_dev
596 */ 602 */
597 write_lock_bh(&pn->hash_lock); 603 delete_item(pn, po->pppoe_pa.sid, po->pppoe_pa.remote,
604 po->pppoe_ifindex);
598 605
599 po = pppox_sk(sk);
600 if (stage_session(po->pppoe_pa.sid))
601 __delete_item(pn, po->pppoe_pa.sid, po->pppoe_pa.remote,
602 po->pppoe_ifindex);
603
604 if (po->pppoe_dev) {
605 dev_put(po->pppoe_dev);
606 po->pppoe_dev = NULL;
607 }
608
609 write_unlock_bh(&pn->hash_lock);
610
611out:
612 sock_orphan(sk); 606 sock_orphan(sk);
613 sock->sk = NULL; 607 sock->sk = NULL;
614 608
@@ -625,8 +619,9 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
625 struct sock *sk = sock->sk; 619 struct sock *sk = sock->sk;
626 struct sockaddr_pppox *sp = (struct sockaddr_pppox *)uservaddr; 620 struct sockaddr_pppox *sp = (struct sockaddr_pppox *)uservaddr;
627 struct pppox_sock *po = pppox_sk(sk); 621 struct pppox_sock *po = pppox_sk(sk);
628 struct net_device *dev; 622 struct net_device *dev = NULL;
629 struct pppoe_net *pn; 623 struct pppoe_net *pn;
624 struct net *net = NULL;
630 int error; 625 int error;
631 626
632 lock_sock(sk); 627 lock_sock(sk);
@@ -652,12 +647,14 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
652 /* Delete the old binding */ 647 /* Delete the old binding */
653 if (stage_session(po->pppoe_pa.sid)) { 648 if (stage_session(po->pppoe_pa.sid)) {
654 pppox_unbind_sock(sk); 649 pppox_unbind_sock(sk);
650 pn = pppoe_pernet(sock_net(sk));
651 delete_item(pn, po->pppoe_pa.sid,
652 po->pppoe_pa.remote, po->pppoe_ifindex);
655 if (po->pppoe_dev) { 653 if (po->pppoe_dev) {
656 pn = pppoe_pernet(dev_net(po->pppoe_dev));
657 delete_item(pn, po->pppoe_pa.sid,
658 po->pppoe_pa.remote, po->pppoe_ifindex);
659 dev_put(po->pppoe_dev); 654 dev_put(po->pppoe_dev);
655 po->pppoe_dev = NULL;
660 } 656 }
657
661 memset(sk_pppox(po) + 1, 0, 658 memset(sk_pppox(po) + 1, 0,
662 sizeof(struct pppox_sock) - sizeof(struct sock)); 659 sizeof(struct pppox_sock) - sizeof(struct sock));
663 sk->sk_state = PPPOX_NONE; 660 sk->sk_state = PPPOX_NONE;
@@ -666,16 +663,15 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
666 /* Re-bind in session stage only */ 663 /* Re-bind in session stage only */
667 if (stage_session(sp->sa_addr.pppoe.sid)) { 664 if (stage_session(sp->sa_addr.pppoe.sid)) {
668 error = -ENODEV; 665 error = -ENODEV;
669 dev = dev_get_by_name(sock_net(sk), sp->sa_addr.pppoe.dev); 666 net = sock_net(sk);
667 dev = dev_get_by_name(net, sp->sa_addr.pppoe.dev);
670 if (!dev) 668 if (!dev)
671 goto end; 669 goto err_put;
672 670
673 po->pppoe_dev = dev; 671 po->pppoe_dev = dev;
674 po->pppoe_ifindex = dev->ifindex; 672 po->pppoe_ifindex = dev->ifindex;
675 pn = pppoe_pernet(dev_net(dev)); 673 pn = pppoe_pernet(net);
676 write_lock_bh(&pn->hash_lock);
677 if (!(dev->flags & IFF_UP)) { 674 if (!(dev->flags & IFF_UP)) {
678 write_unlock_bh(&pn->hash_lock);
679 goto err_put; 675 goto err_put;
680 } 676 }
681 677
@@ -683,6 +679,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
683 &sp->sa_addr.pppoe, 679 &sp->sa_addr.pppoe,
684 sizeof(struct pppoe_addr)); 680 sizeof(struct pppoe_addr));
685 681
682 write_lock_bh(&pn->hash_lock);
686 error = __set_item(pn, po); 683 error = __set_item(pn, po);
687 write_unlock_bh(&pn->hash_lock); 684 write_unlock_bh(&pn->hash_lock);
688 if (error < 0) 685 if (error < 0)
@@ -696,8 +693,11 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
696 po->chan.ops = &pppoe_chan_ops; 693 po->chan.ops = &pppoe_chan_ops;
697 694
698 error = ppp_register_net_channel(dev_net(dev), &po->chan); 695 error = ppp_register_net_channel(dev_net(dev), &po->chan);
699 if (error) 696 if (error) {
697 delete_item(pn, po->pppoe_pa.sid,
698 po->pppoe_pa.remote, po->pppoe_ifindex);
700 goto err_put; 699 goto err_put;
700 }
701 701
702 sk->sk_state = PPPOX_CONNECTED; 702 sk->sk_state = PPPOX_CONNECTED;
703 } 703 }
@@ -915,6 +915,14 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
915 struct pppoe_hdr *ph; 915 struct pppoe_hdr *ph;
916 int data_len = skb->len; 916 int data_len = skb->len;
917 917
918 /* The higher-level PPP code (ppp_unregister_channel()) ensures the PPP
919 * xmit operations conclude prior to an unregistration call. Thus
920 * sk->sk_state cannot change, so we don't need to do lock_sock().
921 * But, we also can't do a lock_sock since that introduces a potential
922 * deadlock as we'd reverse the lock ordering used when calling
923 * ppp_unregister_channel().
924 */
925
918 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) 926 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
919 goto abort; 927 goto abort;
920 928
@@ -944,7 +952,6 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
944 po->pppoe_pa.remote, NULL, data_len); 952 po->pppoe_pa.remote, NULL, data_len);
945 953
946 dev_queue_xmit(skb); 954 dev_queue_xmit(skb);
947
948 return 1; 955 return 1;
949 956
950abort: 957abort:
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index 3ec6e85587a2..c2383adcd527 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -95,6 +95,7 @@ enum {
95 95
96 /* Misc. stuff */ 96 /* Misc. stuff */
97 MAILBOX_COUNT = 16, 97 MAILBOX_COUNT = 16,
98 MAILBOX_TIMEOUT = 5,
98 99
99 PROC_ADDR_RDY = (1 << 31), 100 PROC_ADDR_RDY = (1 << 31),
100 PROC_ADDR_R = (1 << 30), 101 PROC_ADDR_R = (1 << 30),
@@ -803,6 +804,12 @@ enum {
803 MB_CMD_SET_PORT_CFG = 0x00000122, 804 MB_CMD_SET_PORT_CFG = 0x00000122,
804 MB_CMD_GET_PORT_CFG = 0x00000123, 805 MB_CMD_GET_PORT_CFG = 0x00000123,
805 MB_CMD_GET_LINK_STS = 0x00000124, 806 MB_CMD_GET_LINK_STS = 0x00000124,
807 MB_CMD_SET_MGMNT_TFK_CTL = 0x00000160, /* Set Mgmnt Traffic Control */
808 MB_SET_MPI_TFK_STOP = (1 << 0),
809 MB_SET_MPI_TFK_RESUME = (1 << 1),
810 MB_CMD_GET_MGMNT_TFK_CTL = 0x00000161, /* Get Mgmnt Traffic Control */
811 MB_GET_MPI_TFK_STOPPED = (1 << 0),
812 MB_GET_MPI_TFK_FIFO_EMPTY = (1 << 1),
806 813
807 /* Mailbox Command Status. */ 814 /* Mailbox Command Status. */
808 MB_CMD_STS_GOOD = 0x00004000, /* Success. */ 815 MB_CMD_STS_GOOD = 0x00004000, /* Success. */
@@ -1168,7 +1175,7 @@ struct ricb {
1168#define RSS_RI6 0x40 1175#define RSS_RI6 0x40
1169#define RSS_RT6 0x80 1176#define RSS_RT6 0x80
1170 __le16 mask; 1177 __le16 mask;
1171 __le32 hash_cq_id[256]; 1178 u8 hash_cq_id[1024];
1172 __le32 ipv6_hash_key[10]; 1179 __le32 ipv6_hash_key[10];
1173 __le32 ipv4_hash_key[4]; 1180 __le32 ipv4_hash_key[4];
1174} __attribute((packed)); 1181} __attribute((packed));
@@ -1606,6 +1613,8 @@ int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data);
1606int ql_mb_about_fw(struct ql_adapter *qdev); 1613int ql_mb_about_fw(struct ql_adapter *qdev);
1607void ql_link_on(struct ql_adapter *qdev); 1614void ql_link_on(struct ql_adapter *qdev);
1608void ql_link_off(struct ql_adapter *qdev); 1615void ql_link_off(struct ql_adapter *qdev);
1616int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control);
1617int ql_wait_fifo_empty(struct ql_adapter *qdev);
1609 1618
1610#if 1 1619#if 1
1611#define QL_ALL_DUMP 1620#define QL_ALL_DUMP
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 61680715cde0..cea7531f4f40 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -320,6 +320,37 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
320 320
321 switch (type) { 321 switch (type) {
322 case MAC_ADDR_TYPE_MULTI_MAC: 322 case MAC_ADDR_TYPE_MULTI_MAC:
323 {
324 u32 upper = (addr[0] << 8) | addr[1];
325 u32 lower = (addr[2] << 24) | (addr[3] << 16) |
326 (addr[4] << 8) | (addr[5]);
327
328 status =
329 ql_wait_reg_rdy(qdev,
330 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
331 if (status)
332 goto exit;
333 ql_write32(qdev, MAC_ADDR_IDX, (offset++) |
334 (index << MAC_ADDR_IDX_SHIFT) |
335 type | MAC_ADDR_E);
336 ql_write32(qdev, MAC_ADDR_DATA, lower);
337 status =
338 ql_wait_reg_rdy(qdev,
339 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
340 if (status)
341 goto exit;
342 ql_write32(qdev, MAC_ADDR_IDX, (offset++) |
343 (index << MAC_ADDR_IDX_SHIFT) |
344 type | MAC_ADDR_E);
345
346 ql_write32(qdev, MAC_ADDR_DATA, upper);
347 status =
348 ql_wait_reg_rdy(qdev,
349 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
350 if (status)
351 goto exit;
352 break;
353 }
323 case MAC_ADDR_TYPE_CAM_MAC: 354 case MAC_ADDR_TYPE_CAM_MAC:
324 { 355 {
325 u32 cam_output; 356 u32 cam_output;
@@ -365,16 +396,14 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
365 and possibly the function id. Right now we hardcode 396 and possibly the function id. Right now we hardcode
366 the route field to NIC core. 397 the route field to NIC core.
367 */ 398 */
368 if (type == MAC_ADDR_TYPE_CAM_MAC) { 399 cam_output = (CAM_OUT_ROUTE_NIC |
369 cam_output = (CAM_OUT_ROUTE_NIC | 400 (qdev->
370 (qdev-> 401 func << CAM_OUT_FUNC_SHIFT) |
371 func << CAM_OUT_FUNC_SHIFT) | 402 (0 << CAM_OUT_CQ_ID_SHIFT));
372 (0 << CAM_OUT_CQ_ID_SHIFT)); 403 if (qdev->vlgrp)
373 if (qdev->vlgrp) 404 cam_output |= CAM_OUT_RV;
374 cam_output |= CAM_OUT_RV; 405 /* route to NIC core */
375 /* route to NIC core */ 406 ql_write32(qdev, MAC_ADDR_DATA, cam_output);
376 ql_write32(qdev, MAC_ADDR_DATA, cam_output);
377 }
378 break; 407 break;
379 } 408 }
380 case MAC_ADDR_TYPE_VLAN: 409 case MAC_ADDR_TYPE_VLAN:
@@ -546,14 +575,14 @@ static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask,
546 } 575 }
547 case RT_IDX_MCAST: /* Pass up All Multicast frames. */ 576 case RT_IDX_MCAST: /* Pass up All Multicast frames. */
548 { 577 {
549 value = RT_IDX_DST_CAM_Q | /* dest */ 578 value = RT_IDX_DST_DFLT_Q | /* dest */
550 RT_IDX_TYPE_NICQ | /* type */ 579 RT_IDX_TYPE_NICQ | /* type */
551 (RT_IDX_ALLMULTI_SLOT << RT_IDX_IDX_SHIFT);/* index */ 580 (RT_IDX_ALLMULTI_SLOT << RT_IDX_IDX_SHIFT);/* index */
552 break; 581 break;
553 } 582 }
554 case RT_IDX_MCAST_MATCH: /* Pass up matched Multicast frames. */ 583 case RT_IDX_MCAST_MATCH: /* Pass up matched Multicast frames. */
555 { 584 {
556 value = RT_IDX_DST_CAM_Q | /* dest */ 585 value = RT_IDX_DST_DFLT_Q | /* dest */
557 RT_IDX_TYPE_NICQ | /* type */ 586 RT_IDX_TYPE_NICQ | /* type */
558 (RT_IDX_MCAST_MATCH_SLOT << RT_IDX_IDX_SHIFT);/* index */ 587 (RT_IDX_MCAST_MATCH_SLOT << RT_IDX_IDX_SHIFT);/* index */
559 break; 588 break;
@@ -3077,6 +3106,12 @@ err_irq:
3077 3106
3078static int ql_start_rss(struct ql_adapter *qdev) 3107static int ql_start_rss(struct ql_adapter *qdev)
3079{ 3108{
3109 u8 init_hash_seed[] = {0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
3110 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f,
3111 0xb0, 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b,
3112 0x30, 0xb4, 0x77, 0xcb, 0x2d, 0xa3, 0x80,
3113 0x30, 0xf2, 0x0c, 0x6a, 0x42, 0xb7, 0x3b,
3114 0xbe, 0xac, 0x01, 0xfa};
3080 struct ricb *ricb = &qdev->ricb; 3115 struct ricb *ricb = &qdev->ricb;
3081 int status = 0; 3116 int status = 0;
3082 int i; 3117 int i;
@@ -3086,21 +3121,17 @@ static int ql_start_rss(struct ql_adapter *qdev)
3086 3121
3087 ricb->base_cq = RSS_L4K; 3122 ricb->base_cq = RSS_L4K;
3088 ricb->flags = 3123 ricb->flags =
3089 (RSS_L6K | RSS_LI | RSS_LB | RSS_LM | RSS_RI4 | RSS_RI6 | RSS_RT4 | 3124 (RSS_L6K | RSS_LI | RSS_LB | RSS_LM | RSS_RT4 | RSS_RT6);
3090 RSS_RT6); 3125 ricb->mask = cpu_to_le16((u16)(0x3ff));
3091 ricb->mask = cpu_to_le16(qdev->rss_ring_count - 1);
3092 3126
3093 /* 3127 /*
3094 * Fill out the Indirection Table. 3128 * Fill out the Indirection Table.
3095 */ 3129 */
3096 for (i = 0; i < 256; i++) 3130 for (i = 0; i < 1024; i++)
3097 hash_id[i] = i & (qdev->rss_ring_count - 1); 3131 hash_id[i] = (i & (qdev->rss_ring_count - 1));
3098 3132
3099 /* 3133 memcpy((void *)&ricb->ipv6_hash_key[0], init_hash_seed, 40);
3100 * Random values for the IPv6 and IPv4 Hash Keys. 3134 memcpy((void *)&ricb->ipv4_hash_key[0], init_hash_seed, 16);
3101 */
3102 get_random_bytes((void *)&ricb->ipv6_hash_key[0], 40);
3103 get_random_bytes((void *)&ricb->ipv4_hash_key[0], 16);
3104 3135
3105 QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); 3136 QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n");
3106 3137
@@ -3239,6 +3270,13 @@ static int ql_adapter_initialize(struct ql_adapter *qdev)
3239 ql_write32(qdev, SPLT_HDR, SPLT_HDR_EP | 3270 ql_write32(qdev, SPLT_HDR, SPLT_HDR_EP |
3240 min(SMALL_BUFFER_SIZE, MAX_SPLIT_SIZE)); 3271 min(SMALL_BUFFER_SIZE, MAX_SPLIT_SIZE));
3241 3272
3273 /* Set RX packet routing to use port/pci function on which the
3274 * packet arrived on in addition to usual frame routing.
3275 * This is helpful on bonding where both interfaces can have
3276 * the same MAC address.
3277 */
3278 ql_write32(qdev, RST_FO, RST_FO_RR_MASK | RST_FO_RR_RCV_FUNC_CQ);
3279
3242 /* Start up the rx queues. */ 3280 /* Start up the rx queues. */
3243 for (i = 0; i < qdev->rx_ring_count; i++) { 3281 for (i = 0; i < qdev->rx_ring_count; i++) {
3244 status = ql_start_rx_ring(qdev, &qdev->rx_ring[i]); 3282 status = ql_start_rx_ring(qdev, &qdev->rx_ring[i]);
@@ -3311,6 +3349,13 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
3311 3349
3312 end_jiffies = jiffies + 3350 end_jiffies = jiffies +
3313 max((unsigned long)1, usecs_to_jiffies(30)); 3351 max((unsigned long)1, usecs_to_jiffies(30));
3352
3353 /* Stop management traffic. */
3354 ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_STOP);
3355
3356 /* Wait for the NIC and MGMNT FIFOs to empty. */
3357 ql_wait_fifo_empty(qdev);
3358
3314 ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); 3359 ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR);
3315 3360
3316 do { 3361 do {
@@ -3326,6 +3371,8 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
3326 status = -ETIMEDOUT; 3371 status = -ETIMEDOUT;
3327 } 3372 }
3328 3373
3374 /* Resume management traffic. */
3375 ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_RESUME);
3329 return status; 3376 return status;
3330} 3377}
3331 3378
@@ -3704,6 +3751,12 @@ static void ql_asic_reset_work(struct work_struct *work)
3704 status = ql_adapter_up(qdev); 3751 status = ql_adapter_up(qdev);
3705 if (status) 3752 if (status)
3706 goto error; 3753 goto error;
3754
3755 /* Restore rx mode. */
3756 clear_bit(QL_ALLMULTI, &qdev->flags);
3757 clear_bit(QL_PROMISCUOUS, &qdev->flags);
3758 qlge_set_multicast_list(qdev->ndev);
3759
3707 rtnl_unlock(); 3760 rtnl_unlock();
3708 return; 3761 return;
3709error: 3762error:
@@ -3863,6 +3916,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
3863 goto err_out; 3916 goto err_out;
3864 } 3917 }
3865 3918
3919 pci_save_state(pdev);
3866 qdev->reg_base = 3920 qdev->reg_base =
3867 ioremap_nocache(pci_resource_start(pdev, 1), 3921 ioremap_nocache(pci_resource_start(pdev, 1),
3868 pci_resource_len(pdev, 1)); 3922 pci_resource_len(pdev, 1));
@@ -4017,6 +4071,33 @@ static void __devexit qlge_remove(struct pci_dev *pdev)
4017 free_netdev(ndev); 4071 free_netdev(ndev);
4018} 4072}
4019 4073
4074/* Clean up resources without touching hardware. */
4075static void ql_eeh_close(struct net_device *ndev)
4076{
4077 int i;
4078 struct ql_adapter *qdev = netdev_priv(ndev);
4079
4080 if (netif_carrier_ok(ndev)) {
4081 netif_carrier_off(ndev);
4082 netif_stop_queue(ndev);
4083 }
4084
4085 if (test_bit(QL_ADAPTER_UP, &qdev->flags))
4086 cancel_delayed_work_sync(&qdev->asic_reset_work);
4087 cancel_delayed_work_sync(&qdev->mpi_reset_work);
4088 cancel_delayed_work_sync(&qdev->mpi_work);
4089 cancel_delayed_work_sync(&qdev->mpi_idc_work);
4090 cancel_delayed_work_sync(&qdev->mpi_port_cfg_work);
4091
4092 for (i = 0; i < qdev->rss_ring_count; i++)
4093 netif_napi_del(&qdev->rx_ring[i].napi);
4094
4095 clear_bit(QL_ADAPTER_UP, &qdev->flags);
4096 ql_tx_ring_clean(qdev);
4097 ql_free_rx_buffers(qdev);
4098 ql_release_adapter_resources(qdev);
4099}
4100
4020/* 4101/*
4021 * This callback is called by the PCI subsystem whenever 4102 * This callback is called by the PCI subsystem whenever
4022 * a PCI bus error is detected. 4103 * a PCI bus error is detected.
@@ -4025,17 +4106,21 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
4025 enum pci_channel_state state) 4106 enum pci_channel_state state)
4026{ 4107{
4027 struct net_device *ndev = pci_get_drvdata(pdev); 4108 struct net_device *ndev = pci_get_drvdata(pdev);
4028 struct ql_adapter *qdev = netdev_priv(ndev);
4029 4109
4030 netif_device_detach(ndev); 4110 switch (state) {
4031 4111 case pci_channel_io_normal:
4032 if (state == pci_channel_io_perm_failure) 4112 return PCI_ERS_RESULT_CAN_RECOVER;
4113 case pci_channel_io_frozen:
4114 netif_device_detach(ndev);
4115 if (netif_running(ndev))
4116 ql_eeh_close(ndev);
4117 pci_disable_device(pdev);
4118 return PCI_ERS_RESULT_NEED_RESET;
4119 case pci_channel_io_perm_failure:
4120 dev_err(&pdev->dev,
4121 "%s: pci_channel_io_perm_failure.\n", __func__);
4033 return PCI_ERS_RESULT_DISCONNECT; 4122 return PCI_ERS_RESULT_DISCONNECT;
4034 4123 }
4035 if (netif_running(ndev))
4036 ql_adapter_down(qdev);
4037
4038 pci_disable_device(pdev);
4039 4124
4040 /* Request a slot reset. */ 4125 /* Request a slot reset. */
4041 return PCI_ERS_RESULT_NEED_RESET; 4126 return PCI_ERS_RESULT_NEED_RESET;
@@ -4052,25 +4137,15 @@ static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev)
4052 struct net_device *ndev = pci_get_drvdata(pdev); 4137 struct net_device *ndev = pci_get_drvdata(pdev);
4053 struct ql_adapter *qdev = netdev_priv(ndev); 4138 struct ql_adapter *qdev = netdev_priv(ndev);
4054 4139
4140 pdev->error_state = pci_channel_io_normal;
4141
4142 pci_restore_state(pdev);
4055 if (pci_enable_device(pdev)) { 4143 if (pci_enable_device(pdev)) {
4056 QPRINTK(qdev, IFUP, ERR, 4144 QPRINTK(qdev, IFUP, ERR,
4057 "Cannot re-enable PCI device after reset.\n"); 4145 "Cannot re-enable PCI device after reset.\n");
4058 return PCI_ERS_RESULT_DISCONNECT; 4146 return PCI_ERS_RESULT_DISCONNECT;
4059 } 4147 }
4060
4061 pci_set_master(pdev); 4148 pci_set_master(pdev);
4062
4063 netif_carrier_off(ndev);
4064 ql_adapter_reset(qdev);
4065
4066 /* Make sure the EEPROM is good */
4067 memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
4068
4069 if (!is_valid_ether_addr(ndev->perm_addr)) {
4070 QPRINTK(qdev, IFUP, ERR, "After reset, invalid MAC address.\n");
4071 return PCI_ERS_RESULT_DISCONNECT;
4072 }
4073
4074 return PCI_ERS_RESULT_RECOVERED; 4149 return PCI_ERS_RESULT_RECOVERED;
4075} 4150}
4076 4151
@@ -4078,17 +4153,21 @@ static void qlge_io_resume(struct pci_dev *pdev)
4078{ 4153{
4079 struct net_device *ndev = pci_get_drvdata(pdev); 4154 struct net_device *ndev = pci_get_drvdata(pdev);
4080 struct ql_adapter *qdev = netdev_priv(ndev); 4155 struct ql_adapter *qdev = netdev_priv(ndev);
4156 int err = 0;
4081 4157
4082 pci_set_master(pdev); 4158 if (ql_adapter_reset(qdev))
4083 4159 QPRINTK(qdev, DRV, ERR, "reset FAILED!\n");
4084 if (netif_running(ndev)) { 4160 if (netif_running(ndev)) {
4085 if (ql_adapter_up(qdev)) { 4161 err = qlge_open(ndev);
4162 if (err) {
4086 QPRINTK(qdev, IFUP, ERR, 4163 QPRINTK(qdev, IFUP, ERR,
4087 "Device initialization failed after reset.\n"); 4164 "Device initialization failed after reset.\n");
4088 return; 4165 return;
4089 } 4166 }
4167 } else {
4168 QPRINTK(qdev, IFUP, ERR,
4169 "Device was not running prior to EEH.\n");
4090 } 4170 }
4091
4092 netif_device_attach(ndev); 4171 netif_device_attach(ndev);
4093} 4172}
4094 4173
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c
index c2e43073047e..bcf13c96f73f 100644
--- a/drivers/net/qlge/qlge_mpi.c
+++ b/drivers/net/qlge/qlge_mpi.c
@@ -470,7 +470,8 @@ end:
470 */ 470 */
471static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) 471static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
472{ 472{
473 int status, count; 473 int status;
474 unsigned long count;
474 475
475 476
476 /* Begin polled mode for MPI */ 477 /* Begin polled mode for MPI */
@@ -491,9 +492,9 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
491 /* Wait for the command to complete. We loop 492 /* Wait for the command to complete. We loop
492 * here because some AEN might arrive while 493 * here because some AEN might arrive while
493 * we're waiting for the mailbox command to 494 * we're waiting for the mailbox command to
494 * complete. If more than 5 arrive then we can 495 * complete. If more than 5 seconds expire we can
495 * assume something is wrong. */ 496 * assume something is wrong. */
496 count = 5; 497 count = jiffies + HZ * MAILBOX_TIMEOUT;
497 do { 498 do {
498 /* Wait for the interrupt to come in. */ 499 /* Wait for the interrupt to come in. */
499 status = ql_wait_mbx_cmd_cmplt(qdev); 500 status = ql_wait_mbx_cmd_cmplt(qdev);
@@ -517,15 +518,15 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
517 MB_CMD_STS_GOOD) || 518 MB_CMD_STS_GOOD) ||
518 ((mbcp->mbox_out[0] & 0x0000f000) == 519 ((mbcp->mbox_out[0] & 0x0000f000) ==
519 MB_CMD_STS_INTRMDT)) 520 MB_CMD_STS_INTRMDT))
520 break; 521 goto done;
521 } while (--count); 522 } while (time_before(jiffies, count));
522 523
523 if (!count) { 524 QPRINTK(qdev, DRV, ERR,
524 QPRINTK(qdev, DRV, ERR, 525 "Timed out waiting for mailbox complete.\n");
525 "Timed out waiting for mailbox complete.\n"); 526 status = -ETIMEDOUT;
526 status = -ETIMEDOUT; 527 goto end;
527 goto end; 528
528 } 529done:
529 530
530 /* Now we can clear the interrupt condition 531 /* Now we can clear the interrupt condition
531 * and look at our status. 532 * and look at our status.
@@ -768,6 +769,95 @@ static int ql_idc_wait(struct ql_adapter *qdev)
768 return status; 769 return status;
769} 770}
770 771
772int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control)
773{
774 struct mbox_params mbc;
775 struct mbox_params *mbcp = &mbc;
776 int status;
777
778 memset(mbcp, 0, sizeof(struct mbox_params));
779
780 mbcp->in_count = 1;
781 mbcp->out_count = 2;
782
783 mbcp->mbox_in[0] = MB_CMD_SET_MGMNT_TFK_CTL;
784 mbcp->mbox_in[1] = control;
785
786 status = ql_mailbox_command(qdev, mbcp);
787 if (status)
788 return status;
789
790 if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD)
791 return status;
792
793 if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) {
794 QPRINTK(qdev, DRV, ERR,
795 "Command not supported by firmware.\n");
796 status = -EINVAL;
797 } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) {
798 /* This indicates that the firmware is
799 * already in the state we are trying to
800 * change it to.
801 */
802 QPRINTK(qdev, DRV, ERR,
803 "Command parameters make no change.\n");
804 }
805 return status;
806}
807
808/* Returns a negative error code or the mailbox command status. */
809static int ql_mb_get_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 *control)
810{
811 struct mbox_params mbc;
812 struct mbox_params *mbcp = &mbc;
813 int status;
814
815 memset(mbcp, 0, sizeof(struct mbox_params));
816 *control = 0;
817
818 mbcp->in_count = 1;
819 mbcp->out_count = 1;
820
821 mbcp->mbox_in[0] = MB_CMD_GET_MGMNT_TFK_CTL;
822
823 status = ql_mailbox_command(qdev, mbcp);
824 if (status)
825 return status;
826
827 if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD) {
828 *control = mbcp->mbox_in[1];
829 return status;
830 }
831
832 if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) {
833 QPRINTK(qdev, DRV, ERR,
834 "Command not supported by firmware.\n");
835 status = -EINVAL;
836 } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) {
837 QPRINTK(qdev, DRV, ERR,
838 "Failed to get MPI traffic control.\n");
839 status = -EIO;
840 }
841 return status;
842}
843
844int ql_wait_fifo_empty(struct ql_adapter *qdev)
845{
846 int count = 5;
847 u32 mgmnt_fifo_empty;
848 u32 nic_fifo_empty;
849
850 do {
851 nic_fifo_empty = ql_read32(qdev, STS) & STS_NFE;
852 ql_mb_get_mgmnt_traffic_ctl(qdev, &mgmnt_fifo_empty);
853 mgmnt_fifo_empty &= MB_GET_MPI_TFK_FIFO_EMPTY;
854 if (nic_fifo_empty && mgmnt_fifo_empty)
855 return 0;
856 msleep(100);
857 } while (count-- > 0);
858 return -ETIMEDOUT;
859}
860
771/* API called in work thread context to set new TX/RX 861/* API called in work thread context to set new TX/RX
772 * maximum frame size values to match MTU. 862 * maximum frame size values to match MTU.
773 */ 863 */
@@ -876,6 +966,8 @@ void ql_mpi_work(struct work_struct *work)
876 int err = 0; 966 int err = 0;
877 967
878 rtnl_lock(); 968 rtnl_lock();
969 /* Begin polled mode for MPI */
970 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16));
879 971
880 while (ql_read32(qdev, STS) & STS_PI) { 972 while (ql_read32(qdev, STS) & STS_PI) {
881 memset(mbcp, 0, sizeof(struct mbox_params)); 973 memset(mbcp, 0, sizeof(struct mbox_params));
@@ -888,6 +980,8 @@ void ql_mpi_work(struct work_struct *work)
888 break; 980 break;
889 } 981 }
890 982
983 /* End polled mode for MPI */
984 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI);
891 rtnl_unlock(); 985 rtnl_unlock();
892 ql_enable_completion_interrupt(qdev, 0); 986 ql_enable_completion_interrupt(qdev, 0);
893} 987}
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 50c6a3cfe439..fa4935678488 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -115,7 +115,9 @@ enum mac_version {
115 RTL_GIGA_MAC_VER_22 = 0x16, // 8168C 115 RTL_GIGA_MAC_VER_22 = 0x16, // 8168C
116 RTL_GIGA_MAC_VER_23 = 0x17, // 8168CP 116 RTL_GIGA_MAC_VER_23 = 0x17, // 8168CP
117 RTL_GIGA_MAC_VER_24 = 0x18, // 8168CP 117 RTL_GIGA_MAC_VER_24 = 0x18, // 8168CP
118 RTL_GIGA_MAC_VER_25 = 0x19 // 8168D 118 RTL_GIGA_MAC_VER_25 = 0x19, // 8168D
119 RTL_GIGA_MAC_VER_26 = 0x1a, // 8168D
120 RTL_GIGA_MAC_VER_27 = 0x1b // 8168DP
119}; 121};
120 122
121#define _R(NAME,MAC,MASK) \ 123#define _R(NAME,MAC,MASK) \
@@ -150,7 +152,9 @@ static const struct {
150 _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_22, 0xff7e1880), // PCI-E 152 _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_22, 0xff7e1880), // PCI-E
151 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_23, 0xff7e1880), // PCI-E 153 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_23, 0xff7e1880), // PCI-E
152 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_24, 0xff7e1880), // PCI-E 154 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_24, 0xff7e1880), // PCI-E
153 _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_25, 0xff7e1880) // PCI-E 155 _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_25, 0xff7e1880), // PCI-E
156 _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_26, 0xff7e1880), // PCI-E
157 _R("RTL8168dp/8111dp", RTL_GIGA_MAC_VER_27, 0xff7e1880) // PCI-E
154}; 158};
155#undef _R 159#undef _R
156 160
@@ -253,6 +257,13 @@ enum rtl8168_8101_registers {
253 DBG_REG = 0xd1, 257 DBG_REG = 0xd1,
254#define FIX_NAK_1 (1 << 4) 258#define FIX_NAK_1 (1 << 4)
255#define FIX_NAK_2 (1 << 3) 259#define FIX_NAK_2 (1 << 3)
260 EFUSEAR = 0xdc,
261#define EFUSEAR_FLAG 0x80000000
262#define EFUSEAR_WRITE_CMD 0x80000000
263#define EFUSEAR_READ_CMD 0x00000000
264#define EFUSEAR_REG_MASK 0x03ff
265#define EFUSEAR_REG_SHIFT 8
266#define EFUSEAR_DATA_MASK 0xff
256}; 267};
257 268
258enum rtl_register_content { 269enum rtl_register_content {
@@ -568,6 +579,14 @@ static void mdio_patch(void __iomem *ioaddr, int reg_addr, int value)
568 mdio_write(ioaddr, reg_addr, mdio_read(ioaddr, reg_addr) | value); 579 mdio_write(ioaddr, reg_addr, mdio_read(ioaddr, reg_addr) | value);
569} 580}
570 581
582static void mdio_plus_minus(void __iomem *ioaddr, int reg_addr, int p, int m)
583{
584 int val;
585
586 val = mdio_read(ioaddr, reg_addr);
587 mdio_write(ioaddr, reg_addr, (val | p) & ~m);
588}
589
571static void rtl_mdio_write(struct net_device *dev, int phy_id, int location, 590static void rtl_mdio_write(struct net_device *dev, int phy_id, int location,
572 int val) 591 int val)
573{ 592{
@@ -651,6 +670,24 @@ static u32 rtl_csi_read(void __iomem *ioaddr, int addr)
651 return value; 670 return value;
652} 671}
653 672
673static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr)
674{
675 u8 value = 0xff;
676 unsigned int i;
677
678 RTL_W32(EFUSEAR, (reg_addr & EFUSEAR_REG_MASK) << EFUSEAR_REG_SHIFT);
679
680 for (i = 0; i < 300; i++) {
681 if (RTL_R32(EFUSEAR) & EFUSEAR_FLAG) {
682 value = RTL_R32(EFUSEAR) & EFUSEAR_DATA_MASK;
683 break;
684 }
685 udelay(100);
686 }
687
688 return value;
689}
690
654static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr) 691static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr)
655{ 692{
656 RTL_W16(IntrMask, 0x0000); 693 RTL_W16(IntrMask, 0x0000);
@@ -992,7 +1029,10 @@ static void rtl8169_vlan_rx_register(struct net_device *dev,
992 1029
993 spin_lock_irqsave(&tp->lock, flags); 1030 spin_lock_irqsave(&tp->lock, flags);
994 tp->vlgrp = grp; 1031 tp->vlgrp = grp;
995 if (tp->vlgrp) 1032 /*
1033 * Do not disable RxVlan on 8110SCd.
1034 */
1035 if (tp->vlgrp || (tp->mac_version == RTL_GIGA_MAC_VER_05))
996 tp->cp_cmd |= RxVlan; 1036 tp->cp_cmd |= RxVlan;
997 else 1037 else
998 tp->cp_cmd &= ~RxVlan; 1038 tp->cp_cmd &= ~RxVlan;
@@ -1243,7 +1283,10 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
1243 int mac_version; 1283 int mac_version;
1244 } mac_info[] = { 1284 } mac_info[] = {
1245 /* 8168D family. */ 1285 /* 8168D family. */
1246 { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_25 }, 1286 { 0x7cf00000, 0x28300000, RTL_GIGA_MAC_VER_26 },
1287 { 0x7cf00000, 0x28100000, RTL_GIGA_MAC_VER_25 },
1288 { 0x7c800000, 0x28800000, RTL_GIGA_MAC_VER_27 },
1289 { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_26 },
1247 1290
1248 /* 8168C family. */ 1291 /* 8168C family. */
1249 { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 }, 1292 { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 },
@@ -1648,74 +1691,903 @@ static void rtl8168c_4_hw_phy_config(void __iomem *ioaddr)
1648 rtl8168c_3_hw_phy_config(ioaddr); 1691 rtl8168c_3_hw_phy_config(ioaddr);
1649} 1692}
1650 1693
1651static void rtl8168d_hw_phy_config(void __iomem *ioaddr) 1694static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
1652{ 1695{
1653 struct phy_reg phy_reg_init_0[] = { 1696 static struct phy_reg phy_reg_init_0[] = {
1654 { 0x1f, 0x0001 }, 1697 { 0x1f, 0x0001 },
1655 { 0x09, 0x2770 }, 1698 { 0x06, 0x4064 },
1656 { 0x08, 0x04d0 }, 1699 { 0x07, 0x2863 },
1657 { 0x0b, 0xad15 }, 1700 { 0x08, 0x059c },
1658 { 0x0c, 0x5bf0 }, 1701 { 0x09, 0x26b4 },
1659 { 0x1c, 0xf101 }, 1702 { 0x0a, 0x6a19 },
1703 { 0x0b, 0xdcc8 },
1704 { 0x10, 0xf06d },
1705 { 0x14, 0x7f68 },
1706 { 0x18, 0x7fd9 },
1707 { 0x1c, 0xf0ff },
1708 { 0x1d, 0x3d9c },
1660 { 0x1f, 0x0003 }, 1709 { 0x1f, 0x0003 },
1661 { 0x14, 0x94d7 }, 1710 { 0x12, 0xf49f },
1662 { 0x12, 0xf4d6 }, 1711 { 0x13, 0x070b },
1663 { 0x09, 0xca0f }, 1712 { 0x1a, 0x05ad },
1664 { 0x1f, 0x0002 }, 1713 { 0x14, 0x94c0 }
1665 { 0x0b, 0x0b10 }, 1714 };
1666 { 0x0c, 0xd1f7 }, 1715 static struct phy_reg phy_reg_init_1[] = {
1667 { 0x1f, 0x0002 },
1668 { 0x06, 0x5461 },
1669 { 0x1f, 0x0002 }, 1716 { 0x1f, 0x0002 },
1670 { 0x05, 0x6662 }, 1717 { 0x06, 0x5561 },
1718 { 0x1f, 0x0005 },
1719 { 0x05, 0x8332 },
1720 { 0x06, 0x5561 }
1721 };
1722 static struct phy_reg phy_reg_init_2[] = {
1723 { 0x1f, 0x0005 },
1724 { 0x05, 0xffc2 },
1725 { 0x1f, 0x0005 },
1726 { 0x05, 0x8000 },
1727 { 0x06, 0xf8f9 },
1728 { 0x06, 0xfaef },
1729 { 0x06, 0x59ee },
1730 { 0x06, 0xf8ea },
1731 { 0x06, 0x00ee },
1732 { 0x06, 0xf8eb },
1733 { 0x06, 0x00e0 },
1734 { 0x06, 0xf87c },
1735 { 0x06, 0xe1f8 },
1736 { 0x06, 0x7d59 },
1737 { 0x06, 0x0fef },
1738 { 0x06, 0x0139 },
1739 { 0x06, 0x029e },
1740 { 0x06, 0x06ef },
1741 { 0x06, 0x1039 },
1742 { 0x06, 0x089f },
1743 { 0x06, 0x2aee },
1744 { 0x06, 0xf8ea },
1745 { 0x06, 0x00ee },
1746 { 0x06, 0xf8eb },
1747 { 0x06, 0x01e0 },
1748 { 0x06, 0xf87c },
1749 { 0x06, 0xe1f8 },
1750 { 0x06, 0x7d58 },
1751 { 0x06, 0x409e },
1752 { 0x06, 0x0f39 },
1753 { 0x06, 0x46aa },
1754 { 0x06, 0x0bbf },
1755 { 0x06, 0x8290 },
1756 { 0x06, 0xd682 },
1757 { 0x06, 0x9802 },
1758 { 0x06, 0x014f },
1759 { 0x06, 0xae09 },
1760 { 0x06, 0xbf82 },
1761 { 0x06, 0x98d6 },
1762 { 0x06, 0x82a0 },
1763 { 0x06, 0x0201 },
1764 { 0x06, 0x4fef },
1765 { 0x06, 0x95fe },
1766 { 0x06, 0xfdfc },
1767 { 0x06, 0x05f8 },
1768 { 0x06, 0xf9fa },
1769 { 0x06, 0xeef8 },
1770 { 0x06, 0xea00 },
1771 { 0x06, 0xeef8 },
1772 { 0x06, 0xeb00 },
1773 { 0x06, 0xe2f8 },
1774 { 0x06, 0x7ce3 },
1775 { 0x06, 0xf87d },
1776 { 0x06, 0xa511 },
1777 { 0x06, 0x1112 },
1778 { 0x06, 0xd240 },
1779 { 0x06, 0xd644 },
1780 { 0x06, 0x4402 },
1781 { 0x06, 0x8217 },
1782 { 0x06, 0xd2a0 },
1783 { 0x06, 0xd6aa },
1784 { 0x06, 0xaa02 },
1785 { 0x06, 0x8217 },
1786 { 0x06, 0xae0f },
1787 { 0x06, 0xa544 },
1788 { 0x06, 0x4402 },
1789 { 0x06, 0xae4d },
1790 { 0x06, 0xa5aa },
1791 { 0x06, 0xaa02 },
1792 { 0x06, 0xae47 },
1793 { 0x06, 0xaf82 },
1794 { 0x06, 0x13ee },
1795 { 0x06, 0x834e },
1796 { 0x06, 0x00ee },
1797 { 0x06, 0x834d },
1798 { 0x06, 0x0fee },
1799 { 0x06, 0x834c },
1800 { 0x06, 0x0fee },
1801 { 0x06, 0x834f },
1802 { 0x06, 0x00ee },
1803 { 0x06, 0x8351 },
1804 { 0x06, 0x00ee },
1805 { 0x06, 0x834a },
1806 { 0x06, 0xffee },
1807 { 0x06, 0x834b },
1808 { 0x06, 0xffe0 },
1809 { 0x06, 0x8330 },
1810 { 0x06, 0xe183 },
1811 { 0x06, 0x3158 },
1812 { 0x06, 0xfee4 },
1813 { 0x06, 0xf88a },
1814 { 0x06, 0xe5f8 },
1815 { 0x06, 0x8be0 },
1816 { 0x06, 0x8332 },
1817 { 0x06, 0xe183 },
1818 { 0x06, 0x3359 },
1819 { 0x06, 0x0fe2 },
1820 { 0x06, 0x834d },
1821 { 0x06, 0x0c24 },
1822 { 0x06, 0x5af0 },
1823 { 0x06, 0x1e12 },
1824 { 0x06, 0xe4f8 },
1825 { 0x06, 0x8ce5 },
1826 { 0x06, 0xf88d },
1827 { 0x06, 0xaf82 },
1828 { 0x06, 0x13e0 },
1829 { 0x06, 0x834f },
1830 { 0x06, 0x10e4 },
1831 { 0x06, 0x834f },
1832 { 0x06, 0xe083 },
1833 { 0x06, 0x4e78 },
1834 { 0x06, 0x009f },
1835 { 0x06, 0x0ae0 },
1836 { 0x06, 0x834f },
1837 { 0x06, 0xa010 },
1838 { 0x06, 0xa5ee },
1839 { 0x06, 0x834e },
1840 { 0x06, 0x01e0 },
1841 { 0x06, 0x834e },
1842 { 0x06, 0x7805 },
1843 { 0x06, 0x9e9a },
1844 { 0x06, 0xe083 },
1845 { 0x06, 0x4e78 },
1846 { 0x06, 0x049e },
1847 { 0x06, 0x10e0 },
1848 { 0x06, 0x834e },
1849 { 0x06, 0x7803 },
1850 { 0x06, 0x9e0f },
1851 { 0x06, 0xe083 },
1852 { 0x06, 0x4e78 },
1853 { 0x06, 0x019e },
1854 { 0x06, 0x05ae },
1855 { 0x06, 0x0caf },
1856 { 0x06, 0x81f8 },
1857 { 0x06, 0xaf81 },
1858 { 0x06, 0xa3af },
1859 { 0x06, 0x81dc },
1860 { 0x06, 0xaf82 },
1861 { 0x06, 0x13ee },
1862 { 0x06, 0x8348 },
1863 { 0x06, 0x00ee },
1864 { 0x06, 0x8349 },
1865 { 0x06, 0x00e0 },
1866 { 0x06, 0x8351 },
1867 { 0x06, 0x10e4 },
1868 { 0x06, 0x8351 },
1869 { 0x06, 0x5801 },
1870 { 0x06, 0x9fea },
1871 { 0x06, 0xd000 },
1872 { 0x06, 0xd180 },
1873 { 0x06, 0x1f66 },
1874 { 0x06, 0xe2f8 },
1875 { 0x06, 0xeae3 },
1876 { 0x06, 0xf8eb },
1877 { 0x06, 0x5af8 },
1878 { 0x06, 0x1e20 },
1879 { 0x06, 0xe6f8 },
1880 { 0x06, 0xeae5 },
1881 { 0x06, 0xf8eb },
1882 { 0x06, 0xd302 },
1883 { 0x06, 0xb3fe },
1884 { 0x06, 0xe2f8 },
1885 { 0x06, 0x7cef },
1886 { 0x06, 0x325b },
1887 { 0x06, 0x80e3 },
1888 { 0x06, 0xf87d },
1889 { 0x06, 0x9e03 },
1890 { 0x06, 0x7dff },
1891 { 0x06, 0xff0d },
1892 { 0x06, 0x581c },
1893 { 0x06, 0x551a },
1894 { 0x06, 0x6511 },
1895 { 0x06, 0xa190 },
1896 { 0x06, 0xd3e2 },
1897 { 0x06, 0x8348 },
1898 { 0x06, 0xe383 },
1899 { 0x06, 0x491b },
1900 { 0x06, 0x56ab },
1901 { 0x06, 0x08ef },
1902 { 0x06, 0x56e6 },
1903 { 0x06, 0x8348 },
1904 { 0x06, 0xe783 },
1905 { 0x06, 0x4910 },
1906 { 0x06, 0xd180 },
1907 { 0x06, 0x1f66 },
1908 { 0x06, 0xa004 },
1909 { 0x06, 0xb9e2 },
1910 { 0x06, 0x8348 },
1911 { 0x06, 0xe383 },
1912 { 0x06, 0x49ef },
1913 { 0x06, 0x65e2 },
1914 { 0x06, 0x834a },
1915 { 0x06, 0xe383 },
1916 { 0x06, 0x4b1b },
1917 { 0x06, 0x56aa },
1918 { 0x06, 0x0eef },
1919 { 0x06, 0x56e6 },
1920 { 0x06, 0x834a },
1921 { 0x06, 0xe783 },
1922 { 0x06, 0x4be2 },
1923 { 0x06, 0x834d },
1924 { 0x06, 0xe683 },
1925 { 0x06, 0x4ce0 },
1926 { 0x06, 0x834d },
1927 { 0x06, 0xa000 },
1928 { 0x06, 0x0caf },
1929 { 0x06, 0x81dc },
1930 { 0x06, 0xe083 },
1931 { 0x06, 0x4d10 },
1932 { 0x06, 0xe483 },
1933 { 0x06, 0x4dae },
1934 { 0x06, 0x0480 },
1935 { 0x06, 0xe483 },
1936 { 0x06, 0x4de0 },
1937 { 0x06, 0x834e },
1938 { 0x06, 0x7803 },
1939 { 0x06, 0x9e0b },
1940 { 0x06, 0xe083 },
1941 { 0x06, 0x4e78 },
1942 { 0x06, 0x049e },
1943 { 0x06, 0x04ee },
1944 { 0x06, 0x834e },
1945 { 0x06, 0x02e0 },
1946 { 0x06, 0x8332 },
1947 { 0x06, 0xe183 },
1948 { 0x06, 0x3359 },
1949 { 0x06, 0x0fe2 },
1950 { 0x06, 0x834d },
1951 { 0x06, 0x0c24 },
1952 { 0x06, 0x5af0 },
1953 { 0x06, 0x1e12 },
1954 { 0x06, 0xe4f8 },
1955 { 0x06, 0x8ce5 },
1956 { 0x06, 0xf88d },
1957 { 0x06, 0xe083 },
1958 { 0x06, 0x30e1 },
1959 { 0x06, 0x8331 },
1960 { 0x06, 0x6801 },
1961 { 0x06, 0xe4f8 },
1962 { 0x06, 0x8ae5 },
1963 { 0x06, 0xf88b },
1964 { 0x06, 0xae37 },
1965 { 0x06, 0xee83 },
1966 { 0x06, 0x4e03 },
1967 { 0x06, 0xe083 },
1968 { 0x06, 0x4ce1 },
1969 { 0x06, 0x834d },
1970 { 0x06, 0x1b01 },
1971 { 0x06, 0x9e04 },
1972 { 0x06, 0xaaa1 },
1973 { 0x06, 0xaea8 },
1974 { 0x06, 0xee83 },
1975 { 0x06, 0x4e04 },
1976 { 0x06, 0xee83 },
1977 { 0x06, 0x4f00 },
1978 { 0x06, 0xaeab },
1979 { 0x06, 0xe083 },
1980 { 0x06, 0x4f78 },
1981 { 0x06, 0x039f },
1982 { 0x06, 0x14ee },
1983 { 0x06, 0x834e },
1984 { 0x06, 0x05d2 },
1985 { 0x06, 0x40d6 },
1986 { 0x06, 0x5554 },
1987 { 0x06, 0x0282 },
1988 { 0x06, 0x17d2 },
1989 { 0x06, 0xa0d6 },
1990 { 0x06, 0xba00 },
1991 { 0x06, 0x0282 },
1992 { 0x06, 0x17fe },
1993 { 0x06, 0xfdfc },
1994 { 0x06, 0x05f8 },
1995 { 0x06, 0xe0f8 },
1996 { 0x06, 0x60e1 },
1997 { 0x06, 0xf861 },
1998 { 0x06, 0x6802 },
1999 { 0x06, 0xe4f8 },
2000 { 0x06, 0x60e5 },
2001 { 0x06, 0xf861 },
2002 { 0x06, 0xe0f8 },
2003 { 0x06, 0x48e1 },
2004 { 0x06, 0xf849 },
2005 { 0x06, 0x580f },
2006 { 0x06, 0x1e02 },
2007 { 0x06, 0xe4f8 },
2008 { 0x06, 0x48e5 },
2009 { 0x06, 0xf849 },
2010 { 0x06, 0xd000 },
2011 { 0x06, 0x0282 },
2012 { 0x06, 0x5bbf },
2013 { 0x06, 0x8350 },
2014 { 0x06, 0xef46 },
2015 { 0x06, 0xdc19 },
2016 { 0x06, 0xddd0 },
2017 { 0x06, 0x0102 },
2018 { 0x06, 0x825b },
2019 { 0x06, 0x0282 },
2020 { 0x06, 0x77e0 },
2021 { 0x06, 0xf860 },
2022 { 0x06, 0xe1f8 },
2023 { 0x06, 0x6158 },
2024 { 0x06, 0xfde4 },
2025 { 0x06, 0xf860 },
2026 { 0x06, 0xe5f8 },
2027 { 0x06, 0x61fc },
2028 { 0x06, 0x04f9 },
2029 { 0x06, 0xfafb },
2030 { 0x06, 0xc6bf },
2031 { 0x06, 0xf840 },
2032 { 0x06, 0xbe83 },
2033 { 0x06, 0x50a0 },
2034 { 0x06, 0x0101 },
2035 { 0x06, 0x071b },
2036 { 0x06, 0x89cf },
2037 { 0x06, 0xd208 },
2038 { 0x06, 0xebdb },
2039 { 0x06, 0x19b2 },
2040 { 0x06, 0xfbff },
2041 { 0x06, 0xfefd },
2042 { 0x06, 0x04f8 },
2043 { 0x06, 0xe0f8 },
2044 { 0x06, 0x48e1 },
2045 { 0x06, 0xf849 },
2046 { 0x06, 0x6808 },
2047 { 0x06, 0xe4f8 },
2048 { 0x06, 0x48e5 },
2049 { 0x06, 0xf849 },
2050 { 0x06, 0x58f7 },
2051 { 0x06, 0xe4f8 },
2052 { 0x06, 0x48e5 },
2053 { 0x06, 0xf849 },
2054 { 0x06, 0xfc04 },
2055 { 0x06, 0x4d20 },
2056 { 0x06, 0x0002 },
2057 { 0x06, 0x4e22 },
2058 { 0x06, 0x0002 },
2059 { 0x06, 0x4ddf },
2060 { 0x06, 0xff01 },
2061 { 0x06, 0x4edd },
2062 { 0x06, 0xff01 },
2063 { 0x05, 0x83d4 },
2064 { 0x06, 0x8000 },
2065 { 0x05, 0x83d8 },
2066 { 0x06, 0x8051 },
2067 { 0x02, 0x6010 },
2068 { 0x03, 0xdc00 },
2069 { 0x05, 0xfff6 },
2070 { 0x06, 0x00fc },
1671 { 0x1f, 0x0000 }, 2071 { 0x1f, 0x0000 },
1672 { 0x14, 0x0060 }, 2072
1673 { 0x1f, 0x0000 }, 2073 { 0x1f, 0x0000 },
1674 { 0x0d, 0xf8a0 }, 2074 { 0x0d, 0xf880 },
2075 { 0x1f, 0x0000 }
2076 };
2077
2078 rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
2079
2080 mdio_write(ioaddr, 0x1f, 0x0002);
2081 mdio_plus_minus(ioaddr, 0x0b, 0x0010, 0x00ef);
2082 mdio_plus_minus(ioaddr, 0x0c, 0xa200, 0x5d00);
2083
2084 rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1));
2085
2086 if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) {
2087 struct phy_reg phy_reg_init[] = {
2088 { 0x1f, 0x0002 },
2089 { 0x05, 0x669a },
2090 { 0x1f, 0x0005 },
2091 { 0x05, 0x8330 },
2092 { 0x06, 0x669a },
2093 { 0x1f, 0x0002 }
2094 };
2095 int val;
2096
2097 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
2098
2099 val = mdio_read(ioaddr, 0x0d);
2100
2101 if ((val & 0x00ff) != 0x006c) {
2102 u32 set[] = {
2103 0x0065, 0x0066, 0x0067, 0x0068,
2104 0x0069, 0x006a, 0x006b, 0x006c
2105 };
2106 int i;
2107
2108 mdio_write(ioaddr, 0x1f, 0x0002);
2109
2110 val &= 0xff00;
2111 for (i = 0; i < ARRAY_SIZE(set); i++)
2112 mdio_write(ioaddr, 0x0d, val | set[i]);
2113 }
2114 } else {
2115 struct phy_reg phy_reg_init[] = {
2116 { 0x1f, 0x0002 },
2117 { 0x05, 0x6662 },
2118 { 0x1f, 0x0005 },
2119 { 0x05, 0x8330 },
2120 { 0x06, 0x6662 }
2121 };
2122
2123 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
2124 }
2125
2126 mdio_write(ioaddr, 0x1f, 0x0002);
2127 mdio_patch(ioaddr, 0x0d, 0x0300);
2128 mdio_patch(ioaddr, 0x0f, 0x0010);
2129
2130 mdio_write(ioaddr, 0x1f, 0x0002);
2131 mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600);
2132 mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000);
2133
2134 rtl_phy_write(ioaddr, phy_reg_init_2, ARRAY_SIZE(phy_reg_init_2));
2135}
2136
2137static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
2138{
2139 static struct phy_reg phy_reg_init_0[] = {
2140 { 0x1f, 0x0001 },
2141 { 0x06, 0x4064 },
2142 { 0x07, 0x2863 },
2143 { 0x08, 0x059c },
2144 { 0x09, 0x26b4 },
2145 { 0x0a, 0x6a19 },
2146 { 0x0b, 0xdcc8 },
2147 { 0x10, 0xf06d },
2148 { 0x14, 0x7f68 },
2149 { 0x18, 0x7fd9 },
2150 { 0x1c, 0xf0ff },
2151 { 0x1d, 0x3d9c },
2152 { 0x1f, 0x0003 },
2153 { 0x12, 0xf49f },
2154 { 0x13, 0x070b },
2155 { 0x1a, 0x05ad },
2156 { 0x14, 0x94c0 },
2157
2158 { 0x1f, 0x0002 },
2159 { 0x06, 0x5561 },
1675 { 0x1f, 0x0005 }, 2160 { 0x1f, 0x0005 },
1676 { 0x05, 0xffc2 } 2161 { 0x05, 0x8332 },
2162 { 0x06, 0x5561 }
2163 };
2164 static struct phy_reg phy_reg_init_1[] = {
2165 { 0x1f, 0x0005 },
2166 { 0x05, 0xffc2 },
2167 { 0x1f, 0x0005 },
2168 { 0x05, 0x8000 },
2169 { 0x06, 0xf8f9 },
2170 { 0x06, 0xfaee },
2171 { 0x06, 0xf8ea },
2172 { 0x06, 0x00ee },
2173 { 0x06, 0xf8eb },
2174 { 0x06, 0x00e2 },
2175 { 0x06, 0xf87c },
2176 { 0x06, 0xe3f8 },
2177 { 0x06, 0x7da5 },
2178 { 0x06, 0x1111 },
2179 { 0x06, 0x12d2 },
2180 { 0x06, 0x40d6 },
2181 { 0x06, 0x4444 },
2182 { 0x06, 0x0281 },
2183 { 0x06, 0xc6d2 },
2184 { 0x06, 0xa0d6 },
2185 { 0x06, 0xaaaa },
2186 { 0x06, 0x0281 },
2187 { 0x06, 0xc6ae },
2188 { 0x06, 0x0fa5 },
2189 { 0x06, 0x4444 },
2190 { 0x06, 0x02ae },
2191 { 0x06, 0x4da5 },
2192 { 0x06, 0xaaaa },
2193 { 0x06, 0x02ae },
2194 { 0x06, 0x47af },
2195 { 0x06, 0x81c2 },
2196 { 0x06, 0xee83 },
2197 { 0x06, 0x4e00 },
2198 { 0x06, 0xee83 },
2199 { 0x06, 0x4d0f },
2200 { 0x06, 0xee83 },
2201 { 0x06, 0x4c0f },
2202 { 0x06, 0xee83 },
2203 { 0x06, 0x4f00 },
2204 { 0x06, 0xee83 },
2205 { 0x06, 0x5100 },
2206 { 0x06, 0xee83 },
2207 { 0x06, 0x4aff },
2208 { 0x06, 0xee83 },
2209 { 0x06, 0x4bff },
2210 { 0x06, 0xe083 },
2211 { 0x06, 0x30e1 },
2212 { 0x06, 0x8331 },
2213 { 0x06, 0x58fe },
2214 { 0x06, 0xe4f8 },
2215 { 0x06, 0x8ae5 },
2216 { 0x06, 0xf88b },
2217 { 0x06, 0xe083 },
2218 { 0x06, 0x32e1 },
2219 { 0x06, 0x8333 },
2220 { 0x06, 0x590f },
2221 { 0x06, 0xe283 },
2222 { 0x06, 0x4d0c },
2223 { 0x06, 0x245a },
2224 { 0x06, 0xf01e },
2225 { 0x06, 0x12e4 },
2226 { 0x06, 0xf88c },
2227 { 0x06, 0xe5f8 },
2228 { 0x06, 0x8daf },
2229 { 0x06, 0x81c2 },
2230 { 0x06, 0xe083 },
2231 { 0x06, 0x4f10 },
2232 { 0x06, 0xe483 },
2233 { 0x06, 0x4fe0 },
2234 { 0x06, 0x834e },
2235 { 0x06, 0x7800 },
2236 { 0x06, 0x9f0a },
2237 { 0x06, 0xe083 },
2238 { 0x06, 0x4fa0 },
2239 { 0x06, 0x10a5 },
2240 { 0x06, 0xee83 },
2241 { 0x06, 0x4e01 },
2242 { 0x06, 0xe083 },
2243 { 0x06, 0x4e78 },
2244 { 0x06, 0x059e },
2245 { 0x06, 0x9ae0 },
2246 { 0x06, 0x834e },
2247 { 0x06, 0x7804 },
2248 { 0x06, 0x9e10 },
2249 { 0x06, 0xe083 },
2250 { 0x06, 0x4e78 },
2251 { 0x06, 0x039e },
2252 { 0x06, 0x0fe0 },
2253 { 0x06, 0x834e },
2254 { 0x06, 0x7801 },
2255 { 0x06, 0x9e05 },
2256 { 0x06, 0xae0c },
2257 { 0x06, 0xaf81 },
2258 { 0x06, 0xa7af },
2259 { 0x06, 0x8152 },
2260 { 0x06, 0xaf81 },
2261 { 0x06, 0x8baf },
2262 { 0x06, 0x81c2 },
2263 { 0x06, 0xee83 },
2264 { 0x06, 0x4800 },
2265 { 0x06, 0xee83 },
2266 { 0x06, 0x4900 },
2267 { 0x06, 0xe083 },
2268 { 0x06, 0x5110 },
2269 { 0x06, 0xe483 },
2270 { 0x06, 0x5158 },
2271 { 0x06, 0x019f },
2272 { 0x06, 0xead0 },
2273 { 0x06, 0x00d1 },
2274 { 0x06, 0x801f },
2275 { 0x06, 0x66e2 },
2276 { 0x06, 0xf8ea },
2277 { 0x06, 0xe3f8 },
2278 { 0x06, 0xeb5a },
2279 { 0x06, 0xf81e },
2280 { 0x06, 0x20e6 },
2281 { 0x06, 0xf8ea },
2282 { 0x06, 0xe5f8 },
2283 { 0x06, 0xebd3 },
2284 { 0x06, 0x02b3 },
2285 { 0x06, 0xfee2 },
2286 { 0x06, 0xf87c },
2287 { 0x06, 0xef32 },
2288 { 0x06, 0x5b80 },
2289 { 0x06, 0xe3f8 },
2290 { 0x06, 0x7d9e },
2291 { 0x06, 0x037d },
2292 { 0x06, 0xffff },
2293 { 0x06, 0x0d58 },
2294 { 0x06, 0x1c55 },
2295 { 0x06, 0x1a65 },
2296 { 0x06, 0x11a1 },
2297 { 0x06, 0x90d3 },
2298 { 0x06, 0xe283 },
2299 { 0x06, 0x48e3 },
2300 { 0x06, 0x8349 },
2301 { 0x06, 0x1b56 },
2302 { 0x06, 0xab08 },
2303 { 0x06, 0xef56 },
2304 { 0x06, 0xe683 },
2305 { 0x06, 0x48e7 },
2306 { 0x06, 0x8349 },
2307 { 0x06, 0x10d1 },
2308 { 0x06, 0x801f },
2309 { 0x06, 0x66a0 },
2310 { 0x06, 0x04b9 },
2311 { 0x06, 0xe283 },
2312 { 0x06, 0x48e3 },
2313 { 0x06, 0x8349 },
2314 { 0x06, 0xef65 },
2315 { 0x06, 0xe283 },
2316 { 0x06, 0x4ae3 },
2317 { 0x06, 0x834b },
2318 { 0x06, 0x1b56 },
2319 { 0x06, 0xaa0e },
2320 { 0x06, 0xef56 },
2321 { 0x06, 0xe683 },
2322 { 0x06, 0x4ae7 },
2323 { 0x06, 0x834b },
2324 { 0x06, 0xe283 },
2325 { 0x06, 0x4de6 },
2326 { 0x06, 0x834c },
2327 { 0x06, 0xe083 },
2328 { 0x06, 0x4da0 },
2329 { 0x06, 0x000c },
2330 { 0x06, 0xaf81 },
2331 { 0x06, 0x8be0 },
2332 { 0x06, 0x834d },
2333 { 0x06, 0x10e4 },
2334 { 0x06, 0x834d },
2335 { 0x06, 0xae04 },
2336 { 0x06, 0x80e4 },
2337 { 0x06, 0x834d },
2338 { 0x06, 0xe083 },
2339 { 0x06, 0x4e78 },
2340 { 0x06, 0x039e },
2341 { 0x06, 0x0be0 },
2342 { 0x06, 0x834e },
2343 { 0x06, 0x7804 },
2344 { 0x06, 0x9e04 },
2345 { 0x06, 0xee83 },
2346 { 0x06, 0x4e02 },
2347 { 0x06, 0xe083 },
2348 { 0x06, 0x32e1 },
2349 { 0x06, 0x8333 },
2350 { 0x06, 0x590f },
2351 { 0x06, 0xe283 },
2352 { 0x06, 0x4d0c },
2353 { 0x06, 0x245a },
2354 { 0x06, 0xf01e },
2355 { 0x06, 0x12e4 },
2356 { 0x06, 0xf88c },
2357 { 0x06, 0xe5f8 },
2358 { 0x06, 0x8de0 },
2359 { 0x06, 0x8330 },
2360 { 0x06, 0xe183 },
2361 { 0x06, 0x3168 },
2362 { 0x06, 0x01e4 },
2363 { 0x06, 0xf88a },
2364 { 0x06, 0xe5f8 },
2365 { 0x06, 0x8bae },
2366 { 0x06, 0x37ee },
2367 { 0x06, 0x834e },
2368 { 0x06, 0x03e0 },
2369 { 0x06, 0x834c },
2370 { 0x06, 0xe183 },
2371 { 0x06, 0x4d1b },
2372 { 0x06, 0x019e },
2373 { 0x06, 0x04aa },
2374 { 0x06, 0xa1ae },
2375 { 0x06, 0xa8ee },
2376 { 0x06, 0x834e },
2377 { 0x06, 0x04ee },
2378 { 0x06, 0x834f },
2379 { 0x06, 0x00ae },
2380 { 0x06, 0xabe0 },
2381 { 0x06, 0x834f },
2382 { 0x06, 0x7803 },
2383 { 0x06, 0x9f14 },
2384 { 0x06, 0xee83 },
2385 { 0x06, 0x4e05 },
2386 { 0x06, 0xd240 },
2387 { 0x06, 0xd655 },
2388 { 0x06, 0x5402 },
2389 { 0x06, 0x81c6 },
2390 { 0x06, 0xd2a0 },
2391 { 0x06, 0xd6ba },
2392 { 0x06, 0x0002 },
2393 { 0x06, 0x81c6 },
2394 { 0x06, 0xfefd },
2395 { 0x06, 0xfc05 },
2396 { 0x06, 0xf8e0 },
2397 { 0x06, 0xf860 },
2398 { 0x06, 0xe1f8 },
2399 { 0x06, 0x6168 },
2400 { 0x06, 0x02e4 },
2401 { 0x06, 0xf860 },
2402 { 0x06, 0xe5f8 },
2403 { 0x06, 0x61e0 },
2404 { 0x06, 0xf848 },
2405 { 0x06, 0xe1f8 },
2406 { 0x06, 0x4958 },
2407 { 0x06, 0x0f1e },
2408 { 0x06, 0x02e4 },
2409 { 0x06, 0xf848 },
2410 { 0x06, 0xe5f8 },
2411 { 0x06, 0x49d0 },
2412 { 0x06, 0x0002 },
2413 { 0x06, 0x820a },
2414 { 0x06, 0xbf83 },
2415 { 0x06, 0x50ef },
2416 { 0x06, 0x46dc },
2417 { 0x06, 0x19dd },
2418 { 0x06, 0xd001 },
2419 { 0x06, 0x0282 },
2420 { 0x06, 0x0a02 },
2421 { 0x06, 0x8226 },
2422 { 0x06, 0xe0f8 },
2423 { 0x06, 0x60e1 },
2424 { 0x06, 0xf861 },
2425 { 0x06, 0x58fd },
2426 { 0x06, 0xe4f8 },
2427 { 0x06, 0x60e5 },
2428 { 0x06, 0xf861 },
2429 { 0x06, 0xfc04 },
2430 { 0x06, 0xf9fa },
2431 { 0x06, 0xfbc6 },
2432 { 0x06, 0xbff8 },
2433 { 0x06, 0x40be },
2434 { 0x06, 0x8350 },
2435 { 0x06, 0xa001 },
2436 { 0x06, 0x0107 },
2437 { 0x06, 0x1b89 },
2438 { 0x06, 0xcfd2 },
2439 { 0x06, 0x08eb },
2440 { 0x06, 0xdb19 },
2441 { 0x06, 0xb2fb },
2442 { 0x06, 0xfffe },
2443 { 0x06, 0xfd04 },
2444 { 0x06, 0xf8e0 },
2445 { 0x06, 0xf848 },
2446 { 0x06, 0xe1f8 },
2447 { 0x06, 0x4968 },
2448 { 0x06, 0x08e4 },
2449 { 0x06, 0xf848 },
2450 { 0x06, 0xe5f8 },
2451 { 0x06, 0x4958 },
2452 { 0x06, 0xf7e4 },
2453 { 0x06, 0xf848 },
2454 { 0x06, 0xe5f8 },
2455 { 0x06, 0x49fc },
2456 { 0x06, 0x044d },
2457 { 0x06, 0x2000 },
2458 { 0x06, 0x024e },
2459 { 0x06, 0x2200 },
2460 { 0x06, 0x024d },
2461 { 0x06, 0xdfff },
2462 { 0x06, 0x014e },
2463 { 0x06, 0xddff },
2464 { 0x06, 0x0100 },
2465 { 0x05, 0x83d8 },
2466 { 0x06, 0x8000 },
2467 { 0x03, 0xdc00 },
2468 { 0x05, 0xfff6 },
2469 { 0x06, 0x00fc },
2470 { 0x1f, 0x0000 },
2471
2472 { 0x1f, 0x0000 },
2473 { 0x0d, 0xf880 },
2474 { 0x1f, 0x0000 }
1677 }; 2475 };
1678 2476
1679 rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); 2477 rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
1680 2478
1681 if (mdio_read(ioaddr, 0x06) == 0xc400) { 2479 if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) {
1682 struct phy_reg phy_reg_init_1[] = { 2480 struct phy_reg phy_reg_init[] = {
2481 { 0x1f, 0x0002 },
2482 { 0x05, 0x669a },
1683 { 0x1f, 0x0005 }, 2483 { 0x1f, 0x0005 },
1684 { 0x01, 0x0300 }, 2484 { 0x05, 0x8330 },
1685 { 0x1f, 0x0000 }, 2485 { 0x06, 0x669a },
1686 { 0x11, 0x401c }, 2486
1687 { 0x16, 0x4100 }, 2487 { 0x1f, 0x0002 }
2488 };
2489 int val;
2490
2491 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
2492
2493 val = mdio_read(ioaddr, 0x0d);
2494 if ((val & 0x00ff) != 0x006c) {
2495 u32 set[] = {
2496 0x0065, 0x0066, 0x0067, 0x0068,
2497 0x0069, 0x006a, 0x006b, 0x006c
2498 };
2499 int i;
2500
2501 mdio_write(ioaddr, 0x1f, 0x0002);
2502
2503 val &= 0xff00;
2504 for (i = 0; i < ARRAY_SIZE(set); i++)
2505 mdio_write(ioaddr, 0x0d, val | set[i]);
2506 }
2507 } else {
2508 struct phy_reg phy_reg_init[] = {
2509 { 0x1f, 0x0002 },
2510 { 0x05, 0x2642 },
1688 { 0x1f, 0x0005 }, 2511 { 0x1f, 0x0005 },
1689 { 0x07, 0x0010 }, 2512 { 0x05, 0x8330 },
1690 { 0x05, 0x83dc }, 2513 { 0x06, 0x2642 }
1691 { 0x06, 0x087d },
1692 { 0x05, 0x8300 },
1693 { 0x06, 0x0101 },
1694 { 0x06, 0x05f8 },
1695 { 0x06, 0xf9fa },
1696 { 0x06, 0xfbef },
1697 { 0x06, 0x79e2 },
1698 { 0x06, 0x835f },
1699 { 0x06, 0xe0f8 },
1700 { 0x06, 0x9ae1 },
1701 { 0x06, 0xf89b },
1702 { 0x06, 0xef31 },
1703 { 0x06, 0x3b65 },
1704 { 0x06, 0xaa07 },
1705 { 0x06, 0x81e4 },
1706 { 0x06, 0xf89a },
1707 { 0x06, 0xe5f8 },
1708 { 0x06, 0x9baf },
1709 { 0x06, 0x06ae },
1710 { 0x05, 0x83dc },
1711 { 0x06, 0x8300 },
1712 }; 2514 };
1713 2515
1714 rtl_phy_write(ioaddr, phy_reg_init_1, 2516 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
1715 ARRAY_SIZE(phy_reg_init_1));
1716 } 2517 }
1717 2518
1718 mdio_write(ioaddr, 0x1f, 0x0000); 2519 mdio_write(ioaddr, 0x1f, 0x0002);
2520 mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600);
2521 mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000);
2522
2523 mdio_write(ioaddr, 0x1f, 0x0001);
2524 mdio_write(ioaddr, 0x17, 0x0cc0);
2525
2526 mdio_write(ioaddr, 0x1f, 0x0002);
2527 mdio_patch(ioaddr, 0x0f, 0x0017);
2528
2529 rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1));
2530}
2531
2532static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr)
2533{
2534 struct phy_reg phy_reg_init[] = {
2535 { 0x1f, 0x0002 },
2536 { 0x10, 0x0008 },
2537 { 0x0d, 0x006c },
2538
2539 { 0x1f, 0x0000 },
2540 { 0x0d, 0xf880 },
2541
2542 { 0x1f, 0x0001 },
2543 { 0x17, 0x0cc0 },
2544
2545 { 0x1f, 0x0001 },
2546 { 0x0b, 0xa4d8 },
2547 { 0x09, 0x281c },
2548 { 0x07, 0x2883 },
2549 { 0x0a, 0x6b35 },
2550 { 0x1d, 0x3da4 },
2551 { 0x1c, 0xeffd },
2552 { 0x14, 0x7f52 },
2553 { 0x18, 0x7fc6 },
2554 { 0x08, 0x0601 },
2555 { 0x06, 0x4063 },
2556 { 0x10, 0xf074 },
2557 { 0x1f, 0x0003 },
2558 { 0x13, 0x0789 },
2559 { 0x12, 0xf4bd },
2560 { 0x1a, 0x04fd },
2561 { 0x14, 0x84b0 },
2562 { 0x1f, 0x0000 },
2563 { 0x00, 0x9200 },
2564
2565 { 0x1f, 0x0005 },
2566 { 0x01, 0x0340 },
2567 { 0x1f, 0x0001 },
2568 { 0x04, 0x4000 },
2569 { 0x03, 0x1d21 },
2570 { 0x02, 0x0c32 },
2571 { 0x01, 0x0200 },
2572 { 0x00, 0x5554 },
2573 { 0x04, 0x4800 },
2574 { 0x04, 0x4000 },
2575 { 0x04, 0xf000 },
2576 { 0x03, 0xdf01 },
2577 { 0x02, 0xdf20 },
2578 { 0x01, 0x101a },
2579 { 0x00, 0xa0ff },
2580 { 0x04, 0xf800 },
2581 { 0x04, 0xf000 },
2582 { 0x1f, 0x0000 },
2583
2584 { 0x1f, 0x0007 },
2585 { 0x1e, 0x0023 },
2586 { 0x16, 0x0000 },
2587 { 0x1f, 0x0000 }
2588 };
2589
2590 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
1719} 2591}
1720 2592
1721static void rtl8102e_hw_phy_config(void __iomem *ioaddr) 2593static void rtl8102e_hw_phy_config(void __iomem *ioaddr)
@@ -1792,7 +2664,13 @@ static void rtl_hw_phy_config(struct net_device *dev)
1792 rtl8168cp_2_hw_phy_config(ioaddr); 2664 rtl8168cp_2_hw_phy_config(ioaddr);
1793 break; 2665 break;
1794 case RTL_GIGA_MAC_VER_25: 2666 case RTL_GIGA_MAC_VER_25:
1795 rtl8168d_hw_phy_config(ioaddr); 2667 rtl8168d_1_hw_phy_config(ioaddr);
2668 break;
2669 case RTL_GIGA_MAC_VER_26:
2670 rtl8168d_2_hw_phy_config(ioaddr);
2671 break;
2672 case RTL_GIGA_MAC_VER_27:
2673 rtl8168d_3_hw_phy_config(ioaddr);
1796 break; 2674 break;
1797 2675
1798 default: 2676 default:
@@ -2322,6 +3200,14 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2322 } 3200 }
2323 3201
2324 rtl8169_init_phy(dev, tp); 3202 rtl8169_init_phy(dev, tp);
3203
3204 /*
3205 * Pretend we are using VLANs; This bypasses a nasty bug where
3206 * Interrupts stop flowing on high load on 8110SCd controllers.
3207 */
3208 if (tp->mac_version == RTL_GIGA_MAC_VER_05)
3209 RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) | RxVlan);
3210
2325 device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL); 3211 device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL);
2326 3212
2327out: 3213out:
@@ -2493,7 +3379,7 @@ static u16 rtl_rw_cpluscmd(void __iomem *ioaddr)
2493static void rtl_set_rx_max_size(void __iomem *ioaddr, unsigned int rx_buf_sz) 3379static void rtl_set_rx_max_size(void __iomem *ioaddr, unsigned int rx_buf_sz)
2494{ 3380{
2495 /* Low hurts. Let's disable the filtering. */ 3381 /* Low hurts. Let's disable the filtering. */
2496 RTL_W16(RxMaxSize, rx_buf_sz); 3382 RTL_W16(RxMaxSize, rx_buf_sz + 1);
2497} 3383}
2498 3384
2499static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) 3385static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
@@ -2863,6 +3749,8 @@ static void rtl_hw_start_8168(struct net_device *dev)
2863 break; 3749 break;
2864 3750
2865 case RTL_GIGA_MAC_VER_25: 3751 case RTL_GIGA_MAC_VER_25:
3752 case RTL_GIGA_MAC_VER_26:
3753 case RTL_GIGA_MAC_VER_27:
2866 rtl_hw_start_8168d(ioaddr, pdev); 3754 rtl_hw_start_8168d(ioaddr, pdev);
2867 break; 3755 break;
2868 3756
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index 01f9432c31ef..98bff5ada09a 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -444,7 +444,8 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
444 * the appropriate LRO method 444 * the appropriate LRO method
445 */ 445 */
446static void efx_rx_packet_lro(struct efx_channel *channel, 446static void efx_rx_packet_lro(struct efx_channel *channel,
447 struct efx_rx_buffer *rx_buf) 447 struct efx_rx_buffer *rx_buf,
448 bool checksummed)
448{ 449{
449 struct napi_struct *napi = &channel->napi_str; 450 struct napi_struct *napi = &channel->napi_str;
450 451
@@ -466,7 +467,8 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
466 skb->len = rx_buf->len; 467 skb->len = rx_buf->len;
467 skb->data_len = rx_buf->len; 468 skb->data_len = rx_buf->len;
468 skb->truesize += rx_buf->len; 469 skb->truesize += rx_buf->len;
469 skb->ip_summed = CHECKSUM_UNNECESSARY; 470 skb->ip_summed =
471 checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
470 472
471 napi_gro_frags(napi); 473 napi_gro_frags(napi);
472 474
@@ -475,6 +477,7 @@ out:
475 rx_buf->page = NULL; 477 rx_buf->page = NULL;
476 } else { 478 } else {
477 EFX_BUG_ON_PARANOID(!rx_buf->skb); 479 EFX_BUG_ON_PARANOID(!rx_buf->skb);
480 EFX_BUG_ON_PARANOID(!checksummed);
478 481
479 napi_gro_receive(napi, rx_buf->skb); 482 napi_gro_receive(napi, rx_buf->skb);
480 rx_buf->skb = NULL; 483 rx_buf->skb = NULL;
@@ -570,7 +573,7 @@ void __efx_rx_packet(struct efx_channel *channel,
570 } 573 }
571 574
572 if (likely(checksummed || rx_buf->page)) { 575 if (likely(checksummed || rx_buf->page)) {
573 efx_rx_packet_lro(channel, rx_buf); 576 efx_rx_packet_lro(channel, rx_buf, checksummed);
574 goto done; 577 goto done;
575 } 578 }
576 579
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index f49d0800c1d1..528b912a4b0d 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -30,6 +30,7 @@
30#include <linux/phy.h> 30#include <linux/phy.h>
31#include <linux/cache.h> 31#include <linux/cache.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <asm/cacheflush.h>
33 34
34#include "sh_eth.h" 35#include "sh_eth.h"
35 36
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 2ab5c39f33ca..6a10d7ba5877 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -4538,6 +4538,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4538 goto err_out_free_netdev; 4538 goto err_out_free_netdev;
4539 } 4539 }
4540 4540
4541 netif_carrier_off(dev);
4542
4541 netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT); 4543 netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT);
4542 4544
4543 err = request_irq(pdev->irq, sky2_intr, 4545 err = request_irq(pdev->irq, sky2_intr,
diff --git a/drivers/net/stmmac/Kconfig b/drivers/net/stmmac/Kconfig
new file mode 100644
index 000000000000..35eaa5251d7f
--- /dev/null
+++ b/drivers/net/stmmac/Kconfig
@@ -0,0 +1,53 @@
1config STMMAC_ETH
2 tristate "STMicroelectronics 10/100/1000 Ethernet driver"
3 select MII
4 select PHYLIB
5 depends on NETDEVICES && CPU_SUBTYPE_ST40
6 help
7 This is the driver for the ST MAC 10/100/1000 on-chip Ethernet
8 controllers. ST Ethernet IPs are built around a Synopsys IP Core.
9
10if STMMAC_ETH
11
12config STMMAC_DA
13 bool "STMMAC DMA arbitration scheme"
14 default n
15 help
16 Selecting this option, rx has priority over Tx (only for Giga
17 Ethernet device).
18 By default, the DMA arbitration scheme is based on Round-robin
19 (rx:tx priority is 1:1).
20
21config STMMAC_DUAL_MAC
22 bool "STMMAC: dual mac support (EXPERIMENTAL)"
23 default n
24 depends on EXPERIMENTAL && STMMAC_ETH && !STMMAC_TIMER
25 help
26 Some ST SoCs (for example the stx7141 and stx7200c2) have two
27 Ethernet Controllers. This option turns on the second Ethernet
28 device on this kind of platforms.
29
30config STMMAC_TIMER
31 bool "STMMAC Timer optimisation"
32 default n
33 help
34 Use an external timer for mitigating the number of network
35 interrupts.
36
37choice
38 prompt "Select Timer device"
39 depends on STMMAC_TIMER
40
41config STMMAC_TMU_TIMER
42 bool "TMU channel 2"
43 depends on CPU_SH4
44 help
45
46config STMMAC_RTC_TIMER
47 bool "Real time clock"
48 depends on RTC_CLASS
49 help
50
51endchoice
52
53endif
diff --git a/drivers/net/stmmac/Makefile b/drivers/net/stmmac/Makefile
new file mode 100644
index 000000000000..b2d7a5564dfa
--- /dev/null
+++ b/drivers/net/stmmac/Makefile
@@ -0,0 +1,4 @@
1obj-$(CONFIG_STMMAC_ETH) += stmmac.o
2stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
3stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o \
4 mac100.o gmac.o $(stmmac-y)
diff --git a/drivers/net/stmmac/common.h b/drivers/net/stmmac/common.h
new file mode 100644
index 000000000000..e49e5188e887
--- /dev/null
+++ b/drivers/net/stmmac/common.h
@@ -0,0 +1,330 @@
1/*******************************************************************************
2 STMMAC Common Header File
3
4 Copyright (C) 2007-2009 STMicroelectronics Ltd
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
23*******************************************************************************/
24
25#include "descs.h"
26#include <linux/io.h>
27
28/* *********************************************
29 DMA CRS Control and Status Register Mapping
30 * *********************************************/
31#define DMA_BUS_MODE 0x00001000 /* Bus Mode */
32#define DMA_XMT_POLL_DEMAND 0x00001004 /* Transmit Poll Demand */
33#define DMA_RCV_POLL_DEMAND 0x00001008 /* Received Poll Demand */
34#define DMA_RCV_BASE_ADDR 0x0000100c /* Receive List Base */
35#define DMA_TX_BASE_ADDR 0x00001010 /* Transmit List Base */
36#define DMA_STATUS 0x00001014 /* Status Register */
37#define DMA_CONTROL 0x00001018 /* Ctrl (Operational Mode) */
38#define DMA_INTR_ENA 0x0000101c /* Interrupt Enable */
39#define DMA_MISSED_FRAME_CTR 0x00001020 /* Missed Frame Counter */
40#define DMA_CUR_TX_BUF_ADDR 0x00001050 /* Current Host Tx Buffer */
41#define DMA_CUR_RX_BUF_ADDR 0x00001054 /* Current Host Rx Buffer */
42
43/* ********************************
44 DMA Control register defines
45 * ********************************/
46#define DMA_CONTROL_ST 0x00002000 /* Start/Stop Transmission */
47#define DMA_CONTROL_SR 0x00000002 /* Start/Stop Receive */
48
49/* **************************************
50 DMA Interrupt Enable register defines
51 * **************************************/
52/**** NORMAL INTERRUPT ****/
53#define DMA_INTR_ENA_NIE 0x00010000 /* Normal Summary */
54#define DMA_INTR_ENA_TIE 0x00000001 /* Transmit Interrupt */
55#define DMA_INTR_ENA_TUE 0x00000004 /* Transmit Buffer Unavailable */
56#define DMA_INTR_ENA_RIE 0x00000040 /* Receive Interrupt */
57#define DMA_INTR_ENA_ERE 0x00004000 /* Early Receive */
58
59#define DMA_INTR_NORMAL (DMA_INTR_ENA_NIE | DMA_INTR_ENA_RIE | \
60 DMA_INTR_ENA_TIE)
61
62/**** ABNORMAL INTERRUPT ****/
63#define DMA_INTR_ENA_AIE 0x00008000 /* Abnormal Summary */
64#define DMA_INTR_ENA_FBE 0x00002000 /* Fatal Bus Error */
65#define DMA_INTR_ENA_ETE 0x00000400 /* Early Transmit */
66#define DMA_INTR_ENA_RWE 0x00000200 /* Receive Watchdog */
67#define DMA_INTR_ENA_RSE 0x00000100 /* Receive Stopped */
68#define DMA_INTR_ENA_RUE 0x00000080 /* Receive Buffer Unavailable */
69#define DMA_INTR_ENA_UNE 0x00000020 /* Tx Underflow */
70#define DMA_INTR_ENA_OVE 0x00000010 /* Receive Overflow */
71#define DMA_INTR_ENA_TJE 0x00000008 /* Transmit Jabber */
72#define DMA_INTR_ENA_TSE 0x00000002 /* Transmit Stopped */
73
74#define DMA_INTR_ABNORMAL (DMA_INTR_ENA_AIE | DMA_INTR_ENA_FBE | \
75 DMA_INTR_ENA_UNE)
76
77/* DMA default interrupt mask */
78#define DMA_INTR_DEFAULT_MASK (DMA_INTR_NORMAL | DMA_INTR_ABNORMAL)
79
80/* ****************************
81 * DMA Status register defines
82 * ****************************/
83#define DMA_STATUS_GPI 0x10000000 /* PMT interrupt */
84#define DMA_STATUS_GMI 0x08000000 /* MMC interrupt */
85#define DMA_STATUS_GLI 0x04000000 /* GMAC Line interface int. */
86#define DMA_STATUS_GMI 0x08000000
87#define DMA_STATUS_GLI 0x04000000
88#define DMA_STATUS_EB_MASK 0x00380000 /* Error Bits Mask */
89#define DMA_STATUS_EB_TX_ABORT 0x00080000 /* Error Bits - TX Abort */
90#define DMA_STATUS_EB_RX_ABORT 0x00100000 /* Error Bits - RX Abort */
91#define DMA_STATUS_TS_MASK 0x00700000 /* Transmit Process State */
92#define DMA_STATUS_TS_SHIFT 20
93#define DMA_STATUS_RS_MASK 0x000e0000 /* Receive Process State */
94#define DMA_STATUS_RS_SHIFT 17
95#define DMA_STATUS_NIS 0x00010000 /* Normal Interrupt Summary */
96#define DMA_STATUS_AIS 0x00008000 /* Abnormal Interrupt Summary */
97#define DMA_STATUS_ERI 0x00004000 /* Early Receive Interrupt */
98#define DMA_STATUS_FBI 0x00002000 /* Fatal Bus Error Interrupt */
99#define DMA_STATUS_ETI 0x00000400 /* Early Transmit Interrupt */
100#define DMA_STATUS_RWT 0x00000200 /* Receive Watchdog Timeout */
101#define DMA_STATUS_RPS 0x00000100 /* Receive Process Stopped */
102#define DMA_STATUS_RU 0x00000080 /* Receive Buffer Unavailable */
103#define DMA_STATUS_RI 0x00000040 /* Receive Interrupt */
104#define DMA_STATUS_UNF 0x00000020 /* Transmit Underflow */
105#define DMA_STATUS_OVF 0x00000010 /* Receive Overflow */
106#define DMA_STATUS_TJT 0x00000008 /* Transmit Jabber Timeout */
107#define DMA_STATUS_TU 0x00000004 /* Transmit Buffer Unavailable */
108#define DMA_STATUS_TPS 0x00000002 /* Transmit Process Stopped */
109#define DMA_STATUS_TI 0x00000001 /* Transmit Interrupt */
110
111/* Other defines */
112#define HASH_TABLE_SIZE 64
113#define PAUSE_TIME 0x200
114
115/* Flow Control defines */
116#define FLOW_OFF 0
117#define FLOW_RX 1
118#define FLOW_TX 2
119#define FLOW_AUTO (FLOW_TX | FLOW_RX)
120
121/* DMA STORE-AND-FORWARD Operation Mode */
122#define SF_DMA_MODE 1
123
124#define HW_CSUM 1
125#define NO_HW_CSUM 0
126
127/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
128#define BUF_SIZE_16KiB 16384
129#define BUF_SIZE_8KiB 8192
130#define BUF_SIZE_4KiB 4096
131#define BUF_SIZE_2KiB 2048
132
133/* Power Down and WOL */
134#define PMT_NOT_SUPPORTED 0
135#define PMT_SUPPORTED 1
136
137/* Common MAC defines */
138#define MAC_CTRL_REG 0x00000000 /* MAC Control */
139#define MAC_ENABLE_TX 0x00000008 /* Transmitter Enable */
140#define MAC_RNABLE_RX 0x00000004 /* Receiver Enable */
141
142/* MAC Management Counters register */
143#define MMC_CONTROL 0x00000100 /* MMC Control */
144#define MMC_HIGH_INTR 0x00000104 /* MMC High Interrupt */
145#define MMC_LOW_INTR 0x00000108 /* MMC Low Interrupt */
146#define MMC_HIGH_INTR_MASK 0x0000010c /* MMC High Interrupt Mask */
147#define MMC_LOW_INTR_MASK 0x00000110 /* MMC Low Interrupt Mask */
148
149#define MMC_CONTROL_MAX_FRM_MASK 0x0003ff8 /* Maximum Frame Size */
150#define MMC_CONTROL_MAX_FRM_SHIFT 3
151#define MMC_CONTROL_MAX_FRAME 0x7FF
152
153struct stmmac_extra_stats {
154 /* Transmit errors */
155 unsigned long tx_underflow ____cacheline_aligned;
156 unsigned long tx_carrier;
157 unsigned long tx_losscarrier;
158 unsigned long tx_heartbeat;
159 unsigned long tx_deferred;
160 unsigned long tx_vlan;
161 unsigned long tx_jabber;
162 unsigned long tx_frame_flushed;
163 unsigned long tx_payload_error;
164 unsigned long tx_ip_header_error;
165 /* Receive errors */
166 unsigned long rx_desc;
167 unsigned long rx_partial;
168 unsigned long rx_runt;
169 unsigned long rx_toolong;
170 unsigned long rx_collision;
171 unsigned long rx_crc;
172 unsigned long rx_lenght;
173 unsigned long rx_mii;
174 unsigned long rx_multicast;
175 unsigned long rx_gmac_overflow;
176 unsigned long rx_watchdog;
177 unsigned long da_rx_filter_fail;
178 unsigned long sa_rx_filter_fail;
179 unsigned long rx_missed_cntr;
180 unsigned long rx_overflow_cntr;
181 unsigned long rx_vlan;
182 /* Tx/Rx IRQ errors */
183 unsigned long tx_undeflow_irq;
184 unsigned long tx_process_stopped_irq;
185 unsigned long tx_jabber_irq;
186 unsigned long rx_overflow_irq;
187 unsigned long rx_buf_unav_irq;
188 unsigned long rx_process_stopped_irq;
189 unsigned long rx_watchdog_irq;
190 unsigned long tx_early_irq;
191 unsigned long fatal_bus_error_irq;
192 /* Extra info */
193 unsigned long threshold;
194 unsigned long tx_pkt_n;
195 unsigned long rx_pkt_n;
196 unsigned long poll_n;
197 unsigned long sched_timer_n;
198 unsigned long normal_irq_n;
199};
200
201/* GMAC core can compute the checksums in HW. */
202enum rx_frame_status {
203 good_frame = 0,
204 discard_frame = 1,
205 csum_none = 2,
206};
207
208static inline void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6],
209 unsigned int high, unsigned int low)
210{
211 unsigned long data;
212
213 data = (addr[5] << 8) | addr[4];
214 writel(data, ioaddr + high);
215 data = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0];
216 writel(data, ioaddr + low);
217
218 return;
219}
220
221static inline void stmmac_get_mac_addr(unsigned long ioaddr,
222 unsigned char *addr, unsigned int high,
223 unsigned int low)
224{
225 unsigned int hi_addr, lo_addr;
226
227 /* Read the MAC address from the hardware */
228 hi_addr = readl(ioaddr + high);
229 lo_addr = readl(ioaddr + low);
230
231 /* Extract the MAC address from the high and low words */
232 addr[0] = lo_addr & 0xff;
233 addr[1] = (lo_addr >> 8) & 0xff;
234 addr[2] = (lo_addr >> 16) & 0xff;
235 addr[3] = (lo_addr >> 24) & 0xff;
236 addr[4] = hi_addr & 0xff;
237 addr[5] = (hi_addr >> 8) & 0xff;
238
239 return;
240}
241
242struct stmmac_ops {
243 /* MAC core initialization */
244 void (*core_init) (unsigned long ioaddr) ____cacheline_aligned;
245 /* DMA core initialization */
246 int (*dma_init) (unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx);
247 /* Dump MAC registers */
248 void (*dump_mac_regs) (unsigned long ioaddr);
249 /* Dump DMA registers */
250 void (*dump_dma_regs) (unsigned long ioaddr);
251 /* Set tx/rx threshold in the csr6 register
252 * An invalid value enables the store-and-forward mode */
253 void (*dma_mode) (unsigned long ioaddr, int txmode, int rxmode);
254 /* To track extra statistic (if supported) */
255 void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
256 unsigned long ioaddr);
257 /* RX descriptor ring initialization */
258 void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size,
259 int disable_rx_ic);
260 /* TX descriptor ring initialization */
261 void (*init_tx_desc) (struct dma_desc *p, unsigned int ring_size);
262
263 /* Invoked by the xmit function to prepare the tx descriptor */
264 void (*prepare_tx_desc) (struct dma_desc *p, int is_fs, int len,
265 int csum_flag);
266 /* Set/get the owner of the descriptor */
267 void (*set_tx_owner) (struct dma_desc *p);
268 int (*get_tx_owner) (struct dma_desc *p);
269 /* Invoked by the xmit function to close the tx descriptor */
270 void (*close_tx_desc) (struct dma_desc *p);
271 /* Clean the tx descriptor as soon as the tx irq is received */
272 void (*release_tx_desc) (struct dma_desc *p);
273 /* Clear interrupt on tx frame completion. When this bit is
274 * set an interrupt happens as soon as the frame is transmitted */
275 void (*clear_tx_ic) (struct dma_desc *p);
276 /* Last tx segment reports the transmit status */
277 int (*get_tx_ls) (struct dma_desc *p);
278 /* Return the transmit status looking at the TDES1 */
279 int (*tx_status) (void *data, struct stmmac_extra_stats *x,
280 struct dma_desc *p, unsigned long ioaddr);
281 /* Get the buffer size from the descriptor */
282 int (*get_tx_len) (struct dma_desc *p);
283 /* Handle extra events on specific interrupts hw dependent */
284 void (*host_irq_status) (unsigned long ioaddr);
285 int (*get_rx_owner) (struct dma_desc *p);
286 void (*set_rx_owner) (struct dma_desc *p);
287 /* Get the receive frame size */
288 int (*get_rx_frame_len) (struct dma_desc *p);
289 /* Return the reception status looking at the RDES1 */
290 int (*rx_status) (void *data, struct stmmac_extra_stats *x,
291 struct dma_desc *p);
292 /* Multicast filter setting */
293 void (*set_filter) (struct net_device *dev);
294 /* Flow control setting */
295 void (*flow_ctrl) (unsigned long ioaddr, unsigned int duplex,
296 unsigned int fc, unsigned int pause_time);
297 /* Set power management mode (e.g. magic frame) */
298 void (*pmt) (unsigned long ioaddr, unsigned long mode);
299 /* Set/Get Unicast MAC addresses */
300 void (*set_umac_addr) (unsigned long ioaddr, unsigned char *addr,
301 unsigned int reg_n);
302 void (*get_umac_addr) (unsigned long ioaddr, unsigned char *addr,
303 unsigned int reg_n);
304};
305
306struct mac_link {
307 int port;
308 int duplex;
309 int speed;
310};
311
312struct mii_regs {
313 unsigned int addr; /* MII Address */
314 unsigned int data; /* MII Data */
315};
316
317struct hw_cap {
318 unsigned int version; /* Core Version register (GMAC) */
319 unsigned int pmt; /* Power-Down mode (GMAC) */
320 struct mac_link link;
321 struct mii_regs mii;
322};
323
324struct mac_device_info {
325 struct hw_cap hw;
326 struct stmmac_ops *ops;
327};
328
329struct mac_device_info *gmac_setup(unsigned long addr);
330struct mac_device_info *mac100_setup(unsigned long addr);
diff --git a/drivers/net/stmmac/descs.h b/drivers/net/stmmac/descs.h
new file mode 100644
index 000000000000..6d2a0b2f5e57
--- /dev/null
+++ b/drivers/net/stmmac/descs.h
@@ -0,0 +1,163 @@
1/*******************************************************************************
2 Header File to describe the DMA descriptors
3 Use enhanced descriptors in case of GMAC Cores.
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms and conditions of the GNU General Public License,
7 version 2, as published by the Free Software Foundation.
8
9 This program is distributed in the hope it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17
18 The full GNU General Public License is included in this distribution in
19 the file called "COPYING".
20
21 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
22*******************************************************************************/
23struct dma_desc {
24 /* Receive descriptor */
25 union {
26 struct {
27 /* RDES0 */
28 u32 reserved1:1;
29 u32 crc_error:1;
30 u32 dribbling:1;
31 u32 mii_error:1;
32 u32 receive_watchdog:1;
33 u32 frame_type:1;
34 u32 collision:1;
35 u32 frame_too_long:1;
36 u32 last_descriptor:1;
37 u32 first_descriptor:1;
38 u32 multicast_frame:1;
39 u32 run_frame:1;
40 u32 length_error:1;
41 u32 partial_frame_error:1;
42 u32 descriptor_error:1;
43 u32 error_summary:1;
44 u32 frame_length:14;
45 u32 filtering_fail:1;
46 u32 own:1;
47 /* RDES1 */
48 u32 buffer1_size:11;
49 u32 buffer2_size:11;
50 u32 reserved2:2;
51 u32 second_address_chained:1;
52 u32 end_ring:1;
53 u32 reserved3:5;
54 u32 disable_ic:1;
55 } rx;
56 struct {
57 /* RDES0 */
58 u32 payload_csum_error:1;
59 u32 crc_error:1;
60 u32 dribbling:1;
61 u32 error_gmii:1;
62 u32 receive_watchdog:1;
63 u32 frame_type:1;
64 u32 late_collision:1;
65 u32 ipc_csum_error:1;
66 u32 last_descriptor:1;
67 u32 first_descriptor:1;
68 u32 vlan_tag:1;
69 u32 overflow_error:1;
70 u32 length_error:1;
71 u32 sa_filter_fail:1;
72 u32 descriptor_error:1;
73 u32 error_summary:1;
74 u32 frame_length:14;
75 u32 da_filter_fail:1;
76 u32 own:1;
77 /* RDES1 */
78 u32 buffer1_size:13;
79 u32 reserved1:1;
80 u32 second_address_chained:1;
81 u32 end_ring:1;
82 u32 buffer2_size:13;
83 u32 reserved2:2;
84 u32 disable_ic:1;
85 } erx; /* -- enhanced -- */
86
87 /* Transmit descriptor */
88 struct {
89 /* TDES0 */
90 u32 deferred:1;
91 u32 underflow_error:1;
92 u32 excessive_deferral:1;
93 u32 collision_count:4;
94 u32 heartbeat_fail:1;
95 u32 excessive_collisions:1;
96 u32 late_collision:1;
97 u32 no_carrier:1;
98 u32 loss_carrier:1;
99 u32 reserved1:3;
100 u32 error_summary:1;
101 u32 reserved2:15;
102 u32 own:1;
103 /* TDES1 */
104 u32 buffer1_size:11;
105 u32 buffer2_size:11;
106 u32 reserved3:1;
107 u32 disable_padding:1;
108 u32 second_address_chained:1;
109 u32 end_ring:1;
110 u32 crc_disable:1;
111 u32 reserved4:2;
112 u32 first_segment:1;
113 u32 last_segment:1;
114 u32 interrupt:1;
115 } tx;
116 struct {
117 /* TDES0 */
118 u32 deferred:1;
119 u32 underflow_error:1;
120 u32 excessive_deferral:1;
121 u32 collision_count:4;
122 u32 vlan_frame:1;
123 u32 excessive_collisions:1;
124 u32 late_collision:1;
125 u32 no_carrier:1;
126 u32 loss_carrier:1;
127 u32 payload_error:1;
128 u32 frame_flushed:1;
129 u32 jabber_timeout:1;
130 u32 error_summary:1;
131 u32 ip_header_error:1;
132 u32 time_stamp_status:1;
133 u32 reserved1:2;
134 u32 second_address_chained:1;
135 u32 end_ring:1;
136 u32 checksum_insertion:2;
137 u32 reserved2:1;
138 u32 time_stamp_enable:1;
139 u32 disable_padding:1;
140 u32 crc_disable:1;
141 u32 first_segment:1;
142 u32 last_segment:1;
143 u32 interrupt:1;
144 u32 own:1;
145 /* TDES1 */
146 u32 buffer1_size:13;
147 u32 reserved3:3;
148 u32 buffer2_size:13;
149 u32 reserved4:3;
150 } etx; /* -- enhanced -- */
151 } des01;
152 unsigned int des2;
153 unsigned int des3;
154};
155
156/* Transmit checksum insertion control */
157enum tdes_csum_insertion {
158 cic_disabled = 0, /* Checksum Insertion Control */
159 cic_only_ip = 1, /* Only IP header */
160 cic_no_pseudoheader = 2, /* IP header but pseudoheader
161 * is not calculated */
162 cic_full = 3, /* IP header and pseudoheader */
163};
diff --git a/drivers/net/stmmac/gmac.c b/drivers/net/stmmac/gmac.c
new file mode 100644
index 000000000000..b624bb5bae0a
--- /dev/null
+++ b/drivers/net/stmmac/gmac.c
@@ -0,0 +1,693 @@
1/*******************************************************************************
2 This is the driver for the GMAC on-chip Ethernet controller for ST SoCs.
3 DWC Ether MAC 10/100/1000 Universal version 3.41a has been used for
4 developing this code.
5
6 Copyright (C) 2007-2009 STMicroelectronics Ltd
7
8 This program is free software; you can redistribute it and/or modify it
9 under the terms and conditions of the GNU General Public License,
10 version 2, as published by the Free Software Foundation.
11
12 This program is distributed in the hope it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 more details.
16
17 You should have received a copy of the GNU General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20
21 The full GNU General Public License is included in this distribution in
22 the file called "COPYING".
23
24 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
25*******************************************************************************/
26
27#include <linux/netdevice.h>
28#include <linux/crc32.h>
29#include <linux/mii.h>
30#include <linux/phy.h>
31
32#include "stmmac.h"
33#include "gmac.h"
34
35#undef GMAC_DEBUG
36/*#define GMAC_DEBUG*/
37#undef FRAME_FILTER_DEBUG
38/*#define FRAME_FILTER_DEBUG*/
39#ifdef GMAC_DEBUG
40#define DBG(fmt, args...) printk(fmt, ## args)
41#else
42#define DBG(fmt, args...) do { } while (0)
43#endif
44
45static void gmac_dump_regs(unsigned long ioaddr)
46{
47 int i;
48 pr_info("\t----------------------------------------------\n"
49 "\t GMAC registers (base addr = 0x%8x)\n"
50 "\t----------------------------------------------\n",
51 (unsigned int)ioaddr);
52
53 for (i = 0; i < 55; i++) {
54 int offset = i * 4;
55 pr_info("\tReg No. %d (offset 0x%x): 0x%08x\n", i,
56 offset, readl(ioaddr + offset));
57 }
58 return;
59}
60
61static int gmac_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx)
62{
63 u32 value = readl(ioaddr + DMA_BUS_MODE);
64 /* DMA SW reset */
65 value |= DMA_BUS_MODE_SFT_RESET;
66 writel(value, ioaddr + DMA_BUS_MODE);
67 do {} while ((readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET));
68
69 value = /* DMA_BUS_MODE_FB | */ DMA_BUS_MODE_4PBL |
70 ((pbl << DMA_BUS_MODE_PBL_SHIFT) |
71 (pbl << DMA_BUS_MODE_RPBL_SHIFT));
72
73#ifdef CONFIG_STMMAC_DA
74 value |= DMA_BUS_MODE_DA; /* Rx has priority over tx */
75#endif
76 writel(value, ioaddr + DMA_BUS_MODE);
77
78 /* Mask interrupts by writing to CSR7 */
79 writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA);
80
81 /* The base address of the RX/TX descriptor lists must be written into
82 * DMA CSR3 and CSR4, respectively. */
83 writel(dma_tx, ioaddr + DMA_TX_BASE_ADDR);
84 writel(dma_rx, ioaddr + DMA_RCV_BASE_ADDR);
85
86 return 0;
87}
88
89/* Transmit FIFO flush operation */
90static void gmac_flush_tx_fifo(unsigned long ioaddr)
91{
92 u32 csr6 = readl(ioaddr + DMA_CONTROL);
93 writel((csr6 | DMA_CONTROL_FTF), ioaddr + DMA_CONTROL);
94
95 do {} while ((readl(ioaddr + DMA_CONTROL) & DMA_CONTROL_FTF));
96}
97
98static void gmac_dma_operation_mode(unsigned long ioaddr, int txmode,
99 int rxmode)
100{
101 u32 csr6 = readl(ioaddr + DMA_CONTROL);
102
103 if (txmode == SF_DMA_MODE) {
104 DBG(KERN_DEBUG "GMAC: enabling TX store and forward mode\n");
105 /* Transmit COE type 2 cannot be done in cut-through mode. */
106 csr6 |= DMA_CONTROL_TSF;
107 /* Operating on second frame increase the performance
108 * especially when transmit store-and-forward is used.*/
109 csr6 |= DMA_CONTROL_OSF;
110 } else {
111 DBG(KERN_DEBUG "GMAC: disabling TX store and forward mode"
112 " (threshold = %d)\n", txmode);
113 csr6 &= ~DMA_CONTROL_TSF;
114 csr6 &= DMA_CONTROL_TC_TX_MASK;
115 /* Set the transmit threashold */
116 if (txmode <= 32)
117 csr6 |= DMA_CONTROL_TTC_32;
118 else if (txmode <= 64)
119 csr6 |= DMA_CONTROL_TTC_64;
120 else if (txmode <= 128)
121 csr6 |= DMA_CONTROL_TTC_128;
122 else if (txmode <= 192)
123 csr6 |= DMA_CONTROL_TTC_192;
124 else
125 csr6 |= DMA_CONTROL_TTC_256;
126 }
127
128 if (rxmode == SF_DMA_MODE) {
129 DBG(KERN_DEBUG "GMAC: enabling RX store and forward mode\n");
130 csr6 |= DMA_CONTROL_RSF;
131 } else {
132 DBG(KERN_DEBUG "GMAC: disabling RX store and forward mode"
133 " (threshold = %d)\n", rxmode);
134 csr6 &= ~DMA_CONTROL_RSF;
135 csr6 &= DMA_CONTROL_TC_RX_MASK;
136 if (rxmode <= 32)
137 csr6 |= DMA_CONTROL_RTC_32;
138 else if (rxmode <= 64)
139 csr6 |= DMA_CONTROL_RTC_64;
140 else if (rxmode <= 96)
141 csr6 |= DMA_CONTROL_RTC_96;
142 else
143 csr6 |= DMA_CONTROL_RTC_128;
144 }
145
146 writel(csr6, ioaddr + DMA_CONTROL);
147 return;
148}
149
150/* Not yet implemented --- no RMON module */
151static void gmac_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x,
152 unsigned long ioaddr)
153{
154 return;
155}
156
157static void gmac_dump_dma_regs(unsigned long ioaddr)
158{
159 int i;
160 pr_info(" DMA registers\n");
161 for (i = 0; i < 22; i++) {
162 if ((i < 9) || (i > 17)) {
163 int offset = i * 4;
164 pr_err("\t Reg No. %d (offset 0x%x): 0x%08x\n", i,
165 (DMA_BUS_MODE + offset),
166 readl(ioaddr + DMA_BUS_MODE + offset));
167 }
168 }
169 return;
170}
171
172static int gmac_get_tx_frame_status(void *data, struct stmmac_extra_stats *x,
173 struct dma_desc *p, unsigned long ioaddr)
174{
175 int ret = 0;
176 struct net_device_stats *stats = (struct net_device_stats *)data;
177
178 if (unlikely(p->des01.etx.error_summary)) {
179 DBG(KERN_ERR "GMAC TX error... 0x%08x\n", p->des01.etx);
180 if (unlikely(p->des01.etx.jabber_timeout)) {
181 DBG(KERN_ERR "\tjabber_timeout error\n");
182 x->tx_jabber++;
183 }
184
185 if (unlikely(p->des01.etx.frame_flushed)) {
186 DBG(KERN_ERR "\tframe_flushed error\n");
187 x->tx_frame_flushed++;
188 gmac_flush_tx_fifo(ioaddr);
189 }
190
191 if (unlikely(p->des01.etx.loss_carrier)) {
192 DBG(KERN_ERR "\tloss_carrier error\n");
193 x->tx_losscarrier++;
194 stats->tx_carrier_errors++;
195 }
196 if (unlikely(p->des01.etx.no_carrier)) {
197 DBG(KERN_ERR "\tno_carrier error\n");
198 x->tx_carrier++;
199 stats->tx_carrier_errors++;
200 }
201 if (unlikely(p->des01.etx.late_collision)) {
202 DBG(KERN_ERR "\tlate_collision error\n");
203 stats->collisions += p->des01.etx.collision_count;
204 }
205 if (unlikely(p->des01.etx.excessive_collisions)) {
206 DBG(KERN_ERR "\texcessive_collisions\n");
207 stats->collisions += p->des01.etx.collision_count;
208 }
209 if (unlikely(p->des01.etx.excessive_deferral)) {
210 DBG(KERN_INFO "\texcessive tx_deferral\n");
211 x->tx_deferred++;
212 }
213
214 if (unlikely(p->des01.etx.underflow_error)) {
215 DBG(KERN_ERR "\tunderflow error\n");
216 gmac_flush_tx_fifo(ioaddr);
217 x->tx_underflow++;
218 }
219
220 if (unlikely(p->des01.etx.ip_header_error)) {
221 DBG(KERN_ERR "\tTX IP header csum error\n");
222 x->tx_ip_header_error++;
223 }
224
225 if (unlikely(p->des01.etx.payload_error)) {
226 DBG(KERN_ERR "\tAddr/Payload csum error\n");
227 x->tx_payload_error++;
228 gmac_flush_tx_fifo(ioaddr);
229 }
230
231 ret = -1;
232 }
233
234 if (unlikely(p->des01.etx.deferred)) {
235 DBG(KERN_INFO "GMAC TX status: tx deferred\n");
236 x->tx_deferred++;
237 }
238#ifdef STMMAC_VLAN_TAG_USED
239 if (p->des01.etx.vlan_frame) {
240 DBG(KERN_INFO "GMAC TX status: VLAN frame\n");
241 x->tx_vlan++;
242 }
243#endif
244
245 return ret;
246}
247
248static int gmac_get_tx_len(struct dma_desc *p)
249{
250 return p->des01.etx.buffer1_size;
251}
252
253static int gmac_coe_rdes0(int ipc_err, int type, int payload_err)
254{
255 int ret = good_frame;
256 u32 status = (type << 2 | ipc_err << 1 | payload_err) & 0x7;
257
258 /* bits 5 7 0 | Frame status
259 * ----------------------------------------------------------
260 * 0 0 0 | IEEE 802.3 Type frame (lenght < 1536 octects)
261 * 1 0 0 | IPv4/6 No CSUM errorS.
262 * 1 0 1 | IPv4/6 CSUM PAYLOAD error
263 * 1 1 0 | IPv4/6 CSUM IP HR error
264 * 1 1 1 | IPv4/6 IP PAYLOAD AND HEADER errorS
265 * 0 0 1 | IPv4/6 unsupported IP PAYLOAD
266 * 0 1 1 | COE bypassed.. no IPv4/6 frame
267 * 0 1 0 | Reserved.
268 */
269 if (status == 0x0) {
270 DBG(KERN_INFO "RX Des0 status: IEEE 802.3 Type frame.\n");
271 ret = good_frame;
272 } else if (status == 0x4) {
273 DBG(KERN_INFO "RX Des0 status: IPv4/6 No CSUM errorS.\n");
274 ret = good_frame;
275 } else if (status == 0x5) {
276 DBG(KERN_ERR "RX Des0 status: IPv4/6 Payload Error.\n");
277 ret = csum_none;
278 } else if (status == 0x6) {
279 DBG(KERN_ERR "RX Des0 status: IPv4/6 Header Error.\n");
280 ret = csum_none;
281 } else if (status == 0x7) {
282 DBG(KERN_ERR
283 "RX Des0 status: IPv4/6 Header and Payload Error.\n");
284 ret = csum_none;
285 } else if (status == 0x1) {
286 DBG(KERN_ERR
287 "RX Des0 status: IPv4/6 unsupported IP PAYLOAD.\n");
288 ret = discard_frame;
289 } else if (status == 0x3) {
290 DBG(KERN_ERR "RX Des0 status: No IPv4, IPv6 frame.\n");
291 ret = discard_frame;
292 }
293 return ret;
294}
295
296static int gmac_get_rx_frame_status(void *data, struct stmmac_extra_stats *x,
297 struct dma_desc *p)
298{
299 int ret = good_frame;
300 struct net_device_stats *stats = (struct net_device_stats *)data;
301
302 if (unlikely(p->des01.erx.error_summary)) {
303 DBG(KERN_ERR "GMAC RX Error Summary... 0x%08x\n", p->des01.erx);
304 if (unlikely(p->des01.erx.descriptor_error)) {
305 DBG(KERN_ERR "\tdescriptor error\n");
306 x->rx_desc++;
307 stats->rx_length_errors++;
308 }
309 if (unlikely(p->des01.erx.overflow_error)) {
310 DBG(KERN_ERR "\toverflow error\n");
311 x->rx_gmac_overflow++;
312 }
313
314 if (unlikely(p->des01.erx.ipc_csum_error))
315 DBG(KERN_ERR "\tIPC Csum Error/Giant frame\n");
316
317 if (unlikely(p->des01.erx.late_collision)) {
318 DBG(KERN_ERR "\tlate_collision error\n");
319 stats->collisions++;
320 stats->collisions++;
321 }
322 if (unlikely(p->des01.erx.receive_watchdog)) {
323 DBG(KERN_ERR "\treceive_watchdog error\n");
324 x->rx_watchdog++;
325 }
326 if (unlikely(p->des01.erx.error_gmii)) {
327 DBG(KERN_ERR "\tReceive Error\n");
328 x->rx_mii++;
329 }
330 if (unlikely(p->des01.erx.crc_error)) {
331 DBG(KERN_ERR "\tCRC error\n");
332 x->rx_crc++;
333 stats->rx_crc_errors++;
334 }
335 ret = discard_frame;
336 }
337
338 /* After a payload csum error, the ES bit is set.
339 * It doesn't match with the information reported into the databook.
340 * At any rate, we need to understand if the CSUM hw computation is ok
341 * and report this info to the upper layers. */
342 ret = gmac_coe_rdes0(p->des01.erx.ipc_csum_error,
343 p->des01.erx.frame_type, p->des01.erx.payload_csum_error);
344
345 if (unlikely(p->des01.erx.dribbling)) {
346 DBG(KERN_ERR "GMAC RX: dribbling error\n");
347 ret = discard_frame;
348 }
349 if (unlikely(p->des01.erx.sa_filter_fail)) {
350 DBG(KERN_ERR "GMAC RX : Source Address filter fail\n");
351 x->sa_rx_filter_fail++;
352 ret = discard_frame;
353 }
354 if (unlikely(p->des01.erx.da_filter_fail)) {
355 DBG(KERN_ERR "GMAC RX : Destination Address filter fail\n");
356 x->da_rx_filter_fail++;
357 ret = discard_frame;
358 }
359 if (unlikely(p->des01.erx.length_error)) {
360 DBG(KERN_ERR "GMAC RX: length_error error\n");
361 x->rx_lenght++;
362 ret = discard_frame;
363 }
364#ifdef STMMAC_VLAN_TAG_USED
365 if (p->des01.erx.vlan_tag) {
366 DBG(KERN_INFO "GMAC RX: VLAN frame tagged\n");
367 x->rx_vlan++;
368 }
369#endif
370 return ret;
371}
372
373static void gmac_irq_status(unsigned long ioaddr)
374{
375 u32 intr_status = readl(ioaddr + GMAC_INT_STATUS);
376
377 /* Not used events (e.g. MMC interrupts) are not handled. */
378 if ((intr_status & mmc_tx_irq))
379 DBG(KERN_DEBUG "GMAC: MMC tx interrupt: 0x%08x\n",
380 readl(ioaddr + GMAC_MMC_TX_INTR));
381 if (unlikely(intr_status & mmc_rx_irq))
382 DBG(KERN_DEBUG "GMAC: MMC rx interrupt: 0x%08x\n",
383 readl(ioaddr + GMAC_MMC_RX_INTR));
384 if (unlikely(intr_status & mmc_rx_csum_offload_irq))
385 DBG(KERN_DEBUG "GMAC: MMC rx csum offload: 0x%08x\n",
386 readl(ioaddr + GMAC_MMC_RX_CSUM_OFFLOAD));
387 if (unlikely(intr_status & pmt_irq)) {
388 DBG(KERN_DEBUG "GMAC: received Magic frame\n");
389 /* clear the PMT bits 5 and 6 by reading the PMT
390 * status register. */
391 readl(ioaddr + GMAC_PMT);
392 }
393
394 return;
395}
396
397static void gmac_core_init(unsigned long ioaddr)
398{
399 u32 value = readl(ioaddr + GMAC_CONTROL);
400 value |= GMAC_CORE_INIT;
401 writel(value, ioaddr + GMAC_CONTROL);
402
403 /* STBus Bridge Configuration */
404 /*writel(0xc5608, ioaddr + 0x00007000);*/
405
406 /* Freeze MMC counters */
407 writel(0x8, ioaddr + GMAC_MMC_CTRL);
408 /* Mask GMAC interrupts */
409 writel(0x207, ioaddr + GMAC_INT_MASK);
410
411#ifdef STMMAC_VLAN_TAG_USED
412 /* Tag detection without filtering */
413 writel(0x0, ioaddr + GMAC_VLAN_TAG);
414#endif
415 return;
416}
417
418static void gmac_set_umac_addr(unsigned long ioaddr, unsigned char *addr,
419 unsigned int reg_n)
420{
421 stmmac_set_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
422 GMAC_ADDR_LOW(reg_n));
423}
424
425static void gmac_get_umac_addr(unsigned long ioaddr, unsigned char *addr,
426 unsigned int reg_n)
427{
428 stmmac_get_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
429 GMAC_ADDR_LOW(reg_n));
430}
431
432static void gmac_set_filter(struct net_device *dev)
433{
434 unsigned long ioaddr = dev->base_addr;
435 unsigned int value = 0;
436
437 DBG(KERN_INFO "%s: # mcasts %d, # unicast %d\n",
438 __func__, dev->mc_count, dev->uc_count);
439
440 if (dev->flags & IFF_PROMISC)
441 value = GMAC_FRAME_FILTER_PR;
442 else if ((dev->mc_count > HASH_TABLE_SIZE)
443 || (dev->flags & IFF_ALLMULTI)) {
444 value = GMAC_FRAME_FILTER_PM; /* pass all multi */
445 writel(0xffffffff, ioaddr + GMAC_HASH_HIGH);
446 writel(0xffffffff, ioaddr + GMAC_HASH_LOW);
447 } else if (dev->mc_count > 0) {
448 int i;
449 u32 mc_filter[2];
450 struct dev_mc_list *mclist;
451
452 /* Hash filter for multicast */
453 value = GMAC_FRAME_FILTER_HMC;
454
455 memset(mc_filter, 0, sizeof(mc_filter));
456 for (i = 0, mclist = dev->mc_list;
457 mclist && i < dev->mc_count; i++, mclist = mclist->next) {
458 /* The upper 6 bits of the calculated CRC are used to
459 index the contens of the hash table */
460 int bit_nr =
461 bitrev32(~crc32_le(~0, mclist->dmi_addr, 6)) >> 26;
462 /* The most significant bit determines the register to
463 * use (H/L) while the other 5 bits determine the bit
464 * within the register. */
465 mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
466 }
467 writel(mc_filter[0], ioaddr + GMAC_HASH_LOW);
468 writel(mc_filter[1], ioaddr + GMAC_HASH_HIGH);
469 }
470
471 /* Handle multiple unicast addresses (perfect filtering)*/
472 if (dev->uc_count > GMAC_MAX_UNICAST_ADDRESSES)
473 /* Switch to promiscuous mode is more than 16 addrs
474 are required */
475 value |= GMAC_FRAME_FILTER_PR;
476 else {
477 int i;
478 struct dev_addr_list *uc_ptr = dev->uc_list;
479
480 for (i = 0; i < dev->uc_count; i++) {
481 gmac_set_umac_addr(ioaddr, uc_ptr->da_addr,
482 i + 1);
483
484 DBG(KERN_INFO "\t%d "
485 "- Unicast addr %02x:%02x:%02x:%02x:%02x:"
486 "%02x\n", i + 1,
487 uc_ptr->da_addr[0], uc_ptr->da_addr[1],
488 uc_ptr->da_addr[2], uc_ptr->da_addr[3],
489 uc_ptr->da_addr[4], uc_ptr->da_addr[5]);
490 uc_ptr = uc_ptr->next;
491 }
492 }
493
494#ifdef FRAME_FILTER_DEBUG
495 /* Enable Receive all mode (to debug filtering_fail errors) */
496 value |= GMAC_FRAME_FILTER_RA;
497#endif
498 writel(value, ioaddr + GMAC_FRAME_FILTER);
499
500 DBG(KERN_INFO "\tFrame Filter reg: 0x%08x\n\tHash regs: "
501 "HI 0x%08x, LO 0x%08x\n", readl(ioaddr + GMAC_FRAME_FILTER),
502 readl(ioaddr + GMAC_HASH_HIGH), readl(ioaddr + GMAC_HASH_LOW));
503
504 return;
505}
506
507static void gmac_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
508 unsigned int fc, unsigned int pause_time)
509{
510 unsigned int flow = 0;
511
512 DBG(KERN_DEBUG "GMAC Flow-Control:\n");
513 if (fc & FLOW_RX) {
514 DBG(KERN_DEBUG "\tReceive Flow-Control ON\n");
515 flow |= GMAC_FLOW_CTRL_RFE;
516 }
517 if (fc & FLOW_TX) {
518 DBG(KERN_DEBUG "\tTransmit Flow-Control ON\n");
519 flow |= GMAC_FLOW_CTRL_TFE;
520 }
521
522 if (duplex) {
523 DBG(KERN_DEBUG "\tduplex mode: pause time: %d\n", pause_time);
524 flow |= (pause_time << GMAC_FLOW_CTRL_PT_SHIFT);
525 }
526
527 writel(flow, ioaddr + GMAC_FLOW_CTRL);
528 return;
529}
530
531static void gmac_pmt(unsigned long ioaddr, unsigned long mode)
532{
533 unsigned int pmt = 0;
534
535 if (mode == WAKE_MAGIC) {
536 DBG(KERN_DEBUG "GMAC: WOL Magic frame\n");
537 pmt |= power_down | magic_pkt_en;
538 } else if (mode == WAKE_UCAST) {
539 DBG(KERN_DEBUG "GMAC: WOL on global unicast\n");
540 pmt |= global_unicast;
541 }
542
543 writel(pmt, ioaddr + GMAC_PMT);
544 return;
545}
546
547static void gmac_init_rx_desc(struct dma_desc *p, unsigned int ring_size,
548 int disable_rx_ic)
549{
550 int i;
551 for (i = 0; i < ring_size; i++) {
552 p->des01.erx.own = 1;
553 p->des01.erx.buffer1_size = BUF_SIZE_8KiB - 1;
554 /* To support jumbo frames */
555 p->des01.erx.buffer2_size = BUF_SIZE_8KiB - 1;
556 if (i == ring_size - 1)
557 p->des01.erx.end_ring = 1;
558 if (disable_rx_ic)
559 p->des01.erx.disable_ic = 1;
560 p++;
561 }
562 return;
563}
564
565static void gmac_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
566{
567 int i;
568
569 for (i = 0; i < ring_size; i++) {
570 p->des01.etx.own = 0;
571 if (i == ring_size - 1)
572 p->des01.etx.end_ring = 1;
573 p++;
574 }
575
576 return;
577}
578
579static int gmac_get_tx_owner(struct dma_desc *p)
580{
581 return p->des01.etx.own;
582}
583
584static int gmac_get_rx_owner(struct dma_desc *p)
585{
586 return p->des01.erx.own;
587}
588
589static void gmac_set_tx_owner(struct dma_desc *p)
590{
591 p->des01.etx.own = 1;
592}
593
594static void gmac_set_rx_owner(struct dma_desc *p)
595{
596 p->des01.erx.own = 1;
597}
598
599static int gmac_get_tx_ls(struct dma_desc *p)
600{
601 return p->des01.etx.last_segment;
602}
603
604static void gmac_release_tx_desc(struct dma_desc *p)
605{
606 int ter = p->des01.etx.end_ring;
607
608 memset(p, 0, sizeof(struct dma_desc));
609 p->des01.etx.end_ring = ter;
610
611 return;
612}
613
614static void gmac_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
615 int csum_flag)
616{
617 p->des01.etx.first_segment = is_fs;
618 if (unlikely(len > BUF_SIZE_4KiB)) {
619 p->des01.etx.buffer1_size = BUF_SIZE_4KiB;
620 p->des01.etx.buffer2_size = len - BUF_SIZE_4KiB;
621 } else {
622 p->des01.etx.buffer1_size = len;
623 }
624 if (likely(csum_flag))
625 p->des01.etx.checksum_insertion = cic_full;
626}
627
628static void gmac_clear_tx_ic(struct dma_desc *p)
629{
630 p->des01.etx.interrupt = 0;
631}
632
633static void gmac_close_tx_desc(struct dma_desc *p)
634{
635 p->des01.etx.last_segment = 1;
636 p->des01.etx.interrupt = 1;
637}
638
639static int gmac_get_rx_frame_len(struct dma_desc *p)
640{
641 return p->des01.erx.frame_length;
642}
643
644struct stmmac_ops gmac_driver = {
645 .core_init = gmac_core_init,
646 .dump_mac_regs = gmac_dump_regs,
647 .dma_init = gmac_dma_init,
648 .dump_dma_regs = gmac_dump_dma_regs,
649 .dma_mode = gmac_dma_operation_mode,
650 .dma_diagnostic_fr = gmac_dma_diagnostic_fr,
651 .tx_status = gmac_get_tx_frame_status,
652 .rx_status = gmac_get_rx_frame_status,
653 .get_tx_len = gmac_get_tx_len,
654 .set_filter = gmac_set_filter,
655 .flow_ctrl = gmac_flow_ctrl,
656 .pmt = gmac_pmt,
657 .init_rx_desc = gmac_init_rx_desc,
658 .init_tx_desc = gmac_init_tx_desc,
659 .get_tx_owner = gmac_get_tx_owner,
660 .get_rx_owner = gmac_get_rx_owner,
661 .release_tx_desc = gmac_release_tx_desc,
662 .prepare_tx_desc = gmac_prepare_tx_desc,
663 .clear_tx_ic = gmac_clear_tx_ic,
664 .close_tx_desc = gmac_close_tx_desc,
665 .get_tx_ls = gmac_get_tx_ls,
666 .set_tx_owner = gmac_set_tx_owner,
667 .set_rx_owner = gmac_set_rx_owner,
668 .get_rx_frame_len = gmac_get_rx_frame_len,
669 .host_irq_status = gmac_irq_status,
670 .set_umac_addr = gmac_set_umac_addr,
671 .get_umac_addr = gmac_get_umac_addr,
672};
673
674struct mac_device_info *gmac_setup(unsigned long ioaddr)
675{
676 struct mac_device_info *mac;
677 u32 uid = readl(ioaddr + GMAC_VERSION);
678
679 pr_info("\tGMAC - user ID: 0x%x, Synopsys ID: 0x%x\n",
680 ((uid & 0x0000ff00) >> 8), (uid & 0x000000ff));
681
682 mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL);
683
684 mac->ops = &gmac_driver;
685 mac->hw.pmt = PMT_SUPPORTED;
686 mac->hw.link.port = GMAC_CONTROL_PS;
687 mac->hw.link.duplex = GMAC_CONTROL_DM;
688 mac->hw.link.speed = GMAC_CONTROL_FES;
689 mac->hw.mii.addr = GMAC_MII_ADDR;
690 mac->hw.mii.data = GMAC_MII_DATA;
691
692 return mac;
693}
diff --git a/drivers/net/stmmac/gmac.h b/drivers/net/stmmac/gmac.h
new file mode 100644
index 000000000000..684a363120a9
--- /dev/null
+++ b/drivers/net/stmmac/gmac.h
@@ -0,0 +1,204 @@
1/*******************************************************************************
2 Copyright (C) 2007-2009 STMicroelectronics Ltd
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms and conditions of the GNU General Public License,
6 version 2, as published by the Free Software Foundation.
7
8 This program is distributed in the hope it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16
17 The full GNU General Public License is included in this distribution in
18 the file called "COPYING".
19
20 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
21*******************************************************************************/
22
23#define GMAC_CONTROL 0x00000000 /* Configuration */
24#define GMAC_FRAME_FILTER 0x00000004 /* Frame Filter */
25#define GMAC_HASH_HIGH 0x00000008 /* Multicast Hash Table High */
26#define GMAC_HASH_LOW 0x0000000c /* Multicast Hash Table Low */
27#define GMAC_MII_ADDR 0x00000010 /* MII Address */
28#define GMAC_MII_DATA 0x00000014 /* MII Data */
29#define GMAC_FLOW_CTRL 0x00000018 /* Flow Control */
30#define GMAC_VLAN_TAG 0x0000001c /* VLAN Tag */
31#define GMAC_VERSION 0x00000020 /* GMAC CORE Version */
32#define GMAC_WAKEUP_FILTER 0x00000028 /* Wake-up Frame Filter */
33
34#define GMAC_INT_STATUS 0x00000038 /* interrupt status register */
35enum gmac_irq_status {
36 time_stamp_irq = 0x0200,
37 mmc_rx_csum_offload_irq = 0x0080,
38 mmc_tx_irq = 0x0040,
39 mmc_rx_irq = 0x0020,
40 mmc_irq = 0x0010,
41 pmt_irq = 0x0008,
42 pcs_ane_irq = 0x0004,
43 pcs_link_irq = 0x0002,
44 rgmii_irq = 0x0001,
45};
46#define GMAC_INT_MASK 0x0000003c /* interrupt mask register */
47
48/* PMT Control and Status */
49#define GMAC_PMT 0x0000002c
50enum power_event {
51 pointer_reset = 0x80000000,
52 global_unicast = 0x00000200,
53 wake_up_rx_frame = 0x00000040,
54 magic_frame = 0x00000020,
55 wake_up_frame_en = 0x00000004,
56 magic_pkt_en = 0x00000002,
57 power_down = 0x00000001,
58};
59
60/* GMAC HW ADDR regs */
61#define GMAC_ADDR_HIGH(reg) (0x00000040+(reg * 8))
62#define GMAC_ADDR_LOW(reg) (0x00000044+(reg * 8))
63#define GMAC_MAX_UNICAST_ADDRESSES 16
64
65#define GMAC_AN_CTRL 0x000000c0 /* AN control */
66#define GMAC_AN_STATUS 0x000000c4 /* AN status */
67#define GMAC_ANE_ADV 0x000000c8 /* Auto-Neg. Advertisement */
68#define GMAC_ANE_LINK 0x000000cc /* Auto-Neg. link partener ability */
69#define GMAC_ANE_EXP 0x000000d0 /* ANE expansion */
70#define GMAC_TBI 0x000000d4 /* TBI extend status */
71#define GMAC_GMII_STATUS 0x000000d8 /* S/R-GMII status */
72
73/* GMAC Configuration defines */
74#define GMAC_CONTROL_TC 0x01000000 /* Transmit Conf. in RGMII/SGMII */
75#define GMAC_CONTROL_WD 0x00800000 /* Disable Watchdog on receive */
76#define GMAC_CONTROL_JD 0x00400000 /* Jabber disable */
77#define GMAC_CONTROL_BE 0x00200000 /* Frame Burst Enable */
78#define GMAC_CONTROL_JE 0x00100000 /* Jumbo frame */
79enum inter_frame_gap {
80 GMAC_CONTROL_IFG_88 = 0x00040000,
81 GMAC_CONTROL_IFG_80 = 0x00020000,
82 GMAC_CONTROL_IFG_40 = 0x000e0000,
83};
84#define GMAC_CONTROL_DCRS 0x00010000 /* Disable carrier sense during tx */
85#define GMAC_CONTROL_PS 0x00008000 /* Port Select 0:GMI 1:MII */
86#define GMAC_CONTROL_FES 0x00004000 /* Speed 0:10 1:100 */
87#define GMAC_CONTROL_DO 0x00002000 /* Disable Rx Own */
88#define GMAC_CONTROL_LM 0x00001000 /* Loop-back mode */
89#define GMAC_CONTROL_DM 0x00000800 /* Duplex Mode */
90#define GMAC_CONTROL_IPC 0x00000400 /* Checksum Offload */
91#define GMAC_CONTROL_DR 0x00000200 /* Disable Retry */
92#define GMAC_CONTROL_LUD 0x00000100 /* Link up/down */
93#define GMAC_CONTROL_ACS 0x00000080 /* Automatic Pad Stripping */
94#define GMAC_CONTROL_DC 0x00000010 /* Deferral Check */
95#define GMAC_CONTROL_TE 0x00000008 /* Transmitter Enable */
96#define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */
97
98#define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \
99 GMAC_CONTROL_IPC | GMAC_CONTROL_JE | GMAC_CONTROL_BE)
100
101/* GMAC Frame Filter defines */
102#define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */
103#define GMAC_FRAME_FILTER_HUC 0x00000002 /* Hash Unicast */
104#define GMAC_FRAME_FILTER_HMC 0x00000004 /* Hash Multicast */
105#define GMAC_FRAME_FILTER_DAIF 0x00000008 /* DA Inverse Filtering */
106#define GMAC_FRAME_FILTER_PM 0x00000010 /* Pass all multicast */
107#define GMAC_FRAME_FILTER_DBF 0x00000020 /* Disable Broadcast frames */
108#define GMAC_FRAME_FILTER_SAIF 0x00000100 /* Inverse Filtering */
109#define GMAC_FRAME_FILTER_SAF 0x00000200 /* Source Address Filter */
110#define GMAC_FRAME_FILTER_HPF 0x00000400 /* Hash or perfect Filter */
111#define GMAC_FRAME_FILTER_RA 0x80000000 /* Receive all mode */
112/* GMII ADDR defines */
113#define GMAC_MII_ADDR_WRITE 0x00000002 /* MII Write */
114#define GMAC_MII_ADDR_BUSY 0x00000001 /* MII Busy */
115/* GMAC FLOW CTRL defines */
116#define GMAC_FLOW_CTRL_PT_MASK 0xffff0000 /* Pause Time Mask */
117#define GMAC_FLOW_CTRL_PT_SHIFT 16
118#define GMAC_FLOW_CTRL_RFE 0x00000004 /* Rx Flow Control Enable */
119#define GMAC_FLOW_CTRL_TFE 0x00000002 /* Tx Flow Control Enable */
120#define GMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */
121
122/*--- DMA BLOCK defines ---*/
123/* DMA Bus Mode register defines */
124#define DMA_BUS_MODE_SFT_RESET 0x00000001 /* Software Reset */
125#define DMA_BUS_MODE_DA 0x00000002 /* Arbitration scheme */
126#define DMA_BUS_MODE_DSL_MASK 0x0000007c /* Descriptor Skip Length */
127#define DMA_BUS_MODE_DSL_SHIFT 2 /* (in DWORDS) */
128/* Programmable burst length (passed thorugh platform)*/
129#define DMA_BUS_MODE_PBL_MASK 0x00003f00 /* Programmable Burst Len */
130#define DMA_BUS_MODE_PBL_SHIFT 8
131
132enum rx_tx_priority_ratio {
133 double_ratio = 0x00004000, /*2:1 */
134 triple_ratio = 0x00008000, /*3:1 */
135 quadruple_ratio = 0x0000c000, /*4:1 */
136};
137
138#define DMA_BUS_MODE_FB 0x00010000 /* Fixed burst */
139#define DMA_BUS_MODE_RPBL_MASK 0x003e0000 /* Rx-Programmable Burst Len */
140#define DMA_BUS_MODE_RPBL_SHIFT 17
141#define DMA_BUS_MODE_USP 0x00800000
142#define DMA_BUS_MODE_4PBL 0x01000000
143#define DMA_BUS_MODE_AAL 0x02000000
144
145/* DMA CRS Control and Status Register Mapping */
146#define DMA_HOST_TX_DESC 0x00001048 /* Current Host Tx descriptor */
147#define DMA_HOST_RX_DESC 0x0000104c /* Current Host Rx descriptor */
148/* DMA Bus Mode register defines */
149#define DMA_BUS_PR_RATIO_MASK 0x0000c000 /* Rx/Tx priority ratio */
150#define DMA_BUS_PR_RATIO_SHIFT 14
151#define DMA_BUS_FB 0x00010000 /* Fixed Burst */
152
153/* DMA operation mode defines (start/stop tx/rx are placed in common header)*/
154#define DMA_CONTROL_DT 0x04000000 /* Disable Drop TCP/IP csum error */
155#define DMA_CONTROL_RSF 0x02000000 /* Receive Store and Forward */
156#define DMA_CONTROL_DFF 0x01000000 /* Disaable flushing */
157/* Theshold for Activating the FC */
158enum rfa {
159 act_full_minus_1 = 0x00800000,
160 act_full_minus_2 = 0x00800200,
161 act_full_minus_3 = 0x00800400,
162 act_full_minus_4 = 0x00800600,
163};
164/* Theshold for Deactivating the FC */
165enum rfd {
166 deac_full_minus_1 = 0x00400000,
167 deac_full_minus_2 = 0x00400800,
168 deac_full_minus_3 = 0x00401000,
169 deac_full_minus_4 = 0x00401800,
170};
171#define DMA_CONTROL_TSF 0x00200000 /* Transmit Store and Forward */
172#define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */
173
174enum ttc_control {
175 DMA_CONTROL_TTC_64 = 0x00000000,
176 DMA_CONTROL_TTC_128 = 0x00004000,
177 DMA_CONTROL_TTC_192 = 0x00008000,
178 DMA_CONTROL_TTC_256 = 0x0000c000,
179 DMA_CONTROL_TTC_40 = 0x00010000,
180 DMA_CONTROL_TTC_32 = 0x00014000,
181 DMA_CONTROL_TTC_24 = 0x00018000,
182 DMA_CONTROL_TTC_16 = 0x0001c000,
183};
184#define DMA_CONTROL_TC_TX_MASK 0xfffe3fff
185
186#define DMA_CONTROL_EFC 0x00000100
187#define DMA_CONTROL_FEF 0x00000080
188#define DMA_CONTROL_FUF 0x00000040
189
190enum rtc_control {
191 DMA_CONTROL_RTC_64 = 0x00000000,
192 DMA_CONTROL_RTC_32 = 0x00000008,
193 DMA_CONTROL_RTC_96 = 0x00000010,
194 DMA_CONTROL_RTC_128 = 0x00000018,
195};
196#define DMA_CONTROL_TC_RX_MASK 0xffffffe7
197
198#define DMA_CONTROL_OSF 0x00000004 /* Operate on second frame */
199
200/* MMC registers offset */
201#define GMAC_MMC_CTRL 0x100
202#define GMAC_MMC_RX_INTR 0x104
203#define GMAC_MMC_TX_INTR 0x108
204#define GMAC_MMC_RX_CSUM_OFFLOAD 0x208
diff --git a/drivers/net/stmmac/mac100.c b/drivers/net/stmmac/mac100.c
new file mode 100644
index 000000000000..625171b6062b
--- /dev/null
+++ b/drivers/net/stmmac/mac100.c
@@ -0,0 +1,517 @@
1/*******************************************************************************
2 This is the driver for the MAC 10/100 on-chip Ethernet controller
3 currently tested on all the ST boards based on STb7109 and stx7200 SoCs.
4
5 DWC Ether MAC 10/100 Universal version 4.0 has been used for developing
6 this code.
7
8 Copyright (C) 2007-2009 STMicroelectronics Ltd
9
10 This program is free software; you can redistribute it and/or modify it
11 under the terms and conditions of the GNU General Public License,
12 version 2, as published by the Free Software Foundation.
13
14 This program is distributed in the hope it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 more details.
18
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
22
23 The full GNU General Public License is included in this distribution in
24 the file called "COPYING".
25
26 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
27*******************************************************************************/
28
29#include <linux/netdevice.h>
30#include <linux/crc32.h>
31#include <linux/mii.h>
32#include <linux/phy.h>
33
34#include "common.h"
35#include "mac100.h"
36
37#undef MAC100_DEBUG
38/*#define MAC100_DEBUG*/
39#ifdef MAC100_DEBUG
40#define DBG(fmt, args...) printk(fmt, ## args)
41#else
42#define DBG(fmt, args...) do { } while (0)
43#endif
44
45static void mac100_core_init(unsigned long ioaddr)
46{
47 u32 value = readl(ioaddr + MAC_CONTROL);
48
49 writel((value | MAC_CORE_INIT), ioaddr + MAC_CONTROL);
50
51#ifdef STMMAC_VLAN_TAG_USED
52 writel(ETH_P_8021Q, ioaddr + MAC_VLAN1);
53#endif
54 return;
55}
56
57static void mac100_dump_mac_regs(unsigned long ioaddr)
58{
59 pr_info("\t----------------------------------------------\n"
60 "\t MAC100 CSR (base addr = 0x%8x)\n"
61 "\t----------------------------------------------\n",
62 (unsigned int)ioaddr);
63 pr_info("\tcontrol reg (offset 0x%x): 0x%08x\n", MAC_CONTROL,
64 readl(ioaddr + MAC_CONTROL));
65 pr_info("\taddr HI (offset 0x%x): 0x%08x\n ", MAC_ADDR_HIGH,
66 readl(ioaddr + MAC_ADDR_HIGH));
67 pr_info("\taddr LO (offset 0x%x): 0x%08x\n", MAC_ADDR_LOW,
68 readl(ioaddr + MAC_ADDR_LOW));
69 pr_info("\tmulticast hash HI (offset 0x%x): 0x%08x\n",
70 MAC_HASH_HIGH, readl(ioaddr + MAC_HASH_HIGH));
71 pr_info("\tmulticast hash LO (offset 0x%x): 0x%08x\n",
72 MAC_HASH_LOW, readl(ioaddr + MAC_HASH_LOW));
73 pr_info("\tflow control (offset 0x%x): 0x%08x\n",
74 MAC_FLOW_CTRL, readl(ioaddr + MAC_FLOW_CTRL));
75 pr_info("\tVLAN1 tag (offset 0x%x): 0x%08x\n", MAC_VLAN1,
76 readl(ioaddr + MAC_VLAN1));
77 pr_info("\tVLAN2 tag (offset 0x%x): 0x%08x\n", MAC_VLAN2,
78 readl(ioaddr + MAC_VLAN2));
79 pr_info("\n\tMAC management counter registers\n");
80 pr_info("\t MMC crtl (offset 0x%x): 0x%08x\n",
81 MMC_CONTROL, readl(ioaddr + MMC_CONTROL));
82 pr_info("\t MMC High Interrupt (offset 0x%x): 0x%08x\n",
83 MMC_HIGH_INTR, readl(ioaddr + MMC_HIGH_INTR));
84 pr_info("\t MMC Low Interrupt (offset 0x%x): 0x%08x\n",
85 MMC_LOW_INTR, readl(ioaddr + MMC_LOW_INTR));
86 pr_info("\t MMC High Interrupt Mask (offset 0x%x): 0x%08x\n",
87 MMC_HIGH_INTR_MASK, readl(ioaddr + MMC_HIGH_INTR_MASK));
88 pr_info("\t MMC Low Interrupt Mask (offset 0x%x): 0x%08x\n",
89 MMC_LOW_INTR_MASK, readl(ioaddr + MMC_LOW_INTR_MASK));
90 return;
91}
92
93static int mac100_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx,
94 u32 dma_rx)
95{
96 u32 value = readl(ioaddr + DMA_BUS_MODE);
97 /* DMA SW reset */
98 value |= DMA_BUS_MODE_SFT_RESET;
99 writel(value, ioaddr + DMA_BUS_MODE);
100 do {} while ((readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET));
101
102 /* Enable Application Access by writing to DMA CSR0 */
103 writel(DMA_BUS_MODE_DEFAULT | (pbl << DMA_BUS_MODE_PBL_SHIFT),
104 ioaddr + DMA_BUS_MODE);
105
106 /* Mask interrupts by writing to CSR7 */
107 writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA);
108
109 /* The base address of the RX/TX descriptor lists must be written into
110 * DMA CSR3 and CSR4, respectively. */
111 writel(dma_tx, ioaddr + DMA_TX_BASE_ADDR);
112 writel(dma_rx, ioaddr + DMA_RCV_BASE_ADDR);
113
114 return 0;
115}
116
117/* Store and Forward capability is not used at all..
118 * The transmit threshold can be programmed by
119 * setting the TTC bits in the DMA control register.*/
120static void mac100_dma_operation_mode(unsigned long ioaddr, int txmode,
121 int rxmode)
122{
123 u32 csr6 = readl(ioaddr + DMA_CONTROL);
124
125 if (txmode <= 32)
126 csr6 |= DMA_CONTROL_TTC_32;
127 else if (txmode <= 64)
128 csr6 |= DMA_CONTROL_TTC_64;
129 else
130 csr6 |= DMA_CONTROL_TTC_128;
131
132 writel(csr6, ioaddr + DMA_CONTROL);
133
134 return;
135}
136
137static void mac100_dump_dma_regs(unsigned long ioaddr)
138{
139 int i;
140
141 DBG(KERN_DEBUG "MAC100 DMA CSR \n");
142 for (i = 0; i < 9; i++)
143 pr_debug("\t CSR%d (offset 0x%x): 0x%08x\n", i,
144 (DMA_BUS_MODE + i * 4),
145 readl(ioaddr + DMA_BUS_MODE + i * 4));
146 DBG(KERN_DEBUG "\t CSR20 (offset 0x%x): 0x%08x\n",
147 DMA_CUR_TX_BUF_ADDR, readl(ioaddr + DMA_CUR_TX_BUF_ADDR));
148 DBG(KERN_DEBUG "\t CSR21 (offset 0x%x): 0x%08x\n",
149 DMA_CUR_RX_BUF_ADDR, readl(ioaddr + DMA_CUR_RX_BUF_ADDR));
150 return;
151}
152
153/* DMA controller has two counters to track the number of
154 the receive missed frames. */
155static void mac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x,
156 unsigned long ioaddr)
157{
158 struct net_device_stats *stats = (struct net_device_stats *)data;
159 u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR);
160
161 if (unlikely(csr8)) {
162 if (csr8 & DMA_MISSED_FRAME_OVE) {
163 stats->rx_over_errors += 0x800;
164 x->rx_overflow_cntr += 0x800;
165 } else {
166 unsigned int ove_cntr;
167 ove_cntr = ((csr8 & DMA_MISSED_FRAME_OVE_CNTR) >> 17);
168 stats->rx_over_errors += ove_cntr;
169 x->rx_overflow_cntr += ove_cntr;
170 }
171
172 if (csr8 & DMA_MISSED_FRAME_OVE_M) {
173 stats->rx_missed_errors += 0xffff;
174 x->rx_missed_cntr += 0xffff;
175 } else {
176 unsigned int miss_f = (csr8 & DMA_MISSED_FRAME_M_CNTR);
177 stats->rx_missed_errors += miss_f;
178 x->rx_missed_cntr += miss_f;
179 }
180 }
181 return;
182}
183
184static int mac100_get_tx_frame_status(void *data, struct stmmac_extra_stats *x,
185 struct dma_desc *p, unsigned long ioaddr)
186{
187 int ret = 0;
188 struct net_device_stats *stats = (struct net_device_stats *)data;
189
190 if (unlikely(p->des01.tx.error_summary)) {
191 if (unlikely(p->des01.tx.underflow_error)) {
192 x->tx_underflow++;
193 stats->tx_fifo_errors++;
194 }
195 if (unlikely(p->des01.tx.no_carrier)) {
196 x->tx_carrier++;
197 stats->tx_carrier_errors++;
198 }
199 if (unlikely(p->des01.tx.loss_carrier)) {
200 x->tx_losscarrier++;
201 stats->tx_carrier_errors++;
202 }
203 if (unlikely((p->des01.tx.excessive_deferral) ||
204 (p->des01.tx.excessive_collisions) ||
205 (p->des01.tx.late_collision)))
206 stats->collisions += p->des01.tx.collision_count;
207 ret = -1;
208 }
209 if (unlikely(p->des01.tx.heartbeat_fail)) {
210 x->tx_heartbeat++;
211 stats->tx_heartbeat_errors++;
212 ret = -1;
213 }
214 if (unlikely(p->des01.tx.deferred))
215 x->tx_deferred++;
216
217 return ret;
218}
219
220static int mac100_get_tx_len(struct dma_desc *p)
221{
222 return p->des01.tx.buffer1_size;
223}
224
225/* This function verifies if each incoming frame has some errors
226 * and, if required, updates the multicast statistics.
227 * In case of success, it returns csum_none becasue the device
228 * is not able to compute the csum in HW. */
229static int mac100_get_rx_frame_status(void *data, struct stmmac_extra_stats *x,
230 struct dma_desc *p)
231{
232 int ret = csum_none;
233 struct net_device_stats *stats = (struct net_device_stats *)data;
234
235 if (unlikely(p->des01.rx.last_descriptor == 0)) {
236 pr_warning("mac100 Error: Oversized Ethernet "
237 "frame spanned multiple buffers\n");
238 stats->rx_length_errors++;
239 return discard_frame;
240 }
241
242 if (unlikely(p->des01.rx.error_summary)) {
243 if (unlikely(p->des01.rx.descriptor_error))
244 x->rx_desc++;
245 if (unlikely(p->des01.rx.partial_frame_error))
246 x->rx_partial++;
247 if (unlikely(p->des01.rx.run_frame))
248 x->rx_runt++;
249 if (unlikely(p->des01.rx.frame_too_long))
250 x->rx_toolong++;
251 if (unlikely(p->des01.rx.collision)) {
252 x->rx_collision++;
253 stats->collisions++;
254 }
255 if (unlikely(p->des01.rx.crc_error)) {
256 x->rx_crc++;
257 stats->rx_crc_errors++;
258 }
259 ret = discard_frame;
260 }
261 if (unlikely(p->des01.rx.dribbling))
262 ret = discard_frame;
263
264 if (unlikely(p->des01.rx.length_error)) {
265 x->rx_lenght++;
266 ret = discard_frame;
267 }
268 if (unlikely(p->des01.rx.mii_error)) {
269 x->rx_mii++;
270 ret = discard_frame;
271 }
272 if (p->des01.rx.multicast_frame) {
273 x->rx_multicast++;
274 stats->multicast++;
275 }
276 return ret;
277}
278
279static void mac100_irq_status(unsigned long ioaddr)
280{
281 return;
282}
283
284static void mac100_set_umac_addr(unsigned long ioaddr, unsigned char *addr,
285 unsigned int reg_n)
286{
287 stmmac_set_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW);
288}
289
290static void mac100_get_umac_addr(unsigned long ioaddr, unsigned char *addr,
291 unsigned int reg_n)
292{
293 stmmac_get_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW);
294}
295
296static void mac100_set_filter(struct net_device *dev)
297{
298 unsigned long ioaddr = dev->base_addr;
299 u32 value = readl(ioaddr + MAC_CONTROL);
300
301 if (dev->flags & IFF_PROMISC) {
302 value |= MAC_CONTROL_PR;
303 value &= ~(MAC_CONTROL_PM | MAC_CONTROL_IF | MAC_CONTROL_HO |
304 MAC_CONTROL_HP);
305 } else if ((dev->mc_count > HASH_TABLE_SIZE)
306 || (dev->flags & IFF_ALLMULTI)) {
307 value |= MAC_CONTROL_PM;
308 value &= ~(MAC_CONTROL_PR | MAC_CONTROL_IF | MAC_CONTROL_HO);
309 writel(0xffffffff, ioaddr + MAC_HASH_HIGH);
310 writel(0xffffffff, ioaddr + MAC_HASH_LOW);
311 } else if (dev->mc_count == 0) { /* no multicast */
312 value &= ~(MAC_CONTROL_PM | MAC_CONTROL_PR | MAC_CONTROL_IF |
313 MAC_CONTROL_HO | MAC_CONTROL_HP);
314 } else {
315 int i;
316 u32 mc_filter[2];
317 struct dev_mc_list *mclist;
318
319 /* Perfect filter mode for physical address and Hash
320 filter for multicast */
321 value |= MAC_CONTROL_HP;
322 value &= ~(MAC_CONTROL_PM | MAC_CONTROL_PR | MAC_CONTROL_IF
323 | MAC_CONTROL_HO);
324
325 memset(mc_filter, 0, sizeof(mc_filter));
326 for (i = 0, mclist = dev->mc_list;
327 mclist && i < dev->mc_count; i++, mclist = mclist->next) {
328 /* The upper 6 bits of the calculated CRC are used to
329 * index the contens of the hash table */
330 int bit_nr =
331 ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
332 /* The most significant bit determines the register to
333 * use (H/L) while the other 5 bits determine the bit
334 * within the register. */
335 mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
336 }
337 writel(mc_filter[0], ioaddr + MAC_HASH_LOW);
338 writel(mc_filter[1], ioaddr + MAC_HASH_HIGH);
339 }
340
341 writel(value, ioaddr + MAC_CONTROL);
342
343 DBG(KERN_INFO "%s: CTRL reg: 0x%08x Hash regs: "
344 "HI 0x%08x, LO 0x%08x\n",
345 __func__, readl(ioaddr + MAC_CONTROL),
346 readl(ioaddr + MAC_HASH_HIGH), readl(ioaddr + MAC_HASH_LOW));
347 return;
348}
349
350static void mac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
351 unsigned int fc, unsigned int pause_time)
352{
353 unsigned int flow = MAC_FLOW_CTRL_ENABLE;
354
355 if (duplex)
356 flow |= (pause_time << MAC_FLOW_CTRL_PT_SHIFT);
357 writel(flow, ioaddr + MAC_FLOW_CTRL);
358
359 return;
360}
361
362/* No PMT module supported in our SoC for the Ethernet Controller. */
363static void mac100_pmt(unsigned long ioaddr, unsigned long mode)
364{
365 return;
366}
367
368static void mac100_init_rx_desc(struct dma_desc *p, unsigned int ring_size,
369 int disable_rx_ic)
370{
371 int i;
372 for (i = 0; i < ring_size; i++) {
373 p->des01.rx.own = 1;
374 p->des01.rx.buffer1_size = BUF_SIZE_2KiB - 1;
375 if (i == ring_size - 1)
376 p->des01.rx.end_ring = 1;
377 if (disable_rx_ic)
378 p->des01.rx.disable_ic = 1;
379 p++;
380 }
381 return;
382}
383
384static void mac100_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
385{
386 int i;
387 for (i = 0; i < ring_size; i++) {
388 p->des01.tx.own = 0;
389 if (i == ring_size - 1)
390 p->des01.tx.end_ring = 1;
391 p++;
392 }
393 return;
394}
395
396static int mac100_get_tx_owner(struct dma_desc *p)
397{
398 return p->des01.tx.own;
399}
400
401static int mac100_get_rx_owner(struct dma_desc *p)
402{
403 return p->des01.rx.own;
404}
405
406static void mac100_set_tx_owner(struct dma_desc *p)
407{
408 p->des01.tx.own = 1;
409}
410
411static void mac100_set_rx_owner(struct dma_desc *p)
412{
413 p->des01.rx.own = 1;
414}
415
416static int mac100_get_tx_ls(struct dma_desc *p)
417{
418 return p->des01.tx.last_segment;
419}
420
421static void mac100_release_tx_desc(struct dma_desc *p)
422{
423 int ter = p->des01.tx.end_ring;
424
425 /* clean field used within the xmit */
426 p->des01.tx.first_segment = 0;
427 p->des01.tx.last_segment = 0;
428 p->des01.tx.buffer1_size = 0;
429
430 /* clean status reported */
431 p->des01.tx.error_summary = 0;
432 p->des01.tx.underflow_error = 0;
433 p->des01.tx.no_carrier = 0;
434 p->des01.tx.loss_carrier = 0;
435 p->des01.tx.excessive_deferral = 0;
436 p->des01.tx.excessive_collisions = 0;
437 p->des01.tx.late_collision = 0;
438 p->des01.tx.heartbeat_fail = 0;
439 p->des01.tx.deferred = 0;
440
441 /* set termination field */
442 p->des01.tx.end_ring = ter;
443
444 return;
445}
446
447static void mac100_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
448 int csum_flag)
449{
450 p->des01.tx.first_segment = is_fs;
451 p->des01.tx.buffer1_size = len;
452}
453
454static void mac100_clear_tx_ic(struct dma_desc *p)
455{
456 p->des01.tx.interrupt = 0;
457}
458
459static void mac100_close_tx_desc(struct dma_desc *p)
460{
461 p->des01.tx.last_segment = 1;
462 p->des01.tx.interrupt = 1;
463}
464
465static int mac100_get_rx_frame_len(struct dma_desc *p)
466{
467 return p->des01.rx.frame_length;
468}
469
470struct stmmac_ops mac100_driver = {
471 .core_init = mac100_core_init,
472 .dump_mac_regs = mac100_dump_mac_regs,
473 .dma_init = mac100_dma_init,
474 .dump_dma_regs = mac100_dump_dma_regs,
475 .dma_mode = mac100_dma_operation_mode,
476 .dma_diagnostic_fr = mac100_dma_diagnostic_fr,
477 .tx_status = mac100_get_tx_frame_status,
478 .rx_status = mac100_get_rx_frame_status,
479 .get_tx_len = mac100_get_tx_len,
480 .set_filter = mac100_set_filter,
481 .flow_ctrl = mac100_flow_ctrl,
482 .pmt = mac100_pmt,
483 .init_rx_desc = mac100_init_rx_desc,
484 .init_tx_desc = mac100_init_tx_desc,
485 .get_tx_owner = mac100_get_tx_owner,
486 .get_rx_owner = mac100_get_rx_owner,
487 .release_tx_desc = mac100_release_tx_desc,
488 .prepare_tx_desc = mac100_prepare_tx_desc,
489 .clear_tx_ic = mac100_clear_tx_ic,
490 .close_tx_desc = mac100_close_tx_desc,
491 .get_tx_ls = mac100_get_tx_ls,
492 .set_tx_owner = mac100_set_tx_owner,
493 .set_rx_owner = mac100_set_rx_owner,
494 .get_rx_frame_len = mac100_get_rx_frame_len,
495 .host_irq_status = mac100_irq_status,
496 .set_umac_addr = mac100_set_umac_addr,
497 .get_umac_addr = mac100_get_umac_addr,
498};
499
500struct mac_device_info *mac100_setup(unsigned long ioaddr)
501{
502 struct mac_device_info *mac;
503
504 mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL);
505
506 pr_info("\tMAC 10/100\n");
507
508 mac->ops = &mac100_driver;
509 mac->hw.pmt = PMT_NOT_SUPPORTED;
510 mac->hw.link.port = MAC_CONTROL_PS;
511 mac->hw.link.duplex = MAC_CONTROL_F;
512 mac->hw.link.speed = 0;
513 mac->hw.mii.addr = MAC_MII_ADDR;
514 mac->hw.mii.data = MAC_MII_DATA;
515
516 return mac;
517}
diff --git a/drivers/net/stmmac/mac100.h b/drivers/net/stmmac/mac100.h
new file mode 100644
index 000000000000..0f8f110d004a
--- /dev/null
+++ b/drivers/net/stmmac/mac100.h
@@ -0,0 +1,116 @@
1/*******************************************************************************
2 MAC 10/100 Header File
3
4 Copyright (C) 2007-2009 STMicroelectronics Ltd
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
23*******************************************************************************/
24
25/*----------------------------------------------------------------------------
26 * MAC BLOCK defines
27 *---------------------------------------------------------------------------*/
28/* MAC CSR offset */
29#define MAC_CONTROL 0x00000000 /* MAC Control */
30#define MAC_ADDR_HIGH 0x00000004 /* MAC Address High */
31#define MAC_ADDR_LOW 0x00000008 /* MAC Address Low */
32#define MAC_HASH_HIGH 0x0000000c /* Multicast Hash Table High */
33#define MAC_HASH_LOW 0x00000010 /* Multicast Hash Table Low */
34#define MAC_MII_ADDR 0x00000014 /* MII Address */
35#define MAC_MII_DATA 0x00000018 /* MII Data */
36#define MAC_FLOW_CTRL 0x0000001c /* Flow Control */
37#define MAC_VLAN1 0x00000020 /* VLAN1 Tag */
38#define MAC_VLAN2 0x00000024 /* VLAN2 Tag */
39
40/* MAC CTRL defines */
41#define MAC_CONTROL_RA 0x80000000 /* Receive All Mode */
42#define MAC_CONTROL_BLE 0x40000000 /* Endian Mode */
43#define MAC_CONTROL_HBD 0x10000000 /* Heartbeat Disable */
44#define MAC_CONTROL_PS 0x08000000 /* Port Select */
45#define MAC_CONTROL_DRO 0x00800000 /* Disable Receive Own */
46#define MAC_CONTROL_EXT_LOOPBACK 0x00400000 /* Reserved (ext loopback?) */
47#define MAC_CONTROL_OM 0x00200000 /* Loopback Operating Mode */
48#define MAC_CONTROL_F 0x00100000 /* Full Duplex Mode */
49#define MAC_CONTROL_PM 0x00080000 /* Pass All Multicast */
50#define MAC_CONTROL_PR 0x00040000 /* Promiscuous Mode */
51#define MAC_CONTROL_IF 0x00020000 /* Inverse Filtering */
52#define MAC_CONTROL_PB 0x00010000 /* Pass Bad Frames */
53#define MAC_CONTROL_HO 0x00008000 /* Hash Only Filtering Mode */
54#define MAC_CONTROL_HP 0x00002000 /* Hash/Perfect Filtering Mode */
55#define MAC_CONTROL_LCC 0x00001000 /* Late Collision Control */
56#define MAC_CONTROL_DBF 0x00000800 /* Disable Broadcast Frames */
57#define MAC_CONTROL_DRTY 0x00000400 /* Disable Retry */
58#define MAC_CONTROL_ASTP 0x00000100 /* Automatic Pad Stripping */
59#define MAC_CONTROL_BOLMT_10 0x00000000 /* Back Off Limit 10 */
60#define MAC_CONTROL_BOLMT_8 0x00000040 /* Back Off Limit 8 */
61#define MAC_CONTROL_BOLMT_4 0x00000080 /* Back Off Limit 4 */
62#define MAC_CONTROL_BOLMT_1 0x000000c0 /* Back Off Limit 1 */
63#define MAC_CONTROL_DC 0x00000020 /* Deferral Check */
64#define MAC_CONTROL_TE 0x00000008 /* Transmitter Enable */
65#define MAC_CONTROL_RE 0x00000004 /* Receiver Enable */
66
67#define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP)
68
69/* MAC FLOW CTRL defines */
70#define MAC_FLOW_CTRL_PT_MASK 0xffff0000 /* Pause Time Mask */
71#define MAC_FLOW_CTRL_PT_SHIFT 16
72#define MAC_FLOW_CTRL_PASS 0x00000004 /* Pass Control Frames */
73#define MAC_FLOW_CTRL_ENABLE 0x00000002 /* Flow Control Enable */
74#define MAC_FLOW_CTRL_PAUSE 0x00000001 /* Flow Control Busy ... */
75
76/* MII ADDR defines */
77#define MAC_MII_ADDR_WRITE 0x00000002 /* MII Write */
78#define MAC_MII_ADDR_BUSY 0x00000001 /* MII Busy */
79
80/*----------------------------------------------------------------------------
81 * DMA BLOCK defines
82 *---------------------------------------------------------------------------*/
83
84/* DMA Bus Mode register defines */
85#define DMA_BUS_MODE_DBO 0x00100000 /* Descriptor Byte Ordering */
86#define DMA_BUS_MODE_BLE 0x00000080 /* Big Endian/Little Endian */
87#define DMA_BUS_MODE_PBL_MASK 0x00003f00 /* Programmable Burst Len */
88#define DMA_BUS_MODE_PBL_SHIFT 8
89#define DMA_BUS_MODE_DSL_MASK 0x0000007c /* Descriptor Skip Length */
90#define DMA_BUS_MODE_DSL_SHIFT 2 /* (in DWORDS) */
91#define DMA_BUS_MODE_BAR_BUS 0x00000002 /* Bar-Bus Arbitration */
92#define DMA_BUS_MODE_SFT_RESET 0x00000001 /* Software Reset */
93#define DMA_BUS_MODE_DEFAULT 0x00000000
94
95/* DMA Control register defines */
96#define DMA_CONTROL_SF 0x00200000 /* Store And Forward */
97
98/* Transmit Threshold Control */
99enum ttc_control {
100 DMA_CONTROL_TTC_DEFAULT = 0x00000000, /* Threshold is 32 DWORDS */
101 DMA_CONTROL_TTC_64 = 0x00004000, /* Threshold is 64 DWORDS */
102 DMA_CONTROL_TTC_128 = 0x00008000, /* Threshold is 128 DWORDS */
103 DMA_CONTROL_TTC_256 = 0x0000c000, /* Threshold is 256 DWORDS */
104 DMA_CONTROL_TTC_18 = 0x00400000, /* Threshold is 18 DWORDS */
105 DMA_CONTROL_TTC_24 = 0x00404000, /* Threshold is 24 DWORDS */
106 DMA_CONTROL_TTC_32 = 0x00408000, /* Threshold is 32 DWORDS */
107 DMA_CONTROL_TTC_40 = 0x0040c000, /* Threshold is 40 DWORDS */
108 DMA_CONTROL_SE = 0x00000008, /* Stop On Empty */
109 DMA_CONTROL_OSF = 0x00000004, /* Operate On 2nd Frame */
110};
111
112/* STMAC110 DMA Missed Frame Counter register defines */
113#define DMA_MISSED_FRAME_OVE 0x10000000 /* FIFO Overflow Overflow */
114#define DMA_MISSED_FRAME_OVE_CNTR 0x0ffe0000 /* Overflow Frame Counter */
115#define DMA_MISSED_FRAME_OVE_M 0x00010000 /* Missed Frame Overflow */
116#define DMA_MISSED_FRAME_M_CNTR 0x0000ffff /* Missed Frame Couinter */
diff --git a/drivers/net/stmmac/stmmac.h b/drivers/net/stmmac/stmmac.h
new file mode 100644
index 000000000000..6d2eae3040e5
--- /dev/null
+++ b/drivers/net/stmmac/stmmac.h
@@ -0,0 +1,98 @@
1/*******************************************************************************
2 Copyright (C) 2007-2009 STMicroelectronics Ltd
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms and conditions of the GNU General Public License,
6 version 2, as published by the Free Software Foundation.
7
8 This program is distributed in the hope it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16
17 The full GNU General Public License is included in this distribution in
18 the file called "COPYING".
19
20 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
21*******************************************************************************/
22
23#define DRV_MODULE_VERSION "Oct_09"
24
25#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
26#define STMMAC_VLAN_TAG_USED
27#include <linux/if_vlan.h>
28#endif
29
30#include "common.h"
31#ifdef CONFIG_STMMAC_TIMER
32#include "stmmac_timer.h"
33#endif
34
35struct stmmac_priv {
36 /* Frequently used values are kept adjacent for cache effect */
37 struct dma_desc *dma_tx ____cacheline_aligned;
38 dma_addr_t dma_tx_phy;
39 struct sk_buff **tx_skbuff;
40 unsigned int cur_tx;
41 unsigned int dirty_tx;
42 unsigned int dma_tx_size;
43 int tx_coe;
44 int tx_coalesce;
45
46 struct dma_desc *dma_rx ;
47 unsigned int cur_rx;
48 unsigned int dirty_rx;
49 struct sk_buff **rx_skbuff;
50 dma_addr_t *rx_skbuff_dma;
51 struct sk_buff_head rx_recycle;
52
53 struct net_device *dev;
54 int is_gmac;
55 dma_addr_t dma_rx_phy;
56 unsigned int dma_rx_size;
57 int rx_csum;
58 unsigned int dma_buf_sz;
59 struct device *device;
60 struct mac_device_info *mac_type;
61
62 struct stmmac_extra_stats xstats;
63 struct napi_struct napi;
64
65 phy_interface_t phy_interface;
66 int pbl;
67 int bus_id;
68 int phy_addr;
69 int phy_mask;
70 int (*phy_reset) (void *priv);
71 void (*fix_mac_speed) (void *priv, unsigned int speed);
72 void *bsp_priv;
73
74 int phy_irq;
75 struct phy_device *phydev;
76 int oldlink;
77 int speed;
78 int oldduplex;
79 unsigned int flow_ctrl;
80 unsigned int pause;
81 struct mii_bus *mii;
82
83 u32 msg_enable;
84 spinlock_t lock;
85 int wolopts;
86 int wolenabled;
87 int shutdown;
88#ifdef CONFIG_STMMAC_TIMER
89 struct stmmac_timer *tm;
90#endif
91#ifdef STMMAC_VLAN_TAG_USED
92 struct vlan_group *vlgrp;
93#endif
94};
95
96extern int stmmac_mdio_unregister(struct net_device *ndev);
97extern int stmmac_mdio_register(struct net_device *ndev);
98extern void stmmac_set_ethtool_ops(struct net_device *netdev);
diff --git a/drivers/net/stmmac/stmmac_ethtool.c b/drivers/net/stmmac/stmmac_ethtool.c
new file mode 100644
index 000000000000..694ebe6a0758
--- /dev/null
+++ b/drivers/net/stmmac/stmmac_ethtool.c
@@ -0,0 +1,395 @@
1/*******************************************************************************
2 STMMAC Ethtool support
3
4 Copyright (C) 2007-2009 STMicroelectronics Ltd
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
23*******************************************************************************/
24
25#include <linux/etherdevice.h>
26#include <linux/ethtool.h>
27#include <linux/mii.h>
28#include <linux/phy.h>
29
30#include "stmmac.h"
31
32#define REG_SPACE_SIZE 0x1054
33#define MAC100_ETHTOOL_NAME "st_mac100"
34#define GMAC_ETHTOOL_NAME "st_gmac"
35
36struct stmmac_stats {
37 char stat_string[ETH_GSTRING_LEN];
38 int sizeof_stat;
39 int stat_offset;
40};
41
42#define STMMAC_STAT(m) \
43 { #m, FIELD_SIZEOF(struct stmmac_extra_stats, m), \
44 offsetof(struct stmmac_priv, xstats.m)}
45
46static const struct stmmac_stats stmmac_gstrings_stats[] = {
47 STMMAC_STAT(tx_underflow),
48 STMMAC_STAT(tx_carrier),
49 STMMAC_STAT(tx_losscarrier),
50 STMMAC_STAT(tx_heartbeat),
51 STMMAC_STAT(tx_deferred),
52 STMMAC_STAT(tx_vlan),
53 STMMAC_STAT(rx_vlan),
54 STMMAC_STAT(tx_jabber),
55 STMMAC_STAT(tx_frame_flushed),
56 STMMAC_STAT(tx_payload_error),
57 STMMAC_STAT(tx_ip_header_error),
58 STMMAC_STAT(rx_desc),
59 STMMAC_STAT(rx_partial),
60 STMMAC_STAT(rx_runt),
61 STMMAC_STAT(rx_toolong),
62 STMMAC_STAT(rx_collision),
63 STMMAC_STAT(rx_crc),
64 STMMAC_STAT(rx_lenght),
65 STMMAC_STAT(rx_mii),
66 STMMAC_STAT(rx_multicast),
67 STMMAC_STAT(rx_gmac_overflow),
68 STMMAC_STAT(rx_watchdog),
69 STMMAC_STAT(da_rx_filter_fail),
70 STMMAC_STAT(sa_rx_filter_fail),
71 STMMAC_STAT(rx_missed_cntr),
72 STMMAC_STAT(rx_overflow_cntr),
73 STMMAC_STAT(tx_undeflow_irq),
74 STMMAC_STAT(tx_process_stopped_irq),
75 STMMAC_STAT(tx_jabber_irq),
76 STMMAC_STAT(rx_overflow_irq),
77 STMMAC_STAT(rx_buf_unav_irq),
78 STMMAC_STAT(rx_process_stopped_irq),
79 STMMAC_STAT(rx_watchdog_irq),
80 STMMAC_STAT(tx_early_irq),
81 STMMAC_STAT(fatal_bus_error_irq),
82 STMMAC_STAT(threshold),
83 STMMAC_STAT(tx_pkt_n),
84 STMMAC_STAT(rx_pkt_n),
85 STMMAC_STAT(poll_n),
86 STMMAC_STAT(sched_timer_n),
87 STMMAC_STAT(normal_irq_n),
88};
89#define STMMAC_STATS_LEN ARRAY_SIZE(stmmac_gstrings_stats)
90
91void stmmac_ethtool_getdrvinfo(struct net_device *dev,
92 struct ethtool_drvinfo *info)
93{
94 struct stmmac_priv *priv = netdev_priv(dev);
95
96 if (!priv->is_gmac)
97 strcpy(info->driver, MAC100_ETHTOOL_NAME);
98 else
99 strcpy(info->driver, GMAC_ETHTOOL_NAME);
100
101 strcpy(info->version, DRV_MODULE_VERSION);
102 info->fw_version[0] = '\0';
103 info->n_stats = STMMAC_STATS_LEN;
104 return;
105}
106
107int stmmac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
108{
109 struct stmmac_priv *priv = netdev_priv(dev);
110 struct phy_device *phy = priv->phydev;
111 int rc;
112 if (phy == NULL) {
113 pr_err("%s: %s: PHY is not registered\n",
114 __func__, dev->name);
115 return -ENODEV;
116 }
117 if (!netif_running(dev)) {
118 pr_err("%s: interface is disabled: we cannot track "
119 "link speed / duplex setting\n", dev->name);
120 return -EBUSY;
121 }
122 cmd->transceiver = XCVR_INTERNAL;
123 spin_lock_irq(&priv->lock);
124 rc = phy_ethtool_gset(phy, cmd);
125 spin_unlock_irq(&priv->lock);
126 return rc;
127}
128
129int stmmac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
130{
131 struct stmmac_priv *priv = netdev_priv(dev);
132 struct phy_device *phy = priv->phydev;
133 int rc;
134
135 spin_lock(&priv->lock);
136 rc = phy_ethtool_sset(phy, cmd);
137 spin_unlock(&priv->lock);
138
139 return rc;
140}
141
142u32 stmmac_ethtool_getmsglevel(struct net_device *dev)
143{
144 struct stmmac_priv *priv = netdev_priv(dev);
145 return priv->msg_enable;
146}
147
148void stmmac_ethtool_setmsglevel(struct net_device *dev, u32 level)
149{
150 struct stmmac_priv *priv = netdev_priv(dev);
151 priv->msg_enable = level;
152
153}
154
155int stmmac_check_if_running(struct net_device *dev)
156{
157 if (!netif_running(dev))
158 return -EBUSY;
159 return 0;
160}
161
162int stmmac_ethtool_get_regs_len(struct net_device *dev)
163{
164 return REG_SPACE_SIZE;
165}
166
167void stmmac_ethtool_gregs(struct net_device *dev,
168 struct ethtool_regs *regs, void *space)
169{
170 int i;
171 u32 *reg_space = (u32 *) space;
172
173 struct stmmac_priv *priv = netdev_priv(dev);
174
175 memset(reg_space, 0x0, REG_SPACE_SIZE);
176
177 if (!priv->is_gmac) {
178 /* MAC registers */
179 for (i = 0; i < 12; i++)
180 reg_space[i] = readl(dev->base_addr + (i * 4));
181 /* DMA registers */
182 for (i = 0; i < 9; i++)
183 reg_space[i + 12] =
184 readl(dev->base_addr + (DMA_BUS_MODE + (i * 4)));
185 reg_space[22] = readl(dev->base_addr + DMA_CUR_TX_BUF_ADDR);
186 reg_space[23] = readl(dev->base_addr + DMA_CUR_RX_BUF_ADDR);
187 } else {
188 /* MAC registers */
189 for (i = 0; i < 55; i++)
190 reg_space[i] = readl(dev->base_addr + (i * 4));
191 /* DMA registers */
192 for (i = 0; i < 22; i++)
193 reg_space[i + 55] =
194 readl(dev->base_addr + (DMA_BUS_MODE + (i * 4)));
195 }
196
197 return;
198}
199
200int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
201{
202 if (data)
203 netdev->features |= NETIF_F_HW_CSUM;
204 else
205 netdev->features &= ~NETIF_F_HW_CSUM;
206
207 return 0;
208}
209
210u32 stmmac_ethtool_get_rx_csum(struct net_device *dev)
211{
212 struct stmmac_priv *priv = netdev_priv(dev);
213
214 return priv->rx_csum;
215}
216
217static void
218stmmac_get_pauseparam(struct net_device *netdev,
219 struct ethtool_pauseparam *pause)
220{
221 struct stmmac_priv *priv = netdev_priv(netdev);
222
223 spin_lock(&priv->lock);
224
225 pause->rx_pause = 0;
226 pause->tx_pause = 0;
227 pause->autoneg = priv->phydev->autoneg;
228
229 if (priv->flow_ctrl & FLOW_RX)
230 pause->rx_pause = 1;
231 if (priv->flow_ctrl & FLOW_TX)
232 pause->tx_pause = 1;
233
234 spin_unlock(&priv->lock);
235 return;
236}
237
238static int
239stmmac_set_pauseparam(struct net_device *netdev,
240 struct ethtool_pauseparam *pause)
241{
242 struct stmmac_priv *priv = netdev_priv(netdev);
243 struct phy_device *phy = priv->phydev;
244 int new_pause = FLOW_OFF;
245 int ret = 0;
246
247 spin_lock(&priv->lock);
248
249 if (pause->rx_pause)
250 new_pause |= FLOW_RX;
251 if (pause->tx_pause)
252 new_pause |= FLOW_TX;
253
254 priv->flow_ctrl = new_pause;
255
256 if (phy->autoneg) {
257 if (netif_running(netdev)) {
258 struct ethtool_cmd cmd;
259 /* auto-negotiation automatically restarted */
260 cmd.cmd = ETHTOOL_NWAY_RST;
261 cmd.supported = phy->supported;
262 cmd.advertising = phy->advertising;
263 cmd.autoneg = phy->autoneg;
264 cmd.speed = phy->speed;
265 cmd.duplex = phy->duplex;
266 cmd.phy_address = phy->addr;
267 ret = phy_ethtool_sset(phy, &cmd);
268 }
269 } else {
270 unsigned long ioaddr = netdev->base_addr;
271 priv->mac_type->ops->flow_ctrl(ioaddr, phy->duplex,
272 priv->flow_ctrl, priv->pause);
273 }
274 spin_unlock(&priv->lock);
275 return ret;
276}
277
278static void stmmac_get_ethtool_stats(struct net_device *dev,
279 struct ethtool_stats *dummy, u64 *data)
280{
281 struct stmmac_priv *priv = netdev_priv(dev);
282 unsigned long ioaddr = dev->base_addr;
283 int i;
284
285 /* Update HW stats if supported */
286 priv->mac_type->ops->dma_diagnostic_fr(&dev->stats, &priv->xstats,
287 ioaddr);
288
289 for (i = 0; i < STMMAC_STATS_LEN; i++) {
290 char *p = (char *)priv + stmmac_gstrings_stats[i].stat_offset;
291 data[i] = (stmmac_gstrings_stats[i].sizeof_stat ==
292 sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
293 }
294
295 return;
296}
297
298static int stmmac_get_sset_count(struct net_device *netdev, int sset)
299{
300 switch (sset) {
301 case ETH_SS_STATS:
302 return STMMAC_STATS_LEN;
303 default:
304 return -EOPNOTSUPP;
305 }
306}
307
308static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
309{
310 int i;
311 u8 *p = data;
312
313 switch (stringset) {
314 case ETH_SS_STATS:
315 for (i = 0; i < STMMAC_STATS_LEN; i++) {
316 memcpy(p, stmmac_gstrings_stats[i].stat_string,
317 ETH_GSTRING_LEN);
318 p += ETH_GSTRING_LEN;
319 }
320 break;
321 default:
322 WARN_ON(1);
323 break;
324 }
325 return;
326}
327
328/* Currently only support WOL through Magic packet. */
329static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
330{
331 struct stmmac_priv *priv = netdev_priv(dev);
332
333 spin_lock_irq(&priv->lock);
334 if (priv->wolenabled == PMT_SUPPORTED) {
335 wol->supported = WAKE_MAGIC;
336 wol->wolopts = priv->wolopts;
337 }
338 spin_unlock_irq(&priv->lock);
339}
340
341static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
342{
343 struct stmmac_priv *priv = netdev_priv(dev);
344 u32 support = WAKE_MAGIC;
345
346 if (priv->wolenabled == PMT_NOT_SUPPORTED)
347 return -EINVAL;
348
349 if (wol->wolopts & ~support)
350 return -EINVAL;
351
352 if (wol->wolopts == 0)
353 device_set_wakeup_enable(priv->device, 0);
354 else
355 device_set_wakeup_enable(priv->device, 1);
356
357 spin_lock_irq(&priv->lock);
358 priv->wolopts = wol->wolopts;
359 spin_unlock_irq(&priv->lock);
360
361 return 0;
362}
363
364static struct ethtool_ops stmmac_ethtool_ops = {
365 .begin = stmmac_check_if_running,
366 .get_drvinfo = stmmac_ethtool_getdrvinfo,
367 .get_settings = stmmac_ethtool_getsettings,
368 .set_settings = stmmac_ethtool_setsettings,
369 .get_msglevel = stmmac_ethtool_getmsglevel,
370 .set_msglevel = stmmac_ethtool_setmsglevel,
371 .get_regs = stmmac_ethtool_gregs,
372 .get_regs_len = stmmac_ethtool_get_regs_len,
373 .get_link = ethtool_op_get_link,
374 .get_rx_csum = stmmac_ethtool_get_rx_csum,
375 .get_tx_csum = ethtool_op_get_tx_csum,
376 .set_tx_csum = stmmac_ethtool_set_tx_csum,
377 .get_sg = ethtool_op_get_sg,
378 .set_sg = ethtool_op_set_sg,
379 .get_pauseparam = stmmac_get_pauseparam,
380 .set_pauseparam = stmmac_set_pauseparam,
381 .get_ethtool_stats = stmmac_get_ethtool_stats,
382 .get_strings = stmmac_get_strings,
383 .get_wol = stmmac_get_wol,
384 .set_wol = stmmac_set_wol,
385 .get_sset_count = stmmac_get_sset_count,
386#ifdef NETIF_F_TSO
387 .get_tso = ethtool_op_get_tso,
388 .set_tso = ethtool_op_set_tso,
389#endif
390};
391
392void stmmac_set_ethtool_ops(struct net_device *netdev)
393{
394 SET_ETHTOOL_OPS(netdev, &stmmac_ethtool_ops);
395}
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
new file mode 100644
index 000000000000..c2f14dc9ba28
--- /dev/null
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -0,0 +1,2204 @@
1/*******************************************************************************
2 This is the driver for the ST MAC 10/100/1000 on-chip Ethernet controllers.
3 ST Ethernet IPs are built around a Synopsys IP Core.
4
5 Copyright (C) 2007-2009 STMicroelectronics Ltd
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms and conditions of the GNU General Public License,
9 version 2, as published by the Free Software Foundation.
10
11 This program is distributed in the hope it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU General Public License along with
17 this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19
20 The full GNU General Public License is included in this distribution in
21 the file called "COPYING".
22
23 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
24
25 Documentation available at:
26 http://www.stlinux.com
27 Support available at:
28 https://bugzilla.stlinux.com/
29*******************************************************************************/
30
31#include <linux/module.h>
32#include <linux/init.h>
33#include <linux/kernel.h>
34#include <linux/interrupt.h>
35#include <linux/netdevice.h>
36#include <linux/etherdevice.h>
37#include <linux/platform_device.h>
38#include <linux/ip.h>
39#include <linux/tcp.h>
40#include <linux/skbuff.h>
41#include <linux/ethtool.h>
42#include <linux/if_ether.h>
43#include <linux/crc32.h>
44#include <linux/mii.h>
45#include <linux/phy.h>
46#include <linux/if_vlan.h>
47#include <linux/dma-mapping.h>
48#include <linux/stm/soc.h>
49#include "stmmac.h"
50
51#define STMMAC_RESOURCE_NAME "stmmaceth"
52#define PHY_RESOURCE_NAME "stmmacphy"
53
54#undef STMMAC_DEBUG
55/*#define STMMAC_DEBUG*/
56#ifdef STMMAC_DEBUG
57#define DBG(nlevel, klevel, fmt, args...) \
58 ((void)(netif_msg_##nlevel(priv) && \
59 printk(KERN_##klevel fmt, ## args)))
60#else
61#define DBG(nlevel, klevel, fmt, args...) do { } while (0)
62#endif
63
64#undef STMMAC_RX_DEBUG
65/*#define STMMAC_RX_DEBUG*/
66#ifdef STMMAC_RX_DEBUG
67#define RX_DBG(fmt, args...) printk(fmt, ## args)
68#else
69#define RX_DBG(fmt, args...) do { } while (0)
70#endif
71
72#undef STMMAC_XMIT_DEBUG
73/*#define STMMAC_XMIT_DEBUG*/
74#ifdef STMMAC_TX_DEBUG
75#define TX_DBG(fmt, args...) printk(fmt, ## args)
76#else
77#define TX_DBG(fmt, args...) do { } while (0)
78#endif
79
80#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x)
81#define JUMBO_LEN 9000
82
83/* Module parameters */
84#define TX_TIMEO 5000 /* default 5 seconds */
85static int watchdog = TX_TIMEO;
86module_param(watchdog, int, S_IRUGO | S_IWUSR);
87MODULE_PARM_DESC(watchdog, "Transmit timeout in milliseconds");
88
89static int debug = -1; /* -1: default, 0: no output, 16: all */
90module_param(debug, int, S_IRUGO | S_IWUSR);
91MODULE_PARM_DESC(debug, "Message Level (0: no output, 16: all)");
92
93static int phyaddr = -1;
94module_param(phyaddr, int, S_IRUGO);
95MODULE_PARM_DESC(phyaddr, "Physical device address");
96
97#define DMA_TX_SIZE 256
98static int dma_txsize = DMA_TX_SIZE;
99module_param(dma_txsize, int, S_IRUGO | S_IWUSR);
100MODULE_PARM_DESC(dma_txsize, "Number of descriptors in the TX list");
101
102#define DMA_RX_SIZE 256
103static int dma_rxsize = DMA_RX_SIZE;
104module_param(dma_rxsize, int, S_IRUGO | S_IWUSR);
105MODULE_PARM_DESC(dma_rxsize, "Number of descriptors in the RX list");
106
107static int flow_ctrl = FLOW_OFF;
108module_param(flow_ctrl, int, S_IRUGO | S_IWUSR);
109MODULE_PARM_DESC(flow_ctrl, "Flow control ability [on/off]");
110
111static int pause = PAUSE_TIME;
112module_param(pause, int, S_IRUGO | S_IWUSR);
113MODULE_PARM_DESC(pause, "Flow Control Pause Time");
114
115#define TC_DEFAULT 64
116static int tc = TC_DEFAULT;
117module_param(tc, int, S_IRUGO | S_IWUSR);
118MODULE_PARM_DESC(tc, "DMA threshold control value");
119
120#define RX_NO_COALESCE 1 /* Always interrupt on completion */
121#define TX_NO_COALESCE -1 /* No moderation by default */
122
123/* Pay attention to tune this parameter; take care of both
124 * hardware capability and network stabitily/performance impact.
125 * Many tests showed that ~4ms latency seems to be good enough. */
126#ifdef CONFIG_STMMAC_TIMER
127#define DEFAULT_PERIODIC_RATE 256
128static int tmrate = DEFAULT_PERIODIC_RATE;
129module_param(tmrate, int, S_IRUGO | S_IWUSR);
130MODULE_PARM_DESC(tmrate, "External timer freq. (default: 256Hz)");
131#endif
132
133#define DMA_BUFFER_SIZE BUF_SIZE_2KiB
134static int buf_sz = DMA_BUFFER_SIZE;
135module_param(buf_sz, int, S_IRUGO | S_IWUSR);
136MODULE_PARM_DESC(buf_sz, "DMA buffer size");
137
138/* In case of Giga ETH, we can enable/disable the COE for the
139 * transmit HW checksum computation.
140 * Note that, if tx csum is off in HW, SG will be still supported. */
141static int tx_coe = HW_CSUM;
142module_param(tx_coe, int, S_IRUGO | S_IWUSR);
143MODULE_PARM_DESC(tx_coe, "GMAC COE type 2 [on/off]");
144
145static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE |
146 NETIF_MSG_LINK | NETIF_MSG_IFUP |
147 NETIF_MSG_IFDOWN | NETIF_MSG_TIMER);
148
149static irqreturn_t stmmac_interrupt(int irq, void *dev_id);
150static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev);
151
152/**
153 * stmmac_verify_args - verify the driver parameters.
154 * Description: it verifies if some wrong parameter is passed to the driver.
155 * Note that wrong parameters are replaced with the default values.
156 */
157static void stmmac_verify_args(void)
158{
159 if (unlikely(watchdog < 0))
160 watchdog = TX_TIMEO;
161 if (unlikely(dma_rxsize < 0))
162 dma_rxsize = DMA_RX_SIZE;
163 if (unlikely(dma_txsize < 0))
164 dma_txsize = DMA_TX_SIZE;
165 if (unlikely((buf_sz < DMA_BUFFER_SIZE) || (buf_sz > BUF_SIZE_16KiB)))
166 buf_sz = DMA_BUFFER_SIZE;
167 if (unlikely(flow_ctrl > 1))
168 flow_ctrl = FLOW_AUTO;
169 else if (likely(flow_ctrl < 0))
170 flow_ctrl = FLOW_OFF;
171 if (unlikely((pause < 0) || (pause > 0xffff)))
172 pause = PAUSE_TIME;
173
174 return;
175}
176
177#if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
178static void print_pkt(unsigned char *buf, int len)
179{
180 int j;
181 pr_info("len = %d byte, buf addr: 0x%p", len, buf);
182 for (j = 0; j < len; j++) {
183 if ((j % 16) == 0)
184 pr_info("\n %03x:", j);
185 pr_info(" %02x", buf[j]);
186 }
187 pr_info("\n");
188 return;
189}
190#endif
191
192/* minimum number of free TX descriptors required to wake up TX process */
193#define STMMAC_TX_THRESH(x) (x->dma_tx_size/4)
194
195static inline u32 stmmac_tx_avail(struct stmmac_priv *priv)
196{
197 return priv->dirty_tx + priv->dma_tx_size - priv->cur_tx - 1;
198}
199
200/**
201 * stmmac_adjust_link
202 * @dev: net device structure
203 * Description: it adjusts the link parameters.
204 */
205static void stmmac_adjust_link(struct net_device *dev)
206{
207 struct stmmac_priv *priv = netdev_priv(dev);
208 struct phy_device *phydev = priv->phydev;
209 unsigned long ioaddr = dev->base_addr;
210 unsigned long flags;
211 int new_state = 0;
212 unsigned int fc = priv->flow_ctrl, pause_time = priv->pause;
213
214 if (phydev == NULL)
215 return;
216
217 DBG(probe, DEBUG, "stmmac_adjust_link: called. address %d link %d\n",
218 phydev->addr, phydev->link);
219
220 spin_lock_irqsave(&priv->lock, flags);
221 if (phydev->link) {
222 u32 ctrl = readl(ioaddr + MAC_CTRL_REG);
223
224 /* Now we make sure that we can be in full duplex mode.
225 * If not, we operate in half-duplex mode. */
226 if (phydev->duplex != priv->oldduplex) {
227 new_state = 1;
228 if (!(phydev->duplex))
229 ctrl &= ~priv->mac_type->hw.link.duplex;
230 else
231 ctrl |= priv->mac_type->hw.link.duplex;
232 priv->oldduplex = phydev->duplex;
233 }
234 /* Flow Control operation */
235 if (phydev->pause)
236 priv->mac_type->ops->flow_ctrl(ioaddr, phydev->duplex,
237 fc, pause_time);
238
239 if (phydev->speed != priv->speed) {
240 new_state = 1;
241 switch (phydev->speed) {
242 case 1000:
243 if (likely(priv->is_gmac))
244 ctrl &= ~priv->mac_type->hw.link.port;
245 break;
246 case 100:
247 case 10:
248 if (priv->is_gmac) {
249 ctrl |= priv->mac_type->hw.link.port;
250 if (phydev->speed == SPEED_100) {
251 ctrl |=
252 priv->mac_type->hw.link.
253 speed;
254 } else {
255 ctrl &=
256 ~(priv->mac_type->hw.
257 link.speed);
258 }
259 } else {
260 ctrl &= ~priv->mac_type->hw.link.port;
261 }
262 priv->fix_mac_speed(priv->bsp_priv,
263 phydev->speed);
264 break;
265 default:
266 if (netif_msg_link(priv))
267 pr_warning("%s: Speed (%d) is not 10"
268 " or 100!\n", dev->name, phydev->speed);
269 break;
270 }
271
272 priv->speed = phydev->speed;
273 }
274
275 writel(ctrl, ioaddr + MAC_CTRL_REG);
276
277 if (!priv->oldlink) {
278 new_state = 1;
279 priv->oldlink = 1;
280 }
281 } else if (priv->oldlink) {
282 new_state = 1;
283 priv->oldlink = 0;
284 priv->speed = 0;
285 priv->oldduplex = -1;
286 }
287
288 if (new_state && netif_msg_link(priv))
289 phy_print_status(phydev);
290
291 spin_unlock_irqrestore(&priv->lock, flags);
292
293 DBG(probe, DEBUG, "stmmac_adjust_link: exiting\n");
294}
295
296/**
297 * stmmac_init_phy - PHY initialization
298 * @dev: net device structure
299 * Description: it initializes the driver's PHY state, and attaches the PHY
300 * to the mac driver.
301 * Return value:
302 * 0 on success
303 */
304static int stmmac_init_phy(struct net_device *dev)
305{
306 struct stmmac_priv *priv = netdev_priv(dev);
307 struct phy_device *phydev;
308 char phy_id[BUS_ID_SIZE]; /* PHY to connect */
309 char bus_id[BUS_ID_SIZE];
310
311 priv->oldlink = 0;
312 priv->speed = 0;
313 priv->oldduplex = -1;
314
315 if (priv->phy_addr == -1) {
316 /* We don't have a PHY, so do nothing */
317 return 0;
318 }
319
320 snprintf(bus_id, MII_BUS_ID_SIZE, "%x", priv->bus_id);
321 snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, bus_id, priv->phy_addr);
322 pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id);
323
324 phydev = phy_connect(dev, phy_id, &stmmac_adjust_link, 0,
325 priv->phy_interface);
326
327 if (IS_ERR(phydev)) {
328 pr_err("%s: Could not attach to PHY\n", dev->name);
329 return PTR_ERR(phydev);
330 }
331
332 /*
333 * Broken HW is sometimes missing the pull-up resistor on the
334 * MDIO line, which results in reads to non-existent devices returning
335 * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
336 * device as well.
337 * Note: phydev->phy_id is the result of reading the UID PHY registers.
338 */
339 if (phydev->phy_id == 0) {
340 phy_disconnect(phydev);
341 return -ENODEV;
342 }
343 pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)"
344 " Link = %d\n", dev->name, phydev->phy_id, phydev->link);
345
346 priv->phydev = phydev;
347
348 return 0;
349}
350
351static inline void stmmac_mac_enable_rx(unsigned long ioaddr)
352{
353 u32 value = readl(ioaddr + MAC_CTRL_REG);
354 value |= MAC_RNABLE_RX;
355 /* Set the RE (receive enable bit into the MAC CTRL register). */
356 writel(value, ioaddr + MAC_CTRL_REG);
357}
358
359static inline void stmmac_mac_enable_tx(unsigned long ioaddr)
360{
361 u32 value = readl(ioaddr + MAC_CTRL_REG);
362 value |= MAC_ENABLE_TX;
363 /* Set the TE (transmit enable bit into the MAC CTRL register). */
364 writel(value, ioaddr + MAC_CTRL_REG);
365}
366
367static inline void stmmac_mac_disable_rx(unsigned long ioaddr)
368{
369 u32 value = readl(ioaddr + MAC_CTRL_REG);
370 value &= ~MAC_RNABLE_RX;
371 writel(value, ioaddr + MAC_CTRL_REG);
372}
373
374static inline void stmmac_mac_disable_tx(unsigned long ioaddr)
375{
376 u32 value = readl(ioaddr + MAC_CTRL_REG);
377 value &= ~MAC_ENABLE_TX;
378 writel(value, ioaddr + MAC_CTRL_REG);
379}
380
381/**
382 * display_ring
383 * @p: pointer to the ring.
384 * @size: size of the ring.
385 * Description: display all the descriptors within the ring.
386 */
387static void display_ring(struct dma_desc *p, int size)
388{
389 struct tmp_s {
390 u64 a;
391 unsigned int b;
392 unsigned int c;
393 };
394 int i;
395 for (i = 0; i < size; i++) {
396 struct tmp_s *x = (struct tmp_s *)(p + i);
397 pr_info("\t%d [0x%x]: DES0=0x%x DES1=0x%x BUF1=0x%x BUF2=0x%x",
398 i, (unsigned int)virt_to_phys(&p[i]),
399 (unsigned int)(x->a), (unsigned int)((x->a) >> 32),
400 x->b, x->c);
401 pr_info("\n");
402 }
403}
404
405/**
406 * init_dma_desc_rings - init the RX/TX descriptor rings
407 * @dev: net device structure
408 * Description: this function initializes the DMA RX/TX descriptors
409 * and allocates the socket buffers.
410 */
411static void init_dma_desc_rings(struct net_device *dev)
412{
413 int i;
414 struct stmmac_priv *priv = netdev_priv(dev);
415 struct sk_buff *skb;
416 unsigned int txsize = priv->dma_tx_size;
417 unsigned int rxsize = priv->dma_rx_size;
418 unsigned int bfsize = priv->dma_buf_sz;
419 int buff2_needed = 0;
420 int dis_ic = 0;
421
422#ifdef CONFIG_STMMAC_TIMER
423 /* Using Timers disable interrupts on completion for the reception */
424 dis_ic = 1;
425#endif
426 /* Set the Buffer size according to the MTU;
427 * indeed, in case of jumbo we need to bump-up the buffer sizes.
428 */
429 if (unlikely(dev->mtu >= BUF_SIZE_8KiB))
430 bfsize = BUF_SIZE_16KiB;
431 else if (unlikely(dev->mtu >= BUF_SIZE_4KiB))
432 bfsize = BUF_SIZE_8KiB;
433 else if (unlikely(dev->mtu >= BUF_SIZE_2KiB))
434 bfsize = BUF_SIZE_4KiB;
435 else if (unlikely(dev->mtu >= DMA_BUFFER_SIZE))
436 bfsize = BUF_SIZE_2KiB;
437 else
438 bfsize = DMA_BUFFER_SIZE;
439
440 /* If the MTU exceeds 8k so use the second buffer in the chain */
441 if (bfsize >= BUF_SIZE_8KiB)
442 buff2_needed = 1;
443
444 DBG(probe, INFO, "stmmac: txsize %d, rxsize %d, bfsize %d\n",
445 txsize, rxsize, bfsize);
446
447 priv->rx_skbuff_dma = kmalloc(rxsize * sizeof(dma_addr_t), GFP_KERNEL);
448 priv->rx_skbuff =
449 kmalloc(sizeof(struct sk_buff *) * rxsize, GFP_KERNEL);
450 priv->dma_rx =
451 (struct dma_desc *)dma_alloc_coherent(priv->device,
452 rxsize *
453 sizeof(struct dma_desc),
454 &priv->dma_rx_phy,
455 GFP_KERNEL);
456 priv->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * txsize,
457 GFP_KERNEL);
458 priv->dma_tx =
459 (struct dma_desc *)dma_alloc_coherent(priv->device,
460 txsize *
461 sizeof(struct dma_desc),
462 &priv->dma_tx_phy,
463 GFP_KERNEL);
464
465 if ((priv->dma_rx == NULL) || (priv->dma_tx == NULL)) {
466 pr_err("%s:ERROR allocating the DMA Tx/Rx desc\n", __func__);
467 return;
468 }
469
470 DBG(probe, INFO, "stmmac (%s) DMA desc rings: virt addr (Rx %p, "
471 "Tx %p)\n\tDMA phy addr (Rx 0x%08x, Tx 0x%08x)\n",
472 dev->name, priv->dma_rx, priv->dma_tx,
473 (unsigned int)priv->dma_rx_phy, (unsigned int)priv->dma_tx_phy);
474
475 /* RX INITIALIZATION */
476 DBG(probe, INFO, "stmmac: SKB addresses:\n"
477 "skb\t\tskb data\tdma data\n");
478
479 for (i = 0; i < rxsize; i++) {
480 struct dma_desc *p = priv->dma_rx + i;
481
482 skb = netdev_alloc_skb_ip_align(dev, bfsize);
483 if (unlikely(skb == NULL)) {
484 pr_err("%s: Rx init fails; skb is NULL\n", __func__);
485 break;
486 }
487 priv->rx_skbuff[i] = skb;
488 priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data,
489 bfsize, DMA_FROM_DEVICE);
490
491 p->des2 = priv->rx_skbuff_dma[i];
492 if (unlikely(buff2_needed))
493 p->des3 = p->des2 + BUF_SIZE_8KiB;
494 DBG(probe, INFO, "[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i],
495 priv->rx_skbuff[i]->data, priv->rx_skbuff_dma[i]);
496 }
497 priv->cur_rx = 0;
498 priv->dirty_rx = (unsigned int)(i - rxsize);
499 priv->dma_buf_sz = bfsize;
500 buf_sz = bfsize;
501
502 /* TX INITIALIZATION */
503 for (i = 0; i < txsize; i++) {
504 priv->tx_skbuff[i] = NULL;
505 priv->dma_tx[i].des2 = 0;
506 }
507 priv->dirty_tx = 0;
508 priv->cur_tx = 0;
509
510 /* Clear the Rx/Tx descriptors */
511 priv->mac_type->ops->init_rx_desc(priv->dma_rx, rxsize, dis_ic);
512 priv->mac_type->ops->init_tx_desc(priv->dma_tx, txsize);
513
514 if (netif_msg_hw(priv)) {
515 pr_info("RX descriptor ring:\n");
516 display_ring(priv->dma_rx, rxsize);
517 pr_info("TX descriptor ring:\n");
518 display_ring(priv->dma_tx, txsize);
519 }
520 return;
521}
522
523static void dma_free_rx_skbufs(struct stmmac_priv *priv)
524{
525 int i;
526
527 for (i = 0; i < priv->dma_rx_size; i++) {
528 if (priv->rx_skbuff[i]) {
529 dma_unmap_single(priv->device, priv->rx_skbuff_dma[i],
530 priv->dma_buf_sz, DMA_FROM_DEVICE);
531 dev_kfree_skb_any(priv->rx_skbuff[i]);
532 }
533 priv->rx_skbuff[i] = NULL;
534 }
535 return;
536}
537
538static void dma_free_tx_skbufs(struct stmmac_priv *priv)
539{
540 int i;
541
542 for (i = 0; i < priv->dma_tx_size; i++) {
543 if (priv->tx_skbuff[i] != NULL) {
544 struct dma_desc *p = priv->dma_tx + i;
545 if (p->des2)
546 dma_unmap_single(priv->device, p->des2,
547 priv->mac_type->ops->get_tx_len(p),
548 DMA_TO_DEVICE);
549 dev_kfree_skb_any(priv->tx_skbuff[i]);
550 priv->tx_skbuff[i] = NULL;
551 }
552 }
553 return;
554}
555
556static void free_dma_desc_resources(struct stmmac_priv *priv)
557{
558 /* Release the DMA TX/RX socket buffers */
559 dma_free_rx_skbufs(priv);
560 dma_free_tx_skbufs(priv);
561
562 /* Free the region of consistent memory previously allocated for
563 * the DMA */
564 dma_free_coherent(priv->device,
565 priv->dma_tx_size * sizeof(struct dma_desc),
566 priv->dma_tx, priv->dma_tx_phy);
567 dma_free_coherent(priv->device,
568 priv->dma_rx_size * sizeof(struct dma_desc),
569 priv->dma_rx, priv->dma_rx_phy);
570 kfree(priv->rx_skbuff_dma);
571 kfree(priv->rx_skbuff);
572 kfree(priv->tx_skbuff);
573
574 return;
575}
576
577/**
578 * stmmac_dma_start_tx
579 * @ioaddr: device I/O address
580 * Description: this function starts the DMA tx process.
581 */
582static void stmmac_dma_start_tx(unsigned long ioaddr)
583{
584 u32 value = readl(ioaddr + DMA_CONTROL);
585 value |= DMA_CONTROL_ST;
586 writel(value, ioaddr + DMA_CONTROL);
587 return;
588}
589
590static void stmmac_dma_stop_tx(unsigned long ioaddr)
591{
592 u32 value = readl(ioaddr + DMA_CONTROL);
593 value &= ~DMA_CONTROL_ST;
594 writel(value, ioaddr + DMA_CONTROL);
595 return;
596}
597
598/**
599 * stmmac_dma_start_rx
600 * @ioaddr: device I/O address
601 * Description: this function starts the DMA rx process.
602 */
603static void stmmac_dma_start_rx(unsigned long ioaddr)
604{
605 u32 value = readl(ioaddr + DMA_CONTROL);
606 value |= DMA_CONTROL_SR;
607 writel(value, ioaddr + DMA_CONTROL);
608
609 return;
610}
611
612static void stmmac_dma_stop_rx(unsigned long ioaddr)
613{
614 u32 value = readl(ioaddr + DMA_CONTROL);
615 value &= ~DMA_CONTROL_SR;
616 writel(value, ioaddr + DMA_CONTROL);
617
618 return;
619}
620
621/**
622 * stmmac_dma_operation_mode - HW DMA operation mode
623 * @priv : pointer to the private device structure.
624 * Description: it sets the DMA operation mode: tx/rx DMA thresholds
625 * or Store-And-Forward capability. It also verifies the COE for the
626 * transmission in case of Giga ETH.
627 */
628static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
629{
630 if (!priv->is_gmac) {
631 /* MAC 10/100 */
632 priv->mac_type->ops->dma_mode(priv->dev->base_addr, tc, 0);
633 priv->tx_coe = NO_HW_CSUM;
634 } else {
635 if ((priv->dev->mtu <= ETH_DATA_LEN) && (tx_coe)) {
636 priv->mac_type->ops->dma_mode(priv->dev->base_addr,
637 SF_DMA_MODE, SF_DMA_MODE);
638 tc = SF_DMA_MODE;
639 priv->tx_coe = HW_CSUM;
640 } else {
641 /* Checksum computation is performed in software. */
642 priv->mac_type->ops->dma_mode(priv->dev->base_addr, tc,
643 SF_DMA_MODE);
644 priv->tx_coe = NO_HW_CSUM;
645 }
646 }
647 tx_coe = priv->tx_coe;
648
649 return;
650}
651
652#ifdef STMMAC_DEBUG
653/**
654 * show_tx_process_state
655 * @status: tx descriptor status field
656 * Description: it shows the Transmit Process State for CSR5[22:20]
657 */
658static void show_tx_process_state(unsigned int status)
659{
660 unsigned int state;
661 state = (status & DMA_STATUS_TS_MASK) >> DMA_STATUS_TS_SHIFT;
662
663 switch (state) {
664 case 0:
665 pr_info("- TX (Stopped): Reset or Stop command\n");
666 break;
667 case 1:
668 pr_info("- TX (Running):Fetching the Tx desc\n");
669 break;
670 case 2:
671 pr_info("- TX (Running): Waiting for end of tx\n");
672 break;
673 case 3:
674 pr_info("- TX (Running): Reading the data "
675 "and queuing the data into the Tx buf\n");
676 break;
677 case 6:
678 pr_info("- TX (Suspended): Tx Buff Underflow "
679 "or an unavailable Transmit descriptor\n");
680 break;
681 case 7:
682 pr_info("- TX (Running): Closing Tx descriptor\n");
683 break;
684 default:
685 break;
686 }
687 return;
688}
689
690/**
691 * show_rx_process_state
692 * @status: rx descriptor status field
693 * Description: it shows the Receive Process State for CSR5[19:17]
694 */
695static void show_rx_process_state(unsigned int status)
696{
697 unsigned int state;
698 state = (status & DMA_STATUS_RS_MASK) >> DMA_STATUS_RS_SHIFT;
699
700 switch (state) {
701 case 0:
702 pr_info("- RX (Stopped): Reset or Stop command\n");
703 break;
704 case 1:
705 pr_info("- RX (Running): Fetching the Rx desc\n");
706 break;
707 case 2:
708 pr_info("- RX (Running):Checking for end of pkt\n");
709 break;
710 case 3:
711 pr_info("- RX (Running): Waiting for Rx pkt\n");
712 break;
713 case 4:
714 pr_info("- RX (Suspended): Unavailable Rx buf\n");
715 break;
716 case 5:
717 pr_info("- RX (Running): Closing Rx descriptor\n");
718 break;
719 case 6:
720 pr_info("- RX(Running): Flushing the current frame"
721 " from the Rx buf\n");
722 break;
723 case 7:
724 pr_info("- RX (Running): Queuing the Rx frame"
725 " from the Rx buf into memory\n");
726 break;
727 default:
728 break;
729 }
730 return;
731}
732#endif
733
734/**
735 * stmmac_tx:
736 * @priv: private driver structure
737 * Description: it reclaims resources after transmission completes.
738 */
739static void stmmac_tx(struct stmmac_priv *priv)
740{
741 unsigned int txsize = priv->dma_tx_size;
742 unsigned long ioaddr = priv->dev->base_addr;
743
744 while (priv->dirty_tx != priv->cur_tx) {
745 int last;
746 unsigned int entry = priv->dirty_tx % txsize;
747 struct sk_buff *skb = priv->tx_skbuff[entry];
748 struct dma_desc *p = priv->dma_tx + entry;
749
750 /* Check if the descriptor is owned by the DMA. */
751 if (priv->mac_type->ops->get_tx_owner(p))
752 break;
753
754 /* Verify tx error by looking at the last segment */
755 last = priv->mac_type->ops->get_tx_ls(p);
756 if (likely(last)) {
757 int tx_error =
758 priv->mac_type->ops->tx_status(&priv->dev->stats,
759 &priv->xstats,
760 p, ioaddr);
761 if (likely(tx_error == 0)) {
762 priv->dev->stats.tx_packets++;
763 priv->xstats.tx_pkt_n++;
764 } else
765 priv->dev->stats.tx_errors++;
766 }
767 TX_DBG("%s: curr %d, dirty %d\n", __func__,
768 priv->cur_tx, priv->dirty_tx);
769
770 if (likely(p->des2))
771 dma_unmap_single(priv->device, p->des2,
772 priv->mac_type->ops->get_tx_len(p),
773 DMA_TO_DEVICE);
774 if (unlikely(p->des3))
775 p->des3 = 0;
776
777 if (likely(skb != NULL)) {
778 /*
779 * If there's room in the queue (limit it to size)
780 * we add this skb back into the pool,
781 * if it's the right size.
782 */
783 if ((skb_queue_len(&priv->rx_recycle) <
784 priv->dma_rx_size) &&
785 skb_recycle_check(skb, priv->dma_buf_sz))
786 __skb_queue_head(&priv->rx_recycle, skb);
787 else
788 dev_kfree_skb(skb);
789
790 priv->tx_skbuff[entry] = NULL;
791 }
792
793 priv->mac_type->ops->release_tx_desc(p);
794
795 entry = (++priv->dirty_tx) % txsize;
796 }
797 if (unlikely(netif_queue_stopped(priv->dev) &&
798 stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv))) {
799 netif_tx_lock(priv->dev);
800 if (netif_queue_stopped(priv->dev) &&
801 stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv)) {
802 TX_DBG("%s: restart transmit\n", __func__);
803 netif_wake_queue(priv->dev);
804 }
805 netif_tx_unlock(priv->dev);
806 }
807 return;
808}
809
810static inline void stmmac_enable_irq(struct stmmac_priv *priv)
811{
812#ifndef CONFIG_STMMAC_TIMER
813 writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA);
814#else
815 priv->tm->timer_start(tmrate);
816#endif
817}
818
819static inline void stmmac_disable_irq(struct stmmac_priv *priv)
820{
821#ifndef CONFIG_STMMAC_TIMER
822 writel(0, priv->dev->base_addr + DMA_INTR_ENA);
823#else
824 priv->tm->timer_stop();
825#endif
826}
827
828static int stmmac_has_work(struct stmmac_priv *priv)
829{
830 unsigned int has_work = 0;
831 int rxret, tx_work = 0;
832
833 rxret = priv->mac_type->ops->get_rx_owner(priv->dma_rx +
834 (priv->cur_rx % priv->dma_rx_size));
835
836 if (priv->dirty_tx != priv->cur_tx)
837 tx_work = 1;
838
839 if (likely(!rxret || tx_work))
840 has_work = 1;
841
842 return has_work;
843}
844
845static inline void _stmmac_schedule(struct stmmac_priv *priv)
846{
847 if (likely(stmmac_has_work(priv))) {
848 stmmac_disable_irq(priv);
849 napi_schedule(&priv->napi);
850 }
851}
852
853#ifdef CONFIG_STMMAC_TIMER
854void stmmac_schedule(struct net_device *dev)
855{
856 struct stmmac_priv *priv = netdev_priv(dev);
857
858 priv->xstats.sched_timer_n++;
859
860 _stmmac_schedule(priv);
861
862 return;
863}
864
865static void stmmac_no_timer_started(unsigned int x)
866{;
867};
868
869static void stmmac_no_timer_stopped(void)
870{;
871};
872#endif
873
874/**
875 * stmmac_tx_err:
876 * @priv: pointer to the private device structure
877 * Description: it cleans the descriptors and restarts the transmission
878 * in case of errors.
879 */
880static void stmmac_tx_err(struct stmmac_priv *priv)
881{
882 netif_stop_queue(priv->dev);
883
884 stmmac_dma_stop_tx(priv->dev->base_addr);
885 dma_free_tx_skbufs(priv);
886 priv->mac_type->ops->init_tx_desc(priv->dma_tx, priv->dma_tx_size);
887 priv->dirty_tx = 0;
888 priv->cur_tx = 0;
889 stmmac_dma_start_tx(priv->dev->base_addr);
890
891 priv->dev->stats.tx_errors++;
892 netif_wake_queue(priv->dev);
893
894 return;
895}
896
897/**
898 * stmmac_dma_interrupt - Interrupt handler for the driver
899 * @dev: net device structure
900 * Description: Interrupt handler for the driver (DMA).
901 */
902static void stmmac_dma_interrupt(struct net_device *dev)
903{
904 unsigned long ioaddr = dev->base_addr;
905 struct stmmac_priv *priv = netdev_priv(dev);
906 /* read the status register (CSR5) */
907 u32 intr_status = readl(ioaddr + DMA_STATUS);
908
909 DBG(intr, INFO, "%s: [CSR5: 0x%08x]\n", __func__, intr_status);
910
911#ifdef STMMAC_DEBUG
912 /* It displays the DMA transmit process state (CSR5 register) */
913 if (netif_msg_tx_done(priv))
914 show_tx_process_state(intr_status);
915 if (netif_msg_rx_status(priv))
916 show_rx_process_state(intr_status);
917#endif
918 /* ABNORMAL interrupts */
919 if (unlikely(intr_status & DMA_STATUS_AIS)) {
920 DBG(intr, INFO, "CSR5[15] DMA ABNORMAL IRQ: ");
921 if (unlikely(intr_status & DMA_STATUS_UNF)) {
922 DBG(intr, INFO, "transmit underflow\n");
923 if (unlikely(tc != SF_DMA_MODE)
924 && (tc <= 256)) {
925 /* Try to bump up the threshold */
926 tc += 64;
927 priv->mac_type->ops->dma_mode(ioaddr, tc,
928 SF_DMA_MODE);
929 priv->xstats.threshold = tc;
930 }
931 stmmac_tx_err(priv);
932 priv->xstats.tx_undeflow_irq++;
933 }
934 if (unlikely(intr_status & DMA_STATUS_TJT)) {
935 DBG(intr, INFO, "transmit jabber\n");
936 priv->xstats.tx_jabber_irq++;
937 }
938 if (unlikely(intr_status & DMA_STATUS_OVF)) {
939 DBG(intr, INFO, "recv overflow\n");
940 priv->xstats.rx_overflow_irq++;
941 }
942 if (unlikely(intr_status & DMA_STATUS_RU)) {
943 DBG(intr, INFO, "receive buffer unavailable\n");
944 priv->xstats.rx_buf_unav_irq++;
945 }
946 if (unlikely(intr_status & DMA_STATUS_RPS)) {
947 DBG(intr, INFO, "receive process stopped\n");
948 priv->xstats.rx_process_stopped_irq++;
949 }
950 if (unlikely(intr_status & DMA_STATUS_RWT)) {
951 DBG(intr, INFO, "receive watchdog\n");
952 priv->xstats.rx_watchdog_irq++;
953 }
954 if (unlikely(intr_status & DMA_STATUS_ETI)) {
955 DBG(intr, INFO, "transmit early interrupt\n");
956 priv->xstats.tx_early_irq++;
957 }
958 if (unlikely(intr_status & DMA_STATUS_TPS)) {
959 DBG(intr, INFO, "transmit process stopped\n");
960 priv->xstats.tx_process_stopped_irq++;
961 stmmac_tx_err(priv);
962 }
963 if (unlikely(intr_status & DMA_STATUS_FBI)) {
964 DBG(intr, INFO, "fatal bus error\n");
965 priv->xstats.fatal_bus_error_irq++;
966 stmmac_tx_err(priv);
967 }
968 }
969
970 /* TX/RX NORMAL interrupts */
971 if (intr_status & DMA_STATUS_NIS) {
972 priv->xstats.normal_irq_n++;
973 if (likely((intr_status & DMA_STATUS_RI) ||
974 (intr_status & (DMA_STATUS_TI))))
975 _stmmac_schedule(priv);
976 }
977
978 /* Optional hardware blocks, interrupts should be disabled */
979 if (unlikely(intr_status &
980 (DMA_STATUS_GPI | DMA_STATUS_GMI | DMA_STATUS_GLI)))
981 pr_info("%s: unexpected status %08x\n", __func__, intr_status);
982
983 /* Clear the interrupt by writing a logic 1 to the CSR5[15-0] */
984 writel((intr_status & 0x1ffff), ioaddr + DMA_STATUS);
985
986 DBG(intr, INFO, "\n\n");
987
988 return;
989}
990
991/**
992 * stmmac_open - open entry point of the driver
993 * @dev : pointer to the device structure.
994 * Description:
995 * This function is the open entry point of the driver.
996 * Return value:
997 * 0 on success and an appropriate (-)ve integer as defined in errno.h
998 * file on failure.
999 */
1000static int stmmac_open(struct net_device *dev)
1001{
1002 struct stmmac_priv *priv = netdev_priv(dev);
1003 unsigned long ioaddr = dev->base_addr;
1004 int ret;
1005
1006 /* Check that the MAC address is valid. If its not, refuse
1007 * to bring the device up. The user must specify an
1008 * address using the following linux command:
1009 * ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx */
1010 if (!is_valid_ether_addr(dev->dev_addr)) {
1011 random_ether_addr(dev->dev_addr);
1012 pr_warning("%s: generated random MAC address %pM\n", dev->name,
1013 dev->dev_addr);
1014 }
1015
1016 stmmac_verify_args();
1017
1018 ret = stmmac_init_phy(dev);
1019 if (unlikely(ret)) {
1020 pr_err("%s: Cannot attach to PHY (error: %d)\n", __func__, ret);
1021 return ret;
1022 }
1023
1024 /* Request the IRQ lines */
1025 ret = request_irq(dev->irq, &stmmac_interrupt,
1026 IRQF_SHARED, dev->name, dev);
1027 if (unlikely(ret < 0)) {
1028 pr_err("%s: ERROR: allocating the IRQ %d (error: %d)\n",
1029 __func__, dev->irq, ret);
1030 return ret;
1031 }
1032
1033#ifdef CONFIG_STMMAC_TIMER
1034 priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
1035 if (unlikely(priv->tm == NULL)) {
1036 pr_err("%s: ERROR: timer memory alloc failed \n", __func__);
1037 return -ENOMEM;
1038 }
1039 priv->tm->freq = tmrate;
1040
1041 /* Test if the HW timer can be actually used.
1042 * In case of failure continue with no timer. */
1043 if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) {
1044 pr_warning("stmmaceth: cannot attach the HW timer\n");
1045 tmrate = 0;
1046 priv->tm->freq = 0;
1047 priv->tm->timer_start = stmmac_no_timer_started;
1048 priv->tm->timer_stop = stmmac_no_timer_stopped;
1049 }
1050#endif
1051
1052 /* Create and initialize the TX/RX descriptors chains. */
1053 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
1054 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
1055 priv->dma_buf_sz = STMMAC_ALIGN(buf_sz);
1056 init_dma_desc_rings(dev);
1057
1058 /* DMA initialization and SW reset */
1059 if (unlikely(priv->mac_type->ops->dma_init(ioaddr,
1060 priv->pbl, priv->dma_tx_phy, priv->dma_rx_phy) < 0)) {
1061
1062 pr_err("%s: DMA initialization failed\n", __func__);
1063 return -1;
1064 }
1065
1066 /* Copy the MAC addr into the HW */
1067 priv->mac_type->ops->set_umac_addr(ioaddr, dev->dev_addr, 0);
1068 /* Initialize the MAC Core */
1069 priv->mac_type->ops->core_init(ioaddr);
1070
1071 priv->shutdown = 0;
1072
1073 /* Initialise the MMC (if present) to disable all interrupts. */
1074 writel(0xffffffff, ioaddr + MMC_HIGH_INTR_MASK);
1075 writel(0xffffffff, ioaddr + MMC_LOW_INTR_MASK);
1076
1077 /* Enable the MAC Rx/Tx */
1078 stmmac_mac_enable_rx(ioaddr);
1079 stmmac_mac_enable_tx(ioaddr);
1080
1081 /* Set the HW DMA mode and the COE */
1082 stmmac_dma_operation_mode(priv);
1083
1084 /* Extra statistics */
1085 memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
1086 priv->xstats.threshold = tc;
1087
1088 /* Start the ball rolling... */
1089 DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name);
1090 stmmac_dma_start_tx(ioaddr);
1091 stmmac_dma_start_rx(ioaddr);
1092
1093#ifdef CONFIG_STMMAC_TIMER
1094 priv->tm->timer_start(tmrate);
1095#endif
1096 /* Dump DMA/MAC registers */
1097 if (netif_msg_hw(priv)) {
1098 priv->mac_type->ops->dump_mac_regs(ioaddr);
1099 priv->mac_type->ops->dump_dma_regs(ioaddr);
1100 }
1101
1102 if (priv->phydev)
1103 phy_start(priv->phydev);
1104
1105 napi_enable(&priv->napi);
1106 skb_queue_head_init(&priv->rx_recycle);
1107 netif_start_queue(dev);
1108 return 0;
1109}
1110
1111/**
1112 * stmmac_release - close entry point of the driver
1113 * @dev : device pointer.
1114 * Description:
1115 * This is the stop entry point of the driver.
1116 */
1117static int stmmac_release(struct net_device *dev)
1118{
1119 struct stmmac_priv *priv = netdev_priv(dev);
1120
1121 /* Stop and disconnect the PHY */
1122 if (priv->phydev) {
1123 phy_stop(priv->phydev);
1124 phy_disconnect(priv->phydev);
1125 priv->phydev = NULL;
1126 }
1127
1128 netif_stop_queue(dev);
1129
1130#ifdef CONFIG_STMMAC_TIMER
1131 /* Stop and release the timer */
1132 stmmac_close_ext_timer();
1133 if (priv->tm != NULL)
1134 kfree(priv->tm);
1135#endif
1136 napi_disable(&priv->napi);
1137 skb_queue_purge(&priv->rx_recycle);
1138
1139 /* Free the IRQ lines */
1140 free_irq(dev->irq, dev);
1141
1142 /* Stop TX/RX DMA and clear the descriptors */
1143 stmmac_dma_stop_tx(dev->base_addr);
1144 stmmac_dma_stop_rx(dev->base_addr);
1145
1146 /* Release and free the Rx/Tx resources */
1147 free_dma_desc_resources(priv);
1148
1149 /* Disable the MAC core */
1150 stmmac_mac_disable_tx(dev->base_addr);
1151 stmmac_mac_disable_rx(dev->base_addr);
1152
1153 netif_carrier_off(dev);
1154
1155 return 0;
1156}
1157
1158/*
1159 * To perform emulated hardware segmentation on skb.
1160 */
1161static int stmmac_sw_tso(struct stmmac_priv *priv, struct sk_buff *skb)
1162{
1163 struct sk_buff *segs, *curr_skb;
1164 int gso_segs = skb_shinfo(skb)->gso_segs;
1165
1166 /* Estimate the number of fragments in the worst case */
1167 if (unlikely(stmmac_tx_avail(priv) < gso_segs)) {
1168 netif_stop_queue(priv->dev);
1169 TX_DBG(KERN_ERR "%s: TSO BUG! Tx Ring full when queue awake\n",
1170 __func__);
1171 if (stmmac_tx_avail(priv) < gso_segs)
1172 return NETDEV_TX_BUSY;
1173
1174 netif_wake_queue(priv->dev);
1175 }
1176 TX_DBG("\tstmmac_sw_tso: segmenting: skb %p (len %d)\n",
1177 skb, skb->len);
1178
1179 segs = skb_gso_segment(skb, priv->dev->features & ~NETIF_F_TSO);
1180 if (unlikely(IS_ERR(segs)))
1181 goto sw_tso_end;
1182
1183 do {
1184 curr_skb = segs;
1185 segs = segs->next;
1186 TX_DBG("\t\tcurrent skb->len: %d, *curr %p,"
1187 "*next %p\n", curr_skb->len, curr_skb, segs);
1188 curr_skb->next = NULL;
1189 stmmac_xmit(curr_skb, priv->dev);
1190 } while (segs);
1191
1192sw_tso_end:
1193 dev_kfree_skb(skb);
1194
1195 return NETDEV_TX_OK;
1196}
1197
1198static unsigned int stmmac_handle_jumbo_frames(struct sk_buff *skb,
1199 struct net_device *dev,
1200 int csum_insertion)
1201{
1202 struct stmmac_priv *priv = netdev_priv(dev);
1203 unsigned int nopaged_len = skb_headlen(skb);
1204 unsigned int txsize = priv->dma_tx_size;
1205 unsigned int entry = priv->cur_tx % txsize;
1206 struct dma_desc *desc = priv->dma_tx + entry;
1207
1208 if (nopaged_len > BUF_SIZE_8KiB) {
1209
1210 int buf2_size = nopaged_len - BUF_SIZE_8KiB;
1211
1212 desc->des2 = dma_map_single(priv->device, skb->data,
1213 BUF_SIZE_8KiB, DMA_TO_DEVICE);
1214 desc->des3 = desc->des2 + BUF_SIZE_4KiB;
1215 priv->mac_type->ops->prepare_tx_desc(desc, 1, BUF_SIZE_8KiB,
1216 csum_insertion);
1217
1218 entry = (++priv->cur_tx) % txsize;
1219 desc = priv->dma_tx + entry;
1220
1221 desc->des2 = dma_map_single(priv->device,
1222 skb->data + BUF_SIZE_8KiB,
1223 buf2_size, DMA_TO_DEVICE);
1224 desc->des3 = desc->des2 + BUF_SIZE_4KiB;
1225 priv->mac_type->ops->prepare_tx_desc(desc, 0,
1226 buf2_size, csum_insertion);
1227 priv->mac_type->ops->set_tx_owner(desc);
1228 priv->tx_skbuff[entry] = NULL;
1229 } else {
1230 desc->des2 = dma_map_single(priv->device, skb->data,
1231 nopaged_len, DMA_TO_DEVICE);
1232 desc->des3 = desc->des2 + BUF_SIZE_4KiB;
1233 priv->mac_type->ops->prepare_tx_desc(desc, 1, nopaged_len,
1234 csum_insertion);
1235 }
1236 return entry;
1237}
1238
1239/**
1240 * stmmac_xmit:
1241 * @skb : the socket buffer
1242 * @dev : device pointer
1243 * Description : Tx entry point of the driver.
1244 */
1245static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
1246{
1247 struct stmmac_priv *priv = netdev_priv(dev);
1248 unsigned int txsize = priv->dma_tx_size;
1249 unsigned int entry;
1250 int i, csum_insertion = 0;
1251 int nfrags = skb_shinfo(skb)->nr_frags;
1252 struct dma_desc *desc, *first;
1253
1254 if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) {
1255 if (!netif_queue_stopped(dev)) {
1256 netif_stop_queue(dev);
1257 /* This is a hard error, log it. */
1258 pr_err("%s: BUG! Tx Ring full when queue awake\n",
1259 __func__);
1260 }
1261 return NETDEV_TX_BUSY;
1262 }
1263
1264 entry = priv->cur_tx % txsize;
1265
1266#ifdef STMMAC_XMIT_DEBUG
1267 if ((skb->len > ETH_FRAME_LEN) || nfrags)
1268 pr_info("stmmac xmit:\n"
1269 "\tskb addr %p - len: %d - nopaged_len: %d\n"
1270 "\tn_frags: %d - ip_summed: %d - %s gso\n",
1271 skb, skb->len, skb_headlen(skb), nfrags, skb->ip_summed,
1272 !skb_is_gso(skb) ? "isn't" : "is");
1273#endif
1274
1275 if (unlikely(skb_is_gso(skb)))
1276 return stmmac_sw_tso(priv, skb);
1277
1278 if (likely((skb->ip_summed == CHECKSUM_PARTIAL))) {
1279 if (likely(priv->tx_coe == NO_HW_CSUM))
1280 skb_checksum_help(skb);
1281 else
1282 csum_insertion = 1;
1283 }
1284
1285 desc = priv->dma_tx + entry;
1286 first = desc;
1287
1288#ifdef STMMAC_XMIT_DEBUG
1289 if ((nfrags > 0) || (skb->len > ETH_FRAME_LEN))
1290 pr_debug("stmmac xmit: skb len: %d, nopaged_len: %d,\n"
1291 "\t\tn_frags: %d, ip_summed: %d\n",
1292 skb->len, skb_headlen(skb), nfrags, skb->ip_summed);
1293#endif
1294 priv->tx_skbuff[entry] = skb;
1295 if (unlikely(skb->len >= BUF_SIZE_4KiB)) {
1296 entry = stmmac_handle_jumbo_frames(skb, dev, csum_insertion);
1297 desc = priv->dma_tx + entry;
1298 } else {
1299 unsigned int nopaged_len = skb_headlen(skb);
1300 desc->des2 = dma_map_single(priv->device, skb->data,
1301 nopaged_len, DMA_TO_DEVICE);
1302 priv->mac_type->ops->prepare_tx_desc(desc, 1, nopaged_len,
1303 csum_insertion);
1304 }
1305
1306 for (i = 0; i < nfrags; i++) {
1307 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1308 int len = frag->size;
1309
1310 entry = (++priv->cur_tx) % txsize;
1311 desc = priv->dma_tx + entry;
1312
1313 TX_DBG("\t[entry %d] segment len: %d\n", entry, len);
1314 desc->des2 = dma_map_page(priv->device, frag->page,
1315 frag->page_offset,
1316 len, DMA_TO_DEVICE);
1317 priv->tx_skbuff[entry] = NULL;
1318 priv->mac_type->ops->prepare_tx_desc(desc, 0, len,
1319 csum_insertion);
1320 priv->mac_type->ops->set_tx_owner(desc);
1321 }
1322
1323 /* Interrupt on completition only for the latest segment */
1324 priv->mac_type->ops->close_tx_desc(desc);
1325#ifdef CONFIG_STMMAC_TIMER
1326 /* Clean IC while using timers */
1327 priv->mac_type->ops->clear_tx_ic(desc);
1328#endif
1329 /* To avoid raise condition */
1330 priv->mac_type->ops->set_tx_owner(first);
1331
1332 priv->cur_tx++;
1333
1334#ifdef STMMAC_XMIT_DEBUG
1335 if (netif_msg_pktdata(priv)) {
1336 pr_info("stmmac xmit: current=%d, dirty=%d, entry=%d, "
1337 "first=%p, nfrags=%d\n",
1338 (priv->cur_tx % txsize), (priv->dirty_tx % txsize),
1339 entry, first, nfrags);
1340 display_ring(priv->dma_tx, txsize);
1341 pr_info(">>> frame to be transmitted: ");
1342 print_pkt(skb->data, skb->len);
1343 }
1344#endif
1345 if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) {
1346 TX_DBG("%s: stop transmitted packets\n", __func__);
1347 netif_stop_queue(dev);
1348 }
1349
1350 dev->stats.tx_bytes += skb->len;
1351
1352 /* CSR1 enables the transmit DMA to check for new descriptor */
1353 writel(1, dev->base_addr + DMA_XMT_POLL_DEMAND);
1354
1355 return NETDEV_TX_OK;
1356}
1357
1358static inline void stmmac_rx_refill(struct stmmac_priv *priv)
1359{
1360 unsigned int rxsize = priv->dma_rx_size;
1361 int bfsize = priv->dma_buf_sz;
1362 struct dma_desc *p = priv->dma_rx;
1363
1364 for (; priv->cur_rx - priv->dirty_rx > 0; priv->dirty_rx++) {
1365 unsigned int entry = priv->dirty_rx % rxsize;
1366 if (likely(priv->rx_skbuff[entry] == NULL)) {
1367 struct sk_buff *skb;
1368
1369 skb = __skb_dequeue(&priv->rx_recycle);
1370 if (skb == NULL)
1371 skb = netdev_alloc_skb_ip_align(priv->dev,
1372 bfsize);
1373
1374 if (unlikely(skb == NULL))
1375 break;
1376
1377 priv->rx_skbuff[entry] = skb;
1378 priv->rx_skbuff_dma[entry] =
1379 dma_map_single(priv->device, skb->data, bfsize,
1380 DMA_FROM_DEVICE);
1381
1382 (p + entry)->des2 = priv->rx_skbuff_dma[entry];
1383 if (unlikely(priv->is_gmac)) {
1384 if (bfsize >= BUF_SIZE_8KiB)
1385 (p + entry)->des3 =
1386 (p + entry)->des2 + BUF_SIZE_8KiB;
1387 }
1388 RX_DBG(KERN_INFO "\trefill entry #%d\n", entry);
1389 }
1390 priv->mac_type->ops->set_rx_owner(p + entry);
1391 }
1392 return;
1393}
1394
1395static int stmmac_rx(struct stmmac_priv *priv, int limit)
1396{
1397 unsigned int rxsize = priv->dma_rx_size;
1398 unsigned int entry = priv->cur_rx % rxsize;
1399 unsigned int next_entry;
1400 unsigned int count = 0;
1401 struct dma_desc *p = priv->dma_rx + entry;
1402 struct dma_desc *p_next;
1403
1404#ifdef STMMAC_RX_DEBUG
1405 if (netif_msg_hw(priv)) {
1406 pr_debug(">>> stmmac_rx: descriptor ring:\n");
1407 display_ring(priv->dma_rx, rxsize);
1408 }
1409#endif
1410 count = 0;
1411 while (!priv->mac_type->ops->get_rx_owner(p)) {
1412 int status;
1413
1414 if (count >= limit)
1415 break;
1416
1417 count++;
1418
1419 next_entry = (++priv->cur_rx) % rxsize;
1420 p_next = priv->dma_rx + next_entry;
1421 prefetch(p_next);
1422
1423 /* read the status of the incoming frame */
1424 status = (priv->mac_type->ops->rx_status(&priv->dev->stats,
1425 &priv->xstats, p));
1426 if (unlikely(status == discard_frame))
1427 priv->dev->stats.rx_errors++;
1428 else {
1429 struct sk_buff *skb;
1430 /* Length should omit the CRC */
1431 int frame_len =
1432 priv->mac_type->ops->get_rx_frame_len(p) - 4;
1433
1434#ifdef STMMAC_RX_DEBUG
1435 if (frame_len > ETH_FRAME_LEN)
1436 pr_debug("\tRX frame size %d, COE status: %d\n",
1437 frame_len, status);
1438
1439 if (netif_msg_hw(priv))
1440 pr_debug("\tdesc: %p [entry %d] buff=0x%x\n",
1441 p, entry, p->des2);
1442#endif
1443 skb = priv->rx_skbuff[entry];
1444 if (unlikely(!skb)) {
1445 pr_err("%s: Inconsistent Rx descriptor chain\n",
1446 priv->dev->name);
1447 priv->dev->stats.rx_dropped++;
1448 break;
1449 }
1450 prefetch(skb->data - NET_IP_ALIGN);
1451 priv->rx_skbuff[entry] = NULL;
1452
1453 skb_put(skb, frame_len);
1454 dma_unmap_single(priv->device,
1455 priv->rx_skbuff_dma[entry],
1456 priv->dma_buf_sz, DMA_FROM_DEVICE);
1457#ifdef STMMAC_RX_DEBUG
1458 if (netif_msg_pktdata(priv)) {
1459 pr_info(" frame received (%dbytes)", frame_len);
1460 print_pkt(skb->data, frame_len);
1461 }
1462#endif
1463 skb->protocol = eth_type_trans(skb, priv->dev);
1464
1465 if (unlikely(status == csum_none)) {
1466 /* always for the old mac 10/100 */
1467 skb->ip_summed = CHECKSUM_NONE;
1468 netif_receive_skb(skb);
1469 } else {
1470 skb->ip_summed = CHECKSUM_UNNECESSARY;
1471 napi_gro_receive(&priv->napi, skb);
1472 }
1473
1474 priv->dev->stats.rx_packets++;
1475 priv->dev->stats.rx_bytes += frame_len;
1476 priv->dev->last_rx = jiffies;
1477 }
1478 entry = next_entry;
1479 p = p_next; /* use prefetched values */
1480 }
1481
1482 stmmac_rx_refill(priv);
1483
1484 priv->xstats.rx_pkt_n += count;
1485
1486 return count;
1487}
1488
1489/**
1490 * stmmac_poll - stmmac poll method (NAPI)
1491 * @napi : pointer to the napi structure.
1492 * @budget : maximum number of packets that the current CPU can receive from
1493 * all interfaces.
1494 * Description :
1495 * This function implements the the reception process.
1496 * Also it runs the TX completion thread
1497 */
1498static int stmmac_poll(struct napi_struct *napi, int budget)
1499{
1500 struct stmmac_priv *priv = container_of(napi, struct stmmac_priv, napi);
1501 int work_done = 0;
1502
1503 priv->xstats.poll_n++;
1504 stmmac_tx(priv);
1505 work_done = stmmac_rx(priv, budget);
1506
1507 if (work_done < budget) {
1508 napi_complete(napi);
1509 stmmac_enable_irq(priv);
1510 }
1511 return work_done;
1512}
1513
1514/**
1515 * stmmac_tx_timeout
1516 * @dev : Pointer to net device structure
1517 * Description: this function is called when a packet transmission fails to
1518 * complete within a reasonable tmrate. The driver will mark the error in the
1519 * netdev structure and arrange for the device to be reset to a sane state
1520 * in order to transmit a new packet.
1521 */
1522static void stmmac_tx_timeout(struct net_device *dev)
1523{
1524 struct stmmac_priv *priv = netdev_priv(dev);
1525
1526 /* Clear Tx resources and restart transmitting again */
1527 stmmac_tx_err(priv);
1528 return;
1529}
1530
1531/* Configuration changes (passed on by ifconfig) */
1532static int stmmac_config(struct net_device *dev, struct ifmap *map)
1533{
1534 if (dev->flags & IFF_UP) /* can't act on a running interface */
1535 return -EBUSY;
1536
1537 /* Don't allow changing the I/O address */
1538 if (map->base_addr != dev->base_addr) {
1539 pr_warning("%s: can't change I/O address\n", dev->name);
1540 return -EOPNOTSUPP;
1541 }
1542
1543 /* Don't allow changing the IRQ */
1544 if (map->irq != dev->irq) {
1545 pr_warning("%s: can't change IRQ number %d\n",
1546 dev->name, dev->irq);
1547 return -EOPNOTSUPP;
1548 }
1549
1550 /* ignore other fields */
1551 return 0;
1552}
1553
1554/**
1555 * stmmac_multicast_list - entry point for multicast addressing
1556 * @dev : pointer to the device structure
1557 * Description:
1558 * This function is a driver entry point which gets called by the kernel
1559 * whenever multicast addresses must be enabled/disabled.
1560 * Return value:
1561 * void.
1562 */
1563static void stmmac_multicast_list(struct net_device *dev)
1564{
1565 struct stmmac_priv *priv = netdev_priv(dev);
1566
1567 spin_lock(&priv->lock);
1568 priv->mac_type->ops->set_filter(dev);
1569 spin_unlock(&priv->lock);
1570 return;
1571}
1572
1573/**
1574 * stmmac_change_mtu - entry point to change MTU size for the device.
1575 * @dev : device pointer.
1576 * @new_mtu : the new MTU size for the device.
1577 * Description: the Maximum Transfer Unit (MTU) is used by the network layer
1578 * to drive packet transmission. Ethernet has an MTU of 1500 octets
1579 * (ETH_DATA_LEN). This value can be changed with ifconfig.
1580 * Return value:
1581 * 0 on success and an appropriate (-)ve integer as defined in errno.h
1582 * file on failure.
1583 */
1584static int stmmac_change_mtu(struct net_device *dev, int new_mtu)
1585{
1586 struct stmmac_priv *priv = netdev_priv(dev);
1587 int max_mtu;
1588
1589 if (netif_running(dev)) {
1590 pr_err("%s: must be stopped to change its MTU\n", dev->name);
1591 return -EBUSY;
1592 }
1593
1594 if (priv->is_gmac)
1595 max_mtu = JUMBO_LEN;
1596 else
1597 max_mtu = ETH_DATA_LEN;
1598
1599 if ((new_mtu < 46) || (new_mtu > max_mtu)) {
1600 pr_err("%s: invalid MTU, max MTU is: %d\n", dev->name, max_mtu);
1601 return -EINVAL;
1602 }
1603
1604 dev->mtu = new_mtu;
1605
1606 return 0;
1607}
1608
1609static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
1610{
1611 struct net_device *dev = (struct net_device *)dev_id;
1612 struct stmmac_priv *priv = netdev_priv(dev);
1613
1614 if (unlikely(!dev)) {
1615 pr_err("%s: invalid dev pointer\n", __func__);
1616 return IRQ_NONE;
1617 }
1618
1619 if (priv->is_gmac) {
1620 unsigned long ioaddr = dev->base_addr;
1621 /* To handle GMAC own interrupts */
1622 priv->mac_type->ops->host_irq_status(ioaddr);
1623 }
1624 stmmac_dma_interrupt(dev);
1625
1626 return IRQ_HANDLED;
1627}
1628
1629#ifdef CONFIG_NET_POLL_CONTROLLER
1630/* Polling receive - used by NETCONSOLE and other diagnostic tools
1631 * to allow network I/O with interrupts disabled. */
1632static void stmmac_poll_controller(struct net_device *dev)
1633{
1634 disable_irq(dev->irq);
1635 stmmac_interrupt(dev->irq, dev);
1636 enable_irq(dev->irq);
1637}
1638#endif
1639
1640/**
1641 * stmmac_ioctl - Entry point for the Ioctl
1642 * @dev: Device pointer.
1643 * @rq: An IOCTL specefic structure, that can contain a pointer to
1644 * a proprietary structure used to pass information to the driver.
1645 * @cmd: IOCTL command
1646 * Description:
1647 * Currently there are no special functionality supported in IOCTL, just the
1648 * phy_mii_ioctl(...) can be invoked.
1649 */
1650static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1651{
1652 struct stmmac_priv *priv = netdev_priv(dev);
1653 int ret = -EOPNOTSUPP;
1654
1655 if (!netif_running(dev))
1656 return -EINVAL;
1657
1658 switch (cmd) {
1659 case SIOCGMIIPHY:
1660 case SIOCGMIIREG:
1661 case SIOCSMIIREG:
1662 if (!priv->phydev)
1663 return -EINVAL;
1664
1665 spin_lock(&priv->lock);
1666 ret = phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
1667 spin_unlock(&priv->lock);
1668 default:
1669 break;
1670 }
1671 return ret;
1672}
1673
1674#ifdef STMMAC_VLAN_TAG_USED
1675static void stmmac_vlan_rx_register(struct net_device *dev,
1676 struct vlan_group *grp)
1677{
1678 struct stmmac_priv *priv = netdev_priv(dev);
1679
1680 DBG(probe, INFO, "%s: Setting vlgrp to %p\n", dev->name, grp);
1681
1682 spin_lock(&priv->lock);
1683 priv->vlgrp = grp;
1684 spin_unlock(&priv->lock);
1685
1686 return;
1687}
1688#endif
1689
1690static const struct net_device_ops stmmac_netdev_ops = {
1691 .ndo_open = stmmac_open,
1692 .ndo_start_xmit = stmmac_xmit,
1693 .ndo_stop = stmmac_release,
1694 .ndo_change_mtu = stmmac_change_mtu,
1695 .ndo_set_multicast_list = stmmac_multicast_list,
1696 .ndo_tx_timeout = stmmac_tx_timeout,
1697 .ndo_do_ioctl = stmmac_ioctl,
1698 .ndo_set_config = stmmac_config,
1699#ifdef STMMAC_VLAN_TAG_USED
1700 .ndo_vlan_rx_register = stmmac_vlan_rx_register,
1701#endif
1702#ifdef CONFIG_NET_POLL_CONTROLLER
1703 .ndo_poll_controller = stmmac_poll_controller,
1704#endif
1705 .ndo_set_mac_address = eth_mac_addr,
1706};
1707
1708/**
1709 * stmmac_probe - Initialization of the adapter .
1710 * @dev : device pointer
1711 * Description: The function initializes the network device structure for
1712 * the STMMAC driver. It also calls the low level routines
1713 * in order to init the HW (i.e. the DMA engine)
1714 */
1715static int stmmac_probe(struct net_device *dev)
1716{
1717 int ret = 0;
1718 struct stmmac_priv *priv = netdev_priv(dev);
1719
1720 ether_setup(dev);
1721
1722 dev->netdev_ops = &stmmac_netdev_ops;
1723 stmmac_set_ethtool_ops(dev);
1724
1725 dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA);
1726 dev->watchdog_timeo = msecs_to_jiffies(watchdog);
1727#ifdef STMMAC_VLAN_TAG_USED
1728 /* Both mac100 and gmac support receive VLAN tag detection */
1729 dev->features |= NETIF_F_HW_VLAN_RX;
1730#endif
1731 priv->msg_enable = netif_msg_init(debug, default_msg_level);
1732
1733 if (priv->is_gmac)
1734 priv->rx_csum = 1;
1735
1736 if (flow_ctrl)
1737 priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */
1738
1739 priv->pause = pause;
1740 netif_napi_add(dev, &priv->napi, stmmac_poll, 64);
1741
1742 /* Get the MAC address */
1743 priv->mac_type->ops->get_umac_addr(dev->base_addr, dev->dev_addr, 0);
1744
1745 if (!is_valid_ether_addr(dev->dev_addr))
1746 pr_warning("\tno valid MAC address;"
1747 "please, use ifconfig or nwhwconfig!\n");
1748
1749 ret = register_netdev(dev);
1750 if (ret) {
1751 pr_err("%s: ERROR %i registering the device\n",
1752 __func__, ret);
1753 return -ENODEV;
1754 }
1755
1756 DBG(probe, DEBUG, "%s: Scatter/Gather: %s - HW checksums: %s\n",
1757 dev->name, (dev->features & NETIF_F_SG) ? "on" : "off",
1758 (dev->features & NETIF_F_HW_CSUM) ? "on" : "off");
1759
1760 spin_lock_init(&priv->lock);
1761
1762 return ret;
1763}
1764
1765/**
1766 * stmmac_mac_device_setup
1767 * @dev : device pointer
1768 * Description: select and initialise the mac device (mac100 or Gmac).
1769 */
1770static int stmmac_mac_device_setup(struct net_device *dev)
1771{
1772 struct stmmac_priv *priv = netdev_priv(dev);
1773 unsigned long ioaddr = dev->base_addr;
1774
1775 struct mac_device_info *device;
1776
1777 if (priv->is_gmac)
1778 device = gmac_setup(ioaddr);
1779 else
1780 device = mac100_setup(ioaddr);
1781
1782 if (!device)
1783 return -ENOMEM;
1784
1785 priv->mac_type = device;
1786
1787 priv->wolenabled = priv->mac_type->hw.pmt; /* PMT supported */
1788 if (priv->wolenabled == PMT_SUPPORTED)
1789 priv->wolopts = WAKE_MAGIC; /* Magic Frame */
1790
1791 return 0;
1792}
1793
1794static int stmmacphy_dvr_probe(struct platform_device *pdev)
1795{
1796 struct plat_stmmacphy_data *plat_dat;
1797 plat_dat = (struct plat_stmmacphy_data *)((pdev->dev).platform_data);
1798
1799 pr_debug("stmmacphy_dvr_probe: added phy for bus %d\n",
1800 plat_dat->bus_id);
1801
1802 return 0;
1803}
1804
1805static int stmmacphy_dvr_remove(struct platform_device *pdev)
1806{
1807 return 0;
1808}
1809
1810static struct platform_driver stmmacphy_driver = {
1811 .driver = {
1812 .name = PHY_RESOURCE_NAME,
1813 },
1814 .probe = stmmacphy_dvr_probe,
1815 .remove = stmmacphy_dvr_remove,
1816};
1817
1818/**
1819 * stmmac_associate_phy
1820 * @dev: pointer to device structure
1821 * @data: points to the private structure.
1822 * Description: Scans through all the PHYs we have registered and checks if
1823 * any are associated with our MAC. If so, then just fill in
1824 * the blanks in our local context structure
1825 */
1826static int stmmac_associate_phy(struct device *dev, void *data)
1827{
1828 struct stmmac_priv *priv = (struct stmmac_priv *)data;
1829 struct plat_stmmacphy_data *plat_dat;
1830
1831 plat_dat = (struct plat_stmmacphy_data *)(dev->platform_data);
1832
1833 DBG(probe, DEBUG, "%s: checking phy for bus %d\n", __func__,
1834 plat_dat->bus_id);
1835
1836 /* Check that this phy is for the MAC being initialised */
1837 if (priv->bus_id != plat_dat->bus_id)
1838 return 0;
1839
1840 /* OK, this PHY is connected to the MAC.
1841 Go ahead and get the parameters */
1842 DBG(probe, DEBUG, "%s: OK. Found PHY config\n", __func__);
1843 priv->phy_irq =
1844 platform_get_irq_byname(to_platform_device(dev), "phyirq");
1845 DBG(probe, DEBUG, "%s: PHY irq on bus %d is %d\n", __func__,
1846 plat_dat->bus_id, priv->phy_irq);
1847
1848 /* Override with kernel parameters if supplied XXX CRS XXX
1849 * this needs to have multiple instances */
1850 if ((phyaddr >= 0) && (phyaddr <= 31))
1851 plat_dat->phy_addr = phyaddr;
1852
1853 priv->phy_addr = plat_dat->phy_addr;
1854 priv->phy_mask = plat_dat->phy_mask;
1855 priv->phy_interface = plat_dat->interface;
1856 priv->phy_reset = plat_dat->phy_reset;
1857
1858 DBG(probe, DEBUG, "%s: exiting\n", __func__);
1859 return 1; /* forces exit of driver_for_each_device() */
1860}
1861
1862/**
1863 * stmmac_dvr_probe
1864 * @pdev: platform device pointer
1865 * Description: the driver is initialized through platform_device.
1866 */
1867static int stmmac_dvr_probe(struct platform_device *pdev)
1868{
1869 int ret = 0;
1870 struct resource *res;
1871 unsigned int *addr = NULL;
1872 struct net_device *ndev = NULL;
1873 struct stmmac_priv *priv;
1874 struct plat_stmmacenet_data *plat_dat;
1875
1876 pr_info("STMMAC driver:\n\tplatform registration... ");
1877 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1878 if (!res) {
1879 ret = -ENODEV;
1880 goto out;
1881 }
1882 pr_info("done!\n");
1883
1884 if (!request_mem_region(res->start, (res->end - res->start),
1885 pdev->name)) {
1886 pr_err("%s: ERROR: memory allocation failed"
1887 "cannot get the I/O addr 0x%x\n",
1888 __func__, (unsigned int)res->start);
1889 ret = -EBUSY;
1890 goto out;
1891 }
1892
1893 addr = ioremap(res->start, (res->end - res->start));
1894 if (!addr) {
1895 pr_err("%s: ERROR: memory mapping failed \n", __func__);
1896 ret = -ENOMEM;
1897 goto out;
1898 }
1899
1900 ndev = alloc_etherdev(sizeof(struct stmmac_priv));
1901 if (!ndev) {
1902 pr_err("%s: ERROR: allocating the device\n", __func__);
1903 ret = -ENOMEM;
1904 goto out;
1905 }
1906
1907 SET_NETDEV_DEV(ndev, &pdev->dev);
1908
1909 /* Get the MAC information */
1910 ndev->irq = platform_get_irq_byname(pdev, "macirq");
1911 if (ndev->irq == -ENXIO) {
1912 pr_err("%s: ERROR: MAC IRQ configuration "
1913 "information not found\n", __func__);
1914 ret = -ENODEV;
1915 goto out;
1916 }
1917
1918 priv = netdev_priv(ndev);
1919 priv->device = &(pdev->dev);
1920 priv->dev = ndev;
1921 plat_dat = (struct plat_stmmacenet_data *)((pdev->dev).platform_data);
1922 priv->bus_id = plat_dat->bus_id;
1923 priv->pbl = plat_dat->pbl; /* TLI */
1924 priv->is_gmac = plat_dat->has_gmac; /* GMAC is on board */
1925
1926 platform_set_drvdata(pdev, ndev);
1927
1928 /* Set the I/O base addr */
1929 ndev->base_addr = (unsigned long)addr;
1930
1931 /* MAC HW revice detection */
1932 ret = stmmac_mac_device_setup(ndev);
1933 if (ret < 0)
1934 goto out;
1935
1936 /* Network Device Registration */
1937 ret = stmmac_probe(ndev);
1938 if (ret < 0)
1939 goto out;
1940
1941 /* associate a PHY - it is provided by another platform bus */
1942 if (!driver_for_each_device
1943 (&(stmmacphy_driver.driver), NULL, (void *)priv,
1944 stmmac_associate_phy)) {
1945 pr_err("No PHY device is associated with this MAC!\n");
1946 ret = -ENODEV;
1947 goto out;
1948 }
1949
1950 priv->fix_mac_speed = plat_dat->fix_mac_speed;
1951 priv->bsp_priv = plat_dat->bsp_priv;
1952
1953 pr_info("\t%s - (dev. name: %s - id: %d, IRQ #%d\n"
1954 "\tIO base addr: 0x%08x)\n", ndev->name, pdev->name,
1955 pdev->id, ndev->irq, (unsigned int)addr);
1956
1957 /* MDIO bus Registration */
1958 pr_debug("\tMDIO bus (id: %d)...", priv->bus_id);
1959 ret = stmmac_mdio_register(ndev);
1960 if (ret < 0)
1961 goto out;
1962 pr_debug("registered!\n");
1963
1964out:
1965 if (ret < 0) {
1966 platform_set_drvdata(pdev, NULL);
1967 release_mem_region(res->start, (res->end - res->start));
1968 if (addr != NULL)
1969 iounmap(addr);
1970 }
1971
1972 return ret;
1973}
1974
1975/**
1976 * stmmac_dvr_remove
1977 * @pdev: platform device pointer
1978 * Description: this function resets the TX/RX processes, disables the MAC RX/TX
1979 * changes the link status, releases the DMA descriptor rings,
1980 * unregisters the MDIO bus and unmaps the allocated memory.
1981 */
1982static int stmmac_dvr_remove(struct platform_device *pdev)
1983{
1984 struct net_device *ndev = platform_get_drvdata(pdev);
1985 struct resource *res;
1986
1987 pr_info("%s:\n\tremoving driver", __func__);
1988
1989 stmmac_dma_stop_rx(ndev->base_addr);
1990 stmmac_dma_stop_tx(ndev->base_addr);
1991
1992 stmmac_mac_disable_rx(ndev->base_addr);
1993 stmmac_mac_disable_tx(ndev->base_addr);
1994
1995 netif_carrier_off(ndev);
1996
1997 stmmac_mdio_unregister(ndev);
1998
1999 platform_set_drvdata(pdev, NULL);
2000 unregister_netdev(ndev);
2001
2002 iounmap((void *)ndev->base_addr);
2003 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2004 release_mem_region(res->start, (res->end - res->start));
2005
2006 free_netdev(ndev);
2007
2008 return 0;
2009}
2010
2011#ifdef CONFIG_PM
2012static int stmmac_suspend(struct platform_device *pdev, pm_message_t state)
2013{
2014 struct net_device *dev = platform_get_drvdata(pdev);
2015 struct stmmac_priv *priv = netdev_priv(dev);
2016 int dis_ic = 0;
2017
2018 if (!dev || !netif_running(dev))
2019 return 0;
2020
2021 spin_lock(&priv->lock);
2022
2023 if (state.event == PM_EVENT_SUSPEND) {
2024 netif_device_detach(dev);
2025 netif_stop_queue(dev);
2026 if (priv->phydev)
2027 phy_stop(priv->phydev);
2028
2029#ifdef CONFIG_STMMAC_TIMER
2030 priv->tm->timer_stop();
2031 dis_ic = 1;
2032#endif
2033 napi_disable(&priv->napi);
2034
2035 /* Stop TX/RX DMA */
2036 stmmac_dma_stop_tx(dev->base_addr);
2037 stmmac_dma_stop_rx(dev->base_addr);
2038 /* Clear the Rx/Tx descriptors */
2039 priv->mac_type->ops->init_rx_desc(priv->dma_rx,
2040 priv->dma_rx_size, dis_ic);
2041 priv->mac_type->ops->init_tx_desc(priv->dma_tx,
2042 priv->dma_tx_size);
2043
2044 stmmac_mac_disable_tx(dev->base_addr);
2045
2046 if (device_may_wakeup(&(pdev->dev))) {
2047 /* Enable Power down mode by programming the PMT regs */
2048 if (priv->wolenabled == PMT_SUPPORTED)
2049 priv->mac_type->ops->pmt(dev->base_addr,
2050 priv->wolopts);
2051 } else {
2052 stmmac_mac_disable_rx(dev->base_addr);
2053 }
2054 } else {
2055 priv->shutdown = 1;
2056 /* Although this can appear slightly redundant it actually
2057 * makes fast the standby operation and guarantees the driver
2058 * working if hibernation is on media. */
2059 stmmac_release(dev);
2060 }
2061
2062 spin_unlock(&priv->lock);
2063 return 0;
2064}
2065
2066static int stmmac_resume(struct platform_device *pdev)
2067{
2068 struct net_device *dev = platform_get_drvdata(pdev);
2069 struct stmmac_priv *priv = netdev_priv(dev);
2070 unsigned long ioaddr = dev->base_addr;
2071
2072 if (!netif_running(dev))
2073 return 0;
2074
2075 spin_lock(&priv->lock);
2076
2077 if (priv->shutdown) {
2078 /* Re-open the interface and re-init the MAC/DMA
2079 and the rings. */
2080 stmmac_open(dev);
2081 goto out_resume;
2082 }
2083
2084 /* Power Down bit, into the PM register, is cleared
2085 * automatically as soon as a magic packet or a Wake-up frame
2086 * is received. Anyway, it's better to manually clear
2087 * this bit because it can generate problems while resuming
2088 * from another devices (e.g. serial console). */
2089 if (device_may_wakeup(&(pdev->dev)))
2090 if (priv->wolenabled == PMT_SUPPORTED)
2091 priv->mac_type->ops->pmt(dev->base_addr, 0);
2092
2093 netif_device_attach(dev);
2094
2095 /* Enable the MAC and DMA */
2096 stmmac_mac_enable_rx(ioaddr);
2097 stmmac_mac_enable_tx(ioaddr);
2098 stmmac_dma_start_tx(ioaddr);
2099 stmmac_dma_start_rx(ioaddr);
2100
2101#ifdef CONFIG_STMMAC_TIMER
2102 priv->tm->timer_start(tmrate);
2103#endif
2104 napi_enable(&priv->napi);
2105
2106 if (priv->phydev)
2107 phy_start(priv->phydev);
2108
2109 netif_start_queue(dev);
2110
2111out_resume:
2112 spin_unlock(&priv->lock);
2113 return 0;
2114}
2115#endif
2116
2117static struct platform_driver stmmac_driver = {
2118 .driver = {
2119 .name = STMMAC_RESOURCE_NAME,
2120 },
2121 .probe = stmmac_dvr_probe,
2122 .remove = stmmac_dvr_remove,
2123#ifdef CONFIG_PM
2124 .suspend = stmmac_suspend,
2125 .resume = stmmac_resume,
2126#endif
2127
2128};
2129
2130/**
2131 * stmmac_init_module - Entry point for the driver
2132 * Description: This function is the entry point for the driver.
2133 */
2134static int __init stmmac_init_module(void)
2135{
2136 int ret;
2137
2138 if (platform_driver_register(&stmmacphy_driver)) {
2139 pr_err("No PHY devices registered!\n");
2140 return -ENODEV;
2141 }
2142
2143 ret = platform_driver_register(&stmmac_driver);
2144 return ret;
2145}
2146
2147/**
2148 * stmmac_cleanup_module - Cleanup routine for the driver
2149 * Description: This function is the cleanup routine for the driver.
2150 */
2151static void __exit stmmac_cleanup_module(void)
2152{
2153 platform_driver_unregister(&stmmacphy_driver);
2154 platform_driver_unregister(&stmmac_driver);
2155}
2156
2157#ifndef MODULE
2158static int __init stmmac_cmdline_opt(char *str)
2159{
2160 char *opt;
2161
2162 if (!str || !*str)
2163 return -EINVAL;
2164 while ((opt = strsep(&str, ",")) != NULL) {
2165 if (!strncmp(opt, "debug:", 6))
2166 strict_strtoul(opt + 6, 0, (unsigned long *)&debug);
2167 else if (!strncmp(opt, "phyaddr:", 8))
2168 strict_strtoul(opt + 8, 0, (unsigned long *)&phyaddr);
2169 else if (!strncmp(opt, "dma_txsize:", 11))
2170 strict_strtoul(opt + 11, 0,
2171 (unsigned long *)&dma_txsize);
2172 else if (!strncmp(opt, "dma_rxsize:", 11))
2173 strict_strtoul(opt + 11, 0,
2174 (unsigned long *)&dma_rxsize);
2175 else if (!strncmp(opt, "buf_sz:", 7))
2176 strict_strtoul(opt + 7, 0, (unsigned long *)&buf_sz);
2177 else if (!strncmp(opt, "tc:", 3))
2178 strict_strtoul(opt + 3, 0, (unsigned long *)&tc);
2179 else if (!strncmp(opt, "tx_coe:", 7))
2180 strict_strtoul(opt + 7, 0, (unsigned long *)&tx_coe);
2181 else if (!strncmp(opt, "watchdog:", 9))
2182 strict_strtoul(opt + 9, 0, (unsigned long *)&watchdog);
2183 else if (!strncmp(opt, "flow_ctrl:", 10))
2184 strict_strtoul(opt + 10, 0,
2185 (unsigned long *)&flow_ctrl);
2186 else if (!strncmp(opt, "pause:", 6))
2187 strict_strtoul(opt + 6, 0, (unsigned long *)&pause);
2188#ifdef CONFIG_STMMAC_TIMER
2189 else if (!strncmp(opt, "tmrate:", 7))
2190 strict_strtoul(opt + 7, 0, (unsigned long *)&tmrate);
2191#endif
2192 }
2193 return 0;
2194}
2195
2196__setup("stmmaceth=", stmmac_cmdline_opt);
2197#endif
2198
2199module_init(stmmac_init_module);
2200module_exit(stmmac_cleanup_module);
2201
2202MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet driver");
2203MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
2204MODULE_LICENSE("GPL");
diff --git a/drivers/net/stmmac/stmmac_mdio.c b/drivers/net/stmmac/stmmac_mdio.c
new file mode 100644
index 000000000000..8498552a22fc
--- /dev/null
+++ b/drivers/net/stmmac/stmmac_mdio.c
@@ -0,0 +1,217 @@
1/*******************************************************************************
2 STMMAC Ethernet Driver -- MDIO bus implementation
3 Provides Bus interface for MII registers
4
5 Copyright (C) 2007-2009 STMicroelectronics Ltd
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms and conditions of the GNU General Public License,
9 version 2, as published by the Free Software Foundation.
10
11 This program is distributed in the hope it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU General Public License along with
17 this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19
20 The full GNU General Public License is included in this distribution in
21 the file called "COPYING".
22
23 Author: Carl Shaw <carl.shaw@st.com>
24 Maintainer: Giuseppe Cavallaro <peppe.cavallaro@st.com>
25*******************************************************************************/
26
27#include <linux/netdevice.h>
28#include <linux/mii.h>
29#include <linux/phy.h>
30
31#include "stmmac.h"
32
33#define MII_BUSY 0x00000001
34#define MII_WRITE 0x00000002
35
36/**
37 * stmmac_mdio_read
38 * @bus: points to the mii_bus structure
39 * @phyaddr: MII addr reg bits 15-11
40 * @phyreg: MII addr reg bits 10-6
41 * Description: it reads data from the MII register from within the phy device.
42 * For the 7111 GMAC, we must set the bit 0 in the MII address register while
43 * accessing the PHY registers.
44 * Fortunately, it seems this has no drawback for the 7109 MAC.
45 */
46static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
47{
48 struct net_device *ndev = bus->priv;
49 struct stmmac_priv *priv = netdev_priv(ndev);
50 unsigned long ioaddr = ndev->base_addr;
51 unsigned int mii_address = priv->mac_type->hw.mii.addr;
52 unsigned int mii_data = priv->mac_type->hw.mii.data;
53
54 int data;
55 u16 regValue = (((phyaddr << 11) & (0x0000F800)) |
56 ((phyreg << 6) & (0x000007C0)));
57 regValue |= MII_BUSY; /* in case of GMAC */
58
59 do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1);
60 writel(regValue, ioaddr + mii_address);
61 do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1);
62
63 /* Read the data from the MII data register */
64 data = (int)readl(ioaddr + mii_data);
65
66 return data;
67}
68
69/**
70 * stmmac_mdio_write
71 * @bus: points to the mii_bus structure
72 * @phyaddr: MII addr reg bits 15-11
73 * @phyreg: MII addr reg bits 10-6
74 * @phydata: phy data
75 * Description: it writes the data into the MII register from within the device.
76 */
77static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
78 u16 phydata)
79{
80 struct net_device *ndev = bus->priv;
81 struct stmmac_priv *priv = netdev_priv(ndev);
82 unsigned long ioaddr = ndev->base_addr;
83 unsigned int mii_address = priv->mac_type->hw.mii.addr;
84 unsigned int mii_data = priv->mac_type->hw.mii.data;
85
86 u16 value =
87 (((phyaddr << 11) & (0x0000F800)) | ((phyreg << 6) & (0x000007C0)))
88 | MII_WRITE;
89
90 value |= MII_BUSY;
91
92 /* Wait until any existing MII operation is complete */
93 do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1);
94
95 /* Set the MII address register to write */
96 writel(phydata, ioaddr + mii_data);
97 writel(value, ioaddr + mii_address);
98
99 /* Wait until any existing MII operation is complete */
100 do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1);
101
102 return 0;
103}
104
105/**
106 * stmmac_mdio_reset
107 * @bus: points to the mii_bus structure
108 * Description: reset the MII bus
109 */
110static int stmmac_mdio_reset(struct mii_bus *bus)
111{
112 struct net_device *ndev = bus->priv;
113 struct stmmac_priv *priv = netdev_priv(ndev);
114 unsigned long ioaddr = ndev->base_addr;
115 unsigned int mii_address = priv->mac_type->hw.mii.addr;
116
117 if (priv->phy_reset) {
118 pr_debug("stmmac_mdio_reset: calling phy_reset\n");
119 priv->phy_reset(priv->bsp_priv);
120 }
121
122 /* This is a workaround for problems with the STE101P PHY.
123 * It doesn't complete its reset until at least one clock cycle
124 * on MDC, so perform a dummy mdio read.
125 */
126 writel(0, ioaddr + mii_address);
127
128 return 0;
129}
130
131/**
132 * stmmac_mdio_register
133 * @ndev: net device structure
134 * Description: it registers the MII bus
135 */
136int stmmac_mdio_register(struct net_device *ndev)
137{
138 int err = 0;
139 struct mii_bus *new_bus;
140 int *irqlist;
141 struct stmmac_priv *priv = netdev_priv(ndev);
142 int addr, found;
143
144 new_bus = mdiobus_alloc();
145 if (new_bus == NULL)
146 return -ENOMEM;
147
148 irqlist = kzalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
149 if (irqlist == NULL) {
150 err = -ENOMEM;
151 goto irqlist_alloc_fail;
152 }
153
154 /* Assign IRQ to phy at address phy_addr */
155 if (priv->phy_addr != -1)
156 irqlist[priv->phy_addr] = priv->phy_irq;
157
158 new_bus->name = "STMMAC MII Bus";
159 new_bus->read = &stmmac_mdio_read;
160 new_bus->write = &stmmac_mdio_write;
161 new_bus->reset = &stmmac_mdio_reset;
162 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", priv->bus_id);
163 new_bus->priv = ndev;
164 new_bus->irq = irqlist;
165 new_bus->phy_mask = priv->phy_mask;
166 new_bus->parent = priv->device;
167 err = mdiobus_register(new_bus);
168 if (err != 0) {
169 pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
170 goto bus_register_fail;
171 }
172
173 priv->mii = new_bus;
174
175 found = 0;
176 for (addr = 0; addr < 32; addr++) {
177 struct phy_device *phydev = new_bus->phy_map[addr];
178 if (phydev) {
179 if (priv->phy_addr == -1) {
180 priv->phy_addr = addr;
181 phydev->irq = priv->phy_irq;
182 irqlist[addr] = priv->phy_irq;
183 }
184 pr_info("%s: PHY ID %08x at %d IRQ %d (%s)%s\n",
185 ndev->name, phydev->phy_id, addr,
186 phydev->irq, dev_name(&phydev->dev),
187 (addr == priv->phy_addr) ? " active" : "");
188 found = 1;
189 }
190 }
191
192 if (!found)
193 pr_warning("%s: No PHY found\n", ndev->name);
194
195 return 0;
196bus_register_fail:
197 kfree(irqlist);
198irqlist_alloc_fail:
199 kfree(new_bus);
200 return err;
201}
202
203/**
204 * stmmac_mdio_unregister
205 * @ndev: net device structure
206 * Description: it unregisters the MII bus
207 */
208int stmmac_mdio_unregister(struct net_device *ndev)
209{
210 struct stmmac_priv *priv = netdev_priv(ndev);
211
212 mdiobus_unregister(priv->mii);
213 priv->mii->priv = NULL;
214 kfree(priv->mii);
215
216 return 0;
217}
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c
new file mode 100644
index 000000000000..b838c6582077
--- /dev/null
+++ b/drivers/net/stmmac/stmmac_timer.c
@@ -0,0 +1,140 @@
1/*******************************************************************************
2 STMMAC external timer support.
3
4 Copyright (C) 2007-2009 STMicroelectronics Ltd
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
23*******************************************************************************/
24
25#include <linux/kernel.h>
26#include <linux/etherdevice.h>
27#include "stmmac_timer.h"
28
29static void stmmac_timer_handler(void *data)
30{
31 struct net_device *dev = (struct net_device *)data;
32
33 stmmac_schedule(dev);
34
35 return;
36}
37
38#define STMMAC_TIMER_MSG(timer, freq) \
39printk(KERN_INFO "stmmac_timer: %s Timer ON (freq %dHz)\n", timer, freq);
40
41#if defined(CONFIG_STMMAC_RTC_TIMER)
42#include <linux/rtc.h>
43static struct rtc_device *stmmac_rtc;
44static rtc_task_t stmmac_task;
45
46static void stmmac_rtc_start(unsigned int new_freq)
47{
48 rtc_irq_set_freq(stmmac_rtc, &stmmac_task, new_freq);
49 rtc_irq_set_state(stmmac_rtc, &stmmac_task, 1);
50 return;
51}
52
53static void stmmac_rtc_stop(void)
54{
55 rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0);
56 return;
57}
58
59int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
60{
61 stmmac_task.private_data = dev;
62 stmmac_task.func = stmmac_timer_handler;
63
64 stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
65 if (stmmac_rtc == NULL) {
66 pr_error("open rtc device failed\n");
67 return -ENODEV;
68 }
69
70 rtc_irq_register(stmmac_rtc, &stmmac_task);
71
72 /* Periodic mode is not supported */
73 if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) {
74 pr_error("set periodic failed\n");
75 rtc_irq_unregister(stmmac_rtc, &stmmac_task);
76 rtc_class_close(stmmac_rtc);
77 return -1;
78 }
79
80 STMMAC_TIMER_MSG(CONFIG_RTC_HCTOSYS_DEVICE, tm->freq);
81
82 tm->timer_start = stmmac_rtc_start;
83 tm->timer_stop = stmmac_rtc_stop;
84
85 return 0;
86}
87
88int stmmac_close_ext_timer(void)
89{
90 rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0);
91 rtc_irq_unregister(stmmac_rtc, &stmmac_task);
92 rtc_class_close(stmmac_rtc);
93 return 0;
94}
95
96#elif defined(CONFIG_STMMAC_TMU_TIMER)
97#include <linux/clk.h>
98#define TMU_CHANNEL "tmu2_clk"
99static struct clk *timer_clock;
100
101static void stmmac_tmu_start(unsigned int new_freq)
102{
103 clk_set_rate(timer_clock, new_freq);
104 clk_enable(timer_clock);
105 return;
106}
107
108static void stmmac_tmu_stop(void)
109{
110 clk_disable(timer_clock);
111 return;
112}
113
114int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
115{
116 timer_clock = clk_get(NULL, TMU_CHANNEL);
117
118 if (timer_clock == NULL)
119 return -1;
120
121 if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) {
122 timer_clock = NULL;
123 return -1;
124 }
125
126 STMMAC_TIMER_MSG("TMU2", tm->freq);
127 tm->timer_start = stmmac_tmu_start;
128 tm->timer_stop = stmmac_tmu_stop;
129
130 return 0;
131}
132
133int stmmac_close_ext_timer(void)
134{
135 clk_disable(timer_clock);
136 tmu2_unregister_user();
137 clk_put(timer_clock);
138 return 0;
139}
140#endif
diff --git a/drivers/net/stmmac/stmmac_timer.h b/drivers/net/stmmac/stmmac_timer.h
new file mode 100644
index 000000000000..f795cae33725
--- /dev/null
+++ b/drivers/net/stmmac/stmmac_timer.h
@@ -0,0 +1,41 @@
1/*******************************************************************************
2 STMMAC external timer Header File.
3
4 Copyright (C) 2007-2009 STMicroelectronics Ltd
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
23*******************************************************************************/
24
25struct stmmac_timer {
26 void (*timer_start) (unsigned int new_freq);
27 void (*timer_stop) (void);
28 unsigned int freq;
29};
30
31/* Open the HW timer device and return 0 in case of success */
32int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm);
33/* Stop the timer and release it */
34int stmmac_close_ext_timer(void);
35/* Function used for scheduling task within the stmmac */
36void stmmac_schedule(struct net_device *dev);
37
38#if defined(CONFIG_STMMAC_TMU_TIMER)
39extern int tmu2_register_user(void *fnt, void *data);
40extern void tmu2_unregister_user(void);
41#endif
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 36cb2423bcf1..75fa32e34fd0 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -1144,9 +1144,16 @@ static void dir_open_adapter (struct net_device *dev)
1144 } else { 1144 } else {
1145 char **prphase = printphase; 1145 char **prphase = printphase;
1146 char **prerror = printerror; 1146 char **prerror = printerror;
1147 int pnr = err / 16 - 1;
1148 int enr = err % 16 - 1;
1147 DPRINTK("TR Adapter misc open failure, error code = "); 1149 DPRINTK("TR Adapter misc open failure, error code = ");
1148 printk("0x%x, Phase: %s, Error: %s\n", 1150 if (pnr < 0 || pnr >= ARRAY_SIZE(printphase) ||
1149 err, prphase[err/16 -1], prerror[err%16 -1]); 1151 enr < 0 ||
1152 enr >= ARRAY_SIZE(printerror))
1153 printk("0x%x, invalid Phase/Error.", err);
1154 else
1155 printk("0x%x, Phase: %s, Error: %s\n", err,
1156 prphase[pnr], prerror[enr]);
1150 printk(" retrying after %ds delay...\n", 1157 printk(" retrying after %ds delay...\n",
1151 TR_RETRY_INTERVAL/HZ); 1158 TR_RETRY_INTERVAL/HZ);
1152 } 1159 }
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 72470f77f556..a2b30a10064f 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -649,6 +649,10 @@ static const struct usb_device_id products[] = {
649 USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */ 649 USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */
650 .driver_info = (unsigned long)&dm9601_info, 650 .driver_info = (unsigned long)&dm9601_info,
651 }, 651 },
652 {
653 USB_DEVICE(0x0a46, 0x9000), /* DM9000E */
654 .driver_info = (unsigned long)&dm9601_info,
655 },
652 {}, // END 656 {}, // END
653}; 657};
654 658
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 6fdaba8674b9..ed4a508ef262 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -62,8 +62,11 @@ static char *devid=NULL;
62static struct usb_eth_dev usb_dev_id[] = { 62static struct usb_eth_dev usb_dev_id[] = {
63#define PEGASUS_DEV(pn, vid, pid, flags) \ 63#define PEGASUS_DEV(pn, vid, pid, flags) \
64 {.name = pn, .vendor = vid, .device = pid, .private = flags}, 64 {.name = pn, .vendor = vid, .device = pid, .private = flags},
65#define PEGASUS_DEV_CLASS(pn, vid, pid, dclass, flags) \
66 PEGASUS_DEV(pn, vid, pid, flags)
65#include "pegasus.h" 67#include "pegasus.h"
66#undef PEGASUS_DEV 68#undef PEGASUS_DEV
69#undef PEGASUS_DEV_CLASS
67 {NULL, 0, 0, 0}, 70 {NULL, 0, 0, 0},
68 {NULL, 0, 0, 0} 71 {NULL, 0, 0, 0}
69}; 72};
@@ -71,8 +74,18 @@ static struct usb_eth_dev usb_dev_id[] = {
71static struct usb_device_id pegasus_ids[] = { 74static struct usb_device_id pegasus_ids[] = {
72#define PEGASUS_DEV(pn, vid, pid, flags) \ 75#define PEGASUS_DEV(pn, vid, pid, flags) \
73 {.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = vid, .idProduct = pid}, 76 {.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = vid, .idProduct = pid},
77/*
78 * The Belkin F8T012xx1 bluetooth adaptor has the same vendor and product
79 * IDs as the Belkin F5D5050, so we need to teach the pegasus driver to
80 * ignore adaptors belonging to the "Wireless" class 0xE0. For this one
81 * case anyway, seeing as the pegasus is for "Wired" adaptors.
82 */
83#define PEGASUS_DEV_CLASS(pn, vid, pid, dclass, flags) \
84 {.match_flags = (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_CLASS), \
85 .idVendor = vid, .idProduct = pid, .bDeviceClass = dclass},
74#include "pegasus.h" 86#include "pegasus.h"
75#undef PEGASUS_DEV 87#undef PEGASUS_DEV
88#undef PEGASUS_DEV_CLASS
76 {}, 89 {},
77 {} 90 {}
78}; 91};
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h
index f968c834ff63..5d02f0200737 100644
--- a/drivers/net/usb/pegasus.h
+++ b/drivers/net/usb/pegasus.h
@@ -202,7 +202,11 @@ PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
202 DEFAULT_GPIO_RESET | PEGASUS_II ) 202 DEFAULT_GPIO_RESET | PEGASUS_II )
203PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, 203PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
204 DEFAULT_GPIO_RESET | PEGASUS_II ) 204 DEFAULT_GPIO_RESET | PEGASUS_II )
205PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 205/*
206 * Distinguish between this Belkin adaptor and the Belkin bluetooth adaptors
207 * with the same product IDs by checking the device class too.
208 */
209PEGASUS_DEV_CLASS( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
206 DEFAULT_GPIO_RESET | PEGASUS_II ) 210 DEFAULT_GPIO_RESET | PEGASUS_II )
207PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, 211PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
208 DEFAULT_GPIO_RESET ) 212 DEFAULT_GPIO_RESET )
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 0caa8008c51c..f56dec6119c3 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -362,12 +362,12 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
362 retval = -EINVAL; 362 retval = -EINVAL;
363 goto halt_fail_and_release; 363 goto halt_fail_and_release;
364 } 364 }
365 dev->hard_mtu = tmp;
366 net->mtu = dev->hard_mtu - net->hard_header_len;
367 dev_warn(&intf->dev, 365 dev_warn(&intf->dev,
368 "dev can't take %u byte packets (max %u), " 366 "dev can't take %u byte packets (max %u), "
369 "adjusting MTU to %u\n", 367 "adjusting MTU to %u\n",
370 dev->hard_mtu, tmp, net->mtu); 368 dev->hard_mtu, tmp, tmp - net->hard_header_len);
369 dev->hard_mtu = tmp;
370 net->mtu = dev->hard_mtu - net->hard_header_len;
371 } 371 }
372 372
373 /* REVISIT: peripheral "alignment" request is ignored ... */ 373 /* REVISIT: peripheral "alignment" request is ignored ... */
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 8d009760277c..05630f2f6930 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -22,7 +22,6 @@
22#include <linux/ethtool.h> 22#include <linux/ethtool.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/virtio.h> 24#include <linux/virtio.h>
25#include <linux/virtio_ids.h>
26#include <linux/virtio_net.h> 25#include <linux/virtio_net.h>
27#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
28#include <linux/if_vlan.h> 27#include <linux/if_vlan.h>
@@ -454,7 +453,7 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi)
454 vi->dev->stats.tx_bytes += skb->len; 453 vi->dev->stats.tx_bytes += skb->len;
455 vi->dev->stats.tx_packets++; 454 vi->dev->stats.tx_packets++;
456 tot_sgs += skb_vnet_hdr(skb)->num_sg; 455 tot_sgs += skb_vnet_hdr(skb)->num_sg;
457 kfree_skb(skb); 456 dev_kfree_skb_any(skb);
458 } 457 }
459 return tot_sgs; 458 return tot_sgs;
460} 459}
@@ -517,8 +516,7 @@ again:
517 /* Free up any pending old buffers before queueing new ones. */ 516 /* Free up any pending old buffers before queueing new ones. */
518 free_old_xmit_skbs(vi); 517 free_old_xmit_skbs(vi);
519 518
520 /* Put new one in send queue and do transmit */ 519 /* Try to transmit */
521 __skb_queue_head(&vi->send, skb);
522 capacity = xmit_skb(vi, skb); 520 capacity = xmit_skb(vi, skb);
523 521
524 /* This can happen with OOM and indirect buffers. */ 522 /* This can happen with OOM and indirect buffers. */
@@ -532,8 +530,17 @@ again:
532 } 530 }
533 return NETDEV_TX_BUSY; 531 return NETDEV_TX_BUSY;
534 } 532 }
535
536 vi->svq->vq_ops->kick(vi->svq); 533 vi->svq->vq_ops->kick(vi->svq);
534
535 /*
536 * Put new one in send queue. You'd expect we'd need this before
537 * xmit_skb calls add_buf(), since the callback can be triggered
538 * immediately after that. But since the callback just triggers
539 * another call back here, normal network xmit locking prevents the
540 * race.
541 */
542 __skb_queue_head(&vi->send, skb);
543
537 /* Don't wait up for transmitted skbs to be freed. */ 544 /* Don't wait up for transmitted skbs to be freed. */
538 skb_orphan(skb); 545 skb_orphan(skb);
539 nf_reset(skb); 546 nf_reset(skb);
diff --git a/drivers/net/vmxnet3/Makefile b/drivers/net/vmxnet3/Makefile
new file mode 100644
index 000000000000..880f5098eac9
--- /dev/null
+++ b/drivers/net/vmxnet3/Makefile
@@ -0,0 +1,35 @@
1################################################################################
2#
3# Linux driver for VMware's vmxnet3 ethernet NIC.
4#
5# Copyright (C) 2007-2009, VMware, Inc. All Rights Reserved.
6#
7# This program is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by the
9# Free Software Foundation; version 2 of the License and no later version.
10#
11# This program is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14# NON INFRINGEMENT. See the GNU General Public License for more
15# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# The full GNU General Public License is included in this distribution in
22# the file called "COPYING".
23#
24# Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
25#
26#
27################################################################################
28
29#
30# Makefile for the VMware vmxnet3 ethernet NIC driver
31#
32
33obj-$(CONFIG_VMXNET3) += vmxnet3.o
34
35vmxnet3-objs := vmxnet3_drv.o vmxnet3_ethtool.o
diff --git a/drivers/net/vmxnet3/upt1_defs.h b/drivers/net/vmxnet3/upt1_defs.h
new file mode 100644
index 000000000000..37108fb226d3
--- /dev/null
+++ b/drivers/net/vmxnet3/upt1_defs.h
@@ -0,0 +1,96 @@
1/*
2 * Linux driver for VMware's vmxnet3 ethernet NIC.
3 *
4 * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved.
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; version 2 of the License and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13 * NON INFRINGEMENT. See the GNU General Public License for more
14 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * The full GNU General Public License is included in this distribution in
21 * the file called "COPYING".
22 *
23 * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
24 *
25 */
26
27#ifndef _UPT1_DEFS_H
28#define _UPT1_DEFS_H
29
30struct UPT1_TxStats {
31 u64 TSOPktsTxOK; /* TSO pkts post-segmentation */
32 u64 TSOBytesTxOK;
33 u64 ucastPktsTxOK;
34 u64 ucastBytesTxOK;
35 u64 mcastPktsTxOK;
36 u64 mcastBytesTxOK;
37 u64 bcastPktsTxOK;
38 u64 bcastBytesTxOK;
39 u64 pktsTxError;
40 u64 pktsTxDiscard;
41};
42
43struct UPT1_RxStats {
44 u64 LROPktsRxOK; /* LRO pkts */
45 u64 LROBytesRxOK; /* bytes from LRO pkts */
46 /* the following counters are for pkts from the wire, i.e., pre-LRO */
47 u64 ucastPktsRxOK;
48 u64 ucastBytesRxOK;
49 u64 mcastPktsRxOK;
50 u64 mcastBytesRxOK;
51 u64 bcastPktsRxOK;
52 u64 bcastBytesRxOK;
53 u64 pktsRxOutOfBuf;
54 u64 pktsRxError;
55};
56
57/* interrupt moderation level */
58enum {
59 UPT1_IML_NONE = 0, /* no interrupt moderation */
60 UPT1_IML_HIGHEST = 7, /* least intr generated */
61 UPT1_IML_ADAPTIVE = 8, /* adpative intr moderation */
62};
63/* values for UPT1_RSSConf.hashFunc */
64enum {
65 UPT1_RSS_HASH_TYPE_NONE = 0x0,
66 UPT1_RSS_HASH_TYPE_IPV4 = 0x01,
67 UPT1_RSS_HASH_TYPE_TCP_IPV4 = 0x02,
68 UPT1_RSS_HASH_TYPE_IPV6 = 0x04,
69 UPT1_RSS_HASH_TYPE_TCP_IPV6 = 0x08,
70};
71
72enum {
73 UPT1_RSS_HASH_FUNC_NONE = 0x0,
74 UPT1_RSS_HASH_FUNC_TOEPLITZ = 0x01,
75};
76
77#define UPT1_RSS_MAX_KEY_SIZE 40
78#define UPT1_RSS_MAX_IND_TABLE_SIZE 128
79
80struct UPT1_RSSConf {
81 u16 hashType;
82 u16 hashFunc;
83 u16 hashKeySize;
84 u16 indTableSize;
85 u8 hashKey[UPT1_RSS_MAX_KEY_SIZE];
86 u8 indTable[UPT1_RSS_MAX_IND_TABLE_SIZE];
87};
88
89/* features */
90enum {
91 UPT1_F_RXCSUM = 0x0001, /* rx csum verification */
92 UPT1_F_RSS = 0x0002,
93 UPT1_F_RXVLAN = 0x0004, /* VLAN tag stripping */
94 UPT1_F_LRO = 0x0008,
95};
96#endif
diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h
new file mode 100644
index 000000000000..dc8ee4438a4f
--- /dev/null
+++ b/drivers/net/vmxnet3/vmxnet3_defs.h
@@ -0,0 +1,535 @@
1/*
2 * Linux driver for VMware's vmxnet3 ethernet NIC.
3 *
4 * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved.
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; version 2 of the License and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13 * NON INFRINGEMENT. See the GNU General Public License for more
14 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * The full GNU General Public License is included in this distribution in
21 * the file called "COPYING".
22 *
23 * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
24 *
25 */
26
27#ifndef _VMXNET3_DEFS_H_
28#define _VMXNET3_DEFS_H_
29
30#include "upt1_defs.h"
31
32/* all registers are 32 bit wide */
33/* BAR 1 */
34enum {
35 VMXNET3_REG_VRRS = 0x0, /* Vmxnet3 Revision Report Selection */
36 VMXNET3_REG_UVRS = 0x8, /* UPT Version Report Selection */
37 VMXNET3_REG_DSAL = 0x10, /* Driver Shared Address Low */
38 VMXNET3_REG_DSAH = 0x18, /* Driver Shared Address High */
39 VMXNET3_REG_CMD = 0x20, /* Command */
40 VMXNET3_REG_MACL = 0x28, /* MAC Address Low */
41 VMXNET3_REG_MACH = 0x30, /* MAC Address High */
42 VMXNET3_REG_ICR = 0x38, /* Interrupt Cause Register */
43 VMXNET3_REG_ECR = 0x40 /* Event Cause Register */
44};
45
46/* BAR 0 */
47enum {
48 VMXNET3_REG_IMR = 0x0, /* Interrupt Mask Register */
49 VMXNET3_REG_TXPROD = 0x600, /* Tx Producer Index */
50 VMXNET3_REG_RXPROD = 0x800, /* Rx Producer Index for ring 1 */
51 VMXNET3_REG_RXPROD2 = 0xA00 /* Rx Producer Index for ring 2 */
52};
53
54#define VMXNET3_PT_REG_SIZE 4096 /* BAR 0 */
55#define VMXNET3_VD_REG_SIZE 4096 /* BAR 1 */
56
57#define VMXNET3_REG_ALIGN 8 /* All registers are 8-byte aligned. */
58#define VMXNET3_REG_ALIGN_MASK 0x7
59
60/* I/O Mapped access to registers */
61#define VMXNET3_IO_TYPE_PT 0
62#define VMXNET3_IO_TYPE_VD 1
63#define VMXNET3_IO_ADDR(type, reg) (((type) << 24) | ((reg) & 0xFFFFFF))
64#define VMXNET3_IO_TYPE(addr) ((addr) >> 24)
65#define VMXNET3_IO_REG(addr) ((addr) & 0xFFFFFF)
66
67enum {
68 VMXNET3_CMD_FIRST_SET = 0xCAFE0000,
69 VMXNET3_CMD_ACTIVATE_DEV = VMXNET3_CMD_FIRST_SET,
70 VMXNET3_CMD_QUIESCE_DEV,
71 VMXNET3_CMD_RESET_DEV,
72 VMXNET3_CMD_UPDATE_RX_MODE,
73 VMXNET3_CMD_UPDATE_MAC_FILTERS,
74 VMXNET3_CMD_UPDATE_VLAN_FILTERS,
75 VMXNET3_CMD_UPDATE_RSSIDT,
76 VMXNET3_CMD_UPDATE_IML,
77 VMXNET3_CMD_UPDATE_PMCFG,
78 VMXNET3_CMD_UPDATE_FEATURE,
79 VMXNET3_CMD_LOAD_PLUGIN,
80
81 VMXNET3_CMD_FIRST_GET = 0xF00D0000,
82 VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET,
83 VMXNET3_CMD_GET_STATS,
84 VMXNET3_CMD_GET_LINK,
85 VMXNET3_CMD_GET_PERM_MAC_LO,
86 VMXNET3_CMD_GET_PERM_MAC_HI,
87 VMXNET3_CMD_GET_DID_LO,
88 VMXNET3_CMD_GET_DID_HI,
89 VMXNET3_CMD_GET_DEV_EXTRA_INFO,
90 VMXNET3_CMD_GET_CONF_INTR
91};
92
93struct Vmxnet3_TxDesc {
94 u64 addr;
95
96 u32 len:14;
97 u32 gen:1; /* generation bit */
98 u32 rsvd:1;
99 u32 dtype:1; /* descriptor type */
100 u32 ext1:1;
101 u32 msscof:14; /* MSS, checksum offset, flags */
102
103 u32 hlen:10; /* header len */
104 u32 om:2; /* offload mode */
105 u32 eop:1; /* End Of Packet */
106 u32 cq:1; /* completion request */
107 u32 ext2:1;
108 u32 ti:1; /* VLAN Tag Insertion */
109 u32 tci:16; /* Tag to Insert */
110};
111
112/* TxDesc.OM values */
113#define VMXNET3_OM_NONE 0
114#define VMXNET3_OM_CSUM 2
115#define VMXNET3_OM_TSO 3
116
117/* fields in TxDesc we access w/o using bit fields */
118#define VMXNET3_TXD_EOP_SHIFT 12
119#define VMXNET3_TXD_CQ_SHIFT 13
120#define VMXNET3_TXD_GEN_SHIFT 14
121
122#define VMXNET3_TXD_CQ (1 << VMXNET3_TXD_CQ_SHIFT)
123#define VMXNET3_TXD_EOP (1 << VMXNET3_TXD_EOP_SHIFT)
124#define VMXNET3_TXD_GEN (1 << VMXNET3_TXD_GEN_SHIFT)
125
126#define VMXNET3_HDR_COPY_SIZE 128
127
128
129struct Vmxnet3_TxDataDesc {
130 u8 data[VMXNET3_HDR_COPY_SIZE];
131};
132
133
134struct Vmxnet3_TxCompDesc {
135 u32 txdIdx:12; /* Index of the EOP TxDesc */
136 u32 ext1:20;
137
138 u32 ext2;
139 u32 ext3;
140
141 u32 rsvd:24;
142 u32 type:7; /* completion type */
143 u32 gen:1; /* generation bit */
144};
145
146
147struct Vmxnet3_RxDesc {
148 u64 addr;
149
150 u32 len:14;
151 u32 btype:1; /* Buffer Type */
152 u32 dtype:1; /* Descriptor type */
153 u32 rsvd:15;
154 u32 gen:1; /* Generation bit */
155
156 u32 ext1;
157};
158
159/* values of RXD.BTYPE */
160#define VMXNET3_RXD_BTYPE_HEAD 0 /* head only */
161#define VMXNET3_RXD_BTYPE_BODY 1 /* body only */
162
163/* fields in RxDesc we access w/o using bit fields */
164#define VMXNET3_RXD_BTYPE_SHIFT 14
165#define VMXNET3_RXD_GEN_SHIFT 31
166
167
168struct Vmxnet3_RxCompDesc {
169 u32 rxdIdx:12; /* Index of the RxDesc */
170 u32 ext1:2;
171 u32 eop:1; /* End of Packet */
172 u32 sop:1; /* Start of Packet */
173 u32 rqID:10; /* rx queue/ring ID */
174 u32 rssType:4; /* RSS hash type used */
175 u32 cnc:1; /* Checksum Not Calculated */
176 u32 ext2:1;
177
178 u32 rssHash; /* RSS hash value */
179
180 u32 len:14; /* data length */
181 u32 err:1; /* Error */
182 u32 ts:1; /* Tag is stripped */
183 u32 tci:16; /* Tag stripped */
184
185 u32 csum:16;
186 u32 tuc:1; /* TCP/UDP Checksum Correct */
187 u32 udp:1; /* UDP packet */
188 u32 tcp:1; /* TCP packet */
189 u32 ipc:1; /* IP Checksum Correct */
190 u32 v6:1; /* IPv6 */
191 u32 v4:1; /* IPv4 */
192 u32 frg:1; /* IP Fragment */
193 u32 fcs:1; /* Frame CRC correct */
194 u32 type:7; /* completion type */
195 u32 gen:1; /* generation bit */
196};
197
198/* fields in RxCompDesc we access via Vmxnet3_GenericDesc.dword[3] */
199#define VMXNET3_RCD_TUC_SHIFT 16
200#define VMXNET3_RCD_IPC_SHIFT 19
201
202/* fields in RxCompDesc we access via Vmxnet3_GenericDesc.qword[1] */
203#define VMXNET3_RCD_TYPE_SHIFT 56
204#define VMXNET3_RCD_GEN_SHIFT 63
205
206/* csum OK for TCP/UDP pkts over IP */
207#define VMXNET3_RCD_CSUM_OK (1 << VMXNET3_RCD_TUC_SHIFT | \
208 1 << VMXNET3_RCD_IPC_SHIFT)
209
210/* value of RxCompDesc.rssType */
211enum {
212 VMXNET3_RCD_RSS_TYPE_NONE = 0,
213 VMXNET3_RCD_RSS_TYPE_IPV4 = 1,
214 VMXNET3_RCD_RSS_TYPE_TCPIPV4 = 2,
215 VMXNET3_RCD_RSS_TYPE_IPV6 = 3,
216 VMXNET3_RCD_RSS_TYPE_TCPIPV6 = 4,
217};
218
219
220/* a union for accessing all cmd/completion descriptors */
221union Vmxnet3_GenericDesc {
222 u64 qword[2];
223 u32 dword[4];
224 u16 word[8];
225 struct Vmxnet3_TxDesc txd;
226 struct Vmxnet3_RxDesc rxd;
227 struct Vmxnet3_TxCompDesc tcd;
228 struct Vmxnet3_RxCompDesc rcd;
229};
230
231#define VMXNET3_INIT_GEN 1
232
233/* Max size of a single tx buffer */
234#define VMXNET3_MAX_TX_BUF_SIZE (1 << 14)
235
236/* # of tx desc needed for a tx buffer size */
237#define VMXNET3_TXD_NEEDED(size) (((size) + VMXNET3_MAX_TX_BUF_SIZE - 1) / \
238 VMXNET3_MAX_TX_BUF_SIZE)
239
240/* max # of tx descs for a non-tso pkt */
241#define VMXNET3_MAX_TXD_PER_PKT 16
242
243/* Max size of a single rx buffer */
244#define VMXNET3_MAX_RX_BUF_SIZE ((1 << 14) - 1)
245/* Minimum size of a type 0 buffer */
246#define VMXNET3_MIN_T0_BUF_SIZE 128
247#define VMXNET3_MAX_CSUM_OFFSET 1024
248
249/* Ring base address alignment */
250#define VMXNET3_RING_BA_ALIGN 512
251#define VMXNET3_RING_BA_MASK (VMXNET3_RING_BA_ALIGN - 1)
252
253/* Ring size must be a multiple of 32 */
254#define VMXNET3_RING_SIZE_ALIGN 32
255#define VMXNET3_RING_SIZE_MASK (VMXNET3_RING_SIZE_ALIGN - 1)
256
257/* Max ring size */
258#define VMXNET3_TX_RING_MAX_SIZE 4096
259#define VMXNET3_TC_RING_MAX_SIZE 4096
260#define VMXNET3_RX_RING_MAX_SIZE 4096
261#define VMXNET3_RC_RING_MAX_SIZE 8192
262
263/* a list of reasons for queue stop */
264
265enum {
266 VMXNET3_ERR_NOEOP = 0x80000000, /* cannot find the EOP desc of a pkt */
267 VMXNET3_ERR_TXD_REUSE = 0x80000001, /* reuse TxDesc before tx completion */
268 VMXNET3_ERR_BIG_PKT = 0x80000002, /* too many TxDesc for a pkt */
269 VMXNET3_ERR_DESC_NOT_SPT = 0x80000003, /* descriptor type not supported */
270 VMXNET3_ERR_SMALL_BUF = 0x80000004, /* type 0 buffer too small */
271 VMXNET3_ERR_STRESS = 0x80000005, /* stress option firing in vmkernel */
272 VMXNET3_ERR_SWITCH = 0x80000006, /* mode switch failure */
273 VMXNET3_ERR_TXD_INVALID = 0x80000007, /* invalid TxDesc */
274};
275
276/* completion descriptor types */
277#define VMXNET3_CDTYPE_TXCOMP 0 /* Tx Completion Descriptor */
278#define VMXNET3_CDTYPE_RXCOMP 3 /* Rx Completion Descriptor */
279
280enum {
281 VMXNET3_GOS_BITS_UNK = 0, /* unknown */
282 VMXNET3_GOS_BITS_32 = 1,
283 VMXNET3_GOS_BITS_64 = 2,
284};
285
286#define VMXNET3_GOS_TYPE_LINUX 1
287
288
289struct Vmxnet3_GOSInfo {
290 u32 gosBits:2; /* 32-bit or 64-bit? */
291 u32 gosType:4; /* which guest */
292 u32 gosVer:16; /* gos version */
293 u32 gosMisc:10; /* other info about gos */
294};
295
296
297struct Vmxnet3_DriverInfo {
298 u32 version;
299 struct Vmxnet3_GOSInfo gos;
300 u32 vmxnet3RevSpt;
301 u32 uptVerSpt;
302};
303
304
305#define VMXNET3_REV1_MAGIC 0xbabefee1
306
307/*
308 * QueueDescPA must be 128 bytes aligned. It points to an array of
309 * Vmxnet3_TxQueueDesc followed by an array of Vmxnet3_RxQueueDesc.
310 * The number of Vmxnet3_TxQueueDesc/Vmxnet3_RxQueueDesc are specified by
311 * Vmxnet3_MiscConf.numTxQueues/numRxQueues, respectively.
312 */
313#define VMXNET3_QUEUE_DESC_ALIGN 128
314
315
316struct Vmxnet3_MiscConf {
317 struct Vmxnet3_DriverInfo driverInfo;
318 u64 uptFeatures;
319 u64 ddPA; /* driver data PA */
320 u64 queueDescPA; /* queue descriptor table PA */
321 u32 ddLen; /* driver data len */
322 u32 queueDescLen; /* queue desc. table len in bytes */
323 u32 mtu;
324 u16 maxNumRxSG;
325 u8 numTxQueues;
326 u8 numRxQueues;
327 u32 reserved[4];
328};
329
330
331struct Vmxnet3_TxQueueConf {
332 u64 txRingBasePA;
333 u64 dataRingBasePA;
334 u64 compRingBasePA;
335 u64 ddPA; /* driver data */
336 u64 reserved;
337 u32 txRingSize; /* # of tx desc */
338 u32 dataRingSize; /* # of data desc */
339 u32 compRingSize; /* # of comp desc */
340 u32 ddLen; /* size of driver data */
341 u8 intrIdx;
342 u8 _pad[7];
343};
344
345
346struct Vmxnet3_RxQueueConf {
347 u64 rxRingBasePA[2];
348 u64 compRingBasePA;
349 u64 ddPA; /* driver data */
350 u64 reserved;
351 u32 rxRingSize[2]; /* # of rx desc */
352 u32 compRingSize; /* # of rx comp desc */
353 u32 ddLen; /* size of driver data */
354 u8 intrIdx;
355 u8 _pad[7];
356};
357
358
359enum vmxnet3_intr_mask_mode {
360 VMXNET3_IMM_AUTO = 0,
361 VMXNET3_IMM_ACTIVE = 1,
362 VMXNET3_IMM_LAZY = 2
363};
364
365enum vmxnet3_intr_type {
366 VMXNET3_IT_AUTO = 0,
367 VMXNET3_IT_INTX = 1,
368 VMXNET3_IT_MSI = 2,
369 VMXNET3_IT_MSIX = 3
370};
371
372#define VMXNET3_MAX_TX_QUEUES 8
373#define VMXNET3_MAX_RX_QUEUES 16
374/* addition 1 for events */
375#define VMXNET3_MAX_INTRS 25
376
377
378struct Vmxnet3_IntrConf {
379 bool autoMask;
380 u8 numIntrs; /* # of interrupts */
381 u8 eventIntrIdx;
382 u8 modLevels[VMXNET3_MAX_INTRS]; /* moderation level for
383 * each intr */
384 u32 reserved[3];
385};
386
387/* one bit per VLAN ID, the size is in the units of u32 */
388#define VMXNET3_VFT_SIZE (4096 / (sizeof(u32) * 8))
389
390
391struct Vmxnet3_QueueStatus {
392 bool stopped;
393 u8 _pad[3];
394 u32 error;
395};
396
397
398struct Vmxnet3_TxQueueCtrl {
399 u32 txNumDeferred;
400 u32 txThreshold;
401 u64 reserved;
402};
403
404
405struct Vmxnet3_RxQueueCtrl {
406 bool updateRxProd;
407 u8 _pad[7];
408 u64 reserved;
409};
410
411enum {
412 VMXNET3_RXM_UCAST = 0x01, /* unicast only */
413 VMXNET3_RXM_MCAST = 0x02, /* multicast passing the filters */
414 VMXNET3_RXM_BCAST = 0x04, /* broadcast only */
415 VMXNET3_RXM_ALL_MULTI = 0x08, /* all multicast */
416 VMXNET3_RXM_PROMISC = 0x10 /* promiscuous */
417};
418
419struct Vmxnet3_RxFilterConf {
420 u32 rxMode; /* VMXNET3_RXM_xxx */
421 u16 mfTableLen; /* size of the multicast filter table */
422 u16 _pad1;
423 u64 mfTablePA; /* PA of the multicast filters table */
424 u32 vfTable[VMXNET3_VFT_SIZE]; /* vlan filter */
425};
426
427
428#define VMXNET3_PM_MAX_FILTERS 6
429#define VMXNET3_PM_MAX_PATTERN_SIZE 128
430#define VMXNET3_PM_MAX_MASK_SIZE (VMXNET3_PM_MAX_PATTERN_SIZE / 8)
431
432#define VMXNET3_PM_WAKEUP_MAGIC 0x01 /* wake up on magic pkts */
433#define VMXNET3_PM_WAKEUP_FILTER 0x02 /* wake up on pkts matching
434 * filters */
435
436
437struct Vmxnet3_PM_PktFilter {
438 u8 maskSize;
439 u8 patternSize;
440 u8 mask[VMXNET3_PM_MAX_MASK_SIZE];
441 u8 pattern[VMXNET3_PM_MAX_PATTERN_SIZE];
442 u8 pad[6];
443};
444
445
446struct Vmxnet3_PMConf {
447 u16 wakeUpEvents; /* VMXNET3_PM_WAKEUP_xxx */
448 u8 numFilters;
449 u8 pad[5];
450 struct Vmxnet3_PM_PktFilter filters[VMXNET3_PM_MAX_FILTERS];
451};
452
453
454struct Vmxnet3_VariableLenConfDesc {
455 u32 confVer;
456 u32 confLen;
457 u64 confPA;
458};
459
460
461struct Vmxnet3_TxQueueDesc {
462 struct Vmxnet3_TxQueueCtrl ctrl;
463 struct Vmxnet3_TxQueueConf conf;
464
465 /* Driver read after a GET command */
466 struct Vmxnet3_QueueStatus status;
467 struct UPT1_TxStats stats;
468 u8 _pad[88]; /* 128 aligned */
469};
470
471
472struct Vmxnet3_RxQueueDesc {
473 struct Vmxnet3_RxQueueCtrl ctrl;
474 struct Vmxnet3_RxQueueConf conf;
475 /* Driver read after a GET commad */
476 struct Vmxnet3_QueueStatus status;
477 struct UPT1_RxStats stats;
478 u8 __pad[88]; /* 128 aligned */
479};
480
481
482struct Vmxnet3_DSDevRead {
483 /* read-only region for device, read by dev in response to a SET cmd */
484 struct Vmxnet3_MiscConf misc;
485 struct Vmxnet3_IntrConf intrConf;
486 struct Vmxnet3_RxFilterConf rxFilterConf;
487 struct Vmxnet3_VariableLenConfDesc rssConfDesc;
488 struct Vmxnet3_VariableLenConfDesc pmConfDesc;
489 struct Vmxnet3_VariableLenConfDesc pluginConfDesc;
490};
491
492/* All structures in DriverShared are padded to multiples of 8 bytes */
493struct Vmxnet3_DriverShared {
494 u32 magic;
495 /* make devRead start at 64bit boundaries */
496 u32 pad;
497 struct Vmxnet3_DSDevRead devRead;
498 u32 ecr;
499 u32 reserved[5];
500};
501
502
503#define VMXNET3_ECR_RQERR (1 << 0)
504#define VMXNET3_ECR_TQERR (1 << 1)
505#define VMXNET3_ECR_LINK (1 << 2)
506#define VMXNET3_ECR_DIC (1 << 3)
507#define VMXNET3_ECR_DEBUG (1 << 4)
508
509/* flip the gen bit of a ring */
510#define VMXNET3_FLIP_RING_GEN(gen) ((gen) = (gen) ^ 0x1)
511
512/* only use this if moving the idx won't affect the gen bit */
513#define VMXNET3_INC_RING_IDX_ONLY(idx, ring_size) \
514 do {\
515 (idx)++;\
516 if (unlikely((idx) == (ring_size))) {\
517 (idx) = 0;\
518 } \
519 } while (0)
520
521#define VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid) \
522 (vfTable[vid >> 5] |= (1 << (vid & 31)))
523#define VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid) \
524 (vfTable[vid >> 5] &= ~(1 << (vid & 31)))
525
526#define VMXNET3_VFTABLE_ENTRY_IS_SET(vfTable, vid) \
527 ((vfTable[vid >> 5] & (1 << (vid & 31))) != 0)
528
529#define VMXNET3_MAX_MTU 9000
530#define VMXNET3_MIN_MTU 60
531
532#define VMXNET3_LINK_UP (10000 << 16 | 1) /* 10 Gbps, up */
533#define VMXNET3_LINK_DOWN 0
534
535#endif /* _VMXNET3_DEFS_H_ */
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
new file mode 100644
index 000000000000..004353a46af0
--- /dev/null
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -0,0 +1,2574 @@
1/*
2 * Linux driver for VMware's vmxnet3 ethernet NIC.
3 *
4 * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved.
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; version 2 of the License and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13 * NON INFRINGEMENT. See the GNU General Public License for more
14 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * The full GNU General Public License is included in this distribution in
21 * the file called "COPYING".
22 *
23 * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
24 *
25 */
26
27#include "vmxnet3_int.h"
28
29char vmxnet3_driver_name[] = "vmxnet3";
30#define VMXNET3_DRIVER_DESC "VMware vmxnet3 virtual NIC driver"
31
32
33/*
34 * PCI Device ID Table
35 * Last entry must be all 0s
36 */
37static const struct pci_device_id vmxnet3_pciid_table[] = {
38 {PCI_VDEVICE(VMWARE, PCI_DEVICE_ID_VMWARE_VMXNET3)},
39 {0}
40};
41
42MODULE_DEVICE_TABLE(pci, vmxnet3_pciid_table);
43
44static atomic_t devices_found;
45
46
47/*
48 * Enable/Disable the given intr
49 */
50static void
51vmxnet3_enable_intr(struct vmxnet3_adapter *adapter, unsigned intr_idx)
52{
53 VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_IMR + intr_idx * 8, 0);
54}
55
56
57static void
58vmxnet3_disable_intr(struct vmxnet3_adapter *adapter, unsigned intr_idx)
59{
60 VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_IMR + intr_idx * 8, 1);
61}
62
63
64/*
65 * Enable/Disable all intrs used by the device
66 */
67static void
68vmxnet3_enable_all_intrs(struct vmxnet3_adapter *adapter)
69{
70 int i;
71
72 for (i = 0; i < adapter->intr.num_intrs; i++)
73 vmxnet3_enable_intr(adapter, i);
74}
75
76
77static void
78vmxnet3_disable_all_intrs(struct vmxnet3_adapter *adapter)
79{
80 int i;
81
82 for (i = 0; i < adapter->intr.num_intrs; i++)
83 vmxnet3_disable_intr(adapter, i);
84}
85
86
87static void
88vmxnet3_ack_events(struct vmxnet3_adapter *adapter, u32 events)
89{
90 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_ECR, events);
91}
92
93
94static bool
95vmxnet3_tq_stopped(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter)
96{
97 return netif_queue_stopped(adapter->netdev);
98}
99
100
101static void
102vmxnet3_tq_start(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter)
103{
104 tq->stopped = false;
105 netif_start_queue(adapter->netdev);
106}
107
108
109static void
110vmxnet3_tq_wake(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter)
111{
112 tq->stopped = false;
113 netif_wake_queue(adapter->netdev);
114}
115
116
117static void
118vmxnet3_tq_stop(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter)
119{
120 tq->stopped = true;
121 tq->num_stop++;
122 netif_stop_queue(adapter->netdev);
123}
124
125
126/*
127 * Check the link state. This may start or stop the tx queue.
128 */
129static void
130vmxnet3_check_link(struct vmxnet3_adapter *adapter)
131{
132 u32 ret;
133
134 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK);
135 ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
136 adapter->link_speed = ret >> 16;
137 if (ret & 1) { /* Link is up. */
138 printk(KERN_INFO "%s: NIC Link is Up %d Mbps\n",
139 adapter->netdev->name, adapter->link_speed);
140 if (!netif_carrier_ok(adapter->netdev))
141 netif_carrier_on(adapter->netdev);
142
143 vmxnet3_tq_start(&adapter->tx_queue, adapter);
144 } else {
145 printk(KERN_INFO "%s: NIC Link is Down\n",
146 adapter->netdev->name);
147 if (netif_carrier_ok(adapter->netdev))
148 netif_carrier_off(adapter->netdev);
149
150 vmxnet3_tq_stop(&adapter->tx_queue, adapter);
151 }
152}
153
154
155static void
156vmxnet3_process_events(struct vmxnet3_adapter *adapter)
157{
158 u32 events = adapter->shared->ecr;
159 if (!events)
160 return;
161
162 vmxnet3_ack_events(adapter, events);
163
164 /* Check if link state has changed */
165 if (events & VMXNET3_ECR_LINK)
166 vmxnet3_check_link(adapter);
167
168 /* Check if there is an error on xmit/recv queues */
169 if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) {
170 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
171 VMXNET3_CMD_GET_QUEUE_STATUS);
172
173 if (adapter->tqd_start->status.stopped) {
174 printk(KERN_ERR "%s: tq error 0x%x\n",
175 adapter->netdev->name,
176 adapter->tqd_start->status.error);
177 }
178 if (adapter->rqd_start->status.stopped) {
179 printk(KERN_ERR "%s: rq error 0x%x\n",
180 adapter->netdev->name,
181 adapter->rqd_start->status.error);
182 }
183
184 schedule_work(&adapter->work);
185 }
186}
187
188
189static void
190vmxnet3_unmap_tx_buf(struct vmxnet3_tx_buf_info *tbi,
191 struct pci_dev *pdev)
192{
193 if (tbi->map_type == VMXNET3_MAP_SINGLE)
194 pci_unmap_single(pdev, tbi->dma_addr, tbi->len,
195 PCI_DMA_TODEVICE);
196 else if (tbi->map_type == VMXNET3_MAP_PAGE)
197 pci_unmap_page(pdev, tbi->dma_addr, tbi->len,
198 PCI_DMA_TODEVICE);
199 else
200 BUG_ON(tbi->map_type != VMXNET3_MAP_NONE);
201
202 tbi->map_type = VMXNET3_MAP_NONE; /* to help debugging */
203}
204
205
206static int
207vmxnet3_unmap_pkt(u32 eop_idx, struct vmxnet3_tx_queue *tq,
208 struct pci_dev *pdev, struct vmxnet3_adapter *adapter)
209{
210 struct sk_buff *skb;
211 int entries = 0;
212
213 /* no out of order completion */
214 BUG_ON(tq->buf_info[eop_idx].sop_idx != tq->tx_ring.next2comp);
215 BUG_ON(tq->tx_ring.base[eop_idx].txd.eop != 1);
216
217 skb = tq->buf_info[eop_idx].skb;
218 BUG_ON(skb == NULL);
219 tq->buf_info[eop_idx].skb = NULL;
220
221 VMXNET3_INC_RING_IDX_ONLY(eop_idx, tq->tx_ring.size);
222
223 while (tq->tx_ring.next2comp != eop_idx) {
224 vmxnet3_unmap_tx_buf(tq->buf_info + tq->tx_ring.next2comp,
225 pdev);
226
227 /* update next2comp w/o tx_lock. Since we are marking more,
228 * instead of less, tx ring entries avail, the worst case is
229 * that the tx routine incorrectly re-queues a pkt due to
230 * insufficient tx ring entries.
231 */
232 vmxnet3_cmd_ring_adv_next2comp(&tq->tx_ring);
233 entries++;
234 }
235
236 dev_kfree_skb_any(skb);
237 return entries;
238}
239
240
241static int
242vmxnet3_tq_tx_complete(struct vmxnet3_tx_queue *tq,
243 struct vmxnet3_adapter *adapter)
244{
245 int completed = 0;
246 union Vmxnet3_GenericDesc *gdesc;
247
248 gdesc = tq->comp_ring.base + tq->comp_ring.next2proc;
249 while (gdesc->tcd.gen == tq->comp_ring.gen) {
250 completed += vmxnet3_unmap_pkt(gdesc->tcd.txdIdx, tq,
251 adapter->pdev, adapter);
252
253 vmxnet3_comp_ring_adv_next2proc(&tq->comp_ring);
254 gdesc = tq->comp_ring.base + tq->comp_ring.next2proc;
255 }
256
257 if (completed) {
258 spin_lock(&tq->tx_lock);
259 if (unlikely(vmxnet3_tq_stopped(tq, adapter) &&
260 vmxnet3_cmd_ring_desc_avail(&tq->tx_ring) >
261 VMXNET3_WAKE_QUEUE_THRESHOLD(tq) &&
262 netif_carrier_ok(adapter->netdev))) {
263 vmxnet3_tq_wake(tq, adapter);
264 }
265 spin_unlock(&tq->tx_lock);
266 }
267 return completed;
268}
269
270
271static void
272vmxnet3_tq_cleanup(struct vmxnet3_tx_queue *tq,
273 struct vmxnet3_adapter *adapter)
274{
275 int i;
276
277 while (tq->tx_ring.next2comp != tq->tx_ring.next2fill) {
278 struct vmxnet3_tx_buf_info *tbi;
279 union Vmxnet3_GenericDesc *gdesc;
280
281 tbi = tq->buf_info + tq->tx_ring.next2comp;
282 gdesc = tq->tx_ring.base + tq->tx_ring.next2comp;
283
284 vmxnet3_unmap_tx_buf(tbi, adapter->pdev);
285 if (tbi->skb) {
286 dev_kfree_skb_any(tbi->skb);
287 tbi->skb = NULL;
288 }
289 vmxnet3_cmd_ring_adv_next2comp(&tq->tx_ring);
290 }
291
292 /* sanity check, verify all buffers are indeed unmapped and freed */
293 for (i = 0; i < tq->tx_ring.size; i++) {
294 BUG_ON(tq->buf_info[i].skb != NULL ||
295 tq->buf_info[i].map_type != VMXNET3_MAP_NONE);
296 }
297
298 tq->tx_ring.gen = VMXNET3_INIT_GEN;
299 tq->tx_ring.next2fill = tq->tx_ring.next2comp = 0;
300
301 tq->comp_ring.gen = VMXNET3_INIT_GEN;
302 tq->comp_ring.next2proc = 0;
303}
304
305
306void
307vmxnet3_tq_destroy(struct vmxnet3_tx_queue *tq,
308 struct vmxnet3_adapter *adapter)
309{
310 if (tq->tx_ring.base) {
311 pci_free_consistent(adapter->pdev, tq->tx_ring.size *
312 sizeof(struct Vmxnet3_TxDesc),
313 tq->tx_ring.base, tq->tx_ring.basePA);
314 tq->tx_ring.base = NULL;
315 }
316 if (tq->data_ring.base) {
317 pci_free_consistent(adapter->pdev, tq->data_ring.size *
318 sizeof(struct Vmxnet3_TxDataDesc),
319 tq->data_ring.base, tq->data_ring.basePA);
320 tq->data_ring.base = NULL;
321 }
322 if (tq->comp_ring.base) {
323 pci_free_consistent(adapter->pdev, tq->comp_ring.size *
324 sizeof(struct Vmxnet3_TxCompDesc),
325 tq->comp_ring.base, tq->comp_ring.basePA);
326 tq->comp_ring.base = NULL;
327 }
328 kfree(tq->buf_info);
329 tq->buf_info = NULL;
330}
331
332
333static void
334vmxnet3_tq_init(struct vmxnet3_tx_queue *tq,
335 struct vmxnet3_adapter *adapter)
336{
337 int i;
338
339 /* reset the tx ring contents to 0 and reset the tx ring states */
340 memset(tq->tx_ring.base, 0, tq->tx_ring.size *
341 sizeof(struct Vmxnet3_TxDesc));
342 tq->tx_ring.next2fill = tq->tx_ring.next2comp = 0;
343 tq->tx_ring.gen = VMXNET3_INIT_GEN;
344
345 memset(tq->data_ring.base, 0, tq->data_ring.size *
346 sizeof(struct Vmxnet3_TxDataDesc));
347
348 /* reset the tx comp ring contents to 0 and reset comp ring states */
349 memset(tq->comp_ring.base, 0, tq->comp_ring.size *
350 sizeof(struct Vmxnet3_TxCompDesc));
351 tq->comp_ring.next2proc = 0;
352 tq->comp_ring.gen = VMXNET3_INIT_GEN;
353
354 /* reset the bookkeeping data */
355 memset(tq->buf_info, 0, sizeof(tq->buf_info[0]) * tq->tx_ring.size);
356 for (i = 0; i < tq->tx_ring.size; i++)
357 tq->buf_info[i].map_type = VMXNET3_MAP_NONE;
358
359 /* stats are not reset */
360}
361
362
363static int
364vmxnet3_tq_create(struct vmxnet3_tx_queue *tq,
365 struct vmxnet3_adapter *adapter)
366{
367 BUG_ON(tq->tx_ring.base || tq->data_ring.base ||
368 tq->comp_ring.base || tq->buf_info);
369
370 tq->tx_ring.base = pci_alloc_consistent(adapter->pdev, tq->tx_ring.size
371 * sizeof(struct Vmxnet3_TxDesc),
372 &tq->tx_ring.basePA);
373 if (!tq->tx_ring.base) {
374 printk(KERN_ERR "%s: failed to allocate tx ring\n",
375 adapter->netdev->name);
376 goto err;
377 }
378
379 tq->data_ring.base = pci_alloc_consistent(adapter->pdev,
380 tq->data_ring.size *
381 sizeof(struct Vmxnet3_TxDataDesc),
382 &tq->data_ring.basePA);
383 if (!tq->data_ring.base) {
384 printk(KERN_ERR "%s: failed to allocate data ring\n",
385 adapter->netdev->name);
386 goto err;
387 }
388
389 tq->comp_ring.base = pci_alloc_consistent(adapter->pdev,
390 tq->comp_ring.size *
391 sizeof(struct Vmxnet3_TxCompDesc),
392 &tq->comp_ring.basePA);
393 if (!tq->comp_ring.base) {
394 printk(KERN_ERR "%s: failed to allocate tx comp ring\n",
395 adapter->netdev->name);
396 goto err;
397 }
398
399 tq->buf_info = kcalloc(tq->tx_ring.size, sizeof(tq->buf_info[0]),
400 GFP_KERNEL);
401 if (!tq->buf_info) {
402 printk(KERN_ERR "%s: failed to allocate tx bufinfo\n",
403 adapter->netdev->name);
404 goto err;
405 }
406
407 return 0;
408
409err:
410 vmxnet3_tq_destroy(tq, adapter);
411 return -ENOMEM;
412}
413
414
415/*
416 * starting from ring->next2fill, allocate rx buffers for the given ring
417 * of the rx queue and update the rx desc. stop after @num_to_alloc buffers
418 * are allocated or allocation fails
419 */
420
421static int
422vmxnet3_rq_alloc_rx_buf(struct vmxnet3_rx_queue *rq, u32 ring_idx,
423 int num_to_alloc, struct vmxnet3_adapter *adapter)
424{
425 int num_allocated = 0;
426 struct vmxnet3_rx_buf_info *rbi_base = rq->buf_info[ring_idx];
427 struct vmxnet3_cmd_ring *ring = &rq->rx_ring[ring_idx];
428 u32 val;
429
430 while (num_allocated < num_to_alloc) {
431 struct vmxnet3_rx_buf_info *rbi;
432 union Vmxnet3_GenericDesc *gd;
433
434 rbi = rbi_base + ring->next2fill;
435 gd = ring->base + ring->next2fill;
436
437 if (rbi->buf_type == VMXNET3_RX_BUF_SKB) {
438 if (rbi->skb == NULL) {
439 rbi->skb = dev_alloc_skb(rbi->len +
440 NET_IP_ALIGN);
441 if (unlikely(rbi->skb == NULL)) {
442 rq->stats.rx_buf_alloc_failure++;
443 break;
444 }
445 rbi->skb->dev = adapter->netdev;
446
447 skb_reserve(rbi->skb, NET_IP_ALIGN);
448 rbi->dma_addr = pci_map_single(adapter->pdev,
449 rbi->skb->data, rbi->len,
450 PCI_DMA_FROMDEVICE);
451 } else {
452 /* rx buffer skipped by the device */
453 }
454 val = VMXNET3_RXD_BTYPE_HEAD << VMXNET3_RXD_BTYPE_SHIFT;
455 } else {
456 BUG_ON(rbi->buf_type != VMXNET3_RX_BUF_PAGE ||
457 rbi->len != PAGE_SIZE);
458
459 if (rbi->page == NULL) {
460 rbi->page = alloc_page(GFP_ATOMIC);
461 if (unlikely(rbi->page == NULL)) {
462 rq->stats.rx_buf_alloc_failure++;
463 break;
464 }
465 rbi->dma_addr = pci_map_page(adapter->pdev,
466 rbi->page, 0, PAGE_SIZE,
467 PCI_DMA_FROMDEVICE);
468 } else {
469 /* rx buffers skipped by the device */
470 }
471 val = VMXNET3_RXD_BTYPE_BODY << VMXNET3_RXD_BTYPE_SHIFT;
472 }
473
474 BUG_ON(rbi->dma_addr == 0);
475 gd->rxd.addr = rbi->dma_addr;
476 gd->dword[2] = (ring->gen << VMXNET3_RXD_GEN_SHIFT) | val |
477 rbi->len;
478
479 num_allocated++;
480 vmxnet3_cmd_ring_adv_next2fill(ring);
481 }
482 rq->uncommitted[ring_idx] += num_allocated;
483
484 dev_dbg(&adapter->netdev->dev,
485 "alloc_rx_buf: %d allocated, next2fill %u, next2comp "
486 "%u, uncommited %u\n", num_allocated, ring->next2fill,
487 ring->next2comp, rq->uncommitted[ring_idx]);
488
489 /* so that the device can distinguish a full ring and an empty ring */
490 BUG_ON(num_allocated != 0 && ring->next2fill == ring->next2comp);
491
492 return num_allocated;
493}
494
495
496static void
497vmxnet3_append_frag(struct sk_buff *skb, struct Vmxnet3_RxCompDesc *rcd,
498 struct vmxnet3_rx_buf_info *rbi)
499{
500 struct skb_frag_struct *frag = skb_shinfo(skb)->frags +
501 skb_shinfo(skb)->nr_frags;
502
503 BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS);
504
505 frag->page = rbi->page;
506 frag->page_offset = 0;
507 frag->size = rcd->len;
508 skb->data_len += frag->size;
509 skb_shinfo(skb)->nr_frags++;
510}
511
512
513static void
514vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
515 struct vmxnet3_tx_queue *tq, struct pci_dev *pdev,
516 struct vmxnet3_adapter *adapter)
517{
518 u32 dw2, len;
519 unsigned long buf_offset;
520 int i;
521 union Vmxnet3_GenericDesc *gdesc;
522 struct vmxnet3_tx_buf_info *tbi = NULL;
523
524 BUG_ON(ctx->copy_size > skb_headlen(skb));
525
526 /* use the previous gen bit for the SOP desc */
527 dw2 = (tq->tx_ring.gen ^ 0x1) << VMXNET3_TXD_GEN_SHIFT;
528
529 ctx->sop_txd = tq->tx_ring.base + tq->tx_ring.next2fill;
530 gdesc = ctx->sop_txd; /* both loops below can be skipped */
531
532 /* no need to map the buffer if headers are copied */
533 if (ctx->copy_size) {
534 ctx->sop_txd->txd.addr = tq->data_ring.basePA +
535 tq->tx_ring.next2fill *
536 sizeof(struct Vmxnet3_TxDataDesc);
537 ctx->sop_txd->dword[2] = dw2 | ctx->copy_size;
538 ctx->sop_txd->dword[3] = 0;
539
540 tbi = tq->buf_info + tq->tx_ring.next2fill;
541 tbi->map_type = VMXNET3_MAP_NONE;
542
543 dev_dbg(&adapter->netdev->dev,
544 "txd[%u]: 0x%Lx 0x%x 0x%x\n",
545 tq->tx_ring.next2fill, ctx->sop_txd->txd.addr,
546 ctx->sop_txd->dword[2], ctx->sop_txd->dword[3]);
547 vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
548
549 /* use the right gen for non-SOP desc */
550 dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
551 }
552
553 /* linear part can use multiple tx desc if it's big */
554 len = skb_headlen(skb) - ctx->copy_size;
555 buf_offset = ctx->copy_size;
556 while (len) {
557 u32 buf_size;
558
559 buf_size = len > VMXNET3_MAX_TX_BUF_SIZE ?
560 VMXNET3_MAX_TX_BUF_SIZE : len;
561
562 tbi = tq->buf_info + tq->tx_ring.next2fill;
563 tbi->map_type = VMXNET3_MAP_SINGLE;
564 tbi->dma_addr = pci_map_single(adapter->pdev,
565 skb->data + buf_offset, buf_size,
566 PCI_DMA_TODEVICE);
567
568 tbi->len = buf_size; /* this automatically convert 2^14 to 0 */
569
570 gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
571 BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
572
573 gdesc->txd.addr = tbi->dma_addr;
574 gdesc->dword[2] = dw2 | buf_size;
575 gdesc->dword[3] = 0;
576
577 dev_dbg(&adapter->netdev->dev,
578 "txd[%u]: 0x%Lx 0x%x 0x%x\n",
579 tq->tx_ring.next2fill, gdesc->txd.addr,
580 gdesc->dword[2], gdesc->dword[3]);
581 vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
582 dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
583
584 len -= buf_size;
585 buf_offset += buf_size;
586 }
587
588 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
589 struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
590
591 tbi = tq->buf_info + tq->tx_ring.next2fill;
592 tbi->map_type = VMXNET3_MAP_PAGE;
593 tbi->dma_addr = pci_map_page(adapter->pdev, frag->page,
594 frag->page_offset, frag->size,
595 PCI_DMA_TODEVICE);
596
597 tbi->len = frag->size;
598
599 gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
600 BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
601
602 gdesc->txd.addr = tbi->dma_addr;
603 gdesc->dword[2] = dw2 | frag->size;
604 gdesc->dword[3] = 0;
605
606 dev_dbg(&adapter->netdev->dev,
607 "txd[%u]: 0x%llu %u %u\n",
608 tq->tx_ring.next2fill, gdesc->txd.addr,
609 gdesc->dword[2], gdesc->dword[3]);
610 vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
611 dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
612 }
613
614 ctx->eop_txd = gdesc;
615
616 /* set the last buf_info for the pkt */
617 tbi->skb = skb;
618 tbi->sop_idx = ctx->sop_txd - tq->tx_ring.base;
619}
620
621
622/*
623 * parse and copy relevant protocol headers:
624 * For a tso pkt, relevant headers are L2/3/4 including options
625 * For a pkt requesting csum offloading, they are L2/3 and may include L4
626 * if it's a TCP/UDP pkt
627 *
628 * Returns:
629 * -1: error happens during parsing
630 * 0: protocol headers parsed, but too big to be copied
631 * 1: protocol headers parsed and copied
632 *
633 * Other effects:
634 * 1. related *ctx fields are updated.
635 * 2. ctx->copy_size is # of bytes copied
636 * 3. the portion copied is guaranteed to be in the linear part
637 *
638 */
639static int
640vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
641 struct vmxnet3_tx_ctx *ctx,
642 struct vmxnet3_adapter *adapter)
643{
644 struct Vmxnet3_TxDataDesc *tdd;
645
646 if (ctx->mss) {
647 ctx->eth_ip_hdr_size = skb_transport_offset(skb);
648 ctx->l4_hdr_size = ((struct tcphdr *)
649 skb_transport_header(skb))->doff * 4;
650 ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size;
651 } else {
652 unsigned int pull_size;
653
654 if (skb->ip_summed == CHECKSUM_PARTIAL) {
655 ctx->eth_ip_hdr_size = skb_transport_offset(skb);
656
657 if (ctx->ipv4) {
658 struct iphdr *iph = (struct iphdr *)
659 skb_network_header(skb);
660 if (iph->protocol == IPPROTO_TCP) {
661 pull_size = ctx->eth_ip_hdr_size +
662 sizeof(struct tcphdr);
663
664 if (unlikely(!pskb_may_pull(skb,
665 pull_size))) {
666 goto err;
667 }
668 ctx->l4_hdr_size = ((struct tcphdr *)
669 skb_transport_header(skb))->doff * 4;
670 } else if (iph->protocol == IPPROTO_UDP) {
671 ctx->l4_hdr_size =
672 sizeof(struct udphdr);
673 } else {
674 ctx->l4_hdr_size = 0;
675 }
676 } else {
677 /* for simplicity, don't copy L4 headers */
678 ctx->l4_hdr_size = 0;
679 }
680 ctx->copy_size = ctx->eth_ip_hdr_size +
681 ctx->l4_hdr_size;
682 } else {
683 ctx->eth_ip_hdr_size = 0;
684 ctx->l4_hdr_size = 0;
685 /* copy as much as allowed */
686 ctx->copy_size = min((unsigned int)VMXNET3_HDR_COPY_SIZE
687 , skb_headlen(skb));
688 }
689
690 /* make sure headers are accessible directly */
691 if (unlikely(!pskb_may_pull(skb, ctx->copy_size)))
692 goto err;
693 }
694
695 if (unlikely(ctx->copy_size > VMXNET3_HDR_COPY_SIZE)) {
696 tq->stats.oversized_hdr++;
697 ctx->copy_size = 0;
698 return 0;
699 }
700
701 tdd = tq->data_ring.base + tq->tx_ring.next2fill;
702
703 memcpy(tdd->data, skb->data, ctx->copy_size);
704 dev_dbg(&adapter->netdev->dev,
705 "copy %u bytes to dataRing[%u]\n",
706 ctx->copy_size, tq->tx_ring.next2fill);
707 return 1;
708
709err:
710 return -1;
711}
712
713
714static void
715vmxnet3_prepare_tso(struct sk_buff *skb,
716 struct vmxnet3_tx_ctx *ctx)
717{
718 struct tcphdr *tcph = (struct tcphdr *)skb_transport_header(skb);
719 if (ctx->ipv4) {
720 struct iphdr *iph = (struct iphdr *)skb_network_header(skb);
721 iph->check = 0;
722 tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 0,
723 IPPROTO_TCP, 0);
724 } else {
725 struct ipv6hdr *iph = (struct ipv6hdr *)skb_network_header(skb);
726 tcph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, 0,
727 IPPROTO_TCP, 0);
728 }
729}
730
731
732/*
733 * Transmits a pkt thru a given tq
734 * Returns:
735 * NETDEV_TX_OK: descriptors are setup successfully
736 * NETDEV_TX_OK: error occured, the pkt is dropped
737 * NETDEV_TX_BUSY: tx ring is full, queue is stopped
738 *
739 * Side-effects:
740 * 1. tx ring may be changed
741 * 2. tq stats may be updated accordingly
742 * 3. shared->txNumDeferred may be updated
743 */
744
745static int
746vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
747 struct vmxnet3_adapter *adapter, struct net_device *netdev)
748{
749 int ret;
750 u32 count;
751 unsigned long flags;
752 struct vmxnet3_tx_ctx ctx;
753 union Vmxnet3_GenericDesc *gdesc;
754
755 /* conservatively estimate # of descriptors to use */
756 count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
757 skb_shinfo(skb)->nr_frags + 1;
758
759 ctx.ipv4 = (skb->protocol == __constant_ntohs(ETH_P_IP));
760
761 ctx.mss = skb_shinfo(skb)->gso_size;
762 if (ctx.mss) {
763 if (skb_header_cloned(skb)) {
764 if (unlikely(pskb_expand_head(skb, 0, 0,
765 GFP_ATOMIC) != 0)) {
766 tq->stats.drop_tso++;
767 goto drop_pkt;
768 }
769 tq->stats.copy_skb_header++;
770 }
771 vmxnet3_prepare_tso(skb, &ctx);
772 } else {
773 if (unlikely(count > VMXNET3_MAX_TXD_PER_PKT)) {
774
775 /* non-tso pkts must not use more than
776 * VMXNET3_MAX_TXD_PER_PKT entries
777 */
778 if (skb_linearize(skb) != 0) {
779 tq->stats.drop_too_many_frags++;
780 goto drop_pkt;
781 }
782 tq->stats.linearized++;
783
784 /* recalculate the # of descriptors to use */
785 count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1;
786 }
787 }
788
789 ret = vmxnet3_parse_and_copy_hdr(skb, tq, &ctx, adapter);
790 if (ret >= 0) {
791 BUG_ON(ret <= 0 && ctx.copy_size != 0);
792 /* hdrs parsed, check against other limits */
793 if (ctx.mss) {
794 if (unlikely(ctx.eth_ip_hdr_size + ctx.l4_hdr_size >
795 VMXNET3_MAX_TX_BUF_SIZE)) {
796 goto hdr_too_big;
797 }
798 } else {
799 if (skb->ip_summed == CHECKSUM_PARTIAL) {
800 if (unlikely(ctx.eth_ip_hdr_size +
801 skb->csum_offset >
802 VMXNET3_MAX_CSUM_OFFSET)) {
803 goto hdr_too_big;
804 }
805 }
806 }
807 } else {
808 tq->stats.drop_hdr_inspect_err++;
809 goto drop_pkt;
810 }
811
812 spin_lock_irqsave(&tq->tx_lock, flags);
813
814 if (count > vmxnet3_cmd_ring_desc_avail(&tq->tx_ring)) {
815 tq->stats.tx_ring_full++;
816 dev_dbg(&adapter->netdev->dev,
817 "tx queue stopped on %s, next2comp %u"
818 " next2fill %u\n", adapter->netdev->name,
819 tq->tx_ring.next2comp, tq->tx_ring.next2fill);
820
821 vmxnet3_tq_stop(tq, adapter);
822 spin_unlock_irqrestore(&tq->tx_lock, flags);
823 return NETDEV_TX_BUSY;
824 }
825
826 /* fill tx descs related to addr & len */
827 vmxnet3_map_pkt(skb, &ctx, tq, adapter->pdev, adapter);
828
829 /* setup the EOP desc */
830 ctx.eop_txd->dword[3] = VMXNET3_TXD_CQ | VMXNET3_TXD_EOP;
831
832 /* setup the SOP desc */
833 gdesc = ctx.sop_txd;
834 if (ctx.mss) {
835 gdesc->txd.hlen = ctx.eth_ip_hdr_size + ctx.l4_hdr_size;
836 gdesc->txd.om = VMXNET3_OM_TSO;
837 gdesc->txd.msscof = ctx.mss;
838 tq->shared->txNumDeferred += (skb->len - gdesc->txd.hlen +
839 ctx.mss - 1) / ctx.mss;
840 } else {
841 if (skb->ip_summed == CHECKSUM_PARTIAL) {
842 gdesc->txd.hlen = ctx.eth_ip_hdr_size;
843 gdesc->txd.om = VMXNET3_OM_CSUM;
844 gdesc->txd.msscof = ctx.eth_ip_hdr_size +
845 skb->csum_offset;
846 } else {
847 gdesc->txd.om = 0;
848 gdesc->txd.msscof = 0;
849 }
850 tq->shared->txNumDeferred++;
851 }
852
853 if (vlan_tx_tag_present(skb)) {
854 gdesc->txd.ti = 1;
855 gdesc->txd.tci = vlan_tx_tag_get(skb);
856 }
857
858 wmb();
859
860 /* finally flips the GEN bit of the SOP desc */
861 gdesc->dword[2] ^= VMXNET3_TXD_GEN;
862 dev_dbg(&adapter->netdev->dev,
863 "txd[%u]: SOP 0x%Lx 0x%x 0x%x\n",
864 (u32)((union Vmxnet3_GenericDesc *)ctx.sop_txd -
865 tq->tx_ring.base), gdesc->txd.addr, gdesc->dword[2],
866 gdesc->dword[3]);
867
868 spin_unlock_irqrestore(&tq->tx_lock, flags);
869
870 if (tq->shared->txNumDeferred >= tq->shared->txThreshold) {
871 tq->shared->txNumDeferred = 0;
872 VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_TXPROD,
873 tq->tx_ring.next2fill);
874 }
875 netdev->trans_start = jiffies;
876
877 return NETDEV_TX_OK;
878
879hdr_too_big:
880 tq->stats.drop_oversized_hdr++;
881drop_pkt:
882 tq->stats.drop_total++;
883 dev_kfree_skb(skb);
884 return NETDEV_TX_OK;
885}
886
887
888static netdev_tx_t
889vmxnet3_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
890{
891 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
892 struct vmxnet3_tx_queue *tq = &adapter->tx_queue;
893
894 return vmxnet3_tq_xmit(skb, tq, adapter, netdev);
895}
896
897
898static void
899vmxnet3_rx_csum(struct vmxnet3_adapter *adapter,
900 struct sk_buff *skb,
901 union Vmxnet3_GenericDesc *gdesc)
902{
903 if (!gdesc->rcd.cnc && adapter->rxcsum) {
904 /* typical case: TCP/UDP over IP and both csums are correct */
905 if ((gdesc->dword[3] & VMXNET3_RCD_CSUM_OK) ==
906 VMXNET3_RCD_CSUM_OK) {
907 skb->ip_summed = CHECKSUM_UNNECESSARY;
908 BUG_ON(!(gdesc->rcd.tcp || gdesc->rcd.udp));
909 BUG_ON(!(gdesc->rcd.v4 || gdesc->rcd.v6));
910 BUG_ON(gdesc->rcd.frg);
911 } else {
912 if (gdesc->rcd.csum) {
913 skb->csum = htons(gdesc->rcd.csum);
914 skb->ip_summed = CHECKSUM_PARTIAL;
915 } else {
916 skb->ip_summed = CHECKSUM_NONE;
917 }
918 }
919 } else {
920 skb->ip_summed = CHECKSUM_NONE;
921 }
922}
923
924
925static void
926vmxnet3_rx_error(struct vmxnet3_rx_queue *rq, struct Vmxnet3_RxCompDesc *rcd,
927 struct vmxnet3_rx_ctx *ctx, struct vmxnet3_adapter *adapter)
928{
929 rq->stats.drop_err++;
930 if (!rcd->fcs)
931 rq->stats.drop_fcs++;
932
933 rq->stats.drop_total++;
934
935 /*
936 * We do not unmap and chain the rx buffer to the skb.
937 * We basically pretend this buffer is not used and will be recycled
938 * by vmxnet3_rq_alloc_rx_buf()
939 */
940
941 /*
942 * ctx->skb may be NULL if this is the first and the only one
943 * desc for the pkt
944 */
945 if (ctx->skb)
946 dev_kfree_skb_irq(ctx->skb);
947
948 ctx->skb = NULL;
949}
950
951
952static int
953vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
954 struct vmxnet3_adapter *adapter, int quota)
955{
956 static u32 rxprod_reg[2] = {VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2};
957 u32 num_rxd = 0;
958 struct Vmxnet3_RxCompDesc *rcd;
959 struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx;
960
961 rcd = &rq->comp_ring.base[rq->comp_ring.next2proc].rcd;
962 while (rcd->gen == rq->comp_ring.gen) {
963 struct vmxnet3_rx_buf_info *rbi;
964 struct sk_buff *skb;
965 int num_to_alloc;
966 struct Vmxnet3_RxDesc *rxd;
967 u32 idx, ring_idx;
968
969 if (num_rxd >= quota) {
970 /* we may stop even before we see the EOP desc of
971 * the current pkt
972 */
973 break;
974 }
975 num_rxd++;
976
977 idx = rcd->rxdIdx;
978 ring_idx = rcd->rqID == rq->qid ? 0 : 1;
979
980 rxd = &rq->rx_ring[ring_idx].base[idx].rxd;
981 rbi = rq->buf_info[ring_idx] + idx;
982
983 BUG_ON(rxd->addr != rbi->dma_addr || rxd->len != rbi->len);
984
985 if (unlikely(rcd->eop && rcd->err)) {
986 vmxnet3_rx_error(rq, rcd, ctx, adapter);
987 goto rcd_done;
988 }
989
990 if (rcd->sop) { /* first buf of the pkt */
991 BUG_ON(rxd->btype != VMXNET3_RXD_BTYPE_HEAD ||
992 rcd->rqID != rq->qid);
993
994 BUG_ON(rbi->buf_type != VMXNET3_RX_BUF_SKB);
995 BUG_ON(ctx->skb != NULL || rbi->skb == NULL);
996
997 if (unlikely(rcd->len == 0)) {
998 /* Pretend the rx buffer is skipped. */
999 BUG_ON(!(rcd->sop && rcd->eop));
1000 dev_dbg(&adapter->netdev->dev,
1001 "rxRing[%u][%u] 0 length\n",
1002 ring_idx, idx);
1003 goto rcd_done;
1004 }
1005
1006 ctx->skb = rbi->skb;
1007 rbi->skb = NULL;
1008
1009 pci_unmap_single(adapter->pdev, rbi->dma_addr, rbi->len,
1010 PCI_DMA_FROMDEVICE);
1011
1012 skb_put(ctx->skb, rcd->len);
1013 } else {
1014 BUG_ON(ctx->skb == NULL);
1015 /* non SOP buffer must be type 1 in most cases */
1016 if (rbi->buf_type == VMXNET3_RX_BUF_PAGE) {
1017 BUG_ON(rxd->btype != VMXNET3_RXD_BTYPE_BODY);
1018
1019 if (rcd->len) {
1020 pci_unmap_page(adapter->pdev,
1021 rbi->dma_addr, rbi->len,
1022 PCI_DMA_FROMDEVICE);
1023
1024 vmxnet3_append_frag(ctx->skb, rcd, rbi);
1025 rbi->page = NULL;
1026 }
1027 } else {
1028 /*
1029 * The only time a non-SOP buffer is type 0 is
1030 * when it's EOP and error flag is raised, which
1031 * has already been handled.
1032 */
1033 BUG_ON(true);
1034 }
1035 }
1036
1037 skb = ctx->skb;
1038 if (rcd->eop) {
1039 skb->len += skb->data_len;
1040 skb->truesize += skb->data_len;
1041
1042 vmxnet3_rx_csum(adapter, skb,
1043 (union Vmxnet3_GenericDesc *)rcd);
1044 skb->protocol = eth_type_trans(skb, adapter->netdev);
1045
1046 if (unlikely(adapter->vlan_grp && rcd->ts)) {
1047 vlan_hwaccel_receive_skb(skb,
1048 adapter->vlan_grp, rcd->tci);
1049 } else {
1050 netif_receive_skb(skb);
1051 }
1052
1053 adapter->netdev->last_rx = jiffies;
1054 ctx->skb = NULL;
1055 }
1056
1057rcd_done:
1058 /* device may skip some rx descs */
1059 rq->rx_ring[ring_idx].next2comp = idx;
1060 VMXNET3_INC_RING_IDX_ONLY(rq->rx_ring[ring_idx].next2comp,
1061 rq->rx_ring[ring_idx].size);
1062
1063 /* refill rx buffers frequently to avoid starving the h/w */
1064 num_to_alloc = vmxnet3_cmd_ring_desc_avail(rq->rx_ring +
1065 ring_idx);
1066 if (unlikely(num_to_alloc > VMXNET3_RX_ALLOC_THRESHOLD(rq,
1067 ring_idx, adapter))) {
1068 vmxnet3_rq_alloc_rx_buf(rq, ring_idx, num_to_alloc,
1069 adapter);
1070
1071 /* if needed, update the register */
1072 if (unlikely(rq->shared->updateRxProd)) {
1073 VMXNET3_WRITE_BAR0_REG(adapter,
1074 rxprod_reg[ring_idx] + rq->qid * 8,
1075 rq->rx_ring[ring_idx].next2fill);
1076 rq->uncommitted[ring_idx] = 0;
1077 }
1078 }
1079
1080 vmxnet3_comp_ring_adv_next2proc(&rq->comp_ring);
1081 rcd = &rq->comp_ring.base[rq->comp_ring.next2proc].rcd;
1082 }
1083
1084 return num_rxd;
1085}
1086
1087
1088static void
1089vmxnet3_rq_cleanup(struct vmxnet3_rx_queue *rq,
1090 struct vmxnet3_adapter *adapter)
1091{
1092 u32 i, ring_idx;
1093 struct Vmxnet3_RxDesc *rxd;
1094
1095 for (ring_idx = 0; ring_idx < 2; ring_idx++) {
1096 for (i = 0; i < rq->rx_ring[ring_idx].size; i++) {
1097 rxd = &rq->rx_ring[ring_idx].base[i].rxd;
1098
1099 if (rxd->btype == VMXNET3_RXD_BTYPE_HEAD &&
1100 rq->buf_info[ring_idx][i].skb) {
1101 pci_unmap_single(adapter->pdev, rxd->addr,
1102 rxd->len, PCI_DMA_FROMDEVICE);
1103 dev_kfree_skb(rq->buf_info[ring_idx][i].skb);
1104 rq->buf_info[ring_idx][i].skb = NULL;
1105 } else if (rxd->btype == VMXNET3_RXD_BTYPE_BODY &&
1106 rq->buf_info[ring_idx][i].page) {
1107 pci_unmap_page(adapter->pdev, rxd->addr,
1108 rxd->len, PCI_DMA_FROMDEVICE);
1109 put_page(rq->buf_info[ring_idx][i].page);
1110 rq->buf_info[ring_idx][i].page = NULL;
1111 }
1112 }
1113
1114 rq->rx_ring[ring_idx].gen = VMXNET3_INIT_GEN;
1115 rq->rx_ring[ring_idx].next2fill =
1116 rq->rx_ring[ring_idx].next2comp = 0;
1117 rq->uncommitted[ring_idx] = 0;
1118 }
1119
1120 rq->comp_ring.gen = VMXNET3_INIT_GEN;
1121 rq->comp_ring.next2proc = 0;
1122}
1123
1124
1125void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
1126 struct vmxnet3_adapter *adapter)
1127{
1128 int i;
1129 int j;
1130
1131 /* all rx buffers must have already been freed */
1132 for (i = 0; i < 2; i++) {
1133 if (rq->buf_info[i]) {
1134 for (j = 0; j < rq->rx_ring[i].size; j++)
1135 BUG_ON(rq->buf_info[i][j].page != NULL);
1136 }
1137 }
1138
1139
1140 kfree(rq->buf_info[0]);
1141
1142 for (i = 0; i < 2; i++) {
1143 if (rq->rx_ring[i].base) {
1144 pci_free_consistent(adapter->pdev, rq->rx_ring[i].size
1145 * sizeof(struct Vmxnet3_RxDesc),
1146 rq->rx_ring[i].base,
1147 rq->rx_ring[i].basePA);
1148 rq->rx_ring[i].base = NULL;
1149 }
1150 rq->buf_info[i] = NULL;
1151 }
1152
1153 if (rq->comp_ring.base) {
1154 pci_free_consistent(adapter->pdev, rq->comp_ring.size *
1155 sizeof(struct Vmxnet3_RxCompDesc),
1156 rq->comp_ring.base, rq->comp_ring.basePA);
1157 rq->comp_ring.base = NULL;
1158 }
1159}
1160
1161
1162static int
1163vmxnet3_rq_init(struct vmxnet3_rx_queue *rq,
1164 struct vmxnet3_adapter *adapter)
1165{
1166 int i;
1167
1168 /* initialize buf_info */
1169 for (i = 0; i < rq->rx_ring[0].size; i++) {
1170
1171 /* 1st buf for a pkt is skbuff */
1172 if (i % adapter->rx_buf_per_pkt == 0) {
1173 rq->buf_info[0][i].buf_type = VMXNET3_RX_BUF_SKB;
1174 rq->buf_info[0][i].len = adapter->skb_buf_size;
1175 } else { /* subsequent bufs for a pkt is frag */
1176 rq->buf_info[0][i].buf_type = VMXNET3_RX_BUF_PAGE;
1177 rq->buf_info[0][i].len = PAGE_SIZE;
1178 }
1179 }
1180 for (i = 0; i < rq->rx_ring[1].size; i++) {
1181 rq->buf_info[1][i].buf_type = VMXNET3_RX_BUF_PAGE;
1182 rq->buf_info[1][i].len = PAGE_SIZE;
1183 }
1184
1185 /* reset internal state and allocate buffers for both rings */
1186 for (i = 0; i < 2; i++) {
1187 rq->rx_ring[i].next2fill = rq->rx_ring[i].next2comp = 0;
1188 rq->uncommitted[i] = 0;
1189
1190 memset(rq->rx_ring[i].base, 0, rq->rx_ring[i].size *
1191 sizeof(struct Vmxnet3_RxDesc));
1192 rq->rx_ring[i].gen = VMXNET3_INIT_GEN;
1193 }
1194 if (vmxnet3_rq_alloc_rx_buf(rq, 0, rq->rx_ring[0].size - 1,
1195 adapter) == 0) {
1196 /* at least has 1 rx buffer for the 1st ring */
1197 return -ENOMEM;
1198 }
1199 vmxnet3_rq_alloc_rx_buf(rq, 1, rq->rx_ring[1].size - 1, adapter);
1200
1201 /* reset the comp ring */
1202 rq->comp_ring.next2proc = 0;
1203 memset(rq->comp_ring.base, 0, rq->comp_ring.size *
1204 sizeof(struct Vmxnet3_RxCompDesc));
1205 rq->comp_ring.gen = VMXNET3_INIT_GEN;
1206
1207 /* reset rxctx */
1208 rq->rx_ctx.skb = NULL;
1209
1210 /* stats are not reset */
1211 return 0;
1212}
1213
1214
1215static int
1216vmxnet3_rq_create(struct vmxnet3_rx_queue *rq, struct vmxnet3_adapter *adapter)
1217{
1218 int i;
1219 size_t sz;
1220 struct vmxnet3_rx_buf_info *bi;
1221
1222 for (i = 0; i < 2; i++) {
1223
1224 sz = rq->rx_ring[i].size * sizeof(struct Vmxnet3_RxDesc);
1225 rq->rx_ring[i].base = pci_alloc_consistent(adapter->pdev, sz,
1226 &rq->rx_ring[i].basePA);
1227 if (!rq->rx_ring[i].base) {
1228 printk(KERN_ERR "%s: failed to allocate rx ring %d\n",
1229 adapter->netdev->name, i);
1230 goto err;
1231 }
1232 }
1233
1234 sz = rq->comp_ring.size * sizeof(struct Vmxnet3_RxCompDesc);
1235 rq->comp_ring.base = pci_alloc_consistent(adapter->pdev, sz,
1236 &rq->comp_ring.basePA);
1237 if (!rq->comp_ring.base) {
1238 printk(KERN_ERR "%s: failed to allocate rx comp ring\n",
1239 adapter->netdev->name);
1240 goto err;
1241 }
1242
1243 sz = sizeof(struct vmxnet3_rx_buf_info) * (rq->rx_ring[0].size +
1244 rq->rx_ring[1].size);
1245 bi = kmalloc(sz, GFP_KERNEL);
1246 if (!bi) {
1247 printk(KERN_ERR "%s: failed to allocate rx bufinfo\n",
1248 adapter->netdev->name);
1249 goto err;
1250 }
1251 memset(bi, 0, sz);
1252 rq->buf_info[0] = bi;
1253 rq->buf_info[1] = bi + rq->rx_ring[0].size;
1254
1255 return 0;
1256
1257err:
1258 vmxnet3_rq_destroy(rq, adapter);
1259 return -ENOMEM;
1260}
1261
1262
1263static int
1264vmxnet3_do_poll(struct vmxnet3_adapter *adapter, int budget)
1265{
1266 if (unlikely(adapter->shared->ecr))
1267 vmxnet3_process_events(adapter);
1268
1269 vmxnet3_tq_tx_complete(&adapter->tx_queue, adapter);
1270 return vmxnet3_rq_rx_complete(&adapter->rx_queue, adapter, budget);
1271}
1272
1273
1274static int
1275vmxnet3_poll(struct napi_struct *napi, int budget)
1276{
1277 struct vmxnet3_adapter *adapter = container_of(napi,
1278 struct vmxnet3_adapter, napi);
1279 int rxd_done;
1280
1281 rxd_done = vmxnet3_do_poll(adapter, budget);
1282
1283 if (rxd_done < budget) {
1284 napi_complete(napi);
1285 vmxnet3_enable_intr(adapter, 0);
1286 }
1287 return rxd_done;
1288}
1289
1290
1291/* Interrupt handler for vmxnet3 */
1292static irqreturn_t
1293vmxnet3_intr(int irq, void *dev_id)
1294{
1295 struct net_device *dev = dev_id;
1296 struct vmxnet3_adapter *adapter = netdev_priv(dev);
1297
1298 if (unlikely(adapter->intr.type == VMXNET3_IT_INTX)) {
1299 u32 icr = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_ICR);
1300 if (unlikely(icr == 0))
1301 /* not ours */
1302 return IRQ_NONE;
1303 }
1304
1305
1306 /* disable intr if needed */
1307 if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
1308 vmxnet3_disable_intr(adapter, 0);
1309
1310 napi_schedule(&adapter->napi);
1311
1312 return IRQ_HANDLED;
1313}
1314
1315#ifdef CONFIG_NET_POLL_CONTROLLER
1316
1317
1318/* netpoll callback. */
1319static void
1320vmxnet3_netpoll(struct net_device *netdev)
1321{
1322 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1323 int irq;
1324
1325#ifdef CONFIG_PCI_MSI
1326 if (adapter->intr.type == VMXNET3_IT_MSIX)
1327 irq = adapter->intr.msix_entries[0].vector;
1328 else
1329#endif
1330 irq = adapter->pdev->irq;
1331
1332 disable_irq(irq);
1333 vmxnet3_intr(irq, netdev);
1334 enable_irq(irq);
1335}
1336#endif
1337
1338static int
1339vmxnet3_request_irqs(struct vmxnet3_adapter *adapter)
1340{
1341 int err;
1342
1343#ifdef CONFIG_PCI_MSI
1344 if (adapter->intr.type == VMXNET3_IT_MSIX) {
1345 /* we only use 1 MSI-X vector */
1346 err = request_irq(adapter->intr.msix_entries[0].vector,
1347 vmxnet3_intr, 0, adapter->netdev->name,
1348 adapter->netdev);
1349 } else
1350#endif
1351 if (adapter->intr.type == VMXNET3_IT_MSI) {
1352 err = request_irq(adapter->pdev->irq, vmxnet3_intr, 0,
1353 adapter->netdev->name, adapter->netdev);
1354 } else {
1355 err = request_irq(adapter->pdev->irq, vmxnet3_intr,
1356 IRQF_SHARED, adapter->netdev->name,
1357 adapter->netdev);
1358 }
1359
1360 if (err)
1361 printk(KERN_ERR "Failed to request irq %s (intr type:%d), error"
1362 ":%d\n", adapter->netdev->name, adapter->intr.type, err);
1363
1364
1365 if (!err) {
1366 int i;
1367 /* init our intr settings */
1368 for (i = 0; i < adapter->intr.num_intrs; i++)
1369 adapter->intr.mod_levels[i] = UPT1_IML_ADAPTIVE;
1370
1371 /* next setup intr index for all intr sources */
1372 adapter->tx_queue.comp_ring.intr_idx = 0;
1373 adapter->rx_queue.comp_ring.intr_idx = 0;
1374 adapter->intr.event_intr_idx = 0;
1375
1376 printk(KERN_INFO "%s: intr type %u, mode %u, %u vectors "
1377 "allocated\n", adapter->netdev->name, adapter->intr.type,
1378 adapter->intr.mask_mode, adapter->intr.num_intrs);
1379 }
1380
1381 return err;
1382}
1383
1384
1385static void
1386vmxnet3_free_irqs(struct vmxnet3_adapter *adapter)
1387{
1388 BUG_ON(adapter->intr.type == VMXNET3_IT_AUTO ||
1389 adapter->intr.num_intrs <= 0);
1390
1391 switch (adapter->intr.type) {
1392#ifdef CONFIG_PCI_MSI
1393 case VMXNET3_IT_MSIX:
1394 {
1395 int i;
1396
1397 for (i = 0; i < adapter->intr.num_intrs; i++)
1398 free_irq(adapter->intr.msix_entries[i].vector,
1399 adapter->netdev);
1400 break;
1401 }
1402#endif
1403 case VMXNET3_IT_MSI:
1404 free_irq(adapter->pdev->irq, adapter->netdev);
1405 break;
1406 case VMXNET3_IT_INTX:
1407 free_irq(adapter->pdev->irq, adapter->netdev);
1408 break;
1409 default:
1410 BUG_ON(true);
1411 }
1412}
1413
1414
1415static void
1416vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
1417{
1418 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1419 struct Vmxnet3_DriverShared *shared = adapter->shared;
1420 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
1421
1422 if (grp) {
1423 /* add vlan rx stripping. */
1424 if (adapter->netdev->features & NETIF_F_HW_VLAN_RX) {
1425 int i;
1426 struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
1427 adapter->vlan_grp = grp;
1428
1429 /* update FEATURES to device */
1430 devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
1431 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1432 VMXNET3_CMD_UPDATE_FEATURE);
1433 /*
1434 * Clear entire vfTable; then enable untagged pkts.
1435 * Note: setting one entry in vfTable to non-zero turns
1436 * on VLAN rx filtering.
1437 */
1438 for (i = 0; i < VMXNET3_VFT_SIZE; i++)
1439 vfTable[i] = 0;
1440
1441 VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0);
1442 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1443 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1444 } else {
1445 printk(KERN_ERR "%s: vlan_rx_register when device has "
1446 "no NETIF_F_HW_VLAN_RX\n", netdev->name);
1447 }
1448 } else {
1449 /* remove vlan rx stripping. */
1450 struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
1451 adapter->vlan_grp = NULL;
1452
1453 if (devRead->misc.uptFeatures & UPT1_F_RXVLAN) {
1454 int i;
1455
1456 for (i = 0; i < VMXNET3_VFT_SIZE; i++) {
1457 /* clear entire vfTable; this also disables
1458 * VLAN rx filtering
1459 */
1460 vfTable[i] = 0;
1461 }
1462 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1463 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1464
1465 /* update FEATURES to device */
1466 devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN;
1467 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1468 VMXNET3_CMD_UPDATE_FEATURE);
1469 }
1470 }
1471}
1472
1473
1474static void
1475vmxnet3_restore_vlan(struct vmxnet3_adapter *adapter)
1476{
1477 if (adapter->vlan_grp) {
1478 u16 vid;
1479 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
1480 bool activeVlan = false;
1481
1482 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
1483 if (vlan_group_get_device(adapter->vlan_grp, vid)) {
1484 VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid);
1485 activeVlan = true;
1486 }
1487 }
1488 if (activeVlan) {
1489 /* continue to allow untagged pkts */
1490 VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0);
1491 }
1492 }
1493}
1494
1495
1496static void
1497vmxnet3_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1498{
1499 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1500 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
1501
1502 VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid);
1503 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1504 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1505}
1506
1507
1508static void
1509vmxnet3_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1510{
1511 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1512 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
1513
1514 VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid);
1515 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1516 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1517}
1518
1519
1520static u8 *
1521vmxnet3_copy_mc(struct net_device *netdev)
1522{
1523 u8 *buf = NULL;
1524 u32 sz = netdev->mc_count * ETH_ALEN;
1525
1526 /* struct Vmxnet3_RxFilterConf.mfTableLen is u16. */
1527 if (sz <= 0xffff) {
1528 /* We may be called with BH disabled */
1529 buf = kmalloc(sz, GFP_ATOMIC);
1530 if (buf) {
1531 int i;
1532 struct dev_mc_list *mc = netdev->mc_list;
1533
1534 for (i = 0; i < netdev->mc_count; i++) {
1535 BUG_ON(!mc);
1536 memcpy(buf + i * ETH_ALEN, mc->dmi_addr,
1537 ETH_ALEN);
1538 mc = mc->next;
1539 }
1540 }
1541 }
1542 return buf;
1543}
1544
1545
1546static void
1547vmxnet3_set_mc(struct net_device *netdev)
1548{
1549 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1550 struct Vmxnet3_RxFilterConf *rxConf =
1551 &adapter->shared->devRead.rxFilterConf;
1552 u8 *new_table = NULL;
1553 u32 new_mode = VMXNET3_RXM_UCAST;
1554
1555 if (netdev->flags & IFF_PROMISC)
1556 new_mode |= VMXNET3_RXM_PROMISC;
1557
1558 if (netdev->flags & IFF_BROADCAST)
1559 new_mode |= VMXNET3_RXM_BCAST;
1560
1561 if (netdev->flags & IFF_ALLMULTI)
1562 new_mode |= VMXNET3_RXM_ALL_MULTI;
1563 else
1564 if (netdev->mc_count > 0) {
1565 new_table = vmxnet3_copy_mc(netdev);
1566 if (new_table) {
1567 new_mode |= VMXNET3_RXM_MCAST;
1568 rxConf->mfTableLen = netdev->mc_count *
1569 ETH_ALEN;
1570 rxConf->mfTablePA = virt_to_phys(new_table);
1571 } else {
1572 printk(KERN_INFO "%s: failed to copy mcast list"
1573 ", setting ALL_MULTI\n", netdev->name);
1574 new_mode |= VMXNET3_RXM_ALL_MULTI;
1575 }
1576 }
1577
1578
1579 if (!(new_mode & VMXNET3_RXM_MCAST)) {
1580 rxConf->mfTableLen = 0;
1581 rxConf->mfTablePA = 0;
1582 }
1583
1584 if (new_mode != rxConf->rxMode) {
1585 rxConf->rxMode = new_mode;
1586 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1587 VMXNET3_CMD_UPDATE_RX_MODE);
1588 }
1589
1590 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1591 VMXNET3_CMD_UPDATE_MAC_FILTERS);
1592
1593 kfree(new_table);
1594}
1595
1596
1597/*
1598 * Set up driver_shared based on settings in adapter.
1599 */
1600
1601static void
1602vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
1603{
1604 struct Vmxnet3_DriverShared *shared = adapter->shared;
1605 struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
1606 struct Vmxnet3_TxQueueConf *tqc;
1607 struct Vmxnet3_RxQueueConf *rqc;
1608 int i;
1609
1610 memset(shared, 0, sizeof(*shared));
1611
1612 /* driver settings */
1613 shared->magic = VMXNET3_REV1_MAGIC;
1614 devRead->misc.driverInfo.version = VMXNET3_DRIVER_VERSION_NUM;
1615 devRead->misc.driverInfo.gos.gosBits = (sizeof(void *) == 4 ?
1616 VMXNET3_GOS_BITS_32 : VMXNET3_GOS_BITS_64);
1617 devRead->misc.driverInfo.gos.gosType = VMXNET3_GOS_TYPE_LINUX;
1618 devRead->misc.driverInfo.vmxnet3RevSpt = 1;
1619 devRead->misc.driverInfo.uptVerSpt = 1;
1620
1621 devRead->misc.ddPA = virt_to_phys(adapter);
1622 devRead->misc.ddLen = sizeof(struct vmxnet3_adapter);
1623
1624 /* set up feature flags */
1625 if (adapter->rxcsum)
1626 devRead->misc.uptFeatures |= UPT1_F_RXCSUM;
1627
1628 if (adapter->lro) {
1629 devRead->misc.uptFeatures |= UPT1_F_LRO;
1630 devRead->misc.maxNumRxSG = 1 + MAX_SKB_FRAGS;
1631 }
1632 if ((adapter->netdev->features & NETIF_F_HW_VLAN_RX)
1633 && adapter->vlan_grp) {
1634 devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
1635 }
1636
1637 devRead->misc.mtu = adapter->netdev->mtu;
1638 devRead->misc.queueDescPA = adapter->queue_desc_pa;
1639 devRead->misc.queueDescLen = sizeof(struct Vmxnet3_TxQueueDesc) +
1640 sizeof(struct Vmxnet3_RxQueueDesc);
1641
1642 /* tx queue settings */
1643 BUG_ON(adapter->tx_queue.tx_ring.base == NULL);
1644
1645 devRead->misc.numTxQueues = 1;
1646 tqc = &adapter->tqd_start->conf;
1647 tqc->txRingBasePA = adapter->tx_queue.tx_ring.basePA;
1648 tqc->dataRingBasePA = adapter->tx_queue.data_ring.basePA;
1649 tqc->compRingBasePA = adapter->tx_queue.comp_ring.basePA;
1650 tqc->ddPA = virt_to_phys(adapter->tx_queue.buf_info);
1651 tqc->txRingSize = adapter->tx_queue.tx_ring.size;
1652 tqc->dataRingSize = adapter->tx_queue.data_ring.size;
1653 tqc->compRingSize = adapter->tx_queue.comp_ring.size;
1654 tqc->ddLen = sizeof(struct vmxnet3_tx_buf_info) *
1655 tqc->txRingSize;
1656 tqc->intrIdx = adapter->tx_queue.comp_ring.intr_idx;
1657
1658 /* rx queue settings */
1659 devRead->misc.numRxQueues = 1;
1660 rqc = &adapter->rqd_start->conf;
1661 rqc->rxRingBasePA[0] = adapter->rx_queue.rx_ring[0].basePA;
1662 rqc->rxRingBasePA[1] = adapter->rx_queue.rx_ring[1].basePA;
1663 rqc->compRingBasePA = adapter->rx_queue.comp_ring.basePA;
1664 rqc->ddPA = virt_to_phys(adapter->rx_queue.buf_info);
1665 rqc->rxRingSize[0] = adapter->rx_queue.rx_ring[0].size;
1666 rqc->rxRingSize[1] = adapter->rx_queue.rx_ring[1].size;
1667 rqc->compRingSize = adapter->rx_queue.comp_ring.size;
1668 rqc->ddLen = sizeof(struct vmxnet3_rx_buf_info) *
1669 (rqc->rxRingSize[0] + rqc->rxRingSize[1]);
1670 rqc->intrIdx = adapter->rx_queue.comp_ring.intr_idx;
1671
1672 /* intr settings */
1673 devRead->intrConf.autoMask = adapter->intr.mask_mode ==
1674 VMXNET3_IMM_AUTO;
1675 devRead->intrConf.numIntrs = adapter->intr.num_intrs;
1676 for (i = 0; i < adapter->intr.num_intrs; i++)
1677 devRead->intrConf.modLevels[i] = adapter->intr.mod_levels[i];
1678
1679 devRead->intrConf.eventIntrIdx = adapter->intr.event_intr_idx;
1680
1681 /* rx filter settings */
1682 devRead->rxFilterConf.rxMode = 0;
1683 vmxnet3_restore_vlan(adapter);
1684 /* the rest are already zeroed */
1685}
1686
1687
1688int
1689vmxnet3_activate_dev(struct vmxnet3_adapter *adapter)
1690{
1691 int err;
1692 u32 ret;
1693
1694 dev_dbg(&adapter->netdev->dev,
1695 "%s: skb_buf_size %d, rx_buf_per_pkt %d, ring sizes"
1696 " %u %u %u\n", adapter->netdev->name, adapter->skb_buf_size,
1697 adapter->rx_buf_per_pkt, adapter->tx_queue.tx_ring.size,
1698 adapter->rx_queue.rx_ring[0].size,
1699 adapter->rx_queue.rx_ring[1].size);
1700
1701 vmxnet3_tq_init(&adapter->tx_queue, adapter);
1702 err = vmxnet3_rq_init(&adapter->rx_queue, adapter);
1703 if (err) {
1704 printk(KERN_ERR "Failed to init rx queue for %s: error %d\n",
1705 adapter->netdev->name, err);
1706 goto rq_err;
1707 }
1708
1709 err = vmxnet3_request_irqs(adapter);
1710 if (err) {
1711 printk(KERN_ERR "Failed to setup irq for %s: error %d\n",
1712 adapter->netdev->name, err);
1713 goto irq_err;
1714 }
1715
1716 vmxnet3_setup_driver_shared(adapter);
1717
1718 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAL,
1719 VMXNET3_GET_ADDR_LO(adapter->shared_pa));
1720 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH,
1721 VMXNET3_GET_ADDR_HI(adapter->shared_pa));
1722
1723 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1724 VMXNET3_CMD_ACTIVATE_DEV);
1725 ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
1726
1727 if (ret != 0) {
1728 printk(KERN_ERR "Failed to activate dev %s: error %u\n",
1729 adapter->netdev->name, ret);
1730 err = -EINVAL;
1731 goto activate_err;
1732 }
1733 VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_RXPROD,
1734 adapter->rx_queue.rx_ring[0].next2fill);
1735 VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_RXPROD2,
1736 adapter->rx_queue.rx_ring[1].next2fill);
1737
1738 /* Apply the rx filter settins last. */
1739 vmxnet3_set_mc(adapter->netdev);
1740
1741 /*
1742 * Check link state when first activating device. It will start the
1743 * tx queue if the link is up.
1744 */
1745 vmxnet3_check_link(adapter);
1746
1747 napi_enable(&adapter->napi);
1748 vmxnet3_enable_all_intrs(adapter);
1749 clear_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
1750 return 0;
1751
1752activate_err:
1753 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAL, 0);
1754 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH, 0);
1755 vmxnet3_free_irqs(adapter);
1756irq_err:
1757rq_err:
1758 /* free up buffers we allocated */
1759 vmxnet3_rq_cleanup(&adapter->rx_queue, adapter);
1760 return err;
1761}
1762
1763
1764void
1765vmxnet3_reset_dev(struct vmxnet3_adapter *adapter)
1766{
1767 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_RESET_DEV);
1768}
1769
1770
1771int
1772vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter)
1773{
1774 if (test_and_set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state))
1775 return 0;
1776
1777
1778 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1779 VMXNET3_CMD_QUIESCE_DEV);
1780 vmxnet3_disable_all_intrs(adapter);
1781
1782 napi_disable(&adapter->napi);
1783 netif_tx_disable(adapter->netdev);
1784 adapter->link_speed = 0;
1785 netif_carrier_off(adapter->netdev);
1786
1787 vmxnet3_tq_cleanup(&adapter->tx_queue, adapter);
1788 vmxnet3_rq_cleanup(&adapter->rx_queue, adapter);
1789 vmxnet3_free_irqs(adapter);
1790 return 0;
1791}
1792
1793
1794static void
1795vmxnet3_write_mac_addr(struct vmxnet3_adapter *adapter, u8 *mac)
1796{
1797 u32 tmp;
1798
1799 tmp = *(u32 *)mac;
1800 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_MACL, tmp);
1801
1802 tmp = (mac[5] << 8) | mac[4];
1803 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_MACH, tmp);
1804}
1805
1806
1807static int
1808vmxnet3_set_mac_addr(struct net_device *netdev, void *p)
1809{
1810 struct sockaddr *addr = p;
1811 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1812
1813 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
1814 vmxnet3_write_mac_addr(adapter, addr->sa_data);
1815
1816 return 0;
1817}
1818
1819
1820/* ==================== initialization and cleanup routines ============ */
1821
1822static int
1823vmxnet3_alloc_pci_resources(struct vmxnet3_adapter *adapter, bool *dma64)
1824{
1825 int err;
1826 unsigned long mmio_start, mmio_len;
1827 struct pci_dev *pdev = adapter->pdev;
1828
1829 err = pci_enable_device(pdev);
1830 if (err) {
1831 printk(KERN_ERR "Failed to enable adapter %s: error %d\n",
1832 pci_name(pdev), err);
1833 return err;
1834 }
1835
1836 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) {
1837 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) {
1838 printk(KERN_ERR "pci_set_consistent_dma_mask failed "
1839 "for adapter %s\n", pci_name(pdev));
1840 err = -EIO;
1841 goto err_set_mask;
1842 }
1843 *dma64 = true;
1844 } else {
1845 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) {
1846 printk(KERN_ERR "pci_set_dma_mask failed for adapter "
1847 "%s\n", pci_name(pdev));
1848 err = -EIO;
1849 goto err_set_mask;
1850 }
1851 *dma64 = false;
1852 }
1853
1854 err = pci_request_selected_regions(pdev, (1 << 2) - 1,
1855 vmxnet3_driver_name);
1856 if (err) {
1857 printk(KERN_ERR "Failed to request region for adapter %s: "
1858 "error %d\n", pci_name(pdev), err);
1859 goto err_set_mask;
1860 }
1861
1862 pci_set_master(pdev);
1863
1864 mmio_start = pci_resource_start(pdev, 0);
1865 mmio_len = pci_resource_len(pdev, 0);
1866 adapter->hw_addr0 = ioremap(mmio_start, mmio_len);
1867 if (!adapter->hw_addr0) {
1868 printk(KERN_ERR "Failed to map bar0 for adapter %s\n",
1869 pci_name(pdev));
1870 err = -EIO;
1871 goto err_ioremap;
1872 }
1873
1874 mmio_start = pci_resource_start(pdev, 1);
1875 mmio_len = pci_resource_len(pdev, 1);
1876 adapter->hw_addr1 = ioremap(mmio_start, mmio_len);
1877 if (!adapter->hw_addr1) {
1878 printk(KERN_ERR "Failed to map bar1 for adapter %s\n",
1879 pci_name(pdev));
1880 err = -EIO;
1881 goto err_bar1;
1882 }
1883 return 0;
1884
1885err_bar1:
1886 iounmap(adapter->hw_addr0);
1887err_ioremap:
1888 pci_release_selected_regions(pdev, (1 << 2) - 1);
1889err_set_mask:
1890 pci_disable_device(pdev);
1891 return err;
1892}
1893
1894
1895static void
1896vmxnet3_free_pci_resources(struct vmxnet3_adapter *adapter)
1897{
1898 BUG_ON(!adapter->pdev);
1899
1900 iounmap(adapter->hw_addr0);
1901 iounmap(adapter->hw_addr1);
1902 pci_release_selected_regions(adapter->pdev, (1 << 2) - 1);
1903 pci_disable_device(adapter->pdev);
1904}
1905
1906
1907static void
1908vmxnet3_adjust_rx_ring_size(struct vmxnet3_adapter *adapter)
1909{
1910 size_t sz;
1911
1912 if (adapter->netdev->mtu <= VMXNET3_MAX_SKB_BUF_SIZE -
1913 VMXNET3_MAX_ETH_HDR_SIZE) {
1914 adapter->skb_buf_size = adapter->netdev->mtu +
1915 VMXNET3_MAX_ETH_HDR_SIZE;
1916 if (adapter->skb_buf_size < VMXNET3_MIN_T0_BUF_SIZE)
1917 adapter->skb_buf_size = VMXNET3_MIN_T0_BUF_SIZE;
1918
1919 adapter->rx_buf_per_pkt = 1;
1920 } else {
1921 adapter->skb_buf_size = VMXNET3_MAX_SKB_BUF_SIZE;
1922 sz = adapter->netdev->mtu - VMXNET3_MAX_SKB_BUF_SIZE +
1923 VMXNET3_MAX_ETH_HDR_SIZE;
1924 adapter->rx_buf_per_pkt = 1 + (sz + PAGE_SIZE - 1) / PAGE_SIZE;
1925 }
1926
1927 /*
1928 * for simplicity, force the ring0 size to be a multiple of
1929 * rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN
1930 */
1931 sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN;
1932 adapter->rx_queue.rx_ring[0].size = (adapter->rx_queue.rx_ring[0].size +
1933 sz - 1) / sz * sz;
1934 adapter->rx_queue.rx_ring[0].size = min_t(u32,
1935 adapter->rx_queue.rx_ring[0].size,
1936 VMXNET3_RX_RING_MAX_SIZE / sz * sz);
1937}
1938
1939
1940int
1941vmxnet3_create_queues(struct vmxnet3_adapter *adapter, u32 tx_ring_size,
1942 u32 rx_ring_size, u32 rx_ring2_size)
1943{
1944 int err;
1945
1946 adapter->tx_queue.tx_ring.size = tx_ring_size;
1947 adapter->tx_queue.data_ring.size = tx_ring_size;
1948 adapter->tx_queue.comp_ring.size = tx_ring_size;
1949 adapter->tx_queue.shared = &adapter->tqd_start->ctrl;
1950 adapter->tx_queue.stopped = true;
1951 err = vmxnet3_tq_create(&adapter->tx_queue, adapter);
1952 if (err)
1953 return err;
1954
1955 adapter->rx_queue.rx_ring[0].size = rx_ring_size;
1956 adapter->rx_queue.rx_ring[1].size = rx_ring2_size;
1957 vmxnet3_adjust_rx_ring_size(adapter);
1958 adapter->rx_queue.comp_ring.size = adapter->rx_queue.rx_ring[0].size +
1959 adapter->rx_queue.rx_ring[1].size;
1960 adapter->rx_queue.qid = 0;
1961 adapter->rx_queue.qid2 = 1;
1962 adapter->rx_queue.shared = &adapter->rqd_start->ctrl;
1963 err = vmxnet3_rq_create(&adapter->rx_queue, adapter);
1964 if (err)
1965 vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
1966
1967 return err;
1968}
1969
1970static int
1971vmxnet3_open(struct net_device *netdev)
1972{
1973 struct vmxnet3_adapter *adapter;
1974 int err;
1975
1976 adapter = netdev_priv(netdev);
1977
1978 spin_lock_init(&adapter->tx_queue.tx_lock);
1979
1980 err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE,
1981 VMXNET3_DEF_RX_RING_SIZE,
1982 VMXNET3_DEF_RX_RING_SIZE);
1983 if (err)
1984 goto queue_err;
1985
1986 err = vmxnet3_activate_dev(adapter);
1987 if (err)
1988 goto activate_err;
1989
1990 return 0;
1991
1992activate_err:
1993 vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
1994 vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
1995queue_err:
1996 return err;
1997}
1998
1999
2000static int
2001vmxnet3_close(struct net_device *netdev)
2002{
2003 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
2004
2005 /*
2006 * Reset_work may be in the middle of resetting the device, wait for its
2007 * completion.
2008 */
2009 while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
2010 msleep(1);
2011
2012 vmxnet3_quiesce_dev(adapter);
2013
2014 vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
2015 vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
2016
2017 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
2018
2019
2020 return 0;
2021}
2022
2023
2024void
2025vmxnet3_force_close(struct vmxnet3_adapter *adapter)
2026{
2027 /*
2028 * we must clear VMXNET3_STATE_BIT_RESETTING, otherwise
2029 * vmxnet3_close() will deadlock.
2030 */
2031 BUG_ON(test_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state));
2032
2033 /* we need to enable NAPI, otherwise dev_close will deadlock */
2034 napi_enable(&adapter->napi);
2035 dev_close(adapter->netdev);
2036}
2037
2038
2039static int
2040vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
2041{
2042 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
2043 int err = 0;
2044
2045 if (new_mtu < VMXNET3_MIN_MTU || new_mtu > VMXNET3_MAX_MTU)
2046 return -EINVAL;
2047
2048 if (new_mtu > 1500 && !adapter->jumbo_frame)
2049 return -EINVAL;
2050
2051 netdev->mtu = new_mtu;
2052
2053 /*
2054 * Reset_work may be in the middle of resetting the device, wait for its
2055 * completion.
2056 */
2057 while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
2058 msleep(1);
2059
2060 if (netif_running(netdev)) {
2061 vmxnet3_quiesce_dev(adapter);
2062 vmxnet3_reset_dev(adapter);
2063
2064 /* we need to re-create the rx queue based on the new mtu */
2065 vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
2066 vmxnet3_adjust_rx_ring_size(adapter);
2067 adapter->rx_queue.comp_ring.size =
2068 adapter->rx_queue.rx_ring[0].size +
2069 adapter->rx_queue.rx_ring[1].size;
2070 err = vmxnet3_rq_create(&adapter->rx_queue, adapter);
2071 if (err) {
2072 printk(KERN_ERR "%s: failed to re-create rx queue,"
2073 " error %d. Closing it.\n", netdev->name, err);
2074 goto out;
2075 }
2076
2077 err = vmxnet3_activate_dev(adapter);
2078 if (err) {
2079 printk(KERN_ERR "%s: failed to re-activate, error %d. "
2080 "Closing it\n", netdev->name, err);
2081 goto out;
2082 }
2083 }
2084
2085out:
2086 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
2087 if (err)
2088 vmxnet3_force_close(adapter);
2089
2090 return err;
2091}
2092
2093
2094static void
2095vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64)
2096{
2097 struct net_device *netdev = adapter->netdev;
2098
2099 netdev->features = NETIF_F_SG |
2100 NETIF_F_HW_CSUM |
2101 NETIF_F_HW_VLAN_TX |
2102 NETIF_F_HW_VLAN_RX |
2103 NETIF_F_HW_VLAN_FILTER |
2104 NETIF_F_TSO |
2105 NETIF_F_TSO6 |
2106 NETIF_F_LRO;
2107
2108 printk(KERN_INFO "features: sg csum vlan jf tso tsoIPv6 lro");
2109
2110 adapter->rxcsum = true;
2111 adapter->jumbo_frame = true;
2112 adapter->lro = true;
2113
2114 if (dma64) {
2115 netdev->features |= NETIF_F_HIGHDMA;
2116 printk(" highDMA");
2117 }
2118
2119 netdev->vlan_features = netdev->features;
2120 printk("\n");
2121}
2122
2123
2124static void
2125vmxnet3_read_mac_addr(struct vmxnet3_adapter *adapter, u8 *mac)
2126{
2127 u32 tmp;
2128
2129 tmp = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACL);
2130 *(u32 *)mac = tmp;
2131
2132 tmp = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACH);
2133 mac[4] = tmp & 0xff;
2134 mac[5] = (tmp >> 8) & 0xff;
2135}
2136
2137
2138static void
2139vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
2140{
2141 u32 cfg;
2142
2143 /* intr settings */
2144 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2145 VMXNET3_CMD_GET_CONF_INTR);
2146 cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
2147 adapter->intr.type = cfg & 0x3;
2148 adapter->intr.mask_mode = (cfg >> 2) & 0x3;
2149
2150 if (adapter->intr.type == VMXNET3_IT_AUTO) {
2151 int err;
2152
2153#ifdef CONFIG_PCI_MSI
2154 adapter->intr.msix_entries[0].entry = 0;
2155 err = pci_enable_msix(adapter->pdev, adapter->intr.msix_entries,
2156 VMXNET3_LINUX_MAX_MSIX_VECT);
2157 if (!err) {
2158 adapter->intr.num_intrs = 1;
2159 adapter->intr.type = VMXNET3_IT_MSIX;
2160 return;
2161 }
2162#endif
2163
2164 err = pci_enable_msi(adapter->pdev);
2165 if (!err) {
2166 adapter->intr.num_intrs = 1;
2167 adapter->intr.type = VMXNET3_IT_MSI;
2168 return;
2169 }
2170 }
2171
2172 adapter->intr.type = VMXNET3_IT_INTX;
2173
2174 /* INT-X related setting */
2175 adapter->intr.num_intrs = 1;
2176}
2177
2178
2179static void
2180vmxnet3_free_intr_resources(struct vmxnet3_adapter *adapter)
2181{
2182 if (adapter->intr.type == VMXNET3_IT_MSIX)
2183 pci_disable_msix(adapter->pdev);
2184 else if (adapter->intr.type == VMXNET3_IT_MSI)
2185 pci_disable_msi(adapter->pdev);
2186 else
2187 BUG_ON(adapter->intr.type != VMXNET3_IT_INTX);
2188}
2189
2190
2191static void
2192vmxnet3_tx_timeout(struct net_device *netdev)
2193{
2194 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
2195 adapter->tx_timeout_count++;
2196
2197 printk(KERN_ERR "%s: tx hang\n", adapter->netdev->name);
2198 schedule_work(&adapter->work);
2199}
2200
2201
2202static void
2203vmxnet3_reset_work(struct work_struct *data)
2204{
2205 struct vmxnet3_adapter *adapter;
2206
2207 adapter = container_of(data, struct vmxnet3_adapter, work);
2208
2209 /* if another thread is resetting the device, no need to proceed */
2210 if (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
2211 return;
2212
2213 /* if the device is closed, we must leave it alone */
2214 if (netif_running(adapter->netdev)) {
2215 printk(KERN_INFO "%s: resetting\n", adapter->netdev->name);
2216 vmxnet3_quiesce_dev(adapter);
2217 vmxnet3_reset_dev(adapter);
2218 vmxnet3_activate_dev(adapter);
2219 } else {
2220 printk(KERN_INFO "%s: already closed\n", adapter->netdev->name);
2221 }
2222
2223 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
2224}
2225
2226
2227static int __devinit
2228vmxnet3_probe_device(struct pci_dev *pdev,
2229 const struct pci_device_id *id)
2230{
2231 static const struct net_device_ops vmxnet3_netdev_ops = {
2232 .ndo_open = vmxnet3_open,
2233 .ndo_stop = vmxnet3_close,
2234 .ndo_start_xmit = vmxnet3_xmit_frame,
2235 .ndo_set_mac_address = vmxnet3_set_mac_addr,
2236 .ndo_change_mtu = vmxnet3_change_mtu,
2237 .ndo_get_stats = vmxnet3_get_stats,
2238 .ndo_tx_timeout = vmxnet3_tx_timeout,
2239 .ndo_set_multicast_list = vmxnet3_set_mc,
2240 .ndo_vlan_rx_register = vmxnet3_vlan_rx_register,
2241 .ndo_vlan_rx_add_vid = vmxnet3_vlan_rx_add_vid,
2242 .ndo_vlan_rx_kill_vid = vmxnet3_vlan_rx_kill_vid,
2243#ifdef CONFIG_NET_POLL_CONTROLLER
2244 .ndo_poll_controller = vmxnet3_netpoll,
2245#endif
2246 };
2247 int err;
2248 bool dma64 = false; /* stupid gcc */
2249 u32 ver;
2250 struct net_device *netdev;
2251 struct vmxnet3_adapter *adapter;
2252 u8 mac[ETH_ALEN];
2253
2254 netdev = alloc_etherdev(sizeof(struct vmxnet3_adapter));
2255 if (!netdev) {
2256 printk(KERN_ERR "Failed to alloc ethernet device for adapter "
2257 "%s\n", pci_name(pdev));
2258 return -ENOMEM;
2259 }
2260
2261 pci_set_drvdata(pdev, netdev);
2262 adapter = netdev_priv(netdev);
2263 adapter->netdev = netdev;
2264 adapter->pdev = pdev;
2265
2266 adapter->shared = pci_alloc_consistent(adapter->pdev,
2267 sizeof(struct Vmxnet3_DriverShared),
2268 &adapter->shared_pa);
2269 if (!adapter->shared) {
2270 printk(KERN_ERR "Failed to allocate memory for %s\n",
2271 pci_name(pdev));
2272 err = -ENOMEM;
2273 goto err_alloc_shared;
2274 }
2275
2276 adapter->tqd_start = pci_alloc_consistent(adapter->pdev,
2277 sizeof(struct Vmxnet3_TxQueueDesc) +
2278 sizeof(struct Vmxnet3_RxQueueDesc),
2279 &adapter->queue_desc_pa);
2280
2281 if (!adapter->tqd_start) {
2282 printk(KERN_ERR "Failed to allocate memory for %s\n",
2283 pci_name(pdev));
2284 err = -ENOMEM;
2285 goto err_alloc_queue_desc;
2286 }
2287 adapter->rqd_start = (struct Vmxnet3_RxQueueDesc *)(adapter->tqd_start
2288 + 1);
2289
2290 adapter->pm_conf = kmalloc(sizeof(struct Vmxnet3_PMConf), GFP_KERNEL);
2291 if (adapter->pm_conf == NULL) {
2292 printk(KERN_ERR "Failed to allocate memory for %s\n",
2293 pci_name(pdev));
2294 err = -ENOMEM;
2295 goto err_alloc_pm;
2296 }
2297
2298 err = vmxnet3_alloc_pci_resources(adapter, &dma64);
2299 if (err < 0)
2300 goto err_alloc_pci;
2301
2302 ver = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_VRRS);
2303 if (ver & 1) {
2304 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_VRRS, 1);
2305 } else {
2306 printk(KERN_ERR "Incompatible h/w version (0x%x) for adapter"
2307 " %s\n", ver, pci_name(pdev));
2308 err = -EBUSY;
2309 goto err_ver;
2310 }
2311
2312 ver = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_UVRS);
2313 if (ver & 1) {
2314 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_UVRS, 1);
2315 } else {
2316 printk(KERN_ERR "Incompatible upt version (0x%x) for "
2317 "adapter %s\n", ver, pci_name(pdev));
2318 err = -EBUSY;
2319 goto err_ver;
2320 }
2321
2322 vmxnet3_declare_features(adapter, dma64);
2323
2324 adapter->dev_number = atomic_read(&devices_found);
2325 vmxnet3_alloc_intr_resources(adapter);
2326
2327 vmxnet3_read_mac_addr(adapter, mac);
2328 memcpy(netdev->dev_addr, mac, netdev->addr_len);
2329
2330 netdev->netdev_ops = &vmxnet3_netdev_ops;
2331 netdev->watchdog_timeo = 5 * HZ;
2332 vmxnet3_set_ethtool_ops(netdev);
2333
2334 INIT_WORK(&adapter->work, vmxnet3_reset_work);
2335
2336 netif_napi_add(netdev, &adapter->napi, vmxnet3_poll, 64);
2337 SET_NETDEV_DEV(netdev, &pdev->dev);
2338 err = register_netdev(netdev);
2339
2340 if (err) {
2341 printk(KERN_ERR "Failed to register adapter %s\n",
2342 pci_name(pdev));
2343 goto err_register;
2344 }
2345
2346 set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
2347 atomic_inc(&devices_found);
2348 return 0;
2349
2350err_register:
2351 vmxnet3_free_intr_resources(adapter);
2352err_ver:
2353 vmxnet3_free_pci_resources(adapter);
2354err_alloc_pci:
2355 kfree(adapter->pm_conf);
2356err_alloc_pm:
2357 pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_TxQueueDesc) +
2358 sizeof(struct Vmxnet3_RxQueueDesc),
2359 adapter->tqd_start, adapter->queue_desc_pa);
2360err_alloc_queue_desc:
2361 pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_DriverShared),
2362 adapter->shared, adapter->shared_pa);
2363err_alloc_shared:
2364 pci_set_drvdata(pdev, NULL);
2365 free_netdev(netdev);
2366 return err;
2367}
2368
2369
2370static void __devexit
2371vmxnet3_remove_device(struct pci_dev *pdev)
2372{
2373 struct net_device *netdev = pci_get_drvdata(pdev);
2374 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
2375
2376 flush_scheduled_work();
2377
2378 unregister_netdev(netdev);
2379
2380 vmxnet3_free_intr_resources(adapter);
2381 vmxnet3_free_pci_resources(adapter);
2382 kfree(adapter->pm_conf);
2383 pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_TxQueueDesc) +
2384 sizeof(struct Vmxnet3_RxQueueDesc),
2385 adapter->tqd_start, adapter->queue_desc_pa);
2386 pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_DriverShared),
2387 adapter->shared, adapter->shared_pa);
2388 free_netdev(netdev);
2389}
2390
2391
2392#ifdef CONFIG_PM
2393
2394static int
2395vmxnet3_suspend(struct device *device)
2396{
2397 struct pci_dev *pdev = to_pci_dev(device);
2398 struct net_device *netdev = pci_get_drvdata(pdev);
2399 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
2400 struct Vmxnet3_PMConf *pmConf;
2401 struct ethhdr *ehdr;
2402 struct arphdr *ahdr;
2403 u8 *arpreq;
2404 struct in_device *in_dev;
2405 struct in_ifaddr *ifa;
2406 int i = 0;
2407
2408 if (!netif_running(netdev))
2409 return 0;
2410
2411 vmxnet3_disable_all_intrs(adapter);
2412 vmxnet3_free_irqs(adapter);
2413 vmxnet3_free_intr_resources(adapter);
2414
2415 netif_device_detach(netdev);
2416 netif_stop_queue(netdev);
2417
2418 /* Create wake-up filters. */
2419 pmConf = adapter->pm_conf;
2420 memset(pmConf, 0, sizeof(*pmConf));
2421
2422 if (adapter->wol & WAKE_UCAST) {
2423 pmConf->filters[i].patternSize = ETH_ALEN;
2424 pmConf->filters[i].maskSize = 1;
2425 memcpy(pmConf->filters[i].pattern, netdev->dev_addr, ETH_ALEN);
2426 pmConf->filters[i].mask[0] = 0x3F; /* LSB ETH_ALEN bits */
2427
2428 pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
2429 i++;
2430 }
2431
2432 if (adapter->wol & WAKE_ARP) {
2433 in_dev = in_dev_get(netdev);
2434 if (!in_dev)
2435 goto skip_arp;
2436
2437 ifa = (struct in_ifaddr *)in_dev->ifa_list;
2438 if (!ifa)
2439 goto skip_arp;
2440
2441 pmConf->filters[i].patternSize = ETH_HLEN + /* Ethernet header*/
2442 sizeof(struct arphdr) + /* ARP header */
2443 2 * ETH_ALEN + /* 2 Ethernet addresses*/
2444 2 * sizeof(u32); /*2 IPv4 addresses */
2445 pmConf->filters[i].maskSize =
2446 (pmConf->filters[i].patternSize - 1) / 8 + 1;
2447
2448 /* ETH_P_ARP in Ethernet header. */
2449 ehdr = (struct ethhdr *)pmConf->filters[i].pattern;
2450 ehdr->h_proto = htons(ETH_P_ARP);
2451
2452 /* ARPOP_REQUEST in ARP header. */
2453 ahdr = (struct arphdr *)&pmConf->filters[i].pattern[ETH_HLEN];
2454 ahdr->ar_op = htons(ARPOP_REQUEST);
2455 arpreq = (u8 *)(ahdr + 1);
2456
2457 /* The Unicast IPv4 address in 'tip' field. */
2458 arpreq += 2 * ETH_ALEN + sizeof(u32);
2459 *(u32 *)arpreq = ifa->ifa_address;
2460
2461 /* The mask for the relevant bits. */
2462 pmConf->filters[i].mask[0] = 0x00;
2463 pmConf->filters[i].mask[1] = 0x30; /* ETH_P_ARP */
2464 pmConf->filters[i].mask[2] = 0x30; /* ARPOP_REQUEST */
2465 pmConf->filters[i].mask[3] = 0x00;
2466 pmConf->filters[i].mask[4] = 0xC0; /* IPv4 TIP */
2467 pmConf->filters[i].mask[5] = 0x03; /* IPv4 TIP */
2468 in_dev_put(in_dev);
2469
2470 pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
2471 i++;
2472 }
2473
2474skip_arp:
2475 if (adapter->wol & WAKE_MAGIC)
2476 pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_MAGIC;
2477
2478 pmConf->numFilters = i;
2479
2480 adapter->shared->devRead.pmConfDesc.confVer = 1;
2481 adapter->shared->devRead.pmConfDesc.confLen = sizeof(*pmConf);
2482 adapter->shared->devRead.pmConfDesc.confPA = virt_to_phys(pmConf);
2483
2484 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2485 VMXNET3_CMD_UPDATE_PMCFG);
2486
2487 pci_save_state(pdev);
2488 pci_enable_wake(pdev, pci_choose_state(pdev, PMSG_SUSPEND),
2489 adapter->wol);
2490 pci_disable_device(pdev);
2491 pci_set_power_state(pdev, pci_choose_state(pdev, PMSG_SUSPEND));
2492
2493 return 0;
2494}
2495
2496
2497static int
2498vmxnet3_resume(struct device *device)
2499{
2500 int err;
2501 struct pci_dev *pdev = to_pci_dev(device);
2502 struct net_device *netdev = pci_get_drvdata(pdev);
2503 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
2504 struct Vmxnet3_PMConf *pmConf;
2505
2506 if (!netif_running(netdev))
2507 return 0;
2508
2509 /* Destroy wake-up filters. */
2510 pmConf = adapter->pm_conf;
2511 memset(pmConf, 0, sizeof(*pmConf));
2512
2513 adapter->shared->devRead.pmConfDesc.confVer = 1;
2514 adapter->shared->devRead.pmConfDesc.confLen = sizeof(*pmConf);
2515 adapter->shared->devRead.pmConfDesc.confPA = virt_to_phys(pmConf);
2516
2517 netif_device_attach(netdev);
2518 pci_set_power_state(pdev, PCI_D0);
2519 pci_restore_state(pdev);
2520 err = pci_enable_device_mem(pdev);
2521 if (err != 0)
2522 return err;
2523
2524 pci_enable_wake(pdev, PCI_D0, 0);
2525
2526 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2527 VMXNET3_CMD_UPDATE_PMCFG);
2528 vmxnet3_alloc_intr_resources(adapter);
2529 vmxnet3_request_irqs(adapter);
2530 vmxnet3_enable_all_intrs(adapter);
2531
2532 return 0;
2533}
2534
2535static struct dev_pm_ops vmxnet3_pm_ops = {
2536 .suspend = vmxnet3_suspend,
2537 .resume = vmxnet3_resume,
2538};
2539#endif
2540
2541static struct pci_driver vmxnet3_driver = {
2542 .name = vmxnet3_driver_name,
2543 .id_table = vmxnet3_pciid_table,
2544 .probe = vmxnet3_probe_device,
2545 .remove = __devexit_p(vmxnet3_remove_device),
2546#ifdef CONFIG_PM
2547 .driver.pm = &vmxnet3_pm_ops,
2548#endif
2549};
2550
2551
2552static int __init
2553vmxnet3_init_module(void)
2554{
2555 printk(KERN_INFO "%s - version %s\n", VMXNET3_DRIVER_DESC,
2556 VMXNET3_DRIVER_VERSION_REPORT);
2557 return pci_register_driver(&vmxnet3_driver);
2558}
2559
2560module_init(vmxnet3_init_module);
2561
2562
2563static void
2564vmxnet3_exit_module(void)
2565{
2566 pci_unregister_driver(&vmxnet3_driver);
2567}
2568
2569module_exit(vmxnet3_exit_module);
2570
2571MODULE_AUTHOR("VMware, Inc.");
2572MODULE_DESCRIPTION(VMXNET3_DRIVER_DESC);
2573MODULE_LICENSE("GPL v2");
2574MODULE_VERSION(VMXNET3_DRIVER_VERSION_STRING);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
new file mode 100644
index 000000000000..c2c15e4cafc7
--- /dev/null
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -0,0 +1,566 @@
1/*
2 * Linux driver for VMware's vmxnet3 ethernet NIC.
3 *
4 * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved.
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; version 2 of the License and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13 * NON INFRINGEMENT. See the GNU General Public License for more
14 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * The full GNU General Public License is included in this distribution in
21 * the file called "COPYING".
22 *
23 * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
24 *
25 */
26
27
28#include "vmxnet3_int.h"
29
30struct vmxnet3_stat_desc {
31 char desc[ETH_GSTRING_LEN];
32 int offset;
33};
34
35
36static u32
37vmxnet3_get_rx_csum(struct net_device *netdev)
38{
39 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
40 return adapter->rxcsum;
41}
42
43
44static int
45vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
46{
47 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
48
49 if (adapter->rxcsum != val) {
50 adapter->rxcsum = val;
51 if (netif_running(netdev)) {
52 if (val)
53 adapter->shared->devRead.misc.uptFeatures |=
54 UPT1_F_RXCSUM;
55 else
56 adapter->shared->devRead.misc.uptFeatures &=
57 ~UPT1_F_RXCSUM;
58
59 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
60 VMXNET3_CMD_UPDATE_FEATURE);
61 }
62 }
63 return 0;
64}
65
66
67/* per tq stats maintained by the device */
68static const struct vmxnet3_stat_desc
69vmxnet3_tq_dev_stats[] = {
70 /* description, offset */
71 { "TSO pkts tx", offsetof(struct UPT1_TxStats, TSOPktsTxOK) },
72 { "TSO bytes tx", offsetof(struct UPT1_TxStats, TSOBytesTxOK) },
73 { "ucast pkts tx", offsetof(struct UPT1_TxStats, ucastPktsTxOK) },
74 { "ucast bytes tx", offsetof(struct UPT1_TxStats, ucastBytesTxOK) },
75 { "mcast pkts tx", offsetof(struct UPT1_TxStats, mcastPktsTxOK) },
76 { "mcast bytes tx", offsetof(struct UPT1_TxStats, mcastBytesTxOK) },
77 { "bcast pkts tx", offsetof(struct UPT1_TxStats, bcastPktsTxOK) },
78 { "bcast bytes tx", offsetof(struct UPT1_TxStats, bcastBytesTxOK) },
79 { "pkts tx err", offsetof(struct UPT1_TxStats, pktsTxError) },
80 { "pkts tx discard", offsetof(struct UPT1_TxStats, pktsTxDiscard) },
81};
82
83/* per tq stats maintained by the driver */
84static const struct vmxnet3_stat_desc
85vmxnet3_tq_driver_stats[] = {
86 /* description, offset */
87 {"drv dropped tx total", offsetof(struct vmxnet3_tq_driver_stats,
88 drop_total) },
89 { " too many frags", offsetof(struct vmxnet3_tq_driver_stats,
90 drop_too_many_frags) },
91 { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats,
92 drop_oversized_hdr) },
93 { " hdr err", offsetof(struct vmxnet3_tq_driver_stats,
94 drop_hdr_inspect_err) },
95 { " tso", offsetof(struct vmxnet3_tq_driver_stats,
96 drop_tso) },
97 { "ring full", offsetof(struct vmxnet3_tq_driver_stats,
98 tx_ring_full) },
99 { "pkts linearized", offsetof(struct vmxnet3_tq_driver_stats,
100 linearized) },
101 { "hdr cloned", offsetof(struct vmxnet3_tq_driver_stats,
102 copy_skb_header) },
103 { "giant hdr", offsetof(struct vmxnet3_tq_driver_stats,
104 oversized_hdr) },
105};
106
107/* per rq stats maintained by the device */
108static const struct vmxnet3_stat_desc
109vmxnet3_rq_dev_stats[] = {
110 { "LRO pkts rx", offsetof(struct UPT1_RxStats, LROPktsRxOK) },
111 { "LRO byte rx", offsetof(struct UPT1_RxStats, LROBytesRxOK) },
112 { "ucast pkts rx", offsetof(struct UPT1_RxStats, ucastPktsRxOK) },
113 { "ucast bytes rx", offsetof(struct UPT1_RxStats, ucastBytesRxOK) },
114 { "mcast pkts rx", offsetof(struct UPT1_RxStats, mcastPktsRxOK) },
115 { "mcast bytes rx", offsetof(struct UPT1_RxStats, mcastBytesRxOK) },
116 { "bcast pkts rx", offsetof(struct UPT1_RxStats, bcastPktsRxOK) },
117 { "bcast bytes rx", offsetof(struct UPT1_RxStats, bcastBytesRxOK) },
118 { "pkts rx out of buf", offsetof(struct UPT1_RxStats, pktsRxOutOfBuf) },
119 { "pkts rx err", offsetof(struct UPT1_RxStats, pktsRxError) },
120};
121
122/* per rq stats maintained by the driver */
123static const struct vmxnet3_stat_desc
124vmxnet3_rq_driver_stats[] = {
125 /* description, offset */
126 { "drv dropped rx total", offsetof(struct vmxnet3_rq_driver_stats,
127 drop_total) },
128 { " err", offsetof(struct vmxnet3_rq_driver_stats,
129 drop_err) },
130 { " fcs", offsetof(struct vmxnet3_rq_driver_stats,
131 drop_fcs) },
132 { "rx buf alloc fail", offsetof(struct vmxnet3_rq_driver_stats,
133 rx_buf_alloc_failure) },
134};
135
136/* gloabl stats maintained by the driver */
137static const struct vmxnet3_stat_desc
138vmxnet3_global_stats[] = {
139 /* description, offset */
140 { "tx timeout count", offsetof(struct vmxnet3_adapter,
141 tx_timeout_count) }
142};
143
144
145struct net_device_stats *
146vmxnet3_get_stats(struct net_device *netdev)
147{
148 struct vmxnet3_adapter *adapter;
149 struct vmxnet3_tq_driver_stats *drvTxStats;
150 struct vmxnet3_rq_driver_stats *drvRxStats;
151 struct UPT1_TxStats *devTxStats;
152 struct UPT1_RxStats *devRxStats;
153 struct net_device_stats *net_stats = &netdev->stats;
154
155 adapter = netdev_priv(netdev);
156
157 /* Collect the dev stats into the shared area */
158 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
159
160 /* Assuming that we have a single queue device */
161 devTxStats = &adapter->tqd_start->stats;
162 devRxStats = &adapter->rqd_start->stats;
163
164 /* Get access to the driver stats per queue */
165 drvTxStats = &adapter->tx_queue.stats;
166 drvRxStats = &adapter->rx_queue.stats;
167
168 memset(net_stats, 0, sizeof(*net_stats));
169
170 net_stats->rx_packets = devRxStats->ucastPktsRxOK +
171 devRxStats->mcastPktsRxOK +
172 devRxStats->bcastPktsRxOK;
173
174 net_stats->tx_packets = devTxStats->ucastPktsTxOK +
175 devTxStats->mcastPktsTxOK +
176 devTxStats->bcastPktsTxOK;
177
178 net_stats->rx_bytes = devRxStats->ucastBytesRxOK +
179 devRxStats->mcastBytesRxOK +
180 devRxStats->bcastBytesRxOK;
181
182 net_stats->tx_bytes = devTxStats->ucastBytesTxOK +
183 devTxStats->mcastBytesTxOK +
184 devTxStats->bcastBytesTxOK;
185
186 net_stats->rx_errors = devRxStats->pktsRxError;
187 net_stats->tx_errors = devTxStats->pktsTxError;
188 net_stats->rx_dropped = drvRxStats->drop_total;
189 net_stats->tx_dropped = drvTxStats->drop_total;
190 net_stats->multicast = devRxStats->mcastPktsRxOK;
191
192 return net_stats;
193}
194
195static int
196vmxnet3_get_sset_count(struct net_device *netdev, int sset)
197{
198 switch (sset) {
199 case ETH_SS_STATS:
200 return ARRAY_SIZE(vmxnet3_tq_dev_stats) +
201 ARRAY_SIZE(vmxnet3_tq_driver_stats) +
202 ARRAY_SIZE(vmxnet3_rq_dev_stats) +
203 ARRAY_SIZE(vmxnet3_rq_driver_stats) +
204 ARRAY_SIZE(vmxnet3_global_stats);
205 default:
206 return -EOPNOTSUPP;
207 }
208}
209
210
211static int
212vmxnet3_get_regs_len(struct net_device *netdev)
213{
214 return 20 * sizeof(u32);
215}
216
217
218static void
219vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
220{
221 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
222
223 strlcpy(drvinfo->driver, vmxnet3_driver_name, sizeof(drvinfo->driver));
224 drvinfo->driver[sizeof(drvinfo->driver) - 1] = '\0';
225
226 strlcpy(drvinfo->version, VMXNET3_DRIVER_VERSION_REPORT,
227 sizeof(drvinfo->version));
228 drvinfo->driver[sizeof(drvinfo->version) - 1] = '\0';
229
230 strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
231 drvinfo->fw_version[sizeof(drvinfo->fw_version) - 1] = '\0';
232
233 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
234 ETHTOOL_BUSINFO_LEN);
235 drvinfo->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS);
236 drvinfo->testinfo_len = 0;
237 drvinfo->eedump_len = 0;
238 drvinfo->regdump_len = vmxnet3_get_regs_len(netdev);
239}
240
241
242static void
243vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
244{
245 if (stringset == ETH_SS_STATS) {
246 int i;
247
248 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) {
249 memcpy(buf, vmxnet3_tq_dev_stats[i].desc,
250 ETH_GSTRING_LEN);
251 buf += ETH_GSTRING_LEN;
252 }
253 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++) {
254 memcpy(buf, vmxnet3_tq_driver_stats[i].desc,
255 ETH_GSTRING_LEN);
256 buf += ETH_GSTRING_LEN;
257 }
258 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) {
259 memcpy(buf, vmxnet3_rq_dev_stats[i].desc,
260 ETH_GSTRING_LEN);
261 buf += ETH_GSTRING_LEN;
262 }
263 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++) {
264 memcpy(buf, vmxnet3_rq_driver_stats[i].desc,
265 ETH_GSTRING_LEN);
266 buf += ETH_GSTRING_LEN;
267 }
268 for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) {
269 memcpy(buf, vmxnet3_global_stats[i].desc,
270 ETH_GSTRING_LEN);
271 buf += ETH_GSTRING_LEN;
272 }
273 }
274}
275
276static u32
277vmxnet3_get_flags(struct net_device *netdev) {
278 return netdev->features;
279}
280
281static int
282vmxnet3_set_flags(struct net_device *netdev, u32 data) {
283 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
284 u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
285 u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
286
287 if (lro_requested ^ lro_present) {
288 /* toggle the LRO feature*/
289 netdev->features ^= NETIF_F_LRO;
290
291 /* update harware LRO capability accordingly */
292 if (lro_requested)
293 adapter->shared->devRead.misc.uptFeatures &= UPT1_F_LRO;
294 else
295 adapter->shared->devRead.misc.uptFeatures &=
296 ~UPT1_F_LRO;
297 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
298 VMXNET3_CMD_UPDATE_FEATURE);
299 }
300 return 0;
301}
302
303static void
304vmxnet3_get_ethtool_stats(struct net_device *netdev,
305 struct ethtool_stats *stats, u64 *buf)
306{
307 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
308 u8 *base;
309 int i;
310
311 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
312
313 /* this does assume each counter is 64-bit wide */
314
315 base = (u8 *)&adapter->tqd_start->stats;
316 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++)
317 *buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset);
318
319 base = (u8 *)&adapter->tx_queue.stats;
320 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++)
321 *buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset);
322
323 base = (u8 *)&adapter->rqd_start->stats;
324 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++)
325 *buf++ = *(u64 *)(base + vmxnet3_rq_dev_stats[i].offset);
326
327 base = (u8 *)&adapter->rx_queue.stats;
328 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++)
329 *buf++ = *(u64 *)(base + vmxnet3_rq_driver_stats[i].offset);
330
331 base = (u8 *)adapter;
332 for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++)
333 *buf++ = *(u64 *)(base + vmxnet3_global_stats[i].offset);
334}
335
336
337static void
338vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
339{
340 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
341 u32 *buf = p;
342
343 memset(p, 0, vmxnet3_get_regs_len(netdev));
344
345 regs->version = 1;
346
347 /* Update vmxnet3_get_regs_len if we want to dump more registers */
348
349 /* make each ring use multiple of 16 bytes */
350 buf[0] = adapter->tx_queue.tx_ring.next2fill;
351 buf[1] = adapter->tx_queue.tx_ring.next2comp;
352 buf[2] = adapter->tx_queue.tx_ring.gen;
353 buf[3] = 0;
354
355 buf[4] = adapter->tx_queue.comp_ring.next2proc;
356 buf[5] = adapter->tx_queue.comp_ring.gen;
357 buf[6] = adapter->tx_queue.stopped;
358 buf[7] = 0;
359
360 buf[8] = adapter->rx_queue.rx_ring[0].next2fill;
361 buf[9] = adapter->rx_queue.rx_ring[0].next2comp;
362 buf[10] = adapter->rx_queue.rx_ring[0].gen;
363 buf[11] = 0;
364
365 buf[12] = adapter->rx_queue.rx_ring[1].next2fill;
366 buf[13] = adapter->rx_queue.rx_ring[1].next2comp;
367 buf[14] = adapter->rx_queue.rx_ring[1].gen;
368 buf[15] = 0;
369
370 buf[16] = adapter->rx_queue.comp_ring.next2proc;
371 buf[17] = adapter->rx_queue.comp_ring.gen;
372 buf[18] = 0;
373 buf[19] = 0;
374}
375
376
377static void
378vmxnet3_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
379{
380 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
381
382 wol->supported = WAKE_UCAST | WAKE_ARP | WAKE_MAGIC;
383 wol->wolopts = adapter->wol;
384}
385
386
387static int
388vmxnet3_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
389{
390 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
391
392 if (wol->wolopts & (WAKE_PHY | WAKE_MCAST | WAKE_BCAST |
393 WAKE_MAGICSECURE)) {
394 return -EOPNOTSUPP;
395 }
396
397 adapter->wol = wol->wolopts;
398
399 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
400
401 return 0;
402}
403
404
405static int
406vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
407{
408 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
409
410 ecmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full |
411 SUPPORTED_TP;
412 ecmd->advertising = ADVERTISED_TP;
413 ecmd->port = PORT_TP;
414 ecmd->transceiver = XCVR_INTERNAL;
415
416 if (adapter->link_speed) {
417 ecmd->speed = adapter->link_speed;
418 ecmd->duplex = DUPLEX_FULL;
419 } else {
420 ecmd->speed = -1;
421 ecmd->duplex = -1;
422 }
423 return 0;
424}
425
426
427static void
428vmxnet3_get_ringparam(struct net_device *netdev,
429 struct ethtool_ringparam *param)
430{
431 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
432
433 param->rx_max_pending = VMXNET3_RX_RING_MAX_SIZE;
434 param->tx_max_pending = VMXNET3_TX_RING_MAX_SIZE;
435 param->rx_mini_max_pending = 0;
436 param->rx_jumbo_max_pending = 0;
437
438 param->rx_pending = adapter->rx_queue.rx_ring[0].size;
439 param->tx_pending = adapter->tx_queue.tx_ring.size;
440 param->rx_mini_pending = 0;
441 param->rx_jumbo_pending = 0;
442}
443
444
445static int
446vmxnet3_set_ringparam(struct net_device *netdev,
447 struct ethtool_ringparam *param)
448{
449 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
450 u32 new_tx_ring_size, new_rx_ring_size;
451 u32 sz;
452 int err = 0;
453
454 if (param->tx_pending == 0 || param->tx_pending >
455 VMXNET3_TX_RING_MAX_SIZE)
456 return -EINVAL;
457
458 if (param->rx_pending == 0 || param->rx_pending >
459 VMXNET3_RX_RING_MAX_SIZE)
460 return -EINVAL;
461
462
463 /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */
464 new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) &
465 ~VMXNET3_RING_SIZE_MASK;
466 new_tx_ring_size = min_t(u32, new_tx_ring_size,
467 VMXNET3_TX_RING_MAX_SIZE);
468 if (new_tx_ring_size > VMXNET3_TX_RING_MAX_SIZE || (new_tx_ring_size %
469 VMXNET3_RING_SIZE_ALIGN) != 0)
470 return -EINVAL;
471
472 /* ring0 has to be a multiple of
473 * rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN
474 */
475 sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN;
476 new_rx_ring_size = (param->rx_pending + sz - 1) / sz * sz;
477 new_rx_ring_size = min_t(u32, new_rx_ring_size,
478 VMXNET3_RX_RING_MAX_SIZE / sz * sz);
479 if (new_rx_ring_size > VMXNET3_RX_RING_MAX_SIZE || (new_rx_ring_size %
480 sz) != 0)
481 return -EINVAL;
482
483 if (new_tx_ring_size == adapter->tx_queue.tx_ring.size &&
484 new_rx_ring_size == adapter->rx_queue.rx_ring[0].size) {
485 return 0;
486 }
487
488 /*
489 * Reset_work may be in the middle of resetting the device, wait for its
490 * completion.
491 */
492 while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
493 msleep(1);
494
495 if (netif_running(netdev)) {
496 vmxnet3_quiesce_dev(adapter);
497 vmxnet3_reset_dev(adapter);
498
499 /* recreate the rx queue and the tx queue based on the
500 * new sizes */
501 vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
502 vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
503
504 err = vmxnet3_create_queues(adapter, new_tx_ring_size,
505 new_rx_ring_size, VMXNET3_DEF_RX_RING_SIZE);
506 if (err) {
507 /* failed, most likely because of OOM, try default
508 * size */
509 printk(KERN_ERR "%s: failed to apply new sizes, try the"
510 " default ones\n", netdev->name);
511 err = vmxnet3_create_queues(adapter,
512 VMXNET3_DEF_TX_RING_SIZE,
513 VMXNET3_DEF_RX_RING_SIZE,
514 VMXNET3_DEF_RX_RING_SIZE);
515 if (err) {
516 printk(KERN_ERR "%s: failed to create queues "
517 "with default sizes. Closing it\n",
518 netdev->name);
519 goto out;
520 }
521 }
522
523 err = vmxnet3_activate_dev(adapter);
524 if (err)
525 printk(KERN_ERR "%s: failed to re-activate, error %d."
526 " Closing it\n", netdev->name, err);
527 }
528
529out:
530 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
531 if (err)
532 vmxnet3_force_close(adapter);
533
534 return err;
535}
536
537
538static struct ethtool_ops vmxnet3_ethtool_ops = {
539 .get_settings = vmxnet3_get_settings,
540 .get_drvinfo = vmxnet3_get_drvinfo,
541 .get_regs_len = vmxnet3_get_regs_len,
542 .get_regs = vmxnet3_get_regs,
543 .get_wol = vmxnet3_get_wol,
544 .set_wol = vmxnet3_set_wol,
545 .get_link = ethtool_op_get_link,
546 .get_rx_csum = vmxnet3_get_rx_csum,
547 .set_rx_csum = vmxnet3_set_rx_csum,
548 .get_tx_csum = ethtool_op_get_tx_csum,
549 .set_tx_csum = ethtool_op_set_tx_hw_csum,
550 .get_sg = ethtool_op_get_sg,
551 .set_sg = ethtool_op_set_sg,
552 .get_tso = ethtool_op_get_tso,
553 .set_tso = ethtool_op_set_tso,
554 .get_strings = vmxnet3_get_strings,
555 .get_flags = vmxnet3_get_flags,
556 .set_flags = vmxnet3_set_flags,
557 .get_sset_count = vmxnet3_get_sset_count,
558 .get_ethtool_stats = vmxnet3_get_ethtool_stats,
559 .get_ringparam = vmxnet3_get_ringparam,
560 .set_ringparam = vmxnet3_set_ringparam,
561};
562
563void vmxnet3_set_ethtool_ops(struct net_device *netdev)
564{
565 SET_ETHTOOL_OPS(netdev, &vmxnet3_ethtool_ops);
566}
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
new file mode 100644
index 000000000000..3c0d70d58111
--- /dev/null
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -0,0 +1,389 @@
1/*
2 * Linux driver for VMware's vmxnet3 ethernet NIC.
3 *
4 * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved.
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; version 2 of the License and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13 * NON INFRINGEMENT. See the GNU General Public License for more
14 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * The full GNU General Public License is included in this distribution in
21 * the file called "COPYING".
22 *
23 * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
24 *
25 */
26
27#ifndef _VMXNET3_INT_H
28#define _VMXNET3_INT_H
29
30#include <linux/types.h>
31#include <linux/ethtool.h>
32#include <linux/delay.h>
33#include <linux/device.h>
34#include <linux/netdevice.h>
35#include <linux/pci.h>
36#include <linux/ethtool.h>
37#include <linux/compiler.h>
38#include <linux/module.h>
39#include <linux/moduleparam.h>
40#include <linux/slab.h>
41#include <linux/spinlock.h>
42#include <linux/ioport.h>
43#include <linux/highmem.h>
44#include <linux/init.h>
45#include <linux/timer.h>
46#include <linux/skbuff.h>
47#include <linux/interrupt.h>
48#include <linux/workqueue.h>
49#include <linux/uaccess.h>
50#include <asm/dma.h>
51#include <asm/page.h>
52
53#include <linux/tcp.h>
54#include <linux/udp.h>
55#include <linux/ip.h>
56#include <linux/ipv6.h>
57#include <linux/in.h>
58#include <linux/etherdevice.h>
59#include <asm/checksum.h>
60#include <linux/if_vlan.h>
61#include <linux/if_arp.h>
62#include <linux/inetdevice.h>
63
64#include "vmxnet3_defs.h"
65
66#ifdef DEBUG
67# define VMXNET3_DRIVER_VERSION_REPORT VMXNET3_DRIVER_VERSION_STRING"-NAPI(debug)"
68#else
69# define VMXNET3_DRIVER_VERSION_REPORT VMXNET3_DRIVER_VERSION_STRING"-NAPI"
70#endif
71
72
73/*
74 * Version numbers
75 */
76#define VMXNET3_DRIVER_VERSION_STRING "1.0.5.0-k"
77
78/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
79#define VMXNET3_DRIVER_VERSION_NUM 0x01000500
80
81
82/*
83 * Capabilities
84 */
85
86enum {
87 VMNET_CAP_SG = 0x0001, /* Can do scatter-gather transmits. */
88 VMNET_CAP_IP4_CSUM = 0x0002, /* Can checksum only TCP/UDP over
89 * IPv4 */
90 VMNET_CAP_HW_CSUM = 0x0004, /* Can checksum all packets. */
91 VMNET_CAP_HIGH_DMA = 0x0008, /* Can DMA to high memory. */
92 VMNET_CAP_TOE = 0x0010, /* Supports TCP/IP offload. */
93 VMNET_CAP_TSO = 0x0020, /* Supports TCP Segmentation
94 * offload */
95 VMNET_CAP_SW_TSO = 0x0040, /* Supports SW TCP Segmentation */
96 VMNET_CAP_VMXNET_APROM = 0x0080, /* Vmxnet APROM support */
97 VMNET_CAP_HW_TX_VLAN = 0x0100, /* Can we do VLAN tagging in HW */
98 VMNET_CAP_HW_RX_VLAN = 0x0200, /* Can we do VLAN untagging in HW */
99 VMNET_CAP_SW_VLAN = 0x0400, /* VLAN tagging/untagging in SW */
100 VMNET_CAP_WAKE_PCKT_RCV = 0x0800, /* Can wake on network packet recv? */
101 VMNET_CAP_ENABLE_INT_INLINE = 0x1000, /* Enable Interrupt Inline */
102 VMNET_CAP_ENABLE_HEADER_COPY = 0x2000, /* copy header for vmkernel */
103 VMNET_CAP_TX_CHAIN = 0x4000, /* Guest can use multiple tx entries
104 * for a pkt */
105 VMNET_CAP_RX_CHAIN = 0x8000, /* pkt can span multiple rx entries */
106 VMNET_CAP_LPD = 0x10000, /* large pkt delivery */
107 VMNET_CAP_BPF = 0x20000, /* BPF Support in VMXNET Virtual HW*/
108 VMNET_CAP_SG_SPAN_PAGES = 0x40000, /* Scatter-gather can span multiple*/
109 /* pages transmits */
110 VMNET_CAP_IP6_CSUM = 0x80000, /* Can do IPv6 csum offload. */
111 VMNET_CAP_TSO6 = 0x100000, /* TSO seg. offload for IPv6 pkts. */
112 VMNET_CAP_TSO256k = 0x200000, /* Can do TSO seg offload for */
113 /* pkts up to 256kB. */
114 VMNET_CAP_UPT = 0x400000 /* Support UPT */
115};
116
117/*
118 * PCI vendor and device IDs.
119 */
120#define PCI_VENDOR_ID_VMWARE 0x15AD
121#define PCI_DEVICE_ID_VMWARE_VMXNET3 0x07B0
122#define MAX_ETHERNET_CARDS 10
123#define MAX_PCI_PASSTHRU_DEVICE 6
124
125struct vmxnet3_cmd_ring {
126 union Vmxnet3_GenericDesc *base;
127 u32 size;
128 u32 next2fill;
129 u32 next2comp;
130 u8 gen;
131 dma_addr_t basePA;
132};
133
134static inline void
135vmxnet3_cmd_ring_adv_next2fill(struct vmxnet3_cmd_ring *ring)
136{
137 ring->next2fill++;
138 if (unlikely(ring->next2fill == ring->size)) {
139 ring->next2fill = 0;
140 VMXNET3_FLIP_RING_GEN(ring->gen);
141 }
142}
143
144static inline void
145vmxnet3_cmd_ring_adv_next2comp(struct vmxnet3_cmd_ring *ring)
146{
147 VMXNET3_INC_RING_IDX_ONLY(ring->next2comp, ring->size);
148}
149
150static inline int
151vmxnet3_cmd_ring_desc_avail(struct vmxnet3_cmd_ring *ring)
152{
153 return (ring->next2comp > ring->next2fill ? 0 : ring->size) +
154 ring->next2comp - ring->next2fill - 1;
155}
156
157struct vmxnet3_comp_ring {
158 union Vmxnet3_GenericDesc *base;
159 u32 size;
160 u32 next2proc;
161 u8 gen;
162 u8 intr_idx;
163 dma_addr_t basePA;
164};
165
166static inline void
167vmxnet3_comp_ring_adv_next2proc(struct vmxnet3_comp_ring *ring)
168{
169 ring->next2proc++;
170 if (unlikely(ring->next2proc == ring->size)) {
171 ring->next2proc = 0;
172 VMXNET3_FLIP_RING_GEN(ring->gen);
173 }
174}
175
176struct vmxnet3_tx_data_ring {
177 struct Vmxnet3_TxDataDesc *base;
178 u32 size;
179 dma_addr_t basePA;
180};
181
182enum vmxnet3_buf_map_type {
183 VMXNET3_MAP_INVALID = 0,
184 VMXNET3_MAP_NONE,
185 VMXNET3_MAP_SINGLE,
186 VMXNET3_MAP_PAGE,
187};
188
189struct vmxnet3_tx_buf_info {
190 u32 map_type;
191 u16 len;
192 u16 sop_idx;
193 dma_addr_t dma_addr;
194 struct sk_buff *skb;
195};
196
197struct vmxnet3_tq_driver_stats {
198 u64 drop_total; /* # of pkts dropped by the driver, the
199 * counters below track droppings due to
200 * different reasons
201 */
202 u64 drop_too_many_frags;
203 u64 drop_oversized_hdr;
204 u64 drop_hdr_inspect_err;
205 u64 drop_tso;
206
207 u64 tx_ring_full;
208 u64 linearized; /* # of pkts linearized */
209 u64 copy_skb_header; /* # of times we have to copy skb header */
210 u64 oversized_hdr;
211};
212
213struct vmxnet3_tx_ctx {
214 bool ipv4;
215 u16 mss;
216 u32 eth_ip_hdr_size; /* only valid for pkts requesting tso or csum
217 * offloading
218 */
219 u32 l4_hdr_size; /* only valid if mss != 0 */
220 u32 copy_size; /* # of bytes copied into the data ring */
221 union Vmxnet3_GenericDesc *sop_txd;
222 union Vmxnet3_GenericDesc *eop_txd;
223};
224
225struct vmxnet3_tx_queue {
226 spinlock_t tx_lock;
227 struct vmxnet3_cmd_ring tx_ring;
228 struct vmxnet3_tx_buf_info *buf_info;
229 struct vmxnet3_tx_data_ring data_ring;
230 struct vmxnet3_comp_ring comp_ring;
231 struct Vmxnet3_TxQueueCtrl *shared;
232 struct vmxnet3_tq_driver_stats stats;
233 bool stopped;
234 int num_stop; /* # of times the queue is
235 * stopped */
236} __attribute__((__aligned__(SMP_CACHE_BYTES)));
237
238enum vmxnet3_rx_buf_type {
239 VMXNET3_RX_BUF_NONE = 0,
240 VMXNET3_RX_BUF_SKB = 1,
241 VMXNET3_RX_BUF_PAGE = 2
242};
243
244struct vmxnet3_rx_buf_info {
245 enum vmxnet3_rx_buf_type buf_type;
246 u16 len;
247 union {
248 struct sk_buff *skb;
249 struct page *page;
250 };
251 dma_addr_t dma_addr;
252};
253
254struct vmxnet3_rx_ctx {
255 struct sk_buff *skb;
256 u32 sop_idx;
257};
258
259struct vmxnet3_rq_driver_stats {
260 u64 drop_total;
261 u64 drop_err;
262 u64 drop_fcs;
263 u64 rx_buf_alloc_failure;
264};
265
266struct vmxnet3_rx_queue {
267 struct vmxnet3_cmd_ring rx_ring[2];
268 struct vmxnet3_comp_ring comp_ring;
269 struct vmxnet3_rx_ctx rx_ctx;
270 u32 qid; /* rqID in RCD for buffer from 1st ring */
271 u32 qid2; /* rqID in RCD for buffer from 2nd ring */
272 u32 uncommitted[2]; /* # of buffers allocated since last RXPROD
273 * update */
274 struct vmxnet3_rx_buf_info *buf_info[2];
275 struct Vmxnet3_RxQueueCtrl *shared;
276 struct vmxnet3_rq_driver_stats stats;
277} __attribute__((__aligned__(SMP_CACHE_BYTES)));
278
279#define VMXNET3_LINUX_MAX_MSIX_VECT 1
280
281struct vmxnet3_intr {
282 enum vmxnet3_intr_mask_mode mask_mode;
283 enum vmxnet3_intr_type type; /* MSI-X, MSI, or INTx? */
284 u8 num_intrs; /* # of intr vectors */
285 u8 event_intr_idx; /* idx of the intr vector for event */
286 u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */
287#ifdef CONFIG_PCI_MSI
288 struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT];
289#endif
290};
291
292#define VMXNET3_STATE_BIT_RESETTING 0
293#define VMXNET3_STATE_BIT_QUIESCED 1
294struct vmxnet3_adapter {
295 struct vmxnet3_tx_queue tx_queue;
296 struct vmxnet3_rx_queue rx_queue;
297 struct napi_struct napi;
298 struct vlan_group *vlan_grp;
299
300 struct vmxnet3_intr intr;
301
302 struct Vmxnet3_DriverShared *shared;
303 struct Vmxnet3_PMConf *pm_conf;
304 struct Vmxnet3_TxQueueDesc *tqd_start; /* first tx queue desc */
305 struct Vmxnet3_RxQueueDesc *rqd_start; /* first rx queue desc */
306 struct net_device *netdev;
307 struct pci_dev *pdev;
308
309 u8 *hw_addr0; /* for BAR 0 */
310 u8 *hw_addr1; /* for BAR 1 */
311
312 /* feature control */
313 bool rxcsum;
314 bool lro;
315 bool jumbo_frame;
316
317 /* rx buffer related */
318 unsigned skb_buf_size;
319 int rx_buf_per_pkt; /* only apply to the 1st ring */
320 dma_addr_t shared_pa;
321 dma_addr_t queue_desc_pa;
322
323 /* Wake-on-LAN */
324 u32 wol;
325
326 /* Link speed */
327 u32 link_speed; /* in mbps */
328
329 u64 tx_timeout_count;
330 struct work_struct work;
331
332 unsigned long state; /* VMXNET3_STATE_BIT_xxx */
333
334 int dev_number;
335};
336
337#define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \
338 writel((val), (adapter)->hw_addr0 + (reg))
339#define VMXNET3_READ_BAR0_REG(adapter, reg) \
340 readl((adapter)->hw_addr0 + (reg))
341
342#define VMXNET3_WRITE_BAR1_REG(adapter, reg, val) \
343 writel((val), (adapter)->hw_addr1 + (reg))
344#define VMXNET3_READ_BAR1_REG(adapter, reg) \
345 readl((adapter)->hw_addr1 + (reg))
346
347#define VMXNET3_WAKE_QUEUE_THRESHOLD(tq) (5)
348#define VMXNET3_RX_ALLOC_THRESHOLD(rq, ring_idx, adapter) \
349 ((rq)->rx_ring[ring_idx].size >> 3)
350
351#define VMXNET3_GET_ADDR_LO(dma) ((u32)(dma))
352#define VMXNET3_GET_ADDR_HI(dma) ((u32)(((u64)(dma)) >> 32))
353
354/* must be a multiple of VMXNET3_RING_SIZE_ALIGN */
355#define VMXNET3_DEF_TX_RING_SIZE 512
356#define VMXNET3_DEF_RX_RING_SIZE 256
357
358#define VMXNET3_MAX_ETH_HDR_SIZE 22
359#define VMXNET3_MAX_SKB_BUF_SIZE (3*1024)
360
361int
362vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter);
363
364int
365vmxnet3_activate_dev(struct vmxnet3_adapter *adapter);
366
367void
368vmxnet3_force_close(struct vmxnet3_adapter *adapter);
369
370void
371vmxnet3_reset_dev(struct vmxnet3_adapter *adapter);
372
373void
374vmxnet3_tq_destroy(struct vmxnet3_tx_queue *tq,
375 struct vmxnet3_adapter *adapter);
376
377void
378vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
379 struct vmxnet3_adapter *adapter);
380
381int
382vmxnet3_create_queues(struct vmxnet3_adapter *adapter,
383 u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size);
384
385extern void vmxnet3_set_ethtool_ops(struct net_device *netdev);
386extern struct net_device_stats *vmxnet3_get_stats(struct net_device *netdev);
387
388extern char vmxnet3_driver_name[];
389#endif
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index cf5fd17ad707..f1bff98acd1f 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -58,8 +58,7 @@ struct cisco_state {
58 spinlock_t lock; 58 spinlock_t lock;
59 unsigned long last_poll; 59 unsigned long last_poll;
60 int up; 60 int up;
61 int request_sent; 61 u32 txseq; /* TX sequence number, 0 = none */
62 u32 txseq; /* TX sequence number */
63 u32 rxseq; /* RX sequence number */ 62 u32 rxseq; /* RX sequence number */
64}; 63};
65 64
@@ -163,6 +162,7 @@ static int cisco_rx(struct sk_buff *skb)
163 struct cisco_packet *cisco_data; 162 struct cisco_packet *cisco_data;
164 struct in_device *in_dev; 163 struct in_device *in_dev;
165 __be32 addr, mask; 164 __be32 addr, mask;
165 u32 ack;
166 166
167 if (skb->len < sizeof(struct hdlc_header)) 167 if (skb->len < sizeof(struct hdlc_header))
168 goto rx_error; 168 goto rx_error;
@@ -223,8 +223,10 @@ static int cisco_rx(struct sk_buff *skb)
223 case CISCO_KEEPALIVE_REQ: 223 case CISCO_KEEPALIVE_REQ:
224 spin_lock(&st->lock); 224 spin_lock(&st->lock);
225 st->rxseq = ntohl(cisco_data->par1); 225 st->rxseq = ntohl(cisco_data->par1);
226 if (st->request_sent && 226 ack = ntohl(cisco_data->par2);
227 ntohl(cisco_data->par2) == st->txseq) { 227 if (ack && (ack == st->txseq ||
228 /* our current REQ may be in transit */
229 ack == st->txseq - 1)) {
228 st->last_poll = jiffies; 230 st->last_poll = jiffies;
229 if (!st->up) { 231 if (!st->up) {
230 u32 sec, min, hrs, days; 232 u32 sec, min, hrs, days;
@@ -275,7 +277,6 @@ static void cisco_timer(unsigned long arg)
275 277
276 cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, htonl(++st->txseq), 278 cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, htonl(++st->txseq),
277 htonl(st->rxseq)); 279 htonl(st->rxseq));
278 st->request_sent = 1;
279 spin_unlock(&st->lock); 280 spin_unlock(&st->lock);
280 281
281 st->timer.expires = jiffies + st->settings.interval * HZ; 282 st->timer.expires = jiffies + st->settings.interval * HZ;
@@ -293,9 +294,7 @@ static void cisco_start(struct net_device *dev)
293 unsigned long flags; 294 unsigned long flags;
294 295
295 spin_lock_irqsave(&st->lock, flags); 296 spin_lock_irqsave(&st->lock, flags);
296 st->up = 0; 297 st->up = st->txseq = st->rxseq = 0;
297 st->request_sent = 0;
298 st->txseq = st->rxseq = 0;
299 spin_unlock_irqrestore(&st->lock, flags); 298 spin_unlock_irqrestore(&st->lock, flags);
300 299
301 init_timer(&st->timer); 300 init_timer(&st->timer);
@@ -317,8 +316,7 @@ static void cisco_stop(struct net_device *dev)
317 316
318 spin_lock_irqsave(&st->lock, flags); 317 spin_lock_irqsave(&st->lock, flags);
319 netif_dormant_on(dev); 318 netif_dormant_on(dev);
320 st->up = 0; 319 st->up = st->txseq = 0;
321 st->request_sent = 0;
322 spin_unlock_irqrestore(&st->lock, flags); 320 spin_unlock_irqrestore(&st->lock, flags);
323} 321}
324 322
diff --git a/drivers/net/wireless/adm8211.h b/drivers/net/wireless/adm8211.h
index 4f6ab1322189..b07e4d3a6b4d 100644
--- a/drivers/net/wireless/adm8211.h
+++ b/drivers/net/wireless/adm8211.h
@@ -266,7 +266,7 @@ do { \
266#define ADM8211_SYNCTL_CS1 (1 << 28) 266#define ADM8211_SYNCTL_CS1 (1 << 28)
267#define ADM8211_SYNCTL_CAL (1 << 27) 267#define ADM8211_SYNCTL_CAL (1 << 27)
268#define ADM8211_SYNCTL_SELCAL (1 << 26) 268#define ADM8211_SYNCTL_SELCAL (1 << 26)
269#define ADM8211_SYNCTL_RFtype ((1 << 24) || (1 << 23) || (1 << 22)) 269#define ADM8211_SYNCTL_RFtype ((1 << 24) | (1 << 23) | (1 << 22))
270#define ADM8211_SYNCTL_RFMD (1 << 22) 270#define ADM8211_SYNCTL_RFMD (1 << 22)
271#define ADM8211_SYNCTL_GENERAL (0x7 << 22) 271#define ADM8211_SYNCTL_GENERAL (0x7 << 22)
272/* SYNCTL 21:0 Data (Si4126: 18-bit data, 4-bit address) */ 272/* SYNCTL 21:0 Data (Si4126: 18-bit data, 4-bit address) */
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 7116a1aa20ce..abf896a7390e 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode,
4790static int get_dec_u16( char *buffer, int *start, int limit ) { 4790static int get_dec_u16( char *buffer, int *start, int limit ) {
4791 u16 value; 4791 u16 value;
4792 int valid = 0; 4792 int valid = 0;
4793 for( value = 0; buffer[*start] >= '0' && 4793 for (value = 0; *start < limit && buffer[*start] >= '0' &&
4794 buffer[*start] <= '9' && 4794 buffer[*start] <= '9'; (*start)++) {
4795 *start < limit; (*start)++ ) {
4796 valid = 1; 4795 valid = 1;
4797 value *= 10; 4796 value *= 10;
4798 value += buffer[*start] - '0'; 4797 value += buffer[*start] - '0';
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 16a271787b85..1895d63aad0a 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -679,7 +679,7 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc,
679 return rate; 679 return rate;
680 680
681 if (rate_table->info[rate].valid_single_stream && 681 if (rate_table->info[rate].valid_single_stream &&
682 !(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG)); 682 !(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG))
683 return rate; 683 return rate;
684 684
685 /* This should not happen */ 685 /* This should not happen */
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index fa1549a03c71..660716214d49 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -607,82 +607,7 @@ struct b43_qos_params {
607 struct ieee80211_tx_queue_params p; 607 struct ieee80211_tx_queue_params p;
608}; 608};
609 609
610struct b43_wldev; 610struct b43_wl;
611
612/* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */
613struct b43_wl {
614 /* Pointer to the active wireless device on this chip */
615 struct b43_wldev *current_dev;
616 /* Pointer to the ieee80211 hardware data structure */
617 struct ieee80211_hw *hw;
618
619 /* Global driver mutex. Every operation must run with this mutex locked. */
620 struct mutex mutex;
621 /* Hard-IRQ spinlock. This lock protects things used in the hard-IRQ
622 * handler, only. This basically is just the IRQ mask register. */
623 spinlock_t hardirq_lock;
624
625 /* The number of queues that were registered with the mac80211 subsystem
626 * initially. This is a backup copy of hw->queues in case hw->queues has
627 * to be dynamically lowered at runtime (Firmware does not support QoS).
628 * hw->queues has to be restored to the original value before unregistering
629 * from the mac80211 subsystem. */
630 u16 mac80211_initially_registered_queues;
631
632 /* We can only have one operating interface (802.11 core)
633 * at a time. General information about this interface follows.
634 */
635
636 struct ieee80211_vif *vif;
637 /* The MAC address of the operating interface. */
638 u8 mac_addr[ETH_ALEN];
639 /* Current BSSID */
640 u8 bssid[ETH_ALEN];
641 /* Interface type. (NL80211_IFTYPE_XXX) */
642 int if_type;
643 /* Is the card operating in AP, STA or IBSS mode? */
644 bool operating;
645 /* filter flags */
646 unsigned int filter_flags;
647 /* Stats about the wireless interface */
648 struct ieee80211_low_level_stats ieee_stats;
649
650#ifdef CONFIG_B43_HWRNG
651 struct hwrng rng;
652 bool rng_initialized;
653 char rng_name[30 + 1];
654#endif /* CONFIG_B43_HWRNG */
655
656 /* List of all wireless devices on this chip */
657 struct list_head devlist;
658 u8 nr_devs;
659
660 bool radiotap_enabled;
661 bool radio_enabled;
662
663 /* The beacon we are currently using (AP or IBSS mode). */
664 struct sk_buff *current_beacon;
665 bool beacon0_uploaded;
666 bool beacon1_uploaded;
667 bool beacon_templates_virgin; /* Never wrote the templates? */
668 struct work_struct beacon_update_trigger;
669
670 /* The current QOS parameters for the 4 queues. */
671 struct b43_qos_params qos_params[4];
672
673 /* Work for adjustment of the transmission power.
674 * This is scheduled when we determine that the actual TX output
675 * power doesn't match what we want. */
676 struct work_struct txpower_adjust_work;
677
678 /* Packet transmit work */
679 struct work_struct tx_work;
680 /* Queue of packets to be transmitted. */
681 struct sk_buff_head tx_queue;
682
683 /* The device LEDs. */
684 struct b43_leds leds;
685};
686 611
687/* The type of the firmware file. */ 612/* The type of the firmware file. */
688enum b43_firmware_file_type { 613enum b43_firmware_file_type {
@@ -824,6 +749,97 @@ struct b43_wldev {
824#endif 749#endif
825}; 750};
826 751
752/*
753 * Include goes here to avoid a dependency problem.
754 * A better fix would be to integrate xmit.h into b43.h.
755 */
756#include "xmit.h"
757
758/* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */
759struct b43_wl {
760 /* Pointer to the active wireless device on this chip */
761 struct b43_wldev *current_dev;
762 /* Pointer to the ieee80211 hardware data structure */
763 struct ieee80211_hw *hw;
764
765 /* Global driver mutex. Every operation must run with this mutex locked. */
766 struct mutex mutex;
767 /* Hard-IRQ spinlock. This lock protects things used in the hard-IRQ
768 * handler, only. This basically is just the IRQ mask register. */
769 spinlock_t hardirq_lock;
770
771 /* The number of queues that were registered with the mac80211 subsystem
772 * initially. This is a backup copy of hw->queues in case hw->queues has
773 * to be dynamically lowered at runtime (Firmware does not support QoS).
774 * hw->queues has to be restored to the original value before unregistering
775 * from the mac80211 subsystem. */
776 u16 mac80211_initially_registered_queues;
777
778 /* We can only have one operating interface (802.11 core)
779 * at a time. General information about this interface follows.
780 */
781
782 struct ieee80211_vif *vif;
783 /* The MAC address of the operating interface. */
784 u8 mac_addr[ETH_ALEN];
785 /* Current BSSID */
786 u8 bssid[ETH_ALEN];
787 /* Interface type. (NL80211_IFTYPE_XXX) */
788 int if_type;
789 /* Is the card operating in AP, STA or IBSS mode? */
790 bool operating;
791 /* filter flags */
792 unsigned int filter_flags;
793 /* Stats about the wireless interface */
794 struct ieee80211_low_level_stats ieee_stats;
795
796#ifdef CONFIG_B43_HWRNG
797 struct hwrng rng;
798 bool rng_initialized;
799 char rng_name[30 + 1];
800#endif /* CONFIG_B43_HWRNG */
801
802 /* List of all wireless devices on this chip */
803 struct list_head devlist;
804 u8 nr_devs;
805
806 bool radiotap_enabled;
807 bool radio_enabled;
808
809 /* The beacon we are currently using (AP or IBSS mode). */
810 struct sk_buff *current_beacon;
811 bool beacon0_uploaded;
812 bool beacon1_uploaded;
813 bool beacon_templates_virgin; /* Never wrote the templates? */
814 struct work_struct beacon_update_trigger;
815
816 /* The current QOS parameters for the 4 queues. */
817 struct b43_qos_params qos_params[4];
818
819 /* Work for adjustment of the transmission power.
820 * This is scheduled when we determine that the actual TX output
821 * power doesn't match what we want. */
822 struct work_struct txpower_adjust_work;
823
824 /* Packet transmit work */
825 struct work_struct tx_work;
826 /* Queue of packets to be transmitted. */
827 struct sk_buff_head tx_queue;
828
829 /* The device LEDs. */
830 struct b43_leds leds;
831
832#ifdef CONFIG_B43_PIO
833 /*
834 * RX/TX header/tail buffers used by the frame transmit functions.
835 */
836 struct b43_rxhdr_fw4 rxhdr;
837 struct b43_txhdr txhdr;
838 u8 rx_tail[4];
839 u8 tx_tail[4];
840#endif /* CONFIG_B43_PIO */
841};
842
827static inline struct b43_wl *hw_to_b43_wl(struct ieee80211_hw *hw) 843static inline struct b43_wl *hw_to_b43_wl(struct ieee80211_hw *hw)
828{ 844{
829 return hw->priv; 845 return hw->priv;
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 8701034569fa..de4e804bedf0 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1157,8 +1157,9 @@ struct b43_dmaring *parse_cookie(struct b43_wldev *dev, u16 cookie, int *slot)
1157} 1157}
1158 1158
1159static int dma_tx_fragment(struct b43_dmaring *ring, 1159static int dma_tx_fragment(struct b43_dmaring *ring,
1160 struct sk_buff *skb) 1160 struct sk_buff **in_skb)
1161{ 1161{
1162 struct sk_buff *skb = *in_skb;
1162 const struct b43_dma_ops *ops = ring->ops; 1163 const struct b43_dma_ops *ops = ring->ops;
1163 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1164 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1164 u8 *header; 1165 u8 *header;
@@ -1224,8 +1225,14 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1224 } 1225 }
1225 1226
1226 memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len); 1227 memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len);
1228 memcpy(bounce_skb->cb, skb->cb, sizeof(skb->cb));
1229 bounce_skb->dev = skb->dev;
1230 skb_set_queue_mapping(bounce_skb, skb_get_queue_mapping(skb));
1231 info = IEEE80211_SKB_CB(bounce_skb);
1232
1227 dev_kfree_skb_any(skb); 1233 dev_kfree_skb_any(skb);
1228 skb = bounce_skb; 1234 skb = bounce_skb;
1235 *in_skb = bounce_skb;
1229 meta->skb = skb; 1236 meta->skb = skb;
1230 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1237 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1231 if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { 1238 if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
@@ -1355,7 +1362,11 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1355 * static, so we don't need to store it per frame. */ 1362 * static, so we don't need to store it per frame. */
1356 ring->queue_prio = skb_get_queue_mapping(skb); 1363 ring->queue_prio = skb_get_queue_mapping(skb);
1357 1364
1358 err = dma_tx_fragment(ring, skb); 1365 /* dma_tx_fragment might reallocate the skb, so invalidate pointers pointing
1366 * into the skb data or cb now. */
1367 hdr = NULL;
1368 info = NULL;
1369 err = dma_tx_fragment(ring, &skb);
1359 if (unlikely(err == -ENOKEY)) { 1370 if (unlikely(err == -ENOKEY)) {
1360 /* Drop this packet, as we don't have the encryption key 1371 /* Drop this packet, as we don't have the encryption key
1361 * anymore and must not transmit it unencrypted. */ 1372 * anymore and must not transmit it unencrypted. */
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index fbe3d4f62ce2..1e8dba488004 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -348,9 +348,9 @@ void b43_leds_register(struct b43_wldev *dev)
348 } 348 }
349} 349}
350 350
351void b43_leds_unregister(struct b43_wldev *dev) 351void b43_leds_unregister(struct b43_wl *wl)
352{ 352{
353 struct b43_leds *leds = &dev->wl->leds; 353 struct b43_leds *leds = &wl->leds;
354 354
355 b43_unregister_led(&leds->led_tx); 355 b43_unregister_led(&leds->led_tx);
356 b43_unregister_led(&leds->led_rx); 356 b43_unregister_led(&leds->led_rx);
diff --git a/drivers/net/wireless/b43/leds.h b/drivers/net/wireless/b43/leds.h
index 9592e4c5a5f5..32b66d53cdac 100644
--- a/drivers/net/wireless/b43/leds.h
+++ b/drivers/net/wireless/b43/leds.h
@@ -1,6 +1,7 @@
1#ifndef B43_LEDS_H_ 1#ifndef B43_LEDS_H_
2#define B43_LEDS_H_ 2#define B43_LEDS_H_
3 3
4struct b43_wl;
4struct b43_wldev; 5struct b43_wldev;
5 6
6#ifdef CONFIG_B43_LEDS 7#ifdef CONFIG_B43_LEDS
@@ -60,7 +61,7 @@ enum b43_led_behaviour {
60}; 61};
61 62
62void b43_leds_register(struct b43_wldev *dev); 63void b43_leds_register(struct b43_wldev *dev);
63void b43_leds_unregister(struct b43_wldev *dev); 64void b43_leds_unregister(struct b43_wl *wl);
64void b43_leds_init(struct b43_wldev *dev); 65void b43_leds_init(struct b43_wldev *dev);
65void b43_leds_exit(struct b43_wldev *dev); 66void b43_leds_exit(struct b43_wldev *dev);
66void b43_leds_stop(struct b43_wldev *dev); 67void b43_leds_stop(struct b43_wldev *dev);
@@ -76,7 +77,7 @@ struct b43_leds {
76static inline void b43_leds_register(struct b43_wldev *dev) 77static inline void b43_leds_register(struct b43_wldev *dev)
77{ 78{
78} 79}
79static inline void b43_leds_unregister(struct b43_wldev *dev) 80static inline void b43_leds_unregister(struct b43_wl *wl)
80{ 81{
81} 82}
82static inline void b43_leds_init(struct b43_wldev *dev) 83static inline void b43_leds_init(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9b907a36bb8c..86f35827f008 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3874,6 +3874,7 @@ static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev)
3874{ 3874{
3875 struct b43_wl *wl = dev->wl; 3875 struct b43_wl *wl = dev->wl;
3876 struct b43_wldev *orig_dev; 3876 struct b43_wldev *orig_dev;
3877 u32 mask;
3877 3878
3878redo: 3879redo:
3879 if (!dev || b43_status(dev) < B43_STAT_STARTED) 3880 if (!dev || b43_status(dev) < B43_STAT_STARTED)
@@ -3920,7 +3921,8 @@ redo:
3920 goto redo; 3921 goto redo;
3921 return dev; 3922 return dev;
3922 } 3923 }
3923 B43_WARN_ON(b43_read32(dev, B43_MMIO_GEN_IRQ_MASK)); 3924 mask = b43_read32(dev, B43_MMIO_GEN_IRQ_MASK);
3925 B43_WARN_ON(mask != 0xFFFFFFFF && mask);
3924 3926
3925 /* Drain the TX queue */ 3927 /* Drain the TX queue */
3926 while (skb_queue_len(&wl->tx_queue)) 3928 while (skb_queue_len(&wl->tx_queue))
@@ -4997,7 +4999,7 @@ static void b43_remove(struct ssb_device *dev)
4997 4999
4998 if (list_empty(&wl->devlist)) { 5000 if (list_empty(&wl->devlist)) {
4999 b43_rng_exit(wl); 5001 b43_rng_exit(wl);
5000 b43_leds_unregister(wldev); 5002 b43_leds_unregister(wl);
5001 /* Last core on the chip unregistered. 5003 /* Last core on the chip unregistered.
5002 * We can destroy common struct b43_wl. 5004 * We can destroy common struct b43_wl.
5003 */ 5005 */
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 5e87650b07fb..9b9044400218 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -332,6 +332,7 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q,
332 unsigned int data_len) 332 unsigned int data_len)
333{ 333{
334 struct b43_wldev *dev = q->dev; 334 struct b43_wldev *dev = q->dev;
335 struct b43_wl *wl = dev->wl;
335 const u8 *data = _data; 336 const u8 *data = _data;
336 337
337 ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; 338 ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI;
@@ -341,13 +342,12 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q,
341 q->mmio_base + B43_PIO_TXDATA, 342 q->mmio_base + B43_PIO_TXDATA,
342 sizeof(u16)); 343 sizeof(u16));
343 if (data_len & 1) { 344 if (data_len & 1) {
344 u8 tail[2] = { 0, };
345
346 /* Write the last byte. */ 345 /* Write the last byte. */
347 ctl &= ~B43_PIO_TXCTL_WRITEHI; 346 ctl &= ~B43_PIO_TXCTL_WRITEHI;
348 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); 347 b43_piotx_write16(q, B43_PIO_TXCTL, ctl);
349 tail[0] = data[data_len - 1]; 348 wl->tx_tail[0] = data[data_len - 1];
350 ssb_block_write(dev->dev, tail, 2, 349 wl->tx_tail[1] = 0;
350 ssb_block_write(dev->dev, wl->tx_tail, 2,
351 q->mmio_base + B43_PIO_TXDATA, 351 q->mmio_base + B43_PIO_TXDATA,
352 sizeof(u16)); 352 sizeof(u16));
353 } 353 }
@@ -382,6 +382,7 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q,
382 unsigned int data_len) 382 unsigned int data_len)
383{ 383{
384 struct b43_wldev *dev = q->dev; 384 struct b43_wldev *dev = q->dev;
385 struct b43_wl *wl = dev->wl;
385 const u8 *data = _data; 386 const u8 *data = _data;
386 387
387 ctl |= B43_PIO8_TXCTL_0_7 | B43_PIO8_TXCTL_8_15 | 388 ctl |= B43_PIO8_TXCTL_0_7 | B43_PIO8_TXCTL_8_15 |
@@ -392,29 +393,31 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q,
392 q->mmio_base + B43_PIO8_TXDATA, 393 q->mmio_base + B43_PIO8_TXDATA,
393 sizeof(u32)); 394 sizeof(u32));
394 if (data_len & 3) { 395 if (data_len & 3) {
395 u8 tail[4] = { 0, }; 396 wl->tx_tail[3] = 0;
396
397 /* Write the last few bytes. */ 397 /* Write the last few bytes. */
398 ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 | 398 ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 |
399 B43_PIO8_TXCTL_24_31); 399 B43_PIO8_TXCTL_24_31);
400 switch (data_len & 3) { 400 switch (data_len & 3) {
401 case 3: 401 case 3:
402 ctl |= B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_8_15; 402 ctl |= B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_8_15;
403 tail[0] = data[data_len - 3]; 403 wl->tx_tail[0] = data[data_len - 3];
404 tail[1] = data[data_len - 2]; 404 wl->tx_tail[1] = data[data_len - 2];
405 tail[2] = data[data_len - 1]; 405 wl->tx_tail[2] = data[data_len - 1];
406 break; 406 break;
407 case 2: 407 case 2:
408 ctl |= B43_PIO8_TXCTL_8_15; 408 ctl |= B43_PIO8_TXCTL_8_15;
409 tail[0] = data[data_len - 2]; 409 wl->tx_tail[0] = data[data_len - 2];
410 tail[1] = data[data_len - 1]; 410 wl->tx_tail[1] = data[data_len - 1];
411 wl->tx_tail[2] = 0;
411 break; 412 break;
412 case 1: 413 case 1:
413 tail[0] = data[data_len - 1]; 414 wl->tx_tail[0] = data[data_len - 1];
415 wl->tx_tail[1] = 0;
416 wl->tx_tail[2] = 0;
414 break; 417 break;
415 } 418 }
416 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); 419 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl);
417 ssb_block_write(dev->dev, tail, 4, 420 ssb_block_write(dev->dev, wl->tx_tail, 4,
418 q->mmio_base + B43_PIO8_TXDATA, 421 q->mmio_base + B43_PIO8_TXDATA,
419 sizeof(u32)); 422 sizeof(u32));
420 } 423 }
@@ -446,8 +449,9 @@ static void pio_tx_frame_4byte_queue(struct b43_pio_txpacket *pack,
446static int pio_tx_frame(struct b43_pio_txqueue *q, 449static int pio_tx_frame(struct b43_pio_txqueue *q,
447 struct sk_buff *skb) 450 struct sk_buff *skb)
448{ 451{
452 struct b43_wldev *dev = q->dev;
453 struct b43_wl *wl = dev->wl;
449 struct b43_pio_txpacket *pack; 454 struct b43_pio_txpacket *pack;
450 struct b43_txhdr txhdr;
451 u16 cookie; 455 u16 cookie;
452 int err; 456 int err;
453 unsigned int hdrlen; 457 unsigned int hdrlen;
@@ -458,8 +462,8 @@ static int pio_tx_frame(struct b43_pio_txqueue *q,
458 struct b43_pio_txpacket, list); 462 struct b43_pio_txpacket, list);
459 463
460 cookie = generate_cookie(q, pack); 464 cookie = generate_cookie(q, pack);
461 hdrlen = b43_txhdr_size(q->dev); 465 hdrlen = b43_txhdr_size(dev);
462 err = b43_generate_txhdr(q->dev, (u8 *)&txhdr, skb, 466 err = b43_generate_txhdr(dev, (u8 *)&wl->txhdr, skb,
463 info, cookie); 467 info, cookie);
464 if (err) 468 if (err)
465 return err; 469 return err;
@@ -467,15 +471,15 @@ static int pio_tx_frame(struct b43_pio_txqueue *q,
467 if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { 471 if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
468 /* Tell the firmware about the cookie of the last 472 /* Tell the firmware about the cookie of the last
469 * mcast frame, so it can clear the more-data bit in it. */ 473 * mcast frame, so it can clear the more-data bit in it. */
470 b43_shm_write16(q->dev, B43_SHM_SHARED, 474 b43_shm_write16(dev, B43_SHM_SHARED,
471 B43_SHM_SH_MCASTCOOKIE, cookie); 475 B43_SHM_SH_MCASTCOOKIE, cookie);
472 } 476 }
473 477
474 pack->skb = skb; 478 pack->skb = skb;
475 if (q->rev >= 8) 479 if (q->rev >= 8)
476 pio_tx_frame_4byte_queue(pack, (const u8 *)&txhdr, hdrlen); 480 pio_tx_frame_4byte_queue(pack, (const u8 *)&wl->txhdr, hdrlen);
477 else 481 else
478 pio_tx_frame_2byte_queue(pack, (const u8 *)&txhdr, hdrlen); 482 pio_tx_frame_2byte_queue(pack, (const u8 *)&wl->txhdr, hdrlen);
479 483
480 /* Remove it from the list of available packet slots. 484 /* Remove it from the list of available packet slots.
481 * It will be put back when we receive the status report. */ 485 * It will be put back when we receive the status report. */
@@ -615,14 +619,14 @@ void b43_pio_get_tx_stats(struct b43_wldev *dev,
615static bool pio_rx_frame(struct b43_pio_rxqueue *q) 619static bool pio_rx_frame(struct b43_pio_rxqueue *q)
616{ 620{
617 struct b43_wldev *dev = q->dev; 621 struct b43_wldev *dev = q->dev;
618 struct b43_rxhdr_fw4 rxhdr; 622 struct b43_wl *wl = dev->wl;
619 u16 len; 623 u16 len;
620 u32 macstat; 624 u32 macstat;
621 unsigned int i, padding; 625 unsigned int i, padding;
622 struct sk_buff *skb; 626 struct sk_buff *skb;
623 const char *err_msg = NULL; 627 const char *err_msg = NULL;
624 628
625 memset(&rxhdr, 0, sizeof(rxhdr)); 629 memset(&wl->rxhdr, 0, sizeof(wl->rxhdr));
626 630
627 /* Check if we have data and wait for it to get ready. */ 631 /* Check if we have data and wait for it to get ready. */
628 if (q->rev >= 8) { 632 if (q->rev >= 8) {
@@ -660,16 +664,16 @@ data_ready:
660 664
661 /* Get the preamble (RX header) */ 665 /* Get the preamble (RX header) */
662 if (q->rev >= 8) { 666 if (q->rev >= 8) {
663 ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr), 667 ssb_block_read(dev->dev, &wl->rxhdr, sizeof(wl->rxhdr),
664 q->mmio_base + B43_PIO8_RXDATA, 668 q->mmio_base + B43_PIO8_RXDATA,
665 sizeof(u32)); 669 sizeof(u32));
666 } else { 670 } else {
667 ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr), 671 ssb_block_read(dev->dev, &wl->rxhdr, sizeof(wl->rxhdr),
668 q->mmio_base + B43_PIO_RXDATA, 672 q->mmio_base + B43_PIO_RXDATA,
669 sizeof(u16)); 673 sizeof(u16));
670 } 674 }
671 /* Sanity checks. */ 675 /* Sanity checks. */
672 len = le16_to_cpu(rxhdr.frame_len); 676 len = le16_to_cpu(wl->rxhdr.frame_len);
673 if (unlikely(len > 0x700)) { 677 if (unlikely(len > 0x700)) {
674 err_msg = "len > 0x700"; 678 err_msg = "len > 0x700";
675 goto rx_error; 679 goto rx_error;
@@ -679,7 +683,7 @@ data_ready:
679 goto rx_error; 683 goto rx_error;
680 } 684 }
681 685
682 macstat = le32_to_cpu(rxhdr.mac_status); 686 macstat = le32_to_cpu(wl->rxhdr.mac_status);
683 if (macstat & B43_RX_MAC_FCSERR) { 687 if (macstat & B43_RX_MAC_FCSERR) {
684 if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) { 688 if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) {
685 /* Drop frames with failed FCS. */ 689 /* Drop frames with failed FCS. */
@@ -704,24 +708,22 @@ data_ready:
704 q->mmio_base + B43_PIO8_RXDATA, 708 q->mmio_base + B43_PIO8_RXDATA,
705 sizeof(u32)); 709 sizeof(u32));
706 if (len & 3) { 710 if (len & 3) {
707 u8 tail[4] = { 0, };
708
709 /* Read the last few bytes. */ 711 /* Read the last few bytes. */
710 ssb_block_read(dev->dev, tail, 4, 712 ssb_block_read(dev->dev, wl->rx_tail, 4,
711 q->mmio_base + B43_PIO8_RXDATA, 713 q->mmio_base + B43_PIO8_RXDATA,
712 sizeof(u32)); 714 sizeof(u32));
713 switch (len & 3) { 715 switch (len & 3) {
714 case 3: 716 case 3:
715 skb->data[len + padding - 3] = tail[0]; 717 skb->data[len + padding - 3] = wl->rx_tail[0];
716 skb->data[len + padding - 2] = tail[1]; 718 skb->data[len + padding - 2] = wl->rx_tail[1];
717 skb->data[len + padding - 1] = tail[2]; 719 skb->data[len + padding - 1] = wl->rx_tail[2];
718 break; 720 break;
719 case 2: 721 case 2:
720 skb->data[len + padding - 2] = tail[0]; 722 skb->data[len + padding - 2] = wl->rx_tail[0];
721 skb->data[len + padding - 1] = tail[1]; 723 skb->data[len + padding - 1] = wl->rx_tail[1];
722 break; 724 break;
723 case 1: 725 case 1:
724 skb->data[len + padding - 1] = tail[0]; 726 skb->data[len + padding - 1] = wl->rx_tail[0];
725 break; 727 break;
726 } 728 }
727 } 729 }
@@ -730,17 +732,15 @@ data_ready:
730 q->mmio_base + B43_PIO_RXDATA, 732 q->mmio_base + B43_PIO_RXDATA,
731 sizeof(u16)); 733 sizeof(u16));
732 if (len & 1) { 734 if (len & 1) {
733 u8 tail[2] = { 0, };
734
735 /* Read the last byte. */ 735 /* Read the last byte. */
736 ssb_block_read(dev->dev, tail, 2, 736 ssb_block_read(dev->dev, wl->rx_tail, 2,
737 q->mmio_base + B43_PIO_RXDATA, 737 q->mmio_base + B43_PIO_RXDATA,
738 sizeof(u16)); 738 sizeof(u16));
739 skb->data[len + padding - 1] = tail[0]; 739 skb->data[len + padding - 1] = wl->rx_tail[0];
740 } 740 }
741 } 741 }
742 742
743 b43_rx(q->dev, skb, &rxhdr); 743 b43_rx(q->dev, skb, &wl->rxhdr);
744 744
745 return 1; 745 return 1;
746 746
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 7a3218c5ba7d..ffdce6f3c909 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -33,7 +33,8 @@ bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
33 & B43_MMIO_RADIO_HWENABLED_HI_MASK)) 33 & B43_MMIO_RADIO_HWENABLED_HI_MASK))
34 return 1; 34 return 1;
35 } else { 35 } else {
36 if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO) 36 if (b43_status(dev) >= B43_STAT_STARTED &&
37 b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
37 & B43_MMIO_RADIO_HWENABLED_LO_MASK) 38 & B43_MMIO_RADIO_HWENABLED_LO_MASK)
38 return 1; 39 return 1;
39 } 40 }
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index ac9f600995e4..f4e9695ec186 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -27,7 +27,7 @@
27 27
28*/ 28*/
29 29
30#include "xmit.h" 30#include "b43.h"
31#include "phy_common.h" 31#include "phy_common.h"
32#include "dma.h" 32#include "dma.h"
33#include "pio.h" 33#include "pio.h"
@@ -690,7 +690,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
690 } 690 }
691 691
692 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); 692 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
693
694 local_bh_disable();
693 ieee80211_rx(dev->wl->hw, skb); 695 ieee80211_rx(dev->wl->hw, skb);
696 local_bh_enable();
694 697
695#if B43_DEBUG 698#if B43_DEBUG
696 dev->rx_count++; 699 dev->rx_count++;
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 240cff1e6979..a741d37fd96f 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -6325,8 +6325,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6325 6325
6326 fail: 6326 fail:
6327 if (dev) { 6327 if (dev) {
6328 if (registered) 6328 if (registered) {
6329 unregister_ieee80211(priv->ieee);
6329 unregister_netdev(dev); 6330 unregister_netdev(dev);
6331 }
6330 6332
6331 ipw2100_hw_stop_adapter(priv); 6333 ipw2100_hw_stop_adapter(priv);
6332 6334
@@ -6383,6 +6385,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
6383 /* Unregister the device first - this results in close() 6385 /* Unregister the device first - this results in close()
6384 * being called if the device is open. If we free storage 6386 * being called if the device is open. If we free storage
6385 * first, then close() will crash. */ 6387 * first, then close() will crash. */
6388 unregister_ieee80211(priv->ieee);
6386 unregister_netdev(dev); 6389 unregister_netdev(dev);
6387 6390
6388 /* ipw2100_down will ensure that there is no more pending work 6391 /* ipw2100_down will ensure that there is no more pending work
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 827824d45de9..9b0f2c0646e0 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -11822,6 +11822,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11822 if (err) { 11822 if (err) {
11823 IPW_ERROR("Failed to register promiscuous network " 11823 IPW_ERROR("Failed to register promiscuous network "
11824 "device (error %d).\n", err); 11824 "device (error %d).\n", err);
11825 unregister_ieee80211(priv->ieee);
11825 unregister_netdev(priv->net_dev); 11826 unregister_netdev(priv->net_dev);
11826 goto out_remove_sysfs; 11827 goto out_remove_sysfs;
11827 } 11828 }
@@ -11872,6 +11873,7 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11872 11873
11873 mutex_unlock(&priv->mutex); 11874 mutex_unlock(&priv->mutex);
11874 11875
11876 unregister_ieee80211(priv->ieee);
11875 unregister_netdev(priv->net_dev); 11877 unregister_netdev(priv->net_dev);
11876 11878
11877 if (priv->rxq) { 11879 if (priv->rxq) {
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h
index bf45391172f3..f42ade6c2d3e 100644
--- a/drivers/net/wireless/ipw2x00/libipw.h
+++ b/drivers/net/wireless/ipw2x00/libipw.h
@@ -1020,6 +1020,7 @@ static inline int libipw_is_cck_rate(u8 rate)
1020/* ieee80211.c */ 1020/* ieee80211.c */
1021extern void free_ieee80211(struct net_device *dev, int monitor); 1021extern void free_ieee80211(struct net_device *dev, int monitor);
1022extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor); 1022extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor);
1023extern void unregister_ieee80211(struct libipw_device *ieee);
1023extern int libipw_change_mtu(struct net_device *dev, int new_mtu); 1024extern int libipw_change_mtu(struct net_device *dev, int new_mtu);
1024 1025
1025extern void libipw_networks_age(struct libipw_device *ieee, 1026extern void libipw_networks_age(struct libipw_device *ieee,
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c
index a0e9f6aed7da..be5b809ec97a 100644
--- a/drivers/net/wireless/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/ipw2x00/libipw_module.c
@@ -235,16 +235,19 @@ void free_ieee80211(struct net_device *dev, int monitor)
235 libipw_networks_free(ieee); 235 libipw_networks_free(ieee);
236 236
237 /* free cfg80211 resources */ 237 /* free cfg80211 resources */
238 if (!monitor) { 238 if (!monitor)
239 wiphy_unregister(ieee->wdev.wiphy);
240 kfree(ieee->a_band.channels);
241 kfree(ieee->bg_band.channels);
242 wiphy_free(ieee->wdev.wiphy); 239 wiphy_free(ieee->wdev.wiphy);
243 }
244 240
245 free_netdev(dev); 241 free_netdev(dev);
246} 242}
247 243
244void unregister_ieee80211(struct libipw_device *ieee)
245{
246 wiphy_unregister(ieee->wdev.wiphy);
247 kfree(ieee->a_band.channels);
248 kfree(ieee->bg_band.channels);
249}
250
248#ifdef CONFIG_LIBIPW_DEBUG 251#ifdef CONFIG_LIBIPW_DEBUG
249 252
250static int debug = 0; 253static int debug = 0;
@@ -330,3 +333,4 @@ module_init(libipw_init);
330 333
331EXPORT_SYMBOL(alloc_ieee80211); 334EXPORT_SYMBOL(alloc_ieee80211);
332EXPORT_SYMBOL(free_ieee80211); 335EXPORT_SYMBOL(free_ieee80211);
336EXPORT_SYMBOL(unregister_ieee80211);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index a16bd4147eac..cbb0585083a9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -702,7 +702,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
702 u8 sta_id = iwl_find_station(priv, hdr->addr1); 702 u8 sta_id = iwl_find_station(priv, hdr->addr1);
703 703
704 if (sta_id == IWL_INVALID_STATION) { 704 if (sta_id == IWL_INVALID_STATION) {
705 IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n", 705 IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n",
706 hdr->addr1); 706 hdr->addr1);
707 sta_id = iwl_add_station(priv, hdr->addr1, false, 707 sta_id = iwl_add_station(priv, hdr->addr1, false,
708 CMD_ASYNC, NULL); 708 CMD_ASYNC, NULL);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 68136172b823..f059b49dc691 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -611,7 +611,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
611 if (rx_status.band == IEEE80211_BAND_5GHZ) 611 if (rx_status.band == IEEE80211_BAND_5GHZ)
612 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; 612 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE;
613 613
614 rx_status.antenna = le16_to_cpu(rx_hdr->phy_flags & 614 rx_status.antenna = (le16_to_cpu(rx_hdr->phy_flags) &
615 RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; 615 RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
616 616
617 /* set the preamble flag if appropriate */ 617 /* set the preamble flag if appropriate */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index d6bc0e051043..6e6f516ba404 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -318,7 +318,7 @@ static void iwl5000_gain_computation(struct iwl_priv *priv,
318 (s32)average_noise[i])) / 1500; 318 (s32)average_noise[i])) / 1500;
319 /* bound gain by 2 bits value max, 3rd bit is sign */ 319 /* bound gain by 2 bits value max, 3rd bit is sign */
320 data->delta_gain_code[i] = 320 data->delta_gain_code[i] =
321 min(abs(delta_g), CHAIN_NOISE_MAX_DELTA_GAIN_CODE); 321 min(abs(delta_g), (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE);
322 322
323 if (delta_g < 0) 323 if (delta_g < 0)
324 /* set negative sign */ 324 /* set negative sign */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 313d3e5ee84b..eaafae091f5b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3106,8 +3106,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3106 out_pci_disable_device: 3106 out_pci_disable_device:
3107 pci_disable_device(pdev); 3107 pci_disable_device(pdev);
3108 out_ieee80211_free_hw: 3108 out_ieee80211_free_hw:
3109 ieee80211_free_hw(priv->hw);
3110 iwl_free_traffic_mem(priv); 3109 iwl_free_traffic_mem(priv);
3110 ieee80211_free_hw(priv->hw);
3111 out: 3111 out:
3112 return err; 3112 return err;
3113} 3113}
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 2c5c88fc38f5..4afaf773aeac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -1154,7 +1154,7 @@ struct iwl_wep_cmd {
1154#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) 1154#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
1155#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) 1155#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
1156#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) 1156#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
1157#define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0) 1157#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
1158#define RX_RES_PHY_FLAGS_ANTENNA_POS 4 1158#define RX_RES_PHY_FLAGS_ANTENNA_POS 4
1159 1159
1160#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) 1160#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 3d2b93a61e62..e14c9952a935 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -410,7 +410,6 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
410 u16 *validblockaddr) 410 u16 *validblockaddr)
411{ 411{
412 u16 next_link_addr = 0, link_value = 0, valid_addr; 412 u16 next_link_addr = 0, link_value = 0, valid_addr;
413 int ret = 0;
414 int usedblocks = 0; 413 int usedblocks = 0;
415 414
416 /* set addressing mode to absolute to traverse the link list */ 415 /* set addressing mode to absolute to traverse the link list */
@@ -430,29 +429,29 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
430 * check for more block on the link list 429 * check for more block on the link list
431 */ 430 */
432 valid_addr = next_link_addr; 431 valid_addr = next_link_addr;
433 next_link_addr = link_value; 432 next_link_addr = link_value * sizeof(u16);
434 IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", 433 IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
435 usedblocks, next_link_addr); 434 usedblocks, next_link_addr);
436 if (iwl_read_otp_word(priv, next_link_addr, &link_value)) 435 if (iwl_read_otp_word(priv, next_link_addr, &link_value))
437 return -EINVAL; 436 return -EINVAL;
438 if (!link_value) { 437 if (!link_value) {
439 /* 438 /*
440 * reach the end of link list, 439 * reach the end of link list, return success and
441 * set address point to the starting address 440 * set address point to the starting address
442 * of the image 441 * of the image
443 */ 442 */
444 goto done; 443 *validblockaddr = valid_addr;
444 /* skip first 2 bytes (link list pointer) */
445 *validblockaddr += 2;
446 return 0;
445 } 447 }
446 /* more in the link list, continue */ 448 /* more in the link list, continue */
447 usedblocks++; 449 usedblocks++;
448 } while (usedblocks < priv->cfg->max_ll_items); 450 } while (usedblocks <= priv->cfg->max_ll_items);
449 /* OTP full, use last block */ 451
450 IWL_DEBUG_INFO(priv, "OTP is full, use last block\n"); 452 /* OTP has no valid blocks */
451done: 453 IWL_DEBUG_INFO(priv, "OTP has no valid blocks\n");
452 *validblockaddr = valid_addr; 454 return -EINVAL;
453 /* skip first 2 bytes (link list pointer) */
454 *validblockaddr += 2;
455 return ret;
456} 455}
457 456
458/** 457/**
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 6b68db7b1b81..80b9e45d9b9c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -220,35 +220,35 @@ struct iwl_eeprom_enhanced_txpwr {
220 * Section 10: 2.4 GHz 40MHz channels: 132, 44 (_above_) 220 * Section 10: 2.4 GHz 40MHz channels: 132, 44 (_above_)
221 */ 221 */
222/* 2.4 GHz band: CCK */ 222/* 2.4 GHz band: CCK */
223#define EEPROM_LB_CCK_20_COMMON ((0xAA)\ 223#define EEPROM_LB_CCK_20_COMMON ((0xA8)\
224 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 8 bytes */ 224 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 8 bytes */
225/* 2.4 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */ 225/* 2.4 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */
226#define EEPROM_LB_OFDM_COMMON ((0xB2)\ 226#define EEPROM_LB_OFDM_COMMON ((0xB0)\
227 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ 227 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */
228/* 5.2 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */ 228/* 5.2 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */
229#define EEPROM_HB_OFDM_COMMON ((0xCA)\ 229#define EEPROM_HB_OFDM_COMMON ((0xC8)\
230 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ 230 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */
231/* 2.4GHz band channels: 231/* 2.4GHz band channels:
232 * 1Legacy, 1HT, 2Legacy, 2HT, 10Legacy, 10HT, 11Legacy, 11HT */ 232 * 1Legacy, 1HT, 2Legacy, 2HT, 10Legacy, 10HT, 11Legacy, 11HT */
233#define EEPROM_LB_OFDM_20_BAND ((0xE2)\ 233#define EEPROM_LB_OFDM_20_BAND ((0xE0)\
234 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 64 bytes */ 234 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 64 bytes */
235/* 2.4 GHz band HT40 channels: (1,+1) (2,+1) (6,+1) (7,+1) (9,+1) */ 235/* 2.4 GHz band HT40 channels: (1,+1) (2,+1) (6,+1) (7,+1) (9,+1) */
236#define EEPROM_LB_OFDM_HT40_BAND ((0x122)\ 236#define EEPROM_LB_OFDM_HT40_BAND ((0x120)\
237 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 40 bytes */ 237 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 40 bytes */
238/* 5.2GHz band channels: 36Legacy, 36HT, 64Legacy, 64HT, 100Legacy, 100HT */ 238/* 5.2GHz band channels: 36Legacy, 36HT, 64Legacy, 64HT, 100Legacy, 100HT */
239#define EEPROM_HB_OFDM_20_BAND ((0x14A)\ 239#define EEPROM_HB_OFDM_20_BAND ((0x148)\
240 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 48 bytes */ 240 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 48 bytes */
241/* 5.2 GHz band HT40 channels: (36,+1) (60,+1) (100,+1) */ 241/* 5.2 GHz band HT40 channels: (36,+1) (60,+1) (100,+1) */
242#define EEPROM_HB_OFDM_HT40_BAND ((0x17A)\ 242#define EEPROM_HB_OFDM_HT40_BAND ((0x178)\
243 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ 243 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */
244/* 2.4 GHz band, channnel 13: Legacy, HT */ 244/* 2.4 GHz band, channnel 13: Legacy, HT */
245#define EEPROM_LB_OFDM_20_CHANNEL_13 ((0x192)\ 245#define EEPROM_LB_OFDM_20_CHANNEL_13 ((0x190)\
246 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ 246 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */
247/* 5.2 GHz band, channnel 140: Legacy, HT */ 247/* 5.2 GHz band, channnel 140: Legacy, HT */
248#define EEPROM_HB_OFDM_20_CHANNEL_140 ((0x1A2)\ 248#define EEPROM_HB_OFDM_20_CHANNEL_140 ((0x1A0)\
249 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ 249 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */
250/* 5.2 GHz band, HT40 channnels (132,+1) (44,+1) */ 250/* 5.2 GHz band, HT40 channnels (132,+1) (44,+1) */
251#define EEPROM_HB_OFDM_HT40_BAND_1 ((0x1B2)\ 251#define EEPROM_HB_OFDM_HT40_BAND_1 ((0x1B0)\
252 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ 252 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */
253 253
254 254
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 8e1bb53c0aa3..493626bcd3ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -1044,7 +1044,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1044 * as a bitmask. 1044 * as a bitmask.
1045 */ 1045 */
1046 rx_status.antenna = 1046 rx_status.antenna =
1047 le16_to_cpu(phy_res->phy_flags & RX_RES_PHY_FLAGS_ANTENNA_MSK) 1047 (le16_to_cpu(phy_res->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK)
1048 >> RX_RES_PHY_FLAGS_ANTENNA_POS; 1048 >> RX_RES_PHY_FLAGS_ANTENNA_POS;
1049 1049
1050 /* set the preamble flag if appropriate */ 1050 /* set the preamble flag if appropriate */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index aa49230422f3..d00a80334095 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4097,8 +4097,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4097 pci_set_drvdata(pdev, NULL); 4097 pci_set_drvdata(pdev, NULL);
4098 pci_disable_device(pdev); 4098 pci_disable_device(pdev);
4099 out_ieee80211_free_hw: 4099 out_ieee80211_free_hw:
4100 ieee80211_free_hw(priv->hw);
4101 iwl_free_traffic_mem(priv); 4100 iwl_free_traffic_mem(priv);
4101 ieee80211_free_hw(priv->hw);
4102 out: 4102 out:
4103 return err; 4103 return err;
4104} 4104}
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index c42d3faa2660..23f684337fdd 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -3,6 +3,7 @@
3 * responses as well as events generated by firmware. 3 * responses as well as events generated by firmware.
4 */ 4 */
5#include <linux/delay.h> 5#include <linux/delay.h>
6#include <linux/sched.h>
6#include <linux/if_arp.h> 7#include <linux/if_arp.h>
7#include <linux/netdevice.h> 8#include <linux/netdevice.h>
8#include <asm/unaligned.h> 9#include <asm/unaligned.h>
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index cb8be8d7abc1..5b3672c4d0cc 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -134,7 +134,7 @@ static void spu_transaction_finish(struct if_spi_card *card)
134static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len) 134static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len)
135{ 135{
136 int err = 0; 136 int err = 0;
137 u16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK); 137 __le16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK);
138 struct spi_message m; 138 struct spi_message m;
139 struct spi_transfer reg_trans; 139 struct spi_transfer reg_trans;
140 struct spi_transfer data_trans; 140 struct spi_transfer data_trans;
@@ -166,7 +166,7 @@ static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len)
166 166
167static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val) 167static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val)
168{ 168{
169 u16 buff; 169 __le16 buff;
170 170
171 buff = cpu_to_le16(val); 171 buff = cpu_to_le16(val);
172 return spu_write(card, reg, (u8 *)&buff, sizeof(u16)); 172 return spu_write(card, reg, (u8 *)&buff, sizeof(u16));
@@ -188,7 +188,7 @@ static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len)
188{ 188{
189 unsigned int delay; 189 unsigned int delay;
190 int err = 0; 190 int err = 0;
191 u16 reg_out = cpu_to_le16(reg | IF_SPI_READ_OPERATION_MASK); 191 __le16 reg_out = cpu_to_le16(reg | IF_SPI_READ_OPERATION_MASK);
192 struct spi_message m; 192 struct spi_message m;
193 struct spi_transfer reg_trans; 193 struct spi_transfer reg_trans;
194 struct spi_transfer dummy_trans; 194 struct spi_transfer dummy_trans;
@@ -235,7 +235,7 @@ static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len)
235/* Read 16 bits from an SPI register */ 235/* Read 16 bits from an SPI register */
236static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val) 236static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val)
237{ 237{
238 u16 buf; 238 __le16 buf;
239 int ret; 239 int ret;
240 240
241 ret = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); 241 ret = spu_read(card, reg, (u8 *)&buf, sizeof(buf));
@@ -248,7 +248,7 @@ static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val)
248 * The low 16 bits are read first. */ 248 * The low 16 bits are read first. */
249static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val) 249static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val)
250{ 250{
251 u32 buf; 251 __le32 buf;
252 int err; 252 int err;
253 253
254 err = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); 254 err = spu_read(card, reg, (u8 *)&buf, sizeof(buf));
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 92bc8c5f1ca2..3fac4efa5ac8 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -508,7 +508,7 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
508 /* Fill the receive configuration URB and initialise the Rx call back */ 508 /* Fill the receive configuration URB and initialise the Rx call back */
509 usb_fill_bulk_urb(cardp->rx_urb, cardp->udev, 509 usb_fill_bulk_urb(cardp->rx_urb, cardp->udev,
510 usb_rcvbulkpipe(cardp->udev, cardp->ep_in), 510 usb_rcvbulkpipe(cardp->udev, cardp->ep_in),
511 (void *) (skb->tail + (size_t) IPFIELD_ALIGN_OFFSET), 511 skb->data + IPFIELD_ALIGN_OFFSET,
512 MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, 512 MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn,
513 cardp); 513 cardp);
514 514
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 88cd58eb3b9f..1c88c2ea59aa 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -2879,7 +2879,7 @@ static int write_essid(struct file *file, const char __user *buffer,
2879 unsigned long count, void *data) 2879 unsigned long count, void *data)
2880{ 2880{
2881 static char proc_essid[33]; 2881 static char proc_essid[33];
2882 int len = count; 2882 unsigned int len = count;
2883 2883
2884 if (len > 32) 2884 if (len > 32)
2885 len = 32; 2885 len = 32;
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index a084077a1c61..9fe770f7d7bb 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1994,7 +1994,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1994 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); 1994 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
1995 rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, 1995 rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
1996 test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? 1996 test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
1997 (skbdesc->entry->entry_idx + 1) : 0xff); 1997 txdesc->key_idx : 0xff);
1998 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, 1998 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT,
1999 skb->len - txdesc->l2pad); 1999 skb->len - txdesc->l2pad);
2000 rt2x00_set_field32(&word, TXWI_W1_PACKETID, 2000 rt2x00_set_field32(&word, TXWI_W1_PACKETID,
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index b8f5ee33445e..14e7bb210075 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2389,10 +2389,13 @@ static struct usb_device_id rt73usb_device_table[] = {
2389 { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, 2389 { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) },
2390 { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) }, 2390 { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) },
2391 /* MSI */ 2391 /* MSI */
2392 { USB_DEVICE(0x0db0, 0x4600), USB_DEVICE_DATA(&rt73usb_ops) },
2392 { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, 2393 { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) },
2393 { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, 2394 { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) },
2394 { USB_DEVICE(0x0db0, 0xa861), USB_DEVICE_DATA(&rt73usb_ops) }, 2395 { USB_DEVICE(0x0db0, 0xa861), USB_DEVICE_DATA(&rt73usb_ops) },
2395 { USB_DEVICE(0x0db0, 0xa874), USB_DEVICE_DATA(&rt73usb_ops) }, 2396 { USB_DEVICE(0x0db0, 0xa874), USB_DEVICE_DATA(&rt73usb_ops) },
2397 /* Ovislink */
2398 { USB_DEVICE(0x1b75, 0x7318), USB_DEVICE_DATA(&rt73usb_ops) },
2396 /* Ralink */ 2399 /* Ralink */
2397 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, 2400 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) },
2398 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, 2401 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) },
@@ -2420,6 +2423,8 @@ static struct usb_device_id rt73usb_device_table[] = {
2420 /* Planex */ 2423 /* Planex */
2421 { USB_DEVICE(0x2019, 0xab01), USB_DEVICE_DATA(&rt73usb_ops) }, 2424 { USB_DEVICE(0x2019, 0xab01), USB_DEVICE_DATA(&rt73usb_ops) },
2422 { USB_DEVICE(0x2019, 0xab50), USB_DEVICE_DATA(&rt73usb_ops) }, 2425 { USB_DEVICE(0x2019, 0xab50), USB_DEVICE_DATA(&rt73usb_ops) },
2426 /* WideTell */
2427 { USB_DEVICE(0x7167, 0x3840), USB_DEVICE_DATA(&rt73usb_ops) },
2423 /* Zcom */ 2428 /* Zcom */
2424 { USB_DEVICE(0x0cde, 0x001c), USB_DEVICE_DATA(&rt73usb_ops) }, 2429 { USB_DEVICE(0x0cde, 0x001c), USB_DEVICE_DATA(&rt73usb_ops) },
2425 /* ZyXEL */ 2430 /* ZyXEL */
diff --git a/drivers/net/znet.c b/drivers/net/znet.c
index a0384b6f09b6..b42347333750 100644
--- a/drivers/net/znet.c
+++ b/drivers/net/znet.c
@@ -169,7 +169,6 @@ static void znet_tx_timeout (struct net_device *dev);
169static int znet_request_resources (struct net_device *dev) 169static int znet_request_resources (struct net_device *dev)
170{ 170{
171 struct znet_private *znet = netdev_priv(dev); 171 struct znet_private *znet = netdev_priv(dev);
172 unsigned long flags;
173 172
174 if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev)) 173 if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev))
175 goto failed; 174 goto failed;
@@ -187,13 +186,9 @@ static int znet_request_resources (struct net_device *dev)
187 free_sia: 186 free_sia:
188 release_region (znet->sia_base, znet->sia_size); 187 release_region (znet->sia_base, znet->sia_size);
189 free_tx_dma: 188 free_tx_dma:
190 flags = claim_dma_lock();
191 free_dma (znet->tx_dma); 189 free_dma (znet->tx_dma);
192 release_dma_lock (flags);
193 free_rx_dma: 190 free_rx_dma:
194 flags = claim_dma_lock();
195 free_dma (znet->rx_dma); 191 free_dma (znet->rx_dma);
196 release_dma_lock (flags);
197 free_irq: 192 free_irq:
198 free_irq (dev->irq, dev); 193 free_irq (dev->irq, dev);
199 failed: 194 failed:
@@ -203,14 +198,11 @@ static int znet_request_resources (struct net_device *dev)
203static void znet_release_resources (struct net_device *dev) 198static void znet_release_resources (struct net_device *dev)
204{ 199{
205 struct znet_private *znet = netdev_priv(dev); 200 struct znet_private *znet = netdev_priv(dev);
206 unsigned long flags;
207 201
208 release_region (znet->sia_base, znet->sia_size); 202 release_region (znet->sia_base, znet->sia_size);
209 release_region (dev->base_addr, znet->io_size); 203 release_region (dev->base_addr, znet->io_size);
210 flags = claim_dma_lock();
211 free_dma (znet->tx_dma); 204 free_dma (znet->tx_dma);
212 free_dma (znet->rx_dma); 205 free_dma (znet->rx_dma);
213 release_dma_lock (flags);
214 free_irq (dev->irq, dev); 206 free_irq (dev->irq, dev);
215} 207}
216 208
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index bacaa536fd51..4b22ba568b19 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -97,6 +97,12 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
97} 97}
98EXPORT_SYMBOL(of_mdiobus_register); 98EXPORT_SYMBOL(of_mdiobus_register);
99 99
100/* Helper function for of_phy_find_device */
101static int of_phy_match(struct device *dev, void *phy_np)
102{
103 return dev_archdata_get_node(&dev->archdata) == phy_np;
104}
105
100/** 106/**
101 * of_phy_find_device - Give a PHY node, find the phy_device 107 * of_phy_find_device - Give a PHY node, find the phy_device
102 * @phy_np: Pointer to the phy's device tree node 108 * @phy_np: Pointer to the phy's device tree node
@@ -106,15 +112,10 @@ EXPORT_SYMBOL(of_mdiobus_register);
106struct phy_device *of_phy_find_device(struct device_node *phy_np) 112struct phy_device *of_phy_find_device(struct device_node *phy_np)
107{ 113{
108 struct device *d; 114 struct device *d;
109 int match(struct device *dev, void *phy_np)
110 {
111 return dev_archdata_get_node(&dev->archdata) == phy_np;
112 }
113
114 if (!phy_np) 115 if (!phy_np)
115 return NULL; 116 return NULL;
116 117
117 d = bus_find_device(&mdio_bus_type, NULL, phy_np, match); 118 d = bus_find_device(&mdio_bus_type, NULL, phy_np, of_phy_match);
118 return d ? to_phy_device(d) : NULL; 119 return d ? to_phy_device(d) : NULL;
119} 120}
120EXPORT_SYMBOL(of_phy_find_device); 121EXPORT_SYMBOL(of_phy_find_device);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index a790b1771f9f..245d2cdb4765 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1009,7 +1009,7 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX,
1009 1009
1010static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev) 1010static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev)
1011{ 1011{
1012 /* set SBX00 SATA in IDE mode to AHCI mode */ 1012 /* set SBX00/Hudson-2 SATA in IDE mode to AHCI mode */
1013 u8 tmp; 1013 u8 tmp;
1014 1014
1015 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp); 1015 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp);
@@ -1028,8 +1028,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk
1028DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode); 1028DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode);
1029DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); 1029DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
1030DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); 1030DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
1031DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SB900_SATA_IDE, quirk_amd_ide_mode); 1031DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
1032DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SB900_SATA_IDE, quirk_amd_ide_mode); 1032DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
1033 1033
1034/* 1034/*
1035 * Serverworks CSB5 IDE does not fully support native mode 1035 * Serverworks CSB5 IDE does not fully support native mode
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 0959430534b2..cb1a027eb552 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -299,17 +299,8 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon
299 r = bus->resource[i]; 299 r = bus->resource[i];
300 if (r == &ioport_resource || r == &iomem_resource) 300 if (r == &ioport_resource || r == &iomem_resource)
301 continue; 301 continue;
302 if (r && (r->flags & type_mask) == type) { 302 if (r && (r->flags & type_mask) == type && !r->parent)
303 if (!r->parent) 303 return r;
304 return r;
305 /*
306 * if there is no child under that, we should release
307 * and use it. don't need to reset it, pbus_size_* will
308 * set it again
309 */
310 if (!r->child && !release_resource(r))
311 return r;
312 }
313 } 304 }
314 return NULL; 305 return NULL;
315} 306}
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 4a110b7b2673..6c4a4fc83630 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1463,7 +1463,9 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t
1463 return -ENOMEM; 1463 return -ENOMEM;
1464 } 1464 }
1465 tuple.DesiredTuple = code; 1465 tuple.DesiredTuple = code;
1466 tuple.Attributes = TUPLE_RETURN_COMMON; 1466 tuple.Attributes = 0;
1467 if (function == BIND_FN_ALL)
1468 tuple.Attributes = TUPLE_RETURN_COMMON;
1467 ret = pccard_get_first_tuple(s, function, &tuple); 1469 ret = pccard_get_first_tuple(s, function, &tuple);
1468 if (ret != 0) 1470 if (ret != 0)
1469 goto done; 1471 goto done;
@@ -1490,7 +1492,7 @@ EXPORT_SYMBOL(pccard_read_tuple);
1490 1492
1491======================================================================*/ 1493======================================================================*/
1492 1494
1493int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info) 1495int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
1494{ 1496{
1495 tuple_t *tuple; 1497 tuple_t *tuple;
1496 cisparse_t *p; 1498 cisparse_t *p;
@@ -1515,30 +1517,30 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
1515 count = reserved = 0; 1517 count = reserved = 0;
1516 tuple->DesiredTuple = RETURN_FIRST_TUPLE; 1518 tuple->DesiredTuple = RETURN_FIRST_TUPLE;
1517 tuple->Attributes = TUPLE_RETURN_COMMON; 1519 tuple->Attributes = TUPLE_RETURN_COMMON;
1518 ret = pccard_get_first_tuple(s, function, tuple); 1520 ret = pccard_get_first_tuple(s, BIND_FN_ALL, tuple);
1519 if (ret != 0) 1521 if (ret != 0)
1520 goto done; 1522 goto done;
1521 1523
1522 /* First tuple should be DEVICE; we should really have either that 1524 /* First tuple should be DEVICE; we should really have either that
1523 or a CFTABLE_ENTRY of some sort */ 1525 or a CFTABLE_ENTRY of some sort */
1524 if ((tuple->TupleCode == CISTPL_DEVICE) || 1526 if ((tuple->TupleCode == CISTPL_DEVICE) ||
1525 (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == 0) || 1527 (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p) == 0) ||
1526 (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) 1528 (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p) == 0))
1527 dev_ok++; 1529 dev_ok++;
1528 1530
1529 /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 1531 /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2
1530 tuple, for card identification. Certain old D-Link and Linksys 1532 tuple, for card identification. Certain old D-Link and Linksys
1531 cards have only a broken VERS_2 tuple; hence the bogus test. */ 1533 cards have only a broken VERS_2 tuple; hence the bogus test. */
1532 if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) || 1534 if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) ||
1533 (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || 1535 (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) ||
1534 (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != -ENOSPC)) 1536 (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC))
1535 ident_ok++; 1537 ident_ok++;
1536 1538
1537 if (!dev_ok && !ident_ok) 1539 if (!dev_ok && !ident_ok)
1538 goto done; 1540 goto done;
1539 1541
1540 for (count = 1; count < MAX_TUPLES; count++) { 1542 for (count = 1; count < MAX_TUPLES; count++) {
1541 ret = pccard_get_next_tuple(s, function, tuple); 1543 ret = pccard_get_next_tuple(s, BIND_FN_ALL, tuple);
1542 if (ret != 0) 1544 if (ret != 0)
1543 break; 1545 break;
1544 if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || 1546 if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) ||
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 934d4bee39a0..698d75cda084 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -98,10 +98,13 @@ EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
98 * These functions check for the appropriate struct pcmcia_soket arrays, 98 * These functions check for the appropriate struct pcmcia_soket arrays,
99 * and pass them to the low-level functions pcmcia_{suspend,resume}_socket 99 * and pass them to the low-level functions pcmcia_{suspend,resume}_socket
100 */ 100 */
101static int socket_early_resume(struct pcmcia_socket *skt);
102static int socket_late_resume(struct pcmcia_socket *skt);
101static int socket_resume(struct pcmcia_socket *skt); 103static int socket_resume(struct pcmcia_socket *skt);
102static int socket_suspend(struct pcmcia_socket *skt); 104static int socket_suspend(struct pcmcia_socket *skt);
103 105
104int pcmcia_socket_dev_suspend(struct device *dev) 106static void pcmcia_socket_dev_run(struct device *dev,
107 int (*cb)(struct pcmcia_socket *))
105{ 108{
106 struct pcmcia_socket *socket; 109 struct pcmcia_socket *socket;
107 110
@@ -110,29 +113,34 @@ int pcmcia_socket_dev_suspend(struct device *dev)
110 if (socket->dev.parent != dev) 113 if (socket->dev.parent != dev)
111 continue; 114 continue;
112 mutex_lock(&socket->skt_mutex); 115 mutex_lock(&socket->skt_mutex);
113 socket_suspend(socket); 116 cb(socket);
114 mutex_unlock(&socket->skt_mutex); 117 mutex_unlock(&socket->skt_mutex);
115 } 118 }
116 up_read(&pcmcia_socket_list_rwsem); 119 up_read(&pcmcia_socket_list_rwsem);
120}
117 121
122int pcmcia_socket_dev_suspend(struct device *dev)
123{
124 pcmcia_socket_dev_run(dev, socket_suspend);
118 return 0; 125 return 0;
119} 126}
120EXPORT_SYMBOL(pcmcia_socket_dev_suspend); 127EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
121 128
122int pcmcia_socket_dev_resume(struct device *dev) 129void pcmcia_socket_dev_early_resume(struct device *dev)
123{ 130{
124 struct pcmcia_socket *socket; 131 pcmcia_socket_dev_run(dev, socket_early_resume);
132}
133EXPORT_SYMBOL(pcmcia_socket_dev_early_resume);
125 134
126 down_read(&pcmcia_socket_list_rwsem); 135void pcmcia_socket_dev_late_resume(struct device *dev)
127 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { 136{
128 if (socket->dev.parent != dev) 137 pcmcia_socket_dev_run(dev, socket_late_resume);
129 continue; 138}
130 mutex_lock(&socket->skt_mutex); 139EXPORT_SYMBOL(pcmcia_socket_dev_late_resume);
131 socket_resume(socket);
132 mutex_unlock(&socket->skt_mutex);
133 }
134 up_read(&pcmcia_socket_list_rwsem);
135 140
141int pcmcia_socket_dev_resume(struct device *dev)
142{
143 pcmcia_socket_dev_run(dev, socket_resume);
136 return 0; 144 return 0;
137} 145}
138EXPORT_SYMBOL(pcmcia_socket_dev_resume); 146EXPORT_SYMBOL(pcmcia_socket_dev_resume);
@@ -546,29 +554,24 @@ static int socket_suspend(struct pcmcia_socket *skt)
546 return 0; 554 return 0;
547} 555}
548 556
549/* 557static int socket_early_resume(struct pcmcia_socket *skt)
550 * Resume a socket. If a card is present, verify its CIS against
551 * our cached copy. If they are different, the card has been
552 * replaced, and we need to tell the drivers.
553 */
554static int socket_resume(struct pcmcia_socket *skt)
555{ 558{
556 int ret;
557
558 if (!(skt->state & SOCKET_SUSPEND))
559 return -EBUSY;
560
561 skt->socket = dead_socket; 559 skt->socket = dead_socket;
562 skt->ops->init(skt); 560 skt->ops->init(skt);
563 skt->ops->set_socket(skt, &skt->socket); 561 skt->ops->set_socket(skt, &skt->socket);
562 if (skt->state & SOCKET_PRESENT)
563 skt->resume_status = socket_setup(skt, resume_delay);
564 return 0;
565}
564 566
567static int socket_late_resume(struct pcmcia_socket *skt)
568{
565 if (!(skt->state & SOCKET_PRESENT)) { 569 if (!(skt->state & SOCKET_PRESENT)) {
566 skt->state &= ~SOCKET_SUSPEND; 570 skt->state &= ~SOCKET_SUSPEND;
567 return socket_insert(skt); 571 return socket_insert(skt);
568 } 572 }
569 573
570 ret = socket_setup(skt, resume_delay); 574 if (skt->resume_status == 0) {
571 if (ret == 0) {
572 /* 575 /*
573 * FIXME: need a better check here for cardbus cards. 576 * FIXME: need a better check here for cardbus cards.
574 */ 577 */
@@ -596,6 +599,20 @@ static int socket_resume(struct pcmcia_socket *skt)
596 return 0; 599 return 0;
597} 600}
598 601
602/*
603 * Resume a socket. If a card is present, verify its CIS against
604 * our cached copy. If they are different, the card has been
605 * replaced, and we need to tell the drivers.
606 */
607static int socket_resume(struct pcmcia_socket *skt)
608{
609 if (!(skt->state & SOCKET_SUSPEND))
610 return -EBUSY;
611
612 socket_early_resume(skt);
613 return socket_late_resume(skt);
614}
615
599static void socket_remove(struct pcmcia_socket *skt) 616static void socket_remove(struct pcmcia_socket *skt)
600{ 617{
601 dev_printk(KERN_NOTICE, &skt->dev, 618 dev_printk(KERN_NOTICE, &skt->dev,
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 79615e6d540b..1f4098f1354d 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -197,8 +197,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
197 cisdata_t code, void *parse); 197 cisdata_t code, void *parse);
198int pcmcia_replace_cis(struct pcmcia_socket *s, 198int pcmcia_replace_cis(struct pcmcia_socket *s,
199 const u8 *data, const size_t len); 199 const u8 *data, const size_t len);
200int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, 200int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count);
201 unsigned int *count);
202 201
203/* rsrc_mgr.c */ 202/* rsrc_mgr.c */
204int pcmcia_validate_mem(struct pcmcia_socket *s); 203int pcmcia_validate_mem(struct pcmcia_socket *s);
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 9f300d3cb125..f5b7079f13d3 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -547,7 +547,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
547 if (!vers1) 547 if (!vers1)
548 return -ENOMEM; 548 return -ENOMEM;
549 549
550 if (!pccard_read_tuple(p_dev->socket, p_dev->func, 550 if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL,
551 CISTPL_MANFID, &manf_id)) { 551 CISTPL_MANFID, &manf_id)) {
552 p_dev->manf_id = manf_id.manf; 552 p_dev->manf_id = manf_id.manf;
553 p_dev->card_id = manf_id.card; 553 p_dev->card_id = manf_id.card;
@@ -581,9 +581,9 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
581 kfree(devgeo); 581 kfree(devgeo);
582 } 582 }
583 583
584 if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_VERS_1, 584 if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL, CISTPL_VERS_1,
585 vers1)) { 585 vers1)) {
586 for (i=0; i < vers1->ns; i++) { 586 for (i = 0; i < min_t(unsigned int, 4, vers1->ns); i++) {
587 char *tmp; 587 char *tmp;
588 unsigned int length; 588 unsigned int length;
589 589
@@ -733,7 +733,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
733 return -EAGAIN; /* try again, but later... */ 733 return -EAGAIN; /* try again, but later... */
734 } 734 }
735 735
736 ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains); 736 ret = pccard_validate_cis(s, &no_chains);
737 if (ret || !no_chains) { 737 if (ret || !no_chains) {
738 ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); 738 ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n");
739 return -ENODEV; 739 return -ENODEV;
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index b906abe26ad0..a4aacb830b80 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -1053,8 +1053,8 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io)
1053 u_char map, ioctl; 1053 u_char map, ioctl;
1054 1054
1055 debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " 1055 debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, "
1056 "%#x-%#x)\n", sock, io->map, io->flags, 1056 "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed,
1057 io->speed, io->start, io->stop); 1057 (unsigned long long)io->start, (unsigned long long)io->stop);
1058 map = io->map; 1058 map = io->map;
1059 if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || 1059 if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
1060 (io->stop < io->start)) return -EINVAL; 1060 (io->stop < io->start)) return -EINVAL;
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index d1d89c4491ad..7dfbee1dcd76 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -537,8 +537,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io)
537 u_char map; 537 u_char map;
538 538
539 debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " 539 debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, "
540 "%#lx-%#lx)\n", sock, io->map, io->flags, 540 "%#llx-%#llx)\n", sock, io->map, io->flags,
541 io->speed, io->start, io->stop); 541 io->speed, (unsigned long long)io->start,
542 (unsigned long long)io->stop);
542 map = io->map; 543 map = io->map;
543 544
544 return 0; 545 return 0;
@@ -554,8 +555,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem)
554 pcc_socket_t *t = &socket[sock]; 555 pcc_socket_t *t = &socket[sock];
555 556
556 debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " 557 debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, "
557 "%#lx, %#x)\n", sock, map, mem->flags, 558 "%#llx, %#x)\n", sock, map, mem->flags,
558 mem->speed, mem->static_start, mem->card_start); 559 mem->speed, (unsigned long long)mem->static_start,
560 mem->card_start);
559 561
560 /* 562 /*
561 * sanity check 563 * sanity check
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index a0655839c8d3..c6524f99ccc3 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -492,8 +492,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io)
492 u_char map; 492 u_char map;
493 493
494 debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " 494 debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, "
495 "%#x-%#x)\n", sock, io->map, io->flags, 495 "%#llx-%#llx)\n", sock, io->map, io->flags,
496 io->speed, io->start, io->stop); 496 io->speed, (unsigned long long)io->start,
497 (unsigned long long)io->stop);
497 map = io->map; 498 map = io->map;
498 499
499 return 0; 500 return 0;
@@ -515,8 +516,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem)
515#endif 516#endif
516 517
517 debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " 518 debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, "
518 "%#lx, %#x)\n", sock, map, mem->flags, 519 "%#llx, %#x)\n", sock, map, mem->flags,
519 mem->speed, mem->static_start, mem->card_start); 520 mem->speed, (unsigned long long)mem->static_start,
521 mem->card_start);
520 522
521 /* 523 /*
522 * sanity check 524 * sanity check
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index c69f2c4fe520..403559ba49dd 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -975,8 +975,9 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
975#define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) 975#define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start)
976 976
977 dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, " 977 dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, "
978 "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags, 978 "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags,
979 io->speed, io->start, io->stop); 979 io->speed, (unsigned long long)io->start,
980 (unsigned long long)io->stop);
980 981
981 if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff) 982 if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff)
982 || (io->stop > 0xffff) || (io->stop < io->start)) 983 || (io->stop > 0xffff) || (io->stop < io->start))
@@ -1055,8 +1056,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock,
1055 pcmconf8xx_t *pcmcia = s->pcmcia; 1056 pcmconf8xx_t *pcmcia = s->pcmcia;
1056 1057
1057 dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " 1058 dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, "
1058 "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, 1059 "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags,
1059 mem->speed, mem->static_start, mem->card_start); 1060 mem->speed, (unsigned long long)mem->static_start,
1061 mem->card_start);
1060 1062
1061 if ((mem->map >= PCMCIA_MEM_WIN_NO) 1063 if ((mem->map >= PCMCIA_MEM_WIN_NO)
1062// || ((mem->s) >= PCMCIA_MEM_WIN_SIZE) 1064// || ((mem->s) >= PCMCIA_MEM_WIN_SIZE)
@@ -1107,8 +1109,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock,
1107 } 1109 }
1108 1110
1109 dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " 1111 dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, "
1110 "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, 1112 "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags,
1111 mem->speed, mem->static_start, mem->card_start); 1113 mem->speed, (unsigned long long)mem->static_start,
1114 mem->card_start);
1112 1115
1113 /* copy the struct and modify the copy */ 1116 /* copy the struct and modify the copy */
1114 1117
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 32c44040c1e8..30cf71d2ee23 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -881,7 +881,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
881 mutex_lock(&s->skt_mutex); 881 mutex_lock(&s->skt_mutex);
882 pcmcia_validate_mem(s); 882 pcmcia_validate_mem(s);
883 mutex_unlock(&s->skt_mutex); 883 mutex_unlock(&s->skt_mutex);
884 ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo.Chains); 884 ret = pccard_validate_cis(s, &buf->cisinfo.Chains);
885 break; 885 break;
886 case DS_SUSPEND_CARD: 886 case DS_SUSPEND_CARD:
887 ret = pcmcia_suspend_card(s); 887 ret = pcmcia_suspend_card(s);
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 1c39d3438f20..70a33468bcd0 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -641,6 +641,12 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
641 if ((ret = pci_enable_device(dev))) 641 if ((ret = pci_enable_device(dev)))
642 goto err_out_free_mem; 642 goto err_out_free_mem;
643 643
644 if (!pci_resource_start(dev, 0)) {
645 printk(KERN_INFO "pd6729: refusing to load the driver "
646 "as the io_base is 0.\n");
647 goto err_out_free_mem;
648 }
649
644 printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " 650 printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge "
645 "at 0x%llx on irq %d\n", 651 "at 0x%llx on irq %d\n",
646 (unsigned long long)pci_resource_start(dev, 0), dev->irq); 652 (unsigned long long)pci_resource_start(dev, 0), dev->irq);
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 9ca22c7aafb2..7039f3cf5b77 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -206,6 +206,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
206 /* First, what does a floating port look like? */ 206 /* First, what does a floating port look like? */
207 b = kzalloc(256, GFP_KERNEL); 207 b = kzalloc(256, GFP_KERNEL);
208 if (!b) { 208 if (!b) {
209 printk("\n");
209 dev_printk(KERN_ERR, &s->dev, 210 dev_printk(KERN_ERR, &s->dev,
210 "do_io_probe: unable to kmalloc 256 bytes"); 211 "do_io_probe: unable to kmalloc 256 bytes");
211 return; 212 return;
@@ -275,7 +276,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
275 s->cis_mem.res = res; 276 s->cis_mem.res = res;
276 s->cis_virt = ioremap(res->start, s->map_size); 277 s->cis_virt = ioremap(res->start, s->map_size);
277 if (s->cis_virt) { 278 if (s->cis_virt) {
278 ret = pccard_validate_cis(s, BIND_FN_ALL, count); 279 ret = pccard_validate_cis(s, count);
279 /* invalidate mapping and CIS cache */ 280 /* invalidate mapping and CIS cache */
280 iounmap(s->cis_virt); 281 iounmap(s->cis_virt);
281 s->cis_virt = NULL; 282 s->cis_virt = NULL;
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 163cf98e2386..ef7e9e58782b 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -336,8 +336,9 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m
336 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock); 336 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
337 unsigned short speed = map->speed; 337 unsigned short speed = map->speed;
338 338
339 debug(skt, 2, "map %u speed %u start 0x%08x stop 0x%08x\n", 339 debug(skt, 2, "map %u speed %u start 0x%08llx stop 0x%08llx\n",
340 map->map, map->speed, map->start, map->stop); 340 map->map, map->speed, (unsigned long long)map->start,
341 (unsigned long long)map->stop);
341 debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", 342 debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
342 (map->flags==0)?"<NONE>":"", 343 (map->flags==0)?"<NONE>":"",
343 (map->flags&MAP_ACTIVE)?"ACTIVE ":"", 344 (map->flags&MAP_ACTIVE)?"ACTIVE ":"",
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index ff9a3bb3c88d..78d5aab542f7 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -300,7 +300,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
300 300
301 if (!(s->state & SOCKET_PRESENT)) 301 if (!(s->state & SOCKET_PRESENT))
302 return -ENODEV; 302 return -ENODEV;
303 if (pccard_validate_cis(s, BIND_FN_ALL, &chains)) 303 if (pccard_validate_cis(s, &chains))
304 return -EIO; 304 return -EIO;
305 if (!chains) 305 if (!chains)
306 return -ENODATA; 306 return -ENODATA;
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
index 582413fcb62f..6918849d511e 100644
--- a/drivers/pcmcia/tcic.c
+++ b/drivers/pcmcia/tcic.c
@@ -732,8 +732,8 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
732 u_short base, len, ioctl; 732 u_short base, len, ioctl;
733 733
734 debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " 734 debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, "
735 "%#x-%#x)\n", psock, io->map, io->flags, 735 "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed,
736 io->speed, io->start, io->stop); 736 (unsigned long long)io->start, (unsigned long long)io->stop);
737 if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || 737 if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
738 (io->stop < io->start)) return -EINVAL; 738 (io->stop < io->start)) return -EINVAL;
739 tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT)); 739 tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT));
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index abe0e44c6e9e..8be4cc447a17 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1275,16 +1275,26 @@ static int yenta_dev_resume_noirq(struct device *dev)
1275 if (socket->type && socket->type->restore_state) 1275 if (socket->type && socket->type->restore_state)
1276 socket->type->restore_state(socket); 1276 socket->type->restore_state(socket);
1277 1277
1278 return pcmcia_socket_dev_resume(dev); 1278 pcmcia_socket_dev_early_resume(dev);
1279 return 0;
1280}
1281
1282static int yenta_dev_resume(struct device *dev)
1283{
1284 pcmcia_socket_dev_late_resume(dev);
1285 return 0;
1279} 1286}
1280 1287
1281static struct dev_pm_ops yenta_pm_ops = { 1288static struct dev_pm_ops yenta_pm_ops = {
1282 .suspend_noirq = yenta_dev_suspend_noirq, 1289 .suspend_noirq = yenta_dev_suspend_noirq,
1283 .resume_noirq = yenta_dev_resume_noirq, 1290 .resume_noirq = yenta_dev_resume_noirq,
1291 .resume = yenta_dev_resume,
1284 .freeze_noirq = yenta_dev_suspend_noirq, 1292 .freeze_noirq = yenta_dev_suspend_noirq,
1285 .thaw_noirq = yenta_dev_resume_noirq, 1293 .thaw_noirq = yenta_dev_resume_noirq,
1294 .thaw = yenta_dev_resume,
1286 .poweroff_noirq = yenta_dev_suspend_noirq, 1295 .poweroff_noirq = yenta_dev_suspend_noirq,
1287 .restore_noirq = yenta_dev_resume_noirq, 1296 .restore_noirq = yenta_dev_resume_noirq,
1297 .restore = yenta_dev_resume,
1288}; 1298};
1289 1299
1290#define YENTA_PM_OPS (&yenta_pm_ops) 1300#define YENTA_PM_OPS (&yenta_pm_ops)
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 749e2102b2be..d379e74a05d0 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -150,6 +150,8 @@ struct eeepc_hotk {
150/* The actual device the driver binds to */ 150/* The actual device the driver binds to */
151static struct eeepc_hotk *ehotk; 151static struct eeepc_hotk *ehotk;
152 152
153static void eeepc_rfkill_hotplug(bool real);
154
153/* Platform device/driver */ 155/* Platform device/driver */
154static int eeepc_hotk_thaw(struct device *device); 156static int eeepc_hotk_thaw(struct device *device);
155static int eeepc_hotk_restore(struct device *device); 157static int eeepc_hotk_restore(struct device *device);
@@ -343,14 +345,23 @@ static bool eeepc_wlan_rfkill_blocked(void)
343static int eeepc_rfkill_set(void *data, bool blocked) 345static int eeepc_rfkill_set(void *data, bool blocked)
344{ 346{
345 unsigned long asl = (unsigned long)data; 347 unsigned long asl = (unsigned long)data;
346 return set_acpi(asl, !blocked); 348 int ret;
349
350 if (asl != CM_ASL_WLAN)
351 return set_acpi(asl, !blocked);
352
353 /* hack to avoid panic with rt2860sta */
354 if (blocked)
355 eeepc_rfkill_hotplug(false);
356 ret = set_acpi(asl, !blocked);
357 return ret;
347} 358}
348 359
349static const struct rfkill_ops eeepc_rfkill_ops = { 360static const struct rfkill_ops eeepc_rfkill_ops = {
350 .set_block = eeepc_rfkill_set, 361 .set_block = eeepc_rfkill_set,
351}; 362};
352 363
353static void __init eeepc_enable_camera(void) 364static void __devinit eeepc_enable_camera(void)
354{ 365{
355 /* 366 /*
356 * If the following call to set_acpi() fails, it's because there's no 367 * If the following call to set_acpi() fails, it's because there's no
@@ -643,13 +654,13 @@ static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,
643 return 0; 654 return 0;
644} 655}
645 656
646static void eeepc_rfkill_hotplug(void) 657static void eeepc_rfkill_hotplug(bool real)
647{ 658{
648 struct pci_dev *dev; 659 struct pci_dev *dev;
649 struct pci_bus *bus; 660 struct pci_bus *bus;
650 bool blocked = eeepc_wlan_rfkill_blocked(); 661 bool blocked = real ? eeepc_wlan_rfkill_blocked() : true;
651 662
652 if (ehotk->wlan_rfkill) 663 if (real && ehotk->wlan_rfkill)
653 rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); 664 rfkill_set_sw_state(ehotk->wlan_rfkill, blocked);
654 665
655 mutex_lock(&ehotk->hotplug_lock); 666 mutex_lock(&ehotk->hotplug_lock);
@@ -692,7 +703,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
692 if (event != ACPI_NOTIFY_BUS_CHECK) 703 if (event != ACPI_NOTIFY_BUS_CHECK)
693 return; 704 return;
694 705
695 eeepc_rfkill_hotplug(); 706 eeepc_rfkill_hotplug(true);
696} 707}
697 708
698static void eeepc_hotk_notify(struct acpi_device *device, u32 event) 709static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
@@ -850,7 +861,7 @@ static int eeepc_hotk_restore(struct device *device)
850{ 861{
851 /* Refresh both wlan rfkill state and pci hotplug */ 862 /* Refresh both wlan rfkill state and pci hotplug */
852 if (ehotk->wlan_rfkill) 863 if (ehotk->wlan_rfkill)
853 eeepc_rfkill_hotplug(); 864 eeepc_rfkill_hotplug(true);
854 865
855 if (ehotk->bluetooth_rfkill) 866 if (ehotk->bluetooth_rfkill)
856 rfkill_set_sw_state(ehotk->bluetooth_rfkill, 867 rfkill_set_sw_state(ehotk->bluetooth_rfkill,
@@ -993,7 +1004,7 @@ static void eeepc_rfkill_exit(void)
993 * Refresh pci hotplug in case the rfkill state was changed after 1004 * Refresh pci hotplug in case the rfkill state was changed after
994 * eeepc_unregister_rfkill_notifier() 1005 * eeepc_unregister_rfkill_notifier()
995 */ 1006 */
996 eeepc_rfkill_hotplug(); 1007 eeepc_rfkill_hotplug(true);
997 if (ehotk->hotplug_slot) 1008 if (ehotk->hotplug_slot)
998 pci_hp_deregister(ehotk->hotplug_slot); 1009 pci_hp_deregister(ehotk->hotplug_slot);
999 1010
@@ -1109,7 +1120,7 @@ static int eeepc_rfkill_init(struct device *dev)
1109 * Refresh pci hotplug in case the rfkill state was changed during 1120 * Refresh pci hotplug in case the rfkill state was changed during
1110 * setup. 1121 * setup.
1111 */ 1122 */
1112 eeepc_rfkill_hotplug(); 1123 eeepc_rfkill_hotplug(true);
1113 1124
1114exit: 1125exit:
1115 if (result && result != -ENODEV) 1126 if (result && result != -ENODEV)
@@ -1189,7 +1200,7 @@ static int eeepc_input_init(struct device *dev)
1189 return 0; 1200 return 0;
1190} 1201}
1191 1202
1192static int eeepc_hotk_add(struct acpi_device *device) 1203static int __devinit eeepc_hotk_add(struct acpi_device *device)
1193{ 1204{
1194 struct device *dev; 1205 struct device *dev;
1195 int result; 1206 int result;
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index f35aee5c2149..bcd4ba8be7db 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -944,7 +944,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
944 struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device); 944 struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device);
945 struct input_dev *input = fujitsu_hotkey->input; 945 struct input_dev *input = fujitsu_hotkey->input;
946 946
947#ifdef CONFIG_LEDS_CLASS 947#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
948 if (fujitsu_hotkey->logolamp_registered) 948 if (fujitsu_hotkey->logolamp_registered)
949 led_classdev_unregister(&logolamp_led); 949 led_classdev_unregister(&logolamp_led);
950 950
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index a4f68e5b9c96..b44462a6c6d3 100644
--- a/drivers/s390/char/sclp_async.c
+++ b/drivers/s390/char/sclp_async.c
@@ -26,7 +26,6 @@ static struct sclp_async_sccb *sccb;
26static int sclp_async_send_wait(char *message); 26static int sclp_async_send_wait(char *message);
27static struct ctl_table_header *callhome_sysctl_header; 27static struct ctl_table_header *callhome_sysctl_header;
28static DEFINE_SPINLOCK(sclp_async_lock); 28static DEFINE_SPINLOCK(sclp_async_lock);
29static char nodename[64];
30#define SCLP_NORMAL_WRITE 0x00 29#define SCLP_NORMAL_WRITE 0x00
31 30
32struct async_evbuf { 31struct async_evbuf {
@@ -52,9 +51,10 @@ static struct sclp_register sclp_async_register = {
52static int call_home_on_panic(struct notifier_block *self, 51static int call_home_on_panic(struct notifier_block *self,
53 unsigned long event, void *data) 52 unsigned long event, void *data)
54{ 53{
55 strncat(data, nodename, strlen(nodename)); 54 strncat(data, init_utsname()->nodename,
56 sclp_async_send_wait(data); 55 sizeof(init_utsname()->nodename));
57 return NOTIFY_DONE; 56 sclp_async_send_wait(data);
57 return NOTIFY_DONE;
58} 58}
59 59
60static struct notifier_block call_home_panic_nb = { 60static struct notifier_block call_home_panic_nb = {
@@ -68,15 +68,14 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
68{ 68{
69 unsigned long val; 69 unsigned long val;
70 int len, rc; 70 int len, rc;
71 char buf[2]; 71 char buf[3];
72 72
73 if (!*count | (*ppos && !write)) { 73 if (!*count || (*ppos && !write)) {
74 *count = 0; 74 *count = 0;
75 return 0; 75 return 0;
76 } 76 }
77 if (!write) { 77 if (!write) {
78 len = sprintf(buf, "%d\n", callhome_enabled); 78 len = snprintf(buf, sizeof(buf), "%d\n", callhome_enabled);
79 buf[len] = '\0';
80 rc = copy_to_user(buffer, buf, sizeof(buf)); 79 rc = copy_to_user(buffer, buf, sizeof(buf));
81 if (rc != 0) 80 if (rc != 0)
82 return -EFAULT; 81 return -EFAULT;
@@ -171,39 +170,29 @@ static int __init sclp_async_init(void)
171 rc = sclp_register(&sclp_async_register); 170 rc = sclp_register(&sclp_async_register);
172 if (rc) 171 if (rc)
173 return rc; 172 return rc;
174 callhome_sysctl_header = register_sysctl_table(kern_dir_table); 173 rc = -EOPNOTSUPP;
175 if (!callhome_sysctl_header) { 174 if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK))
176 rc = -ENOMEM;
177 goto out_sclp;
178 }
179 if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK)) {
180 rc = -EOPNOTSUPP;
181 goto out_sclp; 175 goto out_sclp;
182 }
183 rc = -ENOMEM; 176 rc = -ENOMEM;
177 callhome_sysctl_header = register_sysctl_table(kern_dir_table);
178 if (!callhome_sysctl_header)
179 goto out_sclp;
184 request = kzalloc(sizeof(struct sclp_req), GFP_KERNEL); 180 request = kzalloc(sizeof(struct sclp_req), GFP_KERNEL);
185 if (!request)
186 goto out_sys;
187 sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA); 181 sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
188 if (!sccb) 182 if (!request || !sccb)
189 goto out_mem; 183 goto out_mem;
190 rc = atomic_notifier_chain_register(&panic_notifier_list, 184 rc = atomic_notifier_chain_register(&panic_notifier_list,
191 &call_home_panic_nb); 185 &call_home_panic_nb);
192 if (rc) 186 if (!rc)
193 goto out_mem; 187 goto out;
194
195 strncpy(nodename, init_utsname()->nodename, 64);
196 return 0;
197
198out_mem: 188out_mem:
199 kfree(request); 189 kfree(request);
200 free_page((unsigned long) sccb); 190 free_page((unsigned long) sccb);
201out_sys:
202 unregister_sysctl_table(callhome_sysctl_header); 191 unregister_sysctl_table(callhome_sysctl_header);
203out_sclp: 192out_sclp:
204 sclp_unregister(&sclp_async_register); 193 sclp_unregister(&sclp_async_register);
194out:
205 return rc; 195 return rc;
206
207} 196}
208module_init(sclp_async_init); 197module_init(sclp_async_init);
209 198
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c
index 102000d1af6f..3012355f8304 100644
--- a/drivers/s390/net/smsgiucv.c
+++ b/drivers/s390/net/smsgiucv.c
@@ -158,7 +158,12 @@ static int smsg_pm_restore_thaw(struct device *dev)
158 smsg_path->flags = 0; 158 smsg_path->flags = 0;
159 rc = iucv_path_connect(smsg_path, &smsg_handler, "*MSG ", 159 rc = iucv_path_connect(smsg_path, &smsg_handler, "*MSG ",
160 NULL, NULL, NULL); 160 NULL, NULL, NULL);
161 printk(KERN_ERR "iucv_path_connect returned with rc %i\n", rc); 161#ifdef CONFIG_PM_DEBUG
162 if (rc)
163 printk(KERN_ERR
164 "iucv_path_connect returned with rc %i\n", rc);
165#endif
166 cpcmd("SET SMSG IUCV", NULL, 0, NULL);
162 } 167 }
163 return 0; 168 return 0;
164} 169}
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 0f79f3af4f54..2889e5f2dfd3 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -128,12 +128,13 @@ out_ccwdev:
128static void __init zfcp_init_device_setup(char *devstr) 128static void __init zfcp_init_device_setup(char *devstr)
129{ 129{
130 char *token; 130 char *token;
131 char *str; 131 char *str, *str_saved;
132 char busid[ZFCP_BUS_ID_SIZE]; 132 char busid[ZFCP_BUS_ID_SIZE];
133 u64 wwpn, lun; 133 u64 wwpn, lun;
134 134
135 /* duplicate devstr and keep the original for sysfs presentation*/ 135 /* duplicate devstr and keep the original for sysfs presentation*/
136 str = kmalloc(strlen(devstr) + 1, GFP_KERNEL); 136 str_saved = kmalloc(strlen(devstr) + 1, GFP_KERNEL);
137 str = str_saved;
137 if (!str) 138 if (!str)
138 return; 139 return;
139 140
@@ -152,12 +153,12 @@ static void __init zfcp_init_device_setup(char *devstr)
152 if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun)) 153 if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun))
153 goto err_out; 154 goto err_out;
154 155
155 kfree(str); 156 kfree(str_saved);
156 zfcp_init_device_configure(busid, wwpn, lun); 157 zfcp_init_device_configure(busid, wwpn, lun);
157 return; 158 return;
158 159
159 err_out: 160err_out:
160 kfree(str); 161 kfree(str_saved);
161 pr_err("%s is not a valid SCSI device\n", devstr); 162 pr_err("%s is not a valid SCSI device\n", devstr);
162} 163}
163 164
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 73d366ba31e5..f73e2180f333 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -858,10 +858,7 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
858 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) 858 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP)
859 return zfcp_erp_open_ptp_port(act); 859 return zfcp_erp_open_ptp_port(act);
860 if (!port->d_id) { 860 if (!port->d_id) {
861 zfcp_port_get(port); 861 zfcp_fc_trigger_did_lookup(port);
862 if (!queue_work(adapter->work_queue,
863 &port->gid_pn_work))
864 zfcp_port_put(port);
865 return ZFCP_ERP_EXIT; 862 return ZFCP_ERP_EXIT;
866 } 863 }
867 return zfcp_erp_port_strategy_open_port(act); 864 return zfcp_erp_port_strategy_open_port(act);
@@ -869,12 +866,11 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
869 case ZFCP_ERP_STEP_PORT_OPENING: 866 case ZFCP_ERP_STEP_PORT_OPENING:
870 /* D_ID might have changed during open */ 867 /* D_ID might have changed during open */
871 if (p_status & ZFCP_STATUS_COMMON_OPEN) { 868 if (p_status & ZFCP_STATUS_COMMON_OPEN) {
872 if (port->d_id) 869 if (!port->d_id) {
873 return ZFCP_ERP_SUCCEEDED; 870 zfcp_fc_trigger_did_lookup(port);
874 else { 871 return ZFCP_ERP_EXIT;
875 act->step = ZFCP_ERP_STEP_PORT_CLOSING;
876 return ZFCP_ERP_CONTINUES;
877 } 872 }
873 return ZFCP_ERP_SUCCEEDED;
878 } 874 }
879 if (port->d_id && !(p_status & ZFCP_STATUS_COMMON_NOESC)) { 875 if (port->d_id && !(p_status & ZFCP_STATUS_COMMON_NOESC)) {
880 port->d_id = 0; 876 port->d_id = 0;
@@ -889,19 +885,21 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
889static int zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action) 885static int zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)
890{ 886{
891 struct zfcp_port *port = erp_action->port; 887 struct zfcp_port *port = erp_action->port;
888 int p_status = atomic_read(&port->status);
892 889
893 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_NOESC) 890 if ((p_status & ZFCP_STATUS_COMMON_NOESC) &&
891 !(p_status & ZFCP_STATUS_COMMON_OPEN))
894 goto close_init_done; 892 goto close_init_done;
895 893
896 switch (erp_action->step) { 894 switch (erp_action->step) {
897 case ZFCP_ERP_STEP_UNINITIALIZED: 895 case ZFCP_ERP_STEP_UNINITIALIZED:
898 zfcp_erp_port_strategy_clearstati(port); 896 zfcp_erp_port_strategy_clearstati(port);
899 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_OPEN) 897 if (p_status & ZFCP_STATUS_COMMON_OPEN)
900 return zfcp_erp_port_strategy_close(erp_action); 898 return zfcp_erp_port_strategy_close(erp_action);
901 break; 899 break;
902 900
903 case ZFCP_ERP_STEP_PORT_CLOSING: 901 case ZFCP_ERP_STEP_PORT_CLOSING:
904 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_OPEN) 902 if (p_status & ZFCP_STATUS_COMMON_OPEN)
905 return ZFCP_ERP_FAILED; 903 return ZFCP_ERP_FAILED;
906 break; 904 break;
907 } 905 }
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 629edec70405..b3f28deb4505 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -96,6 +96,7 @@ extern int zfcp_fc_scan_ports(struct zfcp_adapter *);
96extern void _zfcp_fc_scan_ports_later(struct work_struct *); 96extern void _zfcp_fc_scan_ports_later(struct work_struct *);
97extern void zfcp_fc_incoming_els(struct zfcp_fsf_req *); 97extern void zfcp_fc_incoming_els(struct zfcp_fsf_req *);
98extern void zfcp_fc_port_did_lookup(struct work_struct *); 98extern void zfcp_fc_port_did_lookup(struct work_struct *);
99extern void zfcp_fc_trigger_did_lookup(struct zfcp_port *);
99extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *); 100extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *);
100extern void zfcp_fc_test_link(struct zfcp_port *); 101extern void zfcp_fc_test_link(struct zfcp_port *);
101extern void zfcp_fc_link_test_work(struct work_struct *); 102extern void zfcp_fc_link_test_work(struct work_struct *);
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 722f22de8753..df23bcead23d 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -361,6 +361,17 @@ out:
361} 361}
362 362
363/** 363/**
364 * zfcp_fc_trigger_did_lookup - trigger the d_id lookup using a GID_PN request
365 * @port: The zfcp_port to lookup the d_id for.
366 */
367void zfcp_fc_trigger_did_lookup(struct zfcp_port *port)
368{
369 zfcp_port_get(port);
370 if (!queue_work(port->adapter->work_queue, &port->gid_pn_work))
371 zfcp_port_put(port);
372}
373
374/**
364 * zfcp_fc_plogi_evaluate - evaluate PLOGI playload 375 * zfcp_fc_plogi_evaluate - evaluate PLOGI playload
365 * @port: zfcp_port structure 376 * @port: zfcp_port structure
366 * @plogi: plogi payload 377 * @plogi: plogi payload
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 38a7e4a6b639..4e41baa0c141 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -1079,7 +1079,7 @@ static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req,
1079 /* common settings for ct/gs and els requests */ 1079 /* common settings for ct/gs and els requests */
1080 req->qtcb->bottom.support.service_class = FSF_CLASS_3; 1080 req->qtcb->bottom.support.service_class = FSF_CLASS_3;
1081 req->qtcb->bottom.support.timeout = 2 * R_A_TOV; 1081 req->qtcb->bottom.support.timeout = 2 * R_A_TOV;
1082 zfcp_fsf_start_timer(req, 2 * R_A_TOV + 10); 1082 zfcp_fsf_start_timer(req, (2 * R_A_TOV + 10) * HZ);
1083 1083
1084 return 0; 1084 return 0;
1085} 1085}
@@ -1475,9 +1475,16 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1475 plogi = (struct fsf_plogi *) req->qtcb->bottom.support.els; 1475 plogi = (struct fsf_plogi *) req->qtcb->bottom.support.els;
1476 if (req->qtcb->bottom.support.els1_length >= 1476 if (req->qtcb->bottom.support.els1_length >=
1477 FSF_PLOGI_MIN_LEN) { 1477 FSF_PLOGI_MIN_LEN) {
1478 if (plogi->serv_param.wwpn != port->wwpn) 1478 if (plogi->serv_param.wwpn != port->wwpn) {
1479 port->d_id = 0; 1479 port->d_id = 0;
1480 else { 1480 dev_warn(&port->adapter->ccw_device->dev,
1481 "A port opened with WWPN 0x%016Lx "
1482 "returned data that identifies it as "
1483 "WWPN 0x%016Lx\n",
1484 (unsigned long long) port->wwpn,
1485 (unsigned long long)
1486 plogi->serv_param.wwpn);
1487 } else {
1481 port->wwnn = plogi->serv_param.wwnn; 1488 port->wwnn = plogi->serv_param.wwnn;
1482 zfcp_fc_plogi_evaluate(port, plogi); 1489 zfcp_fc_plogi_evaluate(port, plogi);
1483 } 1490 }
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 079a8cf518a3..d31000886ca8 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -224,6 +224,7 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
224 224
225 zfcp_erp_unit_reopen(unit, 0, "syuas_1", NULL); 225 zfcp_erp_unit_reopen(unit, 0, "syuas_1", NULL);
226 zfcp_erp_wait(unit->port->adapter); 226 zfcp_erp_wait(unit->port->adapter);
227 flush_work(&unit->scsi_work);
227 zfcp_unit_put(unit); 228 zfcp_unit_put(unit);
228out: 229out:
229 mutex_unlock(&zfcp_data.config_mutex); 230 mutex_unlock(&zfcp_data.config_mutex);
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index b6af63ca980b..496764349c41 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1918,6 +1918,10 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
1918 } 1918 }
1919 size = size>>16; 1919 size = size>>16;
1920 size *= 4; 1920 size *= 4;
1921 if (size > MAX_MESSAGE_SIZE) {
1922 rcode = -EINVAL;
1923 goto cleanup;
1924 }
1921 /* Copy in the user's I2O command */ 1925 /* Copy in the user's I2O command */
1922 if (copy_from_user (msg, user_msg, size)) { 1926 if (copy_from_user (msg, user_msg, size)) {
1923 rcode = -EFAULT; 1927 rcode = -EFAULT;
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index c44783801402..0547a7f44d42 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -317,6 +317,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
317out_device_destroy: 317out_device_destroy:
318 scsi_device_set_state(sdev, SDEV_DEL); 318 scsi_device_set_state(sdev, SDEV_DEL);
319 transport_destroy_device(&sdev->sdev_gendev); 319 transport_destroy_device(&sdev->sdev_gendev);
320 put_device(&sdev->sdev_dev);
320 put_device(&sdev->sdev_gendev); 321 put_device(&sdev->sdev_gendev);
321out: 322out:
322 if (display_failure_msg) 323 if (display_failure_msg)
@@ -957,6 +958,7 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
957 if (sdev->host->hostt->slave_destroy) 958 if (sdev->host->hostt->slave_destroy)
958 sdev->host->hostt->slave_destroy(sdev); 959 sdev->host->hostt->slave_destroy(sdev);
959 transport_destroy_device(&sdev->sdev_gendev); 960 transport_destroy_device(&sdev->sdev_gendev);
961 put_device(&sdev->sdev_dev);
960 put_device(&sdev->sdev_gendev); 962 put_device(&sdev->sdev_gendev);
961} 963}
962 964
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index fde54537d715..5c7eb63a19d1 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -864,10 +864,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
864 goto clean_device; 864 goto clean_device;
865 } 865 }
866 866
867 /* take a reference for the sdev_dev; this is
868 * released by the sdev_class .release */
869 get_device(&sdev->sdev_gendev);
870
871 /* create queue files, which may be writable, depending on the host */ 867 /* create queue files, which may be writable, depending on the host */
872 if (sdev->host->hostt->change_queue_depth) 868 if (sdev->host->hostt->change_queue_depth)
873 error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); 869 error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw);
@@ -917,6 +913,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
917 913
918 device_del(&sdev->sdev_gendev); 914 device_del(&sdev->sdev_gendev);
919 transport_destroy_device(&sdev->sdev_gendev); 915 transport_destroy_device(&sdev->sdev_gendev);
916 put_device(&sdev->sdev_dev);
920 put_device(&sdev->sdev_gendev); 917 put_device(&sdev->sdev_gendev);
921 918
922 return error; 919 return error;
@@ -1065,7 +1062,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
1065 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); 1062 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
1066 1063
1067 device_initialize(&sdev->sdev_dev); 1064 device_initialize(&sdev->sdev_dev);
1068 sdev->sdev_dev.parent = &sdev->sdev_gendev; 1065 sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev);
1069 sdev->sdev_dev.class = &sdev_class; 1066 sdev->sdev_dev.class = &sdev_class;
1070 dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%d", 1067 dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%d",
1071 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); 1068 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index e7108e75653d..42e8550cd2b6 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1561,11 +1561,16 @@ enum pci_board_num_t {
1561 pbn_exar_XR17C152, 1561 pbn_exar_XR17C152,
1562 pbn_exar_XR17C154, 1562 pbn_exar_XR17C154,
1563 pbn_exar_XR17C158, 1563 pbn_exar_XR17C158,
1564 pbn_exar_ibm_saturn,
1564 pbn_pasemi_1682M, 1565 pbn_pasemi_1682M,
1565 pbn_ni8430_2, 1566 pbn_ni8430_2,
1566 pbn_ni8430_4, 1567 pbn_ni8430_4,
1567 pbn_ni8430_8, 1568 pbn_ni8430_8,
1568 pbn_ni8430_16, 1569 pbn_ni8430_16,
1570 pbn_ADDIDATA_PCIe_1_3906250,
1571 pbn_ADDIDATA_PCIe_2_3906250,
1572 pbn_ADDIDATA_PCIe_4_3906250,
1573 pbn_ADDIDATA_PCIe_8_3906250,
1569}; 1574};
1570 1575
1571/* 1576/*
@@ -2146,6 +2151,13 @@ static struct pciserial_board pci_boards[] __devinitdata = {
2146 .base_baud = 921600, 2151 .base_baud = 921600,
2147 .uart_offset = 0x200, 2152 .uart_offset = 0x200,
2148 }, 2153 },
2154 [pbn_exar_ibm_saturn] = {
2155 .flags = FL_BASE0,
2156 .num_ports = 1,
2157 .base_baud = 921600,
2158 .uart_offset = 0x200,
2159 },
2160
2149 /* 2161 /*
2150 * PA Semi PWRficient PA6T-1682M on-chip UART 2162 * PA Semi PWRficient PA6T-1682M on-chip UART
2151 */ 2163 */
@@ -2185,6 +2197,37 @@ static struct pciserial_board pci_boards[] __devinitdata = {
2185 .uart_offset = 0x10, 2197 .uart_offset = 0x10,
2186 .first_offset = 0x800, 2198 .first_offset = 0x800,
2187 }, 2199 },
2200 /*
2201 * ADDI-DATA GmbH PCI-Express communication cards <info@addi-data.com>
2202 */
2203 [pbn_ADDIDATA_PCIe_1_3906250] = {
2204 .flags = FL_BASE0,
2205 .num_ports = 1,
2206 .base_baud = 3906250,
2207 .uart_offset = 0x200,
2208 .first_offset = 0x1000,
2209 },
2210 [pbn_ADDIDATA_PCIe_2_3906250] = {
2211 .flags = FL_BASE0,
2212 .num_ports = 2,
2213 .base_baud = 3906250,
2214 .uart_offset = 0x200,
2215 .first_offset = 0x1000,
2216 },
2217 [pbn_ADDIDATA_PCIe_4_3906250] = {
2218 .flags = FL_BASE0,
2219 .num_ports = 4,
2220 .base_baud = 3906250,
2221 .uart_offset = 0x200,
2222 .first_offset = 0x1000,
2223 },
2224 [pbn_ADDIDATA_PCIe_8_3906250] = {
2225 .flags = FL_BASE0,
2226 .num_ports = 8,
2227 .base_baud = 3906250,
2228 .uart_offset = 0x200,
2229 .first_offset = 0x1000,
2230 },
2188}; 2231};
2189 2232
2190static const struct pci_device_id softmodem_blacklist[] = { 2233static const struct pci_device_id softmodem_blacklist[] = {
@@ -2649,6 +2692,9 @@ static struct pci_device_id serial_pci_tbl[] = {
2649 PCI_SUBVENDOR_ID_CONNECT_TECH, 2692 PCI_SUBVENDOR_ID_CONNECT_TECH,
2650 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0, 2693 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0,
2651 pbn_b0_8_1843200_200 }, 2694 pbn_b0_8_1843200_200 },
2695 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
2696 PCI_VENDOR_ID_IBM, PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT,
2697 0, 0, pbn_exar_ibm_saturn },
2652 2698
2653 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530, 2699 { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
2654 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2700 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
@@ -3556,6 +3602,38 @@ static struct pci_device_id serial_pci_tbl[] = {
3556 0, 3602 0,
3557 pbn_b0_8_115200 }, 3603 pbn_b0_8_115200 },
3558 3604
3605 { PCI_VENDOR_ID_ADDIDATA,
3606 PCI_DEVICE_ID_ADDIDATA_APCIe7500,
3607 PCI_ANY_ID,
3608 PCI_ANY_ID,
3609 0,
3610 0,
3611 pbn_ADDIDATA_PCIe_4_3906250 },
3612
3613 { PCI_VENDOR_ID_ADDIDATA,
3614 PCI_DEVICE_ID_ADDIDATA_APCIe7420,
3615 PCI_ANY_ID,
3616 PCI_ANY_ID,
3617 0,
3618 0,
3619 pbn_ADDIDATA_PCIe_2_3906250 },
3620
3621 { PCI_VENDOR_ID_ADDIDATA,
3622 PCI_DEVICE_ID_ADDIDATA_APCIe7300,
3623 PCI_ANY_ID,
3624 PCI_ANY_ID,
3625 0,
3626 0,
3627 pbn_ADDIDATA_PCIe_1_3906250 },
3628
3629 { PCI_VENDOR_ID_ADDIDATA,
3630 PCI_DEVICE_ID_ADDIDATA_APCIe7800,
3631 PCI_ANY_ID,
3632 PCI_ANY_ID,
3633 0,
3634 0,
3635 pbn_ADDIDATA_PCIe_8_3906250 },
3636
3559 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, 3637 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
3560 PCI_VENDOR_ID_IBM, 0x0299, 3638 PCI_VENDOR_ID_IBM, 0x0299,
3561 0, 0, pbn_b0_bt_2_115200 }, 3639 0, 0, pbn_b0_bt_2_115200 },
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 3551c5cb7094..9d948bccafaf 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1531,7 +1531,7 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
1531 void *data; 1531 void *data;
1532 int ret; 1532 int ret;
1533 1533
1534 BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); 1534 BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1));
1535 1535
1536 port = &atmel_ports[pdev->id]; 1536 port = &atmel_ports[pdev->id];
1537 port->backup_imr = 0; 1537 port->backup_imr = 0;
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index d7bcd074d383..7ce9e9f567a3 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -705,7 +705,7 @@ mpc52xx_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
705 return -EINVAL; 705 return -EINVAL;
706 706
707 if ((ser->irq != port->irq) || 707 if ((ser->irq != port->irq) ||
708 (ser->io_type != SERIAL_IO_MEM) || 708 (ser->io_type != UPIO_MEM) ||
709 (ser->baud_base != port->uartclk) || 709 (ser->baud_base != port->uartclk) ||
710 (ser->iomem_base != (void *)port->mapbase) || 710 (ser->iomem_base != (void *)port->mapbase) ||
711 (ser->hub6 != 0)) 711 (ser->hub6 != 0))
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index ff4617e21426..7c7914f5fa02 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -879,10 +879,10 @@ static struct pcmcia_device_id serial_ids[] = {
879 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "cis/DP83903.cis"), 879 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "cis/DP83903.cis"),
880 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"), 880 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"),
881 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"), 881 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"),
882 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "SW_8xx_SER.cis"), /* Sierra Wireless AC850 3G Network Adapter R1 */ 882 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC850 3G Network Adapter R1 */
883 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0x0710, "SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */ 883 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC710/AC750", 0xd85f6206, 0x761b11e0, "cis/SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */
884 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */ 884 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */
885 PCMCIA_DEVICE_CIS_MANF_CARD(0x013f, 0xa555, "SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- post update */ 885 PCMCIA_DEVICE_CIS_MANF_CARD(0x013f, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- post update */
886 PCMCIA_DEVICE_CIS_PROD_ID12("MultiTech", "PCMCIA 56K DataFax", 0x842047ee, 0xc2efcf03, "cis/MT5634ZLX.cis"), 886 PCMCIA_DEVICE_CIS_PROD_ID12("MultiTech", "PCMCIA 56K DataFax", 0x842047ee, 0xc2efcf03, "cis/MT5634ZLX.cis"),
887 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-2", 0x96913a85, 0x27ab5437, "cis/COMpad2.cis"), 887 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-2", 0x96913a85, 0x27ab5437, "cis/COMpad2.cis"),
888 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"), 888 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"),
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 7df3ba4f1f4d..d21b3469f6d7 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -93,8 +93,6 @@ source "drivers/staging/dst/Kconfig"
93 93
94source "drivers/staging/pohmelfs/Kconfig" 94source "drivers/staging/pohmelfs/Kconfig"
95 95
96source "drivers/staging/stlc45xx/Kconfig"
97
98source "drivers/staging/b3dfg/Kconfig" 96source "drivers/staging/b3dfg/Kconfig"
99 97
100source "drivers/staging/phison/Kconfig" 98source "drivers/staging/phison/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 747571172269..8cbf1aebea2e 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_ANDROID) += android/
29obj-$(CONFIG_ANDROID) += dream/ 29obj-$(CONFIG_ANDROID) += dream/
30obj-$(CONFIG_DST) += dst/ 30obj-$(CONFIG_DST) += dst/
31obj-$(CONFIG_POHMELFS) += pohmelfs/ 31obj-$(CONFIG_POHMELFS) += pohmelfs/
32obj-$(CONFIG_STLC45XX) += stlc45xx/
33obj-$(CONFIG_B3DFG) += b3dfg/ 32obj-$(CONFIG_B3DFG) += b3dfg/
34obj-$(CONFIG_IDE_PHISON) += phison/ 33obj-$(CONFIG_IDE_PHISON) += phison/
35obj-$(CONFIG_PLAN9AUTH) += p9auth/ 34obj-$(CONFIG_PLAN9AUTH) += p9auth/
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig
index 247194992374..eb675635ae60 100644
--- a/drivers/staging/android/Kconfig
+++ b/drivers/staging/android/Kconfig
@@ -2,6 +2,7 @@ menu "Android"
2 2
3config ANDROID 3config ANDROID
4 bool "Android Drivers" 4 bool "Android Drivers"
5 depends on BROKEN
5 default N 6 default N
6 ---help--- 7 ---help---
7 Enable support for various drivers needed on the Android platform 8 Enable support for various drivers needed on the Android platform
diff --git a/drivers/staging/b3dfg/b3dfg.c b/drivers/staging/b3dfg/b3dfg.c
index 94c5d27d24d7..cda26bb493b3 100644
--- a/drivers/staging/b3dfg/b3dfg.c
+++ b/drivers/staging/b3dfg/b3dfg.c
@@ -36,6 +36,7 @@
36#include <linux/wait.h> 36#include <linux/wait.h>
37#include <linux/mm.h> 37#include <linux/mm.h>
38#include <linux/uaccess.h> 38#include <linux/uaccess.h>
39#include <linux/sched.h>
39 40
40static unsigned int b3dfg_nbuf = 2; 41static unsigned int b3dfg_nbuf = 2;
41 42
diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c
index 2cda7ad1d32f..80e192d2e77e 100644
--- a/drivers/staging/comedi/drivers/me_daq.c
+++ b/drivers/staging/comedi/drivers/me_daq.c
@@ -51,6 +51,7 @@ from http://www.comedi.org
51*/ 51*/
52 52
53#include <linux/interrupt.h> 53#include <linux/interrupt.h>
54#include <linux/sched.h>
54#include "../comedidev.h" 55#include "../comedidev.h"
55 56
56#include "comedi_pci.h" 57#include "comedi_pci.h"
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index e3ffb067ead1..753ee0512342 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -62,6 +62,7 @@
62/* #define DEBUG_STATUS_B */ 62/* #define DEBUG_STATUS_B */
63 63
64#include <linux/interrupt.h> 64#include <linux/interrupt.h>
65#include <linux/sched.h>
65#include "8255.h" 66#include "8255.h"
66#include "mite.h" 67#include "mite.h"
67#include "comedi_fc.h" 68#include "comedi_fc.h"
diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c
index 52b2eca9e73d..d544698f2414 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -70,6 +70,7 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org
70/* #define DEBUG_FLAGS */ 70/* #define DEBUG_FLAGS */
71 71
72#include <linux/interrupt.h> 72#include <linux/interrupt.h>
73#include <linux/sched.h>
73#include "../comedidev.h" 74#include "../comedidev.h"
74 75
75#include "mite.h" 76#include "mite.h"
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 6294d3814e72..2c3d65a622a7 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -223,7 +223,7 @@ typedef union _TXDMA_PR_NUM_DES_t {
223 223
224extern inline void add_10bit(u32 *v, int n) 224extern inline void add_10bit(u32 *v, int n)
225{ 225{
226 *v = INDEX10(*v + n); 226 *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP);
227} 227}
228 228
229/* 229/*
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 8f2e91fa0a86..10e21db57ac3 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -1177,12 +1177,20 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
1177 1177
1178static inline u32 bump_fbr(u32 *fbr, u32 limit) 1178static inline u32 bump_fbr(u32 *fbr, u32 limit)
1179{ 1179{
1180 u32 v = *fbr; 1180 u32 v = *fbr;
1181 add_10bit(&v, 1); 1181 v++;
1182 if (v > limit) 1182 /* This works for all cases where limit < 1024. The 1023 case
1183 v = (*fbr & ~ET_DMA10_MASK) ^ ET_DMA10_WRAP; 1183 works because 1023++ is 1024 which means the if condition is not
1184 *fbr = v; 1184 taken but the carry of the bit into the wrap bit toggles the wrap
1185 return v; 1185 value correctly */
1186 if ((v & ET_DMA10_MASK) > limit) {
1187 v &= ~ET_DMA10_MASK;
1188 v ^= ET_DMA10_WRAP;
1189 }
1190 /* For the 1023 case */
1191 v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
1192 *fbr = v;
1193 return v;
1186} 1194}
1187 1195
1188/** 1196/**
diff --git a/drivers/staging/hv/ChannelMgmt.h b/drivers/staging/hv/ChannelMgmt.h
index a839d8fe6cec..fa973d86b624 100644
--- a/drivers/staging/hv/ChannelMgmt.h
+++ b/drivers/staging/hv/ChannelMgmt.h
@@ -26,6 +26,7 @@
26#define _CHANNEL_MGMT_H_ 26#define _CHANNEL_MGMT_H_
27 27
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/timer.h>
29#include "RingBuffer.h" 30#include "RingBuffer.h"
30#include "VmbusChannelInterface.h" 31#include "VmbusChannelInterface.h"
31#include "VmbusPacketFormat.h" 32#include "VmbusPacketFormat.h"
@@ -54,7 +55,7 @@ enum vmbus_channel_message_type {
54 ChannelMessageViewRangeRemove = 18, 55 ChannelMessageViewRangeRemove = 18,
55#endif 56#endif
56 ChannelMessageCount 57 ChannelMessageCount
57} __attribute__((packed)); 58};
58 59
59struct vmbus_channel_message_header { 60struct vmbus_channel_message_header {
60 enum vmbus_channel_message_type MessageType; 61 enum vmbus_channel_message_type MessageType;
diff --git a/drivers/staging/hv/NetVsc.c b/drivers/staging/hv/NetVsc.c
index 1610b845198f..d384c0ddf069 100644
--- a/drivers/staging/hv/NetVsc.c
+++ b/drivers/staging/hv/NetVsc.c
@@ -1052,7 +1052,7 @@ static void NetVscOnReceive(struct hv_device *Device,
1052 */ 1052 */
1053 spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags); 1053 spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags);
1054 while (!list_empty(&netDevice->ReceivePacketList)) { 1054 while (!list_empty(&netDevice->ReceivePacketList)) {
1055 list_move_tail(&netDevice->ReceivePacketList, &listHead); 1055 list_move_tail(netDevice->ReceivePacketList.next, &listHead);
1056 if (++count == vmxferpagePacket->RangeCount + 1) 1056 if (++count == vmxferpagePacket->RangeCount + 1)
1057 break; 1057 break;
1058 } 1058 }
@@ -1071,7 +1071,7 @@ static void NetVscOnReceive(struct hv_device *Device,
1071 /* Return it to the freelist */ 1071 /* Return it to the freelist */
1072 spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags); 1072 spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags);
1073 for (i = count; i != 0; i--) { 1073 for (i = count; i != 0; i--) {
1074 list_move_tail(&listHead, 1074 list_move_tail(listHead.next,
1075 &netDevice->ReceivePacketList); 1075 &netDevice->ReceivePacketList);
1076 } 1076 }
1077 spin_unlock_irqrestore(&netDevice->receive_packet_list_lock, 1077 spin_unlock_irqrestore(&netDevice->receive_packet_list_lock,
@@ -1085,8 +1085,7 @@ static void NetVscOnReceive(struct hv_device *Device,
1085 } 1085 }
1086 1086
1087 /* Remove the 1st packet to represent the xfer page packet itself */ 1087 /* Remove the 1st packet to represent the xfer page packet itself */
1088 xferpagePacket = list_entry(&listHead, struct xferpage_packet, 1088 xferpagePacket = (struct xferpage_packet*)listHead.next;
1089 ListEntry);
1090 list_del(&xferpagePacket->ListEntry); 1089 list_del(&xferpagePacket->ListEntry);
1091 1090
1092 /* This is how much we can satisfy */ 1091 /* This is how much we can satisfy */
@@ -1102,8 +1101,7 @@ static void NetVscOnReceive(struct hv_device *Device,
1102 1101
1103 /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */ 1102 /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
1104 for (i = 0; i < (count - 1); i++) { 1103 for (i = 0; i < (count - 1); i++) {
1105 netvscPacket = list_entry(&listHead, struct hv_netvsc_packet, 1104 netvscPacket = (struct hv_netvsc_packet*)listHead.next;
1106 ListEntry);
1107 list_del(&netvscPacket->ListEntry); 1105 list_del(&netvscPacket->ListEntry);
1108 1106
1109 /* Initialize the netvsc packet */ 1107 /* Initialize the netvsc packet */
diff --git a/drivers/staging/hv/TODO b/drivers/staging/hv/TODO
index 4d390b237742..dbfbde937a66 100644
--- a/drivers/staging/hv/TODO
+++ b/drivers/staging/hv/TODO
@@ -1,11 +1,17 @@
1TODO: 1TODO:
2 - fix remaining checkpatch warnings and errors 2 - fix remaining checkpatch warnings and errors
3 - use of /** when it is not a kerneldoc header
3 - remove RingBuffer.c to us in-kernel ringbuffer functions instead. 4 - remove RingBuffer.c to us in-kernel ringbuffer functions instead.
4 - audit the vmbus to verify it is working properly with the 5 - audit the vmbus to verify it is working properly with the
5 driver model 6 driver model
7 - convert vmbus driver interface function pointer tables
8 to constant, a.k.a vmbus_ops
6 - see if the vmbus can be merged with the other virtual busses 9 - see if the vmbus can be merged with the other virtual busses
7 in the kernel 10 in the kernel
8 - audit the network driver 11 - audit the network driver
12 - use existing net_device_stats struct in network device
13 - checking for carrier inside open is wrong, network device API
14 confusion??
9 - audit the block driver 15 - audit the block driver
10 - audit the scsi driver 16 - audit the scsi driver
11 17
diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c
index 8fe543bd9910..3a4793a0fd05 100644
--- a/drivers/staging/hv/osd.c
+++ b/drivers/staging/hv/osd.c
@@ -30,6 +30,7 @@
30#include <linux/ioport.h> 30#include <linux/ioport.h>
31#include <linux/irq.h> 31#include <linux/irq.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/sched.h>
33#include <linux/wait.h> 34#include <linux/wait.h>
34#include <linux/spinlock.h> 35#include <linux/spinlock.h>
35#include <linux/workqueue.h> 36#include <linux/workqueue.h>
diff --git a/drivers/staging/hv/osd.h b/drivers/staging/hv/osd.h
index 9504604c72bd..ce064e8ea644 100644
--- a/drivers/staging/hv/osd.h
+++ b/drivers/staging/hv/osd.h
@@ -25,6 +25,7 @@
25#ifndef _OSD_H_ 25#ifndef _OSD_H_
26#define _OSD_H_ 26#define _OSD_H_
27 27
28#include <linux/workqueue.h>
28 29
29/* Defines */ 30/* Defines */
30#define ALIGN_UP(value, align) (((value) & (align-1)) ? \ 31#define ALIGN_UP(value, align) (((value) & (align-1)) ? \
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 582318f10222..894eecfc63ca 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -507,12 +507,12 @@ static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
507 507
508 child_device_obj = &child_device_ctx->device_obj; 508 child_device_obj = &child_device_ctx->device_obj;
509 child_device_obj->context = context; 509 child_device_obj->context = context;
510 memcpy(&child_device_obj->deviceType, &type, sizeof(struct hv_guid)); 510 memcpy(&child_device_obj->deviceType, type, sizeof(struct hv_guid));
511 memcpy(&child_device_obj->deviceInstance, &instance, 511 memcpy(&child_device_obj->deviceInstance, instance,
512 sizeof(struct hv_guid)); 512 sizeof(struct hv_guid));
513 513
514 memcpy(&child_device_ctx->class_id, &type, sizeof(struct hv_guid)); 514 memcpy(&child_device_ctx->class_id, type, sizeof(struct hv_guid));
515 memcpy(&child_device_ctx->device_id, &instance, sizeof(struct hv_guid)); 515 memcpy(&child_device_ctx->device_id, instance, sizeof(struct hv_guid));
516 516
517 DPRINT_EXIT(VMBUS_DRV); 517 DPRINT_EXIT(VMBUS_DRV);
518 518
@@ -537,18 +537,7 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
537 DPRINT_DBG(VMBUS_DRV, "child device (%p) registering", 537 DPRINT_DBG(VMBUS_DRV, "child device (%p) registering",
538 child_device_ctx); 538 child_device_ctx);
539 539
540 /* Make sure we are not registered already */ 540 /* Set the device name. Otherwise, device_register() will fail. */
541 if (strlen(dev_name(&child_device_ctx->device)) != 0) {
542 DPRINT_ERR(VMBUS_DRV,
543 "child device (%p) already registered - busid %s",
544 child_device_ctx,
545 dev_name(&child_device_ctx->device));
546
547 ret = -1;
548 goto Cleanup;
549 }
550
551 /* Set the device bus id. Otherwise, device_register()will fail. */
552 dev_set_name(&child_device_ctx->device, "vmbus_0_%d", 541 dev_set_name(&child_device_ctx->device, "vmbus_0_%d",
553 atomic_inc_return(&device_num)); 542 atomic_inc_return(&device_num));
554 543
@@ -573,7 +562,6 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
573 DPRINT_INFO(VMBUS_DRV, "child device (%p) registered", 562 DPRINT_INFO(VMBUS_DRV, "child device (%p) registered",
574 &child_device_ctx->device); 563 &child_device_ctx->device);
575 564
576Cleanup:
577 DPRINT_EXIT(VMBUS_DRV); 565 DPRINT_EXIT(VMBUS_DRV);
578 566
579 return ret; 567 return ret;
@@ -623,8 +611,6 @@ static void vmbus_child_device_destroy(struct hv_device *device_obj)
623static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env) 611static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
624{ 612{
625 struct device_context *device_ctx = device_to_device_context(device); 613 struct device_context *device_ctx = device_to_device_context(device);
626 int i = 0;
627 int len = 0;
628 int ret; 614 int ret;
629 615
630 DPRINT_ENTER(VMBUS_DRV); 616 DPRINT_ENTER(VMBUS_DRV);
@@ -644,8 +630,6 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
644 device_ctx->class_id.data[14], 630 device_ctx->class_id.data[14],
645 device_ctx->class_id.data[15]); 631 device_ctx->class_id.data[15]);
646 632
647 env->envp_idx = i;
648 env->buflen = len;
649 ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={" 633 ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={"
650 "%02x%02x%02x%02x-%02x%02x-%02x%02x-" 634 "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
651 "%02x%02x%02x%02x%02x%02x%02x%02x}", 635 "%02x%02x%02x%02x%02x%02x%02x%02x}",
@@ -691,8 +675,6 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
691 if (ret) 675 if (ret)
692 return ret; 676 return ret;
693 677
694 env->envp[env->envp_idx] = NULL;
695
696 DPRINT_EXIT(VMBUS_DRV); 678 DPRINT_EXIT(VMBUS_DRV);
697 679
698 return 0; 680 return 0;
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 1fa18f255814..768f44894d08 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -18,6 +18,8 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/poll.h> 20#include <linux/poll.h>
21#include <linux/sched.h>
22#include <linux/wait.h>
21#include <linux/cdev.h> 23#include <linux/cdev.h>
22#include "iio.h" 24#include "iio.h"
23#include "trigger_consumer.h" 25#include "trigger_consumer.h"
diff --git a/drivers/staging/otus/Kconfig b/drivers/staging/otus/Kconfig
index d549d08fd495..f6cc2625e341 100644
--- a/drivers/staging/otus/Kconfig
+++ b/drivers/staging/otus/Kconfig
@@ -1,6 +1,6 @@
1config OTUS 1config OTUS
2 tristate "Atheros OTUS 802.11n USB wireless support" 2 tristate "Atheros OTUS 802.11n USB wireless support"
3 depends on USB && WLAN_80211 && MAC80211 3 depends on USB && WLAN && MAC80211
4 default N 4 default N
5 ---help--- 5 ---help---
6 Enable support for Atheros 802.11n USB hardware: 6 Enable support for Atheros 802.11n USB hardware:
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index dd7d3fde9699..4ce399b6d237 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2071,11 +2071,15 @@ static void panel_detach(struct parport *port)
2071 return; 2071 return;
2072 } 2072 }
2073 2073
2074 if (keypad_enabled && keypad_initialized) 2074 if (keypad_enabled && keypad_initialized) {
2075 misc_deregister(&keypad_dev); 2075 misc_deregister(&keypad_dev);
2076 keypad_initialized = 0;
2077 }
2076 2078
2077 if (lcd_enabled && lcd_initialized) 2079 if (lcd_enabled && lcd_initialized) {
2078 misc_deregister(&lcd_dev); 2080 misc_deregister(&lcd_dev);
2081 lcd_initialized = 0;
2082 }
2079 2083
2080 parport_release(pprt); 2084 parport_release(pprt);
2081 parport_unregister_device(pprt); 2085 parport_unregister_device(pprt);
@@ -2211,13 +2215,16 @@ static void __exit panel_cleanup_module(void)
2211 del_timer(&scan_timer); 2215 del_timer(&scan_timer);
2212 2216
2213 if (pprt != NULL) { 2217 if (pprt != NULL) {
2214 if (keypad_enabled) 2218 if (keypad_enabled) {
2215 misc_deregister(&keypad_dev); 2219 misc_deregister(&keypad_dev);
2220 keypad_initialized = 0;
2221 }
2216 2222
2217 if (lcd_enabled) { 2223 if (lcd_enabled) {
2218 panel_lcd_print("\x0cLCD driver " PANEL_VERSION 2224 panel_lcd_print("\x0cLCD driver " PANEL_VERSION
2219 "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-"); 2225 "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-");
2220 misc_deregister(&lcd_dev); 2226 misc_deregister(&lcd_dev);
2227 lcd_initialized = 0;
2221 } 2228 }
2222 2229
2223 /* TODO: free all input signals */ 2230 /* TODO: free all input signals */
diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c
index 0d111ddfabb2..2eb8e3d43c4d 100644
--- a/drivers/staging/poch/poch.c
+++ b/drivers/staging/poch/poch.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/ioctl.h> 21#include <linux/ioctl.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/sched.h>
23 24
24#include "poch.h" 25#include "poch.h"
25 26
diff --git a/drivers/staging/rt2860/Kconfig b/drivers/staging/rt2860/Kconfig
index 7f44e5e72463..efe38e25c5ed 100644
--- a/drivers/staging/rt2860/Kconfig
+++ b/drivers/staging/rt2860/Kconfig
@@ -1,5 +1,5 @@
1config RT2860 1config RT2860
2 tristate "Ralink 2860 wireless support" 2 tristate "Ralink 2860 wireless support"
3 depends on PCI && X86 && WLAN_80211 3 depends on PCI && X86 && WLAN
4 ---help--- 4 ---help---
5 This is an experimental driver for the Ralink 2860 wireless chip. 5 This is an experimental driver for the Ralink 2860 wireless chip.
diff --git a/drivers/staging/rt2860/common/cmm_data_2860.c b/drivers/staging/rt2860/common/cmm_data_2860.c
index fb1735533b74..857ff450b6c9 100644
--- a/drivers/staging/rt2860/common/cmm_data_2860.c
+++ b/drivers/staging/rt2860/common/cmm_data_2860.c
@@ -363,6 +363,8 @@ int RtmpPCIMgmtKickOut(
363 ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; 363 ULONG SwIdx = pAd->MgmtRing.TxCpuIdx;
364 364
365 pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; 365 pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa;
366 if (!pTxD)
367 return 0;
366 368
367 pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; 369 pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket;
368 pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; 370 pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL;
diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c
index 9d589c240ed0..019cc4474ce8 100644
--- a/drivers/staging/rt2860/common/cmm_info.c
+++ b/drivers/staging/rt2860/common/cmm_info.c
@@ -25,6 +25,7 @@
25 ************************************************************************* 25 *************************************************************************
26*/ 26*/
27 27
28#include <linux/sched.h>
28#include "../rt_config.h" 29#include "../rt_config.h"
29 30
30INT Show_SSID_Proc( 31INT Show_SSID_Proc(
diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c
index b396a9b570e2..ed27b8545a1b 100644
--- a/drivers/staging/rt2860/rt_linux.c
+++ b/drivers/staging/rt2860/rt_linux.c
@@ -25,6 +25,7 @@
25 ************************************************************************* 25 *************************************************************************
26 */ 26 */
27 27
28#include <linux/sched.h>
28#include "rt_config.h" 29#include "rt_config.h"
29 30
30ULONG RTDebugLevel = RT_DEBUG_ERROR; 31ULONG RTDebugLevel = RT_DEBUG_ERROR;
diff --git a/drivers/staging/rt2870/Kconfig b/drivers/staging/rt2870/Kconfig
index 76841f6dea93..aea5c8221810 100644
--- a/drivers/staging/rt2870/Kconfig
+++ b/drivers/staging/rt2870/Kconfig
@@ -1,5 +1,5 @@
1config RT2870 1config RT2870
2 tristate "Ralink 2870/3070 wireless support" 2 tristate "Ralink 2870/3070 wireless support"
3 depends on USB && X86 && WLAN_80211 3 depends on USB && X86 && WLAN
4 ---help--- 4 ---help---
5 This is an experimental driver for the Ralink xx70 wireless chips. 5 This is an experimental driver for the Ralink xx70 wireless chips.
diff --git a/drivers/staging/rt3090/Kconfig b/drivers/staging/rt3090/Kconfig
index 255e8eaa4836..2b3f745d72b7 100644
--- a/drivers/staging/rt3090/Kconfig
+++ b/drivers/staging/rt3090/Kconfig
@@ -1,5 +1,5 @@
1config RT3090 1config RT3090
2 tristate "Ralink 3090 wireless support" 2 tristate "Ralink 3090 wireless support"
3 depends on PCI && X86 && WLAN_80211 3 depends on PCI && X86 && WLAN
4 ---help--- 4 ---help---
5 This is an experimental driver for the Ralink 3090 wireless chip. 5 This is an experimental driver for the Ralink 3090 wireless chip.
diff --git a/drivers/staging/rt3090/common/cmm_info.c b/drivers/staging/rt3090/common/cmm_info.c
index 5be0714666cb..3e51e98b474c 100644
--- a/drivers/staging/rt3090/common/cmm_info.c
+++ b/drivers/staging/rt3090/common/cmm_info.c
@@ -34,6 +34,7 @@
34 --------- ---------- ---------------------------------------------- 34 --------- ---------- ----------------------------------------------
35 */ 35 */
36 36
37#include <linux/sched.h>
37#include "../rt_config.h" 38#include "../rt_config.h"
38 39
39 40
diff --git a/drivers/staging/rt3090/rt_linux.c b/drivers/staging/rt3090/rt_linux.c
index d2241ecdf583..9b94aa6eb904 100644
--- a/drivers/staging/rt3090/rt_linux.c
+++ b/drivers/staging/rt3090/rt_linux.c
@@ -25,6 +25,7 @@
25 ************************************************************************* 25 *************************************************************************
26 */ 26 */
27 27
28#include <linux/sched.h>
28#include "rt_config.h" 29#include "rt_config.h"
29 30
30ULONG RTDebugLevel = RT_DEBUG_ERROR; 31ULONG RTDebugLevel = RT_DEBUG_ERROR;
diff --git a/drivers/staging/rtl8187se/Kconfig b/drivers/staging/rtl8187se/Kconfig
index 236e42725447..203c79b8180f 100644
--- a/drivers/staging/rtl8187se/Kconfig
+++ b/drivers/staging/rtl8187se/Kconfig
@@ -1,6 +1,6 @@
1config RTL8187SE 1config RTL8187SE
2 tristate "RealTek RTL8187SE Wireless LAN NIC driver" 2 tristate "RealTek RTL8187SE Wireless LAN NIC driver"
3 depends on PCI 3 depends on PCI && WLAN
4 depends on WIRELESS_EXT 4 depends on WIRELESS_EXT
5 default N 5 default N
6 ---help--- 6 ---help---
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
index 013c3e19ae25..4c5d63fd5833 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
@@ -53,10 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
53 53
54 list_del(ptr); 54 list_del(ptr);
55 55
56 if (entry->ops) { 56 if (entry->ops)
57 entry->ops->deinit(entry->priv); 57 entry->ops->deinit(entry->priv);
58 module_put(entry->ops->owner);
59 }
60 kfree(entry); 58 kfree(entry);
61 } 59 }
62} 60}
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c
index 6fbe4890cb66..18392fce487d 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c
@@ -189,10 +189,8 @@ void free_ieee80211(struct net_device *dev)
189 for (i = 0; i < WEP_KEYS; i++) { 189 for (i = 0; i < WEP_KEYS; i++) {
190 struct ieee80211_crypt_data *crypt = ieee->crypt[i]; 190 struct ieee80211_crypt_data *crypt = ieee->crypt[i];
191 if (crypt) { 191 if (crypt) {
192 if (crypt->ops) { 192 if (crypt->ops)
193 crypt->ops->deinit(crypt->priv); 193 crypt->ops->deinit(crypt->priv);
194 module_put(crypt->ops->owner);
195 }
196 kfree(crypt); 194 kfree(crypt);
197 ieee->crypt[i] = NULL; 195 ieee->crypt[i] = NULL;
198 } 196 }
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
index 59b2ab48cdcf..334e4c7ec61b 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -2839,16 +2839,12 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
2839 goto skip_host_crypt; 2839 goto skip_host_crypt;
2840 2840
2841 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 2841 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
2842 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { 2842 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0)
2843 request_module("ieee80211_crypt_wep");
2844 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 2843 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
2845 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { 2844 else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0)
2846 request_module("ieee80211_crypt_tkip");
2847 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 2845 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
2848 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { 2846 else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0)
2849 request_module("ieee80211_crypt_ccmp");
2850 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 2847 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
2851 }
2852 if (ops == NULL) { 2848 if (ops == NULL) {
2853 printk("unknown crypto alg '%s'\n", param->u.crypt.alg); 2849 printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
2854 param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; 2850 param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG;
@@ -2869,7 +2865,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
2869 } 2865 }
2870 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 2866 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
2871 new_crypt->ops = ops; 2867 new_crypt->ops = ops;
2872 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 2868 if (new_crypt->ops)
2873 new_crypt->priv = 2869 new_crypt->priv =
2874 new_crypt->ops->init(param->u.crypt.idx); 2870 new_crypt->ops->init(param->u.crypt.idx);
2875 2871
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
index 8d8bdd0a130e..a08b97a09512 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
@@ -331,12 +331,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
331 return -ENOMEM; 331 return -ENOMEM;
332 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 332 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
333 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 333 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
334 if (!new_crypt->ops) { 334 if (!new_crypt->ops)
335 request_module("ieee80211_crypt_wep");
336 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 335 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
337 }
338 336
339 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 337 if (new_crypt->ops)
340 new_crypt->priv = new_crypt->ops->init(key); 338 new_crypt->priv = new_crypt->ops->init(key);
341 339
342 if (!new_crypt->ops || !new_crypt->priv) { 340 if (!new_crypt->ops || !new_crypt->priv) {
@@ -483,7 +481,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
483 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 481 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
484 int i, idx, ret = 0; 482 int i, idx, ret = 0;
485 int group_key = 0; 483 int group_key = 0;
486 const char *alg, *module; 484 const char *alg;
487 struct ieee80211_crypto_ops *ops; 485 struct ieee80211_crypto_ops *ops;
488 struct ieee80211_crypt_data **crypt; 486 struct ieee80211_crypt_data **crypt;
489 487
@@ -539,15 +537,12 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
539 switch (ext->alg) { 537 switch (ext->alg) {
540 case IW_ENCODE_ALG_WEP: 538 case IW_ENCODE_ALG_WEP:
541 alg = "WEP"; 539 alg = "WEP";
542 module = "ieee80211_crypt_wep";
543 break; 540 break;
544 case IW_ENCODE_ALG_TKIP: 541 case IW_ENCODE_ALG_TKIP:
545 alg = "TKIP"; 542 alg = "TKIP";
546 module = "ieee80211_crypt_tkip";
547 break; 543 break;
548 case IW_ENCODE_ALG_CCMP: 544 case IW_ENCODE_ALG_CCMP:
549 alg = "CCMP"; 545 alg = "CCMP";
550 module = "ieee80211_crypt_ccmp";
551 break; 546 break;
552 default: 547 default:
553 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", 548 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
@@ -558,10 +553,8 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
558// printk("8-09-08-9=====>%s, alg name:%s\n",__func__, alg); 553// printk("8-09-08-9=====>%s, alg name:%s\n",__func__, alg);
559 554
560 ops = ieee80211_get_crypto_ops(alg); 555 ops = ieee80211_get_crypto_ops(alg);
561 if (ops == NULL) { 556 if (ops == NULL)
562 request_module(module);
563 ops = ieee80211_get_crypto_ops(alg); 557 ops = ieee80211_get_crypto_ops(alg);
564 }
565 if (ops == NULL) { 558 if (ops == NULL) {
566 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", 559 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
567 dev->name, ext->alg); 560 dev->name, ext->alg);
@@ -581,7 +574,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
581 goto done; 574 goto done;
582 } 575 }
583 new_crypt->ops = ops; 576 new_crypt->ops = ops;
584 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 577 if (new_crypt->ops)
585 new_crypt->priv = new_crypt->ops->init(idx); 578 new_crypt->priv = new_crypt->ops->init(idx);
586 if (new_crypt->priv == NULL) { 579 if (new_crypt->priv == NULL) {
587 kfree(new_crypt); 580 kfree(new_crypt);
diff --git a/drivers/staging/rtl8192e/Kconfig b/drivers/staging/rtl8192e/Kconfig
index 3100aa58c940..37e4fde45073 100644
--- a/drivers/staging/rtl8192e/Kconfig
+++ b/drivers/staging/rtl8192e/Kconfig
@@ -1,6 +1,6 @@
1config RTL8192E 1config RTL8192E
2 tristate "RealTek RTL8192E Wireless LAN NIC driver" 2 tristate "RealTek RTL8192E Wireless LAN NIC driver"
3 depends on PCI 3 depends on PCI && WLAN
4 depends on WIRELESS_EXT 4 depends on WIRELESS_EXT
5 default N 5 default N
6 ---help--- 6 ---help---
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c
index 1a8ea8a40c3c..b1c54932da3e 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c
@@ -53,14 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
53 53
54 list_del(ptr); 54 list_del(ptr);
55 55
56 if (entry->ops) { 56 if (entry->ops)
57 entry->ops->deinit(entry->priv); 57 entry->ops->deinit(entry->priv);
58#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
59 module_put(entry->ops->owner);
60#else
61 __MOD_DEC_USE_COUNT(entry->ops->owner);
62#endif
63 }
64 kfree(entry); 58 kfree(entry);
65 } 59 }
66} 60}
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
index 16256a31f993..12c2a18e1fa2 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
@@ -242,14 +242,8 @@ void free_ieee80211(struct net_device *dev)
242 for (i = 0; i < WEP_KEYS; i++) { 242 for (i = 0; i < WEP_KEYS; i++) {
243 struct ieee80211_crypt_data *crypt = ieee->crypt[i]; 243 struct ieee80211_crypt_data *crypt = ieee->crypt[i];
244 if (crypt) { 244 if (crypt) {
245 if (crypt->ops) { 245 if (crypt->ops)
246 crypt->ops->deinit(crypt->priv); 246 crypt->ops->deinit(crypt->priv);
247#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
248 module_put(crypt->ops->owner);
249#else
250 __MOD_DEC_USE_COUNT(crypt->ops->owner);
251#endif
252 }
253 kfree(crypt); 247 kfree(crypt);
254 ieee->crypt[i] = NULL; 248 ieee->crypt[i] = NULL;
255 } 249 }
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
index 2fc04df872ca..eae7c4579a68 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
@@ -3284,17 +3284,14 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
3284 goto skip_host_crypt; 3284 goto skip_host_crypt;
3285 3285
3286 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3286 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3287 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { 3287 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0)
3288 request_module("ieee80211_crypt_wep");
3289 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3288 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3290 //set WEP40 first, it will be modified according to WEP104 or WEP40 at other place 3289 /* set WEP40 first, it will be modified according to WEP104 or
3291 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { 3290 * WEP40 at other place */
3292 request_module("ieee80211_crypt_tkip"); 3291 else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0)
3293 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3292 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3294 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { 3293 else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0)
3295 request_module("ieee80211_crypt_ccmp");
3296 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3294 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3297 }
3298 if (ops == NULL) { 3295 if (ops == NULL) {
3299 printk("unknown crypto alg '%s'\n", param->u.crypt.alg); 3296 printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
3300 param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; 3297 param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG;
@@ -3315,11 +3312,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
3315 } 3312 }
3316 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 3313 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
3317 new_crypt->ops = ops; 3314 new_crypt->ops = ops;
3318#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) 3315 if (new_crypt->ops)
3319 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
3320#else
3321 if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
3322#endif
3323 new_crypt->priv = 3316 new_crypt->priv =
3324 new_crypt->ops->init(param->u.crypt.idx); 3317 new_crypt->ops->init(param->u.crypt.idx);
3325 3318
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
index 223483126b0e..4e34a1f4c66b 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
@@ -482,15 +482,9 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
482 return -ENOMEM; 482 return -ENOMEM;
483 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 483 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
484 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 484 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
485 if (!new_crypt->ops) { 485 if (!new_crypt->ops)
486 request_module("ieee80211_crypt_wep");
487 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 486 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
488 } 487 if (new_crypt->ops)
489#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
490 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
491#else
492 if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
493#endif
494 new_crypt->priv = new_crypt->ops->init(key); 488 new_crypt->priv = new_crypt->ops->init(key);
495 489
496 if (!new_crypt->ops || !new_crypt->priv) { 490 if (!new_crypt->ops || !new_crypt->priv) {
@@ -644,7 +638,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
644 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 638 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
645 int i, idx; 639 int i, idx;
646 int group_key = 0; 640 int group_key = 0;
647 const char *alg, *module; 641 const char *alg;
648 struct ieee80211_crypto_ops *ops; 642 struct ieee80211_crypto_ops *ops;
649 struct ieee80211_crypt_data **crypt; 643 struct ieee80211_crypt_data **crypt;
650 644
@@ -711,15 +705,12 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
711 switch (ext->alg) { 705 switch (ext->alg) {
712 case IW_ENCODE_ALG_WEP: 706 case IW_ENCODE_ALG_WEP:
713 alg = "WEP"; 707 alg = "WEP";
714 module = "ieee80211_crypt_wep";
715 break; 708 break;
716 case IW_ENCODE_ALG_TKIP: 709 case IW_ENCODE_ALG_TKIP:
717 alg = "TKIP"; 710 alg = "TKIP";
718 module = "ieee80211_crypt_tkip";
719 break; 711 break;
720 case IW_ENCODE_ALG_CCMP: 712 case IW_ENCODE_ALG_CCMP:
721 alg = "CCMP"; 713 alg = "CCMP";
722 module = "ieee80211_crypt_ccmp";
723 break; 714 break;
724 default: 715 default:
725 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", 716 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
@@ -730,10 +721,8 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
730 printk("alg name:%s\n",alg); 721 printk("alg name:%s\n",alg);
731 722
732 ops = ieee80211_get_crypto_ops(alg); 723 ops = ieee80211_get_crypto_ops(alg);
733 if (ops == NULL) { 724 if (ops == NULL)
734 request_module(module);
735 ops = ieee80211_get_crypto_ops(alg); 725 ops = ieee80211_get_crypto_ops(alg);
736 }
737 if (ops == NULL) { 726 if (ops == NULL) {
738 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", 727 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
739 dev->name, ext->alg); 728 dev->name, ext->alg);
@@ -758,7 +747,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
758 goto done; 747 goto done;
759 } 748 }
760 new_crypt->ops = ops; 749 new_crypt->ops = ops;
761 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 750 if (new_crypt->ops)
762 new_crypt->priv = new_crypt->ops->init(idx); 751 new_crypt->priv = new_crypt->ops->init(idx);
763 if (new_crypt->priv == NULL) { 752 if (new_crypt->priv == NULL) {
764 kfree(new_crypt); 753 kfree(new_crypt);
diff --git a/drivers/staging/rtl8192su/Kconfig b/drivers/staging/rtl8192su/Kconfig
index 770f41280f21..b8c95f942069 100644
--- a/drivers/staging/rtl8192su/Kconfig
+++ b/drivers/staging/rtl8192su/Kconfig
@@ -1,6 +1,6 @@
1config RTL8192SU 1config RTL8192SU
2 tristate "RealTek RTL8192SU Wireless LAN NIC driver" 2 tristate "RealTek RTL8192SU Wireless LAN NIC driver"
3 depends on PCI 3 depends on PCI && WLAN
4 depends on WIRELESS_EXT 4 depends on WIRELESS_EXT
5 default N 5 default N
6 ---help--- 6 ---help---
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
index d76a54d59d2f..521e7b989934 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
@@ -53,10 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
53 53
54 list_del(ptr); 54 list_del(ptr);
55 55
56 if (entry->ops) { 56 if (entry->ops)
57 entry->ops->deinit(entry->priv); 57 entry->ops->deinit(entry->priv);
58 module_put(entry->ops->owner);
59 }
60 kfree(entry); 58 kfree(entry);
61 } 59 }
62} 60}
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
index 68dc8fa094cc..c3383bb8b760 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
@@ -216,10 +216,8 @@ void free_ieee80211(struct net_device *dev)
216 for (i = 0; i < WEP_KEYS; i++) { 216 for (i = 0; i < WEP_KEYS; i++) {
217 struct ieee80211_crypt_data *crypt = ieee->crypt[i]; 217 struct ieee80211_crypt_data *crypt = ieee->crypt[i];
218 if (crypt) { 218 if (crypt) {
219 if (crypt->ops) { 219 if (crypt->ops)
220 crypt->ops->deinit(crypt->priv); 220 crypt->ops->deinit(crypt->priv);
221 module_put(crypt->ops->owner);
222 }
223 kfree(crypt); 221 kfree(crypt);
224 ieee->crypt[i] = NULL; 222 ieee->crypt[i] = NULL;
225 } 223 }
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
index c64ae03f68a0..fd8e11252f1b 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
@@ -3026,17 +3026,14 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
3026 goto skip_host_crypt; 3026 goto skip_host_crypt;
3027 3027
3028 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3028 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3029 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { 3029 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0)
3030 request_module("ieee80211_crypt_wep");
3031 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3030 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3032 //set WEP40 first, it will be modified according to WEP104 or WEP40 at other place 3031 /* set WEP40 first, it will be modified according to WEP104 or
3033 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { 3032 * WEP40 at other place */
3034 request_module("ieee80211_crypt_tkip"); 3033 else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0)
3035 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3034 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3036 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { 3035 else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0)
3037 request_module("ieee80211_crypt_ccmp");
3038 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3036 ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
3039 }
3040 if (ops == NULL) { 3037 if (ops == NULL) {
3041 printk("unknown crypto alg '%s'\n", param->u.crypt.alg); 3038 printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
3042 param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; 3039 param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG;
@@ -3058,7 +3055,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
3058 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 3055 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
3059 new_crypt->ops = ops; 3056 new_crypt->ops = ops;
3060 3057
3061 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 3058 if (new_crypt->ops)
3062 new_crypt->priv = 3059 new_crypt->priv =
3063 new_crypt->ops->init(param->u.crypt.idx); 3060 new_crypt->ops->init(param->u.crypt.idx);
3064 3061
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
index 107759024335..6146c6435dde 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
@@ -358,11 +358,9 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
358 return -ENOMEM; 358 return -ENOMEM;
359 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 359 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
360 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 360 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
361 if (!new_crypt->ops) { 361 if (!new_crypt->ops)
362 request_module("ieee80211_crypt_wep");
363 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 362 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
364 } 363 if (new_crypt->ops)
365 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
366 new_crypt->priv = new_crypt->ops->init(key); 364 new_crypt->priv = new_crypt->ops->init(key);
367 365
368 if (!new_crypt->ops || !new_crypt->priv) { 366 if (!new_crypt->ops || !new_crypt->priv) {
@@ -507,7 +505,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
507 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 505 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
508 int i, idx; 506 int i, idx;
509 int group_key = 0; 507 int group_key = 0;
510 const char *alg, *module; 508 const char *alg;
511 struct ieee80211_crypto_ops *ops; 509 struct ieee80211_crypto_ops *ops;
512 struct ieee80211_crypt_data **crypt; 510 struct ieee80211_crypt_data **crypt;
513 511
@@ -570,15 +568,12 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
570 switch (ext->alg) { 568 switch (ext->alg) {
571 case IW_ENCODE_ALG_WEP: 569 case IW_ENCODE_ALG_WEP:
572 alg = "WEP"; 570 alg = "WEP";
573 module = "ieee80211_crypt_wep";
574 break; 571 break;
575 case IW_ENCODE_ALG_TKIP: 572 case IW_ENCODE_ALG_TKIP:
576 alg = "TKIP"; 573 alg = "TKIP";
577 module = "ieee80211_crypt_tkip";
578 break; 574 break;
579 case IW_ENCODE_ALG_CCMP: 575 case IW_ENCODE_ALG_CCMP:
580 alg = "CCMP"; 576 alg = "CCMP";
581 module = "ieee80211_crypt_ccmp";
582 break; 577 break;
583 default: 578 default:
584 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", 579 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
@@ -589,10 +584,8 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
589 printk("alg name:%s\n",alg); 584 printk("alg name:%s\n",alg);
590 585
591 ops = ieee80211_get_crypto_ops(alg); 586 ops = ieee80211_get_crypto_ops(alg);
592 if (ops == NULL) { 587 if (ops == NULL)
593 request_module("%s", module);
594 ops = ieee80211_get_crypto_ops(alg); 588 ops = ieee80211_get_crypto_ops(alg);
595 }
596 if (ops == NULL) { 589 if (ops == NULL) {
597 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", 590 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
598 dev->name, ext->alg); 591 dev->name, ext->alg);
@@ -612,7 +605,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
612 goto done; 605 goto done;
613 } 606 }
614 new_crypt->ops = ops; 607 new_crypt->ops = ops;
615 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 608 if (new_crypt->ops)
616 new_crypt->priv = new_crypt->ops->init(idx); 609 new_crypt->priv = new_crypt->ops->init(idx);
617 if (new_crypt->priv == NULL) { 610 if (new_crypt->priv == NULL) {
618 kfree(new_crypt); 611 kfree(new_crypt);
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 87f8a1192762..f890a16096c0 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -38,6 +38,7 @@
38#include <linux/mm.h> 38#include <linux/mm.h>
39#include <linux/poll.h> 39#include <linux/poll.h>
40#include <linux/wait.h> 40#include <linux/wait.h>
41#include <linux/sched.h>
41#include <linux/pci.h> 42#include <linux/pci.h>
42#include <linux/firmware.h> 43#include <linux/firmware.h>
43#include <asm/ioctl.h> 44#include <asm/ioctl.h>
diff --git a/drivers/staging/stlc45xx/Kconfig b/drivers/staging/stlc45xx/Kconfig
deleted file mode 100644
index 947fb75a9c68..000000000000
--- a/drivers/staging/stlc45xx/Kconfig
+++ /dev/null
@@ -1,8 +0,0 @@
1config STLC45XX
2 tristate "stlc4550/4560 support"
3 depends on MAC80211 && WLAN_80211 && SPI_MASTER && GENERIC_HARDIRQS
4 ---help---
5 This is a driver for stlc4550 and stlc4560 chipsets.
6
7 To compile this driver as a module, choose M here: the module will be
8 called stlc45xx. If unsure, say N.
diff --git a/drivers/staging/stlc45xx/Makefile b/drivers/staging/stlc45xx/Makefile
deleted file mode 100644
index 7ee32903055a..000000000000
--- a/drivers/staging/stlc45xx/Makefile
+++ /dev/null
@@ -1 +0,0 @@
1obj-$(CONFIG_STLC45XX) += stlc45xx.o
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
deleted file mode 100644
index be99eb33d817..000000000000
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ /dev/null
@@ -1,2594 +0,0 @@
1/*
2 * This file is part of stlc45xx
3 *
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Kalle Valo <kalle.valo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * 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., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include "stlc45xx.h"
25
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/interrupt.h>
29#include <linux/firmware.h>
30#include <linux/delay.h>
31#include <linux/irq.h>
32#include <linux/spi/spi.h>
33#include <linux/etherdevice.h>
34#include <linux/gpio.h>
35#include <linux/moduleparam.h>
36
37#include "stlc45xx_lmac.h"
38
39/*
40 * gpios should be handled in board files and provided via platform data,
41 * but because it's currently impossible for stlc45xx to have a header file
42 * in include/linux, let's use module paramaters for now
43 */
44static int stlc45xx_gpio_power = 97;
45module_param(stlc45xx_gpio_power, int, 0444);
46MODULE_PARM_DESC(stlc45xx_gpio_power, "stlc45xx gpio number for power line");
47
48static int stlc45xx_gpio_irq = 87;
49module_param(stlc45xx_gpio_irq, int, 0444);
50MODULE_PARM_DESC(stlc45xx_gpio_irq, "stlc45xx gpio number for irq line");
51
52static const u8 default_cal_channels[] = {
53 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x09,
55 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01, 0x10,
56 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xe0, 0x00, 0xe0, 0x00,
57 0xe0, 0x00, 0xe0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0,
58 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42,
59 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00,
60 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37, 0xa9,
61 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc, 0x00,
62 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc,
63 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0,
64 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4,
65 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00, 0x5d,
66 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00, 0xaa,
67 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00,
68 0xaa, 0x00, 0xaa, 0xa7, 0x00, 0xa9, 0x3d, 0xc0, 0x17, 0xc0, 0x17,
69 0xc0, 0x17, 0xc0, 0x17, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00,
70 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x7a, 0x00,
71 0x06, 0x2c, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0x00,
72 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96,
73 0x00, 0x96, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x71, 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8,
82 0xff, 0x00, 0x00, 0x00, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
83 0x10, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0,
84 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0x54, 0x01, 0xab, 0xf6,
85 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0x00, 0xcb, 0x00,
86 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb,
87 0x00, 0xcb, 0x22, 0x01, 0x37, 0xa9, 0xc0, 0x33, 0xc0, 0x33, 0xc0,
88 0x33, 0xc0, 0x33, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc,
89 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0xfb, 0x00, 0xca,
90 0x79, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0x00, 0xb4,
91 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00,
92 0xb4, 0x00, 0xb4, 0xd0, 0x00, 0x5d, 0x54, 0xc0, 0x21, 0xc0, 0x21,
93 0xc0, 0x21, 0xc0, 0x21, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00,
94 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0xa7, 0x00,
95 0xa9, 0x3d, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0x00,
96 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
97 0x00, 0xa0, 0x00, 0xa0, 0x7a, 0x00, 0x06, 0x2c, 0xc0, 0x0d, 0xc0,
98 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96,
99 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00,
100 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
101 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
102 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80,
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76,
108 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01,
109 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xf0, 0x00, 0xf0,
110 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
111 0xd0, 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0,
112 0x42, 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb,
113 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37,
114 0xa9, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc,
115 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00,
116 0xbc, 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b,
117 0xc0, 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00,
118 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00,
119 0x5d, 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00,
120 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa,
121 0x00, 0xaa, 0x00, 0xaa, 0xa7, 0x00, 0xa9, 0x3d, 0xc0, 0x17, 0xc0,
122 0x17, 0xc0, 0x17, 0xc0, 0x17, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
123 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x7a,
124 0x00, 0x06, 0x2c, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d,
125 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00,
126 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
132 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x09, 0x00, 0x00, 0xc9, 0xff,
135 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10,
136 0x01, 0x10, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
137 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0x54, 0x01, 0xab,
138 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0x00, 0xcb,
139 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00,
140 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37, 0xa9, 0xc0, 0x33, 0xc0, 0x33,
141 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00,
142 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0xfb, 0x00,
143 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0x00,
144 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4,
145 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00, 0x5d, 0x54, 0xc0, 0x21, 0xc0,
146 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa,
147 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0xa7,
148 0x00, 0xa9, 0x3d, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17,
149 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00,
150 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x7a, 0x00, 0x06, 0x2c, 0xc0, 0x0d,
151 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0x00, 0x96, 0x00, 0x96, 0x00,
152 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96,
153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80,
159 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
161 0x80, 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00,
162 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xf0, 0x00,
163 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0,
164 0x00, 0xd0, 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42,
165 0xc0, 0x42, 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00,
166 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01,
167 0x37, 0xa9, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00,
168 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc,
169 0x00, 0xbc, 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0,
170 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4,
171 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0,
172 0x00, 0x5d, 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21,
173 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00,
174 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0xa7, 0x00, 0xa9, 0x3d, 0xc0, 0x17,
175 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0x00, 0xa0, 0x00, 0xa0, 0x00,
176 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
177 0x7a, 0x00, 0x06, 0x2c, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0,
178 0x0d, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96,
179 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00,
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
183 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00,
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x09, 0x00, 0x00, 0xc9,
188 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01, 0x10, 0x01, 0x10, 0x01,
189 0x10, 0x01, 0x10, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0,
190 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0x54, 0x01,
191 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0x00,
192 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb,
193 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37, 0xa9, 0xc0, 0x33, 0xc0,
194 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc,
195 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0xfb,
196 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b,
197 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00,
198 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00, 0x5d, 0x54, 0xc0, 0x21,
199 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00, 0xaa, 0x00, 0xaa, 0x00,
200 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa,
201 0xa7, 0x00, 0xa9, 0x3d, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0xc0,
202 0x17, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
203 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x7a, 0x00, 0x06, 0x2c, 0xc0,
204 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0x00, 0x96, 0x00, 0x96,
205 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00,
206 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
212 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 0x00, 0x8a, 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00,
215 0x00, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xf0,
216 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
217 0xd0, 0x00, 0xd0, 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0,
218 0x42, 0xc0, 0x42, 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb,
219 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22,
220 0x01, 0x37, 0xa9, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33,
221 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00,
222 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b,
223 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00,
224 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4,
225 0xd0, 0x00, 0x5d, 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0,
226 0x21, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa,
227 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0xa7, 0x00, 0xa9, 0x3d, 0xc0,
228 0x17, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0x00, 0xa0, 0x00, 0xa0,
229 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00,
230 0xa0, 0x7a, 0x00, 0x06, 0x2c, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d,
231 0xc0, 0x0d, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00,
232 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00,
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
235 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, 0x00, 0x00,
239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
240 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x09, 0x00, 0x00,
241 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01, 0x10, 0x01, 0x10,
242 0x01, 0x10, 0x01, 0x10, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
243 0xf0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0x54,
244 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42,
245 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00,
246 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37, 0xa9, 0xc0, 0x33,
247 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc, 0x00, 0xbc, 0x00,
248 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc,
249 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0,
250 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4,
251 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00, 0x5d, 0x54, 0xc0,
252 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00, 0xaa, 0x00, 0xaa,
253 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00,
254 0xaa, 0xa7, 0x00, 0xa9, 0x3d, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17,
255 0xc0, 0x17, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00,
256 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x7a, 0x00, 0x06, 0x2c,
257 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0x00, 0x96, 0x00,
258 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96,
259 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
261 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
265 0x06, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
267 0x00, 0x00, 0x94, 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00,
268 0x00, 0x00, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
269 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0, 0x00, 0xd0,
270 0x00, 0xd0, 0x00, 0xd0, 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42,
271 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00,
272 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb,
273 0x22, 0x01, 0x37, 0xa9, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0,
274 0x33, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc,
275 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0,
276 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4,
277 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00,
278 0xb4, 0xd0, 0x00, 0x5d, 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21,
279 0xc0, 0x21, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00,
280 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0xa7, 0x00, 0xa9, 0x3d,
281 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0x00, 0xa0, 0x00,
282 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
283 0x00, 0xa0, 0x7a, 0x00, 0x06, 0x2c, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0,
284 0x0d, 0xc0, 0x0d, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96,
285 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x00, 0x00,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, 0x00,
292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x09, 0x00,
294 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01, 0x10, 0x01,
295 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0,
296 0x00, 0xf0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
297 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0xc0,
298 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb,
299 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37, 0xa9, 0xc0,
300 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc, 0x00, 0xbc,
301 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00,
302 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b,
303 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00,
304 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00, 0x5d, 0x54,
305 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00, 0xaa, 0x00,
306 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa,
307 0x00, 0xaa, 0xa7, 0x00, 0xa9, 0x3d, 0xc0, 0x17, 0xc0, 0x17, 0xc0,
308 0x17, 0xc0, 0x17, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
309 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x7a, 0x00, 0x06,
310 0x2c, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0x00, 0x96,
311 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00,
312 0x96, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
317 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
318 0x00, 0x06, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320 0x00, 0x00, 0x00, 0x9e, 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff,
321 0x00, 0x00, 0x00, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10,
322 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0, 0x00,
323 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0,
324 0x42, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb,
325 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00,
326 0xcb, 0x22, 0x01, 0x37, 0xa9, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33,
327 0xc0, 0x33, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00,
328 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79,
329 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00,
330 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4,
331 0x00, 0xb4, 0xd0, 0x00, 0x5d, 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0,
332 0x21, 0xc0, 0x21, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa,
333 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0xa7, 0x00, 0xa9,
334 0x3d, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0xc0, 0x17, 0x00, 0xa0,
335 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00,
336 0xa0, 0x00, 0xa0, 0x7a, 0x00, 0x06, 0x2c, 0xc0, 0x0d, 0xc0, 0x0d,
337 0xc0, 0x0d, 0xc0, 0x0d, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00,
338 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x00,
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
354 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
359 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
398 0x00 };
399
400static const u8 default_cal_rssi[] = {
401 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x72,
402 0xfe, 0x1a, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00,
403 0x00, 0x00, 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00, 0x0a,
404 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x72, 0xfe,
405 0x1a, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00,
406 0x00, 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00, 0x0a, 0x01,
407 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x72, 0xfe, 0x1a,
408 0x00, 0x00, 0x00, 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410 0x00, 0x00, 0x00, 0x00, 0x00 };
411
412static void stlc45xx_tx_edcf(struct stlc45xx *stlc);
413static void stlc45xx_tx_setup(struct stlc45xx *stlc);
414static void stlc45xx_tx_scan(struct stlc45xx *stlc);
415static void stlc45xx_tx_psm(struct stlc45xx *stlc, bool enable);
416static int stlc45xx_tx_nullfunc(struct stlc45xx *stlc, bool powersave);
417static int stlc45xx_tx_pspoll(struct stlc45xx *stlc, bool powersave);
418
419static ssize_t stlc45xx_sysfs_show_cal_rssi(struct device *dev,
420 struct device_attribute *attr,
421 char *buf)
422{
423 struct stlc45xx *stlc = dev_get_drvdata(dev);
424 ssize_t len;
425
426 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
427
428 len = PAGE_SIZE;
429
430 mutex_lock(&stlc->mutex);
431
432 if (stlc->cal_rssi)
433 hex_dump_to_buffer(stlc->cal_rssi, RSSI_CAL_ARRAY_LEN, 16,
434 2, buf, len, 0);
435 mutex_unlock(&stlc->mutex);
436
437 len = strlen(buf);
438
439 return len;
440}
441
442static ssize_t stlc45xx_sysfs_store_cal_rssi(struct device *dev,
443 struct device_attribute *attr,
444 const char *buf, size_t count)
445{
446 struct stlc45xx *stlc = dev_get_drvdata(dev);
447
448 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
449
450 mutex_lock(&stlc->mutex);
451
452 if (count != RSSI_CAL_ARRAY_LEN) {
453 stlc45xx_error("invalid cal_rssi length: %zu", count);
454 count = 0;
455 goto out_unlock;
456 }
457
458 kfree(stlc->cal_rssi);
459
460 stlc->cal_rssi = kmemdup(buf, RSSI_CAL_ARRAY_LEN, GFP_KERNEL);
461
462 if (!stlc->cal_rssi) {
463 stlc45xx_error("failed to allocate memory for cal_rssi");
464 count = 0;
465 goto out_unlock;
466 }
467
468 out_unlock:
469 mutex_unlock(&stlc->mutex);
470
471 return count;
472}
473
474static ssize_t stlc45xx_sysfs_show_cal_channels(struct device *dev,
475 struct device_attribute *attr,
476 char *buf)
477{
478 struct stlc45xx *stlc = dev_get_drvdata(dev);
479 ssize_t len;
480
481 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
482
483 len = PAGE_SIZE;
484
485 mutex_lock(&stlc->mutex);
486
487 if (stlc->cal_channels)
488 hex_dump_to_buffer(stlc->cal_channels, CHANNEL_CAL_ARRAY_LEN,
489 16, 2, buf, len, 0);
490
491 mutex_unlock(&stlc->mutex);
492
493 len = strlen(buf);
494
495 return len;
496}
497
498static ssize_t stlc45xx_sysfs_store_cal_channels(struct device *dev,
499 struct device_attribute *attr,
500 const char *buf, size_t count)
501{
502 struct stlc45xx *stlc = dev_get_drvdata(dev);
503
504 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
505
506 mutex_lock(&stlc->mutex);
507
508 if (count != CHANNEL_CAL_ARRAY_LEN) {
509 stlc45xx_error("invalid cal_channels size: %zu ", count);
510 count = 0;
511 goto out_unlock;
512 }
513
514 kfree(stlc->cal_channels);
515
516 stlc->cal_channels = kmemdup(buf, count, GFP_KERNEL);
517
518 if (!stlc->cal_channels) {
519 stlc45xx_error("failed to allocate memory for cal_channels");
520 count = 0;
521 goto out_unlock;
522 }
523
524out_unlock:
525 mutex_unlock(&stlc->mutex);
526
527 return count;
528}
529
530static ssize_t stlc45xx_sysfs_show_tx_buf(struct device *dev,
531 struct device_attribute *attr,
532 char *buf)
533{
534 struct stlc45xx *stlc = dev_get_drvdata(dev);
535 struct txbuffer *entry;
536 ssize_t len = 0;
537
538 stlc45xx_debug(DEBUG_FUNC, "%s()", __func__);
539
540 mutex_lock(&stlc->mutex);
541
542 list_for_each_entry(entry, &stlc->tx_sent, tx_list) {
543 len += sprintf(buf + len, "0x%x: 0x%x-0x%x\n",
544 entry->handle, entry->start,
545 entry->end);
546 }
547
548 mutex_unlock(&stlc->mutex);
549
550 return len;
551}
552
553static DEVICE_ATTR(cal_rssi, S_IRUGO | S_IWUSR,
554 stlc45xx_sysfs_show_cal_rssi,
555 stlc45xx_sysfs_store_cal_rssi);
556static DEVICE_ATTR(cal_channels, S_IRUGO | S_IWUSR,
557 stlc45xx_sysfs_show_cal_channels,
558 stlc45xx_sysfs_store_cal_channels);
559static DEVICE_ATTR(tx_buf, S_IRUGO, stlc45xx_sysfs_show_tx_buf, NULL);
560
561static void stlc45xx_spi_read(struct stlc45xx *stlc, unsigned long addr,
562 void *buf, size_t len)
563{
564 struct spi_transfer t[2];
565 struct spi_message m;
566
567 /* We first push the address */
568 addr = (addr << 8) | ADDR_READ_BIT_15;
569
570 spi_message_init(&m);
571 memset(t, 0, sizeof(t));
572
573 t[0].tx_buf = &addr;
574 t[0].len = 2;
575 spi_message_add_tail(&t[0], &m);
576
577 t[1].rx_buf = buf;
578 t[1].len = len;
579 spi_message_add_tail(&t[1], &m);
580
581 spi_sync(stlc->spi, &m);
582}
583
584
585static void stlc45xx_spi_write(struct stlc45xx *stlc, unsigned long addr,
586 void *buf, size_t len)
587{
588 struct spi_transfer t[3];
589 struct spi_message m;
590 u16 last_word;
591
592 /* We first push the address */
593 addr = addr << 8;
594
595 spi_message_init(&m);
596 memset(t, 0, sizeof(t));
597
598 t[0].tx_buf = &addr;
599 t[0].len = 2;
600 spi_message_add_tail(&t[0], &m);
601
602 t[1].tx_buf = buf;
603 t[1].len = len;
604 spi_message_add_tail(&t[1], &m);
605
606 if (len % 2) {
607 last_word = ((u8 *)buf)[len - 1];
608
609 t[2].tx_buf = &last_word;
610 t[2].len = 2;
611 spi_message_add_tail(&t[2], &m);
612 }
613
614 spi_sync(stlc->spi, &m);
615}
616
617static u16 stlc45xx_read16(struct stlc45xx *stlc, unsigned long addr)
618{
619 u16 val;
620
621 stlc45xx_spi_read(stlc, addr, &val, sizeof(val));
622
623 return val;
624}
625
626static u32 stlc45xx_read32(struct stlc45xx *stlc, unsigned long addr)
627{
628 u32 val;
629
630 stlc45xx_spi_read(stlc, addr, &val, sizeof(val));
631
632 return val;
633}
634
635static void stlc45xx_write16(struct stlc45xx *stlc, unsigned long addr, u16 val)
636{
637 stlc45xx_spi_write(stlc, addr, &val, sizeof(val));
638}
639
640static void stlc45xx_write32(struct stlc45xx *stlc, unsigned long addr, u32 val)
641{
642 stlc45xx_spi_write(stlc, addr, &val, sizeof(val));
643}
644
645struct stlc45xx_spi_reg {
646 u16 address;
647 u16 length;
648 char *name;
649};
650
651/* caller must hold tx_lock */
652static void stlc45xx_txbuffer_dump(struct stlc45xx *stlc)
653{
654 struct txbuffer *txbuffer;
655 char *buf, *pos;
656 int buf_len, l, count;
657
658 if (!(DEBUG_LEVEL & DEBUG_TXBUFFER))
659 return;
660
661 stlc45xx_debug(DEBUG_FUNC, "%s()", __func__);
662
663 buf_len = 500;
664 buf = kmalloc(buf_len, GFP_ATOMIC);
665 if (!buf)
666 return;
667
668 pos = buf;
669 count = 0;
670
671 list_for_each_entry(txbuffer, &stlc->txbuffer, buffer_list) {
672 l = snprintf(pos, buf_len, "0x%x-0x%x,",
673 txbuffer->start, txbuffer->end);
674 /* drop the null byte */
675 pos += l;
676 buf_len -= l;
677 count++;
678 }
679
680 if (count == 0)
681 *pos = '\0';
682 else
683 *--pos = '\0';
684
685 stlc45xx_debug(DEBUG_TXBUFFER, "txbuffer: in buffer %d regions: %s",
686 count, buf);
687
688 kfree(buf);
689}
690
691/* caller must hold tx_lock */
692static int stlc45xx_txbuffer_find(struct stlc45xx *stlc, size_t len)
693{
694 struct txbuffer *txbuffer;
695 int pos;
696
697 stlc45xx_debug(DEBUG_FUNC, "%s()", __func__);
698
699 pos = FIRMWARE_TXBUFFER_START;
700
701 if (list_empty(&stlc->txbuffer))
702 goto out;
703
704 /*
705 * the entries in txbuffer must be in the same order as they are in
706 * the real buffer
707 */
708 list_for_each_entry(txbuffer, &stlc->txbuffer, buffer_list) {
709 if (pos + len < txbuffer->start)
710 break;
711 pos = ALIGN(txbuffer->end + 1, 4);
712 }
713
714 if (pos + len > FIRMWARE_TXBUFFER_END)
715 /* not enough room */
716 pos = -1;
717
718 stlc45xx_debug(DEBUG_TXBUFFER, "txbuffer: find %zu B: 0x%x", len, pos);
719
720out:
721 return pos;
722}
723
724static int stlc45xx_txbuffer_add(struct stlc45xx *stlc,
725 struct txbuffer *txbuffer)
726{
727 struct txbuffer *r, *prev = NULL;
728
729 if (list_empty(&stlc->txbuffer)) {
730 list_add(&txbuffer->buffer_list, &stlc->txbuffer);
731 return 0;
732 }
733
734 r = list_first_entry(&stlc->txbuffer, struct txbuffer, buffer_list);
735
736 if (txbuffer->start < r->start) {
737 /* add to the beginning of the list */
738 list_add(&txbuffer->buffer_list, &stlc->txbuffer);
739 return 0;
740 }
741
742 prev = NULL;
743 list_for_each_entry(r, &stlc->txbuffer, buffer_list) {
744 /* skip first entry, we checked for that above */
745 if (!prev) {
746 prev = r;
747 continue;
748 }
749
750 /* double-check overlaps */
751 WARN_ON_ONCE(txbuffer->start >= r->start &&
752 txbuffer->start <= r->end);
753 WARN_ON_ONCE(txbuffer->end >= r->start &&
754 txbuffer->end <= r->end);
755
756 if (prev->end < txbuffer->start &&
757 txbuffer->end < r->start) {
758 /* insert at this spot */
759 list_add_tail(&txbuffer->buffer_list, &r->buffer_list);
760 return 0;
761 }
762
763 prev = r;
764 }
765
766 /* not found */
767 list_add_tail(&txbuffer->buffer_list, &stlc->txbuffer);
768
769 return 0;
770
771}
772
773/* caller must hold tx_lock */
774static struct txbuffer *stlc45xx_txbuffer_alloc(struct stlc45xx *stlc,
775 size_t frame_len)
776{
777 struct txbuffer *entry = NULL;
778 size_t len;
779 int pos;
780
781 stlc45xx_debug(DEBUG_FUNC, "%s()", __func__);
782
783 len = FIRMWARE_TXBUFFER_HEADER + frame_len + FIRMWARE_TXBUFFER_TRAILER;
784 pos = stlc45xx_txbuffer_find(stlc, len);
785
786 if (pos < 0)
787 return NULL;
788
789 WARN_ON_ONCE(pos + len > FIRMWARE_TXBUFFER_END);
790 WARN_ON_ONCE(pos < FIRMWARE_TXBUFFER_START);
791
792 entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
793 entry->start = pos;
794 entry->frame_start = pos + FIRMWARE_TXBUFFER_HEADER;
795 entry->end = entry->start + len - 1;
796
797 stlc45xx_debug(DEBUG_TXBUFFER, "txbuffer: allocated 0x%x-0x%x",
798 entry->start, entry->end);
799
800 stlc45xx_txbuffer_add(stlc, entry);
801
802 stlc45xx_txbuffer_dump(stlc);
803
804 return entry;
805}
806
807/* caller must hold tx_lock */
808static void stlc45xx_txbuffer_free(struct stlc45xx *stlc,
809 struct txbuffer *txbuffer)
810{
811 stlc45xx_debug(DEBUG_FUNC, "%s()", __func__);
812
813 stlc45xx_debug(DEBUG_TXBUFFER, "txbuffer: freed 0x%x-0x%x",
814 txbuffer->start, txbuffer->end);
815
816 list_del(&txbuffer->buffer_list);
817 kfree(txbuffer);
818}
819
820
821static int stlc45xx_wait_bit(struct stlc45xx *stlc, u16 reg, u32 mask,
822 u32 expected)
823{
824 int i;
825 char buffer[4];
826
827 for (i = 0; i < 2000; i++) {
828 stlc45xx_spi_read(stlc, reg, buffer, sizeof(buffer));
829 if (((*(u32 *)buffer) & mask) == expected)
830 return 1;
831 msleep(1);
832 }
833
834 return 0;
835}
836
837static int stlc45xx_request_firmware(struct stlc45xx *stlc)
838{
839 const struct firmware *fw;
840 int ret;
841
842 /* FIXME: should driver use it's own struct device? */
843 ret = request_firmware(&fw, "3826.arm", &stlc->spi->dev);
844
845 if (ret < 0) {
846 stlc45xx_error("request_firmware() failed: %d", ret);
847 return ret;
848 }
849
850 if (fw->size % 4) {
851 stlc45xx_error("firmware size is not multiple of 32bit: %zu",
852 fw->size);
853 return -EILSEQ; /* Illegal byte sequence */;
854 }
855
856 if (fw->size < 1000) {
857 stlc45xx_error("firmware is too small: %zu", fw->size);
858 return -EILSEQ;
859 }
860
861 stlc->fw = kmemdup(fw->data, fw->size, GFP_KERNEL);
862 if (!stlc->fw) {
863 stlc45xx_error("could not allocate memory for firmware");
864 return -ENOMEM;
865 }
866
867 stlc->fw_len = fw->size;
868
869 release_firmware(fw);
870
871 return 0;
872}
873
874static int stlc45xx_upload_firmware(struct stlc45xx *stlc)
875{
876 struct s_dma_regs dma_regs;
877 unsigned long fw_len, fw_addr;
878 long _fw_len;
879 int ret;
880
881 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
882
883 if (!stlc->fw) {
884 ret = stlc45xx_request_firmware(stlc);
885 if (ret < 0)
886 return ret;
887 }
888
889 /* stop the device */
890 stlc45xx_write16(stlc, SPI_ADRS_DEV_CTRL_STAT,
891 SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_HOST_RESET
892 | SPI_CTRL_STAT_START_HALTED);
893
894 msleep(TARGET_BOOT_SLEEP);
895
896 stlc45xx_write16(stlc, SPI_ADRS_DEV_CTRL_STAT,
897 SPI_CTRL_STAT_HOST_OVERRIDE
898 | SPI_CTRL_STAT_START_HALTED);
899
900 msleep(TARGET_BOOT_SLEEP);
901
902 fw_addr = FIRMWARE_ADDRESS;
903 fw_len = stlc->fw_len;
904
905 while (fw_len > 0) {
906 _fw_len = (fw_len > SPI_MAX_PACKET_SIZE)
907 ? SPI_MAX_PACKET_SIZE : fw_len;
908 dma_regs.cmd = SPI_DMA_WRITE_CTRL_ENABLE;
909 dma_regs.len = cpu_to_le16(_fw_len);
910 dma_regs.addr = cpu_to_le32(fw_addr);
911
912 fw_len -= _fw_len;
913 fw_addr += _fw_len;
914
915 stlc45xx_write16(stlc, SPI_ADRS_DMA_WRITE_CTRL, dma_regs.cmd);
916
917 if (stlc45xx_wait_bit(stlc, SPI_ADRS_DMA_WRITE_CTRL,
918 HOST_ALLOWED, HOST_ALLOWED) == 0) {
919 stlc45xx_error("fw_upload not allowed to DMA write");
920 return -EAGAIN;
921 }
922
923 stlc45xx_write16(stlc, SPI_ADRS_DMA_WRITE_LEN, dma_regs.len);
924 stlc45xx_write32(stlc, SPI_ADRS_DMA_WRITE_BASE, dma_regs.addr);
925
926 stlc45xx_spi_write(stlc, SPI_ADRS_DMA_DATA, stlc->fw, _fw_len);
927
928 /* FIXME: I think this doesn't work if firmware is large,
929 * this loop goes to second round. fw->data is not
930 * increased at all! */
931 }
932
933 BUG_ON(fw_len != 0);
934
935 /* enable host interrupts */
936 stlc45xx_write32(stlc, SPI_ADRS_HOST_INT_EN, SPI_HOST_INTS_DEFAULT);
937
938 /* boot the device */
939 stlc45xx_write16(stlc, SPI_ADRS_DEV_CTRL_STAT,
940 SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_HOST_RESET
941 | SPI_CTRL_STAT_RAM_BOOT);
942
943 msleep(TARGET_BOOT_SLEEP);
944
945 stlc45xx_write16(stlc, SPI_ADRS_DEV_CTRL_STAT,
946 SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_RAM_BOOT);
947 msleep(TARGET_BOOT_SLEEP);
948
949 return 0;
950}
951
952/* caller must hold tx_lock */
953static void stlc45xx_check_txsent(struct stlc45xx *stlc)
954{
955 struct txbuffer *entry, *n;
956
957 list_for_each_entry_safe(entry, n, &stlc->tx_sent, tx_list) {
958 if (time_after(jiffies, entry->lifetime)) {
959 if (net_ratelimit())
960 stlc45xx_warning("frame 0x%x lifetime exceeded",
961 entry->start);
962 list_del(&entry->tx_list);
963 skb_pull(entry->skb, entry->header_len);
964 ieee80211_tx_status(stlc->hw, entry->skb);
965 stlc45xx_txbuffer_free(stlc, entry);
966 }
967 }
968}
969
970static void stlc45xx_power_off(struct stlc45xx *stlc)
971{
972 disable_irq(gpio_to_irq(stlc45xx_gpio_irq));
973 gpio_set_value(stlc45xx_gpio_power, 0);
974}
975
976static void stlc45xx_power_on(struct stlc45xx *stlc)
977{
978 gpio_set_value(stlc45xx_gpio_power, 1);
979 enable_irq(gpio_to_irq(stlc45xx_gpio_irq));
980
981 /*
982 * need to wait a while before device can be accessed, the length
983 * is just a guess
984 */
985 msleep(10);
986}
987
988/* caller must hold tx_lock */
989static void stlc45xx_flush_queues(struct stlc45xx *stlc)
990{
991 struct txbuffer *entry;
992
993 while (!list_empty(&stlc->tx_sent)) {
994 entry = list_first_entry(&stlc->tx_sent,
995 struct txbuffer, tx_list);
996 list_del(&entry->tx_list);
997 dev_kfree_skb(entry->skb);
998 stlc45xx_txbuffer_free(stlc, entry);
999 }
1000
1001 WARN_ON(!list_empty(&stlc->tx_sent));
1002
1003 while (!list_empty(&stlc->tx_pending)) {
1004 entry = list_first_entry(&stlc->tx_pending,
1005 struct txbuffer, tx_list);
1006 list_del(&entry->tx_list);
1007 dev_kfree_skb(entry->skb);
1008 stlc45xx_txbuffer_free(stlc, entry);
1009 }
1010
1011 WARN_ON(!list_empty(&stlc->tx_pending));
1012 WARN_ON(!list_empty(&stlc->txbuffer));
1013}
1014
1015static void stlc45xx_work_reset(struct work_struct *work)
1016{
1017 struct stlc45xx *stlc = container_of(work, struct stlc45xx,
1018 work_reset);
1019
1020 mutex_lock(&stlc->mutex);
1021
1022 if (stlc->fw_state != FW_STATE_RESET)
1023 goto out;
1024
1025 stlc45xx_power_off(stlc);
1026
1027 mutex_unlock(&stlc->mutex);
1028
1029 /* wait that all work_structs have finished, we can't hold
1030 * stlc->mutex to avoid deadlock */
1031 cancel_work_sync(&stlc->work);
1032
1033 /* FIXME: find out good value to wait for chip power down */
1034 msleep(100);
1035
1036 mutex_lock(&stlc->mutex);
1037
1038 /* FIXME: we should gracefully handle if the state has changed
1039 * after re-acquiring mutex */
1040 WARN_ON(stlc->fw_state != FW_STATE_RESET);
1041
1042 spin_lock_bh(&stlc->tx_lock);
1043 stlc45xx_flush_queues(stlc);
1044 spin_unlock_bh(&stlc->tx_lock);
1045
1046 stlc->fw_state = FW_STATE_RESETTING;
1047
1048 stlc45xx_power_on(stlc);
1049 stlc45xx_upload_firmware(stlc);
1050
1051out:
1052 mutex_unlock(&stlc->mutex);
1053}
1054
1055/* caller must hold mutex */
1056static void stlc45xx_reset(struct stlc45xx *stlc)
1057{
1058 stlc45xx_warning("resetting firmware");
1059 stlc->fw_state = FW_STATE_RESET;
1060 ieee80211_stop_queues(stlc->hw);
1061 queue_work(stlc->hw->workqueue, &stlc->work_reset);
1062}
1063
1064static void stlc45xx_work_tx_timeout(struct work_struct *work)
1065{
1066 struct stlc45xx *stlc = container_of(work, struct stlc45xx,
1067 work_tx_timeout.work);
1068
1069 stlc45xx_warning("tx timeout");
1070
1071 mutex_lock(&stlc->mutex);
1072
1073 if (stlc->fw_state != FW_STATE_READY)
1074 goto out;
1075
1076 stlc45xx_reset(stlc);
1077
1078out:
1079 mutex_unlock(&stlc->mutex);
1080}
1081
1082static void stlc45xx_int_ack(struct stlc45xx *stlc, u32 val)
1083{
1084 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1085
1086 stlc45xx_write32(stlc, SPI_ADRS_HOST_INT_ACK, val);
1087}
1088
1089static void stlc45xx_wakeup(struct stlc45xx *stlc)
1090{
1091 unsigned long timeout;
1092 u32 ints;
1093
1094 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1095
1096 /* wake the chip */
1097 stlc45xx_write32(stlc, SPI_ADRS_ARM_INTERRUPTS, SPI_TARGET_INT_WAKEUP);
1098
1099 /* And wait for the READY interrupt */
1100 timeout = jiffies + HZ;
1101
1102 ints = stlc45xx_read32(stlc, SPI_ADRS_HOST_INTERRUPTS);
1103 while (!(ints & SPI_HOST_INT_READY)) {
1104 if (time_after(jiffies, timeout))
1105 goto out;
1106 ints = stlc45xx_read32(stlc, SPI_ADRS_HOST_INTERRUPTS);
1107 }
1108
1109 stlc45xx_int_ack(stlc, SPI_HOST_INT_READY);
1110
1111out:
1112 return;
1113}
1114
1115static void stlc45xx_sleep(struct stlc45xx *stlc)
1116{
1117 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1118
1119 stlc45xx_write32(stlc, SPI_ADRS_ARM_INTERRUPTS, SPI_TARGET_INT_SLEEP);
1120}
1121
1122static void stlc45xx_int_ready(struct stlc45xx *stlc)
1123{
1124 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1125
1126 stlc45xx_write32(stlc, SPI_ADRS_HOST_INT_EN,
1127 SPI_HOST_INT_UPDATE | SPI_HOST_INT_SW_UPDATE);
1128
1129 switch (stlc->fw_state) {
1130 case FW_STATE_BOOTING:
1131 stlc->fw_state = FW_STATE_READY;
1132 complete(&stlc->fw_comp);
1133 break;
1134 case FW_STATE_RESETTING:
1135 stlc->fw_state = FW_STATE_READY;
1136
1137 stlc45xx_tx_scan(stlc);
1138 stlc45xx_tx_setup(stlc);
1139 stlc45xx_tx_edcf(stlc);
1140
1141 ieee80211_wake_queues(stlc->hw);
1142 break;
1143 default:
1144 break;
1145 }
1146}
1147
1148static int stlc45xx_rx_txack(struct stlc45xx *stlc, struct sk_buff *skb)
1149{
1150 struct ieee80211_tx_info *info;
1151 struct s_lm_control *control;
1152 struct s_lmo_tx *tx;
1153 struct txbuffer *entry;
1154 int found = 0;
1155
1156 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1157
1158 control = (struct s_lm_control *) skb->data;
1159 tx = (struct s_lmo_tx *) (control + 1);
1160
1161 if (list_empty(&stlc->tx_sent)) {
1162 if (net_ratelimit())
1163 stlc45xx_warning("no frames waiting for "
1164 "acknowledgement");
1165 return -1;
1166 }
1167
1168 list_for_each_entry(entry, &stlc->tx_sent, tx_list) {
1169 if (control->handle == entry->handle) {
1170 found = 1;
1171 break;
1172 }
1173 }
1174
1175 if (!found) {
1176 if (net_ratelimit())
1177 stlc45xx_warning("couldn't find frame for tx ack 0x%x",
1178 control->handle);
1179 return -1;
1180 }
1181
1182 stlc45xx_debug(DEBUG_TX, "TX ACK 0x%x", entry->handle);
1183
1184 if (entry->status_needed) {
1185 info = IEEE80211_SKB_CB(entry->skb);
1186
1187 if (!(tx->flags & LM_TX_FAILED)) {
1188 /* frame was acked */
1189 info->flags |= IEEE80211_TX_STAT_ACK;
1190 info->status.ack_signal = tx->rcpi / 2 - 110;
1191 }
1192
1193 skb_pull(entry->skb, entry->header_len);
1194
1195 ieee80211_tx_status(stlc->hw, entry->skb);
1196 }
1197
1198 list_del(&entry->tx_list);
1199
1200 stlc45xx_check_txsent(stlc);
1201 if (list_empty(&stlc->tx_sent))
1202 /* there are no pending frames, we can stop the tx timeout
1203 * timer */
1204 cancel_delayed_work(&stlc->work_tx_timeout);
1205
1206 spin_lock_bh(&stlc->tx_lock);
1207
1208 stlc45xx_txbuffer_free(stlc, entry);
1209
1210 if (stlc->tx_queue_stopped &&
1211 stlc45xx_txbuffer_find(stlc, MAX_FRAME_LEN) != -1) {
1212 stlc45xx_debug(DEBUG_QUEUE, "room in tx buffer, waking queues");
1213 ieee80211_wake_queues(stlc->hw);
1214 stlc->tx_queue_stopped = 0;
1215 }
1216
1217 spin_unlock_bh(&stlc->tx_lock);
1218
1219 return 0;
1220}
1221
1222static int stlc45xx_rx_control(struct stlc45xx *stlc, struct sk_buff *skb)
1223{
1224 struct s_lm_control *control;
1225 int ret = 0;
1226
1227 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1228
1229 control = (struct s_lm_control *) skb->data;
1230
1231 switch (control->oid) {
1232 case LM_OID_TX:
1233 ret = stlc45xx_rx_txack(stlc, skb);
1234 break;
1235 case LM_OID_SETUP:
1236 case LM_OID_SCAN:
1237 case LM_OID_TRAP:
1238 case LM_OID_EDCF:
1239 case LM_OID_KEYCACHE:
1240 case LM_OID_PSM:
1241 case LM_OID_STATS:
1242 case LM_OID_LED:
1243 default:
1244 stlc45xx_warning("unhandled rx control oid %d\n",
1245 control->oid);
1246 break;
1247 }
1248
1249 dev_kfree_skb(skb);
1250
1251 return ret;
1252}
1253
1254/* copied from mac80211 */
1255static void stlc45xx_parse_elems(u8 *start, size_t len,
1256 struct stlc45xx_ie_tim **tim,
1257 size_t *tim_len)
1258{
1259 size_t left = len;
1260 u8 *pos = start;
1261
1262 while (left >= 2) {
1263 u8 id, elen;
1264
1265 id = *pos++;
1266 elen = *pos++;
1267 left -= 2;
1268
1269 if (elen > left)
1270 return;
1271
1272 switch (id) {
1273 case WLAN_EID_TIM:
1274 *tim = (struct stlc45xx_ie_tim *) pos;
1275 *tim_len = elen;
1276 break;
1277 default:
1278 break;
1279 }
1280
1281 left -= elen;
1282 pos += elen;
1283 }
1284}
1285
1286/*
1287 * mac80211 doesn't have support for asking frames with PS-Poll, so let's
1288 * implement in the driver for now. We have to add support to mac80211
1289 * later.
1290 */
1291static int stlc45xx_check_more_data(struct stlc45xx *stlc, struct sk_buff *skb)
1292{
1293 struct s_lm_data_in *data = (struct s_lm_data_in *) skb->data;
1294 struct ieee80211_hdr *hdr;
1295 size_t len;
1296 u16 fc;
1297
1298 hdr = (void *) skb->data + sizeof(*data);
1299 len = skb->len - sizeof(*data);
1300
1301 /* minimum frame length is the null frame length 24 bytes */
1302 if (len < 24) {
1303 stlc45xx_warning("invalid frame length when checking for "
1304 "more data");
1305 return -EINVAL;
1306 }
1307
1308 fc = le16_to_cpu(hdr->frame_control);
1309 if (!(fc & IEEE80211_FCTL_FROMDS))
1310 /* this is not from DS */
1311 return 0;
1312
1313 if (compare_ether_addr(hdr->addr1, stlc->mac_addr) != 0)
1314 /* the frame was not for us */
1315 return 0;
1316
1317 if (!(fc & IEEE80211_FCTL_MOREDATA)) {
1318 /* AP has no more frames buffered for us */
1319 stlc45xx_debug(DEBUG_PSM, "all buffered frames retrieved");
1320 stlc->pspolling = false;
1321 return 0;
1322 }
1323
1324 /* MOREDATA bit is set, let's ask for a new frame from the AP */
1325 stlc45xx_tx_pspoll(stlc, stlc->psm);
1326
1327 return 0;
1328}
1329
1330/*
1331 * mac80211 cannot read TIM from beacons, so let's add a hack to the
1332 * driver. We have to add support to mac80211 later.
1333 */
1334static int stlc45xx_rx_data_beacon(struct stlc45xx *stlc, struct sk_buff *skb)
1335{
1336 struct s_lm_data_in *data = (struct s_lm_data_in *) skb->data;
1337 size_t len = skb->len, tim_len = 0, baselen, pvbmap_len;
1338 struct ieee80211_mgmt *mgmt;
1339 struct stlc45xx_ie_tim *tim = NULL;
1340 int bmap_offset, index, aid_bit;
1341
1342 mgmt = (void *) skb->data + sizeof(*data);
1343
1344 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt;
1345 if (baselen > len) {
1346 stlc45xx_warning("invalid baselen in beacon");
1347 return -EINVAL;
1348 }
1349
1350 stlc45xx_parse_elems(mgmt->u.beacon.variable, len - baselen, &tim,
1351 &tim_len);
1352
1353 if (!tim) {
1354 stlc45xx_warning("didn't find tim from a beacon");
1355 return -EINVAL;
1356 }
1357
1358 bmap_offset = tim->bmap_control & 0xfe;
1359 index = stlc->aid / 8 - bmap_offset;
1360
1361 pvbmap_len = tim_len - 3;
1362 if (index > pvbmap_len)
1363 return -EINVAL;
1364
1365 aid_bit = !!(tim->pvbmap[index] & (1 << stlc->aid % 8));
1366
1367 stlc45xx_debug(DEBUG_PSM, "fc 0x%x duration %d seq %d dtim %u "
1368 "bmap_control 0x%x aid_bit %d",
1369 mgmt->frame_control, mgmt->duration, mgmt->seq_ctrl >> 4,
1370 tim->dtim_count, tim->bmap_control, aid_bit);
1371
1372 if (!aid_bit)
1373 return 0;
1374
1375 stlc->pspolling = true;
1376 stlc45xx_tx_pspoll(stlc, stlc->psm);
1377
1378 return 0;
1379}
1380
1381static int stlc45xx_rx_data(struct stlc45xx *stlc, struct sk_buff *skb)
1382{
1383 struct ieee80211_rx_status status;
1384 struct s_lm_data_in *data = (struct s_lm_data_in *) skb->data;
1385 int align = 0;
1386 u8 *p, align_len;
1387 u16 len;
1388
1389 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1390
1391 if (stlc->psm) {
1392 if (data->flags & LM_IN_BEACON)
1393 stlc45xx_rx_data_beacon(stlc, skb);
1394 else if (stlc->pspolling && (data->flags & LM_IN_DATA))
1395 stlc45xx_check_more_data(stlc, skb);
1396 }
1397
1398 memset(&status, 0, sizeof(status));
1399
1400 status.freq = data->frequency;
1401 status.signal = data->rcpi / 2 - 110;
1402
1403 /* let's assume that maximum rcpi value is 140 (= 35 dBm) */
1404 status.qual = data->rcpi * 100 / 140;
1405
1406 status.band = IEEE80211_BAND_2GHZ;
1407
1408 /*
1409 * FIXME: this gives warning from __ieee80211_rx()
1410 *
1411 * status.rate_idx = data->rate;
1412 */
1413
1414 len = data->length;
1415
1416 if (data->flags & LM_FLAG_ALIGN)
1417 align = 1;
1418
1419 skb_pull(skb, sizeof(*data));
1420
1421 if (align) {
1422 p = skb->data;
1423 align_len = *p;
1424 skb_pull(skb, align_len);
1425 }
1426
1427 skb_trim(skb, len);
1428
1429 stlc45xx_debug(DEBUG_RX, "rx data 0x%p %d B", skb->data, skb->len);
1430 stlc45xx_dump(DEBUG_RX_CONTENT, skb->data, skb->len);
1431
1432 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
1433 ieee80211_rx(stlc->hw, skb);
1434
1435 return 0;
1436}
1437
1438
1439
1440static int stlc45xx_rx(struct stlc45xx *stlc)
1441{
1442 struct s_lm_control *control;
1443 struct sk_buff *skb;
1444 int ret;
1445 u16 len;
1446
1447 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1448
1449 stlc45xx_wakeup(stlc);
1450
1451 /* dummy read to flush SPI DMA controller bug */
1452 stlc45xx_read16(stlc, SPI_ADRS_GEN_PURP_1);
1453
1454 len = stlc45xx_read16(stlc, SPI_ADRS_DMA_DATA);
1455
1456 if (len == 0) {
1457 stlc45xx_warning("rx request of zero bytes");
1458 return 0;
1459 }
1460
1461 skb = dev_alloc_skb(len);
1462 if (!skb) {
1463 stlc45xx_warning("could not alloc skb");
1464 return 0;
1465 }
1466
1467 stlc45xx_spi_read(stlc, SPI_ADRS_DMA_DATA, skb_put(skb, len), len);
1468
1469 stlc45xx_sleep(stlc);
1470
1471 stlc45xx_debug(DEBUG_RX, "rx frame 0x%p %d B", skb->data, skb->len);
1472 stlc45xx_dump(DEBUG_RX_CONTENT, skb->data, skb->len);
1473
1474 control = (struct s_lm_control *) skb->data;
1475
1476 if (control->flags & LM_FLAG_CONTROL)
1477 ret = stlc45xx_rx_control(stlc, skb);
1478 else
1479 ret = stlc45xx_rx_data(stlc, skb);
1480
1481 return ret;
1482}
1483
1484
1485static irqreturn_t stlc45xx_interrupt(int irq, void *config)
1486{
1487 struct spi_device *spi = config;
1488 struct stlc45xx *stlc = dev_get_drvdata(&spi->dev);
1489
1490 stlc45xx_debug(DEBUG_IRQ, "IRQ");
1491
1492 queue_work(stlc->hw->workqueue, &stlc->work);
1493
1494 return IRQ_HANDLED;
1495}
1496
1497static int stlc45xx_tx_frame(struct stlc45xx *stlc, u32 address,
1498 void *buf, size_t len)
1499{
1500 struct s_dma_regs dma_regs;
1501 unsigned long timeout;
1502 int ret = 0;
1503 u32 ints;
1504
1505 stlc->tx_frames++;
1506
1507 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1508
1509 stlc45xx_debug(DEBUG_TX, "tx frame 0x%p %zu B", buf, len);
1510 stlc45xx_dump(DEBUG_TX_CONTENT, buf, len);
1511
1512 stlc45xx_wakeup(stlc);
1513
1514 dma_regs.cmd = SPI_DMA_WRITE_CTRL_ENABLE;
1515 dma_regs.len = cpu_to_le16(len);
1516 dma_regs.addr = cpu_to_le32(address);
1517
1518 stlc45xx_spi_write(stlc, SPI_ADRS_DMA_WRITE_CTRL, &dma_regs,
1519 sizeof(dma_regs));
1520
1521 stlc45xx_spi_write(stlc, SPI_ADRS_DMA_DATA, buf, len);
1522
1523 timeout = jiffies + 2 * HZ;
1524 ints = stlc45xx_read32(stlc, SPI_ADRS_HOST_INTERRUPTS);
1525 while (!(ints & SPI_HOST_INT_WR_READY)) {
1526 if (time_after(jiffies, timeout)) {
1527 stlc45xx_warning("WR_READY timeout");
1528 ret = -1;
1529 goto out;
1530 }
1531 ints = stlc45xx_read32(stlc, SPI_ADRS_HOST_INTERRUPTS);
1532 }
1533
1534 stlc45xx_int_ack(stlc, SPI_HOST_INT_WR_READY);
1535
1536 stlc45xx_sleep(stlc);
1537
1538out:
1539 return ret;
1540}
1541
1542static int stlc45xx_wq_tx(struct stlc45xx *stlc)
1543{
1544 struct txbuffer *entry;
1545 int ret = 0;
1546
1547 spin_lock_bh(&stlc->tx_lock);
1548
1549 while (!list_empty(&stlc->tx_pending)) {
1550 entry = list_entry(stlc->tx_pending.next,
1551 struct txbuffer, tx_list);
1552
1553 list_del_init(&entry->tx_list);
1554
1555 spin_unlock_bh(&stlc->tx_lock);
1556
1557 ret = stlc45xx_tx_frame(stlc, entry->frame_start,
1558 entry->skb->data, entry->skb->len);
1559
1560 spin_lock_bh(&stlc->tx_lock);
1561
1562 if (ret < 0) {
1563 /* frame transfer to firmware buffer failed */
1564 /* FIXME: report this to mac80211 */
1565 dev_kfree_skb(entry->skb);
1566 stlc45xx_txbuffer_free(stlc, entry);
1567 goto out;
1568 }
1569
1570 list_add(&entry->tx_list, &stlc->tx_sent);
1571 queue_delayed_work(stlc->hw->workqueue,
1572 &stlc->work_tx_timeout,
1573 msecs_to_jiffies(TX_TIMEOUT));
1574 }
1575
1576out:
1577 spin_unlock_bh(&stlc->tx_lock);
1578 return ret;
1579}
1580
1581static void stlc45xx_work(struct work_struct *work)
1582{
1583 struct stlc45xx *stlc = container_of(work, struct stlc45xx, work);
1584 u32 ints;
1585 int ret;
1586
1587 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1588
1589 mutex_lock(&stlc->mutex);
1590
1591 if (stlc->fw_state == FW_STATE_OFF &&
1592 stlc->fw_state == FW_STATE_RESET)
1593 goto out;
1594
1595 ints = stlc45xx_read32(stlc, SPI_ADRS_HOST_INTERRUPTS);
1596 stlc45xx_debug(DEBUG_BH, "begin host_ints 0x%08x", ints);
1597
1598 if (ints & SPI_HOST_INT_READY) {
1599 stlc45xx_int_ready(stlc);
1600 stlc45xx_int_ack(stlc, SPI_HOST_INT_READY);
1601 }
1602
1603 if (stlc->fw_state != FW_STATE_READY)
1604 goto out;
1605
1606 if (ints & SPI_HOST_INT_UPDATE) {
1607 stlc45xx_int_ack(stlc, SPI_HOST_INT_UPDATE);
1608 ret = stlc45xx_rx(stlc);
1609 if (ret < 0) {
1610 stlc45xx_reset(stlc);
1611 goto out;
1612 }
1613 }
1614 if (ints & SPI_HOST_INT_SW_UPDATE) {
1615 stlc45xx_int_ack(stlc, SPI_HOST_INT_SW_UPDATE);
1616 ret = stlc45xx_rx(stlc);
1617 if (ret < 0) {
1618 stlc45xx_reset(stlc);
1619 goto out;
1620 }
1621 }
1622
1623 ret = stlc45xx_wq_tx(stlc);
1624 if (ret < 0) {
1625 stlc45xx_reset(stlc);
1626 goto out;
1627 }
1628
1629 ints = stlc45xx_read32(stlc, SPI_ADRS_HOST_INTERRUPTS);
1630 stlc45xx_debug(DEBUG_BH, "end host_ints 0x%08x", ints);
1631
1632out:
1633 mutex_unlock(&stlc->mutex);
1634}
1635
1636static void stlc45xx_tx_edcf(struct stlc45xx *stlc)
1637{
1638 struct s_lm_control *control;
1639 struct s_lmo_edcf *edcf;
1640 size_t len, edcf_len;
1641
1642 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1643
1644 edcf_len = sizeof(*edcf);
1645 len = sizeof(*control) + edcf_len;
1646 control = kzalloc(len, GFP_KERNEL);
1647 edcf = (struct s_lmo_edcf *) (control + 1);
1648
1649 control->flags = LM_FLAG_CONTROL | LM_CTRL_OPSET;
1650 control->length = edcf_len;
1651 control->oid = LM_OID_EDCF;
1652
1653 edcf->slottime = 0x14;
1654 edcf->sifs = 10;
1655 edcf->eofpad = 6;
1656 edcf->maxburst = 1500;
1657
1658 edcf->queues[0].aifs = 2;
1659 edcf->queues[0].pad0 = 1;
1660 edcf->queues[0].cwmin = 3;
1661 edcf->queues[0].cwmax = 7;
1662 edcf->queues[0].txop = 47;
1663 edcf->queues[1].aifs = 2;
1664 edcf->queues[1].pad0 = 0;
1665 edcf->queues[1].cwmin = 7;
1666 edcf->queues[1].cwmax = 15;
1667 edcf->queues[1].txop = 94;
1668 edcf->queues[2].aifs = 3;
1669 edcf->queues[2].pad0 = 0;
1670 edcf->queues[2].cwmin = 15;
1671 edcf->queues[2].cwmax = 1023;
1672 edcf->queues[2].txop = 0;
1673 edcf->queues[3].aifs = 7;
1674 edcf->queues[3].pad0 = 0;
1675 edcf->queues[3].cwmin = 15;
1676 edcf->queues[3].cwmax = 1023;
1677 edcf->queues[3].txop = 0;
1678 edcf->queues[4].aifs = 13;
1679 edcf->queues[4].pad0 = 99;
1680 edcf->queues[4].cwmin = 3437;
1681 edcf->queues[4].cwmax = 512;
1682 edcf->queues[4].txop = 12;
1683 edcf->queues[5].aifs = 142;
1684 edcf->queues[5].pad0 = 109;
1685 edcf->queues[5].cwmin = 8756;
1686 edcf->queues[5].cwmax = 6;
1687 edcf->queues[5].txop = 0;
1688 edcf->queues[6].aifs = 4;
1689 edcf->queues[6].pad0 = 0;
1690 edcf->queues[6].cwmin = 0;
1691 edcf->queues[6].cwmax = 58705;
1692 edcf->queues[6].txop = 25716;
1693 edcf->queues[7].aifs = 0;
1694 edcf->queues[7].pad0 = 0;
1695 edcf->queues[7].cwmin = 0;
1696 edcf->queues[7].cwmax = 0;
1697 edcf->queues[7].txop = 0;
1698
1699 stlc45xx_tx_frame(stlc, FIRMWARE_CONFIG_START, control, len);
1700
1701 kfree(control);
1702}
1703
1704static void stlc45xx_tx_setup(struct stlc45xx *stlc)
1705{
1706 struct s_lm_control *control;
1707 struct s_lmo_setup *setup;
1708 size_t len, setup_len;
1709
1710 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1711
1712 setup_len = sizeof(*setup);
1713 len = sizeof(*control) + setup_len;
1714 control = kzalloc(len, GFP_KERNEL);
1715 setup = (struct s_lmo_setup *) (control + 1);
1716
1717 control->flags = LM_FLAG_CONTROL | LM_CTRL_OPSET;
1718 control->length = setup_len;
1719 control->oid = LM_OID_SETUP;
1720
1721 setup->flags = LM_SETUP_INFRA;
1722 setup->antenna = 2;
1723 setup->rx_align = 0;
1724 setup->rx_buffer = FIRMWARE_RXBUFFER_START;
1725 setup->rx_mtu = FIRMWARE_MTU;
1726 setup->frontend = 5;
1727 setup->timeout = 0;
1728 setup->truncate = 48896;
1729 setup->bratemask = 0xffffffff;
1730 setup->ref_clock = 644245094;
1731 setup->lpf_bandwidth = 65535;
1732 setup->osc_start_delay = 65535;
1733
1734 memcpy(setup->macaddr, stlc->mac_addr, ETH_ALEN);
1735 memcpy(setup->bssid, stlc->bssid, ETH_ALEN);
1736
1737 stlc45xx_tx_frame(stlc, FIRMWARE_CONFIG_START, control, len);
1738
1739 kfree(control);
1740}
1741
1742static void stlc45xx_tx_scan(struct stlc45xx *stlc)
1743{
1744 struct s_lm_control *control;
1745 struct s_lmo_scan *scan;
1746 size_t len, scan_len;
1747
1748 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
1749
1750 scan_len = sizeof(*scan);
1751 len = sizeof(*control) + scan_len;
1752 control = kzalloc(len, GFP_KERNEL);
1753 scan = (struct s_lmo_scan *) (control + 1);
1754
1755 control->flags = LM_FLAG_CONTROL | LM_CTRL_OPSET;
1756 control->length = scan_len;
1757 control->oid = LM_OID_SCAN;
1758
1759 scan->flags = LM_SCAN_EXIT;
1760 scan->bratemask = 0x15f;
1761 scan->aloft[0] = 3;
1762 scan->aloft[1] = 3;
1763 scan->aloft[2] = 1;
1764 scan->aloft[3] = 0;
1765 scan->aloft[4] = 0;
1766 scan->aloft[5] = 0;
1767 scan->aloft[6] = 0;
1768 scan->aloft[7] = 0;
1769
1770 memcpy(&scan->rssical, &stlc->cal_rssi[(stlc->channel - 1) *
1771 RSSI_CAL_LEN],
1772 RSSI_CAL_LEN);
1773 memcpy(&scan->channel, &stlc->cal_channels[(stlc->channel - 1) *
1774 CHANNEL_CAL_LEN],
1775 CHANNEL_CAL_LEN);
1776
1777 stlc45xx_tx_frame(stlc, FIRMWARE_CONFIG_START, control, len);
1778
1779 kfree(control);
1780}
1781
1782/*
1783 * caller must hold mutex
1784 */
1785static int stlc45xx_tx_pspoll(struct stlc45xx *stlc, bool powersave)
1786{
1787 struct ieee80211_hdr *pspoll;
1788 int payload_len, padding, i;
1789 struct s_lm_data_out *data;
1790 struct txbuffer *entry;
1791 struct sk_buff *skb;
1792 char *payload;
1793 u16 fc;
1794
1795 skb = dev_alloc_skb(stlc->hw->extra_tx_headroom + 16);
1796 if (!skb) {
1797 stlc45xx_warning("failed to allocate pspoll frame");
1798 return -ENOMEM;
1799 }
1800 skb_reserve(skb, stlc->hw->extra_tx_headroom);
1801
1802 pspoll = (struct ieee80211_hdr *) skb_put(skb, 16);
1803 memset(pspoll, 0, 16);
1804 fc = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL;
1805 if (powersave)
1806 fc |= IEEE80211_FCTL_PM;
1807 pspoll->frame_control = cpu_to_le16(fc);
1808 pspoll->duration_id = cpu_to_le16(stlc->aid);
1809
1810 /* aid in PS-Poll has its two MSBs each set to 1 */
1811 pspoll->duration_id |= cpu_to_le16(1 << 15) | cpu_to_le16(1 << 14);
1812
1813 memcpy(pspoll->addr1, stlc->bssid, ETH_ALEN);
1814 memcpy(pspoll->addr2, stlc->mac_addr, ETH_ALEN);
1815
1816 stlc45xx_debug(DEBUG_PSM, "sending PS-Poll frame to %pM (powersave %d, "
1817 "fc 0x%x, aid %d)", pspoll->addr1,
1818 powersave, fc, stlc->aid);
1819
1820 spin_lock_bh(&stlc->tx_lock);
1821
1822 entry = stlc45xx_txbuffer_alloc(stlc, skb->len);
1823
1824 spin_unlock_bh(&stlc->tx_lock);
1825
1826 if (!entry) {
1827 /*
1828 * The queue should be stopped before the firmware buffer
1829 * is full, so firmware buffer should always have enough
1830 * space.
1831 *
1832 * But I'm too lazy and omit it for now.
1833 */
1834 if (net_ratelimit())
1835 stlc45xx_warning("firmware tx buffer full is full "
1836 "for null frame");
1837 return -ENOSPC;
1838 }
1839
1840 payload = skb->data;
1841 payload_len = skb->len;
1842 padding = (int) (skb->data - sizeof(*data)) & 3;
1843 entry->header_len = sizeof(*data) + padding;
1844
1845 entry->skb = skb;
1846 entry->status_needed = false;
1847 entry->handle = (u32) skb;
1848 entry->lifetime = jiffies + msecs_to_jiffies(TX_FRAME_LIFETIME);
1849
1850 stlc45xx_debug(DEBUG_TX, "tx data 0x%x (0x%p payload %d B "
1851 "padding %d header_len %d)",
1852 entry->handle, payload, payload_len, padding,
1853 entry->header_len);
1854 stlc45xx_dump(DEBUG_TX_CONTENT, payload, payload_len);
1855
1856 data = (struct s_lm_data_out *) skb_push(skb, entry->header_len);
1857
1858 memset(data, 0, entry->header_len);
1859
1860 if (padding)
1861 data->flags = LM_FLAG_ALIGN;
1862
1863 data->flags = LM_OUT_BURST;
1864 data->length = payload_len;
1865 data->handle = entry->handle;
1866 data->aid = 1;
1867 data->rts_retries = 7;
1868 data->retries = 7;
1869 data->aloft_ctrl = 0;
1870 data->crypt_offset = 58;
1871 data->keytype = 0;
1872 data->keylen = 0;
1873 data->queue = LM_QUEUE_DATA3;
1874 data->backlog = 32;
1875 data->antenna = 2;
1876 data->cts = 3;
1877 data->power = 127;
1878
1879 for (i = 0; i < 8; i++)
1880 data->aloft[i] = 0;
1881
1882 /*
1883 * check if there's enough space in tx buffer
1884 *
1885 * FIXME: ignored for now
1886 */
1887
1888 stlc45xx_tx_frame(stlc, entry->start, skb->data, skb->len);
1889
1890 list_add(&entry->tx_list, &stlc->tx_sent);
1891
1892 return 0;
1893}
1894
1895/*
1896 * caller must hold mutex
1897 *
1898 * shamelessly stolen from mac80211/ieee80211_send_nullfunc
1899 */
1900static int stlc45xx_tx_nullfunc(struct stlc45xx *stlc, bool powersave)
1901{
1902 struct ieee80211_hdr *nullfunc;
1903 int payload_len, padding, i;
1904 struct s_lm_data_out *data;
1905 struct txbuffer *entry;
1906 struct sk_buff *skb;
1907 char *payload;
1908 u16 fc;
1909
1910 skb = dev_alloc_skb(stlc->hw->extra_tx_headroom + 24);
1911 if (!skb) {
1912 stlc45xx_warning("failed to allocate buffer for null frame\n");
1913 return -ENOMEM;
1914 }
1915 skb_reserve(skb, stlc->hw->extra_tx_headroom);
1916
1917 nullfunc = (struct ieee80211_hdr *) skb_put(skb, 24);
1918 memset(nullfunc, 0, 24);
1919 fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
1920 IEEE80211_FCTL_TODS;
1921
1922 if (powersave)
1923 fc |= IEEE80211_FCTL_PM;
1924
1925 nullfunc->frame_control = cpu_to_le16(fc);
1926 memcpy(nullfunc->addr1, stlc->bssid, ETH_ALEN);
1927 memcpy(nullfunc->addr2, stlc->mac_addr, ETH_ALEN);
1928 memcpy(nullfunc->addr3, stlc->bssid, ETH_ALEN);
1929
1930 stlc45xx_debug(DEBUG_PSM, "sending Null frame to %pM (powersave %d, "
1931 "fc 0x%x)", nullfunc->addr1, powersave, fc);
1932
1933 spin_lock_bh(&stlc->tx_lock);
1934
1935 entry = stlc45xx_txbuffer_alloc(stlc, skb->len);
1936
1937 spin_unlock_bh(&stlc->tx_lock);
1938
1939 if (!entry) {
1940 /*
1941 * The queue should be stopped before the firmware buffer
1942 * is full, so firmware buffer should always have enough
1943 * space.
1944 *
1945 * But I'm too lazy and omit it for now.
1946 */
1947 if (net_ratelimit())
1948 stlc45xx_warning("firmware tx buffer full is full "
1949 "for null frame");
1950 return -ENOSPC;
1951 }
1952
1953 payload = skb->data;
1954 payload_len = skb->len;
1955 padding = (int) (skb->data - sizeof(*data)) & 3;
1956 entry->header_len = sizeof(*data) + padding;
1957
1958 entry->skb = skb;
1959 entry->status_needed = false;
1960 entry->handle = (u32) skb;
1961 entry->lifetime = jiffies + msecs_to_jiffies(TX_FRAME_LIFETIME);
1962
1963 stlc45xx_debug(DEBUG_TX, "tx data 0x%x (0x%p payload %d B "
1964 "padding %d header_len %d)",
1965 entry->handle, payload, payload_len, padding,
1966 entry->header_len);
1967 stlc45xx_dump(DEBUG_TX_CONTENT, payload, payload_len);
1968
1969 data = (struct s_lm_data_out *) skb_push(skb, entry->header_len);
1970
1971 memset(data, 0, entry->header_len);
1972
1973 if (padding)
1974 data->flags = LM_FLAG_ALIGN;
1975
1976 data->flags = LM_OUT_BURST;
1977 data->length = payload_len;
1978 data->handle = entry->handle;
1979 data->aid = 1;
1980 data->rts_retries = 7;
1981 data->retries = 7;
1982 data->aloft_ctrl = 0;
1983 data->crypt_offset = 58;
1984 data->keytype = 0;
1985 data->keylen = 0;
1986 data->queue = LM_QUEUE_DATA3;
1987 data->backlog = 32;
1988 data->antenna = 2;
1989 data->cts = 3;
1990 data->power = 127;
1991
1992 for (i = 0; i < 8; i++)
1993 data->aloft[i] = 0;
1994
1995 /*
1996 * check if there's enough space in tx buffer
1997 *
1998 * FIXME: ignored for now
1999 */
2000
2001 stlc45xx_tx_frame(stlc, entry->start, skb->data, skb->len);
2002
2003 list_add(&entry->tx_list, &stlc->tx_sent);
2004
2005 return 0;
2006}
2007
2008/* caller must hold mutex */
2009static void stlc45xx_tx_psm(struct stlc45xx *stlc, bool enable)
2010{
2011 struct s_lm_control *control;
2012 struct s_lmo_psm *psm;
2013 size_t len, psm_len;
2014
2015 WARN_ON(!stlc->associated);
2016 WARN_ON(stlc->aid < 1);
2017 WARN_ON(stlc->aid > 2007);
2018
2019 psm_len = sizeof(*psm);
2020 len = sizeof(*control) + psm_len;
2021 control = kzalloc(len, GFP_KERNEL);
2022 psm = (struct s_lmo_psm *) (control + 1);
2023
2024 control->flags = LM_FLAG_CONTROL | LM_CTRL_OPSET;
2025 control->length = psm_len;
2026 control->oid = LM_OID_PSM;
2027
2028 if (enable)
2029 psm->flags |= LM_PSM;
2030
2031 psm->aid = stlc->aid;
2032
2033 psm->beacon_rcpi_skip_max = 60;
2034
2035 psm->intervals[0].interval = 1;
2036 psm->intervals[0].periods = 1;
2037 psm->intervals[1].interval = 1;
2038 psm->intervals[1].periods = 1;
2039 psm->intervals[2].interval = 1;
2040 psm->intervals[2].periods = 1;
2041 psm->intervals[3].interval = 1;
2042 psm->intervals[3].periods = 1;
2043
2044 psm->nr = 0;
2045 psm->exclude[0] = 0;
2046
2047 stlc45xx_debug(DEBUG_PSM, "sending LM_OID_PSM (aid %d, interval %d)",
2048 psm->aid, psm->intervals[0].interval);
2049
2050 stlc45xx_tx_frame(stlc, FIRMWARE_CONFIG_START, control, len);
2051
2052 kfree(control);
2053}
2054
2055static int stlc45xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2056{
2057 struct stlc45xx *stlc = hw->priv;
2058 struct ieee80211_tx_info *info;
2059 struct ieee80211_rate *rate;
2060 int payload_len, padding, i;
2061 struct s_lm_data_out *data;
2062 struct txbuffer *entry;
2063 char *payload;
2064
2065 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2066
2067 spin_lock_bh(&stlc->tx_lock);
2068
2069 entry = stlc45xx_txbuffer_alloc(stlc, skb->len);
2070 if (!entry) {
2071 /* the queue should be stopped before the firmware buffer
2072 * is full, so firmware buffer should always have enough
2073 * space */
2074 if (net_ratelimit())
2075 stlc45xx_warning("firmware buffer full");
2076 spin_unlock_bh(&stlc->tx_lock);
2077 return NETDEV_TX_BUSY;
2078 }
2079
2080 info = IEEE80211_SKB_CB(skb);
2081
2082 payload = skb->data;
2083 payload_len = skb->len;
2084 padding = (int) (skb->data - sizeof(*data)) & 3;
2085 entry->header_len = sizeof(*data) + padding;
2086
2087 entry->skb = skb;
2088 entry->status_needed = true;
2089 entry->handle = (u32) skb;
2090 entry->lifetime = jiffies + msecs_to_jiffies(TX_FRAME_LIFETIME);
2091
2092 stlc45xx_debug(DEBUG_TX, "tx data 0x%x (0x%p payload %d B "
2093 "padding %d header_len %d)",
2094 entry->handle, payload, payload_len, padding,
2095 entry->header_len);
2096 stlc45xx_dump(DEBUG_TX_CONTENT, payload, payload_len);
2097
2098 data = (struct s_lm_data_out *) skb_push(skb, entry->header_len);
2099
2100 memset(data, 0, entry->header_len);
2101
2102 if (padding)
2103 data->flags = LM_FLAG_ALIGN;
2104
2105 data->flags = LM_OUT_BURST;
2106 data->length = payload_len;
2107 data->handle = entry->handle;
2108 data->aid = 1;
2109 data->rts_retries = 7;
2110 data->retries = 7;
2111 data->aloft_ctrl = 0;
2112 data->crypt_offset = 58;
2113 data->keytype = 0;
2114 data->keylen = 0;
2115 data->queue = 2;
2116 data->backlog = 32;
2117 data->antenna = 2;
2118 data->cts = 3;
2119 data->power = 127;
2120
2121 for (i = 0; i < 8; i++) {
2122 rate = ieee80211_get_tx_rate(stlc->hw, info);
2123 data->aloft[i] = rate->hw_value;
2124 }
2125
2126 list_add_tail(&entry->tx_list, &stlc->tx_pending);
2127
2128 /* check if there's enough space in tx buffer */
2129 if (stlc45xx_txbuffer_find(stlc, MAX_FRAME_LEN) == -1) {
2130 stlc45xx_debug(DEBUG_QUEUE, "tx buffer full, stopping queues");
2131 stlc->tx_queue_stopped = 1;
2132 ieee80211_stop_queues(stlc->hw);
2133 }
2134
2135 queue_work(stlc->hw->workqueue, &stlc->work);
2136
2137 spin_unlock_bh(&stlc->tx_lock);
2138
2139 return NETDEV_TX_OK;
2140}
2141
2142static int stlc45xx_op_start(struct ieee80211_hw *hw)
2143{
2144 struct stlc45xx *stlc = hw->priv;
2145 unsigned long timeout;
2146 int ret = 0;
2147
2148 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2149
2150 mutex_lock(&stlc->mutex);
2151
2152 stlc->fw_state = FW_STATE_BOOTING;
2153 stlc->channel = 1;
2154
2155 stlc45xx_power_on(stlc);
2156
2157 ret = stlc45xx_upload_firmware(stlc);
2158 if (ret < 0) {
2159 stlc45xx_power_off(stlc);
2160 goto out_unlock;
2161 }
2162
2163 stlc->tx_queue_stopped = 0;
2164
2165 mutex_unlock(&stlc->mutex);
2166
2167 timeout = msecs_to_jiffies(2000);
2168 timeout = wait_for_completion_interruptible_timeout(&stlc->fw_comp,
2169 timeout);
2170 if (!timeout) {
2171 stlc45xx_error("firmware boot failed");
2172 stlc45xx_power_off(stlc);
2173 ret = -1;
2174 goto out;
2175 }
2176
2177 stlc45xx_debug(DEBUG_BOOT, "firmware booted");
2178
2179 /* FIXME: should we take mutex just after wait_for_completion()? */
2180 mutex_lock(&stlc->mutex);
2181
2182 WARN_ON(stlc->fw_state != FW_STATE_READY);
2183
2184out_unlock:
2185 mutex_unlock(&stlc->mutex);
2186
2187out:
2188 return ret;
2189}
2190
2191static void stlc45xx_op_stop(struct ieee80211_hw *hw)
2192{
2193 struct stlc45xx *stlc = hw->priv;
2194
2195 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2196
2197 mutex_lock(&stlc->mutex);
2198
2199 WARN_ON(stlc->fw_state != FW_STATE_READY);
2200
2201 stlc45xx_power_off(stlc);
2202
2203 /* FIXME: make sure that all work_structs have completed */
2204
2205 spin_lock_bh(&stlc->tx_lock);
2206 stlc45xx_flush_queues(stlc);
2207 spin_unlock_bh(&stlc->tx_lock);
2208
2209 stlc->fw_state = FW_STATE_OFF;
2210
2211 mutex_unlock(&stlc->mutex);
2212}
2213
2214static int stlc45xx_op_add_interface(struct ieee80211_hw *hw,
2215 struct ieee80211_if_init_conf *conf)
2216{
2217 struct stlc45xx *stlc = hw->priv;
2218
2219 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2220
2221 switch (conf->type) {
2222 case NL80211_IFTYPE_STATION:
2223 break;
2224 default:
2225 return -EOPNOTSUPP;
2226 }
2227
2228 memcpy(stlc->mac_addr, conf->mac_addr, ETH_ALEN);
2229
2230 return 0;
2231}
2232
2233static void stlc45xx_op_remove_interface(struct ieee80211_hw *hw,
2234 struct ieee80211_if_init_conf *conf)
2235{
2236 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2237}
2238
2239static int stlc45xx_op_config(struct ieee80211_hw *hw, u32 changed)
2240{
2241 struct stlc45xx *stlc = hw->priv;
2242
2243 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2244
2245 mutex_lock(&stlc->mutex);
2246
2247 stlc->channel = hw->conf.channel->hw_value;
2248 stlc45xx_tx_scan(stlc);
2249 stlc45xx_tx_setup(stlc);
2250 stlc45xx_tx_edcf(stlc);
2251
2252 if ((hw->conf.flags & IEEE80211_CONF_PS) != stlc->psm) {
2253 stlc->psm = hw->conf.flags & IEEE80211_CONF_PS;
2254 if (stlc->associated) {
2255 stlc45xx_tx_psm(stlc, stlc->psm);
2256 stlc45xx_tx_nullfunc(stlc, stlc->psm);
2257 }
2258 }
2259
2260 mutex_unlock(&stlc->mutex);
2261
2262 return 0;
2263}
2264
2265static void stlc45xx_op_configure_filter(struct ieee80211_hw *hw,
2266 unsigned int changed_flags,
2267 unsigned int *total_flags,
2268 int mc_count,
2269 struct dev_addr_list *mc_list)
2270{
2271 *total_flags = 0;
2272}
2273
2274static void stlc45xx_op_bss_info_changed(struct ieee80211_hw *hw,
2275 struct ieee80211_vif *vif,
2276 struct ieee80211_bss_conf *info,
2277 u32 changed)
2278{
2279 struct stlc45xx *stlc = hw->priv;
2280
2281 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2282 mutex_lock(&stlc->mutex);
2283
2284 memcpy(stlc->bssid, info->bssid, ETH_ALEN);
2285 stlc45xx_tx_setup(stlc);
2286
2287 mutex_unlock(&stlc->mutex);
2288
2289 if (changed & BSS_CHANGED_ASSOC) {
2290 stlc->associated = info->assoc;
2291 if (info->assoc)
2292 stlc->aid = info->aid;
2293 else
2294 stlc->aid = -1;
2295
2296 if (stlc->psm) {
2297 stlc45xx_tx_psm(stlc, stlc->psm);
2298 stlc45xx_tx_nullfunc(stlc, stlc->psm);
2299 }
2300 }
2301}
2302
2303
2304/* can't be const, mac80211 writes to this */
2305static struct ieee80211_rate stlc45xx_rates[] = {
2306 { .bitrate = 10, .hw_value = 0, .hw_value_short = 0, },
2307 { .bitrate = 20, .hw_value = 1, .hw_value_short = 1, },
2308 { .bitrate = 55, .hw_value = 2, .hw_value_short = 2, },
2309 { .bitrate = 110, .hw_value = 3, .hw_value_short = 3, },
2310 { .bitrate = 60, .hw_value = 4, .hw_value_short = 4, },
2311 { .bitrate = 90, .hw_value = 5, .hw_value_short = 5, },
2312 { .bitrate = 120, .hw_value = 6, .hw_value_short = 6, },
2313 { .bitrate = 180, .hw_value = 7, .hw_value_short = 7, },
2314 { .bitrate = 240, .hw_value = 8, .hw_value_short = 8, },
2315 { .bitrate = 360, .hw_value = 9, .hw_value_short = 9, },
2316 { .bitrate = 480, .hw_value = 10, .hw_value_short = 10, },
2317 { .bitrate = 540, .hw_value = 11, .hw_value_short = 11, },
2318};
2319
2320/* can't be const, mac80211 writes to this */
2321static struct ieee80211_channel stlc45xx_channels[] = {
2322 { .hw_value = 1, .center_freq = 2412},
2323 { .hw_value = 2, .center_freq = 2417},
2324 { .hw_value = 3, .center_freq = 2422},
2325 { .hw_value = 4, .center_freq = 2427},
2326 { .hw_value = 5, .center_freq = 2432},
2327 { .hw_value = 6, .center_freq = 2437},
2328 { .hw_value = 7, .center_freq = 2442},
2329 { .hw_value = 8, .center_freq = 2447},
2330 { .hw_value = 9, .center_freq = 2452},
2331 { .hw_value = 10, .center_freq = 2457},
2332 { .hw_value = 11, .center_freq = 2462},
2333 { .hw_value = 12, .center_freq = 2467},
2334 { .hw_value = 13, .center_freq = 2472},
2335};
2336
2337/* can't be const, mac80211 writes to this */
2338static struct ieee80211_supported_band stlc45xx_band_2ghz = {
2339 .channels = stlc45xx_channels,
2340 .n_channels = ARRAY_SIZE(stlc45xx_channels),
2341 .bitrates = stlc45xx_rates,
2342 .n_bitrates = ARRAY_SIZE(stlc45xx_rates),
2343};
2344
2345static const struct ieee80211_ops stlc45xx_ops = {
2346 .start = stlc45xx_op_start,
2347 .stop = stlc45xx_op_stop,
2348 .add_interface = stlc45xx_op_add_interface,
2349 .remove_interface = stlc45xx_op_remove_interface,
2350 .config = stlc45xx_op_config,
2351 .configure_filter = stlc45xx_op_configure_filter,
2352 .tx = stlc45xx_op_tx,
2353 .bss_info_changed = stlc45xx_op_bss_info_changed,
2354};
2355
2356static int stlc45xx_register_mac80211(struct stlc45xx *stlc)
2357{
2358 /* FIXME: SET_IEEE80211_PERM_ADDR() requires default_mac_addr
2359 to be non-const for some strange reason */
2360 static u8 default_mac_addr[ETH_ALEN] = {
2361 0x00, 0x02, 0xee, 0xc0, 0xff, 0xee
2362 };
2363 int ret;
2364
2365 SET_IEEE80211_PERM_ADDR(stlc->hw, default_mac_addr);
2366
2367 ret = ieee80211_register_hw(stlc->hw);
2368 if (ret) {
2369 stlc45xx_error("unable to register mac80211 hw: %d", ret);
2370 return ret;
2371 }
2372
2373 return 0;
2374}
2375
2376static void stlc45xx_device_release(struct device *dev)
2377{
2378
2379}
2380
2381static struct platform_device stlc45xx_device = {
2382 .name = "stlc45xx",
2383 .id = -1,
2384
2385 /* device model insists to have a release function */
2386 .dev = {
2387 .release = stlc45xx_device_release,
2388 },
2389};
2390
2391static int __devinit stlc45xx_probe(struct spi_device *spi)
2392{
2393 struct stlc45xx *stlc;
2394 struct ieee80211_hw *hw;
2395 int ret;
2396
2397 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2398
2399 /* mac80211 alloc */
2400 hw = ieee80211_alloc_hw(sizeof(*stlc), &stlc45xx_ops);
2401 if (!hw) {
2402 stlc45xx_error("could not alloc ieee80211_hw");
2403 ret = -ENOMEM;
2404 goto out;
2405 }
2406
2407 /* mac80211 clears hw->priv */
2408 stlc = hw->priv;
2409
2410 stlc->hw = hw;
2411 dev_set_drvdata(&spi->dev, stlc);
2412 stlc->spi = spi;
2413
2414 spi->bits_per_word = 16;
2415 spi->max_speed_hz = 24000000;
2416
2417 ret = spi_setup(spi);
2418 if (ret < 0)
2419 stlc45xx_error("spi_setup failed");
2420
2421 ret = gpio_request(stlc45xx_gpio_power, "stlc45xx power");
2422 if (ret < 0) {
2423 stlc45xx_error("power GPIO request failed: %d", ret);
2424 return ret;
2425 }
2426
2427 ret = gpio_request(stlc45xx_gpio_irq, "stlc45xx irq");
2428 if (ret < 0) {
2429 stlc45xx_error("irq GPIO request failed: %d", ret);
2430 goto out;
2431 }
2432
2433 gpio_direction_output(stlc45xx_gpio_power, 0);
2434 gpio_direction_input(stlc45xx_gpio_irq);
2435
2436 ret = request_irq(gpio_to_irq(stlc45xx_gpio_irq),
2437 stlc45xx_interrupt, IRQF_DISABLED, "stlc45xx",
2438 stlc->spi);
2439 if (ret < 0)
2440 /* FIXME: handle the error */
2441 stlc45xx_error("request_irq() failed");
2442
2443 set_irq_type(gpio_to_irq(stlc45xx_gpio_irq),
2444 IRQ_TYPE_EDGE_RISING);
2445
2446 disable_irq(gpio_to_irq(stlc45xx_gpio_irq));
2447
2448 ret = platform_device_register(&stlc45xx_device);
2449 if (ret) {
2450 stlc45xx_error("Couldn't register wlan_omap device.");
2451 return ret;
2452 }
2453 dev_set_drvdata(&stlc45xx_device.dev, stlc);
2454
2455 INIT_WORK(&stlc->work, stlc45xx_work);
2456 INIT_WORK(&stlc->work_reset, stlc45xx_work_reset);
2457 INIT_DELAYED_WORK(&stlc->work_tx_timeout, stlc45xx_work_tx_timeout);
2458 mutex_init(&stlc->mutex);
2459 init_completion(&stlc->fw_comp);
2460 spin_lock_init(&stlc->tx_lock);
2461 INIT_LIST_HEAD(&stlc->txbuffer);
2462 INIT_LIST_HEAD(&stlc->tx_pending);
2463 INIT_LIST_HEAD(&stlc->tx_sent);
2464
2465 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
2466 IEEE80211_HW_SIGNAL_DBM |
2467 IEEE80211_HW_NOISE_DBM;
2468 /* four bytes for padding */
2469 hw->extra_tx_headroom = sizeof(struct s_lm_data_out) + 4;
2470
2471 /* unit us */
2472 hw->channel_change_time = 1000;
2473
2474 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
2475 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &stlc45xx_band_2ghz;
2476
2477 SET_IEEE80211_DEV(hw, &spi->dev);
2478
2479 BUILD_BUG_ON(sizeof(default_cal_rssi) != RSSI_CAL_ARRAY_LEN);
2480 BUILD_BUG_ON(sizeof(default_cal_channels) != CHANNEL_CAL_ARRAY_LEN);
2481
2482 stlc->cal_rssi = kmemdup(default_cal_rssi, RSSI_CAL_ARRAY_LEN,
2483 GFP_KERNEL);
2484 stlc->cal_channels = kmemdup(default_cal_channels,
2485 CHANNEL_CAL_ARRAY_LEN,
2486 GFP_KERNEL);
2487
2488 ret = device_create_file(&stlc45xx_device.dev, &dev_attr_cal_rssi);
2489 if (ret < 0) {
2490 stlc45xx_error("failed to create sysfs file cal_rssi");
2491 goto out;
2492 }
2493
2494 ret = device_create_file(&stlc45xx_device.dev, &dev_attr_cal_channels);
2495 if (ret < 0) {
2496 stlc45xx_error("failed to create sysfs file cal_channels");
2497 goto out;
2498 }
2499
2500 ret = device_create_file(&stlc45xx_device.dev, &dev_attr_tx_buf);
2501 if (ret < 0) {
2502 stlc45xx_error("failed to create sysfs file tx_buf");
2503 goto out;
2504 }
2505
2506 ret = stlc45xx_register_mac80211(stlc);
2507 if (ret < 0)
2508 goto out;
2509
2510 stlc45xx_info("v" DRIVER_VERSION " loaded");
2511
2512 stlc45xx_info("config buffer 0x%x-0x%x",
2513 FIRMWARE_CONFIG_START, FIRMWARE_CONFIG_END);
2514 stlc45xx_info("tx 0x%x-0x%x, rx 0x%x-0x%x",
2515 FIRMWARE_TXBUFFER_START, FIRMWARE_TXBUFFER_END,
2516 FIRMWARE_RXBUFFER_START, FIRMWARE_RXBUFFER_END);
2517
2518out:
2519 return ret;
2520}
2521
2522static int __devexit stlc45xx_remove(struct spi_device *spi)
2523{
2524 struct stlc45xx *stlc = dev_get_drvdata(&spi->dev);
2525
2526 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2527
2528 platform_device_unregister(&stlc45xx_device);
2529
2530 ieee80211_unregister_hw(stlc->hw);
2531
2532 free_irq(gpio_to_irq(stlc45xx_gpio_irq), spi);
2533
2534 gpio_free(stlc45xx_gpio_power);
2535 gpio_free(stlc45xx_gpio_irq);
2536
2537 /* FIXME: free cal_channels and cal_rssi? */
2538
2539 kfree(stlc->fw);
2540
2541 mutex_destroy(&stlc->mutex);
2542
2543 /* frees also stlc */
2544 ieee80211_free_hw(stlc->hw);
2545 stlc = NULL;
2546
2547 return 0;
2548}
2549
2550
2551static struct spi_driver stlc45xx_spi_driver = {
2552 .driver = {
2553 /* use cx3110x name because board-n800.c uses that for the
2554 * SPI port */
2555 .name = "cx3110x",
2556 .bus = &spi_bus_type,
2557 .owner = THIS_MODULE,
2558 },
2559
2560 .probe = stlc45xx_probe,
2561 .remove = __devexit_p(stlc45xx_remove),
2562};
2563
2564static int __init stlc45xx_init(void)
2565{
2566 int ret;
2567
2568 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2569
2570 ret = spi_register_driver(&stlc45xx_spi_driver);
2571 if (ret < 0) {
2572 stlc45xx_error("failed to register SPI driver: %d", ret);
2573 goto out;
2574 }
2575
2576out:
2577 return ret;
2578}
2579
2580static void __exit stlc45xx_exit(void)
2581{
2582 stlc45xx_debug(DEBUG_FUNC, "%s", __func__);
2583
2584 spi_unregister_driver(&stlc45xx_spi_driver);
2585
2586 stlc45xx_info("unloaded");
2587}
2588
2589module_init(stlc45xx_init);
2590module_exit(stlc45xx_exit);
2591
2592MODULE_LICENSE("GPL");
2593MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>");
2594MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/staging/stlc45xx/stlc45xx.h b/drivers/staging/stlc45xx/stlc45xx.h
deleted file mode 100644
index ac96bbbde79f..000000000000
--- a/drivers/staging/stlc45xx/stlc45xx.h
+++ /dev/null
@@ -1,283 +0,0 @@
1/*
2 * This file is part of stlc45xx
3 *
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Kalle Valo <kalle.valo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * 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., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include <linux/mutex.h>
25#include <linux/list.h>
26#include <net/mac80211.h>
27
28#include "stlc45xx_lmac.h"
29
30#define DRIVER_NAME "stlc45xx"
31#define DRIVER_VERSION "0.1.3"
32
33#define DRIVER_PREFIX DRIVER_NAME ": "
34
35enum {
36 DEBUG_NONE = 0,
37 DEBUG_FUNC = 1 << 0,
38 DEBUG_IRQ = 1 << 1,
39 DEBUG_BH = 1 << 2,
40 DEBUG_RX = 1 << 3,
41 DEBUG_RX_CONTENT = 1 << 5,
42 DEBUG_TX = 1 << 6,
43 DEBUG_TX_CONTENT = 1 << 8,
44 DEBUG_TXBUFFER = 1 << 9,
45 DEBUG_QUEUE = 1 << 10,
46 DEBUG_BOOT = 1 << 11,
47 DEBUG_PSM = 1 << 12,
48 DEBUG_ALL = ~0,
49};
50
51#define DEBUG_LEVEL DEBUG_NONE
52/* #define DEBUG_LEVEL DEBUG_ALL */
53/* #define DEBUG_LEVEL (DEBUG_TX | DEBUG_RX | DEBUG_IRQ) */
54/* #define DEBUG_LEVEL (DEBUG_TX | DEBUG_MEMREGION | DEBUG_QUEUE) */
55/* #define DEBUG_LEVEL (DEBUG_MEMREGION | DEBUG_QUEUE) */
56
57#define stlc45xx_error(fmt, arg...) \
58 printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
59
60#define stlc45xx_warning(fmt, arg...) \
61 printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
62
63#define stlc45xx_info(fmt, arg...) \
64 printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg)
65
66#define stlc45xx_debug(level, fmt, arg...) \
67 do { \
68 if (level & DEBUG_LEVEL) \
69 printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \
70 } while (0)
71
72#define stlc45xx_dump(level, buf, len) \
73 do { \
74 if (level & DEBUG_LEVEL) \
75 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, \
76 16, 1, buf, len, 1); \
77 } while (0)
78
79#define MAC2STR(a) ((a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5])
80#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
81
82/* Bit 15 is read/write bit; ON = READ, OFF = WRITE */
83#define ADDR_READ_BIT_15 0x8000
84
85#define SPI_ADRS_ARM_INTERRUPTS 0x00
86#define SPI_ADRS_ARM_INT_EN 0x04
87
88#define SPI_ADRS_HOST_INTERRUPTS 0x08
89#define SPI_ADRS_HOST_INT_EN 0x0c
90#define SPI_ADRS_HOST_INT_ACK 0x10
91
92#define SPI_ADRS_GEN_PURP_1 0x14
93#define SPI_ADRS_GEN_PURP_2 0x18
94
95/* high word */
96#define SPI_ADRS_DEV_CTRL_STAT 0x26
97
98#define SPI_ADRS_DMA_DATA 0x28
99
100#define SPI_ADRS_DMA_WRITE_CTRL 0x2c
101#define SPI_ADRS_DMA_WRITE_LEN 0x2e
102#define SPI_ADRS_DMA_WRITE_BASE 0x30
103
104#define SPI_ADRS_DMA_READ_CTRL 0x34
105#define SPI_ADRS_DMA_READ_LEN 0x36
106#define SPI_ADRS_DMA_READ_BASE 0x38
107
108#define SPI_CTRL_STAT_HOST_OVERRIDE 0x8000
109#define SPI_CTRL_STAT_START_HALTED 0x4000
110#define SPI_CTRL_STAT_RAM_BOOT 0x2000
111#define SPI_CTRL_STAT_HOST_RESET 0x1000
112#define SPI_CTRL_STAT_HOST_CPU_EN 0x0800
113
114#define SPI_DMA_WRITE_CTRL_ENABLE 0x0001
115#define SPI_DMA_READ_CTRL_ENABLE 0x0001
116#define HOST_ALLOWED (1 << 7)
117
118#define FIRMWARE_ADDRESS 0x20000
119
120#define SPI_TIMEOUT 100 /* msec */
121
122#define SPI_MAX_TX_PACKETS 32
123
124#define SPI_MAX_PACKET_SIZE 32767
125
126#define SPI_TARGET_INT_WAKEUP 0x00000001
127#define SPI_TARGET_INT_SLEEP 0x00000002
128#define SPI_TARGET_INT_RDDONE 0x00000004
129
130#define SPI_TARGET_INT_CTS 0x00004000
131#define SPI_TARGET_INT_DR 0x00008000
132
133#define SPI_HOST_INT_READY 0x00000001
134#define SPI_HOST_INT_WR_READY 0x00000002
135#define SPI_HOST_INT_SW_UPDATE 0x00000004
136#define SPI_HOST_INT_UPDATE 0x10000000
137
138/* clear to send */
139#define SPI_HOST_INT_CTS 0x00004000
140
141/* data ready */
142#define SPI_HOST_INT_DR 0x00008000
143
144#define SPI_HOST_INTS_DEFAULT \
145 (SPI_HOST_INT_READY | SPI_HOST_INT_UPDATE | SPI_HOST_INT_SW_UPDATE)
146
147#define TARGET_BOOT_SLEEP 50
148
149/* The firmware buffer is divided into three areas:
150 *
151 * o config area (for control commands)
152 * o tx buffer
153 * o rx buffer
154 */
155#define FIRMWARE_BUFFER_START 0x20200
156#define FIRMWARE_BUFFER_END 0x27c60
157#define FIRMWARE_BUFFER_LEN (FIRMWARE_BUFFER_END - FIRMWARE_BUFFER_START)
158#define FIRMWARE_MTU 3240
159#define FIRMWARE_CONFIG_PAYLOAD_LEN 1024
160#define FIRMWARE_CONFIG_START FIRMWARE_BUFFER_START
161#define FIRMWARE_CONFIG_LEN (sizeof(struct s_lm_control) + \
162 FIRMWARE_CONFIG_PAYLOAD_LEN)
163#define FIRMWARE_CONFIG_END (FIRMWARE_CONFIG_START + FIRMWARE_CONFIG_LEN - 1)
164#define FIRMWARE_RXBUFFER_LEN (5 * FIRMWARE_MTU + 1024)
165#define FIRMWARE_RXBUFFER_START (FIRMWARE_BUFFER_END - FIRMWARE_RXBUFFER_LEN)
166#define FIRMWARE_RXBUFFER_END (FIRMWARE_RXBUFFER_START + \
167 FIRMWARE_RXBUFFER_LEN - 1)
168#define FIRMWARE_TXBUFFER_START (FIRMWARE_BUFFER_START + FIRMWARE_CONFIG_LEN)
169#define FIRMWARE_TXBUFFER_LEN (FIRMWARE_BUFFER_LEN - FIRMWARE_CONFIG_LEN - \
170 FIRMWARE_RXBUFFER_LEN)
171#define FIRMWARE_TXBUFFER_END (FIRMWARE_TXBUFFER_START + \
172 FIRMWARE_TXBUFFER_LEN - 1)
173
174#define FIRMWARE_TXBUFFER_HEADER 100
175#define FIRMWARE_TXBUFFER_TRAILER 4
176
177/* FIXME: come up with a proper value */
178#define MAX_FRAME_LEN 2500
179
180/* unit is ms */
181#define TX_FRAME_LIFETIME 2000
182#define TX_TIMEOUT 4000
183
184#define SUPPORTED_CHANNELS 13
185
186/* FIXME */
187/* #define CHANNEL_CAL_LEN offsetof(struct s_lmo_scan, bratemask) - \ */
188/* offsetof(struct s_lmo_scan, channel) */
189#define CHANNEL_CAL_LEN 292
190#define CHANNEL_CAL_ARRAY_LEN (SUPPORTED_CHANNELS * CHANNEL_CAL_LEN)
191/* FIXME */
192/* #define RSSI_CAL_LEN sizeof(struct s_lmo_scan) - \ */
193/* offsetof(struct s_lmo_scan, rssical) */
194#define RSSI_CAL_LEN 8
195#define RSSI_CAL_ARRAY_LEN (SUPPORTED_CHANNELS * RSSI_CAL_LEN)
196
197struct s_dma_regs {
198 unsigned short cmd;
199 unsigned short len;
200 unsigned long addr;
201};
202
203struct stlc45xx_ie_tim {
204 u8 dtim_count;
205 u8 dtim_period;
206 u8 bmap_control;
207 u8 pvbmap[251];
208};
209
210struct txbuffer {
211 /* can be removed when switched to skb queue */
212 struct list_head tx_list;
213
214 struct list_head buffer_list;
215
216 int start;
217 int frame_start;
218 int end;
219
220 struct sk_buff *skb;
221 u32 handle;
222
223 bool status_needed;
224
225 int header_len;
226
227 /* unit jiffies */
228 unsigned long lifetime;
229};
230
231enum fw_state {
232 FW_STATE_OFF,
233 FW_STATE_BOOTING,
234 FW_STATE_READY,
235 FW_STATE_RESET,
236 FW_STATE_RESETTING,
237};
238
239struct stlc45xx {
240 struct ieee80211_hw *hw;
241 struct spi_device *spi;
242 struct work_struct work;
243 struct work_struct work_reset;
244 struct delayed_work work_tx_timeout;
245 struct mutex mutex;
246 struct completion fw_comp;
247
248
249 u8 bssid[ETH_ALEN];
250 u8 mac_addr[ETH_ALEN];
251 int channel;
252
253 u8 *cal_rssi;
254 u8 *cal_channels;
255
256 enum fw_state fw_state;
257
258 spinlock_t tx_lock;
259
260 /* protected by tx_lock */
261 struct list_head txbuffer;
262
263 /* protected by tx_lock */
264 struct list_head tx_pending;
265
266 /* protected by tx_lock */
267 int tx_queue_stopped;
268
269 /* protected by mutex */
270 struct list_head tx_sent;
271
272 int tx_frames;
273
274 u8 *fw;
275 int fw_len;
276
277 bool psm;
278 bool associated;
279 int aid;
280 bool pspolling;
281};
282
283
diff --git a/drivers/staging/stlc45xx/stlc45xx_lmac.h b/drivers/staging/stlc45xx/stlc45xx_lmac.h
deleted file mode 100644
index af5db801347f..000000000000
--- a/drivers/staging/stlc45xx/stlc45xx_lmac.h
+++ /dev/null
@@ -1,434 +0,0 @@
1/************************************************************************
2* This is the LMAC API interface header file for STLC4560. *
3* Copyright (C) 2007 Conexant Systems, Inc. *
4* This program is free software; you can redistribute it and/or *
5* modify it under the terms of the GNU General Public License *
6* as published by the Free Software Foundation; either version 2 *
7* of the License, or (at your option) any later version. *
8* *
9* This program is distributed in the hope that it will be useful, *
10* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12* GNU General Public License for more details. *
13* *
14* You should have received a copy of the GNU General Public License *
15* along with this program. If not, see <http://www.gnu.org/licenses/>.*
16*************************************************************************/
17
18#ifndef __lmac_h__
19#define __lmac_h__
20
21#define LM_TOP_VARIANT 0x0506
22#define LM_BOTTOM_VARIANT 0x0506
23
24/*
25 * LMAC - UMAC interface definition:
26 */
27
28#define LM_FLAG_CONTROL 0x8000
29#define LM_FLAG_ALIGN 0x4000
30
31#define LM_CTRL_OPSET 0x0001
32
33#define LM_OUT_PROMISC 0x0001
34#define LM_OUT_TIMESTAMP 0x0002
35#define LM_OUT_SEQNR 0x0004
36#define LM_OUT_BURST 0x0010
37#define LM_OUT_NOCANCEL 0x0020
38#define LM_OUT_CLEARTIM 0x0040
39#define LM_OUT_HITCHHIKE 0x0080
40#define LM_OUT_COMPRESS 0x0100
41#define LM_OUT_CONCAT 0x0200
42#define LM_OUT_PCS_ACCEPT 0x0400
43#define LM_OUT_WAITEOSP 0x0800
44
45
46#define LM_ALOFT_SP 0x10
47#define LM_ALOFT_CTS 0x20
48#define LM_ALOFT_RTS 0x40
49#define LM_ALOFT_MASK 0x1f
50#define LM_ALOFT_RATE 0x0f
51
52#define LM_IN_FCS_GOOD 0x0001
53#define LM_IN_MATCH_MAC 0x0002
54#define LM_IN_MCBC 0x0004
55#define LM_IN_BEACON 0x0008
56#define LM_IN_MATCH_BSS 0x0010
57#define LM_IN_BCAST_BSS 0x0020
58#define LM_IN_DATA 0x0040
59#define LM_IN_TRUNCATED 0x0080
60
61#define LM_IN_TRANSPARENT 0x0200
62
63#define LM_QUEUE_BEACON 0
64#define LM_QUEUE_SCAN 1
65#define LM_QUEUE_MGT 2
66#define LM_QUEUE_MCBC 3
67#define LM_QUEUE_DATA 4
68#define LM_QUEUE_DATA0 4
69#define LM_QUEUE_DATA1 5
70#define LM_QUEUE_DATA2 6
71#define LM_QUEUE_DATA3 7
72
73#define LM_SETUP_INFRA 0x0001
74#define LM_SETUP_IBSS 0x0002
75#define LM_SETUP_TRANSPARENT 0x0008
76#define LM_SETUP_PROMISCUOUS 0x0010
77#define LM_SETUP_HIBERNATE 0x0020
78#define LM_SETUP_NOACK 0x0040
79#define LM_SETUP_RX_DISABLED 0x0080
80
81#define LM_ANTENNA_0 0
82#define LM_ANTENNA_1 1
83#define LM_ANTENNA_DIVERSITY 2
84
85#define LM_TX_FAILED 0x0001
86#define LM_TX_PSM 0x0002
87#define LM_TX_PSM_CANCELLED 0x0004
88
89#define LM_SCAN_EXIT 0x0001
90#define LM_SCAN_TRAP 0x0002
91#define LM_SCAN_ACTIVE 0x0004
92#define LM_SCAN_FILTER 0x0008
93
94#define LM_PSM 0x0001
95#define LM_PSM_DTIM 0x0002
96#define LM_PSM_MCBC 0x0004
97#define LM_PSM_CHECKSUM 0x0008
98#define LM_PSM_SKIP_MORE_DATA 0x0010
99#define LM_PSM_BEACON_TIMEOUT 0x0020
100#define LM_PSM_HFOSLEEP 0x0040
101#define LM_PSM_AUTOSWITCH_SLEEP 0x0080
102#define LM_PSM_LPIT 0x0100
103#define LM_PSM_BF_UCAST_SKIP 0x0200
104#define LM_PSM_BF_MCAST_SKIP 0x0400
105
106/* hfosleep */
107#define LM_PSM_SLEEP_OPTION_MASK (LM_PSM_AUTOSWITCH_SLEEP | LM_PSM_HFOSLEEP)
108#define LM_PSM_SLEEP_OPTION_SHIFT 6
109/* hfosleepend */
110#define LM_PSM_BF_OPTION_MASK (LM_PSM_BF_MCAST_SKIP | LM_PSM_BF_UCAST_SKIP)
111#define LM_PSM_BF_OPTION_SHIFT 9
112
113
114#define LM_PRIVACC_WEP 0x01
115#define LM_PRIVACC_TKIP 0x02
116#define LM_PRIVACC_MICHAEL 0x04
117#define LM_PRIVACC_CCX_KP 0x08
118#define LM_PRIVACC_CCX_MIC 0x10
119#define LM_PRIVACC_AES_CCMP 0x20
120
121/* size of s_lm_descr in words */
122#define LM_DESCR_SIZE_WORDS 11
123
124#ifndef __ASSEMBLER__
125
126enum {
127 LM_MODE_CLIENT = 0,
128 LM_MODE_AP
129};
130
131struct s_lm_descr {
132 uint16_t modes;
133 uint16_t flags;
134 uint32_t buffer_start;
135 uint32_t buffer_end;
136 uint8_t header;
137 uint8_t trailer;
138 uint8_t tx_queues;
139 uint8_t tx_depth;
140 uint8_t privacy;
141 uint8_t rx_keycache;
142 uint8_t tim_size;
143 uint8_t pad1;
144 uint8_t rates[16];
145 uint32_t link;
146 uint16_t mtu;
147};
148
149
150struct s_lm_control {
151 uint16_t flags;
152 uint16_t length;
153 uint32_t handle;
154 uint16_t oid;
155 uint16_t pad;
156 /* uint8_t data[]; */
157};
158
159enum {
160 LM_PRIV_NONE = 0,
161 LM_PRIV_WEP,
162 LM_PRIV_TKIP,
163 LM_PRIV_TKIPMICHAEL,
164 LM_PRIV_CCX_WEPMIC,
165 LM_PRIV_CCX_KPMIC,
166 LM_PRIV_CCX_KP,
167 LM_PRIV_AES_CCMP
168};
169
170enum {
171 LM_DECRYPT_NONE,
172 LM_DECRYPT_OK,
173 LM_DECRYPT_NOKEY,
174 LM_DECRYPT_NOMICHAEL,
175 LM_DECRYPT_NOCKIPMIC,
176 LM_DECRYPT_FAIL_WEP,
177 LM_DECRYPT_FAIL_TKIP,
178 LM_DECRYPT_FAIL_MICHAEL,
179 LM_DECRYPT_FAIL_CKIPKP,
180 LM_DECRYPT_FAIL_CKIPMIC,
181 LM_DECRYPT_FAIL_AESCCMP
182};
183
184struct s_lm_data_out {
185 uint16_t flags;
186 uint16_t length;
187 uint32_t handle;
188 uint16_t aid;
189 uint8_t rts_retries;
190 uint8_t retries;
191 uint8_t aloft[8];
192 uint8_t aloft_ctrl;
193 uint8_t crypt_offset;
194 uint8_t keytype;
195 uint8_t keylen;
196 uint8_t key[16];
197 uint8_t queue;
198 uint8_t backlog;
199 uint16_t durations[4];
200 uint8_t antenna;
201 uint8_t cts;
202 int16_t power;
203 uint8_t pad[2];
204 /*uint8_t data[];*/
205};
206
207#define LM_RCPI_INVALID (0xff)
208
209struct s_lm_data_in {
210 uint16_t flags;
211 uint16_t length;
212 uint16_t frequency;
213 uint8_t antenna;
214 uint8_t rate;
215 uint8_t rcpi;
216 uint8_t sq;
217 uint8_t decrypt;
218 uint8_t rssi_raw;
219 uint32_t clock[2];
220 /*uint8_t data[];*/
221};
222
223union u_lm_data {
224 struct s_lm_data_out out;
225 struct s_lm_data_in in;
226};
227
228enum {
229 LM_OID_SETUP = 0,
230 LM_OID_SCAN = 1,
231 LM_OID_TRAP = 2,
232 LM_OID_EDCF = 3,
233 LM_OID_KEYCACHE = 4,
234 LM_OID_PSM = 6,
235 LM_OID_TXCANCEL = 7,
236 LM_OID_TX = 8,
237 LM_OID_BURST = 9,
238 LM_OID_STATS = 10,
239 LM_OID_LED = 13,
240 LM_OID_TIMER = 15,
241 LM_OID_NAV = 20,
242 LM_OID_PCS = 22,
243 LM_OID_BT_BALANCER = 28,
244 LM_OID_GROUP_ADDRESS_TABLE = 30,
245 LM_OID_ARPTABLE = 31,
246 LM_OID_BT_OPTIONS = 35
247};
248
249enum {
250 LM_FRONTEND_UNKNOWN = 0,
251 LM_FRONTEND_DUETTE3,
252 LM_FRONTEND_DUETTE2,
253 LM_FRONTEND_FRISBEE,
254 LM_FRONTEND_CROSSBOW,
255 LM_FRONTEND_LONGBOW
256};
257
258
259#define INVALID_LPF_BANDWIDTH 0xffff
260#define INVALID_OSC_START_DELAY 0xffff
261
262struct s_lmo_setup {
263 uint16_t flags;
264 uint8_t macaddr[6];
265 uint8_t bssid[6];
266 uint8_t antenna;
267 uint8_t rx_align;
268 uint32_t rx_buffer;
269 uint16_t rx_mtu;
270 uint16_t frontend;
271 uint16_t timeout;
272 uint16_t truncate;
273 uint32_t bratemask;
274 uint8_t sbss_offset;
275 uint8_t mcast_window;
276 uint8_t rx_rssi_threshold;
277 uint8_t rx_ed_threshold;
278 uint32_t ref_clock;
279 uint16_t lpf_bandwidth;
280 uint16_t osc_start_delay;
281};
282
283
284struct s_lmo_scan {
285 uint16_t flags;
286 uint16_t dwell;
287 uint8_t channel[292];
288 uint32_t bratemask;
289 uint8_t aloft[8];
290 uint8_t rssical[8];
291};
292
293
294enum {
295 LM_TRAP_SCAN = 0,
296 LM_TRAP_TIMER,
297 LM_TRAP_BEACON_TX,
298 LM_TRAP_FAA_RADIO_ON,
299 LM_TRAP_FAA_RADIO_OFF,
300 LM_TRAP_RADAR,
301 LM_TRAP_NO_BEACON,
302 LM_TRAP_TBTT,
303 LM_TRAP_SCO_ENTER,
304 LM_TRAP_SCO_EXIT
305};
306
307struct s_lmo_trap {
308 uint16_t event;
309 uint16_t frequency;
310};
311
312struct s_lmo_timer {
313 uint32_t interval;
314};
315
316struct s_lmo_nav {
317 uint32_t period;
318};
319
320
321struct s_lmo_edcf_queue;
322
323struct s_lmo_edcf {
324 uint8_t flags;
325 uint8_t slottime;
326 uint8_t sifs;
327 uint8_t eofpad;
328 struct s_lmo_edcf_queue {
329 uint8_t aifs;
330 uint8_t pad0;
331 uint16_t cwmin;
332 uint16_t cwmax;
333 uint16_t txop;
334 } queues[8];
335 uint8_t mapping[4];
336 uint16_t maxburst;
337 uint16_t round_trip_delay;
338};
339
340struct s_lmo_keycache {
341 uint8_t entry;
342 uint8_t keyid;
343 uint8_t address[6];
344 uint8_t pad[2];
345 uint8_t keytype;
346 uint8_t keylen;
347 uint8_t key[24];
348};
349
350
351struct s_lm_interval;
352
353struct s_lmo_psm {
354 uint16_t flags;
355 uint16_t aid;
356 struct s_lm_interval {
357 uint16_t interval;
358 uint16_t periods;
359 } intervals[4];
360 /* uint16_t pad; */
361 uint8_t beacon_rcpi_skip_max;
362 uint8_t rcpi_delta_threshold;
363 uint8_t nr;
364 uint8_t exclude[1];
365};
366
367#define MC_FILTER_ADDRESS_NUM 4
368
369struct s_lmo_group_address_table {
370 uint16_t filter_enable;
371 uint16_t num_address;
372 uint8_t macaddr_list[MC_FILTER_ADDRESS_NUM][6];
373};
374
375struct s_lmo_txcancel {
376 uint32_t address[1];
377};
378
379
380struct s_lmo_tx {
381 uint8_t flags;
382 uint8_t retries;
383 uint8_t rcpi;
384 uint8_t sq;
385 uint16_t seqctrl;
386 uint8_t antenna;
387 uint8_t pad;
388};
389
390struct s_lmo_burst {
391 uint8_t flags;
392 uint8_t queue;
393 uint8_t backlog;
394 uint8_t pad;
395 uint16_t durations[32];
396};
397
398struct s_lmo_stats {
399 uint32_t valid;
400 uint32_t fcs;
401 uint32_t abort;
402 uint32_t phyabort;
403 uint32_t rts_success;
404 uint32_t rts_fail;
405 uint32_t timestamp;
406 uint32_t time_tx;
407 uint32_t noisefloor;
408 uint32_t sample_noise[8];
409 uint32_t sample_cca;
410 uint32_t sample_tx;
411};
412
413
414struct s_lmo_led {
415 uint16_t flags;
416 uint16_t mask[2];
417 uint16_t delay/*[2]*/;
418};
419
420
421struct s_lmo_bt_balancer {
422 uint16_t prio_thresh;
423 uint16_t acl_thresh;
424};
425
426
427struct s_lmo_arp_table {
428 uint16_t filter_enable;
429 uint32_t ipaddr;
430};
431
432#endif /* __ASSEMBLER__ */
433
434#endif /* __lmac_h__ */
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index 3d2a84c45829..e139eaeaa174 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -25,6 +25,7 @@
25#include <linux/poll.h> 25#include <linux/poll.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/sched.h>
28#include <asm/time.h> 29#include <asm/time.h>
29#include <asm/io.h> 30#include <asm/io.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c
index 8960fa9ee7aa..00fe0803c21c 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme/bridges/vme_tsi148.c
@@ -25,6 +25,7 @@
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/sched.h>
28#include <asm/time.h> 29#include <asm/time.h>
29#include <asm/io.h> 30#include <asm/io.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 7f96bcaf1c60..05186110c029 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -1332,7 +1332,6 @@ device_release_WPADEV(pDevice);
1332 free_netdev(pDevice->dev); 1332 free_netdev(pDevice->dev);
1333 } 1333 }
1334 1334
1335 kfree(pDevice);
1336 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_disconnect3.. \n"); 1335 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_disconnect3.. \n");
1337} 1336}
1338 1337
diff --git a/drivers/staging/winbond/Kconfig b/drivers/staging/winbond/Kconfig
index 940460c39f36..132671d96d0d 100644
--- a/drivers/staging/winbond/Kconfig
+++ b/drivers/staging/winbond/Kconfig
@@ -1,6 +1,6 @@
1config W35UND 1config W35UND
2 tristate "IS89C35 WLAN USB driver" 2 tristate "IS89C35 WLAN USB driver"
3 depends on MAC80211 && WLAN_80211 && USB && EXPERIMENTAL 3 depends on MAC80211 && WLAN && USB && EXPERIMENTAL
4 default n 4 default n
5 ---help--- 5 ---help---
6 This is highly experimental driver for Winbond WIFI card. 6 This is highly experimental driver for Winbond WIFI card.
diff --git a/drivers/staging/wlan-ng/Kconfig b/drivers/staging/wlan-ng/Kconfig
index 9959b658c8cf..f44294b0d8dc 100644
--- a/drivers/staging/wlan-ng/Kconfig
+++ b/drivers/staging/wlan-ng/Kconfig
@@ -1,6 +1,6 @@
1config PRISM2_USB 1config PRISM2_USB
2 tristate "Prism2.5/3 USB driver" 2 tristate "Prism2.5/3 USB driver"
3 depends on WLAN_80211 && USB && WIRELESS_EXT 3 depends on WLAN && USB && WIRELESS_EXT
4 default n 4 default n
5 ---help--- 5 ---help---
6 This is the wlan-ng prism 2.5/3 USB driver for a wide range of 6 This is the wlan-ng prism 2.5/3 USB driver for a wide range of
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 33351312327f..a18e3c5dd82e 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -223,6 +223,7 @@ config USB_OTG
223config USB_GADGET_PXA25X 223config USB_GADGET_PXA25X
224 boolean "PXA 25x or IXP 4xx" 224 boolean "PXA 25x or IXP 4xx"
225 depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX 225 depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX
226 select USB_OTG_UTILS
226 help 227 help
227 Intel's PXA 25x series XScale ARM-5TE processors include 228 Intel's PXA 25x series XScale ARM-5TE processors include
228 an integrated full speed USB 1.1 device controller. The 229 an integrated full speed USB 1.1 device controller. The
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index f37de283d0ab..167cb2a8ecef 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -61,11 +61,6 @@
61 * simpler, Microsoft pushes their own approach: RNDIS. The published 61 * simpler, Microsoft pushes their own approach: RNDIS. The published
62 * RNDIS specs are ambiguous and appear to be incomplete, and are also 62 * RNDIS specs are ambiguous and appear to be incomplete, and are also
63 * needlessly complex. They borrow more from CDC ACM than CDC ECM. 63 * needlessly complex. They borrow more from CDC ACM than CDC ECM.
64 *
65 * While CDC ECM, CDC Subset, and RNDIS are designed to extend the ethernet
66 * interface to the target, CDC EEM was designed to use ethernet over the USB
67 * link between the host and target. CDC EEM is implemented as an alternative
68 * to those other protocols when that communication model is more appropriate
69 */ 64 */
70 65
71#define DRIVER_DESC "Ethernet Gadget" 66#define DRIVER_DESC "Ethernet Gadget"
@@ -157,8 +152,8 @@ static inline bool has_rndis(void)
157#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */ 152#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */
158 153
159/* For EEM gadgets */ 154/* For EEM gadgets */
160#define EEM_VENDOR_NUM 0x0525 /* INVALID - NEEDS TO BE ALLOCATED */ 155#define EEM_VENDOR_NUM 0x1d6b /* Linux Foundation */
161#define EEM_PRODUCT_NUM 0xa4a1 /* INVALID - NEEDS TO BE ALLOCATED */ 156#define EEM_PRODUCT_NUM 0x0102 /* EEM Gadget */
162 157
163/*-------------------------------------------------------------------------*/ 158/*-------------------------------------------------------------------------*/
164 159
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 42a74b8a0bb8..fa3d142ba64d 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2139,7 +2139,7 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
2139static void fsl_udc_release(struct device *dev) 2139static void fsl_udc_release(struct device *dev)
2140{ 2140{
2141 complete(udc_controller->done); 2141 complete(udc_controller->done);
2142 dma_free_coherent(dev, udc_controller->ep_qh_size, 2142 dma_free_coherent(dev->parent, udc_controller->ep_qh_size,
2143 udc_controller->ep_qh, udc_controller->ep_qh_dma); 2143 udc_controller->ep_qh, udc_controller->ep_qh_dma);
2144 kfree(udc_controller); 2144 kfree(udc_controller);
2145} 2145}
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 3efa59b18044..b25cdea93a1f 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1400,6 +1400,10 @@ iso_stream_schedule (
1400 goto fail; 1400 goto fail;
1401 } 1401 }
1402 1402
1403 period = urb->interval;
1404 if (!stream->highspeed)
1405 period <<= 3;
1406
1403 now = ehci_readl(ehci, &ehci->regs->frame_index) % mod; 1407 now = ehci_readl(ehci, &ehci->regs->frame_index) % mod;
1404 1408
1405 /* when's the last uframe this urb could start? */ 1409 /* when's the last uframe this urb could start? */
@@ -1417,8 +1421,8 @@ iso_stream_schedule (
1417 1421
1418 /* Fell behind (by up to twice the slop amount)? */ 1422 /* Fell behind (by up to twice the slop amount)? */
1419 if (start >= max - 2 * 8 * SCHEDULE_SLOP) 1423 if (start >= max - 2 * 8 * SCHEDULE_SLOP)
1420 start += stream->interval * DIV_ROUND_UP( 1424 start += period * DIV_ROUND_UP(
1421 max - start, stream->interval) - mod; 1425 max - start, period) - mod;
1422 1426
1423 /* Tried to schedule too far into the future? */ 1427 /* Tried to schedule too far into the future? */
1424 if (unlikely((start + sched->span) >= max)) { 1428 if (unlikely((start + sched->span) >= max)) {
@@ -1441,10 +1445,6 @@ iso_stream_schedule (
1441 1445
1442 /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ 1446 /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
1443 1447
1444 period = urb->interval;
1445 if (!stream->highspeed)
1446 period <<= 3;
1447
1448 /* find a uframe slot with enough bandwidth */ 1448 /* find a uframe slot with enough bandwidth */
1449 for (; start < (stream->next_uframe + period); start++) { 1449 for (; start < (stream->next_uframe + period); start++) {
1450 int enough_space; 1450 int enough_space;
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 749b53742828..e33d36256350 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -1003,19 +1003,20 @@ static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port,
1003 if (syssts == SE0) { 1003 if (syssts == SE0) {
1004 r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); 1004 r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port));
1005 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); 1005 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port));
1006 return; 1006 } else {
1007 } 1007 if (syssts == FS_JSTS)
1008 r8a66597_bset(r8a66597, HSE, get_syscfg_reg(port));
1009 else if (syssts == LS_JSTS)
1010 r8a66597_bclr(r8a66597, HSE, get_syscfg_reg(port));
1008 1011
1009 if (syssts == FS_JSTS) 1012 r8a66597_write(r8a66597, ~DTCH, get_intsts_reg(port));
1010 r8a66597_bset(r8a66597, HSE, get_syscfg_reg(port)); 1013 r8a66597_bset(r8a66597, DTCHE, get_intenb_reg(port));
1011 else if (syssts == LS_JSTS)
1012 r8a66597_bclr(r8a66597, HSE, get_syscfg_reg(port));
1013 1014
1014 r8a66597_write(r8a66597, ~DTCH, get_intsts_reg(port)); 1015 if (r8a66597->bus_suspended)
1015 r8a66597_bset(r8a66597, DTCHE, get_intenb_reg(port)); 1016 usb_hcd_resume_root_hub(r8a66597_to_hcd(r8a66597));
1017 }
1016 1018
1017 if (r8a66597->bus_suspended) 1019 usb_hcd_poll_rh_status(r8a66597_to_hcd(r8a66597));
1018 usb_hcd_resume_root_hub(r8a66597_to_hcd(r8a66597));
1019} 1020}
1020 1021
1021/* this function must be called with interrupt disabled */ 1022/* this function must be called with interrupt disabled */
@@ -1024,6 +1025,8 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port)
1024 u16 speed = get_rh_usb_speed(r8a66597, port); 1025 u16 speed = get_rh_usb_speed(r8a66597, port);
1025 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1026 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
1026 1027
1028 rh->port &= ~((1 << USB_PORT_FEAT_HIGHSPEED) |
1029 (1 << USB_PORT_FEAT_LOWSPEED));
1027 if (speed == HSMODE) 1030 if (speed == HSMODE)
1028 rh->port |= (1 << USB_PORT_FEAT_HIGHSPEED); 1031 rh->port |= (1 << USB_PORT_FEAT_HIGHSPEED);
1029 else if (speed == LSMODE) 1032 else if (speed == LSMODE)
diff --git a/drivers/usb/host/whci/asl.c b/drivers/usb/host/whci/asl.c
index c632437c7649..562eba108816 100644
--- a/drivers/usb/host/whci/asl.c
+++ b/drivers/usb/host/whci/asl.c
@@ -115,6 +115,10 @@ static uint32_t process_qset(struct whc *whc, struct whc_qset *qset)
115 if (status & QTD_STS_HALTED) { 115 if (status & QTD_STS_HALTED) {
116 /* Ug, an error. */ 116 /* Ug, an error. */
117 process_halted_qtd(whc, qset, td); 117 process_halted_qtd(whc, qset, td);
118 /* A halted qTD always triggers an update
119 because the qset was either removed or
120 reactivated. */
121 update |= WHC_UPDATE_UPDATED;
118 goto done; 122 goto done;
119 } 123 }
120 124
@@ -305,6 +309,7 @@ int asl_urb_dequeue(struct whc *whc, struct urb *urb, int status)
305 struct whc_urb *wurb = urb->hcpriv; 309 struct whc_urb *wurb = urb->hcpriv;
306 struct whc_qset *qset = wurb->qset; 310 struct whc_qset *qset = wurb->qset;
307 struct whc_std *std, *t; 311 struct whc_std *std, *t;
312 bool has_qtd = false;
308 int ret; 313 int ret;
309 unsigned long flags; 314 unsigned long flags;
310 315
@@ -315,17 +320,21 @@ int asl_urb_dequeue(struct whc *whc, struct urb *urb, int status)
315 goto out; 320 goto out;
316 321
317 list_for_each_entry_safe(std, t, &qset->stds, list_node) { 322 list_for_each_entry_safe(std, t, &qset->stds, list_node) {
318 if (std->urb == urb) 323 if (std->urb == urb) {
324 if (std->qtd)
325 has_qtd = true;
319 qset_free_std(whc, std); 326 qset_free_std(whc, std);
320 else 327 } else
321 std->qtd = NULL; /* so this std is re-added when the qset is */ 328 std->qtd = NULL; /* so this std is re-added when the qset is */
322 } 329 }
323 330
324 asl_qset_remove(whc, qset); 331 if (has_qtd) {
325 wurb->status = status; 332 asl_qset_remove(whc, qset);
326 wurb->is_async = true; 333 wurb->status = status;
327 queue_work(whc->workqueue, &wurb->dequeue_work); 334 wurb->is_async = true;
328 335 queue_work(whc->workqueue, &wurb->dequeue_work);
336 } else
337 qset_remove_urb(whc, qset, urb, status);
329out: 338out:
330 spin_unlock_irqrestore(&whc->lock, flags); 339 spin_unlock_irqrestore(&whc->lock, flags);
331 340
diff --git a/drivers/usb/host/whci/pzl.c b/drivers/usb/host/whci/pzl.c
index a9e05bac6646..0db3fb2dc03a 100644
--- a/drivers/usb/host/whci/pzl.c
+++ b/drivers/usb/host/whci/pzl.c
@@ -121,6 +121,10 @@ static enum whc_update pzl_process_qset(struct whc *whc, struct whc_qset *qset)
121 if (status & QTD_STS_HALTED) { 121 if (status & QTD_STS_HALTED) {
122 /* Ug, an error. */ 122 /* Ug, an error. */
123 process_halted_qtd(whc, qset, td); 123 process_halted_qtd(whc, qset, td);
124 /* A halted qTD always triggers an update
125 because the qset was either removed or
126 reactivated. */
127 update |= WHC_UPDATE_UPDATED;
124 goto done; 128 goto done;
125 } 129 }
126 130
@@ -333,6 +337,7 @@ int pzl_urb_dequeue(struct whc *whc, struct urb *urb, int status)
333 struct whc_urb *wurb = urb->hcpriv; 337 struct whc_urb *wurb = urb->hcpriv;
334 struct whc_qset *qset = wurb->qset; 338 struct whc_qset *qset = wurb->qset;
335 struct whc_std *std, *t; 339 struct whc_std *std, *t;
340 bool has_qtd = false;
336 int ret; 341 int ret;
337 unsigned long flags; 342 unsigned long flags;
338 343
@@ -343,17 +348,22 @@ int pzl_urb_dequeue(struct whc *whc, struct urb *urb, int status)
343 goto out; 348 goto out;
344 349
345 list_for_each_entry_safe(std, t, &qset->stds, list_node) { 350 list_for_each_entry_safe(std, t, &qset->stds, list_node) {
346 if (std->urb == urb) 351 if (std->urb == urb) {
352 if (std->qtd)
353 has_qtd = true;
347 qset_free_std(whc, std); 354 qset_free_std(whc, std);
348 else 355 } else
349 std->qtd = NULL; /* so this std is re-added when the qset is */ 356 std->qtd = NULL; /* so this std is re-added when the qset is */
350 } 357 }
351 358
352 pzl_qset_remove(whc, qset); 359 if (has_qtd) {
353 wurb->status = status; 360 pzl_qset_remove(whc, qset);
354 wurb->is_async = false; 361 update_pzl_hw_view(whc);
355 queue_work(whc->workqueue, &wurb->dequeue_work); 362 wurb->status = status;
356 363 wurb->is_async = false;
364 queue_work(whc->workqueue, &wurb->dequeue_work);
365 } else
366 qset_remove_urb(whc, qset, urb, status);
357out: 367out:
358 spin_unlock_irqrestore(&whc->lock, flags); 368 spin_unlock_irqrestore(&whc->lock, flags);
359 369
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 43c227027560..cd44c68954df 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -315,6 +315,9 @@ static int option_resume(struct usb_serial *serial);
315#define QISDA_PRODUCT_H20_4515 0x4515 315#define QISDA_PRODUCT_H20_4515 0x4515
316#define QISDA_PRODUCT_H20_4519 0x4519 316#define QISDA_PRODUCT_H20_4519 0x4519
317 317
318/* TLAYTECH PRODUCTS */
319#define TLAYTECH_VENDOR_ID 0x20B9
320#define TLAYTECH_PRODUCT_TEU800 0x1682
318 321
319/* TOSHIBA PRODUCTS */ 322/* TOSHIBA PRODUCTS */
320#define TOSHIBA_VENDOR_ID 0x0930 323#define TOSHIBA_VENDOR_ID 0x0930
@@ -328,6 +331,9 @@ static int option_resume(struct usb_serial *serial);
328#define ALCATEL_VENDOR_ID 0x1bbb 331#define ALCATEL_VENDOR_ID 0x1bbb
329#define ALCATEL_PRODUCT_X060S 0x0000 332#define ALCATEL_PRODUCT_X060S 0x0000
330 333
334/* Airplus products */
335#define AIRPLUS_VENDOR_ID 0x1011
336#define AIRPLUS_PRODUCT_MCD650 0x3198
331 337
332static struct usb_device_id option_ids[] = { 338static struct usb_device_id option_ids[] = {
333 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 339 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -589,6 +595,8 @@ static struct usb_device_id option_ids[] = {
589 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, 595 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
590 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, 596 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
591 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, 597 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
598 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
599 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
592 { } /* Terminating entry */ 600 { } /* Terminating entry */
593}; 601};
594MODULE_DEVICE_TABLE(usb, option_ids); 602MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 45883988a005..5019325ba25d 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -296,7 +296,6 @@ struct sierra_port_private {
296 int dsr_state; 296 int dsr_state;
297 int dcd_state; 297 int dcd_state;
298 int ri_state; 298 int ri_state;
299
300 unsigned int opened:1; 299 unsigned int opened:1;
301}; 300};
302 301
@@ -306,6 +305,8 @@ static int sierra_send_setup(struct usb_serial_port *port)
306 struct sierra_port_private *portdata; 305 struct sierra_port_private *portdata;
307 __u16 interface = 0; 306 __u16 interface = 0;
308 int val = 0; 307 int val = 0;
308 int do_send = 0;
309 int retval;
309 310
310 dev_dbg(&port->dev, "%s\n", __func__); 311 dev_dbg(&port->dev, "%s\n", __func__);
311 312
@@ -324,10 +325,7 @@ static int sierra_send_setup(struct usb_serial_port *port)
324 */ 325 */
325 if (port->interrupt_in_urb) { 326 if (port->interrupt_in_urb) {
326 /* send control message */ 327 /* send control message */
327 return usb_control_msg(serial->dev, 328 do_send = 1;
328 usb_rcvctrlpipe(serial->dev, 0),
329 0x22, 0x21, val, interface,
330 NULL, 0, USB_CTRL_SET_TIMEOUT);
331 } 329 }
332 } 330 }
333 331
@@ -339,12 +337,18 @@ static int sierra_send_setup(struct usb_serial_port *port)
339 interface = 1; 337 interface = 1;
340 else if (port->bulk_out_endpointAddress == 5) 338 else if (port->bulk_out_endpointAddress == 5)
341 interface = 2; 339 interface = 2;
342 return usb_control_msg(serial->dev, 340
343 usb_rcvctrlpipe(serial->dev, 0), 341 do_send = 1;
344 0x22, 0x21, val, interface,
345 NULL, 0, USB_CTRL_SET_TIMEOUT);
346 } 342 }
347 return 0; 343 if (!do_send)
344 return 0;
345
346 usb_autopm_get_interface(serial->interface);
347 retval = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
348 0x22, 0x21, val, interface, NULL, 0, USB_CTRL_SET_TIMEOUT);
349 usb_autopm_put_interface(serial->interface);
350
351 return retval;
348} 352}
349 353
350static void sierra_set_termios(struct tty_struct *tty, 354static void sierra_set_termios(struct tty_struct *tty,
@@ -773,8 +777,11 @@ static void sierra_close(struct usb_serial_port *port)
773 777
774 if (serial->dev) { 778 if (serial->dev) {
775 mutex_lock(&serial->disc_mutex); 779 mutex_lock(&serial->disc_mutex);
776 if (!serial->disconnected) 780 if (!serial->disconnected) {
781 serial->interface->needs_remote_wakeup = 0;
782 usb_autopm_get_interface(serial->interface);
777 sierra_send_setup(port); 783 sierra_send_setup(port);
784 }
778 mutex_unlock(&serial->disc_mutex); 785 mutex_unlock(&serial->disc_mutex);
779 spin_lock_irq(&intfdata->susp_lock); 786 spin_lock_irq(&intfdata->susp_lock);
780 portdata->opened = 0; 787 portdata->opened = 0;
@@ -788,8 +795,6 @@ static void sierra_close(struct usb_serial_port *port)
788 sierra_release_urb(portdata->in_urbs[i]); 795 sierra_release_urb(portdata->in_urbs[i]);
789 portdata->in_urbs[i] = NULL; 796 portdata->in_urbs[i] = NULL;
790 } 797 }
791 usb_autopm_get_interface(serial->interface);
792 serial->interface->needs_remote_wakeup = 0;
793 } 798 }
794} 799}
795 800
@@ -827,6 +832,8 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port)
827 if (err) { 832 if (err) {
828 /* get rid of everything as in close */ 833 /* get rid of everything as in close */
829 sierra_close(port); 834 sierra_close(port);
835 /* restore balance for autopm */
836 usb_autopm_put_interface(serial->interface);
830 return err; 837 return err;
831 } 838 }
832 sierra_send_setup(port); 839 sierra_send_setup(port);
@@ -915,7 +922,7 @@ static void sierra_release(struct usb_serial *serial)
915#ifdef CONFIG_PM 922#ifdef CONFIG_PM
916static void stop_read_write_urbs(struct usb_serial *serial) 923static void stop_read_write_urbs(struct usb_serial *serial)
917{ 924{
918 int i, j; 925 int i;
919 struct usb_serial_port *port; 926 struct usb_serial_port *port;
920 struct sierra_port_private *portdata; 927 struct sierra_port_private *portdata;
921 928
@@ -923,8 +930,7 @@ static void stop_read_write_urbs(struct usb_serial *serial)
923 for (i = 0; i < serial->num_ports; ++i) { 930 for (i = 0; i < serial->num_ports; ++i) {
924 port = serial->port[i]; 931 port = serial->port[i];
925 portdata = usb_get_serial_port_data(port); 932 portdata = usb_get_serial_port_data(port);
926 for (j = 0; j < N_IN_URB; j++) 933 sierra_stop_rx_urbs(port);
927 usb_kill_urb(portdata->in_urbs[j]);
928 usb_kill_anchored_urbs(&portdata->active); 934 usb_kill_anchored_urbs(&portdata->active);
929 } 935 }
930} 936}
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 3a4fb023af72..589f6b4404f0 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -696,7 +696,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
696 /* device supports and needs bigger sense buffer */ 696 /* device supports and needs bigger sense buffer */
697 if (us->fflags & US_FL_SANE_SENSE) 697 if (us->fflags & US_FL_SANE_SENSE)
698 sense_size = ~0; 698 sense_size = ~0;
699 699Retry_Sense:
700 US_DEBUGP("Issuing auto-REQUEST_SENSE\n"); 700 US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
701 701
702 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size); 702 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size);
@@ -720,6 +720,21 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
720 srb->result = DID_ABORT << 16; 720 srb->result = DID_ABORT << 16;
721 goto Handle_Errors; 721 goto Handle_Errors;
722 } 722 }
723
724 /* Some devices claim to support larger sense but fail when
725 * trying to request it. When a transport failure happens
726 * using US_FS_SANE_SENSE, we always retry with a standard
727 * (small) sense request. This fixes some USB GSM modems
728 */
729 if (temp_result == USB_STOR_TRANSPORT_FAILED &&
730 (us->fflags & US_FL_SANE_SENSE) &&
731 sense_size != US_SENSE_SIZE) {
732 US_DEBUGP("-- auto-sense failure, retry small sense\n");
733 sense_size = US_SENSE_SIZE;
734 goto Retry_Sense;
735 }
736
737 /* Other failures */
723 if (temp_result != USB_STOR_TRANSPORT_GOOD) { 738 if (temp_result != USB_STOR_TRANSPORT_GOOD) {
724 US_DEBUGP("-- auto-sense failure\n"); 739 US_DEBUGP("-- auto-sense failure\n");
725 740
diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c
index b2f149fedcc5..4516c36436e6 100644
--- a/drivers/usb/wusbcore/security.c
+++ b/drivers/usb/wusbcore/security.c
@@ -200,35 +200,40 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
200{ 200{
201 int result, bytes, secd_size; 201 int result, bytes, secd_size;
202 struct device *dev = &usb_dev->dev; 202 struct device *dev = &usb_dev->dev;
203 struct usb_security_descriptor secd; 203 struct usb_security_descriptor *secd;
204 const struct usb_encryption_descriptor *etd, *ccm1_etd = NULL; 204 const struct usb_encryption_descriptor *etd, *ccm1_etd = NULL;
205 void *secd_buf;
206 const void *itr, *top; 205 const void *itr, *top;
207 char buf[64]; 206 char buf[64];
208 207
208 secd = kmalloc(sizeof(struct usb_security_descriptor), GFP_KERNEL);
209 if (secd == NULL) {
210 result = -ENOMEM;
211 goto out;
212 }
213
209 result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, 214 result = usb_get_descriptor(usb_dev, USB_DT_SECURITY,
210 0, &secd, sizeof(secd)); 215 0, secd, sizeof(struct usb_security_descriptor));
211 if (result < sizeof(secd)) { 216 if (result < sizeof(secd)) {
212 dev_err(dev, "Can't read security descriptor or " 217 dev_err(dev, "Can't read security descriptor or "
213 "not enough data: %d\n", result); 218 "not enough data: %d\n", result);
214 goto error_secd; 219 goto out;
215 } 220 }
216 secd_size = le16_to_cpu(secd.wTotalLength); 221 secd_size = le16_to_cpu(secd->wTotalLength);
217 secd_buf = kmalloc(secd_size, GFP_KERNEL); 222 secd = krealloc(secd, secd_size, GFP_KERNEL);
218 if (secd_buf == NULL) { 223 if (secd == NULL) {
219 dev_err(dev, "Can't allocate space for security descriptors\n"); 224 dev_err(dev, "Can't allocate space for security descriptors\n");
220 goto error_secd_alloc; 225 goto out;
221 } 226 }
222 result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, 227 result = usb_get_descriptor(usb_dev, USB_DT_SECURITY,
223 0, secd_buf, secd_size); 228 0, secd, secd_size);
224 if (result < secd_size) { 229 if (result < secd_size) {
225 dev_err(dev, "Can't read security descriptor or " 230 dev_err(dev, "Can't read security descriptor or "
226 "not enough data: %d\n", result); 231 "not enough data: %d\n", result);
227 goto error_secd_all; 232 goto out;
228 } 233 }
229 bytes = 0; 234 bytes = 0;
230 itr = secd_buf + sizeof(secd); 235 itr = &secd[1];
231 top = secd_buf + result; 236 top = (void *)secd + result;
232 while (itr < top) { 237 while (itr < top) {
233 etd = itr; 238 etd = itr;
234 if (top - itr < sizeof(*etd)) { 239 if (top - itr < sizeof(*etd)) {
@@ -259,24 +264,16 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
259 dev_err(dev, "WUSB device doesn't support CCM1 encryption, " 264 dev_err(dev, "WUSB device doesn't support CCM1 encryption, "
260 "can't use!\n"); 265 "can't use!\n");
261 result = -EINVAL; 266 result = -EINVAL;
262 goto error_no_ccm1; 267 goto out;
263 } 268 }
264 wusb_dev->ccm1_etd = *ccm1_etd; 269 wusb_dev->ccm1_etd = *ccm1_etd;
265 dev_dbg(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n", 270 dev_dbg(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n",
266 buf, wusb_et_name(ccm1_etd->bEncryptionType), 271 buf, wusb_et_name(ccm1_etd->bEncryptionType),
267 ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex); 272 ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex);
268 result = 0; 273 result = 0;
269 kfree(secd_buf);
270out: 274out:
275 kfree(secd);
271 return result; 276 return result;
272
273
274error_no_ccm1:
275error_secd_all:
276 kfree(secd_buf);
277error_secd_alloc:
278error_secd:
279 goto out;
280} 277}
281 278
282void wusb_dev_sec_rm(struct wusb_dev *wusb_dev) 279void wusb_dev_sec_rm(struct wusb_dev *wusb_dev)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 200c22f55130..9dd588042880 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -19,7 +19,6 @@
19 */ 19 */
20//#define DEBUG 20//#define DEBUG
21#include <linux/virtio.h> 21#include <linux/virtio.h>
22#include <linux/virtio_ids.h>
23#include <linux/virtio_balloon.h> 22#include <linux/virtio_balloon.h>
24#include <linux/swap.h> 23#include <linux/swap.h>
25#include <linux/kthread.h> 24#include <linux/kthread.h>
@@ -248,7 +247,7 @@ out:
248 return err; 247 return err;
249} 248}
250 249
251static void virtballoon_remove(struct virtio_device *vdev) 250static void __devexit virtballoon_remove(struct virtio_device *vdev)
252{ 251{
253 struct virtio_balloon *vb = vdev->priv; 252 struct virtio_balloon *vb = vdev->priv;
254 253
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 4a1f1ebff7bf..28d9cf7cf72f 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -530,19 +530,22 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
530 err = PTR_ERR(vqs[i]); 530 err = PTR_ERR(vqs[i]);
531 goto error_find; 531 goto error_find;
532 } 532 }
533
534 if (!vp_dev->per_vq_vectors || msix_vec == VIRTIO_MSI_NO_VECTOR)
535 continue;
536
533 /* allocate per-vq irq if available and necessary */ 537 /* allocate per-vq irq if available and necessary */
534 if (vp_dev->per_vq_vectors) { 538 snprintf(vp_dev->msix_names[msix_vec],
535 snprintf(vp_dev->msix_names[msix_vec], 539 sizeof *vp_dev->msix_names,
536 sizeof *vp_dev->msix_names, 540 "%s-%s",
537 "%s-%s", 541 dev_name(&vp_dev->vdev.dev), names[i]);
538 dev_name(&vp_dev->vdev.dev), names[i]); 542 err = request_irq(vp_dev->msix_entries[msix_vec].vector,
539 err = request_irq(msix_vec, vring_interrupt, 0, 543 vring_interrupt, 0,
540 vp_dev->msix_names[msix_vec], 544 vp_dev->msix_names[msix_vec],
541 vqs[i]); 545 vqs[i]);
542 if (err) { 546 if (err) {
543 vp_del_vq(vqs[i]); 547 vp_del_vq(vqs[i]);
544 goto error_find; 548 goto error_find;
545 }
546 } 549 }
547 } 550 }
548 return 0; 551 return 0;
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index f53600580726..fbd2ecde93e4 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -285,6 +285,9 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
285 return NULL; 285 return NULL;
286 } 286 }
287 287
288 /* Only get used array entries after they have been exposed by host. */
289 rmb();
290
288 i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id; 291 i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id;
289 *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len; 292 *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len;
290 293
diff --git a/firmware/Makefile b/firmware/Makefile
index a6c7c3e47e42..f4ca0c7eb51c 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -69,11 +69,13 @@ fw-shipped-$(CONFIG_E100) += e100/d101m_ucode.bin e100/d101s_ucode.bin \
69fw-shipped-$(CONFIG_MYRI_SBUS) += myricom/lanai.bin 69fw-shipped-$(CONFIG_MYRI_SBUS) += myricom/lanai.bin
70fw-shipped-$(CONFIG_PCMCIA_PCNET) += cis/LA-PCM.cis cis/PCMLM28.cis \ 70fw-shipped-$(CONFIG_PCMCIA_PCNET) += cis/LA-PCM.cis cis/PCMLM28.cis \
71 cis/DP83903.cis cis/NE2K.cis \ 71 cis/DP83903.cis cis/NE2K.cis \
72 cis/tamarack.cis 72 cis/tamarack.cis cis/PE-200.cis
73fw-shipped-$(CONFIG_PCMCIA_3C589) += cis/3CXEM556.cis 73fw-shipped-$(CONFIG_PCMCIA_3C589) += cis/3CXEM556.cis
74fw-shipped-$(CONFIG_PCMCIA_3C574) += cis/3CCFEM556.cis 74fw-shipped-$(CONFIG_PCMCIA_3C574) += cis/3CCFEM556.cis
75fw-shipped-$(CONFIG_SERIAL_8250_CS) += cis/MT5634ZLX.cis cis/RS-COM-2P.cis \ 75fw-shipped-$(CONFIG_SERIAL_8250_CS) += cis/MT5634ZLX.cis cis/RS-COM-2P.cis \
76 cis/COMpad2.cis cis/COMpad4.cis 76 cis/COMpad2.cis cis/COMpad4.cis \
77 cis/SW_555_SER.cis cis/SW_7xx_SER.cis \
78 cis/SW_8xx_SER.cis
77fw-shipped-$(CONFIG_PCMCIA_SMC91C92) += ositech/Xilinx7OD.bin 79fw-shipped-$(CONFIG_PCMCIA_SMC91C92) += ositech/Xilinx7OD.bin
78fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \ 80fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \
79 advansys/3550.bin advansys/38C0800.bin 81 advansys/3550.bin advansys/38C0800.bin
diff --git a/firmware/WHENCE b/firmware/WHENCE
index c437e14f0b11..7a8adc06eb34 100644
--- a/firmware/WHENCE
+++ b/firmware/WHENCE
@@ -600,6 +600,7 @@ File: cis/LA-PCM.cis
600 cis/DP83903.cis 600 cis/DP83903.cis
601 cis/NE2K.cis 601 cis/NE2K.cis
602 cis/tamarack.cis 602 cis/tamarack.cis
603 cis/PE-200.cis
603 604
604Licence: GPL 605Licence: GPL
605 606
@@ -633,6 +634,9 @@ File: cis/MT5634ZLX.cis
633 cis/RS-COM-2P.cis 634 cis/RS-COM-2P.cis
634 cis/COMpad2.cis 635 cis/COMpad2.cis
635 cis/COMpad4.cis 636 cis/COMpad4.cis
637 cis/SW_555_SER.cis
638 cis/SW_7xx_SER.cis
639 cis/SW_8xx_SER.cis
636 640
637Licence: GPL 641Licence: GPL
638 642
diff --git a/firmware/cis/PE-200.cis.ihex b/firmware/cis/PE-200.cis.ihex
new file mode 100644
index 000000000000..e6dbdab6eb79
--- /dev/null
+++ b/firmware/cis/PE-200.cis.ihex
@@ -0,0 +1,9 @@
1:1000000001030000FF151E0401504D582020200060
2:1000100050452D3230300045544845524E4554002D
3:1000200052303100FF210206031A050101000101CF
4:100030001B0EC181190155E051000F100F30FFFF59
5:040040001400FF00A9
6:00000001FF
7#
8# Replacement CIS for PE-200 ethernet card
9#
diff --git a/firmware/cis/SW_555_SER.cis.ihex b/firmware/cis/SW_555_SER.cis.ihex
new file mode 100644
index 000000000000..9b9348acee7b
--- /dev/null
+++ b/firmware/cis/SW_555_SER.cis.ihex
@@ -0,0 +1,12 @@
1:100000000101FF17034100FF20043F0110072102F7
2:100010000200152A070053696572726120576972E0
3:10002000656C657373004169724361726420353594
4:1000300035004135353500526576203100FF1A050F
5:1000400001030007731B0BE00118A360F8030730DE
6:10005000BC3F1B08A10108A360F802071B08A2010E
7:1000600008A360E803071B08A30108A360E80207D0
8:0A0070001B04A40108231400FF0084
9:00000001FF
10#
11# Replacement CIS for AC555 provided by Sierra Wireless
12#
diff --git a/firmware/cis/SW_7xx_SER.cis.ihex b/firmware/cis/SW_7xx_SER.cis.ihex
new file mode 100644
index 000000000000..11e44ad86437
--- /dev/null
+++ b/firmware/cis/SW_7xx_SER.cis.ihex
@@ -0,0 +1,13 @@
1:100000000101FF17034100FF2004920110072102A4
2:1000100002001537070053696572726120576972D3
3:10002000656C6573730041433731302F4143373579
4:10003000300047505253204E6574776F726B2041E9
5:1000400064617074657200523100FF1A050103008B
6:1000500007731B10E00119784D555D25A360F80367
7:100060000730BC861B08A10108A360F802071B0823
8:10007000A20108A360E803071B08A30108A360E826
9:0C00800002071B04A40108231400FF0069
10:00000001FF
11#
12# Replacement CIS for AC7xx provided by Sierra Wireless
13#
diff --git a/firmware/cis/SW_8xx_SER.cis.ihex b/firmware/cis/SW_8xx_SER.cis.ihex
new file mode 100644
index 000000000000..bbcfe6348328
--- /dev/null
+++ b/firmware/cis/SW_8xx_SER.cis.ihex
@@ -0,0 +1,13 @@
1:100000000101FF17034100FF2004920110072102A4
2:100010000200152F070053696572726120576972DB
3:10002000656C657373004143383530003347204EAB
4:100030006574776F726B20416461707465720052F1
5:100040003100FF1A0501030007731B10E001197846
6:100050004D555D25A360F8480730BC861B08A101FB
7:1000600008A360F847071B08A20108A360E8480737
8:100070001B08A30108A360E847071B04A401082389
9:040080001400FF0069
10:00000001FF
11#
12# Replacement CIS for AC8xx provided by Sierra Wireless
13#
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 873cd31baa47..15cce53bf61e 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -40,6 +40,24 @@
40#include "fid.h" 40#include "fid.h"
41 41
42/** 42/**
43 * struct p9_rdir - readdir accounting
44 * @mutex: mutex protecting readdir
45 * @head: start offset of current dirread buffer
46 * @tail: end offset of current dirread buffer
47 * @buf: dirread buffer
48 *
49 * private structure for keeping track of readdir
50 * allocated on demand
51 */
52
53struct p9_rdir {
54 struct mutex mutex;
55 int head;
56 int tail;
57 uint8_t *buf;
58};
59
60/**
43 * dt_type - return file type 61 * dt_type - return file type
44 * @mistat: mistat structure 62 * @mistat: mistat structure
45 * 63 *
@@ -70,56 +88,79 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
70{ 88{
71 int over; 89 int over;
72 struct p9_wstat st; 90 struct p9_wstat st;
73 int err; 91 int err = 0;
74 struct p9_fid *fid; 92 struct p9_fid *fid;
75 int buflen; 93 int buflen;
76 char *statbuf; 94 int reclen = 0;
77 int n, i = 0; 95 struct p9_rdir *rdir;
78 96
79 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name); 97 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
80 fid = filp->private_data; 98 fid = filp->private_data;
81 99
82 buflen = fid->clnt->msize - P9_IOHDRSZ; 100 buflen = fid->clnt->msize - P9_IOHDRSZ;
83 statbuf = kmalloc(buflen, GFP_KERNEL); 101
84 if (!statbuf) 102 /* allocate rdir on demand */
85 return -ENOMEM; 103 if (!fid->rdir) {
86 104 rdir = kmalloc(sizeof(struct p9_rdir) + buflen, GFP_KERNEL);
87 while (1) { 105
88 err = v9fs_file_readn(filp, statbuf, NULL, buflen, 106 if (rdir == NULL) {
89 fid->rdir_fpos); 107 err = -ENOMEM;
90 if (err <= 0) 108 goto exit;
91 break; 109 }
92 110 spin_lock(&filp->f_dentry->d_lock);
93 n = err; 111 if (!fid->rdir) {
94 while (i < n) { 112 rdir->buf = (uint8_t *)rdir + sizeof(struct p9_rdir);
95 err = p9stat_read(statbuf + i, buflen-i, &st, 113 mutex_init(&rdir->mutex);
96 fid->clnt->dotu); 114 rdir->head = rdir->tail = 0;
115 fid->rdir = (void *) rdir;
116 rdir = NULL;
117 }
118 spin_unlock(&filp->f_dentry->d_lock);
119 kfree(rdir);
120 }
121 rdir = (struct p9_rdir *) fid->rdir;
122
123 err = mutex_lock_interruptible(&rdir->mutex);
124 while (err == 0) {
125 if (rdir->tail == rdir->head) {
126 err = v9fs_file_readn(filp, rdir->buf, NULL,
127 buflen, filp->f_pos);
128 if (err <= 0)
129 goto unlock_and_exit;
130
131 rdir->head = 0;
132 rdir->tail = err;
133 }
134
135 while (rdir->head < rdir->tail) {
136 err = p9stat_read(rdir->buf + rdir->head,
137 buflen - rdir->head, &st,
138 fid->clnt->dotu);
97 if (err) { 139 if (err) {
98 P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err); 140 P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
99 err = -EIO; 141 err = -EIO;
100 p9stat_free(&st); 142 p9stat_free(&st);
101 goto free_and_exit; 143 goto unlock_and_exit;
102 } 144 }
103 145 reclen = st.size+2;
104 i += st.size+2;
105 fid->rdir_fpos += st.size+2;
106 146
107 over = filldir(dirent, st.name, strlen(st.name), 147 over = filldir(dirent, st.name, strlen(st.name),
108 filp->f_pos, v9fs_qid2ino(&st.qid), dt_type(&st)); 148 filp->f_pos, v9fs_qid2ino(&st.qid), dt_type(&st));
109 149
110 filp->f_pos += st.size+2;
111
112 p9stat_free(&st); 150 p9stat_free(&st);
113 151
114 if (over) { 152 if (over) {
115 err = 0; 153 err = 0;
116 goto free_and_exit; 154 goto unlock_and_exit;
117 } 155 }
156 rdir->head += reclen;
157 filp->f_pos += reclen;
118 } 158 }
119 } 159 }
120 160
121free_and_exit: 161unlock_and_exit:
122 kfree(statbuf); 162 mutex_unlock(&rdir->mutex);
163exit:
123 return err; 164 return err;
124} 165}
125 166
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 5947628aefef..18f74ec4dce9 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -994,8 +994,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
994 P9_DPRINTK(P9_DEBUG_VFS, 994 P9_DPRINTK(P9_DEBUG_VFS,
995 "%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer); 995 "%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer);
996 996
997 retval = buflen; 997 retval = strnlen(buffer, buflen);
998
999done: 998done:
1000 kfree(st); 999 kfree(st);
1001 return retval; 1000 return retval;
@@ -1062,7 +1061,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
1062 __putname(link); 1061 __putname(link);
1063 link = ERR_PTR(len); 1062 link = ERR_PTR(len);
1064 } else 1063 } else
1065 link[len] = 0; 1064 link[min(len, PATH_MAX-1)] = 0;
1066 } 1065 }
1067 nd_set_link(nd, link); 1066 nd_set_link(nd, link);
1068 1067
diff --git a/fs/Kconfig b/fs/Kconfig
index d4bf8caad8d0..2126078a38ed 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -135,8 +135,8 @@ config TMPFS_POSIX_ACL
135 135
136config HUGETLBFS 136config HUGETLBFS
137 bool "HugeTLB file system support" 137 bool "HugeTLB file system support"
138 depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \ 138 depends on X86 || IA64 || PPC_BOOK3S_64 || SPARC64 || (S390 && 64BIT) || \
139 (S390 && 64BIT) || SYS_SUPPORTS_HUGETLBFS || BROKEN 139 SYS_SUPPORTS_HUGETLBFS || BROKEN
140 help 140 help
141 hugetlbfs is a filesystem backing for HugeTLB pages, based on 141 hugetlbfs is a filesystem backing for HugeTLB pages, based on
142 ramfs. For architectures that support it, say Y here and read 142 ramfs. For architectures that support it, say Y here and read
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9cf4b926f8e4..8bed0557d88c 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1248,8 +1248,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1248 bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); 1248 bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9);
1249 } 1249 }
1250 } else { 1250 } else {
1251 put_disk(disk);
1252 module_put(disk->fops->owner); 1251 module_put(disk->fops->owner);
1252 put_disk(disk);
1253 disk = NULL; 1253 disk = NULL;
1254 if (bdev->bd_contains == bdev) { 1254 if (bdev->bd_contains == bdev) {
1255 if (bdev->bd_disk->fops->open) { 1255 if (bdev->bd_disk->fops->open) {
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 69b355ae7f49..361604244271 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -27,7 +27,7 @@
27#include "btrfs_inode.h" 27#include "btrfs_inode.h"
28#include "xattr.h" 28#include "xattr.h"
29 29
30#ifdef CONFIG_BTRFS_POSIX_ACL 30#ifdef CONFIG_BTRFS_FS_POSIX_ACL
31 31
32static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) 32static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
33{ 33{
@@ -313,7 +313,7 @@ struct xattr_handler btrfs_xattr_acl_access_handler = {
313 .set = btrfs_xattr_acl_access_set, 313 .set = btrfs_xattr_acl_access_set,
314}; 314};
315 315
316#else /* CONFIG_BTRFS_POSIX_ACL */ 316#else /* CONFIG_BTRFS_FS_POSIX_ACL */
317 317
318int btrfs_acl_chmod(struct inode *inode) 318int btrfs_acl_chmod(struct inode *inode)
319{ 319{
@@ -325,4 +325,4 @@ int btrfs_init_acl(struct inode *inode, struct inode *dir)
325 return 0; 325 return 0;
326} 326}
327 327
328#endif /* CONFIG_BTRFS_POSIX_ACL */ 328#endif /* CONFIG_BTRFS_FS_POSIX_ACL */
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index c71abec0ab90..f6783a42f010 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -86,6 +86,12 @@ struct btrfs_inode {
86 * transid of the trans_handle that last modified this inode 86 * transid of the trans_handle that last modified this inode
87 */ 87 */
88 u64 last_trans; 88 u64 last_trans;
89
90 /*
91 * log transid when this inode was last modified
92 */
93 u64 last_sub_trans;
94
89 /* 95 /*
90 * transid that last logged this inode 96 * transid that last logged this inode
91 */ 97 */
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 1bb897ecdeeb..444b3e9b92a4 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1009,6 +1009,7 @@ struct btrfs_root {
1009 atomic_t log_writers; 1009 atomic_t log_writers;
1010 atomic_t log_commit[2]; 1010 atomic_t log_commit[2];
1011 unsigned long log_transid; 1011 unsigned long log_transid;
1012 unsigned long last_log_commit;
1012 unsigned long log_batch; 1013 unsigned long log_batch;
1013 pid_t log_start_pid; 1014 pid_t log_start_pid;
1014 bool log_multiple_pids; 1015 bool log_multiple_pids;
@@ -1152,6 +1153,7 @@ struct btrfs_root {
1152#define BTRFS_MOUNT_FLUSHONCOMMIT (1 << 7) 1153#define BTRFS_MOUNT_FLUSHONCOMMIT (1 << 7)
1153#define BTRFS_MOUNT_SSD_SPREAD (1 << 8) 1154#define BTRFS_MOUNT_SSD_SPREAD (1 << 8)
1154#define BTRFS_MOUNT_NOSSD (1 << 9) 1155#define BTRFS_MOUNT_NOSSD (1 << 9)
1156#define BTRFS_MOUNT_DISCARD (1 << 10)
1155 1157
1156#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) 1158#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
1157#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) 1159#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
@@ -2373,7 +2375,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options);
2373int btrfs_sync_fs(struct super_block *sb, int wait); 2375int btrfs_sync_fs(struct super_block *sb, int wait);
2374 2376
2375/* acl.c */ 2377/* acl.c */
2376#ifdef CONFIG_BTRFS_POSIX_ACL 2378#ifdef CONFIG_BTRFS_FS_POSIX_ACL
2377int btrfs_check_acl(struct inode *inode, int mask); 2379int btrfs_check_acl(struct inode *inode, int mask);
2378#else 2380#else
2379#define btrfs_check_acl NULL 2381#define btrfs_check_acl NULL
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 100551a66c46..02b6afbd7450 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -917,6 +917,7 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
917 atomic_set(&root->log_writers, 0); 917 atomic_set(&root->log_writers, 0);
918 root->log_batch = 0; 918 root->log_batch = 0;
919 root->log_transid = 0; 919 root->log_transid = 0;
920 root->last_log_commit = 0;
920 extent_io_tree_init(&root->dirty_log_pages, 921 extent_io_tree_init(&root->dirty_log_pages,
921 fs_info->btree_inode->i_mapping, GFP_NOFS); 922 fs_info->btree_inode->i_mapping, GFP_NOFS);
922 923
@@ -1087,6 +1088,7 @@ int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
1087 WARN_ON(root->log_root); 1088 WARN_ON(root->log_root);
1088 root->log_root = log_root; 1089 root->log_root = log_root;
1089 root->log_transid = 0; 1090 root->log_transid = 0;
1091 root->last_log_commit = 0;
1090 return 0; 1092 return 0;
1091} 1093}
1092 1094
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d0c4d584efad..e238a0cdac67 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1568,23 +1568,23 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans,
1568 return ret; 1568 return ret;
1569} 1569}
1570 1570
1571#ifdef BIO_RW_DISCARD
1572static void btrfs_issue_discard(struct block_device *bdev, 1571static void btrfs_issue_discard(struct block_device *bdev,
1573 u64 start, u64 len) 1572 u64 start, u64 len)
1574{ 1573{
1575 blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, 1574 blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL,
1576 DISCARD_FL_BARRIER); 1575 DISCARD_FL_BARRIER);
1577} 1576}
1578#endif
1579 1577
1580static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, 1578static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
1581 u64 num_bytes) 1579 u64 num_bytes)
1582{ 1580{
1583#ifdef BIO_RW_DISCARD
1584 int ret; 1581 int ret;
1585 u64 map_length = num_bytes; 1582 u64 map_length = num_bytes;
1586 struct btrfs_multi_bio *multi = NULL; 1583 struct btrfs_multi_bio *multi = NULL;
1587 1584
1585 if (!btrfs_test_opt(root, DISCARD))
1586 return 0;
1587
1588 /* Tell the block device(s) that the sectors can be discarded */ 1588 /* Tell the block device(s) that the sectors can be discarded */
1589 ret = btrfs_map_block(&root->fs_info->mapping_tree, READ, 1589 ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
1590 bytenr, &map_length, &multi, 0); 1590 bytenr, &map_length, &multi, 0);
@@ -1604,9 +1604,6 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
1604 } 1604 }
1605 1605
1606 return ret; 1606 return ret;
1607#else
1608 return 0;
1609#endif
1610} 1607}
1611 1608
1612int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, 1609int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
@@ -3690,6 +3687,14 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans,
3690 if (is_data) 3687 if (is_data)
3691 goto pinit; 3688 goto pinit;
3692 3689
3690 /*
3691 * discard is sloooow, and so triggering discards on
3692 * individual btree blocks isn't a good plan. Just
3693 * pin everything in discard mode.
3694 */
3695 if (btrfs_test_opt(root, DISCARD))
3696 goto pinit;
3697
3693 buf = btrfs_find_tree_block(root, bytenr, num_bytes); 3698 buf = btrfs_find_tree_block(root, bytenr, num_bytes);
3694 if (!buf) 3699 if (!buf)
3695 goto pinit; 3700 goto pinit;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 2d623aa0625f..06550affbd27 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1086,8 +1086,10 @@ out_nolock:
1086 btrfs_end_transaction(trans, root); 1086 btrfs_end_transaction(trans, root);
1087 else 1087 else
1088 btrfs_commit_transaction(trans, root); 1088 btrfs_commit_transaction(trans, root);
1089 } else { 1089 } else if (ret != BTRFS_NO_LOG_SYNC) {
1090 btrfs_commit_transaction(trans, root); 1090 btrfs_commit_transaction(trans, root);
1091 } else {
1092 btrfs_end_transaction(trans, root);
1091 } 1093 }
1092 } 1094 }
1093 if (file->f_flags & O_DIRECT) { 1095 if (file->f_flags & O_DIRECT) {
@@ -1137,6 +1139,13 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1137 int ret = 0; 1139 int ret = 0;
1138 struct btrfs_trans_handle *trans; 1140 struct btrfs_trans_handle *trans;
1139 1141
1142
1143 /* we wait first, since the writeback may change the inode */
1144 root->log_batch++;
1145 /* the VFS called filemap_fdatawrite for us */
1146 btrfs_wait_ordered_range(inode, 0, (u64)-1);
1147 root->log_batch++;
1148
1140 /* 1149 /*
1141 * check the transaction that last modified this inode 1150 * check the transaction that last modified this inode
1142 * and see if its already been committed 1151 * and see if its already been committed
@@ -1144,6 +1153,11 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1144 if (!BTRFS_I(inode)->last_trans) 1153 if (!BTRFS_I(inode)->last_trans)
1145 goto out; 1154 goto out;
1146 1155
1156 /*
1157 * if the last transaction that changed this file was before
1158 * the current transaction, we can bail out now without any
1159 * syncing
1160 */
1147 mutex_lock(&root->fs_info->trans_mutex); 1161 mutex_lock(&root->fs_info->trans_mutex);
1148 if (BTRFS_I(inode)->last_trans <= 1162 if (BTRFS_I(inode)->last_trans <=
1149 root->fs_info->last_trans_committed) { 1163 root->fs_info->last_trans_committed) {
@@ -1153,13 +1167,6 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1153 } 1167 }
1154 mutex_unlock(&root->fs_info->trans_mutex); 1168 mutex_unlock(&root->fs_info->trans_mutex);
1155 1169
1156 root->log_batch++;
1157 filemap_fdatawrite(inode->i_mapping);
1158 btrfs_wait_ordered_range(inode, 0, (u64)-1);
1159 root->log_batch++;
1160
1161 if (datasync && !(inode->i_state & I_DIRTY_PAGES))
1162 goto out;
1163 /* 1170 /*
1164 * ok we haven't committed the transaction yet, lets do a commit 1171 * ok we haven't committed the transaction yet, lets do a commit
1165 */ 1172 */
@@ -1188,14 +1195,18 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
1188 */ 1195 */
1189 mutex_unlock(&dentry->d_inode->i_mutex); 1196 mutex_unlock(&dentry->d_inode->i_mutex);
1190 1197
1191 if (ret > 0) { 1198 if (ret != BTRFS_NO_LOG_SYNC) {
1192 ret = btrfs_commit_transaction(trans, root); 1199 if (ret > 0) {
1193 } else {
1194 ret = btrfs_sync_log(trans, root);
1195 if (ret == 0)
1196 ret = btrfs_end_transaction(trans, root);
1197 else
1198 ret = btrfs_commit_transaction(trans, root); 1200 ret = btrfs_commit_transaction(trans, root);
1201 } else {
1202 ret = btrfs_sync_log(trans, root);
1203 if (ret == 0)
1204 ret = btrfs_end_transaction(trans, root);
1205 else
1206 ret = btrfs_commit_transaction(trans, root);
1207 }
1208 } else {
1209 ret = btrfs_end_transaction(trans, root);
1199 } 1210 }
1200 mutex_lock(&dentry->d_inode->i_mutex); 1211 mutex_lock(&dentry->d_inode->i_mutex);
1201out: 1212out:
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9e138b793dc7..dae12dc7e159 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3032,12 +3032,22 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
3032 3032
3033 if ((offset & (blocksize - 1)) == 0) 3033 if ((offset & (blocksize - 1)) == 0)
3034 goto out; 3034 goto out;
3035 ret = btrfs_check_data_free_space(root, inode, PAGE_CACHE_SIZE);
3036 if (ret)
3037 goto out;
3038
3039 ret = btrfs_reserve_metadata_for_delalloc(root, inode, 1);
3040 if (ret)
3041 goto out;
3035 3042
3036 ret = -ENOMEM; 3043 ret = -ENOMEM;
3037again: 3044again:
3038 page = grab_cache_page(mapping, index); 3045 page = grab_cache_page(mapping, index);
3039 if (!page) 3046 if (!page) {
3047 btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE);
3048 btrfs_unreserve_metadata_for_delalloc(root, inode, 1);
3040 goto out; 3049 goto out;
3050 }
3041 3051
3042 page_start = page_offset(page); 3052 page_start = page_offset(page);
3043 page_end = page_start + PAGE_CACHE_SIZE - 1; 3053 page_end = page_start + PAGE_CACHE_SIZE - 1;
@@ -3070,6 +3080,10 @@ again:
3070 goto again; 3080 goto again;
3071 } 3081 }
3072 3082
3083 clear_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end,
3084 EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING,
3085 GFP_NOFS);
3086
3073 ret = btrfs_set_extent_delalloc(inode, page_start, page_end); 3087 ret = btrfs_set_extent_delalloc(inode, page_start, page_end);
3074 if (ret) { 3088 if (ret) {
3075 unlock_extent(io_tree, page_start, page_end, GFP_NOFS); 3089 unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
@@ -3088,6 +3102,9 @@ again:
3088 unlock_extent(io_tree, page_start, page_end, GFP_NOFS); 3102 unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
3089 3103
3090out_unlock: 3104out_unlock:
3105 if (ret)
3106 btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE);
3107 btrfs_unreserve_metadata_for_delalloc(root, inode, 1);
3091 unlock_page(page); 3108 unlock_page(page);
3092 page_cache_release(page); 3109 page_cache_release(page);
3093out: 3110out:
@@ -3111,7 +3128,9 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
3111 if (size <= hole_start) 3128 if (size <= hole_start)
3112 return 0; 3129 return 0;
3113 3130
3114 btrfs_truncate_page(inode->i_mapping, inode->i_size); 3131 err = btrfs_truncate_page(inode->i_mapping, inode->i_size);
3132 if (err)
3133 return err;
3115 3134
3116 while (1) { 3135 while (1) {
3117 struct btrfs_ordered_extent *ordered; 3136 struct btrfs_ordered_extent *ordered;
@@ -3480,6 +3499,7 @@ static noinline void init_btrfs_i(struct inode *inode)
3480 bi->generation = 0; 3499 bi->generation = 0;
3481 bi->sequence = 0; 3500 bi->sequence = 0;
3482 bi->last_trans = 0; 3501 bi->last_trans = 0;
3502 bi->last_sub_trans = 0;
3483 bi->logged_trans = 0; 3503 bi->logged_trans = 0;
3484 bi->delalloc_bytes = 0; 3504 bi->delalloc_bytes = 0;
3485 bi->reserved_bytes = 0; 3505 bi->reserved_bytes = 0;
@@ -4980,7 +5000,9 @@ again:
4980 set_page_dirty(page); 5000 set_page_dirty(page);
4981 SetPageUptodate(page); 5001 SetPageUptodate(page);
4982 5002
4983 BTRFS_I(inode)->last_trans = root->fs_info->generation + 1; 5003 BTRFS_I(inode)->last_trans = root->fs_info->generation;
5004 BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid;
5005
4984 unlock_extent(io_tree, page_start, page_end, GFP_NOFS); 5006 unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
4985 5007
4986out_unlock: 5008out_unlock:
@@ -5005,7 +5027,9 @@ static void btrfs_truncate(struct inode *inode)
5005 if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 5027 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
5006 return; 5028 return;
5007 5029
5008 btrfs_truncate_page(inode->i_mapping, inode->i_size); 5030 ret = btrfs_truncate_page(inode->i_mapping, inode->i_size);
5031 if (ret)
5032 return;
5009 btrfs_wait_ordered_range(inode, inode->i_size & (~mask), (u64)-1); 5033 btrfs_wait_ordered_range(inode, inode->i_size & (~mask), (u64)-1);
5010 5034
5011 trans = btrfs_start_transaction(root, 1); 5035 trans = btrfs_start_transaction(root, 1);
@@ -5100,6 +5124,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
5100 if (!ei) 5124 if (!ei)
5101 return NULL; 5125 return NULL;
5102 ei->last_trans = 0; 5126 ei->last_trans = 0;
5127 ei->last_sub_trans = 0;
5103 ei->logged_trans = 0; 5128 ei->logged_trans = 0;
5104 ei->outstanding_extents = 0; 5129 ei->outstanding_extents = 0;
5105 ei->reserved_extents = 0; 5130 ei->reserved_extents = 0;
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 9de9b2236419..752a5463bf53 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -66,7 +66,8 @@ enum {
66 Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, 66 Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow,
67 Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, 67 Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier,
68 Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, 68 Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl,
69 Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_err, 69 Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
70 Opt_discard, Opt_err,
70}; 71};
71 72
72static match_table_t tokens = { 73static match_table_t tokens = {
@@ -88,6 +89,7 @@ static match_table_t tokens = {
88 {Opt_notreelog, "notreelog"}, 89 {Opt_notreelog, "notreelog"},
89 {Opt_flushoncommit, "flushoncommit"}, 90 {Opt_flushoncommit, "flushoncommit"},
90 {Opt_ratio, "metadata_ratio=%d"}, 91 {Opt_ratio, "metadata_ratio=%d"},
92 {Opt_discard, "discard"},
91 {Opt_err, NULL}, 93 {Opt_err, NULL},
92}; 94};
93 95
@@ -257,6 +259,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
257 info->metadata_ratio); 259 info->metadata_ratio);
258 } 260 }
259 break; 261 break;
262 case Opt_discard:
263 btrfs_set_opt(info->mount_opt, DISCARD);
264 break;
260 default: 265 default:
261 break; 266 break;
262 } 267 }
@@ -344,7 +349,7 @@ static int btrfs_fill_super(struct super_block *sb,
344 sb->s_export_op = &btrfs_export_ops; 349 sb->s_export_op = &btrfs_export_ops;
345 sb->s_xattr = btrfs_xattr_handlers; 350 sb->s_xattr = btrfs_xattr_handlers;
346 sb->s_time_gran = 1; 351 sb->s_time_gran = 1;
347#ifdef CONFIG_BTRFS_POSIX_ACL 352#ifdef CONFIG_BTRFS_FS_POSIX_ACL
348 sb->s_flags |= MS_POSIXACL; 353 sb->s_flags |= MS_POSIXACL;
349#endif 354#endif
350 355
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 0b8f36d4400a..bca82a4ca8e6 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -344,10 +344,10 @@ int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans,
344/* 344/*
345 * when btree blocks are allocated, they have some corresponding bits set for 345 * when btree blocks are allocated, they have some corresponding bits set for
346 * them in one of two extent_io trees. This is used to make sure all of 346 * them in one of two extent_io trees. This is used to make sure all of
347 * those extents are on disk for transaction or log commit 347 * those extents are sent to disk but does not wait on them
348 */ 348 */
349int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, 349int btrfs_write_marked_extents(struct btrfs_root *root,
350 struct extent_io_tree *dirty_pages) 350 struct extent_io_tree *dirty_pages)
351{ 351{
352 int ret; 352 int ret;
353 int err = 0; 353 int err = 0;
@@ -394,6 +394,29 @@ int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
394 page_cache_release(page); 394 page_cache_release(page);
395 } 395 }
396 } 396 }
397 if (err)
398 werr = err;
399 return werr;
400}
401
402/*
403 * when btree blocks are allocated, they have some corresponding bits set for
404 * them in one of two extent_io trees. This is used to make sure all of
405 * those extents are on disk for transaction or log commit. We wait
406 * on all the pages and clear them from the dirty pages state tree
407 */
408int btrfs_wait_marked_extents(struct btrfs_root *root,
409 struct extent_io_tree *dirty_pages)
410{
411 int ret;
412 int err = 0;
413 int werr = 0;
414 struct page *page;
415 struct inode *btree_inode = root->fs_info->btree_inode;
416 u64 start = 0;
417 u64 end;
418 unsigned long index;
419
397 while (1) { 420 while (1) {
398 ret = find_first_extent_bit(dirty_pages, 0, &start, &end, 421 ret = find_first_extent_bit(dirty_pages, 0, &start, &end,
399 EXTENT_DIRTY); 422 EXTENT_DIRTY);
@@ -424,6 +447,22 @@ int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
424 return werr; 447 return werr;
425} 448}
426 449
450/*
451 * when btree blocks are allocated, they have some corresponding bits set for
452 * them in one of two extent_io trees. This is used to make sure all of
453 * those extents are on disk for transaction or log commit
454 */
455int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
456 struct extent_io_tree *dirty_pages)
457{
458 int ret;
459 int ret2;
460
461 ret = btrfs_write_marked_extents(root, dirty_pages);
462 ret2 = btrfs_wait_marked_extents(root, dirty_pages);
463 return ret || ret2;
464}
465
427int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, 466int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
428 struct btrfs_root *root) 467 struct btrfs_root *root)
429{ 468{
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 663c67404918..d4e3e7a6938c 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -79,6 +79,7 @@ static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans,
79 struct inode *inode) 79 struct inode *inode)
80{ 80{
81 BTRFS_I(inode)->last_trans = trans->transaction->transid; 81 BTRFS_I(inode)->last_trans = trans->transaction->transid;
82 BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid;
82} 83}
83 84
84int btrfs_end_transaction(struct btrfs_trans_handle *trans, 85int btrfs_end_transaction(struct btrfs_trans_handle *trans,
@@ -107,5 +108,9 @@ int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans,
107 struct btrfs_root *root); 108 struct btrfs_root *root);
108int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, 109int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
109 struct extent_io_tree *dirty_pages); 110 struct extent_io_tree *dirty_pages);
111int btrfs_write_marked_extents(struct btrfs_root *root,
112 struct extent_io_tree *dirty_pages);
113int btrfs_wait_marked_extents(struct btrfs_root *root,
114 struct extent_io_tree *dirty_pages);
110int btrfs_transaction_in_commit(struct btrfs_fs_info *info); 115int btrfs_transaction_in_commit(struct btrfs_fs_info *info);
111#endif 116#endif
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4edfdc2acc5f..741666a7676a 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1980,6 +1980,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
1980 int ret; 1980 int ret;
1981 struct btrfs_root *log = root->log_root; 1981 struct btrfs_root *log = root->log_root;
1982 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; 1982 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree;
1983 u64 log_transid = 0;
1983 1984
1984 mutex_lock(&root->log_mutex); 1985 mutex_lock(&root->log_mutex);
1985 index1 = root->log_transid % 2; 1986 index1 = root->log_transid % 2;
@@ -1994,12 +1995,13 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
1994 if (atomic_read(&root->log_commit[(index1 + 1) % 2])) 1995 if (atomic_read(&root->log_commit[(index1 + 1) % 2]))
1995 wait_log_commit(trans, root, root->log_transid - 1); 1996 wait_log_commit(trans, root, root->log_transid - 1);
1996 1997
1997 while (root->log_multiple_pids) { 1998 while (1) {
1998 unsigned long batch = root->log_batch; 1999 unsigned long batch = root->log_batch;
1999 mutex_unlock(&root->log_mutex); 2000 if (root->log_multiple_pids) {
2000 schedule_timeout_uninterruptible(1); 2001 mutex_unlock(&root->log_mutex);
2001 mutex_lock(&root->log_mutex); 2002 schedule_timeout_uninterruptible(1);
2002 2003 mutex_lock(&root->log_mutex);
2004 }
2003 wait_for_writer(trans, root); 2005 wait_for_writer(trans, root);
2004 if (batch == root->log_batch) 2006 if (batch == root->log_batch)
2005 break; 2007 break;
@@ -2012,12 +2014,16 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2012 goto out; 2014 goto out;
2013 } 2015 }
2014 2016
2015 ret = btrfs_write_and_wait_marked_extents(log, &log->dirty_log_pages); 2017 /* we start IO on all the marked extents here, but we don't actually
2018 * wait for them until later.
2019 */
2020 ret = btrfs_write_marked_extents(log, &log->dirty_log_pages);
2016 BUG_ON(ret); 2021 BUG_ON(ret);
2017 2022
2018 btrfs_set_root_node(&log->root_item, log->node); 2023 btrfs_set_root_node(&log->root_item, log->node);
2019 2024
2020 root->log_batch = 0; 2025 root->log_batch = 0;
2026 log_transid = root->log_transid;
2021 root->log_transid++; 2027 root->log_transid++;
2022 log->log_transid = root->log_transid; 2028 log->log_transid = root->log_transid;
2023 root->log_start_pid = 0; 2029 root->log_start_pid = 0;
@@ -2046,6 +2052,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2046 2052
2047 index2 = log_root_tree->log_transid % 2; 2053 index2 = log_root_tree->log_transid % 2;
2048 if (atomic_read(&log_root_tree->log_commit[index2])) { 2054 if (atomic_read(&log_root_tree->log_commit[index2])) {
2055 btrfs_wait_marked_extents(log, &log->dirty_log_pages);
2049 wait_log_commit(trans, log_root_tree, 2056 wait_log_commit(trans, log_root_tree,
2050 log_root_tree->log_transid); 2057 log_root_tree->log_transid);
2051 mutex_unlock(&log_root_tree->log_mutex); 2058 mutex_unlock(&log_root_tree->log_mutex);
@@ -2065,6 +2072,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2065 * check the full commit flag again 2072 * check the full commit flag again
2066 */ 2073 */
2067 if (root->fs_info->last_trans_log_full_commit == trans->transid) { 2074 if (root->fs_info->last_trans_log_full_commit == trans->transid) {
2075 btrfs_wait_marked_extents(log, &log->dirty_log_pages);
2068 mutex_unlock(&log_root_tree->log_mutex); 2076 mutex_unlock(&log_root_tree->log_mutex);
2069 ret = -EAGAIN; 2077 ret = -EAGAIN;
2070 goto out_wake_log_root; 2078 goto out_wake_log_root;
@@ -2073,6 +2081,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2073 ret = btrfs_write_and_wait_marked_extents(log_root_tree, 2081 ret = btrfs_write_and_wait_marked_extents(log_root_tree,
2074 &log_root_tree->dirty_log_pages); 2082 &log_root_tree->dirty_log_pages);
2075 BUG_ON(ret); 2083 BUG_ON(ret);
2084 btrfs_wait_marked_extents(log, &log->dirty_log_pages);
2076 2085
2077 btrfs_set_super_log_root(&root->fs_info->super_for_commit, 2086 btrfs_set_super_log_root(&root->fs_info->super_for_commit,
2078 log_root_tree->node->start); 2087 log_root_tree->node->start);
@@ -2092,9 +2101,14 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2092 * the running transaction open, so a full commit can't hop 2101 * the running transaction open, so a full commit can't hop
2093 * in and cause problems either. 2102 * in and cause problems either.
2094 */ 2103 */
2095 write_ctree_super(trans, root->fs_info->tree_root, 2); 2104 write_ctree_super(trans, root->fs_info->tree_root, 1);
2096 ret = 0; 2105 ret = 0;
2097 2106
2107 mutex_lock(&root->log_mutex);
2108 if (root->last_log_commit < log_transid)
2109 root->last_log_commit = log_transid;
2110 mutex_unlock(&root->log_mutex);
2111
2098out_wake_log_root: 2112out_wake_log_root:
2099 atomic_set(&log_root_tree->log_commit[index2], 0); 2113 atomic_set(&log_root_tree->log_commit[index2], 0);
2100 smp_mb(); 2114 smp_mb();
@@ -2862,6 +2876,21 @@ out:
2862 return ret; 2876 return ret;
2863} 2877}
2864 2878
2879static int inode_in_log(struct btrfs_trans_handle *trans,
2880 struct inode *inode)
2881{
2882 struct btrfs_root *root = BTRFS_I(inode)->root;
2883 int ret = 0;
2884
2885 mutex_lock(&root->log_mutex);
2886 if (BTRFS_I(inode)->logged_trans == trans->transid &&
2887 BTRFS_I(inode)->last_sub_trans <= root->last_log_commit)
2888 ret = 1;
2889 mutex_unlock(&root->log_mutex);
2890 return ret;
2891}
2892
2893
2865/* 2894/*
2866 * helper function around btrfs_log_inode to make sure newly created 2895 * helper function around btrfs_log_inode to make sure newly created
2867 * parent directories also end up in the log. A minimal inode and backref 2896 * parent directories also end up in the log. A minimal inode and backref
@@ -2901,6 +2930,11 @@ int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
2901 if (ret) 2930 if (ret)
2902 goto end_no_trans; 2931 goto end_no_trans;
2903 2932
2933 if (inode_in_log(trans, inode)) {
2934 ret = BTRFS_NO_LOG_SYNC;
2935 goto end_no_trans;
2936 }
2937
2904 start_log_trans(trans, root); 2938 start_log_trans(trans, root);
2905 2939
2906 ret = btrfs_log_inode(trans, root, inode, inode_only); 2940 ret = btrfs_log_inode(trans, root, inode, inode_only);
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index d09c7609e16b..0776eacb5083 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -19,6 +19,9 @@
19#ifndef __TREE_LOG_ 19#ifndef __TREE_LOG_
20#define __TREE_LOG_ 20#define __TREE_LOG_
21 21
22/* return value for btrfs_log_dentry_safe that means we don't need to log it at all */
23#define BTRFS_NO_LOG_SYNC 256
24
22int btrfs_sync_log(struct btrfs_trans_handle *trans, 25int btrfs_sync_log(struct btrfs_trans_handle *trans,
23 struct btrfs_root *root); 26 struct btrfs_root *root);
24int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root); 27int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root);
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index b0fc93f95fd0..b6dd5967c48a 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -260,7 +260,7 @@ err:
260 * attributes are handled directly. 260 * attributes are handled directly.
261 */ 261 */
262struct xattr_handler *btrfs_xattr_handlers[] = { 262struct xattr_handler *btrfs_xattr_handlers[] = {
263#ifdef CONFIG_BTRFS_POSIX_ACL 263#ifdef CONFIG_BTRFS_FS_POSIX_ACL
264 &btrfs_xattr_acl_access_handler, 264 &btrfs_xattr_acl_access_handler,
265 &btrfs_xattr_acl_default_handler, 265 &btrfs_xattr_acl_default_handler,
266#endif 266#endif
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 43003e0bef18..b09098079916 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1577,7 +1577,8 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1577 1577
1578out_err: 1578out_err:
1579 if (tcp_ses) { 1579 if (tcp_ses) {
1580 kfree(tcp_ses->hostname); 1580 if (!IS_ERR(tcp_ses->hostname))
1581 kfree(tcp_ses->hostname);
1581 if (tcp_ses->ssocket) 1582 if (tcp_ses->ssocket)
1582 sock_release(tcp_ses->ssocket); 1583 sock_release(tcp_ses->ssocket);
1583 kfree(tcp_ses); 1584 kfree(tcp_ses);
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 240cef14fe58..70736eb4b516 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -316,6 +316,10 @@ int dlm_lowcomms_connect_node(int nodeid)
316{ 316{
317 struct connection *con; 317 struct connection *con;
318 318
319 /* with sctp there's no connecting without sending */
320 if (dlm_config.ci_protocol != 0)
321 return 0;
322
319 if (nodeid == dlm_our_nodeid()) 323 if (nodeid == dlm_our_nodeid())
320 return 0; 324 return 0;
321 325
@@ -455,9 +459,9 @@ static void process_sctp_notification(struct connection *con,
455 int prim_len, ret; 459 int prim_len, ret;
456 int addr_len; 460 int addr_len;
457 struct connection *new_con; 461 struct connection *new_con;
458 struct file *file;
459 sctp_peeloff_arg_t parg; 462 sctp_peeloff_arg_t parg;
460 int parglen = sizeof(parg); 463 int parglen = sizeof(parg);
464 int err;
461 465
462 /* 466 /*
463 * We get this before any data for an association. 467 * We get this before any data for an association.
@@ -512,19 +516,22 @@ static void process_sctp_notification(struct connection *con,
512 ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, 516 ret = kernel_getsockopt(con->sock, IPPROTO_SCTP,
513 SCTP_SOCKOPT_PEELOFF, 517 SCTP_SOCKOPT_PEELOFF,
514 (void *)&parg, &parglen); 518 (void *)&parg, &parglen);
515 if (ret) { 519 if (ret < 0) {
516 log_print("Can't peel off a socket for " 520 log_print("Can't peel off a socket for "
517 "connection %d to node %d: err=%d\n", 521 "connection %d to node %d: err=%d",
518 parg.associd, nodeid, ret); 522 parg.associd, nodeid, ret);
523 return;
524 }
525 new_con->sock = sockfd_lookup(parg.sd, &err);
526 if (!new_con->sock) {
527 log_print("sockfd_lookup error %d", err);
528 return;
519 } 529 }
520 file = fget(parg.sd);
521 new_con->sock = SOCKET_I(file->f_dentry->d_inode);
522 add_sock(new_con->sock, new_con); 530 add_sock(new_con->sock, new_con);
523 fput(file); 531 sockfd_put(new_con->sock);
524 put_unused_fd(parg.sd);
525 532
526 log_print("got new/restarted association %d nodeid %d", 533 log_print("connecting to %d sctp association %d",
527 (int)sn->sn_assoc_change.sac_assoc_id, nodeid); 534 nodeid, (int)sn->sn_assoc_change.sac_assoc_id);
528 535
529 /* Send any pending writes */ 536 /* Send any pending writes */
530 clear_bit(CF_CONNECT_PENDING, &new_con->flags); 537 clear_bit(CF_CONNECT_PENDING, &new_con->flags);
@@ -837,8 +844,6 @@ static void sctp_init_assoc(struct connection *con)
837 if (con->retries++ > MAX_CONNECT_RETRIES) 844 if (con->retries++ > MAX_CONNECT_RETRIES)
838 return; 845 return;
839 846
840 log_print("Initiating association with node %d", con->nodeid);
841
842 if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) { 847 if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) {
843 log_print("no address for nodeid %d", con->nodeid); 848 log_print("no address for nodeid %d", con->nodeid);
844 return; 849 return;
@@ -855,11 +860,14 @@ static void sctp_init_assoc(struct connection *con)
855 outmessage.msg_flags = MSG_EOR; 860 outmessage.msg_flags = MSG_EOR;
856 861
857 spin_lock(&con->writequeue_lock); 862 spin_lock(&con->writequeue_lock);
858 e = list_entry(con->writequeue.next, struct writequeue_entry,
859 list);
860 863
861 BUG_ON((struct list_head *) e == &con->writequeue); 864 if (list_empty(&con->writequeue)) {
865 spin_unlock(&con->writequeue_lock);
866 log_print("writequeue empty for nodeid %d", con->nodeid);
867 return;
868 }
862 869
870 e = list_first_entry(&con->writequeue, struct writequeue_entry, list);
863 len = e->len; 871 len = e->len;
864 offset = e->offset; 872 offset = e->offset;
865 spin_unlock(&con->writequeue_lock); 873 spin_unlock(&con->writequeue_lock);
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 984ca0cb38c3..00d153f2f261 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -743,6 +743,7 @@ struct ext4_inode_info {
743#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ 743#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
744#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 744#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
745#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 745#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
746#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
746#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ 747#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
747#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ 748#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
748#define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ 749#define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 312211ee05af..d4ca92aab514 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1300,9 +1300,11 @@ static int parse_options(char *options, struct super_block *sb,
1300 *journal_devnum = option; 1300 *journal_devnum = option;
1301 break; 1301 break;
1302 case Opt_journal_checksum: 1302 case Opt_journal_checksum:
1303 break; /* Kept for backwards compatibility */ 1303 set_opt(sbi->s_mount_opt, JOURNAL_CHECKSUM);
1304 break;
1304 case Opt_journal_async_commit: 1305 case Opt_journal_async_commit:
1305 set_opt(sbi->s_mount_opt, JOURNAL_ASYNC_COMMIT); 1306 set_opt(sbi->s_mount_opt, JOURNAL_ASYNC_COMMIT);
1307 set_opt(sbi->s_mount_opt, JOURNAL_CHECKSUM);
1306 break; 1308 break;
1307 case Opt_noload: 1309 case Opt_noload:
1308 set_opt(sbi->s_mount_opt, NOLOAD); 1310 set_opt(sbi->s_mount_opt, NOLOAD);
@@ -2759,14 +2761,20 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2759 goto failed_mount4; 2761 goto failed_mount4;
2760 } 2762 }
2761 2763
2762 jbd2_journal_set_features(sbi->s_journal, 2764 if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
2763 JBD2_FEATURE_COMPAT_CHECKSUM, 0, 0); 2765 jbd2_journal_set_features(sbi->s_journal,
2764 if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) 2766 JBD2_FEATURE_COMPAT_CHECKSUM, 0,
2765 jbd2_journal_set_features(sbi->s_journal, 0, 0,
2766 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT); 2767 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT);
2767 else 2768 } else if (test_opt(sb, JOURNAL_CHECKSUM)) {
2769 jbd2_journal_set_features(sbi->s_journal,
2770 JBD2_FEATURE_COMPAT_CHECKSUM, 0, 0);
2768 jbd2_journal_clear_features(sbi->s_journal, 0, 0, 2771 jbd2_journal_clear_features(sbi->s_journal, 0, 0,
2769 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT); 2772 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT);
2773 } else {
2774 jbd2_journal_clear_features(sbi->s_journal,
2775 JBD2_FEATURE_COMPAT_CHECKSUM, 0,
2776 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT);
2777 }
2770 2778
2771 /* We have now updated the journal if required, so we can 2779 /* We have now updated the journal if required, so we can
2772 * validate the data journaling mode. */ 2780 * validate the data journaling mode. */
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 9b9d6395bad3..052f214ea6f0 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -58,6 +58,11 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
58 } 58 }
59 unlock_new_inode(tree->inode); 59 unlock_new_inode(tree->inode);
60 60
61 if (!HFS_I(tree->inode)->first_blocks) {
62 printk(KERN_ERR "hfs: invalid btree extent records (0 size).\n");
63 goto free_inode;
64 }
65
61 mapping = tree->inode->i_mapping; 66 mapping = tree->inode->i_mapping;
62 page = read_mapping_page(mapping, 0, NULL); 67 page = read_mapping_page(mapping, 0, NULL);
63 if (IS_ERR(page)) 68 if (IS_ERR(page))
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index 175d08eacc86..bed78ac8f6d1 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -99,6 +99,10 @@ int hfsplus_read_wrapper(struct super_block *sb)
99 99
100 if (hfsplus_get_last_session(sb, &part_start, &part_size)) 100 if (hfsplus_get_last_session(sb, &part_start, &part_size))
101 return -EINVAL; 101 return -EINVAL;
102 if ((u64)part_start + part_size > 0x100000000ULL) {
103 pr_err("hfs: volumes larger than 2TB are not supported yet\n");
104 return -EINVAL;
105 }
102 while (1) { 106 while (1) {
103 bh = sb_bread512(sb, part_start + HFSPLUS_VOLHEAD_SECTOR, vhdr); 107 bh = sb_bread512(sb, part_start + HFSPLUS_VOLHEAD_SECTOR, vhdr);
104 if (!bh) 108 if (!bh)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 32062c33c859..7cb298525eef 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1536,6 +1536,8 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
1536 old_dentry->d_parent->d_name.name, old_dentry->d_name.name, 1536 old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
1537 dentry->d_parent->d_name.name, dentry->d_name.name); 1537 dentry->d_parent->d_name.name, dentry->d_name.name);
1538 1538
1539 nfs_inode_return_delegation(inode);
1540
1539 d_drop(dentry); 1541 d_drop(dentry);
1540 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); 1542 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
1541 if (error == 0) { 1543 if (error == 0) {
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 6c3210099d51..e1d415e97849 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -457,6 +457,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
457 }; 457 };
458 struct rpc_task_setup task_setup_data = { 458 struct rpc_task_setup task_setup_data = {
459 .rpc_client = NFS_CLIENT(inode), 459 .rpc_client = NFS_CLIENT(inode),
460 .rpc_message = &msg,
460 .callback_ops = &nfs_write_direct_ops, 461 .callback_ops = &nfs_write_direct_ops,
461 .workqueue = nfsiod_workqueue, 462 .workqueue = nfsiod_workqueue,
462 .flags = RPC_TASK_ASYNC, 463 .flags = RPC_TASK_ASYNC,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ed7c269e2514..ff37454fa783 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -72,12 +72,17 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
72/* Prevent leaks of NFSv4 errors into userland */ 72/* Prevent leaks of NFSv4 errors into userland */
73static int nfs4_map_errors(int err) 73static int nfs4_map_errors(int err)
74{ 74{
75 if (err < -1000) { 75 if (err >= -1000)
76 return err;
77 switch (err) {
78 case -NFS4ERR_RESOURCE:
79 return -EREMOTEIO;
80 default:
76 dprintk("%s could not handle NFSv4 error %d\n", 81 dprintk("%s could not handle NFSv4 error %d\n",
77 __func__, -err); 82 __func__, -err);
78 return -EIO; 83 break;
79 } 84 }
80 return err; 85 return -EIO;
81} 86}
82 87
83/* 88/*
@@ -3060,9 +3065,6 @@ static void nfs4_renew_done(struct rpc_task *task, void *data)
3060 if (time_before(clp->cl_last_renewal,timestamp)) 3065 if (time_before(clp->cl_last_renewal,timestamp))
3061 clp->cl_last_renewal = timestamp; 3066 clp->cl_last_renewal = timestamp;
3062 spin_unlock(&clp->cl_lock); 3067 spin_unlock(&clp->cl_lock);
3063 dprintk("%s calling put_rpccred on rpc_cred %p\n", __func__,
3064 task->tk_msg.rpc_cred);
3065 put_rpccred(task->tk_msg.rpc_cred);
3066} 3068}
3067 3069
3068static const struct rpc_call_ops nfs4_renew_ops = { 3070static const struct rpc_call_ops nfs4_renew_ops = {
@@ -4877,7 +4879,6 @@ void nfs41_sequence_call_done(struct rpc_task *task, void *data)
4877 nfs41_sequence_free_slot(clp, task->tk_msg.rpc_resp); 4879 nfs41_sequence_free_slot(clp, task->tk_msg.rpc_resp);
4878 dprintk("%s rpc_cred %p\n", __func__, task->tk_msg.rpc_cred); 4880 dprintk("%s rpc_cred %p\n", __func__, task->tk_msg.rpc_cred);
4879 4881
4880 put_rpccred(task->tk_msg.rpc_cred);
4881 kfree(task->tk_msg.rpc_argp); 4882 kfree(task->tk_msg.rpc_argp);
4882 kfree(task->tk_msg.rpc_resp); 4883 kfree(task->tk_msg.rpc_resp);
4883 4884
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 83ad47cbdd8a..20b4e30e6c82 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -5681,7 +5681,6 @@ static struct {
5681 { NFS4ERR_SERVERFAULT, -ESERVERFAULT }, 5681 { NFS4ERR_SERVERFAULT, -ESERVERFAULT },
5682 { NFS4ERR_BADTYPE, -EBADTYPE }, 5682 { NFS4ERR_BADTYPE, -EBADTYPE },
5683 { NFS4ERR_LOCKED, -EAGAIN }, 5683 { NFS4ERR_LOCKED, -EAGAIN },
5684 { NFS4ERR_RESOURCE, -EREMOTEIO },
5685 { NFS4ERR_SYMLINK, -ELOOP }, 5684 { NFS4ERR_SYMLINK, -ELOOP },
5686 { NFS4ERR_OP_ILLEGAL, -EOPNOTSUPP }, 5685 { NFS4ERR_OP_ILLEGAL, -EOPNOTSUPP },
5687 { NFS4ERR_DEADLOCK, -EDEADLK }, 5686 { NFS4ERR_DEADLOCK, -EDEADLK },
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index a2c18acb8568..90be551b80c1 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1253,6 +1253,7 @@ static int nfs_parse_mount_options(char *raw,
1253 default: 1253 default:
1254 dfprintk(MOUNT, "NFS: unrecognized " 1254 dfprintk(MOUNT, "NFS: unrecognized "
1255 "transport protocol\n"); 1255 "transport protocol\n");
1256 kfree(string);
1256 return 0; 1257 return 0;
1257 } 1258 }
1258 break; 1259 break;
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
index 5941958f1e47..84c25382f8e3 100644
--- a/fs/nilfs2/btnode.c
+++ b/fs/nilfs2/btnode.c
@@ -87,6 +87,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
87 brelse(bh); 87 brelse(bh);
88 BUG(); 88 BUG();
89 } 89 }
90 memset(bh->b_data, 0, 1 << inode->i_blkbits);
90 bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev; 91 bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
91 bh->b_blocknr = blocknr; 92 bh->b_blocknr = blocknr;
92 set_buffer_mapped(bh); 93 set_buffer_mapped(bh);
@@ -276,8 +277,7 @@ void nilfs_btnode_commit_change_key(struct address_space *btnc,
276 "invalid oldkey %lld (newkey=%lld)", 277 "invalid oldkey %lld (newkey=%lld)",
277 (unsigned long long)oldkey, 278 (unsigned long long)oldkey,
278 (unsigned long long)newkey); 279 (unsigned long long)newkey);
279 if (!test_set_buffer_dirty(obh) && TestSetPageDirty(opage)) 280 nilfs_btnode_mark_dirty(obh);
280 BUG();
281 281
282 spin_lock_irq(&btnc->tree_lock); 282 spin_lock_irq(&btnc->tree_lock);
283 radix_tree_delete(&btnc->page_tree, oldkey); 283 radix_tree_delete(&btnc->page_tree, oldkey);
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 683df89dbae5..6eff66a070d5 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2468,17 +2468,22 @@ static void nilfs_segctor_notify(struct nilfs_sc_info *sci,
2468 /* Clear requests (even when the construction failed) */ 2468 /* Clear requests (even when the construction failed) */
2469 spin_lock(&sci->sc_state_lock); 2469 spin_lock(&sci->sc_state_lock);
2470 2470
2471 sci->sc_state &= ~NILFS_SEGCTOR_COMMIT;
2472
2473 if (req->mode == SC_LSEG_SR) { 2471 if (req->mode == SC_LSEG_SR) {
2472 sci->sc_state &= ~NILFS_SEGCTOR_COMMIT;
2474 sci->sc_seq_done = req->seq_accepted; 2473 sci->sc_seq_done = req->seq_accepted;
2475 nilfs_segctor_wakeup(sci, req->sc_err ? : req->sb_err); 2474 nilfs_segctor_wakeup(sci, req->sc_err ? : req->sb_err);
2476 sci->sc_flush_request = 0; 2475 sci->sc_flush_request = 0;
2477 } else if (req->mode == SC_FLUSH_FILE) 2476 } else {
2478 sci->sc_flush_request &= ~FLUSH_FILE_BIT; 2477 if (req->mode == SC_FLUSH_FILE)
2479 else if (req->mode == SC_FLUSH_DAT) 2478 sci->sc_flush_request &= ~FLUSH_FILE_BIT;
2480 sci->sc_flush_request &= ~FLUSH_DAT_BIT; 2479 else if (req->mode == SC_FLUSH_DAT)
2480 sci->sc_flush_request &= ~FLUSH_DAT_BIT;
2481 2481
2482 /* re-enable timer if checkpoint creation was not done */
2483 if (sci->sc_timer && (sci->sc_state & NILFS_SEGCTOR_COMMIT) &&
2484 time_before(jiffies, sci->sc_timer->expires))
2485 add_timer(sci->sc_timer);
2486 }
2482 spin_unlock(&sci->sc_state_lock); 2487 spin_unlock(&sci->sc_state_lock);
2483} 2488}
2484 2489
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index 828a889be909..7e54e52964dd 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -91,6 +91,7 @@ static int dnotify_handle_event(struct fsnotify_group *group,
91 struct dnotify_struct *dn; 91 struct dnotify_struct *dn;
92 struct dnotify_struct **prev; 92 struct dnotify_struct **prev;
93 struct fown_struct *fown; 93 struct fown_struct *fown;
94 __u32 test_mask = event->mask & ~FS_EVENT_ON_CHILD;
94 95
95 to_tell = event->to_tell; 96 to_tell = event->to_tell;
96 97
@@ -106,7 +107,7 @@ static int dnotify_handle_event(struct fsnotify_group *group,
106 spin_lock(&entry->lock); 107 spin_lock(&entry->lock);
107 prev = &dnentry->dn; 108 prev = &dnentry->dn;
108 while ((dn = *prev) != NULL) { 109 while ((dn = *prev) != NULL) {
109 if ((dn->dn_mask & event->mask) == 0) { 110 if ((dn->dn_mask & test_mask) == 0) {
110 prev = &dn->dn_next; 111 prev = &dn->dn_next;
111 continue; 112 continue;
112 } 113 }
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
index c8a07c65482b..3165d85aada2 100644
--- a/fs/notify/inode_mark.c
+++ b/fs/notify/inode_mark.c
@@ -324,11 +324,11 @@ int fsnotify_add_mark(struct fsnotify_mark_entry *entry,
324 spin_lock(&group->mark_lock); 324 spin_lock(&group->mark_lock);
325 spin_lock(&inode->i_lock); 325 spin_lock(&inode->i_lock);
326 326
327 entry->group = group;
328 entry->inode = inode;
329
330 lentry = fsnotify_find_mark_entry(group, inode); 327 lentry = fsnotify_find_mark_entry(group, inode);
331 if (!lentry) { 328 if (!lentry) {
329 entry->group = group;
330 entry->inode = inode;
331
332 hlist_add_head(&entry->i_list, &inode->i_fsnotify_mark_entries); 332 hlist_add_head(&entry->i_list, &inode->i_fsnotify_mark_entries);
333 list_add(&entry->g_list, &group->mark_entries); 333 list_add(&entry->g_list, &group->mark_entries);
334 334
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index 3816d5750dd5..b8bf53b4c108 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -143,7 +143,7 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new
143 /* remember, after old was put on the wait_q we aren't 143 /* remember, after old was put on the wait_q we aren't
144 * allowed to look at the inode any more, only thing 144 * allowed to look at the inode any more, only thing
145 * left to check was if the file_name is the same */ 145 * left to check was if the file_name is the same */
146 if (old->name_len && 146 if (!old->name_len ||
147 !strcmp(old->file_name, new->file_name)) 147 !strcmp(old->file_name, new->file_name))
148 return true; 148 return true;
149 break; 149 break;
diff --git a/fs/pipe.c b/fs/pipe.c
index 52c415114838..ae17d026aaa3 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -777,36 +777,55 @@ pipe_rdwr_release(struct inode *inode, struct file *filp)
777static int 777static int
778pipe_read_open(struct inode *inode, struct file *filp) 778pipe_read_open(struct inode *inode, struct file *filp)
779{ 779{
780 /* We could have perhaps used atomic_t, but this and friends 780 int ret = -ENOENT;
781 below are the only places. So it doesn't seem worthwhile. */ 781
782 mutex_lock(&inode->i_mutex); 782 mutex_lock(&inode->i_mutex);
783 inode->i_pipe->readers++; 783
784 if (inode->i_pipe) {
785 ret = 0;
786 inode->i_pipe->readers++;
787 }
788
784 mutex_unlock(&inode->i_mutex); 789 mutex_unlock(&inode->i_mutex);
785 790
786 return 0; 791 return ret;
787} 792}
788 793
789static int 794static int
790pipe_write_open(struct inode *inode, struct file *filp) 795pipe_write_open(struct inode *inode, struct file *filp)
791{ 796{
797 int ret = -ENOENT;
798
792 mutex_lock(&inode->i_mutex); 799 mutex_lock(&inode->i_mutex);
793 inode->i_pipe->writers++; 800
801 if (inode->i_pipe) {
802 ret = 0;
803 inode->i_pipe->writers++;
804 }
805
794 mutex_unlock(&inode->i_mutex); 806 mutex_unlock(&inode->i_mutex);
795 807
796 return 0; 808 return ret;
797} 809}
798 810
799static int 811static int
800pipe_rdwr_open(struct inode *inode, struct file *filp) 812pipe_rdwr_open(struct inode *inode, struct file *filp)
801{ 813{
814 int ret = -ENOENT;
815
802 mutex_lock(&inode->i_mutex); 816 mutex_lock(&inode->i_mutex);
803 if (filp->f_mode & FMODE_READ) 817
804 inode->i_pipe->readers++; 818 if (inode->i_pipe) {
805 if (filp->f_mode & FMODE_WRITE) 819 ret = 0;
806 inode->i_pipe->writers++; 820 if (filp->f_mode & FMODE_READ)
821 inode->i_pipe->readers++;
822 if (filp->f_mode & FMODE_WRITE)
823 inode->i_pipe->writers++;
824 }
825
807 mutex_unlock(&inode->i_mutex); 826 mutex_unlock(&inode->i_mutex);
808 827
809 return 0; 828 return ret;
810} 829}
811 830
812/* 831/*
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index c7bff4f603ff..a65239cfd97e 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
99 "VmallocUsed: %8lu kB\n" 99 "VmallocUsed: %8lu kB\n"
100 "VmallocChunk: %8lu kB\n" 100 "VmallocChunk: %8lu kB\n"
101#ifdef CONFIG_MEMORY_FAILURE 101#ifdef CONFIG_MEMORY_FAILURE
102 "HardwareCorrupted: %8lu kB\n" 102 "HardwareCorrupted: %5lu kB\n"
103#endif 103#endif
104 , 104 ,
105 K(i.totalram), 105 K(i.totalram),
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 0050fc40e8c9..5fad489ce5bc 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -894,7 +894,8 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
894 894
895 mutex_lock(&sysfs_rename_mutex); 895 mutex_lock(&sysfs_rename_mutex);
896 BUG_ON(!sd->s_parent); 896 BUG_ON(!sd->s_parent);
897 new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : &sysfs_root; 897 new_parent_sd = (new_parent_kobj && new_parent_kobj->sd) ?
898 new_parent_kobj->sd : &sysfs_root;
898 899
899 error = 0; 900 error = 0;
900 if (sd->s_parent == new_parent_sd) 901 if (sd->s_parent == new_parent_sd)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 561a9c050cef..f5ea4680f15f 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -268,7 +268,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
268 struct sysfs_open_dirent *od, *new_od = NULL; 268 struct sysfs_open_dirent *od, *new_od = NULL;
269 269
270 retry: 270 retry:
271 spin_lock(&sysfs_open_dirent_lock); 271 spin_lock_irq(&sysfs_open_dirent_lock);
272 272
273 if (!sd->s_attr.open && new_od) { 273 if (!sd->s_attr.open && new_od) {
274 sd->s_attr.open = new_od; 274 sd->s_attr.open = new_od;
@@ -281,7 +281,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
281 list_add_tail(&buffer->list, &od->buffers); 281 list_add_tail(&buffer->list, &od->buffers);
282 } 282 }
283 283
284 spin_unlock(&sysfs_open_dirent_lock); 284 spin_unlock_irq(&sysfs_open_dirent_lock);
285 285
286 if (od) { 286 if (od) {
287 kfree(new_od); 287 kfree(new_od);
@@ -315,8 +315,9 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
315 struct sysfs_buffer *buffer) 315 struct sysfs_buffer *buffer)
316{ 316{
317 struct sysfs_open_dirent *od = sd->s_attr.open; 317 struct sysfs_open_dirent *od = sd->s_attr.open;
318 unsigned long flags;
318 319
319 spin_lock(&sysfs_open_dirent_lock); 320 spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
320 321
321 list_del(&buffer->list); 322 list_del(&buffer->list);
322 if (atomic_dec_and_test(&od->refcnt)) 323 if (atomic_dec_and_test(&od->refcnt))
@@ -324,7 +325,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
324 else 325 else
325 od = NULL; 326 od = NULL;
326 327
327 spin_unlock(&sysfs_open_dirent_lock); 328 spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
328 329
329 kfree(od); 330 kfree(od);
330} 331}
@@ -456,8 +457,9 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
456void sysfs_notify_dirent(struct sysfs_dirent *sd) 457void sysfs_notify_dirent(struct sysfs_dirent *sd)
457{ 458{
458 struct sysfs_open_dirent *od; 459 struct sysfs_open_dirent *od;
460 unsigned long flags;
459 461
460 spin_lock(&sysfs_open_dirent_lock); 462 spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
461 463
462 od = sd->s_attr.open; 464 od = sd->s_attr.open;
463 if (od) { 465 if (od) {
@@ -465,7 +467,7 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd)
465 wake_up_interruptible(&od->poll); 467 wake_up_interruptible(&od->poll);
466 } 468 }
467 469
468 spin_unlock(&sysfs_open_dirent_lock); 470 spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
469} 471}
470EXPORT_SYMBOL_GPL(sysfs_notify_dirent); 472EXPORT_SYMBOL_GPL(sysfs_notify_dirent);
471 473
diff --git a/fs/xfs/linux-2.6/xfs_quotaops.c b/fs/xfs/linux-2.6/xfs_quotaops.c
index 9e41f91aa269..3d4a0c84d634 100644
--- a/fs/xfs/linux-2.6/xfs_quotaops.c
+++ b/fs/xfs/linux-2.6/xfs_quotaops.c
@@ -80,7 +80,7 @@ xfs_fs_set_xstate(
80 80
81 if (sb->s_flags & MS_RDONLY) 81 if (sb->s_flags & MS_RDONLY)
82 return -EROFS; 82 return -EROFS;
83 if (!XFS_IS_QUOTA_RUNNING(mp)) 83 if (op != Q_XQUOTARM && !XFS_IS_QUOTA_RUNNING(mp))
84 return -ENOSYS; 84 return -ENOSYS;
85 if (!capable(CAP_SYS_ADMIN)) 85 if (!capable(CAP_SYS_ADMIN))
86 return -EPERM; 86 return -EPERM;
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 4e4276b956e8..5d1a3b98a6e6 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -876,7 +876,6 @@ xfs_dqrele_inode(
876 ip->i_gdquot = NULL; 876 ip->i_gdquot = NULL;
877 } 877 }
878 xfs_iput(ip, XFS_ILOCK_EXCL); 878 xfs_iput(ip, XFS_ILOCK_EXCL);
879 IRELE(ip);
880 879
881 return 0; 880 return 0;
882} 881}
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index ab64f3efb43b..0785797db828 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -880,6 +880,7 @@ nextag:
880 * Not in range - save last search 880 * Not in range - save last search
881 * location and allocate a new inode 881 * location and allocate a new inode
882 */ 882 */
883 xfs_btree_del_cursor(tcur, XFS_BTREE_NOERROR);
883 pag->pagl_leftrec = trec.ir_startino; 884 pag->pagl_leftrec = trec.ir_startino;
884 pag->pagl_rightrec = rec.ir_startino; 885 pag->pagl_rightrec = rec.ir_startino;
885 pag->pagl_pagino = pagino; 886 pag->pagl_pagino = pagino;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 3f384d4b163a..1feed71551c9 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -364,6 +364,7 @@ unifdef-y += utsname.h
364unifdef-y += videodev2.h 364unifdef-y += videodev2.h
365unifdef-y += videodev.h 365unifdef-y += videodev.h
366unifdef-y += virtio_config.h 366unifdef-y += virtio_config.h
367unifdef-y += virtio_ids.h
367unifdef-y += virtio_blk.h 368unifdef-y += virtio_blk.h
368unifdef-y += virtio_net.h 369unifdef-y += virtio_net.h
369unifdef-y += virtio_9p.h 370unifdef-y += virtio_9p.h
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 44717eb47639..79a2340d83cd 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -291,8 +291,15 @@ struct global_attr {
291int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 291int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
292int cpufreq_update_policy(unsigned int cpu); 292int cpufreq_update_policy(unsigned int cpu);
293 293
294#ifdef CONFIG_CPU_FREQ
294/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 295/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
295unsigned int cpufreq_get(unsigned int cpu); 296unsigned int cpufreq_get(unsigned int cpu);
297#else
298static inline unsigned int cpufreq_get(unsigned int cpu)
299{
300 return 0;
301}
302#endif
296 303
297/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 304/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
298#ifdef CONFIG_CPU_FREQ 305#ifdef CONFIG_CPU_FREQ
diff --git a/include/linux/device.h b/include/linux/device.h
index aca31bf7d8ed..2ea3e4921812 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -124,7 +124,9 @@ struct device_driver {
124 struct bus_type *bus; 124 struct bus_type *bus;
125 125
126 struct module *owner; 126 struct module *owner;
127 const char *mod_name; /* used for built-in modules */ 127 const char *mod_name; /* used for built-in modules */
128
129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
128 130
129 int (*probe) (struct device *dev); 131 int (*probe) (struct device *dev);
130 int (*remove) (struct device *dev); 132 int (*remove) (struct device *dev);
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 6547c3cdbc4c..82a9124f7d75 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -37,7 +37,6 @@ typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); 37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
38 38
39/* Flag bits for kernel_param.flags */ 39/* Flag bits for kernel_param.flags */
40#define KPARAM_KMALLOCED 1
41#define KPARAM_ISBOOL 2 40#define KPARAM_ISBOOL 2
42 41
43struct kernel_param { 42struct kernel_param {
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 94958c109761..812a5f3c2abe 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -557,7 +557,7 @@ struct netdev_queue {
557 * Callback uses when the transmitter has not made any progress 557 * Callback uses when the transmitter has not made any progress
558 * for dev->watchdog ticks. 558 * for dev->watchdog ticks.
559 * 559 *
560 * struct net_device_stats* (*get_stats)(struct net_device *dev); 560 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
561 * Called when a user wants to get the network device usage 561 * Called when a user wants to get the network device usage
562 * statistics. If not defined, the counters in dev->stats will 562 * statistics. If not defined, the counters in dev->stats will
563 * be used. 563 * be used.
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f490e7a7307a..b0f0f3851cd4 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -379,9 +379,6 @@
379#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c 379#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c
380#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390 380#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390
381#define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c 381#define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c
382/* AMD SB Chipset */
383#define PCI_DEVICE_ID_AMD_SB900_IDE 0x780c
384#define PCI_DEVICE_ID_AMD_SB900_SATA_IDE 0x7800
385 382
386#define PCI_VENDOR_ID_VLSI 0x1004 383#define PCI_VENDOR_ID_VLSI 0x1004
387#define PCI_DEVICE_ID_VLSI_82C592 0x0005 384#define PCI_DEVICE_ID_VLSI_82C592 0x0005
@@ -485,6 +482,9 @@
485#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361 482#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361
486#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 483#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252
487 484
485#define PCI_SUBVENDOR_ID_IBM 0x1014
486#define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4
487
488#define PCI_VENDOR_ID_UNISYS 0x1018 488#define PCI_VENDOR_ID_UNISYS 0x1018
489#define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C 489#define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C
490 490
@@ -553,9 +553,10 @@
553#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 553#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
554#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 554#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
555#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 555#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
556
557#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 556#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
558#define PCI_DEVICE_ID_AMD_LX_AES 0x2082 557#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
558#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c
559#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800
559 560
560#define PCI_VENDOR_ID_TRIDENT 0x1023 561#define PCI_VENDOR_ID_TRIDENT 0x1023
561#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 562#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
@@ -2162,6 +2163,10 @@
2162#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D 2163#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D
2163#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E 2164#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E
2164#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F 2165#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F
2166#define PCI_DEVICE_ID_ADDIDATA_APCIe7300 0x7010
2167#define PCI_DEVICE_ID_ADDIDATA_APCIe7420 0x7011
2168#define PCI_DEVICE_ID_ADDIDATA_APCIe7500 0x7012
2169#define PCI_DEVICE_ID_ADDIDATA_APCIe7800 0x7013
2165 2170
2166#define PCI_VENDOR_ID_PDC 0x15e9 2171#define PCI_VENDOR_ID_PDC 0x15e9
2167 2172
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index df9d964c15fc..45b56faf5cdc 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -472,8 +472,8 @@ struct hw_perf_event {
472 unsigned long event_base; 472 unsigned long event_base;
473 int idx; 473 int idx;
474 }; 474 };
475 union { /* software */ 475 struct { /* software */
476 atomic64_t count; 476 s64 remaining;
477 struct hrtimer hrtimer; 477 struct hrtimer hrtimer;
478 }; 478 };
479 }; 479 };
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 931150566ade..a3baeb2c2161 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -88,6 +88,18 @@
88#define PR_TASK_PERF_EVENTS_DISABLE 31 88#define PR_TASK_PERF_EVENTS_DISABLE 31
89#define PR_TASK_PERF_EVENTS_ENABLE 32 89#define PR_TASK_PERF_EVENTS_ENABLE 32
90 90
91/*
92 * Set early/late kill mode for hwpoison memory corruption.
93 * This influences when the process gets killed on a memory corruption.
94 */
91#define PR_MCE_KILL 33 95#define PR_MCE_KILL 33
96# define PR_MCE_KILL_CLEAR 0
97# define PR_MCE_KILL_SET 1
98
99# define PR_MCE_KILL_LATE 0
100# define PR_MCE_KILL_EARLY 1
101# define PR_MCE_KILL_DEFAULT 2
102
103#define PR_MCE_KILL_GET 34
92 104
93#endif /* _LINUX_PRCTL_H */ 105#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 46e9ab3ee6e1..9642c6bcb399 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -76,11 +76,7 @@ static inline void __rcu_read_unlock_bh(void)
76 76
77extern void call_rcu_sched(struct rcu_head *head, 77extern void call_rcu_sched(struct rcu_head *head,
78 void (*func)(struct rcu_head *rcu)); 78 void (*func)(struct rcu_head *rcu));
79 79extern void synchronize_rcu_expedited(void);
80static inline void synchronize_rcu_expedited(void)
81{
82 synchronize_sched_expedited();
83}
84 80
85static inline void synchronize_rcu_bh_expedited(void) 81static inline void synchronize_rcu_bh_expedited(void)
86{ 82{
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index df7b23ac66e6..bcdd6606f468 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -354,8 +354,8 @@ struct sk_buff {
354 ipvs_property:1, 354 ipvs_property:1,
355 peeked:1, 355 peeked:1,
356 nf_trace:1; 356 nf_trace:1;
357 __be16 protocol:16;
357 kmemcheck_bitfield_end(flags1); 358 kmemcheck_bitfield_end(flags1);
358 __be16 protocol;
359 359
360 void (*destructor)(struct sk_buff *skb); 360 void (*destructor)(struct sk_buff *skb);
361#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 361#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -367,7 +367,6 @@ struct sk_buff {
367#endif 367#endif
368 368
369 int iif; 369 int iif;
370 __u16 queue_mapping;
371#ifdef CONFIG_NET_SCHED 370#ifdef CONFIG_NET_SCHED
372 __u16 tc_index; /* traffic control index */ 371 __u16 tc_index; /* traffic control index */
373#ifdef CONFIG_NET_CLS_ACT 372#ifdef CONFIG_NET_CLS_ACT
@@ -376,6 +375,7 @@ struct sk_buff {
376#endif 375#endif
377 376
378 kmemcheck_bitfield_begin(flags2); 377 kmemcheck_bitfield_begin(flags2);
378 __u16 queue_mapping:16;
379#ifdef CONFIG_IPV6_NDISC_NODETYPE 379#ifdef CONFIG_IPV6_NDISC_NODETYPE
380 __u8 ndisc_nodetype:2; 380 __u8 ndisc_nodetype:2;
381#endif 381#endif
@@ -1757,6 +1757,8 @@ extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
1757 int to_offset, 1757 int to_offset,
1758 int size); 1758 int size);
1759extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1759extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1760extern void skb_free_datagram_locked(struct sock *sk,
1761 struct sk_buff *skb);
1760extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1762extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1761 unsigned int flags); 1763 unsigned int flags);
1762extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 1764extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
diff --git a/include/linux/string.h b/include/linux/string.h
index 489019ef1694..b8508868d5ad 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -62,7 +62,7 @@ extern char * strnchr(const char *, size_t, int);
62#ifndef __HAVE_ARCH_STRRCHR 62#ifndef __HAVE_ARCH_STRRCHR
63extern char * strrchr(const char *,int); 63extern char * strrchr(const char *,int);
64#endif 64#endif
65extern char * strstrip(char *); 65extern char * __must_check strstrip(char *);
66#ifndef __HAVE_ARCH_STRSTR 66#ifndef __HAVE_ARCH_STRSTR
67extern char * strstr(const char *,const char *); 67extern char * strstr(const char *,const char *);
68#endif 68#endif
diff --git a/include/linux/topology.h b/include/linux/topology.h
index fc0bf3edeb67..57e63579bfdd 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -129,7 +129,7 @@ int arch_update_cpu_topology(void);
129 | 1*SD_BALANCE_FORK \ 129 | 1*SD_BALANCE_FORK \
130 | 0*SD_BALANCE_WAKE \ 130 | 0*SD_BALANCE_WAKE \
131 | 1*SD_WAKE_AFFINE \ 131 | 1*SD_WAKE_AFFINE \
132 | 1*SD_PREFER_LOCAL \ 132 | 0*SD_PREFER_LOCAL \
133 | 0*SD_SHARE_CPUPOWER \ 133 | 0*SD_SHARE_CPUPOWER \
134 | 1*SD_SHARE_PKG_RESOURCES \ 134 | 1*SD_SHARE_PKG_RESOURCES \
135 | 0*SD_SERIALIZE \ 135 | 0*SD_SERIALIZE \
@@ -162,7 +162,7 @@ int arch_update_cpu_topology(void);
162 | 1*SD_BALANCE_FORK \ 162 | 1*SD_BALANCE_FORK \
163 | 0*SD_BALANCE_WAKE \ 163 | 0*SD_BALANCE_WAKE \
164 | 1*SD_WAKE_AFFINE \ 164 | 1*SD_WAKE_AFFINE \
165 | 1*SD_PREFER_LOCAL \ 165 | 0*SD_PREFER_LOCAL \
166 | 0*SD_SHARE_CPUPOWER \ 166 | 0*SD_SHARE_CPUPOWER \
167 | 0*SD_SHARE_PKG_RESOURCES \ 167 | 0*SD_SHARE_PKG_RESOURCES \
168 | 0*SD_SERIALIZE \ 168 | 0*SD_SERIALIZE \
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index c134dd1fe6b6..09077f6ed128 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -7,7 +7,7 @@
7 7
8/* 8/*
9 * Trace sequences are used to allow a function to call several other functions 9 * Trace sequences are used to allow a function to call several other functions
10 * to create a string of data to use (up to a max of PAGE_SIZE. 10 * to create a string of data to use (up to a max of PAGE_SIZE).
11 */ 11 */
12 12
13struct trace_seq { 13struct trace_seq {
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index ea7226a45acb..095e10d148b4 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -2,6 +2,7 @@
2#define _LINUX_VIRTIO_9P_H 2#define _LINUX_VIRTIO_9P_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* Maximum number of virtio channels per partition (1 for now) */ 8/* Maximum number of virtio channels per partition (1 for now) */
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index 09d730085060..1418f048cb34 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -2,6 +2,7 @@
2#define _LINUX_VIRTIO_BALLOON_H 2#define _LINUX_VIRTIO_BALLOON_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* The feature bitmap for virtio balloon */ 8/* The feature bitmap for virtio balloon */
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index 15cb666581d7..fd294c56d571 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -3,6 +3,7 @@
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
7 8
8/* Feature bits */ 9/* Feature bits */
@@ -13,11 +14,8 @@
13#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ 14#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
14#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ 15#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
15#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 16#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
16#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */
17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ 17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
18 18
19#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */
20
21struct virtio_blk_config { 19struct virtio_blk_config {
22 /* The capacity (in 512-byte sectors). */ 20 /* The capacity (in 512-byte sectors). */
23 __u64 capacity; 21 __u64 capacity;
@@ -33,7 +31,6 @@ struct virtio_blk_config {
33 } geometry; 31 } geometry;
34 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ 32 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
35 __u32 blk_size; 33 __u32 blk_size;
36 __u8 identify[VIRTIO_BLK_ID_BYTES];
37} __attribute__((packed)); 34} __attribute__((packed));
38 35
39/* 36/*
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index b5f519806014..fe885174cc1f 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_VIRTIO_CONSOLE_H 1#ifndef _LINUX_VIRTIO_CONSOLE_H
2#define _LINUX_VIRTIO_CONSOLE_H 2#define _LINUX_VIRTIO_CONSOLE_H
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/virtio_ids.h>
4#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
5/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 6/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
6 * anyone can use the definitions to implement compatible drivers/servers. */ 7 * anyone can use the definitions to implement compatible drivers/servers. */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 1f41734bbb77..085e42298ce5 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -3,6 +3,7 @@
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
7#include <linux/if_ether.h> 8#include <linux/if_ether.h>
8 9
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h
index 48121c3c434b..c4d5de896f0c 100644
--- a/include/linux/virtio_rng.h
+++ b/include/linux/virtio_rng.h
@@ -2,6 +2,7 @@
2#define _LINUX_VIRTIO_RNG_H 2#define _LINUX_VIRTIO_RNG_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7#endif /* _LINUX_VIRTIO_RNG_H */ 8#endif /* _LINUX_VIRTIO_RNG_H */
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index e26812274b75..fb00b329f0d3 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -159,8 +159,7 @@ struct p9_client {
159 * @qid: the &p9_qid server identifier this handle points to 159 * @qid: the &p9_qid server identifier this handle points to
160 * @iounit: the server reported maximum transaction size for this file 160 * @iounit: the server reported maximum transaction size for this file
161 * @uid: the numeric uid of the local user who owns this handle 161 * @uid: the numeric uid of the local user who owns this handle
162 * @aux: transport specific information (unused?) 162 * @rdir: readdir accounting structure (allocated on demand)
163 * @rdir_fpos: tracks offset of file position when reading directory contents
164 * @flist: per-client-instance fid tracking 163 * @flist: per-client-instance fid tracking
165 * @dlist: per-dentry fid tracking 164 * @dlist: per-dentry fid tracking
166 * 165 *
@@ -174,9 +173,9 @@ struct p9_fid {
174 struct p9_qid qid; 173 struct p9_qid qid;
175 u32 iounit; 174 u32 iounit;
176 uid_t uid; 175 uid_t uid;
177 void *aux;
178 176
179 int rdir_fpos; 177 void *rdir;
178
180 struct list_head flist; 179 struct list_head flist;
181 struct list_head dlist; /* list of all fids attached to a dentry */ 180 struct list_head dlist; /* list of all fids attached to a dentry */
182}; 181};
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index b63b80fac567..f93ad90a601b 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -130,11 +130,11 @@ struct inet_timewait_sock {
130 __u16 tw_num; 130 __u16 tw_num;
131 kmemcheck_bitfield_begin(flags); 131 kmemcheck_bitfield_begin(flags);
132 /* And these are ours. */ 132 /* And these are ours. */
133 __u8 tw_ipv6only:1, 133 unsigned int tw_ipv6only : 1,
134 tw_transparent:1; 134 tw_transparent : 1,
135 /* 14 bits hole, try to pack */ 135 tw_pad : 14, /* 14 bits hole */
136 tw_ipv6_offset : 16;
136 kmemcheck_bitfield_end(flags); 137 kmemcheck_bitfield_end(flags);
137 __u16 tw_ipv6_offset;
138 unsigned long tw_ttd; 138 unsigned long tw_ttd;
139 struct inet_bind_bucket *tw_tb; 139 struct inet_bind_bucket *tw_tb;
140 struct hlist_node tw_death_node; 140 struct hlist_node tw_death_node;
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index ef91fe924ba4..4d22fabc7719 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -210,7 +210,8 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id);
210extern const struct nla_policy rtm_ipv4_policy[]; 210extern const struct nla_policy rtm_ipv4_policy[];
211extern void ip_fib_init(void); 211extern void ip_fib_init(void);
212extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 212extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
213 struct net_device *dev, __be32 *spec_dst, u32 *itag); 213 struct net_device *dev, __be32 *spec_dst,
214 u32 *itag, u32 mark);
214extern void fib_select_default(struct net *net, const struct flowi *flp, 215extern void fib_select_default(struct net *net, const struct flowi *flp,
215 struct fib_result *res); 216 struct fib_result *res);
216 217
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 466859b285e1..c75b960c8ac8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1669,6 +1669,8 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw);
1669 * to this function and ieee80211_rx_irqsafe() may not be mixed for a 1669 * to this function and ieee80211_rx_irqsafe() may not be mixed for a
1670 * single hardware. 1670 * single hardware.
1671 * 1671 *
1672 * Note that right now, this function must be called with softirqs disabled.
1673 *
1672 * @hw: the hardware this frame came in on 1674 * @hw: the hardware this frame came in on
1673 * @skb: the buffer to receive, owned by mac80211 after this call 1675 * @skb: the buffer to receive, owned by mac80211 after this call
1674 */ 1676 */
diff --git a/include/net/sock.h b/include/net/sock.h
index 1621935aad5b..9f96394f694e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -226,12 +226,12 @@ struct sock {
226#define sk_prot __sk_common.skc_prot 226#define sk_prot __sk_common.skc_prot
227#define sk_net __sk_common.skc_net 227#define sk_net __sk_common.skc_net
228 kmemcheck_bitfield_begin(flags); 228 kmemcheck_bitfield_begin(flags);
229 unsigned char sk_shutdown : 2, 229 unsigned int sk_shutdown : 2,
230 sk_no_check : 2, 230 sk_no_check : 2,
231 sk_userlocks : 4; 231 sk_userlocks : 4,
232 sk_protocol : 8,
233 sk_type : 16;
232 kmemcheck_bitfield_end(flags); 234 kmemcheck_bitfield_end(flags);
233 unsigned char sk_protocol;
234 unsigned short sk_type;
235 int sk_rcvbuf; 235 int sk_rcvbuf;
236 socket_lock_t sk_lock; 236 socket_lock_t sk_lock;
237 /* 237 /*
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index d696a692d94a..e0f6feb8588c 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -262,6 +262,8 @@ struct pcmcia_socket {
262 struct device dev; 262 struct device dev;
263 /* data internal to the socket driver */ 263 /* data internal to the socket driver */
264 void *driver_data; 264 void *driver_data;
265 /* status of the card during resume from a system sleep state */
266 int resume_status;
265}; 267};
266 268
267 269
@@ -280,6 +282,8 @@ extern struct pccard_resource_ops pccard_nonstatic_ops;
280 282
281/* socket drivers are expected to use these callbacks in their .drv struct */ 283/* socket drivers are expected to use these callbacks in their .drv struct */
282extern int pcmcia_socket_dev_suspend(struct device *dev); 284extern int pcmcia_socket_dev_suspend(struct device *dev);
285extern void pcmcia_socket_dev_early_resume(struct device *dev);
286extern void pcmcia_socket_dev_late_resume(struct device *dev);
283extern int pcmcia_socket_dev_resume(struct device *dev); 287extern int pcmcia_socket_dev_resume(struct device *dev);
284 288
285/* socket drivers use this callback in their IRQ handler */ 289/* socket drivers use this callback in their IRQ handler */
diff --git a/init/Kconfig b/init/Kconfig
index 09c5c6431f42..f51586406d62 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -297,7 +297,7 @@ config AUDIT
297 297
298config AUDITSYSCALL 298config AUDITSYSCALL
299 bool "Enable system-call auditing support" 299 bool "Enable system-call auditing support"
300 depends on AUDIT && (X86 || PPC || PPC64 || S390 || IA64 || UML || SPARC64|| SUPERH) 300 depends on AUDIT && (X86 || PPC || S390 || IA64 || UML || SPARC64 || SUPERH)
301 default y if SECURITY_SELINUX 301 default y if SECURITY_SELINUX
302 help 302 help
303 Enable low-overhead system-call auditing infrastructure that 303 Enable low-overhead system-call auditing infrastructure that
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index ca83b73fba19..0249f4be9b5c 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1710,14 +1710,13 @@ static ssize_t cgroup_write_X64(struct cgroup *cgrp, struct cftype *cft,
1710 return -EFAULT; 1710 return -EFAULT;
1711 1711
1712 buffer[nbytes] = 0; /* nul-terminate */ 1712 buffer[nbytes] = 0; /* nul-terminate */
1713 strstrip(buffer);
1714 if (cft->write_u64) { 1713 if (cft->write_u64) {
1715 u64 val = simple_strtoull(buffer, &end, 0); 1714 u64 val = simple_strtoull(strstrip(buffer), &end, 0);
1716 if (*end) 1715 if (*end)
1717 return -EINVAL; 1716 return -EINVAL;
1718 retval = cft->write_u64(cgrp, cft, val); 1717 retval = cft->write_u64(cgrp, cft, val);
1719 } else { 1718 } else {
1720 s64 val = simple_strtoll(buffer, &end, 0); 1719 s64 val = simple_strtoll(strstrip(buffer), &end, 0);
1721 if (*end) 1720 if (*end)
1722 return -EINVAL; 1721 return -EINVAL;
1723 retval = cft->write_s64(cgrp, cft, val); 1722 retval = cft->write_s64(cgrp, cft, val);
@@ -1753,8 +1752,7 @@ static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft,
1753 } 1752 }
1754 1753
1755 buffer[nbytes] = 0; /* nul-terminate */ 1754 buffer[nbytes] = 0; /* nul-terminate */
1756 strstrip(buffer); 1755 retval = cft->write_string(cgrp, cft, strstrip(buffer));
1757 retval = cft->write_string(cgrp, cft, buffer);
1758 if (!retval) 1756 if (!retval)
1759 retval = nbytes; 1757 retval = nbytes;
1760out: 1758out:
diff --git a/kernel/exit.c b/kernel/exit.c
index e61891f80123..f7864ac2ecc1 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -359,10 +359,8 @@ void __set_special_pids(struct pid *pid)
359{ 359{
360 struct task_struct *curr = current->group_leader; 360 struct task_struct *curr = current->group_leader;
361 361
362 if (task_session(curr) != pid) { 362 if (task_session(curr) != pid)
363 change_pid(curr, PIDTYPE_SID, pid); 363 change_pid(curr, PIDTYPE_SID, pid);
364 proc_sid_connector(curr);
365 }
366 364
367 if (task_pgrp(curr) != pid) 365 if (task_pgrp(curr) != pid)
368 change_pid(curr, PIDTYPE_PGID, pid); 366 change_pid(curr, PIDTYPE_PGID, pid);
diff --git a/kernel/fork.c b/kernel/fork.c
index 4c20fff8c13a..166b8c49257c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -91,7 +91,7 @@ int nr_processes(void)
91 int cpu; 91 int cpu;
92 int total = 0; 92 int total = 0;
93 93
94 for_each_online_cpu(cpu) 94 for_each_possible_cpu(cpu)
95 total += per_cpu(process_counts, cpu); 95 total += per_cpu(process_counts, cpu);
96 96
97 return total; 97 return total;
diff --git a/kernel/futex.c b/kernel/futex.c
index 4949d336d88d..fb65e822fc41 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -150,7 +150,8 @@ static struct futex_hash_bucket *hash_futex(union futex_key *key)
150 */ 150 */
151static inline int match_futex(union futex_key *key1, union futex_key *key2) 151static inline int match_futex(union futex_key *key1, union futex_key *key2)
152{ 152{
153 return (key1->both.word == key2->both.word 153 return (key1 && key2
154 && key1->both.word == key2->both.word
154 && key1->both.ptr == key2->both.ptr 155 && key1->both.ptr == key2->both.ptr
155 && key1->both.offset == key2->both.offset); 156 && key1->both.offset == key2->both.offset);
156} 157}
@@ -1028,7 +1029,6 @@ static inline
1028void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key, 1029void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
1029 struct futex_hash_bucket *hb) 1030 struct futex_hash_bucket *hb)
1030{ 1031{
1031 drop_futex_key_refs(&q->key);
1032 get_futex_key_refs(key); 1032 get_futex_key_refs(key);
1033 q->key = *key; 1033 q->key = *key;
1034 1034
@@ -1226,6 +1226,7 @@ retry_private:
1226 */ 1226 */
1227 if (ret == 1) { 1227 if (ret == 1) {
1228 WARN_ON(pi_state); 1228 WARN_ON(pi_state);
1229 drop_count++;
1229 task_count++; 1230 task_count++;
1230 ret = get_futex_value_locked(&curval2, uaddr2); 1231 ret = get_futex_value_locked(&curval2, uaddr2);
1231 if (!ret) 1232 if (!ret)
@@ -1304,6 +1305,7 @@ retry_private:
1304 if (ret == 1) { 1305 if (ret == 1) {
1305 /* We got the lock. */ 1306 /* We got the lock. */
1306 requeue_pi_wake_futex(this, &key2, hb2); 1307 requeue_pi_wake_futex(this, &key2, hb2);
1308 drop_count++;
1307 continue; 1309 continue;
1308 } else if (ret) { 1310 } else if (ret) {
1309 /* -EDEADLK */ 1311 /* -EDEADLK */
@@ -1791,6 +1793,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
1791 current->timer_slack_ns); 1793 current->timer_slack_ns);
1792 } 1794 }
1793 1795
1796retry:
1794 /* Prepare to wait on uaddr. */ 1797 /* Prepare to wait on uaddr. */
1795 ret = futex_wait_setup(uaddr, val, fshared, &q, &hb); 1798 ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
1796 if (ret) 1799 if (ret)
@@ -1808,9 +1811,14 @@ static int futex_wait(u32 __user *uaddr, int fshared,
1808 goto out_put_key; 1811 goto out_put_key;
1809 1812
1810 /* 1813 /*
1811 * We expect signal_pending(current), but another thread may 1814 * We expect signal_pending(current), but we might be the
1812 * have handled it for us already. 1815 * victim of a spurious wakeup as well.
1813 */ 1816 */
1817 if (!signal_pending(current)) {
1818 put_futex_key(fshared, &q.key);
1819 goto retry;
1820 }
1821
1814 ret = -ERESTARTSYS; 1822 ret = -ERESTARTSYS;
1815 if (!abs_time) 1823 if (!abs_time)
1816 goto out_put_key; 1824 goto out_put_key;
@@ -2118,9 +2126,11 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
2118 */ 2126 */
2119 plist_del(&q->list, &q->list.plist); 2127 plist_del(&q->list, &q->list.plist);
2120 2128
2129 /* Handle spurious wakeups gracefully */
2130 ret = -EWOULDBLOCK;
2121 if (timeout && !timeout->task) 2131 if (timeout && !timeout->task)
2122 ret = -ETIMEDOUT; 2132 ret = -ETIMEDOUT;
2123 else 2133 else if (signal_pending(current))
2124 ret = -ERESTARTNOINTR; 2134 ret = -ERESTARTNOINTR;
2125 } 2135 }
2126 return ret; 2136 return ret;
diff --git a/kernel/params.c b/kernel/params.c
index 9da58eabdcb2..d656c276508d 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -218,15 +218,11 @@ int param_set_charp(const char *val, struct kernel_param *kp)
218 return -ENOSPC; 218 return -ENOSPC;
219 } 219 }
220 220
221 if (kp->flags & KPARAM_KMALLOCED)
222 kfree(*(char **)kp->arg);
223
224 /* This is a hack. We can't need to strdup in early boot, and we 221 /* This is a hack. We can't need to strdup in early boot, and we
225 * don't need to; this mangled commandline is preserved. */ 222 * don't need to; this mangled commandline is preserved. */
226 if (slab_is_available()) { 223 if (slab_is_available()) {
227 kp->flags |= KPARAM_KMALLOCED;
228 *(char **)kp->arg = kstrdup(val, GFP_KERNEL); 224 *(char **)kp->arg = kstrdup(val, GFP_KERNEL);
229 if (!kp->arg) 225 if (!*(char **)kp->arg)
230 return -ENOMEM; 226 return -ENOMEM;
231 } else 227 } else
232 *(const char **)kp->arg = val; 228 *(const char **)kp->arg = val;
@@ -304,6 +300,7 @@ static int param_array(const char *name,
304 unsigned int min, unsigned int max, 300 unsigned int min, unsigned int max,
305 void *elem, int elemsize, 301 void *elem, int elemsize,
306 int (*set)(const char *, struct kernel_param *kp), 302 int (*set)(const char *, struct kernel_param *kp),
303 u16 flags,
307 unsigned int *num) 304 unsigned int *num)
308{ 305{
309 int ret; 306 int ret;
@@ -313,6 +310,7 @@ static int param_array(const char *name,
313 /* Get the name right for errors. */ 310 /* Get the name right for errors. */
314 kp.name = name; 311 kp.name = name;
315 kp.arg = elem; 312 kp.arg = elem;
313 kp.flags = flags;
316 314
317 /* No equals sign? */ 315 /* No equals sign? */
318 if (!val) { 316 if (!val) {
@@ -358,7 +356,8 @@ int param_array_set(const char *val, struct kernel_param *kp)
358 unsigned int temp_num; 356 unsigned int temp_num;
359 357
360 return param_array(kp->name, val, 1, arr->max, arr->elem, 358 return param_array(kp->name, val, 1, arr->max, arr->elem,
361 arr->elemsize, arr->set, arr->num ?: &temp_num); 359 arr->elemsize, arr->set, kp->flags,
360 arr->num ?: &temp_num);
362} 361}
363 362
364int param_array_get(char *buffer, struct kernel_param *kp) 363int param_array_get(char *buffer, struct kernel_param *kp)
@@ -605,11 +604,7 @@ void module_param_sysfs_remove(struct module *mod)
605 604
606void destroy_params(const struct kernel_param *params, unsigned num) 605void destroy_params(const struct kernel_param *params, unsigned num)
607{ 606{
608 unsigned int i; 607 /* FIXME: This should free kmalloced charp parameters. It doesn't. */
609
610 for (i = 0; i < num; i++)
611 if (params[i].flags & KPARAM_KMALLOCED)
612 kfree(*(char **)params[i].arg);
613} 608}
614 609
615static void __init kernel_add_sysfs_param(const char *name, 610static void __init kernel_add_sysfs_param(const char *name,
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 9ecaa45ab6b2..a69d4ed6a666 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3976,8 +3976,9 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
3976 regs = task_pt_regs(current); 3976 regs = task_pt_regs(current);
3977 3977
3978 if (regs) { 3978 if (regs) {
3979 if (perf_event_overflow(event, 0, &data, regs)) 3979 if (!(event->attr.exclude_idle && current->pid == 0))
3980 ret = HRTIMER_NORESTART; 3980 if (perf_event_overflow(event, 0, &data, regs))
3981 ret = HRTIMER_NORESTART;
3981 } 3982 }
3982 3983
3983 period = max_t(u64, 10000, event->hw.sample_period); 3984 period = max_t(u64, 10000, event->hw.sample_period);
@@ -3986,6 +3987,42 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
3986 return ret; 3987 return ret;
3987} 3988}
3988 3989
3990static void perf_swevent_start_hrtimer(struct perf_event *event)
3991{
3992 struct hw_perf_event *hwc = &event->hw;
3993
3994 hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
3995 hwc->hrtimer.function = perf_swevent_hrtimer;
3996 if (hwc->sample_period) {
3997 u64 period;
3998
3999 if (hwc->remaining) {
4000 if (hwc->remaining < 0)
4001 period = 10000;
4002 else
4003 period = hwc->remaining;
4004 hwc->remaining = 0;
4005 } else {
4006 period = max_t(u64, 10000, hwc->sample_period);
4007 }
4008 __hrtimer_start_range_ns(&hwc->hrtimer,
4009 ns_to_ktime(period), 0,
4010 HRTIMER_MODE_REL, 0);
4011 }
4012}
4013
4014static void perf_swevent_cancel_hrtimer(struct perf_event *event)
4015{
4016 struct hw_perf_event *hwc = &event->hw;
4017
4018 if (hwc->sample_period) {
4019 ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
4020 hwc->remaining = ktime_to_ns(remaining);
4021
4022 hrtimer_cancel(&hwc->hrtimer);
4023 }
4024}
4025
3989/* 4026/*
3990 * Software event: cpu wall time clock 4027 * Software event: cpu wall time clock
3991 */ 4028 */
@@ -4008,22 +4045,14 @@ static int cpu_clock_perf_event_enable(struct perf_event *event)
4008 int cpu = raw_smp_processor_id(); 4045 int cpu = raw_smp_processor_id();
4009 4046
4010 atomic64_set(&hwc->prev_count, cpu_clock(cpu)); 4047 atomic64_set(&hwc->prev_count, cpu_clock(cpu));
4011 hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 4048 perf_swevent_start_hrtimer(event);
4012 hwc->hrtimer.function = perf_swevent_hrtimer;
4013 if (hwc->sample_period) {
4014 u64 period = max_t(u64, 10000, hwc->sample_period);
4015 __hrtimer_start_range_ns(&hwc->hrtimer,
4016 ns_to_ktime(period), 0,
4017 HRTIMER_MODE_REL, 0);
4018 }
4019 4049
4020 return 0; 4050 return 0;
4021} 4051}
4022 4052
4023static void cpu_clock_perf_event_disable(struct perf_event *event) 4053static void cpu_clock_perf_event_disable(struct perf_event *event)
4024{ 4054{
4025 if (event->hw.sample_period) 4055 perf_swevent_cancel_hrtimer(event);
4026 hrtimer_cancel(&event->hw.hrtimer);
4027 cpu_clock_perf_event_update(event); 4056 cpu_clock_perf_event_update(event);
4028} 4057}
4029 4058
@@ -4060,22 +4089,15 @@ static int task_clock_perf_event_enable(struct perf_event *event)
4060 now = event->ctx->time; 4089 now = event->ctx->time;
4061 4090
4062 atomic64_set(&hwc->prev_count, now); 4091 atomic64_set(&hwc->prev_count, now);
4063 hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 4092
4064 hwc->hrtimer.function = perf_swevent_hrtimer; 4093 perf_swevent_start_hrtimer(event);
4065 if (hwc->sample_period) {
4066 u64 period = max_t(u64, 10000, hwc->sample_period);
4067 __hrtimer_start_range_ns(&hwc->hrtimer,
4068 ns_to_ktime(period), 0,
4069 HRTIMER_MODE_REL, 0);
4070 }
4071 4094
4072 return 0; 4095 return 0;
4073} 4096}
4074 4097
4075static void task_clock_perf_event_disable(struct perf_event *event) 4098static void task_clock_perf_event_disable(struct perf_event *event)
4076{ 4099{
4077 if (event->hw.sample_period) 4100 perf_swevent_cancel_hrtimer(event);
4078 hrtimer_cancel(&event->hw.hrtimer);
4079 task_clock_perf_event_update(event, event->ctx->time); 4101 task_clock_perf_event_update(event, event->ctx->time);
4080 4102
4081} 4103}
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 04b3a83d686f..04a9e90d248f 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -693,21 +693,22 @@ static int software_resume(void)
693 /* The snapshot device should not be opened while we're running */ 693 /* The snapshot device should not be opened while we're running */
694 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { 694 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
695 error = -EBUSY; 695 error = -EBUSY;
696 swsusp_close(FMODE_READ);
696 goto Unlock; 697 goto Unlock;
697 } 698 }
698 699
699 pm_prepare_console(); 700 pm_prepare_console();
700 error = pm_notifier_call_chain(PM_RESTORE_PREPARE); 701 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
701 if (error) 702 if (error)
702 goto Finish; 703 goto close_finish;
703 704
704 error = usermodehelper_disable(); 705 error = usermodehelper_disable();
705 if (error) 706 if (error)
706 goto Finish; 707 goto close_finish;
707 708
708 error = create_basic_memory_bitmaps(); 709 error = create_basic_memory_bitmaps();
709 if (error) 710 if (error)
710 goto Finish; 711 goto close_finish;
711 712
712 pr_debug("PM: Preparing processes for restore.\n"); 713 pr_debug("PM: Preparing processes for restore.\n");
713 error = prepare_processes(); 714 error = prepare_processes();
@@ -719,6 +720,7 @@ static int software_resume(void)
719 pr_debug("PM: Reading hibernation image.\n"); 720 pr_debug("PM: Reading hibernation image.\n");
720 721
721 error = swsusp_read(&flags); 722 error = swsusp_read(&flags);
723 swsusp_close(FMODE_READ);
722 if (!error) 724 if (!error)
723 hibernation_restore(flags & SF_PLATFORM_MODE); 725 hibernation_restore(flags & SF_PLATFORM_MODE);
724 726
@@ -737,6 +739,9 @@ static int software_resume(void)
737 mutex_unlock(&pm_mutex); 739 mutex_unlock(&pm_mutex);
738 pr_debug("PM: Resume from disk failed.\n"); 740 pr_debug("PM: Resume from disk failed.\n");
739 return error; 741 return error;
742close_finish:
743 swsusp_close(FMODE_READ);
744 goto Finish;
740} 745}
741 746
742late_initcall(software_resume); 747late_initcall(software_resume);
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
index 17d8bb1acf9c..25596e450ac7 100644
--- a/kernel/power/suspend_test.c
+++ b/kernel/power/suspend_test.c
@@ -19,7 +19,7 @@
19 * The time it takes is system-specific though, so when we test this 19 * The time it takes is system-specific though, so when we test this
20 * during system bootup we allow a LOT of time. 20 * during system bootup we allow a LOT of time.
21 */ 21 */
22#define TEST_SUSPEND_SECONDS 5 22#define TEST_SUSPEND_SECONDS 10
23 23
24static unsigned long suspend_test_start_time; 24static unsigned long suspend_test_start_time;
25 25
@@ -49,7 +49,8 @@ void suspend_test_finish(const char *label)
49 * has some performance issues. The stack dump of a WARN_ON 49 * has some performance issues. The stack dump of a WARN_ON
50 * is more likely to get the right attention than a printk... 50 * is more likely to get the right attention than a printk...
51 */ 51 */
52 WARN(msec > (TEST_SUSPEND_SECONDS * 1000), "Component: %s\n", label); 52 WARN(msec > (TEST_SUSPEND_SECONDS * 1000),
53 "Component: %s, time: %u\n", label, msec);
53} 54}
54 55
55/* 56/*
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index b101cdc4df3f..890f6b11b1d3 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -314,7 +314,6 @@ static int save_image(struct swap_map_handle *handle,
314{ 314{
315 unsigned int m; 315 unsigned int m;
316 int ret; 316 int ret;
317 int error = 0;
318 int nr_pages; 317 int nr_pages;
319 int err2; 318 int err2;
320 struct bio *bio; 319 struct bio *bio;
@@ -329,26 +328,27 @@ static int save_image(struct swap_map_handle *handle,
329 nr_pages = 0; 328 nr_pages = 0;
330 bio = NULL; 329 bio = NULL;
331 do_gettimeofday(&start); 330 do_gettimeofday(&start);
332 do { 331 while (1) {
333 ret = snapshot_read_next(snapshot, PAGE_SIZE); 332 ret = snapshot_read_next(snapshot, PAGE_SIZE);
334 if (ret > 0) { 333 if (ret <= 0)
335 error = swap_write_page(handle, data_of(*snapshot), 334 break;
336 &bio); 335 ret = swap_write_page(handle, data_of(*snapshot), &bio);
337 if (error) 336 if (ret)
338 break; 337 break;
339 if (!(nr_pages % m)) 338 if (!(nr_pages % m))
340 printk("\b\b\b\b%3d%%", nr_pages / m); 339 printk("\b\b\b\b%3d%%", nr_pages / m);
341 nr_pages++; 340 nr_pages++;
342 } 341 }
343 } while (ret > 0);
344 err2 = wait_on_bio_chain(&bio); 342 err2 = wait_on_bio_chain(&bio);
345 do_gettimeofday(&stop); 343 do_gettimeofday(&stop);
346 if (!error) 344 if (!ret)
347 error = err2; 345 ret = err2;
348 if (!error) 346 if (!ret)
349 printk("\b\b\b\bdone\n"); 347 printk("\b\b\b\bdone\n");
348 else
349 printk("\n");
350 swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); 350 swsusp_show_speed(&start, &stop, nr_to_write, "Wrote");
351 return error; 351 return ret;
352} 352}
353 353
354/** 354/**
@@ -536,7 +536,8 @@ static int load_image(struct swap_map_handle *handle,
536 snapshot_write_finalize(snapshot); 536 snapshot_write_finalize(snapshot);
537 if (!snapshot_image_loaded(snapshot)) 537 if (!snapshot_image_loaded(snapshot))
538 error = -ENODATA; 538 error = -ENODATA;
539 } 539 } else
540 printk("\n");
540 swsusp_show_speed(&start, &stop, nr_to_read, "Read"); 541 swsusp_show_speed(&start, &stop, nr_to_read, "Read");
541 return error; 542 return error;
542} 543}
@@ -572,8 +573,6 @@ int swsusp_read(unsigned int *flags_p)
572 error = load_image(&handle, &snapshot, header->pages - 1); 573 error = load_image(&handle, &snapshot, header->pages - 1);
573 release_swap_reader(&handle); 574 release_swap_reader(&handle);
574 575
575 blkdev_put(resume_bdev, FMODE_READ);
576
577 if (!error) 576 if (!error)
578 pr_debug("PM: Image successfully loaded\n"); 577 pr_debug("PM: Image successfully loaded\n");
579 else 578 else
@@ -596,7 +595,7 @@ int swsusp_check(void)
596 error = bio_read_page(swsusp_resume_block, 595 error = bio_read_page(swsusp_resume_block,
597 swsusp_header, NULL); 596 swsusp_header, NULL);
598 if (error) 597 if (error)
599 return error; 598 goto put;
600 599
601 if (!memcmp(SWSUSP_SIG, swsusp_header->sig, 10)) { 600 if (!memcmp(SWSUSP_SIG, swsusp_header->sig, 10)) {
602 memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10); 601 memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
@@ -604,8 +603,10 @@ int swsusp_check(void)
604 error = bio_write_page(swsusp_resume_block, 603 error = bio_write_page(swsusp_resume_block,
605 swsusp_header, NULL); 604 swsusp_header, NULL);
606 } else { 605 } else {
607 return -EINVAL; 606 error = -EINVAL;
608 } 607 }
608
609put:
609 if (error) 610 if (error)
610 blkdev_put(resume_bdev, FMODE_READ); 611 blkdev_put(resume_bdev, FMODE_READ);
611 else 612 else
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 705f02ac7433..0536125b0497 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -913,7 +913,20 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp)
913 spin_unlock(&rnp->lock); /* irqs remain disabled. */ 913 spin_unlock(&rnp->lock); /* irqs remain disabled. */
914 break; 914 break;
915 } 915 }
916 rcu_preempt_offline_tasks(rsp, rnp, rdp); 916
917 /*
918 * If there was a task blocking the current grace period,
919 * and if all CPUs have checked in, we need to propagate
920 * the quiescent state up the rcu_node hierarchy. But that
921 * is inconvenient at the moment due to deadlock issues if
922 * this should end the current grace period. So set the
923 * offlined CPU's bit in ->qsmask in order to force the
924 * next force_quiescent_state() invocation to clean up this
925 * mess in a deadlock-free manner.
926 */
927 if (rcu_preempt_offline_tasks(rsp, rnp, rdp) && !rnp->qsmask)
928 rnp->qsmask |= mask;
929
917 mask = rnp->grpmask; 930 mask = rnp->grpmask;
918 spin_unlock(&rnp->lock); /* irqs remain disabled. */ 931 spin_unlock(&rnp->lock); /* irqs remain disabled. */
919 rnp = rnp->parent; 932 rnp = rnp->parent;
@@ -958,7 +971,7 @@ static void rcu_offline_cpu(int cpu)
958 * Invoke any RCU callbacks that have made it to the end of their grace 971 * Invoke any RCU callbacks that have made it to the end of their grace
959 * period. Thottle as specified by rdp->blimit. 972 * period. Thottle as specified by rdp->blimit.
960 */ 973 */
961static void rcu_do_batch(struct rcu_data *rdp) 974static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
962{ 975{
963 unsigned long flags; 976 unsigned long flags;
964 struct rcu_head *next, *list, **tail; 977 struct rcu_head *next, *list, **tail;
@@ -1011,6 +1024,13 @@ static void rcu_do_batch(struct rcu_data *rdp)
1011 if (rdp->blimit == LONG_MAX && rdp->qlen <= qlowmark) 1024 if (rdp->blimit == LONG_MAX && rdp->qlen <= qlowmark)
1012 rdp->blimit = blimit; 1025 rdp->blimit = blimit;
1013 1026
1027 /* Reset ->qlen_last_fqs_check trigger if enough CBs have drained. */
1028 if (rdp->qlen == 0 && rdp->qlen_last_fqs_check != 0) {
1029 rdp->qlen_last_fqs_check = 0;
1030 rdp->n_force_qs_snap = rsp->n_force_qs;
1031 } else if (rdp->qlen < rdp->qlen_last_fqs_check - qhimark)
1032 rdp->qlen_last_fqs_check = rdp->qlen;
1033
1014 local_irq_restore(flags); 1034 local_irq_restore(flags);
1015 1035
1016 /* Re-raise the RCU softirq if there are callbacks remaining. */ 1036 /* Re-raise the RCU softirq if there are callbacks remaining. */
@@ -1224,7 +1244,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
1224 } 1244 }
1225 1245
1226 /* If there are callbacks ready, invoke them. */ 1246 /* If there are callbacks ready, invoke them. */
1227 rcu_do_batch(rdp); 1247 rcu_do_batch(rsp, rdp);
1228} 1248}
1229 1249
1230/* 1250/*
@@ -1288,10 +1308,20 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu),
1288 rcu_start_gp(rsp, nestflag); /* releases rnp_root->lock. */ 1308 rcu_start_gp(rsp, nestflag); /* releases rnp_root->lock. */
1289 } 1309 }
1290 1310
1291 /* Force the grace period if too many callbacks or too long waiting. */ 1311 /*
1292 if (unlikely(++rdp->qlen > qhimark)) { 1312 * Force the grace period if too many callbacks or too long waiting.
1313 * Enforce hysteresis, and don't invoke force_quiescent_state()
1314 * if some other CPU has recently done so. Also, don't bother
1315 * invoking force_quiescent_state() if the newly enqueued callback
1316 * is the only one waiting for a grace period to complete.
1317 */
1318 if (unlikely(++rdp->qlen > rdp->qlen_last_fqs_check + qhimark)) {
1293 rdp->blimit = LONG_MAX; 1319 rdp->blimit = LONG_MAX;
1294 force_quiescent_state(rsp, 0); 1320 if (rsp->n_force_qs == rdp->n_force_qs_snap &&
1321 *rdp->nxttail[RCU_DONE_TAIL] != head)
1322 force_quiescent_state(rsp, 0);
1323 rdp->n_force_qs_snap = rsp->n_force_qs;
1324 rdp->qlen_last_fqs_check = rdp->qlen;
1295 } else if ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0) 1325 } else if ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0)
1296 force_quiescent_state(rsp, 1); 1326 force_quiescent_state(rsp, 1);
1297 local_irq_restore(flags); 1327 local_irq_restore(flags);
@@ -1523,6 +1553,8 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
1523 rdp->beenonline = 1; /* We have now been online. */ 1553 rdp->beenonline = 1; /* We have now been online. */
1524 rdp->preemptable = preemptable; 1554 rdp->preemptable = preemptable;
1525 rdp->passed_quiesc_completed = lastcomp - 1; 1555 rdp->passed_quiesc_completed = lastcomp - 1;
1556 rdp->qlen_last_fqs_check = 0;
1557 rdp->n_force_qs_snap = rsp->n_force_qs;
1526 rdp->blimit = blimit; 1558 rdp->blimit = blimit;
1527 spin_unlock(&rnp->lock); /* irqs remain disabled. */ 1559 spin_unlock(&rnp->lock); /* irqs remain disabled. */
1528 1560
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index b40ac5706040..1823c6e20609 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -167,6 +167,10 @@ struct rcu_data {
167 struct rcu_head *nxtlist; 167 struct rcu_head *nxtlist;
168 struct rcu_head **nxttail[RCU_NEXT_SIZE]; 168 struct rcu_head **nxttail[RCU_NEXT_SIZE];
169 long qlen; /* # of queued callbacks */ 169 long qlen; /* # of queued callbacks */
170 long qlen_last_fqs_check;
171 /* qlen at last check for QS forcing */
172 unsigned long n_force_qs_snap;
173 /* did other CPU force QS recently? */
170 long blimit; /* Upper limit on a processed batch */ 174 long blimit; /* Upper limit on a processed batch */
171 175
172#ifdef CONFIG_NO_HZ 176#ifdef CONFIG_NO_HZ
@@ -302,9 +306,9 @@ static void rcu_print_task_stall(struct rcu_node *rnp);
302#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ 306#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
303static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp); 307static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp);
304#ifdef CONFIG_HOTPLUG_CPU 308#ifdef CONFIG_HOTPLUG_CPU
305static void rcu_preempt_offline_tasks(struct rcu_state *rsp, 309static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
306 struct rcu_node *rnp, 310 struct rcu_node *rnp,
307 struct rcu_data *rdp); 311 struct rcu_data *rdp);
308static void rcu_preempt_offline_cpu(int cpu); 312static void rcu_preempt_offline_cpu(int cpu);
309#endif /* #ifdef CONFIG_HOTPLUG_CPU */ 313#endif /* #ifdef CONFIG_HOTPLUG_CPU */
310static void rcu_preempt_check_callbacks(int cpu); 314static void rcu_preempt_check_callbacks(int cpu);
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index c0cb783aa16a..ef2a58c2b9d5 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -304,21 +304,25 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)
304 * parent is to remove the need for rcu_read_unlock_special() to 304 * parent is to remove the need for rcu_read_unlock_special() to
305 * make more than two attempts to acquire the target rcu_node's lock. 305 * make more than two attempts to acquire the target rcu_node's lock.
306 * 306 *
307 * Returns 1 if there was previously a task blocking the current grace
308 * period on the specified rcu_node structure.
309 *
307 * The caller must hold rnp->lock with irqs disabled. 310 * The caller must hold rnp->lock with irqs disabled.
308 */ 311 */
309static void rcu_preempt_offline_tasks(struct rcu_state *rsp, 312static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
310 struct rcu_node *rnp, 313 struct rcu_node *rnp,
311 struct rcu_data *rdp) 314 struct rcu_data *rdp)
312{ 315{
313 int i; 316 int i;
314 struct list_head *lp; 317 struct list_head *lp;
315 struct list_head *lp_root; 318 struct list_head *lp_root;
319 int retval = rcu_preempted_readers(rnp);
316 struct rcu_node *rnp_root = rcu_get_root(rsp); 320 struct rcu_node *rnp_root = rcu_get_root(rsp);
317 struct task_struct *tp; 321 struct task_struct *tp;
318 322
319 if (rnp == rnp_root) { 323 if (rnp == rnp_root) {
320 WARN_ONCE(1, "Last CPU thought to be offlined?"); 324 WARN_ONCE(1, "Last CPU thought to be offlined?");
321 return; /* Shouldn't happen: at least one CPU online. */ 325 return 0; /* Shouldn't happen: at least one CPU online. */
322 } 326 }
323 WARN_ON_ONCE(rnp != rdp->mynode && 327 WARN_ON_ONCE(rnp != rdp->mynode &&
324 (!list_empty(&rnp->blocked_tasks[0]) || 328 (!list_empty(&rnp->blocked_tasks[0]) ||
@@ -342,6 +346,8 @@ static void rcu_preempt_offline_tasks(struct rcu_state *rsp,
342 spin_unlock(&rnp_root->lock); /* irqs remain disabled */ 346 spin_unlock(&rnp_root->lock); /* irqs remain disabled */
343 } 347 }
344 } 348 }
349
350 return retval;
345} 351}
346 352
347/* 353/*
@@ -393,6 +399,17 @@ void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
393EXPORT_SYMBOL_GPL(call_rcu); 399EXPORT_SYMBOL_GPL(call_rcu);
394 400
395/* 401/*
402 * Wait for an rcu-preempt grace period. We are supposed to expedite the
403 * grace period, but this is the crude slow compatability hack, so just
404 * invoke synchronize_rcu().
405 */
406void synchronize_rcu_expedited(void)
407{
408 synchronize_rcu();
409}
410EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
411
412/*
396 * Check to see if there is any immediate preemptable-RCU-related work 413 * Check to see if there is any immediate preemptable-RCU-related work
397 * to be done. 414 * to be done.
398 */ 415 */
@@ -521,12 +538,15 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)
521 538
522/* 539/*
523 * Because preemptable RCU does not exist, it never needs to migrate 540 * Because preemptable RCU does not exist, it never needs to migrate
524 * tasks that were blocked within RCU read-side critical sections. 541 * tasks that were blocked within RCU read-side critical sections, and
542 * such non-existent tasks cannot possibly have been blocking the current
543 * grace period.
525 */ 544 */
526static void rcu_preempt_offline_tasks(struct rcu_state *rsp, 545static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
527 struct rcu_node *rnp, 546 struct rcu_node *rnp,
528 struct rcu_data *rdp) 547 struct rcu_data *rdp)
529{ 548{
549 return 0;
530} 550}
531 551
532/* 552/*
@@ -565,6 +585,16 @@ void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
565EXPORT_SYMBOL_GPL(call_rcu); 585EXPORT_SYMBOL_GPL(call_rcu);
566 586
567/* 587/*
588 * Wait for an rcu-preempt grace period, but make it happen quickly.
589 * But because preemptable RCU does not exist, map to rcu-sched.
590 */
591void synchronize_rcu_expedited(void)
592{
593 synchronize_sched_expedited();
594}
595EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
596
597/*
568 * Because preemptable RCU does not exist, it never has any work to do. 598 * Because preemptable RCU does not exist, it never has any work to do.
569 */ 599 */
570static int rcu_preempt_pending(int cpu) 600static int rcu_preempt_pending(int cpu)
diff --git a/kernel/sched.c b/kernel/sched.c
index e88689522e66..a455dca884a6 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1564,11 +1564,7 @@ static unsigned long cpu_avg_load_per_task(int cpu)
1564 1564
1565#ifdef CONFIG_FAIR_GROUP_SCHED 1565#ifdef CONFIG_FAIR_GROUP_SCHED
1566 1566
1567struct update_shares_data { 1567static __read_mostly unsigned long *update_shares_data;
1568 unsigned long rq_weight[NR_CPUS];
1569};
1570
1571static DEFINE_PER_CPU(struct update_shares_data, update_shares_data);
1572 1568
1573static void __set_se_shares(struct sched_entity *se, unsigned long shares); 1569static void __set_se_shares(struct sched_entity *se, unsigned long shares);
1574 1570
@@ -1578,12 +1574,12 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares);
1578static void update_group_shares_cpu(struct task_group *tg, int cpu, 1574static void update_group_shares_cpu(struct task_group *tg, int cpu,
1579 unsigned long sd_shares, 1575 unsigned long sd_shares,
1580 unsigned long sd_rq_weight, 1576 unsigned long sd_rq_weight,
1581 struct update_shares_data *usd) 1577 unsigned long *usd_rq_weight)
1582{ 1578{
1583 unsigned long shares, rq_weight; 1579 unsigned long shares, rq_weight;
1584 int boost = 0; 1580 int boost = 0;
1585 1581
1586 rq_weight = usd->rq_weight[cpu]; 1582 rq_weight = usd_rq_weight[cpu];
1587 if (!rq_weight) { 1583 if (!rq_weight) {
1588 boost = 1; 1584 boost = 1;
1589 rq_weight = NICE_0_LOAD; 1585 rq_weight = NICE_0_LOAD;
@@ -1618,7 +1614,7 @@ static void update_group_shares_cpu(struct task_group *tg, int cpu,
1618static int tg_shares_up(struct task_group *tg, void *data) 1614static int tg_shares_up(struct task_group *tg, void *data)
1619{ 1615{
1620 unsigned long weight, rq_weight = 0, shares = 0; 1616 unsigned long weight, rq_weight = 0, shares = 0;
1621 struct update_shares_data *usd; 1617 unsigned long *usd_rq_weight;
1622 struct sched_domain *sd = data; 1618 struct sched_domain *sd = data;
1623 unsigned long flags; 1619 unsigned long flags;
1624 int i; 1620 int i;
@@ -1627,11 +1623,11 @@ static int tg_shares_up(struct task_group *tg, void *data)
1627 return 0; 1623 return 0;
1628 1624
1629 local_irq_save(flags); 1625 local_irq_save(flags);
1630 usd = &__get_cpu_var(update_shares_data); 1626 usd_rq_weight = per_cpu_ptr(update_shares_data, smp_processor_id());
1631 1627
1632 for_each_cpu(i, sched_domain_span(sd)) { 1628 for_each_cpu(i, sched_domain_span(sd)) {
1633 weight = tg->cfs_rq[i]->load.weight; 1629 weight = tg->cfs_rq[i]->load.weight;
1634 usd->rq_weight[i] = weight; 1630 usd_rq_weight[i] = weight;
1635 1631
1636 /* 1632 /*
1637 * If there are currently no tasks on the cpu pretend there 1633 * If there are currently no tasks on the cpu pretend there
@@ -1652,7 +1648,7 @@ static int tg_shares_up(struct task_group *tg, void *data)
1652 shares = tg->shares; 1648 shares = tg->shares;
1653 1649
1654 for_each_cpu(i, sched_domain_span(sd)) 1650 for_each_cpu(i, sched_domain_span(sd))
1655 update_group_shares_cpu(tg, i, shares, rq_weight, usd); 1651 update_group_shares_cpu(tg, i, shares, rq_weight, usd_rq_weight);
1656 1652
1657 local_irq_restore(flags); 1653 local_irq_restore(flags);
1658 1654
@@ -9407,6 +9403,10 @@ void __init sched_init(void)
9407#endif /* CONFIG_USER_SCHED */ 9403#endif /* CONFIG_USER_SCHED */
9408#endif /* CONFIG_GROUP_SCHED */ 9404#endif /* CONFIG_GROUP_SCHED */
9409 9405
9406#if defined CONFIG_FAIR_GROUP_SCHED && defined CONFIG_SMP
9407 update_shares_data = __alloc_percpu(nr_cpu_ids * sizeof(unsigned long),
9408 __alignof__(unsigned long));
9409#endif
9410 for_each_possible_cpu(i) { 9410 for_each_possible_cpu(i) {
9411 struct rq *rq; 9411 struct rq *rq;
9412 9412
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 4e777b47eeda..c32c3e643daa 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -861,12 +861,21 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se);
861static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq) 861static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
862{ 862{
863 struct sched_entity *se = __pick_next_entity(cfs_rq); 863 struct sched_entity *se = __pick_next_entity(cfs_rq);
864 struct sched_entity *buddy;
864 865
865 if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, se) < 1) 866 if (cfs_rq->next) {
866 return cfs_rq->next; 867 buddy = cfs_rq->next;
868 cfs_rq->next = NULL;
869 if (wakeup_preempt_entity(buddy, se) < 1)
870 return buddy;
871 }
867 872
868 if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, se) < 1) 873 if (cfs_rq->last) {
869 return cfs_rq->last; 874 buddy = cfs_rq->last;
875 cfs_rq->last = NULL;
876 if (wakeup_preempt_entity(buddy, se) < 1)
877 return buddy;
878 }
870 879
871 return se; 880 return se;
872} 881}
@@ -1654,16 +1663,6 @@ static struct task_struct *pick_next_task_fair(struct rq *rq)
1654 1663
1655 do { 1664 do {
1656 se = pick_next_entity(cfs_rq); 1665 se = pick_next_entity(cfs_rq);
1657 /*
1658 * If se was a buddy, clear it so that it will have to earn
1659 * the favour again.
1660 *
1661 * If se was not a buddy, clear the buddies because neither
1662 * was elegible to run, let them earn it again.
1663 *
1664 * IOW. unconditionally clear buddies.
1665 */
1666 __clear_buddies(cfs_rq, NULL);
1667 set_next_entity(cfs_rq, se); 1666 set_next_entity(cfs_rq, se);
1668 cfs_rq = group_cfs_rq(se); 1667 cfs_rq = group_cfs_rq(se);
1669 } while (cfs_rq); 1668 } while (cfs_rq);
diff --git a/kernel/sys.c b/kernel/sys.c
index 255475d163e0..ce17760d9c51 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1110,6 +1110,8 @@ SYSCALL_DEFINE0(setsid)
1110 err = session; 1110 err = session;
1111out: 1111out:
1112 write_unlock_irq(&tasklist_lock); 1112 write_unlock_irq(&tasklist_lock);
1113 if (err > 0)
1114 proc_sid_connector(group_leader);
1113 return err; 1115 return err;
1114} 1116}
1115 1117
@@ -1546,24 +1548,37 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
1546 if (arg4 | arg5) 1548 if (arg4 | arg5)
1547 return -EINVAL; 1549 return -EINVAL;
1548 switch (arg2) { 1550 switch (arg2) {
1549 case 0: 1551 case PR_MCE_KILL_CLEAR:
1550 if (arg3 != 0) 1552 if (arg3 != 0)
1551 return -EINVAL; 1553 return -EINVAL;
1552 current->flags &= ~PF_MCE_PROCESS; 1554 current->flags &= ~PF_MCE_PROCESS;
1553 break; 1555 break;
1554 case 1: 1556 case PR_MCE_KILL_SET:
1555 current->flags |= PF_MCE_PROCESS; 1557 current->flags |= PF_MCE_PROCESS;
1556 if (arg3 != 0) 1558 if (arg3 == PR_MCE_KILL_EARLY)
1557 current->flags |= PF_MCE_EARLY; 1559 current->flags |= PF_MCE_EARLY;
1558 else 1560 else if (arg3 == PR_MCE_KILL_LATE)
1559 current->flags &= ~PF_MCE_EARLY; 1561 current->flags &= ~PF_MCE_EARLY;
1562 else if (arg3 == PR_MCE_KILL_DEFAULT)
1563 current->flags &=
1564 ~(PF_MCE_EARLY|PF_MCE_PROCESS);
1565 else
1566 return -EINVAL;
1560 break; 1567 break;
1561 default: 1568 default:
1562 return -EINVAL; 1569 return -EINVAL;
1563 } 1570 }
1564 error = 0; 1571 error = 0;
1565 break; 1572 break;
1566 1573 case PR_MCE_KILL_GET:
1574 if (arg2 | arg3 | arg4 | arg5)
1575 return -EINVAL;
1576 if (current->flags & PF_MCE_PROCESS)
1577 error = (current->flags & PF_MCE_EARLY) ?
1578 PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE;
1579 else
1580 error = PR_MCE_KILL_DEFAULT;
1581 break;
1567 default: 1582 default:
1568 error = -EINVAL; 1583 error = -EINVAL;
1569 break; 1584 break;
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
index b38423ca711a..b6e7aaea4604 100644
--- a/kernel/sysctl_check.c
+++ b/kernel/sysctl_check.c
@@ -1521,7 +1521,7 @@ int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table)
1521 if (!table->ctl_name && table->strategy) 1521 if (!table->ctl_name && table->strategy)
1522 set_fail(&fail, table, "Strategy without ctl_name"); 1522 set_fail(&fail, table, "Strategy without ctl_name");
1523#endif 1523#endif
1524#ifdef CONFIG_PROC_FS 1524#ifdef CONFIG_PROC_SYSCTL
1525 if (table->procname && !table->proc_handler) 1525 if (table->procname && !table->proc_handler)
1526 set_fail(&fail, table, "No proc_handler"); 1526 set_fail(&fail, table, "No proc_handler");
1527#endif 1527#endif
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b10c0d90a6ff..1ed514fe3a30 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -751,7 +751,7 @@ ftrace_profile_write(struct file *filp, const char __user *ubuf,
751 out: 751 out:
752 mutex_unlock(&ftrace_profile_lock); 752 mutex_unlock(&ftrace_profile_lock);
753 753
754 filp->f_pos += cnt; 754 *ppos += cnt;
755 755
756 return cnt; 756 return cnt;
757} 757}
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index e43c928356ee..63446f12e470 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -486,7 +486,7 @@ struct ring_buffer_iter {
486/* Up this if you want to test the TIME_EXTENTS and normalization */ 486/* Up this if you want to test the TIME_EXTENTS and normalization */
487#define DEBUG_SHIFT 0 487#define DEBUG_SHIFT 0
488 488
489static inline u64 rb_time_stamp(struct ring_buffer *buffer, int cpu) 489static inline u64 rb_time_stamp(struct ring_buffer *buffer)
490{ 490{
491 /* shift to debug/test normalization and TIME_EXTENTS */ 491 /* shift to debug/test normalization and TIME_EXTENTS */
492 return buffer->clock() << DEBUG_SHIFT; 492 return buffer->clock() << DEBUG_SHIFT;
@@ -497,7 +497,7 @@ u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu)
497 u64 time; 497 u64 time;
498 498
499 preempt_disable_notrace(); 499 preempt_disable_notrace();
500 time = rb_time_stamp(buffer, cpu); 500 time = rb_time_stamp(buffer);
501 preempt_enable_no_resched_notrace(); 501 preempt_enable_no_resched_notrace();
502 502
503 return time; 503 return time;
@@ -602,7 +602,7 @@ static struct list_head *rb_list_head(struct list_head *list)
602} 602}
603 603
604/* 604/*
605 * rb_is_head_page - test if the give page is the head page 605 * rb_is_head_page - test if the given page is the head page
606 * 606 *
607 * Because the reader may move the head_page pointer, we can 607 * Because the reader may move the head_page pointer, we can
608 * not trust what the head page is (it may be pointing to 608 * not trust what the head page is (it may be pointing to
@@ -1871,7 +1871,7 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
1871 * Nested commits always have zero deltas, so 1871 * Nested commits always have zero deltas, so
1872 * just reread the time stamp 1872 * just reread the time stamp
1873 */ 1873 */
1874 *ts = rb_time_stamp(buffer, cpu_buffer->cpu); 1874 *ts = rb_time_stamp(buffer);
1875 next_page->page->time_stamp = *ts; 1875 next_page->page->time_stamp = *ts;
1876 } 1876 }
1877 1877
@@ -2114,7 +2114,7 @@ rb_reserve_next_event(struct ring_buffer *buffer,
2114 if (RB_WARN_ON(cpu_buffer, ++nr_loops > 1000)) 2114 if (RB_WARN_ON(cpu_buffer, ++nr_loops > 1000))
2115 goto out_fail; 2115 goto out_fail;
2116 2116
2117 ts = rb_time_stamp(cpu_buffer->buffer, cpu_buffer->cpu); 2117 ts = rb_time_stamp(cpu_buffer->buffer);
2118 2118
2119 /* 2119 /*
2120 * Only the first commit can update the timestamp. 2120 * Only the first commit can update the timestamp.
@@ -2684,7 +2684,7 @@ unsigned long ring_buffer_entries(struct ring_buffer *buffer)
2684EXPORT_SYMBOL_GPL(ring_buffer_entries); 2684EXPORT_SYMBOL_GPL(ring_buffer_entries);
2685 2685
2686/** 2686/**
2687 * ring_buffer_overrun_cpu - get the number of overruns in buffer 2687 * ring_buffer_overruns - get the number of overruns in buffer
2688 * @buffer: The ring buffer 2688 * @buffer: The ring buffer
2689 * 2689 *
2690 * Returns the total number of overruns in the ring buffer 2690 * Returns the total number of overruns in the ring buffer
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 026e715a0c7a..9d3067a62d43 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2440,7 +2440,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
2440 return ret; 2440 return ret;
2441 } 2441 }
2442 2442
2443 filp->f_pos += cnt; 2443 *ppos += cnt;
2444 2444
2445 return cnt; 2445 return cnt;
2446} 2446}
@@ -2582,7 +2582,7 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
2582 } 2582 }
2583 mutex_unlock(&trace_types_lock); 2583 mutex_unlock(&trace_types_lock);
2584 2584
2585 filp->f_pos += cnt; 2585 *ppos += cnt;
2586 2586
2587 return cnt; 2587 return cnt;
2588} 2588}
@@ -2764,7 +2764,7 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
2764 if (err) 2764 if (err)
2765 return err; 2765 return err;
2766 2766
2767 filp->f_pos += ret; 2767 *ppos += ret;
2768 2768
2769 return ret; 2769 return ret;
2770} 2770}
@@ -3299,7 +3299,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
3299 } 3299 }
3300 } 3300 }
3301 3301
3302 filp->f_pos += cnt; 3302 *ppos += cnt;
3303 3303
3304 /* If check pages failed, return ENOMEM */ 3304 /* If check pages failed, return ENOMEM */
3305 if (tracing_disabled) 3305 if (tracing_disabled)
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index ed17565826b0..b6c12c6a1bcd 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -69,6 +69,9 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
69 * @s: trace sequence descriptor 69 * @s: trace sequence descriptor
70 * @fmt: printf format string 70 * @fmt: printf format string
71 * 71 *
72 * It returns 0 if the trace oversizes the buffer's free
73 * space, 1 otherwise.
74 *
72 * The tracer may use either sequence operations or its own 75 * The tracer may use either sequence operations or its own
73 * copy to user routines. To simplify formating of a trace 76 * copy to user routines. To simplify formating of a trace
74 * trace_seq_printf is used to store strings into a special 77 * trace_seq_printf is used to store strings into a special
@@ -95,7 +98,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
95 98
96 s->len += ret; 99 s->len += ret;
97 100
98 return len; 101 return 1;
99} 102}
100EXPORT_SYMBOL_GPL(trace_seq_printf); 103EXPORT_SYMBOL_GPL(trace_seq_printf);
101 104
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ccefe574dcf7..12328147132c 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -647,7 +647,7 @@ EXPORT_SYMBOL(schedule_delayed_work);
647 */ 647 */
648void flush_delayed_work(struct delayed_work *dwork) 648void flush_delayed_work(struct delayed_work *dwork)
649{ 649{
650 if (del_timer(&dwork->timer)) { 650 if (del_timer_sync(&dwork->timer)) {
651 struct cpu_workqueue_struct *cwq; 651 struct cpu_workqueue_struct *cwq;
652 cwq = wq_per_cpu(keventd_wq, get_cpu()); 652 cwq = wq_per_cpu(keventd_wq, get_cpu());
653 __queue_work(cwq, &dwork->work); 653 __queue_work(cwq, &dwork->work);
@@ -685,21 +685,38 @@ EXPORT_SYMBOL(schedule_delayed_work_on);
685int schedule_on_each_cpu(work_func_t func) 685int schedule_on_each_cpu(work_func_t func)
686{ 686{
687 int cpu; 687 int cpu;
688 int orig = -1;
688 struct work_struct *works; 689 struct work_struct *works;
689 690
690 works = alloc_percpu(struct work_struct); 691 works = alloc_percpu(struct work_struct);
691 if (!works) 692 if (!works)
692 return -ENOMEM; 693 return -ENOMEM;
693 694
695 /*
696 * when running in keventd don't schedule a work item on itself.
697 * Can just call directly because the work queue is already bound.
698 * This also is faster.
699 * Make this a generic parameter for other workqueues?
700 */
701 if (current_is_keventd()) {
702 orig = raw_smp_processor_id();
703 INIT_WORK(per_cpu_ptr(works, orig), func);
704 func(per_cpu_ptr(works, orig));
705 }
706
694 get_online_cpus(); 707 get_online_cpus();
695 for_each_online_cpu(cpu) { 708 for_each_online_cpu(cpu) {
696 struct work_struct *work = per_cpu_ptr(works, cpu); 709 struct work_struct *work = per_cpu_ptr(works, cpu);
697 710
711 if (cpu == orig)
712 continue;
698 INIT_WORK(work, func); 713 INIT_WORK(work, func);
699 schedule_work_on(cpu, work); 714 schedule_work_on(cpu, work);
700 } 715 }
701 for_each_online_cpu(cpu) 716 for_each_online_cpu(cpu) {
702 flush_work(per_cpu_ptr(works, cpu)); 717 if (cpu != orig)
718 flush_work(per_cpu_ptr(works, cpu));
719 }
703 put_online_cpus(); 720 put_online_cpus();
704 free_percpu(works); 721 free_percpu(works);
705 return 0; 722 return 0;
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 30df5865ecbe..234ceb10861f 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -392,7 +392,7 @@ config DEBUG_KMEMLEAK_TEST
392 392
393config DEBUG_PREEMPT 393config DEBUG_PREEMPT
394 bool "Debug preemptible kernel" 394 bool "Debug preemptible kernel"
395 depends on DEBUG_KERNEL && PREEMPT && (TRACE_IRQFLAGS_SUPPORT || PPC64) 395 depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT
396 default y 396 default y
397 help 397 help
398 If you say Y here then the kernel will use a debug variant of the 398 If you say Y here then the kernel will use a debug variant of the
diff --git a/mm/Kconfig b/mm/Kconfig
index 57963c6063d1..fd3386242cf0 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -67,7 +67,7 @@ config DISCONTIGMEM
67 67
68config SPARSEMEM 68config SPARSEMEM
69 def_bool y 69 def_bool y
70 depends on SPARSEMEM_MANUAL 70 depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
71 71
72config FLATMEM 72config FLATMEM
73 def_bool y 73 def_bool y
@@ -129,7 +129,7 @@ config MEMORY_HOTPLUG
129 bool "Allow for memory hot-add" 129 bool "Allow for memory hot-add"
130 depends on SPARSEMEM || X86_64_ACPI_NUMA 130 depends on SPARSEMEM || X86_64_ACPI_NUMA
131 depends on HOTPLUG && !(HIBERNATION && !S390) && ARCH_ENABLE_MEMORY_HOTPLUG 131 depends on HOTPLUG && !(HIBERNATION && !S390) && ARCH_ENABLE_MEMORY_HOTPLUG
132 depends on (IA64 || X86 || PPC64 || SUPERH || S390) 132 depends on (IA64 || X86 || PPC_BOOK3S_64 || SUPERH || S390)
133 133
134comment "Memory hotplug is currently incompatible with Software Suspend" 134comment "Memory hotplug is currently incompatible with Software Suspend"
135 depends on SPARSEMEM && HOTPLUG && HIBERNATION && !S390 135 depends on SPARSEMEM && HOTPLUG && HIBERNATION && !S390
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 5a37e2055717..1065b715ef64 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -610,6 +610,21 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi)
610 kthread_stop(wb->task); 610 kthread_stop(wb->task);
611} 611}
612 612
613/*
614 * This bdi is going away now, make sure that no super_blocks point to it
615 */
616static void bdi_prune_sb(struct backing_dev_info *bdi)
617{
618 struct super_block *sb;
619
620 spin_lock(&sb_lock);
621 list_for_each_entry(sb, &super_blocks, s_list) {
622 if (sb->s_bdi == bdi)
623 sb->s_bdi = NULL;
624 }
625 spin_unlock(&sb_lock);
626}
627
613void bdi_unregister(struct backing_dev_info *bdi) 628void bdi_unregister(struct backing_dev_info *bdi)
614{ 629{
615 if (bdi->dev) { 630 if (bdi->dev) {
@@ -682,6 +697,7 @@ void bdi_destroy(struct backing_dev_info *bdi)
682 spin_unlock(&inode_lock); 697 spin_unlock(&inode_lock);
683 } 698 }
684 699
700 bdi_prune_sb(bdi);
685 bdi_unregister(bdi); 701 bdi_unregister(bdi);
686 702
687 for (i = 0; i < NR_BDI_STAT_ITEMS; i++) 703 for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 729d4b15b645..dacc64183874 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -35,6 +35,7 @@
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/page-flags.h> 36#include <linux/page-flags.h>
37#include <linux/sched.h> 37#include <linux/sched.h>
38#include <linux/ksm.h>
38#include <linux/rmap.h> 39#include <linux/rmap.h>
39#include <linux/pagemap.h> 40#include <linux/pagemap.h>
40#include <linux/swap.h> 41#include <linux/swap.h>
@@ -370,9 +371,6 @@ static int me_pagecache_clean(struct page *p, unsigned long pfn)
370 int ret = FAILED; 371 int ret = FAILED;
371 struct address_space *mapping; 372 struct address_space *mapping;
372 373
373 if (!isolate_lru_page(p))
374 page_cache_release(p);
375
376 /* 374 /*
377 * For anonymous pages we're done the only reference left 375 * For anonymous pages we're done the only reference left
378 * should be the one m_f() holds. 376 * should be the one m_f() holds.
@@ -498,30 +496,18 @@ static int me_pagecache_dirty(struct page *p, unsigned long pfn)
498 */ 496 */
499static int me_swapcache_dirty(struct page *p, unsigned long pfn) 497static int me_swapcache_dirty(struct page *p, unsigned long pfn)
500{ 498{
501 int ret = FAILED;
502
503 ClearPageDirty(p); 499 ClearPageDirty(p);
504 /* Trigger EIO in shmem: */ 500 /* Trigger EIO in shmem: */
505 ClearPageUptodate(p); 501 ClearPageUptodate(p);
506 502
507 if (!isolate_lru_page(p)) { 503 return DELAYED;
508 page_cache_release(p);
509 ret = DELAYED;
510 }
511
512 return ret;
513} 504}
514 505
515static int me_swapcache_clean(struct page *p, unsigned long pfn) 506static int me_swapcache_clean(struct page *p, unsigned long pfn)
516{ 507{
517 int ret = FAILED;
518
519 if (!isolate_lru_page(p)) {
520 page_cache_release(p);
521 ret = RECOVERED;
522 }
523 delete_from_swap_cache(p); 508 delete_from_swap_cache(p);
524 return ret; 509
510 return RECOVERED;
525} 511}
526 512
527/* 513/*
@@ -611,8 +597,6 @@ static struct page_state {
611 { 0, 0, "unknown page state", me_unknown }, 597 { 0, 0, "unknown page state", me_unknown },
612}; 598};
613 599
614#undef lru
615
616static void action_result(unsigned long pfn, char *msg, int result) 600static void action_result(unsigned long pfn, char *msg, int result)
617{ 601{
618 struct page *page = NULL; 602 struct page *page = NULL;
@@ -629,13 +613,16 @@ static int page_action(struct page_state *ps, struct page *p,
629 unsigned long pfn, int ref) 613 unsigned long pfn, int ref)
630{ 614{
631 int result; 615 int result;
616 int count;
632 617
633 result = ps->action(p, pfn); 618 result = ps->action(p, pfn);
634 action_result(pfn, ps->msg, result); 619 action_result(pfn, ps->msg, result);
635 if (page_count(p) != 1 + ref) 620
621 count = page_count(p) - 1 - ref;
622 if (count != 0)
636 printk(KERN_ERR 623 printk(KERN_ERR
637 "MCE %#lx: %s page still referenced by %d users\n", 624 "MCE %#lx: %s page still referenced by %d users\n",
638 pfn, ps->msg, page_count(p) - 1); 625 pfn, ps->msg, count);
639 626
640 /* Could do more checks here if page looks ok */ 627 /* Could do more checks here if page looks ok */
641 /* 628 /*
@@ -661,12 +648,9 @@ static void hwpoison_user_mappings(struct page *p, unsigned long pfn,
661 int i; 648 int i;
662 int kill = 1; 649 int kill = 1;
663 650
664 if (PageReserved(p) || PageCompound(p) || PageSlab(p)) 651 if (PageReserved(p) || PageCompound(p) || PageSlab(p) || PageKsm(p))
665 return; 652 return;
666 653
667 if (!PageLRU(p))
668 lru_add_drain_all();
669
670 /* 654 /*
671 * This check implies we don't kill processes if their pages 655 * This check implies we don't kill processes if their pages
672 * are in the swap cache early. Those are always late kills. 656 * are in the swap cache early. Those are always late kills.
@@ -738,6 +722,7 @@ static void hwpoison_user_mappings(struct page *p, unsigned long pfn,
738 722
739int __memory_failure(unsigned long pfn, int trapno, int ref) 723int __memory_failure(unsigned long pfn, int trapno, int ref)
740{ 724{
725 unsigned long lru_flag;
741 struct page_state *ps; 726 struct page_state *ps;
742 struct page *p; 727 struct page *p;
743 int res; 728 int res;
@@ -775,6 +760,24 @@ int __memory_failure(unsigned long pfn, int trapno, int ref)
775 } 760 }
776 761
777 /* 762 /*
763 * We ignore non-LRU pages for good reasons.
764 * - PG_locked is only well defined for LRU pages and a few others
765 * - to avoid races with __set_page_locked()
766 * - to avoid races with __SetPageSlab*() (and more non-atomic ops)
767 * The check (unnecessarily) ignores LRU pages being isolated and
768 * walked by the page reclaim code, however that's not a big loss.
769 */
770 if (!PageLRU(p))
771 lru_add_drain_all();
772 lru_flag = p->flags & lru;
773 if (isolate_lru_page(p)) {
774 action_result(pfn, "non LRU", IGNORED);
775 put_page(p);
776 return -EBUSY;
777 }
778 page_cache_release(p);
779
780 /*
778 * Lock the page and wait for writeback to finish. 781 * Lock the page and wait for writeback to finish.
779 * It's very difficult to mess with pages currently under IO 782 * It's very difficult to mess with pages currently under IO
780 * and in many cases impossible, so we just avoid it here. 783 * and in many cases impossible, so we just avoid it here.
@@ -790,7 +793,7 @@ int __memory_failure(unsigned long pfn, int trapno, int ref)
790 /* 793 /*
791 * Torn down by someone else? 794 * Torn down by someone else?
792 */ 795 */
793 if (PageLRU(p) && !PageSwapCache(p) && p->mapping == NULL) { 796 if ((lru_flag & lru) && !PageSwapCache(p) && p->mapping == NULL) {
794 action_result(pfn, "already truncated LRU", IGNORED); 797 action_result(pfn, "already truncated LRU", IGNORED);
795 res = 0; 798 res = 0;
796 goto out; 799 goto out;
@@ -798,7 +801,7 @@ int __memory_failure(unsigned long pfn, int trapno, int ref)
798 801
799 res = -EBUSY; 802 res = -EBUSY;
800 for (ps = error_states;; ps++) { 803 for (ps = error_states;; ps++) {
801 if ((p->flags & ps->mask) == ps->res) { 804 if (((p->flags | lru_flag)& ps->mask) == ps->res) {
802 res = page_action(ps, p, pfn, ref); 805 res = page_action(ps, p, pfn, ref);
803 break; 806 break;
804 } 807 }
diff --git a/mm/memory.c b/mm/memory.c
index 7e91b5f9f690..6ab19dd4a199 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -641,6 +641,7 @@ static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
641 pmd_t *dst_pmd, pmd_t *src_pmd, struct vm_area_struct *vma, 641 pmd_t *dst_pmd, pmd_t *src_pmd, struct vm_area_struct *vma,
642 unsigned long addr, unsigned long end) 642 unsigned long addr, unsigned long end)
643{ 643{
644 pte_t *orig_src_pte, *orig_dst_pte;
644 pte_t *src_pte, *dst_pte; 645 pte_t *src_pte, *dst_pte;
645 spinlock_t *src_ptl, *dst_ptl; 646 spinlock_t *src_ptl, *dst_ptl;
646 int progress = 0; 647 int progress = 0;
@@ -654,6 +655,8 @@ again:
654 src_pte = pte_offset_map_nested(src_pmd, addr); 655 src_pte = pte_offset_map_nested(src_pmd, addr);
655 src_ptl = pte_lockptr(src_mm, src_pmd); 656 src_ptl = pte_lockptr(src_mm, src_pmd);
656 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); 657 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
658 orig_src_pte = src_pte;
659 orig_dst_pte = dst_pte;
657 arch_enter_lazy_mmu_mode(); 660 arch_enter_lazy_mmu_mode();
658 661
659 do { 662 do {
@@ -677,9 +680,9 @@ again:
677 680
678 arch_leave_lazy_mmu_mode(); 681 arch_leave_lazy_mmu_mode();
679 spin_unlock(src_ptl); 682 spin_unlock(src_ptl);
680 pte_unmap_nested(src_pte - 1); 683 pte_unmap_nested(orig_src_pte);
681 add_mm_rss(dst_mm, rss[0], rss[1]); 684 add_mm_rss(dst_mm, rss[0], rss[1]);
682 pte_unmap_unlock(dst_pte - 1, dst_ptl); 685 pte_unmap_unlock(orig_dst_pte, dst_ptl);
683 cond_resched(); 686 cond_resched();
684 if (addr != end) 687 if (addr != end)
685 goto again; 688 goto again;
@@ -1820,10 +1823,10 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
1820 token = pmd_pgtable(*pmd); 1823 token = pmd_pgtable(*pmd);
1821 1824
1822 do { 1825 do {
1823 err = fn(pte, token, addr, data); 1826 err = fn(pte++, token, addr, data);
1824 if (err) 1827 if (err)
1825 break; 1828 break;
1826 } while (pte++, addr += PAGE_SIZE, addr != end); 1829 } while (addr += PAGE_SIZE, addr != end);
1827 1830
1828 arch_leave_lazy_mmu_mode(); 1831 arch_leave_lazy_mmu_mode();
1829 1832
@@ -2539,7 +2542,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2539 } else if (PageHWPoison(page)) { 2542 } else if (PageHWPoison(page)) {
2540 ret = VM_FAULT_HWPOISON; 2543 ret = VM_FAULT_HWPOISON;
2541 delayacct_clear_flag(DELAYACCT_PF_SWAPIN); 2544 delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
2542 goto out; 2545 goto out_release;
2543 } 2546 }
2544 2547
2545 lock_page(page); 2548 lock_page(page);
@@ -2611,6 +2614,7 @@ out_nomap:
2611 pte_unmap_unlock(page_table, ptl); 2614 pte_unmap_unlock(page_table, ptl);
2612out_page: 2615out_page:
2613 unlock_page(page); 2616 unlock_page(page);
2617out_release:
2614 page_cache_release(page); 2618 page_cache_release(page);
2615 return ret; 2619 return ret;
2616} 2620}
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 7dd9d9f80694..4545d5944243 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1024,7 +1024,7 @@ static long do_mbind(unsigned long start, unsigned long len,
1024 1024
1025 err = migrate_prep(); 1025 err = migrate_prep();
1026 if (err) 1026 if (err)
1027 return err; 1027 goto mpol_out;
1028 } 1028 }
1029 { 1029 {
1030 NODEMASK_SCRATCH(scratch); 1030 NODEMASK_SCRATCH(scratch);
@@ -1039,10 +1039,9 @@ static long do_mbind(unsigned long start, unsigned long len,
1039 err = -ENOMEM; 1039 err = -ENOMEM;
1040 NODEMASK_SCRATCH_FREE(scratch); 1040 NODEMASK_SCRATCH_FREE(scratch);
1041 } 1041 }
1042 if (err) { 1042 if (err)
1043 mpol_put(new); 1043 goto mpol_out;
1044 return err; 1044
1045 }
1046 vma = check_range(mm, start, end, nmask, 1045 vma = check_range(mm, start, end, nmask,
1047 flags | MPOL_MF_INVERT, &pagelist); 1046 flags | MPOL_MF_INVERT, &pagelist);
1048 1047
@@ -1058,9 +1057,11 @@ static long do_mbind(unsigned long start, unsigned long len,
1058 1057
1059 if (!err && nr_failed && (flags & MPOL_MF_STRICT)) 1058 if (!err && nr_failed && (flags & MPOL_MF_STRICT))
1060 err = -EIO; 1059 err = -EIO;
1061 } 1060 } else
1061 putback_lru_pages(&pagelist);
1062 1062
1063 up_write(&mm->mmap_sem); 1063 up_write(&mm->mmap_sem);
1064 mpol_out:
1064 mpol_put(new); 1065 mpol_put(new);
1065 return err; 1066 return err;
1066} 1067}
diff --git a/mm/nommu.c b/mm/nommu.c
index 5189b5aed8c0..9876fa0c3ad3 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1362,9 +1362,11 @@ share:
1362error_just_free: 1362error_just_free:
1363 up_write(&nommu_region_sem); 1363 up_write(&nommu_region_sem);
1364error: 1364error:
1365 fput(region->vm_file); 1365 if (region->vm_file)
1366 fput(region->vm_file);
1366 kmem_cache_free(vm_region_jar, region); 1367 kmem_cache_free(vm_region_jar, region);
1367 fput(vma->vm_file); 1368 if (vma->vm_file)
1369 fput(vma->vm_file);
1368 if (vma->vm_flags & VM_EXECUTABLE) 1370 if (vma->vm_flags & VM_EXECUTABLE)
1369 removed_exe_file_vma(vma->vm_mm); 1371 removed_exe_file_vma(vma->vm_mm);
1370 kmem_cache_free(vm_area_cachep, vma); 1372 kmem_cache_free(vm_area_cachep, vma);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bf720550b44d..cdcedf661616 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2183,7 +2183,7 @@ void show_free_areas(void)
2183 printk("active_anon:%lu inactive_anon:%lu isolated_anon:%lu\n" 2183 printk("active_anon:%lu inactive_anon:%lu isolated_anon:%lu\n"
2184 " active_file:%lu inactive_file:%lu isolated_file:%lu\n" 2184 " active_file:%lu inactive_file:%lu isolated_file:%lu\n"
2185 " unevictable:%lu" 2185 " unevictable:%lu"
2186 " dirty:%lu writeback:%lu unstable:%lu buffer:%lu\n" 2186 " dirty:%lu writeback:%lu unstable:%lu\n"
2187 " free:%lu slab_reclaimable:%lu slab_unreclaimable:%lu\n" 2187 " free:%lu slab_reclaimable:%lu slab_unreclaimable:%lu\n"
2188 " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n", 2188 " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n",
2189 global_page_state(NR_ACTIVE_ANON), 2189 global_page_state(NR_ACTIVE_ANON),
@@ -2196,7 +2196,6 @@ void show_free_areas(void)
2196 global_page_state(NR_FILE_DIRTY), 2196 global_page_state(NR_FILE_DIRTY),
2197 global_page_state(NR_WRITEBACK), 2197 global_page_state(NR_WRITEBACK),
2198 global_page_state(NR_UNSTABLE_NFS), 2198 global_page_state(NR_UNSTABLE_NFS),
2199 nr_blockdev_pages(),
2200 global_page_state(NR_FREE_PAGES), 2199 global_page_state(NR_FREE_PAGES),
2201 global_page_state(NR_SLAB_RECLAIMABLE), 2200 global_page_state(NR_SLAB_RECLAIMABLE),
2202 global_page_state(NR_SLAB_UNRECLAIMABLE), 2201 global_page_state(NR_SLAB_UNRECLAIMABLE),
diff --git a/mm/percpu.c b/mm/percpu.c
index 6af78c1ee704..d90797160c2a 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -153,7 +153,10 @@ static int pcpu_reserved_chunk_limit;
153 * 153 *
154 * During allocation, pcpu_alloc_mutex is kept locked all the time and 154 * During allocation, pcpu_alloc_mutex is kept locked all the time and
155 * pcpu_lock is grabbed and released as necessary. All actual memory 155 * pcpu_lock is grabbed and released as necessary. All actual memory
156 * allocations are done using GFP_KERNEL with pcpu_lock released. 156 * allocations are done using GFP_KERNEL with pcpu_lock released. In
157 * general, percpu memory can't be allocated with irq off but
158 * irqsave/restore are still used in alloc path so that it can be used
159 * from early init path - sched_init() specifically.
157 * 160 *
158 * Free path accesses and alters only the index data structures, so it 161 * Free path accesses and alters only the index data structures, so it
159 * can be safely called from atomic context. When memory needs to be 162 * can be safely called from atomic context. When memory needs to be
@@ -366,7 +369,7 @@ static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr)
366 * RETURNS: 369 * RETURNS:
367 * 0 if noop, 1 if successfully extended, -errno on failure. 370 * 0 if noop, 1 if successfully extended, -errno on failure.
368 */ 371 */
369static int pcpu_extend_area_map(struct pcpu_chunk *chunk) 372static int pcpu_extend_area_map(struct pcpu_chunk *chunk, unsigned long *flags)
370{ 373{
371 int new_alloc; 374 int new_alloc;
372 int *new; 375 int *new;
@@ -376,7 +379,7 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk)
376 if (chunk->map_alloc >= chunk->map_used + 2) 379 if (chunk->map_alloc >= chunk->map_used + 2)
377 return 0; 380 return 0;
378 381
379 spin_unlock_irq(&pcpu_lock); 382 spin_unlock_irqrestore(&pcpu_lock, *flags);
380 383
381 new_alloc = PCPU_DFL_MAP_ALLOC; 384 new_alloc = PCPU_DFL_MAP_ALLOC;
382 while (new_alloc < chunk->map_used + 2) 385 while (new_alloc < chunk->map_used + 2)
@@ -384,7 +387,7 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk)
384 387
385 new = pcpu_mem_alloc(new_alloc * sizeof(new[0])); 388 new = pcpu_mem_alloc(new_alloc * sizeof(new[0]));
386 if (!new) { 389 if (!new) {
387 spin_lock_irq(&pcpu_lock); 390 spin_lock_irqsave(&pcpu_lock, *flags);
388 return -ENOMEM; 391 return -ENOMEM;
389 } 392 }
390 393
@@ -393,7 +396,7 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk)
393 * could have happened inbetween, so map_used couldn't have 396 * could have happened inbetween, so map_used couldn't have
394 * grown. 397 * grown.
395 */ 398 */
396 spin_lock_irq(&pcpu_lock); 399 spin_lock_irqsave(&pcpu_lock, *flags);
397 BUG_ON(new_alloc < chunk->map_used + 2); 400 BUG_ON(new_alloc < chunk->map_used + 2);
398 401
399 size = chunk->map_alloc * sizeof(chunk->map[0]); 402 size = chunk->map_alloc * sizeof(chunk->map[0]);
@@ -1047,6 +1050,7 @@ static void *pcpu_alloc(size_t size, size_t align, bool reserved)
1047 struct pcpu_chunk *chunk; 1050 struct pcpu_chunk *chunk;
1048 const char *err; 1051 const char *err;
1049 int slot, off; 1052 int slot, off;
1053 unsigned long flags;
1050 1054
1051 if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) { 1055 if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
1052 WARN(true, "illegal size (%zu) or align (%zu) for " 1056 WARN(true, "illegal size (%zu) or align (%zu) for "
@@ -1055,13 +1059,13 @@ static void *pcpu_alloc(size_t size, size_t align, bool reserved)
1055 } 1059 }
1056 1060
1057 mutex_lock(&pcpu_alloc_mutex); 1061 mutex_lock(&pcpu_alloc_mutex);
1058 spin_lock_irq(&pcpu_lock); 1062 spin_lock_irqsave(&pcpu_lock, flags);
1059 1063
1060 /* serve reserved allocations from the reserved chunk if available */ 1064 /* serve reserved allocations from the reserved chunk if available */
1061 if (reserved && pcpu_reserved_chunk) { 1065 if (reserved && pcpu_reserved_chunk) {
1062 chunk = pcpu_reserved_chunk; 1066 chunk = pcpu_reserved_chunk;
1063 if (size > chunk->contig_hint || 1067 if (size > chunk->contig_hint ||
1064 pcpu_extend_area_map(chunk) < 0) { 1068 pcpu_extend_area_map(chunk, &flags) < 0) {
1065 err = "failed to extend area map of reserved chunk"; 1069 err = "failed to extend area map of reserved chunk";
1066 goto fail_unlock; 1070 goto fail_unlock;
1067 } 1071 }
@@ -1079,7 +1083,7 @@ restart:
1079 if (size > chunk->contig_hint) 1083 if (size > chunk->contig_hint)
1080 continue; 1084 continue;
1081 1085
1082 switch (pcpu_extend_area_map(chunk)) { 1086 switch (pcpu_extend_area_map(chunk, &flags)) {
1083 case 0: 1087 case 0:
1084 break; 1088 break;
1085 case 1: 1089 case 1:
@@ -1096,7 +1100,7 @@ restart:
1096 } 1100 }
1097 1101
1098 /* hmmm... no space left, create a new chunk */ 1102 /* hmmm... no space left, create a new chunk */
1099 spin_unlock_irq(&pcpu_lock); 1103 spin_unlock_irqrestore(&pcpu_lock, flags);
1100 1104
1101 chunk = alloc_pcpu_chunk(); 1105 chunk = alloc_pcpu_chunk();
1102 if (!chunk) { 1106 if (!chunk) {
@@ -1104,16 +1108,16 @@ restart:
1104 goto fail_unlock_mutex; 1108 goto fail_unlock_mutex;
1105 } 1109 }
1106 1110
1107 spin_lock_irq(&pcpu_lock); 1111 spin_lock_irqsave(&pcpu_lock, flags);
1108 pcpu_chunk_relocate(chunk, -1); 1112 pcpu_chunk_relocate(chunk, -1);
1109 goto restart; 1113 goto restart;
1110 1114
1111area_found: 1115area_found:
1112 spin_unlock_irq(&pcpu_lock); 1116 spin_unlock_irqrestore(&pcpu_lock, flags);
1113 1117
1114 /* populate, map and clear the area */ 1118 /* populate, map and clear the area */
1115 if (pcpu_populate_chunk(chunk, off, size)) { 1119 if (pcpu_populate_chunk(chunk, off, size)) {
1116 spin_lock_irq(&pcpu_lock); 1120 spin_lock_irqsave(&pcpu_lock, flags);
1117 pcpu_free_area(chunk, off); 1121 pcpu_free_area(chunk, off);
1118 err = "failed to populate"; 1122 err = "failed to populate";
1119 goto fail_unlock; 1123 goto fail_unlock;
@@ -1125,7 +1129,7 @@ area_found:
1125 return __addr_to_pcpu_ptr(chunk->base_addr + off); 1129 return __addr_to_pcpu_ptr(chunk->base_addr + off);
1126 1130
1127fail_unlock: 1131fail_unlock:
1128 spin_unlock_irq(&pcpu_lock); 1132 spin_unlock_irqrestore(&pcpu_lock, flags);
1129fail_unlock_mutex: 1133fail_unlock_mutex:
1130 mutex_unlock(&pcpu_alloc_mutex); 1134 mutex_unlock(&pcpu_alloc_mutex);
1131 if (warn_limit) { 1135 if (warn_limit) {
diff --git a/mm/swapfile.c b/mm/swapfile.c
index a1bc6b9af9a2..9c590eef7912 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1151,8 +1151,7 @@ static int try_to_unuse(unsigned int type)
1151 } else 1151 } else
1152 retval = unuse_mm(mm, entry, page); 1152 retval = unuse_mm(mm, entry, page);
1153 1153
1154 if (set_start_mm && 1154 if (set_start_mm && *swap_map < swcount) {
1155 swap_count(*swap_map) < swcount) {
1156 mmput(new_start_mm); 1155 mmput(new_start_mm);
1157 atomic_inc(&mm->mm_users); 1156 atomic_inc(&mm->mm_users);
1158 new_start_mm = mm; 1157 new_start_mm = mm;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 64e438898832..777af57fd8c8 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -544,6 +544,16 @@ redo:
544 */ 544 */
545 lru = LRU_UNEVICTABLE; 545 lru = LRU_UNEVICTABLE;
546 add_page_to_unevictable_list(page); 546 add_page_to_unevictable_list(page);
547 /*
548 * When racing with an mlock clearing (page is
549 * unlocked), make sure that if the other thread does
550 * not observe our setting of PG_lru and fails
551 * isolation, we see PG_mlocked cleared below and move
552 * the page back to the evictable list.
553 *
554 * The other side is TestClearPageMlocked().
555 */
556 smp_mb();
547 } 557 }
548 558
549 /* 559 /*
@@ -1088,7 +1098,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
1088 int lumpy_reclaim = 0; 1098 int lumpy_reclaim = 0;
1089 1099
1090 while (unlikely(too_many_isolated(zone, file, sc))) { 1100 while (unlikely(too_many_isolated(zone, file, sc))) {
1091 congestion_wait(WRITE, HZ/10); 1101 congestion_wait(BLK_RW_ASYNC, HZ/10);
1092 1102
1093 /* We are about to die and free our memory. Return now. */ 1103 /* We are about to die and free our memory. Return now. */
1094 if (fatal_signal_pending(current)) 1104 if (fatal_signal_pending(current))
@@ -1356,7 +1366,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
1356 * IO, plus JVM can create lots of anon VM_EXEC pages, 1366 * IO, plus JVM can create lots of anon VM_EXEC pages,
1357 * so we ignore them here. 1367 * so we ignore them here.
1358 */ 1368 */
1359 if ((vm_flags & VM_EXEC) && !PageAnon(page)) { 1369 if ((vm_flags & VM_EXEC) && page_is_file_cache(page)) {
1360 list_add(&page->lru, &l_active); 1370 list_add(&page->lru, &l_active);
1361 continue; 1371 continue;
1362 } 1372 }
diff --git a/net/9p/client.c b/net/9p/client.c
index 5bf5f227dbe0..8af95b2dddd6 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -582,11 +582,9 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
582 582
583 memset(&fid->qid, 0, sizeof(struct p9_qid)); 583 memset(&fid->qid, 0, sizeof(struct p9_qid));
584 fid->mode = -1; 584 fid->mode = -1;
585 fid->rdir_fpos = 0;
586 fid->uid = current_fsuid(); 585 fid->uid = current_fsuid();
587 fid->clnt = clnt; 586 fid->clnt = clnt;
588 fid->aux = NULL; 587 fid->rdir = NULL;
589
590 spin_lock_irqsave(&clnt->lock, flags); 588 spin_lock_irqsave(&clnt->lock, flags);
591 list_add(&fid->flist, &clnt->fidlist); 589 list_add(&fid->flist, &clnt->fidlist);
592 spin_unlock_irqrestore(&clnt->lock, flags); 590 spin_unlock_irqrestore(&clnt->lock, flags);
@@ -609,6 +607,7 @@ static void p9_fid_destroy(struct p9_fid *fid)
609 spin_lock_irqsave(&clnt->lock, flags); 607 spin_lock_irqsave(&clnt->lock, flags);
610 list_del(&fid->flist); 608 list_del(&fid->flist);
611 spin_unlock_irqrestore(&clnt->lock, flags); 609 spin_unlock_irqrestore(&clnt->lock, flags);
610 kfree(fid->rdir);
612 kfree(fid); 611 kfree(fid);
613} 612}
614 613
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index b2e07f0dd298..ea1e3daabefe 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -43,7 +43,6 @@
43#include <net/9p/transport.h> 43#include <net/9p/transport.h>
44#include <linux/scatterlist.h> 44#include <linux/scatterlist.h>
45#include <linux/virtio.h> 45#include <linux/virtio.h>
46#include <linux/virtio_ids.h>
47#include <linux/virtio_9p.h> 46#include <linux/virtio_9p.h>
48 47
49#define VIRTQUEUE_NUM 128 48#define VIRTQUEUE_NUM 128
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 7f939ce29801..2bc6f6a8de68 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -92,6 +92,8 @@ static void add_conn(struct work_struct *work)
92 92
93 dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); 93 dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
94 94
95 dev_set_drvdata(&conn->dev, conn);
96
95 if (device_add(&conn->dev) < 0) { 97 if (device_add(&conn->dev) < 0) {
96 BT_ERR("Failed to register connection device"); 98 BT_ERR("Failed to register connection device");
97 return; 99 return;
@@ -144,8 +146,6 @@ void hci_conn_init_sysfs(struct hci_conn *conn)
144 conn->dev.class = bt_class; 146 conn->dev.class = bt_class;
145 conn->dev.parent = &hdev->dev; 147 conn->dev.parent = &hdev->dev;
146 148
147 dev_set_drvdata(&conn->dev, conn);
148
149 device_initialize(&conn->dev); 149 device_initialize(&conn->dev);
150 150
151 INIT_WORK(&conn->work_add, add_conn); 151 INIT_WORK(&conn->work_add, add_conn);
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 555d9da1869b..77e9fb130adb 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -555,12 +555,12 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
555 555
556 conn->feat_mask = 0; 556 conn->feat_mask = 0;
557 557
558 setup_timer(&conn->info_timer, l2cap_info_timeout,
559 (unsigned long) conn);
560
561 spin_lock_init(&conn->lock); 558 spin_lock_init(&conn->lock);
562 rwlock_init(&conn->chan_list.lock); 559 rwlock_init(&conn->chan_list.lock);
563 560
561 setup_timer(&conn->info_timer, l2cap_info_timeout,
562 (unsigned long) conn);
563
564 conn->disc_reason = 0x13; 564 conn->disc_reason = 0x13;
565 565
566 return conn; 566 return conn;
@@ -783,6 +783,9 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
783 /* Default config options */ 783 /* Default config options */
784 pi->conf_len = 0; 784 pi->conf_len = 0;
785 pi->flush_to = L2CAP_DEFAULT_FLUSH_TO; 785 pi->flush_to = L2CAP_DEFAULT_FLUSH_TO;
786 skb_queue_head_init(TX_QUEUE(sk));
787 skb_queue_head_init(SREJ_QUEUE(sk));
788 INIT_LIST_HEAD(SREJ_LIST(sk));
786} 789}
787 790
788static struct proto l2cap_proto = { 791static struct proto l2cap_proto = {
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 1c6cf3a1a4f6..4ade3011bb3c 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -224,6 +224,15 @@ void skb_free_datagram(struct sock *sk, struct sk_buff *skb)
224 consume_skb(skb); 224 consume_skb(skb);
225 sk_mem_reclaim_partial(sk); 225 sk_mem_reclaim_partial(sk);
226} 226}
227EXPORT_SYMBOL(skb_free_datagram);
228
229void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb)
230{
231 lock_sock(sk);
232 skb_free_datagram(sk, skb);
233 release_sock(sk);
234}
235EXPORT_SYMBOL(skb_free_datagram_locked);
227 236
228/** 237/**
229 * skb_kill_datagram - Free a datagram skbuff forcibly 238 * skb_kill_datagram - Free a datagram skbuff forcibly
@@ -752,5 +761,4 @@ unsigned int datagram_poll(struct file *file, struct socket *sock,
752EXPORT_SYMBOL(datagram_poll); 761EXPORT_SYMBOL(datagram_poll);
753EXPORT_SYMBOL(skb_copy_and_csum_datagram_iovec); 762EXPORT_SYMBOL(skb_copy_and_csum_datagram_iovec);
754EXPORT_SYMBOL(skb_copy_datagram_iovec); 763EXPORT_SYMBOL(skb_copy_datagram_iovec);
755EXPORT_SYMBOL(skb_free_datagram);
756EXPORT_SYMBOL(skb_recv_datagram); 764EXPORT_SYMBOL(skb_recv_datagram);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 86acdba0a97d..6eb8d47cbf3a 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -335,6 +335,7 @@ struct pktgen_dev {
335 __u32 cur_src_mac_offset; 335 __u32 cur_src_mac_offset;
336 __be32 cur_saddr; 336 __be32 cur_saddr;
337 __be32 cur_daddr; 337 __be32 cur_daddr;
338 __u16 ip_id;
338 __u16 cur_udp_dst; 339 __u16 cur_udp_dst;
339 __u16 cur_udp_src; 340 __u16 cur_udp_src;
340 __u16 cur_queue_map; 341 __u16 cur_queue_map;
@@ -2630,6 +2631,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
2630 iph->protocol = IPPROTO_UDP; /* UDP */ 2631 iph->protocol = IPPROTO_UDP; /* UDP */
2631 iph->saddr = pkt_dev->cur_saddr; 2632 iph->saddr = pkt_dev->cur_saddr;
2632 iph->daddr = pkt_dev->cur_daddr; 2633 iph->daddr = pkt_dev->cur_daddr;
2634 iph->id = htons(pkt_dev->ip_id);
2635 pkt_dev->ip_id++;
2633 iph->frag_off = 0; 2636 iph->frag_off = 0;
2634 iplen = 20 + 8 + datalen; 2637 iplen = 20 + 8 + datalen;
2635 iph->tot_len = htons(iplen); 2638 iph->tot_len = htons(iplen);
@@ -2641,24 +2644,26 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
2641 skb->dev = odev; 2644 skb->dev = odev;
2642 skb->pkt_type = PACKET_HOST; 2645 skb->pkt_type = PACKET_HOST;
2643 2646
2644 if (pkt_dev->nfrags <= 0) 2647 if (pkt_dev->nfrags <= 0) {
2645 pgh = (struct pktgen_hdr *)skb_put(skb, datalen); 2648 pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
2646 else { 2649 memset(pgh + 1, 0, datalen - sizeof(struct pktgen_hdr));
2650 } else {
2647 int frags = pkt_dev->nfrags; 2651 int frags = pkt_dev->nfrags;
2648 int i; 2652 int i, len;
2649 2653
2650 pgh = (struct pktgen_hdr *)(((char *)(udph)) + 8); 2654 pgh = (struct pktgen_hdr *)(((char *)(udph)) + 8);
2651 2655
2652 if (frags > MAX_SKB_FRAGS) 2656 if (frags > MAX_SKB_FRAGS)
2653 frags = MAX_SKB_FRAGS; 2657 frags = MAX_SKB_FRAGS;
2654 if (datalen > frags * PAGE_SIZE) { 2658 if (datalen > frags * PAGE_SIZE) {
2655 skb_put(skb, datalen - frags * PAGE_SIZE); 2659 len = datalen - frags * PAGE_SIZE;
2660 memset(skb_put(skb, len), 0, len);
2656 datalen = frags * PAGE_SIZE; 2661 datalen = frags * PAGE_SIZE;
2657 } 2662 }
2658 2663
2659 i = 0; 2664 i = 0;
2660 while (datalen > 0) { 2665 while (datalen > 0) {
2661 struct page *page = alloc_pages(GFP_KERNEL, 0); 2666 struct page *page = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0);
2662 skb_shinfo(skb)->frags[i].page = page; 2667 skb_shinfo(skb)->frags[i].page = page;
2663 skb_shinfo(skb)->frags[i].page_offset = 0; 2668 skb_shinfo(skb)->frags[i].page_offset = 0;
2664 skb_shinfo(skb)->frags[i].size = 2669 skb_shinfo(skb)->frags[i].size =
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index e2f950592566..aa00398be80e 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -229,14 +229,17 @@ unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
229 */ 229 */
230 230
231int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 231int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
232 struct net_device *dev, __be32 *spec_dst, u32 *itag) 232 struct net_device *dev, __be32 *spec_dst,
233 u32 *itag, u32 mark)
233{ 234{
234 struct in_device *in_dev; 235 struct in_device *in_dev;
235 struct flowi fl = { .nl_u = { .ip4_u = 236 struct flowi fl = { .nl_u = { .ip4_u =
236 { .daddr = src, 237 { .daddr = src,
237 .saddr = dst, 238 .saddr = dst,
238 .tos = tos } }, 239 .tos = tos } },
240 .mark = mark,
239 .iif = oif }; 241 .iif = oif };
242
240 struct fib_result res; 243 struct fib_result res;
241 int no_addr, rpf; 244 int no_addr, rpf;
242 int ret; 245 int ret;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 4351ca2cf0b8..537731b3bcb3 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -446,6 +446,28 @@ extern int sysctl_tcp_synack_retries;
446 446
447EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); 447EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add);
448 448
449/* Decide when to expire the request and when to resend SYN-ACK */
450static inline void syn_ack_recalc(struct request_sock *req, const int thresh,
451 const int max_retries,
452 const u8 rskq_defer_accept,
453 int *expire, int *resend)
454{
455 if (!rskq_defer_accept) {
456 *expire = req->retrans >= thresh;
457 *resend = 1;
458 return;
459 }
460 *expire = req->retrans >= thresh &&
461 (!inet_rsk(req)->acked || req->retrans >= max_retries);
462 /*
463 * Do not resend while waiting for data after ACK,
464 * start to resend on end of deferring period to give
465 * last chance for data or ACK to create established socket.
466 */
467 *resend = !inet_rsk(req)->acked ||
468 req->retrans >= rskq_defer_accept - 1;
469}
470
449void inet_csk_reqsk_queue_prune(struct sock *parent, 471void inet_csk_reqsk_queue_prune(struct sock *parent,
450 const unsigned long interval, 472 const unsigned long interval,
451 const unsigned long timeout, 473 const unsigned long timeout,
@@ -501,9 +523,15 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
501 reqp=&lopt->syn_table[i]; 523 reqp=&lopt->syn_table[i];
502 while ((req = *reqp) != NULL) { 524 while ((req = *reqp) != NULL) {
503 if (time_after_eq(now, req->expires)) { 525 if (time_after_eq(now, req->expires)) {
504 if ((req->retrans < thresh || 526 int expire = 0, resend = 0;
505 (inet_rsk(req)->acked && req->retrans < max_retries)) 527
506 && !req->rsk_ops->rtx_syn_ack(parent, req)) { 528 syn_ack_recalc(req, thresh, max_retries,
529 queue->rskq_defer_accept,
530 &expire, &resend);
531 if (!expire &&
532 (!resend ||
533 !req->rsk_ops->rtx_syn_ack(parent, req) ||
534 inet_rsk(req)->acked)) {
507 unsigned long timeo; 535 unsigned long timeo;
508 536
509 if (req->retrans++ == 0) 537 if (req->retrans++ == 0)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 41ada9904d31..143333852624 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1464,7 +1464,7 @@ static void ipgre_tap_setup(struct net_device *dev)
1464 1464
1465 ether_setup(dev); 1465 ether_setup(dev);
1466 1466
1467 dev->netdev_ops = &ipgre_netdev_ops; 1467 dev->netdev_ops = &ipgre_tap_netdev_ops;
1468 dev->destructor = free_netdev; 1468 dev->destructor = free_netdev;
1469 1469
1470 dev->iflink = 0; 1470 dev->iflink = 0;
@@ -1525,25 +1525,29 @@ static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[],
1525 if (t->dev != dev) 1525 if (t->dev != dev)
1526 return -EEXIST; 1526 return -EEXIST;
1527 } else { 1527 } else {
1528 unsigned nflags = 0;
1529
1530 t = nt; 1528 t = nt;
1531 1529
1532 if (ipv4_is_multicast(p.iph.daddr)) 1530 if (dev->type != ARPHRD_ETHER) {
1533 nflags = IFF_BROADCAST; 1531 unsigned nflags = 0;
1534 else if (p.iph.daddr)
1535 nflags = IFF_POINTOPOINT;
1536 1532
1537 if ((dev->flags ^ nflags) & 1533 if (ipv4_is_multicast(p.iph.daddr))
1538 (IFF_POINTOPOINT | IFF_BROADCAST)) 1534 nflags = IFF_BROADCAST;
1539 return -EINVAL; 1535 else if (p.iph.daddr)
1536 nflags = IFF_POINTOPOINT;
1537
1538 if ((dev->flags ^ nflags) &
1539 (IFF_POINTOPOINT | IFF_BROADCAST))
1540 return -EINVAL;
1541 }
1540 1542
1541 ipgre_tunnel_unlink(ign, t); 1543 ipgre_tunnel_unlink(ign, t);
1542 t->parms.iph.saddr = p.iph.saddr; 1544 t->parms.iph.saddr = p.iph.saddr;
1543 t->parms.iph.daddr = p.iph.daddr; 1545 t->parms.iph.daddr = p.iph.daddr;
1544 t->parms.i_key = p.i_key; 1546 t->parms.i_key = p.i_key;
1545 memcpy(dev->dev_addr, &p.iph.saddr, 4); 1547 if (dev->type != ARPHRD_ETHER) {
1546 memcpy(dev->broadcast, &p.iph.daddr, 4); 1548 memcpy(dev->dev_addr, &p.iph.saddr, 4);
1549 memcpy(dev->broadcast, &p.iph.daddr, 4);
1550 }
1547 ipgre_tunnel_link(ign, t); 1551 ipgre_tunnel_link(ign, t);
1548 netdev_state_change(dev); 1552 netdev_state_change(dev);
1549 } 1553 }
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 0c0b6e363a20..e982b5c1ee17 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -634,17 +634,16 @@ static int do_ip_setsockopt(struct sock *sk, int level,
634 break; 634 break;
635 } 635 }
636 dev = ip_dev_find(sock_net(sk), mreq.imr_address.s_addr); 636 dev = ip_dev_find(sock_net(sk), mreq.imr_address.s_addr);
637 if (dev) { 637 if (dev)
638 mreq.imr_ifindex = dev->ifindex; 638 mreq.imr_ifindex = dev->ifindex;
639 dev_put(dev);
640 }
641 } else 639 } else
642 dev = __dev_get_by_index(sock_net(sk), mreq.imr_ifindex); 640 dev = dev_get_by_index(sock_net(sk), mreq.imr_ifindex);
643 641
644 642
645 err = -EADDRNOTAVAIL; 643 err = -EADDRNOTAVAIL;
646 if (!dev) 644 if (!dev)
647 break; 645 break;
646 dev_put(dev);
648 647
649 err = -EINVAL; 648 err = -EINVAL;
650 if (sk->sk_bound_dev_if && 649 if (sk->sk_bound_dev_if &&
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 757c9171e7c2..ab996f9c0fe0 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -352,13 +352,24 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
352 skb->ip_summed = CHECKSUM_NONE; 352 skb->ip_summed = CHECKSUM_NONE;
353 353
354 skb->transport_header = skb->network_header; 354 skb->transport_header = skb->network_header;
355 err = memcpy_fromiovecend((void *)iph, from, 0, length); 355 err = -EFAULT;
356 if (err) 356 if (memcpy_fromiovecend((void *)iph, from, 0, length))
357 goto error_fault; 357 goto error_free;
358 358
359 /* We don't modify invalid header */
360 iphlen = iph->ihl * 4; 359 iphlen = iph->ihl * 4;
361 if (iphlen >= sizeof(*iph) && iphlen <= length) { 360
361 /*
362 * We don't want to modify the ip header, but we do need to
363 * be sure that it won't cause problems later along the network
364 * stack. Specifically we want to make sure that iph->ihl is a
365 * sane value. If ihl points beyond the length of the buffer passed
366 * in, reject the frame as invalid
367 */
368 err = -EINVAL;
369 if (iphlen > length)
370 goto error_free;
371
372 if (iphlen >= sizeof(*iph)) {
362 if (!iph->saddr) 373 if (!iph->saddr)
363 iph->saddr = rt->rt_src; 374 iph->saddr = rt->rt_src;
364 iph->check = 0; 375 iph->check = 0;
@@ -381,8 +392,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
381out: 392out:
382 return 0; 393 return 0;
383 394
384error_fault: 395error_free:
385 err = -EFAULT;
386 kfree_skb(skb); 396 kfree_skb(skb);
387error: 397error:
388 IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); 398 IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index bb4199252026..5b1050a5d874 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1854,7 +1854,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1854 goto e_inval; 1854 goto e_inval;
1855 spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); 1855 spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
1856 } else if (fib_validate_source(saddr, 0, tos, 0, 1856 } else if (fib_validate_source(saddr, 0, tos, 0,
1857 dev, &spec_dst, &itag) < 0) 1857 dev, &spec_dst, &itag, 0) < 0)
1858 goto e_inval; 1858 goto e_inval;
1859 1859
1860 rth = dst_alloc(&ipv4_dst_ops); 1860 rth = dst_alloc(&ipv4_dst_ops);
@@ -1967,7 +1967,7 @@ static int __mkroute_input(struct sk_buff *skb,
1967 1967
1968 1968
1969 err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(*res), 1969 err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(*res),
1970 in_dev->dev, &spec_dst, &itag); 1970 in_dev->dev, &spec_dst, &itag, skb->mark);
1971 if (err < 0) { 1971 if (err < 0) {
1972 ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, 1972 ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
1973 saddr); 1973 saddr);
@@ -2141,7 +2141,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2141 int result; 2141 int result;
2142 result = fib_validate_source(saddr, daddr, tos, 2142 result = fib_validate_source(saddr, daddr, tos,
2143 net->loopback_dev->ifindex, 2143 net->loopback_dev->ifindex,
2144 dev, &spec_dst, &itag); 2144 dev, &spec_dst, &itag, skb->mark);
2145 if (result < 0) 2145 if (result < 0)
2146 goto martian_source; 2146 goto martian_source;
2147 if (result) 2147 if (result)
@@ -2170,7 +2170,7 @@ brd_input:
2170 spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); 2170 spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
2171 else { 2171 else {
2172 err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst, 2172 err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
2173 &itag); 2173 &itag, skb->mark);
2174 if (err < 0) 2174 if (err < 0)
2175 goto martian_source; 2175 goto martian_source;
2176 if (err) 2176 if (err)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 64d0af675823..98440ad82558 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -326,6 +326,43 @@ void tcp_enter_memory_pressure(struct sock *sk)
326 326
327EXPORT_SYMBOL(tcp_enter_memory_pressure); 327EXPORT_SYMBOL(tcp_enter_memory_pressure);
328 328
329/* Convert seconds to retransmits based on initial and max timeout */
330static u8 secs_to_retrans(int seconds, int timeout, int rto_max)
331{
332 u8 res = 0;
333
334 if (seconds > 0) {
335 int period = timeout;
336
337 res = 1;
338 while (seconds > period && res < 255) {
339 res++;
340 timeout <<= 1;
341 if (timeout > rto_max)
342 timeout = rto_max;
343 period += timeout;
344 }
345 }
346 return res;
347}
348
349/* Convert retransmits to seconds based on initial and max timeout */
350static int retrans_to_secs(u8 retrans, int timeout, int rto_max)
351{
352 int period = 0;
353
354 if (retrans > 0) {
355 period = timeout;
356 while (--retrans) {
357 timeout <<= 1;
358 if (timeout > rto_max)
359 timeout = rto_max;
360 period += timeout;
361 }
362 }
363 return period;
364}
365
329/* 366/*
330 * Wait for a TCP event. 367 * Wait for a TCP event.
331 * 368 *
@@ -1405,7 +1442,9 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1405 goto found_ok_skb; 1442 goto found_ok_skb;
1406 if (tcp_hdr(skb)->fin) 1443 if (tcp_hdr(skb)->fin)
1407 goto found_fin_ok; 1444 goto found_fin_ok;
1408 WARN_ON(!(flags & MSG_PEEK)); 1445 WARN(!(flags & MSG_PEEK), KERN_INFO "recvmsg bug 2: "
1446 "copied %X seq %X\n", *seq,
1447 TCP_SKB_CB(skb)->seq);
1409 } 1448 }
1410 1449
1411 /* Well, if we have backlog, try to process it now yet. */ 1450 /* Well, if we have backlog, try to process it now yet. */
@@ -2163,16 +2202,10 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2163 break; 2202 break;
2164 2203
2165 case TCP_DEFER_ACCEPT: 2204 case TCP_DEFER_ACCEPT:
2166 icsk->icsk_accept_queue.rskq_defer_accept = 0; 2205 /* Translate value in seconds to number of retransmits */
2167 if (val > 0) { 2206 icsk->icsk_accept_queue.rskq_defer_accept =
2168 /* Translate value in seconds to number of 2207 secs_to_retrans(val, TCP_TIMEOUT_INIT / HZ,
2169 * retransmits */ 2208 TCP_RTO_MAX / HZ);
2170 while (icsk->icsk_accept_queue.rskq_defer_accept < 32 &&
2171 val > ((TCP_TIMEOUT_INIT / HZ) <<
2172 icsk->icsk_accept_queue.rskq_defer_accept))
2173 icsk->icsk_accept_queue.rskq_defer_accept++;
2174 icsk->icsk_accept_queue.rskq_defer_accept++;
2175 }
2176 break; 2209 break;
2177 2210
2178 case TCP_WINDOW_CLAMP: 2211 case TCP_WINDOW_CLAMP:
@@ -2353,8 +2386,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
2353 val = (val ? : sysctl_tcp_fin_timeout) / HZ; 2386 val = (val ? : sysctl_tcp_fin_timeout) / HZ;
2354 break; 2387 break;
2355 case TCP_DEFER_ACCEPT: 2388 case TCP_DEFER_ACCEPT:
2356 val = !icsk->icsk_accept_queue.rskq_defer_accept ? 0 : 2389 val = retrans_to_secs(icsk->icsk_accept_queue.rskq_defer_accept,
2357 ((TCP_TIMEOUT_INIT / HZ) << (icsk->icsk_accept_queue.rskq_defer_accept - 1)); 2390 TCP_TIMEOUT_INIT / HZ, TCP_RTO_MAX / HZ);
2358 break; 2391 break;
2359 case TCP_WINDOW_CLAMP: 2392 case TCP_WINDOW_CLAMP:
2360 val = tp->window_clamp; 2393 val = tp->window_clamp;
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 624c3c9b3c2b..4c03598ed924 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -641,8 +641,8 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
641 if (!(flg & TCP_FLAG_ACK)) 641 if (!(flg & TCP_FLAG_ACK))
642 return NULL; 642 return NULL;
643 643
644 /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */ 644 /* While TCP_DEFER_ACCEPT is active, drop bare ACK. */
645 if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && 645 if (req->retrans < inet_csk(sk)->icsk_accept_queue.rskq_defer_accept &&
646 TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) { 646 TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) {
647 inet_rsk(req)->acked = 1; 647 inet_rsk(req)->acked = 1;
648 return NULL; 648 return NULL;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 6ec6a8a4a224..0fa9f70e4b19 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -841,6 +841,42 @@ out:
841 return ret; 841 return ret;
842} 842}
843 843
844
845/**
846 * first_packet_length - return length of first packet in receive queue
847 * @sk: socket
848 *
849 * Drops all bad checksum frames, until a valid one is found.
850 * Returns the length of found skb, or 0 if none is found.
851 */
852static unsigned int first_packet_length(struct sock *sk)
853{
854 struct sk_buff_head list_kill, *rcvq = &sk->sk_receive_queue;
855 struct sk_buff *skb;
856 unsigned int res;
857
858 __skb_queue_head_init(&list_kill);
859
860 spin_lock_bh(&rcvq->lock);
861 while ((skb = skb_peek(rcvq)) != NULL &&
862 udp_lib_checksum_complete(skb)) {
863 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS,
864 IS_UDPLITE(sk));
865 __skb_unlink(skb, rcvq);
866 __skb_queue_tail(&list_kill, skb);
867 }
868 res = skb ? skb->len : 0;
869 spin_unlock_bh(&rcvq->lock);
870
871 if (!skb_queue_empty(&list_kill)) {
872 lock_sock(sk);
873 __skb_queue_purge(&list_kill);
874 sk_mem_reclaim_partial(sk);
875 release_sock(sk);
876 }
877 return res;
878}
879
844/* 880/*
845 * IOCTL requests applicable to the UDP protocol 881 * IOCTL requests applicable to the UDP protocol
846 */ 882 */
@@ -857,21 +893,16 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
857 893
858 case SIOCINQ: 894 case SIOCINQ:
859 { 895 {
860 struct sk_buff *skb; 896 unsigned int amount = first_packet_length(sk);
861 unsigned long amount;
862 897
863 amount = 0; 898 if (amount)
864 spin_lock_bh(&sk->sk_receive_queue.lock);
865 skb = skb_peek(&sk->sk_receive_queue);
866 if (skb != NULL) {
867 /* 899 /*
868 * We will only return the amount 900 * We will only return the amount
869 * of this packet since that is all 901 * of this packet since that is all
870 * that will be read. 902 * that will be read.
871 */ 903 */
872 amount = skb->len - sizeof(struct udphdr); 904 amount -= sizeof(struct udphdr);
873 } 905
874 spin_unlock_bh(&sk->sk_receive_queue.lock);
875 return put_user(amount, (int __user *)arg); 906 return put_user(amount, (int __user *)arg);
876 } 907 }
877 908
@@ -968,9 +999,7 @@ try_again:
968 err = ulen; 999 err = ulen;
969 1000
970out_free: 1001out_free:
971 lock_sock(sk); 1002 skb_free_datagram_locked(sk, skb);
972 skb_free_datagram(sk, skb);
973 release_sock(sk);
974out: 1003out:
975 return err; 1004 return err;
976 1005
@@ -1540,29 +1569,11 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
1540{ 1569{
1541 unsigned int mask = datagram_poll(file, sock, wait); 1570 unsigned int mask = datagram_poll(file, sock, wait);
1542 struct sock *sk = sock->sk; 1571 struct sock *sk = sock->sk;
1543 int is_lite = IS_UDPLITE(sk);
1544 1572
1545 /* Check for false positives due to checksum errors */ 1573 /* Check for false positives due to checksum errors */
1546 if ((mask & POLLRDNORM) && 1574 if ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) &&
1547 !(file->f_flags & O_NONBLOCK) && 1575 !(sk->sk_shutdown & RCV_SHUTDOWN) && !first_packet_length(sk))
1548 !(sk->sk_shutdown & RCV_SHUTDOWN)) { 1576 mask &= ~(POLLIN | POLLRDNORM);
1549 struct sk_buff_head *rcvq = &sk->sk_receive_queue;
1550 struct sk_buff *skb;
1551
1552 spin_lock_bh(&rcvq->lock);
1553 while ((skb = skb_peek(rcvq)) != NULL &&
1554 udp_lib_checksum_complete(skb)) {
1555 UDP_INC_STATS_BH(sock_net(sk),
1556 UDP_MIB_INERRORS, is_lite);
1557 __skb_unlink(skb, rcvq);
1558 kfree_skb(skb);
1559 }
1560 spin_unlock_bh(&rcvq->lock);
1561
1562 /* nothing to see, move along */
1563 if (skb == NULL)
1564 mask &= ~(POLLIN | POLLRDNORM);
1565 }
1566 1577
1567 return mask; 1578 return mask;
1568 1579
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 14f54eb5a7fc..4f7aaf6996a3 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -496,13 +496,17 @@ done:
496 goto e_inval; 496 goto e_inval;
497 497
498 if (val) { 498 if (val) {
499 struct net_device *dev;
500
499 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val) 501 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val)
500 goto e_inval; 502 goto e_inval;
501 503
502 if (__dev_get_by_index(net, val) == NULL) { 504 dev = dev_get_by_index(net, val);
505 if (!dev) {
503 retv = -ENODEV; 506 retv = -ENODEV;
504 break; 507 break;
505 } 508 }
509 dev_put(dev);
506 } 510 }
507 np->mcast_oif = val; 511 np->mcast_oif = val;
508 retv = 0; 512 retv = 0;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 3a60f12b34ed..cf538ed5ef6a 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -288,9 +288,7 @@ try_again:
288 err = ulen; 288 err = ulen;
289 289
290out_free: 290out_free:
291 lock_sock(sk); 291 skb_free_datagram_locked(sk, skb);
292 skb_free_datagram(sk, skb);
293 release_sock(sk);
294out: 292out:
295 return err; 293 return err;
296 294
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index bd765f30dba2..b09948ceec4a 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -666,26 +666,25 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
666 666
667 state = &sta->ampdu_mlme.tid_state_tx[tid]; 667 state = &sta->ampdu_mlme.tid_state_tx[tid];
668 668
669 del_timer_sync(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
670
669 spin_lock_bh(&sta->lock); 671 spin_lock_bh(&sta->lock);
670 672
671 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 673 if (!(*state & HT_ADDBA_REQUESTED_MSK))
672 spin_unlock_bh(&sta->lock); 674 goto timer_still_needed;
673 return;
674 }
675 675
676 if (mgmt->u.action.u.addba_resp.dialog_token != 676 if (mgmt->u.action.u.addba_resp.dialog_token !=
677 sta->ampdu_mlme.tid_tx[tid]->dialog_token) { 677 sta->ampdu_mlme.tid_tx[tid]->dialog_token) {
678 spin_unlock_bh(&sta->lock);
679#ifdef CONFIG_MAC80211_HT_DEBUG 678#ifdef CONFIG_MAC80211_HT_DEBUG
680 printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid); 679 printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid);
681#endif /* CONFIG_MAC80211_HT_DEBUG */ 680#endif /* CONFIG_MAC80211_HT_DEBUG */
682 return; 681 goto timer_still_needed;
683 } 682 }
684 683
685 del_timer_sync(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
686#ifdef CONFIG_MAC80211_HT_DEBUG 684#ifdef CONFIG_MAC80211_HT_DEBUG
687 printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid); 685 printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid);
688#endif /* CONFIG_MAC80211_HT_DEBUG */ 686#endif /* CONFIG_MAC80211_HT_DEBUG */
687
689 if (le16_to_cpu(mgmt->u.action.u.addba_resp.status) 688 if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
690 == WLAN_STATUS_SUCCESS) { 689 == WLAN_STATUS_SUCCESS) {
691 u8 curstate = *state; 690 u8 curstate = *state;
@@ -699,5 +698,11 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
699 } else { 698 } else {
700 ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR); 699 ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR);
701 } 700 }
701
702 goto out;
703
704 timer_still_needed:
705 add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
706 out:
702 spin_unlock_bh(&sta->lock); 707 spin_unlock_bh(&sta->lock);
703} 708}
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5608f6c68413..7b5131bd6fa1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -72,6 +72,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
72 struct ieee80211_sub_if_data *sdata; 72 struct ieee80211_sub_if_data *sdata;
73 int ret; 73 int ret;
74 74
75 if (netif_running(dev))
76 return -EBUSY;
77
75 if (!nl80211_type_check(type)) 78 if (!nl80211_type_check(type))
76 return -EINVAL; 79 return -EINVAL;
77 80
@@ -81,9 +84,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
81 if (ret) 84 if (ret)
82 return ret; 85 return ret;
83 86
84 if (netif_running(sdata->dev))
85 return -EBUSY;
86
87 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) 87 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
88 ieee80211_sdata_set_mesh_id(sdata, 88 ieee80211_sdata_set_mesh_id(sdata,
89 params->mesh_id_len, 89 params->mesh_id_len,
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 0891bfb06996..48ef1a282b91 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -153,7 +153,7 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
153 if (net_ratelimit()) 153 if (net_ratelimit())
154 printk(KERN_DEBUG "delba from %pM (%s) tid %d reason code %d\n", 154 printk(KERN_DEBUG "delba from %pM (%s) tid %d reason code %d\n",
155 mgmt->sa, initiator ? "initiator" : "recipient", tid, 155 mgmt->sa, initiator ? "initiator" : "recipient", tid,
156 mgmt->u.action.u.delba.reason_code); 156 le16_to_cpu(mgmt->u.action.u.delba.reason_code));
157#endif /* CONFIG_MAC80211_HT_DEBUG */ 157#endif /* CONFIG_MAC80211_HT_DEBUG */
158 158
159 if (initiator == WLAN_BACK_INITIATOR) 159 if (initiator == WLAN_BACK_INITIATOR)
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 920ec8792f4b..f1362f32c17d 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -73,6 +73,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
73 struct ieee80211_mgmt *mgmt; 73 struct ieee80211_mgmt *mgmt;
74 u8 *pos; 74 u8 *pos;
75 struct ieee80211_supported_band *sband; 75 struct ieee80211_supported_band *sband;
76 struct cfg80211_bss *bss;
76 u32 bss_change; 77 u32 bss_change;
77 u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 78 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
78 79
@@ -177,8 +178,9 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
177 mod_timer(&ifibss->timer, 178 mod_timer(&ifibss->timer,
178 round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); 179 round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL));
179 180
180 cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel, 181 bss = cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel,
181 mgmt, skb->len, 0, GFP_KERNEL); 182 mgmt, skb->len, 0, GFP_KERNEL);
183 cfg80211_put_bss(bss);
182 cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL); 184 cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL);
183} 185}
184 186
@@ -538,13 +540,12 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
538 WLAN_CAPABILITY_PRIVACY, 540 WLAN_CAPABILITY_PRIVACY,
539 capability); 541 capability);
540 542
543 if (bss) {
541#ifdef CONFIG_MAC80211_IBSS_DEBUG 544#ifdef CONFIG_MAC80211_IBSS_DEBUG
542 if (bss)
543 printk(KERN_DEBUG " sta_find_ibss: selected %pM current " 545 printk(KERN_DEBUG " sta_find_ibss: selected %pM current "
544 "%pM\n", bss->cbss.bssid, ifibss->bssid); 546 "%pM\n", bss->cbss.bssid, ifibss->bssid);
545#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 547#endif /* CONFIG_MAC80211_IBSS_DEBUG */
546 548
547 if (bss && memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) {
548 printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" 549 printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
549 " based on configured SSID\n", 550 " based on configured SSID\n",
550 sdata->dev->name, bss->cbss.bssid); 551 sdata->dev->name, bss->cbss.bssid);
@@ -552,8 +553,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
552 ieee80211_sta_join_ibss(sdata, bss); 553 ieee80211_sta_join_ibss(sdata, bss);
553 ieee80211_rx_bss_put(local, bss); 554 ieee80211_rx_bss_put(local, bss);
554 return; 555 return;
555 } else if (bss) 556 }
556 ieee80211_rx_bss_put(local, bss);
557 557
558#ifdef CONFIG_MAC80211_IBSS_DEBUG 558#ifdef CONFIG_MAC80211_IBSS_DEBUG
559 printk(KERN_DEBUG " did not try to join ibss\n"); 559 printk(KERN_DEBUG " did not try to join ibss\n");
@@ -829,7 +829,7 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local)
829 if (!sdata->u.ibss.ssid_len) 829 if (!sdata->u.ibss.ssid_len)
830 continue; 830 continue;
831 sdata->u.ibss.last_scan_completed = jiffies; 831 sdata->u.ibss.last_scan_completed = jiffies;
832 ieee80211_sta_find_ibss(sdata); 832 mod_timer(&sdata->u.ibss.timer, 0);
833 } 833 }
834 mutex_unlock(&local->iflist_mtx); 834 mutex_unlock(&local->iflist_mtx);
835} 835}
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index e12a786e26b8..29b82e98effa 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -259,7 +259,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
259 * @hwmp_ie: hwmp information element (PREP or PREQ) 259 * @hwmp_ie: hwmp information element (PREP or PREQ)
260 * 260 *
261 * This function updates the path routing information to the originator and the 261 * This function updates the path routing information to the originator and the
262 * transmitter of a HWMP PREQ or PREP fram. 262 * transmitter of a HWMP PREQ or PREP frame.
263 * 263 *
264 * Returns: metric to frame originator or 0 if the frame should not be further 264 * Returns: metric to frame originator or 0 if the frame should not be further
265 * processed 265 * processed
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 8d26e9bf8964..dc5049d58c51 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1457,8 +1457,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1457 if (status_code != WLAN_STATUS_SUCCESS) { 1457 if (status_code != WLAN_STATUS_SUCCESS) {
1458 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", 1458 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
1459 sdata->dev->name, status_code); 1459 sdata->dev->name, status_code);
1460 list_del(&wk->list); 1460 wk->state = IEEE80211_MGD_STATE_IDLE;
1461 kfree(wk);
1462 return RX_MGMT_CFG80211_ASSOC; 1461 return RX_MGMT_CFG80211_ASSOC;
1463 } 1462 }
1464 1463
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index c01588f9d453..7170bf4565a8 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2164,11 +2164,17 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
2164 2164
2165 skb = rx.skb; 2165 skb = rx.skb;
2166 2166
2167 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 2167 if (rx.sdata && ieee80211_is_data(hdr->frame_control)) {
2168 rx.flags |= IEEE80211_RX_RA_MATCH;
2169 prepares = prepare_for_handlers(rx.sdata, &rx, hdr);
2170 if (prepares)
2171 prev = rx.sdata;
2172 } else list_for_each_entry_rcu(sdata, &local->interfaces, list) {
2168 if (!netif_running(sdata->dev)) 2173 if (!netif_running(sdata->dev))
2169 continue; 2174 continue;
2170 2175
2171 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) 2176 if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2177 sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2172 continue; 2178 continue;
2173 2179
2174 rx.flags |= IEEE80211_RX_RA_MATCH; 2180 rx.flags |= IEEE80211_RX_RA_MATCH;
@@ -2447,6 +2453,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
2447 struct ieee80211_supported_band *sband; 2453 struct ieee80211_supported_band *sband;
2448 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 2454 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
2449 2455
2456 WARN_ON_ONCE(softirq_count() == 0);
2457
2450 if (WARN_ON(status->band < 0 || 2458 if (WARN_ON(status->band < 0 ||
2451 status->band >= IEEE80211_NUM_BANDS)) 2459 status->band >= IEEE80211_NUM_BANDS))
2452 goto drop; 2460 goto drop;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index eec001491e66..594f2318c3d8 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -361,6 +361,7 @@ int sta_info_insert(struct sta_info *sta)
361 u.ap); 361 u.ap);
362 362
363 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta); 363 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta);
364 sdata = sta->sdata;
364 } 365 }
365 366
366#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 367#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -496,6 +497,7 @@ static void __sta_info_unlink(struct sta_info **sta)
496 497
497 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE, 498 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE,
498 &(*sta)->sta); 499 &(*sta)->sta);
500 sdata = (*sta)->sdata;
499 } 501 }
500 502
501 if (ieee80211_vif_is_mesh(&sdata->vif)) { 503 if (ieee80211_vif_is_mesh(&sdata->vif)) {
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index fd4028296613..eaa4118de988 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1445,7 +1445,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1445 if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) 1445 if (tmp_sdata->vif.type != NL80211_IFTYPE_AP)
1446 continue; 1446 continue;
1447 if (compare_ether_addr(tmp_sdata->dev->dev_addr, 1447 if (compare_ether_addr(tmp_sdata->dev->dev_addr,
1448 hdr->addr2)) { 1448 hdr->addr2) == 0) {
1449 dev_hold(tmp_sdata->dev); 1449 dev_hold(tmp_sdata->dev);
1450 dev_put(sdata->dev); 1450 dev_put(sdata->dev);
1451 sdata = tmp_sdata; 1451 sdata = tmp_sdata;
@@ -1704,7 +1704,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1704 if (!is_multicast_ether_addr(hdr.addr1)) { 1704 if (!is_multicast_ether_addr(hdr.addr1)) {
1705 rcu_read_lock(); 1705 rcu_read_lock();
1706 sta = sta_info_get(local, hdr.addr1); 1706 sta = sta_info_get(local, hdr.addr1);
1707 if (sta) 1707 /* XXX: in the future, use sdata to look up the sta */
1708 if (sta && sta->sdata == sdata)
1708 sta_flags = get_sta_flags(sta); 1709 sta_flags = get_sta_flags(sta);
1709 rcu_read_unlock(); 1710 rcu_read_unlock();
1710 } 1711 }
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index dd6564321369..aeb65b3d2295 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -339,7 +339,7 @@ void ieee80211_add_pending_skb(struct ieee80211_local *local,
339 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 339 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
340 340
341 if (WARN_ON(!info->control.vif)) { 341 if (WARN_ON(!info->control.vif)) {
342 kfree(skb); 342 kfree_skb(skb);
343 return; 343 return;
344 } 344 }
345 345
@@ -367,7 +367,7 @@ int ieee80211_add_pending_skbs(struct ieee80211_local *local,
367 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 367 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
368 368
369 if (WARN_ON(!info->control.vif)) { 369 if (WARN_ON(!info->control.vif)) {
370 kfree(skb); 370 kfree_skb(skb);
371 continue; 371 continue;
372 } 372 }
373 373
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d7ecca0a0c07..f2d116a5cb35 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -982,10 +982,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
982 goto out_put; 982 goto out_put;
983 983
984 size_max = po->tx_ring.frame_size 984 size_max = po->tx_ring.frame_size
985 - sizeof(struct skb_shared_info) 985 - (po->tp_hdrlen - sizeof(struct sockaddr_ll));
986 - po->tp_hdrlen
987 - LL_ALLOCATED_SPACE(dev)
988 - sizeof(struct sockaddr_ll);
989 986
990 if (size_max > dev->mtu + reserve) 987 if (size_max > dev->mtu + reserve)
991 size_max = dev->mtu + reserve; 988 size_max = dev->mtu + reserve;
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 96c0ed115e2a..6b0359a500e6 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -34,7 +34,7 @@ static struct tcf_hashinfo pedit_hash_info = {
34}; 34};
35 35
36static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = { 36static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = {
37 [TCA_PEDIT_PARMS] = { .len = sizeof(struct tcf_pedit) }, 37 [TCA_PEDIT_PARMS] = { .len = sizeof(struct tc_pedit) },
38}; 38};
39 39
40static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est, 40static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est,
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 6a536949cdc0..7cf6c0fbc7a6 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -350,7 +350,7 @@ static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp,
350 tcm = NLMSG_DATA(nlh); 350 tcm = NLMSG_DATA(nlh);
351 tcm->tcm_family = AF_UNSPEC; 351 tcm->tcm_family = AF_UNSPEC;
352 tcm->tcm__pad1 = 0; 352 tcm->tcm__pad1 = 0;
353 tcm->tcm__pad1 = 0; 353 tcm->tcm__pad2 = 0;
354 tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex; 354 tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex;
355 tcm->tcm_parent = tp->classid; 355 tcm->tcm_parent = tp->classid;
356 tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol); 356 tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol);
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index ccc5e83cae5d..1c246a4f491e 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -111,7 +111,7 @@ static void svc_release_skb(struct svc_rqst *rqstp)
111 rqstp->rq_xprt_ctxt = NULL; 111 rqstp->rq_xprt_ctxt = NULL;
112 112
113 dprintk("svc: service %p, releasing skb %p\n", rqstp, skb); 113 dprintk("svc: service %p, releasing skb %p\n", rqstp, skb);
114 skb_free_datagram(svsk->sk_sk, skb); 114 skb_free_datagram_locked(svsk->sk_sk, skb);
115 } 115 }
116} 116}
117 117
@@ -578,7 +578,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
578 "svc: received unknown control message %d/%d; " 578 "svc: received unknown control message %d/%d; "
579 "dropping RPC reply datagram\n", 579 "dropping RPC reply datagram\n",
580 cmh->cmsg_level, cmh->cmsg_type); 580 cmh->cmsg_level, cmh->cmsg_type);
581 skb_free_datagram(svsk->sk_sk, skb); 581 skb_free_datagram_locked(svsk->sk_sk, skb);
582 return 0; 582 return 0;
583 } 583 }
584 584
@@ -588,18 +588,18 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
588 if (csum_partial_copy_to_xdr(&rqstp->rq_arg, skb)) { 588 if (csum_partial_copy_to_xdr(&rqstp->rq_arg, skb)) {
589 local_bh_enable(); 589 local_bh_enable();
590 /* checksum error */ 590 /* checksum error */
591 skb_free_datagram(svsk->sk_sk, skb); 591 skb_free_datagram_locked(svsk->sk_sk, skb);
592 return 0; 592 return 0;
593 } 593 }
594 local_bh_enable(); 594 local_bh_enable();
595 skb_free_datagram(svsk->sk_sk, skb); 595 skb_free_datagram_locked(svsk->sk_sk, skb);
596 } else { 596 } else {
597 /* we can use it in-place */ 597 /* we can use it in-place */
598 rqstp->rq_arg.head[0].iov_base = skb->data + 598 rqstp->rq_arg.head[0].iov_base = skb->data +
599 sizeof(struct udphdr); 599 sizeof(struct udphdr);
600 rqstp->rq_arg.head[0].iov_len = len; 600 rqstp->rq_arg.head[0].iov_len = len;
601 if (skb_checksum_complete(skb)) { 601 if (skb_checksum_complete(skb)) {
602 skb_free_datagram(svsk->sk_sk, skb); 602 skb_free_datagram_locked(svsk->sk_sk, skb);
603 return 0; 603 return 0;
604 } 604 }
605 rqstp->rq_xprt_ctxt = skb; 605 rqstp->rq_xprt_ctxt = skb;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 51ab497115eb..fc820cd75453 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1074,6 +1074,8 @@ restart:
1074 err = -ECONNREFUSED; 1074 err = -ECONNREFUSED;
1075 if (other->sk_state != TCP_LISTEN) 1075 if (other->sk_state != TCP_LISTEN)
1076 goto out_unlock; 1076 goto out_unlock;
1077 if (other->sk_shutdown & RCV_SHUTDOWN)
1078 goto out_unlock;
1077 1079
1078 if (unix_recvq_full(other)) { 1080 if (unix_recvq_full(other)) {
1079 err = -EAGAIN; 1081 err = -EAGAIN;
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 2a33d8bc886b..68b321997d4c 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -358,6 +358,7 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
358 struct wireless_dev *wdev); 358 struct wireless_dev *wdev);
359 359
360void cfg80211_conn_work(struct work_struct *work); 360void cfg80211_conn_work(struct work_struct *work);
361void cfg80211_sme_failed_assoc(struct wireless_dev *wdev);
361bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev); 362bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev);
362 363
363/* internal helpers */ 364/* internal helpers */
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 79d2eec54cec..0a6b7a0eca6b 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -62,6 +62,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
62 u8 *ie = mgmt->u.assoc_resp.variable; 62 u8 *ie = mgmt->u.assoc_resp.variable;
63 int i, ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); 63 int i, ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
64 struct cfg80211_internal_bss *bss = NULL; 64 struct cfg80211_internal_bss *bss = NULL;
65 bool need_connect_result = true;
65 66
66 wdev_lock(wdev); 67 wdev_lock(wdev);
67 68
@@ -94,6 +95,14 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
94 } 95 }
95 96
96 WARN_ON(!bss); 97 WARN_ON(!bss);
98 } else if (wdev->conn) {
99 cfg80211_sme_failed_assoc(wdev);
100 need_connect_result = false;
101 /*
102 * do not call connect_result() now because the
103 * sme will schedule work that does it later.
104 */
105 goto out;
97 } 106 }
98 107
99 if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) { 108 if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index eddab097435c..ca3c92a0a14f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4029,7 +4029,7 @@ static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info)
4029 rdev = cfg80211_get_dev_from_info(info); 4029 rdev = cfg80211_get_dev_from_info(info);
4030 if (IS_ERR(rdev)) { 4030 if (IS_ERR(rdev)) {
4031 err = PTR_ERR(rdev); 4031 err = PTR_ERR(rdev);
4032 goto out; 4032 goto out_rtnl;
4033 } 4033 }
4034 4034
4035 net = get_net_ns_by_pid(pid); 4035 net = get_net_ns_by_pid(pid);
@@ -4049,6 +4049,7 @@ static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info)
4049 put_net(net); 4049 put_net(net);
4050 out: 4050 out:
4051 cfg80211_unlock_rdev(rdev); 4051 cfg80211_unlock_rdev(rdev);
4052 out_rtnl:
4052 rtnl_unlock(); 4053 rtnl_unlock();
4053 return err; 4054 return err;
4054} 4055}
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 93c3ed329204..9f0b2800a9d7 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -26,6 +26,7 @@ struct cfg80211_conn {
26 CFG80211_CONN_AUTHENTICATING, 26 CFG80211_CONN_AUTHENTICATING,
27 CFG80211_CONN_ASSOCIATE_NEXT, 27 CFG80211_CONN_ASSOCIATE_NEXT,
28 CFG80211_CONN_ASSOCIATING, 28 CFG80211_CONN_ASSOCIATING,
29 CFG80211_CONN_DEAUTH_ASSOC_FAIL,
29 } state; 30 } state;
30 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 31 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
31 u8 *ie; 32 u8 *ie;
@@ -148,6 +149,12 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
148 NULL, 0, 149 NULL, 0,
149 WLAN_REASON_DEAUTH_LEAVING); 150 WLAN_REASON_DEAUTH_LEAVING);
150 return err; 151 return err;
152 case CFG80211_CONN_DEAUTH_ASSOC_FAIL:
153 __cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
154 NULL, 0,
155 WLAN_REASON_DEAUTH_LEAVING);
156 /* return an error so that we call __cfg80211_connect_result() */
157 return -EINVAL;
151 default: 158 default:
152 return 0; 159 return 0;
153 } 160 }
@@ -158,6 +165,7 @@ void cfg80211_conn_work(struct work_struct *work)
158 struct cfg80211_registered_device *rdev = 165 struct cfg80211_registered_device *rdev =
159 container_of(work, struct cfg80211_registered_device, conn_work); 166 container_of(work, struct cfg80211_registered_device, conn_work);
160 struct wireless_dev *wdev; 167 struct wireless_dev *wdev;
168 u8 bssid_buf[ETH_ALEN], *bssid = NULL;
161 169
162 rtnl_lock(); 170 rtnl_lock();
163 cfg80211_lock_rdev(rdev); 171 cfg80211_lock_rdev(rdev);
@@ -173,10 +181,13 @@ void cfg80211_conn_work(struct work_struct *work)
173 wdev_unlock(wdev); 181 wdev_unlock(wdev);
174 continue; 182 continue;
175 } 183 }
184 if (wdev->conn->params.bssid) {
185 memcpy(bssid_buf, wdev->conn->params.bssid, ETH_ALEN);
186 bssid = bssid_buf;
187 }
176 if (cfg80211_conn_do_work(wdev)) 188 if (cfg80211_conn_do_work(wdev))
177 __cfg80211_connect_result( 189 __cfg80211_connect_result(
178 wdev->netdev, 190 wdev->netdev, bssid,
179 wdev->conn->params.bssid,
180 NULL, 0, NULL, 0, 191 NULL, 0, NULL, 0,
181 WLAN_STATUS_UNSPECIFIED_FAILURE, 192 WLAN_STATUS_UNSPECIFIED_FAILURE,
182 false, NULL); 193 false, NULL);
@@ -337,6 +348,15 @@ bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev)
337 return true; 348 return true;
338} 349}
339 350
351void cfg80211_sme_failed_assoc(struct wireless_dev *wdev)
352{
353 struct wiphy *wiphy = wdev->wiphy;
354 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
355
356 wdev->conn->state = CFG80211_CONN_DEAUTH_ASSOC_FAIL;
357 schedule_work(&rdev->conn_work);
358}
359
340void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 360void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
341 const u8 *req_ie, size_t req_ie_len, 361 const u8 *req_ie, size_t req_ie_len,
342 const u8 *resp_ie, size_t resp_ie_len, 362 const u8 *resp_ie, size_t resp_ie_len,
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 87bbb8bce9bf..bc4114f1ab30 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2,7 +2,7 @@
2# (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit) 2# (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit)
3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) 3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
4# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) 4# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
5# (c) 2008, Andy Whitcroft <apw@canonical.com> 5# (c) 2008,2009, Andy Whitcroft <apw@canonical.com>
6# Licensed under the terms of the GNU GPL License version 2 6# Licensed under the terms of the GNU GPL License version 2
7 7
8use strict; 8use strict;
@@ -10,7 +10,7 @@ use strict;
10my $P = $0; 10my $P = $0;
11$P =~ s@.*/@@g; 11$P =~ s@.*/@@g;
12 12
13my $V = '0.29'; 13my $V = '0.30';
14 14
15use Getopt::Long qw(:config no_auto_abbrev); 15use Getopt::Long qw(:config no_auto_abbrev);
16 16
@@ -130,7 +130,10 @@ if ($tree) {
130 130
131my $emitted_corrupt = 0; 131my $emitted_corrupt = 0;
132 132
133our $Ident = qr{[A-Za-z_][A-Za-z\d_]*}; 133our $Ident = qr{
134 [A-Za-z_][A-Za-z\d_]*
135 (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
136 }x;
134our $Storage = qr{extern|static|asmlinkage}; 137our $Storage = qr{extern|static|asmlinkage};
135our $Sparse = qr{ 138our $Sparse = qr{
136 __user| 139 __user|
@@ -997,23 +1000,25 @@ sub annotate_values {
997 1000
998sub possible { 1001sub possible {
999 my ($possible, $line) = @_; 1002 my ($possible, $line) = @_;
1000 1003 my $notPermitted = qr{(?:
1001 print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
1002 if ($possible !~ /(?:
1003 ^(?: 1004 ^(?:
1004 $Modifier| 1005 $Modifier|
1005 $Storage| 1006 $Storage|
1006 $Type| 1007 $Type|
1007 DEFINE_\S+| 1008 DEFINE_\S+
1009 )$|
1010 ^(?:
1008 goto| 1011 goto|
1009 return| 1012 return|
1010 case| 1013 case|
1011 else| 1014 else|
1012 asm|__asm__| 1015 asm|__asm__|
1013 do 1016 do
1014 )$| 1017 )(?:\s|$)|
1015 ^(?:typedef|struct|enum)\b 1018 ^(?:typedef|struct|enum)\b
1016 )/x) { 1019 )}x;
1020 warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
1021 if ($possible !~ $notPermitted) {
1017 # Check for modifiers. 1022 # Check for modifiers.
1018 $possible =~ s/\s*$Storage\s*//g; 1023 $possible =~ s/\s*$Storage\s*//g;
1019 $possible =~ s/\s*$Sparse\s*//g; 1024 $possible =~ s/\s*$Sparse\s*//g;
@@ -1022,8 +1027,10 @@ sub possible {
1022 } elsif ($possible =~ /\s/) { 1027 } elsif ($possible =~ /\s/) {
1023 $possible =~ s/\s*$Type\s*//g; 1028 $possible =~ s/\s*$Type\s*//g;
1024 for my $modifier (split(' ', $possible)) { 1029 for my $modifier (split(' ', $possible)) {
1025 warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); 1030 if ($modifier !~ $notPermitted) {
1026 push(@modifierList, $modifier); 1031 warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
1032 push(@modifierList, $modifier);
1033 }
1027 } 1034 }
1028 1035
1029 } else { 1036 } else {
@@ -1138,6 +1145,7 @@ sub process {
1138 # suppression flags 1145 # suppression flags
1139 my %suppress_ifbraces; 1146 my %suppress_ifbraces;
1140 my %suppress_whiletrailers; 1147 my %suppress_whiletrailers;
1148 my %suppress_export;
1141 1149
1142 # Pre-scan the patch sanitizing the lines. 1150 # Pre-scan the patch sanitizing the lines.
1143 # Pre-scan the patch looking for any __setup documentation. 1151 # Pre-scan the patch looking for any __setup documentation.
@@ -1230,7 +1238,6 @@ sub process {
1230 $linenr++; 1238 $linenr++;
1231 1239
1232 my $rawline = $rawlines[$linenr - 1]; 1240 my $rawline = $rawlines[$linenr - 1];
1233 my $hunk_line = ($realcnt != 0);
1234 1241
1235#extract the line range in the file after the patch is applied 1242#extract the line range in the file after the patch is applied
1236 if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { 1243 if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
@@ -1247,6 +1254,7 @@ sub process {
1247 1254
1248 %suppress_ifbraces = (); 1255 %suppress_ifbraces = ();
1249 %suppress_whiletrailers = (); 1256 %suppress_whiletrailers = ();
1257 %suppress_export = ();
1250 next; 1258 next;
1251 1259
1252# track the line number as we move through the hunk, note that 1260# track the line number as we move through the hunk, note that
@@ -1270,6 +1278,8 @@ sub process {
1270 $realcnt--; 1278 $realcnt--;
1271 } 1279 }
1272 1280
1281 my $hunk_line = ($realcnt != 0);
1282
1273#make up the handle for any error we report on this line 1283#make up the handle for any error we report on this line
1274 $prefix = "$filename:$realline: " if ($emacs && $file); 1284 $prefix = "$filename:$realline: " if ($emacs && $file);
1275 $prefix = "$filename:$linenr: " if ($emacs && !$file); 1285 $prefix = "$filename:$linenr: " if ($emacs && !$file);
@@ -1420,13 +1430,22 @@ sub process {
1420 } 1430 }
1421 1431
1422# Check for potential 'bare' types 1432# Check for potential 'bare' types
1423 my ($stat, $cond, $line_nr_next, $remain_next, $off_next); 1433 my ($stat, $cond, $line_nr_next, $remain_next, $off_next,
1434 $realline_next);
1424 if ($realcnt && $line =~ /.\s*\S/) { 1435 if ($realcnt && $line =~ /.\s*\S/) {
1425 ($stat, $cond, $line_nr_next, $remain_next, $off_next) = 1436 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
1426 ctx_statement_block($linenr, $realcnt, 0); 1437 ctx_statement_block($linenr, $realcnt, 0);
1427 $stat =~ s/\n./\n /g; 1438 $stat =~ s/\n./\n /g;
1428 $cond =~ s/\n./\n /g; 1439 $cond =~ s/\n./\n /g;
1429 1440
1441 # Find the real next line.
1442 $realline_next = $line_nr_next;
1443 if (defined $realline_next &&
1444 (!defined $lines[$realline_next - 1] ||
1445 substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) {
1446 $realline_next++;
1447 }
1448
1430 my $s = $stat; 1449 my $s = $stat;
1431 $s =~ s/{.*$//s; 1450 $s =~ s/{.*$//s;
1432 1451
@@ -1661,8 +1680,8 @@ sub process {
1661 } 1680 }
1662 1681
1663# check for initialisation to aggregates open brace on the next line 1682# check for initialisation to aggregates open brace on the next line
1664 if ($prevline =~ /$Declare\s*$Ident\s*=\s*$/ && 1683 if ($line =~ /^.\s*{/ &&
1665 $line =~ /^.\s*{/) { 1684 $prevline =~ /(?:^|[^=])=\s*$/) {
1666 ERROR("that open brace { should be on the previous line\n" . $hereprev); 1685 ERROR("that open brace { should be on the previous line\n" . $hereprev);
1667 } 1686 }
1668 1687
@@ -1687,21 +1706,40 @@ sub process {
1687 $line =~ s@//.*@@; 1706 $line =~ s@//.*@@;
1688 $opline =~ s@//.*@@; 1707 $opline =~ s@//.*@@;
1689 1708
1690#EXPORT_SYMBOL should immediately follow its function closing }. 1709# EXPORT_SYMBOL should immediately follow the thing it is exporting, consider
1691 if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || 1710# the whole statement.
1692 ($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { 1711#print "APW <$lines[$realline_next - 1]>\n";
1712 if (defined $realline_next &&
1713 exists $lines[$realline_next - 1] &&
1714 !defined $suppress_export{$realline_next} &&
1715 ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ ||
1716 $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
1693 my $name = $1; 1717 my $name = $1;
1694 if ($prevline !~ /(?: 1718 if ($stat !~ /(?:
1695 ^.}| 1719 \n.}\s*$|
1696 ^.DEFINE_$Ident\(\Q$name\E\)| 1720 ^.DEFINE_$Ident\(\Q$name\E\)|
1697 ^.DECLARE_$Ident\(\Q$name\E\)| 1721 ^.DECLARE_$Ident\(\Q$name\E\)|
1698 ^.LIST_HEAD\(\Q$name\E\)| 1722 ^.LIST_HEAD\(\Q$name\E\)|
1699 ^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| 1723 ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
1700 \b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[) 1724 \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()
1701 )/x) { 1725 )/x) {
1702 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); 1726#print "FOO A<$lines[$realline_next - 1]> stat<$stat> name<$name>\n";
1727 $suppress_export{$realline_next} = 2;
1728 } else {
1729 $suppress_export{$realline_next} = 1;
1703 } 1730 }
1704 } 1731 }
1732 if (!defined $suppress_export{$linenr} &&
1733 $prevline =~ /^.\s*$/ &&
1734 ($line =~ /EXPORT_SYMBOL.*\((.*)\)/ ||
1735 $line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
1736#print "FOO B <$lines[$linenr - 1]>\n";
1737 $suppress_export{$linenr} = 2;
1738 }
1739 if (defined $suppress_export{$linenr} &&
1740 $suppress_export{$linenr} == 2) {
1741 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
1742 }
1705 1743
1706# check for external initialisers. 1744# check for external initialisers.
1707 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { 1745 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) {
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index cdb44b63342e..102b76608f35 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -13,7 +13,7 @@
13use strict; 13use strict;
14 14
15my $P = $0; 15my $P = $0;
16my $V = '0.20'; 16my $V = '0.21';
17 17
18use Getopt::Long qw(:config no_auto_abbrev); 18use Getopt::Long qw(:config no_auto_abbrev);
19 19
@@ -37,6 +37,7 @@ my $scm = 0;
37my $web = 0; 37my $web = 0;
38my $subsystem = 0; 38my $subsystem = 0;
39my $status = 0; 39my $status = 0;
40my $keywords = 1;
40my $from_filename = 0; 41my $from_filename = 0;
41my $pattern_depth = 0; 42my $pattern_depth = 0;
42my $version = 0; 43my $version = 0;
@@ -84,6 +85,7 @@ if (!GetOptions(
84 'scm!' => \$scm, 85 'scm!' => \$scm,
85 'web!' => \$web, 86 'web!' => \$web,
86 'pattern-depth=i' => \$pattern_depth, 87 'pattern-depth=i' => \$pattern_depth,
88 'k|keywords!' => \$keywords,
87 'f|file' => \$from_filename, 89 'f|file' => \$from_filename,
88 'v|version' => \$version, 90 'v|version' => \$version,
89 'h|help' => \$help, 91 'h|help' => \$help,
@@ -132,6 +134,8 @@ if (!top_of_kernel_tree($lk_path)) {
132## Read MAINTAINERS for type/value pairs 134## Read MAINTAINERS for type/value pairs
133 135
134my @typevalue = (); 136my @typevalue = ();
137my %keyword_hash;
138
135open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; 139open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n";
136while (<MAINT>) { 140while (<MAINT>) {
137 my $line = $_; 141 my $line = $_;
@@ -149,6 +153,8 @@ while (<MAINT>) {
149 if ((-d $value)) { 153 if ((-d $value)) {
150 $value =~ s@([^/])$@$1/@; 154 $value =~ s@([^/])$@$1/@;
151 } 155 }
156 } elsif ($type eq "K") {
157 $keyword_hash{@typevalue} = $value;
152 } 158 }
153 push(@typevalue, "$type:$value"); 159 push(@typevalue, "$type:$value");
154 } elsif (!/^(\s)*$/) { 160 } elsif (!/^(\s)*$/) {
@@ -188,6 +194,7 @@ if ($email_remove_duplicates) {
188 194
189my @files = (); 195my @files = ();
190my @range = (); 196my @range = ();
197my @keyword_tvi = ();
191 198
192foreach my $file (@ARGV) { 199foreach my $file (@ARGV) {
193 ##if $file is a directory and it lacks a trailing slash, add one 200 ##if $file is a directory and it lacks a trailing slash, add one
@@ -198,11 +205,24 @@ foreach my $file (@ARGV) {
198 } 205 }
199 if ($from_filename) { 206 if ($from_filename) {
200 push(@files, $file); 207 push(@files, $file);
208 if (-f $file && $keywords) {
209 open(FILE, "<$file") or die "$P: Can't open ${file}\n";
210 while (<FILE>) {
211 my $patch_line = $_;
212 foreach my $line (keys %keyword_hash) {
213 if ($patch_line =~ m/^.*$keyword_hash{$line}/x) {
214 push(@keyword_tvi, $line);
215 }
216 }
217 }
218 close(FILE);
219 }
201 } else { 220 } else {
202 my $file_cnt = @files; 221 my $file_cnt = @files;
203 my $lastfile; 222 my $lastfile;
204 open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; 223 open(PATCH, "<$file") or die "$P: Can't open ${file}\n";
205 while (<PATCH>) { 224 while (<PATCH>) {
225 my $patch_line = $_;
206 if (m/^\+\+\+\s+(\S+)/) { 226 if (m/^\+\+\+\s+(\S+)/) {
207 my $filename = $1; 227 my $filename = $1;
208 $filename =~ s@^[^/]*/@@; 228 $filename =~ s@^[^/]*/@@;
@@ -213,6 +233,12 @@ foreach my $file (@ARGV) {
213 if ($email_git_blame) { 233 if ($email_git_blame) {
214 push(@range, "$lastfile:$1:$2"); 234 push(@range, "$lastfile:$1:$2");
215 } 235 }
236 } elsif ($keywords) {
237 foreach my $line (keys %keyword_hash) {
238 if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) {
239 push(@keyword_tvi, $line);
240 }
241 }
216 } 242 }
217 } 243 }
218 close(PATCH); 244 close(PATCH);
@@ -286,6 +312,13 @@ foreach my $file (@files) {
286 } 312 }
287} 313}
288 314
315if ($keywords) {
316 @keyword_tvi = sort_and_uniq(@keyword_tvi);
317 foreach my $line (@keyword_tvi) {
318 add_categories($line);
319 }
320}
321
289if ($email) { 322if ($email) {
290 foreach my $chief (@penguin_chief) { 323 foreach my $chief (@penguin_chief) {
291 if ($chief =~ m/^(.*):(.*)/) { 324 if ($chief =~ m/^(.*):(.*)/) {
@@ -384,6 +417,7 @@ Output type options:
384 417
385Other options: 418Other options:
386 --pattern-depth => Number of pattern directory traversals (default: 0 (all)) 419 --pattern-depth => Number of pattern directory traversals (default: 0 (all))
420 --keywords => scan patch for keywords (default: 1 (on))
387 --version => show version 421 --version => show version
388 --help => show this help information 422 --help => show this help information
389 423
@@ -486,7 +520,6 @@ sub format_email {
486} 520}
487 521
488sub find_starting_index { 522sub find_starting_index {
489
490 my ($index) = @_; 523 my ($index) = @_;
491 524
492 while ($index > 0) { 525 while ($index > 0) {
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 2fb28efc5326..06ec722897be 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -873,7 +873,7 @@ static long get_instantiation_keyring(key_serial_t ringid,
873 /* otherwise specify the destination keyring recorded in the 873 /* otherwise specify the destination keyring recorded in the
874 * authorisation key (any KEY_SPEC_*_KEYRING) */ 874 * authorisation key (any KEY_SPEC_*_KEYRING) */
875 if (ringid >= KEY_SPEC_REQUESTOR_KEYRING) { 875 if (ringid >= KEY_SPEC_REQUESTOR_KEYRING) {
876 *_dest_keyring = rka->dest_keyring; 876 *_dest_keyring = key_get(rka->dest_keyring);
877 return 0; 877 return 0;
878 } 878 }
879 879
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 0c1440121c22..c69c60b2a48a 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -953,11 +953,12 @@ static int snd_pcm_dev_register(struct snd_device *device)
953 struct snd_pcm_substream *substream; 953 struct snd_pcm_substream *substream;
954 struct snd_pcm_notify *notify; 954 struct snd_pcm_notify *notify;
955 char str[16]; 955 char str[16];
956 struct snd_pcm *pcm = device->device_data; 956 struct snd_pcm *pcm;
957 struct device *dev; 957 struct device *dev;
958 958
959 if (snd_BUG_ON(!pcm || !device)) 959 if (snd_BUG_ON(!device || !device->device_data))
960 return -ENXIO; 960 return -ENXIO;
961 pcm = device->device_data;
961 mutex_lock(&register_mutex); 962 mutex_lock(&register_mutex);
962 err = snd_pcm_add(pcm); 963 err = snd_pcm_add(pcm);
963 if (err) { 964 if (err) {
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 6ba066c41d2e..252e04ce602f 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -165,7 +165,7 @@ MODULE_PARM_DESC(enable, "Enable this dummy soundcard.");
165module_param_array(pcm_devs, int, NULL, 0444); 165module_param_array(pcm_devs, int, NULL, 0444);
166MODULE_PARM_DESC(pcm_devs, "PCM devices # (0-4) for dummy driver."); 166MODULE_PARM_DESC(pcm_devs, "PCM devices # (0-4) for dummy driver.");
167module_param_array(pcm_substreams, int, NULL, 0444); 167module_param_array(pcm_substreams, int, NULL, 0444);
168MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-16) for dummy driver."); 168MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-128) for dummy driver.");
169//module_param_array(midi_devs, int, NULL, 0444); 169//module_param_array(midi_devs, int, NULL, 0444);
170//MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver."); 170//MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver.");
171module_param(fake_buffer, bool, 0444); 171module_param(fake_buffer, bool, 0444);
@@ -808,8 +808,6 @@ static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy)
808 unsigned int idx; 808 unsigned int idx;
809 int err; 809 int err;
810 810
811 if (snd_BUG_ON(!dummy))
812 return -EINVAL;
813 spin_lock_init(&dummy->mixer_lock); 811 spin_lock_init(&dummy->mixer_lock);
814 strcpy(card->mixername, "Dummy Mixer"); 812 strcpy(card->mixername, "Dummy Mixer");
815 813
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c
index 84cc2658c05b..e1145ac6e908 100644
--- a/sound/drivers/pcsp/pcsp_lib.c
+++ b/sound/drivers/pcsp/pcsp_lib.c
@@ -39,25 +39,20 @@ static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed, 0);
39/* write the port and returns the next expire time in ns; 39/* write the port and returns the next expire time in ns;
40 * called at the trigger-start and in hrtimer callback 40 * called at the trigger-start and in hrtimer callback
41 */ 41 */
42static unsigned long pcsp_timer_update(struct hrtimer *handle) 42static u64 pcsp_timer_update(struct snd_pcsp *chip)
43{ 43{
44 unsigned char timer_cnt, val; 44 unsigned char timer_cnt, val;
45 u64 ns; 45 u64 ns;
46 struct snd_pcm_substream *substream; 46 struct snd_pcm_substream *substream;
47 struct snd_pcm_runtime *runtime; 47 struct snd_pcm_runtime *runtime;
48 struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer);
49 unsigned long flags; 48 unsigned long flags;
50 49
51 if (chip->thalf) { 50 if (chip->thalf) {
52 outb(chip->val61, 0x61); 51 outb(chip->val61, 0x61);
53 chip->thalf = 0; 52 chip->thalf = 0;
54 if (!atomic_read(&chip->timer_active))
55 return 0;
56 return chip->ns_rem; 53 return chip->ns_rem;
57 } 54 }
58 55
59 if (!atomic_read(&chip->timer_active))
60 return 0;
61 substream = chip->playback_substream; 56 substream = chip->playback_substream;
62 if (!substream) 57 if (!substream)
63 return 0; 58 return 0;
@@ -88,24 +83,17 @@ static unsigned long pcsp_timer_update(struct hrtimer *handle)
88 return ns; 83 return ns;
89} 84}
90 85
91enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) 86static void pcsp_pointer_update(struct snd_pcsp *chip)
92{ 87{
93 struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer);
94 struct snd_pcm_substream *substream; 88 struct snd_pcm_substream *substream;
95 int periods_elapsed, pointer_update;
96 size_t period_bytes, buffer_bytes; 89 size_t period_bytes, buffer_bytes;
97 unsigned long ns; 90 int periods_elapsed;
98 unsigned long flags; 91 unsigned long flags;
99 92
100 pointer_update = !chip->thalf;
101 ns = pcsp_timer_update(handle);
102 if (!ns)
103 return HRTIMER_NORESTART;
104
105 /* update the playback position */ 93 /* update the playback position */
106 substream = chip->playback_substream; 94 substream = chip->playback_substream;
107 if (!substream) 95 if (!substream)
108 return HRTIMER_NORESTART; 96 return;
109 97
110 period_bytes = snd_pcm_lib_period_bytes(substream); 98 period_bytes = snd_pcm_lib_period_bytes(substream);
111 buffer_bytes = snd_pcm_lib_buffer_bytes(substream); 99 buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
@@ -134,6 +122,26 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
134 122
135 if (periods_elapsed) 123 if (periods_elapsed)
136 tasklet_schedule(&pcsp_pcm_tasklet); 124 tasklet_schedule(&pcsp_pcm_tasklet);
125}
126
127enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
128{
129 struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer);
130 int pointer_update;
131 u64 ns;
132
133 if (!atomic_read(&chip->timer_active) || !chip->playback_substream)
134 return HRTIMER_NORESTART;
135
136 pointer_update = !chip->thalf;
137 ns = pcsp_timer_update(chip);
138 if (!ns) {
139 printk(KERN_WARNING "PCSP: unexpected stop\n");
140 return HRTIMER_NORESTART;
141 }
142
143 if (pointer_update)
144 pcsp_pointer_update(chip);
137 145
138 hrtimer_forward(handle, hrtimer_get_expires(handle), ns_to_ktime(ns)); 146 hrtimer_forward(handle, hrtimer_get_expires(handle), ns_to_ktime(ns));
139 147
@@ -142,8 +150,6 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
142 150
143static int pcsp_start_playing(struct snd_pcsp *chip) 151static int pcsp_start_playing(struct snd_pcsp *chip)
144{ 152{
145 unsigned long ns;
146
147#if PCSP_DEBUG 153#if PCSP_DEBUG
148 printk(KERN_INFO "PCSP: start_playing called\n"); 154 printk(KERN_INFO "PCSP: start_playing called\n");
149#endif 155#endif
@@ -159,11 +165,7 @@ static int pcsp_start_playing(struct snd_pcsp *chip)
159 atomic_set(&chip->timer_active, 1); 165 atomic_set(&chip->timer_active, 1);
160 chip->thalf = 0; 166 chip->thalf = 0;
161 167
162 ns = pcsp_timer_update(&pcsp_chip.timer); 168 hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL);
163 if (!ns)
164 return -EIO;
165
166 hrtimer_start(&pcsp_chip.timer, ktime_set(0, ns), HRTIMER_MODE_REL);
167 return 0; 169 return 0;
168} 170}
169 171
@@ -232,21 +234,22 @@ static int snd_pcsp_playback_hw_free(struct snd_pcm_substream *substream)
232static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream) 234static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream)
233{ 235{
234 struct snd_pcsp *chip = snd_pcm_substream_chip(substream); 236 struct snd_pcsp *chip = snd_pcm_substream_chip(substream);
237 pcsp_sync_stop(chip);
238 chip->playback_ptr = 0;
239 chip->period_ptr = 0;
240 chip->fmt_size =
241 snd_pcm_format_physical_width(substream->runtime->format) >> 3;
242 chip->is_signed = snd_pcm_format_signed(substream->runtime->format);
235#if PCSP_DEBUG 243#if PCSP_DEBUG
236 printk(KERN_INFO "PCSP: prepare called, " 244 printk(KERN_INFO "PCSP: prepare called, "
237 "size=%zi psize=%zi f=%zi f1=%i\n", 245 "size=%zi psize=%zi f=%zi f1=%i fsize=%i\n",
238 snd_pcm_lib_buffer_bytes(substream), 246 snd_pcm_lib_buffer_bytes(substream),
239 snd_pcm_lib_period_bytes(substream), 247 snd_pcm_lib_period_bytes(substream),
240 snd_pcm_lib_buffer_bytes(substream) / 248 snd_pcm_lib_buffer_bytes(substream) /
241 snd_pcm_lib_period_bytes(substream), 249 snd_pcm_lib_period_bytes(substream),
242 substream->runtime->periods); 250 substream->runtime->periods,
251 chip->fmt_size);
243#endif 252#endif
244 pcsp_sync_stop(chip);
245 chip->playback_ptr = 0;
246 chip->period_ptr = 0;
247 chip->fmt_size =
248 snd_pcm_format_physical_width(substream->runtime->format) >> 3;
249 chip->is_signed = snd_pcm_format_signed(substream->runtime->format);
250 return 0; 253 return 0;
251} 254}
252 255
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c
index 199b03377142..903bc846763f 100644
--- a/sound/drivers/pcsp/pcsp_mixer.c
+++ b/sound/drivers/pcsp/pcsp_mixer.c
@@ -72,7 +72,7 @@ static int pcsp_treble_put(struct snd_kcontrol *kcontrol,
72 if (treble != chip->treble) { 72 if (treble != chip->treble) {
73 chip->treble = treble; 73 chip->treble = treble;
74#if PCSP_DEBUG 74#if PCSP_DEBUG
75 printk(KERN_INFO "PCSP: rate set to %i\n", PCSP_RATE()); 75 printk(KERN_INFO "PCSP: rate set to %li\n", PCSP_RATE());
76#endif 76#endif
77 changed = 1; 77 changed = 1;
78 } 78 }
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index e924492df21d..f47f9e226b08 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -624,6 +624,9 @@ snd_harmony_pcm_init(struct snd_harmony *h)
624 struct snd_pcm *pcm; 624 struct snd_pcm *pcm;
625 int err; 625 int err;
626 626
627 if (snd_BUG_ON(!h))
628 return -EINVAL;
629
627 harmony_disable_interrupts(h); 630 harmony_disable_interrupts(h);
628 631
629 err = snd_pcm_new(h->card, "harmony", 0, 1, 1, &pcm); 632 err = snd_pcm_new(h->card, "harmony", 0, 1, 1, &pcm);
@@ -865,11 +868,12 @@ snd_harmony_mixer_reset(struct snd_harmony *h)
865static int __devinit 868static int __devinit
866snd_harmony_mixer_init(struct snd_harmony *h) 869snd_harmony_mixer_init(struct snd_harmony *h)
867{ 870{
868 struct snd_card *card = h->card; 871 struct snd_card *card;
869 int idx, err; 872 int idx, err;
870 873
871 if (snd_BUG_ON(!h)) 874 if (snd_BUG_ON(!h))
872 return -EINVAL; 875 return -EINVAL;
876 card = h->card;
873 strcpy(card->mixername, "Harmony Gain control interface"); 877 strcpy(card->mixername, "Harmony Gain control interface");
874 878
875 for (idx = 0; idx < HARMONY_CONTROLS; idx++) { 879 for (idx = 0; idx < HARMONY_CONTROLS; idx++) {
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index fb5ee3cc3968..75c602b5b132 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -259,7 +259,6 @@ config SND_CS5530
259 259
260config SND_CS5535AUDIO 260config SND_CS5535AUDIO
261 tristate "CS5535/CS5536 Audio" 261 tristate "CS5535/CS5536 Audio"
262 depends on X86 && !X86_64
263 select SND_PCM 262 select SND_PCM
264 select SND_AC97_CODEC 263 select SND_AC97_CODEC
265 help 264 help
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index b458d208720b..aaf4da68969c 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -973,7 +973,7 @@ static void snd_ali_free_voice(struct snd_ali * codec,
973 void *private_data; 973 void *private_data;
974 974
975 snd_ali_printk("free_voice: channel=%d\n",pvoice->number); 975 snd_ali_printk("free_voice: channel=%d\n",pvoice->number);
976 if (pvoice == NULL || !pvoice->use) 976 if (!pvoice->use)
977 return; 977 return;
978 snd_ali_clear_voices(codec, pvoice->number, pvoice->number); 978 snd_ali_clear_voices(codec, pvoice->number, pvoice->number);
979 spin_lock_irq(&codec->voice_alloc); 979 spin_lock_irq(&codec->voice_alloc);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index c9ad182e1b4b..e340792f6cb3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2674,6 +2674,7 @@ static struct pci_device_id azx_ids[] = {
2674 { PCI_DEVICE(0x10de, 0x044b), .driver_data = AZX_DRIVER_NVIDIA }, 2674 { PCI_DEVICE(0x10de, 0x044b), .driver_data = AZX_DRIVER_NVIDIA },
2675 { PCI_DEVICE(0x10de, 0x055c), .driver_data = AZX_DRIVER_NVIDIA }, 2675 { PCI_DEVICE(0x10de, 0x055c), .driver_data = AZX_DRIVER_NVIDIA },
2676 { PCI_DEVICE(0x10de, 0x055d), .driver_data = AZX_DRIVER_NVIDIA }, 2676 { PCI_DEVICE(0x10de, 0x055d), .driver_data = AZX_DRIVER_NVIDIA },
2677 { PCI_DEVICE(0x10de, 0x0590), .driver_data = AZX_DRIVER_NVIDIA },
2677 { PCI_DEVICE(0x10de, 0x0774), .driver_data = AZX_DRIVER_NVIDIA }, 2678 { PCI_DEVICE(0x10de, 0x0774), .driver_data = AZX_DRIVER_NVIDIA },
2678 { PCI_DEVICE(0x10de, 0x0775), .driver_data = AZX_DRIVER_NVIDIA }, 2679 { PCI_DEVICE(0x10de, 0x0775), .driver_data = AZX_DRIVER_NVIDIA },
2679 { PCI_DEVICE(0x10de, 0x0776), .driver_data = AZX_DRIVER_NVIDIA }, 2680 { PCI_DEVICE(0x10de, 0x0776), .driver_data = AZX_DRIVER_NVIDIA },
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c08ca660daba..ff20048504b6 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -965,6 +965,8 @@ static void alc_automute_pin(struct hda_codec *codec)
965 unsigned int nid = spec->autocfg.hp_pins[0]; 965 unsigned int nid = spec->autocfg.hp_pins[0];
966 int i; 966 int i;
967 967
968 if (!nid)
969 return;
968 pincap = snd_hda_query_pin_caps(codec, nid); 970 pincap = snd_hda_query_pin_caps(codec, nid);
969 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ 971 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
970 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); 972 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
@@ -12602,7 +12604,8 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
12602 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", 12604 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12603 ALC268_ACER_ASPIRE_ONE), 12605 ALC268_ACER_ASPIRE_ONE),
12604 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 12606 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12605 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), 12607 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12608 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12606 /* almost compatible with toshiba but with optional digital outs; 12609 /* almost compatible with toshiba but with optional digital outs;
12607 * auto-probing seems working fine 12610 * auto-probing seems working fine
12608 */ 12611 */
@@ -17374,7 +17377,7 @@ static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17374 17377
17375/* create playback/capture controls for input pins */ 17378/* create playback/capture controls for input pins */
17376#define alc662_auto_create_input_ctls \ 17379#define alc662_auto_create_input_ctls \
17377 alc880_auto_create_input_ctls 17380 alc882_auto_create_input_ctls
17378 17381
17379static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, 17382static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17380 hda_nid_t nid, int pin_type, 17383 hda_nid_t nid, int pin_type,
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 91683a349035..8a332d2f615c 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -386,6 +386,7 @@ struct via82xx {
386 386
387 struct snd_pcm *pcms[2]; 387 struct snd_pcm *pcms[2];
388 struct snd_rawmidi *rmidi; 388 struct snd_rawmidi *rmidi;
389 struct snd_kcontrol *dxs_controls[4];
389 390
390 struct snd_ac97_bus *ac97_bus; 391 struct snd_ac97_bus *ac97_bus;
391 struct snd_ac97 *ac97; 392 struct snd_ac97 *ac97;
@@ -1216,9 +1217,9 @@ static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev,
1216 1217
1217 1218
1218/* 1219/*
1219 * open callback for playback on via686 and via823x DSX 1220 * open callback for playback on via686
1220 */ 1221 */
1221static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) 1222static int snd_via686_playback_open(struct snd_pcm_substream *substream)
1222{ 1223{
1223 struct via82xx *chip = snd_pcm_substream_chip(substream); 1224 struct via82xx *chip = snd_pcm_substream_chip(substream);
1224 struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; 1225 struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number];
@@ -1230,6 +1231,32 @@ static int snd_via82xx_playback_open(struct snd_pcm_substream *substream)
1230} 1231}
1231 1232
1232/* 1233/*
1234 * open callback for playback on via823x DXS
1235 */
1236static int snd_via8233_playback_open(struct snd_pcm_substream *substream)
1237{
1238 struct via82xx *chip = snd_pcm_substream_chip(substream);
1239 struct viadev *viadev;
1240 unsigned int stream;
1241 int err;
1242
1243 viadev = &chip->devs[chip->playback_devno + substream->number];
1244 if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0)
1245 return err;
1246 stream = viadev->reg_offset / 0x10;
1247 if (chip->dxs_controls[stream]) {
1248 chip->playback_volume[stream][0] = 0;
1249 chip->playback_volume[stream][1] = 0;
1250 chip->dxs_controls[stream]->vd[0].access &=
1251 ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1252 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE |
1253 SNDRV_CTL_EVENT_MASK_INFO,
1254 &chip->dxs_controls[stream]->id);
1255 }
1256 return 0;
1257}
1258
1259/*
1233 * open callback for playback on via823x multi-channel 1260 * open callback for playback on via823x multi-channel
1234 */ 1261 */
1235static int snd_via8233_multi_open(struct snd_pcm_substream *substream) 1262static int snd_via8233_multi_open(struct snd_pcm_substream *substream)
@@ -1302,10 +1329,26 @@ static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream)
1302 return 0; 1329 return 0;
1303} 1330}
1304 1331
1332static int snd_via8233_playback_close(struct snd_pcm_substream *substream)
1333{
1334 struct via82xx *chip = snd_pcm_substream_chip(substream);
1335 struct viadev *viadev = substream->runtime->private_data;
1336 unsigned int stream;
1337
1338 stream = viadev->reg_offset / 0x10;
1339 if (chip->dxs_controls[stream]) {
1340 chip->dxs_controls[stream]->vd[0].access |=
1341 SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1342 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO,
1343 &chip->dxs_controls[stream]->id);
1344 }
1345 return snd_via82xx_pcm_close(substream);
1346}
1347
1305 1348
1306/* via686 playback callbacks */ 1349/* via686 playback callbacks */
1307static struct snd_pcm_ops snd_via686_playback_ops = { 1350static struct snd_pcm_ops snd_via686_playback_ops = {
1308 .open = snd_via82xx_playback_open, 1351 .open = snd_via686_playback_open,
1309 .close = snd_via82xx_pcm_close, 1352 .close = snd_via82xx_pcm_close,
1310 .ioctl = snd_pcm_lib_ioctl, 1353 .ioctl = snd_pcm_lib_ioctl,
1311 .hw_params = snd_via82xx_hw_params, 1354 .hw_params = snd_via82xx_hw_params,
@@ -1331,8 +1374,8 @@ static struct snd_pcm_ops snd_via686_capture_ops = {
1331 1374
1332/* via823x DSX playback callbacks */ 1375/* via823x DSX playback callbacks */
1333static struct snd_pcm_ops snd_via8233_playback_ops = { 1376static struct snd_pcm_ops snd_via8233_playback_ops = {
1334 .open = snd_via82xx_playback_open, 1377 .open = snd_via8233_playback_open,
1335 .close = snd_via82xx_pcm_close, 1378 .close = snd_via8233_playback_close,
1336 .ioctl = snd_pcm_lib_ioctl, 1379 .ioctl = snd_pcm_lib_ioctl,
1337 .hw_params = snd_via82xx_hw_params, 1380 .hw_params = snd_via82xx_hw_params,
1338 .hw_free = snd_via82xx_hw_free, 1381 .hw_free = snd_via82xx_hw_free,
@@ -1709,8 +1752,9 @@ static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = {
1709 .device = 0, 1752 .device = 0,
1710 /* .subdevice set later */ 1753 /* .subdevice set later */
1711 .name = "PCM Playback Volume", 1754 .name = "PCM Playback Volume",
1712 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 1755 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
1713 SNDRV_CTL_ELEM_ACCESS_TLV_READ), 1756 SNDRV_CTL_ELEM_ACCESS_TLV_READ |
1757 SNDRV_CTL_ELEM_ACCESS_INACTIVE,
1714 .info = snd_via8233_dxs_volume_info, 1758 .info = snd_via8233_dxs_volume_info,
1715 .get = snd_via8233_dxs_volume_get, 1759 .get = snd_via8233_dxs_volume_get,
1716 .put = snd_via8233_dxs_volume_put, 1760 .put = snd_via8233_dxs_volume_put,
@@ -1948,6 +1992,7 @@ static int __devinit snd_via8233_init_misc(struct via82xx *chip)
1948 err = snd_ctl_add(chip->card, kctl); 1992 err = snd_ctl_add(chip->card, kctl);
1949 if (err < 0) 1993 if (err < 0)
1950 return err; 1994 return err;
1995 chip->dxs_controls[i] = kctl;
1951 } 1996 }
1952 } 1997 }
1953 } 1998 }
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 7dea74b71cf1..64b859925c0b 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -217,20 +217,25 @@ static void snd_pdacf_detach(struct pcmcia_device *link)
217 * configuration callback 217 * configuration callback
218 */ 218 */
219 219
220#define CS_CHECK(fn, ret) \
221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
222
223static int pdacf_config(struct pcmcia_device *link) 220static int pdacf_config(struct pcmcia_device *link)
224{ 221{
225 struct snd_pdacf *pdacf = link->priv; 222 struct snd_pdacf *pdacf = link->priv;
226 int last_fn, last_ret; 223 int ret;
227 224
228 snd_printdd(KERN_DEBUG "pdacf_config called\n"); 225 snd_printdd(KERN_DEBUG "pdacf_config called\n");
229 link->conf.ConfigIndex = 0x5; 226 link->conf.ConfigIndex = 0x5;
230 227
231 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 228 ret = pcmcia_request_io(link, &link->io);
232 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 229 if (ret)
233 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 230 goto failed;
231
232 ret = pcmcia_request_irq(link, &link->irq);
233 if (ret)
234 goto failed;
235
236 ret = pcmcia_request_configuration(link, &link->conf);
237 if (ret)
238 goto failed;
234 239
235 if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) 240 if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
236 goto failed; 241 goto failed;
@@ -238,8 +243,6 @@ static int pdacf_config(struct pcmcia_device *link)
238 link->dev_node = &pdacf->node; 243 link->dev_node = &pdacf->node;
239 return 0; 244 return 0;
240 245
241cs_failed:
242 cs_error(link, last_fn, last_ret);
243failed: 246failed:
244 pcmcia_disable_device(link); 247 pcmcia_disable_device(link);
245 return -ENODEV; 248 return -ENODEV;
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 7445cc8a47d3..1492744ad67f 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -213,14 +213,11 @@ static int snd_vxpocket_assign_resources(struct vx_core *chip, int port, int irq
213 * configuration callback 213 * configuration callback
214 */ 214 */
215 215
216#define CS_CHECK(fn, ret) \
217do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
218
219static int vxpocket_config(struct pcmcia_device *link) 216static int vxpocket_config(struct pcmcia_device *link)
220{ 217{
221 struct vx_core *chip = link->priv; 218 struct vx_core *chip = link->priv;
222 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; 219 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
223 int last_fn, last_ret; 220 int ret;
224 221
225 snd_printdd(KERN_DEBUG "vxpocket_config called\n"); 222 snd_printdd(KERN_DEBUG "vxpocket_config called\n");
226 223
@@ -235,9 +232,17 @@ static int vxpocket_config(struct pcmcia_device *link)
235 strcpy(chip->card->driver, vxp440_hw.name); 232 strcpy(chip->card->driver, vxp440_hw.name);
236 } 233 }
237 234
238 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 235 ret = pcmcia_request_io(link, &link->io);
239 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 236 if (ret)
240 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 237 goto failed;
238
239 ret = pcmcia_request_irq(link, &link->irq);
240 if (ret)
241 goto failed;
242
243 ret = pcmcia_request_configuration(link, &link->conf);
244 if (ret)
245 goto failed;
241 246
242 chip->dev = &handle_to_dev(link); 247 chip->dev = &handle_to_dev(link);
243 snd_card_set_dev(chip->card, chip->dev); 248 snd_card_set_dev(chip->card, chip->dev);
@@ -248,8 +253,6 @@ static int vxpocket_config(struct pcmcia_device *link)
248 link->dev_node = &vxp->node; 253 link->dev_node = &vxp->node;
249 return 0; 254 return 0;
250 255
251cs_failed:
252 cs_error(link, last_fn, last_ret);
253failed: 256failed:
254 pcmcia_disable_device(link); 257 pcmcia_disable_device(link);
255 return -ENODEV; 258 return -ENODEV;
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig
index bd2338ab2ced..0519c60f5be1 100644
--- a/sound/ppc/Kconfig
+++ b/sound/ppc/Kconfig
@@ -2,7 +2,7 @@
2 2
3menuconfig SND_PPC 3menuconfig SND_PPC
4 bool "PowerPC sound devices" 4 bool "PowerPC sound devices"
5 depends on PPC64 || PPC32 5 depends on PPC
6 default y 6 default y
7 help 7 help
8 Support for sound devices specific to PowerPC architectures. 8 Support for sound devices specific to PowerPC architectures.
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 2dee9839be86..653a362425df 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -21,7 +21,18 @@ config SND_OMAP_SOC_AMS_DELTA
21 select SND_OMAP_SOC_MCBSP 21 select SND_OMAP_SOC_MCBSP
22 select SND_SOC_CX20442 22 select SND_SOC_CX20442
23 help 23 help
24 Say Y if you want to add support for SoC audio on Amstrad Delta. 24 Say Y if you want to add support for SoC audio device connected to
25 a handset and a speakerphone found on Amstrad E3 (Delta) videophone.
26
27 Note that in order to get those devices fully supported, you have to
28 build the kernel with standard serial port driver included and
29 configured for at least 4 ports. Then, from userspace, you must load
30 a line discipline #19 on the modem (ttyS3) serial line. The simplest
31 way to achieve this is to install util-linux-ng and use the included
32 ldattach utility. This can be started automatically from udev,
33 a simple rule like this one should do the trick (it does for me):
34 ACTION=="add", KERNEL=="controlC0", \
35 RUN+="/usr/sbin/ldattach 19 /dev/ttyS3"
25 36
26config SND_OMAP_SOC_OSK5912 37config SND_OMAP_SOC_OSK5912
27 tristate "SoC Audio support for omap osk5912" 38 tristate "SoC Audio support for omap osk5912"
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
index 5cbbdc80fde3..1f35c6fcf5fd 100644
--- a/sound/soc/s3c24xx/s3c24xx-pcm.c
+++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -75,11 +75,19 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream)
75{ 75{
76 struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; 76 struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
77 dma_addr_t pos = prtd->dma_pos; 77 dma_addr_t pos = prtd->dma_pos;
78 unsigned int limit;
78 int ret; 79 int ret;
79 80
80 pr_debug("Entered %s\n", __func__); 81 pr_debug("Entered %s\n", __func__);
81 82
82 while (prtd->dma_loaded < prtd->dma_limit) { 83 if (s3c_dma_has_circular()) {
84 limit = (prtd->dma_end - prtd->dma_start) / prtd->dma_period;
85 } else
86 limit = prtd->dma_limit;
87
88 pr_debug("%s: loaded %d, limit %d\n", __func__, prtd->dma_loaded, limit);
89
90 while (prtd->dma_loaded < limit) {
83 unsigned long len = prtd->dma_period; 91 unsigned long len = prtd->dma_period;
84 92
85 pr_debug("dma_loaded: %d\n", prtd->dma_loaded); 93 pr_debug("dma_loaded: %d\n", prtd->dma_loaded);
@@ -123,7 +131,7 @@ static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel,
123 snd_pcm_period_elapsed(substream); 131 snd_pcm_period_elapsed(substream);
124 132
125 spin_lock(&prtd->lock); 133 spin_lock(&prtd->lock);
126 if (prtd->state & ST_RUNNING) { 134 if (prtd->state & ST_RUNNING && !s3c_dma_has_circular()) {
127 prtd->dma_loaded--; 135 prtd->dma_loaded--;
128 s3c24xx_pcm_enqueue(substream); 136 s3c24xx_pcm_enqueue(substream);
129 } 137 }
@@ -164,6 +172,11 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
164 printk(KERN_ERR "failed to get dma channel\n"); 172 printk(KERN_ERR "failed to get dma channel\n");
165 return ret; 173 return ret;
166 } 174 }
175
176 /* use the circular buffering if we have it available. */
177 if (s3c_dma_has_circular())
178 s3c2410_dma_setflags(prtd->params->channel,
179 S3C2410_DMAF_CIRCULAR);
167 } 180 }
168 181
169 s3c2410_dma_set_buffdone_fn(prtd->params->channel, 182 s3c2410_dma_set_buffdone_fn(prtd->params->channel,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7ff04ad2a97e..0a1b2f64bbee 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -834,6 +834,9 @@ EXPORT_SYMBOL_GPL(snd_soc_resume_device);
834#define soc_resume NULL 834#define soc_resume NULL
835#endif 835#endif
836 836
837static struct snd_soc_dai_ops null_dai_ops = {
838};
839
837static void snd_soc_instantiate_card(struct snd_soc_card *card) 840static void snd_soc_instantiate_card(struct snd_soc_card *card)
838{ 841{
839 struct platform_device *pdev = container_of(card->dev, 842 struct platform_device *pdev = container_of(card->dev,
@@ -877,6 +880,11 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
877 ac97 = 1; 880 ac97 = 1;
878 } 881 }
879 882
883 for (i = 0; i < card->num_links; i++) {
884 if (!card->dai_link[i].codec_dai->ops)
885 card->dai_link[i].codec_dai->ops = &null_dai_ops;
886 }
887
880 /* If we have AC97 in the system then don't wait for the 888 /* If we have AC97 in the system then don't wait for the
881 * codec. This will need revisiting if we have to handle 889 * codec. This will need revisiting if we have to handle
882 * systems with mixed AC97 and non-AC97 parts. Only check for 890 * systems with mixed AC97 and non-AC97 parts. Only check for
@@ -2329,9 +2337,6 @@ static int snd_soc_unregister_card(struct snd_soc_card *card)
2329 return 0; 2337 return 0;
2330} 2338}
2331 2339
2332static struct snd_soc_dai_ops null_dai_ops = {
2333};
2334
2335/** 2340/**
2336 * snd_soc_register_dai - Register a DAI with the ASoC core 2341 * snd_soc_register_dai - Register a DAI with the ASoC core
2337 * 2342 *
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8de6f9dec4a2..d89f6dc00908 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2072,9 +2072,9 @@ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec,
2072 } 2072 }
2073 } 2073 }
2074 } 2074 }
2075 mutex_unlock(&codec->mutex);
2076 2075
2077 dapm_power_widgets(codec, event); 2076 dapm_power_widgets(codec, event);
2077 mutex_unlock(&codec->mutex);
2078 dump_dapm(codec, __func__); 2078 dump_dapm(codec, __func__);
2079 return 0; 2079 return 0;
2080} 2080}
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 121af0644fd9..86b2c3b92df5 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -62,10 +62,14 @@ static void
62activate_substream(struct snd_usb_caiaqdev *dev, 62activate_substream(struct snd_usb_caiaqdev *dev,
63 struct snd_pcm_substream *sub) 63 struct snd_pcm_substream *sub)
64{ 64{
65 spin_lock(&dev->spinlock);
66
65 if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) 67 if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
66 dev->sub_playback[sub->number] = sub; 68 dev->sub_playback[sub->number] = sub;
67 else 69 else
68 dev->sub_capture[sub->number] = sub; 70 dev->sub_capture[sub->number] = sub;
71
72 spin_unlock(&dev->spinlock);
69} 73}
70 74
71static void 75static void
@@ -269,16 +273,22 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)
269{ 273{
270 int index = sub->number; 274 int index = sub->number;
271 struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); 275 struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub);
276 snd_pcm_uframes_t ptr;
277
278 spin_lock(&dev->spinlock);
272 279
273 if (dev->input_panic || dev->output_panic) 280 if (dev->input_panic || dev->output_panic)
274 return SNDRV_PCM_POS_XRUN; 281 ptr = SNDRV_PCM_POS_XRUN;
275 282
276 if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) 283 if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
277 return bytes_to_frames(sub->runtime, 284 ptr = bytes_to_frames(sub->runtime,
278 dev->audio_out_buf_pos[index]); 285 dev->audio_out_buf_pos[index]);
279 else 286 else
280 return bytes_to_frames(sub->runtime, 287 ptr = bytes_to_frames(sub->runtime,
281 dev->audio_in_buf_pos[index]); 288 dev->audio_in_buf_pos[index]);
289
290 spin_unlock(&dev->spinlock);
291 return ptr;
282} 292}
283 293
284/* operators for both playback and capture */ 294/* operators for both playback and capture */
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index 83e6c1312d47..a3f02dd97440 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -35,7 +35,7 @@
35#include "input.h" 35#include "input.h"
36 36
37MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); 37MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
38MODULE_DESCRIPTION("caiaq USB audio, version 1.3.19"); 38MODULE_DESCRIPTION("caiaq USB audio, version 1.3.20");
39MODULE_LICENSE("GPL"); 39MODULE_LICENSE("GPL");
40MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," 40MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
41 "{Native Instruments, RigKontrol3}," 41 "{Native Instruments, RigKontrol3},"
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 9f4488d6f8e6..542b29e2e382 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -177,8 +177,7 @@ endif
177# Include saner warnings here, which can catch bugs: 177# Include saner warnings here, which can catch bugs:
178# 178#
179 179
180EXTRA_WARNINGS := -Wcast-align 180EXTRA_WARNINGS := -Wformat
181EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat
182EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security 181EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
183EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k 182EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
184EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow 183EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
@@ -456,12 +455,12 @@ ifeq ($(uname_S),Darwin)
456 PTHREAD_LIBS = 455 PTHREAD_LIBS =
457endif 456endif
458 457
459ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) 458ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
460 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); 459 ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
461endif 460 BASIC_CFLAGS += -DLIBELF_NO_MMAP
462 461 endif
463ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) 462else
464 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); 463 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
465endif 464endif
466 465
467ifdef NO_DEMANGLE 466ifdef NO_DEMANGLE
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 93c49f4685ff..ac94d7b94f61 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -549,7 +549,7 @@ static int dso__synthesize_plt_symbols(struct dso *self)
549 if (fd < 0) 549 if (fd < 0)
550 goto out; 550 goto out;
551 551
552 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); 552 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
553 if (elf == NULL) 553 if (elf == NULL)
554 goto out_close; 554 goto out_close;
555 555
@@ -673,7 +673,7 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
673 Elf *elf; 673 Elf *elf;
674 int nr = 0; 674 int nr = 0;
675 675
676 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); 676 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
677 if (elf == NULL) { 677 if (elf == NULL) {
678 pr_err("%s: cannot read %s ELF file.\n", __func__, name); 678 pr_err("%s: cannot read %s ELF file.\n", __func__, name);
679 goto out_close; 679 goto out_close;
@@ -842,7 +842,7 @@ static char *dso__read_build_id(struct dso *self)
842 if (fd < 0) 842 if (fd < 0)
843 goto out; 843 goto out;
844 844
845 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); 845 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
846 if (elf == NULL) { 846 if (elf == NULL) {
847 pr_err("%s: cannot read %s ELF file.\n", __func__, 847 pr_err("%s: cannot read %s ELF file.\n", __func__,
848 self->long_name); 848 self->long_name);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index a471a3840736..088433062dd4 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -27,6 +27,16 @@ static inline char *bfd_demangle(void __used *v, const char __used *c,
27#endif 27#endif
28#endif 28#endif
29 29
30/*
31 * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
32 * for newer versions we can use mmap to reduce memory usage:
33 */
34#ifdef LIBELF_NO_MMAP
35# define PERF_ELF_C_READ_MMAP ELF_C_READ
36#else
37# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
38#endif
39
30#ifndef DMGL_PARAMS 40#ifndef DMGL_PARAMS
31#define DMGL_PARAMS (1 << 0) /* Include function args */ 41#define DMGL_PARAMS (1 << 0) /* Include function args */
32#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ 42#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b7c78a403dc2..7495ce347344 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2717,8 +2717,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
2717 int r; 2717 int r;
2718 int cpu; 2718 int cpu;
2719 2719
2720 kvm_init_debug();
2721
2722 r = kvm_arch_init(opaque); 2720 r = kvm_arch_init(opaque);
2723 if (r) 2721 if (r)
2724 goto out_fail; 2722 goto out_fail;
@@ -2785,6 +2783,8 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
2785 kvm_preempt_ops.sched_in = kvm_sched_in; 2783 kvm_preempt_ops.sched_in = kvm_sched_in;
2786 kvm_preempt_ops.sched_out = kvm_sched_out; 2784 kvm_preempt_ops.sched_out = kvm_sched_out;
2787 2785
2786 kvm_init_debug();
2787
2788 return 0; 2788 return 0;
2789 2789
2790out_free: 2790out_free:
@@ -2807,7 +2807,6 @@ out_free_0:
2807out: 2807out:
2808 kvm_arch_exit(); 2808 kvm_arch_exit();
2809out_fail: 2809out_fail:
2810 kvm_exit_debug();
2811 return r; 2810 return r;
2812} 2811}
2813EXPORT_SYMBOL_GPL(kvm_init); 2812EXPORT_SYMBOL_GPL(kvm_init);
@@ -2815,6 +2814,7 @@ EXPORT_SYMBOL_GPL(kvm_init);
2815void kvm_exit(void) 2814void kvm_exit(void)
2816{ 2815{
2817 tracepoint_synchronize_unregister(); 2816 tracepoint_synchronize_unregister();
2817 kvm_exit_debug();
2818 misc_deregister(&kvm_dev); 2818 misc_deregister(&kvm_dev);
2819 kmem_cache_destroy(kvm_vcpu_cache); 2819 kmem_cache_destroy(kvm_vcpu_cache);
2820 sysdev_unregister(&kvm_sysdev); 2820 sysdev_unregister(&kvm_sysdev);
@@ -2824,7 +2824,6 @@ void kvm_exit(void)
2824 on_each_cpu(hardware_disable, NULL, 1); 2824 on_each_cpu(hardware_disable, NULL, 1);
2825 kvm_arch_hardware_unsetup(); 2825 kvm_arch_hardware_unsetup();
2826 kvm_arch_exit(); 2826 kvm_arch_exit();
2827 kvm_exit_debug();
2828 free_cpumask_var(cpus_hardware_enabled); 2827 free_cpumask_var(cpus_hardware_enabled);
2829 __free_page(bad_page); 2828 __free_page(bad_page);
2830} 2829}