diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-27 15:44:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-27 15:44:34 -0400 |
commit | 78c10e556ed904d5bfbd71e9cadd8ce8f25d6982 (patch) | |
tree | f73c802d60e81ff9e9fd2465eab096834d0227cd | |
parent | d2c3ac7e7e39ec6d37e4114ae7444948561e59af (diff) | |
parent | 9ff897c4e8d5bd05ad7009f84a395596d4953858 (diff) |
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
...
281 files changed, 6271 insertions, 2321 deletions
diff --git a/Documentation/devicetree/bindings/clock/ingenic,cgu.txt b/Documentation/devicetree/bindings/clock/ingenic,cgu.txt new file mode 100644 index 000000000000..f8d4134ae409 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/ingenic,cgu.txt | |||
@@ -0,0 +1,53 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/qca,ath79-pll.txt b/Documentation/devicetree/bindings/clock/qca,ath79-pll.txt new file mode 100644 index 000000000000..e0fc2c11dd00 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/qca,ath79-pll.txt | |||
@@ -0,0 +1,33 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio-ath79.txt b/Documentation/devicetree/bindings/gpio/gpio-ath79.txt new file mode 100644 index 000000000000..c522851017ae --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-ath79.txt | |||
@@ -0,0 +1,38 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.txt b/Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.txt new file mode 100644 index 000000000000..5f89fb635a1b --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.txt | |||
@@ -0,0 +1,28 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt new file mode 100644 index 000000000000..aabce7810d29 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt | |||
@@ -0,0 +1,44 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt new file mode 100644 index 000000000000..391717a68f3b --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt | |||
@@ -0,0 +1,30 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt b/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt new file mode 100644 index 000000000000..efe35a065714 --- /dev/null +++ b/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt | |||
@@ -0,0 +1,35 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/mips/ath79-soc.txt b/Documentation/devicetree/bindings/mips/ath79-soc.txt new file mode 100644 index 000000000000..88a12a43e44e --- /dev/null +++ b/Documentation/devicetree/bindings/mips/ath79-soc.txt | |||
@@ -0,0 +1,21 @@ | |||
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 | ||
diff --git a/Documentation/devicetree/bindings/phy/pistachio-usb-phy.txt b/Documentation/devicetree/bindings/phy/pistachio-usb-phy.txt new file mode 100644 index 000000000000..afbc7e24a3de --- /dev/null +++ b/Documentation/devicetree/bindings/phy/pistachio-usb-phy.txt | |||
@@ -0,0 +1,29 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/serial/ingenic,uart.txt b/Documentation/devicetree/bindings/serial/ingenic,uart.txt new file mode 100644 index 000000000000..c2d3b3abe7d9 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/ingenic,uart.txt | |||
@@ -0,0 +1,22 @@ | |||
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 | }; | ||
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 8e8f4bc6fcf1..7b607761b774 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -106,6 +106,7 @@ ibm International Business Machines (IBM) | |||
106 | idt Integrated Device Technologies, Inc. | 106 | idt Integrated Device Technologies, Inc. |
107 | iom Iomega Corporation | 107 | iom Iomega Corporation |
108 | img Imagination Technologies Ltd. | 108 | img Imagination Technologies Ltd. |
109 | ingenic Ingenic Semiconductor | ||
109 | innolux Innolux Corporation | 110 | innolux Innolux Corporation |
110 | intel Intel Corporation | 111 | intel Intel Corporation |
111 | intercontrol Inter Control Group | 112 | intercontrol Inter Control Group |
@@ -161,6 +162,7 @@ powervr PowerVR (deprecated, use img) | |||
161 | qca Qualcomm Atheros, Inc. | 162 | qca Qualcomm Atheros, Inc. |
162 | qcom Qualcomm Technologies, Inc | 163 | qcom Qualcomm Technologies, Inc |
163 | qemu QEMU, a generic and open source machine emulator and virtualizer | 164 | qemu QEMU, a generic and open source machine emulator and virtualizer |
165 | qi Qi Hardware | ||
164 | qnap QNAP Systems, Inc. | 166 | qnap QNAP Systems, Inc. |
165 | radxa Radxa | 167 | radxa Radxa |
166 | raidsonic RaidSonic Technology GmbH | 168 | raidsonic RaidSonic Technology GmbH |
@@ -206,6 +208,7 @@ tlm Trusted Logic Mobility | |||
206 | toradex Toradex AG | 208 | toradex Toradex AG |
207 | toshiba Toshiba Corporation | 209 | toshiba Toshiba Corporation |
208 | toumaz Toumaz | 210 | toumaz Toumaz |
211 | tplink TP-LINK Technologies Co., Ltd. | ||
209 | truly Truly Semiconductors Limited | 212 | truly Truly Semiconductors Limited |
210 | usi Universal Scientific Industrial Co., Ltd. | 213 | usi Universal Scientific Industrial Co., Ltd. |
211 | v3 V3 Semiconductor | 214 | v3 V3 Semiconductor |
diff --git a/MAINTAINERS b/MAINTAINERS index c54a67434048..6aedd5072323 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2229,6 +2229,14 @@ F: arch/mips/bcm3384/* | |||
2229 | F: arch/mips/include/asm/mach-bcm3384/* | 2229 | F: arch/mips/include/asm/mach-bcm3384/* |
2230 | F: arch/mips/kernel/*bmips* | 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 | BROADCOM BCM5301X ARM ARCHITECTURE | 2240 | BROADCOM BCM5301X ARM ARCHITECTURE |
2233 | M: Hauke Mehrtens <hauke@hauke-m.de> | 2241 | M: Hauke Mehrtens <hauke@hauke-m.de> |
2234 | L: linux-arm-kernel@lists.infradead.org | 2242 | L: linux-arm-kernel@lists.infradead.org |
@@ -2333,6 +2341,12 @@ S: Supported | |||
2333 | F: drivers/gpio/gpio-bcm-kona.c | 2341 | F: drivers/gpio/gpio-bcm-kona.c |
2334 | F: Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt | 2342 | F: Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt |
2335 | 2343 | ||
2344 | BROADCOM NVRAM DRIVER | ||
2345 | M: Rafał Miłecki <zajec5@gmail.com> | ||
2346 | L: linux-mips@linux-mips.org | ||
2347 | S: Maintained | ||
2348 | F: drivers/firmware/broadcom/* | ||
2349 | |||
2336 | BROADCOM STB NAND FLASH DRIVER | 2350 | BROADCOM STB NAND FLASH DRIVER |
2337 | M: Brian Norris <computersforpeace@gmail.com> | 2351 | M: Brian Norris <computersforpeace@gmail.com> |
2338 | L: linux-mtd@lists.infradead.org | 2352 | L: linux-mtd@lists.infradead.org |
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms index 39cf40da5f14..a424e46b50af 100644 --- a/arch/mips/Kbuild.platforms +++ b/arch/mips/Kbuild.platforms | |||
@@ -15,8 +15,8 @@ platforms += jazz | |||
15 | platforms += jz4740 | 15 | platforms += jz4740 |
16 | platforms += lantiq | 16 | platforms += lantiq |
17 | platforms += lasat | 17 | platforms += lasat |
18 | platforms += loongson | 18 | platforms += loongson32 |
19 | platforms += loongson1 | 19 | platforms += loongson64 |
20 | platforms += mti-malta | 20 | platforms += mti-malta |
21 | platforms += mti-sead3 | 21 | platforms += mti-sead3 |
22 | platforms += netlogic | 22 | platforms += netlogic |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index b65edf514b40..2a14585c90d2 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -21,11 +21,12 @@ config MIPS | |||
21 | select HAVE_FUNCTION_GRAPH_TRACER | 21 | select HAVE_FUNCTION_GRAPH_TRACER |
22 | select HAVE_KPROBES | 22 | select HAVE_KPROBES |
23 | select HAVE_KRETPROBES | 23 | select HAVE_KRETPROBES |
24 | select HAVE_SYSCALL_TRACEPOINTS | ||
24 | select HAVE_DEBUG_KMEMLEAK | 25 | select HAVE_DEBUG_KMEMLEAK |
25 | select HAVE_SYSCALL_TRACEPOINTS | 26 | select HAVE_SYSCALL_TRACEPOINTS |
26 | select ARCH_HAS_ELF_RANDOMIZE | 27 | select ARCH_HAS_ELF_RANDOMIZE |
27 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT | 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 | select GENERIC_ATOMIC64 if !64BIT | 30 | select GENERIC_ATOMIC64 if !64BIT |
30 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE | 31 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE |
31 | select HAVE_DMA_ATTRS | 32 | select HAVE_DMA_ATTRS |
@@ -70,7 +71,7 @@ config MIPS_ALCHEMY | |||
70 | select ARCH_PHYS_ADDR_T_64BIT | 71 | select ARCH_PHYS_ADDR_T_64BIT |
71 | select CEVT_R4K | 72 | select CEVT_R4K |
72 | select CSRC_R4K | 73 | select CSRC_R4K |
73 | select IRQ_CPU | 74 | select IRQ_MIPS_CPU |
74 | select DMA_MAYBE_COHERENT # Au1000,1500,1100 aren't, rest is | 75 | select DMA_MAYBE_COHERENT # Au1000,1500,1100 aren't, rest is |
75 | select SYS_HAS_CPU_MIPS32_R1 | 76 | select SYS_HAS_CPU_MIPS32_R1 |
76 | select SYS_SUPPORTS_32BIT_KERNEL | 77 | select SYS_SUPPORTS_32BIT_KERNEL |
@@ -85,7 +86,7 @@ config AR7 | |||
85 | select DMA_NONCOHERENT | 86 | select DMA_NONCOHERENT |
86 | select CEVT_R4K | 87 | select CEVT_R4K |
87 | select CSRC_R4K | 88 | select CSRC_R4K |
88 | select IRQ_CPU | 89 | select IRQ_MIPS_CPU |
89 | select NO_EXCEPT_FILL | 90 | select NO_EXCEPT_FILL |
90 | select SWAP_IO_SPACE | 91 | select SWAP_IO_SPACE |
91 | select SYS_HAS_CPU_MIPS32_R1 | 92 | select SYS_HAS_CPU_MIPS32_R1 |
@@ -106,7 +107,7 @@ config ATH25 | |||
106 | select CEVT_R4K | 107 | select CEVT_R4K |
107 | select CSRC_R4K | 108 | select CSRC_R4K |
108 | select DMA_NONCOHERENT | 109 | select DMA_NONCOHERENT |
109 | select IRQ_CPU | 110 | select IRQ_MIPS_CPU |
110 | select IRQ_DOMAIN | 111 | select IRQ_DOMAIN |
111 | select SYS_HAS_CPU_MIPS32_R1 | 112 | select SYS_HAS_CPU_MIPS32_R1 |
112 | select SYS_SUPPORTS_BIG_ENDIAN | 113 | select SYS_SUPPORTS_BIG_ENDIAN |
@@ -123,14 +124,17 @@ config ATH79 | |||
123 | select CSRC_R4K | 124 | select CSRC_R4K |
124 | select DMA_NONCOHERENT | 125 | select DMA_NONCOHERENT |
125 | select HAVE_CLK | 126 | select HAVE_CLK |
127 | select COMMON_CLK | ||
126 | select CLKDEV_LOOKUP | 128 | select CLKDEV_LOOKUP |
127 | select IRQ_CPU | 129 | select IRQ_MIPS_CPU |
128 | select MIPS_MACHINE | 130 | select MIPS_MACHINE |
129 | select SYS_HAS_CPU_MIPS32_R2 | 131 | select SYS_HAS_CPU_MIPS32_R2 |
130 | select SYS_HAS_EARLY_PRINTK | 132 | select SYS_HAS_EARLY_PRINTK |
131 | select SYS_SUPPORTS_32BIT_KERNEL | 133 | select SYS_SUPPORTS_32BIT_KERNEL |
132 | select SYS_SUPPORTS_BIG_ENDIAN | 134 | select SYS_SUPPORTS_BIG_ENDIAN |
133 | select SYS_SUPPORTS_MIPS16 | 135 | select SYS_SUPPORTS_MIPS16 |
136 | select SYS_SUPPORTS_ZBOOT | ||
137 | select USE_OF | ||
134 | help | 138 | help |
135 | Support for the Atheros AR71XX/AR724X/AR913X SoCs. | 139 | Support for the Atheros AR71XX/AR724X/AR913X SoCs. |
136 | 140 | ||
@@ -146,7 +150,7 @@ config BMIPS_GENERIC | |||
146 | select BCM7038_L1_IRQ | 150 | select BCM7038_L1_IRQ |
147 | select BCM7120_L2_IRQ | 151 | select BCM7120_L2_IRQ |
148 | select BRCMSTB_L2_IRQ | 152 | select BRCMSTB_L2_IRQ |
149 | select IRQ_CPU | 153 | select IRQ_MIPS_CPU |
150 | select RAW_IRQ_ACCESSORS | 154 | select RAW_IRQ_ACCESSORS |
151 | select DMA_NONCOHERENT | 155 | select DMA_NONCOHERENT |
152 | select SYS_SUPPORTS_32BIT_KERNEL | 156 | select SYS_SUPPORTS_32BIT_KERNEL |
@@ -176,7 +180,7 @@ config BCM47XX | |||
176 | select CSRC_R4K | 180 | select CSRC_R4K |
177 | select DMA_NONCOHERENT | 181 | select DMA_NONCOHERENT |
178 | select HW_HAS_PCI | 182 | select HW_HAS_PCI |
179 | select IRQ_CPU | 183 | select IRQ_MIPS_CPU |
180 | select SYS_HAS_CPU_MIPS32_R1 | 184 | select SYS_HAS_CPU_MIPS32_R1 |
181 | select NO_EXCEPT_FILL | 185 | select NO_EXCEPT_FILL |
182 | select SYS_SUPPORTS_32BIT_KERNEL | 186 | select SYS_SUPPORTS_32BIT_KERNEL |
@@ -186,6 +190,7 @@ config BCM47XX | |||
186 | select USE_GENERIC_EARLY_PRINTK_8250 | 190 | select USE_GENERIC_EARLY_PRINTK_8250 |
187 | select GPIOLIB | 191 | select GPIOLIB |
188 | select LEDS_GPIO_REGISTER | 192 | select LEDS_GPIO_REGISTER |
193 | select BCM47XX_NVRAM | ||
189 | help | 194 | help |
190 | Support for BCM47XX based boards | 195 | Support for BCM47XX based boards |
191 | 196 | ||
@@ -196,7 +201,7 @@ config BCM63XX | |||
196 | select CSRC_R4K | 201 | select CSRC_R4K |
197 | select SYNC_R4K | 202 | select SYNC_R4K |
198 | select DMA_NONCOHERENT | 203 | select DMA_NONCOHERENT |
199 | select IRQ_CPU | 204 | select IRQ_MIPS_CPU |
200 | select SYS_SUPPORTS_32BIT_KERNEL | 205 | select SYS_SUPPORTS_32BIT_KERNEL |
201 | select SYS_SUPPORTS_BIG_ENDIAN | 206 | select SYS_SUPPORTS_BIG_ENDIAN |
202 | select SYS_HAS_EARLY_PRINTK | 207 | select SYS_HAS_EARLY_PRINTK |
@@ -216,7 +221,7 @@ config MIPS_COBALT | |||
216 | select HW_HAS_PCI | 221 | select HW_HAS_PCI |
217 | select I8253 | 222 | select I8253 |
218 | select I8259 | 223 | select I8259 |
219 | select IRQ_CPU | 224 | select IRQ_MIPS_CPU |
220 | select IRQ_GT641XX | 225 | select IRQ_GT641XX |
221 | select PCI_GT64XXX_PCI0 | 226 | select PCI_GT64XXX_PCI0 |
222 | select PCI | 227 | select PCI |
@@ -239,7 +244,7 @@ config MACH_DECSTATION | |||
239 | select CPU_R4400_WORKAROUNDS if 64BIT | 244 | select CPU_R4400_WORKAROUNDS if 64BIT |
240 | select DMA_NONCOHERENT | 245 | select DMA_NONCOHERENT |
241 | select NO_IOPORT_MAP | 246 | select NO_IOPORT_MAP |
242 | select IRQ_CPU | 247 | select IRQ_MIPS_CPU |
243 | select SYS_HAS_CPU_R3000 | 248 | select SYS_HAS_CPU_R3000 |
244 | select SYS_HAS_CPU_R4X00 | 249 | select SYS_HAS_CPU_R4X00 |
245 | select SYS_SUPPORTS_32BIT_KERNEL | 250 | select SYS_SUPPORTS_32BIT_KERNEL |
@@ -274,7 +279,7 @@ config MACH_JAZZ | |||
274 | select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN | 279 | select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN |
275 | select GENERIC_ISA_DMA | 280 | select GENERIC_ISA_DMA |
276 | select HAVE_PCSPKR_PLATFORM | 281 | select HAVE_PCSPKR_PLATFORM |
277 | select IRQ_CPU | 282 | select IRQ_MIPS_CPU |
278 | select I8253 | 283 | select I8253 |
279 | select I8259 | 284 | select I8259 |
280 | select ISA | 285 | select ISA |
@@ -288,23 +293,24 @@ config MACH_JAZZ | |||
288 | Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and | 293 | Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and |
289 | Olivetti M700-10 workstations. | 294 | Olivetti M700-10 workstations. |
290 | 295 | ||
291 | config MACH_JZ4740 | 296 | config MACH_INGENIC |
292 | bool "Ingenic JZ4740 based machines" | 297 | bool "Ingenic SoC based machines" |
293 | select SYS_HAS_CPU_MIPS32_R1 | ||
294 | select SYS_SUPPORTS_32BIT_KERNEL | 298 | select SYS_SUPPORTS_32BIT_KERNEL |
295 | select SYS_SUPPORTS_LITTLE_ENDIAN | 299 | select SYS_SUPPORTS_LITTLE_ENDIAN |
296 | select SYS_SUPPORTS_ZBOOT_UART16550 | 300 | select SYS_SUPPORTS_ZBOOT_UART16550 |
297 | select DMA_NONCOHERENT | 301 | select DMA_NONCOHERENT |
298 | select IRQ_CPU | 302 | select IRQ_MIPS_CPU |
299 | select ARCH_REQUIRE_GPIOLIB | 303 | select ARCH_REQUIRE_GPIOLIB |
300 | select SYS_HAS_EARLY_PRINTK | 304 | select COMMON_CLK |
301 | select HAVE_CLK | ||
302 | select GENERIC_IRQ_CHIP | 305 | select GENERIC_IRQ_CHIP |
306 | select BUILTIN_DTB | ||
307 | select USE_OF | ||
308 | select LIBFDT | ||
303 | 309 | ||
304 | config LANTIQ | 310 | config LANTIQ |
305 | bool "Lantiq based platforms" | 311 | bool "Lantiq based platforms" |
306 | select DMA_NONCOHERENT | 312 | select DMA_NONCOHERENT |
307 | select IRQ_CPU | 313 | select IRQ_MIPS_CPU |
308 | select CEVT_R4K | 314 | select CEVT_R4K |
309 | select CSRC_R4K | 315 | select CSRC_R4K |
310 | select SYS_HAS_CPU_MIPS32_R1 | 316 | select SYS_HAS_CPU_MIPS32_R1 |
@@ -333,7 +339,7 @@ config LASAT | |||
333 | select DMA_NONCOHERENT | 339 | select DMA_NONCOHERENT |
334 | select SYS_HAS_EARLY_PRINTK | 340 | select SYS_HAS_EARLY_PRINTK |
335 | select HW_HAS_PCI | 341 | select HW_HAS_PCI |
336 | select IRQ_CPU | 342 | select IRQ_MIPS_CPU |
337 | select PCI_GT64XXX_PCI0 | 343 | select PCI_GT64XXX_PCI0 |
338 | select MIPS_NILE4 | 344 | select MIPS_NILE4 |
339 | select R5000_CPU_SCACHE | 345 | select R5000_CPU_SCACHE |
@@ -342,26 +348,28 @@ config LASAT | |||
342 | select SYS_SUPPORTS_64BIT_KERNEL if BROKEN | 348 | select SYS_SUPPORTS_64BIT_KERNEL if BROKEN |
343 | select SYS_SUPPORTS_LITTLE_ENDIAN | 349 | select SYS_SUPPORTS_LITTLE_ENDIAN |
344 | 350 | ||
345 | config MACH_LOONGSON | 351 | config MACH_LOONGSON32 |
346 | bool "Loongson family of machines" | 352 | bool "Loongson-1 family of machines" |
347 | select SYS_SUPPORTS_ZBOOT | 353 | select SYS_SUPPORTS_ZBOOT |
348 | help | 354 | help |
349 | This enables the support of Loongson family of machines. | 355 | This enables support for the Loongson-1 family of machines. |
350 | 356 | ||
351 | Loongson is a family of general-purpose MIPS-compatible CPUs. | 357 | Loongson-1 is a family of 32-bit MIPS-compatible SoCs developed by |
352 | developed at Institute of Computing Technology (ICT), | 358 | the Institute of Computing Technology (ICT), Chinese Academy of |
353 | Chinese Academy of Sciences (CAS) in the People's Republic | 359 | Sciences (CAS). |
354 | of China. The chief architect is Professor Weiwu Hu. | ||
355 | 360 | ||
356 | config MACH_LOONGSON1 | 361 | config MACH_LOONGSON64 |
357 | bool "Loongson 1 family of machines" | 362 | bool "Loongson-2/3 family of machines" |
358 | select SYS_SUPPORTS_ZBOOT | 363 | select SYS_SUPPORTS_ZBOOT |
359 | help | 364 | help |
360 | This enables support for the Loongson 1 based machines. | 365 | This enables the support of Loongson-2/3 family of machines. |
361 | 366 | ||
362 | Loongson 1 is a family of 32-bit MIPS-compatible SoCs developed by | 367 | Loongson-2 is a family of single-core CPUs and Loongson-3 is a |
363 | the ICT (Institute of Computing Technology) and the Chinese Academy | 368 | family of multi-core CPUs. They are both 64-bit general-purpose |
364 | of Sciences. | 369 | MIPS-compatible CPUs. Loongson-2/3 are developed by the Institute |
370 | of Computing Technology (ICT), Chinese Academy of Sciences (CAS) | ||
371 | in the People's Republic of China. The chief architect is Professor | ||
372 | Weiwu Hu. | ||
365 | 373 | ||
366 | config MACH_PISTACHIO | 374 | config MACH_PISTACHIO |
367 | bool "IMG Pistachio SoC based boards" | 375 | bool "IMG Pistachio SoC based boards" |
@@ -373,7 +381,7 @@ config MACH_PISTACHIO | |||
373 | select COMMON_CLK | 381 | select COMMON_CLK |
374 | select CSRC_R4K | 382 | select CSRC_R4K |
375 | select DMA_MAYBE_COHERENT | 383 | select DMA_MAYBE_COHERENT |
376 | select IRQ_CPU | 384 | select IRQ_MIPS_CPU |
377 | select LIBFDT | 385 | select LIBFDT |
378 | select MFD_SYSCON | 386 | select MFD_SYSCON |
379 | select MIPS_CPU_SCACHE | 387 | select MIPS_CPU_SCACHE |
@@ -386,6 +394,8 @@ config MACH_PISTACHIO | |||
386 | select SYS_SUPPORTS_MIPS_CPS | 394 | select SYS_SUPPORTS_MIPS_CPS |
387 | select SYS_SUPPORTS_MULTITHREADING | 395 | select SYS_SUPPORTS_MULTITHREADING |
388 | select SYS_SUPPORTS_ZBOOT | 396 | select SYS_SUPPORTS_ZBOOT |
397 | select SYS_HAS_EARLY_PRINTK | ||
398 | select USE_GENERIC_EARLY_PRINTK_8250 | ||
389 | select USE_OF | 399 | select USE_OF |
390 | help | 400 | help |
391 | This enables support for the IMG Pistachio SoC platform. | 401 | This enables support for the IMG Pistachio SoC platform. |
@@ -395,13 +405,14 @@ config MIPS_MALTA | |||
395 | select ARCH_MAY_HAVE_PC_FDC | 405 | select ARCH_MAY_HAVE_PC_FDC |
396 | select BOOT_ELF32 | 406 | select BOOT_ELF32 |
397 | select BOOT_RAW | 407 | select BOOT_RAW |
408 | select BUILTIN_DTB | ||
398 | select CEVT_R4K | 409 | select CEVT_R4K |
399 | select CSRC_R4K | 410 | select CSRC_R4K |
400 | select CLKSRC_MIPS_GIC | 411 | select CLKSRC_MIPS_GIC |
401 | select DMA_MAYBE_COHERENT | 412 | select DMA_MAYBE_COHERENT |
402 | select GENERIC_ISA_DMA | 413 | select GENERIC_ISA_DMA |
403 | select HAVE_PCSPKR_PLATFORM | 414 | select HAVE_PCSPKR_PLATFORM |
404 | select IRQ_CPU | 415 | select IRQ_MIPS_CPU |
405 | select MIPS_GIC | 416 | select MIPS_GIC |
406 | select HW_HAS_PCI | 417 | select HW_HAS_PCI |
407 | select I8253 | 418 | select I8253 |
@@ -434,6 +445,8 @@ config MIPS_MALTA | |||
434 | select SYS_SUPPORTS_MULTITHREADING | 445 | select SYS_SUPPORTS_MULTITHREADING |
435 | select SYS_SUPPORTS_SMARTMIPS | 446 | select SYS_SUPPORTS_SMARTMIPS |
436 | select SYS_SUPPORTS_ZBOOT | 447 | select SYS_SUPPORTS_ZBOOT |
448 | select USE_OF | ||
449 | select ZONE_DMA32 if 64BIT | ||
437 | help | 450 | help |
438 | This enables support for the MIPS Technologies Malta evaluation | 451 | This enables support for the MIPS Technologies Malta evaluation |
439 | board. | 452 | board. |
@@ -449,7 +462,7 @@ config MIPS_SEAD3 | |||
449 | select CPU_MIPSR2_IRQ_VI | 462 | select CPU_MIPSR2_IRQ_VI |
450 | select CPU_MIPSR2_IRQ_EI | 463 | select CPU_MIPSR2_IRQ_EI |
451 | select DMA_NONCOHERENT | 464 | select DMA_NONCOHERENT |
452 | select IRQ_CPU | 465 | select IRQ_MIPS_CPU |
453 | select MIPS_GIC | 466 | select MIPS_GIC |
454 | select LIBFDT | 467 | select LIBFDT |
455 | select MIPS_MSC | 468 | select MIPS_MSC |
@@ -512,7 +525,7 @@ config PMC_MSP | |||
512 | select SYS_SUPPORTS_32BIT_KERNEL | 525 | select SYS_SUPPORTS_32BIT_KERNEL |
513 | select SYS_SUPPORTS_BIG_ENDIAN | 526 | select SYS_SUPPORTS_BIG_ENDIAN |
514 | select SYS_SUPPORTS_MIPS16 | 527 | select SYS_SUPPORTS_MIPS16 |
515 | select IRQ_CPU | 528 | select IRQ_MIPS_CPU |
516 | select SERIAL_8250 | 529 | select SERIAL_8250 |
517 | select SERIAL_8250_CONSOLE | 530 | select SERIAL_8250_CONSOLE |
518 | select USB_EHCI_BIG_ENDIAN_MMIO | 531 | select USB_EHCI_BIG_ENDIAN_MMIO |
@@ -529,7 +542,7 @@ config RALINK | |||
529 | select CSRC_R4K | 542 | select CSRC_R4K |
530 | select BOOT_RAW | 543 | select BOOT_RAW |
531 | select DMA_NONCOHERENT | 544 | select DMA_NONCOHERENT |
532 | select IRQ_CPU | 545 | select IRQ_MIPS_CPU |
533 | select USE_OF | 546 | select USE_OF |
534 | select SYS_HAS_CPU_MIPS32_R1 | 547 | select SYS_HAS_CPU_MIPS32_R1 |
535 | select SYS_HAS_CPU_MIPS32_R2 | 548 | select SYS_HAS_CPU_MIPS32_R2 |
@@ -555,7 +568,7 @@ config SGI_IP22 | |||
555 | select I8253 | 568 | select I8253 |
556 | select I8259 | 569 | select I8259 |
557 | select IP22_CPU_SCACHE | 570 | select IP22_CPU_SCACHE |
558 | select IRQ_CPU | 571 | select IRQ_MIPS_CPU |
559 | select GENERIC_ISA_DMA_SUPPORT_BROKEN | 572 | select GENERIC_ISA_DMA_SUPPORT_BROKEN |
560 | select SGI_HAS_I8042 | 573 | select SGI_HAS_I8042 |
561 | select SGI_HAS_INDYDOG | 574 | select SGI_HAS_INDYDOG |
@@ -614,7 +627,7 @@ config SGI_IP28 | |||
614 | select DEFAULT_SGI_PARTITION | 627 | select DEFAULT_SGI_PARTITION |
615 | select DMA_NONCOHERENT | 628 | select DMA_NONCOHERENT |
616 | select GENERIC_ISA_DMA_SUPPORT_BROKEN | 629 | select GENERIC_ISA_DMA_SUPPORT_BROKEN |
617 | select IRQ_CPU | 630 | select IRQ_MIPS_CPU |
618 | select HW_HAS_EISA | 631 | select HW_HAS_EISA |
619 | select I8253 | 632 | select I8253 |
620 | select I8259 | 633 | select I8259 |
@@ -650,7 +663,7 @@ config SGI_IP32 | |||
650 | select CSRC_R4K | 663 | select CSRC_R4K |
651 | select DMA_NONCOHERENT | 664 | select DMA_NONCOHERENT |
652 | select HW_HAS_PCI | 665 | select HW_HAS_PCI |
653 | select IRQ_CPU | 666 | select IRQ_MIPS_CPU |
654 | select R5000_CPU_SCACHE | 667 | select R5000_CPU_SCACHE |
655 | select RM7000_CPU_SCACHE | 668 | select RM7000_CPU_SCACHE |
656 | select SYS_HAS_CPU_R5000 | 669 | select SYS_HAS_CPU_R5000 |
@@ -766,7 +779,7 @@ config SNI_RM | |||
766 | select HAVE_PCSPKR_PLATFORM | 779 | select HAVE_PCSPKR_PLATFORM |
767 | select HW_HAS_EISA | 780 | select HW_HAS_EISA |
768 | select HW_HAS_PCI | 781 | select HW_HAS_PCI |
769 | select IRQ_CPU | 782 | select IRQ_MIPS_CPU |
770 | select I8253 | 783 | select I8253 |
771 | select I8259 | 784 | select I8259 |
772 | select ISA | 785 | select ISA |
@@ -799,7 +812,7 @@ config MIKROTIK_RB532 | |||
799 | select CSRC_R4K | 812 | select CSRC_R4K |
800 | select DMA_NONCOHERENT | 813 | select DMA_NONCOHERENT |
801 | select HW_HAS_PCI | 814 | select HW_HAS_PCI |
802 | select IRQ_CPU | 815 | select IRQ_MIPS_CPU |
803 | select SYS_HAS_CPU_MIPS32_R1 | 816 | select SYS_HAS_CPU_MIPS32_R1 |
804 | select SYS_SUPPORTS_32BIT_KERNEL | 817 | select SYS_SUPPORTS_32BIT_KERNEL |
805 | select SYS_SUPPORTS_LITTLE_ENDIAN | 818 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -866,7 +879,7 @@ config NLM_XLR_BOARD | |||
866 | select NR_CPUS_DEFAULT_32 | 879 | select NR_CPUS_DEFAULT_32 |
867 | select CEVT_R4K | 880 | select CEVT_R4K |
868 | select CSRC_R4K | 881 | select CSRC_R4K |
869 | select IRQ_CPU | 882 | select IRQ_MIPS_CPU |
870 | select ZONE_DMA32 if 64BIT | 883 | select ZONE_DMA32 if 64BIT |
871 | select SYNC_R4K | 884 | select SYNC_R4K |
872 | select SYS_HAS_EARLY_PRINTK | 885 | select SYS_HAS_EARLY_PRINTK |
@@ -893,7 +906,7 @@ config NLM_XLP_BOARD | |||
893 | select NR_CPUS_DEFAULT_32 | 906 | select NR_CPUS_DEFAULT_32 |
894 | select CEVT_R4K | 907 | select CEVT_R4K |
895 | select CSRC_R4K | 908 | select CSRC_R4K |
896 | select IRQ_CPU | 909 | select IRQ_MIPS_CPU |
897 | select ZONE_DMA32 if 64BIT | 910 | select ZONE_DMA32 if 64BIT |
898 | select SYNC_R4K | 911 | select SYNC_R4K |
899 | select SYS_HAS_EARLY_PRINTK | 912 | select SYS_HAS_EARLY_PRINTK |
@@ -942,8 +955,8 @@ source "arch/mips/sibyte/Kconfig" | |||
942 | source "arch/mips/txx9/Kconfig" | 955 | source "arch/mips/txx9/Kconfig" |
943 | source "arch/mips/vr41xx/Kconfig" | 956 | source "arch/mips/vr41xx/Kconfig" |
944 | source "arch/mips/cavium-octeon/Kconfig" | 957 | source "arch/mips/cavium-octeon/Kconfig" |
945 | source "arch/mips/loongson/Kconfig" | 958 | source "arch/mips/loongson32/Kconfig" |
946 | source "arch/mips/loongson1/Kconfig" | 959 | source "arch/mips/loongson64/Kconfig" |
947 | source "arch/mips/netlogic/Kconfig" | 960 | source "arch/mips/netlogic/Kconfig" |
948 | source "arch/mips/paravirt/Kconfig" | 961 | source "arch/mips/paravirt/Kconfig" |
949 | 962 | ||
@@ -1142,10 +1155,6 @@ config SYS_SUPPORTS_HUGETLBFS | |||
1142 | config MIPS_HUGE_TLB_SUPPORT | 1155 | config MIPS_HUGE_TLB_SUPPORT |
1143 | def_bool HUGETLB_PAGE || TRANSPARENT_HUGEPAGE | 1156 | def_bool HUGETLB_PAGE || TRANSPARENT_HUGEPAGE |
1144 | 1157 | ||
1145 | config IRQ_CPU | ||
1146 | bool | ||
1147 | select IRQ_DOMAIN | ||
1148 | |||
1149 | config IRQ_CPU_RM7K | 1158 | config IRQ_CPU_RM7K |
1150 | bool | 1159 | bool |
1151 | 1160 | ||
@@ -1172,7 +1181,7 @@ config SOC_EMMA2RH | |||
1172 | select CEVT_R4K | 1181 | select CEVT_R4K |
1173 | select CSRC_R4K | 1182 | select CSRC_R4K |
1174 | select DMA_NONCOHERENT | 1183 | select DMA_NONCOHERENT |
1175 | select IRQ_CPU | 1184 | select IRQ_MIPS_CPU |
1176 | select SWAP_IO_SPACE | 1185 | select SWAP_IO_SPACE |
1177 | select SYS_HAS_CPU_R5500 | 1186 | select SYS_HAS_CPU_R5500 |
1178 | select SYS_SUPPORTS_32BIT_KERNEL | 1187 | select SYS_SUPPORTS_32BIT_KERNEL |
@@ -1183,7 +1192,7 @@ config SOC_PNX833X | |||
1183 | bool | 1192 | bool |
1184 | select CEVT_R4K | 1193 | select CEVT_R4K |
1185 | select CSRC_R4K | 1194 | select CSRC_R4K |
1186 | select IRQ_CPU | 1195 | select IRQ_MIPS_CPU |
1187 | select DMA_NONCOHERENT | 1196 | select DMA_NONCOHERENT |
1188 | select SYS_HAS_CPU_MIPS32_R2 | 1197 | select SYS_HAS_CPU_MIPS32_R2 |
1189 | select SYS_SUPPORTS_32BIT_KERNEL | 1198 | select SYS_SUPPORTS_32BIT_KERNEL |
@@ -1569,7 +1578,8 @@ config CPU_CAVIUM_OCTEON | |||
1569 | select WEAK_ORDERING | 1578 | select WEAK_ORDERING |
1570 | select CPU_SUPPORTS_HIGHMEM | 1579 | select CPU_SUPPORTS_HIGHMEM |
1571 | select CPU_SUPPORTS_HUGEPAGES | 1580 | select CPU_SUPPORTS_HUGEPAGES |
1572 | select USB_EHCI_BIG_ENDIAN_MMIO | 1581 | select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN |
1582 | select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN | ||
1573 | select MIPS_L1_CACHE_SHIFT_7 | 1583 | select MIPS_L1_CACHE_SHIFT_7 |
1574 | help | 1584 | help |
1575 | The Cavium Octeon processor is a highly integrated chip containing | 1585 | The Cavium Octeon processor is a highly integrated chip containing |
@@ -1587,7 +1597,7 @@ config CPU_BMIPS | |||
1587 | select CPU_BMIPS5000 if SYS_HAS_CPU_BMIPS5000 | 1597 | select CPU_BMIPS5000 if SYS_HAS_CPU_BMIPS5000 |
1588 | select CPU_SUPPORTS_32BIT_KERNEL | 1598 | select CPU_SUPPORTS_32BIT_KERNEL |
1589 | select DMA_NONCOHERENT | 1599 | select DMA_NONCOHERENT |
1590 | select IRQ_CPU | 1600 | select IRQ_MIPS_CPU |
1591 | select SWAP_IO_SPACE | 1601 | select SWAP_IO_SPACE |
1592 | select WEAK_ORDERING | 1602 | select WEAK_ORDERING |
1593 | select CPU_SUPPORTS_HIGHMEM | 1603 | select CPU_SUPPORTS_HIGHMEM |
@@ -2672,6 +2682,51 @@ config USE_OF | |||
2672 | config BUILTIN_DTB | 2682 | config BUILTIN_DTB |
2673 | bool | 2683 | bool |
2674 | 2684 | ||
2685 | choice | ||
2686 | prompt "Kernel appended dtb support" if OF | ||
2687 | default MIPS_NO_APPENDED_DTB | ||
2688 | |||
2689 | config MIPS_NO_APPENDED_DTB | ||
2690 | bool "None" | ||
2691 | help | ||
2692 | Do not enable appended dtb support. | ||
2693 | |||
2694 | config MIPS_RAW_APPENDED_DTB | ||
2695 | bool "vmlinux.bin" | ||
2696 | help | ||
2697 | With this option, the boot code will look for a device tree binary | ||
2698 | DTB) appended to raw vmlinux.bin (without decompressor). | ||
2699 | (e.g. cat vmlinux.bin <filename>.dtb > vmlinux_w_dtb). | ||
2700 | |||
2701 | This is meant as a backward compatibility convenience for those | ||
2702 | systems with a bootloader that can't be upgraded to accommodate | ||
2703 | the documented boot protocol using a device tree. | ||
2704 | |||
2705 | Beware that there is very little in terms of protection against | ||
2706 | this option being confused by leftover garbage in memory that might | ||
2707 | look like a DTB header after a reboot if no actual DTB is appended | ||
2708 | to vmlinux.bin. Do not leave this option active in a production kernel | ||
2709 | if you don't intend to always append a DTB. | ||
2710 | |||
2711 | config MIPS_ZBOOT_APPENDED_DTB | ||
2712 | bool "vmlinuz.bin" | ||
2713 | depends on SYS_SUPPORTS_ZBOOT | ||
2714 | help | ||
2715 | With this option, the boot code will look for a device tree binary | ||
2716 | DTB) appended to raw vmlinuz.bin (with decompressor). | ||
2717 | (e.g. cat vmlinuz.bin <filename>.dtb > vmlinuz_w_dtb). | ||
2718 | |||
2719 | This is meant as a backward compatibility convenience for those | ||
2720 | systems with a bootloader that can't be upgraded to accommodate | ||
2721 | the documented boot protocol using a device tree. | ||
2722 | |||
2723 | Beware that there is very little in terms of protection against | ||
2724 | this option being confused by leftover garbage in memory that might | ||
2725 | look like a DTB header after a reboot if no actual DTB is appended | ||
2726 | to vmlinuz.bin. Do not leave this option active in a production kernel | ||
2727 | if you don't intend to always append a DTB. | ||
2728 | endchoice | ||
2729 | |||
2675 | endmenu | 2730 | endmenu |
2676 | 2731 | ||
2677 | config LOCKDEP_SUPPORT | 2732 | config LOCKDEP_SUPPORT |
diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c index 6a98d2cb402c..6e46abe0dac6 100644 --- a/arch/mips/alchemy/common/clock.c +++ b/arch/mips/alchemy/common/clock.c | |||
@@ -752,12 +752,12 @@ static int __init alchemy_clk_init_fgens(int ctype) | |||
752 | switch (ctype) { | 752 | switch (ctype) { |
753 | case ALCHEMY_CPU_AU1000...ALCHEMY_CPU_AU1200: | 753 | case ALCHEMY_CPU_AU1000...ALCHEMY_CPU_AU1200: |
754 | id.ops = &alchemy_clkops_fgenv1; | 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 | id.num_parents = 2; | 756 | id.num_parents = 2; |
757 | break; | 757 | break; |
758 | case ALCHEMY_CPU_AU1300: | 758 | case ALCHEMY_CPU_AU1300: |
759 | id.ops = &alchemy_clkops_fgenv2; | 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 | id.num_parents = 3; | 761 | id.num_parents = 3; |
762 | break; | 762 | break; |
763 | default: | 763 | default: |
@@ -961,7 +961,7 @@ static int __init alchemy_clk_setup_imux(int ctype) | |||
961 | struct clk *c; | 961 | struct clk *c; |
962 | 962 | ||
963 | id.ops = &alchemy_clkops_csrc; | 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 | id.num_parents = 7; | 965 | id.num_parents = 7; |
966 | id.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE; | 966 | id.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE; |
967 | 967 | ||
diff --git a/arch/mips/ath25/ar2315.c b/arch/mips/ath25/ar2315.c index 2befa7d766a6..8742e1cee492 100644 --- a/arch/mips/ath25/ar2315.c +++ b/arch/mips/ath25/ar2315.c | |||
@@ -76,7 +76,7 @@ static void ar2315_misc_irq_handler(unsigned irq, struct irq_desc *desc) | |||
76 | unsigned nr, misc_irq = 0; | 76 | unsigned nr, misc_irq = 0; |
77 | 77 | ||
78 | if (pending) { | 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 | nr = __ffs(pending); | 81 | nr = __ffs(pending); |
82 | misc_irq = irq_find_mapping(domain, nr); | 82 | misc_irq = irq_find_mapping(domain, nr); |
diff --git a/arch/mips/ath25/ar5312.c b/arch/mips/ath25/ar5312.c index b6887f75144c..094b938fd603 100644 --- a/arch/mips/ath25/ar5312.c +++ b/arch/mips/ath25/ar5312.c | |||
@@ -80,7 +80,7 @@ static void ar5312_misc_irq_handler(unsigned irq, struct irq_desc *desc) | |||
80 | unsigned nr, misc_irq = 0; | 80 | unsigned nr, misc_irq = 0; |
81 | 81 | ||
82 | if (pending) { | 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 | nr = __ffs(pending); | 85 | nr = __ffs(pending); |
86 | misc_irq = irq_find_mapping(domain, nr); | 86 | misc_irq = irq_find_mapping(domain, nr); |
diff --git a/arch/mips/ath25/board.c b/arch/mips/ath25/board.c index b8bb78282d6a..9ab48ff80c1c 100644 --- a/arch/mips/ath25/board.c +++ b/arch/mips/ath25/board.c | |||
@@ -216,7 +216,7 @@ void __init plat_time_init(void) | |||
216 | ar2315_plat_time_init(); | 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 | return CP0_LEGACY_COMPARE_IRQ; | 221 | return CP0_LEGACY_COMPARE_IRQ; |
222 | } | 222 | } |
diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig index dfc60209dc63..13c04cf54afa 100644 --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig | |||
@@ -71,6 +71,18 @@ config ATH79_MACH_UBNT_XM | |||
71 | Say 'Y' here if you want your kernel to support the | 71 | Say 'Y' here if you want your kernel to support the |
72 | Ubiquiti Networks XM (rev 1.0) board. | 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 | endmenu | 86 | endmenu |
75 | 87 | ||
76 | config SOC_AR71XX | 88 | config SOC_AR71XX |
diff --git a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c index 26479f437675..eb5117ced95a 100644 --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/clkdev.h> | 19 | #include <linux/clkdev.h> |
20 | #include <linux/clk-provider.h> | ||
20 | 21 | ||
21 | #include <asm/div64.h> | 22 | #include <asm/div64.h> |
22 | 23 | ||
@@ -28,24 +29,27 @@ | |||
28 | #define AR724X_BASE_FREQ 5000000 | 29 | #define AR724X_BASE_FREQ 5000000 |
29 | #define AR913X_BASE_FREQ 5000000 | 30 | #define AR913X_BASE_FREQ 5000000 |
30 | 31 | ||
31 | struct clk { | 32 | static struct clk *clks[3]; |
32 | unsigned long rate; | 33 | static struct clk_onecell_data clk_data = { |
34 | .clks = clks, | ||
35 | .clk_num = ARRAY_SIZE(clks), | ||
33 | }; | 36 | }; |
34 | 37 | ||
35 | static void __init ath79_add_sys_clkdev(const char *id, unsigned long rate) | 38 | static struct clk *__init ath79_add_sys_clkdev( |
39 | const char *id, unsigned long rate) | ||
36 | { | 40 | { |
37 | struct clk *clk; | 41 | struct clk *clk; |
38 | int err; | 42 | int err; |
39 | 43 | ||
40 | clk = kzalloc(sizeof(*clk), GFP_KERNEL); | 44 | clk = clk_register_fixed_rate(NULL, id, NULL, CLK_IS_ROOT, rate); |
41 | if (!clk) | 45 | if (!clk) |
42 | panic("failed to allocate %s clock structure", id); | 46 | panic("failed to allocate %s clock structure", id); |
43 | 47 | ||
44 | clk->rate = rate; | ||
45 | |||
46 | err = clk_register_clkdev(clk, id, NULL); | 48 | err = clk_register_clkdev(clk, id, NULL); |
47 | if (err) | 49 | if (err) |
48 | panic("unable to register %s clock device", id); | 50 | panic("unable to register %s clock device", id); |
51 | |||
52 | return clk; | ||
49 | } | 53 | } |
50 | 54 | ||
51 | static void __init ar71xx_clocks_init(void) | 55 | static void __init ar71xx_clocks_init(void) |
@@ -62,7 +66,7 @@ static void __init ar71xx_clocks_init(void) | |||
62 | 66 | ||
63 | pll = ath79_pll_rr(AR71XX_PLL_REG_CPU_CONFIG); | 67 | pll = ath79_pll_rr(AR71XX_PLL_REG_CPU_CONFIG); |
64 | 68 | ||
65 | div = ((pll >> AR71XX_PLL_DIV_SHIFT) & AR71XX_PLL_DIV_MASK) + 1; | 69 | div = ((pll >> AR71XX_PLL_FB_SHIFT) & AR71XX_PLL_FB_MASK) + 1; |
66 | freq = div * ref_rate; | 70 | freq = div * ref_rate; |
67 | 71 | ||
68 | div = ((pll >> AR71XX_CPU_DIV_SHIFT) & AR71XX_CPU_DIV_MASK) + 1; | 72 | div = ((pll >> AR71XX_CPU_DIV_SHIFT) & AR71XX_CPU_DIV_MASK) + 1; |
@@ -75,9 +79,9 @@ static void __init ar71xx_clocks_init(void) | |||
75 | ahb_rate = cpu_rate / div; | 79 | ahb_rate = cpu_rate / div; |
76 | 80 | ||
77 | ath79_add_sys_clkdev("ref", ref_rate); | 81 | ath79_add_sys_clkdev("ref", ref_rate); |
78 | ath79_add_sys_clkdev("cpu", cpu_rate); | 82 | clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); |
79 | ath79_add_sys_clkdev("ddr", ddr_rate); | 83 | clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); |
80 | ath79_add_sys_clkdev("ahb", ahb_rate); | 84 | clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); |
81 | 85 | ||
82 | clk_add_alias("wdt", NULL, "ahb", NULL); | 86 | clk_add_alias("wdt", NULL, "ahb", NULL); |
83 | clk_add_alias("uart", NULL, "ahb", NULL); | 87 | clk_add_alias("uart", NULL, "ahb", NULL); |
@@ -96,7 +100,7 @@ static void __init ar724x_clocks_init(void) | |||
96 | ref_rate = AR724X_BASE_FREQ; | 100 | ref_rate = AR724X_BASE_FREQ; |
97 | pll = ath79_pll_rr(AR724X_PLL_REG_CPU_CONFIG); | 101 | pll = ath79_pll_rr(AR724X_PLL_REG_CPU_CONFIG); |
98 | 102 | ||
99 | div = ((pll >> AR724X_PLL_DIV_SHIFT) & AR724X_PLL_DIV_MASK); | 103 | div = ((pll >> AR724X_PLL_FB_SHIFT) & AR724X_PLL_FB_MASK); |
100 | freq = div * ref_rate; | 104 | freq = div * ref_rate; |
101 | 105 | ||
102 | div = ((pll >> AR724X_PLL_REF_DIV_SHIFT) & AR724X_PLL_REF_DIV_MASK); | 106 | div = ((pll >> AR724X_PLL_REF_DIV_SHIFT) & AR724X_PLL_REF_DIV_MASK); |
@@ -111,9 +115,9 @@ static void __init ar724x_clocks_init(void) | |||
111 | ahb_rate = cpu_rate / div; | 115 | ahb_rate = cpu_rate / div; |
112 | 116 | ||
113 | ath79_add_sys_clkdev("ref", ref_rate); | 117 | ath79_add_sys_clkdev("ref", ref_rate); |
114 | ath79_add_sys_clkdev("cpu", cpu_rate); | 118 | clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); |
115 | ath79_add_sys_clkdev("ddr", ddr_rate); | 119 | clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); |
116 | ath79_add_sys_clkdev("ahb", ahb_rate); | 120 | clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); |
117 | 121 | ||
118 | clk_add_alias("wdt", NULL, "ahb", NULL); | 122 | clk_add_alias("wdt", NULL, "ahb", NULL); |
119 | clk_add_alias("uart", NULL, "ahb", NULL); | 123 | clk_add_alias("uart", NULL, "ahb", NULL); |
@@ -132,7 +136,7 @@ static void __init ar913x_clocks_init(void) | |||
132 | ref_rate = AR913X_BASE_FREQ; | 136 | ref_rate = AR913X_BASE_FREQ; |
133 | pll = ath79_pll_rr(AR913X_PLL_REG_CPU_CONFIG); | 137 | pll = ath79_pll_rr(AR913X_PLL_REG_CPU_CONFIG); |
134 | 138 | ||
135 | div = ((pll >> AR913X_PLL_DIV_SHIFT) & AR913X_PLL_DIV_MASK); | 139 | div = ((pll >> AR913X_PLL_FB_SHIFT) & AR913X_PLL_FB_MASK); |
136 | freq = div * ref_rate; | 140 | freq = div * ref_rate; |
137 | 141 | ||
138 | cpu_rate = freq; | 142 | cpu_rate = freq; |
@@ -144,9 +148,9 @@ static void __init ar913x_clocks_init(void) | |||
144 | ahb_rate = cpu_rate / div; | 148 | ahb_rate = cpu_rate / div; |
145 | 149 | ||
146 | ath79_add_sys_clkdev("ref", ref_rate); | 150 | ath79_add_sys_clkdev("ref", ref_rate); |
147 | ath79_add_sys_clkdev("cpu", cpu_rate); | 151 | clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); |
148 | ath79_add_sys_clkdev("ddr", ddr_rate); | 152 | clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); |
149 | ath79_add_sys_clkdev("ahb", ahb_rate); | 153 | clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); |
150 | 154 | ||
151 | clk_add_alias("wdt", NULL, "ahb", NULL); | 155 | clk_add_alias("wdt", NULL, "ahb", NULL); |
152 | clk_add_alias("uart", NULL, "ahb", NULL); | 156 | clk_add_alias("uart", NULL, "ahb", NULL); |
@@ -206,9 +210,9 @@ static void __init ar933x_clocks_init(void) | |||
206 | } | 210 | } |
207 | 211 | ||
208 | ath79_add_sys_clkdev("ref", ref_rate); | 212 | ath79_add_sys_clkdev("ref", ref_rate); |
209 | ath79_add_sys_clkdev("cpu", cpu_rate); | 213 | clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); |
210 | ath79_add_sys_clkdev("ddr", ddr_rate); | 214 | clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); |
211 | ath79_add_sys_clkdev("ahb", ahb_rate); | 215 | clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); |
212 | 216 | ||
213 | clk_add_alias("wdt", NULL, "ahb", NULL); | 217 | clk_add_alias("wdt", NULL, "ahb", NULL); |
214 | clk_add_alias("uart", NULL, "ref", NULL); | 218 | clk_add_alias("uart", NULL, "ref", NULL); |
@@ -340,9 +344,9 @@ static void __init ar934x_clocks_init(void) | |||
340 | ahb_rate = cpu_pll / (postdiv + 1); | 344 | ahb_rate = cpu_pll / (postdiv + 1); |
341 | 345 | ||
342 | ath79_add_sys_clkdev("ref", ref_rate); | 346 | ath79_add_sys_clkdev("ref", ref_rate); |
343 | ath79_add_sys_clkdev("cpu", cpu_rate); | 347 | clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); |
344 | ath79_add_sys_clkdev("ddr", ddr_rate); | 348 | clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); |
345 | ath79_add_sys_clkdev("ahb", ahb_rate); | 349 | clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); |
346 | 350 | ||
347 | clk_add_alias("wdt", NULL, "ref", NULL); | 351 | clk_add_alias("wdt", NULL, "ref", NULL); |
348 | clk_add_alias("uart", NULL, "ref", NULL); | 352 | clk_add_alias("uart", NULL, "ref", NULL); |
@@ -427,9 +431,9 @@ static void __init qca955x_clocks_init(void) | |||
427 | ahb_rate = cpu_pll / (postdiv + 1); | 431 | ahb_rate = cpu_pll / (postdiv + 1); |
428 | 432 | ||
429 | ath79_add_sys_clkdev("ref", ref_rate); | 433 | ath79_add_sys_clkdev("ref", ref_rate); |
430 | ath79_add_sys_clkdev("cpu", cpu_rate); | 434 | clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate); |
431 | ath79_add_sys_clkdev("ddr", ddr_rate); | 435 | clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate); |
432 | ath79_add_sys_clkdev("ahb", ahb_rate); | 436 | clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate); |
433 | 437 | ||
434 | clk_add_alias("wdt", NULL, "ref", NULL); | 438 | clk_add_alias("wdt", NULL, "ref", NULL); |
435 | clk_add_alias("uart", NULL, "ref", NULL); | 439 | clk_add_alias("uart", NULL, "ref", NULL); |
@@ -451,6 +455,8 @@ void __init ath79_clocks_init(void) | |||
451 | qca955x_clocks_init(); | 455 | qca955x_clocks_init(); |
452 | else | 456 | else |
453 | BUG(); | 457 | BUG(); |
458 | |||
459 | of_clk_init(NULL); | ||
454 | } | 460 | } |
455 | 461 | ||
456 | unsigned long __init | 462 | unsigned long __init |
@@ -469,22 +475,16 @@ ath79_get_sys_clk_rate(const char *id) | |||
469 | return rate; | 475 | return rate; |
470 | } | 476 | } |
471 | 477 | ||
472 | /* | 478 | #ifdef CONFIG_OF |
473 | * Linux clock API | 479 | static void __init ath79_clocks_init_dt(struct device_node *np) |
474 | */ | ||
475 | int clk_enable(struct clk *clk) | ||
476 | { | 480 | { |
477 | return 0; | 481 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
478 | } | 482 | } |
479 | EXPORT_SYMBOL(clk_enable); | ||
480 | 483 | ||
481 | void clk_disable(struct clk *clk) | 484 | CLK_OF_DECLARE(ar7100, "qca,ar7100-pll", ath79_clocks_init_dt); |
482 | { | 485 | CLK_OF_DECLARE(ar7240, "qca,ar7240-pll", ath79_clocks_init_dt); |
483 | } | 486 | CLK_OF_DECLARE(ar9130, "qca,ar9130-pll", ath79_clocks_init_dt); |
484 | EXPORT_SYMBOL(clk_disable); | 487 | CLK_OF_DECLARE(ar9330, "qca,ar9330-pll", ath79_clocks_init_dt); |
485 | 488 | CLK_OF_DECLARE(ar9340, "qca,ar9340-pll", ath79_clocks_init_dt); | |
486 | unsigned long clk_get_rate(struct clk *clk) | 489 | CLK_OF_DECLARE(ar9550, "qca,qca9550-pll", ath79_clocks_init_dt); |
487 | { | 490 | #endif |
488 | return clk->rate; | ||
489 | } | ||
490 | EXPORT_SYMBOL(clk_get_rate); | ||
diff --git a/arch/mips/ath79/common.c b/arch/mips/ath79/common.c index eb3966cd8cfc..3cedd1f95e0f 100644 --- a/arch/mips/ath79/common.c +++ b/arch/mips/ath79/common.c | |||
@@ -38,11 +38,27 @@ unsigned int ath79_soc_rev; | |||
38 | void __iomem *ath79_pll_base; | 38 | void __iomem *ath79_pll_base; |
39 | void __iomem *ath79_reset_base; | 39 | void __iomem *ath79_reset_base; |
40 | EXPORT_SYMBOL_GPL(ath79_reset_base); | 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 | void ath79_ddr_wb_flush(u32 reg) | 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 | /* Flush the DDR write buffer. */ | 63 | /* Flush the DDR write buffer. */ |
48 | __raw_writel(0x1, flush_reg); | 64 | __raw_writel(0x1, flush_reg); |
@@ -56,6 +72,21 @@ void ath79_ddr_wb_flush(u32 reg) | |||
56 | } | 72 | } |
57 | EXPORT_SYMBOL_GPL(ath79_ddr_wb_flush); | 73 | EXPORT_SYMBOL_GPL(ath79_ddr_wb_flush); |
58 | 74 | ||
75 | void ath79_ddr_set_pci_windows(void) | ||
76 | { | ||
77 | BUG_ON(!ath79_ddr_pci_win_base); | ||
78 | |||
79 | __raw_writel(AR71XX_PCI_WIN0_OFFS, ath79_ddr_pci_win_base + 0); | ||
80 | __raw_writel(AR71XX_PCI_WIN1_OFFS, ath79_ddr_pci_win_base + 1); | ||
81 | __raw_writel(AR71XX_PCI_WIN2_OFFS, ath79_ddr_pci_win_base + 2); | ||
82 | __raw_writel(AR71XX_PCI_WIN3_OFFS, ath79_ddr_pci_win_base + 3); | ||
83 | __raw_writel(AR71XX_PCI_WIN4_OFFS, ath79_ddr_pci_win_base + 4); | ||
84 | __raw_writel(AR71XX_PCI_WIN5_OFFS, ath79_ddr_pci_win_base + 5); | ||
85 | __raw_writel(AR71XX_PCI_WIN6_OFFS, ath79_ddr_pci_win_base + 6); | ||
86 | __raw_writel(AR71XX_PCI_WIN7_OFFS, ath79_ddr_pci_win_base + 7); | ||
87 | } | ||
88 | EXPORT_SYMBOL_GPL(ath79_ddr_set_pci_windows); | ||
89 | |||
59 | void ath79_device_reset_set(u32 mask) | 90 | void ath79_device_reset_set(u32 mask) |
60 | { | 91 | { |
61 | unsigned long flags; | 92 | unsigned long flags; |
diff --git a/arch/mips/ath79/common.h b/arch/mips/ath79/common.h index c39de61f9b36..e5ea71277f0c 100644 --- a/arch/mips/ath79/common.h +++ b/arch/mips/ath79/common.h | |||
@@ -22,6 +22,7 @@ | |||
22 | void ath79_clocks_init(void); | 22 | void ath79_clocks_init(void); |
23 | unsigned long ath79_get_sys_clk_rate(const char *id); | 23 | unsigned long ath79_get_sys_clk_rate(const char *id); |
24 | 24 | ||
25 | void ath79_ddr_ctrl_init(void); | ||
25 | void ath79_ddr_wb_flush(unsigned int reg); | 26 | void ath79_ddr_wb_flush(unsigned int reg); |
26 | 27 | ||
27 | void ath79_gpio_function_enable(u32 mask); | 28 | void ath79_gpio_function_enable(u32 mask); |
diff --git a/arch/mips/ath79/dev-common.c b/arch/mips/ath79/dev-common.c index 516225d207ee..9d0172a4dc69 100644 --- a/arch/mips/ath79/dev-common.c +++ b/arch/mips/ath79/dev-common.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/platform_data/gpio-ath79.h> | ||
17 | #include <linux/serial_8250.h> | 18 | #include <linux/serial_8250.h> |
18 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
19 | #include <linux/err.h> | 20 | #include <linux/err.h> |
@@ -106,3 +107,53 @@ void __init ath79_register_wdt(void) | |||
106 | 107 | ||
107 | platform_device_register_simple("ath79-wdt", -1, &res, 1); | 108 | platform_device_register_simple("ath79-wdt", -1, &res, 1); |
108 | } | 109 | } |
110 | |||
111 | static struct ath79_gpio_platform_data ath79_gpio_pdata; | ||
112 | |||
113 | static struct resource ath79_gpio_resources[] = { | ||
114 | { | ||
115 | .flags = IORESOURCE_MEM, | ||
116 | .start = AR71XX_GPIO_BASE, | ||
117 | .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1, | ||
118 | }, | ||
119 | { | ||
120 | .start = ATH79_MISC_IRQ(2), | ||
121 | .end = ATH79_MISC_IRQ(2), | ||
122 | .flags = IORESOURCE_IRQ, | ||
123 | }, | ||
124 | }; | ||
125 | |||
126 | static struct platform_device ath79_gpio_device = { | ||
127 | .name = "ath79-gpio", | ||
128 | .id = -1, | ||
129 | .resource = ath79_gpio_resources, | ||
130 | .num_resources = ARRAY_SIZE(ath79_gpio_resources), | ||
131 | .dev = { | ||
132 | .platform_data = &ath79_gpio_pdata | ||
133 | }, | ||
134 | }; | ||
135 | |||
136 | void __init ath79_gpio_init(void) | ||
137 | { | ||
138 | if (soc_is_ar71xx()) { | ||
139 | ath79_gpio_pdata.ngpios = AR71XX_GPIO_COUNT; | ||
140 | } else if (soc_is_ar7240()) { | ||
141 | ath79_gpio_pdata.ngpios = AR7240_GPIO_COUNT; | ||
142 | } else if (soc_is_ar7241() || soc_is_ar7242()) { | ||
143 | ath79_gpio_pdata.ngpios = AR7241_GPIO_COUNT; | ||
144 | } else if (soc_is_ar913x()) { | ||
145 | ath79_gpio_pdata.ngpios = AR913X_GPIO_COUNT; | ||
146 | } else if (soc_is_ar933x()) { | ||
147 | ath79_gpio_pdata.ngpios = AR933X_GPIO_COUNT; | ||
148 | } else if (soc_is_ar934x()) { | ||
149 | ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT; | ||
150 | ath79_gpio_pdata.oe_inverted = 1; | ||
151 | } else if (soc_is_qca955x()) { | ||
152 | ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; | ||
153 | ath79_gpio_pdata.oe_inverted = 1; | ||
154 | } else { | ||
155 | BUG(); | ||
156 | } | ||
157 | |||
158 | platform_device_register(&ath79_gpio_device); | ||
159 | } | ||
diff --git a/arch/mips/ath79/gpio.c b/arch/mips/ath79/gpio.c index 8d025b028bb1..f59ccb26520a 100644 --- a/arch/mips/ath79/gpio.c +++ b/arch/mips/ath79/gpio.c | |||
@@ -20,13 +20,15 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/platform_data/gpio-ath79.h> | ||
24 | #include <linux/of_device.h> | ||
23 | 25 | ||
24 | #include <asm/mach-ath79/ar71xx_regs.h> | 26 | #include <asm/mach-ath79/ar71xx_regs.h> |
25 | #include <asm/mach-ath79/ath79.h> | 27 | #include <asm/mach-ath79/ath79.h> |
26 | #include "common.h" | 28 | #include "common.h" |
27 | 29 | ||
28 | static void __iomem *ath79_gpio_base; | 30 | static void __iomem *ath79_gpio_base; |
29 | static unsigned long ath79_gpio_count; | 31 | static u32 ath79_gpio_count; |
30 | static DEFINE_SPINLOCK(ath79_gpio_lock); | 32 | static DEFINE_SPINLOCK(ath79_gpio_lock); |
31 | 33 | ||
32 | static void __ath79_gpio_set_value(unsigned gpio, int value) | 34 | static void __ath79_gpio_set_value(unsigned gpio, int value) |
@@ -178,39 +180,72 @@ void ath79_gpio_function_disable(u32 mask) | |||
178 | ath79_gpio_function_setup(0, mask); | 180 | ath79_gpio_function_setup(0, mask); |
179 | } | 181 | } |
180 | 182 | ||
181 | void __init ath79_gpio_init(void) | 183 | static const struct of_device_id ath79_gpio_of_match[] = { |
184 | { .compatible = "qca,ar7100-gpio" }, | ||
185 | { .compatible = "qca,ar9340-gpio" }, | ||
186 | {}, | ||
187 | }; | ||
188 | |||
189 | static int ath79_gpio_probe(struct platform_device *pdev) | ||
182 | { | 190 | { |
191 | struct ath79_gpio_platform_data *pdata = pdev->dev.platform_data; | ||
192 | struct device_node *np = pdev->dev.of_node; | ||
193 | struct resource *res; | ||
194 | bool oe_inverted; | ||
183 | int err; | 195 | int err; |
184 | 196 | ||
185 | if (soc_is_ar71xx()) | 197 | if (np) { |
186 | ath79_gpio_count = AR71XX_GPIO_COUNT; | 198 | err = of_property_read_u32(np, "ngpios", &ath79_gpio_count); |
187 | else if (soc_is_ar7240()) | 199 | if (err) { |
188 | ath79_gpio_count = AR7240_GPIO_COUNT; | 200 | dev_err(&pdev->dev, "ngpios property is not valid\n"); |
189 | else if (soc_is_ar7241() || soc_is_ar7242()) | 201 | return err; |
190 | ath79_gpio_count = AR7241_GPIO_COUNT; | 202 | } |
191 | else if (soc_is_ar913x()) | 203 | if (ath79_gpio_count >= 32) { |
192 | ath79_gpio_count = AR913X_GPIO_COUNT; | 204 | dev_err(&pdev->dev, "ngpios must be less than 32\n"); |
193 | else if (soc_is_ar933x()) | 205 | return -EINVAL; |
194 | ath79_gpio_count = AR933X_GPIO_COUNT; | 206 | } |
195 | else if (soc_is_ar934x()) | 207 | oe_inverted = of_device_is_compatible(np, "qca,ar9340-gpio"); |
196 | ath79_gpio_count = AR934X_GPIO_COUNT; | 208 | } else if (pdata) { |
197 | else if (soc_is_qca955x()) | 209 | ath79_gpio_count = pdata->ngpios; |
198 | ath79_gpio_count = QCA955X_GPIO_COUNT; | 210 | oe_inverted = pdata->oe_inverted; |
199 | else | 211 | } else { |
200 | BUG(); | 212 | dev_err(&pdev->dev, "No DT node or platform data found\n"); |
213 | return -EINVAL; | ||
214 | } | ||
215 | |||
216 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
217 | ath79_gpio_base = devm_ioremap_nocache( | ||
218 | &pdev->dev, res->start, resource_size(res)); | ||
219 | if (!ath79_gpio_base) | ||
220 | return -ENOMEM; | ||
201 | 221 | ||
202 | ath79_gpio_base = ioremap_nocache(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); | 222 | ath79_gpio_chip.dev = &pdev->dev; |
203 | ath79_gpio_chip.ngpio = ath79_gpio_count; | 223 | ath79_gpio_chip.ngpio = ath79_gpio_count; |
204 | if (soc_is_ar934x() || soc_is_qca955x()) { | 224 | if (oe_inverted) { |
205 | ath79_gpio_chip.direction_input = ar934x_gpio_direction_input; | 225 | ath79_gpio_chip.direction_input = ar934x_gpio_direction_input; |
206 | ath79_gpio_chip.direction_output = ar934x_gpio_direction_output; | 226 | ath79_gpio_chip.direction_output = ar934x_gpio_direction_output; |
207 | } | 227 | } |
208 | 228 | ||
209 | err = gpiochip_add(&ath79_gpio_chip); | 229 | err = gpiochip_add(&ath79_gpio_chip); |
210 | if (err) | 230 | if (err) { |
211 | panic("cannot add AR71xx GPIO chip, error=%d", err); | 231 | dev_err(&pdev->dev, |
232 | "cannot add AR71xx GPIO chip, error=%d", err); | ||
233 | return err; | ||
234 | } | ||
235 | |||
236 | return 0; | ||
212 | } | 237 | } |
213 | 238 | ||
239 | static struct platform_driver ath79_gpio_driver = { | ||
240 | .driver = { | ||
241 | .name = "ath79-gpio", | ||
242 | .of_match_table = ath79_gpio_of_match, | ||
243 | }, | ||
244 | .probe = ath79_gpio_probe, | ||
245 | }; | ||
246 | |||
247 | module_platform_driver(ath79_gpio_driver); | ||
248 | |||
214 | int gpio_get_value(unsigned gpio) | 249 | int gpio_get_value(unsigned gpio) |
215 | { | 250 | { |
216 | if (gpio < ath79_gpio_count) | 251 | if (gpio < ath79_gpio_count) |
diff --git a/arch/mips/ath79/irq.c b/arch/mips/ath79/irq.c index 6adae366f11a..afb009603f7f 100644 --- a/arch/mips/ath79/irq.c +++ b/arch/mips/ath79/irq.c | |||
@@ -15,7 +15,9 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/interrupt.h> | 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 | #include <asm/irq_cpu.h> | 22 | #include <asm/irq_cpu.h> |
21 | #include <asm/mipsregs.h> | 23 | #include <asm/mipsregs.h> |
@@ -23,9 +25,7 @@ | |||
23 | #include <asm/mach-ath79/ath79.h> | 25 | #include <asm/mach-ath79/ath79.h> |
24 | #include <asm/mach-ath79/ar71xx_regs.h> | 26 | #include <asm/mach-ath79/ar71xx_regs.h> |
25 | #include "common.h" | 27 | #include "common.h" |
26 | 28 | #include "machtypes.h" | |
27 | static void (*ath79_ip2_handler)(void); | ||
28 | static void (*ath79_ip3_handler)(void); | ||
29 | 29 | ||
30 | static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc) | 30 | static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc) |
31 | { | 31 | { |
@@ -129,10 +129,10 @@ static void ar934x_ip2_irq_dispatch(unsigned int irq, struct irq_desc *desc) | |||
129 | status = ath79_reset_rr(AR934X_RESET_REG_PCIE_WMAC_INT_STATUS); | 129 | status = ath79_reset_rr(AR934X_RESET_REG_PCIE_WMAC_INT_STATUS); |
130 | 130 | ||
131 | if (status & AR934X_PCIE_WMAC_INT_PCIE_ALL) { | 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 | generic_handle_irq(ATH79_IP2_IRQ(0)); | 133 | generic_handle_irq(ATH79_IP2_IRQ(0)); |
134 | } else if (status & AR934X_PCIE_WMAC_INT_WMAC_ALL) { | 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 | generic_handle_irq(ATH79_IP2_IRQ(1)); | 136 | generic_handle_irq(ATH79_IP2_IRQ(1)); |
137 | } else { | 137 | } else { |
138 | spurious_interrupt(); | 138 | spurious_interrupt(); |
@@ -235,128 +235,132 @@ static void qca955x_irq_init(void) | |||
235 | irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); | 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 | * The IP2/IP3 lines are tied to a PCI/WMAC/USB device. Drivers for | 239 | * The IP2/IP3 lines are tied to a PCI/WMAC/USB device. Drivers for |
268 | * these devices typically allocate coherent DMA memory, however the | 240 | * these devices typically allocate coherent DMA memory, however the |
269 | * DMA controller may still have some unsynchronized data in the FIFO. | 241 | * DMA controller may still have some unsynchronized data in the FIFO. |
270 | * Issue a flush in the handlers to ensure that the driver sees | 242 | * Issue a flush in the handlers to ensure that the driver sees |
271 | * the update. | 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] = { |
275 | { | 249 | -1, -1, -1, -1, -1, -1, -1, -1, |
276 | do_IRQ(ATH79_CPU_IRQ(2)); | 250 | }; |
277 | } | ||
278 | 251 | ||
279 | static void ath79_default_ip3_handler(void) | 252 | asmlinkage void plat_irq_dispatch(void) |
280 | { | 253 | { |
281 | do_IRQ(ATH79_CPU_IRQ(3)); | 254 | unsigned long pending; |
282 | } | 255 | int irq; |
283 | 256 | ||
284 | static void ar71xx_ip2_handler(void) | 257 | pending = read_c0_status() & read_c0_cause() & ST0_IM; |
285 | { | ||
286 | ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_PCI); | ||
287 | do_IRQ(ATH79_CPU_IRQ(2)); | ||
288 | } | ||
289 | 258 | ||
290 | static void ar724x_ip2_handler(void) | 259 | if (!pending) { |
291 | { | 260 | spurious_interrupt(); |
292 | ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_PCIE); | 261 | return; |
293 | do_IRQ(ATH79_CPU_IRQ(2)); | 262 | } |
294 | } | ||
295 | 263 | ||
296 | static void ar913x_ip2_handler(void) | 264 | pending >>= CAUSEB_IP; |
297 | { | 265 | while (pending) { |
298 | ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_WMAC); | 266 | irq = fls(pending) - 1; |
299 | do_IRQ(ATH79_CPU_IRQ(2)); | 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 | } | ||
300 | } | 272 | } |
301 | 273 | ||
302 | static void ar933x_ip2_handler(void) | 274 | #ifdef CONFIG_IRQCHIP |
275 | static int misc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) | ||
303 | { | 276 | { |
304 | ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_WMAC); | 277 | irq_set_chip_and_handler(irq, &ath79_misc_irq_chip, handle_level_irq); |
305 | do_IRQ(ATH79_CPU_IRQ(2)); | 278 | return 0; |
306 | } | 279 | } |
307 | 280 | ||
308 | static void ar71xx_ip3_handler(void) | 281 | static const struct irq_domain_ops misc_irq_domain_ops = { |
309 | { | 282 | .xlate = irq_domain_xlate_onecell, |
310 | ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_USB); | 283 | .map = misc_map, |
311 | do_IRQ(ATH79_CPU_IRQ(3)); | 284 | }; |
312 | } | ||
313 | 285 | ||
314 | static void ar724x_ip3_handler(void) | 286 | static int __init ath79_misc_intc_of_init( |
287 | struct device_node *node, struct device_node *parent) | ||
315 | { | 288 | { |
316 | ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_USB); | 289 | void __iomem *base = ath79_reset_base; |
317 | do_IRQ(ATH79_CPU_IRQ(3)); | 290 | struct irq_domain *domain; |
318 | } | 291 | int irq; |
319 | 292 | ||
320 | static void ar913x_ip3_handler(void) | 293 | irq = irq_of_parse_and_map(node, 0); |
321 | { | 294 | if (!irq) |
322 | ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_USB); | 295 | panic("Failed to get MISC IRQ"); |
323 | do_IRQ(ATH79_CPU_IRQ(3)); | ||
324 | } | ||
325 | 296 | ||
326 | static void ar933x_ip3_handler(void) | 297 | domain = irq_domain_add_legacy(node, ATH79_MISC_IRQ_COUNT, |
327 | { | 298 | ATH79_MISC_IRQ_BASE, 0, &misc_irq_domain_ops, NULL); |
328 | ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_USB); | 299 | if (!domain) |
329 | do_IRQ(ATH79_CPU_IRQ(3)); | 300 | panic("Failed to add MISC irqdomain"); |
301 | |||
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); | ||
305 | |||
306 | |||
307 | irq_set_chained_handler(irq, ath79_misc_irq_handler); | ||
308 | |||
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); | 317 | int err, i, count; |
335 | do_IRQ(ATH79_CPU_IRQ(3)); | 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 | void __init arch_init_irq(void) | 351 | void __init arch_init_irq(void) |
339 | { | 352 | { |
340 | if (soc_is_ar71xx()) { | 353 | if (mips_machtype == ATH79_MACH_GENERIC_OF) { |
341 | ath79_ip2_handler = ar71xx_ip2_handler; | 354 | irqchip_init(); |
342 | ath79_ip3_handler = ar71xx_ip3_handler; | 355 | return; |
343 | } else if (soc_is_ar724x()) { | 356 | } |
344 | ath79_ip2_handler = ar724x_ip2_handler; | 357 | |
345 | ath79_ip3_handler = ar724x_ip3_handler; | 358 | if (soc_is_ar71xx() || soc_is_ar724x() || |
346 | } else if (soc_is_ar913x()) { | 359 | soc_is_ar913x() || soc_is_ar933x()) { |
347 | ath79_ip2_handler = ar913x_ip2_handler; | 360 | irq_wb_chan[2] = 3; |
348 | ath79_ip3_handler = ar913x_ip3_handler; | 361 | irq_wb_chan[3] = 2; |
349 | } else if (soc_is_ar933x()) { | ||
350 | ath79_ip2_handler = ar933x_ip2_handler; | ||
351 | ath79_ip3_handler = ar933x_ip3_handler; | ||
352 | } else if (soc_is_ar934x()) { | 362 | } else if (soc_is_ar934x()) { |
353 | ath79_ip2_handler = ath79_default_ip2_handler; | 363 | irq_wb_chan[3] = 2; |
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(); | ||
360 | } | 364 | } |
361 | 365 | ||
362 | mips_cpu_irq_init(); | 366 | mips_cpu_irq_init(); |
diff --git a/arch/mips/ath79/machtypes.h b/arch/mips/ath79/machtypes.h index 26254058c545..a13db3d15c8f 100644 --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/mips_machine.h> | 15 | #include <asm/mips_machine.h> |
16 | 16 | ||
17 | enum ath79_mach_type { | 17 | enum ath79_mach_type { |
18 | ATH79_MACH_GENERIC_OF = -1, /* Device tree board */ | ||
18 | ATH79_MACH_GENERIC = 0, | 19 | ATH79_MACH_GENERIC = 0, |
19 | ATH79_MACH_AP121, /* Atheros AP121 reference board */ | 20 | ATH79_MACH_AP121, /* Atheros AP121 reference board */ |
20 | ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ | 21 | ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ |
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index 7fc8397d16f2..01a644f174dd 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c | |||
@@ -17,12 +17,16 @@ | |||
17 | #include <linux/bootmem.h> | 17 | #include <linux/bootmem.h> |
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/of_platform.h> | ||
21 | #include <linux/of_fdt.h> | ||
20 | 22 | ||
21 | #include <asm/bootinfo.h> | 23 | #include <asm/bootinfo.h> |
22 | #include <asm/idle.h> | 24 | #include <asm/idle.h> |
23 | #include <asm/time.h> /* for mips_hpt_frequency */ | 25 | #include <asm/time.h> /* for mips_hpt_frequency */ |
24 | #include <asm/reboot.h> /* for _machine_{restart,halt} */ | 26 | #include <asm/reboot.h> /* for _machine_{restart,halt} */ |
25 | #include <asm/mips_machine.h> | 27 | #include <asm/mips_machine.h> |
28 | #include <asm/prom.h> | ||
29 | #include <asm/fw/fw.h> | ||
26 | 30 | ||
27 | #include <asm/mach-ath79/ath79.h> | 31 | #include <asm/mach-ath79/ath79.h> |
28 | #include <asm/mach-ath79/ar71xx_regs.h> | 32 | #include <asm/mach-ath79/ar71xx_regs.h> |
@@ -194,17 +198,28 @@ unsigned int get_c0_compare_int(void) | |||
194 | 198 | ||
195 | void __init plat_mem_setup(void) | 199 | void __init plat_mem_setup(void) |
196 | { | 200 | { |
201 | unsigned long fdt_start; | ||
202 | |||
197 | set_io_port_base(KSEG1); | 203 | set_io_port_base(KSEG1); |
198 | 204 | ||
205 | /* Get the position of the FDT passed by the bootloader */ | ||
206 | fdt_start = fw_getenvl("fdt_start"); | ||
207 | if (fdt_start) | ||
208 | __dt_setup_arch((void *)KSEG0ADDR(fdt_start)); | ||
209 | #ifdef CONFIG_BUILTIN_DTB | ||
210 | else | ||
211 | __dt_setup_arch(__dtb_start); | ||
212 | #endif | ||
213 | |||
199 | ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, | 214 | ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, |
200 | AR71XX_RESET_SIZE); | 215 | AR71XX_RESET_SIZE); |
201 | ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, | 216 | ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, |
202 | AR71XX_PLL_SIZE); | 217 | AR71XX_PLL_SIZE); |
203 | ath79_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE, | 218 | ath79_ddr_ctrl_init(); |
204 | AR71XX_DDR_CTRL_SIZE); | ||
205 | 219 | ||
206 | ath79_detect_sys_type(); | 220 | ath79_detect_sys_type(); |
207 | detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); | 221 | if (mips_machtype != ATH79_MACH_GENERIC_OF) |
222 | detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); | ||
208 | 223 | ||
209 | _machine_restart = ath79_restart; | 224 | _machine_restart = ath79_restart; |
210 | _machine_halt = ath79_halt; | 225 | _machine_halt = ath79_halt; |
@@ -236,6 +251,10 @@ void __init plat_time_init(void) | |||
236 | 251 | ||
237 | static int __init ath79_setup(void) | 252 | static int __init ath79_setup(void) |
238 | { | 253 | { |
254 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
255 | if (mips_machtype == ATH79_MACH_GENERIC_OF) | ||
256 | return 0; | ||
257 | |||
239 | ath79_gpio_init(); | 258 | ath79_gpio_init(); |
240 | ath79_register_uart(); | 259 | ath79_register_uart(); |
241 | ath79_register_wdt(); | 260 | ath79_register_wdt(); |
@@ -247,6 +266,11 @@ static int __init ath79_setup(void) | |||
247 | 266 | ||
248 | arch_initcall(ath79_setup); | 267 | arch_initcall(ath79_setup); |
249 | 268 | ||
269 | void __init device_tree_init(void) | ||
270 | { | ||
271 | unflatten_and_copy_device_tree(); | ||
272 | } | ||
273 | |||
250 | static void __init ath79_generic_init(void) | 274 | static void __init ath79_generic_init(void) |
251 | { | 275 | { |
252 | /* Nothing to do */ | 276 | /* Nothing to do */ |
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig index fc21d3659fa0..51ed599cc894 100644 --- a/arch/mips/bcm47xx/Kconfig +++ b/arch/mips/bcm47xx/Kconfig | |||
@@ -25,7 +25,6 @@ config BCM47XX_BCMA | |||
25 | select BCMA | 25 | select BCMA |
26 | select BCMA_HOST_SOC | 26 | select BCMA_HOST_SOC |
27 | select BCMA_DRIVER_MIPS | 27 | select BCMA_DRIVER_MIPS |
28 | select BCMA_HOST_PCI if PCI | ||
29 | select BCMA_DRIVER_PCI_HOSTMODE if PCI | 28 | select BCMA_DRIVER_PCI_HOSTMODE if PCI |
30 | select BCMA_DRIVER_GPIO | 29 | select BCMA_DRIVER_GPIO |
31 | default y | 30 | default y |
diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile index d58c51b5e501..66bea4ecf449 100644 --- a/arch/mips/bcm47xx/Makefile +++ b/arch/mips/bcm47xx/Makefile | |||
@@ -3,5 +3,5 @@ | |||
3 | # under Linux. | 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 | obj-y += board.o buttons.o leds.o workarounds.o | 7 | obj-y += board.o buttons.o leds.o workarounds.o |
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c index bd56415f2f3b..a88975a55c4d 100644 --- a/arch/mips/bcm47xx/board.c +++ b/arch/mips/bcm47xx/board.c | |||
@@ -149,6 +149,7 @@ struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] __initconst = { | |||
149 | /* board_id */ | 149 | /* board_id */ |
150 | static const | 150 | static const |
151 | struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = { | 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 | {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"}, | 153 | {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"}, |
153 | {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"}, | 154 | {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"}, |
154 | {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "Netgear WGR614 V10"}, "U12H139T01_NETGEAR"}, | 155 | {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "Netgear WGR614 V10"}, "U12H139T01_NETGEAR"}, |
diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c index 276276a8c6d7..08a4abf09a33 100644 --- a/arch/mips/bcm47xx/buttons.c +++ b/arch/mips/bcm47xx/buttons.c | |||
@@ -299,6 +299,13 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = { | |||
299 | BCM47XX_GPIO_KEY(6, KEY_RESTART), | 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 | /* Microsoft */ | 309 | /* Microsoft */ |
303 | 310 | ||
304 | static const struct gpio_keys_button | 311 | static const struct gpio_keys_button |
@@ -555,6 +562,10 @@ int __init bcm47xx_buttons_register(void) | |||
555 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); | 562 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); |
556 | break; | 563 | break; |
557 | 564 | ||
565 | case BCM47XX_BOARD_LUXUL_XWR_1750_V1: | ||
566 | err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1); | ||
567 | break; | ||
568 | |||
558 | case BCM47XX_BOARD_MICROSOFT_MN700: | 569 | case BCM47XX_BOARD_MICROSOFT_MN700: |
559 | err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700); | 570 | err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700); |
560 | break; | 571 | break; |
diff --git a/arch/mips/bcm47xx/leds.c b/arch/mips/bcm47xx/leds.c index 0e4ade342333..d20ae63eb3c2 100644 --- a/arch/mips/bcm47xx/leds.c +++ b/arch/mips/bcm47xx/leds.c | |||
@@ -370,6 +370,16 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initconst = { | |||
370 | BCM47XX_GPIO_LED(7, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), | 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 | /* Microsoft */ | 383 | /* Microsoft */ |
374 | 384 | ||
375 | static const struct gpio_led | 385 | static const struct gpio_led |
@@ -623,6 +633,10 @@ void __init bcm47xx_leds_register(void) | |||
623 | bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); | 633 | bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); |
624 | break; | 634 | break; |
625 | 635 | ||
636 | case BCM47XX_BOARD_LUXUL_XWR_1750_V1: | ||
637 | bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1); | ||
638 | break; | ||
639 | |||
626 | case BCM47XX_BOARD_MICROSOFT_MN700: | 640 | case BCM47XX_BOARD_MICROSOFT_MN700: |
627 | bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700); | 641 | bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700); |
628 | break; | 642 | break; |
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c index ab698bad6d62..135a5407f015 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c | |||
@@ -126,7 +126,7 @@ void __init prom_free_prom_memory(void) | |||
126 | /* Stripped version of tlb_init, with the call to build_tlb_refill_handler | 126 | /* Stripped version of tlb_init, with the call to build_tlb_refill_handler |
127 | * dropped. Calling it at this stage causes a hang. | 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 | write_c0_pagemask(PM_DEFAULT_MASK); | 131 | write_c0_pagemask(PM_DEFAULT_MASK); |
132 | write_c0_wired(0); | 132 | write_c0_wired(0); |
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index 82ff9fd2ab6e..98c075f81795 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c | |||
@@ -206,9 +206,6 @@ void __init bcm47xx_bus_setup(void) | |||
206 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); | 206 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); |
207 | if (err) | 207 | if (err) |
208 | panic("Failed to initialize BCMA bus (err %d)", err); | 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 | #endif | 210 | #endif |
214 | 211 | ||
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c index 68ebf2322f8b..2d5c7a7f24bb 100644 --- a/arch/mips/bcm47xx/sprom.c +++ b/arch/mips/bcm47xx/sprom.c | |||
@@ -200,7 +200,13 @@ static void bcm47xx_sprom_fill_auto(struct ssb_sprom *sprom, | |||
200 | const char *pre = prefix; | 200 | const char *pre = prefix; |
201 | bool fb = fallback; | 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 | ENTRY(0xfffffffe, u16, pre, "boardrev", board_rev, 0, true); | 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 | ENTRY(0x00000002, u16, pre, "boardflags", boardflags_lo, 0, fb); | 210 | ENTRY(0x00000002, u16, pre, "boardflags", boardflags_lo, 0, fb); |
205 | ENTRY(0xfffffffc, u16, pre, "boardtype", board_type, 0, true); | 211 | ENTRY(0xfffffffc, u16, pre, "boardtype", board_type, 0, true); |
206 | ENTRY(0xfffffffe, u16, pre, "boardnum", board_num, 0, fb); | 212 | ENTRY(0xfffffffe, u16, pre, "boardnum", board_num, 0, fb); |
@@ -409,27 +415,6 @@ static void bcm47xx_sprom_fill_auto(struct ssb_sprom *sprom, | |||
409 | } | 415 | } |
410 | #undef ENTRY /* It's specififc, uses local variable, don't use it (again). */ | 416 | #undef ENTRY /* It's specififc, uses local variable, don't use it (again). */ |
411 | 417 | ||
412 | static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, | ||
413 | const char *prefix, bool fallback) | ||
414 | { | ||
415 | nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback); | ||
416 | nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback); | ||
417 | } | ||
418 | |||
419 | static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix, | ||
420 | bool fallback) | ||
421 | { | ||
422 | nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, | ||
423 | &sprom->leddc_off_time, fallback); | ||
424 | } | ||
425 | |||
426 | static void bcm47xx_fill_sprom_r4589(struct ssb_sprom *sprom, | ||
427 | const char *prefix, bool fallback) | ||
428 | { | ||
429 | nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, | ||
430 | &sprom->leddc_off_time, fallback); | ||
431 | } | ||
432 | |||
433 | static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom, | 418 | static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom, |
434 | const char *prefix, bool fallback) | 419 | const char *prefix, bool fallback) |
435 | { | 420 | { |
@@ -528,6 +513,8 @@ static int mac_addr_used = 2; | |||
528 | static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, | 513 | static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, |
529 | const char *prefix, bool fallback) | 514 | const char *prefix, bool fallback) |
530 | { | 515 | { |
516 | bool fb = fallback; | ||
517 | |||
531 | nvram_read_macaddr(prefix, "et0macaddr", sprom->et0mac, fallback); | 518 | nvram_read_macaddr(prefix, "et0macaddr", sprom->et0mac, fallback); |
532 | nvram_read_u8(prefix, NULL, "et0mdcport", &sprom->et0mdcport, 0, | 519 | nvram_read_u8(prefix, NULL, "et0mdcport", &sprom->et0mdcport, 0, |
533 | fallback); | 520 | fallback); |
@@ -540,6 +527,10 @@ static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, | |||
540 | nvram_read_u8(prefix, NULL, "et1phyaddr", &sprom->et1phyaddr, 0, | 527 | nvram_read_u8(prefix, NULL, "et1phyaddr", &sprom->et1phyaddr, 0, |
541 | fallback); | 528 | fallback); |
542 | 529 | ||
530 | nvram_read_macaddr(prefix, "et2macaddr", sprom->et2mac, fb); | ||
531 | nvram_read_u8(prefix, NULL, "et2mdcport", &sprom->et2mdcport, 0, fb); | ||
532 | nvram_read_u8(prefix, NULL, "et2phyaddr", &sprom->et2phyaddr, 0, fb); | ||
533 | |||
543 | nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback); | 534 | nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback); |
544 | nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback); | 535 | nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback); |
545 | 536 | ||
@@ -580,39 +571,22 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix, | |||
580 | 571 | ||
581 | nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0, fallback); | 572 | nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0, fallback); |
582 | 573 | ||
574 | /* Entries requiring custom functions */ | ||
575 | nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback); | ||
576 | if (sprom->revision >= 3) | ||
577 | nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time, | ||
578 | &sprom->leddc_off_time, fallback); | ||
579 | |||
583 | switch (sprom->revision) { | 580 | switch (sprom->revision) { |
584 | case 1: | ||
585 | bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); | ||
586 | break; | ||
587 | case 2: | ||
588 | bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); | ||
589 | break; | ||
590 | case 3: | ||
591 | bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); | ||
592 | bcm47xx_fill_sprom_r3(sprom, prefix, fallback); | ||
593 | break; | ||
594 | case 4: | 581 | case 4: |
595 | case 5: | 582 | case 5: |
596 | bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); | ||
597 | bcm47xx_fill_sprom_r4589(sprom, prefix, fallback); | ||
598 | bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); | 583 | bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); |
599 | bcm47xx_fill_sprom_path_r45(sprom, prefix, fallback); | 584 | bcm47xx_fill_sprom_path_r45(sprom, prefix, fallback); |
600 | break; | 585 | break; |
601 | case 8: | 586 | case 8: |
602 | bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); | ||
603 | bcm47xx_fill_sprom_r4589(sprom, prefix, fallback); | ||
604 | bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); | ||
605 | break; | ||
606 | case 9: | 587 | case 9: |
607 | bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); | ||
608 | bcm47xx_fill_sprom_r4589(sprom, prefix, fallback); | ||
609 | bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); | 588 | bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); |
610 | break; | 589 | break; |
611 | default: | ||
612 | pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n", | ||
613 | sprom->revision); | ||
614 | sprom->revision = 1; | ||
615 | bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); | ||
616 | } | 590 | } |
617 | 591 | ||
618 | bcm47xx_sprom_fill_auto(sprom, prefix, fallback); | 592 | bcm47xx_sprom_fill_auto(sprom, prefix, fallback); |
@@ -631,19 +605,6 @@ void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, | |||
631 | } | 605 | } |
632 | #endif | 606 | #endif |
633 | 607 | ||
634 | #ifdef CONFIG_BCM47XX_BCMA | ||
635 | void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo, | ||
636 | const char *prefix) | ||
637 | { | ||
638 | nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0, | ||
639 | true); | ||
640 | if (!boardinfo->vendor) | ||
641 | boardinfo->vendor = SSB_BOARDVENDOR_BCM; | ||
642 | |||
643 | nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true); | ||
644 | } | ||
645 | #endif | ||
646 | |||
647 | #if defined(CONFIG_BCM47XX_SSB) | 608 | #if defined(CONFIG_BCM47XX_SSB) |
648 | static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) | 609 | static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) |
649 | { | 610 | { |
@@ -698,33 +659,46 @@ static void bcm47xx_sprom_apply_prefix_alias(char *prefix, size_t prefix_size) | |||
698 | 659 | ||
699 | static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) | 660 | static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) |
700 | { | 661 | { |
701 | char prefix[10]; | 662 | struct bcma_boardinfo *binfo = &bus->boardinfo; |
702 | struct bcma_device *core; | 663 | struct bcma_device *core; |
664 | char buf[10]; | ||
665 | char *prefix; | ||
666 | bool fallback = false; | ||
703 | 667 | ||
704 | switch (bus->hosttype) { | 668 | switch (bus->hosttype) { |
705 | case BCMA_HOSTTYPE_PCI: | 669 | case BCMA_HOSTTYPE_PCI: |
706 | memset(out, 0, sizeof(struct ssb_sprom)); | 670 | memset(out, 0, sizeof(struct ssb_sprom)); |
707 | snprintf(prefix, sizeof(prefix), "pci/%u/%u/", | 671 | snprintf(buf, sizeof(buf), "pci/%u/%u/", |
708 | bus->host_pci->bus->number + 1, | 672 | bus->host_pci->bus->number + 1, |
709 | PCI_SLOT(bus->host_pci->devfn)); | 673 | PCI_SLOT(bus->host_pci->devfn)); |
710 | bcm47xx_sprom_apply_prefix_alias(prefix, sizeof(prefix)); | 674 | bcm47xx_sprom_apply_prefix_alias(buf, sizeof(buf)); |
711 | bcm47xx_fill_sprom(out, prefix, false); | 675 | prefix = buf; |
712 | return 0; | 676 | break; |
713 | case BCMA_HOSTTYPE_SOC: | 677 | case BCMA_HOSTTYPE_SOC: |
714 | memset(out, 0, sizeof(struct ssb_sprom)); | 678 | memset(out, 0, sizeof(struct ssb_sprom)); |
715 | core = bcma_find_core(bus, BCMA_CORE_80211); | 679 | core = bcma_find_core(bus, BCMA_CORE_80211); |
716 | if (core) { | 680 | if (core) { |
717 | snprintf(prefix, sizeof(prefix), "sb/%u/", | 681 | snprintf(buf, sizeof(buf), "sb/%u/", |
718 | core->core_index); | 682 | core->core_index); |
719 | bcm47xx_fill_sprom(out, prefix, true); | 683 | prefix = buf; |
684 | fallback = true; | ||
720 | } else { | 685 | } else { |
721 | bcm47xx_fill_sprom(out, NULL, false); | 686 | prefix = NULL; |
722 | } | 687 | } |
723 | return 0; | 688 | break; |
724 | default: | 689 | default: |
725 | pr_warn("Unable to fill SPROM for given bustype.\n"); | 690 | pr_warn("Unable to fill SPROM for given bustype.\n"); |
726 | return -EINVAL; | 691 | return -EINVAL; |
727 | } | 692 | } |
693 | |||
694 | nvram_read_u16(prefix, NULL, "boardvendor", &binfo->vendor, 0, true); | ||
695 | if (!binfo->vendor) | ||
696 | binfo->vendor = SSB_BOARDVENDOR_BCM; | ||
697 | nvram_read_u16(prefix, NULL, "boardtype", &binfo->type, 0, true); | ||
698 | |||
699 | bcm47xx_fill_sprom(out, prefix, fallback); | ||
700 | |||
701 | return 0; | ||
728 | } | 702 | } |
729 | #endif | 703 | #endif |
730 | 704 | ||
diff --git a/arch/mips/bmips/Kconfig b/arch/mips/bmips/Kconfig index f35c84c019df..e2c4fd682c74 100644 --- a/arch/mips/bmips/Kconfig +++ b/arch/mips/bmips/Kconfig | |||
@@ -57,6 +57,10 @@ config DT_BCM97425SVMB | |||
57 | bool "BCM97425SVMB" | 57 | bool "BCM97425SVMB" |
58 | select BUILTIN_DTB | 58 | select BUILTIN_DTB |
59 | 59 | ||
60 | config DT_BCM97435SVMB | ||
61 | bool "BCM97435SVMB" | ||
62 | select BUILTIN_DTB | ||
63 | |||
60 | endchoice | 64 | endchoice |
61 | 65 | ||
62 | endif | 66 | endif |
diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c index fae800e8b1e1..526ec2789bb9 100644 --- a/arch/mips/bmips/setup.c +++ b/arch/mips/bmips/setup.c | |||
@@ -149,6 +149,8 @@ void __init plat_mem_setup(void) | |||
149 | /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ | 149 | /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ |
150 | if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) | 150 | if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) |
151 | dtb = phys_to_virt(fw_arg2); | 151 | dtb = phys_to_virt(fw_arg2); |
152 | else if (fw_arg0 == -2) /* UHI interface */ | ||
153 | dtb = (void *)fw_arg1; | ||
152 | else if (__dtb_start != __dtb_end) | 154 | else if (__dtb_start != __dtb_end) |
153 | dtb = (void *)__dtb_start; | 155 | dtb = (void *)__dtb_start; |
154 | else | 156 | else |
diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S index 409cb483a9ff..c580e853b9fb 100644 --- a/arch/mips/boot/compressed/head.S +++ b/arch/mips/boot/compressed/head.S | |||
@@ -25,6 +25,22 @@ start: | |||
25 | move s2, a2 | 25 | move s2, a2 |
26 | move s3, a3 | 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 | /* Clear BSS */ | 44 | /* Clear BSS */ |
29 | PTR_LA a0, _edata | 45 | PTR_LA a0, _edata |
30 | PTR_LA a2, _end | 46 | PTR_LA a2, _end |
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script index 5a33409c7f63..2ed08fbef8e7 100644 --- a/arch/mips/boot/compressed/ld.script +++ b/arch/mips/boot/compressed/ld.script | |||
@@ -29,8 +29,12 @@ SECTIONS | |||
29 | *(.image) | 29 | *(.image) |
30 | __image_end = .; | 30 | __image_end = .; |
31 | CONSTRUCTORS | 31 | CONSTRUCTORS |
32 | . = ALIGN(16); | ||
32 | } | 33 | } |
33 | . = ALIGN(16); | 34 | __appended_dtb = .; |
35 | /* leave space for appended DTB */ | ||
36 | . += 0x100000; | ||
37 | |||
34 | _edata = .; | 38 | _edata = .; |
35 | /* End of data section */ | 39 | /* End of data section */ |
36 | 40 | ||
diff --git a/arch/mips/boot/compressed/uart-16550.c b/arch/mips/boot/compressed/uart-16550.c index 237494b7a21a..408799a839b4 100644 --- a/arch/mips/boot/compressed/uart-16550.c +++ b/arch/mips/boot/compressed/uart-16550.c | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | #include <asm/addrspace.h> | 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 | #define UART_BASE 0x1fd003f8 | 11 | #define UART_BASE 0x1fd003f8 |
12 | #define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset)) | 12 | #define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset)) |
13 | #endif | 13 | #endif |
diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile index 5d95e4bd709a..778a34028c1b 100644 --- a/arch/mips/boot/dts/Makefile +++ b/arch/mips/boot/dts/Makefile | |||
@@ -1,8 +1,10 @@ | |||
1 | dts-dirs += brcm | 1 | dts-dirs += brcm |
2 | dts-dirs += cavium-octeon | 2 | dts-dirs += cavium-octeon |
3 | dts-dirs += ingenic | ||
3 | dts-dirs += lantiq | 4 | dts-dirs += lantiq |
4 | dts-dirs += mti | 5 | dts-dirs += mti |
5 | dts-dirs += netlogic | 6 | dts-dirs += netlogic |
7 | dts-dirs += qca | ||
6 | dts-dirs += ralink | 8 | dts-dirs += ralink |
7 | 9 | ||
8 | obj-y := $(addsuffix /, $(dts-dirs)) | 10 | obj-y := $(addsuffix /, $(dts-dirs)) |
diff --git a/arch/mips/boot/dts/brcm/Makefile b/arch/mips/boot/dts/brcm/Makefile index 1c8353bfe003..eabeb603e805 100644 --- a/arch/mips/boot/dts/brcm/Makefile +++ b/arch/mips/boot/dts/brcm/Makefile | |||
@@ -9,6 +9,20 @@ dtb-$(CONFIG_DT_BCM97360SVMB) += bcm97360svmb.dtb | |||
9 | dtb-$(CONFIG_DT_BCM97362SVMB) += bcm97362svmb.dtb | 9 | dtb-$(CONFIG_DT_BCM97362SVMB) += bcm97362svmb.dtb |
10 | dtb-$(CONFIG_DT_BCM97420C) += bcm97420c.dtb | 10 | dtb-$(CONFIG_DT_BCM97420C) += bcm97420c.dtb |
11 | dtb-$(CONFIG_DT_BCM97425SVMB) += bcm97425svmb.dtb | 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 | obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) | 27 | obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) |
14 | 28 | ||
diff --git a/arch/mips/boot/dts/brcm/bcm7346.dtsi b/arch/mips/boot/dts/brcm/bcm7346.dtsi index 1f30728a3177..d817bb46b934 100644 --- a/arch/mips/boot/dts/brcm/bcm7346.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7346.dtsi | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | aliases { | 25 | aliases { |
26 | uart0 = &uart0; | 26 | uart0 = &uart0; |
27 | uart1 = &uart1; | ||
28 | uart2 = &uart2; | ||
27 | }; | 29 | }; |
28 | 30 | ||
29 | cpu_intc: cpu_intc { | 31 | cpu_intc: cpu_intc { |
@@ -118,6 +120,30 @@ | |||
118 | status = "disabled"; | 120 | status = "disabled"; |
119 | }; | 121 | }; |
120 | 122 | ||
123 | uart1: serial@406940 { | ||
124 | compatible = "ns16550a"; | ||
125 | reg = <0x406940 0x20>; | ||
126 | reg-io-width = <0x4>; | ||
127 | reg-shift = <0x2>; | ||
128 | native-endian; | ||
129 | interrupt-parent = <&periph_intc>; | ||
130 | interrupts = <65>; | ||
131 | clocks = <&uart_clk>; | ||
132 | status = "disabled"; | ||
133 | }; | ||
134 | |||
135 | uart2: serial@406980 { | ||
136 | compatible = "ns16550a"; | ||
137 | reg = <0x406980 0x20>; | ||
138 | reg-io-width = <0x4>; | ||
139 | reg-shift = <0x2>; | ||
140 | native-endian; | ||
141 | interrupt-parent = <&periph_intc>; | ||
142 | interrupts = <66>; | ||
143 | clocks = <&uart_clk>; | ||
144 | status = "disabled"; | ||
145 | }; | ||
146 | |||
121 | enet0: ethernet@430000 { | 147 | enet0: ethernet@430000 { |
122 | phy-mode = "internal"; | 148 | phy-mode = "internal"; |
123 | phy-handle = <&phy1>; | 149 | phy-handle = <&phy1>; |
diff --git a/arch/mips/boot/dts/brcm/bcm7358.dtsi b/arch/mips/boot/dts/brcm/bcm7358.dtsi index 2c2aa9368f76..277a90adc1a7 100644 --- a/arch/mips/boot/dts/brcm/bcm7358.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7358.dtsi | |||
@@ -18,6 +18,8 @@ | |||
18 | 18 | ||
19 | aliases { | 19 | aliases { |
20 | uart0 = &uart0; | 20 | uart0 = &uart0; |
21 | uart1 = &uart1; | ||
22 | uart2 = &uart2; | ||
21 | }; | 23 | }; |
22 | 24 | ||
23 | cpu_intc: cpu_intc { | 25 | cpu_intc: cpu_intc { |
@@ -112,6 +114,30 @@ | |||
112 | status = "disabled"; | 114 | status = "disabled"; |
113 | }; | 115 | }; |
114 | 116 | ||
117 | uart1: serial@406840 { | ||
118 | compatible = "ns16550a"; | ||
119 | reg = <0x406840 0x20>; | ||
120 | reg-io-width = <0x4>; | ||
121 | reg-shift = <0x2>; | ||
122 | native-endian; | ||
123 | interrupt-parent = <&periph_intc>; | ||
124 | interrupts = <62>; | ||
125 | clocks = <&uart_clk>; | ||
126 | status = "disabled"; | ||
127 | }; | ||
128 | |||
129 | uart2: serial@406880 { | ||
130 | compatible = "ns16550a"; | ||
131 | reg = <0x406880 0x20>; | ||
132 | reg-io-width = <0x4>; | ||
133 | reg-shift = <0x2>; | ||
134 | native-endian; | ||
135 | interrupt-parent = <&periph_intc>; | ||
136 | interrupts = <63>; | ||
137 | clocks = <&uart_clk>; | ||
138 | status = "disabled"; | ||
139 | }; | ||
140 | |||
115 | enet0: ethernet@430000 { | 141 | enet0: ethernet@430000 { |
116 | phy-mode = "internal"; | 142 | phy-mode = "internal"; |
117 | phy-handle = <&phy1>; | 143 | phy-handle = <&phy1>; |
diff --git a/arch/mips/boot/dts/brcm/bcm7360.dtsi b/arch/mips/boot/dts/brcm/bcm7360.dtsi index f23b0aed276f..9e1e571ba346 100644 --- a/arch/mips/boot/dts/brcm/bcm7360.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7360.dtsi | |||
@@ -18,6 +18,8 @@ | |||
18 | 18 | ||
19 | aliases { | 19 | aliases { |
20 | uart0 = &uart0; | 20 | uart0 = &uart0; |
21 | uart1 = &uart1; | ||
22 | uart2 = &uart2; | ||
21 | }; | 23 | }; |
22 | 24 | ||
23 | cpu_intc: cpu_intc { | 25 | cpu_intc: cpu_intc { |
@@ -112,6 +114,30 @@ | |||
112 | status = "disabled"; | 114 | status = "disabled"; |
113 | }; | 115 | }; |
114 | 116 | ||
117 | uart1: serial@406840 { | ||
118 | compatible = "ns16550a"; | ||
119 | reg = <0x406840 0x20>; | ||
120 | reg-io-width = <0x4>; | ||
121 | reg-shift = <0x2>; | ||
122 | native-endian; | ||
123 | interrupt-parent = <&periph_intc>; | ||
124 | interrupts = <62>; | ||
125 | clocks = <&uart_clk>; | ||
126 | status = "disabled"; | ||
127 | }; | ||
128 | |||
129 | uart2: serial@406880 { | ||
130 | compatible = "ns16550a"; | ||
131 | reg = <0x406880 0x20>; | ||
132 | reg-io-width = <0x4>; | ||
133 | reg-shift = <0x2>; | ||
134 | native-endian; | ||
135 | interrupt-parent = <&periph_intc>; | ||
136 | interrupts = <63>; | ||
137 | clocks = <&uart_clk>; | ||
138 | status = "disabled"; | ||
139 | }; | ||
140 | |||
115 | enet0: ethernet@430000 { | 141 | enet0: ethernet@430000 { |
116 | phy-mode = "internal"; | 142 | phy-mode = "internal"; |
117 | phy-handle = <&phy1>; | 143 | phy-handle = <&phy1>; |
diff --git a/arch/mips/boot/dts/brcm/bcm7362.dtsi b/arch/mips/boot/dts/brcm/bcm7362.dtsi index da99db665bbc..6e65db86fc61 100644 --- a/arch/mips/boot/dts/brcm/bcm7362.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7362.dtsi | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | aliases { | 25 | aliases { |
26 | uart0 = &uart0; | 26 | uart0 = &uart0; |
27 | uart1 = &uart1; | ||
28 | uart2 = &uart2; | ||
27 | }; | 29 | }; |
28 | 30 | ||
29 | cpu_intc: cpu_intc { | 31 | cpu_intc: cpu_intc { |
@@ -118,6 +120,30 @@ | |||
118 | status = "disabled"; | 120 | status = "disabled"; |
119 | }; | 121 | }; |
120 | 122 | ||
123 | uart1: serial@406840 { | ||
124 | compatible = "ns16550a"; | ||
125 | reg = <0x406840 0x20>; | ||
126 | reg-io-width = <0x4>; | ||
127 | reg-shift = <0x2>; | ||
128 | native-endian; | ||
129 | interrupt-parent = <&periph_intc>; | ||
130 | interrupts = <62>; | ||
131 | clocks = <&uart_clk>; | ||
132 | status = "disabled"; | ||
133 | }; | ||
134 | |||
135 | uart2: serial@406880 { | ||
136 | compatible = "ns16550a"; | ||
137 | reg = <0x406880 0x20>; | ||
138 | reg-io-width = <0x4>; | ||
139 | reg-shift = <0x2>; | ||
140 | native-endian; | ||
141 | interrupt-parent = <&periph_intc>; | ||
142 | interrupts = <63>; | ||
143 | clocks = <&uart_clk>; | ||
144 | status = "disabled"; | ||
145 | }; | ||
146 | |||
121 | enet0: ethernet@430000 { | 147 | enet0: ethernet@430000 { |
122 | phy-mode = "internal"; | 148 | phy-mode = "internal"; |
123 | phy-handle = <&phy1>; | 149 | phy-handle = <&phy1>; |
diff --git a/arch/mips/boot/dts/brcm/bcm7435.dtsi b/arch/mips/boot/dts/brcm/bcm7435.dtsi new file mode 100644 index 000000000000..8b9432cc062b --- /dev/null +++ b/arch/mips/boot/dts/brcm/bcm7435.dtsi | |||
@@ -0,0 +1,239 @@ | |||
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 | }; | ||
diff --git a/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts b/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts index 70f196d89d26..3fe0445b9d37 100644 --- a/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts +++ b/arch/mips/boot/dts/brcm/bcm97346dbsmb.dts | |||
@@ -21,6 +21,14 @@ | |||
21 | status = "okay"; | 21 | status = "okay"; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | &uart1 { | ||
25 | status = "okay"; | ||
26 | }; | ||
27 | |||
28 | &uart2 { | ||
29 | status = "okay"; | ||
30 | }; | ||
31 | |||
24 | &enet0 { | 32 | &enet0 { |
25 | status = "okay"; | 33 | status = "okay"; |
26 | }; | 34 | }; |
diff --git a/arch/mips/boot/dts/brcm/bcm97358svmb.dts b/arch/mips/boot/dts/brcm/bcm97358svmb.dts index d18e6d947739..a8dc01e30313 100644 --- a/arch/mips/boot/dts/brcm/bcm97358svmb.dts +++ b/arch/mips/boot/dts/brcm/bcm97358svmb.dts | |||
@@ -21,6 +21,14 @@ | |||
21 | status = "okay"; | 21 | status = "okay"; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | &uart1 { | ||
25 | status = "okay"; | ||
26 | }; | ||
27 | |||
28 | &uart2 { | ||
29 | status = "okay"; | ||
30 | }; | ||
31 | |||
24 | &enet0 { | 32 | &enet0 { |
25 | status = "okay"; | 33 | status = "okay"; |
26 | }; | 34 | }; |
diff --git a/arch/mips/boot/dts/brcm/bcm97360svmb.dts b/arch/mips/boot/dts/brcm/bcm97360svmb.dts index 4fe515500102..eee8b0e32681 100644 --- a/arch/mips/boot/dts/brcm/bcm97360svmb.dts +++ b/arch/mips/boot/dts/brcm/bcm97360svmb.dts | |||
@@ -21,6 +21,14 @@ | |||
21 | status = "okay"; | 21 | status = "okay"; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | &uart1 { | ||
25 | status = "okay"; | ||
26 | }; | ||
27 | |||
28 | &uart2 { | ||
29 | status = "okay"; | ||
30 | }; | ||
31 | |||
24 | &enet0 { | 32 | &enet0 { |
25 | status = "okay"; | 33 | status = "okay"; |
26 | }; | 34 | }; |
diff --git a/arch/mips/boot/dts/brcm/bcm97362svmb.dts b/arch/mips/boot/dts/brcm/bcm97362svmb.dts index b7b88e5dc9e7..739c2ef5663b 100644 --- a/arch/mips/boot/dts/brcm/bcm97362svmb.dts +++ b/arch/mips/boot/dts/brcm/bcm97362svmb.dts | |||
@@ -21,6 +21,14 @@ | |||
21 | status = "okay"; | 21 | status = "okay"; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | &uart1 { | ||
25 | status = "okay"; | ||
26 | }; | ||
27 | |||
28 | &uart2 { | ||
29 | status = "okay"; | ||
30 | }; | ||
31 | |||
24 | &enet0 { | 32 | &enet0 { |
25 | status = "okay"; | 33 | status = "okay"; |
26 | }; | 34 | }; |
diff --git a/arch/mips/boot/dts/brcm/bcm97435svmb.dts b/arch/mips/boot/dts/brcm/bcm97435svmb.dts new file mode 100644 index 000000000000..1df088183523 --- /dev/null +++ b/arch/mips/boot/dts/brcm/bcm97435svmb.dts | |||
@@ -0,0 +1,60 @@ | |||
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 | }; | ||
diff --git a/arch/mips/boot/dts/ingenic/Makefile b/arch/mips/boot/dts/ingenic/Makefile new file mode 100644 index 000000000000..f2b864f07850 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/Makefile | |||
@@ -0,0 +1,10 @@ | |||
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 | ||
diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts new file mode 100644 index 000000000000..9fcb9e7d1f57 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/ci20.dts | |||
@@ -0,0 +1,44 @@ | |||
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 | }; | ||
diff --git a/arch/mips/boot/dts/ingenic/jz4740.dtsi b/arch/mips/boot/dts/ingenic/jz4740.dtsi new file mode 100644 index 000000000000..8b2437cd019f --- /dev/null +++ b/arch/mips/boot/dts/ingenic/jz4740.dtsi | |||
@@ -0,0 +1,68 @@ | |||
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 | }; | ||
diff --git a/arch/mips/boot/dts/ingenic/jz4780.dtsi b/arch/mips/boot/dts/ingenic/jz4780.dtsi new file mode 100644 index 000000000000..65389f602733 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/jz4780.dtsi | |||
@@ -0,0 +1,111 @@ | |||
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 | }; | ||
diff --git a/arch/mips/boot/dts/ingenic/qi_lb60.dts b/arch/mips/boot/dts/ingenic/qi_lb60.dts new file mode 100644 index 000000000000..2414d63ae818 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/qi_lb60.dts | |||
@@ -0,0 +1,15 @@ | |||
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 | }; | ||
diff --git a/arch/mips/boot/dts/mti/Makefile b/arch/mips/boot/dts/mti/Makefile index ef1f3dbed033..144d776cc9f2 100644 --- a/arch/mips/boot/dts/mti/Makefile +++ b/arch/mips/boot/dts/mti/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | dtb-$(CONFIG_MIPS_MALTA) += malta.dtb | ||
1 | dtb-$(CONFIG_MIPS_SEAD3) += sead3.dtb | 2 | dtb-$(CONFIG_MIPS_SEAD3) += sead3.dtb |
2 | 3 | ||
3 | obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) | 4 | obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) |
diff --git a/arch/mips/boot/dts/mti/malta.dts b/arch/mips/boot/dts/mti/malta.dts new file mode 100644 index 000000000000..c678115f5b7f --- /dev/null +++ b/arch/mips/boot/dts/mti/malta.dts | |||
@@ -0,0 +1,7 @@ | |||
1 | /dts-v1/; | ||
2 | |||
3 | / { | ||
4 | #address-cells = <1>; | ||
5 | #size-cells = <1>; | ||
6 | compatible = "mti,malta"; | ||
7 | }; | ||
diff --git a/arch/mips/boot/dts/qca/Makefile b/arch/mips/boot/dts/qca/Makefile new file mode 100644 index 000000000000..2d61455d585d --- /dev/null +++ b/arch/mips/boot/dts/qca/Makefile | |||
@@ -0,0 +1,11 @@ | |||
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 | ||
diff --git a/arch/mips/boot/dts/qca/ar9132.dtsi b/arch/mips/boot/dts/qca/ar9132.dtsi new file mode 100644 index 000000000000..4759cff814d1 --- /dev/null +++ b/arch/mips/boot/dts/qca/ar9132.dtsi | |||
@@ -0,0 +1,133 @@ | |||
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 | }; | ||
diff --git a/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts b/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts new file mode 100644 index 000000000000..003015ab34e7 --- /dev/null +++ b/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts | |||
@@ -0,0 +1,112 @@ | |||
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 | }; | ||
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 10f762557b92..d8124a3c5a85 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c | |||
@@ -698,7 +698,9 @@ static void octeon_irq_ciu_gpio_ack(struct irq_data *data) | |||
698 | 698 | ||
699 | static void octeon_irq_handle_trigger(unsigned int irq, struct irq_desc *desc) | 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 | handle_edge_irq(irq, desc); | 704 | handle_edge_irq(irq, desc); |
703 | else | 705 | else |
704 | handle_level_irq(irq, desc); | 706 | handle_level_irq(irq, desc); |
diff --git a/arch/mips/cobalt/mtd.c b/arch/mips/cobalt/mtd.c index 8db7b5d81560..83e1b1093d5f 100644 --- a/arch/mips/cobalt/mtd.c +++ b/arch/mips/cobalt/mtd.c | |||
@@ -57,5 +57,4 @@ static int __init cobalt_mtd_init(void) | |||
57 | 57 | ||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | device_initcall(cobalt_mtd_init); | |
61 | module_init(cobalt_mtd_init); | ||
diff --git a/arch/mips/configs/ci20_defconfig b/arch/mips/configs/ci20_defconfig new file mode 100644 index 000000000000..4e36b6e1869c --- /dev/null +++ b/arch/mips/configs/ci20_defconfig | |||
@@ -0,0 +1,162 @@ | |||
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" | ||
diff --git a/arch/mips/configs/fuloong2e_defconfig b/arch/mips/configs/fuloong2e_defconfig index b2a577ebce0b..a75c65da08b4 100644 --- a/arch/mips/configs/fuloong2e_defconfig +++ b/arch/mips/configs/fuloong2e_defconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | CONFIG_MACH_LOONGSON=y | 1 | CONFIG_MACH_LOONGSON64=y |
2 | CONFIG_64BIT=y | 2 | CONFIG_64BIT=y |
3 | CONFIG_NO_HZ=y | 3 | CONFIG_NO_HZ=y |
4 | CONFIG_HIGH_RES_TIMERS=y | 4 | CONFIG_HIGH_RES_TIMERS=y |
diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig index 0cbc9863c7c8..54cc3853d259 100644 --- a/arch/mips/configs/lemote2f_defconfig +++ b/arch/mips/configs/lemote2f_defconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | CONFIG_MACH_LOONGSON=y | 1 | CONFIG_MACH_LOONGSON64=y |
2 | CONFIG_LEMOTE_MACH2F=y | 2 | CONFIG_LEMOTE_MACH2F=y |
3 | CONFIG_CS5536_MFGPT=y | 3 | CONFIG_CS5536_MFGPT=y |
4 | CONFIG_64BIT=y | 4 | CONFIG_64BIT=y |
diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig index c8442997477b..f8bf915c6d6b 100644 --- a/arch/mips/configs/loongson3_defconfig +++ b/arch/mips/configs/loongson3_defconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | CONFIG_MACH_LOONGSON=y | 1 | CONFIG_MACH_LOONGSON64=y |
2 | CONFIG_SWIOTLB=y | 2 | CONFIG_SWIOTLB=y |
3 | CONFIG_LOONGSON_MACH3X=y | 3 | CONFIG_LOONGSON_MACH3X=y |
4 | CONFIG_CPU_LOONGSON3=y | 4 | CONFIG_CPU_LOONGSON3=y |
diff --git a/arch/mips/configs/ls1b_defconfig b/arch/mips/configs/ls1b_defconfig index 7eb75543ca1a..1b2cc1fb26a1 100644 --- a/arch/mips/configs/ls1b_defconfig +++ b/arch/mips/configs/ls1b_defconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | CONFIG_MACH_LOONGSON1=y | 1 | CONFIG_MACH_LOONGSON32=y |
2 | CONFIG_PREEMPT=y | 2 | CONFIG_PREEMPT=y |
3 | # CONFIG_SECCOMP is not set | 3 | # CONFIG_SECCOMP is not set |
4 | CONFIG_EXPERIMENTAL=y | 4 | CONFIG_EXPERIMENTAL=y |
diff --git a/arch/mips/configs/maltasmvp_defconfig b/arch/mips/configs/maltasmvp_defconfig index f8a32315bb38..ac0eb4daf101 100644 --- a/arch/mips/configs/maltasmvp_defconfig +++ b/arch/mips/configs/maltasmvp_defconfig | |||
@@ -84,15 +84,12 @@ CONFIG_NET_CLS_IND=y | |||
84 | CONFIG_DEVTMPFS=y | 84 | CONFIG_DEVTMPFS=y |
85 | CONFIG_BLK_DEV_LOOP=y | 85 | CONFIG_BLK_DEV_LOOP=y |
86 | CONFIG_BLK_DEV_CRYPTOLOOP=m | 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 | CONFIG_BLK_DEV_SD=y | 87 | CONFIG_BLK_DEV_SD=y |
94 | CONFIG_CHR_DEV_SG=y | 88 | CONFIG_CHR_DEV_SG=y |
95 | # CONFIG_SCSI_LOWLEVEL is not set | 89 | # CONFIG_SCSI_LOWLEVEL is not set |
90 | CONFIG_ATA=y | ||
91 | # CONFIG_SATA_PMP is not set | ||
92 | CONFIG_ATA_PIIX=y | ||
96 | CONFIG_NETDEVICES=y | 93 | CONFIG_NETDEVICES=y |
97 | # CONFIG_NET_VENDOR_3COM is not set | 94 | # CONFIG_NET_VENDOR_3COM is not set |
98 | # CONFIG_NET_VENDOR_ADAPTEC is not set | 95 | # CONFIG_NET_VENDOR_ADAPTEC is not set |
@@ -138,7 +135,6 @@ CONFIG_SERIAL_8250=y | |||
138 | CONFIG_SERIAL_8250_CONSOLE=y | 135 | CONFIG_SERIAL_8250_CONSOLE=y |
139 | CONFIG_HW_RANDOM=y | 136 | CONFIG_HW_RANDOM=y |
140 | # CONFIG_HWMON is not set | 137 | # CONFIG_HWMON is not set |
141 | CONFIG_VIDEO_OUTPUT_CONTROL=m | ||
142 | CONFIG_FB=y | 138 | CONFIG_FB=y |
143 | CONFIG_FIRMWARE_EDID=y | 139 | CONFIG_FIRMWARE_EDID=y |
144 | CONFIG_FB_MATROX=y | 140 | CONFIG_FB_MATROX=y |
@@ -152,7 +148,6 @@ CONFIG_NEW_LEDS=y | |||
152 | CONFIG_LEDS_CLASS=y | 148 | CONFIG_LEDS_CLASS=y |
153 | CONFIG_LEDS_TRIGGERS=y | 149 | CONFIG_LEDS_TRIGGERS=y |
154 | CONFIG_LEDS_TRIGGER_TIMER=y | 150 | CONFIG_LEDS_TRIGGER_TIMER=y |
155 | CONFIG_LEDS_TRIGGER_IDE_DISK=y | ||
156 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 151 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
157 | CONFIG_LEDS_TRIGGER_BACKLIGHT=y | 152 | CONFIG_LEDS_TRIGGER_BACKLIGHT=y |
158 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y | 153 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y |
@@ -160,7 +155,11 @@ CONFIG_RTC_CLASS=y | |||
160 | CONFIG_RTC_DRV_CMOS=y | 155 | CONFIG_RTC_DRV_CMOS=y |
161 | CONFIG_EXT2_FS=y | 156 | CONFIG_EXT2_FS=y |
162 | CONFIG_EXT3_FS=y | 157 | CONFIG_EXT3_FS=y |
163 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 158 | CONFIG_EXT3_FS_POSIX_ACL=y |
159 | CONFIG_EXT3_FS_SECURITY=y | ||
160 | CONFIG_EXT4_FS=y | ||
161 | CONFIG_EXT4_FS_POSIX_ACL=y | ||
162 | CONFIG_EXT4_FS_SECURITY=y | ||
164 | CONFIG_XFS_FS=y | 163 | CONFIG_XFS_FS=y |
165 | CONFIG_XFS_QUOTA=y | 164 | CONFIG_XFS_QUOTA=y |
166 | CONFIG_XFS_POSIX_ACL=y | 165 | CONFIG_XFS_POSIX_ACL=y |
diff --git a/arch/mips/configs/pistachio_defconfig b/arch/mips/configs/pistachio_defconfig index f22e92ee7709..1646cce032c3 100644 --- a/arch/mips/configs/pistachio_defconfig +++ b/arch/mips/configs/pistachio_defconfig | |||
@@ -272,6 +272,7 @@ CONFIG_IIO=y | |||
272 | CONFIG_CC10001_ADC=y | 272 | CONFIG_CC10001_ADC=y |
273 | CONFIG_PWM=y | 273 | CONFIG_PWM=y |
274 | CONFIG_PWM_IMG=y | 274 | CONFIG_PWM_IMG=y |
275 | CONFIG_PHY_PISTACHIO_USB=y | ||
275 | CONFIG_ANDROID=y | 276 | CONFIG_ANDROID=y |
276 | CONFIG_EXT4_FS=y | 277 | CONFIG_EXT4_FS=y |
277 | CONFIG_EXT4_FS_POSIX_ACL=y | 278 | CONFIG_EXT4_FS_POSIX_ACL=y |
diff --git a/arch/mips/configs/qi_lb60_defconfig b/arch/mips/configs/qi_lb60_defconfig index 2b965470c35b..d7bb8cce1068 100644 --- a/arch/mips/configs/qi_lb60_defconfig +++ b/arch/mips/configs/qi_lb60_defconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | CONFIG_MACH_JZ4740=y | 1 | CONFIG_MACH_INGENIC=y |
2 | # CONFIG_COMPACTION is not set | 2 | # CONFIG_COMPACTION is not set |
3 | # CONFIG_CROSS_MEMORY_ATTACH is not set | 3 | # CONFIG_CROSS_MEMORY_ATTACH is not set |
4 | CONFIG_HZ_100=y | 4 | CONFIG_HZ_100=y |
@@ -66,6 +66,7 @@ CONFIG_SERIAL_8250_CONSOLE=y | |||
66 | # CONFIG_SERIAL_8250_DMA is not set | 66 | # CONFIG_SERIAL_8250_DMA is not set |
67 | CONFIG_SERIAL_8250_NR_UARTS=2 | 67 | CONFIG_SERIAL_8250_NR_UARTS=2 |
68 | CONFIG_SERIAL_8250_RUNTIME_UARTS=2 | 68 | CONFIG_SERIAL_8250_RUNTIME_UARTS=2 |
69 | CONFIG_SERIAL_8250_INGENIC=y | ||
69 | # CONFIG_HW_RANDOM is not set | 70 | # CONFIG_HW_RANDOM is not set |
70 | CONFIG_SPI=y | 71 | CONFIG_SPI=y |
71 | CONFIG_SPI_GPIO=y | 72 | CONFIG_SPI_GPIO=y |
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h index 6156ac8c4cfb..76317a70200d 100644 --- a/arch/mips/include/asm/asmmacro.h +++ b/arch/mips/include/asm/asmmacro.h | |||
@@ -211,9 +211,13 @@ | |||
211 | .endm | 211 | .endm |
212 | 212 | ||
213 | #ifdef TOOLCHAIN_SUPPORTS_MSA | 213 | #ifdef TOOLCHAIN_SUPPORTS_MSA |
214 | /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ | ||
215 | #undef fp | ||
216 | |||
214 | .macro _cfcmsa rd, cs | 217 | .macro _cfcmsa rd, cs |
215 | .set push | 218 | .set push |
216 | .set mips32r2 | 219 | .set mips32r2 |
220 | .set fp=64 | ||
217 | .set msa | 221 | .set msa |
218 | cfcmsa \rd, $\cs | 222 | cfcmsa \rd, $\cs |
219 | .set pop | 223 | .set pop |
@@ -222,6 +226,7 @@ | |||
222 | .macro _ctcmsa cd, rs | 226 | .macro _ctcmsa cd, rs |
223 | .set push | 227 | .set push |
224 | .set mips32r2 | 228 | .set mips32r2 |
229 | .set fp=64 | ||
225 | .set msa | 230 | .set msa |
226 | ctcmsa $\cd, \rs | 231 | ctcmsa $\cd, \rs |
227 | .set pop | 232 | .set pop |
@@ -230,6 +235,7 @@ | |||
230 | .macro ld_d wd, off, base | 235 | .macro ld_d wd, off, base |
231 | .set push | 236 | .set push |
232 | .set mips32r2 | 237 | .set mips32r2 |
238 | .set fp=64 | ||
233 | .set msa | 239 | .set msa |
234 | ld.d $w\wd, \off(\base) | 240 | ld.d $w\wd, \off(\base) |
235 | .set pop | 241 | .set pop |
@@ -238,6 +244,7 @@ | |||
238 | .macro st_d wd, off, base | 244 | .macro st_d wd, off, base |
239 | .set push | 245 | .set push |
240 | .set mips32r2 | 246 | .set mips32r2 |
247 | .set fp=64 | ||
241 | .set msa | 248 | .set msa |
242 | st.d $w\wd, \off(\base) | 249 | st.d $w\wd, \off(\base) |
243 | .set pop | 250 | .set pop |
@@ -246,6 +253,7 @@ | |||
246 | .macro copy_u_w ws, n | 253 | .macro copy_u_w ws, n |
247 | .set push | 254 | .set push |
248 | .set mips32r2 | 255 | .set mips32r2 |
256 | .set fp=64 | ||
249 | .set msa | 257 | .set msa |
250 | copy_u.w $1, $w\ws[\n] | 258 | copy_u.w $1, $w\ws[\n] |
251 | .set pop | 259 | .set pop |
@@ -254,6 +262,7 @@ | |||
254 | .macro copy_u_d ws, n | 262 | .macro copy_u_d ws, n |
255 | .set push | 263 | .set push |
256 | .set mips64r2 | 264 | .set mips64r2 |
265 | .set fp=64 | ||
257 | .set msa | 266 | .set msa |
258 | copy_u.d $1, $w\ws[\n] | 267 | copy_u.d $1, $w\ws[\n] |
259 | .set pop | 268 | .set pop |
@@ -262,6 +271,7 @@ | |||
262 | .macro insert_w wd, n | 271 | .macro insert_w wd, n |
263 | .set push | 272 | .set push |
264 | .set mips32r2 | 273 | .set mips32r2 |
274 | .set fp=64 | ||
265 | .set msa | 275 | .set msa |
266 | insert.w $w\wd[\n], $1 | 276 | insert.w $w\wd[\n], $1 |
267 | .set pop | 277 | .set pop |
@@ -270,6 +280,7 @@ | |||
270 | .macro insert_d wd, n | 280 | .macro insert_d wd, n |
271 | .set push | 281 | .set push |
272 | .set mips64r2 | 282 | .set mips64r2 |
283 | .set fp=64 | ||
273 | .set msa | 284 | .set msa |
274 | insert.d $w\wd[\n], $1 | 285 | insert.d $w\wd[\n], $1 |
275 | .set pop | 286 | .set pop |
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index 0cf29bd5dc5c..ce9666cf1499 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h | |||
@@ -469,7 +469,7 @@ static inline int test_and_change_bit(unsigned long nr, | |||
469 | */ | 469 | */ |
470 | static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *addr) | 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 | __clear_bit(nr, addr); | 473 | __clear_bit(nr, addr); |
474 | } | 474 | } |
475 | 475 | ||
diff --git a/arch/mips/include/asm/bmips-spaces.h b/arch/mips/include/asm/bmips-spaces.h new file mode 100644 index 000000000000..eb96541ae67e --- /dev/null +++ b/arch/mips/include/asm/bmips-spaces.h | |||
@@ -0,0 +1,7 @@ | |||
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 */ | ||
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index 5aeaf19c26b0..f25de771f7ed 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h | |||
@@ -108,6 +108,9 @@ | |||
108 | #ifndef cpu_has_llsc | 108 | #ifndef cpu_has_llsc |
109 | #define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC) | 109 | #define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC) |
110 | #endif | 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 | #ifndef kernel_uses_llsc | 114 | #ifndef kernel_uses_llsc |
112 | #define kernel_uses_llsc cpu_has_llsc | 115 | #define kernel_uses_llsc cpu_has_llsc |
113 | #endif | 116 | #endif |
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h index 33f3cab9e689..d41e8e284825 100644 --- a/arch/mips/include/asm/cpu-type.h +++ b/arch/mips/include/asm/cpu-type.h | |||
@@ -32,12 +32,12 @@ static inline int __pure __get_cpu_type(const int cpu_type) | |||
32 | case CPU_4KC: | 32 | case CPU_4KC: |
33 | case CPU_ALCHEMY: | 33 | case CPU_ALCHEMY: |
34 | case CPU_PR4450: | 34 | case CPU_PR4450: |
35 | case CPU_JZRISC: | ||
36 | #endif | 35 | #endif |
37 | 36 | ||
38 | #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \ | 37 | #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \ |
39 | defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) | 38 | defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) |
40 | case CPU_4KEC: | 39 | case CPU_4KEC: |
40 | case CPU_JZRISC: | ||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2 | 43 | #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2 |
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index e3adca1d0b99..e46e40602af3 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h | |||
@@ -42,7 +42,9 @@ | |||
42 | #define PRID_COMP_LEXRA 0x0b0000 | 42 | #define PRID_COMP_LEXRA 0x0b0000 |
43 | #define PRID_COMP_NETLOGIC 0x0c0000 | 43 | #define PRID_COMP_NETLOGIC 0x0c0000 |
44 | #define PRID_COMP_CAVIUM 0x0d0000 | 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 | * Assigned Processor ID (implementation) values for bits 15:8 of the PRId | 50 | * Assigned Processor ID (implementation) values for bits 15:8 of the PRId |
@@ -168,7 +170,7 @@ | |||
168 | #define PRID_IMP_CAVIUM_CN70XX 0x9600 | 170 | #define PRID_IMP_CAVIUM_CN70XX 0x9600 |
169 | 171 | ||
170 | /* | 172 | /* |
171 | * These are the PRID's for when 23:16 == PRID_COMP_INGENIC | 173 | * These are the PRID's for when 23:16 == PRID_COMP_INGENIC_* |
172 | */ | 174 | */ |
173 | 175 | ||
174 | #define PRID_IMP_JZRISC 0x0200 | 176 | #define PRID_IMP_JZRISC 0x0200 |
@@ -379,6 +381,7 @@ enum cpu_type_enum { | |||
379 | #define MIPS_CPU_RW_LLB 0x1000000000ull /* LLADDR/LLB writes are allowed */ | 381 | #define MIPS_CPU_RW_LLB 0x1000000000ull /* LLADDR/LLB writes are allowed */ |
380 | #define MIPS_CPU_XPA 0x2000000000ull /* CPU supports Extended Physical Addressing */ | 382 | #define MIPS_CPU_XPA 0x2000000000ull /* CPU supports Extended Physical Addressing */ |
381 | #define MIPS_CPU_CDMM 0x4000000000ull /* CPU has Common Device Memory Map */ | 383 | #define MIPS_CPU_CDMM 0x4000000000ull /* CPU has Common Device Memory Map */ |
384 | #define MIPS_CPU_BP_GHIST 0x8000000000ull /* R12K+ Branch Prediction Global History */ | ||
382 | 385 | ||
383 | /* | 386 | /* |
384 | * CPU ASE encodings | 387 | * CPU ASE encodings |
diff --git a/arch/mips/include/asm/hazards.h b/arch/mips/include/asm/hazards.h index 4087b47ad1cb..7b99efd31074 100644 --- a/arch/mips/include/asm/hazards.h +++ b/arch/mips/include/asm/hazards.h | |||
@@ -31,9 +31,15 @@ | |||
31 | #define __mtc0_tlbw_hazard \ | 31 | #define __mtc0_tlbw_hazard \ |
32 | ___ehb | 32 | ___ehb |
33 | 33 | ||
34 | #define __mtc0_tlbr_hazard \ | ||
35 | ___ehb | ||
36 | |||
34 | #define __tlbw_use_hazard \ | 37 | #define __tlbw_use_hazard \ |
35 | ___ehb | 38 | ___ehb |
36 | 39 | ||
40 | #define __tlb_read_hazard \ | ||
41 | ___ehb | ||
42 | |||
37 | #define __tlb_probe_hazard \ | 43 | #define __tlb_probe_hazard \ |
38 | ___ehb | 44 | ___ehb |
39 | 45 | ||
@@ -80,12 +86,23 @@ do { \ | |||
80 | ___ssnop; \ | 86 | ___ssnop; \ |
81 | ___ehb | 87 | ___ehb |
82 | 88 | ||
89 | #define __mtc0_tlbr_hazard \ | ||
90 | ___ssnop; \ | ||
91 | ___ssnop; \ | ||
92 | ___ehb | ||
93 | |||
83 | #define __tlbw_use_hazard \ | 94 | #define __tlbw_use_hazard \ |
84 | ___ssnop; \ | 95 | ___ssnop; \ |
85 | ___ssnop; \ | 96 | ___ssnop; \ |
86 | ___ssnop; \ | 97 | ___ssnop; \ |
87 | ___ehb | 98 | ___ehb |
88 | 99 | ||
100 | #define __tlb_read_hazard \ | ||
101 | ___ssnop; \ | ||
102 | ___ssnop; \ | ||
103 | ___ssnop; \ | ||
104 | ___ehb | ||
105 | |||
89 | #define __tlb_probe_hazard \ | 106 | #define __tlb_probe_hazard \ |
90 | ___ssnop; \ | 107 | ___ssnop; \ |
91 | ___ssnop; \ | 108 | ___ssnop; \ |
@@ -147,8 +164,12 @@ do { \ | |||
147 | 164 | ||
148 | #define __mtc0_tlbw_hazard | 165 | #define __mtc0_tlbw_hazard |
149 | 166 | ||
167 | #define __mtc0_tlbr_hazard | ||
168 | |||
150 | #define __tlbw_use_hazard | 169 | #define __tlbw_use_hazard |
151 | 170 | ||
171 | #define __tlb_read_hazard | ||
172 | |||
152 | #define __tlb_probe_hazard | 173 | #define __tlb_probe_hazard |
153 | 174 | ||
154 | #define __irq_enable_hazard | 175 | #define __irq_enable_hazard |
@@ -166,8 +187,12 @@ do { \ | |||
166 | */ | 187 | */ |
167 | #define __mtc0_tlbw_hazard | 188 | #define __mtc0_tlbw_hazard |
168 | 189 | ||
190 | #define __mtc0_tlbr_hazard | ||
191 | |||
169 | #define __tlbw_use_hazard | 192 | #define __tlbw_use_hazard |
170 | 193 | ||
194 | #define __tlb_read_hazard | ||
195 | |||
171 | #define __tlb_probe_hazard | 196 | #define __tlb_probe_hazard |
172 | 197 | ||
173 | #define __irq_enable_hazard | 198 | #define __irq_enable_hazard |
@@ -196,11 +221,20 @@ do { \ | |||
196 | nop; \ | 221 | nop; \ |
197 | nop | 222 | nop |
198 | 223 | ||
224 | #define __mtc0_tlbr_hazard \ | ||
225 | nop; \ | ||
226 | nop | ||
227 | |||
199 | #define __tlbw_use_hazard \ | 228 | #define __tlbw_use_hazard \ |
200 | nop; \ | 229 | nop; \ |
201 | nop; \ | 230 | nop; \ |
202 | nop | 231 | nop |
203 | 232 | ||
233 | #define __tlb_read_hazard \ | ||
234 | nop; \ | ||
235 | nop; \ | ||
236 | nop | ||
237 | |||
204 | #define __tlb_probe_hazard \ | 238 | #define __tlb_probe_hazard \ |
205 | nop; \ | 239 | nop; \ |
206 | nop; \ | 240 | nop; \ |
@@ -267,7 +301,9 @@ do { \ | |||
267 | #define _ssnop ___ssnop | 301 | #define _ssnop ___ssnop |
268 | #define _ehb ___ehb | 302 | #define _ehb ___ehb |
269 | #define mtc0_tlbw_hazard __mtc0_tlbw_hazard | 303 | #define mtc0_tlbw_hazard __mtc0_tlbw_hazard |
304 | #define mtc0_tlbr_hazard __mtc0_tlbr_hazard | ||
270 | #define tlbw_use_hazard __tlbw_use_hazard | 305 | #define tlbw_use_hazard __tlbw_use_hazard |
306 | #define tlb_read_hazard __tlb_read_hazard | ||
271 | #define tlb_probe_hazard __tlb_probe_hazard | 307 | #define tlb_probe_hazard __tlb_probe_hazard |
272 | #define irq_enable_hazard __irq_enable_hazard | 308 | #define irq_enable_hazard __irq_enable_hazard |
273 | #define irq_disable_hazard __irq_disable_hazard | 309 | #define irq_disable_hazard __irq_disable_hazard |
@@ -300,6 +336,14 @@ do { \ | |||
300 | } while (0) | 336 | } while (0) |
301 | 337 | ||
302 | 338 | ||
339 | #define mtc0_tlbr_hazard() \ | ||
340 | do { \ | ||
341 | __asm__ __volatile__( \ | ||
342 | __stringify(__mtc0_tlbr_hazard) \ | ||
343 | ); \ | ||
344 | } while (0) | ||
345 | |||
346 | |||
303 | #define tlbw_use_hazard() \ | 347 | #define tlbw_use_hazard() \ |
304 | do { \ | 348 | do { \ |
305 | __asm__ __volatile__( \ | 349 | __asm__ __volatile__( \ |
@@ -308,6 +352,14 @@ do { \ | |||
308 | } while (0) | 352 | } while (0) |
309 | 353 | ||
310 | 354 | ||
355 | #define tlb_read_hazard() \ | ||
356 | do { \ | ||
357 | __asm__ __volatile__( \ | ||
358 | __stringify(__tlb_read_hazard) \ | ||
359 | ); \ | ||
360 | } while (0) | ||
361 | |||
362 | |||
311 | #define tlb_probe_hazard() \ | 363 | #define tlb_probe_hazard() \ |
312 | do { \ | 364 | do { \ |
313 | __asm__ __volatile__( \ | 365 | __asm__ __volatile__( \ |
diff --git a/arch/mips/include/asm/i8259.h b/arch/mips/include/asm/i8259.h index c7e278447c0a..a7fbcd6ed13c 100644 --- a/arch/mips/include/asm/i8259.h +++ b/arch/mips/include/asm/i8259.h | |||
@@ -41,6 +41,7 @@ extern int i8259A_irq_pending(unsigned int irq); | |||
41 | extern void make_8259A_irq(unsigned int irq); | 41 | extern void make_8259A_irq(unsigned int irq); |
42 | 42 | ||
43 | extern void init_i8259_irqs(void); | 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 | * Do the traditional i8259 interrupt polling thing. This is for the few | 47 | * Do the traditional i8259 interrupt polling thing. This is for the few |
diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h index d60cc68fa31e..e7b138b4b3d3 100644 --- a/arch/mips/include/asm/irqflags.h +++ b/arch/mips/include/asm/irqflags.h | |||
@@ -60,7 +60,7 @@ static inline void arch_local_irq_restore(unsigned long flags) | |||
60 | " .set push \n" | 60 | " .set push \n" |
61 | " .set noreorder \n" | 61 | " .set noreorder \n" |
62 | " .set noat \n" | 62 | " .set noat \n" |
63 | #if defined(CONFIG_IRQ_CPU) | 63 | #if defined(CONFIG_IRQ_MIPS_CPU) |
64 | /* | 64 | /* |
65 | * Slow, but doesn't suffer from a relatively unlikely race | 65 | * Slow, but doesn't suffer from a relatively unlikely race |
66 | * condition we're having since days 1. | 66 | * condition we're having since days 1. |
@@ -90,7 +90,7 @@ static inline void __arch_local_irq_restore(unsigned long flags) | |||
90 | " .set push \n" | 90 | " .set push \n" |
91 | " .set noreorder \n" | 91 | " .set noreorder \n" |
92 | " .set noat \n" | 92 | " .set noat \n" |
93 | #if defined(CONFIG_IRQ_CPU) | 93 | #if defined(CONFIG_IRQ_MIPS_CPU) |
94 | /* | 94 | /* |
95 | * Slow, but doesn't suffer from a relatively unlikely race | 95 | * Slow, but doesn't suffer from a relatively unlikely race |
96 | * condition we're having since days 1. | 96 | * condition we're having since days 1. |
diff --git a/arch/mips/include/asm/kgdb.h b/arch/mips/include/asm/kgdb.h index e6c0b0e14ccb..69dc0df94a96 100644 --- a/arch/mips/include/asm/kgdb.h +++ b/arch/mips/include/asm/kgdb.h | |||
@@ -33,7 +33,6 @@ | |||
33 | #define CACHE_FLUSH_IS_SAFE 0 | 33 | #define CACHE_FLUSH_IS_SAFE 0 |
34 | 34 | ||
35 | extern void arch_kgdb_breakpoint(void); | 35 | extern void arch_kgdb_breakpoint(void); |
36 | extern int kgdb_early_setup; | ||
37 | extern void *saved_vectors[32]; | 36 | extern void *saved_vectors[32]; |
38 | extern void handle_exception(struct pt_regs *regs); | 37 | extern void handle_exception(struct pt_regs *regs); |
39 | extern void breakinst(void); | 38 | extern void breakinst(void); |
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h index cd41e93bc1d8..aa3800c82332 100644 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h | |||
@@ -157,8 +157,8 @@ | |||
157 | #define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10 | 157 | #define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10 |
158 | #define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14 | 158 | #define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14 |
159 | 159 | ||
160 | #define AR71XX_PLL_DIV_SHIFT 3 | 160 | #define AR71XX_PLL_FB_SHIFT 3 |
161 | #define AR71XX_PLL_DIV_MASK 0x1f | 161 | #define AR71XX_PLL_FB_MASK 0x1f |
162 | #define AR71XX_CPU_DIV_SHIFT 16 | 162 | #define AR71XX_CPU_DIV_SHIFT 16 |
163 | #define AR71XX_CPU_DIV_MASK 0x3 | 163 | #define AR71XX_CPU_DIV_MASK 0x3 |
164 | #define AR71XX_DDR_DIV_SHIFT 18 | 164 | #define AR71XX_DDR_DIV_SHIFT 18 |
@@ -169,8 +169,8 @@ | |||
169 | #define AR724X_PLL_REG_CPU_CONFIG 0x00 | 169 | #define AR724X_PLL_REG_CPU_CONFIG 0x00 |
170 | #define AR724X_PLL_REG_PCIE_CONFIG 0x18 | 170 | #define AR724X_PLL_REG_PCIE_CONFIG 0x18 |
171 | 171 | ||
172 | #define AR724X_PLL_DIV_SHIFT 0 | 172 | #define AR724X_PLL_FB_SHIFT 0 |
173 | #define AR724X_PLL_DIV_MASK 0x3ff | 173 | #define AR724X_PLL_FB_MASK 0x3ff |
174 | #define AR724X_PLL_REF_DIV_SHIFT 10 | 174 | #define AR724X_PLL_REF_DIV_SHIFT 10 |
175 | #define AR724X_PLL_REF_DIV_MASK 0xf | 175 | #define AR724X_PLL_REF_DIV_MASK 0xf |
176 | #define AR724X_AHB_DIV_SHIFT 19 | 176 | #define AR724X_AHB_DIV_SHIFT 19 |
@@ -183,8 +183,8 @@ | |||
183 | #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14 | 183 | #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14 |
184 | #define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18 | 184 | #define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18 |
185 | 185 | ||
186 | #define AR913X_PLL_DIV_SHIFT 0 | 186 | #define AR913X_PLL_FB_SHIFT 0 |
187 | #define AR913X_PLL_DIV_MASK 0x3ff | 187 | #define AR913X_PLL_FB_MASK 0x3ff |
188 | #define AR913X_DDR_DIV_SHIFT 22 | 188 | #define AR913X_DDR_DIV_SHIFT 22 |
189 | #define AR913X_DDR_DIV_MASK 0x3 | 189 | #define AR913X_DDR_DIV_MASK 0x3 |
190 | #define AR913X_AHB_DIV_SHIFT 19 | 190 | #define AR913X_AHB_DIV_SHIFT 19 |
diff --git a/arch/mips/include/asm/mach-ath79/ath79.h b/arch/mips/include/asm/mach-ath79/ath79.h index 1557934aaca9..4eee221b0cf0 100644 --- a/arch/mips/include/asm/mach-ath79/ath79.h +++ b/arch/mips/include/asm/mach-ath79/ath79.h | |||
@@ -115,7 +115,8 @@ static inline int soc_is_qca955x(void) | |||
115 | return soc_is_qca9556() || soc_is_qca9558(); | 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 | extern void __iomem *ath79_pll_base; | 120 | extern void __iomem *ath79_pll_base; |
120 | extern void __iomem *ath79_reset_base; | 121 | extern void __iomem *ath79_reset_base; |
121 | 122 | ||
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h index 8ed77f618940..1461c10c1c4c 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | |||
@@ -52,10 +52,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix, | |||
52 | void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, | 52 | void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, |
53 | const char *prefix); | 53 | const char *prefix); |
54 | #endif | 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 | void bcm47xx_set_system_type(u16 chip_id); | 56 | void bcm47xx_set_system_type(u16 chip_id); |
61 | 57 | ||
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h index c41d1dce1062..2afb84072ad0 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | |||
@@ -80,6 +80,8 @@ enum bcm47xx_board { | |||
80 | BCM47XX_BOARD_LINKSYS_WRT610NV2, | 80 | BCM47XX_BOARD_LINKSYS_WRT610NV2, |
81 | BCM47XX_BOARD_LINKSYS_WRTSL54GS, | 81 | BCM47XX_BOARD_LINKSYS_WRTSL54GS, |
82 | 82 | ||
83 | BCM47XX_BOARD_LUXUL_XWR_1750_V1, | ||
84 | |||
83 | BCM47XX_BOARD_MICROSOFT_MN700, | 85 | BCM47XX_BOARD_MICROSOFT_MN700, |
84 | 86 | ||
85 | BCM47XX_BOARD_MOTOROLA_WE800G, | 87 | BCM47XX_BOARD_MOTOROLA_WE800G, |
diff --git a/arch/mips/include/asm/mach-bcm63xx/spaces.h b/arch/mips/include/asm/mach-bcm63xx/spaces.h index 61e750fb4653..1410ed0da4df 100644 --- a/arch/mips/include/asm/mach-bcm63xx/spaces.h +++ b/arch/mips/include/asm/mach-bcm63xx/spaces.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #ifndef _ASM_BCM63XX_SPACES_H | 10 | #ifndef _ASM_BCM63XX_SPACES_H |
11 | #define _ASM_BCM63XX_SPACES_H | 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 | #include <asm/mach-generic/spaces.h> | 15 | #include <asm/mach-generic/spaces.h> |
16 | 16 | ||
diff --git a/arch/mips/include/asm/mach-bmips/spaces.h b/arch/mips/include/asm/mach-bmips/spaces.h index 1b05bddc8ec5..c59b28fd9e1d 100644 --- a/arch/mips/include/asm/mach-bmips/spaces.h +++ b/arch/mips/include/asm/mach-bmips/spaces.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #define _ASM_BMIPS_SPACES_H | 11 | #define _ASM_BMIPS_SPACES_H |
12 | 12 | ||
13 | /* Avoid collisions with system base register (SBR) region on BMIPS3300 */ | 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 | #include <asm/mach-generic/spaces.h> | 16 | #include <asm/mach-generic/spaces.h> |
17 | 17 | ||
diff --git a/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h b/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h index bdf045fb00c8..21eae03d752a 100644 --- a/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h | |||
@@ -14,6 +14,13 @@ | |||
14 | 14 | ||
15 | /* Generic ones first. */ | 15 | /* Generic ones first. */ |
16 | #define cpu_has_tlb 1 | 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 | #define cpu_has_tx39_cache 0 | 24 | #define cpu_has_tx39_cache 0 |
18 | #define cpu_has_divec 0 | 25 | #define cpu_has_divec 0 |
19 | #define cpu_has_prefetch 0 | 26 | #define cpu_has_prefetch 0 |
@@ -24,6 +31,7 @@ | |||
24 | #define cpu_has_mips3d 0 | 31 | #define cpu_has_mips3d 0 |
25 | #define cpu_has_smartmips 0 | 32 | #define cpu_has_smartmips 0 |
26 | #define cpu_has_rixi 0 | 33 | #define cpu_has_rixi 0 |
34 | #define cpu_has_xpa 0 | ||
27 | #define cpu_has_vtag_icache 0 | 35 | #define cpu_has_vtag_icache 0 |
28 | #define cpu_has_ic_fills_f_dc 0 | 36 | #define cpu_has_ic_fills_f_dc 0 |
29 | #define cpu_has_pindexed_dcache 0 | 37 | #define cpu_has_pindexed_dcache 0 |
@@ -36,11 +44,18 @@ | |||
36 | #define cpu_has_mips64r1 0 | 44 | #define cpu_has_mips64r1 0 |
37 | #define cpu_has_mips64r2 0 | 45 | #define cpu_has_mips64r2 0 |
38 | #define cpu_has_dsp 0 | 46 | #define cpu_has_dsp 0 |
47 | #define cpu_has_dsp2 0 | ||
39 | #define cpu_has_mipsmt 0 | 48 | #define cpu_has_mipsmt 0 |
40 | #define cpu_has_userlocal 0 | 49 | #define cpu_has_userlocal 0 |
50 | #define cpu_hwrena_impl_bits 0 | ||
51 | #define cpu_has_perf_cntr_intr_bit 0 | ||
52 | #define cpu_has_vz 0 | ||
53 | #define cpu_has_fre 0 | ||
54 | #define cpu_has_cdmm 0 | ||
41 | 55 | ||
42 | /* R3k-specific ones. */ | 56 | /* R3k-specific ones. */ |
43 | #ifdef CONFIG_CPU_R3000 | 57 | #ifdef CONFIG_CPU_R3000 |
58 | #define cpu_has_3kex 1 | ||
44 | #define cpu_has_4kex 0 | 59 | #define cpu_has_4kex 0 |
45 | #define cpu_has_3k_cache 1 | 60 | #define cpu_has_3k_cache 1 |
46 | #define cpu_has_4k_cache 0 | 61 | #define cpu_has_4k_cache 0 |
@@ -63,6 +78,7 @@ | |||
63 | 78 | ||
64 | /* R4k-specific ones. */ | 79 | /* R4k-specific ones. */ |
65 | #ifdef CONFIG_CPU_R4X00 | 80 | #ifdef CONFIG_CPU_R4X00 |
81 | #define cpu_has_3kex 0 | ||
66 | #define cpu_has_4kex 1 | 82 | #define cpu_has_4kex 1 |
67 | #define cpu_has_3k_cache 0 | 83 | #define cpu_has_3k_cache 0 |
68 | #define cpu_has_4k_cache 1 | 84 | #define cpu_has_4k_cache 1 |
diff --git a/arch/mips/include/asm/mach-generic/irq.h b/arch/mips/include/asm/mach-generic/irq.h index 050e18bb1a04..be546a0f65fa 100644 --- a/arch/mips/include/asm/mach-generic/irq.h +++ b/arch/mips/include/asm/mach-generic/irq.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #endif | 18 | #endif |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #ifdef CONFIG_IRQ_CPU | 21 | #ifdef CONFIG_IRQ_MIPS_CPU |
22 | 22 | ||
23 | #ifndef MIPS_CPU_IRQ_BASE | 23 | #ifndef MIPS_CPU_IRQ_BASE |
24 | #ifdef CONFIG_I8259 | 24 | #ifdef CONFIG_I8259 |
@@ -34,7 +34,7 @@ | |||
34 | #endif | 34 | #endif |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #endif /* CONFIG_IRQ_CPU */ | 37 | #endif /* CONFIG_IRQ_MIPS_CPU */ |
38 | 38 | ||
39 | #ifdef CONFIG_MIPS_GIC | 39 | #ifdef CONFIG_MIPS_GIC |
40 | #ifndef MIPS_GIC_IRQ_BASE | 40 | #ifndef MIPS_GIC_IRQ_BASE |
diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h index 9488fa5f8866..afc96ecb9004 100644 --- a/arch/mips/include/asm/mach-generic/spaces.h +++ b/arch/mips/include/asm/mach-generic/spaces.h | |||
@@ -94,7 +94,11 @@ | |||
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | #ifndef FIXADDR_TOP | 96 | #ifndef FIXADDR_TOP |
97 | #ifdef CONFIG_KVM_GUEST | ||
98 | #define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000) | ||
99 | #else | ||
97 | #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000) | 100 | #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000) |
98 | #endif | 101 | #endif |
102 | #endif | ||
99 | 103 | ||
100 | #endif /* __ASM_MACH_GENERIC_SPACES_H */ | 104 | #endif /* __ASM_MACH_GENERIC_SPACES_H */ |
diff --git a/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h index d6111aa2e886..7449794eade6 100644 --- a/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h | |||
@@ -11,47 +11,69 @@ | |||
11 | #include <asm/cpu.h> | 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 | 16 | #define cpu_has_tlb 1 |
17 | #define cpu_has_mips16 0 | 17 | #define cpu_has_tlbinv 0 |
18 | #define cpu_has_divec 0 | 18 | #define cpu_has_segments 0 |
19 | #define cpu_has_vce 0 | 19 | #define cpu_has_eva 0 |
20 | #define cpu_has_cache_cdex_p 0 | 20 | #define cpu_has_htw 0 |
21 | #define cpu_has_cache_cdex_s 0 | 21 | #define cpu_has_rixiex 0 |
22 | #define cpu_has_prefetch 1 | 22 | #define cpu_has_maar 0 |
23 | #define cpu_has_mcheck 0 | 23 | #define cpu_has_rw_llb 0 |
24 | #define cpu_has_ejtag 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 | #define cpu_icache_snoops_remote_store 1 | 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 | 57 | #define cpu_has_mips32r1 0 |
37 | #define cpu_has_64bits 1 | 58 | #define cpu_has_mips32r2 0 |
38 | 59 | #define cpu_has_mips64r1 0 | |
39 | #define cpu_has_4kex 1 | 60 | #define cpu_has_mips64r2 0 |
40 | #define cpu_has_3k_cache 0 | 61 | #define cpu_has_mips32r6 0 |
41 | #define cpu_has_6k_cache 0 | 62 | #define cpu_has_mips64r6 0 |
42 | #define cpu_has_4k_cache 1 | ||
43 | #define cpu_has_8k_cache 0 | ||
44 | #define cpu_has_tx39_cache 0 | ||
45 | 63 | ||
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 | #define cpu_has_inclusive_pcaches 1 | 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 | 75 | #define cpu_dcache_line_size() 32 |
49 | #define cpu_icache_line_size() 64 | 76 | #define cpu_icache_line_size() 64 |
50 | #define cpu_scache_line_size() 128 | 77 | #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 | ||
56 | 78 | ||
57 | #endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */ | 79 | #endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */ |
diff --git a/arch/mips/include/asm/mach-jz4740/clock.h b/arch/mips/include/asm/mach-jz4740/clock.h index 16659cd76d4e..104d2dfe1e36 100644 --- a/arch/mips/include/asm/mach-jz4740/clock.h +++ b/arch/mips/include/asm/mach-jz4740/clock.h | |||
@@ -22,6 +22,9 @@ enum jz4740_wait_mode { | |||
22 | 22 | ||
23 | void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode); | 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 | void jz4740_clock_udc_enable_auto_suspend(void); | 28 | void jz4740_clock_udc_enable_auto_suspend(void); |
26 | void jz4740_clock_udc_disable_auto_suspend(void); | 29 | void jz4740_clock_udc_disable_auto_suspend(void); |
27 | 30 | ||
diff --git a/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h b/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h index a225baaa215d..0933f94a1e69 100644 --- a/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h | |||
@@ -12,8 +12,6 @@ | |||
12 | #define cpu_has_3k_cache 0 | 12 | #define cpu_has_3k_cache 0 |
13 | #define cpu_has_4k_cache 1 | 13 | #define cpu_has_4k_cache 1 |
14 | #define cpu_has_tx39_cache 0 | 14 | #define cpu_has_tx39_cache 0 |
15 | #define cpu_has_fpu 0 | ||
16 | #define cpu_has_32fpr 0 | ||
17 | #define cpu_has_counter 0 | 15 | #define cpu_has_counter 0 |
18 | #define cpu_has_watch 1 | 16 | #define cpu_has_watch 1 |
19 | #define cpu_has_divec 1 | 17 | #define cpu_has_divec 1 |
@@ -34,7 +32,6 @@ | |||
34 | #define cpu_has_ic_fills_f_dc 0 | 32 | #define cpu_has_ic_fills_f_dc 0 |
35 | #define cpu_has_pindexed_dcache 0 | 33 | #define cpu_has_pindexed_dcache 0 |
36 | #define cpu_has_mips32r1 1 | 34 | #define cpu_has_mips32r1 1 |
37 | #define cpu_has_mips32r2 0 | ||
38 | #define cpu_has_mips64r1 0 | 35 | #define cpu_has_mips64r1 0 |
39 | #define cpu_has_mips64r2 0 | 36 | #define cpu_has_mips64r2 0 |
40 | #define cpu_has_dsp 0 | 37 | #define cpu_has_dsp 0 |
diff --git a/arch/mips/include/asm/mach-jz4740/irq.h b/arch/mips/include/asm/mach-jz4740/irq.h index df50736749c1..9b439fc218bd 100644 --- a/arch/mips/include/asm/mach-jz4740/irq.h +++ b/arch/mips/include/asm/mach-jz4740/irq.h | |||
@@ -19,6 +19,12 @@ | |||
19 | #define MIPS_CPU_IRQ_BASE 0 | 19 | #define MIPS_CPU_IRQ_BASE 0 |
20 | #define JZ4740_IRQ_BASE 8 | 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 | /* 1st-level interrupts */ | 28 | /* 1st-level interrupts */ |
23 | #define JZ4740_IRQ(x) (JZ4740_IRQ_BASE + (x)) | 29 | #define JZ4740_IRQ(x) (JZ4740_IRQ_BASE + (x)) |
24 | #define JZ4740_IRQ_I2C JZ4740_IRQ(1) | 30 | #define JZ4740_IRQ_I2C JZ4740_IRQ(1) |
@@ -44,13 +50,15 @@ | |||
44 | #define JZ4740_IRQ_IPU JZ4740_IRQ(29) | 50 | #define JZ4740_IRQ_IPU JZ4740_IRQ(29) |
45 | #define JZ4740_IRQ_LCD JZ4740_IRQ(30) | 51 | #define JZ4740_IRQ_LCD JZ4740_IRQ(30) |
46 | 52 | ||
53 | #define JZ4780_IRQ_TCU2 JZ4740_IRQ(25) | ||
54 | |||
47 | /* 2nd-level interrupts */ | 55 | /* 2nd-level interrupts */ |
48 | #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (x)) | 56 | #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(NR_INTC_IRQS) + (x)) |
49 | 57 | ||
50 | #define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) | 58 | #define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) |
51 | #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x)) | 59 | #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(NR_INTC_IRQS + 16) + (x)) |
52 | 60 | ||
53 | #define JZ4740_IRQ_ADC_BASE JZ4740_IRQ(176) | 61 | #define JZ4740_IRQ_ADC_BASE JZ4740_IRQ(NR_INTC_IRQS + 144) |
54 | 62 | ||
55 | #define NR_IRQS (JZ4740_IRQ_ADC_BASE + 6) | 63 | #define NR_IRQS (JZ4740_IRQ_ADC_BASE + 6) |
56 | 64 | ||
diff --git a/arch/mips/include/asm/mach-jz4740/platform.h b/arch/mips/include/asm/mach-jz4740/platform.h index 069b43a9da6f..32cfbe6a191b 100644 --- a/arch/mips/include/asm/mach-jz4740/platform.h +++ b/arch/mips/include/asm/mach-jz4740/platform.h | |||
@@ -35,6 +35,4 @@ extern struct platform_device jz4740_wdt_device; | |||
35 | extern struct platform_device jz4740_pwm_device; | 35 | extern struct platform_device jz4740_pwm_device; |
36 | extern struct platform_device jz4740_dma_device; | 36 | extern struct platform_device jz4740_dma_device; |
37 | 37 | ||
38 | void jz4740_serial_device_register(void); | ||
39 | |||
40 | #endif | 38 | #endif |
diff --git a/arch/mips/include/asm/mach-loongson/workarounds.h b/arch/mips/include/asm/mach-loongson/workarounds.h deleted file mode 100644 index e180c1422eae..000000000000 --- a/arch/mips/include/asm/mach-loongson/workarounds.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
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 | ||
diff --git a/arch/mips/include/asm/mach-loongson1/cpufreq.h b/arch/mips/include/asm/mach-loongson32/cpufreq.h index e7765ce30bcf..6843fa1a608d 100644 --- a/arch/mips/include/asm/mach-loongson1/cpufreq.h +++ b/arch/mips/include/asm/mach-loongson32/cpufreq.h | |||
@@ -10,8 +10,8 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | 12 | ||
13 | #ifndef __ASM_MACH_LOONGSON1_CPUFREQ_H | 13 | #ifndef __ASM_MACH_LOONGSON32_CPUFREQ_H |
14 | #define __ASM_MACH_LOONGSON1_CPUFREQ_H | 14 | #define __ASM_MACH_LOONGSON32_CPUFREQ_H |
15 | 15 | ||
16 | struct plat_ls1x_cpufreq { | 16 | struct plat_ls1x_cpufreq { |
17 | const char *clk_name; /* CPU clk */ | 17 | const char *clk_name; /* CPU clk */ |
@@ -20,4 +20,4 @@ struct plat_ls1x_cpufreq { | |||
20 | unsigned int min_freq; /* in kHz */ | 20 | unsigned int min_freq; /* in kHz */ |
21 | }; | 21 | }; |
22 | 22 | ||
23 | #endif /* __ASM_MACH_LOONGSON1_CPUFREQ_H */ | 23 | #endif /* __ASM_MACH_LOONGSON32_CPUFREQ_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/irq.h b/arch/mips/include/asm/mach-loongson32/irq.h index 96bfb1c1c73d..0d35b994e8d2 100644 --- a/arch/mips/include/asm/mach-loongson1/irq.h +++ b/arch/mips/include/asm/mach-loongson32/irq.h | |||
@@ -10,8 +10,8 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | 12 | ||
13 | #ifndef __ASM_MACH_LOONGSON1_IRQ_H | 13 | #ifndef __ASM_MACH_LOONGSON32_IRQ_H |
14 | #define __ASM_MACH_LOONGSON1_IRQ_H | 14 | #define __ASM_MACH_LOONGSON32_IRQ_H |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * CPU core Interrupt Numbers | 17 | * CPU core Interrupt Numbers |
@@ -70,4 +70,4 @@ | |||
70 | 70 | ||
71 | #define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS) | 71 | #define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS) |
72 | 72 | ||
73 | #endif /* __ASM_MACH_LOONGSON1_IRQ_H */ | 73 | #endif /* __ASM_MACH_LOONGSON32_IRQ_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/loongson1.h b/arch/mips/include/asm/mach-loongson32/loongson1.h index 20e0c2b155dd..12aa129aad80 100644 --- a/arch/mips/include/asm/mach-loongson1/loongson1.h +++ b/arch/mips/include/asm/mach-loongson32/loongson1.h | |||
@@ -10,8 +10,8 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | 12 | ||
13 | #ifndef __ASM_MACH_LOONGSON1_LOONGSON1_H | 13 | #ifndef __ASM_MACH_LOONGSON32_LOONGSON1_H |
14 | #define __ASM_MACH_LOONGSON1_LOONGSON1_H | 14 | #define __ASM_MACH_LOONGSON32_LOONGSON1_H |
15 | 15 | ||
16 | #define DEFAULT_MEMSIZE 256 /* If no memsize provided */ | 16 | #define DEFAULT_MEMSIZE 256 /* If no memsize provided */ |
17 | 17 | ||
@@ -47,4 +47,4 @@ | |||
47 | #include <regs-pwm.h> | 47 | #include <regs-pwm.h> |
48 | #include <regs-wdt.h> | 48 | #include <regs-wdt.h> |
49 | 49 | ||
50 | #endif /* __ASM_MACH_LOONGSON1_LOONGSON1_H */ | 50 | #endif /* __ASM_MACH_LOONGSON32_LOONGSON1_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/platform.h b/arch/mips/include/asm/mach-loongson32/platform.h index 47de55e0c835..c32f03f3f72c 100644 --- a/arch/mips/include/asm/mach-loongson1/platform.h +++ b/arch/mips/include/asm/mach-loongson32/platform.h | |||
@@ -8,8 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | 10 | ||
11 | #ifndef __ASM_MACH_LOONGSON1_PLATFORM_H | 11 | #ifndef __ASM_MACH_LOONGSON32_PLATFORM_H |
12 | #define __ASM_MACH_LOONGSON1_PLATFORM_H | 12 | #define __ASM_MACH_LOONGSON32_PLATFORM_H |
13 | 13 | ||
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | 15 | ||
@@ -23,4 +23,4 @@ extern struct platform_device ls1x_rtc_pdev; | |||
23 | extern void __init ls1x_clk_init(void); | 23 | extern void __init ls1x_clk_init(void); |
24 | extern void __init ls1x_serial_setup(struct platform_device *pdev); | 24 | extern void __init ls1x_serial_setup(struct platform_device *pdev); |
25 | 25 | ||
26 | #endif /* __ASM_MACH_LOONGSON1_PLATFORM_H */ | 26 | #endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/prom.h b/arch/mips/include/asm/mach-loongson32/prom.h index 34859a4d4ac4..a08503c0ba20 100644 --- a/arch/mips/include/asm/mach-loongson1/prom.h +++ b/arch/mips/include/asm/mach-loongson32/prom.h | |||
@@ -7,8 +7,8 @@ | |||
7 | * option) any later version. | 7 | * option) any later version. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifndef __ASM_MACH_LOONGSON1_PROM_H | 10 | #ifndef __ASM_MACH_LOONGSON32_PROM_H |
11 | #define __ASM_MACH_LOONGSON1_PROM_H | 11 | #define __ASM_MACH_LOONGSON32_PROM_H |
12 | 12 | ||
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
@@ -21,4 +21,4 @@ extern unsigned long memsize, highmemsize; | |||
21 | extern char *prom_getenv(char *name); | 21 | extern char *prom_getenv(char *name); |
22 | extern void __init prom_init_cmdline(void); | 22 | extern void __init prom_init_cmdline(void); |
23 | 23 | ||
24 | #endif /* __ASM_MACH_LOONGSON1_PROM_H */ | 24 | #endif /* __ASM_MACH_LOONGSON32_PROM_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/regs-clk.h b/arch/mips/include/asm/mach-loongson32/regs-clk.h index ee2445b10fc3..1f5a715ac841 100644 --- a/arch/mips/include/asm/mach-loongson1/regs-clk.h +++ b/arch/mips/include/asm/mach-loongson32/regs-clk.h | |||
@@ -9,8 +9,8 @@ | |||
9 | * option) any later version. | 9 | * option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifndef __ASM_MACH_LOONGSON1_REGS_CLK_H | 12 | #ifndef __ASM_MACH_LOONGSON32_REGS_CLK_H |
13 | #define __ASM_MACH_LOONGSON1_REGS_CLK_H | 13 | #define __ASM_MACH_LOONGSON32_REGS_CLK_H |
14 | 14 | ||
15 | #define LS1X_CLK_REG(x) \ | 15 | #define LS1X_CLK_REG(x) \ |
16 | ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x))) | 16 | ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x))) |
@@ -48,4 +48,4 @@ | |||
48 | #define BYPASS_DDR_WIDTH 1 | 48 | #define BYPASS_DDR_WIDTH 1 |
49 | #define BYPASS_CPU_WIDTH 1 | 49 | #define BYPASS_CPU_WIDTH 1 |
50 | 50 | ||
51 | #endif /* __ASM_MACH_LOONGSON1_REGS_CLK_H */ | 51 | #endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/regs-mux.h b/arch/mips/include/asm/mach-loongson32/regs-mux.h index fb1e36efaa19..8302d92f2da2 100644 --- a/arch/mips/include/asm/mach-loongson1/regs-mux.h +++ b/arch/mips/include/asm/mach-loongson32/regs-mux.h | |||
@@ -9,8 +9,8 @@ | |||
9 | * option) any later version. | 9 | * option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifndef __ASM_MACH_LOONGSON1_REGS_MUX_H | 12 | #ifndef __ASM_MACH_LOONGSON32_REGS_MUX_H |
13 | #define __ASM_MACH_LOONGSON1_REGS_MUX_H | 13 | #define __ASM_MACH_LOONGSON32_REGS_MUX_H |
14 | 14 | ||
15 | #define LS1X_MUX_REG(x) \ | 15 | #define LS1X_MUX_REG(x) \ |
16 | ((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x))) | 16 | ((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x))) |
@@ -64,4 +64,4 @@ | |||
64 | #define GMAC1_USE_PWM23 (0x1 << 1) | 64 | #define GMAC1_USE_PWM23 (0x1 << 1) |
65 | #define GMAC0_USE_PWM01 0x1 | 65 | #define GMAC0_USE_PWM01 0x1 |
66 | 66 | ||
67 | #endif /* __ASM_MACH_LOONGSON1_REGS_MUX_H */ | 67 | #endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/regs-pwm.h b/arch/mips/include/asm/mach-loongson32/regs-pwm.h index 99f2bcc586f0..69f174ed13a4 100644 --- a/arch/mips/include/asm/mach-loongson1/regs-pwm.h +++ b/arch/mips/include/asm/mach-loongson32/regs-pwm.h | |||
@@ -9,8 +9,8 @@ | |||
9 | * option) any later version. | 9 | * option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifndef __ASM_MACH_LOONGSON1_REGS_PWM_H | 12 | #ifndef __ASM_MACH_LOONGSON32_REGS_PWM_H |
13 | #define __ASM_MACH_LOONGSON1_REGS_PWM_H | 13 | #define __ASM_MACH_LOONGSON32_REGS_PWM_H |
14 | 14 | ||
15 | /* Loongson 1 PWM Timer Register Definitions */ | 15 | /* Loongson 1 PWM Timer Register Definitions */ |
16 | #define PWM_CNT 0x0 | 16 | #define PWM_CNT 0x0 |
@@ -26,4 +26,4 @@ | |||
26 | #define PWM_OE (0x1 << 3) | 26 | #define PWM_OE (0x1 << 3) |
27 | #define CNT_EN 0x1 | 27 | #define CNT_EN 0x1 |
28 | 28 | ||
29 | #endif /* __ASM_MACH_LOONGSON1_REGS_PWM_H */ | 29 | #endif /* __ASM_MACH_LOONGSON32_REGS_PWM_H */ |
diff --git a/arch/mips/include/asm/mach-loongson1/regs-wdt.h b/arch/mips/include/asm/mach-loongson32/regs-wdt.h index c39ee982ad3b..6644ab6d3391 100644 --- a/arch/mips/include/asm/mach-loongson1/regs-wdt.h +++ b/arch/mips/include/asm/mach-loongson32/regs-wdt.h | |||
@@ -9,11 +9,11 @@ | |||
9 | * option) any later version. | 9 | * option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifndef __ASM_MACH_LOONGSON1_REGS_WDT_H | 12 | #ifndef __ASM_MACH_LOONGSON32_REGS_WDT_H |
13 | #define __ASM_MACH_LOONGSON1_REGS_WDT_H | 13 | #define __ASM_MACH_LOONGSON32_REGS_WDT_H |
14 | 14 | ||
15 | #define WDT_EN 0x0 | 15 | #define WDT_EN 0x0 |
16 | #define WDT_TIMER 0x4 | 16 | #define WDT_TIMER 0x4 |
17 | #define WDT_SET 0x8 | 17 | #define WDT_SET 0x8 |
18 | 18 | ||
19 | #endif /* __ASM_MACH_LOONGSON1_REGS_WDT_H */ | 19 | #endif /* __ASM_MACH_LOONGSON32_REGS_WDT_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h index fa802926523f..d3f3258b7cd4 100644 --- a/arch/mips/include/asm/mach-loongson/boot_param.h +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __ASM_MACH_LOONGSON_BOOT_PARAM_H_ | 1 | #ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_ |
2 | #define __ASM_MACH_LOONGSON_BOOT_PARAM_H_ | 2 | #define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_ |
3 | 3 | ||
4 | #define SYSTEM_RAM_LOW 1 | 4 | #define SYSTEM_RAM_LOW 1 |
5 | #define SYSTEM_RAM_HIGH 2 | 5 | #define SYSTEM_RAM_HIGH 2 |
diff --git a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h index acc376897e46..98963c2c7be4 100644 --- a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h | |||
@@ -13,8 +13,8 @@ | |||
13 | * loongson2f user manual. | 13 | * loongson2f user manual. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H | 16 | #ifndef __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H |
17 | #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H | 17 | #define __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H |
18 | 18 | ||
19 | #define cpu_dcache_line_size() 32 | 19 | #define cpu_dcache_line_size() 32 |
20 | #define cpu_icache_line_size() 32 | 20 | #define cpu_icache_line_size() 32 |
@@ -58,4 +58,4 @@ | |||
58 | 58 | ||
59 | #define cpu_has_wsbh IS_ENABLED(CONFIG_CPU_LOONGSON3) | 59 | #define cpu_has_wsbh IS_ENABLED(CONFIG_CPU_LOONGSON3) |
60 | 60 | ||
61 | #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */ | 61 | #endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536.h b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536.h index a0ee0cb775ad..a0ee0cb775ad 100644 --- a/arch/mips/include/asm/mach-loongson/cs5536/cs5536.h +++ b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536.h | |||
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536_mfgpt.h index 021d0172dad6..021d0172dad6 100644 --- a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h +++ b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536_mfgpt.h | |||
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_pci.h b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536_pci.h index 8a7ecb4d5c64..8a7ecb4d5c64 100644 --- a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_pci.h +++ b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536_pci.h | |||
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536_vsm.h index 1f17c1815ee5..1f17c1815ee5 100644 --- a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h +++ b/arch/mips/include/asm/mach-loongson64/cs5536/cs5536_vsm.h | |||
diff --git a/arch/mips/include/asm/mach-loongson/dma-coherence.h b/arch/mips/include/asm/mach-loongson64/dma-coherence.h index 4bf4e19f72e8..1602a9e9e8c2 100644 --- a/arch/mips/include/asm/mach-loongson/dma-coherence.h +++ b/arch/mips/include/asm/mach-loongson64/dma-coherence.h | |||
@@ -8,8 +8,8 @@ | |||
8 | * Author: Fuxin Zhang, zhangfx@lemote.com | 8 | * Author: Fuxin Zhang, zhangfx@lemote.com |
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | #ifndef __ASM_MACH_LOONGSON_DMA_COHERENCE_H | 11 | #ifndef __ASM_MACH_LOONGSON64_DMA_COHERENCE_H |
12 | #define __ASM_MACH_LOONGSON_DMA_COHERENCE_H | 12 | #define __ASM_MACH_LOONGSON64_DMA_COHERENCE_H |
13 | 13 | ||
14 | #ifdef CONFIG_SWIOTLB | 14 | #ifdef CONFIG_SWIOTLB |
15 | #include <linux/swiotlb.h> | 15 | #include <linux/swiotlb.h> |
@@ -82,4 +82,4 @@ static inline void plat_post_dma_flush(struct device *dev) | |||
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
85 | #endif /* __ASM_MACH_LOONGSON_DMA_COHERENCE_H */ | 85 | #endif /* __ASM_MACH_LOONGSON64_DMA_COHERENCE_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/gpio.h b/arch/mips/include/asm/mach-loongson64/gpio.h index b3b216904a9a..b3b216904a9a 100644 --- a/arch/mips/include/asm/mach-loongson/gpio.h +++ b/arch/mips/include/asm/mach-loongson64/gpio.h | |||
diff --git a/arch/mips/include/asm/mach-loongson/irq.h b/arch/mips/include/asm/mach-loongson64/irq.h index a281cca5f2fb..d18c45c7c394 100644 --- a/arch/mips/include/asm/mach-loongson/irq.h +++ b/arch/mips/include/asm/mach-loongson64/irq.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __ASM_MACH_LOONGSON_IRQ_H_ | 1 | #ifndef __ASM_MACH_LOONGSON64_IRQ_H_ |
2 | #define __ASM_MACH_LOONGSON_IRQ_H_ | 2 | #define __ASM_MACH_LOONGSON64_IRQ_H_ |
3 | 3 | ||
4 | #include <boot_param.h> | 4 | #include <boot_param.h> |
5 | 5 | ||
@@ -40,4 +40,4 @@ extern void fixup_irqs(void); | |||
40 | extern void loongson3_ipi_interrupt(struct pt_regs *regs); | 40 | extern void loongson3_ipi_interrupt(struct pt_regs *regs); |
41 | 41 | ||
42 | #include_next <irq.h> | 42 | #include_next <irq.h> |
43 | #endif /* __ASM_MACH_LOONGSON_IRQ_H_ */ | 43 | #endif /* __ASM_MACH_LOONGSON64_IRQ_H_ */ |
diff --git a/arch/mips/include/asm/mach-loongson/kernel-entry-init.h b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h index df5fca8eeb80..3f2f84f6c401 100644 --- a/arch/mips/include/asm/mach-loongson/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | |||
@@ -8,8 +8,8 @@ | |||
8 | * Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn) | 8 | * Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn) |
9 | * Copyright (C) 2012 Huacai Chen (chenhc@lemote.com) | 9 | * Copyright (C) 2012 Huacai Chen (chenhc@lemote.com) |
10 | */ | 10 | */ |
11 | #ifndef __ASM_MACH_LOONGSON_KERNEL_ENTRY_H | 11 | #ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H |
12 | #define __ASM_MACH_LOONGSON_KERNEL_ENTRY_H | 12 | #define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * Override macros used in arch/mips/kernel/head.S. | 15 | * Override macros used in arch/mips/kernel/head.S. |
@@ -49,4 +49,4 @@ | |||
49 | #endif | 49 | #endif |
50 | .endm | 50 | .endm |
51 | 51 | ||
52 | #endif /* __ASM_MACH_LOONGSON_KERNEL_ENTRY_H */ | 52 | #endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson64/loongson.h index 9783103fd6f6..d1ff774ac4b6 100644 --- a/arch/mips/include/asm/mach-loongson/loongson.h +++ b/arch/mips/include/asm/mach-loongson64/loongson.h | |||
@@ -8,8 +8,8 @@ | |||
8 | * option) any later version. | 8 | * option) any later version. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __ASM_MACH_LOONGSON_LOONGSON_H | 11 | #ifndef __ASM_MACH_LOONGSON64_LOONGSON_H |
12 | #define __ASM_MACH_LOONGSON_LOONGSON_H | 12 | #define __ASM_MACH_LOONGSON64_LOONGSON_H |
13 | 13 | ||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
@@ -357,4 +357,4 @@ extern unsigned long _loongson_addrwincfg_base; | |||
357 | 357 | ||
358 | #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */ | 358 | #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */ |
359 | 359 | ||
360 | #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */ | 360 | #endif /* __ASM_MACH_LOONGSON64_LOONGSON_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/loongson_hwmon.h b/arch/mips/include/asm/mach-loongson64/loongson_hwmon.h index 4431fc54a36c..4431fc54a36c 100644 --- a/arch/mips/include/asm/mach-loongson/loongson_hwmon.h +++ b/arch/mips/include/asm/mach-loongson64/loongson_hwmon.h | |||
diff --git a/arch/mips/include/asm/mach-loongson/machine.h b/arch/mips/include/asm/mach-loongson64/machine.h index cb2b60249cd2..c52549bb4e56 100644 --- a/arch/mips/include/asm/mach-loongson/machine.h +++ b/arch/mips/include/asm/mach-loongson64/machine.h | |||
@@ -8,8 +8,8 @@ | |||
8 | * option) any later version. | 8 | * option) any later version. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __ASM_MACH_LOONGSON_MACHINE_H | 11 | #ifndef __ASM_MACH_LOONGSON64_MACHINE_H |
12 | #define __ASM_MACH_LOONGSON_MACHINE_H | 12 | #define __ASM_MACH_LOONGSON64_MACHINE_H |
13 | 13 | ||
14 | #ifdef CONFIG_LEMOTE_FULOONG2E | 14 | #ifdef CONFIG_LEMOTE_FULOONG2E |
15 | 15 | ||
@@ -30,4 +30,4 @@ | |||
30 | 30 | ||
31 | #endif /* CONFIG_LOONGSON_MACH3X */ | 31 | #endif /* CONFIG_LOONGSON_MACH3X */ |
32 | 32 | ||
33 | #endif /* __ASM_MACH_LOONGSON_MACHINE_H */ | 33 | #endif /* __ASM_MACH_LOONGSON64_MACHINE_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/mc146818rtc.h b/arch/mips/include/asm/mach-loongson64/mc146818rtc.h index ed7fe978335a..ebdccfee50be 100644 --- a/arch/mips/include/asm/mach-loongson/mc146818rtc.h +++ b/arch/mips/include/asm/mach-loongson64/mc146818rtc.h | |||
@@ -7,8 +7,8 @@ | |||
7 | * | 7 | * |
8 | * RTC routines for PC style attached Dallas chip. | 8 | * RTC routines for PC style attached Dallas chip. |
9 | */ | 9 | */ |
10 | #ifndef __ASM_MACH_LOONGSON_MC146818RTC_H | 10 | #ifndef __ASM_MACH_LOONGSON64_MC146818RTC_H |
11 | #define __ASM_MACH_LOONGSON_MC146818RTC_H | 11 | #define __ASM_MACH_LOONGSON64_MC146818RTC_H |
12 | 12 | ||
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | 14 | ||
@@ -33,4 +33,4 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr) | |||
33 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) | 33 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #endif /* __ASM_MACH_LOONGSON_MC146818RTC_H */ | 36 | #endif /* __ASM_MACH_LOONGSON64_MC146818RTC_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/mem.h b/arch/mips/include/asm/mach-loongson64/mem.h index f4a36d7dbfab..75c16bead536 100644 --- a/arch/mips/include/asm/mach-loongson/mem.h +++ b/arch/mips/include/asm/mach-loongson64/mem.h | |||
@@ -8,8 +8,8 @@ | |||
8 | * option) any later version. | 8 | * option) any later version. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __ASM_MACH_LOONGSON_MEM_H | 11 | #ifndef __ASM_MACH_LOONGSON64_MEM_H |
12 | #define __ASM_MACH_LOONGSON_MEM_H | 12 | #define __ASM_MACH_LOONGSON64_MEM_H |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * high memory space | 15 | * high memory space |
@@ -38,4 +38,4 @@ | |||
38 | #define LOONGSON_MMIO_MEM_END 0x80000000 | 38 | #define LOONGSON_MMIO_MEM_END 0x80000000 |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #endif /* __ASM_MACH_LOONGSON_MEM_H */ | 41 | #endif /* __ASM_MACH_LOONGSON64_MEM_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h index 37c08a27b4f0..37c08a27b4f0 100644 --- a/arch/mips/include/asm/mach-loongson/mmzone.h +++ b/arch/mips/include/asm/mach-loongson64/mmzone.h | |||
diff --git a/arch/mips/include/asm/mach-loongson/pci.h b/arch/mips/include/asm/mach-loongson64/pci.h index 1212774f66ef..3401f557434a 100644 --- a/arch/mips/include/asm/mach-loongson/pci.h +++ b/arch/mips/include/asm/mach-loongson64/pci.h | |||
@@ -9,8 +9,8 @@ | |||
9 | * option) any later version. | 9 | * option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifndef __ASM_MACH_LOONGSON_PCI_H_ | 12 | #ifndef __ASM_MACH_LOONGSON64_PCI_H_ |
13 | #define __ASM_MACH_LOONGSON_PCI_H_ | 13 | #define __ASM_MACH_LOONGSON64_PCI_H_ |
14 | 14 | ||
15 | extern struct pci_ops loongson_pci_ops; | 15 | extern struct pci_ops loongson_pci_ops; |
16 | 16 | ||
@@ -52,4 +52,4 @@ extern struct pci_ops loongson_pci_ops; | |||
52 | 52 | ||
53 | #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */ | 53 | #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */ |
54 | 54 | ||
55 | #endif /* !__ASM_MACH_LOONGSON_PCI_H_ */ | 55 | #endif /* !__ASM_MACH_LOONGSON64_PCI_H_ */ |
diff --git a/arch/mips/include/asm/mach-loongson/spaces.h b/arch/mips/include/asm/mach-loongson64/spaces.h index e2506ee90044..c6040b9fcf94 100644 --- a/arch/mips/include/asm/mach-loongson/spaces.h +++ b/arch/mips/include/asm/mach-loongson64/spaces.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __ASM_MACH_LOONGSON_SPACES_H_ | 1 | #ifndef __ASM_MACH_LOONGSON64_SPACES_H_ |
2 | #define __ASM_MACH_LOONGSON_SPACES_H_ | 2 | #define __ASM_MACH_LOONGSON64_SPACES_H_ |
3 | 3 | ||
4 | #if defined(CONFIG_64BIT) | 4 | #if defined(CONFIG_64BIT) |
5 | #define CAC_BASE _AC(0x9800000000000000, UL) | 5 | #define CAC_BASE _AC(0x9800000000000000, UL) |
diff --git a/arch/mips/include/asm/mach-loongson/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h index 0d8f3b55bdbc..0d8f3b55bdbc 100644 --- a/arch/mips/include/asm/mach-loongson/topology.h +++ b/arch/mips/include/asm/mach-loongson64/topology.h | |||
diff --git a/arch/mips/include/asm/mach-loongson64/workarounds.h b/arch/mips/include/asm/mach-loongson64/workarounds.h new file mode 100644 index 000000000000..e659f041e116 --- /dev/null +++ b/arch/mips/include/asm/mach-loongson64/workarounds.h | |||
@@ -0,0 +1,7 @@ | |||
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 | ||
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h index 59c0901bdd84..edc7ee95269e 100644 --- a/arch/mips/include/asm/mips-cm.h +++ b/arch/mips/include/asm/mips-cm.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #ifndef __MIPS_ASM_MIPS_CM_H__ | 11 | #ifndef __MIPS_ASM_MIPS_CM_H__ |
12 | #define __MIPS_ASM_MIPS_CM_H__ | 12 | #define __MIPS_ASM_MIPS_CM_H__ |
13 | 13 | ||
14 | #include <linux/errno.h> | ||
14 | #include <linux/io.h> | 15 | #include <linux/io.h> |
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
16 | 17 | ||
@@ -216,6 +217,10 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) | |||
216 | #define CM_GCR_CPC_BASE_CPCEN_SHF 0 | 217 | #define CM_GCR_CPC_BASE_CPCEN_SHF 0 |
217 | #define CM_GCR_CPC_BASE_CPCEN_MSK (_ULCAST_(0x1) << 0) | 218 | #define CM_GCR_CPC_BASE_CPCEN_MSK (_ULCAST_(0x1) << 0) |
218 | 219 | ||
220 | /* GCR_GIC_STATUS register fields */ | ||
221 | #define CM_GCR_GIC_STATUS_GICEX_SHF 0 | ||
222 | #define CM_GCR_GIC_STATUS_GICEX_MSK (_ULCAST_(0x1) << 0) | ||
223 | |||
219 | /* GCR_REGn_BASE register fields */ | 224 | /* GCR_REGn_BASE register fields */ |
220 | #define CM_GCR_REGn_BASE_BASEADDR_SHF 16 | 225 | #define CM_GCR_REGn_BASE_BASEADDR_SHF 16 |
221 | #define CM_GCR_REGn_BASE_BASEADDR_MSK (_ULCAST_(0xffff) << 16) | 226 | #define CM_GCR_REGn_BASE_BASEADDR_MSK (_ULCAST_(0xffff) << 16) |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 764e2756b54d..c5b0956a8530 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -589,6 +589,28 @@ | |||
589 | /* EntryHI bit definition */ | 589 | /* EntryHI bit definition */ |
590 | #define MIPS_ENTRYHI_EHINV (_ULCAST_(1) << 10) | 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 | /* CMGCRBase bit definitions */ | 614 | /* CMGCRBase bit definitions */ |
593 | #define MIPS_CMGCRB_BASE 11 | 615 | #define MIPS_CMGCRB_BASE 11 |
594 | #define MIPS_CMGCRF_BASE (~_ULCAST_((1 << MIPS_CMGCRB_BASE) - 1)) | 616 | #define MIPS_CMGCRF_BASE (~_ULCAST_((1 << MIPS_CMGCRB_BASE) - 1)) |
@@ -685,6 +707,15 @@ | |||
685 | #define TX39_CONF_DRSIZE_SHIFT 0 | 707 | #define TX39_CONF_DRSIZE_SHIFT 0 |
686 | #define TX39_CONF_DRSIZE_MASK 0x00000003 | 708 | #define TX39_CONF_DRSIZE_MASK 0x00000003 |
687 | 709 | ||
710 | /* | ||
711 | * Interesting Bits in the R10K CP0 Branch Diagnostic Register | ||
712 | */ | ||
713 | /* Disable Branch Target Address Cache */ | ||
714 | #define R10K_DIAG_D_BTAC (_ULCAST_(1) << 27) | ||
715 | /* Enable Branch Prediction Global History */ | ||
716 | #define R10K_DIAG_E_GHIST (_ULCAST_(1) << 26) | ||
717 | /* Disable Branch Return Cache */ | ||
718 | #define R10K_DIAG_D_BRC (_ULCAST_(1) << 22) | ||
688 | 719 | ||
689 | /* | 720 | /* |
690 | * Coprocessor 1 (FPU) register names | 721 | * Coprocessor 1 (FPU) register names |
@@ -1247,6 +1278,10 @@ do { \ | |||
1247 | #define read_c0_diag() __read_32bit_c0_register($22, 0) | 1278 | #define read_c0_diag() __read_32bit_c0_register($22, 0) |
1248 | #define write_c0_diag(val) __write_32bit_c0_register($22, 0, val) | 1279 | #define write_c0_diag(val) __write_32bit_c0_register($22, 0, val) |
1249 | 1280 | ||
1281 | /* R10K CP0 Branch Diagnostic register is 64bits wide */ | ||
1282 | #define read_c0_r10k_diag() __read_64bit_c0_register($22, 0) | ||
1283 | #define write_c0_r10k_diag(val) __write_64bit_c0_register($22, 0, val) | ||
1284 | |||
1250 | #define read_c0_diag1() __read_32bit_c0_register($22, 1) | 1285 | #define read_c0_diag1() __read_32bit_c0_register($22, 1) |
1251 | #define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val) | 1286 | #define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val) |
1252 | 1287 | ||
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h index 7d56686c0e62..832e2167d00f 100644 --- a/arch/mips/include/asm/pgtable-32.h +++ b/arch/mips/include/asm/pgtable-32.h | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | #include <asm-generic/pgtable-nopmd.h> | 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 | * - add_temporary_entry() add a temporary TLB entry. We use TLB entries | 24 | * - add_temporary_entry() add a temporary TLB entry. We use TLB entries |
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h index 8ebc2aa5f3e1..0b4b668925f6 100644 --- a/arch/mips/include/asm/prom.h +++ b/arch/mips/include/asm/prom.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #ifndef __ASM_PROM_H | 11 | #ifndef __ASM_PROM_H |
12 | #define __ASM_PROM_H | 12 | #define __ASM_PROM_H |
13 | 13 | ||
14 | #ifdef CONFIG_OF | 14 | #ifdef CONFIG_USE_OF |
15 | #include <linux/bug.h> | 15 | #include <linux/bug.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h index 1fca2e0793dc..9de4ba43dcd1 100644 --- a/arch/mips/include/asm/spinlock.h +++ b/arch/mips/include/asm/spinlock.h | |||
@@ -109,7 +109,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) | |||
109 | " subu %[ticket], %[my_ticket], %[ticket] \n" | 109 | " subu %[ticket], %[my_ticket], %[ticket] \n" |
110 | "2: \n" | 110 | "2: \n" |
111 | " .subsection 2 \n" | 111 | " .subsection 2 \n" |
112 | "4: andi %[ticket], %[ticket], 0x1fff \n" | 112 | "4: andi %[ticket], %[ticket], 0xffff \n" |
113 | " sll %[ticket], 5 \n" | 113 | " sll %[ticket], 5 \n" |
114 | " \n" | 114 | " \n" |
115 | "6: bnez %[ticket], 6b \n" | 115 | "6: bnez %[ticket], 6b \n" |
@@ -317,7 +317,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw) | |||
317 | 317 | ||
318 | static inline void arch_write_unlock(arch_rwlock_t *rw) | 318 | static inline void arch_write_unlock(arch_rwlock_t *rw) |
319 | { | 319 | { |
320 | smp_mb(); | 320 | smp_mb__before_llsc(); |
321 | 321 | ||
322 | __asm__ __volatile__( | 322 | __asm__ __volatile__( |
323 | " # arch_write_unlock \n" | 323 | " # arch_write_unlock \n" |
diff --git a/arch/mips/include/asm/txx9irq.h b/arch/mips/include/asm/txx9irq.h index 5620879be37f..68a6650a4025 100644 --- a/arch/mips/include/asm/txx9irq.h +++ b/arch/mips/include/asm/txx9irq.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #include <irq.h> | 12 | #include <irq.h> |
13 | 13 | ||
14 | #ifdef CONFIG_IRQ_CPU | 14 | #ifdef CONFIG_IRQ_MIPS_CPU |
15 | #define TXX9_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8) | 15 | #define TXX9_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8) |
16 | #else | 16 | #else |
17 | #ifdef CONFIG_I8259 | 17 | #ifdef CONFIG_I8259 |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index 9722357d2854..5305d694ffe5 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
@@ -78,6 +78,21 @@ extern u64 __ua_limit; | |||
78 | 78 | ||
79 | #define segment_eq(a, b) ((a).seg == (b).seg) | 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 | * Is a address valid? This does a straighforward calculation rather | 98 | * Is a address valid? This does a straighforward calculation rather |
@@ -286,7 +301,7 @@ do { \ | |||
286 | ({ \ | 301 | ({ \ |
287 | int __gu_err; \ | 302 | int __gu_err; \ |
288 | \ | 303 | \ |
289 | if (segment_eq(get_fs(), get_ds())) { \ | 304 | if (eva_kernel_access()) { \ |
290 | __get_kernel_common((x), size, ptr); \ | 305 | __get_kernel_common((x), size, ptr); \ |
291 | } else { \ | 306 | } else { \ |
292 | __chk_user_ptr(ptr); \ | 307 | __chk_user_ptr(ptr); \ |
@@ -302,7 +317,7 @@ do { \ | |||
302 | \ | 317 | \ |
303 | might_fault(); \ | 318 | might_fault(); \ |
304 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) { \ | 319 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) { \ |
305 | if (segment_eq(get_fs(), get_ds())) \ | 320 | if (eva_kernel_access()) \ |
306 | __get_kernel_common((x), size, __gu_ptr); \ | 321 | __get_kernel_common((x), size, __gu_ptr); \ |
307 | else \ | 322 | else \ |
308 | __get_user_common((x), size, __gu_ptr); \ | 323 | __get_user_common((x), size, __gu_ptr); \ |
@@ -427,7 +442,7 @@ do { \ | |||
427 | int __pu_err = 0; \ | 442 | int __pu_err = 0; \ |
428 | \ | 443 | \ |
429 | __pu_val = (x); \ | 444 | __pu_val = (x); \ |
430 | if (segment_eq(get_fs(), get_ds())) { \ | 445 | if (eva_kernel_access()) { \ |
431 | __put_kernel_common(ptr, size); \ | 446 | __put_kernel_common(ptr, size); \ |
432 | } else { \ | 447 | } else { \ |
433 | __chk_user_ptr(ptr); \ | 448 | __chk_user_ptr(ptr); \ |
@@ -444,7 +459,7 @@ do { \ | |||
444 | \ | 459 | \ |
445 | might_fault(); \ | 460 | might_fault(); \ |
446 | if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \ | 461 | if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \ |
447 | if (segment_eq(get_fs(), get_ds())) \ | 462 | if (eva_kernel_access()) \ |
448 | __put_kernel_common(__pu_addr, size); \ | 463 | __put_kernel_common(__pu_addr, size); \ |
449 | else \ | 464 | else \ |
450 | __put_user_common(__pu_addr, size); \ | 465 | __put_user_common(__pu_addr, size); \ |
@@ -843,7 +858,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n); | |||
843 | __cu_from = (from); \ | 858 | __cu_from = (from); \ |
844 | __cu_len = (n); \ | 859 | __cu_len = (n); \ |
845 | might_fault(); \ | 860 | might_fault(); \ |
846 | if (segment_eq(get_fs(), get_ds())) \ | 861 | if (eva_kernel_access()) \ |
847 | __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ | 862 | __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ |
848 | __cu_len); \ | 863 | __cu_len); \ |
849 | else \ | 864 | else \ |
@@ -863,7 +878,7 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n); | |||
863 | __cu_to = (to); \ | 878 | __cu_to = (to); \ |
864 | __cu_from = (from); \ | 879 | __cu_from = (from); \ |
865 | __cu_len = (n); \ | 880 | __cu_len = (n); \ |
866 | if (segment_eq(get_fs(), get_ds())) \ | 881 | if (eva_kernel_access()) \ |
867 | __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ | 882 | __cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \ |
868 | __cu_len); \ | 883 | __cu_len); \ |
869 | else \ | 884 | else \ |
@@ -881,7 +896,7 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n); | |||
881 | __cu_to = (to); \ | 896 | __cu_to = (to); \ |
882 | __cu_from = (from); \ | 897 | __cu_from = (from); \ |
883 | __cu_len = (n); \ | 898 | __cu_len = (n); \ |
884 | if (segment_eq(get_fs(), get_ds())) \ | 899 | if (eva_kernel_access()) \ |
885 | __cu_len = __invoke_copy_from_kernel_inatomic(__cu_to, \ | 900 | __cu_len = __invoke_copy_from_kernel_inatomic(__cu_to, \ |
886 | __cu_from,\ | 901 | __cu_from,\ |
887 | __cu_len);\ | 902 | __cu_len);\ |
@@ -915,7 +930,7 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n); | |||
915 | __cu_to = (to); \ | 930 | __cu_to = (to); \ |
916 | __cu_from = (from); \ | 931 | __cu_from = (from); \ |
917 | __cu_len = (n); \ | 932 | __cu_len = (n); \ |
918 | if (segment_eq(get_fs(), get_ds())) { \ | 933 | if (eva_kernel_access()) { \ |
919 | __cu_len = __invoke_copy_to_kernel(__cu_to, \ | 934 | __cu_len = __invoke_copy_to_kernel(__cu_to, \ |
920 | __cu_from, \ | 935 | __cu_from, \ |
921 | __cu_len); \ | 936 | __cu_len); \ |
@@ -1139,7 +1154,7 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); | |||
1139 | __cu_to = (to); \ | 1154 | __cu_to = (to); \ |
1140 | __cu_from = (from); \ | 1155 | __cu_from = (from); \ |
1141 | __cu_len = (n); \ | 1156 | __cu_len = (n); \ |
1142 | if (segment_eq(get_fs(), get_ds())) { \ | 1157 | if (eva_kernel_access()) { \ |
1143 | __cu_len = __invoke_copy_from_kernel(__cu_to, \ | 1158 | __cu_len = __invoke_copy_from_kernel(__cu_to, \ |
1144 | __cu_from, \ | 1159 | __cu_from, \ |
1145 | __cu_len); \ | 1160 | __cu_len); \ |
@@ -1163,7 +1178,7 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); | |||
1163 | __cu_to = (to); \ | 1178 | __cu_to = (to); \ |
1164 | __cu_from = (from); \ | 1179 | __cu_from = (from); \ |
1165 | __cu_len = (n); \ | 1180 | __cu_len = (n); \ |
1166 | if (segment_eq(get_fs(), get_ds())) { \ | 1181 | if (eva_kernel_access()) { \ |
1167 | __cu_len = ___invoke_copy_in_kernel(__cu_to, __cu_from, \ | 1182 | __cu_len = ___invoke_copy_in_kernel(__cu_to, __cu_from, \ |
1168 | __cu_len); \ | 1183 | __cu_len); \ |
1169 | } else { \ | 1184 | } else { \ |
@@ -1183,7 +1198,7 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); | |||
1183 | __cu_to = (to); \ | 1198 | __cu_to = (to); \ |
1184 | __cu_from = (from); \ | 1199 | __cu_from = (from); \ |
1185 | __cu_len = (n); \ | 1200 | __cu_len = (n); \ |
1186 | if (segment_eq(get_fs(), get_ds())) { \ | 1201 | if (eva_kernel_access()) { \ |
1187 | __cu_len = ___invoke_copy_in_kernel(__cu_to,__cu_from, \ | 1202 | __cu_len = ___invoke_copy_in_kernel(__cu_to,__cu_from, \ |
1188 | __cu_len); \ | 1203 | __cu_len); \ |
1189 | } else { \ | 1204 | } else { \ |
@@ -1263,7 +1278,7 @@ __strncpy_from_user(char *__to, const char __user *__from, long __len) | |||
1263 | { | 1278 | { |
1264 | long res; | 1279 | long res; |
1265 | 1280 | ||
1266 | if (segment_eq(get_fs(), get_ds())) { | 1281 | if (eva_kernel_access()) { |
1267 | __asm__ __volatile__( | 1282 | __asm__ __volatile__( |
1268 | "move\t$4, %1\n\t" | 1283 | "move\t$4, %1\n\t" |
1269 | "move\t$5, %2\n\t" | 1284 | "move\t$5, %2\n\t" |
@@ -1312,7 +1327,7 @@ strncpy_from_user(char *__to, const char __user *__from, long __len) | |||
1312 | { | 1327 | { |
1313 | long res; | 1328 | long res; |
1314 | 1329 | ||
1315 | if (segment_eq(get_fs(), get_ds())) { | 1330 | if (eva_kernel_access()) { |
1316 | __asm__ __volatile__( | 1331 | __asm__ __volatile__( |
1317 | "move\t$4, %1\n\t" | 1332 | "move\t$4, %1\n\t" |
1318 | "move\t$5, %2\n\t" | 1333 | "move\t$5, %2\n\t" |
@@ -1357,7 +1372,7 @@ static inline long strlen_user(const char __user *s) | |||
1357 | { | 1372 | { |
1358 | long res; | 1373 | long res; |
1359 | 1374 | ||
1360 | if (segment_eq(get_fs(), get_ds())) { | 1375 | if (eva_kernel_access()) { |
1361 | __asm__ __volatile__( | 1376 | __asm__ __volatile__( |
1362 | "move\t$4, %1\n\t" | 1377 | "move\t$4, %1\n\t" |
1363 | __MODULE_JAL(__strlen_kernel_asm) | 1378 | __MODULE_JAL(__strlen_kernel_asm) |
@@ -1384,7 +1399,7 @@ static inline long __strnlen_user(const char __user *s, long n) | |||
1384 | { | 1399 | { |
1385 | long res; | 1400 | long res; |
1386 | 1401 | ||
1387 | if (segment_eq(get_fs(), get_ds())) { | 1402 | if (eva_kernel_access()) { |
1388 | __asm__ __volatile__( | 1403 | __asm__ __volatile__( |
1389 | "move\t$4, %1\n\t" | 1404 | "move\t$4, %1\n\t" |
1390 | "move\t$5, %2\n\t" | 1405 | "move\t$5, %2\n\t" |
@@ -1426,7 +1441,7 @@ static inline long strnlen_user(const char __user *s, long n) | |||
1426 | long res; | 1441 | long res; |
1427 | 1442 | ||
1428 | might_fault(); | 1443 | might_fault(); |
1429 | if (segment_eq(get_fs(), get_ds())) { | 1444 | if (eva_kernel_access()) { |
1430 | __asm__ __volatile__( | 1445 | __asm__ __volatile__( |
1431 | "move\t$4, %1\n\t" | 1446 | "move\t$4, %1\n\t" |
1432 | "move\t$5, %2\n\t" | 1447 | "move\t$5, %2\n\t" |
diff --git a/arch/mips/include/asm/xtalk/xwidget.h b/arch/mips/include/asm/xtalk/xwidget.h index 32e4e884f9b9..24f121da6a1d 100644 --- a/arch/mips/include/asm/xtalk/xwidget.h +++ b/arch/mips/include/asm/xtalk/xwidget.h | |||
@@ -84,6 +84,118 @@ | |||
84 | #define WIDGET_LLP_MAXBURST 0x000003ff | 84 | #define WIDGET_LLP_MAXBURST 0x000003ff |
85 | #define WIDGET_LLP_MAXBURST_SHFT 0 | 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 | * according to the crosstalk spec, only 32-bits access to the widget | 200 | * according to the crosstalk spec, only 32-bits access to the widget |
89 | * configuration registers is allowed. some widgets may allow 64-bits | 201 | * configuration registers is allowed. some widgets may allow 64-bits |
diff --git a/arch/mips/jz4740/Kconfig b/arch/mips/jz4740/Kconfig index 468903053883..36f82017695d 100644 --- a/arch/mips/jz4740/Kconfig +++ b/arch/mips/jz4740/Kconfig | |||
@@ -1,9 +1,24 @@ | |||
1 | choice | 1 | choice |
2 | prompt "Machine type" | 2 | prompt "Machine type" |
3 | depends on MACH_JZ4740 | 3 | depends on MACH_INGENIC |
4 | default JZ4740_QI_LB60 | 4 | default JZ4740_QI_LB60 |
5 | 5 | ||
6 | config JZ4740_QI_LB60 | 6 | config JZ4740_QI_LB60 |
7 | bool "Qi Hardware Ben NanoNote" | 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 | endchoice | 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 | ||
diff --git a/arch/mips/jz4740/Makefile b/arch/mips/jz4740/Makefile index 28e5535dfa9e..39d70bde8cfe 100644 --- a/arch/mips/jz4740/Makefile +++ b/arch/mips/jz4740/Makefile | |||
@@ -4,10 +4,12 @@ | |||
4 | 4 | ||
5 | # Object file lists. | 5 | # Object file lists. |
6 | 6 | ||
7 | obj-y += prom.o irq.o time.o reset.o setup.o \ | 7 | obj-y += prom.o time.o reset.o setup.o \ |
8 | gpio.o clock.o platform.o timer.o serial.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 | # board specific support | 14 | # board specific support |
13 | 15 | ||
diff --git a/arch/mips/jz4740/Platform b/arch/mips/jz4740/Platform index c41d30080098..28448d358c10 100644 --- a/arch/mips/jz4740/Platform +++ b/arch/mips/jz4740/Platform | |||
@@ -1,4 +1,4 @@ | |||
1 | platform-$(CONFIG_MACH_JZ4740) += jz4740/ | 1 | platform-$(CONFIG_MACH_INGENIC) += jz4740/ |
2 | cflags-$(CONFIG_MACH_JZ4740) += -I$(srctree)/arch/mips/include/asm/mach-jz4740 | 2 | cflags-$(CONFIG_MACH_INGENIC) += -I$(srctree)/arch/mips/include/asm/mach-jz4740 |
3 | load-$(CONFIG_MACH_JZ4740) += 0xffffffff80010000 | 3 | load-$(CONFIG_MACH_INGENIC) += 0xffffffff80010000 |
4 | zload-$(CONFIG_MACH_JZ4740) += 0xffffffff80600000 | 4 | zload-$(CONFIG_MACH_INGENIC) += 0xffffffff80600000 |
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c index 9dd051edb411..4e62bf85d0b0 100644 --- a/arch/mips/jz4740/board-qi_lb60.c +++ b/arch/mips/jz4740/board-qi_lb60.c | |||
@@ -482,8 +482,6 @@ static int __init qi_lb60_init_platform_devices(void) | |||
482 | gpiod_add_lookup_table(&qi_lb60_audio_gpio_table); | 482 | gpiod_add_lookup_table(&qi_lb60_audio_gpio_table); |
483 | gpiod_add_lookup_table(&qi_lb60_nand_gpio_table); | 483 | gpiod_add_lookup_table(&qi_lb60_nand_gpio_table); |
484 | 484 | ||
485 | jz4740_serial_device_register(); | ||
486 | |||
487 | spi_register_board_info(qi_lb60_spi_board_info, | 485 | spi_register_board_info(qi_lb60_spi_board_info, |
488 | ARRAY_SIZE(qi_lb60_spi_board_info)); | 486 | ARRAY_SIZE(qi_lb60_spi_board_info)); |
489 | 487 | ||
@@ -497,11 +495,6 @@ static int __init qi_lb60_init_platform_devices(void) | |||
497 | 495 | ||
498 | } | 496 | } |
499 | 497 | ||
500 | struct jz4740_clock_board_data jz4740_clock_bdata = { | ||
501 | .ext_rate = 12000000, | ||
502 | .rtc_rate = 32768, | ||
503 | }; | ||
504 | |||
505 | static __init int board_avt2(char *str) | 498 | static __init int board_avt2(char *str) |
506 | { | 499 | { |
507 | qi_lb60_mmc_pdata.card_detect_active_low = 1; | 500 | qi_lb60_mmc_pdata.card_detect_active_low = 1; |
diff --git a/arch/mips/jz4740/clock-debugfs.c b/arch/mips/jz4740/clock-debugfs.c deleted file mode 100644 index 325422d0d453..000000000000 --- a/arch/mips/jz4740/clock-debugfs.c +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
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 | } | ||
diff --git a/arch/mips/jz4740/clock.c b/arch/mips/jz4740/clock.c deleted file mode 100644 index 1b5f55426cad..000000000000 --- a/arch/mips/jz4740/clock.c +++ /dev/null | |||
@@ -1,924 +0,0 @@ | |||
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); | ||
diff --git a/arch/mips/jz4740/clock.h b/arch/mips/jz4740/clock.h deleted file mode 100644 index 5d07499d7461..000000000000 --- a/arch/mips/jz4740/clock.h +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
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 | ||
diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c index 00b798d2fb7c..54c80d42a88d 100644 --- a/arch/mips/jz4740/gpio.c +++ b/arch/mips/jz4740/gpio.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/irqchip/ingenic.h> | ||
24 | #include <linux/bitops.h> | 25 | #include <linux/bitops.h> |
25 | 26 | ||
26 | #include <linux/debugfs.h> | 27 | #include <linux/debugfs.h> |
@@ -28,8 +29,6 @@ | |||
28 | 29 | ||
29 | #include <asm/mach-jz4740/base.h> | 30 | #include <asm/mach-jz4740/base.h> |
30 | 31 | ||
31 | #include "irq.h" | ||
32 | |||
33 | #define JZ4740_GPIO_BASE_A (32*0) | 32 | #define JZ4740_GPIO_BASE_A (32*0) |
34 | #define JZ4740_GPIO_BASE_B (32*1) | 33 | #define JZ4740_GPIO_BASE_B (32*1) |
35 | #define JZ4740_GPIO_BASE_C (32*2) | 34 | #define JZ4740_GPIO_BASE_C (32*2) |
@@ -442,8 +441,8 @@ static void jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id) | |||
442 | ct->chip.irq_mask = irq_gc_mask_disable_reg; | 441 | ct->chip.irq_mask = irq_gc_mask_disable_reg; |
443 | ct->chip.irq_unmask = jz_gpio_irq_unmask; | 442 | ct->chip.irq_unmask = jz_gpio_irq_unmask; |
444 | ct->chip.irq_ack = irq_gc_ack_set_bit; | 443 | ct->chip.irq_ack = irq_gc_ack_set_bit; |
445 | ct->chip.irq_suspend = jz4740_irq_suspend; | 444 | ct->chip.irq_suspend = ingenic_intc_irq_suspend; |
446 | ct->chip.irq_resume = jz4740_irq_resume; | 445 | ct->chip.irq_resume = ingenic_intc_irq_resume; |
447 | ct->chip.irq_startup = jz_gpio_irq_startup; | 446 | ct->chip.irq_startup = jz_gpio_irq_startup; |
448 | ct->chip.irq_shutdown = jz_gpio_irq_shutdown; | 447 | ct->chip.irq_shutdown = jz_gpio_irq_shutdown; |
449 | ct->chip.irq_set_type = jz_gpio_irq_set_type; | 448 | ct->chip.irq_set_type = jz_gpio_irq_set_type; |
diff --git a/arch/mips/jz4740/irq.c b/arch/mips/jz4740/irq.c deleted file mode 100644 index 97206b3deb97..000000000000 --- a/arch/mips/jz4740/irq.c +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
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 | ||
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c index 0b12f273cb2e..e8a463b9b663 100644 --- a/arch/mips/jz4740/platform.c +++ b/arch/mips/jz4740/platform.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/clk.h> | ||
16 | #include <linux/device.h> | 17 | #include <linux/device.h> |
17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
@@ -29,7 +30,6 @@ | |||
29 | #include <linux/serial_core.h> | 30 | #include <linux/serial_core.h> |
30 | #include <linux/serial_8250.h> | 31 | #include <linux/serial_8250.h> |
31 | 32 | ||
32 | #include "serial.h" | ||
33 | #include "clock.h" | 33 | #include "clock.h" |
34 | 34 | ||
35 | /* OHCI controller */ | 35 | /* OHCI controller */ |
@@ -279,42 +279,6 @@ struct platform_device jz4740_adc_device = { | |||
279 | .resource = jz4740_adc_resources, | 279 | .resource = jz4740_adc_resources, |
280 | }; | 280 | }; |
281 | 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 | |||
318 | /* Watchdog */ | 282 | /* Watchdog */ |
319 | static struct resource jz4740_wdt_resources[] = { | 283 | static struct resource jz4740_wdt_resources[] = { |
320 | { | 284 | { |
diff --git a/arch/mips/jz4740/pm.c b/arch/mips/jz4740/pm.c index d8e213010169..2d8653f2fc61 100644 --- a/arch/mips/jz4740/pm.c +++ b/arch/mips/jz4740/pm.c | |||
@@ -20,8 +20,6 @@ | |||
20 | 20 | ||
21 | #include <asm/mach-jz4740/clock.h> | 21 | #include <asm/mach-jz4740/clock.h> |
22 | 22 | ||
23 | #include "clock.h" | ||
24 | |||
25 | static int jz4740_pm_enter(suspend_state_t state) | 23 | static int jz4740_pm_enter(suspend_state_t state) |
26 | { | 24 | { |
27 | jz4740_clock_suspend(); | 25 | jz4740_clock_suspend(); |
diff --git a/arch/mips/jz4740/prom.c b/arch/mips/jz4740/prom.c index 5a93f381590d..6984683c90d0 100644 --- a/arch/mips/jz4740/prom.c +++ b/arch/mips/jz4740/prom.c | |||
@@ -53,16 +53,3 @@ void __init prom_init(void) | |||
53 | void __init prom_free_prom_memory(void) | 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 | } | ||
diff --git a/arch/mips/jz4740/reset.c b/arch/mips/jz4740/reset.c index b6c6343d2834..954e669c9e6b 100644 --- a/arch/mips/jz4740/reset.c +++ b/arch/mips/jz4740/reset.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/clk.h> | ||
15 | #include <linux/io.h> | 16 | #include <linux/io.h> |
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
@@ -79,12 +80,20 @@ static void jz4740_power_off(void) | |||
79 | void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38); | 80 | void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38); |
80 | unsigned long wakeup_filter_ticks; | 81 | unsigned long wakeup_filter_ticks; |
81 | unsigned long reset_counter_ticks; | 82 | unsigned long reset_counter_ticks; |
83 | struct clk *rtc_clk; | ||
84 | unsigned long rtc_rate; | ||
85 | |||
86 | rtc_clk = clk_get(NULL, "rtc"); | ||
87 | if (IS_ERR(rtc_clk)) | ||
88 | panic("unable to get RTC clock"); | ||
89 | rtc_rate = clk_get_rate(rtc_clk); | ||
90 | clk_put(rtc_clk); | ||
82 | 91 | ||
83 | /* | 92 | /* |
84 | * Set minimum wakeup pin assertion time: 100 ms. | 93 | * Set minimum wakeup pin assertion time: 100 ms. |
85 | * Range is 0 to 2 sec if RTC is clocked at 32 kHz. | 94 | * Range is 0 to 2 sec if RTC is clocked at 32 kHz. |
86 | */ | 95 | */ |
87 | wakeup_filter_ticks = (100 * jz4740_clock_bdata.rtc_rate) / 1000; | 96 | wakeup_filter_ticks = (100 * rtc_rate) / 1000; |
88 | if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK) | 97 | if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK) |
89 | wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK; | 98 | wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK; |
90 | else | 99 | else |
@@ -96,7 +105,7 @@ static void jz4740_power_off(void) | |||
96 | * Set reset pin low-level assertion time after wakeup: 60 ms. | 105 | * Set reset pin low-level assertion time after wakeup: 60 ms. |
97 | * Range is 0 to 125 ms if RTC is clocked at 32 kHz. | 106 | * Range is 0 to 125 ms if RTC is clocked at 32 kHz. |
98 | */ | 107 | */ |
99 | reset_counter_ticks = (60 * jz4740_clock_bdata.rtc_rate) / 1000; | 108 | reset_counter_ticks = (60 * rtc_rate) / 1000; |
100 | if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK) | 109 | if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK) |
101 | reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK; | 110 | reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK; |
102 | else | 111 | else |
diff --git a/arch/mips/jz4740/serial.c b/arch/mips/jz4740/serial.c deleted file mode 100644 index d23de45826d1..000000000000 --- a/arch/mips/jz4740/serial.c +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
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 | } | ||
diff --git a/arch/mips/jz4740/serial.h b/arch/mips/jz4740/serial.h deleted file mode 100644 index 8eb715bb1ea8..000000000000 --- a/arch/mips/jz4740/serial.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
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 | ||
diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c index ef796f97b996..510fc0d962f2 100644 --- a/arch/mips/jz4740/setup.c +++ b/arch/mips/jz4740/setup.c | |||
@@ -16,9 +16,14 @@ | |||
16 | 16 | ||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/irqchip.h> | ||
19 | #include <linux/kernel.h> | 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 | #include <asm/bootinfo.h> | 25 | #include <asm/bootinfo.h> |
26 | #include <asm/prom.h> | ||
22 | 27 | ||
23 | #include <asm/mach-jz4740/base.h> | 28 | #include <asm/mach-jz4740/base.h> |
24 | 29 | ||
@@ -51,11 +56,40 @@ static void __init jz4740_detect_mem(void) | |||
51 | 56 | ||
52 | void __init plat_mem_setup(void) | 57 | void __init plat_mem_setup(void) |
53 | { | 58 | { |
59 | int offset; | ||
60 | |||
54 | jz4740_reset_init(); | 61 | jz4740_reset_init(); |
55 | jz4740_detect_mem(); | 62 | __dt_setup_arch(__dtb_start); |
63 | |||
64 | offset = fdt_path_offset(__dtb_start, "/memory"); | ||
65 | if (offset < 0) | ||
66 | jz4740_detect_mem(); | ||
56 | } | 67 | } |
57 | 68 | ||
69 | void __init device_tree_init(void) | ||
70 | { | ||
71 | if (!initial_boot_params) | ||
72 | return; | ||
73 | |||
74 | unflatten_and_copy_device_tree(); | ||
75 | } | ||
76 | |||
77 | static int __init populate_machine(void) | ||
78 | { | ||
79 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
80 | return 0; | ||
81 | } | ||
82 | arch_initcall(populate_machine); | ||
83 | |||
58 | const char *get_system_type(void) | 84 | const char *get_system_type(void) |
59 | { | 85 | { |
86 | if (config_enabled(CONFIG_MACH_JZ4780)) | ||
87 | return "JZ4780"; | ||
88 | |||
60 | return "JZ4740"; | 89 | return "JZ4740"; |
61 | } | 90 | } |
91 | |||
92 | void __init arch_init_irq(void) | ||
93 | { | ||
94 | irqchip_init(); | ||
95 | } | ||
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c index 72b0cecbc17c..7ab47fee1be8 100644 --- a/arch/mips/jz4740/time.c +++ b/arch/mips/jz4740/time.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/clk.h> | ||
17 | #include <linux/clk-provider.h> | ||
16 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
17 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
18 | #include <linux/time.h> | 20 | #include <linux/time.h> |
@@ -20,6 +22,7 @@ | |||
20 | #include <linux/clockchips.h> | 22 | #include <linux/clockchips.h> |
21 | #include <linux/sched_clock.h> | 23 | #include <linux/sched_clock.h> |
22 | 24 | ||
25 | #include <asm/mach-jz4740/clock.h> | ||
23 | #include <asm/mach-jz4740/irq.h> | 26 | #include <asm/mach-jz4740/irq.h> |
24 | #include <asm/mach-jz4740/timer.h> | 27 | #include <asm/mach-jz4740/timer.h> |
25 | #include <asm/time.h> | 28 | #include <asm/time.h> |
@@ -99,7 +102,12 @@ static struct clock_event_device jz4740_clockevent = { | |||
99 | .set_next_event = jz4740_clockevent_set_next, | 102 | .set_next_event = jz4740_clockevent_set_next, |
100 | .set_mode = jz4740_clockevent_set_mode, | 103 | .set_mode = jz4740_clockevent_set_mode, |
101 | .rating = 200, | 104 | .rating = 200, |
105 | #ifdef CONFIG_MACH_JZ4740 | ||
102 | .irq = JZ4740_IRQ_TCU0, | 106 | .irq = JZ4740_IRQ_TCU0, |
107 | #endif | ||
108 | #ifdef CONFIG_MACH_JZ4780 | ||
109 | .irq = JZ4780_IRQ_TCU2, | ||
110 | #endif | ||
103 | }; | 111 | }; |
104 | 112 | ||
105 | static struct irqaction timer_irqaction = { | 113 | static struct irqaction timer_irqaction = { |
@@ -114,10 +122,17 @@ void __init plat_time_init(void) | |||
114 | int ret; | 122 | int ret; |
115 | uint32_t clk_rate; | 123 | uint32_t clk_rate; |
116 | uint16_t ctrl; | 124 | uint16_t ctrl; |
125 | struct clk *ext_clk; | ||
117 | 126 | ||
127 | of_clk_init(NULL); | ||
118 | jz4740_timer_init(); | 128 | jz4740_timer_init(); |
119 | 129 | ||
120 | clk_rate = jz4740_clock_bdata.ext_rate >> 4; | 130 | ext_clk = clk_get(NULL, "ext"); |
131 | if (IS_ERR(ext_clk)) | ||
132 | panic("unable to get ext clock"); | ||
133 | clk_rate = clk_get_rate(ext_clk) >> 4; | ||
134 | clk_put(ext_clk); | ||
135 | |||
121 | jz4740_jiffies_per_tick = DIV_ROUND_CLOSEST(clk_rate, HZ); | 136 | jz4740_jiffies_per_tick = DIV_ROUND_CLOSEST(clk_rate, HZ); |
122 | 137 | ||
123 | clockevent_set_clock(&jz4740_clockevent, clk_rate); | 138 | clockevent_set_clock(&jz4740_clockevent, clk_rate); |
@@ -134,7 +149,7 @@ void __init plat_time_init(void) | |||
134 | 149 | ||
135 | sched_clock_register(jz4740_read_sched_clock, 16, clk_rate); | 150 | sched_clock_register(jz4740_read_sched_clock, 16, clk_rate); |
136 | 151 | ||
137 | setup_irq(JZ4740_IRQ_TCU0, &timer_irqaction); | 152 | setup_irq(jz4740_clockevent.irq, &timer_irqaction); |
138 | 153 | ||
139 | ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT; | 154 | ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT; |
140 | 155 | ||
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index d3d2ff2d76dc..3f5cf8aff6f3 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -62,7 +62,6 @@ obj-$(CONFIG_MIPS_VPE_APSP_API_CMP) += rtlx-cmp.o | |||
62 | obj-$(CONFIG_MIPS_VPE_APSP_API_MT) += rtlx-mt.o | 62 | obj-$(CONFIG_MIPS_VPE_APSP_API_MT) += rtlx-mt.o |
63 | 63 | ||
64 | obj-$(CONFIG_I8259) += i8259.o | 64 | obj-$(CONFIG_I8259) += i8259.o |
65 | obj-$(CONFIG_IRQ_CPU) += irq_cpu.o | ||
66 | obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o | 65 | obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o |
67 | obj-$(CONFIG_MIPS_MSC) += irq-msc01.o | 66 | obj-$(CONFIG_MIPS_MSC) += irq-msc01.o |
68 | obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o | 67 | obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o |
@@ -77,6 +76,7 @@ obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o | |||
77 | 76 | ||
78 | obj-$(CONFIG_KGDB) += kgdb.o | 77 | obj-$(CONFIG_KGDB) += kgdb.o |
79 | obj-$(CONFIG_PROC_FS) += proc.o | 78 | obj-$(CONFIG_PROC_FS) += proc.o |
79 | obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o | ||
80 | 80 | ||
81 | obj-$(CONFIG_64BIT) += cpu-bugs64.o | 81 | obj-$(CONFIG_64BIT) += cpu-bugs64.o |
82 | 82 | ||
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 209e5b76c1bc..dbe0792fc9c1 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -945,7 +945,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
945 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | | 945 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
946 | MIPS_CPU_FPU | MIPS_CPU_32FPR | | 946 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
947 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | | 947 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
948 | MIPS_CPU_LLSC; | 948 | MIPS_CPU_LLSC | MIPS_CPU_BP_GHIST; |
949 | c->tlbsize = 64; | 949 | c->tlbsize = 64; |
950 | break; | 950 | break; |
951 | case PRID_IMP_R14000: | 951 | case PRID_IMP_R14000: |
@@ -960,7 +960,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
960 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | | 960 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
961 | MIPS_CPU_FPU | MIPS_CPU_32FPR | | 961 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
962 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | | 962 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
963 | MIPS_CPU_LLSC; | 963 | MIPS_CPU_LLSC | MIPS_CPU_BP_GHIST; |
964 | c->tlbsize = 64; | 964 | c->tlbsize = 64; |
965 | break; | 965 | break; |
966 | case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */ | 966 | case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */ |
@@ -1443,7 +1443,9 @@ void cpu_probe(void) | |||
1443 | case PRID_COMP_CAVIUM: | 1443 | case PRID_COMP_CAVIUM: |
1444 | cpu_probe_cavium(c, cpu); | 1444 | cpu_probe_cavium(c, cpu); |
1445 | break; | 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 | cpu_probe_ingenic(c, cpu); | 1449 | cpu_probe_ingenic(c, cpu); |
1448 | break; | 1450 | break; |
1449 | case PRID_COMP_NETLOGIC: | 1451 | case PRID_COMP_NETLOGIC: |
@@ -1478,6 +1480,10 @@ void cpu_probe(void) | |||
1478 | else | 1480 | else |
1479 | cpu_set_nofpu_opts(c); | 1481 | cpu_set_nofpu_opts(c); |
1480 | 1482 | ||
1483 | if (cpu_has_bp_ghist) | ||
1484 | write_c0_r10k_diag(read_c0_r10k_diag() | | ||
1485 | R10K_DIAG_E_GHIST); | ||
1486 | |||
1481 | if (cpu_has_mips_r2_r6) { | 1487 | if (cpu_has_mips_r2_r6) { |
1482 | c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; | 1488 | c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; |
1483 | /* R2 has Performance Counter Interrupt indicator */ | 1489 | /* R2 has Performance Counter Interrupt indicator */ |
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S index 95afd663cd45..4e4cc5b9a771 100644 --- a/arch/mips/kernel/head.S +++ b/arch/mips/kernel/head.S | |||
@@ -94,6 +94,22 @@ NESTED(kernel_entry, 16, sp) # kernel entry point | |||
94 | jr t0 | 94 | jr t0 |
95 | 0: | 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 | PTR_LA t0, __bss_start # clear .bss | 113 | PTR_LA t0, __bss_start # clear .bss |
98 | LONG_S zero, (t0) | 114 | LONG_S zero, (t0) |
99 | PTR_LA t1, __bss_stop - LONGSIZE | 115 | PTR_LA t1, __bss_stop - LONGSIZE |
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c index a74ec3ae557c..74f6752814d3 100644 --- a/arch/mips/kernel/i8259.c +++ b/arch/mips/kernel/i8259.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/irqdomain.h> | 15 | #include <linux/irqdomain.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/of_irq.h> | ||
17 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
18 | #include <linux/syscore_ops.h> | 19 | #include <linux/syscore_ops.h> |
19 | #include <linux/irq.h> | 20 | #include <linux/irq.h> |
@@ -21,6 +22,8 @@ | |||
21 | #include <asm/i8259.h> | 22 | #include <asm/i8259.h> |
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
23 | 24 | ||
25 | #include "../../drivers/irqchip/irqchip.h" | ||
26 | |||
24 | /* | 27 | /* |
25 | * This is the 'legacy' 8259A Programmable Interrupt Controller, | 28 | * This is the 'legacy' 8259A Programmable Interrupt Controller, |
26 | * present in the majority of PC/AT boxes. | 29 | * present in the majority of PC/AT boxes. |
@@ -327,7 +330,7 @@ static struct irq_domain_ops i8259A_ops = { | |||
327 | * driver compatibility reasons interrupts 0 - 15 to be the i8259 | 330 | * driver compatibility reasons interrupts 0 - 15 to be the i8259 |
328 | * interrupts even if the hardware uses a different interrupt numbering. | 331 | * interrupts even if the hardware uses a different interrupt numbering. |
329 | */ | 332 | */ |
330 | void __init init_i8259_irqs(void) | 333 | struct irq_domain * __init __init_i8259_irqs(struct device_node *node) |
331 | { | 334 | { |
332 | struct irq_domain *domain; | 335 | struct irq_domain *domain; |
333 | 336 | ||
@@ -336,10 +339,46 @@ void __init init_i8259_irqs(void) | |||
336 | 339 | ||
337 | init_8259A(0); | 340 | init_8259A(0); |
338 | 341 | ||
339 | domain = irq_domain_add_legacy(NULL, 16, I8259A_IRQ_BASE, 0, | 342 | domain = irq_domain_add_legacy(node, 16, I8259A_IRQ_BASE, 0, |
340 | &i8259A_ops, NULL); | 343 | &i8259A_ops, NULL); |
341 | if (!domain) | 344 | if (!domain) |
342 | panic("Failed to add i8259 IRQ domain"); | 345 | panic("Failed to add i8259 IRQ domain"); |
343 | 346 | ||
344 | setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2); | 347 | setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2); |
348 | return domain; | ||
349 | } | ||
350 | |||
351 | void __init init_i8259_irqs(void) | ||
352 | { | ||
353 | __init_i8259_irqs(NULL); | ||
354 | } | ||
355 | |||
356 | static void i8259_irq_dispatch(unsigned int irq, struct irq_desc *desc) | ||
357 | { | ||
358 | struct irq_domain *domain = irq_get_handler_data(irq); | ||
359 | int hwirq = i8259_irq(); | ||
360 | |||
361 | if (hwirq < 0) | ||
362 | return; | ||
363 | |||
364 | irq = irq_linear_revmap(domain, hwirq); | ||
365 | generic_handle_irq(irq); | ||
366 | } | ||
367 | |||
368 | int __init i8259_of_init(struct device_node *node, struct device_node *parent) | ||
369 | { | ||
370 | struct irq_domain *domain; | ||
371 | unsigned int parent_irq; | ||
372 | |||
373 | parent_irq = irq_of_parse_and_map(node, 0); | ||
374 | if (!parent_irq) { | ||
375 | pr_err("Failed to map i8259 parent IRQ\n"); | ||
376 | return -ENODEV; | ||
377 | } | ||
378 | |||
379 | domain = __init_i8259_irqs(node); | ||
380 | irq_set_handler_data(parent_irq, domain); | ||
381 | irq_set_chained_handler(parent_irq, i8259_irq_dispatch); | ||
382 | return 0; | ||
345 | } | 383 | } |
384 | IRQCHIP_DECLARE(i8259, "intel,i8259", i8259_of_init); | ||
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index 3c8a18a00a65..8eb5af805964 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c | |||
@@ -25,48 +25,6 @@ | |||
25 | #include <linux/atomic.h> | 25 | #include <linux/atomic.h> |
26 | #include <asm/uaccess.h> | 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 | * 'what should we do if we get a hw irq event on an illegal vector'. | 29 | * 'what should we do if we get a hw irq event on an illegal vector'. |
72 | * each architecture has to answer this themselves. | 30 | * each architecture has to answer this themselves. |
@@ -93,20 +51,10 @@ void __init init_IRQ(void) | |||
93 | { | 51 | { |
94 | int i; | 52 | int i; |
95 | 53 | ||
96 | #ifdef CONFIG_KGDB | ||
97 | if (kgdb_early_setup) | ||
98 | return; | ||
99 | #endif | ||
100 | |||
101 | for (i = 0; i < NR_IRQS; i++) | 54 | for (i = 0; i < NR_IRQS; i++) |
102 | irq_set_noprobe(i); | 55 | irq_set_noprobe(i); |
103 | 56 | ||
104 | arch_init_irq(); | 57 | arch_init_irq(); |
105 | |||
106 | #ifdef CONFIG_KGDB | ||
107 | if (!kgdb_early_setup) | ||
108 | kgdb_early_setup = 1; | ||
109 | #endif | ||
110 | } | 58 | } |
111 | 59 | ||
112 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 60 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c index 7afcc2f22c0d..de63d36af895 100644 --- a/arch/mips/kernel/kgdb.c +++ b/arch/mips/kernel/kgdb.c | |||
@@ -378,10 +378,6 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
378 | 378 | ||
379 | struct kgdb_arch arch_kgdb_ops; | 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 | int kgdb_arch_init(void) | 381 | int kgdb_arch_init(void) |
386 | { | 382 | { |
387 | union mips_instruction insn = { | 383 | union mips_instruction insn = { |
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index e303cb1ef2f4..b130033838ba 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/of_fdt.h> | 18 | #include <linux/of_fdt.h> |
19 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
20 | 20 | ||
21 | #include <asm/bootinfo.h> | ||
21 | #include <asm/page.h> | 22 | #include <asm/page.h> |
22 | #include <asm/prom.h> | 23 | #include <asm/prom.h> |
23 | 24 | ||
diff --git a/arch/mips/kernel/sysrq.c b/arch/mips/kernel/sysrq.c new file mode 100644 index 000000000000..5b539f5fc9d9 --- /dev/null +++ b/arch/mips/kernel/sysrq.c | |||
@@ -0,0 +1,77 @@ | |||
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); | ||
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index d2d1c1933bc9..2a7b38ed23f0 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -236,6 +236,7 @@ static void __show_regs(const struct pt_regs *regs) | |||
236 | { | 236 | { |
237 | const int field = 2 * sizeof(unsigned long); | 237 | const int field = 2 * sizeof(unsigned long); |
238 | unsigned int cause = regs->cp0_cause; | 238 | unsigned int cause = regs->cp0_cause; |
239 | unsigned int exccode; | ||
239 | int i; | 240 | int i; |
240 | 241 | ||
241 | show_regs_print_info(KERN_DEFAULT); | 242 | show_regs_print_info(KERN_DEFAULT); |
@@ -317,10 +318,10 @@ static void __show_regs(const struct pt_regs *regs) | |||
317 | } | 318 | } |
318 | printk("\n"); | 319 | printk("\n"); |
319 | 320 | ||
320 | printk("Cause : %08x\n", cause); | 321 | exccode = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE; |
322 | printk("Cause : %08x (ExcCode %02x)\n", cause, exccode); | ||
321 | 323 | ||
322 | cause = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE; | 324 | if (1 <= exccode && exccode <= 5) |
323 | if (1 <= cause && cause <= 5) | ||
324 | printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr); | 325 | printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr); |
325 | 326 | ||
326 | printk("PrId : %08x (%s)\n", read_c0_prid(), | 327 | printk("PrId : %08x (%s)\n", read_c0_prid(), |
@@ -2184,11 +2185,6 @@ void __init trap_init(void) | |||
2184 | 2185 | ||
2185 | check_wait(); | 2186 | check_wait(); |
2186 | 2187 | ||
2187 | #if defined(CONFIG_KGDB) | ||
2188 | if (kgdb_early_setup) | ||
2189 | return; /* Already done */ | ||
2190 | #endif | ||
2191 | |||
2192 | if (cpu_has_veic || cpu_has_vint) { | 2188 | if (cpu_has_veic || cpu_has_vint) { |
2193 | unsigned long size = 0x200 + VECTORSPACING*64; | 2189 | unsigned long size = 0x200 + VECTORSPACING*64; |
2194 | ebase = (unsigned long) | 2190 | ebase = (unsigned long) |
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 3b46f7ce9ca7..07d32a4aea60 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S | |||
@@ -125,8 +125,14 @@ SECTIONS | |||
125 | .exit.data : { | 125 | .exit.data : { |
126 | EXIT_DATA | 126 | EXIT_DATA |
127 | } | 127 | } |
128 | 128 | #ifdef CONFIG_SMP | |
129 | PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) | 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 | * Align to 64K in attempt to eliminate holes before the | 137 | * Align to 64K in attempt to eliminate holes before the |
132 | * .bss..swapper_pg_dir section at the start of .bss. This | 138 | * .bss..swapper_pg_dir section at the start of .bss. This |
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c index 32b9f21bfd85..167f35634709 100644 --- a/arch/mips/lib/dump_tlb.c +++ b/arch/mips/lib/dump_tlb.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | 9 | ||
10 | #include <asm/hazards.h> | ||
10 | #include <asm/mipsregs.h> | 11 | #include <asm/mipsregs.h> |
11 | #include <asm/page.h> | 12 | #include <asm/page.h> |
12 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
@@ -40,17 +41,20 @@ static inline const char *msk2str(unsigned int mask) | |||
40 | return ""; | 41 | return ""; |
41 | } | 42 | } |
42 | 43 | ||
43 | #define BARRIER() \ | ||
44 | __asm__ __volatile__( \ | ||
45 | ".set\tnoreorder\n\t" \ | ||
46 | "nop;nop;nop;nop;nop;nop;nop\n\t" \ | ||
47 | ".set\treorder"); | ||
48 | |||
49 | static void dump_tlb(int first, int last) | 44 | static void dump_tlb(int first, int last) |
50 | { | 45 | { |
51 | unsigned long s_entryhi, entryhi, asid; | 46 | unsigned long s_entryhi, entryhi, asid; |
52 | unsigned long long entrylo0, entrylo1; | 47 | unsigned long long entrylo0, entrylo1, pa; |
53 | unsigned int s_index, s_pagemask, pagemask, c0, c1, i; | 48 | unsigned int s_index, s_pagemask, pagemask, c0, c1, i; |
49 | #ifdef CONFIG_32BIT | ||
50 | bool xpa = cpu_has_xpa && (read_c0_pagegrain() & PG_ELPA); | ||
51 | int pwidth = xpa ? 11 : 8; | ||
52 | int vwidth = 8; | ||
53 | #else | ||
54 | bool xpa = false; | ||
55 | int pwidth = 11; | ||
56 | int vwidth = 11; | ||
57 | #endif | ||
54 | 58 | ||
55 | s_pagemask = read_c0_pagemask(); | 59 | s_pagemask = read_c0_pagemask(); |
56 | s_entryhi = read_c0_entryhi(); | 60 | s_entryhi = read_c0_entryhi(); |
@@ -59,46 +63,74 @@ static void dump_tlb(int first, int last) | |||
59 | 63 | ||
60 | for (i = first; i <= last; i++) { | 64 | for (i = first; i <= last; i++) { |
61 | write_c0_index(i); | 65 | write_c0_index(i); |
62 | BARRIER(); | 66 | mtc0_tlbr_hazard(); |
63 | tlb_read(); | 67 | tlb_read(); |
64 | BARRIER(); | 68 | tlb_read_hazard(); |
65 | pagemask = read_c0_pagemask(); | 69 | pagemask = read_c0_pagemask(); |
66 | entryhi = read_c0_entryhi(); | 70 | entryhi = read_c0_entryhi(); |
67 | entrylo0 = read_c0_entrylo0(); | 71 | entrylo0 = read_c0_entrylo0(); |
68 | entrylo1 = read_c0_entrylo1(); | 72 | entrylo1 = read_c0_entrylo1(); |
69 | 73 | ||
70 | /* Unused entries have a virtual address of CKSEG0. */ | 74 | /* EHINV bit marks entire entry as invalid */ |
71 | if ((entryhi & ~0x1ffffUL) != CKSEG0 | 75 | if (cpu_has_tlbinv && entryhi & MIPS_ENTRYHI_EHINV) |
72 | && (entryhi & 0xff) == asid) { | 76 | continue; |
73 | #ifdef CONFIG_32BIT | 77 | /* |
74 | int width = 8; | 78 | * Prior to tlbinv, unused entries have a virtual address of |
75 | #else | 79 | * CKSEG0. |
76 | int width = 11; | 80 | */ |
77 | #endif | 81 | if ((entryhi & ~0x1ffffUL) == CKSEG0) |
78 | /* | 82 | continue; |
79 | * Only print entries in use | 83 | /* |
80 | */ | 84 | * ASID takes effect in absence of G (global) bit. |
81 | printk("Index: %2d pgmask=%s ", i, msk2str(pagemask)); | 85 | * We check both G bits, even though architecturally they should |
86 | * match one another, because some revisions of the SB1 core may | ||
87 | * leave only a single G bit set after a machine check exception | ||
88 | * due to duplicate TLB entry. | ||
89 | */ | ||
90 | if (!((entrylo0 | entrylo1) & MIPS_ENTRYLO_G) && | ||
91 | (entryhi & 0xff) != asid) | ||
92 | continue; | ||
93 | |||
94 | /* | ||
95 | * Only print entries in use | ||
96 | */ | ||
97 | printk("Index: %2d pgmask=%s ", i, msk2str(pagemask)); | ||
82 | 98 | ||
83 | c0 = (entrylo0 >> 3) & 7; | 99 | c0 = (entrylo0 & MIPS_ENTRYLO_C) >> MIPS_ENTRYLO_C_SHIFT; |
84 | c1 = (entrylo1 >> 3) & 7; | 100 | c1 = (entrylo1 & MIPS_ENTRYLO_C) >> MIPS_ENTRYLO_C_SHIFT; |
85 | 101 | ||
86 | printk("va=%0*lx asid=%02lx\n", | 102 | printk("va=%0*lx asid=%02lx\n", |
87 | width, (entryhi & ~0x1fffUL), | 103 | vwidth, (entryhi & ~0x1fffUL), |
88 | entryhi & 0xff); | 104 | entryhi & 0xff); |
89 | printk("\t[pa=%0*llx c=%d d=%d v=%d g=%d] ", | 105 | /* RI/XI are in awkward places, so mask them off separately */ |
90 | width, | 106 | pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); |
91 | (entrylo0 << 6) & PAGE_MASK, c0, | 107 | if (xpa) |
92 | (entrylo0 & 4) ? 1 : 0, | 108 | pa |= (unsigned long long)readx_c0_entrylo0() << 30; |
93 | (entrylo0 & 2) ? 1 : 0, | 109 | pa = (pa << 6) & PAGE_MASK; |
94 | (entrylo0 & 1) ? 1 : 0); | 110 | printk("\t["); |
95 | printk("[pa=%0*llx c=%d d=%d v=%d g=%d]\n", | 111 | if (cpu_has_rixi) |
96 | width, | 112 | printk("ri=%d xi=%d ", |
97 | (entrylo1 << 6) & PAGE_MASK, c1, | 113 | (entrylo0 & MIPS_ENTRYLO_RI) ? 1 : 0, |
98 | (entrylo1 & 4) ? 1 : 0, | 114 | (entrylo0 & MIPS_ENTRYLO_XI) ? 1 : 0); |
99 | (entrylo1 & 2) ? 1 : 0, | 115 | printk("pa=%0*llx c=%d d=%d v=%d g=%d] [", |
100 | (entrylo1 & 1) ? 1 : 0); | 116 | pwidth, pa, c0, |
101 | } | 117 | (entrylo0 & MIPS_ENTRYLO_D) ? 1 : 0, |
118 | (entrylo0 & MIPS_ENTRYLO_V) ? 1 : 0, | ||
119 | (entrylo0 & MIPS_ENTRYLO_G) ? 1 : 0); | ||
120 | /* RI/XI are in awkward places, so mask them off separately */ | ||
121 | pa = entrylo1 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); | ||
122 | if (xpa) | ||
123 | pa |= (unsigned long long)readx_c0_entrylo1() << 30; | ||
124 | pa = (pa << 6) & PAGE_MASK; | ||
125 | if (cpu_has_rixi) | ||
126 | printk("ri=%d xi=%d ", | ||
127 | (entrylo1 & MIPS_ENTRYLO_RI) ? 1 : 0, | ||
128 | (entrylo1 & MIPS_ENTRYLO_XI) ? 1 : 0); | ||
129 | printk("pa=%0*llx c=%d d=%d v=%d g=%d]\n", | ||
130 | pwidth, pa, c1, | ||
131 | (entrylo1 & MIPS_ENTRYLO_D) ? 1 : 0, | ||
132 | (entrylo1 & MIPS_ENTRYLO_V) ? 1 : 0, | ||
133 | (entrylo1 & MIPS_ENTRYLO_G) ? 1 : 0); | ||
102 | } | 134 | } |
103 | printk("\n"); | 135 | printk("\n"); |
104 | 136 | ||
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c index 975a13855116..8e0d3cff8ae4 100644 --- a/arch/mips/lib/r3k_dump_tlb.c +++ b/arch/mips/lib/r3k_dump_tlb.c | |||
@@ -14,8 +14,6 @@ | |||
14 | #include <asm/pgtable.h> | 14 | #include <asm/pgtable.h> |
15 | #include <asm/tlbdebug.h> | 15 | #include <asm/tlbdebug.h> |
16 | 16 | ||
17 | extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */ | ||
18 | |||
19 | static void dump_tlb(int first, int last) | 17 | static void dump_tlb(int first, int last) |
20 | { | 18 | { |
21 | int i; | 19 | int i; |
@@ -35,8 +33,9 @@ static void dump_tlb(int first, int last) | |||
35 | entrylo0 = read_c0_entrylo0(); | 33 | entrylo0 = read_c0_entrylo0(); |
36 | 34 | ||
37 | /* Unused entries have a virtual address of KSEG0. */ | 35 | /* Unused entries have a virtual address of KSEG0. */ |
38 | if ((entryhi & PAGE_MASK) != KSEG0 | 36 | if ((entryhi & PAGE_MASK) != KSEG0 && |
39 | && (entryhi & ASID_MASK) == asid) { | 37 | (entrylo0 & R3K_ENTRYLO_G || |
38 | (entryhi & ASID_MASK) == asid)) { | ||
40 | /* | 39 | /* |
41 | * Only print entries in use | 40 | * Only print entries in use |
42 | */ | 41 | */ |
@@ -47,10 +46,10 @@ static void dump_tlb(int first, int last) | |||
47 | entryhi & PAGE_MASK, | 46 | entryhi & PAGE_MASK, |
48 | entryhi & ASID_MASK, | 47 | entryhi & ASID_MASK, |
49 | entrylo0 & PAGE_MASK, | 48 | entrylo0 & PAGE_MASK, |
50 | (entrylo0 & (1 << 11)) ? 1 : 0, | 49 | (entrylo0 & R3K_ENTRYLO_N) ? 1 : 0, |
51 | (entrylo0 & (1 << 10)) ? 1 : 0, | 50 | (entrylo0 & R3K_ENTRYLO_D) ? 1 : 0, |
52 | (entrylo0 & (1 << 9)) ? 1 : 0, | 51 | (entrylo0 & R3K_ENTRYLO_V) ? 1 : 0, |
53 | (entrylo0 & (1 << 8)) ? 1 : 0); | 52 | (entrylo0 & R3K_ENTRYLO_G) ? 1 : 0); |
54 | } | 53 | } |
55 | } | 54 | } |
56 | printk("\n"); | 55 | printk("\n"); |
diff --git a/arch/mips/loongson1/Kconfig b/arch/mips/loongson32/Kconfig index a2b796eaf3c3..7704f20529d6 100644 --- a/arch/mips/loongson1/Kconfig +++ b/arch/mips/loongson32/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | if MACH_LOONGSON1 | 1 | if MACH_LOONGSON32 |
2 | 2 | ||
3 | choice | 3 | choice |
4 | prompt "Machine Type" | 4 | prompt "Machine Type" |
@@ -10,7 +10,7 @@ config LOONGSON1_LS1B | |||
10 | select SYS_HAS_CPU_LOONGSON1B | 10 | select SYS_HAS_CPU_LOONGSON1B |
11 | select DMA_NONCOHERENT | 11 | select DMA_NONCOHERENT |
12 | select BOOT_ELF32 | 12 | select BOOT_ELF32 |
13 | select IRQ_CPU | 13 | select IRQ_MIPS_CPU |
14 | select SYS_SUPPORTS_32BIT_KERNEL | 14 | select SYS_SUPPORTS_32BIT_KERNEL |
15 | select SYS_SUPPORTS_LITTLE_ENDIAN | 15 | select SYS_SUPPORTS_LITTLE_ENDIAN |
16 | select SYS_SUPPORTS_HIGHMEM | 16 | select SYS_SUPPORTS_HIGHMEM |
@@ -58,4 +58,4 @@ config TIMER_USE_PWM3 | |||
58 | 58 | ||
59 | endchoice | 59 | endchoice |
60 | 60 | ||
61 | endif # MACH_LOONGSON1 | 61 | endif # MACH_LOONGSON32 |
diff --git a/arch/mips/loongson1/Makefile b/arch/mips/loongson32/Makefile index 9719c75886f5..5f4bd6e071ca 100644 --- a/arch/mips/loongson1/Makefile +++ b/arch/mips/loongson32/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Common code for all Loongson 1 based systems | 2 | # Common code for all Loongson 1 based systems |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_MACH_LOONGSON1) += common/ | 5 | obj-$(CONFIG_MACH_LOONGSON32) += common/ |
6 | 6 | ||
7 | # | 7 | # |
8 | # Loongson LS1B board | 8 | # Loongson LS1B board |
diff --git a/arch/mips/loongson1/Platform b/arch/mips/loongson32/Platform index 11863441dea3..ebb6dc290f0a 100644 --- a/arch/mips/loongson1/Platform +++ b/arch/mips/loongson32/Platform | |||
@@ -2,6 +2,6 @@ cflags-$(CONFIG_CPU_LOONGSON1) += \ | |||
2 | $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ | 2 | $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ |
3 | -Wa,-mips32r2 -Wa,--trap | 3 | -Wa,-mips32r2 -Wa,--trap |
4 | 4 | ||
5 | platform-$(CONFIG_MACH_LOONGSON1) += loongson1/ | 5 | platform-$(CONFIG_MACH_LOONGSON32) += loongson32/ |
6 | cflags-$(CONFIG_MACH_LOONGSON1) += -I$(srctree)/arch/mips/include/asm/mach-loongson1 | 6 | cflags-$(CONFIG_MACH_LOONGSON32) += -I$(srctree)/arch/mips/include/asm/mach-loongson32 |
7 | load-$(CONFIG_LOONGSON1_LS1B) += 0xffffffff80100000 | 7 | load-$(CONFIG_LOONGSON1_LS1B) += 0xffffffff80100000 |
diff --git a/arch/mips/loongson1/common/Makefile b/arch/mips/loongson32/common/Makefile index 723b4ce3b8f0..723b4ce3b8f0 100644 --- a/arch/mips/loongson1/common/Makefile +++ b/arch/mips/loongson32/common/Makefile | |||
diff --git a/arch/mips/loongson1/common/irq.c b/arch/mips/loongson32/common/irq.c index 455a7704a90f..455a7704a90f 100644 --- a/arch/mips/loongson1/common/irq.c +++ b/arch/mips/loongson32/common/irq.c | |||
diff --git a/arch/mips/loongson1/common/platform.c b/arch/mips/loongson32/common/platform.c index ddf1d4cbf31e..ddf1d4cbf31e 100644 --- a/arch/mips/loongson1/common/platform.c +++ b/arch/mips/loongson32/common/platform.c | |||
diff --git a/arch/mips/loongson1/common/prom.c b/arch/mips/loongson32/common/prom.c index 68600980ea49..68600980ea49 100644 --- a/arch/mips/loongson1/common/prom.c +++ b/arch/mips/loongson32/common/prom.c | |||
diff --git a/arch/mips/loongson1/common/reset.c b/arch/mips/loongson32/common/reset.c index c41e4ca56ab4..c41e4ca56ab4 100644 --- a/arch/mips/loongson1/common/reset.c +++ b/arch/mips/loongson32/common/reset.c | |||
diff --git a/arch/mips/loongson1/common/setup.c b/arch/mips/loongson32/common/setup.c index 62f41afee241..62f41afee241 100644 --- a/arch/mips/loongson1/common/setup.c +++ b/arch/mips/loongson32/common/setup.c | |||
diff --git a/arch/mips/loongson1/common/time.c b/arch/mips/loongson32/common/time.c index df0f850d6a5f..df0f850d6a5f 100644 --- a/arch/mips/loongson1/common/time.c +++ b/arch/mips/loongson32/common/time.c | |||
diff --git a/arch/mips/loongson1/ls1b/Makefile b/arch/mips/loongson32/ls1b/Makefile index 891eac482b82..891eac482b82 100644 --- a/arch/mips/loongson1/ls1b/Makefile +++ b/arch/mips/loongson32/ls1b/Makefile | |||
diff --git a/arch/mips/loongson1/ls1b/board.c b/arch/mips/loongson32/ls1b/board.c index 58daeea25739..58daeea25739 100644 --- a/arch/mips/loongson1/ls1b/board.c +++ b/arch/mips/loongson32/ls1b/board.c | |||
diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson64/Kconfig index 156de85b82cd..497912b38d8e 100644 --- a/arch/mips/loongson/Kconfig +++ b/arch/mips/loongson64/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | if MACH_LOONGSON | 1 | if MACH_LOONGSON64 |
2 | 2 | ||
3 | choice | 3 | choice |
4 | prompt "Machine Type" | 4 | prompt "Machine Type" |
@@ -15,7 +15,7 @@ config LEMOTE_FULOONG2E | |||
15 | select HW_HAS_PCI | 15 | select HW_HAS_PCI |
16 | select I8259 | 16 | select I8259 |
17 | select ISA | 17 | select ISA |
18 | select IRQ_CPU | 18 | select IRQ_MIPS_CPU |
19 | select SYS_SUPPORTS_32BIT_KERNEL | 19 | select SYS_SUPPORTS_32BIT_KERNEL |
20 | select SYS_SUPPORTS_64BIT_KERNEL | 20 | select SYS_SUPPORTS_64BIT_KERNEL |
21 | select SYS_SUPPORTS_LITTLE_ENDIAN | 21 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -44,7 +44,7 @@ config LEMOTE_MACH2F | |||
44 | select HAVE_CLK | 44 | select HAVE_CLK |
45 | select HW_HAS_PCI | 45 | select HW_HAS_PCI |
46 | select I8259 | 46 | select I8259 |
47 | select IRQ_CPU | 47 | select IRQ_MIPS_CPU |
48 | select ISA | 48 | select ISA |
49 | select SYS_HAS_CPU_LOONGSON2F | 49 | select SYS_HAS_CPU_LOONGSON2F |
50 | select SYS_HAS_EARLY_PRINTK | 50 | select SYS_HAS_EARLY_PRINTK |
@@ -73,7 +73,7 @@ config LOONGSON_MACH3X | |||
73 | select ISA | 73 | select ISA |
74 | select HT_PCI | 74 | select HT_PCI |
75 | select I8259 | 75 | select I8259 |
76 | select IRQ_CPU | 76 | select IRQ_MIPS_CPU |
77 | select NR_CPUS_DEFAULT_4 | 77 | select NR_CPUS_DEFAULT_4 |
78 | select SYS_HAS_CPU_LOONGSON3 | 78 | select SYS_HAS_CPU_LOONGSON3 |
79 | select SYS_HAS_EARLY_PRINTK | 79 | select SYS_HAS_EARLY_PRINTK |
@@ -155,4 +155,4 @@ config LOONGSON_MC146818 | |||
155 | config LEFI_FIRMWARE_INTERFACE | 155 | config LEFI_FIRMWARE_INTERFACE |
156 | bool | 156 | bool |
157 | 157 | ||
158 | endif # MACH_LOONGSON | 158 | endif # MACH_LOONGSON64 |
diff --git a/arch/mips/loongson/Makefile b/arch/mips/loongson64/Makefile index 7429994e7604..4fe3d88fc361 100644 --- a/arch/mips/loongson/Makefile +++ b/arch/mips/loongson64/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Common code for all Loongson based systems | 2 | # Common code for all Loongson based systems |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_MACH_LOONGSON) += common/ | 5 | obj-$(CONFIG_MACH_LOONGSON64) += common/ |
6 | 6 | ||
7 | # | 7 | # |
8 | # Lemote Fuloong mini-PC (Loongson 2E-based) | 8 | # Lemote Fuloong mini-PC (Loongson 2E-based) |
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson64/Platform index 0ac20eb84ecc..2e48e83d5524 100644 --- a/arch/mips/loongson/Platform +++ b/arch/mips/loongson64/Platform | |||
@@ -26,8 +26,8 @@ endif | |||
26 | # Loongson Machines' Support | 26 | # Loongson Machines' Support |
27 | # | 27 | # |
28 | 28 | ||
29 | platform-$(CONFIG_MACH_LOONGSON) += loongson/ | 29 | platform-$(CONFIG_MACH_LOONGSON64) += loongson64/ |
30 | cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely | 30 | cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely |
31 | load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000 | 31 | load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000 |
32 | load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000 | 32 | load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000 |
33 | load-$(CONFIG_LOONGSON_MACH3X) += 0xffffffff80200000 | 33 | load-$(CONFIG_LOONGSON_MACH3X) += 0xffffffff80200000 |
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson64/common/Makefile index f2e8153e44f5..f2e8153e44f5 100644 --- a/arch/mips/loongson/common/Makefile +++ b/arch/mips/loongson64/common/Makefile | |||
diff --git a/arch/mips/loongson/common/bonito-irq.c b/arch/mips/loongson64/common/bonito-irq.c index cc0e4fd548e6..cc0e4fd548e6 100644 --- a/arch/mips/loongson/common/bonito-irq.c +++ b/arch/mips/loongson64/common/bonito-irq.c | |||
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson64/common/cmdline.c index 72fed003a536..72fed003a536 100644 --- a/arch/mips/loongson/common/cmdline.c +++ b/arch/mips/loongson64/common/cmdline.c | |||
diff --git a/arch/mips/loongson/common/cs5536/Makefile b/arch/mips/loongson64/common/cs5536/Makefile index f12e64007347..f12e64007347 100644 --- a/arch/mips/loongson/common/cs5536/Makefile +++ b/arch/mips/loongson64/common/cs5536/Makefile | |||
diff --git a/arch/mips/loongson/common/cs5536/cs5536_acc.c b/arch/mips/loongson64/common/cs5536/cs5536_acc.c index ab4d6cc57384..ab4d6cc57384 100644 --- a/arch/mips/loongson/common/cs5536/cs5536_acc.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_acc.c | |||
diff --git a/arch/mips/loongson/common/cs5536/cs5536_ehci.c b/arch/mips/loongson64/common/cs5536/cs5536_ehci.c index ec2e360267a8..ec2e360267a8 100644 --- a/arch/mips/loongson/common/cs5536/cs5536_ehci.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_ehci.c | |||
diff --git a/arch/mips/loongson/common/cs5536/cs5536_ide.c b/arch/mips/loongson64/common/cs5536/cs5536_ide.c index a73414d9ee51..a73414d9ee51 100644 --- a/arch/mips/loongson/common/cs5536/cs5536_ide.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_ide.c | |||
diff --git a/arch/mips/loongson/common/cs5536/cs5536_isa.c b/arch/mips/loongson64/common/cs5536/cs5536_isa.c index 924be39e7733..924be39e7733 100644 --- a/arch/mips/loongson/common/cs5536/cs5536_isa.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_isa.c | |||
diff --git a/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c index 12c75db23420..12c75db23420 100644 --- a/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c | |||
diff --git a/arch/mips/loongson/common/cs5536/cs5536_ohci.c b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c index f7c905e50dc4..f7c905e50dc4 100644 --- a/arch/mips/loongson/common/cs5536/cs5536_ohci.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c | |||
diff --git a/arch/mips/loongson/common/cs5536/cs5536_pci.c b/arch/mips/loongson64/common/cs5536/cs5536_pci.c index b739723205f8..b739723205f8 100644 --- a/arch/mips/loongson/common/cs5536/cs5536_pci.c +++ b/arch/mips/loongson64/common/cs5536/cs5536_pci.c | |||
diff --git a/arch/mips/loongson/common/dma-swiotlb.c b/arch/mips/loongson64/common/dma-swiotlb.c index 2c6b989c1bc4..2c6b989c1bc4 100644 --- a/arch/mips/loongson/common/dma-swiotlb.c +++ b/arch/mips/loongson64/common/dma-swiotlb.c | |||
diff --git a/arch/mips/loongson/common/early_printk.c b/arch/mips/loongson64/common/early_printk.c index 6ca632e529dc..6ca632e529dc 100644 --- a/arch/mips/loongson/common/early_printk.c +++ b/arch/mips/loongson64/common/early_printk.c | |||
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson64/common/env.c index 22f04ca2ff3e..22f04ca2ff3e 100644 --- a/arch/mips/loongson/common/env.c +++ b/arch/mips/loongson64/common/env.c | |||
diff --git a/arch/mips/loongson/common/init.c b/arch/mips/loongson64/common/init.c index 9b987fe98b5b..9b987fe98b5b 100644 --- a/arch/mips/loongson/common/init.c +++ b/arch/mips/loongson64/common/init.c | |||
diff --git a/arch/mips/loongson/common/irq.c b/arch/mips/loongson64/common/irq.c index 687003b19b45..687003b19b45 100644 --- a/arch/mips/loongson/common/irq.c +++ b/arch/mips/loongson64/common/irq.c | |||
diff --git a/arch/mips/loongson/common/machtype.c b/arch/mips/loongson64/common/machtype.c index f2807bc662a3..f2807bc662a3 100644 --- a/arch/mips/loongson/common/machtype.c +++ b/arch/mips/loongson64/common/machtype.c | |||
diff --git a/arch/mips/loongson/common/mem.c b/arch/mips/loongson64/common/mem.c index b01d52473da8..b01d52473da8 100644 --- a/arch/mips/loongson/common/mem.c +++ b/arch/mips/loongson64/common/mem.c | |||
diff --git a/arch/mips/loongson/common/pci.c b/arch/mips/loongson64/common/pci.c index 4e2575643781..4e2575643781 100644 --- a/arch/mips/loongson/common/pci.c +++ b/arch/mips/loongson64/common/pci.c | |||
diff --git a/arch/mips/loongson/common/platform.c b/arch/mips/loongson64/common/platform.c index 0ed38321a9a2..0ed38321a9a2 100644 --- a/arch/mips/loongson/common/platform.c +++ b/arch/mips/loongson64/common/platform.c | |||
diff --git a/arch/mips/loongson/common/pm.c b/arch/mips/loongson64/common/pm.c index a6b67ccfc811..a6b67ccfc811 100644 --- a/arch/mips/loongson/common/pm.c +++ b/arch/mips/loongson64/common/pm.c | |||
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson64/common/reset.c index a60715e11306..a60715e11306 100644 --- a/arch/mips/loongson/common/reset.c +++ b/arch/mips/loongson64/common/reset.c | |||
diff --git a/arch/mips/loongson/common/rtc.c b/arch/mips/loongson64/common/rtc.c index b5709af09f7f..b5709af09f7f 100644 --- a/arch/mips/loongson/common/rtc.c +++ b/arch/mips/loongson64/common/rtc.c | |||
diff --git a/arch/mips/loongson/common/serial.c b/arch/mips/loongson64/common/serial.c index c23fa1373729..ffefc1cb2612 100644 --- a/arch/mips/loongson/common/serial.c +++ b/arch/mips/loongson64/common/serial.c | |||
@@ -11,7 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/init.h> | 14 | #include <linux/module.h> |
15 | #include <linux/serial_8250.h> | 15 | #include <linux/serial_8250.h> |
16 | 16 | ||
17 | #include <asm/bootinfo.h> | 17 | #include <asm/bootinfo.h> |
@@ -108,5 +108,10 @@ static int __init serial_init(void) | |||
108 | 108 | ||
109 | return platform_device_register(&uart8250_device); | 109 | return platform_device_register(&uart8250_device); |
110 | } | 110 | } |
111 | module_init(serial_init); | ||
111 | 112 | ||
112 | device_initcall(serial_init); | 113 | static void __init serial_exit(void) |
114 | { | ||
115 | platform_device_unregister(&uart8250_device); | ||
116 | } | ||
117 | module_exit(serial_exit); | ||
diff --git a/arch/mips/loongson/common/setup.c b/arch/mips/loongson64/common/setup.c index d477dd6bb326..d477dd6bb326 100644 --- a/arch/mips/loongson/common/setup.c +++ b/arch/mips/loongson64/common/setup.c | |||
diff --git a/arch/mips/loongson/common/time.c b/arch/mips/loongson64/common/time.c index e1a5382ad47e..e1a5382ad47e 100644 --- a/arch/mips/loongson/common/time.c +++ b/arch/mips/loongson64/common/time.c | |||
diff --git a/arch/mips/loongson/common/uart_base.c b/arch/mips/loongson64/common/uart_base.c index 9de559d58e1f..9de559d58e1f 100644 --- a/arch/mips/loongson/common/uart_base.c +++ b/arch/mips/loongson64/common/uart_base.c | |||
diff --git a/arch/mips/loongson/fuloong-2e/Makefile b/arch/mips/loongson64/fuloong-2e/Makefile index b7622720c1ad..b7622720c1ad 100644 --- a/arch/mips/loongson/fuloong-2e/Makefile +++ b/arch/mips/loongson64/fuloong-2e/Makefile | |||
diff --git a/arch/mips/loongson/fuloong-2e/irq.c b/arch/mips/loongson64/fuloong-2e/irq.c index ef5ec8f3de5f..ef5ec8f3de5f 100644 --- a/arch/mips/loongson/fuloong-2e/irq.c +++ b/arch/mips/loongson64/fuloong-2e/irq.c | |||
diff --git a/arch/mips/loongson/fuloong-2e/reset.c b/arch/mips/loongson64/fuloong-2e/reset.c index da4d2ae2a1f8..da4d2ae2a1f8 100644 --- a/arch/mips/loongson/fuloong-2e/reset.c +++ b/arch/mips/loongson64/fuloong-2e/reset.c | |||
diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson64/lemote-2f/Makefile index 4f9eaa328a16..4f9eaa328a16 100644 --- a/arch/mips/loongson/lemote-2f/Makefile +++ b/arch/mips/loongson64/lemote-2f/Makefile | |||
diff --git a/arch/mips/loongson/lemote-2f/clock.c b/arch/mips/loongson64/lemote-2f/clock.c index 462e34d46b4a..462e34d46b4a 100644 --- a/arch/mips/loongson/lemote-2f/clock.c +++ b/arch/mips/loongson64/lemote-2f/clock.c | |||
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.c b/arch/mips/loongson64/lemote-2f/ec_kb3310b.c index 2b666d3a3947..2b666d3a3947 100644 --- a/arch/mips/loongson/lemote-2f/ec_kb3310b.c +++ b/arch/mips/loongson64/lemote-2f/ec_kb3310b.c | |||
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.h b/arch/mips/loongson64/lemote-2f/ec_kb3310b.h index 5a3f1860d4d2..5a3f1860d4d2 100644 --- a/arch/mips/loongson/lemote-2f/ec_kb3310b.h +++ b/arch/mips/loongson64/lemote-2f/ec_kb3310b.h | |||
diff --git a/arch/mips/loongson/lemote-2f/irq.c b/arch/mips/loongson64/lemote-2f/irq.c index cab5f43e0e29..cab5f43e0e29 100644 --- a/arch/mips/loongson/lemote-2f/irq.c +++ b/arch/mips/loongson64/lemote-2f/irq.c | |||
diff --git a/arch/mips/loongson/lemote-2f/machtype.c b/arch/mips/loongson64/lemote-2f/machtype.c index b55e6eece5e0..b55e6eece5e0 100644 --- a/arch/mips/loongson/lemote-2f/machtype.c +++ b/arch/mips/loongson64/lemote-2f/machtype.c | |||
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson64/lemote-2f/pm.c index cac4d382ea73..cac4d382ea73 100644 --- a/arch/mips/loongson/lemote-2f/pm.c +++ b/arch/mips/loongson64/lemote-2f/pm.c | |||
diff --git a/arch/mips/loongson/lemote-2f/reset.c b/arch/mips/loongson64/lemote-2f/reset.c index a26ca7fcd7e0..a26ca7fcd7e0 100644 --- a/arch/mips/loongson/lemote-2f/reset.c +++ b/arch/mips/loongson64/lemote-2f/reset.c | |||
diff --git a/arch/mips/loongson/loongson-3/Makefile b/arch/mips/loongson64/loongson-3/Makefile index 622fead5ebc9..622fead5ebc9 100644 --- a/arch/mips/loongson/loongson-3/Makefile +++ b/arch/mips/loongson64/loongson-3/Makefile | |||
diff --git a/arch/mips/loongson/loongson-3/cop2-ex.c b/arch/mips/loongson64/loongson-3/cop2-ex.c index ea13764d0a03..ea13764d0a03 100644 --- a/arch/mips/loongson/loongson-3/cop2-ex.c +++ b/arch/mips/loongson64/loongson-3/cop2-ex.c | |||
diff --git a/arch/mips/loongson/loongson-3/hpet.c b/arch/mips/loongson64/loongson-3/hpet.c index 5c21cd3bd339..5c21cd3bd339 100644 --- a/arch/mips/loongson/loongson-3/hpet.c +++ b/arch/mips/loongson64/loongson-3/hpet.c | |||
diff --git a/arch/mips/loongson/loongson-3/irq.c b/arch/mips/loongson64/loongson-3/irq.c index 0f75b6b3d218..0f75b6b3d218 100644 --- a/arch/mips/loongson/loongson-3/irq.c +++ b/arch/mips/loongson64/loongson-3/irq.c | |||
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c index 12d14ed48778..12d14ed48778 100644 --- a/arch/mips/loongson/loongson-3/numa.c +++ b/arch/mips/loongson64/loongson-3/numa.c | |||
diff --git a/arch/mips/loongson/loongson-3/platform.c b/arch/mips/loongson64/loongson-3/platform.c index 25a97cc0ee33..25a97cc0ee33 100644 --- a/arch/mips/loongson/loongson-3/platform.c +++ b/arch/mips/loongson64/loongson-3/platform.c | |||
diff --git a/arch/mips/loongson/loongson-3/smp.c b/arch/mips/loongson64/loongson-3/smp.c index 509877c6e9d9..509877c6e9d9 100644 --- a/arch/mips/loongson/loongson-3/smp.c +++ b/arch/mips/loongson64/loongson-3/smp.c | |||
diff --git a/arch/mips/loongson/loongson-3/smp.h b/arch/mips/loongson64/loongson-3/smp.h index d98ff654b7d7..d98ff654b7d7 100644 --- a/arch/mips/loongson/loongson-3/smp.h +++ b/arch/mips/loongson64/loongson-3/smp.h | |||
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 2e03ab173591..7f660dc67596 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -295,7 +295,7 @@ static void r4k_blast_icache_page_setup(void) | |||
295 | 295 | ||
296 | static void (*r4k_blast_icache_user_page)(unsigned long addr); | 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 | unsigned long ic_lsize = cpu_icache_line_size(); | 300 | unsigned long ic_lsize = cpu_icache_line_size(); |
301 | 301 | ||
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c index 8d909dbbf37f..596e18458e04 100644 --- a/arch/mips/mm/c-tx39.c +++ b/arch/mips/mm/c-tx39.c | |||
@@ -28,8 +28,6 @@ static unsigned long icache_size, dcache_size; /* Size in bytes */ | |||
28 | 28 | ||
29 | #include <asm/r4kcache.h> | 29 | #include <asm/r4kcache.h> |
30 | 30 | ||
31 | extern int r3k_have_wired_reg; /* in r3k-tlb.c */ | ||
32 | |||
33 | /* This sequence is required to ensure icache is disabled immediately */ | 31 | /* This sequence is required to ensure icache is disabled immediately */ |
34 | #define TX39_STOP_STREAMING() \ | 32 | #define TX39_STOP_STREAMING() \ |
35 | __asm__ __volatile__( \ | 33 | __asm__ __volatile__( \ |
@@ -383,8 +381,6 @@ void tx39_cache_init(void) | |||
383 | case CPU_TX3927: | 381 | case CPU_TX3927: |
384 | default: | 382 | default: |
385 | /* TX39/H2,H3 core (writeback 2way-set-associative cache) */ | 383 | /* TX39/H2,H3 core (writeback 2way-set-associative cache) */ |
386 | r3k_have_wired_reg = 1; | ||
387 | write_c0_wired(0); /* set 8 on reset... */ | ||
388 | /* board-dependent init code may set WBON */ | 384 | /* board-dependent init code may set WBON */ |
389 | 385 | ||
390 | __flush_cache_vmap = tx39__flush_cache_vmap; | 386 | __flush_cache_vmap = tx39__flush_cache_vmap; |
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 609d1241b0c4..eeaf0245c3b1 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -262,12 +262,13 @@ static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, | |||
262 | plat_unmap_dma_mem(dev, dma_addr, size, direction); | 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 | int nents, enum dma_data_direction direction, struct dma_attrs *attrs) | 266 | int nents, enum dma_data_direction direction, struct dma_attrs *attrs) |
267 | { | 267 | { |
268 | int i; | 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 | if (!plat_device_is_coherent(dev)) | 272 | if (!plat_device_is_coherent(dev)) |
272 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 273 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
273 | direction); | 274 | direction); |
@@ -291,13 +292,14 @@ static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page, | |||
291 | return plat_map_dma_mem_page(dev, page) + offset; | 292 | return plat_map_dma_mem_page(dev, page) + offset; |
292 | } | 293 | } |
293 | 294 | ||
294 | static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg, | 295 | static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, |
295 | int nhwentries, enum dma_data_direction direction, | 296 | int nhwentries, enum dma_data_direction direction, |
296 | struct dma_attrs *attrs) | 297 | struct dma_attrs *attrs) |
297 | { | 298 | { |
298 | int i; | 299 | int i; |
300 | struct scatterlist *sg; | ||
299 | 301 | ||
300 | for (i = 0; i < nhwentries; i++, sg++) { | 302 | for_each_sg(sglist, sg, nhwentries, i) { |
301 | if (!plat_device_is_coherent(dev) && | 303 | if (!plat_device_is_coherent(dev) && |
302 | direction != DMA_TO_DEVICE) | 304 | direction != DMA_TO_DEVICE) |
303 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 305 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
@@ -324,26 +326,34 @@ static void mips_dma_sync_single_for_device(struct device *dev, | |||
324 | } | 326 | } |
325 | 327 | ||
326 | static void mips_dma_sync_sg_for_cpu(struct device *dev, | 328 | static void mips_dma_sync_sg_for_cpu(struct device *dev, |
327 | struct scatterlist *sg, int nelems, enum dma_data_direction direction) | 329 | struct scatterlist *sglist, int nelems, |
330 | enum dma_data_direction direction) | ||
328 | { | 331 | { |
329 | int i; | 332 | int i; |
333 | struct scatterlist *sg; | ||
330 | 334 | ||
331 | if (cpu_needs_post_dma_flush(dev)) | 335 | if (cpu_needs_post_dma_flush(dev)) { |
332 | for (i = 0; i < nelems; i++, sg++) | 336 | for_each_sg(sglist, sg, nelems, i) { |
333 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 337 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
334 | direction); | 338 | direction); |
339 | } | ||
340 | } | ||
335 | plat_post_dma_flush(dev); | 341 | plat_post_dma_flush(dev); |
336 | } | 342 | } |
337 | 343 | ||
338 | static void mips_dma_sync_sg_for_device(struct device *dev, | 344 | static void mips_dma_sync_sg_for_device(struct device *dev, |
339 | struct scatterlist *sg, int nelems, enum dma_data_direction direction) | 345 | struct scatterlist *sglist, int nelems, |
346 | enum dma_data_direction direction) | ||
340 | { | 347 | { |
341 | int i; | 348 | int i; |
349 | struct scatterlist *sg; | ||
342 | 350 | ||
343 | if (!plat_device_is_coherent(dev)) | 351 | if (!plat_device_is_coherent(dev)) { |
344 | for (i = 0; i < nelems; i++, sg++) | 352 | for_each_sg(sglist, sg, nelems, i) { |
345 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 353 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
346 | direction); | 354 | direction); |
355 | } | ||
356 | } | ||
347 | } | 357 | } |
348 | 358 | ||
349 | int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 359 | int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c index 4094bbd42adf..2b75b8f880ed 100644 --- a/arch/mips/mm/tlb-r3k.c +++ b/arch/mips/mm/tlb-r3k.c | |||
@@ -36,30 +36,33 @@ extern void build_tlb_refill_handler(void); | |||
36 | "nop\n\t" \ | 36 | "nop\n\t" \ |
37 | ".set pop\n\t") | 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 | /* TLB operations. */ | 41 | /* TLB operations. */ |
42 | void local_flush_tlb_all(void) | 42 | static void local_flush_tlb_from(int entry) |
43 | { | 43 | { |
44 | unsigned long flags; | ||
45 | unsigned long old_ctx; | 44 | unsigned long old_ctx; |
46 | int entry; | ||
47 | |||
48 | #ifdef DEBUG_TLB | ||
49 | printk("[tlball]"); | ||
50 | #endif | ||
51 | 45 | ||
52 | local_irq_save(flags); | ||
53 | old_ctx = read_c0_entryhi() & ASID_MASK; | 46 | old_ctx = read_c0_entryhi() & ASID_MASK; |
54 | write_c0_entrylo0(0); | 47 | write_c0_entrylo0(0); |
55 | entry = r3k_have_wired_reg ? read_c0_wired() : 8; | 48 | while (entry < current_cpu_data.tlbsize) { |
56 | for (; entry < current_cpu_data.tlbsize; entry++) { | ||
57 | write_c0_index(entry << 8); | 49 | write_c0_index(entry << 8); |
58 | write_c0_entryhi((entry | 0x80000) << 12); | 50 | write_c0_entryhi((entry | 0x80000) << 12); |
59 | BARRIER; | 51 | entry++; /* BARRIER */ |
60 | tlb_write_indexed(); | 52 | tlb_write_indexed(); |
61 | } | 53 | } |
62 | write_c0_entryhi(old_ctx); | 54 | write_c0_entryhi(old_ctx); |
55 | } | ||
56 | |||
57 | void local_flush_tlb_all(void) | ||
58 | { | ||
59 | unsigned long flags; | ||
60 | |||
61 | #ifdef DEBUG_TLB | ||
62 | printk("[tlball]"); | ||
63 | #endif | ||
64 | local_irq_save(flags); | ||
65 | local_flush_tlb_from(r3k_have_wired_reg ? read_c0_wired() : 8); | ||
63 | local_irq_restore(flags); | 66 | local_irq_restore(flags); |
64 | } | 67 | } |
65 | 68 | ||
@@ -277,7 +280,13 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
277 | 280 | ||
278 | void tlb_init(void) | 281 | void tlb_init(void) |
279 | { | 282 | { |
280 | local_flush_tlb_all(); | 283 | switch (current_cpu_type()) { |
281 | 284 | case CPU_TX3922: | |
285 | case CPU_TX3927: | ||
286 | r3k_have_wired_reg = 1; | ||
287 | write_c0_wired(0); /* Set to 8 on reset... */ | ||
288 | break; | ||
289 | } | ||
290 | local_flush_tlb_from(0); | ||
282 | build_tlb_refill_handler(); | 291 | build_tlb_refill_handler(); |
283 | } | 292 | } |
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index 08318ecb803a..5037d5868cef 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -423,7 +423,7 @@ int __init has_transparent_hugepage(void) | |||
423 | * lifetime of the system | 423 | * lifetime of the system |
424 | */ | 424 | */ |
425 | 425 | ||
426 | int temp_tlb_entry __cpuinitdata; | 426 | int temp_tlb_entry; |
427 | 427 | ||
428 | __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | 428 | __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, |
429 | unsigned long entryhi, unsigned long pagemask) | 429 | unsigned long entryhi, unsigned long pagemask) |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 97c87027c17f..323d1d302f2b 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <asm/uasm.h> | 35 | #include <asm/uasm.h> |
36 | #include <asm/setup.h> | 36 | #include <asm/setup.h> |
37 | 37 | ||
38 | static int __cpuinitdata mips_xpa_disabled; | 38 | static int mips_xpa_disabled; |
39 | 39 | ||
40 | static int __init xpa_disable(char *s) | 40 | static int __init xpa_disable(char *s) |
41 | { | 41 | { |
@@ -1608,23 +1608,32 @@ build_pte_present(u32 **p, struct uasm_reloc **r, | |||
1608 | int pte, int ptr, int scratch, enum label_id lid) | 1608 | int pte, int ptr, int scratch, enum label_id lid) |
1609 | { | 1609 | { |
1610 | int t = scratch >= 0 ? scratch : pte; | 1610 | int t = scratch >= 0 ? scratch : pte; |
1611 | int cur = pte; | ||
1611 | 1612 | ||
1612 | if (cpu_has_rixi) { | 1613 | if (cpu_has_rixi) { |
1613 | if (use_bbit_insns()) { | 1614 | if (use_bbit_insns()) { |
1614 | uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid); | 1615 | uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid); |
1615 | uasm_i_nop(p); | 1616 | uasm_i_nop(p); |
1616 | } else { | 1617 | } else { |
1617 | uasm_i_srl(p, t, pte, _PAGE_PRESENT_SHIFT); | 1618 | if (_PAGE_PRESENT_SHIFT) { |
1618 | uasm_i_andi(p, t, t, 1); | 1619 | uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); |
1620 | cur = t; | ||
1621 | } | ||
1622 | uasm_i_andi(p, t, cur, 1); | ||
1619 | uasm_il_beqz(p, r, t, lid); | 1623 | uasm_il_beqz(p, r, t, lid); |
1620 | if (pte == t) | 1624 | if (pte == t) |
1621 | /* You lose the SMP race :-(*/ | 1625 | /* You lose the SMP race :-(*/ |
1622 | iPTE_LW(p, pte, ptr); | 1626 | iPTE_LW(p, pte, ptr); |
1623 | } | 1627 | } |
1624 | } else { | 1628 | } else { |
1625 | uasm_i_srl(p, t, pte, _PAGE_PRESENT_SHIFT); | 1629 | if (_PAGE_PRESENT_SHIFT) { |
1626 | uasm_i_andi(p, t, t, 3); | 1630 | uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); |
1627 | uasm_i_xori(p, t, t, 3); | 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 | uasm_il_bnez(p, r, t, lid); | 1637 | uasm_il_bnez(p, r, t, lid); |
1629 | if (pte == t) | 1638 | if (pte == t) |
1630 | /* You lose the SMP race :-(*/ | 1639 | /* You lose the SMP race :-(*/ |
@@ -1652,10 +1661,16 @@ build_pte_writable(u32 **p, struct uasm_reloc **r, | |||
1652 | enum label_id lid) | 1661 | enum label_id lid) |
1653 | { | 1662 | { |
1654 | int t = scratch >= 0 ? scratch : pte; | 1663 | int t = scratch >= 0 ? scratch : pte; |
1664 | int cur = pte; | ||
1655 | 1665 | ||
1656 | uasm_i_srl(p, t, pte, _PAGE_PRESENT_SHIFT); | 1666 | if (_PAGE_PRESENT_SHIFT) { |
1657 | uasm_i_andi(p, t, t, 5); | 1667 | uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); |
1658 | uasm_i_xori(p, t, t, 5); | 1668 | cur = t; |
1669 | } | ||
1670 | uasm_i_andi(p, t, cur, | ||
1671 | (_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT); | ||
1672 | uasm_i_xori(p, t, t, | ||
1673 | (_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT); | ||
1659 | uasm_il_bnez(p, r, t, lid); | 1674 | uasm_il_bnez(p, r, t, lid); |
1660 | if (pte == t) | 1675 | if (pte == t) |
1661 | /* You lose the SMP race :-(*/ | 1676 | /* You lose the SMP race :-(*/ |
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile index 6510ace272d4..ea35587a5c29 100644 --- a/arch/mips/mti-malta/Makefile +++ b/arch/mips/mti-malta/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | # Copyright (C) 2008 Wind River Systems, Inc. | 5 | # Copyright (C) 2008 Wind River Systems, Inc. |
6 | # written by Ralf Baechle <ralf@linux-mips.org> | 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 | malta-int.o malta-memory.o malta-platform.o \ | 9 | malta-int.o malta-memory.o malta-platform.o \ |
10 | malta-reset.o malta-setup.o malta-time.o | 10 | malta-reset.o malta-setup.o malta-time.o |
11 | 11 | ||
diff --git a/arch/mips/mti-malta/malta-dt.c b/arch/mips/mti-malta/malta-dt.c new file mode 100644 index 000000000000..47a22889285f --- /dev/null +++ b/arch/mips/mti-malta/malta-dt.c | |||
@@ -0,0 +1,34 @@ | |||
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); | ||
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c index db7c9e5826a6..9d1e7f5ec36c 100644 --- a/arch/mips/mti-malta/malta-setup.c +++ b/arch/mips/mti-malta/malta-setup.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/ioport.h> | 22 | #include <linux/ioport.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/of_fdt.h> | ||
24 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
25 | #include <linux/screen_info.h> | 26 | #include <linux/screen_info.h> |
26 | #include <linux/time.h> | 27 | #include <linux/time.h> |
@@ -31,6 +32,7 @@ | |||
31 | #include <asm/mips-boards/malta.h> | 32 | #include <asm/mips-boards/malta.h> |
32 | #include <asm/mips-boards/maltaint.h> | 33 | #include <asm/mips-boards/maltaint.h> |
33 | #include <asm/dma.h> | 34 | #include <asm/dma.h> |
35 | #include <asm/prom.h> | ||
34 | #include <asm/traps.h> | 36 | #include <asm/traps.h> |
35 | #ifdef CONFIG_VT | 37 | #ifdef CONFIG_VT |
36 | #include <linux/console.h> | 38 | #include <linux/console.h> |
@@ -249,6 +251,8 @@ void __init plat_mem_setup(void) | |||
249 | { | 251 | { |
250 | unsigned int i; | 252 | unsigned int i; |
251 | 253 | ||
254 | __dt_setup_arch(__dtb_start); | ||
255 | |||
252 | if (config_enabled(CONFIG_EVA)) | 256 | if (config_enabled(CONFIG_EVA)) |
253 | /* EVA has already been configured in mach-malta/kernel-init.h */ | 257 | /* EVA has already been configured in mach-malta/kernel-init.h */ |
254 | pr_info("Enhanced Virtual Addressing (EVA) activated\n"); | 258 | pr_info("Enhanced Virtual Addressing (EVA) activated\n"); |
diff --git a/arch/mips/net/Makefile b/arch/mips/net/Makefile index ae74b3a91f5c..8c2771401f54 100644 --- a/arch/mips/net/Makefile +++ b/arch/mips/net/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | # MIPS networking code | 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 |
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index e23fdf2a9c80..0c4a133f6216 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
23 | #include <asm/asm.h> | ||
23 | #include <asm/bitops.h> | 24 | #include <asm/bitops.h> |
24 | #include <asm/cacheflush.h> | 25 | #include <asm/cacheflush.h> |
25 | #include <asm/cpu-features.h> | 26 | #include <asm/cpu-features.h> |
@@ -28,14 +29,14 @@ | |||
28 | #include "bpf_jit.h" | 29 | #include "bpf_jit.h" |
29 | 30 | ||
30 | /* ABI | 31 | /* ABI |
31 | * | 32 | * r_skb_hl SKB header length |
32 | * s0 1st scratch register | 33 | * r_data SKB data pointer |
33 | * s1 2nd scratch register | 34 | * r_off Offset |
34 | * s2 offset register | 35 | * r_A BPF register A |
35 | * s3 BPF register A | 36 | * r_X BPF register X |
36 | * s4 BPF register X | 37 | * r_skb *skb |
37 | * s5 *skb | 38 | * r_M *scratch memory |
38 | * s6 *scratch memory | 39 | * r_skb_len SKB length |
39 | * | 40 | * |
40 | * On entry (*bpf_func)(*skb, *filter) | 41 | * On entry (*bpf_func)(*skb, *filter) |
41 | * a0 = MIPS_R_A0 = skb; | 42 | * a0 = MIPS_R_A0 = skb; |
@@ -63,44 +64,8 @@ | |||
63 | * ---------------------------------------------------- | 64 | * ---------------------------------------------------- |
64 | */ | 65 | */ |
65 | 66 | ||
66 | #define RSIZE (sizeof(unsigned long)) | ||
67 | #define ptr typeof(unsigned long) | 67 | #define ptr typeof(unsigned long) |
68 | 68 | ||
69 | /* ABI specific return values */ | ||
70 | #ifdef CONFIG_32BIT /* O32 */ | ||
71 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
72 | #define r_err MIPS_R_V1 | ||
73 | #define r_val MIPS_R_V0 | ||
74 | #else /* CONFIG_CPU_LITTLE_ENDIAN */ | ||
75 | #define r_err MIPS_R_V0 | ||
76 | #define r_val MIPS_R_V1 | ||
77 | #endif | ||
78 | #else /* N64 */ | ||
79 | #define r_err MIPS_R_V0 | ||
80 | #define r_val MIPS_R_V0 | ||
81 | #endif | ||
82 | |||
83 | #define r_ret MIPS_R_V0 | ||
84 | |||
85 | /* | ||
86 | * Use 2 scratch registers to avoid pipeline interlocks. | ||
87 | * There is no overhead during epilogue and prologue since | ||
88 | * any of the $s0-$s6 registers will only be preserved if | ||
89 | * they are going to actually be used. | ||
90 | */ | ||
91 | #define r_s0 MIPS_R_S0 /* scratch reg 1 */ | ||
92 | #define r_s1 MIPS_R_S1 /* scratch reg 2 */ | ||
93 | #define r_off MIPS_R_S2 | ||
94 | #define r_A MIPS_R_S3 | ||
95 | #define r_X MIPS_R_S4 | ||
96 | #define r_skb MIPS_R_S5 | ||
97 | #define r_M MIPS_R_S6 | ||
98 | #define r_tmp_imm MIPS_R_T6 /* No need to preserve this */ | ||
99 | #define r_tmp MIPS_R_T7 /* No need to preserve this */ | ||
100 | #define r_zero MIPS_R_ZERO | ||
101 | #define r_sp MIPS_R_SP | ||
102 | #define r_ra MIPS_R_RA | ||
103 | |||
104 | #define SCRATCH_OFF(k) (4 * (k)) | 69 | #define SCRATCH_OFF(k) (4 * (k)) |
105 | 70 | ||
106 | /* JIT flags */ | 71 | /* JIT flags */ |
@@ -108,13 +73,13 @@ | |||
108 | #define SEEN_SREG_SFT (BPF_MEMWORDS + 1) | 73 | #define SEEN_SREG_SFT (BPF_MEMWORDS + 1) |
109 | #define SEEN_SREG_BASE (1 << SEEN_SREG_SFT) | 74 | #define SEEN_SREG_BASE (1 << SEEN_SREG_SFT) |
110 | #define SEEN_SREG(x) (SEEN_SREG_BASE << (x)) | 75 | #define SEEN_SREG(x) (SEEN_SREG_BASE << (x)) |
111 | #define SEEN_S0 SEEN_SREG(0) | ||
112 | #define SEEN_S1 SEEN_SREG(1) | ||
113 | #define SEEN_OFF SEEN_SREG(2) | 76 | #define SEEN_OFF SEEN_SREG(2) |
114 | #define SEEN_A SEEN_SREG(3) | 77 | #define SEEN_A SEEN_SREG(3) |
115 | #define SEEN_X SEEN_SREG(4) | 78 | #define SEEN_X SEEN_SREG(4) |
116 | #define SEEN_SKB SEEN_SREG(5) | 79 | #define SEEN_SKB SEEN_SREG(5) |
117 | #define SEEN_MEM SEEN_SREG(6) | 80 | #define SEEN_MEM SEEN_SREG(6) |
81 | /* SEEN_SK_DATA also implies skb_hl an skb_len */ | ||
82 | #define SEEN_SKB_DATA (SEEN_SREG(7) | SEEN_SREG(1) | SEEN_SREG(0)) | ||
118 | 83 | ||
119 | /* Arguments used by JIT */ | 84 | /* Arguments used by JIT */ |
120 | #define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ | 85 | #define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ |
@@ -577,27 +542,13 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) | |||
577 | /* Adjust the stack pointer */ | 542 | /* Adjust the stack pointer */ |
578 | emit_stack_offset(-align_sp(offset), ctx); | 543 | emit_stack_offset(-align_sp(offset), ctx); |
579 | 544 | ||
580 | if (ctx->flags & SEEN_CALL) { | ||
581 | /* Argument save area */ | ||
582 | if (config_enabled(CONFIG_64BIT)) | ||
583 | /* Bottom of current frame */ | ||
584 | real_off = align_sp(offset) - RSIZE; | ||
585 | else | ||
586 | /* Top of previous frame */ | ||
587 | real_off = align_sp(offset) + RSIZE; | ||
588 | emit_store_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); | ||
589 | emit_store_stack_reg(MIPS_R_A1, r_sp, real_off + RSIZE, ctx); | ||
590 | |||
591 | real_off = 0; | ||
592 | } | ||
593 | |||
594 | tmp_flags = sflags = ctx->flags >> SEEN_SREG_SFT; | 545 | tmp_flags = sflags = ctx->flags >> SEEN_SREG_SFT; |
595 | /* sflags is essentially a bitmap */ | 546 | /* sflags is essentially a bitmap */ |
596 | while (tmp_flags) { | 547 | while (tmp_flags) { |
597 | if ((sflags >> i) & 0x1) { | 548 | if ((sflags >> i) & 0x1) { |
598 | emit_store_stack_reg(MIPS_R_S0 + i, r_sp, real_off, | 549 | emit_store_stack_reg(MIPS_R_S0 + i, r_sp, real_off, |
599 | ctx); | 550 | ctx); |
600 | real_off += RSIZE; | 551 | real_off += SZREG; |
601 | } | 552 | } |
602 | i++; | 553 | i++; |
603 | tmp_flags >>= 1; | 554 | tmp_flags >>= 1; |
@@ -606,13 +557,13 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) | |||
606 | /* save return address */ | 557 | /* save return address */ |
607 | if (ctx->flags & SEEN_CALL) { | 558 | if (ctx->flags & SEEN_CALL) { |
608 | emit_store_stack_reg(r_ra, r_sp, real_off, ctx); | 559 | emit_store_stack_reg(r_ra, r_sp, real_off, ctx); |
609 | real_off += RSIZE; | 560 | real_off += SZREG; |
610 | } | 561 | } |
611 | 562 | ||
612 | /* Setup r_M leaving the alignment gap if necessary */ | 563 | /* Setup r_M leaving the alignment gap if necessary */ |
613 | if (ctx->flags & SEEN_MEM) { | 564 | if (ctx->flags & SEEN_MEM) { |
614 | if (real_off % (RSIZE * 2)) | 565 | if (real_off % (SZREG * 2)) |
615 | real_off += RSIZE; | 566 | real_off += SZREG; |
616 | emit_long_instr(ctx, ADDIU, r_M, r_sp, real_off); | 567 | emit_long_instr(ctx, ADDIU, r_M, r_sp, real_off); |
617 | } | 568 | } |
618 | } | 569 | } |
@@ -623,19 +574,6 @@ static void restore_bpf_jit_regs(struct jit_ctx *ctx, | |||
623 | int i, real_off = 0; | 574 | int i, real_off = 0; |
624 | u32 sflags, tmp_flags; | 575 | u32 sflags, tmp_flags; |
625 | 576 | ||
626 | if (ctx->flags & SEEN_CALL) { | ||
627 | if (config_enabled(CONFIG_64BIT)) | ||
628 | /* Bottom of current frame */ | ||
629 | real_off = align_sp(offset) - RSIZE; | ||
630 | else | ||
631 | /* Top of previous frame */ | ||
632 | real_off = align_sp(offset) + RSIZE; | ||
633 | emit_load_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); | ||
634 | emit_load_stack_reg(MIPS_R_A1, r_sp, real_off + RSIZE, ctx); | ||
635 | |||
636 | real_off = 0; | ||
637 | } | ||
638 | |||
639 | tmp_flags = sflags = ctx->flags >> SEEN_SREG_SFT; | 577 | tmp_flags = sflags = ctx->flags >> SEEN_SREG_SFT; |
640 | /* sflags is a bitmap */ | 578 | /* sflags is a bitmap */ |
641 | i = 0; | 579 | i = 0; |
@@ -643,7 +581,7 @@ static void restore_bpf_jit_regs(struct jit_ctx *ctx, | |||
643 | if ((sflags >> i) & 0x1) { | 581 | if ((sflags >> i) & 0x1) { |
644 | emit_load_stack_reg(MIPS_R_S0 + i, r_sp, real_off, | 582 | emit_load_stack_reg(MIPS_R_S0 + i, r_sp, real_off, |
645 | ctx); | 583 | ctx); |
646 | real_off += RSIZE; | 584 | real_off += SZREG; |
647 | } | 585 | } |
648 | i++; | 586 | i++; |
649 | tmp_flags >>= 1; | 587 | tmp_flags >>= 1; |
@@ -663,23 +601,13 @@ static unsigned int get_stack_depth(struct jit_ctx *ctx) | |||
663 | 601 | ||
664 | 602 | ||
665 | /* How may s* regs do we need to preserved? */ | 603 | /* How may s* regs do we need to preserved? */ |
666 | sp_off += hweight32(ctx->flags >> SEEN_SREG_SFT) * RSIZE; | 604 | sp_off += hweight32(ctx->flags >> SEEN_SREG_SFT) * SZREG; |
667 | 605 | ||
668 | if (ctx->flags & SEEN_MEM) | 606 | if (ctx->flags & SEEN_MEM) |
669 | sp_off += 4 * BPF_MEMWORDS; /* BPF_MEMWORDS are 32-bit */ | 607 | sp_off += 4 * BPF_MEMWORDS; /* BPF_MEMWORDS are 32-bit */ |
670 | 608 | ||
671 | if (ctx->flags & SEEN_CALL) | 609 | if (ctx->flags & SEEN_CALL) |
672 | /* | 610 | sp_off += SZREG; /* Space for our ra register */ |
673 | * The JIT code make calls to external functions using 2 | ||
674 | * arguments. Therefore, for o32 we don't need to allocate | ||
675 | * space because we don't care if the argumetns are lost | ||
676 | * across calls. We do need however to preserve incoming | ||
677 | * arguments but the space is already allocated for us by | ||
678 | * the caller. On the other hand, for n64, we need to allocate | ||
679 | * this space ourselves. We need to preserve $ra as well. | ||
680 | */ | ||
681 | sp_off += config_enabled(CONFIG_64BIT) ? | ||
682 | (ARGS_USED_BY_JIT + 1) * RSIZE : RSIZE; | ||
683 | 611 | ||
684 | return sp_off; | 612 | return sp_off; |
685 | } | 613 | } |
@@ -696,6 +624,19 @@ static void build_prologue(struct jit_ctx *ctx) | |||
696 | if (ctx->flags & SEEN_SKB) | 624 | if (ctx->flags & SEEN_SKB) |
697 | emit_reg_move(r_skb, MIPS_R_A0, ctx); | 625 | emit_reg_move(r_skb, MIPS_R_A0, ctx); |
698 | 626 | ||
627 | if (ctx->flags & SEEN_SKB_DATA) { | ||
628 | /* Load packet length */ | ||
629 | emit_load(r_skb_len, r_skb, offsetof(struct sk_buff, len), | ||
630 | ctx); | ||
631 | emit_load(r_tmp, r_skb, offsetof(struct sk_buff, data_len), | ||
632 | ctx); | ||
633 | /* Load the data pointer */ | ||
634 | emit_load_ptr(r_skb_data, r_skb, | ||
635 | offsetof(struct sk_buff, data), ctx); | ||
636 | /* Load the header length */ | ||
637 | emit_subu(r_skb_hl, r_skb_len, r_tmp, ctx); | ||
638 | } | ||
639 | |||
699 | if (ctx->flags & SEEN_X) | 640 | if (ctx->flags & SEEN_X) |
700 | emit_jit_reg_move(r_X, r_zero, ctx); | 641 | emit_jit_reg_move(r_X, r_zero, ctx); |
701 | 642 | ||
@@ -718,43 +659,17 @@ static void build_epilogue(struct jit_ctx *ctx) | |||
718 | emit_nop(ctx); | 659 | emit_nop(ctx); |
719 | } | 660 | } |
720 | 661 | ||
721 | static u64 jit_get_skb_b(struct sk_buff *skb, unsigned offset) | 662 | #define CHOOSE_LOAD_FUNC(K, func) \ |
722 | { | 663 | ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative : func) : \ |
723 | u8 ret; | 664 | func##_positive) |
724 | int err; | ||
725 | |||
726 | err = skb_copy_bits(skb, offset, &ret, 1); | ||
727 | |||
728 | return (u64)err << 32 | ret; | ||
729 | } | ||
730 | |||
731 | static u64 jit_get_skb_h(struct sk_buff *skb, unsigned offset) | ||
732 | { | ||
733 | u16 ret; | ||
734 | int err; | ||
735 | |||
736 | err = skb_copy_bits(skb, offset, &ret, 2); | ||
737 | |||
738 | return (u64)err << 32 | ntohs(ret); | ||
739 | } | ||
740 | |||
741 | static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset) | ||
742 | { | ||
743 | u32 ret; | ||
744 | int err; | ||
745 | |||
746 | err = skb_copy_bits(skb, offset, &ret, 4); | ||
747 | |||
748 | return (u64)err << 32 | ntohl(ret); | ||
749 | } | ||
750 | 665 | ||
751 | static int build_body(struct jit_ctx *ctx) | 666 | static int build_body(struct jit_ctx *ctx) |
752 | { | 667 | { |
753 | void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w}; | ||
754 | const struct bpf_prog *prog = ctx->skf; | 668 | const struct bpf_prog *prog = ctx->skf; |
755 | const struct sock_filter *inst; | 669 | const struct sock_filter *inst; |
756 | unsigned int i, off, load_order, condt; | 670 | unsigned int i, off, condt; |
757 | u32 k, b_off __maybe_unused; | 671 | u32 k, b_off __maybe_unused; |
672 | u8 (*sk_load_func)(unsigned long *skb, int offset); | ||
758 | 673 | ||
759 | for (i = 0; i < prog->len; i++) { | 674 | for (i = 0; i < prog->len; i++) { |
760 | u16 code; | 675 | u16 code; |
@@ -788,71 +703,46 @@ static int build_body(struct jit_ctx *ctx) | |||
788 | break; | 703 | break; |
789 | case BPF_LD | BPF_W | BPF_ABS: | 704 | case BPF_LD | BPF_W | BPF_ABS: |
790 | /* A <- P[k:4] */ | 705 | /* A <- P[k:4] */ |
791 | load_order = 2; | 706 | sk_load_func = CHOOSE_LOAD_FUNC(k, sk_load_word); |
792 | goto load; | 707 | goto load; |
793 | case BPF_LD | BPF_H | BPF_ABS: | 708 | case BPF_LD | BPF_H | BPF_ABS: |
794 | /* A <- P[k:2] */ | 709 | /* A <- P[k:2] */ |
795 | load_order = 1; | 710 | sk_load_func = CHOOSE_LOAD_FUNC(k, sk_load_half); |
796 | goto load; | 711 | goto load; |
797 | case BPF_LD | BPF_B | BPF_ABS: | 712 | case BPF_LD | BPF_B | BPF_ABS: |
798 | /* A <- P[k:1] */ | 713 | /* A <- P[k:1] */ |
799 | load_order = 0; | 714 | sk_load_func = CHOOSE_LOAD_FUNC(k, sk_load_byte); |
800 | load: | 715 | load: |
801 | /* the interpreter will deal with the negative K */ | ||
802 | if ((int)k < 0) | ||
803 | return -ENOTSUPP; | ||
804 | |||
805 | emit_load_imm(r_off, k, ctx); | 716 | emit_load_imm(r_off, k, ctx); |
806 | load_common: | 717 | load_common: |
807 | /* | 718 | ctx->flags |= SEEN_CALL | SEEN_OFF | |
808 | * We may got here from the indirect loads so | 719 | SEEN_SKB | SEEN_A | SEEN_SKB_DATA; |
809 | * return if offset is negative. | ||
810 | */ | ||
811 | emit_slt(r_s0, r_off, r_zero, ctx); | ||
812 | emit_bcond(MIPS_COND_NE, r_s0, r_zero, | ||
813 | b_imm(prog->len, ctx), ctx); | ||
814 | emit_reg_move(r_ret, r_zero, ctx); | ||
815 | |||
816 | ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 | | ||
817 | SEEN_SKB | SEEN_A; | ||
818 | 720 | ||
819 | emit_load_func(r_s0, (ptr)load_func[load_order], | 721 | emit_load_func(r_s0, (ptr)sk_load_func, ctx); |
820 | ctx); | ||
821 | emit_reg_move(MIPS_R_A0, r_skb, ctx); | 722 | emit_reg_move(MIPS_R_A0, r_skb, ctx); |
822 | emit_jalr(MIPS_R_RA, r_s0, ctx); | 723 | emit_jalr(MIPS_R_RA, r_s0, ctx); |
823 | /* Load second argument to delay slot */ | 724 | /* Load second argument to delay slot */ |
824 | emit_reg_move(MIPS_R_A1, r_off, ctx); | 725 | emit_reg_move(MIPS_R_A1, r_off, ctx); |
825 | /* Check the error value */ | 726 | /* Check the error value */ |
826 | if (config_enabled(CONFIG_64BIT)) { | 727 | emit_bcond(MIPS_COND_EQ, r_ret, 0, b_imm(i + 1, ctx), |
827 | /* Get error code from the top 32-bits */ | 728 | ctx); |
828 | emit_dsrl32(r_s0, r_val, 0, ctx); | 729 | /* Load return register on DS for failures */ |
829 | /* Branch to 3 instructions ahead */ | 730 | emit_reg_move(r_ret, r_zero, ctx); |
830 | emit_bcond(MIPS_COND_NE, r_s0, r_zero, 3 << 2, | ||
831 | ctx); | ||
832 | } else { | ||
833 | /* Branch to 3 instructions ahead */ | ||
834 | emit_bcond(MIPS_COND_NE, r_err, r_zero, 3 << 2, | ||
835 | ctx); | ||
836 | } | ||
837 | emit_nop(ctx); | ||
838 | /* We are good */ | ||
839 | emit_b(b_imm(i + 1, ctx), ctx); | ||
840 | emit_jit_reg_move(r_A, r_val, ctx); | ||
841 | /* Return with error */ | 731 | /* Return with error */ |
842 | emit_b(b_imm(prog->len, ctx), ctx); | 732 | emit_b(b_imm(prog->len, ctx), ctx); |
843 | emit_reg_move(r_ret, r_zero, ctx); | 733 | emit_nop(ctx); |
844 | break; | 734 | break; |
845 | case BPF_LD | BPF_W | BPF_IND: | 735 | case BPF_LD | BPF_W | BPF_IND: |
846 | /* A <- P[X + k:4] */ | 736 | /* A <- P[X + k:4] */ |
847 | load_order = 2; | 737 | sk_load_func = sk_load_word; |
848 | goto load_ind; | 738 | goto load_ind; |
849 | case BPF_LD | BPF_H | BPF_IND: | 739 | case BPF_LD | BPF_H | BPF_IND: |
850 | /* A <- P[X + k:2] */ | 740 | /* A <- P[X + k:2] */ |
851 | load_order = 1; | 741 | sk_load_func = sk_load_half; |
852 | goto load_ind; | 742 | goto load_ind; |
853 | case BPF_LD | BPF_B | BPF_IND: | 743 | case BPF_LD | BPF_B | BPF_IND: |
854 | /* A <- P[X + k:1] */ | 744 | /* A <- P[X + k:1] */ |
855 | load_order = 0; | 745 | sk_load_func = sk_load_byte; |
856 | load_ind: | 746 | load_ind: |
857 | ctx->flags |= SEEN_OFF | SEEN_X; | 747 | ctx->flags |= SEEN_OFF | SEEN_X; |
858 | emit_addiu(r_off, r_X, k, ctx); | 748 | emit_addiu(r_off, r_X, k, ctx); |
@@ -874,14 +764,10 @@ load_ind: | |||
874 | emit_load(r_X, r_skb, off, ctx); | 764 | emit_load(r_X, r_skb, off, ctx); |
875 | break; | 765 | break; |
876 | case BPF_LDX | BPF_B | BPF_MSH: | 766 | case BPF_LDX | BPF_B | BPF_MSH: |
877 | /* the interpreter will deal with the negative K */ | ||
878 | if ((int)k < 0) | ||
879 | return -ENOTSUPP; | ||
880 | |||
881 | /* X <- 4 * (P[k:1] & 0xf) */ | 767 | /* X <- 4 * (P[k:1] & 0xf) */ |
882 | ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB; | 768 | ctx->flags |= SEEN_X | SEEN_CALL | SEEN_SKB; |
883 | /* Load offset to a1 */ | 769 | /* Load offset to a1 */ |
884 | emit_load_func(r_s0, (ptr)jit_get_skb_b, ctx); | 770 | emit_load_func(r_s0, (ptr)sk_load_byte, ctx); |
885 | /* | 771 | /* |
886 | * This may emit two instructions so it may not fit | 772 | * This may emit two instructions so it may not fit |
887 | * in the delay slot. So use a0 in the delay slot. | 773 | * in the delay slot. So use a0 in the delay slot. |
@@ -890,25 +776,15 @@ load_ind: | |||
890 | emit_jalr(MIPS_R_RA, r_s0, ctx); | 776 | emit_jalr(MIPS_R_RA, r_s0, ctx); |
891 | emit_reg_move(MIPS_R_A0, r_skb, ctx); /* delay slot */ | 777 | emit_reg_move(MIPS_R_A0, r_skb, ctx); /* delay slot */ |
892 | /* Check the error value */ | 778 | /* Check the error value */ |
893 | if (config_enabled(CONFIG_64BIT)) { | 779 | emit_bcond(MIPS_COND_NE, r_ret, 0, |
894 | /* Top 32-bits of $v0 on 64-bit */ | 780 | b_imm(prog->len, ctx), ctx); |
895 | emit_dsrl32(r_s0, r_val, 0, ctx); | 781 | emit_reg_move(r_ret, r_zero, ctx); |
896 | emit_bcond(MIPS_COND_NE, r_s0, r_zero, | ||
897 | 3 << 2, ctx); | ||
898 | } else { | ||
899 | emit_bcond(MIPS_COND_NE, r_err, r_zero, | ||
900 | 3 << 2, ctx); | ||
901 | } | ||
902 | /* No need for delay slot */ | ||
903 | /* We are good */ | 782 | /* We are good */ |
904 | /* X <- P[1:K] & 0xf */ | 783 | /* X <- P[1:K] & 0xf */ |
905 | emit_andi(r_X, r_val, 0xf, ctx); | 784 | emit_andi(r_X, r_A, 0xf, ctx); |
906 | /* X << 2 */ | 785 | /* X << 2 */ |
907 | emit_b(b_imm(i + 1, ctx), ctx); | 786 | emit_b(b_imm(i + 1, ctx), ctx); |
908 | emit_sll(r_X, r_X, 2, ctx); /* delay slot */ | 787 | emit_sll(r_X, r_X, 2, ctx); /* delay slot */ |
909 | /* Return with error */ | ||
910 | emit_b(b_imm(prog->len, ctx), ctx); | ||
911 | emit_load_imm(r_ret, 0, ctx); /* delay slot */ | ||
912 | break; | 788 | break; |
913 | case BPF_ST: | 789 | case BPF_ST: |
914 | /* M[k] <- A */ | 790 | /* M[k] <- A */ |
@@ -943,7 +819,7 @@ load_ind: | |||
943 | case BPF_ALU | BPF_MUL | BPF_K: | 819 | case BPF_ALU | BPF_MUL | BPF_K: |
944 | /* A *= K */ | 820 | /* A *= K */ |
945 | /* Load K to scratch register before MUL */ | 821 | /* Load K to scratch register before MUL */ |
946 | ctx->flags |= SEEN_A | SEEN_S0; | 822 | ctx->flags |= SEEN_A; |
947 | emit_load_imm(r_s0, k, ctx); | 823 | emit_load_imm(r_s0, k, ctx); |
948 | emit_mul(r_A, r_A, r_s0, ctx); | 824 | emit_mul(r_A, r_A, r_s0, ctx); |
949 | break; | 825 | break; |
@@ -961,7 +837,7 @@ load_ind: | |||
961 | emit_srl(r_A, r_A, k, ctx); | 837 | emit_srl(r_A, r_A, k, ctx); |
962 | break; | 838 | break; |
963 | } | 839 | } |
964 | ctx->flags |= SEEN_A | SEEN_S0; | 840 | ctx->flags |= SEEN_A; |
965 | emit_load_imm(r_s0, k, ctx); | 841 | emit_load_imm(r_s0, k, ctx); |
966 | emit_div(r_A, r_s0, ctx); | 842 | emit_div(r_A, r_s0, ctx); |
967 | break; | 843 | break; |
@@ -971,7 +847,7 @@ load_ind: | |||
971 | ctx->flags |= SEEN_A; | 847 | ctx->flags |= SEEN_A; |
972 | emit_jit_reg_move(r_A, r_zero, ctx); | 848 | emit_jit_reg_move(r_A, r_zero, ctx); |
973 | } else { | 849 | } else { |
974 | ctx->flags |= SEEN_A | SEEN_S0; | 850 | ctx->flags |= SEEN_A; |
975 | emit_load_imm(r_s0, k, ctx); | 851 | emit_load_imm(r_s0, k, ctx); |
976 | emit_mod(r_A, r_s0, ctx); | 852 | emit_mod(r_A, r_s0, ctx); |
977 | } | 853 | } |
@@ -982,7 +858,7 @@ load_ind: | |||
982 | /* Check if r_X is zero */ | 858 | /* Check if r_X is zero */ |
983 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, | 859 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, |
984 | b_imm(prog->len, ctx), ctx); | 860 | b_imm(prog->len, ctx), ctx); |
985 | emit_load_imm(r_val, 0, ctx); /* delay slot */ | 861 | emit_load_imm(r_ret, 0, ctx); /* delay slot */ |
986 | emit_div(r_A, r_X, ctx); | 862 | emit_div(r_A, r_X, ctx); |
987 | break; | 863 | break; |
988 | case BPF_ALU | BPF_MOD | BPF_X: | 864 | case BPF_ALU | BPF_MOD | BPF_X: |
@@ -991,7 +867,7 @@ load_ind: | |||
991 | /* Check if r_X is zero */ | 867 | /* Check if r_X is zero */ |
992 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, | 868 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, |
993 | b_imm(prog->len, ctx), ctx); | 869 | b_imm(prog->len, ctx), ctx); |
994 | emit_load_imm(r_val, 0, ctx); /* delay slot */ | 870 | emit_load_imm(r_ret, 0, ctx); /* delay slot */ |
995 | emit_mod(r_A, r_X, ctx); | 871 | emit_mod(r_A, r_X, ctx); |
996 | break; | 872 | break; |
997 | case BPF_ALU | BPF_OR | BPF_K: | 873 | case BPF_ALU | BPF_OR | BPF_K: |
@@ -1085,10 +961,10 @@ jmp_cmp: | |||
1085 | if ((condt & MIPS_COND_GE) || | 961 | if ((condt & MIPS_COND_GE) || |
1086 | (condt & MIPS_COND_GT)) { | 962 | (condt & MIPS_COND_GT)) { |
1087 | if (condt & MIPS_COND_K) { /* K */ | 963 | if (condt & MIPS_COND_K) { /* K */ |
1088 | ctx->flags |= SEEN_S0 | SEEN_A; | 964 | ctx->flags |= SEEN_A; |
1089 | emit_sltiu(r_s0, r_A, k, ctx); | 965 | emit_sltiu(r_s0, r_A, k, ctx); |
1090 | } else { /* X */ | 966 | } else { /* X */ |
1091 | ctx->flags |= SEEN_S0 | SEEN_A | | 967 | ctx->flags |= SEEN_A | |
1092 | SEEN_X; | 968 | SEEN_X; |
1093 | emit_sltu(r_s0, r_A, r_X, ctx); | 969 | emit_sltu(r_s0, r_A, r_X, ctx); |
1094 | } | 970 | } |
@@ -1100,7 +976,7 @@ jmp_cmp: | |||
1100 | /* A > (K|X) ? scratch = 0 */ | 976 | /* A > (K|X) ? scratch = 0 */ |
1101 | if (condt & MIPS_COND_GT) { | 977 | if (condt & MIPS_COND_GT) { |
1102 | /* Checking for equality */ | 978 | /* Checking for equality */ |
1103 | ctx->flags |= SEEN_S0 | SEEN_A | SEEN_X; | 979 | ctx->flags |= SEEN_A | SEEN_X; |
1104 | if (condt & MIPS_COND_K) | 980 | if (condt & MIPS_COND_K) |
1105 | emit_load_imm(r_s0, k, ctx); | 981 | emit_load_imm(r_s0, k, ctx); |
1106 | else | 982 | else |
@@ -1123,7 +999,7 @@ jmp_cmp: | |||
1123 | } else { | 999 | } else { |
1124 | /* A == K|X */ | 1000 | /* A == K|X */ |
1125 | if (condt & MIPS_COND_K) { /* K */ | 1001 | if (condt & MIPS_COND_K) { /* K */ |
1126 | ctx->flags |= SEEN_S0 | SEEN_A; | 1002 | ctx->flags |= SEEN_A; |
1127 | emit_load_imm(r_s0, k, ctx); | 1003 | emit_load_imm(r_s0, k, ctx); |
1128 | /* jump true */ | 1004 | /* jump true */ |
1129 | b_off = b_imm(i + inst->jt + 1, ctx); | 1005 | b_off = b_imm(i + inst->jt + 1, ctx); |
@@ -1153,7 +1029,7 @@ jmp_cmp: | |||
1153 | } | 1029 | } |
1154 | break; | 1030 | break; |
1155 | case BPF_JMP | BPF_JSET | BPF_K: | 1031 | case BPF_JMP | BPF_JSET | BPF_K: |
1156 | ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A; | 1032 | ctx->flags |= SEEN_A; |
1157 | /* pc += (A & K) ? pc -> jt : pc -> jf */ | 1033 | /* pc += (A & K) ? pc -> jt : pc -> jf */ |
1158 | emit_load_imm(r_s1, k, ctx); | 1034 | emit_load_imm(r_s1, k, ctx); |
1159 | emit_and(r_s0, r_A, r_s1, ctx); | 1035 | emit_and(r_s0, r_A, r_s1, ctx); |
@@ -1167,7 +1043,7 @@ jmp_cmp: | |||
1167 | emit_nop(ctx); | 1043 | emit_nop(ctx); |
1168 | break; | 1044 | break; |
1169 | case BPF_JMP | BPF_JSET | BPF_X: | 1045 | case BPF_JMP | BPF_JSET | BPF_X: |
1170 | ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A; | 1046 | ctx->flags |= SEEN_X | SEEN_A; |
1171 | /* pc += (A & X) ? pc -> jt : pc -> jf */ | 1047 | /* pc += (A & X) ? pc -> jt : pc -> jf */ |
1172 | emit_and(r_s0, r_A, r_X, ctx); | 1048 | emit_and(r_s0, r_A, r_X, ctx); |
1173 | /* jump true */ | 1049 | /* jump true */ |
@@ -1251,7 +1127,7 @@ jmp_cmp: | |||
1251 | break; | 1127 | break; |
1252 | case BPF_ANC | SKF_AD_IFINDEX: | 1128 | case BPF_ANC | SKF_AD_IFINDEX: |
1253 | /* A = skb->dev->ifindex */ | 1129 | /* A = skb->dev->ifindex */ |
1254 | ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0; | 1130 | ctx->flags |= SEEN_SKB | SEEN_A; |
1255 | off = offsetof(struct sk_buff, dev); | 1131 | off = offsetof(struct sk_buff, dev); |
1256 | /* Load *dev pointer */ | 1132 | /* Load *dev pointer */ |
1257 | emit_load_ptr(r_s0, r_skb, off, ctx); | 1133 | emit_load_ptr(r_s0, r_skb, off, ctx); |
@@ -1278,7 +1154,7 @@ jmp_cmp: | |||
1278 | break; | 1154 | break; |
1279 | case BPF_ANC | SKF_AD_VLAN_TAG: | 1155 | case BPF_ANC | SKF_AD_VLAN_TAG: |
1280 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: | 1156 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
1281 | ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A; | 1157 | ctx->flags |= SEEN_SKB | SEEN_A; |
1282 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 1158 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
1283 | vlan_tci) != 2); | 1159 | vlan_tci) != 2); |
1284 | off = offsetof(struct sk_buff, vlan_tci); | 1160 | off = offsetof(struct sk_buff, vlan_tci); |
diff --git a/arch/mips/net/bpf_jit.h b/arch/mips/net/bpf_jit.h index 3a5751b4335a..8f9f54841123 100644 --- a/arch/mips/net/bpf_jit.h +++ b/arch/mips/net/bpf_jit.h | |||
@@ -15,9 +15,10 @@ | |||
15 | /* Registers used by JIT */ | 15 | /* Registers used by JIT */ |
16 | #define MIPS_R_ZERO 0 | 16 | #define MIPS_R_ZERO 0 |
17 | #define MIPS_R_V0 2 | 17 | #define MIPS_R_V0 2 |
18 | #define MIPS_R_V1 3 | ||
19 | #define MIPS_R_A0 4 | 18 | #define MIPS_R_A0 4 |
20 | #define MIPS_R_A1 5 | 19 | #define MIPS_R_A1 5 |
20 | #define MIPS_R_T4 12 | ||
21 | #define MIPS_R_T5 13 | ||
21 | #define MIPS_R_T6 14 | 22 | #define MIPS_R_T6 14 |
22 | #define MIPS_R_T7 15 | 23 | #define MIPS_R_T7 15 |
23 | #define MIPS_R_S0 16 | 24 | #define MIPS_R_S0 16 |
@@ -41,4 +42,43 @@ | |||
41 | #define MIPS_COND_X (0x1 << 5) | 42 | #define MIPS_COND_X (0x1 << 5) |
42 | #define MIPS_COND_K (0x1 << 6) | 43 | #define MIPS_COND_K (0x1 << 6) |
43 | 44 | ||
45 | #define r_ret MIPS_R_V0 | ||
46 | |||
47 | /* | ||
48 | * Use 2 scratch registers to avoid pipeline interlocks. | ||
49 | * There is no overhead during epilogue and prologue since | ||
50 | * any of the $s0-$s6 registers will only be preserved if | ||
51 | * they are going to actually be used. | ||
52 | */ | ||
53 | #define r_skb_hl MIPS_R_S0 /* skb header length */ | ||
54 | #define r_skb_data MIPS_R_S1 /* skb actual data */ | ||
55 | #define r_off MIPS_R_S2 | ||
56 | #define r_A MIPS_R_S3 | ||
57 | #define r_X MIPS_R_S4 | ||
58 | #define r_skb MIPS_R_S5 | ||
59 | #define r_M MIPS_R_S6 | ||
60 | #define r_skb_len MIPS_R_S7 | ||
61 | #define r_s0 MIPS_R_T4 /* scratch reg 1 */ | ||
62 | #define r_s1 MIPS_R_T5 /* scratch reg 2 */ | ||
63 | #define r_tmp_imm MIPS_R_T6 /* No need to preserve this */ | ||
64 | #define r_tmp MIPS_R_T7 /* No need to preserve this */ | ||
65 | #define r_zero MIPS_R_ZERO | ||
66 | #define r_sp MIPS_R_SP | ||
67 | #define r_ra MIPS_R_RA | ||
68 | |||
69 | #ifndef __ASSEMBLY__ | ||
70 | |||
71 | /* Declare ASM helpers */ | ||
72 | |||
73 | #define DECLARE_LOAD_FUNC(func) \ | ||
74 | extern u8 func(unsigned long *skb, int offset); \ | ||
75 | extern u8 func##_negative(unsigned long *skb, int offset); \ | ||
76 | extern u8 func##_positive(unsigned long *skb, int offset) | ||
77 | |||
78 | DECLARE_LOAD_FUNC(sk_load_word); | ||
79 | DECLARE_LOAD_FUNC(sk_load_half); | ||
80 | DECLARE_LOAD_FUNC(sk_load_byte); | ||
81 | |||
82 | #endif | ||
83 | |||
44 | #endif /* BPF_JIT_MIPS_OP_H */ | 84 | #endif /* BPF_JIT_MIPS_OP_H */ |
diff --git a/arch/mips/net/bpf_jit_asm.S b/arch/mips/net/bpf_jit_asm.S new file mode 100644 index 000000000000..e92726099be0 --- /dev/null +++ b/arch/mips/net/bpf_jit_asm.S | |||
@@ -0,0 +1,238 @@ | |||
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 | ||
diff --git a/arch/mips/netlogic/xlr/platform-flash.c b/arch/mips/netlogic/xlr/platform-flash.c index 6d3c727e0ef8..f03131fec41d 100644 --- a/arch/mips/netlogic/xlr/platform-flash.c +++ b/arch/mips/netlogic/xlr/platform-flash.c | |||
@@ -78,8 +78,6 @@ static struct platform_device xlr_nor_dev = { | |||
78 | .resource = xlr_nor_res, | 78 | .resource = xlr_nor_res, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | const char *xlr_part_probes[] = { "cmdlinepart", NULL }; | ||
82 | |||
83 | /* | 81 | /* |
84 | * Use "gen_nand" driver for NAND flash | 82 | * Use "gen_nand" driver for NAND flash |
85 | * | 83 | * |
@@ -111,7 +109,6 @@ struct platform_nand_data xlr_nand_data = { | |||
111 | .nr_partitions = ARRAY_SIZE(xlr_nand_parts), | 109 | .nr_partitions = ARRAY_SIZE(xlr_nand_parts), |
112 | .chip_delay = 50, | 110 | .chip_delay = 50, |
113 | .partitions = xlr_nand_parts, | 111 | .partitions = xlr_nand_parts, |
114 | .part_probe_types = xlr_part_probes, | ||
115 | }, | 112 | }, |
116 | .ctrl = { | 113 | .ctrl = { |
117 | .cmd_ctrl = xlr_nand_ctrl, | 114 | .cmd_ctrl = xlr_nand_ctrl, |
diff --git a/arch/mips/pci/pci-ar2315.c b/arch/mips/pci/pci-ar2315.c index 07a18228e63a..dadb30306a0a 100644 --- a/arch/mips/pci/pci-ar2315.c +++ b/arch/mips/pci/pci-ar2315.c | |||
@@ -320,7 +320,7 @@ static int ar2315_pci_host_setup(struct ar2315_pci_ctrl *apc) | |||
320 | 320 | ||
321 | static void ar2315_pci_irq_handler(unsigned irq, struct irq_desc *desc) | 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 | u32 pending = ar2315_pci_reg_read(apc, AR2315_PCI_ISR) & | 324 | u32 pending = ar2315_pci_reg_read(apc, AR2315_PCI_ISR) & |
325 | ar2315_pci_reg_read(apc, AR2315_PCI_IMR); | 325 | ar2315_pci_reg_read(apc, AR2315_PCI_IMR); |
326 | unsigned pci_irq = 0; | 326 | unsigned pci_irq = 0; |
diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c index 9e62ad31d4b5..283157f8dc64 100644 --- a/arch/mips/pci/pci-ar71xx.c +++ b/arch/mips/pci/pci-ar71xx.c | |||
@@ -232,7 +232,7 @@ static void ar71xx_pci_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
232 | void __iomem *base = ath79_reset_base; | 232 | void __iomem *base = ath79_reset_base; |
233 | u32 pending; | 233 | u32 pending; |
234 | 234 | ||
235 | apc = irq_get_handler_data(irq); | 235 | apc = irq_desc_get_handler_data(desc); |
236 | 236 | ||
237 | pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & | 237 | pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & |
238 | __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); | 238 | __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); |
@@ -318,23 +318,13 @@ static void ar71xx_pci_irq_init(struct ar71xx_pci_controller *apc) | |||
318 | 318 | ||
319 | static void ar71xx_pci_reset(void) | 319 | static void ar71xx_pci_reset(void) |
320 | { | 320 | { |
321 | void __iomem *ddr_base = ath79_ddr_base; | ||
322 | |||
323 | ath79_device_reset_set(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); | 321 | ath79_device_reset_set(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); |
324 | mdelay(100); | 322 | mdelay(100); |
325 | 323 | ||
326 | ath79_device_reset_clear(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); | 324 | ath79_device_reset_clear(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); |
327 | mdelay(100); | 325 | mdelay(100); |
328 | 326 | ||
329 | __raw_writel(AR71XX_PCI_WIN0_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN0); | 327 | ath79_ddr_set_pci_windows(); |
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 | |||
338 | mdelay(100); | 328 | mdelay(100); |
339 | } | 329 | } |
340 | 330 | ||
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c index a1b7d2a1b0d5..0af362b5af92 100644 --- a/arch/mips/pci/pci-ar724x.c +++ b/arch/mips/pci/pci-ar724x.c | |||
@@ -231,7 +231,7 @@ static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
231 | void __iomem *base; | 231 | void __iomem *base; |
232 | u32 pending; | 232 | u32 pending; |
233 | 233 | ||
234 | apc = irq_get_handler_data(irq); | 234 | apc = irq_desc_get_handler_data(desc); |
235 | base = apc->ctrl_base; | 235 | base = apc->ctrl_base; |
236 | 236 | ||
237 | pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) & | 237 | pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) & |
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c index ec9be8ca4ada..80fafe646e74 100644 --- a/arch/mips/pci/pci-rt3883.c +++ b/arch/mips/pci/pci-rt3883.c | |||
@@ -134,7 +134,7 @@ static void rt3883_pci_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
134 | struct rt3883_pci_controller *rpc; | 134 | struct rt3883_pci_controller *rpc; |
135 | u32 pending; | 135 | u32 pending; |
136 | 136 | ||
137 | rpc = irq_get_handler_data(irq); | 137 | rpc = irq_desc_get_handler_data(desc); |
138 | 138 | ||
139 | pending = rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIINT) & | 139 | pending = rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIINT) & |
140 | rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA); | 140 | rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA); |
diff --git a/arch/mips/ralink/irq.c b/arch/mips/ralink/irq.c index 7cf91b92e9d1..da301e0a2f1f 100644 --- a/arch/mips/ralink/irq.c +++ b/arch/mips/ralink/irq.c | |||
@@ -100,7 +100,7 @@ static void ralink_intc_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
100 | u32 pending = rt_intc_r32(INTC_REG_STATUS0); | 100 | u32 pending = rt_intc_r32(INTC_REG_STATUS0); |
101 | 101 | ||
102 | if (pending) { | 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 | generic_handle_irq(irq_find_mapping(domain, __ffs(pending))); | 104 | generic_handle_irq(irq_find_mapping(domain, __ffs(pending))); |
105 | } else { | 105 | } else { |
106 | spurious_interrupt(); | 106 | spurious_interrupt(); |
diff --git a/arch/mips/sgi-ip27/Makefile b/arch/mips/sgi-ip27/Makefile index da8f6816d346..ab4affa626c7 100644 --- a/arch/mips/sgi-ip27/Makefile +++ b/arch/mips/sgi-ip27/Makefile | |||
@@ -2,9 +2,9 @@ | |||
2 | # Makefile for the IP27 specific kernel interface routines under Linux. | 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 \ | 5 | obj-y := ip27-berr.o ip27-irq.o ip27-irqno.o ip27-init.o ip27-klconfig.o \ |
6 | ip27-memory.o ip27-nmi.o ip27-reset.o ip27-timer.o ip27-hubio.o \ | 6 | ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o ip27-timer.o \ |
7 | ip27-xtalk.o | 7 | ip27-hubio.o ip27-xtalk.o |
8 | 8 | ||
9 | obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o | 9 | obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o |
10 | obj-$(CONFIG_PCI) += ip27-irq-pci.o | 10 | obj-$(CONFIG_PCI) += ip27-irq-pci.o |
diff --git a/arch/mips/sgi-ip27/ip27-irqno.c b/arch/mips/sgi-ip27/ip27-irqno.c new file mode 100644 index 000000000000..957ab58e1c00 --- /dev/null +++ b/arch/mips/sgi-ip27/ip27-irqno.c | |||
@@ -0,0 +1,48 @@ | |||
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 | } | ||
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig index 5fbd3605d24f..a8bb972fd9fd 100644 --- a/arch/mips/sibyte/Kconfig +++ b/arch/mips/sibyte/Kconfig | |||
@@ -3,7 +3,7 @@ config SIBYTE_SB1250 | |||
3 | select CEVT_SB1250 | 3 | select CEVT_SB1250 |
4 | select CSRC_SB1250 | 4 | select CSRC_SB1250 |
5 | select HW_HAS_PCI | 5 | select HW_HAS_PCI |
6 | select IRQ_CPU | 6 | select IRQ_MIPS_CPU |
7 | select SIBYTE_ENABLE_LDT_IF_PCI | 7 | select SIBYTE_ENABLE_LDT_IF_PCI |
8 | select SIBYTE_HAS_ZBUS_PROFILING | 8 | select SIBYTE_HAS_ZBUS_PROFILING |
9 | select SIBYTE_SB1xxx_SOC | 9 | select SIBYTE_SB1xxx_SOC |
@@ -13,7 +13,7 @@ config SIBYTE_BCM1120 | |||
13 | bool | 13 | bool |
14 | select CEVT_SB1250 | 14 | select CEVT_SB1250 |
15 | select CSRC_SB1250 | 15 | select CSRC_SB1250 |
16 | select IRQ_CPU | 16 | select IRQ_MIPS_CPU |
17 | select SIBYTE_BCM112X | 17 | select SIBYTE_BCM112X |
18 | select SIBYTE_HAS_ZBUS_PROFILING | 18 | select SIBYTE_HAS_ZBUS_PROFILING |
19 | select SIBYTE_SB1xxx_SOC | 19 | select SIBYTE_SB1xxx_SOC |
@@ -23,7 +23,7 @@ config SIBYTE_BCM1125 | |||
23 | select CEVT_SB1250 | 23 | select CEVT_SB1250 |
24 | select CSRC_SB1250 | 24 | select CSRC_SB1250 |
25 | select HW_HAS_PCI | 25 | select HW_HAS_PCI |
26 | select IRQ_CPU | 26 | select IRQ_MIPS_CPU |
27 | select SIBYTE_BCM112X | 27 | select SIBYTE_BCM112X |
28 | select SIBYTE_HAS_ZBUS_PROFILING | 28 | select SIBYTE_HAS_ZBUS_PROFILING |
29 | select SIBYTE_SB1xxx_SOC | 29 | select SIBYTE_SB1xxx_SOC |
@@ -33,7 +33,7 @@ config SIBYTE_BCM1125H | |||
33 | select CEVT_SB1250 | 33 | select CEVT_SB1250 |
34 | select CSRC_SB1250 | 34 | select CSRC_SB1250 |
35 | select HW_HAS_PCI | 35 | select HW_HAS_PCI |
36 | select IRQ_CPU | 36 | select IRQ_MIPS_CPU |
37 | select SIBYTE_BCM112X | 37 | select SIBYTE_BCM112X |
38 | select SIBYTE_ENABLE_LDT_IF_PCI | 38 | select SIBYTE_ENABLE_LDT_IF_PCI |
39 | select SIBYTE_HAS_ZBUS_PROFILING | 39 | select SIBYTE_HAS_ZBUS_PROFILING |
@@ -43,7 +43,7 @@ config SIBYTE_BCM112X | |||
43 | bool | 43 | bool |
44 | select CEVT_SB1250 | 44 | select CEVT_SB1250 |
45 | select CSRC_SB1250 | 45 | select CSRC_SB1250 |
46 | select IRQ_CPU | 46 | select IRQ_MIPS_CPU |
47 | select SIBYTE_SB1xxx_SOC | 47 | select SIBYTE_SB1xxx_SOC |
48 | select SIBYTE_HAS_ZBUS_PROFILING | 48 | select SIBYTE_HAS_ZBUS_PROFILING |
49 | 49 | ||
@@ -52,7 +52,7 @@ config SIBYTE_BCM1x80 | |||
52 | select CEVT_BCM1480 | 52 | select CEVT_BCM1480 |
53 | select CSRC_BCM1480 | 53 | select CSRC_BCM1480 |
54 | select HW_HAS_PCI | 54 | select HW_HAS_PCI |
55 | select IRQ_CPU | 55 | select IRQ_MIPS_CPU |
56 | select SIBYTE_HAS_ZBUS_PROFILING | 56 | select SIBYTE_HAS_ZBUS_PROFILING |
57 | select SIBYTE_SB1xxx_SOC | 57 | select SIBYTE_SB1xxx_SOC |
58 | select SYS_SUPPORTS_SMP | 58 | select SYS_SUPPORTS_SMP |
@@ -62,7 +62,7 @@ config SIBYTE_BCM1x55 | |||
62 | select CEVT_BCM1480 | 62 | select CEVT_BCM1480 |
63 | select CSRC_BCM1480 | 63 | select CSRC_BCM1480 |
64 | select HW_HAS_PCI | 64 | select HW_HAS_PCI |
65 | select IRQ_CPU | 65 | select IRQ_MIPS_CPU |
66 | select SIBYTE_SB1xxx_SOC | 66 | select SIBYTE_SB1xxx_SOC |
67 | select SIBYTE_HAS_ZBUS_PROFILING | 67 | select SIBYTE_HAS_ZBUS_PROFILING |
68 | select SYS_SUPPORTS_SMP | 68 | select SYS_SUPPORTS_SMP |
@@ -70,7 +70,7 @@ config SIBYTE_BCM1x55 | |||
70 | config SIBYTE_SB1xxx_SOC | 70 | config SIBYTE_SB1xxx_SOC |
71 | bool | 71 | bool |
72 | select DMA_COHERENT | 72 | select DMA_COHERENT |
73 | select IRQ_CPU | 73 | select IRQ_MIPS_CPU |
74 | select SWAP_IO_SPACE | 74 | select SWAP_IO_SPACE |
75 | select SYS_SUPPORTS_32BIT_KERNEL | 75 | select SYS_SUPPORTS_32BIT_KERNEL |
76 | select SYS_SUPPORTS_64BIT_KERNEL | 76 | select SYS_SUPPORTS_64BIT_KERNEL |
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig index 6d40bc783459..8c337d60f790 100644 --- a/arch/mips/txx9/Kconfig +++ b/arch/mips/txx9/Kconfig | |||
@@ -8,7 +8,7 @@ config MACH_TX49XX | |||
8 | select MACH_TXX9 | 8 | select MACH_TXX9 |
9 | select CEVT_R4K | 9 | select CEVT_R4K |
10 | select CSRC_R4K | 10 | select CSRC_R4K |
11 | select IRQ_CPU | 11 | select IRQ_MIPS_CPU |
12 | select SYS_HAS_CPU_TX49XX | 12 | select SYS_HAS_CPU_TX49XX |
13 | select SYS_SUPPORTS_64BIT_KERNEL | 13 | select SYS_SUPPORTS_64BIT_KERNEL |
14 | 14 | ||
diff --git a/arch/mips/vr41xx/Kconfig b/arch/mips/vr41xx/Kconfig index c1be6b37fb2a..74927b4d4f0b 100644 --- a/arch/mips/vr41xx/Kconfig +++ b/arch/mips/vr41xx/Kconfig | |||
@@ -8,7 +8,7 @@ config CASIO_E55 | |||
8 | select CEVT_R4K | 8 | select CEVT_R4K |
9 | select CSRC_R4K | 9 | select CSRC_R4K |
10 | select DMA_NONCOHERENT | 10 | select DMA_NONCOHERENT |
11 | select IRQ_CPU | 11 | select IRQ_MIPS_CPU |
12 | select ISA | 12 | select ISA |
13 | select SYS_SUPPORTS_32BIT_KERNEL | 13 | select SYS_SUPPORTS_32BIT_KERNEL |
14 | select SYS_SUPPORTS_LITTLE_ENDIAN | 14 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -18,7 +18,7 @@ config IBM_WORKPAD | |||
18 | select CEVT_R4K | 18 | select CEVT_R4K |
19 | select CSRC_R4K | 19 | select CSRC_R4K |
20 | select DMA_NONCOHERENT | 20 | select DMA_NONCOHERENT |
21 | select IRQ_CPU | 21 | select IRQ_MIPS_CPU |
22 | select ISA | 22 | select ISA |
23 | select SYS_SUPPORTS_32BIT_KERNEL | 23 | select SYS_SUPPORTS_32BIT_KERNEL |
24 | select SYS_SUPPORTS_LITTLE_ENDIAN | 24 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -28,7 +28,7 @@ config TANBAC_TB022X | |||
28 | select CEVT_R4K | 28 | select CEVT_R4K |
29 | select CSRC_R4K | 29 | select CSRC_R4K |
30 | select DMA_NONCOHERENT | 30 | select DMA_NONCOHERENT |
31 | select IRQ_CPU | 31 | select IRQ_MIPS_CPU |
32 | select HW_HAS_PCI | 32 | select HW_HAS_PCI |
33 | select SYS_SUPPORTS_32BIT_KERNEL | 33 | select SYS_SUPPORTS_32BIT_KERNEL |
34 | select SYS_SUPPORTS_LITTLE_ENDIAN | 34 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -44,7 +44,7 @@ config VICTOR_MPC30X | |||
44 | select CEVT_R4K | 44 | select CEVT_R4K |
45 | select CSRC_R4K | 45 | select CSRC_R4K |
46 | select DMA_NONCOHERENT | 46 | select DMA_NONCOHERENT |
47 | select IRQ_CPU | 47 | select IRQ_MIPS_CPU |
48 | select HW_HAS_PCI | 48 | select HW_HAS_PCI |
49 | select PCI_VR41XX | 49 | select PCI_VR41XX |
50 | select SYS_SUPPORTS_32BIT_KERNEL | 50 | select SYS_SUPPORTS_32BIT_KERNEL |
@@ -55,7 +55,7 @@ config ZAO_CAPCELLA | |||
55 | select CEVT_R4K | 55 | select CEVT_R4K |
56 | select CSRC_R4K | 56 | select CSRC_R4K |
57 | select DMA_NONCOHERENT | 57 | select DMA_NONCOHERENT |
58 | select IRQ_CPU | 58 | select IRQ_MIPS_CPU |
59 | select HW_HAS_PCI | 59 | select HW_HAS_PCI |
60 | select PCI_VR41XX | 60 | select PCI_VR41XX |
61 | select SYS_SUPPORTS_32BIT_KERNEL | 61 | select SYS_SUPPORTS_32BIT_KERNEL |
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 5b6af6a9319f..8732e4c5bf3c 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -24,7 +24,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o | |||
24 | obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o | 24 | obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o |
25 | obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o | 25 | obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o |
26 | obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o | 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 | obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o | 28 | obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o |
29 | obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o | 29 | obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o |
30 | obj-$(CONFIG_COMMON_CLK_MAX77802) += clk-max77802.o | 30 | obj-$(CONFIG_COMMON_CLK_MAX77802) += clk-max77802.o |
@@ -51,6 +51,7 @@ obj-$(CONFIG_ARCH_HI3xxx) += hisilicon/ | |||
51 | obj-$(CONFIG_ARCH_HIP04) += hisilicon/ | 51 | obj-$(CONFIG_ARCH_HIP04) += hisilicon/ |
52 | obj-$(CONFIG_ARCH_HIX5HD2) += hisilicon/ | 52 | obj-$(CONFIG_ARCH_HIX5HD2) += hisilicon/ |
53 | obj-$(CONFIG_ARCH_MXC) += imx/ | 53 | obj-$(CONFIG_ARCH_MXC) += imx/ |
54 | obj-$(CONFIG_MACH_INGENIC) += ingenic/ | ||
54 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ | 55 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ |
55 | ifeq ($(CONFIG_COMMON_CLK), y) | 56 | ifeq ($(CONFIG_COMMON_CLK), y) |
56 | obj-$(CONFIG_ARCH_MMP) += mmp/ | 57 | obj-$(CONFIG_ARCH_MMP) += mmp/ |
diff --git a/drivers/clk/ingenic/Makefile b/drivers/clk/ingenic/Makefile new file mode 100644 index 000000000000..cd47b0664c2b --- /dev/null +++ b/drivers/clk/ingenic/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-y += cgu.o | ||
2 | obj-$(CONFIG_MACH_JZ4740) += jz4740-cgu.o | ||
3 | obj-$(CONFIG_MACH_JZ4780) += jz4780-cgu.o | ||
diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c new file mode 100644 index 000000000000..b936cdd1a13c --- /dev/null +++ b/drivers/clk/ingenic/cgu.c | |||
@@ -0,0 +1,711 @@ | |||
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 | } | ||
diff --git a/drivers/clk/ingenic/cgu.h b/drivers/clk/ingenic/cgu.h new file mode 100644 index 000000000000..99347e2b97e8 --- /dev/null +++ b/drivers/clk/ingenic/cgu.h | |||
@@ -0,0 +1,223 @@ | |||
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__ */ | ||
diff --git a/drivers/clk/ingenic/jz4740-cgu.c b/drivers/clk/ingenic/jz4740-cgu.c new file mode 100644 index 000000000000..305a26c2a800 --- /dev/null +++ b/drivers/clk/ingenic/jz4740-cgu.c | |||
@@ -0,0 +1,303 @@ | |||
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 | } | ||
diff --git a/drivers/clk/ingenic/jz4780-cgu.c b/drivers/clk/ingenic/jz4780-cgu.c new file mode 100644 index 000000000000..431f962300b6 --- /dev/null +++ b/drivers/clk/ingenic/jz4780-cgu.c | |||
@@ -0,0 +1,733 @@ | |||
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); | ||
diff --git a/drivers/cpufreq/ls1x-cpufreq.c b/drivers/cpufreq/ls1x-cpufreq.c index f0913eee2f50..262581b3318d 100644 --- a/drivers/cpufreq/ls1x-cpufreq.c +++ b/drivers/cpufreq/ls1x-cpufreq.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | 19 | ||
20 | #include <asm/mach-loongson1/cpufreq.h> | 20 | #include <cpufreq.h> |
21 | #include <asm/mach-loongson1/loongson1.h> | 21 | #include <loongson1.h> |
22 | 22 | ||
23 | static struct { | 23 | static struct { |
24 | struct device *dev; | 24 | struct device *dev; |
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 6517132e5d8b..99c69a3205c4 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -136,6 +136,7 @@ config QCOM_SCM | |||
136 | bool | 136 | bool |
137 | depends on ARM || ARM64 | 137 | depends on ARM || ARM64 |
138 | 138 | ||
139 | source "drivers/firmware/broadcom/Kconfig" | ||
139 | source "drivers/firmware/google/Kconfig" | 140 | source "drivers/firmware/google/Kconfig" |
140 | source "drivers/firmware/efi/Kconfig" | 141 | source "drivers/firmware/efi/Kconfig" |
141 | 142 | ||
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 3001f1ae1062..4a4b897f9314 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile | |||
@@ -15,6 +15,7 @@ obj-$(CONFIG_QCOM_SCM) += qcom_scm.o | |||
15 | obj-$(CONFIG_QCOM_SCM) += qcom_scm-32.o | 15 | obj-$(CONFIG_QCOM_SCM) += qcom_scm-32.o |
16 | CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1) | 16 | CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1) |
17 | 17 | ||
18 | obj-y += broadcom/ | ||
18 | obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ | 19 | obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ |
19 | obj-$(CONFIG_EFI) += efi/ | 20 | obj-$(CONFIG_EFI) += efi/ |
20 | obj-$(CONFIG_UEFI_CPER) += efi/ | 21 | obj-$(CONFIG_UEFI_CPER) += efi/ |
diff --git a/drivers/firmware/broadcom/Kconfig b/drivers/firmware/broadcom/Kconfig new file mode 100644 index 000000000000..6bed119930dd --- /dev/null +++ b/drivers/firmware/broadcom/Kconfig | |||
@@ -0,0 +1,11 @@ | |||
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. | ||
diff --git a/drivers/firmware/broadcom/Makefile b/drivers/firmware/broadcom/Makefile new file mode 100644 index 000000000000..d0e683583cd6 --- /dev/null +++ b/drivers/firmware/broadcom/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-$(CONFIG_BCM47XX_NVRAM) += bcm47xx_nvram.o | |||
diff --git a/arch/mips/bcm47xx/nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c index ba632ff08a13..87add3fdce52 100644 --- a/arch/mips/bcm47xx/nvram.c +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c | |||
@@ -35,6 +35,7 @@ struct nvram_header { | |||
35 | }; | 35 | }; |
36 | 36 | ||
37 | static char nvram_buf[NVRAM_SPACE]; | 37 | static char nvram_buf[NVRAM_SPACE]; |
38 | static size_t nvram_len; | ||
38 | static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; | 39 | static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; |
39 | 40 | ||
40 | static u32 find_nvram_size(void __iomem *end) | 41 | static u32 find_nvram_size(void __iomem *end) |
@@ -60,7 +61,7 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim) | |||
60 | u32 *src, *dst; | 61 | u32 *src, *dst; |
61 | u32 size; | 62 | u32 size; |
62 | 63 | ||
63 | if (nvram_buf[0]) { | 64 | if (nvram_len) { |
64 | pr_warn("nvram already initialized\n"); | 65 | pr_warn("nvram already initialized\n"); |
65 | return -EEXIST; | 66 | return -EEXIST; |
66 | } | 67 | } |
@@ -94,18 +95,25 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim) | |||
94 | return -ENXIO; | 95 | return -ENXIO; |
95 | 96 | ||
96 | found: | 97 | 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; | 98 | src = (u32 *)header; |
104 | dst = (u32 *)nvram_buf; | 99 | dst = (u32 *)nvram_buf; |
105 | for (i = 0; i < sizeof(struct nvram_header); i += 4) | 100 | for (i = 0; i < sizeof(struct nvram_header); i += 4) |
106 | *dst++ = __raw_readl(src++); | 101 | *dst++ = __raw_readl(src++); |
107 | for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4) | 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) | ||
108 | *dst++ = readl(src++); | 115 | *dst++ = readl(src++); |
116 | nvram_buf[NVRAM_SPACE - 1] = '\0'; | ||
109 | 117 | ||
110 | return 0; | 118 | return 0; |
111 | } | 119 | } |
@@ -146,21 +154,18 @@ static int nvram_init(void) | |||
146 | return -ENODEV; | 154 | return -ENODEV; |
147 | 155 | ||
148 | err = mtd_read(mtd, 0, sizeof(header), &bytes_read, (uint8_t *)&header); | 156 | err = mtd_read(mtd, 0, sizeof(header), &bytes_read, (uint8_t *)&header); |
149 | if (!err && header.magic == NVRAM_MAGIC) { | 157 | if (!err && header.magic == NVRAM_MAGIC && |
150 | u8 *dst = (uint8_t *)nvram_buf; | 158 | header.len > sizeof(header)) { |
151 | size_t len = header.len; | 159 | nvram_len = header.len; |
152 | 160 | if (nvram_len >= NVRAM_SPACE) { | |
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", | 161 | 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); | 162 | header.len, NVRAM_SPACE); |
156 | len = NVRAM_SPACE; | 163 | nvram_len = NVRAM_SPACE - 1; |
157 | } | 164 | } |
158 | 165 | ||
159 | err = mtd_read(mtd, 0, len, &bytes_read, dst); | 166 | err = mtd_read(mtd, 0, nvram_len, &nvram_len, |
160 | if (err) | 167 | (u8 *)nvram_buf); |
161 | return err; | 168 | return err; |
162 | |||
163 | return 0; | ||
164 | } | 169 | } |
165 | #endif | 170 | #endif |
166 | 171 | ||
@@ -170,12 +175,12 @@ static int nvram_init(void) | |||
170 | int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) | 175 | int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) |
171 | { | 176 | { |
172 | char *var, *value, *end, *eq; | 177 | char *var, *value, *end, *eq; |
173 | int data_left, err; | 178 | int err; |
174 | 179 | ||
175 | if (!name) | 180 | if (!name) |
176 | return -EINVAL; | 181 | return -EINVAL; |
177 | 182 | ||
178 | if (!nvram_buf[0]) { | 183 | if (!nvram_len) { |
179 | err = nvram_init(); | 184 | err = nvram_init(); |
180 | if (err) | 185 | if (err) |
181 | return err; | 186 | return err; |
@@ -183,19 +188,16 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) | |||
183 | 188 | ||
184 | /* Look for name=value and return value */ | 189 | /* Look for name=value and return value */ |
185 | var = &nvram_buf[sizeof(struct nvram_header)]; | 190 | var = &nvram_buf[sizeof(struct nvram_header)]; |
186 | end = nvram_buf + sizeof(nvram_buf) - 2; | 191 | end = nvram_buf + sizeof(nvram_buf); |
187 | end[0] = '\0'; | 192 | while (var < end && *var) { |
188 | end[1] = '\0'; | 193 | eq = strchr(var, '='); |
189 | for (; *var; var = value + strlen(value) + 1) { | ||
190 | data_left = end - var; | ||
191 | |||
192 | eq = strnchr(var, data_left, '='); | ||
193 | if (!eq) | 194 | if (!eq) |
194 | break; | 195 | break; |
195 | value = eq + 1; | 196 | value = eq + 1; |
196 | if (eq - var == strlen(name) && | 197 | if (eq - var == strlen(name) && |
197 | strncmp(var, name, eq - var) == 0) | 198 | strncmp(var, name, eq - var) == 0) |
198 | return snprintf(val, val_len, "%s", value); | 199 | return snprintf(val, val_len, "%s", value); |
200 | var = value + strlen(value) + 1; | ||
199 | } | 201 | } |
200 | return -ENOENT; | 202 | return -ENOENT; |
201 | } | 203 | } |
@@ -221,3 +223,26 @@ int bcm47xx_nvram_gpio_pin(const char *name) | |||
221 | return -ENOENT; | 223 | return -ENOENT; |
222 | } | 224 | } |
223 | EXPORT_SYMBOL(bcm47xx_nvram_gpio_pin); | 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"); | ||
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 8a7d7807b596..120d81543e53 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig | |||
@@ -86,6 +86,11 @@ config IMGPDC_IRQ | |||
86 | select GENERIC_IRQ_CHIP | 86 | select GENERIC_IRQ_CHIP |
87 | select IRQ_DOMAIN | 87 | select IRQ_DOMAIN |
88 | 88 | ||
89 | config IRQ_MIPS_CPU | ||
90 | bool | ||
91 | select GENERIC_IRQ_CHIP | ||
92 | select IRQ_DOMAIN | ||
93 | |||
89 | config CLPS711X_IRQCHIP | 94 | config CLPS711X_IRQCHIP |
90 | bool | 95 | bool |
91 | depends on ARCH_CLPS711X | 96 | depends on ARCH_CLPS711X |
@@ -160,10 +165,15 @@ config MIPS_GIC | |||
160 | bool | 165 | bool |
161 | select MIPS_CM | 166 | select MIPS_CM |
162 | 167 | ||
168 | config INGENIC_IRQ | ||
169 | bool | ||
170 | depends on MACH_INGENIC | ||
171 | default y | ||
172 | |||
163 | config RENESAS_H8300H_INTC | 173 | config RENESAS_H8300H_INTC |
164 | bool | 174 | bool |
165 | select IRQ_DOMAIN | 175 | select IRQ_DOMAIN |
166 | 176 | ||
167 | config RENESAS_H8S_INTC | 177 | config RENESAS_H8S_INTC |
168 | bool | 178 | bool |
169 | select IRQ_DOMAIN \ No newline at end of file | 179 | select IRQ_DOMAIN |
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 5c9adf1f554d..b8d4e9691890 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -28,6 +28,7 @@ obj-$(CONFIG_ARM_VIC) += irq-vic.o | |||
28 | obj-$(CONFIG_ATMEL_AIC_IRQ) += irq-atmel-aic-common.o irq-atmel-aic.o | 28 | obj-$(CONFIG_ATMEL_AIC_IRQ) += irq-atmel-aic-common.o irq-atmel-aic.o |
29 | obj-$(CONFIG_ATMEL_AIC5_IRQ) += irq-atmel-aic-common.o irq-atmel-aic5.o | 29 | obj-$(CONFIG_ATMEL_AIC5_IRQ) += irq-atmel-aic-common.o irq-atmel-aic5.o |
30 | obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o | 30 | obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o |
31 | obj-$(CONFIG_IRQ_MIPS_CPU) += irq-mips-cpu.o | ||
31 | obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o | 32 | obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o |
32 | obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o | 33 | obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o |
33 | obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o | 34 | obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o |
@@ -50,3 +51,4 @@ obj-$(CONFIG_ARCH_DIGICOLOR) += irq-digicolor.o | |||
50 | obj-$(CONFIG_RENESAS_H8300H_INTC) += irq-renesas-h8300h.o | 51 | obj-$(CONFIG_RENESAS_H8300H_INTC) += irq-renesas-h8300h.o |
51 | obj-$(CONFIG_RENESAS_H8S_INTC) += irq-renesas-h8s.o | 52 | obj-$(CONFIG_RENESAS_H8S_INTC) += irq-renesas-h8s.o |
52 | obj-$(CONFIG_ARCH_SA1100) += irq-sa11x0.o | 53 | obj-$(CONFIG_ARCH_SA1100) += irq-sa11x0.o |
54 | obj-$(CONFIG_INGENIC_IRQ) += irq-ingenic.o | ||
diff --git a/drivers/irqchip/irq-ingenic.c b/drivers/irqchip/irq-ingenic.c new file mode 100644 index 000000000000..005de3f932ae --- /dev/null +++ b/drivers/irqchip/irq-ingenic.c | |||
@@ -0,0 +1,177 @@ | |||
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); | ||
diff --git a/arch/mips/kernel/irq_cpu.c b/drivers/irqchip/irq-mips-cpu.c index 6eb7a3f515fc..a43c41988009 100644 --- a/arch/mips/kernel/irq_cpu.c +++ b/drivers/irqchip/irq-mips-cpu.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <asm/mipsmtregs.h> | 38 | #include <asm/mipsmtregs.h> |
39 | #include <asm/setup.h> | 39 | #include <asm/setup.h> |
40 | 40 | ||
41 | #include "irqchip.h" | ||
42 | |||
41 | static inline void unmask_mips_irq(struct irq_data *d) | 43 | static inline void unmask_mips_irq(struct irq_data *d) |
42 | { | 44 | { |
43 | set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); | 45 | set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); |
@@ -167,3 +169,4 @@ int __init mips_cpu_irq_of_init(struct device_node *of_node, | |||
167 | __mips_cpu_irq_init(of_node); | 169 | __mips_cpu_irq_init(of_node); |
168 | return 0; | 170 | return 0; |
169 | } | 171 | } |
172 | IRQCHIP_DECLARE(cpu_intc, "mti,cpu-interrupt-controller", mips_cpu_irq_of_init); | ||
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 487d057431cc..c0e6ede3e27d 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -267,6 +267,13 @@ config PHY_EXYNOS5_USBDRD | |||
267 | This driver provides PHY interface for USB 3.0 DRD controller | 267 | This driver provides PHY interface for USB 3.0 DRD controller |
268 | present on Exynos5 SoC series. | 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 | config PHY_QCOM_APQ8064_SATA | 277 | config PHY_QCOM_APQ8064_SATA |
271 | tristate "Qualcomm APQ8064 SATA SerDes/PHY driver" | 278 | tristate "Qualcomm APQ8064 SATA SerDes/PHY driver" |
272 | depends on ARCH_QCOM | 279 | depends on ARCH_QCOM |
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 42f58e95aff0..f344e1b2e825 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile | |||
@@ -44,3 +44,4 @@ obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-20nm.o | |||
44 | obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-14nm.o | 44 | obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-14nm.o |
45 | obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o | 45 | obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o |
46 | obj-$(CONFIG_PHY_BRCMSTB_SATA) += phy-brcmstb-sata.o | 46 | obj-$(CONFIG_PHY_BRCMSTB_SATA) += phy-brcmstb-sata.o |
47 | obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o | ||
diff --git a/drivers/phy/phy-pistachio-usb.c b/drivers/phy/phy-pistachio-usb.c new file mode 100644 index 000000000000..c6db35e6bb63 --- /dev/null +++ b/drivers/phy/phy-pistachio-usb.c | |||
@@ -0,0 +1,206 @@ | |||
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"); | ||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index db2fe4ab4b4a..83b4b89b9d5a 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -1503,7 +1503,7 @@ config RTC_DRV_PUV3 | |||
1503 | 1503 | ||
1504 | config RTC_DRV_LOONGSON1 | 1504 | config RTC_DRV_LOONGSON1 |
1505 | tristate "loongson1 RTC support" | 1505 | tristate "loongson1 RTC support" |
1506 | depends on MACH_LOONGSON1 | 1506 | depends on MACH_LOONGSON32 |
1507 | help | 1507 | help |
1508 | This is a driver for the loongson1 on-chip Counter0 (Time-Of-Year | 1508 | This is a driver for the loongson1 on-chip Counter0 (Time-Of-Year |
1509 | counter) to be used as a RTC. | 1509 | counter) to be used as a RTC. |
diff --git a/drivers/rtc/rtc-ls1x.c b/drivers/rtc/rtc-ls1x.c index 8445e564094a..22a9ec4f2b83 100644 --- a/drivers/rtc/rtc-ls1x.c +++ b/drivers/rtc/rtc-ls1x.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <asm/mach-loongson1/loongson1.h> | 20 | #include <loongson1.h> |
21 | 21 | ||
22 | #define LS1X_RTC_REG_OFFSET (LS1X_RTC_BASE + 0x20) | 22 | #define LS1X_RTC_REG_OFFSET (LS1X_RTC_BASE + 0x20) |
23 | #define LS1X_RTC_REGS(x) \ | 23 | #define LS1X_RTC_REGS(x) \ |
diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c new file mode 100644 index 000000000000..21bf81fe794f --- /dev/null +++ b/drivers/tty/serial/8250/8250_ingenic.c | |||
@@ -0,0 +1,266 @@ | |||
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"); | ||
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig index a74a8e4717d4..e1de1181b322 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig | |||
@@ -357,3 +357,12 @@ config SERIAL_8250_UNIPHIER | |||
357 | help | 357 | help |
358 | If you have a UniPhier based board and want to use the on-chip | 358 | If you have a UniPhier based board and want to use the on-chip |
359 | serial ports, say Y to this option. If unsure, say N. | 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. | ||
diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Makefile index 6fa22ffad63d..706295913c34 100644 --- a/drivers/tty/serial/8250/Makefile +++ b/drivers/tty/serial/8250/Makefile | |||
@@ -25,3 +25,6 @@ obj-$(CONFIG_SERIAL_8250_FINTEK) += 8250_fintek.o | |||
25 | obj-$(CONFIG_SERIAL_8250_LPC18XX) += 8250_lpc18xx.o | 25 | obj-$(CONFIG_SERIAL_8250_LPC18XX) += 8250_lpc18xx.o |
26 | obj-$(CONFIG_SERIAL_8250_MT6577) += 8250_mtk.o | 26 | obj-$(CONFIG_SERIAL_8250_MT6577) += 8250_mtk.o |
27 | obj-$(CONFIG_SERIAL_8250_UNIPHIER) += 8250_uniphier.o | 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 | ||
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 1c4791033b72..2847108cc8dd 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
@@ -462,6 +462,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
462 | /* v: May be registered for frame buffer console restore */ | 462 | /* v: May be registered for frame buffer console restore */ |
463 | NULL, /* v */ | 463 | NULL, /* v */ |
464 | &sysrq_showstate_blocked_op, /* w */ | 464 | &sysrq_showstate_blocked_op, /* w */ |
465 | /* x: May be registered on mips for TLB dump */ | ||
465 | /* x: May be registered on ppc/powerpc for xmon */ | 466 | /* x: May be registered on ppc/powerpc for xmon */ |
466 | /* x: May be registered on sparc64 for global PMU dump */ | 467 | /* x: May be registered on sparc64 for global PMU dump */ |
467 | NULL, /* x */ | 468 | NULL, /* x */ |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 547cee83400b..8afc3c1efdab 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -295,7 +295,7 @@ config USB_OCTEON_EHCI | |||
295 | bool "Octeon on-chip EHCI support (DEPRECATED)" | 295 | bool "Octeon on-chip EHCI support (DEPRECATED)" |
296 | depends on CAVIUM_OCTEON_SOC | 296 | depends on CAVIUM_OCTEON_SOC |
297 | default n | 297 | default n |
298 | select USB_EHCI_BIG_ENDIAN_MMIO | 298 | select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN |
299 | select USB_EHCI_HCD_PLATFORM | 299 | select USB_EHCI_HCD_PLATFORM |
300 | help | 300 | help |
301 | This option is deprecated now and the driver was removed, use | 301 | This option is deprecated now and the driver was removed, use |
@@ -568,7 +568,7 @@ config USB_OCTEON_OHCI | |||
568 | bool "Octeon on-chip OHCI support (DEPRECATED)" | 568 | bool "Octeon on-chip OHCI support (DEPRECATED)" |
569 | depends on CAVIUM_OCTEON_SOC | 569 | depends on CAVIUM_OCTEON_SOC |
570 | default USB_OCTEON_EHCI | 570 | default USB_OCTEON_EHCI |
571 | select USB_OHCI_BIG_ENDIAN_MMIO | 571 | select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN |
572 | select USB_OHCI_LITTLE_ENDIAN | 572 | select USB_OHCI_LITTLE_ENDIAN |
573 | select USB_OHCI_HCD_PLATFORM | 573 | select USB_OHCI_HCD_PLATFORM |
574 | help | 574 | help |
diff --git a/include/dt-bindings/clock/jz4740-cgu.h b/include/dt-bindings/clock/jz4740-cgu.h new file mode 100644 index 000000000000..43153d3e9bd2 --- /dev/null +++ b/include/dt-bindings/clock/jz4740-cgu.h | |||
@@ -0,0 +1,37 @@ | |||
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__ */ | ||
diff --git a/include/dt-bindings/clock/jz4780-cgu.h b/include/dt-bindings/clock/jz4780-cgu.h new file mode 100644 index 000000000000..467165e3cfee --- /dev/null +++ b/include/dt-bindings/clock/jz4780-cgu.h | |||
@@ -0,0 +1,88 @@ | |||
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__ */ | ||
diff --git a/include/dt-bindings/phy/phy-pistachio-usb.h b/include/dt-bindings/phy/phy-pistachio-usb.h new file mode 100644 index 000000000000..d1877aa0a3f5 --- /dev/null +++ b/include/dt-bindings/phy/phy-pistachio-usb.h | |||
@@ -0,0 +1,16 @@ | |||
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 */ | ||
diff --git a/include/linux/bcm47xx_nvram.h b/include/linux/bcm47xx_nvram.h index b12b07e75929..2793652fbf66 100644 --- a/include/linux/bcm47xx_nvram.h +++ b/include/linux/bcm47xx_nvram.h | |||
@@ -10,11 +10,17 @@ | |||
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/vmalloc.h> | ||
13 | 14 | ||
14 | #ifdef CONFIG_BCM47XX | 15 | #ifdef CONFIG_BCM47XX_NVRAM |
15 | int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); | 16 | int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); |
16 | int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); | 17 | int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); |
17 | int bcm47xx_nvram_gpio_pin(const char *name); | 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 | #else | 24 | #else |
19 | static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) | 25 | static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) |
20 | { | 26 | { |
@@ -29,6 +35,15 @@ static inline int bcm47xx_nvram_gpio_pin(const char *name) | |||
29 | { | 35 | { |
30 | return -ENOTSUPP; | 36 | return -ENOTSUPP; |
31 | }; | 37 | }; |
38 | |||
39 | static inline char *bcm47xx_nvram_get_contents(size_t *val_len) | ||
40 | { | ||
41 | return NULL; | ||
42 | }; | ||
43 | |||
44 | static inline void bcm47xx_nvram_release_contents(char *nvram) | ||
45 | { | ||
46 | }; | ||
32 | #endif | 47 | #endif |
33 | 48 | ||
34 | #endif /* __BCM47XX_NVRAM_H */ | 49 | #endif /* __BCM47XX_NVRAM_H */ |
diff --git a/arch/mips/jz4740/irq.h b/include/linux/irqchip/ingenic.h index 0f48720b5b63..0ee319a4029d 100644 --- a/arch/mips/jz4740/irq.h +++ b/include/linux/irqchip/ingenic.h | |||
@@ -12,12 +12,12 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef __MIPS_JZ4740_IRQ_H__ | 15 | #ifndef __LINUX_IRQCHIP_INGENIC_H__ |
16 | #define __MIPS_JZ4740_IRQ_H__ | 16 | #define __LINUX_IRQCHIP_INGENIC_H__ |
17 | 17 | ||
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | 19 | ||
20 | extern void jz4740_irq_suspend(struct irq_data *data); | 20 | extern void ingenic_intc_irq_suspend(struct irq_data *data); |
21 | extern void jz4740_irq_resume(struct irq_data *data); | 21 | extern void ingenic_intc_irq_resume(struct irq_data *data); |
22 | 22 | ||
23 | #endif | 23 | #endif |
diff --git a/include/linux/platform_data/gpio-ath79.h b/include/linux/platform_data/gpio-ath79.h new file mode 100644 index 000000000000..88b0db7bee74 --- /dev/null +++ b/include/linux/platform_data/gpio-ath79.h | |||
@@ -0,0 +1,19 @@ | |||
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 | ||
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 4568a5cc9ab8..c3d1a525bacc 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -29,10 +29,13 @@ struct ssb_sprom { | |||
29 | u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */ | 29 | u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */ |
30 | u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */ | 30 | u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */ |
31 | u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */ | 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 | u8 et0phyaddr; /* MII address for enet0 */ | 33 | u8 et0phyaddr; /* MII address for enet0 */ |
33 | u8 et1phyaddr; /* MII address for enet1 */ | 34 | u8 et1phyaddr; /* MII address for enet1 */ |
35 | u8 et2phyaddr; /* MII address for enet2 */ | ||
34 | u8 et0mdcport; /* MDIO for enet0 */ | 36 | u8 et0mdcport; /* MDIO for enet0 */ |
35 | u8 et1mdcport; /* MDIO for enet1 */ | 37 | u8 et1mdcport; /* MDIO for enet1 */ |
38 | u8 et2mdcport; /* MDIO for enet2 */ | ||
36 | u16 dev_id; /* Device ID overriding e.g. PCI ID */ | 39 | u16 dev_id; /* Device ID overriding e.g. PCI ID */ |
37 | u16 board_rev; /* Board revision number from SPROM. */ | 40 | u16 board_rev; /* Board revision number from SPROM. */ |
38 | u16 board_num; /* Board number from SPROM. */ | 41 | u16 board_num; /* Board number from SPROM. */ |
@@ -88,11 +91,14 @@ struct ssb_sprom { | |||
88 | u32 ofdm5glpo; /* 5.2GHz OFDM power offset */ | 91 | u32 ofdm5glpo; /* 5.2GHz OFDM power offset */ |
89 | u32 ofdm5gpo; /* 5.3GHz OFDM power offset */ | 92 | u32 ofdm5gpo; /* 5.3GHz OFDM power offset */ |
90 | u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */ | 93 | u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */ |
94 | u32 boardflags; | ||
95 | u32 boardflags2; | ||
96 | u32 boardflags3; | ||
97 | /* TODO: Switch all drivers to new u32 fields and drop below ones */ | ||
91 | u16 boardflags_lo; /* Board flags (bits 0-15) */ | 98 | u16 boardflags_lo; /* Board flags (bits 0-15) */ |
92 | u16 boardflags_hi; /* Board flags (bits 16-31) */ | 99 | u16 boardflags_hi; /* Board flags (bits 16-31) */ |
93 | u16 boardflags2_lo; /* Board flags (bits 32-47) */ | 100 | u16 boardflags2_lo; /* Board flags (bits 32-47) */ |
94 | u16 boardflags2_hi; /* Board flags (bits 48-63) */ | 101 | u16 boardflags2_hi; /* Board flags (bits 48-63) */ |
95 | /* TODO store board flags in a single u64 */ | ||
96 | 102 | ||
97 | struct ssb_sprom_core_pwr_info core_pwr_info[4]; | 103 | struct ssb_sprom_core_pwr_info core_pwr_info[4]; |
98 | 104 | ||