Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS updates from Ralf Baechle:

- Improvements to the tlb_dump code
- KVM fixes
- Add support for appended DTB
- Minor improvements to the R12000 support
- Minor improvements to the R12000 support
- Various platform improvments for BCM47xx
- The usual pile of minor cleanups
- A number of BPF fixes and improvments
- Some improvments to the support for R3000 and DECstations
- Some improvments to the ATH79 platform support
- A major patchset for the JZ4740 SOC adding support for the CI20 platform
- Add support for the Pistachio SOC
- Minor BMIPS/BCM63xx platform support improvments.
- Avoid "SYNC 0" as memory barrier when unlocking spinlocks
- Add support for the XWR-1750 board.
- Paul's __cpuinit/__cpuinitdata cleanups.
- New Malta CPU board support large memory so enable ZONE_DMA32.

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (131 commits)
MIPS: spinlock: Adjust arch_spin_lock back-off time
MIPS: asmmacro: Ensure 64-bit FP registers are used with MSA
MIPS: BCM47xx: Simplify handling SPROM revisions
MIPS: Cobalt Don't use module_init in non-modular MTD registration.
MIPS: BCM47xx: Move NVRAM driver to the drivers/firmware/
MIPS: use for_each_sg()
MIPS: BCM47xx: Don't select BCMA_HOST_PCI
MIPS: BCM47xx: Add helper variable for storing NVRAM length
MIPS: IRQ/IP27: Move IRQ allocation API to platform code.
MIPS: Replace smp_mb with release barrier function in unlocks.
MIPS: i8259: DT support
MIPS: Malta: Basic DT plumbing
MIPS: include errno.h for ENODEV in mips-cm.h
MIPS: Define GCR_GIC_STATUS register fields
MIPS: BPF: Introduce BPF ASM helpers
MIPS: BPF: Use BPF register names to describe the ABI
MIPS: BPF: Move register definition to the BPF header
MIPS: net: BPF: Replace RSIZE with SZREG
MIPS: BPF: Free up some callee-saved registers
MIPS: Xtalk: Update xwidget.h with known Xtalk device numbers
...

+8333 -4383
+53
Documentation/devicetree/bindings/clock/ingenic,cgu.txt
··· 1 + Ingenic SoC CGU binding 2 + 3 + The CGU in an Ingenic SoC provides all the clocks generated on-chip. It 4 + typically includes a variety of PLLs, multiplexers, dividers & gates in order 5 + to provide many different clock signals derived from only 2 external source 6 + clocks. 7 + 8 + Required properties: 9 + - compatible : Should be "ingenic,<soctype>-cgu". 10 + For example "ingenic,jz4740-cgu" or "ingenic,jz4780-cgu". 11 + - reg : The address & length of the CGU registers. 12 + - clocks : List of phandle & clock specifiers for clocks external to the CGU. 13 + Two such external clocks should be specified - first the external crystal 14 + "ext" and second the RTC clock source "rtc". 15 + - clock-names : List of name strings for the external clocks. 16 + - #clock-cells: Should be 1. 17 + Clock consumers specify this argument to identify a clock. The valid values 18 + may be found in <dt-bindings/clock/<soctype>-cgu.h>. 19 + 20 + Example SoC include file: 21 + 22 + / { 23 + cgu: jz4740-cgu { 24 + compatible = "ingenic,jz4740-cgu"; 25 + reg = <0x10000000 0x100>; 26 + #clock-cells = <1>; 27 + }; 28 + 29 + uart0: serial@10030000 { 30 + clocks = <&cgu JZ4740_CLK_UART0>; 31 + }; 32 + }; 33 + 34 + Example board file: 35 + 36 + / { 37 + ext: clock@0 { 38 + compatible = "fixed-clock"; 39 + #clock-cells = <0>; 40 + clock-frequency = <12000000>; 41 + }; 42 + 43 + rtc: clock@1 { 44 + compatible = "fixed-clock"; 45 + #clock-cells = <0>; 46 + clock-frequency = <32768>; 47 + }; 48 + 49 + &cgu { 50 + clocks = <&ext> <&rtc>; 51 + clock-names: "ext", "rtc"; 52 + }; 53 + };
+33
Documentation/devicetree/bindings/clock/qca,ath79-pll.txt
··· 1 + Binding for Qualcomm Atheros AR7xxx/AR9XXX PLL controller 2 + 3 + The PPL controller provides the 3 main clocks of the SoC: CPU, DDR and AHB. 4 + 5 + Required Properties: 6 + - compatible: has to be "qca,<soctype>-cpu-intc" and one of the following 7 + fallbacks: 8 + - "qca,ar7100-pll" 9 + - "qca,ar7240-pll" 10 + - "qca,ar9130-pll" 11 + - "qca,ar9330-pll" 12 + - "qca,ar9340-pll" 13 + - "qca,qca9550-pll" 14 + - reg: Base address and size of the controllers memory area 15 + - clock-names: Name of the input clock, has to be "ref" 16 + - clocks: phandle of the external reference clock 17 + - #clock-cells: has to be one 18 + 19 + Optional properties: 20 + - clock-output-names: should be "cpu", "ddr", "ahb" 21 + 22 + Example: 23 + 24 + memory-controller@18050000 { 25 + compatible = "qca,ar9132-ppl", "qca,ar9130-pll"; 26 + reg = <0x18050000 0x20>; 27 + 28 + clock-names = "ref"; 29 + clocks = <&extosc>; 30 + 31 + #clock-cells = <1>; 32 + clock-output-names = "cpu", "ddr", "ahb"; 33 + };
+38
Documentation/devicetree/bindings/gpio/gpio-ath79.txt
··· 1 + Binding for Qualcomm Atheros AR7xxx/AR9xxx GPIO controller 2 + 3 + Required properties: 4 + - compatible: has to be "qca,<soctype>-gpio" and one of the following 5 + fallbacks: 6 + - "qca,ar7100-gpio" 7 + - "qca,ar9340-gpio" 8 + - reg: Base address and size of the controllers memory area 9 + - gpio-controller : Marks the device node as a GPIO controller. 10 + - #gpio-cells : Should be two. The first cell is the pin number and the 11 + second cell is used to specify optional parameters. 12 + - ngpios: Should be set to the number of GPIOs available on the SoC. 13 + 14 + Optional properties: 15 + - interrupt-parent: phandle of the parent interrupt controller. 16 + - interrupts: Interrupt specifier for the controllers interrupt. 17 + - interrupt-controller : Identifies the node as an interrupt controller 18 + - #interrupt-cells : Specifies the number of cells needed to encode interrupt 19 + source, should be 2 20 + 21 + Please refer to interrupts.txt in this directory for details of the common 22 + Interrupt Controllers bindings used by client devices. 23 + 24 + Example: 25 + 26 + gpio@18040000 { 27 + compatible = "qca,ar9132-gpio", "qca,ar7100-gpio"; 28 + reg = <0x18040000 0x30>; 29 + interrupts = <2>; 30 + 31 + ngpios = <22>; 32 + 33 + gpio-controller; 34 + #gpio-cells = <2>; 35 + 36 + interrupt-controller; 37 + #interrupt-cells = <2>; 38 + };
+28
Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.txt
··· 1 + Ingenic SoC Interrupt Controller 2 + 3 + Required properties: 4 + 5 + - compatible : should be "ingenic,<socname>-intc". Valid strings are: 6 + ingenic,jz4740-intc 7 + ingenic,jz4770-intc 8 + ingenic,jz4775-intc 9 + ingenic,jz4780-intc 10 + - reg : Specifies base physical address and size of the registers. 11 + - interrupt-controller : Identifies the node as an interrupt controller 12 + - #interrupt-cells : Specifies the number of cells needed to encode an 13 + interrupt source. The value shall be 1. 14 + - interrupt-parent : phandle of the CPU interrupt controller. 15 + - interrupts : Specifies the CPU interrupt the controller is connected to. 16 + 17 + Example: 18 + 19 + intc: interrupt-controller@10001000 { 20 + compatible = "ingenic,jz4740-intc"; 21 + reg = <0x10001000 0x14>; 22 + 23 + interrupt-controller; 24 + #interrupt-cells = <1>; 25 + 26 + interrupt-parent = <&cpuintc>; 27 + interrupts = <2>; 28 + };
+44
Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt
··· 1 + Binding for Qualcomm Atheros AR7xxx/AR9XXX CPU interrupt controller 2 + 3 + On most SoC the IRQ controller need to flush the DDR FIFO before running 4 + the interrupt handler of some devices. This is configured using the 5 + qca,ddr-wb-channels and qca,ddr-wb-channel-interrupts properties. 6 + 7 + Required Properties: 8 + 9 + - compatible: has to be "qca,<soctype>-cpu-intc", "qca,ar7100-cpu-intc" 10 + as fallback 11 + - interrupt-controller : Identifies the node as an interrupt controller 12 + - #interrupt-cells : Specifies the number of cells needed to encode interrupt 13 + source, should be 1 for intc 14 + 15 + Please refer to interrupts.txt in this directory for details of the common 16 + Interrupt Controllers bindings used by client devices. 17 + 18 + Optional Properties: 19 + 20 + - qca,ddr-wb-channel-interrupts: List of the interrupts needing a write 21 + buffer flush 22 + - qca,ddr-wb-channels: List of phandles to the write buffer channels for 23 + each interrupt. If qca,ddr-wb-channel-interrupts is not present the interrupt 24 + default to the entry's index. 25 + 26 + Example: 27 + 28 + interrupt-controller { 29 + compatible = "qca,ar9132-cpu-intc", "qca,ar7100-cpu-intc"; 30 + 31 + interrupt-controller; 32 + #interrupt-cells = <1>; 33 + 34 + qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; 35 + qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, 36 + <&ddr_ctrl 0>, <&ddr_ctrl 1>; 37 + }; 38 + 39 + ... 40 + 41 + ddr_ctrl: memory-controller@18000000 { 42 + ... 43 + #qca,ddr-wb-channel-cells = <1>; 44 + };
+30
Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt
··· 1 + Binding for Qualcomm Atheros AR7xxx/AR9XXX MISC interrupt controller 2 + 3 + The MISC interrupt controller is a secondary controller for lower priority 4 + interrupt. 5 + 6 + Required Properties: 7 + - compatible: has to be "qca,<soctype>-cpu-intc", "qca,ar7100-misc-intc" 8 + as fallback 9 + - reg: Base address and size of the controllers memory area 10 + - interrupt-parent: phandle of the parent interrupt controller. 11 + - interrupts: Interrupt specifier for the controllers interrupt. 12 + - interrupt-controller : Identifies the node as an interrupt controller 13 + - #interrupt-cells : Specifies the number of cells needed to encode interrupt 14 + source, should be 1 15 + 16 + Please refer to interrupts.txt in this directory for details of the common 17 + Interrupt Controllers bindings used by client devices. 18 + 19 + Example: 20 + 21 + interrupt-controller@18060010 { 22 + compatible = "qca,ar9132-misc-intc", qca,ar7100-misc-intc"; 23 + reg = <0x18060010 0x4>; 24 + 25 + interrupt-parent = <&cpuintc>; 26 + interrupts = <6>; 27 + 28 + interrupt-controller; 29 + #interrupt-cells = <1>; 30 + };
+35
Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt
··· 1 + Binding for Qualcomm Atheros AR7xxx/AR9xxx DDR controller 2 + 3 + The DDR controller of the ARxxx and AR9xxx families provides an interface 4 + to flush the FIFO between various devices and the DDR. This is mainly used 5 + by the IRQ controller to flush the FIFO before running the interrupt handler 6 + of such devices. 7 + 8 + Required properties: 9 + 10 + - compatible: has to be "qca,<soc-type>-ddr-controller", 11 + "qca,[ar7100|ar7240]-ddr-controller" as fallback. 12 + On SoC with PCI support "qca,ar7100-ddr-controller" should be used as 13 + fallback, otherwise "qca,ar7240-ddr-controller" should be used. 14 + - reg: Base address and size of the controllers memory area 15 + - #qca,ddr-wb-channel-cells: has to be 1, the index of the write buffer 16 + channel 17 + 18 + Example: 19 + 20 + ddr_ctrl: memory-controller@18000000 { 21 + compatible = "qca,ar9132-ddr-controller", 22 + "qca,ar7240-ddr-controller"; 23 + reg = <0x18000000 0x100>; 24 + 25 + #qca,ddr-wb-channel-cells = <1>; 26 + }; 27 + 28 + ... 29 + 30 + interrupt-controller { 31 + ... 32 + qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; 33 + qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, 34 + <&ddr_ctrl 0>, <&ddr_ctrl 1>; 35 + };
+21
Documentation/devicetree/bindings/mips/ath79-soc.txt
··· 1 + Binding for Qualcomm Atheros AR7xxx/AR9XXX SoC 2 + 3 + Each device tree must specify a compatible value for the AR SoC 4 + it uses in the compatible property of the root node. The compatible 5 + value must be one of the following values: 6 + 7 + - qca,ar7130 8 + - qca,ar7141 9 + - qca,ar7161 10 + - qca,ar7240 11 + - qca,ar7241 12 + - qca,ar7242 13 + - qca,ar9130 14 + - qca,ar9132 15 + - qca,ar9330 16 + - qca,ar9331 17 + - qca,ar9341 18 + - qca,ar9342 19 + - qca,ar9344 20 + - qca,qca9556 21 + - qca,qca9558
+29
Documentation/devicetree/bindings/phy/pistachio-usb-phy.txt
··· 1 + IMG Pistachio USB PHY 2 + ===================== 3 + 4 + Required properties: 5 + -------------------- 6 + - compatible: Must be "img,pistachio-usb-phy". 7 + - #phy-cells: Must be 0. See ./phy-bindings.txt for details. 8 + - clocks: Must contain an entry for each entry in clock-names. 9 + See ../clock/clock-bindings.txt for details. 10 + - clock-names: Must include "usb_phy". 11 + - img,cr-top: Must constain a phandle to the CR_TOP syscon node. 12 + - img,refclk: Indicates the reference clock source for the USB PHY. 13 + See <dt-bindings/phy/phy-pistachio-usb.h> for a list of valid values. 14 + 15 + Optional properties: 16 + -------------------- 17 + - phy-supply: USB VBUS supply. Must supply 5.0V. 18 + 19 + Example: 20 + -------- 21 + usb_phy: usb-phy { 22 + compatible = "img,pistachio-usb-phy"; 23 + clocks = <&clk_core CLK_USB_PHY>; 24 + clock-names = "usb_phy"; 25 + phy-supply = <&usb_vbus>; 26 + img,refclk = <REFCLK_CLK_CORE>; 27 + img,cr-top = <&cr_top>; 28 + #phy-cells = <0>; 29 + };
+22
Documentation/devicetree/bindings/serial/ingenic,uart.txt
··· 1 + * Ingenic SoC UART 2 + 3 + Required properties: 4 + - compatible : "ingenic,jz4740-uart" or "ingenic,jz4780-uart" 5 + - reg : offset and length of the register set for the device. 6 + - interrupts : should contain uart interrupt. 7 + - clocks : phandles to the module & baud clocks. 8 + - clock-names: tuple listing input clock names. 9 + Required elements: "baud", "module" 10 + 11 + Example: 12 + 13 + uart0: serial@10030000 { 14 + compatible = "ingenic,jz4740-uart"; 15 + reg = <0x10030000 0x100>; 16 + 17 + interrupt-parent = <&intc>; 18 + interrupts = <9>; 19 + 20 + clocks = <&ext>, <&cgu JZ4740_CLK_UART0>; 21 + clock-names = "baud", "module"; 22 + };
+3
Documentation/devicetree/bindings/vendor-prefixes.txt
··· 106 106 idt Integrated Device Technologies, Inc. 107 107 iom Iomega Corporation 108 108 img Imagination Technologies Ltd. 109 + ingenic Ingenic Semiconductor 109 110 innolux Innolux Corporation 110 111 intel Intel Corporation 111 112 intercontrol Inter Control Group ··· 162 161 qca Qualcomm Atheros, Inc. 163 162 qcom Qualcomm Technologies, Inc 164 163 qemu QEMU, a generic and open source machine emulator and virtualizer 164 + qi Qi Hardware 165 165 qnap QNAP Systems, Inc. 166 166 radxa Radxa 167 167 raidsonic RaidSonic Technology GmbH ··· 208 206 toradex Toradex AG 209 207 toshiba Toshiba Corporation 210 208 toumaz Toumaz 209 + tplink TP-LINK Technologies Co., Ltd. 211 210 truly Truly Semiconductors Limited 212 211 usi Universal Scientific Industrial Co., Ltd. 213 212 v3 V3 Semiconductor
+14
MAINTAINERS
··· 2229 2229 F: arch/mips/include/asm/mach-bcm3384/* 2230 2230 F: arch/mips/kernel/*bmips* 2231 2231 2232 + BROADCOM BCM47XX MIPS ARCHITECTURE 2233 + M: Hauke Mehrtens <hauke@hauke-m.de> 2234 + M: Rafał Miłecki <zajec5@gmail.com> 2235 + L: linux-mips@linux-mips.org 2236 + S: Maintained 2237 + F: arch/mips/bcm47xx/* 2238 + F: arch/mips/include/asm/mach-bcm47xx/* 2239 + 2232 2240 BROADCOM BCM5301X ARM ARCHITECTURE 2233 2241 M: Hauke Mehrtens <hauke@hauke-m.de> 2234 2242 L: linux-arm-kernel@lists.infradead.org ··· 2340 2332 S: Supported 2341 2333 F: drivers/gpio/gpio-bcm-kona.c 2342 2334 F: Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt 2335 + 2336 + BROADCOM NVRAM DRIVER 2337 + M: Rafał Miłecki <zajec5@gmail.com> 2338 + L: linux-mips@linux-mips.org 2339 + S: Maintained 2340 + F: drivers/firmware/broadcom/* 2343 2341 2344 2342 BROADCOM STB NAND FLASH DRIVER 2345 2343 M: Brian Norris <computersforpeace@gmail.com>
+2 -2
arch/mips/Kbuild.platforms
··· 15 15 platforms += jz4740 16 16 platforms += lantiq 17 17 platforms += lasat 18 - platforms += loongson 19 - platforms += loongson1 18 + platforms += loongson32 19 + platforms += loongson64 20 20 platforms += mti-malta 21 21 platforms += mti-sead3 22 22 platforms += netlogic
+109 -54
arch/mips/Kconfig
··· 21 21 select HAVE_FUNCTION_GRAPH_TRACER 22 22 select HAVE_KPROBES 23 23 select HAVE_KRETPROBES 24 + select HAVE_SYSCALL_TRACEPOINTS 24 25 select HAVE_DEBUG_KMEMLEAK 25 26 select HAVE_SYSCALL_TRACEPOINTS 26 27 select ARCH_HAS_ELF_RANDOMIZE 27 28 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT 28 - select RTC_LIB if !MACH_LOONGSON 29 + select RTC_LIB if !MACH_LOONGSON64 29 30 select GENERIC_ATOMIC64 if !64BIT 30 31 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 31 32 select HAVE_DMA_ATTRS ··· 71 70 select ARCH_PHYS_ADDR_T_64BIT 72 71 select CEVT_R4K 73 72 select CSRC_R4K 74 - select IRQ_CPU 73 + select IRQ_MIPS_CPU 75 74 select DMA_MAYBE_COHERENT # Au1000,1500,1100 aren't, rest is 76 75 select SYS_HAS_CPU_MIPS32_R1 77 76 select SYS_SUPPORTS_32BIT_KERNEL ··· 86 85 select DMA_NONCOHERENT 87 86 select CEVT_R4K 88 87 select CSRC_R4K 89 - select IRQ_CPU 88 + select IRQ_MIPS_CPU 90 89 select NO_EXCEPT_FILL 91 90 select SWAP_IO_SPACE 92 91 select SYS_HAS_CPU_MIPS32_R1 ··· 107 106 select CEVT_R4K 108 107 select CSRC_R4K 109 108 select DMA_NONCOHERENT 110 - select IRQ_CPU 109 + select IRQ_MIPS_CPU 111 110 select IRQ_DOMAIN 112 111 select SYS_HAS_CPU_MIPS32_R1 113 112 select SYS_SUPPORTS_BIG_ENDIAN ··· 124 123 select CSRC_R4K 125 124 select DMA_NONCOHERENT 126 125 select HAVE_CLK 126 + select COMMON_CLK 127 127 select CLKDEV_LOOKUP 128 - select IRQ_CPU 128 + select IRQ_MIPS_CPU 129 129 select MIPS_MACHINE 130 130 select SYS_HAS_CPU_MIPS32_R2 131 131 select SYS_HAS_EARLY_PRINTK 132 132 select SYS_SUPPORTS_32BIT_KERNEL 133 133 select SYS_SUPPORTS_BIG_ENDIAN 134 134 select SYS_SUPPORTS_MIPS16 135 + select SYS_SUPPORTS_ZBOOT 136 + select USE_OF 135 137 help 136 138 Support for the Atheros AR71XX/AR724X/AR913X SoCs. 137 139 ··· 150 146 select BCM7038_L1_IRQ 151 147 select BCM7120_L2_IRQ 152 148 select BRCMSTB_L2_IRQ 153 - select IRQ_CPU 149 + select IRQ_MIPS_CPU 154 150 select RAW_IRQ_ACCESSORS 155 151 select DMA_NONCOHERENT 156 152 select SYS_SUPPORTS_32BIT_KERNEL ··· 180 176 select CSRC_R4K 181 177 select DMA_NONCOHERENT 182 178 select HW_HAS_PCI 183 - select IRQ_CPU 179 + select IRQ_MIPS_CPU 184 180 select SYS_HAS_CPU_MIPS32_R1 185 181 select NO_EXCEPT_FILL 186 182 select SYS_SUPPORTS_32BIT_KERNEL ··· 190 186 select USE_GENERIC_EARLY_PRINTK_8250 191 187 select GPIOLIB 192 188 select LEDS_GPIO_REGISTER 189 + select BCM47XX_NVRAM 193 190 help 194 191 Support for BCM47XX based boards 195 192 ··· 201 196 select CSRC_R4K 202 197 select SYNC_R4K 203 198 select DMA_NONCOHERENT 204 - select IRQ_CPU 199 + select IRQ_MIPS_CPU 205 200 select SYS_SUPPORTS_32BIT_KERNEL 206 201 select SYS_SUPPORTS_BIG_ENDIAN 207 202 select SYS_HAS_EARLY_PRINTK ··· 221 216 select HW_HAS_PCI 222 217 select I8253 223 218 select I8259 224 - select IRQ_CPU 219 + select IRQ_MIPS_CPU 225 220 select IRQ_GT641XX 226 221 select PCI_GT64XXX_PCI0 227 222 select PCI ··· 244 239 select CPU_R4400_WORKAROUNDS if 64BIT 245 240 select DMA_NONCOHERENT 246 241 select NO_IOPORT_MAP 247 - select IRQ_CPU 242 + select IRQ_MIPS_CPU 248 243 select SYS_HAS_CPU_R3000 249 244 select SYS_HAS_CPU_R4X00 250 245 select SYS_SUPPORTS_32BIT_KERNEL ··· 279 274 select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN 280 275 select GENERIC_ISA_DMA 281 276 select HAVE_PCSPKR_PLATFORM 282 - select IRQ_CPU 277 + select IRQ_MIPS_CPU 283 278 select I8253 284 279 select I8259 285 280 select ISA ··· 293 288 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and 294 289 Olivetti M700-10 workstations. 295 290 296 - config MACH_JZ4740 297 - bool "Ingenic JZ4740 based machines" 298 - select SYS_HAS_CPU_MIPS32_R1 291 + config MACH_INGENIC 292 + bool "Ingenic SoC based machines" 299 293 select SYS_SUPPORTS_32BIT_KERNEL 300 294 select SYS_SUPPORTS_LITTLE_ENDIAN 301 295 select SYS_SUPPORTS_ZBOOT_UART16550 302 296 select DMA_NONCOHERENT 303 - select IRQ_CPU 297 + select IRQ_MIPS_CPU 304 298 select ARCH_REQUIRE_GPIOLIB 305 - select SYS_HAS_EARLY_PRINTK 306 - select HAVE_CLK 299 + select COMMON_CLK 307 300 select GENERIC_IRQ_CHIP 301 + select BUILTIN_DTB 302 + select USE_OF 303 + select LIBFDT 308 304 309 305 config LANTIQ 310 306 bool "Lantiq based platforms" 311 307 select DMA_NONCOHERENT 312 - select IRQ_CPU 308 + select IRQ_MIPS_CPU 313 309 select CEVT_R4K 314 310 select CSRC_R4K 315 311 select SYS_HAS_CPU_MIPS32_R1 ··· 339 333 select DMA_NONCOHERENT 340 334 select SYS_HAS_EARLY_PRINTK 341 335 select HW_HAS_PCI 342 - select IRQ_CPU 336 + select IRQ_MIPS_CPU 343 337 select PCI_GT64XXX_PCI0 344 338 select MIPS_NILE4 345 339 select R5000_CPU_SCACHE ··· 348 342 select SYS_SUPPORTS_64BIT_KERNEL if BROKEN 349 343 select SYS_SUPPORTS_LITTLE_ENDIAN 350 344 351 - config MACH_LOONGSON 352 - bool "Loongson family of machines" 345 + config MACH_LOONGSON32 346 + bool "Loongson-1 family of machines" 353 347 select SYS_SUPPORTS_ZBOOT 354 348 help 355 - This enables the support of Loongson family of machines. 349 + This enables support for the Loongson-1 family of machines. 356 350 357 - Loongson is a family of general-purpose MIPS-compatible CPUs. 358 - developed at Institute of Computing Technology (ICT), 359 - Chinese Academy of Sciences (CAS) in the People's Republic 360 - of China. The chief architect is Professor Weiwu Hu. 351 + Loongson-1 is a family of 32-bit MIPS-compatible SoCs developed by 352 + the Institute of Computing Technology (ICT), Chinese Academy of 353 + Sciences (CAS). 361 354 362 - config MACH_LOONGSON1 363 - bool "Loongson 1 family of machines" 355 + config MACH_LOONGSON64 356 + bool "Loongson-2/3 family of machines" 364 357 select SYS_SUPPORTS_ZBOOT 365 358 help 366 - This enables support for the Loongson 1 based machines. 359 + This enables the support of Loongson-2/3 family of machines. 367 360 368 - Loongson 1 is a family of 32-bit MIPS-compatible SoCs developed by 369 - the ICT (Institute of Computing Technology) and the Chinese Academy 370 - of Sciences. 361 + Loongson-2 is a family of single-core CPUs and Loongson-3 is a 362 + family of multi-core CPUs. They are both 64-bit general-purpose 363 + MIPS-compatible CPUs. Loongson-2/3 are developed by the Institute 364 + of Computing Technology (ICT), Chinese Academy of Sciences (CAS) 365 + in the People's Republic of China. The chief architect is Professor 366 + Weiwu Hu. 371 367 372 368 config MACH_PISTACHIO 373 369 bool "IMG Pistachio SoC based boards" ··· 381 373 select COMMON_CLK 382 374 select CSRC_R4K 383 375 select DMA_MAYBE_COHERENT 384 - select IRQ_CPU 376 + select IRQ_MIPS_CPU 385 377 select LIBFDT 386 378 select MFD_SYSCON 387 379 select MIPS_CPU_SCACHE ··· 394 386 select SYS_SUPPORTS_MIPS_CPS 395 387 select SYS_SUPPORTS_MULTITHREADING 396 388 select SYS_SUPPORTS_ZBOOT 389 + select SYS_HAS_EARLY_PRINTK 390 + select USE_GENERIC_EARLY_PRINTK_8250 397 391 select USE_OF 398 392 help 399 393 This enables support for the IMG Pistachio SoC platform. ··· 405 395 select ARCH_MAY_HAVE_PC_FDC 406 396 select BOOT_ELF32 407 397 select BOOT_RAW 398 + select BUILTIN_DTB 408 399 select CEVT_R4K 409 400 select CSRC_R4K 410 401 select CLKSRC_MIPS_GIC 411 402 select DMA_MAYBE_COHERENT 412 403 select GENERIC_ISA_DMA 413 404 select HAVE_PCSPKR_PLATFORM 414 - select IRQ_CPU 405 + select IRQ_MIPS_CPU 415 406 select MIPS_GIC 416 407 select HW_HAS_PCI 417 408 select I8253 ··· 445 434 select SYS_SUPPORTS_MULTITHREADING 446 435 select SYS_SUPPORTS_SMARTMIPS 447 436 select SYS_SUPPORTS_ZBOOT 437 + select USE_OF 438 + select ZONE_DMA32 if 64BIT 448 439 help 449 440 This enables support for the MIPS Technologies Malta evaluation 450 441 board. ··· 462 449 select CPU_MIPSR2_IRQ_VI 463 450 select CPU_MIPSR2_IRQ_EI 464 451 select DMA_NONCOHERENT 465 - select IRQ_CPU 452 + select IRQ_MIPS_CPU 466 453 select MIPS_GIC 467 454 select LIBFDT 468 455 select MIPS_MSC ··· 525 512 select SYS_SUPPORTS_32BIT_KERNEL 526 513 select SYS_SUPPORTS_BIG_ENDIAN 527 514 select SYS_SUPPORTS_MIPS16 528 - select IRQ_CPU 515 + select IRQ_MIPS_CPU 529 516 select SERIAL_8250 530 517 select SERIAL_8250_CONSOLE 531 518 select USB_EHCI_BIG_ENDIAN_MMIO ··· 542 529 select CSRC_R4K 543 530 select BOOT_RAW 544 531 select DMA_NONCOHERENT 545 - select IRQ_CPU 532 + select IRQ_MIPS_CPU 546 533 select USE_OF 547 534 select SYS_HAS_CPU_MIPS32_R1 548 535 select SYS_HAS_CPU_MIPS32_R2 ··· 568 555 select I8253 569 556 select I8259 570 557 select IP22_CPU_SCACHE 571 - select IRQ_CPU 558 + select IRQ_MIPS_CPU 572 559 select GENERIC_ISA_DMA_SUPPORT_BROKEN 573 560 select SGI_HAS_I8042 574 561 select SGI_HAS_INDYDOG ··· 627 614 select DEFAULT_SGI_PARTITION 628 615 select DMA_NONCOHERENT 629 616 select GENERIC_ISA_DMA_SUPPORT_BROKEN 630 - select IRQ_CPU 617 + select IRQ_MIPS_CPU 631 618 select HW_HAS_EISA 632 619 select I8253 633 620 select I8259 ··· 663 650 select CSRC_R4K 664 651 select DMA_NONCOHERENT 665 652 select HW_HAS_PCI 666 - select IRQ_CPU 653 + select IRQ_MIPS_CPU 667 654 select R5000_CPU_SCACHE 668 655 select RM7000_CPU_SCACHE 669 656 select SYS_HAS_CPU_R5000 ··· 779 766 select HAVE_PCSPKR_PLATFORM 780 767 select HW_HAS_EISA 781 768 select HW_HAS_PCI 782 - select IRQ_CPU 769 + select IRQ_MIPS_CPU 783 770 select I8253 784 771 select I8259 785 772 select ISA ··· 812 799 select CSRC_R4K 813 800 select DMA_NONCOHERENT 814 801 select HW_HAS_PCI 815 - select IRQ_CPU 802 + select IRQ_MIPS_CPU 816 803 select SYS_HAS_CPU_MIPS32_R1 817 804 select SYS_SUPPORTS_32BIT_KERNEL 818 805 select SYS_SUPPORTS_LITTLE_ENDIAN ··· 879 866 select NR_CPUS_DEFAULT_32 880 867 select CEVT_R4K 881 868 select CSRC_R4K 882 - select IRQ_CPU 869 + select IRQ_MIPS_CPU 883 870 select ZONE_DMA32 if 64BIT 884 871 select SYNC_R4K 885 872 select SYS_HAS_EARLY_PRINTK ··· 906 893 select NR_CPUS_DEFAULT_32 907 894 select CEVT_R4K 908 895 select CSRC_R4K 909 - select IRQ_CPU 896 + select IRQ_MIPS_CPU 910 897 select ZONE_DMA32 if 64BIT 911 898 select SYNC_R4K 912 899 select SYS_HAS_EARLY_PRINTK ··· 955 942 source "arch/mips/txx9/Kconfig" 956 943 source "arch/mips/vr41xx/Kconfig" 957 944 source "arch/mips/cavium-octeon/Kconfig" 958 - source "arch/mips/loongson/Kconfig" 959 - source "arch/mips/loongson1/Kconfig" 945 + source "arch/mips/loongson32/Kconfig" 946 + source "arch/mips/loongson64/Kconfig" 960 947 source "arch/mips/netlogic/Kconfig" 961 948 source "arch/mips/paravirt/Kconfig" 962 949 ··· 1155 1142 config MIPS_HUGE_TLB_SUPPORT 1156 1143 def_bool HUGETLB_PAGE || TRANSPARENT_HUGEPAGE 1157 1144 1158 - config IRQ_CPU 1159 - bool 1160 - select IRQ_DOMAIN 1161 - 1162 1145 config IRQ_CPU_RM7K 1163 1146 bool 1164 1147 ··· 1181 1172 select CEVT_R4K 1182 1173 select CSRC_R4K 1183 1174 select DMA_NONCOHERENT 1184 - select IRQ_CPU 1175 + select IRQ_MIPS_CPU 1185 1176 select SWAP_IO_SPACE 1186 1177 select SYS_HAS_CPU_R5500 1187 1178 select SYS_SUPPORTS_32BIT_KERNEL ··· 1192 1183 bool 1193 1184 select CEVT_R4K 1194 1185 select CSRC_R4K 1195 - select IRQ_CPU 1186 + select IRQ_MIPS_CPU 1196 1187 select DMA_NONCOHERENT 1197 1188 select SYS_HAS_CPU_MIPS32_R2 1198 1189 select SYS_SUPPORTS_32BIT_KERNEL ··· 1578 1569 select WEAK_ORDERING 1579 1570 select CPU_SUPPORTS_HIGHMEM 1580 1571 select CPU_SUPPORTS_HUGEPAGES 1581 - select USB_EHCI_BIG_ENDIAN_MMIO 1572 + select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN 1573 + select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN 1582 1574 select MIPS_L1_CACHE_SHIFT_7 1583 1575 help 1584 1576 The Cavium Octeon processor is a highly integrated chip containing ··· 1597 1587 select CPU_BMIPS5000 if SYS_HAS_CPU_BMIPS5000 1598 1588 select CPU_SUPPORTS_32BIT_KERNEL 1599 1589 select DMA_NONCOHERENT 1600 - select IRQ_CPU 1590 + select IRQ_MIPS_CPU 1601 1591 select SWAP_IO_SPACE 1602 1592 select WEAK_ORDERING 1603 1593 select CPU_SUPPORTS_HIGHMEM ··· 2681 2671 2682 2672 config BUILTIN_DTB 2683 2673 bool 2674 + 2675 + choice 2676 + prompt "Kernel appended dtb support" if OF 2677 + default MIPS_NO_APPENDED_DTB 2678 + 2679 + config MIPS_NO_APPENDED_DTB 2680 + bool "None" 2681 + help 2682 + Do not enable appended dtb support. 2683 + 2684 + config MIPS_RAW_APPENDED_DTB 2685 + bool "vmlinux.bin" 2686 + help 2687 + With this option, the boot code will look for a device tree binary 2688 + DTB) appended to raw vmlinux.bin (without decompressor). 2689 + (e.g. cat vmlinux.bin <filename>.dtb > vmlinux_w_dtb). 2690 + 2691 + This is meant as a backward compatibility convenience for those 2692 + systems with a bootloader that can't be upgraded to accommodate 2693 + the documented boot protocol using a device tree. 2694 + 2695 + Beware that there is very little in terms of protection against 2696 + this option being confused by leftover garbage in memory that might 2697 + look like a DTB header after a reboot if no actual DTB is appended 2698 + to vmlinux.bin. Do not leave this option active in a production kernel 2699 + if you don't intend to always append a DTB. 2700 + 2701 + config MIPS_ZBOOT_APPENDED_DTB 2702 + bool "vmlinuz.bin" 2703 + depends on SYS_SUPPORTS_ZBOOT 2704 + help 2705 + With this option, the boot code will look for a device tree binary 2706 + DTB) appended to raw vmlinuz.bin (with decompressor). 2707 + (e.g. cat vmlinuz.bin <filename>.dtb > vmlinuz_w_dtb). 2708 + 2709 + This is meant as a backward compatibility convenience for those 2710 + systems with a bootloader that can't be upgraded to accommodate 2711 + the documented boot protocol using a device tree. 2712 + 2713 + Beware that there is very little in terms of protection against 2714 + this option being confused by leftover garbage in memory that might 2715 + look like a DTB header after a reboot if no actual DTB is appended 2716 + to vmlinuz.bin. Do not leave this option active in a production kernel 2717 + if you don't intend to always append a DTB. 2718 + endchoice 2684 2719 2685 2720 endmenu 2686 2721
+3 -3
arch/mips/alchemy/common/clock.c
··· 752 752 switch (ctype) { 753 753 case ALCHEMY_CPU_AU1000...ALCHEMY_CPU_AU1200: 754 754 id.ops = &alchemy_clkops_fgenv1; 755 - id.parent_names = (const char **)alchemy_clk_fgv1_parents; 755 + id.parent_names = alchemy_clk_fgv1_parents; 756 756 id.num_parents = 2; 757 757 break; 758 758 case ALCHEMY_CPU_AU1300: 759 759 id.ops = &alchemy_clkops_fgenv2; 760 - id.parent_names = (const char **)alchemy_clk_fgv2_parents; 760 + id.parent_names = alchemy_clk_fgv2_parents; 761 761 id.num_parents = 3; 762 762 break; 763 763 default: ··· 961 961 struct clk *c; 962 962 963 963 id.ops = &alchemy_clkops_csrc; 964 - id.parent_names = (const char **)alchemy_clk_csrc_parents; 964 + id.parent_names = alchemy_clk_csrc_parents; 965 965 id.num_parents = 7; 966 966 id.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE; 967 967
+1 -1
arch/mips/ath25/ar2315.c
··· 76 76 unsigned nr, misc_irq = 0; 77 77 78 78 if (pending) { 79 - struct irq_domain *domain = irq_get_handler_data(irq); 79 + struct irq_domain *domain = irq_desc_get_handler_data(desc); 80 80 81 81 nr = __ffs(pending); 82 82 misc_irq = irq_find_mapping(domain, nr);
+1 -1
arch/mips/ath25/ar5312.c
··· 80 80 unsigned nr, misc_irq = 0; 81 81 82 82 if (pending) { 83 - struct irq_domain *domain = irq_get_handler_data(irq); 83 + struct irq_domain *domain = irq_desc_get_handler_data(desc); 84 84 85 85 nr = __ffs(pending); 86 86 misc_irq = irq_find_mapping(domain, nr);
+1 -1
arch/mips/ath25/board.c
··· 216 216 ar2315_plat_time_init(); 217 217 } 218 218 219 - unsigned int __cpuinit get_c0_compare_int(void) 219 + unsigned int get_c0_compare_int(void) 220 220 { 221 221 return CP0_LEGACY_COMPARE_IRQ; 222 222 }
+12
arch/mips/ath79/Kconfig
··· 71 71 Say 'Y' here if you want your kernel to support the 72 72 Ubiquiti Networks XM (rev 1.0) board. 73 73 74 + choice 75 + prompt "Build a DTB in the kernel" 76 + optional 77 + help 78 + Select a devicetree that should be built into the kernel. 79 + 80 + config DTB_TL_WR1043ND_V1 81 + bool "TL-WR1043ND Version 1" 82 + select BUILTIN_DTB 83 + select SOC_AR913X 84 + endchoice 85 + 74 86 endmenu 75 87 76 88 config SOC_AR71XX
+43 -43
arch/mips/ath79/clock.c
··· 17 17 #include <linux/err.h> 18 18 #include <linux/clk.h> 19 19 #include <linux/clkdev.h> 20 + #include <linux/clk-provider.h> 20 21 21 22 #include <asm/div64.h> 22 23 ··· 29 28 #define AR724X_BASE_FREQ 5000000 30 29 #define AR913X_BASE_FREQ 5000000 31 30 32 - struct clk { 33 - unsigned long rate; 31 + static struct clk *clks[3]; 32 + static struct clk_onecell_data clk_data = { 33 + .clks = clks, 34 + .clk_num = ARRAY_SIZE(clks), 34 35 }; 35 36 36 - static void __init ath79_add_sys_clkdev(const char *id, unsigned long rate) 37 + static struct clk *__init ath79_add_sys_clkdev( 38 + const char *id, unsigned long rate) 37 39 { 38 40 struct clk *clk; 39 41 int err; 40 42 41 - clk = kzalloc(sizeof(*clk), GFP_KERNEL); 43 + clk = clk_register_fixed_rate(NULL, id, NULL, CLK_IS_ROOT, rate); 42 44 if (!clk) 43 45 panic("failed to allocate %s clock structure", id); 44 - 45 - clk->rate = rate; 46 46 47 47 err = clk_register_clkdev(clk, id, NULL); 48 48 if (err) 49 49 panic("unable to register %s clock device", id); 50 + 51 + return clk; 50 52 } 51 53 52 54 static void __init ar71xx_clocks_init(void) ··· 66 62 67 63 pll = ath79_pll_rr(AR71XX_PLL_REG_CPU_CONFIG); 68 64 69 - div = ((pll >> AR71XX_PLL_DIV_SHIFT) & AR71XX_PLL_DIV_MASK) + 1; 65 + div = ((pll >> AR71XX_PLL_FB_SHIFT) & AR71XX_PLL_FB_MASK) + 1; 70 66 freq = div * ref_rate; 71 67 72 68 div = ((pll >> AR71XX_CPU_DIV_SHIFT) & AR71XX_CPU_DIV_MASK) + 1; ··· 79 75 ahb_rate = cpu_rate / div; 80 76 81 77 ath79_add_sys_clkdev("ref", ref_rate); 82 - ath79_add_sys_clkdev("cpu", cpu_rate); 83 - ath79_add_sys_clkdev("ddr", ddr_rate); 84 - ath79_add_sys_clkdev("ahb", ahb_rate); 78 + clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); 79 + clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); 80 + clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); 85 81 86 82 clk_add_alias("wdt", NULL, "ahb", NULL); 87 83 clk_add_alias("uart", NULL, "ahb", NULL); ··· 100 96 ref_rate = AR724X_BASE_FREQ; 101 97 pll = ath79_pll_rr(AR724X_PLL_REG_CPU_CONFIG); 102 98 103 - div = ((pll >> AR724X_PLL_DIV_SHIFT) & AR724X_PLL_DIV_MASK); 99 + div = ((pll >> AR724X_PLL_FB_SHIFT) & AR724X_PLL_FB_MASK); 104 100 freq = div * ref_rate; 105 101 106 102 div = ((pll >> AR724X_PLL_REF_DIV_SHIFT) & AR724X_PLL_REF_DIV_MASK); ··· 115 111 ahb_rate = cpu_rate / div; 116 112 117 113 ath79_add_sys_clkdev("ref", ref_rate); 118 - ath79_add_sys_clkdev("cpu", cpu_rate); 119 - ath79_add_sys_clkdev("ddr", ddr_rate); 120 - ath79_add_sys_clkdev("ahb", ahb_rate); 114 + clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); 115 + clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); 116 + clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); 121 117 122 118 clk_add_alias("wdt", NULL, "ahb", NULL); 123 119 clk_add_alias("uart", NULL, "ahb", NULL); ··· 136 132 ref_rate = AR913X_BASE_FREQ; 137 133 pll = ath79_pll_rr(AR913X_PLL_REG_CPU_CONFIG); 138 134 139 - div = ((pll >> AR913X_PLL_DIV_SHIFT) & AR913X_PLL_DIV_MASK); 135 + div = ((pll >> AR913X_PLL_FB_SHIFT) & AR913X_PLL_FB_MASK); 140 136 freq = div * ref_rate; 141 137 142 138 cpu_rate = freq; ··· 148 144 ahb_rate = cpu_rate / div; 149 145 150 146 ath79_add_sys_clkdev("ref", ref_rate); 151 - ath79_add_sys_clkdev("cpu", cpu_rate); 152 - ath79_add_sys_clkdev("ddr", ddr_rate); 153 - ath79_add_sys_clkdev("ahb", ahb_rate); 147 + clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); 148 + clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); 149 + clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); 154 150 155 151 clk_add_alias("wdt", NULL, "ahb", NULL); 156 152 clk_add_alias("uart", NULL, "ahb", NULL); ··· 210 206 } 211 207 212 208 ath79_add_sys_clkdev("ref", ref_rate); 213 - ath79_add_sys_clkdev("cpu", cpu_rate); 214 - ath79_add_sys_clkdev("ddr", ddr_rate); 215 - ath79_add_sys_clkdev("ahb", ahb_rate); 209 + clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); 210 + clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); 211 + clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); 216 212 217 213 clk_add_alias("wdt", NULL, "ahb", NULL); 218 214 clk_add_alias("uart", NULL, "ref", NULL); ··· 344 340 ahb_rate = cpu_pll / (postdiv + 1); 345 341 346 342 ath79_add_sys_clkdev("ref", ref_rate); 347 - ath79_add_sys_clkdev("cpu", cpu_rate); 348 - ath79_add_sys_clkdev("ddr", ddr_rate); 349 - ath79_add_sys_clkdev("ahb", ahb_rate); 343 + clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); 344 + clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); 345 + clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); 350 346 351 347 clk_add_alias("wdt", NULL, "ref", NULL); 352 348 clk_add_alias("uart", NULL, "ref", NULL); ··· 431 427 ahb_rate = cpu_pll / (postdiv + 1); 432 428 433 429 ath79_add_sys_clkdev("ref", ref_rate); 434 - ath79_add_sys_clkdev("cpu", cpu_rate); 435 - ath79_add_sys_clkdev("ddr", ddr_rate); 436 - ath79_add_sys_clkdev("ahb", ahb_rate); 430 + clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); 431 + clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); 432 + clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); 437 433 438 434 clk_add_alias("wdt", NULL, "ref", NULL); 439 435 clk_add_alias("uart", NULL, "ref", NULL); ··· 455 451 qca955x_clocks_init(); 456 452 else 457 453 BUG(); 454 + 455 + of_clk_init(NULL); 458 456 } 459 457 460 458 unsigned long __init ··· 475 469 return rate; 476 470 } 477 471 478 - /* 479 - * Linux clock API 480 - */ 481 - int clk_enable(struct clk *clk) 472 + #ifdef CONFIG_OF 473 + static void __init ath79_clocks_init_dt(struct device_node *np) 482 474 { 483 - return 0; 475 + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 484 476 } 485 - EXPORT_SYMBOL(clk_enable); 486 477 487 - void clk_disable(struct clk *clk) 488 - { 489 - } 490 - EXPORT_SYMBOL(clk_disable); 491 - 492 - unsigned long clk_get_rate(struct clk *clk) 493 - { 494 - return clk->rate; 495 - } 496 - EXPORT_SYMBOL(clk_get_rate); 478 + CLK_OF_DECLARE(ar7100, "qca,ar7100-pll", ath79_clocks_init_dt); 479 + CLK_OF_DECLARE(ar7240, "qca,ar7240-pll", ath79_clocks_init_dt); 480 + CLK_OF_DECLARE(ar9130, "qca,ar9130-pll", ath79_clocks_init_dt); 481 + CLK_OF_DECLARE(ar9330, "qca,ar9330-pll", ath79_clocks_init_dt); 482 + CLK_OF_DECLARE(ar9340, "qca,ar9340-pll", ath79_clocks_init_dt); 483 + CLK_OF_DECLARE(ar9550, "qca,qca9550-pll", ath79_clocks_init_dt); 484 + #endif
+33 -2
arch/mips/ath79/common.c
··· 38 38 void __iomem *ath79_pll_base; 39 39 void __iomem *ath79_reset_base; 40 40 EXPORT_SYMBOL_GPL(ath79_reset_base); 41 - void __iomem *ath79_ddr_base; 41 + static void __iomem *ath79_ddr_base; 42 + static void __iomem *ath79_ddr_wb_flush_base; 43 + static void __iomem *ath79_ddr_pci_win_base; 44 + 45 + void ath79_ddr_ctrl_init(void) 46 + { 47 + ath79_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE, 48 + AR71XX_DDR_CTRL_SIZE); 49 + if (soc_is_ar71xx() || soc_is_ar934x()) { 50 + ath79_ddr_wb_flush_base = ath79_ddr_base + 0x9c; 51 + ath79_ddr_pci_win_base = ath79_ddr_base + 0x7c; 52 + } else { 53 + ath79_ddr_wb_flush_base = ath79_ddr_base + 0x7c; 54 + ath79_ddr_pci_win_base = 0; 55 + } 56 + } 57 + EXPORT_SYMBOL_GPL(ath79_ddr_ctrl_init); 42 58 43 59 void ath79_ddr_wb_flush(u32 reg) 44 60 { 45 - void __iomem *flush_reg = ath79_ddr_base + reg; 61 + void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg; 46 62 47 63 /* Flush the DDR write buffer. */ 48 64 __raw_writel(0x1, flush_reg); ··· 71 55 ; 72 56 } 73 57 EXPORT_SYMBOL_GPL(ath79_ddr_wb_flush); 58 + 59 + void ath79_ddr_set_pci_windows(void) 60 + { 61 + BUG_ON(!ath79_ddr_pci_win_base); 62 + 63 + __raw_writel(AR71XX_PCI_WIN0_OFFS, ath79_ddr_pci_win_base + 0); 64 + __raw_writel(AR71XX_PCI_WIN1_OFFS, ath79_ddr_pci_win_base + 1); 65 + __raw_writel(AR71XX_PCI_WIN2_OFFS, ath79_ddr_pci_win_base + 2); 66 + __raw_writel(AR71XX_PCI_WIN3_OFFS, ath79_ddr_pci_win_base + 3); 67 + __raw_writel(AR71XX_PCI_WIN4_OFFS, ath79_ddr_pci_win_base + 4); 68 + __raw_writel(AR71XX_PCI_WIN5_OFFS, ath79_ddr_pci_win_base + 5); 69 + __raw_writel(AR71XX_PCI_WIN6_OFFS, ath79_ddr_pci_win_base + 6); 70 + __raw_writel(AR71XX_PCI_WIN7_OFFS, ath79_ddr_pci_win_base + 7); 71 + } 72 + EXPORT_SYMBOL_GPL(ath79_ddr_set_pci_windows); 74 73 75 74 void ath79_device_reset_set(u32 mask) 76 75 {
+1
arch/mips/ath79/common.h
··· 22 22 void ath79_clocks_init(void); 23 23 unsigned long ath79_get_sys_clk_rate(const char *id); 24 24 25 + void ath79_ddr_ctrl_init(void); 25 26 void ath79_ddr_wb_flush(unsigned int reg); 26 27 27 28 void ath79_gpio_function_enable(u32 mask);
+51
arch/mips/ath79/dev-common.c
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/init.h> 16 16 #include <linux/platform_device.h> 17 + #include <linux/platform_data/gpio-ath79.h> 17 18 #include <linux/serial_8250.h> 18 19 #include <linux/clk.h> 19 20 #include <linux/err.h> ··· 106 105 res.end = res.start + 0x8 - 1; 107 106 108 107 platform_device_register_simple("ath79-wdt", -1, &res, 1); 108 + } 109 + 110 + static struct ath79_gpio_platform_data ath79_gpio_pdata; 111 + 112 + static struct resource ath79_gpio_resources[] = { 113 + { 114 + .flags = IORESOURCE_MEM, 115 + .start = AR71XX_GPIO_BASE, 116 + .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1, 117 + }, 118 + { 119 + .start = ATH79_MISC_IRQ(2), 120 + .end = ATH79_MISC_IRQ(2), 121 + .flags = IORESOURCE_IRQ, 122 + }, 123 + }; 124 + 125 + static struct platform_device ath79_gpio_device = { 126 + .name = "ath79-gpio", 127 + .id = -1, 128 + .resource = ath79_gpio_resources, 129 + .num_resources = ARRAY_SIZE(ath79_gpio_resources), 130 + .dev = { 131 + .platform_data = &ath79_gpio_pdata 132 + }, 133 + }; 134 + 135 + void __init ath79_gpio_init(void) 136 + { 137 + if (soc_is_ar71xx()) { 138 + ath79_gpio_pdata.ngpios = AR71XX_GPIO_COUNT; 139 + } else if (soc_is_ar7240()) { 140 + ath79_gpio_pdata.ngpios = AR7240_GPIO_COUNT; 141 + } else if (soc_is_ar7241() || soc_is_ar7242()) { 142 + ath79_gpio_pdata.ngpios = AR7241_GPIO_COUNT; 143 + } else if (soc_is_ar913x()) { 144 + ath79_gpio_pdata.ngpios = AR913X_GPIO_COUNT; 145 + } else if (soc_is_ar933x()) { 146 + ath79_gpio_pdata.ngpios = AR933X_GPIO_COUNT; 147 + } else if (soc_is_ar934x()) { 148 + ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT; 149 + ath79_gpio_pdata.oe_inverted = 1; 150 + } else if (soc_is_qca955x()) { 151 + ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; 152 + ath79_gpio_pdata.oe_inverted = 1; 153 + } else { 154 + BUG(); 155 + } 156 + 157 + platform_device_register(&ath79_gpio_device); 109 158 }
+57 -22
arch/mips/ath79/gpio.c
··· 20 20 #include <linux/io.h> 21 21 #include <linux/ioport.h> 22 22 #include <linux/gpio.h> 23 + #include <linux/platform_data/gpio-ath79.h> 24 + #include <linux/of_device.h> 23 25 24 26 #include <asm/mach-ath79/ar71xx_regs.h> 25 27 #include <asm/mach-ath79/ath79.h> 26 28 #include "common.h" 27 29 28 30 static void __iomem *ath79_gpio_base; 29 - static unsigned long ath79_gpio_count; 31 + static u32 ath79_gpio_count; 30 32 static DEFINE_SPINLOCK(ath79_gpio_lock); 31 33 32 34 static void __ath79_gpio_set_value(unsigned gpio, int value) ··· 180 178 ath79_gpio_function_setup(0, mask); 181 179 } 182 180 183 - void __init ath79_gpio_init(void) 181 + static const struct of_device_id ath79_gpio_of_match[] = { 182 + { .compatible = "qca,ar7100-gpio" }, 183 + { .compatible = "qca,ar9340-gpio" }, 184 + {}, 185 + }; 186 + 187 + static int ath79_gpio_probe(struct platform_device *pdev) 184 188 { 189 + struct ath79_gpio_platform_data *pdata = pdev->dev.platform_data; 190 + struct device_node *np = pdev->dev.of_node; 191 + struct resource *res; 192 + bool oe_inverted; 185 193 int err; 186 194 187 - if (soc_is_ar71xx()) 188 - ath79_gpio_count = AR71XX_GPIO_COUNT; 189 - else if (soc_is_ar7240()) 190 - ath79_gpio_count = AR7240_GPIO_COUNT; 191 - else if (soc_is_ar7241() || soc_is_ar7242()) 192 - ath79_gpio_count = AR7241_GPIO_COUNT; 193 - else if (soc_is_ar913x()) 194 - ath79_gpio_count = AR913X_GPIO_COUNT; 195 - else if (soc_is_ar933x()) 196 - ath79_gpio_count = AR933X_GPIO_COUNT; 197 - else if (soc_is_ar934x()) 198 - ath79_gpio_count = AR934X_GPIO_COUNT; 199 - else if (soc_is_qca955x()) 200 - ath79_gpio_count = QCA955X_GPIO_COUNT; 201 - else 202 - BUG(); 195 + if (np) { 196 + err = of_property_read_u32(np, "ngpios", &ath79_gpio_count); 197 + if (err) { 198 + dev_err(&pdev->dev, "ngpios property is not valid\n"); 199 + return err; 200 + } 201 + if (ath79_gpio_count >= 32) { 202 + dev_err(&pdev->dev, "ngpios must be less than 32\n"); 203 + return -EINVAL; 204 + } 205 + oe_inverted = of_device_is_compatible(np, "qca,ar9340-gpio"); 206 + } else if (pdata) { 207 + ath79_gpio_count = pdata->ngpios; 208 + oe_inverted = pdata->oe_inverted; 209 + } else { 210 + dev_err(&pdev->dev, "No DT node or platform data found\n"); 211 + return -EINVAL; 212 + } 203 213 204 - ath79_gpio_base = ioremap_nocache(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); 214 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 215 + ath79_gpio_base = devm_ioremap_nocache( 216 + &pdev->dev, res->start, resource_size(res)); 217 + if (!ath79_gpio_base) 218 + return -ENOMEM; 219 + 220 + ath79_gpio_chip.dev = &pdev->dev; 205 221 ath79_gpio_chip.ngpio = ath79_gpio_count; 206 - if (soc_is_ar934x() || soc_is_qca955x()) { 222 + if (oe_inverted) { 207 223 ath79_gpio_chip.direction_input = ar934x_gpio_direction_input; 208 224 ath79_gpio_chip.direction_output = ar934x_gpio_direction_output; 209 225 } 210 226 211 227 err = gpiochip_add(&ath79_gpio_chip); 212 - if (err) 213 - panic("cannot add AR71xx GPIO chip, error=%d", err); 228 + if (err) { 229 + dev_err(&pdev->dev, 230 + "cannot add AR71xx GPIO chip, error=%d", err); 231 + return err; 232 + } 233 + 234 + return 0; 214 235 } 236 + 237 + static struct platform_driver ath79_gpio_driver = { 238 + .driver = { 239 + .name = "ath79-gpio", 240 + .of_match_table = ath79_gpio_of_match, 241 + }, 242 + .probe = ath79_gpio_probe, 243 + }; 244 + 245 + module_platform_driver(ath79_gpio_driver); 215 246 216 247 int gpio_get_value(unsigned gpio) 217 248 {
+102 -98
arch/mips/ath79/irq.c
··· 15 15 #include <linux/kernel.h> 16 16 #include <linux/init.h> 17 17 #include <linux/interrupt.h> 18 - #include <linux/irq.h> 18 + #include <linux/irqchip.h> 19 + #include <linux/of_irq.h> 20 + #include "../../../drivers/irqchip/irqchip.h" 19 21 20 22 #include <asm/irq_cpu.h> 21 23 #include <asm/mipsregs.h> ··· 25 23 #include <asm/mach-ath79/ath79.h> 26 24 #include <asm/mach-ath79/ar71xx_regs.h> 27 25 #include "common.h" 28 - 29 - static void (*ath79_ip2_handler)(void); 30 - static void (*ath79_ip3_handler)(void); 26 + #include "machtypes.h" 31 27 32 28 static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc) 33 29 { ··· 129 129 status = ath79_reset_rr(AR934X_RESET_REG_PCIE_WMAC_INT_STATUS); 130 130 131 131 if (status & AR934X_PCIE_WMAC_INT_PCIE_ALL) { 132 - ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_PCIE); 132 + ath79_ddr_wb_flush(3); 133 133 generic_handle_irq(ATH79_IP2_IRQ(0)); 134 134 } else if (status & AR934X_PCIE_WMAC_INT_WMAC_ALL) { 135 - ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_WMAC); 135 + ath79_ddr_wb_flush(4); 136 136 generic_handle_irq(ATH79_IP2_IRQ(1)); 137 137 } else { 138 138 spurious_interrupt(); ··· 235 235 irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); 236 236 } 237 237 238 - asmlinkage void plat_irq_dispatch(void) 239 - { 240 - unsigned long pending; 241 - 242 - pending = read_c0_status() & read_c0_cause() & ST0_IM; 243 - 244 - if (pending & STATUSF_IP7) 245 - do_IRQ(ATH79_CPU_IRQ(7)); 246 - 247 - else if (pending & STATUSF_IP2) 248 - ath79_ip2_handler(); 249 - 250 - else if (pending & STATUSF_IP4) 251 - do_IRQ(ATH79_CPU_IRQ(4)); 252 - 253 - else if (pending & STATUSF_IP5) 254 - do_IRQ(ATH79_CPU_IRQ(5)); 255 - 256 - else if (pending & STATUSF_IP3) 257 - ath79_ip3_handler(); 258 - 259 - else if (pending & STATUSF_IP6) 260 - do_IRQ(ATH79_CPU_IRQ(6)); 261 - 262 - else 263 - spurious_interrupt(); 264 - } 265 - 266 238 /* 267 239 * The IP2/IP3 lines are tied to a PCI/WMAC/USB device. Drivers for 268 240 * these devices typically allocate coherent DMA memory, however the 269 241 * DMA controller may still have some unsynchronized data in the FIFO. 270 242 * Issue a flush in the handlers to ensure that the driver sees 271 243 * the update. 244 + * 245 + * This array map the interrupt lines to the DDR write buffer channels. 272 246 */ 273 247 274 - static void ath79_default_ip2_handler(void) 248 + static unsigned irq_wb_chan[8] = { 249 + -1, -1, -1, -1, -1, -1, -1, -1, 250 + }; 251 + 252 + asmlinkage void plat_irq_dispatch(void) 275 253 { 276 - do_IRQ(ATH79_CPU_IRQ(2)); 254 + unsigned long pending; 255 + int irq; 256 + 257 + pending = read_c0_status() & read_c0_cause() & ST0_IM; 258 + 259 + if (!pending) { 260 + spurious_interrupt(); 261 + return; 262 + } 263 + 264 + pending >>= CAUSEB_IP; 265 + while (pending) { 266 + irq = fls(pending) - 1; 267 + if (irq < ARRAY_SIZE(irq_wb_chan) && irq_wb_chan[irq] != -1) 268 + ath79_ddr_wb_flush(irq_wb_chan[irq]); 269 + do_IRQ(MIPS_CPU_IRQ_BASE + irq); 270 + pending &= ~BIT(irq); 271 + } 277 272 } 278 273 279 - static void ath79_default_ip3_handler(void) 274 + #ifdef CONFIG_IRQCHIP 275 + static int misc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) 280 276 { 281 - do_IRQ(ATH79_CPU_IRQ(3)); 277 + irq_set_chip_and_handler(irq, &ath79_misc_irq_chip, handle_level_irq); 278 + return 0; 282 279 } 283 280 284 - static void ar71xx_ip2_handler(void) 285 - { 286 - ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_PCI); 287 - do_IRQ(ATH79_CPU_IRQ(2)); 288 - } 281 + static const struct irq_domain_ops misc_irq_domain_ops = { 282 + .xlate = irq_domain_xlate_onecell, 283 + .map = misc_map, 284 + }; 289 285 290 - static void ar724x_ip2_handler(void) 286 + static int __init ath79_misc_intc_of_init( 287 + struct device_node *node, struct device_node *parent) 291 288 { 292 - ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_PCIE); 293 - do_IRQ(ATH79_CPU_IRQ(2)); 294 - } 289 + void __iomem *base = ath79_reset_base; 290 + struct irq_domain *domain; 291 + int irq; 295 292 296 - static void ar913x_ip2_handler(void) 297 - { 298 - ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_WMAC); 299 - do_IRQ(ATH79_CPU_IRQ(2)); 300 - } 293 + irq = irq_of_parse_and_map(node, 0); 294 + if (!irq) 295 + panic("Failed to get MISC IRQ"); 301 296 302 - static void ar933x_ip2_handler(void) 303 - { 304 - ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_WMAC); 305 - do_IRQ(ATH79_CPU_IRQ(2)); 306 - } 297 + domain = irq_domain_add_legacy(node, ATH79_MISC_IRQ_COUNT, 298 + ATH79_MISC_IRQ_BASE, 0, &misc_irq_domain_ops, NULL); 299 + if (!domain) 300 + panic("Failed to add MISC irqdomain"); 307 301 308 - static void ar71xx_ip3_handler(void) 309 - { 310 - ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_USB); 311 - do_IRQ(ATH79_CPU_IRQ(3)); 312 - } 302 + /* Disable and clear all interrupts */ 303 + __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); 304 + __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); 313 305 314 - static void ar724x_ip3_handler(void) 315 - { 316 - ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_USB); 317 - do_IRQ(ATH79_CPU_IRQ(3)); 318 - } 319 306 320 - static void ar913x_ip3_handler(void) 321 - { 322 - ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_USB); 323 - do_IRQ(ATH79_CPU_IRQ(3)); 324 - } 307 + irq_set_chained_handler(irq, ath79_misc_irq_handler); 325 308 326 - static void ar933x_ip3_handler(void) 327 - { 328 - ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_USB); 329 - do_IRQ(ATH79_CPU_IRQ(3)); 309 + return 0; 330 310 } 311 + IRQCHIP_DECLARE(ath79_misc_intc, "qca,ar7100-misc-intc", 312 + ath79_misc_intc_of_init); 331 313 332 - static void ar934x_ip3_handler(void) 314 + static int __init ar79_cpu_intc_of_init( 315 + struct device_node *node, struct device_node *parent) 333 316 { 334 - ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_USB); 335 - do_IRQ(ATH79_CPU_IRQ(3)); 317 + int err, i, count; 318 + 319 + /* Fill the irq_wb_chan table */ 320 + count = of_count_phandle_with_args( 321 + node, "qca,ddr-wb-channels", "#qca,ddr-wb-channel-cells"); 322 + 323 + for (i = 0; i < count; i++) { 324 + struct of_phandle_args args; 325 + u32 irq = i; 326 + 327 + of_property_read_u32_index( 328 + node, "qca,ddr-wb-channel-interrupts", i, &irq); 329 + if (irq >= ARRAY_SIZE(irq_wb_chan)) 330 + continue; 331 + 332 + err = of_parse_phandle_with_args( 333 + node, "qca,ddr-wb-channels", 334 + "#qca,ddr-wb-channel-cells", 335 + i, &args); 336 + if (err) 337 + return err; 338 + 339 + irq_wb_chan[irq] = args.args[0]; 340 + pr_info("IRQ: Set flush channel of IRQ%d to %d\n", 341 + irq, args.args[0]); 342 + } 343 + 344 + return mips_cpu_irq_of_init(node, parent); 336 345 } 346 + IRQCHIP_DECLARE(ar79_cpu_intc, "qca,ar7100-cpu-intc", 347 + ar79_cpu_intc_of_init); 348 + 349 + #endif 337 350 338 351 void __init arch_init_irq(void) 339 352 { 340 - if (soc_is_ar71xx()) { 341 - ath79_ip2_handler = ar71xx_ip2_handler; 342 - ath79_ip3_handler = ar71xx_ip3_handler; 343 - } else if (soc_is_ar724x()) { 344 - ath79_ip2_handler = ar724x_ip2_handler; 345 - ath79_ip3_handler = ar724x_ip3_handler; 346 - } else if (soc_is_ar913x()) { 347 - ath79_ip2_handler = ar913x_ip2_handler; 348 - ath79_ip3_handler = ar913x_ip3_handler; 349 - } else if (soc_is_ar933x()) { 350 - ath79_ip2_handler = ar933x_ip2_handler; 351 - ath79_ip3_handler = ar933x_ip3_handler; 353 + if (mips_machtype == ATH79_MACH_GENERIC_OF) { 354 + irqchip_init(); 355 + return; 356 + } 357 + 358 + if (soc_is_ar71xx() || soc_is_ar724x() || 359 + soc_is_ar913x() || soc_is_ar933x()) { 360 + irq_wb_chan[2] = 3; 361 + irq_wb_chan[3] = 2; 352 362 } else if (soc_is_ar934x()) { 353 - ath79_ip2_handler = ath79_default_ip2_handler; 354 - ath79_ip3_handler = ar934x_ip3_handler; 355 - } else if (soc_is_qca955x()) { 356 - ath79_ip2_handler = ath79_default_ip2_handler; 357 - ath79_ip3_handler = ath79_default_ip3_handler; 358 - } else { 359 - BUG(); 363 + irq_wb_chan[3] = 2; 360 364 } 361 365 362 366 mips_cpu_irq_init();
+1
arch/mips/ath79/machtypes.h
··· 15 15 #include <asm/mips_machine.h> 16 16 17 17 enum ath79_mach_type { 18 + ATH79_MACH_GENERIC_OF = -1, /* Device tree board */ 18 19 ATH79_MACH_GENERIC = 0, 19 20 ATH79_MACH_AP121, /* Atheros AP121 reference board */ 20 21 ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */
+27 -3
arch/mips/ath79/setup.c
··· 17 17 #include <linux/bootmem.h> 18 18 #include <linux/err.h> 19 19 #include <linux/clk.h> 20 + #include <linux/of_platform.h> 21 + #include <linux/of_fdt.h> 20 22 21 23 #include <asm/bootinfo.h> 22 24 #include <asm/idle.h> 23 25 #include <asm/time.h> /* for mips_hpt_frequency */ 24 26 #include <asm/reboot.h> /* for _machine_{restart,halt} */ 25 27 #include <asm/mips_machine.h> 28 + #include <asm/prom.h> 29 + #include <asm/fw/fw.h> 26 30 27 31 #include <asm/mach-ath79/ath79.h> 28 32 #include <asm/mach-ath79/ar71xx_regs.h> ··· 198 194 199 195 void __init plat_mem_setup(void) 200 196 { 197 + unsigned long fdt_start; 198 + 201 199 set_io_port_base(KSEG1); 200 + 201 + /* Get the position of the FDT passed by the bootloader */ 202 + fdt_start = fw_getenvl("fdt_start"); 203 + if (fdt_start) 204 + __dt_setup_arch((void *)KSEG0ADDR(fdt_start)); 205 + #ifdef CONFIG_BUILTIN_DTB 206 + else 207 + __dt_setup_arch(__dtb_start); 208 + #endif 202 209 203 210 ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, 204 211 AR71XX_RESET_SIZE); 205 212 ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, 206 213 AR71XX_PLL_SIZE); 207 - ath79_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE, 208 - AR71XX_DDR_CTRL_SIZE); 214 + ath79_ddr_ctrl_init(); 209 215 210 216 ath79_detect_sys_type(); 211 - detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); 217 + if (mips_machtype != ATH79_MACH_GENERIC_OF) 218 + detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); 212 219 213 220 _machine_restart = ath79_restart; 214 221 _machine_halt = ath79_halt; ··· 251 236 252 237 static int __init ath79_setup(void) 253 238 { 239 + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 240 + if (mips_machtype == ATH79_MACH_GENERIC_OF) 241 + return 0; 242 + 254 243 ath79_gpio_init(); 255 244 ath79_register_uart(); 256 245 ath79_register_wdt(); ··· 265 246 } 266 247 267 248 arch_initcall(ath79_setup); 249 + 250 + void __init device_tree_init(void) 251 + { 252 + unflatten_and_copy_device_tree(); 253 + } 268 254 269 255 static void __init ath79_generic_init(void) 270 256 {
-1
arch/mips/bcm47xx/Kconfig
··· 25 25 select BCMA 26 26 select BCMA_HOST_SOC 27 27 select BCMA_DRIVER_MIPS 28 - select BCMA_HOST_PCI if PCI 29 28 select BCMA_DRIVER_PCI_HOSTMODE if PCI 30 29 select BCMA_DRIVER_GPIO 31 30 default y
+1 -1
arch/mips/bcm47xx/Makefile
··· 3 3 # under Linux. 4 4 # 5 5 6 - obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o 6 + obj-y += irq.o prom.o serial.o setup.o time.o sprom.o 7 7 obj-y += board.o buttons.o leds.o workarounds.o
+1
arch/mips/bcm47xx/board.c
··· 149 149 /* board_id */ 150 150 static const 151 151 struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = { 152 + {{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Luxul XWR-1750 V1"}, "luxul_xwr1750_v1"}, 152 153 {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"}, 153 154 {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"}, 154 155 {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "Netgear WGR614 V10"}, "U12H139T01_NETGEAR"},
+11
arch/mips/bcm47xx/buttons.c
··· 299 299 BCM47XX_GPIO_KEY(6, KEY_RESTART), 300 300 }; 301 301 302 + /* Luxul */ 303 + 304 + static const struct gpio_keys_button 305 + bcm47xx_buttons_luxul_xwr_1750_v1[] = { 306 + BCM47XX_GPIO_KEY(14, BTN_TASK), 307 + }; 308 + 302 309 /* Microsoft */ 303 310 304 311 static const struct gpio_keys_button ··· 560 553 break; 561 554 case BCM47XX_BOARD_LINKSYS_WRTSL54GS: 562 555 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); 556 + break; 557 + 558 + case BCM47XX_BOARD_LUXUL_XWR_1750_V1: 559 + err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1); 563 560 break; 564 561 565 562 case BCM47XX_BOARD_MICROSOFT_MN700:
+14
arch/mips/bcm47xx/leds.c
··· 370 370 BCM47XX_GPIO_LED(7, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), 371 371 }; 372 372 373 + /* Luxul */ 374 + 375 + static const struct gpio_led 376 + bcm47xx_leds_luxul_xwr_1750_v1[] __initconst = { 377 + BCM47XX_GPIO_LED(5, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF), 378 + BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), 379 + BCM47XX_GPIO_LED_TRIGGER(13, "green", "status", 0, "timer"), 380 + BCM47XX_GPIO_LED(15, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), 381 + }; 382 + 373 383 /* Microsoft */ 374 384 375 385 static const struct gpio_led ··· 631 621 break; 632 622 case BCM47XX_BOARD_LINKSYS_WRTSL54GS: 633 623 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); 624 + break; 625 + 626 + case BCM47XX_BOARD_LUXUL_XWR_1750_V1: 627 + bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1); 634 628 break; 635 629 636 630 case BCM47XX_BOARD_MICROSOFT_MN700:
-223
arch/mips/bcm47xx/nvram.c
··· 1 - /* 2 - * BCM947xx nvram variable access 3 - * 4 - * Copyright (C) 2005 Broadcom Corporation 5 - * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> 6 - * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de> 7 - * 8 - * This program is free software; you can redistribute it and/or modify it 9 - * under the terms of the GNU General Public License as published by the 10 - * Free Software Foundation; either version 2 of the License, or (at your 11 - * option) any later version. 12 - */ 13 - 14 - #include <linux/io.h> 15 - #include <linux/types.h> 16 - #include <linux/module.h> 17 - #include <linux/kernel.h> 18 - #include <linux/string.h> 19 - #include <linux/mtd/mtd.h> 20 - #include <linux/bcm47xx_nvram.h> 21 - 22 - #define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ 23 - #define NVRAM_SPACE 0x10000 24 - #define NVRAM_MAX_GPIO_ENTRIES 32 25 - #define NVRAM_MAX_GPIO_VALUE_LEN 30 26 - 27 - #define FLASH_MIN 0x00020000 /* Minimum flash size */ 28 - 29 - struct nvram_header { 30 - u32 magic; 31 - u32 len; 32 - u32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */ 33 - u32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */ 34 - u32 config_ncdl; /* ncdl values for memc */ 35 - }; 36 - 37 - static char nvram_buf[NVRAM_SPACE]; 38 - static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; 39 - 40 - static u32 find_nvram_size(void __iomem *end) 41 - { 42 - struct nvram_header __iomem *header; 43 - int i; 44 - 45 - for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { 46 - header = (struct nvram_header *)(end - nvram_sizes[i]); 47 - if (header->magic == NVRAM_MAGIC) 48 - return nvram_sizes[i]; 49 - } 50 - 51 - return 0; 52 - } 53 - 54 - /* Probe for NVRAM header */ 55 - static int nvram_find_and_copy(void __iomem *iobase, u32 lim) 56 - { 57 - struct nvram_header __iomem *header; 58 - int i; 59 - u32 off; 60 - u32 *src, *dst; 61 - u32 size; 62 - 63 - if (nvram_buf[0]) { 64 - pr_warn("nvram already initialized\n"); 65 - return -EEXIST; 66 - } 67 - 68 - /* TODO: when nvram is on nand flash check for bad blocks first. */ 69 - off = FLASH_MIN; 70 - while (off <= lim) { 71 - /* Windowed flash access */ 72 - size = find_nvram_size(iobase + off); 73 - if (size) { 74 - header = (struct nvram_header *)(iobase + off - size); 75 - goto found; 76 - } 77 - off <<= 1; 78 - } 79 - 80 - /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ 81 - header = (struct nvram_header *)(iobase + 4096); 82 - if (header->magic == NVRAM_MAGIC) { 83 - size = NVRAM_SPACE; 84 - goto found; 85 - } 86 - 87 - header = (struct nvram_header *)(iobase + 1024); 88 - if (header->magic == NVRAM_MAGIC) { 89 - size = NVRAM_SPACE; 90 - goto found; 91 - } 92 - 93 - pr_err("no nvram found\n"); 94 - return -ENXIO; 95 - 96 - found: 97 - if (header->len > size) 98 - pr_err("The nvram size accoridng to the header seems to be bigger than the partition on flash\n"); 99 - if (header->len > NVRAM_SPACE) 100 - pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", 101 - header->len, NVRAM_SPACE); 102 - 103 - src = (u32 *)header; 104 - dst = (u32 *)nvram_buf; 105 - for (i = 0; i < sizeof(struct nvram_header); i += 4) 106 - *dst++ = __raw_readl(src++); 107 - for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4) 108 - *dst++ = readl(src++); 109 - 110 - return 0; 111 - } 112 - 113 - /* 114 - * On bcm47xx we need access to the NVRAM very early, so we can't use mtd 115 - * subsystem to access flash. We can't even use platform device / driver to 116 - * store memory offset. 117 - * To handle this we provide following symbol. It's supposed to be called as 118 - * soon as we get info about flash device, before any NVRAM entry is needed. 119 - */ 120 - int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) 121 - { 122 - void __iomem *iobase; 123 - int err; 124 - 125 - iobase = ioremap_nocache(base, lim); 126 - if (!iobase) 127 - return -ENOMEM; 128 - 129 - err = nvram_find_and_copy(iobase, lim); 130 - 131 - iounmap(iobase); 132 - 133 - return err; 134 - } 135 - 136 - static int nvram_init(void) 137 - { 138 - #ifdef CONFIG_MTD 139 - struct mtd_info *mtd; 140 - struct nvram_header header; 141 - size_t bytes_read; 142 - int err; 143 - 144 - mtd = get_mtd_device_nm("nvram"); 145 - if (IS_ERR(mtd)) 146 - return -ENODEV; 147 - 148 - err = mtd_read(mtd, 0, sizeof(header), &bytes_read, (uint8_t *)&header); 149 - if (!err && header.magic == NVRAM_MAGIC) { 150 - u8 *dst = (uint8_t *)nvram_buf; 151 - size_t len = header.len; 152 - 153 - if (header.len > NVRAM_SPACE) { 154 - pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", 155 - header.len, NVRAM_SPACE); 156 - len = NVRAM_SPACE; 157 - } 158 - 159 - err = mtd_read(mtd, 0, len, &bytes_read, dst); 160 - if (err) 161 - return err; 162 - 163 - return 0; 164 - } 165 - #endif 166 - 167 - return -ENXIO; 168 - } 169 - 170 - int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) 171 - { 172 - char *var, *value, *end, *eq; 173 - int data_left, err; 174 - 175 - if (!name) 176 - return -EINVAL; 177 - 178 - if (!nvram_buf[0]) { 179 - err = nvram_init(); 180 - if (err) 181 - return err; 182 - } 183 - 184 - /* Look for name=value and return value */ 185 - var = &nvram_buf[sizeof(struct nvram_header)]; 186 - end = nvram_buf + sizeof(nvram_buf) - 2; 187 - end[0] = '\0'; 188 - end[1] = '\0'; 189 - for (; *var; var = value + strlen(value) + 1) { 190 - data_left = end - var; 191 - 192 - eq = strnchr(var, data_left, '='); 193 - if (!eq) 194 - break; 195 - value = eq + 1; 196 - if (eq - var == strlen(name) && 197 - strncmp(var, name, eq - var) == 0) 198 - return snprintf(val, val_len, "%s", value); 199 - } 200 - return -ENOENT; 201 - } 202 - EXPORT_SYMBOL(bcm47xx_nvram_getenv); 203 - 204 - int bcm47xx_nvram_gpio_pin(const char *name) 205 - { 206 - int i, err; 207 - char nvram_var[] = "gpioXX"; 208 - char buf[NVRAM_MAX_GPIO_VALUE_LEN]; 209 - 210 - /* TODO: Optimize it to don't call getenv so many times */ 211 - for (i = 0; i < NVRAM_MAX_GPIO_ENTRIES; i++) { 212 - err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i); 213 - if (err <= 0) 214 - continue; 215 - err = bcm47xx_nvram_getenv(nvram_var, buf, sizeof(buf)); 216 - if (err <= 0) 217 - continue; 218 - if (!strcmp(name, buf)) 219 - return i; 220 - } 221 - return -ENOENT; 222 - } 223 - EXPORT_SYMBOL(bcm47xx_nvram_gpio_pin);
+1 -1
arch/mips/bcm47xx/prom.c
··· 126 126 /* Stripped version of tlb_init, with the call to build_tlb_refill_handler 127 127 * dropped. Calling it at this stage causes a hang. 128 128 */ 129 - void __cpuinit early_tlb_init(void) 129 + void early_tlb_init(void) 130 130 { 131 131 write_c0_pagemask(PM_DEFAULT_MASK); 132 132 write_c0_wired(0);
-3
arch/mips/bcm47xx/setup.c
··· 206 206 err = bcma_host_soc_init(&bcm47xx_bus.bcma); 207 207 if (err) 208 208 panic("Failed to initialize BCMA bus (err %d)", err); 209 - 210 - bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, 211 - NULL); 212 209 } 213 210 #endif 214 211
+40 -66
arch/mips/bcm47xx/sprom.c
··· 200 200 const char *pre = prefix; 201 201 bool fb = fallback; 202 202 203 + /* Broadcom extracts it for rev 8+ but it was found on 2 and 4 too */ 204 + ENTRY(0xfffffffe, u16, pre, "devid", dev_id, 0, fallback); 205 + 203 206 ENTRY(0xfffffffe, u16, pre, "boardrev", board_rev, 0, true); 207 + ENTRY(0xfffffffe, u32, pre, "boardflags", boardflags, 0, fb); 208 + ENTRY(0xfffffff0, u32, pre, "boardflags2", boardflags2, 0, fb); 209 + ENTRY(0xfffff800, u32, pre, "boardflags3", boardflags3, 0, fb); 204 210 ENTRY(0x00000002, u16, pre, "boardflags", boardflags_lo, 0, fb); 205 211 ENTRY(0xfffffffc, u16, pre, "boardtype", board_type, 0, true); 206 212 ENTRY(0xfffffffe, u16, pre, "boardnum", board_num, 0, fb); ··· 415 409 } 416 410 #undef ENTRY /* It's specififc, uses local variable, don't use it (again). */ 417 411 418 - static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, 419 - const char *prefix, bool fallback) 420 - { 421 - nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback); 422 - nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback); 423 - } 424 - 425 - static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix, 426 - bool fallback) 427 - { 428 - nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, 429 - &sprom->leddc_off_time, fallback); 430 - } 431 - 432 - static void bcm47xx_fill_sprom_r4589(struct ssb_sprom *sprom, 433 - const char *prefix, bool fallback) 434 - { 435 - nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, 436 - &sprom->leddc_off_time, fallback); 437 - } 438 - 439 412 static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom, 440 413 const char *prefix, bool fallback) 441 414 { ··· 513 528 static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, 514 529 const char *prefix, bool fallback) 515 530 { 531 + bool fb = fallback; 532 + 516 533 nvram_read_macaddr(prefix, "et0macaddr", sprom->et0mac, fallback); 517 534 nvram_read_u8(prefix, NULL, "et0mdcport", &sprom->et0mdcport, 0, 518 535 fallback); ··· 526 539 fallback); 527 540 nvram_read_u8(prefix, NULL, "et1phyaddr", &sprom->et1phyaddr, 0, 528 541 fallback); 542 + 543 + nvram_read_macaddr(prefix, "et2macaddr", sprom->et2mac, fb); 544 + nvram_read_u8(prefix, NULL, "et2mdcport", &sprom->et2mdcport, 0, fb); 545 + nvram_read_u8(prefix, NULL, "et2phyaddr", &sprom->et2phyaddr, 0, fb); 529 546 530 547 nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback); 531 548 nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback); ··· 571 580 572 581 nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0, fallback); 573 582 583 + /* Entries requiring custom functions */ 584 + nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback); 585 + if (sprom->revision >= 3) 586 + nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, 587 + &sprom->leddc_off_time, fallback); 588 + 574 589 switch (sprom->revision) { 575 - case 1: 576 - bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 577 - break; 578 - case 2: 579 - bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 580 - break; 581 - case 3: 582 - bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 583 - bcm47xx_fill_sprom_r3(sprom, prefix, fallback); 584 - break; 585 590 case 4: 586 591 case 5: 587 - bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 588 - bcm47xx_fill_sprom_r4589(sprom, prefix, fallback); 589 592 bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); 590 593 bcm47xx_fill_sprom_path_r45(sprom, prefix, fallback); 591 594 break; 592 595 case 8: 593 - bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 594 - bcm47xx_fill_sprom_r4589(sprom, prefix, fallback); 595 - bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); 596 - break; 597 596 case 9: 598 - bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 599 - bcm47xx_fill_sprom_r4589(sprom, prefix, fallback); 600 597 bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); 601 598 break; 602 - default: 603 - pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n", 604 - sprom->revision); 605 - sprom->revision = 1; 606 - bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 607 599 } 608 600 609 601 bcm47xx_sprom_fill_auto(sprom, prefix, fallback); ··· 595 621 #ifdef CONFIG_BCM47XX_SSB 596 622 void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, 597 623 const char *prefix) 598 - { 599 - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0, 600 - true); 601 - if (!boardinfo->vendor) 602 - boardinfo->vendor = SSB_BOARDVENDOR_BCM; 603 - 604 - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true); 605 - } 606 - #endif 607 - 608 - #ifdef CONFIG_BCM47XX_BCMA 609 - void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo, 610 - const char *prefix) 611 624 { 612 625 nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0, 613 626 true); ··· 659 698 660 699 static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) 661 700 { 662 - char prefix[10]; 701 + struct bcma_boardinfo *binfo = &bus->boardinfo; 663 702 struct bcma_device *core; 703 + char buf[10]; 704 + char *prefix; 705 + bool fallback = false; 664 706 665 707 switch (bus->hosttype) { 666 708 case BCMA_HOSTTYPE_PCI: 667 709 memset(out, 0, sizeof(struct ssb_sprom)); 668 - snprintf(prefix, sizeof(prefix), "pci/%u/%u/", 710 + snprintf(buf, sizeof(buf), "pci/%u/%u/", 669 711 bus->host_pci->bus->number + 1, 670 712 PCI_SLOT(bus->host_pci->devfn)); 671 - bcm47xx_sprom_apply_prefix_alias(prefix, sizeof(prefix)); 672 - bcm47xx_fill_sprom(out, prefix, false); 673 - return 0; 713 + bcm47xx_sprom_apply_prefix_alias(buf, sizeof(buf)); 714 + prefix = buf; 715 + break; 674 716 case BCMA_HOSTTYPE_SOC: 675 717 memset(out, 0, sizeof(struct ssb_sprom)); 676 718 core = bcma_find_core(bus, BCMA_CORE_80211); 677 719 if (core) { 678 - snprintf(prefix, sizeof(prefix), "sb/%u/", 720 + snprintf(buf, sizeof(buf), "sb/%u/", 679 721 core->core_index); 680 - bcm47xx_fill_sprom(out, prefix, true); 722 + prefix = buf; 723 + fallback = true; 681 724 } else { 682 - bcm47xx_fill_sprom(out, NULL, false); 725 + prefix = NULL; 683 726 } 684 - return 0; 727 + break; 685 728 default: 686 729 pr_warn("Unable to fill SPROM for given bustype.\n"); 687 730 return -EINVAL; 688 731 } 732 + 733 + nvram_read_u16(prefix, NULL, "boardvendor", &binfo->vendor, 0, true); 734 + if (!binfo->vendor) 735 + binfo->vendor = SSB_BOARDVENDOR_BCM; 736 + nvram_read_u16(prefix, NULL, "boardtype", &binfo->type, 0, true); 737 + 738 + bcm47xx_fill_sprom(out, prefix, fallback); 739 + 740 + return 0; 689 741 } 690 742 #endif 691 743
+4
arch/mips/bmips/Kconfig
··· 57 57 bool "BCM97425SVMB" 58 58 select BUILTIN_DTB 59 59 60 + config DT_BCM97435SVMB 61 + bool "BCM97435SVMB" 62 + select BUILTIN_DTB 63 + 60 64 endchoice 61 65 62 66 endif
+2
arch/mips/bmips/setup.c
··· 149 149 /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ 150 150 if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) 151 151 dtb = phys_to_virt(fw_arg2); 152 + else if (fw_arg0 == -2) /* UHI interface */ 153 + dtb = (void *)fw_arg1; 152 154 else if (__dtb_start != __dtb_end) 153 155 dtb = (void *)__dtb_start; 154 156 else
+16
arch/mips/boot/compressed/head.S
··· 25 25 move s2, a2 26 26 move s3, a3 27 27 28 + #ifdef CONFIG_MIPS_ZBOOT_APPENDED_DTB 29 + PTR_LA t0, __appended_dtb 30 + #ifdef CONFIG_CPU_BIG_ENDIAN 31 + li t1, 0xd00dfeed 32 + #else 33 + li t1, 0xedfe0dd0 34 + #endif 35 + lw t2, (t0) 36 + bne t1, t2, not_found 37 + nop 38 + 39 + move s1, t0 40 + PTR_LI s0, -2 41 + not_found: 42 + #endif 43 + 28 44 /* Clear BSS */ 29 45 PTR_LA a0, _edata 30 46 PTR_LA a2, _end
+5 -1
arch/mips/boot/compressed/ld.script
··· 29 29 *(.image) 30 30 __image_end = .; 31 31 CONSTRUCTORS 32 + . = ALIGN(16); 32 33 } 33 - . = ALIGN(16); 34 + __appended_dtb = .; 35 + /* leave space for appended DTB */ 36 + . += 0x100000; 37 + 34 38 _edata = .; 35 39 /* End of data section */ 36 40
+1 -1
arch/mips/boot/compressed/uart-16550.c
··· 7 7 8 8 #include <asm/addrspace.h> 9 9 10 - #if defined(CONFIG_MACH_LOONGSON) || defined(CONFIG_MIPS_MALTA) 10 + #if defined(CONFIG_MACH_LOONGSON64) || defined(CONFIG_MIPS_MALTA) 11 11 #define UART_BASE 0x1fd003f8 12 12 #define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset)) 13 13 #endif
+2
arch/mips/boot/dts/Makefile
··· 1 1 dts-dirs += brcm 2 2 dts-dirs += cavium-octeon 3 + dts-dirs += ingenic 3 4 dts-dirs += lantiq 4 5 dts-dirs += mti 5 6 dts-dirs += netlogic 7 + dts-dirs += qca 6 8 dts-dirs += ralink 7 9 8 10 obj-y := $(addsuffix /, $(dts-dirs))
+14
arch/mips/boot/dts/brcm/Makefile
··· 9 9 dtb-$(CONFIG_DT_BCM97362SVMB) += bcm97362svmb.dtb 10 10 dtb-$(CONFIG_DT_BCM97420C) += bcm97420c.dtb 11 11 dtb-$(CONFIG_DT_BCM97425SVMB) += bcm97425svmb.dtb 12 + dtb-$(CONFIG_DT_BCM97435SVMB) += bcm97435svmb.dtb 13 + 14 + dtb-$(CONFIG_DT_NONE) += \ 15 + bcm93384wvg.dtb \ 16 + bcm93384wvg_viper.dtb \ 17 + bcm96368mvwg.dtb \ 18 + bcm9ejtagprb.dtb \ 19 + bcm97125cbmb.dtb \ 20 + bcm97346dbsmb.dtb \ 21 + bcm97358svmb.dtb \ 22 + bcm97360svmb.dtb \ 23 + bcm97362svmb.dtb \ 24 + bcm97420c.dtb \ 25 + bcm97425svmb.dtb 12 26 13 27 obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) 14 28
+26
arch/mips/boot/dts/brcm/bcm7346.dtsi
··· 24 24 25 25 aliases { 26 26 uart0 = &uart0; 27 + uart1 = &uart1; 28 + uart2 = &uart2; 27 29 }; 28 30 29 31 cpu_intc: cpu_intc { ··· 116 114 native-endian; 117 115 interrupt-parent = <&periph_intc>; 118 116 interrupts = <64>; 117 + clocks = <&uart_clk>; 118 + status = "disabled"; 119 + }; 120 + 121 + uart1: serial@406940 { 122 + compatible = "ns16550a"; 123 + reg = <0x406940 0x20>; 124 + reg-io-width = <0x4>; 125 + reg-shift = <0x2>; 126 + native-endian; 127 + interrupt-parent = <&periph_intc>; 128 + interrupts = <65>; 129 + clocks = <&uart_clk>; 130 + status = "disabled"; 131 + }; 132 + 133 + uart2: serial@406980 { 134 + compatible = "ns16550a"; 135 + reg = <0x406980 0x20>; 136 + reg-io-width = <0x4>; 137 + reg-shift = <0x2>; 138 + native-endian; 139 + interrupt-parent = <&periph_intc>; 140 + interrupts = <66>; 119 141 clocks = <&uart_clk>; 120 142 status = "disabled"; 121 143 };
+26
arch/mips/boot/dts/brcm/bcm7358.dtsi
··· 18 18 19 19 aliases { 20 20 uart0 = &uart0; 21 + uart1 = &uart1; 22 + uart2 = &uart2; 21 23 }; 22 24 23 25 cpu_intc: cpu_intc { ··· 110 108 native-endian; 111 109 interrupt-parent = <&periph_intc>; 112 110 interrupts = <61>; 111 + clocks = <&uart_clk>; 112 + status = "disabled"; 113 + }; 114 + 115 + uart1: serial@406840 { 116 + compatible = "ns16550a"; 117 + reg = <0x406840 0x20>; 118 + reg-io-width = <0x4>; 119 + reg-shift = <0x2>; 120 + native-endian; 121 + interrupt-parent = <&periph_intc>; 122 + interrupts = <62>; 123 + clocks = <&uart_clk>; 124 + status = "disabled"; 125 + }; 126 + 127 + uart2: serial@406880 { 128 + compatible = "ns16550a"; 129 + reg = <0x406880 0x20>; 130 + reg-io-width = <0x4>; 131 + reg-shift = <0x2>; 132 + native-endian; 133 + interrupt-parent = <&periph_intc>; 134 + interrupts = <63>; 113 135 clocks = <&uart_clk>; 114 136 status = "disabled"; 115 137 };
+26
arch/mips/boot/dts/brcm/bcm7360.dtsi
··· 18 18 19 19 aliases { 20 20 uart0 = &uart0; 21 + uart1 = &uart1; 22 + uart2 = &uart2; 21 23 }; 22 24 23 25 cpu_intc: cpu_intc { ··· 110 108 native-endian; 111 109 interrupt-parent = <&periph_intc>; 112 110 interrupts = <61>; 111 + clocks = <&uart_clk>; 112 + status = "disabled"; 113 + }; 114 + 115 + uart1: serial@406840 { 116 + compatible = "ns16550a"; 117 + reg = <0x406840 0x20>; 118 + reg-io-width = <0x4>; 119 + reg-shift = <0x2>; 120 + native-endian; 121 + interrupt-parent = <&periph_intc>; 122 + interrupts = <62>; 123 + clocks = <&uart_clk>; 124 + status = "disabled"; 125 + }; 126 + 127 + uart2: serial@406880 { 128 + compatible = "ns16550a"; 129 + reg = <0x406880 0x20>; 130 + reg-io-width = <0x4>; 131 + reg-shift = <0x2>; 132 + native-endian; 133 + interrupt-parent = <&periph_intc>; 134 + interrupts = <63>; 113 135 clocks = <&uart_clk>; 114 136 status = "disabled"; 115 137 };
+26
arch/mips/boot/dts/brcm/bcm7362.dtsi
··· 24 24 25 25 aliases { 26 26 uart0 = &uart0; 27 + uart1 = &uart1; 28 + uart2 = &uart2; 27 29 }; 28 30 29 31 cpu_intc: cpu_intc { ··· 116 114 native-endian; 117 115 interrupt-parent = <&periph_intc>; 118 116 interrupts = <61>; 117 + clocks = <&uart_clk>; 118 + status = "disabled"; 119 + }; 120 + 121 + uart1: serial@406840 { 122 + compatible = "ns16550a"; 123 + reg = <0x406840 0x20>; 124 + reg-io-width = <0x4>; 125 + reg-shift = <0x2>; 126 + native-endian; 127 + interrupt-parent = <&periph_intc>; 128 + interrupts = <62>; 129 + clocks = <&uart_clk>; 130 + status = "disabled"; 131 + }; 132 + 133 + uart2: serial@406880 { 134 + compatible = "ns16550a"; 135 + reg = <0x406880 0x20>; 136 + reg-io-width = <0x4>; 137 + reg-shift = <0x2>; 138 + native-endian; 139 + interrupt-parent = <&periph_intc>; 140 + interrupts = <63>; 119 141 clocks = <&uart_clk>; 120 142 status = "disabled"; 121 143 };
+239
arch/mips/boot/dts/brcm/bcm7435.dtsi
··· 1 + / { 2 + #address-cells = <1>; 3 + #size-cells = <1>; 4 + compatible = "brcm,bcm7435"; 5 + 6 + cpus { 7 + #address-cells = <1>; 8 + #size-cells = <0>; 9 + 10 + mips-hpt-frequency = <163125000>; 11 + 12 + cpu@0 { 13 + compatible = "brcm,bmips5200"; 14 + device_type = "cpu"; 15 + reg = <0>; 16 + }; 17 + 18 + cpu@1 { 19 + compatible = "brcm,bmips5200"; 20 + device_type = "cpu"; 21 + reg = <1>; 22 + }; 23 + 24 + cpu@2 { 25 + compatible = "brcm,bmips5200"; 26 + device_type = "cpu"; 27 + reg = <2>; 28 + }; 29 + 30 + cpu@3 { 31 + compatible = "brcm,bmips5200"; 32 + device_type = "cpu"; 33 + reg = <3>; 34 + }; 35 + }; 36 + 37 + aliases { 38 + uart0 = &uart0; 39 + }; 40 + 41 + cpu_intc: cpu_intc { 42 + #address-cells = <0>; 43 + compatible = "mti,cpu-interrupt-controller"; 44 + 45 + interrupt-controller; 46 + #interrupt-cells = <1>; 47 + }; 48 + 49 + clocks { 50 + uart_clk: uart_clk { 51 + compatible = "fixed-clock"; 52 + #clock-cells = <0>; 53 + clock-frequency = <81000000>; 54 + }; 55 + }; 56 + 57 + rdb { 58 + #address-cells = <1>; 59 + #size-cells = <1>; 60 + 61 + compatible = "simple-bus"; 62 + ranges = <0 0x10000000 0x01000000>; 63 + 64 + periph_intc: periph_intc@41b500 { 65 + compatible = "brcm,bcm7038-l1-intc"; 66 + reg = <0x41b500 0x40>, <0x41b600 0x40>; 67 + 68 + interrupt-controller; 69 + #interrupt-cells = <1>; 70 + 71 + interrupt-parent = <&cpu_intc>; 72 + interrupts = <2>, <3>; 73 + }; 74 + 75 + sun_l2_intc: sun_l2_intc@403000 { 76 + compatible = "brcm,l2-intc"; 77 + reg = <0x403000 0x30>; 78 + interrupt-controller; 79 + #interrupt-cells = <1>; 80 + interrupt-parent = <&periph_intc>; 81 + interrupts = <52>; 82 + }; 83 + 84 + gisb-arb@400000 { 85 + compatible = "brcm,bcm7400-gisb-arb"; 86 + reg = <0x400000 0xdc>; 87 + native-endian; 88 + interrupt-parent = <&sun_l2_intc>; 89 + interrupts = <0>, <2>; 90 + brcm,gisb-arb-master-mask = <0xf77f>; 91 + brcm,gisb-arb-master-names = "ssp_0", "cpu_0", "webcpu_0", 92 + "pcie_0", "bsp_0", 93 + "rdc_0", "raaga_0", 94 + "avd_1", "jtag_0", 95 + "svd_0", "vice_0", 96 + "vice_1", "raaga_1", 97 + "scpu"; 98 + }; 99 + 100 + upg_irq0_intc: upg_irq0_intc@406780 { 101 + compatible = "brcm,bcm7120-l2-intc"; 102 + reg = <0x406780 0x8>; 103 + 104 + brcm,int-map-mask = <0x44>; 105 + brcm,int-fwd-mask = <0x70000>; 106 + 107 + interrupt-controller; 108 + #interrupt-cells = <1>; 109 + 110 + interrupt-parent = <&periph_intc>; 111 + interrupts = <60>; 112 + }; 113 + 114 + sun_top_ctrl: syscon@404000 { 115 + compatible = "brcm,bcm7425-sun-top-ctrl", "syscon"; 116 + reg = <0x404000 0x51c>; 117 + little-endian; 118 + }; 119 + 120 + reboot { 121 + compatible = "brcm,brcmstb-reboot"; 122 + syscon = <&sun_top_ctrl 0x304 0x308>; 123 + }; 124 + 125 + uart0: serial@406b00 { 126 + compatible = "ns16550a"; 127 + reg = <0x406b00 0x20>; 128 + reg-io-width = <0x4>; 129 + reg-shift = <0x2>; 130 + interrupt-parent = <&periph_intc>; 131 + interrupts = <66>; 132 + clocks = <&uart_clk>; 133 + status = "disabled"; 134 + }; 135 + 136 + enet0: ethernet@b80000 { 137 + phy-mode = "internal"; 138 + phy-handle = <&phy1>; 139 + mac-address = [ 00 10 18 36 23 1a ]; 140 + compatible = "brcm,genet-v3"; 141 + #address-cells = <0x1>; 142 + #size-cells = <0x1>; 143 + reg = <0xb80000 0x11c88>; 144 + interrupts = <17>, <18>; 145 + interrupt-parent = <&periph_intc>; 146 + status = "disabled"; 147 + 148 + mdio@e14 { 149 + compatible = "brcm,genet-mdio-v3"; 150 + #address-cells = <0x1>; 151 + #size-cells = <0x0>; 152 + reg = <0xe14 0x8>; 153 + 154 + phy1: ethernet-phy@1 { 155 + max-speed = <100>; 156 + reg = <0x1>; 157 + compatible = "brcm,40nm-ephy", 158 + "ethernet-phy-ieee802.3-c22"; 159 + }; 160 + }; 161 + }; 162 + 163 + ehci0: usb@480300 { 164 + compatible = "brcm,bcm7435-ehci", "generic-ehci"; 165 + reg = <0x480300 0x100>; 166 + native-endian; 167 + interrupt-parent = <&periph_intc>; 168 + interrupts = <70>; 169 + status = "disabled"; 170 + }; 171 + 172 + ohci0: usb@480400 { 173 + compatible = "brcm,bcm7435-ohci", "generic-ohci"; 174 + reg = <0x480400 0x100>; 175 + native-endian; 176 + no-big-frame-no; 177 + interrupt-parent = <&periph_intc>; 178 + interrupts = <72>; 179 + status = "disabled"; 180 + }; 181 + 182 + ehci1: usb@480500 { 183 + compatible = "brcm,bcm7435-ehci", "generic-ehci"; 184 + reg = <0x480500 0x100>; 185 + native-endian; 186 + interrupt-parent = <&periph_intc>; 187 + interrupts = <71>; 188 + status = "disabled"; 189 + }; 190 + 191 + ohci1: usb@480600 { 192 + compatible = "brcm,bcm7435-ohci", "generic-ohci"; 193 + reg = <0x480600 0x100>; 194 + native-endian; 195 + no-big-frame-no; 196 + interrupt-parent = <&periph_intc>; 197 + interrupts = <73>; 198 + status = "disabled"; 199 + }; 200 + 201 + ehci2: usb@490300 { 202 + compatible = "brcm,bcm7435-ehci", "generic-ehci"; 203 + reg = <0x490300 0x100>; 204 + native-endian; 205 + interrupt-parent = <&periph_intc>; 206 + interrupts = <75>; 207 + status = "disabled"; 208 + }; 209 + 210 + ohci2: usb@490400 { 211 + compatible = "brcm,bcm7435-ohci", "generic-ohci"; 212 + reg = <0x490400 0x100>; 213 + native-endian; 214 + no-big-frame-no; 215 + interrupt-parent = <&periph_intc>; 216 + interrupts = <77>; 217 + status = "disabled"; 218 + }; 219 + 220 + ehci3: usb@490500 { 221 + compatible = "brcm,bcm7435-ehci", "generic-ehci"; 222 + reg = <0x490500 0x100>; 223 + native-endian; 224 + interrupt-parent = <&periph_intc>; 225 + interrupts = <76>; 226 + status = "disabled"; 227 + }; 228 + 229 + ohci3: usb@490600 { 230 + compatible = "brcm,bcm7435-ohci", "generic-ohci"; 231 + reg = <0x490600 0x100>; 232 + native-endian; 233 + no-big-frame-no; 234 + interrupt-parent = <&periph_intc>; 235 + interrupts = <78>; 236 + status = "disabled"; 237 + }; 238 + }; 239 + };
+8
arch/mips/boot/dts/brcm/bcm97346dbsmb.dts
··· 21 21 status = "okay"; 22 22 }; 23 23 24 + &uart1 { 25 + status = "okay"; 26 + }; 27 + 28 + &uart2 { 29 + status = "okay"; 30 + }; 31 + 24 32 &enet0 { 25 33 status = "okay"; 26 34 };
+8
arch/mips/boot/dts/brcm/bcm97358svmb.dts
··· 21 21 status = "okay"; 22 22 }; 23 23 24 + &uart1 { 25 + status = "okay"; 26 + }; 27 + 28 + &uart2 { 29 + status = "okay"; 30 + }; 31 + 24 32 &enet0 { 25 33 status = "okay"; 26 34 };
+8
arch/mips/boot/dts/brcm/bcm97360svmb.dts
··· 21 21 status = "okay"; 22 22 }; 23 23 24 + &uart1 { 25 + status = "okay"; 26 + }; 27 + 28 + &uart2 { 29 + status = "okay"; 30 + }; 31 + 24 32 &enet0 { 25 33 status = "okay"; 26 34 };
+8
arch/mips/boot/dts/brcm/bcm97362svmb.dts
··· 21 21 status = "okay"; 22 22 }; 23 23 24 + &uart1 { 25 + status = "okay"; 26 + }; 27 + 28 + &uart2 { 29 + status = "okay"; 30 + }; 31 + 24 32 &enet0 { 25 33 status = "okay"; 26 34 };
+60
arch/mips/boot/dts/brcm/bcm97435svmb.dts
··· 1 + /dts-v1/; 2 + 3 + /include/ "bcm7435.dtsi" 4 + 5 + / { 6 + compatible = "brcm,bcm97435svmb", "brcm,bcm7435"; 7 + model = "Broadcom BCM97435SVMB"; 8 + 9 + memory@0 { 10 + device_type = "memory"; 11 + reg = <0x00000000 0x10000000>, 12 + <0x20000000 0x30000000>, 13 + <0x90000000 0x40000000>; 14 + }; 15 + 16 + chosen { 17 + bootargs = "console=ttyS0,115200 maxcpus=1"; 18 + stdout-path = &uart0; 19 + }; 20 + }; 21 + 22 + &uart0 { 23 + status = "okay"; 24 + }; 25 + 26 + &enet0 { 27 + status = "okay"; 28 + }; 29 + 30 + &ehci0 { 31 + status = "okay"; 32 + }; 33 + 34 + &ohci0 { 35 + status = "okay"; 36 + }; 37 + 38 + &ehci1 { 39 + status = "okay"; 40 + }; 41 + 42 + &ohci1 { 43 + status = "okay"; 44 + }; 45 + 46 + &ehci2 { 47 + status = "okay"; 48 + }; 49 + 50 + &ohci2 { 51 + status = "okay"; 52 + }; 53 + 54 + &ehci3 { 55 + status = "okay"; 56 + }; 57 + 58 + &ohci3 { 59 + status = "okay"; 60 + };
+10
arch/mips/boot/dts/ingenic/Makefile
··· 1 + dtb-$(CONFIG_JZ4740_QI_LB60) += qi_lb60.dtb 2 + dtb-$(CONFIG_JZ4780_CI20) += ci20.dtb 3 + 4 + obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) 5 + 6 + # Force kbuild to make empty built-in.o if necessary 7 + obj- += dummy.o 8 + 9 + always := $(dtb-y) 10 + clean-files := *.dtb *.dtb.S
+44
arch/mips/boot/dts/ingenic/ci20.dts
··· 1 + /dts-v1/; 2 + 3 + #include "jz4780.dtsi" 4 + 5 + / { 6 + compatible = "img,ci20", "ingenic,jz4780"; 7 + 8 + aliases { 9 + serial0 = &uart0; 10 + serial1 = &uart1; 11 + serial3 = &uart3; 12 + serial4 = &uart4; 13 + }; 14 + 15 + chosen { 16 + stdout-path = &uart4; 17 + }; 18 + 19 + memory { 20 + device_type = "memory"; 21 + reg = <0x0 0x10000000 22 + 0x30000000 0x30000000>; 23 + }; 24 + }; 25 + 26 + &ext { 27 + clock-frequency = <48000000>; 28 + }; 29 + 30 + &uart0 { 31 + status = "okay"; 32 + }; 33 + 34 + &uart1 { 35 + status = "okay"; 36 + }; 37 + 38 + &uart3 { 39 + status = "okay"; 40 + }; 41 + 42 + &uart4 { 43 + status = "okay"; 44 + };
+68
arch/mips/boot/dts/ingenic/jz4740.dtsi
··· 1 + #include <dt-bindings/clock/jz4740-cgu.h> 2 + 3 + / { 4 + #address-cells = <1>; 5 + #size-cells = <1>; 6 + compatible = "ingenic,jz4740"; 7 + 8 + cpuintc: interrupt-controller@0 { 9 + #address-cells = <0>; 10 + #interrupt-cells = <1>; 11 + interrupt-controller; 12 + compatible = "mti,cpu-interrupt-controller"; 13 + }; 14 + 15 + intc: interrupt-controller@10001000 { 16 + compatible = "ingenic,jz4740-intc"; 17 + reg = <0x10001000 0x14>; 18 + 19 + interrupt-controller; 20 + #interrupt-cells = <1>; 21 + 22 + interrupt-parent = <&cpuintc>; 23 + interrupts = <2>; 24 + }; 25 + 26 + ext: ext { 27 + compatible = "fixed-clock"; 28 + #clock-cells = <0>; 29 + }; 30 + 31 + rtc: rtc { 32 + compatible = "fixed-clock"; 33 + #clock-cells = <0>; 34 + clock-frequency = <32768>; 35 + }; 36 + 37 + cgu: jz4740-cgu@10000000 { 38 + compatible = "ingenic,jz4740-cgu"; 39 + reg = <0x10000000 0x100>; 40 + 41 + clocks = <&ext>, <&rtc>; 42 + clock-names = "ext", "rtc"; 43 + 44 + #clock-cells = <1>; 45 + }; 46 + 47 + uart0: serial@10030000 { 48 + compatible = "ingenic,jz4740-uart"; 49 + reg = <0x10030000 0x100>; 50 + 51 + interrupt-parent = <&intc>; 52 + interrupts = <9>; 53 + 54 + clocks = <&ext>, <&cgu JZ4740_CLK_UART0>; 55 + clock-names = "baud", "module"; 56 + }; 57 + 58 + uart1: serial@10031000 { 59 + compatible = "ingenic,jz4740-uart"; 60 + reg = <0x10031000 0x100>; 61 + 62 + interrupt-parent = <&intc>; 63 + interrupts = <8>; 64 + 65 + clocks = <&ext>, <&cgu JZ4740_CLK_UART1>; 66 + clock-names = "baud", "module"; 67 + }; 68 + };
+111
arch/mips/boot/dts/ingenic/jz4780.dtsi
··· 1 + #include <dt-bindings/clock/jz4780-cgu.h> 2 + 3 + / { 4 + #address-cells = <1>; 5 + #size-cells = <1>; 6 + compatible = "ingenic,jz4780"; 7 + 8 + cpuintc: interrupt-controller { 9 + #address-cells = <0>; 10 + #interrupt-cells = <1>; 11 + interrupt-controller; 12 + compatible = "mti,cpu-interrupt-controller"; 13 + }; 14 + 15 + intc: interrupt-controller@10001000 { 16 + compatible = "ingenic,jz4780-intc"; 17 + reg = <0x10001000 0x50>; 18 + 19 + interrupt-controller; 20 + #interrupt-cells = <1>; 21 + 22 + interrupt-parent = <&cpuintc>; 23 + interrupts = <2>; 24 + }; 25 + 26 + ext: ext { 27 + compatible = "fixed-clock"; 28 + #clock-cells = <0>; 29 + }; 30 + 31 + rtc: rtc { 32 + compatible = "fixed-clock"; 33 + #clock-cells = <0>; 34 + clock-frequency = <32768>; 35 + }; 36 + 37 + cgu: jz4780-cgu@10000000 { 38 + compatible = "ingenic,jz4780-cgu"; 39 + reg = <0x10000000 0x100>; 40 + 41 + clocks = <&ext>, <&rtc>; 42 + clock-names = "ext", "rtc"; 43 + 44 + #clock-cells = <1>; 45 + }; 46 + 47 + uart0: serial@10030000 { 48 + compatible = "ingenic,jz4780-uart"; 49 + reg = <0x10030000 0x100>; 50 + 51 + interrupt-parent = <&intc>; 52 + interrupts = <51>; 53 + 54 + clocks = <&ext>, <&cgu JZ4780_CLK_UART0>; 55 + clock-names = "baud", "module"; 56 + 57 + status = "disabled"; 58 + }; 59 + 60 + uart1: serial@10031000 { 61 + compatible = "ingenic,jz4780-uart"; 62 + reg = <0x10031000 0x100>; 63 + 64 + interrupt-parent = <&intc>; 65 + interrupts = <50>; 66 + 67 + clocks = <&ext>, <&cgu JZ4780_CLK_UART1>; 68 + clock-names = "baud", "module"; 69 + 70 + status = "disabled"; 71 + }; 72 + 73 + uart2: serial@10032000 { 74 + compatible = "ingenic,jz4780-uart"; 75 + reg = <0x10032000 0x100>; 76 + 77 + interrupt-parent = <&intc>; 78 + interrupts = <49>; 79 + 80 + clocks = <&ext>, <&cgu JZ4780_CLK_UART2>; 81 + clock-names = "baud", "module"; 82 + 83 + status = "disabled"; 84 + }; 85 + 86 + uart3: serial@10033000 { 87 + compatible = "ingenic,jz4780-uart"; 88 + reg = <0x10033000 0x100>; 89 + 90 + interrupt-parent = <&intc>; 91 + interrupts = <48>; 92 + 93 + clocks = <&ext>, <&cgu JZ4780_CLK_UART3>; 94 + clock-names = "baud", "module"; 95 + 96 + status = "disabled"; 97 + }; 98 + 99 + uart4: serial@10034000 { 100 + compatible = "ingenic,jz4780-uart"; 101 + reg = <0x10034000 0x100>; 102 + 103 + interrupt-parent = <&intc>; 104 + interrupts = <34>; 105 + 106 + clocks = <&ext>, <&cgu JZ4780_CLK_UART4>; 107 + clock-names = "baud", "module"; 108 + 109 + status = "disabled"; 110 + }; 111 + };
+15
arch/mips/boot/dts/ingenic/qi_lb60.dts
··· 1 + /dts-v1/; 2 + 3 + #include "jz4740.dtsi" 4 + 5 + / { 6 + compatible = "qi,lb60", "ingenic,jz4740"; 7 + 8 + chosen { 9 + stdout-path = &uart0; 10 + }; 11 + }; 12 + 13 + &ext { 14 + clock-frequency = <12000000>; 15 + };
+1
arch/mips/boot/dts/mti/Makefile
··· 1 + dtb-$(CONFIG_MIPS_MALTA) += malta.dtb 1 2 dtb-$(CONFIG_MIPS_SEAD3) += sead3.dtb 2 3 3 4 obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
+7
arch/mips/boot/dts/mti/malta.dts
··· 1 + /dts-v1/; 2 + 3 + / { 4 + #address-cells = <1>; 5 + #size-cells = <1>; 6 + compatible = "mti,malta"; 7 + };
+11
arch/mips/boot/dts/qca/Makefile
··· 1 + # All DTBs 2 + dtb-$(CONFIG_ATH79) += ar9132_tl_wr1043nd_v1.dtb 3 + 4 + # Select a DTB to build in the kernel 5 + obj-$(CONFIG_DTB_TL_WR1043ND_V1) += ar9132_tl_wr1043nd_v1.dtb.o 6 + 7 + # Force kbuild to make empty built-in.o if necessary 8 + obj- += dummy.o 9 + 10 + always := $(dtb-y) 11 + clean-files := *.dtb *.dtb.S
+133
arch/mips/boot/dts/qca/ar9132.dtsi
··· 1 + / { 2 + compatible = "qca,ar9132"; 3 + 4 + #address-cells = <1>; 5 + #size-cells = <1>; 6 + 7 + cpus { 8 + #address-cells = <1>; 9 + #size-cells = <0>; 10 + 11 + cpu@0 { 12 + device_type = "cpu"; 13 + compatible = "mips,mips24Kc"; 14 + reg = <0>; 15 + }; 16 + }; 17 + 18 + cpuintc: interrupt-controller { 19 + compatible = "qca,ar9132-cpu-intc", "qca,ar7100-cpu-intc"; 20 + 21 + interrupt-controller; 22 + #interrupt-cells = <1>; 23 + 24 + qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; 25 + qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, 26 + <&ddr_ctrl 0>, <&ddr_ctrl 1>; 27 + }; 28 + 29 + ahb { 30 + compatible = "simple-bus"; 31 + ranges; 32 + 33 + #address-cells = <1>; 34 + #size-cells = <1>; 35 + 36 + interrupt-parent = <&cpuintc>; 37 + 38 + apb { 39 + compatible = "simple-bus"; 40 + ranges; 41 + 42 + #address-cells = <1>; 43 + #size-cells = <1>; 44 + 45 + interrupt-parent = <&miscintc>; 46 + 47 + ddr_ctrl: memory-controller@18000000 { 48 + compatible = "qca,ar9132-ddr-controller", 49 + "qca,ar7240-ddr-controller"; 50 + reg = <0x18000000 0x100>; 51 + 52 + #qca,ddr-wb-channel-cells = <1>; 53 + }; 54 + 55 + uart@18020000 { 56 + compatible = "ns8250"; 57 + reg = <0x18020000 0x20>; 58 + interrupts = <3>; 59 + 60 + clocks = <&pll 2>; 61 + clock-names = "uart"; 62 + 63 + reg-io-width = <4>; 64 + reg-shift = <2>; 65 + no-loopback-test; 66 + 67 + status = "disabled"; 68 + }; 69 + 70 + gpio: gpio@18040000 { 71 + compatible = "qca,ar9132-gpio", 72 + "qca,ar7100-gpio"; 73 + reg = <0x18040000 0x30>; 74 + interrupts = <2>; 75 + 76 + ngpios = <22>; 77 + 78 + gpio-controller; 79 + #gpio-cells = <2>; 80 + 81 + interrupt-controller; 82 + #interrupt-cells = <2>; 83 + }; 84 + 85 + pll: pll-controller@18050000 { 86 + compatible = "qca,ar9132-ppl", 87 + "qca,ar9130-pll"; 88 + reg = <0x18050000 0x20>; 89 + 90 + clock-names = "ref"; 91 + /* The board must provides the ref clock */ 92 + 93 + #clock-cells = <1>; 94 + clock-output-names = "cpu", "ddr", "ahb"; 95 + }; 96 + 97 + wdt@18060008 { 98 + compatible = "qca,ar7130-wdt"; 99 + reg = <0x18060008 0x8>; 100 + 101 + interrupts = <4>; 102 + 103 + clocks = <&pll 2>; 104 + clock-names = "wdt"; 105 + }; 106 + 107 + miscintc: interrupt-controller@18060010 { 108 + compatible = "qca,ar9132-misc-intc", 109 + "qca,ar7100-misc-intc"; 110 + reg = <0x18060010 0x4>; 111 + 112 + interrupt-parent = <&cpuintc>; 113 + interrupts = <6>; 114 + 115 + interrupt-controller; 116 + #interrupt-cells = <1>; 117 + }; 118 + }; 119 + 120 + spi@1f000000 { 121 + compatible = "qca,ar9132-spi", "qca,ar7100-spi"; 122 + reg = <0x1f000000 0x10>; 123 + 124 + clocks = <&pll 2>; 125 + clock-names = "ahb"; 126 + 127 + status = "disabled"; 128 + 129 + #address-cells = <1>; 130 + #size-cells = <0>; 131 + }; 132 + }; 133 + };
+112
arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
··· 1 + /dts-v1/; 2 + 3 + #include <dt-bindings/gpio/gpio.h> 4 + #include <dt-bindings/input/input.h> 5 + 6 + #include "ar9132.dtsi" 7 + 8 + / { 9 + compatible = "tplink,tl-wr1043nd-v1", "qca,ar9132"; 10 + model = "TP-Link TL-WR1043ND Version 1"; 11 + 12 + alias { 13 + serial0 = "/ahb/apb/uart@18020000"; 14 + }; 15 + 16 + memory@0 { 17 + device_type = "memory"; 18 + reg = <0x0 0x2000000>; 19 + }; 20 + 21 + extosc: oscillator { 22 + compatible = "fixed-clock"; 23 + #clock-cells = <0>; 24 + clock-frequency = <40000000>; 25 + }; 26 + 27 + ahb { 28 + apb { 29 + uart@18020000 { 30 + status = "okay"; 31 + }; 32 + 33 + pll-controller@18050000 { 34 + clocks = <&extosc>; 35 + }; 36 + }; 37 + 38 + spi@1f000000 { 39 + status = "okay"; 40 + num-cs = <1>; 41 + 42 + flash@0 { 43 + #address-cells = <1>; 44 + #size-cells = <1>; 45 + compatible = "s25sl064a"; 46 + reg = <0>; 47 + spi-max-frequency = <25000000>; 48 + 49 + partition@0 { 50 + label = "u-boot"; 51 + reg = <0x000000 0x020000>; 52 + }; 53 + 54 + partition@1 { 55 + label = "firmware"; 56 + reg = <0x020000 0x7D0000>; 57 + }; 58 + 59 + partition@2 { 60 + label = "art"; 61 + reg = <0x7F0000 0x010000>; 62 + read-only; 63 + }; 64 + }; 65 + }; 66 + }; 67 + 68 + gpio-keys { 69 + compatible = "gpio-keys-polled"; 70 + #address-cells = <1>; 71 + #size-cells = <0>; 72 + 73 + poll-interval = <20>; 74 + button@0 { 75 + label = "reset"; 76 + linux,code = <KEY_RESTART>; 77 + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; 78 + debounce-interval = <60>; 79 + }; 80 + 81 + button@1 { 82 + label = "qss"; 83 + linux,code = <KEY_WPS_BUTTON>; 84 + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; 85 + debounce-interval = <60>; 86 + }; 87 + }; 88 + 89 + leds { 90 + compatible = "gpio-leds"; 91 + led@0 { 92 + label = "tp-link:green:usb"; 93 + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; 94 + }; 95 + 96 + led@1 { 97 + label = "tp-link:green:system"; 98 + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; 99 + linux,default-trigger = "heartbeat"; 100 + }; 101 + 102 + led@2 { 103 + label = "tp-link:green:qss"; 104 + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; 105 + }; 106 + 107 + led@3 { 108 + label = "tp-link:green:wlan"; 109 + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; 110 + }; 111 + }; 112 + };
+3 -1
arch/mips/cavium-octeon/octeon-irq.c
··· 698 698 699 699 static void octeon_irq_handle_trigger(unsigned int irq, struct irq_desc *desc) 700 700 { 701 - if (irq_get_trigger_type(irq) & IRQ_TYPE_EDGE_BOTH) 701 + struct irq_data *data = irq_desc_get_irq_data(desc); 702 + 703 + if (irqd_get_trigger_type(data) & IRQ_TYPE_EDGE_BOTH) 702 704 handle_edge_irq(irq, desc); 703 705 else 704 706 handle_level_irq(irq, desc);
+1 -2
arch/mips/cobalt/mtd.c
··· 57 57 58 58 return 0; 59 59 } 60 - 61 - module_init(cobalt_mtd_init); 60 + device_initcall(cobalt_mtd_init);
+162
arch/mips/configs/ci20_defconfig
··· 1 + CONFIG_MACH_INGENIC=y 2 + CONFIG_JZ4780_CI20=y 3 + CONFIG_HIGHMEM=y 4 + # CONFIG_COMPACTION is not set 5 + CONFIG_CMA=y 6 + CONFIG_HZ_100=y 7 + CONFIG_PREEMPT=y 8 + # CONFIG_SECCOMP is not set 9 + # CONFIG_LOCALVERSION_AUTO is not set 10 + CONFIG_KERNEL_XZ=y 11 + CONFIG_SYSVIPC=y 12 + CONFIG_POSIX_MQUEUE=y 13 + CONFIG_FHANDLE=y 14 + CONFIG_NO_HZ_IDLE=y 15 + CONFIG_HIGH_RES_TIMERS=y 16 + CONFIG_IKCONFIG=y 17 + CONFIG_IKCONFIG_PROC=y 18 + CONFIG_LOG_BUF_SHIFT=14 19 + CONFIG_CGROUPS=y 20 + CONFIG_CGROUP_FREEZER=y 21 + CONFIG_CGROUP_DEVICE=y 22 + CONFIG_CPUSETS=y 23 + CONFIG_CGROUP_CPUACCT=y 24 + CONFIG_MEMCG=y 25 + CONFIG_MEMCG_KMEM=y 26 + CONFIG_CGROUP_SCHED=y 27 + CONFIG_NAMESPACES=y 28 + CONFIG_USER_NS=y 29 + CONFIG_CC_OPTIMIZE_FOR_SIZE=y 30 + CONFIG_SYSCTL_SYSCALL=y 31 + CONFIG_KALLSYMS_ALL=y 32 + CONFIG_EMBEDDED=y 33 + # CONFIG_VM_EVENT_COUNTERS is not set 34 + # CONFIG_COMPAT_BRK is not set 35 + CONFIG_SLAB=y 36 + # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 37 + # CONFIG_SUSPEND is not set 38 + CONFIG_NET=y 39 + CONFIG_PACKET=y 40 + CONFIG_UNIX=y 41 + CONFIG_INET=y 42 + # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 43 + # CONFIG_INET_XFRM_MODE_TUNNEL is not set 44 + # CONFIG_INET_XFRM_MODE_BEET is not set 45 + # CONFIG_INET_LRO is not set 46 + # CONFIG_INET_DIAG is not set 47 + # CONFIG_IPV6 is not set 48 + # CONFIG_WIRELESS is not set 49 + CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 50 + CONFIG_DEVTMPFS=y 51 + # CONFIG_FW_LOADER is not set 52 + # CONFIG_ALLOW_DEV_COREDUMP is not set 53 + CONFIG_DMA_CMA=y 54 + CONFIG_CMA_SIZE_MBYTES=32 55 + CONFIG_NETDEVICES=y 56 + # CONFIG_NET_VENDOR_ARC is not set 57 + # CONFIG_NET_CADENCE is not set 58 + # CONFIG_NET_VENDOR_BROADCOM is not set 59 + CONFIG_DM9000=y 60 + CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL=y 61 + # CONFIG_NET_VENDOR_INTEL is not set 62 + # CONFIG_NET_VENDOR_MARVELL is not set 63 + # CONFIG_NET_VENDOR_MICREL is not set 64 + # CONFIG_NET_VENDOR_NATSEMI is not set 65 + # CONFIG_NET_VENDOR_QUALCOMM is not set 66 + # CONFIG_NET_VENDOR_ROCKER is not set 67 + # CONFIG_NET_VENDOR_SAMSUNG is not set 68 + # CONFIG_NET_VENDOR_SEEQ is not set 69 + # CONFIG_NET_VENDOR_SMSC is not set 70 + # CONFIG_NET_VENDOR_STMICRO is not set 71 + # CONFIG_NET_VENDOR_VIA is not set 72 + # CONFIG_NET_VENDOR_WIZNET is not set 73 + # CONFIG_WLAN is not set 74 + # CONFIG_INPUT_MOUSEDEV is not set 75 + # CONFIG_INPUT_KEYBOARD is not set 76 + # CONFIG_INPUT_MOUSE is not set 77 + # CONFIG_SERIO is not set 78 + CONFIG_VT_HW_CONSOLE_BINDING=y 79 + CONFIG_LEGACY_PTY_COUNT=2 80 + # CONFIG_DEVKMEM is not set 81 + CONFIG_SERIAL_8250=y 82 + CONFIG_SERIAL_8250_CONSOLE=y 83 + CONFIG_SERIAL_8250_NR_UARTS=5 84 + CONFIG_SERIAL_8250_RUNTIME_UARTS=5 85 + CONFIG_SERIAL_8250_INGENIC=y 86 + CONFIG_SERIAL_OF_PLATFORM=y 87 + # CONFIG_HW_RANDOM is not set 88 + CONFIG_I2C=y 89 + CONFIG_I2C_JZ4780=y 90 + CONFIG_GPIO_SYSFS=y 91 + # CONFIG_HWMON is not set 92 + CONFIG_REGULATOR=y 93 + CONFIG_REGULATOR_DEBUG=y 94 + CONFIG_REGULATOR_FIXED_VOLTAGE=y 95 + # CONFIG_VGA_CONSOLE is not set 96 + # CONFIG_HID is not set 97 + # CONFIG_USB_SUPPORT is not set 98 + CONFIG_MMC=y 99 + # CONFIG_IOMMU_SUPPORT is not set 100 + CONFIG_MEMORY=y 101 + # CONFIG_DNOTIFY is not set 102 + CONFIG_PROC_KCORE=y 103 + # CONFIG_PROC_PAGE_MONITOR is not set 104 + CONFIG_TMPFS=y 105 + CONFIG_CONFIGFS_FS=y 106 + # CONFIG_MISC_FILESYSTEMS is not set 107 + # CONFIG_NETWORK_FILESYSTEMS is not set 108 + CONFIG_NLS=y 109 + CONFIG_NLS_CODEPAGE_437=y 110 + CONFIG_NLS_CODEPAGE_737=y 111 + CONFIG_NLS_CODEPAGE_775=y 112 + CONFIG_NLS_CODEPAGE_850=y 113 + CONFIG_NLS_CODEPAGE_852=y 114 + CONFIG_NLS_CODEPAGE_855=y 115 + CONFIG_NLS_CODEPAGE_857=y 116 + CONFIG_NLS_CODEPAGE_860=y 117 + CONFIG_NLS_CODEPAGE_861=y 118 + CONFIG_NLS_CODEPAGE_862=y 119 + CONFIG_NLS_CODEPAGE_863=y 120 + CONFIG_NLS_CODEPAGE_864=y 121 + CONFIG_NLS_CODEPAGE_865=y 122 + CONFIG_NLS_CODEPAGE_866=y 123 + CONFIG_NLS_CODEPAGE_869=y 124 + CONFIG_NLS_CODEPAGE_936=y 125 + CONFIG_NLS_CODEPAGE_950=y 126 + CONFIG_NLS_CODEPAGE_932=y 127 + CONFIG_NLS_CODEPAGE_949=y 128 + CONFIG_NLS_CODEPAGE_874=y 129 + CONFIG_NLS_ISO8859_8=y 130 + CONFIG_NLS_CODEPAGE_1250=y 131 + CONFIG_NLS_CODEPAGE_1251=y 132 + CONFIG_NLS_ASCII=y 133 + CONFIG_NLS_ISO8859_1=y 134 + CONFIG_NLS_ISO8859_2=y 135 + CONFIG_NLS_ISO8859_3=y 136 + CONFIG_NLS_ISO8859_4=y 137 + CONFIG_NLS_ISO8859_5=y 138 + CONFIG_NLS_ISO8859_6=y 139 + CONFIG_NLS_ISO8859_7=y 140 + CONFIG_NLS_ISO8859_9=y 141 + CONFIG_NLS_ISO8859_13=y 142 + CONFIG_NLS_ISO8859_14=y 143 + CONFIG_NLS_ISO8859_15=y 144 + CONFIG_NLS_KOI8_R=y 145 + CONFIG_NLS_KOI8_U=y 146 + CONFIG_NLS_UTF8=y 147 + CONFIG_PRINTK_TIME=y 148 + CONFIG_DEBUG_INFO=y 149 + CONFIG_STRIP_ASM_SYMS=y 150 + CONFIG_DEBUG_FS=y 151 + CONFIG_MAGIC_SYSRQ=y 152 + CONFIG_LOCKUP_DETECTOR=y 153 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 154 + CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y 155 + CONFIG_PANIC_ON_OOPS=y 156 + CONFIG_PANIC_TIMEOUT=10 157 + # CONFIG_SCHED_DEBUG is not set 158 + # CONFIG_DEBUG_PREEMPT is not set 159 + CONFIG_STACKTRACE=y 160 + # CONFIG_FTRACE is not set 161 + CONFIG_CMDLINE_BOOL=y 162 + CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"
+1 -1
arch/mips/configs/fuloong2e_defconfig
··· 1 - CONFIG_MACH_LOONGSON=y 1 + CONFIG_MACH_LOONGSON64=y 2 2 CONFIG_64BIT=y 3 3 CONFIG_NO_HZ=y 4 4 CONFIG_HIGH_RES_TIMERS=y
+1 -1
arch/mips/configs/lemote2f_defconfig
··· 1 - CONFIG_MACH_LOONGSON=y 1 + CONFIG_MACH_LOONGSON64=y 2 2 CONFIG_LEMOTE_MACH2F=y 3 3 CONFIG_CS5536_MFGPT=y 4 4 CONFIG_64BIT=y
+1 -1
arch/mips/configs/loongson3_defconfig
··· 1 - CONFIG_MACH_LOONGSON=y 1 + CONFIG_MACH_LOONGSON64=y 2 2 CONFIG_SWIOTLB=y 3 3 CONFIG_LOONGSON_MACH3X=y 4 4 CONFIG_CPU_LOONGSON3=y
+1 -1
arch/mips/configs/ls1b_defconfig
··· 1 - CONFIG_MACH_LOONGSON1=y 1 + CONFIG_MACH_LOONGSON32=y 2 2 CONFIG_PREEMPT=y 3 3 # CONFIG_SECCOMP is not set 4 4 CONFIG_EXPERIMENTAL=y
+8 -9
arch/mips/configs/maltasmvp_defconfig
··· 84 84 CONFIG_DEVTMPFS=y 85 85 CONFIG_BLK_DEV_LOOP=y 86 86 CONFIG_BLK_DEV_CRYPTOLOOP=m 87 - CONFIG_IDE=y 88 - # CONFIG_IDE_PROC_FS is not set 89 - # CONFIG_IDEPCI_PCIBUS_ORDER is not set 90 - CONFIG_BLK_DEV_GENERIC=y 91 - CONFIG_BLK_DEV_PIIX=y 92 - CONFIG_SCSI=y 93 87 CONFIG_BLK_DEV_SD=y 94 88 CONFIG_CHR_DEV_SG=y 95 89 # CONFIG_SCSI_LOWLEVEL is not set 90 + CONFIG_ATA=y 91 + # CONFIG_SATA_PMP is not set 92 + CONFIG_ATA_PIIX=y 96 93 CONFIG_NETDEVICES=y 97 94 # CONFIG_NET_VENDOR_3COM is not set 98 95 # CONFIG_NET_VENDOR_ADAPTEC is not set ··· 135 138 CONFIG_SERIAL_8250_CONSOLE=y 136 139 CONFIG_HW_RANDOM=y 137 140 # CONFIG_HWMON is not set 138 - CONFIG_VIDEO_OUTPUT_CONTROL=m 139 141 CONFIG_FB=y 140 142 CONFIG_FIRMWARE_EDID=y 141 143 CONFIG_FB_MATROX=y ··· 148 152 CONFIG_LEDS_CLASS=y 149 153 CONFIG_LEDS_TRIGGERS=y 150 154 CONFIG_LEDS_TRIGGER_TIMER=y 151 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 152 155 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 153 156 CONFIG_LEDS_TRIGGER_BACKLIGHT=y 154 157 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ··· 155 160 CONFIG_RTC_DRV_CMOS=y 156 161 CONFIG_EXT2_FS=y 157 162 CONFIG_EXT3_FS=y 158 - # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 163 + CONFIG_EXT3_FS_POSIX_ACL=y 164 + CONFIG_EXT3_FS_SECURITY=y 165 + CONFIG_EXT4_FS=y 166 + CONFIG_EXT4_FS_POSIX_ACL=y 167 + CONFIG_EXT4_FS_SECURITY=y 159 168 CONFIG_XFS_FS=y 160 169 CONFIG_XFS_QUOTA=y 161 170 CONFIG_XFS_POSIX_ACL=y
+1
arch/mips/configs/pistachio_defconfig
··· 272 272 CONFIG_CC10001_ADC=y 273 273 CONFIG_PWM=y 274 274 CONFIG_PWM_IMG=y 275 + CONFIG_PHY_PISTACHIO_USB=y 275 276 CONFIG_ANDROID=y 276 277 CONFIG_EXT4_FS=y 277 278 CONFIG_EXT4_FS_POSIX_ACL=y
+2 -1
arch/mips/configs/qi_lb60_defconfig
··· 1 - CONFIG_MACH_JZ4740=y 1 + CONFIG_MACH_INGENIC=y 2 2 # CONFIG_COMPACTION is not set 3 3 # CONFIG_CROSS_MEMORY_ATTACH is not set 4 4 CONFIG_HZ_100=y ··· 66 66 # CONFIG_SERIAL_8250_DMA is not set 67 67 CONFIG_SERIAL_8250_NR_UARTS=2 68 68 CONFIG_SERIAL_8250_RUNTIME_UARTS=2 69 + CONFIG_SERIAL_8250_INGENIC=y 69 70 # CONFIG_HW_RANDOM is not set 70 71 CONFIG_SPI=y 71 72 CONFIG_SPI_GPIO=y
+11
arch/mips/include/asm/asmmacro.h
··· 211 211 .endm 212 212 213 213 #ifdef TOOLCHAIN_SUPPORTS_MSA 214 + /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ 215 + #undef fp 216 + 214 217 .macro _cfcmsa rd, cs 215 218 .set push 216 219 .set mips32r2 220 + .set fp=64 217 221 .set msa 218 222 cfcmsa \rd, $\cs 219 223 .set pop ··· 226 222 .macro _ctcmsa cd, rs 227 223 .set push 228 224 .set mips32r2 225 + .set fp=64 229 226 .set msa 230 227 ctcmsa $\cd, \rs 231 228 .set pop ··· 235 230 .macro ld_d wd, off, base 236 231 .set push 237 232 .set mips32r2 233 + .set fp=64 238 234 .set msa 239 235 ld.d $w\wd, \off(\base) 240 236 .set pop ··· 244 238 .macro st_d wd, off, base 245 239 .set push 246 240 .set mips32r2 241 + .set fp=64 247 242 .set msa 248 243 st.d $w\wd, \off(\base) 249 244 .set pop ··· 253 246 .macro copy_u_w ws, n 254 247 .set push 255 248 .set mips32r2 249 + .set fp=64 256 250 .set msa 257 251 copy_u.w $1, $w\ws[\n] 258 252 .set pop ··· 262 254 .macro copy_u_d ws, n 263 255 .set push 264 256 .set mips64r2 257 + .set fp=64 265 258 .set msa 266 259 copy_u.d $1, $w\ws[\n] 267 260 .set pop ··· 271 262 .macro insert_w wd, n 272 263 .set push 273 264 .set mips32r2 265 + .set fp=64 274 266 .set msa 275 267 insert.w $w\wd[\n], $1 276 268 .set pop ··· 280 270 .macro insert_d wd, n 281 271 .set push 282 272 .set mips64r2 273 + .set fp=64 283 274 .set msa 284 275 insert.d $w\wd[\n], $1 285 276 .set pop
+1 -1
arch/mips/include/asm/bitops.h
··· 469 469 */ 470 470 static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *addr) 471 471 { 472 - smp_mb(); 472 + smp_mb__before_llsc(); 473 473 __clear_bit(nr, addr); 474 474 } 475 475
+7
arch/mips/include/asm/bmips-spaces.h
··· 1 + #ifndef __ASM_BMIPS_SPACES_H 2 + #define __ASM_BMIPS_SPACES_H 3 + 4 + /* Avoid collisions with system base register (SBR) region on BMIPS3300 */ 5 + #define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000) 6 + 7 + #endif /* __ASM_BMIPS_SPACES_H */
+3
arch/mips/include/asm/cpu-features.h
··· 108 108 #ifndef cpu_has_llsc 109 109 #define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC) 110 110 #endif 111 + #ifndef cpu_has_bp_ghist 112 + #define cpu_has_bp_ghist (cpu_data[0].options & MIPS_CPU_BP_GHIST) 113 + #endif 111 114 #ifndef kernel_uses_llsc 112 115 #define kernel_uses_llsc cpu_has_llsc 113 116 #endif
+1 -1
arch/mips/include/asm/cpu-type.h
··· 32 32 case CPU_4KC: 33 33 case CPU_ALCHEMY: 34 34 case CPU_PR4450: 35 - case CPU_JZRISC: 36 35 #endif 37 36 38 37 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \ 39 38 defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) 40 39 case CPU_4KEC: 40 + case CPU_JZRISC: 41 41 #endif 42 42 43 43 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2
+5 -2
arch/mips/include/asm/cpu.h
··· 42 42 #define PRID_COMP_LEXRA 0x0b0000 43 43 #define PRID_COMP_NETLOGIC 0x0c0000 44 44 #define PRID_COMP_CAVIUM 0x0d0000 45 - #define PRID_COMP_INGENIC 0xd00000 45 + #define PRID_COMP_INGENIC_D0 0xd00000 /* JZ4740, JZ4750 */ 46 + #define PRID_COMP_INGENIC_D1 0xd10000 /* JZ4770, JZ4775 */ 47 + #define PRID_COMP_INGENIC_E1 0xe10000 /* JZ4780 */ 46 48 47 49 /* 48 50 * Assigned Processor ID (implementation) values for bits 15:8 of the PRId ··· 170 168 #define PRID_IMP_CAVIUM_CN70XX 0x9600 171 169 172 170 /* 173 - * These are the PRID's for when 23:16 == PRID_COMP_INGENIC 171 + * These are the PRID's for when 23:16 == PRID_COMP_INGENIC_* 174 172 */ 175 173 176 174 #define PRID_IMP_JZRISC 0x0200 ··· 381 379 #define MIPS_CPU_RW_LLB 0x1000000000ull /* LLADDR/LLB writes are allowed */ 382 380 #define MIPS_CPU_XPA 0x2000000000ull /* CPU supports Extended Physical Addressing */ 383 381 #define MIPS_CPU_CDMM 0x4000000000ull /* CPU has Common Device Memory Map */ 382 + #define MIPS_CPU_BP_GHIST 0x8000000000ull /* R12K+ Branch Prediction Global History */ 384 383 385 384 /* 386 385 * CPU ASE encodings
+52
arch/mips/include/asm/hazards.h
··· 31 31 #define __mtc0_tlbw_hazard \ 32 32 ___ehb 33 33 34 + #define __mtc0_tlbr_hazard \ 35 + ___ehb 36 + 34 37 #define __tlbw_use_hazard \ 38 + ___ehb 39 + 40 + #define __tlb_read_hazard \ 35 41 ___ehb 36 42 37 43 #define __tlb_probe_hazard \ ··· 86 80 ___ssnop; \ 87 81 ___ehb 88 82 83 + #define __mtc0_tlbr_hazard \ 84 + ___ssnop; \ 85 + ___ssnop; \ 86 + ___ehb 87 + 89 88 #define __tlbw_use_hazard \ 89 + ___ssnop; \ 90 + ___ssnop; \ 91 + ___ssnop; \ 92 + ___ehb 93 + 94 + #define __tlb_read_hazard \ 90 95 ___ssnop; \ 91 96 ___ssnop; \ 92 97 ___ssnop; \ ··· 164 147 165 148 #define __mtc0_tlbw_hazard 166 149 150 + #define __mtc0_tlbr_hazard 151 + 167 152 #define __tlbw_use_hazard 153 + 154 + #define __tlb_read_hazard 168 155 169 156 #define __tlb_probe_hazard 170 157 ··· 187 166 */ 188 167 #define __mtc0_tlbw_hazard 189 168 169 + #define __mtc0_tlbr_hazard 170 + 190 171 #define __tlbw_use_hazard 172 + 173 + #define __tlb_read_hazard 191 174 192 175 #define __tlb_probe_hazard 193 176 ··· 221 196 nop; \ 222 197 nop 223 198 199 + #define __mtc0_tlbr_hazard \ 200 + nop; \ 201 + nop 202 + 224 203 #define __tlbw_use_hazard \ 204 + nop; \ 205 + nop; \ 206 + nop 207 + 208 + #define __tlb_read_hazard \ 225 209 nop; \ 226 210 nop; \ 227 211 nop ··· 301 267 #define _ssnop ___ssnop 302 268 #define _ehb ___ehb 303 269 #define mtc0_tlbw_hazard __mtc0_tlbw_hazard 270 + #define mtc0_tlbr_hazard __mtc0_tlbr_hazard 304 271 #define tlbw_use_hazard __tlbw_use_hazard 272 + #define tlb_read_hazard __tlb_read_hazard 305 273 #define tlb_probe_hazard __tlb_probe_hazard 306 274 #define irq_enable_hazard __irq_enable_hazard 307 275 #define irq_disable_hazard __irq_disable_hazard ··· 336 300 } while (0) 337 301 338 302 303 + #define mtc0_tlbr_hazard() \ 304 + do { \ 305 + __asm__ __volatile__( \ 306 + __stringify(__mtc0_tlbr_hazard) \ 307 + ); \ 308 + } while (0) 309 + 310 + 339 311 #define tlbw_use_hazard() \ 340 312 do { \ 341 313 __asm__ __volatile__( \ 342 314 __stringify(__tlbw_use_hazard) \ 315 + ); \ 316 + } while (0) 317 + 318 + 319 + #define tlb_read_hazard() \ 320 + do { \ 321 + __asm__ __volatile__( \ 322 + __stringify(__tlb_read_hazard) \ 343 323 ); \ 344 324 } while (0) 345 325
+1
arch/mips/include/asm/i8259.h
··· 41 41 extern void make_8259A_irq(unsigned int irq); 42 42 43 43 extern void init_i8259_irqs(void); 44 + extern int i8259_of_init(struct device_node *node, struct device_node *parent); 44 45 45 46 /* 46 47 * Do the traditional i8259 interrupt polling thing. This is for the few
+2 -2
arch/mips/include/asm/irqflags.h
··· 60 60 " .set push \n" 61 61 " .set noreorder \n" 62 62 " .set noat \n" 63 - #if defined(CONFIG_IRQ_CPU) 63 + #if defined(CONFIG_IRQ_MIPS_CPU) 64 64 /* 65 65 * Slow, but doesn't suffer from a relatively unlikely race 66 66 * condition we're having since days 1. ··· 90 90 " .set push \n" 91 91 " .set noreorder \n" 92 92 " .set noat \n" 93 - #if defined(CONFIG_IRQ_CPU) 93 + #if defined(CONFIG_IRQ_MIPS_CPU) 94 94 /* 95 95 * Slow, but doesn't suffer from a relatively unlikely race 96 96 * condition we're having since days 1.
-1
arch/mips/include/asm/kgdb.h
··· 33 33 #define CACHE_FLUSH_IS_SAFE 0 34 34 35 35 extern void arch_kgdb_breakpoint(void); 36 - extern int kgdb_early_setup; 37 36 extern void *saved_vectors[32]; 38 37 extern void handle_exception(struct pt_regs *regs); 39 38 extern void breakinst(void);
+6 -6
arch/mips/include/asm/mach-ath79/ar71xx_regs.h
··· 157 157 #define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10 158 158 #define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14 159 159 160 - #define AR71XX_PLL_DIV_SHIFT 3 161 - #define AR71XX_PLL_DIV_MASK 0x1f 160 + #define AR71XX_PLL_FB_SHIFT 3 161 + #define AR71XX_PLL_FB_MASK 0x1f 162 162 #define AR71XX_CPU_DIV_SHIFT 16 163 163 #define AR71XX_CPU_DIV_MASK 0x3 164 164 #define AR71XX_DDR_DIV_SHIFT 18 ··· 169 169 #define AR724X_PLL_REG_CPU_CONFIG 0x00 170 170 #define AR724X_PLL_REG_PCIE_CONFIG 0x18 171 171 172 - #define AR724X_PLL_DIV_SHIFT 0 173 - #define AR724X_PLL_DIV_MASK 0x3ff 172 + #define AR724X_PLL_FB_SHIFT 0 173 + #define AR724X_PLL_FB_MASK 0x3ff 174 174 #define AR724X_PLL_REF_DIV_SHIFT 10 175 175 #define AR724X_PLL_REF_DIV_MASK 0xf 176 176 #define AR724X_AHB_DIV_SHIFT 19 ··· 183 183 #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14 184 184 #define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18 185 185 186 - #define AR913X_PLL_DIV_SHIFT 0 187 - #define AR913X_PLL_DIV_MASK 0x3ff 186 + #define AR913X_PLL_FB_SHIFT 0 187 + #define AR913X_PLL_FB_MASK 0x3ff 188 188 #define AR913X_DDR_DIV_SHIFT 22 189 189 #define AR913X_DDR_DIV_MASK 0x3 190 190 #define AR913X_AHB_DIV_SHIFT 19
+2 -1
arch/mips/include/asm/mach-ath79/ath79.h
··· 115 115 return soc_is_qca9556() || soc_is_qca9558(); 116 116 } 117 117 118 - extern void __iomem *ath79_ddr_base; 118 + void ath79_ddr_set_pci_windows(void); 119 + 119 120 extern void __iomem *ath79_pll_base; 120 121 extern void __iomem *ath79_reset_base; 121 122
-4
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
··· 52 52 void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, 53 53 const char *prefix); 54 54 #endif 55 - #ifdef CONFIG_BCM47XX_BCMA 56 - void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo, 57 - const char *prefix); 58 - #endif 59 55 60 56 void bcm47xx_set_system_type(u16 chip_id); 61 57
+2
arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
··· 80 80 BCM47XX_BOARD_LINKSYS_WRT610NV2, 81 81 BCM47XX_BOARD_LINKSYS_WRTSL54GS, 82 82 83 + BCM47XX_BOARD_LUXUL_XWR_1750_V1, 84 + 83 85 BCM47XX_BOARD_MICROSOFT_MN700, 84 86 85 87 BCM47XX_BOARD_MOTOROLA_WE800G,
+1 -1
arch/mips/include/asm/mach-bcm63xx/spaces.h
··· 10 10 #ifndef _ASM_BCM63XX_SPACES_H 11 11 #define _ASM_BCM63XX_SPACES_H 12 12 13 - #define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000) 13 + #include <asm/bmips-spaces.h> 14 14 15 15 #include <asm/mach-generic/spaces.h> 16 16
+1 -1
arch/mips/include/asm/mach-bmips/spaces.h
··· 11 11 #define _ASM_BMIPS_SPACES_H 12 12 13 13 /* Avoid collisions with system base register (SBR) region on BMIPS3300 */ 14 - #define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000) 14 + #include <asm/bmips-spaces.h> 15 15 16 16 #include <asm/mach-generic/spaces.h> 17 17
+16
arch/mips/include/asm/mach-dec/cpu-feature-overrides.h
··· 14 14 15 15 /* Generic ones first. */ 16 16 #define cpu_has_tlb 1 17 + #define cpu_has_tlbinv 0 18 + #define cpu_has_segments 0 19 + #define cpu_has_eva 0 20 + #define cpu_has_htw 0 21 + #define cpu_has_rixiex 0 22 + #define cpu_has_maar 0 23 + #define cpu_has_rw_llb 0 17 24 #define cpu_has_tx39_cache 0 18 25 #define cpu_has_divec 0 19 26 #define cpu_has_prefetch 0 ··· 31 24 #define cpu_has_mips3d 0 32 25 #define cpu_has_smartmips 0 33 26 #define cpu_has_rixi 0 27 + #define cpu_has_xpa 0 34 28 #define cpu_has_vtag_icache 0 35 29 #define cpu_has_ic_fills_f_dc 0 36 30 #define cpu_has_pindexed_dcache 0 ··· 44 36 #define cpu_has_mips64r1 0 45 37 #define cpu_has_mips64r2 0 46 38 #define cpu_has_dsp 0 39 + #define cpu_has_dsp2 0 47 40 #define cpu_has_mipsmt 0 48 41 #define cpu_has_userlocal 0 42 + #define cpu_hwrena_impl_bits 0 43 + #define cpu_has_perf_cntr_intr_bit 0 44 + #define cpu_has_vz 0 45 + #define cpu_has_fre 0 46 + #define cpu_has_cdmm 0 49 47 50 48 /* R3k-specific ones. */ 51 49 #ifdef CONFIG_CPU_R3000 50 + #define cpu_has_3kex 1 52 51 #define cpu_has_4kex 0 53 52 #define cpu_has_3k_cache 1 54 53 #define cpu_has_4k_cache 0 ··· 78 63 79 64 /* R4k-specific ones. */ 80 65 #ifdef CONFIG_CPU_R4X00 66 + #define cpu_has_3kex 0 81 67 #define cpu_has_4kex 1 82 68 #define cpu_has_3k_cache 0 83 69 #define cpu_has_4k_cache 1
+2 -2
arch/mips/include/asm/mach-generic/irq.h
··· 18 18 #endif 19 19 #endif 20 20 21 - #ifdef CONFIG_IRQ_CPU 21 + #ifdef CONFIG_IRQ_MIPS_CPU 22 22 23 23 #ifndef MIPS_CPU_IRQ_BASE 24 24 #ifdef CONFIG_I8259 ··· 34 34 #endif 35 35 #endif 36 36 37 - #endif /* CONFIG_IRQ_CPU */ 37 + #endif /* CONFIG_IRQ_MIPS_CPU */ 38 38 39 39 #ifdef CONFIG_MIPS_GIC 40 40 #ifndef MIPS_GIC_IRQ_BASE
+4
arch/mips/include/asm/mach-generic/spaces.h
··· 94 94 #endif 95 95 96 96 #ifndef FIXADDR_TOP 97 + #ifdef CONFIG_KVM_GUEST 98 + #define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000) 99 + #else 97 100 #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000) 101 + #endif 98 102 #endif 99 103 100 104 #endif /* __ASM_MACH_GENERIC_SPACES_H */
+57 -35
arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h
··· 11 11 #include <asm/cpu.h> 12 12 13 13 /* 14 - * IP27 only comes with R10000 family processors all using the same config 14 + * IP27 only comes with R1x000 family processors, all using the same config 15 15 */ 16 - #define cpu_has_watch 1 17 - #define cpu_has_mips16 0 18 - #define cpu_has_divec 0 19 - #define cpu_has_vce 0 20 - #define cpu_has_cache_cdex_p 0 21 - #define cpu_has_cache_cdex_s 0 22 - #define cpu_has_prefetch 1 23 - #define cpu_has_mcheck 0 24 - #define cpu_has_ejtag 0 16 + #define cpu_has_tlb 1 17 + #define cpu_has_tlbinv 0 18 + #define cpu_has_segments 0 19 + #define cpu_has_eva 0 20 + #define cpu_has_htw 0 21 + #define cpu_has_rixiex 0 22 + #define cpu_has_maar 0 23 + #define cpu_has_rw_llb 0 24 + #define cpu_has_3kex 0 25 + #define cpu_has_4kex 1 26 + #define cpu_has_3k_cache 0 27 + #define cpu_has_4k_cache 1 28 + #define cpu_has_6k_cache 0 29 + #define cpu_has_8k_cache 0 30 + #define cpu_has_tx39_cache 0 31 + #define cpu_has_fpu 1 32 + #define cpu_has_nofpuex 0 33 + #define cpu_has_32fpr 1 34 + #define cpu_has_counter 1 35 + #define cpu_has_watch 1 36 + #define cpu_has_64bits 1 37 + #define cpu_has_divec 0 38 + #define cpu_has_vce 0 39 + #define cpu_has_cache_cdex_p 0 40 + #define cpu_has_cache_cdex_s 0 41 + #define cpu_has_prefetch 1 42 + #define cpu_has_mcheck 0 43 + #define cpu_has_ejtag 0 44 + #define cpu_has_llsc 1 45 + #define cpu_has_mips16 0 46 + #define cpu_has_mdmx 0 47 + #define cpu_has_mips3d 0 48 + #define cpu_has_smartmips 0 49 + #define cpu_has_rixi 0 50 + #define cpu_has_xpa 0 51 + #define cpu_has_vtag_icache 0 52 + #define cpu_has_dc_aliases 0 53 + #define cpu_has_ic_fills_f_dc 0 25 54 26 - #define cpu_has_llsc 1 27 - #define cpu_has_vtag_icache 0 28 - #define cpu_has_dc_aliases 0 29 - #define cpu_has_ic_fills_f_dc 0 30 - #define cpu_has_dsp 0 31 - #define cpu_has_dsp2 0 32 55 #define cpu_icache_snoops_remote_store 1 33 - #define cpu_has_mipsmt 0 34 - #define cpu_has_userlocal 0 35 56 36 - #define cpu_has_nofpuex 0 37 - #define cpu_has_64bits 1 57 + #define cpu_has_mips32r1 0 58 + #define cpu_has_mips32r2 0 59 + #define cpu_has_mips64r1 0 60 + #define cpu_has_mips64r2 0 61 + #define cpu_has_mips32r6 0 62 + #define cpu_has_mips64r6 0 38 63 39 - #define cpu_has_4kex 1 40 - #define cpu_has_3k_cache 0 41 - #define cpu_has_6k_cache 0 42 - #define cpu_has_4k_cache 1 43 - #define cpu_has_8k_cache 0 44 - #define cpu_has_tx39_cache 0 45 - 64 + #define cpu_has_dsp 0 65 + #define cpu_has_dsp2 0 66 + #define cpu_has_mipsmt 0 67 + #define cpu_has_userlocal 0 46 68 #define cpu_has_inclusive_pcaches 1 69 + #define cpu_hwrena_impl_bits 0 70 + #define cpu_has_perf_cntr_intr_bit 0 71 + #define cpu_has_vz 0 72 + #define cpu_has_fre 0 73 + #define cpu_has_cdmm 0 47 74 48 - #define cpu_dcache_line_size() 32 49 - #define cpu_icache_line_size() 64 50 - #define cpu_scache_line_size() 128 51 - 52 - #define cpu_has_mips32r1 0 53 - #define cpu_has_mips32r2 0 54 - #define cpu_has_mips64r1 0 55 - #define cpu_has_mips64r2 0 75 + #define cpu_dcache_line_size() 32 76 + #define cpu_icache_line_size() 64 77 + #define cpu_scache_line_size() 128 56 78 57 79 #endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */
+3
arch/mips/include/asm/mach-jz4740/clock.h
··· 22 22 23 23 void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode); 24 24 25 + void jz4740_clock_suspend(void); 26 + void jz4740_clock_resume(void); 27 + 25 28 void jz4740_clock_udc_enable_auto_suspend(void); 26 29 void jz4740_clock_udc_disable_auto_suspend(void); 27 30
-3
arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h
··· 12 12 #define cpu_has_3k_cache 0 13 13 #define cpu_has_4k_cache 1 14 14 #define cpu_has_tx39_cache 0 15 - #define cpu_has_fpu 0 16 - #define cpu_has_32fpr 0 17 15 #define cpu_has_counter 0 18 16 #define cpu_has_watch 1 19 17 #define cpu_has_divec 1 ··· 32 34 #define cpu_has_ic_fills_f_dc 0 33 35 #define cpu_has_pindexed_dcache 0 34 36 #define cpu_has_mips32r1 1 35 - #define cpu_has_mips32r2 0 36 37 #define cpu_has_mips64r1 0 37 38 #define cpu_has_mips64r2 0 38 39 #define cpu_has_dsp 0
+11 -3
arch/mips/include/asm/mach-jz4740/irq.h
··· 19 19 #define MIPS_CPU_IRQ_BASE 0 20 20 #define JZ4740_IRQ_BASE 8 21 21 22 + #ifdef CONFIG_MACH_JZ4740 23 + # define NR_INTC_IRQS 32 24 + #else 25 + # define NR_INTC_IRQS 64 26 + #endif 27 + 22 28 /* 1st-level interrupts */ 23 29 #define JZ4740_IRQ(x) (JZ4740_IRQ_BASE + (x)) 24 30 #define JZ4740_IRQ_I2C JZ4740_IRQ(1) ··· 50 44 #define JZ4740_IRQ_IPU JZ4740_IRQ(29) 51 45 #define JZ4740_IRQ_LCD JZ4740_IRQ(30) 52 46 47 + #define JZ4780_IRQ_TCU2 JZ4740_IRQ(25) 48 + 53 49 /* 2nd-level interrupts */ 54 - #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (x)) 50 + #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(NR_INTC_IRQS) + (x)) 55 51 56 52 #define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) 57 - #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x)) 53 + #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(NR_INTC_IRQS + 16) + (x)) 58 54 59 - #define JZ4740_IRQ_ADC_BASE JZ4740_IRQ(176) 55 + #define JZ4740_IRQ_ADC_BASE JZ4740_IRQ(NR_INTC_IRQS + 144) 60 56 61 57 #define NR_IRQS (JZ4740_IRQ_ADC_BASE + 6) 62 58
-2
arch/mips/include/asm/mach-jz4740/platform.h
··· 35 35 extern struct platform_device jz4740_pwm_device; 36 36 extern struct platform_device jz4740_dma_device; 37 37 38 - void jz4740_serial_device_register(void); 39 - 40 38 #endif
-210
arch/mips/include/asm/mach-loongson/boot_param.h
··· 1 - #ifndef __ASM_MACH_LOONGSON_BOOT_PARAM_H_ 2 - #define __ASM_MACH_LOONGSON_BOOT_PARAM_H_ 3 - 4 - #define SYSTEM_RAM_LOW 1 5 - #define SYSTEM_RAM_HIGH 2 6 - #define MEM_RESERVED 3 7 - #define PCI_IO 4 8 - #define PCI_MEM 5 9 - #define LOONGSON_CFG_REG 6 10 - #define VIDEO_ROM 7 11 - #define ADAPTER_ROM 8 12 - #define ACPI_TABLE 9 13 - #define SMBIOS_TABLE 10 14 - #define MAX_MEMORY_TYPE 11 15 - 16 - #define LOONGSON3_BOOT_MEM_MAP_MAX 128 17 - struct efi_memory_map_loongson { 18 - u16 vers; /* version of efi_memory_map */ 19 - u32 nr_map; /* number of memory_maps */ 20 - u32 mem_freq; /* memory frequence */ 21 - struct mem_map { 22 - u32 node_id; /* node_id which memory attached to */ 23 - u32 mem_type; /* system memory, pci memory, pci io, etc. */ 24 - u64 mem_start; /* memory map start address */ 25 - u32 mem_size; /* each memory_map size, not the total size */ 26 - } map[LOONGSON3_BOOT_MEM_MAP_MAX]; 27 - } __packed; 28 - 29 - enum loongson_cpu_type { 30 - Loongson_2E = 0, 31 - Loongson_2F = 1, 32 - Loongson_3A = 2, 33 - Loongson_3B = 3, 34 - Loongson_1A = 4, 35 - Loongson_1B = 5 36 - }; 37 - 38 - /* 39 - * Capability and feature descriptor structure for MIPS CPU 40 - */ 41 - struct efi_cpuinfo_loongson { 42 - u16 vers; /* version of efi_cpuinfo_loongson */ 43 - u32 processor_id; /* PRID, e.g. 6305, 6306 */ 44 - u32 cputype; /* Loongson_3A/3B, etc. */ 45 - u32 total_node; /* num of total numa nodes */ 46 - u16 cpu_startup_core_id; /* Boot core id */ 47 - u16 reserved_cores_mask; 48 - u32 cpu_clock_freq; /* cpu_clock */ 49 - u32 nr_cpus; 50 - } __packed; 51 - 52 - #define MAX_UARTS 64 53 - struct uart_device { 54 - u32 iotype; /* see include/linux/serial_core.h */ 55 - u32 uartclk; 56 - u32 int_offset; 57 - u64 uart_base; 58 - } __packed; 59 - 60 - #define MAX_SENSORS 64 61 - #define SENSOR_TEMPER 0x00000001 62 - #define SENSOR_VOLTAGE 0x00000002 63 - #define SENSOR_FAN 0x00000004 64 - struct sensor_device { 65 - char name[32]; /* a formal name */ 66 - char label[64]; /* a flexible description */ 67 - u32 type; /* SENSOR_* */ 68 - u32 id; /* instance id of a sensor-class */ 69 - u32 fan_policy; /* see loongson_hwmon.h */ 70 - u32 fan_percent;/* only for constant speed policy */ 71 - u64 base_addr; /* base address of device registers */ 72 - } __packed; 73 - 74 - struct system_loongson { 75 - u16 vers; /* version of system_loongson */ 76 - u32 ccnuma_smp; /* 0: no numa; 1: has numa */ 77 - u32 sing_double_channel; /* 1:single; 2:double */ 78 - u32 nr_uarts; 79 - struct uart_device uarts[MAX_UARTS]; 80 - u32 nr_sensors; 81 - struct sensor_device sensors[MAX_SENSORS]; 82 - char has_ec; 83 - char ec_name[32]; 84 - u64 ec_base_addr; 85 - char has_tcm; 86 - char tcm_name[32]; 87 - u64 tcm_base_addr; 88 - u64 workarounds; /* see workarounds.h */ 89 - } __packed; 90 - 91 - struct irq_source_routing_table { 92 - u16 vers; 93 - u16 size; 94 - u16 rtr_bus; 95 - u16 rtr_devfn; 96 - u32 vendor; 97 - u32 device; 98 - u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */ 99 - u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */ 100 - u64 ht_enable; /* irqs used in this PIC */ 101 - u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */ 102 - u64 pci_mem_start_addr; 103 - u64 pci_mem_end_addr; 104 - u64 pci_io_start_addr; 105 - u64 pci_io_end_addr; 106 - u64 pci_config_addr; 107 - u32 dma_mask_bits; 108 - } __packed; 109 - 110 - struct interface_info { 111 - u16 vers; /* version of the specificition */ 112 - u16 size; 113 - u8 flag; 114 - char description[64]; 115 - } __packed; 116 - 117 - #define MAX_RESOURCE_NUMBER 128 118 - struct resource_loongson { 119 - u64 start; /* resource start address */ 120 - u64 end; /* resource end address */ 121 - char name[64]; 122 - u32 flags; 123 - }; 124 - 125 - struct archdev_data {}; /* arch specific additions */ 126 - 127 - struct board_devices { 128 - char name[64]; /* hold the device name */ 129 - u32 num_resources; /* number of device_resource */ 130 - /* for each device's resource */ 131 - struct resource_loongson resource[MAX_RESOURCE_NUMBER]; 132 - /* arch specific additions */ 133 - struct archdev_data archdata; 134 - }; 135 - 136 - struct loongson_special_attribute { 137 - u16 vers; /* version of this special */ 138 - char special_name[64]; /* special_atribute_name */ 139 - u32 loongson_special_type; /* type of special device */ 140 - /* for each device's resource */ 141 - struct resource_loongson resource[MAX_RESOURCE_NUMBER]; 142 - }; 143 - 144 - struct loongson_params { 145 - u64 memory_offset; /* efi_memory_map_loongson struct offset */ 146 - u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */ 147 - u64 system_offset; /* system_loongson struct offset */ 148 - u64 irq_offset; /* irq_source_routing_table struct offset */ 149 - u64 interface_offset; /* interface_info struct offset */ 150 - u64 special_offset; /* loongson_special_attribute struct offset */ 151 - u64 boarddev_table_offset; /* board_devices offset */ 152 - }; 153 - 154 - struct smbios_tables { 155 - u16 vers; /* version of smbios */ 156 - u64 vga_bios; /* vga_bios address */ 157 - struct loongson_params lp; 158 - }; 159 - 160 - struct efi_reset_system_t { 161 - u64 ResetCold; 162 - u64 ResetWarm; 163 - u64 ResetType; 164 - u64 Shutdown; 165 - u64 DoSuspend; /* NULL if not support */ 166 - }; 167 - 168 - struct efi_loongson { 169 - u64 mps; /* MPS table */ 170 - u64 acpi; /* ACPI table (IA64 ext 0.71) */ 171 - u64 acpi20; /* ACPI table (ACPI 2.0) */ 172 - struct smbios_tables smbios; /* SM BIOS table */ 173 - u64 sal_systab; /* SAL system table */ 174 - u64 boot_info; /* boot info table */ 175 - }; 176 - 177 - struct boot_params { 178 - struct efi_loongson efi; 179 - struct efi_reset_system_t reset_system; 180 - }; 181 - 182 - struct loongson_system_configuration { 183 - u32 nr_cpus; 184 - u32 nr_nodes; 185 - int cores_per_node; 186 - int cores_per_package; 187 - u16 boot_cpu_id; 188 - u16 reserved_cpus_mask; 189 - enum loongson_cpu_type cputype; 190 - u64 ht_control_base; 191 - u64 pci_mem_start_addr; 192 - u64 pci_mem_end_addr; 193 - u64 pci_io_base; 194 - u64 restart_addr; 195 - u64 poweroff_addr; 196 - u64 suspend_addr; 197 - u64 vgabios_addr; 198 - u32 dma_mask_bits; 199 - char ecname[32]; 200 - u32 nr_uarts; 201 - struct uart_device uarts[MAX_UARTS]; 202 - u32 nr_sensors; 203 - struct sensor_device sensors[MAX_SENSORS]; 204 - u64 workarounds; 205 - }; 206 - 207 - extern struct efi_memory_map_loongson *loongson_memmap; 208 - extern struct loongson_system_configuration loongson_sysconf; 209 - 210 - #endif
-61
arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
··· 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) 2009 Wu Zhangjin <wuzhangjin@gmail.com> 7 - * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca> 8 - * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org> 9 - * 10 - * reference: /proc/cpuinfo, 11 - * arch/mips/kernel/cpu-probe.c(cpu_probe_legacy), 12 - * arch/mips/kernel/proc.c(show_cpuinfo), 13 - * loongson2f user manual. 14 - */ 15 - 16 - #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H 17 - #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H 18 - 19 - #define cpu_dcache_line_size() 32 20 - #define cpu_icache_line_size() 32 21 - #define cpu_scache_line_size() 32 22 - 23 - 24 - #define cpu_has_32fpr 1 25 - #define cpu_has_3k_cache 0 26 - #define cpu_has_4k_cache 1 27 - #define cpu_has_4kex 1 28 - #define cpu_has_64bits 1 29 - #define cpu_has_cache_cdex_p 0 30 - #define cpu_has_cache_cdex_s 0 31 - #define cpu_has_counter 1 32 - #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) 33 - #define cpu_has_divec 0 34 - #define cpu_has_dsp 0 35 - #define cpu_has_dsp2 0 36 - #define cpu_has_ejtag 0 37 - #define cpu_has_ic_fills_f_dc 0 38 - #define cpu_has_inclusive_pcaches 1 39 - #define cpu_has_llsc 1 40 - #define cpu_has_mcheck 0 41 - #define cpu_has_mdmx 0 42 - #define cpu_has_mips16 0 43 - #define cpu_has_mips32r2 0 44 - #define cpu_has_mips3d 0 45 - #define cpu_has_mips64r2 0 46 - #define cpu_has_mipsmt 0 47 - #define cpu_has_prefetch 0 48 - #define cpu_has_smartmips 0 49 - #define cpu_has_tlb 1 50 - #define cpu_has_tx39_cache 0 51 - #define cpu_has_userlocal 0 52 - #define cpu_has_vce 0 53 - #define cpu_has_veic 0 54 - #define cpu_has_vint 0 55 - #define cpu_has_vtag_icache 0 56 - #define cpu_has_watch 1 57 - #define cpu_has_local_ebase 0 58 - 59 - #define cpu_has_wsbh IS_ENABLED(CONFIG_CPU_LOONGSON3) 60 - 61 - #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
arch/mips/include/asm/mach-loongson/cs5536/cs5536.h arch/mips/include/asm/mach-loongson64/cs5536/cs5536.h
arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h arch/mips/include/asm/mach-loongson64/cs5536/cs5536_mfgpt.h
arch/mips/include/asm/mach-loongson/cs5536/cs5536_pci.h arch/mips/include/asm/mach-loongson64/cs5536/cs5536_pci.h
arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h arch/mips/include/asm/mach-loongson64/cs5536/cs5536_vsm.h
-85
arch/mips/include/asm/mach-loongson/dma-coherence.h
··· 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) 2006, 07 Ralf Baechle <ralf@linux-mips.org> 7 - * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology 8 - * Author: Fuxin Zhang, zhangfx@lemote.com 9 - * 10 - */ 11 - #ifndef __ASM_MACH_LOONGSON_DMA_COHERENCE_H 12 - #define __ASM_MACH_LOONGSON_DMA_COHERENCE_H 13 - 14 - #ifdef CONFIG_SWIOTLB 15 - #include <linux/swiotlb.h> 16 - #endif 17 - 18 - struct device; 19 - 20 - extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 21 - extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr); 22 - static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, 23 - size_t size) 24 - { 25 - #ifdef CONFIG_CPU_LOONGSON3 26 - return phys_to_dma(dev, virt_to_phys(addr)); 27 - #else 28 - return virt_to_phys(addr) | 0x80000000; 29 - #endif 30 - } 31 - 32 - static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, 33 - struct page *page) 34 - { 35 - #ifdef CONFIG_CPU_LOONGSON3 36 - return phys_to_dma(dev, page_to_phys(page)); 37 - #else 38 - return page_to_phys(page) | 0x80000000; 39 - #endif 40 - } 41 - 42 - static inline unsigned long plat_dma_addr_to_phys(struct device *dev, 43 - dma_addr_t dma_addr) 44 - { 45 - #if defined(CONFIG_CPU_LOONGSON3) && defined(CONFIG_64BIT) 46 - return dma_to_phys(dev, dma_addr); 47 - #elif defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) 48 - return (dma_addr > 0x8fffffff) ? dma_addr : (dma_addr & 0x0fffffff); 49 - #else 50 - return dma_addr & 0x7fffffff; 51 - #endif 52 - } 53 - 54 - static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 55 - size_t size, enum dma_data_direction direction) 56 - { 57 - } 58 - 59 - static inline int plat_dma_supported(struct device *dev, u64 mask) 60 - { 61 - /* 62 - * we fall back to GFP_DMA when the mask isn't all 1s, 63 - * so we can't guarantee allocations that must be 64 - * within a tighter range than GFP_DMA.. 65 - */ 66 - if (mask < DMA_BIT_MASK(24)) 67 - return 0; 68 - 69 - return 1; 70 - } 71 - 72 - static inline int plat_device_is_coherent(struct device *dev) 73 - { 74 - #ifdef CONFIG_DMA_NONCOHERENT 75 - return 0; 76 - #else 77 - return 1; 78 - #endif /* CONFIG_DMA_NONCOHERENT */ 79 - } 80 - 81 - static inline void plat_post_dma_flush(struct device *dev) 82 - { 83 - } 84 - 85 - #endif /* __ASM_MACH_LOONGSON_DMA_COHERENCE_H */
arch/mips/include/asm/mach-loongson/gpio.h arch/mips/include/asm/mach-loongson64/gpio.h
-43
arch/mips/include/asm/mach-loongson/irq.h
··· 1 - #ifndef __ASM_MACH_LOONGSON_IRQ_H_ 2 - #define __ASM_MACH_LOONGSON_IRQ_H_ 3 - 4 - #include <boot_param.h> 5 - 6 - #ifdef CONFIG_CPU_LOONGSON3 7 - 8 - /* cpu core interrupt numbers */ 9 - #define MIPS_CPU_IRQ_BASE 56 10 - 11 - #define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */ 12 - #define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3) /* HT1 */ 13 - #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */ 14 - 15 - #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base 16 - #define LOONGSON_HT1_INT_VECTOR_BASE (LOONGSON_HT1_CFG_BASE + 0x80) 17 - #define LOONGSON_HT1_INT_EN_BASE (LOONGSON_HT1_CFG_BASE + 0xa0) 18 - #define LOONGSON_HT1_INT_VECTOR(n) \ 19 - LOONGSON3_REG32(LOONGSON_HT1_INT_VECTOR_BASE, 4 * (n)) 20 - #define LOONGSON_HT1_INTN_EN(n) \ 21 - LOONGSON3_REG32(LOONGSON_HT1_INT_EN_BASE, 4 * (n)) 22 - 23 - #define LOONGSON_INT_ROUTER_OFFSET 0x1400 24 - #define LOONGSON_INT_ROUTER_INTEN \ 25 - LOONGSON3_REG32(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + 0x24) 26 - #define LOONGSON_INT_ROUTER_INTENSET \ 27 - LOONGSON3_REG32(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + 0x28) 28 - #define LOONGSON_INT_ROUTER_INTENCLR \ 29 - LOONGSON3_REG32(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + 0x2c) 30 - #define LOONGSON_INT_ROUTER_ENTRY(n) \ 31 - LOONGSON3_REG8(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + n) 32 - #define LOONGSON_INT_ROUTER_LPC LOONGSON_INT_ROUTER_ENTRY(0x0a) 33 - #define LOONGSON_INT_ROUTER_HT1(n) LOONGSON_INT_ROUTER_ENTRY(n + 0x18) 34 - 35 - #define LOONGSON_INT_COREx_INTy(x, y) (1<<(x) | 1<<(y+4)) /* route to int y of core x */ 36 - 37 - #endif 38 - 39 - extern void fixup_irqs(void); 40 - extern void loongson3_ipi_interrupt(struct pt_regs *regs); 41 - 42 - #include_next <irq.h> 43 - #endif /* __ASM_MACH_LOONGSON_IRQ_H_ */
-52
arch/mips/include/asm/mach-loongson/kernel-entry-init.h
··· 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) 2005 Embedded Alley Solutions, Inc 7 - * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 8 - * Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn) 9 - * Copyright (C) 2012 Huacai Chen (chenhc@lemote.com) 10 - */ 11 - #ifndef __ASM_MACH_LOONGSON_KERNEL_ENTRY_H 12 - #define __ASM_MACH_LOONGSON_KERNEL_ENTRY_H 13 - 14 - /* 15 - * Override macros used in arch/mips/kernel/head.S. 16 - */ 17 - .macro kernel_entry_setup 18 - #ifdef CONFIG_CPU_LOONGSON3 19 - .set push 20 - .set mips64 21 - /* Set LPA on LOONGSON3 config3 */ 22 - mfc0 t0, $16, 3 23 - or t0, (0x1 << 7) 24 - mtc0 t0, $16, 3 25 - /* Set ELPA on LOONGSON3 pagegrain */ 26 - li t0, (0x1 << 29) 27 - mtc0 t0, $5, 1 28 - _ehb 29 - .set pop 30 - #endif 31 - .endm 32 - 33 - /* 34 - * Do SMP slave processor setup. 35 - */ 36 - .macro smp_slave_setup 37 - #ifdef CONFIG_CPU_LOONGSON3 38 - .set push 39 - .set mips64 40 - /* Set LPA on LOONGSON3 config3 */ 41 - mfc0 t0, $16, 3 42 - or t0, (0x1 << 7) 43 - mtc0 t0, $16, 3 44 - /* Set ELPA on LOONGSON3 pagegrain */ 45 - li t0, (0x1 << 29) 46 - mtc0 t0, $5, 1 47 - _ehb 48 - .set pop 49 - #endif 50 - .endm 51 - 52 - #endif /* __ASM_MACH_LOONGSON_KERNEL_ENTRY_H */
-360
arch/mips/include/asm/mach-loongson/loongson.h
··· 1 - /* 2 - * Copyright (C) 2009 Lemote, Inc. 3 - * Author: Wu Zhangjin <wuzhangjin@gmail.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 __ASM_MACH_LOONGSON_LOONGSON_H 12 - #define __ASM_MACH_LOONGSON_LOONGSON_H 13 - 14 - #include <linux/io.h> 15 - #include <linux/init.h> 16 - #include <linux/irq.h> 17 - #include <linux/kconfig.h> 18 - #include <boot_param.h> 19 - 20 - /* loongson internal northbridge initialization */ 21 - extern void bonito_irq_init(void); 22 - 23 - /* machine-specific reboot/halt operation */ 24 - extern void mach_prepare_reboot(void); 25 - extern void mach_prepare_shutdown(void); 26 - 27 - /* environment arguments from bootloader */ 28 - extern u32 cpu_clock_freq; 29 - extern u32 memsize, highmemsize; 30 - extern struct plat_smp_ops loongson3_smp_ops; 31 - 32 - /* loongson-specific command line, env and memory initialization */ 33 - extern void __init prom_init_memory(void); 34 - extern void __init prom_init_cmdline(void); 35 - extern void __init prom_init_machtype(void); 36 - extern void __init prom_init_env(void); 37 - #ifdef CONFIG_LOONGSON_UART_BASE 38 - extern unsigned long _loongson_uart_base[], loongson_uart_base[]; 39 - extern void prom_init_loongson_uart_base(void); 40 - #endif 41 - 42 - static inline void prom_init_uart_base(void) 43 - { 44 - #ifdef CONFIG_LOONGSON_UART_BASE 45 - prom_init_loongson_uart_base(); 46 - #endif 47 - } 48 - 49 - /* irq operation functions */ 50 - extern void bonito_irqdispatch(void); 51 - extern void __init bonito_irq_init(void); 52 - extern void __init mach_init_irq(void); 53 - extern void mach_irq_dispatch(unsigned int pending); 54 - extern int mach_i8259_irq(void); 55 - 56 - /* We need this in some places... */ 57 - #define delay() ({ \ 58 - int x; \ 59 - for (x = 0; x < 100000; x++) \ 60 - __asm__ __volatile__(""); \ 61 - }) 62 - 63 - #define LOONGSON_REG(x) \ 64 - (*(volatile u32 *)((char *)CKSEG1ADDR(LOONGSON_REG_BASE) + (x))) 65 - 66 - #define LOONGSON3_REG8(base, x) \ 67 - (*(volatile u8 *)((char *)TO_UNCAC(base) + (x))) 68 - 69 - #define LOONGSON3_REG32(base, x) \ 70 - (*(volatile u32 *)((char *)TO_UNCAC(base) + (x))) 71 - 72 - #define LOONGSON_IRQ_BASE 32 73 - #define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */ 74 - 75 - #include <linux/interrupt.h> 76 - static inline void do_perfcnt_IRQ(void) 77 - { 78 - #if IS_ENABLED(CONFIG_OPROFILE) 79 - do_IRQ(LOONGSON2_PERFCNT_IRQ); 80 - #endif 81 - } 82 - 83 - #define LOONGSON_FLASH_BASE 0x1c000000 84 - #define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */ 85 - #define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1) 86 - 87 - #define LOONGSON_LIO0_BASE 0x1e000000 88 - #define LOONGSON_LIO0_SIZE 0x01C00000 /* 28M */ 89 - #define LOONGSON_LIO0_TOP (LOONGSON_LIO0_BASE+LOONGSON_LIO0_SIZE-1) 90 - 91 - #define LOONGSON_BOOT_BASE 0x1fc00000 92 - #define LOONGSON_BOOT_SIZE 0x00100000 /* 1M */ 93 - #define LOONGSON_BOOT_TOP (LOONGSON_BOOT_BASE+LOONGSON_BOOT_SIZE-1) 94 - #define LOONGSON_REG_BASE 0x1fe00000 95 - #define LOONGSON_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */ 96 - #define LOONGSON_REG_TOP (LOONGSON_REG_BASE+LOONGSON_REG_SIZE-1) 97 - /* Loongson-3 specific registers */ 98 - #define LOONGSON3_REG_BASE 0x3ff00000 99 - #define LOONGSON3_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */ 100 - #define LOONGSON3_REG_TOP (LOONGSON3_REG_BASE+LOONGSON3_REG_SIZE-1) 101 - 102 - #define LOONGSON_LIO1_BASE 0x1ff00000 103 - #define LOONGSON_LIO1_SIZE 0x00100000 /* 1M */ 104 - #define LOONGSON_LIO1_TOP (LOONGSON_LIO1_BASE+LOONGSON_LIO1_SIZE-1) 105 - 106 - #define LOONGSON_PCILO0_BASE 0x10000000 107 - #define LOONGSON_PCILO1_BASE 0x14000000 108 - #define LOONGSON_PCILO2_BASE 0x18000000 109 - #define LOONGSON_PCILO_BASE LOONGSON_PCILO0_BASE 110 - #define LOONGSON_PCILO_SIZE 0x0c000000 /* 64M * 3 */ 111 - #define LOONGSON_PCILO_TOP (LOONGSON_PCILO0_BASE+LOONGSON_PCILO_SIZE-1) 112 - 113 - #define LOONGSON_PCICFG_BASE 0x1fe80000 114 - #define LOONGSON_PCICFG_SIZE 0x00000800 /* 2K */ 115 - #define LOONGSON_PCICFG_TOP (LOONGSON_PCICFG_BASE+LOONGSON_PCICFG_SIZE-1) 116 - 117 - #if defined(CONFIG_HT_PCI) 118 - #define LOONGSON_PCIIO_BASE loongson_sysconf.pci_io_base 119 - #else 120 - #define LOONGSON_PCIIO_BASE 0x1fd00000 121 - #endif 122 - 123 - #define LOONGSON_PCIIO_SIZE 0x00100000 /* 1M */ 124 - #define LOONGSON_PCIIO_TOP (LOONGSON_PCIIO_BASE+LOONGSON_PCIIO_SIZE-1) 125 - 126 - /* Loongson Register Bases */ 127 - 128 - #define LOONGSON_PCICONFIGBASE 0x00 129 - #define LOONGSON_REGBASE 0x100 130 - 131 - /* PCI Configuration Registers */ 132 - 133 - #define LOONGSON_PCI_REG(x) LOONGSON_REG(LOONGSON_PCICONFIGBASE + (x)) 134 - #define LOONGSON_PCIDID LOONGSON_PCI_REG(0x00) 135 - #define LOONGSON_PCICMD LOONGSON_PCI_REG(0x04) 136 - #define LOONGSON_PCICLASS LOONGSON_PCI_REG(0x08) 137 - #define LOONGSON_PCILTIMER LOONGSON_PCI_REG(0x0c) 138 - #define LOONGSON_PCIBASE0 LOONGSON_PCI_REG(0x10) 139 - #define LOONGSON_PCIBASE1 LOONGSON_PCI_REG(0x14) 140 - #define LOONGSON_PCIBASE2 LOONGSON_PCI_REG(0x18) 141 - #define LOONGSON_PCIBASE3 LOONGSON_PCI_REG(0x1c) 142 - #define LOONGSON_PCIBASE4 LOONGSON_PCI_REG(0x20) 143 - #define LOONGSON_PCIEXPRBASE LOONGSON_PCI_REG(0x30) 144 - #define LOONGSON_PCIINT LOONGSON_PCI_REG(0x3c) 145 - 146 - #define LOONGSON_PCI_ISR4C LOONGSON_PCI_REG(0x4c) 147 - 148 - #define LOONGSON_PCICMD_PERR_CLR 0x80000000 149 - #define LOONGSON_PCICMD_SERR_CLR 0x40000000 150 - #define LOONGSON_PCICMD_MABORT_CLR 0x20000000 151 - #define LOONGSON_PCICMD_MTABORT_CLR 0x10000000 152 - #define LOONGSON_PCICMD_TABORT_CLR 0x08000000 153 - #define LOONGSON_PCICMD_MPERR_CLR 0x01000000 154 - #define LOONGSON_PCICMD_PERRRESPEN 0x00000040 155 - #define LOONGSON_PCICMD_ASTEPEN 0x00000080 156 - #define LOONGSON_PCICMD_SERREN 0x00000100 157 - #define LOONGSON_PCILTIMER_BUSLATENCY 0x0000ff00 158 - #define LOONGSON_PCILTIMER_BUSLATENCY_SHIFT 8 159 - 160 - /* Loongson h/w Configuration */ 161 - 162 - #define LOONGSON_GENCFG_OFFSET 0x4 163 - #define LOONGSON_GENCFG LOONGSON_REG(LOONGSON_REGBASE + LOONGSON_GENCFG_OFFSET) 164 - 165 - #define LOONGSON_GENCFG_DEBUGMODE 0x00000001 166 - #define LOONGSON_GENCFG_SNOOPEN 0x00000002 167 - #define LOONGSON_GENCFG_CPUSELFRESET 0x00000004 168 - 169 - #define LOONGSON_GENCFG_FORCE_IRQA 0x00000008 170 - #define LOONGSON_GENCFG_IRQA_ISOUT 0x00000010 171 - #define LOONGSON_GENCFG_IRQA_FROM_INT1 0x00000020 172 - #define LOONGSON_GENCFG_BYTESWAP 0x00000040 173 - 174 - #define LOONGSON_GENCFG_UNCACHED 0x00000080 175 - #define LOONGSON_GENCFG_PREFETCHEN 0x00000100 176 - #define LOONGSON_GENCFG_WBEHINDEN 0x00000200 177 - #define LOONGSON_GENCFG_CACHEALG 0x00000c00 178 - #define LOONGSON_GENCFG_CACHEALG_SHIFT 10 179 - #define LOONGSON_GENCFG_PCIQUEUE 0x00001000 180 - #define LOONGSON_GENCFG_CACHESTOP 0x00002000 181 - #define LOONGSON_GENCFG_MSTRBYTESWAP 0x00004000 182 - #define LOONGSON_GENCFG_BUSERREN 0x00008000 183 - #define LOONGSON_GENCFG_NORETRYTIMEOUT 0x00010000 184 - #define LOONGSON_GENCFG_SHORTCOPYTIMEOUT 0x00020000 185 - 186 - /* PCI address map control */ 187 - 188 - #define LOONGSON_PCIMAP LOONGSON_REG(LOONGSON_REGBASE + 0x10) 189 - #define LOONGSON_PCIMEMBASECFG LOONGSON_REG(LOONGSON_REGBASE + 0x14) 190 - #define LOONGSON_PCIMAP_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x18) 191 - 192 - /* GPIO Regs - r/w */ 193 - 194 - #define LOONGSON_GPIODATA LOONGSON_REG(LOONGSON_REGBASE + 0x1c) 195 - #define LOONGSON_GPIOIE LOONGSON_REG(LOONGSON_REGBASE + 0x20) 196 - 197 - /* ICU Configuration Regs - r/w */ 198 - 199 - #define LOONGSON_INTEDGE LOONGSON_REG(LOONGSON_REGBASE + 0x24) 200 - #define LOONGSON_INTSTEER LOONGSON_REG(LOONGSON_REGBASE + 0x28) 201 - #define LOONGSON_INTPOL LOONGSON_REG(LOONGSON_REGBASE + 0x2c) 202 - 203 - /* ICU Enable Regs - IntEn & IntISR are r/o. */ 204 - 205 - #define LOONGSON_INTENSET LOONGSON_REG(LOONGSON_REGBASE + 0x30) 206 - #define LOONGSON_INTENCLR LOONGSON_REG(LOONGSON_REGBASE + 0x34) 207 - #define LOONGSON_INTEN LOONGSON_REG(LOONGSON_REGBASE + 0x38) 208 - #define LOONGSON_INTISR LOONGSON_REG(LOONGSON_REGBASE + 0x3c) 209 - 210 - /* ICU */ 211 - #define LOONGSON_ICU_MBOXES 0x0000000f 212 - #define LOONGSON_ICU_MBOXES_SHIFT 0 213 - #define LOONGSON_ICU_DMARDY 0x00000010 214 - #define LOONGSON_ICU_DMAEMPTY 0x00000020 215 - #define LOONGSON_ICU_COPYRDY 0x00000040 216 - #define LOONGSON_ICU_COPYEMPTY 0x00000080 217 - #define LOONGSON_ICU_COPYERR 0x00000100 218 - #define LOONGSON_ICU_PCIIRQ 0x00000200 219 - #define LOONGSON_ICU_MASTERERR 0x00000400 220 - #define LOONGSON_ICU_SYSTEMERR 0x00000800 221 - #define LOONGSON_ICU_DRAMPERR 0x00001000 222 - #define LOONGSON_ICU_RETRYERR 0x00002000 223 - #define LOONGSON_ICU_GPIOS 0x01ff0000 224 - #define LOONGSON_ICU_GPIOS_SHIFT 16 225 - #define LOONGSON_ICU_GPINS 0x7e000000 226 - #define LOONGSON_ICU_GPINS_SHIFT 25 227 - #define LOONGSON_ICU_MBOX(N) (1<<(LOONGSON_ICU_MBOXES_SHIFT+(N))) 228 - #define LOONGSON_ICU_GPIO(N) (1<<(LOONGSON_ICU_GPIOS_SHIFT+(N))) 229 - #define LOONGSON_ICU_GPIN(N) (1<<(LOONGSON_ICU_GPINS_SHIFT+(N))) 230 - 231 - /* PCI prefetch window base & mask */ 232 - 233 - #define LOONGSON_MEM_WIN_BASE_L LOONGSON_REG(LOONGSON_REGBASE + 0x40) 234 - #define LOONGSON_MEM_WIN_BASE_H LOONGSON_REG(LOONGSON_REGBASE + 0x44) 235 - #define LOONGSON_MEM_WIN_MASK_L LOONGSON_REG(LOONGSON_REGBASE + 0x48) 236 - #define LOONGSON_MEM_WIN_MASK_H LOONGSON_REG(LOONGSON_REGBASE + 0x4c) 237 - 238 - /* PCI_Hit*_Sel_* */ 239 - 240 - #define LOONGSON_PCI_HIT0_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x50) 241 - #define LOONGSON_PCI_HIT0_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x54) 242 - #define LOONGSON_PCI_HIT1_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x58) 243 - #define LOONGSON_PCI_HIT1_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x5c) 244 - #define LOONGSON_PCI_HIT2_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x60) 245 - #define LOONGSON_PCI_HIT2_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x64) 246 - 247 - /* PXArb Config & Status */ 248 - 249 - #define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68) 250 - #define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c) 251 - 252 - #define MAX_PACKAGES 4 253 - 254 - /* Chip Config registor of each physical cpu package, PRid >= Loongson-2F */ 255 - extern u64 loongson_chipcfg[MAX_PACKAGES]; 256 - #define LOONGSON_CHIPCFG(id) (*(volatile u32 *)(loongson_chipcfg[id])) 257 - 258 - /* Chip Temperature registor of each physical cpu package, PRid >= Loongson-3A */ 259 - extern u64 loongson_chiptemp[MAX_PACKAGES]; 260 - #define LOONGSON_CHIPTEMP(id) (*(volatile u32 *)(loongson_chiptemp[id])) 261 - 262 - /* Freq Control register of each physical cpu package, PRid >= Loongson-3B */ 263 - extern u64 loongson_freqctrl[MAX_PACKAGES]; 264 - #define LOONGSON_FREQCTRL(id) (*(volatile u32 *)(loongson_freqctrl[id])) 265 - 266 - /* pcimap */ 267 - 268 - #define LOONGSON_PCIMAP_PCIMAP_LO0 0x0000003f 269 - #define LOONGSON_PCIMAP_PCIMAP_LO0_SHIFT 0 270 - #define LOONGSON_PCIMAP_PCIMAP_LO1 0x00000fc0 271 - #define LOONGSON_PCIMAP_PCIMAP_LO1_SHIFT 6 272 - #define LOONGSON_PCIMAP_PCIMAP_LO2 0x0003f000 273 - #define LOONGSON_PCIMAP_PCIMAP_LO2_SHIFT 12 274 - #define LOONGSON_PCIMAP_PCIMAP_2 0x00040000 275 - #define LOONGSON_PCIMAP_WIN(WIN, ADDR) \ 276 - ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6)) 277 - 278 - #ifdef CONFIG_CPU_SUPPORTS_CPUFREQ 279 - #include <linux/cpufreq.h> 280 - extern struct cpufreq_frequency_table loongson2_clockmod_table[]; 281 - #endif 282 - 283 - /* 284 - * address windows configuration module 285 - * 286 - * loongson2e do not have this module 287 - */ 288 - #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG 289 - 290 - /* address window config module base address */ 291 - #define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul 292 - #define LOONGSON_ADDRWINCFG_SIZE 0x180 293 - 294 - extern unsigned long _loongson_addrwincfg_base; 295 - #define LOONGSON_ADDRWINCFG(offset) \ 296 - (*(volatile u64 *)(_loongson_addrwincfg_base + (offset))) 297 - 298 - #define CPU_WIN0_BASE LOONGSON_ADDRWINCFG(0x00) 299 - #define CPU_WIN1_BASE LOONGSON_ADDRWINCFG(0x08) 300 - #define CPU_WIN2_BASE LOONGSON_ADDRWINCFG(0x10) 301 - #define CPU_WIN3_BASE LOONGSON_ADDRWINCFG(0x18) 302 - 303 - #define CPU_WIN0_MASK LOONGSON_ADDRWINCFG(0x20) 304 - #define CPU_WIN1_MASK LOONGSON_ADDRWINCFG(0x28) 305 - #define CPU_WIN2_MASK LOONGSON_ADDRWINCFG(0x30) 306 - #define CPU_WIN3_MASK LOONGSON_ADDRWINCFG(0x38) 307 - 308 - #define CPU_WIN0_MMAP LOONGSON_ADDRWINCFG(0x40) 309 - #define CPU_WIN1_MMAP LOONGSON_ADDRWINCFG(0x48) 310 - #define CPU_WIN2_MMAP LOONGSON_ADDRWINCFG(0x50) 311 - #define CPU_WIN3_MMAP LOONGSON_ADDRWINCFG(0x58) 312 - 313 - #define PCIDMA_WIN0_BASE LOONGSON_ADDRWINCFG(0x60) 314 - #define PCIDMA_WIN1_BASE LOONGSON_ADDRWINCFG(0x68) 315 - #define PCIDMA_WIN2_BASE LOONGSON_ADDRWINCFG(0x70) 316 - #define PCIDMA_WIN3_BASE LOONGSON_ADDRWINCFG(0x78) 317 - 318 - #define PCIDMA_WIN0_MASK LOONGSON_ADDRWINCFG(0x80) 319 - #define PCIDMA_WIN1_MASK LOONGSON_ADDRWINCFG(0x88) 320 - #define PCIDMA_WIN2_MASK LOONGSON_ADDRWINCFG(0x90) 321 - #define PCIDMA_WIN3_MASK LOONGSON_ADDRWINCFG(0x98) 322 - 323 - #define PCIDMA_WIN0_MMAP LOONGSON_ADDRWINCFG(0xa0) 324 - #define PCIDMA_WIN1_MMAP LOONGSON_ADDRWINCFG(0xa8) 325 - #define PCIDMA_WIN2_MMAP LOONGSON_ADDRWINCFG(0xb0) 326 - #define PCIDMA_WIN3_MMAP LOONGSON_ADDRWINCFG(0xb8) 327 - 328 - #define ADDRWIN_WIN0 0 329 - #define ADDRWIN_WIN1 1 330 - #define ADDRWIN_WIN2 2 331 - #define ADDRWIN_WIN3 3 332 - 333 - #define ADDRWIN_MAP_DST_DDR 0 334 - #define ADDRWIN_MAP_DST_PCI 1 335 - #define ADDRWIN_MAP_DST_LIO 1 336 - 337 - /* 338 - * s: CPU, PCIDMA 339 - * d: DDR, PCI, LIO 340 - * win: 0, 1, 2, 3 341 - * src: map source 342 - * dst: map destination 343 - * size: ~mask + 1 344 - */ 345 - #define LOONGSON_ADDRWIN_CFG(s, d, w, src, dst, size) do {\ 346 - s##_WIN##w##_BASE = (src); \ 347 - s##_WIN##w##_MMAP = (dst) | ADDRWIN_MAP_DST_##d; \ 348 - s##_WIN##w##_MASK = ~(size-1); \ 349 - } while (0) 350 - 351 - #define LOONGSON_ADDRWIN_CPUTOPCI(win, src, dst, size) \ 352 - LOONGSON_ADDRWIN_CFG(CPU, PCI, win, src, dst, size) 353 - #define LOONGSON_ADDRWIN_CPUTODDR(win, src, dst, size) \ 354 - LOONGSON_ADDRWIN_CFG(CPU, DDR, win, src, dst, size) 355 - #define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \ 356 - LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size) 357 - 358 - #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */ 359 - 360 - #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */
arch/mips/include/asm/mach-loongson/loongson_hwmon.h arch/mips/include/asm/mach-loongson64/loongson_hwmon.h
-33
arch/mips/include/asm/mach-loongson/machine.h
··· 1 - /* 2 - * Copyright (C) 2009 Lemote, Inc. 3 - * Author: Wu Zhangjin <wuzhangjin@gmail.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 __ASM_MACH_LOONGSON_MACHINE_H 12 - #define __ASM_MACH_LOONGSON_MACHINE_H 13 - 14 - #ifdef CONFIG_LEMOTE_FULOONG2E 15 - 16 - #define LOONGSON_MACHTYPE MACH_LEMOTE_FL2E 17 - 18 - #endif 19 - 20 - /* use fuloong2f as the default machine of LEMOTE_MACH2F */ 21 - #ifdef CONFIG_LEMOTE_MACH2F 22 - 23 - #define LOONGSON_MACHTYPE MACH_LEMOTE_FL2F 24 - 25 - #endif 26 - 27 - #ifdef CONFIG_LOONGSON_MACH3X 28 - 29 - #define LOONGSON_MACHTYPE MACH_LOONGSON_GENERIC 30 - 31 - #endif /* CONFIG_LOONGSON_MACH3X */ 32 - 33 - #endif /* __ASM_MACH_LOONGSON_MACHINE_H */
-36
arch/mips/include/asm/mach-loongson/mc146818rtc.h
··· 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) 1998, 2001, 03, 07 by Ralf Baechle (ralf@linux-mips.org) 7 - * 8 - * RTC routines for PC style attached Dallas chip. 9 - */ 10 - #ifndef __ASM_MACH_LOONGSON_MC146818RTC_H 11 - #define __ASM_MACH_LOONGSON_MC146818RTC_H 12 - 13 - #include <linux/io.h> 14 - 15 - #define RTC_PORT(x) (0x70 + (x)) 16 - #define RTC_IRQ 8 17 - 18 - static inline unsigned char CMOS_READ(unsigned long addr) 19 - { 20 - outb_p(addr, RTC_PORT(0)); 21 - return inb_p(RTC_PORT(1)); 22 - } 23 - 24 - static inline void CMOS_WRITE(unsigned char data, unsigned long addr) 25 - { 26 - outb_p(addr, RTC_PORT(0)); 27 - outb_p(data, RTC_PORT(1)); 28 - } 29 - 30 - #define RTC_ALWAYS_BCD 0 31 - 32 - #ifndef mc146818_decode_year 33 - #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) 34 - #endif 35 - 36 - #endif /* __ASM_MACH_LOONGSON_MC146818RTC_H */
-41
arch/mips/include/asm/mach-loongson/mem.h
··· 1 - /* 2 - * Copyright (C) 2009 Lemote, Inc. 3 - * Author: Wu Zhangjin <wuzhangjin@gmail.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 __ASM_MACH_LOONGSON_MEM_H 12 - #define __ASM_MACH_LOONGSON_MEM_H 13 - 14 - /* 15 - * high memory space 16 - * 17 - * in loongson2e, starts from 512M 18 - * in loongson2f, starts from 2G 256M 19 - */ 20 - #ifdef CONFIG_CPU_LOONGSON2E 21 - #define LOONGSON_HIGHMEM_START 0x20000000 22 - #else 23 - #define LOONGSON_HIGHMEM_START 0x90000000 24 - #endif 25 - 26 - /* 27 - * the peripheral registers(MMIO): 28 - * 29 - * On the Lemote Loongson 2e system, reside between 0x1000:0000 and 0x2000:0000. 30 - * On the Lemote Loongson 2f system, reside between 0x1000:0000 and 0x8000:0000. 31 - */ 32 - 33 - #define LOONGSON_MMIO_MEM_START 0x10000000 34 - 35 - #ifdef CONFIG_CPU_LOONGSON2E 36 - #define LOONGSON_MMIO_MEM_END 0x20000000 37 - #else 38 - #define LOONGSON_MMIO_MEM_END 0x80000000 39 - #endif 40 - 41 - #endif /* __ASM_MACH_LOONGSON_MEM_H */
arch/mips/include/asm/mach-loongson/mmzone.h arch/mips/include/asm/mach-loongson64/mmzone.h
-55
arch/mips/include/asm/mach-loongson/pci.h
··· 1 - /* 2 - * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org> 3 - * Copyright (c) 2009 Wu Zhangjin <wuzhangjin@gmail.com> 4 - * 5 - * This program is free software; you can redistribute it 6 - * and/or modify it under the terms of the GNU General 7 - * Public License as published by the Free Software 8 - * Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - #ifndef __ASM_MACH_LOONGSON_PCI_H_ 13 - #define __ASM_MACH_LOONGSON_PCI_H_ 14 - 15 - extern struct pci_ops loongson_pci_ops; 16 - 17 - /* this is an offset from mips_io_port_base */ 18 - #define LOONGSON_PCI_IO_START 0x00004000UL 19 - 20 - #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG 21 - 22 - /* 23 - * we use address window2 to map cpu address space to pci space 24 - * window2: cpu [1G, 2G] -> pci [1G, 2G] 25 - * why not use window 0 & 1? because they are used by cpu when booting. 26 - * window0: cpu [0, 256M] -> ddr [0, 256M] 27 - * window1: cpu [256M, 512M] -> pci [256M, 512M] 28 - */ 29 - 30 - /* the smallest LOONGSON_CPU_MEM_SRC can be 512M */ 31 - #define LOONGSON_CPU_MEM_SRC 0x40000000ul /* 1G */ 32 - #define LOONGSON_PCI_MEM_DST LOONGSON_CPU_MEM_SRC 33 - 34 - #define LOONGSON_PCI_MEM_START LOONGSON_PCI_MEM_DST 35 - #define LOONGSON_PCI_MEM_END (0x80000000ul-1) /* 2G */ 36 - 37 - #define MMAP_CPUTOPCI_SIZE (LOONGSON_PCI_MEM_END - \ 38 - LOONGSON_PCI_MEM_START + 1) 39 - 40 - #else /* loongson2f/32bit & loongson2e */ 41 - 42 - /* this pci memory space is mapped by pcimap in pci.c */ 43 - #ifdef CONFIG_CPU_LOONGSON3 44 - #define LOONGSON_PCI_MEM_START 0x40000000UL 45 - #define LOONGSON_PCI_MEM_END 0x7effffffUL 46 - #else 47 - #define LOONGSON_PCI_MEM_START LOONGSON_PCILO1_BASE 48 - #define LOONGSON_PCI_MEM_END (LOONGSON_PCILO1_BASE + 0x04000000 * 2) 49 - #endif 50 - /* this is an offset from mips_io_port_base */ 51 - #define LOONGSON_PCI_IO_START 0x00004000UL 52 - 53 - #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */ 54 - 55 - #endif /* !__ASM_MACH_LOONGSON_PCI_H_ */
-9
arch/mips/include/asm/mach-loongson/spaces.h
··· 1 - #ifndef __ASM_MACH_LOONGSON_SPACES_H_ 2 - #define __ASM_MACH_LOONGSON_SPACES_H_ 3 - 4 - #if defined(CONFIG_64BIT) 5 - #define CAC_BASE _AC(0x9800000000000000, UL) 6 - #endif /* CONFIG_64BIT */ 7 - 8 - #include <asm/mach-generic/spaces.h> 9 - #endif
arch/mips/include/asm/mach-loongson/topology.h arch/mips/include/asm/mach-loongson64/topology.h
-7
arch/mips/include/asm/mach-loongson/workarounds.h
··· 1 - #ifndef __ASM_MACH_LOONGSON_WORKAROUNDS_H_ 2 - #define __ASM_MACH_LOONGSON_WORKAROUNDS_H_ 3 - 4 - #define WORKAROUND_CPUFREQ 0x00000001 5 - #define WORKAROUND_CPUHOTPLUG 0x00000002 6 - 7 - #endif
-23
arch/mips/include/asm/mach-loongson1/cpufreq.h
··· 1 - /* 2 - * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com> 3 - * 4 - * Loongson 1 CPUFreq platform support. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - 13 - #ifndef __ASM_MACH_LOONGSON1_CPUFREQ_H 14 - #define __ASM_MACH_LOONGSON1_CPUFREQ_H 15 - 16 - struct plat_ls1x_cpufreq { 17 - const char *clk_name; /* CPU clk */ 18 - const char *osc_clk_name; /* OSC clk */ 19 - unsigned int max_freq; /* in kHz */ 20 - unsigned int min_freq; /* in kHz */ 21 - }; 22 - 23 - #endif /* __ASM_MACH_LOONGSON1_CPUFREQ_H */
-73
arch/mips/include/asm/mach-loongson1/irq.h
··· 1 - /* 2 - * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 - * 4 - * IRQ mappings for Loongson 1 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - 13 - #ifndef __ASM_MACH_LOONGSON1_IRQ_H 14 - #define __ASM_MACH_LOONGSON1_IRQ_H 15 - 16 - /* 17 - * CPU core Interrupt Numbers 18 - */ 19 - #define MIPS_CPU_IRQ_BASE 0 20 - #define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) 21 - 22 - #define SOFTINT0_IRQ MIPS_CPU_IRQ(0) 23 - #define SOFTINT1_IRQ MIPS_CPU_IRQ(1) 24 - #define INT0_IRQ MIPS_CPU_IRQ(2) 25 - #define INT1_IRQ MIPS_CPU_IRQ(3) 26 - #define INT2_IRQ MIPS_CPU_IRQ(4) 27 - #define INT3_IRQ MIPS_CPU_IRQ(5) 28 - #define INT4_IRQ MIPS_CPU_IRQ(6) 29 - #define TIMER_IRQ MIPS_CPU_IRQ(7) /* cpu timer */ 30 - 31 - #define MIPS_CPU_IRQS (MIPS_CPU_IRQ(7) + 1 - MIPS_CPU_IRQ_BASE) 32 - 33 - /* 34 - * INT0~3 Interrupt Numbers 35 - */ 36 - #define LS1X_IRQ_BASE MIPS_CPU_IRQS 37 - #define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x)) 38 - 39 - #define LS1X_UART0_IRQ LS1X_IRQ(0, 2) 40 - #define LS1X_UART1_IRQ LS1X_IRQ(0, 3) 41 - #define LS1X_UART2_IRQ LS1X_IRQ(0, 4) 42 - #define LS1X_UART3_IRQ LS1X_IRQ(0, 5) 43 - #define LS1X_CAN0_IRQ LS1X_IRQ(0, 6) 44 - #define LS1X_CAN1_IRQ LS1X_IRQ(0, 7) 45 - #define LS1X_SPI0_IRQ LS1X_IRQ(0, 8) 46 - #define LS1X_SPI1_IRQ LS1X_IRQ(0, 9) 47 - #define LS1X_AC97_IRQ LS1X_IRQ(0, 10) 48 - #define LS1X_DMA0_IRQ LS1X_IRQ(0, 13) 49 - #define LS1X_DMA1_IRQ LS1X_IRQ(0, 14) 50 - #define LS1X_DMA2_IRQ LS1X_IRQ(0, 15) 51 - #define LS1X_PWM0_IRQ LS1X_IRQ(0, 17) 52 - #define LS1X_PWM1_IRQ LS1X_IRQ(0, 18) 53 - #define LS1X_PWM2_IRQ LS1X_IRQ(0, 19) 54 - #define LS1X_PWM3_IRQ LS1X_IRQ(0, 20) 55 - #define LS1X_RTC_INT0_IRQ LS1X_IRQ(0, 21) 56 - #define LS1X_RTC_INT1_IRQ LS1X_IRQ(0, 22) 57 - #define LS1X_RTC_INT2_IRQ LS1X_IRQ(0, 23) 58 - #define LS1X_TOY_INT0_IRQ LS1X_IRQ(0, 24) 59 - #define LS1X_TOY_INT1_IRQ LS1X_IRQ(0, 25) 60 - #define LS1X_TOY_INT2_IRQ LS1X_IRQ(0, 26) 61 - #define LS1X_RTC_TICK_IRQ LS1X_IRQ(0, 27) 62 - #define LS1X_TOY_TICK_IRQ LS1X_IRQ(0, 28) 63 - 64 - #define LS1X_EHCI_IRQ LS1X_IRQ(1, 0) 65 - #define LS1X_OHCI_IRQ LS1X_IRQ(1, 1) 66 - #define LS1X_GMAC0_IRQ LS1X_IRQ(1, 2) 67 - #define LS1X_GMAC1_IRQ LS1X_IRQ(1, 3) 68 - 69 - #define LS1X_IRQS (LS1X_IRQ(4, 31) + 1 - LS1X_IRQ_BASE) 70 - 71 - #define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS) 72 - 73 - #endif /* __ASM_MACH_LOONGSON1_IRQ_H */
-50
arch/mips/include/asm/mach-loongson1/loongson1.h
··· 1 - /* 2 - * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 - * 4 - * Register mappings for Loongson 1 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - 13 - #ifndef __ASM_MACH_LOONGSON1_LOONGSON1_H 14 - #define __ASM_MACH_LOONGSON1_LOONGSON1_H 15 - 16 - #define DEFAULT_MEMSIZE 256 /* If no memsize provided */ 17 - 18 - /* Loongson 1 Register Bases */ 19 - #define LS1X_MUX_BASE 0x1fd00420 20 - #define LS1X_INTC_BASE 0x1fd01040 21 - #define LS1X_EHCI_BASE 0x1fe00000 22 - #define LS1X_OHCI_BASE 0x1fe08000 23 - #define LS1X_GMAC0_BASE 0x1fe10000 24 - #define LS1X_GMAC1_BASE 0x1fe20000 25 - 26 - #define LS1X_UART0_BASE 0x1fe40000 27 - #define LS1X_UART1_BASE 0x1fe44000 28 - #define LS1X_UART2_BASE 0x1fe48000 29 - #define LS1X_UART3_BASE 0x1fe4c000 30 - #define LS1X_CAN0_BASE 0x1fe50000 31 - #define LS1X_CAN1_BASE 0x1fe54000 32 - #define LS1X_I2C0_BASE 0x1fe58000 33 - #define LS1X_I2C1_BASE 0x1fe68000 34 - #define LS1X_I2C2_BASE 0x1fe70000 35 - #define LS1X_PWM0_BASE 0x1fe5c000 36 - #define LS1X_PWM1_BASE 0x1fe5c010 37 - #define LS1X_PWM2_BASE 0x1fe5c020 38 - #define LS1X_PWM3_BASE 0x1fe5c030 39 - #define LS1X_WDT_BASE 0x1fe5c060 40 - #define LS1X_RTC_BASE 0x1fe64000 41 - #define LS1X_AC97_BASE 0x1fe74000 42 - #define LS1X_NAND_BASE 0x1fe78000 43 - #define LS1X_CLK_BASE 0x1fe78030 44 - 45 - #include <regs-clk.h> 46 - #include <regs-mux.h> 47 - #include <regs-pwm.h> 48 - #include <regs-wdt.h> 49 - 50 - #endif /* __ASM_MACH_LOONGSON1_LOONGSON1_H */
-26
arch/mips/include/asm/mach-loongson1/platform.h
··· 1 - /* 2 - * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@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 - 11 - #ifndef __ASM_MACH_LOONGSON1_PLATFORM_H 12 - #define __ASM_MACH_LOONGSON1_PLATFORM_H 13 - 14 - #include <linux/platform_device.h> 15 - 16 - extern struct platform_device ls1x_uart_pdev; 17 - extern struct platform_device ls1x_cpufreq_pdev; 18 - extern struct platform_device ls1x_eth0_pdev; 19 - extern struct platform_device ls1x_eth1_pdev; 20 - extern struct platform_device ls1x_ehci_pdev; 21 - extern struct platform_device ls1x_rtc_pdev; 22 - 23 - extern void __init ls1x_clk_init(void); 24 - extern void __init ls1x_serial_setup(struct platform_device *pdev); 25 - 26 - #endif /* __ASM_MACH_LOONGSON1_PLATFORM_H */
-24
arch/mips/include/asm/mach-loongson1/prom.h
··· 1 - /* 2 - * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@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 - #ifndef __ASM_MACH_LOONGSON1_PROM_H 11 - #define __ASM_MACH_LOONGSON1_PROM_H 12 - 13 - #include <linux/io.h> 14 - #include <linux/init.h> 15 - #include <linux/irq.h> 16 - 17 - /* environment arguments from bootloader */ 18 - extern unsigned long memsize, highmemsize; 19 - 20 - /* loongson-specific command line, env and memory initialization */ 21 - extern char *prom_getenv(char *name); 22 - extern void __init prom_init_cmdline(void); 23 - 24 - #endif /* __ASM_MACH_LOONGSON1_PROM_H */
-51
arch/mips/include/asm/mach-loongson1/regs-clk.h
··· 1 - /* 2 - * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 - * 4 - * Loongson 1 Clock Register Definitions. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - #ifndef __ASM_MACH_LOONGSON1_REGS_CLK_H 13 - #define __ASM_MACH_LOONGSON1_REGS_CLK_H 14 - 15 - #define LS1X_CLK_REG(x) \ 16 - ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x))) 17 - 18 - #define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0) 19 - #define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4) 20 - 21 - /* Clock PLL Divisor Register Bits */ 22 - #define DIV_DC_EN (0x1 << 31) 23 - #define DIV_DC_RST (0x1 << 30) 24 - #define DIV_CPU_EN (0x1 << 25) 25 - #define DIV_CPU_RST (0x1 << 24) 26 - #define DIV_DDR_EN (0x1 << 19) 27 - #define DIV_DDR_RST (0x1 << 18) 28 - #define RST_DC_EN (0x1 << 5) 29 - #define RST_DC (0x1 << 4) 30 - #define RST_DDR_EN (0x1 << 3) 31 - #define RST_DDR (0x1 << 2) 32 - #define RST_CPU_EN (0x1 << 1) 33 - #define RST_CPU 0x1 34 - 35 - #define DIV_DC_SHIFT 26 36 - #define DIV_CPU_SHIFT 20 37 - #define DIV_DDR_SHIFT 14 38 - 39 - #define DIV_DC_WIDTH 4 40 - #define DIV_CPU_WIDTH 4 41 - #define DIV_DDR_WIDTH 4 42 - 43 - #define BYPASS_DC_SHIFT 12 44 - #define BYPASS_DDR_SHIFT 10 45 - #define BYPASS_CPU_SHIFT 8 46 - 47 - #define BYPASS_DC_WIDTH 1 48 - #define BYPASS_DDR_WIDTH 1 49 - #define BYPASS_CPU_WIDTH 1 50 - 51 - #endif /* __ASM_MACH_LOONGSON1_REGS_CLK_H */
-67
arch/mips/include/asm/mach-loongson1/regs-mux.h
··· 1 - /* 2 - * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com> 3 - * 4 - * Loongson 1 MUX Register Definitions. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - #ifndef __ASM_MACH_LOONGSON1_REGS_MUX_H 13 - #define __ASM_MACH_LOONGSON1_REGS_MUX_H 14 - 15 - #define LS1X_MUX_REG(x) \ 16 - ((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x))) 17 - 18 - #define LS1X_MUX_CTRL0 LS1X_MUX_REG(0x0) 19 - #define LS1X_MUX_CTRL1 LS1X_MUX_REG(0x4) 20 - 21 - /* MUX CTRL0 Register Bits */ 22 - #define UART0_USE_PWM23 (0x1 << 28) 23 - #define UART0_USE_PWM01 (0x1 << 27) 24 - #define UART1_USE_LCD0_5_6_11 (0x1 << 26) 25 - #define I2C2_USE_CAN1 (0x1 << 25) 26 - #define I2C1_USE_CAN0 (0x1 << 24) 27 - #define NAND3_USE_UART5 (0x1 << 23) 28 - #define NAND3_USE_UART4 (0x1 << 22) 29 - #define NAND3_USE_UART1_DAT (0x1 << 21) 30 - #define NAND3_USE_UART1_CTS (0x1 << 20) 31 - #define NAND3_USE_PWM23 (0x1 << 19) 32 - #define NAND3_USE_PWM01 (0x1 << 18) 33 - #define NAND2_USE_UART5 (0x1 << 17) 34 - #define NAND2_USE_UART4 (0x1 << 16) 35 - #define NAND2_USE_UART1_DAT (0x1 << 15) 36 - #define NAND2_USE_UART1_CTS (0x1 << 14) 37 - #define NAND2_USE_PWM23 (0x1 << 13) 38 - #define NAND2_USE_PWM01 (0x1 << 12) 39 - #define NAND1_USE_UART5 (0x1 << 11) 40 - #define NAND1_USE_UART4 (0x1 << 10) 41 - #define NAND1_USE_UART1_DAT (0x1 << 9) 42 - #define NAND1_USE_UART1_CTS (0x1 << 8) 43 - #define NAND1_USE_PWM23 (0x1 << 7) 44 - #define NAND1_USE_PWM01 (0x1 << 6) 45 - #define GMAC1_USE_UART1 (0x1 << 4) 46 - #define GMAC1_USE_UART0 (0x1 << 3) 47 - #define LCD_USE_UART0_DAT (0x1 << 2) 48 - #define LCD_USE_UART15 (0x1 << 1) 49 - #define LCD_USE_UART0 0x1 50 - 51 - /* MUX CTRL1 Register Bits */ 52 - #define USB_RESET (0x1 << 31) 53 - #define SPI1_CS_USE_PWM01 (0x1 << 24) 54 - #define SPI1_USE_CAN (0x1 << 23) 55 - #define DISABLE_DDR_CONFSPACE (0x1 << 20) 56 - #define DDR32TO16EN (0x1 << 16) 57 - #define GMAC1_SHUT (0x1 << 13) 58 - #define GMAC0_SHUT (0x1 << 12) 59 - #define USB_SHUT (0x1 << 11) 60 - #define UART1_3_USE_CAN1 (0x1 << 5) 61 - #define UART1_2_USE_CAN0 (0x1 << 4) 62 - #define GMAC1_USE_TXCLK (0x1 << 3) 63 - #define GMAC0_USE_TXCLK (0x1 << 2) 64 - #define GMAC1_USE_PWM23 (0x1 << 1) 65 - #define GMAC0_USE_PWM01 0x1 66 - 67 - #endif /* __ASM_MACH_LOONGSON1_REGS_MUX_H */
-29
arch/mips/include/asm/mach-loongson1/regs-pwm.h
··· 1 - /* 2 - * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com> 3 - * 4 - * Loongson 1 PWM Register Definitions. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - #ifndef __ASM_MACH_LOONGSON1_REGS_PWM_H 13 - #define __ASM_MACH_LOONGSON1_REGS_PWM_H 14 - 15 - /* Loongson 1 PWM Timer Register Definitions */ 16 - #define PWM_CNT 0x0 17 - #define PWM_HRC 0x4 18 - #define PWM_LRC 0x8 19 - #define PWM_CTRL 0xc 20 - 21 - /* PWM Control Register Bits */ 22 - #define CNT_RST (0x1 << 7) 23 - #define INT_SR (0x1 << 6) 24 - #define INT_EN (0x1 << 5) 25 - #define PWM_SINGLE (0x1 << 4) 26 - #define PWM_OE (0x1 << 3) 27 - #define CNT_EN 0x1 28 - 29 - #endif /* __ASM_MACH_LOONGSON1_REGS_PWM_H */
-19
arch/mips/include/asm/mach-loongson1/regs-wdt.h
··· 1 - /* 2 - * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 - * 4 - * Loongson 1 Watchdog Register Definitions. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - #ifndef __ASM_MACH_LOONGSON1_REGS_WDT_H 13 - #define __ASM_MACH_LOONGSON1_REGS_WDT_H 14 - 15 - #define WDT_EN 0x0 16 - #define WDT_TIMER 0x4 17 - #define WDT_SET 0x8 18 - 19 - #endif /* __ASM_MACH_LOONGSON1_REGS_WDT_H */
+23
arch/mips/include/asm/mach-loongson32/cpufreq.h
··· 1 + /* 2 + * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com> 3 + * 4 + * Loongson 1 CPUFreq platform support. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + 13 + #ifndef __ASM_MACH_LOONGSON32_CPUFREQ_H 14 + #define __ASM_MACH_LOONGSON32_CPUFREQ_H 15 + 16 + struct plat_ls1x_cpufreq { 17 + const char *clk_name; /* CPU clk */ 18 + const char *osc_clk_name; /* OSC clk */ 19 + unsigned int max_freq; /* in kHz */ 20 + unsigned int min_freq; /* in kHz */ 21 + }; 22 + 23 + #endif /* __ASM_MACH_LOONGSON32_CPUFREQ_H */
+73
arch/mips/include/asm/mach-loongson32/irq.h
··· 1 + /* 2 + * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 + * 4 + * IRQ mappings for Loongson 1 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + 13 + #ifndef __ASM_MACH_LOONGSON32_IRQ_H 14 + #define __ASM_MACH_LOONGSON32_IRQ_H 15 + 16 + /* 17 + * CPU core Interrupt Numbers 18 + */ 19 + #define MIPS_CPU_IRQ_BASE 0 20 + #define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) 21 + 22 + #define SOFTINT0_IRQ MIPS_CPU_IRQ(0) 23 + #define SOFTINT1_IRQ MIPS_CPU_IRQ(1) 24 + #define INT0_IRQ MIPS_CPU_IRQ(2) 25 + #define INT1_IRQ MIPS_CPU_IRQ(3) 26 + #define INT2_IRQ MIPS_CPU_IRQ(4) 27 + #define INT3_IRQ MIPS_CPU_IRQ(5) 28 + #define INT4_IRQ MIPS_CPU_IRQ(6) 29 + #define TIMER_IRQ MIPS_CPU_IRQ(7) /* cpu timer */ 30 + 31 + #define MIPS_CPU_IRQS (MIPS_CPU_IRQ(7) + 1 - MIPS_CPU_IRQ_BASE) 32 + 33 + /* 34 + * INT0~3 Interrupt Numbers 35 + */ 36 + #define LS1X_IRQ_BASE MIPS_CPU_IRQS 37 + #define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x)) 38 + 39 + #define LS1X_UART0_IRQ LS1X_IRQ(0, 2) 40 + #define LS1X_UART1_IRQ LS1X_IRQ(0, 3) 41 + #define LS1X_UART2_IRQ LS1X_IRQ(0, 4) 42 + #define LS1X_UART3_IRQ LS1X_IRQ(0, 5) 43 + #define LS1X_CAN0_IRQ LS1X_IRQ(0, 6) 44 + #define LS1X_CAN1_IRQ LS1X_IRQ(0, 7) 45 + #define LS1X_SPI0_IRQ LS1X_IRQ(0, 8) 46 + #define LS1X_SPI1_IRQ LS1X_IRQ(0, 9) 47 + #define LS1X_AC97_IRQ LS1X_IRQ(0, 10) 48 + #define LS1X_DMA0_IRQ LS1X_IRQ(0, 13) 49 + #define LS1X_DMA1_IRQ LS1X_IRQ(0, 14) 50 + #define LS1X_DMA2_IRQ LS1X_IRQ(0, 15) 51 + #define LS1X_PWM0_IRQ LS1X_IRQ(0, 17) 52 + #define LS1X_PWM1_IRQ LS1X_IRQ(0, 18) 53 + #define LS1X_PWM2_IRQ LS1X_IRQ(0, 19) 54 + #define LS1X_PWM3_IRQ LS1X_IRQ(0, 20) 55 + #define LS1X_RTC_INT0_IRQ LS1X_IRQ(0, 21) 56 + #define LS1X_RTC_INT1_IRQ LS1X_IRQ(0, 22) 57 + #define LS1X_RTC_INT2_IRQ LS1X_IRQ(0, 23) 58 + #define LS1X_TOY_INT0_IRQ LS1X_IRQ(0, 24) 59 + #define LS1X_TOY_INT1_IRQ LS1X_IRQ(0, 25) 60 + #define LS1X_TOY_INT2_IRQ LS1X_IRQ(0, 26) 61 + #define LS1X_RTC_TICK_IRQ LS1X_IRQ(0, 27) 62 + #define LS1X_TOY_TICK_IRQ LS1X_IRQ(0, 28) 63 + 64 + #define LS1X_EHCI_IRQ LS1X_IRQ(1, 0) 65 + #define LS1X_OHCI_IRQ LS1X_IRQ(1, 1) 66 + #define LS1X_GMAC0_IRQ LS1X_IRQ(1, 2) 67 + #define LS1X_GMAC1_IRQ LS1X_IRQ(1, 3) 68 + 69 + #define LS1X_IRQS (LS1X_IRQ(4, 31) + 1 - LS1X_IRQ_BASE) 70 + 71 + #define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS) 72 + 73 + #endif /* __ASM_MACH_LOONGSON32_IRQ_H */
+50
arch/mips/include/asm/mach-loongson32/loongson1.h
··· 1 + /* 2 + * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 + * 4 + * Register mappings for Loongson 1 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + 13 + #ifndef __ASM_MACH_LOONGSON32_LOONGSON1_H 14 + #define __ASM_MACH_LOONGSON32_LOONGSON1_H 15 + 16 + #define DEFAULT_MEMSIZE 256 /* If no memsize provided */ 17 + 18 + /* Loongson 1 Register Bases */ 19 + #define LS1X_MUX_BASE 0x1fd00420 20 + #define LS1X_INTC_BASE 0x1fd01040 21 + #define LS1X_EHCI_BASE 0x1fe00000 22 + #define LS1X_OHCI_BASE 0x1fe08000 23 + #define LS1X_GMAC0_BASE 0x1fe10000 24 + #define LS1X_GMAC1_BASE 0x1fe20000 25 + 26 + #define LS1X_UART0_BASE 0x1fe40000 27 + #define LS1X_UART1_BASE 0x1fe44000 28 + #define LS1X_UART2_BASE 0x1fe48000 29 + #define LS1X_UART3_BASE 0x1fe4c000 30 + #define LS1X_CAN0_BASE 0x1fe50000 31 + #define LS1X_CAN1_BASE 0x1fe54000 32 + #define LS1X_I2C0_BASE 0x1fe58000 33 + #define LS1X_I2C1_BASE 0x1fe68000 34 + #define LS1X_I2C2_BASE 0x1fe70000 35 + #define LS1X_PWM0_BASE 0x1fe5c000 36 + #define LS1X_PWM1_BASE 0x1fe5c010 37 + #define LS1X_PWM2_BASE 0x1fe5c020 38 + #define LS1X_PWM3_BASE 0x1fe5c030 39 + #define LS1X_WDT_BASE 0x1fe5c060 40 + #define LS1X_RTC_BASE 0x1fe64000 41 + #define LS1X_AC97_BASE 0x1fe74000 42 + #define LS1X_NAND_BASE 0x1fe78000 43 + #define LS1X_CLK_BASE 0x1fe78030 44 + 45 + #include <regs-clk.h> 46 + #include <regs-mux.h> 47 + #include <regs-pwm.h> 48 + #include <regs-wdt.h> 49 + 50 + #endif /* __ASM_MACH_LOONGSON32_LOONGSON1_H */
+26
arch/mips/include/asm/mach-loongson32/platform.h
··· 1 + /* 2 + * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@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 + 11 + #ifndef __ASM_MACH_LOONGSON32_PLATFORM_H 12 + #define __ASM_MACH_LOONGSON32_PLATFORM_H 13 + 14 + #include <linux/platform_device.h> 15 + 16 + extern struct platform_device ls1x_uart_pdev; 17 + extern struct platform_device ls1x_cpufreq_pdev; 18 + extern struct platform_device ls1x_eth0_pdev; 19 + extern struct platform_device ls1x_eth1_pdev; 20 + extern struct platform_device ls1x_ehci_pdev; 21 + extern struct platform_device ls1x_rtc_pdev; 22 + 23 + extern void __init ls1x_clk_init(void); 24 + extern void __init ls1x_serial_setup(struct platform_device *pdev); 25 + 26 + #endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */
+24
arch/mips/include/asm/mach-loongson32/prom.h
··· 1 + /* 2 + * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@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 + #ifndef __ASM_MACH_LOONGSON32_PROM_H 11 + #define __ASM_MACH_LOONGSON32_PROM_H 12 + 13 + #include <linux/io.h> 14 + #include <linux/init.h> 15 + #include <linux/irq.h> 16 + 17 + /* environment arguments from bootloader */ 18 + extern unsigned long memsize, highmemsize; 19 + 20 + /* loongson-specific command line, env and memory initialization */ 21 + extern char *prom_getenv(char *name); 22 + extern void __init prom_init_cmdline(void); 23 + 24 + #endif /* __ASM_MACH_LOONGSON32_PROM_H */
+51
arch/mips/include/asm/mach-loongson32/regs-clk.h
··· 1 + /* 2 + * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 + * 4 + * Loongson 1 Clock Register Definitions. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #ifndef __ASM_MACH_LOONGSON32_REGS_CLK_H 13 + #define __ASM_MACH_LOONGSON32_REGS_CLK_H 14 + 15 + #define LS1X_CLK_REG(x) \ 16 + ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x))) 17 + 18 + #define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0) 19 + #define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4) 20 + 21 + /* Clock PLL Divisor Register Bits */ 22 + #define DIV_DC_EN (0x1 << 31) 23 + #define DIV_DC_RST (0x1 << 30) 24 + #define DIV_CPU_EN (0x1 << 25) 25 + #define DIV_CPU_RST (0x1 << 24) 26 + #define DIV_DDR_EN (0x1 << 19) 27 + #define DIV_DDR_RST (0x1 << 18) 28 + #define RST_DC_EN (0x1 << 5) 29 + #define RST_DC (0x1 << 4) 30 + #define RST_DDR_EN (0x1 << 3) 31 + #define RST_DDR (0x1 << 2) 32 + #define RST_CPU_EN (0x1 << 1) 33 + #define RST_CPU 0x1 34 + 35 + #define DIV_DC_SHIFT 26 36 + #define DIV_CPU_SHIFT 20 37 + #define DIV_DDR_SHIFT 14 38 + 39 + #define DIV_DC_WIDTH 4 40 + #define DIV_CPU_WIDTH 4 41 + #define DIV_DDR_WIDTH 4 42 + 43 + #define BYPASS_DC_SHIFT 12 44 + #define BYPASS_DDR_SHIFT 10 45 + #define BYPASS_CPU_SHIFT 8 46 + 47 + #define BYPASS_DC_WIDTH 1 48 + #define BYPASS_DDR_WIDTH 1 49 + #define BYPASS_CPU_WIDTH 1 50 + 51 + #endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */
+67
arch/mips/include/asm/mach-loongson32/regs-mux.h
··· 1 + /* 2 + * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com> 3 + * 4 + * Loongson 1 MUX Register Definitions. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #ifndef __ASM_MACH_LOONGSON32_REGS_MUX_H 13 + #define __ASM_MACH_LOONGSON32_REGS_MUX_H 14 + 15 + #define LS1X_MUX_REG(x) \ 16 + ((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x))) 17 + 18 + #define LS1X_MUX_CTRL0 LS1X_MUX_REG(0x0) 19 + #define LS1X_MUX_CTRL1 LS1X_MUX_REG(0x4) 20 + 21 + /* MUX CTRL0 Register Bits */ 22 + #define UART0_USE_PWM23 (0x1 << 28) 23 + #define UART0_USE_PWM01 (0x1 << 27) 24 + #define UART1_USE_LCD0_5_6_11 (0x1 << 26) 25 + #define I2C2_USE_CAN1 (0x1 << 25) 26 + #define I2C1_USE_CAN0 (0x1 << 24) 27 + #define NAND3_USE_UART5 (0x1 << 23) 28 + #define NAND3_USE_UART4 (0x1 << 22) 29 + #define NAND3_USE_UART1_DAT (0x1 << 21) 30 + #define NAND3_USE_UART1_CTS (0x1 << 20) 31 + #define NAND3_USE_PWM23 (0x1 << 19) 32 + #define NAND3_USE_PWM01 (0x1 << 18) 33 + #define NAND2_USE_UART5 (0x1 << 17) 34 + #define NAND2_USE_UART4 (0x1 << 16) 35 + #define NAND2_USE_UART1_DAT (0x1 << 15) 36 + #define NAND2_USE_UART1_CTS (0x1 << 14) 37 + #define NAND2_USE_PWM23 (0x1 << 13) 38 + #define NAND2_USE_PWM01 (0x1 << 12) 39 + #define NAND1_USE_UART5 (0x1 << 11) 40 + #define NAND1_USE_UART4 (0x1 << 10) 41 + #define NAND1_USE_UART1_DAT (0x1 << 9) 42 + #define NAND1_USE_UART1_CTS (0x1 << 8) 43 + #define NAND1_USE_PWM23 (0x1 << 7) 44 + #define NAND1_USE_PWM01 (0x1 << 6) 45 + #define GMAC1_USE_UART1 (0x1 << 4) 46 + #define GMAC1_USE_UART0 (0x1 << 3) 47 + #define LCD_USE_UART0_DAT (0x1 << 2) 48 + #define LCD_USE_UART15 (0x1 << 1) 49 + #define LCD_USE_UART0 0x1 50 + 51 + /* MUX CTRL1 Register Bits */ 52 + #define USB_RESET (0x1 << 31) 53 + #define SPI1_CS_USE_PWM01 (0x1 << 24) 54 + #define SPI1_USE_CAN (0x1 << 23) 55 + #define DISABLE_DDR_CONFSPACE (0x1 << 20) 56 + #define DDR32TO16EN (0x1 << 16) 57 + #define GMAC1_SHUT (0x1 << 13) 58 + #define GMAC0_SHUT (0x1 << 12) 59 + #define USB_SHUT (0x1 << 11) 60 + #define UART1_3_USE_CAN1 (0x1 << 5) 61 + #define UART1_2_USE_CAN0 (0x1 << 4) 62 + #define GMAC1_USE_TXCLK (0x1 << 3) 63 + #define GMAC0_USE_TXCLK (0x1 << 2) 64 + #define GMAC1_USE_PWM23 (0x1 << 1) 65 + #define GMAC0_USE_PWM01 0x1 66 + 67 + #endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */
+29
arch/mips/include/asm/mach-loongson32/regs-pwm.h
··· 1 + /* 2 + * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com> 3 + * 4 + * Loongson 1 PWM Register Definitions. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #ifndef __ASM_MACH_LOONGSON32_REGS_PWM_H 13 + #define __ASM_MACH_LOONGSON32_REGS_PWM_H 14 + 15 + /* Loongson 1 PWM Timer Register Definitions */ 16 + #define PWM_CNT 0x0 17 + #define PWM_HRC 0x4 18 + #define PWM_LRC 0x8 19 + #define PWM_CTRL 0xc 20 + 21 + /* PWM Control Register Bits */ 22 + #define CNT_RST (0x1 << 7) 23 + #define INT_SR (0x1 << 6) 24 + #define INT_EN (0x1 << 5) 25 + #define PWM_SINGLE (0x1 << 4) 26 + #define PWM_OE (0x1 << 3) 27 + #define CNT_EN 0x1 28 + 29 + #endif /* __ASM_MACH_LOONGSON32_REGS_PWM_H */
+19
arch/mips/include/asm/mach-loongson32/regs-wdt.h
··· 1 + /* 2 + * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 3 + * 4 + * Loongson 1 Watchdog Register Definitions. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #ifndef __ASM_MACH_LOONGSON32_REGS_WDT_H 13 + #define __ASM_MACH_LOONGSON32_REGS_WDT_H 14 + 15 + #define WDT_EN 0x0 16 + #define WDT_TIMER 0x4 17 + #define WDT_SET 0x8 18 + 19 + #endif /* __ASM_MACH_LOONGSON32_REGS_WDT_H */
+210
arch/mips/include/asm/mach-loongson64/boot_param.h
··· 1 + #ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_ 2 + #define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_ 3 + 4 + #define SYSTEM_RAM_LOW 1 5 + #define SYSTEM_RAM_HIGH 2 6 + #define MEM_RESERVED 3 7 + #define PCI_IO 4 8 + #define PCI_MEM 5 9 + #define LOONGSON_CFG_REG 6 10 + #define VIDEO_ROM 7 11 + #define ADAPTER_ROM 8 12 + #define ACPI_TABLE 9 13 + #define SMBIOS_TABLE 10 14 + #define MAX_MEMORY_TYPE 11 15 + 16 + #define LOONGSON3_BOOT_MEM_MAP_MAX 128 17 + struct efi_memory_map_loongson { 18 + u16 vers; /* version of efi_memory_map */ 19 + u32 nr_map; /* number of memory_maps */ 20 + u32 mem_freq; /* memory frequence */ 21 + struct mem_map { 22 + u32 node_id; /* node_id which memory attached to */ 23 + u32 mem_type; /* system memory, pci memory, pci io, etc. */ 24 + u64 mem_start; /* memory map start address */ 25 + u32 mem_size; /* each memory_map size, not the total size */ 26 + } map[LOONGSON3_BOOT_MEM_MAP_MAX]; 27 + } __packed; 28 + 29 + enum loongson_cpu_type { 30 + Loongson_2E = 0, 31 + Loongson_2F = 1, 32 + Loongson_3A = 2, 33 + Loongson_3B = 3, 34 + Loongson_1A = 4, 35 + Loongson_1B = 5 36 + }; 37 + 38 + /* 39 + * Capability and feature descriptor structure for MIPS CPU 40 + */ 41 + struct efi_cpuinfo_loongson { 42 + u16 vers; /* version of efi_cpuinfo_loongson */ 43 + u32 processor_id; /* PRID, e.g. 6305, 6306 */ 44 + u32 cputype; /* Loongson_3A/3B, etc. */ 45 + u32 total_node; /* num of total numa nodes */ 46 + u16 cpu_startup_core_id; /* Boot core id */ 47 + u16 reserved_cores_mask; 48 + u32 cpu_clock_freq; /* cpu_clock */ 49 + u32 nr_cpus; 50 + } __packed; 51 + 52 + #define MAX_UARTS 64 53 + struct uart_device { 54 + u32 iotype; /* see include/linux/serial_core.h */ 55 + u32 uartclk; 56 + u32 int_offset; 57 + u64 uart_base; 58 + } __packed; 59 + 60 + #define MAX_SENSORS 64 61 + #define SENSOR_TEMPER 0x00000001 62 + #define SENSOR_VOLTAGE 0x00000002 63 + #define SENSOR_FAN 0x00000004 64 + struct sensor_device { 65 + char name[32]; /* a formal name */ 66 + char label[64]; /* a flexible description */ 67 + u32 type; /* SENSOR_* */ 68 + u32 id; /* instance id of a sensor-class */ 69 + u32 fan_policy; /* see loongson_hwmon.h */ 70 + u32 fan_percent;/* only for constant speed policy */ 71 + u64 base_addr; /* base address of device registers */ 72 + } __packed; 73 + 74 + struct system_loongson { 75 + u16 vers; /* version of system_loongson */ 76 + u32 ccnuma_smp; /* 0: no numa; 1: has numa */ 77 + u32 sing_double_channel; /* 1:single; 2:double */ 78 + u32 nr_uarts; 79 + struct uart_device uarts[MAX_UARTS]; 80 + u32 nr_sensors; 81 + struct sensor_device sensors[MAX_SENSORS]; 82 + char has_ec; 83 + char ec_name[32]; 84 + u64 ec_base_addr; 85 + char has_tcm; 86 + char tcm_name[32]; 87 + u64 tcm_base_addr; 88 + u64 workarounds; /* see workarounds.h */ 89 + } __packed; 90 + 91 + struct irq_source_routing_table { 92 + u16 vers; 93 + u16 size; 94 + u16 rtr_bus; 95 + u16 rtr_devfn; 96 + u32 vendor; 97 + u32 device; 98 + u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */ 99 + u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */ 100 + u64 ht_enable; /* irqs used in this PIC */ 101 + u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */ 102 + u64 pci_mem_start_addr; 103 + u64 pci_mem_end_addr; 104 + u64 pci_io_start_addr; 105 + u64 pci_io_end_addr; 106 + u64 pci_config_addr; 107 + u32 dma_mask_bits; 108 + } __packed; 109 + 110 + struct interface_info { 111 + u16 vers; /* version of the specificition */ 112 + u16 size; 113 + u8 flag; 114 + char description[64]; 115 + } __packed; 116 + 117 + #define MAX_RESOURCE_NUMBER 128 118 + struct resource_loongson { 119 + u64 start; /* resource start address */ 120 + u64 end; /* resource end address */ 121 + char name[64]; 122 + u32 flags; 123 + }; 124 + 125 + struct archdev_data {}; /* arch specific additions */ 126 + 127 + struct board_devices { 128 + char name[64]; /* hold the device name */ 129 + u32 num_resources; /* number of device_resource */ 130 + /* for each device's resource */ 131 + struct resource_loongson resource[MAX_RESOURCE_NUMBER]; 132 + /* arch specific additions */ 133 + struct archdev_data archdata; 134 + }; 135 + 136 + struct loongson_special_attribute { 137 + u16 vers; /* version of this special */ 138 + char special_name[64]; /* special_atribute_name */ 139 + u32 loongson_special_type; /* type of special device */ 140 + /* for each device's resource */ 141 + struct resource_loongson resource[MAX_RESOURCE_NUMBER]; 142 + }; 143 + 144 + struct loongson_params { 145 + u64 memory_offset; /* efi_memory_map_loongson struct offset */ 146 + u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */ 147 + u64 system_offset; /* system_loongson struct offset */ 148 + u64 irq_offset; /* irq_source_routing_table struct offset */ 149 + u64 interface_offset; /* interface_info struct offset */ 150 + u64 special_offset; /* loongson_special_attribute struct offset */ 151 + u64 boarddev_table_offset; /* board_devices offset */ 152 + }; 153 + 154 + struct smbios_tables { 155 + u16 vers; /* version of smbios */ 156 + u64 vga_bios; /* vga_bios address */ 157 + struct loongson_params lp; 158 + }; 159 + 160 + struct efi_reset_system_t { 161 + u64 ResetCold; 162 + u64 ResetWarm; 163 + u64 ResetType; 164 + u64 Shutdown; 165 + u64 DoSuspend; /* NULL if not support */ 166 + }; 167 + 168 + struct efi_loongson { 169 + u64 mps; /* MPS table */ 170 + u64 acpi; /* ACPI table (IA64 ext 0.71) */ 171 + u64 acpi20; /* ACPI table (ACPI 2.0) */ 172 + struct smbios_tables smbios; /* SM BIOS table */ 173 + u64 sal_systab; /* SAL system table */ 174 + u64 boot_info; /* boot info table */ 175 + }; 176 + 177 + struct boot_params { 178 + struct efi_loongson efi; 179 + struct efi_reset_system_t reset_system; 180 + }; 181 + 182 + struct loongson_system_configuration { 183 + u32 nr_cpus; 184 + u32 nr_nodes; 185 + int cores_per_node; 186 + int cores_per_package; 187 + u16 boot_cpu_id; 188 + u16 reserved_cpus_mask; 189 + enum loongson_cpu_type cputype; 190 + u64 ht_control_base; 191 + u64 pci_mem_start_addr; 192 + u64 pci_mem_end_addr; 193 + u64 pci_io_base; 194 + u64 restart_addr; 195 + u64 poweroff_addr; 196 + u64 suspend_addr; 197 + u64 vgabios_addr; 198 + u32 dma_mask_bits; 199 + char ecname[32]; 200 + u32 nr_uarts; 201 + struct uart_device uarts[MAX_UARTS]; 202 + u32 nr_sensors; 203 + struct sensor_device sensors[MAX_SENSORS]; 204 + u64 workarounds; 205 + }; 206 + 207 + extern struct efi_memory_map_loongson *loongson_memmap; 208 + extern struct loongson_system_configuration loongson_sysconf; 209 + 210 + #endif
+61
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
··· 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) 2009 Wu Zhangjin <wuzhangjin@gmail.com> 7 + * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca> 8 + * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org> 9 + * 10 + * reference: /proc/cpuinfo, 11 + * arch/mips/kernel/cpu-probe.c(cpu_probe_legacy), 12 + * arch/mips/kernel/proc.c(show_cpuinfo), 13 + * loongson2f user manual. 14 + */ 15 + 16 + #ifndef __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H 17 + #define __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H 18 + 19 + #define cpu_dcache_line_size() 32 20 + #define cpu_icache_line_size() 32 21 + #define cpu_scache_line_size() 32 22 + 23 + 24 + #define cpu_has_32fpr 1 25 + #define cpu_has_3k_cache 0 26 + #define cpu_has_4k_cache 1 27 + #define cpu_has_4kex 1 28 + #define cpu_has_64bits 1 29 + #define cpu_has_cache_cdex_p 0 30 + #define cpu_has_cache_cdex_s 0 31 + #define cpu_has_counter 1 32 + #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) 33 + #define cpu_has_divec 0 34 + #define cpu_has_dsp 0 35 + #define cpu_has_dsp2 0 36 + #define cpu_has_ejtag 0 37 + #define cpu_has_ic_fills_f_dc 0 38 + #define cpu_has_inclusive_pcaches 1 39 + #define cpu_has_llsc 1 40 + #define cpu_has_mcheck 0 41 + #define cpu_has_mdmx 0 42 + #define cpu_has_mips16 0 43 + #define cpu_has_mips32r2 0 44 + #define cpu_has_mips3d 0 45 + #define cpu_has_mips64r2 0 46 + #define cpu_has_mipsmt 0 47 + #define cpu_has_prefetch 0 48 + #define cpu_has_smartmips 0 49 + #define cpu_has_tlb 1 50 + #define cpu_has_tx39_cache 0 51 + #define cpu_has_userlocal 0 52 + #define cpu_has_vce 0 53 + #define cpu_has_veic 0 54 + #define cpu_has_vint 0 55 + #define cpu_has_vtag_icache 0 56 + #define cpu_has_watch 1 57 + #define cpu_has_local_ebase 0 58 + 59 + #define cpu_has_wsbh IS_ENABLED(CONFIG_CPU_LOONGSON3) 60 + 61 + #endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
+85
arch/mips/include/asm/mach-loongson64/dma-coherence.h
··· 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) 2006, 07 Ralf Baechle <ralf@linux-mips.org> 7 + * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology 8 + * Author: Fuxin Zhang, zhangfx@lemote.com 9 + * 10 + */ 11 + #ifndef __ASM_MACH_LOONGSON64_DMA_COHERENCE_H 12 + #define __ASM_MACH_LOONGSON64_DMA_COHERENCE_H 13 + 14 + #ifdef CONFIG_SWIOTLB 15 + #include <linux/swiotlb.h> 16 + #endif 17 + 18 + struct device; 19 + 20 + extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 21 + extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr); 22 + static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, 23 + size_t size) 24 + { 25 + #ifdef CONFIG_CPU_LOONGSON3 26 + return phys_to_dma(dev, virt_to_phys(addr)); 27 + #else 28 + return virt_to_phys(addr) | 0x80000000; 29 + #endif 30 + } 31 + 32 + static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, 33 + struct page *page) 34 + { 35 + #ifdef CONFIG_CPU_LOONGSON3 36 + return phys_to_dma(dev, page_to_phys(page)); 37 + #else 38 + return page_to_phys(page) | 0x80000000; 39 + #endif 40 + } 41 + 42 + static inline unsigned long plat_dma_addr_to_phys(struct device *dev, 43 + dma_addr_t dma_addr) 44 + { 45 + #if defined(CONFIG_CPU_LOONGSON3) && defined(CONFIG_64BIT) 46 + return dma_to_phys(dev, dma_addr); 47 + #elif defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) 48 + return (dma_addr > 0x8fffffff) ? dma_addr : (dma_addr & 0x0fffffff); 49 + #else 50 + return dma_addr & 0x7fffffff; 51 + #endif 52 + } 53 + 54 + static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 55 + size_t size, enum dma_data_direction direction) 56 + { 57 + } 58 + 59 + static inline int plat_dma_supported(struct device *dev, u64 mask) 60 + { 61 + /* 62 + * we fall back to GFP_DMA when the mask isn't all 1s, 63 + * so we can't guarantee allocations that must be 64 + * within a tighter range than GFP_DMA.. 65 + */ 66 + if (mask < DMA_BIT_MASK(24)) 67 + return 0; 68 + 69 + return 1; 70 + } 71 + 72 + static inline int plat_device_is_coherent(struct device *dev) 73 + { 74 + #ifdef CONFIG_DMA_NONCOHERENT 75 + return 0; 76 + #else 77 + return 1; 78 + #endif /* CONFIG_DMA_NONCOHERENT */ 79 + } 80 + 81 + static inline void plat_post_dma_flush(struct device *dev) 82 + { 83 + } 84 + 85 + #endif /* __ASM_MACH_LOONGSON64_DMA_COHERENCE_H */
+43
arch/mips/include/asm/mach-loongson64/irq.h
··· 1 + #ifndef __ASM_MACH_LOONGSON64_IRQ_H_ 2 + #define __ASM_MACH_LOONGSON64_IRQ_H_ 3 + 4 + #include <boot_param.h> 5 + 6 + #ifdef CONFIG_CPU_LOONGSON3 7 + 8 + /* cpu core interrupt numbers */ 9 + #define MIPS_CPU_IRQ_BASE 56 10 + 11 + #define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */ 12 + #define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3) /* HT1 */ 13 + #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */ 14 + 15 + #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base 16 + #define LOONGSON_HT1_INT_VECTOR_BASE (LOONGSON_HT1_CFG_BASE + 0x80) 17 + #define LOONGSON_HT1_INT_EN_BASE (LOONGSON_HT1_CFG_BASE + 0xa0) 18 + #define LOONGSON_HT1_INT_VECTOR(n) \ 19 + LOONGSON3_REG32(LOONGSON_HT1_INT_VECTOR_BASE, 4 * (n)) 20 + #define LOONGSON_HT1_INTN_EN(n) \ 21 + LOONGSON3_REG32(LOONGSON_HT1_INT_EN_BASE, 4 * (n)) 22 + 23 + #define LOONGSON_INT_ROUTER_OFFSET 0x1400 24 + #define LOONGSON_INT_ROUTER_INTEN \ 25 + LOONGSON3_REG32(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + 0x24) 26 + #define LOONGSON_INT_ROUTER_INTENSET \ 27 + LOONGSON3_REG32(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + 0x28) 28 + #define LOONGSON_INT_ROUTER_INTENCLR \ 29 + LOONGSON3_REG32(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + 0x2c) 30 + #define LOONGSON_INT_ROUTER_ENTRY(n) \ 31 + LOONGSON3_REG8(LOONGSON3_REG_BASE, LOONGSON_INT_ROUTER_OFFSET + n) 32 + #define LOONGSON_INT_ROUTER_LPC LOONGSON_INT_ROUTER_ENTRY(0x0a) 33 + #define LOONGSON_INT_ROUTER_HT1(n) LOONGSON_INT_ROUTER_ENTRY(n + 0x18) 34 + 35 + #define LOONGSON_INT_COREx_INTy(x, y) (1<<(x) | 1<<(y+4)) /* route to int y of core x */ 36 + 37 + #endif 38 + 39 + extern void fixup_irqs(void); 40 + extern void loongson3_ipi_interrupt(struct pt_regs *regs); 41 + 42 + #include_next <irq.h> 43 + #endif /* __ASM_MACH_LOONGSON64_IRQ_H_ */
+52
arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
··· 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) 2005 Embedded Alley Solutions, Inc 7 + * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 8 + * Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn) 9 + * Copyright (C) 2012 Huacai Chen (chenhc@lemote.com) 10 + */ 11 + #ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H 12 + #define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H 13 + 14 + /* 15 + * Override macros used in arch/mips/kernel/head.S. 16 + */ 17 + .macro kernel_entry_setup 18 + #ifdef CONFIG_CPU_LOONGSON3 19 + .set push 20 + .set mips64 21 + /* Set LPA on LOONGSON3 config3 */ 22 + mfc0 t0, $16, 3 23 + or t0, (0x1 << 7) 24 + mtc0 t0, $16, 3 25 + /* Set ELPA on LOONGSON3 pagegrain */ 26 + li t0, (0x1 << 29) 27 + mtc0 t0, $5, 1 28 + _ehb 29 + .set pop 30 + #endif 31 + .endm 32 + 33 + /* 34 + * Do SMP slave processor setup. 35 + */ 36 + .macro smp_slave_setup 37 + #ifdef CONFIG_CPU_LOONGSON3 38 + .set push 39 + .set mips64 40 + /* Set LPA on LOONGSON3 config3 */ 41 + mfc0 t0, $16, 3 42 + or t0, (0x1 << 7) 43 + mtc0 t0, $16, 3 44 + /* Set ELPA on LOONGSON3 pagegrain */ 45 + li t0, (0x1 << 29) 46 + mtc0 t0, $5, 1 47 + _ehb 48 + .set pop 49 + #endif 50 + .endm 51 + 52 + #endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */
+360
arch/mips/include/asm/mach-loongson64/loongson.h
··· 1 + /* 2 + * Copyright (C) 2009 Lemote, Inc. 3 + * Author: Wu Zhangjin <wuzhangjin@gmail.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 __ASM_MACH_LOONGSON64_LOONGSON_H 12 + #define __ASM_MACH_LOONGSON64_LOONGSON_H 13 + 14 + #include <linux/io.h> 15 + #include <linux/init.h> 16 + #include <linux/irq.h> 17 + #include <linux/kconfig.h> 18 + #include <boot_param.h> 19 + 20 + /* loongson internal northbridge initialization */ 21 + extern void bonito_irq_init(void); 22 + 23 + /* machine-specific reboot/halt operation */ 24 + extern void mach_prepare_reboot(void); 25 + extern void mach_prepare_shutdown(void); 26 + 27 + /* environment arguments from bootloader */ 28 + extern u32 cpu_clock_freq; 29 + extern u32 memsize, highmemsize; 30 + extern struct plat_smp_ops loongson3_smp_ops; 31 + 32 + /* loongson-specific command line, env and memory initialization */ 33 + extern void __init prom_init_memory(void); 34 + extern void __init prom_init_cmdline(void); 35 + extern void __init prom_init_machtype(void); 36 + extern void __init prom_init_env(void); 37 + #ifdef CONFIG_LOONGSON_UART_BASE 38 + extern unsigned long _loongson_uart_base[], loongson_uart_base[]; 39 + extern void prom_init_loongson_uart_base(void); 40 + #endif 41 + 42 + static inline void prom_init_uart_base(void) 43 + { 44 + #ifdef CONFIG_LOONGSON_UART_BASE 45 + prom_init_loongson_uart_base(); 46 + #endif 47 + } 48 + 49 + /* irq operation functions */ 50 + extern void bonito_irqdispatch(void); 51 + extern void __init bonito_irq_init(void); 52 + extern void __init mach_init_irq(void); 53 + extern void mach_irq_dispatch(unsigned int pending); 54 + extern int mach_i8259_irq(void); 55 + 56 + /* We need this in some places... */ 57 + #define delay() ({ \ 58 + int x; \ 59 + for (x = 0; x < 100000; x++) \ 60 + __asm__ __volatile__(""); \ 61 + }) 62 + 63 + #define LOONGSON_REG(x) \ 64 + (*(volatile u32 *)((char *)CKSEG1ADDR(LOONGSON_REG_BASE) + (x))) 65 + 66 + #define LOONGSON3_REG8(base, x) \ 67 + (*(volatile u8 *)((char *)TO_UNCAC(base) + (x))) 68 + 69 + #define LOONGSON3_REG32(base, x) \ 70 + (*(volatile u32 *)((char *)TO_UNCAC(base) + (x))) 71 + 72 + #define LOONGSON_IRQ_BASE 32 73 + #define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */ 74 + 75 + #include <linux/interrupt.h> 76 + static inline void do_perfcnt_IRQ(void) 77 + { 78 + #if IS_ENABLED(CONFIG_OPROFILE) 79 + do_IRQ(LOONGSON2_PERFCNT_IRQ); 80 + #endif 81 + } 82 + 83 + #define LOONGSON_FLASH_BASE 0x1c000000 84 + #define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */ 85 + #define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1) 86 + 87 + #define LOONGSON_LIO0_BASE 0x1e000000 88 + #define LOONGSON_LIO0_SIZE 0x01C00000 /* 28M */ 89 + #define LOONGSON_LIO0_TOP (LOONGSON_LIO0_BASE+LOONGSON_LIO0_SIZE-1) 90 + 91 + #define LOONGSON_BOOT_BASE 0x1fc00000 92 + #define LOONGSON_BOOT_SIZE 0x00100000 /* 1M */ 93 + #define LOONGSON_BOOT_TOP (LOONGSON_BOOT_BASE+LOONGSON_BOOT_SIZE-1) 94 + #define LOONGSON_REG_BASE 0x1fe00000 95 + #define LOONGSON_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */ 96 + #define LOONGSON_REG_TOP (LOONGSON_REG_BASE+LOONGSON_REG_SIZE-1) 97 + /* Loongson-3 specific registers */ 98 + #define LOONGSON3_REG_BASE 0x3ff00000 99 + #define LOONGSON3_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */ 100 + #define LOONGSON3_REG_TOP (LOONGSON3_REG_BASE+LOONGSON3_REG_SIZE-1) 101 + 102 + #define LOONGSON_LIO1_BASE 0x1ff00000 103 + #define LOONGSON_LIO1_SIZE 0x00100000 /* 1M */ 104 + #define LOONGSON_LIO1_TOP (LOONGSON_LIO1_BASE+LOONGSON_LIO1_SIZE-1) 105 + 106 + #define LOONGSON_PCILO0_BASE 0x10000000 107 + #define LOONGSON_PCILO1_BASE 0x14000000 108 + #define LOONGSON_PCILO2_BASE 0x18000000 109 + #define LOONGSON_PCILO_BASE LOONGSON_PCILO0_BASE 110 + #define LOONGSON_PCILO_SIZE 0x0c000000 /* 64M * 3 */ 111 + #define LOONGSON_PCILO_TOP (LOONGSON_PCILO0_BASE+LOONGSON_PCILO_SIZE-1) 112 + 113 + #define LOONGSON_PCICFG_BASE 0x1fe80000 114 + #define LOONGSON_PCICFG_SIZE 0x00000800 /* 2K */ 115 + #define LOONGSON_PCICFG_TOP (LOONGSON_PCICFG_BASE+LOONGSON_PCICFG_SIZE-1) 116 + 117 + #if defined(CONFIG_HT_PCI) 118 + #define LOONGSON_PCIIO_BASE loongson_sysconf.pci_io_base 119 + #else 120 + #define LOONGSON_PCIIO_BASE 0x1fd00000 121 + #endif 122 + 123 + #define LOONGSON_PCIIO_SIZE 0x00100000 /* 1M */ 124 + #define LOONGSON_PCIIO_TOP (LOONGSON_PCIIO_BASE+LOONGSON_PCIIO_SIZE-1) 125 + 126 + /* Loongson Register Bases */ 127 + 128 + #define LOONGSON_PCICONFIGBASE 0x00 129 + #define LOONGSON_REGBASE 0x100 130 + 131 + /* PCI Configuration Registers */ 132 + 133 + #define LOONGSON_PCI_REG(x) LOONGSON_REG(LOONGSON_PCICONFIGBASE + (x)) 134 + #define LOONGSON_PCIDID LOONGSON_PCI_REG(0x00) 135 + #define LOONGSON_PCICMD LOONGSON_PCI_REG(0x04) 136 + #define LOONGSON_PCICLASS LOONGSON_PCI_REG(0x08) 137 + #define LOONGSON_PCILTIMER LOONGSON_PCI_REG(0x0c) 138 + #define LOONGSON_PCIBASE0 LOONGSON_PCI_REG(0x10) 139 + #define LOONGSON_PCIBASE1 LOONGSON_PCI_REG(0x14) 140 + #define LOONGSON_PCIBASE2 LOONGSON_PCI_REG(0x18) 141 + #define LOONGSON_PCIBASE3 LOONGSON_PCI_REG(0x1c) 142 + #define LOONGSON_PCIBASE4 LOONGSON_PCI_REG(0x20) 143 + #define LOONGSON_PCIEXPRBASE LOONGSON_PCI_REG(0x30) 144 + #define LOONGSON_PCIINT LOONGSON_PCI_REG(0x3c) 145 + 146 + #define LOONGSON_PCI_ISR4C LOONGSON_PCI_REG(0x4c) 147 + 148 + #define LOONGSON_PCICMD_PERR_CLR 0x80000000 149 + #define LOONGSON_PCICMD_SERR_CLR 0x40000000 150 + #define LOONGSON_PCICMD_MABORT_CLR 0x20000000 151 + #define LOONGSON_PCICMD_MTABORT_CLR 0x10000000 152 + #define LOONGSON_PCICMD_TABORT_CLR 0x08000000 153 + #define LOONGSON_PCICMD_MPERR_CLR 0x01000000 154 + #define LOONGSON_PCICMD_PERRRESPEN 0x00000040 155 + #define LOONGSON_PCICMD_ASTEPEN 0x00000080 156 + #define LOONGSON_PCICMD_SERREN 0x00000100 157 + #define LOONGSON_PCILTIMER_BUSLATENCY 0x0000ff00 158 + #define LOONGSON_PCILTIMER_BUSLATENCY_SHIFT 8 159 + 160 + /* Loongson h/w Configuration */ 161 + 162 + #define LOONGSON_GENCFG_OFFSET 0x4 163 + #define LOONGSON_GENCFG LOONGSON_REG(LOONGSON_REGBASE + LOONGSON_GENCFG_OFFSET) 164 + 165 + #define LOONGSON_GENCFG_DEBUGMODE 0x00000001 166 + #define LOONGSON_GENCFG_SNOOPEN 0x00000002 167 + #define LOONGSON_GENCFG_CPUSELFRESET 0x00000004 168 + 169 + #define LOONGSON_GENCFG_FORCE_IRQA 0x00000008 170 + #define LOONGSON_GENCFG_IRQA_ISOUT 0x00000010 171 + #define LOONGSON_GENCFG_IRQA_FROM_INT1 0x00000020 172 + #define LOONGSON_GENCFG_BYTESWAP 0x00000040 173 + 174 + #define LOONGSON_GENCFG_UNCACHED 0x00000080 175 + #define LOONGSON_GENCFG_PREFETCHEN 0x00000100 176 + #define LOONGSON_GENCFG_WBEHINDEN 0x00000200 177 + #define LOONGSON_GENCFG_CACHEALG 0x00000c00 178 + #define LOONGSON_GENCFG_CACHEALG_SHIFT 10 179 + #define LOONGSON_GENCFG_PCIQUEUE 0x00001000 180 + #define LOONGSON_GENCFG_CACHESTOP 0x00002000 181 + #define LOONGSON_GENCFG_MSTRBYTESWAP 0x00004000 182 + #define LOONGSON_GENCFG_BUSERREN 0x00008000 183 + #define LOONGSON_GENCFG_NORETRYTIMEOUT 0x00010000 184 + #define LOONGSON_GENCFG_SHORTCOPYTIMEOUT 0x00020000 185 + 186 + /* PCI address map control */ 187 + 188 + #define LOONGSON_PCIMAP LOONGSON_REG(LOONGSON_REGBASE + 0x10) 189 + #define LOONGSON_PCIMEMBASECFG LOONGSON_REG(LOONGSON_REGBASE + 0x14) 190 + #define LOONGSON_PCIMAP_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x18) 191 + 192 + /* GPIO Regs - r/w */ 193 + 194 + #define LOONGSON_GPIODATA LOONGSON_REG(LOONGSON_REGBASE + 0x1c) 195 + #define LOONGSON_GPIOIE LOONGSON_REG(LOONGSON_REGBASE + 0x20) 196 + 197 + /* ICU Configuration Regs - r/w */ 198 + 199 + #define LOONGSON_INTEDGE LOONGSON_REG(LOONGSON_REGBASE + 0x24) 200 + #define LOONGSON_INTSTEER LOONGSON_REG(LOONGSON_REGBASE + 0x28) 201 + #define LOONGSON_INTPOL LOONGSON_REG(LOONGSON_REGBASE + 0x2c) 202 + 203 + /* ICU Enable Regs - IntEn & IntISR are r/o. */ 204 + 205 + #define LOONGSON_INTENSET LOONGSON_REG(LOONGSON_REGBASE + 0x30) 206 + #define LOONGSON_INTENCLR LOONGSON_REG(LOONGSON_REGBASE + 0x34) 207 + #define LOONGSON_INTEN LOONGSON_REG(LOONGSON_REGBASE + 0x38) 208 + #define LOONGSON_INTISR LOONGSON_REG(LOONGSON_REGBASE + 0x3c) 209 + 210 + /* ICU */ 211 + #define LOONGSON_ICU_MBOXES 0x0000000f 212 + #define LOONGSON_ICU_MBOXES_SHIFT 0 213 + #define LOONGSON_ICU_DMARDY 0x00000010 214 + #define LOONGSON_ICU_DMAEMPTY 0x00000020 215 + #define LOONGSON_ICU_COPYRDY 0x00000040 216 + #define LOONGSON_ICU_COPYEMPTY 0x00000080 217 + #define LOONGSON_ICU_COPYERR 0x00000100 218 + #define LOONGSON_ICU_PCIIRQ 0x00000200 219 + #define LOONGSON_ICU_MASTERERR 0x00000400 220 + #define LOONGSON_ICU_SYSTEMERR 0x00000800 221 + #define LOONGSON_ICU_DRAMPERR 0x00001000 222 + #define LOONGSON_ICU_RETRYERR 0x00002000 223 + #define LOONGSON_ICU_GPIOS 0x01ff0000 224 + #define LOONGSON_ICU_GPIOS_SHIFT 16 225 + #define LOONGSON_ICU_GPINS 0x7e000000 226 + #define LOONGSON_ICU_GPINS_SHIFT 25 227 + #define LOONGSON_ICU_MBOX(N) (1<<(LOONGSON_ICU_MBOXES_SHIFT+(N))) 228 + #define LOONGSON_ICU_GPIO(N) (1<<(LOONGSON_ICU_GPIOS_SHIFT+(N))) 229 + #define LOONGSON_ICU_GPIN(N) (1<<(LOONGSON_ICU_GPINS_SHIFT+(N))) 230 + 231 + /* PCI prefetch window base & mask */ 232 + 233 + #define LOONGSON_MEM_WIN_BASE_L LOONGSON_REG(LOONGSON_REGBASE + 0x40) 234 + #define LOONGSON_MEM_WIN_BASE_H LOONGSON_REG(LOONGSON_REGBASE + 0x44) 235 + #define LOONGSON_MEM_WIN_MASK_L LOONGSON_REG(LOONGSON_REGBASE + 0x48) 236 + #define LOONGSON_MEM_WIN_MASK_H LOONGSON_REG(LOONGSON_REGBASE + 0x4c) 237 + 238 + /* PCI_Hit*_Sel_* */ 239 + 240 + #define LOONGSON_PCI_HIT0_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x50) 241 + #define LOONGSON_PCI_HIT0_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x54) 242 + #define LOONGSON_PCI_HIT1_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x58) 243 + #define LOONGSON_PCI_HIT1_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x5c) 244 + #define LOONGSON_PCI_HIT2_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x60) 245 + #define LOONGSON_PCI_HIT2_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x64) 246 + 247 + /* PXArb Config & Status */ 248 + 249 + #define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68) 250 + #define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c) 251 + 252 + #define MAX_PACKAGES 4 253 + 254 + /* Chip Config registor of each physical cpu package, PRid >= Loongson-2F */ 255 + extern u64 loongson_chipcfg[MAX_PACKAGES]; 256 + #define LOONGSON_CHIPCFG(id) (*(volatile u32 *)(loongson_chipcfg[id])) 257 + 258 + /* Chip Temperature registor of each physical cpu package, PRid >= Loongson-3A */ 259 + extern u64 loongson_chiptemp[MAX_PACKAGES]; 260 + #define LOONGSON_CHIPTEMP(id) (*(volatile u32 *)(loongson_chiptemp[id])) 261 + 262 + /* Freq Control register of each physical cpu package, PRid >= Loongson-3B */ 263 + extern u64 loongson_freqctrl[MAX_PACKAGES]; 264 + #define LOONGSON_FREQCTRL(id) (*(volatile u32 *)(loongson_freqctrl[id])) 265 + 266 + /* pcimap */ 267 + 268 + #define LOONGSON_PCIMAP_PCIMAP_LO0 0x0000003f 269 + #define LOONGSON_PCIMAP_PCIMAP_LO0_SHIFT 0 270 + #define LOONGSON_PCIMAP_PCIMAP_LO1 0x00000fc0 271 + #define LOONGSON_PCIMAP_PCIMAP_LO1_SHIFT 6 272 + #define LOONGSON_PCIMAP_PCIMAP_LO2 0x0003f000 273 + #define LOONGSON_PCIMAP_PCIMAP_LO2_SHIFT 12 274 + #define LOONGSON_PCIMAP_PCIMAP_2 0x00040000 275 + #define LOONGSON_PCIMAP_WIN(WIN, ADDR) \ 276 + ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6)) 277 + 278 + #ifdef CONFIG_CPU_SUPPORTS_CPUFREQ 279 + #include <linux/cpufreq.h> 280 + extern struct cpufreq_frequency_table loongson2_clockmod_table[]; 281 + #endif 282 + 283 + /* 284 + * address windows configuration module 285 + * 286 + * loongson2e do not have this module 287 + */ 288 + #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG 289 + 290 + /* address window config module base address */ 291 + #define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul 292 + #define LOONGSON_ADDRWINCFG_SIZE 0x180 293 + 294 + extern unsigned long _loongson_addrwincfg_base; 295 + #define LOONGSON_ADDRWINCFG(offset) \ 296 + (*(volatile u64 *)(_loongson_addrwincfg_base + (offset))) 297 + 298 + #define CPU_WIN0_BASE LOONGSON_ADDRWINCFG(0x00) 299 + #define CPU_WIN1_BASE LOONGSON_ADDRWINCFG(0x08) 300 + #define CPU_WIN2_BASE LOONGSON_ADDRWINCFG(0x10) 301 + #define CPU_WIN3_BASE LOONGSON_ADDRWINCFG(0x18) 302 + 303 + #define CPU_WIN0_MASK LOONGSON_ADDRWINCFG(0x20) 304 + #define CPU_WIN1_MASK LOONGSON_ADDRWINCFG(0x28) 305 + #define CPU_WIN2_MASK LOONGSON_ADDRWINCFG(0x30) 306 + #define CPU_WIN3_MASK LOONGSON_ADDRWINCFG(0x38) 307 + 308 + #define CPU_WIN0_MMAP LOONGSON_ADDRWINCFG(0x40) 309 + #define CPU_WIN1_MMAP LOONGSON_ADDRWINCFG(0x48) 310 + #define CPU_WIN2_MMAP LOONGSON_ADDRWINCFG(0x50) 311 + #define CPU_WIN3_MMAP LOONGSON_ADDRWINCFG(0x58) 312 + 313 + #define PCIDMA_WIN0_BASE LOONGSON_ADDRWINCFG(0x60) 314 + #define PCIDMA_WIN1_BASE LOONGSON_ADDRWINCFG(0x68) 315 + #define PCIDMA_WIN2_BASE LOONGSON_ADDRWINCFG(0x70) 316 + #define PCIDMA_WIN3_BASE LOONGSON_ADDRWINCFG(0x78) 317 + 318 + #define PCIDMA_WIN0_MASK LOONGSON_ADDRWINCFG(0x80) 319 + #define PCIDMA_WIN1_MASK LOONGSON_ADDRWINCFG(0x88) 320 + #define PCIDMA_WIN2_MASK LOONGSON_ADDRWINCFG(0x90) 321 + #define PCIDMA_WIN3_MASK LOONGSON_ADDRWINCFG(0x98) 322 + 323 + #define PCIDMA_WIN0_MMAP LOONGSON_ADDRWINCFG(0xa0) 324 + #define PCIDMA_WIN1_MMAP LOONGSON_ADDRWINCFG(0xa8) 325 + #define PCIDMA_WIN2_MMAP LOONGSON_ADDRWINCFG(0xb0) 326 + #define PCIDMA_WIN3_MMAP LOONGSON_ADDRWINCFG(0xb8) 327 + 328 + #define ADDRWIN_WIN0 0 329 + #define ADDRWIN_WIN1 1 330 + #define ADDRWIN_WIN2 2 331 + #define ADDRWIN_WIN3 3 332 + 333 + #define ADDRWIN_MAP_DST_DDR 0 334 + #define ADDRWIN_MAP_DST_PCI 1 335 + #define ADDRWIN_MAP_DST_LIO 1 336 + 337 + /* 338 + * s: CPU, PCIDMA 339 + * d: DDR, PCI, LIO 340 + * win: 0, 1, 2, 3 341 + * src: map source 342 + * dst: map destination 343 + * size: ~mask + 1 344 + */ 345 + #define LOONGSON_ADDRWIN_CFG(s, d, w, src, dst, size) do {\ 346 + s##_WIN##w##_BASE = (src); \ 347 + s##_WIN##w##_MMAP = (dst) | ADDRWIN_MAP_DST_##d; \ 348 + s##_WIN##w##_MASK = ~(size-1); \ 349 + } while (0) 350 + 351 + #define LOONGSON_ADDRWIN_CPUTOPCI(win, src, dst, size) \ 352 + LOONGSON_ADDRWIN_CFG(CPU, PCI, win, src, dst, size) 353 + #define LOONGSON_ADDRWIN_CPUTODDR(win, src, dst, size) \ 354 + LOONGSON_ADDRWIN_CFG(CPU, DDR, win, src, dst, size) 355 + #define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \ 356 + LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size) 357 + 358 + #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */ 359 + 360 + #endif /* __ASM_MACH_LOONGSON64_LOONGSON_H */
+33
arch/mips/include/asm/mach-loongson64/machine.h
··· 1 + /* 2 + * Copyright (C) 2009 Lemote, Inc. 3 + * Author: Wu Zhangjin <wuzhangjin@gmail.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 __ASM_MACH_LOONGSON64_MACHINE_H 12 + #define __ASM_MACH_LOONGSON64_MACHINE_H 13 + 14 + #ifdef CONFIG_LEMOTE_FULOONG2E 15 + 16 + #define LOONGSON_MACHTYPE MACH_LEMOTE_FL2E 17 + 18 + #endif 19 + 20 + /* use fuloong2f as the default machine of LEMOTE_MACH2F */ 21 + #ifdef CONFIG_LEMOTE_MACH2F 22 + 23 + #define LOONGSON_MACHTYPE MACH_LEMOTE_FL2F 24 + 25 + #endif 26 + 27 + #ifdef CONFIG_LOONGSON_MACH3X 28 + 29 + #define LOONGSON_MACHTYPE MACH_LOONGSON_GENERIC 30 + 31 + #endif /* CONFIG_LOONGSON_MACH3X */ 32 + 33 + #endif /* __ASM_MACH_LOONGSON64_MACHINE_H */
+36
arch/mips/include/asm/mach-loongson64/mc146818rtc.h
··· 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) 1998, 2001, 03, 07 by Ralf Baechle (ralf@linux-mips.org) 7 + * 8 + * RTC routines for PC style attached Dallas chip. 9 + */ 10 + #ifndef __ASM_MACH_LOONGSON64_MC146818RTC_H 11 + #define __ASM_MACH_LOONGSON64_MC146818RTC_H 12 + 13 + #include <linux/io.h> 14 + 15 + #define RTC_PORT(x) (0x70 + (x)) 16 + #define RTC_IRQ 8 17 + 18 + static inline unsigned char CMOS_READ(unsigned long addr) 19 + { 20 + outb_p(addr, RTC_PORT(0)); 21 + return inb_p(RTC_PORT(1)); 22 + } 23 + 24 + static inline void CMOS_WRITE(unsigned char data, unsigned long addr) 25 + { 26 + outb_p(addr, RTC_PORT(0)); 27 + outb_p(data, RTC_PORT(1)); 28 + } 29 + 30 + #define RTC_ALWAYS_BCD 0 31 + 32 + #ifndef mc146818_decode_year 33 + #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) 34 + #endif 35 + 36 + #endif /* __ASM_MACH_LOONGSON64_MC146818RTC_H */
+41
arch/mips/include/asm/mach-loongson64/mem.h
··· 1 + /* 2 + * Copyright (C) 2009 Lemote, Inc. 3 + * Author: Wu Zhangjin <wuzhangjin@gmail.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 __ASM_MACH_LOONGSON64_MEM_H 12 + #define __ASM_MACH_LOONGSON64_MEM_H 13 + 14 + /* 15 + * high memory space 16 + * 17 + * in loongson2e, starts from 512M 18 + * in loongson2f, starts from 2G 256M 19 + */ 20 + #ifdef CONFIG_CPU_LOONGSON2E 21 + #define LOONGSON_HIGHMEM_START 0x20000000 22 + #else 23 + #define LOONGSON_HIGHMEM_START 0x90000000 24 + #endif 25 + 26 + /* 27 + * the peripheral registers(MMIO): 28 + * 29 + * On the Lemote Loongson 2e system, reside between 0x1000:0000 and 0x2000:0000. 30 + * On the Lemote Loongson 2f system, reside between 0x1000:0000 and 0x8000:0000. 31 + */ 32 + 33 + #define LOONGSON_MMIO_MEM_START 0x10000000 34 + 35 + #ifdef CONFIG_CPU_LOONGSON2E 36 + #define LOONGSON_MMIO_MEM_END 0x20000000 37 + #else 38 + #define LOONGSON_MMIO_MEM_END 0x80000000 39 + #endif 40 + 41 + #endif /* __ASM_MACH_LOONGSON64_MEM_H */
+55
arch/mips/include/asm/mach-loongson64/pci.h
··· 1 + /* 2 + * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org> 3 + * Copyright (c) 2009 Wu Zhangjin <wuzhangjin@gmail.com> 4 + * 5 + * This program is free software; you can redistribute it 6 + * and/or modify it under the terms of the GNU General 7 + * Public License as published by the Free Software 8 + * Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #ifndef __ASM_MACH_LOONGSON64_PCI_H_ 13 + #define __ASM_MACH_LOONGSON64_PCI_H_ 14 + 15 + extern struct pci_ops loongson_pci_ops; 16 + 17 + /* this is an offset from mips_io_port_base */ 18 + #define LOONGSON_PCI_IO_START 0x00004000UL 19 + 20 + #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG 21 + 22 + /* 23 + * we use address window2 to map cpu address space to pci space 24 + * window2: cpu [1G, 2G] -> pci [1G, 2G] 25 + * why not use window 0 & 1? because they are used by cpu when booting. 26 + * window0: cpu [0, 256M] -> ddr [0, 256M] 27 + * window1: cpu [256M, 512M] -> pci [256M, 512M] 28 + */ 29 + 30 + /* the smallest LOONGSON_CPU_MEM_SRC can be 512M */ 31 + #define LOONGSON_CPU_MEM_SRC 0x40000000ul /* 1G */ 32 + #define LOONGSON_PCI_MEM_DST LOONGSON_CPU_MEM_SRC 33 + 34 + #define LOONGSON_PCI_MEM_START LOONGSON_PCI_MEM_DST 35 + #define LOONGSON_PCI_MEM_END (0x80000000ul-1) /* 2G */ 36 + 37 + #define MMAP_CPUTOPCI_SIZE (LOONGSON_PCI_MEM_END - \ 38 + LOONGSON_PCI_MEM_START + 1) 39 + 40 + #else /* loongson2f/32bit & loongson2e */ 41 + 42 + /* this pci memory space is mapped by pcimap in pci.c */ 43 + #ifdef CONFIG_CPU_LOONGSON3 44 + #define LOONGSON_PCI_MEM_START 0x40000000UL 45 + #define LOONGSON_PCI_MEM_END 0x7effffffUL 46 + #else 47 + #define LOONGSON_PCI_MEM_START LOONGSON_PCILO1_BASE 48 + #define LOONGSON_PCI_MEM_END (LOONGSON_PCILO1_BASE + 0x04000000 * 2) 49 + #endif 50 + /* this is an offset from mips_io_port_base */ 51 + #define LOONGSON_PCI_IO_START 0x00004000UL 52 + 53 + #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */ 54 + 55 + #endif /* !__ASM_MACH_LOONGSON64_PCI_H_ */
+9
arch/mips/include/asm/mach-loongson64/spaces.h
··· 1 + #ifndef __ASM_MACH_LOONGSON64_SPACES_H_ 2 + #define __ASM_MACH_LOONGSON64_SPACES_H_ 3 + 4 + #if defined(CONFIG_64BIT) 5 + #define CAC_BASE _AC(0x9800000000000000, UL) 6 + #endif /* CONFIG_64BIT */ 7 + 8 + #include <asm/mach-generic/spaces.h> 9 + #endif
+7
arch/mips/include/asm/mach-loongson64/workarounds.h
··· 1 + #ifndef __ASM_MACH_LOONGSON64_WORKAROUNDS_H_ 2 + #define __ASM_MACH_LOONGSON64_WORKAROUNDS_H_ 3 + 4 + #define WORKAROUND_CPUFREQ 0x00000001 5 + #define WORKAROUND_CPUHOTPLUG 0x00000002 6 + 7 + #endif
+5
arch/mips/include/asm/mips-cm.h
··· 11 11 #ifndef __MIPS_ASM_MIPS_CM_H__ 12 12 #define __MIPS_ASM_MIPS_CM_H__ 13 13 14 + #include <linux/errno.h> 14 15 #include <linux/io.h> 15 16 #include <linux/types.h> 16 17 ··· 216 215 #define CM_GCR_CPC_BASE_CPCBASE_MSK (_ULCAST_(0x7fff) << 17) 217 216 #define CM_GCR_CPC_BASE_CPCEN_SHF 0 218 217 #define CM_GCR_CPC_BASE_CPCEN_MSK (_ULCAST_(0x1) << 0) 218 + 219 + /* GCR_GIC_STATUS register fields */ 220 + #define CM_GCR_GIC_STATUS_GICEX_SHF 0 221 + #define CM_GCR_GIC_STATUS_GICEX_MSK (_ULCAST_(0x1) << 0) 219 222 220 223 /* GCR_REGn_BASE register fields */ 221 224 #define CM_GCR_REGn_BASE_BASEADDR_SHF 16
+35
arch/mips/include/asm/mipsregs.h
··· 589 589 /* EntryHI bit definition */ 590 590 #define MIPS_ENTRYHI_EHINV (_ULCAST_(1) << 10) 591 591 592 + /* R3000 EntryLo bit definitions */ 593 + #define R3K_ENTRYLO_G (_ULCAST_(1) << 8) 594 + #define R3K_ENTRYLO_V (_ULCAST_(1) << 9) 595 + #define R3K_ENTRYLO_D (_ULCAST_(1) << 10) 596 + #define R3K_ENTRYLO_N (_ULCAST_(1) << 11) 597 + 598 + /* R4000 compatible EntryLo bit definitions */ 599 + #define MIPS_ENTRYLO_G (_ULCAST_(1) << 0) 600 + #define MIPS_ENTRYLO_V (_ULCAST_(1) << 1) 601 + #define MIPS_ENTRYLO_D (_ULCAST_(1) << 2) 602 + #define MIPS_ENTRYLO_C_SHIFT 3 603 + #define MIPS_ENTRYLO_C (_ULCAST_(7) << MIPS_ENTRYLO_C_SHIFT) 604 + #ifdef CONFIG_64BIT 605 + /* as read by dmfc0 */ 606 + #define MIPS_ENTRYLO_XI (_ULCAST_(1) << 62) 607 + #define MIPS_ENTRYLO_RI (_ULCAST_(1) << 63) 608 + #else 609 + /* as read by mfc0 */ 610 + #define MIPS_ENTRYLO_XI (_ULCAST_(1) << 30) 611 + #define MIPS_ENTRYLO_RI (_ULCAST_(1) << 31) 612 + #endif 613 + 592 614 /* CMGCRBase bit definitions */ 593 615 #define MIPS_CMGCRB_BASE 11 594 616 #define MIPS_CMGCRF_BASE (~_ULCAST_((1 << MIPS_CMGCRB_BASE) - 1)) ··· 707 685 #define TX39_CONF_DRSIZE_SHIFT 0 708 686 #define TX39_CONF_DRSIZE_MASK 0x00000003 709 687 688 + /* 689 + * Interesting Bits in the R10K CP0 Branch Diagnostic Register 690 + */ 691 + /* Disable Branch Target Address Cache */ 692 + #define R10K_DIAG_D_BTAC (_ULCAST_(1) << 27) 693 + /* Enable Branch Prediction Global History */ 694 + #define R10K_DIAG_E_GHIST (_ULCAST_(1) << 26) 695 + /* Disable Branch Return Cache */ 696 + #define R10K_DIAG_D_BRC (_ULCAST_(1) << 22) 710 697 711 698 /* 712 699 * Coprocessor 1 (FPU) register names ··· 1277 1246 1278 1247 #define read_c0_diag() __read_32bit_c0_register($22, 0) 1279 1248 #define write_c0_diag(val) __write_32bit_c0_register($22, 0, val) 1249 + 1250 + /* R10K CP0 Branch Diagnostic register is 64bits wide */ 1251 + #define read_c0_r10k_diag() __read_64bit_c0_register($22, 0) 1252 + #define write_c0_r10k_diag(val) __write_64bit_c0_register($22, 0, val) 1280 1253 1281 1254 #define read_c0_diag1() __read_32bit_c0_register($22, 1) 1282 1255 #define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val)
+1 -1
arch/mips/include/asm/pgtable-32.h
··· 18 18 19 19 #include <asm-generic/pgtable-nopmd.h> 20 20 21 - extern int temp_tlb_entry __cpuinitdata; 21 + extern int temp_tlb_entry; 22 22 23 23 /* 24 24 * - add_temporary_entry() add a temporary TLB entry. We use TLB entries
+1 -1
arch/mips/include/asm/prom.h
··· 11 11 #ifndef __ASM_PROM_H 12 12 #define __ASM_PROM_H 13 13 14 - #ifdef CONFIG_OF 14 + #ifdef CONFIG_USE_OF 15 15 #include <linux/bug.h> 16 16 #include <linux/io.h> 17 17 #include <linux/types.h>
+2 -2
arch/mips/include/asm/spinlock.h
··· 109 109 " subu %[ticket], %[my_ticket], %[ticket] \n" 110 110 "2: \n" 111 111 " .subsection 2 \n" 112 - "4: andi %[ticket], %[ticket], 0x1fff \n" 112 + "4: andi %[ticket], %[ticket], 0xffff \n" 113 113 " sll %[ticket], 5 \n" 114 114 " \n" 115 115 "6: bnez %[ticket], 6b \n" ··· 317 317 318 318 static inline void arch_write_unlock(arch_rwlock_t *rw) 319 319 { 320 - smp_mb(); 320 + smp_mb__before_llsc(); 321 321 322 322 __asm__ __volatile__( 323 323 " # arch_write_unlock \n"
+1 -1
arch/mips/include/asm/txx9irq.h
··· 11 11 12 12 #include <irq.h> 13 13 14 - #ifdef CONFIG_IRQ_CPU 14 + #ifdef CONFIG_IRQ_MIPS_CPU 15 15 #define TXX9_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8) 16 16 #else 17 17 #ifdef CONFIG_I8259
+31 -16
arch/mips/include/asm/uaccess.h
··· 78 78 79 79 #define segment_eq(a, b) ((a).seg == (b).seg) 80 80 81 + /* 82 + * eva_kernel_access() - determine whether kernel memory access on an EVA system 83 + * 84 + * Determines whether memory accesses should be performed to kernel memory 85 + * on a system using Extended Virtual Addressing (EVA). 86 + * 87 + * Return: true if a kernel memory access on an EVA system, else false. 88 + */ 89 + static inline bool eva_kernel_access(void) 90 + { 91 + if (!config_enabled(CONFIG_EVA)) 92 + return false; 93 + 94 + return segment_eq(get_fs(), get_ds()); 95 + } 81 96 82 97 /* 83 98 * Is a address valid? This does a straighforward calculation rather ··· 301 286 ({ \ 302 287 int __gu_err; \ 303 288 \ 304 - if (segment_eq(get_fs(), get_ds())) { \ 289 + if (eva_kernel_access()) { \ 305 290 __get_kernel_common((x), size, ptr); \ 306 291 } else { \ 307 292 __chk_user_ptr(ptr); \ ··· 317 302 \ 318 303 might_fault(); \ 319 304 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) { \ 320 - if (segment_eq(get_fs(), get_ds())) \ 305 + if (eva_kernel_access()) \ 321 306 __get_kernel_common((x), size, __gu_ptr); \ 322 307 else \ 323 308 __get_user_common((x), size, __gu_ptr); \ ··· 442 427 int __pu_err = 0; \ 443 428 \ 444 429 __pu_val = (x); \ 445 - if (segment_eq(get_fs(), get_ds())) { \ 430 + if (eva_kernel_access()) { \ 446 431 __put_kernel_common(ptr, size); \ 447 432 } else { \ 448 433 __chk_user_ptr(ptr); \ ··· 459 444 \ 460 445 might_fault(); \ 461 446 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \ 462 - if (segment_eq(get_fs(), get_ds())) \ 447 + if (eva_kernel_access()) \ 463 448 __put_kernel_common(__pu_addr, size); \ 464 449 else \ 465 450 __put_user_common(__pu_addr, size); \ ··· 858 843 __cu_from = (from); \ 859 844 __cu_len = (n); \ 860 845 might_fault(); \ 861 - if (segment_eq(get_fs(), get_ds())) \ 846 + if (eva_kernel_access()) \ 862 847 __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ 863 848 __cu_len); \ 864 849 else \ ··· 878 863 __cu_to = (to); \ 879 864 __cu_from = (from); \ 880 865 __cu_len = (n); \ 881 - if (segment_eq(get_fs(), get_ds())) \ 866 + if (eva_kernel_access()) \ 882 867 __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ 883 868 __cu_len); \ 884 869 else \ ··· 896 881 __cu_to = (to); \ 897 882 __cu_from = (from); \ 898 883 __cu_len = (n); \ 899 - if (segment_eq(get_fs(), get_ds())) \ 884 + if (eva_kernel_access()) \ 900 885 __cu_len = __invoke_copy_from_kernel_inatomic(__cu_to, \ 901 886 __cu_from,\ 902 887 __cu_len);\ ··· 930 915 __cu_to = (to); \ 931 916 __cu_from = (from); \ 932 917 __cu_len = (n); \ 933 - if (segment_eq(get_fs(), get_ds())) { \ 918 + if (eva_kernel_access()) { \ 934 919 __cu_len = __invoke_copy_to_kernel(__cu_to, \ 935 920 __cu_from, \ 936 921 __cu_len); \ ··· 1154 1139 __cu_to = (to); \ 1155 1140 __cu_from = (from); \ 1156 1141 __cu_len = (n); \ 1157 - if (segment_eq(get_fs(), get_ds())) { \ 1142 + if (eva_kernel_access()) { \ 1158 1143 __cu_len = __invoke_copy_from_kernel(__cu_to, \ 1159 1144 __cu_from, \ 1160 1145 __cu_len); \ ··· 1178 1163 __cu_to = (to); \ 1179 1164 __cu_from = (from); \ 1180 1165 __cu_len = (n); \ 1181 - if (segment_eq(get_fs(), get_ds())) { \ 1166 + if (eva_kernel_access()) { \ 1182 1167 __cu_len = ___invoke_copy_in_kernel(__cu_to, __cu_from, \ 1183 1168 __cu_len); \ 1184 1169 } else { \ ··· 1198 1183 __cu_to = (to); \ 1199 1184 __cu_from = (from); \ 1200 1185 __cu_len = (n); \ 1201 - if (segment_eq(get_fs(), get_ds())) { \ 1186 + if (eva_kernel_access()) { \ 1202 1187 __cu_len = ___invoke_copy_in_kernel(__cu_to,__cu_from, \ 1203 1188 __cu_len); \ 1204 1189 } else { \ ··· 1278 1263 { 1279 1264 long res; 1280 1265 1281 - if (segment_eq(get_fs(), get_ds())) { 1266 + if (eva_kernel_access()) { 1282 1267 __asm__ __volatile__( 1283 1268 "move\t$4, %1\n\t" 1284 1269 "move\t$5, %2\n\t" ··· 1327 1312 { 1328 1313 long res; 1329 1314 1330 - if (segment_eq(get_fs(), get_ds())) { 1315 + if (eva_kernel_access()) { 1331 1316 __asm__ __volatile__( 1332 1317 "move\t$4, %1\n\t" 1333 1318 "move\t$5, %2\n\t" ··· 1372 1357 { 1373 1358 long res; 1374 1359 1375 - if (segment_eq(get_fs(), get_ds())) { 1360 + if (eva_kernel_access()) { 1376 1361 __asm__ __volatile__( 1377 1362 "move\t$4, %1\n\t" 1378 1363 __MODULE_JAL(__strlen_kernel_asm) ··· 1399 1384 { 1400 1385 long res; 1401 1386 1402 - if (segment_eq(get_fs(), get_ds())) { 1387 + if (eva_kernel_access()) { 1403 1388 __asm__ __volatile__( 1404 1389 "move\t$4, %1\n\t" 1405 1390 "move\t$5, %2\n\t" ··· 1441 1426 long res; 1442 1427 1443 1428 might_fault(); 1444 - if (segment_eq(get_fs(), get_ds())) { 1429 + if (eva_kernel_access()) { 1445 1430 __asm__ __volatile__( 1446 1431 "move\t$4, %1\n\t" 1447 1432 "move\t$5, %2\n\t"
+112
arch/mips/include/asm/xtalk/xwidget.h
··· 84 84 #define WIDGET_LLP_MAXBURST 0x000003ff 85 85 #define WIDGET_LLP_MAXBURST_SHFT 0 86 86 87 + /* Xtalk Widget Device Mfgr Nums */ 88 + #define WIDGET_XBOW_MFGR_NUM 0x0 /* IP30 XBow Chip */ 89 + #define WIDGET_XXBOW_MFGR_NUM 0x0 /* IP35 Xbow + XBridge Chip */ 90 + #define WIDGET_ODYS_MFGR_NUM 0x023 /* Odyssey / VPro GFX */ 91 + #define WIDGET_TPU_MFGR_NUM 0x024 /* Tensor Processor Unit */ 92 + #define WIDGET_XBRDG_MFGR_NUM 0x024 /* IP35 XBridge Chip */ 93 + #define WIDGET_HEART_MFGR_NUM 0x036 /* IP30 HEART Chip */ 94 + #define WIDGET_BRIDG_MFGR_NUM 0x036 /* PCI Bridge */ 95 + #define WIDGET_HUB_MFGR_NUM 0x036 /* IP27 Hub Chip */ 96 + #define WIDGET_BDRCK_MFGR_NUM 0x036 /* IP35 Bedrock Chip */ 97 + #define WIDGET_IMPCT_MFGR_NUM 0x2aa /* HQ4 / Impact GFX */ 98 + #define WIDGET_KONA_MFGR_NUM 0x2aa /* InfiniteReality3 / Kona GFX */ 99 + #define WIDGET_NULL_MFGR_NUM -1 /* NULL */ 100 + 101 + /* Xtalk Widget Device Part Nums */ 102 + #define WIDGET_XBOW_PART_NUM 0x0000 103 + #define WIDGET_HEART_PART_NUM 0xc001 104 + #define WIDGET_BRIDG_PART_NUM 0xc002 105 + #define WIDGET_IMPCT_PART_NUM 0xc003 106 + #define WIDGET_ODYS_PART_NUM 0xc013 107 + #define WIDGET_HUB_PART_NUM 0xc101 108 + #define WIDGET_KONA_PART_NUM 0xc102 109 + #define WIDGET_BDRCK_PART_NUM 0xc110 110 + #define WIDGET_TPU_PART_NUM 0xc202 111 + #define WIDGET_XXBOW_PART_NUM 0xd000 112 + #define WIDGET_XBRDG_PART_NUM 0xd002 113 + #define WIDGET_NULL_PART_NUM -1 114 + 115 + /* For Xtalk Widget identification */ 116 + struct widget_ident { 117 + u32 mfgr; 118 + u32 part; 119 + char *name; 120 + char *revs[16]; 121 + }; 122 + 123 + /* Known Xtalk Widgets */ 124 + static const struct widget_ident __initconst widget_idents[] = { 125 + { 126 + WIDGET_XBOW_MFGR_NUM, 127 + WIDGET_XBOW_PART_NUM, 128 + "xbow", 129 + {NULL, "1.0", "1.1", "1.2", "1.3", "2.0", NULL}, 130 + }, 131 + { 132 + WIDGET_HEART_MFGR_NUM, 133 + WIDGET_HEART_PART_NUM, 134 + "heart", 135 + {NULL, "A", "B", "C", "D", "E", "F", NULL}, 136 + }, 137 + { 138 + WIDGET_BRIDG_MFGR_NUM, 139 + WIDGET_BRIDG_PART_NUM, 140 + "bridge", 141 + {NULL, "A", "B", "C", "D", NULL}, 142 + }, 143 + { 144 + WIDGET_IMPCT_MFGR_NUM, 145 + WIDGET_IMPCT_PART_NUM, 146 + "impact", 147 + {NULL, "A", "B", NULL}, 148 + }, 149 + { 150 + WIDGET_ODYS_MFGR_NUM, 151 + WIDGET_ODYS_PART_NUM, 152 + "odyssey", 153 + {NULL, "A", "B", NULL}, 154 + }, 155 + { 156 + WIDGET_HUB_MFGR_NUM, 157 + WIDGET_HUB_PART_NUM, 158 + "hub", 159 + {NULL, "1.0", "2.0", "2.1", "2.2", "2.3", "2.4", NULL}, 160 + }, 161 + { 162 + WIDGET_KONA_MFGR_NUM, 163 + WIDGET_KONA_PART_NUM, 164 + "kona", 165 + {NULL}, 166 + }, 167 + { 168 + WIDGET_BDRCK_MFGR_NUM, 169 + WIDGET_BDRCK_PART_NUM, 170 + "bedrock", 171 + {NULL, "1.0", "1.1", NULL}, 172 + }, 173 + { 174 + WIDGET_TPU_MFGR_NUM, 175 + WIDGET_TPU_PART_NUM, 176 + "tpu", 177 + {"0", NULL}, 178 + }, 179 + { 180 + WIDGET_XXBOW_MFGR_NUM, 181 + WIDGET_XXBOW_PART_NUM, 182 + "xxbow", 183 + {NULL, "1.0", "2.0", NULL}, 184 + }, 185 + { 186 + WIDGET_XBRDG_MFGR_NUM, 187 + WIDGET_XBRDG_PART_NUM, 188 + "xbridge", 189 + {NULL, "A", "B", NULL}, 190 + }, 191 + { 192 + WIDGET_NULL_MFGR_NUM, 193 + WIDGET_NULL_PART_NUM, 194 + NULL, 195 + {NULL}, 196 + } 197 + }; 198 + 87 199 /* 88 200 * according to the crosstalk spec, only 32-bits access to the widget 89 201 * configuration registers is allowed. some widgets may allow 64-bits
+16 -1
arch/mips/jz4740/Kconfig
··· 1 1 choice 2 2 prompt "Machine type" 3 - depends on MACH_JZ4740 3 + depends on MACH_INGENIC 4 4 default JZ4740_QI_LB60 5 5 6 6 config JZ4740_QI_LB60 7 7 bool "Qi Hardware Ben NanoNote" 8 + select MACH_JZ4740 9 + 10 + config JZ4780_CI20 11 + bool "MIPS Creator CI20" 12 + select MACH_JZ4780 8 13 9 14 endchoice 15 + 16 + config MACH_JZ4740 17 + bool 18 + select SYS_HAS_CPU_MIPS32_R1 19 + 20 + config MACH_JZ4780 21 + bool 22 + select MIPS_CPU_SCACHE 23 + select SYS_HAS_CPU_MIPS32_R2 24 + select SYS_SUPPORTS_HIGHMEM
+5 -3
arch/mips/jz4740/Makefile
··· 4 4 5 5 # Object file lists. 6 6 7 - obj-y += prom.o irq.o time.o reset.o setup.o \ 8 - gpio.o clock.o platform.o timer.o serial.o 7 + obj-y += prom.o time.o reset.o setup.o \ 8 + platform.o timer.o 9 9 10 - obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o 10 + obj-$(CONFIG_MACH_JZ4740) += gpio.o 11 + 12 + CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt 11 13 12 14 # board specific support 13 15
+4 -4
arch/mips/jz4740/Platform
··· 1 - platform-$(CONFIG_MACH_JZ4740) += jz4740/ 2 - cflags-$(CONFIG_MACH_JZ4740) += -I$(srctree)/arch/mips/include/asm/mach-jz4740 3 - load-$(CONFIG_MACH_JZ4740) += 0xffffffff80010000 4 - zload-$(CONFIG_MACH_JZ4740) += 0xffffffff80600000 1 + platform-$(CONFIG_MACH_INGENIC) += jz4740/ 2 + cflags-$(CONFIG_MACH_INGENIC) += -I$(srctree)/arch/mips/include/asm/mach-jz4740 3 + load-$(CONFIG_MACH_INGENIC) += 0xffffffff80010000 4 + zload-$(CONFIG_MACH_INGENIC) += 0xffffffff80600000
-7
arch/mips/jz4740/board-qi_lb60.c
··· 482 482 gpiod_add_lookup_table(&qi_lb60_audio_gpio_table); 483 483 gpiod_add_lookup_table(&qi_lb60_nand_gpio_table); 484 484 485 - jz4740_serial_device_register(); 486 - 487 485 spi_register_board_info(qi_lb60_spi_board_info, 488 486 ARRAY_SIZE(qi_lb60_spi_board_info)); 489 487 ··· 494 496 ARRAY_SIZE(jz_platform_devices)); 495 497 496 498 } 497 - 498 - struct jz4740_clock_board_data jz4740_clock_bdata = { 499 - .ext_rate = 12000000, 500 - .rtc_rate = 32768, 501 - }; 502 499 503 500 static __init int board_avt2(char *str) 504 501 {
-108
arch/mips/jz4740/clock-debugfs.c
··· 1 - /* 2 - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 3 - * JZ4740 SoC clock support debugfs entries 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 - * You should have received a copy of the GNU General Public License along 11 - * with this program; if not, write to the Free Software Foundation, Inc., 12 - * 675 Mass Ave, Cambridge, MA 02139, USA. 13 - * 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/module.h> 18 - #include <linux/clk.h> 19 - #include <linux/err.h> 20 - 21 - #include <linux/debugfs.h> 22 - #include <linux/uaccess.h> 23 - 24 - #include <asm/mach-jz4740/clock.h> 25 - #include "clock.h" 26 - 27 - static struct dentry *jz4740_clock_debugfs; 28 - 29 - static int jz4740_clock_debugfs_show_enabled(void *data, uint64_t *value) 30 - { 31 - struct clk *clk = data; 32 - *value = clk_is_enabled(clk); 33 - 34 - return 0; 35 - } 36 - 37 - static int jz4740_clock_debugfs_set_enabled(void *data, uint64_t value) 38 - { 39 - struct clk *clk = data; 40 - 41 - if (value) 42 - return clk_enable(clk); 43 - else 44 - clk_disable(clk); 45 - 46 - return 0; 47 - } 48 - 49 - DEFINE_SIMPLE_ATTRIBUTE(jz4740_clock_debugfs_ops_enabled, 50 - jz4740_clock_debugfs_show_enabled, 51 - jz4740_clock_debugfs_set_enabled, 52 - "%llu\n"); 53 - 54 - static int jz4740_clock_debugfs_show_rate(void *data, uint64_t *value) 55 - { 56 - struct clk *clk = data; 57 - *value = clk_get_rate(clk); 58 - 59 - return 0; 60 - } 61 - 62 - DEFINE_SIMPLE_ATTRIBUTE(jz4740_clock_debugfs_ops_rate, 63 - jz4740_clock_debugfs_show_rate, 64 - NULL, 65 - "%llu\n"); 66 - 67 - void jz4740_clock_debugfs_add_clk(struct clk *clk) 68 - { 69 - if (!jz4740_clock_debugfs) 70 - return; 71 - 72 - clk->debugfs_entry = debugfs_create_dir(clk->name, jz4740_clock_debugfs); 73 - debugfs_create_file("rate", S_IWUGO | S_IRUGO, clk->debugfs_entry, clk, 74 - &jz4740_clock_debugfs_ops_rate); 75 - debugfs_create_file("enabled", S_IRUGO, clk->debugfs_entry, clk, 76 - &jz4740_clock_debugfs_ops_enabled); 77 - 78 - if (clk->parent) { 79 - char parent_path[100]; 80 - snprintf(parent_path, 100, "../%s", clk->parent->name); 81 - clk->debugfs_parent_entry = debugfs_create_symlink("parent", 82 - clk->debugfs_entry, 83 - parent_path); 84 - } 85 - } 86 - 87 - /* TODO: Locking */ 88 - void jz4740_clock_debugfs_update_parent(struct clk *clk) 89 - { 90 - debugfs_remove(clk->debugfs_parent_entry); 91 - 92 - if (clk->parent) { 93 - char parent_path[100]; 94 - snprintf(parent_path, 100, "../%s", clk->parent->name); 95 - clk->debugfs_parent_entry = debugfs_create_symlink("parent", 96 - clk->debugfs_entry, 97 - parent_path); 98 - } else { 99 - clk->debugfs_parent_entry = NULL; 100 - } 101 - } 102 - 103 - void jz4740_clock_debugfs_init(void) 104 - { 105 - jz4740_clock_debugfs = debugfs_create_dir("jz4740-clock", NULL); 106 - if (IS_ERR(jz4740_clock_debugfs)) 107 - jz4740_clock_debugfs = NULL; 108 - }
-924
arch/mips/jz4740/clock.c
··· 1 - /* 2 - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 3 - * JZ4740 SoC clock support 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 - * You should have received a copy of the GNU General Public License along 11 - * with this program; if not, write to the Free Software Foundation, Inc., 12 - * 675 Mass Ave, Cambridge, MA 02139, USA. 13 - * 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/errno.h> 18 - #include <linux/clk.h> 19 - #include <linux/spinlock.h> 20 - #include <linux/io.h> 21 - #include <linux/module.h> 22 - #include <linux/list.h> 23 - #include <linux/err.h> 24 - 25 - #include <asm/mach-jz4740/clock.h> 26 - #include <asm/mach-jz4740/base.h> 27 - 28 - #include "clock.h" 29 - 30 - #define JZ_REG_CLOCK_CTRL 0x00 31 - #define JZ_REG_CLOCK_LOW_POWER 0x04 32 - #define JZ_REG_CLOCK_PLL 0x10 33 - #define JZ_REG_CLOCK_GATE 0x20 34 - #define JZ_REG_CLOCK_SLEEP_CTRL 0x24 35 - #define JZ_REG_CLOCK_I2S 0x60 36 - #define JZ_REG_CLOCK_LCD 0x64 37 - #define JZ_REG_CLOCK_MMC 0x68 38 - #define JZ_REG_CLOCK_UHC 0x6C 39 - #define JZ_REG_CLOCK_SPI 0x74 40 - 41 - #define JZ_CLOCK_CTRL_I2S_SRC_PLL BIT(31) 42 - #define JZ_CLOCK_CTRL_KO_ENABLE BIT(30) 43 - #define JZ_CLOCK_CTRL_UDC_SRC_PLL BIT(29) 44 - #define JZ_CLOCK_CTRL_UDIV_MASK 0x1f800000 45 - #define JZ_CLOCK_CTRL_CHANGE_ENABLE BIT(22) 46 - #define JZ_CLOCK_CTRL_PLL_HALF BIT(21) 47 - #define JZ_CLOCK_CTRL_LDIV_MASK 0x001f0000 48 - #define JZ_CLOCK_CTRL_UDIV_OFFSET 23 49 - #define JZ_CLOCK_CTRL_LDIV_OFFSET 16 50 - #define JZ_CLOCK_CTRL_MDIV_OFFSET 12 51 - #define JZ_CLOCK_CTRL_PDIV_OFFSET 8 52 - #define JZ_CLOCK_CTRL_HDIV_OFFSET 4 53 - #define JZ_CLOCK_CTRL_CDIV_OFFSET 0 54 - 55 - #define JZ_CLOCK_GATE_UART0 BIT(0) 56 - #define JZ_CLOCK_GATE_TCU BIT(1) 57 - #define JZ_CLOCK_GATE_RTC BIT(2) 58 - #define JZ_CLOCK_GATE_I2C BIT(3) 59 - #define JZ_CLOCK_GATE_SPI BIT(4) 60 - #define JZ_CLOCK_GATE_AIC BIT(5) 61 - #define JZ_CLOCK_GATE_I2S BIT(6) 62 - #define JZ_CLOCK_GATE_MMC BIT(7) 63 - #define JZ_CLOCK_GATE_ADC BIT(8) 64 - #define JZ_CLOCK_GATE_CIM BIT(9) 65 - #define JZ_CLOCK_GATE_LCD BIT(10) 66 - #define JZ_CLOCK_GATE_UDC BIT(11) 67 - #define JZ_CLOCK_GATE_DMAC BIT(12) 68 - #define JZ_CLOCK_GATE_IPU BIT(13) 69 - #define JZ_CLOCK_GATE_UHC BIT(14) 70 - #define JZ_CLOCK_GATE_UART1 BIT(15) 71 - 72 - #define JZ_CLOCK_I2S_DIV_MASK 0x01ff 73 - 74 - #define JZ_CLOCK_LCD_DIV_MASK 0x01ff 75 - 76 - #define JZ_CLOCK_MMC_DIV_MASK 0x001f 77 - 78 - #define JZ_CLOCK_UHC_DIV_MASK 0x000f 79 - 80 - #define JZ_CLOCK_SPI_SRC_PLL BIT(31) 81 - #define JZ_CLOCK_SPI_DIV_MASK 0x000f 82 - 83 - #define JZ_CLOCK_PLL_M_MASK 0x01ff 84 - #define JZ_CLOCK_PLL_N_MASK 0x001f 85 - #define JZ_CLOCK_PLL_OD_MASK 0x0003 86 - #define JZ_CLOCK_PLL_STABLE BIT(10) 87 - #define JZ_CLOCK_PLL_BYPASS BIT(9) 88 - #define JZ_CLOCK_PLL_ENABLED BIT(8) 89 - #define JZ_CLOCK_PLL_STABLIZE_MASK 0x000f 90 - #define JZ_CLOCK_PLL_M_OFFSET 23 91 - #define JZ_CLOCK_PLL_N_OFFSET 18 92 - #define JZ_CLOCK_PLL_OD_OFFSET 16 93 - 94 - #define JZ_CLOCK_LOW_POWER_MODE_DOZE BIT(2) 95 - #define JZ_CLOCK_LOW_POWER_MODE_SLEEP BIT(0) 96 - 97 - #define JZ_CLOCK_SLEEP_CTRL_SUSPEND_UHC BIT(7) 98 - #define JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC BIT(6) 99 - 100 - static void __iomem *jz_clock_base; 101 - static spinlock_t jz_clock_lock; 102 - static LIST_HEAD(jz_clocks); 103 - 104 - struct main_clk { 105 - struct clk clk; 106 - uint32_t div_offset; 107 - }; 108 - 109 - struct divided_clk { 110 - struct clk clk; 111 - uint32_t reg; 112 - uint32_t mask; 113 - }; 114 - 115 - struct static_clk { 116 - struct clk clk; 117 - unsigned long rate; 118 - }; 119 - 120 - static uint32_t jz_clk_reg_read(int reg) 121 - { 122 - return readl(jz_clock_base + reg); 123 - } 124 - 125 - static void jz_clk_reg_write_mask(int reg, uint32_t val, uint32_t mask) 126 - { 127 - uint32_t val2; 128 - 129 - spin_lock(&jz_clock_lock); 130 - val2 = readl(jz_clock_base + reg); 131 - val2 &= ~mask; 132 - val2 |= val; 133 - writel(val2, jz_clock_base + reg); 134 - spin_unlock(&jz_clock_lock); 135 - } 136 - 137 - static void jz_clk_reg_set_bits(int reg, uint32_t mask) 138 - { 139 - uint32_t val; 140 - 141 - spin_lock(&jz_clock_lock); 142 - val = readl(jz_clock_base + reg); 143 - val |= mask; 144 - writel(val, jz_clock_base + reg); 145 - spin_unlock(&jz_clock_lock); 146 - } 147 - 148 - static void jz_clk_reg_clear_bits(int reg, uint32_t mask) 149 - { 150 - uint32_t val; 151 - 152 - spin_lock(&jz_clock_lock); 153 - val = readl(jz_clock_base + reg); 154 - val &= ~mask; 155 - writel(val, jz_clock_base + reg); 156 - spin_unlock(&jz_clock_lock); 157 - } 158 - 159 - static int jz_clk_enable_gating(struct clk *clk) 160 - { 161 - if (clk->gate_bit == JZ4740_CLK_NOT_GATED) 162 - return -EINVAL; 163 - 164 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_GATE, clk->gate_bit); 165 - return 0; 166 - } 167 - 168 - static int jz_clk_disable_gating(struct clk *clk) 169 - { 170 - if (clk->gate_bit == JZ4740_CLK_NOT_GATED) 171 - return -EINVAL; 172 - 173 - jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, clk->gate_bit); 174 - return 0; 175 - } 176 - 177 - static int jz_clk_is_enabled_gating(struct clk *clk) 178 - { 179 - if (clk->gate_bit == JZ4740_CLK_NOT_GATED) 180 - return 1; 181 - 182 - return !(jz_clk_reg_read(JZ_REG_CLOCK_GATE) & clk->gate_bit); 183 - } 184 - 185 - static unsigned long jz_clk_static_get_rate(struct clk *clk) 186 - { 187 - return ((struct static_clk *)clk)->rate; 188 - } 189 - 190 - static int jz_clk_ko_enable(struct clk *clk) 191 - { 192 - jz_clk_reg_set_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_KO_ENABLE); 193 - return 0; 194 - } 195 - 196 - static int jz_clk_ko_disable(struct clk *clk) 197 - { 198 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_KO_ENABLE); 199 - return 0; 200 - } 201 - 202 - static int jz_clk_ko_is_enabled(struct clk *clk) 203 - { 204 - return !!(jz_clk_reg_read(JZ_REG_CLOCK_CTRL) & JZ_CLOCK_CTRL_KO_ENABLE); 205 - } 206 - 207 - static const int pllno[] = {1, 2, 2, 4}; 208 - 209 - static unsigned long jz_clk_pll_get_rate(struct clk *clk) 210 - { 211 - uint32_t val; 212 - int m; 213 - int n; 214 - int od; 215 - 216 - val = jz_clk_reg_read(JZ_REG_CLOCK_PLL); 217 - 218 - if (val & JZ_CLOCK_PLL_BYPASS) 219 - return clk_get_rate(clk->parent); 220 - 221 - m = ((val >> 23) & 0x1ff) + 2; 222 - n = ((val >> 18) & 0x1f) + 2; 223 - od = (val >> 16) & 0x3; 224 - 225 - return ((clk_get_rate(clk->parent) / n) * m) / pllno[od]; 226 - } 227 - 228 - static unsigned long jz_clk_pll_half_get_rate(struct clk *clk) 229 - { 230 - uint32_t reg; 231 - 232 - reg = jz_clk_reg_read(JZ_REG_CLOCK_CTRL); 233 - if (reg & JZ_CLOCK_CTRL_PLL_HALF) 234 - return jz_clk_pll_get_rate(clk->parent); 235 - return jz_clk_pll_get_rate(clk->parent) >> 1; 236 - } 237 - 238 - static const int jz_clk_main_divs[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; 239 - 240 - static unsigned long jz_clk_main_round_rate(struct clk *clk, unsigned long rate) 241 - { 242 - unsigned long parent_rate = jz_clk_pll_get_rate(clk->parent); 243 - int div; 244 - 245 - div = parent_rate / rate; 246 - if (div > 32) 247 - return parent_rate / 32; 248 - else if (div < 1) 249 - return parent_rate; 250 - 251 - div &= (0x3 << (ffs(div) - 1)); 252 - 253 - return parent_rate / div; 254 - } 255 - 256 - static unsigned long jz_clk_main_get_rate(struct clk *clk) 257 - { 258 - struct main_clk *mclk = (struct main_clk *)clk; 259 - uint32_t div; 260 - 261 - div = jz_clk_reg_read(JZ_REG_CLOCK_CTRL); 262 - 263 - div >>= mclk->div_offset; 264 - div &= 0xf; 265 - 266 - if (div >= ARRAY_SIZE(jz_clk_main_divs)) 267 - div = ARRAY_SIZE(jz_clk_main_divs) - 1; 268 - 269 - return jz_clk_pll_get_rate(clk->parent) / jz_clk_main_divs[div]; 270 - } 271 - 272 - static int jz_clk_main_set_rate(struct clk *clk, unsigned long rate) 273 - { 274 - struct main_clk *mclk = (struct main_clk *)clk; 275 - int i; 276 - int div; 277 - unsigned long parent_rate = jz_clk_pll_get_rate(clk->parent); 278 - 279 - rate = jz_clk_main_round_rate(clk, rate); 280 - 281 - div = parent_rate / rate; 282 - 283 - i = (ffs(div) - 1) << 1; 284 - if (i > 0 && !(div & BIT(i-1))) 285 - i -= 1; 286 - 287 - jz_clk_reg_write_mask(JZ_REG_CLOCK_CTRL, i << mclk->div_offset, 288 - 0xf << mclk->div_offset); 289 - 290 - return 0; 291 - } 292 - 293 - static struct clk_ops jz_clk_static_ops = { 294 - .get_rate = jz_clk_static_get_rate, 295 - .enable = jz_clk_enable_gating, 296 - .disable = jz_clk_disable_gating, 297 - .is_enabled = jz_clk_is_enabled_gating, 298 - }; 299 - 300 - static struct static_clk jz_clk_ext = { 301 - .clk = { 302 - .name = "ext", 303 - .gate_bit = JZ4740_CLK_NOT_GATED, 304 - .ops = &jz_clk_static_ops, 305 - }, 306 - }; 307 - 308 - static struct clk_ops jz_clk_pll_ops = { 309 - .get_rate = jz_clk_pll_get_rate, 310 - }; 311 - 312 - static struct clk jz_clk_pll = { 313 - .name = "pll", 314 - .parent = &jz_clk_ext.clk, 315 - .ops = &jz_clk_pll_ops, 316 - }; 317 - 318 - static struct clk_ops jz_clk_pll_half_ops = { 319 - .get_rate = jz_clk_pll_half_get_rate, 320 - }; 321 - 322 - static struct clk jz_clk_pll_half = { 323 - .name = "pll half", 324 - .parent = &jz_clk_pll, 325 - .ops = &jz_clk_pll_half_ops, 326 - }; 327 - 328 - static const struct clk_ops jz_clk_main_ops = { 329 - .get_rate = jz_clk_main_get_rate, 330 - .set_rate = jz_clk_main_set_rate, 331 - .round_rate = jz_clk_main_round_rate, 332 - }; 333 - 334 - static struct main_clk jz_clk_cpu = { 335 - .clk = { 336 - .name = "cclk", 337 - .parent = &jz_clk_pll, 338 - .ops = &jz_clk_main_ops, 339 - }, 340 - .div_offset = JZ_CLOCK_CTRL_CDIV_OFFSET, 341 - }; 342 - 343 - static struct main_clk jz_clk_memory = { 344 - .clk = { 345 - .name = "mclk", 346 - .parent = &jz_clk_pll, 347 - .ops = &jz_clk_main_ops, 348 - }, 349 - .div_offset = JZ_CLOCK_CTRL_MDIV_OFFSET, 350 - }; 351 - 352 - static struct main_clk jz_clk_high_speed_peripheral = { 353 - .clk = { 354 - .name = "hclk", 355 - .parent = &jz_clk_pll, 356 - .ops = &jz_clk_main_ops, 357 - }, 358 - .div_offset = JZ_CLOCK_CTRL_HDIV_OFFSET, 359 - }; 360 - 361 - 362 - static struct main_clk jz_clk_low_speed_peripheral = { 363 - .clk = { 364 - .name = "pclk", 365 - .parent = &jz_clk_pll, 366 - .ops = &jz_clk_main_ops, 367 - }, 368 - .div_offset = JZ_CLOCK_CTRL_PDIV_OFFSET, 369 - }; 370 - 371 - static const struct clk_ops jz_clk_ko_ops = { 372 - .enable = jz_clk_ko_enable, 373 - .disable = jz_clk_ko_disable, 374 - .is_enabled = jz_clk_ko_is_enabled, 375 - }; 376 - 377 - static struct clk jz_clk_ko = { 378 - .name = "cko", 379 - .parent = &jz_clk_memory.clk, 380 - .ops = &jz_clk_ko_ops, 381 - }; 382 - 383 - static int jz_clk_spi_set_parent(struct clk *clk, struct clk *parent) 384 - { 385 - if (parent == &jz_clk_pll) 386 - jz_clk_reg_set_bits(JZ_CLOCK_SPI_SRC_PLL, JZ_REG_CLOCK_SPI); 387 - else if (parent == &jz_clk_ext.clk) 388 - jz_clk_reg_clear_bits(JZ_CLOCK_SPI_SRC_PLL, JZ_REG_CLOCK_SPI); 389 - else 390 - return -EINVAL; 391 - 392 - clk->parent = parent; 393 - 394 - return 0; 395 - } 396 - 397 - static int jz_clk_i2s_set_parent(struct clk *clk, struct clk *parent) 398 - { 399 - if (parent == &jz_clk_pll_half) 400 - jz_clk_reg_set_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_I2S_SRC_PLL); 401 - else if (parent == &jz_clk_ext.clk) 402 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_I2S_SRC_PLL); 403 - else 404 - return -EINVAL; 405 - 406 - clk->parent = parent; 407 - 408 - return 0; 409 - } 410 - 411 - static int jz_clk_udc_enable(struct clk *clk) 412 - { 413 - jz_clk_reg_set_bits(JZ_REG_CLOCK_SLEEP_CTRL, 414 - JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC); 415 - 416 - return 0; 417 - } 418 - 419 - static int jz_clk_udc_disable(struct clk *clk) 420 - { 421 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_SLEEP_CTRL, 422 - JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC); 423 - 424 - return 0; 425 - } 426 - 427 - static int jz_clk_udc_is_enabled(struct clk *clk) 428 - { 429 - return !!(jz_clk_reg_read(JZ_REG_CLOCK_SLEEP_CTRL) & 430 - JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC); 431 - } 432 - 433 - static int jz_clk_udc_set_parent(struct clk *clk, struct clk *parent) 434 - { 435 - if (parent == &jz_clk_pll_half) 436 - jz_clk_reg_set_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_UDC_SRC_PLL); 437 - else if (parent == &jz_clk_ext.clk) 438 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_UDC_SRC_PLL); 439 - else 440 - return -EINVAL; 441 - 442 - clk->parent = parent; 443 - 444 - return 0; 445 - } 446 - 447 - static int jz_clk_udc_set_rate(struct clk *clk, unsigned long rate) 448 - { 449 - int div; 450 - 451 - if (clk->parent == &jz_clk_ext.clk) 452 - return -EINVAL; 453 - 454 - div = clk_get_rate(clk->parent) / rate - 1; 455 - 456 - if (div < 0) 457 - div = 0; 458 - else if (div > 63) 459 - div = 63; 460 - 461 - jz_clk_reg_write_mask(JZ_REG_CLOCK_CTRL, div << JZ_CLOCK_CTRL_UDIV_OFFSET, 462 - JZ_CLOCK_CTRL_UDIV_MASK); 463 - return 0; 464 - } 465 - 466 - static unsigned long jz_clk_udc_get_rate(struct clk *clk) 467 - { 468 - int div; 469 - 470 - if (clk->parent == &jz_clk_ext.clk) 471 - return clk_get_rate(clk->parent); 472 - 473 - div = (jz_clk_reg_read(JZ_REG_CLOCK_CTRL) & JZ_CLOCK_CTRL_UDIV_MASK); 474 - div >>= JZ_CLOCK_CTRL_UDIV_OFFSET; 475 - div += 1; 476 - 477 - return clk_get_rate(clk->parent) / div; 478 - } 479 - 480 - static unsigned long jz_clk_divided_get_rate(struct clk *clk) 481 - { 482 - struct divided_clk *dclk = (struct divided_clk *)clk; 483 - int div; 484 - 485 - if (clk->parent == &jz_clk_ext.clk) 486 - return clk_get_rate(clk->parent); 487 - 488 - div = (jz_clk_reg_read(dclk->reg) & dclk->mask) + 1; 489 - 490 - return clk_get_rate(clk->parent) / div; 491 - } 492 - 493 - static int jz_clk_divided_set_rate(struct clk *clk, unsigned long rate) 494 - { 495 - struct divided_clk *dclk = (struct divided_clk *)clk; 496 - int div; 497 - 498 - if (clk->parent == &jz_clk_ext.clk) 499 - return -EINVAL; 500 - 501 - div = clk_get_rate(clk->parent) / rate - 1; 502 - 503 - if (div < 0) 504 - div = 0; 505 - else if (div > dclk->mask) 506 - div = dclk->mask; 507 - 508 - jz_clk_reg_write_mask(dclk->reg, div, dclk->mask); 509 - 510 - return 0; 511 - } 512 - 513 - static unsigned long jz_clk_ldclk_round_rate(struct clk *clk, unsigned long rate) 514 - { 515 - int div; 516 - unsigned long parent_rate = jz_clk_pll_half_get_rate(clk->parent); 517 - 518 - if (rate > 150000000) 519 - return 150000000; 520 - 521 - div = parent_rate / rate; 522 - if (div < 1) 523 - div = 1; 524 - else if (div > 32) 525 - div = 32; 526 - 527 - return parent_rate / div; 528 - } 529 - 530 - static int jz_clk_ldclk_set_rate(struct clk *clk, unsigned long rate) 531 - { 532 - int div; 533 - 534 - if (rate > 150000000) 535 - return -EINVAL; 536 - 537 - div = jz_clk_pll_half_get_rate(clk->parent) / rate - 1; 538 - if (div < 0) 539 - div = 0; 540 - else if (div > 31) 541 - div = 31; 542 - 543 - jz_clk_reg_write_mask(JZ_REG_CLOCK_CTRL, div << JZ_CLOCK_CTRL_LDIV_OFFSET, 544 - JZ_CLOCK_CTRL_LDIV_MASK); 545 - 546 - return 0; 547 - } 548 - 549 - static unsigned long jz_clk_ldclk_get_rate(struct clk *clk) 550 - { 551 - int div; 552 - 553 - div = jz_clk_reg_read(JZ_REG_CLOCK_CTRL) & JZ_CLOCK_CTRL_LDIV_MASK; 554 - div >>= JZ_CLOCK_CTRL_LDIV_OFFSET; 555 - 556 - return jz_clk_pll_half_get_rate(clk->parent) / (div + 1); 557 - } 558 - 559 - static const struct clk_ops jz_clk_ops_ld = { 560 - .set_rate = jz_clk_ldclk_set_rate, 561 - .get_rate = jz_clk_ldclk_get_rate, 562 - .round_rate = jz_clk_ldclk_round_rate, 563 - .enable = jz_clk_enable_gating, 564 - .disable = jz_clk_disable_gating, 565 - .is_enabled = jz_clk_is_enabled_gating, 566 - }; 567 - 568 - static struct clk jz_clk_ld = { 569 - .name = "lcd", 570 - .gate_bit = JZ_CLOCK_GATE_LCD, 571 - .parent = &jz_clk_pll_half, 572 - .ops = &jz_clk_ops_ld, 573 - }; 574 - 575 - static const struct clk_ops jz_clk_i2s_ops = { 576 - .set_rate = jz_clk_divided_set_rate, 577 - .get_rate = jz_clk_divided_get_rate, 578 - .enable = jz_clk_enable_gating, 579 - .disable = jz_clk_disable_gating, 580 - .is_enabled = jz_clk_is_enabled_gating, 581 - .set_parent = jz_clk_i2s_set_parent, 582 - }; 583 - 584 - static const struct clk_ops jz_clk_spi_ops = { 585 - .set_rate = jz_clk_divided_set_rate, 586 - .get_rate = jz_clk_divided_get_rate, 587 - .enable = jz_clk_enable_gating, 588 - .disable = jz_clk_disable_gating, 589 - .is_enabled = jz_clk_is_enabled_gating, 590 - .set_parent = jz_clk_spi_set_parent, 591 - }; 592 - 593 - static const struct clk_ops jz_clk_divided_ops = { 594 - .set_rate = jz_clk_divided_set_rate, 595 - .get_rate = jz_clk_divided_get_rate, 596 - .enable = jz_clk_enable_gating, 597 - .disable = jz_clk_disable_gating, 598 - .is_enabled = jz_clk_is_enabled_gating, 599 - }; 600 - 601 - static struct divided_clk jz4740_clock_divided_clks[] = { 602 - [0] = { 603 - .clk = { 604 - .name = "i2s", 605 - .parent = &jz_clk_ext.clk, 606 - .gate_bit = JZ_CLOCK_GATE_I2S, 607 - .ops = &jz_clk_i2s_ops, 608 - }, 609 - .reg = JZ_REG_CLOCK_I2S, 610 - .mask = JZ_CLOCK_I2S_DIV_MASK, 611 - }, 612 - [1] = { 613 - .clk = { 614 - .name = "spi", 615 - .parent = &jz_clk_ext.clk, 616 - .gate_bit = JZ_CLOCK_GATE_SPI, 617 - .ops = &jz_clk_spi_ops, 618 - }, 619 - .reg = JZ_REG_CLOCK_SPI, 620 - .mask = JZ_CLOCK_SPI_DIV_MASK, 621 - }, 622 - [2] = { 623 - .clk = { 624 - .name = "lcd_pclk", 625 - .parent = &jz_clk_pll_half, 626 - .gate_bit = JZ4740_CLK_NOT_GATED, 627 - .ops = &jz_clk_divided_ops, 628 - }, 629 - .reg = JZ_REG_CLOCK_LCD, 630 - .mask = JZ_CLOCK_LCD_DIV_MASK, 631 - }, 632 - [3] = { 633 - .clk = { 634 - .name = "mmc", 635 - .parent = &jz_clk_pll_half, 636 - .gate_bit = JZ_CLOCK_GATE_MMC, 637 - .ops = &jz_clk_divided_ops, 638 - }, 639 - .reg = JZ_REG_CLOCK_MMC, 640 - .mask = JZ_CLOCK_MMC_DIV_MASK, 641 - }, 642 - [4] = { 643 - .clk = { 644 - .name = "uhc", 645 - .parent = &jz_clk_pll_half, 646 - .gate_bit = JZ_CLOCK_GATE_UHC, 647 - .ops = &jz_clk_divided_ops, 648 - }, 649 - .reg = JZ_REG_CLOCK_UHC, 650 - .mask = JZ_CLOCK_UHC_DIV_MASK, 651 - }, 652 - }; 653 - 654 - static const struct clk_ops jz_clk_udc_ops = { 655 - .set_parent = jz_clk_udc_set_parent, 656 - .set_rate = jz_clk_udc_set_rate, 657 - .get_rate = jz_clk_udc_get_rate, 658 - .enable = jz_clk_udc_enable, 659 - .disable = jz_clk_udc_disable, 660 - .is_enabled = jz_clk_udc_is_enabled, 661 - }; 662 - 663 - static const struct clk_ops jz_clk_simple_ops = { 664 - .enable = jz_clk_enable_gating, 665 - .disable = jz_clk_disable_gating, 666 - .is_enabled = jz_clk_is_enabled_gating, 667 - }; 668 - 669 - static struct clk jz4740_clock_simple_clks[] = { 670 - [0] = { 671 - .name = "udc", 672 - .parent = &jz_clk_ext.clk, 673 - .ops = &jz_clk_udc_ops, 674 - }, 675 - [1] = { 676 - .name = "uart0", 677 - .parent = &jz_clk_ext.clk, 678 - .gate_bit = JZ_CLOCK_GATE_UART0, 679 - .ops = &jz_clk_simple_ops, 680 - }, 681 - [2] = { 682 - .name = "uart1", 683 - .parent = &jz_clk_ext.clk, 684 - .gate_bit = JZ_CLOCK_GATE_UART1, 685 - .ops = &jz_clk_simple_ops, 686 - }, 687 - [3] = { 688 - .name = "dma", 689 - .parent = &jz_clk_high_speed_peripheral.clk, 690 - .gate_bit = JZ_CLOCK_GATE_DMAC, 691 - .ops = &jz_clk_simple_ops, 692 - }, 693 - [4] = { 694 - .name = "ipu", 695 - .parent = &jz_clk_high_speed_peripheral.clk, 696 - .gate_bit = JZ_CLOCK_GATE_IPU, 697 - .ops = &jz_clk_simple_ops, 698 - }, 699 - [5] = { 700 - .name = "adc", 701 - .parent = &jz_clk_ext.clk, 702 - .gate_bit = JZ_CLOCK_GATE_ADC, 703 - .ops = &jz_clk_simple_ops, 704 - }, 705 - [6] = { 706 - .name = "i2c", 707 - .parent = &jz_clk_ext.clk, 708 - .gate_bit = JZ_CLOCK_GATE_I2C, 709 - .ops = &jz_clk_simple_ops, 710 - }, 711 - [7] = { 712 - .name = "aic", 713 - .parent = &jz_clk_ext.clk, 714 - .gate_bit = JZ_CLOCK_GATE_AIC, 715 - .ops = &jz_clk_simple_ops, 716 - }, 717 - }; 718 - 719 - static struct static_clk jz_clk_rtc = { 720 - .clk = { 721 - .name = "rtc", 722 - .gate_bit = JZ_CLOCK_GATE_RTC, 723 - .ops = &jz_clk_static_ops, 724 - }, 725 - .rate = 32768, 726 - }; 727 - 728 - int clk_enable(struct clk *clk) 729 - { 730 - if (!clk->ops->enable) 731 - return -EINVAL; 732 - 733 - return clk->ops->enable(clk); 734 - } 735 - EXPORT_SYMBOL_GPL(clk_enable); 736 - 737 - void clk_disable(struct clk *clk) 738 - { 739 - if (clk->ops->disable) 740 - clk->ops->disable(clk); 741 - } 742 - EXPORT_SYMBOL_GPL(clk_disable); 743 - 744 - int clk_is_enabled(struct clk *clk) 745 - { 746 - if (clk->ops->is_enabled) 747 - return clk->ops->is_enabled(clk); 748 - 749 - return 1; 750 - } 751 - 752 - unsigned long clk_get_rate(struct clk *clk) 753 - { 754 - if (clk->ops->get_rate) 755 - return clk->ops->get_rate(clk); 756 - if (clk->parent) 757 - return clk_get_rate(clk->parent); 758 - 759 - return -EINVAL; 760 - } 761 - EXPORT_SYMBOL_GPL(clk_get_rate); 762 - 763 - int clk_set_rate(struct clk *clk, unsigned long rate) 764 - { 765 - if (!clk->ops->set_rate) 766 - return -EINVAL; 767 - return clk->ops->set_rate(clk, rate); 768 - } 769 - EXPORT_SYMBOL_GPL(clk_set_rate); 770 - 771 - long clk_round_rate(struct clk *clk, unsigned long rate) 772 - { 773 - if (clk->ops->round_rate) 774 - return clk->ops->round_rate(clk, rate); 775 - 776 - return -EINVAL; 777 - } 778 - EXPORT_SYMBOL_GPL(clk_round_rate); 779 - 780 - int clk_set_parent(struct clk *clk, struct clk *parent) 781 - { 782 - int ret; 783 - int enabled; 784 - 785 - if (!clk->ops->set_parent) 786 - return -EINVAL; 787 - 788 - enabled = clk_is_enabled(clk); 789 - if (enabled) 790 - clk_disable(clk); 791 - ret = clk->ops->set_parent(clk, parent); 792 - if (enabled) 793 - clk_enable(clk); 794 - 795 - jz4740_clock_debugfs_update_parent(clk); 796 - 797 - return ret; 798 - } 799 - EXPORT_SYMBOL_GPL(clk_set_parent); 800 - 801 - struct clk *clk_get(struct device *dev, const char *name) 802 - { 803 - struct clk *clk; 804 - 805 - list_for_each_entry(clk, &jz_clocks, list) { 806 - if (strcmp(clk->name, name) == 0) 807 - return clk; 808 - } 809 - return ERR_PTR(-ENXIO); 810 - } 811 - EXPORT_SYMBOL_GPL(clk_get); 812 - 813 - void clk_put(struct clk *clk) 814 - { 815 - } 816 - EXPORT_SYMBOL_GPL(clk_put); 817 - 818 - static inline void clk_add(struct clk *clk) 819 - { 820 - list_add_tail(&clk->list, &jz_clocks); 821 - 822 - jz4740_clock_debugfs_add_clk(clk); 823 - } 824 - 825 - static void clk_register_clks(void) 826 - { 827 - size_t i; 828 - 829 - clk_add(&jz_clk_ext.clk); 830 - clk_add(&jz_clk_pll); 831 - clk_add(&jz_clk_pll_half); 832 - clk_add(&jz_clk_cpu.clk); 833 - clk_add(&jz_clk_high_speed_peripheral.clk); 834 - clk_add(&jz_clk_low_speed_peripheral.clk); 835 - clk_add(&jz_clk_ko); 836 - clk_add(&jz_clk_ld); 837 - clk_add(&jz_clk_rtc.clk); 838 - 839 - for (i = 0; i < ARRAY_SIZE(jz4740_clock_divided_clks); ++i) 840 - clk_add(&jz4740_clock_divided_clks[i].clk); 841 - 842 - for (i = 0; i < ARRAY_SIZE(jz4740_clock_simple_clks); ++i) 843 - clk_add(&jz4740_clock_simple_clks[i]); 844 - } 845 - 846 - void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode) 847 - { 848 - switch (mode) { 849 - case JZ4740_WAIT_MODE_IDLE: 850 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_LOW_POWER, JZ_CLOCK_LOW_POWER_MODE_SLEEP); 851 - break; 852 - case JZ4740_WAIT_MODE_SLEEP: 853 - jz_clk_reg_set_bits(JZ_REG_CLOCK_LOW_POWER, JZ_CLOCK_LOW_POWER_MODE_SLEEP); 854 - break; 855 - } 856 - } 857 - 858 - void jz4740_clock_udc_disable_auto_suspend(void) 859 - { 860 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_GATE, JZ_CLOCK_GATE_UDC); 861 - } 862 - EXPORT_SYMBOL_GPL(jz4740_clock_udc_disable_auto_suspend); 863 - 864 - void jz4740_clock_udc_enable_auto_suspend(void) 865 - { 866 - jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, JZ_CLOCK_GATE_UDC); 867 - } 868 - EXPORT_SYMBOL_GPL(jz4740_clock_udc_enable_auto_suspend); 869 - 870 - void jz4740_clock_suspend(void) 871 - { 872 - jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, 873 - JZ_CLOCK_GATE_TCU | JZ_CLOCK_GATE_DMAC | JZ_CLOCK_GATE_UART0); 874 - 875 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_PLL, JZ_CLOCK_PLL_ENABLED); 876 - } 877 - 878 - void jz4740_clock_resume(void) 879 - { 880 - uint32_t pll; 881 - 882 - jz_clk_reg_set_bits(JZ_REG_CLOCK_PLL, JZ_CLOCK_PLL_ENABLED); 883 - 884 - do { 885 - pll = jz_clk_reg_read(JZ_REG_CLOCK_PLL); 886 - } while (!(pll & JZ_CLOCK_PLL_STABLE)); 887 - 888 - jz_clk_reg_clear_bits(JZ_REG_CLOCK_GATE, 889 - JZ_CLOCK_GATE_TCU | JZ_CLOCK_GATE_DMAC | JZ_CLOCK_GATE_UART0); 890 - } 891 - 892 - static int jz4740_clock_init(void) 893 - { 894 - uint32_t val; 895 - 896 - jz_clock_base = ioremap(JZ4740_CPM_BASE_ADDR, 0x100); 897 - if (!jz_clock_base) 898 - return -EBUSY; 899 - 900 - spin_lock_init(&jz_clock_lock); 901 - 902 - jz_clk_ext.rate = jz4740_clock_bdata.ext_rate; 903 - jz_clk_rtc.rate = jz4740_clock_bdata.rtc_rate; 904 - 905 - val = jz_clk_reg_read(JZ_REG_CLOCK_SPI); 906 - 907 - if (val & JZ_CLOCK_SPI_SRC_PLL) 908 - jz4740_clock_divided_clks[1].clk.parent = &jz_clk_pll_half; 909 - 910 - val = jz_clk_reg_read(JZ_REG_CLOCK_CTRL); 911 - 912 - if (val & JZ_CLOCK_CTRL_I2S_SRC_PLL) 913 - jz4740_clock_divided_clks[0].clk.parent = &jz_clk_pll_half; 914 - 915 - if (val & JZ_CLOCK_CTRL_UDC_SRC_PLL) 916 - jz4740_clock_simple_clks[0].parent = &jz_clk_pll_half; 917 - 918 - jz4740_clock_debugfs_init(); 919 - 920 - clk_register_clks(); 921 - 922 - return 0; 923 - } 924 - arch_initcall(jz4740_clock_init);
-76
arch/mips/jz4740/clock.h
··· 1 - /* 2 - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 3 - * JZ4740 SoC clock support 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 - * You should have received a copy of the GNU General Public License along 11 - * with this program; if not, write to the Free Software Foundation, Inc., 12 - * 675 Mass Ave, Cambridge, MA 02139, USA. 13 - * 14 - */ 15 - 16 - #ifndef __MIPS_JZ4740_CLOCK_H__ 17 - #define __MIPS_JZ4740_CLOCK_H__ 18 - 19 - #include <linux/list.h> 20 - 21 - struct jz4740_clock_board_data { 22 - unsigned long ext_rate; 23 - unsigned long rtc_rate; 24 - }; 25 - 26 - extern struct jz4740_clock_board_data jz4740_clock_bdata; 27 - 28 - void jz4740_clock_suspend(void); 29 - void jz4740_clock_resume(void); 30 - 31 - struct clk; 32 - 33 - struct clk_ops { 34 - unsigned long (*get_rate)(struct clk *clk); 35 - unsigned long (*round_rate)(struct clk *clk, unsigned long rate); 36 - int (*set_rate)(struct clk *clk, unsigned long rate); 37 - int (*enable)(struct clk *clk); 38 - int (*disable)(struct clk *clk); 39 - int (*is_enabled)(struct clk *clk); 40 - 41 - int (*set_parent)(struct clk *clk, struct clk *parent); 42 - 43 - }; 44 - 45 - struct clk { 46 - const char *name; 47 - struct clk *parent; 48 - 49 - uint32_t gate_bit; 50 - 51 - const struct clk_ops *ops; 52 - 53 - struct list_head list; 54 - 55 - #ifdef CONFIG_DEBUG_FS 56 - struct dentry *debugfs_entry; 57 - struct dentry *debugfs_parent_entry; 58 - #endif 59 - 60 - }; 61 - 62 - #define JZ4740_CLK_NOT_GATED ((uint32_t)-1) 63 - 64 - int clk_is_enabled(struct clk *clk); 65 - 66 - #ifdef CONFIG_DEBUG_FS 67 - void jz4740_clock_debugfs_init(void); 68 - void jz4740_clock_debugfs_add_clk(struct clk *clk); 69 - void jz4740_clock_debugfs_update_parent(struct clk *clk); 70 - #else 71 - static inline void jz4740_clock_debugfs_init(void) {}; 72 - static inline void jz4740_clock_debugfs_add_clk(struct clk *clk) {}; 73 - static inline void jz4740_clock_debugfs_update_parent(struct clk *clk) {}; 74 - #endif 75 - 76 - #endif
+3 -4
arch/mips/jz4740/gpio.c
··· 21 21 #include <linux/gpio.h> 22 22 #include <linux/delay.h> 23 23 #include <linux/interrupt.h> 24 + #include <linux/irqchip/ingenic.h> 24 25 #include <linux/bitops.h> 25 26 26 27 #include <linux/debugfs.h> 27 28 #include <linux/seq_file.h> 28 29 29 30 #include <asm/mach-jz4740/base.h> 30 - 31 - #include "irq.h" 32 31 33 32 #define JZ4740_GPIO_BASE_A (32*0) 34 33 #define JZ4740_GPIO_BASE_B (32*1) ··· 441 442 ct->chip.irq_mask = irq_gc_mask_disable_reg; 442 443 ct->chip.irq_unmask = jz_gpio_irq_unmask; 443 444 ct->chip.irq_ack = irq_gc_ack_set_bit; 444 - ct->chip.irq_suspend = jz4740_irq_suspend; 445 - ct->chip.irq_resume = jz4740_irq_resume; 445 + ct->chip.irq_suspend = ingenic_intc_irq_suspend; 446 + ct->chip.irq_resume = ingenic_intc_irq_resume; 446 447 ct->chip.irq_startup = jz_gpio_irq_startup; 447 448 ct->chip.irq_shutdown = jz_gpio_irq_shutdown; 448 449 ct->chip.irq_set_type = jz_gpio_irq_set_type;
-162
arch/mips/jz4740/irq.c
··· 1 - /* 2 - * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> 3 - * JZ4740 platform IRQ support 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 - * You should have received a copy of the GNU General Public License along 11 - * with this program; if not, write to the Free Software Foundation, Inc., 12 - * 675 Mass Ave, Cambridge, MA 02139, USA. 13 - * 14 - */ 15 - 16 - #include <linux/errno.h> 17 - #include <linux/init.h> 18 - #include <linux/types.h> 19 - #include <linux/interrupt.h> 20 - #include <linux/ioport.h> 21 - #include <linux/timex.h> 22 - #include <linux/slab.h> 23 - #include <linux/delay.h> 24 - 25 - #include <linux/debugfs.h> 26 - #include <linux/seq_file.h> 27 - 28 - #include <asm/io.h> 29 - #include <asm/mipsregs.h> 30 - #include <asm/irq_cpu.h> 31 - 32 - #include <asm/mach-jz4740/base.h> 33 - #include <asm/mach-jz4740/irq.h> 34 - 35 - #include "irq.h" 36 - 37 - static void __iomem *jz_intc_base; 38 - 39 - #define JZ_REG_INTC_STATUS 0x00 40 - #define JZ_REG_INTC_MASK 0x04 41 - #define JZ_REG_INTC_SET_MASK 0x08 42 - #define JZ_REG_INTC_CLEAR_MASK 0x0c 43 - #define JZ_REG_INTC_PENDING 0x10 44 - 45 - static irqreturn_t jz4740_cascade(int irq, void *data) 46 - { 47 - uint32_t irq_reg; 48 - 49 - irq_reg = readl(jz_intc_base + JZ_REG_INTC_PENDING); 50 - 51 - if (irq_reg) 52 - generic_handle_irq(__fls(irq_reg) + JZ4740_IRQ_BASE); 53 - 54 - return IRQ_HANDLED; 55 - } 56 - 57 - static void jz4740_irq_set_mask(struct irq_chip_generic *gc, uint32_t mask) 58 - { 59 - struct irq_chip_regs *regs = &gc->chip_types->regs; 60 - 61 - writel(mask, gc->reg_base + regs->enable); 62 - writel(~mask, gc->reg_base + regs->disable); 63 - } 64 - 65 - void jz4740_irq_suspend(struct irq_data *data) 66 - { 67 - struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); 68 - jz4740_irq_set_mask(gc, gc->wake_active); 69 - } 70 - 71 - void jz4740_irq_resume(struct irq_data *data) 72 - { 73 - struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); 74 - jz4740_irq_set_mask(gc, gc->mask_cache); 75 - } 76 - 77 - static struct irqaction jz4740_cascade_action = { 78 - .handler = jz4740_cascade, 79 - .name = "JZ4740 cascade interrupt", 80 - }; 81 - 82 - void __init arch_init_irq(void) 83 - { 84 - struct irq_chip_generic *gc; 85 - struct irq_chip_type *ct; 86 - 87 - mips_cpu_irq_init(); 88 - 89 - jz_intc_base = ioremap(JZ4740_INTC_BASE_ADDR, 0x14); 90 - 91 - /* Mask all irqs */ 92 - writel(0xffffffff, jz_intc_base + JZ_REG_INTC_SET_MASK); 93 - 94 - gc = irq_alloc_generic_chip("INTC", 1, JZ4740_IRQ_BASE, jz_intc_base, 95 - handle_level_irq); 96 - 97 - gc->wake_enabled = IRQ_MSK(32); 98 - 99 - ct = gc->chip_types; 100 - ct->regs.enable = JZ_REG_INTC_CLEAR_MASK; 101 - ct->regs.disable = JZ_REG_INTC_SET_MASK; 102 - ct->chip.irq_unmask = irq_gc_unmask_enable_reg; 103 - ct->chip.irq_mask = irq_gc_mask_disable_reg; 104 - ct->chip.irq_mask_ack = irq_gc_mask_disable_reg; 105 - ct->chip.irq_set_wake = irq_gc_set_wake; 106 - ct->chip.irq_suspend = jz4740_irq_suspend; 107 - ct->chip.irq_resume = jz4740_irq_resume; 108 - 109 - irq_setup_generic_chip(gc, IRQ_MSK(32), 0, 0, IRQ_NOPROBE | IRQ_LEVEL); 110 - 111 - setup_irq(2, &jz4740_cascade_action); 112 - } 113 - 114 - asmlinkage void plat_irq_dispatch(void) 115 - { 116 - unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; 117 - if (pending & STATUSF_IP2) 118 - do_IRQ(2); 119 - else if (pending & STATUSF_IP3) 120 - do_IRQ(3); 121 - else 122 - spurious_interrupt(); 123 - } 124 - 125 - #ifdef CONFIG_DEBUG_FS 126 - 127 - static inline void intc_seq_reg(struct seq_file *s, const char *name, 128 - unsigned int reg) 129 - { 130 - seq_printf(s, "%s:\t\t%08x\n", name, readl(jz_intc_base + reg)); 131 - } 132 - 133 - static int intc_regs_show(struct seq_file *s, void *unused) 134 - { 135 - intc_seq_reg(s, "Status", JZ_REG_INTC_STATUS); 136 - intc_seq_reg(s, "Mask", JZ_REG_INTC_MASK); 137 - intc_seq_reg(s, "Pending", JZ_REG_INTC_PENDING); 138 - 139 - return 0; 140 - } 141 - 142 - static int intc_regs_open(struct inode *inode, struct file *file) 143 - { 144 - return single_open(file, intc_regs_show, NULL); 145 - } 146 - 147 - static const struct file_operations intc_regs_operations = { 148 - .open = intc_regs_open, 149 - .read = seq_read, 150 - .llseek = seq_lseek, 151 - .release = single_release, 152 - }; 153 - 154 - static int __init intc_debugfs_init(void) 155 - { 156 - (void) debugfs_create_file("jz_regs_intc", S_IFREG | S_IRUGO, 157 - NULL, NULL, &intc_regs_operations); 158 - return 0; 159 - } 160 - subsys_initcall(intc_debugfs_init); 161 - 162 - #endif
-23
arch/mips/jz4740/irq.h
··· 1 - /* 2 - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 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 - * You should have received a copy of the GNU General Public License along 10 - * with this program; if not, write to the Free Software Foundation, Inc., 11 - * 675 Mass Ave, Cambridge, MA 02139, USA. 12 - * 13 - */ 14 - 15 - #ifndef __MIPS_JZ4740_IRQ_H__ 16 - #define __MIPS_JZ4740_IRQ_H__ 17 - 18 - #include <linux/irq.h> 19 - 20 - extern void jz4740_irq_suspend(struct irq_data *data); 21 - extern void jz4740_irq_resume(struct irq_data *data); 22 - 23 - #endif
+1 -37
arch/mips/jz4740/platform.c
··· 13 13 * 14 14 */ 15 15 16 + #include <linux/clk.h> 16 17 #include <linux/device.h> 17 18 #include <linux/kernel.h> 18 19 #include <linux/platform_device.h> ··· 30 29 #include <linux/serial_core.h> 31 30 #include <linux/serial_8250.h> 32 31 33 - #include "serial.h" 34 32 #include "clock.h" 35 33 36 34 /* OHCI controller */ ··· 278 278 .num_resources = ARRAY_SIZE(jz4740_adc_resources), 279 279 .resource = jz4740_adc_resources, 280 280 }; 281 - 282 - /* Serial */ 283 - #define JZ4740_UART_DATA(_id) \ 284 - { \ 285 - .flags = UPF_SKIP_TEST | UPF_IOREMAP | UPF_FIXED_TYPE, \ 286 - .iotype = UPIO_MEM, \ 287 - .regshift = 2, \ 288 - .serial_out = jz4740_serial_out, \ 289 - .type = PORT_16550, \ 290 - .mapbase = JZ4740_UART ## _id ## _BASE_ADDR, \ 291 - .irq = JZ4740_IRQ_UART ## _id, \ 292 - } 293 - 294 - static struct plat_serial8250_port jz4740_uart_data[] = { 295 - JZ4740_UART_DATA(0), 296 - JZ4740_UART_DATA(1), 297 - {}, 298 - }; 299 - 300 - static struct platform_device jz4740_uart_device = { 301 - .name = "serial8250", 302 - .id = 0, 303 - .dev = { 304 - .platform_data = jz4740_uart_data, 305 - }, 306 - }; 307 - 308 - void jz4740_serial_device_register(void) 309 - { 310 - struct plat_serial8250_port *p; 311 - 312 - for (p = jz4740_uart_data; p->flags != 0; ++p) 313 - p->uartclk = jz4740_clock_bdata.ext_rate; 314 - 315 - platform_device_register(&jz4740_uart_device); 316 - } 317 281 318 282 /* Watchdog */ 319 283 static struct resource jz4740_wdt_resources[] = {
-2
arch/mips/jz4740/pm.c
··· 20 20 21 21 #include <asm/mach-jz4740/clock.h> 22 22 23 - #include "clock.h" 24 - 25 23 static int jz4740_pm_enter(suspend_state_t state) 26 24 { 27 25 jz4740_clock_suspend();
-13
arch/mips/jz4740/prom.c
··· 53 53 void __init prom_free_prom_memory(void) 54 54 { 55 55 } 56 - 57 - #define UART_REG(_reg) ((void __iomem *)CKSEG1ADDR(JZ4740_UART0_BASE_ADDR + (_reg << 2))) 58 - 59 - void prom_putchar(char c) 60 - { 61 - uint8_t lsr; 62 - 63 - do { 64 - lsr = readb(UART_REG(UART_LSR)); 65 - } while ((lsr & UART_LSR_TEMT) == 0); 66 - 67 - writeb(c, UART_REG(UART_TX)); 68 - }
+11 -2
arch/mips/jz4740/reset.c
··· 12 12 * 13 13 */ 14 14 15 + #include <linux/clk.h> 15 16 #include <linux/io.h> 16 17 #include <linux/kernel.h> 17 18 #include <linux/pm.h> ··· 80 79 void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38); 81 80 unsigned long wakeup_filter_ticks; 82 81 unsigned long reset_counter_ticks; 82 + struct clk *rtc_clk; 83 + unsigned long rtc_rate; 84 + 85 + rtc_clk = clk_get(NULL, "rtc"); 86 + if (IS_ERR(rtc_clk)) 87 + panic("unable to get RTC clock"); 88 + rtc_rate = clk_get_rate(rtc_clk); 89 + clk_put(rtc_clk); 83 90 84 91 /* 85 92 * Set minimum wakeup pin assertion time: 100 ms. 86 93 * Range is 0 to 2 sec if RTC is clocked at 32 kHz. 87 94 */ 88 - wakeup_filter_ticks = (100 * jz4740_clock_bdata.rtc_rate) / 1000; 95 + wakeup_filter_ticks = (100 * rtc_rate) / 1000; 89 96 if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK) 90 97 wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK; 91 98 else ··· 105 96 * Set reset pin low-level assertion time after wakeup: 60 ms. 106 97 * Range is 0 to 125 ms if RTC is clocked at 32 kHz. 107 98 */ 108 - reset_counter_ticks = (60 * jz4740_clock_bdata.rtc_rate) / 1000; 99 + reset_counter_ticks = (60 * rtc_rate) / 1000; 109 100 if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK) 110 101 reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK; 111 102 else
-33
arch/mips/jz4740/serial.c
··· 1 - /* 2 - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 3 - * JZ4740 serial support 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 - * You should have received a copy of the GNU General Public License along 11 - * with this program; if not, write to the Free Software Foundation, Inc., 12 - * 675 Mass Ave, Cambridge, MA 02139, USA. 13 - * 14 - */ 15 - 16 - #include <linux/io.h> 17 - #include <linux/serial_core.h> 18 - #include <linux/serial_reg.h> 19 - 20 - void jz4740_serial_out(struct uart_port *p, int offset, int value) 21 - { 22 - switch (offset) { 23 - case UART_FCR: 24 - value |= 0x10; /* Enable uart module */ 25 - break; 26 - case UART_IER: 27 - value |= (value & 0x4) << 2; 28 - break; 29 - default: 30 - break; 31 - } 32 - writeb(value, p->membase + (offset << p->regshift)); 33 - }
-23
arch/mips/jz4740/serial.h
··· 1 - /* 2 - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 3 - * JZ4740 serial support 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 - * You should have received a copy of the GNU General Public License along 11 - * with this program; if not, write to the Free Software Foundation, Inc., 12 - * 675 Mass Ave, Cambridge, MA 02139, USA. 13 - * 14 - */ 15 - 16 - #ifndef __MIPS_JZ4740_SERIAL_H__ 17 - #define __MIPS_JZ4740_SERIAL_H__ 18 - 19 - struct uart_port; 20 - 21 - void jz4740_serial_out(struct uart_port *p, int offset, int value); 22 - 23 - #endif
+35 -1
arch/mips/jz4740/setup.c
··· 16 16 17 17 #include <linux/init.h> 18 18 #include <linux/io.h> 19 + #include <linux/irqchip.h> 19 20 #include <linux/kernel.h> 21 + #include <linux/libfdt.h> 22 + #include <linux/of_fdt.h> 23 + #include <linux/of_platform.h> 20 24 21 25 #include <asm/bootinfo.h> 26 + #include <asm/prom.h> 22 27 23 28 #include <asm/mach-jz4740/base.h> 24 29 ··· 56 51 57 52 void __init plat_mem_setup(void) 58 53 { 54 + int offset; 55 + 59 56 jz4740_reset_init(); 60 - jz4740_detect_mem(); 57 + __dt_setup_arch(__dtb_start); 58 + 59 + offset = fdt_path_offset(__dtb_start, "/memory"); 60 + if (offset < 0) 61 + jz4740_detect_mem(); 61 62 } 63 + 64 + void __init device_tree_init(void) 65 + { 66 + if (!initial_boot_params) 67 + return; 68 + 69 + unflatten_and_copy_device_tree(); 70 + } 71 + 72 + static int __init populate_machine(void) 73 + { 74 + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 75 + return 0; 76 + } 77 + arch_initcall(populate_machine); 62 78 63 79 const char *get_system_type(void) 64 80 { 81 + if (config_enabled(CONFIG_MACH_JZ4780)) 82 + return "JZ4780"; 83 + 65 84 return "JZ4740"; 85 + } 86 + 87 + void __init arch_init_irq(void) 88 + { 89 + irqchip_init(); 66 90 }
+17 -2
arch/mips/jz4740/time.c
··· 13 13 * 14 14 */ 15 15 16 + #include <linux/clk.h> 17 + #include <linux/clk-provider.h> 16 18 #include <linux/interrupt.h> 17 19 #include <linux/kernel.h> 18 20 #include <linux/time.h> ··· 22 20 #include <linux/clockchips.h> 23 21 #include <linux/sched_clock.h> 24 22 23 + #include <asm/mach-jz4740/clock.h> 25 24 #include <asm/mach-jz4740/irq.h> 26 25 #include <asm/mach-jz4740/timer.h> 27 26 #include <asm/time.h> ··· 102 99 .set_next_event = jz4740_clockevent_set_next, 103 100 .set_mode = jz4740_clockevent_set_mode, 104 101 .rating = 200, 102 + #ifdef CONFIG_MACH_JZ4740 105 103 .irq = JZ4740_IRQ_TCU0, 104 + #endif 105 + #ifdef CONFIG_MACH_JZ4780 106 + .irq = JZ4780_IRQ_TCU2, 107 + #endif 106 108 }; 107 109 108 110 static struct irqaction timer_irqaction = { ··· 122 114 int ret; 123 115 uint32_t clk_rate; 124 116 uint16_t ctrl; 117 + struct clk *ext_clk; 125 118 119 + of_clk_init(NULL); 126 120 jz4740_timer_init(); 127 121 128 - clk_rate = jz4740_clock_bdata.ext_rate >> 4; 122 + ext_clk = clk_get(NULL, "ext"); 123 + if (IS_ERR(ext_clk)) 124 + panic("unable to get ext clock"); 125 + clk_rate = clk_get_rate(ext_clk) >> 4; 126 + clk_put(ext_clk); 127 + 129 128 jz4740_jiffies_per_tick = DIV_ROUND_CLOSEST(clk_rate, HZ); 130 129 131 130 clockevent_set_clock(&jz4740_clockevent, clk_rate); ··· 149 134 150 135 sched_clock_register(jz4740_read_sched_clock, 16, clk_rate); 151 136 152 - setup_irq(JZ4740_IRQ_TCU0, &timer_irqaction); 137 + setup_irq(jz4740_clockevent.irq, &timer_irqaction); 153 138 154 139 ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT; 155 140
+1 -1
arch/mips/kernel/Makefile
··· 62 62 obj-$(CONFIG_MIPS_VPE_APSP_API_MT) += rtlx-mt.o 63 63 64 64 obj-$(CONFIG_I8259) += i8259.o 65 - obj-$(CONFIG_IRQ_CPU) += irq_cpu.o 66 65 obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o 67 66 obj-$(CONFIG_MIPS_MSC) += irq-msc01.o 68 67 obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o ··· 76 77 77 78 obj-$(CONFIG_KGDB) += kgdb.o 78 79 obj-$(CONFIG_PROC_FS) += proc.o 80 + obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o 79 81 80 82 obj-$(CONFIG_64BIT) += cpu-bugs64.o 81 83
+9 -3
arch/mips/kernel/cpu-probe.c
··· 945 945 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 946 946 MIPS_CPU_FPU | MIPS_CPU_32FPR | 947 947 MIPS_CPU_COUNTER | MIPS_CPU_WATCH | 948 - MIPS_CPU_LLSC; 948 + MIPS_CPU_LLSC | MIPS_CPU_BP_GHIST; 949 949 c->tlbsize = 64; 950 950 break; 951 951 case PRID_IMP_R14000: ··· 960 960 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 961 961 MIPS_CPU_FPU | MIPS_CPU_32FPR | 962 962 MIPS_CPU_COUNTER | MIPS_CPU_WATCH | 963 - MIPS_CPU_LLSC; 963 + MIPS_CPU_LLSC | MIPS_CPU_BP_GHIST; 964 964 c->tlbsize = 64; 965 965 break; 966 966 case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */ ··· 1443 1443 case PRID_COMP_CAVIUM: 1444 1444 cpu_probe_cavium(c, cpu); 1445 1445 break; 1446 - case PRID_COMP_INGENIC: 1446 + case PRID_COMP_INGENIC_D0: 1447 + case PRID_COMP_INGENIC_D1: 1448 + case PRID_COMP_INGENIC_E1: 1447 1449 cpu_probe_ingenic(c, cpu); 1448 1450 break; 1449 1451 case PRID_COMP_NETLOGIC: ··· 1479 1477 cpu_set_fpu_opts(c); 1480 1478 else 1481 1479 cpu_set_nofpu_opts(c); 1480 + 1481 + if (cpu_has_bp_ghist) 1482 + write_c0_r10k_diag(read_c0_r10k_diag() | 1483 + R10K_DIAG_E_GHIST); 1482 1484 1483 1485 if (cpu_has_mips_r2_r6) { 1484 1486 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
+16
arch/mips/kernel/head.S
··· 94 94 jr t0 95 95 0: 96 96 97 + #ifdef CONFIG_MIPS_RAW_APPENDED_DTB 98 + PTR_LA t0, __appended_dtb 99 + 100 + #ifdef CONFIG_CPU_BIG_ENDIAN 101 + li t1, 0xd00dfeed 102 + #else 103 + li t1, 0xedfe0dd0 104 + #endif 105 + lw t2, (t0) 106 + bne t1, t2, not_found 107 + nop 108 + 109 + move a1, t0 110 + PTR_LI a0, -2 111 + not_found: 112 + #endif 97 113 PTR_LA t0, __bss_start # clear .bss 98 114 LONG_S zero, (t0) 99 115 PTR_LA t1, __bss_stop - LONGSIZE
+41 -2
arch/mips/kernel/i8259.c
··· 14 14 #include <linux/interrupt.h> 15 15 #include <linux/irqdomain.h> 16 16 #include <linux/kernel.h> 17 + #include <linux/of_irq.h> 17 18 #include <linux/spinlock.h> 18 19 #include <linux/syscore_ops.h> 19 20 #include <linux/irq.h> 20 21 21 22 #include <asm/i8259.h> 22 23 #include <asm/io.h> 24 + 25 + #include "../../drivers/irqchip/irqchip.h" 23 26 24 27 /* 25 28 * This is the 'legacy' 8259A Programmable Interrupt Controller, ··· 330 327 * driver compatibility reasons interrupts 0 - 15 to be the i8259 331 328 * interrupts even if the hardware uses a different interrupt numbering. 332 329 */ 333 - void __init init_i8259_irqs(void) 330 + struct irq_domain * __init __init_i8259_irqs(struct device_node *node) 334 331 { 335 332 struct irq_domain *domain; 336 333 ··· 339 336 340 337 init_8259A(0); 341 338 342 - domain = irq_domain_add_legacy(NULL, 16, I8259A_IRQ_BASE, 0, 339 + domain = irq_domain_add_legacy(node, 16, I8259A_IRQ_BASE, 0, 343 340 &i8259A_ops, NULL); 344 341 if (!domain) 345 342 panic("Failed to add i8259 IRQ domain"); 346 343 347 344 setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2); 345 + return domain; 348 346 } 347 + 348 + void __init init_i8259_irqs(void) 349 + { 350 + __init_i8259_irqs(NULL); 351 + } 352 + 353 + static void i8259_irq_dispatch(unsigned int irq, struct irq_desc *desc) 354 + { 355 + struct irq_domain *domain = irq_get_handler_data(irq); 356 + int hwirq = i8259_irq(); 357 + 358 + if (hwirq < 0) 359 + return; 360 + 361 + irq = irq_linear_revmap(domain, hwirq); 362 + generic_handle_irq(irq); 363 + } 364 + 365 + int __init i8259_of_init(struct device_node *node, struct device_node *parent) 366 + { 367 + struct irq_domain *domain; 368 + unsigned int parent_irq; 369 + 370 + parent_irq = irq_of_parse_and_map(node, 0); 371 + if (!parent_irq) { 372 + pr_err("Failed to map i8259 parent IRQ\n"); 373 + return -ENODEV; 374 + } 375 + 376 + domain = __init_i8259_irqs(node); 377 + irq_set_handler_data(parent_irq, domain); 378 + irq_set_chained_handler(parent_irq, i8259_irq_dispatch); 379 + return 0; 380 + } 381 + IRQCHIP_DECLARE(i8259, "intel,i8259", i8259_of_init);
-52
arch/mips/kernel/irq.c
··· 25 25 #include <linux/atomic.h> 26 26 #include <asm/uaccess.h> 27 27 28 - #ifdef CONFIG_KGDB 29 - int kgdb_early_setup; 30 - #endif 31 - 32 - static DECLARE_BITMAP(irq_map, NR_IRQS); 33 - 34 - int allocate_irqno(void) 35 - { 36 - int irq; 37 - 38 - again: 39 - irq = find_first_zero_bit(irq_map, NR_IRQS); 40 - 41 - if (irq >= NR_IRQS) 42 - return -ENOSPC; 43 - 44 - if (test_and_set_bit(irq, irq_map)) 45 - goto again; 46 - 47 - return irq; 48 - } 49 - 50 - /* 51 - * Allocate the 16 legacy interrupts for i8259 devices. This happens early 52 - * in the kernel initialization so treating allocation failure as BUG() is 53 - * ok. 54 - */ 55 - void __init alloc_legacy_irqno(void) 56 - { 57 - int i; 58 - 59 - for (i = 0; i <= 16; i++) 60 - BUG_ON(test_and_set_bit(i, irq_map)); 61 - } 62 - 63 - void free_irqno(unsigned int irq) 64 - { 65 - smp_mb__before_atomic(); 66 - clear_bit(irq, irq_map); 67 - smp_mb__after_atomic(); 68 - } 69 - 70 28 /* 71 29 * 'what should we do if we get a hw irq event on an illegal vector'. 72 30 * each architecture has to answer this themselves. ··· 51 93 { 52 94 int i; 53 95 54 - #ifdef CONFIG_KGDB 55 - if (kgdb_early_setup) 56 - return; 57 - #endif 58 - 59 96 for (i = 0; i < NR_IRQS; i++) 60 97 irq_set_noprobe(i); 61 98 62 99 arch_init_irq(); 63 - 64 - #ifdef CONFIG_KGDB 65 - if (!kgdb_early_setup) 66 - kgdb_early_setup = 1; 67 - #endif 68 100 } 69 101 70 102 #ifdef CONFIG_DEBUG_STACKOVERFLOW
-169
arch/mips/kernel/irq_cpu.c
··· 1 - /* 2 - * Copyright 2001 MontaVista Software Inc. 3 - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 4 - * 5 - * Copyright (C) 2001 Ralf Baechle 6 - * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 7 - * Author: Maciej W. Rozycki <macro@mips.com> 8 - * 9 - * This file define the irq handler for MIPS CPU interrupts. 10 - * 11 - * This program is free software; you can redistribute it and/or modify it 12 - * under the terms of the GNU General Public License as published by the 13 - * Free Software Foundation; either version 2 of the License, or (at your 14 - * option) any later version. 15 - */ 16 - 17 - /* 18 - * Almost all MIPS CPUs define 8 interrupt sources. They are typically 19 - * level triggered (i.e., cannot be cleared from CPU; must be cleared from 20 - * device). The first two are software interrupts which we don't really 21 - * use or support. The last one is usually the CPU timer interrupt if 22 - * counter register is present or, for CPUs with an external FPU, by 23 - * convention it's the FPU exception interrupt. 24 - * 25 - * Don't even think about using this on SMP. You have been warned. 26 - * 27 - * This file exports one global function: 28 - * void mips_cpu_irq_init(void); 29 - */ 30 - #include <linux/init.h> 31 - #include <linux/interrupt.h> 32 - #include <linux/kernel.h> 33 - #include <linux/irq.h> 34 - #include <linux/irqdomain.h> 35 - 36 - #include <asm/irq_cpu.h> 37 - #include <asm/mipsregs.h> 38 - #include <asm/mipsmtregs.h> 39 - #include <asm/setup.h> 40 - 41 - static inline void unmask_mips_irq(struct irq_data *d) 42 - { 43 - set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 44 - irq_enable_hazard(); 45 - } 46 - 47 - static inline void mask_mips_irq(struct irq_data *d) 48 - { 49 - clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 50 - irq_disable_hazard(); 51 - } 52 - 53 - static struct irq_chip mips_cpu_irq_controller = { 54 - .name = "MIPS", 55 - .irq_ack = mask_mips_irq, 56 - .irq_mask = mask_mips_irq, 57 - .irq_mask_ack = mask_mips_irq, 58 - .irq_unmask = unmask_mips_irq, 59 - .irq_eoi = unmask_mips_irq, 60 - .irq_disable = mask_mips_irq, 61 - .irq_enable = unmask_mips_irq, 62 - }; 63 - 64 - /* 65 - * Basically the same as above but taking care of all the MT stuff 66 - */ 67 - 68 - static unsigned int mips_mt_cpu_irq_startup(struct irq_data *d) 69 - { 70 - unsigned int vpflags = dvpe(); 71 - 72 - clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 73 - evpe(vpflags); 74 - unmask_mips_irq(d); 75 - return 0; 76 - } 77 - 78 - /* 79 - * While we ack the interrupt interrupts are disabled and thus we don't need 80 - * to deal with concurrency issues. Same for mips_cpu_irq_end. 81 - */ 82 - static void mips_mt_cpu_irq_ack(struct irq_data *d) 83 - { 84 - unsigned int vpflags = dvpe(); 85 - clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 86 - evpe(vpflags); 87 - mask_mips_irq(d); 88 - } 89 - 90 - static struct irq_chip mips_mt_cpu_irq_controller = { 91 - .name = "MIPS", 92 - .irq_startup = mips_mt_cpu_irq_startup, 93 - .irq_ack = mips_mt_cpu_irq_ack, 94 - .irq_mask = mask_mips_irq, 95 - .irq_mask_ack = mips_mt_cpu_irq_ack, 96 - .irq_unmask = unmask_mips_irq, 97 - .irq_eoi = unmask_mips_irq, 98 - .irq_disable = mask_mips_irq, 99 - .irq_enable = unmask_mips_irq, 100 - }; 101 - 102 - asmlinkage void __weak plat_irq_dispatch(void) 103 - { 104 - unsigned long pending = read_c0_cause() & read_c0_status() & ST0_IM; 105 - int irq; 106 - 107 - if (!pending) { 108 - spurious_interrupt(); 109 - return; 110 - } 111 - 112 - pending >>= CAUSEB_IP; 113 - while (pending) { 114 - irq = fls(pending) - 1; 115 - do_IRQ(MIPS_CPU_IRQ_BASE + irq); 116 - pending &= ~BIT(irq); 117 - } 118 - } 119 - 120 - static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq, 121 - irq_hw_number_t hw) 122 - { 123 - static struct irq_chip *chip; 124 - 125 - if (hw < 2 && cpu_has_mipsmt) { 126 - /* Software interrupts are used for MT/CMT IPI */ 127 - chip = &mips_mt_cpu_irq_controller; 128 - } else { 129 - chip = &mips_cpu_irq_controller; 130 - } 131 - 132 - if (cpu_has_vint) 133 - set_vi_handler(hw, plat_irq_dispatch); 134 - 135 - irq_set_chip_and_handler(irq, chip, handle_percpu_irq); 136 - 137 - return 0; 138 - } 139 - 140 - static const struct irq_domain_ops mips_cpu_intc_irq_domain_ops = { 141 - .map = mips_cpu_intc_map, 142 - .xlate = irq_domain_xlate_onecell, 143 - }; 144 - 145 - static void __init __mips_cpu_irq_init(struct device_node *of_node) 146 - { 147 - struct irq_domain *domain; 148 - 149 - /* Mask interrupts. */ 150 - clear_c0_status(ST0_IM); 151 - clear_c0_cause(CAUSEF_IP); 152 - 153 - domain = irq_domain_add_legacy(of_node, 8, MIPS_CPU_IRQ_BASE, 0, 154 - &mips_cpu_intc_irq_domain_ops, NULL); 155 - if (!domain) 156 - panic("Failed to add irqdomain for MIPS CPU"); 157 - } 158 - 159 - void __init mips_cpu_irq_init(void) 160 - { 161 - __mips_cpu_irq_init(NULL); 162 - } 163 - 164 - int __init mips_cpu_irq_of_init(struct device_node *of_node, 165 - struct device_node *parent) 166 - { 167 - __mips_cpu_irq_init(of_node); 168 - return 0; 169 - }
-4
arch/mips/kernel/kgdb.c
··· 378 378 379 379 struct kgdb_arch arch_kgdb_ops; 380 380 381 - /* 382 - * We use kgdb_early_setup so that functions we need to call now don't 383 - * cause trouble when called again later. 384 - */ 385 381 int kgdb_arch_init(void) 386 382 { 387 383 union mips_instruction insn = {
+1
arch/mips/kernel/prom.c
··· 18 18 #include <linux/of_fdt.h> 19 19 #include <linux/of_platform.h> 20 20 21 + #include <asm/bootinfo.h> 21 22 #include <asm/page.h> 22 23 #include <asm/prom.h> 23 24
+77
arch/mips/kernel/sysrq.c
··· 1 + /* 2 + * MIPS specific sysrq operations. 3 + * 4 + * Copyright (C) 2015 Imagination Technologies Ltd. 5 + */ 6 + #include <linux/init.h> 7 + #include <linux/smp.h> 8 + #include <linux/spinlock.h> 9 + #include <linux/sysrq.h> 10 + #include <linux/workqueue.h> 11 + 12 + #include <asm/cpu-features.h> 13 + #include <asm/mipsregs.h> 14 + #include <asm/tlbdebug.h> 15 + 16 + /* 17 + * Dump TLB entries on all CPUs. 18 + */ 19 + 20 + static DEFINE_SPINLOCK(show_lock); 21 + 22 + static void sysrq_tlbdump_single(void *dummy) 23 + { 24 + const int field = 2 * sizeof(unsigned long); 25 + unsigned long flags; 26 + 27 + spin_lock_irqsave(&show_lock, flags); 28 + 29 + pr_info("CPU%d:\n", smp_processor_id()); 30 + pr_info("Index : %0x\n", read_c0_index()); 31 + pr_info("Pagemask: %0x\n", read_c0_pagemask()); 32 + pr_info("EntryHi : %0*lx\n", field, read_c0_entryhi()); 33 + pr_info("EntryLo0: %0*lx\n", field, read_c0_entrylo0()); 34 + pr_info("EntryLo1: %0*lx\n", field, read_c0_entrylo1()); 35 + pr_info("Wired : %0x\n", read_c0_wired()); 36 + pr_info("Pagegrain: %0x\n", read_c0_pagegrain()); 37 + if (cpu_has_htw) { 38 + pr_info("PWField : %0*lx\n", field, read_c0_pwfield()); 39 + pr_info("PWSize : %0*lx\n", field, read_c0_pwsize()); 40 + pr_info("PWCtl : %0x\n", read_c0_pwctl()); 41 + } 42 + pr_info("\n"); 43 + dump_tlb_all(); 44 + pr_info("\n"); 45 + 46 + spin_unlock_irqrestore(&show_lock, flags); 47 + } 48 + 49 + #ifdef CONFIG_SMP 50 + static void sysrq_tlbdump_othercpus(struct work_struct *dummy) 51 + { 52 + smp_call_function(sysrq_tlbdump_single, NULL, 0); 53 + } 54 + 55 + static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus); 56 + #endif 57 + 58 + static void sysrq_handle_tlbdump(int key) 59 + { 60 + sysrq_tlbdump_single(NULL); 61 + #ifdef CONFIG_SMP 62 + schedule_work(&sysrq_tlbdump); 63 + #endif 64 + } 65 + 66 + static struct sysrq_key_op sysrq_tlbdump_op = { 67 + .handler = sysrq_handle_tlbdump, 68 + .help_msg = "show-tlbs(x)", 69 + .action_msg = "Show TLB entries", 70 + .enable_mask = SYSRQ_ENABLE_DUMP, 71 + }; 72 + 73 + static int __init mips_sysrq_init(void) 74 + { 75 + return register_sysrq_key('x', &sysrq_tlbdump_op); 76 + } 77 + arch_initcall(mips_sysrq_init);
+4 -8
arch/mips/kernel/traps.c
··· 236 236 { 237 237 const int field = 2 * sizeof(unsigned long); 238 238 unsigned int cause = regs->cp0_cause; 239 + unsigned int exccode; 239 240 int i; 240 241 241 242 show_regs_print_info(KERN_DEFAULT); ··· 318 317 } 319 318 printk("\n"); 320 319 321 - printk("Cause : %08x\n", cause); 320 + exccode = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE; 321 + printk("Cause : %08x (ExcCode %02x)\n", cause, exccode); 322 322 323 - cause = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE; 324 - if (1 <= cause && cause <= 5) 323 + if (1 <= exccode && exccode <= 5) 325 324 printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr); 326 325 327 326 printk("PrId : %08x (%s)\n", read_c0_prid(), ··· 2184 2183 unsigned long i; 2185 2184 2186 2185 check_wait(); 2187 - 2188 - #if defined(CONFIG_KGDB) 2189 - if (kgdb_early_setup) 2190 - return; /* Already done */ 2191 - #endif 2192 2186 2193 2187 if (cpu_has_veic || cpu_has_vint) { 2194 2188 unsigned long size = 0x200 + VECTORSPACING*64;
+7 -1
arch/mips/kernel/vmlinux.lds.S
··· 125 125 .exit.data : { 126 126 EXIT_DATA 127 127 } 128 - 128 + #ifdef CONFIG_SMP 129 129 PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 130 + #endif 131 + #ifdef CONFIG_MIPS_RAW_APPENDED_DTB 132 + __appended_dtb = .; 133 + /* leave space for appended DTB */ 134 + . += 0x100000; 135 + #endif 130 136 /* 131 137 * Align to 64K in attempt to eliminate holes before the 132 138 * .bss..swapper_pg_dir section at the start of .bss. This
+71 -39
arch/mips/lib/dump_tlb.c
··· 7 7 #include <linux/kernel.h> 8 8 #include <linux/mm.h> 9 9 10 + #include <asm/hazards.h> 10 11 #include <asm/mipsregs.h> 11 12 #include <asm/page.h> 12 13 #include <asm/pgtable.h> ··· 41 40 return ""; 42 41 } 43 42 44 - #define BARRIER() \ 45 - __asm__ __volatile__( \ 46 - ".set\tnoreorder\n\t" \ 47 - "nop;nop;nop;nop;nop;nop;nop\n\t" \ 48 - ".set\treorder"); 49 - 50 43 static void dump_tlb(int first, int last) 51 44 { 52 45 unsigned long s_entryhi, entryhi, asid; 53 - unsigned long long entrylo0, entrylo1; 46 + unsigned long long entrylo0, entrylo1, pa; 54 47 unsigned int s_index, s_pagemask, pagemask, c0, c1, i; 48 + #ifdef CONFIG_32BIT 49 + bool xpa = cpu_has_xpa && (read_c0_pagegrain() & PG_ELPA); 50 + int pwidth = xpa ? 11 : 8; 51 + int vwidth = 8; 52 + #else 53 + bool xpa = false; 54 + int pwidth = 11; 55 + int vwidth = 11; 56 + #endif 55 57 56 58 s_pagemask = read_c0_pagemask(); 57 59 s_entryhi = read_c0_entryhi(); ··· 63 59 64 60 for (i = first; i <= last; i++) { 65 61 write_c0_index(i); 66 - BARRIER(); 62 + mtc0_tlbr_hazard(); 67 63 tlb_read(); 68 - BARRIER(); 64 + tlb_read_hazard(); 69 65 pagemask = read_c0_pagemask(); 70 66 entryhi = read_c0_entryhi(); 71 67 entrylo0 = read_c0_entrylo0(); 72 68 entrylo1 = read_c0_entrylo1(); 73 69 74 - /* Unused entries have a virtual address of CKSEG0. */ 75 - if ((entryhi & ~0x1ffffUL) != CKSEG0 76 - && (entryhi & 0xff) == asid) { 77 - #ifdef CONFIG_32BIT 78 - int width = 8; 79 - #else 80 - int width = 11; 81 - #endif 82 - /* 83 - * Only print entries in use 84 - */ 85 - printk("Index: %2d pgmask=%s ", i, msk2str(pagemask)); 70 + /* EHINV bit marks entire entry as invalid */ 71 + if (cpu_has_tlbinv && entryhi & MIPS_ENTRYHI_EHINV) 72 + continue; 73 + /* 74 + * Prior to tlbinv, unused entries have a virtual address of 75 + * CKSEG0. 76 + */ 77 + if ((entryhi & ~0x1ffffUL) == CKSEG0) 78 + continue; 79 + /* 80 + * ASID takes effect in absence of G (global) bit. 81 + * We check both G bits, even though architecturally they should 82 + * match one another, because some revisions of the SB1 core may 83 + * leave only a single G bit set after a machine check exception 84 + * due to duplicate TLB entry. 85 + */ 86 + if (!((entrylo0 | entrylo1) & MIPS_ENTRYLO_G) && 87 + (entryhi & 0xff) != asid) 88 + continue; 86 89 87 - c0 = (entrylo0 >> 3) & 7; 88 - c1 = (entrylo1 >> 3) & 7; 90 + /* 91 + * Only print entries in use 92 + */ 93 + printk("Index: %2d pgmask=%s ", i, msk2str(pagemask)); 89 94 90 - printk("va=%0*lx asid=%02lx\n", 91 - width, (entryhi & ~0x1fffUL), 92 - entryhi & 0xff); 93 - printk("\t[pa=%0*llx c=%d d=%d v=%d g=%d] ", 94 - width, 95 - (entrylo0 << 6) & PAGE_MASK, c0, 96 - (entrylo0 & 4) ? 1 : 0, 97 - (entrylo0 & 2) ? 1 : 0, 98 - (entrylo0 & 1) ? 1 : 0); 99 - printk("[pa=%0*llx c=%d d=%d v=%d g=%d]\n", 100 - width, 101 - (entrylo1 << 6) & PAGE_MASK, c1, 102 - (entrylo1 & 4) ? 1 : 0, 103 - (entrylo1 & 2) ? 1 : 0, 104 - (entrylo1 & 1) ? 1 : 0); 105 - } 95 + c0 = (entrylo0 & MIPS_ENTRYLO_C) >> MIPS_ENTRYLO_C_SHIFT; 96 + c1 = (entrylo1 & MIPS_ENTRYLO_C) >> MIPS_ENTRYLO_C_SHIFT; 97 + 98 + printk("va=%0*lx asid=%02lx\n", 99 + vwidth, (entryhi & ~0x1fffUL), 100 + entryhi & 0xff); 101 + /* RI/XI are in awkward places, so mask them off separately */ 102 + pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); 103 + if (xpa) 104 + pa |= (unsigned long long)readx_c0_entrylo0() << 30; 105 + pa = (pa << 6) & PAGE_MASK; 106 + printk("\t["); 107 + if (cpu_has_rixi) 108 + printk("ri=%d xi=%d ", 109 + (entrylo0 & MIPS_ENTRYLO_RI) ? 1 : 0, 110 + (entrylo0 & MIPS_ENTRYLO_XI) ? 1 : 0); 111 + printk("pa=%0*llx c=%d d=%d v=%d g=%d] [", 112 + pwidth, pa, c0, 113 + (entrylo0 & MIPS_ENTRYLO_D) ? 1 : 0, 114 + (entrylo0 & MIPS_ENTRYLO_V) ? 1 : 0, 115 + (entrylo0 & MIPS_ENTRYLO_G) ? 1 : 0); 116 + /* RI/XI are in awkward places, so mask them off separately */ 117 + pa = entrylo1 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); 118 + if (xpa) 119 + pa |= (unsigned long long)readx_c0_entrylo1() << 30; 120 + pa = (pa << 6) & PAGE_MASK; 121 + if (cpu_has_rixi) 122 + printk("ri=%d xi=%d ", 123 + (entrylo1 & MIPS_ENTRYLO_RI) ? 1 : 0, 124 + (entrylo1 & MIPS_ENTRYLO_XI) ? 1 : 0); 125 + printk("pa=%0*llx c=%d d=%d v=%d g=%d]\n", 126 + pwidth, pa, c1, 127 + (entrylo1 & MIPS_ENTRYLO_D) ? 1 : 0, 128 + (entrylo1 & MIPS_ENTRYLO_V) ? 1 : 0, 129 + (entrylo1 & MIPS_ENTRYLO_G) ? 1 : 0); 106 130 } 107 131 printk("\n"); 108 132
+7 -8
arch/mips/lib/r3k_dump_tlb.c
··· 14 14 #include <asm/pgtable.h> 15 15 #include <asm/tlbdebug.h> 16 16 17 - extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */ 18 - 19 17 static void dump_tlb(int first, int last) 20 18 { 21 19 int i; ··· 33 35 entrylo0 = read_c0_entrylo0(); 34 36 35 37 /* Unused entries have a virtual address of KSEG0. */ 36 - if ((entryhi & PAGE_MASK) != KSEG0 37 - && (entryhi & ASID_MASK) == asid) { 38 + if ((entryhi & PAGE_MASK) != KSEG0 && 39 + (entrylo0 & R3K_ENTRYLO_G || 40 + (entryhi & ASID_MASK) == asid)) { 38 41 /* 39 42 * Only print entries in use 40 43 */ ··· 46 47 entryhi & PAGE_MASK, 47 48 entryhi & ASID_MASK, 48 49 entrylo0 & PAGE_MASK, 49 - (entrylo0 & (1 << 11)) ? 1 : 0, 50 - (entrylo0 & (1 << 10)) ? 1 : 0, 51 - (entrylo0 & (1 << 9)) ? 1 : 0, 52 - (entrylo0 & (1 << 8)) ? 1 : 0); 50 + (entrylo0 & R3K_ENTRYLO_N) ? 1 : 0, 51 + (entrylo0 & R3K_ENTRYLO_D) ? 1 : 0, 52 + (entrylo0 & R3K_ENTRYLO_V) ? 1 : 0, 53 + (entrylo0 & R3K_ENTRYLO_G) ? 1 : 0); 53 54 } 54 55 } 55 56 printk("\n");
-158
arch/mips/loongson/Kconfig
··· 1 - if MACH_LOONGSON 2 - 3 - choice 4 - prompt "Machine Type" 5 - 6 - config LEMOTE_FULOONG2E 7 - bool "Lemote Fuloong(2e) mini-PC" 8 - select ARCH_SPARSEMEM_ENABLE 9 - select CEVT_R4K 10 - select CSRC_R4K 11 - select SYS_HAS_CPU_LOONGSON2E 12 - select DMA_NONCOHERENT 13 - select BOOT_ELF32 14 - select BOARD_SCACHE 15 - select HW_HAS_PCI 16 - select I8259 17 - select ISA 18 - select IRQ_CPU 19 - select SYS_SUPPORTS_32BIT_KERNEL 20 - select SYS_SUPPORTS_64BIT_KERNEL 21 - select SYS_SUPPORTS_LITTLE_ENDIAN 22 - select SYS_SUPPORTS_HIGHMEM 23 - select SYS_HAS_EARLY_PRINTK 24 - select GENERIC_ISA_DMA_SUPPORT_BROKEN 25 - select CPU_HAS_WB 26 - select LOONGSON_MC146818 27 - help 28 - Lemote Fuloong(2e) mini-PC board based on the Chinese Loongson-2E CPU and 29 - an FPGA northbridge 30 - 31 - Lemote Fuloong(2e) mini PC have a VIA686B south bridge. 32 - 33 - config LEMOTE_MACH2F 34 - bool "Lemote Loongson 2F family machines" 35 - select ARCH_SPARSEMEM_ENABLE 36 - select BOARD_SCACHE 37 - select BOOT_ELF32 38 - select CEVT_R4K if ! MIPS_EXTERNAL_TIMER 39 - select CPU_HAS_WB 40 - select CS5536 41 - select CSRC_R4K if ! MIPS_EXTERNAL_TIMER 42 - select DMA_NONCOHERENT 43 - select GENERIC_ISA_DMA_SUPPORT_BROKEN 44 - select HAVE_CLK 45 - select HW_HAS_PCI 46 - select I8259 47 - select IRQ_CPU 48 - select ISA 49 - select SYS_HAS_CPU_LOONGSON2F 50 - select SYS_HAS_EARLY_PRINTK 51 - select SYS_SUPPORTS_32BIT_KERNEL 52 - select SYS_SUPPORTS_64BIT_KERNEL 53 - select SYS_SUPPORTS_HIGHMEM 54 - select SYS_SUPPORTS_LITTLE_ENDIAN 55 - select LOONGSON_MC146818 56 - help 57 - Lemote Loongson 2F family machines utilize the 2F revision of 58 - Loongson processor and the AMD CS5536 south bridge. 59 - 60 - These family machines include fuloong2f mini PC, yeeloong2f notebook, 61 - LingLoong allinone PC and so forth. 62 - 63 - config LOONGSON_MACH3X 64 - bool "Generic Loongson 3 family machines" 65 - select ARCH_SPARSEMEM_ENABLE 66 - select GENERIC_ISA_DMA_SUPPORT_BROKEN 67 - select BOOT_ELF32 68 - select BOARD_SCACHE 69 - select CSRC_R4K 70 - select CEVT_R4K 71 - select CPU_HAS_WB 72 - select HW_HAS_PCI 73 - select ISA 74 - select HT_PCI 75 - select I8259 76 - select IRQ_CPU 77 - select NR_CPUS_DEFAULT_4 78 - select SYS_HAS_CPU_LOONGSON3 79 - select SYS_HAS_EARLY_PRINTK 80 - select SYS_SUPPORTS_SMP 81 - select SYS_SUPPORTS_HOTPLUG_CPU 82 - select SYS_SUPPORTS_NUMA 83 - select SYS_SUPPORTS_64BIT_KERNEL 84 - select SYS_SUPPORTS_HIGHMEM 85 - select SYS_SUPPORTS_LITTLE_ENDIAN 86 - select LOONGSON_MC146818 87 - select ZONE_DMA32 88 - select LEFI_FIRMWARE_INTERFACE 89 - select PHYS48_TO_HT40 90 - help 91 - Generic Loongson 3 family machines utilize the 3A/3B revision 92 - of Loongson processor and RS780/SBX00 chipset. 93 - endchoice 94 - 95 - config CS5536 96 - bool 97 - 98 - config CS5536_MFGPT 99 - bool "CS5536 MFGPT Timer" 100 - depends on CS5536 && !HIGH_RES_TIMERS 101 - select MIPS_EXTERNAL_TIMER 102 - help 103 - This option enables the mfgpt0 timer of AMD CS5536. With this timer 104 - switched on you can not use high resolution timers. 105 - 106 - If you want to enable the Loongson2 CPUFreq Driver, Please enable 107 - this option at first, otherwise, You will get wrong system time. 108 - 109 - If unsure, say Yes. 110 - 111 - config RS780_HPET 112 - bool "RS780/SBX00 HPET Timer" 113 - depends on LOONGSON_MACH3X 114 - select MIPS_EXTERNAL_TIMER 115 - help 116 - This option enables the hpet timer of AMD RS780/SBX00. 117 - 118 - If you want to enable the Loongson3 CPUFreq Driver, Please enable 119 - this option at first, otherwise, You will get wrong system time. 120 - 121 - If unsure, say Yes. 122 - 123 - config LOONGSON_SUSPEND 124 - bool 125 - default y 126 - depends on CPU_SUPPORTS_CPUFREQ && SUSPEND 127 - 128 - config LOONGSON_UART_BASE 129 - bool 130 - default y 131 - depends on EARLY_PRINTK || SERIAL_8250 132 - 133 - config IOMMU_HELPER 134 - bool 135 - 136 - config NEED_SG_DMA_LENGTH 137 - bool 138 - 139 - config SWIOTLB 140 - bool "Soft IOMMU Support for All-Memory DMA" 141 - default y 142 - depends on CPU_LOONGSON3 143 - select IOMMU_HELPER 144 - select NEED_SG_DMA_LENGTH 145 - select NEED_DMA_MAP_STATE 146 - 147 - config PHYS48_TO_HT40 148 - bool 149 - default y if CPU_LOONGSON3 150 - 151 - config LOONGSON_MC146818 152 - bool 153 - default n 154 - 155 - config LEFI_FIRMWARE_INTERFACE 156 - bool 157 - 158 - endif # MACH_LOONGSON
-23
arch/mips/loongson/Makefile
··· 1 - # 2 - # Common code for all Loongson based systems 3 - # 4 - 5 - obj-$(CONFIG_MACH_LOONGSON) += common/ 6 - 7 - # 8 - # Lemote Fuloong mini-PC (Loongson 2E-based) 9 - # 10 - 11 - obj-$(CONFIG_LEMOTE_FULOONG2E) += fuloong-2e/ 12 - 13 - # 14 - # Lemote loongson2f family machines 15 - # 16 - 17 - obj-$(CONFIG_LEMOTE_MACH2F) += lemote-2f/ 18 - 19 - # 20 - # All Loongson-3 family machines 21 - # 22 - 23 - obj-$(CONFIG_CPU_LOONGSON3) += loongson-3/
-33
arch/mips/loongson/Platform
··· 1 - # 2 - # Loongson Processors' Support 3 - # 4 - 5 - # Only gcc >= 4.4 have Loongson specific support 6 - cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap 7 - cflags-$(CONFIG_CPU_LOONGSON2E) += \ 8 - $(call cc-option,-march=loongson2e,-march=r4600) 9 - cflags-$(CONFIG_CPU_LOONGSON2F) += \ 10 - $(call cc-option,-march=loongson2f,-march=r4600) 11 - # Enable the workarounds for Loongson2f 12 - ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS 13 - ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),) 14 - $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop) 15 - else 16 - cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop 17 - endif 18 - ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),) 19 - $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump) 20 - else 21 - cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump 22 - endif 23 - endif 24 - 25 - # 26 - # Loongson Machines' Support 27 - # 28 - 29 - platform-$(CONFIG_MACH_LOONGSON) += loongson/ 30 - cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely 31 - load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000 32 - load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000 33 - load-$(CONFIG_LOONGSON_MACH3X) += 0xffffffff80200000
arch/mips/loongson/common/Makefile arch/mips/loongson64/common/Makefile
arch/mips/loongson/common/bonito-irq.c arch/mips/loongson64/common/bonito-irq.c
arch/mips/loongson/common/cmdline.c arch/mips/loongson64/common/cmdline.c
arch/mips/loongson/common/cs5536/Makefile arch/mips/loongson64/common/cs5536/Makefile
arch/mips/loongson/common/cs5536/cs5536_acc.c arch/mips/loongson64/common/cs5536/cs5536_acc.c
arch/mips/loongson/common/cs5536/cs5536_ehci.c arch/mips/loongson64/common/cs5536/cs5536_ehci.c
arch/mips/loongson/common/cs5536/cs5536_ide.c arch/mips/loongson64/common/cs5536/cs5536_ide.c
arch/mips/loongson/common/cs5536/cs5536_isa.c arch/mips/loongson64/common/cs5536/cs5536_isa.c
arch/mips/loongson/common/cs5536/cs5536_mfgpt.c arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
arch/mips/loongson/common/cs5536/cs5536_ohci.c arch/mips/loongson64/common/cs5536/cs5536_ohci.c
arch/mips/loongson/common/cs5536/cs5536_pci.c arch/mips/loongson64/common/cs5536/cs5536_pci.c
arch/mips/loongson/common/dma-swiotlb.c arch/mips/loongson64/common/dma-swiotlb.c
arch/mips/loongson/common/early_printk.c arch/mips/loongson64/common/early_printk.c
arch/mips/loongson/common/env.c arch/mips/loongson64/common/env.c
arch/mips/loongson/common/init.c arch/mips/loongson64/common/init.c
arch/mips/loongson/common/irq.c arch/mips/loongson64/common/irq.c
arch/mips/loongson/common/machtype.c arch/mips/loongson64/common/machtype.c
arch/mips/loongson/common/mem.c arch/mips/loongson64/common/mem.c
arch/mips/loongson/common/pci.c arch/mips/loongson64/common/pci.c
arch/mips/loongson/common/platform.c arch/mips/loongson64/common/platform.c
arch/mips/loongson/common/pm.c arch/mips/loongson64/common/pm.c
arch/mips/loongson/common/reset.c arch/mips/loongson64/common/reset.c
arch/mips/loongson/common/rtc.c arch/mips/loongson64/common/rtc.c
-112
arch/mips/loongson/common/serial.c
··· 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) 2007 Ralf Baechle (ralf@linux-mips.org) 7 - * 8 - * Copyright (C) 2009 Lemote, Inc. 9 - * Author: Yan hua (yanhua@lemote.com) 10 - * Author: Wu Zhangjin (wuzhangjin@gmail.com) 11 - */ 12 - 13 - #include <linux/io.h> 14 - #include <linux/init.h> 15 - #include <linux/serial_8250.h> 16 - 17 - #include <asm/bootinfo.h> 18 - 19 - #include <loongson.h> 20 - #include <machine.h> 21 - 22 - #define PORT(int, clk) \ 23 - { \ 24 - .irq = int, \ 25 - .uartclk = clk, \ 26 - .iotype = UPIO_PORT, \ 27 - .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ 28 - .regshift = 0, \ 29 - } 30 - 31 - #define PORT_M(int, clk) \ 32 - { \ 33 - .irq = MIPS_CPU_IRQ_BASE + (int), \ 34 - .uartclk = clk, \ 35 - .iotype = UPIO_MEM, \ 36 - .membase = (void __iomem *)NULL, \ 37 - .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ 38 - .regshift = 0, \ 39 - } 40 - 41 - static struct plat_serial8250_port uart8250_data[][MAX_UARTS + 1] = { 42 - [MACH_LOONGSON_UNKNOWN] = {}, 43 - [MACH_LEMOTE_FL2E] = {PORT(4, 1843200), {} }, 44 - [MACH_LEMOTE_FL2F] = {PORT(3, 1843200), {} }, 45 - [MACH_LEMOTE_ML2F7] = {PORT_M(3, 3686400), {} }, 46 - [MACH_LEMOTE_YL2F89] = {PORT_M(3, 3686400), {} }, 47 - [MACH_DEXXON_GDIUM2F10] = {PORT_M(3, 3686400), {} }, 48 - [MACH_LEMOTE_NAS] = {PORT_M(3, 3686400), {} }, 49 - [MACH_LEMOTE_LL2F] = {PORT(3, 1843200), {} }, 50 - [MACH_LOONGSON_GENERIC] = {PORT_M(2, 25000000), {} }, 51 - [MACH_LOONGSON_END] = {}, 52 - }; 53 - 54 - static struct platform_device uart8250_device = { 55 - .name = "serial8250", 56 - .id = PLAT8250_DEV_PLATFORM, 57 - }; 58 - 59 - static int __init serial_init(void) 60 - { 61 - int i; 62 - unsigned char iotype; 63 - 64 - iotype = uart8250_data[mips_machtype][0].iotype; 65 - 66 - if (UPIO_MEM == iotype) { 67 - uart8250_data[mips_machtype][0].mapbase = 68 - loongson_uart_base[0]; 69 - uart8250_data[mips_machtype][0].membase = 70 - (void __iomem *)_loongson_uart_base[0]; 71 - } 72 - else if (UPIO_PORT == iotype) 73 - uart8250_data[mips_machtype][0].iobase = 74 - loongson_uart_base[0] - LOONGSON_PCIIO_BASE; 75 - 76 - if (loongson_sysconf.uarts[0].uartclk) 77 - uart8250_data[mips_machtype][0].uartclk = 78 - loongson_sysconf.uarts[0].uartclk; 79 - 80 - for (i = 1; i < loongson_sysconf.nr_uarts; i++) { 81 - iotype = loongson_sysconf.uarts[i].iotype; 82 - uart8250_data[mips_machtype][i].iotype = iotype; 83 - loongson_uart_base[i] = loongson_sysconf.uarts[i].uart_base; 84 - 85 - if (UPIO_MEM == iotype) { 86 - uart8250_data[mips_machtype][i].irq = 87 - MIPS_CPU_IRQ_BASE + loongson_sysconf.uarts[i].int_offset; 88 - uart8250_data[mips_machtype][i].mapbase = 89 - loongson_uart_base[i]; 90 - uart8250_data[mips_machtype][i].membase = 91 - ioremap_nocache(loongson_uart_base[i], 8); 92 - } else if (UPIO_PORT == iotype) { 93 - uart8250_data[mips_machtype][i].irq = 94 - loongson_sysconf.uarts[i].int_offset; 95 - uart8250_data[mips_machtype][i].iobase = 96 - loongson_uart_base[i] - LOONGSON_PCIIO_BASE; 97 - } 98 - 99 - uart8250_data[mips_machtype][i].uartclk = 100 - loongson_sysconf.uarts[i].uartclk; 101 - uart8250_data[mips_machtype][i].flags = 102 - UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 103 - } 104 - 105 - memset(&uart8250_data[mips_machtype][loongson_sysconf.nr_uarts], 106 - 0, sizeof(struct plat_serial8250_port)); 107 - uart8250_device.dev.platform_data = uart8250_data[mips_machtype]; 108 - 109 - return platform_device_register(&uart8250_device); 110 - } 111 - 112 - device_initcall(serial_init);
arch/mips/loongson/common/setup.c arch/mips/loongson64/common/setup.c
arch/mips/loongson/common/time.c arch/mips/loongson64/common/time.c
arch/mips/loongson/common/uart_base.c arch/mips/loongson64/common/uart_base.c
arch/mips/loongson/fuloong-2e/Makefile arch/mips/loongson64/fuloong-2e/Makefile
arch/mips/loongson/fuloong-2e/irq.c arch/mips/loongson64/fuloong-2e/irq.c
arch/mips/loongson/fuloong-2e/reset.c arch/mips/loongson64/fuloong-2e/reset.c
arch/mips/loongson/lemote-2f/Makefile arch/mips/loongson64/lemote-2f/Makefile
arch/mips/loongson/lemote-2f/clock.c arch/mips/loongson64/lemote-2f/clock.c
arch/mips/loongson/lemote-2f/ec_kb3310b.c arch/mips/loongson64/lemote-2f/ec_kb3310b.c
arch/mips/loongson/lemote-2f/ec_kb3310b.h arch/mips/loongson64/lemote-2f/ec_kb3310b.h
arch/mips/loongson/lemote-2f/irq.c arch/mips/loongson64/lemote-2f/irq.c
arch/mips/loongson/lemote-2f/machtype.c arch/mips/loongson64/lemote-2f/machtype.c
arch/mips/loongson/lemote-2f/pm.c arch/mips/loongson64/lemote-2f/pm.c
arch/mips/loongson/lemote-2f/reset.c arch/mips/loongson64/lemote-2f/reset.c
arch/mips/loongson/loongson-3/Makefile arch/mips/loongson64/loongson-3/Makefile
arch/mips/loongson/loongson-3/cop2-ex.c arch/mips/loongson64/loongson-3/cop2-ex.c
arch/mips/loongson/loongson-3/hpet.c arch/mips/loongson64/loongson-3/hpet.c
arch/mips/loongson/loongson-3/irq.c arch/mips/loongson64/loongson-3/irq.c
arch/mips/loongson/loongson-3/numa.c arch/mips/loongson64/loongson-3/numa.c
arch/mips/loongson/loongson-3/platform.c arch/mips/loongson64/loongson-3/platform.c
arch/mips/loongson/loongson-3/smp.c arch/mips/loongson64/loongson-3/smp.c
arch/mips/loongson/loongson-3/smp.h arch/mips/loongson64/loongson-3/smp.h
-61
arch/mips/loongson1/Kconfig
··· 1 - if MACH_LOONGSON1 2 - 3 - choice 4 - prompt "Machine Type" 5 - 6 - config LOONGSON1_LS1B 7 - bool "Loongson LS1B board" 8 - select CEVT_R4K if !MIPS_EXTERNAL_TIMER 9 - select CSRC_R4K if !MIPS_EXTERNAL_TIMER 10 - select SYS_HAS_CPU_LOONGSON1B 11 - select DMA_NONCOHERENT 12 - select BOOT_ELF32 13 - select IRQ_CPU 14 - select SYS_SUPPORTS_32BIT_KERNEL 15 - select SYS_SUPPORTS_LITTLE_ENDIAN 16 - select SYS_SUPPORTS_HIGHMEM 17 - select SYS_SUPPORTS_MIPS16 18 - select SYS_HAS_EARLY_PRINTK 19 - select USE_GENERIC_EARLY_PRINTK_8250 20 - select COMMON_CLK 21 - 22 - endchoice 23 - 24 - menuconfig CEVT_CSRC_LS1X 25 - bool "Use PWM Timer for clockevent/clocksource" 26 - select MIPS_EXTERNAL_TIMER 27 - depends on CPU_LOONGSON1 28 - help 29 - This option changes the default clockevent/clocksource to PWM Timer, 30 - and is required by Loongson1 CPUFreq support. 31 - 32 - If unsure, say N. 33 - 34 - choice 35 - prompt "Select clockevent/clocksource" 36 - depends on CEVT_CSRC_LS1X 37 - default TIMER_USE_PWM0 38 - 39 - config TIMER_USE_PWM0 40 - bool "Use PWM Timer 0" 41 - help 42 - Use PWM Timer 0 as the default clockevent/clocksourcer. 43 - 44 - config TIMER_USE_PWM1 45 - bool "Use PWM Timer 1" 46 - help 47 - Use PWM Timer 1 as the default clockevent/clocksourcer. 48 - 49 - config TIMER_USE_PWM2 50 - bool "Use PWM Timer 2" 51 - help 52 - Use PWM Timer 2 as the default clockevent/clocksourcer. 53 - 54 - config TIMER_USE_PWM3 55 - bool "Use PWM Timer 3" 56 - help 57 - Use PWM Timer 3 as the default clockevent/clocksourcer. 58 - 59 - endchoice 60 - 61 - endif # MACH_LOONGSON1
-11
arch/mips/loongson1/Makefile
··· 1 - # 2 - # Common code for all Loongson 1 based systems 3 - # 4 - 5 - obj-$(CONFIG_MACH_LOONGSON1) += common/ 6 - 7 - # 8 - # Loongson LS1B board 9 - # 10 - 11 - obj-$(CONFIG_LOONGSON1_LS1B) += ls1b/
-7
arch/mips/loongson1/Platform
··· 1 - cflags-$(CONFIG_CPU_LOONGSON1) += \ 2 - $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ 3 - -Wa,-mips32r2 -Wa,--trap 4 - 5 - platform-$(CONFIG_MACH_LOONGSON1) += loongson1/ 6 - cflags-$(CONFIG_MACH_LOONGSON1) += -I$(srctree)/arch/mips/include/asm/mach-loongson1 7 - load-$(CONFIG_LOONGSON1_LS1B) += 0xffffffff80100000
arch/mips/loongson1/common/Makefile arch/mips/loongson32/common/Makefile
arch/mips/loongson1/common/irq.c arch/mips/loongson32/common/irq.c
arch/mips/loongson1/common/platform.c arch/mips/loongson32/common/platform.c
arch/mips/loongson1/common/prom.c arch/mips/loongson32/common/prom.c
arch/mips/loongson1/common/reset.c arch/mips/loongson32/common/reset.c
arch/mips/loongson1/common/setup.c arch/mips/loongson32/common/setup.c
arch/mips/loongson1/common/time.c arch/mips/loongson32/common/time.c
arch/mips/loongson1/ls1b/Makefile arch/mips/loongson32/ls1b/Makefile
arch/mips/loongson1/ls1b/board.c arch/mips/loongson32/ls1b/board.c
+61
arch/mips/loongson32/Kconfig
··· 1 + if MACH_LOONGSON32 2 + 3 + choice 4 + prompt "Machine Type" 5 + 6 + config LOONGSON1_LS1B 7 + bool "Loongson LS1B board" 8 + select CEVT_R4K if !MIPS_EXTERNAL_TIMER 9 + select CSRC_R4K if !MIPS_EXTERNAL_TIMER 10 + select SYS_HAS_CPU_LOONGSON1B 11 + select DMA_NONCOHERENT 12 + select BOOT_ELF32 13 + select IRQ_MIPS_CPU 14 + select SYS_SUPPORTS_32BIT_KERNEL 15 + select SYS_SUPPORTS_LITTLE_ENDIAN 16 + select SYS_SUPPORTS_HIGHMEM 17 + select SYS_SUPPORTS_MIPS16 18 + select SYS_HAS_EARLY_PRINTK 19 + select USE_GENERIC_EARLY_PRINTK_8250 20 + select COMMON_CLK 21 + 22 + endchoice 23 + 24 + menuconfig CEVT_CSRC_LS1X 25 + bool "Use PWM Timer for clockevent/clocksource" 26 + select MIPS_EXTERNAL_TIMER 27 + depends on CPU_LOONGSON1 28 + help 29 + This option changes the default clockevent/clocksource to PWM Timer, 30 + and is required by Loongson1 CPUFreq support. 31 + 32 + If unsure, say N. 33 + 34 + choice 35 + prompt "Select clockevent/clocksource" 36 + depends on CEVT_CSRC_LS1X 37 + default TIMER_USE_PWM0 38 + 39 + config TIMER_USE_PWM0 40 + bool "Use PWM Timer 0" 41 + help 42 + Use PWM Timer 0 as the default clockevent/clocksourcer. 43 + 44 + config TIMER_USE_PWM1 45 + bool "Use PWM Timer 1" 46 + help 47 + Use PWM Timer 1 as the default clockevent/clocksourcer. 48 + 49 + config TIMER_USE_PWM2 50 + bool "Use PWM Timer 2" 51 + help 52 + Use PWM Timer 2 as the default clockevent/clocksourcer. 53 + 54 + config TIMER_USE_PWM3 55 + bool "Use PWM Timer 3" 56 + help 57 + Use PWM Timer 3 as the default clockevent/clocksourcer. 58 + 59 + endchoice 60 + 61 + endif # MACH_LOONGSON32
+11
arch/mips/loongson32/Makefile
··· 1 + # 2 + # Common code for all Loongson 1 based systems 3 + # 4 + 5 + obj-$(CONFIG_MACH_LOONGSON32) += common/ 6 + 7 + # 8 + # Loongson LS1B board 9 + # 10 + 11 + obj-$(CONFIG_LOONGSON1_LS1B) += ls1b/
+7
arch/mips/loongson32/Platform
··· 1 + cflags-$(CONFIG_CPU_LOONGSON1) += \ 2 + $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ 3 + -Wa,-mips32r2 -Wa,--trap 4 + 5 + platform-$(CONFIG_MACH_LOONGSON32) += loongson32/ 6 + cflags-$(CONFIG_MACH_LOONGSON32) += -I$(srctree)/arch/mips/include/asm/mach-loongson32 7 + load-$(CONFIG_LOONGSON1_LS1B) += 0xffffffff80100000
+158
arch/mips/loongson64/Kconfig
··· 1 + if MACH_LOONGSON64 2 + 3 + choice 4 + prompt "Machine Type" 5 + 6 + config LEMOTE_FULOONG2E 7 + bool "Lemote Fuloong(2e) mini-PC" 8 + select ARCH_SPARSEMEM_ENABLE 9 + select CEVT_R4K 10 + select CSRC_R4K 11 + select SYS_HAS_CPU_LOONGSON2E 12 + select DMA_NONCOHERENT 13 + select BOOT_ELF32 14 + select BOARD_SCACHE 15 + select HW_HAS_PCI 16 + select I8259 17 + select ISA 18 + select IRQ_MIPS_CPU 19 + select SYS_SUPPORTS_32BIT_KERNEL 20 + select SYS_SUPPORTS_64BIT_KERNEL 21 + select SYS_SUPPORTS_LITTLE_ENDIAN 22 + select SYS_SUPPORTS_HIGHMEM 23 + select SYS_HAS_EARLY_PRINTK 24 + select GENERIC_ISA_DMA_SUPPORT_BROKEN 25 + select CPU_HAS_WB 26 + select LOONGSON_MC146818 27 + help 28 + Lemote Fuloong(2e) mini-PC board based on the Chinese Loongson-2E CPU and 29 + an FPGA northbridge 30 + 31 + Lemote Fuloong(2e) mini PC have a VIA686B south bridge. 32 + 33 + config LEMOTE_MACH2F 34 + bool "Lemote Loongson 2F family machines" 35 + select ARCH_SPARSEMEM_ENABLE 36 + select BOARD_SCACHE 37 + select BOOT_ELF32 38 + select CEVT_R4K if ! MIPS_EXTERNAL_TIMER 39 + select CPU_HAS_WB 40 + select CS5536 41 + select CSRC_R4K if ! MIPS_EXTERNAL_TIMER 42 + select DMA_NONCOHERENT 43 + select GENERIC_ISA_DMA_SUPPORT_BROKEN 44 + select HAVE_CLK 45 + select HW_HAS_PCI 46 + select I8259 47 + select IRQ_MIPS_CPU 48 + select ISA 49 + select SYS_HAS_CPU_LOONGSON2F 50 + select SYS_HAS_EARLY_PRINTK 51 + select SYS_SUPPORTS_32BIT_KERNEL 52 + select SYS_SUPPORTS_64BIT_KERNEL 53 + select SYS_SUPPORTS_HIGHMEM 54 + select SYS_SUPPORTS_LITTLE_ENDIAN 55 + select LOONGSON_MC146818 56 + help 57 + Lemote Loongson 2F family machines utilize the 2F revision of 58 + Loongson processor and the AMD CS5536 south bridge. 59 + 60 + These family machines include fuloong2f mini PC, yeeloong2f notebook, 61 + LingLoong allinone PC and so forth. 62 + 63 + config LOONGSON_MACH3X 64 + bool "Generic Loongson 3 family machines" 65 + select ARCH_SPARSEMEM_ENABLE 66 + select GENERIC_ISA_DMA_SUPPORT_BROKEN 67 + select BOOT_ELF32 68 + select BOARD_SCACHE 69 + select CSRC_R4K 70 + select CEVT_R4K 71 + select CPU_HAS_WB 72 + select HW_HAS_PCI 73 + select ISA 74 + select HT_PCI 75 + select I8259 76 + select IRQ_MIPS_CPU 77 + select NR_CPUS_DEFAULT_4 78 + select SYS_HAS_CPU_LOONGSON3 79 + select SYS_HAS_EARLY_PRINTK 80 + select SYS_SUPPORTS_SMP 81 + select SYS_SUPPORTS_HOTPLUG_CPU 82 + select SYS_SUPPORTS_NUMA 83 + select SYS_SUPPORTS_64BIT_KERNEL 84 + select SYS_SUPPORTS_HIGHMEM 85 + select SYS_SUPPORTS_LITTLE_ENDIAN 86 + select LOONGSON_MC146818 87 + select ZONE_DMA32 88 + select LEFI_FIRMWARE_INTERFACE 89 + select PHYS48_TO_HT40 90 + help 91 + Generic Loongson 3 family machines utilize the 3A/3B revision 92 + of Loongson processor and RS780/SBX00 chipset. 93 + endchoice 94 + 95 + config CS5536 96 + bool 97 + 98 + config CS5536_MFGPT 99 + bool "CS5536 MFGPT Timer" 100 + depends on CS5536 && !HIGH_RES_TIMERS 101 + select MIPS_EXTERNAL_TIMER 102 + help 103 + This option enables the mfgpt0 timer of AMD CS5536. With this timer 104 + switched on you can not use high resolution timers. 105 + 106 + If you want to enable the Loongson2 CPUFreq Driver, Please enable 107 + this option at first, otherwise, You will get wrong system time. 108 + 109 + If unsure, say Yes. 110 + 111 + config RS780_HPET 112 + bool "RS780/SBX00 HPET Timer" 113 + depends on LOONGSON_MACH3X 114 + select MIPS_EXTERNAL_TIMER 115 + help 116 + This option enables the hpet timer of AMD RS780/SBX00. 117 + 118 + If you want to enable the Loongson3 CPUFreq Driver, Please enable 119 + this option at first, otherwise, You will get wrong system time. 120 + 121 + If unsure, say Yes. 122 + 123 + config LOONGSON_SUSPEND 124 + bool 125 + default y 126 + depends on CPU_SUPPORTS_CPUFREQ && SUSPEND 127 + 128 + config LOONGSON_UART_BASE 129 + bool 130 + default y 131 + depends on EARLY_PRINTK || SERIAL_8250 132 + 133 + config IOMMU_HELPER 134 + bool 135 + 136 + config NEED_SG_DMA_LENGTH 137 + bool 138 + 139 + config SWIOTLB 140 + bool "Soft IOMMU Support for All-Memory DMA" 141 + default y 142 + depends on CPU_LOONGSON3 143 + select IOMMU_HELPER 144 + select NEED_SG_DMA_LENGTH 145 + select NEED_DMA_MAP_STATE 146 + 147 + config PHYS48_TO_HT40 148 + bool 149 + default y if CPU_LOONGSON3 150 + 151 + config LOONGSON_MC146818 152 + bool 153 + default n 154 + 155 + config LEFI_FIRMWARE_INTERFACE 156 + bool 157 + 158 + endif # MACH_LOONGSON64
+23
arch/mips/loongson64/Makefile
··· 1 + # 2 + # Common code for all Loongson based systems 3 + # 4 + 5 + obj-$(CONFIG_MACH_LOONGSON64) += common/ 6 + 7 + # 8 + # Lemote Fuloong mini-PC (Loongson 2E-based) 9 + # 10 + 11 + obj-$(CONFIG_LEMOTE_FULOONG2E) += fuloong-2e/ 12 + 13 + # 14 + # Lemote loongson2f family machines 15 + # 16 + 17 + obj-$(CONFIG_LEMOTE_MACH2F) += lemote-2f/ 18 + 19 + # 20 + # All Loongson-3 family machines 21 + # 22 + 23 + obj-$(CONFIG_CPU_LOONGSON3) += loongson-3/
+33
arch/mips/loongson64/Platform
··· 1 + # 2 + # Loongson Processors' Support 3 + # 4 + 5 + # Only gcc >= 4.4 have Loongson specific support 6 + cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap 7 + cflags-$(CONFIG_CPU_LOONGSON2E) += \ 8 + $(call cc-option,-march=loongson2e,-march=r4600) 9 + cflags-$(CONFIG_CPU_LOONGSON2F) += \ 10 + $(call cc-option,-march=loongson2f,-march=r4600) 11 + # Enable the workarounds for Loongson2f 12 + ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS 13 + ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),) 14 + $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop) 15 + else 16 + cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop 17 + endif 18 + ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),) 19 + $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump) 20 + else 21 + cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump 22 + endif 23 + endif 24 + 25 + # 26 + # Loongson Machines' Support 27 + # 28 + 29 + platform-$(CONFIG_MACH_LOONGSON64) += loongson64/ 30 + cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely 31 + load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000 32 + load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000 33 + load-$(CONFIG_LOONGSON_MACH3X) += 0xffffffff80200000
+117
arch/mips/loongson64/common/serial.c
··· 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) 2007 Ralf Baechle (ralf@linux-mips.org) 7 + * 8 + * Copyright (C) 2009 Lemote, Inc. 9 + * Author: Yan hua (yanhua@lemote.com) 10 + * Author: Wu Zhangjin (wuzhangjin@gmail.com) 11 + */ 12 + 13 + #include <linux/io.h> 14 + #include <linux/module.h> 15 + #include <linux/serial_8250.h> 16 + 17 + #include <asm/bootinfo.h> 18 + 19 + #include <loongson.h> 20 + #include <machine.h> 21 + 22 + #define PORT(int, clk) \ 23 + { \ 24 + .irq = int, \ 25 + .uartclk = clk, \ 26 + .iotype = UPIO_PORT, \ 27 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ 28 + .regshift = 0, \ 29 + } 30 + 31 + #define PORT_M(int, clk) \ 32 + { \ 33 + .irq = MIPS_CPU_IRQ_BASE + (int), \ 34 + .uartclk = clk, \ 35 + .iotype = UPIO_MEM, \ 36 + .membase = (void __iomem *)NULL, \ 37 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ 38 + .regshift = 0, \ 39 + } 40 + 41 + static struct plat_serial8250_port uart8250_data[][MAX_UARTS + 1] = { 42 + [MACH_LOONGSON_UNKNOWN] = {}, 43 + [MACH_LEMOTE_FL2E] = {PORT(4, 1843200), {} }, 44 + [MACH_LEMOTE_FL2F] = {PORT(3, 1843200), {} }, 45 + [MACH_LEMOTE_ML2F7] = {PORT_M(3, 3686400), {} }, 46 + [MACH_LEMOTE_YL2F89] = {PORT_M(3, 3686400), {} }, 47 + [MACH_DEXXON_GDIUM2F10] = {PORT_M(3, 3686400), {} }, 48 + [MACH_LEMOTE_NAS] = {PORT_M(3, 3686400), {} }, 49 + [MACH_LEMOTE_LL2F] = {PORT(3, 1843200), {} }, 50 + [MACH_LOONGSON_GENERIC] = {PORT_M(2, 25000000), {} }, 51 + [MACH_LOONGSON_END] = {}, 52 + }; 53 + 54 + static struct platform_device uart8250_device = { 55 + .name = "serial8250", 56 + .id = PLAT8250_DEV_PLATFORM, 57 + }; 58 + 59 + static int __init serial_init(void) 60 + { 61 + int i; 62 + unsigned char iotype; 63 + 64 + iotype = uart8250_data[mips_machtype][0].iotype; 65 + 66 + if (UPIO_MEM == iotype) { 67 + uart8250_data[mips_machtype][0].mapbase = 68 + loongson_uart_base[0]; 69 + uart8250_data[mips_machtype][0].membase = 70 + (void __iomem *)_loongson_uart_base[0]; 71 + } 72 + else if (UPIO_PORT == iotype) 73 + uart8250_data[mips_machtype][0].iobase = 74 + loongson_uart_base[0] - LOONGSON_PCIIO_BASE; 75 + 76 + if (loongson_sysconf.uarts[0].uartclk) 77 + uart8250_data[mips_machtype][0].uartclk = 78 + loongson_sysconf.uarts[0].uartclk; 79 + 80 + for (i = 1; i < loongson_sysconf.nr_uarts; i++) { 81 + iotype = loongson_sysconf.uarts[i].iotype; 82 + uart8250_data[mips_machtype][i].iotype = iotype; 83 + loongson_uart_base[i] = loongson_sysconf.uarts[i].uart_base; 84 + 85 + if (UPIO_MEM == iotype) { 86 + uart8250_data[mips_machtype][i].irq = 87 + MIPS_CPU_IRQ_BASE + loongson_sysconf.uarts[i].int_offset; 88 + uart8250_data[mips_machtype][i].mapbase = 89 + loongson_uart_base[i]; 90 + uart8250_data[mips_machtype][i].membase = 91 + ioremap_nocache(loongson_uart_base[i], 8); 92 + } else if (UPIO_PORT == iotype) { 93 + uart8250_data[mips_machtype][i].irq = 94 + loongson_sysconf.uarts[i].int_offset; 95 + uart8250_data[mips_machtype][i].iobase = 96 + loongson_uart_base[i] - LOONGSON_PCIIO_BASE; 97 + } 98 + 99 + uart8250_data[mips_machtype][i].uartclk = 100 + loongson_sysconf.uarts[i].uartclk; 101 + uart8250_data[mips_machtype][i].flags = 102 + UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 103 + } 104 + 105 + memset(&uart8250_data[mips_machtype][loongson_sysconf.nr_uarts], 106 + 0, sizeof(struct plat_serial8250_port)); 107 + uart8250_device.dev.platform_data = uart8250_data[mips_machtype]; 108 + 109 + return platform_device_register(&uart8250_device); 110 + } 111 + module_init(serial_init); 112 + 113 + static void __init serial_exit(void) 114 + { 115 + platform_device_unregister(&uart8250_device); 116 + } 117 + module_exit(serial_exit);
+1 -1
arch/mips/mm/c-r4k.c
··· 295 295 296 296 static void (*r4k_blast_icache_user_page)(unsigned long addr); 297 297 298 - static void __cpuinit r4k_blast_icache_user_page_setup(void) 298 + static void r4k_blast_icache_user_page_setup(void) 299 299 { 300 300 unsigned long ic_lsize = cpu_icache_line_size(); 301 301
-4
arch/mips/mm/c-tx39.c
··· 28 28 29 29 #include <asm/r4kcache.h> 30 30 31 - extern int r3k_have_wired_reg; /* in r3k-tlb.c */ 32 - 33 31 /* This sequence is required to ensure icache is disabled immediately */ 34 32 #define TX39_STOP_STREAMING() \ 35 33 __asm__ __volatile__( \ ··· 381 383 case CPU_TX3927: 382 384 default: 383 385 /* TX39/H2,H3 core (writeback 2way-set-associative cache) */ 384 - r3k_have_wired_reg = 1; 385 - write_c0_wired(0); /* set 8 on reset... */ 386 386 /* board-dependent init code may set WBON */ 387 387 388 388 __flush_cache_vmap = tx39__flush_cache_vmap;
+20 -10
arch/mips/mm/dma-default.c
··· 262 262 plat_unmap_dma_mem(dev, dma_addr, size, direction); 263 263 } 264 264 265 - static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg, 265 + static int mips_dma_map_sg(struct device *dev, struct scatterlist *sglist, 266 266 int nents, enum dma_data_direction direction, struct dma_attrs *attrs) 267 267 { 268 268 int i; 269 + struct scatterlist *sg; 269 270 270 - for (i = 0; i < nents; i++, sg++) { 271 + for_each_sg(sglist, sg, nents, i) { 271 272 if (!plat_device_is_coherent(dev)) 272 273 __dma_sync(sg_page(sg), sg->offset, sg->length, 273 274 direction); ··· 292 291 return plat_map_dma_mem_page(dev, page) + offset; 293 292 } 294 293 295 - static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg, 294 + static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, 296 295 int nhwentries, enum dma_data_direction direction, 297 296 struct dma_attrs *attrs) 298 297 { 299 298 int i; 299 + struct scatterlist *sg; 300 300 301 - for (i = 0; i < nhwentries; i++, sg++) { 301 + for_each_sg(sglist, sg, nhwentries, i) { 302 302 if (!plat_device_is_coherent(dev) && 303 303 direction != DMA_TO_DEVICE) 304 304 __dma_sync(sg_page(sg), sg->offset, sg->length, ··· 326 324 } 327 325 328 326 static void mips_dma_sync_sg_for_cpu(struct device *dev, 329 - struct scatterlist *sg, int nelems, enum dma_data_direction direction) 327 + struct scatterlist *sglist, int nelems, 328 + enum dma_data_direction direction) 330 329 { 331 330 int i; 331 + struct scatterlist *sg; 332 332 333 - if (cpu_needs_post_dma_flush(dev)) 334 - for (i = 0; i < nelems; i++, sg++) 333 + if (cpu_needs_post_dma_flush(dev)) { 334 + for_each_sg(sglist, sg, nelems, i) { 335 335 __dma_sync(sg_page(sg), sg->offset, sg->length, 336 336 direction); 337 + } 338 + } 337 339 plat_post_dma_flush(dev); 338 340 } 339 341 340 342 static void mips_dma_sync_sg_for_device(struct device *dev, 341 - struct scatterlist *sg, int nelems, enum dma_data_direction direction) 343 + struct scatterlist *sglist, int nelems, 344 + enum dma_data_direction direction) 342 345 { 343 346 int i; 347 + struct scatterlist *sg; 344 348 345 - if (!plat_device_is_coherent(dev)) 346 - for (i = 0; i < nelems; i++, sg++) 349 + if (!plat_device_is_coherent(dev)) { 350 + for_each_sg(sglist, sg, nelems, i) { 347 351 __dma_sync(sg_page(sg), sg->offset, sg->length, 348 352 direction); 353 + } 354 + } 349 355 } 350 356 351 357 int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+25 -16
arch/mips/mm/tlb-r3k.c
··· 36 36 "nop\n\t" \ 37 37 ".set pop\n\t") 38 38 39 - int r3k_have_wired_reg; /* should be in cpu_data? */ 39 + static int r3k_have_wired_reg; /* Should be in cpu_data? */ 40 40 41 41 /* TLB operations. */ 42 + static void local_flush_tlb_from(int entry) 43 + { 44 + unsigned long old_ctx; 45 + 46 + old_ctx = read_c0_entryhi() & ASID_MASK; 47 + write_c0_entrylo0(0); 48 + while (entry < current_cpu_data.tlbsize) { 49 + write_c0_index(entry << 8); 50 + write_c0_entryhi((entry | 0x80000) << 12); 51 + entry++; /* BARRIER */ 52 + tlb_write_indexed(); 53 + } 54 + write_c0_entryhi(old_ctx); 55 + } 56 + 42 57 void local_flush_tlb_all(void) 43 58 { 44 59 unsigned long flags; 45 - unsigned long old_ctx; 46 - int entry; 47 60 48 61 #ifdef DEBUG_TLB 49 62 printk("[tlball]"); 50 63 #endif 51 - 52 64 local_irq_save(flags); 53 - old_ctx = read_c0_entryhi() & ASID_MASK; 54 - write_c0_entrylo0(0); 55 - entry = r3k_have_wired_reg ? read_c0_wired() : 8; 56 - for (; entry < current_cpu_data.tlbsize; entry++) { 57 - write_c0_index(entry << 8); 58 - write_c0_entryhi((entry | 0x80000) << 12); 59 - BARRIER; 60 - tlb_write_indexed(); 61 - } 62 - write_c0_entryhi(old_ctx); 65 + local_flush_tlb_from(r3k_have_wired_reg ? read_c0_wired() : 8); 63 66 local_irq_restore(flags); 64 67 } 65 68 ··· 280 277 281 278 void tlb_init(void) 282 279 { 283 - local_flush_tlb_all(); 284 - 280 + switch (current_cpu_type()) { 281 + case CPU_TX3922: 282 + case CPU_TX3927: 283 + r3k_have_wired_reg = 1; 284 + write_c0_wired(0); /* Set to 8 on reset... */ 285 + break; 286 + } 287 + local_flush_tlb_from(0); 285 288 build_tlb_refill_handler(); 286 289 }
+1 -1
arch/mips/mm/tlb-r4k.c
··· 423 423 * lifetime of the system 424 424 */ 425 425 426 - int temp_tlb_entry __cpuinitdata; 426 + int temp_tlb_entry; 427 427 428 428 __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, 429 429 unsigned long entryhi, unsigned long pagemask)
+24 -9
arch/mips/mm/tlbex.c
··· 35 35 #include <asm/uasm.h> 36 36 #include <asm/setup.h> 37 37 38 - static int __cpuinitdata mips_xpa_disabled; 38 + static int mips_xpa_disabled; 39 39 40 40 static int __init xpa_disable(char *s) 41 41 { ··· 1608 1608 int pte, int ptr, int scratch, enum label_id lid) 1609 1609 { 1610 1610 int t = scratch >= 0 ? scratch : pte; 1611 + int cur = pte; 1611 1612 1612 1613 if (cpu_has_rixi) { 1613 1614 if (use_bbit_insns()) { 1614 1615 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid); 1615 1616 uasm_i_nop(p); 1616 1617 } else { 1617 - uasm_i_srl(p, t, pte, _PAGE_PRESENT_SHIFT); 1618 - uasm_i_andi(p, t, t, 1); 1618 + if (_PAGE_PRESENT_SHIFT) { 1619 + uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); 1620 + cur = t; 1621 + } 1622 + uasm_i_andi(p, t, cur, 1); 1619 1623 uasm_il_beqz(p, r, t, lid); 1620 1624 if (pte == t) 1621 1625 /* You lose the SMP race :-(*/ 1622 1626 iPTE_LW(p, pte, ptr); 1623 1627 } 1624 1628 } else { 1625 - uasm_i_srl(p, t, pte, _PAGE_PRESENT_SHIFT); 1626 - uasm_i_andi(p, t, t, 3); 1627 - uasm_i_xori(p, t, t, 3); 1629 + if (_PAGE_PRESENT_SHIFT) { 1630 + uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); 1631 + cur = t; 1632 + } 1633 + uasm_i_andi(p, t, cur, 1634 + (_PAGE_PRESENT | _PAGE_READ) >> _PAGE_PRESENT_SHIFT); 1635 + uasm_i_xori(p, t, t, 1636 + (_PAGE_PRESENT | _PAGE_READ) >> _PAGE_PRESENT_SHIFT); 1628 1637 uasm_il_bnez(p, r, t, lid); 1629 1638 if (pte == t) 1630 1639 /* You lose the SMP race :-(*/ ··· 1661 1652 enum label_id lid) 1662 1653 { 1663 1654 int t = scratch >= 0 ? scratch : pte; 1655 + int cur = pte; 1664 1656 1665 - uasm_i_srl(p, t, pte, _PAGE_PRESENT_SHIFT); 1666 - uasm_i_andi(p, t, t, 5); 1667 - uasm_i_xori(p, t, t, 5); 1657 + if (_PAGE_PRESENT_SHIFT) { 1658 + uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); 1659 + cur = t; 1660 + } 1661 + uasm_i_andi(p, t, cur, 1662 + (_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT); 1663 + uasm_i_xori(p, t, t, 1664 + (_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT); 1668 1665 uasm_il_bnez(p, r, t, lid); 1669 1666 if (pte == t) 1670 1667 /* You lose the SMP race :-(*/
+1 -1
arch/mips/mti-malta/Makefile
··· 5 5 # Copyright (C) 2008 Wind River Systems, Inc. 6 6 # written by Ralf Baechle <ralf@linux-mips.org> 7 7 # 8 - obj-y := malta-display.o malta-init.o \ 8 + obj-y := malta-display.o malta-dt.o malta-init.o \ 9 9 malta-int.o malta-memory.o malta-platform.o \ 10 10 malta-reset.o malta-setup.o malta-time.o 11 11
+34
arch/mips/mti-malta/malta-dt.c
··· 1 + /* 2 + * Copyright (C) 2015 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-provider.h> 12 + #include <linux/init.h> 13 + #include <linux/of_fdt.h> 14 + #include <linux/of_platform.h> 15 + 16 + void __init device_tree_init(void) 17 + { 18 + unflatten_and_copy_device_tree(); 19 + } 20 + 21 + static const struct of_device_id bus_ids[] __initconst = { 22 + { .compatible = "simple-bus", }, 23 + { .compatible = "isa", }, 24 + {}, 25 + }; 26 + 27 + static 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 + } 34 + device_initcall(publish_devices);
+4
arch/mips/mti-malta/malta-setup.c
··· 21 21 #include <linux/sched.h> 22 22 #include <linux/ioport.h> 23 23 #include <linux/irq.h> 24 + #include <linux/of_fdt.h> 24 25 #include <linux/pci.h> 25 26 #include <linux/screen_info.h> 26 27 #include <linux/time.h> ··· 32 31 #include <asm/mips-boards/malta.h> 33 32 #include <asm/mips-boards/maltaint.h> 34 33 #include <asm/dma.h> 34 + #include <asm/prom.h> 35 35 #include <asm/traps.h> 36 36 #ifdef CONFIG_VT 37 37 #include <linux/console.h> ··· 250 248 void __init plat_mem_setup(void) 251 249 { 252 250 unsigned int i; 251 + 252 + __dt_setup_arch(__dtb_start); 253 253 254 254 if (config_enabled(CONFIG_EVA)) 255 255 /* EVA has already been configured in mach-malta/kernel-init.h */
+1 -1
arch/mips/net/Makefile
··· 1 1 # MIPS networking code 2 2 3 - obj-$(CONFIG_BPF_JIT) += bpf_jit.o 3 + obj-$(CONFIG_BPF_JIT) += bpf_jit.o bpf_jit_asm.o
+69 -193
arch/mips/net/bpf_jit.c
··· 20 20 #include <linux/string.h> 21 21 #include <linux/slab.h> 22 22 #include <linux/types.h> 23 + #include <asm/asm.h> 23 24 #include <asm/bitops.h> 24 25 #include <asm/cacheflush.h> 25 26 #include <asm/cpu-features.h> ··· 29 28 #include "bpf_jit.h" 30 29 31 30 /* ABI 32 - * 33 - * s0 1st scratch register 34 - * s1 2nd scratch register 35 - * s2 offset register 36 - * s3 BPF register A 37 - * s4 BPF register X 38 - * s5 *skb 39 - * s6 *scratch memory 31 + * r_skb_hl SKB header length 32 + * r_data SKB data pointer 33 + * r_off Offset 34 + * r_A BPF register A 35 + * r_X BPF register X 36 + * r_skb *skb 37 + * r_M *scratch memory 38 + * r_skb_len SKB length 40 39 * 41 40 * On entry (*bpf_func)(*skb, *filter) 42 41 * a0 = MIPS_R_A0 = skb; ··· 64 63 * ---------------------------------------------------- 65 64 */ 66 65 67 - #define RSIZE (sizeof(unsigned long)) 68 66 #define ptr typeof(unsigned long) 69 - 70 - /* ABI specific return values */ 71 - #ifdef CONFIG_32BIT /* O32 */ 72 - #ifdef CONFIG_CPU_LITTLE_ENDIAN 73 - #define r_err MIPS_R_V1 74 - #define r_val MIPS_R_V0 75 - #else /* CONFIG_CPU_LITTLE_ENDIAN */ 76 - #define r_err MIPS_R_V0 77 - #define r_val MIPS_R_V1 78 - #endif 79 - #else /* N64 */ 80 - #define r_err MIPS_R_V0 81 - #define r_val MIPS_R_V0 82 - #endif 83 - 84 - #define r_ret MIPS_R_V0 85 - 86 - /* 87 - * Use 2 scratch registers to avoid pipeline interlocks. 88 - * There is no overhead during epilogue and prologue since 89 - * any of the $s0-$s6 registers will only be preserved if 90 - * they are going to actually be used. 91 - */ 92 - #define r_s0 MIPS_R_S0 /* scratch reg 1 */ 93 - #define r_s1 MIPS_R_S1 /* scratch reg 2 */ 94 - #define r_off MIPS_R_S2 95 - #define r_A MIPS_R_S3 96 - #define r_X MIPS_R_S4 97 - #define r_skb MIPS_R_S5 98 - #define r_M MIPS_R_S6 99 - #define r_tmp_imm MIPS_R_T6 /* No need to preserve this */ 100 - #define r_tmp MIPS_R_T7 /* No need to preserve this */ 101 - #define r_zero MIPS_R_ZERO 102 - #define r_sp MIPS_R_SP 103 - #define r_ra MIPS_R_RA 104 67 105 68 #define SCRATCH_OFF(k) (4 * (k)) 106 69 ··· 73 108 #define SEEN_SREG_SFT (BPF_MEMWORDS + 1) 74 109 #define SEEN_SREG_BASE (1 << SEEN_SREG_SFT) 75 110 #define SEEN_SREG(x) (SEEN_SREG_BASE << (x)) 76 - #define SEEN_S0 SEEN_SREG(0) 77 - #define SEEN_S1 SEEN_SREG(1) 78 111 #define SEEN_OFF SEEN_SREG(2) 79 112 #define SEEN_A SEEN_SREG(3) 80 113 #define SEEN_X SEEN_SREG(4) 81 114 #define SEEN_SKB SEEN_SREG(5) 82 115 #define SEEN_MEM SEEN_SREG(6) 116 + /* SEEN_SK_DATA also implies skb_hl an skb_len */ 117 + #define SEEN_SKB_DATA (SEEN_SREG(7) | SEEN_SREG(1) | SEEN_SREG(0)) 83 118 84 119 /* Arguments used by JIT */ 85 120 #define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ ··· 542 577 /* Adjust the stack pointer */ 543 578 emit_stack_offset(-align_sp(offset), ctx); 544 579 545 - if (ctx->flags & SEEN_CALL) { 546 - /* Argument save area */ 547 - if (config_enabled(CONFIG_64BIT)) 548 - /* Bottom of current frame */ 549 - real_off = align_sp(offset) - RSIZE; 550 - else 551 - /* Top of previous frame */ 552 - real_off = align_sp(offset) + RSIZE; 553 - emit_store_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); 554 - emit_store_stack_reg(MIPS_R_A1, r_sp, real_off + RSIZE, ctx); 555 - 556 - real_off = 0; 557 - } 558 - 559 580 tmp_flags = sflags = ctx->flags >> SEEN_SREG_SFT; 560 581 /* sflags is essentially a bitmap */ 561 582 while (tmp_flags) { 562 583 if ((sflags >> i) & 0x1) { 563 584 emit_store_stack_reg(MIPS_R_S0 + i, r_sp, real_off, 564 585 ctx); 565 - real_off += RSIZE; 586 + real_off += SZREG; 566 587 } 567 588 i++; 568 589 tmp_flags >>= 1; ··· 557 606 /* save return address */ 558 607 if (ctx->flags & SEEN_CALL) { 559 608 emit_store_stack_reg(r_ra, r_sp, real_off, ctx); 560 - real_off += RSIZE; 609 + real_off += SZREG; 561 610 } 562 611 563 612 /* Setup r_M leaving the alignment gap if necessary */ 564 613 if (ctx->flags & SEEN_MEM) { 565 - if (real_off % (RSIZE * 2)) 566 - real_off += RSIZE; 614 + if (real_off % (SZREG * 2)) 615 + real_off += SZREG; 567 616 emit_long_instr(ctx, ADDIU, r_M, r_sp, real_off); 568 617 } 569 618 } ··· 574 623 int i, real_off = 0; 575 624 u32 sflags, tmp_flags; 576 625 577 - if (ctx->flags & SEEN_CALL) { 578 - if (config_enabled(CONFIG_64BIT)) 579 - /* Bottom of current frame */ 580 - real_off = align_sp(offset) - RSIZE; 581 - else 582 - /* Top of previous frame */ 583 - real_off = align_sp(offset) + RSIZE; 584 - emit_load_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); 585 - emit_load_stack_reg(MIPS_R_A1, r_sp, real_off + RSIZE, ctx); 586 - 587 - real_off = 0; 588 - } 589 - 590 626 tmp_flags = sflags = ctx->flags >> SEEN_SREG_SFT; 591 627 /* sflags is a bitmap */ 592 628 i = 0; ··· 581 643 if ((sflags >> i) & 0x1) { 582 644 emit_load_stack_reg(MIPS_R_S0 + i, r_sp, real_off, 583 645 ctx); 584 - real_off += RSIZE; 646 + real_off += SZREG; 585 647 } 586 648 i++; 587 649 tmp_flags >>= 1; ··· 601 663 602 664 603 665 /* How may s* regs do we need to preserved? */ 604 - sp_off += hweight32(ctx->flags >> SEEN_SREG_SFT) * RSIZE; 666 + sp_off += hweight32(ctx->flags >> SEEN_SREG_SFT) * SZREG; 605 667 606 668 if (ctx->flags & SEEN_MEM) 607 669 sp_off += 4 * BPF_MEMWORDS; /* BPF_MEMWORDS are 32-bit */ 608 670 609 671 if (ctx->flags & SEEN_CALL) 610 - /* 611 - * The JIT code make calls to external functions using 2 612 - * arguments. Therefore, for o32 we don't need to allocate 613 - * space because we don't care if the argumetns are lost 614 - * across calls. We do need however to preserve incoming 615 - * arguments but the space is already allocated for us by 616 - * the caller. On the other hand, for n64, we need to allocate 617 - * this space ourselves. We need to preserve $ra as well. 618 - */ 619 - sp_off += config_enabled(CONFIG_64BIT) ? 620 - (ARGS_USED_BY_JIT + 1) * RSIZE : RSIZE; 672 + sp_off += SZREG; /* Space for our ra register */ 621 673 622 674 return sp_off; 623 675 } ··· 623 695 624 696 if (ctx->flags & SEEN_SKB) 625 697 emit_reg_move(r_skb, MIPS_R_A0, ctx); 698 + 699 + if (ctx->flags & SEEN_SKB_DATA) { 700 + /* Load packet length */ 701 + emit_load(r_skb_len, r_skb, offsetof(struct sk_buff, len), 702 + ctx); 703 + emit_load(r_tmp, r_skb, offsetof(struct sk_buff, data_len), 704 + ctx); 705 + /* Load the data pointer */ 706 + emit_load_ptr(r_skb_data, r_skb, 707 + offsetof(struct sk_buff, data), ctx); 708 + /* Load the header length */ 709 + emit_subu(r_skb_hl, r_skb_len, r_tmp, ctx); 710 + } 626 711 627 712 if (ctx->flags & SEEN_X) 628 713 emit_jit_reg_move(r_X, r_zero, ctx); ··· 659 718 emit_nop(ctx); 660 719 } 661 720 662 - static u64 jit_get_skb_b(struct sk_buff *skb, unsigned offset) 663 - { 664 - u8 ret; 665 - int err; 666 - 667 - err = skb_copy_bits(skb, offset, &ret, 1); 668 - 669 - return (u64)err << 32 | ret; 670 - } 671 - 672 - static u64 jit_get_skb_h(struct sk_buff *skb, unsigned offset) 673 - { 674 - u16 ret; 675 - int err; 676 - 677 - err = skb_copy_bits(skb, offset, &ret, 2); 678 - 679 - return (u64)err << 32 | ntohs(ret); 680 - } 681 - 682 - static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset) 683 - { 684 - u32 ret; 685 - int err; 686 - 687 - err = skb_copy_bits(skb, offset, &ret, 4); 688 - 689 - return (u64)err << 32 | ntohl(ret); 690 - } 721 + #define CHOOSE_LOAD_FUNC(K, func) \ 722 + ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative : func) : \ 723 + func##_positive) 691 724 692 725 static int build_body(struct jit_ctx *ctx) 693 726 { 694 - void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w}; 695 727 const struct bpf_prog *prog = ctx->skf; 696 728 const struct sock_filter *inst; 697 - unsigned int i, off, load_order, condt; 729 + unsigned int i, off, condt; 698 730 u32 k, b_off __maybe_unused; 731 + u8 (*sk_load_func)(unsigned long *skb, int offset); 699 732 700 733 for (i = 0; i < prog->len; i++) { 701 734 u16 code; ··· 703 788 break; 704 789 case BPF_LD | BPF_W | BPF_ABS: 705 790 /* A <- P[k:4] */ 706 - load_order = 2; 791 + sk_load_func = CHOOSE_LOAD_FUNC(k, sk_load_word); 707 792 goto load; 708 793 case BPF_LD | BPF_H | BPF_ABS: 709 794 /* A <- P[k:2] */ 710 - load_order = 1; 795 + sk_load_func = CHOOSE_LOAD_FUNC(k, sk_load_half); 711 796 goto load; 712 797 case BPF_LD | BPF_B | BPF_ABS: 713 798 /* A <- P[k:1] */ 714 - load_order = 0; 799 + sk_load_func = CHOOSE_LOAD_FUNC(k, sk_load_byte); 715 800 load: 716 - /* the interpreter will deal with the negative K */ 717 - if ((int)k < 0) 718 - return -ENOTSUPP; 719 - 720 801 emit_load_imm(r_off, k, ctx); 721 802 load_common: 722 - /* 723 - * We may got here from the indirect loads so 724 - * return if offset is negative. 725 - */ 726 - emit_slt(r_s0, r_off, r_zero, ctx); 727 - emit_bcond(MIPS_COND_NE, r_s0, r_zero, 728 - b_imm(prog->len, ctx), ctx); 729 - emit_reg_move(r_ret, r_zero, ctx); 803 + ctx->flags |= SEEN_CALL | SEEN_OFF | 804 + SEEN_SKB | SEEN_A | SEEN_SKB_DATA; 730 805 731 - ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 | 732 - SEEN_SKB | SEEN_A; 733 - 734 - emit_load_func(r_s0, (ptr)load_func[load_order], 735 - ctx); 806 + emit_load_func(r_s0, (ptr)sk_load_func, ctx); 736 807 emit_reg_move(MIPS_R_A0, r_skb, ctx); 737 808 emit_jalr(MIPS_R_RA, r_s0, ctx); 738 809 /* Load second argument to delay slot */ 739 810 emit_reg_move(MIPS_R_A1, r_off, ctx); 740 811 /* Check the error value */ 741 - if (config_enabled(CONFIG_64BIT)) { 742 - /* Get error code from the top 32-bits */ 743 - emit_dsrl32(r_s0, r_val, 0, ctx); 744 - /* Branch to 3 instructions ahead */ 745 - emit_bcond(MIPS_COND_NE, r_s0, r_zero, 3 << 2, 746 - ctx); 747 - } else { 748 - /* Branch to 3 instructions ahead */ 749 - emit_bcond(MIPS_COND_NE, r_err, r_zero, 3 << 2, 750 - ctx); 751 - } 752 - emit_nop(ctx); 753 - /* We are good */ 754 - emit_b(b_imm(i + 1, ctx), ctx); 755 - emit_jit_reg_move(r_A, r_val, ctx); 812 + emit_bcond(MIPS_COND_EQ, r_ret, 0, b_imm(i + 1, ctx), 813 + ctx); 814 + /* Load return register on DS for failures */ 815 + emit_reg_move(r_ret, r_zero, ctx); 756 816 /* Return with error */ 757 817 emit_b(b_imm(prog->len, ctx), ctx); 758 - emit_reg_move(r_ret, r_zero, ctx); 818 + emit_nop(ctx); 759 819 break; 760 820 case BPF_LD | BPF_W | BPF_IND: 761 821 /* A <- P[X + k:4] */ 762 - load_order = 2; 822 + sk_load_func = sk_load_word; 763 823 goto load_ind; 764 824 case BPF_LD | BPF_H | BPF_IND: 765 825 /* A <- P[X + k:2] */ 766 - load_order = 1; 826 + sk_load_func = sk_load_half; 767 827 goto load_ind; 768 828 case BPF_LD | BPF_B | BPF_IND: 769 829 /* A <- P[X + k:1] */ 770 - load_order = 0; 830 + sk_load_func = sk_load_byte; 771 831 load_ind: 772 832 ctx->flags |= SEEN_OFF | SEEN_X; 773 833 emit_addiu(r_off, r_X, k, ctx); ··· 764 874 emit_load(r_X, r_skb, off, ctx); 765 875 break; 766 876 case BPF_LDX | BPF_B | BPF_MSH: 767 - /* the interpreter will deal with the negative K */ 768 - if ((int)k < 0) 769 - return -ENOTSUPP; 770 - 771 877 /* X <- 4 * (P[k:1] & 0xf) */ 772 - ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB; 878 + ctx->flags |= SEEN_X | SEEN_CALL | SEEN_SKB; 773 879 /* Load offset to a1 */ 774 - emit_load_func(r_s0, (ptr)jit_get_skb_b, ctx); 880 + emit_load_func(r_s0, (ptr)sk_load_byte, ctx); 775 881 /* 776 882 * This may emit two instructions so it may not fit 777 883 * in the delay slot. So use a0 in the delay slot. ··· 776 890 emit_jalr(MIPS_R_RA, r_s0, ctx); 777 891 emit_reg_move(MIPS_R_A0, r_skb, ctx); /* delay slot */ 778 892 /* Check the error value */ 779 - if (config_enabled(CONFIG_64BIT)) { 780 - /* Top 32-bits of $v0 on 64-bit */ 781 - emit_dsrl32(r_s0, r_val, 0, ctx); 782 - emit_bcond(MIPS_COND_NE, r_s0, r_zero, 783 - 3 << 2, ctx); 784 - } else { 785 - emit_bcond(MIPS_COND_NE, r_err, r_zero, 786 - 3 << 2, ctx); 787 - } 788 - /* No need for delay slot */ 893 + emit_bcond(MIPS_COND_NE, r_ret, 0, 894 + b_imm(prog->len, ctx), ctx); 895 + emit_reg_move(r_ret, r_zero, ctx); 789 896 /* We are good */ 790 897 /* X <- P[1:K] & 0xf */ 791 - emit_andi(r_X, r_val, 0xf, ctx); 898 + emit_andi(r_X, r_A, 0xf, ctx); 792 899 /* X << 2 */ 793 900 emit_b(b_imm(i + 1, ctx), ctx); 794 901 emit_sll(r_X, r_X, 2, ctx); /* delay slot */ 795 - /* Return with error */ 796 - emit_b(b_imm(prog->len, ctx), ctx); 797 - emit_load_imm(r_ret, 0, ctx); /* delay slot */ 798 902 break; 799 903 case BPF_ST: 800 904 /* M[k] <- A */ ··· 819 943 case BPF_ALU | BPF_MUL | BPF_K: 820 944 /* A *= K */ 821 945 /* Load K to scratch register before MUL */ 822 - ctx->flags |= SEEN_A | SEEN_S0; 946 + ctx->flags |= SEEN_A; 823 947 emit_load_imm(r_s0, k, ctx); 824 948 emit_mul(r_A, r_A, r_s0, ctx); 825 949 break; ··· 837 961 emit_srl(r_A, r_A, k, ctx); 838 962 break; 839 963 } 840 - ctx->flags |= SEEN_A | SEEN_S0; 964 + ctx->flags |= SEEN_A; 841 965 emit_load_imm(r_s0, k, ctx); 842 966 emit_div(r_A, r_s0, ctx); 843 967 break; ··· 847 971 ctx->flags |= SEEN_A; 848 972 emit_jit_reg_move(r_A, r_zero, ctx); 849 973 } else { 850 - ctx->flags |= SEEN_A | SEEN_S0; 974 + ctx->flags |= SEEN_A; 851 975 emit_load_imm(r_s0, k, ctx); 852 976 emit_mod(r_A, r_s0, ctx); 853 977 } ··· 858 982 /* Check if r_X is zero */ 859 983 emit_bcond(MIPS_COND_EQ, r_X, r_zero, 860 984 b_imm(prog->len, ctx), ctx); 861 - emit_load_imm(r_val, 0, ctx); /* delay slot */ 985 + emit_load_imm(r_ret, 0, ctx); /* delay slot */ 862 986 emit_div(r_A, r_X, ctx); 863 987 break; 864 988 case BPF_ALU | BPF_MOD | BPF_X: ··· 867 991 /* Check if r_X is zero */ 868 992 emit_bcond(MIPS_COND_EQ, r_X, r_zero, 869 993 b_imm(prog->len, ctx), ctx); 870 - emit_load_imm(r_val, 0, ctx); /* delay slot */ 994 + emit_load_imm(r_ret, 0, ctx); /* delay slot */ 871 995 emit_mod(r_A, r_X, ctx); 872 996 break; 873 997 case BPF_ALU | BPF_OR | BPF_K: ··· 961 1085 if ((condt & MIPS_COND_GE) || 962 1086 (condt & MIPS_COND_GT)) { 963 1087 if (condt & MIPS_COND_K) { /* K */ 964 - ctx->flags |= SEEN_S0 | SEEN_A; 1088 + ctx->flags |= SEEN_A; 965 1089 emit_sltiu(r_s0, r_A, k, ctx); 966 1090 } else { /* X */ 967 - ctx->flags |= SEEN_S0 | SEEN_A | 1091 + ctx->flags |= SEEN_A | 968 1092 SEEN_X; 969 1093 emit_sltu(r_s0, r_A, r_X, ctx); 970 1094 } ··· 976 1100 /* A > (K|X) ? scratch = 0 */ 977 1101 if (condt & MIPS_COND_GT) { 978 1102 /* Checking for equality */ 979 - ctx->flags |= SEEN_S0 | SEEN_A | SEEN_X; 1103 + ctx->flags |= SEEN_A | SEEN_X; 980 1104 if (condt & MIPS_COND_K) 981 1105 emit_load_imm(r_s0, k, ctx); 982 1106 else ··· 999 1123 } else { 1000 1124 /* A == K|X */ 1001 1125 if (condt & MIPS_COND_K) { /* K */ 1002 - ctx->flags |= SEEN_S0 | SEEN_A; 1126 + ctx->flags |= SEEN_A; 1003 1127 emit_load_imm(r_s0, k, ctx); 1004 1128 /* jump true */ 1005 1129 b_off = b_imm(i + inst->jt + 1, ctx); ··· 1029 1153 } 1030 1154 break; 1031 1155 case BPF_JMP | BPF_JSET | BPF_K: 1032 - ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A; 1156 + ctx->flags |= SEEN_A; 1033 1157 /* pc += (A & K) ? pc -> jt : pc -> jf */ 1034 1158 emit_load_imm(r_s1, k, ctx); 1035 1159 emit_and(r_s0, r_A, r_s1, ctx); ··· 1043 1167 emit_nop(ctx); 1044 1168 break; 1045 1169 case BPF_JMP | BPF_JSET | BPF_X: 1046 - ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A; 1170 + ctx->flags |= SEEN_X | SEEN_A; 1047 1171 /* pc += (A & X) ? pc -> jt : pc -> jf */ 1048 1172 emit_and(r_s0, r_A, r_X, ctx); 1049 1173 /* jump true */ ··· 1127 1251 break; 1128 1252 case BPF_ANC | SKF_AD_IFINDEX: 1129 1253 /* A = skb->dev->ifindex */ 1130 - ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0; 1254 + ctx->flags |= SEEN_SKB | SEEN_A; 1131 1255 off = offsetof(struct sk_buff, dev); 1132 1256 /* Load *dev pointer */ 1133 1257 emit_load_ptr(r_s0, r_skb, off, ctx); ··· 1154 1278 break; 1155 1279 case BPF_ANC | SKF_AD_VLAN_TAG: 1156 1280 case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: 1157 - ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A; 1281 + ctx->flags |= SEEN_SKB | SEEN_A; 1158 1282 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 1159 1283 vlan_tci) != 2); 1160 1284 off = offsetof(struct sk_buff, vlan_tci);
+41 -1
arch/mips/net/bpf_jit.h
··· 15 15 /* Registers used by JIT */ 16 16 #define MIPS_R_ZERO 0 17 17 #define MIPS_R_V0 2 18 - #define MIPS_R_V1 3 19 18 #define MIPS_R_A0 4 20 19 #define MIPS_R_A1 5 20 + #define MIPS_R_T4 12 21 + #define MIPS_R_T5 13 21 22 #define MIPS_R_T6 14 22 23 #define MIPS_R_T7 15 23 24 #define MIPS_R_S0 16 ··· 41 40 /* Conditionals on X register or K immediate */ 42 41 #define MIPS_COND_X (0x1 << 5) 43 42 #define MIPS_COND_K (0x1 << 6) 43 + 44 + #define r_ret MIPS_R_V0 45 + 46 + /* 47 + * Use 2 scratch registers to avoid pipeline interlocks. 48 + * There is no overhead during epilogue and prologue since 49 + * any of the $s0-$s6 registers will only be preserved if 50 + * they are going to actually be used. 51 + */ 52 + #define r_skb_hl MIPS_R_S0 /* skb header length */ 53 + #define r_skb_data MIPS_R_S1 /* skb actual data */ 54 + #define r_off MIPS_R_S2 55 + #define r_A MIPS_R_S3 56 + #define r_X MIPS_R_S4 57 + #define r_skb MIPS_R_S5 58 + #define r_M MIPS_R_S6 59 + #define r_skb_len MIPS_R_S7 60 + #define r_s0 MIPS_R_T4 /* scratch reg 1 */ 61 + #define r_s1 MIPS_R_T5 /* scratch reg 2 */ 62 + #define r_tmp_imm MIPS_R_T6 /* No need to preserve this */ 63 + #define r_tmp MIPS_R_T7 /* No need to preserve this */ 64 + #define r_zero MIPS_R_ZERO 65 + #define r_sp MIPS_R_SP 66 + #define r_ra MIPS_R_RA 67 + 68 + #ifndef __ASSEMBLY__ 69 + 70 + /* Declare ASM helpers */ 71 + 72 + #define DECLARE_LOAD_FUNC(func) \ 73 + extern u8 func(unsigned long *skb, int offset); \ 74 + extern u8 func##_negative(unsigned long *skb, int offset); \ 75 + extern u8 func##_positive(unsigned long *skb, int offset) 76 + 77 + DECLARE_LOAD_FUNC(sk_load_word); 78 + DECLARE_LOAD_FUNC(sk_load_half); 79 + DECLARE_LOAD_FUNC(sk_load_byte); 80 + 81 + #endif 44 82 45 83 #endif /* BPF_JIT_MIPS_OP_H */
+238
arch/mips/net/bpf_jit_asm.S
··· 1 + /* 2 + * bpf_jib_asm.S: Packet/header access helper functions for MIPS/MIPS64 BPF 3 + * compiler. 4 + * 5 + * Copyright (C) 2015 Imagination Technologies Ltd. 6 + * Author: Markos Chandras <markos.chandras@imgtec.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; version 2 of the License. 11 + */ 12 + 13 + #include <asm/asm.h> 14 + #include <asm/regdef.h> 15 + #include "bpf_jit.h" 16 + 17 + /* ABI 18 + * 19 + * r_skb_hl skb header length 20 + * r_skb_data skb data 21 + * r_off(a1) offset register 22 + * r_A BPF register A 23 + * r_X PF register X 24 + * r_skb(a0) *skb 25 + * r_M *scratch memory 26 + * r_skb_le skb length 27 + * r_s0 Scratch register 0 28 + * r_s1 Scratch register 1 29 + * 30 + * On entry: 31 + * a0: *skb 32 + * a1: offset (imm or imm + X) 33 + * 34 + * All non-BPF-ABI registers are free for use. On return, we only 35 + * care about r_ret. The BPF-ABI registers are assumed to remain 36 + * unmodified during the entire filter operation. 37 + */ 38 + 39 + #define skb a0 40 + #define offset a1 41 + #define SKF_LL_OFF (-0x200000) /* Can't include linux/filter.h in assembly */ 42 + 43 + /* We know better :) so prevent assembler reordering etc */ 44 + .set noreorder 45 + 46 + #define is_offset_negative(TYPE) \ 47 + /* If offset is negative we have more work to do */ \ 48 + slti t0, offset, 0; \ 49 + bgtz t0, bpf_slow_path_##TYPE##_neg; \ 50 + /* Be careful what follows in DS. */ 51 + 52 + #define is_offset_in_header(SIZE, TYPE) \ 53 + /* Reading from header? */ \ 54 + addiu $r_s0, $r_skb_hl, -SIZE; \ 55 + slt t0, $r_s0, offset; \ 56 + bgtz t0, bpf_slow_path_##TYPE; \ 57 + 58 + LEAF(sk_load_word) 59 + is_offset_negative(word) 60 + .globl sk_load_word_positive 61 + sk_load_word_positive: 62 + is_offset_in_header(4, word) 63 + /* Offset within header boundaries */ 64 + PTR_ADDU t1, $r_skb_data, offset 65 + lw $r_A, 0(t1) 66 + #ifdef CONFIG_CPU_LITTLE_ENDIAN 67 + wsbh t0, $r_A 68 + rotr $r_A, t0, 16 69 + #endif 70 + jr $r_ra 71 + move $r_ret, zero 72 + END(sk_load_word) 73 + 74 + LEAF(sk_load_half) 75 + is_offset_negative(half) 76 + .globl sk_load_half_positive 77 + sk_load_half_positive: 78 + is_offset_in_header(2, half) 79 + /* Offset within header boundaries */ 80 + PTR_ADDU t1, $r_skb_data, offset 81 + lh $r_A, 0(t1) 82 + #ifdef CONFIG_CPU_LITTLE_ENDIAN 83 + wsbh t0, $r_A 84 + seh $r_A, t0 85 + #endif 86 + jr $r_ra 87 + move $r_ret, zero 88 + END(sk_load_half) 89 + 90 + LEAF(sk_load_byte) 91 + is_offset_negative(byte) 92 + .globl sk_load_byte_positive 93 + sk_load_byte_positive: 94 + is_offset_in_header(1, byte) 95 + /* Offset within header boundaries */ 96 + PTR_ADDU t1, $r_skb_data, offset 97 + lb $r_A, 0(t1) 98 + jr $r_ra 99 + move $r_ret, zero 100 + END(sk_load_byte) 101 + 102 + /* 103 + * call skb_copy_bits: 104 + * (prototype in linux/skbuff.h) 105 + * 106 + * int skb_copy_bits(sk_buff *skb, int offset, void *to, int len) 107 + * 108 + * o32 mandates we leave 4 spaces for argument registers in case 109 + * the callee needs to use them. Even though we don't care about 110 + * the argument registers ourselves, we need to allocate that space 111 + * to remain ABI compliant since the callee may want to use that space. 112 + * We also allocate 2 more spaces for $r_ra and our return register (*to). 113 + * 114 + * n64 is a bit different. The *caller* will allocate the space to preserve 115 + * the arguments. So in 64-bit kernels, we allocate the 4-arg space for no 116 + * good reason but it does not matter that much really. 117 + * 118 + * (void *to) is returned in r_s0 119 + * 120 + */ 121 + #define bpf_slow_path_common(SIZE) \ 122 + /* Quick check. Are we within reasonable boundaries? */ \ 123 + LONG_ADDIU $r_s1, $r_skb_len, -SIZE; \ 124 + sltu $r_s0, offset, $r_s1; \ 125 + beqz $r_s0, fault; \ 126 + /* Load 4th argument in DS */ \ 127 + LONG_ADDIU a3, zero, SIZE; \ 128 + PTR_ADDIU $r_sp, $r_sp, -(6 * SZREG); \ 129 + PTR_LA t0, skb_copy_bits; \ 130 + PTR_S $r_ra, (5 * SZREG)($r_sp); \ 131 + /* Assign low slot to a2 */ \ 132 + move a2, $r_sp; \ 133 + jalr t0; \ 134 + /* Reset our destination slot (DS but it's ok) */ \ 135 + INT_S zero, (4 * SZREG)($r_sp); \ 136 + /* \ 137 + * skb_copy_bits returns 0 on success and -EFAULT \ 138 + * on error. Our data live in a2. Do not bother with \ 139 + * our data if an error has been returned. \ 140 + */ \ 141 + /* Restore our frame */ \ 142 + PTR_L $r_ra, (5 * SZREG)($r_sp); \ 143 + INT_L $r_s0, (4 * SZREG)($r_sp); \ 144 + bltz v0, fault; \ 145 + PTR_ADDIU $r_sp, $r_sp, 6 * SZREG; \ 146 + move $r_ret, zero; \ 147 + 148 + NESTED(bpf_slow_path_word, (6 * SZREG), $r_sp) 149 + bpf_slow_path_common(4) 150 + #ifdef CONFIG_CPU_LITTLE_ENDIAN 151 + wsbh t0, $r_s0 152 + jr $r_ra 153 + rotr $r_A, t0, 16 154 + #endif 155 + jr $r_ra 156 + move $r_A, $r_s0 157 + 158 + END(bpf_slow_path_word) 159 + 160 + NESTED(bpf_slow_path_half, (6 * SZREG), $r_sp) 161 + bpf_slow_path_common(2) 162 + #ifdef CONFIG_CPU_LITTLE_ENDIAN 163 + jr $r_ra 164 + wsbh $r_A, $r_s0 165 + #endif 166 + jr $r_ra 167 + move $r_A, $r_s0 168 + 169 + END(bpf_slow_path_half) 170 + 171 + NESTED(bpf_slow_path_byte, (6 * SZREG), $r_sp) 172 + bpf_slow_path_common(1) 173 + jr $r_ra 174 + move $r_A, $r_s0 175 + 176 + END(bpf_slow_path_byte) 177 + 178 + /* 179 + * Negative entry points 180 + */ 181 + .macro bpf_is_end_of_data 182 + li t0, SKF_LL_OFF 183 + /* Reading link layer data? */ 184 + slt t1, offset, t0 185 + bgtz t1, fault 186 + /* Be careful what follows in DS. */ 187 + .endm 188 + /* 189 + * call skb_copy_bits: 190 + * (prototype in linux/filter.h) 191 + * 192 + * void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, 193 + * int k, unsigned int size) 194 + * 195 + * see above (bpf_slow_path_common) for ABI restrictions 196 + */ 197 + #define bpf_negative_common(SIZE) \ 198 + PTR_ADDIU $r_sp, $r_sp, -(6 * SZREG); \ 199 + PTR_LA t0, bpf_internal_load_pointer_neg_helper; \ 200 + PTR_S $r_ra, (5 * SZREG)($r_sp); \ 201 + jalr t0; \ 202 + li a2, SIZE; \ 203 + PTR_L $r_ra, (5 * SZREG)($r_sp); \ 204 + /* Check return pointer */ \ 205 + beqz v0, fault; \ 206 + PTR_ADDIU $r_sp, $r_sp, 6 * SZREG; \ 207 + /* Preserve our pointer */ \ 208 + move $r_s0, v0; \ 209 + /* Set return value */ \ 210 + move $r_ret, zero; \ 211 + 212 + bpf_slow_path_word_neg: 213 + bpf_is_end_of_data 214 + NESTED(sk_load_word_negative, (6 * SZREG), $r_sp) 215 + bpf_negative_common(4) 216 + jr $r_ra 217 + lw $r_A, 0($r_s0) 218 + END(sk_load_word_negative) 219 + 220 + bpf_slow_path_half_neg: 221 + bpf_is_end_of_data 222 + NESTED(sk_load_half_negative, (6 * SZREG), $r_sp) 223 + bpf_negative_common(2) 224 + jr $r_ra 225 + lhu $r_A, 0($r_s0) 226 + END(sk_load_half_negative) 227 + 228 + bpf_slow_path_byte_neg: 229 + bpf_is_end_of_data 230 + NESTED(sk_load_byte_negative, (6 * SZREG), $r_sp) 231 + bpf_negative_common(1) 232 + jr $r_ra 233 + lbu $r_A, 0($r_s0) 234 + END(sk_load_byte_negative) 235 + 236 + fault: 237 + jr $r_ra 238 + addiu $r_ret, zero, 1
-3
arch/mips/netlogic/xlr/platform-flash.c
··· 78 78 .resource = xlr_nor_res, 79 79 }; 80 80 81 - const char *xlr_part_probes[] = { "cmdlinepart", NULL }; 82 - 83 81 /* 84 82 * Use "gen_nand" driver for NAND flash 85 83 * ··· 109 111 .nr_partitions = ARRAY_SIZE(xlr_nand_parts), 110 112 .chip_delay = 50, 111 113 .partitions = xlr_nand_parts, 112 - .part_probe_types = xlr_part_probes, 113 114 }, 114 115 .ctrl = { 115 116 .cmd_ctrl = xlr_nand_ctrl,
+1 -1
arch/mips/pci/pci-ar2315.c
··· 320 320 321 321 static void ar2315_pci_irq_handler(unsigned irq, struct irq_desc *desc) 322 322 { 323 - struct ar2315_pci_ctrl *apc = irq_get_handler_data(irq); 323 + struct ar2315_pci_ctrl *apc = irq_desc_get_handler_data(desc); 324 324 u32 pending = ar2315_pci_reg_read(apc, AR2315_PCI_ISR) & 325 325 ar2315_pci_reg_read(apc, AR2315_PCI_IMR); 326 326 unsigned pci_irq = 0;
+2 -12
arch/mips/pci/pci-ar71xx.c
··· 232 232 void __iomem *base = ath79_reset_base; 233 233 u32 pending; 234 234 235 - apc = irq_get_handler_data(irq); 235 + apc = irq_desc_get_handler_data(desc); 236 236 237 237 pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & 238 238 __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); ··· 318 318 319 319 static void ar71xx_pci_reset(void) 320 320 { 321 - void __iomem *ddr_base = ath79_ddr_base; 322 - 323 321 ath79_device_reset_set(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); 324 322 mdelay(100); 325 323 326 324 ath79_device_reset_clear(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); 327 325 mdelay(100); 328 326 329 - __raw_writel(AR71XX_PCI_WIN0_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN0); 330 - __raw_writel(AR71XX_PCI_WIN1_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN1); 331 - __raw_writel(AR71XX_PCI_WIN2_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN2); 332 - __raw_writel(AR71XX_PCI_WIN3_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN3); 333 - __raw_writel(AR71XX_PCI_WIN4_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN4); 334 - __raw_writel(AR71XX_PCI_WIN5_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN5); 335 - __raw_writel(AR71XX_PCI_WIN6_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN6); 336 - __raw_writel(AR71XX_PCI_WIN7_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN7); 337 - 327 + ath79_ddr_set_pci_windows(); 338 328 mdelay(100); 339 329 } 340 330
+1 -1
arch/mips/pci/pci-ar724x.c
··· 231 231 void __iomem *base; 232 232 u32 pending; 233 233 234 - apc = irq_get_handler_data(irq); 234 + apc = irq_desc_get_handler_data(desc); 235 235 base = apc->ctrl_base; 236 236 237 237 pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) &
+1 -1
arch/mips/pci/pci-rt3883.c
··· 134 134 struct rt3883_pci_controller *rpc; 135 135 u32 pending; 136 136 137 - rpc = irq_get_handler_data(irq); 137 + rpc = irq_desc_get_handler_data(desc); 138 138 139 139 pending = rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIINT) & 140 140 rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA);
+1 -1
arch/mips/ralink/irq.c
··· 100 100 u32 pending = rt_intc_r32(INTC_REG_STATUS0); 101 101 102 102 if (pending) { 103 - struct irq_domain *domain = irq_get_handler_data(irq); 103 + struct irq_domain *domain = irq_desc_get_handler_data(desc); 104 104 generic_handle_irq(irq_find_mapping(domain, __ffs(pending))); 105 105 } else { 106 106 spurious_interrupt();
+3 -3
arch/mips/sgi-ip27/Makefile
··· 2 2 # Makefile for the IP27 specific kernel interface routines under Linux. 3 3 # 4 4 5 - obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \ 6 - ip27-memory.o ip27-nmi.o ip27-reset.o ip27-timer.o ip27-hubio.o \ 7 - ip27-xtalk.o 5 + obj-y := ip27-berr.o ip27-irq.o ip27-irqno.o ip27-init.o ip27-klconfig.o \ 6 + ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o ip27-timer.o \ 7 + ip27-hubio.o ip27-xtalk.o 8 8 9 9 obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o 10 10 obj-$(CONFIG_PCI) += ip27-irq-pci.o
+48
arch/mips/sgi-ip27/ip27-irqno.c
··· 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 + #include <linux/init.h> 7 + #include <linux/irq.h> 8 + #include <linux/types.h> 9 + 10 + #include <asm/barrier.h> 11 + 12 + static DECLARE_BITMAP(irq_map, NR_IRQS); 13 + 14 + int allocate_irqno(void) 15 + { 16 + int irq; 17 + 18 + again: 19 + irq = find_first_zero_bit(irq_map, NR_IRQS); 20 + 21 + if (irq >= NR_IRQS) 22 + return -ENOSPC; 23 + 24 + if (test_and_set_bit(irq, irq_map)) 25 + goto again; 26 + 27 + return irq; 28 + } 29 + 30 + /* 31 + * Allocate the 16 legacy interrupts for i8259 devices. This happens early 32 + * in the kernel initialization so treating allocation failure as BUG() is 33 + * ok. 34 + */ 35 + void __init alloc_legacy_irqno(void) 36 + { 37 + int i; 38 + 39 + for (i = 0; i <= 16; i++) 40 + BUG_ON(test_and_set_bit(i, irq_map)); 41 + } 42 + 43 + void free_irqno(unsigned int irq) 44 + { 45 + smp_mb__before_atomic(); 46 + clear_bit(irq, irq_map); 47 + smp_mb__after_atomic(); 48 + }
+8 -8
arch/mips/sibyte/Kconfig
··· 3 3 select CEVT_SB1250 4 4 select CSRC_SB1250 5 5 select HW_HAS_PCI 6 - select IRQ_CPU 6 + select IRQ_MIPS_CPU 7 7 select SIBYTE_ENABLE_LDT_IF_PCI 8 8 select SIBYTE_HAS_ZBUS_PROFILING 9 9 select SIBYTE_SB1xxx_SOC ··· 13 13 bool 14 14 select CEVT_SB1250 15 15 select CSRC_SB1250 16 - select IRQ_CPU 16 + select IRQ_MIPS_CPU 17 17 select SIBYTE_BCM112X 18 18 select SIBYTE_HAS_ZBUS_PROFILING 19 19 select SIBYTE_SB1xxx_SOC ··· 23 23 select CEVT_SB1250 24 24 select CSRC_SB1250 25 25 select HW_HAS_PCI 26 - select IRQ_CPU 26 + select IRQ_MIPS_CPU 27 27 select SIBYTE_BCM112X 28 28 select SIBYTE_HAS_ZBUS_PROFILING 29 29 select SIBYTE_SB1xxx_SOC ··· 33 33 select CEVT_SB1250 34 34 select CSRC_SB1250 35 35 select HW_HAS_PCI 36 - select IRQ_CPU 36 + select IRQ_MIPS_CPU 37 37 select SIBYTE_BCM112X 38 38 select SIBYTE_ENABLE_LDT_IF_PCI 39 39 select SIBYTE_HAS_ZBUS_PROFILING ··· 43 43 bool 44 44 select CEVT_SB1250 45 45 select CSRC_SB1250 46 - select IRQ_CPU 46 + select IRQ_MIPS_CPU 47 47 select SIBYTE_SB1xxx_SOC 48 48 select SIBYTE_HAS_ZBUS_PROFILING 49 49 ··· 52 52 select CEVT_BCM1480 53 53 select CSRC_BCM1480 54 54 select HW_HAS_PCI 55 - select IRQ_CPU 55 + select IRQ_MIPS_CPU 56 56 select SIBYTE_HAS_ZBUS_PROFILING 57 57 select SIBYTE_SB1xxx_SOC 58 58 select SYS_SUPPORTS_SMP ··· 62 62 select CEVT_BCM1480 63 63 select CSRC_BCM1480 64 64 select HW_HAS_PCI 65 - select IRQ_CPU 65 + select IRQ_MIPS_CPU 66 66 select SIBYTE_SB1xxx_SOC 67 67 select SIBYTE_HAS_ZBUS_PROFILING 68 68 select SYS_SUPPORTS_SMP ··· 70 70 config SIBYTE_SB1xxx_SOC 71 71 bool 72 72 select DMA_COHERENT 73 - select IRQ_CPU 73 + select IRQ_MIPS_CPU 74 74 select SWAP_IO_SPACE 75 75 select SYS_SUPPORTS_32BIT_KERNEL 76 76 select SYS_SUPPORTS_64BIT_KERNEL
+1 -1
arch/mips/txx9/Kconfig
··· 8 8 select MACH_TXX9 9 9 select CEVT_R4K 10 10 select CSRC_R4K 11 - select IRQ_CPU 11 + select IRQ_MIPS_CPU 12 12 select SYS_HAS_CPU_TX49XX 13 13 select SYS_SUPPORTS_64BIT_KERNEL 14 14
+5 -5
arch/mips/vr41xx/Kconfig
··· 8 8 select CEVT_R4K 9 9 select CSRC_R4K 10 10 select DMA_NONCOHERENT 11 - select IRQ_CPU 11 + select IRQ_MIPS_CPU 12 12 select ISA 13 13 select SYS_SUPPORTS_32BIT_KERNEL 14 14 select SYS_SUPPORTS_LITTLE_ENDIAN ··· 18 18 select CEVT_R4K 19 19 select CSRC_R4K 20 20 select DMA_NONCOHERENT 21 - select IRQ_CPU 21 + select IRQ_MIPS_CPU 22 22 select ISA 23 23 select SYS_SUPPORTS_32BIT_KERNEL 24 24 select SYS_SUPPORTS_LITTLE_ENDIAN ··· 28 28 select CEVT_R4K 29 29 select CSRC_R4K 30 30 select DMA_NONCOHERENT 31 - select IRQ_CPU 31 + select IRQ_MIPS_CPU 32 32 select HW_HAS_PCI 33 33 select SYS_SUPPORTS_32BIT_KERNEL 34 34 select SYS_SUPPORTS_LITTLE_ENDIAN ··· 44 44 select CEVT_R4K 45 45 select CSRC_R4K 46 46 select DMA_NONCOHERENT 47 - select IRQ_CPU 47 + select IRQ_MIPS_CPU 48 48 select HW_HAS_PCI 49 49 select PCI_VR41XX 50 50 select SYS_SUPPORTS_32BIT_KERNEL ··· 55 55 select CEVT_R4K 56 56 select CSRC_R4K 57 57 select DMA_NONCOHERENT 58 - select IRQ_CPU 58 + select IRQ_MIPS_CPU 59 59 select HW_HAS_PCI 60 60 select PCI_VR41XX 61 61 select SYS_SUPPORTS_32BIT_KERNEL
+2 -1
drivers/clk/Makefile
··· 24 24 obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o 25 25 obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o 26 26 obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o 27 - obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o 27 + obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o 28 28 obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o 29 29 obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o 30 30 obj-$(CONFIG_COMMON_CLK_MAX77802) += clk-max77802.o ··· 51 51 obj-$(CONFIG_ARCH_HIP04) += hisilicon/ 52 52 obj-$(CONFIG_ARCH_HIX5HD2) += hisilicon/ 53 53 obj-$(CONFIG_ARCH_MXC) += imx/ 54 + obj-$(CONFIG_MACH_INGENIC) += ingenic/ 54 55 obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ 55 56 ifeq ($(CONFIG_COMMON_CLK), y) 56 57 obj-$(CONFIG_ARCH_MMP) += mmp/
+3
drivers/clk/ingenic/Makefile
··· 1 + obj-y += cgu.o 2 + obj-$(CONFIG_MACH_JZ4740) += jz4740-cgu.o 3 + obj-$(CONFIG_MACH_JZ4780) += jz4780-cgu.o
+711
drivers/clk/ingenic/cgu.c
··· 1 + /* 2 + * Ingenic SoC CGU driver 3 + * 4 + * Copyright (c) 2013-2015 Imagination Technologies 5 + * Author: Paul Burton <paul.burton@imgtec.com> 6 + * 7 + * This program is free software; you can redistribute it and/or 8 + * modify it under the terms of the GNU General Public License as 9 + * published by the Free Software Foundation; either version 2 of 10 + * the License, or (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #include <linux/bitops.h> 19 + #include <linux/clk-provider.h> 20 + #include <linux/clkdev.h> 21 + #include <linux/delay.h> 22 + #include <linux/math64.h> 23 + #include <linux/of.h> 24 + #include <linux/of_address.h> 25 + #include <linux/slab.h> 26 + #include <linux/spinlock.h> 27 + #include "cgu.h" 28 + 29 + #define MHZ (1000 * 1000) 30 + 31 + /** 32 + * ingenic_cgu_gate_get() - get the value of clock gate register bit 33 + * @cgu: reference to the CGU whose registers should be read 34 + * @info: info struct describing the gate bit 35 + * 36 + * Retrieves the state of the clock gate bit described by info. The 37 + * caller must hold cgu->lock. 38 + * 39 + * Return: true if the gate bit is set, else false. 40 + */ 41 + static inline bool 42 + ingenic_cgu_gate_get(struct ingenic_cgu *cgu, 43 + const struct ingenic_cgu_gate_info *info) 44 + { 45 + return readl(cgu->base + info->reg) & BIT(info->bit); 46 + } 47 + 48 + /** 49 + * ingenic_cgu_gate_set() - set the value of clock gate register bit 50 + * @cgu: reference to the CGU whose registers should be modified 51 + * @info: info struct describing the gate bit 52 + * @val: non-zero to gate a clock, otherwise zero 53 + * 54 + * Sets the given gate bit in order to gate or ungate a clock. 55 + * 56 + * The caller must hold cgu->lock. 57 + */ 58 + static inline void 59 + ingenic_cgu_gate_set(struct ingenic_cgu *cgu, 60 + const struct ingenic_cgu_gate_info *info, bool val) 61 + { 62 + u32 clkgr = readl(cgu->base + info->reg); 63 + 64 + if (val) 65 + clkgr |= BIT(info->bit); 66 + else 67 + clkgr &= ~BIT(info->bit); 68 + 69 + writel(clkgr, cgu->base + info->reg); 70 + } 71 + 72 + /* 73 + * PLL operations 74 + */ 75 + 76 + static unsigned long 77 + ingenic_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) 78 + { 79 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 80 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 81 + const struct ingenic_cgu_clk_info *clk_info; 82 + const struct ingenic_cgu_pll_info *pll_info; 83 + unsigned m, n, od_enc, od; 84 + bool bypass, enable; 85 + unsigned long flags; 86 + u32 ctl; 87 + 88 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 89 + BUG_ON(clk_info->type != CGU_CLK_PLL); 90 + pll_info = &clk_info->pll; 91 + 92 + spin_lock_irqsave(&cgu->lock, flags); 93 + ctl = readl(cgu->base + pll_info->reg); 94 + spin_unlock_irqrestore(&cgu->lock, flags); 95 + 96 + m = (ctl >> pll_info->m_shift) & GENMASK(pll_info->m_bits - 1, 0); 97 + m += pll_info->m_offset; 98 + n = (ctl >> pll_info->n_shift) & GENMASK(pll_info->n_bits - 1, 0); 99 + n += pll_info->n_offset; 100 + od_enc = ctl >> pll_info->od_shift; 101 + od_enc &= GENMASK(pll_info->od_bits - 1, 0); 102 + bypass = !!(ctl & BIT(pll_info->bypass_bit)); 103 + enable = !!(ctl & BIT(pll_info->enable_bit)); 104 + 105 + if (bypass) 106 + return parent_rate; 107 + 108 + if (!enable) 109 + return 0; 110 + 111 + for (od = 0; od < pll_info->od_max; od++) { 112 + if (pll_info->od_encoding[od] == od_enc) 113 + break; 114 + } 115 + BUG_ON(od == pll_info->od_max); 116 + od++; 117 + 118 + return div_u64((u64)parent_rate * m, n * od); 119 + } 120 + 121 + static unsigned long 122 + ingenic_pll_calc(const struct ingenic_cgu_clk_info *clk_info, 123 + unsigned long rate, unsigned long parent_rate, 124 + unsigned *pm, unsigned *pn, unsigned *pod) 125 + { 126 + const struct ingenic_cgu_pll_info *pll_info; 127 + unsigned m, n, od; 128 + 129 + pll_info = &clk_info->pll; 130 + od = 1; 131 + 132 + /* 133 + * The frequency after the input divider must be between 10 and 50 MHz. 134 + * The highest divider yields the best resolution. 135 + */ 136 + n = parent_rate / (10 * MHZ); 137 + n = min_t(unsigned, n, 1 << clk_info->pll.n_bits); 138 + n = max_t(unsigned, n, pll_info->n_offset); 139 + 140 + m = (rate / MHZ) * od * n / (parent_rate / MHZ); 141 + m = min_t(unsigned, m, 1 << clk_info->pll.m_bits); 142 + m = max_t(unsigned, m, pll_info->m_offset); 143 + 144 + if (pm) 145 + *pm = m; 146 + if (pn) 147 + *pn = n; 148 + if (pod) 149 + *pod = od; 150 + 151 + return div_u64((u64)parent_rate * m, n * od); 152 + } 153 + 154 + static long 155 + ingenic_pll_round_rate(struct clk_hw *hw, unsigned long req_rate, 156 + unsigned long *prate) 157 + { 158 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 159 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 160 + const struct ingenic_cgu_clk_info *clk_info; 161 + 162 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 163 + BUG_ON(clk_info->type != CGU_CLK_PLL); 164 + 165 + return ingenic_pll_calc(clk_info, req_rate, *prate, NULL, NULL, NULL); 166 + } 167 + 168 + static int 169 + ingenic_pll_set_rate(struct clk_hw *hw, unsigned long req_rate, 170 + unsigned long parent_rate) 171 + { 172 + const unsigned timeout = 100; 173 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 174 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 175 + const struct ingenic_cgu_clk_info *clk_info; 176 + const struct ingenic_cgu_pll_info *pll_info; 177 + unsigned long rate, flags; 178 + unsigned m, n, od, i; 179 + u32 ctl; 180 + 181 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 182 + BUG_ON(clk_info->type != CGU_CLK_PLL); 183 + pll_info = &clk_info->pll; 184 + 185 + rate = ingenic_pll_calc(clk_info, req_rate, parent_rate, 186 + &m, &n, &od); 187 + if (rate != req_rate) 188 + pr_info("ingenic-cgu: request '%s' rate %luHz, actual %luHz\n", 189 + clk_info->name, req_rate, rate); 190 + 191 + spin_lock_irqsave(&cgu->lock, flags); 192 + ctl = readl(cgu->base + pll_info->reg); 193 + 194 + ctl &= ~(GENMASK(pll_info->m_bits - 1, 0) << pll_info->m_shift); 195 + ctl |= (m - pll_info->m_offset) << pll_info->m_shift; 196 + 197 + ctl &= ~(GENMASK(pll_info->n_bits - 1, 0) << pll_info->n_shift); 198 + ctl |= (n - pll_info->n_offset) << pll_info->n_shift; 199 + 200 + ctl &= ~(GENMASK(pll_info->od_bits - 1, 0) << pll_info->od_shift); 201 + ctl |= pll_info->od_encoding[od - 1] << pll_info->od_shift; 202 + 203 + ctl &= ~BIT(pll_info->bypass_bit); 204 + ctl |= BIT(pll_info->enable_bit); 205 + 206 + writel(ctl, cgu->base + pll_info->reg); 207 + 208 + /* wait for the PLL to stabilise */ 209 + for (i = 0; i < timeout; i++) { 210 + ctl = readl(cgu->base + pll_info->reg); 211 + if (ctl & BIT(pll_info->stable_bit)) 212 + break; 213 + mdelay(1); 214 + } 215 + 216 + spin_unlock_irqrestore(&cgu->lock, flags); 217 + 218 + if (i == timeout) 219 + return -EBUSY; 220 + 221 + return 0; 222 + } 223 + 224 + static const struct clk_ops ingenic_pll_ops = { 225 + .recalc_rate = ingenic_pll_recalc_rate, 226 + .round_rate = ingenic_pll_round_rate, 227 + .set_rate = ingenic_pll_set_rate, 228 + }; 229 + 230 + /* 231 + * Operations for all non-PLL clocks 232 + */ 233 + 234 + static u8 ingenic_clk_get_parent(struct clk_hw *hw) 235 + { 236 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 237 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 238 + const struct ingenic_cgu_clk_info *clk_info; 239 + u32 reg; 240 + u8 i, hw_idx, idx = 0; 241 + 242 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 243 + 244 + if (clk_info->type & CGU_CLK_MUX) { 245 + reg = readl(cgu->base + clk_info->mux.reg); 246 + hw_idx = (reg >> clk_info->mux.shift) & 247 + GENMASK(clk_info->mux.bits - 1, 0); 248 + 249 + /* 250 + * Convert the hardware index to the parent index by skipping 251 + * over any -1's in the parents array. 252 + */ 253 + for (i = 0; i < hw_idx; i++) { 254 + if (clk_info->parents[i] != -1) 255 + idx++; 256 + } 257 + } 258 + 259 + return idx; 260 + } 261 + 262 + static int ingenic_clk_set_parent(struct clk_hw *hw, u8 idx) 263 + { 264 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 265 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 266 + const struct ingenic_cgu_clk_info *clk_info; 267 + unsigned long flags; 268 + u8 curr_idx, hw_idx, num_poss; 269 + u32 reg, mask; 270 + 271 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 272 + 273 + if (clk_info->type & CGU_CLK_MUX) { 274 + /* 275 + * Convert the parent index to the hardware index by adding 276 + * 1 for any -1 in the parents array preceding the given 277 + * index. That is, we want the index of idx'th entry in 278 + * clk_info->parents which does not equal -1. 279 + */ 280 + hw_idx = curr_idx = 0; 281 + num_poss = 1 << clk_info->mux.bits; 282 + for (; hw_idx < num_poss; hw_idx++) { 283 + if (clk_info->parents[hw_idx] == -1) 284 + continue; 285 + if (curr_idx == idx) 286 + break; 287 + curr_idx++; 288 + } 289 + 290 + /* idx should always be a valid parent */ 291 + BUG_ON(curr_idx != idx); 292 + 293 + mask = GENMASK(clk_info->mux.bits - 1, 0); 294 + mask <<= clk_info->mux.shift; 295 + 296 + spin_lock_irqsave(&cgu->lock, flags); 297 + 298 + /* write the register */ 299 + reg = readl(cgu->base + clk_info->mux.reg); 300 + reg &= ~mask; 301 + reg |= hw_idx << clk_info->mux.shift; 302 + writel(reg, cgu->base + clk_info->mux.reg); 303 + 304 + spin_unlock_irqrestore(&cgu->lock, flags); 305 + return 0; 306 + } 307 + 308 + return idx ? -EINVAL : 0; 309 + } 310 + 311 + static unsigned long 312 + ingenic_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) 313 + { 314 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 315 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 316 + const struct ingenic_cgu_clk_info *clk_info; 317 + unsigned long rate = parent_rate; 318 + u32 div_reg, div; 319 + 320 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 321 + 322 + if (clk_info->type & CGU_CLK_DIV) { 323 + div_reg = readl(cgu->base + clk_info->div.reg); 324 + div = (div_reg >> clk_info->div.shift) & 325 + GENMASK(clk_info->div.bits - 1, 0); 326 + div += 1; 327 + 328 + rate /= div; 329 + } 330 + 331 + return rate; 332 + } 333 + 334 + static unsigned 335 + ingenic_clk_calc_div(const struct ingenic_cgu_clk_info *clk_info, 336 + unsigned long parent_rate, unsigned long req_rate) 337 + { 338 + unsigned div; 339 + 340 + /* calculate the divide */ 341 + div = DIV_ROUND_UP(parent_rate, req_rate); 342 + 343 + /* and impose hardware constraints */ 344 + div = min_t(unsigned, div, 1 << clk_info->div.bits); 345 + div = max_t(unsigned, div, 1); 346 + 347 + return div; 348 + } 349 + 350 + static long 351 + ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate, 352 + unsigned long *parent_rate) 353 + { 354 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 355 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 356 + const struct ingenic_cgu_clk_info *clk_info; 357 + long rate = *parent_rate; 358 + 359 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 360 + 361 + if (clk_info->type & CGU_CLK_DIV) 362 + rate /= ingenic_clk_calc_div(clk_info, *parent_rate, req_rate); 363 + else if (clk_info->type & CGU_CLK_FIXDIV) 364 + rate /= clk_info->fixdiv.div; 365 + 366 + return rate; 367 + } 368 + 369 + static int 370 + ingenic_clk_set_rate(struct clk_hw *hw, unsigned long req_rate, 371 + unsigned long parent_rate) 372 + { 373 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 374 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 375 + const struct ingenic_cgu_clk_info *clk_info; 376 + const unsigned timeout = 100; 377 + unsigned long rate, flags; 378 + unsigned div, i; 379 + u32 reg, mask; 380 + int ret = 0; 381 + 382 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 383 + 384 + if (clk_info->type & CGU_CLK_DIV) { 385 + div = ingenic_clk_calc_div(clk_info, parent_rate, req_rate); 386 + rate = parent_rate / div; 387 + 388 + if (rate != req_rate) 389 + return -EINVAL; 390 + 391 + spin_lock_irqsave(&cgu->lock, flags); 392 + reg = readl(cgu->base + clk_info->div.reg); 393 + 394 + /* update the divide */ 395 + mask = GENMASK(clk_info->div.bits - 1, 0); 396 + reg &= ~(mask << clk_info->div.shift); 397 + reg |= (div - 1) << clk_info->div.shift; 398 + 399 + /* clear the stop bit */ 400 + if (clk_info->div.stop_bit != -1) 401 + reg &= ~BIT(clk_info->div.stop_bit); 402 + 403 + /* set the change enable bit */ 404 + if (clk_info->div.ce_bit != -1) 405 + reg |= BIT(clk_info->div.ce_bit); 406 + 407 + /* update the hardware */ 408 + writel(reg, cgu->base + clk_info->div.reg); 409 + 410 + /* wait for the change to take effect */ 411 + if (clk_info->div.busy_bit != -1) { 412 + for (i = 0; i < timeout; i++) { 413 + reg = readl(cgu->base + clk_info->div.reg); 414 + if (!(reg & BIT(clk_info->div.busy_bit))) 415 + break; 416 + mdelay(1); 417 + } 418 + if (i == timeout) 419 + ret = -EBUSY; 420 + } 421 + 422 + spin_unlock_irqrestore(&cgu->lock, flags); 423 + return ret; 424 + } 425 + 426 + return -EINVAL; 427 + } 428 + 429 + static int ingenic_clk_enable(struct clk_hw *hw) 430 + { 431 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 432 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 433 + const struct ingenic_cgu_clk_info *clk_info; 434 + unsigned long flags; 435 + 436 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 437 + 438 + if (clk_info->type & CGU_CLK_GATE) { 439 + /* ungate the clock */ 440 + spin_lock_irqsave(&cgu->lock, flags); 441 + ingenic_cgu_gate_set(cgu, &clk_info->gate, false); 442 + spin_unlock_irqrestore(&cgu->lock, flags); 443 + } 444 + 445 + return 0; 446 + } 447 + 448 + static void ingenic_clk_disable(struct clk_hw *hw) 449 + { 450 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 451 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 452 + const struct ingenic_cgu_clk_info *clk_info; 453 + unsigned long flags; 454 + 455 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 456 + 457 + if (clk_info->type & CGU_CLK_GATE) { 458 + /* gate the clock */ 459 + spin_lock_irqsave(&cgu->lock, flags); 460 + ingenic_cgu_gate_set(cgu, &clk_info->gate, true); 461 + spin_unlock_irqrestore(&cgu->lock, flags); 462 + } 463 + } 464 + 465 + static int ingenic_clk_is_enabled(struct clk_hw *hw) 466 + { 467 + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 468 + struct ingenic_cgu *cgu = ingenic_clk->cgu; 469 + const struct ingenic_cgu_clk_info *clk_info; 470 + unsigned long flags; 471 + int enabled = 1; 472 + 473 + clk_info = &cgu->clock_info[ingenic_clk->idx]; 474 + 475 + if (clk_info->type & CGU_CLK_GATE) { 476 + spin_lock_irqsave(&cgu->lock, flags); 477 + enabled = !ingenic_cgu_gate_get(cgu, &clk_info->gate); 478 + spin_unlock_irqrestore(&cgu->lock, flags); 479 + } 480 + 481 + return enabled; 482 + } 483 + 484 + static const struct clk_ops ingenic_clk_ops = { 485 + .get_parent = ingenic_clk_get_parent, 486 + .set_parent = ingenic_clk_set_parent, 487 + 488 + .recalc_rate = ingenic_clk_recalc_rate, 489 + .round_rate = ingenic_clk_round_rate, 490 + .set_rate = ingenic_clk_set_rate, 491 + 492 + .enable = ingenic_clk_enable, 493 + .disable = ingenic_clk_disable, 494 + .is_enabled = ingenic_clk_is_enabled, 495 + }; 496 + 497 + /* 498 + * Setup functions. 499 + */ 500 + 501 + static int ingenic_register_clock(struct ingenic_cgu *cgu, unsigned idx) 502 + { 503 + const struct ingenic_cgu_clk_info *clk_info = &cgu->clock_info[idx]; 504 + struct clk_init_data clk_init; 505 + struct ingenic_clk *ingenic_clk = NULL; 506 + struct clk *clk, *parent; 507 + const char *parent_names[4]; 508 + unsigned caps, i, num_possible; 509 + int err = -EINVAL; 510 + 511 + BUILD_BUG_ON(ARRAY_SIZE(clk_info->parents) > ARRAY_SIZE(parent_names)); 512 + 513 + if (clk_info->type == CGU_CLK_EXT) { 514 + clk = of_clk_get_by_name(cgu->np, clk_info->name); 515 + if (IS_ERR(clk)) { 516 + pr_err("%s: no external clock '%s' provided\n", 517 + __func__, clk_info->name); 518 + err = -ENODEV; 519 + goto out; 520 + } 521 + err = clk_register_clkdev(clk, clk_info->name, NULL); 522 + if (err) { 523 + clk_put(clk); 524 + goto out; 525 + } 526 + cgu->clocks.clks[idx] = clk; 527 + return 0; 528 + } 529 + 530 + if (!clk_info->type) { 531 + pr_err("%s: no clock type specified for '%s'\n", __func__, 532 + clk_info->name); 533 + goto out; 534 + } 535 + 536 + ingenic_clk = kzalloc(sizeof(*ingenic_clk), GFP_KERNEL); 537 + if (!ingenic_clk) { 538 + err = -ENOMEM; 539 + goto out; 540 + } 541 + 542 + ingenic_clk->hw.init = &clk_init; 543 + ingenic_clk->cgu = cgu; 544 + ingenic_clk->idx = idx; 545 + 546 + clk_init.name = clk_info->name; 547 + clk_init.flags = 0; 548 + clk_init.parent_names = parent_names; 549 + 550 + caps = clk_info->type; 551 + 552 + if (caps & (CGU_CLK_MUX | CGU_CLK_CUSTOM)) { 553 + clk_init.num_parents = 0; 554 + 555 + if (caps & CGU_CLK_MUX) 556 + num_possible = 1 << clk_info->mux.bits; 557 + else 558 + num_possible = ARRAY_SIZE(clk_info->parents); 559 + 560 + for (i = 0; i < num_possible; i++) { 561 + if (clk_info->parents[i] == -1) 562 + continue; 563 + 564 + parent = cgu->clocks.clks[clk_info->parents[i]]; 565 + parent_names[clk_init.num_parents] = 566 + __clk_get_name(parent); 567 + clk_init.num_parents++; 568 + } 569 + 570 + BUG_ON(!clk_init.num_parents); 571 + BUG_ON(clk_init.num_parents > ARRAY_SIZE(parent_names)); 572 + } else { 573 + BUG_ON(clk_info->parents[0] == -1); 574 + clk_init.num_parents = 1; 575 + parent = cgu->clocks.clks[clk_info->parents[0]]; 576 + parent_names[0] = __clk_get_name(parent); 577 + } 578 + 579 + if (caps & CGU_CLK_CUSTOM) { 580 + clk_init.ops = clk_info->custom.clk_ops; 581 + 582 + caps &= ~CGU_CLK_CUSTOM; 583 + 584 + if (caps) { 585 + pr_err("%s: custom clock may not be combined with type 0x%x\n", 586 + __func__, caps); 587 + goto out; 588 + } 589 + } else if (caps & CGU_CLK_PLL) { 590 + clk_init.ops = &ingenic_pll_ops; 591 + 592 + caps &= ~CGU_CLK_PLL; 593 + 594 + if (caps) { 595 + pr_err("%s: PLL may not be combined with type 0x%x\n", 596 + __func__, caps); 597 + goto out; 598 + } 599 + } else { 600 + clk_init.ops = &ingenic_clk_ops; 601 + } 602 + 603 + /* nothing to do for gates or fixed dividers */ 604 + caps &= ~(CGU_CLK_GATE | CGU_CLK_FIXDIV); 605 + 606 + if (caps & CGU_CLK_MUX) { 607 + if (!(caps & CGU_CLK_MUX_GLITCHFREE)) 608 + clk_init.flags |= CLK_SET_PARENT_GATE; 609 + 610 + caps &= ~(CGU_CLK_MUX | CGU_CLK_MUX_GLITCHFREE); 611 + } 612 + 613 + if (caps & CGU_CLK_DIV) { 614 + caps &= ~CGU_CLK_DIV; 615 + } else { 616 + /* pass rate changes to the parent clock */ 617 + clk_init.flags |= CLK_SET_RATE_PARENT; 618 + } 619 + 620 + if (caps) { 621 + pr_err("%s: unknown clock type 0x%x\n", __func__, caps); 622 + goto out; 623 + } 624 + 625 + clk = clk_register(NULL, &ingenic_clk->hw); 626 + if (IS_ERR(clk)) { 627 + pr_err("%s: failed to register clock '%s'\n", __func__, 628 + clk_info->name); 629 + err = PTR_ERR(clk); 630 + goto out; 631 + } 632 + 633 + err = clk_register_clkdev(clk, clk_info->name, NULL); 634 + if (err) 635 + goto out; 636 + 637 + cgu->clocks.clks[idx] = clk; 638 + out: 639 + if (err) 640 + kfree(ingenic_clk); 641 + return err; 642 + } 643 + 644 + struct ingenic_cgu * 645 + ingenic_cgu_new(const struct ingenic_cgu_clk_info *clock_info, 646 + unsigned num_clocks, struct device_node *np) 647 + { 648 + struct ingenic_cgu *cgu; 649 + 650 + cgu = kzalloc(sizeof(*cgu), GFP_KERNEL); 651 + if (!cgu) 652 + goto err_out; 653 + 654 + cgu->base = of_iomap(np, 0); 655 + if (!cgu->base) { 656 + pr_err("%s: failed to map CGU registers\n", __func__); 657 + goto err_out_free; 658 + } 659 + 660 + cgu->np = np; 661 + cgu->clock_info = clock_info; 662 + cgu->clocks.clk_num = num_clocks; 663 + 664 + spin_lock_init(&cgu->lock); 665 + 666 + return cgu; 667 + 668 + err_out_free: 669 + kfree(cgu); 670 + err_out: 671 + return NULL; 672 + } 673 + 674 + int ingenic_cgu_register_clocks(struct ingenic_cgu *cgu) 675 + { 676 + unsigned i; 677 + int err; 678 + 679 + cgu->clocks.clks = kcalloc(cgu->clocks.clk_num, sizeof(struct clk *), 680 + GFP_KERNEL); 681 + if (!cgu->clocks.clks) { 682 + err = -ENOMEM; 683 + goto err_out; 684 + } 685 + 686 + for (i = 0; i < cgu->clocks.clk_num; i++) { 687 + err = ingenic_register_clock(cgu, i); 688 + if (err) 689 + goto err_out_unregister; 690 + } 691 + 692 + err = of_clk_add_provider(cgu->np, of_clk_src_onecell_get, 693 + &cgu->clocks); 694 + if (err) 695 + goto err_out_unregister; 696 + 697 + return 0; 698 + 699 + err_out_unregister: 700 + for (i = 0; i < cgu->clocks.clk_num; i++) { 701 + if (!cgu->clocks.clks[i]) 702 + continue; 703 + if (cgu->clock_info[i].type & CGU_CLK_EXT) 704 + clk_put(cgu->clocks.clks[i]); 705 + else 706 + clk_unregister(cgu->clocks.clks[i]); 707 + } 708 + kfree(cgu->clocks.clks); 709 + err_out: 710 + return err; 711 + }
+223
drivers/clk/ingenic/cgu.h
··· 1 + /* 2 + * Ingenic SoC CGU driver 3 + * 4 + * Copyright (c) 2013-2015 Imagination Technologies 5 + * Author: Paul Burton <paul.burton@imgtec.com> 6 + * 7 + * This program is free software; you can redistribute it and/or 8 + * modify it under the terms of the GNU General Public License as 9 + * published by the Free Software Foundation; either version 2 of 10 + * the License, or (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #ifndef __DRIVERS_CLK_INGENIC_CGU_H__ 19 + #define __DRIVERS_CLK_INGENIC_CGU_H__ 20 + 21 + #include <linux/bitops.h> 22 + #include <linux/of.h> 23 + #include <linux/spinlock.h> 24 + 25 + /** 26 + * struct ingenic_cgu_pll_info - information about a PLL 27 + * @reg: the offset of the PLL's control register within the CGU 28 + * @m_shift: the number of bits to shift the multiplier value by (ie. the 29 + * index of the lowest bit of the multiplier value in the PLL's 30 + * control register) 31 + * @m_bits: the size of the multiplier field in bits 32 + * @m_offset: the multiplier value which encodes to 0 in the PLL's control 33 + * register 34 + * @n_shift: the number of bits to shift the divider value by (ie. the 35 + * index of the lowest bit of the divider value in the PLL's 36 + * control register) 37 + * @n_bits: the size of the divider field in bits 38 + * @n_offset: the divider value which encodes to 0 in the PLL's control 39 + * register 40 + * @od_shift: the number of bits to shift the post-VCO divider value by (ie. 41 + * the index of the lowest bit of the post-VCO divider value in 42 + * the PLL's control register) 43 + * @od_bits: the size of the post-VCO divider field in bits 44 + * @od_max: the maximum post-VCO divider value 45 + * @od_encoding: a pointer to an array mapping post-VCO divider values to 46 + * their encoded values in the PLL control register, or -1 for 47 + * unsupported values 48 + * @bypass_bit: the index of the bypass bit in the PLL control register 49 + * @enable_bit: the index of the enable bit in the PLL control register 50 + * @stable_bit: the index of the stable bit in the PLL control register 51 + */ 52 + struct ingenic_cgu_pll_info { 53 + unsigned reg; 54 + const s8 *od_encoding; 55 + u8 m_shift, m_bits, m_offset; 56 + u8 n_shift, n_bits, n_offset; 57 + u8 od_shift, od_bits, od_max; 58 + u8 bypass_bit; 59 + u8 enable_bit; 60 + u8 stable_bit; 61 + }; 62 + 63 + /** 64 + * struct ingenic_cgu_mux_info - information about a clock mux 65 + * @reg: offset of the mux control register within the CGU 66 + * @shift: number of bits to shift the mux value by (ie. the index of 67 + * the lowest bit of the mux value within its control register) 68 + * @bits: the size of the mux value in bits 69 + */ 70 + struct ingenic_cgu_mux_info { 71 + unsigned reg; 72 + u8 shift; 73 + u8 bits; 74 + }; 75 + 76 + /** 77 + * struct ingenic_cgu_div_info - information about a divider 78 + * @reg: offset of the divider control register within the CGU 79 + * @shift: number of bits to shift the divide value by (ie. the index of 80 + * the lowest bit of the divide value within its control register) 81 + * @bits: the size of the divide value in bits 82 + * @ce_bit: the index of the change enable bit within reg, or -1 if there 83 + * isn't one 84 + * @busy_bit: the index of the busy bit within reg, or -1 if there isn't one 85 + * @stop_bit: the index of the stop bit within reg, or -1 if there isn't one 86 + */ 87 + struct ingenic_cgu_div_info { 88 + unsigned reg; 89 + u8 shift; 90 + u8 bits; 91 + s8 ce_bit; 92 + s8 busy_bit; 93 + s8 stop_bit; 94 + }; 95 + 96 + /** 97 + * struct ingenic_cgu_fixdiv_info - information about a fixed divider 98 + * @div: the divider applied to the parent clock 99 + */ 100 + struct ingenic_cgu_fixdiv_info { 101 + unsigned div; 102 + }; 103 + 104 + /** 105 + * struct ingenic_cgu_gate_info - information about a clock gate 106 + * @reg: offset of the gate control register within the CGU 107 + * @bit: offset of the bit in the register that controls the gate 108 + */ 109 + struct ingenic_cgu_gate_info { 110 + unsigned reg; 111 + u8 bit; 112 + }; 113 + 114 + /** 115 + * struct ingenic_cgu_custom_info - information about a custom (SoC) clock 116 + * @clk_ops: custom clock operation callbacks 117 + */ 118 + struct ingenic_cgu_custom_info { 119 + struct clk_ops *clk_ops; 120 + }; 121 + 122 + /** 123 + * struct ingenic_cgu_clk_info - information about a clock 124 + * @name: name of the clock 125 + * @type: a bitmask formed from CGU_CLK_* values 126 + * @parents: an array of the indices of potential parents of this clock 127 + * within the clock_info array of the CGU, or -1 in entries 128 + * which correspond to no valid parent 129 + * @pll: information valid if type includes CGU_CLK_PLL 130 + * @gate: information valid if type includes CGU_CLK_GATE 131 + * @mux: information valid if type includes CGU_CLK_MUX 132 + * @div: information valid if type includes CGU_CLK_DIV 133 + * @fixdiv: information valid if type includes CGU_CLK_FIXDIV 134 + * @custom: information valid if type includes CGU_CLK_CUSTOM 135 + */ 136 + struct ingenic_cgu_clk_info { 137 + const char *name; 138 + 139 + enum { 140 + CGU_CLK_NONE = 0, 141 + CGU_CLK_EXT = BIT(0), 142 + CGU_CLK_PLL = BIT(1), 143 + CGU_CLK_GATE = BIT(2), 144 + CGU_CLK_MUX = BIT(3), 145 + CGU_CLK_MUX_GLITCHFREE = BIT(4), 146 + CGU_CLK_DIV = BIT(5), 147 + CGU_CLK_FIXDIV = BIT(6), 148 + CGU_CLK_CUSTOM = BIT(7), 149 + } type; 150 + 151 + int parents[4]; 152 + 153 + union { 154 + struct ingenic_cgu_pll_info pll; 155 + 156 + struct { 157 + struct ingenic_cgu_gate_info gate; 158 + struct ingenic_cgu_mux_info mux; 159 + struct ingenic_cgu_div_info div; 160 + struct ingenic_cgu_fixdiv_info fixdiv; 161 + }; 162 + 163 + struct ingenic_cgu_custom_info custom; 164 + }; 165 + }; 166 + 167 + /** 168 + * struct ingenic_cgu - data about the CGU 169 + * @np: the device tree node that caused the CGU to be probed 170 + * @base: the ioremap'ed base address of the CGU registers 171 + * @clock_info: an array containing information about implemented clocks 172 + * @clocks: used to provide clocks to DT, allows lookup of struct clk* 173 + * @lock: lock to be held whilst manipulating CGU registers 174 + */ 175 + struct ingenic_cgu { 176 + struct device_node *np; 177 + void __iomem *base; 178 + 179 + const struct ingenic_cgu_clk_info *clock_info; 180 + struct clk_onecell_data clocks; 181 + 182 + spinlock_t lock; 183 + }; 184 + 185 + /** 186 + * struct ingenic_clk - private data for a clock 187 + * @hw: see Documentation/clk.txt 188 + * @cgu: a pointer to the CGU data 189 + * @idx: the index of this clock in cgu->clock_info 190 + */ 191 + struct ingenic_clk { 192 + struct clk_hw hw; 193 + struct ingenic_cgu *cgu; 194 + unsigned idx; 195 + }; 196 + 197 + #define to_ingenic_clk(_hw) container_of(_hw, struct ingenic_clk, hw) 198 + 199 + /** 200 + * ingenic_cgu_new() - create a new CGU instance 201 + * @clock_info: an array of clock information structures describing the clocks 202 + * which are implemented by the CGU 203 + * @num_clocks: the number of entries in clock_info 204 + * @np: the device tree node which causes this CGU to be probed 205 + * 206 + * Return: a pointer to the CGU instance if initialisation is successful, 207 + * otherwise NULL. 208 + */ 209 + struct ingenic_cgu * 210 + ingenic_cgu_new(const struct ingenic_cgu_clk_info *clock_info, 211 + unsigned num_clocks, struct device_node *np); 212 + 213 + /** 214 + * ingenic_cgu_register_clocks() - Registers the clocks 215 + * @cgu: pointer to cgu data 216 + * 217 + * Register the clocks described by the CGU with the common clock framework. 218 + * 219 + * Return: 0 on success or -errno if unsuccesful. 220 + */ 221 + int ingenic_cgu_register_clocks(struct ingenic_cgu *cgu); 222 + 223 + #endif /* __DRIVERS_CLK_INGENIC_CGU_H__ */
+303
drivers/clk/ingenic/jz4740-cgu.c
··· 1 + /* 2 + * Ingenic JZ4740 SoC CGU driver 3 + * 4 + * Copyright (c) 2015 Imagination Technologies 5 + * Author: Paul Burton <paul.burton@imgtec.com> 6 + * 7 + * This program is free software; you can redistribute it and/or 8 + * modify it under the terms of the GNU General Public License as 9 + * published by the Free Software Foundation; either version 2 of 10 + * the License, or (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #include <linux/clk-provider.h> 19 + #include <linux/delay.h> 20 + #include <linux/of.h> 21 + #include <dt-bindings/clock/jz4740-cgu.h> 22 + #include <asm/mach-jz4740/clock.h> 23 + #include "cgu.h" 24 + 25 + /* CGU register offsets */ 26 + #define CGU_REG_CPCCR 0x00 27 + #define CGU_REG_LCR 0x04 28 + #define CGU_REG_CPPCR 0x10 29 + #define CGU_REG_CLKGR 0x20 30 + #define CGU_REG_SCR 0x24 31 + #define CGU_REG_I2SCDR 0x60 32 + #define CGU_REG_LPCDR 0x64 33 + #define CGU_REG_MSCCDR 0x68 34 + #define CGU_REG_UHCCDR 0x6c 35 + #define CGU_REG_SSICDR 0x74 36 + 37 + /* bits within a PLL control register */ 38 + #define PLLCTL_M_SHIFT 23 39 + #define PLLCTL_M_MASK (0x1ff << PLLCTL_M_SHIFT) 40 + #define PLLCTL_N_SHIFT 18 41 + #define PLLCTL_N_MASK (0x1f << PLLCTL_N_SHIFT) 42 + #define PLLCTL_OD_SHIFT 16 43 + #define PLLCTL_OD_MASK (0x3 << PLLCTL_OD_SHIFT) 44 + #define PLLCTL_STABLE (1 << 10) 45 + #define PLLCTL_BYPASS (1 << 9) 46 + #define PLLCTL_ENABLE (1 << 8) 47 + 48 + /* bits within the LCR register */ 49 + #define LCR_SLEEP (1 << 0) 50 + 51 + /* bits within the CLKGR register */ 52 + #define CLKGR_UDC (1 << 11) 53 + 54 + static struct ingenic_cgu *cgu; 55 + 56 + static const s8 pll_od_encoding[4] = { 57 + 0x0, 0x1, -1, 0x3, 58 + }; 59 + 60 + static const struct ingenic_cgu_clk_info jz4740_cgu_clocks[] = { 61 + 62 + /* External clocks */ 63 + 64 + [JZ4740_CLK_EXT] = { "ext", CGU_CLK_EXT }, 65 + [JZ4740_CLK_RTC] = { "rtc", CGU_CLK_EXT }, 66 + 67 + [JZ4740_CLK_PLL] = { 68 + "pll", CGU_CLK_PLL, 69 + .parents = { JZ4740_CLK_EXT, -1, -1, -1 }, 70 + .pll = { 71 + .reg = CGU_REG_CPPCR, 72 + .m_shift = 23, 73 + .m_bits = 9, 74 + .m_offset = 2, 75 + .n_shift = 18, 76 + .n_bits = 5, 77 + .n_offset = 2, 78 + .od_shift = 16, 79 + .od_bits = 2, 80 + .od_max = 4, 81 + .od_encoding = pll_od_encoding, 82 + .stable_bit = 10, 83 + .bypass_bit = 9, 84 + .enable_bit = 8, 85 + }, 86 + }, 87 + 88 + /* Muxes & dividers */ 89 + 90 + [JZ4740_CLK_PLL_HALF] = { 91 + "pll half", CGU_CLK_DIV, 92 + .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 93 + .div = { CGU_REG_CPCCR, 21, 1, -1, -1, -1 }, 94 + }, 95 + 96 + [JZ4740_CLK_CCLK] = { 97 + "cclk", CGU_CLK_DIV, 98 + .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 99 + .div = { CGU_REG_CPCCR, 0, 4, 22, -1, -1 }, 100 + }, 101 + 102 + [JZ4740_CLK_HCLK] = { 103 + "hclk", CGU_CLK_DIV, 104 + .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 105 + .div = { CGU_REG_CPCCR, 4, 4, 22, -1, -1 }, 106 + }, 107 + 108 + [JZ4740_CLK_PCLK] = { 109 + "pclk", CGU_CLK_DIV, 110 + .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 111 + .div = { CGU_REG_CPCCR, 8, 4, 22, -1, -1 }, 112 + }, 113 + 114 + [JZ4740_CLK_MCLK] = { 115 + "mclk", CGU_CLK_DIV, 116 + .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 117 + .div = { CGU_REG_CPCCR, 12, 4, 22, -1, -1 }, 118 + }, 119 + 120 + [JZ4740_CLK_LCD] = { 121 + "lcd", CGU_CLK_DIV | CGU_CLK_GATE, 122 + .parents = { JZ4740_CLK_PLL_HALF, -1, -1, -1 }, 123 + .div = { CGU_REG_CPCCR, 16, 5, 22, -1, -1 }, 124 + .gate = { CGU_REG_CLKGR, 10 }, 125 + }, 126 + 127 + [JZ4740_CLK_LCD_PCLK] = { 128 + "lcd_pclk", CGU_CLK_DIV, 129 + .parents = { JZ4740_CLK_PLL_HALF, -1, -1, -1 }, 130 + .div = { CGU_REG_LPCDR, 0, 11, -1, -1, -1 }, 131 + }, 132 + 133 + [JZ4740_CLK_I2S] = { 134 + "i2s", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, 135 + .parents = { JZ4740_CLK_EXT, JZ4740_CLK_PLL_HALF, -1, -1 }, 136 + .mux = { CGU_REG_CPCCR, 31, 1 }, 137 + .div = { CGU_REG_I2SCDR, 0, 8, -1, -1, -1 }, 138 + .gate = { CGU_REG_CLKGR, 6 }, 139 + }, 140 + 141 + [JZ4740_CLK_SPI] = { 142 + "spi", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, 143 + .parents = { JZ4740_CLK_EXT, JZ4740_CLK_PLL, -1, -1 }, 144 + .mux = { CGU_REG_SSICDR, 31, 1 }, 145 + .div = { CGU_REG_SSICDR, 0, 4, -1, -1, -1 }, 146 + .gate = { CGU_REG_CLKGR, 4 }, 147 + }, 148 + 149 + [JZ4740_CLK_MMC] = { 150 + "mmc", CGU_CLK_DIV | CGU_CLK_GATE, 151 + .parents = { JZ4740_CLK_PLL_HALF, -1, -1, -1 }, 152 + .div = { CGU_REG_MSCCDR, 0, 5, -1, -1, -1 }, 153 + .gate = { CGU_REG_CLKGR, 7 }, 154 + }, 155 + 156 + [JZ4740_CLK_UHC] = { 157 + "uhc", CGU_CLK_DIV | CGU_CLK_GATE, 158 + .parents = { JZ4740_CLK_PLL_HALF, -1, -1, -1 }, 159 + .div = { CGU_REG_UHCCDR, 0, 4, -1, -1, -1 }, 160 + .gate = { CGU_REG_CLKGR, 14 }, 161 + }, 162 + 163 + [JZ4740_CLK_UDC] = { 164 + "udc", CGU_CLK_MUX | CGU_CLK_DIV, 165 + .parents = { JZ4740_CLK_EXT, JZ4740_CLK_PLL_HALF, -1, -1 }, 166 + .mux = { CGU_REG_CPCCR, 29, 1 }, 167 + .div = { CGU_REG_CPCCR, 23, 6, -1, -1, -1 }, 168 + .gate = { CGU_REG_SCR, 6 }, 169 + }, 170 + 171 + /* Gate-only clocks */ 172 + 173 + [JZ4740_CLK_UART0] = { 174 + "uart0", CGU_CLK_GATE, 175 + .parents = { JZ4740_CLK_EXT, -1, -1, -1 }, 176 + .gate = { CGU_REG_CLKGR, 0 }, 177 + }, 178 + 179 + [JZ4740_CLK_UART1] = { 180 + "uart1", CGU_CLK_GATE, 181 + .parents = { JZ4740_CLK_EXT, -1, -1, -1 }, 182 + .gate = { CGU_REG_CLKGR, 15 }, 183 + }, 184 + 185 + [JZ4740_CLK_DMA] = { 186 + "dma", CGU_CLK_GATE, 187 + .parents = { JZ4740_CLK_PCLK, -1, -1, -1 }, 188 + .gate = { CGU_REG_CLKGR, 12 }, 189 + }, 190 + 191 + [JZ4740_CLK_IPU] = { 192 + "ipu", CGU_CLK_GATE, 193 + .parents = { JZ4740_CLK_PCLK, -1, -1, -1 }, 194 + .gate = { CGU_REG_CLKGR, 13 }, 195 + }, 196 + 197 + [JZ4740_CLK_ADC] = { 198 + "adc", CGU_CLK_GATE, 199 + .parents = { JZ4740_CLK_EXT, -1, -1, -1 }, 200 + .gate = { CGU_REG_CLKGR, 8 }, 201 + }, 202 + 203 + [JZ4740_CLK_I2C] = { 204 + "i2c", CGU_CLK_GATE, 205 + .parents = { JZ4740_CLK_EXT, -1, -1, -1 }, 206 + .gate = { CGU_REG_CLKGR, 3 }, 207 + }, 208 + 209 + [JZ4740_CLK_AIC] = { 210 + "aic", CGU_CLK_GATE, 211 + .parents = { JZ4740_CLK_EXT, -1, -1, -1 }, 212 + .gate = { CGU_REG_CLKGR, 5 }, 213 + }, 214 + }; 215 + 216 + static void __init jz4740_cgu_init(struct device_node *np) 217 + { 218 + int retval; 219 + 220 + cgu = ingenic_cgu_new(jz4740_cgu_clocks, 221 + ARRAY_SIZE(jz4740_cgu_clocks), np); 222 + if (!cgu) { 223 + pr_err("%s: failed to initialise CGU\n", __func__); 224 + return; 225 + } 226 + 227 + retval = ingenic_cgu_register_clocks(cgu); 228 + if (retval) 229 + pr_err("%s: failed to register CGU Clocks\n", __func__); 230 + } 231 + CLK_OF_DECLARE(jz4740_cgu, "ingenic,jz4740-cgu", jz4740_cgu_init); 232 + 233 + void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode) 234 + { 235 + uint32_t lcr = readl(cgu->base + CGU_REG_LCR); 236 + 237 + switch (mode) { 238 + case JZ4740_WAIT_MODE_IDLE: 239 + lcr &= ~LCR_SLEEP; 240 + break; 241 + 242 + case JZ4740_WAIT_MODE_SLEEP: 243 + lcr |= LCR_SLEEP; 244 + break; 245 + } 246 + 247 + writel(lcr, cgu->base + CGU_REG_LCR); 248 + } 249 + 250 + void jz4740_clock_udc_disable_auto_suspend(void) 251 + { 252 + uint32_t clkgr = readl(cgu->base + CGU_REG_CLKGR); 253 + 254 + clkgr &= ~CLKGR_UDC; 255 + writel(clkgr, cgu->base + CGU_REG_CLKGR); 256 + } 257 + EXPORT_SYMBOL_GPL(jz4740_clock_udc_disable_auto_suspend); 258 + 259 + void jz4740_clock_udc_enable_auto_suspend(void) 260 + { 261 + uint32_t clkgr = readl(cgu->base + CGU_REG_CLKGR); 262 + 263 + clkgr |= CLKGR_UDC; 264 + writel(clkgr, cgu->base + CGU_REG_CLKGR); 265 + } 266 + EXPORT_SYMBOL_GPL(jz4740_clock_udc_enable_auto_suspend); 267 + 268 + #define JZ_CLOCK_GATE_UART0 BIT(0) 269 + #define JZ_CLOCK_GATE_TCU BIT(1) 270 + #define JZ_CLOCK_GATE_DMAC BIT(12) 271 + 272 + void jz4740_clock_suspend(void) 273 + { 274 + uint32_t clkgr, cppcr; 275 + 276 + clkgr = readl(cgu->base + CGU_REG_CLKGR); 277 + clkgr |= JZ_CLOCK_GATE_TCU | JZ_CLOCK_GATE_DMAC | JZ_CLOCK_GATE_UART0; 278 + writel(clkgr, cgu->base + CGU_REG_CLKGR); 279 + 280 + cppcr = readl(cgu->base + CGU_REG_CPPCR); 281 + cppcr &= ~BIT(jz4740_cgu_clocks[JZ4740_CLK_PLL].pll.enable_bit); 282 + writel(cppcr, cgu->base + CGU_REG_CPPCR); 283 + } 284 + 285 + void jz4740_clock_resume(void) 286 + { 287 + uint32_t clkgr, cppcr, stable; 288 + 289 + cppcr = readl(cgu->base + CGU_REG_CPPCR); 290 + cppcr |= BIT(jz4740_cgu_clocks[JZ4740_CLK_PLL].pll.enable_bit); 291 + writel(cppcr, cgu->base + CGU_REG_CPPCR); 292 + 293 + stable = BIT(jz4740_cgu_clocks[JZ4740_CLK_PLL].pll.stable_bit); 294 + do { 295 + cppcr = readl(cgu->base + CGU_REG_CPPCR); 296 + } while (!(cppcr & stable)); 297 + 298 + clkgr = readl(cgu->base + CGU_REG_CLKGR); 299 + clkgr &= ~JZ_CLOCK_GATE_TCU; 300 + clkgr &= ~JZ_CLOCK_GATE_DMAC; 301 + clkgr &= ~JZ_CLOCK_GATE_UART0; 302 + writel(clkgr, cgu->base + CGU_REG_CLKGR); 303 + }
+733
drivers/clk/ingenic/jz4780-cgu.c
··· 1 + /* 2 + * Ingenic JZ4780 SoC CGU driver 3 + * 4 + * Copyright (c) 2013-2015 Imagination Technologies 5 + * Author: Paul Burton <paul.burton@imgtec.com> 6 + * 7 + * This program is free software; you can redistribute it and/or 8 + * modify it under the terms of the GNU General Public License as 9 + * published by the Free Software Foundation; either version 2 of 10 + * the License, or (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #include <linux/clk-provider.h> 19 + #include <linux/delay.h> 20 + #include <linux/of.h> 21 + #include <dt-bindings/clock/jz4780-cgu.h> 22 + #include "cgu.h" 23 + 24 + /* CGU register offsets */ 25 + #define CGU_REG_CLOCKCONTROL 0x00 26 + #define CGU_REG_PLLCONTROL 0x0c 27 + #define CGU_REG_APLL 0x10 28 + #define CGU_REG_MPLL 0x14 29 + #define CGU_REG_EPLL 0x18 30 + #define CGU_REG_VPLL 0x1c 31 + #define CGU_REG_CLKGR0 0x20 32 + #define CGU_REG_OPCR 0x24 33 + #define CGU_REG_CLKGR1 0x28 34 + #define CGU_REG_DDRCDR 0x2c 35 + #define CGU_REG_VPUCDR 0x30 36 + #define CGU_REG_USBPCR 0x3c 37 + #define CGU_REG_USBRDT 0x40 38 + #define CGU_REG_USBVBFIL 0x44 39 + #define CGU_REG_USBPCR1 0x48 40 + #define CGU_REG_LP0CDR 0x54 41 + #define CGU_REG_I2SCDR 0x60 42 + #define CGU_REG_LP1CDR 0x64 43 + #define CGU_REG_MSC0CDR 0x68 44 + #define CGU_REG_UHCCDR 0x6c 45 + #define CGU_REG_SSICDR 0x74 46 + #define CGU_REG_CIMCDR 0x7c 47 + #define CGU_REG_PCMCDR 0x84 48 + #define CGU_REG_GPUCDR 0x88 49 + #define CGU_REG_HDMICDR 0x8c 50 + #define CGU_REG_MSC1CDR 0xa4 51 + #define CGU_REG_MSC2CDR 0xa8 52 + #define CGU_REG_BCHCDR 0xac 53 + #define CGU_REG_CLOCKSTATUS 0xd4 54 + 55 + /* bits within the OPCR register */ 56 + #define OPCR_SPENDN0 (1 << 7) 57 + #define OPCR_SPENDN1 (1 << 6) 58 + 59 + /* bits within the USBPCR register */ 60 + #define USBPCR_USB_MODE BIT(31) 61 + #define USBPCR_IDPULLUP_MASK (0x3 << 28) 62 + #define USBPCR_COMMONONN BIT(25) 63 + #define USBPCR_VBUSVLDEXT BIT(24) 64 + #define USBPCR_VBUSVLDEXTSEL BIT(23) 65 + #define USBPCR_POR BIT(22) 66 + #define USBPCR_OTG_DISABLE BIT(20) 67 + #define USBPCR_COMPDISTUNE_MASK (0x7 << 17) 68 + #define USBPCR_OTGTUNE_MASK (0x7 << 14) 69 + #define USBPCR_SQRXTUNE_MASK (0x7 << 11) 70 + #define USBPCR_TXFSLSTUNE_MASK (0xf << 7) 71 + #define USBPCR_TXPREEMPHTUNE BIT(6) 72 + #define USBPCR_TXHSXVTUNE_MASK (0x3 << 4) 73 + #define USBPCR_TXVREFTUNE_MASK 0xf 74 + 75 + /* bits within the USBPCR1 register */ 76 + #define USBPCR1_REFCLKSEL_SHIFT 26 77 + #define USBPCR1_REFCLKSEL_MASK (0x3 << USBPCR1_REFCLKSEL_SHIFT) 78 + #define USBPCR1_REFCLKSEL_CORE (0x2 << USBPCR1_REFCLKSEL_SHIFT) 79 + #define USBPCR1_REFCLKDIV_SHIFT 24 80 + #define USBPCR1_REFCLKDIV_MASK (0x3 << USBPCR1_REFCLKDIV_SHIFT) 81 + #define USBPCR1_REFCLKDIV_19_2 (0x3 << USBPCR1_REFCLKDIV_SHIFT) 82 + #define USBPCR1_REFCLKDIV_48 (0x2 << USBPCR1_REFCLKDIV_SHIFT) 83 + #define USBPCR1_REFCLKDIV_24 (0x1 << USBPCR1_REFCLKDIV_SHIFT) 84 + #define USBPCR1_REFCLKDIV_12 (0x0 << USBPCR1_REFCLKDIV_SHIFT) 85 + #define USBPCR1_USB_SEL BIT(28) 86 + #define USBPCR1_WORD_IF0 BIT(19) 87 + #define USBPCR1_WORD_IF1 BIT(18) 88 + 89 + /* bits within the USBRDT register */ 90 + #define USBRDT_VBFIL_LD_EN BIT(25) 91 + #define USBRDT_USBRDT_MASK 0x7fffff 92 + 93 + /* bits within the USBVBFIL register */ 94 + #define USBVBFIL_IDDIGFIL_SHIFT 16 95 + #define USBVBFIL_IDDIGFIL_MASK (0xffff << USBVBFIL_IDDIGFIL_SHIFT) 96 + #define USBVBFIL_USBVBFIL_MASK (0xffff) 97 + 98 + static struct ingenic_cgu *cgu; 99 + 100 + static u8 jz4780_otg_phy_get_parent(struct clk_hw *hw) 101 + { 102 + /* we only use CLKCORE, revisit if that ever changes */ 103 + return 0; 104 + } 105 + 106 + static int jz4780_otg_phy_set_parent(struct clk_hw *hw, u8 idx) 107 + { 108 + unsigned long flags; 109 + u32 usbpcr1; 110 + 111 + if (idx > 0) 112 + return -EINVAL; 113 + 114 + spin_lock_irqsave(&cgu->lock, flags); 115 + 116 + usbpcr1 = readl(cgu->base + CGU_REG_USBPCR1); 117 + usbpcr1 &= ~USBPCR1_REFCLKSEL_MASK; 118 + /* we only use CLKCORE */ 119 + usbpcr1 |= USBPCR1_REFCLKSEL_CORE; 120 + writel(usbpcr1, cgu->base + CGU_REG_USBPCR1); 121 + 122 + spin_unlock_irqrestore(&cgu->lock, flags); 123 + return 0; 124 + } 125 + 126 + static unsigned long jz4780_otg_phy_recalc_rate(struct clk_hw *hw, 127 + unsigned long parent_rate) 128 + { 129 + u32 usbpcr1; 130 + unsigned refclk_div; 131 + 132 + usbpcr1 = readl(cgu->base + CGU_REG_USBPCR1); 133 + refclk_div = usbpcr1 & USBPCR1_REFCLKDIV_MASK; 134 + 135 + switch (refclk_div) { 136 + case USBPCR1_REFCLKDIV_12: 137 + return 12000000; 138 + 139 + case USBPCR1_REFCLKDIV_24: 140 + return 24000000; 141 + 142 + case USBPCR1_REFCLKDIV_48: 143 + return 48000000; 144 + 145 + case USBPCR1_REFCLKDIV_19_2: 146 + return 19200000; 147 + } 148 + 149 + BUG(); 150 + return parent_rate; 151 + } 152 + 153 + static long jz4780_otg_phy_round_rate(struct clk_hw *hw, unsigned long req_rate, 154 + unsigned long *parent_rate) 155 + { 156 + if (req_rate < 15600000) 157 + return 12000000; 158 + 159 + if (req_rate < 21600000) 160 + return 19200000; 161 + 162 + if (req_rate < 36000000) 163 + return 24000000; 164 + 165 + return 48000000; 166 + } 167 + 168 + static int jz4780_otg_phy_set_rate(struct clk_hw *hw, unsigned long req_rate, 169 + unsigned long parent_rate) 170 + { 171 + unsigned long flags; 172 + u32 usbpcr1, div_bits; 173 + 174 + switch (req_rate) { 175 + case 12000000: 176 + div_bits = USBPCR1_REFCLKDIV_12; 177 + break; 178 + 179 + case 19200000: 180 + div_bits = USBPCR1_REFCLKDIV_19_2; 181 + break; 182 + 183 + case 24000000: 184 + div_bits = USBPCR1_REFCLKDIV_24; 185 + break; 186 + 187 + case 48000000: 188 + div_bits = USBPCR1_REFCLKDIV_48; 189 + break; 190 + 191 + default: 192 + return -EINVAL; 193 + } 194 + 195 + spin_lock_irqsave(&cgu->lock, flags); 196 + 197 + usbpcr1 = readl(cgu->base + CGU_REG_USBPCR1); 198 + usbpcr1 &= ~USBPCR1_REFCLKDIV_MASK; 199 + usbpcr1 |= div_bits; 200 + writel(usbpcr1, cgu->base + CGU_REG_USBPCR1); 201 + 202 + spin_unlock_irqrestore(&cgu->lock, flags); 203 + return 0; 204 + } 205 + 206 + static struct clk_ops jz4780_otg_phy_ops = { 207 + .get_parent = jz4780_otg_phy_get_parent, 208 + .set_parent = jz4780_otg_phy_set_parent, 209 + 210 + .recalc_rate = jz4780_otg_phy_recalc_rate, 211 + .round_rate = jz4780_otg_phy_round_rate, 212 + .set_rate = jz4780_otg_phy_set_rate, 213 + }; 214 + 215 + static const s8 pll_od_encoding[16] = { 216 + 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 217 + 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 218 + }; 219 + 220 + static const struct ingenic_cgu_clk_info jz4780_cgu_clocks[] = { 221 + 222 + /* External clocks */ 223 + 224 + [JZ4780_CLK_EXCLK] = { "ext", CGU_CLK_EXT }, 225 + [JZ4780_CLK_RTCLK] = { "rtc", CGU_CLK_EXT }, 226 + 227 + /* PLLs */ 228 + 229 + #define DEF_PLL(name) { \ 230 + .reg = CGU_REG_ ## name, \ 231 + .m_shift = 19, \ 232 + .m_bits = 13, \ 233 + .m_offset = 1, \ 234 + .n_shift = 13, \ 235 + .n_bits = 6, \ 236 + .n_offset = 1, \ 237 + .od_shift = 9, \ 238 + .od_bits = 4, \ 239 + .od_max = 16, \ 240 + .od_encoding = pll_od_encoding, \ 241 + .stable_bit = 6, \ 242 + .bypass_bit = 1, \ 243 + .enable_bit = 0, \ 244 + } 245 + 246 + [JZ4780_CLK_APLL] = { 247 + "apll", CGU_CLK_PLL, 248 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 249 + .pll = DEF_PLL(APLL), 250 + }, 251 + 252 + [JZ4780_CLK_MPLL] = { 253 + "mpll", CGU_CLK_PLL, 254 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 255 + .pll = DEF_PLL(MPLL), 256 + }, 257 + 258 + [JZ4780_CLK_EPLL] = { 259 + "epll", CGU_CLK_PLL, 260 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 261 + .pll = DEF_PLL(EPLL), 262 + }, 263 + 264 + [JZ4780_CLK_VPLL] = { 265 + "vpll", CGU_CLK_PLL, 266 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 267 + .pll = DEF_PLL(VPLL), 268 + }, 269 + 270 + #undef DEF_PLL 271 + 272 + /* Custom (SoC-specific) OTG PHY */ 273 + 274 + [JZ4780_CLK_OTGPHY] = { 275 + "otg_phy", CGU_CLK_CUSTOM, 276 + .parents = { -1, -1, JZ4780_CLK_EXCLK, -1 }, 277 + .custom = { &jz4780_otg_phy_ops }, 278 + }, 279 + 280 + /* Muxes & dividers */ 281 + 282 + [JZ4780_CLK_SCLKA] = { 283 + "sclk_a", CGU_CLK_MUX, 284 + .parents = { -1, JZ4780_CLK_APLL, JZ4780_CLK_EXCLK, 285 + JZ4780_CLK_RTCLK }, 286 + .mux = { CGU_REG_CLOCKCONTROL, 30, 2 }, 287 + }, 288 + 289 + [JZ4780_CLK_CPUMUX] = { 290 + "cpumux", CGU_CLK_MUX, 291 + .parents = { -1, JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 292 + JZ4780_CLK_EPLL }, 293 + .mux = { CGU_REG_CLOCKCONTROL, 28, 2 }, 294 + }, 295 + 296 + [JZ4780_CLK_CPU] = { 297 + "cpu", CGU_CLK_DIV, 298 + .parents = { JZ4780_CLK_CPUMUX, -1, -1, -1 }, 299 + .div = { CGU_REG_CLOCKCONTROL, 0, 4, 22, -1, -1 }, 300 + }, 301 + 302 + [JZ4780_CLK_L2CACHE] = { 303 + "l2cache", CGU_CLK_DIV, 304 + .parents = { JZ4780_CLK_CPUMUX, -1, -1, -1 }, 305 + .div = { CGU_REG_CLOCKCONTROL, 4, 4, -1, -1, -1 }, 306 + }, 307 + 308 + [JZ4780_CLK_AHB0] = { 309 + "ahb0", CGU_CLK_MUX | CGU_CLK_DIV, 310 + .parents = { -1, JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 311 + JZ4780_CLK_EPLL }, 312 + .mux = { CGU_REG_CLOCKCONTROL, 26, 2 }, 313 + .div = { CGU_REG_CLOCKCONTROL, 8, 4, 21, -1, -1 }, 314 + }, 315 + 316 + [JZ4780_CLK_AHB2PMUX] = { 317 + "ahb2_apb_mux", CGU_CLK_MUX, 318 + .parents = { -1, JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 319 + JZ4780_CLK_RTCLK }, 320 + .mux = { CGU_REG_CLOCKCONTROL, 24, 2 }, 321 + }, 322 + 323 + [JZ4780_CLK_AHB2] = { 324 + "ahb2", CGU_CLK_DIV, 325 + .parents = { JZ4780_CLK_AHB2PMUX, -1, -1, -1 }, 326 + .div = { CGU_REG_CLOCKCONTROL, 12, 4, 20, -1, -1 }, 327 + }, 328 + 329 + [JZ4780_CLK_PCLK] = { 330 + "pclk", CGU_CLK_DIV, 331 + .parents = { JZ4780_CLK_AHB2PMUX, -1, -1, -1 }, 332 + .div = { CGU_REG_CLOCKCONTROL, 16, 4, 20, -1, -1 }, 333 + }, 334 + 335 + [JZ4780_CLK_DDR] = { 336 + "ddr", CGU_CLK_MUX | CGU_CLK_DIV, 337 + .parents = { -1, JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, -1 }, 338 + .mux = { CGU_REG_DDRCDR, 30, 2 }, 339 + .div = { CGU_REG_DDRCDR, 0, 4, 29, 28, 27 }, 340 + }, 341 + 342 + [JZ4780_CLK_VPU] = { 343 + "vpu", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, 344 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 345 + JZ4780_CLK_EPLL, -1 }, 346 + .mux = { CGU_REG_VPUCDR, 30, 2 }, 347 + .div = { CGU_REG_VPUCDR, 0, 4, 29, 28, 27 }, 348 + .gate = { CGU_REG_CLKGR1, 2 }, 349 + }, 350 + 351 + [JZ4780_CLK_I2SPLL] = { 352 + "i2s_pll", CGU_CLK_MUX | CGU_CLK_DIV, 353 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_EPLL, -1, -1 }, 354 + .mux = { CGU_REG_I2SCDR, 30, 1 }, 355 + .div = { CGU_REG_I2SCDR, 0, 8, 29, 28, 27 }, 356 + }, 357 + 358 + [JZ4780_CLK_I2S] = { 359 + "i2s", CGU_CLK_MUX, 360 + .parents = { JZ4780_CLK_EXCLK, JZ4780_CLK_I2SPLL, -1, -1 }, 361 + .mux = { CGU_REG_I2SCDR, 31, 1 }, 362 + }, 363 + 364 + [JZ4780_CLK_LCD0PIXCLK] = { 365 + "lcd0pixclk", CGU_CLK_MUX | CGU_CLK_DIV, 366 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 367 + JZ4780_CLK_VPLL, -1 }, 368 + .mux = { CGU_REG_LP0CDR, 30, 2 }, 369 + .div = { CGU_REG_LP0CDR, 0, 8, 28, 27, 26 }, 370 + }, 371 + 372 + [JZ4780_CLK_LCD1PIXCLK] = { 373 + "lcd1pixclk", CGU_CLK_MUX | CGU_CLK_DIV, 374 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 375 + JZ4780_CLK_VPLL, -1 }, 376 + .mux = { CGU_REG_LP1CDR, 30, 2 }, 377 + .div = { CGU_REG_LP1CDR, 0, 8, 28, 27, 26 }, 378 + }, 379 + 380 + [JZ4780_CLK_MSCMUX] = { 381 + "msc_mux", CGU_CLK_MUX, 382 + .parents = { -1, JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, -1 }, 383 + .mux = { CGU_REG_MSC0CDR, 30, 2 }, 384 + }, 385 + 386 + [JZ4780_CLK_MSC0] = { 387 + "msc0", CGU_CLK_DIV | CGU_CLK_GATE, 388 + .parents = { JZ4780_CLK_MSCMUX, -1, -1, -1 }, 389 + .div = { CGU_REG_MSC0CDR, 0, 8, 29, 28, 27 }, 390 + .gate = { CGU_REG_CLKGR0, 3 }, 391 + }, 392 + 393 + [JZ4780_CLK_MSC1] = { 394 + "msc1", CGU_CLK_DIV | CGU_CLK_GATE, 395 + .parents = { JZ4780_CLK_MSCMUX, -1, -1, -1 }, 396 + .div = { CGU_REG_MSC1CDR, 0, 8, 29, 28, 27 }, 397 + .gate = { CGU_REG_CLKGR0, 11 }, 398 + }, 399 + 400 + [JZ4780_CLK_MSC2] = { 401 + "msc2", CGU_CLK_DIV | CGU_CLK_GATE, 402 + .parents = { JZ4780_CLK_MSCMUX, -1, -1, -1 }, 403 + .div = { CGU_REG_MSC2CDR, 0, 8, 29, 28, 27 }, 404 + .gate = { CGU_REG_CLKGR0, 12 }, 405 + }, 406 + 407 + [JZ4780_CLK_UHC] = { 408 + "uhc", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, 409 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 410 + JZ4780_CLK_EPLL, JZ4780_CLK_OTGPHY }, 411 + .mux = { CGU_REG_UHCCDR, 30, 2 }, 412 + .div = { CGU_REG_UHCCDR, 0, 8, 29, 28, 27 }, 413 + .gate = { CGU_REG_CLKGR0, 24 }, 414 + }, 415 + 416 + [JZ4780_CLK_SSIPLL] = { 417 + "ssi_pll", CGU_CLK_MUX | CGU_CLK_DIV, 418 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, -1, -1 }, 419 + .mux = { CGU_REG_SSICDR, 30, 1 }, 420 + .div = { CGU_REG_SSICDR, 0, 8, 29, 28, 27 }, 421 + }, 422 + 423 + [JZ4780_CLK_SSI] = { 424 + "ssi", CGU_CLK_MUX, 425 + .parents = { JZ4780_CLK_EXCLK, JZ4780_CLK_SSIPLL, -1, -1 }, 426 + .mux = { CGU_REG_SSICDR, 31, 1 }, 427 + }, 428 + 429 + [JZ4780_CLK_CIMMCLK] = { 430 + "cim_mclk", CGU_CLK_MUX | CGU_CLK_DIV, 431 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, -1, -1 }, 432 + .mux = { CGU_REG_CIMCDR, 31, 1 }, 433 + .div = { CGU_REG_CIMCDR, 0, 8, 30, 29, 28 }, 434 + }, 435 + 436 + [JZ4780_CLK_PCMPLL] = { 437 + "pcm_pll", CGU_CLK_MUX | CGU_CLK_DIV, 438 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 439 + JZ4780_CLK_EPLL, JZ4780_CLK_VPLL }, 440 + .mux = { CGU_REG_PCMCDR, 29, 2 }, 441 + .div = { CGU_REG_PCMCDR, 0, 8, 28, 27, 26 }, 442 + }, 443 + 444 + [JZ4780_CLK_PCM] = { 445 + "pcm", CGU_CLK_MUX | CGU_CLK_GATE, 446 + .parents = { JZ4780_CLK_EXCLK, JZ4780_CLK_PCMPLL, -1, -1 }, 447 + .mux = { CGU_REG_PCMCDR, 31, 1 }, 448 + .gate = { CGU_REG_CLKGR1, 3 }, 449 + }, 450 + 451 + [JZ4780_CLK_GPU] = { 452 + "gpu", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, 453 + .parents = { -1, JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 454 + JZ4780_CLK_EPLL }, 455 + .mux = { CGU_REG_GPUCDR, 30, 2 }, 456 + .div = { CGU_REG_GPUCDR, 0, 4, 29, 28, 27 }, 457 + .gate = { CGU_REG_CLKGR1, 4 }, 458 + }, 459 + 460 + [JZ4780_CLK_HDMI] = { 461 + "hdmi", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, 462 + .parents = { JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 463 + JZ4780_CLK_VPLL, -1 }, 464 + .mux = { CGU_REG_HDMICDR, 30, 2 }, 465 + .div = { CGU_REG_HDMICDR, 0, 8, 29, 28, 26 }, 466 + .gate = { CGU_REG_CLKGR1, 9 }, 467 + }, 468 + 469 + [JZ4780_CLK_BCH] = { 470 + "bch", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, 471 + .parents = { -1, JZ4780_CLK_SCLKA, JZ4780_CLK_MPLL, 472 + JZ4780_CLK_EPLL }, 473 + .mux = { CGU_REG_BCHCDR, 30, 2 }, 474 + .div = { CGU_REG_BCHCDR, 0, 4, 29, 28, 27 }, 475 + .gate = { CGU_REG_CLKGR0, 1 }, 476 + }, 477 + 478 + /* Gate-only clocks */ 479 + 480 + [JZ4780_CLK_NEMC] = { 481 + "nemc", CGU_CLK_GATE, 482 + .parents = { JZ4780_CLK_AHB2, -1, -1, -1 }, 483 + .gate = { CGU_REG_CLKGR0, 0 }, 484 + }, 485 + 486 + [JZ4780_CLK_OTG0] = { 487 + "otg0", CGU_CLK_GATE, 488 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 489 + .gate = { CGU_REG_CLKGR0, 2 }, 490 + }, 491 + 492 + [JZ4780_CLK_SSI0] = { 493 + "ssi0", CGU_CLK_GATE, 494 + .parents = { JZ4780_CLK_SSI, -1, -1, -1 }, 495 + .gate = { CGU_REG_CLKGR0, 4 }, 496 + }, 497 + 498 + [JZ4780_CLK_SMB0] = { 499 + "smb0", CGU_CLK_GATE, 500 + .parents = { JZ4780_CLK_PCLK, -1, -1, -1 }, 501 + .gate = { CGU_REG_CLKGR0, 5 }, 502 + }, 503 + 504 + [JZ4780_CLK_SMB1] = { 505 + "smb1", CGU_CLK_GATE, 506 + .parents = { JZ4780_CLK_PCLK, -1, -1, -1 }, 507 + .gate = { CGU_REG_CLKGR0, 6 }, 508 + }, 509 + 510 + [JZ4780_CLK_SCC] = { 511 + "scc", CGU_CLK_GATE, 512 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 513 + .gate = { CGU_REG_CLKGR0, 7 }, 514 + }, 515 + 516 + [JZ4780_CLK_AIC] = { 517 + "aic", CGU_CLK_GATE, 518 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 519 + .gate = { CGU_REG_CLKGR0, 8 }, 520 + }, 521 + 522 + [JZ4780_CLK_TSSI0] = { 523 + "tssi0", CGU_CLK_GATE, 524 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 525 + .gate = { CGU_REG_CLKGR0, 9 }, 526 + }, 527 + 528 + [JZ4780_CLK_OWI] = { 529 + "owi", CGU_CLK_GATE, 530 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 531 + .gate = { CGU_REG_CLKGR0, 10 }, 532 + }, 533 + 534 + [JZ4780_CLK_KBC] = { 535 + "kbc", CGU_CLK_GATE, 536 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 537 + .gate = { CGU_REG_CLKGR0, 13 }, 538 + }, 539 + 540 + [JZ4780_CLK_SADC] = { 541 + "sadc", CGU_CLK_GATE, 542 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 543 + .gate = { CGU_REG_CLKGR0, 14 }, 544 + }, 545 + 546 + [JZ4780_CLK_UART0] = { 547 + "uart0", CGU_CLK_GATE, 548 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 549 + .gate = { CGU_REG_CLKGR0, 15 }, 550 + }, 551 + 552 + [JZ4780_CLK_UART1] = { 553 + "uart1", CGU_CLK_GATE, 554 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 555 + .gate = { CGU_REG_CLKGR0, 16 }, 556 + }, 557 + 558 + [JZ4780_CLK_UART2] = { 559 + "uart2", CGU_CLK_GATE, 560 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 561 + .gate = { CGU_REG_CLKGR0, 17 }, 562 + }, 563 + 564 + [JZ4780_CLK_UART3] = { 565 + "uart3", CGU_CLK_GATE, 566 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 567 + .gate = { CGU_REG_CLKGR0, 18 }, 568 + }, 569 + 570 + [JZ4780_CLK_SSI1] = { 571 + "ssi1", CGU_CLK_GATE, 572 + .parents = { JZ4780_CLK_SSI, -1, -1, -1 }, 573 + .gate = { CGU_REG_CLKGR0, 19 }, 574 + }, 575 + 576 + [JZ4780_CLK_SSI2] = { 577 + "ssi2", CGU_CLK_GATE, 578 + .parents = { JZ4780_CLK_SSI, -1, -1, -1 }, 579 + .gate = { CGU_REG_CLKGR0, 20 }, 580 + }, 581 + 582 + [JZ4780_CLK_PDMA] = { 583 + "pdma", CGU_CLK_GATE, 584 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 585 + .gate = { CGU_REG_CLKGR0, 21 }, 586 + }, 587 + 588 + [JZ4780_CLK_GPS] = { 589 + "gps", CGU_CLK_GATE, 590 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 591 + .gate = { CGU_REG_CLKGR0, 22 }, 592 + }, 593 + 594 + [JZ4780_CLK_MAC] = { 595 + "mac", CGU_CLK_GATE, 596 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 597 + .gate = { CGU_REG_CLKGR0, 23 }, 598 + }, 599 + 600 + [JZ4780_CLK_SMB2] = { 601 + "smb2", CGU_CLK_GATE, 602 + .parents = { JZ4780_CLK_PCLK, -1, -1, -1 }, 603 + .gate = { CGU_REG_CLKGR0, 24 }, 604 + }, 605 + 606 + [JZ4780_CLK_CIM] = { 607 + "cim", CGU_CLK_GATE, 608 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 609 + .gate = { CGU_REG_CLKGR0, 26 }, 610 + }, 611 + 612 + [JZ4780_CLK_LCD] = { 613 + "lcd", CGU_CLK_GATE, 614 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 615 + .gate = { CGU_REG_CLKGR0, 28 }, 616 + }, 617 + 618 + [JZ4780_CLK_TVE] = { 619 + "tve", CGU_CLK_GATE, 620 + .parents = { JZ4780_CLK_LCD, -1, -1, -1 }, 621 + .gate = { CGU_REG_CLKGR0, 27 }, 622 + }, 623 + 624 + [JZ4780_CLK_IPU] = { 625 + "ipu", CGU_CLK_GATE, 626 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 627 + .gate = { CGU_REG_CLKGR0, 29 }, 628 + }, 629 + 630 + [JZ4780_CLK_DDR0] = { 631 + "ddr0", CGU_CLK_GATE, 632 + .parents = { JZ4780_CLK_DDR, -1, -1, -1 }, 633 + .gate = { CGU_REG_CLKGR0, 30 }, 634 + }, 635 + 636 + [JZ4780_CLK_DDR1] = { 637 + "ddr1", CGU_CLK_GATE, 638 + .parents = { JZ4780_CLK_DDR, -1, -1, -1 }, 639 + .gate = { CGU_REG_CLKGR0, 31 }, 640 + }, 641 + 642 + [JZ4780_CLK_SMB3] = { 643 + "smb3", CGU_CLK_GATE, 644 + .parents = { JZ4780_CLK_PCLK, -1, -1, -1 }, 645 + .gate = { CGU_REG_CLKGR1, 0 }, 646 + }, 647 + 648 + [JZ4780_CLK_TSSI1] = { 649 + "tssi1", CGU_CLK_GATE, 650 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 651 + .gate = { CGU_REG_CLKGR1, 1 }, 652 + }, 653 + 654 + [JZ4780_CLK_COMPRESS] = { 655 + "compress", CGU_CLK_GATE, 656 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 657 + .gate = { CGU_REG_CLKGR1, 5 }, 658 + }, 659 + 660 + [JZ4780_CLK_AIC1] = { 661 + "aic1", CGU_CLK_GATE, 662 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 663 + .gate = { CGU_REG_CLKGR1, 6 }, 664 + }, 665 + 666 + [JZ4780_CLK_GPVLC] = { 667 + "gpvlc", CGU_CLK_GATE, 668 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 669 + .gate = { CGU_REG_CLKGR1, 7 }, 670 + }, 671 + 672 + [JZ4780_CLK_OTG1] = { 673 + "otg1", CGU_CLK_GATE, 674 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 675 + .gate = { CGU_REG_CLKGR1, 8 }, 676 + }, 677 + 678 + [JZ4780_CLK_UART4] = { 679 + "uart4", CGU_CLK_GATE, 680 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 681 + .gate = { CGU_REG_CLKGR1, 10 }, 682 + }, 683 + 684 + [JZ4780_CLK_AHBMON] = { 685 + "ahb_mon", CGU_CLK_GATE, 686 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 687 + .gate = { CGU_REG_CLKGR1, 11 }, 688 + }, 689 + 690 + [JZ4780_CLK_SMB4] = { 691 + "smb4", CGU_CLK_GATE, 692 + .parents = { JZ4780_CLK_PCLK, -1, -1, -1 }, 693 + .gate = { CGU_REG_CLKGR1, 12 }, 694 + }, 695 + 696 + [JZ4780_CLK_DES] = { 697 + "des", CGU_CLK_GATE, 698 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 699 + .gate = { CGU_REG_CLKGR1, 13 }, 700 + }, 701 + 702 + [JZ4780_CLK_X2D] = { 703 + "x2d", CGU_CLK_GATE, 704 + .parents = { JZ4780_CLK_EXCLK, -1, -1, -1 }, 705 + .gate = { CGU_REG_CLKGR1, 14 }, 706 + }, 707 + 708 + [JZ4780_CLK_CORE1] = { 709 + "core1", CGU_CLK_GATE, 710 + .parents = { JZ4780_CLK_CPU, -1, -1, -1 }, 711 + .gate = { CGU_REG_CLKGR1, 15 }, 712 + }, 713 + 714 + }; 715 + 716 + static void __init jz4780_cgu_init(struct device_node *np) 717 + { 718 + int retval; 719 + 720 + cgu = ingenic_cgu_new(jz4780_cgu_clocks, 721 + ARRAY_SIZE(jz4780_cgu_clocks), np); 722 + if (!cgu) { 723 + pr_err("%s: failed to initialise CGU\n", __func__); 724 + return; 725 + } 726 + 727 + retval = ingenic_cgu_register_clocks(cgu); 728 + if (retval) { 729 + pr_err("%s: failed to register CGU Clocks\n", __func__); 730 + return; 731 + } 732 + } 733 + CLK_OF_DECLARE(jz4780_cgu, "ingenic,jz4780-cgu", jz4780_cgu_init);
+2 -2
drivers/cpufreq/ls1x-cpufreq.c
··· 17 17 #include <linux/platform_device.h> 18 18 #include <linux/slab.h> 19 19 20 - #include <asm/mach-loongson1/cpufreq.h> 21 - #include <asm/mach-loongson1/loongson1.h> 20 + #include <cpufreq.h> 21 + #include <loongson1.h> 22 22 23 23 static struct { 24 24 struct device *dev;
+1
drivers/firmware/Kconfig
··· 136 136 bool 137 137 depends on ARM || ARM64 138 138 139 + source "drivers/firmware/broadcom/Kconfig" 139 140 source "drivers/firmware/google/Kconfig" 140 141 source "drivers/firmware/efi/Kconfig" 141 142
+1
drivers/firmware/Makefile
··· 15 15 obj-$(CONFIG_QCOM_SCM) += qcom_scm-32.o 16 16 CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1) 17 17 18 + obj-y += broadcom/ 18 19 obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ 19 20 obj-$(CONFIG_EFI) += efi/ 20 21 obj-$(CONFIG_UEFI_CPER) += efi/
+11
drivers/firmware/broadcom/Kconfig
··· 1 + config BCM47XX_NVRAM 2 + bool "Broadcom NVRAM driver" 3 + depends on BCM47XX || ARCH_BCM_5301X 4 + help 5 + Broadcom home routers contain flash partition called "nvram" with all 6 + important hardware configuration as well as some minor user setup. 7 + NVRAM partition contains a text-like data representing name=value 8 + pairs. 9 + This driver provides an easy way to get value of requested parameter. 10 + It simply reads content of NVRAM and parses it. It doesn't control any 11 + hardware part itself.
+1
drivers/firmware/broadcom/Makefile
··· 1 + obj-$(CONFIG_BCM47XX_NVRAM) += bcm47xx_nvram.o
+248
drivers/firmware/broadcom/bcm47xx_nvram.c
··· 1 + /* 2 + * BCM947xx nvram variable access 3 + * 4 + * Copyright (C) 2005 Broadcom Corporation 5 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> 6 + * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de> 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 12 + */ 13 + 14 + #include <linux/io.h> 15 + #include <linux/types.h> 16 + #include <linux/module.h> 17 + #include <linux/kernel.h> 18 + #include <linux/string.h> 19 + #include <linux/mtd/mtd.h> 20 + #include <linux/bcm47xx_nvram.h> 21 + 22 + #define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ 23 + #define NVRAM_SPACE 0x10000 24 + #define NVRAM_MAX_GPIO_ENTRIES 32 25 + #define NVRAM_MAX_GPIO_VALUE_LEN 30 26 + 27 + #define FLASH_MIN 0x00020000 /* Minimum flash size */ 28 + 29 + struct nvram_header { 30 + u32 magic; 31 + u32 len; 32 + u32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */ 33 + u32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */ 34 + u32 config_ncdl; /* ncdl values for memc */ 35 + }; 36 + 37 + static char nvram_buf[NVRAM_SPACE]; 38 + static size_t nvram_len; 39 + static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; 40 + 41 + static u32 find_nvram_size(void __iomem *end) 42 + { 43 + struct nvram_header __iomem *header; 44 + int i; 45 + 46 + for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { 47 + header = (struct nvram_header *)(end - nvram_sizes[i]); 48 + if (header->magic == NVRAM_MAGIC) 49 + return nvram_sizes[i]; 50 + } 51 + 52 + return 0; 53 + } 54 + 55 + /* Probe for NVRAM header */ 56 + static int nvram_find_and_copy(void __iomem *iobase, u32 lim) 57 + { 58 + struct nvram_header __iomem *header; 59 + int i; 60 + u32 off; 61 + u32 *src, *dst; 62 + u32 size; 63 + 64 + if (nvram_len) { 65 + pr_warn("nvram already initialized\n"); 66 + return -EEXIST; 67 + } 68 + 69 + /* TODO: when nvram is on nand flash check for bad blocks first. */ 70 + off = FLASH_MIN; 71 + while (off <= lim) { 72 + /* Windowed flash access */ 73 + size = find_nvram_size(iobase + off); 74 + if (size) { 75 + header = (struct nvram_header *)(iobase + off - size); 76 + goto found; 77 + } 78 + off <<= 1; 79 + } 80 + 81 + /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ 82 + header = (struct nvram_header *)(iobase + 4096); 83 + if (header->magic == NVRAM_MAGIC) { 84 + size = NVRAM_SPACE; 85 + goto found; 86 + } 87 + 88 + header = (struct nvram_header *)(iobase + 1024); 89 + if (header->magic == NVRAM_MAGIC) { 90 + size = NVRAM_SPACE; 91 + goto found; 92 + } 93 + 94 + pr_err("no nvram found\n"); 95 + return -ENXIO; 96 + 97 + found: 98 + src = (u32 *)header; 99 + dst = (u32 *)nvram_buf; 100 + for (i = 0; i < sizeof(struct nvram_header); i += 4) 101 + *dst++ = __raw_readl(src++); 102 + header = (struct nvram_header *)nvram_buf; 103 + nvram_len = header->len; 104 + if (nvram_len > size) { 105 + pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n"); 106 + nvram_len = size; 107 + } 108 + if (nvram_len >= NVRAM_SPACE) { 109 + pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", 110 + header->len, NVRAM_SPACE - 1); 111 + nvram_len = NVRAM_SPACE - 1; 112 + } 113 + /* proceed reading data after header */ 114 + for (; i < nvram_len; i += 4) 115 + *dst++ = readl(src++); 116 + nvram_buf[NVRAM_SPACE - 1] = '\0'; 117 + 118 + return 0; 119 + } 120 + 121 + /* 122 + * On bcm47xx we need access to the NVRAM very early, so we can't use mtd 123 + * subsystem to access flash. We can't even use platform device / driver to 124 + * store memory offset. 125 + * To handle this we provide following symbol. It's supposed to be called as 126 + * soon as we get info about flash device, before any NVRAM entry is needed. 127 + */ 128 + int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) 129 + { 130 + void __iomem *iobase; 131 + int err; 132 + 133 + iobase = ioremap_nocache(base, lim); 134 + if (!iobase) 135 + return -ENOMEM; 136 + 137 + err = nvram_find_and_copy(iobase, lim); 138 + 139 + iounmap(iobase); 140 + 141 + return err; 142 + } 143 + 144 + static int nvram_init(void) 145 + { 146 + #ifdef CONFIG_MTD 147 + struct mtd_info *mtd; 148 + struct nvram_header header; 149 + size_t bytes_read; 150 + int err; 151 + 152 + mtd = get_mtd_device_nm("nvram"); 153 + if (IS_ERR(mtd)) 154 + return -ENODEV; 155 + 156 + err = mtd_read(mtd, 0, sizeof(header), &bytes_read, (uint8_t *)&header); 157 + if (!err && header.magic == NVRAM_MAGIC && 158 + header.len > sizeof(header)) { 159 + nvram_len = header.len; 160 + if (nvram_len >= NVRAM_SPACE) { 161 + pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", 162 + header.len, NVRAM_SPACE); 163 + nvram_len = NVRAM_SPACE - 1; 164 + } 165 + 166 + err = mtd_read(mtd, 0, nvram_len, &nvram_len, 167 + (u8 *)nvram_buf); 168 + return err; 169 + } 170 + #endif 171 + 172 + return -ENXIO; 173 + } 174 + 175 + int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) 176 + { 177 + char *var, *value, *end, *eq; 178 + int err; 179 + 180 + if (!name) 181 + return -EINVAL; 182 + 183 + if (!nvram_len) { 184 + err = nvram_init(); 185 + if (err) 186 + return err; 187 + } 188 + 189 + /* Look for name=value and return value */ 190 + var = &nvram_buf[sizeof(struct nvram_header)]; 191 + end = nvram_buf + sizeof(nvram_buf); 192 + while (var < end && *var) { 193 + eq = strchr(var, '='); 194 + if (!eq) 195 + break; 196 + value = eq + 1; 197 + if (eq - var == strlen(name) && 198 + strncmp(var, name, eq - var) == 0) 199 + return snprintf(val, val_len, "%s", value); 200 + var = value + strlen(value) + 1; 201 + } 202 + return -ENOENT; 203 + } 204 + EXPORT_SYMBOL(bcm47xx_nvram_getenv); 205 + 206 + int bcm47xx_nvram_gpio_pin(const char *name) 207 + { 208 + int i, err; 209 + char nvram_var[] = "gpioXX"; 210 + char buf[NVRAM_MAX_GPIO_VALUE_LEN]; 211 + 212 + /* TODO: Optimize it to don't call getenv so many times */ 213 + for (i = 0; i < NVRAM_MAX_GPIO_ENTRIES; i++) { 214 + err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i); 215 + if (err <= 0) 216 + continue; 217 + err = bcm47xx_nvram_getenv(nvram_var, buf, sizeof(buf)); 218 + if (err <= 0) 219 + continue; 220 + if (!strcmp(name, buf)) 221 + return i; 222 + } 223 + return -ENOENT; 224 + } 225 + EXPORT_SYMBOL(bcm47xx_nvram_gpio_pin); 226 + 227 + char *bcm47xx_nvram_get_contents(size_t *nvram_size) 228 + { 229 + int err; 230 + char *nvram; 231 + 232 + if (!nvram_len) { 233 + err = nvram_init(); 234 + if (err) 235 + return NULL; 236 + } 237 + 238 + *nvram_size = nvram_len - sizeof(struct nvram_header); 239 + nvram = vmalloc(*nvram_size); 240 + if (!nvram) 241 + return NULL; 242 + memcpy(nvram, &nvram_buf[sizeof(struct nvram_header)], *nvram_size); 243 + 244 + return nvram; 245 + } 246 + EXPORT_SYMBOL(bcm47xx_nvram_get_contents); 247 + 248 + MODULE_LICENSE("GPLv2");
+10
drivers/irqchip/Kconfig
··· 86 86 select GENERIC_IRQ_CHIP 87 87 select IRQ_DOMAIN 88 88 89 + config IRQ_MIPS_CPU 90 + bool 91 + select GENERIC_IRQ_CHIP 92 + select IRQ_DOMAIN 93 + 89 94 config CLPS711X_IRQCHIP 90 95 bool 91 96 depends on ARCH_CLPS711X ··· 164 159 config MIPS_GIC 165 160 bool 166 161 select MIPS_CM 162 + 163 + config INGENIC_IRQ 164 + bool 165 + depends on MACH_INGENIC 166 + default y 167 167 168 168 config RENESAS_H8300H_INTC 169 169 bool
+2
drivers/irqchip/Makefile
··· 28 28 obj-$(CONFIG_ATMEL_AIC_IRQ) += irq-atmel-aic-common.o irq-atmel-aic.o 29 29 obj-$(CONFIG_ATMEL_AIC5_IRQ) += irq-atmel-aic-common.o irq-atmel-aic5.o 30 30 obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o 31 + obj-$(CONFIG_IRQ_MIPS_CPU) += irq-mips-cpu.o 31 32 obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o 32 33 obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o 33 34 obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o ··· 51 50 obj-$(CONFIG_RENESAS_H8300H_INTC) += irq-renesas-h8300h.o 52 51 obj-$(CONFIG_RENESAS_H8S_INTC) += irq-renesas-h8s.o 53 52 obj-$(CONFIG_ARCH_SA1100) += irq-sa11x0.o 53 + obj-$(CONFIG_INGENIC_IRQ) += irq-ingenic.o
+177
drivers/irqchip/irq-ingenic.c
··· 1 + /* 2 + * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> 3 + * JZ4740 platform IRQ support 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 + * You should have received a copy of the GNU General Public License along 11 + * with this program; if not, write to the Free Software Foundation, Inc., 12 + * 675 Mass Ave, Cambridge, MA 02139, USA. 13 + * 14 + */ 15 + 16 + #include <linux/errno.h> 17 + #include <linux/init.h> 18 + #include <linux/types.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/ioport.h> 21 + #include <linux/irqchip/ingenic.h> 22 + #include <linux/of_address.h> 23 + #include <linux/of_irq.h> 24 + #include <linux/timex.h> 25 + #include <linux/slab.h> 26 + #include <linux/delay.h> 27 + 28 + #include <asm/io.h> 29 + #include <asm/mach-jz4740/irq.h> 30 + 31 + #include "irqchip.h" 32 + 33 + struct ingenic_intc_data { 34 + void __iomem *base; 35 + unsigned num_chips; 36 + }; 37 + 38 + #define JZ_REG_INTC_STATUS 0x00 39 + #define JZ_REG_INTC_MASK 0x04 40 + #define JZ_REG_INTC_SET_MASK 0x08 41 + #define JZ_REG_INTC_CLEAR_MASK 0x0c 42 + #define JZ_REG_INTC_PENDING 0x10 43 + #define CHIP_SIZE 0x20 44 + 45 + static irqreturn_t intc_cascade(int irq, void *data) 46 + { 47 + struct ingenic_intc_data *intc = irq_get_handler_data(irq); 48 + uint32_t irq_reg; 49 + unsigned i; 50 + 51 + for (i = 0; i < intc->num_chips; i++) { 52 + irq_reg = readl(intc->base + (i * CHIP_SIZE) + 53 + JZ_REG_INTC_PENDING); 54 + if (!irq_reg) 55 + continue; 56 + 57 + generic_handle_irq(__fls(irq_reg) + (i * 32) + JZ4740_IRQ_BASE); 58 + } 59 + 60 + return IRQ_HANDLED; 61 + } 62 + 63 + static void intc_irq_set_mask(struct irq_chip_generic *gc, uint32_t mask) 64 + { 65 + struct irq_chip_regs *regs = &gc->chip_types->regs; 66 + 67 + writel(mask, gc->reg_base + regs->enable); 68 + writel(~mask, gc->reg_base + regs->disable); 69 + } 70 + 71 + void ingenic_intc_irq_suspend(struct irq_data *data) 72 + { 73 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); 74 + intc_irq_set_mask(gc, gc->wake_active); 75 + } 76 + 77 + void ingenic_intc_irq_resume(struct irq_data *data) 78 + { 79 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); 80 + intc_irq_set_mask(gc, gc->mask_cache); 81 + } 82 + 83 + static struct irqaction intc_cascade_action = { 84 + .handler = intc_cascade, 85 + .name = "SoC intc cascade interrupt", 86 + }; 87 + 88 + static int __init ingenic_intc_of_init(struct device_node *node, 89 + unsigned num_chips) 90 + { 91 + struct ingenic_intc_data *intc; 92 + struct irq_chip_generic *gc; 93 + struct irq_chip_type *ct; 94 + struct irq_domain *domain; 95 + int parent_irq, err = 0; 96 + unsigned i; 97 + 98 + intc = kzalloc(sizeof(*intc), GFP_KERNEL); 99 + if (!intc) { 100 + err = -ENOMEM; 101 + goto out_err; 102 + } 103 + 104 + parent_irq = irq_of_parse_and_map(node, 0); 105 + if (!parent_irq) { 106 + err = -EINVAL; 107 + goto out_free; 108 + } 109 + 110 + err = irq_set_handler_data(parent_irq, intc); 111 + if (err) 112 + goto out_unmap_irq; 113 + 114 + intc->num_chips = num_chips; 115 + intc->base = of_iomap(node, 0); 116 + if (!intc->base) { 117 + err = -ENODEV; 118 + goto out_unmap_irq; 119 + } 120 + 121 + for (i = 0; i < num_chips; i++) { 122 + /* Mask all irqs */ 123 + writel(0xffffffff, intc->base + (i * CHIP_SIZE) + 124 + JZ_REG_INTC_SET_MASK); 125 + 126 + gc = irq_alloc_generic_chip("INTC", 1, 127 + JZ4740_IRQ_BASE + (i * 32), 128 + intc->base + (i * CHIP_SIZE), 129 + handle_level_irq); 130 + 131 + gc->wake_enabled = IRQ_MSK(32); 132 + 133 + ct = gc->chip_types; 134 + ct->regs.enable = JZ_REG_INTC_CLEAR_MASK; 135 + ct->regs.disable = JZ_REG_INTC_SET_MASK; 136 + ct->chip.irq_unmask = irq_gc_unmask_enable_reg; 137 + ct->chip.irq_mask = irq_gc_mask_disable_reg; 138 + ct->chip.irq_mask_ack = irq_gc_mask_disable_reg; 139 + ct->chip.irq_set_wake = irq_gc_set_wake; 140 + ct->chip.irq_suspend = ingenic_intc_irq_suspend; 141 + ct->chip.irq_resume = ingenic_intc_irq_resume; 142 + 143 + irq_setup_generic_chip(gc, IRQ_MSK(32), 0, 0, 144 + IRQ_NOPROBE | IRQ_LEVEL); 145 + } 146 + 147 + domain = irq_domain_add_legacy(node, num_chips * 32, JZ4740_IRQ_BASE, 0, 148 + &irq_domain_simple_ops, NULL); 149 + if (!domain) 150 + pr_warn("unable to register IRQ domain\n"); 151 + 152 + setup_irq(parent_irq, &intc_cascade_action); 153 + return 0; 154 + 155 + out_unmap_irq: 156 + irq_dispose_mapping(parent_irq); 157 + out_free: 158 + kfree(intc); 159 + out_err: 160 + return err; 161 + } 162 + 163 + static int __init intc_1chip_of_init(struct device_node *node, 164 + struct device_node *parent) 165 + { 166 + return ingenic_intc_of_init(node, 1); 167 + } 168 + IRQCHIP_DECLARE(jz4740_intc, "ingenic,jz4740-intc", intc_1chip_of_init); 169 + 170 + static int __init intc_2chip_of_init(struct device_node *node, 171 + struct device_node *parent) 172 + { 173 + return ingenic_intc_of_init(node, 2); 174 + } 175 + IRQCHIP_DECLARE(jz4770_intc, "ingenic,jz4770-intc", intc_2chip_of_init); 176 + IRQCHIP_DECLARE(jz4775_intc, "ingenic,jz4775-intc", intc_2chip_of_init); 177 + IRQCHIP_DECLARE(jz4780_intc, "ingenic,jz4780-intc", intc_2chip_of_init);
+172
drivers/irqchip/irq-mips-cpu.c
··· 1 + /* 2 + * Copyright 2001 MontaVista Software Inc. 3 + * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 4 + * 5 + * Copyright (C) 2001 Ralf Baechle 6 + * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 7 + * Author: Maciej W. Rozycki <macro@mips.com> 8 + * 9 + * This file define the irq handler for MIPS CPU interrupts. 10 + * 11 + * This program is free software; you can redistribute it and/or modify it 12 + * under the terms of the GNU General Public License as published by the 13 + * Free Software Foundation; either version 2 of the License, or (at your 14 + * option) any later version. 15 + */ 16 + 17 + /* 18 + * Almost all MIPS CPUs define 8 interrupt sources. They are typically 19 + * level triggered (i.e., cannot be cleared from CPU; must be cleared from 20 + * device). The first two are software interrupts which we don't really 21 + * use or support. The last one is usually the CPU timer interrupt if 22 + * counter register is present or, for CPUs with an external FPU, by 23 + * convention it's the FPU exception interrupt. 24 + * 25 + * Don't even think about using this on SMP. You have been warned. 26 + * 27 + * This file exports one global function: 28 + * void mips_cpu_irq_init(void); 29 + */ 30 + #include <linux/init.h> 31 + #include <linux/interrupt.h> 32 + #include <linux/kernel.h> 33 + #include <linux/irq.h> 34 + #include <linux/irqdomain.h> 35 + 36 + #include <asm/irq_cpu.h> 37 + #include <asm/mipsregs.h> 38 + #include <asm/mipsmtregs.h> 39 + #include <asm/setup.h> 40 + 41 + #include "irqchip.h" 42 + 43 + static inline void unmask_mips_irq(struct irq_data *d) 44 + { 45 + set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 46 + irq_enable_hazard(); 47 + } 48 + 49 + static inline void mask_mips_irq(struct irq_data *d) 50 + { 51 + clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 52 + irq_disable_hazard(); 53 + } 54 + 55 + static struct irq_chip mips_cpu_irq_controller = { 56 + .name = "MIPS", 57 + .irq_ack = mask_mips_irq, 58 + .irq_mask = mask_mips_irq, 59 + .irq_mask_ack = mask_mips_irq, 60 + .irq_unmask = unmask_mips_irq, 61 + .irq_eoi = unmask_mips_irq, 62 + .irq_disable = mask_mips_irq, 63 + .irq_enable = unmask_mips_irq, 64 + }; 65 + 66 + /* 67 + * Basically the same as above but taking care of all the MT stuff 68 + */ 69 + 70 + static unsigned int mips_mt_cpu_irq_startup(struct irq_data *d) 71 + { 72 + unsigned int vpflags = dvpe(); 73 + 74 + clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 75 + evpe(vpflags); 76 + unmask_mips_irq(d); 77 + return 0; 78 + } 79 + 80 + /* 81 + * While we ack the interrupt interrupts are disabled and thus we don't need 82 + * to deal with concurrency issues. Same for mips_cpu_irq_end. 83 + */ 84 + static void mips_mt_cpu_irq_ack(struct irq_data *d) 85 + { 86 + unsigned int vpflags = dvpe(); 87 + clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 88 + evpe(vpflags); 89 + mask_mips_irq(d); 90 + } 91 + 92 + static struct irq_chip mips_mt_cpu_irq_controller = { 93 + .name = "MIPS", 94 + .irq_startup = mips_mt_cpu_irq_startup, 95 + .irq_ack = mips_mt_cpu_irq_ack, 96 + .irq_mask = mask_mips_irq, 97 + .irq_mask_ack = mips_mt_cpu_irq_ack, 98 + .irq_unmask = unmask_mips_irq, 99 + .irq_eoi = unmask_mips_irq, 100 + .irq_disable = mask_mips_irq, 101 + .irq_enable = unmask_mips_irq, 102 + }; 103 + 104 + asmlinkage void __weak plat_irq_dispatch(void) 105 + { 106 + unsigned long pending = read_c0_cause() & read_c0_status() & ST0_IM; 107 + int irq; 108 + 109 + if (!pending) { 110 + spurious_interrupt(); 111 + return; 112 + } 113 + 114 + pending >>= CAUSEB_IP; 115 + while (pending) { 116 + irq = fls(pending) - 1; 117 + do_IRQ(MIPS_CPU_IRQ_BASE + irq); 118 + pending &= ~BIT(irq); 119 + } 120 + } 121 + 122 + static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq, 123 + irq_hw_number_t hw) 124 + { 125 + static struct irq_chip *chip; 126 + 127 + if (hw < 2 && cpu_has_mipsmt) { 128 + /* Software interrupts are used for MT/CMT IPI */ 129 + chip = &mips_mt_cpu_irq_controller; 130 + } else { 131 + chip = &mips_cpu_irq_controller; 132 + } 133 + 134 + if (cpu_has_vint) 135 + set_vi_handler(hw, plat_irq_dispatch); 136 + 137 + irq_set_chip_and_handler(irq, chip, handle_percpu_irq); 138 + 139 + return 0; 140 + } 141 + 142 + static const struct irq_domain_ops mips_cpu_intc_irq_domain_ops = { 143 + .map = mips_cpu_intc_map, 144 + .xlate = irq_domain_xlate_onecell, 145 + }; 146 + 147 + static void __init __mips_cpu_irq_init(struct device_node *of_node) 148 + { 149 + struct irq_domain *domain; 150 + 151 + /* Mask interrupts. */ 152 + clear_c0_status(ST0_IM); 153 + clear_c0_cause(CAUSEF_IP); 154 + 155 + domain = irq_domain_add_legacy(of_node, 8, MIPS_CPU_IRQ_BASE, 0, 156 + &mips_cpu_intc_irq_domain_ops, NULL); 157 + if (!domain) 158 + panic("Failed to add irqdomain for MIPS CPU"); 159 + } 160 + 161 + void __init mips_cpu_irq_init(void) 162 + { 163 + __mips_cpu_irq_init(NULL); 164 + } 165 + 166 + int __init mips_cpu_irq_of_init(struct device_node *of_node, 167 + struct device_node *parent) 168 + { 169 + __mips_cpu_irq_init(of_node); 170 + return 0; 171 + } 172 + IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init);
+7
drivers/phy/Kconfig
··· 267 267 This driver provides PHY interface for USB 3.0 DRD controller 268 268 present on Exynos5 SoC series. 269 269 270 + config PHY_PISTACHIO_USB 271 + tristate "IMG Pistachio USB2.0 PHY driver" 272 + depends on MACH_PISTACHIO 273 + select GENERIC_PHY 274 + help 275 + Enable this to support the USB2.0 PHY on the IMG Pistachio SoC. 276 + 270 277 config PHY_QCOM_APQ8064_SATA 271 278 tristate "Qualcomm APQ8064 SATA SerDes/PHY driver" 272 279 depends on ARCH_QCOM
+1
drivers/phy/Makefile
··· 44 44 obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-14nm.o 45 45 obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o 46 46 obj-$(CONFIG_PHY_BRCMSTB_SATA) += phy-brcmstb-sata.o 47 + obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o
+206
drivers/phy/phy-pistachio-usb.c
··· 1 + /* 2 + * IMG Pistachio USB PHY driver 3 + * 4 + * Copyright (C) 2015 Google, Inc. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + */ 10 + 11 + #include <linux/clk.h> 12 + #include <linux/delay.h> 13 + #include <linux/io.h> 14 + #include <linux/kernel.h> 15 + #include <linux/mfd/syscon.h> 16 + #include <linux/module.h> 17 + #include <linux/of.h> 18 + #include <linux/phy/phy.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/regmap.h> 21 + 22 + #include <dt-bindings/phy/phy-pistachio-usb.h> 23 + 24 + #define USB_PHY_CONTROL1 0x04 25 + #define USB_PHY_CONTROL1_FSEL_SHIFT 2 26 + #define USB_PHY_CONTROL1_FSEL_MASK 0x7 27 + 28 + #define USB_PHY_STRAP_CONTROL 0x10 29 + #define USB_PHY_STRAP_CONTROL_REFCLK_SHIFT 4 30 + #define USB_PHY_STRAP_CONTROL_REFCLK_MASK 0x3 31 + 32 + #define USB_PHY_STATUS 0x14 33 + #define USB_PHY_STATUS_RX_PHY_CLK BIT(9) 34 + #define USB_PHY_STATUS_RX_UTMI_CLK BIT(8) 35 + #define USB_PHY_STATUS_VBUS_FAULT BIT(7) 36 + 37 + struct pistachio_usb_phy { 38 + struct device *dev; 39 + struct regmap *cr_top; 40 + struct clk *phy_clk; 41 + unsigned int refclk; 42 + }; 43 + 44 + static const unsigned long fsel_rate_map[] = { 45 + 9600000, 46 + 10000000, 47 + 12000000, 48 + 19200000, 49 + 20000000, 50 + 24000000, 51 + 0, 52 + 50000000, 53 + }; 54 + 55 + static int pistachio_usb_phy_power_on(struct phy *phy) 56 + { 57 + struct pistachio_usb_phy *p_phy = phy_get_drvdata(phy); 58 + unsigned long timeout, rate; 59 + unsigned int i; 60 + int ret; 61 + 62 + ret = clk_prepare_enable(p_phy->phy_clk); 63 + if (ret < 0) { 64 + dev_err(p_phy->dev, "Failed to enable PHY clock: %d\n", ret); 65 + return ret; 66 + } 67 + 68 + regmap_update_bits(p_phy->cr_top, USB_PHY_STRAP_CONTROL, 69 + USB_PHY_STRAP_CONTROL_REFCLK_MASK << 70 + USB_PHY_STRAP_CONTROL_REFCLK_SHIFT, 71 + p_phy->refclk << USB_PHY_STRAP_CONTROL_REFCLK_SHIFT); 72 + 73 + rate = clk_get_rate(p_phy->phy_clk); 74 + if (p_phy->refclk == REFCLK_XO_CRYSTAL && rate != 12000000) { 75 + dev_err(p_phy->dev, "Unsupported rate for XO crystal: %ld\n", 76 + rate); 77 + ret = -EINVAL; 78 + goto disable_clk; 79 + } 80 + 81 + for (i = 0; i < ARRAY_SIZE(fsel_rate_map); i++) { 82 + if (rate == fsel_rate_map[i]) 83 + break; 84 + } 85 + if (i == ARRAY_SIZE(fsel_rate_map)) { 86 + dev_err(p_phy->dev, "Unsupported clock rate: %lu\n", rate); 87 + ret = -EINVAL; 88 + goto disable_clk; 89 + } 90 + 91 + regmap_update_bits(p_phy->cr_top, USB_PHY_CONTROL1, 92 + USB_PHY_CONTROL1_FSEL_MASK << 93 + USB_PHY_CONTROL1_FSEL_SHIFT, 94 + i << USB_PHY_CONTROL1_FSEL_SHIFT); 95 + 96 + timeout = jiffies + msecs_to_jiffies(200); 97 + while (time_before(jiffies, timeout)) { 98 + unsigned int val; 99 + 100 + regmap_read(p_phy->cr_top, USB_PHY_STATUS, &val); 101 + if (val & USB_PHY_STATUS_VBUS_FAULT) { 102 + dev_err(p_phy->dev, "VBUS fault detected\n"); 103 + ret = -EIO; 104 + goto disable_clk; 105 + } 106 + if ((val & USB_PHY_STATUS_RX_PHY_CLK) && 107 + (val & USB_PHY_STATUS_RX_UTMI_CLK)) 108 + return 0; 109 + usleep_range(1000, 1500); 110 + } 111 + 112 + dev_err(p_phy->dev, "Timed out waiting for PHY to power on\n"); 113 + ret = -ETIMEDOUT; 114 + 115 + disable_clk: 116 + clk_disable_unprepare(p_phy->phy_clk); 117 + return ret; 118 + } 119 + 120 + static int pistachio_usb_phy_power_off(struct phy *phy) 121 + { 122 + struct pistachio_usb_phy *p_phy = phy_get_drvdata(phy); 123 + 124 + clk_disable_unprepare(p_phy->phy_clk); 125 + 126 + return 0; 127 + } 128 + 129 + static const struct phy_ops pistachio_usb_phy_ops = { 130 + .power_on = pistachio_usb_phy_power_on, 131 + .power_off = pistachio_usb_phy_power_off, 132 + .owner = THIS_MODULE, 133 + }; 134 + 135 + static int pistachio_usb_phy_probe(struct platform_device *pdev) 136 + { 137 + struct pistachio_usb_phy *p_phy; 138 + struct phy_provider *provider; 139 + struct phy *phy; 140 + int ret; 141 + 142 + p_phy = devm_kzalloc(&pdev->dev, sizeof(*p_phy), GFP_KERNEL); 143 + if (!p_phy) 144 + return -ENOMEM; 145 + p_phy->dev = &pdev->dev; 146 + platform_set_drvdata(pdev, p_phy); 147 + 148 + p_phy->cr_top = syscon_regmap_lookup_by_phandle(p_phy->dev->of_node, 149 + "img,cr-top"); 150 + if (IS_ERR(p_phy->cr_top)) { 151 + dev_err(p_phy->dev, "Failed to get CR_TOP registers: %ld\n", 152 + PTR_ERR(p_phy->cr_top)); 153 + return PTR_ERR(p_phy->cr_top); 154 + } 155 + 156 + p_phy->phy_clk = devm_clk_get(p_phy->dev, "usb_phy"); 157 + if (IS_ERR(p_phy->phy_clk)) { 158 + dev_err(p_phy->dev, "Failed to get usb_phy clock: %ld\n", 159 + PTR_ERR(p_phy->phy_clk)); 160 + return PTR_ERR(p_phy->phy_clk); 161 + } 162 + 163 + ret = of_property_read_u32(p_phy->dev->of_node, "img,refclk", 164 + &p_phy->refclk); 165 + if (ret < 0) { 166 + dev_err(p_phy->dev, "No reference clock selector specified\n"); 167 + return ret; 168 + } 169 + 170 + phy = devm_phy_create(p_phy->dev, NULL, &pistachio_usb_phy_ops); 171 + if (IS_ERR(phy)) { 172 + dev_err(p_phy->dev, "Failed to create PHY: %ld\n", 173 + PTR_ERR(phy)); 174 + return PTR_ERR(phy); 175 + } 176 + phy_set_drvdata(phy, p_phy); 177 + 178 + provider = devm_of_phy_provider_register(p_phy->dev, 179 + of_phy_simple_xlate); 180 + if (IS_ERR(provider)) { 181 + dev_err(p_phy->dev, "Failed to register PHY provider: %ld\n", 182 + PTR_ERR(provider)); 183 + return PTR_ERR(provider); 184 + } 185 + 186 + return 0; 187 + } 188 + 189 + static const struct of_device_id pistachio_usb_phy_of_match[] = { 190 + { .compatible = "img,pistachio-usb-phy", }, 191 + { }, 192 + }; 193 + MODULE_DEVICE_TABLE(of, pistachio_usb_phy_of_match); 194 + 195 + static struct platform_driver pistachio_usb_phy_driver = { 196 + .probe = pistachio_usb_phy_probe, 197 + .driver = { 198 + .name = "pistachio-usb-phy", 199 + .of_match_table = pistachio_usb_phy_of_match, 200 + }, 201 + }; 202 + module_platform_driver(pistachio_usb_phy_driver); 203 + 204 + MODULE_AUTHOR("Andrew Bresticker <abrestic@chromium.org>"); 205 + MODULE_DESCRIPTION("IMG Pistachio USB2.0 PHY driver"); 206 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/rtc/Kconfig
··· 1503 1503 1504 1504 config RTC_DRV_LOONGSON1 1505 1505 tristate "loongson1 RTC support" 1506 - depends on MACH_LOONGSON1 1506 + depends on MACH_LOONGSON32 1507 1507 help 1508 1508 This is a driver for the loongson1 on-chip Counter0 (Time-Of-Year 1509 1509 counter) to be used as a RTC.
+1 -1
drivers/rtc/rtc-ls1x.c
··· 17 17 #include <linux/delay.h> 18 18 #include <linux/types.h> 19 19 #include <linux/io.h> 20 - #include <asm/mach-loongson1/loongson1.h> 20 + #include <loongson1.h> 21 21 22 22 #define LS1X_RTC_REG_OFFSET (LS1X_RTC_BASE + 0x20) 23 23 #define LS1X_RTC_REGS(x) \
+266
drivers/tty/serial/8250/8250_ingenic.c
··· 1 + /* 2 + * Copyright (C) 2010 Lars-Peter Clausen <lars@metafoo.de> 3 + * Copyright (C) 2015 Imagination Technologies 4 + * 5 + * Ingenic SoC UART support 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 + * You should have received a copy of the GNU General Public License along 13 + * with this program; if not, write to the Free Software Foundation, Inc., 14 + * 675 Mass Ave, Cambridge, MA 02139, USA. 15 + */ 16 + 17 + #include <linux/clk.h> 18 + #include <linux/console.h> 19 + #include <linux/io.h> 20 + #include <linux/libfdt.h> 21 + #include <linux/module.h> 22 + #include <linux/of.h> 23 + #include <linux/of_fdt.h> 24 + #include <linux/platform_device.h> 25 + #include <linux/serial_8250.h> 26 + #include <linux/serial_core.h> 27 + #include <linux/serial_reg.h> 28 + 29 + struct ingenic_uart_data { 30 + struct clk *clk_module; 31 + struct clk *clk_baud; 32 + int line; 33 + }; 34 + 35 + #define UART_FCR_UME BIT(4) 36 + 37 + static struct earlycon_device *early_device; 38 + 39 + static uint8_t __init early_in(struct uart_port *port, int offset) 40 + { 41 + return readl(port->membase + (offset << 2)); 42 + } 43 + 44 + static void __init early_out(struct uart_port *port, int offset, uint8_t value) 45 + { 46 + writel(value, port->membase + (offset << 2)); 47 + } 48 + 49 + static void __init ingenic_early_console_putc(struct uart_port *port, int c) 50 + { 51 + uint8_t lsr; 52 + 53 + do { 54 + lsr = early_in(port, UART_LSR); 55 + } while ((lsr & UART_LSR_TEMT) == 0); 56 + 57 + early_out(port, UART_TX, c); 58 + } 59 + 60 + static void __init ingenic_early_console_write(struct console *console, 61 + const char *s, unsigned int count) 62 + { 63 + uart_console_write(&early_device->port, s, count, 64 + ingenic_early_console_putc); 65 + } 66 + 67 + static void __init ingenic_early_console_setup_clock(struct earlycon_device *dev) 68 + { 69 + void *fdt = initial_boot_params; 70 + const __be32 *prop; 71 + int offset; 72 + 73 + offset = fdt_path_offset(fdt, "/ext"); 74 + if (offset < 0) 75 + return; 76 + 77 + prop = fdt_getprop(fdt, offset, "clock-frequency", NULL); 78 + if (!prop) 79 + return; 80 + 81 + dev->port.uartclk = be32_to_cpup(prop); 82 + } 83 + 84 + static int __init ingenic_early_console_setup(struct earlycon_device *dev, 85 + const char *opt) 86 + { 87 + struct uart_port *port = &dev->port; 88 + unsigned int baud, divisor; 89 + 90 + if (!dev->port.membase) 91 + return -ENODEV; 92 + 93 + ingenic_early_console_setup_clock(dev); 94 + 95 + baud = dev->baud ?: 115200; 96 + divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud); 97 + 98 + early_out(port, UART_IER, 0); 99 + early_out(port, UART_LCR, UART_LCR_DLAB | UART_LCR_WLEN8); 100 + early_out(port, UART_DLL, 0); 101 + early_out(port, UART_DLM, 0); 102 + early_out(port, UART_LCR, UART_LCR_WLEN8); 103 + early_out(port, UART_FCR, UART_FCR_UME | UART_FCR_CLEAR_XMIT | 104 + UART_FCR_CLEAR_RCVR | UART_FCR_ENABLE_FIFO); 105 + early_out(port, UART_MCR, UART_MCR_RTS | UART_MCR_DTR); 106 + 107 + early_out(port, UART_LCR, UART_LCR_DLAB | UART_LCR_WLEN8); 108 + early_out(port, UART_DLL, divisor & 0xff); 109 + early_out(port, UART_DLM, (divisor >> 8) & 0xff); 110 + early_out(port, UART_LCR, UART_LCR_WLEN8); 111 + 112 + early_device = dev; 113 + dev->con->write = ingenic_early_console_write; 114 + 115 + return 0; 116 + } 117 + 118 + EARLYCON_DECLARE(jz4740_uart, ingenic_early_console_setup); 119 + OF_EARLYCON_DECLARE(jz4740_uart, "ingenic,jz4740-uart", 120 + ingenic_early_console_setup); 121 + 122 + EARLYCON_DECLARE(jz4775_uart, ingenic_early_console_setup); 123 + OF_EARLYCON_DECLARE(jz4775_uart, "ingenic,jz4775-uart", 124 + ingenic_early_console_setup); 125 + 126 + EARLYCON_DECLARE(jz4780_uart, ingenic_early_console_setup); 127 + OF_EARLYCON_DECLARE(jz4780_uart, "ingenic,jz4780-uart", 128 + ingenic_early_console_setup); 129 + 130 + static void ingenic_uart_serial_out(struct uart_port *p, int offset, int value) 131 + { 132 + switch (offset) { 133 + case UART_FCR: 134 + /* UART module enable */ 135 + value |= UART_FCR_UME; 136 + break; 137 + 138 + case UART_IER: 139 + value |= (value & 0x4) << 2; 140 + break; 141 + 142 + default: 143 + break; 144 + } 145 + 146 + writeb(value, p->membase + (offset << p->regshift)); 147 + } 148 + 149 + static int ingenic_uart_probe(struct platform_device *pdev) 150 + { 151 + struct uart_8250_port uart = {}; 152 + struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 153 + struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 154 + struct ingenic_uart_data *data; 155 + int err, line; 156 + 157 + if (!regs || !irq) { 158 + dev_err(&pdev->dev, "no registers/irq defined\n"); 159 + return -EINVAL; 160 + } 161 + 162 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 163 + if (!data) 164 + return -ENOMEM; 165 + 166 + spin_lock_init(&uart.port.lock); 167 + uart.port.type = PORT_16550; 168 + uart.port.flags = UPF_SKIP_TEST | UPF_IOREMAP | UPF_FIXED_TYPE; 169 + uart.port.iotype = UPIO_MEM; 170 + uart.port.mapbase = regs->start; 171 + uart.port.regshift = 2; 172 + uart.port.serial_out = ingenic_uart_serial_out; 173 + uart.port.irq = irq->start; 174 + uart.port.dev = &pdev->dev; 175 + 176 + /* Check for a fixed line number */ 177 + line = of_alias_get_id(pdev->dev.of_node, "serial"); 178 + if (line >= 0) 179 + uart.port.line = line; 180 + 181 + uart.port.membase = devm_ioremap(&pdev->dev, regs->start, 182 + resource_size(regs)); 183 + if (!uart.port.membase) 184 + return -ENOMEM; 185 + 186 + data->clk_module = devm_clk_get(&pdev->dev, "module"); 187 + if (IS_ERR(data->clk_module)) { 188 + err = PTR_ERR(data->clk_module); 189 + if (err != -EPROBE_DEFER) 190 + dev_err(&pdev->dev, 191 + "unable to get module clock: %d\n", err); 192 + return err; 193 + } 194 + 195 + data->clk_baud = devm_clk_get(&pdev->dev, "baud"); 196 + if (IS_ERR(data->clk_baud)) { 197 + err = PTR_ERR(data->clk_baud); 198 + if (err != -EPROBE_DEFER) 199 + dev_err(&pdev->dev, 200 + "unable to get baud clock: %d\n", err); 201 + return err; 202 + } 203 + 204 + err = clk_prepare_enable(data->clk_module); 205 + if (err) { 206 + dev_err(&pdev->dev, "could not enable module clock: %d\n", err); 207 + goto out; 208 + } 209 + 210 + err = clk_prepare_enable(data->clk_baud); 211 + if (err) { 212 + dev_err(&pdev->dev, "could not enable baud clock: %d\n", err); 213 + goto out_disable_moduleclk; 214 + } 215 + uart.port.uartclk = clk_get_rate(data->clk_baud); 216 + 217 + data->line = serial8250_register_8250_port(&uart); 218 + if (data->line < 0) { 219 + err = data->line; 220 + goto out_disable_baudclk; 221 + } 222 + 223 + platform_set_drvdata(pdev, data); 224 + return 0; 225 + 226 + out_disable_baudclk: 227 + clk_disable_unprepare(data->clk_baud); 228 + out_disable_moduleclk: 229 + clk_disable_unprepare(data->clk_module); 230 + out: 231 + return err; 232 + } 233 + 234 + static int ingenic_uart_remove(struct platform_device *pdev) 235 + { 236 + struct ingenic_uart_data *data = platform_get_drvdata(pdev); 237 + 238 + serial8250_unregister_port(data->line); 239 + clk_disable_unprepare(data->clk_module); 240 + clk_disable_unprepare(data->clk_baud); 241 + return 0; 242 + } 243 + 244 + static const struct of_device_id of_match[] = { 245 + { .compatible = "ingenic,jz4740-uart" }, 246 + { .compatible = "ingenic,jz4775-uart" }, 247 + { .compatible = "ingenic,jz4780-uart" }, 248 + { /* sentinel */ } 249 + }; 250 + MODULE_DEVICE_TABLE(of, of_match); 251 + 252 + static struct platform_driver ingenic_uart_platform_driver = { 253 + .driver = { 254 + .name = "ingenic-uart", 255 + .owner = THIS_MODULE, 256 + .of_match_table = of_match, 257 + }, 258 + .probe = ingenic_uart_probe, 259 + .remove = ingenic_uart_remove, 260 + }; 261 + 262 + module_platform_driver(ingenic_uart_platform_driver); 263 + 264 + MODULE_AUTHOR("Paul Burton"); 265 + MODULE_LICENSE("GPL"); 266 + MODULE_DESCRIPTION("Ingenic SoC UART driver");
+9
drivers/tty/serial/8250/Kconfig
··· 357 357 help 358 358 If you have a UniPhier based board and want to use the on-chip 359 359 serial ports, say Y to this option. If unsure, say N. 360 + 361 + config SERIAL_8250_INGENIC 362 + bool "Support for Ingenic SoC serial ports" 363 + depends on SERIAL_8250_CONSOLE && OF_FLATTREE 364 + select LIBFDT 365 + select SERIAL_EARLYCON 366 + help 367 + If you have a system using an Ingenic SoC and wish to make use of 368 + its UARTs, say Y to this option. If unsure, say N.
+3
drivers/tty/serial/8250/Makefile
··· 25 25 obj-$(CONFIG_SERIAL_8250_LPC18XX) += 8250_lpc18xx.o 26 26 obj-$(CONFIG_SERIAL_8250_MT6577) += 8250_mtk.o 27 27 obj-$(CONFIG_SERIAL_8250_UNIPHIER) += 8250_uniphier.o 28 + obj-$(CONFIG_SERIAL_8250_INGENIC) += 8250_ingenic.o 29 + 30 + CFLAGS_8250_ingenic.o += -I$(srctree)/scripts/dtc/libfdt
+1
drivers/tty/sysrq.c
··· 462 462 /* v: May be registered for frame buffer console restore */ 463 463 NULL, /* v */ 464 464 &sysrq_showstate_blocked_op, /* w */ 465 + /* x: May be registered on mips for TLB dump */ 465 466 /* x: May be registered on ppc/powerpc for xmon */ 466 467 /* x: May be registered on sparc64 for global PMU dump */ 467 468 NULL, /* x */
+2 -2
drivers/usb/host/Kconfig
··· 295 295 bool "Octeon on-chip EHCI support (DEPRECATED)" 296 296 depends on CAVIUM_OCTEON_SOC 297 297 default n 298 - select USB_EHCI_BIG_ENDIAN_MMIO 298 + select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN 299 299 select USB_EHCI_HCD_PLATFORM 300 300 help 301 301 This option is deprecated now and the driver was removed, use ··· 568 568 bool "Octeon on-chip OHCI support (DEPRECATED)" 569 569 depends on CAVIUM_OCTEON_SOC 570 570 default USB_OCTEON_EHCI 571 - select USB_OHCI_BIG_ENDIAN_MMIO 571 + select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN 572 572 select USB_OHCI_LITTLE_ENDIAN 573 573 select USB_OHCI_HCD_PLATFORM 574 574 help
+37
include/dt-bindings/clock/jz4740-cgu.h
··· 1 + /* 2 + * This header provides clock numbers for the ingenic,jz4740-cgu DT binding. 3 + * 4 + * They are roughly ordered as: 5 + * - external clocks 6 + * - PLLs 7 + * - muxes/dividers in the order they appear in the jz4740 programmers manual 8 + * - gates in order of their bit in the CLKGR* registers 9 + */ 10 + 11 + #ifndef __DT_BINDINGS_CLOCK_JZ4740_CGU_H__ 12 + #define __DT_BINDINGS_CLOCK_JZ4740_CGU_H__ 13 + 14 + #define JZ4740_CLK_EXT 0 15 + #define JZ4740_CLK_RTC 1 16 + #define JZ4740_CLK_PLL 2 17 + #define JZ4740_CLK_PLL_HALF 3 18 + #define JZ4740_CLK_CCLK 4 19 + #define JZ4740_CLK_HCLK 5 20 + #define JZ4740_CLK_PCLK 6 21 + #define JZ4740_CLK_MCLK 7 22 + #define JZ4740_CLK_LCD 8 23 + #define JZ4740_CLK_LCD_PCLK 9 24 + #define JZ4740_CLK_I2S 10 25 + #define JZ4740_CLK_SPI 11 26 + #define JZ4740_CLK_MMC 12 27 + #define JZ4740_CLK_UHC 13 28 + #define JZ4740_CLK_UDC 14 29 + #define JZ4740_CLK_UART0 15 30 + #define JZ4740_CLK_UART1 16 31 + #define JZ4740_CLK_DMA 17 32 + #define JZ4740_CLK_IPU 18 33 + #define JZ4740_CLK_ADC 19 34 + #define JZ4740_CLK_I2C 20 35 + #define JZ4740_CLK_AIC 21 36 + 37 + #endif /* __DT_BINDINGS_CLOCK_JZ4740_CGU_H__ */
+88
include/dt-bindings/clock/jz4780-cgu.h
··· 1 + /* 2 + * This header provides clock numbers for the ingenic,jz4780-cgu DT binding. 3 + * 4 + * They are roughly ordered as: 5 + * - external clocks 6 + * - PLLs 7 + * - muxes/dividers in the order they appear in the jz4780 programmers manual 8 + * - gates in order of their bit in the CLKGR* registers 9 + */ 10 + 11 + #ifndef __DT_BINDINGS_CLOCK_JZ4780_CGU_H__ 12 + #define __DT_BINDINGS_CLOCK_JZ4780_CGU_H__ 13 + 14 + #define JZ4780_CLK_EXCLK 0 15 + #define JZ4780_CLK_RTCLK 1 16 + #define JZ4780_CLK_APLL 2 17 + #define JZ4780_CLK_MPLL 3 18 + #define JZ4780_CLK_EPLL 4 19 + #define JZ4780_CLK_VPLL 5 20 + #define JZ4780_CLK_OTGPHY 6 21 + #define JZ4780_CLK_SCLKA 7 22 + #define JZ4780_CLK_CPUMUX 8 23 + #define JZ4780_CLK_CPU 9 24 + #define JZ4780_CLK_L2CACHE 10 25 + #define JZ4780_CLK_AHB0 11 26 + #define JZ4780_CLK_AHB2PMUX 12 27 + #define JZ4780_CLK_AHB2 13 28 + #define JZ4780_CLK_PCLK 14 29 + #define JZ4780_CLK_DDR 15 30 + #define JZ4780_CLK_VPU 16 31 + #define JZ4780_CLK_I2SPLL 17 32 + #define JZ4780_CLK_I2S 18 33 + #define JZ4780_CLK_LCD0PIXCLK 19 34 + #define JZ4780_CLK_LCD1PIXCLK 20 35 + #define JZ4780_CLK_MSCMUX 21 36 + #define JZ4780_CLK_MSC0 22 37 + #define JZ4780_CLK_MSC1 23 38 + #define JZ4780_CLK_MSC2 24 39 + #define JZ4780_CLK_UHC 25 40 + #define JZ4780_CLK_SSIPLL 26 41 + #define JZ4780_CLK_SSI 27 42 + #define JZ4780_CLK_CIMMCLK 28 43 + #define JZ4780_CLK_PCMPLL 29 44 + #define JZ4780_CLK_PCM 30 45 + #define JZ4780_CLK_GPU 31 46 + #define JZ4780_CLK_HDMI 32 47 + #define JZ4780_CLK_BCH 33 48 + #define JZ4780_CLK_NEMC 34 49 + #define JZ4780_CLK_OTG0 35 50 + #define JZ4780_CLK_SSI0 36 51 + #define JZ4780_CLK_SMB0 37 52 + #define JZ4780_CLK_SMB1 38 53 + #define JZ4780_CLK_SCC 39 54 + #define JZ4780_CLK_AIC 40 55 + #define JZ4780_CLK_TSSI0 41 56 + #define JZ4780_CLK_OWI 42 57 + #define JZ4780_CLK_KBC 43 58 + #define JZ4780_CLK_SADC 44 59 + #define JZ4780_CLK_UART0 45 60 + #define JZ4780_CLK_UART1 46 61 + #define JZ4780_CLK_UART2 47 62 + #define JZ4780_CLK_UART3 48 63 + #define JZ4780_CLK_SSI1 49 64 + #define JZ4780_CLK_SSI2 50 65 + #define JZ4780_CLK_PDMA 51 66 + #define JZ4780_CLK_GPS 52 67 + #define JZ4780_CLK_MAC 53 68 + #define JZ4780_CLK_SMB2 54 69 + #define JZ4780_CLK_CIM 55 70 + #define JZ4780_CLK_LCD 56 71 + #define JZ4780_CLK_TVE 57 72 + #define JZ4780_CLK_IPU 58 73 + #define JZ4780_CLK_DDR0 59 74 + #define JZ4780_CLK_DDR1 60 75 + #define JZ4780_CLK_SMB3 61 76 + #define JZ4780_CLK_TSSI1 62 77 + #define JZ4780_CLK_COMPRESS 63 78 + #define JZ4780_CLK_AIC1 64 79 + #define JZ4780_CLK_GPVLC 65 80 + #define JZ4780_CLK_OTG1 66 81 + #define JZ4780_CLK_UART4 67 82 + #define JZ4780_CLK_AHBMON 68 83 + #define JZ4780_CLK_SMB4 69 84 + #define JZ4780_CLK_DES 70 85 + #define JZ4780_CLK_X2D 71 86 + #define JZ4780_CLK_CORE1 72 87 + 88 + #endif /* __DT_BINDINGS_CLOCK_JZ4780_CGU_H__ */
+16
include/dt-bindings/phy/phy-pistachio-usb.h
··· 1 + /* 2 + * Copyright (C) 2015 Google, Inc. 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms and conditions of the GNU General Public License, 6 + * version 2, as published by the Free Software Foundation. 7 + */ 8 + 9 + #ifndef _DT_BINDINGS_PHY_PISTACHIO 10 + #define _DT_BINDINGS_PHY_PISTACHIO 11 + 12 + #define REFCLK_XO_CRYSTAL 0x0 13 + #define REFCLK_X0_EXT_CLK 0x1 14 + #define REFCLK_CLK_CORE 0x2 15 + 16 + #endif /* _DT_BINDINGS_PHY_PISTACHIO */
+16 -1
include/linux/bcm47xx_nvram.h
··· 10 10 11 11 #include <linux/types.h> 12 12 #include <linux/kernel.h> 13 + #include <linux/vmalloc.h> 13 14 14 - #ifdef CONFIG_BCM47XX 15 + #ifdef CONFIG_BCM47XX_NVRAM 15 16 int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); 16 17 int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); 17 18 int bcm47xx_nvram_gpio_pin(const char *name); 19 + char *bcm47xx_nvram_get_contents(size_t *val_len); 20 + static inline void bcm47xx_nvram_release_contents(char *nvram) 21 + { 22 + vfree(nvram); 23 + }; 18 24 #else 19 25 static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) 20 26 { ··· 34 28 static inline int bcm47xx_nvram_gpio_pin(const char *name) 35 29 { 36 30 return -ENOTSUPP; 31 + }; 32 + 33 + static inline char *bcm47xx_nvram_get_contents(size_t *val_len) 34 + { 35 + return NULL; 36 + }; 37 + 38 + static inline void bcm47xx_nvram_release_contents(char *nvram) 39 + { 37 40 }; 38 41 #endif 39 42
+23
include/linux/irqchip/ingenic.h
··· 1 + /* 2 + * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 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 + * You should have received a copy of the GNU General Public License along 10 + * with this program; if not, write to the Free Software Foundation, Inc., 11 + * 675 Mass Ave, Cambridge, MA 02139, USA. 12 + * 13 + */ 14 + 15 + #ifndef __LINUX_IRQCHIP_INGENIC_H__ 16 + #define __LINUX_IRQCHIP_INGENIC_H__ 17 + 18 + #include <linux/irq.h> 19 + 20 + extern void ingenic_intc_irq_suspend(struct irq_data *data); 21 + extern void ingenic_intc_irq_resume(struct irq_data *data); 22 + 23 + #endif
+19
include/linux/platform_data/gpio-ath79.h
··· 1 + /* 2 + * Atheros AR7XXX/AR9XXX GPIO controller platform data 3 + * 4 + * Copyright (C) 2015 Alban Bedel <albeu@free.fr> 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 + #ifndef __LINUX_PLATFORM_DATA_GPIO_ATH79_H 12 + #define __LINUX_PLATFORM_DATA_GPIO_ATH79_H 13 + 14 + struct ath79_gpio_platform_data { 15 + unsigned ngpios; 16 + bool oe_inverted; 17 + }; 18 + 19 + #endif
+7 -1
include/linux/ssb/ssb.h
··· 29 29 u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */ 30 30 u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */ 31 31 u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */ 32 + u8 et2mac[6] __aligned(sizeof(u16)); /* MAC address for extra Ethernet */ 32 33 u8 et0phyaddr; /* MII address for enet0 */ 33 34 u8 et1phyaddr; /* MII address for enet1 */ 35 + u8 et2phyaddr; /* MII address for enet2 */ 34 36 u8 et0mdcport; /* MDIO for enet0 */ 35 37 u8 et1mdcport; /* MDIO for enet1 */ 38 + u8 et2mdcport; /* MDIO for enet2 */ 36 39 u16 dev_id; /* Device ID overriding e.g. PCI ID */ 37 40 u16 board_rev; /* Board revision number from SPROM. */ 38 41 u16 board_num; /* Board number from SPROM. */ ··· 91 88 u32 ofdm5glpo; /* 5.2GHz OFDM power offset */ 92 89 u32 ofdm5gpo; /* 5.3GHz OFDM power offset */ 93 90 u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */ 91 + u32 boardflags; 92 + u32 boardflags2; 93 + u32 boardflags3; 94 + /* TODO: Switch all drivers to new u32 fields and drop below ones */ 94 95 u16 boardflags_lo; /* Board flags (bits 0-15) */ 95 96 u16 boardflags_hi; /* Board flags (bits 16-31) */ 96 97 u16 boardflags2_lo; /* Board flags (bits 32-47) */ 97 98 u16 boardflags2_hi; /* Board flags (bits 48-63) */ 98 - /* TODO store board flags in a single u64 */ 99 99 100 100 struct ssb_sprom_core_pwr_info core_pwr_info[4]; 101 101