]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 19:50:54 +0000 (15:50 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 19:50:54 +0000 (15:50 -0400)
Pull MIPS updates from Ralf Baechle:
 "This is the main pull request for MIPS for Linux 4.1.  Most
  noteworthy:

   - Add more Octeon-optimized crypto functions
   - Octeon crypto preemption and locking fixes
   - Little endian support for Octeon
   - Use correct CSR to soft reset Octeons
   - Support LEDs on the Octeon-based DSR-1000N
   - Fix PCI interrupt mapping for the Octeon-based DSR-1000N
   - Mark prom_free_prom_memory() as __init for a number of systems
   - Support for Imagination's Pistachio SOC.  This includes arch and
     CLK bits.  I'd like to merge pinctrl bits later
   - Improve parallelism of csum_partial for certain pipelines
   - Organize DTB files in subdirs like other architectures
   - Implement read_sched_clock for all MIPS platforms other than
     Octeon
   - Massive series of 38 fixes and cleanups for the FPU emulator /
     kernel
   - Further FPU remulator work to support new features.  This sits on a
     separate branch which also has been pulled into the 4.1 KVM branch
   - Clean up and fixes for the SEAD3 eval board; remove unused file
   - Various updates for Netlogic platforms
   - A number of small updates for Loongson 3 platforms
   - Increase the memory limit for ATH79 platforms to 256MB
   - A fair number of fixes and updates for BCM47xx platforms
   - Finish the implementation of XPA support
   - MIPS FDC support.  No, not floppy controller but Fast Debug Channel :)
   - Detect the R16000 used in SGI legacy platforms
   - Fix Kconfig dependencies for the SSB bus support"

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (265 commits)
  MIPS: Makefile: Fix MIPS ASE detection code
  MIPS: asm: elf: Set O32 default FPU flags
  MIPS: BCM47XX: Fix detecting Microsoft MN-700 & Asus WL500G
  MIPS: Kconfig: Disable SMP/CPS for 64-bit
  MIPS: Hibernate: flush TLB entries earlier
  MIPS: smp-cps: cpu_set FPU mask if FPU present
  MIPS: lose_fpu(): Disable FPU when MSA enabled
  MIPS: ralink: add missing symbol for RALINK_ILL_ACC
  MIPS: ralink: Fix bad config symbol in PCI makefile.
  SSB: fix Kconfig dependencies
  MIPS: Malta: Detect and fix bad memsize values
  Revert "MIPS: Avoid pipeline stalls on some MIPS32R2 cores."
  MIPS: Octeon: Delete override of cpu_has_mips_r2_exec_hazard.
  MIPS: Fix cpu_has_mips_r2_exec_hazard.
  MIPS: kernel: entry.S: Set correct ISA level for mips_ihb
  MIPS: asm: spinlock: Fix addiu instruction for R10000_LLSC_WAR case
  MIPS: r4kcache: Use correct base register for MIPS R6 cache flushes
  MIPS: Kconfig: Fix typo for the r2-to-r6 emulator kernel parameter
  MIPS: unaligned: Fix regular load/store instruction emulation for EVA
  MIPS: unaligned: Surround load/store macros in do {} while statements
  ...

15 files changed:
1  2 
Documentation/kernel-parameters.txt
arch/mips/Kconfig
arch/mips/Makefile
arch/mips/cavium-octeon/crypto/octeon-crypto.h
arch/mips/include/asm/elf.h
arch/mips/include/asm/thread_info.h
arch/mips/kernel/traps.c
arch/mips/lasat/sysctl.c
arch/mips/pci/pci.c
arch/mips/sgi-ip32/ip32-platform.c
drivers/clocksource/Kconfig
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
drivers/net/ethernet/broadcom/bgmac.c
drivers/staging/octeon/ethernet.c

index 491bbd104b063143924647e566be5e7bfc8ac743,f23384402ee4e4694e962899d72bf498e54ba591..11a76df2e1f1ee837abb694b482def0e3467530e
@@@ -1036,7 -1036,7 +1036,7 @@@ bytes respectively. Such letter suffixe
                        Format: {"off" | "on" | "skip[mbr]"}
  
        efi=            [EFI]
 -                      Format: { "old_map", "nochunk", "noruntime" }
 +                      Format: { "old_map", "nochunk", "noruntime", "debug" }
                        old_map [X86-64]: switch to the old ioremap-based EFI
                        runtime services mapping. 32-bit still uses this one by
                        default.
                        boot stub, as chunking can cause problems with some
                        firmware implementations.
                        noruntime : disable EFI runtime services support
 +                      debug: enable misc debug output
  
        efi_no_storage_paranoia [EFI; X86]
                        Using this parameter you can use more than 50% of
                        seconds.  Use this parameter to check at some
                        other rate.  0 disables periodic checking.
  
 -      memtest=        [KNL,X86] Enable memtest
 +      memtest=        [KNL,X86,ARM] Enable memtest
                        Format: <integer>
                        default : 0 <disable>
                        Specifies the number of memtest passes to be
  
        nmi_watchdog=   [KNL,BUGS=X86] Debugging features for SMP kernels
                        Format: [panic,][nopanic,][num]
 -                      Valid num: 0
 +                      Valid num: 0 or 1
                        0 - turn nmi_watchdog off
 +                      1 - turn nmi_watchdog on
                        When panic is specified, panic when an NMI watchdog
                        timeout occurs (or 'nopanic' to override the opposite
                        default).
                        noexec32=off: disable non-executable mappings
                                read implies executable mappings
  
-       nofpu           [SH] Disable hardware FPU at boot time.
+       nofpu           [MIPS,SH] Disable hardware FPU at boot time.
  
        nofxsr          [BUGS=X86-32] Disables x86 floating point extended
                        register save and restore. The kernel will only save
                        legacy floating-point registers on task switch.
  
 +      nohugeiomap     [KNL,x86] Disable kernel huge I/O mappings.
 +
        noxsave         [BUGS=X86] Disables x86 extended register state save
                        and restore using xsave. The kernel will fallback to
                        enabling legacy floating-point and sse state.
  
        nousb           [USB] Disable the USB subsystem
  
 -      nowatchdog      [KNL] Disable the lockup detector (NMI watchdog).
 +      nowatchdog      [KNL] Disable both lockup detectors, i.e.
 +                        soft-lockup and NMI watchdog (hard-lockup).
  
        nowb            [ARM]
  
                        Set maximum number of finished RCU callbacks to
                        process in one batch.
  
 +      rcutree.gp_init_delay=  [KNL]
 +                      Set the number of jiffies to delay each step of
 +                      RCU grace-period initialization.  This only has
 +                      effect when CONFIG_RCU_TORTURE_TEST_SLOW_INIT is
 +                      set.
 +
        rcutree.rcu_fanout_leaf= [KNL]
                        Increase the number of CPUs assigned to each
                        leaf rcu_node structure.  Useful for very large
                        value is one, and maximum value is HZ.
  
        rcutree.kthread_prio=    [KNL,BOOT]
 -                      Set the SCHED_FIFO priority of the RCU
 -                      per-CPU kthreads (rcuc/N). This value is also
 -                      used for the priority of the RCU boost threads
 -                      (rcub/N). Valid values are 1-99 and the default
 -                      is 1 (the least-favored priority).
 +                      Set the SCHED_FIFO priority of the RCU per-CPU
 +                      kthreads (rcuc/N). This value is also used for
 +                      the priority of the RCU boost threads (rcub/N)
 +                      and for the RCU grace-period kthreads (rcu_bh,
 +                      rcu_preempt, and rcu_sched). If RCU_BOOST is
 +                      set, valid values are 1-99 and the default is 1
 +                      (the least-favored priority).  Otherwise, when
 +                      RCU_BOOST is not set, valid values are 0-99 and
 +                      the default is zero (non-realtime operation).
  
        rcutree.rcu_nocb_leader_stride= [KNL]
                        Set the number of NOCB kthread groups, which
                        improve throughput, but will also increase the
                        amount of memory reserved for use by the client.
  
 +      suspend.pm_test_delay=
 +                      [SUSPEND]
 +                      Sets the number of seconds to remain in a suspend test
 +                      mode before resuming the system (see
 +                      /sys/power/pm_test). Only available when CONFIG_PM_DEBUG
 +                      is set. Default value is 5.
 +
        swapaccount=[0|1]
                        [KNL] Enable accounting of swap in memory resource
                        controller if no parameter or 1 is given or disable
diff --combined arch/mips/Kconfig
index a326c4cb8cf0e65f8e75eb4fb2c9e0b124f1d52e,1c971be1b985e97b78e598b3c6be8a51cc65e571..2198837c256fd63b33d33817fba12e762c88abfa
@@@ -23,7 -23,7 +23,7 @@@ config MIP
        select HAVE_KRETPROBES
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_SYSCALL_TRACEPOINTS
 -      select ARCH_BINFMT_ELF_RANDOMIZE_PIE
 +      select ARCH_HAS_ELF_RANDOMIZE
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT
        select RTC_LIB if !MACH_LOONGSON
        select GENERIC_ATOMIC64 if !64BIT
@@@ -43,6 -43,7 +43,7 @@@
        select GENERIC_SMP_IDLE_THREAD
        select BUILDTIME_EXTABLE_SORT
        select GENERIC_CLOCKEVENTS
+       select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
        select GENERIC_CMOS_UPDATE
        select HAVE_MOD_ARCH_SPECIFIC
        select VIRT_TO_BUS
@@@ -55,6 -56,8 +56,8 @@@
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_BINFMT_ELF_STATE
        select SYSCTL_EXCEPTION_TRACE
+       select HAVE_VIRT_CPU_ACCOUNTING_GEN
+       select HAVE_IRQ_TIME_ACCOUNTING
  
  menu "Machine selection"
  
@@@ -131,8 -134,8 +134,8 @@@ config ATH7
        help
          Support for the Atheros AR71XX/AR724X/AR913X SoCs.
  
- config BCM3384
-       bool "Broadcom BCM3384 based boards"
+ config BMIPS_GENERIC
+       bool "Broadcom Generic BMIPS kernel"
        select BOOT_RAW
        select NO_EXCEPT_FILL
        select USE_OF
        select CSRC_R4K
        select SYNC_R4K
        select COMMON_CLK
-       select DMA_NONCOHERENT
+       select BCM7038_L1_IRQ
+       select BCM7120_L2_IRQ
+       select BRCMSTB_L2_IRQ
        select IRQ_CPU
+       select RAW_IRQ_ACCESSORS
+       select DMA_NONCOHERENT
        select SYS_SUPPORTS_32BIT_KERNEL
+       select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_HIGHMEM
+       select SYS_HAS_CPU_BMIPS32_3300
+       select SYS_HAS_CPU_BMIPS4350
+       select SYS_HAS_CPU_BMIPS4380
        select SYS_HAS_CPU_BMIPS5000
        select SWAP_IO_SPACE
-       select USB_EHCI_BIG_ENDIAN_DESC
-       select USB_EHCI_BIG_ENDIAN_MMIO
-       select USB_OHCI_BIG_ENDIAN_DESC
-       select USB_OHCI_BIG_ENDIAN_MMIO
+       select USB_EHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
+       select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
+       select USB_OHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
+       select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
        help
