aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-15 12:26:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-15 12:26:12 -0400
commit133d970e0dadf7b413db19893acc5b26664bf4a1 (patch)
treeea10732ca1d0f663ef1319973947a7c72cf170e7
parent050aaeab99067b6a08b34274ff15ca5dbb94a160 (diff)
parent38b8767462120c62a5046b529c80b06861f9ac85 (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle: "This is the main MIPS pull request for 4.9: MIPS core arch code: - traps: 64bit kernels should read CP0_EBase 64bit - traps: Convert ebase to KSEG0 - c-r4k: Drop bc_wback_inv() from icache flush - c-r4k: Split user/kernel flush_icache_range() - cacheflush: Use __flush_icache_user_range() - uprobes: Flush icache via kernel address - KVM: Use __local_flush_icache_user_range() - c-r4k: Fix flush_icache_range() for EVA - Fix -mabi=64 build of vdso.lds - VDSO: Drop duplicated -I*/-E* aflags - tracing: move insn_has_delay_slot to a shared header - tracing: disable uprobe/kprobe on compact branch instructions - ptrace: Fix regs_return_value for kernel context - Squash lines for simple wrapper functions - Move identification of VP(E) into proc.c from smp-mt.c - Add definitions of SYNC barrierstype values - traps: Ensure full EBase is written - tlb-r4k: If there are wired entries, don't use TLBINVF - Sanitise coherentio semantics - dma-default: Don't check hw_coherentio if device is non-coherent - Support per-device DMA coherence - Adjust MIPS64 CAC_BASE to reflect Config.K0 - Support generating Flattened Image Trees (.itb) - generic: Introduce generic DT-based board support - generic: Convert SEAD-3 to a generic board - Enable hardened usercopy - Don't specify STACKPROTECTOR in defconfigs Octeon: - Delete dead code and files across the platform. - Change to use all memory into use by default. - Rename upper case variables in setup code to lowercase. - Delete legacy hack for broken bootloaders. - Leave maintaining the link state to the actual ethernet/PHY drivers. - Add DTS for D-Link DSR-500N. - Fix PCI interrupt routing on D-Link DSR-500N. Pistachio: - Remove ANDROID_TIMED_OUTPUT from defconfig TX39xx: - Move GPIO setup from .mem_setup() to .arch_init() - Convert to Common Clock Framework TX49xx: - Move GPIO setup from .mem_setup() to .arch_init() - Convert to Common Clock Framework txx9wdt: - Add missing clock (un)prepare calls for CCF BMIPS: - Add PW, GPIO SDHCI and NAND device node names - Support APPENDED_DTB - Add missing bcm97435svmb to DT_NONE - Rename bcm96358nb4ser to bcm6358-neufbox4-sercom - Add DT examples for BCM63268, BCM3368 and BCM6362 - Add support for BCM3368 and BCM6362 PCI - Reduce stack frame usage - Use struct list_head lists - Support for CONFIG_PCI_DOMAINS_GENERIC - Make pcibios_set_cache_line_size an initcall - Inline pcibios_assign_all_busses - Split pci.c into pci.c & pci-legacy.c - Introduce CONFIG_PCI_DRIVERS_LEGACY - Support generic drivers CPC - Convert bare 'unsigned' to 'unsigned int' - Avoid lock when MIPS CM >= 3 is present GIC: - Delete unused file smp-gic.c mt7620: - Delete unnecessary assignment for the field "owner" from PCI BCM63xx: - Let clk_disable() return immediately if clk is NULL pm-cps: - Change FSB workaround to CPU blacklist - Update comments on barrier instructions - Use MIPS standard lightweight ordering barrier - Use MIPS standard completion barrier - Remove selection of sync types - Add MIPSr6 CPU support - Support CM3 changes to Coherence Enable Register SMP: - Wrap call to mips_cpc_lock_other in mips_cm_lock_other - Introduce mechanism for freeing and allocating IPIs cpuidle: - cpuidle-cps: Enable use with MIPSr6 CPUs. SEAD3: - Rewrite to use DT and generic kernel feature. USB: - host: ehci-sead3: Remove SEAD-3 EHCI code FBDEV: - cobalt_lcdfb: Drop SEAD3 support dt-bindings: - Document a binding for simple ASCII LCDs auxdisplay: - img-ascii-lcd: driver for simple ASCII LCD displays irqchip i8259: - i8259: Add domain before mapping parent irq - i8259: Allow platforms to override poll function - i8259: Remove unused i8259A_irq_pending Malta: - Rewrite to use DT of/platform: - Probe "isa" busses by default CM: - Print CM error reports upon bus errors Module: - Migrate exception table users off module.h and onto extable.h - Make various drivers explicitly non-modular: - Audit and remove any unnecessary uses of module.h mailmap: - Canonicalize to Qais' current email address. Documentation: - MIPS supports HAVE_REGS_AND_STACK_ACCESS_API Loongson1C: - Add CPU support for Loongson1C - Add board support - Add defconfig - Add RTC support for Loongson1C board All this except one Documentation fix has sat in linux-next and has survived Imagination's automated build test system" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (127 commits) Documentation: MIPS supports HAVE_REGS_AND_STACK_ACCESS_API MIPS: ptrace: Fix regs_return_value for kernel context MIPS: VDSO: Drop duplicated -I*/-E* aflags MIPS: Fix -mabi=64 build of vdso.lds MIPS: Enable hardened usercopy MIPS: generic: Convert SEAD-3 to a generic board MIPS: generic: Introduce generic DT-based board support MIPS: Support generating Flattened Image Trees (.itb) MIPS: Adjust MIPS64 CAC_BASE to reflect Config.K0 MIPS: Print CM error reports upon bus errors MIPS: Support per-device DMA coherence MIPS: dma-default: Don't check hw_coherentio if device is non-coherent MIPS: Sanitise coherentio semantics MIPS: PCI: Support generic drivers MIPS: PCI: Introduce CONFIG_PCI_DRIVERS_LEGACY MIPS: PCI: Split pci.c into pci.c & pci-legacy.c MIPS: PCI: Inline pcibios_assign_all_busses MIPS: PCI: Make pcibios_set_cache_line_size an initcall MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC MIPS: PCI: Use struct list_head lists ...
-rw-r--r--.mailmap1
-rw-r--r--Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt17
-rw-r--r--Documentation/devicetree/bindings/mips/brcm/soc.txt4
-rw-r--r--Documentation/features/perf/kprobes-event/arch-support.txt2
-rw-r--r--MAINTAINERS6
-rw-r--r--arch/mips/Kbuild.platforms2
-rw-r--r--arch/mips/Kconfig121
-rw-r--r--arch/mips/Makefile77
-rw-r--r--arch/mips/alchemy/common/setup.c6
-rw-r--r--arch/mips/bcm47xx/serial.c11
-rw-r--r--arch/mips/bcm63xx/clk.c3
-rw-r--r--arch/mips/bmips/Kconfig20
-rw-r--r--arch/mips/bmips/setup.c12
-rw-r--r--arch/mips/boot/Makefile66
-rw-r--r--arch/mips/boot/dts/brcm/Makefile36
-rw-r--r--arch/mips/boot/dts/brcm/bcm3368-netgear-cvg834g.dts22
-rw-r--r--arch/mips/boot/dts/brcm/bcm3368.dtsi101
-rw-r--r--arch/mips/boot/dts/brcm/bcm63268-comtrend-vr-3032u.dts108
-rw-r--r--arch/mips/boot/dts/brcm/bcm63268.dtsi134
-rw-r--r--arch/mips/boot/dts/brcm/bcm6358-neufbox4-sercomm.dts (renamed from arch/mips/boot/dts/brcm/bcm96358nb4ser.dts)1
-rw-r--r--arch/mips/boot/dts/brcm/bcm6362-neufbox6-sercomm.dts22
-rw-r--r--arch/mips/boot/dts/brcm/bcm6362.dtsi134
-rw-r--r--arch/mips/boot/dts/brcm/bcm7125.dtsi34
-rw-r--r--arch/mips/boot/dts/brcm/bcm7346.dtsi97
-rw-r--r--arch/mips/boot/dts/brcm/bcm7358.dtsi89
-rw-r--r--arch/mips/boot/dts/brcm/bcm7360.dtsi89
-rw-r--r--arch/mips/boot/dts/brcm/bcm7362.dtsi89
-rw-r--r--arch/mips/boot/dts/brcm/bcm7420.dtsi42
-rw-r--r--arch/mips/boot/dts/brcm/bcm7425.dtsi109
-rw-r--r--arch/mips/boot/dts/brcm/bcm7435.dtsi109
-rw-r--r--arch/mips/boot/dts/brcm/bcm97125cbmb.dts4
-rw-r--r--arch/mips/boot/dts/brcm/bcm97346dbsmb.dts17
-rw-r--r--arch/mips/boot/dts/brcm/bcm97358svmb.dts13
-rw-r--r--arch/mips/boot/dts/brcm/bcm97360svmb.dts8
-rw-r--r--arch/mips/boot/dts/brcm/bcm97362svmb.dts13
-rw-r--r--arch/mips/boot/dts/brcm/bcm97420c.dts8
-rw-r--r--arch/mips/boot/dts/brcm/bcm97425svmb.dts21
-rw-r--r--arch/mips/boot/dts/brcm/bcm97435svmb.dts21
-rw-r--r--arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch24.dtsi25
-rw-r--r--arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch4.dtsi25
-rw-r--r--arch/mips/boot/dts/cavium-octeon/dlink_dsr-1000n.dts45
-rw-r--r--arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n-1000n.dtsi58
-rw-r--r--arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n.dts40
-rw-r--r--arch/mips/boot/dts/mti/Makefile2
-rw-r--r--arch/mips/boot/dts/mti/malta.dts99
-rw-r--r--arch/mips/boot/dts/mti/sead3.dts238
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-board.c337
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c5
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c1
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c2
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper.c10
-rw-r--r--arch/mips/cavium-octeon/setup.c38
-rw-r--r--arch/mips/configs/generic/32r1.config2
-rw-r--r--arch/mips/configs/generic/32r2.config3
-rw-r--r--arch/mips/configs/generic/32r6.config2
-rw-r--r--arch/mips/configs/generic/64r1.config4
-rw-r--r--arch/mips/configs/generic/64r2.config5
-rw-r--r--arch/mips/configs/generic/64r6.config4
-rw-r--r--arch/mips/configs/generic/board-sead-3.config32
-rw-r--r--arch/mips/configs/generic/eb.config1
-rw-r--r--arch/mips/configs/generic/el.config1
-rw-r--r--arch/mips/configs/generic/micro32r2.config4
-rw-r--r--arch/mips/configs/generic_defconfig96
-rw-r--r--arch/mips/configs/loongson1c_defconfig126
-rw-r--r--arch/mips/configs/malta_defconfig4
-rw-r--r--arch/mips/configs/malta_kvm_defconfig4
-rw-r--r--arch/mips/configs/malta_kvm_guest_defconfig4
-rw-r--r--arch/mips/configs/malta_qemu_32r6_defconfig2
-rw-r--r--arch/mips/configs/maltaaprp_defconfig2
-rw-r--r--arch/mips/configs/maltasmvp_defconfig2
-rw-r--r--arch/mips/configs/maltasmvp_eva_defconfig2
-rw-r--r--arch/mips/configs/maltaup_defconfig2
-rw-r--r--arch/mips/configs/maltaup_xpa_defconfig4
-rw-r--r--arch/mips/configs/pistachio_defconfig2
-rw-r--r--arch/mips/configs/sead3_defconfig121
-rw-r--r--arch/mips/configs/sead3micro_defconfig122
-rw-r--r--arch/mips/generic/Kconfig19
-rw-r--r--arch/mips/generic/Makefile15
-rw-r--r--arch/mips/generic/Platform14
-rw-r--r--arch/mips/generic/board-sead3.c376
-rw-r--r--arch/mips/generic/init.c176
-rw-r--r--arch/mips/generic/irq.c64
-rw-r--r--arch/mips/generic/proc.c29
-rw-r--r--arch/mips/generic/vmlinux.its.S31
-rw-r--r--arch/mips/include/asm/addrspace.h3
-rw-r--r--arch/mips/include/asm/barrier.h96
-rw-r--r--arch/mips/include/asm/cacheflush.h5
-rw-r--r--arch/mips/include/asm/cpu-type.h3
-rw-r--r--arch/mips/include/asm/cpu.h1
-rw-r--r--arch/mips/include/asm/device.h5
-rw-r--r--arch/mips/include/asm/dma-coherence.h16
-rw-r--r--arch/mips/include/asm/dma-mapping.h10
-rw-r--r--arch/mips/include/asm/i8259.h12
-rw-r--r--arch/mips/include/asm/mach-generic/dma-coherence.h14
-rw-r--r--arch/mips/include/asm/mach-generic/floppy.h6
-rw-r--r--arch/mips/include/asm/mach-generic/spaces.h8
-rw-r--r--arch/mips/include/asm/mach-ip27/spaces.h1
-rw-r--r--arch/mips/include/asm/mach-loongson32/irq.h41
-rw-r--r--arch/mips/include/asm/mach-loongson32/loongson1.h5
-rw-r--r--arch/mips/include/asm/mach-loongson32/platform.h1
-rw-r--r--arch/mips/include/asm/mach-loongson32/regs-clk.h34
-rw-r--r--arch/mips/include/asm/mach-loongson32/regs-mux.h61
-rw-r--r--arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h72
-rw-r--r--arch/mips/include/asm/mach-sead3/irq.h9
-rw-r--r--arch/mips/include/asm/mach-sead3/kernel-entry-init.h21
-rw-r--r--arch/mips/include/asm/mach-sead3/war.h24
-rw-r--r--arch/mips/include/asm/machine.h63
-rw-r--r--arch/mips/include/asm/mips-boards/sead3int.h32
-rw-r--r--arch/mips/include/asm/mips-cm.h1
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-board.h30
-rw-r--r--arch/mips/include/asm/octeon/cvmx-mdio.h506
-rw-r--r--arch/mips/include/asm/pci.h60
-rw-r--r--arch/mips/include/asm/pgalloc.h6
-rw-r--r--arch/mips/include/asm/pm-cps.h6
-rw-r--r--arch/mips/include/asm/ptrace.h2
-rw-r--r--arch/mips/include/asm/smp.h14
-rw-r--r--arch/mips/include/asm/uaccess.h18
-rw-r--r--arch/mips/kernel/binfmt_elfn32.c8
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c8
-rw-r--r--arch/mips/kernel/branch.c36
-rw-r--r--arch/mips/kernel/kprobes.c67
-rw-r--r--arch/mips/kernel/linux32.c1
-rw-r--r--arch/mips/kernel/mips-cpc.c17
-rw-r--r--arch/mips/kernel/mips-r2-to-r6-emul.c1
-rw-r--r--arch/mips/kernel/module.c1
-rw-r--r--arch/mips/kernel/pm-cps.c160
-rw-r--r--arch/mips/kernel/probes-common.h83
-rw-r--r--arch/mips/kernel/proc.c7
-rw-r--r--arch/mips/kernel/smp-gic.c66
-rw-r--r--arch/mips/kernel/smp-mt.c23
-rw-r--r--arch/mips/kernel/smp.c65
-rw-r--r--arch/mips/kernel/traps.c53
-rw-r--r--arch/mips/kernel/uprobes.c88
-rw-r--r--arch/mips/kvm/commpage.c1
-rw-r--r--arch/mips/kvm/dyntrans.c5
-rw-r--r--arch/mips/kvm/emulate.c1
-rw-r--r--arch/mips/kvm/interrupt.c1
-rw-r--r--arch/mips/kvm/trap_emul.c1
-rw-r--r--arch/mips/lantiq/xway/vmmc.c6
-rw-r--r--arch/mips/lantiq/xway/xrx200_phy_fw.c12
-rw-r--r--arch/mips/lib/ashldi3.c2
-rw-r--r--arch/mips/lib/ashrdi3.c2
-rw-r--r--arch/mips/lib/bswapdi.c3
-rw-r--r--arch/mips/lib/bswapsi.c3
-rw-r--r--arch/mips/lib/cmpdi2.c2
-rw-r--r--arch/mips/lib/delay.c2
-rw-r--r--arch/mips/lib/iomap-pci.c6
-rw-r--r--arch/mips/lib/iomap.c2
-rw-r--r--arch/mips/lib/lshrdi3.c2
-rw-r--r--arch/mips/lib/ucmpdi2.c2
-rw-r--r--arch/mips/loongson32/Kconfig15
-rw-r--r--arch/mips/loongson32/Makefile6
-rw-r--r--arch/mips/loongson32/Platform1
-rw-r--r--arch/mips/loongson32/common/irq.c55
-rw-r--r--arch/mips/loongson32/common/platform.c32
-rw-r--r--arch/mips/loongson32/common/setup.c4
-rw-r--r--arch/mips/loongson32/ls1c/Makefile5
-rw-r--r--arch/mips/loongson32/ls1c/board.c27
-rw-r--r--arch/mips/mm/c-octeon.c2
-rw-r--r--arch/mips/mm/c-r3k.c2
-rw-r--r--arch/mips/mm/c-r4k.c61
-rw-r--r--arch/mips/mm/c-tx39.c3
-rw-r--r--arch/mips/mm/cache.c8
-rw-r--r--arch/mips/mm/dma-default.c18
-rw-r--r--arch/mips/mm/extable.c2
-rw-r--r--arch/mips/mm/fault.c1
-rw-r--r--arch/mips/mm/highmem.c3
-rw-r--r--arch/mips/mm/init.c2
-rw-r--r--arch/mips/mm/ioremap.c2
-rw-r--r--arch/mips/mm/mmap.c2
-rw-r--r--arch/mips/mm/page.c1
-rw-r--r--arch/mips/mm/tlb-r4k.c9
-rw-r--r--arch/mips/mti-malta/malta-dt.c15
-rw-r--r--arch/mips/mti-malta/malta-dtshim.c187
-rw-r--r--arch/mips/mti-malta/malta-init.c17
-rw-r--r--arch/mips/mti-malta/malta-int.c111
-rw-r--r--arch/mips/mti-malta/malta-platform.c73
-rw-r--r--arch/mips/mti-malta/malta-reset.c21
-rw-r--r--arch/mips/mti-malta/malta-setup.c10
-rw-r--r--arch/mips/mti-sead3/Makefile15
-rw-r--r--arch/mips/mti-sead3/Platform7
-rw-r--r--arch/mips/mti-sead3/sead3-console.c46
-rw-r--r--arch/mips/mti-sead3/sead3-display.c77
-rw-r--r--arch/mips/mti-sead3/sead3-init.c152
-rw-r--r--arch/mips/mti-sead3/sead3-int.c42
-rw-r--r--arch/mips/mti-sead3/sead3-lcd.c43
-rw-r--r--arch/mips/mti-sead3/sead3-platform.c223
-rw-r--r--arch/mips/mti-sead3/sead3-reset.c40
-rw-r--r--arch/mips/mti-sead3/sead3-setup.c108
-rw-r--r--arch/mips/mti-sead3/sead3-time.c99
-rw-r--r--arch/mips/pci/Makefile2
-rw-r--r--arch/mips/pci/pci-alchemy.c3
-rw-r--r--arch/mips/pci/pci-ar71xx.c2
-rw-r--r--arch/mips/pci/pci-ar724x.c2
-rw-r--r--arch/mips/pci/pci-generic.c52
-rw-r--r--arch/mips/pci/pci-lantiq.c2
-rw-r--r--arch/mips/pci/pci-legacy.c302
-rw-r--r--arch/mips/pci/pci-mt7620.c3
-rw-r--r--arch/mips/pci/pci-octeon.c2
-rw-r--r--arch/mips/pci/pci-rt2880.c2
-rw-r--r--arch/mips/pci/pci-rt3883.c2
-rw-r--r--arch/mips/pci/pci.c297
-rw-r--r--arch/mips/pci/pcie-octeon.c2
-rw-r--r--arch/mips/pnx833x/common/platform.c8
-rw-r--r--arch/mips/ralink/timer.c28
-rw-r--r--arch/mips/txx9/Kconfig2
-rw-r--r--arch/mips/txx9/generic/pci.c6
-rw-r--r--arch/mips/txx9/generic/setup.c70
-rw-r--r--arch/mips/txx9/generic/setup_tx3927.c1
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c1
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c1
-rw-r--r--arch/mips/txx9/jmr3927/setup.c11
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c32
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c1
-rw-r--r--arch/mips/vdso/Makefile4
-rw-r--r--drivers/auxdisplay/Kconfig9
-rw-r--r--drivers/auxdisplay/Makefile1
-rw-r--r--drivers/auxdisplay/img-ascii-lcd.c443
-rw-r--r--drivers/cpuidle/Kconfig.mips2
-rw-r--r--drivers/cpuidle/cpuidle-cps.c2
-rw-r--r--drivers/irqchip/irq-i8259.c30
-rw-r--r--drivers/of/platform.c1
-rw-r--r--drivers/usb/host/ehci-hcd.c5
-rw-r--r--drivers/usb/host/ehci-sead3.c185
-rw-r--r--drivers/video/fbdev/Kconfig2
-rw-r--r--drivers/video/fbdev/cobalt_lcdfb.c42
226 files changed, 5242 insertions, 3657 deletions
diff --git a/.mailmap b/.mailmap
index 2408e56e241b..02d261407683 100644
--- a/.mailmap
+++ b/.mailmap
@@ -127,6 +127,7 @@ Peter Oruba <peter@oruba.de>
127Peter Oruba <peter.oruba@amd.com> 127Peter Oruba <peter.oruba@amd.com>
128Pratyush Anand <pratyush.anand@gmail.com> <pratyush.anand@st.com> 128Pratyush Anand <pratyush.anand@gmail.com> <pratyush.anand@st.com>
129Praveen BP <praveenbp@ti.com> 129Praveen BP <praveenbp@ti.com>
130Qais Yousef <qsyousef@gmail.com> <qais.yousef@imgtec.com>
130Rajesh Shah <rajesh.shah@intel.com> 131Rajesh Shah <rajesh.shah@intel.com>
131Ralf Baechle <ralf@linux-mips.org> 132Ralf Baechle <ralf@linux-mips.org>
132Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 133Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
diff --git a/Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt b/Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
new file mode 100644
index 000000000000..b69bb68992fd
--- /dev/null
+++ b/Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
@@ -0,0 +1,17 @@
1Binding for ASCII LCD displays on Imagination Technologies boards
2
3Required properties:
4- compatible : should be one of:
5 "img,boston-lcd"
6 "mti,malta-lcd"
7 "mti,sead3-lcd"
8
9Required properties for "img,boston-lcd":
10- reg : memory region locating the device registers
11
12Required properties for "mti,malta-lcd" or "mti,sead3-lcd":
13- regmap: phandle of the system controller containing the LCD registers
14- offset: offset in bytes to the LCD registers within the system controller
15
16The layout of the registers & properties of the display are determined
17from the compatible string, making this binding somewhat trivial.
diff --git a/Documentation/devicetree/bindings/mips/brcm/soc.txt b/Documentation/devicetree/bindings/mips/brcm/soc.txt
index 4a7e030e4f9b..e4e1cd91fb1f 100644
--- a/Documentation/devicetree/bindings/mips/brcm/soc.txt
+++ b/Documentation/devicetree/bindings/mips/brcm/soc.txt
@@ -2,9 +2,9 @@
2 2
3Required properties: 3Required properties:
4 4
5- compatible: "brcm,bcm3384", "brcm,bcm33843" 5- compatible: "brcm,bcm3368", "brcm,bcm3384", "brcm,bcm33843"
6 "brcm,bcm3384-viper", "brcm,bcm33843-viper" 6 "brcm,bcm3384-viper", "brcm,bcm33843-viper"
7 "brcm,bcm6328", "brcm,bcm6358", "brcm,bcm6368", 7 "brcm,bcm6328", "brcm,bcm6358", "brcm,bcm6362", "brcm,bcm6368",
8 "brcm,bcm63168", "brcm,bcm63268", 8 "brcm,bcm63168", "brcm,bcm63268",
9 "brcm,bcm7125", "brcm,bcm7346", "brcm,bcm7358", "brcm,bcm7360", 9 "brcm,bcm7125", "brcm,bcm7346", "brcm,bcm7358", "brcm,bcm7360",
10 "brcm,bcm7362", "brcm,bcm7420", "brcm,bcm7425" 10 "brcm,bcm7362", "brcm,bcm7420", "brcm,bcm7425"
diff --git a/Documentation/features/perf/kprobes-event/arch-support.txt b/Documentation/features/perf/kprobes-event/arch-support.txt
index 9855ad044386..4660bf222db1 100644
--- a/Documentation/features/perf/kprobes-event/arch-support.txt
+++ b/Documentation/features/perf/kprobes-event/arch-support.txt
@@ -22,7 +22,7 @@
22 | m68k: | TODO | 22 | m68k: | TODO |
23 | metag: | TODO | 23 | metag: | TODO |
24 | microblaze: | TODO | 24 | microblaze: | TODO |
25 | mips: | TODO | 25 | mips: | ok |
26 | mn10300: | TODO | 26 | mn10300: | TODO |
27 | nios2: | TODO | 27 | nios2: | TODO |
28 | openrisc: | TODO | 28 | openrisc: | TODO |
diff --git a/MAINTAINERS b/MAINTAINERS
index 5f5e5caefc35..1cd38a7e0064 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6131,6 +6131,12 @@ M: Stanislaw Gruszka <stf_xl@wp.pl>
6131S: Maintained 6131S: Maintained
6132F: drivers/usb/atm/ueagle-atm.c 6132F: drivers/usb/atm/ueagle-atm.c
6133 6133
6134IMGTEC ASCII LCD DRIVER
6135M: Paul Burton <paul.burton@imgtec.com>
6136S: Maintained
6137F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
6138F: drivers/auxdisplay/img-ascii-lcd.c
6139
6134INA209 HARDWARE MONITOR DRIVER 6140INA209 HARDWARE MONITOR DRIVER
6135M: Guenter Roeck <linux@roeck-us.net> 6141M: Guenter Roeck <linux@roeck-us.net>
6136L: linux-hwmon@vger.kernel.org 6142L: linux-hwmon@vger.kernel.org
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
index c5cd63a4b6d5..f5f1bdb292de 100644
--- a/arch/mips/Kbuild.platforms
+++ b/arch/mips/Kbuild.platforms
@@ -11,6 +11,7 @@ platforms += cavium-octeon
11platforms += cobalt 11platforms += cobalt
12platforms += dec 12platforms += dec
13platforms += emma 13platforms += emma
14platforms += generic
14platforms += jazz 15platforms += jazz
15platforms += jz4740 16platforms += jz4740
16platforms += lantiq 17platforms += lantiq
@@ -18,7 +19,6 @@ platforms += lasat
18platforms += loongson32 19platforms += loongson32
19platforms += loongson64 20platforms += loongson64
20platforms += mti-malta 21platforms += mti-malta
21platforms += mti-sead3
22platforms += netlogic 22platforms += netlogic
23platforms += paravirt 23platforms += paravirt
24platforms += pic32 24platforms += pic32
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 1a322c807f22..b3c5bde43d34 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -65,6 +65,7 @@ config MIPS
65 select HANDLE_DOMAIN_IRQ 65 select HANDLE_DOMAIN_IRQ
66 select HAVE_EXIT_THREAD 66 select HAVE_EXIT_THREAD
67 select HAVE_REGS_AND_STACK_ACCESS_API 67 select HAVE_REGS_AND_STACK_ACCESS_API
68 select HAVE_ARCH_HARDENED_USERCOPY
68 69
69menu "Machine selection" 70menu "Machine selection"
70 71
@@ -72,6 +73,57 @@ choice
72 prompt "System type" 73 prompt "System type"
73 default SGI_IP22 74 default SGI_IP22
74 75
76config MIPS_GENERIC
77 bool "Generic board-agnostic MIPS kernel"
78 select BOOT_RAW
79 select BUILTIN_DTB
80 select CEVT_R4K
81 select CLKSRC_MIPS_GIC
82 select COMMON_CLK
83 select CPU_MIPSR2_IRQ_VI
84 select CPU_MIPSR2_IRQ_EI
85 select CSRC_R4K
86 select DMA_PERDEV_COHERENT
87 select HW_HAS_PCI
88 select IRQ_MIPS_CPU
89 select LIBFDT
90 select MIPS_CPU_SCACHE
91 select MIPS_GIC
92 select MIPS_L1_CACHE_SHIFT_7
93 select NO_EXCEPT_FILL
94 select PCI_DRIVERS_GENERIC
95 select PINCTRL
96 select SMP_UP if SMP
97 select SYS_HAS_CPU_MIPS32_R1
98 select SYS_HAS_CPU_MIPS32_R2
99 select SYS_HAS_CPU_MIPS32_R6
100 select SYS_HAS_CPU_MIPS64_R1
101 select SYS_HAS_CPU_MIPS64_R2
102 select SYS_HAS_CPU_MIPS64_R6
103 select SYS_SUPPORTS_32BIT_KERNEL
104 select SYS_SUPPORTS_64BIT_KERNEL
105 select SYS_SUPPORTS_BIG_ENDIAN
106 select SYS_SUPPORTS_HIGHMEM
107 select SYS_SUPPORTS_LITTLE_ENDIAN
108 select SYS_SUPPORTS_MICROMIPS
109 select SYS_SUPPORTS_MIPS_CPS
110 select SYS_SUPPORTS_MIPS16
111 select SYS_SUPPORTS_MULTITHREADING
112 select SYS_SUPPORTS_RELOCATABLE
113 select SYS_SUPPORTS_SMARTMIPS
114 select USB_EHCI_BIG_ENDIAN_DESC if BIG_ENDIAN
115 select USB_EHCI_BIG_ENDIAN_MMIO if BIG_ENDIAN
116 select USB_OHCI_BIG_ENDIAN_DESC if BIG_ENDIAN
117 select USB_OHCI_BIG_ENDIAN_MMIO if BIG_ENDIAN
118 select USB_UHCI_BIG_ENDIAN_DESC if BIG_ENDIAN
119 select USB_UHCI_BIG_ENDIAN_MMIO if BIG_ENDIAN
120 select USE_OF
121 help
122 Select this to build a kernel which aims to support multiple boards,
123 generally using a flattened device tree passed from the bootloader
124 using the boot protocol defined in the UHI (Unified Hosting
125 Interface) specification.
126
75config MIPS_ALCHEMY 127config MIPS_ALCHEMY
76 bool "Alchemy processor based machines" 128 bool "Alchemy processor based machines"
77 select ARCH_PHYS_ADDR_T_64BIT 129 select ARCH_PHYS_ADDR_T_64BIT
@@ -478,6 +530,7 @@ config MIPS_MALTA
478 select SYS_SUPPORTS_ZBOOT 530 select SYS_SUPPORTS_ZBOOT
479 select SYS_SUPPORTS_RELOCATABLE 531 select SYS_SUPPORTS_RELOCATABLE
480 select USE_OF 532 select USE_OF
533 select LIBFDT
481 select ZONE_DMA32 if 64BIT 534 select ZONE_DMA32 if 64BIT
482 select BUILTIN_DTB 535 select BUILTIN_DTB
483 select LIBFDT 536 select LIBFDT
@@ -493,42 +546,6 @@ config MACH_PIC32
493 Microchip PIC32 is a family of general-purpose 32 bit MIPS core 546 Microchip PIC32 is a family of general-purpose 32 bit MIPS core
494 microcontrollers. 547 microcontrollers.
495 548
496config MIPS_SEAD3
497 bool "MIPS SEAD3 board"
498 select BOOT_ELF32
499 select BOOT_RAW
500 select BUILTIN_DTB
501 select CEVT_R4K
502 select CSRC_R4K
503 select CLKSRC_MIPS_GIC
504 select COMMON_CLK
505 select CPU_MIPSR2_IRQ_VI
506 select CPU_MIPSR2_IRQ_EI
507 select DMA_NONCOHERENT
508 select IRQ_MIPS_CPU
509 select MIPS_GIC
510 select LIBFDT
511 select MIPS_MSC
512 select SYS_HAS_CPU_MIPS32_R1
513 select SYS_HAS_CPU_MIPS32_R2
514 select SYS_HAS_CPU_MIPS32_R6
515 select SYS_HAS_CPU_MIPS64_R1
516 select SYS_HAS_EARLY_PRINTK
517 select SYS_SUPPORTS_32BIT_KERNEL
518 select SYS_SUPPORTS_64BIT_KERNEL
519 select SYS_SUPPORTS_BIG_ENDIAN
520 select SYS_SUPPORTS_LITTLE_ENDIAN
521 select SYS_SUPPORTS_SMARTMIPS
522 select SYS_SUPPORTS_MICROMIPS
523 select SYS_SUPPORTS_MIPS16
524 select SYS_SUPPORTS_RELOCATABLE
525 select USB_EHCI_BIG_ENDIAN_DESC
526 select USB_EHCI_BIG_ENDIAN_MMIO
527 select USE_OF
528 help
529 This enables support for the MIPS Technologies SEAD3 evaluation
530 board.
531
532config NEC_MARKEINS 549config NEC_MARKEINS
533 bool "NEC EMMA2RH Mark-eins board" 550 bool "NEC EMMA2RH Mark-eins board"
534 select SOC_EMMA2RH 551 select SOC_EMMA2RH
@@ -988,6 +1005,7 @@ source "arch/mips/ath79/Kconfig"
988source "arch/mips/bcm47xx/Kconfig" 1005source "arch/mips/bcm47xx/Kconfig"
989source "arch/mips/bcm63xx/Kconfig" 1006source "arch/mips/bcm63xx/Kconfig"
990source "arch/mips/bmips/Kconfig" 1007source "arch/mips/bmips/Kconfig"
1008source "arch/mips/generic/Kconfig"
991source "arch/mips/jazz/Kconfig" 1009source "arch/mips/jazz/Kconfig"
992source "arch/mips/jz4740/Kconfig" 1010source "arch/mips/jz4740/Kconfig"
993source "arch/mips/lantiq/Kconfig" 1011source "arch/mips/lantiq/Kconfig"
@@ -1098,6 +1116,10 @@ config DMA_MAYBE_COHERENT
1098 select DMA_NONCOHERENT 1116 select DMA_NONCOHERENT
1099 bool 1117 bool
1100 1118
1119config DMA_PERDEV_COHERENT
1120 bool
1121 select DMA_MAYBE_COHERENT
1122
1101config DMA_COHERENT 1123config DMA_COHERENT
1102 bool 1124 bool
1103 1125
@@ -1401,6 +1423,16 @@ config CPU_LOONGSON1B
1401 The Loongson 1B is a 32-bit SoC, which implements the MIPS32 1423 The Loongson 1B is a 32-bit SoC, which implements the MIPS32
1402 release 2 instruction set. 1424 release 2 instruction set.
1403 1425
1426config CPU_LOONGSON1C
1427 bool "Loongson 1C"
1428 depends on SYS_HAS_CPU_LOONGSON1C
1429 select CPU_LOONGSON1
1430 select ARCH_WANT_OPTIONAL_GPIOLIB
1431 select LEDS_GPIO_REGISTER
1432 help
1433 The Loongson 1C is a 32-bit SoC, which implements the MIPS32
1434 release 2 instruction set.
1435
1404config CPU_MIPS32_R1 1436config CPU_MIPS32_R1
1405 bool "MIPS32 Release 1" 1437 bool "MIPS32 Release 1"
1406 depends on SYS_HAS_CPU_MIPS32_R1 1438 depends on SYS_HAS_CPU_MIPS32_R1
@@ -1850,6 +1882,9 @@ config SYS_HAS_CPU_LOONGSON2F
1850config SYS_HAS_CPU_LOONGSON1B 1882config SYS_HAS_CPU_LOONGSON1B
1851 bool 1883 bool
1852 1884
1885config SYS_HAS_CPU_LOONGSON1C
1886 bool
1887
1853config SYS_HAS_CPU_MIPS32_R1 1888config SYS_HAS_CPU_MIPS32_R1
1854 bool 1889 bool
1855 1890
@@ -2906,7 +2941,7 @@ endchoice
2906choice 2941choice
2907 prompt "Kernel command line type" if !CMDLINE_OVERRIDE 2942 prompt "Kernel command line type" if !CMDLINE_OVERRIDE
2908 default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATH79 && !MACH_INGENIC && \ 2943 default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATH79 && !MACH_INGENIC && \
2909 !MIPS_MALTA && !MIPS_SEAD3 && \ 2944 !MIPS_MALTA && \
2910 !CAVIUM_OCTEON_SOC 2945 !CAVIUM_OCTEON_SOC
2911 default MIPS_CMDLINE_FROM_BOOTLOADER 2946 default MIPS_CMDLINE_FROM_BOOTLOADER
2912 2947
@@ -2960,7 +2995,6 @@ config PCI
2960 bool "Support for PCI controller" 2995 bool "Support for PCI controller"
2961 depends on HW_HAS_PCI 2996 depends on HW_HAS_PCI
2962 select PCI_DOMAINS 2997 select PCI_DOMAINS
2963 select NO_GENERIC_PCI_IOPORT_MAP
2964 help 2998 help
2965 Find out whether you have a PCI motherboard. PCI is the name of a 2999 Find out whether you have a PCI motherboard. PCI is the name of a
2966 bus system, i.e. the way the CPU talks to the other stuff inside 3000 bus system, i.e. the way the CPU talks to the other stuff inside
@@ -2981,6 +3015,17 @@ config HT_PCI
2981config PCI_DOMAINS 3015config PCI_DOMAINS
2982 bool 3016 bool
2983 3017
3018config PCI_DOMAINS_GENERIC
3019 bool
3020
3021config PCI_DRIVERS_GENERIC
3022 select PCI_DOMAINS_GENERIC if PCI_DOMAINS
3023 bool
3024
3025config PCI_DRIVERS_LEGACY
3026 def_bool !PCI_DRIVERS_GENERIC
3027 select NO_GENERIC_PCI_IOPORT_MAP
3028
2984source "drivers/pci/Kconfig" 3029source "drivers/pci/Kconfig"
2985 3030
2986# 3031#
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 598ab2930fce..fbf40d3c8123 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -262,7 +262,14 @@ KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
262KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) 262KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
263 263
264bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ 264bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \
265 VMLINUX_ENTRY_ADDRESS=$(entry-y) 265 VMLINUX_ENTRY_ADDRESS=$(entry-y) \
266 PLATFORM=$(platform-y)
267ifdef CONFIG_32BIT
268bootvars-y += ADDR_BITS=32
269endif
270ifdef CONFIG_64BIT
271bootvars-y += ADDR_BITS=64
272endif
266 273
267LDFLAGS += -m $(ld-emul) 274LDFLAGS += -m $(ld-emul)
268 275
@@ -302,6 +309,11 @@ boot-y += uImage.gz
302boot-y += uImage.lzma 309boot-y += uImage.lzma
303boot-y += uImage.lzo 310boot-y += uImage.lzo
304endif 311endif
312boot-y += vmlinux.itb
313boot-y += vmlinux.gz.itb
314boot-y += vmlinux.bz2.itb
315boot-y += vmlinux.lzma.itb
316boot-y += vmlinux.lzo.itb
305 317
306# compressed boot image targets (arch/mips/boot/compressed/) 318# compressed boot image targets (arch/mips/boot/compressed/)
307bootz-y := vmlinuz 319bootz-y := vmlinuz
@@ -425,4 +437,67 @@ define archhelp
425 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)' 437 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
426 echo 438 echo
427 echo ' These will be default as appropriate for a configured platform.' 439 echo ' These will be default as appropriate for a configured platform.'
440 echo
441 echo ' If you are targeting a system supported by generic kernels you may'
442 echo ' configure the kernel for a given architecture target like so:'
443 echo
444 echo ' {micro32,32,64}{r1,r2,r6}{el,}_defconfig <BOARDS="list of boards">'
445 echo
446 echo ' Otherwise, the following default configurations are available:'
428endef 447endef
448
449generic_config_dir = $(srctree)/arch/$(ARCH)/configs/generic
450generic_defconfigs :=
451
452#
453# If the user generates a generic kernel configuration without specifying a
454# list of boards to include the config fragments for, default to including all
455# available board config fragments.
456#
457ifeq ($(BOARDS),)
458BOARDS = $(patsubst board-%.config,%,$(notdir $(wildcard $(generic_config_dir)/board-*.config)))
459endif
460
461#
462# Generic kernel configurations which merge generic_defconfig with the
463# appropriate config fragments from arch/mips/configs/generic/, resulting in
464# the ability to easily configure the kernel for a given architecture,
465# endianness & set of boards without duplicating the needed configuration in
466# hundreds of defconfig files.
467#
468define gen_generic_defconfigs
469$(foreach bits,$(1),$(foreach rev,$(2),$(foreach endian,$(3),
470target := $(bits)$(rev)$(filter el,$(endian))_defconfig
471generic_defconfigs += $$(target)
472$$(target): $(generic_config_dir)/$(bits)$(rev).config
473$$(target): $(generic_config_dir)/$(endian).config
474)))
475endef
476
477$(eval $(call gen_generic_defconfigs,32 64,r1 r2 r6,eb el))
478$(eval $(call gen_generic_defconfigs,micro32,r2,eb el))
479
480.PHONY: $(generic_defconfigs)
481$(generic_defconfigs):
482 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
483 -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/generic_defconfig $^ \
484 $(foreach board,$(BOARDS),$(generic_config_dir)/board-$(board).config)
485 $(Q)$(MAKE) olddefconfig
486
487#
488# Prevent generic merge_config rules attempting to merge single fragments
489#
490$(generic_config_dir)/%.config: ;
491
492#
493# Legacy defconfig compatibility - these targets used to be real defconfigs but
494# now that the boards have been converted to use the generic kernel they are
495# wrappers around the generic rules above.
496#
497.PHONY: sead3_defconfig
498sead3_defconfig:
499 $(Q)$(MAKE) 32r2el_defconfig BOARDS=sead-3
500
501.PHONY: sead3micro_defconfig
502sead3micro_defconfig:
503 $(Q)$(MAKE) micro32r2el_defconfig BOARDS=sead-3
diff --git a/arch/mips/alchemy/common/setup.c b/arch/mips/alchemy/common/setup.c
index 2902138b3e0f..7faaa6d593a7 100644
--- a/arch/mips/alchemy/common/setup.c
+++ b/arch/mips/alchemy/common/setup.c
@@ -48,17 +48,17 @@ void __init plat_mem_setup(void)
48 clear_c0_config(1 << 19); /* Clear Config[OD] */ 48 clear_c0_config(1 << 19); /* Clear Config[OD] */
49 49
50 hw_coherentio = 0; 50 hw_coherentio = 0;
51 coherentio = 1; 51 coherentio = IO_COHERENCE_ENABLED;
52 switch (alchemy_get_cputype()) { 52 switch (alchemy_get_cputype()) {
53 case ALCHEMY_CPU_AU1000: 53 case ALCHEMY_CPU_AU1000:
54 case ALCHEMY_CPU_AU1500: 54 case ALCHEMY_CPU_AU1500:
55 case ALCHEMY_CPU_AU1100: 55 case ALCHEMY_CPU_AU1100:
56 coherentio = 0; 56 coherentio = IO_COHERENCE_DISABLED;
57 break; 57 break;
58 case ALCHEMY_CPU_AU1200: 58 case ALCHEMY_CPU_AU1200:
59 /* Au1200 AB USB does not support coherent memory */ 59 /* Au1200 AB USB does not support coherent memory */
60 if (0 == (read_c0_prid() & PRID_REV_MASK)) 60 if (0 == (read_c0_prid() & PRID_REV_MASK))
61 coherentio = 0; 61 coherentio = IO_COHERENCE_DISABLED;
62 break; 62 break;
63 } 63 }
64 64
diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
index df761d38f7fc..e3c9872a4aa5 100644
--- a/arch/mips/bcm47xx/serial.c
+++ b/arch/mips/bcm47xx/serial.c
@@ -1,4 +1,7 @@
1/* 1/*
2 * 8250 UART probe driver for the BCM47XX platforms
3 * Author: Aurelien Jarno
4 *
2 * This file is subject to the terms and conditions of the GNU General Public 5 * 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 6 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 7 * for more details.
@@ -6,7 +9,6 @@
6 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net> 9 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
7 */ 10 */
8 11
9#include <linux/module.h>
10#include <linux/init.h> 12#include <linux/init.h>
11#include <linux/serial.h> 13#include <linux/serial.h>
12#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
@@ -88,9 +90,4 @@ static int __init uart8250_init(void)
88 } 90 }
89 return -EINVAL; 91 return -EINVAL;
90} 92}
91 93device_initcall(uart8250_init);
92module_init(uart8250_init);
93
94MODULE_AUTHOR("Aurelien Jarno <aurelien@aurel32.net>");
95MODULE_LICENSE("GPL");
96MODULE_DESCRIPTION("8250 UART probe driver for the BCM47XX platforms");
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 637565284732..b49fc9cb9cad 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -326,6 +326,9 @@ EXPORT_SYMBOL(clk_enable);
326 326
327void clk_disable(struct clk *clk) 327void clk_disable(struct clk *clk)
328{ 328{
329 if (!clk)
330 return;
331
329 mutex_lock(&clocks_mutex); 332 mutex_lock(&clocks_mutex);
330 clk_disable_unlocked(clk); 333 clk_disable_unlocked(clk);
331 mutex_unlock(&clocks_mutex); 334 mutex_unlock(&clocks_mutex);
diff --git a/arch/mips/bmips/Kconfig b/arch/mips/bmips/Kconfig
index 264328d528c7..2d60f25403de 100644
--- a/arch/mips/bmips/Kconfig
+++ b/arch/mips/bmips/Kconfig
@@ -21,10 +21,6 @@ config DT_BCM93384WVG_VIPER
21 bool "BCM93384WVG Viper CPU (EXPERIMENTAL)" 21 bool "BCM93384WVG Viper CPU (EXPERIMENTAL)"
22 select BUILTIN_DTB 22 select BUILTIN_DTB
23 23
24config DT_BCM96358NB4SER
25 bool "BCM96358NB4SER"
26 select BUILTIN_DTB
27
28config DT_BCM96368MVWG 24config DT_BCM96368MVWG
29 bool "BCM96368MVWG" 25 bool "BCM96368MVWG"
30 select BUILTIN_DTB 26 select BUILTIN_DTB
@@ -65,6 +61,22 @@ config DT_BCM97435SVMB
65 bool "BCM97435SVMB" 61 bool "BCM97435SVMB"
66 select BUILTIN_DTB 62 select BUILTIN_DTB
67 63
64config DT_COMTREND_VR3032U
65 bool "Comtrend VR-3032u"
66 select BUILTIN_DTB
67
68config DT_NETGEAR_CVG834G
69 bool "NETGEAR CVG834G"
70 select BUILTIN_DTB
71
72config DT_SFR_NEUFBOX4_SERCOMM
73 bool "SFR Neufbox 4 (Sercomm)"
74 select BUILTIN_DTB
75
76config DT_SFR_NEUFBOX6_SERCOMM
77 bool "SFR Neufbox 6 (Sercomm)"
78 select BUILTIN_DTB
79
68endchoice 80endchoice
69 81
70endif 82endif
diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
index 6776042679dd..3b6f687f177c 100644
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
@@ -17,6 +17,7 @@
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_fdt.h> 18#include <linux/of_fdt.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/libfdt.h>
20#include <linux/smp.h> 21#include <linux/smp.h>
21#include <asm/addrspace.h> 22#include <asm/addrspace.h>
22#include <asm/bmips.h> 23#include <asm/bmips.h>
@@ -98,7 +99,7 @@ static void bcm6328_quirks(void)
98static void bcm6358_quirks(void) 99static void bcm6358_quirks(void)
99{ 100{
100 /* 101 /*
101 * BCM6358 needs special handling for its shared TLB, so 102 * BCM3368/BCM6358 need special handling for their shared TLB, so
102 * disable SMP for now 103 * disable SMP for now
103 */ 104 */
104 bmips_smp_enabled = 0; 105 bmips_smp_enabled = 0;
@@ -110,10 +111,12 @@ static void bcm6368_quirks(void)
110} 111}
111 112
112static const struct bmips_quirk bmips_quirk_list[] = { 113static const struct bmips_quirk bmips_quirk_list[] = {
114 { "brcm,bcm3368", &bcm6358_quirks },
113 { "brcm,bcm3384-viper", &bcm3384_viper_quirks }, 115 { "brcm,bcm3384-viper", &bcm3384_viper_quirks },
114 { "brcm,bcm33843-viper", &bcm3384_viper_quirks }, 116 { "brcm,bcm33843-viper", &bcm3384_viper_quirks },
115 { "brcm,bcm6328", &bcm6328_quirks }, 117 { "brcm,bcm6328", &bcm6328_quirks },
116 { "brcm,bcm6358", &bcm6358_quirks }, 118 { "brcm,bcm6358", &bcm6358_quirks },
119 { "brcm,bcm6362", &bcm6368_quirks },
117 { "brcm,bcm6368", &bcm6368_quirks }, 120 { "brcm,bcm6368", &bcm6368_quirks },
118 { "brcm,bcm63168", &bcm6368_quirks }, 121 { "brcm,bcm63168", &bcm6368_quirks },
119 { "brcm,bcm63268", &bcm6368_quirks }, 122 { "brcm,bcm63268", &bcm6368_quirks },
@@ -150,6 +153,8 @@ void __init plat_time_init(void)
150 mips_hpt_frequency = freq; 153 mips_hpt_frequency = freq;
151} 154}
152 155
156extern const char __appended_dtb;
157
153void __init plat_mem_setup(void) 158void __init plat_mem_setup(void)
154{ 159{
155 void *dtb; 160 void *dtb;
@@ -159,6 +164,11 @@ void __init plat_mem_setup(void)
159 ioport_resource.start = 0; 164 ioport_resource.start = 0;
160 ioport_resource.end = ~0; 165 ioport_resource.end = ~0;
161 166
167#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
168 if (!fdt_check_header(&__appended_dtb))
169 dtb = (void *)&__appended_dtb;
170 else
171#endif
162 /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ 172 /* intended to somewhat resemble ARM; see Documentation/arm/Booting */
163 if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) 173 if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
164 dtb = phys_to_virt(fw_arg2); 174 dtb = phys_to_virt(fw_arg2);
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index acb1988f354e..2728a9a9c7c5 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -100,3 +100,69 @@ $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
100$(obj)/uImage: $(obj)/uImage.$(suffix-y) 100$(obj)/uImage: $(obj)/uImage.$(suffix-y)
101 @ln -sf $(notdir $<) $@ 101 @ln -sf $(notdir $<) $@
102 @echo ' Image $@ is ready' 102 @echo ' Image $@ is ready'
103
104#
105# Flattened Image Tree (.itb) images
106#
107
108targets += vmlinux.itb
109targets += vmlinux.gz.itb
110targets += vmlinux.bz2.itb
111targets += vmlinux.lzma.itb
112targets += vmlinux.lzo.itb
113
114ifeq ($(ADDR_BITS),32)
115 itb_addr_cells = 1
116endif
117ifeq ($(ADDR_BITS),64)
118 itb_addr_cells = 2
119endif
120
121quiet_cmd_cpp_its_S = ITS $@
122 cmd_cpp_its_S = $(CPP) $(cpp_flags) -P -C -o $@ $< \
123 -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
124 -DVMLINUX_BINARY="\"$(3)\"" \
125 -DVMLINUX_COMPRESSION="\"$(2)\"" \
126 -DVMLINUX_LOAD_ADDRESS=$(VMLINUX_LOAD_ADDRESS) \
127 -DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS) \
128 -DADDR_BITS=$(ADDR_BITS) \
129 -DADDR_CELLS=$(itb_addr_cells)
130
131$(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
132 $(call if_changed_dep,cpp_its_S,none,vmlinux.bin)
133
134$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
135 $(call if_changed_dep,cpp_its_S,gzip,vmlinux.bin.gz)
136
137$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
138 $(call if_changed_dep,cpp_its_S,bzip2,vmlinux.bin.bz2)
139
140$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
141 $(call if_changed_dep,cpp_its_S,lzma,vmlinux.bin.lzma)
142
143$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
144 $(call if_changed_dep,cpp_its_S,lzo,vmlinux.bin.lzo)
145
146quiet_cmd_itb-image = ITB $@
147 cmd_itb-image = \
148 env PATH="$(objtree)/scripts/dtc:$(PATH)" \
149 $(CONFIG_SHELL) $(MKIMAGE) \
150 -D "-I dts -O dtb -p 500 \
151 --include $(objtree)/arch/mips \
152 --warning no-unit_address_vs_reg" \
153 -f $(2) $@
154
155$(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE
156 $(call if_changed,itb-image,$<)
157
158$(obj)/vmlinux.gz.itb: $(obj)/vmlinux.gz.its $(obj)/vmlinux.bin.gz FORCE
159 $(call if_changed,itb-image,$<)
160
161$(obj)/vmlinux.bz2.itb: $(obj)/vmlinux.bz2.its $(obj)/vmlinux.bin.bz2 FORCE
162 $(call if_changed,itb-image,$<)
163
164$(obj)/vmlinux.lzma.itb: $(obj)/vmlinux.lzma.its $(obj)/vmlinux.bin.lzma FORCE
165 $(call if_changed,itb-image,$<)
166
167$(obj)/vmlinux.lzo.itb: $(obj)/vmlinux.lzo.its $(obj)/vmlinux.bin.lzo FORCE
168 $(call if_changed,itb-image,$<)
diff --git a/arch/mips/boot/dts/brcm/Makefile b/arch/mips/boot/dts/brcm/Makefile
index fda9d387cc08..d61bc2aebf69 100644
--- a/arch/mips/boot/dts/brcm/Makefile
+++ b/arch/mips/boot/dts/brcm/Makefile
@@ -1,6 +1,5 @@
1dtb-$(CONFIG_DT_BCM93384WVG) += bcm93384wvg.dtb 1dtb-$(CONFIG_DT_BCM93384WVG) += bcm93384wvg.dtb
2dtb-$(CONFIG_DT_BCM93384WVG_VIPER) += bcm93384wvg_viper.dtb 2dtb-$(CONFIG_DT_BCM93384WVG_VIPER) += bcm93384wvg_viper.dtb
3dtb-$(CONFIG_DT_BCM96358NB4SER) += bcm96358nb4ser.dtb
4dtb-$(CONFIG_DT_BCM96368MVWG) += bcm96368mvwg.dtb 3dtb-$(CONFIG_DT_BCM96368MVWG) += bcm96368mvwg.dtb
5dtb-$(CONFIG_DT_BCM9EJTAGPRB) += bcm9ejtagprb.dtb 4dtb-$(CONFIG_DT_BCM9EJTAGPRB) += bcm9ejtagprb.dtb
6dtb-$(CONFIG_DT_BCM97125CBMB) += bcm97125cbmb.dtb 5dtb-$(CONFIG_DT_BCM97125CBMB) += bcm97125cbmb.dtb
@@ -11,20 +10,29 @@ dtb-$(CONFIG_DT_BCM97362SVMB) += bcm97362svmb.dtb
11dtb-$(CONFIG_DT_BCM97420C) += bcm97420c.dtb 10dtb-$(CONFIG_DT_BCM97420C) += bcm97420c.dtb
12dtb-$(CONFIG_DT_BCM97425SVMB) += bcm97425svmb.dtb 11dtb-$(CONFIG_DT_BCM97425SVMB) += bcm97425svmb.dtb
13dtb-$(CONFIG_DT_BCM97435SVMB) += bcm97435svmb.dtb 12dtb-$(CONFIG_DT_BCM97435SVMB) += bcm97435svmb.dtb
13dtb-$(CONFIG_DT_COMTREND_VR3032U) += bcm63268-comtrend-vr-3032u.dtb
14dtb-$(CONFIG_DT_NETGEAR_CVG834G) += bcm3368-netgear-cvg834g.dtb
15dtb-$(CONFIG_DT_SFR_NEUFBOX4_SERCOMM) += bcm6358-neufbox4-sercomm.dtb
16dtb-$(CONFIG_DT_SFR_NEUFBOX6_SERCOMM) += bcm6362-neufbox6-sercomm.dtb
14 17
15dtb-$(CONFIG_DT_NONE) += \ 18dtb-$(CONFIG_DT_NONE) += \
16 bcm93384wvg.dtb \ 19 bcm3368-netgear-cvg834g.dtb \
17 bcm93384wvg_viper.dtb \ 20 bcm6358-neufbox4-sercomm.dtb \
18 bcm96358nb4ser.dtb \ 21 bcm6362-neufbox6-sercomm.dtb \
19 bcm96368mvwg.dtb \ 22 bcm63268-comtrend-vr-3032u.dtb \
20 bcm9ejtagprb.dtb \ 23 bcm93384wvg.dtb \
21 bcm97125cbmb.dtb \ 24 bcm93384wvg_viper.dtb \
22 bcm97346dbsmb.dtb \ 25 bcm96358nb4ser.dtb \
23 bcm97358svmb.dtb \ 26 bcm96368mvwg.dtb \
24 bcm97360svmb.dtb \ 27 bcm9ejtagprb.dtb \
25 bcm97362svmb.dtb \ 28 bcm97125cbmb.dtb \
26 bcm97420c.dtb \ 29 bcm97346dbsmb.dtb \
27 bcm97425svmb.dtb 30 bcm97358svmb.dtb \
31 bcm97360svmb.dtb \
32 bcm97362svmb.dtb \
33 bcm97420c.dtb \
34 bcm97425svmb.dtb \
35 bcm97435svmb.dtb
28 36
29obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) 37obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
30 38
diff --git a/arch/mips/boot/dts/brcm/bcm3368-netgear-cvg834g.dts b/arch/mips/boot/dts/brcm/bcm3368-netgear-cvg834g.dts
new file mode 100644
index 000000000000..2f2e80fdcde8
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm3368-netgear-cvg834g.dts
@@ -0,0 +1,22 @@
1/dts-v1/;
2
3/include/ "bcm3368.dtsi"
4
5/ {
6 compatible = "netgear,cvg834g", "brcm,bcm3368";
7 model = "NETGEAR CVG834G";
8
9 memory@0 {
10 device_type = "memory";
11 reg = <0x00000000 0x02000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200";
16 stdout-path = &uart0;
17 };
18};
19
20&uart0 {
21 status = "okay";
22};
diff --git a/arch/mips/boot/dts/brcm/bcm3368.dtsi b/arch/mips/boot/dts/brcm/bcm3368.dtsi
new file mode 100644
index 000000000000..bee855cb8073
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm3368.dtsi
@@ -0,0 +1,101 @@
1/ {
2 #address-cells = <1>;
3 #size-cells = <1>;
4 compatible = "brcm,bcm3368";
5
6 cpus {
7 #address-cells = <1>;
8 #size-cells = <0>;
9
10 mips-hpt-frequency = <150000000>;
11
12 cpu@0 {
13 compatible = "brcm,bmips4350";
14 device_type = "cpu";
15 reg = <0>;
16 };
17
18 cpu@1 {
19 compatible = "brcm,bmips4350";
20 device_type = "cpu";
21 reg = <1>;
22 };
23 };
24
25 clocks {
26 periph_clk: periph-clk {
27 compatible = "fixed-clock";
28 #clock-cells = <0>;
29 clock-frequency = <50000000>;
30 };
31 };
32
33 aliases {
34 serial0 = &uart0;
35 serial1 = &uart1;
36 };
37
38 cpu_intc: interrupt-controller {
39 #address-cells = <0>;
40 compatible = "mti,cpu-interrupt-controller";
41
42 interrupt-controller;
43 #interrupt-cells = <1>;
44 };
45
46 ubus {
47 #address-cells = <1>;
48 #size-cells = <1>;
49
50 compatible = "simple-bus";
51 ranges;
52
53 periph_cntl: syscon@fff8c000 {
54 compatible = "syscon";
55 reg = <0xfff8c000 0xc>;
56 native-endian;
57 };
58
59 reboot: syscon-reboot@fff8c008 {
60 compatible = "syscon-reboot";
61 regmap = <&periph_cntl>;
62 offset = <0x8>;
63 mask = <0x1>;
64 };
65
66 periph_intc: interrupt-controller@fff8c00c {
67 compatible = "brcm,bcm6345-l1-intc";
68 reg = <0xfff8c00c 0x8>;
69
70 interrupt-controller;
71 #interrupt-cells = <1>;
72
73 interrupt-parent = <&cpu_intc>;
74 interrupts = <2>;
75 };
76
77 uart0: serial@fff8c100 {
78 compatible = "brcm,bcm6345-uart";
79 reg = <0xfff8c100 0x18>;
80
81 interrupt-parent = <&periph_intc>;
82 interrupts = <2>;
83
84 clocks = <&periph_clk>;
85
86 status = "disabled";
87 };
88
89 uart1: serial@fff8c120 {
90 compatible = "brcm,bcm6345-uart";
91 reg = <0xfff8c120 0x18>;
92
93 interrupt-parent = <&periph_intc>;
94 interrupts = <3>;
95
96 clocks = <&periph_clk>;
97
98 status = "disabled";
99 };
100 };
101};
diff --git a/arch/mips/boot/dts/brcm/bcm63268-comtrend-vr-3032u.dts b/arch/mips/boot/dts/brcm/bcm63268-comtrend-vr-3032u.dts
new file mode 100644
index 000000000000..430d35ca33d5
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm63268-comtrend-vr-3032u.dts
@@ -0,0 +1,108 @@
1/dts-v1/;
2
3/include/ "bcm63268.dtsi"
4
5/ {
6 compatible = "comtrend,vr-3032u", "brcm,bcm63268";
7 model = "Comtrend VR-3032u";
8
9 memory@0 {
10 device_type = "memory";
11 reg = <0x00000000 0x04000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200";
16 stdout-path = &uart0;
17 };
18};
19
20&leds0 {
21 status = "ok";
22 brcm,serial-leds;
23 brcm,serial-dat-low;
24 brcm,serial-shift-inv;
25
26 led@0 {
27 reg = <0>;
28 brcm,hardware-controlled;
29 brcm,link-signal-sources = <0>;
30 /* GPHY0 Speed 0 */
31 };
32 led@1 {
33 reg = <1>;
34 brcm,hardware-controlled;
35 brcm,link-signal-sources = <1>;
36 /* GPHY0 Speed 1 */
37 };
38 led@2 {
39 reg = <2>;
40 active-low;
41 label = "vr-3032u:red:inet";
42 };
43 led@3 {
44 reg = <3>;
45 active-low;
46 label = "vr-3032u:green:dsl";
47 };
48 led@4 {
49 reg = <4>;
50 active-low;
51 label = "vr-3032u:green:usb";
52 };
53 led@7 {
54 reg = <7>;
55 active-low;
56 label = "vr-3032u:green:wps";
57 };
58 led@8 {
59 reg = <8>;
60 active-low;
61 label = "vr-3032u:green:inet";
62 };
63 led@9 {
64 reg = <9>;
65 brcm,hardware-controlled;
66 /* EPHY0 Activity */
67 };
68 led@10 {
69 reg = <10>;
70 brcm,hardware-controlled;
71 /* EPHY1 Activity */
72 };
73 led@11 {
74 reg = <11>;
75 brcm,hardware-controlled;
76 /* EPHY2 Activity */
77 };
78 led@12 {
79 reg = <12>;
80 brcm,hardware-controlled;
81 /* GPHY0 Activity */
82 };
83 led@13 {
84 reg = <13>;
85 brcm,hardware-controlled;
86 /* EPHY0 Speed */
87 };
88 led@14 {
89 reg = <14>;
90 brcm,hardware-controlled;
91 /* EPHY1 Speed */
92 };
93 led@15 {
94 reg = <15>;
95 brcm,hardware-controlled;
96 /* EPHY2 Speed */
97 };
98 led@20 {
99 reg = <20>;
100 active-low;
101 label = "vr-3032u:green:power";
102 default-state = "on";
103 };
104};
105
106&uart0 {
107 status = "okay";
108};
diff --git a/arch/mips/boot/dts/brcm/bcm63268.dtsi b/arch/mips/boot/dts/brcm/bcm63268.dtsi
new file mode 100644
index 000000000000..7e6bf2cc0287
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm63268.dtsi
@@ -0,0 +1,134 @@
1/ {
2 #address-cells = <1>;
3 #size-cells = <1>;
4 compatible = "brcm,bcm63268";
5
6 cpus {
7 #address-cells = <1>;
8 #size-cells = <0>;
9
10 mips-hpt-frequency = <200000000>;
11
12 cpu@0 {
13 compatible = "brcm,bmips4350";
14 device_type = "cpu";
15 reg = <0>;
16 };
17
18 cpu@1 {
19 compatible = "brcm,bmips4350";
20 device_type = "cpu";
21 reg = <1>;
22 };
23 };
24
25 clocks {
26 periph_clk: periph-clk {
27 compatible = "fixed-clock";
28 #clock-cells = <0>;
29 clock-frequency = <50000000>;
30 };
31 };
32
33 aliases {
34 serial0 = &uart0;
35 serial1 = &uart1;
36 };
37
38 cpu_intc: interrupt-controller {
39 #address-cells = <0>;
40 compatible = "mti,cpu-interrupt-controller";
41
42 interrupt-controller;
43 #interrupt-cells = <1>;
44 };
45
46 ubus {
47 #address-cells = <1>;
48 #size-cells = <1>;
49
50 compatible = "simple-bus";
51 ranges;
52
53 periph_cntl: syscon@10000000 {
54 compatible = "syscon";
55 reg = <0x10000000 0x14>;
56 native-endian;
57 };
58
59 reboot: syscon-reboot@10000008 {
60 compatible = "syscon-reboot";
61 regmap = <&periph_cntl>;
62 offset = <0x8>;
63 mask = <0x1>;
64 };
65
66 periph_intc: interrupt-controller@10000020 {
67 compatible = "brcm,bcm6345-l1-intc";
68 reg = <0x10000020 0x20>,
69 <0x10000040 0x20>;
70
71 interrupt-controller;
72 #interrupt-cells = <1>;
73
74 interrupt-parent = <&cpu_intc>;
75 interrupts = <2>, <3>;
76 };
77
78 uart0: serial@10000180 {
79 compatible = "brcm,bcm6345-uart";
80 reg = <0x10000180 0x18>;
81
82 interrupt-parent = <&periph_intc>;
83 interrupts = <5>;
84
85 clocks = <&periph_clk>;
86
87 status = "disabled";
88 };
89
90 uart1: serial@100001a0 {
91 compatible = "brcm,bcm6345-uart";
92 reg = <0x100001a0 0x18>;
93
94 interrupt-parent = <&periph_intc>;
95 interrupts = <34>;
96
97 clocks = <&periph_clk>;
98
99 status = "disabled";
100 };
101
102 leds0: led-controller@10001900 {
103 #address-cells = <1>;
104 #size-cells = <0>;
105 compatible = "brcm,bcm6328-leds";
106 reg = <0x10001900 0x24>;
107
108 status = "disabled";
109 };
110
111 ehci: usb@10002500 {
112 compatible = "brcm,bcm63268-ehci", "generic-ehci";
113 reg = <0x10002500 0x100>;
114 big-endian;
115
116 interrupt-parent = <&periph_intc>;
117 interrupts = <10>;
118
119 status = "disabled";
120 };
121
122 ohci: usb@10002600 {
123 compatible = "brcm,bcm63268-ohci", "generic-ohci";
124 reg = <0x10002600 0x100>;
125 big-endian;
126 no-big-frame-no;
127
128 interrupt-parent = <&periph_intc>;
129 interrupts = <9>;
130
131 status = "disabled";
132 };
133 };
134};
diff --git a/arch/mips/boot/dts/brcm/bcm96358nb4ser.dts b/arch/mips/boot/dts/brcm/bcm6358-neufbox4-sercomm.dts
index f412117972e6..702eae2a22a0 100644
--- a/arch/mips/boot/dts/brcm/bcm96358nb4ser.dts
+++ b/arch/mips/boot/dts/brcm/bcm6358-neufbox4-sercomm.dts
@@ -12,6 +12,7 @@
12 }; 12 };
13 13
14 chosen { 14 chosen {
15 bootargs = "console=ttyS0,115200";
15 stdout-path = &uart0; 16 stdout-path = &uart0;
16 }; 17 };
17}; 18};
diff --git a/arch/mips/boot/dts/brcm/bcm6362-neufbox6-sercomm.dts b/arch/mips/boot/dts/brcm/bcm6362-neufbox6-sercomm.dts
new file mode 100644
index 000000000000..480f2a5bf1da
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm6362-neufbox6-sercomm.dts
@@ -0,0 +1,22 @@
1/dts-v1/;
2
3/include/ "bcm6362.dtsi"
4
5/ {
6 compatible = "sfr,nb6-ser", "brcm,bcm6362";
7 model = "SFR NeufBox 6 (Sercomm)";
8
9 memory@0 {
10 device_type = "memory";
11 reg = <0x00000000 0x08000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200";
16 stdout-path = &uart0;
17 };
18};
19
20&uart0 {
21 status = "okay";
22};
diff --git a/arch/mips/boot/dts/brcm/bcm6362.dtsi b/arch/mips/boot/dts/brcm/bcm6362.dtsi
new file mode 100644
index 000000000000..c507da594f2f
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm6362.dtsi
@@ -0,0 +1,134 @@
1/ {
2 #address-cells = <1>;
3 #size-cells = <1>;
4 compatible = "brcm,bcm6362";
5
6 cpus {
7 #address-cells = <1>;
8 #size-cells = <0>;
9
10 mips-hpt-frequency = <200000000>;
11
12 cpu@0 {
13 compatible = "brcm,bmips4350";
14 device_type = "cpu";
15 reg = <0>;
16 };
17
18 cpu@1 {
19 compatible = "brcm,bmips4350";
20 device_type = "cpu";
21 reg = <1>;
22 };
23 };
24
25 clocks {
26 periph_clk: periph-clk {
27 compatible = "fixed-clock";
28 #clock-cells = <0>;
29 clock-frequency = <50000000>;
30 };
31 };
32
33 aliases {
34 serial0 = &uart0;
35 serial1 = &uart1;
36 };
37
38 cpu_intc: interrupt-controller {
39 #address-cells = <0>;
40 compatible = "mti,cpu-interrupt-controller";
41
42 interrupt-controller;
43 #interrupt-cells = <1>;
44 };
45
46 ubus {
47 #address-cells = <1>;
48 #size-cells = <1>;
49
50 compatible = "simple-bus";
51 ranges;
52
53 periph_cntl: syscon@10000000 {
54 compatible = "syscon";
55 reg = <0x10000000 0x14>;
56 native-endian;
57 };
58
59 reboot: syscon-reboot@10000008 {
60 compatible = "syscon-reboot";
61 regmap = <&periph_cntl>;
62 offset = <0x8>;
63 mask = <0x1>;
64 };
65
66 periph_intc: interrupt-controller@10000020 {
67 compatible = "brcm,bcm6345-l1-intc";
68 reg = <0x10000020 0x10>,
69 <0x10000030 0x10>;
70
71 interrupt-controller;
72 #interrupt-cells = <1>;
73
74 interrupt-parent = <&cpu_intc>;
75 interrupts = <2>, <3>;
76 };
77
78 uart0: serial@10000100 {
79 compatible = "brcm,bcm6345-uart";
80 reg = <0x10000100 0x18>;
81
82 interrupt-parent = <&periph_intc>;
83 interrupts = <3>;
84
85 clocks = <&periph_clk>;
86
87 status = "disabled";
88 };
89
90 uart1: serial@10000120 {
91 compatible = "brcm,bcm6345-uart";
92 reg = <0x10000120 0x18>;
93
94 interrupt-parent = <&periph_intc>;
95 interrupts = <4>;
96
97 clocks = <&periph_clk>;
98
99 status = "disabled";
100 };
101
102 leds0: led-controller@10001900 {
103 #address-cells = <1>;
104 #size-cells = <0>;
105 compatible = "brcm,bcm6328-leds";
106 reg = <0x10001900 0x24>;
107
108 status = "disabled";
109 };
110
111 ehci: usb@10002500 {
112 compatible = "brcm,bcm6362-ehci", "generic-ehci";
113 reg = <0x10002500 0x100>;
114 big-endian;
115
116 interrupt-parent = <&periph_intc>;
117 interrupts = <10>;
118
119 status = "disabled";
120 };
121
122 ohci: usb@10002600 {
123 compatible = "brcm,bcm6362-ohci", "generic-ohci";
124 reg = <0x10002600 0x100>;
125 big-endian;
126 no-big-frame-no;
127
128 interrupt-parent = <&periph_intc>;
129 interrupts = <9>;
130
131 status = "disabled";
132 };
133 };
134};
diff --git a/arch/mips/boot/dts/brcm/bcm7125.dtsi b/arch/mips/boot/dts/brcm/bcm7125.dtsi
index 550e1d9e3ee0..bbd00f65ce39 100644
--- a/arch/mips/boot/dts/brcm/bcm7125.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7125.dtsi
@@ -26,7 +26,7 @@
26 uart0 = &uart0; 26 uart0 = &uart0;
27 }; 27 };
28 28
29 cpu_intc: cpu_intc { 29 cpu_intc: interrupt-controller {
30 #address-cells = <0>; 30 #address-cells = <0>;
31 compatible = "mti,cpu-interrupt-controller"; 31 compatible = "mti,cpu-interrupt-controller";
32 32
@@ -40,6 +40,12 @@
40 #clock-cells = <0>; 40 #clock-cells = <0>;
41 clock-frequency = <81000000>; 41 clock-frequency = <81000000>;
42 }; 42 };
43
44 upg_clk: upg_clk {
45 compatible = "fixed-clock";
46 #clock-cells = <0>;
47 clock-frequency = <27000000>;
48 };
43 }; 49 };
44 50
45 rdb { 51 rdb {
@@ -49,7 +55,7 @@
49 compatible = "simple-bus"; 55 compatible = "simple-bus";
50 ranges = <0 0x10000000 0x01000000>; 56 ranges = <0 0x10000000 0x01000000>;
51 57
52 periph_intc: periph_intc@441400 { 58 periph_intc: interrupt-controller@441400 {
53 compatible = "brcm,bcm7038-l1-intc"; 59 compatible = "brcm,bcm7038-l1-intc";
54 reg = <0x441400 0x30>, <0x441600 0x30>; 60 reg = <0x441400 0x30>, <0x441600 0x30>;
55 61
@@ -60,7 +66,7 @@
60 interrupts = <2>, <3>; 66 interrupts = <2>, <3>;
61 }; 67 };
62 68
63 sun_l2_intc: sun_l2_intc@401800 { 69 sun_l2_intc: interrupt-controller@401800 {
64 compatible = "brcm,l2-intc"; 70 compatible = "brcm,l2-intc";
65 reg = <0x401800 0x30>; 71 reg = <0x401800 0x30>;
66 interrupt-controller; 72 interrupt-controller;
@@ -81,7 +87,7 @@
81 "avd_0", "jtag_0"; 87 "avd_0", "jtag_0";
82 }; 88 };
83 89
84 upg_irq0_intc: upg_irq0_intc@406780 { 90 upg_irq0_intc: interrupt-controller@406780 {
85 compatible = "brcm,bcm7120-l2-intc"; 91 compatible = "brcm,bcm7120-l2-intc";
86 reg = <0x406780 0x8>; 92 reg = <0x406780 0x8>;
87 93
@@ -183,6 +189,26 @@
183 status = "disabled"; 189 status = "disabled";
184 }; 190 };
185 191
192 pwma: pwm@406580 {
193 compatible = "brcm,bcm7038-pwm";
194 reg = <0x406580 0x28>;
195 #pwm-cells = <2>;
196 clocks = <&upg_clk>;
197 status = "disabled";
198 };
199
200 upg_gio: gpio@406700 {
201 compatible = "brcm,brcmstb-gpio";
202 reg = <0x406700 0x80>;
203 #gpio-cells = <2>;
204 #interrupt-cells = <2>;
205 gpio-controller;
206 interrupt-controller;
207 interrupt-parent = <&upg_irq0_intc>;
208 interrupts = <6>;
209 brcm,gpio-bank-widths = <32 32 32 18>;
210 };
211
186 ehci0: usb@488300 { 212 ehci0: usb@488300 {
187 compatible = "brcm,bcm7125-ehci", "generic-ehci"; 213 compatible = "brcm,bcm7125-ehci", "generic-ehci";
188 reg = <0x488300 0x100>; 214 reg = <0x488300 0x100>;
diff --git a/arch/mips/boot/dts/brcm/bcm7346.dtsi b/arch/mips/boot/dts/brcm/bcm7346.dtsi
index ec959061d52e..4bbcc95f1c15 100644
--- a/arch/mips/boot/dts/brcm/bcm7346.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7346.dtsi
@@ -26,7 +26,7 @@
26 uart0 = &uart0; 26 uart0 = &uart0;
27 }; 27 };
28 28
29 cpu_intc: cpu_intc { 29 cpu_intc: interrupt-controller {
30 #address-cells = <0>; 30 #address-cells = <0>;
31 compatible = "mti,cpu-interrupt-controller"; 31 compatible = "mti,cpu-interrupt-controller";
32 32
@@ -40,6 +40,12 @@
40 #clock-cells = <0>; 40 #clock-cells = <0>;
41 clock-frequency = <81000000>; 41 clock-frequency = <81000000>;
42 }; 42 };
43
44 upg_clk: upg_clk {
45 compatible = "fixed-clock";
46 #clock-cells = <0>;
47 clock-frequency = <27000000>;
48 };
43 }; 49 };
44 50
45 rdb { 51 rdb {
@@ -49,7 +55,7 @@
49 compatible = "simple-bus"; 55 compatible = "simple-bus";
50 ranges = <0 0x10000000 0x01000000>; 56 ranges = <0 0x10000000 0x01000000>;
51 57
52 periph_intc: periph_intc@411400 { 58 periph_intc: interrupt-controller@411400 {
53 compatible = "brcm,bcm7038-l1-intc"; 59 compatible = "brcm,bcm7038-l1-intc";
54 reg = <0x411400 0x30>, <0x411600 0x30>; 60 reg = <0x411400 0x30>, <0x411600 0x30>;
55 61
@@ -60,7 +66,7 @@
60 interrupts = <2>, <3>; 66 interrupts = <2>, <3>;
61 }; 67 };
62 68
63 sun_l2_intc: sun_l2_intc@403000 { 69 sun_l2_intc: interrupt-controller@403000 {
64 compatible = "brcm,l2-intc"; 70 compatible = "brcm,l2-intc";
65 reg = <0x403000 0x30>; 71 reg = <0x403000 0x30>;
66 interrupt-controller; 72 interrupt-controller;
@@ -81,7 +87,7 @@
81 "jtag_0", "svd_0"; 87 "jtag_0", "svd_0";
82 }; 88 };
83 89
84 upg_irq0_intc: upg_irq0_intc@406780 { 90 upg_irq0_intc: interrupt-controller@406780 {
85 compatible = "brcm,bcm7120-l2-intc"; 91 compatible = "brcm,bcm7120-l2-intc";
86 reg = <0x406780 0x8>; 92 reg = <0x406780 0x8>;
87 93
@@ -96,7 +102,7 @@
96 interrupt-names = "upg_main", "upg_bsc"; 102 interrupt-names = "upg_main", "upg_bsc";
97 }; 103 };
98 104
99 upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { 105 upg_aon_irq0_intc: interrupt-controller@408b80 {
100 compatible = "brcm,bcm7120-l2-intc"; 106 compatible = "brcm,bcm7120-l2-intc";
101 reg = <0x408b80 0x8>; 107 reg = <0x408b80 0x8>;
102 108
@@ -210,6 +216,59 @@
210 status = "disabled"; 216 status = "disabled";
211 }; 217 };
212 218
219 pwma: pwm@406580 {
220 compatible = "brcm,bcm7038-pwm";
221 reg = <0x406580 0x28>;
222 #pwm-cells = <2>;
223 clocks = <&upg_clk>;
224 status = "disabled";
225 };
226
227 pwmb: pwm@406800 {
228 compatible = "brcm,bcm7038-pwm";
229 reg = <0x406800 0x28>;
230 #pwm-cells = <2>;
231 clocks = <&upg_clk>;
232 status = "disabled";
233 };
234
235 aon_pm_l2_intc: interrupt-controller@408440 {
236 compatible = "brcm,l2-intc";
237 reg = <0x408440 0x30>;
238 interrupt-controller;
239 #interrupt-cells = <1>;
240 interrupt-parent = <&periph_intc>;
241 interrupts = <53>;
242 brcm,irq-can-wake;
243 };
244
245 upg_gio: gpio@406700 {
246 compatible = "brcm,brcmstb-gpio";
247 reg = <0x406700 0x60>;
248 #gpio-cells = <2>;
249 #interrupt-cells = <2>;
250 gpio-controller;
251 interrupt-controller;
252 interrupt-parent = <&upg_irq0_intc>;
253 interrupts = <6>;
254 brcm,gpio-bank-widths = <32 32 16>;
255 };
256
257 upg_gio_aon: gpio@408c00 {
258 compatible = "brcm,brcmstb-gpio";
259 reg = <0x408c00 0x60>;
260 #gpio-cells = <2>;
261 #interrupt-cells = <2>;
262 gpio-controller;
263 interrupt-controller;
264 interrupt-parent = <&upg_aon_irq0_intc>;
265 interrupts = <6>;
266 interrupts-extended = <&upg_aon_irq0_intc 6>,
267 <&aon_pm_l2_intc 5>;
268 wakeup-source;
269 brcm,gpio-bank-widths = <27 32 2>;
270 };
271
213 enet0: ethernet@430000 { 272 enet0: ethernet@430000 {
214 phy-mode = "internal"; 273 phy-mode = "internal";
215 phy-handle = <&phy1>; 274 phy-handle = <&phy1>;
@@ -313,6 +372,26 @@
313 status = "disabled"; 372 status = "disabled";
314 }; 373 };
315 374
375 hif_l2_intc: interrupt-controller@411000 {
376 compatible = "brcm,l2-intc";
377 reg = <0x411000 0x30>;
378 interrupt-controller;
379 #interrupt-cells = <1>;
380 interrupt-parent = <&periph_intc>;
381 interrupts = <30>;
382 };
383
384 nand: nand@412800 {
385 compatible = "brcm,brcmnand-v5.0", "brcm,brcmnand";
386 #address-cells = <1>;
387 #size-cells = <0>;
388 reg-names = "nand";
389 reg = <0x412800 0x400>;
390 interrupt-parent = <&hif_l2_intc>;
391 interrupts = <24>;
392 status = "disabled";
393 };
394
316 sata: sata@181000 { 395 sata: sata@181000 {
317 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; 396 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci";
318 reg-names = "ahci", "top-ctrl"; 397 reg-names = "ahci", "top-ctrl";
@@ -352,5 +431,13 @@
352 #phy-cells = <0>; 431 #phy-cells = <0>;
353 }; 432 };
354 }; 433 };
434
435 sdhci0: sdhci@413500 {
436 compatible = "brcm,bcm7425-sdhci";
437 reg = <0x413500 0x100>;
438 interrupt-parent = <&periph_intc>;
439 interrupts = <85>;
440 status = "disabled";
441 };
355 }; 442 };
356}; 443};
diff --git a/arch/mips/boot/dts/brcm/bcm7358.dtsi b/arch/mips/boot/dts/brcm/bcm7358.dtsi
index ca57fb5eb122..3e42535c8d29 100644
--- a/arch/mips/boot/dts/brcm/bcm7358.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7358.dtsi
@@ -20,7 +20,7 @@
20 uart0 = &uart0; 20 uart0 = &uart0;
21 }; 21 };
22 22
23 cpu_intc: cpu_intc { 23 cpu_intc: interrupt-controller {
24 #address-cells = <0>; 24 #address-cells = <0>;
25 compatible = "mti,cpu-interrupt-controller"; 25 compatible = "mti,cpu-interrupt-controller";
26 26
@@ -34,6 +34,12 @@
34 #clock-cells = <0>; 34 #clock-cells = <0>;
35 clock-frequency = <81000000>; 35 clock-frequency = <81000000>;
36 }; 36 };
37
38 upg_clk: upg_clk {
39 compatible = "fixed-clock";
40 #clock-cells = <0>;
41 clock-frequency = <27000000>;
42 };
37 }; 43 };
38 44
39 rdb { 45 rdb {
@@ -43,7 +49,7 @@
43 compatible = "simple-bus"; 49 compatible = "simple-bus";
44 ranges = <0 0x10000000 0x01000000>; 50 ranges = <0 0x10000000 0x01000000>;
45 51
46 periph_intc: periph_intc@411400 { 52 periph_intc: interrupt-controller@411400 {
47 compatible = "brcm,bcm7038-l1-intc"; 53 compatible = "brcm,bcm7038-l1-intc";
48 reg = <0x411400 0x30>; 54 reg = <0x411400 0x30>;
49 55
@@ -54,7 +60,7 @@
54 interrupts = <2>; 60 interrupts = <2>;
55 }; 61 };
56 62
57 sun_l2_intc: sun_l2_intc@403000 { 63 sun_l2_intc: interrupt-controller@403000 {
58 compatible = "brcm,l2-intc"; 64 compatible = "brcm,l2-intc";
59 reg = <0x403000 0x30>; 65 reg = <0x403000 0x30>;
60 interrupt-controller; 66 interrupt-controller;
@@ -75,7 +81,7 @@
75 "avd_0", "jtag_0"; 81 "avd_0", "jtag_0";
76 }; 82 };
77 83
78 upg_irq0_intc: upg_irq0_intc@406600 { 84 upg_irq0_intc: interrupt-controller@406600 {
79 compatible = "brcm,bcm7120-l2-intc"; 85 compatible = "brcm,bcm7120-l2-intc";
80 reg = <0x406600 0x8>; 86 reg = <0x406600 0x8>;
81 87
@@ -90,7 +96,7 @@
90 interrupt-names = "upg_main", "upg_bsc"; 96 interrupt-names = "upg_main", "upg_bsc";
91 }; 97 };
92 98
93 upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { 99 upg_aon_irq0_intc: interrupt-controller@408b80 {
94 compatible = "brcm,bcm7120-l2-intc"; 100 compatible = "brcm,bcm7120-l2-intc";
95 reg = <0x408b80 0x8>; 101 reg = <0x408b80 0x8>;
96 102
@@ -194,6 +200,59 @@
194 status = "disabled"; 200 status = "disabled";
195 }; 201 };
196 202
203 pwma: pwm@406400 {
204 compatible = "brcm,bcm7038-pwm";
205 reg = <0x406400 0x28>;
206 #pwm-cells = <2>;
207 clocks = <&upg_clk>;
208 status = "disabled";
209 };
210
211 pwmb: pwm@406700 {
212 compatible = "brcm,bcm7038-pwm";
213 reg = <0x406700 0x28>;
214 #pwm-cells = <2>;
215 clocks = <&upg_clk>;
216 status = "disabled";
217 };
218
219 aon_pm_l2_intc: interrupt-controller@408240 {
220 compatible = "brcm,l2-intc";
221 reg = <0x408240 0x30>;
222 interrupt-controller;
223 #interrupt-cells = <1>;
224 interrupt-parent = <&periph_intc>;
225 interrupts = <50>;
226 brcm,irq-can-wake;
227 };
228
229 upg_gio: gpio@406500 {
230 compatible = "brcm,brcmstb-gpio";
231 reg = <0x406500 0xa0>;
232 #gpio-cells = <2>;
233 #interrupt-cells = <2>;
234 gpio-controller;
235 interrupt-controller;
236 interrupt-parent = <&upg_irq0_intc>;
237 interrupts = <6>;
238 brcm,gpio-bank-widths = <32 32 32 29 4>;
239 };
240
241 upg_gio_aon: gpio@408c00 {
242 compatible = "brcm,brcmstb-gpio";
243 reg = <0x408c00 0x60>;
244 #gpio-cells = <2>;
245 #interrupt-cells = <2>;
246 gpio-controller;
247 interrupt-controller;
248 interrupt-parent = <&upg_aon_irq0_intc>;
249 interrupts = <6>;
250 interrupts-extended = <&upg_aon_irq0_intc 6>,
251 <&aon_pm_l2_intc 5>;
252 wakeup-source;
253 brcm,gpio-bank-widths = <21 32 2>;
254 };
255
197 enet0: ethernet@430000 { 256 enet0: ethernet@430000 {
198 phy-mode = "internal"; 257 phy-mode = "internal";
199 phy-handle = <&phy1>; 258 phy-handle = <&phy1>;
@@ -239,5 +298,25 @@
239 interrupts = <66>; 298 interrupts = <66>;
240 status = "disabled"; 299 status = "disabled";
241 }; 300 };
301
302 hif_l2_intc: interrupt-controller@411000 {
303 compatible = "brcm,l2-intc";
304 reg = <0x411000 0x30>;
305 interrupt-controller;
306 #interrupt-cells = <1>;
307 interrupt-parent = <&periph_intc>;
308 interrupts = <30>;
309 };
310
311 nand: nand@412800 {
312 compatible = "brcm,brcmnand-v5.0", "brcm,brcmnand";
313 #address-cells = <1>;
314 #size-cells = <0>;
315 reg-names = "nand";
316 reg = <0x412800 0x400>;
317 interrupt-parent = <&hif_l2_intc>;
318 interrupts = <24>;
319 status = "disabled";
320 };
242 }; 321 };
243}; 322};
diff --git a/arch/mips/boot/dts/brcm/bcm7360.dtsi b/arch/mips/boot/dts/brcm/bcm7360.dtsi
index 1c0c3d438c7a..112a5571c596 100644
--- a/arch/mips/boot/dts/brcm/bcm7360.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7360.dtsi
@@ -20,7 +20,7 @@
20 uart0 = &uart0; 20 uart0 = &uart0;
21 }; 21 };
22 22
23 cpu_intc: cpu_intc { 23 cpu_intc: interrupt-controller {
24 #address-cells = <0>; 24 #address-cells = <0>;
25 compatible = "mti,cpu-interrupt-controller"; 25 compatible = "mti,cpu-interrupt-controller";
26 26
@@ -34,6 +34,12 @@
34 #clock-cells = <0>; 34 #clock-cells = <0>;
35 clock-frequency = <81000000>; 35 clock-frequency = <81000000>;
36 }; 36 };
37
38 upg_clk: upg_clk {
39 compatible = "fixed-clock";
40 #clock-cells = <0>;
41 clock-frequency = <27000000>;
42 };
37 }; 43 };
38 44
39 rdb { 45 rdb {
@@ -43,7 +49,7 @@
43 compatible = "simple-bus"; 49 compatible = "simple-bus";
44 ranges = <0 0x10000000 0x01000000>; 50 ranges = <0 0x10000000 0x01000000>;
45 51
46 periph_intc: periph_intc@411400 { 52 periph_intc: interrupt-controller@411400 {
47 compatible = "brcm,bcm7038-l1-intc"; 53 compatible = "brcm,bcm7038-l1-intc";
48 reg = <0x411400 0x30>; 54 reg = <0x411400 0x30>;
49 55
@@ -54,7 +60,7 @@
54 interrupts = <2>; 60 interrupts = <2>;
55 }; 61 };
56 62
57 sun_l2_intc: sun_l2_intc@403000 { 63 sun_l2_intc: interrupt-controller@403000 {
58 compatible = "brcm,l2-intc"; 64 compatible = "brcm,l2-intc";
59 reg = <0x403000 0x30>; 65 reg = <0x403000 0x30>;
60 interrupt-controller; 66 interrupt-controller;
@@ -75,7 +81,7 @@
75 "avd_0", "jtag_0"; 81 "avd_0", "jtag_0";
76 }; 82 };
77 83
78 upg_irq0_intc: upg_irq0_intc@406600 { 84 upg_irq0_intc: interrupt-controller@406600 {
79 compatible = "brcm,bcm7120-l2-intc"; 85 compatible = "brcm,bcm7120-l2-intc";
80 reg = <0x406600 0x8>; 86 reg = <0x406600 0x8>;
81 87
@@ -90,7 +96,7 @@
90 interrupt-names = "upg_main", "upg_bsc"; 96 interrupt-names = "upg_main", "upg_bsc";
91 }; 97 };
92 98
93 upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { 99 upg_aon_irq0_intc: interrupt-controller@408b80 {
94 compatible = "brcm,bcm7120-l2-intc"; 100 compatible = "brcm,bcm7120-l2-intc";
95 reg = <0x408b80 0x8>; 101 reg = <0x408b80 0x8>;
96 102
@@ -194,6 +200,51 @@
194 status = "disabled"; 200 status = "disabled";
195 }; 201 };
196 202
203 pwma: pwm@406400 {
204 compatible = "brcm,bcm7038-pwm";
205 reg = <0x406400 0x28>;
206 #pwm-cells = <2>;
207 clocks = <&upg_clk>;
208 status = "disabled";
209 };
210
211 aon_pm_l2_intc: interrupt-controller@408440 {
212 compatible = "brcm,l2-intc";
213 reg = <0x408440 0x30>;
214 interrupt-controller;
215 #interrupt-cells = <1>;
216 interrupt-parent = <&periph_intc>;
217 interrupts = <50>;
218 brcm,irq-can-wake;
219 };
220
221 upg_gio: gpio@406500 {
222 compatible = "brcm,brcmstb-gpio";
223 reg = <0x406500 0xa0>;
224 #gpio-cells = <2>;
225 #interrupt-cells = <2>;
226 gpio-controller;
227 interrupt-controller;
228 interrupt-parent = <&upg_irq0_intc>;
229 interrupts = <6>;
230 brcm,gpio-bank-widths = <32 32 32 29 4>;
231 };
232
233 upg_gio_aon: gpio@408c00 {
234 compatible = "brcm,brcmstb-gpio";
235 reg = <0x408c00 0x60>;
236 #gpio-cells = <2>;
237 #interrupt-cells = <2>;
238 gpio-controller;
239 interrupt-controller;
240 interrupt-parent = <&upg_aon_irq0_intc>;
241 interrupts = <6>;
242 interrupts-extended = <&upg_aon_irq0_intc 6>,
243 <&aon_pm_l2_intc 5>;
244 wakeup-source;
245 brcm,gpio-bank-widths = <21 32 2>;
246 };
247
197 enet0: ethernet@430000 { 248 enet0: ethernet@430000 {
198 phy-mode = "internal"; 249 phy-mode = "internal";
199 phy-handle = <&phy1>; 250 phy-handle = <&phy1>;
@@ -240,6 +291,26 @@
240 status = "disabled"; 291 status = "disabled";
241 }; 292 };
242 293
294 hif_l2_intc: interrupt-controller@411000 {
295 compatible = "brcm,l2-intc";
296 reg = <0x411000 0x30>;
297 interrupt-controller;
298 #interrupt-cells = <1>;
299 interrupt-parent = <&periph_intc>;
300 interrupts = <30>;
301 };
302
303 nand: nand@412800 {
304 compatible = "brcm,brcmnand-v5.0", "brcm,brcmnand";
305 #address-cells = <1>;
306 #size-cells = <0>;
307 reg-names = "nand";
308 reg = <0x412800 0x400>;
309 interrupt-parent = <&hif_l2_intc>;
310 interrupts = <24>;
311 status = "disabled";
312 };
313
243 sata: sata@181000 { 314 sata: sata@181000 {
244 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; 315 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci";
245 reg-names = "ahci", "top-ctrl"; 316 reg-names = "ahci", "top-ctrl";
@@ -279,5 +350,13 @@
279 #phy-cells = <0>; 350 #phy-cells = <0>;
280 }; 351 };
281 }; 352 };
353
354 sdhci0: sdhci@410000 {
355 compatible = "brcm,bcm7425-sdhci";
356 reg = <0x410000 0x100>;
357 interrupt-parent = <&periph_intc>;
358 interrupts = <82>;
359 status = "disabled";
360 };
282 }; 361 };
283}; 362};
diff --git a/arch/mips/boot/dts/brcm/bcm7362.dtsi b/arch/mips/boot/dts/brcm/bcm7362.dtsi
index 6b4713add4b8..34abfb0b07e7 100644
--- a/arch/mips/boot/dts/brcm/bcm7362.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7362.dtsi
@@ -26,7 +26,7 @@
26 uart0 = &uart0; 26 uart0 = &uart0;
27 }; 27 };
28 28
29 cpu_intc: cpu_intc { 29 cpu_intc: interrupt-controller {
30 #address-cells = <0>; 30 #address-cells = <0>;
31 compatible = "mti,cpu-interrupt-controller"; 31 compatible = "mti,cpu-interrupt-controller";
32 32
@@ -40,6 +40,12 @@
40 #clock-cells = <0>; 40 #clock-cells = <0>;
41 clock-frequency = <81000000>; 41 clock-frequency = <81000000>;
42 }; 42 };
43
44 upg_clk: upg_clk {
45 compatible = "fixed-clock";
46 #clock-cells = <0>;
47 clock-frequency = <27000000>;
48 };
43 }; 49 };
44 50
45 rdb { 51 rdb {
@@ -49,7 +55,7 @@
49 compatible = "simple-bus"; 55 compatible = "simple-bus";
50 ranges = <0 0x10000000 0x01000000>; 56 ranges = <0 0x10000000 0x01000000>;
51 57
52 periph_intc: periph_intc@411400 { 58 periph_intc: interrupt-controller@411400 {
53 compatible = "brcm,bcm7038-l1-intc"; 59 compatible = "brcm,bcm7038-l1-intc";
54 reg = <0x411400 0x30>, <0x411600 0x30>; 60 reg = <0x411400 0x30>, <0x411600 0x30>;
55 61
@@ -60,7 +66,7 @@
60 interrupts = <2>, <3>; 66 interrupts = <2>, <3>;
61 }; 67 };
62 68
63 sun_l2_intc: sun_l2_intc@403000 { 69 sun_l2_intc: interrupt-controller@403000 {
64 compatible = "brcm,l2-intc"; 70 compatible = "brcm,l2-intc";
65 reg = <0x403000 0x30>; 71 reg = <0x403000 0x30>;
66 interrupt-controller; 72 interrupt-controller;
@@ -81,7 +87,7 @@
81 "avd_0", "jtag_0"; 87 "avd_0", "jtag_0";
82 }; 88 };
83 89
84 upg_irq0_intc: upg_irq0_intc@406600 { 90 upg_irq0_intc: interrupt-controller@406600 {
85 compatible = "brcm,bcm7120-l2-intc"; 91 compatible = "brcm,bcm7120-l2-intc";
86 reg = <0x406600 0x8>; 92 reg = <0x406600 0x8>;
87 93
@@ -96,7 +102,7 @@
96 interrupt-names = "upg_main", "upg_bsc"; 102 interrupt-names = "upg_main", "upg_bsc";
97 }; 103 };
98 104
99 upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { 105 upg_aon_irq0_intc: interrupt-controller@408b80 {
100 compatible = "brcm,bcm7120-l2-intc"; 106 compatible = "brcm,bcm7120-l2-intc";
101 reg = <0x408b80 0x8>; 107 reg = <0x408b80 0x8>;
102 108
@@ -190,6 +196,51 @@
190 status = "disabled"; 196 status = "disabled";
191 }; 197 };
192 198
199 pwma: pwm@406400 {
200 compatible = "brcm,bcm7038-pwm";
201 reg = <0x406400 0x28>;
202 #pwm-cells = <2>;
203 clocks = <&upg_clk>;
204 status = "disabled";
205 };
206
207 aon_pm_l2_intc: interrupt-controller@408440 {
208 compatible = "brcm,l2-intc";
209 reg = <0x408440 0x30>;
210 interrupt-controller;
211 #interrupt-cells = <1>;
212 interrupt-parent = <&periph_intc>;
213 interrupts = <50>;
214 brcm,irq-can-wake;
215 };
216
217 upg_gio: gpio@406500 {
218 compatible = "brcm,brcmstb-gpio";
219 reg = <0x406500 0xa0>;
220 #gpio-cells = <2>;
221 #interrupt-cells = <2>;
222 gpio-controller;
223 interrupt-controller;
224 interrupt-parent = <&upg_irq0_intc>;
225 interrupts = <6>;
226 brcm,gpio-bank-widths = <32 32 32 29 4>;
227 };
228
229 upg_gio_aon: gpio@408c00 {
230 compatible = "brcm,brcmstb-gpio";
231 reg = <0x408c00 0x60>;
232 #gpio-cells = <2>;
233 #interrupt-cells = <2>;
234 gpio-controller;
235 interrupt-controller;
236 interrupt-parent = <&upg_aon_irq0_intc>;
237 interrupts = <6>;
238 interrupts-extended = <&upg_aon_irq0_intc 6>,
239 <&aon_pm_l2_intc 5>;
240 wakeup-source;
241 brcm,gpio-bank-widths = <21 32 2>;
242 };
243
193 enet0: ethernet@430000 { 244 enet0: ethernet@430000 {
194 phy-mode = "internal"; 245 phy-mode = "internal";
195 phy-handle = <&phy1>; 246 phy-handle = <&phy1>;
@@ -236,6 +287,26 @@
236 status = "disabled"; 287 status = "disabled";
237 }; 288 };
238 289
290 hif_l2_intc: interrupt-controller@411000 {
291 compatible = "brcm,l2-intc";
292 reg = <0x411000 0x30>;
293 interrupt-controller;
294 #interrupt-cells = <1>;
295 interrupt-parent = <&periph_intc>;
296 interrupts = <30>;
297 };
298
299 nand: nand@412800 {
300 compatible = "brcm,brcmnand-v5.0", "brcm,brcmnand";
301 #address-cells = <1>;
302 #size-cells = <0>;
303 reg-names = "nand";
304 reg = <0x412800 0x400>;
305 interrupt-parent = <&hif_l2_intc>;
306 interrupts = <24>;
307 status = "disabled";
308 };
309
239 sata: sata@181000 { 310 sata: sata@181000 {
240 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; 311 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci";
241 reg-names = "ahci", "top-ctrl"; 312 reg-names = "ahci", "top-ctrl";
@@ -275,5 +346,13 @@
275 #phy-cells = <0>; 346 #phy-cells = <0>;
276 }; 347 };
277 }; 348 };
349
350 sdhci0: sdhci@410000 {
351 compatible = "brcm,bcm7425-sdhci";
352 reg = <0x410000 0x100>;
353 interrupt-parent = <&periph_intc>;
354 interrupts = <82>;
355 status = "disabled";
356 };
278 }; 357 };
279}; 358};
diff --git a/arch/mips/boot/dts/brcm/bcm7420.dtsi b/arch/mips/boot/dts/brcm/bcm7420.dtsi
index 0586bf662571..b143723c674e 100644
--- a/arch/mips/boot/dts/brcm/bcm7420.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7420.dtsi
@@ -26,7 +26,7 @@
26 uart0 = &uart0; 26 uart0 = &uart0;
27 }; 27 };
28 28
29 cpu_intc: cpu_intc { 29 cpu_intc: interrupt-controller {
30 #address-cells = <0>; 30 #address-cells = <0>;
31 compatible = "mti,cpu-interrupt-controller"; 31 compatible = "mti,cpu-interrupt-controller";
32 32
@@ -40,6 +40,12 @@
40 #clock-cells = <0>; 40 #clock-cells = <0>;
41 clock-frequency = <81000000>; 41 clock-frequency = <81000000>;
42 }; 42 };
43
44 upg_clk: upg_clk {
45 compatible = "fixed-clock";
46 #clock-cells = <0>;
47 clock-frequency = <27000000>;
48 };
43 }; 49 };
44 50
45 rdb { 51 rdb {
@@ -49,7 +55,7 @@
49 compatible = "simple-bus"; 55 compatible = "simple-bus";
50 ranges = <0 0x10000000 0x01000000>; 56 ranges = <0 0x10000000 0x01000000>;
51 57
52 periph_intc: periph_intc@441400 { 58 periph_intc: interrupt-controller@441400 {
53 compatible = "brcm,bcm7038-l1-intc"; 59 compatible = "brcm,bcm7038-l1-intc";
54 reg = <0x441400 0x30>, <0x441600 0x30>; 60 reg = <0x441400 0x30>, <0x441600 0x30>;
55 61
@@ -60,7 +66,7 @@
60 interrupts = <2>, <3>; 66 interrupts = <2>, <3>;
61 }; 67 };
62 68
63 sun_l2_intc: sun_l2_intc@401800 { 69 sun_l2_intc: interrupt-controller@401800 {
64 compatible = "brcm,l2-intc"; 70 compatible = "brcm,l2-intc";
65 reg = <0x401800 0x30>; 71 reg = <0x401800 0x30>;
66 interrupt-controller; 72 interrupt-controller;
@@ -82,7 +88,7 @@
82 "jtag_0"; 88 "jtag_0";
83 }; 89 };
84 90
85 upg_irq0_intc: upg_irq0_intc@406780 { 91 upg_irq0_intc: interrupt-controller@406780 {
86 compatible = "brcm,bcm7120-l2-intc"; 92 compatible = "brcm,bcm7120-l2-intc";
87 reg = <0x406780 0x8>; 93 reg = <0x406780 0x8>;
88 94
@@ -191,6 +197,34 @@
191 status = "disabled"; 197 status = "disabled";
192 }; 198 };
193 199
200 pwma: pwm@406580 {
201 compatible = "brcm,bcm7038-pwm";
202 reg = <0x406580 0x28>;
203 #pwm-cells = <2>;
204 clocks = <&upg_clk>;
205 status = "disabled";
206 };
207
208 pwmb: pwm@406880 {
209 compatible = "brcm,bcm7038-pwm";
210 reg = <0x406880 0x28>;
211 #pwm-cells = <2>;
212 clocks = <&upg_clk>;
213 status = "disabled";
214 };
215
216 upg_gio: gpio@406700 {
217 compatible = "brcm,brcmstb-gpio";
218 reg = <0x406700 0x80>;
219 #gpio-cells = <2>;
220 #interrupt-cells = <2>;
221 gpio-controller;
222 interrupt-controller;
223 interrupt-parent = <&upg_irq0_intc>;
224 interrupts = <6>;
225 brcm,gpio-bank-widths = <32 32 32 27>;
226 };
227
194 enet0: ethernet@468000 { 228 enet0: ethernet@468000 {
195 phy-mode = "internal"; 229 phy-mode = "internal";
196 phy-handle = <&phy1>; 230 phy-handle = <&phy1>;
diff --git a/arch/mips/boot/dts/brcm/bcm7425.dtsi b/arch/mips/boot/dts/brcm/bcm7425.dtsi
index c1c15edaf829..2488d2f61f60 100644
--- a/arch/mips/boot/dts/brcm/bcm7425.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7425.dtsi
@@ -26,7 +26,7 @@
26 uart0 = &uart0; 26 uart0 = &uart0;
27 }; 27 };
28 28
29 cpu_intc: cpu_intc { 29 cpu_intc: interrupt-controller {
30 #address-cells = <0>; 30 #address-cells = <0>;
31 compatible = "mti,cpu-interrupt-controller"; 31 compatible = "mti,cpu-interrupt-controller";
32 32
@@ -40,6 +40,12 @@
40 #clock-cells = <0>; 40 #clock-cells = <0>;
41 clock-frequency = <81000000>; 41 clock-frequency = <81000000>;
42 }; 42 };
43
44 upg_clk: upg_clk {
45 compatible = "fixed-clock";
46 #clock-cells = <0>;
47 clock-frequency = <27000000>;
48 };
43 }; 49 };
44 50
45 rdb { 51 rdb {
@@ -49,7 +55,7 @@
49 compatible = "simple-bus"; 55 compatible = "simple-bus";
50 ranges = <0 0x10000000 0x01000000>; 56 ranges = <0 0x10000000 0x01000000>;
51 57
52 periph_intc: periph_intc@41a400 { 58 periph_intc: interrupt-controller@41a400 {
53 compatible = "brcm,bcm7038-l1-intc"; 59 compatible = "brcm,bcm7038-l1-intc";
54 reg = <0x41a400 0x30>, <0x41a600 0x30>; 60 reg = <0x41a400 0x30>, <0x41a600 0x30>;
55 61
@@ -60,7 +66,7 @@
60 interrupts = <2>, <3>; 66 interrupts = <2>, <3>;
61 }; 67 };
62 68
63 sun_l2_intc: sun_l2_intc@403000 { 69 sun_l2_intc: interrupt-controller@403000 {
64 compatible = "brcm,l2-intc"; 70 compatible = "brcm,l2-intc";
65 reg = <0x403000 0x30>; 71 reg = <0x403000 0x30>;
66 interrupt-controller; 72 interrupt-controller;
@@ -83,7 +89,7 @@
83 "vice_0"; 89 "vice_0";
84 }; 90 };
85 91
86 upg_irq0_intc: upg_irq0_intc@406780 { 92 upg_irq0_intc: interrupt-controller@406780 {
87 compatible = "brcm,bcm7120-l2-intc"; 93 compatible = "brcm,bcm7120-l2-intc";
88 reg = <0x406780 0x8>; 94 reg = <0x406780 0x8>;
89 95
@@ -98,7 +104,7 @@
98 interrupt-names = "upg_main", "upg_bsc"; 104 interrupt-names = "upg_main", "upg_bsc";
99 }; 105 };
100 106
101 upg_aon_irq0_intc: upg_aon_irq0_intc@409480 { 107 upg_aon_irq0_intc: interrupt-controller@409480 {
102 compatible = "brcm,bcm7120-l2-intc"; 108 compatible = "brcm,bcm7120-l2-intc";
103 reg = <0x409480 0x8>; 109 reg = <0x409480 0x8>;
104 110
@@ -209,6 +215,59 @@
209 status = "disabled"; 215 status = "disabled";
210 }; 216 };
211 217
218 pwma: pwm@406580 {
219 compatible = "brcm,bcm7038-pwm";
220 reg = <0x406580 0x28>;
221 #pwm-cells = <2>;
222 clocks = <&upg_clk>;
223 status = "disabled";
224 };
225
226 pwmb: pwm@406800 {
227 compatible = "brcm,bcm7038-pwm";
228 reg = <0x406800 0x28>;
229 #pwm-cells = <2>;
230 clocks = <&upg_clk>;
231 status = "disabled";
232 };
233
234 aon_pm_l2_intc: interrupt-controller@408440 {
235 compatible = "brcm,l2-intc";
236 reg = <0x408440 0x30>;
237 interrupt-controller;
238 #interrupt-cells = <1>;
239 interrupt-parent = <&periph_intc>;
240 interrupts = <49>;
241 brcm,irq-can-wake;
242 };
243
244 upg_gio: gpio@406700 {
245 compatible = "brcm,brcmstb-gpio";
246 reg = <0x406700 0x80>;
247 #gpio-cells = <2>;
248 #interrupt-cells = <2>;
249 gpio-controller;
250 interrupt-controller;
251 interrupt-parent = <&upg_irq0_intc>;
252 interrupts = <6>;
253 brcm,gpio-bank-widths = <32 32 32 21>;
254 };
255
256 upg_gio_aon: gpio@4094c0 {
257 compatible = "brcm,brcmstb-gpio";
258 reg = <0x4094c0 0x40>;
259 #gpio-cells = <2>;
260 #interrupt-cells = <2>;
261 gpio-controller;
262 interrupt-controller;
263 interrupt-parent = <&upg_aon_irq0_intc>;
264 interrupts = <6>;
265 interrupts-extended = <&upg_aon_irq0_intc 6>,
266 <&aon_pm_l2_intc 5>;
267 wakeup-source;
268 brcm,gpio-bank-widths = <18 4>;
269 };
270
212 enet0: ethernet@b80000 { 271 enet0: ethernet@b80000 {
213 phy-mode = "internal"; 272 phy-mode = "internal";
214 phy-handle = <&phy1>; 273 phy-handle = <&phy1>;
@@ -312,6 +371,26 @@
312 status = "disabled"; 371 status = "disabled";
313 }; 372 };
314 373
374 hif_l2_intc: interrupt-controller@41a000 {
375 compatible = "brcm,l2-intc";
376 reg = <0x41a000 0x30>;
377 interrupt-controller;
378 #interrupt-cells = <1>;
379 interrupt-parent = <&periph_intc>;
380 interrupts = <24>;
381 };
382
383 nand: nand@41b800 {
384 compatible = "brcm,brcmnand-v5.0", "brcm,brcmnand";
385 #address-cells = <1>;
386 #size-cells = <0>;
387 reg-names = "nand";
388 reg = <0x41b800 0x400>;
389 interrupt-parent = <&hif_l2_intc>;
390 interrupts = <24>;
391 status = "disabled";
392 };
393
315 sata: sata@181000 { 394 sata: sata@181000 {
316 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; 395 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci";
317 reg-names = "ahci", "top-ctrl"; 396 reg-names = "ahci", "top-ctrl";
@@ -351,5 +430,25 @@
351 #phy-cells = <0>; 430 #phy-cells = <0>;
352 }; 431 };
353 }; 432 };
433
434 sdhci0: sdhci@419000 {
435 compatible = "brcm,bcm7425-sdhci";
436 reg = <0x419000 0x100>;
437 interrupt-parent = <&periph_intc>;
438 interrupts = <43>;
439 sd-uhs-sdr50;
440 mmc-hs200-1_8v;
441 status = "disabled";
442 };
443
444 sdhci1: sdhci@419200 {
445 compatible = "brcm,bcm7425-sdhci";
446 reg = <0x419200 0x100>;
447 interrupt-parent = <&periph_intc>;
448 interrupts = <44>;
449 sd-uhs-sdr50;
450 mmc-hs200-1_8v;
451 status = "disabled";
452 };
354 }; 453 };
355}; 454};
diff --git a/arch/mips/boot/dts/brcm/bcm7435.dtsi b/arch/mips/boot/dts/brcm/bcm7435.dtsi
index a874d3a0e2ee..19fa259b968b 100644
--- a/arch/mips/boot/dts/brcm/bcm7435.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7435.dtsi
@@ -38,7 +38,7 @@
38 uart0 = &uart0; 38 uart0 = &uart0;
39 }; 39 };
40 40
41 cpu_intc: cpu_intc { 41 cpu_intc: interrupt-controller {
42 #address-cells = <0>; 42 #address-cells = <0>;
43 compatible = "mti,cpu-interrupt-controller"; 43 compatible = "mti,cpu-interrupt-controller";
44 44
@@ -52,6 +52,12 @@
52 #clock-cells = <0>; 52 #clock-cells = <0>;
53 clock-frequency = <81000000>; 53 clock-frequency = <81000000>;
54 }; 54 };
55
56 upg_clk: upg_clk {
57 compatible = "fixed-clock";
58 #clock-cells = <0>;
59 clock-frequency = <27000000>;
60 };
55 }; 61 };
56 62
57 rdb { 63 rdb {
@@ -61,7 +67,7 @@
61 compatible = "simple-bus"; 67 compatible = "simple-bus";
62 ranges = <0 0x10000000 0x01000000>; 68 ranges = <0 0x10000000 0x01000000>;
63 69
64 periph_intc: periph_intc@41b500 { 70 periph_intc: interrupt-controller@41b500 {
65 compatible = "brcm,bcm7038-l1-intc"; 71 compatible = "brcm,bcm7038-l1-intc";
66 reg = <0x41b500 0x40>, <0x41b600 0x40>, 72 reg = <0x41b500 0x40>, <0x41b600 0x40>,
67 <0x41b700 0x40>, <0x41b800 0x40>; 73 <0x41b700 0x40>, <0x41b800 0x40>;
@@ -73,7 +79,7 @@
73 interrupts = <2>, <3>, <2>, <3>; 79 interrupts = <2>, <3>, <2>, <3>;
74 }; 80 };
75 81
76 sun_l2_intc: sun_l2_intc@403000 { 82 sun_l2_intc: interrupt-controller@403000 {
77 compatible = "brcm,l2-intc"; 83 compatible = "brcm,l2-intc";
78 reg = <0x403000 0x30>; 84 reg = <0x403000 0x30>;
79 interrupt-controller; 85 interrupt-controller;
@@ -98,7 +104,7 @@
98 "scpu"; 104 "scpu";
99 }; 105 };
100 106
101 upg_irq0_intc: upg_irq0_intc@406780 { 107 upg_irq0_intc: interrupt-controller@406780 {
102 compatible = "brcm,bcm7120-l2-intc"; 108 compatible = "brcm,bcm7120-l2-intc";
103 reg = <0x406780 0x8>; 109 reg = <0x406780 0x8>;
104 110
@@ -113,7 +119,7 @@
113 interrupt-names = "upg_main", "upg_bsc"; 119 interrupt-names = "upg_main", "upg_bsc";
114 }; 120 };
115 121
116 upg_aon_irq0_intc: upg_aon_irq0_intc@409480 { 122 upg_aon_irq0_intc: interrupt-controller@409480 {
117 compatible = "brcm,bcm7120-l2-intc"; 123 compatible = "brcm,bcm7120-l2-intc";
118 reg = <0x409480 0x8>; 124 reg = <0x409480 0x8>;
119 125
@@ -224,6 +230,59 @@
224 status = "disabled"; 230 status = "disabled";
225 }; 231 };
226 232
233 pwma: pwm@406580 {
234 compatible = "brcm,bcm7038-pwm";
235 reg = <0x406580 0x28>;
236 #pwm-cells = <2>;
237 clocks = <&upg_clk>;
238 status = "disabled";
239 };
240
241 pwmb: pwm@406800 {
242 compatible = "brcm,bcm7038-pwm";
243 reg = <0x406800 0x28>;
244 #pwm-cells = <2>;
245 clocks = <&upg_clk>;
246 status = "disabled";
247 };
248
249 aon_pm_l2_intc: interrupt-controller@408440 {
250 compatible = "brcm,l2-intc";
251 reg = <0x408440 0x30>;
252 interrupt-controller;
253 #interrupt-cells = <1>;
254 interrupt-parent = <&periph_intc>;
255 interrupts = <54>;
256 brcm,irq-can-wake;
257 };
258
259 upg_gio: gpio@406700 {
260 compatible = "brcm,brcmstb-gpio";
261 reg = <0x406700 0x80>;
262 #gpio-cells = <2>;
263 #interrupt-cells = <2>;
264 gpio-controller;
265 interrupt-controller;
266 interrupt-parent = <&upg_irq0_intc>;
267 interrupts = <6>;
268 brcm,gpio-bank-widths = <32 32 32 21>;
269 };
270
271 upg_gio_aon: gpio@4094c0 {
272 compatible = "brcm,brcmstb-gpio";
273 reg = <0x4094c0 0x40>;
274 #gpio-cells = <2>;
275 #interrupt-cells = <2>;
276 gpio-controller;
277 interrupt-controller;
278 interrupt-parent = <&upg_aon_irq0_intc>;
279 interrupts = <6>;
280 interrupts-extended = <&upg_aon_irq0_intc 6>,
281 <&aon_pm_l2_intc 5>;
282 wakeup-source;
283 brcm,gpio-bank-widths = <18 4>;
284 };
285
227 enet0: ethernet@b80000 { 286 enet0: ethernet@b80000 {
228 phy-mode = "internal"; 287 phy-mode = "internal";
229 phy-handle = <&phy1>; 288 phy-handle = <&phy1>;
@@ -327,6 +386,26 @@
327 status = "disabled"; 386 status = "disabled";
328 }; 387 };
329 388
389 hif_l2_intc: interrupt-controller@41b000 {
390 compatible = "brcm,l2-intc";
391 reg = <0x41b000 0x30>;
392 interrupt-controller;
393 #interrupt-cells = <1>;
394 interrupt-parent = <&periph_intc>;
395 interrupts = <24>;
396 };
397
398 nand: nand@41c800 {
399 compatible = "brcm,brcmnand-v6.2", "brcm,brcmnand";
400 #address-cells = <1>;
401 #size-cells = <0>;
402 reg-names = "nand", "flash-dma";
403 reg = <0x41c800 0x600>, <0x41d000 0x100>;
404 interrupt-parent = <&hif_l2_intc>;
405 interrupts = <24>, <4>;
406 status = "disabled";
407 };
408
330 sata: sata@181000 { 409 sata: sata@181000 {
331 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; 410 compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci";
332 reg-names = "ahci", "top-ctrl"; 411 reg-names = "ahci", "top-ctrl";
@@ -366,5 +445,25 @@
366 #phy-cells = <0>; 445 #phy-cells = <0>;
367 }; 446 };
368 }; 447 };
448
449 sdhci0: sdhci@41a000 {
450 compatible = "brcm,bcm7425-sdhci";
451 reg = <0x41a000 0x100>;
452 interrupt-parent = <&periph_intc>;
453 interrupts = <47>;
454 sd-uhs-sdr50;
455 mmc-hs200-1_8v;
456 status = "disabled";
457 };
458
459 sdhci1: sdhci@41a200 {
460 compatible = "brcm,bcm7425-sdhci";
461 reg = <0x41a200 0x100>;
462 interrupt-parent = <&periph_intc>;
463 interrupts = <48>;
464 sd-uhs-sdr50;
465 mmc-hs200-1_8v;
466 status = "disabled";
467 };
369 }; 468 };
370}; 469};
diff --git a/arch/mips/boot/dts/brcm/bcm97125cbmb.dts b/arch/mips/boot/dts/brcm/bcm97125cbmb.dts
index f2449d147c6d..5c24eacd72dd 100644
--- a/arch/mips/boot/dts/brcm/bcm97125cbmb.dts
+++ b/arch/mips/boot/dts/brcm/bcm97125cbmb.dts
@@ -45,6 +45,10 @@
45 status = "okay"; 45 status = "okay";
46}; 46};
47 47
48&pwma {
49 status = "okay";
50};
51
48/* FIXME: USB is wonky; disable it for now */ 52/* FIXME: USB is wonky; disable it for now */
49&ehci0 { 53&ehci0 {
50 status = "disabled"; 54 status = "disabled";
diff --git a/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts b/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts
index d3d28816a027..e67eaf30de3d 100644
--- a/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts
+++ b/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "bcm7346.dtsi" 3/include/ "bcm7346.dtsi"
4/include/ "bcm97xxx-nand-cs1-bch24.dtsi"
4 5
5/ { 6/ {
6 compatible = "brcm,bcm97346dbsmb", "brcm,bcm7346"; 7 compatible = "brcm,bcm97346dbsmb", "brcm,bcm7346";
@@ -49,6 +50,14 @@
49 status = "okay"; 50 status = "okay";
50}; 51};
51 52
53&pwma {
54 status = "okay";
55};
56
57&pwmb {
58 status = "okay";
59};
60
52&enet0 { 61&enet0 {
53 status = "okay"; 62 status = "okay";
54}; 63};
@@ -85,6 +94,10 @@
85 status = "okay"; 94 status = "okay";
86}; 95};
87 96
97&nand {
98 status = "okay";
99};
100
88&sata { 101&sata {
89 status = "okay"; 102 status = "okay";
90}; 103};
@@ -92,3 +105,7 @@
92&sata_phy { 105&sata_phy {
93 status = "okay"; 106 status = "okay";
94}; 107};
108
109&sdhci0 {
110 status = "okay";
111};
diff --git a/arch/mips/boot/dts/brcm/bcm97358svmb.dts b/arch/mips/boot/dts/brcm/bcm97358svmb.dts
index 02ce6b429dc4..ee4607fae47a 100644
--- a/arch/mips/boot/dts/brcm/bcm97358svmb.dts
+++ b/arch/mips/boot/dts/brcm/bcm97358svmb.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "bcm7358.dtsi" 3/include/ "bcm7358.dtsi"
4/include/ "bcm97xxx-nand-cs1-bch4.dtsi"
4 5
5/ { 6/ {
6 compatible = "brcm,bcm97358svmb", "brcm,bcm7358"; 7 compatible = "brcm,bcm97358svmb", "brcm,bcm7358";
@@ -45,6 +46,14 @@
45 status = "okay"; 46 status = "okay";
46}; 47};
47 48
49&pwma {
50 status = "okay";
51};
52
53&pwmb {
54 status = "okay";
55};
56
48&enet0 { 57&enet0 {
49 status = "okay"; 58 status = "okay";
50}; 59};
@@ -56,3 +65,7 @@
56&ohci0 { 65&ohci0 {
57 status = "okay"; 66 status = "okay";
58}; 67};
68
69&nand {
70 status = "okay";
71};
diff --git a/arch/mips/boot/dts/brcm/bcm97360svmb.dts b/arch/mips/boot/dts/brcm/bcm97360svmb.dts
index 73124be9548a..bed821b03013 100644
--- a/arch/mips/boot/dts/brcm/bcm97360svmb.dts
+++ b/arch/mips/boot/dts/brcm/bcm97360svmb.dts
@@ -45,6 +45,10 @@
45 status = "okay"; 45 status = "okay";
46}; 46};
47 47
48&pwma {
49 status = "okay";
50};
51
48&enet0 { 52&enet0 {
49 status = "okay"; 53 status = "okay";
50}; 54};
@@ -64,3 +68,7 @@
64&sata_phy { 68&sata_phy {
65 status = "okay"; 69 status = "okay";
66}; 70};
71
72&sdhci0 {
73 status = "okay";
74};
diff --git a/arch/mips/boot/dts/brcm/bcm97362svmb.dts b/arch/mips/boot/dts/brcm/bcm97362svmb.dts
index 3cfcaebe7f79..68fd823868e0 100644
--- a/arch/mips/boot/dts/brcm/bcm97362svmb.dts
+++ b/arch/mips/boot/dts/brcm/bcm97362svmb.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "bcm7362.dtsi" 3/include/ "bcm7362.dtsi"
4/include/ "bcm97xxx-nand-cs1-bch4.dtsi"
4 5
5/ { 6/ {
6 compatible = "brcm,bcm97362svmb", "brcm,bcm7362"; 7 compatible = "brcm,bcm97362svmb", "brcm,bcm7362";
@@ -41,6 +42,10 @@
41 status = "okay"; 42 status = "okay";
42}; 43};
43 44
45&pwma {
46 status = "okay";
47};
48
44&enet0 { 49&enet0 {
45 status = "okay"; 50 status = "okay";
46}; 51};
@@ -53,6 +58,10 @@
53 status = "okay"; 58 status = "okay";
54}; 59};
55 60
61&nand {
62 status = "okay";
63};
64
56&sata { 65&sata {
57 status = "okay"; 66 status = "okay";
58}; 67};
@@ -60,3 +69,7 @@
60&sata_phy { 69&sata_phy {
61 status = "okay"; 70 status = "okay";
62}; 71};
72
73&sdhci0 {
74 status = "okay";
75};
diff --git a/arch/mips/boot/dts/brcm/bcm97420c.dts b/arch/mips/boot/dts/brcm/bcm97420c.dts
index 600d57abee05..e66271af055e 100644
--- a/arch/mips/boot/dts/brcm/bcm97420c.dts
+++ b/arch/mips/boot/dts/brcm/bcm97420c.dts
@@ -51,6 +51,14 @@
51 status = "okay"; 51 status = "okay";
52}; 52};
53 53
54&pwma {
55 status = "okay";
56};
57
58&pwmb {
59 status = "okay";
60};
61
54/* FIXME: MAC driver comes up but cannot attach to PHY */ 62/* FIXME: MAC driver comes up but cannot attach to PHY */
55&enet0 { 63&enet0 {
56 status = "disabled"; 64 status = "disabled";
diff --git a/arch/mips/boot/dts/brcm/bcm97425svmb.dts b/arch/mips/boot/dts/brcm/bcm97425svmb.dts
index 119c714805cb..f95ba1bf3e58 100644
--- a/arch/mips/boot/dts/brcm/bcm97425svmb.dts
+++ b/arch/mips/boot/dts/brcm/bcm97425svmb.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "bcm7425.dtsi" 3/include/ "bcm7425.dtsi"
4/include/ "bcm97xxx-nand-cs1-bch24.dtsi"
4 5
5/ { 6/ {
6 compatible = "brcm,bcm97425svmb", "brcm,bcm7425"; 7 compatible = "brcm,bcm97425svmb", "brcm,bcm7425";
@@ -51,6 +52,14 @@
51 status = "okay"; 52 status = "okay";
52}; 53};
53 54
55&pwma {
56 status = "okay";
57};
58
59&pwmb {
60 status = "okay";
61};
62
54&enet0 { 63&enet0 {
55 status = "okay"; 64 status = "okay";
56}; 65};
@@ -86,3 +95,15 @@
86&ohci3 { 95&ohci3 {
87 status = "okay"; 96 status = "okay";
88}; 97};
98
99&nand {
100 status = "okay";
101};
102
103&sdhci0 {
104 status = "okay";
105};
106
107&sdhci1 {
108 status = "okay";
109};
diff --git a/arch/mips/boot/dts/brcm/bcm97435svmb.dts b/arch/mips/boot/dts/brcm/bcm97435svmb.dts
index 43e3ba27f07b..fb37b7111bf4 100644
--- a/arch/mips/boot/dts/brcm/bcm97435svmb.dts
+++ b/arch/mips/boot/dts/brcm/bcm97435svmb.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "bcm7435.dtsi" 3/include/ "bcm7435.dtsi"
4/include/ "bcm97xxx-nand-cs1-bch24.dtsi"
4 5
5/ { 6/ {
6 compatible = "brcm,bcm97435svmb", "brcm,bcm7435"; 7 compatible = "brcm,bcm97435svmb", "brcm,bcm7435";
@@ -51,6 +52,14 @@
51 status = "okay"; 52 status = "okay";
52}; 53};
53 54
55&pwma {
56 status = "okay";
57};
58
59&pwmb {
60 status = "okay";
61};
62
54&enet0 { 63&enet0 {
55 status = "okay"; 64 status = "okay";
56}; 65};
@@ -87,6 +96,10 @@
87 status = "okay"; 96 status = "okay";
88}; 97};
89 98
99&nand {
100 status = "okay";
101};
102
90&sata { 103&sata {
91 status = "okay"; 104 status = "okay";
92}; 105};
@@ -94,3 +107,11 @@
94&sata_phy { 107&sata_phy {
95 status = "okay"; 108 status = "okay";
96}; 109};
110
111&sdhci0 {
112 status = "okay";
113};
114
115&sdhci1 {
116 status = "okay";
117};
diff --git a/arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch24.dtsi b/arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch24.dtsi
new file mode 100644
index 000000000000..3c24f97de922
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch24.dtsi
@@ -0,0 +1,25 @@
1&nand {
2 nandcs@1 {
3 compatible = "brcm,nandcs";
4 reg = <1>;
5 nand-on-flash-bbt;
6
7 nand-ecc-strength = <24>;
8 nand-ecc-step-size = <1024>;
9 brcm,nand-oob-sector-size = <27>;
10
11 partitions {
12 compatible = "fixed-partitions";
13 #address-cells = <1>;
14 #size-cells = <1>;
15
16 flash1.rootfs@0 {
17 reg = <0x0 0x10000000>;
18 };
19
20 flash1.kernel@10000000 {
21 reg = <0x10000000 0x400000>;
22 };
23 };
24 };
25};
diff --git a/arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch4.dtsi b/arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch4.dtsi
new file mode 100644
index 000000000000..cb531816ef4c
--- /dev/null
+++ b/arch/mips/boot/dts/brcm/bcm97xxx-nand-cs1-bch4.dtsi
@@ -0,0 +1,25 @@
1&nand {
2 nandcs@1 {
3 compatible = "brcm,nandcs";
4 reg = <1>;
5 nand-on-flash-bbt;
6
7 nand-ecc-strength = <4>;
8 nand-ecc-step-size = <512>;
9 brcm,nand-oob-sector-size = <16>;
10
11 partitions {
12 compatible = "fixed-partitions";
13 #address-cells = <1>;
14 #size-cells = <1>;
15
16 flash1.rootfs@0 {
17 reg = <0x0 0x10000000>;
18 };
19
20 flash1.kernel@10000000 {
21 reg = <0x10000000 0x400000>;
22 };
23 };
24 };
25};
diff --git a/arch/mips/boot/dts/cavium-octeon/dlink_dsr-1000n.dts b/arch/mips/boot/dts/cavium-octeon/dlink_dsr-1000n.dts
index b134798a0fd7..cfa29156eb69 100644
--- a/arch/mips/boot/dts/cavium-octeon/dlink_dsr-1000n.dts
+++ b/arch/mips/boot/dts/cavium-octeon/dlink_dsr-1000n.dts
@@ -8,55 +8,16 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11/include/ "octeon_3xxx.dtsi" 11/include/ "dlink_dsr-500n-1000n.dtsi"
12#include <dt-bindings/gpio/gpio.h> 12#include <dt-bindings/gpio/gpio.h>
13 13
14/ { 14/ {
15 model = "dlink,dsr-1000n"; 15 model = "dlink,dsr-1000n";
16 16
17 soc@0 { 17 soc@0 {
18 smi0: mdio@1180000001800 {
19 phy8: ethernet-phy@8 {
20 reg = <8>;
21 compatible = "ethernet-phy-ieee802.3-c22";
22 };
23 };
24
25 pip: pip@11800a0000000 {
26 interface@0 {
27 ethernet@0 {
28 fixed-link {
29 speed = <1000>;
30 full-duplex;
31 };
32 };
33 ethernet@1 {
34 fixed-link {
35 speed = <1000>;
36 full-duplex;
37 };
38 };
39 ethernet@2 {
40 phy-handle = <&phy8>;
41 };
42 };
43 };
44
45 twsi0: i2c@1180000001000 {
46 rtc@68 {
47 compatible = "dallas,ds1337";
48 reg = <0x68>;
49 };
50 };
51
52 uart0: serial@1180000000800 { 18 uart0: serial@1180000000800 {
53 clock-frequency = <500000000>; 19 clock-frequency = <500000000>;
54 }; 20 };
55
56 usbn: usbn@1180068000000 {
57 refclk-frequency = <12000000>;
58 refclk-type = "crystal";
59 };
60 }; 21 };
61 22
62 leds { 23 leds {
@@ -87,8 +48,4 @@
87 gpios = <&gpio 18 GPIO_ACTIVE_LOW>; 48 gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
88 }; 49 };
89 }; 50 };
90
91 aliases {
92 pip = &pip;
93 };
94}; 51};
diff --git a/arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n-1000n.dtsi b/arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n-1000n.dtsi
new file mode 100644
index 000000000000..246b598201f8
--- /dev/null
+++ b/arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n-1000n.dtsi
@@ -0,0 +1,58 @@
1/*
2 * Device tree source for D-Link DSR-500N/1000N (common parts).
3 *
4 * Written by: Aaro Koskinen <aaro.koskinen@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/include/ "octeon_3xxx.dtsi"
12
13/ {
14 soc@0 {
15 smi0: mdio@1180000001800 {
16 phy8: ethernet-phy@8 {
17 reg = <8>;
18 compatible = "ethernet-phy-ieee802.3-c22";
19 };
20 };
21
22 pip: pip@11800a0000000 {
23 interface@0 {
24 ethernet@0 {
25 fixed-link {
26 speed = <1000>;
27 full-duplex;
28 };
29 };
30 ethernet@1 {
31 fixed-link {
32 speed = <1000>;
33 full-duplex;
34 };
35 };
36 ethernet@2 {
37 phy-handle = <&phy8>;
38 };
39 };
40 };
41
42 twsi0: i2c@1180000001000 {
43 rtc@68 {
44 compatible = "dallas,ds1337";
45 reg = <0x68>;
46 };
47 };
48
49 usbn: usbn@1180068000000 {
50 refclk-frequency = <12000000>;
51 refclk-type = "crystal";
52 };
53 };
54
55 aliases {
56 pip = &pip;
57 };
58};
diff --git a/arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n.dts b/arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n.dts
new file mode 100644
index 000000000000..78886e172c48
--- /dev/null
+++ b/arch/mips/boot/dts/cavium-octeon/dlink_dsr-500n.dts
@@ -0,0 +1,40 @@
1/*
2 * Device tree source for D-Link DSR-500N.
3 *
4 * Written by: Aaro Koskinen <aaro.koskinen@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/include/ "dlink_dsr-500n-1000n.dtsi"
12#include <dt-bindings/gpio/gpio.h>
13
14/ {
15 model = "dlink,dsr-500n";
16 compatible = "dlink,dsr-500n", "cavium,octeon-3860";
17
18 soc@0 {
19 uart0: serial@1180000000800 {
20 clock-frequency = <300000000>;
21 };
22 };
23
24 leds {
25 compatible = "gpio-leds";
26
27 usb {
28 gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
29 };
30
31 wps {
32 gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
33 };
34
35 wireless {
36 label = "2.4g";
37 gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
38 };
39 };
40};
diff --git a/arch/mips/boot/dts/mti/Makefile b/arch/mips/boot/dts/mti/Makefile
index 144d776cc9f2..fcabd69b7030 100644
--- a/arch/mips/boot/dts/mti/Makefile
+++ b/arch/mips/boot/dts/mti/Makefile
@@ -1,5 +1,5 @@
1dtb-$(CONFIG_MIPS_MALTA) += malta.dtb 1dtb-$(CONFIG_MIPS_MALTA) += malta.dtb
2dtb-$(CONFIG_MIPS_SEAD3) += sead3.dtb 2dtb-$(CONFIG_LEGACY_BOARD_SEAD3) += sead3.dtb
3 3
4obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) 4obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
5 5
diff --git a/arch/mips/boot/dts/mti/malta.dts b/arch/mips/boot/dts/mti/malta.dts
index b18c46637d21..f604a272d91d 100644
--- a/arch/mips/boot/dts/mti/malta.dts
+++ b/arch/mips/boot/dts/mti/malta.dts
@@ -1,5 +1,8 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/interrupt-controller/irq.h>
4#include <dt-bindings/interrupt-controller/mips-gic.h>
5
3/memreserve/ 0x00000000 0x00001000; /* YAMON exception vectors */ 6/memreserve/ 0x00000000 0x00001000; /* YAMON exception vectors */
4/memreserve/ 0x00001000 0x000ef000; /* YAMON */ 7/memreserve/ 0x00001000 0x000ef000; /* YAMON */
5/memreserve/ 0x000f0000 0x00010000; /* PIIX4 ISA memory */ 8/memreserve/ 0x000f0000 0x00010000; /* PIIX4 ISA memory */
@@ -8,4 +11,100 @@
8 #address-cells = <1>; 11 #address-cells = <1>;
9 #size-cells = <1>; 12 #size-cells = <1>;
10 compatible = "mti,malta"; 13 compatible = "mti,malta";
14
15 cpu_intc: interrupt-controller {
16 compatible = "mti,cpu-interrupt-controller";
17
18 interrupt-controller;
19 #interrupt-cells = <1>;
20 };
21
22 gic: interrupt-controller@1bdc0000 {
23 compatible = "mti,gic";
24 reg = <0x1bdc0000 0x20000>;
25
26 interrupt-controller;
27 #interrupt-cells = <3>;
28
29 /*
30 * Declare the interrupt-parent even though the mti,gic
31 * binding doesn't require it, such that the kernel can
32 * figure out that cpu_intc is the root interrupt
33 * controller & should be probed first.
34 */
35 interrupt-parent = <&cpu_intc>;
36
37 timer {
38 compatible = "mti,gic-timer";
39 interrupts = <GIC_LOCAL 1 IRQ_TYPE_NONE>;
40 };
41 };
42
43 i8259: interrupt-controller@20 {
44 compatible = "intel,i8259";
45
46 interrupt-controller;
47 #interrupt-cells = <1>;
48
49 interrupt-parent = <&gic>;
50 interrupts = <GIC_SHARED 3 IRQ_TYPE_LEVEL_HIGH>;
51 };
52
53 flash@1e000000 {
54 compatible = "intel,dt28f160", "cfi-flash";
55 reg = <0x1e000000 0x400000>;
56 bank-width = <4>;
57 #address-cells = <1>;
58 #size-cells = <1>;
59
60 partitions {
61 compatible = "fixed-partitions";
62 #address-cells = <1>;
63 #size-cells = <1>;
64
65 yamon@0 {
66 label = "YAMON";
67 reg = <0x0 0x100000>;
68 read-only;
69 };
70
71 user-fs@100000 {
72 label = "User FS";
73 reg = <0x100000 0x2e0000>;
74 };
75
76 board-config@3e0000 {
77 label = "Board Config";
78 reg = <0x3e0000 0x20000>;
79 read-only;
80 };
81 };
82 };
83
84 fpga_regs: system-controller@1f000000 {
85 compatible = "mti,malta-fpga", "syscon", "simple-mfd";
86 reg = <0x1f000000 0x1000>;
87
88 reboot {
89 compatible = "syscon-reboot";
90 regmap = <&fpga_regs>;
91 offset = <0x500>;
92 mask = <0x4d>;
93 };
94 };
95
96 isa {
97 compatible = "isa";
98 #address-cells = <2>;
99 #size-cells = <1>;
100 ranges = <1 0 0 0x1000>;
101
102 rtc@70 {
103 compatible = "motorola,mc146818";
104 reg = <1 0x70 0x8>;
105
106 interrupt-parent = <&i8259>;
107 interrupts = <8>;
108 };
109 };
11}; 110};
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index e4b317d414f1..b112879a5d9d 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -4,10 +4,23 @@
4/memreserve/ 0x00001000 0x000ef000; // ROM data 4/memreserve/ 0x00001000 0x000ef000; // ROM data
5/memreserve/ 0x000f0000 0x004cc000; // reserved 5/memreserve/ 0x000f0000 0x004cc000; // reserved
6 6
7#include <dt-bindings/interrupt-controller/mips-gic.h>
8
7/ { 9/ {
8 #address-cells = <1>; 10 #address-cells = <1>;
9 #size-cells = <1>; 11 #size-cells = <1>;
10 compatible = "mti,sead-3"; 12 compatible = "mti,sead-3";
13 model = "MIPS SEAD-3";
14 interrupt-parent = <&gic>;
15
16 chosen {
17 stdout-path = "uart1:115200";
18 };
19
20 aliases {
21 uart0 = &uart0;
22 uart1 = &uart1;
23 };
11 24
12 cpus { 25 cpus {
13 cpu@0 { 26 cpu@0 {
@@ -19,4 +32,229 @@
19 device_type = "memory"; 32 device_type = "memory";
20 reg = <0x0 0x08000000>; 33 reg = <0x0 0x08000000>;
21 }; 34 };
35
36 cpu_intc: interrupt-controller {
37 compatible = "mti,cpu-interrupt-controller";
38
39 interrupt-controller;
40 #interrupt-cells = <1>;
41 };
42
43 gic: interrupt-controller@1b1c0000 {
44 compatible = "mti,gic";
45 reg = <0x1b1c0000 0x20000>;
46
47 interrupt-controller;
48 #interrupt-cells = <3>;
49
50 /*
51 * Declare the interrupt-parent even though the mti,gic
52 * binding doesn't require it, such that the kernel can
53 * figure out that cpu_intc is the root interrupt
54 * controller & should be probed first.
55 */
56 interrupt-parent = <&cpu_intc>;
57
58 timer {
59 compatible = "mti,gic-timer";
60 interrupts = <GIC_LOCAL 1 IRQ_TYPE_NONE>;
61 };
62 };
63
64 ehci@1b200000 {
65 compatible = "generic-ehci";
66 reg = <0x1b200000 0x1000>;
67
68 interrupts = <0>; /* GIC 0 or CPU 6 */
69
70 has-transaction-translator;
71 };
72
73 flash@1c000000 {
74 compatible = "intel,28f128j3", "cfi-flash";
75 reg = <0x1c000000 0x2000000>;
76 #address-cells = <1>;
77 #size-cells = <1>;
78 bank-width = <4>;
79
80 partitions {
81 compatible = "fixed-partitions";
82 #address-cells = <1>;
83 #size-cells = <1>;
84
85 user-fs@0 {
86 label = "User FS";
87 reg = <0x0 0x1fc0000>;
88 };
89
90 board-config@3e0000 {
91 label = "Board Config";
92 reg = <0x1fc0000 0x40000>;
93 };
94 };
95 };
96
97 fpga_regs: system-controller@1f000000 {
98 compatible = "mti,sead3-fpga", "syscon", "simple-mfd";
99 reg = <0x1f000000 0x200>;
100
101 reboot {
102 compatible = "syscon-reboot";
103 regmap = <&fpga_regs>;
104 offset = <0x50>;
105 mask = <0x4d>;
106 };
107
108 poweroff {
109 compatible = "restart-poweroff";
110 };
111 };
112
113 system-controller@1f000200 {
114 compatible = "mti,sead3-cpld", "syscon", "simple-mfd";
115 reg = <0x1f000200 0x300>;
116
117 led@10.0 {
118 compatible = "register-bit-led";
119 offset = <0x10>;
120 mask = <0x1>;
121 label = "pled0";
122 };
123 led@10.1 {
124 compatible = "register-bit-led";
125 offset = <0x10>;
126 mask = <0x2>;
127 label = "pled1";
128 };
129 led@10.2 {
130 compatible = "register-bit-led";
131 offset = <0x10>;
132 mask = <0x4>;
133 label = "pled2";
134 };
135 led@10.3 {
136 compatible = "register-bit-led";
137 offset = <0x10>;
138 mask = <0x8>;
139 label = "pled3";
140 };
141 led@10.4 {
142 compatible = "register-bit-led";
143 offset = <0x10>;
144 mask = <0x10>;
145 label = "pled4";
146 };
147 led@10.5 {
148 compatible = "register-bit-led";
149 offset = <0x10>;
150 mask = <0x20>;
151 label = "pled5";
152 };
153 led@10.6 {
154 compatible = "register-bit-led";
155 offset = <0x10>;
156 mask = <0x40>;
157 label = "pled6";
158 };
159 led@10.7 {
160 compatible = "register-bit-led";
161 offset = <0x10>;
162 mask = <0x80>;
163 label = "pled7";
164 };
165
166 led@18.0 {
167 compatible = "register-bit-led";
168 offset = <0x18>;
169 mask = <0x1>;
170 label = "fled0";
171 };
172 led@18.1 {
173 compatible = "register-bit-led";
174 offset = <0x18>;
175 mask = <0x2>;
176 label = "fled1";
177 };
178 led@18.2 {
179 compatible = "register-bit-led";
180 offset = <0x18>;
181 mask = <0x4>;
182 label = "fled2";
183 };
184 led@18.3 {
185 compatible = "register-bit-led";
186 offset = <0x18>;
187 mask = <0x8>;
188 label = "fled3";
189 };
190 led@18.4 {
191 compatible = "register-bit-led";
192 offset = <0x18>;
193 mask = <0x10>;
194 label = "fled4";
195 };
196 led@18.5 {
197 compatible = "register-bit-led";
198 offset = <0x18>;
199 mask = <0x20>;
200 label = "fled5";
201 };
202 led@18.6 {
203 compatible = "register-bit-led";
204 offset = <0x18>;
205 mask = <0x40>;
206 label = "fled6";
207 };
208 led@18.7 {
209 compatible = "register-bit-led";
210 offset = <0x18>;
211 mask = <0x80>;
212 label = "fled7";
213 };
214
215 lcd@200 {
216 compatible = "mti,sead3-lcd";
217 offset = <0x200>;
218 };
219 };
220
221 /* UART connected to FTDI & miniUSB socket */
222 uart0: uart@1f000900 {
223 compatible = "ns16550a";
224 reg = <0x1f000900 0x20>;
225 reg-io-width = <4>;
226 reg-shift = <2>;
227
228 clock-frequency = <14745600>;
229
230 interrupts = <3>; /* GIC 3 or CPU 4 */
231
232 no-loopback-test;
233 };
234
235 /* UART connected to RS232 socket */
236 uart1: uart@1f000800 {
237 compatible = "ns16550a";
238 reg = <0x1f000800 0x20>;
239 reg-io-width = <4>;
240 reg-shift = <2>;
241
242 clock-frequency = <14745600>;
243
244 interrupts = <2>; /* GIC 2 or CPU 4 */
245
246 no-loopback-test;
247 };
248
249 eth@1f010000 {
250 compatible = "smsc,lan9115";
251 reg = <0x1f010000 0x10000>;
252 reg-io-width = <4>;
253
254 interrupts = <0>; /* GIC 0 or CPU 6 */
255
256 phy-mode = "mii";
257 smsc,irq-push-pull;
258 smsc,save-mac-address;
259 };
22}; 260};
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
index ff49fc04500c..ab8362e04461 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
@@ -36,8 +36,6 @@
36 36
37#include <asm/octeon/cvmx-config.h> 37#include <asm/octeon/cvmx-config.h>
38 38
39#include <asm/octeon/cvmx-mdio.h>
40
41#include <asm/octeon/cvmx-helper.h> 39#include <asm/octeon/cvmx-helper.h>
42#include <asm/octeon/cvmx-helper-util.h> 40#include <asm/octeon/cvmx-helper-util.h>
43#include <asm/octeon/cvmx-helper-board.h> 41#include <asm/octeon/cvmx-helper-board.h>
@@ -46,17 +44,6 @@
46#include <asm/octeon/cvmx-asxx-defs.h> 44#include <asm/octeon/cvmx-asxx-defs.h>
47 45
48/** 46/**
49 * cvmx_override_board_link_get(int ipd_port) is a function
50 * pointer. It is meant to allow customization of the process of
51 * talking to a PHY to determine link speed. It is called every
52 * time a PHY must be polled for link status. Users should set
53 * this pointer to a function before calling any cvmx-helper
54 * operations.
55 */
56cvmx_helper_link_info_t(*cvmx_override_board_link_get) (int ipd_port) =
57 NULL;
58
59/**
60 * Return the MII PHY address associated with the given IPD 47 * Return the MII PHY address associated with the given IPD
61 * port. A result of -1 means there isn't a MII capable PHY 48 * port. A result of -1 means there isn't a MII capable PHY
62 * connected to this port. On chips supporting multiple MII 49 * connected to this port. On chips supporting multiple MII
@@ -222,12 +209,6 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
222cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port) 209cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
223{ 210{
224 cvmx_helper_link_info_t result; 211 cvmx_helper_link_info_t result;
225 int phy_addr;
226 int is_broadcom_phy = 0;
227
228 /* Give the user a chance to override the processing of this function */
229 if (cvmx_override_board_link_get)
230 return cvmx_override_board_link_get(ipd_port);
231 212
232 /* Unless we fix it later, all links are defaulted to down */ 213 /* Unless we fix it later, all links are defaulted to down */
233 result.u64 = 0; 214 result.u64 = 0;
@@ -263,8 +244,7 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
263 result.s.full_duplex = 1; 244 result.s.full_duplex = 1;
264 result.s.speed = 1000; 245 result.s.speed = 1000;
265 return result; 246 return result;
266 } else /* The other port uses a broadcom PHY */ 247 }
267 is_broadcom_phy = 1;
268 break; 248 break;
269 case CVMX_BOARD_TYPE_BBGW_REF: 249 case CVMX_BOARD_TYPE_BBGW_REF:
270 /* Port 1 on these boards is always Gigabit */ 250 /* Port 1 on these boards is always Gigabit */
@@ -282,108 +262,7 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
282 break; 262 break;
283 } 263 }
284 264
285 phy_addr = cvmx_helper_board_get_mii_address(ipd_port); 265 if (OCTEON_IS_MODEL(OCTEON_CN3XXX)
286 if (phy_addr != -1) {
287 if (is_broadcom_phy) {
288 /*
289 * Below we are going to read SMI/MDIO
290 * register 0x19 which works on Broadcom
291 * parts
292 */
293 int phy_status =
294 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
295 0x19);
296 switch ((phy_status >> 8) & 0x7) {
297 case 0:
298 result.u64 = 0;
299 break;
300 case 1:
301 result.s.link_up = 1;
302 result.s.full_duplex = 0;
303 result.s.speed = 10;
304 break;
305 case 2:
306 result.s.link_up = 1;
307 result.s.full_duplex = 1;
308 result.s.speed = 10;
309 break;
310 case 3:
311 result.s.link_up = 1;
312 result.s.full_duplex = 0;
313 result.s.speed = 100;
314 break;
315 case 4:
316 result.s.link_up = 1;
317 result.s.full_duplex = 1;
318 result.s.speed = 100;
319 break;
320 case 5:
321 result.s.link_up = 1;
322 result.s.full_duplex = 1;
323 result.s.speed = 100;
324 break;
325 case 6:
326 result.s.link_up = 1;
327 result.s.full_duplex = 0;
328 result.s.speed = 1000;
329 break;
330 case 7:
331 result.s.link_up = 1;
332 result.s.full_duplex = 1;
333 result.s.speed = 1000;
334 break;
335 }
336 } else {
337 /*
338 * This code assumes we are using a Marvell
339 * Gigabit PHY. All the speed information can
340 * be read from register 17 in one
341 * go. Somebody using a different PHY will
342 * need to handle it above in the board
343 * specific area.
344 */
345 int phy_status =
346 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff, 17);
347
348 /*
349 * If the resolve bit 11 isn't set, see if
350 * autoneg is turned off (bit 12, reg 0). The
351 * resolve bit doesn't get set properly when
352 * autoneg is off, so force it.
353 */
354 if ((phy_status & (1 << 11)) == 0) {
355 int auto_status =
356 cvmx_mdio_read(phy_addr >> 8,
357 phy_addr & 0xff, 0);
358 if ((auto_status & (1 << 12)) == 0)
359 phy_status |= 1 << 11;
360 }
361
362 /*
363 * Only return a link if the PHY has finished
364 * auto negotiation and set the resolved bit
365 * (bit 11)
366 */
367 if (phy_status & (1 << 11)) {
368 result.s.link_up = 1;
369 result.s.full_duplex = ((phy_status >> 13) & 1);
370 switch ((phy_status >> 14) & 3) {
371 case 0: /* 10 Mbps */
372 result.s.speed = 10;
373 break;
374 case 1: /* 100 Mbps */
375 result.s.speed = 100;
376 break;
377 case 2: /* 1 Gbps */
378 result.s.speed = 1000;
379 break;
380 case 3: /* Illegal */
381 result.u64 = 0;
382 break;
383 }
384 }
385 }
386 } else if (OCTEON_IS_MODEL(OCTEON_CN3XXX)
387 || OCTEON_IS_MODEL(OCTEON_CN58XX) 266 || OCTEON_IS_MODEL(OCTEON_CN58XX)
388 || OCTEON_IS_MODEL(OCTEON_CN50XX)) { 267 || OCTEON_IS_MODEL(OCTEON_CN50XX)) {
389 /* 268 /*
@@ -433,176 +312,6 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
433} 312}
434 313
435/** 314/**
436 * This function as a board specific method of changing the PHY
437 * speed, duplex, and auto-negotiation. This programs the PHY and
438 * not Octeon. This can be used to force Octeon's links to
439 * specific settings.
440 *
441 * @phy_addr: The address of the PHY to program
442 * @enable_autoneg:
443 * Non zero if you want to enable auto-negotiation.
444 * @link_info: Link speed to program. If the speed is zero and auto-negotiation
445 * is enabled, all possible negotiation speeds are advertised.
446 *
447 * Returns Zero on success, negative on failure
448 */
449int cvmx_helper_board_link_set_phy(int phy_addr,
450 cvmx_helper_board_set_phy_link_flags_types_t
451 link_flags,
452 cvmx_helper_link_info_t link_info)
453{
454
455 /* Set the flow control settings based on link_flags */
456 if ((link_flags & set_phy_link_flags_flow_control_mask) !=
457 set_phy_link_flags_flow_control_dont_touch) {
458 cvmx_mdio_phy_reg_autoneg_adver_t reg_autoneg_adver;
459 reg_autoneg_adver.u16 =
460 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
461 CVMX_MDIO_PHY_REG_AUTONEG_ADVER);
462 reg_autoneg_adver.s.asymmetric_pause =
463 (link_flags & set_phy_link_flags_flow_control_mask) ==
464 set_phy_link_flags_flow_control_enable;
465 reg_autoneg_adver.s.pause =
466 (link_flags & set_phy_link_flags_flow_control_mask) ==
467 set_phy_link_flags_flow_control_enable;
468 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
469 CVMX_MDIO_PHY_REG_AUTONEG_ADVER,
470 reg_autoneg_adver.u16);
471 }
472
473 /* If speed isn't set and autoneg is on advertise all supported modes */
474 if ((link_flags & set_phy_link_flags_autoneg)
475 && (link_info.s.speed == 0)) {
476 cvmx_mdio_phy_reg_control_t reg_control;
477 cvmx_mdio_phy_reg_status_t reg_status;
478 cvmx_mdio_phy_reg_autoneg_adver_t reg_autoneg_adver;
479 cvmx_mdio_phy_reg_extended_status_t reg_extended_status;
480 cvmx_mdio_phy_reg_control_1000_t reg_control_1000;
481
482 reg_status.u16 =
483 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
484 CVMX_MDIO_PHY_REG_STATUS);
485 reg_autoneg_adver.u16 =
486 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
487 CVMX_MDIO_PHY_REG_AUTONEG_ADVER);
488 reg_autoneg_adver.s.advert_100base_t4 =
489 reg_status.s.capable_100base_t4;
490 reg_autoneg_adver.s.advert_10base_tx_full =
491 reg_status.s.capable_10_full;
492 reg_autoneg_adver.s.advert_10base_tx_half =
493 reg_status.s.capable_10_half;
494 reg_autoneg_adver.s.advert_100base_tx_full =
495 reg_status.s.capable_100base_x_full;
496 reg_autoneg_adver.s.advert_100base_tx_half =
497 reg_status.s.capable_100base_x_half;
498 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
499 CVMX_MDIO_PHY_REG_AUTONEG_ADVER,
500 reg_autoneg_adver.u16);
501 if (reg_status.s.capable_extended_status) {
502 reg_extended_status.u16 =
503 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
504 CVMX_MDIO_PHY_REG_EXTENDED_STATUS);
505 reg_control_1000.u16 =
506 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
507 CVMX_MDIO_PHY_REG_CONTROL_1000);
508 reg_control_1000.s.advert_1000base_t_full =
509 reg_extended_status.s.capable_1000base_t_full;
510 reg_control_1000.s.advert_1000base_t_half =
511 reg_extended_status.s.capable_1000base_t_half;
512 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
513 CVMX_MDIO_PHY_REG_CONTROL_1000,
514 reg_control_1000.u16);
515 }
516 reg_control.u16 =
517 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
518 CVMX_MDIO_PHY_REG_CONTROL);
519 reg_control.s.autoneg_enable = 1;
520 reg_control.s.restart_autoneg = 1;
521 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
522 CVMX_MDIO_PHY_REG_CONTROL, reg_control.u16);
523 } else if ((link_flags & set_phy_link_flags_autoneg)) {
524 cvmx_mdio_phy_reg_control_t reg_control;
525 cvmx_mdio_phy_reg_status_t reg_status;
526 cvmx_mdio_phy_reg_autoneg_adver_t reg_autoneg_adver;
527 cvmx_mdio_phy_reg_control_1000_t reg_control_1000;
528
529 reg_status.u16 =
530 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
531 CVMX_MDIO_PHY_REG_STATUS);
532 reg_autoneg_adver.u16 =
533 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
534 CVMX_MDIO_PHY_REG_AUTONEG_ADVER);
535 reg_autoneg_adver.s.advert_100base_t4 = 0;
536 reg_autoneg_adver.s.advert_10base_tx_full = 0;
537 reg_autoneg_adver.s.advert_10base_tx_half = 0;
538 reg_autoneg_adver.s.advert_100base_tx_full = 0;
539 reg_autoneg_adver.s.advert_100base_tx_half = 0;
540 if (reg_status.s.capable_extended_status) {
541 reg_control_1000.u16 =
542 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
543 CVMX_MDIO_PHY_REG_CONTROL_1000);
544 reg_control_1000.s.advert_1000base_t_full = 0;
545 reg_control_1000.s.advert_1000base_t_half = 0;
546 }
547 switch (link_info.s.speed) {
548 case 10:
549 reg_autoneg_adver.s.advert_10base_tx_full =
550 link_info.s.full_duplex;
551 reg_autoneg_adver.s.advert_10base_tx_half =
552 !link_info.s.full_duplex;
553 break;
554 case 100:
555 reg_autoneg_adver.s.advert_100base_tx_full =
556 link_info.s.full_duplex;
557 reg_autoneg_adver.s.advert_100base_tx_half =
558 !link_info.s.full_duplex;
559 break;
560 case 1000:
561 reg_control_1000.s.advert_1000base_t_full =
562 link_info.s.full_duplex;
563 reg_control_1000.s.advert_1000base_t_half =
564 !link_info.s.full_duplex;
565 break;
566 }
567 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
568 CVMX_MDIO_PHY_REG_AUTONEG_ADVER,
569 reg_autoneg_adver.u16);
570 if (reg_status.s.capable_extended_status)
571 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
572 CVMX_MDIO_PHY_REG_CONTROL_1000,
573 reg_control_1000.u16);
574 reg_control.u16 =
575 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
576 CVMX_MDIO_PHY_REG_CONTROL);
577 reg_control.s.autoneg_enable = 1;
578 reg_control.s.restart_autoneg = 1;
579 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
580 CVMX_MDIO_PHY_REG_CONTROL, reg_control.u16);
581 } else {
582 cvmx_mdio_phy_reg_control_t reg_control;
583 reg_control.u16 =
584 cvmx_mdio_read(phy_addr >> 8, phy_addr & 0xff,
585 CVMX_MDIO_PHY_REG_CONTROL);
586 reg_control.s.autoneg_enable = 0;
587 reg_control.s.restart_autoneg = 1;
588 reg_control.s.duplex = link_info.s.full_duplex;
589 if (link_info.s.speed == 1000) {
590 reg_control.s.speed_msb = 1;
591 reg_control.s.speed_lsb = 0;
592 } else if (link_info.s.speed == 100) {
593 reg_control.s.speed_msb = 0;
594 reg_control.s.speed_lsb = 1;
595 } else if (link_info.s.speed == 10) {
596 reg_control.s.speed_msb = 0;
597 reg_control.s.speed_lsb = 0;
598 }
599 cvmx_mdio_write(phy_addr >> 8, phy_addr & 0xff,
600 CVMX_MDIO_PHY_REG_CONTROL, reg_control.u16);
601 }
602 return 0;
603}
604
605/**
606 * This function is called by cvmx_helper_interface_probe() after it 315 * This function is called by cvmx_helper_interface_probe() after it
607 * determines the number of ports Octeon can support on a specific 316 * determines the number of ports Octeon can support on a specific
608 * interface. This function is the per board location to override 317 * interface. This function is the per board location to override
@@ -676,48 +385,6 @@ int __cvmx_helper_board_hardware_enable(int interface)
676 0xc); 385 0xc);
677 } 386 }
678 } else if (cvmx_sysinfo_get()->board_type == 387 } else if (cvmx_sysinfo_get()->board_type ==
679 CVMX_BOARD_TYPE_CN3010_EVB_HS5) {
680 /*
681 * Broadcom PHYs require differnet ASX
682 * clocks. Unfortunately many boards don't define a
683 * new board Id and simply mangle the
684 * CN3010_EVB_HS5
685 */
686 if (interface == 0) {
687 /*
688 * Some boards use a hacked up bootloader that
689 * identifies them as CN3010_EVB_HS5
690 * evaluation boards. This leads to all kinds
691 * of configuration problems. Detect one
692 * case, and print warning, while trying to do
693 * the right thing.
694 */
695 int phy_addr = cvmx_helper_board_get_mii_address(0);
696 if (phy_addr != -1) {
697 int phy_identifier =
698 cvmx_mdio_read(phy_addr >> 8,
699 phy_addr & 0xff, 0x2);
700 /* Is it a Broadcom PHY? */
701 if (phy_identifier == 0x0143) {
702 cvmx_dprintf("\n");
703 cvmx_dprintf("ERROR:\n");
704 cvmx_dprintf
705 ("ERROR: Board type is CVMX_BOARD_TYPE_CN3010_EVB_HS5, but Broadcom PHY found.\n");
706 cvmx_dprintf
707 ("ERROR: The board type is mis-configured, and software malfunctions are likely.\n");
708 cvmx_dprintf
709 ("ERROR: All boards require a unique board type to identify them.\n");
710 cvmx_dprintf("ERROR:\n");
711 cvmx_dprintf("\n");
712 cvmx_wait(1000000000);
713 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX
714 (0, interface), 5);
715 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX
716 (0, interface), 5);
717 }
718 }
719 }
720 } else if (cvmx_sysinfo_get()->board_type ==
721 CVMX_BOARD_TYPE_UBNT_E100) { 388 CVMX_BOARD_TYPE_UBNT_E100) {
722 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface), 0); 389 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface), 0);
723 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface), 0x10); 390 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface), 0x10);
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c b/arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c
index f59c88ee9b31..671ab1db2727 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c
@@ -33,8 +33,6 @@
33 33
34#include <asm/octeon/cvmx-config.h> 34#include <asm/octeon/cvmx-config.h>
35 35
36
37#include <asm/octeon/cvmx-mdio.h>
38#include <asm/octeon/cvmx-pko.h> 36#include <asm/octeon/cvmx-pko.h>
39#include <asm/octeon/cvmx-helper.h> 37#include <asm/octeon/cvmx-helper.h>
40#include <asm/octeon/cvmx-helper-board.h> 38#include <asm/octeon/cvmx-helper-board.h>
@@ -243,8 +241,7 @@ int __cvmx_helper_rgmii_enable(int interface)
243 /* enable the ports now */ 241 /* enable the ports now */
244 for (port = 0; port < num_ports; port++) { 242 for (port = 0; port < num_ports; port++) {
245 union cvmx_gmxx_prtx_cfg gmx_cfg; 243 union cvmx_gmxx_prtx_cfg gmx_cfg;
246 cvmx_helper_link_autoconf(cvmx_helper_get_ipd_port 244
247 (interface, port));
248 gmx_cfg.u64 = 245 gmx_cfg.u64 =
249 cvmx_read_csr(CVMX_GMXX_PRTX_CFG(port, interface)); 246 cvmx_read_csr(CVMX_GMXX_PRTX_CFG(port, interface));
250 gmx_cfg.s.en = 1; 247 gmx_cfg.s.en = 1;
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c b/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
index 6f9609e63a65..54375340afe8 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
@@ -34,7 +34,6 @@
34 34
35#include <asm/octeon/cvmx-config.h> 35#include <asm/octeon/cvmx-config.h>
36 36
37#include <asm/octeon/cvmx-mdio.h>
38#include <asm/octeon/cvmx-helper.h> 37#include <asm/octeon/cvmx-helper.h>
39#include <asm/octeon/cvmx-helper-board.h> 38#include <asm/octeon/cvmx-helper-board.h>
40 39
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
index a56ee590de1f..d347fe13b666 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
@@ -234,8 +234,6 @@ int __cvmx_helper_xaui_enable(int interface)
234 cvmx_write_csr(CVMX_GMXX_TX_INT_EN(interface), gmx_tx_int_en.u64); 234 cvmx_write_csr(CVMX_GMXX_TX_INT_EN(interface), gmx_tx_int_en.u64);
235 cvmx_write_csr(CVMX_PCSXX_INT_EN_REG(interface), pcsx_int_en_reg.u64); 235 cvmx_write_csr(CVMX_PCSXX_INT_EN_REG(interface), pcsx_int_en_reg.u64);
236 236
237 cvmx_helper_link_autoconf(cvmx_helper_get_ipd_port(interface, 0));
238
239 /* (8) Enable packet reception */ 237 /* (8) Enable packet reception */
240 xauiMiscCtl.s.gmxeno = 0; 238 xauiMiscCtl.s.gmxeno = 0;
241 cvmx_write_csr(CVMX_PCSXX_MISC_CTL_REG(interface), xauiMiscCtl.u64); 239 cvmx_write_csr(CVMX_PCSXX_MISC_CTL_REG(interface), xauiMiscCtl.u64);
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
index ff26d0217b87..6456af642471 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
@@ -841,7 +841,6 @@ int __cvmx_helper_errata_fix_ipd_ptr_alignment(void)
841 int retry_cnt; 841 int retry_cnt;
842 int retry_loop_cnt; 842 int retry_loop_cnt;
843 int i; 843 int i;
844 cvmx_helper_link_info_t link_info;
845 844
846 /* Save values for restore at end */ 845 /* Save values for restore at end */
847 uint64_t prtx_cfg = 846 uint64_t prtx_cfg =
@@ -1002,15 +1001,6 @@ fix_ipd_exit:
1002 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT)), 1001 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT)),
1003 frame_max); 1002 frame_max);
1004 cvmx_write_csr(CVMX_ASXX_PRT_LOOP(INTERFACE(FIX_IPD_OUTPORT)), 0); 1003 cvmx_write_csr(CVMX_ASXX_PRT_LOOP(INTERFACE(FIX_IPD_OUTPORT)), 0);
1005 /* Set link to down so autonegotiation will set it up again */
1006 link_info.u64 = 0;
1007 cvmx_helper_link_set(FIX_IPD_OUTPORT, link_info);
1008
1009 /*
1010 * Bring the link back up as autonegotiation is not done in
1011 * user applications.
1012 */
1013 cvmx_helper_link_autoconf(FIX_IPD_OUTPORT);
1014 1004
1015 CVMX_SYNC; 1005 CVMX_SYNC;
1016 if (num_segs) 1006 if (num_segs)
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 5537f95b28c9..9a2db1c013d9 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -65,7 +65,8 @@ EXPORT_SYMBOL(octeon_should_swizzle_table);
65extern void pci_console_init(const char *arg); 65extern void pci_console_init(const char *arg);
66#endif 66#endif
67 67
68static unsigned long long MAX_MEMORY = 512ull << 20; 68static unsigned long long max_memory = ULLONG_MAX;
69static unsigned long long reserve_low_mem;
69 70
70DEFINE_SEMAPHORE(octeon_bootbus_sem); 71DEFINE_SEMAPHORE(octeon_bootbus_sem);
71EXPORT_SYMBOL(octeon_bootbus_sem); 72EXPORT_SYMBOL(octeon_bootbus_sem);
@@ -75,7 +76,6 @@ struct octeon_boot_descriptor *octeon_boot_desc_ptr;
75struct cvmx_bootinfo *octeon_bootinfo; 76struct cvmx_bootinfo *octeon_bootinfo;
76EXPORT_SYMBOL(octeon_bootinfo); 77EXPORT_SYMBOL(octeon_bootinfo);
77 78
78static unsigned long long RESERVE_LOW_MEM = 0ull;
79#ifdef CONFIG_KEXEC 79#ifdef CONFIG_KEXEC
80#ifdef CONFIG_SMP 80#ifdef CONFIG_SMP
81/* 81/*
@@ -125,18 +125,18 @@ static void kexec_bootmem_init(uint64_t mem_size, uint32_t low_reserved_bytes)
125 bootmem_desc->major_version = CVMX_BOOTMEM_DESC_MAJ_VER; 125 bootmem_desc->major_version = CVMX_BOOTMEM_DESC_MAJ_VER;
126 bootmem_desc->minor_version = CVMX_BOOTMEM_DESC_MIN_VER; 126 bootmem_desc->minor_version = CVMX_BOOTMEM_DESC_MIN_VER;
127 127
128 addr = (OCTEON_DDR0_BASE + RESERVE_LOW_MEM + low_reserved_bytes); 128 addr = (OCTEON_DDR0_BASE + reserve_low_mem + low_reserved_bytes);
129 bootmem_desc->head_addr = 0; 129 bootmem_desc->head_addr = 0;
130 130
131 if (mem_size <= OCTEON_DDR0_SIZE) { 131 if (mem_size <= OCTEON_DDR0_SIZE) {
132 __cvmx_bootmem_phy_free(addr, 132 __cvmx_bootmem_phy_free(addr,
133 mem_size - RESERVE_LOW_MEM - 133 mem_size - reserve_low_mem -
134 low_reserved_bytes, 0); 134 low_reserved_bytes, 0);
135 return; 135 return;
136 } 136 }
137 137
138 __cvmx_bootmem_phy_free(addr, 138 __cvmx_bootmem_phy_free(addr,
139 OCTEON_DDR0_SIZE - RESERVE_LOW_MEM - 139 OCTEON_DDR0_SIZE - reserve_low_mem -
140 low_reserved_bytes, 0); 140 low_reserved_bytes, 0);
141 141
142 mem_size -= OCTEON_DDR0_SIZE; 142 mem_size -= OCTEON_DDR0_SIZE;
@@ -857,15 +857,15 @@ void __init prom_init(void)
857 857
858 /* Default to 64MB in the simulator to speed things up */ 858 /* Default to 64MB in the simulator to speed things up */
859 if (octeon_is_simulation()) 859 if (octeon_is_simulation())
860 MAX_MEMORY = 64ull << 20; 860 max_memory = 64ull << 20;
861 861
862 arg = strstr(arcs_cmdline, "mem="); 862 arg = strstr(arcs_cmdline, "mem=");
863 if (arg) { 863 if (arg) {
864 MAX_MEMORY = memparse(arg + 4, &p); 864 max_memory = memparse(arg + 4, &p);
865 if (MAX_MEMORY == 0) 865 if (max_memory == 0)
866 MAX_MEMORY = 32ull << 30; 866 max_memory = 32ull << 30;
867 if (*p == '@') 867 if (*p == '@')
868 RESERVE_LOW_MEM = memparse(p + 1, &p); 868 reserve_low_mem = memparse(p + 1, &p);
869 } 869 }
870 870
871 arcs_cmdline[0] = 0; 871 arcs_cmdline[0] = 0;
@@ -875,11 +875,11 @@ void __init prom_init(void)
875 cvmx_phys_to_ptr(octeon_boot_desc_ptr->argv[i]); 875 cvmx_phys_to_ptr(octeon_boot_desc_ptr->argv[i]);
876 if ((strncmp(arg, "MEM=", 4) == 0) || 876 if ((strncmp(arg, "MEM=", 4) == 0) ||
877 (strncmp(arg, "mem=", 4) == 0)) { 877 (strncmp(arg, "mem=", 4) == 0)) {
878 MAX_MEMORY = memparse(arg + 4, &p); 878 max_memory = memparse(arg + 4, &p);
879 if (MAX_MEMORY == 0) 879 if (max_memory == 0)
880 MAX_MEMORY = 32ull << 30; 880 max_memory = 32ull << 30;
881 if (*p == '@') 881 if (*p == '@')
882 RESERVE_LOW_MEM = memparse(p + 1, &p); 882 reserve_low_mem = memparse(p + 1, &p);
883#ifdef CONFIG_KEXEC 883#ifdef CONFIG_KEXEC
884 } else if (strncmp(arg, "crashkernel=", 12) == 0) { 884 } else if (strncmp(arg, "crashkernel=", 12) == 0) {
885 crashk_size = memparse(arg+12, &p); 885 crashk_size = memparse(arg+12, &p);
@@ -971,13 +971,13 @@ void __init plat_mem_setup(void)
971 * to consistently work. 971 * to consistently work.
972 */ 972 */
973 mem_alloc_size = 4 << 20; 973 mem_alloc_size = 4 << 20;
974 if (mem_alloc_size > MAX_MEMORY) 974 if (mem_alloc_size > max_memory)
975 mem_alloc_size = MAX_MEMORY; 975 mem_alloc_size = max_memory;
976 976
977/* Crashkernel ignores bootmem list. It relies on mem=X@Y option */ 977/* Crashkernel ignores bootmem list. It relies on mem=X@Y option */
978#ifdef CONFIG_CRASH_DUMP 978#ifdef CONFIG_CRASH_DUMP
979 add_memory_region(RESERVE_LOW_MEM, MAX_MEMORY, BOOT_MEM_RAM); 979 add_memory_region(reserve_low_mem, max_memory, BOOT_MEM_RAM);
980 total += MAX_MEMORY; 980 total += max_memory;
981#else 981#else
982#ifdef CONFIG_KEXEC 982#ifdef CONFIG_KEXEC
983 if (crashk_size > 0) { 983 if (crashk_size > 0) {
@@ -992,7 +992,7 @@ void __init plat_mem_setup(void)
992 */ 992 */
993 cvmx_bootmem_lock(); 993 cvmx_bootmem_lock();
994 while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX) 994 while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX)
995 && (total < MAX_MEMORY)) { 995 && (total < max_memory)) {
996 memory = cvmx_bootmem_phy_alloc(mem_alloc_size, 996 memory = cvmx_bootmem_phy_alloc(mem_alloc_size,
997 __pa_symbol(&_end), -1, 997 __pa_symbol(&_end), -1,
998 0x100000, 998 0x100000,
diff --git a/arch/mips/configs/generic/32r1.config b/arch/mips/configs/generic/32r1.config
new file mode 100644
index 000000000000..a11cd8715519
--- /dev/null
+++ b/arch/mips/configs/generic/32r1.config
@@ -0,0 +1,2 @@
1CONFIG_CPU_MIPS32_R1=y
2CONFIG_HIGHMEM=y
diff --git a/arch/mips/configs/generic/32r2.config b/arch/mips/configs/generic/32r2.config
new file mode 100644
index 000000000000..9570672d4f9f
--- /dev/null
+++ b/arch/mips/configs/generic/32r2.config
@@ -0,0 +1,3 @@
1CONFIG_CPU_MIPS32_R2=y
2CONFIG_MIPS_O32_FP64_SUPPORT=y
3CONFIG_HIGHMEM=y
diff --git a/arch/mips/configs/generic/32r6.config b/arch/mips/configs/generic/32r6.config
new file mode 100644
index 000000000000..ca606e71f4d0
--- /dev/null
+++ b/arch/mips/configs/generic/32r6.config
@@ -0,0 +1,2 @@
1CONFIG_CPU_MIPS32_R6=y
2CONFIG_HIGHMEM=y
diff --git a/arch/mips/configs/generic/64r1.config b/arch/mips/configs/generic/64r1.config
new file mode 100644
index 000000000000..7c1ea7e7bae3
--- /dev/null
+++ b/arch/mips/configs/generic/64r1.config
@@ -0,0 +1,4 @@
1CONFIG_CPU_MIPS64_R1=y
2CONFIG_64BIT=y
3CONFIG_MIPS32_O32=y
4CONFIG_MIPS32_N32=y
diff --git a/arch/mips/configs/generic/64r2.config b/arch/mips/configs/generic/64r2.config
new file mode 100644
index 000000000000..b4d31ae8bfec
--- /dev/null
+++ b/arch/mips/configs/generic/64r2.config
@@ -0,0 +1,5 @@
1CONFIG_CPU_MIPS64_R2=y
2CONFIG_MIPS_O32_FP64_SUPPORT=y
3CONFIG_64BIT=y
4CONFIG_MIPS32_O32=y
5CONFIG_MIPS32_N32=y
diff --git a/arch/mips/configs/generic/64r6.config b/arch/mips/configs/generic/64r6.config
new file mode 100644
index 000000000000..7cac0339c4d5
--- /dev/null
+++ b/arch/mips/configs/generic/64r6.config
@@ -0,0 +1,4 @@
1CONFIG_CPU_MIPS64_R6=y
2CONFIG_64BIT=y
3CONFIG_MIPS32_O32=y
4CONFIG_MIPS32_N32=y
diff --git a/arch/mips/configs/generic/board-sead-3.config b/arch/mips/configs/generic/board-sead-3.config
new file mode 100644
index 000000000000..3b5e1ac579eb
--- /dev/null
+++ b/arch/mips/configs/generic/board-sead-3.config
@@ -0,0 +1,32 @@
1CONFIG_LEGACY_BOARD_SEAD3=y
2
3CONFIG_AUXDISPLAY=y
4CONFIG_IMG_ASCII_LCD=y
5
6CONFIG_NEW_LEDS=y
7CONFIG_LEDS_CLASS=y
8CONFIG_LEDS_SYSCON=y
9
10CONFIG_MMC=y
11CONFIG_MMC_SPI=y
12
13CONFIG_MTD=y
14CONFIG_MTD_BLOCK=y
15CONFIG_MTD_CFI=y
16CONFIG_MTD_CFI_INTELEXT=y
17CONFIG_MTD_OF_PARTS=y
18CONFIG_MTD_PHYSMAP=y
19CONFIG_MTD_PHYSMAP_OF=y
20CONFIG_MTD_UBI=y
21CONFIG_MTD_UBI_GLUEBI=y
22
23CONFIG_NETDEVICES=y
24CONFIG_SMSC911X=y
25CONFIG_SMSC_PHY=y
26
27CONFIG_SERIAL_8250=y
28CONFIG_SERIAL_8250_CONSOLE=y
29CONFIG_SERIAL_OF_PLATFORM=y
30
31CONFIG_USB=y
32CONFIG_USB_EHCI_HCD=y
diff --git a/arch/mips/configs/generic/eb.config b/arch/mips/configs/generic/eb.config
new file mode 100644
index 000000000000..c5cdc99a6530
--- /dev/null
+++ b/arch/mips/configs/generic/eb.config
@@ -0,0 +1 @@
CONFIG_CPU_BIG_ENDIAN=y
diff --git a/arch/mips/configs/generic/el.config b/arch/mips/configs/generic/el.config
new file mode 100644
index 000000000000..ee43fdb3b8f4
--- /dev/null
+++ b/arch/mips/configs/generic/el.config
@@ -0,0 +1 @@
CONFIG_CPU_LITTLE_ENDIAN=y
diff --git a/arch/mips/configs/generic/micro32r2.config b/arch/mips/configs/generic/micro32r2.config
new file mode 100644
index 000000000000..b701fe7aaa68
--- /dev/null
+++ b/arch/mips/configs/generic/micro32r2.config
@@ -0,0 +1,4 @@
1CONFIG_CPU_MIPS32_R2=y
2CONFIG_CPU_MICROMIPS=y
3CONFIG_MIPS_O32_FP64_SUPPORT=y
4CONFIG_HIGHMEM=y
diff --git a/arch/mips/configs/generic_defconfig b/arch/mips/configs/generic_defconfig
new file mode 100644
index 000000000000..c95d94c7838b
--- /dev/null
+++ b/arch/mips/configs/generic_defconfig
@@ -0,0 +1,96 @@
1CONFIG_MIPS_GENERIC=y
2CONFIG_CPU_LITTLE_ENDIAN=y
3CONFIG_MIPS_CPS=y
4CONFIG_CPU_HAS_MSA=y
5CONFIG_HIGHMEM=y
6CONFIG_NR_CPUS=2
7CONFIG_MIPS_O32_FP64_SUPPORT=y
8CONFIG_SYSVIPC=y
9CONFIG_NO_HZ_IDLE=y
10CONFIG_IKCONFIG=y
11CONFIG_IKCONFIG_PROC=y
12CONFIG_MEMCG=y
13CONFIG_MEMCG_SWAP=y
14CONFIG_BLK_CGROUP=y
15CONFIG_CFS_BANDWIDTH=y
16CONFIG_RT_GROUP_SCHED=y
17CONFIG_CGROUP_PIDS=y
18CONFIG_CGROUP_FREEZER=y
19CONFIG_CPUSETS=y
20CONFIG_CGROUP_DEVICE=y
21CONFIG_CGROUP_CPUACCT=y
22CONFIG_NAMESPACES=y
23CONFIG_USER_NS=y
24CONFIG_SCHED_AUTOGROUP=y
25CONFIG_BLK_DEV_INITRD=y
26CONFIG_BPF_SYSCALL=y
27CONFIG_USERFAULTFD=y
28CONFIG_EMBEDDED=y
29# CONFIG_SLUB_DEBUG is not set
30# CONFIG_COMPAT_BRK is not set
31CONFIG_CC_STACKPROTECTOR_REGULAR=y
32CONFIG_MODULES=y
33CONFIG_MODULE_UNLOAD=y
34CONFIG_TRIM_UNUSED_KSYMS=y
35CONFIG_NET=y
36CONFIG_PACKET=y
37CONFIG_UNIX=y
38CONFIG_INET=y
39CONFIG_NETFILTER=y
40# CONFIG_WIRELESS is not set
41CONFIG_DEVTMPFS=y
42CONFIG_DEVTMPFS_MOUNT=y
43CONFIG_SCSI=y
44# CONFIG_INPUT_MOUSEDEV is not set
45# CONFIG_INPUT_KEYBOARD is not set
46# CONFIG_INPUT_MOUSE is not set
47# CONFIG_SERIO is not set
48CONFIG_HW_RANDOM=y
49# CONFIG_HWMON is not set
50CONFIG_MFD_SYSCON=y
51CONFIG_HID_A4TECH=y
52CONFIG_HID_APPLE=y
53CONFIG_HID_BELKIN=y
54CONFIG_HID_CHERRY=y
55CONFIG_HID_CHICONY=y
56CONFIG_HID_CYPRESS=y
57CONFIG_HID_EZKEY=y
58CONFIG_HID_KENSINGTON=y
59CONFIG_HID_LOGITECH=y
60CONFIG_HID_MICROSOFT=y
61CONFIG_HID_MONTEREY=y
62# CONFIG_USB_SUPPORT is not set
63# CONFIG_MIPS_PLATFORM_DEVICES is not set
64# CONFIG_IOMMU_SUPPORT is not set
65CONFIG_EXT4_FS=y
66CONFIG_EXT4_FS_POSIX_ACL=y
67CONFIG_EXT4_FS_SECURITY=y
68CONFIG_EXT4_ENCRYPTION=y
69CONFIG_FANOTIFY=y
70CONFIG_FUSE_FS=y
71CONFIG_CUSE=y
72CONFIG_OVERLAY_FS=y
73CONFIG_MSDOS_FS=y
74CONFIG_VFAT_FS=y
75CONFIG_TMPFS=y
76CONFIG_TMPFS_POSIX_ACL=y
77# CONFIG_MISC_FILESYSTEMS is not set
78CONFIG_NFS_FS=y
79CONFIG_NFS_V3_ACL=y
80CONFIG_NFS_V4=y
81CONFIG_NFS_V4_1=y
82CONFIG_NFS_V4_2=y
83CONFIG_PRINTK_TIME=y
84CONFIG_DEBUG_INFO=y
85CONFIG_DEBUG_INFO_REDUCED=y
86CONFIG_DEBUG_FS=y
87# CONFIG_SCHED_DEBUG is not set
88# CONFIG_FTRACE is not set
89CONFIG_CMDLINE_BOOL=y
90CONFIG_CMDLINE="earlycon"
91# CONFIG_XZ_DEC_X86 is not set
92# CONFIG_XZ_DEC_POWERPC is not set
93# CONFIG_XZ_DEC_IA64 is not set
94# CONFIG_XZ_DEC_ARM is not set
95# CONFIG_XZ_DEC_ARMTHUMB is not set
96# CONFIG_XZ_DEC_SPARC is not set
diff --git a/arch/mips/configs/loongson1c_defconfig b/arch/mips/configs/loongson1c_defconfig
new file mode 100644
index 000000000000..2304d4165773
--- /dev/null
+++ b/arch/mips/configs/loongson1c_defconfig
@@ -0,0 +1,126 @@
1CONFIG_MACH_LOONGSON32=y
2CONFIG_LOONGSON1_LS1C=y
3CONFIG_PREEMPT=y
4# CONFIG_SECCOMP is not set
5# CONFIG_LOCALVERSION_AUTO is not set
6CONFIG_KERNEL_XZ=y
7CONFIG_SYSVIPC=y
8CONFIG_HIGH_RES_TIMERS=y
9CONFIG_BSD_PROCESS_ACCT=y
10CONFIG_BSD_PROCESS_ACCT_V3=y
11CONFIG_IKCONFIG=y
12CONFIG_IKCONFIG_PROC=y
13CONFIG_LOG_BUF_SHIFT=16
14CONFIG_NAMESPACES=y
15CONFIG_CC_OPTIMIZE_FOR_SIZE=y
16CONFIG_EXPERT=y
17CONFIG_PERF_EVENTS=y
18# CONFIG_COMPAT_BRK is not set
19CONFIG_MODULES=y
20CONFIG_MODULE_UNLOAD=y
21CONFIG_MODVERSIONS=y
22# CONFIG_LBDAF is not set
23# CONFIG_BLK_DEV_BSG is not set
24# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
25# CONFIG_SUSPEND is not set
26CONFIG_NET=y
27CONFIG_PACKET=y
28CONFIG_UNIX=y
29CONFIG_INET=y
30CONFIG_IP_PNP=y
31CONFIG_IP_PNP_DHCP=y
32CONFIG_SYN_COOKIES=y
33# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
34# CONFIG_INET_XFRM_MODE_TUNNEL is not set
35# CONFIG_INET_XFRM_MODE_BEET is not set
36# CONFIG_INET_DIAG is not set
37# CONFIG_IPV6 is not set
38# CONFIG_WIRELESS is not set
39CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
40CONFIG_DEVTMPFS=y
41CONFIG_DEVTMPFS_MOUNT=y
42# CONFIG_STANDALONE is not set
43CONFIG_MTD=y
44CONFIG_MTD_CMDLINE_PARTS=y
45CONFIG_MTD_BLOCK=y
46CONFIG_MTD_NAND=y
47CONFIG_MTD_NAND_LOONGSON1=y
48CONFIG_MTD_UBI=y
49CONFIG_BLK_DEV_LOOP=y
50CONFIG_SCSI=m
51# CONFIG_SCSI_PROC_FS is not set
52CONFIG_BLK_DEV_SD=m
53# CONFIG_SCSI_LOWLEVEL is not set
54CONFIG_NETDEVICES=y
55# CONFIG_NET_VENDOR_BROADCOM is not set
56# CONFIG_NET_VENDOR_INTEL is not set
57# CONFIG_NET_VENDOR_MARVELL is not set
58# CONFIG_NET_VENDOR_MICREL is not set
59# CONFIG_NET_VENDOR_NATSEMI is not set
60# CONFIG_NET_VENDOR_SEEQ is not set
61# CONFIG_NET_VENDOR_SMSC is not set
62CONFIG_STMMAC_ETH=y
63# CONFIG_NET_VENDOR_WIZNET is not set
64# CONFIG_WLAN is not set
65CONFIG_INPUT_EVDEV=y
66# CONFIG_INPUT_KEYBOARD is not set
67# CONFIG_INPUT_MOUSE is not set
68# CONFIG_SERIO is not set
69CONFIG_VT_HW_CONSOLE_BINDING=y
70CONFIG_LEGACY_PTY_COUNT=8
71# CONFIG_DEVKMEM is not set
72CONFIG_SERIAL_8250=y
73CONFIG_SERIAL_8250_CONSOLE=y
74# CONFIG_HW_RANDOM is not set
75CONFIG_GPIOLIB=y
76CONFIG_GPIO_LOONGSON1=y
77# CONFIG_HWMON is not set
78# CONFIG_VGA_CONSOLE is not set
79CONFIG_HID_GENERIC=m
80CONFIG_USB_HID=m
81CONFIG_USB=y
82CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
83CONFIG_USB_EHCI_HCD=y
84# CONFIG_USB_EHCI_TT_NEWSCHED is not set
85CONFIG_USB_EHCI_HCD_PLATFORM=y
86CONFIG_USB_STORAGE=m
87CONFIG_USB_SERIAL=m
88CONFIG_USB_SERIAL_PL2303=m
89CONFIG_NEW_LEDS=y
90CONFIG_LEDS_CLASS=y
91CONFIG_LEDS_GPIO=y
92CONFIG_LEDS_TRIGGERS=y
93CONFIG_LEDS_TRIGGER_HEARTBEAT=y
94CONFIG_RTC_CLASS=y
95CONFIG_RTC_DRV_LOONGSON1=y
96# CONFIG_IOMMU_SUPPORT is not set
97CONFIG_EXT2_FS=y
98CONFIG_EXT2_FS_XATTR=y
99CONFIG_EXT2_FS_POSIX_ACL=y
100CONFIG_EXT2_FS_SECURITY=y
101CONFIG_EXT3_FS=y
102CONFIG_EXT3_FS_POSIX_ACL=y
103CONFIG_EXT3_FS_SECURITY=y
104# CONFIG_DNOTIFY is not set
105CONFIG_VFAT_FS=y
106CONFIG_PROC_KCORE=y
107CONFIG_TMPFS=y
108CONFIG_TMPFS_POSIX_ACL=y
109CONFIG_UBIFS_FS=y
110CONFIG_UBIFS_FS_ADVANCED_COMPR=y
111CONFIG_UBIFS_ATIME_SUPPORT=y
112CONFIG_NFS_FS=y
113CONFIG_ROOT_NFS=y
114CONFIG_NLS_CODEPAGE_437=m
115CONFIG_NLS_ISO8859_1=m
116CONFIG_DYNAMIC_DEBUG=y
117# CONFIG_ENABLE_WARN_DEPRECATED is not set
118# CONFIG_ENABLE_MUST_CHECK is not set
119CONFIG_DEBUG_FS=y
120CONFIG_MAGIC_SYSRQ=y
121# CONFIG_SCHED_DEBUG is not set
122# CONFIG_DEBUG_PREEMPT is not set
123# CONFIG_FTRACE is not set
124# CONFIG_EARLY_PRINTK is not set
125# CONFIG_CRYPTO_ECHAINIV is not set
126# CONFIG_CRYPTO_HW is not set
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 5afb4840aec7..58d43f3c348d 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -230,7 +230,7 @@ CONFIG_MTD_CFI=y
230CONFIG_MTD_CFI_INTELEXT=y 230CONFIG_MTD_CFI_INTELEXT=y
231CONFIG_MTD_CFI_AMDSTD=y 231CONFIG_MTD_CFI_AMDSTD=y
232CONFIG_MTD_CFI_STAA=y 232CONFIG_MTD_CFI_STAA=y
233CONFIG_MTD_PHYSMAP=y 233CONFIG_MTD_PHYSMAP_OF=y
234CONFIG_MTD_UBI=m 234CONFIG_MTD_UBI=m
235CONFIG_MTD_UBI_GLUEBI=m 235CONFIG_MTD_UBI_GLUEBI=m
236CONFIG_BLK_DEV_FD=m 236CONFIG_BLK_DEV_FD=m
@@ -318,6 +318,8 @@ CONFIG_LIBERTAS=m
318# CONFIG_SERIO_I8042 is not set 318# CONFIG_SERIO_I8042 is not set
319CONFIG_SERIAL_8250=y 319CONFIG_SERIAL_8250=y
320CONFIG_SERIAL_8250_CONSOLE=y 320CONFIG_SERIAL_8250_CONSOLE=y
321CONFIG_POWER_RESET=y
322CONFIG_POWER_RESET_SYSCON=y
321# CONFIG_HWMON is not set 323# CONFIG_HWMON is not set
322CONFIG_FB=y 324CONFIG_FB=y
323CONFIG_FB_CIRRUS=y 325CONFIG_FB_CIRRUS=y
diff --git a/arch/mips/configs/malta_kvm_defconfig b/arch/mips/configs/malta_kvm_defconfig
index 98f13879bb8f..c8f7e2835840 100644
--- a/arch/mips/configs/malta_kvm_defconfig
+++ b/arch/mips/configs/malta_kvm_defconfig
@@ -235,7 +235,7 @@ CONFIG_MTD_CFI=y
235CONFIG_MTD_CFI_INTELEXT=y 235CONFIG_MTD_CFI_INTELEXT=y
236CONFIG_MTD_CFI_AMDSTD=y 236CONFIG_MTD_CFI_AMDSTD=y
237CONFIG_MTD_CFI_STAA=y 237CONFIG_MTD_CFI_STAA=y
238CONFIG_MTD_PHYSMAP=y 238CONFIG_MTD_PHYSMAP_OF=y
239CONFIG_MTD_UBI=m 239CONFIG_MTD_UBI=m
240CONFIG_MTD_UBI_GLUEBI=m 240CONFIG_MTD_UBI_GLUEBI=m
241CONFIG_BLK_DEV_FD=m 241CONFIG_BLK_DEV_FD=m
@@ -331,6 +331,8 @@ CONFIG_LIBERTAS=m
331# CONFIG_SERIO_I8042 is not set 331# CONFIG_SERIO_I8042 is not set
332CONFIG_SERIAL_8250=y 332CONFIG_SERIAL_8250=y
333CONFIG_SERIAL_8250_CONSOLE=y 333CONFIG_SERIAL_8250_CONSOLE=y
334CONFIG_POWER_RESET=y
335CONFIG_POWER_RESET_SYSCON=y
334# CONFIG_HWMON is not set 336# CONFIG_HWMON is not set
335CONFIG_FB=y 337CONFIG_FB=y
336CONFIG_FB_CIRRUS=y 338CONFIG_FB_CIRRUS=y
diff --git a/arch/mips/configs/malta_kvm_guest_defconfig b/arch/mips/configs/malta_kvm_guest_defconfig
index 3b5d5913f548..d2f54e55356c 100644
--- a/arch/mips/configs/malta_kvm_guest_defconfig
+++ b/arch/mips/configs/malta_kvm_guest_defconfig
@@ -234,7 +234,7 @@ CONFIG_MTD_CFI=y
234CONFIG_MTD_CFI_INTELEXT=y 234CONFIG_MTD_CFI_INTELEXT=y
235CONFIG_MTD_CFI_AMDSTD=y 235CONFIG_MTD_CFI_AMDSTD=y
236CONFIG_MTD_CFI_STAA=y 236CONFIG_MTD_CFI_STAA=y
237CONFIG_MTD_PHYSMAP=y 237CONFIG_MTD_PHYSMAP_OF=y
238CONFIG_MTD_UBI=m 238CONFIG_MTD_UBI=m
239CONFIG_MTD_UBI_GLUEBI=m 239CONFIG_MTD_UBI_GLUEBI=m
240CONFIG_BLK_DEV_FD=m 240CONFIG_BLK_DEV_FD=m
@@ -331,6 +331,8 @@ CONFIG_LIBERTAS=m
331# CONFIG_SERIO_I8042 is not set 331# CONFIG_SERIO_I8042 is not set
332CONFIG_SERIAL_8250=y 332CONFIG_SERIAL_8250=y
333CONFIG_SERIAL_8250_CONSOLE=y 333CONFIG_SERIAL_8250_CONSOLE=y
334CONFIG_POWER_RESET=y
335CONFIG_POWER_RESET_SYSCON=y
334# CONFIG_HWMON is not set 336# CONFIG_HWMON is not set
335CONFIG_FB=y 337CONFIG_FB=y
336CONFIG_FB_CIRRUS=y 338CONFIG_FB_CIRRUS=y
diff --git a/arch/mips/configs/malta_qemu_32r6_defconfig b/arch/mips/configs/malta_qemu_32r6_defconfig
index 65f140e1e872..cbf37dd0c490 100644
--- a/arch/mips/configs/malta_qemu_32r6_defconfig
+++ b/arch/mips/configs/malta_qemu_32r6_defconfig
@@ -132,6 +132,8 @@ CONFIG_LEGACY_PTY_COUNT=4
132CONFIG_SERIAL_8250=y 132CONFIG_SERIAL_8250=y
133CONFIG_SERIAL_8250_CONSOLE=y 133CONFIG_SERIAL_8250_CONSOLE=y
134CONFIG_HW_RANDOM=y 134CONFIG_HW_RANDOM=y
135CONFIG_POWER_RESET=y
136CONFIG_POWER_RESET_SYSCON=y
135# CONFIG_HWMON is not set 137# CONFIG_HWMON is not set
136CONFIG_FB=y 138CONFIG_FB=y
137CONFIG_FIRMWARE_EDID=y 139CONFIG_FIRMWARE_EDID=y
diff --git a/arch/mips/configs/maltaaprp_defconfig b/arch/mips/configs/maltaaprp_defconfig
index 799c4338fd5e..35f6ba260df8 100644
--- a/arch/mips/configs/maltaaprp_defconfig
+++ b/arch/mips/configs/maltaaprp_defconfig
@@ -132,6 +132,8 @@ CONFIG_LEGACY_PTY_COUNT=16
132CONFIG_SERIAL_8250=y 132CONFIG_SERIAL_8250=y
133CONFIG_SERIAL_8250_CONSOLE=y 133CONFIG_SERIAL_8250_CONSOLE=y
134CONFIG_HW_RANDOM=y 134CONFIG_HW_RANDOM=y
135CONFIG_POWER_RESET=y
136CONFIG_POWER_RESET_SYSCON=y
135# CONFIG_HWMON is not set 137# CONFIG_HWMON is not set
136CONFIG_VIDEO_OUTPUT_CONTROL=m 138CONFIG_VIDEO_OUTPUT_CONTROL=m
137CONFIG_FB=y 139CONFIG_FB=y
diff --git a/arch/mips/configs/maltasmvp_defconfig b/arch/mips/configs/maltasmvp_defconfig
index ac0eb4daf101..900f14543eeb 100644
--- a/arch/mips/configs/maltasmvp_defconfig
+++ b/arch/mips/configs/maltasmvp_defconfig
@@ -134,6 +134,8 @@ CONFIG_LEGACY_PTY_COUNT=4
134CONFIG_SERIAL_8250=y 134CONFIG_SERIAL_8250=y
135CONFIG_SERIAL_8250_CONSOLE=y 135CONFIG_SERIAL_8250_CONSOLE=y
136CONFIG_HW_RANDOM=y 136CONFIG_HW_RANDOM=y
137CONFIG_POWER_RESET=y
138CONFIG_POWER_RESET_SYSCON=y
137# CONFIG_HWMON is not set 139# CONFIG_HWMON is not set
138CONFIG_FB=y 140CONFIG_FB=y
139CONFIG_FIRMWARE_EDID=y 141CONFIG_FIRMWARE_EDID=y
diff --git a/arch/mips/configs/maltasmvp_eva_defconfig b/arch/mips/configs/maltasmvp_eva_defconfig
index 31846000530f..8e2738b5e180 100644
--- a/arch/mips/configs/maltasmvp_eva_defconfig
+++ b/arch/mips/configs/maltasmvp_eva_defconfig
@@ -137,6 +137,8 @@ CONFIG_LEGACY_PTY_COUNT=4
137CONFIG_SERIAL_8250=y 137CONFIG_SERIAL_8250=y
138CONFIG_SERIAL_8250_CONSOLE=y 138CONFIG_SERIAL_8250_CONSOLE=y
139CONFIG_HW_RANDOM=y 139CONFIG_HW_RANDOM=y
140CONFIG_POWER_RESET=y
141CONFIG_POWER_RESET_SYSCON=y
140# CONFIG_HWMON is not set 142# CONFIG_HWMON is not set
141CONFIG_VIDEO_OUTPUT_CONTROL=m 143CONFIG_VIDEO_OUTPUT_CONTROL=m
142CONFIG_FB=y 144CONFIG_FB=y
diff --git a/arch/mips/configs/maltaup_defconfig b/arch/mips/configs/maltaup_defconfig
index a79107da0675..6dc4e309a691 100644
--- a/arch/mips/configs/maltaup_defconfig
+++ b/arch/mips/configs/maltaup_defconfig
@@ -131,6 +131,8 @@ CONFIG_LEGACY_PTY_COUNT=16
131CONFIG_SERIAL_8250=y 131CONFIG_SERIAL_8250=y
132CONFIG_SERIAL_8250_CONSOLE=y 132CONFIG_SERIAL_8250_CONSOLE=y
133CONFIG_HW_RANDOM=y 133CONFIG_HW_RANDOM=y
134CONFIG_POWER_RESET=y
135CONFIG_POWER_RESET_SYSCON=y
134# CONFIG_HWMON is not set 136# CONFIG_HWMON is not set
135CONFIG_VIDEO_OUTPUT_CONTROL=m 137CONFIG_VIDEO_OUTPUT_CONTROL=m
136CONFIG_FB=y 138CONFIG_FB=y
diff --git a/arch/mips/configs/maltaup_xpa_defconfig b/arch/mips/configs/maltaup_xpa_defconfig
index 732215732751..3d0d9cb9673f 100644
--- a/arch/mips/configs/maltaup_xpa_defconfig
+++ b/arch/mips/configs/maltaup_xpa_defconfig
@@ -231,7 +231,7 @@ CONFIG_MTD_CFI=y
231CONFIG_MTD_CFI_INTELEXT=y 231CONFIG_MTD_CFI_INTELEXT=y
232CONFIG_MTD_CFI_AMDSTD=y 232CONFIG_MTD_CFI_AMDSTD=y
233CONFIG_MTD_CFI_STAA=y 233CONFIG_MTD_CFI_STAA=y
234CONFIG_MTD_PHYSMAP=y 234CONFIG_MTD_PHYSMAP_OF=y
235CONFIG_MTD_UBI=m 235CONFIG_MTD_UBI=m
236CONFIG_MTD_UBI_GLUEBI=m 236CONFIG_MTD_UBI_GLUEBI=m
237CONFIG_BLK_DEV_FD=m 237CONFIG_BLK_DEV_FD=m
@@ -326,6 +326,8 @@ CONFIG_LIBERTAS=m
326# CONFIG_SERIO_I8042 is not set 326# CONFIG_SERIO_I8042 is not set
327CONFIG_SERIAL_8250=y 327CONFIG_SERIAL_8250=y
328CONFIG_SERIAL_8250_CONSOLE=y 328CONFIG_SERIAL_8250_CONSOLE=y
329CONFIG_POWER_RESET=y
330CONFIG_POWER_RESET_SYSCON=y
329# CONFIG_HWMON is not set 331# CONFIG_HWMON is not set
330CONFIG_FB=y 332CONFIG_FB=y
331CONFIG_FB_CIRRUS=y 333CONFIG_FB_CIRRUS=y
diff --git a/arch/mips/configs/pistachio_defconfig b/arch/mips/configs/pistachio_defconfig
index 8b7429127a1d..7d32fbbca962 100644
--- a/arch/mips/configs/pistachio_defconfig
+++ b/arch/mips/configs/pistachio_defconfig
@@ -29,7 +29,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
29CONFIG_EMBEDDED=y 29CONFIG_EMBEDDED=y
30# CONFIG_COMPAT_BRK is not set 30# CONFIG_COMPAT_BRK is not set
31CONFIG_PROFILING=y 31CONFIG_PROFILING=y
32CONFIG_CC_STACKPROTECTOR_STRONG=y
33CONFIG_MODULES=y 32CONFIG_MODULES=y
34CONFIG_MODULE_UNLOAD=y 33CONFIG_MODULE_UNLOAD=y
35CONFIG_MODULE_FORCE_UNLOAD=y 34CONFIG_MODULE_FORCE_UNLOAD=y
@@ -264,7 +263,6 @@ CONFIG_DMADEVICES=y
264CONFIG_IMG_MDC_DMA=y 263CONFIG_IMG_MDC_DMA=y
265CONFIG_STAGING=y 264CONFIG_STAGING=y
266CONFIG_ASHMEM=y 265CONFIG_ASHMEM=y
267# CONFIG_ANDROID_TIMED_OUTPUT is not set
268# CONFIG_IOMMU_SUPPORT is not set 266# CONFIG_IOMMU_SUPPORT is not set
269CONFIG_MEMORY=y 267CONFIG_MEMORY=y
270CONFIG_IIO=y 268CONFIG_IIO=y
diff --git a/arch/mips/configs/sead3_defconfig b/arch/mips/configs/sead3_defconfig
deleted file mode 100644
index dae9354b6256..000000000000
--- a/arch/mips/configs/sead3_defconfig
+++ /dev/null
@@ -1,121 +0,0 @@
1CONFIG_MIPS_SEAD3=y
2CONFIG_CPU_LITTLE_ENDIAN=y
3CONFIG_CPU_MIPS32_R2=y
4CONFIG_HZ_100=y
5CONFIG_SYSVIPC=y
6CONFIG_POSIX_MQUEUE=y
7CONFIG_NO_HZ=y
8CONFIG_HIGH_RES_TIMERS=y
9CONFIG_IKCONFIG=y
10CONFIG_IKCONFIG_PROC=y
11CONFIG_LOG_BUF_SHIFT=15
12CONFIG_EMBEDDED=y
13CONFIG_SLAB=y
14CONFIG_PROFILING=y
15CONFIG_OPROFILE=y
16CONFIG_MODULES=y
17# CONFIG_BLK_DEV_BSG is not set
18# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
19CONFIG_NET=y
20CONFIG_PACKET=y
21CONFIG_UNIX=y
22CONFIG_INET=y
23CONFIG_IP_PNP=y
24CONFIG_IP_PNP_DHCP=y
25CONFIG_IP_PNP_BOOTP=y
26# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
27# CONFIG_INET_XFRM_MODE_TUNNEL is not set
28# CONFIG_INET_XFRM_MODE_BEET is not set
29# CONFIG_INET_LRO is not set
30# CONFIG_INET_DIAG is not set
31# CONFIG_IPV6 is not set
32# CONFIG_WIRELESS is not set
33CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
34CONFIG_DEVTMPFS=y
35CONFIG_MTD=y
36CONFIG_MTD_BLOCK=y
37CONFIG_MTD_CFI=y
38CONFIG_MTD_CFI_INTELEXT=y
39CONFIG_MTD_PHYSMAP=y
40CONFIG_MTD_UBI=y
41CONFIG_MTD_UBI_GLUEBI=y
42CONFIG_BLK_DEV_LOOP=y
43CONFIG_BLK_DEV_CRYPTOLOOP=m
44CONFIG_SCSI=y
45# CONFIG_SCSI_PROC_FS is not set
46CONFIG_BLK_DEV_SD=y
47CONFIG_CHR_DEV_SG=y
48# CONFIG_SCSI_LOWLEVEL is not set
49CONFIG_NETDEVICES=y
50CONFIG_SMSC911X=y
51# CONFIG_NET_VENDOR_WIZNET is not set
52CONFIG_MARVELL_PHY=y
53CONFIG_DAVICOM_PHY=y
54CONFIG_QSEMI_PHY=y
55CONFIG_LXT_PHY=y
56CONFIG_CICADA_PHY=y
57CONFIG_VITESSE_PHY=y
58CONFIG_SMSC_PHY=y
59CONFIG_BROADCOM_PHY=y
60CONFIG_ICPLUS_PHY=y
61# CONFIG_WLAN is not set
62# CONFIG_INPUT_MOUSEDEV is not set
63# CONFIG_INPUT_KEYBOARD is not set
64# CONFIG_INPUT_MOUSE is not set
65# CONFIG_SERIO is not set
66# CONFIG_CONSOLE_TRANSLATIONS is not set
67CONFIG_VT_HW_CONSOLE_BINDING=y
68CONFIG_LEGACY_PTY_COUNT=32
69CONFIG_SERIAL_8250=y
70CONFIG_SERIAL_8250_CONSOLE=y
71CONFIG_SERIAL_8250_NR_UARTS=2
72CONFIG_SERIAL_8250_RUNTIME_UARTS=2
73# CONFIG_HW_RANDOM is not set
74CONFIG_I2C=y
75# CONFIG_I2C_COMPAT is not set
76CONFIG_I2C_CHARDEV=y
77# CONFIG_I2C_HELPER_AUTO is not set
78CONFIG_SPI=y
79CONFIG_SENSORS_ADT7475=y
80CONFIG_BACKLIGHT_LCD_SUPPORT=y
81CONFIG_LCD_CLASS_DEVICE=y
82CONFIG_BACKLIGHT_CLASS_DEVICE=y
83# CONFIG_VGA_CONSOLE is not set
84CONFIG_USB=y
85CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
86CONFIG_USB_EHCI_HCD=y
87CONFIG_USB_EHCI_ROOT_HUB_TT=y
88CONFIG_USB_STORAGE=y
89CONFIG_MMC=y
90CONFIG_MMC_DEBUG=y
91CONFIG_MMC_SPI=y
92CONFIG_NEW_LEDS=y
93CONFIG_LEDS_CLASS=y
94CONFIG_LEDS_TRIGGERS=y
95CONFIG_LEDS_TRIGGER_HEARTBEAT=y
96CONFIG_RTC_CLASS=y
97CONFIG_RTC_DRV_M41T80=y
98CONFIG_EXT3_FS=y
99# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
100CONFIG_XFS_FS=y
101CONFIG_XFS_QUOTA=y
102CONFIG_XFS_POSIX_ACL=y
103CONFIG_QUOTA=y
104# CONFIG_PRINT_QUOTA_WARNING is not set
105CONFIG_MSDOS_FS=m
106CONFIG_VFAT_FS=m
107CONFIG_TMPFS=y
108CONFIG_JFFS2_FS=y
109CONFIG_NFS_FS=y
110CONFIG_ROOT_NFS=y
111CONFIG_NLS_CODEPAGE_437=y
112CONFIG_NLS_ASCII=y
113CONFIG_NLS_ISO8859_1=y
114CONFIG_NLS_ISO8859_15=y
115CONFIG_NLS_UTF8=y
116# CONFIG_FTRACE is not set
117CONFIG_CRYPTO_CBC=y
118CONFIG_CRYPTO_ECB=y
119CONFIG_CRYPTO_ARC4=y
120# CONFIG_CRYPTO_ANSI_CPRNG is not set
121# CONFIG_CRYPTO_HW is not set
diff --git a/arch/mips/configs/sead3micro_defconfig b/arch/mips/configs/sead3micro_defconfig
deleted file mode 100644
index cd91a775c74e..000000000000
--- a/arch/mips/configs/sead3micro_defconfig
+++ /dev/null
@@ -1,122 +0,0 @@
1CONFIG_MIPS_SEAD3=y
2CONFIG_CPU_LITTLE_ENDIAN=y
3CONFIG_CPU_MIPS32_R2=y
4CONFIG_CPU_MICROMIPS=y
5CONFIG_HZ_100=y
6CONFIG_SYSVIPC=y
7CONFIG_POSIX_MQUEUE=y
8CONFIG_NO_HZ=y
9CONFIG_HIGH_RES_TIMERS=y
10CONFIG_IKCONFIG=y
11CONFIG_IKCONFIG_PROC=y
12CONFIG_LOG_BUF_SHIFT=15
13CONFIG_EMBEDDED=y
14CONFIG_SLAB=y
15CONFIG_PROFILING=y
16CONFIG_OPROFILE=y
17CONFIG_MODULES=y
18# CONFIG_BLK_DEV_BSG is not set
19# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
20CONFIG_NET=y
21CONFIG_PACKET=y
22CONFIG_UNIX=y
23CONFIG_INET=y
24CONFIG_IP_PNP=y
25CONFIG_IP_PNP_DHCP=y
26CONFIG_IP_PNP_BOOTP=y
27# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
28# CONFIG_INET_XFRM_MODE_TUNNEL is not set
29# CONFIG_INET_XFRM_MODE_BEET is not set
30# CONFIG_INET_LRO is not set
31# CONFIG_INET_DIAG is not set
32# CONFIG_IPV6 is not set
33# CONFIG_WIRELESS is not set
34CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
35CONFIG_DEVTMPFS=y
36CONFIG_MTD=y
37CONFIG_MTD_BLOCK=y
38CONFIG_MTD_CFI=y
39CONFIG_MTD_CFI_INTELEXT=y
40CONFIG_MTD_PHYSMAP=y
41CONFIG_MTD_UBI=y
42CONFIG_MTD_UBI_GLUEBI=y
43CONFIG_BLK_DEV_LOOP=y
44CONFIG_BLK_DEV_CRYPTOLOOP=m
45CONFIG_SCSI=y
46# CONFIG_SCSI_PROC_FS is not set
47CONFIG_BLK_DEV_SD=y
48CONFIG_CHR_DEV_SG=y
49# CONFIG_SCSI_LOWLEVEL is not set
50CONFIG_NETDEVICES=y
51CONFIG_SMSC911X=y
52# CONFIG_NET_VENDOR_WIZNET is not set
53CONFIG_MARVELL_PHY=y
54CONFIG_DAVICOM_PHY=y
55CONFIG_QSEMI_PHY=y
56CONFIG_LXT_PHY=y
57CONFIG_CICADA_PHY=y
58CONFIG_VITESSE_PHY=y
59CONFIG_SMSC_PHY=y
60CONFIG_BROADCOM_PHY=y
61CONFIG_ICPLUS_PHY=y
62# CONFIG_WLAN is not set
63# CONFIG_INPUT_MOUSEDEV is not set
64# CONFIG_INPUT_KEYBOARD is not set
65# CONFIG_INPUT_MOUSE is not set
66# CONFIG_SERIO is not set
67# CONFIG_CONSOLE_TRANSLATIONS is not set
68CONFIG_VT_HW_CONSOLE_BINDING=y
69CONFIG_LEGACY_PTY_COUNT=32
70CONFIG_SERIAL_8250=y
71CONFIG_SERIAL_8250_CONSOLE=y
72CONFIG_SERIAL_8250_NR_UARTS=2
73CONFIG_SERIAL_8250_RUNTIME_UARTS=2
74# CONFIG_HW_RANDOM is not set
75CONFIG_I2C=y
76# CONFIG_I2C_COMPAT is not set
77CONFIG_I2C_CHARDEV=y
78# CONFIG_I2C_HELPER_AUTO is not set
79CONFIG_SPI=y
80CONFIG_SENSORS_ADT7475=y
81CONFIG_BACKLIGHT_LCD_SUPPORT=y
82CONFIG_LCD_CLASS_DEVICE=y
83CONFIG_BACKLIGHT_CLASS_DEVICE=y
84# CONFIG_VGA_CONSOLE is not set
85CONFIG_USB=y
86CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
87CONFIG_USB_EHCI_HCD=y
88CONFIG_USB_EHCI_ROOT_HUB_TT=y
89CONFIG_USB_STORAGE=y
90CONFIG_MMC=y
91CONFIG_MMC_DEBUG=y
92CONFIG_MMC_SPI=y
93CONFIG_NEW_LEDS=y
94CONFIG_LEDS_CLASS=y
95CONFIG_LEDS_TRIGGERS=y
96CONFIG_LEDS_TRIGGER_HEARTBEAT=y
97CONFIG_RTC_CLASS=y
98CONFIG_RTC_DRV_M41T80=y
99CONFIG_EXT3_FS=y
100# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
101CONFIG_XFS_FS=y
102CONFIG_XFS_QUOTA=y
103CONFIG_XFS_POSIX_ACL=y
104CONFIG_QUOTA=y
105# CONFIG_PRINT_QUOTA_WARNING is not set
106CONFIG_MSDOS_FS=m
107CONFIG_VFAT_FS=m
108CONFIG_TMPFS=y
109CONFIG_JFFS2_FS=y
110CONFIG_NFS_FS=y
111CONFIG_ROOT_NFS=y
112CONFIG_NLS_CODEPAGE_437=y
113CONFIG_NLS_ASCII=y
114CONFIG_NLS_ISO8859_1=y
115CONFIG_NLS_ISO8859_15=y
116CONFIG_NLS_UTF8=y
117# CONFIG_FTRACE is not set
118CONFIG_CRYPTO_CBC=y
119CONFIG_CRYPTO_ECB=y
120CONFIG_CRYPTO_ARC4=y
121# CONFIG_CRYPTO_ANSI_CPRNG is not set
122# CONFIG_CRYPTO_HW is not set
diff --git a/arch/mips/generic/Kconfig b/arch/mips/generic/Kconfig
new file mode 100644
index 000000000000..a606b3f9196c
--- /dev/null
+++ b/arch/mips/generic/Kconfig
@@ -0,0 +1,19 @@
1if MIPS_GENERIC
2
3config LEGACY_BOARDS
4 bool
5 help
6 Select this from your board if the board must use a legacy, non-UHI,
7 boot protocol. This will cause the kernel to scan through the list of
8 supported machines calling their detect functions in turn if the
9 kernel is booted without being provided with an FDT via the UHI
10 boot protocol.
11
12config LEGACY_BOARD_SEAD3
13 bool "Support MIPS SEAD-3 boards"
14 select LEGACY_BOARDS
15 help
16 Enable this to include support for booting on MIPS SEAD-3 FPGA-based
17 development boards, which boot using a legacy boot protocol.
18
19endif
diff --git a/arch/mips/generic/Makefile b/arch/mips/generic/Makefile
new file mode 100644
index 000000000000..7c66494151db
--- /dev/null
+++ b/arch/mips/generic/Makefile
@@ -0,0 +1,15 @@
1#
2# Copyright (C) 2016 Imagination Technologies
3# Author: Paul Burton <paul.burton@imgtec.com>
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by the
7# Free Software Foundation; either version 2 of the License, or (at your
8# option) any later version.
9#
10
11obj-y += init.o
12obj-y += irq.o
13obj-y += proc.o
14
15obj-$(CONFIG_LEGACY_BOARD_SEAD3) += board-sead3.o
diff --git a/arch/mips/generic/Platform b/arch/mips/generic/Platform
new file mode 100644
index 000000000000..9a30d69e2281
--- /dev/null
+++ b/arch/mips/generic/Platform
@@ -0,0 +1,14 @@
1#
2# Copyright (C) 2016 Imagination Technologies
3# Author: Paul Burton <paul.burton@imgtec.com>
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by the
7# Free Software Foundation; either version 2 of the License, or (at your
8# option) any later version.
9#
10
11platform-$(CONFIG_MIPS_GENERIC) += generic/
12cflags-$(CONFIG_MIPS_GENERIC) += -I$(srctree)/arch/mips/include/asm/mach-generic
13load-$(CONFIG_MIPS_GENERIC) += 0xffffffff80100000
14all-$(CONFIG_MIPS_GENERIC) := vmlinux.gz.itb
diff --git a/arch/mips/generic/board-sead3.c b/arch/mips/generic/board-sead3.c
new file mode 100644
index 000000000000..f4ae0584a33b
--- /dev/null
+++ b/arch/mips/generic/board-sead3.c
@@ -0,0 +1,376 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#define pr_fmt(fmt) "sead3: " fmt
12
13#include <linux/errno.h>
14#include <linux/libfdt.h>
15#include <linux/printk.h>
16
17#include <asm/fw/fw.h>
18#include <asm/io.h>
19#include <asm/machine.h>
20
21#define SEAD_CONFIG CKSEG1ADDR(0x1b100110)
22#define SEAD_CONFIG_GIC_PRESENT BIT(1)
23
24#define MIPS_REVISION CKSEG1ADDR(0x1fc00010)
25#define MIPS_REVISION_MACHINE (0xf << 4)
26#define MIPS_REVISION_MACHINE_SEAD3 (0x4 << 4)
27
28static __init bool sead3_detect(void)
29{
30 uint32_t rev;
31
32 rev = __raw_readl((void *)MIPS_REVISION);
33 return (rev & MIPS_REVISION_MACHINE) == MIPS_REVISION_MACHINE_SEAD3;
34}
35
36static __init int append_cmdline(void *fdt)
37{
38 int err, chosen_off;
39
40 /* find or add chosen node */
41 chosen_off = fdt_path_offset(fdt, "/chosen");
42 if (chosen_off == -FDT_ERR_NOTFOUND)
43 chosen_off = fdt_path_offset(fdt, "/chosen@0");
44 if (chosen_off == -FDT_ERR_NOTFOUND)
45 chosen_off = fdt_add_subnode(fdt, 0, "chosen");
46 if (chosen_off < 0) {
47 pr_err("Unable to find or add DT chosen node: %d\n",
48 chosen_off);
49 return chosen_off;
50 }
51
52 err = fdt_setprop_string(fdt, chosen_off, "bootargs", fw_getcmdline());
53 if (err) {
54 pr_err("Unable to set bootargs property: %d\n", err);
55 return err;
56 }
57
58 return 0;
59}
60
61static __init int append_memory(void *fdt)
62{
63 unsigned long phys_memsize, memsize;
64 __be32 mem_array[2];
65 int err, mem_off;
66 char *var;
67
68 /* find memory size from the bootloader environment */
69 var = fw_getenv("memsize");
70 if (var) {
71 err = kstrtoul(var, 0, &phys_memsize);
72 if (err) {
73 pr_err("Failed to read memsize env variable '%s'\n",
74 var);
75 return -EINVAL;
76 }
77 } else {
78 pr_warn("The bootloader didn't provide memsize: defaulting to 32MB\n");
79 phys_memsize = 32 << 20;
80 }
81
82 /* default to using all available RAM */
83 memsize = phys_memsize;
84
85 /* allow the user to override the usable memory */
86 var = strstr(arcs_cmdline, "memsize=");
87 if (var)
88 memsize = memparse(var + strlen("memsize="), NULL);
89
90 /* if the user says there's more RAM than we thought, believe them */
91 phys_memsize = max_t(unsigned long, phys_memsize, memsize);
92
93 /* find or add a memory node */
94 mem_off = fdt_path_offset(fdt, "/memory");
95 if (mem_off == -FDT_ERR_NOTFOUND)
96 mem_off = fdt_add_subnode(fdt, 0, "memory");
97 if (mem_off < 0) {
98 pr_err("Unable to find or add memory DT node: %d\n", mem_off);
99 return mem_off;
100 }
101
102 err = fdt_setprop_string(fdt, mem_off, "device_type", "memory");
103 if (err) {
104 pr_err("Unable to set memory node device_type: %d\n", err);
105 return err;
106 }
107
108 mem_array[0] = 0;
109 mem_array[1] = cpu_to_be32(phys_memsize);
110 err = fdt_setprop(fdt, mem_off, "reg", mem_array, sizeof(mem_array));
111 if (err) {
112 pr_err("Unable to set memory regs property: %d\n", err);
113 return err;
114 }
115
116 mem_array[0] = 0;
117 mem_array[1] = cpu_to_be32(memsize);
118 err = fdt_setprop(fdt, mem_off, "linux,usable-memory",
119 mem_array, sizeof(mem_array));
120 if (err) {
121 pr_err("Unable to set linux,usable-memory property: %d\n", err);
122 return err;
123 }
124
125 return 0;
126}
127
128static __init int remove_gic(void *fdt)
129{
130 const unsigned int cpu_ehci_int = 2;
131 const unsigned int cpu_uart_int = 4;
132 const unsigned int cpu_eth_int = 6;
133 int gic_off, cpu_off, uart_off, eth_off, ehci_off, err;
134 uint32_t cfg, cpu_phandle;
135
136 /* leave the GIC node intact if a GIC is present */
137 cfg = __raw_readl((uint32_t *)SEAD_CONFIG);
138 if (cfg & SEAD_CONFIG_GIC_PRESENT)
139 return 0;
140
141 gic_off = fdt_node_offset_by_compatible(fdt, -1, "mti,gic");
142 if (gic_off < 0) {
143 pr_err("unable to find DT GIC node: %d\n", gic_off);
144 return gic_off;
145 }
146
147 err = fdt_nop_node(fdt, gic_off);
148 if (err) {
149 pr_err("unable to nop GIC node\n");
150 return err;
151 }
152
153 cpu_off = fdt_node_offset_by_compatible(fdt, -1,
154 "mti,cpu-interrupt-controller");
155 if (cpu_off < 0) {
156 pr_err("unable to find CPU intc node: %d\n", cpu_off);
157 return cpu_off;
158 }
159
160 cpu_phandle = fdt_get_phandle(fdt, cpu_off);
161 if (!cpu_phandle) {
162 pr_err("unable to get CPU intc phandle\n");
163 return -EINVAL;
164 }
165
166 err = fdt_setprop_u32(fdt, 0, "interrupt-parent", cpu_phandle);
167 if (err) {
168 pr_err("unable to set root interrupt-parent: %d\n", err);
169 return err;
170 }
171
172 uart_off = fdt_node_offset_by_compatible(fdt, -1, "ns16550a");
173 while (uart_off >= 0) {
174 err = fdt_setprop_u32(fdt, uart_off, "interrupts",
175 cpu_uart_int);
176 if (err) {
177 pr_err("unable to set UART interrupts property: %d\n",
178 err);
179 return err;
180 }
181
182 uart_off = fdt_node_offset_by_compatible(fdt, uart_off,
183 "ns16550a");
184 }
185 if (uart_off != -FDT_ERR_NOTFOUND) {
186 pr_err("error searching for UART DT node: %d\n", uart_off);
187 return uart_off;
188 }
189
190 eth_off = fdt_node_offset_by_compatible(fdt, -1, "smsc,lan9115");
191 if (eth_off < 0) {
192 pr_err("unable to find ethernet DT node: %d\n", eth_off);
193 return eth_off;
194 }
195
196 err = fdt_setprop_u32(fdt, eth_off, "interrupts", cpu_eth_int);
197 if (err) {
198 pr_err("unable to set ethernet interrupts property: %d\n", err);
199 return err;
200 }
201
202 ehci_off = fdt_node_offset_by_compatible(fdt, -1, "generic-ehci");
203 if (ehci_off < 0) {
204 pr_err("unable to find EHCI DT node: %d\n", ehci_off);
205 return ehci_off;
206 }
207
208 err = fdt_setprop_u32(fdt, ehci_off, "interrupts", cpu_ehci_int);
209 if (err) {
210 pr_err("unable to set EHCI interrupts property: %d\n", err);
211 return err;
212 }
213
214 return 0;
215}
216
217static __init int serial_config(void *fdt)
218{
219 const char *yamontty, *mode_var;
220 char mode_var_name[9], path[18], parity;
221 unsigned int uart, baud, stop_bits;
222 bool hw_flow;
223 int chosen_off, err;
224
225 yamontty = fw_getenv("yamontty");
226 if (!yamontty || !strcmp(yamontty, "tty0")) {
227 uart = 0;
228 } else if (!strcmp(yamontty, "tty1")) {
229 uart = 1;
230 } else {
231 pr_warn("yamontty environment variable '%s' invalid\n",
232 yamontty);
233 uart = 0;
234 }
235
236 baud = stop_bits = 0;
237 parity = 0;
238 hw_flow = false;
239
240 snprintf(mode_var_name, sizeof(mode_var_name), "modetty%u", uart);
241 mode_var = fw_getenv(mode_var_name);
242 if (mode_var) {
243 while (mode_var[0] >= '0' && mode_var[0] <= '9') {
244 baud *= 10;
245 baud += mode_var[0] - '0';
246 mode_var++;
247 }
248 if (mode_var[0] == ',')
249 mode_var++;
250 if (mode_var[0])
251 parity = mode_var[0];
252 if (mode_var[0] == ',')
253 mode_var++;
254 if (mode_var[0])
255 stop_bits = mode_var[0] - '0';
256 if (mode_var[0] == ',')
257 mode_var++;
258 if (!strcmp(mode_var, "hw"))
259 hw_flow = true;
260 }
261
262 if (!baud)
263 baud = 38400;
264
265 if (parity != 'e' && parity != 'n' && parity != 'o')
266 parity = 'n';
267
268 if (stop_bits != 7 && stop_bits != 8)
269 stop_bits = 8;
270
271 WARN_ON(snprintf(path, sizeof(path), "uart%u:%u%c%u%s",
272 uart, baud, parity, stop_bits,
273 hw_flow ? "r" : "") >= sizeof(path));
274
275 /* find or add chosen node */
276 chosen_off = fdt_path_offset(fdt, "/chosen");
277 if (chosen_off == -FDT_ERR_NOTFOUND)
278 chosen_off = fdt_path_offset(fdt, "/chosen@0");
279 if (chosen_off == -FDT_ERR_NOTFOUND)
280 chosen_off = fdt_add_subnode(fdt, 0, "chosen");
281 if (chosen_off < 0) {
282 pr_err("Unable to find or add DT chosen node: %d\n",
283 chosen_off);
284 return chosen_off;
285 }
286
287 err = fdt_setprop_string(fdt, chosen_off, "stdout-path", path);
288 if (err) {
289 pr_err("Unable to set stdout-path property: %d\n", err);
290 return err;
291 }
292
293 return 0;
294}
295
296static __init const void *sead3_fixup_fdt(const void *fdt,
297 const void *match_data)
298{
299 static unsigned char fdt_buf[16 << 10] __initdata;
300 int err;
301
302 if (fdt_check_header(fdt))
303 panic("Corrupt DT");
304
305 /* if this isn't SEAD3, something went wrong */
306 BUG_ON(fdt_node_check_compatible(fdt, 0, "mti,sead-3"));
307
308 fw_init_cmdline();
309
310 err = fdt_open_into(fdt, fdt_buf, sizeof(fdt_buf));
311 if (err)
312 panic("Unable to open FDT: %d", err);
313
314 err = append_cmdline(fdt_buf);
315 if (err)
316 panic("Unable to patch FDT: %d", err);
317
318 err = append_memory(fdt_buf);
319 if (err)
320 panic("Unable to patch FDT: %d", err);
321
322 err = remove_gic(fdt_buf);
323 if (err)
324 panic("Unable to patch FDT: %d", err);
325
326 err = serial_config(fdt_buf);
327 if (err)
328 panic("Unable to patch FDT: %d", err);
329
330 err = fdt_pack(fdt_buf);
331 if (err)
332 panic("Unable to pack FDT: %d\n", err);
333
334 return fdt_buf;
335}
336
337static __init unsigned int sead3_measure_hpt_freq(void)
338{
339 void __iomem *status_reg = (void __iomem *)0xbf000410;
340 unsigned int freq, orig, tick = 0;
341 unsigned long flags;
342
343 local_irq_save(flags);
344
345 orig = readl(status_reg) & 0x2; /* get original sample */
346 /* wait for transition */
347 while ((readl(status_reg) & 0x2) == orig)
348 ;
349 orig = orig ^ 0x2; /* flip the bit */
350
351 write_c0_count(0);
352
353 /* wait 1 second (the sampling clock transitions every 10ms) */
354 while (tick < 100) {
355 /* wait for transition */
356 while ((readl(status_reg) & 0x2) == orig)
357 ;
358 orig = orig ^ 0x2; /* flip the bit */
359 tick++;
360 }
361
362 freq = read_c0_count();
363
364 local_irq_restore(flags);
365
366 return freq;
367}
368
369extern char __dtb_sead3_begin[];
370
371MIPS_MACHINE(sead3) = {
372 .fdt = __dtb_sead3_begin,
373 .detect = sead3_detect,
374 .fixup_fdt = sead3_fixup_fdt,
375 .measure_hpt_freq = sead3_measure_hpt_freq,
376};
diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
new file mode 100644
index 000000000000..0ea73e845440
--- /dev/null
+++ b/arch/mips/generic/init.c
@@ -0,0 +1,176 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/clk.h>
12#include <linux/clk-provider.h>
13#include <linux/clocksource.h>
14#include <linux/init.h>
15#include <linux/irqchip.h>
16#include <linux/of_fdt.h>
17#include <linux/of_platform.h>
18
19#include <asm/fw/fw.h>
20#include <asm/irq_cpu.h>
21#include <asm/machine.h>
22#include <asm/mips-cpc.h>
23#include <asm/prom.h>
24#include <asm/smp-ops.h>
25#include <asm/time.h>
26
27static __initdata const void *fdt;
28static __initdata const struct mips_machine *mach;
29static __initdata const void *mach_match_data;
30
31void __init prom_init(void)
32{
33 const struct mips_machine *check_mach;
34 const struct of_device_id *match;
35
36 if ((fw_arg0 == -2) && !fdt_check_header((void *)fw_arg1)) {
37 /*
38 * We booted using the UHI boot protocol, so we have been
39 * provided with the appropriate device tree for the board.
40 * Make use of it & search for any machine struct based upon
41 * the root compatible string.
42 */
43 fdt = (void *)fw_arg1;
44
45 for_each_mips_machine(check_mach) {
46 match = mips_machine_is_compatible(check_mach, fdt);
47 if (match) {
48 mach = check_mach;
49 mach_match_data = match->data;
50 break;
51 }
52 }
53 } else if (IS_ENABLED(CONFIG_LEGACY_BOARDS)) {
54 /*
55 * We weren't booted using the UHI boot protocol, but do
56 * support some number of boards with legacy boot protocols.
57 * Attempt to find the right one.
58 */
59 for_each_mips_machine(check_mach) {
60 if (!check_mach->detect)
61 continue;
62
63 if (!check_mach->detect())
64 continue;
65
66 mach = check_mach;
67 }
68
69 /*
70 * If we don't recognise the machine then we can't continue, so
71 * die here.
72 */
73 BUG_ON(!mach);
74
75 /* Retrieve the machine's FDT */
76 fdt = mach->fdt;
77 }
78
79 BUG_ON(!fdt);
80}
81
82void __init *plat_get_fdt(void)
83{
84 return (void *)fdt;
85}
86
87void __init plat_mem_setup(void)
88{
89 if (mach && mach->fixup_fdt)
90 fdt = mach->fixup_fdt(fdt, mach_match_data);
91
92 strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
93 __dt_setup_arch((void *)fdt);
94}
95
96void __init device_tree_init(void)
97{
98 int err;
99
100 unflatten_and_copy_device_tree();
101 mips_cpc_probe();
102
103 err = register_cps_smp_ops();
104 if (err)
105 err = register_up_smp_ops();
106}
107
108void __init plat_time_init(void)
109{
110 struct device_node *np;
111 struct clk *clk;
112
113 of_clk_init(NULL);
114
115 if (!cpu_has_counter) {
116 mips_hpt_frequency = 0;
117 } else if (mach && mach->measure_hpt_freq) {
118 mips_hpt_frequency = mach->measure_hpt_freq();
119 } else {
120 np = of_get_cpu_node(0, NULL);
121 if (!np) {
122 pr_err("Failed to get CPU node\n");
123 return;
124 }
125
126 clk = of_clk_get(np, 0);
127 if (IS_ERR(clk)) {
128 pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk));
129 return;
130 }
131
132 mips_hpt_frequency = clk_get_rate(clk);
133 clk_put(clk);
134
135 switch (boot_cpu_type()) {
136 case CPU_20KC:
137 case CPU_25KF:
138 /* The counter runs at the CPU clock rate */
139 break;
140 default:
141 /* The counter runs at half the CPU clock rate */
142 mips_hpt_frequency /= 2;
143 break;
144 }
145 }
146
147 clocksource_probe();
148}
149
150void __init arch_init_irq(void)
151{
152 struct device_node *intc_node;
153
154 intc_node = of_find_compatible_node(NULL, NULL,
155 "mti,cpu-interrupt-controller");
156 if (!cpu_has_veic && !intc_node)
157 mips_cpu_irq_init();
158
159 irqchip_init();
160}
161
162static int __init publish_devices(void)
163{
164 if (!of_have_populated_dt())
165 panic("Device-tree not present");
166
167 if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
168 panic("Failed to populate DT");
169
170 return 0;
171}
172arch_initcall(publish_devices);
173
174void __init prom_free_prom_memory(void)
175{
176}
diff --git a/arch/mips/generic/irq.c b/arch/mips/generic/irq.c
new file mode 100644
index 000000000000..14064bdd91dd
--- /dev/null
+++ b/arch/mips/generic/irq.c
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/clk.h>
12#include <linux/clk-provider.h>
13#include <linux/clocksource.h>
14#include <linux/init.h>
15#include <linux/irqchip/mips-gic.h>
16#include <linux/types.h>
17
18#include <asm/irq.h>
19
20int get_c0_fdc_int(void)
21{
22 int mips_cpu_fdc_irq;
23
24 if (cpu_has_veic)
25 panic("Unimplemented!");
26 else if (gic_present)
27 mips_cpu_fdc_irq = gic_get_c0_fdc_int();
28 else if (cp0_fdc_irq >= 0)
29 mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
30 else
31 mips_cpu_fdc_irq = -1;
32
33 return mips_cpu_fdc_irq;
34}
35
36int get_c0_perfcount_int(void)
37{
38 int mips_cpu_perf_irq;
39
40 if (cpu_has_veic)
41 panic("Unimplemented!");
42 else if (gic_present)
43 mips_cpu_perf_irq = gic_get_c0_perfcount_int();
44 else if (cp0_perfcount_irq >= 0)
45 mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
46 else
47 mips_cpu_perf_irq = -1;
48
49 return mips_cpu_perf_irq;
50}
51
52unsigned int get_c0_compare_int(void)
53{
54 int mips_cpu_timer_irq;
55
56 if (cpu_has_veic)
57 panic("Unimplemented!");
58 else if (gic_present)
59 mips_cpu_timer_irq = gic_get_c0_compare_int();
60 else
61 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
62
63 return mips_cpu_timer_irq;
64}
diff --git a/arch/mips/generic/proc.c b/arch/mips/generic/proc.c
new file mode 100644
index 000000000000..42b33250a4a2
--- /dev/null
+++ b/arch/mips/generic/proc.c
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/of.h>
12
13#include <asm/bootinfo.h>
14
15const char *get_system_type(void)
16{
17 const char *str;
18 int err;
19
20 err = of_property_read_string(of_root, "model", &str);
21 if (!err)
22 return str;
23
24 err = of_property_read_string_index(of_root, "compatible", 0, &str);
25 if (!err)
26 return str;
27
28 return "Unknown";
29}
diff --git a/arch/mips/generic/vmlinux.its.S b/arch/mips/generic/vmlinux.its.S
new file mode 100644
index 000000000000..f67fbf1c8541
--- /dev/null
+++ b/arch/mips/generic/vmlinux.its.S
@@ -0,0 +1,31 @@
1/dts-v1/;
2
3/ {
4 description = KERNEL_NAME;
5 #address-cells = <ADDR_CELLS>;
6
7 images {
8 kernel@0 {
9 description = KERNEL_NAME;
10 data = /incbin/(VMLINUX_BINARY);
11 type = "kernel";
12 arch = "mips";
13 os = "linux";
14 compression = VMLINUX_COMPRESSION;
15 load = /bits/ ADDR_BITS <VMLINUX_LOAD_ADDRESS>;
16 entry = /bits/ ADDR_BITS <VMLINUX_ENTRY_ADDRESS>;
17 hash@0 {
18 algo = "sha1";
19 };
20 };
21 };
22
23 configurations {
24 default = "conf@default";
25
26 conf@default {
27 description = "Generic Linux kernel";
28 kernel = "kernel@0";
29 };
30 };
31};
diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
index c5b04e752e97..4856adc8906e 100644
--- a/arch/mips/include/asm/addrspace.h
+++ b/arch/mips/include/asm/addrspace.h
@@ -126,8 +126,7 @@
126#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p)) 126#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p)) 127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK) 128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
129#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \ 129#define PHYS_TO_XKPHYS(cm, a) (XKPHYS | (_ACAST64_(cm) << 59) | (a))
130 (_CONST64_(cm) << 59) | (a))
131 130
132/* 131/*
133 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting 132 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h
index d296633d890e..a5eb1bb199a7 100644
--- a/arch/mips/include/asm/barrier.h
+++ b/arch/mips/include/asm/barrier.h
@@ -10,6 +10,102 @@
10 10
11#include <asm/addrspace.h> 11#include <asm/addrspace.h>
12 12
13/*
14 * Sync types defined by the MIPS architecture (document MD00087 table 6.5)
15 * These values are used with the sync instruction to perform memory barriers.
16 * Types of ordering guarantees available through the SYNC instruction:
17 * - Completion Barriers
18 * - Ordering Barriers
19 * As compared to the completion barrier, the ordering barrier is a
20 * lighter-weight operation as it does not require the specified instructions
21 * before the SYNC to be already completed. Instead it only requires that those
22 * specified instructions which are subsequent to the SYNC in the instruction
23 * stream are never re-ordered for processing ahead of the specified
24 * instructions which are before the SYNC in the instruction stream.
25 * This potentially reduces how many cycles the barrier instruction must stall
26 * before it completes.
27 * Implementations that do not use any of the non-zero values of stype to define
28 * different barriers, such as ordering barriers, must make those stype values
29 * act the same as stype zero.
30 */
31
32/*
33 * Completion barriers:
34 * - Every synchronizable specified memory instruction (loads or stores or both)
35 * that occurs in the instruction stream before the SYNC instruction must be
36 * already globally performed before any synchronizable specified memory
37 * instructions that occur after the SYNC are allowed to be performed, with
38 * respect to any other processor or coherent I/O module.
39 *
40 * - The barrier does not guarantee the order in which instruction fetches are
41 * performed.
42 *
43 * - A stype value of zero will always be defined such that it performs the most
44 * complete set of synchronization operations that are defined.This means
45 * stype zero always does a completion barrier that affects both loads and
46 * stores preceding the SYNC instruction and both loads and stores that are
47 * subsequent to the SYNC instruction. Non-zero values of stype may be defined
48 * by the architecture or specific implementations to perform synchronization
49 * behaviors that are less complete than that of stype zero. If an
50 * implementation does not use one of these non-zero values to define a
51 * different synchronization behavior, then that non-zero value of stype must
52 * act the same as stype zero completion barrier. This allows software written
53 * for an implementation with a lighter-weight barrier to work on another
54 * implementation which only implements the stype zero completion barrier.
55 *
56 * - A completion barrier is required, potentially in conjunction with SSNOP (in
57 * Release 1 of the Architecture) or EHB (in Release 2 of the Architecture),
58 * to guarantee that memory reference results are visible across operating
59 * mode changes. For example, a completion barrier is required on some
60 * implementations on entry to and exit from Debug Mode to guarantee that
61 * memory effects are handled correctly.
62 */
63
64/*
65 * stype 0 - A completion barrier that affects preceding loads and stores and
66 * subsequent loads and stores.
67 * Older instructions which must reach the load/store ordering point before the
68 * SYNC instruction completes: Loads, Stores
69 * Younger instructions which must reach the load/store ordering point only
70 * after the SYNC instruction completes: Loads, Stores
71 * Older instructions which must be globally performed when the SYNC instruction
72 * completes: Loads, Stores
73 */
74#define STYPE_SYNC 0x0
75
76/*
77 * Ordering barriers:
78 * - Every synchronizable specified memory instruction (loads or stores or both)
79 * that occurs in the instruction stream before the SYNC instruction must
80 * reach a stage in the load/store datapath after which no instruction
81 * re-ordering is possible before any synchronizable specified memory
82 * instruction which occurs after the SYNC instruction in the instruction
83 * stream reaches the same stage in the load/store datapath.
84 *
85 * - If any memory instruction before the SYNC instruction in program order,
86 * generates a memory request to the external memory and any memory
87 * instruction after the SYNC instruction in program order also generates a
88 * memory request to external memory, the memory request belonging to the
89 * older instruction must be globally performed before the time the memory
90 * request belonging to the younger instruction is globally performed.
91 *
92 * - The barrier does not guarantee the order in which instruction fetches are
93 * performed.
94 */
95
96/*
97 * stype 0x10 - An ordering barrier that affects preceding loads and stores and
98 * subsequent loads and stores.
99 * Older instructions which must reach the load/store ordering point before the
100 * SYNC instruction completes: Loads, Stores
101 * Younger instructions which must reach the load/store ordering point only
102 * after the SYNC instruction completes: Loads, Stores
103 * Older instructions which must be globally performed when the SYNC instruction
104 * completes: N/A
105 */
106#define STYPE_SYNC_MB 0x10
107
108
13#ifdef CONFIG_CPU_HAS_SYNC 109#ifdef CONFIG_CPU_HAS_SYNC
14#define __sync() \ 110#define __sync() \
15 __asm__ __volatile__( \ 111 __asm__ __volatile__( \
diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h
index 34ed22ec6c33..4812d1fed0c2 100644
--- a/arch/mips/include/asm/cacheflush.h
+++ b/arch/mips/include/asm/cacheflush.h
@@ -28,6 +28,7 @@
28 * - flush_cache_sigtramp() flush signal trampoline 28 * - flush_cache_sigtramp() flush signal trampoline
29 * - flush_icache_all() flush the entire instruction cache 29 * - flush_icache_all() flush the entire instruction cache
30 * - flush_data_cache_page() flushes a page from the data cache 30 * - flush_data_cache_page() flushes a page from the data cache
31 * - __flush_icache_user_range(start, end) flushes range of user instructions
31 */ 32 */
32 33
33 /* 34 /*
@@ -80,6 +81,10 @@ static inline void flush_icache_page(struct vm_area_struct *vma,
80 81
81extern void (*flush_icache_range)(unsigned long start, unsigned long end); 82extern void (*flush_icache_range)(unsigned long start, unsigned long end);
82extern void (*local_flush_icache_range)(unsigned long start, unsigned long end); 83extern void (*local_flush_icache_range)(unsigned long start, unsigned long end);
84extern void (*__flush_icache_user_range)(unsigned long start,
85 unsigned long end);
86extern void (*__local_flush_icache_user_range)(unsigned long start,
87 unsigned long end);
83 88
84extern void (*__flush_cache_vmap)(void); 89extern void (*__flush_cache_vmap)(void);
85 90
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h
index fbe1881f28fc..bdd6dc18e65c 100644
--- a/arch/mips/include/asm/cpu-type.h
+++ b/arch/mips/include/asm/cpu-type.h
@@ -24,7 +24,8 @@ static inline int __pure __get_cpu_type(const int cpu_type)
24 case CPU_LOONGSON3: 24 case CPU_LOONGSON3:
25#endif 25#endif
26 26
27#ifdef CONFIG_SYS_HAS_CPU_LOONGSON1B 27#if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
28 defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
28 case CPU_LOONGSON1: 29 case CPU_LOONGSON1:
29#endif 30#endif
30 31
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index f672df8b26d0..9a8372484edc 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -240,6 +240,7 @@
240#define PRID_REV_VR4130 0x0080 240#define PRID_REV_VR4130 0x0080
241#define PRID_REV_34K_V1_0_2 0x0022 241#define PRID_REV_34K_V1_0_2 0x0022
242#define PRID_REV_LOONGSON1B 0x0020 242#define PRID_REV_LOONGSON1B 0x0020
243#define PRID_REV_LOONGSON1C 0x0020 /* Same as Loongson-1B */
243#define PRID_REV_LOONGSON2E 0x0002 244#define PRID_REV_LOONGSON2E 0x0002
244#define PRID_REV_LOONGSON2F 0x0003 245#define PRID_REV_LOONGSON2F 0x0003
245#define PRID_REV_LOONGSON3A_R1 0x0005 246#define PRID_REV_LOONGSON3A_R1 0x0005
diff --git a/arch/mips/include/asm/device.h b/arch/mips/include/asm/device.h
index c94fafba9e62..21c2082a0dfb 100644
--- a/arch/mips/include/asm/device.h
+++ b/arch/mips/include/asm/device.h
@@ -11,6 +11,11 @@ struct dma_map_ops;
11struct dev_archdata { 11struct dev_archdata {
12 /* DMA operations on that device */ 12 /* DMA operations on that device */
13 struct dma_map_ops *dma_ops; 13 struct dma_map_ops *dma_ops;
14
15#ifdef CONFIG_DMA_PERDEV_COHERENT
16 /* Non-zero if DMA is coherent with CPU caches */
17 bool dma_coherent;
18#endif
14}; 19};
15 20
16struct pdev_archdata { 21struct pdev_archdata {
diff --git a/arch/mips/include/asm/dma-coherence.h b/arch/mips/include/asm/dma-coherence.h
index bc5e85d579e6..72d0eab02afc 100644
--- a/arch/mips/include/asm/dma-coherence.h
+++ b/arch/mips/include/asm/dma-coherence.h
@@ -9,14 +9,22 @@
9#ifndef __ASM_DMA_COHERENCE_H 9#ifndef __ASM_DMA_COHERENCE_H
10#define __ASM_DMA_COHERENCE_H 10#define __ASM_DMA_COHERENCE_H
11 11
12#ifdef CONFIG_DMA_MAYBE_COHERENT 12enum coherent_io_user_state {
13extern int coherentio; 13 IO_COHERENCE_DEFAULT,
14 IO_COHERENCE_ENABLED,
15 IO_COHERENCE_DISABLED,
16};
17
18#if defined(CONFIG_DMA_PERDEV_COHERENT)
19/* Don't provide (hw_)coherentio to avoid misuse */
20#elif defined(CONFIG_DMA_MAYBE_COHERENT)
21extern enum coherent_io_user_state coherentio;
14extern int hw_coherentio; 22extern int hw_coherentio;
15#else 23#else
16#ifdef CONFIG_DMA_COHERENT 24#ifdef CONFIG_DMA_COHERENT
17#define coherentio 1 25#define coherentio IO_COHERENCE_ENABLED
18#else 26#else
19#define coherentio 0 27#define coherentio IO_COHERENCE_DISABLED
20#endif 28#endif
21#define hw_coherentio 0 29#define hw_coherentio 0
22#endif /* CONFIG_DMA_MAYBE_COHERENT */ 30#endif /* CONFIG_DMA_MAYBE_COHERENT */
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index 12fa79e2f1b4..7aa71b9b0258 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -32,4 +32,14 @@ static inline void dma_mark_clean(void *addr, size_t size) {}
32extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 32extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
33 enum dma_data_direction direction); 33 enum dma_data_direction direction);
34 34
35#define arch_setup_dma_ops arch_setup_dma_ops
36static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
37 u64 size, const struct iommu_ops *iommu,
38 bool coherent)
39{
40#ifdef CONFIG_DMA_PERDEV_COHERENT
41 dev->archdata.dma_coherent = coherent;
42#endif
43}
44
35#endif /* _ASM_DMA_MAPPING_H */ 45#endif /* _ASM_DMA_MAPPING_H */
diff --git a/arch/mips/include/asm/i8259.h b/arch/mips/include/asm/i8259.h
index a7fbcd6ed13c..32229c77906a 100644
--- a/arch/mips/include/asm/i8259.h
+++ b/arch/mips/include/asm/i8259.h
@@ -37,12 +37,22 @@
37 37
38extern raw_spinlock_t i8259A_lock; 38extern raw_spinlock_t i8259A_lock;
39 39
40extern int i8259A_irq_pending(unsigned int irq);
41extern void make_8259A_irq(unsigned int irq); 40extern void make_8259A_irq(unsigned int irq);
42 41
43extern void init_i8259_irqs(void); 42extern void init_i8259_irqs(void);
44extern int i8259_of_init(struct device_node *node, struct device_node *parent); 43extern int i8259_of_init(struct device_node *node, struct device_node *parent);
45 44
45/**
46 * i8159_set_poll() - Override the i8259 polling function
47 * @poll: pointer to platform-specific polling function
48 *
49 * Call this to override the generic i8259 polling function, which directly
50 * accesses i8259 registers, with a platform specific one which may be faster
51 * in cases where hardware provides a more optimal means of polling for an
52 * interrupt.
53 */
54extern void i8259_set_poll(int (*poll)(void));
55
46/* 56/*
47 * Do the traditional i8259 interrupt polling thing. This is for the few 57 * Do the traditional i8259 interrupt polling thing. This is for the few
48 * cases where no better interrupt acknowledge method is available and we 58 * cases where no better interrupt acknowledge method is available and we
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index 0f8a354fd468..61addb1677e9 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -49,7 +49,19 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
49 49
50static inline int plat_device_is_coherent(struct device *dev) 50static inline int plat_device_is_coherent(struct device *dev)
51{ 51{
52 return coherentio; 52#ifdef CONFIG_DMA_PERDEV_COHERENT
53 return dev->archdata.dma_coherent;
54#else
55 switch (coherentio) {
56 default:
57 case IO_COHERENCE_DEFAULT:
58 return hw_coherentio;
59 case IO_COHERENCE_ENABLED:
60 return 1;
61 case IO_COHERENCE_DISABLED:
62 return 0;
63 }
64#endif
53} 65}
54 66
55#ifndef plat_post_dma_flush 67#ifndef plat_post_dma_flush
diff --git a/arch/mips/include/asm/mach-generic/floppy.h b/arch/mips/include/asm/mach-generic/floppy.h
index e2561d99a3fe..9ec2f6a5200b 100644
--- a/arch/mips/include/asm/mach-generic/floppy.h
+++ b/arch/mips/include/asm/mach-generic/floppy.h
@@ -115,11 +115,7 @@ static inline unsigned long fd_getfdaddr1(void)
115 115
116static inline unsigned long fd_dma_mem_alloc(unsigned long size) 116static inline unsigned long fd_dma_mem_alloc(unsigned long size)
117{ 117{
118 unsigned long mem; 118 return __get_dma_pages(GFP_KERNEL, get_order(size));
119
120 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
121
122 return mem;
123} 119}
124 120
125static inline void fd_dma_mem_free(unsigned long addr, unsigned long size) 121static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h
index afc96ecb9004..952b0fdfda0e 100644
--- a/arch/mips/include/asm/mach-generic/spaces.h
+++ b/arch/mips/include/asm/mach-generic/spaces.h
@@ -12,6 +12,8 @@
12 12
13#include <linux/const.h> 13#include <linux/const.h>
14 14
15#include <asm/mipsregs.h>
16
15/* 17/*
16 * This gives the physical RAM offset. 18 * This gives the physical RAM offset.
17 */ 19 */
@@ -52,11 +54,7 @@
52#ifdef CONFIG_64BIT 54#ifdef CONFIG_64BIT
53 55
54#ifndef CAC_BASE 56#ifndef CAC_BASE
55#ifdef CONFIG_DMA_NONCOHERENT 57#define CAC_BASE PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
56#define CAC_BASE _AC(0x9800000000000000, UL)
57#else
58#define CAC_BASE _AC(0xa800000000000000, UL)
59#endif
60#endif 58#endif
61 59
62#ifndef IO_BASE 60#ifndef IO_BASE
diff --git a/arch/mips/include/asm/mach-ip27/spaces.h b/arch/mips/include/asm/mach-ip27/spaces.h
index b18802a0b17e..4775a1136a5b 100644
--- a/arch/mips/include/asm/mach-ip27/spaces.h
+++ b/arch/mips/include/asm/mach-ip27/spaces.h
@@ -19,6 +19,7 @@
19#define IO_BASE 0x9200000000000000 19#define IO_BASE 0x9200000000000000
20#define MSPEC_BASE 0x9400000000000000 20#define MSPEC_BASE 0x9400000000000000
21#define UNCAC_BASE 0x9600000000000000 21#define UNCAC_BASE 0x9600000000000000
22#define CAC_BASE 0xa800000000000000
22 23
23#define TO_MSPEC(x) (MSPEC_BASE | ((x) & TO_PHYS_MASK)) 24#define TO_MSPEC(x) (MSPEC_BASE | ((x) & TO_PHYS_MASK))
24#define TO_HSPEC(x) (HSPEC_BASE | ((x) & TO_PHYS_MASK)) 25#define TO_HSPEC(x) (HSPEC_BASE | ((x) & TO_PHYS_MASK))
diff --git a/arch/mips/include/asm/mach-loongson32/irq.h b/arch/mips/include/asm/mach-loongson32/irq.h
index c1c744197de4..8c01b304b7ec 100644
--- a/arch/mips/include/asm/mach-loongson32/irq.h
+++ b/arch/mips/include/asm/mach-loongson32/irq.h
@@ -36,9 +36,14 @@
36#define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x)) 36#define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x))
37 37
38#define LS1X_UART0_IRQ LS1X_IRQ(0, 2) 38#define LS1X_UART0_IRQ LS1X_IRQ(0, 2)
39#if defined(CONFIG_LOONGSON1_LS1B)
39#define LS1X_UART1_IRQ LS1X_IRQ(0, 3) 40#define LS1X_UART1_IRQ LS1X_IRQ(0, 3)
40#define LS1X_UART2_IRQ LS1X_IRQ(0, 4) 41#define LS1X_UART2_IRQ LS1X_IRQ(0, 4)
41#define LS1X_UART3_IRQ LS1X_IRQ(0, 5) 42#define LS1X_UART3_IRQ LS1X_IRQ(0, 5)
43#elif defined(CONFIG_LOONGSON1_LS1C)
44#define LS1X_UART1_IRQ LS1X_IRQ(0, 4)
45#define LS1X_UART2_IRQ LS1X_IRQ(0, 5)
46#endif
42#define LS1X_CAN0_IRQ LS1X_IRQ(0, 6) 47#define LS1X_CAN0_IRQ LS1X_IRQ(0, 6)
43#define LS1X_CAN1_IRQ LS1X_IRQ(0, 7) 48#define LS1X_CAN1_IRQ LS1X_IRQ(0, 7)
44#define LS1X_SPI0_IRQ LS1X_IRQ(0, 8) 49#define LS1X_SPI0_IRQ LS1X_IRQ(0, 8)
@@ -47,6 +52,9 @@
47#define LS1X_DMA0_IRQ LS1X_IRQ(0, 13) 52#define LS1X_DMA0_IRQ LS1X_IRQ(0, 13)
48#define LS1X_DMA1_IRQ LS1X_IRQ(0, 14) 53#define LS1X_DMA1_IRQ LS1X_IRQ(0, 14)
49#define LS1X_DMA2_IRQ LS1X_IRQ(0, 15) 54#define LS1X_DMA2_IRQ LS1X_IRQ(0, 15)
55#if defined(CONFIG_LOONGSON1_LS1C)
56#define LS1X_NAND_IRQ LS1X_IRQ(0, 16)
57#endif
50#define LS1X_PWM0_IRQ LS1X_IRQ(0, 17) 58#define LS1X_PWM0_IRQ LS1X_IRQ(0, 17)
51#define LS1X_PWM1_IRQ LS1X_IRQ(0, 18) 59#define LS1X_PWM1_IRQ LS1X_IRQ(0, 18)
52#define LS1X_PWM2_IRQ LS1X_IRQ(0, 19) 60#define LS1X_PWM2_IRQ LS1X_IRQ(0, 19)
@@ -54,18 +62,49 @@
54#define LS1X_RTC_INT0_IRQ LS1X_IRQ(0, 21) 62#define LS1X_RTC_INT0_IRQ LS1X_IRQ(0, 21)
55#define LS1X_RTC_INT1_IRQ LS1X_IRQ(0, 22) 63#define LS1X_RTC_INT1_IRQ LS1X_IRQ(0, 22)
56#define LS1X_RTC_INT2_IRQ LS1X_IRQ(0, 23) 64#define LS1X_RTC_INT2_IRQ LS1X_IRQ(0, 23)
65#if defined(CONFIG_LOONGSON1_LS1B)
57#define LS1X_TOY_INT0_IRQ LS1X_IRQ(0, 24) 66#define LS1X_TOY_INT0_IRQ LS1X_IRQ(0, 24)
58#define LS1X_TOY_INT1_IRQ LS1X_IRQ(0, 25) 67#define LS1X_TOY_INT1_IRQ LS1X_IRQ(0, 25)
59#define LS1X_TOY_INT2_IRQ LS1X_IRQ(0, 26) 68#define LS1X_TOY_INT2_IRQ LS1X_IRQ(0, 26)
60#define LS1X_RTC_TICK_IRQ LS1X_IRQ(0, 27) 69#define LS1X_RTC_TICK_IRQ LS1X_IRQ(0, 27)
61#define LS1X_TOY_TICK_IRQ LS1X_IRQ(0, 28) 70#define LS1X_TOY_TICK_IRQ LS1X_IRQ(0, 28)
71#define LS1X_UART4_IRQ LS1X_IRQ(0, 29)
72#define LS1X_UART5_IRQ LS1X_IRQ(0, 30)
73#elif defined(CONFIG_LOONGSON1_LS1C)
74#define LS1X_UART3_IRQ LS1X_IRQ(0, 29)
75#define LS1X_ADC_IRQ LS1X_IRQ(0, 30)
76#define LS1X_SDIO_IRQ LS1X_IRQ(0, 31)
77#endif
62 78
63#define LS1X_EHCI_IRQ LS1X_IRQ(1, 0) 79#define LS1X_EHCI_IRQ LS1X_IRQ(1, 0)
64#define LS1X_OHCI_IRQ LS1X_IRQ(1, 1) 80#define LS1X_OHCI_IRQ LS1X_IRQ(1, 1)
81#if defined(CONFIG_LOONGSON1_LS1B)
65#define LS1X_GMAC0_IRQ LS1X_IRQ(1, 2) 82#define LS1X_GMAC0_IRQ LS1X_IRQ(1, 2)
66#define LS1X_GMAC1_IRQ LS1X_IRQ(1, 3) 83#define LS1X_GMAC1_IRQ LS1X_IRQ(1, 3)
84#elif defined(CONFIG_LOONGSON1_LS1C)
85#define LS1X_OTG_IRQ LS1X_IRQ(1, 2)
86#define LS1X_GMAC0_IRQ LS1X_IRQ(1, 3)
87#define LS1X_CAM_IRQ LS1X_IRQ(1, 4)
88#define LS1X_UART4_IRQ LS1X_IRQ(1, 5)
89#define LS1X_UART5_IRQ LS1X_IRQ(1, 6)
90#define LS1X_UART6_IRQ LS1X_IRQ(1, 7)
91#define LS1X_UART7_IRQ LS1X_IRQ(1, 8)
92#define LS1X_UART8_IRQ LS1X_IRQ(1, 9)
93#define LS1X_UART9_IRQ LS1X_IRQ(1, 13)
94#define LS1X_UART10_IRQ LS1X_IRQ(1, 14)
95#define LS1X_UART11_IRQ LS1X_IRQ(1, 15)
96#define LS1X_I2C0_IRQ LS1X_IRQ(1, 17)
97#define LS1X_I2C1_IRQ LS1X_IRQ(1, 18)
98#define LS1X_I2C2_IRQ LS1X_IRQ(1, 19)
99#endif
67 100
68#define LS1X_IRQS (LS1X_IRQ(4, 31) + 1 - LS1X_IRQ_BASE) 101#if defined(CONFIG_LOONGSON1_LS1B)
102#define INTN 4
103#elif defined(CONFIG_LOONGSON1_LS1C)
104#define INTN 5
105#endif
106
107#define LS1X_IRQS (LS1X_IRQ(INTN, 31) + 1 - LS1X_IRQ_BASE)
69 108
70#define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS) 109#define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS)
71 110
diff --git a/arch/mips/include/asm/mach-loongson32/loongson1.h b/arch/mips/include/asm/mach-loongson32/loongson1.h
index 978f6df8970a..3584c40caf79 100644
--- a/arch/mips/include/asm/mach-loongson32/loongson1.h
+++ b/arch/mips/include/asm/mach-loongson32/loongson1.h
@@ -12,7 +12,11 @@
12#ifndef __ASM_MACH_LOONGSON32_LOONGSON1_H 12#ifndef __ASM_MACH_LOONGSON32_LOONGSON1_H
13#define __ASM_MACH_LOONGSON32_LOONGSON1_H 13#define __ASM_MACH_LOONGSON32_LOONGSON1_H
14 14
15#if defined(CONFIG_LOONGSON1_LS1B)
15#define DEFAULT_MEMSIZE 256 /* If no memsize provided */ 16#define DEFAULT_MEMSIZE 256 /* If no memsize provided */
17#elif defined(CONFIG_LOONGSON1_LS1C)
18#define DEFAULT_MEMSIZE 32
19#endif
16 20
17/* Loongson 1 Register Bases */ 21/* Loongson 1 Register Bases */
18#define LS1X_MUX_BASE 0x1fd00420 22#define LS1X_MUX_BASE 0x1fd00420
@@ -20,6 +24,7 @@
20#define LS1X_GPIO0_BASE 0x1fd010c0 24#define LS1X_GPIO0_BASE 0x1fd010c0
21#define LS1X_GPIO1_BASE 0x1fd010c4 25#define LS1X_GPIO1_BASE 0x1fd010c4
22#define LS1X_DMAC_BASE 0x1fd01160 26#define LS1X_DMAC_BASE 0x1fd01160
27#define LS1X_CBUS_BASE 0x1fd011c0
23#define LS1X_EHCI_BASE 0x1fe00000 28#define LS1X_EHCI_BASE 0x1fe00000
24#define LS1X_OHCI_BASE 0x1fe08000 29#define LS1X_OHCI_BASE 0x1fe08000
25#define LS1X_GMAC0_BASE 0x1fe10000 30#define LS1X_GMAC0_BASE 0x1fe10000
diff --git a/arch/mips/include/asm/mach-loongson32/platform.h b/arch/mips/include/asm/mach-loongson32/platform.h
index 672531aa9bef..7adc31364939 100644
--- a/arch/mips/include/asm/mach-loongson32/platform.h
+++ b/arch/mips/include/asm/mach-loongson32/platform.h
@@ -30,5 +30,6 @@ void __init ls1x_clk_init(void);
30void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata); 30void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata);
31void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata); 31void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata);
32void __init ls1x_serial_set_uartclk(struct platform_device *pdev); 32void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
33void __init ls1x_rtc_set_extclk(struct platform_device *pdev);
33 34
34#endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */ 35#endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */
diff --git a/arch/mips/include/asm/mach-loongson32/regs-clk.h b/arch/mips/include/asm/mach-loongson32/regs-clk.h
index 4d56fc38f0c4..e5e8f118f34b 100644
--- a/arch/mips/include/asm/mach-loongson32/regs-clk.h
+++ b/arch/mips/include/asm/mach-loongson32/regs-clk.h
@@ -18,6 +18,7 @@
18#define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0) 18#define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0)
19#define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4) 19#define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4)
20 20
21#if defined(CONFIG_LOONGSON1_LS1B)
21/* Clock PLL Divisor Register Bits */ 22/* Clock PLL Divisor Register Bits */
22#define DIV_DC_EN BIT(31) 23#define DIV_DC_EN BIT(31)
23#define DIV_DC_RST BIT(30) 24#define DIV_DC_RST BIT(30)
@@ -48,4 +49,37 @@
48#define BYPASS_DDR_WIDTH 1 49#define BYPASS_DDR_WIDTH 1
49#define BYPASS_CPU_WIDTH 1 50#define BYPASS_CPU_WIDTH 1
50 51
52#elif defined(CONFIG_LOONGSON1_LS1C)
53/* PLL/SDRAM Frequency configuration register Bits */
54#define PLL_VALID BIT(31)
55#define FRAC_N GENMASK(23, 16)
56#define RST_TIME GENMASK(3, 2)
57#define SDRAM_DIV GENMASK(1, 0)
58
59/* CPU/CAMERA/DC Frequency configuration register Bits */
60#define DIV_DC_EN BIT(31)
61#define DIV_DC GENMASK(30, 24)
62#define DIV_CAM_EN BIT(23)
63#define DIV_CAM GENMASK(22, 16)
64#define DIV_CPU_EN BIT(15)
65#define DIV_CPU GENMASK(14, 8)
66#define DIV_DC_SEL_EN BIT(5)
67#define DIV_DC_SEL BIT(4)
68#define DIV_CAM_SEL_EN BIT(3)
69#define DIV_CAM_SEL BIT(2)
70#define DIV_CPU_SEL_EN BIT(1)
71#define DIV_CPU_SEL BIT(0)
72
73#define DIV_DC_SHIFT 24
74#define DIV_CAM_SHIFT 16
75#define DIV_CPU_SHIFT 8
76#define DIV_DDR_SHIFT 0
77
78#define DIV_DC_WIDTH 7
79#define DIV_CAM_WIDTH 7
80#define DIV_CPU_WIDTH 7
81#define DIV_DDR_WIDTH 2
82
83#endif
84
51#endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */ 85#endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */
diff --git a/arch/mips/include/asm/mach-loongson32/regs-mux.h b/arch/mips/include/asm/mach-loongson32/regs-mux.h
index 7c394f93cb9e..4a0bdeb0eb9b 100644
--- a/arch/mips/include/asm/mach-loongson32/regs-mux.h
+++ b/arch/mips/include/asm/mach-loongson32/regs-mux.h
@@ -18,6 +18,7 @@
18#define LS1X_MUX_CTRL0 LS1X_MUX_REG(0x0) 18#define LS1X_MUX_CTRL0 LS1X_MUX_REG(0x0)
19#define LS1X_MUX_CTRL1 LS1X_MUX_REG(0x4) 19#define LS1X_MUX_CTRL1 LS1X_MUX_REG(0x4)
20 20
21#if defined(CONFIG_LOONGSON1_LS1B)
21/* MUX CTRL0 Register Bits */ 22/* MUX CTRL0 Register Bits */
22#define UART0_USE_PWM23 BIT(28) 23#define UART0_USE_PWM23 BIT(28)
23#define UART0_USE_PWM01 BIT(27) 24#define UART0_USE_PWM01 BIT(27)
@@ -64,4 +65,64 @@
64#define GMAC1_USE_PWM23 BIT(1) 65#define GMAC1_USE_PWM23 BIT(1)
65#define GMAC0_USE_PWM01 BIT(0) 66#define GMAC0_USE_PWM01 BIT(0)
66 67
68#elif defined(CONFIG_LOONGSON1_LS1C)
69
70/* SHUT_CTRL Register Bits */
71#define UART_SPLIT GENMASK(31, 30)
72#define OUTPUT_CLK GENMASK(29, 26)
73#define ADC_SHUT BIT(25)
74#define SDIO_SHUT BIT(24)
75#define DMA2_SHUT BIT(23)
76#define DMA1_SHUT BIT(22)
77#define DMA0_SHUT BIT(21)
78#define SPI1_SHUT BIT(20)
79#define SPI0_SHUT BIT(19)
80#define I2C2_SHUT BIT(18)
81#define I2C1_SHUT BIT(17)
82#define I2C0_SHUT BIT(16)
83#define AC97_SHUT BIT(15)
84#define I2S_SHUT BIT(14)
85#define UART3_SHUT BIT(13)
86#define UART2_SHUT BIT(12)
87#define UART1_SHUT BIT(11)
88#define UART0_SHUT BIT(10)
89#define CAN1_SHUT BIT(9)
90#define CAN0_SHUT BIT(8)
91#define ECC_SHUT BIT(7)
92#define GMAC_SHUT BIT(6)
93#define USBHOST_SHUT BIT(5)
94#define USBOTG_SHUT BIT(4)
95#define SDRAM_SHUT BIT(3)
96#define SRAM_SHUT BIT(2)
97#define CAM_SHUT BIT(1)
98#define LCD_SHUT BIT(0)
99
100#define UART_SPLIT_SHIFT 30
101#define OUTPUT_CLK_SHIFT 26
102
103/* MISC_CTRL Register Bits */
104#define USBHOST_RSTN BIT(31)
105#define PHY_INTF_SELI GENMASK(30, 28)
106#define AC97_EN BIT(25)
107#define SDIO_DMA_EN GENMASK(24, 23)
108#define ADC_DMA_EN BIT(22)
109#define SDIO_USE_SPI1 BIT(17)
110#define SDIO_USE_SPI0 BIT(16)
111#define SRAM_CTRL GENMASK(15, 0)
112
113#define PHY_INTF_SELI_SHIFT 28
114#define SDIO_DMA_EN_SHIFT 23
115#define SRAM_CTRL_SHIFT 0
116
117#define LS1X_CBUS_REG(n, x) \
118 ((void __iomem *)KSEG1ADDR(LS1X_CBUS_BASE + (n * 0x04) + (x)))
119
120#define LS1X_CBUS_FIRST(n) LS1X_CBUS_REG(n, 0x00)
121#define LS1X_CBUS_SECOND(n) LS1X_CBUS_REG(n, 0x10)
122#define LS1X_CBUS_THIRD(n) LS1X_CBUS_REG(n, 0x20)
123#define LS1X_CBUS_FOURTHT(n) LS1X_CBUS_REG(n, 0x30)
124#define LS1X_CBUS_FIFTHT(n) LS1X_CBUS_REG(n, 0x40)
125
126#endif
127
67#endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */ 128#endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */
diff --git a/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h b/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
deleted file mode 100644
index bfbd7035d4c5..000000000000
--- a/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
+++ /dev/null
@@ -1,72 +0,0 @@
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) 2003, 2004 Chris Dearman
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
11
12
13/*
14 * CPU feature overrides for MIPS boards
15 */
16#ifdef CONFIG_CPU_MIPS32
17#define cpu_has_tlb 1
18#define cpu_has_4kex 1
19#define cpu_has_4k_cache 1
20/* #define cpu_has_fpu ? */
21/* #define cpu_has_32fpr ? */
22#define cpu_has_counter 1
23/* #define cpu_has_watch ? */
24#define cpu_has_divec 1
25#define cpu_has_vce 0
26/* #define cpu_has_cache_cdex_p ? */
27/* #define cpu_has_cache_cdex_s ? */
28/* #define cpu_has_prefetch ? */
29#define cpu_has_mcheck 1
30/* #define cpu_has_ejtag ? */
31#ifdef CONFIG_CPU_MICROMIPS
32#define cpu_has_llsc 0
33#else
34#define cpu_has_llsc 1
35#endif
36/* #define cpu_has_vtag_icache ? */
37/* #define cpu_has_dc_aliases ? */
38/* #define cpu_has_ic_fills_f_dc ? */
39#define cpu_has_nofpuex 0
40/* #define cpu_has_64bits ? */
41/* #define cpu_has_64bit_zero_reg ? */
42/* #define cpu_has_inclusive_pcaches ? */
43#define cpu_icache_snoops_remote_store 1
44#endif
45
46#ifdef CONFIG_CPU_MIPS64
47#define cpu_has_tlb 1
48#define cpu_has_4kex 1
49#define cpu_has_4k_cache 1
50/* #define cpu_has_fpu ? */
51/* #define cpu_has_32fpr ? */
52#define cpu_has_counter 1
53/* #define cpu_has_watch ? */
54#define cpu_has_divec 1
55#define cpu_has_vce 0
56/* #define cpu_has_cache_cdex_p ? */
57/* #define cpu_has_cache_cdex_s ? */
58/* #define cpu_has_prefetch ? */
59#define cpu_has_mcheck 1
60/* #define cpu_has_ejtag ? */
61#define cpu_has_llsc 1
62/* #define cpu_has_vtag_icache ? */
63/* #define cpu_has_dc_aliases ? */
64/* #define cpu_has_ic_fills_f_dc ? */
65#define cpu_has_nofpuex 0
66/* #define cpu_has_64bits ? */
67/* #define cpu_has_64bit_zero_reg ? */
68/* #define cpu_has_inclusive_pcaches ? */
69#define cpu_icache_snoops_remote_store 1
70#endif
71
72#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-sead3/irq.h b/arch/mips/include/asm/mach-sead3/irq.h
deleted file mode 100644
index 5d154cfbcf4c..000000000000
--- a/arch/mips/include/asm/mach-sead3/irq.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_MACH_MIPS_IRQ_H
2#define __ASM_MACH_MIPS_IRQ_H
3
4#define NR_IRQS 256
5
6
7#include_next <irq.h>
8
9#endif /* __ASM_MACH_MIPS_IRQ_H */
diff --git a/arch/mips/include/asm/mach-sead3/kernel-entry-init.h b/arch/mips/include/asm/mach-sead3/kernel-entry-init.h
deleted file mode 100644
index 6cccd4d558d7..000000000000
--- a/arch/mips/include/asm/mach-sead3/kernel-entry-init.h
+++ /dev/null
@@ -1,21 +0,0 @@
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 * Chris Dearman (chris@mips.com)
7 * Copyright (C) 2007 Mips Technologies, Inc.
8 */
9#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
10#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
11
12 .macro kernel_entry_setup
13 .endm
14
15/*
16 * Do SMP slave processor setup necessary before we can safely execute C code.
17 */
18 .macro smp_slave_setup
19 .endm
20
21#endif /* __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H */
diff --git a/arch/mips/include/asm/mach-sead3/war.h b/arch/mips/include/asm/mach-sead3/war.h
deleted file mode 100644
index d068fc411f47..000000000000
--- a/arch/mips/include/asm/mach-sead3/war.h
+++ /dev/null
@@ -1,24 +0,0 @@
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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_MIPS_WAR_H
9#define __ASM_MIPS_MACH_MIPS_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 1
18#define MIPS_CACHE_SYNC_WAR 1
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define ICACHE_REFILLS_WORKAROUND_WAR 1
21#define R10000_LLSC_WAR 0
22#define MIPS34K_MISSED_ITLB_WAR 0
23
24#endif /* __ASM_MIPS_MACH_MIPS_WAR_H */
diff --git a/arch/mips/include/asm/machine.h b/arch/mips/include/asm/machine.h
new file mode 100644
index 000000000000..6b444cd9526f
--- /dev/null
+++ b/arch/mips/include/asm/machine.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MIPS_ASM_MACHINE_H__
12#define __MIPS_ASM_MACHINE_H__
13
14#include <linux/libfdt.h>
15#include <linux/of.h>
16
17struct mips_machine {
18 const struct of_device_id *matches;
19 const void *fdt;
20 bool (*detect)(void);
21 const void *(*fixup_fdt)(const void *fdt, const void *match_data);
22 unsigned int (*measure_hpt_freq)(void);
23};
24
25extern long __mips_machines_start;
26extern long __mips_machines_end;
27
28#define MIPS_MACHINE(name) \
29 static const struct mips_machine __mips_mach_##name \
30 __used __section(.mips.machines.init)
31
32#define for_each_mips_machine(mach) \
33 for ((mach) = (struct mips_machine *)&__mips_machines_start; \
34 (mach) < (struct mips_machine *)&__mips_machines_end; \
35 (mach)++)
36
37/**
38 * mips_machine_is_compatible() - check if a machine is compatible with an FDT
39 * @mach: the machine struct to check
40 * @fdt: the FDT to check for compatibility with
41 *
42 * Check whether the given machine @mach is compatible with the given flattened
43 * device tree @fdt, based upon the compatibility property of the root node.
44 *
45 * Return: the device id matched if any, else NULL
46 */
47static inline const struct of_device_id *
48mips_machine_is_compatible(const struct mips_machine *mach, const void *fdt)
49{
50 const struct of_device_id *match;
51
52 if (!mach->matches)
53 return NULL;
54
55 for (match = mach->matches; match->compatible; match++) {
56 if (fdt_node_check_compatible(fdt, 0, match->compatible) == 0)
57 return match;
58 }
59
60 return NULL;
61}
62
63#endif /* __MIPS_ASM_MACHINE_H__ */
diff --git a/arch/mips/include/asm/mips-boards/sead3int.h b/arch/mips/include/asm/mips-boards/sead3int.h
deleted file mode 100644
index 8932c7de0419..000000000000
--- a/arch/mips/include/asm/mips-boards/sead3int.h
+++ /dev/null
@@ -1,32 +0,0 @@
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) 2000,2012 MIPS Technologies, Inc. All rights reserved.
7 * Douglas Leung <douglas@mips.com>
8 * Steven J. Hill <sjhill@mips.com>
9 */
10#ifndef _MIPS_SEAD3INT_H
11#define _MIPS_SEAD3INT_H
12
13#include <linux/irqchip/mips-gic.h>
14
15/* SEAD-3 GIC address space definitions. */
16#define GIC_BASE_ADDR 0x1b1c0000
17#define GIC_ADDRSPACE_SZ (128 * 1024)
18
19/* CPU interrupt offsets */
20#define CPU_INT_GIC 2
21#define CPU_INT_EHCI 2
22#define CPU_INT_UART0 4
23#define CPU_INT_UART1 4
24#define CPU_INT_NET 6
25
26/* GIC interrupt offsets */
27#define GIC_INT_NET GIC_SHARED_TO_HWIRQ(0)
28#define GIC_INT_UART1 GIC_SHARED_TO_HWIRQ(2)
29#define GIC_INT_UART0 GIC_SHARED_TO_HWIRQ(3)
30#define GIC_INT_EHCI GIC_SHARED_TO_HWIRQ(5)
31
32#endif /* !(_MIPS_SEAD3INT_H) */
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index 4fafeefe65c2..2e4180797b21 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -359,6 +359,7 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80)
359/* GCR_Cx_COHERENCE register fields */ 359/* GCR_Cx_COHERENCE register fields */
360#define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0 360#define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0
361#define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0) 361#define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0)
362#define CM3_GCR_Cx_COHERENCE_COHEN_MSK (_ULCAST_(0x1) << 0)
362 363
363/* GCR_Cx_CONFIG register fields */ 364/* GCR_Cx_CONFIG register fields */
364#define CM_GCR_Cx_CONFIG_IOCUTYPE_SHF 10 365#define CM_GCR_Cx_CONFIG_IOCUTYPE_SHF 10
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-board.h b/arch/mips/include/asm/octeon/cvmx-helper-board.h
index cda93aee712c..b4d19c21b62c 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-board.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-board.h
@@ -58,16 +58,6 @@ typedef enum {
58#define CVMX_HELPER_BOARD_MGMT_IPD_PORT -10 58#define CVMX_HELPER_BOARD_MGMT_IPD_PORT -10
59 59
60/** 60/**
61 * cvmx_override_board_link_get(int ipd_port) is a function
62 * pointer. It is meant to allow customization of the process of
63 * talking to a PHY to determine link speed. It is called every
64 * time a PHY must be polled for link status. Users should set
65 * this pointer to a function before calling any cvmx-helper
66 * operations.
67 */
68extern cvmx_helper_link_info_t(*cvmx_override_board_link_get) (int ipd_port);
69
70/**
71 * Return the MII PHY address associated with the given IPD 61 * Return the MII PHY address associated with the given IPD
72 * port. A result of -1 means there isn't a MII capable PHY 62 * port. A result of -1 means there isn't a MII capable PHY
73 * connected to this port. On chips supporting multiple MII 63 * connected to this port. On chips supporting multiple MII
@@ -86,26 +76,6 @@ extern cvmx_helper_link_info_t(*cvmx_override_board_link_get) (int ipd_port);
86extern int cvmx_helper_board_get_mii_address(int ipd_port); 76extern int cvmx_helper_board_get_mii_address(int ipd_port);
87 77
88/** 78/**
89 * This function as a board specific method of changing the PHY
90 * speed, duplex, and autonegotiation. This programs the PHY and
91 * not Octeon. This can be used to force Octeon's links to
92 * specific settings.
93 *
94 * @phy_addr: The address of the PHY to program
95 * @link_flags:
96 * Flags to control autonegotiation. Bit 0 is autonegotiation
97 * enable/disable to maintain backward compatibility.
98 * @link_info: Link speed to program. If the speed is zero and autonegotiation
99 * is enabled, all possible negotiation speeds are advertised.
100 *
101 * Returns Zero on success, negative on failure
102 */
103int cvmx_helper_board_link_set_phy(int phy_addr,
104 cvmx_helper_board_set_phy_link_flags_types_t
105 link_flags,
106 cvmx_helper_link_info_t link_info);
107
108/**
109 * This function is the board specific method of determining an 79 * This function is the board specific method of determining an
110 * ethernet ports link speed. Most Octeon boards have Marvell PHYs 80 * ethernet ports link speed. Most Octeon boards have Marvell PHYs
111 * and are handled by the fall through case. This function must be 81 * and are handled by the fall through case. This function must be
diff --git a/arch/mips/include/asm/octeon/cvmx-mdio.h b/arch/mips/include/asm/octeon/cvmx-mdio.h
deleted file mode 100644
index 9f6a4f32a83c..000000000000
--- a/arch/mips/include/asm/octeon/cvmx-mdio.h
+++ /dev/null
@@ -1,506 +0,0 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 *
30 * Interface to the SMI/MDIO hardware, including support for both IEEE 802.3
31 * clause 22 and clause 45 operations.
32 *
33 */
34
35#ifndef __CVMX_MIO_H__
36#define __CVMX_MIO_H__
37
38#include <asm/octeon/cvmx-smix-defs.h>
39
40/**
41 * PHY register 0 from the 802.3 spec
42 */
43#define CVMX_MDIO_PHY_REG_CONTROL 0
44typedef union {
45 uint16_t u16;
46 struct {
47 uint16_t reset:1;
48 uint16_t loopback:1;
49 uint16_t speed_lsb:1;
50 uint16_t autoneg_enable:1;
51 uint16_t power_down:1;
52 uint16_t isolate:1;
53 uint16_t restart_autoneg:1;
54 uint16_t duplex:1;
55 uint16_t collision_test:1;
56 uint16_t speed_msb:1;
57 uint16_t unidirectional_enable:1;
58 uint16_t reserved_0_4:5;
59 } s;
60} cvmx_mdio_phy_reg_control_t;
61
62/**
63 * PHY register 1 from the 802.3 spec
64 */
65#define CVMX_MDIO_PHY_REG_STATUS 1
66typedef union {
67 uint16_t u16;
68 struct {
69 uint16_t capable_100base_t4:1;
70 uint16_t capable_100base_x_full:1;
71 uint16_t capable_100base_x_half:1;
72 uint16_t capable_10_full:1;
73 uint16_t capable_10_half:1;
74 uint16_t capable_100base_t2_full:1;
75 uint16_t capable_100base_t2_half:1;
76 uint16_t capable_extended_status:1;
77 uint16_t capable_unidirectional:1;
78 uint16_t capable_mf_preamble_suppression:1;
79 uint16_t autoneg_complete:1;
80 uint16_t remote_fault:1;
81 uint16_t capable_autoneg:1;
82 uint16_t link_status:1;
83 uint16_t jabber_detect:1;
84 uint16_t capable_extended_registers:1;
85
86 } s;
87} cvmx_mdio_phy_reg_status_t;
88
89/**
90 * PHY register 2 from the 802.3 spec
91 */
92#define CVMX_MDIO_PHY_REG_ID1 2
93typedef union {
94 uint16_t u16;
95 struct {
96 uint16_t oui_bits_3_18;
97 } s;
98} cvmx_mdio_phy_reg_id1_t;
99
100/**
101 * PHY register 3 from the 802.3 spec
102 */
103#define CVMX_MDIO_PHY_REG_ID2 3
104typedef union {
105 uint16_t u16;
106 struct {
107 uint16_t oui_bits_19_24:6;
108 uint16_t model:6;
109 uint16_t revision:4;
110 } s;
111} cvmx_mdio_phy_reg_id2_t;
112
113/**
114 * PHY register 4 from the 802.3 spec
115 */
116#define CVMX_MDIO_PHY_REG_AUTONEG_ADVER 4
117typedef union {
118 uint16_t u16;
119 struct {
120 uint16_t next_page:1;
121 uint16_t reserved_14:1;
122 uint16_t remote_fault:1;
123 uint16_t reserved_12:1;
124 uint16_t asymmetric_pause:1;
125 uint16_t pause:1;
126 uint16_t advert_100base_t4:1;
127 uint16_t advert_100base_tx_full:1;
128 uint16_t advert_100base_tx_half:1;
129 uint16_t advert_10base_tx_full:1;
130 uint16_t advert_10base_tx_half:1;
131 uint16_t selector:5;
132 } s;
133} cvmx_mdio_phy_reg_autoneg_adver_t;
134
135/**
136 * PHY register 5 from the 802.3 spec
137 */
138#define CVMX_MDIO_PHY_REG_LINK_PARTNER_ABILITY 5
139typedef union {
140 uint16_t u16;
141 struct {
142 uint16_t next_page:1;
143 uint16_t ack:1;
144 uint16_t remote_fault:1;
145 uint16_t reserved_12:1;
146 uint16_t asymmetric_pause:1;
147 uint16_t pause:1;
148 uint16_t advert_100base_t4:1;
149 uint16_t advert_100base_tx_full:1;
150 uint16_t advert_100base_tx_half:1;
151 uint16_t advert_10base_tx_full:1;
152 uint16_t advert_10base_tx_half:1;
153 uint16_t selector:5;
154 } s;
155} cvmx_mdio_phy_reg_link_partner_ability_t;
156
157/**
158 * PHY register 6 from the 802.3 spec
159 */
160#define CVMX_MDIO_PHY_REG_AUTONEG_EXPANSION 6
161typedef union {
162 uint16_t u16;
163 struct {
164 uint16_t reserved_5_15:11;
165 uint16_t parallel_detection_fault:1;
166 uint16_t link_partner_next_page_capable:1;
167 uint16_t local_next_page_capable:1;
168 uint16_t page_received:1;
169 uint16_t link_partner_autoneg_capable:1;
170
171 } s;
172} cvmx_mdio_phy_reg_autoneg_expansion_t;
173
174/**
175 * PHY register 9 from the 802.3 spec
176 */
177#define CVMX_MDIO_PHY_REG_CONTROL_1000 9
178typedef union {
179 uint16_t u16;
180 struct {
181 uint16_t test_mode:3;
182 uint16_t manual_master_slave:1;
183 uint16_t master:1;
184 uint16_t port_type:1;
185 uint16_t advert_1000base_t_full:1;
186 uint16_t advert_1000base_t_half:1;
187 uint16_t reserved_0_7:8;
188 } s;
189} cvmx_mdio_phy_reg_control_1000_t;
190
191/**
192 * PHY register 10 from the 802.3 spec
193 */
194#define CVMX_MDIO_PHY_REG_STATUS_1000 10
195typedef union {
196 uint16_t u16;
197 struct {
198 uint16_t master_slave_fault:1;
199 uint16_t is_master:1;
200 uint16_t local_receiver_ok:1;
201 uint16_t remote_receiver_ok:1;
202 uint16_t remote_capable_1000base_t_full:1;
203 uint16_t remote_capable_1000base_t_half:1;
204 uint16_t reserved_8_9:2;
205 uint16_t idle_error_count:8;
206 } s;
207} cvmx_mdio_phy_reg_status_1000_t;
208
209/**
210 * PHY register 15 from the 802.3 spec
211 */
212#define CVMX_MDIO_PHY_REG_EXTENDED_STATUS 15
213typedef union {
214 uint16_t u16;
215 struct {
216 uint16_t capable_1000base_x_full:1;
217 uint16_t capable_1000base_x_half:1;
218 uint16_t capable_1000base_t_full:1;
219 uint16_t capable_1000base_t_half:1;
220 uint16_t reserved_0_11:12;
221 } s;
222} cvmx_mdio_phy_reg_extended_status_t;
223
224/**
225 * PHY register 13 from the 802.3 spec
226 */
227#define CVMX_MDIO_PHY_REG_MMD_CONTROL 13
228typedef union {
229 uint16_t u16;
230 struct {
231 uint16_t function:2;
232 uint16_t reserved_5_13:9;
233 uint16_t devad:5;
234 } s;
235} cvmx_mdio_phy_reg_mmd_control_t;
236
237/**
238 * PHY register 14 from the 802.3 spec
239 */
240#define CVMX_MDIO_PHY_REG_MMD_ADDRESS_DATA 14
241typedef union {
242 uint16_t u16;
243 struct {
244 uint16_t address_data:16;
245 } s;
246} cvmx_mdio_phy_reg_mmd_address_data_t;
247
248/* Operating request encodings. */
249#define MDIO_CLAUSE_22_WRITE 0
250#define MDIO_CLAUSE_22_READ 1
251
252#define MDIO_CLAUSE_45_ADDRESS 0
253#define MDIO_CLAUSE_45_WRITE 1
254#define MDIO_CLAUSE_45_READ_INC 2
255#define MDIO_CLAUSE_45_READ 3
256
257/* MMD identifiers, mostly for accessing devices within XENPAK modules. */
258#define CVMX_MMD_DEVICE_PMA_PMD 1
259#define CVMX_MMD_DEVICE_WIS 2
260#define CVMX_MMD_DEVICE_PCS 3
261#define CVMX_MMD_DEVICE_PHY_XS 4
262#define CVMX_MMD_DEVICE_DTS_XS 5
263#define CVMX_MMD_DEVICE_TC 6
264#define CVMX_MMD_DEVICE_CL22_EXT 29
265#define CVMX_MMD_DEVICE_VENDOR_1 30
266#define CVMX_MMD_DEVICE_VENDOR_2 31
267
268/* Helper function to put MDIO interface into clause 45 mode */
269static inline void __cvmx_mdio_set_clause45_mode(int bus_id)
270{
271 union cvmx_smix_clk smi_clk;
272 /* Put bus into clause 45 mode */
273 smi_clk.u64 = cvmx_read_csr(CVMX_SMIX_CLK(bus_id));
274 smi_clk.s.mode = 1;
275 smi_clk.s.preamble = 1;
276 cvmx_write_csr(CVMX_SMIX_CLK(bus_id), smi_clk.u64);
277}
278
279/* Helper function to put MDIO interface into clause 22 mode */
280static inline void __cvmx_mdio_set_clause22_mode(int bus_id)
281{
282 union cvmx_smix_clk smi_clk;
283 /* Put bus into clause 22 mode */
284 smi_clk.u64 = cvmx_read_csr(CVMX_SMIX_CLK(bus_id));
285 smi_clk.s.mode = 0;
286 cvmx_write_csr(CVMX_SMIX_CLK(bus_id), smi_clk.u64);
287}
288
289/**
290 * Perform an MII read. This function is used to read PHY
291 * registers controlling auto negotiation.
292 *
293 * @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
294 * support multiple busses.
295 * @phy_id: The MII phy id
296 * @location: Register location to read
297 *
298 * Returns Result from the read or -1 on failure
299 */
300static inline int cvmx_mdio_read(int bus_id, int phy_id, int location)
301{
302 union cvmx_smix_cmd smi_cmd;
303 union cvmx_smix_rd_dat smi_rd;
304 int timeout = 1000;
305
306 if (octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
307 __cvmx_mdio_set_clause22_mode(bus_id);
308
309 smi_cmd.u64 = 0;
310 smi_cmd.s.phy_op = MDIO_CLAUSE_22_READ;
311 smi_cmd.s.phy_adr = phy_id;
312 smi_cmd.s.reg_adr = location;
313 cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
314
315 do {
316 cvmx_wait(1000);
317 smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(bus_id));
318 } while (smi_rd.s.pending && timeout--);
319
320 if (smi_rd.s.val)
321 return smi_rd.s.dat;
322 else
323 return -1;
324}
325
326/**
327 * Perform an MII write. This function is used to write PHY
328 * registers controlling auto negotiation.
329 *
330 * @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
331 * support multiple busses.
332 * @phy_id: The MII phy id
333 * @location: Register location to write
334 * @val: Value to write
335 *
336 * Returns -1 on error
337 * 0 on success
338 */
339static inline int cvmx_mdio_write(int bus_id, int phy_id, int location, int val)
340{
341 union cvmx_smix_cmd smi_cmd;
342 union cvmx_smix_wr_dat smi_wr;
343 int timeout = 1000;
344
345 if (octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
346 __cvmx_mdio_set_clause22_mode(bus_id);
347
348 smi_wr.u64 = 0;
349 smi_wr.s.dat = val;
350 cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
351
352 smi_cmd.u64 = 0;
353 smi_cmd.s.phy_op = MDIO_CLAUSE_22_WRITE;
354 smi_cmd.s.phy_adr = phy_id;
355 smi_cmd.s.reg_adr = location;
356 cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
357
358 do {
359 cvmx_wait(1000);
360 smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
361 } while (smi_wr.s.pending && --timeout);
362 if (timeout <= 0)
363 return -1;
364
365 return 0;
366}
367
368/**
369 * Perform an IEEE 802.3 clause 45 MII read. This function is used to
370 * read PHY registers controlling auto negotiation.
371 *
372 * @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
373 * support multiple busses.
374 * @phy_id: The MII phy id
375 * @device: MDIO Managable Device (MMD) id
376 * @location: Register location to read
377 *
378 * Returns Result from the read or -1 on failure
379 */
380
381static inline int cvmx_mdio_45_read(int bus_id, int phy_id, int device,
382 int location)
383{
384 union cvmx_smix_cmd smi_cmd;
385 union cvmx_smix_rd_dat smi_rd;
386 union cvmx_smix_wr_dat smi_wr;
387 int timeout = 1000;
388
389 if (!octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
390 return -1;
391
392 __cvmx_mdio_set_clause45_mode(bus_id);
393
394 smi_wr.u64 = 0;
395 smi_wr.s.dat = location;
396 cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
397
398 smi_cmd.u64 = 0;
399 smi_cmd.s.phy_op = MDIO_CLAUSE_45_ADDRESS;
400 smi_cmd.s.phy_adr = phy_id;
401 smi_cmd.s.reg_adr = device;
402 cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
403
404 do {
405 cvmx_wait(1000);
406 smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
407 } while (smi_wr.s.pending && --timeout);
408 if (timeout <= 0) {
409 cvmx_dprintf("cvmx_mdio_45_read: bus_id %d phy_id %2d "
410 "device %2d register %2d TIME OUT(address)\n",
411 bus_id, phy_id, device, location);
412 return -1;
413 }
414
415 smi_cmd.u64 = 0;
416 smi_cmd.s.phy_op = MDIO_CLAUSE_45_READ;
417 smi_cmd.s.phy_adr = phy_id;
418 smi_cmd.s.reg_adr = device;
419 cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
420
421 do {
422 cvmx_wait(1000);
423 smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(bus_id));
424 } while (smi_rd.s.pending && --timeout);
425
426 if (timeout <= 0) {
427 cvmx_dprintf("cvmx_mdio_45_read: bus_id %d phy_id %2d "
428 "device %2d register %2d TIME OUT(data)\n",
429 bus_id, phy_id, device, location);
430 return -1;
431 }
432
433 if (smi_rd.s.val)
434 return smi_rd.s.dat;
435 else {
436 cvmx_dprintf("cvmx_mdio_45_read: bus_id %d phy_id %2d "
437 "device %2d register %2d INVALID READ\n",
438 bus_id, phy_id, device, location);
439 return -1;
440 }
441}
442
443/**
444 * Perform an IEEE 802.3 clause 45 MII write. This function is used to
445 * write PHY registers controlling auto negotiation.
446 *
447 * @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
448 * support multiple busses.
449 * @phy_id: The MII phy id
450 * @device: MDIO Managable Device (MMD) id
451 * @location: Register location to write
452 * @val: Value to write
453 *
454 * Returns -1 on error
455 * 0 on success
456 */
457static inline int cvmx_mdio_45_write(int bus_id, int phy_id, int device,
458 int location, int val)
459{
460 union cvmx_smix_cmd smi_cmd;
461 union cvmx_smix_wr_dat smi_wr;
462 int timeout = 1000;
463
464 if (!octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
465 return -1;
466
467 __cvmx_mdio_set_clause45_mode(bus_id);
468
469 smi_wr.u64 = 0;
470 smi_wr.s.dat = location;
471 cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
472
473 smi_cmd.u64 = 0;
474 smi_cmd.s.phy_op = MDIO_CLAUSE_45_ADDRESS;
475 smi_cmd.s.phy_adr = phy_id;
476 smi_cmd.s.reg_adr = device;
477 cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
478
479 do {
480 cvmx_wait(1000);
481 smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
482 } while (smi_wr.s.pending && --timeout);
483 if (timeout <= 0)
484 return -1;
485
486 smi_wr.u64 = 0;
487 smi_wr.s.dat = val;
488 cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
489
490 smi_cmd.u64 = 0;
491 smi_cmd.s.phy_op = MDIO_CLAUSE_45_WRITE;
492 smi_cmd.s.phy_adr = phy_id;
493 smi_cmd.s.reg_adr = device;
494 cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
495
496 do {
497 cvmx_wait(1000);
498 smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
499 } while (smi_wr.s.pending && --timeout);
500 if (timeout <= 0)
501 return -1;
502
503 return 0;
504}
505
506#endif
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 9b63cd41213d..30d1129d8624 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -17,15 +17,18 @@
17 */ 17 */
18 18
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/list.h>
20#include <linux/of.h> 21#include <linux/of.h>
21 22
23#ifdef CONFIG_PCI_DRIVERS_LEGACY
24
22/* 25/*
23 * Each pci channel is a top-level PCI bus seem by CPU. A machine with 26 * Each pci channel is a top-level PCI bus seem by CPU. A machine with
24 * multiple PCI channels may have multiple PCI host controllers or a 27 * multiple PCI channels may have multiple PCI host controllers or a
25 * single controller supporting multiple channels. 28 * single controller supporting multiple channels.
26 */ 29 */
27struct pci_controller { 30struct pci_controller {
28 struct pci_controller *next; 31 struct list_head list;
29 struct pci_bus *bus; 32 struct pci_bus *bus;
30 struct device_node *of_node; 33 struct device_node *of_node;
31 34
@@ -38,10 +41,12 @@ struct pci_controller {
38 struct resource *busn_resource; 41 struct resource *busn_resource;
39 unsigned long busn_offset; 42 unsigned long busn_offset;
40 43
44#ifndef CONFIG_PCI_DOMAINS_GENERIC
41 unsigned int index; 45 unsigned int index;
42 /* For compatibility with current (as of July 2003) pciutils 46 /* For compatibility with current (as of July 2003) pciutils
43 and XFree86. Eventually will be removed. */ 47 and XFree86. Eventually will be removed. */
44 unsigned int need_domain_info; 48 unsigned int need_domain_info;
49#endif
45 50
46 /* Optional access methods for reading/writing the bus number 51 /* Optional access methods for reading/writing the bus number
47 of the PCI controller */ 52 of the PCI controller */
@@ -59,12 +64,43 @@ extern void register_pci_controller(struct pci_controller *hose);
59 */ 64 */
60extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 65extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
61 66
67/* Do platform specific device initialization at pci_enable_device() time */
68extern int pcibios_plat_dev_init(struct pci_dev *dev);
69
70extern char * (*pcibios_plat_setup)(char *str);
71
72#ifdef CONFIG_OF
73/* this function parses memory ranges from a device node */
74extern void pci_load_of_ranges(struct pci_controller *hose,
75 struct device_node *node);
76#else
77static inline void pci_load_of_ranges(struct pci_controller *hose,
78 struct device_node *node) {}
79#endif
80
81#ifdef CONFIG_PCI_DOMAINS_GENERIC
82static inline void set_pci_need_domain_info(struct pci_controller *hose,
83 int need_domain_info)
84{
85 /* nothing to do */
86}
87#elif defined(CONFIG_PCI_DOMAINS)
88static inline void set_pci_need_domain_info(struct pci_controller *hose,
89 int need_domain_info)
90{
91 hose->need_domain_info = need_domain_info;
92}
93#endif /* CONFIG_PCI_DOMAINS */
94
95#endif
62 96
63/* Can be used to override the logic in pci_scan_bus for skipping 97/* Can be used to override the logic in pci_scan_bus for skipping
64 already-configured bus numbers - to be used for buggy BIOSes 98 already-configured bus numbers - to be used for buggy BIOSes
65 or architectures with incomplete PCI setup by the loader */ 99 or architectures with incomplete PCI setup by the loader */
66 100static inline unsigned int pcibios_assign_all_busses(void)
67extern unsigned int pcibios_assign_all_busses(void); 101{
102 return 1;
103}
68 104
69extern unsigned long PCIBIOS_MIN_IO; 105extern unsigned long PCIBIOS_MIN_IO;
70extern unsigned long PCIBIOS_MIN_MEM; 106extern unsigned long PCIBIOS_MIN_MEM;
@@ -100,7 +136,12 @@ struct pci_dev;
100 */ 136 */
101#define PCI_DMA_BUS_IS_PHYS (1) 137#define PCI_DMA_BUS_IS_PHYS (1)
102 138
103#ifdef CONFIG_PCI_DOMAINS 139#ifdef CONFIG_PCI_DOMAINS_GENERIC
140static inline int pci_proc_domain(struct pci_bus *bus)
141{
142 return pci_domain_nr(bus);
143}
144#elif defined(CONFIG_PCI_DOMAINS)
104#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 145#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
105 146
106static inline int pci_proc_domain(struct pci_bus *bus) 147static inline int pci_proc_domain(struct pci_bus *bus)
@@ -121,15 +162,4 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
121 return channel ? 15 : 14; 162 return channel ? 15 : 14;
122} 163}
123 164
124extern char * (*pcibios_plat_setup)(char *str);
125
126#ifdef CONFIG_OF
127/* this function parses memory ranges from a device node */
128extern void pci_load_of_ranges(struct pci_controller *hose,
129 struct device_node *node);
130#else
131static inline void pci_load_of_ranges(struct pci_controller *hose,
132 struct device_node *node) {}
133#endif
134
135#endif /* _ASM_PCI_H */ 165#endif /* _ASM_PCI_H */
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 93c079a1cfc8..a03e86969f78 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -67,11 +67,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
67static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 67static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
68 unsigned long address) 68 unsigned long address)
69{ 69{
70 pte_t *pte; 70 return (pte_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, PTE_ORDER);
71
72 pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_ZERO, PTE_ORDER);
73
74 return pte;
75} 71}
76 72
77static inline struct page *pte_alloc_one(struct mm_struct *mm, 73static inline struct page *pte_alloc_one(struct mm_struct *mm,
diff --git a/arch/mips/include/asm/pm-cps.h b/arch/mips/include/asm/pm-cps.h
index 625eda53d571..89d58d80b77b 100644
--- a/arch/mips/include/asm/pm-cps.h
+++ b/arch/mips/include/asm/pm-cps.h
@@ -13,10 +13,12 @@
13 13
14/* 14/*
15 * The CM & CPC can only handle coherence & power control on a per-core basis, 15 * The CM & CPC can only handle coherence & power control on a per-core basis,
16 * thus in an MT system the VPEs within each core are coupled and can only 16 * thus in an MT system the VP(E)s within each core are coupled and can only
17 * enter or exit states requiring CM or CPC assistance in unison. 17 * enter or exit states requiring CM or CPC assistance in unison.
18 */ 18 */
19#ifdef CONFIG_MIPS_MT 19#if defined(CONFIG_CPU_MIPSR6)
20# define coupled_coherence cpu_has_vp
21#elif defined(CONFIG_MIPS_MT)
20# define coupled_coherence cpu_has_mipsmt 22# define coupled_coherence cpu_has_mipsmt
21#else 23#else
22# define coupled_coherence 0 24# define coupled_coherence 0
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index f6fc6aac5496..b6578611dddb 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -152,7 +152,7 @@ static inline int is_syscall_success(struct pt_regs *regs)
152 152
153static inline long regs_return_value(struct pt_regs *regs) 153static inline long regs_return_value(struct pt_regs *regs)
154{ 154{
155 if (is_syscall_success(regs)) 155 if (is_syscall_success(regs) || !user_mode(regs))
156 return regs->regs[2]; 156 return regs->regs[2];
157 else 157 else
158 return -regs->regs[2]; 158 return -regs->regs[2];
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 8bc6c70a4030..060f23ff1817 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -85,6 +85,20 @@ static inline void __cpu_die(unsigned int cpu)
85extern void play_dead(void); 85extern void play_dead(void);
86#endif 86#endif
87 87
88/*
89 * This function will set up the necessary IPIs for Linux to communicate
90 * with the CPUs in mask.
91 * Return 0 on success.
92 */
93int mips_smp_ipi_allocate(const struct cpumask *mask);
94
95/*
96 * This function will free up IPIs allocated with mips_smp_ipi_allocate to the
97 * CPUs in mask, which must be a subset of the IPIs that have been configured.
98 * Return 0 on success.
99 */
100int mips_smp_ipi_free(const struct cpumask *mask);
101
88static inline void arch_send_call_function_single_ipi(int cpu) 102static inline void arch_send_call_function_single_ipi(int cpu)
89{ 103{
90 extern struct plat_smp_ops *mp_ops; /* private */ 104 extern struct plat_smp_ops *mp_ops; /* private */
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index 4daf839cd8a8..89fa5c0b1579 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -859,7 +859,10 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
859 __cu_to = (to); \ 859 __cu_to = (to); \
860 __cu_from = (from); \ 860 __cu_from = (from); \
861 __cu_len = (n); \ 861 __cu_len = (n); \
862 \
863 check_object_size(__cu_from, __cu_len, true); \
862 might_fault(); \ 864 might_fault(); \
865 \
863 if (eva_kernel_access()) \ 866 if (eva_kernel_access()) \
864 __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ 867 __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \
865 __cu_len); \ 868 __cu_len); \
@@ -880,6 +883,9 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
880 __cu_to = (to); \ 883 __cu_to = (to); \
881 __cu_from = (from); \ 884 __cu_from = (from); \
882 __cu_len = (n); \ 885 __cu_len = (n); \
886 \
887 check_object_size(__cu_from, __cu_len, true); \
888 \
883 if (eva_kernel_access()) \ 889 if (eva_kernel_access()) \
884 __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ 890 __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \
885 __cu_len); \ 891 __cu_len); \
@@ -898,6 +904,9 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
898 __cu_to = (to); \ 904 __cu_to = (to); \
899 __cu_from = (from); \ 905 __cu_from = (from); \
900 __cu_len = (n); \ 906 __cu_len = (n); \
907 \
908 check_object_size(__cu_to, __cu_len, false); \
909 \
901 if (eva_kernel_access()) \ 910 if (eva_kernel_access()) \
902 __cu_len = __invoke_copy_from_kernel_inatomic(__cu_to, \ 911 __cu_len = __invoke_copy_from_kernel_inatomic(__cu_to, \
903 __cu_from,\ 912 __cu_from,\
@@ -932,6 +941,9 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
932 __cu_to = (to); \ 941 __cu_to = (to); \
933 __cu_from = (from); \ 942 __cu_from = (from); \
934 __cu_len = (n); \ 943 __cu_len = (n); \
944 \
945 check_object_size(__cu_from, __cu_len, true); \
946 \
935 if (eva_kernel_access()) { \ 947 if (eva_kernel_access()) { \
936 __cu_len = __invoke_copy_to_kernel(__cu_to, \ 948 __cu_len = __invoke_copy_to_kernel(__cu_to, \
937 __cu_from, \ 949 __cu_from, \
@@ -1124,6 +1136,9 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
1124 __cu_to = (to); \ 1136 __cu_to = (to); \
1125 __cu_from = (from); \ 1137 __cu_from = (from); \
1126 __cu_len = (n); \ 1138 __cu_len = (n); \
1139 \
1140 check_object_size(__cu_to, __cu_len, false); \
1141 \
1127 if (eva_kernel_access()) { \ 1142 if (eva_kernel_access()) { \
1128 __cu_len = __invoke_copy_from_kernel(__cu_to, \ 1143 __cu_len = __invoke_copy_from_kernel(__cu_to, \
1129 __cu_from, \ 1144 __cu_from, \
@@ -1162,6 +1177,9 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
1162 __cu_to = (to); \ 1177 __cu_to = (to); \
1163 __cu_from = (from); \ 1178 __cu_from = (from); \
1164 __cu_len = (n); \ 1179 __cu_len = (n); \
1180 \
1181 check_object_size(__cu_to, __cu_len, false); \
1182 \
1165 if (eva_kernel_access()) { \ 1183 if (eva_kernel_access()) { \
1166 __cu_len = __invoke_copy_from_kernel(__cu_to, \ 1184 __cu_len = __invoke_copy_from_kernel(__cu_to, \
1167 __cu_from, \ 1185 __cu_from, \
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
index 58ad63d7eb42..9c7f3e136d50 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Support for n32 Linux/MIPS ELF binaries. 2 * Support for n32 Linux/MIPS ELF binaries.
3 * Author: Ralf Baechle (ralf@linux-mips.org)
3 * 4 *
4 * Copyright (C) 1999, 2001 Ralf Baechle 5 * Copyright (C) 1999, 2001 Ralf Baechle
5 * Copyright (C) 1999, 2001 Silicon Graphics, Inc. 6 * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
@@ -37,7 +38,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
37#define ELF_ET_DYN_BASE (TASK32_SIZE / 3 * 2) 38#define ELF_ET_DYN_BASE (TASK32_SIZE / 3 * 2)
38 39
39#include <asm/processor.h> 40#include <asm/processor.h>
40#include <linux/module.h>
41#include <linux/elfcore.h> 41#include <linux/elfcore.h>
42#include <linux/compat.h> 42#include <linux/compat.h>
43#include <linux/math64.h> 43#include <linux/math64.h>
@@ -96,12 +96,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
96 96
97#define ELF_CORE_EFLAGS EF_MIPS_ABI2 97#define ELF_CORE_EFLAGS EF_MIPS_ABI2
98 98
99MODULE_DESCRIPTION("Binary format loader for compatibility with n32 Linux/MIPS binaries");
100MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
101
102#undef MODULE_DESCRIPTION
103#undef MODULE_AUTHOR
104
105#undef TASK_SIZE 99#undef TASK_SIZE
106#define TASK_SIZE TASK_SIZE32 100#define TASK_SIZE TASK_SIZE32
107 101
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index 49fb881481f7..1ab34322dd97 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Support for o32 Linux/MIPS ELF binaries. 2 * Support for o32 Linux/MIPS ELF binaries.
3 * Author: Ralf Baechle (ralf@linux-mips.org)
3 * 4 *
4 * Copyright (C) 1999, 2001 Ralf Baechle 5 * Copyright (C) 1999, 2001 Ralf Baechle
5 * Copyright (C) 1999, 2001 Silicon Graphics, Inc. 6 * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
@@ -42,7 +43,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
42 43
43#include <asm/processor.h> 44#include <asm/processor.h>
44 45
45#include <linux/module.h>
46#include <linux/elfcore.h> 46#include <linux/elfcore.h>
47#include <linux/compat.h> 47#include <linux/compat.h>
48#include <linux/math64.h> 48#include <linux/math64.h>
@@ -99,12 +99,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
99 value->tv_usec = rem / NSEC_PER_USEC; 99 value->tv_usec = rem / NSEC_PER_USEC;
100} 100}
101 101
102MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries");
103MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
104
105#undef MODULE_DESCRIPTION
106#undef MODULE_AUTHOR
107
108#undef TASK_SIZE 102#undef TASK_SIZE
109#define TASK_SIZE TASK_SIZE32 103#define TASK_SIZE TASK_SIZE32
110 104
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 46c227fc98f5..12c718181e5e 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -9,7 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/signal.h> 11#include <linux/signal.h>
12#include <linux/module.h> 12#include <linux/export.h>
13#include <asm/branch.h> 13#include <asm/branch.h>
14#include <asm/cpu.h> 14#include <asm/cpu.h>
15#include <asm/cpu-features.h> 15#include <asm/cpu-features.h>
@@ -866,3 +866,37 @@ unaligned:
866 force_sig(SIGBUS, current); 866 force_sig(SIGBUS, current);
867 return -EFAULT; 867 return -EFAULT;
868} 868}
869
870#if (defined CONFIG_KPROBES) || (defined CONFIG_UPROBES)
871
872int __insn_is_compact_branch(union mips_instruction insn)
873{
874 if (!cpu_has_mips_r6)
875 return 0;
876
877 switch (insn.i_format.opcode) {
878 case blezl_op:
879 case bgtzl_op:
880 case blez_op:
881 case bgtz_op:
882 /*
883 * blez[l] and bgtz[l] opcodes with non-zero rt
884 * are MIPS R6 compact branches
885 */
886 if (insn.i_format.rt)
887 return 1;
888 break;
889 case bc6_op:
890 case balc6_op:
891 case pop10_op:
892 case pop30_op:
893 case pop66_op:
894 case pop76_op:
895 return 1;
896 }
897
898 return 0;
899}
900EXPORT_SYMBOL_GPL(__insn_is_compact_branch);
901
902#endif /* CONFIG_KPROBES || CONFIG_UPROBES */
diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c
index 212f46f2014e..f5c8bce70db2 100644
--- a/arch/mips/kernel/kprobes.c
+++ b/arch/mips/kernel/kprobes.c
@@ -32,7 +32,8 @@
32#include <asm/ptrace.h> 32#include <asm/ptrace.h>
33#include <asm/branch.h> 33#include <asm/branch.h>
34#include <asm/break.h> 34#include <asm/break.h>
35#include <asm/inst.h> 35
36#include "probes-common.h"
36 37
37static const union mips_instruction breakpoint_insn = { 38static const union mips_instruction breakpoint_insn = {
38 .b_format = { 39 .b_format = {
@@ -55,63 +56,7 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
55 56
56static int __kprobes insn_has_delayslot(union mips_instruction insn) 57static int __kprobes insn_has_delayslot(union mips_instruction insn)
57{ 58{
58 switch (insn.i_format.opcode) { 59 return __insn_has_delay_slot(insn);
59
60 /*
61 * This group contains:
62 * jr and jalr are in r_format format.
63 */
64 case spec_op:
65 switch (insn.r_format.func) {
66 case jr_op:
67 case jalr_op:
68 break;
69 default:
70 goto insn_ok;
71 }
72
73 /*
74 * This group contains:
75 * bltz_op, bgez_op, bltzl_op, bgezl_op,
76 * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
77 */
78 case bcond_op:
79
80 /*
81 * These are unconditional and in j_format.
82 */
83 case jal_op:
84 case j_op:
85
86 /*
87 * These are conditional and in i_format.
88 */
89 case beq_op:
90 case beql_op:
91 case bne_op:
92 case bnel_op:
93 case blez_op:
94 case blezl_op:
95 case bgtz_op:
96 case bgtzl_op:
97
98 /*
99 * These are the FPA/cp1 branch instructions.
100 */
101 case cop1_op:
102
103#ifdef CONFIG_CPU_CAVIUM_OCTEON
104 case lwc2_op: /* This is bbit0 on Octeon */
105 case ldc2_op: /* This is bbit032 on Octeon */
106 case swc2_op: /* This is bbit1 on Octeon */
107 case sdc2_op: /* This is bbit132 on Octeon */
108#endif
109 return 1;
110 default:
111 break;
112 }
113insn_ok:
114 return 0;
115} 60}
116 61
117/* 62/*
@@ -161,6 +106,12 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
161 goto out; 106 goto out;
162 } 107 }
163 108
109 if (__insn_is_compact_branch(insn)) {
110 pr_notice("Kprobes for compact branches are not supported\n");
111 ret = -EINVAL;
112 goto out;
113 }
114
164 /* insn: must be on special executable page on mips. */ 115 /* insn: must be on special executable page on mips. */
165 p->ainsn.insn = get_insn_slot(); 116 p->ainsn.insn = get_insn_slot();
166 if (!p->ainsn.insn) { 117 if (!p->ainsn.insn) {
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 0b29646bcee7..50fb62544df7 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -26,7 +26,6 @@
26#include <linux/utsname.h> 26#include <linux/utsname.h>
27#include <linux/personality.h> 27#include <linux/personality.h>
28#include <linux/dnotify.h> 28#include <linux/dnotify.h>
29#include <linux/module.h>
30#include <linux/binfmts.h> 29#include <linux/binfmts.h>
31#include <linux/security.h> 30#include <linux/security.h>
32#include <linux/compat.h> 31#include <linux/compat.h>
diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
index 566b8d2c092c..2a45867d3b4f 100644
--- a/arch/mips/kernel/mips-cpc.c
+++ b/arch/mips/kernel/mips-cpc.c
@@ -52,7 +52,7 @@ static phys_addr_t mips_cpc_phys_base(void)
52int mips_cpc_probe(void) 52int mips_cpc_probe(void)
53{ 53{
54 phys_addr_t addr; 54 phys_addr_t addr;
55 unsigned cpu; 55 unsigned int cpu;
56 56
57 for_each_possible_cpu(cpu) 57 for_each_possible_cpu(cpu)
58 spin_lock_init(&per_cpu(cpc_core_lock, cpu)); 58 spin_lock_init(&per_cpu(cpc_core_lock, cpu));
@@ -70,7 +70,12 @@ int mips_cpc_probe(void)
70 70
71void mips_cpc_lock_other(unsigned int core) 71void mips_cpc_lock_other(unsigned int core)
72{ 72{
73 unsigned curr_core; 73 unsigned int curr_core;
74
75 if (mips_cm_revision() >= CM_REV_CM3)
76 /* Systems with CM >= 3 lock the CPC via mips_cm_lock_other */
77 return;
78
74 preempt_disable(); 79 preempt_disable();
75 curr_core = current_cpu_data.core; 80 curr_core = current_cpu_data.core;
76 spin_lock_irqsave(&per_cpu(cpc_core_lock, curr_core), 81 spin_lock_irqsave(&per_cpu(cpc_core_lock, curr_core),
@@ -86,7 +91,13 @@ void mips_cpc_lock_other(unsigned int core)
86 91
87void mips_cpc_unlock_other(void) 92void mips_cpc_unlock_other(void)
88{ 93{
89 unsigned curr_core = current_cpu_data.core; 94 unsigned int curr_core;
95
96 if (mips_cm_revision() >= CM_REV_CM3)
97 /* Systems with CM >= 3 lock the CPC via mips_cm_lock_other */
98 return;
99
100 curr_core = current_cpu_data.core;
90 spin_unlock_irqrestore(&per_cpu(cpc_core_lock, curr_core), 101 spin_unlock_irqrestore(&per_cpu(cpc_core_lock, curr_core),
91 per_cpu(cpc_core_lock_flags, curr_core)); 102 per_cpu(cpc_core_lock_flags, curr_core));
92 preempt_enable(); 103 preempt_enable();
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index 0a7e10b5f9e3..22dedd62818a 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -15,7 +15,6 @@
15#include <linux/debugfs.h> 15#include <linux/debugfs.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/module.h>
19#include <linux/ptrace.h> 18#include <linux/ptrace.h>
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
21 20
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index 79850e376ef6..94627a3a6a0d 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -20,6 +20,7 @@
20 20
21#undef DEBUG 21#undef DEBUG
22 22
23#include <linux/extable.h>
23#include <linux/moduleloader.h> 24#include <linux/moduleloader.h>
24#include <linux/elf.h> 25#include <linux/elf.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index 5b31a9405ebc..7cf653e21423 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -8,6 +8,7 @@
8 * option) any later version. 8 * option) any later version.
9 */ 9 */
10 10
11#include <linux/cpuhotplug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/percpu.h> 13#include <linux/percpu.h>
13#include <linux/slab.h> 14#include <linux/slab.h>
@@ -70,13 +71,8 @@ static DEFINE_PER_CPU_ALIGNED(atomic_t, pm_barrier);
70DEFINE_PER_CPU_ALIGNED(struct mips_static_suspend_state, cps_cpu_state); 71DEFINE_PER_CPU_ALIGNED(struct mips_static_suspend_state, cps_cpu_state);
71 72
72/* A somewhat arbitrary number of labels & relocs for uasm */ 73/* A somewhat arbitrary number of labels & relocs for uasm */
73static struct uasm_label labels[32] __initdata; 74static struct uasm_label labels[32];
74static struct uasm_reloc relocs[32] __initdata; 75static struct uasm_reloc relocs[32];
75
76/* CPU dependant sync types */
77static unsigned stype_intervention;
78static unsigned stype_memory;
79static unsigned stype_ordering;
80 76
81enum mips_reg { 77enum mips_reg {
82 zero, at, v0, v1, a0, a1, a2, a3, 78 zero, at, v0, v1, a0, a1, a2, a3,
@@ -134,7 +130,7 @@ int cps_pm_enter_state(enum cps_pm_state state)
134 return -EINVAL; 130 return -EINVAL;
135 131
136 /* Calculate which coupled CPUs (VPEs) are online */ 132 /* Calculate which coupled CPUs (VPEs) are online */
137#ifdef CONFIG_MIPS_MT 133#if defined(CONFIG_MIPS_MT) || defined(CONFIG_CPU_MIPSR6)
138 if (cpu_online(cpu)) { 134 if (cpu_online(cpu)) {
139 cpumask_and(coupled_mask, cpu_online_mask, 135 cpumask_and(coupled_mask, cpu_online_mask,
140 &cpu_sibling_map[cpu]); 136 &cpu_sibling_map[cpu]);
@@ -198,10 +194,10 @@ int cps_pm_enter_state(enum cps_pm_state state)
198 return 0; 194 return 0;
199} 195}
200 196
201static void __init cps_gen_cache_routine(u32 **pp, struct uasm_label **pl, 197static void cps_gen_cache_routine(u32 **pp, struct uasm_label **pl,
202 struct uasm_reloc **pr, 198 struct uasm_reloc **pr,
203 const struct cache_desc *cache, 199 const struct cache_desc *cache,
204 unsigned op, int lbl) 200 unsigned op, int lbl)
205{ 201{
206 unsigned cache_size = cache->ways << cache->waybit; 202 unsigned cache_size = cache->ways << cache->waybit;
207 unsigned i; 203 unsigned i;
@@ -242,10 +238,10 @@ static void __init cps_gen_cache_routine(u32 **pp, struct uasm_label **pl,
242 uasm_i_nop(pp); 238 uasm_i_nop(pp);
243} 239}
244 240
245static int __init cps_gen_flush_fsb(u32 **pp, struct uasm_label **pl, 241static int cps_gen_flush_fsb(u32 **pp, struct uasm_label **pl,
246 struct uasm_reloc **pr, 242 struct uasm_reloc **pr,
247 const struct cpuinfo_mips *cpu_info, 243 const struct cpuinfo_mips *cpu_info,
248 int lbl) 244 int lbl)
249{ 245{
250 unsigned i, fsb_size = 8; 246 unsigned i, fsb_size = 8;
251 unsigned num_loads = (fsb_size * 3) / 2; 247 unsigned num_loads = (fsb_size * 3) / 2;
@@ -272,14 +268,9 @@ static int __init cps_gen_flush_fsb(u32 **pp, struct uasm_label **pl,
272 /* On older ones it's unavailable */ 268 /* On older ones it's unavailable */
273 return -1; 269 return -1;
274 270
275 /* CPUs which do not require the workaround */
276 case CPU_P5600:
277 case CPU_I6400:
278 return 0;
279
280 default: 271 default:
281 WARN_ONCE(1, "pm-cps: FSB flush unsupported for this CPU\n"); 272 /* Assume that the CPU does not need this workaround */
282 return -1; 273 return 0;
283 } 274 }
284 275
285 /* 276 /*
@@ -320,8 +311,8 @@ static int __init cps_gen_flush_fsb(u32 **pp, struct uasm_label **pl,
320 i * line_size * line_stride, t0); 311 i * line_size * line_stride, t0);
321 } 312 }
322 313
323 /* Completion barrier */ 314 /* Barrier ensuring previous cache invalidates are complete */
324 uasm_i_sync(pp, stype_memory); 315 uasm_i_sync(pp, STYPE_SYNC);
325 uasm_i_ehb(pp); 316 uasm_i_ehb(pp);
326 317
327 /* Check whether the pipeline stalled due to the FSB being full */ 318 /* Check whether the pipeline stalled due to the FSB being full */
@@ -340,9 +331,9 @@ static int __init cps_gen_flush_fsb(u32 **pp, struct uasm_label **pl,
340 return 0; 331 return 0;
341} 332}
342 333
343static void __init cps_gen_set_top_bit(u32 **pp, struct uasm_label **pl, 334static void cps_gen_set_top_bit(u32 **pp, struct uasm_label **pl,
344 struct uasm_reloc **pr, 335 struct uasm_reloc **pr,
345 unsigned r_addr, int lbl) 336 unsigned r_addr, int lbl)
346{ 337{
347 uasm_i_lui(pp, t0, uasm_rel_hi(0x80000000)); 338 uasm_i_lui(pp, t0, uasm_rel_hi(0x80000000));
348 uasm_build_label(pl, *pp, lbl); 339 uasm_build_label(pl, *pp, lbl);
@@ -353,7 +344,7 @@ static void __init cps_gen_set_top_bit(u32 **pp, struct uasm_label **pl,
353 uasm_i_nop(pp); 344 uasm_i_nop(pp);
354} 345}
355 346
356static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state) 347static void *cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
357{ 348{
358 struct uasm_label *l = labels; 349 struct uasm_label *l = labels;
359 struct uasm_reloc *r = relocs; 350 struct uasm_reloc *r = relocs;
@@ -411,7 +402,7 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
411 402
412 if (coupled_coherence) { 403 if (coupled_coherence) {
413 /* Increment ready_count */ 404 /* Increment ready_count */
414 uasm_i_sync(&p, stype_ordering); 405 uasm_i_sync(&p, STYPE_SYNC_MB);
415 uasm_build_label(&l, p, lbl_incready); 406 uasm_build_label(&l, p, lbl_incready);
416 uasm_i_ll(&p, t1, 0, r_nc_count); 407 uasm_i_ll(&p, t1, 0, r_nc_count);
417 uasm_i_addiu(&p, t2, t1, 1); 408 uasm_i_addiu(&p, t2, t1, 1);
@@ -419,8 +410,8 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
419 uasm_il_beqz(&p, &r, t2, lbl_incready); 410 uasm_il_beqz(&p, &r, t2, lbl_incready);
420 uasm_i_addiu(&p, t1, t1, 1); 411 uasm_i_addiu(&p, t1, t1, 1);
421 412
422 /* Ordering barrier */ 413 /* Barrier ensuring all CPUs see the updated r_nc_count value */
423 uasm_i_sync(&p, stype_ordering); 414 uasm_i_sync(&p, STYPE_SYNC_MB);
424 415
425 /* 416 /*
426 * If this is the last VPE to become ready for non-coherence 417 * If this is the last VPE to become ready for non-coherence
@@ -441,7 +432,8 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
441 uasm_i_lw(&p, t0, 0, r_nc_count); 432 uasm_i_lw(&p, t0, 0, r_nc_count);
442 uasm_il_bltz(&p, &r, t0, lbl_secondary_cont); 433 uasm_il_bltz(&p, &r, t0, lbl_secondary_cont);
443 uasm_i_ehb(&p); 434 uasm_i_ehb(&p);
444 uasm_i_yield(&p, zero, t1); 435 if (cpu_has_mipsmt)
436 uasm_i_yield(&p, zero, t1);
445 uasm_il_b(&p, &r, lbl_poll_cont); 437 uasm_il_b(&p, &r, lbl_poll_cont);
446 uasm_i_nop(&p); 438 uasm_i_nop(&p);
447 } else { 439 } else {
@@ -449,8 +441,21 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
449 * The core will lose power & this VPE will not continue 441 * The core will lose power & this VPE will not continue
450 * so it can simply halt here. 442 * so it can simply halt here.
451 */ 443 */
452 uasm_i_addiu(&p, t0, zero, TCHALT_H); 444 if (cpu_has_mipsmt) {
453 uasm_i_mtc0(&p, t0, 2, 4); 445 /* Halt the VPE via C0 tchalt register */
446 uasm_i_addiu(&p, t0, zero, TCHALT_H);
447 uasm_i_mtc0(&p, t0, 2, 4);
448 } else if (cpu_has_vp) {
449 /* Halt the VP via the CPC VP_STOP register */
450 unsigned int vpe_id;
451
452 vpe_id = cpu_vpe_id(&cpu_data[cpu]);
453 uasm_i_addiu(&p, t0, zero, 1 << vpe_id);
454 UASM_i_LA(&p, t1, (long)addr_cpc_cl_vp_stop());
455 uasm_i_sw(&p, t0, 0, t1);
456 } else {
457 BUG();
458 }
454 uasm_build_label(&l, p, lbl_secondary_hang); 459 uasm_build_label(&l, p, lbl_secondary_hang);
455 uasm_il_b(&p, &r, lbl_secondary_hang); 460 uasm_il_b(&p, &r, lbl_secondary_hang);
456 uasm_i_nop(&p); 461 uasm_i_nop(&p);
@@ -472,22 +477,24 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
472 cps_gen_cache_routine(&p, &l, &r, &cpu_data[cpu].dcache, 477 cps_gen_cache_routine(&p, &l, &r, &cpu_data[cpu].dcache,
473 Index_Writeback_Inv_D, lbl_flushdcache); 478 Index_Writeback_Inv_D, lbl_flushdcache);
474 479
475 /* Completion barrier */ 480 /* Barrier ensuring previous cache invalidates are complete */
476 uasm_i_sync(&p, stype_memory); 481 uasm_i_sync(&p, STYPE_SYNC);
477 uasm_i_ehb(&p); 482 uasm_i_ehb(&p);
478 483
479 /* 484 if (mips_cm_revision() < CM_REV_CM3) {
480 * Disable all but self interventions. The load from COHCTL is defined 485 /*
481 * by the interAptiv & proAptiv SUMs as ensuring that the operation 486 * Disable all but self interventions. The load from COHCTL is
482 * resulting from the preceding store is complete. 487 * defined by the interAptiv & proAptiv SUMs as ensuring that the
483 */ 488 * operation resulting from the preceding store is complete.
484 uasm_i_addiu(&p, t0, zero, 1 << cpu_data[cpu].core); 489 */
485 uasm_i_sw(&p, t0, 0, r_pcohctl); 490 uasm_i_addiu(&p, t0, zero, 1 << cpu_data[cpu].core);
486 uasm_i_lw(&p, t0, 0, r_pcohctl); 491 uasm_i_sw(&p, t0, 0, r_pcohctl);
487 492 uasm_i_lw(&p, t0, 0, r_pcohctl);
488 /* Sync to ensure previous interventions are complete */ 493
489 uasm_i_sync(&p, stype_intervention); 494 /* Barrier to ensure write to coherence control is complete */
490 uasm_i_ehb(&p); 495 uasm_i_sync(&p, STYPE_SYNC);
496 uasm_i_ehb(&p);
497 }
491 498
492 /* Disable coherence */ 499 /* Disable coherence */
493 uasm_i_sw(&p, zero, 0, r_pcohctl); 500 uasm_i_sw(&p, zero, 0, r_pcohctl);
@@ -531,8 +538,8 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
531 goto gen_done; 538 goto gen_done;
532 } 539 }
533 540
534 /* Completion barrier */ 541 /* Barrier to ensure write to CPC command is complete */
535 uasm_i_sync(&p, stype_memory); 542 uasm_i_sync(&p, STYPE_SYNC);
536 uasm_i_ehb(&p); 543 uasm_i_ehb(&p);
537 } 544 }
538 545
@@ -562,26 +569,29 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
562 * will run this. The first will actually re-enable coherence & the 569 * will run this. The first will actually re-enable coherence & the
563 * rest will just be performing a rather unusual nop. 570 * rest will just be performing a rather unusual nop.
564 */ 571 */
565 uasm_i_addiu(&p, t0, zero, CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK); 572 uasm_i_addiu(&p, t0, zero, mips_cm_revision() < CM_REV_CM3
573 ? CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK
574 : CM3_GCR_Cx_COHERENCE_COHEN_MSK);
575
566 uasm_i_sw(&p, t0, 0, r_pcohctl); 576 uasm_i_sw(&p, t0, 0, r_pcohctl);
567 uasm_i_lw(&p, t0, 0, r_pcohctl); 577 uasm_i_lw(&p, t0, 0, r_pcohctl);
568 578
569 /* Completion barrier */ 579 /* Barrier to ensure write to coherence control is complete */
570 uasm_i_sync(&p, stype_memory); 580 uasm_i_sync(&p, STYPE_SYNC);
571 uasm_i_ehb(&p); 581 uasm_i_ehb(&p);
572 582
573 if (coupled_coherence && (state == CPS_PM_NC_WAIT)) { 583 if (coupled_coherence && (state == CPS_PM_NC_WAIT)) {
574 /* Decrement ready_count */ 584 /* Decrement ready_count */
575 uasm_build_label(&l, p, lbl_decready); 585 uasm_build_label(&l, p, lbl_decready);
576 uasm_i_sync(&p, stype_ordering); 586 uasm_i_sync(&p, STYPE_SYNC_MB);
577 uasm_i_ll(&p, t1, 0, r_nc_count); 587 uasm_i_ll(&p, t1, 0, r_nc_count);
578 uasm_i_addiu(&p, t2, t1, -1); 588 uasm_i_addiu(&p, t2, t1, -1);
579 uasm_i_sc(&p, t2, 0, r_nc_count); 589 uasm_i_sc(&p, t2, 0, r_nc_count);
580 uasm_il_beqz(&p, &r, t2, lbl_decready); 590 uasm_il_beqz(&p, &r, t2, lbl_decready);
581 uasm_i_andi(&p, v0, t1, (1 << fls(smp_num_siblings)) - 1); 591 uasm_i_andi(&p, v0, t1, (1 << fls(smp_num_siblings)) - 1);
582 592
583 /* Ordering barrier */ 593 /* Barrier ensuring all CPUs see the updated r_nc_count value */
584 uasm_i_sync(&p, stype_ordering); 594 uasm_i_sync(&p, STYPE_SYNC_MB);
585 } 595 }
586 596
587 if (coupled_coherence && (state == CPS_PM_CLOCK_GATED)) { 597 if (coupled_coherence && (state == CPS_PM_CLOCK_GATED)) {
@@ -602,8 +612,8 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
602 */ 612 */
603 uasm_build_label(&l, p, lbl_secondary_cont); 613 uasm_build_label(&l, p, lbl_secondary_cont);
604 614
605 /* Ordering barrier */ 615 /* Barrier ensuring all CPUs see the updated r_nc_count value */
606 uasm_i_sync(&p, stype_ordering); 616 uasm_i_sync(&p, STYPE_SYNC_MB);
607 } 617 }
608 618
609 /* The core is coherent, time to return to C code */ 619 /* The core is coherent, time to return to C code */
@@ -628,7 +638,7 @@ out_err:
628 return NULL; 638 return NULL;
629} 639}
630 640
631static int __init cps_gen_core_entries(unsigned cpu) 641static int cps_pm_online_cpu(unsigned int cpu)
632{ 642{
633 enum cps_pm_state state; 643 enum cps_pm_state state;
634 unsigned core = cpu_data[cpu].core; 644 unsigned core = cpu_data[cpu].core;
@@ -670,29 +680,10 @@ static int __init cps_gen_core_entries(unsigned cpu)
670 680
671static int __init cps_pm_init(void) 681static int __init cps_pm_init(void)
672{ 682{
673 unsigned cpu;
674 int err;
675
676 /* Detect appropriate sync types for the system */
677 switch (current_cpu_data.cputype) {
678 case CPU_INTERAPTIV:
679 case CPU_PROAPTIV:
680 case CPU_M5150:
681 case CPU_P5600:
682 case CPU_I6400:
683 stype_intervention = 0x2;
684 stype_memory = 0x3;
685 stype_ordering = 0x10;
686 break;
687
688 default:
689 pr_warn("Power management is using heavyweight sync 0\n");
690 }
691
692 /* A CM is required for all non-coherent states */ 683 /* A CM is required for all non-coherent states */
693 if (!mips_cm_present()) { 684 if (!mips_cm_present()) {
694 pr_warn("pm-cps: no CM, non-coherent states unavailable\n"); 685 pr_warn("pm-cps: no CM, non-coherent states unavailable\n");
695 goto out; 686 return 0;
696 } 687 }
697 688
698 /* 689 /*
@@ -722,12 +713,7 @@ static int __init cps_pm_init(void)
722 pr_warn("pm-cps: no CPC, clock & power gating unavailable\n"); 713 pr_warn("pm-cps: no CPC, clock & power gating unavailable\n");
723 } 714 }
724 715
725 for_each_present_cpu(cpu) { 716 return cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "AP_PM_CPS_CPU_ONLINE",
726 err = cps_gen_core_entries(cpu); 717 cps_pm_online_cpu, NULL);
727 if (err)
728 return err;
729 }
730out:
731 return 0;
732} 718}
733arch_initcall(cps_pm_init); 719arch_initcall(cps_pm_init);
diff --git a/arch/mips/kernel/probes-common.h b/arch/mips/kernel/probes-common.h
new file mode 100644
index 000000000000..dd08e41134b6
--- /dev/null
+++ b/arch/mips/kernel/probes-common.h
@@ -0,0 +1,83 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __PROBES_COMMON_H
12#define __PROBES_COMMON_H
13
14#include <asm/inst.h>
15
16int __insn_is_compact_branch(union mips_instruction insn);
17
18static inline int __insn_has_delay_slot(const union mips_instruction insn)
19{
20 switch (insn.i_format.opcode) {
21 /*
22 * jr and jalr are in r_format format.
23 */
24 case spec_op:
25 switch (insn.r_format.func) {
26 case jalr_op:
27 case jr_op:
28 return 1;
29 }
30 break;
31
32 /*
33 * This group contains:
34 * bltz_op, bgez_op, bltzl_op, bgezl_op,
35 * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
36 */
37 case bcond_op:
38 switch (insn.i_format.rt) {
39 case bltz_op:
40 case bltzl_op:
41 case bgez_op:
42 case bgezl_op:
43 case bltzal_op:
44 case bltzall_op:
45 case bgezal_op:
46 case bgezall_op:
47 case bposge32_op:
48 return 1;
49 }
50 break;
51
52 /*
53 * These are unconditional and in j_format.
54 */
55 case jal_op:
56 case j_op:
57 case beq_op:
58 case beql_op:
59 case bne_op:
60 case bnel_op:
61 case blez_op: /* not really i_format */
62 case blezl_op:
63 case bgtz_op:
64 case bgtzl_op:
65 return 1;
66
67 /*
68 * And now the FPA/cp1 branch instructions.
69 */
70 case cop1_op:
71#ifdef CONFIG_CPU_CAVIUM_OCTEON
72 case lwc2_op: /* This is bbit0 on Octeon */
73 case ldc2_op: /* This is bbit032 on Octeon */
74 case swc2_op: /* This is bbit1 on Octeon */
75 case sdc2_op: /* This is bbit132 on Octeon */
76#endif
77 return 1;
78 }
79
80 return 0;
81}
82
83#endif /* __PROBES_COMMON_H */
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 97dc01b03631..4eff2aed7360 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -135,6 +135,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)
135 seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package); 135 seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
136 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core); 136 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
137 137
138#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_CPU_MIPSR6)
139 if (cpu_has_mipsmt)
140 seq_printf(m, "VPE\t\t\t: %d\n", cpu_data[n].vpe_id);
141 else if (cpu_has_vp)
142 seq_printf(m, "VP\t\t\t: %d\n", cpu_data[n].vpe_id);
143#endif
144
138 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", 145 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
139 cpu_has_vce ? "%u" : "not available"); 146 cpu_has_vce ? "%u" : "not available");
140 seq_printf(m, fmt, 'D', vced_count); 147 seq_printf(m, fmt, 'D', vced_count);
diff --git a/arch/mips/kernel/smp-gic.c b/arch/mips/kernel/smp-gic.c
deleted file mode 100644
index 9b63829cf929..000000000000
--- a/arch/mips/kernel/smp-gic.c
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * Based on smp-cmp.c:
6 * Copyright (C) 2007 MIPS Technologies, Inc.
7 * Author: Chris Dearman (chris@mips.com)
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/irqchip/mips-gic.h>
16#include <linux/printk.h>
17
18#include <asm/mips-cpc.h>
19#include <asm/smp-ops.h>
20
21void gic_send_ipi_single(int cpu, unsigned int action)
22{
23 unsigned long flags;
24 unsigned int intr;
25 unsigned int core = cpu_data[cpu].core;
26
27 pr_debug("CPU%d: %s cpu %d action %u status %08x\n",
28 smp_processor_id(), __func__, cpu, action, read_c0_status());
29
30 local_irq_save(flags);
31
32 switch (action) {
33 case SMP_CALL_FUNCTION:
34 intr = plat_ipi_call_int_xlate(cpu);
35 break;
36
37 case SMP_RESCHEDULE_YOURSELF:
38 intr = plat_ipi_resched_int_xlate(cpu);
39 break;
40
41 default:
42 BUG();
43 }
44
45 gic_send_ipi(intr);
46
47 if (mips_cpc_present() && (core != current_cpu_data.core)) {
48 while (!cpumask_test_cpu(cpu, &cpu_coherent_mask)) {
49 mips_cm_lock_other(core, 0);
50 mips_cpc_lock_other(core);
51 write_cpc_co_cmd(CPC_Cx_CMD_PWRUP);
52 mips_cpc_unlock_other();
53 mips_cm_unlock_other();
54 }
55 }
56
57 local_irq_restore(flags);
58}
59
60void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action)
61{
62 unsigned int i;
63
64 for_each_cpu(i, mask)
65 gic_send_ipi_single(i, action);
66}
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 4f9570a57e8d..e077ea3e11fb 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -289,26 +289,3 @@ struct plat_smp_ops vsmp_smp_ops = {
289 .prepare_cpus = vsmp_prepare_cpus, 289 .prepare_cpus = vsmp_prepare_cpus,
290}; 290};
291 291
292#ifdef CONFIG_PROC_FS
293static int proc_cpuinfo_chain_call(struct notifier_block *nfb,
294 unsigned long action_unused, void *data)
295{
296 struct proc_cpuinfo_notifier_args *pcn = data;
297 struct seq_file *m = pcn->m;
298 unsigned long n = pcn->n;
299
300 if (!cpu_has_mipsmt)
301 return NOTIFY_OK;
302
303 seq_printf(m, "VPE\t\t\t: %d\n", cpu_data[n].vpe_id);
304
305 return NOTIFY_OK;
306}
307
308static int __init proc_cpuinfo_notifier_init(void)
309{
310 return proc_cpuinfo_notifier(proc_cpuinfo_chain_call, 0);
311}
312
313subsys_initcall(proc_cpuinfo_notifier_init);
314#endif
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index b0baf48951fa..7ebb1918e2ac 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -25,7 +25,7 @@
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/threads.h> 27#include <linux/threads.h>
28#include <linux/module.h> 28#include <linux/export.h>
29#include <linux/time.h> 29#include <linux/time.h>
30#include <linux/timex.h> 30#include <linux/timex.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
@@ -192,9 +192,11 @@ void mips_smp_send_ipi_mask(const struct cpumask *mask, unsigned int action)
192 continue; 192 continue;
193 193
194 while (!cpumask_test_cpu(cpu, &cpu_coherent_mask)) { 194 while (!cpumask_test_cpu(cpu, &cpu_coherent_mask)) {
195 mips_cm_lock_other(core, 0);
195 mips_cpc_lock_other(core); 196 mips_cpc_lock_other(core);
196 write_cpc_co_cmd(CPC_Cx_CMD_PWRUP); 197 write_cpc_co_cmd(CPC_Cx_CMD_PWRUP);
197 mips_cpc_unlock_other(); 198 mips_cpc_unlock_other();
199 mips_cm_unlock_other();
198 } 200 }
199 } 201 }
200 } 202 }
@@ -229,7 +231,7 @@ static struct irqaction irq_call = {
229 .name = "IPI call" 231 .name = "IPI call"
230}; 232};
231 233
232static __init void smp_ipi_init_one(unsigned int virq, 234static void smp_ipi_init_one(unsigned int virq,
233 struct irqaction *action) 235 struct irqaction *action)
234{ 236{
235 int ret; 237 int ret;
@@ -239,9 +241,11 @@ static __init void smp_ipi_init_one(unsigned int virq,
239 BUG_ON(ret); 241 BUG_ON(ret);
240} 242}
241 243
242static int __init mips_smp_ipi_init(void) 244static unsigned int call_virq, sched_virq;
245
246int mips_smp_ipi_allocate(const struct cpumask *mask)
243{ 247{
244 unsigned int call_virq, sched_virq; 248 int virq;
245 struct irq_domain *ipidomain; 249 struct irq_domain *ipidomain;
246 struct device_node *node; 250 struct device_node *node;
247 251
@@ -268,16 +272,20 @@ static int __init mips_smp_ipi_init(void)
268 if (!ipidomain) 272 if (!ipidomain)
269 return 0; 273 return 0;
270 274
271 call_virq = irq_reserve_ipi(ipidomain, cpu_possible_mask); 275 virq = irq_reserve_ipi(ipidomain, mask);
272 BUG_ON(!call_virq); 276 BUG_ON(!virq);
277 if (!call_virq)
278 call_virq = virq;
273 279
274 sched_virq = irq_reserve_ipi(ipidomain, cpu_possible_mask); 280 virq = irq_reserve_ipi(ipidomain, mask);
275 BUG_ON(!sched_virq); 281 BUG_ON(!virq);
282 if (!sched_virq)
283 sched_virq = virq;
276 284
277 if (irq_domain_is_ipi_per_cpu(ipidomain)) { 285 if (irq_domain_is_ipi_per_cpu(ipidomain)) {
278 int cpu; 286 int cpu;
279 287
280 for_each_cpu(cpu, cpu_possible_mask) { 288 for_each_cpu(cpu, mask) {
281 smp_ipi_init_one(call_virq + cpu, &irq_call); 289 smp_ipi_init_one(call_virq + cpu, &irq_call);
282 smp_ipi_init_one(sched_virq + cpu, &irq_resched); 290 smp_ipi_init_one(sched_virq + cpu, &irq_resched);
283 } 291 }
@@ -286,6 +294,45 @@ static int __init mips_smp_ipi_init(void)
286 smp_ipi_init_one(sched_virq, &irq_resched); 294 smp_ipi_init_one(sched_virq, &irq_resched);
287 } 295 }
288 296
297 return 0;
298}
299
300int mips_smp_ipi_free(const struct cpumask *mask)
301{
302 struct irq_domain *ipidomain;
303 struct device_node *node;
304
305 node = of_irq_find_parent(of_root);
306 ipidomain = irq_find_matching_host(node, DOMAIN_BUS_IPI);
307
308 /*
309 * Some platforms have half DT setup. So if we found irq node but
310 * didn't find an ipidomain, try to search for one that is not in the
311 * DT.
312 */
313 if (node && !ipidomain)
314 ipidomain = irq_find_matching_host(NULL, DOMAIN_BUS_IPI);
315
316 BUG_ON(!ipidomain);
317
318 if (irq_domain_is_ipi_per_cpu(ipidomain)) {
319 int cpu;
320
321 for_each_cpu(cpu, mask) {
322 remove_irq(call_virq + cpu, &irq_call);
323 remove_irq(sched_virq + cpu, &irq_resched);
324 }
325 }
326 irq_destroy_ipi(call_virq, mask);
327 irq_destroy_ipi(sched_virq, mask);
328 return 0;
329}
330
331
332static int __init mips_smp_ipi_init(void)
333{
334 mips_smp_ipi_allocate(cpu_possible_mask);
335
289 call_desc = irq_to_desc(call_virq); 336 call_desc = irq_to_desc(call_virq);
290 sched_desc = irq_to_desc(sched_virq); 337 sched_desc = irq_to_desc(sched_virq);
291 338
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 3de85be2486a..1f5fdee1dfc3 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/extable.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/sched.h> 26#include <linux/sched.h>
26#include <linux/smp.h> 27#include <linux/smp.h>
@@ -48,6 +49,7 @@
48#include <asm/fpu.h> 49#include <asm/fpu.h>
49#include <asm/fpu_emulator.h> 50#include <asm/fpu_emulator.h>
50#include <asm/idle.h> 51#include <asm/idle.h>
52#include <asm/mips-cm.h>
51#include <asm/mips-r2-to-r6-emul.h> 53#include <asm/mips-r2-to-r6-emul.h>
52#include <asm/mipsregs.h> 54#include <asm/mipsregs.h>
53#include <asm/mipsmtregs.h> 55#include <asm/mipsmtregs.h>
@@ -444,6 +446,8 @@ asmlinkage void do_be(struct pt_regs *regs)
444 446
445 if (board_be_handler) 447 if (board_be_handler)
446 action = board_be_handler(regs, fixup != NULL); 448 action = board_be_handler(regs, fixup != NULL);
449 else
450 mips_cm_error_report();
447 451
448 switch (action) { 452 switch (action) {
449 case MIPS_BE_DISCARD: 453 case MIPS_BE_DISCARD:
@@ -2091,6 +2095,14 @@ static void configure_exception_vector(void)
2091{ 2095{
2092 if (cpu_has_veic || cpu_has_vint) { 2096 if (cpu_has_veic || cpu_has_vint) {
2093 unsigned long sr = set_c0_status(ST0_BEV); 2097 unsigned long sr = set_c0_status(ST0_BEV);
2098 /* If available, use WG to set top bits of EBASE */
2099 if (cpu_has_ebase_wg) {
2100#ifdef CONFIG_64BIT
2101 write_c0_ebase_64(ebase | MIPS_EBASE_WG);
2102#else
2103 write_c0_ebase(ebase | MIPS_EBASE_WG);
2104#endif
2105 }
2094 write_c0_ebase(ebase); 2106 write_c0_ebase(ebase);
2095 write_c0_status(sr); 2107 write_c0_status(sr);
2096 /* Setting vector spacing enables EI/VI mode */ 2108 /* Setting vector spacing enables EI/VI mode */
@@ -2127,8 +2139,17 @@ void per_cpu_trap_init(bool is_boot_cpu)
2127 * We shouldn't trust a secondary core has a sane EBASE register 2139 * We shouldn't trust a secondary core has a sane EBASE register
2128 * so use the one calculated by the boot CPU. 2140 * so use the one calculated by the boot CPU.
2129 */ 2141 */
2130 if (!is_boot_cpu) 2142 if (!is_boot_cpu) {
2143 /* If available, use WG to set top bits of EBASE */
2144 if (cpu_has_ebase_wg) {
2145#ifdef CONFIG_64BIT
2146 write_c0_ebase_64(ebase | MIPS_EBASE_WG);
2147#else
2148 write_c0_ebase(ebase | MIPS_EBASE_WG);
2149#endif
2150 }
2131 write_c0_ebase(ebase); 2151 write_c0_ebase(ebase);
2152 }
2132 2153
2133 cp0_compare_irq_shift = CAUSEB_TI - CAUSEB_IP; 2154 cp0_compare_irq_shift = CAUSEB_TI - CAUSEB_IP;
2134 cp0_compare_irq = (read_c0_intctl() >> INTCTLB_IPTI) & 7; 2155 cp0_compare_irq = (read_c0_intctl() >> INTCTLB_IPTI) & 7;
@@ -2209,13 +2230,39 @@ void __init trap_init(void)
2209 2230
2210 if (cpu_has_veic || cpu_has_vint) { 2231 if (cpu_has_veic || cpu_has_vint) {
2211 unsigned long size = 0x200 + VECTORSPACING*64; 2232 unsigned long size = 0x200 + VECTORSPACING*64;
2233 phys_addr_t ebase_pa;
2234
2212 ebase = (unsigned long) 2235 ebase = (unsigned long)
2213 __alloc_bootmem(size, 1 << fls(size), 0); 2236 __alloc_bootmem(size, 1 << fls(size), 0);
2237
2238 /*
2239 * Try to ensure ebase resides in KSeg0 if possible.
2240 *
2241 * It shouldn't generally be in XKPhys on MIPS64 to avoid
2242 * hitting a poorly defined exception base for Cache Errors.
2243 * The allocation is likely to be in the low 512MB of physical,
2244 * in which case we should be able to convert to KSeg0.
2245 *
2246 * EVA is special though as it allows segments to be rearranged
2247 * and to become uncached during cache error handling.
2248 */
2249 ebase_pa = __pa(ebase);
2250 if (!IS_ENABLED(CONFIG_EVA) && !WARN_ON(ebase_pa >= 0x20000000))
2251 ebase = CKSEG0ADDR(ebase_pa);
2214 } else { 2252 } else {
2215 ebase = CAC_BASE; 2253 ebase = CAC_BASE;
2216 2254
2217 if (cpu_has_mips_r2_r6) 2255 if (cpu_has_mips_r2_r6) {
2218 ebase += (read_c0_ebase() & 0x3ffff000); 2256 if (cpu_has_ebase_wg) {
2257#ifdef CONFIG_64BIT
2258 ebase = (read_c0_ebase_64() & ~0xfff);
2259#else
2260 ebase = (read_c0_ebase() & ~0xfff);
2261#endif
2262 } else {
2263 ebase += (read_c0_ebase() & 0x3ffff000);
2264 }
2265 }
2219 } 2266 }
2220 2267
2221 if (cpu_has_mmips) { 2268 if (cpu_has_mmips) {
diff --git a/arch/mips/kernel/uprobes.c b/arch/mips/kernel/uprobes.c
index 4c7c1558944a..dbb917403131 100644
--- a/arch/mips/kernel/uprobes.c
+++ b/arch/mips/kernel/uprobes.c
@@ -8,71 +8,12 @@
8#include <asm/branch.h> 8#include <asm/branch.h>
9#include <asm/cpu-features.h> 9#include <asm/cpu-features.h>
10#include <asm/ptrace.h> 10#include <asm/ptrace.h>
11#include <asm/inst.h> 11
12#include "probes-common.h"
12 13
13static inline int insn_has_delay_slot(const union mips_instruction insn) 14static inline int insn_has_delay_slot(const union mips_instruction insn)
14{ 15{
15 switch (insn.i_format.opcode) { 16 return __insn_has_delay_slot(insn);
16 /*
17 * jr and jalr are in r_format format.
18 */
19 case spec_op:
20 switch (insn.r_format.func) {
21 case jalr_op:
22 case jr_op:
23 return 1;
24 }
25 break;
26
27 /*
28 * This group contains:
29 * bltz_op, bgez_op, bltzl_op, bgezl_op,
30 * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
31 */
32 case bcond_op:
33 switch (insn.i_format.rt) {
34 case bltz_op:
35 case bltzl_op:
36 case bgez_op:
37 case bgezl_op:
38 case bltzal_op:
39 case bltzall_op:
40 case bgezal_op:
41 case bgezall_op:
42 case bposge32_op:
43 return 1;
44 }
45 break;
46
47 /*
48 * These are unconditional and in j_format.
49 */
50 case jal_op:
51 case j_op:
52 case beq_op:
53 case beql_op:
54 case bne_op:
55 case bnel_op:
56 case blez_op: /* not really i_format */
57 case blezl_op:
58 case bgtz_op:
59 case bgtzl_op:
60 return 1;
61
62 /*
63 * And now the FPA/cp1 branch instructions.
64 */
65 case cop1_op:
66#ifdef CONFIG_CPU_CAVIUM_OCTEON
67 case lwc2_op: /* This is bbit0 on Octeon */
68 case ldc2_op: /* This is bbit032 on Octeon */
69 case swc2_op: /* This is bbit1 on Octeon */
70 case sdc2_op: /* This is bbit132 on Octeon */
71#endif
72 return 1;
73 }
74
75 return 0;
76} 17}
77 18
78/** 19/**
@@ -95,6 +36,12 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *aup,
95 return -EINVAL; 36 return -EINVAL;
96 37
97 inst.word = aup->insn[0]; 38 inst.word = aup->insn[0];
39
40 if (__insn_is_compact_branch(inst)) {
41 pr_notice("Uprobes for compact branches are not supported\n");
42 return -EINVAL;
43 }
44
98 aup->ixol[0] = aup->insn[insn_has_delay_slot(inst)]; 45 aup->ixol[0] = aup->insn[insn_has_delay_slot(inst)];
99 aup->ixol[1] = UPROBE_BRK_UPROBE_XOL; /* NOP */ 46 aup->ixol[1] = UPROBE_BRK_UPROBE_XOL; /* NOP */
100 47
@@ -282,19 +229,14 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm,
282void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, 229void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
283 void *src, unsigned long len) 230 void *src, unsigned long len)
284{ 231{
285 void *kaddr; 232 unsigned long kaddr, kstart;
286 233
287 /* Initialize the slot */ 234 /* Initialize the slot */
288 kaddr = kmap_atomic(page); 235 kaddr = (unsigned long)kmap_atomic(page);
289 memcpy(kaddr + (vaddr & ~PAGE_MASK), src, len); 236 kstart = kaddr + (vaddr & ~PAGE_MASK);
290 kunmap_atomic(kaddr); 237 memcpy((void *)kstart, src, len);
291 238 flush_icache_range(kstart, kstart + len);
292 /* 239 kunmap_atomic((void *)kaddr);
293 * The MIPS version of flush_icache_range will operate safely on
294 * user space addresses and more importantly, it doesn't require a
295 * VMA argument.
296 */
297 flush_icache_range(vaddr, vaddr + len);
298} 240}
299 241
300/** 242/**
diff --git a/arch/mips/kvm/commpage.c b/arch/mips/kvm/commpage.c
index a36b77e1705c..f43629979a0e 100644
--- a/arch/mips/kvm/commpage.c
+++ b/arch/mips/kvm/commpage.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/module.h>
16#include <linux/vmalloc.h> 15#include <linux/vmalloc.h>
17#include <linux/fs.h> 16#include <linux/fs.h>
18#include <linux/bootmem.h> 17#include <linux/bootmem.h>
diff --git a/arch/mips/kvm/dyntrans.c b/arch/mips/kvm/dyntrans.c
index d280894915ed..010cef240688 100644
--- a/arch/mips/kvm/dyntrans.c
+++ b/arch/mips/kvm/dyntrans.c
@@ -13,7 +13,6 @@
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/highmem.h> 14#include <linux/highmem.h>
15#include <linux/kvm_host.h> 15#include <linux/kvm_host.h>
16#include <linux/module.h>
17#include <linux/vmalloc.h> 16#include <linux/vmalloc.h>
18#include <linux/fs.h> 17#include <linux/fs.h>
19#include <linux/bootmem.h> 18#include <linux/bootmem.h>
@@ -45,8 +44,8 @@ static int kvm_mips_trans_replace(struct kvm_vcpu *vcpu, u32 *opc,
45 } else if (KVM_GUEST_KSEGX((unsigned long) opc) == KVM_GUEST_KSEG23) { 44 } else if (KVM_GUEST_KSEGX((unsigned long) opc) == KVM_GUEST_KSEG23) {
46 local_irq_save(flags); 45 local_irq_save(flags);
47 memcpy((void *)opc, (void *)&replace, sizeof(u32)); 46 memcpy((void *)opc, (void *)&replace, sizeof(u32));
48 local_flush_icache_range((unsigned long)opc, 47 __local_flush_icache_user_range((unsigned long)opc,
49 (unsigned long)opc + 32); 48 (unsigned long)opc + 32);
50 local_irq_restore(flags); 49 local_irq_restore(flags);
51 } else { 50 } else {
52 kvm_err("%s: Invalid address: %p\n", __func__, opc); 51 kvm_err("%s: Invalid address: %p\n", __func__, opc);
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
index 4db4c0370859..8770f32c9e0b 100644
--- a/arch/mips/kvm/emulate.c
+++ b/arch/mips/kvm/emulate.c
@@ -13,7 +13,6 @@
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/ktime.h> 14#include <linux/ktime.h>
15#include <linux/kvm_host.h> 15#include <linux/kvm_host.h>
16#include <linux/module.h>
17#include <linux/vmalloc.h> 16#include <linux/vmalloc.h>
18#include <linux/fs.h> 17#include <linux/fs.h>
19#include <linux/bootmem.h> 18#include <linux/bootmem.h>
diff --git a/arch/mips/kvm/interrupt.c b/arch/mips/kvm/interrupt.c
index ad28dac6b7e9..e88403b3dcdd 100644
--- a/arch/mips/kvm/interrupt.c
+++ b/arch/mips/kvm/interrupt.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/module.h>
15#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
16#include <linux/fs.h> 15#include <linux/fs.h>
17#include <linux/bootmem.h> 16#include <linux/bootmem.h>
diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c
index 3a5484f9aa50..3b20441f2beb 100644
--- a/arch/mips/kvm/trap_emul.c
+++ b/arch/mips/kvm/trap_emul.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/module.h>
15#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
16 15
17#include <linux/kvm_host.h> 16#include <linux/kvm_host.h>
diff --git a/arch/mips/lantiq/xway/vmmc.c b/arch/mips/lantiq/xway/vmmc.c
index 4625495f9230..577ec81b557d 100644
--- a/arch/mips/lantiq/xway/vmmc.c
+++ b/arch/mips/lantiq/xway/vmmc.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2012 John Crispin <john@phrozen.org> 6 * Copyright (C) 2012 John Crispin <john@phrozen.org>
7 */ 7 */
8 8
9#include <linux/module.h> 9#include <linux/export.h>
10#include <linux/of_platform.h> 10#include <linux/of_platform.h>
11#include <linux/of_gpio.h> 11#include <linux/of_gpio.h>
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
@@ -55,7 +55,6 @@ static const struct of_device_id vmmc_match[] = {
55 { .compatible = "lantiq,vmmc-xway" }, 55 { .compatible = "lantiq,vmmc-xway" },
56 {}, 56 {},
57}; 57};
58MODULE_DEVICE_TABLE(of, vmmc_match);
59 58
60static struct platform_driver vmmc_driver = { 59static struct platform_driver vmmc_driver = {
61 .probe = vmmc_probe, 60 .probe = vmmc_probe,
@@ -64,5 +63,4 @@ static struct platform_driver vmmc_driver = {
64 .of_match_table = vmmc_match, 63 .of_match_table = vmmc_match,
65 }, 64 },
66}; 65};
67 66builtin_platform_driver(vmmc_driver);
68module_platform_driver(vmmc_driver);
diff --git a/arch/mips/lantiq/xway/xrx200_phy_fw.c b/arch/mips/lantiq/xway/xrx200_phy_fw.c
index 71e518c1e7e7..f0a0f2d431b2 100644
--- a/arch/mips/lantiq/xway/xrx200_phy_fw.c
+++ b/arch/mips/lantiq/xway/xrx200_phy_fw.c
@@ -1,4 +1,7 @@
1/* 1/*
2 * Lantiq XRX200 PHY Firmware Loader
3 * Author: John Crispin
4 *
2 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published 6 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation. 7 * by the Free Software Foundation.
@@ -8,7 +11,6 @@
8 11
9#include <linux/delay.h> 12#include <linux/delay.h>
10#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
11#include <linux/module.h>
12#include <linux/firmware.h> 14#include <linux/firmware.h>
13#include <linux/of_platform.h> 15#include <linux/of_platform.h>
14 16
@@ -100,7 +102,6 @@ static const struct of_device_id xway_phy_match[] = {
100 { .compatible = "lantiq,phy-xrx200" }, 102 { .compatible = "lantiq,phy-xrx200" },
101 {}, 103 {},
102}; 104};
103MODULE_DEVICE_TABLE(of, xway_phy_match);
104 105
105static struct platform_driver xway_phy_driver = { 106static struct platform_driver xway_phy_driver = {
106 .probe = xway_phy_fw_probe, 107 .probe = xway_phy_fw_probe,
@@ -109,9 +110,4 @@ static struct platform_driver xway_phy_driver = {
109 .of_match_table = xway_phy_match, 110 .of_match_table = xway_phy_match,
110 }, 111 },
111}; 112};
112 113builtin_platform_driver(xway_phy_driver);
113module_platform_driver(xway_phy_driver);
114
115MODULE_AUTHOR("John Crispin <john@phrozen.org>");
116MODULE_DESCRIPTION("Lantiq XRX200 PHY Firmware Loader");
117MODULE_LICENSE("GPL");
diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c
index 927dc94a030f..c3e22053d13e 100644
--- a/arch/mips/lib/ashldi3.c
+++ b/arch/mips/lib/ashldi3.c
@@ -1,4 +1,4 @@
1#include <linux/module.h> 1#include <linux/export.h>
2 2
3#include "libgcc.h" 3#include "libgcc.h"
4 4
diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c
index 9fdf1a598428..17456024873d 100644
--- a/arch/mips/lib/ashrdi3.c
+++ b/arch/mips/lib/ashrdi3.c
@@ -1,4 +1,4 @@
1#include <linux/module.h> 1#include <linux/export.h>
2 2
3#include "libgcc.h" 3#include "libgcc.h"
4 4
diff --git a/arch/mips/lib/bswapdi.c b/arch/mips/lib/bswapdi.c
index e3e77aa52c95..a8114148f82a 100644
--- a/arch/mips/lib/bswapdi.c
+++ b/arch/mips/lib/bswapdi.c
@@ -1,4 +1,5 @@
1#include <linux/module.h> 1#include <linux/export.h>
2#include <linux/compiler.h>
2 3
3unsigned long long notrace __bswapdi2(unsigned long long u) 4unsigned long long notrace __bswapdi2(unsigned long long u)
4{ 5{
diff --git a/arch/mips/lib/bswapsi.c b/arch/mips/lib/bswapsi.c
index 530a8afe6fda..106fd978317d 100644
--- a/arch/mips/lib/bswapsi.c
+++ b/arch/mips/lib/bswapsi.c
@@ -1,4 +1,5 @@
1#include <linux/module.h> 1#include <linux/export.h>
2#include <linux/compiler.h>
2 3
3unsigned int notrace __bswapsi2(unsigned int u) 4unsigned int notrace __bswapsi2(unsigned int u)
4{ 5{
diff --git a/arch/mips/lib/cmpdi2.c b/arch/mips/lib/cmpdi2.c
index 06857da96993..9d849d8743c9 100644
--- a/arch/mips/lib/cmpdi2.c
+++ b/arch/mips/lib/cmpdi2.c
@@ -1,4 +1,4 @@
1#include <linux/module.h> 1#include <linux/export.h>
2 2
3#include "libgcc.h" 3#include "libgcc.h"
4 4
diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index 21d27c6819a2..2307a3cb2714 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -8,7 +8,7 @@
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2007, 2014 Maciej W. Rozycki 9 * Copyright (C) 2007, 2014 Maciej W. Rozycki
10 */ 10 */
11#include <linux/module.h> 11#include <linux/export.h>
12#include <linux/param.h> 12#include <linux/param.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/stringify.h> 14#include <linux/stringify.h>
diff --git a/arch/mips/lib/iomap-pci.c b/arch/mips/lib/iomap-pci.c
index fd35daa45314..8ed3f25a9047 100644
--- a/arch/mips/lib/iomap-pci.c
+++ b/arch/mips/lib/iomap-pci.c
@@ -7,9 +7,11 @@
7 * written by Ralf Baechle <ralf@linux-mips.org> 7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */ 8 */
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/module.h> 10#include <linux/export.h>
11#include <asm/io.h> 11#include <asm/io.h>
12 12
13#ifdef CONFIG_PCI_DRIVERS_LEGACY
14
13void __iomem *__pci_ioport_map(struct pci_dev *dev, 15void __iomem *__pci_ioport_map(struct pci_dev *dev,
14 unsigned long port, unsigned int nr) 16 unsigned long port, unsigned int nr)
15{ 17{
@@ -40,6 +42,8 @@ void __iomem *__pci_ioport_map(struct pci_dev *dev,
40 return (void __iomem *) (ctrl->io_map_base + port); 42 return (void __iomem *) (ctrl->io_map_base + port);
41} 43}
42 44
45#endif /* CONFIG_PCI_DRIVERS_LEGACY */
46
43void pci_iounmap(struct pci_dev *dev, void __iomem * addr) 47void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
44{ 48{
45 iounmap(addr); 49 iounmap(addr);
diff --git a/arch/mips/lib/iomap.c b/arch/mips/lib/iomap.c
index 8e7e378ce51c..9daa92428e23 100644
--- a/arch/mips/lib/iomap.c
+++ b/arch/mips/lib/iomap.c
@@ -6,7 +6,7 @@
6 * (C) Copyright 2007 MIPS Technologies, Inc. 6 * (C) Copyright 2007 MIPS Technologies, Inc.
7 * written by Ralf Baechle <ralf@linux-mips.org> 7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */ 8 */
9#include <linux/module.h> 9#include <linux/export.h>
10#include <asm/io.h> 10#include <asm/io.h>
11 11
12/* 12/*
diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c
index 364547449c65..221167c1be55 100644
--- a/arch/mips/lib/lshrdi3.c
+++ b/arch/mips/lib/lshrdi3.c
@@ -1,4 +1,4 @@
1#include <linux/module.h> 1#include <linux/export.h>
2 2
3#include "libgcc.h" 3#include "libgcc.h"
4 4
diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c
index bd599f58234c..08067fa538f2 100644
--- a/arch/mips/lib/ucmpdi2.c
+++ b/arch/mips/lib/ucmpdi2.c
@@ -1,4 +1,4 @@
1#include <linux/module.h> 1#include <linux/export.h>
2 2
3#include "libgcc.h" 3#include "libgcc.h"
4 4
diff --git a/arch/mips/loongson32/Kconfig b/arch/mips/loongson32/Kconfig
index 7704f20529d6..3c0c2f2096cd 100644
--- a/arch/mips/loongson32/Kconfig
+++ b/arch/mips/loongson32/Kconfig
@@ -19,6 +19,21 @@ config LOONGSON1_LS1B
19 select USE_GENERIC_EARLY_PRINTK_8250 19 select USE_GENERIC_EARLY_PRINTK_8250
20 select COMMON_CLK 20 select COMMON_CLK
21 21
22config LOONGSON1_LS1C
23 bool "Loongson LS1C board"
24 select CEVT_R4K if !MIPS_EXTERNAL_TIMER
25 select CSRC_R4K if !MIPS_EXTERNAL_TIMER
26 select SYS_HAS_CPU_LOONGSON1C
27 select DMA_NONCOHERENT
28 select BOOT_ELF32
29 select IRQ_MIPS_CPU
30 select SYS_SUPPORTS_32BIT_KERNEL
31 select SYS_SUPPORTS_LITTLE_ENDIAN
32 select SYS_SUPPORTS_HIGHMEM
33 select SYS_SUPPORTS_MIPS16
34 select SYS_HAS_EARLY_PRINTK
35 select USE_GENERIC_EARLY_PRINTK_8250
36 select COMMON_CLK
22endchoice 37endchoice
23 38
24menuconfig CEVT_CSRC_LS1X 39menuconfig CEVT_CSRC_LS1X
diff --git a/arch/mips/loongson32/Makefile b/arch/mips/loongson32/Makefile
index 5f4bd6e071ca..1ab2c5bbc066 100644
--- a/arch/mips/loongson32/Makefile
+++ b/arch/mips/loongson32/Makefile
@@ -9,3 +9,9 @@ obj-$(CONFIG_MACH_LOONGSON32) += common/
9# 9#
10 10
11obj-$(CONFIG_LOONGSON1_LS1B) += ls1b/ 11obj-$(CONFIG_LOONGSON1_LS1B) += ls1b/
12
13#
14# Loongson LS1C board
15#
16
17obj-$(CONFIG_LOONGSON1_LS1C) += ls1c/
diff --git a/arch/mips/loongson32/Platform b/arch/mips/loongson32/Platform
index ebb6dc290f0a..ffe01c6d0037 100644
--- a/arch/mips/loongson32/Platform
+++ b/arch/mips/loongson32/Platform
@@ -5,3 +5,4 @@ cflags-$(CONFIG_CPU_LOONGSON1) += \
5platform-$(CONFIG_MACH_LOONGSON32) += loongson32/ 5platform-$(CONFIG_MACH_LOONGSON32) += loongson32/
6cflags-$(CONFIG_MACH_LOONGSON32) += -I$(srctree)/arch/mips/include/asm/mach-loongson32 6cflags-$(CONFIG_MACH_LOONGSON32) += -I$(srctree)/arch/mips/include/asm/mach-loongson32
7load-$(CONFIG_LOONGSON1_LS1B) += 0xffffffff80100000 7load-$(CONFIG_LOONGSON1_LS1B) += 0xffffffff80100000
8load-$(CONFIG_LOONGSON1_LS1C) += 0xffffffff80100000
diff --git a/arch/mips/loongson32/common/irq.c b/arch/mips/loongson32/common/irq.c
index 455a7704a90f..635a4abe1f48 100644
--- a/arch/mips/loongson32/common/irq.c
+++ b/arch/mips/loongson32/common/irq.c
@@ -62,12 +62,58 @@ static void ls1x_irq_unmask(struct irq_data *d)
62 | (1 << bit), LS1X_INTC_INTIEN(n)); 62 | (1 << bit), LS1X_INTC_INTIEN(n));
63} 63}
64 64
65static int ls1x_irq_settype(struct irq_data *d, unsigned int type)
66{
67 unsigned int bit = (d->irq - LS1X_IRQ_BASE) & 0x1f;
68 unsigned int n = (d->irq - LS1X_IRQ_BASE) >> 5;
69
70 switch (type) {
71 case IRQ_TYPE_LEVEL_HIGH:
72 __raw_writel(__raw_readl(LS1X_INTC_INTPOL(n))
73 | (1 << bit), LS1X_INTC_INTPOL(n));
74 __raw_writel(__raw_readl(LS1X_INTC_INTEDGE(n))
75 & ~(1 << bit), LS1X_INTC_INTEDGE(n));
76 break;
77 case IRQ_TYPE_LEVEL_LOW:
78 __raw_writel(__raw_readl(LS1X_INTC_INTPOL(n))
79 & ~(1 << bit), LS1X_INTC_INTPOL(n));
80 __raw_writel(__raw_readl(LS1X_INTC_INTEDGE(n))
81 & ~(1 << bit), LS1X_INTC_INTEDGE(n));
82 break;
83 case IRQ_TYPE_EDGE_RISING:
84 __raw_writel(__raw_readl(LS1X_INTC_INTPOL(n))
85 | (1 << bit), LS1X_INTC_INTPOL(n));
86 __raw_writel(__raw_readl(LS1X_INTC_INTEDGE(n))
87 | (1 << bit), LS1X_INTC_INTEDGE(n));
88 break;
89 case IRQ_TYPE_EDGE_FALLING:
90 __raw_writel(__raw_readl(LS1X_INTC_INTPOL(n))
91 & ~(1 << bit), LS1X_INTC_INTPOL(n));
92 __raw_writel(__raw_readl(LS1X_INTC_INTEDGE(n))
93 | (1 << bit), LS1X_INTC_INTEDGE(n));
94 break;
95 case IRQ_TYPE_EDGE_BOTH:
96 __raw_writel(__raw_readl(LS1X_INTC_INTPOL(n))
97 & ~(1 << bit), LS1X_INTC_INTPOL(n));
98 __raw_writel(__raw_readl(LS1X_INTC_INTEDGE(n))
99 | (1 << bit), LS1X_INTC_INTEDGE(n));
100 break;
101 case IRQ_TYPE_NONE:
102 break;
103 default:
104 return -EINVAL;
105 }
106
107 return 0;
108}
109
65static struct irq_chip ls1x_irq_chip = { 110static struct irq_chip ls1x_irq_chip = {
66 .name = "LS1X-INTC", 111 .name = "LS1X-INTC",
67 .irq_ack = ls1x_irq_ack, 112 .irq_ack = ls1x_irq_ack,
68 .irq_mask = ls1x_irq_mask, 113 .irq_mask = ls1x_irq_mask,
69 .irq_mask_ack = ls1x_irq_mask_ack, 114 .irq_mask_ack = ls1x_irq_mask_ack,
70 .irq_unmask = ls1x_irq_unmask, 115 .irq_unmask = ls1x_irq_unmask,
116 .irq_set_type = ls1x_irq_settype,
71}; 117};
72 118
73static void ls1x_irq_dispatch(int n) 119static void ls1x_irq_dispatch(int n)
@@ -107,7 +153,7 @@ asmlinkage void plat_irq_dispatch(void)
107 153
108} 154}
109 155
110struct irqaction cascade_irqaction = { 156static struct irqaction cascade_irqaction = {
111 .handler = no_action, 157 .handler = no_action,
112 .name = "cascade", 158 .name = "cascade",
113 .flags = IRQF_NO_THREAD, 159 .flags = IRQF_NO_THREAD,
@@ -120,7 +166,7 @@ static void __init ls1x_irq_init(int base)
120 /* Disable interrupts and clear pending, 166 /* Disable interrupts and clear pending,
121 * setup all IRQs as high level triggered 167 * setup all IRQs as high level triggered
122 */ 168 */
123 for (n = 0; n < 4; n++) { 169 for (n = 0; n < INTN; n++) {
124 __raw_writel(0x0, LS1X_INTC_INTIEN(n)); 170 __raw_writel(0x0, LS1X_INTC_INTIEN(n));
125 __raw_writel(0xffffffff, LS1X_INTC_INTCLR(n)); 171 __raw_writel(0xffffffff, LS1X_INTC_INTCLR(n));
126 __raw_writel(0xffffffff, LS1X_INTC_INTPOL(n)); 172 __raw_writel(0xffffffff, LS1X_INTC_INTPOL(n));
@@ -129,7 +175,7 @@ static void __init ls1x_irq_init(int base)
129 } 175 }
130 176
131 177
132 for (n = base; n < LS1X_IRQS; n++) { 178 for (n = base; n < NR_IRQS; n++) {
133 irq_set_chip_and_handler(n, &ls1x_irq_chip, 179 irq_set_chip_and_handler(n, &ls1x_irq_chip,
134 handle_level_irq); 180 handle_level_irq);
135 } 181 }
@@ -138,6 +184,9 @@ static void __init ls1x_irq_init(int base)
138 setup_irq(INT1_IRQ, &cascade_irqaction); 184 setup_irq(INT1_IRQ, &cascade_irqaction);
139 setup_irq(INT2_IRQ, &cascade_irqaction); 185 setup_irq(INT2_IRQ, &cascade_irqaction);
140 setup_irq(INT3_IRQ, &cascade_irqaction); 186 setup_irq(INT3_IRQ, &cascade_irqaction);
187#if defined(CONFIG_LOONGSON1_LS1C)
188 setup_irq(INT4_IRQ, &cascade_irqaction);
189#endif
141} 190}
142 191
143void __init arch_init_irq(void) 192void __init arch_init_irq(void)
diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/common/platform.c
index f2c714d8fb60..beff0852c6a4 100644
--- a/arch/mips/loongson32/common/platform.c
+++ b/arch/mips/loongson32/common/platform.c
@@ -17,11 +17,16 @@
17#include <linux/stmmac.h> 17#include <linux/stmmac.h>
18#include <linux/usb/ehci_pdriver.h> 18#include <linux/usb/ehci_pdriver.h>
19 19
20#include <platform.h>
20#include <loongson1.h> 21#include <loongson1.h>
21#include <cpufreq.h> 22#include <cpufreq.h>
22#include <dma.h> 23#include <dma.h>
23#include <nand.h> 24#include <nand.h>
24 25
26#define LS1X_RTC_CTRL ((void __iomem *)KSEG1ADDR(LS1X_RTC_BASE + 0x40))
27#define RTC_EXTCLK_OK (BIT(5) | BIT(8))
28#define RTC_EXTCLK_EN BIT(8)
29
25/* 8250/16550 compatible UART */ 30/* 8250/16550 compatible UART */
26#define LS1X_UART(_id) \ 31#define LS1X_UART(_id) \
27 { \ 32 { \
@@ -65,6 +70,15 @@ void __init ls1x_serial_set_uartclk(struct platform_device *pdev)
65 p->uartclk = clk_get_rate(clk); 70 p->uartclk = clk_get_rate(clk);
66} 71}
67 72
73void __init ls1x_rtc_set_extclk(struct platform_device *pdev)
74{
75 u32 val;
76
77 val = __raw_readl(LS1X_RTC_CTRL);
78 if (!(val & RTC_EXTCLK_OK))
79 __raw_writel(val | RTC_EXTCLK_EN, LS1X_RTC_CTRL);
80}
81
68/* CPUFreq */ 82/* CPUFreq */
69static struct plat_ls1x_cpufreq ls1x_cpufreq_pdata = { 83static struct plat_ls1x_cpufreq ls1x_cpufreq_pdata = {
70 .clk_name = "cpu_clk", 84 .clk_name = "cpu_clk",
@@ -132,6 +146,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void *priv)
132 146
133 val = __raw_readl(LS1X_MUX_CTRL1); 147 val = __raw_readl(LS1X_MUX_CTRL1);
134 148
149#if defined(CONFIG_LOONGSON1_LS1B)
135 plat_dat = dev_get_platdata(&pdev->dev); 150 plat_dat = dev_get_platdata(&pdev->dev);
136 if (plat_dat->bus_id) { 151 if (plat_dat->bus_id) {
137 __raw_writel(__raw_readl(LS1X_MUX_CTRL0) | GMAC1_USE_UART1 | 152 __raw_writel(__raw_readl(LS1X_MUX_CTRL0) | GMAC1_USE_UART1 |
@@ -165,6 +180,17 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void *priv)
165 val &= ~GMAC0_SHUT; 180 val &= ~GMAC0_SHUT;
166 } 181 }
167 __raw_writel(val, LS1X_MUX_CTRL1); 182 __raw_writel(val, LS1X_MUX_CTRL1);
183#elif defined(CONFIG_LOONGSON1_LS1C)
184 plat_dat = dev_get_platdata(&pdev->dev);
185
186 val &= ~PHY_INTF_SELI;
187 if (plat_dat->interface == PHY_INTERFACE_MODE_RMII)
188 val |= 0x4 << PHY_INTF_SELI_SHIFT;
189 __raw_writel(val, LS1X_MUX_CTRL1);
190
191 val = __raw_readl(LS1X_MUX_CTRL0);
192 __raw_writel(val & (~GMAC_SHUT), LS1X_MUX_CTRL0);
193#endif
168 194
169 return 0; 195 return 0;
170} 196}
@@ -172,7 +198,11 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void *priv)
172static struct plat_stmmacenet_data ls1x_eth0_pdata = { 198static struct plat_stmmacenet_data ls1x_eth0_pdata = {
173 .bus_id = 0, 199 .bus_id = 0,
174 .phy_addr = -1, 200 .phy_addr = -1,
201#if defined(CONFIG_LOONGSON1_LS1B)
175 .interface = PHY_INTERFACE_MODE_MII, 202 .interface = PHY_INTERFACE_MODE_MII,
203#elif defined(CONFIG_LOONGSON1_LS1C)
204 .interface = PHY_INTERFACE_MODE_RMII,
205#endif
176 .mdio_bus_data = &ls1x_mdio_bus_data, 206 .mdio_bus_data = &ls1x_mdio_bus_data,
177 .dma_cfg = &ls1x_eth_dma_cfg, 207 .dma_cfg = &ls1x_eth_dma_cfg,
178 .has_gmac = 1, 208 .has_gmac = 1,
@@ -203,6 +233,7 @@ struct platform_device ls1x_eth0_pdev = {
203 }, 233 },
204}; 234};
205 235
236#ifdef CONFIG_LOONGSON1_LS1B
206static struct plat_stmmacenet_data ls1x_eth1_pdata = { 237static struct plat_stmmacenet_data ls1x_eth1_pdata = {
207 .bus_id = 1, 238 .bus_id = 1,
208 .phy_addr = -1, 239 .phy_addr = -1,
@@ -236,6 +267,7 @@ struct platform_device ls1x_eth1_pdev = {
236 .platform_data = &ls1x_eth1_pdata, 267 .platform_data = &ls1x_eth1_pdata,
237 }, 268 },
238}; 269};
270#endif /* CONFIG_LOONGSON1_LS1B */
239 271
240/* GPIO */ 272/* GPIO */
241static struct resource ls1x_gpio0_resources[] = { 273static struct resource ls1x_gpio0_resources[] = {
diff --git a/arch/mips/loongson32/common/setup.c b/arch/mips/loongson32/common/setup.c
index 62f41afee241..1640744288ee 100644
--- a/arch/mips/loongson32/common/setup.c
+++ b/arch/mips/loongson32/common/setup.c
@@ -22,7 +22,11 @@ const char *get_system_type(void)
22 22
23 switch (processor_id & PRID_REV_MASK) { 23 switch (processor_id & PRID_REV_MASK) {
24 case PRID_REV_LOONGSON1B: 24 case PRID_REV_LOONGSON1B:
25#if defined(CONFIG_LOONGSON1_LS1B)
25 return "LOONGSON LS1B"; 26 return "LOONGSON LS1B";
27#elif defined(CONFIG_LOONGSON1_LS1C)
28 return "LOONGSON LS1C";
29#endif
26 default: 30 default:
27 return "LOONGSON (unknown)"; 31 return "LOONGSON (unknown)";
28 } 32 }
diff --git a/arch/mips/loongson32/ls1c/Makefile b/arch/mips/loongson32/ls1c/Makefile
new file mode 100644
index 000000000000..a92c6cd3418d
--- /dev/null
+++ b/arch/mips/loongson32/ls1c/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for loongson1C based machines.
3#
4
5obj-y += board.o
diff --git a/arch/mips/loongson32/ls1c/board.c b/arch/mips/loongson32/ls1c/board.c
new file mode 100644
index 000000000000..a96bed5e3ea6
--- /dev/null
+++ b/arch/mips/loongson32/ls1c/board.c
@@ -0,0 +1,27 @@
1/*
2 * Copyright (c) 2016 Yang Ling <gnaygnil@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#include <platform.h>
11
12static struct platform_device *ls1c_platform_devices[] __initdata = {
13 &ls1x_uart_pdev,
14 &ls1x_eth0_pdev,
15 &ls1x_rtc_pdev,
16};
17
18static int __init ls1c_platform_init(void)
19{
20 ls1x_serial_set_uartclk(&ls1x_uart_pdev);
21 ls1x_rtc_set_extclk(&ls1x_rtc_pdev);
22
23 return platform_add_devices(ls1c_platform_devices,
24 ARRAY_SIZE(ls1c_platform_devices));
25}
26
27arch_initcall(ls1c_platform_init);
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index 05b1d7cf9514..0e45b061e514 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -294,6 +294,8 @@ void octeon_cache_init(void)
294 flush_data_cache_page = octeon_flush_data_cache_page; 294 flush_data_cache_page = octeon_flush_data_cache_page;
295 flush_icache_range = octeon_flush_icache_range; 295 flush_icache_range = octeon_flush_icache_range;
296 local_flush_icache_range = local_octeon_flush_icache_range; 296 local_flush_icache_range = local_octeon_flush_icache_range;
297 __flush_icache_user_range = octeon_flush_icache_range;
298 __local_flush_icache_user_range = local_octeon_flush_icache_range;
297 299
298 __flush_kernel_vmap_range = octeon_flush_kernel_vmap_range; 300 __flush_kernel_vmap_range = octeon_flush_kernel_vmap_range;
299 301
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index 135ec313c1f6..21e4e662c1fa 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -325,6 +325,8 @@ void r3k_cache_init(void)
325 flush_cache_page = r3k_flush_cache_page; 325 flush_cache_page = r3k_flush_cache_page;
326 flush_icache_range = r3k_flush_icache_range; 326 flush_icache_range = r3k_flush_icache_range;
327 local_flush_icache_range = r3k_flush_icache_range; 327 local_flush_icache_range = r3k_flush_icache_range;
328 __flush_icache_user_range = r3k_flush_icache_range;
329 __local_flush_icache_user_range = r3k_flush_icache_range;
328 330
329 __flush_kernel_vmap_range = r3k_flush_kernel_vmap_range; 331 __flush_kernel_vmap_range = r3k_flush_kernel_vmap_range;
330 332
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index fa7d8d3790bf..88cfaf81c958 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -17,7 +17,7 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/module.h> 20#include <linux/export.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22 22
23#include <asm/bcache.h> 23#include <asm/bcache.h>
@@ -722,11 +722,13 @@ struct flush_icache_range_args {
722 unsigned long start; 722 unsigned long start;
723 unsigned long end; 723 unsigned long end;
724 unsigned int type; 724 unsigned int type;
725 bool user;
725}; 726};
726 727
727static inline void __local_r4k_flush_icache_range(unsigned long start, 728static inline void __local_r4k_flush_icache_range(unsigned long start,
728 unsigned long end, 729 unsigned long end,
729 unsigned int type) 730 unsigned int type,
731 bool user)
730{ 732{
731 if (!cpu_has_ic_fills_f_dc) { 733 if (!cpu_has_ic_fills_f_dc) {
732 if (type == R4K_INDEX || 734 if (type == R4K_INDEX ||
@@ -734,7 +736,10 @@ static inline void __local_r4k_flush_icache_range(unsigned long start,
734 r4k_blast_dcache(); 736 r4k_blast_dcache();
735 } else { 737 } else {
736 R4600_HIT_CACHEOP_WAR_IMPL; 738 R4600_HIT_CACHEOP_WAR_IMPL;
737 protected_blast_dcache_range(start, end); 739 if (user)
740 protected_blast_dcache_range(start, end);
741 else
742 blast_dcache_range(start, end);
738 } 743 }
739 } 744 }
740 745
@@ -748,27 +753,25 @@ static inline void __local_r4k_flush_icache_range(unsigned long start,
748 break; 753 break;
749 754
750 default: 755 default:
751 protected_blast_icache_range(start, end); 756 if (user)
757 protected_blast_icache_range(start, end);
758 else
759 blast_icache_range(start, end);
752 break; 760 break;
753 } 761 }
754 } 762 }
755#ifdef CONFIG_EVA
756 /*
757 * Due to all possible segment mappings, there might cache aliases
758 * caused by the bootloader being in non-EVA mode, and the CPU switching
759 * to EVA during early kernel init. It's best to flush the scache
760 * to avoid having secondary cores fetching stale data and lead to
761 * kernel crashes.
762 */
763 bc_wback_inv(start, (end - start));
764 __sync();
765#endif
766} 763}
767 764
768static inline void local_r4k_flush_icache_range(unsigned long start, 765static inline void local_r4k_flush_icache_range(unsigned long start,
769 unsigned long end) 766 unsigned long end)
770{ 767{
771 __local_r4k_flush_icache_range(start, end, R4K_HIT | R4K_INDEX); 768 __local_r4k_flush_icache_range(start, end, R4K_HIT | R4K_INDEX, false);
769}
770
771static inline void local_r4k_flush_icache_user_range(unsigned long start,
772 unsigned long end)
773{
774 __local_r4k_flush_icache_range(start, end, R4K_HIT | R4K_INDEX, true);
772} 775}
773 776
774static inline void local_r4k_flush_icache_range_ipi(void *args) 777static inline void local_r4k_flush_icache_range_ipi(void *args)
@@ -777,11 +780,13 @@ static inline void local_r4k_flush_icache_range_ipi(void *args)
777 unsigned long start = fir_args->start; 780 unsigned long start = fir_args->start;
778 unsigned long end = fir_args->end; 781 unsigned long end = fir_args->end;
779 unsigned int type = fir_args->type; 782 unsigned int type = fir_args->type;
783 bool user = fir_args->user;
780 784
781 __local_r4k_flush_icache_range(start, end, type); 785 __local_r4k_flush_icache_range(start, end, type, user);
782} 786}
783 787
784static void r4k_flush_icache_range(unsigned long start, unsigned long end) 788static void __r4k_flush_icache_range(unsigned long start, unsigned long end,
789 bool user)
785{ 790{
786 struct flush_icache_range_args args; 791 struct flush_icache_range_args args;
787 unsigned long size, cache_size; 792 unsigned long size, cache_size;
@@ -789,6 +794,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
789 args.start = start; 794 args.start = start;
790 args.end = end; 795 args.end = end;
791 args.type = R4K_HIT | R4K_INDEX; 796 args.type = R4K_HIT | R4K_INDEX;
797 args.user = user;
792 798
793 /* 799 /*
794 * Indexed cache ops require an SMP call. 800 * Indexed cache ops require an SMP call.
@@ -814,6 +820,16 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
814 instruction_hazard(); 820 instruction_hazard();
815} 821}
816 822
823static void r4k_flush_icache_range(unsigned long start, unsigned long end)
824{
825 return __r4k_flush_icache_range(start, end, false);
826}
827
828static void r4k_flush_icache_user_range(unsigned long start, unsigned long end)
829{
830 return __r4k_flush_icache_range(start, end, true);
831}
832
817#if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_DMA_MAYBE_COHERENT) 833#if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_DMA_MAYBE_COHERENT)
818 834
819static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) 835static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
@@ -1915,9 +1931,16 @@ void r4k_cache_init(void)
1915 flush_data_cache_page = r4k_flush_data_cache_page; 1931 flush_data_cache_page = r4k_flush_data_cache_page;
1916 flush_icache_range = r4k_flush_icache_range; 1932 flush_icache_range = r4k_flush_icache_range;
1917 local_flush_icache_range = local_r4k_flush_icache_range; 1933 local_flush_icache_range = local_r4k_flush_icache_range;
1934 __flush_icache_user_range = r4k_flush_icache_user_range;
1935 __local_flush_icache_user_range = local_r4k_flush_icache_user_range;
1918 1936
1919#if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_DMA_MAYBE_COHERENT) 1937#if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_DMA_MAYBE_COHERENT)
1920 if (coherentio) { 1938# if defined(CONFIG_DMA_PERDEV_COHERENT)
1939 if (0) {
1940# else
1941 if ((coherentio == IO_COHERENCE_ENABLED) ||
1942 ((coherentio == IO_COHERENCE_DEFAULT) && hw_coherentio)) {
1943# endif
1921 _dma_cache_wback_inv = (void *)cache_noop; 1944 _dma_cache_wback_inv = (void *)cache_noop;
1922 _dma_cache_wback = (void *)cache_noop; 1945 _dma_cache_wback = (void *)cache_noop;
1923 _dma_cache_inv = (void *)cache_noop; 1946 _dma_cache_inv = (void *)cache_noop;
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index 596e18458e04..5c282583edf1 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -411,6 +411,9 @@ void tx39_cache_init(void)
411 break; 411 break;
412 } 412 }
413 413
414 __flush_icache_user_range = flush_icache_range;
415 __local_flush_icache_user_range = local_flush_icache_range;
416
414 current_cpu_data.icache.waysize = icache_size / current_cpu_data.icache.ways; 417 current_cpu_data.icache.waysize = icache_size / current_cpu_data.icache.ways;
415 current_cpu_data.dcache.waysize = dcache_size / current_cpu_data.dcache.ways; 418 current_cpu_data.dcache.waysize = dcache_size / current_cpu_data.dcache.ways;
416 419
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index bf04c6c479a4..6db341347202 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -10,7 +10,7 @@
10#include <linux/fcntl.h> 10#include <linux/fcntl.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <linux/module.h> 13#include <linux/export.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/syscalls.h> 15#include <linux/syscalls.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
@@ -33,6 +33,10 @@ void (*flush_icache_range)(unsigned long start, unsigned long end);
33EXPORT_SYMBOL_GPL(flush_icache_range); 33EXPORT_SYMBOL_GPL(flush_icache_range);
34void (*local_flush_icache_range)(unsigned long start, unsigned long end); 34void (*local_flush_icache_range)(unsigned long start, unsigned long end);
35EXPORT_SYMBOL_GPL(local_flush_icache_range); 35EXPORT_SYMBOL_GPL(local_flush_icache_range);
36void (*__flush_icache_user_range)(unsigned long start, unsigned long end);
37EXPORT_SYMBOL_GPL(__flush_icache_user_range);
38void (*__local_flush_icache_user_range)(unsigned long start, unsigned long end);
39EXPORT_SYMBOL_GPL(__local_flush_icache_user_range);
36 40
37void (*__flush_cache_vmap)(void); 41void (*__flush_cache_vmap)(void);
38void (*__flush_cache_vunmap)(void); 42void (*__flush_cache_vunmap)(void);
@@ -74,7 +78,7 @@ SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes,
74 if (!access_ok(VERIFY_WRITE, (void __user *) addr, bytes)) 78 if (!access_ok(VERIFY_WRITE, (void __user *) addr, bytes))
75 return -EFAULT; 79 return -EFAULT;
76 80
77 flush_icache_range(addr, addr + bytes); 81 __flush_icache_user_range(addr, addr + bytes);
78 82
79 return 0; 83 return 0;
80} 84}
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index b2eadd6fa9a1..46d5696c4f27 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -11,7 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/module.h> 14#include <linux/export.h>
15#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/gfp.h> 17#include <linux/gfp.h>
@@ -24,14 +24,15 @@
24 24
25#include <dma-coherence.h> 25#include <dma-coherence.h>
26 26
27#ifdef CONFIG_DMA_MAYBE_COHERENT 27#if defined(CONFIG_DMA_MAYBE_COHERENT) && !defined(CONFIG_DMA_PERDEV_COHERENT)
28int coherentio = 0; /* User defined DMA coherency from command line. */ 28/* User defined DMA coherency from command line. */
29enum coherent_io_user_state coherentio = IO_COHERENCE_DEFAULT;
29EXPORT_SYMBOL_GPL(coherentio); 30EXPORT_SYMBOL_GPL(coherentio);
30int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */ 31int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */
31 32
32static int __init setcoherentio(char *str) 33static int __init setcoherentio(char *str)
33{ 34{
34 coherentio = 1; 35 coherentio = IO_COHERENCE_ENABLED;
35 pr_info("Hardware DMA cache coherency (command line)\n"); 36 pr_info("Hardware DMA cache coherency (command line)\n");
36 return 0; 37 return 0;
37} 38}
@@ -39,7 +40,7 @@ early_param("coherentio", setcoherentio);
39 40
40static int __init setnocoherentio(char *str) 41static int __init setnocoherentio(char *str)
41{ 42{
42 coherentio = 0; 43 coherentio = IO_COHERENCE_DISABLED;
43 pr_info("Software DMA cache coherency (command line)\n"); 44 pr_info("Software DMA cache coherency (command line)\n");
44 return 0; 45 return 0;
45} 46}
@@ -160,8 +161,7 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
160 *dma_handle = plat_map_dma_mem(dev, ret, size); 161 *dma_handle = plat_map_dma_mem(dev, ret, size);
161 if (!plat_device_is_coherent(dev)) { 162 if (!plat_device_is_coherent(dev)) {
162 dma_cache_wback_inv((unsigned long) ret, size); 163 dma_cache_wback_inv((unsigned long) ret, size);
163 if (!hw_coherentio) 164 ret = UNCAC_ADDR(ret);
164 ret = UNCAC_ADDR(ret);
165 } 165 }
166 166
167 return ret; 167 return ret;
@@ -189,7 +189,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
189 189
190 plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL); 190 plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL);
191 191
192 if (!plat_device_is_coherent(dev) && !hw_coherentio) 192 if (!plat_device_is_coherent(dev))
193 addr = CAC_ADDR(addr); 193 addr = CAC_ADDR(addr);
194 194
195 page = virt_to_page((void *) addr); 195 page = virt_to_page((void *) addr);
@@ -209,7 +209,7 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma,
209 unsigned long pfn; 209 unsigned long pfn;
210 int ret = -ENXIO; 210 int ret = -ENXIO;
211 211
212 if (!plat_device_is_coherent(dev) && !hw_coherentio) 212 if (!plat_device_is_coherent(dev))
213 addr = CAC_ADDR(addr); 213 addr = CAC_ADDR(addr);
214 214
215 pfn = page_to_pfn(virt_to_page((void *)addr)); 215 pfn = page_to_pfn(virt_to_page((void *)addr));
diff --git a/arch/mips/mm/extable.c b/arch/mips/mm/extable.c
index 9d25d2ba4b9e..e474fa2efed4 100644
--- a/arch/mips/mm/extable.c
+++ b/arch/mips/mm/extable.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 1997, 99, 2001 - 2004 Ralf Baechle <ralf@linux-mips.org> 6 * Copyright (C) 1997, 99, 2001 - 2004 Ralf Baechle <ralf@linux-mips.org>
7 */ 7 */
8#include <linux/module.h> 8#include <linux/extable.h>
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <asm/branch.h> 10#include <asm/branch.h>
11#include <asm/uaccess.h> 11#include <asm/uaccess.h>
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 9560ad731120..d56a855828c2 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -18,7 +18,6 @@
18#include <linux/mman.h> 18#include <linux/mman.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
21#include <linux/module.h>
22#include <linux/kprobes.h> 21#include <linux/kprobes.h>
23#include <linux/perf_event.h> 22#include <linux/perf_event.h>
24#include <linux/uaccess.h> 23#include <linux/uaccess.h>
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index d7258a103439..f13f51003bd8 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -1,5 +1,6 @@
1#include <linux/compiler.h> 1#include <linux/compiler.h>
2#include <linux/module.h> 2#include <linux/init.h>
3#include <linux/export.h>
3#include <linux/highmem.h> 4#include <linux/highmem.h>
4#include <linux/sched.h> 5#include <linux/sched.h>
5#include <linux/smp.h> 6#include <linux/smp.h>
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 72f7478ee068..3a6edecc3f38 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -10,7 +10,7 @@
10 */ 10 */
11#include <linux/bug.h> 11#include <linux/bug.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/module.h> 13#include <linux/export.h>
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/smp.h> 16#include <linux/smp.h>
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
index 8d5008cbdc0f..1f189627440f 100644
--- a/arch/mips/mm/ioremap.c
+++ b/arch/mips/mm/ioremap.c
@@ -6,7 +6,7 @@
6 * (C) Copyright 1995 1996 Linus Torvalds 6 * (C) Copyright 1995 1996 Linus Torvalds
7 * (C) Copyright 2001, 2002 Ralf Baechle 7 * (C) Copyright 2001, 2002 Ralf Baechle
8 */ 8 */
9#include <linux/module.h> 9#include <linux/export.h>
10#include <asm/addrspace.h> 10#include <asm/addrspace.h>
11#include <asm/byteorder.h> 11#include <asm/byteorder.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 353037699512..d08ea3ff0f53 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -10,7 +10,7 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/mman.h> 12#include <linux/mman.h>
13#include <linux/module.h> 13#include <linux/export.h>
14#include <linux/personality.h> 14#include <linux/personality.h>
15#include <linux/random.h> 15#include <linux/random.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index c41953ca6605..6f804f5960ab 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -12,7 +12,6 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/module.h>
16#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
17 16
18#include <asm/bugs.h> 17#include <asm/bugs.h>
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index e8b335c16295..bba9c1484b41 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -14,7 +14,7 @@
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/hugetlb.h> 16#include <linux/hugetlb.h>
17#include <linux/module.h> 17#include <linux/export.h>
18 18
19#include <asm/cpu.h> 19#include <asm/cpu.h>
20#include <asm/cpu-type.h> 20#include <asm/cpu-type.h>
@@ -67,8 +67,11 @@ void local_flush_tlb_all(void)
67 67
68 entry = read_c0_wired(); 68 entry = read_c0_wired();
69 69
70 /* Blast 'em all away. */ 70 /*
71 if (cpu_has_tlbinv) { 71 * Blast 'em all away.
72 * If there are any wired entries, fall back to iterating
73 */
74 if (cpu_has_tlbinv && !entry) {
72 if (current_cpu_data.tlbsizevtlb) { 75 if (current_cpu_data.tlbsizevtlb) {
73 write_c0_index(0); 76 write_c0_index(0);
74 mtc0_tlbw_hazard(); 77 mtc0_tlbw_hazard();
diff --git a/arch/mips/mti-malta/malta-dt.c b/arch/mips/mti-malta/malta-dt.c
index 47a22889285f..4822943100f3 100644
--- a/arch/mips/mti-malta/malta-dt.c
+++ b/arch/mips/mti-malta/malta-dt.c
@@ -17,18 +17,3 @@ void __init device_tree_init(void)
17{ 17{
18 unflatten_and_copy_device_tree(); 18 unflatten_and_copy_device_tree();
19} 19}
20
21static const struct of_device_id bus_ids[] __initconst = {
22 { .compatible = "simple-bus", },
23 { .compatible = "isa", },
24 {},
25};
26
27static int __init publish_devices(void)
28{
29 if (!of_have_populated_dt())
30 return 0;
31
32 return of_platform_bus_probe(NULL, bus_ids, NULL);
33}
34device_initcall(publish_devices);
diff --git a/arch/mips/mti-malta/malta-dtshim.c b/arch/mips/mti-malta/malta-dtshim.c
index 151f4882ec8a..c398582c316f 100644
--- a/arch/mips/mti-malta/malta-dtshim.c
+++ b/arch/mips/mti-malta/malta-dtshim.c
@@ -13,18 +13,66 @@
13#include <linux/libfdt.h> 13#include <linux/libfdt.h>
14#include <linux/of_fdt.h> 14#include <linux/of_fdt.h>
15#include <linux/sizes.h> 15#include <linux/sizes.h>
16#include <asm/addrspace.h>
16#include <asm/bootinfo.h> 17#include <asm/bootinfo.h>
17#include <asm/fw/fw.h> 18#include <asm/fw/fw.h>
19#include <asm/mips-boards/generic.h>
20#include <asm/mips-boards/malta.h>
21#include <asm/mips-cm.h>
18#include <asm/page.h> 22#include <asm/page.h>
19 23
24#define ROCIT_REG_BASE 0x1f403000
25#define ROCIT_CONFIG_GEN1 (ROCIT_REG_BASE + 0x04)
26#define ROCIT_CONFIG_GEN1_MEMMAP_SHIFT 8
27#define ROCIT_CONFIG_GEN1_MEMMAP_MASK (0xf << 8)
28
20static unsigned char fdt_buf[16 << 10] __initdata; 29static unsigned char fdt_buf[16 << 10] __initdata;
21 30
22/* determined physical memory size, not overridden by command line args */ 31/* determined physical memory size, not overridden by command line args */
23extern unsigned long physical_memsize; 32extern unsigned long physical_memsize;
24 33
25#define MAX_MEM_ARRAY_ENTRIES 1 34enum mem_map {
35 MEM_MAP_V1 = 0,
36 MEM_MAP_V2,
37};
38
39#define MAX_MEM_ARRAY_ENTRIES 2
26 40
27static unsigned __init gen_fdt_mem_array(__be32 *mem_array, unsigned long size) 41static __init int malta_scon(void)
42{
43 int scon = MIPS_REVISION_SCONID;
44
45 if (scon != MIPS_REVISION_SCON_OTHER)
46 return scon;
47
48 switch (MIPS_REVISION_CORID) {
49 case MIPS_REVISION_CORID_QED_RM5261:
50 case MIPS_REVISION_CORID_CORE_LV:
51 case MIPS_REVISION_CORID_CORE_FPGA:
52 case MIPS_REVISION_CORID_CORE_FPGAR2:
53 return MIPS_REVISION_SCON_GT64120;
54
55 case MIPS_REVISION_CORID_CORE_EMUL_BON:
56 case MIPS_REVISION_CORID_BONITO64:
57 case MIPS_REVISION_CORID_CORE_20K:
58 return MIPS_REVISION_SCON_BONITO;
59
60 case MIPS_REVISION_CORID_CORE_MSC:
61 case MIPS_REVISION_CORID_CORE_FPGA2:
62 case MIPS_REVISION_CORID_CORE_24K:
63 return MIPS_REVISION_SCON_SOCIT;
64
65 case MIPS_REVISION_CORID_CORE_FPGA3:
66 case MIPS_REVISION_CORID_CORE_FPGA4:
67 case MIPS_REVISION_CORID_CORE_FPGA5:
68 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
69 default:
70 return MIPS_REVISION_SCON_ROCIT;
71 }
72}
73
74static unsigned __init gen_fdt_mem_array(__be32 *mem_array, unsigned long size,
75 enum mem_map map)
28{ 76{
29 unsigned long size_preio; 77 unsigned long size_preio;
30 unsigned entries; 78 unsigned entries;
@@ -39,11 +87,47 @@ static unsigned __init gen_fdt_mem_array(__be32 *mem_array, unsigned long size)
39 * DDR but limits it to 2GB. 87 * DDR but limits it to 2GB.
40 */ 88 */
41 mem_array[1] = cpu_to_be32(size); 89 mem_array[1] = cpu_to_be32(size);
90 goto done;
91 }
92
93 size_preio = min_t(unsigned long, size, SZ_256M);
94 mem_array[1] = cpu_to_be32(size_preio);
95 size -= size_preio;
96 if (!size)
97 goto done;
98
99 if (map == MEM_MAP_V2) {
100 /*
101 * We have a flat 32 bit physical memory map with DDR filling
102 * all 4GB of the memory map, apart from the I/O region which
103 * obscures 256MB from 0x10000000-0x1fffffff.
104 *
105 * Therefore we discard the 256MB behind the I/O region.
106 */
107 if (size <= SZ_256M)
108 goto done;
109 size -= SZ_256M;
110
111 /* Make use of the memory following the I/O region */
112 entries++;
113 mem_array[2] = cpu_to_be32(PHYS_OFFSET + SZ_512M);
114 mem_array[3] = cpu_to_be32(size);
42 } else { 115 } else {
43 size_preio = min_t(unsigned long, size, SZ_256M); 116 /*
44 mem_array[1] = cpu_to_be32(size_preio); 117 * We have a 32 bit physical memory map with a 2GB DDR region
118 * aliased in the upper & lower halves of it. The I/O region
119 * obscures 256MB from 0x10000000-0x1fffffff in the low alias
120 * but the DDR it obscures is accessible via the high alias.
121 *
122 * Simply access everything beyond the lowest 256MB of DDR using
123 * the high alias.
124 */
125 entries++;
126 mem_array[2] = cpu_to_be32(PHYS_OFFSET + SZ_2G + SZ_256M);
127 mem_array[3] = cpu_to_be32(size);
45 } 128 }
46 129
130done:
47 BUG_ON(entries > MAX_MEM_ARRAY_ENTRIES); 131 BUG_ON(entries > MAX_MEM_ARRAY_ENTRIES);
48 return entries; 132 return entries;
49} 133}
@@ -54,6 +138,8 @@ static void __init append_memory(void *fdt, int root_off)
54 unsigned long memsize; 138 unsigned long memsize;
55 unsigned mem_entries; 139 unsigned mem_entries;
56 int i, err, mem_off; 140 int i, err, mem_off;
141 enum mem_map mem_map;
142 u32 config;
57 char *var, param_name[10], *var_names[] = { 143 char *var, param_name[10], *var_names[] = {
58 "ememsize", "memsize", 144 "ememsize", "memsize",
59 }; 145 };
@@ -106,6 +192,20 @@ static void __init append_memory(void *fdt, int root_off)
106 /* if the user says there's more RAM than we thought, believe them */ 192 /* if the user says there's more RAM than we thought, believe them */
107 physical_memsize = max_t(unsigned long, physical_memsize, memsize); 193 physical_memsize = max_t(unsigned long, physical_memsize, memsize);
108 194
195 /* detect the memory map in use */
196 if (malta_scon() == MIPS_REVISION_SCON_ROCIT) {
197 /* ROCit has a register indicating the memory map in use */
198 config = readl((void __iomem *)CKSEG1ADDR(ROCIT_CONFIG_GEN1));
199 mem_map = config & ROCIT_CONFIG_GEN1_MEMMAP_MASK;
200 mem_map >>= ROCIT_CONFIG_GEN1_MEMMAP_SHIFT;
201 } else {
202 /* if not using ROCit, presume the v1 memory map */
203 mem_map = MEM_MAP_V1;
204 }
205 if (mem_map > MEM_MAP_V2)
206 panic("Unsupported physical memory map v%u detected",
207 (unsigned int)mem_map);
208
109 /* append memory to the DT */ 209 /* append memory to the DT */
110 mem_off = fdt_add_subnode(fdt, root_off, "memory"); 210 mem_off = fdt_add_subnode(fdt, root_off, "memory");
111 if (mem_off < 0) 211 if (mem_off < 0)
@@ -115,19 +215,93 @@ static void __init append_memory(void *fdt, int root_off)
115 if (err) 215 if (err)
116 panic("Unable to set memory node device_type: %d", err); 216 panic("Unable to set memory node device_type: %d", err);
117 217
118 mem_entries = gen_fdt_mem_array(mem_array, physical_memsize); 218 mem_entries = gen_fdt_mem_array(mem_array, physical_memsize, mem_map);
119 err = fdt_setprop(fdt, mem_off, "reg", mem_array, 219 err = fdt_setprop(fdt, mem_off, "reg", mem_array,
120 mem_entries * 2 * sizeof(mem_array[0])); 220 mem_entries * 2 * sizeof(mem_array[0]));
121 if (err) 221 if (err)
122 panic("Unable to set memory regs property: %d", err); 222 panic("Unable to set memory regs property: %d", err);
123 223
124 mem_entries = gen_fdt_mem_array(mem_array, memsize); 224 mem_entries = gen_fdt_mem_array(mem_array, memsize, mem_map);
125 err = fdt_setprop(fdt, mem_off, "linux,usable-memory", mem_array, 225 err = fdt_setprop(fdt, mem_off, "linux,usable-memory", mem_array,
126 mem_entries * 2 * sizeof(mem_array[0])); 226 mem_entries * 2 * sizeof(mem_array[0]));
127 if (err) 227 if (err)
128 panic("Unable to set linux,usable-memory property: %d", err); 228 panic("Unable to set linux,usable-memory property: %d", err);
129} 229}
130 230
231static void __init remove_gic(void *fdt)
232{
233 int err, gic_off, i8259_off, cpu_off;
234 void __iomem *biu_base;
235 uint32_t cpu_phandle, sc_cfg;
236
237 /* if we have a CM which reports a GIC is present, leave the DT alone */
238 err = mips_cm_probe();
239 if (!err && (read_gcr_gic_status() & CM_GCR_GIC_STATUS_GICEX_MSK))
240 return;
241
242 if (malta_scon() == MIPS_REVISION_SCON_ROCIT) {
243 /*
244 * On systems using the RocIT system controller a GIC may be
245 * present without a CM. Detect whether that is the case.
246 */
247 biu_base = ioremap_nocache(MSC01_BIU_REG_BASE,
248 MSC01_BIU_ADDRSPACE_SZ);
249 sc_cfg = __raw_readl(biu_base + MSC01_SC_CFG_OFS);
250 if (sc_cfg & MSC01_SC_CFG_GICPRES_MSK) {
251 /* enable the GIC at the system controller level */
252 sc_cfg |= BIT(MSC01_SC_CFG_GICENA_SHF);
253 __raw_writel(sc_cfg, biu_base + MSC01_SC_CFG_OFS);
254 return;
255 }
256 }
257
258 gic_off = fdt_node_offset_by_compatible(fdt, -1, "mti,gic");
259 if (gic_off < 0) {
260 pr_warn("malta-dtshim: unable to find DT GIC node: %d\n",
261 gic_off);
262 return;
263 }
264
265 err = fdt_nop_node(fdt, gic_off);
266 if (err)
267 pr_warn("malta-dtshim: unable to nop GIC node\n");
268
269 i8259_off = fdt_node_offset_by_compatible(fdt, -1, "intel,i8259");
270 if (i8259_off < 0) {
271 pr_warn("malta-dtshim: unable to find DT i8259 node: %d\n",
272 i8259_off);
273 return;
274 }
275
276 cpu_off = fdt_node_offset_by_compatible(fdt, -1,
277 "mti,cpu-interrupt-controller");
278 if (cpu_off < 0) {
279 pr_warn("malta-dtshim: unable to find CPU intc node: %d\n",
280 cpu_off);
281 return;
282 }
283
284 cpu_phandle = fdt_get_phandle(fdt, cpu_off);
285 if (!cpu_phandle) {
286 pr_warn("malta-dtshim: unable to get CPU intc phandle\n");
287 return;
288 }
289
290 err = fdt_setprop_u32(fdt, i8259_off, "interrupt-parent", cpu_phandle);
291 if (err) {
292 pr_warn("malta-dtshim: unable to set i8259 interrupt-parent: %d\n",
293 err);
294 return;
295 }
296
297 err = fdt_setprop_u32(fdt, i8259_off, "interrupts", 2);
298 if (err) {
299 pr_warn("malta-dtshim: unable to set i8259 interrupts: %d\n",
300 err);
301 return;
302 }
303}
304
131void __init *malta_dt_shim(void *fdt) 305void __init *malta_dt_shim(void *fdt)
132{ 306{
133 int root_off, len, err; 307 int root_off, len, err;
@@ -153,6 +327,7 @@ void __init *malta_dt_shim(void *fdt)
153 return fdt; 327 return fdt;
154 328
155 append_memory(fdt_buf, root_off); 329 append_memory(fdt_buf, root_off);
330 remove_gic(fdt_buf);
156 331
157 err = fdt_pack(fdt_buf); 332 err = fdt_pack(fdt_buf);
158 if (err) 333 if (err)
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index dc2c5214809d..0f3b881a3190 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/string.h> 15#include <linux/string.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/pci_regs.h>
17#include <linux/serial_core.h> 18#include <linux/serial_core.h>
18 19
19#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
@@ -242,23 +243,19 @@ mips_pci_controller:
242 MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_MEM_SHF | 243 MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_MEM_SHF |
243 MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_BAR0_SHF); 244 MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_BAR0_SHF);
244#endif 245#endif
245#ifndef CONFIG_EVA 246
246 /* Fix up target memory mapping. */
247 MSC_READ(MSC01_PCI_BAR0, mask);
248 MSC_WRITE(MSC01_PCI_P2SCMSKL, mask & MSC01_PCI_BAR0_SIZE_MSK);
249#else
250 /* 247 /*
251 * Setup the Malta max (2GB) memory for PCI DMA in host bridge 248 * Setup the Malta max (2GB) memory for PCI DMA in host bridge
252 * in transparent addressing mode, starting from 0x80000000. 249 * in transparent addressing mode.
253 */ 250 */
254 mask = PHYS_OFFSET | (1<<3); 251 mask = PHYS_OFFSET | PCI_BASE_ADDRESS_MEM_PREFETCH;
255 MSC_WRITE(MSC01_PCI_BAR0, mask); 252 MSC_WRITE(MSC01_PCI_BAR0, mask);
256
257 mask = PHYS_OFFSET;
258 MSC_WRITE(MSC01_PCI_HEAD4, mask); 253 MSC_WRITE(MSC01_PCI_HEAD4, mask);
254
255 mask &= MSC01_PCI_BAR0_SIZE_MSK;
259 MSC_WRITE(MSC01_PCI_P2SCMSKL, mask); 256 MSC_WRITE(MSC01_PCI_P2SCMSKL, mask);
260 MSC_WRITE(MSC01_PCI_P2SCMAPL, mask); 257 MSC_WRITE(MSC01_PCI_P2SCMAPL, mask);
261#endif 258
262 /* Don't handle target retries indefinitely. */ 259 /* Don't handle target retries indefinitely. */
263 if ((data & MSC01_PCI_CFG_MAXRTRY_MSK) == 260 if ((data & MSC01_PCI_CFG_MAXRTRY_MSK) ==
264 MSC01_PCI_CFG_MAXRTRY_MSK) 261 MSC01_PCI_CFG_MAXRTRY_MSK)
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index c6a6c7afddab..cb675ec6f283 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -14,11 +14,13 @@
14 */ 14 */
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/irqchip.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18#include <linux/smp.h> 19#include <linux/smp.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/io.h> 21#include <linux/io.h>
21#include <linux/irqchip/mips-gic.h> 22#include <linux/irqchip/mips-gic.h>
23#include <linux/of_irq.h>
22#include <linux/kernel_stat.h> 24#include <linux/kernel_stat.h>
23#include <linux/kernel.h> 25#include <linux/kernel.h>
24#include <linux/random.h> 26#include <linux/random.h>
@@ -37,10 +39,6 @@
37#include <asm/setup.h> 39#include <asm/setup.h>
38#include <asm/rtlx.h> 40#include <asm/rtlx.h>
39 41
40static void __iomem *_msc01_biu_base;
41
42static DEFINE_RAW_SPINLOCK(mips_irq_lock);
43
44static inline int mips_pcibios_iack(void) 42static inline int mips_pcibios_iack(void)
45{ 43{
46 int irq; 44 int irq;
@@ -85,49 +83,6 @@ static inline int mips_pcibios_iack(void)
85 return irq; 83 return irq;
86} 84}
87 85
88static inline int get_int(void)
89{
90 unsigned long flags;
91 int irq;
92 raw_spin_lock_irqsave(&mips_irq_lock, flags);
93
94 irq = mips_pcibios_iack();
95
96 /*
97 * The only way we can decide if an interrupt is spurious
98 * is by checking the 8259 registers. This needs a spinlock
99 * on an SMP system, so leave it up to the generic code...
100 */
101
102 raw_spin_unlock_irqrestore(&mips_irq_lock, flags);
103
104 return irq;
105}
106
107static void malta_hw0_irqdispatch(void)
108{
109 int irq;
110
111 irq = get_int();
112 if (irq < 0) {
113 /* interrupt has already been cleared */
114 return;
115 }
116
117 do_IRQ(MALTA_INT_BASE + irq);
118
119#ifdef CONFIG_MIPS_VPE_APSP_API_MT
120 if (aprp_hook)
121 aprp_hook();
122#endif
123}
124
125static irqreturn_t i8259_handler(int irq, void *dev_id)
126{
127 malta_hw0_irqdispatch();
128 return IRQ_HANDLED;
129}
130
131static void corehi_irqdispatch(void) 86static void corehi_irqdispatch(void)
132{ 87{
133 unsigned int intedge, intsteer, pcicmd, pcibadaddr; 88 unsigned int intedge, intsteer, pcicmd, pcibadaddr;
@@ -240,12 +195,6 @@ static struct irqaction irq_call = {
240}; 195};
241#endif /* CONFIG_MIPS_MT_SMP */ 196#endif /* CONFIG_MIPS_MT_SMP */
242 197
243static struct irqaction i8259irq = {
244 .handler = i8259_handler,
245 .name = "XT-PIC cascade",
246 .flags = IRQF_NO_THREAD,
247};
248
249static struct irqaction corehi_irqaction = { 198static struct irqaction corehi_irqaction = {
250 .handler = corehi_handler, 199 .handler = corehi_handler,
251 .name = "CoreHi", 200 .name = "CoreHi",
@@ -281,28 +230,10 @@ void __init arch_init_ipiirq(int irq, struct irqaction *action)
281 230
282void __init arch_init_irq(void) 231void __init arch_init_irq(void)
283{ 232{
284 int corehi_irq, i8259_irq; 233 int corehi_irq;
285
286 init_i8259_irqs();
287 234
288 if (!cpu_has_veic) 235 i8259_set_poll(mips_pcibios_iack);
289 mips_cpu_irq_init(); 236 irqchip_init();
290
291 if (mips_cm_present()) {
292 write_gcr_gic_base(GIC_BASE_ADDR | CM_GCR_GIC_BASE_GICEN_MSK);
293 gic_present = 1;
294 } else {
295 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) {
296 _msc01_biu_base = ioremap_nocache(MSC01_BIU_REG_BASE,
297 MSC01_BIU_ADDRSPACE_SZ);
298 gic_present =
299 (__raw_readl(_msc01_biu_base + MSC01_SC_CFG_OFS) &
300 MSC01_SC_CFG_GICPRES_MSK) >>
301 MSC01_SC_CFG_GICPRES_SHF;
302 }
303 }
304 if (gic_present)
305 pr_debug("GIC present\n");
306 237
307 switch (mips_revision_sconid) { 238 switch (mips_revision_sconid) {
308 case MIPS_REVISION_SCON_SOCIT: 239 case MIPS_REVISION_SCON_SOCIT:
@@ -330,18 +261,6 @@ void __init arch_init_irq(void)
330 } 261 }
331 262
332 if (gic_present) { 263 if (gic_present) {
333 int i;
334
335 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, MIPSCPU_INT_GIC,
336 MIPS_GIC_IRQ_BASE);
337 if (!mips_cm_present()) {
338 /* Enable the GIC */
339 i = __raw_readl(_msc01_biu_base + MSC01_SC_CFG_OFS);
340 __raw_writel(i | (0x1 << MSC01_SC_CFG_GICENA_SHF),
341 _msc01_biu_base + MSC01_SC_CFG_OFS);
342 pr_debug("GIC Enabled\n");
343 }
344 i8259_irq = MIPS_GIC_IRQ_BASE + GIC_INT_I8259A;
345 corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI; 264 corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI;
346 } else { 265 } else {
347#if defined(CONFIG_MIPS_MT_SMP) 266#if defined(CONFIG_MIPS_MT_SMP)
@@ -361,33 +280,13 @@ void __init arch_init_irq(void)
361 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call); 280 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call);
362#endif 281#endif
363 if (cpu_has_veic) { 282 if (cpu_has_veic) {
364 set_vi_handler(MSC01E_INT_I8259A,
365 malta_hw0_irqdispatch);
366 set_vi_handler(MSC01E_INT_COREHI, 283 set_vi_handler(MSC01E_INT_COREHI,
367 corehi_irqdispatch); 284 corehi_irqdispatch);
368 i8259_irq = MSC01E_INT_BASE + MSC01E_INT_I8259A;
369 corehi_irq = MSC01E_INT_BASE + MSC01E_INT_COREHI; 285 corehi_irq = MSC01E_INT_BASE + MSC01E_INT_COREHI;
370 } else { 286 } else {
371 i8259_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_I8259A;
372 corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI; 287 corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI;
373 } 288 }
374 } 289 }
375 290
376 setup_irq(i8259_irq, &i8259irq);
377 setup_irq(corehi_irq, &corehi_irqaction); 291 setup_irq(corehi_irq, &corehi_irqaction);
378} 292}
379
380void malta_be_init(void)
381{
382 /* Could change CM error mask register. */
383}
384
385int malta_be_handler(struct pt_regs *regs, int is_fixup)
386{
387 /* This duplicates the handling in do_be which seems wrong */
388 int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
389
390 mips_cm_error_report();
391
392 return retval;
393}
diff --git a/arch/mips/mti-malta/malta-platform.c b/arch/mips/mti-malta/malta-platform.c
index e1dd1c1d3fde..516e1233d771 100644
--- a/arch/mips/mti-malta/malta-platform.c
+++ b/arch/mips/mti-malta/malta-platform.c
@@ -23,14 +23,10 @@
23 */ 23 */
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
26#include <linux/mc146818rtc.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include <linux/irq.h> 27#include <linux/irq.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mtd/physmap.h>
31#include <linux/platform_device.h> 28#include <linux/platform_device.h>
32#include <asm/mips-boards/maltaint.h> 29#include <asm/mips-boards/maltaint.h>
33#include <mtd/mtd-abi.h>
34 30
35#define SMC_PORT(base, int) \ 31#define SMC_PORT(base, int) \
36{ \ 32{ \
@@ -68,80 +64,13 @@ static struct platform_device malta_uart8250_device = {
68 }, 64 },
69}; 65};
70 66
71struct resource malta_rtc_resources[] = {
72 {
73 .start = RTC_PORT(0),
74 .end = RTC_PORT(7),
75 .flags = IORESOURCE_IO,
76 }, {
77 .start = RTC_IRQ,
78 .end = RTC_IRQ,
79 .flags = IORESOURCE_IRQ,
80 }
81};
82
83static struct platform_device malta_rtc_device = {
84 .name = "rtc_cmos",
85 .id = -1,
86 .resource = malta_rtc_resources,
87 .num_resources = ARRAY_SIZE(malta_rtc_resources),
88};
89
90static struct mtd_partition malta_mtd_partitions[] = {
91 {
92 .name = "YAMON",
93 .offset = 0x0,
94 .size = 0x100000,
95 .mask_flags = MTD_WRITEABLE
96 }, {
97 .name = "User FS",
98 .offset = 0x100000,
99 .size = 0x2e0000
100 }, {
101 .name = "Board Config",
102 .offset = 0x3e0000,
103 .size = 0x020000,
104 .mask_flags = MTD_WRITEABLE
105 }
106};
107
108static struct physmap_flash_data malta_flash_data = {
109 .width = 4,
110 .nr_parts = ARRAY_SIZE(malta_mtd_partitions),
111 .parts = malta_mtd_partitions
112};
113
114static struct resource malta_flash_resource = {
115 .start = 0x1e000000,
116 .end = 0x1e3fffff,
117 .flags = IORESOURCE_MEM
118};
119
120static struct platform_device malta_flash_device = {
121 .name = "physmap-flash",
122 .id = 0,
123 .dev = {
124 .platform_data = &malta_flash_data,
125 },
126 .num_resources = 1,
127 .resource = &malta_flash_resource,
128};
129
130static struct platform_device *malta_devices[] __initdata = { 67static struct platform_device *malta_devices[] __initdata = {
131 &malta_uart8250_device, 68 &malta_uart8250_device,
132 &malta_rtc_device,
133 &malta_flash_device,
134}; 69};
135 70
136static int __init malta_add_devices(void) 71static int __init malta_add_devices(void)
137{ 72{
138 int err; 73 return platform_add_devices(malta_devices, ARRAY_SIZE(malta_devices));
139
140 err = platform_add_devices(malta_devices, ARRAY_SIZE(malta_devices));
141 if (err)
142 return err;
143
144 return 0;
145} 74}
146 75
147device_initcall(malta_add_devices); 76device_initcall(malta_add_devices);
diff --git a/arch/mips/mti-malta/malta-reset.c b/arch/mips/mti-malta/malta-reset.c
index 2fd2cc2c5034..dd6f62ad4417 100644
--- a/arch/mips/mti-malta/malta-reset.c
+++ b/arch/mips/mti-malta/malta-reset.c
@@ -8,38 +8,21 @@
8 */ 8 */
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/pm.h> 10#include <linux/pm.h>
11#include <linux/reboot.h>
11 12
12#include <asm/reboot.h> 13#include <asm/reboot.h>
13#include <asm/mach-malta/malta-pm.h> 14#include <asm/mach-malta/malta-pm.h>
14 15
15#define SOFTRES_REG 0x1f000500
16#define GORESET 0x42
17
18static void mips_machine_restart(char *command)
19{
20 unsigned int __iomem *softres_reg =
21 ioremap(SOFTRES_REG, sizeof(unsigned int));
22
23 __raw_writel(GORESET, softres_reg);
24}
25
26static void mips_machine_halt(void)
27{
28 while (true);
29}
30
31static void mips_machine_power_off(void) 16static void mips_machine_power_off(void)
32{ 17{
33 mips_pm_suspend(PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_SOFF); 18 mips_pm_suspend(PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_SOFF);
34 19
35 pr_info("Failed to power down, resetting\n"); 20 pr_info("Failed to power down, resetting\n");
36 mips_machine_restart(NULL); 21 machine_restart(NULL);
37} 22}
38 23
39static int __init mips_reboot_setup(void) 24static int __init mips_reboot_setup(void)
40{ 25{
41 _machine_restart = mips_machine_restart;
42 _machine_halt = mips_machine_halt;
43 pm_power_off = mips_machine_power_off; 26 pm_power_off = mips_machine_power_off;
44 27
45 return 0; 28 return 0;
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index 7e7364b0501e..a01d5debfcaf 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -42,9 +42,6 @@
42#define ROCIT_CONFIG_GEN0 0x1f403000 42#define ROCIT_CONFIG_GEN0 0x1f403000
43#define ROCIT_CONFIG_GEN0_PCI_IOCU BIT(7) 43#define ROCIT_CONFIG_GEN0_PCI_IOCU BIT(7)
44 44
45extern void malta_be_init(void);
46extern int malta_be_handler(struct pt_regs *regs, int is_fixup);
47
48static struct resource standard_io_resources[] = { 45static struct resource standard_io_resources[] = {
49 { 46 {
50 .name = "dma1", 47 .name = "dma1",
@@ -154,12 +151,12 @@ static void __init plat_setup_iocoherency(void)
154 * coherency instead. 151 * coherency instead.
155 */ 152 */
156 if (plat_enable_iocoherency()) { 153 if (plat_enable_iocoherency()) {
157 if (coherentio == 0) 154 if (coherentio == IO_COHERENCE_DISABLED)
158 pr_info("Hardware DMA cache coherency disabled\n"); 155 pr_info("Hardware DMA cache coherency disabled\n");
159 else 156 else
160 pr_info("Hardware DMA cache coherency enabled\n"); 157 pr_info("Hardware DMA cache coherency enabled\n");
161 } else { 158 } else {
162 if (coherentio == 1) 159 if (coherentio == IO_COHERENCE_ENABLED)
163 pr_info("Hardware DMA cache coherency unsupported, but enabled from command line!\n"); 160 pr_info("Hardware DMA cache coherency unsupported, but enabled from command line!\n");
164 else 161 else
165 pr_info("Software DMA cache coherency enabled\n"); 162 pr_info("Software DMA cache coherency enabled\n");
@@ -301,7 +298,4 @@ void __init plat_mem_setup(void)
301#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) 298#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
302 screen_info_setup(); 299 screen_info_setup();
303#endif 300#endif
304
305 board_be_init = malta_be_init;
306 board_be_handler = malta_be_handler;
307} 301}
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
deleted file mode 100644
index 7a584e0bf933..000000000000
--- a/arch/mips/mti-sead3/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
1#
2# Carsten Langgaard, carstenl@mips.com
3# Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4#
5# Copyright (C) 2008 Wind River Systems, Inc.
6# written by Ralf Baechle <ralf@linux-mips.org>
7#
8# Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved.
9# Steven J. Hill <sjhill@mips.com>
10#
11obj-y := sead3-lcd.o sead3-display.o sead3-init.o \
12 sead3-int.o sead3-platform.o sead3-reset.o \
13 sead3-setup.o sead3-time.o
14
15obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
diff --git a/arch/mips/mti-sead3/Platform b/arch/mips/mti-sead3/Platform
deleted file mode 100644
index 387092427145..000000000000
--- a/arch/mips/mti-sead3/Platform
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# MIPS SEAD-3 board
3#
4platform-$(CONFIG_MIPS_SEAD3) += mti-sead3/
5cflags-$(CONFIG_MIPS_SEAD3) += -I$(srctree)/arch/mips/include/asm/mach-sead3
6load-$(CONFIG_MIPS_SEAD3) += 0xffffffff80100000
7all-$(CONFIG_MIPS_SEAD3) := $(COMPRESSION_FNAME).srec
diff --git a/arch/mips/mti-sead3/sead3-console.c b/arch/mips/mti-sead3/sead3-console.c
deleted file mode 100644
index 031f47d69770..000000000000
--- a/arch/mips/mti-sead3/sead3-console.c
+++ /dev/null
@@ -1,46 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/init.h>
9#include <linux/console.h>
10#include <linux/serial_reg.h>
11#include <linux/io.h>
12
13#define SEAD_UART1_REGS_BASE 0xbf000800 /* ttyS1 = DB9 port */
14#define SEAD_UART0_REGS_BASE 0xbf000900 /* ttyS0 = USB port */
15#define PORT(base_addr, offset) ((unsigned int __iomem *)(base_addr+(offset)*4))
16
17static char console_port = 1;
18
19static inline unsigned int serial_in(int offset, unsigned int base_addr)
20{
21 return __raw_readl(PORT(base_addr, offset)) & 0xff;
22}
23
24static inline void serial_out(int offset, int value, unsigned int base_addr)
25{
26 __raw_writel(value, PORT(base_addr, offset));
27}
28
29void __init fw_init_early_console(char port)
30{
31 console_port = port;
32}
33
34int prom_putchar(char c)
35{
36 unsigned int base_addr;
37
38 base_addr = console_port ? SEAD_UART1_REGS_BASE : SEAD_UART0_REGS_BASE;
39
40 while ((serial_in(UART_LSR, base_addr) & UART_LSR_THRE) == 0)
41 ;
42
43 serial_out(UART_TX, c, base_addr);
44
45 return 1;
46}
diff --git a/arch/mips/mti-sead3/sead3-display.c b/arch/mips/mti-sead3/sead3-display.c
deleted file mode 100644
index 94875991907b..000000000000
--- a/arch/mips/mti-sead3/sead3-display.c
+++ /dev/null
@@ -1,77 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/timer.h>
9#include <linux/io.h>
10#include <asm/mips-boards/generic.h>
11
12static unsigned int display_count;
13static unsigned int max_display_count;
14
15#define LCD_DISPLAY_POS_BASE 0x1f000400
16#define DISPLAY_LCDINSTRUCTION (0*2)
17#define DISPLAY_LCDDATA (1*2)
18#define DISPLAY_CPLDSTATUS (2*2)
19#define DISPLAY_CPLDDATA (3*2)
20#define LCD_SETDDRAM 0x80
21#define LCD_IR_BF 0x80
22
23const char display_string[] = " LINUX ON SEAD3 ";
24
25static void scroll_display_message(unsigned long data);
26static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
27
28static void lcd_wait(unsigned int __iomem *display)
29{
30 /* Wait for CPLD state machine to become idle. */
31 do { } while (__raw_readl(display + DISPLAY_CPLDSTATUS) & 1);
32
33 do {
34 __raw_readl(display + DISPLAY_LCDINSTRUCTION);
35
36 /* Wait for CPLD state machine to become idle. */
37 do { } while (__raw_readl(display + DISPLAY_CPLDSTATUS) & 1);
38 } while (__raw_readl(display + DISPLAY_CPLDDATA) & LCD_IR_BF);
39}
40
41void mips_display_message(const char *str)
42{
43 static unsigned int __iomem *display;
44 char ch;
45 int i;
46
47 if (unlikely(display == NULL))
48 display = ioremap_nocache(LCD_DISPLAY_POS_BASE,
49 (8 * sizeof(int)));
50
51 for (i = 0; i < 16; i++) {
52 if (*str)
53 ch = *str++;
54 else
55 ch = ' ';
56 lcd_wait(display);
57 __raw_writel((LCD_SETDDRAM | i),
58 (display + DISPLAY_LCDINSTRUCTION));
59 lcd_wait(display);
60 __raw_writel(ch, display + DISPLAY_LCDDATA);
61 }
62}
63
64static void scroll_display_message(unsigned long data)
65{
66 mips_display_message(&display_string[display_count++]);
67 if (display_count == max_display_count)
68 display_count = 0;
69 mod_timer(&mips_scroll_timer, jiffies + HZ);
70}
71
72void mips_scroll_message(void)
73{
74 del_timer_sync(&mips_scroll_timer);
75 max_display_count = strlen(display_string) + 1 - 16;
76 mod_timer(&mips_scroll_timer, jiffies + 1);
77}
diff --git a/arch/mips/mti-sead3/sead3-init.c b/arch/mips/mti-sead3/sead3-init.c
deleted file mode 100644
index 3572ea30173e..000000000000
--- a/arch/mips/mti-sead3/sead3-init.c
+++ /dev/null
@@ -1,152 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/init.h>
9#include <linux/io.h>
10
11#include <asm/bootinfo.h>
12#include <asm/cacheflush.h>
13#include <asm/traps.h>
14#include <asm/mips-boards/generic.h>
15#include <asm/fw/fw.h>
16
17extern char except_vec_nmi;
18extern char except_vec_ejtag_debug;
19
20#ifdef CONFIG_SERIAL_8250_CONSOLE
21static void __init console_config(void)
22{
23 char console_string[40];
24 int baud = 0;
25 char parity = '\0', bits = '\0', flow = '\0';
26 char *s;
27
28 if ((strstr(fw_getcmdline(), "console=")) == NULL) {
29 s = fw_getenv("modetty0");
30 if (s) {
31 while (*s >= '0' && *s <= '9')
32 baud = baud*10 + *s++ - '0';
33 if (*s == ',')
34 s++;
35 if (*s)
36 parity = *s++;
37 if (*s == ',')
38 s++;
39 if (*s)
40 bits = *s++;
41 if (*s == ',')
42 s++;
43 if (*s == 'h')
44 flow = 'r';
45 }
46 if (baud == 0)
47 baud = 38400;
48 if (parity != 'n' && parity != 'o' && parity != 'e')
49 parity = 'n';
50 if (bits != '7' && bits != '8')
51 bits = '8';
52 if (flow == '\0')
53 flow = 'r';
54 sprintf(console_string, " console=ttyS0,%d%c%c%c", baud,
55 parity, bits, flow);
56 strcat(fw_getcmdline(), console_string);
57 }
58}
59#endif
60
61static void __init mips_nmi_setup(void)
62{
63 void *base;
64
65 base = cpu_has_veic ?
66 (void *)(CAC_BASE + 0xa80) :
67 (void *)(CAC_BASE + 0x380);
68#ifdef CONFIG_CPU_MICROMIPS
69 /*
70 * Decrement the exception vector address by one for microMIPS.
71 */
72 memcpy(base, (&except_vec_nmi - 1), 0x80);
73
74 /*
75 * This is a hack. We do not know if the boot loader was built with
76 * microMIPS instructions or not. If it was not, the NMI exception
77 * code at 0x80000a80 will be taken in MIPS32 mode. The hand coded
78 * assembly below forces us into microMIPS mode if we are a pure
79 * microMIPS kernel. The assembly instructions are:
80 *
81 * 3C1A8000 lui k0,0x8000
82 * 375A0381 ori k0,k0,0x381
83 * 03400008 jr k0
84 * 00000000 nop
85 *
86 * The mode switch occurs by jumping to the unaligned exception
87 * vector address at 0x80000381 which would have been 0x80000380
88 * in MIPS32 mode. The jump to the unaligned address transitions
89 * us into microMIPS mode.
90 */
91 if (!cpu_has_veic) {
92 void *base2 = (void *)(CAC_BASE + 0xa80);
93 *((unsigned int *)base2) = 0x3c1a8000;
94 *((unsigned int *)base2 + 1) = 0x375a0381;
95 *((unsigned int *)base2 + 2) = 0x03400008;
96 *((unsigned int *)base2 + 3) = 0x00000000;
97 flush_icache_range((unsigned long)base2,
98 (unsigned long)base2 + 0x10);
99 }
100#else
101 memcpy(base, &except_vec_nmi, 0x80);
102#endif
103 flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
104}
105
106static void __init mips_ejtag_setup(void)
107{
108 void *base;
109
110 base = cpu_has_veic ?
111 (void *)(CAC_BASE + 0xa00) :
112 (void *)(CAC_BASE + 0x300);
113#ifdef CONFIG_CPU_MICROMIPS
114 /* Deja vu... */
115 memcpy(base, (&except_vec_ejtag_debug - 1), 0x80);
116 if (!cpu_has_veic) {
117 void *base2 = (void *)(CAC_BASE + 0xa00);
118 *((unsigned int *)base2) = 0x3c1a8000;
119 *((unsigned int *)base2 + 1) = 0x375a0301;
120 *((unsigned int *)base2 + 2) = 0x03400008;
121 *((unsigned int *)base2 + 3) = 0x00000000;
122 flush_icache_range((unsigned long)base2,
123 (unsigned long)base2 + 0x10);
124 }
125#else
126 memcpy(base, &except_vec_ejtag_debug, 0x80);
127#endif
128 flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
129}
130
131void __init prom_init(void)
132{
133 board_nmi_handler_setup = mips_nmi_setup;
134 board_ejtag_handler_setup = mips_ejtag_setup;
135
136 fw_init_cmdline();
137#ifdef CONFIG_EARLY_PRINTK
138 if ((strstr(fw_getcmdline(), "console=ttyS0")) != NULL)
139 fw_init_early_console(0);
140 else if ((strstr(fw_getcmdline(), "console=ttyS1")) != NULL)
141 fw_init_early_console(1);
142#endif
143#ifdef CONFIG_SERIAL_8250_CONSOLE
144 if ((strstr(fw_getcmdline(), "console=")) == NULL)
145 strcat(fw_getcmdline(), " console=ttyS0,38400n8r");
146 console_config();
147#endif
148}
149
150void __init prom_free_prom_memory(void)
151{
152}
diff --git a/arch/mips/mti-sead3/sead3-int.c b/arch/mips/mti-sead3/sead3-int.c
deleted file mode 100644
index e31e17f81eef..000000000000
--- a/arch/mips/mti-sead3/sead3-int.c
+++ /dev/null
@@ -1,42 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/init.h>
9#include <linux/irq.h>
10#include <linux/irqchip/mips-gic.h>
11#include <linux/io.h>
12
13#include <asm/irq_cpu.h>
14#include <asm/setup.h>
15
16#include <asm/mips-boards/sead3int.h>
17
18#define SEAD_CONFIG_GIC_PRESENT_SHF 1
19#define SEAD_CONFIG_GIC_PRESENT_MSK (1 << SEAD_CONFIG_GIC_PRESENT_SHF)
20#define SEAD_CONFIG_BASE 0x1b100110
21#define SEAD_CONFIG_SIZE 4
22
23static void __iomem *sead3_config_reg;
24
25void __init arch_init_irq(void)
26{
27 if (!cpu_has_veic)
28 mips_cpu_irq_init();
29
30 sead3_config_reg = ioremap_nocache(SEAD_CONFIG_BASE, SEAD_CONFIG_SIZE);
31 gic_present = (__raw_readl(sead3_config_reg) &
32 SEAD_CONFIG_GIC_PRESENT_MSK) >>
33 SEAD_CONFIG_GIC_PRESENT_SHF;
34 pr_info("GIC: %spresent\n", (gic_present) ? "" : "not ");
35 pr_info("EIC: %s\n",
36 (current_cpu_data.options & MIPS_CPU_VEIC) ? "on" : "off");
37
38 if (gic_present)
39 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, CPU_INT_GIC,
40 MIPS_GIC_IRQ_BASE);
41}
42
diff --git a/arch/mips/mti-sead3/sead3-lcd.c b/arch/mips/mti-sead3/sead3-lcd.c
deleted file mode 100644
index 10b10ed21f77..000000000000
--- a/arch/mips/mti-sead3/sead3-lcd.c
+++ /dev/null
@@ -1,43 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/init.h>
9#include <linux/platform_device.h>
10
11static struct resource __initdata sead3_lcd_resource = {
12 .start = 0x1f000400,
13 .end = 0x1f00041f,
14 .flags = IORESOURCE_MEM,
15};
16
17static __init int sead3_lcd_add(void)
18{
19 struct platform_device *pdev;
20 int retval;
21
22 /* SEAD-3 and Cobalt platforms use same display type. */
23 pdev = platform_device_alloc("cobalt-lcd", -1);
24 if (!pdev)
25 return -ENOMEM;
26
27 retval = platform_device_add_resources(pdev, &sead3_lcd_resource, 1);
28 if (retval)
29 goto err_free_device;
30
31 retval = platform_device_add(pdev);
32 if (retval)
33 goto err_free_device;
34
35 return 0;
36
37err_free_device:
38 platform_device_put(pdev);
39
40 return retval;
41}
42
43device_initcall(sead3_lcd_add);
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
deleted file mode 100644
index 73b73efbfb05..000000000000
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ /dev/null
@@ -1,223 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/dma-mapping.h>
9#include <linux/init.h>
10#include <linux/irq.h>
11#include <linux/irqchip/mips-gic.h>
12#include <linux/leds.h>
13#include <linux/mtd/physmap.h>
14#include <linux/platform_device.h>
15#include <linux/serial_8250.h>
16#include <linux/smsc911x.h>
17
18#include <asm/mips-boards/sead3int.h>
19
20#define UART(base) \
21{ \
22 .mapbase = base, \
23 .irq = -1, \
24 .uartclk = 14745600, \
25 .iotype = UPIO_MEM32, \
26 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, \
27 .regshift = 2, \
28}
29
30static struct plat_serial8250_port uart8250_data[] = {
31 UART(0x1f000900), /* ttyS0 = USB */
32 UART(0x1f000800), /* ttyS1 = RS232 */
33 { },
34};
35
36static struct platform_device uart8250_device = {
37 .name = "serial8250",
38 .id = PLAT8250_DEV_PLATFORM2,
39 .dev = {
40 .platform_data = uart8250_data,
41 },
42};
43
44static struct smsc911x_platform_config sead3_smsc911x_data = {
45 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
46 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
47 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
48 .phy_interface = PHY_INTERFACE_MODE_MII,
49};
50
51static struct resource sead3_net_resources[] = {
52 {
53 .start = 0x1f010000,
54 .end = 0x1f01ffff,
55 .flags = IORESOURCE_MEM
56 }, {
57 .flags = IORESOURCE_IRQ
58 }
59};
60
61static struct platform_device sead3_net_device = {
62 .name = "smsc911x",
63 .id = 0,
64 .dev = {
65 .platform_data = &sead3_smsc911x_data,
66 },
67 .num_resources = ARRAY_SIZE(sead3_net_resources),
68 .resource = sead3_net_resources
69};
70
71static struct mtd_partition sead3_mtd_partitions[] = {
72 {
73 .name = "User FS",
74 .offset = 0x00000000,
75 .size = 0x01fc0000,
76 }, {
77 .name = "Board Config",
78 .offset = 0x01fc0000,
79 .size = 0x00040000,
80 .mask_flags = MTD_WRITEABLE
81 },
82};
83
84static struct physmap_flash_data sead3_flash_data = {
85 .width = 4,
86 .nr_parts = ARRAY_SIZE(sead3_mtd_partitions),
87 .parts = sead3_mtd_partitions
88};
89
90static struct resource sead3_flash_resource = {
91 .start = 0x1c000000,
92 .end = 0x1dffffff,
93 .flags = IORESOURCE_MEM
94};
95
96static struct platform_device sead3_flash = {
97 .name = "physmap-flash",
98 .id = 0,
99 .dev = {
100 .platform_data = &sead3_flash_data,
101 },
102 .num_resources = 1,
103 .resource = &sead3_flash_resource,
104};
105
106#define LEDFLAGS(bits, shift) \
107 ((bits << 8) | (shift << 8))
108
109#define LEDBITS(id, shift, bits) \
110 .name = id #shift, \
111 .flags = LEDFLAGS(bits, shift)
112
113static struct led_info led_data_info[] = {
114 { LEDBITS("bit", 0, 1) },
115 { LEDBITS("bit", 1, 1) },
116 { LEDBITS("bit", 2, 1) },
117 { LEDBITS("bit", 3, 1) },
118 { LEDBITS("bit", 4, 1) },
119 { LEDBITS("bit", 5, 1) },
120 { LEDBITS("bit", 6, 1) },
121 { LEDBITS("bit", 7, 1) },
122 { LEDBITS("all", 0, 8) },
123};
124
125static struct led_platform_data led_data = {
126 .num_leds = ARRAY_SIZE(led_data_info),
127 .leds = led_data_info
128};
129
130static struct resource pled_resources[] = {
131 {
132 .start = 0x1f000210,
133 .end = 0x1f000217,
134 .flags = IORESOURCE_MEM
135 }
136};
137
138static struct platform_device pled_device = {
139 .name = "sead3::pled",
140 .id = 0,
141 .dev = {
142 .platform_data = &led_data,
143 },
144 .num_resources = ARRAY_SIZE(pled_resources),
145 .resource = pled_resources
146};
147
148
149static struct resource fled_resources[] = {
150 {
151 .start = 0x1f000218,
152 .end = 0x1f00021f,
153 .flags = IORESOURCE_MEM
154 }
155};
156
157static struct platform_device fled_device = {
158 .name = "sead3::fled",
159 .id = 0,
160 .dev = {
161 .platform_data = &led_data,
162 },
163 .num_resources = ARRAY_SIZE(fled_resources),
164 .resource = fled_resources
165};
166
167static struct platform_device sead3_led_device = {
168 .name = "sead3-led",
169 .id = -1,
170};
171
172static struct resource ehci_resources[] = {
173 {
174 .start = 0x1b200000,
175 .end = 0x1b200fff,
176 .flags = IORESOURCE_MEM
177 }, {
178 .flags = IORESOURCE_IRQ
179 }
180};
181
182static u64 sead3_usbdev_dma_mask = DMA_BIT_MASK(32);
183
184static struct platform_device ehci_device = {
185 .name = "sead3-ehci",
186 .id = 0,
187 .dev = {
188 .dma_mask = &sead3_usbdev_dma_mask,
189 .coherent_dma_mask = DMA_BIT_MASK(32)
190 },
191 .num_resources = ARRAY_SIZE(ehci_resources),
192 .resource = ehci_resources
193};
194
195static struct platform_device *sead3_platform_devices[] __initdata = {
196 &uart8250_device,
197 &sead3_flash,
198 &pled_device,
199 &fled_device,
200 &sead3_led_device,
201 &ehci_device,
202 &sead3_net_device,
203};
204
205static int __init sead3_platforms_device_init(void)
206{
207 if (gic_present) {
208 uart8250_data[0].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART0;
209 uart8250_data[1].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART1;
210 ehci_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_EHCI;
211 sead3_net_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_NET;
212 } else {
213 uart8250_data[0].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART0;
214 uart8250_data[1].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART1;
215 ehci_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_EHCI;
216 sead3_net_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_NET;
217 }
218
219 return platform_add_devices(sead3_platform_devices,
220 ARRAY_SIZE(sead3_platform_devices));
221}
222
223device_initcall(sead3_platforms_device_init);
diff --git a/arch/mips/mti-sead3/sead3-reset.c b/arch/mips/mti-sead3/sead3-reset.c
deleted file mode 100644
index e6fb24414a70..000000000000
--- a/arch/mips/mti-sead3/sead3-reset.c
+++ /dev/null
@@ -1,40 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/io.h>
9#include <linux/pm.h>
10
11#include <asm/reboot.h>
12
13#define SOFTRES_REG 0x1f000050
14#define GORESET 0x4d
15
16static void mips_machine_restart(char *command)
17{
18 unsigned int __iomem *softres_reg =
19 ioremap(SOFTRES_REG, sizeof(unsigned int));
20
21 __raw_writel(GORESET, softres_reg);
22}
23
24static void mips_machine_halt(void)
25{
26 unsigned int __iomem *softres_reg =
27 ioremap(SOFTRES_REG, sizeof(unsigned int));
28
29 __raw_writel(GORESET, softres_reg);
30}
31
32static int __init mips_reboot_setup(void)
33{
34 _machine_restart = mips_machine_restart;
35 _machine_halt = mips_machine_halt;
36 pm_power_off = mips_machine_halt;
37
38 return 0;
39}
40arch_initcall(mips_reboot_setup);
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
deleted file mode 100644
index edfcaf06680d..000000000000
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ /dev/null
@@ -1,108 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
8 */
9#include <linux/init.h>
10#include <linux/libfdt.h>
11#include <linux/of_fdt.h>
12
13#include <asm/prom.h>
14#include <asm/fw/fw.h>
15
16#include <asm/mips-boards/generic.h>
17
18const char *get_system_type(void)
19{
20 return "MIPS SEAD3";
21}
22
23static uint32_t get_memsize_from_cmdline(void)
24{
25 int memsize = 0;
26 char *p = arcs_cmdline;
27 char *s = "memsize=";
28
29 p = strstr(p, s);
30 if (p) {
31 p += strlen(s);
32 memsize = memparse(p, NULL);
33 }
34
35 return memsize;
36}
37
38static uint32_t get_memsize_from_env(void)
39{
40 int memsize = 0;
41 char *p;
42
43 p = fw_getenv("memsize");
44 if (p)
45 memsize = memparse(p, NULL);
46
47 return memsize;
48}
49
50static uint32_t get_memsize(void)
51{
52 uint32_t memsize;
53
54 memsize = get_memsize_from_cmdline();
55 if (memsize)
56 return memsize;
57
58 return get_memsize_from_env();
59}
60
61static void __init parse_memsize_param(void)
62{
63 int offset;
64 const uint64_t *prop_value;
65 int prop_len;
66 uint32_t memsize = get_memsize();
67
68 if (!memsize)
69 return;
70
71 offset = fdt_path_offset(__dtb_start, "/memory");
72 if (offset > 0) {
73 uint64_t new_value;
74 /*
75 * reg contains 2 32-bits BE values, offset and size. We just
76 * want to replace the size value without affecting the offset
77 */
78 prop_value = fdt_getprop(__dtb_start, offset, "reg", &prop_len);
79 new_value = be64_to_cpu(*prop_value);
80 new_value = (new_value & ~0xffffffffllu) | memsize;
81 fdt_setprop_inplace_u64(__dtb_start, offset, "reg", new_value);
82 }
83}
84
85void __init *plat_get_fdt(void)
86{
87 return (void *)__dtb_start;
88}
89
90void __init plat_mem_setup(void)
91{
92 /* allow command line/bootloader env to override memory size in DT */
93 parse_memsize_param();
94
95 /*
96 * Load the builtin devicetree. This causes the chosen node to be
97 * parsed resulting in our memory appearing
98 */
99 __dt_setup_arch(__dtb_start);
100}
101
102void __init device_tree_init(void)
103{
104 if (!initial_boot_params)
105 return;
106
107 unflatten_and_copy_device_tree();
108}
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c
deleted file mode 100644
index a120b7a5a8fe..000000000000
--- a/arch/mips/mti-sead3/sead3-time.c
+++ /dev/null
@@ -1,99 +0,0 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/init.h>
9#include <linux/irqchip/mips-gic.h>
10
11#include <asm/cpu.h>
12#include <asm/setup.h>
13#include <asm/time.h>
14#include <asm/irq.h>
15#include <asm/mips-boards/generic.h>
16
17static void __iomem *status_reg = (void __iomem *)0xbf000410;
18
19/*
20 * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect.
21 */
22static unsigned int __init estimate_cpu_frequency(void)
23{
24 unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK);
25 unsigned int tick = 0;
26 unsigned int freq;
27 unsigned int orig;
28 unsigned long flags;
29
30 local_irq_save(flags);
31
32 orig = readl(status_reg) & 0x2; /* get original sample */
33 /* wait for transition */
34 while ((readl(status_reg) & 0x2) == orig)
35 ;
36 orig = orig ^ 0x2; /* flip the bit */
37
38 write_c0_count(0);
39
40 /* wait 1 second (the sampling clock transitions every 10ms) */
41 while (tick < 100) {
42 /* wait for transition */
43 while ((readl(status_reg) & 0x2) == orig)
44 ;
45 orig = orig ^ 0x2; /* flip the bit */
46 tick++;
47 }
48
49 freq = read_c0_count();
50
51 local_irq_restore(flags);
52
53 mips_hpt_frequency = freq;
54
55 /* Adjust for processor */
56 if ((prid != (PRID_COMP_MIPS | PRID_IMP_20KC)) &&
57 (prid != (PRID_COMP_MIPS | PRID_IMP_25KF)))
58 freq *= 2;
59
60 freq += 5000; /* rounding */
61 freq -= freq%10000;
62
63 return freq ;
64}
65
66void read_persistent_clock(struct timespec *ts)
67{
68 ts->tv_sec = 0;
69 ts->tv_nsec = 0;
70}
71
72int get_c0_perfcount_int(void)
73{
74 if (gic_present)
75 return gic_get_c0_perfcount_int();
76 if (cp0_perfcount_irq >= 0)
77 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
78 return -1;
79}
80EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
81
82unsigned int get_c0_compare_int(void)
83{
84 if (gic_present)
85 return gic_get_c0_compare_int();
86 return MIPS_CPU_IRQ_BASE + cp0_compare_irq;
87}
88
89void __init plat_time_init(void)
90{
91 unsigned int est_freq;
92
93 est_freq = estimate_cpu_frequency();
94
95 pr_debug("CPU frequency %d.%02d MHz\n", (est_freq / 1000000),
96 (est_freq % 1000000) * 100 / 1000000);
97
98 mips_scroll_message();
99}
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 139ad1d7ab5e..4b821481dd44 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -3,6 +3,8 @@
3# 3#
4 4
5obj-y += pci.o 5obj-y += pci.o
6obj-$(CONFIG_PCI_DRIVERS_LEGACY)+= pci-legacy.o
7obj-$(CONFIG_PCI_DRIVERS_GENERIC)+= pci-generic.o
6 8
7# 9#
8# PCI bus host bridge specific code 10# PCI bus host bridge specific code
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c
index c8994c156e2d..e99ca7702d8a 100644
--- a/arch/mips/pci/pci-alchemy.c
+++ b/arch/mips/pci/pci-alchemy.c
@@ -429,7 +429,8 @@ static int alchemy_pci_probe(struct platform_device *pdev)
429 429
430 /* Au1500 revisions older than AD have borked coherent PCI */ 430 /* Au1500 revisions older than AD have borked coherent PCI */
431 if ((alchemy_get_cputype() == ALCHEMY_CPU_AU1500) && 431 if ((alchemy_get_cputype() == ALCHEMY_CPU_AU1500) &&
432 (read_c0_prid() < 0x01030202) && !coherentio) { 432 (read_c0_prid() < 0x01030202) &&
433 (coherentio == IO_COHERENCE_DISABLED)) {
433 val = __raw_readl(ctx->regs + PCI_REG_CONFIG); 434 val = __raw_readl(ctx->regs + PCI_REG_CONFIG);
434 val |= PCI_CONFIG_NC; 435 val |= PCI_CONFIG_NC;
435 __raw_writel(val, ctx->regs + PCI_REG_CONFIG); 436 __raw_writel(val, ctx->regs + PCI_REG_CONFIG);
diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
index 7db963deec73..bdf87b43633f 100644
--- a/arch/mips/pci/pci-ar71xx.c
+++ b/arch/mips/pci/pci-ar71xx.c
@@ -18,7 +18,7 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/pci_regs.h> 19#include <linux/pci_regs.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/module.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23 23
24#include <asm/mach-ath79/ar71xx_regs.h> 24#include <asm/mach-ath79/ar71xx_regs.h>
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
index 2013dad700df..1e23c8d587bd 100644
--- a/arch/mips/pci/pci-ar724x.c
+++ b/arch/mips/pci/pci-ar724x.c
@@ -11,7 +11,7 @@
11 11
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/module.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <asm/mach-ath79/ath79.h> 16#include <asm/mach-ath79/ath79.h>
17#include <asm/mach-ath79/ar71xx_regs.h> 17#include <asm/mach-ath79/ar71xx_regs.h>
diff --git a/arch/mips/pci/pci-generic.c b/arch/mips/pci/pci-generic.c
new file mode 100644
index 000000000000..dce304dc3d62
--- /dev/null
+++ b/arch/mips/pci/pci-generic.c
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * pcibios_align_resource taken from arch/arm/kernel/bios32.c.
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; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/pci.h>
14
15/*
16 * We need to avoid collisions with `mirrored' VGA ports
17 * and other strange ISA hardware, so we always want the
18 * addresses to be allocated in the 0x000-0x0ff region
19 * modulo 0x400.
20 *
21 * Why? Because some silly external IO cards only decode
22 * the low 10 bits of the IO address. The 0x00-0xff region
23 * is reserved for motherboard devices that decode all 16
24 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
25 * but we want to try to avoid allocating at 0x2900-0x2bff
26 * which might have be mirrored at 0x0100-0x03ff..
27 */
28resource_size_t pcibios_align_resource(void *data, const struct resource *res,
29 resource_size_t size, resource_size_t align)
30{
31 struct pci_dev *dev = data;
32 resource_size_t start = res->start;
33 struct pci_host_bridge *host_bridge;
34
35 if (res->flags & IORESOURCE_IO && start & 0x300)
36 start = (start + 0x3ff) & ~0x3ff;
37
38 start = (start + align - 1) & ~(align - 1);
39
40 host_bridge = pci_find_host_bridge(dev->bus);
41
42 if (host_bridge->align_resource)
43 return host_bridge->align_resource(dev, res,
44 start, size, align);
45
46 return start;
47}
48
49void pcibios_fixup_bus(struct pci_bus *bus)
50{
51 pci_read_bridge_bases(bus);
52}
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index b9deab17ccf2..f18f887f481d 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -13,7 +13,6 @@
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/vmalloc.h> 15#include <linux/vmalloc.h>
16#include <linux/module.h>
17#include <linux/clk.h> 16#include <linux/clk.h>
18#include <linux/of_platform.h> 17#include <linux/of_platform.h>
19#include <linux/of_gpio.h> 18#include <linux/of_gpio.h>
@@ -234,7 +233,6 @@ static const struct of_device_id ltq_pci_match[] = {
234 { .compatible = "lantiq,pci-xway" }, 233 { .compatible = "lantiq,pci-xway" },
235 {}, 234 {},
236}; 235};
237MODULE_DEVICE_TABLE(of, ltq_pci_match);
238 236
239static struct platform_driver ltq_pci_driver = { 237static struct platform_driver ltq_pci_driver = {
240 .probe = ltq_pci_probe, 238 .probe = ltq_pci_probe,
diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c
new file mode 100644
index 000000000000..014649be158d
--- /dev/null
+++ b/arch/mips/pci/pci-legacy.c
@@ -0,0 +1,302 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * Copyright (C) 2003, 04, 11 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2011 Wind River Systems,
9 * written by Ralf Baechle (ralf@linux-mips.org)
10 */
11#include <linux/bug.h>
12#include <linux/kernel.h>
13#include <linux/mm.h>
14#include <linux/bootmem.h>
15#include <linux/export.h>
16#include <linux/init.h>
17#include <linux/types.h>
18#include <linux/pci.h>
19#include <linux/of_address.h>
20
21#include <asm/cpu-info.h>
22
23/*
24 * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource
25 * assignments.
26 */
27
28/*
29 * The PCI controller list.
30 */
31static LIST_HEAD(controllers);
32
33static int pci_initialized;
34
35/*
36 * We need to avoid collisions with `mirrored' VGA ports
37 * and other strange ISA hardware, so we always want the
38 * addresses to be allocated in the 0x000-0x0ff region
39 * modulo 0x400.
40 *
41 * Why? Because some silly external IO cards only decode
42 * the low 10 bits of the IO address. The 0x00-0xff region
43 * is reserved for motherboard devices that decode all 16
44 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
45 * but we want to try to avoid allocating at 0x2900-0x2bff
46 * which might have be mirrored at 0x0100-0x03ff..
47 */
48resource_size_t
49pcibios_align_resource(void *data, const struct resource *res,
50 resource_size_t size, resource_size_t align)
51{
52 struct pci_dev *dev = data;
53 struct pci_controller *hose = dev->sysdata;
54 resource_size_t start = res->start;
55
56 if (res->flags & IORESOURCE_IO) {
57 /* Make sure we start at our min on all hoses */
58 if (start < PCIBIOS_MIN_IO + hose->io_resource->start)
59 start = PCIBIOS_MIN_IO + hose->io_resource->start;
60
61 /*
62 * Put everything into 0x00-0xff region modulo 0x400
63 */
64 if (start & 0x300)
65 start = (start + 0x3ff) & ~0x3ff;
66 } else if (res->flags & IORESOURCE_MEM) {
67 /* Make sure we start at our min on all hoses */
68 if (start < PCIBIOS_MIN_MEM + hose->mem_resource->start)
69 start = PCIBIOS_MIN_MEM + hose->mem_resource->start;
70 }
71
72 return start;
73}
74
75static void pcibios_scanbus(struct pci_controller *hose)
76{
77 static int next_busno;
78 static int need_domain_info;
79 LIST_HEAD(resources);
80 struct pci_bus *bus;
81
82 if (hose->get_busno && pci_has_flag(PCI_PROBE_ONLY))
83 next_busno = (*hose->get_busno)();
84
85 pci_add_resource_offset(&resources,
86 hose->mem_resource, hose->mem_offset);
87 pci_add_resource_offset(&resources,
88 hose->io_resource, hose->io_offset);
89 pci_add_resource_offset(&resources,
90 hose->busn_resource, hose->busn_offset);
91 bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
92 &resources);
93 hose->bus = bus;
94
95 need_domain_info = need_domain_info || pci_domain_nr(bus);
96 set_pci_need_domain_info(hose, need_domain_info);
97
98 if (!bus) {
99 pci_free_resource_list(&resources);
100 return;
101 }
102
103 next_busno = bus->busn_res.end + 1;
104 /* Don't allow 8-bit bus number overflow inside the hose -
105 reserve some space for bridges. */
106 if (next_busno > 224) {
107 next_busno = 0;
108 need_domain_info = 1;
109 }
110
111 /*
112 * We insert PCI resources into the iomem_resource and
113 * ioport_resource trees in either pci_bus_claim_resources()
114 * or pci_bus_assign_resources().
115 */
116 if (pci_has_flag(PCI_PROBE_ONLY)) {
117 pci_bus_claim_resources(bus);
118 } else {
119 pci_bus_size_bridges(bus);
120 pci_bus_assign_resources(bus);
121 }
122 pci_bus_add_devices(bus);
123}
124
125#ifdef CONFIG_OF
126void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
127{
128 struct of_pci_range range;
129 struct of_pci_range_parser parser;
130
131 pr_info("PCI host bridge %s ranges:\n", node->full_name);
132 hose->of_node = node;
133
134 if (of_pci_range_parser_init(&parser, node))
135 return;
136
137 for_each_of_pci_range(&parser, &range) {
138 struct resource *res = NULL;
139
140 switch (range.flags & IORESOURCE_TYPE_BITS) {
141 case IORESOURCE_IO:
142 pr_info(" IO 0x%016llx..0x%016llx\n",
143 range.cpu_addr,
144 range.cpu_addr + range.size - 1);
145 hose->io_map_base =
146 (unsigned long)ioremap(range.cpu_addr,
147 range.size);
148 res = hose->io_resource;
149 break;
150 case IORESOURCE_MEM:
151 pr_info(" MEM 0x%016llx..0x%016llx\n",
152 range.cpu_addr,
153 range.cpu_addr + range.size - 1);
154 res = hose->mem_resource;
155 break;
156 }
157 if (res != NULL)
158 of_pci_range_to_resource(&range, node, res);
159 }
160}
161
162struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
163{
164 struct pci_controller *hose = bus->sysdata;
165
166 return of_node_get(hose->of_node);
167}
168#endif
169
170static DEFINE_MUTEX(pci_scan_mutex);
171
172void register_pci_controller(struct pci_controller *hose)
173{
174 struct resource *parent;
175
176 parent = hose->mem_resource->parent;
177 if (!parent)
178 parent = &iomem_resource;
179
180 if (request_resource(parent, hose->mem_resource) < 0)
181 goto out;
182
183 parent = hose->io_resource->parent;
184 if (!parent)
185 parent = &ioport_resource;
186
187 if (request_resource(parent, hose->io_resource) < 0) {
188 release_resource(hose->mem_resource);
189 goto out;
190 }
191
192 INIT_LIST_HEAD(&hose->list);
193 list_add(&hose->list, &controllers);
194
195 /*
196 * Do not panic here but later - this might happen before console init.
197 */
198 if (!hose->io_map_base) {
199 printk(KERN_WARNING
200 "registering PCI controller with io_map_base unset\n");
201 }
202
203 /*
204 * Scan the bus if it is register after the PCI subsystem
205 * initialization.
206 */
207 if (pci_initialized) {
208 mutex_lock(&pci_scan_mutex);
209 pcibios_scanbus(hose);
210 mutex_unlock(&pci_scan_mutex);
211 }
212
213 return;
214
215out:
216 printk(KERN_WARNING
217 "Skipping PCI bus scan due to resource conflict\n");
218}
219
220static int __init pcibios_init(void)
221{
222 struct pci_controller *hose;
223
224 /* Scan all of the recorded PCI controllers. */
225 list_for_each_entry(hose, &controllers, list)
226 pcibios_scanbus(hose);
227
228 pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
229
230 pci_initialized = 1;
231
232 return 0;
233}
234
235subsys_initcall(pcibios_init);
236
237static int pcibios_enable_resources(struct pci_dev *dev, int mask)
238{
239 u16 cmd, old_cmd;
240 int idx;
241 struct resource *r;
242
243 pci_read_config_word(dev, PCI_COMMAND, &cmd);
244 old_cmd = cmd;
245 for (idx=0; idx < PCI_NUM_RESOURCES; idx++) {
246 /* Only set up the requested stuff */
247 if (!(mask & (1<<idx)))
248 continue;
249
250 r = &dev->resource[idx];
251 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
252 continue;
253 if ((idx == PCI_ROM_RESOURCE) &&
254 (!(r->flags & IORESOURCE_ROM_ENABLE)))
255 continue;
256 if (!r->start && r->end) {
257 printk(KERN_ERR "PCI: Device %s not available "
258 "because of resource collisions\n",
259 pci_name(dev));
260 return -EINVAL;
261 }
262 if (r->flags & IORESOURCE_IO)
263 cmd |= PCI_COMMAND_IO;
264 if (r->flags & IORESOURCE_MEM)
265 cmd |= PCI_COMMAND_MEMORY;
266 }
267 if (cmd != old_cmd) {
268 printk("PCI: Enabling device %s (%04x -> %04x)\n",
269 pci_name(dev), old_cmd, cmd);
270 pci_write_config_word(dev, PCI_COMMAND, cmd);
271 }
272 return 0;
273}
274
275int pcibios_enable_device(struct pci_dev *dev, int mask)
276{
277 int err;
278
279 if ((err = pcibios_enable_resources(dev, mask)) < 0)
280 return err;
281
282 return pcibios_plat_dev_init(dev);
283}
284
285void pcibios_fixup_bus(struct pci_bus *bus)
286{
287 struct pci_dev *dev = bus->self;
288
289 if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
290 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
291 pci_read_bridge_bases(bus);
292 }
293}
294
295char * (*pcibios_plat_setup)(char *str) __initdata;
296
297char *__init pcibios_setup(char *str)
298{
299 if (pcibios_plat_setup)
300 return pcibios_plat_setup(str);
301 return str;
302}
diff --git a/arch/mips/pci/pci-mt7620.c b/arch/mips/pci/pci-mt7620.c
index 6ce816201699..628c5132b3d8 100644
--- a/arch/mips/pci/pci-mt7620.c
+++ b/arch/mips/pci/pci-mt7620.c
@@ -15,7 +15,6 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/module.h>
19#include <linux/of.h> 18#include <linux/of.h>
20#include <linux/of_irq.h> 19#include <linux/of_irq.h>
21#include <linux/of_pci.h> 20#include <linux/of_pci.h>
@@ -407,13 +406,11 @@ static const struct of_device_id mt7620_pci_ids[] = {
407 { .compatible = "mediatek,mt7620-pci" }, 406 { .compatible = "mediatek,mt7620-pci" },
408 {}, 407 {},
409}; 408};
410MODULE_DEVICE_TABLE(of, mt7620_pci_ids);
411 409
412static struct platform_driver mt7620_pci_driver = { 410static struct platform_driver mt7620_pci_driver = {
413 .probe = mt7620_pci_probe, 411 .probe = mt7620_pci_probe,
414 .driver = { 412 .driver = {
415 .name = "mt7620-pci", 413 .name = "mt7620-pci",
416 .owner = THIS_MODULE,
417 .of_match_table = of_match_ptr(mt7620_pci_ids), 414 .of_match_table = of_match_ptr(mt7620_pci_ids),
418 }, 415 },
419}; 416};
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c
index c258cd406fbb..308d051fc45c 100644
--- a/arch/mips/pci/pci-octeon.c
+++ b/arch/mips/pci/pci-octeon.c
@@ -204,6 +204,8 @@ const char *octeon_get_pci_interrupts(void)
204 * Interrupt Number (INTA# = 0, INTB# = 1, INTC# = 2, and 204 * Interrupt Number (INTA# = 0, INTB# = 1, INTC# = 2, and
205 * INTD# = 3) 205 * INTD# = 3)
206 */ 206 */
207 if (of_machine_is_compatible("dlink,dsr-500n"))
208 return "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC";
207 switch (octeon_bootinfo->board_type) { 209 switch (octeon_bootinfo->board_type) {
208 case CVMX_BOARD_TYPE_NAO38: 210 case CVMX_BOARD_TYPE_NAO38:
209 /* This is really the NAC38 */ 211 /* This is really the NAC38 */
diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c
index f2a1050168d9..d6360fe73d05 100644
--- a/arch/mips/pci/pci-rt2880.c
+++ b/arch/mips/pci/pci-rt2880.c
@@ -16,7 +16,6 @@
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/module.h>
20#include <linux/of_platform.h> 19#include <linux/of_platform.h>
21#include <linux/of_irq.h> 20#include <linux/of_irq.h>
22#include <linux/of_pci.h> 21#include <linux/of_pci.h>
@@ -260,7 +259,6 @@ static const struct of_device_id rt288x_pci_match[] = {
260 { .compatible = "ralink,rt288x-pci" }, 259 { .compatible = "ralink,rt288x-pci" },
261 {}, 260 {},
262}; 261};
263MODULE_DEVICE_TABLE(of, rt288x_pci_match);
264 262
265static struct platform_driver rt288x_pci_driver = { 263static struct platform_driver rt288x_pci_driver = {
266 .probe = rt288x_pci_probe, 264 .probe = rt288x_pci_probe,
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c
index 53a42b07008b..3520e9b414e7 100644
--- a/arch/mips/pci/pci-rt3883.c
+++ b/arch/mips/pci/pci-rt3883.c
@@ -16,7 +16,6 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/module.h>
20#include <linux/of.h> 19#include <linux/of.h>
21#include <linux/of_irq.h> 20#include <linux/of_irq.h>
22#include <linux/of_pci.h> 21#include <linux/of_pci.h>
@@ -580,7 +579,6 @@ static const struct of_device_id rt3883_pci_ids[] = {
580 { .compatible = "ralink,rt3883-pci" }, 579 { .compatible = "ralink,rt3883-pci" },
581 {}, 580 {},
582}; 581};
583MODULE_DEVICE_TABLE(of, rt3883_pci_ids);
584 582
585static struct platform_driver rt3883_pci_driver = { 583static struct platform_driver rt3883_pci_driver = {
586 .probe = rt3883_pci_probe, 584 .probe = rt3883_pci_probe,
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index b4c02f29663e..f6325fa657fb 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -20,208 +20,13 @@
20 20
21#include <asm/cpu-info.h> 21#include <asm/cpu-info.h>
22 22
23/*
24 * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource
25 * assignments.
26 */
27
28/*
29 * The PCI controller list.
30 */
31
32static struct pci_controller *hose_head, **hose_tail = &hose_head;
33
34unsigned long PCIBIOS_MIN_IO; 23unsigned long PCIBIOS_MIN_IO;
35unsigned long PCIBIOS_MIN_MEM; 24EXPORT_SYMBOL(PCIBIOS_MIN_IO);
36
37static int pci_initialized;
38
39/*
40 * We need to avoid collisions with `mirrored' VGA ports
41 * and other strange ISA hardware, so we always want the
42 * addresses to be allocated in the 0x000-0x0ff region
43 * modulo 0x400.
44 *
45 * Why? Because some silly external IO cards only decode
46 * the low 10 bits of the IO address. The 0x00-0xff region
47 * is reserved for motherboard devices that decode all 16
48 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
49 * but we want to try to avoid allocating at 0x2900-0x2bff
50 * which might have be mirrored at 0x0100-0x03ff..
51 */
52resource_size_t
53pcibios_align_resource(void *data, const struct resource *res,
54 resource_size_t size, resource_size_t align)
55{
56 struct pci_dev *dev = data;
57 struct pci_controller *hose = dev->sysdata;
58 resource_size_t start = res->start;
59
60 if (res->flags & IORESOURCE_IO) {
61 /* Make sure we start at our min on all hoses */
62 if (start < PCIBIOS_MIN_IO + hose->io_resource->start)
63 start = PCIBIOS_MIN_IO + hose->io_resource->start;
64
65 /*
66 * Put everything into 0x00-0xff region modulo 0x400
67 */
68 if (start & 0x300)
69 start = (start + 0x3ff) & ~0x3ff;
70 } else if (res->flags & IORESOURCE_MEM) {
71 /* Make sure we start at our min on all hoses */
72 if (start < PCIBIOS_MIN_MEM + hose->mem_resource->start)
73 start = PCIBIOS_MIN_MEM + hose->mem_resource->start;
74 }
75
76 return start;
77}
78
79static void pcibios_scanbus(struct pci_controller *hose)
80{
81 static int next_busno;
82 static int need_domain_info;
83 LIST_HEAD(resources);
84 struct pci_bus *bus;
85
86 if (hose->get_busno && pci_has_flag(PCI_PROBE_ONLY))
87 next_busno = (*hose->get_busno)();
88
89 pci_add_resource_offset(&resources,
90 hose->mem_resource, hose->mem_offset);
91 pci_add_resource_offset(&resources,
92 hose->io_resource, hose->io_offset);
93 pci_add_resource_offset(&resources,
94 hose->busn_resource, hose->busn_offset);
95 bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
96 &resources);
97 hose->bus = bus;
98
99 need_domain_info = need_domain_info || hose->index;
100 hose->need_domain_info = need_domain_info;
101
102 if (!bus) {
103 pci_free_resource_list(&resources);
104 return;
105 }
106
107 next_busno = bus->busn_res.end + 1;
108 /* Don't allow 8-bit bus number overflow inside the hose -
109 reserve some space for bridges. */
110 if (next_busno > 224) {
111 next_busno = 0;
112 need_domain_info = 1;
113 }
114
115 /*
116 * We insert PCI resources into the iomem_resource and
117 * ioport_resource trees in either pci_bus_claim_resources()
118 * or pci_bus_assign_resources().
119 */
120 if (pci_has_flag(PCI_PROBE_ONLY)) {
121 pci_bus_claim_resources(bus);
122 } else {
123 pci_bus_size_bridges(bus);
124 pci_bus_assign_resources(bus);
125 }
126 pci_bus_add_devices(bus);
127}
128
129#ifdef CONFIG_OF
130void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
131{
132 struct of_pci_range range;
133 struct of_pci_range_parser parser;
134
135 pr_info("PCI host bridge %s ranges:\n", node->full_name);
136 hose->of_node = node;
137
138 if (of_pci_range_parser_init(&parser, node))
139 return;
140
141 for_each_of_pci_range(&parser, &range) {
142 struct resource *res = NULL;
143
144 switch (range.flags & IORESOURCE_TYPE_BITS) {
145 case IORESOURCE_IO:
146 pr_info(" IO 0x%016llx..0x%016llx\n",
147 range.cpu_addr,
148 range.cpu_addr + range.size - 1);
149 hose->io_map_base =
150 (unsigned long)ioremap(range.cpu_addr,
151 range.size);
152 res = hose->io_resource;
153 break;
154 case IORESOURCE_MEM:
155 pr_info(" MEM 0x%016llx..0x%016llx\n",
156 range.cpu_addr,
157 range.cpu_addr + range.size - 1);
158 res = hose->mem_resource;
159 break;
160 }
161 if (res != NULL)
162 of_pci_range_to_resource(&range, node, res);
163 }
164}
165
166struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
167{
168 struct pci_controller *hose = bus->sysdata;
169
170 return of_node_get(hose->of_node);
171}
172#endif
173
174static DEFINE_MUTEX(pci_scan_mutex);
175
176void register_pci_controller(struct pci_controller *hose)
177{
178 struct resource *parent;
179
180 parent = hose->mem_resource->parent;
181 if (!parent)
182 parent = &iomem_resource;
183
184 if (request_resource(parent, hose->mem_resource) < 0)
185 goto out;
186
187 parent = hose->io_resource->parent;
188 if (!parent)
189 parent = &ioport_resource;
190
191 if (request_resource(parent, hose->io_resource) < 0) {
192 release_resource(hose->mem_resource);
193 goto out;
194 }
195
196 *hose_tail = hose;
197 hose_tail = &hose->next;
198
199 /*
200 * Do not panic here but later - this might happen before console init.
201 */
202 if (!hose->io_map_base) {
203 printk(KERN_WARNING
204 "registering PCI controller with io_map_base unset\n");
205 }
206
207 /*
208 * Scan the bus if it is register after the PCI subsystem
209 * initialization.
210 */
211 if (pci_initialized) {
212 mutex_lock(&pci_scan_mutex);
213 pcibios_scanbus(hose);
214 mutex_unlock(&pci_scan_mutex);
215 }
216
217 return;
218 25
219out: 26unsigned long PCIBIOS_MIN_MEM;
220 printk(KERN_WARNING 27EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
221 "Skipping PCI bus scan due to resource conflict\n");
222}
223 28
224static void __init pcibios_set_cache_line_size(void) 29static int __init pcibios_set_cache_line_size(void)
225{ 30{
226 struct cpuinfo_mips *c = &current_cpu_data; 31 struct cpuinfo_mips *c = &current_cpu_data;
227 unsigned int lsize; 32 unsigned int lsize;
@@ -239,92 +44,9 @@ static void __init pcibios_set_cache_line_size(void)
239 pci_dfl_cache_line_size = lsize >> 2; 44 pci_dfl_cache_line_size = lsize >> 2;
240 45
241 pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize); 46 pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
242}
243
244static int __init pcibios_init(void)
245{
246 struct pci_controller *hose;
247
248 pcibios_set_cache_line_size();
249
250 /* Scan all of the recorded PCI controllers. */
251 for (hose = hose_head; hose; hose = hose->next)
252 pcibios_scanbus(hose);
253
254 pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
255
256 pci_initialized = 1;
257
258 return 0;
259}
260
261subsys_initcall(pcibios_init);
262
263static int pcibios_enable_resources(struct pci_dev *dev, int mask)
264{
265 u16 cmd, old_cmd;
266 int idx;
267 struct resource *r;
268
269 pci_read_config_word(dev, PCI_COMMAND, &cmd);
270 old_cmd = cmd;
271 for (idx=0; idx < PCI_NUM_RESOURCES; idx++) {
272 /* Only set up the requested stuff */
273 if (!(mask & (1<<idx)))
274 continue;
275
276 r = &dev->resource[idx];
277 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
278 continue;
279 if ((idx == PCI_ROM_RESOURCE) &&
280 (!(r->flags & IORESOURCE_ROM_ENABLE)))
281 continue;
282 if (!r->start && r->end) {
283 printk(KERN_ERR "PCI: Device %s not available "
284 "because of resource collisions\n",
285 pci_name(dev));
286 return -EINVAL;
287 }
288 if (r->flags & IORESOURCE_IO)
289 cmd |= PCI_COMMAND_IO;
290 if (r->flags & IORESOURCE_MEM)
291 cmd |= PCI_COMMAND_MEMORY;
292 }
293 if (cmd != old_cmd) {
294 printk("PCI: Enabling device %s (%04x -> %04x)\n",
295 pci_name(dev), old_cmd, cmd);
296 pci_write_config_word(dev, PCI_COMMAND, cmd);
297 }
298 return 0; 47 return 0;
299} 48}
300 49arch_initcall(pcibios_set_cache_line_size);
301unsigned int pcibios_assign_all_busses(void)
302{
303 return 1;
304}
305
306int pcibios_enable_device(struct pci_dev *dev, int mask)
307{
308 int err;
309
310 if ((err = pcibios_enable_resources(dev, mask)) < 0)
311 return err;
312
313 return pcibios_plat_dev_init(dev);
314}
315
316void pcibios_fixup_bus(struct pci_bus *bus)
317{
318 struct pci_dev *dev = bus->self;
319
320 if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
321 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
322 pci_read_bridge_bases(bus);
323 }
324}
325
326EXPORT_SYMBOL(PCIBIOS_MIN_IO);
327EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
328 50
329void pci_resource_to_user(const struct pci_dev *dev, int bar, 51void pci_resource_to_user(const struct pci_dev *dev, int bar,
330 const struct resource *rsrc, resource_size_t *start, 52 const struct resource *rsrc, resource_size_t *start,
@@ -359,12 +81,3 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
359 return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 81 return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
360 vma->vm_end - vma->vm_start, vma->vm_page_prot); 82 vma->vm_end - vma->vm_start, vma->vm_page_prot);
361} 83}
362
363char * (*pcibios_plat_setup)(char *str) __initdata;
364
365char *__init pcibios_setup(char *str)
366{
367 if (pcibios_plat_setup)
368 return pcibios_plat_setup(str);
369 return str;
370}
diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
index 99f3db4f0a9b..9f672ceb089b 100644
--- a/arch/mips/pci/pcie-octeon.c
+++ b/arch/mips/pci/pcie-octeon.c
@@ -11,7 +11,7 @@
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/module.h> 14#include <linux/moduleparam.h>
15 15
16#include <asm/octeon/octeon.h> 16#include <asm/octeon/octeon.h>
17#include <asm/octeon/cvmx-npei-defs.h> 17#include <asm/octeon/cvmx-npei-defs.h>
diff --git a/arch/mips/pnx833x/common/platform.c b/arch/mips/pnx833x/common/platform.c
index 3cd357737a26..7cf4eb50fc72 100644
--- a/arch/mips/pnx833x/common/platform.c
+++ b/arch/mips/pnx833x/common/platform.c
@@ -232,12 +232,8 @@ static struct platform_device *pnx833x_platform_devices[] __initdata = {
232 232
233static int __init pnx833x_platform_init(void) 233static int __init pnx833x_platform_init(void)
234{ 234{
235 int res; 235 return platform_add_devices(pnx833x_platform_devices,
236 236 ARRAY_SIZE(pnx833x_platform_devices));
237 res = platform_add_devices(pnx833x_platform_devices,
238 ARRAY_SIZE(pnx833x_platform_devices));
239
240 return res;
241} 237}
242 238
243arch_initcall(pnx833x_platform_init); 239arch_initcall(pnx833x_platform_init);
diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c
index b0343ff336c5..8077ff39bdea 100644
--- a/arch/mips/ralink/timer.c
+++ b/arch/mips/ralink/timer.c
@@ -1,4 +1,7 @@
1/* 1/*
2 * Ralink RT2880 timer
3 * Author: John Crispin
4 *
2 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published 6 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation. 7 * by the Free Software Foundation.
@@ -6,7 +9,6 @@
6 * Copyright (C) 2013 John Crispin <john@phrozen.org> 9 * Copyright (C) 2013 John Crispin <john@phrozen.org>
7*/ 10*/
8 11
9#include <linux/module.h>
10#include <linux/platform_device.h> 12#include <linux/platform_device.h>
11#include <linux/interrupt.h> 13#include <linux/interrupt.h>
12#include <linux/timer.h> 14#include <linux/timer.h>
@@ -152,33 +154,17 @@ static int rt_timer_probe(struct platform_device *pdev)
152 return 0; 154 return 0;
153} 155}
154 156
155static int rt_timer_remove(struct platform_device *pdev)
156{
157 struct rt_timer *rt = platform_get_drvdata(pdev);
158
159 rt_timer_disable(rt);
160 rt_timer_free(rt);
161
162 return 0;
163}
164
165static const struct of_device_id rt_timer_match[] = { 157static const struct of_device_id rt_timer_match[] = {
166 { .compatible = "ralink,rt2880-timer" }, 158 { .compatible = "ralink,rt2880-timer" },
167 {}, 159 {},
168}; 160};
169MODULE_DEVICE_TABLE(of, rt_timer_match);
170 161
171static struct platform_driver rt_timer_driver = { 162static struct platform_driver rt_timer_driver = {
172 .probe = rt_timer_probe, 163 .probe = rt_timer_probe,
173 .remove = rt_timer_remove,
174 .driver = { 164 .driver = {
175 .name = "rt-timer", 165 .name = "rt-timer",
176 .of_match_table = rt_timer_match 166 .of_match_table = rt_timer_match,
167 .suppress_bind_attrs = true,
177 }, 168 },
178}; 169};
179 170builtin_platform_driver(rt_timer_driver);
180module_platform_driver(rt_timer_driver);
181
182MODULE_DESCRIPTION("Ralink RT2880 timer");
183MODULE_AUTHOR("John Crispin <john@phrozen.org");
184MODULE_LICENSE("GPL");
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 8c337d60f790..42923478d45c 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -20,7 +20,7 @@ config MACH_TXX9
20 select SYS_SUPPORTS_32BIT_KERNEL 20 select SYS_SUPPORTS_32BIT_KERNEL
21 select SYS_SUPPORTS_LITTLE_ENDIAN 21 select SYS_SUPPORTS_LITTLE_ENDIAN
22 select SYS_SUPPORTS_BIG_ENDIAN 22 select SYS_SUPPORTS_BIG_ENDIAN
23 select HAVE_CLK 23 select COMMON_CLK
24 24
25config TOSHIBA_JMR3927 25config TOSHIBA_JMR3927
26 bool "Toshiba JMR-TX3927 board" 26 bool "Toshiba JMR-TX3927 board"
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 1f6bc9a3036c..285d84e5c7b9 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -29,12 +29,8 @@ static int __init
29early_read_config_word(struct pci_controller *hose, 29early_read_config_word(struct pci_controller *hose,
30 int top_bus, int bus, int devfn, int offset, u16 *value) 30 int top_bus, int bus, int devfn, int offset, u16 *value)
31{ 31{
32 struct pci_dev fake_dev;
33 struct pci_bus fake_bus; 32 struct pci_bus fake_bus;
34 33
35 fake_dev.bus = &fake_bus;
36 fake_dev.sysdata = hose;
37 fake_dev.devfn = devfn;
38 fake_bus.number = bus; 34 fake_bus.number = bus;
39 fake_bus.sysdata = hose; 35 fake_bus.sysdata = hose;
40 fake_bus.ops = hose->pci_ops; 36 fake_bus.ops = hose->pci_ops;
@@ -45,7 +41,7 @@ early_read_config_word(struct pci_controller *hose,
45 else 41 else
46 fake_bus.parent = NULL; 42 fake_bus.parent = NULL;
47 43
48 return pci_read_config_word(&fake_dev, offset, value); 44 return pci_bus_read_config_word(&fake_bus, devfn, offset, value);
49} 45}
50 46
51int __init txx9_pci66_check(struct pci_controller *hose, int top_bus, 47int __init txx9_pci66_check(struct pci_controller *hose, int top_bus,
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index ada92db92f87..a1d98b5c8fd6 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -15,7 +15,8 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/clk.h> 18#include <linux/clk-provider.h>
19#include <linux/clkdev.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/gpio/driver.h> 21#include <linux/gpio/driver.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
@@ -83,40 +84,6 @@ int txx9_ccfg_toeon __initdata;
83int txx9_ccfg_toeon __initdata = 1; 84int txx9_ccfg_toeon __initdata = 1;
84#endif 85#endif
85 86
86/* Minimum CLK support */
87
88struct clk *clk_get(struct device *dev, const char *id)
89{
90 if (!strcmp(id, "spi-baseclk"))
91 return (struct clk *)((unsigned long)txx9_gbus_clock / 2 / 2);
92 if (!strcmp(id, "imbus_clk"))
93 return (struct clk *)((unsigned long)txx9_gbus_clock / 2);
94 return ERR_PTR(-ENOENT);
95}
96EXPORT_SYMBOL(clk_get);
97
98int clk_enable(struct clk *clk)
99{
100 return 0;
101}
102EXPORT_SYMBOL(clk_enable);
103
104void clk_disable(struct clk *clk)
105{
106}
107EXPORT_SYMBOL(clk_disable);
108
109unsigned long clk_get_rate(struct clk *clk)
110{
111 return (unsigned long)clk;
112}
113EXPORT_SYMBOL(clk_get_rate);
114
115void clk_put(struct clk *clk)
116{
117}
118EXPORT_SYMBOL(clk_put);
119
120#define BOARD_VEC(board) extern struct txx9_board_vec board; 87#define BOARD_VEC(board) extern struct txx9_board_vec board;
121#include <asm/txx9/boards.h> 88#include <asm/txx9/boards.h>
122#undef BOARD_VEC 89#undef BOARD_VEC
@@ -560,8 +527,41 @@ void __init plat_time_init(void)
560 txx9_board_vec->time_init(); 527 txx9_board_vec->time_init();
561} 528}
562 529
530static void txx9_clk_init(void)
531{
532 struct clk_hw *hw;
533 int error;
534
535 hw = clk_hw_register_fixed_rate(NULL, "gbus", NULL, 0, txx9_gbus_clock);
536 if (IS_ERR(hw)) {
537 error = PTR_ERR(hw);
538 goto fail;
539 }
540
541 hw = clk_hw_register_fixed_factor(NULL, "imbus", "gbus", 0, 1, 2);
542 error = clk_hw_register_clkdev(hw, "imbus_clk", NULL);
543 if (error)
544 goto fail;
545
546#ifdef CONFIG_CPU_TX49XX
547 if (TX4938_REV_PCODE() == 0x4938) {
548 hw = clk_hw_register_fixed_factor(NULL, "spi", "gbus", 0, 1, 4);
549 error = clk_hw_register_clkdev(hw, "spi-baseclk", NULL);
550 if (error)
551 goto fail;
552 }
553#endif
554
555 return;
556
557fail:
558 pr_err("Failed to register clocks: %d\n", error);
559}
560
563static int __init _txx9_arch_init(void) 561static int __init _txx9_arch_init(void)
564{ 562{
563 txx9_clk_init();
564
565 if (txx9_board_vec->arch_init) 565 if (txx9_board_vec->arch_init)
566 txx9_board_vec->arch_init(); 566 txx9_board_vec->arch_init();
567 return 0; 567 return 0;
diff --git a/arch/mips/txx9/generic/setup_tx3927.c b/arch/mips/txx9/generic/setup_tx3927.c
index 110e05c3eb8f..d3b83a92cf26 100644
--- a/arch/mips/txx9/generic/setup_tx3927.c
+++ b/arch/mips/txx9/generic/setup_tx3927.c
@@ -92,7 +92,6 @@ void __init tx3927_setup(void)
92 /* PIO */ 92 /* PIO */
93 __raw_writel(0, &tx3927_pioptr->maskcpu); 93 __raw_writel(0, &tx3927_pioptr->maskcpu);
94 __raw_writel(0, &tx3927_pioptr->maskext); 94 __raw_writel(0, &tx3927_pioptr->maskext);
95 txx9_gpio_init(TX3927_PIO_REG, 0, 16);
96 95
97 conf = read_c0_conf(); 96 conf = read_c0_conf();
98 if (conf & TX39_CONF_DCE) { 97 if (conf & TX39_CONF_DCE) {
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index a4664cb6c1e1..8d8011570b1d 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -215,7 +215,6 @@ void __init tx4927_setup(void)
215 txx9_tmr_init(TX4927_TMR_REG(i) & 0xfffffffffULL); 215 txx9_tmr_init(TX4927_TMR_REG(i) & 0xfffffffffULL);
216 216
217 /* PIO */ 217 /* PIO */
218 txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO);
219 __raw_writel(0, &tx4927_pioptr->maskcpu); 218 __raw_writel(0, &tx4927_pioptr->maskcpu);
220 __raw_writel(0, &tx4927_pioptr->maskext); 219 __raw_writel(0, &tx4927_pioptr->maskext);
221 220
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index 58cdb2aba5e1..ba265bf1fd06 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -241,7 +241,6 @@ void __init tx4938_setup(void)
241 txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL); 241 txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL);
242 242
243 /* PIO */ 243 /* PIO */
244 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
245 __raw_writel(0, &tx4938_pioptr->maskcpu); 244 __raw_writel(0, &tx4938_pioptr->maskcpu);
246 __raw_writel(0, &tx4938_pioptr->maskext); 245 __raw_writel(0, &tx4938_pioptr->maskext);
247 246
diff --git a/arch/mips/txx9/jmr3927/setup.c b/arch/mips/txx9/jmr3927/setup.c
index 3206f76f300b..a455166dc6d4 100644
--- a/arch/mips/txx9/jmr3927/setup.c
+++ b/arch/mips/txx9/jmr3927/setup.c
@@ -142,8 +142,6 @@ static void __init jmr3927_board_init(void)
142 142
143 /* PIO[15:12] connected to LEDs */ 143 /* PIO[15:12] connected to LEDs */
144 __raw_writel(0x0000f000, &tx3927_pioptr->dir); 144 __raw_writel(0x0000f000, &tx3927_pioptr->dir);
145 gpio_request(11, "dipsw1");
146 gpio_request(10, "dipsw2");
147 145
148 jmr3927_pci_setup(); 146 jmr3927_pci_setup();
149 147
@@ -204,6 +202,14 @@ static void __init jmr3927_device_init(void)
204 txx9_iocled_init(iocled_base, -1, 8, 1, "green", NULL); 202 txx9_iocled_init(iocled_base, -1, 8, 1, "green", NULL);
205} 203}
206 204
205static void __init jmr3927_arch_init(void)
206{
207 txx9_gpio_init(TX3927_PIO_REG, 0, 16);
208
209 gpio_request(11, "dipsw1");
210 gpio_request(10, "dipsw2");
211}
212
207struct txx9_board_vec jmr3927_vec __initdata = { 213struct txx9_board_vec jmr3927_vec __initdata = {
208 .system = "Toshiba JMR_TX3927", 214 .system = "Toshiba JMR_TX3927",
209 .prom_init = jmr3927_prom_init, 215 .prom_init = jmr3927_prom_init,
@@ -211,6 +217,7 @@ struct txx9_board_vec jmr3927_vec __initdata = {
211 .irq_setup = jmr3927_irq_setup, 217 .irq_setup = jmr3927_irq_setup,
212 .time_init = jmr3927_time_init, 218 .time_init = jmr3927_time_init,
213 .device_init = jmr3927_device_init, 219 .device_init = jmr3927_device_init,
220 .arch_init = jmr3927_arch_init,
214#ifdef CONFIG_PCI 221#ifdef CONFIG_PCI
215 .pci_map_irq = jmr3927_pci_map_irq, 222 .pci_map_irq = jmr3927_pci_map_irq,
216#endif 223#endif
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 3c516ef625e5..f5b367e20dff 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -52,6 +52,7 @@
52#include <linux/leds.h> 52#include <linux/leds.h>
53#include <asm/io.h> 53#include <asm/io.h>
54#include <asm/reboot.h> 54#include <asm/reboot.h>
55#include <asm/txx9pio.h>
55#include <asm/txx9/generic.h> 56#include <asm/txx9/generic.h>
56#include <asm/txx9/pci.h> 57#include <asm/txx9/pci.h>
57#include <asm/txx9/rbtx4927.h> 58#include <asm/txx9/rbtx4927.h>
@@ -151,20 +152,37 @@ static void __init tx4937_pci_setup(void)
151 } 152 }
152 tx4938_setup_pcierr_irq(); 153 tx4938_setup_pcierr_irq();
153} 154}
155#else
156static inline void tx4927_pci_setup(void) {}
157static inline void tx4937_pci_setup(void) {}
158#endif /* CONFIG_PCI */
159
160static void __init rbtx4927_gpio_init(void)
161{
162 /* TX4927-SIO DTR on (PIO[15]) */
163 gpio_request(15, "sio-dtr");
164 gpio_direction_output(15, 1);
165
166 tx4927_sio_init(0, 0);
167}
154 168
155static void __init rbtx4927_arch_init(void) 169static void __init rbtx4927_arch_init(void)
156{ 170{
171 txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO);
172
173 rbtx4927_gpio_init();
174
157 tx4927_pci_setup(); 175 tx4927_pci_setup();
158} 176}
159 177
160static void __init rbtx4937_arch_init(void) 178static void __init rbtx4937_arch_init(void)
161{ 179{
180 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
181
182 rbtx4927_gpio_init();
183
162 tx4937_pci_setup(); 184 tx4937_pci_setup();
163} 185}
164#else
165#define rbtx4927_arch_init NULL
166#define rbtx4937_arch_init NULL
167#endif /* CONFIG_PCI */
168 186
169static void toshiba_rbtx4927_restart(char *command) 187static void toshiba_rbtx4927_restart(char *command)
170{ 188{
@@ -205,12 +223,6 @@ static void __init rbtx4927_mem_setup(void)
205#else 223#else
206 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET); 224 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
207#endif 225#endif
208
209 /* TX4927-SIO DTR on (PIO[15]) */
210 gpio_request(15, "sio-dtr");
211 gpio_direction_output(15, 1);
212
213 tx4927_sio_init(0, 0);
214} 226}
215 227
216static void __init rbtx4927_clock_init(void) 228static void __init rbtx4927_clock_init(void)
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 54de66837103..07939ed6b22f 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -336,6 +336,7 @@ static void __init rbtx4938_mtd_init(void)
336 336
337static void __init rbtx4938_arch_init(void) 337static void __init rbtx4938_arch_init(void)
338{ 338{
339 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
339 gpiochip_add_data(&rbtx4938_spi_gpio_chip, NULL); 340 gpiochip_add_data(&rbtx4938_spi_gpio_chip, NULL);
340 rbtx4938_pci_setup(); 341 rbtx4938_pci_setup();
341 rbtx4938_spi_init(); 342 rbtx4938_spi_init();
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index 3b4538ec0102..c3dc12a8b7d9 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -13,8 +13,6 @@ cflags-vdso := $(ccflags-vdso) \
13 -DDISABLE_BRANCH_PROFILING \ 13 -DDISABLE_BRANCH_PROFILING \
14 $(call cc-option, -fno-stack-protector) 14 $(call cc-option, -fno-stack-protector)
15aflags-vdso := $(ccflags-vdso) \ 15aflags-vdso := $(ccflags-vdso) \
16 $(filter -I%,$(KBUILD_CFLAGS)) \
17 $(filter -E%,$(KBUILD_CFLAGS)) \
18 -D__ASSEMBLY__ -Wa,-gdwarf-2 16 -D__ASSEMBLY__ -Wa,-gdwarf-2
19 17
20# 18#
@@ -82,7 +80,7 @@ obj-vdso := $(obj-vdso-y:%.o=$(obj)/%.o)
82$(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $(native-abi) 80$(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $(native-abi)
83$(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi) 81$(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
84 82
85$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(native-abi) 83$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
86 84
87$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) FORCE 85$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
88 $(call if_changed,vdsold) 86 $(call if_changed,vdsold)
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index c07e725ea93d..10e1b9eee10e 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -119,4 +119,13 @@ config CFAG12864B_RATE
119 If you compile this as a module, you can still override this 119 If you compile this as a module, you can still override this
120 value using the module parameters. 120 value using the module parameters.
121 121
122config IMG_ASCII_LCD
123 tristate "Imagination Technologies ASCII LCD Display"
124 default y if MIPS_MALTA || MIPS_SEAD3
125 select SYSCON
126 help
127 Enable this to support the simple ASCII LCD displays found on
128 development boards such as the MIPS Boston, MIPS Malta & MIPS SEAD3
129 from Imagination Technologies.
130
122endif # AUXDISPLAY 131endif # AUXDISPLAY
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index 8a8936a468b9..3127175c89df 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -4,3 +4,4 @@
4 4
5obj-$(CONFIG_KS0108) += ks0108.o 5obj-$(CONFIG_KS0108) += ks0108.o
6obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o 6obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o
7obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o
diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c
new file mode 100644
index 000000000000..bf43b5d2aafc
--- /dev/null
+++ b/drivers/auxdisplay/img-ascii-lcd.c
@@ -0,0 +1,443 @@
1/*
2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <generated/utsrelease.h>
12#include <linux/kernel.h>
13#include <linux/io.h>
14#include <linux/mfd/syscon.h>
15#include <linux/module.h>
16#include <linux/of_address.h>
17#include <linux/of_platform.h>
18#include <linux/platform_device.h>
19#include <linux/regmap.h>
20#include <linux/slab.h>
21#include <linux/sysfs.h>
22
23struct img_ascii_lcd_ctx;
24
25/**
26 * struct img_ascii_lcd_config - Configuration information about an LCD model
27 * @num_chars: the number of characters the LCD can display
28 * @external_regmap: true if registers are in a system controller, else false
29 * @update: function called to update the LCD
30 */
31struct img_ascii_lcd_config {
32 unsigned int num_chars;
33 bool external_regmap;
34 void (*update)(struct img_ascii_lcd_ctx *ctx);
35};
36
37/**
38 * struct img_ascii_lcd_ctx - Private data structure
39 * @pdev: the ASCII LCD platform device
40 * @base: the base address of the LCD registers
41 * @regmap: the regmap through which LCD registers are accessed
42 * @offset: the offset within regmap to the start of the LCD registers
43 * @cfg: pointer to the LCD model configuration
44 * @message: the full message to display or scroll on the LCD
45 * @message_len: the length of the @message string
46 * @scroll_pos: index of the first character of @message currently displayed
47 * @scroll_rate: scroll interval in jiffies
48 * @timer: timer used to implement scrolling
49 * @curr: the string currently displayed on the LCD
50 */
51struct img_ascii_lcd_ctx {
52 struct platform_device *pdev;
53 union {
54 void __iomem *base;
55 struct regmap *regmap;
56 };
57 u32 offset;
58 const struct img_ascii_lcd_config *cfg;
59 char *message;
60 unsigned int message_len;
61 unsigned int scroll_pos;
62 unsigned int scroll_rate;
63 struct timer_list timer;
64 char curr[] __aligned(8);
65};
66
67/*
68 * MIPS Boston development board
69 */
70
71static void boston_update(struct img_ascii_lcd_ctx *ctx)
72{
73 ulong val;
74
75#if BITS_PER_LONG == 64
76 val = *((u64 *)&ctx->curr[0]);
77 __raw_writeq(val, ctx->base);
78#elif BITS_PER_LONG == 32
79 val = *((u32 *)&ctx->curr[0]);
80 __raw_writel(val, ctx->base);
81 val = *((u32 *)&ctx->curr[4]);
82 __raw_writel(val, ctx->base + 4);
83#else
84# error Not 32 or 64 bit
85#endif
86}
87
88static struct img_ascii_lcd_config boston_config = {
89 .num_chars = 8,
90 .update = boston_update,
91};
92
93/*
94 * MIPS Malta development board
95 */
96
97static void malta_update(struct img_ascii_lcd_ctx *ctx)
98{
99 unsigned int i;
100 int err;
101
102 for (i = 0; i < ctx->cfg->num_chars; i++) {
103 err = regmap_write(ctx->regmap,
104 ctx->offset + (i * 8), ctx->curr[i]);
105 if (err)
106 break;
107 }
108
109 if (unlikely(err))
110 pr_err_ratelimited("Failed to update LCD display: %d\n", err);
111}
112
113static struct img_ascii_lcd_config malta_config = {
114 .num_chars = 8,
115 .external_regmap = true,
116 .update = malta_update,
117};
118
119/*
120 * MIPS SEAD3 development board
121 */
122
123enum {
124 SEAD3_REG_LCD_CTRL = 0x00,
125#define SEAD3_REG_LCD_CTRL_SETDRAM BIT(7)
126 SEAD3_REG_LCD_DATA = 0x08,
127 SEAD3_REG_CPLD_STATUS = 0x10,
128#define SEAD3_REG_CPLD_STATUS_BUSY BIT(0)
129 SEAD3_REG_CPLD_DATA = 0x18,
130#define SEAD3_REG_CPLD_DATA_BUSY BIT(7)
131};
132
133static int sead3_wait_sm_idle(struct img_ascii_lcd_ctx *ctx)
134{
135 unsigned int status;
136 int err;
137
138 do {
139 err = regmap_read(ctx->regmap,
140 ctx->offset + SEAD3_REG_CPLD_STATUS,
141 &status);
142 if (err)
143 return err;
144 } while (status & SEAD3_REG_CPLD_STATUS_BUSY);
145
146 return 0;
147
148}
149
150static int sead3_wait_lcd_idle(struct img_ascii_lcd_ctx *ctx)
151{
152 unsigned int cpld_data;
153 int err;
154
155 err = sead3_wait_sm_idle(ctx);
156 if (err)
157 return err;
158
159 do {
160 err = regmap_read(ctx->regmap,
161 ctx->offset + SEAD3_REG_LCD_CTRL,
162 &cpld_data);
163 if (err)
164 return err;
165
166 err = sead3_wait_sm_idle(ctx);
167 if (err)
168 return err;
169
170 err = regmap_read(ctx->regmap,
171 ctx->offset + SEAD3_REG_CPLD_DATA,
172 &cpld_data);
173 if (err)
174 return err;
175 } while (cpld_data & SEAD3_REG_CPLD_DATA_BUSY);
176
177 return 0;
178}
179
180static void sead3_update(struct img_ascii_lcd_ctx *ctx)
181{
182 unsigned int i;
183 int err;
184
185 for (i = 0; i < ctx->cfg->num_chars; i++) {
186 err = sead3_wait_lcd_idle(ctx);
187 if (err)
188 break;
189
190 err = regmap_write(ctx->regmap,
191 ctx->offset + SEAD3_REG_LCD_CTRL,
192 SEAD3_REG_LCD_CTRL_SETDRAM | i);
193 if (err)
194 break;
195
196 err = sead3_wait_lcd_idle(ctx);
197 if (err)
198 break;
199
200 err = regmap_write(ctx->regmap,
201 ctx->offset + SEAD3_REG_LCD_DATA,
202 ctx->curr[i]);
203 if (err)
204 break;
205 }
206
207 if (unlikely(err))
208 pr_err_ratelimited("Failed to update LCD display: %d\n", err);
209}
210
211static struct img_ascii_lcd_config sead3_config = {
212 .num_chars = 16,
213 .external_regmap = true,
214 .update = sead3_update,
215};
216
217static const struct of_device_id img_ascii_lcd_matches[] = {
218 { .compatible = "img,boston-lcd", .data = &boston_config },
219 { .compatible = "mti,malta-lcd", .data = &malta_config },
220 { .compatible = "mti,sead3-lcd", .data = &sead3_config },
221};
222
223/**
224 * img_ascii_lcd_scroll() - scroll the display by a character
225 * @arg: really a pointer to the private data structure
226 *
227 * Scroll the current message along the LCD by one character, rearming the
228 * timer if required.
229 */
230static void img_ascii_lcd_scroll(unsigned long arg)
231{
232 struct img_ascii_lcd_ctx *ctx = (struct img_ascii_lcd_ctx *)arg;
233 unsigned int i, ch = ctx->scroll_pos;
234 unsigned int num_chars = ctx->cfg->num_chars;
235
236 /* update the current message string */
237 for (i = 0; i < num_chars;) {
238 /* copy as many characters from the string as possible */
239 for (; i < num_chars && ch < ctx->message_len; i++, ch++)
240 ctx->curr[i] = ctx->message[ch];
241
242 /* wrap around to the start of the string */
243 ch = 0;
244 }
245
246 /* update the LCD */
247 ctx->cfg->update(ctx);
248
249 /* move on to the next character */
250 ctx->scroll_pos++;
251 ctx->scroll_pos %= ctx->message_len;
252
253 /* rearm the timer */
254 if (ctx->message_len > ctx->cfg->num_chars)
255 mod_timer(&ctx->timer, jiffies + ctx->scroll_rate);
256}
257
258/**
259 * img_ascii_lcd_display() - set the message to be displayed
260 * @ctx: pointer to the private data structure
261 * @msg: the message to display
262 * @count: length of msg, or -1
263 *
264 * Display a new message @msg on the LCD. @msg can be longer than the number of
265 * characters the LCD can display, in which case it will begin scrolling across
266 * the LCD display.
267 *
268 * Return: 0 on success, -ENOMEM on memory allocation failure
269 */
270static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx,
271 const char *msg, ssize_t count)
272{
273 char *new_msg;
274
275 /* stop the scroll timer */
276 del_timer_sync(&ctx->timer);
277
278 if (count == -1)
279 count = strlen(msg);
280
281 /* if the string ends with a newline, trim it */
282 if (msg[count - 1] == '\n')
283 count--;
284
285 new_msg = devm_kmalloc(&ctx->pdev->dev, count + 1, GFP_KERNEL);
286 if (!new_msg)
287 return -ENOMEM;
288
289 memcpy(new_msg, msg, count);
290 new_msg[count] = 0;
291
292 if (ctx->message)
293 devm_kfree(&ctx->pdev->dev, ctx->message);
294
295 ctx->message = new_msg;
296 ctx->message_len = count;
297 ctx->scroll_pos = 0;
298
299 /* update the LCD */
300 img_ascii_lcd_scroll((unsigned long)ctx);
301
302 return 0;
303}
304
305/**
306 * message_show() - read message via sysfs
307 * @dev: the LCD device
308 * @attr: the LCD message attribute
309 * @buf: the buffer to read the message into
310 *
311 * Read the current message being displayed or scrolled across the LCD display
312 * into @buf, for reads from sysfs.
313 *
314 * Return: the number of characters written to @buf
315 */
316static ssize_t message_show(struct device *dev, struct device_attribute *attr,
317 char *buf)
318{
319 struct img_ascii_lcd_ctx *ctx = dev_get_drvdata(dev);
320
321 return sprintf(buf, "%s\n", ctx->message);
322}
323
324/**
325 * message_store() - write a new message via sysfs
326 * @dev: the LCD device
327 * @attr: the LCD message attribute
328 * @buf: the buffer containing the new message
329 * @count: the size of the message in @buf
330 *
331 * Write a new message to display or scroll across the LCD display from sysfs.
332 *
333 * Return: the size of the message on success, else -ERRNO
334 */
335static ssize_t message_store(struct device *dev, struct device_attribute *attr,
336 const char *buf, size_t count)
337{
338 struct img_ascii_lcd_ctx *ctx = dev_get_drvdata(dev);
339 int err;
340
341 err = img_ascii_lcd_display(ctx, buf, count);
342 return err ?: count;
343}
344
345static DEVICE_ATTR_RW(message);
346
347/**
348 * img_ascii_lcd_probe() - probe an LCD display device
349 * @pdev: the LCD platform device
350 *
351 * Probe an LCD display device, ensuring that we have the required resources in
352 * order to access the LCD & setting up private data as well as sysfs files.
353 *
354 * Return: 0 on success, else -ERRNO
355 */
356static int img_ascii_lcd_probe(struct platform_device *pdev)
357{
358 const struct of_device_id *match;
359 const struct img_ascii_lcd_config *cfg;
360 struct img_ascii_lcd_ctx *ctx;
361 struct resource *res;
362 int err;
363
364 match = of_match_device(img_ascii_lcd_matches, &pdev->dev);
365 if (!match)
366 return -ENODEV;
367
368 cfg = match->data;
369 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx) + cfg->num_chars,
370 GFP_KERNEL);
371 if (!ctx)
372 return -ENOMEM;
373
374 if (cfg->external_regmap) {
375 ctx->regmap = syscon_node_to_regmap(pdev->dev.parent->of_node);
376 if (IS_ERR(ctx->regmap))
377 return PTR_ERR(ctx->regmap);
378
379 if (of_property_read_u32(pdev->dev.of_node, "offset",
380 &ctx->offset))
381 return -EINVAL;
382 } else {
383 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
384 ctx->base = devm_ioremap_resource(&pdev->dev, res);
385 if (IS_ERR(ctx->base))
386 return PTR_ERR(ctx->base);
387 }
388
389 ctx->pdev = pdev;
390 ctx->cfg = cfg;
391 ctx->message = NULL;
392 ctx->scroll_pos = 0;
393 ctx->scroll_rate = HZ / 2;
394
395 /* initialise a timer for scrolling the message */
396 init_timer(&ctx->timer);
397 ctx->timer.function = img_ascii_lcd_scroll;
398 ctx->timer.data = (unsigned long)ctx;
399
400 platform_set_drvdata(pdev, ctx);
401
402 /* display a default message */
403 err = img_ascii_lcd_display(ctx, "Linux " UTS_RELEASE " ", -1);
404 if (err)
405 goto out_del_timer;
406
407 err = device_create_file(&pdev->dev, &dev_attr_message);
408 if (err)
409 goto out_del_timer;
410
411 return 0;
412out_del_timer:
413 del_timer_sync(&ctx->timer);
414 return err;
415}
416
417/**
418 * img_ascii_lcd_remove() - remove an LCD display device
419 * @pdev: the LCD platform device
420 *
421 * Remove an LCD display device, freeing private resources & ensuring that the
422 * driver stops using the LCD display registers.
423 *
424 * Return: 0
425 */
426static int img_ascii_lcd_remove(struct platform_device *pdev)
427{
428 struct img_ascii_lcd_ctx *ctx = platform_get_drvdata(pdev);
429
430 device_remove_file(&pdev->dev, &dev_attr_message);
431 del_timer_sync(&ctx->timer);
432 return 0;
433}
434
435static struct platform_driver img_ascii_lcd_driver = {
436 .driver = {
437 .name = "img-ascii-lcd",
438 .of_match_table = img_ascii_lcd_matches,
439 },
440 .probe = img_ascii_lcd_probe,
441 .remove = img_ascii_lcd_remove,
442};
443module_platform_driver(img_ascii_lcd_driver);
diff --git a/drivers/cpuidle/Kconfig.mips b/drivers/cpuidle/Kconfig.mips
index 4102be01d06a..512ee37b374b 100644
--- a/drivers/cpuidle/Kconfig.mips
+++ b/drivers/cpuidle/Kconfig.mips
@@ -5,7 +5,7 @@ config MIPS_CPS_CPUIDLE
5 bool "CPU Idle driver for MIPS CPS platforms" 5 bool "CPU Idle driver for MIPS CPS platforms"
6 depends on CPU_IDLE && MIPS_CPS 6 depends on CPU_IDLE && MIPS_CPS
7 depends on SYS_SUPPORTS_MIPS_CPS 7 depends on SYS_SUPPORTS_MIPS_CPS
8 select ARCH_NEEDS_CPU_IDLE_COUPLED if MIPS_MT 8 select ARCH_NEEDS_CPU_IDLE_COUPLED if MIPS_MT || CPU_MIPSR6
9 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 9 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
10 select MIPS_CPS_PM 10 select MIPS_CPS_PM
11 default y 11 default y
diff --git a/drivers/cpuidle/cpuidle-cps.c b/drivers/cpuidle/cpuidle-cps.c
index 1adb6980b707..926ba9871c62 100644
--- a/drivers/cpuidle/cpuidle-cps.c
+++ b/drivers/cpuidle/cpuidle-cps.c
@@ -163,7 +163,7 @@ static int __init cps_cpuidle_init(void)
163 core = cpu_data[cpu].core; 163 core = cpu_data[cpu].core;
164 device = &per_cpu(cpuidle_dev, cpu); 164 device = &per_cpu(cpuidle_dev, cpu);
165 device->cpu = cpu; 165 device->cpu = cpu;
166#ifdef CONFIG_MIPS_MT 166#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
167 cpumask_copy(&device->coupled_cpus, &cpu_sibling_map[cpu]); 167 cpumask_copy(&device->coupled_cpus, &cpu_sibling_map[cpu]);
168#endif 168#endif
169 169
diff --git a/drivers/irqchip/irq-i8259.c b/drivers/irqchip/irq-i8259.c
index 6b304eb39bd2..1aec12c6d9ac 100644
--- a/drivers/irqchip/irq-i8259.c
+++ b/drivers/irqchip/irq-i8259.c
@@ -38,6 +38,7 @@ static void disable_8259A_irq(struct irq_data *d);
38static void enable_8259A_irq(struct irq_data *d); 38static void enable_8259A_irq(struct irq_data *d);
39static void mask_and_ack_8259A(struct irq_data *d); 39static void mask_and_ack_8259A(struct irq_data *d);
40static void init_8259A(int auto_eoi); 40static void init_8259A(int auto_eoi);
41static int (*i8259_poll)(void) = i8259_irq;
41 42
42static struct irq_chip i8259A_chip = { 43static struct irq_chip i8259A_chip = {
43 .name = "XT-PIC", 44 .name = "XT-PIC",
@@ -51,6 +52,11 @@ static struct irq_chip i8259A_chip = {
51 * 8259A PIC functions to handle ISA devices: 52 * 8259A PIC functions to handle ISA devices:
52 */ 53 */
53 54
55void i8259_set_poll(int (*poll)(void))
56{
57 i8259_poll = poll;
58}
59
54/* 60/*
55 * This contains the irq mask for both 8259A irq controllers, 61 * This contains the irq mask for both 8259A irq controllers,
56 */ 62 */
@@ -89,24 +95,6 @@ static void enable_8259A_irq(struct irq_data *d)
89 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 95 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
90} 96}
91 97
92int i8259A_irq_pending(unsigned int irq)
93{
94 unsigned int mask;
95 unsigned long flags;
96 int ret;
97
98 irq -= I8259A_IRQ_BASE;
99 mask = 1 << irq;
100 raw_spin_lock_irqsave(&i8259A_lock, flags);
101 if (irq < 8)
102 ret = inb(PIC_MASTER_CMD) & mask;
103 else
104 ret = inb(PIC_SLAVE_CMD) & (mask >> 8);
105 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
106
107 return ret;
108}
109
110void make_8259A_irq(unsigned int irq) 98void make_8259A_irq(unsigned int irq)
111{ 99{
112 disable_irq_nosync(irq); 100 disable_irq_nosync(irq);
@@ -355,7 +343,7 @@ void __init init_i8259_irqs(void)
355static void i8259_irq_dispatch(struct irq_desc *desc) 343static void i8259_irq_dispatch(struct irq_desc *desc)
356{ 344{
357 struct irq_domain *domain = irq_desc_get_handler_data(desc); 345 struct irq_domain *domain = irq_desc_get_handler_data(desc);
358 int hwirq = i8259_irq(); 346 int hwirq = i8259_poll();
359 unsigned int irq; 347 unsigned int irq;
360 348
361 if (hwirq < 0) 349 if (hwirq < 0)
@@ -370,13 +358,15 @@ int __init i8259_of_init(struct device_node *node, struct device_node *parent)
370 struct irq_domain *domain; 358 struct irq_domain *domain;
371 unsigned int parent_irq; 359 unsigned int parent_irq;
372 360
361 domain = __init_i8259_irqs(node);
362
373 parent_irq = irq_of_parse_and_map(node, 0); 363 parent_irq = irq_of_parse_and_map(node, 0);
374 if (!parent_irq) { 364 if (!parent_irq) {
375 pr_err("Failed to map i8259 parent IRQ\n"); 365 pr_err("Failed to map i8259 parent IRQ\n");
366 irq_domain_remove(domain);
376 return -ENODEV; 367 return -ENODEV;
377 } 368 }
378 369
379 domain = __init_i8259_irqs(node);
380 irq_set_chained_handler_and_data(parent_irq, i8259_irq_dispatch, 370 irq_set_chained_handler_and_data(parent_irq, i8259_irq_dispatch,
381 domain); 371 domain);
382 return 0; 372 return 0;
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index f811d2796437..e4bf07d20f9b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -29,6 +29,7 @@
29const struct of_device_id of_default_bus_match_table[] = { 29const struct of_device_id of_default_bus_match_table[] = {
30 { .compatible = "simple-bus", }, 30 { .compatible = "simple-bus", },
31 { .compatible = "simple-mfd", }, 31 { .compatible = "simple-mfd", },
32 { .compatible = "isa", },
32#ifdef CONFIG_ARM_AMBA 33#ifdef CONFIG_ARM_AMBA
33 { .compatible = "arm,amba-bus", }, 34 { .compatible = "arm,amba-bus", },
34#endif /* CONFIG_ARM_AMBA */ 35#endif /* CONFIG_ARM_AMBA */
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 1e5f529d51a2..063064801ceb 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1308,11 +1308,6 @@ MODULE_LICENSE ("GPL");
1308#define PLATFORM_DRIVER ehci_mv_driver 1308#define PLATFORM_DRIVER ehci_mv_driver
1309#endif 1309#endif
1310 1310
1311#ifdef CONFIG_MIPS_SEAD3
1312#include "ehci-sead3.c"
1313#define PLATFORM_DRIVER ehci_hcd_sead3_driver
1314#endif
1315
1316static int __init ehci_hcd_init(void) 1311static int __init ehci_hcd_init(void)
1317{ 1312{
1318 int retval = 0; 1313 int retval = 0;
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
deleted file mode 100644
index 3d86cc2ffe68..000000000000
--- a/drivers/usb/host/ehci-sead3.c
+++ /dev/null
@@ -1,185 +0,0 @@
1/*
2 * MIPS CI13320A EHCI Host Controller driver
3 * Based on "ehci-au1xxx.c" by K.Boge <karsten.boge@amd.com>
4 *
5 * Copyright (C) 2012 MIPS Technologies, Inc.
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; either version 2 of the License, or (at your
10 * option) any later version.
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 MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * 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 Foundation,
19 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#include <linux/err.h>
23#include <linux/platform_device.h>
24
25static int ehci_sead3_setup(struct usb_hcd *hcd)
26{
27 int ret;
28 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
29
30 ehci->caps = hcd->regs + 0x100;
31
32#ifdef __BIG_ENDIAN
33 ehci->big_endian_mmio = 1;
34 ehci->big_endian_desc = 1;
35#endif
36
37 ret = ehci_setup(hcd);
38 if (ret)
39 return ret;
40
41 ehci->need_io_watchdog = 0;
42
43 /* Set burst length to 16 words. */
44 ehci_writel(ehci, 0x1010, &ehci->regs->reserved1[1]);
45
46 return ret;
47}
48
49const struct hc_driver ehci_sead3_hc_driver = {
50 .description = hcd_name,
51 .product_desc = "SEAD-3 EHCI",
52 .hcd_priv_size = sizeof(struct ehci_hcd),
53
54 /*
55 * generic hardware linkage
56 */
57 .irq = ehci_irq,
58 .flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
59
60 /*
61 * basic lifecycle operations
62 *
63 */
64 .reset = ehci_sead3_setup,
65 .start = ehci_run,
66 .stop = ehci_stop,
67 .shutdown = ehci_shutdown,
68
69 /*
70 * managing i/o requests and associated device resources
71 */
72 .urb_enqueue = ehci_urb_enqueue,
73 .urb_dequeue = ehci_urb_dequeue,
74 .endpoint_disable = ehci_endpoint_disable,
75 .endpoint_reset = ehci_endpoint_reset,
76
77 /*
78 * scheduling support
79 */
80 .get_frame_number = ehci_get_frame,
81
82 /*
83 * root hub support
84 */
85 .hub_status_data = ehci_hub_status_data,
86 .hub_control = ehci_hub_control,
87 .bus_suspend = ehci_bus_suspend,
88 .bus_resume = ehci_bus_resume,
89 .relinquish_port = ehci_relinquish_port,
90 .port_handed_over = ehci_port_handed_over,
91
92 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
93};
94
95static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
96{
97 struct usb_hcd *hcd;
98 struct resource *res;
99 int ret;
100
101 if (usb_disabled())
102 return -ENODEV;
103
104 if (pdev->resource[1].flags != IORESOURCE_IRQ) {
105 pr_debug("resource[1] is not IORESOURCE_IRQ");
106 return -ENOMEM;
107 }
108 hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
109 if (!hcd)
110 return -ENOMEM;
111
112 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
113 hcd->regs = devm_ioremap_resource(&pdev->dev, res);
114 if (IS_ERR(hcd->regs)) {
115 ret = PTR_ERR(hcd->regs);
116 goto err1;
117 }
118 hcd->rsrc_start = res->start;
119 hcd->rsrc_len = resource_size(res);
120
121 /* Root hub has integrated TT. */
122 hcd->has_tt = 1;
123
124 ret = usb_add_hcd(hcd, pdev->resource[1].start,
125 IRQF_SHARED);
126 if (ret == 0) {
127 platform_set_drvdata(pdev, hcd);
128 device_wakeup_enable(hcd->self.controller);
129 return ret;
130 }
131
132err1:
133 usb_put_hcd(hcd);
134 return ret;
135}
136
137static int ehci_hcd_sead3_drv_remove(struct platform_device *pdev)
138{
139 struct usb_hcd *hcd = platform_get_drvdata(pdev);
140
141 usb_remove_hcd(hcd);
142 usb_put_hcd(hcd);
143
144 return 0;
145}
146
147#ifdef CONFIG_PM
148static int ehci_hcd_sead3_drv_suspend(struct device *dev)
149{
150 struct usb_hcd *hcd = dev_get_drvdata(dev);
151 bool do_wakeup = device_may_wakeup(dev);
152
153 return ehci_suspend(hcd, do_wakeup);
154}
155
156static int ehci_hcd_sead3_drv_resume(struct device *dev)
157{
158 struct usb_hcd *hcd = dev_get_drvdata(dev);
159
160 ehci_resume(hcd, false);
161 return 0;
162}
163
164static const struct dev_pm_ops sead3_ehci_pmops = {
165 .suspend = ehci_hcd_sead3_drv_suspend,
166 .resume = ehci_hcd_sead3_drv_resume,
167};
168
169#define SEAD3_EHCI_PMOPS (&sead3_ehci_pmops)
170
171#else
172#define SEAD3_EHCI_PMOPS NULL
173#endif
174
175static struct platform_driver ehci_hcd_sead3_driver = {
176 .probe = ehci_hcd_sead3_drv_probe,
177 .remove = ehci_hcd_sead3_drv_remove,
178 .shutdown = usb_hcd_platform_shutdown,
179 .driver = {
180 .name = "sead3-ehci",
181 .pm = SEAD3_EHCI_PMOPS,
182 }
183};
184
185MODULE_ALIAS("platform:sead3-ehci");
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index af2f117208f1..5d3b0db5ce0a 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -2187,7 +2187,7 @@ config FB_GOLDFISH
2187 2187
2188config FB_COBALT 2188config FB_COBALT
2189 tristate "Cobalt server LCD frame buffer support" 2189 tristate "Cobalt server LCD frame buffer support"
2190 depends on FB && (MIPS_COBALT || MIPS_SEAD3) 2190 depends on FB && MIPS_COBALT
2191 2191
2192config FB_SH7760 2192config FB_SH7760
2193 bool "SH7760/SH7763/SH7720/SH7721 LCDC support" 2193 bool "SH7760/SH7763/SH7720/SH7721 LCDC support"
diff --git a/drivers/video/fbdev/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c
index 07675d6f323e..2d3b691f3fc4 100644
--- a/drivers/video/fbdev/cobalt_lcdfb.c
+++ b/drivers/video/fbdev/cobalt_lcdfb.c
@@ -63,7 +63,6 @@
63#define LCD_CUR_POS(x) ((x) & LCD_CUR_POS_MASK) 63#define LCD_CUR_POS(x) ((x) & LCD_CUR_POS_MASK)
64#define LCD_TEXT_POS(x) ((x) | LCD_TEXT_MODE) 64#define LCD_TEXT_POS(x) ((x) | LCD_TEXT_MODE)
65 65
66#ifdef CONFIG_MIPS_COBALT
67static inline void lcd_write_control(struct fb_info *info, u8 control) 66static inline void lcd_write_control(struct fb_info *info, u8 control)
68{ 67{
69 writel((u32)control << 24, info->screen_base); 68 writel((u32)control << 24, info->screen_base);
@@ -83,47 +82,6 @@ static inline u8 lcd_read_data(struct fb_info *info)
83{ 82{
84 return readl(info->screen_base + LCD_DATA_REG_OFFSET) >> 24; 83 return readl(info->screen_base + LCD_DATA_REG_OFFSET) >> 24;
85} 84}
86#else
87
88#define LCD_CTL 0x00
89#define LCD_DATA 0x08
90#define CPLD_STATUS 0x10
91#define CPLD_DATA 0x18
92
93static inline void cpld_wait(struct fb_info *info)
94{
95 do {
96 } while (readl(info->screen_base + CPLD_STATUS) & 1);
97}
98
99static inline void lcd_write_control(struct fb_info *info, u8 control)
100{
101 cpld_wait(info);
102 writel(control, info->screen_base + LCD_CTL);
103}
104
105static inline u8 lcd_read_control(struct fb_info *info)
106{
107 cpld_wait(info);
108 readl(info->screen_base + LCD_CTL);
109 cpld_wait(info);
110 return readl(info->screen_base + CPLD_DATA) & 0xff;
111}
112
113static inline void lcd_write_data(struct fb_info *info, u8 data)
114{
115 cpld_wait(info);
116 writel(data, info->screen_base + LCD_DATA);
117}
118
119static inline u8 lcd_read_data(struct fb_info *info)
120{
121 cpld_wait(info);
122 readl(info->screen_base + LCD_DATA);
123 cpld_wait(info);
124 return readl(info->screen_base + CPLD_DATA) & 0xff;
125}
126#endif
127 85
128static int lcd_busy_wait(struct fb_info *info) 86static int lcd_busy_wait(struct fb_info *info)
129{ 87{