Pull ARM SoC updates from Olof Johansson: "A few SoC (code) changes have queued up this cycle, mostly for minor changes and some refactoring and cleanup of legacy platforms. This branch also contains a few of the fixes that weren't sent in by the end of the release (all fairly minor). - Adding an additional maintainer for the TEE subsystem (Sumit Garg) - Quite a significant modernization of the IXP4xx platforms by Linus Walleij, revisiting with a new PCI host driver/binding, removing legacy mach/* include dependencies and moving platform detection/config to drivers/soc. Also some updates/cleanup of platform data. - Core power domain support for Tegra platforms, and some improvements in build test coverage by adding stubs for compile test targets. - A handful of updates to i.MX platforms, adding legacy (non-PSCI) SMP support on i.MX7D, SoC ID setup for i.MX50, removal of platform data and board fixups for iMX6/7. ... and a few smaller changes and fixes for Samsung, OMAP, Allwinner, Rockchip" * tag 'arm-soc-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (53 commits) MAINTAINERS: Add myself as TEE subsystem reviewer ixp4xx: fix spelling mistake in Kconfig "Devce" -> "Device" hw_random: ixp4xx: Add OF support hw_random: ixp4xx: Add DT bindings hw_random: ixp4xx: Turn into a module hw_random: ixp4xx: Use SPDX license tag hw_random: ixp4xx: enable compile-testing pata: ixp4xx: split platform data to its own header soc: ixp4xx: move cpu detection to linux/soc/ixp4xx/cpu.h PCI: ixp4xx: Add a new driver for IXP4xx PCI: ixp4xx: Add device tree bindings for IXP4xx ARM/ixp4xx: Make NEED_MACH_IO_H optional ARM/ixp4xx: Move the virtual IObases MAINTAINERS: ARM/MStar/Sigmastar SoCs: Add a link to the MStar tree ARM: debug: add UART early console support for MSTAR SoCs ARM: dts: ux500: Fix LED probing ARM: imx: add smp support for imx7d ARM: imx6q: drop of_platform_default_populate() from init_machine arm64: dts: rockchip: Update RK3399 PCI host bridge window to 32-bit address memory soc/tegra: fuse: Fix Tegra234-only builds ...
Unified · Split
| @@ -0,0 +1,100 @@ | ||
| 1 | +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | |
| 2 | +%YAML 1.2 | |
| 3 | +--- | |
| 4 | +$id: http://devicetree.org/schemas/pci/intel,ixp4xx-pci.yaml# | |
| 5 | +$schema: http://devicetree.org/meta-schemas/core.yaml# | |
| 6 | + | |
| 7 | +title: Intel IXP4xx PCI controller | |
| 8 | + | |
| 9 | +maintainers: | |
| 10 | + - Linus Walleij <linus.walleij@linaro.org> | |
| 11 | + | |
| 12 | +description: PCI host controller found in the Intel IXP4xx SoC series. | |
| 13 | + | |
| 14 | +allOf: | |
| 15 | + - $ref: /schemas/pci/pci-bus.yaml# | |
| 16 | + | |
| 17 | +properties: | |
| 18 | + compatible: | |
| 19 | + items: | |
| 20 | + - enum: | |
| 21 | + - intel,ixp42x-pci | |
| 22 | + - intel,ixp43x-pci | |
| 23 | + description: The two supported variants are ixp42x and ixp43x, | |
| 24 | + though more variants may exist. | |
| 25 | + | |
| 26 | + reg: | |
| 27 | + items: | |
| 28 | + - description: IXP4xx-specific registers | |
| 29 | + | |
| 30 | + interrupts: | |
| 31 | + items: | |
| 32 | + - description: Main PCI interrupt | |
| 33 | + - description: PCI DMA interrupt 1 | |
| 34 | + - description: PCI DMA interrupt 2 | |
| 35 | + | |
| 36 | + ranges: | |
| 37 | + maxItems: 2 | |
| 38 | + description: Typically one memory range of 64MB and one IO | |
| 39 | + space range of 64KB. | |
| 40 | + | |
| 41 | + dma-ranges: | |
| 42 | + maxItems: 1 | |
| 43 | + description: The DMA range tells the PCI host which addresses | |
| 44 | + the RAM is at. It can map only 64MB so if the RAM is bigger | |
| 45 | + than 64MB the DMA access has to be restricted to these | |
| 46 | + addresses. | |
| 47 | + | |
| 48 | + "#interrupt-cells": true | |
| 49 | + | |
| 50 | + interrupt-map: true | |
| 51 | + | |
| 52 | + interrupt-map-mask: | |
| 53 | + items: | |
| 54 | + - const: 0xf800 | |
| 55 | + - const: 0 | |
| 56 | + - const: 0 | |
| 57 | + - const: 7 | |
| 58 | + | |
| 59 | +required: | |
| 60 | + - compatible | |
| 61 | + - reg | |
| 62 | + - dma-ranges | |
| 63 | + - "#interrupt-cells" | |
| 64 | + - interrupt-map | |
| 65 | + - interrupt-map-mask | |
| 66 | + | |
| 67 | +unevaluatedProperties: false | |
| 68 | + | |
| 69 | +examples: | |
| 70 | + - | | |
| 71 | + pci@c0000000 { | |
| 72 | + compatible = "intel,ixp43x-pci"; | |
| 73 | + reg = <0xc0000000 0x1000>; | |
| 74 | + #address-cells = <3>; | |
| 75 | + #size-cells = <2>; | |
| 76 | + device_type = "pci"; | |
| 77 | + bus-range = <0x00 0xff>; | |
| 78 | + | |
| 79 | + ranges = | |
| 80 | + <0x02000000 0 0x48000000 0x48000000 0 0x04000000>, | |
| 81 | + <0x01000000 0 0x00000000 0x4c000000 0 0x00010000>; | |
| 82 | + dma-ranges = | |
| 83 | + <0x02000000 0 0x00000000 0x00000000 0 0x04000000>; | |
| 84 | + | |
| 85 | + #interrupt-cells = <1>; | |
| 86 | + interrupt-map-mask = <0xf800 0 0 7>; | |
| 87 | + interrupt-map = | |
| 88 | + <0x0800 0 0 1 &gpio0 11 3>, /* INT A on slot 1 is irq 11 */ | |
| 89 | + <0x0800 0 0 2 &gpio0 10 3>, /* INT B on slot 1 is irq 10 */ | |
| 90 | + <0x0800 0 0 3 &gpio0 9 3>, /* INT C on slot 1 is irq 9 */ | |
| 91 | + <0x0800 0 0 4 &gpio0 8 3>, /* INT D on slot 1 is irq 8 */ | |
| 92 | + <0x1000 0 0 1 &gpio0 10 3>, /* INT A on slot 2 is irq 10 */ | |
| 93 | + <0x1000 0 0 2 &gpio0 9 3>, /* INT B on slot 2 is irq 9 */ | |
| 94 | + <0x1000 0 0 3 &gpio0 8 3>, /* INT C on slot 2 is irq 8 */ | |
| 95 | + <0x1000 0 0 4 &gpio0 11 3>, /* INT D on slot 2 is irq 11 */ | |
| 96 | + <0x1800 0 0 1 &gpio0 9 3>, /* INT A on slot 3 is irq 9 */ | |
| 97 | + <0x1800 0 0 2 &gpio0 8 3>, /* INT B on slot 3 is irq 8 */ | |
| 98 | + <0x1800 0 0 3 &gpio0 11 3>, /* INT C on slot 3 is irq 11 */ | |
| 99 | + <0x1800 0 0 4 &gpio0 10 3>; /* INT D on slot 3 is irq 10 */ | |
| 100 | + }; | |
| @@ -0,0 +1,36 @@ | ||
| 1 | +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | |
| 2 | +%YAML 1.2 | |
| 3 | +--- | |
| 4 | +$id: http://devicetree.org/schemas/rng/intel,ixp46x-rng.yaml# | |
| 5 | +$schema: http://devicetree.org/meta-schemas/core.yaml# | |
| 6 | + | |
| 7 | +title: Intel IXP46x RNG bindings | |
| 8 | + | |
| 9 | +description: | | |
| 10 | + The Intel IXP46x has a random number generator at a fixed physical | |
| 11 | + location in memory. Each read is guaranteed to provide a unique | |
| 12 | + 32 bit random number. | |
| 13 | + | |
| 14 | +maintainers: | |
| 15 | + - Linus Walleij <linus.walleij@linaro.org> | |
| 16 | + | |
| 17 | +properties: | |
| 18 | + compatible: | |
| 19 | + const: intel,ixp46x-rng | |
| 20 | + | |
| 21 | + reg: | |
| 22 | + maxItems: 1 | |
| 23 | + | |
| 24 | +required: | |
| 25 | + - compatible | |
| 26 | + - reg | |
| 27 | + | |
| 28 | +additionalProperties: false | |
| 29 | + | |
| 30 | +examples: | |
| 31 | + - | | |
| 32 | + rng@70002100 { | |
| 33 | + compatible = "intel,ixp46x-rng"; | |
| 34 | + reg = <0x70002100 4>; | |
| 35 | + }; | |
| 36 | + | |
| @@ -2210,6 +2210,7 @@ M: Daniel Palmer <daniel@thingy.jp> · 2209 unmodified lines | ||
| 2210 | 2210 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 2211 | 2211 | S: Maintained |
| 2212 | 2212 | W: http://linux-chenxing.org/ |
| 2213 | +T: git git://github.com/linux-chenxing/linux.git | |
| 2213 | 2214 | F: Documentation/devicetree/bindings/arm/mstar/* |
| 2214 | 2215 | F: Documentation/devicetree/bindings/clock/mstar,msc313-mpll.yaml |
| 2215 | 2216 | F: Documentation/devicetree/bindings/gpio/mstar,msc313-gpio.yaml |
| @@ -2479,9 +2480,12 @@ F: drivers/*/*/*s3c24* · 263 unmodified lines | ||
| 2479 | 2480 | F: drivers/*/*s3c24* |
| 2480 | 2481 | F: drivers/*/*s3c64xx* |
| 2481 | 2482 | F: drivers/*/*s5pv210* |
| 2483 | +F: drivers/clocksource/samsung_pwm_timer.c | |
| 2482 | 2484 | F: drivers/memory/samsung/ |
| 2485 | +F: drivers/pwm/pwm-samsung.c | |
| 2483 | 2486 | F: drivers/soc/samsung/ |
| 2484 | 2487 | F: drivers/tty/serial/samsung* |
| 2488 | +F: include/clocksource/samsung_pwm.h | |
| 2485 | 2489 | F: include/linux/platform_data/*s3c* |
| 2486 | 2490 | F: include/linux/serial_s3c.h |
| 2487 | 2491 | F: include/linux/soc/samsung/ |
| @@ -9381,6 +9385,7 @@ F: include/linux/soc/ixp4xx/qmgr.h · 6893 unmodified lines | ||
| 9381 | 9385 | INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT |
| 9382 | 9386 | M: Deepak Saxena <dsaxena@plexity.net> |
| 9383 | 9387 | S: Maintained |
| 9388 | +F: Documentation/devicetree/bindings/display/intel,ixp46x-rng.yaml | |
| 9384 | 9389 | F: drivers/char/hw_random/ixp4xx-rng.c |
| 9385 | 9390 | |
| 9386 | 9391 | INTEL KEEM BAY DRM DRIVER |
| @@ -13510,12 +13515,6 @@ L: linux-omap@vger.kernel.org · 4123 unmodified lines | ||
| 13510 | 13515 | S: Maintained |
| 13511 | 13516 | F: arch/arm/mach-omap2/omap_hwmod*data* |
| 13512 | 13517 | |
| 13513 | −OMAP HWMOD DATA FOR OMAP4-BASED DEVICES | |
| 13514 | −M: Benoît Cousson <bcousson@baylibre.com> | |
| 13515 | −L: linux-omap@vger.kernel.org | |
| 13516 | −S: Maintained | |
| 13517 | −F: arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |
| 13518 | − | |
| 13519 | 13518 | OMAP HWMOD SUPPORT |
| 13520 | 13519 | M: Benoît Cousson <bcousson@baylibre.com> |
| 13521 | 13520 | M: Paul Walmsley <paul@pwsan.com> |
| @@ -14179,6 +14178,12 @@ S: Maintained · 657 unmodified lines | ||
| 14179 | 14178 | F: Documentation/devicetree/bindings/pci/sifive,fu740-pcie.yaml |
| 14180 | 14179 | F: drivers/pci/controller/dwc/pcie-fu740.c |
| 14181 | 14180 | |
| 14181 | +PCI DRIVER FOR INTEL IXP4XX | |
| 14182 | +M: Linus Walleij <linus.walleij@linaro.org> | |
| 14183 | +S: Maintained | |
| 14184 | +F: Documentation/devicetree/bindings/pci/intel,ixp4xx-pci.yaml | |
| 14185 | +F: drivers/pci/controller/pci-ixp4xx.c | |
| 14186 | + | |
| 14182 | 14187 | PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) |
| 14183 | 14188 | M: Jonathan Derrick <jonathan.derrick@intel.com> |
| 14184 | 14189 | L: linux-pci@vger.kernel.org |
| @@ -18126,6 +18131,7 @@ F: include/media/i2c/tw9910.h · 3941 unmodified lines | ||
| 18126 | 18131 | |
| 18127 | 18132 | TEE SUBSYSTEM |
| 18128 | 18133 | M: Jens Wiklander <jens.wiklander@linaro.org> |
| 18134 | +R: Sumit Garg <sumit.garg@linaro.org> | |
| 18129 | 18135 | L: op-tee@lists.trustedfirmware.org |
| 18130 | 18136 | S: Maintained |
| 18131 | 18137 | F: Documentation/staging/tee.rst |
| @@ -394,7 +394,8 @@ config ARCH_IXP4XX · 393 unmodified lines | ||
| 394 | 394 | select HAVE_PCI |
| 395 | 395 | select IXP4XX_IRQ |
| 396 | 396 | select IXP4XX_TIMER |
| 397 | − select NEED_MACH_IO_H | |
| 397 | + # With the new PCI driver this is not needed | |
| 398 | + select NEED_MACH_IO_H if PCI_IXP4XX_LEGACY | |
| 398 | 399 | select USB_EHCI_BIG_ENDIAN_DESC |
| 399 | 400 | select USB_EHCI_BIG_ENDIAN_MMIO |
| 400 | 401 | help |
| @@ -609,6 +609,14 @@ choice · 608 unmodified lines | ||
| 609 | 609 | when u-boot hands over to the kernel, the system |
| 610 | 610 | silently crashes, with no serial output at all. |
| 611 | 611 | |
| 612 | + config DEBUG_MSTARV7_PMUART | |
| 613 | + bool "Kernel low-level debugging messages via MSTARV7 PM UART" | |
| 614 | + depends on ARCH_MSTARV7 | |
| 615 | + select DEBUG_UART_8250 | |
| 616 | + help | |
| 617 | + Say Y here if you want kernel low-level debugging support | |
| 618 | + for MSTAR ARMv7-based platforms on PM UART. | |
| 619 | + | |
| 612 | 620 | config DEBUG_MT6589_UART0 |
| 613 | 621 | bool "Mediatek mt6589 UART0" |
| 614 | 622 | depends on ARCH_MEDIATEK |
| @@ -1607,6 +1615,7 @@ config DEBUG_UART_PHYS · 992 unmodified lines | ||
| 1607 | 1615 | default 0x18000400 if DEBUG_BCM_HR2 |
| 1608 | 1616 | default 0x18023000 if DEBUG_BCM_IPROC_UART3 |
| 1609 | 1617 | default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1 |
| 1618 | + default 0x1f221000 if DEBUG_MSTARV7_PMUART | |
| 1610 | 1619 | default 0x20001000 if DEBUG_HIP01_UART |
| 1611 | 1620 | default 0x20060000 if DEBUG_RK29_UART0 |
| 1612 | 1621 | default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2 |
| @@ -1724,6 +1733,7 @@ config DEBUG_UART_VIRT · 111 unmodified lines | ||
| 1724 | 1733 | default 0xf0100000 if DEBUG_DIGICOLOR_UA0 |
| 1725 | 1734 | default 0xf01fb000 if DEBUG_NOMADIK_UART |
| 1726 | 1735 | default 0xf0201000 if DEBUG_BCM2835 || DEBUG_BCM2836 |
| 1736 | + default 0xf0221000 if DEBUG_MSTARV7_PMUART | |
| 1727 | 1737 | default 0xf1000300 if DEBUG_BCM_5301X |
| 1728 | 1738 | default 0xf1000400 if DEBUG_BCM_HR2 |
| 1729 | 1739 | default 0xf1002000 if DEBUG_MT8127_UART0 |
| @@ -1805,8 +1815,8 @@ config DEBUG_UART_VIRT · 75 unmodified lines | ||
| 1805 | 1815 | default 0xfedc0000 if DEBUG_EP93XX |
| 1806 | 1816 | default 0xfee003f8 if DEBUG_FOOTBRIDGE_COM1 |
| 1807 | 1817 | default 0xfee20000 if DEBUG_NSPIRE_CLASSIC_UART || DEBUG_NSPIRE_CX_UART |
| 1808 | − default 0xfef00000 if ARCH_IXP4XX && !CPU_BIG_ENDIAN | |
| 1809 | − default 0xfef00003 if ARCH_IXP4XX && CPU_BIG_ENDIAN | |
| 1818 | + default 0xfec00000 if ARCH_IXP4XX && !CPU_BIG_ENDIAN | |
| 1819 | + default 0xfec00003 if ARCH_IXP4XX && CPU_BIG_ENDIAN | |
| 1810 | 1820 | default 0xfef36000 if DEBUG_HIGHBANK_UART |
| 1811 | 1821 | default 0xfefb0000 if DEBUG_OMAP1UART1 || DEBUG_OMAP7XXUART1 |
| 1812 | 1822 | default 0xfefb0800 if DEBUG_OMAP1UART2 || DEBUG_OMAP7XXUART2 |
| @@ -1829,6 +1839,7 @@ config DEBUG_UART_8250_SHIFT · 16 unmodified lines | ||
| 1829 | 1839 | default 0 if DEBUG_FOOTBRIDGE_COM1 || ARCH_IOP32X || DEBUG_BCM_5301X || \ |
| 1830 | 1840 | DEBUG_BCM_HR2 || DEBUG_OMAP7XXUART1 || DEBUG_OMAP7XXUART2 || \ |
| 1831 | 1841 | DEBUG_OMAP7XXUART3 |
| 1842 | + default 3 if DEBUG_MSTARV7_PMUART | |
| 1832 | 1843 | default 2 |
| 1833 | 1844 | |
| 1834 | 1845 | config DEBUG_UART_8250_WORD |
| @@ -17,17 +17,13 @@ · 16 unmodified lines | ||
| 17 | 17 | * VCP1, VCP2 |
| 18 | 18 | * MLB |
| 19 | 19 | * ISS |
| 20 | − * USB3, USB4 | |
| 20 | + * USB3 | |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | &usb3_tm { |
| 24 | 24 | status = "disabled"; |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | −&usb4_tm { | |
| 28 | − status = "disabled"; | |
| 29 | −}; | |
| 30 | − | |
| 31 | 27 | &atl_tm { |
| 32 | 28 | status = "disabled"; |
| 33 | 29 | }; |
| @@ -4129,28 +4129,6 @@ · 4128 unmodified lines | ||
| 4129 | 4129 | }; |
| 4130 | 4130 | }; |
| 4131 | 4131 | |
| 4132 | − usb4_tm: target-module@140000 { /* 0x48940000, ap 75 3c.0 */ | |
| 4133 | − compatible = "ti,sysc-omap4", "ti,sysc"; | |
| 4134 | − reg = <0x140000 0x4>, | |
| 4135 | − <0x140010 0x4>; | |
| 4136 | − reg-names = "rev", "sysc"; | |
| 4137 | − ti,sysc-mask = <SYSC_OMAP4_DMADISABLE>; | |
| 4138 | − ti,sysc-midle = <SYSC_IDLE_FORCE>, | |
| 4139 | − <SYSC_IDLE_NO>, | |
| 4140 | − <SYSC_IDLE_SMART>, | |
| 4141 | − <SYSC_IDLE_SMART_WKUP>; | |
| 4142 | − ti,sysc-sidle = <SYSC_IDLE_FORCE>, | |
| 4143 | − <SYSC_IDLE_NO>, | |
| 4144 | − <SYSC_IDLE_SMART>, | |
| 4145 | − <SYSC_IDLE_SMART_WKUP>; | |
| 4146 | − /* Domains (P, C): l3init_pwrdm, l3init_clkdm */ | |
| 4147 | − clocks = <&l3init_clkctrl DRA7_L3INIT_USB_OTG_SS4_CLKCTRL 0>; | |
| 4148 | − clock-names = "fck"; | |
| 4149 | − #address-cells = <1>; | |
| 4150 | − #size-cells = <1>; | |
| 4151 | − ranges = <0x0 0x140000 0x20000>; | |
| 4152 | − }; | |
| 4153 | − | |
| 4154 | 4132 | target-module@170000 { /* 0x48970000, ap 21 0a.0 */ |
| 4155 | 4133 | compatible = "ti,sysc-omap4", "ti,sysc"; |
| 4156 | 4134 | reg = <0x170010 0x4>; |
| @@ -11,7 +11,3 @@ · 10 unmodified lines | ||
| 11 | 11 | &rtctarget { |
| 12 | 12 | status = "disabled"; |
| 13 | 13 | }; |
| 14 | − | |
| 15 | −&usb4_tm { | |
| 16 | − status = "disabled"; | |
| 17 | −}; | |
| @@ -108,7 +108,3 @@ · 107 unmodified lines | ||
| 108 | 108 | &pcie2_rc { |
| 109 | 109 | compatible = "ti,dra726-pcie-rc", "ti,dra7-pcie"; |
| 110 | 110 | }; |
| 111 | − | |
| 112 | −&usb4_tm { | |
| 113 | − status = "disabled"; | |
| 114 | −}; | |
| @@ -49,49 +49,6 @@ · 48 unmodified lines | ||
| 49 | 49 | reg = <0x41500000 0x100>; |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | − target-module@48940000 { | |
| 53 | − compatible = "ti,sysc-omap4", "ti,sysc"; | |
| 54 | − reg = <0x48940000 0x4>, | |
| 55 | − <0x48940010 0x4>; | |
| 56 | − reg-names = "rev", "sysc"; | |
| 57 | − ti,sysc-mask = <SYSC_OMAP4_DMADISABLE>; | |
| 58 | − ti,sysc-midle = <SYSC_IDLE_FORCE>, | |
| 59 | − <SYSC_IDLE_NO>, | |
| 60 | − <SYSC_IDLE_SMART>, | |
| 61 | − <SYSC_IDLE_SMART_WKUP>; | |
| 62 | − ti,sysc-sidle = <SYSC_IDLE_FORCE>, | |
| 63 | − <SYSC_IDLE_NO>, | |
| 64 | − <SYSC_IDLE_SMART>, | |
| 65 | − <SYSC_IDLE_SMART_WKUP>; | |
| 66 | − clocks = <&l3init_clkctrl DRA7_L3INIT_USB_OTG_SS4_CLKCTRL 0>; | |
| 67 | − clock-names = "fck"; | |
| 68 | − #address-cells = <1>; | |
| 69 | − #size-cells = <1>; | |
| 70 | − ranges = <0x0 0x48940000 0x20000>; | |
| 71 | − | |
| 72 | − omap_dwc3_4: omap_dwc3_4@0 { | |
| 73 | − compatible = "ti,dwc3"; | |
| 74 | − reg = <0 0x10000>; | |
| 75 | − interrupts = <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>; | |
| 76 | − #address-cells = <1>; | |
| 77 | − #size-cells = <1>; | |
| 78 | − utmi-mode = <2>; | |
| 79 | − ranges; | |
| 80 | − status = "disabled"; | |
| 81 | − usb4: usb@10000 { | |
| 82 | − compatible = "snps,dwc3"; | |
| 83 | − reg = <0x10000 0x17000>; | |
| 84 | − interrupts = <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>, | |
| 85 | − <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>, | |
| 86 | − <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>; | |
| 87 | − interrupt-names = "peripheral", | |
| 88 | − "host", | |
| 89 | − "otg"; | |
| 90 | − maximum-speed = "high-speed"; | |
| 91 | − dr_mode = "otg"; | |
| 92 | − }; | |
| 93 | − }; | |
| 94 | − }; | |
| 95 | 52 | |
| 96 | 53 | target-module@41501000 { |
| 97 | 54 | compatible = "ti,sysc-omap2", "ti,sysc"; |
| @@ -224,3 +181,52 @@ · 126 unmodified lines | ||
| 224 | 181 | &pcie2_rc { |
| 225 | 182 | compatible = "ti,dra746-pcie-rc", "ti,dra7-pcie"; |
| 226 | 183 | }; |
| 184 | + | |
| 185 | +&l4_per3 { | |
| 186 | + segment@0 { | |
| 187 | + usb4_tm: target-module@140000 { /* 0x48940000, ap 75 3c.0 */ | |
| 188 | + compatible = "ti,sysc-omap4", "ti,sysc"; | |
| 189 | + reg = <0x140000 0x4>, | |
| 190 | + <0x140010 0x4>; | |
| 191 | + reg-names = "rev", "sysc"; | |
| 192 | + ti,sysc-mask = <SYSC_OMAP4_DMADISABLE>; | |
| 193 | + ti,sysc-midle = <SYSC_IDLE_FORCE>, | |
| 194 | + <SYSC_IDLE_NO>, | |
| 195 | + <SYSC_IDLE_SMART>, | |
| 196 | + <SYSC_IDLE_SMART_WKUP>; | |
| 197 | + ti,sysc-sidle = <SYSC_IDLE_FORCE>, | |
| 198 | + <SYSC_IDLE_NO>, | |
| 199 | + <SYSC_IDLE_SMART>, | |
| 200 | + <SYSC_IDLE_SMART_WKUP>; | |
| 201 | + /* Domains (P, C): l3init_pwrdm, l3init_clkdm */ | |
| 202 | + clocks = <&l3init_clkctrl DRA7_L3INIT_USB_OTG_SS4_CLKCTRL 0>; | |
| 203 | + clock-names = "fck"; | |
| 204 | + #address-cells = <1>; | |
| 205 | + #size-cells = <1>; | |
| 206 | + ranges = <0x0 0x140000 0x20000>; | |
| 207 | + | |
| 208 | + omap_dwc3_4: omap_dwc3_4@0 { | |
| 209 | + compatible = "ti,dwc3"; | |
| 210 | + reg = <0 0x10000>; | |
| 211 | + interrupts = <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>; | |
| 212 | + #address-cells = <1>; | |
| 213 | + #size-cells = <1>; | |
| 214 | + utmi-mode = <2>; | |
| 215 | + ranges; | |
| 216 | + status = "disabled"; | |
| 217 | + usb4: usb@10000 { | |
| 218 | + compatible = "snps,dwc3"; | |
| 219 | + reg = <0x10000 0x17000>; | |
| 220 | + interrupts = <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>, | |
| 221 | + <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>, | |
| 222 | + <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>; | |
| 223 | + interrupt-names = "peripheral", | |
| 224 | + "host", | |
| 225 | + "otg"; | |
| 226 | + maximum-speed = "high-speed"; | |
| 227 | + dr_mode = "otg"; | |
| 228 | + }; | |
| 229 | + }; | |
| 230 | + }; | |
| 231 | + }; | |
| 232 | +}; | |
| @@ -250,7 +250,7 @@ · 249 unmodified lines | ||
| 250 | 250 | nand-ecc-step-size = <512>; |
| 251 | 251 | nand-bus-width = <8>; |
| 252 | 252 | /* efs2 partition is secured */ |
| 253 | − secure-regions = <0x500000 0xb00000>; | |
| 253 | + secure-regions = /bits/ 64 <0x500000 0xb00000>; | |
| 254 | 254 | }; |
| 255 | 255 | }; |
| 256 | 256 | |
| @@ -250,8 +250,8 @@ · 249 unmodified lines | ||
| 250 | 250 | nand-ecc-step-size = <512>; |
| 251 | 251 | nand-bus-width = <8>; |
| 252 | 252 | /* ico and efs2 partitions are secured */ |
| 253 | − secure-regions = <0x500000 0x500000 | |
| 254 | − 0xa00000 0xb00000>; | |
| 253 | + secure-regions = /bits/ 64 <0x500000 0x500000 | |
| 254 | + 0xa00000 0xb00000>; | |
| 255 | 255 | }; |
| 256 | 256 | }; |
| 257 | 257 | |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include <dt-bindings/interrupt-controller/irq.h> |
| 7 | +#include <dt-bindings/leds/common.h> | |
| 7 | 8 | #include "ste-href-family-pinctrl.dtsi" |
| 8 | 9 | |
| 9 | 10 | / { |
| @@ -64,17 +65,20 @@ · 54 unmodified lines | ||
| 64 | 65 | reg = <0>; |
| 65 | 66 | led-cur = /bits/ 8 <0x2f>; |
| 66 | 67 | max-cur = /bits/ 8 <0x5f>; |
| 68 | + color = <LED_COLOR_ID_BLUE>; | |
| 67 | 69 | linux,default-trigger = "heartbeat"; |
| 68 | 70 | }; |
| 69 | 71 | chan@1 { |
| 70 | 72 | reg = <1>; |
| 71 | 73 | led-cur = /bits/ 8 <0x2f>; |
| 72 | 74 | max-cur = /bits/ 8 <0x5f>; |
| 75 | + color = <LED_COLOR_ID_BLUE>; | |
| 73 | 76 | }; |
| 74 | 77 | chan@2 { |
| 75 | 78 | reg = <2>; |
| 76 | 79 | led-cur = /bits/ 8 <0x2f>; |
| 77 | 80 | max-cur = /bits/ 8 <0x5f>; |
| 81 | + color = <LED_COLOR_ID_BLUE>; | |
| 78 | 82 | }; |
| 79 | 83 | }; |
| 80 | 84 | lp5521@34 { |
| @@ -88,16 +92,19 @@ · 7 unmodified lines | ||
| 88 | 92 | reg = <0>; |
| 89 | 93 | led-cur = /bits/ 8 <0x2f>; |
| 90 | 94 | max-cur = /bits/ 8 <0x5f>; |
| 95 | + color = <LED_COLOR_ID_BLUE>; | |
| 91 | 96 | }; |
| 92 | 97 | chan@1 { |
| 93 | 98 | reg = <1>; |
| 94 | 99 | led-cur = /bits/ 8 <0x2f>; |
| 95 | 100 | max-cur = /bits/ 8 <0x5f>; |
| 101 | + color = <LED_COLOR_ID_BLUE>; | |
| 96 | 102 | }; |
| 97 | 103 | chan@2 { |
| 98 | 104 | reg = <2>; |
| 99 | 105 | led-cur = /bits/ 8 <0x2f>; |
| 100 | 106 | max-cur = /bits/ 8 <0x5f>; |
| 107 | + color = <LED_COLOR_ID_BLUE>; | |
| 101 | 108 | }; |
| 102 | 109 | }; |
| 103 | 110 | bh1780@29 { |
| @@ -85,7 +85,7 @@ · 84 unmodified lines | ||
| 85 | 85 | pinctrl-0 = <&emac_rgmii_pins>; |
| 86 | 86 | phy-supply = <®_gmac_3v3>; |
| 87 | 87 | phy-handle = <&ext_rgmii_phy>; |
| 88 | − phy-mode = "rgmii"; | |
| 88 | + phy-mode = "rgmii-id"; | |
| 89 | 89 | |
| 90 | 90 | status = "okay"; |
| 91 | 91 | }; |
| @@ -55,6 +55,7 @@ void __init exynos_sysram_init(void) · 54 unmodified lines | ||
| 55 | 55 | sysram_base_addr = of_iomap(node, 0); |
| 56 | 56 | sysram_base_phys = of_translate_address(node, |
| 57 | 57 | of_get_address(node, 0, NULL, NULL)); |
| 58 | + of_node_put(node); | |
| 58 | 59 | break; |
| 59 | 60 | } |
| 60 | 61 | |
| @@ -62,6 +63,7 @@ void __init exynos_sysram_init(void) · 1 unmodified line | ||
| 62 | 63 | if (!of_device_is_available(node)) |
| 63 | 64 | continue; |
| 64 | 65 | sysram_ns_base_addr = of_iomap(node, 0); |
| 66 | + of_node_put(node); | |
| 65 | 67 | break; |
| 66 | 68 | } |
| 67 | 69 | } |
| @@ -35,7 +35,7 @@ obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o · 34 unmodified lines | ||
| 35 | 35 | obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o |
| 36 | 36 | obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o |
| 37 | 37 | obj-$(CONFIG_HAVE_IMX_SRC) += src.o |
| 38 | −ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) | |
| 38 | +ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_IMX7D_CA7)$(CONFIG_SOC_LS1021A),) | |
| 39 | 39 | AFLAGS_headsmp.o :=-Wa,-march=armv7-a |
| 40 | 40 | obj-$(CONFIG_SMP) += headsmp.o platsmp.o |
| 41 | 41 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
| @@ -68,11 +68,13 @@ void imx_set_cpu_arg(int cpu, u32 arg); · 67 unmodified lines | ||
| 68 | 68 | void v7_secondary_startup(void); |
| 69 | 69 | void imx_scu_map_io(void); |
| 70 | 70 | void imx_smp_prepare(void); |
| 71 | +void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn); | |
| 71 | 72 | #else |
| 72 | 73 | static inline void imx_scu_map_io(void) {} |
| 73 | 74 | static inline void imx_smp_prepare(void) {} |
| 74 | 75 | #endif |
| 75 | 76 | void imx_src_init(void); |
| 77 | +void imx7_src_init(void); | |
| 76 | 78 | void imx_gpc_pre_suspend(bool arm_power_off); |
| 77 | 79 | void imx_gpc_post_resume(void); |
| 78 | 80 | void imx_gpc_mask_all(void); |
| @@ -131,6 +133,7 @@ static inline void imx_init_l2cache(void) {} · 52 unmodified lines | ||
| 131 | 133 | #endif |
| 132 | 134 | |
| 133 | 135 | extern const struct smp_operations imx_smp_ops; |
| 136 | +extern const struct smp_operations imx7_smp_ops; | |
| 134 | 137 | extern const struct smp_operations ls1021a_smp_ops; |
| 135 | 138 | |
| 136 | 139 | #endif |
| @@ -21,6 +21,15 @@ diag_reg_offset: · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | ENTRY(v7_secondary_startup) |
| 23 | 23 | ARM_BE8(setend be) @ go BE8 if entered LE |
| 24 | + mrc p15, 0, r0, c0, c0, 0 | |
| 25 | + lsl r0, r0, #16 | |
| 26 | + lsr r0, r0, #20 | |
| 27 | + /* 0xc07 is cortex A7's ID */ | |
| 28 | + mov r1, #0xc00 | |
| 29 | + orr r1, #0x7 | |
| 30 | + cmp r0, r1 | |
| 31 | + beq secondary_startup | |
| 32 | + | |
| 24 | 33 | set_diag_reg |
| 25 | 34 | b secondary_startup |
| 26 | 35 | ENDPROC(v7_secondary_startup) |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <asm/proc-fns.h> |
| 12 | 12 | |
| 13 | 13 | #include "common.h" |
| 14 | +#include "hardware.h" | |
| 14 | 15 | |
| 15 | 16 | /* |
| 16 | 17 | * platform-specific code to shutdown a CPU |
| @@ -40,5 +41,7 @@ int imx_cpu_kill(unsigned int cpu) · 23 unmodified lines | ||
| 40 | 41 | return 0; |
| 41 | 42 | imx_enable_cpu(cpu, false); |
| 42 | 43 | imx_set_cpu_arg(cpu, 0); |
| 44 | + if (cpu_is_imx7d()) | |
| 45 | + imx_gpcv2_set_core1_pdn_pup_by_software(true); | |
| 43 | 46 | return 1; |
| 44 | 47 | } |
| @@ -9,6 +9,12 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <asm/mach/arch.h> |
| 10 | 10 | |
| 11 | 11 | #include "common.h" |
| 12 | +#include "hardware.h" | |
| 13 | + | |
| 14 | +static void __init imx50_init_early(void) | |
| 15 | +{ | |
| 16 | + mxc_set_cpu_type(MXC_CPU_MX50); | |
| 17 | +} | |
| 12 | 18 | |
| 13 | 19 | static const char * const imx50_dt_board_compat[] __initconst = { |
| 14 | 20 | "fsl,imx50", |
| @@ -16,5 +22,6 @@ static const char * const imx50_dt_board_compat[] __initconst = { · 1 unmodified line | ||
| 16 | 22 | }; |
| 17 | 23 | |
| 18 | 24 | DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)") |
| 25 | + .init_early = imx50_init_early, | |
| 19 | 26 | .dt_compat = imx50_dt_board_compat, |
| 20 | 27 | MACHINE_END |
| @@ -40,27 +40,6 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev) · 39 unmodified lines | ||
| 40 | 40 | return 0; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | −static void mmd_write_reg(struct phy_device *dev, int device, int reg, int val) | |
| 44 | −{ | |
| 45 | − phy_write(dev, 0x0d, device); | |
| 46 | − phy_write(dev, 0x0e, reg); | |
| 47 | − phy_write(dev, 0x0d, (1 << 14) | device); | |
| 48 | − phy_write(dev, 0x0e, val); | |
| 49 | −} | |
| 50 | − | |
| 51 | −static int ksz9031rn_phy_fixup(struct phy_device *dev) | |
| 52 | −{ | |
| 53 | − /* | |
| 54 | − * min rx data delay, max rx/tx clock delay, | |
| 55 | − * min rx/tx control delay | |
| 56 | − */ | |
| 57 | − mmd_write_reg(dev, 2, 4, 0); | |
| 58 | − mmd_write_reg(dev, 2, 5, 0); | |
| 59 | − mmd_write_reg(dev, 2, 8, 0x003ff); | |
| 60 | − | |
| 61 | − return 0; | |
| 62 | −} | |
| 63 | − | |
| 64 | 43 | /* |
| 65 | 44 | * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High |
| 66 | 45 | * as they are used for slots1-7 PERST# |
| @@ -89,75 +68,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, ventana_pciesw_early_fixup); · 22 unmodified lines | ||
| 89 | 68 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, ventana_pciesw_early_fixup); |
| 90 | 69 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, ventana_pciesw_early_fixup); |
| 91 | 70 | |
| 92 | −static int ar8031_phy_fixup(struct phy_device *dev) | |
| 93 | −{ | |
| 94 | − u16 val; | |
| 95 | − | |
| 96 | − /* To enable AR8031 output a 125MHz clk from CLK_25M */ | |
| 97 | − phy_write(dev, 0xd, 0x7); | |
| 98 | − phy_write(dev, 0xe, 0x8016); | |
| 99 | − phy_write(dev, 0xd, 0x4007); | |
| 100 | − | |
| 101 | − val = phy_read(dev, 0xe); | |
| 102 | − val &= 0xffe3; | |
| 103 | − val |= 0x18; | |
| 104 | − phy_write(dev, 0xe, val); | |
| 105 | − | |
| 106 | − /* introduce tx clock delay */ | |
| 107 | − phy_write(dev, 0x1d, 0x5); | |
| 108 | − val = phy_read(dev, 0x1e); | |
| 109 | − val |= 0x0100; | |
| 110 | − phy_write(dev, 0x1e, val); | |
| 111 | − | |
| 112 | − return 0; | |
| 113 | −} | |
| 114 | − | |
| 115 | −#define PHY_ID_AR8031 0x004dd074 | |
| 116 | − | |
| 117 | −static int ar8035_phy_fixup(struct phy_device *dev) | |
| 118 | −{ | |
| 119 | − u16 val; | |
| 120 | − | |
| 121 | − /* Ar803x phy SmartEEE feature cause link status generates glitch, | |
| 122 | − * which cause ethernet link down/up issue, so disable SmartEEE | |
| 123 | − */ | |
| 124 | − phy_write(dev, 0xd, 0x3); | |
| 125 | − phy_write(dev, 0xe, 0x805d); | |
| 126 | − phy_write(dev, 0xd, 0x4003); | |
| 127 | − | |
| 128 | − val = phy_read(dev, 0xe); | |
| 129 | − phy_write(dev, 0xe, val & ~(1 << 8)); | |
| 130 | − | |
| 131 | − /* | |
| 132 | − * Enable 125MHz clock from CLK_25M on the AR8031. This | |
| 133 | − * is fed in to the IMX6 on the ENET_REF_CLK (V22) pad. | |
| 134 | − * Also, introduce a tx clock delay. | |
| 135 | − * | |
| 136 | − * This is the same as is the AR8031 fixup. | |
| 137 | − */ | |
| 138 | − ar8031_phy_fixup(dev); | |
| 139 | − | |
| 140 | − /*check phy power*/ | |
| 141 | − val = phy_read(dev, 0x0); | |
| 142 | − if (val & BMCR_PDOWN) | |
| 143 | − phy_write(dev, 0x0, val & ~BMCR_PDOWN); | |
| 144 | − | |
| 145 | − return 0; | |
| 146 | −} | |
| 147 | − | |
| 148 | −#define PHY_ID_AR8035 0x004dd072 | |
| 149 | − | |
| 150 | 71 | static void __init imx6q_enet_phy_init(void) |
| 151 | 72 | { |
| 152 | 73 | if (IS_BUILTIN(CONFIG_PHYLIB)) { |
| 153 | 74 | phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, |
| 154 | 75 | ksz9021rn_phy_fixup); |
| 155 | − phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK, | |
| 156 | − ksz9031rn_phy_fixup); | |
| 157 | − phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffef, | |
| 158 | − ar8031_phy_fixup); | |
| 159 | − phy_register_fixup_for_uid(PHY_ID_AR8035, 0xffffffef, | |
| 160 | − ar8035_phy_fixup); | |
| 161 | 76 | } |
| 162 | 77 | } |
| 163 | 78 | |
| @@ -257,9 +172,6 @@ static void __init imx6q_init_machine(void) · 93 unmodified lines | ||
| 257 | 172 | imx_get_soc_revision()); |
| 258 | 173 | |
| 259 | 174 | imx6q_enet_phy_init(); |
| 260 | − | |
| 261 | − of_platform_default_populate(NULL, NULL, NULL); | |
| 262 | − | |
| 263 | 175 | imx_anatop_init(); |
| 264 | 176 | cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init(); |
| 265 | 177 | imx6q_1588_init(); |
| @@ -15,31 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #include "common.h" |
| 16 | 16 | #include "cpuidle.h" |
| 17 | 17 | |
| 18 | −static int ar8031_phy_fixup(struct phy_device *dev) | |
| 19 | −{ | |
| 20 | − u16 val; | |
| 21 | − | |
| 22 | − /* Set RGMII IO voltage to 1.8V */ | |
| 23 | − phy_write(dev, 0x1d, 0x1f); | |
| 24 | − phy_write(dev, 0x1e, 0x8); | |
| 25 | − | |
| 26 | − /* introduce tx clock delay */ | |
| 27 | − phy_write(dev, 0x1d, 0x5); | |
| 28 | − val = phy_read(dev, 0x1e); | |
| 29 | − val |= 0x0100; | |
| 30 | − phy_write(dev, 0x1e, val); | |
| 31 | − | |
| 32 | − return 0; | |
| 33 | −} | |
| 34 | − | |
| 35 | −#define PHY_ID_AR8031 0x004dd074 | |
| 36 | −static void __init imx6sx_enet_phy_init(void) | |
| 37 | −{ | |
| 38 | − if (IS_BUILTIN(CONFIG_PHYLIB)) | |
| 39 | − phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, | |
| 40 | − ar8031_phy_fixup); | |
| 41 | −} | |
| 42 | − | |
| 43 | 18 | static void __init imx6sx_enet_clk_sel(void) |
| 44 | 19 | { |
| 45 | 20 | struct regmap *gpr; |
| @@ -57,7 +32,6 @@ static void __init imx6sx_enet_clk_sel(void) · 11 unmodified lines | ||
| 57 | 32 | |
| 58 | 33 | static inline void imx6sx_enet_init(void) |
| 59 | 34 | { |
| 60 | − imx6sx_enet_phy_init(); | |
| 61 | 35 | imx6sx_enet_clk_sel(); |
| 62 | 36 | } |
| 63 | 37 | |
| @@ -14,25 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | #include "common.h" |
| 16 | 16 | |
| 17 | −static int ar8031_phy_fixup(struct phy_device *dev) | |
| 18 | −{ | |
| 19 | − u16 val; | |
| 20 | − | |
| 21 | − /* Set RGMII IO voltage to 1.8V */ | |
| 22 | − phy_write(dev, 0x1d, 0x1f); | |
| 23 | − phy_write(dev, 0x1e, 0x8); | |
| 24 | − | |
| 25 | − /* disable phy AR8031 SmartEEE function. */ | |
| 26 | − phy_write(dev, 0xd, 0x3); | |
| 27 | − phy_write(dev, 0xe, 0x805d); | |
| 28 | − phy_write(dev, 0xd, 0x4003); | |
| 29 | − val = phy_read(dev, 0xe); | |
| 30 | − val &= ~(0x1 << 8); | |
| 31 | − phy_write(dev, 0xe, val); | |
| 32 | − | |
| 33 | − return 0; | |
| 34 | −} | |
| 35 | − | |
| 36 | 17 | static int bcm54220_phy_fixup(struct phy_device *dev) |
| 37 | 18 | { |
| 38 | 19 | /* enable RXC skew select RGMII copper mode */ |
| @@ -44,14 +25,11 @@ static int bcm54220_phy_fixup(struct phy_device *dev) · 5 unmodified lines | ||
| 44 | 25 | return 0; |
| 45 | 26 | } |
| 46 | 27 | |
| 47 | −#define PHY_ID_AR8031 0x004dd074 | |
| 48 | 28 | #define PHY_ID_BCM54220 0x600d8589 |
| 49 | 29 | |
| 50 | 30 | static void __init imx7d_enet_phy_init(void) |
| 51 | 31 | { |
| 52 | 32 | if (IS_BUILTIN(CONFIG_PHYLIB)) { |
| 53 | − phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, | |
| 54 | − ar8031_phy_fixup); | |
| 55 | 33 | phy_register_fixup_for_uid(PHY_ID_BCM54220, 0xffffffff, |
| 56 | 34 | bcm54220_phy_fixup); |
| 57 | 35 | } |
| @@ -91,7 +69,7 @@ static void __init imx7d_init_late(void) · 33 unmodified lines | ||
| 91 | 69 | static void __init imx7d_init_irq(void) |
| 92 | 70 | { |
| 93 | 71 | imx_init_revision_from_anatop(); |
| 94 | − imx_src_init(); | |
| 72 | + imx7_src_init(); | |
| 95 | 73 | irqchip_init(); |
| 96 | 74 | } |
| 97 | 75 | |
| @@ -102,6 +80,7 @@ static const char *const imx7d_dt_compat[] __initconst = { · 4 unmodified lines | ||
| 102 | 80 | }; |
| 103 | 81 | |
| 104 | 82 | DT_MACHINE_START(IMX7D, "Freescale i.MX7 Dual (Device Tree)") |
| 83 | + .smp = smp_ops(imx7_smp_ops), | |
| 105 | 84 | .init_irq = imx7d_init_irq, |
| 106 | 85 | .init_machine = imx7d_init_machine, |
| 107 | 86 | .init_late = imx7d_init_late, |
| @@ -92,6 +92,32 @@ const struct smp_operations imx_smp_ops __initconst = { · 91 unmodified lines | ||
| 92 | 92 | #endif |
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | +/* | |
| 96 | + * Initialise the CPU possible map early - this describes the CPUs | |
| 97 | + * which may be present or become present in the system. | |
| 98 | + */ | |
| 99 | +static void __init imx7_smp_init_cpus(void) | |
| 100 | +{ | |
| 101 | + struct device_node *np; | |
| 102 | + int i, ncores = 0; | |
| 103 | + | |
| 104 | + /* The iMX7D SCU does not report core count, get it from DT */ | |
| 105 | + for_each_of_cpu_node(np) | |
| 106 | + ncores++; | |
| 107 | + | |
| 108 | + for (i = ncores; i < NR_CPUS; i++) | |
| 109 | + set_cpu_possible(i, false); | |
| 110 | +} | |
| 111 | + | |
| 112 | +const struct smp_operations imx7_smp_ops __initconst = { | |
| 113 | + .smp_init_cpus = imx7_smp_init_cpus, | |
| 114 | + .smp_boot_secondary = imx_boot_secondary, | |
| 115 | +#ifdef CONFIG_HOTPLUG_CPU | |
| 116 | + .cpu_die = imx_cpu_die, | |
| 117 | + .cpu_kill = imx_cpu_kill, | |
| 118 | +#endif | |
| 119 | +}; | |
| 120 | + | |
| 95 | 121 | #define DCFG_CCSR_SCRATCHRW1 0x200 |
| 96 | 122 | |
| 97 | 123 | static int ls1021a_boot_secondary(unsigned int cpu, struct task_struct *idle) |
| @@ -6,15 +6,19 @@ · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | #include <linux/init.h> |
| 8 | 8 | #include <linux/io.h> |
| 9 | +#include <linux/iopoll.h> | |
| 9 | 10 | #include <linux/of.h> |
| 10 | 11 | #include <linux/of_address.h> |
| 11 | 12 | #include <linux/reset-controller.h> |
| 12 | 13 | #include <linux/smp.h> |
| 13 | 14 | #include <asm/smp_plat.h> |
| 14 | 15 | #include "common.h" |
| 16 | +#include "hardware.h" | |
| 15 | 17 | |
| 16 | 18 | #define SRC_SCR 0x000 |
| 17 | −#define SRC_GPR1 0x020 | |
| 19 | +#define SRC_GPR1_V1 0x020 | |
| 20 | +#define SRC_GPR1_V2 0x074 | |
| 21 | +#define SRC_GPR1(gpr_v2) ((gpr_v2) ? SRC_GPR1_V2 : SRC_GPR1_V1) | |
| 18 | 22 | #define BP_SRC_SCR_WARM_RESET_ENABLE 0 |
| 19 | 23 | #define BP_SRC_SCR_SW_GPU_RST 1 |
| 20 | 24 | #define BP_SRC_SCR_SW_VPU_RST 2 |
| @@ -23,9 +27,18 @@ · 2 unmodified lines | ||
| 23 | 27 | #define BP_SRC_SCR_SW_IPU2_RST 12 |
| 24 | 28 | #define BP_SRC_SCR_CORE1_RST 14 |
| 25 | 29 | #define BP_SRC_SCR_CORE1_ENABLE 22 |
| 30 | +/* below is for i.MX7D */ | |
| 31 | +#define SRC_A7RCR1 0x008 | |
| 32 | +#define BP_SRC_A7RCR1_A7_CORE1_ENABLE 1 | |
| 33 | +#define GPC_CPU_PGC_SW_PUP_REQ 0xf0 | |
| 34 | +#define GPC_CPU_PGC_SW_PDN_REQ 0xfc | |
| 35 | +#define GPC_PGC_C1 0x840 | |
| 36 | +#define BM_CPU_PGC_SW_PDN_PUP_REQ_CORE1_A7 0x2 | |
| 26 | 37 | |
| 27 | 38 | static void __iomem *src_base; |
| 28 | 39 | static DEFINE_SPINLOCK(scr_lock); |
| 40 | +static bool gpr_v2; | |
| 41 | +static void __iomem *gpc_base; | |
| 29 | 42 | |
| 30 | 43 | static const int sw_reset_bits[5] = { |
| 31 | 44 | BP_SRC_SCR_SW_GPU_RST, |
| @@ -73,17 +86,64 @@ static struct reset_controller_dev imx_reset_controller = { · 41 unmodified lines | ||
| 73 | 86 | .nr_resets = ARRAY_SIZE(sw_reset_bits), |
| 74 | 87 | }; |
| 75 | 88 | |
| 89 | +static void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset) | |
| 90 | +{ | |
| 91 | + writel_relaxed(enable, gpc_base + offset); | |
| 92 | +} | |
| 93 | + | |
| 94 | +/* | |
| 95 | + * The motivation for bringing up the second i.MX7D core inside the kernel | |
| 96 | + * is that legacy vendor bootloaders usually do not implement PSCI support. | |
| 97 | + * This is a significant blocker for systems in the field that are running old | |
| 98 | + * bootloader versions to upgrade to a modern mainline kernel version, as only | |
| 99 | + * one CPU of the i.MX7D would be brought up. | |
| 100 | + * Bring up the second i.MX7D core inside the kernel to make the migration | |
| 101 | + * path to mainline kernel easier for the existing iMX7D users. | |
| 102 | + */ | |
| 103 | +void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn) | |
| 104 | +{ | |
| 105 | + u32 reg = pdn ? GPC_CPU_PGC_SW_PDN_REQ : GPC_CPU_PGC_SW_PUP_REQ; | |
| 106 | + u32 val, pup; | |
| 107 | + int ret; | |
| 108 | + | |
| 109 | + imx_gpcv2_set_m_core_pgc(true, GPC_PGC_C1); | |
| 110 | + val = readl_relaxed(gpc_base + reg); | |
| 111 | + val |= BM_CPU_PGC_SW_PDN_PUP_REQ_CORE1_A7; | |
| 112 | + writel_relaxed(val, gpc_base + reg); | |
| 113 | + | |
| 114 | + ret = readl_relaxed_poll_timeout_atomic(gpc_base + reg, pup, | |
| 115 | + !(pup & BM_CPU_PGC_SW_PDN_PUP_REQ_CORE1_A7), | |
| 116 | + 5, 1000000); | |
| 117 | + if (ret < 0) { | |
| 118 | + pr_err("i.MX7D: CORE1_A7 power up timeout\n"); | |
| 119 | + val &= ~BM_CPU_PGC_SW_PDN_PUP_REQ_CORE1_A7; | |
| 120 | + writel_relaxed(val, gpc_base + reg); | |
| 121 | + } | |
| 122 | + | |
| 123 | + imx_gpcv2_set_m_core_pgc(false, GPC_PGC_C1); | |
| 124 | +} | |
| 125 | + | |
| 76 | 126 | void imx_enable_cpu(int cpu, bool enable) |
| 77 | 127 | { |
| 78 | 128 | u32 mask, val; |
| 79 | 129 | |
| 80 | 130 | cpu = cpu_logical_map(cpu); |
| 81 | − mask = 1 << (BP_SRC_SCR_CORE1_ENABLE + cpu - 1); | |
| 82 | 131 | spin_lock(&scr_lock); |
| 83 | − val = readl_relaxed(src_base + SRC_SCR); | |
| 84 | − val = enable ? val | mask : val & ~mask; | |
| 85 | − val |= 1 << (BP_SRC_SCR_CORE1_RST + cpu - 1); | |
| 86 | − writel_relaxed(val, src_base + SRC_SCR); | |
| 132 | + if (gpr_v2) { | |
| 133 | + if (enable) | |
| 134 | + imx_gpcv2_set_core1_pdn_pup_by_software(false); | |
| 135 | + | |
| 136 | + mask = 1 << (BP_SRC_A7RCR1_A7_CORE1_ENABLE + cpu - 1); | |
| 137 | + val = readl_relaxed(src_base + SRC_A7RCR1); | |
| 138 | + val = enable ? val | mask : val & ~mask; | |
| 139 | + writel_relaxed(val, src_base + SRC_A7RCR1); | |
| 140 | + } else { | |
| 141 | + mask = 1 << (BP_SRC_SCR_CORE1_ENABLE + cpu - 1); | |
| 142 | + val = readl_relaxed(src_base + SRC_SCR); | |
| 143 | + val = enable ? val | mask : val & ~mask; | |
| 144 | + val |= 1 << (BP_SRC_SCR_CORE1_RST + cpu - 1); | |
| 145 | + writel_relaxed(val, src_base + SRC_SCR); | |
| 146 | + } | |
| 87 | 147 | spin_unlock(&scr_lock); |
| 88 | 148 | } |
| 89 | 149 | |
| @@ -91,19 +151,19 @@ void imx_set_cpu_jump(int cpu, void *jump_addr) · 1 unmodified line | ||
| 91 | 151 | { |
| 92 | 152 | cpu = cpu_logical_map(cpu); |
| 93 | 153 | writel_relaxed(__pa_symbol(jump_addr), |
| 94 | − src_base + SRC_GPR1 + cpu * 8); | |
| 154 | + src_base + SRC_GPR1(gpr_v2) + cpu * 8); | |
| 95 | 155 | } |
| 96 | 156 | |
| 97 | 157 | u32 imx_get_cpu_arg(int cpu) |
| 98 | 158 | { |
| 99 | 159 | cpu = cpu_logical_map(cpu); |
| 100 | − return readl_relaxed(src_base + SRC_GPR1 + cpu * 8 + 4); | |
| 160 | + return readl_relaxed(src_base + SRC_GPR1(gpr_v2) + cpu * 8 + 4); | |
| 101 | 161 | } |
| 102 | 162 | |
| 103 | 163 | void imx_set_cpu_arg(int cpu, u32 arg) |
| 104 | 164 | { |
| 105 | 165 | cpu = cpu_logical_map(cpu); |
| 106 | − writel_relaxed(arg, src_base + SRC_GPR1 + cpu * 8 + 4); | |
| 166 | + writel_relaxed(arg, src_base + SRC_GPR1(gpr_v2) + cpu * 8 + 4); | |
| 107 | 167 | } |
| 108 | 168 | |
| 109 | 169 | void __init imx_src_init(void) |
| @@ -131,3 +191,26 @@ void __init imx_src_init(void) · 21 unmodified lines | ||
| 131 | 191 | writel_relaxed(val, src_base + SRC_SCR); |
| 132 | 192 | spin_unlock(&scr_lock); |
| 133 | 193 | } |
| 194 | + | |
| 195 | +void __init imx7_src_init(void) | |
| 196 | +{ | |
| 197 | + struct device_node *np; | |
| 198 | + | |
| 199 | + gpr_v2 = true; | |
| 200 | + | |
| 201 | + np = of_find_compatible_node(NULL, NULL, "fsl,imx7d-src"); | |
| 202 | + if (!np) | |
| 203 | + return; | |
| 204 | + | |
| 205 | + src_base = of_iomap(np, 0); | |
| 206 | + if (!src_base) | |
| 207 | + return; | |
| 208 | + | |
| 209 | + np = of_find_compatible_node(NULL, NULL, "fsl,imx7d-gpc"); | |
| 210 | + if (!np) | |
| 211 | + return; | |
| 212 | + | |
| 213 | + gpc_base = of_iomap(np, 0); | |
| 214 | + if (!gpc_base) | |
| 215 | + return; | |
| 216 | +} | |
| @@ -28,11 +28,11 @@ · 27 unmodified lines | ||
| 28 | 28 | * ^ |
| 29 | 29 | * ^ |
| 30 | 30 | * imx53_suspend code |
| 31 | − * PM_INFO structure(imx53_suspend_info) | |
| 31 | + * PM_INFO structure(imx5_cpu_suspend_info) | |
| 32 | 32 | * ======================== low address ======================= |
| 33 | 33 | */ |
| 34 | 34 | |
| 35 | −/* Offsets of members of struct imx53_suspend_info */ | |
| 35 | +/* Offsets of members of struct imx5_cpu_suspend_info */ | |
| 36 | 36 | #define SUSPEND_INFO_MX53_M4IF_V_OFFSET 0x0 |
| 37 | 37 | #define SUSPEND_INFO_MX53_IOMUXC_V_OFFSET 0x4 |
| 38 | 38 | #define SUSPEND_INFO_MX53_IO_COUNT_OFFSET 0x8 |
| @@ -7,7 +7,7 @@ comment "IXP4xx Platforms" · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | config MACH_IXP4XX_OF |
| 9 | 9 | bool |
| 10 | − prompt "Devce Tree IXP4xx boards" | |
| 10 | + prompt "Device Tree IXP4xx boards" | |
| 11 | 11 | default y |
| 12 | 12 | select ARM_APPENDED_DTB # Old Redboot bootloaders deployed |
| 13 | 13 | select I2C |
| @@ -20,7 +20,7 @@ config MACH_IXP4XX_OF · 6 unmodified lines | ||
| 20 | 20 | config MACH_NSLU2 |
| 21 | 21 | bool |
| 22 | 22 | prompt "Linksys NSLU2" |
| 23 | − select FORCE_PCI | |
| 23 | + depends on IXP4XX_PCI_LEGACY | |
| 24 | 24 | help |
| 25 | 25 | Say 'Y' here if you want your kernel to support Linksys's |
| 26 | 26 | NSLU2 NAS device. For more information on this platform, |
| @@ -28,7 +28,7 @@ config MACH_NSLU2 · 1 unmodified line | ||
| 28 | 28 | |
| 29 | 29 | config MACH_AVILA |
| 30 | 30 | bool "Avila" |
| 31 | − select FORCE_PCI | |
| 31 | + depends on IXP4XX_PCI_LEGACY | |
| 32 | 32 | help |
| 33 | 33 | Say 'Y' here if you want your kernel to support the Gateworks |
| 34 | 34 | Avila Network Platform. For more information on this platform, |
| @@ -44,7 +44,7 @@ config MACH_LOFT · 9 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | config ARCH_ADI_COYOTE |
| 46 | 46 | bool "Coyote" |
| 47 | − select FORCE_PCI | |
| 47 | + depends on IXP4XX_PCI_LEGACY | |
| 48 | 48 | help |
| 49 | 49 | Say 'Y' here if you want your kernel to support the ADI |
| 50 | 50 | Engineering Coyote Gateway Reference Platform. For more |
| @@ -52,7 +52,7 @@ config ARCH_ADI_COYOTE · 1 unmodified line | ||
| 52 | 52 | |
| 53 | 53 | config MACH_GATEWAY7001 |
| 54 | 54 | bool "Gateway 7001" |
| 55 | − select FORCE_PCI | |
| 55 | + depends on IXP4XX_PCI_LEGACY | |
| 56 | 56 | help |
| 57 | 57 | Say 'Y' here if you want your kernel to support Gateway's |
| 58 | 58 | 7001 Access Point. For more information on this platform, |
| @@ -60,7 +60,7 @@ config MACH_GATEWAY7001 · 1 unmodified line | ||
| 60 | 60 | |
| 61 | 61 | config MACH_WG302V2 |
| 62 | 62 | bool "Netgear WG302 v2 / WAG302 v2" |
| 63 | − select FORCE_PCI | |
| 63 | + depends on IXP4XX_PCI_LEGACY | |
| 64 | 64 | help |
| 65 | 65 | Say 'Y' here if you want your kernel to support Netgear's |
| 66 | 66 | WG302 v2 or WAG302 v2 Access Points. For more information |
| @@ -68,6 +68,7 @@ config MACH_WG302V2 · 1 unmodified line | ||
| 68 | 68 | |
| 69 | 69 | config ARCH_IXDP425 |
| 70 | 70 | bool "IXDP425" |
| 71 | + depends on IXP4XX_PCI_LEGACY | |
| 71 | 72 | help |
| 72 | 73 | Say 'Y' here if you want your kernel to support Intel's |
| 73 | 74 | IXDP425 Development Platform (Also known as Richfield). |
| @@ -75,6 +76,7 @@ config ARCH_IXDP425 · 1 unmodified line | ||
| 75 | 76 | |
| 76 | 77 | config MACH_IXDPG425 |
| 77 | 78 | bool "IXDPG425" |
| 79 | + depends on IXP4XX_PCI_LEGACY | |
| 78 | 80 | help |
| 79 | 81 | Say 'Y' here if you want your kernel to support Intel's |
| 80 | 82 | IXDPG425 Development Platform (Also known as Montajade). |
| @@ -120,7 +122,7 @@ config ARCH_PRPMC1100 · 39 unmodified lines | ||
| 120 | 122 | config MACH_NAS100D |
| 121 | 123 | bool |
| 122 | 124 | prompt "NAS100D" |
| 123 | − select FORCE_PCI | |
| 125 | + depends on IXP4XX_PCI_LEGACY | |
| 124 | 126 | help |
| 125 | 127 | Say 'Y' here if you want your kernel to support Iomega's |
| 126 | 128 | NAS 100d device. For more information on this platform, |
| @@ -129,7 +131,7 @@ config MACH_NAS100D · 2 unmodified lines | ||
| 129 | 131 | config MACH_DSMG600 |
| 130 | 132 | bool |
| 131 | 133 | prompt "D-Link DSM-G600 RevA" |
| 132 | − select FORCE_PCI | |
| 134 | + depends on IXP4XX_PCI_LEGACY | |
| 133 | 135 | help |
| 134 | 136 | Say 'Y' here if you want your kernel to support D-Link's |
| 135 | 137 | DSM-G600 RevA device. For more information on this platform, |
| @@ -143,7 +145,7 @@ config ARCH_IXDP4XX · 7 unmodified lines | ||
| 143 | 145 | config MACH_FSG |
| 144 | 146 | bool |
| 145 | 147 | prompt "Freecom FSG-3" |
| 146 | − select FORCE_PCI | |
| 148 | + depends on IXP4XX_PCI_LEGACY | |
| 147 | 149 | help |
| 148 | 150 | Say 'Y' here if you want your kernel to support Freecom's |
| 149 | 151 | FSG-3 device. For more information on this platform, |
| @@ -152,7 +154,7 @@ config MACH_FSG · 2 unmodified lines | ||
| 152 | 154 | config MACH_ARCOM_VULCAN |
| 153 | 155 | bool |
| 154 | 156 | prompt "Arcom/Eurotech Vulcan" |
| 155 | − select FORCE_PCI | |
| 157 | + depends on IXP4XX_PCI_LEGACY | |
| 156 | 158 | help |
| 157 | 159 | Say 'Y' here if you want your kernel to support Arcom's |
| 158 | 160 | Vulcan board. |
| @@ -173,7 +175,7 @@ config CPU_IXP43X · 14 unmodified lines | ||
| 173 | 175 | config MACH_GTWX5715 |
| 174 | 176 | bool "Gemtek WX5715 (Linksys WRV54G)" |
| 175 | 177 | depends on ARCH_IXP4XX |
| 176 | − select FORCE_PCI | |
| 178 | + depends on IXP4XX_PCI_LEGACY | |
| 177 | 179 | help |
| 178 | 180 | This board is currently inside the Linksys WRV54G Gateways. |
| 179 | 181 | |
| @@ -196,7 +198,7 @@ config MACH_DEVIXP · 16 unmodified lines | ||
| 196 | 198 | |
| 197 | 199 | config MACH_MICCPT |
| 198 | 200 | bool "Omicron MICCPT" |
| 199 | − select FORCE_PCI | |
| 201 | + depends on IXP4XX_PCI_LEGACY | |
| 200 | 202 | help |
| 201 | 203 | Say 'Y' here if you want your kernel to support the MICCPT |
| 202 | 204 | board from OMICRON electronics GmbH. |
| @@ -209,9 +211,16 @@ config MACH_MIC256 · 6 unmodified lines | ||
| 209 | 211 | |
| 210 | 212 | comment "IXP4xx Options" |
| 211 | 213 | |
| 214 | +config IXP4XX_PCI_LEGACY | |
| 215 | + bool "IXP4xx legacy PCI driver support" | |
| 216 | + depends on PCI | |
| 217 | + help | |
| 218 | + Selects legacy PCI driver. | |
| 219 | + Not recommended for new development. | |
| 220 | + | |
| 212 | 221 | config IXP4XX_INDIRECT_PCI |
| 213 | 222 | bool "Use indirect PCI memory access" |
| 214 | − depends on PCI | |
| 223 | + depends on IXP4XX_PCI_LEGACY | |
| 215 | 224 | help |
| 216 | 225 | IXP4xx provides two methods of accessing PCI memory space: |
| 217 | 226 | |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <linux/tty.h> |
| 20 | 20 | #include <linux/serial_8250.h> |
| 21 | 21 | #include <linux/gpio/machine.h> |
| 22 | +#include <linux/platform_data/pata_ixp4xx_cf.h> | |
| 22 | 23 | #include <asm/types.h> |
| 23 | 24 | #include <asm/setup.h> |
| 24 | 25 | #include <asm/memory.h> |
| @@ -27,12 +27,12 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/cpu.h> |
| 28 | 28 | #include <linux/pci.h> |
| 29 | 29 | #include <linux/sched_clock.h> |
| 30 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 30 | 31 | #include <linux/irqchip/irq-ixp4xx.h> |
| 31 | 32 | #include <linux/platform_data/timer-ixp4xx.h> |
| 32 | 33 | #include <linux/dma-map-ops.h> |
| 33 | 34 | #include <mach/udc.h> |
| 34 | 35 | #include <mach/hardware.h> |
| 35 | −#include <mach/io.h> | |
| 36 | 36 | #include <linux/uaccess.h> |
| 37 | 37 | #include <asm/page.h> |
| 38 | 38 | #include <asm/exception.h> |
| @@ -44,6 +44,27 @@ · 5 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | #include "irqs.h" |
| 46 | 46 | |
| 47 | +u32 ixp4xx_read_feature_bits(void) | |
| 48 | +{ | |
| 49 | + u32 val = ~__raw_readl(IXP4XX_EXP_CFG2); | |
| 50 | + | |
| 51 | + if (cpu_is_ixp42x_rev_a0()) | |
| 52 | + return IXP42X_FEATURE_MASK & ~(IXP4XX_FEATURE_RCOMP | | |
| 53 | + IXP4XX_FEATURE_AES); | |
| 54 | + if (cpu_is_ixp42x()) | |
| 55 | + return val & IXP42X_FEATURE_MASK; | |
| 56 | + if (cpu_is_ixp43x()) | |
| 57 | + return val & IXP43X_FEATURE_MASK; | |
| 58 | + return val & IXP46X_FEATURE_MASK; | |
| 59 | +} | |
| 60 | +EXPORT_SYMBOL(ixp4xx_read_feature_bits); | |
| 61 | + | |
| 62 | +void ixp4xx_write_feature_bits(u32 value) | |
| 63 | +{ | |
| 64 | + __raw_writel(~value, IXP4XX_EXP_CFG2); | |
| 65 | +} | |
| 66 | +EXPORT_SYMBOL(ixp4xx_write_feature_bits); | |
| 67 | + | |
| 47 | 68 | #define IXP4XX_TIMER_FREQ 66666000 |
| 48 | 69 | |
| 49 | 70 | /************************************************************************* |
| @@ -215,6 +236,27 @@ static struct resource ixp46x_i2c_resources[] = { · 165 unmodified lines | ||
| 215 | 236 | } |
| 216 | 237 | }; |
| 217 | 238 | |
| 239 | +/* A single 32-bit register on IXP46x */ | |
| 240 | +#define IXP4XX_HWRANDOM_BASE_PHYS 0x70002100 | |
| 241 | + | |
| 242 | +static struct resource ixp46x_hwrandom_resource[] = { | |
| 243 | + { | |
| 244 | + .start = IXP4XX_HWRANDOM_BASE_PHYS, | |
| 245 | + .end = IXP4XX_HWRANDOM_BASE_PHYS + 0x3, | |
| 246 | + .flags = IORESOURCE_MEM, | |
| 247 | + }, | |
| 248 | +}; | |
| 249 | + | |
| 250 | +static struct platform_device ixp46x_hwrandom_device = { | |
| 251 | + .name = "ixp4xx-hwrandom", | |
| 252 | + .id = -1, | |
| 253 | + .dev = { | |
| 254 | + .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 255 | + }, | |
| 256 | + .resource = ixp46x_hwrandom_resource, | |
| 257 | + .num_resources = ARRAY_SIZE(ixp46x_hwrandom_resource), | |
| 258 | +}; | |
| 259 | + | |
| 218 | 260 | /* |
| 219 | 261 | * I2C controller. The IXP46x uses the same block as the IOP3xx, so |
| 220 | 262 | * we just use the same device name. |
| @@ -227,7 +269,8 @@ static struct platform_device ixp46x_i2c_controller = { · 6 unmodified lines | ||
| 227 | 269 | }; |
| 228 | 270 | |
| 229 | 271 | static struct platform_device *ixp46x_devices[] __initdata = { |
| 230 | − &ixp46x_i2c_controller | |
| 272 | + &ixp46x_hwrandom_device, | |
| 273 | + &ixp46x_i2c_controller, | |
| 231 | 274 | }; |
| 232 | 275 | |
| 233 | 276 | unsigned long ixp4xx_exp_bus_size; |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <asm/mach-types.h> |
| 29 | 29 | #include <asm/mach/arch.h> |
| 30 | 30 | #include <asm/mach/flash.h> |
| 31 | +#include <mach/hardware.h> | |
| 31 | 32 | |
| 32 | 33 | #include "irqs.h" |
| 33 | 34 | |
| @@ -1,54 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ixp4xx/include/mach/cpu.h | |
| 4 | − * | |
| 5 | − * IXP4XX cpu type detection | |
| 6 | − * | |
| 7 | − * Copyright (C) 2007 MontaVista Software, Inc. | |
| 8 | − */ | |
| 9 | − | |
| 10 | −#ifndef __ASM_ARCH_CPU_H__ | |
| 11 | −#define __ASM_ARCH_CPU_H__ | |
| 12 | − | |
| 13 | −#include <linux/io.h> | |
| 14 | −#include <asm/cputype.h> | |
| 15 | − | |
| 16 | −/* Processor id value in CP15 Register 0 */ | |
| 17 | −#define IXP42X_PROCESSOR_ID_VALUE 0x690541c0 /* including unused 0x690541Ex */ | |
| 18 | −#define IXP42X_PROCESSOR_ID_MASK 0xffffffc0 | |
| 19 | − | |
| 20 | −#define IXP43X_PROCESSOR_ID_VALUE 0x69054040 | |
| 21 | −#define IXP43X_PROCESSOR_ID_MASK 0xfffffff0 | |
| 22 | − | |
| 23 | −#define IXP46X_PROCESSOR_ID_VALUE 0x69054200 /* including IXP455 */ | |
| 24 | −#define IXP46X_PROCESSOR_ID_MASK 0xfffffff0 | |
| 25 | − | |
| 26 | −#define cpu_is_ixp42x_rev_a0() ((read_cpuid_id() & (IXP42X_PROCESSOR_ID_MASK | 0xF)) == \ | |
| 27 | − IXP42X_PROCESSOR_ID_VALUE) | |
| 28 | −#define cpu_is_ixp42x() ((read_cpuid_id() & IXP42X_PROCESSOR_ID_MASK) == \ | |
| 29 | − IXP42X_PROCESSOR_ID_VALUE) | |
| 30 | −#define cpu_is_ixp43x() ((read_cpuid_id() & IXP43X_PROCESSOR_ID_MASK) == \ | |
| 31 | − IXP43X_PROCESSOR_ID_VALUE) | |
| 32 | −#define cpu_is_ixp46x() ((read_cpuid_id() & IXP46X_PROCESSOR_ID_MASK) == \ | |
| 33 | − IXP46X_PROCESSOR_ID_VALUE) | |
| 34 | − | |
| 35 | −static inline u32 ixp4xx_read_feature_bits(void) | |
| 36 | −{ | |
| 37 | − u32 val = ~__raw_readl(IXP4XX_EXP_CFG2); | |
| 38 | − | |
| 39 | − if (cpu_is_ixp42x_rev_a0()) | |
| 40 | − return IXP42X_FEATURE_MASK & ~(IXP4XX_FEATURE_RCOMP | | |
| 41 | − IXP4XX_FEATURE_AES); | |
| 42 | − if (cpu_is_ixp42x()) | |
| 43 | − return val & IXP42X_FEATURE_MASK; | |
| 44 | − if (cpu_is_ixp43x()) | |
| 45 | − return val & IXP43X_FEATURE_MASK; | |
| 46 | − return val & IXP46X_FEATURE_MASK; | |
| 47 | −} | |
| 48 | − | |
| 49 | −static inline void ixp4xx_write_feature_bits(u32 value) | |
| 50 | −{ | |
| 51 | − __raw_writel(~value, IXP4XX_EXP_CFG2); | |
| 52 | −} | |
| 53 | − | |
| 54 | −#endif /* _ASM_ARCH_CPU_H */ | |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "ixp4xx-regs.h" |
| 24 | 24 | |
| 25 | 25 | #ifndef __ASSEMBLER__ |
| 26 | −#include <mach/cpu.h> | |
| 26 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | 29 | /* Platform helper functions and definitions */ |
| @@ -45,21 +45,21 @@ · 44 unmodified lines | ||
| 45 | 45 | * it can be used with the low-level debug code. |
| 46 | 46 | */ |
| 47 | 47 | #define IXP4XX_PERIPHERAL_BASE_PHYS 0xC8000000 |
| 48 | −#define IXP4XX_PERIPHERAL_BASE_VIRT IOMEM(0xFEF00000) | |
| 48 | +#define IXP4XX_PERIPHERAL_BASE_VIRT IOMEM(0xFEC00000) | |
| 49 | 49 | #define IXP4XX_PERIPHERAL_REGION_SIZE 0x00013000 |
| 50 | 50 | |
| 51 | 51 | /* |
| 52 | 52 | * PCI Config registers |
| 53 | 53 | */ |
| 54 | 54 | #define IXP4XX_PCI_CFG_BASE_PHYS 0xC0000000 |
| 55 | −#define IXP4XX_PCI_CFG_BASE_VIRT IOMEM(0xFEF13000) | |
| 55 | +#define IXP4XX_PCI_CFG_BASE_VIRT IOMEM(0xFEC13000) | |
| 56 | 56 | #define IXP4XX_PCI_CFG_REGION_SIZE 0x00001000 |
| 57 | 57 | |
| 58 | 58 | /* |
| 59 | 59 | * Expansion BUS Configuration registers |
| 60 | 60 | */ |
| 61 | 61 | #define IXP4XX_EXP_CFG_BASE_PHYS 0xC4000000 |
| 62 | −#define IXP4XX_EXP_CFG_BASE_VIRT 0xFEF14000 | |
| 62 | +#define IXP4XX_EXP_CFG_BASE_VIRT 0xFEC14000 | |
| 63 | 63 | #define IXP4XX_EXP_CFG_REGION_SIZE 0x00001000 |
| 64 | 64 | |
| 65 | 65 | #define IXP4XX_EXP_CS0_OFFSET 0x00 |
| @@ -120,6 +120,7 @@ · 54 unmodified lines | ||
| 120 | 120 | #define IXP4XX_SSP_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x12000) |
| 121 | 121 | |
| 122 | 122 | |
| 123 | +/* The UART is explicitly put in the beginning of fixmap */ | |
| 123 | 124 | #define IXP4XX_UART1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000) |
| 124 | 125 | #define IXP4XX_UART2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000) |
| 125 | 126 | #define IXP4XX_PMU_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x2000) |
| @@ -299,58 +300,4 @@ · 173 unmodified lines | ||
| 299 | 300 | |
| 300 | 301 | #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ |
| 301 | 302 | |
| 302 | −/* "fuse" bits of IXP_EXP_CFG2 */ | |
| 303 | −/* All IXP4xx CPUs */ | |
| 304 | −#define IXP4XX_FEATURE_RCOMP (1 << 0) | |
| 305 | −#define IXP4XX_FEATURE_USB_DEVICE (1 << 1) | |
| 306 | −#define IXP4XX_FEATURE_HASH (1 << 2) | |
| 307 | −#define IXP4XX_FEATURE_AES (1 << 3) | |
| 308 | −#define IXP4XX_FEATURE_DES (1 << 4) | |
| 309 | −#define IXP4XX_FEATURE_HDLC (1 << 5) | |
| 310 | −#define IXP4XX_FEATURE_AAL (1 << 6) | |
| 311 | −#define IXP4XX_FEATURE_HSS (1 << 7) | |
| 312 | −#define IXP4XX_FEATURE_UTOPIA (1 << 8) | |
| 313 | −#define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9) | |
| 314 | −#define IXP4XX_FEATURE_NPEC_ETH (1 << 10) | |
| 315 | −#define IXP4XX_FEATURE_RESET_NPEA (1 << 11) | |
| 316 | −#define IXP4XX_FEATURE_RESET_NPEB (1 << 12) | |
| 317 | −#define IXP4XX_FEATURE_RESET_NPEC (1 << 13) | |
| 318 | −#define IXP4XX_FEATURE_PCI (1 << 14) | |
| 319 | −#define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16) | |
| 320 | −#define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22) | |
| 321 | −#define IXP42X_FEATURE_MASK (IXP4XX_FEATURE_RCOMP | \ | |
| 322 | − IXP4XX_FEATURE_USB_DEVICE | \ | |
| 323 | − IXP4XX_FEATURE_HASH | \ | |
| 324 | − IXP4XX_FEATURE_AES | \ | |
| 325 | − IXP4XX_FEATURE_DES | \ | |
| 326 | − IXP4XX_FEATURE_HDLC | \ | |
| 327 | − IXP4XX_FEATURE_AAL | \ | |
| 328 | − IXP4XX_FEATURE_HSS | \ | |
| 329 | − IXP4XX_FEATURE_UTOPIA | \ | |
| 330 | − IXP4XX_FEATURE_NPEB_ETH0 | \ | |
| 331 | − IXP4XX_FEATURE_NPEC_ETH | \ | |
| 332 | − IXP4XX_FEATURE_RESET_NPEA | \ | |
| 333 | − IXP4XX_FEATURE_RESET_NPEB | \ | |
| 334 | − IXP4XX_FEATURE_RESET_NPEC | \ | |
| 335 | − IXP4XX_FEATURE_PCI | \ | |
| 336 | − IXP4XX_FEATURE_UTOPIA_PHY_LIMIT | \ | |
| 337 | − IXP4XX_FEATURE_XSCALE_MAX_FREQ) | |
| 338 | − | |
| 339 | − | |
| 340 | −/* IXP43x/46x CPUs */ | |
| 341 | −#define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15) | |
| 342 | −#define IXP4XX_FEATURE_USB_HOST (1 << 18) | |
| 343 | −#define IXP4XX_FEATURE_NPEA_ETH (1 << 19) | |
| 344 | −#define IXP43X_FEATURE_MASK (IXP42X_FEATURE_MASK | \ | |
| 345 | − IXP4XX_FEATURE_ECC_TIMESYNC | \ | |
| 346 | − IXP4XX_FEATURE_USB_HOST | \ | |
| 347 | − IXP4XX_FEATURE_NPEA_ETH) | |
| 348 | − | |
| 349 | −/* IXP46x CPU (including IXP455) only */ | |
| 350 | −#define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20) | |
| 351 | −#define IXP4XX_FEATURE_RSA (1 << 21) | |
| 352 | −#define IXP46X_FEATURE_MASK (IXP43X_FEATURE_MASK | \ | |
| 353 | − IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \ | |
| 354 | − IXP4XX_FEATURE_RSA) | |
| 355 | − | |
| 356 | 303 | #endif |
| @@ -79,20 +79,6 @@ extern unsigned long ixp4xx_exp_bus_size; · 78 unmodified lines | ||
| 79 | 79 | #define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66MHzi APB BUS */ |
| 80 | 80 | #define IXP4XX_UART_XTAL 14745600 |
| 81 | 81 | |
| 82 | −/* | |
| 83 | − * This structure provide a means for the board setup code | |
| 84 | − * to give information to th pata_ixp4xx driver. It is | |
| 85 | − * passed as platform_data. | |
| 86 | − */ | |
| 87 | −struct ixp4xx_pata_data { | |
| 88 | − volatile u32 *cs0_cfg; | |
| 89 | − volatile u32 *cs1_cfg; | |
| 90 | − unsigned long cs0_bits; | |
| 91 | − unsigned long cs1_bits; | |
| 92 | − void __iomem *cs0; | |
| 93 | − void __iomem *cs1; | |
| 94 | −}; | |
| 95 | − | |
| 96 | 82 | /* |
| 97 | 83 | * Frequency of clock used for primary clocksource |
| 98 | 84 | */ |
| @@ -9,8 +9,12 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <asm/mach/arch.h> |
| 10 | 10 | #include <asm/mach/map.h> |
| 11 | 11 | |
| 12 | −#include <mach/hardware.h> | |
| 13 | −#include <mach/ixp4xx-regs.h> | |
| 12 | +/* | |
| 13 | + * These are the only fixed phys to virt mappings we ever need | |
| 14 | + * we put it right after the UART mapping at 0xffc80000-0xffc81fff | |
| 15 | + */ | |
| 16 | +#define IXP4XX_EXP_CFG_BASE_PHYS 0xC4000000 | |
| 17 | +#define IXP4XX_EXP_CFG_BASE_VIRT 0xFEC14000 | |
| 14 | 18 | |
| 15 | 19 | static struct map_desc ixp4xx_of_io_desc[] __initdata = { |
| 16 | 20 | /* |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #include <asm/mach-types.h> |
| 34 | 34 | #include <asm/mach/arch.h> |
| 35 | 35 | #include <asm/mach/flash.h> |
| 36 | +#include <mach/hardware.h> | |
| 36 | 37 | |
| 37 | 38 | #include "irqs.h" |
| 38 | 39 | |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <asm/mach/arch.h> |
| 32 | 32 | #include <asm/mach/flash.h> |
| 33 | 33 | #include <asm/mach/time.h> |
| 34 | +#include <mach/hardware.h> | |
| 34 | 35 | |
| 35 | 36 | #include "irqs.h" |
| 36 | 37 | |
| @@ -65,14 +65,14 @@ config MACH_OMAP_INNOVATOR · 64 unmodified lines | ||
| 65 | 65 | config MACH_OMAP_H2 |
| 66 | 66 | bool "TI H2 Support" |
| 67 | 67 | depends on ARCH_OMAP16XX |
| 68 | − help | |
| 68 | + help | |
| 69 | 69 | TI OMAP 1610/1611B H2 board support. Say Y here if you have such |
| 70 | 70 | a board. |
| 71 | 71 | |
| 72 | 72 | config MACH_OMAP_H3 |
| 73 | 73 | bool "TI H3 Support" |
| 74 | 74 | depends on ARCH_OMAP16XX |
| 75 | − help | |
| 75 | + help | |
| 76 | 76 | TI OMAP 1710 H3 board support. Say Y here if you have such |
| 77 | 77 | a board. |
| 78 | 78 | |
| @@ -85,14 +85,14 @@ config MACH_HERALD · 6 unmodified lines | ||
| 85 | 85 | config MACH_OMAP_OSK |
| 86 | 86 | bool "TI OSK Support" |
| 87 | 87 | depends on ARCH_OMAP16XX |
| 88 | − help | |
| 88 | + help | |
| 89 | 89 | TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here |
| 90 | 90 | if you have such a board. |
| 91 | 91 | |
| 92 | 92 | config OMAP_OSK_MISTRAL |
| 93 | 93 | bool "Mistral QVGA board Support" |
| 94 | 94 | depends on MACH_OMAP_OSK |
| 95 | − help | |
| 95 | + help | |
| 96 | 96 | The OSK supports an optional add-on board with a Quarter-VGA |
| 97 | 97 | touchscreen, PDA-ish buttons, a resume button, bicolor LED, |
| 98 | 98 | and camera connector. Say Y here if you have this board. |
| @@ -100,14 +100,14 @@ config OMAP_OSK_MISTRAL · 1 unmodified line | ||
| 100 | 100 | config MACH_OMAP_PERSEUS2 |
| 101 | 101 | bool "TI Perseus2" |
| 102 | 102 | depends on ARCH_OMAP730 |
| 103 | − help | |
| 103 | + help | |
| 104 | 104 | Support for TI OMAP 730 Perseus2 board. Say Y here if you have such |
| 105 | 105 | a board. |
| 106 | 106 | |
| 107 | 107 | config MACH_OMAP_FSAMPLE |
| 108 | 108 | bool "TI F-Sample" |
| 109 | 109 | depends on ARCH_OMAP730 |
| 110 | − help | |
| 110 | + help | |
| 111 | 111 | Support for TI OMAP 850 F-Sample board. Say Y here if you have such |
| 112 | 112 | a board. |
| 113 | 113 | |
| @@ -26,7 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | extern struct omap_domain_base cm_base; |
| 28 | 28 | extern struct omap_domain_base cm2_base; |
| 29 | −extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2); | |
| 30 | 29 | # endif |
| 31 | 30 | |
| 32 | 31 | /* |
| @@ -37,19 +37,6 @@ struct omap_domain_base cm2_base; · 36 unmodified lines | ||
| 37 | 37 | #define CM_NO_CLOCKS 0x1 |
| 38 | 38 | #define CM_SINGLE_INSTANCE 0x2 |
| 39 | 39 | |
| 40 | −/** | |
| 41 | − * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use) | |
| 42 | − * @cm: CM base virtual address | |
| 43 | − * @cm2: CM2 base virtual address (if present on the booted SoC) | |
| 44 | − * | |
| 45 | − * XXX Will be replaced when the PRM/CM drivers are completed. | |
| 46 | − */ | |
| 47 | −void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2) | |
| 48 | −{ | |
| 49 | − cm_base.va = cm; | |
| 50 | − cm2_base.va = cm2; | |
| 51 | −} | |
| 52 | − | |
| 53 | 40 | /** |
| 54 | 41 | * cm_split_idlest_reg - split CM_IDLEST reg addr into its components |
| 55 | 42 | * @idlest_reg: CM_IDLEST* virtual address |
| @@ -130,7 +130,6 @@ void am33xx_init_early(void); · 129 unmodified lines | ||
| 130 | 130 | void am35xx_init_early(void); |
| 131 | 131 | void ti814x_init_early(void); |
| 132 | 132 | void ti816x_init_early(void); |
| 133 | −void am33xx_init_early(void); | |
| 134 | 133 | void am43xx_init_early(void); |
| 135 | 134 | void am43xx_init_late(void); |
| 136 | 135 | void omap4430_init_early(void); |
| @@ -136,11 +136,6 @@ struct omap3_control_regs { · 135 unmodified lines | ||
| 136 | 136 | static struct omap3_control_regs control_context; |
| 137 | 137 | #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ |
| 138 | 138 | |
| 139 | −void __init omap2_set_globals_control(void __iomem *ctrl) | |
| 140 | −{ | |
| 141 | − omap2_ctrl_base = ctrl; | |
| 142 | −} | |
| 143 | − | |
| 144 | 139 | u8 omap_ctrl_readb(u16 offset) |
| 145 | 140 | { |
| 146 | 141 | u32 val; |
| @@ -528,7 +528,6 @@ extern int omap3_ctrl_save_padconf(void); · 527 unmodified lines | ||
| 528 | 528 | void omap3_ctrl_init(void); |
| 529 | 529 | int omap2_control_base_init(void); |
| 530 | 530 | int omap_control_init(void); |
| 531 | −void omap2_set_globals_control(void __iomem *ctrl); | |
| 532 | 531 | void __init omap3_control_legacy_iomap_init(void); |
| 533 | 532 | #else |
| 534 | 533 | #define omap_ctrl_readb(x) 0 |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #include <linux/cpuidle.h> |
| 10 | 10 | #include <linux/platform_data/pm33xx.h> |
| 11 | +#include <linux/suspend.h> | |
| 11 | 12 | #include <asm/cpuidle.h> |
| 12 | 13 | #include <asm/smp_scu.h> |
| 13 | 14 | #include <asm/suspend.h> |
| @@ -324,6 +325,44 @@ static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void) · 310 unmodified lines | ||
| 324 | 325 | return NULL; |
| 325 | 326 | } |
| 326 | 327 | |
| 328 | +#ifdef CONFIG_SUSPEND | |
| 329 | +/* | |
| 330 | + * Block system suspend initially. Later on pm33xx sets up it's own | |
| 331 | + * platform_suspend_ops after probe. That depends also on loaded | |
| 332 | + * wkup_m3_ipc and booted am335x-pm-firmware.elf. | |
| 333 | + */ | |
| 334 | +static int amx3_suspend_block(suspend_state_t state) | |
| 335 | +{ | |
| 336 | + pr_warn("PM not initialized for pm33xx, wkup_m3_ipc, or am335x-pm-firmware.elf\n"); | |
| 337 | + | |
| 338 | + return -EINVAL; | |
| 339 | +} | |
| 340 | + | |
| 341 | +static int amx3_pm_valid(suspend_state_t state) | |
| 342 | +{ | |
| 343 | + switch (state) { | |
| 344 | + case PM_SUSPEND_STANDBY: | |
| 345 | + return 1; | |
| 346 | + default: | |
| 347 | + return 0; | |
| 348 | + } | |
| 349 | +} | |
| 350 | + | |
| 351 | +static const struct platform_suspend_ops amx3_blocked_pm_ops = { | |
| 352 | + .begin = amx3_suspend_block, | |
| 353 | + .valid = amx3_pm_valid, | |
| 354 | +}; | |
| 355 | + | |
| 356 | +static void __init amx3_block_suspend(void) | |
| 357 | +{ | |
| 358 | + suspend_set_ops(&amx3_blocked_pm_ops); | |
| 359 | +} | |
| 360 | +#else | |
| 361 | +static inline void amx3_block_suspend(void) | |
| 362 | +{ | |
| 363 | +} | |
| 364 | +#endif /* CONFIG_SUSPEND */ | |
| 365 | + | |
| 327 | 366 | int __init amx3_common_pm_init(void) |
| 328 | 367 | { |
| 329 | 368 | struct am33xx_pm_platform_data *pdata; |
| @@ -337,6 +376,7 @@ int __init amx3_common_pm_init(void) · 7 unmodified lines | ||
| 337 | 376 | devinfo.size_data = sizeof(*pdata); |
| 338 | 377 | devinfo.id = -1; |
| 339 | 378 | platform_device_register_full(&devinfo); |
| 379 | + amx3_block_suspend(); | |
| 340 | 380 | |
| 341 | 381 | return 0; |
| 342 | 382 | } |
| @@ -271,7 +271,6 @@ static int rx1950_led_blink_set(struct gpio_desc *desc, int state, · 270 unmodified lines | ||
| 271 | 271 | break; |
| 272 | 272 | default: |
| 273 | 273 | return -EINVAL; |
| 274 | − break; | |
| 275 | 274 | } |
| 276 | 275 | |
| 277 | 276 | if (delay_on && delay_off && !*delay_on && !*delay_off) |
| @@ -16,6 +16,7 @@ config ARCH_SUNXI · 15 unmodified lines | ||
| 16 | 16 | select IRQ_FASTEOI_HIERARCHY_HANDLERS |
| 17 | 17 | select PINCTRL |
| 18 | 18 | select RESET_CONTROLLER |
| 19 | + select SUN4I_TIMER | |
| 19 | 20 | help |
| 20 | 21 | This enables support for Allwinner sunxi based SoCs like the A64. |
| 21 | 22 | |
| @@ -79,7 +79,7 @@ · 78 unmodified lines | ||
| 79 | 79 | &emac { |
| 80 | 80 | pinctrl-names = "default"; |
| 81 | 81 | pinctrl-0 = <&rgmii_pins>; |
| 82 | − phy-mode = "rgmii-id"; | |
| 82 | + phy-mode = "rgmii-txid"; | |
| 83 | 83 | phy-handle = <&ext_rgmii_phy>; |
| 84 | 84 | phy-supply = <®_dc1sw>; |
| 85 | 85 | status = "okay"; |
| @@ -227,7 +227,7 @@ · 226 unmodified lines | ||
| 227 | 227 | <&pcie_phy 2>, <&pcie_phy 3>; |
| 228 | 228 | phy-names = "pcie-phy-0", "pcie-phy-1", |
| 229 | 229 | "pcie-phy-2", "pcie-phy-3"; |
| 230 | − ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x1e00000>, | |
| 230 | + ranges = <0x82000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x1e00000>, | |
| 231 | 231 | <0x81000000 0x0 0xfbe00000 0x0 0xfbe00000 0x0 0x100000>; |
| 232 | 232 | resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>, |
| 233 | 233 | <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>, |
| @@ -1058,7 +1058,7 @@ config PATA_ISAPNP · 1057 unmodified lines | ||
| 1058 | 1058 | |
| 1059 | 1059 | config PATA_IXP4XX_CF |
| 1060 | 1060 | tristate "IXP4XX Compact Flash support" |
| 1061 | − depends on ARCH_IXP4XX | |
| 1061 | + depends on ARCH_IXP4XX || COMPILE_TEST | |
| 1062 | 1062 | help |
| 1063 | 1063 | This option enables support for a Compact Flash connected on |
| 1064 | 1064 | the ixp4xx expansion bus. This driver had been written for |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/libata.h> |
| 18 | 18 | #include <linux/irq.h> |
| 19 | 19 | #include <linux/platform_device.h> |
| 20 | +#include <linux/platform_data/pata_ixp4xx_cf.h> | |
| 20 | 21 | #include <scsi/scsi_host.h> |
| 21 | 22 | |
| 22 | 23 | #define DRV_NAME "pata_ixp4xx_cf" |
| @@ -152,7 +152,7 @@ config HW_RANDOM_VIA · 151 unmodified lines | ||
| 152 | 152 | |
| 153 | 153 | config HW_RANDOM_IXP4XX |
| 154 | 154 | tristate "Intel IXP4xx NPU HW Pseudo-Random Number Generator support" |
| 155 | − depends on ARCH_IXP4XX | |
| 155 | + depends on ARCH_IXP4XX || COMPILE_TEST | |
| 156 | 156 | default HW_RANDOM |
| 157 | 157 | help |
| 158 | 158 | This driver provides kernel-side support for the Pseudo-Random |
| @@ -1,3 +1,4 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 1 | 2 | /* |
| 2 | 3 | * drivers/char/hw_random/ixp4xx-rng.c |
| 3 | 4 | * |
| @@ -8,23 +9,20 @@ · 4 unmodified lines | ||
| 8 | 9 | * Copyright 2005 (c) MontaVista Software, Inc. |
| 9 | 10 | * |
| 10 | 11 | * Fixes by Michael Buesch |
| 11 | − * | |
| 12 | − * This file is licensed under the terms of the GNU General Public | |
| 13 | − * License version 2. This program is licensed "as is" without any | |
| 14 | − * warranty of any kind, whether express or implied. | |
| 15 | 12 | */ |
| 16 | 13 | |
| 17 | 14 | #include <linux/kernel.h> |
| 18 | 15 | #include <linux/types.h> |
| 19 | 16 | #include <linux/module.h> |
| 20 | 17 | #include <linux/moduleparam.h> |
| 18 | +#include <linux/platform_device.h> | |
| 21 | 19 | #include <linux/init.h> |
| 22 | 20 | #include <linux/bitops.h> |
| 23 | 21 | #include <linux/hw_random.h> |
| 22 | +#include <linux/of.h> | |
| 23 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 24 | 24 | |
| 25 | 25 | #include <asm/io.h> |
| 26 | −#include <mach/hardware.h> | |
| 27 | − | |
| 28 | 26 | |
| 29 | 27 | static int ixp4xx_rng_data_read(struct hwrng *rng, u32 *buffer) |
| 30 | 28 | { |
| @@ -40,35 +38,40 @@ static struct hwrng ixp4xx_rng_ops = { · 9 unmodified lines | ||
| 40 | 38 | .data_read = ixp4xx_rng_data_read, |
| 41 | 39 | }; |
| 42 | 40 | |
| 43 | −static int __init ixp4xx_rng_init(void) | |
| 41 | +static int ixp4xx_rng_probe(struct platform_device *pdev) | |
| 44 | 42 | { |
| 45 | 43 | void __iomem * rng_base; |
| 46 | − int err; | |
| 44 | + struct device *dev = &pdev->dev; | |
| 45 | + struct resource *res; | |
| 47 | 46 | |
| 48 | 47 | if (!cpu_is_ixp46x()) /* includes IXP455 */ |
| 49 | 48 | return -ENOSYS; |
| 50 | 49 | |
| 51 | − rng_base = ioremap(0x70002100, 4); | |
| 52 | − if (!rng_base) | |
| 53 | − return -ENOMEM; | |
| 54 | − ixp4xx_rng_ops.priv = (unsigned long)rng_base; | |
| 55 | − err = hwrng_register(&ixp4xx_rng_ops); | |
| 56 | − if (err) | |
| 57 | − iounmap(rng_base); | |
| 50 | + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 51 | + rng_base = devm_ioremap_resource(dev, res); | |
| 52 | + if (IS_ERR(rng_base)) | |
| 53 | + return PTR_ERR(rng_base); | |
| 58 | 54 | |
| 59 | − return err; | |
| 55 | + ixp4xx_rng_ops.priv = (unsigned long)rng_base; | |
| 56 | + return devm_hwrng_register(dev, &ixp4xx_rng_ops); | |
| 60 | 57 | } |
| 61 | 58 | |
| 62 | −static void __exit ixp4xx_rng_exit(void) | |
| 63 | −{ | |
| 64 | − void __iomem * rng_base = (void __iomem *)ixp4xx_rng_ops.priv; | |
| 65 | − | |
| 66 | − hwrng_unregister(&ixp4xx_rng_ops); | |
| 67 | − iounmap(rng_base); | |
| 68 | −} | |
| 59 | +static const struct of_device_id ixp4xx_rng_of_match[] = { | |
| 60 | + { | |
| 61 | + .compatible = "intel,ixp46x-rng", | |
| 62 | + }, | |
| 63 | + {}, | |
| 64 | +}; | |
| 65 | +MODULE_DEVICE_TABLE(of, ixp4xx_rng_of_match); | |
| 69 | 66 | |
| 70 | −module_init(ixp4xx_rng_init); | |
| 71 | −module_exit(ixp4xx_rng_exit); | |
| 67 | +static struct platform_driver ixp4xx_rng_driver = { | |
| 68 | + .driver = { | |
| 69 | + .name = "ixp4xx-hwrandom", | |
| 70 | + .of_match_table = ixp4xx_rng_of_match, | |
| 71 | + }, | |
| 72 | + .probe = ixp4xx_rng_probe, | |
| 73 | +}; | |
| 74 | +module_platform_driver(ixp4xx_rng_driver); | |
| 72 | 75 | |
| 73 | 76 | MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); |
| 74 | 77 | MODULE_DESCRIPTION("H/W Pseudo-Random Number Generator (RNG) driver for IXP45x/46x"); |
| @@ -31,6 +31,10 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <linux/soc/ixp4xx/npe.h> |
| 32 | 32 | #include <linux/soc/ixp4xx/qmgr.h> |
| 33 | 33 | |
| 34 | +/* Intermittent includes, delete this after v5.14-rc1 */ | |
| 35 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 36 | +#include <mach/ixp4xx-regs.h> | |
| 37 | + | |
| 34 | 38 | #define MAX_KEYLEN 32 |
| 35 | 39 | |
| 36 | 40 | /* hash: cfgword + 2 * digestlen; crypt: keylen + cfgword */ |
| @@ -37,6 +37,8 @@ · 36 unmodified lines | ||
| 37 | 37 | #include <linux/module.h> |
| 38 | 38 | #include <linux/soc/ixp4xx/npe.h> |
| 39 | 39 | #include <linux/soc/ixp4xx/qmgr.h> |
| 40 | +#include <mach/hardware.h> | |
| 41 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 40 | 42 | |
| 41 | 43 | #include "ixp46x_ts.h" |
| 42 | 44 | |
| @@ -12,9 +12,8 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/io.h> |
| 13 | 13 | #include <linux/irq.h> |
| 14 | 14 | #include <linux/kernel.h> |
| 15 | −#include <linux/module.h> | |
| 16 | − | |
| 17 | 15 | #include <linux/ptp_clock_kernel.h> |
| 16 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 18 | 17 | |
| 19 | 18 | #include "ixp46x_ts.h" |
| 20 | 19 | |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/slab.h> |
| 23 | 23 | #include <linux/soc/ixp4xx/npe.h> |
| 24 | 24 | #include <linux/soc/ixp4xx/qmgr.h> |
| 25 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 25 | 26 | |
| 26 | 27 | #define DEBUG_DESC 0 |
| 27 | 28 | #define DEBUG_RX 0 |
| @@ -37,6 +37,14 @@ config PCI_FTPCI100 · 36 unmodified lines | ||
| 37 | 37 | depends on OF |
| 38 | 38 | default ARCH_GEMINI |
| 39 | 39 | |
| 40 | +config PCI_IXP4XX | |
| 41 | + bool "Intel IXP4xx PCI controller" | |
| 42 | + depends on ARM && OF | |
| 43 | + default ARCH_IXP4XX | |
| 44 | + help | |
| 45 | + Say Y here if you want support for the PCI host controller found | |
| 46 | + in the Intel IXP4xx XScale-based network processor SoC. | |
| 47 | + | |
| 40 | 48 | config PCI_TEGRA |
| 41 | 49 | bool "NVIDIA Tegra PCIe controller" |
| 42 | 50 | depends on ARCH_TEGRA || COMPILE_TEST |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | obj-$(CONFIG_PCIE_CADENCE) += cadence/ |
| 3 | 3 | obj-$(CONFIG_PCI_FTPCI100) += pci-ftpci100.o |
| 4 | +obj-$(CONFIG_PCI_IXP4XX) += pci-ixp4xx.o | |
| 4 | 5 | obj-$(CONFIG_PCI_HYPERV) += pci-hyperv.o |
| 5 | 6 | obj-$(CONFIG_PCI_HYPERV_INTERFACE) += pci-hyperv-intf.o |
| 6 | 7 | obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o |
| @@ -0,0 +1,671 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +/* | |
| 3 | + * Support for Intel IXP4xx PCI host controller | |
| 4 | + * | |
| 5 | + * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org> | |
| 6 | + * | |
| 7 | + * Based on the IXP4xx arch/arm/mach-ixp4xx/common-pci.c driver | |
| 8 | + * Copyright (C) 2002 Intel Corporation | |
| 9 | + * Copyright (C) 2003 Greg Ungerer <gerg@linux-m68k.org> | |
| 10 | + * Copyright (C) 2003-2004 MontaVista Software, Inc. | |
| 11 | + * Copyright (C) 2005 Deepak Saxena <dsaxena@plexity.net> | |
| 12 | + * Copyright (C) 2005 Alessandro Zummo <a.zummo@towertech.it> | |
| 13 | + * | |
| 14 | + * TODO: | |
| 15 | + * - Test IO-space access | |
| 16 | + * - DMA support | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#include <linux/init.h> | |
| 20 | +#include <linux/io.h> | |
| 21 | +#include <linux/kernel.h> | |
| 22 | +#include <linux/of_address.h> | |
| 23 | +#include <linux/of_device.h> | |
| 24 | +#include <linux/of_pci.h> | |
| 25 | +#include <linux/pci.h> | |
| 26 | +#include <linux/platform_device.h> | |
| 27 | +#include <linux/slab.h> | |
| 28 | +#include <linux/bits.h> | |
| 29 | + | |
| 30 | +/* Register offsets */ | |
| 31 | +#define IXP4XX_PCI_NP_AD 0x00 | |
| 32 | +#define IXP4XX_PCI_NP_CBE 0x04 | |
| 33 | +#define IXP4XX_PCI_NP_WDATA 0x08 | |
| 34 | +#define IXP4XX_PCI_NP_RDATA 0x0c | |
| 35 | +#define IXP4XX_PCI_CRP_AD_CBE 0x10 | |
| 36 | +#define IXP4XX_PCI_CRP_WDATA 0x14 | |
| 37 | +#define IXP4XX_PCI_CRP_RDATA 0x18 | |
| 38 | +#define IXP4XX_PCI_CSR 0x1c | |
| 39 | +#define IXP4XX_PCI_ISR 0x20 | |
| 40 | +#define IXP4XX_PCI_INTEN 0x24 | |
| 41 | +#define IXP4XX_PCI_DMACTRL 0x28 | |
| 42 | +#define IXP4XX_PCI_AHBMEMBASE 0x2c | |
| 43 | +#define IXP4XX_PCI_AHBIOBASE 0x30 | |
| 44 | +#define IXP4XX_PCI_PCIMEMBASE 0x34 | |
| 45 | +#define IXP4XX_PCI_AHBDOORBELL 0x38 | |
| 46 | +#define IXP4XX_PCI_PCIDOORBELL 0x3c | |
| 47 | +#define IXP4XX_PCI_ATPDMA0_AHBADDR 0x40 | |
| 48 | +#define IXP4XX_PCI_ATPDMA0_PCIADDR 0x44 | |
| 49 | +#define IXP4XX_PCI_ATPDMA0_LENADDR 0x48 | |
| 50 | +#define IXP4XX_PCI_ATPDMA1_AHBADDR 0x4c | |
| 51 | +#define IXP4XX_PCI_ATPDMA1_PCIADDR 0x50 | |
| 52 | +#define IXP4XX_PCI_ATPDMA1_LENADDR 0x54 | |
| 53 | + | |
| 54 | +/* CSR bit definitions */ | |
| 55 | +#define IXP4XX_PCI_CSR_HOST BIT(0) | |
| 56 | +#define IXP4XX_PCI_CSR_ARBEN BIT(1) | |
| 57 | +#define IXP4XX_PCI_CSR_ADS BIT(2) | |
| 58 | +#define IXP4XX_PCI_CSR_PDS BIT(3) | |
| 59 | +#define IXP4XX_PCI_CSR_ABE BIT(4) | |
| 60 | +#define IXP4XX_PCI_CSR_DBT BIT(5) | |
| 61 | +#define IXP4XX_PCI_CSR_ASE BIT(8) | |
| 62 | +#define IXP4XX_PCI_CSR_IC BIT(15) | |
| 63 | +#define IXP4XX_PCI_CSR_PRST BIT(16) | |
| 64 | + | |
| 65 | +/* ISR (Interrupt status) Register bit definitions */ | |
| 66 | +#define IXP4XX_PCI_ISR_PSE BIT(0) | |
| 67 | +#define IXP4XX_PCI_ISR_PFE BIT(1) | |
| 68 | +#define IXP4XX_PCI_ISR_PPE BIT(2) | |
| 69 | +#define IXP4XX_PCI_ISR_AHBE BIT(3) | |
| 70 | +#define IXP4XX_PCI_ISR_APDC BIT(4) | |
| 71 | +#define IXP4XX_PCI_ISR_PADC BIT(5) | |
| 72 | +#define IXP4XX_PCI_ISR_ADB BIT(6) | |
| 73 | +#define IXP4XX_PCI_ISR_PDB BIT(7) | |
| 74 | + | |
| 75 | +/* INTEN (Interrupt Enable) Register bit definitions */ | |
| 76 | +#define IXP4XX_PCI_INTEN_PSE BIT(0) | |
| 77 | +#define IXP4XX_PCI_INTEN_PFE BIT(1) | |
| 78 | +#define IXP4XX_PCI_INTEN_PPE BIT(2) | |
| 79 | +#define IXP4XX_PCI_INTEN_AHBE BIT(3) | |
| 80 | +#define IXP4XX_PCI_INTEN_APDC BIT(4) | |
| 81 | +#define IXP4XX_PCI_INTEN_PADC BIT(5) | |
| 82 | +#define IXP4XX_PCI_INTEN_ADB BIT(6) | |
| 83 | +#define IXP4XX_PCI_INTEN_PDB BIT(7) | |
| 84 | + | |
| 85 | +/* Shift value for byte enable on NP cmd/byte enable register */ | |
| 86 | +#define IXP4XX_PCI_NP_CBE_BESL 4 | |
| 87 | + | |
| 88 | +/* PCI commands supported by NP access unit */ | |
| 89 | +#define NP_CMD_IOREAD 0x2 | |
| 90 | +#define NP_CMD_IOWRITE 0x3 | |
| 91 | +#define NP_CMD_CONFIGREAD 0xa | |
| 92 | +#define NP_CMD_CONFIGWRITE 0xb | |
| 93 | +#define NP_CMD_MEMREAD 0x6 | |
| 94 | +#define NP_CMD_MEMWRITE 0x7 | |
| 95 | + | |
| 96 | +/* Constants for CRP access into local config space */ | |
| 97 | +#define CRP_AD_CBE_BESL 20 | |
| 98 | +#define CRP_AD_CBE_WRITE 0x00010000 | |
| 99 | + | |
| 100 | +/* Special PCI configuration space registers for this controller */ | |
| 101 | +#define IXP4XX_PCI_RTOTTO 0x40 | |
| 102 | + | |
| 103 | +struct ixp4xx_pci { | |
| 104 | + struct device *dev; | |
| 105 | + void __iomem *base; | |
| 106 | + bool errata_hammer; | |
| 107 | + bool host_mode; | |
| 108 | +}; | |
| 109 | + | |
| 110 | +/* | |
| 111 | + * The IXP4xx has a peculiar address bus that will change the | |
| 112 | + * byte order on SoC peripherals depending on whether the device | |
| 113 | + * operates in big-endian or little-endian mode. That means that | |
| 114 | + * readl() and writel() that always use little-endian access | |
| 115 | + * will not work for SoC peripherals such as the PCI controller | |
| 116 | + * when used in big-endian mode. The accesses to the individual | |
| 117 | + * PCI devices on the other hand, are always little-endian and | |
| 118 | + * can use readl() and writel(). | |
| 119 | + * | |
| 120 | + * For local AHB bus access we need to use __raw_[readl|writel]() | |
| 121 | + * to make sure that we access the SoC devices in the CPU native | |
| 122 | + * endianness. | |
| 123 | + */ | |
| 124 | +static inline u32 ixp4xx_readl(struct ixp4xx_pci *p, u32 reg) | |
| 125 | +{ | |
| 126 | + return __raw_readl(p->base + reg); | |
| 127 | +} | |
| 128 | + | |
| 129 | +static inline void ixp4xx_writel(struct ixp4xx_pci *p, u32 reg, u32 val) | |
| 130 | +{ | |
| 131 | + __raw_writel(val, p->base + reg); | |
| 132 | +} | |
| 133 | + | |
| 134 | +static int ixp4xx_pci_check_master_abort(struct ixp4xx_pci *p) | |
| 135 | +{ | |
| 136 | + u32 isr = ixp4xx_readl(p, IXP4XX_PCI_ISR); | |
| 137 | + | |
| 138 | + if (isr & IXP4XX_PCI_ISR_PFE) { | |
| 139 | + /* Make sure the master abort bit is reset */ | |
| 140 | + ixp4xx_writel(p, IXP4XX_PCI_ISR, IXP4XX_PCI_ISR_PFE); | |
| 141 | + dev_dbg(p->dev, "master abort detected\n"); | |
| 142 | + return -EINVAL; | |
| 143 | + } | |
| 144 | + | |
| 145 | + return 0; | |
| 146 | +} | |
| 147 | + | |
| 148 | +static int ixp4xx_pci_read(struct ixp4xx_pci *p, u32 addr, u32 cmd, u32 *data) | |
| 149 | +{ | |
| 150 | + ixp4xx_writel(p, IXP4XX_PCI_NP_AD, addr); | |
| 151 | + | |
| 152 | + if (p->errata_hammer) { | |
| 153 | + int i; | |
| 154 | + | |
| 155 | + /* | |
| 156 | + * PCI workaround - only works if NP PCI space reads have | |
| 157 | + * no side effects. Hammer the register and read twice 8 | |
| 158 | + * times. last one will be good. | |
| 159 | + */ | |
| 160 | + for (i = 0; i < 8; i++) { | |
| 161 | + ixp4xx_writel(p, IXP4XX_PCI_NP_CBE, cmd); | |
| 162 | + *data = ixp4xx_readl(p, IXP4XX_PCI_NP_RDATA); | |
| 163 | + *data = ixp4xx_readl(p, IXP4XX_PCI_NP_RDATA); | |
| 164 | + } | |
| 165 | + } else { | |
| 166 | + ixp4xx_writel(p, IXP4XX_PCI_NP_CBE, cmd); | |
| 167 | + *data = ixp4xx_readl(p, IXP4XX_PCI_NP_RDATA); | |
| 168 | + } | |
| 169 | + | |
| 170 | + return ixp4xx_pci_check_master_abort(p); | |
| 171 | +} | |
| 172 | + | |
| 173 | +static int ixp4xx_pci_write(struct ixp4xx_pci *p, u32 addr, u32 cmd, u32 data) | |
| 174 | +{ | |
| 175 | + ixp4xx_writel(p, IXP4XX_PCI_NP_AD, addr); | |
| 176 | + | |
| 177 | + /* Set up the write */ | |
| 178 | + ixp4xx_writel(p, IXP4XX_PCI_NP_CBE, cmd); | |
| 179 | + | |
| 180 | + /* Execute the write by writing to NP_WDATA */ | |
| 181 | + ixp4xx_writel(p, IXP4XX_PCI_NP_WDATA, data); | |
| 182 | + | |
| 183 | + return ixp4xx_pci_check_master_abort(p); | |
| 184 | +} | |
| 185 | + | |
| 186 | +static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where) | |
| 187 | +{ | |
| 188 | + /* Root bus is always 0 in this hardware */ | |
| 189 | + if (bus_num == 0) { | |
| 190 | + /* type 0 */ | |
| 191 | + return BIT(32-PCI_SLOT(devfn)) | ((PCI_FUNC(devfn)) << 8) | | |
| 192 | + (where & ~3); | |
| 193 | + } else { | |
| 194 | + /* type 1 */ | |
| 195 | + return (bus_num << 16) | ((PCI_SLOT(devfn)) << 11) | | |
| 196 | + ((PCI_FUNC(devfn)) << 8) | (where & ~3) | 1; | |
| 197 | + } | |
| 198 | +} | |
| 199 | + | |
| 200 | +/* | |
| 201 | + * CRP functions are "Controller Configuration Port" accesses | |
| 202 | + * initiated from within this driver itself to read/write PCI | |
| 203 | + * control information in the config space. | |
| 204 | + */ | |
| 205 | +static u32 ixp4xx_crp_byte_lane_enable_bits(u32 n, int size) | |
| 206 | +{ | |
| 207 | + if (size == 1) | |
| 208 | + return (0xf & ~BIT(n)) << CRP_AD_CBE_BESL; | |
| 209 | + if (size == 2) | |
| 210 | + return (0xf & ~(BIT(n) | BIT(n+1))) << CRP_AD_CBE_BESL; | |
| 211 | + if (size == 4) | |
| 212 | + return 0; | |
| 213 | + return 0xffffffff; | |
| 214 | +} | |
| 215 | + | |
| 216 | +static int ixp4xx_crp_read_config(struct ixp4xx_pci *p, int where, int size, | |
| 217 | + u32 *value) | |
| 218 | +{ | |
| 219 | + u32 n, cmd, val; | |
| 220 | + | |
| 221 | + n = where % 4; | |
| 222 | + cmd = where & ~3; | |
| 223 | + | |
| 224 | + dev_dbg(p->dev, "%s from %d size %d cmd %08x\n", | |
| 225 | + __func__, where, size, cmd); | |
| 226 | + | |
| 227 | + ixp4xx_writel(p, IXP4XX_PCI_CRP_AD_CBE, cmd); | |
| 228 | + val = ixp4xx_readl(p, IXP4XX_PCI_CRP_RDATA); | |
| 229 | + | |
| 230 | + val >>= (8*n); | |
| 231 | + switch (size) { | |
| 232 | + case 1: | |
| 233 | + val &= U8_MAX; | |
| 234 | + dev_dbg(p->dev, "%s read byte %02x\n", __func__, val); | |
| 235 | + break; | |
| 236 | + case 2: | |
| 237 | + val &= U16_MAX; | |
| 238 | + dev_dbg(p->dev, "%s read word %04x\n", __func__, val); | |
| 239 | + break; | |
| 240 | + case 4: | |
| 241 | + val &= U32_MAX; | |
| 242 | + dev_dbg(p->dev, "%s read long %08x\n", __func__, val); | |
| 243 | + break; | |
| 244 | + default: | |
| 245 | + /* Should not happen */ | |
| 246 | + dev_err(p->dev, "%s illegal size\n", __func__); | |
| 247 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 248 | + } | |
| 249 | + *value = val; | |
| 250 | + | |
| 251 | + return PCIBIOS_SUCCESSFUL; | |
| 252 | +} | |
| 253 | + | |
| 254 | +static int ixp4xx_crp_write_config(struct ixp4xx_pci *p, int where, int size, | |
| 255 | + u32 value) | |
| 256 | +{ | |
| 257 | + u32 n, cmd, val; | |
| 258 | + | |
| 259 | + n = where % 4; | |
| 260 | + cmd = ixp4xx_crp_byte_lane_enable_bits(n, size); | |
| 261 | + if (cmd == 0xffffffff) | |
| 262 | + return PCIBIOS_BAD_REGISTER_NUMBER; | |
| 263 | + cmd |= where & ~3; | |
| 264 | + cmd |= CRP_AD_CBE_WRITE; | |
| 265 | + | |
| 266 | + val = value << (8*n); | |
| 267 | + | |
| 268 | + dev_dbg(p->dev, "%s to %d size %d cmd %08x val %08x\n", | |
| 269 | + __func__, where, size, cmd, val); | |
| 270 | + | |
| 271 | + ixp4xx_writel(p, IXP4XX_PCI_CRP_AD_CBE, cmd); | |
| 272 | + ixp4xx_writel(p, IXP4XX_PCI_CRP_WDATA, val); | |
| 273 | + | |
| 274 | + return PCIBIOS_SUCCESSFUL; | |
| 275 | +} | |
| 276 | + | |
| 277 | +/* | |
| 278 | + * Then follows the functions that read and write from the common PCI | |
| 279 | + * configuration space. | |
| 280 | + */ | |
| 281 | +static u32 ixp4xx_byte_lane_enable_bits(u32 n, int size) | |
| 282 | +{ | |
| 283 | + if (size == 1) | |
| 284 | + return (0xf & ~BIT(n)) << 4; | |
| 285 | + if (size == 2) | |
| 286 | + return (0xf & ~(BIT(n) | BIT(n+1))) << 4; | |
| 287 | + if (size == 4) | |
| 288 | + return 0; | |
| 289 | + return 0xffffffff; | |
| 290 | +} | |
| 291 | + | |
| 292 | +static int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |
| 293 | + int where, int size, u32 *value) | |
| 294 | +{ | |
| 295 | + struct ixp4xx_pci *p = bus->sysdata; | |
| 296 | + u32 n, addr, val, cmd; | |
| 297 | + u8 bus_num = bus->number; | |
| 298 | + int ret; | |
| 299 | + | |
| 300 | + *value = 0xffffffff; | |
| 301 | + n = where % 4; | |
| 302 | + cmd = ixp4xx_byte_lane_enable_bits(n, size); | |
| 303 | + if (cmd == 0xffffffff) | |
| 304 | + return PCIBIOS_BAD_REGISTER_NUMBER; | |
| 305 | + | |
| 306 | + addr = ixp4xx_config_addr(bus_num, devfn, where); | |
| 307 | + cmd |= NP_CMD_CONFIGREAD; | |
| 308 | + dev_dbg(p->dev, "read_config from %d size %d dev %d:%d:%d address: %08x cmd: %08x\n", | |
| 309 | + where, size, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn), addr, cmd); | |
| 310 | + | |
| 311 | + ret = ixp4xx_pci_read(p, addr, cmd, &val); | |
| 312 | + if (ret) | |
| 313 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 314 | + | |
| 315 | + val >>= (8*n); | |
| 316 | + switch (size) { | |
| 317 | + case 1: | |
| 318 | + val &= U8_MAX; | |
| 319 | + dev_dbg(p->dev, "%s read byte %02x\n", __func__, val); | |
| 320 | + break; | |
| 321 | + case 2: | |
| 322 | + val &= U16_MAX; | |
| 323 | + dev_dbg(p->dev, "%s read word %04x\n", __func__, val); | |
| 324 | + break; | |
| 325 | + case 4: | |
| 326 | + val &= U32_MAX; | |
| 327 | + dev_dbg(p->dev, "%s read long %08x\n", __func__, val); | |
| 328 | + break; | |
| 329 | + default: | |
| 330 | + /* Should not happen */ | |
| 331 | + dev_err(p->dev, "%s illegal size\n", __func__); | |
| 332 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 333 | + } | |
| 334 | + *value = val; | |
| 335 | + | |
| 336 | + return PCIBIOS_SUCCESSFUL; | |
| 337 | +} | |
| 338 | + | |
| 339 | +static int ixp4xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, | |
| 340 | + int where, int size, u32 value) | |
| 341 | +{ | |
| 342 | + struct ixp4xx_pci *p = bus->sysdata; | |
| 343 | + u32 n, addr, val, cmd; | |
| 344 | + u8 bus_num = bus->number; | |
| 345 | + int ret; | |
| 346 | + | |
| 347 | + n = where % 4; | |
| 348 | + cmd = ixp4xx_byte_lane_enable_bits(n, size); | |
| 349 | + if (cmd == 0xffffffff) | |
| 350 | + return PCIBIOS_BAD_REGISTER_NUMBER; | |
| 351 | + | |
| 352 | + addr = ixp4xx_config_addr(bus_num, devfn, where); | |
| 353 | + cmd |= NP_CMD_CONFIGWRITE; | |
| 354 | + val = value << (8*n); | |
| 355 | + | |
| 356 | + dev_dbg(p->dev, "write_config_byte %#x to %d size %d dev %d:%d:%d addr: %08x cmd %08x\n", | |
| 357 | + value, where, size, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn), addr, cmd); | |
| 358 | + | |
| 359 | + ret = ixp4xx_pci_write(p, addr, cmd, val); | |
| 360 | + if (ret) | |
| 361 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 362 | + | |
| 363 | + return PCIBIOS_SUCCESSFUL; | |
| 364 | +} | |
| 365 | + | |
| 366 | +static struct pci_ops ixp4xx_pci_ops = { | |
| 367 | + .read = ixp4xx_pci_read_config, | |
| 368 | + .write = ixp4xx_pci_write_config, | |
| 369 | +}; | |
| 370 | + | |
| 371 | +static u32 ixp4xx_pci_addr_to_64mconf(phys_addr_t addr) | |
| 372 | +{ | |
| 373 | + u8 base; | |
| 374 | + | |
| 375 | + base = ((addr & 0xff000000) >> 24); | |
| 376 | + return (base << 24) | ((base + 1) << 16) | |
| 377 | + | ((base + 2) << 8) | (base + 3); | |
| 378 | +} | |
| 379 | + | |
| 380 | +static int ixp4xx_pci_parse_map_ranges(struct ixp4xx_pci *p) | |
| 381 | +{ | |
| 382 | + struct device *dev = p->dev; | |
| 383 | + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p); | |
| 384 | + struct resource_entry *win; | |
| 385 | + struct resource *res; | |
| 386 | + phys_addr_t addr; | |
| 387 | + | |
| 388 | + win = resource_list_first_type(&bridge->windows, IORESOURCE_MEM); | |
| 389 | + if (win) { | |
| 390 | + u32 pcimembase; | |
| 391 | + | |
| 392 | + res = win->res; | |
| 393 | + addr = res->start - win->offset; | |
| 394 | + | |
| 395 | + if (res->flags & IORESOURCE_PREFETCH) | |
| 396 | + res->name = "IXP4xx PCI PRE-MEM"; | |
| 397 | + else | |
| 398 | + res->name = "IXP4xx PCI NON-PRE-MEM"; | |
| 399 | + | |
| 400 | + dev_dbg(dev, "%s window %pR, bus addr %pa\n", | |
| 401 | + res->name, res, &addr); | |
| 402 | + if (resource_size(res) != SZ_64M) { | |
| 403 | + dev_err(dev, "memory range is not 64MB\n"); | |
| 404 | + return -EINVAL; | |
| 405 | + } | |
| 406 | + | |
| 407 | + pcimembase = ixp4xx_pci_addr_to_64mconf(addr); | |
| 408 | + /* Commit configuration */ | |
| 409 | + ixp4xx_writel(p, IXP4XX_PCI_PCIMEMBASE, pcimembase); | |
| 410 | + } else { | |
| 411 | + dev_err(dev, "no AHB memory mapping defined\n"); | |
| 412 | + } | |
| 413 | + | |
| 414 | + win = resource_list_first_type(&bridge->windows, IORESOURCE_IO); | |
| 415 | + if (win) { | |
| 416 | + res = win->res; | |
| 417 | + | |
| 418 | + addr = pci_pio_to_address(res->start); | |
| 419 | + if (addr & 0xff) { | |
| 420 | + dev_err(dev, "IO mem at uneven address: %pa\n", &addr); | |
| 421 | + return -EINVAL; | |
| 422 | + } | |
| 423 | + | |
| 424 | + res->name = "IXP4xx PCI IO MEM"; | |
| 425 | + /* | |
| 426 | + * Setup I/O space location for PCI->AHB access, the | |
| 427 | + * upper 24 bits of the address goes into the lower | |
| 428 | + * 24 bits of this register. | |
| 429 | + */ | |
| 430 | + ixp4xx_writel(p, IXP4XX_PCI_AHBIOBASE, (addr >> 8)); | |
| 431 | + } else { | |
| 432 | + dev_info(dev, "no IO space AHB memory mapping defined\n"); | |
| 433 | + } | |
| 434 | + | |
| 435 | + return 0; | |
| 436 | +} | |
| 437 | + | |
| 438 | +static int ixp4xx_pci_parse_map_dma_ranges(struct ixp4xx_pci *p) | |
| 439 | +{ | |
| 440 | + struct device *dev = p->dev; | |
| 441 | + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p); | |
| 442 | + struct resource_entry *win; | |
| 443 | + struct resource *res; | |
| 444 | + phys_addr_t addr; | |
| 445 | + u32 ahbmembase; | |
| 446 | + | |
| 447 | + win = resource_list_first_type(&bridge->dma_ranges, IORESOURCE_MEM); | |
| 448 | + if (win) { | |
| 449 | + res = win->res; | |
| 450 | + addr = res->start - win->offset; | |
| 451 | + | |
| 452 | + if (resource_size(res) != SZ_64M) { | |
| 453 | + dev_err(dev, "DMA memory range is not 64MB\n"); | |
| 454 | + return -EINVAL; | |
| 455 | + } | |
| 456 | + | |
| 457 | + dev_dbg(dev, "DMA MEM BASE: %pa\n", &addr); | |
| 458 | + /* | |
| 459 | + * 4 PCI-to-AHB windows of 16 MB each, write the 8 high bits | |
| 460 | + * into each byte of the PCI_AHBMEMBASE register. | |
| 461 | + */ | |
| 462 | + ahbmembase = ixp4xx_pci_addr_to_64mconf(addr); | |
| 463 | + /* Commit AHB membase */ | |
| 464 | + ixp4xx_writel(p, IXP4XX_PCI_AHBMEMBASE, ahbmembase); | |
| 465 | + } else { | |
| 466 | + dev_err(dev, "no DMA memory range defined\n"); | |
| 467 | + } | |
| 468 | + | |
| 469 | + return 0; | |
| 470 | +} | |
| 471 | + | |
| 472 | +/* Only used to get context for abort handling */ | |
| 473 | +static struct ixp4xx_pci *ixp4xx_pci_abort_singleton; | |
| 474 | + | |
| 475 | +static int ixp4xx_pci_abort_handler(unsigned long addr, unsigned int fsr, | |
| 476 | + struct pt_regs *regs) | |
| 477 | +{ | |
| 478 | + struct ixp4xx_pci *p = ixp4xx_pci_abort_singleton; | |
| 479 | + u32 isr, status; | |
| 480 | + int ret; | |
| 481 | + | |
| 482 | + isr = ixp4xx_readl(p, IXP4XX_PCI_ISR); | |
| 483 | + ret = ixp4xx_crp_read_config(p, PCI_STATUS, 2, &status); | |
| 484 | + if (ret) { | |
| 485 | + dev_err(p->dev, "unable to read abort status\n"); | |
| 486 | + return -EINVAL; | |
| 487 | + } | |
| 488 | + | |
| 489 | + dev_err(p->dev, | |
| 490 | + "PCI: abort_handler addr = %#lx, isr = %#x, status = %#x\n", | |
| 491 | + addr, isr, status); | |
| 492 | + | |
| 493 | + /* Make sure the Master Abort bit is reset */ | |
| 494 | + ixp4xx_writel(p, IXP4XX_PCI_ISR, IXP4XX_PCI_ISR_PFE); | |
| 495 | + status |= PCI_STATUS_REC_MASTER_ABORT; | |
| 496 | + ret = ixp4xx_crp_write_config(p, PCI_STATUS, 2, status); | |
| 497 | + if (ret) | |
| 498 | + dev_err(p->dev, "unable to clear abort status bit\n"); | |
| 499 | + | |
| 500 | + /* | |
| 501 | + * If it was an imprecise abort, then we need to correct the | |
| 502 | + * return address to be _after_ the instruction. | |
| 503 | + */ | |
| 504 | + if (fsr & (1 << 10)) { | |
| 505 | + dev_err(p->dev, "imprecise abort\n"); | |
| 506 | + regs->ARM_pc += 4; | |
| 507 | + } | |
| 508 | + | |
| 509 | + return 0; | |
| 510 | +} | |
| 511 | + | |
| 512 | +static int __init ixp4xx_pci_probe(struct platform_device *pdev) | |
| 513 | +{ | |
| 514 | + struct device *dev = &pdev->dev; | |
| 515 | + struct device_node *np = dev->of_node; | |
| 516 | + struct ixp4xx_pci *p; | |
| 517 | + struct pci_host_bridge *host; | |
| 518 | + int ret; | |
| 519 | + u32 val; | |
| 520 | + phys_addr_t addr; | |
| 521 | + u32 basereg[4] = { | |
| 522 | + PCI_BASE_ADDRESS_0, | |
| 523 | + PCI_BASE_ADDRESS_1, | |
| 524 | + PCI_BASE_ADDRESS_2, | |
| 525 | + PCI_BASE_ADDRESS_3, | |
| 526 | + }; | |
| 527 | + int i; | |
| 528 | + | |
| 529 | + host = devm_pci_alloc_host_bridge(dev, sizeof(*p)); | |
| 530 | + if (!host) | |
| 531 | + return -ENOMEM; | |
| 532 | + | |
| 533 | + host->ops = &ixp4xx_pci_ops; | |
| 534 | + p = pci_host_bridge_priv(host); | |
| 535 | + host->sysdata = p; | |
| 536 | + p->dev = dev; | |
| 537 | + dev_set_drvdata(dev, p); | |
| 538 | + | |
| 539 | + /* | |
| 540 | + * Set up quirk for erratic behaviour in the 42x variant | |
| 541 | + * when accessing config space. | |
| 542 | + */ | |
| 543 | + if (of_device_is_compatible(np, "intel,ixp42x-pci")) { | |
| 544 | + p->errata_hammer = true; | |
| 545 | + dev_info(dev, "activate hammering errata\n"); | |
| 546 | + } | |
| 547 | + | |
| 548 | + p->base = devm_platform_ioremap_resource(pdev, 0); | |
| 549 | + if (IS_ERR(p->base)) | |
| 550 | + return PTR_ERR(p->base); | |
| 551 | + | |
| 552 | + val = ixp4xx_readl(p, IXP4XX_PCI_CSR); | |
| 553 | + p->host_mode = !!(val & IXP4XX_PCI_CSR_HOST); | |
| 554 | + dev_info(dev, "controller is in %s mode\n", | |
| 555 | + p->host_mode ? "host" : "option"); | |
| 556 | + | |
| 557 | + /* Hook in our fault handler for PCI errors */ | |
| 558 | + ixp4xx_pci_abort_singleton = p; | |
| 559 | + hook_fault_code(16+6, ixp4xx_pci_abort_handler, SIGBUS, 0, | |
| 560 | + "imprecise external abort"); | |
| 561 | + | |
| 562 | + ret = ixp4xx_pci_parse_map_ranges(p); | |
| 563 | + if (ret) | |
| 564 | + return ret; | |
| 565 | + | |
| 566 | + ret = ixp4xx_pci_parse_map_dma_ranges(p); | |
| 567 | + if (ret) | |
| 568 | + return ret; | |
| 569 | + | |
| 570 | + /* This is only configured in host mode */ | |
| 571 | + if (p->host_mode) { | |
| 572 | + addr = __pa(PAGE_OFFSET); | |
| 573 | + /* This is a noop (0x00) but explains what is going on */ | |
| 574 | + addr |= PCI_BASE_ADDRESS_SPACE_MEMORY; | |
| 575 | + | |
| 576 | + for (i = 0; i < 4; i++) { | |
| 577 | + /* Write this directly into the config space */ | |
| 578 | + ret = ixp4xx_crp_write_config(p, basereg[i], 4, addr); | |
| 579 | + if (ret) | |
| 580 | + dev_err(dev, "failed to set up PCI_BASE_ADDRESS_%d\n", i); | |
| 581 | + else | |
| 582 | + dev_info(dev, "set PCI_BASE_ADDR_%d to %pa\n", i, &addr); | |
| 583 | + addr += SZ_16M; | |
| 584 | + } | |
| 585 | + | |
| 586 | + /* | |
| 587 | + * Enable CSR window at 64 MiB to allow PCI masters to continue | |
| 588 | + * prefetching past the 64 MiB boundary, if all AHB to PCI | |
| 589 | + * windows are consecutive. | |
| 590 | + */ | |
| 591 | + ret = ixp4xx_crp_write_config(p, PCI_BASE_ADDRESS_4, 4, addr); | |
| 592 | + if (ret) | |
| 593 | + dev_err(dev, "failed to set up PCI_BASE_ADDRESS_4\n"); | |
| 594 | + else | |
| 595 | + dev_info(dev, "set PCI_BASE_ADDR_4 to %pa\n", &addr); | |
| 596 | + | |
| 597 | + /* | |
| 598 | + * Put the IO memory window at the very end of physical memory | |
| 599 | + * at 0xfffffc00. This is when the system is trying to access IO | |
| 600 | + * memory over AHB. | |
| 601 | + */ | |
| 602 | + addr = 0xfffffc00; | |
| 603 | + addr |= PCI_BASE_ADDRESS_SPACE_IO; | |
| 604 | + ret = ixp4xx_crp_write_config(p, PCI_BASE_ADDRESS_5, 4, addr); | |
| 605 | + if (ret) | |
| 606 | + dev_err(dev, "failed to set up PCI_BASE_ADDRESS_5\n"); | |
| 607 | + else | |
| 608 | + dev_info(dev, "set PCI_BASE_ADDR_5 to %pa\n", &addr); | |
| 609 | + | |
| 610 | + /* | |
| 611 | + * Retry timeout to 0x80 | |
| 612 | + * Transfer ready timeout to 0xff | |
| 613 | + */ | |
| 614 | + ret = ixp4xx_crp_write_config(p, IXP4XX_PCI_RTOTTO, 4, | |
| 615 | + 0x000080ff); | |
| 616 | + if (ret) | |
| 617 | + dev_err(dev, "failed to set up TRDY limit\n"); | |
| 618 | + else | |
| 619 | + dev_info(dev, "set TRDY limit to 0x80ff\n"); | |
| 620 | + } | |
| 621 | + | |
| 622 | + /* Clear interrupts */ | |
| 623 | + val = IXP4XX_PCI_ISR_PSE | IXP4XX_PCI_ISR_PFE | IXP4XX_PCI_ISR_PPE | IXP4XX_PCI_ISR_AHBE; | |
| 624 | + ixp4xx_writel(p, IXP4XX_PCI_ISR, val); | |
| 625 | + | |
| 626 | + /* | |
| 627 | + * Set Initialize Complete in PCI Control Register: allow IXP4XX to | |
| 628 | + * generate PCI configuration cycles. Specify that the AHB bus is | |
| 629 | + * operating in big-endian mode. Set up byte lane swapping between | |
| 630 | + * little-endian PCI and the big-endian AHB bus. | |
| 631 | + */ | |
| 632 | + val = IXP4XX_PCI_CSR_IC | IXP4XX_PCI_CSR_ABE; | |
| 633 | + if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) | |
| 634 | + val |= (IXP4XX_PCI_CSR_PDS | IXP4XX_PCI_CSR_ADS); | |
| 635 | + ixp4xx_writel(p, IXP4XX_PCI_CSR, val); | |
| 636 | + | |
| 637 | + ret = ixp4xx_crp_write_config(p, PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); | |
| 638 | + if (ret) | |
| 639 | + dev_err(dev, "unable to initialize master and command memory\n"); | |
| 640 | + else | |
| 641 | + dev_info(dev, "initialized as master\n"); | |
| 642 | + | |
| 643 | + pci_host_probe(host); | |
| 644 | + | |
| 645 | + return 0; | |
| 646 | +} | |
| 647 | + | |
| 648 | +static const struct of_device_id ixp4xx_pci_of_match[] = { | |
| 649 | + { | |
| 650 | + .compatible = "intel,ixp42x-pci", | |
| 651 | + }, | |
| 652 | + { | |
| 653 | + .compatible = "intel,ixp43x-pci", | |
| 654 | + }, | |
| 655 | + {}, | |
| 656 | +}; | |
| 657 | + | |
| 658 | +/* | |
| 659 | + * This driver needs to be a builtin module with suppressed bind | |
| 660 | + * attributes since the probe() is initializing a hard exception | |
| 661 | + * handler and this can only be done from __init-tagged code | |
| 662 | + * sections. This module cannot be removed and inserted at all. | |
| 663 | + */ | |
| 664 | +static struct platform_driver ixp4xx_pci_driver = { | |
| 665 | + .driver = { | |
| 666 | + .name = "ixp4xx-pci", | |
| 667 | + .suppress_bind_attrs = true, | |
| 668 | + .of_match_table = ixp4xx_pci_of_match, | |
| 669 | + }, | |
| 670 | +}; | |
| 671 | +builtin_platform_driver_probe(ixp4xx_pci_driver, ixp4xx_pci_probe); | |
| @@ -70,6 +70,9 @@ static int __init imx_soc_device_init(void) · 69 unmodified lines | ||
| 70 | 70 | case MXC_CPU_MX35: |
| 71 | 71 | soc_id = "i.MX35"; |
| 72 | 72 | break; |
| 73 | + case MXC_CPU_MX50: | |
| 74 | + soc_id = "i.MX50"; | |
| 75 | + break; | |
| 73 | 76 | case MXC_CPU_MX51: |
| 74 | 77 | ocotp_compat = "fsl,imx51-iim"; |
| 75 | 78 | soc_id = "i.MX51"; |
| @@ -21,6 +21,8 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <linux/of_platform.h> |
| 22 | 22 | #include <linux/platform_device.h> |
| 23 | 23 | #include <linux/soc/ixp4xx/npe.h> |
| 24 | +#include <mach/hardware.h> | |
| 25 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 24 | 26 | |
| 25 | 27 | #define DEBUG_MSG 0 |
| 26 | 28 | #define DEBUG_FW 0 |
| @@ -12,6 +12,8 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/of.h> |
| 13 | 13 | #include <linux/platform_device.h> |
| 14 | 14 | #include <linux/soc/ixp4xx/qmgr.h> |
| 15 | +#include <mach/hardware.h> | |
| 16 | +#include <linux/soc/ixp4xx/cpu.h> | |
| 15 | 17 | |
| 16 | 18 | static struct qmgr_regs __iomem *qmgr_regs; |
| 17 | 19 | static int qmgr_irq_1; |
| @@ -144,6 +144,8 @@ config SOC_TEGRA_FLOWCTRL · 143 unmodified lines | ||
| 144 | 144 | config SOC_TEGRA_PMC |
| 145 | 145 | bool |
| 146 | 146 | select GENERIC_PINCONF |
| 147 | + select PM_OPP | |
| 148 | + select PM_GENERIC_DOMAINS | |
| 147 | 149 | |
| 148 | 150 | config SOC_TEGRA_POWERGATE_BPMP |
| 149 | 151 | def_bool y |
| @@ -3,9 +3,16 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +#define dev_fmt(fmt) "tegra-soc: " fmt | |
| 7 | + | |
| 8 | +#include <linux/clk.h> | |
| 9 | +#include <linux/device.h> | |
| 10 | +#include <linux/export.h> | |
| 6 | 11 | #include <linux/of.h> |
| 12 | +#include <linux/pm_opp.h> | |
| 7 | 13 | |
| 8 | 14 | #include <soc/tegra/common.h> |
| 15 | +#include <soc/tegra/fuse.h> | |
| 9 | 16 | |
| 10 | 17 | static const struct of_device_id tegra_machine_match[] = { |
| 11 | 18 | { .compatible = "nvidia,tegra20", }, |
| @@ -31,3 +38,93 @@ bool soc_is_tegra(void) · 19 unmodified lines | ||
| 31 | 38 | |
| 32 | 39 | return match != NULL; |
| 33 | 40 | } |
| 41 | + | |
| 42 | +static int tegra_core_dev_init_opp_state(struct device *dev) | |
| 43 | +{ | |
| 44 | + unsigned long rate; | |
| 45 | + struct clk *clk; | |
| 46 | + int err; | |
| 47 | + | |
| 48 | + clk = devm_clk_get(dev, NULL); | |
| 49 | + if (IS_ERR(clk)) { | |
| 50 | + dev_err(dev, "failed to get clk: %pe\n", clk); | |
| 51 | + return PTR_ERR(clk); | |
| 52 | + } | |
| 53 | + | |
| 54 | + rate = clk_get_rate(clk); | |
| 55 | + if (!rate) { | |
| 56 | + dev_err(dev, "failed to get clk rate\n"); | |
| 57 | + return -EINVAL; | |
| 58 | + } | |
| 59 | + | |
| 60 | + /* first dummy rate-setting initializes voltage vote */ | |
| 61 | + err = dev_pm_opp_set_rate(dev, rate); | |
| 62 | + if (err) { | |
| 63 | + dev_err(dev, "failed to initialize OPP clock: %d\n", err); | |
| 64 | + return err; | |
| 65 | + } | |
| 66 | + | |
| 67 | + return 0; | |
| 68 | +} | |
| 69 | + | |
| 70 | +/** | |
| 71 | + * devm_tegra_core_dev_init_opp_table() - initialize OPP table | |
| 72 | + * @dev: device for which OPP table is initialized | |
| 73 | + * @params: pointer to the OPP table configuration | |
| 74 | + * | |
| 75 | + * This function will initialize OPP table and sync OPP state of a Tegra SoC | |
| 76 | + * core device. | |
| 77 | + * | |
| 78 | + * Return: 0 on success or errorno. | |
| 79 | + */ | |
| 80 | +int devm_tegra_core_dev_init_opp_table(struct device *dev, | |
| 81 | + struct tegra_core_opp_params *params) | |
| 82 | +{ | |
| 83 | + u32 hw_version; | |
| 84 | + int err; | |
| 85 | + | |
| 86 | + err = devm_pm_opp_set_clkname(dev, NULL); | |
| 87 | + if (err) { | |
| 88 | + dev_err(dev, "failed to set OPP clk: %d\n", err); | |
| 89 | + return err; | |
| 90 | + } | |
| 91 | + | |
| 92 | + /* Tegra114+ doesn't support OPP yet */ | |
| 93 | + if (!of_machine_is_compatible("nvidia,tegra20") && | |
| 94 | + !of_machine_is_compatible("nvidia,tegra30")) | |
| 95 | + return -ENODEV; | |
| 96 | + | |
| 97 | + if (of_machine_is_compatible("nvidia,tegra20")) | |
| 98 | + hw_version = BIT(tegra_sku_info.soc_process_id); | |
| 99 | + else | |
| 100 | + hw_version = BIT(tegra_sku_info.soc_speedo_id); | |
| 101 | + | |
| 102 | + err = devm_pm_opp_set_supported_hw(dev, &hw_version, 1); | |
| 103 | + if (err) { | |
| 104 | + dev_err(dev, "failed to set OPP supported HW: %d\n", err); | |
| 105 | + return err; | |
| 106 | + } | |
| 107 | + | |
| 108 | + /* | |
| 109 | + * Older device-trees have an empty OPP table, we will get | |
| 110 | + * -ENODEV from devm_pm_opp_of_add_table() in this case. | |
| 111 | + */ | |
| 112 | + err = devm_pm_opp_of_add_table(dev); | |
| 113 | + if (err) { | |
| 114 | + if (err == -ENODEV) | |
| 115 | + dev_err_once(dev, "OPP table not found, please update device-tree\n"); | |
| 116 | + else | |
| 117 | + dev_err(dev, "failed to add OPP table: %d\n", err); | |
| 118 | + | |
| 119 | + return err; | |
| 120 | + } | |
| 121 | + | |
| 122 | + if (params->init_state) { | |
| 123 | + err = tegra_core_dev_init_opp_state(dev); | |
| 124 | + if (err) | |
| 125 | + return err; | |
| 126 | + } | |
| 127 | + | |
| 128 | + return 0; | |
| 129 | +} | |
| 130 | +EXPORT_SYMBOL_GPL(devm_tegra_core_dev_init_opp_table); | |
| @@ -489,10 +489,8 @@ static int __init tegra_init_fuse(void) · 488 unmodified lines | ||
| 489 | 489 | size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups; |
| 490 | 490 | |
| 491 | 491 | fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL); |
| 492 | − if (!fuse->lookups) | |
| 493 | − return -ENOMEM; | |
| 494 | − | |
| 495 | − nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); | |
| 492 | + if (fuse->lookups) | |
| 493 | + nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); | |
| 496 | 494 | } |
| 497 | 495 | |
| 498 | 496 | return 0; |
| @@ -37,7 +37,8 @@ · 36 unmodified lines | ||
| 37 | 37 | defined(CONFIG_ARCH_TEGRA_132_SOC) || \ |
| 38 | 38 | defined(CONFIG_ARCH_TEGRA_210_SOC) || \ |
| 39 | 39 | defined(CONFIG_ARCH_TEGRA_186_SOC) || \ |
| 40 | − defined(CONFIG_ARCH_TEGRA_194_SOC) | |
| 40 | + defined(CONFIG_ARCH_TEGRA_194_SOC) || \ | |
| 41 | + defined(CONFIG_ARCH_TEGRA_234_SOC) | |
| 41 | 42 | static u32 tegra30_fuse_read_early(struct tegra_fuse *fuse, unsigned int offset) |
| 42 | 43 | { |
| 43 | 44 | if (WARN_ON(!fuse->base)) |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | #include <linux/pinctrl/pinctrl.h> |
| 39 | 39 | #include <linux/platform_device.h> |
| 40 | 40 | #include <linux/pm_domain.h> |
| 41 | +#include <linux/pm_opp.h> | |
| 41 | 42 | #include <linux/reboot.h> |
| 42 | 43 | #include <linux/regmap.h> |
| 43 | 44 | #include <linux/reset.h> |
| @@ -428,6 +429,9 @@ struct tegra_pmc { · 384 unmodified lines | ||
| 428 | 429 | struct irq_chip irq; |
| 429 | 430 | |
| 430 | 431 | struct notifier_block clk_nb; |
| 432 | + | |
| 433 | + bool core_domain_state_synced; | |
| 434 | + bool core_domain_registered; | |
| 431 | 435 | }; |
| 432 | 436 | |
| 433 | 437 | static struct tegra_pmc *pmc = &(struct tegra_pmc) { |
| @@ -1297,12 +1301,107 @@ free_mem: · 863 unmodified lines | ||
| 1297 | 1301 | return err; |
| 1298 | 1302 | } |
| 1299 | 1303 | |
| 1304 | +bool tegra_pmc_core_domain_state_synced(void) | |
| 1305 | +{ | |
| 1306 | + return pmc->core_domain_state_synced; | |
| 1307 | +} | |
| 1308 | + | |
| 1309 | +static int | |
| 1310 | +tegra_pmc_core_pd_set_performance_state(struct generic_pm_domain *genpd, | |
| 1311 | + unsigned int level) | |
| 1312 | +{ | |
| 1313 | + struct dev_pm_opp *opp; | |
| 1314 | + int err; | |
| 1315 | + | |
| 1316 | + opp = dev_pm_opp_find_level_ceil(&genpd->dev, &level); | |
| 1317 | + if (IS_ERR(opp)) { | |
| 1318 | + dev_err(&genpd->dev, "failed to find OPP for level %u: %pe\n", | |
| 1319 | + level, opp); | |
| 1320 | + return PTR_ERR(opp); | |
| 1321 | + } | |
| 1322 | + | |
| 1323 | + mutex_lock(&pmc->powergates_lock); | |
| 1324 | + err = dev_pm_opp_set_opp(pmc->dev, opp); | |
| 1325 | + mutex_unlock(&pmc->powergates_lock); | |
| 1326 | + | |
| 1327 | + dev_pm_opp_put(opp); | |
| 1328 | + | |
| 1329 | + if (err) { | |
| 1330 | + dev_err(&genpd->dev, "failed to set voltage to %duV: %d\n", | |
| 1331 | + level, err); | |
| 1332 | + return err; | |
| 1333 | + } | |
| 1334 | + | |
| 1335 | + return 0; | |
| 1336 | +} | |
| 1337 | + | |
| 1338 | +static unsigned int | |
| 1339 | +tegra_pmc_core_pd_opp_to_performance_state(struct generic_pm_domain *genpd, | |
| 1340 | + struct dev_pm_opp *opp) | |
| 1341 | +{ | |
| 1342 | + return dev_pm_opp_get_level(opp); | |
| 1343 | +} | |
| 1344 | + | |
| 1345 | +static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np) | |
| 1346 | +{ | |
| 1347 | + struct generic_pm_domain *genpd; | |
| 1348 | + const char *rname = "core"; | |
| 1349 | + int err; | |
| 1350 | + | |
| 1351 | + genpd = devm_kzalloc(pmc->dev, sizeof(*genpd), GFP_KERNEL); | |
| 1352 | + if (!genpd) | |
| 1353 | + return -ENOMEM; | |
| 1354 | + | |
| 1355 | + genpd->name = np->name; | |
| 1356 | + genpd->set_performance_state = tegra_pmc_core_pd_set_performance_state; | |
| 1357 | + genpd->opp_to_performance_state = tegra_pmc_core_pd_opp_to_performance_state; | |
| 1358 | + | |
| 1359 | + err = devm_pm_opp_set_regulators(pmc->dev, &rname, 1); | |
| 1360 | + if (err) | |
| 1361 | + return dev_err_probe(pmc->dev, err, | |
| 1362 | + "failed to set core OPP regulator\n"); | |
| 1363 | + | |
| 1364 | + err = pm_genpd_init(genpd, NULL, false); | |
| 1365 | + if (err) { | |
| 1366 | + dev_err(pmc->dev, "failed to init core genpd: %d\n", err); | |
| 1367 | + return err; | |
| 1368 | + } | |
| 1369 | + | |
| 1370 | + err = of_genpd_add_provider_simple(np, genpd); | |
| 1371 | + if (err) { | |
| 1372 | + dev_err(pmc->dev, "failed to add core genpd: %d\n", err); | |
| 1373 | + goto remove_genpd; | |
| 1374 | + } | |
| 1375 | + | |
| 1376 | + pmc->core_domain_registered = true; | |
| 1377 | + | |
| 1378 | + return 0; | |
| 1379 | + | |
| 1380 | +remove_genpd: | |
| 1381 | + pm_genpd_remove(genpd); | |
| 1382 | + | |
| 1383 | + return err; | |
| 1384 | +} | |
| 1385 | + | |
| 1300 | 1386 | static int tegra_powergate_init(struct tegra_pmc *pmc, |
| 1301 | 1387 | struct device_node *parent) |
| 1302 | 1388 | { |
| 1389 | + struct of_phandle_args child_args, parent_args; | |
| 1303 | 1390 | struct device_node *np, *child; |
| 1304 | 1391 | int err = 0; |
| 1305 | 1392 | |
| 1393 | + /* | |
| 1394 | + * Core power domain is the parent of powergate domains, hence it | |
| 1395 | + * should be registered first. | |
| 1396 | + */ | |
| 1397 | + np = of_get_child_by_name(parent, "core-domain"); | |
| 1398 | + if (np) { | |
| 1399 | + err = tegra_pmc_core_pd_add(pmc, np); | |
| 1400 | + of_node_put(np); | |
| 1401 | + if (err) | |
| 1402 | + return err; | |
| 1403 | + } | |
| 1404 | + | |
| 1306 | 1405 | np = of_get_child_by_name(parent, "powergates"); |
| 1307 | 1406 | if (!np) |
| 1308 | 1407 | return 0; |
| @@ -1313,6 +1412,21 @@ static int tegra_powergate_init(struct tegra_pmc *pmc, · 4 unmodified lines | ||
| 1313 | 1412 | of_node_put(child); |
| 1314 | 1413 | break; |
| 1315 | 1414 | } |
| 1415 | + | |
| 1416 | + if (of_parse_phandle_with_args(child, "power-domains", | |
| 1417 | + "#power-domain-cells", | |
| 1418 | + 0, &parent_args)) | |
| 1419 | + continue; | |
| 1420 | + | |
| 1421 | + child_args.np = child; | |
| 1422 | + child_args.args_count = 0; | |
| 1423 | + | |
| 1424 | + err = of_genpd_add_subdomain(&parent_args, &child_args); | |
| 1425 | + of_node_put(parent_args.np); | |
| 1426 | + if (err) { | |
| 1427 | + of_node_put(child); | |
| 1428 | + break; | |
| 1429 | + } | |
| 1316 | 1430 | } |
| 1317 | 1431 | |
| 1318 | 1432 | of_node_put(np); |
| @@ -1356,6 +1470,12 @@ static void tegra_powergate_remove_all(struct device_node *parent) · 37 unmodified lines | ||
| 1356 | 1470 | } |
| 1357 | 1471 | |
| 1358 | 1472 | of_node_put(np); |
| 1473 | + | |
| 1474 | + np = of_get_child_by_name(parent, "core-domain"); | |
| 1475 | + if (np) { | |
| 1476 | + of_genpd_del_provider(np); | |
| 1477 | + of_genpd_remove_last(np); | |
| 1478 | + } | |
| 1359 | 1479 | } |
| 1360 | 1480 | |
| 1361 | 1481 | static const struct tegra_io_pad_soc * |
| @@ -3667,6 +3787,29 @@ static const struct of_device_id tegra_pmc_match[] = { · 2305 unmodified lines | ||
| 3667 | 3787 | { } |
| 3668 | 3788 | }; |
| 3669 | 3789 | |
| 3790 | +static void tegra_pmc_sync_state(struct device *dev) | |
| 3791 | +{ | |
| 3792 | + int err; | |
| 3793 | + | |
| 3794 | + /* | |
| 3795 | + * Older device-trees don't have core PD, and thus, there are | |
| 3796 | + * no dependencies that will block the state syncing. We shouldn't | |
| 3797 | + * mark the domain as synced in this case. | |
| 3798 | + */ | |
| 3799 | + if (!pmc->core_domain_registered) | |
| 3800 | + return; | |
| 3801 | + | |
| 3802 | + pmc->core_domain_state_synced = true; | |
| 3803 | + | |
| 3804 | + /* this is a no-op if core regulator isn't used */ | |
| 3805 | + mutex_lock(&pmc->powergates_lock); | |
| 3806 | + err = dev_pm_opp_sync_regulators(dev); | |
| 3807 | + mutex_unlock(&pmc->powergates_lock); | |
| 3808 | + | |
| 3809 | + if (err) | |
| 3810 | + dev_err(dev, "failed to sync regulators: %d\n", err); | |
| 3811 | +} | |
| 3812 | + | |
| 3670 | 3813 | static struct platform_driver tegra_pmc_driver = { |
| 3671 | 3814 | .driver = { |
| 3672 | 3815 | .name = "tegra-pmc", |
| @@ -3675,6 +3818,7 @@ static struct platform_driver tegra_pmc_driver = { · 2 unmodified lines | ||
| 3675 | 3818 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_ARM) |
| 3676 | 3819 | .pm = &tegra_pmc_pm_ops, |
| 3677 | 3820 | #endif |
| 3821 | + .sync_state = tegra_pmc_sync_state, | |
| 3678 | 3822 | }, |
| 3679 | 3823 | .probe = tegra_pmc_probe, |
| 3680 | 3824 | }; |
| @@ -12,16 +12,22 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/init.h> |
| 13 | 13 | #include <linux/kernel.h> |
| 14 | 14 | #include <linux/of.h> |
| 15 | +#include <linux/reboot.h> | |
| 15 | 16 | #include <linux/regulator/coupler.h> |
| 16 | 17 | #include <linux/regulator/driver.h> |
| 17 | 18 | #include <linux/regulator/machine.h> |
| 18 | 19 | |
| 20 | +#include <soc/tegra/pmc.h> | |
| 21 | + | |
| 19 | 22 | struct tegra_regulator_coupler { |
| 20 | 23 | struct regulator_coupler coupler; |
| 21 | 24 | struct regulator_dev *core_rdev; |
| 22 | 25 | struct regulator_dev *cpu_rdev; |
| 23 | 26 | struct regulator_dev *rtc_rdev; |
| 24 | − int core_min_uV; | |
| 27 | + struct notifier_block reboot_notifier; | |
| 28 | + int core_min_uV, cpu_min_uV; | |
| 29 | + bool sys_reboot_mode_req; | |
| 30 | + bool sys_reboot_mode; | |
| 25 | 31 | }; |
| 26 | 32 | |
| 27 | 33 | static inline struct tegra_regulator_coupler * |
| @@ -38,6 +44,21 @@ static int tegra20_core_limit(struct tegra_regulator_coupler *tegra, · 10 unmodified lines | ||
| 38 | 44 | int core_cur_uV; |
| 39 | 45 | int err; |
| 40 | 46 | |
| 47 | + /* | |
| 48 | + * Tegra20 SoC has critical DVFS-capable devices that are | |
| 49 | + * permanently-active or active at a boot time, like EMC | |
| 50 | + * (DRAM controller) or Display controller for example. | |
| 51 | + * | |
| 52 | + * The voltage of a CORE SoC power domain shall not be dropped below | |
| 53 | + * a minimum level, which is determined by device's clock rate. | |
| 54 | + * This means that we can't fully allow CORE voltage scaling until | |
| 55 | + * the state of all DVFS-critical CORE devices is synced. | |
| 56 | + */ | |
| 57 | + if (tegra_pmc_core_domain_state_synced() && !tegra->sys_reboot_mode) { | |
| 58 | + pr_info_once("voltage state synced\n"); | |
| 59 | + return 0; | |
| 60 | + } | |
| 61 | + | |
| 41 | 62 | if (tegra->core_min_uV > 0) |
| 42 | 63 | return tegra->core_min_uV; |
| 43 | 64 | |
| @@ -58,7 +79,7 @@ static int tegra20_core_limit(struct tegra_regulator_coupler *tegra, · 14 unmodified lines | ||
| 58 | 79 | */ |
| 59 | 80 | tegra->core_min_uV = core_max_uV; |
| 60 | 81 | |
| 61 | − pr_info("core minimum voltage limited to %duV\n", tegra->core_min_uV); | |
| 82 | + pr_info("core voltage initialized to %duV\n", tegra->core_min_uV); | |
| 62 | 83 | |
| 63 | 84 | return tegra->core_min_uV; |
| 64 | 85 | } |
| @@ -242,6 +263,10 @@ static int tegra20_cpu_voltage_update(struct tegra_regulator_coupler *tegra, · 177 unmodified lines | ||
| 242 | 263 | if (cpu_uV < 0) |
| 243 | 264 | return cpu_uV; |
| 244 | 265 | |
| 266 | + /* store boot voltage level */ | |
| 267 | + if (!tegra->cpu_min_uV) | |
| 268 | + tegra->cpu_min_uV = cpu_uV; | |
| 269 | + | |
| 245 | 270 | /* |
| 246 | 271 | * CPU's regulator may not have any consumers, hence the voltage |
| 247 | 272 | * must not be changed in that case because CPU simply won't |
| @@ -250,6 +275,10 @@ static int tegra20_cpu_voltage_update(struct tegra_regulator_coupler *tegra, · 2 unmodified lines | ||
| 250 | 275 | if (!cpu_min_uV_consumers) |
| 251 | 276 | cpu_min_uV = cpu_uV; |
| 252 | 277 | |
| 278 | + /* restore boot voltage level */ | |
| 279 | + if (tegra->sys_reboot_mode) | |
| 280 | + cpu_min_uV = max(cpu_min_uV, tegra->cpu_min_uV); | |
| 281 | + | |
| 253 | 282 | if (cpu_min_uV > cpu_uV) { |
| 254 | 283 | err = tegra20_core_rtc_update(tegra, core_rdev, rtc_rdev, |
| 255 | 284 | cpu_uV, cpu_min_uV); |
| @@ -290,6 +319,8 @@ static int tegra20_regulator_balance_voltage(struct regulator_coupler *coupler, · 34 unmodified lines | ||
| 290 | 319 | return -EINVAL; |
| 291 | 320 | } |
| 292 | 321 | |
| 322 | + tegra->sys_reboot_mode = READ_ONCE(tegra->sys_reboot_mode_req); | |
| 323 | + | |
| 293 | 324 | if (rdev == cpu_rdev) |
| 294 | 325 | return tegra20_cpu_voltage_update(tegra, cpu_rdev, |
| 295 | 326 | core_rdev, rtc_rdev); |
| @@ -303,6 +334,51 @@ static int tegra20_regulator_balance_voltage(struct regulator_coupler *coupler, · 7 unmodified lines | ||
| 303 | 334 | return -EPERM; |
| 304 | 335 | } |
| 305 | 336 | |
| 337 | +static int tegra20_regulator_prepare_reboot(struct tegra_regulator_coupler *tegra, | |
| 338 | + bool sys_reboot_mode) | |
| 339 | +{ | |
| 340 | + int err; | |
| 341 | + | |
| 342 | + if (!tegra->core_rdev || !tegra->rtc_rdev || !tegra->cpu_rdev) | |
| 343 | + return 0; | |
| 344 | + | |
| 345 | + WRITE_ONCE(tegra->sys_reboot_mode_req, true); | |
| 346 | + | |
| 347 | + /* | |
| 348 | + * Some devices use CPU soft-reboot method and in this case we | |
| 349 | + * should ensure that voltages are sane for the reboot by restoring | |
| 350 | + * the minimum boot levels. | |
| 351 | + */ | |
| 352 | + err = regulator_sync_voltage_rdev(tegra->cpu_rdev); | |
| 353 | + if (err) | |
| 354 | + return err; | |
| 355 | + | |
| 356 | + err = regulator_sync_voltage_rdev(tegra->core_rdev); | |
| 357 | + if (err) | |
| 358 | + return err; | |
| 359 | + | |
| 360 | + WRITE_ONCE(tegra->sys_reboot_mode_req, sys_reboot_mode); | |
| 361 | + | |
| 362 | + return 0; | |
| 363 | +} | |
| 364 | + | |
| 365 | +static int tegra20_regulator_reboot(struct notifier_block *notifier, | |
| 366 | + unsigned long event, void *cmd) | |
| 367 | +{ | |
| 368 | + struct tegra_regulator_coupler *tegra; | |
| 369 | + int ret; | |
| 370 | + | |
| 371 | + if (event != SYS_RESTART) | |
| 372 | + return NOTIFY_DONE; | |
| 373 | + | |
| 374 | + tegra = container_of(notifier, struct tegra_regulator_coupler, | |
| 375 | + reboot_notifier); | |
| 376 | + | |
| 377 | + ret = tegra20_regulator_prepare_reboot(tegra, true); | |
| 378 | + | |
| 379 | + return notifier_from_errno(ret); | |
| 380 | +} | |
| 381 | + | |
| 306 | 382 | static int tegra20_regulator_attach(struct regulator_coupler *coupler, |
| 307 | 383 | struct regulator_dev *rdev) |
| 308 | 384 | { |
| @@ -335,6 +411,14 @@ static int tegra20_regulator_detach(struct regulator_coupler *coupler, · 26 unmodified lines | ||
| 335 | 411 | { |
| 336 | 412 | struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler); |
| 337 | 413 | |
| 414 | + /* | |
| 415 | + * We don't expect regulators to be decoupled during reboot, | |
| 416 | + * this may race with the reboot handler and shouldn't ever | |
| 417 | + * happen in practice. | |
| 418 | + */ | |
| 419 | + if (WARN_ON_ONCE(system_state > SYSTEM_RUNNING)) | |
| 420 | + return -EPERM; | |
| 421 | + | |
| 338 | 422 | if (tegra->core_rdev == rdev) { |
| 339 | 423 | tegra->core_rdev = NULL; |
| 340 | 424 | return 0; |
| @@ -359,13 +443,19 @@ static struct tegra_regulator_coupler tegra20_coupler = { · 18 unmodified lines | ||
| 359 | 443 | .detach_regulator = tegra20_regulator_detach, |
| 360 | 444 | .balance_voltage = tegra20_regulator_balance_voltage, |
| 361 | 445 | }, |
| 446 | + .reboot_notifier.notifier_call = tegra20_regulator_reboot, | |
| 362 | 447 | }; |
| 363 | 448 | |
| 364 | 449 | static int __init tegra_regulator_coupler_init(void) |
| 365 | 450 | { |
| 451 | + int err; | |
| 452 | + | |
| 366 | 453 | if (!of_machine_is_compatible("nvidia,tegra20")) |
| 367 | 454 | return 0; |
| 368 | 455 | |
| 456 | + err = register_reboot_notifier(&tegra20_coupler.reboot_notifier); | |
| 457 | + WARN_ON(err); | |
| 458 | + | |
| 369 | 459 | return regulator_coupler_register(&tegra20_coupler.coupler); |
| 370 | 460 | } |
| 371 | 461 | arch_initcall(tegra_regulator_coupler_init); |
| @@ -12,17 +12,22 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/init.h> |
| 13 | 13 | #include <linux/kernel.h> |
| 14 | 14 | #include <linux/of.h> |
| 15 | +#include <linux/reboot.h> | |
| 15 | 16 | #include <linux/regulator/coupler.h> |
| 16 | 17 | #include <linux/regulator/driver.h> |
| 17 | 18 | #include <linux/regulator/machine.h> |
| 18 | 19 | |
| 19 | 20 | #include <soc/tegra/fuse.h> |
| 21 | +#include <soc/tegra/pmc.h> | |
| 20 | 22 | |
| 21 | 23 | struct tegra_regulator_coupler { |
| 22 | 24 | struct regulator_coupler coupler; |
| 23 | 25 | struct regulator_dev *core_rdev; |
| 24 | 26 | struct regulator_dev *cpu_rdev; |
| 25 | − int core_min_uV; | |
| 27 | + struct notifier_block reboot_notifier; | |
| 28 | + int core_min_uV, cpu_min_uV; | |
| 29 | + bool sys_reboot_mode_req; | |
| 30 | + bool sys_reboot_mode; | |
| 26 | 31 | }; |
| 27 | 32 | |
| 28 | 33 | static inline struct tegra_regulator_coupler * |
| @@ -39,6 +44,21 @@ static int tegra30_core_limit(struct tegra_regulator_coupler *tegra, · 10 unmodified lines | ||
| 39 | 44 | int core_cur_uV; |
| 40 | 45 | int err; |
| 41 | 46 | |
| 47 | + /* | |
| 48 | + * Tegra30 SoC has critical DVFS-capable devices that are | |
| 49 | + * permanently-active or active at a boot time, like EMC | |
| 50 | + * (DRAM controller) or Display controller for example. | |
| 51 | + * | |
| 52 | + * The voltage of a CORE SoC power domain shall not be dropped below | |
| 53 | + * a minimum level, which is determined by device's clock rate. | |
| 54 | + * This means that we can't fully allow CORE voltage scaling until | |
| 55 | + * the state of all DVFS-critical CORE devices is synced. | |
| 56 | + */ | |
| 57 | + if (tegra_pmc_core_domain_state_synced() && !tegra->sys_reboot_mode) { | |
| 58 | + pr_info_once("voltage state synced\n"); | |
| 59 | + return 0; | |
| 60 | + } | |
| 61 | + | |
| 42 | 62 | if (tegra->core_min_uV > 0) |
| 43 | 63 | return tegra->core_min_uV; |
| 44 | 64 | |
| @@ -59,7 +79,7 @@ static int tegra30_core_limit(struct tegra_regulator_coupler *tegra, · 14 unmodified lines | ||
| 59 | 79 | */ |
| 60 | 80 | tegra->core_min_uV = core_max_uV; |
| 61 | 81 | |
| 62 | − pr_info("core minimum voltage limited to %duV\n", tegra->core_min_uV); | |
| 82 | + pr_info("core voltage initialized to %duV\n", tegra->core_min_uV); | |
| 63 | 83 | |
| 64 | 84 | return tegra->core_min_uV; |
| 65 | 85 | } |
| @@ -172,6 +192,10 @@ static int tegra30_voltage_update(struct tegra_regulator_coupler *tegra, · 106 unmodified lines | ||
| 172 | 192 | if (cpu_uV < 0) |
| 173 | 193 | return cpu_uV; |
| 174 | 194 | |
| 195 | + /* store boot voltage level */ | |
| 196 | + if (!tegra->cpu_min_uV) | |
| 197 | + tegra->cpu_min_uV = cpu_uV; | |
| 198 | + | |
| 175 | 199 | /* |
| 176 | 200 | * CPU's regulator may not have any consumers, hence the voltage |
| 177 | 201 | * must not be changed in that case because CPU simply won't |
| @@ -195,6 +219,10 @@ static int tegra30_voltage_update(struct tegra_regulator_coupler *tegra, · 17 unmodified lines | ||
| 195 | 219 | if (err) |
| 196 | 220 | return err; |
| 197 | 221 | |
| 222 | + /* restore boot voltage level */ | |
| 223 | + if (tegra->sys_reboot_mode) | |
| 224 | + cpu_min_uV = max(cpu_min_uV, tegra->cpu_min_uV); | |
| 225 | + | |
| 198 | 226 | if (core_min_limited_uV > core_uV) { |
| 199 | 227 | pr_err("core voltage constraint violated: %d %d %d\n", |
| 200 | 228 | core_uV, core_min_limited_uV, cpu_uV); |
| @@ -263,9 +291,56 @@ static int tegra30_regulator_balance_voltage(struct regulator_coupler *coupler, · 62 unmodified lines | ||
| 263 | 291 | return -EINVAL; |
| 264 | 292 | } |
| 265 | 293 | |
| 294 | + tegra->sys_reboot_mode = READ_ONCE(tegra->sys_reboot_mode_req); | |
| 295 | + | |
| 266 | 296 | return tegra30_voltage_update(tegra, cpu_rdev, core_rdev); |
| 267 | 297 | } |
| 268 | 298 | |
| 299 | +static int tegra30_regulator_prepare_reboot(struct tegra_regulator_coupler *tegra, | |
| 300 | + bool sys_reboot_mode) | |
| 301 | +{ | |
| 302 | + int err; | |
| 303 | + | |
| 304 | + if (!tegra->core_rdev || !tegra->cpu_rdev) | |
| 305 | + return 0; | |
| 306 | + | |
| 307 | + WRITE_ONCE(tegra->sys_reboot_mode_req, true); | |
| 308 | + | |
| 309 | + /* | |
| 310 | + * Some devices use CPU soft-reboot method and in this case we | |
| 311 | + * should ensure that voltages are sane for the reboot by restoring | |
| 312 | + * the minimum boot levels. | |
| 313 | + */ | |
| 314 | + err = regulator_sync_voltage_rdev(tegra->cpu_rdev); | |
| 315 | + if (err) | |
| 316 | + return err; | |
| 317 | + | |
| 318 | + err = regulator_sync_voltage_rdev(tegra->core_rdev); | |
| 319 | + if (err) | |
| 320 | + return err; | |
| 321 | + | |
| 322 | + WRITE_ONCE(tegra->sys_reboot_mode_req, sys_reboot_mode); | |
| 323 | + | |
| 324 | + return 0; | |
| 325 | +} | |
| 326 | + | |
| 327 | +static int tegra30_regulator_reboot(struct notifier_block *notifier, | |
| 328 | + unsigned long event, void *cmd) | |
| 329 | +{ | |
| 330 | + struct tegra_regulator_coupler *tegra; | |
| 331 | + int ret; | |
| 332 | + | |
| 333 | + if (event != SYS_RESTART) | |
| 334 | + return NOTIFY_DONE; | |
| 335 | + | |
| 336 | + tegra = container_of(notifier, struct tegra_regulator_coupler, | |
| 337 | + reboot_notifier); | |
| 338 | + | |
| 339 | + ret = tegra30_regulator_prepare_reboot(tegra, true); | |
| 340 | + | |
| 341 | + return notifier_from_errno(ret); | |
| 342 | +} | |
| 343 | + | |
| 269 | 344 | static int tegra30_regulator_attach(struct regulator_coupler *coupler, |
| 270 | 345 | struct regulator_dev *rdev) |
| 271 | 346 | { |
| @@ -292,6 +367,14 @@ static int tegra30_regulator_detach(struct regulator_coupler *coupler, · 20 unmodified lines | ||
| 292 | 367 | { |
| 293 | 368 | struct tegra_regulator_coupler *tegra = to_tegra_coupler(coupler); |
| 294 | 369 | |
| 370 | + /* | |
| 371 | + * We don't expect regulators to be decoupled during reboot, | |
| 372 | + * this may race with the reboot handler and shouldn't ever | |
| 373 | + * happen in practice. | |
| 374 | + */ | |
| 375 | + if (WARN_ON_ONCE(system_state > SYSTEM_RUNNING)) | |
| 376 | + return -EPERM; | |
| 377 | + | |
| 295 | 378 | if (tegra->core_rdev == rdev) { |
| 296 | 379 | tegra->core_rdev = NULL; |
| 297 | 380 | return 0; |
| @@ -311,13 +394,19 @@ static struct tegra_regulator_coupler tegra30_coupler = { · 13 unmodified lines | ||
| 311 | 394 | .detach_regulator = tegra30_regulator_detach, |
| 312 | 395 | .balance_voltage = tegra30_regulator_balance_voltage, |
| 313 | 396 | }, |
| 397 | + .reboot_notifier.notifier_call = tegra30_regulator_reboot, | |
| 314 | 398 | }; |
| 315 | 399 | |
| 316 | 400 | static int __init tegra_regulator_coupler_init(void) |
| 317 | 401 | { |
| 402 | + int err; | |
| 403 | + | |
| 318 | 404 | if (!of_machine_is_compatible("nvidia,tegra30")) |
| 319 | 405 | return 0; |
| 320 | 406 | |
| 407 | + err = register_reboot_notifier(&tegra30_coupler.reboot_notifier); | |
| 408 | + WARN_ON(err); | |
| 409 | + | |
| 321 | 410 | return regulator_coupler_register(&tegra30_coupler.coupler); |
| 322 | 411 | } |
| 323 | 412 | arch_initcall(tegra_regulator_coupler_init); |
| @@ -0,0 +1,21 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __PLATFORM_DATA_PATA_IXP4XX_H | |
| 3 | +#define __PLATFORM_DATA_PATA_IXP4XX_H | |
| 4 | + | |
| 5 | +#include <linux/types.h> | |
| 6 | + | |
| 7 | +/* | |
| 8 | + * This structure provide a means for the board setup code | |
| 9 | + * to give information to th pata_ixp4xx driver. It is | |
| 10 | + * passed as platform_data. | |
| 11 | + */ | |
| 12 | +struct ixp4xx_pata_data { | |
| 13 | + volatile u32 *cs0_cfg; | |
| 14 | + volatile u32 *cs1_cfg; | |
| 15 | + unsigned long cs0_bits; | |
| 16 | + unsigned long cs1_bits; | |
| 17 | + void __iomem *cs0; | |
| 18 | + void __iomem *cs1; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +#endif | |
| @@ -0,0 +1,106 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | +/* | |
| 3 | + * IXP4XX cpu type detection | |
| 4 | + * | |
| 5 | + * Copyright (C) 2007 MontaVista Software, Inc. | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __SOC_IXP4XX_CPU_H__ | |
| 9 | +#define __SOC_IXP4XX_CPU_H__ | |
| 10 | + | |
| 11 | +#include <linux/io.h> | |
| 12 | +#ifdef CONFIG_ARM | |
| 13 | +#include <asm/cputype.h> | |
| 14 | +#endif | |
| 15 | + | |
| 16 | +/* Processor id value in CP15 Register 0 */ | |
| 17 | +#define IXP42X_PROCESSOR_ID_VALUE 0x690541c0 /* including unused 0x690541Ex */ | |
| 18 | +#define IXP42X_PROCESSOR_ID_MASK 0xffffffc0 | |
| 19 | + | |
| 20 | +#define IXP43X_PROCESSOR_ID_VALUE 0x69054040 | |
| 21 | +#define IXP43X_PROCESSOR_ID_MASK 0xfffffff0 | |
| 22 | + | |
| 23 | +#define IXP46X_PROCESSOR_ID_VALUE 0x69054200 /* including IXP455 */ | |
| 24 | +#define IXP46X_PROCESSOR_ID_MASK 0xfffffff0 | |
| 25 | + | |
| 26 | +/* "fuse" bits of IXP_EXP_CFG2 */ | |
| 27 | +/* All IXP4xx CPUs */ | |
| 28 | +#define IXP4XX_FEATURE_RCOMP (1 << 0) | |
| 29 | +#define IXP4XX_FEATURE_USB_DEVICE (1 << 1) | |
| 30 | +#define IXP4XX_FEATURE_HASH (1 << 2) | |
| 31 | +#define IXP4XX_FEATURE_AES (1 << 3) | |
| 32 | +#define IXP4XX_FEATURE_DES (1 << 4) | |
| 33 | +#define IXP4XX_FEATURE_HDLC (1 << 5) | |
| 34 | +#define IXP4XX_FEATURE_AAL (1 << 6) | |
| 35 | +#define IXP4XX_FEATURE_HSS (1 << 7) | |
| 36 | +#define IXP4XX_FEATURE_UTOPIA (1 << 8) | |
| 37 | +#define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9) | |
| 38 | +#define IXP4XX_FEATURE_NPEC_ETH (1 << 10) | |
| 39 | +#define IXP4XX_FEATURE_RESET_NPEA (1 << 11) | |
| 40 | +#define IXP4XX_FEATURE_RESET_NPEB (1 << 12) | |
| 41 | +#define IXP4XX_FEATURE_RESET_NPEC (1 << 13) | |
| 42 | +#define IXP4XX_FEATURE_PCI (1 << 14) | |
| 43 | +#define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16) | |
| 44 | +#define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22) | |
| 45 | +#define IXP42X_FEATURE_MASK (IXP4XX_FEATURE_RCOMP | \ | |
| 46 | + IXP4XX_FEATURE_USB_DEVICE | \ | |
| 47 | + IXP4XX_FEATURE_HASH | \ | |
| 48 | + IXP4XX_FEATURE_AES | \ | |
| 49 | + IXP4XX_FEATURE_DES | \ | |
| 50 | + IXP4XX_FEATURE_HDLC | \ | |
| 51 | + IXP4XX_FEATURE_AAL | \ | |
| 52 | + IXP4XX_FEATURE_HSS | \ | |
| 53 | + IXP4XX_FEATURE_UTOPIA | \ | |
| 54 | + IXP4XX_FEATURE_NPEB_ETH0 | \ | |
| 55 | + IXP4XX_FEATURE_NPEC_ETH | \ | |
| 56 | + IXP4XX_FEATURE_RESET_NPEA | \ | |
| 57 | + IXP4XX_FEATURE_RESET_NPEB | \ | |
| 58 | + IXP4XX_FEATURE_RESET_NPEC | \ | |
| 59 | + IXP4XX_FEATURE_PCI | \ | |
| 60 | + IXP4XX_FEATURE_UTOPIA_PHY_LIMIT | \ | |
| 61 | + IXP4XX_FEATURE_XSCALE_MAX_FREQ) | |
| 62 | + | |
| 63 | + | |
| 64 | +/* IXP43x/46x CPUs */ | |
| 65 | +#define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15) | |
| 66 | +#define IXP4XX_FEATURE_USB_HOST (1 << 18) | |
| 67 | +#define IXP4XX_FEATURE_NPEA_ETH (1 << 19) | |
| 68 | +#define IXP43X_FEATURE_MASK (IXP42X_FEATURE_MASK | \ | |
| 69 | + IXP4XX_FEATURE_ECC_TIMESYNC | \ | |
| 70 | + IXP4XX_FEATURE_USB_HOST | \ | |
| 71 | + IXP4XX_FEATURE_NPEA_ETH) | |
| 72 | + | |
| 73 | +/* IXP46x CPU (including IXP455) only */ | |
| 74 | +#define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20) | |
| 75 | +#define IXP4XX_FEATURE_RSA (1 << 21) | |
| 76 | +#define IXP46X_FEATURE_MASK (IXP43X_FEATURE_MASK | \ | |
| 77 | + IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \ | |
| 78 | + IXP4XX_FEATURE_RSA) | |
| 79 | + | |
| 80 | +#ifdef CONFIG_ARCH_IXP4XX | |
| 81 | +#define cpu_is_ixp42x_rev_a0() ((read_cpuid_id() & (IXP42X_PROCESSOR_ID_MASK | 0xF)) == \ | |
| 82 | + IXP42X_PROCESSOR_ID_VALUE) | |
| 83 | +#define cpu_is_ixp42x() ((read_cpuid_id() & IXP42X_PROCESSOR_ID_MASK) == \ | |
| 84 | + IXP42X_PROCESSOR_ID_VALUE) | |
| 85 | +#define cpu_is_ixp43x() ((read_cpuid_id() & IXP43X_PROCESSOR_ID_MASK) == \ | |
| 86 | + IXP43X_PROCESSOR_ID_VALUE) | |
| 87 | +#define cpu_is_ixp46x() ((read_cpuid_id() & IXP46X_PROCESSOR_ID_MASK) == \ | |
| 88 | + IXP46X_PROCESSOR_ID_VALUE) | |
| 89 | + | |
| 90 | +u32 ixp4xx_read_feature_bits(void); | |
| 91 | +void ixp4xx_write_feature_bits(u32 value); | |
| 92 | +#else | |
| 93 | +#define cpu_is_ixp42x_rev_a0() 0 | |
| 94 | +#define cpu_is_ixp42x() 0 | |
| 95 | +#define cpu_is_ixp43x() 0 | |
| 96 | +#define cpu_is_ixp46x() 0 | |
| 97 | +static inline u32 ixp4xx_read_feature_bits(void) | |
| 98 | +{ | |
| 99 | + return 0; | |
| 100 | +} | |
| 101 | +static inline void ixp4xx_write_feature_bits(u32 value) | |
| 102 | +{ | |
| 103 | +} | |
| 104 | +#endif | |
| 105 | + | |
| 106 | +#endif /* _ASM_ARCH_CPU_H */ | |
| @@ -611,12 +611,6 @@ · 610 unmodified lines | ||
| 611 | 611 | #define EXYNOS5420_FSYS2_OPTION 0x4168 |
| 612 | 612 | #define EXYNOS5420_PSGEN_OPTION 0x4188 |
| 613 | 613 | |
| 614 | −/* For EXYNOS_CENTRAL_SEQ_OPTION */ | |
| 615 | −#define EXYNOS5_USE_STANDBYWFI_ARM_CORE0 BIT(16) | |
| 616 | −#define EXYNOS5_USE_STANDBYWFI_ARM_CORE1 BUT(17) | |
| 617 | −#define EXYNOS5_USE_STANDBYWFE_ARM_CORE0 BIT(24) | |
| 618 | −#define EXYNOS5_USE_STANDBYWFE_ARM_CORE1 BIT(25) | |
| 619 | − | |
| 620 | 614 | #define EXYNOS5420_ARM_USE_STANDBY_WFI0 BIT(4) |
| 621 | 615 | #define EXYNOS5420_ARM_USE_STANDBY_WFI1 BIT(5) |
| 622 | 616 | #define EXYNOS5420_ARM_USE_STANDBY_WFI2 BIT(6) |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #define MXC_CPU_MX27 27 |
| 10 | 10 | #define MXC_CPU_MX31 31 |
| 11 | 11 | #define MXC_CPU_MX35 35 |
| 12 | +#define MXC_CPU_MX50 50 | |
| 12 | 13 | #define MXC_CPU_MX51 51 |
| 13 | 14 | #define MXC_CPU_MX53 53 |
| 14 | 15 | #define MXC_CPU_IMX6SL 0x60 |
| @@ -6,6 +6,37 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef __SOC_TEGRA_COMMON_H__ |
| 7 | 7 | #define __SOC_TEGRA_COMMON_H__ |
| 8 | 8 | |
| 9 | +#include <linux/errno.h> | |
| 10 | +#include <linux/types.h> | |
| 11 | + | |
| 12 | +struct device; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Tegra SoC core device OPP table configuration | |
| 16 | + * | |
| 17 | + * @init_state: pre-initialize OPP state of a device | |
| 18 | + */ | |
| 19 | +struct tegra_core_opp_params { | |
| 20 | + bool init_state; | |
| 21 | +}; | |
| 22 | + | |
| 23 | +#ifdef CONFIG_ARCH_TEGRA | |
| 9 | 24 | bool soc_is_tegra(void); |
| 10 | 25 | |
| 26 | +int devm_tegra_core_dev_init_opp_table(struct device *dev, | |
| 27 | + struct tegra_core_opp_params *params); | |
| 28 | +#else | |
| 29 | +static inline bool soc_is_tegra(void) | |
| 30 | +{ | |
| 31 | + return false; | |
| 32 | +} | |
| 33 | + | |
| 34 | +static inline int | |
| 35 | +devm_tegra_core_dev_init_opp_table(struct device *dev, | |
| 36 | + struct tegra_core_opp_params *params) | |
| 37 | +{ | |
| 38 | + return -ENODEV; | |
| 39 | +} | |
| 40 | +#endif | |
| 41 | + | |
| 11 | 42 | #endif /* __SOC_TEGRA_COMMON_H__ */ |
| @@ -52,14 +52,28 @@ struct tegra_sku_info { · 51 unmodified lines | ||
| 52 | 52 | enum tegra_revision revision; |
| 53 | 53 | }; |
| 54 | 54 | |
| 55 | +#ifdef CONFIG_ARCH_TEGRA | |
| 56 | +extern struct tegra_sku_info tegra_sku_info; | |
| 55 | 57 | u32 tegra_read_straps(void); |
| 56 | 58 | u32 tegra_read_ram_code(void); |
| 57 | 59 | int tegra_fuse_readl(unsigned long offset, u32 *value); |
| 58 | − | |
| 59 | −#ifdef CONFIG_ARCH_TEGRA | |
| 60 | −extern struct tegra_sku_info tegra_sku_info; | |
| 61 | 60 | #else |
| 62 | 61 | static struct tegra_sku_info tegra_sku_info __maybe_unused; |
| 62 | + | |
| 63 | +static inline u32 tegra_read_straps(void) | |
| 64 | +{ | |
| 65 | + return 0; | |
| 66 | +} | |
| 67 | + | |
| 68 | +static inline u32 tegra_read_ram_code(void) | |
| 69 | +{ | |
| 70 | + return 0; | |
| 71 | +} | |
| 72 | + | |
| 73 | +static inline int tegra_fuse_readl(unsigned long offset, u32 *value) | |
| 74 | +{ | |
| 75 | + return -ENODEV; | |
| 76 | +} | |
| 63 | 77 | #endif |
| 64 | 78 | |
| 65 | 79 | struct device *tegra_soc_device_register(void); |
| @@ -171,6 +171,8 @@ int tegra_io_rail_power_off(unsigned int id); · 170 unmodified lines | ||
| 171 | 171 | void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); |
| 172 | 172 | void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); |
| 173 | 173 | |
| 174 | +bool tegra_pmc_core_domain_state_synced(void); | |
| 175 | + | |
| 174 | 176 | #else |
| 175 | 177 | static inline int tegra_powergate_power_on(unsigned int id) |
| 176 | 178 | { |
| @@ -227,6 +229,11 @@ static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode) · 50 unmodified lines | ||
| 227 | 229 | { |
| 228 | 230 | } |
| 229 | 231 | |
| 232 | +static inline bool tegra_pmc_core_domain_state_synced(void) | |
| 233 | +{ | |
| 234 | + return false; | |
| 235 | +} | |
| 236 | + | |
| 230 | 237 | #endif /* CONFIG_SOC_TEGRA_PMC */ |
| 231 | 238 | |
| 232 | 239 | #if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP) |