-         Support for BCM3384 based boards.  BCM3384/BCM33843 is a cable modem
-         chipset with a Linux application processor that is often used to
-         provide Samba services, a CUPS print server, and/or advanced routing
-         features.
+         Build a generic DT-based kernel image that boots on select
+         BCM33xx cable modem chips, BCM63xx DSL chips, and BCM7xxx set-top
+         box chips.  Note that CONFIG_CPU_BIG_ENDIAN/CONFIG_CPU_LITTLE_ENDIAN
+         must be set appropriately for your board.
  
  config BCM47XX
        bool "Broadcom BCM47XX based boards"
@@@ -352,6 -363,33 +363,33 @@@ config MACH_LOONGSON
          the ICT (Institute of Computing Technology) and the Chinese Academy
          of Sciences.
  
+ config MACH_PISTACHIO
+       bool "IMG Pistachio SoC based boards"
+       select ARCH_REQUIRE_GPIOLIB
+       select BOOT_ELF32
+       select BOOT_RAW
+       select CEVT_R4K
+       select CLKSRC_MIPS_GIC
+       select COMMON_CLK
+       select CSRC_R4K
+       select DMA_MAYBE_COHERENT
+       select IRQ_CPU
+       select LIBFDT
+       select MFD_SYSCON
+       select MIPS_CPU_SCACHE
+       select MIPS_GIC
+       select PINCTRL
+       select REGULATOR
+       select SYS_HAS_CPU_MIPS32_R2
+       select SYS_SUPPORTS_32BIT_KERNEL
+       select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_SUPPORTS_MIPS_CPS
+       select SYS_SUPPORTS_MULTITHREADING
+       select SYS_SUPPORTS_ZBOOT
+       select USE_OF
+       help
+         This enables support for the IMG Pistachio SoC platform.
  config MIPS_MALTA
        bool "MIPS Malta board"
        select ARCH_MAY_HAVE_PC_FDC
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_HAS_CPU_MIPS32_R2
        select SYS_HAS_CPU_MIPS32_R3_5
+       select SYS_HAS_CPU_MIPS32_R5
        select SYS_HAS_CPU_MIPS32_R6
        select SYS_HAS_CPU_MIPS64_R1
        select SYS_HAS_CPU_MIPS64_R2
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
+       select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_MICROMIPS
        select SYS_SUPPORTS_MIPS_CMP
@@@ -779,7 -819,8 +819,8 @@@ config CAVIUM_OCTEON_SO
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select EDAC_SUPPORT
-       select SYS_SUPPORTS_HOTPLUG_CPU
+       select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_SUPPORTS_HOTPLUG_CPU if CPU_BIG_ENDIAN
        select SYS_HAS_EARLY_PRINTK
        select SYS_HAS_CPU_CAVIUM_OCTEON
        select SWAP_IO_SPACE
        select SYS_SUPPORTS_SMP
        select NR_CPUS_DEFAULT_16
        select BUILTIN_DTB
+       select MTD_COMPLEX_MAPPINGS
        help
          This option supports all of the Octeon reference boards from Cavium
          Networks. It builds a kernel that dynamically determines the Octeon
@@@ -887,6 -929,7 +929,7 @@@ source "arch/mips/ath25/Kconfig
  source "arch/mips/ath79/Kconfig"
  source "arch/mips/bcm47xx/Kconfig"
  source "arch/mips/bcm63xx/Kconfig"
+ source "arch/mips/bmips/Kconfig"
  source "arch/mips/jazz/Kconfig"
  source "arch/mips/jz4740/Kconfig"
  source "arch/mips/lantiq/Kconfig"
@@@ -1202,10 -1245,10 +1245,10 @@@ config MIPS_L1_CACHE_SHIFT_
  
  config MIPS_L1_CACHE_SHIFT
        int
-       default "4" if MIPS_L1_CACHE_SHIFT_4
-       default "5" if MIPS_L1_CACHE_SHIFT_5
-       default "6" if MIPS_L1_CACHE_SHIFT_6
        default "7" if MIPS_L1_CACHE_SHIFT_7
+       default "6" if MIPS_L1_CACHE_SHIFT_6
+       default "5" if MIPS_L1_CACHE_SHIFT_5
+       default "4" if MIPS_L1_CACHE_SHIFT_4
        default "5"
  
  config HAVE_STD_PC_SERIAL_PORT
@@@ -1572,6 -1615,7 +1615,7 @@@ config CPU_XL
        select WEAK_REORDERING_BEYOND_LLSC
        select CPU_HAS_PREFETCH
        select CPU_MIPSR2
+       select CPU_SUPPORTS_HUGEPAGES
        help
          Netlogic Microsystems XLP processors.
  endchoice
@@@ -1596,6 -1640,33 +1640,33 @@@ config CPU_MIPS32_3_5_EV
          One of its primary benefits is an increase in the maximum size
          of lowmem (up to 3GB). If unsure, say 'N' here.
  
+ config CPU_MIPS32_R5_FEATURES
+       bool "MIPS32 Release 5 Features"
+       depends on SYS_HAS_CPU_MIPS32_R5
+       depends on CPU_MIPS32_R2
+       help
+         Choose this option to build a kernel for release 2 or later of the
+         MIPS32 architecture including features from release 5 such as
+         support for Extended Physical Addressing (XPA).
+ config CPU_MIPS32_R5_XPA
+       bool "Extended Physical Addressing (XPA)"
+       depends on CPU_MIPS32_R5_FEATURES
+       depends on !EVA
+       depends on !PAGE_SIZE_4KB
+       depends on SYS_SUPPORTS_HIGHMEM
+       select XPA
+       select HIGHMEM
+       select ARCH_PHYS_ADDR_T_64BIT
+       default n
+       help
+         Choose this option if you want to enable the Extended Physical
+         Addressing (XPA) on your MIPS32 core (such as P5600 series). The
+         benefit is to increase physical addressing equal to or greater
+         than 40 bits. Note that this has the side effect of turning on
+         64-bit addressing which in turn makes the PTEs 64-bit in size.
+         If unsure, say 'N' here.
  if CPU_LOONGSON2F
  config CPU_NOP_WORKAROUNDS
        bool
@@@ -1699,6 -1770,9 +1770,9 @@@ config SYS_HAS_CPU_MIPS32_R
  config SYS_HAS_CPU_MIPS32_R3_5
        bool
  
+ config SYS_HAS_CPU_MIPS32_R5
+       bool
  config SYS_HAS_CPU_MIPS32_R6
        bool
  
@@@ -1836,6 -1910,9 +1910,9 @@@ config CPU_MIPSR
  config EVA
        bool
  
+ config XPA
+       bool
  config SYS_SUPPORTS_32BIT_KERNEL
        bool
  config SYS_SUPPORTS_64BIT_KERNEL
@@@ -2072,7 -2149,7 +2149,7 @@@ config MIPSR2_TO_R6_EMULATO
        help
          Choose this option if you want to run non-R6 MIPS userland code.
          Even if you say 'Y' here, the emulator will still be disabled by
-         default. You can enable it using the 'mipsr2emul' kernel option.
+         default. You can enable it using the 'mipsr2emu' kernel option.
          The only reason this is a build-time option is to save ~14K from the
          final kernel image.
  comment "MIPS R2-to-R6 emulator is only available for UP kernels"
@@@ -2142,7 -2219,7 +2219,7 @@@ config MIPS_CM
  
  config MIPS_CPS
        bool "MIPS Coherent Processing System support"
-       depends on SYS_SUPPORTS_MIPS_CPS
+       depends on SYS_SUPPORTS_MIPS_CPS && !64BIT
        select MIPS_CM
        select MIPS_CPC
        select MIPS_CPS_PM if HOTPLUG_CPU
@@@ -2348,7 -2425,7 +2425,7 @@@ config NODES_SHIF
  
  config HW_PERF_EVENTS
        bool "Enable hardware performance counter support for perf events"
-       depends on PERF_EVENTS && OPROFILE=n && (CPU_MIPS32 || CPU_MIPS64 || CPU_R10000 || CPU_SB1 || CPU_CAVIUM_OCTEON || CPU_XLP)
+       depends on PERF_EVENTS && OPROFILE=n && (CPU_MIPS32 || CPU_MIPS64 || CPU_R10000 || CPU_SB1 || CPU_CAVIUM_OCTEON || CPU_XLP || CPU_LOONGSON3)
        default y
        help
          Enable hardware performance counter support for perf events. If
@@@ -2500,6 -2577,9 +2577,9 @@@ config H
        default 1000 if HZ_1000
        default 1024 if HZ_1024
  
+ config SCHED_HRTICK
+       def_bool HIGH_RES_TIMERS
  source "kernel/Kconfig.preempt"
  
  config KEXEC
@@@ -2600,11 -2680,6 +2680,11 @@@ config STACKTRACE_SUPPOR
        bool
        default y
  
 +config PGTABLE_LEVELS
 +      int
 +      default 3 if 64BIT && !PAGE_SIZE_64KB
 +      default 2
 +
  source "init/Kconfig"
  
  source "kernel/Kconfig.freezer"
diff --combined arch/mips/Makefile
index d152dfbc360dcf0d58e0b2ea0aa3572440583d70,198fd8d120a0cbc1e6e9333b44937b4fdc24578c..5200f649dd4e3005423a81b4c608fc4ac49d2321
@@@ -197,11 -197,17 +197,17 @@@ endi
  # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
  # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
  # been fixed properly.
- mips-cflags                           := "$(cflags-y)"
- cflags-$(CONFIG_CPU_HAS_SMARTMIPS)    += $(call cc-option,$(mips-cflags),-msmartmips) -Wa,--no-warn
- cflags-$(CONFIG_CPU_MICROMIPS)                += $(call cc-option,$(mips-cflags),-mmicromips)
+ mips-cflags                           := $(cflags-y)
+ ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y)
+ smartmips-ase                         := $(call cc-option-yn,$(mips-cflags) -msmartmips)
+ cflags-$(smartmips-ase)                       += -msmartmips -Wa,--no-warn
+ endif
+ ifeq ($(CONFIG_CPU_MICROMIPS),y)
+ micromips-ase                         := $(call cc-option-yn,$(mips-cflags) -mmicromips)
+ cflags-$(micromips-ase)                       += -mmicromips
+ endif
  ifeq ($(CONFIG_CPU_HAS_MSA),y)
- toolchain-msa                         := $(call cc-option-yn,-$(mips-cflags),mhard-float -mfp64 -Wa$(comma)-mmsa)
+ toolchain-msa                         := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa)
  cflags-$(toolchain-msa)                       += -DTOOLCHAIN_SUPPORTS_MSA
  endif
  
@@@ -225,7 -231,7 +231,7 @@@ endi
  #
  # Board-dependent options and extra files
  #
 -include $(srctree)/arch/mips/Kbuild.platforms
 +include arch/mips/Kbuild.platforms
  
  ifdef CONFIG_PHYSICAL_START
  load-y                                        = $(CONFIG_PHYSICAL_START)
@@@ -365,7 -371,11 +371,11 @@@ core-$(CONFIG_BUILTIN_DTB) += arch/mips
  
  PHONY += dtbs
  dtbs: scripts
-       $(Q)$(MAKE) $(build)=arch/mips/boot/dts dtbs
+       $(Q)$(MAKE) $(build)=arch/mips/boot/dts
+ PHONY += dtbs_install
+ dtbs_install:
+       $(Q)$(MAKE) $(dtbinst)=arch/mips/boot/dts
  
  archprepare:
  ifdef CONFIG_MIPS32_N32
@@@ -407,6 -417,7 +417,7 @@@ define archhel
        echo '  uImage.lzma          - U-Boot image (lzma)'
        echo '  uImage.lzo           - U-Boot image (lzo)'
        echo '  dtbs                 - Device-tree blobs for enabled boards'
+       echo '  dtbs_install         - Install dtbs to $(INSTALL_DTBS_PATH)'
        echo
        echo '  These will be default as appropriate for a configured platform.'
  endef
index 3550725351101e5bf32f75ddb30cd146a56ffb46,df6912ec1f5774ae91ef09fef7f2fa78ea063324..7315cc307397b8dc851d6c3d2cd18b4d30152de5
@@@ -33,7 -33,7 +33,7 @@@ do {                                                  
        __asm__ __volatile__ (                          \
        "dmtc2 %[rt],0x0048+" STR(index)                \
        :                                               \
-       : [rt] "d" (value));                            \
+       : [rt] "d" (cpu_to_be64(value)));               \
  } while (0)
  
  /*
@@@ -48,7 -48,7 +48,7 @@@
        : [rt] "=d" (__value)                           \
        : );                                            \
                                                        \
-       __value;                                        \
+       be64_to_cpu(__value);                           \
  })
  
  /*
@@@ -59,7 -59,7 +59,7 @@@ do {                                                  
        __asm__ __volatile__ (                          \
        "dmtc2 %[rt],0x0040+" STR(index)                \
        :                                               \
-       : [rt] "d" (value));                            \
+       : [rt] "d" (cpu_to_be64(value)));               \
  } while (0)
  
  /*
@@@ -70,20 -70,20 +70,94 @@@ do {                                                       
        __asm__ __volatile__ (                          \
        "dmtc2 %[rt],0x4047"                            \
        :                                               \
+       : [rt] "d" (cpu_to_be64(value)));               \
+ } while (0)
+ /*
+  * The value is the final block dword (64-bit).
+  */
+ #define octeon_sha1_start(value)                      \
+ do {                                                  \
+       __asm__ __volatile__ (                          \
+       "dmtc2 %[rt],0x4057"                            \
+       :                                               \
+       : [rt] "d" (value));                            \
+ } while (0)
++/*
++ * The value is the final block dword (64-bit).
++ */
++#define octeon_sha256_start(value)                    \
++do {                                                  \
++      __asm__ __volatile__ (                          \
++      "dmtc2 %[rt],0x404f"                            \
++      :                                               \
++      : [rt] "d" (value));                            \
++} while (0)
++
++/*
++ * Macros needed to implement SHA512:
++ */
++
++/*
++ * The index can be 0-7.
++ */
++#define write_octeon_64bit_hash_sha512(value, index)  \
++do {                                                  \
++      __asm__ __volatile__ (                          \
++      "dmtc2 %[rt],0x0250+" STR(index)                \
++      :                                               \
++      : [rt] "d" (value));                            \
++} while (0)
++
++/*
++ * The index can be 0-7.
++ */
++#define read_octeon_64bit_hash_sha512(index)          \
++({                                                    \
++      u64 __value;                                    \
++                                                      \
++      __asm__ __volatile__ (                          \
++      "dmfc2 %[rt],0x0250+" STR(index)                \
++      : [rt] "=d" (__value)                           \
++      : );                                            \
++                                                      \
++      __value;                                        \
++})
++
++/*
++ * The index can be 0-14.
++ */
++#define write_octeon_64bit_block_sha512(value, index) \
++do {                                                  \
++      __asm__ __volatile__ (                          \
++      "dmtc2 %[rt],0x0240+" STR(index)                \
++      :                                               \
++      : [rt] "d" (value));                            \
++} while (0)
++
++/*
++ * The value is the final block word (64-bit).
++ */
++#define octeon_sha512_start(value)                    \
++do {                                                  \
++      __asm__ __volatile__ (                          \
++      "dmtc2 %[rt],0x424f"                            \
++      :                                               \
 +      : [rt] "d" (value));                            \
 +} while (0)
 +
 +/*
 + * The value is the final block dword (64-bit).
 + */
 +#define octeon_sha1_start(value)                      \
 +do {                                                  \
 +      __asm__ __volatile__ (                          \
 +      "dmtc2 %[rt],0x4057"                            \
 +      :                                               \
 +      : [rt] "d" (value));                            \
 +} while (0)
 +
  /*
   * The value is the final block dword (64-bit).
   */
index 31d747d46a23c1ba76b97755f44d1f20203028f6,9a74248e782132ff34ef9c7faf2669e389ba139e..a594d8ed96980cd1e96c8bf3eb593368203fe53c
@@@ -11,6 -11,9 +11,9 @@@
  #include <linux/fs.h>
  #include <uapi/linux/elf.h>
  
+ #include <asm/cpu-info.h>
+ #include <asm/current.h>
  /* ELF header e_flags defines. */
  /* MIPS architecture level. */
  #define EF_MIPS_ARCH_1                0x00000000      /* -mips1 code.  */
@@@ -294,9 -297,14 +297,14 @@@ do {                                                                     
        if (personality(current->personality) != PER_LINUX)             \
                set_personality(PER_LINUX);                             \
                                                                        \
+       clear_thread_flag(TIF_HYBRID_FPREGS);                           \
+       set_thread_flag(TIF_32BIT_FPREGS);                              \
+                                                                       \
        mips_set_personality_fp(state);                                 \
                                                                        \
        current->thread.abi = &mips_abi;                                \
+                                                                       \
+       current->thread.fpu.fcr31 = current_cpu_data.fpu_csr31;         \
  } while (0)
  
  #endif /* CONFIG_32BIT */
        do {                                                            \
                set_thread_flag(TIF_32BIT_REGS);                        \
                set_thread_flag(TIF_32BIT_ADDR);                        \
+               clear_thread_flag(TIF_HYBRID_FPREGS);                   \
+               set_thread_flag(TIF_32BIT_FPREGS);                      \
                                                                        \
                mips_set_personality_fp(state);                         \
                                                                        \
@@@ -356,6 -366,8 +366,8 @@@ do {                                                                       
        else                                                            \
                current->thread.abi = &mips_abi;                        \
                                                                        \
+       current->thread.fpu.fcr31 = current_cpu_data.fpu_csr31;         \
+                                                                       \
        p = personality(current->personality);                          \
        if (p != PER_LINUX32 && p != PER_LINUX)                         \
                set_personality(PER_LINUX);                             \
@@@ -410,6 -422,10 +422,6 @@@ struct linux_binprm
  extern int arch_setup_additional_pages(struct linux_binprm *bprm,
                                       int uses_interp);
  
 -struct mm_struct;
 -extern unsigned long arch_randomize_brk(struct mm_struct *mm);
 -#define arch_randomize_brk arch_randomize_brk
 -
  struct arch_elf_state {
        int fp_abi;
        int interp_fp_abi;
index 8408a30c47f33f826503488c5d25230ec6deaf66,2f0dba36e0a84a40effb2f1ee05f12acf3676503..9c0014e87c1746fbe23555d7f2cd72885d1b68a5
@@@ -23,6 -23,7 +23,6 @@@
   */
  struct thread_info {
        struct task_struct      *task;          /* main task structure */
 -      struct exec_domain      *exec_domain;   /* execution domain */
        unsigned long           flags;          /* low level flags */
        unsigned long           tp_value;       /* thread pointer */
        __u32                   cpu;            /* current CPU */
@@@ -43,6 -44,7 +43,6 @@@
  #define INIT_THREAD_INFO(tsk)                 \
  {                                             \
        .task           = &tsk,                 \
 -      .exec_domain    = &default_exec_domain, \
        .flags          = _TIF_FIXADE,          \
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
  #define init_stack            (init_thread_union.stack)
  
  /* How to get the thread information struct from C.  */
+ register struct thread_info *__current_thread_info __asm__("$28");
  static inline struct thread_info *current_thread_info(void)
  {
-       register struct thread_info *__current_thread_info __asm__("$28");
        return __current_thread_info;
  }
  
diff --combined arch/mips/kernel/traps.c
index 5b4d711f878da251a101526671a80283503736a4,7d5532adc890bb2e502771e4b013a835ab46a51a..e334c641a81b3d30bc9a90e2de98604f76993dc4
@@@ -12,6 -12,7 +12,7 @@@
   * Copyright (C) 2000, 2001, 2012 MIPS Technologies, Inc.  All rights reserved.
   * Copyright (C) 2014, Imagination Technologies Ltd.
   */
+ #include <linux/bitops.h>
  #include <linux/bug.h>
  #include <linux/compiler.h>
  #include <linux/context_tracking.h>
@@@ -699,36 -700,60 +700,60 @@@ asmlinkage void do_ov(struct pt_regs *r
        exception_exit(prev_state);
  }
  
- int process_fpemu_return(int sig, void __user *fault_addr)
+ int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcr31)
  {
-       /*
-        * We can't allow the emulated instruction to leave any of the cause
-        * bits set in FCSR. If they were then the kernel would take an FP
-        * exception when restoring FP context.
-        */
-       current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
+       struct siginfo si = { 0 };
+       switch (sig) {
+       case 0:
+               return 0;
  
-       if (sig == SIGSEGV || sig == SIGBUS) {
-               struct siginfo si = {0};
+       case SIGFPE:
                si.si_addr = fault_addr;
                si.si_signo = sig;
-               if (sig == SIGSEGV) {
-                       down_read(&current->mm->mmap_sem);
-                       if (find_vma(current->mm, (unsigned long)fault_addr))
-                               si.si_code = SEGV_ACCERR;
-                       else
-                               si.si_code = SEGV_MAPERR;
-                       up_read(&current->mm->mmap_sem);
-               } else {
-                       si.si_code = BUS_ADRERR;
-               }
+               /*
+                * Inexact can happen together with Overflow or Underflow.
+                * Respect the mask to deliver the correct exception.
+                */
+               fcr31 &= (fcr31 & FPU_CSR_ALL_E) <<
+                        (ffs(FPU_CSR_ALL_X) - ffs(FPU_CSR_ALL_E));
+               if (fcr31 & FPU_CSR_INV_X)
+                       si.si_code = FPE_FLTINV;
+               else if (fcr31 & FPU_CSR_DIV_X)
+                       si.si_code = FPE_FLTDIV;
+               else if (fcr31 & FPU_CSR_OVF_X)
+                       si.si_code = FPE_FLTOVF;
+               else if (fcr31 & FPU_CSR_UDF_X)
+                       si.si_code = FPE_FLTUND;
+               else if (fcr31 & FPU_CSR_INE_X)
+                       si.si_code = FPE_FLTRES;
+               else
+                       si.si_code = __SI_FAULT;
                force_sig_info(sig, &si, current);
                return 1;
-       } else if (sig) {
+       case SIGBUS:
+               si.si_addr = fault_addr;
+               si.si_signo = sig;
+               si.si_code = BUS_ADRERR;
+               force_sig_info(sig, &si, current);
+               return 1;
+       case SIGSEGV:
+               si.si_addr = fault_addr;
+               si.si_signo = sig;
+               down_read(&current->mm->mmap_sem);
+               if (find_vma(current->mm, (unsigned long)fault_addr))
+                       si.si_code = SEGV_ACCERR;
+               else
+                       si.si_code = SEGV_MAPERR;
+               up_read(&current->mm->mmap_sem);
+               force_sig_info(sig, &si, current);
+               return 1;
+       default:
                force_sig(sig, current);
                return 1;
-       } else {
-               return 0;
        }
  }
  
@@@ -736,7 -761,8 +761,8 @@@ static int simulate_fp(struct pt_regs *
                       unsigned long old_epc, unsigned long old_ra)
  {
        union mips_instruction inst = { .word = opcode };
-       void __user *fault_addr = NULL;
+       void __user *fault_addr;
+       unsigned long fcr31;
        int sig;
  
        /* If it's obviously not an FP instruction, skip it */
        /* Run the emulator */
        sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1,
                                       &fault_addr);
+       fcr31 = current->thread.fpu.fcr31;
  
-       /* If something went wrong, signal */
-       process_fpemu_return(sig, fault_addr);
+       /*
+        * We can't allow the emulated instruction to leave any of
+        * the cause bits set in $fcr31.
+        */
+       current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
  
        /* Restore the hardware register state */
        own_fpu(1);
  
+       /* Send a signal if required.  */
+       process_fpemu_return(sig, fault_addr, fcr31);
        return 0;
  }
  
  asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
  {
        enum ctx_state prev_state;
-       siginfo_t info = {0};
+       void __user *fault_addr;
+       int sig;
  
        prev_state = exception_enter();
        if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs),
                       SIGFPE) == NOTIFY_STOP)
                goto out;
 +
 +      /* Clear FCSR.Cause before enabling interrupts */
 +      write_32bit_cp1_register(CP1_STATUS, fcr31 & ~FPU_CSR_ALL_X);
 +      local_irq_enable();
 +
        die_if_kernel("FP exception in kernel code", regs);
  
        if (fcr31 & FPU_CSR_UNI_X) {
-               int sig;
-               void __user *fault_addr = NULL;
                /*
                 * Unimplemented operation exception.  If we've got the full
                 * software emulator on-board, let's use it...
                /* Run the emulator */
                sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1,
                                               &fault_addr);
+               fcr31 = current->thread.fpu.fcr31;
  
-               /* If something went wrong, signal */
-               process_fpemu_return(sig, fault_addr);
+               /*
+                * We can't allow the emulated instruction to leave any of
+                * the cause bits set in $fcr31.
+                */
+               current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
  
                /* Restore the hardware register state */
                own_fpu(1);     /* Using the FPU again.  */
+       } else {
+               sig = SIGFPE;
+               fault_addr = (void __user *) regs->cp0_epc;
+       }
  
-               goto out;
-       } else if (fcr31 & FPU_CSR_INV_X)
-               info.si_code = FPE_FLTINV;
-       else if (fcr31 & FPU_CSR_DIV_X)
-               info.si_code = FPE_FLTDIV;
-       else if (fcr31 & FPU_CSR_OVF_X)
-               info.si_code = FPE_FLTOVF;
-       else if (fcr31 & FPU_CSR_UDF_X)
-               info.si_code = FPE_FLTUND;
-       else if (fcr31 & FPU_CSR_INE_X)
-               info.si_code = FPE_FLTRES;
-       else
-               info.si_code = __SI_FAULT;
-       info.si_signo = SIGFPE;
-       info.si_errno = 0;
-       info.si_addr = (void __user *) regs->cp0_epc;
-       force_sig_info(SIGFPE, &info, current);
+       /* Send a signal if required.  */
+       process_fpemu_return(sig, fault_addr, fcr31);
  
  out:
        exception_exit(prev_state);
@@@ -885,9 -904,9 +909,9 @@@ void do_trap_or_bp(struct pt_regs *regs
                break;
        case BRK_MEMU:
                /*
-                * Address errors may be deliberately induced by the FPU
-                * emulator to retake control of the CPU after executing the
-                * instruction in the delay slot of an emulated branch.
+                * This breakpoint code is used by the FPU emulator to retake
+                * control of the CPU after executing the instruction from the
+                * delay slot of an emulated branch.
                 *
                 * Terminate if exception was recognized as a delay slot return
                 * otherwise handle as normal.
  
  asmlinkage void do_bp(struct pt_regs *regs)
  {
+       unsigned long epc = msk_isa16_mode(exception_epc(regs));
        unsigned int opcode, bcode;
        enum ctx_state prev_state;
-       unsigned long epc;
-       u16 instr[2];
        mm_segment_t seg;
  
        seg = get_fs();
  
        prev_state = exception_enter();
        if (get_isa16_mode(regs->cp0_epc)) {
-               /* Calculate EPC. */
-               epc = exception_epc(regs);
-               if (cpu_has_mmips) {
-                       if ((__get_user(instr[0], (u16 __user *)msk_isa16_mode(epc)) ||
-                           (__get_user(instr[1], (u16 __user *)msk_isa16_mode(epc + 2)))))
-                               goto out_sigsegv;
-                       opcode = (instr[0] << 16) | instr[1];
-               } else {
+               u16 instr[2];
+               if (__get_user(instr[0], (u16 __user *)epc))
+                       goto out_sigsegv;
+               if (!cpu_has_mmips) {
                        /* MIPS16e mode */
-                       if (__get_user(instr[0],
-                                      (u16 __user *)msk_isa16_mode(epc)))
+                       bcode = (instr[0] >> 5) & 0x3f;
+               } else if (mm_insn_16bit(instr[0])) {
+                       /* 16-bit microMIPS BREAK */
+                       bcode = instr[0] & 0xf;
+               } else {
+                       /* 32-bit microMIPS BREAK */
+                       if (__get_user(instr[1], (u16 __user *)(epc + 2)))
                                goto out_sigsegv;
-                       bcode = (instr[0] >> 6) & 0x3f;
-                       do_trap_or_bp(regs, bcode, "Break");
-                       goto out;
+                       opcode = (instr[0] << 16) | instr[1];
+                       bcode = (opcode >> 6) & ((1 << 20) - 1);
                }
        } else {
-               if (__get_user(opcode,
-                              (unsigned int __user *) exception_epc(regs)))
+               if (__get_user(opcode, (unsigned int __user *)epc))
                        goto out_sigsegv;
+               bcode = (opcode >> 6) & ((1 << 20) - 1);
        }
  
        /*
         * Gas is bug-compatible, but not always, grrr...
         * We handle both cases with a simple heuristics.  --macro
         */
-       bcode = ((opcode >> 6) & ((1 << 20) - 1));
        if (bcode >= (1 << 10))
-               bcode >>= 10;
+               bcode = ((bcode & ((1 << 10) - 1)) << 10) | (bcode >> 10);
  
        /*
         * notify the kprobe handlers, if instruction is likely to
@@@ -1039,22 -1058,24 +1063,24 @@@ asmlinkage void do_ri(struct pt_regs *r
         * as quickly as possible.
         */
        if (mipsr2_emulation && cpu_has_mips_r6 &&
-           likely(user_mode(regs))) {
-               if (likely(get_user(opcode, epc) >= 0)) {
-                       status = mipsr2_decoder(regs, opcode);
-                       switch (status) {
-                       case 0:
-                       case SIGEMT:
-                               task_thread_info(current)->r2_emul_return = 1;
-                               return;
-                       case SIGILL:
-                               goto no_r2_instr;
-                       default:
-                               process_fpemu_return(status,
-                                                    &current->thread.cp0_baduaddr);
-                               task_thread_info(current)->r2_emul_return = 1;
-                               return;
-                       }
+           likely(user_mode(regs)) &&
+           likely(get_user(opcode, epc) >= 0)) {
+               unsigned long fcr31 = 0;
+               status = mipsr2_decoder(regs, opcode, &fcr31);
+               switch (status) {
+               case 0:
+               case SIGEMT:
+                       task_thread_info(current)->r2_emul_return = 1;
+                       return;
+               case SIGILL:
+                       goto no_r2_instr;
+               default:
+                       process_fpemu_return(status,
+                                            &current->thread.cp0_baduaddr,
+                                            fcr31);
+                       task_thread_info(current)->r2_emul_return = 1;
+                       return;
                }
        }
  
@@@ -1299,10 -1320,13 +1325,13 @@@ asmlinkage void do_cpu(struct pt_regs *
        enum ctx_state prev_state;
        unsigned int __user *epc;
        unsigned long old_epc, old31;
+       void __user *fault_addr;
        unsigned int opcode;
+       unsigned long fcr31;
        unsigned int cpid;
        int status, err;
        unsigned long __maybe_unused flags;
+       int sig;
  
        prev_state = exception_enter();
        cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
                status = -1;
  
                if (unlikely(compute_return_epc(regs) < 0))
-                       goto out;
+                       break;
  
                if (get_isa16_mode(regs->cp0_epc)) {
                        unsigned short mmop[2] = { 0 };
                        force_sig(status, current);
                }
  
-               goto out;
+               break;
  
        case 3:
                /*
-                * Old (MIPS I and MIPS II) processors will set this code
-                * for COP1X opcode instructions that replaced the original
-                * COP3 space.  We don't limit COP1 space instructions in
-                * the emulator according to the CPU ISA, so we want to
-                * treat COP1X instructions consistently regardless of which
-                * code the CPU chose.  Therefore we redirect this trap to
-                * the FP emulator too.
-                *
-                * Then some newer FPU-less processors use this code
-                * erroneously too, so they are covered by this choice
-                * as well.
+                * The COP3 opcode space and consequently the CP0.Status.CU3
+                * bit and the CP0.Cause.CE=3 encoding have been removed as
+                * of the MIPS III ISA.  From the MIPS IV and MIPS32r2 ISAs
+                * up the space has been reused for COP1X instructions, that
+                * are enabled by the CP0.Status.CU1 bit and consequently
+                * use the CP0.Cause.CE=1 encoding for Coprocessor Unusable
+                * exceptions.  Some FPU-less processors that implement one
+                * of these ISAs however use this code erroneously for COP1X
+                * instructions.  Therefore we redirect this trap to the FP
+                * emulator too.
                 */
-               if (raw_cpu_has_fpu)
+               if (raw_cpu_has_fpu || !cpu_has_mips_4_5_64_r2_r6) {
+                       force_sig(SIGILL, current);
                        break;
+               }
                /* Fall through.  */
  
        case 1:
                err = enable_restore_fp_context(0);
  
-               if (!raw_cpu_has_fpu || err) {
-                       int sig;
-                       void __user *fault_addr = NULL;
-                       sig = fpu_emulator_cop1Handler(regs,
-                                                      &current->thread.fpu,
-                                                      0, &fault_addr);
-                       if (!process_fpemu_return(sig, fault_addr) && !err)
-                               mt_ase_fp_affinity();
-               }
+               if (raw_cpu_has_fpu && !err)
+                       break;
  
-               goto out;
+               sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 0,
+                                              &fault_addr);
+               fcr31 = current->thread.fpu.fcr31;
+               /*
+                * We can't allow the emulated instruction to leave
+                * any of the cause bits set in $fcr31.
+                */
+               current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
+               /* Send a signal if required.  */
+               if (!process_fpemu_return(sig, fault_addr, fcr31) && !err)
+                       mt_ase_fp_affinity();
+               break;
  
        case 2:
                raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs);
-               goto out;
+               break;
        }
  
-       force_sig(SIGILL, current);
- out:
        exception_exit(prev_state);
  }
  
 -asmlinkage void do_msa_fpe(struct pt_regs *regs)
 +asmlinkage void do_msa_fpe(struct pt_regs *regs, unsigned int msacsr)
  {
        enum ctx_state prev_state;
  
        prev_state = exception_enter();
 +      if (notify_die(DIE_MSAFP, "MSA FP exception", regs, 0,
 +                     regs_to_trapnr(regs), SIGFPE) == NOTIFY_STOP)
 +              goto out;
 +
 +      /* Clear MSACSR.Cause before enabling interrupts */
 +      write_msa_csr(msacsr & ~MSA_CSR_CAUSEF);
 +      local_irq_enable();
 +
        die_if_kernel("do_msa_fpe invoked from kernel context!", regs);
        force_sig(SIGFPE, current);
 +out:
        exception_exit(prev_state);
  }
  
@@@ -1984,6 -2004,12 +2018,12 @@@ int cp0_compare_irq_shift
  int cp0_perfcount_irq;
  EXPORT_SYMBOL_GPL(cp0_perfcount_irq);
  
+ /*
+  * Fast debug channel IRQ or -1 if not present
+  */
+ int cp0_fdc_irq;
+ EXPORT_SYMBOL_GPL(cp0_fdc_irq);
  static int noulri;
  
  static int __init ulri_disable(char *s)
@@@ -2065,17 -2091,21 +2105,21 @@@ void per_cpu_trap_init(bool is_boot_cpu
         *
         *  o read IntCtl.IPTI to determine the timer interrupt
         *  o read IntCtl.IPPCI to determine the performance counter interrupt
+        *  o read IntCtl.IPFDC to determine the fast debug channel interrupt
         */
        if (cpu_has_mips_r2_r6) {
                cp0_compare_irq_shift = CAUSEB_TI - CAUSEB_IP;
                cp0_compare_irq = (read_c0_intctl() >> INTCTLB_IPTI) & 7;
                cp0_perfcount_irq = (read_c0_intctl() >> INTCTLB_IPPCI) & 7;
-               if (cp0_perfcount_irq == cp0_compare_irq)
-                       cp0_perfcount_irq = -1;
+               cp0_fdc_irq = (read_c0_intctl() >> INTCTLB_IPFDC) & 7;
+               if (!cp0_fdc_irq)
+                       cp0_fdc_irq = -1;
        } else {
                cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
                cp0_compare_irq_shift = CP0_LEGACY_PERFCNT_IRQ;
                cp0_perfcount_irq = -1;
+               cp0_fdc_irq = -1;
        }
  
        if (!cpu_data[cpu].asid_cache)
diff --combined arch/mips/lasat/sysctl.c
index cf9b4633257eb86dd14cea3656b94104ce8d909a,9d65f1ed4f72c13d8f2cafa1fc5dabe27796e9b2..a57959e648a6beb5ec3e21db56512989a3382f78
@@@ -53,21 -53,6 +53,6 @@@ int proc_dolasatstring(struct ctl_tabl
        return 0;
  }
  
- /* proc function to write EEPROM after changing int entry */
- int proc_dolasatint(struct ctl_table *table, int write,
-                      void *buffer, size_t *lenp, loff_t *ppos)
- {
-       int r;
-       r = proc_dointvec(table, write, buffer, lenp, ppos);
-       if ((!write) || r)
-               return r;
-       lasat_write_eeprom_info();
-       return 0;
- }
  #ifdef CONFIG_DS1603
  static int rtctmp;
  
  int proc_dolasatrtc(struct ctl_table *table, int write,
                       void *buffer, size_t *lenp, loff_t *ppos)
  {
 -      struct timespec ts;
 +      struct timespec64 ts;
        int r;
  
        if (!write) {
 -              read_persistent_clock(&ts);
 +              read_persistent_clock64(&ts);
                rtctmp = ts.tv_sec;
                /* check for time < 0 and set to 0 */
                if (rtctmp < 0)
diff --combined arch/mips/pci/pci.c
index 8bb13a4af68a097057f55d9379961a6f0319a4e4,0e3f437e8cadbca654030e195b69d9677d8b497d..b8a0bf5766f2efb64380ae3dedddca3b4782da03
@@@ -91,32 -91,33 +91,35 @@@ static void pcibios_scanbus(struct pci_
  
        pci_add_resource_offset(&resources,
                                hose->mem_resource, hose->mem_offset);
-       pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
+       pci_add_resource_offset(&resources,
+                               hose->io_resource, hose->io_offset);
+       pci_add_resource_offset(&resources,
+                               hose->busn_resource, hose->busn_offset);
        bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
                                &resources);
 -      if (!bus)
 -              pci_free_resource_list(&resources);
 -
        hose->bus = bus;
  
        need_domain_info = need_domain_info || hose->index;
        hose->need_domain_info = need_domain_info;
 -      if (bus) {
 -              next_busno = bus->busn_res.end + 1;
 -              /* Don't allow 8-bit bus number overflow inside the hose -
 -                 reserve some space for bridges. */
 -              if (next_busno > 224) {
 -                      next_busno = 0;
 -                      need_domain_info = 1;
 -              }
 -
 -              if (!pci_has_flag(PCI_PROBE_ONLY)) {
 -                      pci_bus_size_bridges(bus);
 -                      pci_bus_assign_resources(bus);
 -              }
 +
 +      if (!bus) {
 +              pci_free_resource_list(&resources);
 +              return;
 +      }
 +
 +      next_busno = bus->busn_res.end + 1;
 +      /* Don't allow 8-bit bus number overflow inside the hose -
 +         reserve some space for bridges. */
 +      if (next_busno > 224) {
 +              next_busno = 0;
 +              need_domain_info = 1;
 +      }
 +
 +      if (!pci_has_flag(PCI_PROBE_ONLY)) {
 +              pci_bus_size_bridges(bus);
 +              pci_bus_assign_resources(bus);
        }
 +      pci_bus_add_devices(bus);
  }
  
  #ifdef CONFIG_OF
index b522477129a5fe3b021b613a59fd19cb8552909c,94191a19588db51aca791977b4db2af4f2c8e953..0134db2ad0a850ca5f2e07c912fe24e746dda902
@@@ -5,17 -5,13 +5,16 @@@
   *
   * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
   */
- #include <linux/module.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
  #include <linux/serial_8250.h>
 +#include <linux/rtc/ds1685.h>
  
  #include <asm/ip32/mace.h>
  #include <asm/ip32/ip32_ints.h>
  
 +extern void ip32_prepare_poweroff(void);
 +
  #define MACEISA_SERIAL1_OFFS   offsetof(struct sgi_mace, isa.serial1)
  #define MACEISA_SERIAL2_OFFS   offsetof(struct sgi_mace, isa.serial2)
  
@@@ -93,51 -89,18 +92,47 @@@ static __init int sgio2btns_devinit(voi
  
  device_initcall(sgio2btns_devinit);
  
 -static struct resource sgio2_cmos_rsrc[] = {
 +#define MACE_RTC_RES_START (MACE_BASE + offsetof(struct sgi_mace, isa.rtc))
 +#define MACE_RTC_RES_END (MACE_RTC_RES_START + 32767)
 +
 +static struct resource ip32_rtc_resources[] = {
        {
 -              .start = 0x70,
 -              .end   = 0x71,
 -              .flags = IORESOURCE_IO
 +              .start  = MACEISA_RTC_IRQ,
 +              .end    = MACEISA_RTC_IRQ,
 +              .flags  = IORESOURCE_IRQ
 +      }, {
 +              .start  = MACE_RTC_RES_START,
 +              .end    = MACE_RTC_RES_END,
 +              .flags  = IORESOURCE_MEM,
        }
  };
  
 -static __init int sgio2_cmos_devinit(void)
 +/* RTC registers on IP32 are each padded by 256 bytes (0x100). */
 +static struct ds1685_rtc_platform_data
 +ip32_rtc_platform_data[] = {
 +      {
 +              .regstep = 0x100,
 +              .bcd_mode = true,
 +              .no_irq = false,
 +              .uie_unsupported = false,
 +              .alloc_io_resources = true,
 +              .plat_prepare_poweroff = ip32_prepare_poweroff,
 +      },
 +};
 +
 +struct platform_device ip32_rtc_device = {
 +      .name                   = "rtc-ds1685",
 +      .id                     = -1,
 +      .dev                    = {
 +              .platform_data  = ip32_rtc_platform_data,
 +      },
 +      .num_resources          = ARRAY_SIZE(ip32_rtc_resources),
 +      .resource               = ip32_rtc_resources,
 +};
 +
 ++static int __init sgio2_rtc_devinit(void)
  {
 -      return IS_ERR(platform_device_register_simple("rtc_cmos", -1,
 -                                                    sgio2_cmos_rsrc, 1));
 +      return platform_device_register(&ip32_rtc_device);
  }
  
  device_initcall(sgio2_cmos_devinit);
- MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
- MODULE_LICENSE("GPL");
- MODULE_DESCRIPTION("8250 UART probe driver for SGI IP32 aka O2");
index a0b036ccb118b1fc23fa07907f17196c80a15a54,7e7146f735c6821afe5f79b6b7b75cfb1668b027..b4ac7cfae4418d3ed904db7e697078ffa00cab86
@@@ -192,7 -192,6 +192,7 @@@ config SYS_SUPPORTS_EM_ST
  config SH_TIMER_CMT
        bool "Renesas CMT timer driver" if COMPILE_TEST
        depends on GENERIC_CLOCKEVENTS
 +      depends on HAS_IOMEM
        default SYS_SUPPORTS_SH_CMT
        help
          This enables build of a clocksource and clockevent driver for
  config SH_TIMER_MTU2
        bool "Renesas MTU2 timer driver" if COMPILE_TEST
        depends on GENERIC_CLOCKEVENTS
 +      depends on HAS_IOMEM
        default SYS_SUPPORTS_SH_MTU2
        help
          This enables build of a clockevent driver for the Multi-Function
  config SH_TIMER_TMU
        bool "Renesas TMU timer driver" if COMPILE_TEST
        depends on GENERIC_CLOCKEVENTS
 +      depends on HAS_IOMEM
        default SYS_SUPPORTS_SH_TMU
        help
          This enables build of a clocksource and clockevent driver for
@@@ -233,7 -230,7 +233,7 @@@ config CLKSRC_QCO
  
  config CLKSRC_VERSATILE
        bool "ARM Versatile (Express) reference platforms clock source"
-       depends on GENERIC_SCHED_CLOCK && !ARCH_USES_GETTIMEOFFSET
+       depends on PLAT_VERSATILE && GENERIC_SCHED_CLOCK && !ARCH_USES_GETTIMEOFFSET
        select CLKSRC_OF
        default y if MFD_VEXPRESS_SYSREG
        help
diff --combined drivers/irqchip/Kconfig
index c8d260e33a90d340cdb0a98d23eb1d289ba86160,241a5b2dd6a1e4381cd62042d111db5a52221e76..6de62a96e79c80e9d442ca07f53549cf334f8c7c
@@@ -60,6 -60,11 +60,11 @@@ config ATMEL_AIC5_IR
        select MULTI_IRQ_HANDLER
        select SPARSE_IRQ
  
+ config BCM7038_L1_IRQ
+       bool
+       select GENERIC_IRQ_CHIP
+       select IRQ_DOMAIN
  config BCM7120_L2_IRQ
        bool
        select GENERIC_IRQ_CHIP
@@@ -110,13 -115,6 +115,13 @@@ config RENESAS_IRQ
        bool
        select IRQ_DOMAIN
  
 +config ST_IRQCHIP
 +      bool
 +      select REGMAP
 +      select MFD_SYSCON
 +      help
 +        Enables SysCfg Controlled IRQs on STi based platforms.
 +
  config TB10X_IRQC
        bool
        select IRQ_DOMAIN
diff --combined drivers/irqchip/Makefile
index 552a740276015179dd170e65d82f2f4983a72ddb,89e45613de766d6e969ff343964f26aaa10e9602..dda4927e47a6a98fab0a66a8c8416b252096533b
@@@ -6,7 -6,6 +6,7 @@@ obj-$(CONFIG_ARCH_HIP04)         += irq-hip04.
  obj-$(CONFIG_ARCH_MMP)                        += irq-mmp.o
  obj-$(CONFIG_ARCH_MVEBU)              += irq-armada-370-xp.o
  obj-$(CONFIG_ARCH_MXS)                        += irq-mxs.o
 +obj-$(CONFIG_ARCH_TEGRA)              += irq-tegra.o
  obj-$(CONFIG_ARCH_S3C24XX)            += irq-s3c24xx.o
  obj-$(CONFIG_DW_APB_ICTL)             += irq-dw-apb-ictl.o
  obj-$(CONFIG_METAG)                   += irq-metag-ext.o
@@@ -34,12 -33,11 +34,13 @@@ obj-$(CONFIG_RENESAS_IRQC)         += irq-rene
  obj-$(CONFIG_VERSATILE_FPGA_IRQ)      += irq-versatile-fpga.o
  obj-$(CONFIG_ARCH_NSPIRE)             += irq-zevio.o
  obj-$(CONFIG_ARCH_VT8500)             += irq-vt8500.o
 +obj-$(CONFIG_ST_IRQCHIP)              += irq-st.o
  obj-$(CONFIG_TB10X_IRQC)              += irq-tb10x.o
  obj-$(CONFIG_XTENSA)                  += irq-xtensa-pic.o
  obj-$(CONFIG_XTENSA_MX)                       += irq-xtensa-mx.o
  obj-$(CONFIG_IRQ_CROSSBAR)            += irq-crossbar.o
 +obj-$(CONFIG_SOC_VF610)                       += irq-vf610-mscm-ir.o
+ obj-$(CONFIG_BCM7038_L1_IRQ)          += irq-bcm7038-l1.o
  obj-$(CONFIG_BCM7120_L2_IRQ)          += irq-bcm7120-l2.o
  obj-$(CONFIG_BRCMSTB_L2_IRQ)          += irq-brcmstb-l2.o
  obj-$(CONFIG_KEYSTONE_IRQ)            += irq-keystone.o
index 5cb93d1f50a482c1aa3f7f855ca77d1d8b385740,be059df8c85242ae420de0bd8befcf0a1d58998f..de77d3a74abc82f0c8b77dff3200799e70634674
  #include <linux/etherdevice.h>
  #include <linux/mii.h>
  #include <linux/phy.h>
 +#include <linux/phy_fixed.h>
  #include <linux/interrupt.h>
  #include <linux/dma-mapping.h>
- #include <bcm47xx_nvram.h>
+ #include <linux/bcm47xx_nvram.h>
  
  static const struct bcma_device_id bgmac_bcma_tbl[] = {
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
@@@ -115,89 -114,54 +115,89 @@@ static void bgmac_dma_tx_enable(struct 
        bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, ctl);
  }
  
 +static void
 +bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
 +                   int i, int len, u32 ctl0)
 +{
 +      struct bgmac_slot_info *slot;
 +      struct bgmac_dma_desc *dma_desc;
 +      u32 ctl1;
 +
 +      if (i == BGMAC_TX_RING_SLOTS - 1)
 +              ctl0 |= BGMAC_DESC_CTL0_EOT;
 +
 +      ctl1 = len & BGMAC_DESC_CTL1_LEN;
 +
 +      slot = &ring->slots[i];
 +      dma_desc = &ring->cpu_base[i];
 +      dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr));
 +      dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr));
 +      dma_desc->ctl0 = cpu_to_le32(ctl0);
 +      dma_desc->ctl1 = cpu_to_le32(ctl1);
 +}
 +
  static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
                                    struct bgmac_dma_ring *ring,
                                    struct sk_buff *skb)
  {
        struct device *dma_dev = bgmac->core->dma_dev;
        struct net_device *net_dev = bgmac->net_dev;
 -      struct bgmac_dma_desc *dma_desc;
 -      struct bgmac_slot_info *slot;
 -      u32 ctl0, ctl1;
 -      int free_slots;
 +      int index = ring->end % BGMAC_TX_RING_SLOTS;
 +      struct bgmac_slot_info *slot = &ring->slots[index];
 +      int nr_frags;
 +      u32 flags;
 +      int i;
  
        if (skb->len > BGMAC_DESC_CTL1_LEN) {
                bgmac_err(bgmac, "Too long skb (%d)\n", skb->len);
 -              goto err_stop_drop;
 +              goto err_drop;
        }
  
 -      if (ring->start <= ring->end)
 -              free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS;
 -      else
 -              free_slots = ring->start - ring->end;
 -      if (free_slots == 1) {
 +      if (skb->ip_summed == CHECKSUM_PARTIAL)
 +              skb_checksum_help(skb);
 +
 +      nr_frags = skb_shinfo(skb)->nr_frags;
 +
 +      /* ring->end - ring->start will return the number of valid slots,
 +       * even when ring->end overflows
 +       */
 +      if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) {
                bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n");
                netif_stop_queue(net_dev);
                return NETDEV_TX_BUSY;
        }
  
 -      slot = &ring->slots[ring->end];
 -      slot->skb = skb;
 -      slot->dma_addr = dma_map_single(dma_dev, skb->data, skb->len,
 +      slot->dma_addr = dma_map_single(dma_dev, skb->data, skb_headlen(skb),
                                        DMA_TO_DEVICE);
 -      if (dma_mapping_error(dma_dev, slot->dma_addr)) {
 -              bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n",
 -                        ring->mmio_base);
 -              goto err_stop_drop;
 -      }
 +      if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr)))
 +              goto err_dma_head;
  
 -      ctl0 = BGMAC_DESC_CTL0_IOC | BGMAC_DESC_CTL0_SOF | BGMAC_DESC_CTL0_EOF;
 -      if (ring->end == ring->num_slots - 1)
 -              ctl0 |= BGMAC_DESC_CTL0_EOT;
 -      ctl1 = skb->len & BGMAC_DESC_CTL1_LEN;
 +      flags = BGMAC_DESC_CTL0_SOF;
 +      if (!nr_frags)
 +              flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC;
  
 -      dma_desc = ring->cpu_base;
 -      dma_desc += ring->end;
 -      dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr));
 -      dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr));
 -      dma_desc->ctl0 = cpu_to_le32(ctl0);
 -      dma_desc->ctl1 = cpu_to_le32(ctl1);
 +      bgmac_dma_tx_add_buf(bgmac, ring, index, skb_headlen(skb), flags);
 +      flags = 0;
 +
 +      for (i = 0; i < nr_frags; i++) {
 +              struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
 +              int len = skb_frag_size(frag);
 +
 +              index = (index + 1) % BGMAC_TX_RING_SLOTS;
 +              slot = &ring->slots[index];
 +              slot->dma_addr = skb_frag_dma_map(dma_dev, frag, 0,
 +                                                len, DMA_TO_DEVICE);
 +              if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr)))
 +                      goto err_dma;
 +
 +              if (i == nr_frags - 1)
 +                      flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC;
 +
 +              bgmac_dma_tx_add_buf(bgmac, ring, index, len, flags);
 +      }
  
 +      slot->skb = skb;
 +      ring->end += nr_frags + 1;
        netdev_sent_queue(net_dev, skb->len);
  
        wmb();
        /* Increase ring->end to point empty slot. We tell hardware the first
         * slot it should *not* read.
         */
 -      if (++ring->end >= BGMAC_TX_RING_SLOTS)
 -              ring->end = 0;
        bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX,
                    ring->index_base +
 -                  ring->end * sizeof(struct bgmac_dma_desc));
 +                  (ring->end % BGMAC_TX_RING_SLOTS) *
 +                  sizeof(struct bgmac_dma_desc));
  
 -      /* Always keep one slot free to allow detecting bugged calls. */
 -      if (--free_slots == 1)
 +      if (ring->end - ring->start >= BGMAC_TX_RING_SLOTS - 8)
                netif_stop_queue(net_dev);
  
        return NETDEV_TX_OK;
  
 -err_stop_drop:
 -      netif_stop_queue(net_dev);
 +err_dma:
 +      dma_unmap_single(dma_dev, slot->dma_addr, skb_headlen(skb),
 +                       DMA_TO_DEVICE);
 +
 +      while (i > 0) {
 +              int index = (ring->end + i) % BGMAC_TX_RING_SLOTS;
 +              struct bgmac_slot_info *slot = &ring->slots[index];
 +              u32 ctl1 = le32_to_cpu(ring->cpu_base[index].ctl1);
 +              int len = ctl1 & BGMAC_DESC_CTL1_LEN;
 +
 +              dma_unmap_page(dma_dev, slot->dma_addr, len, DMA_TO_DEVICE);
 +      }
 +
 +err_dma_head:
 +      bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n",
 +                ring->mmio_base);
 +
 +err_drop:
        dev_kfree_skb(skb);
        return NETDEV_TX_OK;
  }
@@@ -252,45 -202,34 +252,45 @@@ static void bgmac_dma_tx_free(struct bg
        empty_slot &= BGMAC_DMA_TX_STATDPTR;
        empty_slot /= sizeof(struct bgmac_dma_desc);
  
 -      while (ring->start != empty_slot) {
 -              struct bgmac_slot_info *slot = &ring->slots[ring->start];
 +      while (ring->start != ring->end) {
 +              int slot_idx = ring->start % BGMAC_TX_RING_SLOTS;
 +              struct bgmac_slot_info *slot = &ring->slots[slot_idx];
 +              u32 ctl1;
 +              int len;
  
 -              if (slot->skb) {
 +              if (slot_idx == empty_slot)
 +                      break;
 +
 +              ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1);
 +              len = ctl1 & BGMAC_DESC_CTL1_LEN;
 +              if (ctl1 & BGMAC_DESC_CTL0_SOF)
                        /* Unmap no longer used buffer */
 -                      dma_unmap_single(dma_dev, slot->dma_addr,
 -                                       slot->skb->len, DMA_TO_DEVICE);
 -                      slot->dma_addr = 0;
 +                      dma_unmap_single(dma_dev, slot->dma_addr, len,
 +                                       DMA_TO_DEVICE);
 +              else
 +                      dma_unmap_page(dma_dev, slot->dma_addr, len,
 +                                     DMA_TO_DEVICE);
  
 +              if (slot->skb) {
                        bytes_compl += slot->skb->len;
                        pkts_compl++;
  
                        /* Free memory! :) */
                        dev_kfree_skb(slot->skb);
                        slot->skb = NULL;
 -              } else {
 -                      bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n",
 -                                ring->start, ring->end);
                }
  
 -              if (++ring->start >= BGMAC_TX_RING_SLOTS)
 -                      ring->start = 0;
 +              slot->dma_addr = 0;
 +              ring->start++;
                freed = true;
        }
  
 +      if (!pkts_compl)
 +              return;
 +
        netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl);
  
 -      if (freed && netif_queue_stopped(bgmac->net_dev))
 +      if (netif_queue_stopped(bgmac->net_dev))
                netif_wake_queue(bgmac->net_dev);
  }
  
@@@ -336,53 -275,43 +336,53 @@@ static int bgmac_dma_rx_skb_for_slot(st
                                     struct bgmac_slot_info *slot)
  {
        struct device *dma_dev = bgmac->core->dma_dev;
 -      struct sk_buff *skb;
        dma_addr_t dma_addr;
        struct bgmac_rx_header *rx;
 +      void *buf;
  
        /* Alloc skb */
 -      skb = netdev_alloc_skb(bgmac->net_dev, BGMAC_RX_BUF_SIZE);
 -      if (!skb)
 +      buf = netdev_alloc_frag(BGMAC_RX_ALLOC_SIZE);
 +      if (!buf)
                return -ENOMEM;
  
        /* Poison - if everything goes fine, hardware will overwrite it */
 -      rx = (struct bgmac_rx_header *)skb->data;
 +      rx = buf + BGMAC_RX_BUF_OFFSET;
        rx->len = cpu_to_le16(0xdead);
        rx->flags = cpu_to_le16(0xbeef);
  
        /* Map skb for the DMA */
 -      dma_addr = dma_map_single(dma_dev, skb->data,
 +      dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET,
                                  BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE);
        if (dma_mapping_error(dma_dev, dma_addr)) {
                bgmac_err(bgmac, "DMA mapping error\n");
 -              dev_kfree_skb(skb);
 +              put_page(virt_to_head_page(buf));
                return -ENOMEM;
        }
  
        /* Update the slot */
 -      slot->skb = skb;
 +      slot->buf = buf;
        slot->dma_addr = dma_addr;
  
        return 0;
  }
  
 +static void bgmac_dma_rx_update_index(struct bgmac *bgmac,
 +                                    struct bgmac_dma_ring *ring)
 +{
 +      dma_wmb();
 +
 +      bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX,
 +                  ring->index_base +
 +                  ring->end * sizeof(struct bgmac_dma_desc));
 +}
 +
  static void bgmac_dma_rx_setup_desc(struct bgmac *bgmac,
                                    struct bgmac_dma_ring *ring, int desc_idx)
  {
        struct bgmac_dma_desc *dma_desc = ring->cpu_base + desc_idx;
        u32 ctl0 = 0, ctl1 = 0;
  
 -      if (desc_idx == ring->num_slots - 1)
 +      if (desc_idx == BGMAC_RX_RING_SLOTS - 1)
                ctl0 |= BGMAC_DESC_CTL0_EOT;
        ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN;
        /* Is there any BGMAC device that requires extension? */
        dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[desc_idx].dma_addr));
        dma_desc->ctl0 = cpu_to_le32(ctl0);
        dma_desc->ctl1 = cpu_to_le32(ctl1);
 +
 +      ring->end = desc_idx;
 +}
 +
 +static void bgmac_dma_rx_poison_buf(struct device *dma_dev,
 +                                  struct bgmac_slot_info *slot)
 +{
 +      struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET;
 +
 +      dma_sync_single_for_cpu(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE,
 +                              DMA_FROM_DEVICE);
 +      rx->len = cpu_to_le16(0xdead);
 +      rx->flags = cpu_to_le16(0xbeef);
 +      dma_sync_single_for_device(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE,
 +                                 DMA_FROM_DEVICE);
  }
  
  static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
        end_slot &= BGMAC_DMA_RX_STATDPTR;
        end_slot /= sizeof(struct bgmac_dma_desc);
  
 -      ring->end = end_slot;
 -
 -      while (ring->start != ring->end) {
 +      while (ring->start != end_slot) {
                struct device *dma_dev = bgmac->core->dma_dev;
                struct bgmac_slot_info *slot = &ring->slots[ring->start];
 -              struct sk_buff *skb = slot->skb;
 -              struct bgmac_rx_header *rx;
 +              struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET;
 +              struct sk_buff *skb;
 +              void *buf = slot->buf;
 +              dma_addr_t dma_addr = slot->dma_addr;
                u16 len, flags;
  
 -              /* Unmap buffer to make it accessible to the CPU */
 -              dma_sync_single_for_cpu(dma_dev, slot->dma_addr,
 -                                      BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE);
 +              do {
 +                      /* Prepare new skb as replacement */
 +                      if (bgmac_dma_rx_skb_for_slot(bgmac, slot)) {
 +                              bgmac_dma_rx_poison_buf(dma_dev, slot);
 +                              break;
 +                      }
  
 -              /* Get info from the header */
 -              rx = (struct bgmac_rx_header *)skb->data;
 -              len = le16_to_cpu(rx->len);
 -              flags = le16_to_cpu(rx->flags);
 +                      /* Unmap buffer to make it accessible to the CPU */
 +                      dma_unmap_single(dma_dev, dma_addr,
 +                                       BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE);
  
 -              do {
 -                      dma_addr_t old_dma_addr = slot->dma_addr;
 -                      int err;
 +                      /* Get info from the header */
 +                      len = le16_to_cpu(rx->len);
 +                      flags = le16_to_cpu(rx->flags);
  
                        /* Check for poison and drop or pass the packet */
                        if (len == 0xdead && flags == 0xbeef) {
                                bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
                                          ring->start);
 -                              dma_sync_single_for_device(dma_dev,
 -                                                         slot->dma_addr,
 -                                                         BGMAC_RX_BUF_SIZE,
 -                                                         DMA_FROM_DEVICE);
 +                              put_page(virt_to_head_page(buf));
                                break;
                        }
  
 -                      /* Omit CRC. */
 -                      len -= ETH_FCS_LEN;
 -
 -                      /* Prepare new skb as replacement */
 -                      err = bgmac_dma_rx_skb_for_slot(bgmac, slot);
 -                      if (err) {
 -                              /* Poison the old skb */
 -                              rx->len = cpu_to_le16(0xdead);
 -                              rx->flags = cpu_to_le16(0xbeef);
 -
 -                              dma_sync_single_for_device(dma_dev,
 -                                                         slot->dma_addr,
 -                                                         BGMAC_RX_BUF_SIZE,
 -                                                         DMA_FROM_DEVICE);
 +                      if (len > BGMAC_RX_ALLOC_SIZE) {
 +                              bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
 +                                        ring->start);
 +                              put_page(virt_to_head_page(buf));
                                break;
                        }
 -                      bgmac_dma_rx_setup_desc(bgmac, ring, ring->start);
  
 -                      /* Unmap old skb, we'll pass it to the netfif */
 -                      dma_unmap_single(dma_dev, old_dma_addr,
 -                                       BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE);
 +                      /* Omit CRC. */
 +                      len -= ETH_FCS_LEN;
  
 -                      skb_put(skb, BGMAC_RX_FRAME_OFFSET + len);
 -                      skb_pull(skb, BGMAC_RX_FRAME_OFFSET);
 +                      skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE);
 +                      skb_put(skb, BGMAC_RX_FRAME_OFFSET +
 +                              BGMAC_RX_BUF_OFFSET + len);
 +                      skb_pull(skb, BGMAC_RX_FRAME_OFFSET +
 +                               BGMAC_RX_BUF_OFFSET);
  
                        skb_checksum_none_assert(skb);
                        skb->protocol = eth_type_trans(skb, bgmac->net_dev);
 -                      netif_receive_skb(skb);
 +                      napi_gro_receive(&bgmac->napi, skb);
                        handled++;
                } while (0);
  
 +              bgmac_dma_rx_setup_desc(bgmac, ring, ring->start);
 +
                if (++ring->start >= BGMAC_RX_RING_SLOTS)
                        ring->start = 0;
  
                        break;
        }
  
 +      bgmac_dma_rx_update_index(bgmac, ring);
 +
        return handled;
  }
  
@@@ -513,90 -433,40 +513,90 @@@ static bool bgmac_dma_unaligned(struct 
        return false;
  }
  
 -static void bgmac_dma_ring_free(struct bgmac *bgmac,
 -                              struct bgmac_dma_ring *ring)
 +static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
 +                                 struct bgmac_dma_ring *ring)
  {
        struct device *dma_dev = bgmac->core->dma_dev;
 +      struct bgmac_dma_desc *dma_desc = ring->cpu_base;
        struct bgmac_slot_info *slot;
 -      int size;
        int i;
  
 -      for (i = 0; i < ring->num_slots; i++) {
 +      for (i = 0; i < BGMAC_TX_RING_SLOTS; i++) {
 +              int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN;
 +
                slot = &ring->slots[i];
 -              if (slot->skb) {
 -                      if (slot->dma_addr)
 -                              dma_unmap_single(dma_dev, slot->dma_addr,
 -                                               slot->skb->len, DMA_TO_DEVICE);
 -                      dev_kfree_skb(slot->skb);
 -              }
 +              dev_kfree_skb(slot->skb);
 +
 +              if (!slot->dma_addr)
 +                      continue;
 +
 +              if (slot->skb)
 +                      dma_unmap_single(dma_dev, slot->dma_addr,
 +                                       len, DMA_TO_DEVICE);
 +              else
 +                      dma_unmap_page(dma_dev, slot->dma_addr,
 +                                     len, DMA_TO_DEVICE);
        }
 +}
 +
 +static void bgmac_dma_rx_ring_free(struct bgmac *bgmac,
 +                                 struct bgmac_dma_ring *ring)
 +{
 +      struct device *dma_dev = bgmac->core->dma_dev;
 +      struct bgmac_slot_info *slot;
 +      int i;
  
 -      if (ring->cpu_base) {
 -              /* Free ring of descriptors */
 -              size = ring->num_slots * sizeof(struct bgmac_dma_desc);
 -              dma_free_coherent(dma_dev, size, ring->cpu_base,
 -                                ring->dma_base);
 +      for (i = 0; i < BGMAC_RX_RING_SLOTS; i++) {
 +              slot = &ring->slots[i];
 +              if (!slot->dma_addr)
 +                      continue;
 +
 +              dma_unmap_single(dma_dev, slot->dma_addr,
 +                               BGMAC_RX_BUF_SIZE,
 +                               DMA_FROM_DEVICE);
 +              put_page(virt_to_head_page(slot->buf));
 +              slot->dma_addr = 0;
        }
  }
  
 +static void bgmac_dma_ring_desc_free(struct bgmac *bgmac,
 +                                   struct bgmac_dma_ring *ring,
 +                                   int num_slots)
 +{
 +      struct device *dma_dev = bgmac->core->dma_dev;
 +      int size;
 +
 +      if (!ring->cpu_base)
 +          return;
 +
 +      /* Free ring of descriptors */
 +      size = num_slots * sizeof(struct bgmac_dma_desc);
 +      dma_free_coherent(dma_dev, size, ring->cpu_base,
 +                        ring->dma_base);
 +}
 +
 +static void bgmac_dma_cleanup(struct bgmac *bgmac)
 +{
 +      int i;
 +
 +      for (i = 0; i < BGMAC_MAX_TX_RINGS; i++)
 +              bgmac_dma_tx_ring_free(bgmac, &bgmac->tx_ring[i]);
 +
 +      for (i = 0; i < BGMAC_MAX_RX_RINGS; i++)
 +              bgmac_dma_rx_ring_free(bgmac, &bgmac->rx_ring[i]);
 +}
 +
  static void bgmac_dma_free(struct bgmac *bgmac)
  {
        int i;
  
        for (i = 0; i < BGMAC_MAX_TX_RINGS; i++)
 -              bgmac_dma_ring_free(bgmac, &bgmac->tx_ring[i]);
 +              bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i],
 +                                       BGMAC_TX_RING_SLOTS);
 +
        for (i = 0; i < BGMAC_MAX_RX_RINGS; i++)
 -              bgmac_dma_ring_free(bgmac, &bgmac->rx_ring[i]);
 +              bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i],
 +                                       BGMAC_RX_RING_SLOTS);
  }
  
  static int bgmac_dma_alloc(struct bgmac *bgmac)
  
        for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) {
                ring = &bgmac->tx_ring[i];
 -              ring->num_slots = BGMAC_TX_RING_SLOTS;
                ring->mmio_base = ring_base[i];
  
                /* Alloc ring of descriptors */
 -              size = ring->num_slots * sizeof(struct bgmac_dma_desc);
 +              size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc);
                ring->cpu_base = dma_zalloc_coherent(dma_dev, size,
                                                     &ring->dma_base,
                                                     GFP_KERNEL);
        }
  
        for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) {
 -              int j;
 -
                ring = &bgmac->rx_ring[i];
 -              ring->num_slots = BGMAC_RX_RING_SLOTS;
                ring->mmio_base = ring_base[i];
  
                /* Alloc ring of descriptors */
 -              size = ring->num_slots * sizeof(struct bgmac_dma_desc);
 +              size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc);
                ring->cpu_base = dma_zalloc_coherent(dma_dev, size,
                                                     &ring->dma_base,
                                                     GFP_KERNEL);
                        ring->index_base = lower_32_bits(ring->dma_base);
                else
                        ring->index_base = 0;
 -
 -              /* Alloc RX slots */
 -              for (j = 0; j < ring->num_slots; j++) {
 -                      err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]);
 -                      if (err) {
 -                              bgmac_err(bgmac, "Can't allocate skb for slot in RX ring\n");
 -                              goto err_dma_free;
 -                      }
 -              }
        }
  
        return 0;
@@@ -673,10 -556,10 +673,10 @@@ err_dma_free
        return -ENOMEM;
  }
  
 -static void bgmac_dma_init(struct bgmac *bgmac)
 +static int bgmac_dma_init(struct bgmac *bgmac)
  {
        struct bgmac_dma_ring *ring;
 -      int i;
 +      int i, err;
  
        for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) {
                ring = &bgmac->tx_ring[i];
                if (ring->unaligned)
                        bgmac_dma_rx_enable(bgmac, ring);
  
 -              for (j = 0; j < ring->num_slots; j++)
 -                      bgmac_dma_rx_setup_desc(bgmac, ring, j);
 -
 -              bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX,
 -                          ring->index_base +
 -                          ring->num_slots * sizeof(struct bgmac_dma_desc));
 -
                ring->start = 0;
                ring->end = 0;
 +              for (j = 0; j < BGMAC_RX_RING_SLOTS; j++) {
 +                      err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]);
 +                      if (err)
 +                              goto error;
 +
 +                      bgmac_dma_rx_setup_desc(bgmac, ring, j);
 +              }
 +
 +              bgmac_dma_rx_update_index(bgmac, ring);
        }
 +
 +      return 0;
 +
 +error:
 +      bgmac_dma_cleanup(bgmac);
 +      return err;
  }
  
  /**************************************************
@@@ -1133,6 -1008,8 +1133,6 @@@ static void bgmac_chip_reset(struct bgm
        bgmac_phy_init(bgmac);
  
        netdev_reset_queue(bgmac->net_dev);
 -
 -      bgmac->int_status = 0;
  }
  
  static void bgmac_chip_intrs_on(struct bgmac *bgmac)
@@@ -1201,8 -1078,11 +1201,8 @@@ static void bgmac_enable(struct bgmac *
  }
  
  /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */
 -static void bgmac_chip_init(struct bgmac *bgmac, bool full_init)
 +static void bgmac_chip_init(struct bgmac *bgmac)
  {
 -      struct bgmac_dma_ring *ring;
 -      int i;
 -
        /* 1 interrupt per received frame */
        bgmac_write(bgmac, BGMAC_INT_RECV_LAZY, 1 << BGMAC_IRL_FC_SHIFT);
  
  
        bgmac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + ETHER_MAX_LEN);
  
 -      if (full_init) {
 -              bgmac_dma_init(bgmac);
 -              if (1) /* FIXME: is there any case we don't want IRQs? */
 -                      bgmac_chip_intrs_on(bgmac);
 -      } else {
 -              for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) {
 -                      ring = &bgmac->rx_ring[i];
 -                      bgmac_dma_rx_enable(bgmac, ring);
 -              }
 -      }
 +      bgmac_chip_intrs_on(bgmac);
  
        bgmac_enable(bgmac);
  }
@@@ -1235,13 -1124,14 +1235,13 @@@ static irqreturn_t bgmac_interrupt(int 
        if (!int_status)
                return IRQ_NONE;
  
 -      /* Ack */
 -      bgmac_write(bgmac, BGMAC_INT_STATUS, int_status);
 +      int_status &= ~(BGMAC_IS_TX0 | BGMAC_IS_RX);
 +      if (int_status)
 +              bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", int_status);
  
        /* Disable new interrupts until handling existing ones */
        bgmac_chip_intrs_off(bgmac);
  
 -      bgmac->int_status = int_status;
 -
        napi_schedule(&bgmac->napi);
  
        return IRQ_HANDLED;
  static int bgmac_poll(struct napi_struct *napi, int weight)
  {
        struct bgmac *bgmac = container_of(napi, struct bgmac, napi);
 -      struct bgmac_dma_ring *ring;
        int handled = 0;
  
 -      if (bgmac->int_status & BGMAC_IS_TX0) {
 -              ring = &bgmac->tx_ring[0];
 -              bgmac_dma_tx_free(bgmac, ring);
 -              bgmac->int_status &= ~BGMAC_IS_TX0;
 -      }
 +      /* Ack */
 +      bgmac_write(bgmac, BGMAC_INT_STATUS, ~0);
  
 -      if (bgmac->int_status & BGMAC_IS_RX) {
 -              ring = &bgmac->rx_ring[0];
 -              handled += bgmac_dma_rx_read(bgmac, ring, weight);
 -              bgmac->int_status &= ~BGMAC_IS_RX;
 -      }
 +      bgmac_dma_tx_free(bgmac, &bgmac->tx_ring[0]);
 +      handled += bgmac_dma_rx_read(bgmac, &bgmac->rx_ring[0], weight);
  
 -      if (bgmac->int_status) {
 -              bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", bgmac->int_status);
 -              bgmac->int_status = 0;
 -      }
 +      /* Poll again if more events arrived in the meantime */
 +      if (bgmac_read(bgmac, BGMAC_INT_STATUS) & (BGMAC_IS_TX0 | BGMAC_IS_RX))
 +              return handled;
  
        if (handled < weight) {
                napi_complete(napi);
@@@ -1280,27 -1178,23 +1280,27 @@@ static int bgmac_open(struct net_devic
        int err = 0;
  
        bgmac_chip_reset(bgmac);
 +
 +      err = bgmac_dma_init(bgmac);
 +      if (err)
 +              return err;
 +
        /* Specs say about reclaiming rings here, but we do that in DMA init */
 -      bgmac_chip_init(bgmac, true);
 +      bgmac_chip_init(bgmac);
  
        err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
                          KBUILD_MODNAME, net_dev);
        if (err < 0) {
                bgmac_err(bgmac, "IRQ request error: %d!\n", err);
 -              goto err_out;
 +              bgmac_dma_cleanup(bgmac);
 +              return err;
        }
        napi_enable(&bgmac->napi);
  
        phy_start(bgmac->phy_dev);
  
        netif_carrier_on(net_dev);
 -
 -err_out:
 -      return err;
 +      return 0;
  }
  
  static int bgmac_stop(struct net_device *net_dev)
        free_irq(bgmac->core->irq, net_dev);
  
        bgmac_chip_reset(bgmac);
 +      bgmac_dma_cleanup(bgmac);
  
        return 0;
  }
@@@ -1437,46 -1330,13 +1437,46 @@@ static void bgmac_adjust_link(struct ne
        }
  }
  
 +static int bgmac_fixed_phy_register(struct bgmac *bgmac)
 +{
 +      struct fixed_phy_status fphy_status = {
 +              .link = 1,
 +              .speed = SPEED_1000,
 +              .duplex = DUPLEX_FULL,
 +      };
 +      struct phy_device *phy_dev;
 +      int err;
 +
 +      phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
 +      if (!phy_dev || IS_ERR(phy_dev)) {
 +              bgmac_err(bgmac, "Failed to register fixed PHY device\n");
 +              return -ENODEV;
 +      }
 +
 +      err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
 +                               PHY_INTERFACE_MODE_MII);
 +      if (err) {
 +              bgmac_err(bgmac, "Connecting PHY failed\n");
 +              return err;
 +      }
 +
 +      bgmac->phy_dev = phy_dev;
 +
 +      return err;
 +}
 +
  static int bgmac_mii_register(struct bgmac *bgmac)
  {
 +      struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
        struct mii_bus *mii_bus;
        struct phy_device *phy_dev;
        char bus_id[MII_BUS_ID_SIZE + 3];
        int i, err = 0;
  
 +      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
 +          ci->id == BCMA_CHIP_ID_BCM53018)
 +              return bgmac_fixed_phy_register(bgmac);
 +
        mii_bus = mdiobus_alloc();
        if (!mii_bus)
                return -ENOMEM;
@@@ -1657,10 -1517,6 +1657,10 @@@ static int bgmac_probe(struct bcma_devi
                goto err_dma_free;
        }
  
 +      net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 +      net_dev->hw_features = net_dev->features;
 +      net_dev->vlan_features = net_dev->features;
 +
        err = register_netdev(bgmac->net_dev);
        if (err) {
                bgmac_err(bgmac, "Cannot register net device\n");
index f539d82f2f111683c76c0ed0c0e18a9dc58bfdec,85618f155ffad2a6584ec9d138e7b4079142d374..fbbe866485c7c359eaae0d9631b21e9ac05b594f
@@@ -170,6 -170,16 +170,16 @@@ static void cvm_oct_configure_common_hw
                cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
                                     CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
  
+ #ifdef __LITTLE_ENDIAN
+       {
+               union cvmx_ipd_ctl_status ipd_ctl_status;
+               ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
+               ipd_ctl_status.s.pkt_lend = 1;
+               ipd_ctl_status.s.wqe_lend = 1;
+               cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_status.u64);
+       }
+ #endif
        if (USE_RED)
                cvmx_helper_setup_red(num_packet_buffers / 4,
                                      num_packet_buffers / 8);
@@@ -573,6 -583,8 +583,6 @@@ static const struct net_device_ops cvm_
  #endif
  };
  
 -extern void octeon_mdiobus_force_mod_depencency(void);
 -
  static struct device_node *cvm_oct_of_get_child(
                                const struct device_node *parent, int reg_val)
  {
@@@ -857,7 -869,7 +867,7 @@@ static int cvm_oct_remove(struct platfo
        return 0;
  }
  
 -static struct of_device_id cvm_oct_match[] = {
 +static const struct of_device_id cvm_oct_match[] = {
        {
                .compatible = "cavium,octeon-3860-pip",
        },