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

Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM driver updates from Olof Johansson:
"Updates of SoC-near drivers and other driver updates that makes more
sense to take through our tree.

The largest part of this is a conversion of device registration for
some renesas shmobile/sh devices over to use resources. This has
required coordination with the corresponding arch/sh changes, and
we've agreed to merge the arch/sh changes through our tree.

Added in this branch is support for Trusted Foundations secure
firmware, which is what is used on many of the commercial Nvidia Tegra
products that are in the market, including the Nvidia Shield. The
code is local to arch/arm at this time since it's uncertain whether it
will be shared with arm64 longer-term, if needed we will refactor
later.

A couple of new RTC drivers used on ARM boards, merged through our
tree on request by the RTC maintainer.

... plus a bunch of smaller updates across the board, gpio conversions
for davinci, etc"

* tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (45 commits)
watchdog: davinci: rename platform driver to davinci-wdt
tty: serial: Limit msm_serial_hs driver to platforms that use it
mmc: msm_sdcc: Limit driver to platforms that use it
usb: phy: msm: Move mach dependent code to platform data
clk: versatile: fixup IM-PD1 clock implementation
clk: versatile: pass a name to ICST clock provider
ARM: integrator: pass parent IRQ to the SIC
irqchip: versatile FPGA: support cascaded interrupts from DT
gpio: davinci: don't create irq_domain in case of unbanked irqs
gpio: davinci: use chained_irq_enter/chained_irq_exit API
gpio: davinci: add OF support
gpio: davinci: remove unused variable intc_irq_num
gpio: davinci: convert to use irqdomain support.
gpio: introduce GPIO_DAVINCI kconfig option
gpio: davinci: get rid of DAVINCI_N_GPIO
gpio: davinci: use {readl|writel}_relaxed() instead of __raw_*
serial: sh-sci: Add OF support
serial: sh-sci: Add device tree bindings documentation
serial: sh-sci: Remove platform data mapbase and irqs fields
serial: sh-sci: Remove platform data scbrr_algo_id field
...

+2904 -743
+20
Documentation/devicetree/bindings/arm/firmware/tlm,trusted-foundations.txt
··· 1 + Trusted Foundations 2 + ------------------- 3 + 4 + Boards that use the Trusted Foundations secure monitor can signal its 5 + presence by declaring a node compatible with "tlm,trusted-foundations" 6 + under the /firmware/ node 7 + 8 + Required properties: 9 + - compatible: "tlm,trusted-foundations" 10 + - tlm,version-major: major version number of Trusted Foundations firmware 11 + - tlm,version-minor: minor version number of Trusted Foundations firmware 12 + 13 + Example: 14 + firmware { 15 + trusted-foundations { 16 + compatible = "tlm,trusted-foundations"; 17 + tlm,version-major = <2>; 18 + tlm,version-minor = <8>; 19 + }; 20 + };
+5
Documentation/devicetree/bindings/arm/tegra.txt
··· 32 32 nvidia,whistler 33 33 toradex,colibri_t20-512 34 34 toradex,iris 35 + 36 + Trusted Foundations 37 + ------------------------------------------- 38 + Tegra supports the Trusted Foundation secure monitor. See the 39 + "tlm,trusted-foundations" binding's documentation for more details.
+5
Documentation/devicetree/bindings/arm/versatile-fpga-irq.txt
··· 29 29 clear-mask = <0xffffffff>; 30 30 valid-mask = <0x003fffff>; 31 31 }; 32 + 33 + Optional properties: 34 + - interrupts: if the FPGA IRQ controller is cascaded, i.e. if its IRQ 35 + output is simply connected to the input of another IRQ controller, 36 + then the parent IRQ shall be specified in this property.
+68
Documentation/devicetree/bindings/crypto/atmel-crypto.txt
··· 1 + * Atmel HW cryptographic accelerators 2 + 3 + These are the HW cryptographic accelerators found on some Atmel products. 4 + 5 + * Advanced Encryption Standard (AES) 6 + 7 + Required properties: 8 + - compatible : Should be "atmel,at91sam9g46-aes". 9 + - reg: Should contain AES registers location and length. 10 + - interrupts: Should contain the IRQ line for the AES. 11 + - dmas: List of two DMA specifiers as described in 12 + atmel-dma.txt and dma.txt files. 13 + - dma-names: Contains one identifier string for each DMA specifier 14 + in the dmas property. 15 + 16 + Example: 17 + aes@f8038000 { 18 + compatible = "atmel,at91sam9g46-aes"; 19 + reg = <0xf8038000 0x100>; 20 + interrupts = <43 4 0>; 21 + dmas = <&dma1 2 18>, 22 + <&dma1 2 19>; 23 + dma-names = "tx", "rx"; 24 + 25 + * Triple Data Encryption Standard (Triple DES) 26 + 27 + Required properties: 28 + - compatible : Should be "atmel,at91sam9g46-tdes". 29 + - reg: Should contain TDES registers location and length. 30 + - interrupts: Should contain the IRQ line for the TDES. 31 + 32 + Optional properties: 33 + - dmas: List of two DMA specifiers as described in 34 + atmel-dma.txt and dma.txt files. 35 + - dma-names: Contains one identifier string for each DMA specifier 36 + in the dmas property. 37 + 38 + Example: 39 + tdes@f803c000 { 40 + compatible = "atmel,at91sam9g46-tdes"; 41 + reg = <0xf803c000 0x100>; 42 + interrupts = <44 4 0>; 43 + dmas = <&dma1 2 20>, 44 + <&dma1 2 21>; 45 + dma-names = "tx", "rx"; 46 + }; 47 + 48 + * Secure Hash Algorithm (SHA) 49 + 50 + Required properties: 51 + - compatible : Should be "atmel,at91sam9g46-sha". 52 + - reg: Should contain SHA registers location and length. 53 + - interrupts: Should contain the IRQ line for the SHA. 54 + 55 + Optional properties: 56 + - dmas: One DMA specifiers as described in 57 + atmel-dma.txt and dma.txt files. 58 + - dma-names: Contains one identifier string for each DMA specifier 59 + in the dmas property. Only one "tx" string needed. 60 + 61 + Example: 62 + sha@f8034000 { 63 + compatible = "atmel,at91sam9g46-sha"; 64 + reg = <0xf8034000 0x100>; 65 + interrupts = <42 4 0>; 66 + dmas = <&dma1 2 17>; 67 + dma-names = "tx"; 68 + };
+41
Documentation/devicetree/bindings/gpio/gpio-davinci.txt
··· 1 + Davinci GPIO controller bindings 2 + 3 + Required Properties: 4 + - compatible: should be "ti,dm6441-gpio" 5 + 6 + - reg: Physical base address of the controller and the size of memory mapped 7 + registers. 8 + 9 + - gpio-controller : Marks the device node as a gpio controller. 10 + 11 + - interrupt-parent: phandle of the parent interrupt controller. 12 + 13 + - interrupts: Array of GPIO interrupt number. Only banked or unbanked IRQs are 14 + supported at a time. 15 + 16 + - ti,ngpio: The number of GPIO pins supported. 17 + 18 + - ti,davinci-gpio-unbanked: The number of GPIOs that have an individual interrupt 19 + line to processor. 20 + 21 + The GPIO controller also acts as an interrupt controller. It uses the default 22 + two cells specifier as described in Documentation/devicetree/bindings/ 23 + interrupt-controller/interrupts.txt. 24 + 25 + Example: 26 + 27 + gpio: gpio@1e26000 { 28 + compatible = "ti,dm6441-gpio"; 29 + gpio-controller; 30 + reg = <0x226000 0x1000>; 31 + interrupt-parent = <&intc>; 32 + interrupts = <42 IRQ_TYPE_EDGE_BOTH 43 IRQ_TYPE_EDGE_BOTH 33 + 44 IRQ_TYPE_EDGE_BOTH 45 IRQ_TYPE_EDGE_BOTH 34 + 46 IRQ_TYPE_EDGE_BOTH 47 IRQ_TYPE_EDGE_BOTH 35 + 48 IRQ_TYPE_EDGE_BOTH 49 IRQ_TYPE_EDGE_BOTH 36 + 50 IRQ_TYPE_EDGE_BOTH>; 37 + ti,ngpio = <144>; 38 + ti,davinci-gpio-unbanked = <0>; 39 + interrupt-controller; 40 + #interrupt-cells = <2>; 41 + };
+1
Documentation/devicetree/bindings/i2c/trivial-devices.txt
··· 40 40 gmt,g751 G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface 41 41 infineon,slb9635tt Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz) 42 42 infineon,slb9645tt Infineon SLB9645 I2C TPM (new protocol, max 400khz) 43 + isl,isl12057 Intersil ISL12057 I2C RTC Chip 43 44 maxim,ds1050 5 Bit Programmable, Pulse-Width Modulator 44 45 maxim,max1237 Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs 45 46 maxim,max6625 9-Bit/12-Bit Temperature Sensors with I²C-Compatible Serial Interface
+17
Documentation/devicetree/bindings/rtc/sunxi-rtc.txt
··· 1 + * sun4i/sun7i Real Time Clock 2 + 3 + RTC controller for the Allwinner A10/A20 4 + 5 + Required properties: 6 + - compatible : Should be "allwinner,sun4i-rtc" or "allwinner,sun7i-a20-rtc" 7 + - reg: physical base address of the controller and length of memory mapped 8 + region. 9 + - interrupts: IRQ line for the RTC. 10 + 11 + Example: 12 + 13 + rtc: rtc@01c20d00 { 14 + compatible = "allwinner,sun4i-rtc"; 15 + reg = <0x01c20d00 0x20>; 16 + interrupts = <24>; 17 + };
+46
Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
··· 1 + * Renesas SH-Mobile Serial Communication Interface 2 + 3 + Required properties: 4 + 5 + - compatible: Must contain one of the following: 6 + 7 + - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART. 8 + - "renesas,scifa-r8a7790" for R8A7790 (R-Car H2) SCIFA compatible UART. 9 + - "renesas,scifb-r8a7790" for R8A7790 (R-Car H2) SCIFB compatible UART. 10 + - "renesas,hscif-r8a7790" for R8A7790 (R-Car H2) HSCIF compatible UART. 11 + - "renesas,scif-r8a7791" for R8A7791 (R-Car M2) SCIF compatible UART. 12 + - "renesas,scifa-r8a7791" for R8A7791 (R-Car M2) SCIFA compatible UART. 13 + - "renesas,scifb-r8a7791" for R8A7791 (R-Car M2) SCIFB compatible UART. 14 + - "renesas,hscif-r8a7791" for R8A7791 (R-Car M2) HSCIF compatible UART. 15 + - "renesas,scif" for generic SCIF compatible UART. 16 + - "renesas,scifa" for generic SCIFA compatible UART. 17 + - "renesas,scifb" for generic SCIFB compatible UART. 18 + - "renesas,hscif" for generic HSCIF compatible UART. 19 + 20 + When compatible with the generic version, nodes must list the 21 + SoC-specific version corresponding to the platform first followed by the 22 + generic version. 23 + 24 + - reg: Base address and length of the I/O registers used by the UART. 25 + - interrupts: Must contain an interrupt-specifier for the SCIx interrupt. 26 + 27 + - clocks: Must contain a phandle and clock-specifier pair for each entry 28 + in clock-names. 29 + - clock-names: Must contain "sci_ick" for the SCIx UART interface clock. 30 + 31 + Note: Each enabled SCIx UART should have an alias correctly numbered in the 32 + "aliases" node. 33 + 34 + Example: 35 + aliases { 36 + serial0 = &scifa0; 37 + }; 38 + 39 + scifa0: serial@e6c40000 { 40 + compatible = "renesas,scifa-r8a7790", "renesas,scifa-generic"; 41 + reg = <0 0xe6c40000 0 64>; 42 + interrupt-parent = <&gic>; 43 + interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>; 44 + clocks = <&mstp2_clks R8A7790_CLK_SCIFA0>; 45 + clock-names = "sci_ick"; 46 + };
+2
Documentation/devicetree/bindings/vendor-prefixes.txt
··· 40 40 idt Integrated Device Technologies, Inc. 41 41 img Imagination Technologies Ltd. 42 42 intercontrol Inter Control Group 43 + isl Intersil 43 44 lg LG Corporation 44 45 linux Linux-specific binding 45 46 lsi LSI Corp. (LSI Logic) ··· 75 74 ste ST-Ericsson 76 75 stericsson ST-Ericsson 77 76 ti Texas Instruments 77 + tlm Trusted Logic Mobility 78 78 toshiba Toshiba Corporation 79 79 toumaz Toumaz 80 80 v3 V3 Semiconductor
+4
arch/arm/Kconfig
··· 317 317 bool "ARM Ltd. Integrator family" 318 318 select ARCH_HAS_CPUFREQ 319 319 select ARM_AMBA 320 + select ARM_PATCH_PHYS_VIRT 321 + select AUTO_ZRELADDR 320 322 select COMMON_CLK 321 323 select COMMON_CLK_VERSATILE 322 324 select GENERIC_CLOCKEVENTS ··· 1085 1083 bool 1086 1084 select CLKSRC_MMIO 1087 1085 select CLKSRC_OF if OF 1086 + 1087 + source "arch/arm/firmware/Kconfig" 1088 1088 1089 1089 source arch/arm/mm/Kconfig 1090 1090
+1
arch/arm/Makefile
··· 267 267 core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ 268 268 core-y += arch/arm/net/ 269 269 core-y += arch/arm/crypto/ 270 + core-y += arch/arm/firmware/ 270 271 core-y += $(machdirs) $(platdirs) 271 272 272 273 drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
+3
arch/arm/boot/dts/integratorcp.dts
··· 47 47 valid-mask = <0x00000007>; 48 48 }; 49 49 50 + /* The SIC is cascaded off IRQ 26 on the PIC */ 50 51 sic: sic@ca000000 { 51 52 compatible = "arm,versatile-fpga-irq"; 53 + interrupt-parent = <&pic>; 54 + interrupts = <26>; 52 55 #interrupt-cells = <1>; 53 56 interrupt-controller; 54 57 reg = <0xca000000 0x100>;
+1
arch/arm/configs/tegra_defconfig
··· 33 33 CONFIG_PCI_MSI=y 34 34 CONFIG_PCI_TEGRA=y 35 35 CONFIG_PCIEPORTBUS=y 36 + CONFIG_TRUSTED_FOUNDATIONS=y 36 37 CONFIG_SMP=y 37 38 CONFIG_PREEMPT=y 38 39 CONFIG_AEABI=y
+28
arch/arm/firmware/Kconfig
··· 1 + config ARCH_SUPPORTS_FIRMWARE 2 + bool 3 + 4 + config ARCH_SUPPORTS_TRUSTED_FOUNDATIONS 5 + bool 6 + select ARCH_SUPPORTS_FIRMWARE 7 + 8 + menu "Firmware options" 9 + depends on ARCH_SUPPORTS_FIRMWARE 10 + 11 + config TRUSTED_FOUNDATIONS 12 + bool "Trusted Foundations secure monitor support" 13 + depends on ARCH_SUPPORTS_TRUSTED_FOUNDATIONS 14 + help 15 + Some devices (including most Tegra-based consumer devices on the 16 + market) are booted with the Trusted Foundations secure monitor 17 + active, requiring some core operations to be performed by the secure 18 + monitor instead of the kernel. 19 + 20 + This option allows the kernel to invoke the secure monitor whenever 21 + required on devices using Trusted Foundations. See 22 + arch/arm/include/asm/trusted_foundations.h or the 23 + tl,trusted-foundations device tree binding documentation for details 24 + on how to use it. 25 + 26 + Say n if you don't know what this is about. 27 + 28 + endmenu
+1
arch/arm/firmware/Makefile
··· 1 + obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o
+81
arch/arm/firmware/trusted_foundations.c
··· 1 + /* 2 + * Trusted Foundations support for ARM CPUs 3 + * 4 + * Copyright (c) 2013, NVIDIA Corporation. 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, but WITHOUT 12 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 + * more details. 15 + */ 16 + 17 + #include <linux/kernel.h> 18 + #include <linux/init.h> 19 + #include <linux/of.h> 20 + #include <asm/firmware.h> 21 + #include <asm/trusted_foundations.h> 22 + 23 + #define TF_SET_CPU_BOOT_ADDR_SMC 0xfffff200 24 + 25 + static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) 26 + { 27 + asm volatile( 28 + ".arch_extension sec\n\t" 29 + "stmfd sp!, {r4 - r11, lr}\n\t" 30 + __asmeq("%0", "r0") 31 + __asmeq("%1", "r1") 32 + __asmeq("%2", "r2") 33 + "mov r3, #0\n\t" 34 + "mov r4, #0\n\t" 35 + "smc #0\n\t" 36 + "ldmfd sp!, {r4 - r11, pc}" 37 + : 38 + : "r" (type), "r" (arg1), "r" (arg2) 39 + : "memory"); 40 + } 41 + 42 + static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr) 43 + { 44 + tf_generic_smc(TF_SET_CPU_BOOT_ADDR_SMC, boot_addr, 0); 45 + 46 + return 0; 47 + } 48 + 49 + static const struct firmware_ops trusted_foundations_ops = { 50 + .set_cpu_boot_addr = tf_set_cpu_boot_addr, 51 + }; 52 + 53 + void register_trusted_foundations(struct trusted_foundations_platform_data *pd) 54 + { 55 + /* 56 + * we are not using version information for now since currently 57 + * supported SMCs are compatible with all TF releases 58 + */ 59 + register_firmware_ops(&trusted_foundations_ops); 60 + } 61 + 62 + void of_register_trusted_foundations(void) 63 + { 64 + struct device_node *node; 65 + struct trusted_foundations_platform_data pdata; 66 + int err; 67 + 68 + node = of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations"); 69 + if (!node) 70 + return; 71 + 72 + err = of_property_read_u32(node, "tlm,version-major", 73 + &pdata.version_major); 74 + if (err != 0) 75 + panic("Trusted Foundation: missing version-major property\n"); 76 + err = of_property_read_u32(node, "tlm,version-minor", 77 + &pdata.version_minor); 78 + if (err != 0) 79 + panic("Trusted Foundation: missing version-minor property\n"); 80 + register_trusted_foundations(&pdata); 81 + }
+67
arch/arm/include/asm/trusted_foundations.h
··· 1 + /* 2 + * Copyright (c) 2013, NVIDIA Corporation. 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + */ 14 + 15 + /* 16 + * Support for the Trusted Foundations secure monitor. 17 + * 18 + * Trusted Foundation comes active on some ARM consumer devices (most 19 + * Tegra-based devices sold on the market are concerned). Such devices can only 20 + * perform some basic operations, like setting the CPU reset vector, through 21 + * SMC calls to the secure monitor. The calls are completely specific to 22 + * Trusted Foundations, and do *not* follow the SMC calling convention or the 23 + * PSCI standard. 24 + */ 25 + 26 + #ifndef __ASM_ARM_TRUSTED_FOUNDATIONS_H 27 + #define __ASM_ARM_TRUSTED_FOUNDATIONS_H 28 + 29 + #include <linux/kconfig.h> 30 + #include <linux/printk.h> 31 + #include <linux/bug.h> 32 + #include <linux/of.h> 33 + 34 + struct trusted_foundations_platform_data { 35 + unsigned int version_major; 36 + unsigned int version_minor; 37 + }; 38 + 39 + #if IS_ENABLED(CONFIG_TRUSTED_FOUNDATIONS) 40 + 41 + void register_trusted_foundations(struct trusted_foundations_platform_data *pd); 42 + void of_register_trusted_foundations(void); 43 + 44 + #else /* CONFIG_TRUSTED_FOUNDATIONS */ 45 + 46 + static inline void register_trusted_foundations( 47 + struct trusted_foundations_platform_data *pd) 48 + { 49 + /* 50 + * If we try to register TF, this means the system needs it to continue. 51 + * Its absence if thus a fatal error. 52 + */ 53 + panic("No support for Trusted Foundations, stopping...\n"); 54 + } 55 + 56 + static inline void of_register_trusted_foundations(void) 57 + { 58 + /* 59 + * If we find the target should enable TF but does not support it, 60 + * fail as the system won't be able to do much anyway 61 + */ 62 + if (of_find_compatible_node(NULL, NULL, "tl,trusted-foundations")) 63 + register_trusted_foundations(NULL); 64 + } 65 + #endif /* CONFIG_TRUSTED_FOUNDATIONS */ 66 + 67 + #endif
+1 -2
arch/arm/mach-davinci/da830.c
··· 385 385 CLK(NULL, "pll0_sysclk7", &pll0_sysclk7), 386 386 CLK("i2c_davinci.1", NULL, &i2c0_clk), 387 387 CLK(NULL, "timer0", &timerp64_0_clk), 388 - CLK("watchdog", NULL, &timerp64_1_clk), 388 + CLK("davinci-wdt", NULL, &timerp64_1_clk), 389 389 CLK(NULL, "arm_rom", &arm_rom_clk), 390 390 CLK(NULL, "scr0_ss", &scr0_ss_clk), 391 391 CLK(NULL, "scr1_ss", &scr1_ss_clk), ··· 1153 1153 1154 1154 static struct davinci_gpio_platform_data da830_gpio_platform_data = { 1155 1155 .ngpio = 128, 1156 - .intc_irq_num = DA830_N_CP_INTC_IRQ, 1157 1156 }; 1158 1157 1159 1158 int __init da830_register_gpio(void)
+1 -2
arch/arm/mach-davinci/da850.c
··· 443 443 CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), 444 444 CLK("i2c_davinci.1", NULL, &i2c0_clk), 445 445 CLK(NULL, "timer0", &timerp64_0_clk), 446 - CLK("watchdog", NULL, &timerp64_1_clk), 446 + CLK("davinci-wdt", NULL, &timerp64_1_clk), 447 447 CLK(NULL, "arm_rom", &arm_rom_clk), 448 448 CLK(NULL, "tpcc0", &tpcc0_clk), 449 449 CLK(NULL, "tptc0", &tptc0_clk), ··· 1283 1283 1284 1284 static struct davinci_gpio_platform_data da850_gpio_platform_data = { 1285 1285 .ngpio = 144, 1286 - .intc_irq_num = DA850_N_CP_INTC_IRQ, 1287 1286 }; 1288 1287 1289 1288 int __init da850_register_gpio(void)
+1 -1
arch/arm/mach-davinci/da8xx-dt.c
··· 32 32 33 33 static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { 34 34 OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL), 35 - OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL), 35 + OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "davinci-wdt", NULL), 36 36 OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL), 37 37 OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f00000, "ehrpwm", NULL), 38 38 OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
+2 -2
arch/arm/mach-davinci/devices-da8xx.c
··· 389 389 }; 390 390 391 391 static struct platform_device da8xx_wdt_device = { 392 - .name = "watchdog", 392 + .name = "davinci-wdt", 393 393 .id = -1, 394 394 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), 395 395 .resource = da8xx_watchdog_resources, ··· 399 399 { 400 400 struct device *dev; 401 401 402 - dev = bus_find_device_by_name(&platform_bus_type, NULL, "watchdog"); 402 + dev = bus_find_device_by_name(&platform_bus_type, NULL, "davinci-wdt"); 403 403 if (!dev) { 404 404 pr_err("%s: failed to find watchdog device\n", __func__); 405 405 return;
+1 -1
arch/arm/mach-davinci/devices.c
··· 302 302 }; 303 303 304 304 struct platform_device davinci_wdt_device = { 305 - .name = "watchdog", 305 + .name = "davinci-wdt", 306 306 .id = -1, 307 307 .num_resources = ARRAY_SIZE(wdt_resources), 308 308 .resource = wdt_resources,
+1 -2
arch/arm/mach-davinci/dm355.c
··· 375 375 CLK(NULL, "pwm3", &pwm3_clk), 376 376 CLK(NULL, "timer0", &timer0_clk), 377 377 CLK(NULL, "timer1", &timer1_clk), 378 - CLK("watchdog", NULL, &timer2_clk), 378 + CLK("davinci-wdt", NULL, &timer2_clk), 379 379 CLK(NULL, "timer3", &timer3_clk), 380 380 CLK(NULL, "rto", &rto_clk), 381 381 CLK(NULL, "usb", &usb_clk), ··· 901 901 902 902 static struct davinci_gpio_platform_data dm355_gpio_platform_data = { 903 903 .ngpio = 104, 904 - .intc_irq_num = DAVINCI_N_AINTC_IRQ, 905 904 }; 906 905 907 906 int __init dm355_gpio_register(void)
+1 -2
arch/arm/mach-davinci/dm365.c
··· 473 473 CLK(NULL, "pwm3", &pwm3_clk), 474 474 CLK(NULL, "timer0", &timer0_clk), 475 475 CLK(NULL, "timer1", &timer1_clk), 476 - CLK("watchdog", NULL, &timer2_clk), 476 + CLK("davinci-wdt", NULL, &timer2_clk), 477 477 CLK(NULL, "timer3", &timer3_clk), 478 478 CLK(NULL, "usb", &usb_clk), 479 479 CLK("davinci_emac.1", NULL, &emac_clk), ··· 713 713 714 714 static struct davinci_gpio_platform_data dm365_gpio_platform_data = { 715 715 .ngpio = 104, 716 - .intc_irq_num = DAVINCI_N_AINTC_IRQ, 717 716 .gpio_unbanked = 8, 718 717 }; 719 718
+1 -2
arch/arm/mach-davinci/dm644x.c
··· 322 322 CLK(NULL, "pwm2", &pwm2_clk), 323 323 CLK(NULL, "timer0", &timer0_clk), 324 324 CLK(NULL, "timer1", &timer1_clk), 325 - CLK("watchdog", NULL, &timer2_clk), 325 + CLK("davinci-wdt", NULL, &timer2_clk), 326 326 CLK(NULL, NULL, NULL), 327 327 }; 328 328 ··· 787 787 788 788 static struct davinci_gpio_platform_data dm644_gpio_platform_data = { 789 789 .ngpio = 71, 790 - .intc_irq_num = DAVINCI_N_AINTC_IRQ, 791 790 }; 792 791 793 792 int __init dm644x_gpio_register(void)
+1 -2
arch/arm/mach-davinci/dm646x.c
··· 356 356 CLK(NULL, "pwm1", &pwm1_clk), 357 357 CLK(NULL, "timer0", &timer0_clk), 358 358 CLK(NULL, "timer1", &timer1_clk), 359 - CLK("watchdog", NULL, &timer2_clk), 359 + CLK("davinci-wdt", NULL, &timer2_clk), 360 360 CLK("palm_bk3710", NULL, &ide_clk), 361 361 CLK(NULL, "vpif0", &vpif0_clk), 362 362 CLK(NULL, "vpif1", &vpif1_clk), ··· 763 763 764 764 static struct davinci_gpio_platform_data dm646x_gpio_platform_data = { 765 765 .ngpio = 43, 766 - .intc_irq_num = DAVINCI_N_AINTC_IRQ, 767 766 }; 768 767 769 768 int __init dm646x_gpio_register(void)
+35
arch/arm/mach-msm/board-msm7x30.c
··· 30 30 #include <asm/memory.h> 31 31 #include <asm/setup.h> 32 32 33 + #include <mach/clk.h> 33 34 #include <mach/msm_iomap.h> 34 35 #include <mach/dma.h> 35 36 ··· 61 60 -1 62 61 }; 63 62 63 + static int hsusb_link_clk_reset(struct clk *link_clk, bool assert) 64 + { 65 + int ret; 66 + 67 + if (assert) { 68 + ret = clk_reset(link_clk, CLK_RESET_ASSERT); 69 + if (ret) 70 + pr_err("usb hs_clk assert failed\n"); 71 + } else { 72 + ret = clk_reset(link_clk, CLK_RESET_DEASSERT); 73 + if (ret) 74 + pr_err("usb hs_clk deassert failed\n"); 75 + } 76 + return ret; 77 + } 78 + 79 + static int hsusb_phy_clk_reset(struct clk *phy_clk) 80 + { 81 + int ret; 82 + 83 + ret = clk_reset(phy_clk, CLK_RESET_ASSERT); 84 + if (ret) { 85 + pr_err("usb phy clk assert failed\n"); 86 + return ret; 87 + } 88 + usleep_range(10000, 12000); 89 + ret = clk_reset(phy_clk, CLK_RESET_DEASSERT); 90 + if (ret) 91 + pr_err("usb phy clk deassert failed\n"); 92 + return ret; 93 + } 94 + 64 95 static struct msm_otg_platform_data msm_otg_pdata = { 65 96 .phy_init_seq = hsusb_phy_init_seq, 66 97 .mode = USB_PERIPHERAL, 67 98 .otg_control = OTG_PHY_CONTROL, 99 + .link_clk_reset = hsusb_link_clk_reset, 100 + .phy_clk_reset = hsusb_phy_clk_reset, 68 101 }; 69 102 70 103 struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
+35
arch/arm/mach-msm/board-qsd8x50.c
··· 31 31 #include <mach/irqs.h> 32 32 #include <mach/sirc.h> 33 33 #include <mach/vreg.h> 34 + #include <mach/clk.h> 34 35 #include <linux/platform_data/mmc-msm_sdcc.h> 35 36 36 37 #include "devices.h" ··· 82 81 -1 83 82 }; 84 83 84 + static int hsusb_link_clk_reset(struct clk *link_clk, bool assert) 85 + { 86 + int ret; 87 + 88 + if (assert) { 89 + ret = clk_reset(link_clk, CLK_RESET_ASSERT); 90 + if (ret) 91 + pr_err("usb hs_clk assert failed\n"); 92 + } else { 93 + ret = clk_reset(link_clk, CLK_RESET_DEASSERT); 94 + if (ret) 95 + pr_err("usb hs_clk deassert failed\n"); 96 + } 97 + return ret; 98 + } 99 + 100 + static int hsusb_phy_clk_reset(struct clk *phy_clk) 101 + { 102 + int ret; 103 + 104 + ret = clk_reset(phy_clk, CLK_RESET_ASSERT); 105 + if (ret) { 106 + pr_err("usb phy clk assert failed\n"); 107 + return ret; 108 + } 109 + usleep_range(10000, 12000); 110 + ret = clk_reset(phy_clk, CLK_RESET_DEASSERT); 111 + if (ret) 112 + pr_err("usb phy clk deassert failed\n"); 113 + return ret; 114 + } 115 + 85 116 static struct msm_otg_platform_data msm_otg_pdata = { 86 117 .phy_init_seq = hsusb_phy_init_seq, 87 118 .mode = USB_PERIPHERAL, 88 119 .otg_control = OTG_PHY_CONTROL, 120 + .link_clk_reset = hsusb_link_clk_reset, 121 + .phy_clk_reset = hsusb_phy_clk_reset, 89 122 }; 90 123 91 124 static struct platform_device *devices[] __initdata = {
+1
arch/arm/mach-tegra/Kconfig
··· 2 2 bool "NVIDIA Tegra" if ARCH_MULTI_V7 3 3 select ARCH_HAS_CPUFREQ 4 4 select ARCH_REQUIRE_GPIOLIB 5 + select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS 5 6 select ARM_GIC 6 7 select CLKSRC_MMIO 7 8 select CLKSRC_OF
+29 -11
arch/arm/mach-tegra/reset.c
··· 21 21 22 22 #include <asm/cacheflush.h> 23 23 #include <asm/hardware/cache-l2x0.h> 24 + #include <asm/firmware.h> 24 25 25 26 #include "iomap.h" 26 27 #include "irammap.h" ··· 34 33 35 34 static bool is_enabled; 36 35 37 - static void __init tegra_cpu_reset_handler_enable(void) 36 + static void __init tegra_cpu_reset_handler_set(const u32 reset_address) 38 37 { 39 - void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE); 40 38 void __iomem *evp_cpu_reset = 41 39 IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE + 0x100); 42 40 void __iomem *sb_ctrl = IO_ADDRESS(TEGRA_SB_BASE); 43 41 u32 reg; 44 42 45 - BUG_ON(is_enabled); 46 - BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE); 47 - 48 - memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start, 49 - tegra_cpu_reset_handler_size); 50 - 51 43 /* 52 44 * NOTE: This must be the one and only write to the EVP CPU reset 53 45 * vector in the entire system. 54 46 */ 55 - writel(TEGRA_IRAM_RESET_BASE + tegra_cpu_reset_handler_offset, 56 - evp_cpu_reset); 47 + writel(reset_address, evp_cpu_reset); 57 48 wmb(); 58 49 reg = readl(evp_cpu_reset); 59 50 ··· 59 66 writel(reg, sb_ctrl); 60 67 wmb(); 61 68 } 69 + } 62 70 63 - is_enabled = true; 71 + static void __init tegra_cpu_reset_handler_enable(void) 72 + { 73 + void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE); 74 + const u32 reset_address = TEGRA_IRAM_RESET_BASE + 75 + tegra_cpu_reset_handler_offset; 76 + int err; 77 + 78 + BUG_ON(is_enabled); 79 + BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE); 80 + 81 + memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start, 82 + tegra_cpu_reset_handler_size); 83 + 84 + err = call_firmware_op(set_cpu_boot_addr, 0, reset_address); 85 + switch (err) { 86 + case -ENOSYS: 87 + tegra_cpu_reset_handler_set(reset_address); 88 + /* pass-through */ 89 + case 0: 90 + is_enabled = true; 91 + break; 92 + default: 93 + pr_crit("Cannot set CPU reset handler: %d\n", err); 94 + BUG(); 95 + } 64 96 } 65 97 66 98 void __init tegra_cpu_reset_handler_init(void)
+2
arch/arm/mach-tegra/tegra.c
··· 40 40 #include <asm/mach/arch.h> 41 41 #include <asm/mach/time.h> 42 42 #include <asm/setup.h> 43 + #include <asm/trusted_foundations.h> 43 44 44 45 #include "apbio.h" 45 46 #include "board.h" ··· 89 88 90 89 static void __init tegra_init_early(void) 91 90 { 91 + of_register_trusted_foundations(); 92 92 tegra_apb_io_init(); 93 93 tegra_init_fuse(); 94 94 tegra_cpu_reset_handler_init();
+21 -9
arch/sh/kernel/cpu/sh2/setup-sh7619.c
··· 61 61 NULL, prio_registers, NULL); 62 62 63 63 static struct plat_sci_port scif0_platform_data = { 64 - .mapbase = 0xf8400000, 65 64 .flags = UPF_BOOT_AUTOCONF, 66 65 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 67 - .scbrr_algo_id = SCBRR_ALGO_2, 68 66 .type = PORT_SCIF, 69 - .irqs = SCIx_IRQ_MUXED(88), 67 + }; 68 + 69 + static struct resource scif0_resources[] = { 70 + DEFINE_RES_MEM(0xf8400000, 0x100), 71 + DEFINE_RES_IRQ(88), 70 72 }; 71 73 72 74 static struct platform_device scif0_device = { 73 75 .name = "sh-sci", 74 76 .id = 0, 77 + .resource = scif0_resources, 78 + .num_resources = ARRAY_SIZE(scif0_resources), 75 79 .dev = { 76 80 .platform_data = &scif0_platform_data, 77 81 }, 78 82 }; 79 83 80 84 static struct plat_sci_port scif1_platform_data = { 81 - .mapbase = 0xf8410000, 82 85 .flags = UPF_BOOT_AUTOCONF, 83 86 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 84 - .scbrr_algo_id = SCBRR_ALGO_2, 85 87 .type = PORT_SCIF, 86 - .irqs = SCIx_IRQ_MUXED(92), 88 + }; 89 + 90 + static struct resource scif1_resources[] = { 91 + DEFINE_RES_MEM(0xf8410000, 0x100), 92 + DEFINE_RES_IRQ(92), 87 93 }; 88 94 89 95 static struct platform_device scif1_device = { 90 96 .name = "sh-sci", 91 97 .id = 1, 98 + .resource = scif1_resources, 99 + .num_resources = ARRAY_SIZE(scif1_resources), 92 100 .dev = { 93 101 .platform_data = &scif1_platform_data, 94 102 }, 95 103 }; 96 104 97 105 static struct plat_sci_port scif2_platform_data = { 98 - .mapbase = 0xf8420000, 99 106 .flags = UPF_BOOT_AUTOCONF, 100 107 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 101 - .scbrr_algo_id = SCBRR_ALGO_2, 102 108 .type = PORT_SCIF, 103 - .irqs = SCIx_IRQ_MUXED(96), 109 + }; 110 + 111 + static struct resource scif2_resources[] = { 112 + DEFINE_RES_MEM(0xf8420000, 0x100), 113 + DEFINE_RES_IRQ(96), 104 114 }; 105 115 106 116 static struct platform_device scif2_device = { 107 117 .name = "sh-sci", 108 118 .id = 2, 119 + .resource = scif2_resources, 120 + .num_resources = ARRAY_SIZE(scif2_resources), 109 121 .dev = { 110 122 .platform_data = &scif2_platform_data, 111 123 },
+7 -3
arch/sh/kernel/cpu/sh2a/setup-mxg.c
··· 199 199 }; 200 200 201 201 static struct plat_sci_port scif0_platform_data = { 202 - .mapbase = 0xff804000, 203 202 .flags = UPF_BOOT_AUTOCONF, 204 203 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 205 - .scbrr_algo_id = SCBRR_ALGO_2, 206 204 .type = PORT_SCIF, 207 - .irqs = SCIx_IRQ_MUXED(220), 205 + }; 206 + 207 + static struct resource scif0_resources[] = { 208 + DEFINE_RES_MEM(0xff804000, 0x100), 209 + DEFINE_RES_IRQ(220), 208 210 }; 209 211 210 212 static struct platform_device scif0_device = { 211 213 .name = "sh-sci", 212 214 .id = 0, 215 + .resource = scif0_resources, 216 + .num_resources = ARRAY_SIZE(scif0_resources), 213 217 .dev = { 214 218 .platform_data = &scif0_platform_data, 215 219 },
+56 -24
arch/sh/kernel/cpu/sh2a/setup-sh7201.c
··· 178 178 mask_registers, prio_registers, NULL); 179 179 180 180 static struct plat_sci_port scif0_platform_data = { 181 - .mapbase = 0xfffe8000, 182 181 .flags = UPF_BOOT_AUTOCONF, 183 182 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 184 - .scbrr_algo_id = SCBRR_ALGO_2, 185 183 .type = PORT_SCIF, 186 - .irqs = SCIx_IRQ_MUXED(180), 184 + }; 185 + 186 + static struct resource scif0_resources[] = { 187 + DEFINE_RES_MEM(0xfffe8000, 0x100), 188 + DEFINE_RES_IRQ(180), 187 189 }; 188 190 189 191 static struct platform_device scif0_device = { 190 192 .name = "sh-sci", 191 193 .id = 0, 194 + .resource = scif0_resources, 195 + .num_resources = ARRAY_SIZE(scif0_resources), 192 196 .dev = { 193 197 .platform_data = &scif0_platform_data, 194 198 }, 195 199 }; 196 200 197 201 static struct plat_sci_port scif1_platform_data = { 198 - .mapbase = 0xfffe8800, 199 202 .flags = UPF_BOOT_AUTOCONF, 200 203 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 201 - .scbrr_algo_id = SCBRR_ALGO_2, 202 204 .type = PORT_SCIF, 203 - .irqs = SCIx_IRQ_MUXED(184), 205 + }; 206 + 207 + static struct resource scif1_resources[] = { 208 + DEFINE_RES_MEM(0xfffe8800, 0x100), 209 + DEFINE_RES_IRQ(184), 204 210 }; 205 211 206 212 static struct platform_device scif1_device = { 207 213 .name = "sh-sci", 208 214 .id = 1, 215 + .resource = scif1_resources, 216 + .num_resources = ARRAY_SIZE(scif1_resources), 209 217 .dev = { 210 218 .platform_data = &scif1_platform_data, 211 219 }, 212 220 }; 213 221 214 222 static struct plat_sci_port scif2_platform_data = { 215 - .mapbase = 0xfffe9000, 216 223 .flags = UPF_BOOT_AUTOCONF, 217 224 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 218 - .scbrr_algo_id = SCBRR_ALGO_2, 219 225 .type = PORT_SCIF, 220 - .irqs = SCIx_IRQ_MUXED(188), 226 + }; 227 + 228 + static struct resource scif2_resources[] = { 229 + DEFINE_RES_MEM(0xfffe9000, 0x100), 230 + DEFINE_RES_IRQ(188), 221 231 }; 222 232 223 233 static struct platform_device scif2_device = { 224 234 .name = "sh-sci", 225 235 .id = 2, 236 + .resource = scif2_resources, 237 + .num_resources = ARRAY_SIZE(scif2_resources), 226 238 .dev = { 227 239 .platform_data = &scif2_platform_data, 228 240 }, 229 241 }; 230 242 231 243 static struct plat_sci_port scif3_platform_data = { 232 - .mapbase = 0xfffe9800, 233 244 .flags = UPF_BOOT_AUTOCONF, 234 245 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 235 - .scbrr_algo_id = SCBRR_ALGO_2, 236 246 .type = PORT_SCIF, 237 - .irqs = SCIx_IRQ_MUXED(192), 247 + }; 248 + 249 + static struct resource scif3_resources[] = { 250 + DEFINE_RES_MEM(0xfffe9800, 0x100), 251 + DEFINE_RES_IRQ(192), 238 252 }; 239 253 240 254 static struct platform_device scif3_device = { 241 255 .name = "sh-sci", 242 256 .id = 3, 257 + .resource = scif3_resources, 258 + .num_resources = ARRAY_SIZE(scif3_resources), 243 259 .dev = { 244 260 .platform_data = &scif3_platform_data, 245 261 }, 246 262 }; 247 263 248 264 static struct plat_sci_port scif4_platform_data = { 249 - .mapbase = 0xfffea000, 250 265 .flags = UPF_BOOT_AUTOCONF, 251 266 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 252 - .scbrr_algo_id = SCBRR_ALGO_2, 253 267 .type = PORT_SCIF, 254 - .irqs = SCIx_IRQ_MUXED(196), 268 + }; 269 + 270 + static struct resource scif4_resources[] = { 271 + DEFINE_RES_MEM(0xfffea000, 0x100), 272 + DEFINE_RES_IRQ(196), 255 273 }; 256 274 257 275 static struct platform_device scif4_device = { 258 276 .name = "sh-sci", 259 277 .id = 4, 278 + .resource = scif4_resources, 279 + .num_resources = ARRAY_SIZE(scif4_resources), 260 280 .dev = { 261 281 .platform_data = &scif4_platform_data, 262 282 }, 263 283 }; 264 284 265 285 static struct plat_sci_port scif5_platform_data = { 266 - .mapbase = 0xfffea800, 267 286 .flags = UPF_BOOT_AUTOCONF, 268 287 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 269 - .scbrr_algo_id = SCBRR_ALGO_2, 270 288 .type = PORT_SCIF, 271 - .irqs = SCIx_IRQ_MUXED(200), 289 + }; 290 + 291 + static struct resource scif5_resources[] = { 292 + DEFINE_RES_MEM(0xfffea800, 0x100), 293 + DEFINE_RES_IRQ(200), 272 294 }; 273 295 274 296 static struct platform_device scif5_device = { 275 297 .name = "sh-sci", 276 298 .id = 5, 299 + .resource = scif5_resources, 300 + .num_resources = ARRAY_SIZE(scif5_resources), 277 301 .dev = { 278 302 .platform_data = &scif5_platform_data, 279 303 }, 280 304 }; 281 305 282 306 static struct plat_sci_port scif6_platform_data = { 283 - .mapbase = 0xfffeb000, 284 307 .flags = UPF_BOOT_AUTOCONF, 285 308 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 286 - .scbrr_algo_id = SCBRR_ALGO_2, 287 309 .type = PORT_SCIF, 288 - .irqs = SCIx_IRQ_MUXED(204), 310 + }; 311 + 312 + static struct resource scif6_resources[] = { 313 + DEFINE_RES_MEM(0xfffeb000, 0x100), 314 + DEFINE_RES_IRQ(204), 289 315 }; 290 316 291 317 static struct platform_device scif6_device = { 292 318 .name = "sh-sci", 293 319 .id = 6, 320 + .resource = scif6_resources, 321 + .num_resources = ARRAY_SIZE(scif6_resources), 294 322 .dev = { 295 323 .platform_data = &scif6_platform_data, 296 324 }, 297 325 }; 298 326 299 327 static struct plat_sci_port scif7_platform_data = { 300 - .mapbase = 0xfffeb800, 301 328 .flags = UPF_BOOT_AUTOCONF, 302 329 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 303 - .scbrr_algo_id = SCBRR_ALGO_2, 304 330 .type = PORT_SCIF, 305 - .irqs = SCIx_IRQ_MUXED(208), 331 + }; 332 + 333 + static struct resource scif7_resources[] = { 334 + DEFINE_RES_MEM(0xfffeb800, 0x100), 335 + DEFINE_RES_IRQ(208), 306 336 }; 307 337 308 338 static struct platform_device scif7_device = { 309 339 .name = "sh-sci", 310 340 .id = 7, 341 + .resource = scif7_resources, 342 + .num_resources = ARRAY_SIZE(scif7_resources), 311 343 .dev = { 312 344 .platform_data = &scif7_platform_data, 313 345 },
+28 -12
arch/sh/kernel/cpu/sh2a/setup-sh7203.c
··· 174 174 mask_registers, prio_registers, NULL); 175 175 176 176 static struct plat_sci_port scif0_platform_data = { 177 - .mapbase = 0xfffe8000, 178 177 .flags = UPF_BOOT_AUTOCONF, 179 178 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 180 179 SCSCR_REIE, 181 - .scbrr_algo_id = SCBRR_ALGO_2, 182 180 .type = PORT_SCIF, 183 - .irqs = SCIx_IRQ_MUXED(192), 184 181 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 182 + }; 183 + 184 + static struct resource scif0_resources[] = { 185 + DEFINE_RES_MEM(0xfffe8000, 0x100), 186 + DEFINE_RES_IRQ(192), 185 187 }; 186 188 187 189 static struct platform_device scif0_device = { 188 190 .name = "sh-sci", 189 191 .id = 0, 192 + .resource = scif0_resources, 193 + .num_resources = ARRAY_SIZE(scif0_resources), 190 194 .dev = { 191 195 .platform_data = &scif0_platform_data, 192 196 }, 193 197 }; 194 198 195 199 static struct plat_sci_port scif1_platform_data = { 196 - .mapbase = 0xfffe8800, 197 200 .flags = UPF_BOOT_AUTOCONF, 198 201 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 199 202 SCSCR_REIE, 200 - .scbrr_algo_id = SCBRR_ALGO_2, 201 203 .type = PORT_SCIF, 202 - .irqs = SCIx_IRQ_MUXED(196), 203 204 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 205 + }; 206 + 207 + static struct resource scif1_resources[] = { 208 + DEFINE_RES_MEM(0xfffe8800, 0x100), 209 + DEFINE_RES_IRQ(196), 204 210 }; 205 211 206 212 static struct platform_device scif1_device = { 207 213 .name = "sh-sci", 208 214 .id = 1, 215 + .resource = scif1_resources, 216 + .num_resources = ARRAY_SIZE(scif1_resources), 209 217 .dev = { 210 218 .platform_data = &scif1_platform_data, 211 219 }, 212 220 }; 213 221 214 222 static struct plat_sci_port scif2_platform_data = { 215 - .mapbase = 0xfffe9000, 216 223 .flags = UPF_BOOT_AUTOCONF, 217 224 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 218 225 SCSCR_REIE, 219 - .scbrr_algo_id = SCBRR_ALGO_2, 220 226 .type = PORT_SCIF, 221 - .irqs = SCIx_IRQ_MUXED(200), 222 227 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 228 + }; 229 + 230 + static struct resource scif2_resources[] = { 231 + DEFINE_RES_MEM(0xfffe9000, 0x100), 232 + DEFINE_RES_IRQ(200), 223 233 }; 224 234 225 235 static struct platform_device scif2_device = { 226 236 .name = "sh-sci", 227 237 .id = 2, 238 + .resource = scif2_resources, 239 + .num_resources = ARRAY_SIZE(scif2_resources), 228 240 .dev = { 229 241 .platform_data = &scif2_platform_data, 230 242 }, 231 243 }; 232 244 233 245 static struct plat_sci_port scif3_platform_data = { 234 - .mapbase = 0xfffe9800, 235 246 .flags = UPF_BOOT_AUTOCONF, 236 247 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 237 248 SCSCR_REIE, 238 - .scbrr_algo_id = SCBRR_ALGO_2, 239 249 .type = PORT_SCIF, 240 - .irqs = SCIx_IRQ_MUXED(204), 241 250 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 251 + }; 252 + 253 + static struct resource scif3_resources[] = { 254 + DEFINE_RES_MEM(0xfffe9800, 0x100), 255 + DEFINE_RES_IRQ(204), 242 256 }; 243 257 244 258 static struct platform_device scif3_device = { 245 259 .name = "sh-sci", 246 260 .id = 3, 261 + .resource = scif3_resources, 262 + .num_resources = ARRAY_SIZE(scif3_resources), 247 263 .dev = { 248 264 .platform_data = &scif3_platform_data, 249 265 },
+28 -12
arch/sh/kernel/cpu/sh2a/setup-sh7206.c
··· 134 134 mask_registers, prio_registers, NULL); 135 135 136 136 static struct plat_sci_port scif0_platform_data = { 137 - .mapbase = 0xfffe8000, 138 137 .flags = UPF_BOOT_AUTOCONF, 139 138 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 140 - .scbrr_algo_id = SCBRR_ALGO_2, 141 139 .type = PORT_SCIF, 142 - .irqs = SCIx_IRQ_MUXED(240), 140 + }; 141 + 142 + static struct resource scif0_resources[] = { 143 + DEFINE_RES_MEM(0xfffe8000, 0x100), 144 + DEFINE_RES_IRQ(240), 143 145 }; 144 146 145 147 static struct platform_device scif0_device = { 146 148 .name = "sh-sci", 147 149 .id = 0, 150 + .resource = scif0_resources, 151 + .num_resources = ARRAY_SIZE(scif0_resources), 148 152 .dev = { 149 153 .platform_data = &scif0_platform_data, 150 154 }, 151 155 }; 152 156 153 157 static struct plat_sci_port scif1_platform_data = { 154 - .mapbase = 0xfffe8800, 155 158 .flags = UPF_BOOT_AUTOCONF, 156 159 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 157 - .scbrr_algo_id = SCBRR_ALGO_2, 158 160 .type = PORT_SCIF, 159 - .irqs = SCIx_IRQ_MUXED(244), 161 + }; 162 + 163 + static struct resource scif1_resources[] = { 164 + DEFINE_RES_MEM(0xfffe8800, 0x100), 165 + DEFINE_RES_IRQ(244), 160 166 }; 161 167 162 168 static struct platform_device scif1_device = { 163 169 .name = "sh-sci", 164 170 .id = 1, 171 + .resource = scif1_resources, 172 + .num_resources = ARRAY_SIZE(scif1_resources), 165 173 .dev = { 166 174 .platform_data = &scif1_platform_data, 167 175 }, 168 176 }; 169 177 170 178 static struct plat_sci_port scif2_platform_data = { 171 - .mapbase = 0xfffe9000, 172 179 .flags = UPF_BOOT_AUTOCONF, 173 180 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 174 - .scbrr_algo_id = SCBRR_ALGO_2, 175 181 .type = PORT_SCIF, 176 - .irqs = SCIx_IRQ_MUXED(248), 182 + }; 183 + 184 + static struct resource scif2_resources[] = { 185 + DEFINE_RES_MEM(0xfffe9000, 0x100), 186 + DEFINE_RES_IRQ(248), 177 187 }; 178 188 179 189 static struct platform_device scif2_device = { 180 190 .name = "sh-sci", 181 191 .id = 2, 192 + .resource = scif2_resources, 193 + .num_resources = ARRAY_SIZE(scif2_resources), 182 194 .dev = { 183 195 .platform_data = &scif2_platform_data, 184 196 }, 185 197 }; 186 198 187 199 static struct plat_sci_port scif3_platform_data = { 188 - .mapbase = 0xfffe9800, 189 200 .flags = UPF_BOOT_AUTOCONF, 190 201 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 191 - .scbrr_algo_id = SCBRR_ALGO_2, 192 202 .type = PORT_SCIF, 193 - .irqs = SCIx_IRQ_MUXED(252), 203 + }; 204 + 205 + static struct resource scif3_resources[] = { 206 + DEFINE_RES_MEM(0xfffe9800, 0x100), 207 + DEFINE_RES_IRQ(252), 194 208 }; 195 209 196 210 static struct platform_device scif3_device = { 197 211 .name = "sh-sci", 198 212 .id = 3, 213 + .resource = scif3_resources, 214 + .num_resources = ARRAY_SIZE(scif3_resources), 199 215 .dev = { 200 216 .platform_data = &scif3_platform_data, 201 217 },
+80 -24
arch/sh/kernel/cpu/sh2a/setup-sh7264.c
··· 226 226 mask_registers, prio_registers, NULL); 227 227 228 228 static struct plat_sci_port scif0_platform_data = { 229 - .mapbase = 0xfffe8000, 230 229 .flags = UPF_BOOT_AUTOCONF, 231 230 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 232 231 SCSCR_REIE | SCSCR_TOIE, 233 - .scbrr_algo_id = SCBRR_ALGO_2, 234 232 .type = PORT_SCIF, 235 - .irqs = { 233, 234, 235, 232 }, 236 233 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 234 + }; 235 + 236 + static struct resource scif0_resources[] = { 237 + DEFINE_RES_MEM(0xfffe8000, 0x100), 238 + DEFINE_RES_IRQ(233), 239 + DEFINE_RES_IRQ(234), 240 + DEFINE_RES_IRQ(235), 241 + DEFINE_RES_IRQ(232), 237 242 }; 238 243 239 244 static struct platform_device scif0_device = { 240 245 .name = "sh-sci", 241 246 .id = 0, 247 + .resource = scif0_resources, 248 + .num_resources = ARRAY_SIZE(scif0_resources), 242 249 .dev = { 243 250 .platform_data = &scif0_platform_data, 244 251 }, 245 252 }; 246 253 247 254 static struct plat_sci_port scif1_platform_data = { 248 - .mapbase = 0xfffe8800, 249 255 .flags = UPF_BOOT_AUTOCONF, 250 256 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 251 257 SCSCR_REIE | SCSCR_TOIE, 252 - .scbrr_algo_id = SCBRR_ALGO_2, 253 258 .type = PORT_SCIF, 254 - .irqs = { 237, 238, 239, 236 }, 255 259 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 260 + }; 261 + 262 + static struct resource scif1_resources[] = { 263 + DEFINE_RES_MEM(0xfffe8800, 0x100), 264 + DEFINE_RES_IRQ(237), 265 + DEFINE_RES_IRQ(238), 266 + DEFINE_RES_IRQ(239), 267 + DEFINE_RES_IRQ(236), 256 268 }; 257 269 258 270 static struct platform_device scif1_device = { 259 271 .name = "sh-sci", 260 272 .id = 1, 273 + .resource = scif1_resources, 274 + .num_resources = ARRAY_SIZE(scif1_resources), 261 275 .dev = { 262 276 .platform_data = &scif1_platform_data, 263 277 }, 264 278 }; 265 279 266 280 static struct plat_sci_port scif2_platform_data = { 267 - .mapbase = 0xfffe9000, 268 281 .flags = UPF_BOOT_AUTOCONF, 269 282 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 270 283 SCSCR_REIE | SCSCR_TOIE, 271 - .scbrr_algo_id = SCBRR_ALGO_2, 272 284 .type = PORT_SCIF, 273 - .irqs = { 241, 242, 243, 240 }, 274 285 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 286 + }; 287 + 288 + static struct resource scif2_resources[] = { 289 + DEFINE_RES_MEM(0xfffe9000, 0x100), 290 + DEFINE_RES_IRQ(241), 291 + DEFINE_RES_IRQ(242), 292 + DEFINE_RES_IRQ(243), 293 + DEFINE_RES_IRQ(240), 275 294 }; 276 295 277 296 static struct platform_device scif2_device = { 278 297 .name = "sh-sci", 279 298 .id = 2, 299 + .resource = scif2_resources, 300 + .num_resources = ARRAY_SIZE(scif2_resources), 280 301 .dev = { 281 302 .platform_data = &scif2_platform_data, 282 303 }, 283 304 }; 284 305 285 306 static struct plat_sci_port scif3_platform_data = { 286 - .mapbase = 0xfffe9800, 287 307 .flags = UPF_BOOT_AUTOCONF, 288 308 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 289 309 SCSCR_REIE | SCSCR_TOIE, 290 - .scbrr_algo_id = SCBRR_ALGO_2, 291 310 .type = PORT_SCIF, 292 - .irqs = { 245, 246, 247, 244 }, 293 311 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 312 + }; 313 + 314 + static struct resource scif3_resources[] = { 315 + DEFINE_RES_MEM(0xfffe9800, 0x100), 316 + DEFINE_RES_IRQ(245), 317 + DEFINE_RES_IRQ(246), 318 + DEFINE_RES_IRQ(247), 319 + DEFINE_RES_IRQ(244), 294 320 }; 295 321 296 322 static struct platform_device scif3_device = { 297 323 .name = "sh-sci", 298 324 .id = 3, 325 + .resource = scif3_resources, 326 + .num_resources = ARRAY_SIZE(scif3_resources), 299 327 .dev = { 300 328 .platform_data = &scif3_platform_data, 301 329 }, 302 330 }; 303 331 304 332 static struct plat_sci_port scif4_platform_data = { 305 - .mapbase = 0xfffea000, 306 333 .flags = UPF_BOOT_AUTOCONF, 307 334 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 308 335 SCSCR_REIE | SCSCR_TOIE, 309 - .scbrr_algo_id = SCBRR_ALGO_2, 310 336 .type = PORT_SCIF, 311 - .irqs = { 249, 250, 251, 248 }, 312 337 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 338 + }; 339 + 340 + static struct resource scif4_resources[] = { 341 + DEFINE_RES_MEM(0xfffea000, 0x100), 342 + DEFINE_RES_IRQ(249), 343 + DEFINE_RES_IRQ(250), 344 + DEFINE_RES_IRQ(251), 345 + DEFINE_RES_IRQ(248), 313 346 }; 314 347 315 348 static struct platform_device scif4_device = { 316 349 .name = "sh-sci", 317 350 .id = 4, 351 + .resource = scif4_resources, 352 + .num_resources = ARRAY_SIZE(scif4_resources), 318 353 .dev = { 319 354 .platform_data = &scif4_platform_data, 320 355 }, 321 356 }; 322 357 323 358 static struct plat_sci_port scif5_platform_data = { 324 - .mapbase = 0xfffea800, 325 359 .flags = UPF_BOOT_AUTOCONF, 326 360 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 327 361 SCSCR_REIE | SCSCR_TOIE, 328 - .scbrr_algo_id = SCBRR_ALGO_2, 329 362 .type = PORT_SCIF, 330 - .irqs = { 253, 254, 255, 252 }, 331 363 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 364 + }; 365 + 366 + static struct resource scif5_resources[] = { 367 + DEFINE_RES_MEM(0xfffea800, 0x100), 368 + DEFINE_RES_IRQ(253), 369 + DEFINE_RES_IRQ(254), 370 + DEFINE_RES_IRQ(255), 371 + DEFINE_RES_IRQ(252), 332 372 }; 333 373 334 374 static struct platform_device scif5_device = { 335 375 .name = "sh-sci", 336 376 .id = 5, 377 + .resource = scif5_resources, 378 + .num_resources = ARRAY_SIZE(scif5_resources), 337 379 .dev = { 338 380 .platform_data = &scif5_platform_data, 339 381 }, 340 382 }; 341 383 342 384 static struct plat_sci_port scif6_platform_data = { 343 - .mapbase = 0xfffeb000, 344 385 .flags = UPF_BOOT_AUTOCONF, 345 386 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 346 387 SCSCR_REIE | SCSCR_TOIE, 347 - .scbrr_algo_id = SCBRR_ALGO_2, 348 388 .type = PORT_SCIF, 349 - .irqs = { 257, 258, 259, 256 }, 350 389 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 390 + }; 391 + 392 + static struct resource scif6_resources[] = { 393 + DEFINE_RES_MEM(0xfffeb000, 0x100), 394 + DEFINE_RES_IRQ(257), 395 + DEFINE_RES_IRQ(258), 396 + DEFINE_RES_IRQ(259), 397 + DEFINE_RES_IRQ(256), 351 398 }; 352 399 353 400 static struct platform_device scif6_device = { 354 401 .name = "sh-sci", 355 402 .id = 6, 403 + .resource = scif6_resources, 404 + .num_resources = ARRAY_SIZE(scif6_resources), 356 405 .dev = { 357 406 .platform_data = &scif6_platform_data, 358 407 }, 359 408 }; 360 409 361 410 static struct plat_sci_port scif7_platform_data = { 362 - .mapbase = 0xfffeb800, 363 411 .flags = UPF_BOOT_AUTOCONF, 364 412 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 365 413 SCSCR_REIE | SCSCR_TOIE, 366 - .scbrr_algo_id = SCBRR_ALGO_2, 367 414 .type = PORT_SCIF, 368 - .irqs = { 261, 262, 263, 260 }, 369 415 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 416 + }; 417 + 418 + static struct resource scif7_resources[] = { 419 + DEFINE_RES_MEM(0xfffeb800, 0x100), 420 + DEFINE_RES_IRQ(261), 421 + DEFINE_RES_IRQ(262), 422 + DEFINE_RES_IRQ(263), 423 + DEFINE_RES_IRQ(260), 370 424 }; 371 425 372 426 static struct platform_device scif7_device = { 373 427 .name = "sh-sci", 374 428 .id = 7, 429 + .resource = scif7_resources, 430 + .num_resources = ARRAY_SIZE(scif7_resources), 375 431 .dev = { 376 432 .platform_data = &scif7_platform_data, 377 433 },
+80 -24
arch/sh/kernel/cpu/sh2a/setup-sh7269.c
··· 248 248 mask_registers, prio_registers, NULL); 249 249 250 250 static struct plat_sci_port scif0_platform_data = { 251 - .mapbase = 0xe8007000, 252 251 .flags = UPF_BOOT_AUTOCONF, 253 252 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 254 253 SCSCR_REIE | SCSCR_TOIE, 255 - .scbrr_algo_id = SCBRR_ALGO_2, 256 254 .type = PORT_SCIF, 257 - .irqs = { 259, 260, 261, 258 }, 258 255 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 256 + }; 257 + 258 + static struct resource scif0_resources[] = { 259 + DEFINE_RES_MEM(0xe8007000, 0x100), 260 + DEFINE_RES_IRQ(259), 261 + DEFINE_RES_IRQ(260), 262 + DEFINE_RES_IRQ(261), 263 + DEFINE_RES_IRQ(258), 259 264 }; 260 265 261 266 static struct platform_device scif0_device = { 262 267 .name = "sh-sci", 263 268 .id = 0, 269 + .resource = scif0_resources, 270 + .num_resources = ARRAY_SIZE(scif0_resources), 264 271 .dev = { 265 272 .platform_data = &scif0_platform_data, 266 273 }, 267 274 }; 268 275 269 276 static struct plat_sci_port scif1_platform_data = { 270 - .mapbase = 0xe8007800, 271 277 .flags = UPF_BOOT_AUTOCONF, 272 278 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 273 279 SCSCR_REIE | SCSCR_TOIE, 274 - .scbrr_algo_id = SCBRR_ALGO_2, 275 280 .type = PORT_SCIF, 276 - .irqs = { 263, 264, 265, 262 }, 277 281 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 282 + }; 283 + 284 + static struct resource scif1_resources[] = { 285 + DEFINE_RES_MEM(0xe8007800, 0x100), 286 + DEFINE_RES_IRQ(263), 287 + DEFINE_RES_IRQ(264), 288 + DEFINE_RES_IRQ(265), 289 + DEFINE_RES_IRQ(262), 278 290 }; 279 291 280 292 static struct platform_device scif1_device = { 281 293 .name = "sh-sci", 282 294 .id = 1, 295 + .resource = scif1_resources, 296 + .num_resources = ARRAY_SIZE(scif1_resources), 283 297 .dev = { 284 298 .platform_data = &scif1_platform_data, 285 299 }, 286 300 }; 287 301 288 302 static struct plat_sci_port scif2_platform_data = { 289 - .mapbase = 0xe8008000, 290 303 .flags = UPF_BOOT_AUTOCONF, 291 304 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 292 305 SCSCR_REIE | SCSCR_TOIE, 293 - .scbrr_algo_id = SCBRR_ALGO_2, 294 306 .type = PORT_SCIF, 295 - .irqs = { 267, 268, 269, 266 }, 296 307 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 308 + }; 309 + 310 + static struct resource scif2_resources[] = { 311 + DEFINE_RES_MEM(0xe8008000, 0x100), 312 + DEFINE_RES_IRQ(267), 313 + DEFINE_RES_IRQ(268), 314 + DEFINE_RES_IRQ(269), 315 + DEFINE_RES_IRQ(266), 297 316 }; 298 317 299 318 static struct platform_device scif2_device = { 300 319 .name = "sh-sci", 301 320 .id = 2, 321 + .resource = scif2_resources, 322 + .num_resources = ARRAY_SIZE(scif2_resources), 302 323 .dev = { 303 324 .platform_data = &scif2_platform_data, 304 325 }, 305 326 }; 306 327 307 328 static struct plat_sci_port scif3_platform_data = { 308 - .mapbase = 0xe8008800, 309 329 .flags = UPF_BOOT_AUTOCONF, 310 330 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 311 331 SCSCR_REIE | SCSCR_TOIE, 312 - .scbrr_algo_id = SCBRR_ALGO_2, 313 332 .type = PORT_SCIF, 314 - .irqs = { 271, 272, 273, 270 }, 315 333 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 334 + }; 335 + 336 + static struct resource scif3_resources[] = { 337 + DEFINE_RES_MEM(0xe8008800, 0x100), 338 + DEFINE_RES_IRQ(271), 339 + DEFINE_RES_IRQ(272), 340 + DEFINE_RES_IRQ(273), 341 + DEFINE_RES_IRQ(270), 316 342 }; 317 343 318 344 static struct platform_device scif3_device = { 319 345 .name = "sh-sci", 320 346 .id = 3, 347 + .resource = scif3_resources, 348 + .num_resources = ARRAY_SIZE(scif3_resources), 321 349 .dev = { 322 350 .platform_data = &scif3_platform_data, 323 351 }, 324 352 }; 325 353 326 354 static struct plat_sci_port scif4_platform_data = { 327 - .mapbase = 0xe8009000, 328 355 .flags = UPF_BOOT_AUTOCONF, 329 356 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 330 357 SCSCR_REIE | SCSCR_TOIE, 331 - .scbrr_algo_id = SCBRR_ALGO_2, 332 358 .type = PORT_SCIF, 333 - .irqs = { 275, 276, 277, 274 }, 334 359 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 360 + }; 361 + 362 + static struct resource scif4_resources[] = { 363 + DEFINE_RES_MEM(0xe8009000, 0x100), 364 + DEFINE_RES_IRQ(275), 365 + DEFINE_RES_IRQ(276), 366 + DEFINE_RES_IRQ(277), 367 + DEFINE_RES_IRQ(274), 335 368 }; 336 369 337 370 static struct platform_device scif4_device = { 338 371 .name = "sh-sci", 339 372 .id = 4, 373 + .resource = scif4_resources, 374 + .num_resources = ARRAY_SIZE(scif4_resources), 340 375 .dev = { 341 376 .platform_data = &scif4_platform_data, 342 377 }, 343 378 }; 344 379 345 380 static struct plat_sci_port scif5_platform_data = { 346 - .mapbase = 0xe8009800, 347 381 .flags = UPF_BOOT_AUTOCONF, 348 382 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 349 383 SCSCR_REIE | SCSCR_TOIE, 350 - .scbrr_algo_id = SCBRR_ALGO_2, 351 384 .type = PORT_SCIF, 352 - .irqs = { 279, 280, 281, 278 }, 353 385 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 386 + }; 387 + 388 + static struct resource scif5_resources[] = { 389 + DEFINE_RES_MEM(0xe8009800, 0x100), 390 + DEFINE_RES_IRQ(279), 391 + DEFINE_RES_IRQ(280), 392 + DEFINE_RES_IRQ(281), 393 + DEFINE_RES_IRQ(278), 354 394 }; 355 395 356 396 static struct platform_device scif5_device = { 357 397 .name = "sh-sci", 358 398 .id = 5, 399 + .resource = scif5_resources, 400 + .num_resources = ARRAY_SIZE(scif5_resources), 359 401 .dev = { 360 402 .platform_data = &scif5_platform_data, 361 403 }, 362 404 }; 363 405 364 406 static struct plat_sci_port scif6_platform_data = { 365 - .mapbase = 0xe800a000, 366 407 .flags = UPF_BOOT_AUTOCONF, 367 408 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 368 409 SCSCR_REIE | SCSCR_TOIE, 369 - .scbrr_algo_id = SCBRR_ALGO_2, 370 410 .type = PORT_SCIF, 371 - .irqs = { 283, 284, 285, 282 }, 372 411 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 412 + }; 413 + 414 + static struct resource scif6_resources[] = { 415 + DEFINE_RES_MEM(0xe800a000, 0x100), 416 + DEFINE_RES_IRQ(283), 417 + DEFINE_RES_IRQ(284), 418 + DEFINE_RES_IRQ(285), 419 + DEFINE_RES_IRQ(282), 373 420 }; 374 421 375 422 static struct platform_device scif6_device = { 376 423 .name = "sh-sci", 377 424 .id = 6, 425 + .resource = scif6_resources, 426 + .num_resources = ARRAY_SIZE(scif6_resources), 378 427 .dev = { 379 428 .platform_data = &scif6_platform_data, 380 429 }, 381 430 }; 382 431 383 432 static struct plat_sci_port scif7_platform_data = { 384 - .mapbase = 0xe800a800, 385 433 .flags = UPF_BOOT_AUTOCONF, 386 434 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 387 435 SCSCR_REIE | SCSCR_TOIE, 388 - .scbrr_algo_id = SCBRR_ALGO_2, 389 436 .type = PORT_SCIF, 390 - .irqs = { 287, 288, 289, 286 }, 391 437 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 438 + }; 439 + 440 + static struct resource scif7_resources[] = { 441 + DEFINE_RES_MEM(0xe800a800, 0x100), 442 + DEFINE_RES_IRQ(287), 443 + DEFINE_RES_IRQ(288), 444 + DEFINE_RES_IRQ(289), 445 + DEFINE_RES_IRQ(286), 392 446 }; 393 447 394 448 static struct platform_device scif7_device = { 395 449 .name = "sh-sci", 396 450 .id = 7, 451 + .resource = scif7_resources, 452 + .num_resources = ARRAY_SIZE(scif7_resources), 397 453 .dev = { 398 454 .platform_data = &scif7_platform_data, 399 455 },
+14 -6
arch/sh/kernel/cpu/sh3/setup-sh7705.c
··· 70 70 NULL, prio_registers, NULL); 71 71 72 72 static struct plat_sci_port scif0_platform_data = { 73 - .mapbase = 0xa4410000, 74 73 .flags = UPF_BOOT_AUTOCONF, 75 74 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE | 76 75 SCSCR_RE | SCSCR_CKE1 | SCSCR_CKE0, 77 - .scbrr_algo_id = SCBRR_ALGO_4, 78 76 .type = PORT_SCIF, 79 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 80 77 .ops = &sh770x_sci_port_ops, 81 78 .regtype = SCIx_SH7705_SCIF_REGTYPE, 79 + }; 80 + 81 + static struct resource scif0_resources[] = { 82 + DEFINE_RES_MEM(0xa4410000, 0x100), 83 + DEFINE_RES_IRQ(evt2irq(0x900)), 82 84 }; 83 85 84 86 static struct platform_device scif0_device = { 85 87 .name = "sh-sci", 86 88 .id = 0, 89 + .resource = scif0_resources, 90 + .num_resources = ARRAY_SIZE(scif0_resources), 87 91 .dev = { 88 92 .platform_data = &scif0_platform_data, 89 93 }, 90 94 }; 91 95 92 96 static struct plat_sci_port scif1_platform_data = { 93 - .mapbase = 0xa4400000, 94 97 .flags = UPF_BOOT_AUTOCONF, 95 98 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE | SCSCR_RE, 96 - .scbrr_algo_id = SCBRR_ALGO_4, 97 99 .type = PORT_SCIF, 98 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)), 99 100 .ops = &sh770x_sci_port_ops, 100 101 .regtype = SCIx_SH7705_SCIF_REGTYPE, 102 + }; 103 + 104 + static struct resource scif1_resources[] = { 105 + DEFINE_RES_MEM(0xa4400000, 0x100), 106 + DEFINE_RES_IRQ(evt2irq(0x880)), 101 107 }; 102 108 103 109 static struct platform_device scif1_device = { 104 110 .name = "sh-sci", 105 111 .id = 1, 112 + .resource = scif1_resources, 113 + .num_resources = ARRAY_SIZE(scif1_resources), 106 114 .dev = { 107 115 .platform_data = &scif1_platform_data, 108 116 },
+21 -9
arch/sh/kernel/cpu/sh3/setup-sh770x.c
··· 109 109 }; 110 110 111 111 static struct plat_sci_port scif0_platform_data = { 112 - .mapbase = 0xfffffe80, 113 112 .port_reg = 0xa4000136, 114 113 .flags = UPF_BOOT_AUTOCONF, 115 114 .scscr = SCSCR_TE | SCSCR_RE, 116 - .scbrr_algo_id = SCBRR_ALGO_2, 117 115 .type = PORT_SCI, 118 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x4e0)), 119 116 .ops = &sh770x_sci_port_ops, 120 117 .regshift = 1, 118 + }; 119 + 120 + static struct resource scif0_resources[] = { 121 + DEFINE_RES_MEM(0xfffffe80, 0x100), 122 + DEFINE_RES_IRQ(evt2irq(0x4e0)), 121 123 }; 122 124 123 125 static struct platform_device scif0_device = { 124 126 .name = "sh-sci", 125 127 .id = 0, 128 + .resource = scif0_resources, 129 + .num_resources = ARRAY_SIZE(scif0_resources), 126 130 .dev = { 127 131 .platform_data = &scif0_platform_data, 128 132 }, ··· 135 131 defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 136 132 defined(CONFIG_CPU_SUBTYPE_SH7709) 137 133 static struct plat_sci_port scif1_platform_data = { 138 - .mapbase = 0xa4000150, 139 134 .flags = UPF_BOOT_AUTOCONF, 140 135 .scscr = SCSCR_TE | SCSCR_RE, 141 - .scbrr_algo_id = SCBRR_ALGO_2, 142 136 .type = PORT_SCIF, 143 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 144 137 .ops = &sh770x_sci_port_ops, 145 138 .regtype = SCIx_SH3_SCIF_REGTYPE, 139 + }; 140 + 141 + static struct resource scif1_resources[] = { 142 + DEFINE_RES_MEM(0xa4000150, 0x100), 143 + DEFINE_RES_IRQ(evt2irq(0x900)), 146 144 }; 147 145 148 146 static struct platform_device scif1_device = { 149 147 .name = "sh-sci", 150 148 .id = 1, 149 + .resource = scif1_resources, 150 + .num_resources = ARRAY_SIZE(scif1_resources), 151 151 .dev = { 152 152 .platform_data = &scif1_platform_data, 153 153 }, ··· 160 152 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 161 153 defined(CONFIG_CPU_SUBTYPE_SH7709) 162 154 static struct plat_sci_port scif2_platform_data = { 163 - .mapbase = 0xa4000140, 164 155 .port_reg = SCIx_NOT_SUPPORTED, 165 156 .flags = UPF_BOOT_AUTOCONF, 166 157 .scscr = SCSCR_TE | SCSCR_RE, 167 - .scbrr_algo_id = SCBRR_ALGO_2, 168 158 .type = PORT_IRDA, 169 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)), 170 159 .ops = &sh770x_sci_port_ops, 171 160 .regshift = 1, 161 + }; 162 + 163 + static struct resource scif2_resources[] = { 164 + DEFINE_RES_MEM(0xa4000140, 0x100), 165 + DEFINE_RES_IRQ(evt2irq(0x880)), 172 166 }; 173 167 174 168 static struct platform_device scif2_device = { 175 169 .name = "sh-sci", 176 170 .id = 2, 171 + .resource = scif2_resources, 172 + .num_resources = ARRAY_SIZE(scif2_resources), 177 173 .dev = { 178 174 .platform_data = &scif2_platform_data, 179 175 },
+14 -6
arch/sh/kernel/cpu/sh3/setup-sh7710.c
··· 98 98 }; 99 99 100 100 static struct plat_sci_port scif0_platform_data = { 101 - .mapbase = 0xa4400000, 102 101 .flags = UPF_BOOT_AUTOCONF, 103 102 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE | 104 103 SCSCR_CKE1 | SCSCR_CKE0, 105 - .scbrr_algo_id = SCBRR_ALGO_2, 106 104 .type = PORT_SCIF, 107 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)), 105 + }; 106 + 107 + static struct resource scif0_resources[] = { 108 + DEFINE_RES_MEM(0xa4400000, 0x100), 109 + DEFINE_RES_IRQ(evt2irq(0x880)), 108 110 }; 109 111 110 112 static struct platform_device scif0_device = { 111 113 .name = "sh-sci", 112 114 .id = 0, 115 + .resource = scif0_resources, 116 + .num_resources = ARRAY_SIZE(scif0_resources), 113 117 .dev = { 114 118 .platform_data = &scif0_platform_data, 115 119 }, 116 120 }; 117 121 118 122 static struct plat_sci_port scif1_platform_data = { 119 - .mapbase = 0xa4410000, 120 123 .flags = UPF_BOOT_AUTOCONF, 121 124 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE | 122 125 SCSCR_CKE1 | SCSCR_CKE0, 123 - .scbrr_algo_id = SCBRR_ALGO_2, 124 126 .type = PORT_SCIF, 125 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 127 + }; 128 + 129 + static struct resource scif1_resources[] = { 130 + DEFINE_RES_MEM(0xa4410000, 0x100), 131 + DEFINE_RES_IRQ(evt2irq(0x900)), 126 132 }; 127 133 128 134 static struct platform_device scif1_device = { 129 135 .name = "sh-sci", 130 136 .id = 1, 137 + .resource = scif1_resources, 138 + .num_resources = ARRAY_SIZE(scif1_resources), 131 139 .dev = { 132 140 .platform_data = &scif1_platform_data, 133 141 },
+14 -6
arch/sh/kernel/cpu/sh3/setup-sh7720.c
··· 52 52 }; 53 53 54 54 static struct plat_sci_port scif0_platform_data = { 55 - .mapbase = 0xa4430000, 56 55 .flags = UPF_BOOT_AUTOCONF, 57 56 .scscr = SCSCR_RE | SCSCR_TE, 58 - .scbrr_algo_id = SCBRR_ALGO_4, 59 57 .type = PORT_SCIF, 60 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 61 58 .ops = &sh7720_sci_port_ops, 62 59 .regtype = SCIx_SH7705_SCIF_REGTYPE, 60 + }; 61 + 62 + static struct resource scif0_resources[] = { 63 + DEFINE_RES_MEM(0xa4430000, 0x100), 64 + DEFINE_RES_IRQ(evt2irq(0xc00)), 63 65 }; 64 66 65 67 static struct platform_device scif0_device = { 66 68 .name = "sh-sci", 67 69 .id = 0, 70 + .resource = scif0_resources, 71 + .num_resources = ARRAY_SIZE(scif0_resources), 68 72 .dev = { 69 73 .platform_data = &scif0_platform_data, 70 74 }, 71 75 }; 72 76 73 77 static struct plat_sci_port scif1_platform_data = { 74 - .mapbase = 0xa4438000, 75 78 .flags = UPF_BOOT_AUTOCONF, 76 79 .scscr = SCSCR_RE | SCSCR_TE, 77 - .scbrr_algo_id = SCBRR_ALGO_4, 78 80 .type = PORT_SCIF, 79 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)), 80 81 .ops = &sh7720_sci_port_ops, 81 82 .regtype = SCIx_SH7705_SCIF_REGTYPE, 83 + }; 84 + 85 + static struct resource scif1_resources[] = { 86 + DEFINE_RES_MEM(0xa4438000, 0x100), 87 + DEFINE_RES_IRQ(evt2irq(0xc20)), 82 88 }; 83 89 84 90 static struct platform_device scif1_device = { 85 91 .name = "sh-sci", 86 92 .id = 1, 93 + .resource = scif1_resources, 94 + .num_resources = ARRAY_SIZE(scif1_resources), 87 95 .dev = { 88 96 .platform_data = &scif1_platform_data, 89 97 },
+10 -6
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
··· 17 17 #include <linux/io.h> 18 18 19 19 static struct plat_sci_port scif0_platform_data = { 20 - .mapbase = 0xffe80000, 21 20 .flags = UPF_BOOT_AUTOCONF, 22 21 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 23 - .scbrr_algo_id = SCBRR_ALGO_2, 24 22 .type = PORT_SCIF, 25 - .irqs = { evt2irq(0x700), 26 - evt2irq(0x720), 27 - evt2irq(0x760), 28 - evt2irq(0x740) }, 23 + }; 24 + 25 + static struct resource scif0_resources[] = { 26 + DEFINE_RES_MEM(0xffe80000, 0x100), 27 + DEFINE_RES_IRQ(evt2irq(0x700)), 28 + DEFINE_RES_IRQ(evt2irq(0x720)), 29 + DEFINE_RES_IRQ(evt2irq(0x760)), 30 + DEFINE_RES_IRQ(evt2irq(0x740)), 29 31 }; 30 32 31 33 static struct platform_device scif0_device = { 32 34 .name = "sh-sci", 33 35 .id = 0, 36 + .resource = scif0_resources, 37 + .num_resources = ARRAY_SIZE(scif0_resources), 34 38 .dev = { 35 39 .platform_data = &scif0_platform_data, 36 40 },
+14 -6
arch/sh/kernel/cpu/sh4/setup-sh7750.c
··· 38 38 }; 39 39 40 40 static struct plat_sci_port sci_platform_data = { 41 - .mapbase = 0xffe00000, 42 41 .port_reg = 0xffe0001C, 43 42 .flags = UPF_BOOT_AUTOCONF, 44 43 .scscr = SCSCR_TE | SCSCR_RE, 45 - .scbrr_algo_id = SCBRR_ALGO_2, 46 44 .type = PORT_SCI, 47 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x4e0)), 48 45 .regshift = 2, 46 + }; 47 + 48 + static struct resource sci_resources[] = { 49 + DEFINE_RES_MEM(0xffe00000, 0x100), 50 + DEFINE_RES_IRQ(evt2irq(0x4e0)), 49 51 }; 50 52 51 53 static struct platform_device sci_device = { 52 54 .name = "sh-sci", 53 55 .id = 0, 56 + .resource = sci_resources, 57 + .num_resources = ARRAY_SIZE(sci_resources), 54 58 .dev = { 55 59 .platform_data = &sci_platform_data, 56 60 }, 57 61 }; 58 62 59 63 static struct plat_sci_port scif_platform_data = { 60 - .mapbase = 0xffe80000, 61 64 .flags = UPF_BOOT_AUTOCONF, 62 65 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE, 63 - .scbrr_algo_id = SCBRR_ALGO_2, 64 66 .type = PORT_SCIF, 65 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)), 67 + }; 68 + 69 + static struct resource scif_resources[] = { 70 + DEFINE_RES_MEM(0xffe80000, 0x100), 71 + DEFINE_RES_IRQ(evt2irq(0x700)), 66 72 }; 67 73 68 74 static struct platform_device scif_device = { 69 75 .name = "sh-sci", 70 76 .id = 1, 77 + .resource = scif_resources, 78 + .num_resources = ARRAY_SIZE(scif_resources), 71 79 .dev = { 72 80 .platform_data = &scif_platform_data, 73 81 },
+39 -23
arch/sh/kernel/cpu/sh4/setup-sh7760.c
··· 128 128 mask_registers, prio_registers, NULL); 129 129 130 130 static struct plat_sci_port scif0_platform_data = { 131 - .mapbase = 0xfe600000, 132 131 .flags = UPF_BOOT_AUTOCONF, 133 132 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 134 - .scbrr_algo_id = SCBRR_ALGO_2, 135 133 .type = PORT_SCIF, 136 - .irqs = { evt2irq(0x880), 137 - evt2irq(0x8a0), 138 - evt2irq(0x8e0), 139 - evt2irq(0x8c0) }, 140 134 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 135 + }; 136 + 137 + static struct resource scif0_resources[] = { 138 + DEFINE_RES_MEM(0xfe600000, 0x100), 139 + DEFINE_RES_IRQ(evt2irq(0x880)), 140 + DEFINE_RES_IRQ(evt2irq(0x8a0)), 141 + DEFINE_RES_IRQ(evt2irq(0x8e0)), 142 + DEFINE_RES_IRQ(evt2irq(0x8c0)), 141 143 }; 142 144 143 145 static struct platform_device scif0_device = { 144 146 .name = "sh-sci", 145 147 .id = 0, 148 + .resource = scif0_resources, 149 + .num_resources = ARRAY_SIZE(scif0_resources), 146 150 .dev = { 147 151 .platform_data = &scif0_platform_data, 148 152 }, 149 153 }; 150 154 151 155 static struct plat_sci_port scif1_platform_data = { 152 - .mapbase = 0xfe610000, 153 156 .flags = UPF_BOOT_AUTOCONF, 154 157 .type = PORT_SCIF, 155 158 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 156 - .scbrr_algo_id = SCBRR_ALGO_2, 157 - .irqs = { evt2irq(0xb00), 158 - evt2irq(0xb20), 159 - evt2irq(0xb60), 160 - evt2irq(0xb40) }, 161 159 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 160 + }; 161 + 162 + static struct resource scif1_resources[] = { 163 + DEFINE_RES_MEM(0xfe610000, 0x100), 164 + DEFINE_RES_IRQ(evt2irq(0xb00)), 165 + DEFINE_RES_IRQ(evt2irq(0xb20)), 166 + DEFINE_RES_IRQ(evt2irq(0xb60)), 167 + DEFINE_RES_IRQ(evt2irq(0xb40)), 162 168 }; 163 169 164 170 static struct platform_device scif1_device = { 165 171 .name = "sh-sci", 166 172 .id = 1, 173 + .resource = scif1_resources, 174 + .num_resources = ARRAY_SIZE(scif1_resources), 167 175 .dev = { 168 176 .platform_data = &scif1_platform_data, 169 177 }, 170 178 }; 171 179 172 180 static struct plat_sci_port scif2_platform_data = { 173 - .mapbase = 0xfe620000, 174 181 .flags = UPF_BOOT_AUTOCONF, 175 182 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 176 - .scbrr_algo_id = SCBRR_ALGO_2, 177 183 .type = PORT_SCIF, 178 - .irqs = { evt2irq(0xb80), 179 - evt2irq(0xba0), 180 - evt2irq(0xbe0), 181 - evt2irq(0xbc0) }, 182 184 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 185 + }; 186 + 187 + static struct resource scif2_resources[] = { 188 + DEFINE_RES_MEM(0xfe620000, 0x100), 189 + DEFINE_RES_IRQ(evt2irq(0xb80)), 190 + DEFINE_RES_IRQ(evt2irq(0xba0)), 191 + DEFINE_RES_IRQ(evt2irq(0xbe0)), 192 + DEFINE_RES_IRQ(evt2irq(0xbc0)), 183 193 }; 184 194 185 195 static struct platform_device scif2_device = { 186 196 .name = "sh-sci", 187 197 .id = 2, 198 + .resource = scif2_resources, 199 + .num_resources = ARRAY_SIZE(scif2_resources), 188 200 .dev = { 189 201 .platform_data = &scif2_platform_data, 190 202 }, 191 203 }; 192 204 193 205 static struct plat_sci_port scif3_platform_data = { 194 - .mapbase = 0xfe480000, 195 206 .flags = UPF_BOOT_AUTOCONF, 196 207 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 197 - .scbrr_algo_id = SCBRR_ALGO_2, 198 208 .type = PORT_SCI, 199 - .irqs = { evt2irq(0xc00), 200 - evt2irq(0xc20), 201 - evt2irq(0xc40), }, 202 209 .regshift = 2, 210 + }; 211 + 212 + static struct resource scif3_resources[] = { 213 + DEFINE_RES_MEM(0xfe480000, 0x100), 214 + DEFINE_RES_IRQ(evt2irq(0xc00)), 215 + DEFINE_RES_IRQ(evt2irq(0xc20)), 216 + DEFINE_RES_IRQ(evt2irq(0xc40)), 203 217 }; 204 218 205 219 static struct platform_device scif3_device = { 206 220 .name = "sh-sci", 207 221 .id = 3, 222 + .resource = scif3_resources, 223 + .num_resources = ARRAY_SIZE(scif3_resources), 208 224 .dev = { 209 225 .platform_data = &scif3_platform_data, 210 226 },
+28 -12
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
··· 18 18 19 19 /* Serial */ 20 20 static struct plat_sci_port scif0_platform_data = { 21 - .mapbase = 0xffe00000, 22 21 .flags = UPF_BOOT_AUTOCONF, 23 22 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 24 - .scbrr_algo_id = SCBRR_ALGO_2, 25 23 .type = PORT_SCIF, 26 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 24 + }; 25 + 26 + static struct resource scif0_resources[] = { 27 + DEFINE_RES_MEM(0xffe00000, 0x100), 28 + DEFINE_RES_IRQ(evt2irq(0xc00)), 27 29 }; 28 30 29 31 static struct platform_device scif0_device = { 30 32 .name = "sh-sci", 31 33 .id = 0, 34 + .resource = scif0_resources, 35 + .num_resources = ARRAY_SIZE(scif0_resources), 32 36 .dev = { 33 37 .platform_data = &scif0_platform_data, 34 38 }, 35 39 }; 36 40 37 41 static struct plat_sci_port scif1_platform_data = { 38 - .mapbase = 0xffe10000, 39 42 .flags = UPF_BOOT_AUTOCONF, 40 43 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 41 - .scbrr_algo_id = SCBRR_ALGO_2, 42 44 .type = PORT_SCIF, 43 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)), 45 + }; 46 + 47 + static struct resource scif1_resources[] = { 48 + DEFINE_RES_MEM(0xffe10000, 0x100), 49 + DEFINE_RES_IRQ(evt2irq(0xc20)), 44 50 }; 45 51 46 52 static struct platform_device scif1_device = { 47 53 .name = "sh-sci", 48 54 .id = 1, 55 + .resource = scif1_resources, 56 + .num_resources = ARRAY_SIZE(scif1_resources), 49 57 .dev = { 50 58 .platform_data = &scif1_platform_data, 51 59 }, 52 60 }; 53 61 54 62 static struct plat_sci_port scif2_platform_data = { 55 - .mapbase = 0xffe20000, 56 63 .flags = UPF_BOOT_AUTOCONF, 57 64 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 58 - .scbrr_algo_id = SCBRR_ALGO_2, 59 65 .type = PORT_SCIF, 60 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)), 66 + }; 67 + 68 + static struct resource scif2_resources[] = { 69 + DEFINE_RES_MEM(0xffe20000, 0x100), 70 + DEFINE_RES_IRQ(evt2irq(0xc40)), 61 71 }; 62 72 63 73 static struct platform_device scif2_device = { 64 74 .name = "sh-sci", 65 75 .id = 2, 76 + .resource = scif2_resources, 77 + .num_resources = ARRAY_SIZE(scif2_resources), 66 78 .dev = { 67 79 .platform_data = &scif2_platform_data, 68 80 }, 69 81 }; 70 82 71 83 static struct plat_sci_port scif3_platform_data = { 72 - .mapbase = 0xffe30000, 73 84 .flags = UPF_BOOT_AUTOCONF, 74 85 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 75 - .scbrr_algo_id = SCBRR_ALGO_2, 76 86 .type = PORT_SCIF, 77 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc60)), 87 + }; 88 + 89 + static struct resource scif3_resources[] = { 90 + DEFINE_RES_MEM(0xffe30000, 0x100), 91 + DEFINE_RES_IRQ(evt2irq(0xc60)), 78 92 }; 79 93 80 94 static struct platform_device scif3_device = { 81 95 .name = "sh-sci", 82 96 .id = 3, 97 + .resource = scif3_resources, 98 + .num_resources = ARRAY_SIZE(scif3_resources), 83 99 .dev = { 84 100 .platform_data = &scif3_platform_data, 85 101 },
+7 -3
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
··· 20 20 #include <asm/clock.h> 21 21 22 22 static struct plat_sci_port scif0_platform_data = { 23 - .mapbase = 0xffe00000, 24 23 .port_reg = 0xa405013e, 25 24 .flags = UPF_BOOT_AUTOCONF, 26 25 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 27 - .scbrr_algo_id = SCBRR_ALGO_2, 28 26 .type = PORT_SCIF, 29 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 27 + }; 28 + 29 + static struct resource scif0_resources[] = { 30 + DEFINE_RES_MEM(0xffe00000, 0x100), 31 + DEFINE_RES_IRQ(evt2irq(0xc00)), 30 32 }; 31 33 32 34 static struct platform_device scif0_device = { 33 35 .name = "sh-sci", 34 36 .id = 0, 37 + .resource = scif0_resources, 38 + .num_resources = ARRAY_SIZE(scif0_resources), 35 39 .dev = { 36 40 .platform_data = &scif0_platform_data, 37 41 },
+21 -9
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
··· 179 179 180 180 /* Serial */ 181 181 static struct plat_sci_port scif0_platform_data = { 182 - .mapbase = 0xffe00000, 183 182 .flags = UPF_BOOT_AUTOCONF, 184 183 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 185 - .scbrr_algo_id = SCBRR_ALGO_2, 186 184 .type = PORT_SCIF, 187 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 188 185 .ops = &sh7722_sci_port_ops, 189 186 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 187 + }; 188 + 189 + static struct resource scif0_resources[] = { 190 + DEFINE_RES_MEM(0xffe00000, 0x100), 191 + DEFINE_RES_IRQ(evt2irq(0xc00)), 190 192 }; 191 193 192 194 static struct platform_device scif0_device = { 193 195 .name = "sh-sci", 194 196 .id = 0, 197 + .resource = scif0_resources, 198 + .num_resources = ARRAY_SIZE(scif0_resources), 195 199 .dev = { 196 200 .platform_data = &scif0_platform_data, 197 201 }, 198 202 }; 199 203 200 204 static struct plat_sci_port scif1_platform_data = { 201 - .mapbase = 0xffe10000, 202 205 .flags = UPF_BOOT_AUTOCONF, 203 206 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 204 - .scbrr_algo_id = SCBRR_ALGO_2, 205 207 .type = PORT_SCIF, 206 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)), 207 208 .ops = &sh7722_sci_port_ops, 208 209 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 210 + }; 211 + 212 + static struct resource scif1_resources[] = { 213 + DEFINE_RES_MEM(0xffe10000, 0x100), 214 + DEFINE_RES_IRQ(evt2irq(0xc20)), 209 215 }; 210 216 211 217 static struct platform_device scif1_device = { 212 218 .name = "sh-sci", 213 219 .id = 1, 220 + .resource = scif1_resources, 221 + .num_resources = ARRAY_SIZE(scif1_resources), 214 222 .dev = { 215 223 .platform_data = &scif1_platform_data, 216 224 }, 217 225 }; 218 226 219 227 static struct plat_sci_port scif2_platform_data = { 220 - .mapbase = 0xffe20000, 221 228 .flags = UPF_BOOT_AUTOCONF, 222 229 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 223 - .scbrr_algo_id = SCBRR_ALGO_2, 224 230 .type = PORT_SCIF, 225 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)), 226 231 .ops = &sh7722_sci_port_ops, 227 232 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 233 + }; 234 + 235 + static struct resource scif2_resources[] = { 236 + DEFINE_RES_MEM(0xffe20000, 0x100), 237 + DEFINE_RES_IRQ(evt2irq(0xc40)), 228 238 }; 229 239 230 240 static struct platform_device scif2_device = { 231 241 .name = "sh-sci", 232 242 .id = 2, 243 + .resource = scif2_resources, 244 + .num_resources = ARRAY_SIZE(scif2_resources), 233 245 .dev = { 234 246 .platform_data = &scif2_platform_data, 235 247 },
+45 -18
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
··· 23 23 24 24 /* Serial */ 25 25 static struct plat_sci_port scif0_platform_data = { 26 - .mapbase = 0xffe00000, 27 26 .port_reg = 0xa4050160, 28 27 .flags = UPF_BOOT_AUTOCONF, 29 28 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 30 - .scbrr_algo_id = SCBRR_ALGO_2, 31 29 .type = PORT_SCIF, 32 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 33 30 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 31 + }; 32 + 33 + static struct resource scif0_resources[] = { 34 + DEFINE_RES_MEM(0xffe00000, 0x100), 35 + DEFINE_RES_IRQ(evt2irq(0xc00)), 34 36 }; 35 37 36 38 static struct platform_device scif0_device = { 37 39 .name = "sh-sci", 38 40 .id = 0, 41 + .resource = scif0_resources, 42 + .num_resources = ARRAY_SIZE(scif0_resources), 39 43 .dev = { 40 44 .platform_data = &scif0_platform_data, 41 45 }, 42 46 }; 43 47 44 48 static struct plat_sci_port scif1_platform_data = { 45 - .mapbase = 0xffe10000, 46 49 .port_reg = SCIx_NOT_SUPPORTED, 47 50 .flags = UPF_BOOT_AUTOCONF, 48 51 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 49 - .scbrr_algo_id = SCBRR_ALGO_2, 50 52 .type = PORT_SCIF, 51 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)), 52 53 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 54 + }; 55 + 56 + static struct resource scif1_resources[] = { 57 + DEFINE_RES_MEM(0xffe10000, 0x100), 58 + DEFINE_RES_IRQ(evt2irq(0xc20)), 53 59 }; 54 60 55 61 static struct platform_device scif1_device = { 56 62 .name = "sh-sci", 57 63 .id = 1, 64 + .resource = scif1_resources, 65 + .num_resources = ARRAY_SIZE(scif1_resources), 58 66 .dev = { 59 67 .platform_data = &scif1_platform_data, 60 68 }, 61 69 }; 62 70 63 71 static struct plat_sci_port scif2_platform_data = { 64 - .mapbase = 0xffe20000, 65 72 .port_reg = SCIx_NOT_SUPPORTED, 66 73 .flags = UPF_BOOT_AUTOCONF, 67 74 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 68 - .scbrr_algo_id = SCBRR_ALGO_2, 69 75 .type = PORT_SCIF, 70 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)), 71 76 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 77 + }; 78 + 79 + static struct resource scif2_resources[] = { 80 + DEFINE_RES_MEM(0xffe20000, 0x100), 81 + DEFINE_RES_IRQ(evt2irq(0xc40)), 72 82 }; 73 83 74 84 static struct platform_device scif2_device = { 75 85 .name = "sh-sci", 76 86 .id = 2, 87 + .resource = scif2_resources, 88 + .num_resources = ARRAY_SIZE(scif2_resources), 77 89 .dev = { 78 90 .platform_data = &scif2_platform_data, 79 91 }, 80 92 }; 81 93 82 94 static struct plat_sci_port scif3_platform_data = { 83 - .mapbase = 0xa4e30000, 84 95 .flags = UPF_BOOT_AUTOCONF, 85 96 .port_reg = SCIx_NOT_SUPPORTED, 86 97 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 87 - .scbrr_algo_id = SCBRR_ALGO_3, 98 + .sampling_rate = 8, 88 99 .type = PORT_SCIFA, 89 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 100 + }; 101 + 102 + static struct resource scif3_resources[] = { 103 + DEFINE_RES_MEM(0xa4e30000, 0x100), 104 + DEFINE_RES_IRQ(evt2irq(0x900)), 90 105 }; 91 106 92 107 static struct platform_device scif3_device = { 93 108 .name = "sh-sci", 94 109 .id = 3, 110 + .resource = scif3_resources, 111 + .num_resources = ARRAY_SIZE(scif3_resources), 95 112 .dev = { 96 113 .platform_data = &scif3_platform_data, 97 114 }, 98 115 }; 99 116 100 117 static struct plat_sci_port scif4_platform_data = { 101 - .mapbase = 0xa4e40000, 102 118 .port_reg = SCIx_NOT_SUPPORTED, 103 119 .flags = UPF_BOOT_AUTOCONF, 104 120 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 105 - .scbrr_algo_id = SCBRR_ALGO_3, 121 + .sampling_rate = 8, 106 122 .type = PORT_SCIFA, 107 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xd00)), 123 + }; 124 + 125 + static struct resource scif4_resources[] = { 126 + DEFINE_RES_MEM(0xa4e40000, 0x100), 127 + DEFINE_RES_IRQ(evt2irq(0xd00)), 108 128 }; 109 129 110 130 static struct platform_device scif4_device = { 111 131 .name = "sh-sci", 112 132 .id = 4, 133 + .resource = scif4_resources, 134 + .num_resources = ARRAY_SIZE(scif4_resources), 113 135 .dev = { 114 136 .platform_data = &scif4_platform_data, 115 137 }, 116 138 }; 117 139 118 140 static struct plat_sci_port scif5_platform_data = { 119 - .mapbase = 0xa4e50000, 120 141 .port_reg = SCIx_NOT_SUPPORTED, 121 142 .flags = UPF_BOOT_AUTOCONF, 122 143 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 123 - .scbrr_algo_id = SCBRR_ALGO_3, 144 + .sampling_rate = 8, 124 145 .type = PORT_SCIFA, 125 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xfa0)), 146 + }; 147 + 148 + static struct resource scif5_resources[] = { 149 + DEFINE_RES_MEM(0xa4e50000, 0x100), 150 + DEFINE_RES_IRQ(evt2irq(0xfa0)), 126 151 }; 127 152 128 153 static struct platform_device scif5_device = { 129 154 .name = "sh-sci", 130 155 .id = 5, 156 + .resource = scif5_resources, 157 + .num_resources = ARRAY_SIZE(scif5_resources), 131 158 .dev = { 132 159 .platform_data = &scif5_platform_data, 133 160 },
+45 -18
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
··· 290 290 291 291 /* Serial */ 292 292 static struct plat_sci_port scif0_platform_data = { 293 - .mapbase = 0xffe00000, 294 293 .port_reg = SCIx_NOT_SUPPORTED, 295 294 .flags = UPF_BOOT_AUTOCONF, 296 295 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 297 - .scbrr_algo_id = SCBRR_ALGO_2, 298 296 .type = PORT_SCIF, 299 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 300 297 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 298 + }; 299 + 300 + static struct resource scif0_resources[] = { 301 + DEFINE_RES_MEM(0xffe00000, 0x100), 302 + DEFINE_RES_IRQ(evt2irq(0xc00)), 301 303 }; 302 304 303 305 static struct platform_device scif0_device = { 304 306 .name = "sh-sci", 305 307 .id = 0, 308 + .resource = scif0_resources, 309 + .num_resources = ARRAY_SIZE(scif0_resources), 306 310 .dev = { 307 311 .platform_data = &scif0_platform_data, 308 312 }, 309 313 }; 310 314 311 315 static struct plat_sci_port scif1_platform_data = { 312 - .mapbase = 0xffe10000, 313 316 .port_reg = SCIx_NOT_SUPPORTED, 314 317 .flags = UPF_BOOT_AUTOCONF, 315 318 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 316 - .scbrr_algo_id = SCBRR_ALGO_2, 317 319 .type = PORT_SCIF, 318 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)), 319 320 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 321 + }; 322 + 323 + static struct resource scif1_resources[] = { 324 + DEFINE_RES_MEM(0xffe10000, 0x100), 325 + DEFINE_RES_IRQ(evt2irq(0xc20)), 320 326 }; 321 327 322 328 static struct platform_device scif1_device = { 323 329 .name = "sh-sci", 324 330 .id = 1, 331 + .resource = scif1_resources, 332 + .num_resources = ARRAY_SIZE(scif1_resources), 325 333 .dev = { 326 334 .platform_data = &scif1_platform_data, 327 335 }, 328 336 }; 329 337 330 338 static struct plat_sci_port scif2_platform_data = { 331 - .mapbase = 0xffe20000, 332 339 .port_reg = SCIx_NOT_SUPPORTED, 333 340 .flags = UPF_BOOT_AUTOCONF, 334 341 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 335 - .scbrr_algo_id = SCBRR_ALGO_2, 336 342 .type = PORT_SCIF, 337 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)), 338 343 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 344 + }; 345 + 346 + static struct resource scif2_resources[] = { 347 + DEFINE_RES_MEM(0xffe20000, 0x100), 348 + DEFINE_RES_IRQ(evt2irq(0xc40)), 339 349 }; 340 350 341 351 static struct platform_device scif2_device = { 342 352 .name = "sh-sci", 343 353 .id = 2, 354 + .resource = scif2_resources, 355 + .num_resources = ARRAY_SIZE(scif2_resources), 344 356 .dev = { 345 357 .platform_data = &scif2_platform_data, 346 358 }, 347 359 }; 348 360 349 361 static struct plat_sci_port scif3_platform_data = { 350 - .mapbase = 0xa4e30000, 351 362 .port_reg = SCIx_NOT_SUPPORTED, 352 363 .flags = UPF_BOOT_AUTOCONF, 353 364 .scscr = SCSCR_RE | SCSCR_TE, 354 - .scbrr_algo_id = SCBRR_ALGO_3, 365 + .sampling_rate = 8, 355 366 .type = PORT_SCIFA, 356 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 367 + }; 368 + 369 + static struct resource scif3_resources[] = { 370 + DEFINE_RES_MEM(0xa4e30000, 0x100), 371 + DEFINE_RES_IRQ(evt2irq(0x900)), 357 372 }; 358 373 359 374 static struct platform_device scif3_device = { 360 375 .name = "sh-sci", 361 376 .id = 3, 377 + .resource = scif3_resources, 378 + .num_resources = ARRAY_SIZE(scif3_resources), 362 379 .dev = { 363 380 .platform_data = &scif3_platform_data, 364 381 }, 365 382 }; 366 383 367 384 static struct plat_sci_port scif4_platform_data = { 368 - .mapbase = 0xa4e40000, 369 385 .port_reg = SCIx_NOT_SUPPORTED, 370 386 .flags = UPF_BOOT_AUTOCONF, 371 387 .scscr = SCSCR_RE | SCSCR_TE, 372 - .scbrr_algo_id = SCBRR_ALGO_3, 388 + .sampling_rate = 8, 373 389 .type = PORT_SCIFA, 374 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xd00)), 390 + }; 391 + 392 + static struct resource scif4_resources[] = { 393 + DEFINE_RES_MEM(0xa4e40000, 0x100), 394 + DEFINE_RES_IRQ(evt2irq(0xd00)), 375 395 }; 376 396 377 397 static struct platform_device scif4_device = { 378 398 .name = "sh-sci", 379 399 .id = 4, 400 + .resource = scif4_resources, 401 + .num_resources = ARRAY_SIZE(scif4_resources), 380 402 .dev = { 381 403 .platform_data = &scif4_platform_data, 382 404 }, 383 405 }; 384 406 385 407 static struct plat_sci_port scif5_platform_data = { 386 - .mapbase = 0xa4e50000, 387 408 .port_reg = SCIx_NOT_SUPPORTED, 388 409 .flags = UPF_BOOT_AUTOCONF, 389 410 .scscr = SCSCR_RE | SCSCR_TE, 390 - .scbrr_algo_id = SCBRR_ALGO_3, 411 + .sampling_rate = 8, 391 412 .type = PORT_SCIFA, 392 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xfa0)), 413 + }; 414 + 415 + static struct resource scif5_resources[] = { 416 + DEFINE_RES_MEM(0xa4e50000, 0x100), 417 + DEFINE_RES_IRQ(evt2irq(0xfa0)), 393 418 }; 394 419 395 420 static struct platform_device scif5_device = { 396 421 .name = "sh-sci", 397 422 .id = 5, 423 + .resource = scif5_resources, 424 + .num_resources = ARRAY_SIZE(scif5_resources), 398 425 .dev = { 399 426 .platform_data = &scif5_platform_data, 400 427 },
+48 -24
arch/sh/kernel/cpu/sh4a/setup-sh7734.c
··· 25 25 26 26 /* SCIF */ 27 27 static struct plat_sci_port scif0_platform_data = { 28 - .mapbase = 0xFFE40000, 29 28 .flags = UPF_BOOT_AUTOCONF, 30 29 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 31 - .scbrr_algo_id = SCBRR_ALGO_2, 32 30 .type = PORT_SCIF, 33 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x8C0)), 34 31 .regtype = SCIx_SH4_SCIF_REGTYPE, 32 + }; 33 + 34 + static struct resource scif0_resources[] = { 35 + DEFINE_RES_MEM(0xffe40000, 0x100), 36 + DEFINE_RES_IRQ(evt2irq(0x8c0)), 35 37 }; 36 38 37 39 static struct platform_device scif0_device = { 38 40 .name = "sh-sci", 39 - .id = 0, 41 + .id = 0, 42 + .resource = scif0_resources, 43 + .num_resources = ARRAY_SIZE(scif0_resources), 40 44 .dev = { 41 45 .platform_data = &scif0_platform_data, 42 46 }, 43 47 }; 44 48 45 49 static struct plat_sci_port scif1_platform_data = { 46 - .mapbase = 0xFFE41000, 47 50 .flags = UPF_BOOT_AUTOCONF, 48 51 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 49 - .scbrr_algo_id = SCBRR_ALGO_2, 50 52 .type = PORT_SCIF, 51 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x8E0)), 52 53 .regtype = SCIx_SH4_SCIF_REGTYPE, 54 + }; 55 + 56 + static struct resource scif1_resources[] = { 57 + DEFINE_RES_MEM(0xffe41000, 0x100), 58 + DEFINE_RES_IRQ(evt2irq(0x8e0)), 53 59 }; 54 60 55 61 static struct platform_device scif1_device = { 56 62 .name = "sh-sci", 57 - .id = 1, 63 + .id = 1, 64 + .resource = scif1_resources, 65 + .num_resources = ARRAY_SIZE(scif1_resources), 58 66 .dev = { 59 67 .platform_data = &scif1_platform_data, 60 68 }, 61 69 }; 62 70 63 71 static struct plat_sci_port scif2_platform_data = { 64 - .mapbase = 0xFFE42000, 65 72 .flags = UPF_BOOT_AUTOCONF, 66 73 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 67 - .scbrr_algo_id = SCBRR_ALGO_2, 68 74 .type = PORT_SCIF, 69 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 70 75 .regtype = SCIx_SH4_SCIF_REGTYPE, 76 + }; 77 + 78 + static struct resource scif2_resources[] = { 79 + DEFINE_RES_MEM(0xffe42000, 0x100), 80 + DEFINE_RES_IRQ(evt2irq(0x900)), 71 81 }; 72 82 73 83 static struct platform_device scif2_device = { 74 84 .name = "sh-sci", 75 - .id = 2, 85 + .id = 2, 86 + .resource = scif2_resources, 87 + .num_resources = ARRAY_SIZE(scif2_resources), 76 88 .dev = { 77 89 .platform_data = &scif2_platform_data, 78 90 }, 79 91 }; 80 92 81 93 static struct plat_sci_port scif3_platform_data = { 82 - .mapbase = 0xFFE43000, 83 94 .flags = UPF_BOOT_AUTOCONF, 84 95 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 85 - .scbrr_algo_id = SCBRR_ALGO_2, 86 96 .type = PORT_SCIF, 87 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x920)), 88 97 .regtype = SCIx_SH4_SCIF_REGTYPE, 98 + }; 99 + 100 + static struct resource scif3_resources[] = { 101 + DEFINE_RES_MEM(0xffe43000, 0x100), 102 + DEFINE_RES_IRQ(evt2irq(0x920)), 89 103 }; 90 104 91 105 static struct platform_device scif3_device = { 92 106 .name = "sh-sci", 93 - .id = 3, 107 + .id = 3, 108 + .resource = scif3_resources, 109 + .num_resources = ARRAY_SIZE(scif3_resources), 94 110 .dev = { 95 111 .platform_data = &scif3_platform_data, 96 112 }, 97 113 }; 98 114 99 115 static struct plat_sci_port scif4_platform_data = { 100 - .mapbase = 0xFFE44000, 101 116 .flags = UPF_BOOT_AUTOCONF, 102 117 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 103 - .scbrr_algo_id = SCBRR_ALGO_2, 104 118 .type = PORT_SCIF, 105 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x940)), 106 119 .regtype = SCIx_SH4_SCIF_REGTYPE, 120 + }; 121 + 122 + static struct resource scif4_resources[] = { 123 + DEFINE_RES_MEM(0xffe44000, 0x100), 124 + DEFINE_RES_IRQ(evt2irq(0x940)), 107 125 }; 108 126 109 127 static struct platform_device scif4_device = { 110 128 .name = "sh-sci", 111 - .id = 4, 129 + .id = 4, 130 + .resource = scif4_resources, 131 + .num_resources = ARRAY_SIZE(scif4_resources), 112 132 .dev = { 113 133 .platform_data = &scif4_platform_data, 114 134 }, 115 135 }; 116 136 117 137 static struct plat_sci_port scif5_platform_data = { 118 - .mapbase = 0xFFE43000, 119 138 .flags = UPF_BOOT_AUTOCONF, 120 139 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 121 - .scbrr_algo_id = SCBRR_ALGO_2, 122 140 .type = PORT_SCIF, 123 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x960)), 124 141 .regtype = SCIx_SH4_SCIF_REGTYPE, 142 + }; 143 + 144 + static struct resource scif5_resources[] = { 145 + DEFINE_RES_MEM(0xffe43000, 0x100), 146 + DEFINE_RES_IRQ(evt2irq(0x960)), 125 147 }; 126 148 127 149 static struct platform_device scif5_device = { 128 150 .name = "sh-sci", 129 - .id = 5, 151 + .id = 5, 152 + .resource = scif5_resources, 153 + .num_resources = ARRAY_SIZE(scif5_resources), 130 154 .dev = { 131 155 .platform_data = &scif5_platform_data, 132 156 },
+21 -9
arch/sh/kernel/cpu/sh4a/setup-sh7757.c
··· 24 24 #include <cpu/sh7757.h> 25 25 26 26 static struct plat_sci_port scif2_platform_data = { 27 - .mapbase = 0xfe4b0000, /* SCIF2 */ 28 27 .flags = UPF_BOOT_AUTOCONF, 29 28 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 30 - .scbrr_algo_id = SCBRR_ALGO_2, 31 29 .type = PORT_SCIF, 32 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)), 30 + }; 31 + 32 + static struct resource scif2_resources[] = { 33 + DEFINE_RES_MEM(0xfe4b0000, 0x100), /* SCIF2 */ 34 + DEFINE_RES_IRQ(evt2irq(0x700)), 33 35 }; 34 36 35 37 static struct platform_device scif2_device = { 36 38 .name = "sh-sci", 37 39 .id = 0, 40 + .resource = scif2_resources, 41 + .num_resources = ARRAY_SIZE(scif2_resources), 38 42 .dev = { 39 43 .platform_data = &scif2_platform_data, 40 44 }, 41 45 }; 42 46 43 47 static struct plat_sci_port scif3_platform_data = { 44 - .mapbase = 0xfe4c0000, /* SCIF3 */ 45 48 .flags = UPF_BOOT_AUTOCONF, 46 49 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 47 - .scbrr_algo_id = SCBRR_ALGO_2, 48 50 .type = PORT_SCIF, 49 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xb80)), 51 + }; 52 + 53 + static struct resource scif3_resources[] = { 54 + DEFINE_RES_MEM(0xfe4c0000, 0x100), /* SCIF3 */ 55 + DEFINE_RES_IRQ(evt2irq(0xb80)), 50 56 }; 51 57 52 58 static struct platform_device scif3_device = { 53 59 .name = "sh-sci", 54 60 .id = 1, 61 + .resource = scif3_resources, 62 + .num_resources = ARRAY_SIZE(scif3_resources), 55 63 .dev = { 56 64 .platform_data = &scif3_platform_data, 57 65 }, 58 66 }; 59 67 60 68 static struct plat_sci_port scif4_platform_data = { 61 - .mapbase = 0xfe4d0000, /* SCIF4 */ 62 69 .flags = UPF_BOOT_AUTOCONF, 63 70 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 64 - .scbrr_algo_id = SCBRR_ALGO_2, 65 71 .type = PORT_SCIF, 66 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xF00)), 72 + }; 73 + 74 + static struct resource scif4_resources[] = { 75 + DEFINE_RES_MEM(0xfe4d0000, 0x100), /* SCIF4 */ 76 + DEFINE_RES_IRQ(evt2irq(0xf00)), 67 77 }; 68 78 69 79 static struct platform_device scif4_device = { 70 80 .name = "sh-sci", 71 81 .id = 2, 82 + .resource = scif4_resources, 83 + .num_resources = ARRAY_SIZE(scif4_resources), 72 84 .dev = { 73 85 .platform_data = &scif4_platform_data, 74 86 },
+21 -9
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
··· 19 19 #include <linux/usb/ohci_pdriver.h> 20 20 21 21 static struct plat_sci_port scif0_platform_data = { 22 - .mapbase = 0xffe00000, 23 22 .flags = UPF_BOOT_AUTOCONF, 24 23 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 25 - .scbrr_algo_id = SCBRR_ALGO_2, 26 24 .type = PORT_SCIF, 27 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)), 28 25 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 26 + }; 27 + 28 + static struct resource scif0_resources[] = { 29 + DEFINE_RES_MEM(0xffe00000, 0x100), 30 + DEFINE_RES_IRQ(evt2irq(0x700)), 29 31 }; 30 32 31 33 static struct platform_device scif0_device = { 32 34 .name = "sh-sci", 33 35 .id = 0, 36 + .resource = scif0_resources, 37 + .num_resources = ARRAY_SIZE(scif0_resources), 34 38 .dev = { 35 39 .platform_data = &scif0_platform_data, 36 40 }, 37 41 }; 38 42 39 43 static struct plat_sci_port scif1_platform_data = { 40 - .mapbase = 0xffe08000, 41 44 .flags = UPF_BOOT_AUTOCONF, 42 45 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 43 - .scbrr_algo_id = SCBRR_ALGO_2, 44 46 .type = PORT_SCIF, 45 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xb80)), 46 47 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 48 + }; 49 + 50 + static struct resource scif1_resources[] = { 51 + DEFINE_RES_MEM(0xffe08000, 0x100), 52 + DEFINE_RES_IRQ(evt2irq(0xb80)), 47 53 }; 48 54 49 55 static struct platform_device scif1_device = { 50 56 .name = "sh-sci", 51 57 .id = 1, 58 + .resource = scif1_resources, 59 + .num_resources = ARRAY_SIZE(scif1_resources), 52 60 .dev = { 53 61 .platform_data = &scif1_platform_data, 54 62 }, 55 63 }; 56 64 57 65 static struct plat_sci_port scif2_platform_data = { 58 - .mapbase = 0xffe10000, 59 66 .flags = UPF_BOOT_AUTOCONF, 60 67 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 61 - .scbrr_algo_id = SCBRR_ALGO_2, 62 68 .type = PORT_SCIF, 63 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xf00)), 64 69 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 70 + }; 71 + 72 + static struct resource scif2_resources[] = { 73 + DEFINE_RES_MEM(0xffe10000, 0x100), 74 + DEFINE_RES_IRQ(evt2irq(0xf00)), 65 75 }; 66 76 67 77 static struct platform_device scif2_device = { 68 78 .name = "sh-sci", 69 79 .id = 2, 80 + .resource = scif2_resources, 81 + .num_resources = ARRAY_SIZE(scif2_resources), 70 82 .dev = { 71 83 .platform_data = &scif2_platform_data, 72 84 },
+70 -30
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
··· 16 16 #include <linux/io.h> 17 17 18 18 static struct plat_sci_port scif0_platform_data = { 19 - .mapbase = 0xff923000, 20 19 .flags = UPF_BOOT_AUTOCONF, 21 20 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 22 - .scbrr_algo_id = SCBRR_ALGO_2, 23 21 .type = PORT_SCIF, 24 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x9a0)), 22 + }; 23 + 24 + static struct resource scif0_resources[] = { 25 + DEFINE_RES_MEM(0xff923000, 0x100), 26 + DEFINE_RES_IRQ(evt2irq(0x9a0)), 25 27 }; 26 28 27 29 static struct platform_device scif0_device = { 28 30 .name = "sh-sci", 29 31 .id = 0, 32 + .resource = scif0_resources, 33 + .num_resources = ARRAY_SIZE(scif0_resources), 30 34 .dev = { 31 35 .platform_data = &scif0_platform_data, 32 36 }, 33 37 }; 34 38 35 39 static struct plat_sci_port scif1_platform_data = { 36 - .mapbase = 0xff924000, 37 40 .flags = UPF_BOOT_AUTOCONF, 38 41 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 39 - .scbrr_algo_id = SCBRR_ALGO_2, 40 42 .type = PORT_SCIF, 41 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x9c0)), 43 + }; 44 + 45 + static struct resource scif1_resources[] = { 46 + DEFINE_RES_MEM(0xff924000, 0x100), 47 + DEFINE_RES_IRQ(evt2irq(0x9c0)), 42 48 }; 43 49 44 50 static struct platform_device scif1_device = { 45 51 .name = "sh-sci", 46 52 .id = 1, 53 + .resource = scif1_resources, 54 + .num_resources = ARRAY_SIZE(scif1_resources), 47 55 .dev = { 48 56 .platform_data = &scif1_platform_data, 49 57 }, 50 58 }; 51 59 52 60 static struct plat_sci_port scif2_platform_data = { 53 - .mapbase = 0xff925000, 54 61 .flags = UPF_BOOT_AUTOCONF, 55 62 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 56 - .scbrr_algo_id = SCBRR_ALGO_2, 57 63 .type = PORT_SCIF, 58 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x9e0)), 64 + }; 65 + 66 + static struct resource scif2_resources[] = { 67 + DEFINE_RES_MEM(0xff925000, 0x100), 68 + DEFINE_RES_IRQ(evt2irq(0x9e0)), 59 69 }; 60 70 61 71 static struct platform_device scif2_device = { 62 72 .name = "sh-sci", 63 73 .id = 2, 74 + .resource = scif2_resources, 75 + .num_resources = ARRAY_SIZE(scif2_resources), 64 76 .dev = { 65 77 .platform_data = &scif2_platform_data, 66 78 }, 67 79 }; 68 80 69 81 static struct plat_sci_port scif3_platform_data = { 70 - .mapbase = 0xff926000, 71 82 .flags = UPF_BOOT_AUTOCONF, 72 83 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 73 - .scbrr_algo_id = SCBRR_ALGO_2, 74 84 .type = PORT_SCIF, 75 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xa00)), 85 + }; 86 + 87 + static struct resource scif3_resources[] = { 88 + DEFINE_RES_MEM(0xff926000, 0x100), 89 + DEFINE_RES_IRQ(evt2irq(0xa00)), 76 90 }; 77 91 78 92 static struct platform_device scif3_device = { 79 93 .name = "sh-sci", 80 94 .id = 3, 95 + .resource = scif3_resources, 96 + .num_resources = ARRAY_SIZE(scif3_resources), 81 97 .dev = { 82 98 .platform_data = &scif3_platform_data, 83 99 }, 84 100 }; 85 101 86 102 static struct plat_sci_port scif4_platform_data = { 87 - .mapbase = 0xff927000, 88 103 .flags = UPF_BOOT_AUTOCONF, 89 104 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 90 - .scbrr_algo_id = SCBRR_ALGO_2, 91 105 .type = PORT_SCIF, 92 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xa20)), 106 + }; 107 + 108 + static struct resource scif4_resources[] = { 109 + DEFINE_RES_MEM(0xff927000, 0x100), 110 + DEFINE_RES_IRQ(evt2irq(0xa20)), 93 111 }; 94 112 95 113 static struct platform_device scif4_device = { 96 114 .name = "sh-sci", 97 115 .id = 4, 116 + .resource = scif4_resources, 117 + .num_resources = ARRAY_SIZE(scif4_resources), 98 118 .dev = { 99 119 .platform_data = &scif4_platform_data, 100 120 }, 101 121 }; 102 122 103 123 static struct plat_sci_port scif5_platform_data = { 104 - .mapbase = 0xff928000, 105 124 .flags = UPF_BOOT_AUTOCONF, 106 125 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 107 - .scbrr_algo_id = SCBRR_ALGO_2, 108 126 .type = PORT_SCIF, 109 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xa40)), 127 + }; 128 + 129 + static struct resource scif5_resources[] = { 130 + DEFINE_RES_MEM(0xff928000, 0x100), 131 + DEFINE_RES_IRQ(evt2irq(0xa40)), 110 132 }; 111 133 112 134 static struct platform_device scif5_device = { 113 135 .name = "sh-sci", 114 136 .id = 5, 137 + .resource = scif5_resources, 138 + .num_resources = ARRAY_SIZE(scif5_resources), 115 139 .dev = { 116 140 .platform_data = &scif5_platform_data, 117 141 }, 118 142 }; 119 143 120 144 static struct plat_sci_port scif6_platform_data = { 121 - .mapbase = 0xff929000, 122 145 .flags = UPF_BOOT_AUTOCONF, 123 146 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 124 - .scbrr_algo_id = SCBRR_ALGO_2, 125 147 .type = PORT_SCIF, 126 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xa60)), 148 + }; 149 + 150 + static struct resource scif6_resources[] = { 151 + DEFINE_RES_MEM(0xff929000, 0x100), 152 + DEFINE_RES_IRQ(evt2irq(0xa60)), 127 153 }; 128 154 129 155 static struct platform_device scif6_device = { 130 156 .name = "sh-sci", 131 157 .id = 6, 158 + .resource = scif6_resources, 159 + .num_resources = ARRAY_SIZE(scif6_resources), 132 160 .dev = { 133 161 .platform_data = &scif6_platform_data, 134 162 }, 135 163 }; 136 164 137 165 static struct plat_sci_port scif7_platform_data = { 138 - .mapbase = 0xff92a000, 139 166 .flags = UPF_BOOT_AUTOCONF, 140 167 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 141 - .scbrr_algo_id = SCBRR_ALGO_2, 142 168 .type = PORT_SCIF, 143 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xa80)), 169 + }; 170 + 171 + static struct resource scif7_resources[] = { 172 + DEFINE_RES_MEM(0xff92a000, 0x100), 173 + DEFINE_RES_IRQ(evt2irq(0xa80)), 144 174 }; 145 175 146 176 static struct platform_device scif7_device = { 147 177 .name = "sh-sci", 148 178 .id = 7, 179 + .resource = scif7_resources, 180 + .num_resources = ARRAY_SIZE(scif7_resources), 149 181 .dev = { 150 182 .platform_data = &scif7_platform_data, 151 183 }, 152 184 }; 153 185 154 186 static struct plat_sci_port scif8_platform_data = { 155 - .mapbase = 0xff92b000, 156 187 .flags = UPF_BOOT_AUTOCONF, 157 188 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 158 - .scbrr_algo_id = SCBRR_ALGO_2, 159 189 .type = PORT_SCIF, 160 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xaa0)), 190 + }; 191 + 192 + static struct resource scif8_resources[] = { 193 + DEFINE_RES_MEM(0xff92b000, 0x100), 194 + DEFINE_RES_IRQ(evt2irq(0xaa0)), 161 195 }; 162 196 163 197 static struct platform_device scif8_device = { 164 198 .name = "sh-sci", 165 199 .id = 8, 200 + .resource = scif8_resources, 201 + .num_resources = ARRAY_SIZE(scif8_resources), 166 202 .dev = { 167 203 .platform_data = &scif8_platform_data, 168 204 }, 169 205 }; 170 206 171 207 static struct plat_sci_port scif9_platform_data = { 172 - .mapbase = 0xff92c000, 173 208 .flags = UPF_BOOT_AUTOCONF, 174 209 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 175 - .scbrr_algo_id = SCBRR_ALGO_2, 176 210 .type = PORT_SCIF, 177 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xac0)), 211 + }; 212 + 213 + static struct resource scif9_resources[] = { 214 + DEFINE_RES_MEM(0xff92c000, 0x100), 215 + DEFINE_RES_IRQ(evt2irq(0xac0)), 178 216 }; 179 217 180 218 static struct platform_device scif9_device = { 181 219 .name = "sh-sci", 182 220 .id = 9, 221 + .resource = scif9_resources, 222 + .num_resources = ARRAY_SIZE(scif9_resources), 183 223 .dev = { 184 224 .platform_data = &scif9_platform_data, 185 225 },
+14 -8
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
··· 18 18 #include <cpu/dma-register.h> 19 19 20 20 static struct plat_sci_port scif0_platform_data = { 21 - .mapbase = 0xffe00000, 22 21 .flags = UPF_BOOT_AUTOCONF, 23 22 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 24 - .scbrr_algo_id = SCBRR_ALGO_1, 25 23 .type = PORT_SCIF, 26 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)), 27 24 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 25 + }; 26 + 27 + static struct resource scif0_resources[] = { 28 + DEFINE_RES_MEM(0xffe00000, 0x100), 29 + DEFINE_RES_IRQ(evt2irq(0x700)), 28 30 }; 29 31 30 32 static struct platform_device scif0_device = { 31 33 .name = "sh-sci", 32 34 .id = 0, 35 + .resource = scif0_resources, 36 + .num_resources = ARRAY_SIZE(scif0_resources), 33 37 .dev = { 34 38 .platform_data = &scif0_platform_data, 35 39 }, 36 40 }; 37 41 38 42 static struct plat_sci_port scif1_platform_data = { 39 - .mapbase = 0xffe10000, 40 43 .flags = UPF_BOOT_AUTOCONF, 41 44 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 42 - .scbrr_algo_id = SCBRR_ALGO_1, 43 45 .type = PORT_SCIF, 44 - .irqs = SCIx_IRQ_MUXED(evt2irq(0xb80)), 45 46 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 47 + }; 48 + 49 + static struct resource scif1_resources[] = { 50 + DEFINE_RES_MEM(0xffe10000, 0x100), 51 + DEFINE_RES_IRQ(evt2irq(0xb80)), 46 52 }; 47 53 48 54 static struct platform_device scif1_device = { 49 55 .name = "sh-sci", 50 56 .id = 1, 57 + .resource = scif1_resources, 58 + .num_resources = ARRAY_SIZE(scif1_resources), 51 59 .dev = { 52 60 .platform_data = &scif1_platform_data, 53 61 }, ··· 417 409 { 418 410 if (mach_is_sh2007()) { 419 411 scif0_platform_data.scscr &= ~SCSCR_CKE1; 420 - scif0_platform_data.scbrr_algo_id = SCBRR_ALGO_2; 421 412 scif1_platform_data.scscr &= ~SCSCR_CKE1; 422 - scif1_platform_data.scbrr_algo_id = SCBRR_ALGO_2; 423 413 } 424 414 425 415 early_platform_add_devices(sh7780_early_devices,
+42 -18
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
··· 20 20 #include <cpu/dma-register.h> 21 21 22 22 static struct plat_sci_port scif0_platform_data = { 23 - .mapbase = 0xffea0000, 24 23 .flags = UPF_BOOT_AUTOCONF, 25 24 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 26 - .scbrr_algo_id = SCBRR_ALGO_1, 27 25 .type = PORT_SCIF, 28 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)), 29 26 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 27 + }; 28 + 29 + static struct resource scif0_resources[] = { 30 + DEFINE_RES_MEM(0xffea0000, 0x100), 31 + DEFINE_RES_IRQ(evt2irq(0x700)), 30 32 }; 31 33 32 34 static struct platform_device scif0_device = { 33 35 .name = "sh-sci", 34 36 .id = 0, 37 + .resource = scif0_resources, 38 + .num_resources = ARRAY_SIZE(scif0_resources), 35 39 .dev = { 36 40 .platform_data = &scif0_platform_data, 37 41 }, 38 42 }; 39 43 40 44 static struct plat_sci_port scif1_platform_data = { 41 - .mapbase = 0xffeb0000, 42 45 .flags = UPF_BOOT_AUTOCONF, 43 46 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 44 - .scbrr_algo_id = SCBRR_ALGO_1, 45 47 .type = PORT_SCIF, 46 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x780)), 47 48 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 49 + }; 50 + 51 + static struct resource scif1_resources[] = { 52 + DEFINE_RES_MEM(0xffeb0000, 0x100), 53 + DEFINE_RES_IRQ(evt2irq(0x780)), 48 54 }; 49 55 50 56 static struct platform_device scif1_device = { 51 57 .name = "sh-sci", 52 58 .id = 1, 59 + .resource = scif1_resources, 60 + .num_resources = ARRAY_SIZE(scif1_resources), 53 61 .dev = { 54 62 .platform_data = &scif1_platform_data, 55 63 }, 56 64 }; 57 65 58 66 static struct plat_sci_port scif2_platform_data = { 59 - .mapbase = 0xffec0000, 60 67 .flags = UPF_BOOT_AUTOCONF, 61 68 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 62 - .scbrr_algo_id = SCBRR_ALGO_1, 63 69 .type = PORT_SCIF, 64 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x980)), 65 70 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 71 + }; 72 + 73 + static struct resource scif2_resources[] = { 74 + DEFINE_RES_MEM(0xffec0000, 0x100), 75 + DEFINE_RES_IRQ(evt2irq(0x980)), 66 76 }; 67 77 68 78 static struct platform_device scif2_device = { 69 79 .name = "sh-sci", 70 80 .id = 2, 81 + .resource = scif2_resources, 82 + .num_resources = ARRAY_SIZE(scif2_resources), 71 83 .dev = { 72 84 .platform_data = &scif2_platform_data, 73 85 }, 74 86 }; 75 87 76 88 static struct plat_sci_port scif3_platform_data = { 77 - .mapbase = 0xffed0000, 78 89 .flags = UPF_BOOT_AUTOCONF, 79 90 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 80 - .scbrr_algo_id = SCBRR_ALGO_1, 81 91 .type = PORT_SCIF, 82 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x9a0)), 83 92 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 93 + }; 94 + 95 + static struct resource scif3_resources[] = { 96 + DEFINE_RES_MEM(0xffed0000, 0x100), 97 + DEFINE_RES_IRQ(evt2irq(0x9a0)), 84 98 }; 85 99 86 100 static struct platform_device scif3_device = { 87 101 .name = "sh-sci", 88 102 .id = 3, 103 + .resource = scif3_resources, 104 + .num_resources = ARRAY_SIZE(scif3_resources), 89 105 .dev = { 90 106 .platform_data = &scif3_platform_data, 91 107 }, 92 108 }; 93 109 94 110 static struct plat_sci_port scif4_platform_data = { 95 - .mapbase = 0xffee0000, 96 111 .flags = UPF_BOOT_AUTOCONF, 97 112 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 98 - .scbrr_algo_id = SCBRR_ALGO_1, 99 113 .type = PORT_SCIF, 100 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x9c0)), 101 114 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 115 + }; 116 + 117 + static struct resource scif4_resources[] = { 118 + DEFINE_RES_MEM(0xffee0000, 0x100), 119 + DEFINE_RES_IRQ(evt2irq(0x9c0)), 102 120 }; 103 121 104 122 static struct platform_device scif4_device = { 105 123 .name = "sh-sci", 106 124 .id = 4, 125 + .resource = scif4_resources, 126 + .num_resources = ARRAY_SIZE(scif4_resources), 107 127 .dev = { 108 128 .platform_data = &scif4_platform_data, 109 129 }, 110 130 }; 111 131 112 132 static struct plat_sci_port scif5_platform_data = { 113 - .mapbase = 0xffef0000, 114 133 .flags = UPF_BOOT_AUTOCONF, 115 134 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 116 - .scbrr_algo_id = SCBRR_ALGO_1, 117 135 .type = PORT_SCIF, 118 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x9e0)), 119 136 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 137 + }; 138 + 139 + static struct resource scif5_resources[] = { 140 + DEFINE_RES_MEM(0xffef0000, 0x100), 141 + DEFINE_RES_IRQ(evt2irq(0x9e0)), 120 142 }; 121 143 122 144 static struct platform_device scif5_device = { 123 145 .name = "sh-sci", 124 146 .id = 5, 147 + .resource = scif5_resources, 148 + .num_resources = ARRAY_SIZE(scif5_resources), 125 149 .dev = { 126 150 .platform_data = &scif5_platform_data, 127 151 },
+62 -26
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
··· 28 28 #include <asm/mmzone.h> 29 29 30 30 static struct plat_sci_port scif0_platform_data = { 31 - .mapbase = 0xffea0000, 32 31 .flags = UPF_BOOT_AUTOCONF, 33 32 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 34 - .scbrr_algo_id = SCBRR_ALGO_1, 35 33 .type = PORT_SCIF, 36 - .irqs = { evt2irq(0x700), 37 - evt2irq(0x720), 38 - evt2irq(0x760), 39 - evt2irq(0x740) }, 40 34 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 35 + }; 36 + 37 + static struct resource scif0_resources[] = { 38 + DEFINE_RES_MEM(0xffea0000, 0x100), 39 + DEFINE_RES_IRQ(evt2irq(0x700)), 40 + DEFINE_RES_IRQ(evt2irq(0x720)), 41 + DEFINE_RES_IRQ(evt2irq(0x760)), 42 + DEFINE_RES_IRQ(evt2irq(0x740)), 41 43 }; 42 44 43 45 static struct platform_device scif0_device = { 44 46 .name = "sh-sci", 45 47 .id = 0, 48 + .resource = scif0_resources, 49 + .num_resources = ARRAY_SIZE(scif0_resources), 46 50 .dev = { 47 51 .platform_data = &scif0_platform_data, 48 52 }, ··· 56 52 * The rest of these all have multiplexed IRQs 57 53 */ 58 54 static struct plat_sci_port scif1_platform_data = { 59 - .mapbase = 0xffeb0000, 60 55 .flags = UPF_BOOT_AUTOCONF, 61 56 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 62 - .scbrr_algo_id = SCBRR_ALGO_1, 63 57 .type = PORT_SCIF, 64 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x780)), 65 58 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 59 + }; 60 + 61 + static struct resource scif1_resources[] = { 62 + DEFINE_RES_MEM(0xffeb0000, 0x100), 63 + DEFINE_RES_IRQ(evt2irq(0x780)), 64 + }; 65 + 66 + static struct resource scif1_demux_resources[] = { 67 + DEFINE_RES_MEM(0xffeb0000, 0x100), 68 + /* Placeholders, see sh7786_devices_setup() */ 69 + DEFINE_RES_IRQ(0), 70 + DEFINE_RES_IRQ(0), 71 + DEFINE_RES_IRQ(0), 72 + DEFINE_RES_IRQ(0), 66 73 }; 67 74 68 75 static struct platform_device scif1_device = { 69 76 .name = "sh-sci", 70 77 .id = 1, 78 + .resource = scif1_resources, 79 + .num_resources = ARRAY_SIZE(scif1_resources), 71 80 .dev = { 72 81 .platform_data = &scif1_platform_data, 73 82 }, 74 83 }; 75 84 76 85 static struct plat_sci_port scif2_platform_data = { 77 - .mapbase = 0xffec0000, 78 86 .flags = UPF_BOOT_AUTOCONF, 79 87 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 80 - .scbrr_algo_id = SCBRR_ALGO_1, 81 88 .type = PORT_SCIF, 82 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x840)), 83 89 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 90 + }; 91 + 92 + static struct resource scif2_resources[] = { 93 + DEFINE_RES_MEM(0xffec0000, 0x100), 94 + DEFINE_RES_IRQ(evt2irq(0x840)), 84 95 }; 85 96 86 97 static struct platform_device scif2_device = { 87 98 .name = "sh-sci", 88 99 .id = 2, 100 + .resource = scif2_resources, 101 + .num_resources = ARRAY_SIZE(scif2_resources), 89 102 .dev = { 90 103 .platform_data = &scif2_platform_data, 91 104 }, 92 105 }; 93 106 94 107 static struct plat_sci_port scif3_platform_data = { 95 - .mapbase = 0xffed0000, 96 108 .flags = UPF_BOOT_AUTOCONF, 97 109 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 98 - .scbrr_algo_id = SCBRR_ALGO_1, 99 110 .type = PORT_SCIF, 100 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x860)), 101 111 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 112 + }; 113 + 114 + static struct resource scif3_resources[] = { 115 + DEFINE_RES_MEM(0xffed0000, 0x100), 116 + DEFINE_RES_IRQ(evt2irq(0x860)), 102 117 }; 103 118 104 119 static struct platform_device scif3_device = { 105 120 .name = "sh-sci", 106 121 .id = 3, 122 + .resource = scif3_resources, 123 + .num_resources = ARRAY_SIZE(scif3_resources), 107 124 .dev = { 108 125 .platform_data = &scif3_platform_data, 109 126 }, 110 127 }; 111 128 112 129 static struct plat_sci_port scif4_platform_data = { 113 - .mapbase = 0xffee0000, 114 130 .flags = UPF_BOOT_AUTOCONF, 115 131 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 116 - .scbrr_algo_id = SCBRR_ALGO_1, 117 132 .type = PORT_SCIF, 118 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)), 119 133 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 134 + }; 135 + 136 + static struct resource scif4_resources[] = { 137 + DEFINE_RES_MEM(0xffee0000, 0x100), 138 + DEFINE_RES_IRQ(evt2irq(0x880)), 120 139 }; 121 140 122 141 static struct platform_device scif4_device = { 123 142 .name = "sh-sci", 124 143 .id = 4, 144 + .resource = scif4_resources, 145 + .num_resources = ARRAY_SIZE(scif4_resources), 125 146 .dev = { 126 147 .platform_data = &scif4_platform_data, 127 148 }, 128 149 }; 129 150 130 151 static struct plat_sci_port scif5_platform_data = { 131 - .mapbase = 0xffef0000, 132 152 .flags = UPF_BOOT_AUTOCONF, 133 153 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 134 - .scbrr_algo_id = SCBRR_ALGO_1, 135 154 .type = PORT_SCIF, 136 - .irqs = SCIx_IRQ_MUXED(evt2irq(0x8a0)), 137 155 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 156 + }; 157 + 158 + static struct resource scif5_resources[] = { 159 + DEFINE_RES_MEM(0xffef0000, 0x100), 160 + DEFINE_RES_IRQ(evt2irq(0x8a0)), 138 161 }; 139 162 140 163 static struct platform_device scif5_device = { 141 164 .name = "sh-sci", 142 165 .id = 5, 166 + .resource = scif5_resources, 167 + .num_resources = ARRAY_SIZE(scif5_resources), 143 168 .dev = { 144 169 .platform_data = &scif5_platform_data, 145 170 }, ··· 1070 1037 */ 1071 1038 irq = intc_irq_lookup(sh7786_intc_desc.name, TXI1); 1072 1039 if (irq > 0) { 1073 - scif1_platform_data.irqs[SCIx_TXI_IRQ] = irq; 1074 - scif1_platform_data.irqs[SCIx_ERI_IRQ] = 1040 + scif1_demux_resources[1].start = 1075 1041 intc_irq_lookup(sh7786_intc_desc.name, ERI1); 1076 - scif1_platform_data.irqs[SCIx_BRI_IRQ] = 1077 - intc_irq_lookup(sh7786_intc_desc.name, BRI1); 1078 - scif1_platform_data.irqs[SCIx_RXI_IRQ] = 1042 + scif1_demux_resources[2].start = 1079 1043 intc_irq_lookup(sh7786_intc_desc.name, RXI1); 1044 + scif1_demux_resources[3].start = irq; 1045 + scif1_demux_resources[4].start = 1046 + intc_irq_lookup(sh7786_intc_desc.name, BRI1); 1047 + 1048 + scif1_device.resource = scif1_demux_resources; 1049 + scif1_device.num_resources = ARRAY_SIZE(scif1_demux_resources); 1080 1050 } 1081 1051 1082 1052 ret = platform_add_devices(sh7786_early_devices,
+30 -18
arch/sh/kernel/cpu/sh4a/setup-shx3.c
··· 28 28 * all rather than adding infrastructure to hack around it. 29 29 */ 30 30 static struct plat_sci_port scif0_platform_data = { 31 - .mapbase = 0xffc30000, 32 31 .flags = UPF_BOOT_AUTOCONF, 33 32 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 34 - .scbrr_algo_id = SCBRR_ALGO_2, 35 33 .type = PORT_SCIF, 36 - .irqs = { evt2irq(0x700), 37 - evt2irq(0x720), 38 - evt2irq(0x760), 39 - evt2irq(0x740) }, 34 + }; 35 + 36 + static struct resource scif0_resources[] = { 37 + DEFINE_RES_MEM(0xffc30000, 0x100), 38 + DEFINE_RES_IRQ(evt2irq(0x700)), 39 + DEFINE_RES_IRQ(evt2irq(0x720)), 40 + DEFINE_RES_IRQ(evt2irq(0x760)), 41 + DEFINE_RES_IRQ(evt2irq(0x740)), 40 42 }; 41 43 42 44 static struct platform_device scif0_device = { 43 45 .name = "sh-sci", 44 46 .id = 0, 47 + .resource = scif0_resources, 48 + .num_resources = ARRAY_SIZE(scif0_resources), 45 49 .dev = { 46 50 .platform_data = &scif0_platform_data, 47 51 }, 48 52 }; 49 53 50 54 static struct plat_sci_port scif1_platform_data = { 51 - .mapbase = 0xffc40000, 52 55 .flags = UPF_BOOT_AUTOCONF, 53 56 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 54 - .scbrr_algo_id = SCBRR_ALGO_2, 55 57 .type = PORT_SCIF, 56 - .irqs = { evt2irq(0x780), 57 - evt2irq(0x7a0), 58 - evt2irq(0x7e0), 59 - evt2irq(0x7c0) }, 58 + }; 59 + 60 + static struct resource scif1_resources[] = { 61 + DEFINE_RES_MEM(0xffc40000, 0x100), 62 + DEFINE_RES_IRQ(evt2irq(0x780)), 63 + DEFINE_RES_IRQ(evt2irq(0x7a0)), 64 + DEFINE_RES_IRQ(evt2irq(0x7e0)), 65 + DEFINE_RES_IRQ(evt2irq(0x7c0)), 60 66 }; 61 67 62 68 static struct platform_device scif1_device = { 63 69 .name = "sh-sci", 64 70 .id = 1, 71 + .resource = scif1_resources, 72 + .num_resources = ARRAY_SIZE(scif1_resources), 65 73 .dev = { 66 74 .platform_data = &scif1_platform_data, 67 75 }, 68 76 }; 69 77 70 78 static struct plat_sci_port scif2_platform_data = { 71 - .mapbase = 0xffc60000, 72 79 .flags = UPF_BOOT_AUTOCONF, 73 80 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 74 - .scbrr_algo_id = SCBRR_ALGO_2, 75 81 .type = PORT_SCIF, 76 - .irqs = { evt2irq(0x880), 77 - evt2irq(0x8a0), 78 - evt2irq(0x8e0), 79 - evt2irq(0x8c0) }, 82 + }; 83 + 84 + static struct resource scif2_resources[] = { 85 + DEFINE_RES_MEM(0xffc60000, 0x100), 86 + DEFINE_RES_IRQ(evt2irq(0x880)), 87 + DEFINE_RES_IRQ(evt2irq(0x8a0)), 88 + DEFINE_RES_IRQ(evt2irq(0x8e0)), 89 + DEFINE_RES_IRQ(evt2irq(0x8c0)), 80 90 }; 81 91 82 92 static struct platform_device scif2_device = { 83 93 .name = "sh-sci", 84 94 .id = 2, 95 + .resource = scif2_resources, 96 + .num_resources = ARRAY_SIZE(scif2_resources), 85 97 .dev = { 86 98 .platform_data = &scif2_platform_data, 87 99 },
+9 -3
arch/sh/kernel/cpu/sh5/setup-sh5.c
··· 17 17 #include <asm/addrspace.h> 18 18 19 19 static struct plat_sci_port scif0_platform_data = { 20 - .mapbase = PHYS_PERIPHERAL_BLOCK + 0x01030000, 21 20 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 22 21 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 23 - .scbrr_algo_id = SCBRR_ALGO_2, 24 22 .type = PORT_SCIF, 25 - .irqs = { 39, 40, 42, 0 }, 23 + }; 24 + 25 + static struct resource scif0_resources[] = { 26 + DEFINE_RES_MEM(PHYS_PERIPHERAL_BLOCK + 0x01030000, 0x100), 27 + DEFINE_RES_IRQ(39), 28 + DEFINE_RES_IRQ(40), 29 + DEFINE_RES_IRQ(42), 26 30 }; 27 31 28 32 static struct platform_device scif0_device = { 29 33 .name = "sh-sci", 30 34 .id = 0, 35 + .resource = scif0_resources, 36 + .num_resources = ARRAY_SIZE(scif0_resources), 31 37 .dev = { 32 38 .platform_data = &scif0_platform_data, 33 39 },
+2 -8
drivers/bus/mvebu-mbus.c
··· 588 588 .show_cpu_target = mvebu_sdram_debug_show_orion, 589 589 }; 590 590 591 - /* 592 - * The driver doesn't yet have a DT binding because the details of 593 - * this DT binding still need to be sorted out. However, as a 594 - * preparation, we already use of_device_id to match a SoC description 595 - * string against the SoC specific details of this driver. 596 - */ 597 591 static const struct of_device_id of_mvebu_mbus_ids[] = { 598 592 { .compatible = "marvell,armada370-mbus", 599 593 .data = &armada_370_xp_mbus_data, }, ··· 728 734 { 729 735 const struct of_device_id *of_id; 730 736 731 - for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) 737 + for (of_id = of_mvebu_mbus_ids; of_id->compatible[0]; of_id++) 732 738 if (!strcmp(of_id->compatible, soc)) 733 739 break; 734 740 735 - if (!of_id->compatible) { 741 + if (!of_id->compatible[0]) { 736 742 pr_err("could not find a matching SoC family\n"); 737 743 return -ENODEV; 738 744 }
+2 -1
drivers/clk/versatile/clk-icst.c
··· 119 119 120 120 struct clk *icst_clk_register(struct device *dev, 121 121 const struct clk_icst_desc *desc, 122 + const char *name, 122 123 void __iomem *base) 123 124 { 124 125 struct clk *clk; ··· 131 130 pr_err("could not allocate ICST clock!\n"); 132 131 return ERR_PTR(-ENOMEM); 133 132 } 134 - init.name = "icst"; 133 + init.name = name; 135 134 init.ops = &icst_ops; 136 135 init.flags = CLK_IS_ROOT; 137 136 init.parent_names = NULL;
+1
drivers/clk/versatile/clk-icst.h
··· 15 15 16 16 struct clk *icst_clk_register(struct device *dev, 17 17 const struct clk_icst_desc *desc, 18 + const char *name, 18 19 void __iomem *base);
+72 -16
drivers/clk/versatile/clk-impd1.c
··· 1 1 /* 2 2 * Clock driver for the ARM Integrator/IM-PD1 board 3 - * Copyright (C) 2012 Linus Walleij 3 + * Copyright (C) 2012-2013 Linus Walleij 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify 6 6 * it under the terms of the GNU General Public License version 2 as ··· 18 18 #include "clk-icst.h" 19 19 20 20 struct impd1_clk { 21 - struct clk *vcoclk; 21 + char *vco1name; 22 + struct clk *vco1clk; 23 + char *vco2name; 24 + struct clk *vco2clk; 25 + struct clk *mmciclk; 26 + char *uartname; 22 27 struct clk *uartclk; 23 - struct clk_lookup *clks[3]; 28 + char *spiname; 29 + struct clk *spiclk; 30 + char *scname; 31 + struct clk *scclk; 32 + struct clk_lookup *clks[6]; 24 33 }; 25 34 35 + /* One entry for each connected IM-PD1 LM */ 26 36 static struct impd1_clk impd1_clks[4]; 27 37 28 38 /* 29 - * There are two VCO's on the IM-PD1 but only one is used by the 30 - * kernel, that is why we are only implementing the control of 31 - * IMPD1_OSC1 here. 39 + * There are two VCO's on the IM-PD1 32 40 */ 33 41 34 - static const struct icst_params impd1_vco_params = { 42 + static const struct icst_params impd1_vco1_params = { 35 43 .ref = 24000000, /* 24 MHz */ 36 44 .vco_max = ICST525_VCO_MAX_3V, 37 45 .vco_min = ICST525_VCO_MIN, ··· 52 44 }; 53 45 54 46 static const struct clk_icst_desc impd1_icst1_desc = { 55 - .params = &impd1_vco_params, 47 + .params = &impd1_vco1_params, 56 48 .vco_offset = IMPD1_OSC1, 49 + .lock_offset = IMPD1_LOCK, 50 + }; 51 + 52 + static const struct icst_params impd1_vco2_params = { 53 + .ref = 24000000, /* 24 MHz */ 54 + .vco_max = ICST525_VCO_MAX_3V, 55 + .vco_min = ICST525_VCO_MIN, 56 + .vd_min = 12, 57 + .vd_max = 519, 58 + .rd_min = 3, 59 + .rd_max = 120, 60 + .s2div = icst525_s2div, 61 + .idx2s = icst525_idx2s, 62 + }; 63 + 64 + static const struct clk_icst_desc impd1_icst2_desc = { 65 + .params = &impd1_vco2_params, 66 + .vco_offset = IMPD1_OSC2, 57 67 .lock_offset = IMPD1_LOCK, 58 68 }; 59 69 ··· 92 66 } 93 67 imc = &impd1_clks[id]; 94 68 95 - clk = icst_clk_register(NULL, &impd1_icst1_desc, base); 96 - imc->vcoclk = clk; 69 + imc->vco1name = kasprintf(GFP_KERNEL, "lm%x-vco1", id); 70 + clk = icst_clk_register(NULL, &impd1_icst1_desc, imc->vco1name, base); 71 + imc->vco1clk = clk; 97 72 imc->clks[0] = clkdev_alloc(clk, NULL, "lm%x:01000", id); 98 73 99 - /* UART reference clock */ 100 - clk = clk_register_fixed_rate(NULL, "uartclk", NULL, CLK_IS_ROOT, 101 - 14745600); 74 + /* VCO2 is also called "CLK2" */ 75 + imc->vco2name = kasprintf(GFP_KERNEL, "lm%x-vco2", id); 76 + clk = icst_clk_register(NULL, &impd1_icst2_desc, imc->vco2name, base); 77 + imc->vco2clk = clk; 78 + 79 + /* MMCI uses CLK2 right off */ 80 + imc->clks[1] = clkdev_alloc(clk, NULL, "lm%x:00700", id); 81 + 82 + /* UART reference clock divides CLK2 by a fixed factor 4 */ 83 + imc->uartname = kasprintf(GFP_KERNEL, "lm%x-uartclk", id); 84 + clk = clk_register_fixed_factor(NULL, imc->uartname, imc->vco2name, 85 + CLK_IGNORE_UNUSED, 1, 4); 102 86 imc->uartclk = clk; 103 - imc->clks[1] = clkdev_alloc(clk, NULL, "lm%x:00100", id); 104 - imc->clks[2] = clkdev_alloc(clk, NULL, "lm%x:00200", id); 87 + imc->clks[2] = clkdev_alloc(clk, NULL, "lm%x:00100", id); 88 + imc->clks[3] = clkdev_alloc(clk, NULL, "lm%x:00200", id); 89 + 90 + /* SPI PL022 clock divides CLK2 by a fixed factor 64 */ 91 + imc->spiname = kasprintf(GFP_KERNEL, "lm%x-spiclk", id); 92 + clk = clk_register_fixed_factor(NULL, imc->spiname, imc->vco2name, 93 + CLK_IGNORE_UNUSED, 1, 64); 94 + imc->clks[4] = clkdev_alloc(clk, NULL, "lm%x:00300", id); 95 + 96 + /* Smart Card clock divides CLK2 by a fixed factor 4 */ 97 + imc->scname = kasprintf(GFP_KERNEL, "lm%x-scclk", id); 98 + clk = clk_register_fixed_factor(NULL, imc->scname, imc->vco2name, 99 + CLK_IGNORE_UNUSED, 1, 4); 100 + imc->scclk = clk; 101 + imc->clks[5] = clkdev_alloc(clk, NULL, "lm%x:00600", id); 105 102 106 103 for (i = 0; i < ARRAY_SIZE(imc->clks); i++) 107 104 clkdev_add(imc->clks[i]); ··· 141 92 142 93 for (i = 0; i < ARRAY_SIZE(imc->clks); i++) 143 94 clkdev_drop(imc->clks[i]); 95 + clk_unregister(imc->spiclk); 144 96 clk_unregister(imc->uartclk); 145 - clk_unregister(imc->vcoclk); 97 + clk_unregister(imc->vco2clk); 98 + clk_unregister(imc->vco1clk); 99 + kfree(imc->scname); 100 + kfree(imc->spiname); 101 + kfree(imc->uartname); 102 + kfree(imc->vco2name); 103 + kfree(imc->vco1name); 146 104 }
+1 -1
drivers/clk/versatile/clk-integrator.c
··· 78 78 clk_register_clkdev(clk, NULL, "sp804"); 79 79 80 80 /* ICST VCO clock used on the Integrator/CP CLCD */ 81 - clk = icst_clk_register(NULL, &cp_icst_desc, 81 + clk = icst_clk_register(NULL, &cp_icst_desc, "icst", 82 82 __io_address(INTEGRATOR_HDR_BASE)); 83 83 clk_register_clkdev(clk, NULL, "clcd"); 84 84 }
+4 -2
drivers/clk/versatile/clk-realview.c
··· 84 84 85 85 /* ICST VCO clock */ 86 86 if (is_pb1176) 87 - clk = icst_clk_register(NULL, &realview_osc0_desc, sysbase); 87 + clk = icst_clk_register(NULL, &realview_osc0_desc, 88 + "osc0", sysbase); 88 89 else 89 - clk = icst_clk_register(NULL, &realview_osc4_desc, sysbase); 90 + clk = icst_clk_register(NULL, &realview_osc4_desc, 91 + "osc4", sysbase); 90 92 91 93 clk_register_clkdev(clk, NULL, "dev:clcd"); 92 94 clk_register_clkdev(clk, NULL, "issp:clcd");
+89 -44
drivers/crypto/atmel-aes.c
··· 30 30 #include <linux/irq.h> 31 31 #include <linux/scatterlist.h> 32 32 #include <linux/dma-mapping.h> 33 + #include <linux/of_device.h> 33 34 #include <linux/delay.h> 34 35 #include <linux/crypto.h> 35 36 #include <linux/cryptohash.h> ··· 40 39 #include <crypto/hash.h> 41 40 #include <crypto/internal/hash.h> 42 41 #include <linux/platform_data/crypto-atmel.h> 42 + #include <dt-bindings/dma/at91.h> 43 43 #include "atmel-aes-regs.h" 44 44 45 45 #define CFB8_BLOCK_SIZE 1 ··· 749 747 struct crypto_platform_data *pdata) 750 748 { 751 749 int err = -ENOMEM; 752 - dma_cap_mask_t mask_in, mask_out; 750 + dma_cap_mask_t mask; 753 751 754 - if (pdata && pdata->dma_slave->txdata.dma_dev && 755 - pdata->dma_slave->rxdata.dma_dev) { 752 + dma_cap_zero(mask); 753 + dma_cap_set(DMA_SLAVE, mask); 756 754 757 - /* Try to grab 2 DMA channels */ 758 - dma_cap_zero(mask_in); 759 - dma_cap_set(DMA_SLAVE, mask_in); 755 + /* Try to grab 2 DMA channels */ 756 + dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask, 757 + atmel_aes_filter, &pdata->dma_slave->rxdata, dd->dev, "tx"); 758 + if (!dd->dma_lch_in.chan) 759 + goto err_dma_in; 760 760 761 - dd->dma_lch_in.chan = dma_request_channel(mask_in, 762 - atmel_aes_filter, &pdata->dma_slave->rxdata); 761 + dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; 762 + dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + 763 + AES_IDATAR(0); 764 + dd->dma_lch_in.dma_conf.src_maxburst = dd->caps.max_burst_size; 765 + dd->dma_lch_in.dma_conf.src_addr_width = 766 + DMA_SLAVE_BUSWIDTH_4_BYTES; 767 + dd->dma_lch_in.dma_conf.dst_maxburst = dd->caps.max_burst_size; 768 + dd->dma_lch_in.dma_conf.dst_addr_width = 769 + DMA_SLAVE_BUSWIDTH_4_BYTES; 770 + dd->dma_lch_in.dma_conf.device_fc = false; 763 771 764 - if (!dd->dma_lch_in.chan) 765 - goto err_dma_in; 772 + dd->dma_lch_out.chan = dma_request_slave_channel_compat(mask, 773 + atmel_aes_filter, &pdata->dma_slave->txdata, dd->dev, "rx"); 774 + if (!dd->dma_lch_out.chan) 775 + goto err_dma_out; 766 776 767 - dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; 768 - dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + 769 - AES_IDATAR(0); 770 - dd->dma_lch_in.dma_conf.src_maxburst = dd->caps.max_burst_size; 771 - dd->dma_lch_in.dma_conf.src_addr_width = 772 - DMA_SLAVE_BUSWIDTH_4_BYTES; 773 - dd->dma_lch_in.dma_conf.dst_maxburst = dd->caps.max_burst_size; 774 - dd->dma_lch_in.dma_conf.dst_addr_width = 775 - DMA_SLAVE_BUSWIDTH_4_BYTES; 776 - dd->dma_lch_in.dma_conf.device_fc = false; 777 + dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM; 778 + dd->dma_lch_out.dma_conf.src_addr = dd->phys_base + 779 + AES_ODATAR(0); 780 + dd->dma_lch_out.dma_conf.src_maxburst = dd->caps.max_burst_size; 781 + dd->dma_lch_out.dma_conf.src_addr_width = 782 + DMA_SLAVE_BUSWIDTH_4_BYTES; 783 + dd->dma_lch_out.dma_conf.dst_maxburst = dd->caps.max_burst_size; 784 + dd->dma_lch_out.dma_conf.dst_addr_width = 785 + DMA_SLAVE_BUSWIDTH_4_BYTES; 786 + dd->dma_lch_out.dma_conf.device_fc = false; 777 787 778 - dma_cap_zero(mask_out); 779 - dma_cap_set(DMA_SLAVE, mask_out); 780 - dd->dma_lch_out.chan = dma_request_channel(mask_out, 781 - atmel_aes_filter, &pdata->dma_slave->txdata); 782 - 783 - if (!dd->dma_lch_out.chan) 784 - goto err_dma_out; 785 - 786 - dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM; 787 - dd->dma_lch_out.dma_conf.src_addr = dd->phys_base + 788 - AES_ODATAR(0); 789 - dd->dma_lch_out.dma_conf.src_maxburst = dd->caps.max_burst_size; 790 - dd->dma_lch_out.dma_conf.src_addr_width = 791 - DMA_SLAVE_BUSWIDTH_4_BYTES; 792 - dd->dma_lch_out.dma_conf.dst_maxburst = dd->caps.max_burst_size; 793 - dd->dma_lch_out.dma_conf.dst_addr_width = 794 - DMA_SLAVE_BUSWIDTH_4_BYTES; 795 - dd->dma_lch_out.dma_conf.device_fc = false; 796 - 797 - return 0; 798 - } else { 799 - return -ENODEV; 800 - } 788 + return 0; 801 789 802 790 err_dma_out: 803 791 dma_release_channel(dd->dma_lch_in.chan); 804 792 err_dma_in: 793 + dev_warn(dd->dev, "no DMA channel available\n"); 805 794 return err; 806 795 } 807 796 ··· 1254 1261 } 1255 1262 } 1256 1263 1264 + #if defined(CONFIG_OF) 1265 + static const struct of_device_id atmel_aes_dt_ids[] = { 1266 + { .compatible = "atmel,at91sam9g46-aes" }, 1267 + { /* sentinel */ } 1268 + }; 1269 + MODULE_DEVICE_TABLE(of, atmel_aes_dt_ids); 1270 + 1271 + static struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pdev) 1272 + { 1273 + struct device_node *np = pdev->dev.of_node; 1274 + struct crypto_platform_data *pdata; 1275 + 1276 + if (!np) { 1277 + dev_err(&pdev->dev, "device node not found\n"); 1278 + return ERR_PTR(-EINVAL); 1279 + } 1280 + 1281 + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 1282 + if (!pdata) { 1283 + dev_err(&pdev->dev, "could not allocate memory for pdata\n"); 1284 + return ERR_PTR(-ENOMEM); 1285 + } 1286 + 1287 + pdata->dma_slave = devm_kzalloc(&pdev->dev, 1288 + sizeof(*(pdata->dma_slave)), 1289 + GFP_KERNEL); 1290 + if (!pdata->dma_slave) { 1291 + dev_err(&pdev->dev, "could not allocate memory for dma_slave\n"); 1292 + devm_kfree(&pdev->dev, pdata); 1293 + return ERR_PTR(-ENOMEM); 1294 + } 1295 + 1296 + return pdata; 1297 + } 1298 + #else 1299 + static inline struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pdev) 1300 + { 1301 + return ERR_PTR(-EINVAL); 1302 + } 1303 + #endif 1304 + 1257 1305 static int atmel_aes_probe(struct platform_device *pdev) 1258 1306 { 1259 1307 struct atmel_aes_dev *aes_dd; ··· 1306 1272 1307 1273 pdata = pdev->dev.platform_data; 1308 1274 if (!pdata) { 1275 + pdata = atmel_aes_of_init(pdev); 1276 + if (IS_ERR(pdata)) { 1277 + err = PTR_ERR(pdata); 1278 + goto aes_dd_err; 1279 + } 1280 + } 1281 + 1282 + if (!pdata->dma_slave) { 1309 1283 err = -ENXIO; 1310 1284 goto aes_dd_err; 1311 1285 } ··· 1400 1358 if (err) 1401 1359 goto err_algs; 1402 1360 1403 - dev_info(dev, "Atmel AES\n"); 1361 + dev_info(dev, "Atmel AES - Using %s, %s for DMA transfers\n", 1362 + dma_chan_name(aes_dd->dma_lch_in.chan), 1363 + dma_chan_name(aes_dd->dma_lch_out.chan)); 1404 1364 1405 1365 return 0; 1406 1366 ··· 1468 1424 .driver = { 1469 1425 .name = "atmel_aes", 1470 1426 .owner = THIS_MODULE, 1427 + .of_match_table = of_match_ptr(atmel_aes_dt_ids), 1471 1428 }, 1472 1429 }; 1473 1430
+78 -25
drivers/crypto/atmel-sha.c
··· 30 30 #include <linux/irq.h> 31 31 #include <linux/scatterlist.h> 32 32 #include <linux/dma-mapping.h> 33 + #include <linux/of_device.h> 33 34 #include <linux/delay.h> 34 35 #include <linux/crypto.h> 35 36 #include <linux/cryptohash.h> ··· 1264 1263 int err = -ENOMEM; 1265 1264 dma_cap_mask_t mask_in; 1266 1265 1267 - if (pdata && pdata->dma_slave->rxdata.dma_dev) { 1268 - /* Try to grab DMA channel */ 1269 - dma_cap_zero(mask_in); 1270 - dma_cap_set(DMA_SLAVE, mask_in); 1266 + /* Try to grab DMA channel */ 1267 + dma_cap_zero(mask_in); 1268 + dma_cap_set(DMA_SLAVE, mask_in); 1271 1269 1272 - dd->dma_lch_in.chan = dma_request_channel(mask_in, 1273 - atmel_sha_filter, &pdata->dma_slave->rxdata); 1274 - 1275 - if (!dd->dma_lch_in.chan) 1276 - return err; 1277 - 1278 - dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; 1279 - dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + 1280 - SHA_REG_DIN(0); 1281 - dd->dma_lch_in.dma_conf.src_maxburst = 1; 1282 - dd->dma_lch_in.dma_conf.src_addr_width = 1283 - DMA_SLAVE_BUSWIDTH_4_BYTES; 1284 - dd->dma_lch_in.dma_conf.dst_maxburst = 1; 1285 - dd->dma_lch_in.dma_conf.dst_addr_width = 1286 - DMA_SLAVE_BUSWIDTH_4_BYTES; 1287 - dd->dma_lch_in.dma_conf.device_fc = false; 1288 - 1289 - return 0; 1270 + dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask_in, 1271 + atmel_sha_filter, &pdata->dma_slave->rxdata, dd->dev, "tx"); 1272 + if (!dd->dma_lch_in.chan) { 1273 + dev_warn(dd->dev, "no DMA channel available\n"); 1274 + return err; 1290 1275 } 1291 1276 1292 - return -ENODEV; 1277 + dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; 1278 + dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + 1279 + SHA_REG_DIN(0); 1280 + dd->dma_lch_in.dma_conf.src_maxburst = 1; 1281 + dd->dma_lch_in.dma_conf.src_addr_width = 1282 + DMA_SLAVE_BUSWIDTH_4_BYTES; 1283 + dd->dma_lch_in.dma_conf.dst_maxburst = 1; 1284 + dd->dma_lch_in.dma_conf.dst_addr_width = 1285 + DMA_SLAVE_BUSWIDTH_4_BYTES; 1286 + dd->dma_lch_in.dma_conf.device_fc = false; 1287 + 1288 + return 0; 1293 1289 } 1294 1290 1295 1291 static void atmel_sha_dma_cleanup(struct atmel_sha_dev *dd) ··· 1323 1325 break; 1324 1326 } 1325 1327 } 1328 + 1329 + #if defined(CONFIG_OF) 1330 + static const struct of_device_id atmel_sha_dt_ids[] = { 1331 + { .compatible = "atmel,at91sam9g46-sha" }, 1332 + { /* sentinel */ } 1333 + }; 1334 + 1335 + MODULE_DEVICE_TABLE(of, atmel_sha_dt_ids); 1336 + 1337 + static struct crypto_platform_data *atmel_sha_of_init(struct platform_device *pdev) 1338 + { 1339 + struct device_node *np = pdev->dev.of_node; 1340 + struct crypto_platform_data *pdata; 1341 + 1342 + if (!np) { 1343 + dev_err(&pdev->dev, "device node not found\n"); 1344 + return ERR_PTR(-EINVAL); 1345 + } 1346 + 1347 + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 1348 + if (!pdata) { 1349 + dev_err(&pdev->dev, "could not allocate memory for pdata\n"); 1350 + return ERR_PTR(-ENOMEM); 1351 + } 1352 + 1353 + pdata->dma_slave = devm_kzalloc(&pdev->dev, 1354 + sizeof(*(pdata->dma_slave)), 1355 + GFP_KERNEL); 1356 + if (!pdata->dma_slave) { 1357 + dev_err(&pdev->dev, "could not allocate memory for dma_slave\n"); 1358 + devm_kfree(&pdev->dev, pdata); 1359 + return ERR_PTR(-ENOMEM); 1360 + } 1361 + 1362 + return pdata; 1363 + } 1364 + #else /* CONFIG_OF */ 1365 + static inline struct crypto_platform_data *atmel_sha_of_init(struct platform_device *dev) 1366 + { 1367 + return ERR_PTR(-EINVAL); 1368 + } 1369 + #endif 1326 1370 1327 1371 static int atmel_sha_probe(struct platform_device *pdev) 1328 1372 { ··· 1442 1402 if (sha_dd->caps.has_dma) { 1443 1403 pdata = pdev->dev.platform_data; 1444 1404 if (!pdata) { 1445 - dev_err(&pdev->dev, "platform data not available\n"); 1405 + pdata = atmel_sha_of_init(pdev); 1406 + if (IS_ERR(pdata)) { 1407 + dev_err(&pdev->dev, "platform data not available\n"); 1408 + err = PTR_ERR(pdata); 1409 + goto err_pdata; 1410 + } 1411 + } 1412 + if (!pdata->dma_slave) { 1446 1413 err = -ENXIO; 1447 1414 goto err_pdata; 1448 1415 } 1449 1416 err = atmel_sha_dma_init(sha_dd, pdata); 1450 1417 if (err) 1451 1418 goto err_sha_dma; 1419 + 1420 + dev_info(dev, "using %s for DMA transfers\n", 1421 + dma_chan_name(sha_dd->dma_lch_in.chan)); 1452 1422 } 1453 1423 1454 1424 spin_lock(&atmel_sha.lock); ··· 1469 1419 if (err) 1470 1420 goto err_algs; 1471 1421 1472 - dev_info(dev, "Atmel SHA1/SHA256\n"); 1422 + dev_info(dev, "Atmel SHA1/SHA256%s%s\n", 1423 + sha_dd->caps.has_sha224 ? "/SHA224" : "", 1424 + sha_dd->caps.has_sha_384_512 ? "/SHA384/SHA512" : ""); 1473 1425 1474 1426 return 0; 1475 1427 ··· 1535 1483 .driver = { 1536 1484 .name = "atmel_sha", 1537 1485 .owner = THIS_MODULE, 1486 + .of_match_table = of_match_ptr(atmel_sha_dt_ids), 1538 1487 }, 1539 1488 }; 1540 1489
+89 -44
drivers/crypto/atmel-tdes.c
··· 30 30 #include <linux/irq.h> 31 31 #include <linux/scatterlist.h> 32 32 #include <linux/dma-mapping.h> 33 + #include <linux/of_device.h> 33 34 #include <linux/delay.h> 34 35 #include <linux/crypto.h> 35 36 #include <linux/cryptohash.h> ··· 717 716 struct crypto_platform_data *pdata) 718 717 { 719 718 int err = -ENOMEM; 720 - dma_cap_mask_t mask_in, mask_out; 719 + dma_cap_mask_t mask; 721 720 722 - if (pdata && pdata->dma_slave->txdata.dma_dev && 723 - pdata->dma_slave->rxdata.dma_dev) { 721 + dma_cap_zero(mask); 722 + dma_cap_set(DMA_SLAVE, mask); 724 723 725 - /* Try to grab 2 DMA channels */ 726 - dma_cap_zero(mask_in); 727 - dma_cap_set(DMA_SLAVE, mask_in); 724 + /* Try to grab 2 DMA channels */ 725 + dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask, 726 + atmel_tdes_filter, &pdata->dma_slave->rxdata, dd->dev, "tx"); 727 + if (!dd->dma_lch_in.chan) 728 + goto err_dma_in; 728 729 729 - dd->dma_lch_in.chan = dma_request_channel(mask_in, 730 - atmel_tdes_filter, &pdata->dma_slave->rxdata); 730 + dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; 731 + dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + 732 + TDES_IDATA1R; 733 + dd->dma_lch_in.dma_conf.src_maxburst = 1; 734 + dd->dma_lch_in.dma_conf.src_addr_width = 735 + DMA_SLAVE_BUSWIDTH_4_BYTES; 736 + dd->dma_lch_in.dma_conf.dst_maxburst = 1; 737 + dd->dma_lch_in.dma_conf.dst_addr_width = 738 + DMA_SLAVE_BUSWIDTH_4_BYTES; 739 + dd->dma_lch_in.dma_conf.device_fc = false; 731 740 732 - if (!dd->dma_lch_in.chan) 733 - goto err_dma_in; 741 + dd->dma_lch_out.chan = dma_request_slave_channel_compat(mask, 742 + atmel_tdes_filter, &pdata->dma_slave->txdata, dd->dev, "rx"); 743 + if (!dd->dma_lch_out.chan) 744 + goto err_dma_out; 734 745 735 - dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; 736 - dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + 737 - TDES_IDATA1R; 738 - dd->dma_lch_in.dma_conf.src_maxburst = 1; 739 - dd->dma_lch_in.dma_conf.src_addr_width = 740 - DMA_SLAVE_BUSWIDTH_4_BYTES; 741 - dd->dma_lch_in.dma_conf.dst_maxburst = 1; 742 - dd->dma_lch_in.dma_conf.dst_addr_width = 743 - DMA_SLAVE_BUSWIDTH_4_BYTES; 744 - dd->dma_lch_in.dma_conf.device_fc = false; 746 + dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM; 747 + dd->dma_lch_out.dma_conf.src_addr = dd->phys_base + 748 + TDES_ODATA1R; 749 + dd->dma_lch_out.dma_conf.src_maxburst = 1; 750 + dd->dma_lch_out.dma_conf.src_addr_width = 751 + DMA_SLAVE_BUSWIDTH_4_BYTES; 752 + dd->dma_lch_out.dma_conf.dst_maxburst = 1; 753 + dd->dma_lch_out.dma_conf.dst_addr_width = 754 + DMA_SLAVE_BUSWIDTH_4_BYTES; 755 + dd->dma_lch_out.dma_conf.device_fc = false; 745 756 746 - dma_cap_zero(mask_out); 747 - dma_cap_set(DMA_SLAVE, mask_out); 748 - dd->dma_lch_out.chan = dma_request_channel(mask_out, 749 - atmel_tdes_filter, &pdata->dma_slave->txdata); 750 - 751 - if (!dd->dma_lch_out.chan) 752 - goto err_dma_out; 753 - 754 - dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM; 755 - dd->dma_lch_out.dma_conf.src_addr = dd->phys_base + 756 - TDES_ODATA1R; 757 - dd->dma_lch_out.dma_conf.src_maxburst = 1; 758 - dd->dma_lch_out.dma_conf.src_addr_width = 759 - DMA_SLAVE_BUSWIDTH_4_BYTES; 760 - dd->dma_lch_out.dma_conf.dst_maxburst = 1; 761 - dd->dma_lch_out.dma_conf.dst_addr_width = 762 - DMA_SLAVE_BUSWIDTH_4_BYTES; 763 - dd->dma_lch_out.dma_conf.device_fc = false; 764 - 765 - return 0; 766 - } else { 767 - return -ENODEV; 768 - } 757 + return 0; 769 758 770 759 err_dma_out: 771 760 dma_release_channel(dd->dma_lch_in.chan); 772 761 err_dma_in: 762 + dev_warn(dd->dev, "no DMA channel available\n"); 773 763 return err; 774 764 } 775 765 ··· 1309 1317 } 1310 1318 } 1311 1319 1320 + #if defined(CONFIG_OF) 1321 + static const struct of_device_id atmel_tdes_dt_ids[] = { 1322 + { .compatible = "atmel,at91sam9g46-tdes" }, 1323 + { /* sentinel */ } 1324 + }; 1325 + MODULE_DEVICE_TABLE(of, atmel_tdes_dt_ids); 1326 + 1327 + static struct crypto_platform_data *atmel_tdes_of_init(struct platform_device *pdev) 1328 + { 1329 + struct device_node *np = pdev->dev.of_node; 1330 + struct crypto_platform_data *pdata; 1331 + 1332 + if (!np) { 1333 + dev_err(&pdev->dev, "device node not found\n"); 1334 + return ERR_PTR(-EINVAL); 1335 + } 1336 + 1337 + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 1338 + if (!pdata) { 1339 + dev_err(&pdev->dev, "could not allocate memory for pdata\n"); 1340 + return ERR_PTR(-ENOMEM); 1341 + } 1342 + 1343 + pdata->dma_slave = devm_kzalloc(&pdev->dev, 1344 + sizeof(*(pdata->dma_slave)), 1345 + GFP_KERNEL); 1346 + if (!pdata->dma_slave) { 1347 + dev_err(&pdev->dev, "could not allocate memory for dma_slave\n"); 1348 + devm_kfree(&pdev->dev, pdata); 1349 + return ERR_PTR(-ENOMEM); 1350 + } 1351 + 1352 + return pdata; 1353 + } 1354 + #else /* CONFIG_OF */ 1355 + static inline struct crypto_platform_data *atmel_tdes_of_init(struct platform_device *pdev) 1356 + { 1357 + return ERR_PTR(-EINVAL); 1358 + } 1359 + #endif 1360 + 1312 1361 static int atmel_tdes_probe(struct platform_device *pdev) 1313 1362 { 1314 1363 struct atmel_tdes_dev *tdes_dd; ··· 1432 1399 if (tdes_dd->caps.has_dma) { 1433 1400 pdata = pdev->dev.platform_data; 1434 1401 if (!pdata) { 1435 - dev_err(&pdev->dev, "platform data not available\n"); 1402 + pdata = atmel_tdes_of_init(pdev); 1403 + if (IS_ERR(pdata)) { 1404 + dev_err(&pdev->dev, "platform data not available\n"); 1405 + err = PTR_ERR(pdata); 1406 + goto err_pdata; 1407 + } 1408 + } 1409 + if (!pdata->dma_slave) { 1436 1410 err = -ENXIO; 1437 1411 goto err_pdata; 1438 1412 } 1439 1413 err = atmel_tdes_dma_init(tdes_dd, pdata); 1440 1414 if (err) 1441 1415 goto err_tdes_dma; 1416 + 1417 + dev_info(dev, "using %s, %s for DMA transfers\n", 1418 + dma_chan_name(tdes_dd->dma_lch_in.chan), 1419 + dma_chan_name(tdes_dd->dma_lch_out.chan)); 1442 1420 } 1443 1421 1444 1422 spin_lock(&atmel_tdes.lock); ··· 1531 1487 .driver = { 1532 1488 .name = "atmel_tdes", 1533 1489 .owner = THIS_MODULE, 1490 + .of_match_table = of_match_ptr(atmel_tdes_dt_ids), 1534 1491 }, 1535 1492 }; 1536 1493
+7
drivers/gpio/Kconfig
··· 115 115 help 116 116 Say yes here to support GPIO on CLPS711X SoCs. 117 117 118 + config GPIO_DAVINCI 119 + bool "TI Davinci/Keystone GPIO support" 120 + default y if ARCH_DAVINCI 121 + depends on ARM && (ARCH_DAVINCI || ARCH_KEYSTONE) 122 + help 123 + Say yes here to enable GPIO support for TI Davinci/Keystone SoCs. 124 + 118 125 config GPIO_GENERIC_PLATFORM 119 126 tristate "Generic memory-mapped GPIO controller support (MMIO platform device)" 120 127 select GPIO_GENERIC
+1 -1
drivers/gpio/Makefile
··· 22 22 obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o 23 23 obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.o 24 24 obj-$(CONFIG_GPIO_DA9055) += gpio-da9055.o 25 - obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o 25 + obj-$(CONFIG_GPIO_DAVINCI) += gpio-davinci.o 26 26 obj-$(CONFIG_GPIO_EM) += gpio-em.o 27 27 obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o 28 28 obj-$(CONFIG_GPIO_F7188X) += gpio-f7188x.o
+127 -58
drivers/gpio/gpio-davinci.c
··· 16 16 #include <linux/err.h> 17 17 #include <linux/io.h> 18 18 #include <linux/irq.h> 19 + #include <linux/irqdomain.h> 20 + #include <linux/module.h> 21 + #include <linux/of.h> 22 + #include <linux/of_device.h> 19 23 #include <linux/platform_device.h> 20 24 #include <linux/platform_data/gpio-davinci.h> 25 + #include <linux/irqchip/chained_irq.h> 21 26 22 27 struct davinci_gpio_regs { 23 28 u32 dir; ··· 87 82 u32 mask = 1 << offset; 88 83 89 84 spin_lock_irqsave(&d->lock, flags); 90 - temp = __raw_readl(&g->dir); 85 + temp = readl_relaxed(&g->dir); 91 86 if (out) { 92 87 temp &= ~mask; 93 - __raw_writel(mask, value ? &g->set_data : &g->clr_data); 88 + writel_relaxed(mask, value ? &g->set_data : &g->clr_data); 94 89 } else { 95 90 temp |= mask; 96 91 } 97 - __raw_writel(temp, &g->dir); 92 + writel_relaxed(temp, &g->dir); 98 93 spin_unlock_irqrestore(&d->lock, flags); 99 94 100 95 return 0; ··· 123 118 struct davinci_gpio_controller *d = chip2controller(chip); 124 119 struct davinci_gpio_regs __iomem *g = d->regs; 125 120 126 - return (1 << offset) & __raw_readl(&g->in_data); 121 + return (1 << offset) & readl_relaxed(&g->in_data); 127 122 } 128 123 129 124 /* ··· 135 130 struct davinci_gpio_controller *d = chip2controller(chip); 136 131 struct davinci_gpio_regs __iomem *g = d->regs; 137 132 138 - __raw_writel((1 << offset), value ? &g->set_data : &g->clr_data); 133 + writel_relaxed((1 << offset), value ? &g->set_data : &g->clr_data); 134 + } 135 + 136 + static struct davinci_gpio_platform_data * 137 + davinci_gpio_get_pdata(struct platform_device *pdev) 138 + { 139 + struct device_node *dn = pdev->dev.of_node; 140 + struct davinci_gpio_platform_data *pdata; 141 + int ret; 142 + u32 val; 143 + 144 + if (!IS_ENABLED(CONFIG_OF) || !pdev->dev.of_node) 145 + return pdev->dev.platform_data; 146 + 147 + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 148 + if (!pdata) 149 + return NULL; 150 + 151 + ret = of_property_read_u32(dn, "ti,ngpio", &val); 152 + if (ret) 153 + goto of_err; 154 + 155 + pdata->ngpio = val; 156 + 157 + ret = of_property_read_u32(dn, "ti,davinci-gpio-unbanked", &val); 158 + if (ret) 159 + goto of_err; 160 + 161 + pdata->gpio_unbanked = val; 162 + 163 + return pdata; 164 + 165 + of_err: 166 + dev_err(&pdev->dev, "Populating pdata from DT failed: err %d\n", ret); 167 + return NULL; 139 168 } 140 169 141 170 static int davinci_gpio_probe(struct platform_device *pdev) ··· 182 143 struct device *dev = &pdev->dev; 183 144 struct resource *res; 184 145 185 - pdata = dev->platform_data; 146 + pdata = davinci_gpio_get_pdata(pdev); 186 147 if (!pdata) { 187 148 dev_err(dev, "No platform data found\n"); 188 149 return -EINVAL; 189 150 } 151 + 152 + dev->platform_data = pdata; 190 153 191 154 /* 192 155 * The gpio banks conceptually expose a segmented bitmap, ··· 201 160 return -EINVAL; 202 161 } 203 162 204 - if (WARN_ON(DAVINCI_N_GPIO < ngpio)) 205 - ngpio = DAVINCI_N_GPIO; 163 + if (WARN_ON(ARCH_NR_GPIOS < ngpio)) 164 + ngpio = ARCH_NR_GPIOS; 206 165 207 166 chips = devm_kzalloc(dev, 208 167 ngpio * sizeof(struct davinci_gpio_controller), ··· 235 194 if (chips[i].chip.ngpio > 32) 236 195 chips[i].chip.ngpio = 32; 237 196 197 + #ifdef CONFIG_OF_GPIO 198 + chips[i].chip.of_node = dev->of_node; 199 + #endif 238 200 spin_lock_init(&chips[i].lock); 239 201 240 202 regs = gpio2regs(base); ··· 271 227 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq); 272 228 u32 mask = (u32) irq_data_get_irq_handler_data(d); 273 229 274 - __raw_writel(mask, &g->clr_falling); 275 - __raw_writel(mask, &g->clr_rising); 230 + writel_relaxed(mask, &g->clr_falling); 231 + writel_relaxed(mask, &g->clr_rising); 276 232 } 277 233 278 234 static void gpio_irq_enable(struct irq_data *d) ··· 286 242 status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING; 287 243 288 244 if (status & IRQ_TYPE_EDGE_FALLING) 289 - __raw_writel(mask, &g->set_falling); 245 + writel_relaxed(mask, &g->set_falling); 290 246 if (status & IRQ_TYPE_EDGE_RISING) 291 - __raw_writel(mask, &g->set_rising); 247 + writel_relaxed(mask, &g->set_rising); 292 248 } 293 249 294 250 static int gpio_irq_type(struct irq_data *d, unsigned trigger) ··· 322 278 mask <<= 16; 323 279 324 280 /* temporarily mask (level sensitive) parent IRQ */ 325 - desc->irq_data.chip->irq_mask(&desc->irq_data); 326 - desc->irq_data.chip->irq_ack(&desc->irq_data); 281 + chained_irq_enter(irq_desc_get_chip(desc), desc); 327 282 while (1) { 328 283 u32 status; 329 - int n; 330 - int res; 284 + int bit; 331 285 332 286 /* ack any irqs */ 333 - status = __raw_readl(&g->intstat) & mask; 287 + status = readl_relaxed(&g->intstat) & mask; 334 288 if (!status) 335 289 break; 336 - __raw_writel(status, &g->intstat); 290 + writel_relaxed(status, &g->intstat); 337 291 338 292 /* now demux them to the right lowlevel handler */ 339 - n = d->irq_base; 340 - if (irq & 1) { 341 - n += 16; 342 - status >>= 16; 343 - } 344 293 345 294 while (status) { 346 - res = ffs(status); 347 - n += res; 348 - generic_handle_irq(n - 1); 349 - status >>= res; 295 + bit = __ffs(status); 296 + status &= ~BIT(bit); 297 + generic_handle_irq( 298 + irq_find_mapping(d->irq_domain, 299 + d->chip.base + bit)); 350 300 } 351 301 } 352 - desc->irq_data.chip->irq_unmask(&desc->irq_data); 302 + chained_irq_exit(irq_desc_get_chip(desc), desc); 353 303 /* now it may re-trigger */ 354 304 } 355 305 ··· 351 313 { 352 314 struct davinci_gpio_controller *d = chip2controller(chip); 353 315 354 - if (d->irq_base >= 0) 355 - return d->irq_base + offset; 316 + if (d->irq_domain) 317 + return irq_create_mapping(d->irq_domain, d->chip.base + offset); 356 318 else 357 - return -ENODEV; 319 + return -ENXIO; 358 320 } 359 321 360 322 static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) ··· 384 346 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 385 347 return -EINVAL; 386 348 387 - __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING) 349 + writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_FALLING) 388 350 ? &g->set_falling : &g->clr_falling); 389 - __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING) 351 + writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_RISING) 390 352 ? &g->set_rising : &g->clr_rising); 391 353 392 354 return 0; 393 355 } 356 + 357 + static int 358 + davinci_gpio_irq_map(struct irq_domain *d, unsigned int irq, 359 + irq_hw_number_t hw) 360 + { 361 + struct davinci_gpio_regs __iomem *g = gpio2regs(hw); 362 + 363 + irq_set_chip_and_handler_name(irq, &gpio_irqchip, handle_simple_irq, 364 + "davinci_gpio"); 365 + irq_set_irq_type(irq, IRQ_TYPE_NONE); 366 + irq_set_chip_data(irq, (__force void *)g); 367 + irq_set_handler_data(irq, (void *)__gpio_mask(hw)); 368 + set_irq_flags(irq, IRQF_VALID); 369 + 370 + return 0; 371 + } 372 + 373 + static const struct irq_domain_ops davinci_gpio_irq_ops = { 374 + .map = davinci_gpio_irq_map, 375 + .xlate = irq_domain_xlate_onetwocell, 376 + }; 394 377 395 378 /* 396 379 * NOTE: for suspend/resume, probably best to make a platform_device with ··· 432 373 struct davinci_gpio_controller *chips = platform_get_drvdata(pdev); 433 374 struct davinci_gpio_platform_data *pdata = dev->platform_data; 434 375 struct davinci_gpio_regs __iomem *g; 376 + struct irq_domain *irq_domain = NULL; 435 377 436 378 ngpio = pdata->ngpio; 437 379 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); ··· 456 396 } 457 397 clk_prepare_enable(clk); 458 398 399 + if (!pdata->gpio_unbanked) { 400 + irq = irq_alloc_descs(-1, 0, ngpio, 0); 401 + if (irq < 0) { 402 + dev_err(dev, "Couldn't allocate IRQ numbers\n"); 403 + return irq; 404 + } 405 + 406 + irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0, 407 + &davinci_gpio_irq_ops, 408 + chips); 409 + if (!irq_domain) { 410 + dev_err(dev, "Couldn't register an IRQ domain\n"); 411 + return -ENODEV; 412 + } 413 + } 414 + 459 415 /* 460 416 * Arrange gpio_to_irq() support, handling either direct IRQs or 461 417 * banked IRQs. Having GPIOs in the first GPIO bank use direct ··· 480 404 */ 481 405 for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) { 482 406 chips[bank].chip.to_irq = gpio_to_irq_banked; 483 - chips[bank].irq_base = pdata->gpio_unbanked 484 - ? -EINVAL 485 - : (pdata->intc_irq_num + gpio); 407 + chips[bank].irq_domain = irq_domain; 486 408 } 487 409 488 410 /* ··· 506 432 507 433 /* default trigger: both edges */ 508 434 g = gpio2regs(0); 509 - __raw_writel(~0, &g->set_falling); 510 - __raw_writel(~0, &g->set_rising); 435 + writel_relaxed(~0, &g->set_falling); 436 + writel_relaxed(~0, &g->set_rising); 511 437 512 438 /* set the direct IRQs up to use that irqchip */ 513 439 for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) { ··· 523 449 * Or, AINTC can handle IRQs for banks of 16 GPIO IRQs, which we 524 450 * then chain through our own handler. 525 451 */ 526 - for (gpio = 0, irq = gpio_to_irq(0), bank = 0; 527 - gpio < ngpio; 528 - bank++, bank_irq++) { 529 - unsigned i; 530 - 452 + for (gpio = 0, bank = 0; gpio < ngpio; bank++, bank_irq++, gpio += 16) { 531 453 /* disabled by default, enabled only as needed */ 532 454 g = gpio2regs(gpio); 533 - __raw_writel(~0, &g->clr_falling); 534 - __raw_writel(~0, &g->clr_rising); 455 + writel_relaxed(~0, &g->clr_falling); 456 + writel_relaxed(~0, &g->clr_rising); 535 457 536 458 /* set up all irqs in this bank */ 537 459 irq_set_chained_handler(bank_irq, gpio_irq_handler); ··· 539 469 */ 540 470 irq_set_handler_data(bank_irq, &chips[gpio / 32]); 541 471 542 - for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) { 543 - irq_set_chip(irq, &gpio_irqchip); 544 - irq_set_chip_data(irq, (__force void *)g); 545 - irq_set_handler_data(irq, (void *)__gpio_mask(gpio)); 546 - irq_set_handler(irq, handle_simple_irq); 547 - set_irq_flags(irq, IRQF_VALID); 548 - } 549 - 550 472 binten |= BIT(bank); 551 473 } 552 474 ··· 547 485 * BINTEN -- per-bank interrupt enable. genirq would also let these 548 486 * bits be set/cleared dynamically. 549 487 */ 550 - __raw_writel(binten, gpio_base + BINTEN); 551 - 552 - printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); 488 + writel_relaxed(binten, gpio_base + BINTEN); 553 489 554 490 return 0; 555 491 } 556 492 493 + #if IS_ENABLED(CONFIG_OF) 494 + static const struct of_device_id davinci_gpio_ids[] = { 495 + { .compatible = "ti,dm6441-gpio", }, 496 + { /* sentinel */ }, 497 + }; 498 + MODULE_DEVICE_TABLE(of, davinci_gpio_ids); 499 + #endif 500 + 557 501 static struct platform_driver davinci_gpio_driver = { 558 502 .probe = davinci_gpio_probe, 559 503 .driver = { 560 - .name = "davinci_gpio", 561 - .owner = THIS_MODULE, 504 + .name = "davinci_gpio", 505 + .owner = THIS_MODULE, 506 + .of_match_table = of_match_ptr(davinci_gpio_ids), 562 507 }, 563 508 }; 564 509
+3 -12
drivers/irqchip/exynos-combiner.c
··· 171 171 172 172 static void __init combiner_init(void __iomem *combiner_base, 173 173 struct device_node *np, 174 - unsigned int max_nr, 175 - int irq_base) 174 + unsigned int max_nr) 176 175 { 177 176 int i, irq; 178 177 unsigned int nr_irq; ··· 185 186 return; 186 187 } 187 188 188 - combiner_irq_domain = irq_domain_add_simple(np, nr_irq, irq_base, 189 + combiner_irq_domain = irq_domain_add_linear(np, nr_irq, 189 190 &combiner_irq_domain_ops, combiner_data); 190 191 if (WARN_ON(!combiner_irq_domain)) { 191 192 pr_warning("%s: irq domain init failed\n", __func__); ··· 206 207 { 207 208 void __iomem *combiner_base; 208 209 unsigned int max_nr = 20; 209 - int irq_base = -1; 210 210 211 211 combiner_base = of_iomap(np, 0); 212 212 if (!combiner_base) { ··· 219 221 __func__, max_nr); 220 222 } 221 223 222 - /* 223 - * FIXME: This is a hardwired COMBINER_IRQ(0,0). Once all devices 224 - * get their IRQ from DT, remove this in order to get dynamic 225 - * allocation. 226 - */ 227 - irq_base = 160; 228 - 229 - combiner_init(combiner_base, np, max_nr, irq_base); 224 + combiner_init(combiner_base, np, max_nr); 230 225 231 226 return 0; 232 227 }
+8 -13
drivers/irqchip/irq-renesas-irqc.c
··· 81 81 iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_STS); 82 82 } 83 83 84 - #define INTC_IRQ_SENSE_VALID 0x10 85 - #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) 86 - 87 84 static unsigned char irqc_sense[IRQ_TYPE_SENSE_MASK + 1] = { 88 - [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x01), 89 - [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x02), 90 - [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x04), /* Synchronous */ 91 - [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x08), /* Synchronous */ 92 - [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x0c), /* Synchronous */ 85 + [IRQ_TYPE_LEVEL_LOW] = 0x01, 86 + [IRQ_TYPE_LEVEL_HIGH] = 0x02, 87 + [IRQ_TYPE_EDGE_FALLING] = 0x04, /* Synchronous */ 88 + [IRQ_TYPE_EDGE_RISING] = 0x08, /* Synchronous */ 89 + [IRQ_TYPE_EDGE_BOTH] = 0x0c, /* Synchronous */ 93 90 }; 94 91 95 92 static int irqc_irq_set_type(struct irq_data *d, unsigned int type) ··· 98 101 99 102 irqc_dbg(&p->irq[hw_irq], "sense"); 100 103 101 - if (!(value & INTC_IRQ_SENSE_VALID)) 104 + if (!value) 102 105 return -EINVAL; 103 106 104 107 tmp = ioread32(p->iomem + IRQC_CONFIG(hw_irq)); 105 108 tmp &= ~0x3f; 106 - tmp |= value ^ INTC_IRQ_SENSE_VALID; 109 + tmp |= value; 107 110 iowrite32(tmp, p->iomem + IRQC_CONFIG(hw_irq)); 108 111 return 0; 109 112 } ··· 209 212 irq_chip->name = name; 210 213 irq_chip->irq_mask = irqc_irq_disable; 211 214 irq_chip->irq_unmask = irqc_irq_enable; 212 - irq_chip->irq_enable = irqc_irq_enable; 213 - irq_chip->irq_disable = irqc_irq_disable; 214 215 irq_chip->irq_set_type = irqc_irq_set_type; 215 - irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; 216 + irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; 216 217 217 218 p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, 218 219 p->number_of_irqs,
+13 -2
drivers/irqchip/irq-versatile-fpga.c
··· 9 9 #include <linux/module.h> 10 10 #include <linux/of.h> 11 11 #include <linux/of_address.h> 12 + #include <linux/of_irq.h> 12 13 13 14 #include <asm/exception.h> 14 15 #include <asm/mach/irq.h> ··· 168 167 f->used_irqs++; 169 168 } 170 169 171 - pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n", 170 + pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs", 172 171 fpga_irq_id, name, base, f->used_irqs); 172 + if (parent_irq != -1) 173 + pr_cont(", parent IRQ: %d\n", parent_irq); 174 + else 175 + pr_cont("\n"); 173 176 174 177 fpga_irq_id++; 175 178 } ··· 185 180 void __iomem *base; 186 181 u32 clear_mask; 187 182 u32 valid_mask; 183 + int parent_irq; 188 184 189 185 if (WARN_ON(!node)) 190 186 return -ENODEV; ··· 199 193 if (of_property_read_u32(node, "valid-mask", &valid_mask)) 200 194 valid_mask = 0; 201 195 202 - fpga_irq_init(base, node->name, 0, -1, valid_mask, node); 196 + /* Some chips are cascaded from a parent IRQ */ 197 + parent_irq = irq_of_parse_and_map(node, 0); 198 + if (!parent_irq) 199 + parent_irq = -1; 200 + 201 + fpga_irq_init(base, node->name, 0, parent_irq, valid_mask, node); 203 202 204 203 writel(clear_mask, base + IRQ_ENABLE_CLEAR); 205 204 writel(clear_mask, base + FIQ_ENABLE_CLEAR);
+1 -1
drivers/mmc/host/Kconfig
··· 324 324 325 325 config MMC_MSM 326 326 tristate "Qualcomm SDCC Controller Support" 327 - depends on MMC && ARCH_MSM 327 + depends on MMC && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) 328 328 help 329 329 This provides support for the SD/MMC cell found in the 330 330 MSM and QSD SOCs from Qualcomm. The controller also has
+18
drivers/rtc/Kconfig
··· 304 304 This driver can also be built as a module. If so, the module 305 305 will be called rtc-isl12022. 306 306 307 + config RTC_DRV_ISL12057 308 + depends on I2C 309 + select REGMAP_I2C 310 + tristate "Intersil ISL12057" 311 + help 312 + If you say yes here you get support for the Intersil ISL12057 313 + I2C RTC chip. 314 + 315 + This driver can also be built as a module. If so, the module 316 + will be called rtc-isl12057. 317 + 307 318 config RTC_DRV_X1205 308 319 tristate "Xicor/Intersil X1205" 309 320 help ··· 1114 1103 help 1115 1104 If you say Y here you will get support for the Hypervisor 1116 1105 based RTC on SUN4V systems. 1106 + 1107 + config RTC_DRV_SUNXI 1108 + tristate "Allwinner sun4i/sun7i RTC" 1109 + depends on ARCH_SUNXI 1110 + help 1111 + If you say Y here you will get support for the RTC found on 1112 + Allwinner A10/A20. 1117 1113 1118 1114 config RTC_DRV_STARFIRE 1119 1115 bool "Starfire RTC"
+2
drivers/rtc/Makefile
··· 58 58 obj-$(CONFIG_RTC_DRV_IMXDI) += rtc-imxdi.o 59 59 obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o 60 60 obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o 61 + obj-$(CONFIG_RTC_DRV_ISL12057) += rtc-isl12057.o 61 62 obj-$(CONFIG_RTC_DRV_JZ4740) += rtc-jz4740.o 62 63 obj-$(CONFIG_RTC_DRV_LP8788) += rtc-lp8788.o 63 64 obj-$(CONFIG_RTC_DRV_LPC32XX) += rtc-lpc32xx.o ··· 118 117 obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o 119 118 obj-$(CONFIG_RTC_DRV_STMP) += rtc-stmp3xxx.o 120 119 obj-$(CONFIG_RTC_DRV_SUN4V) += rtc-sun4v.o 120 + obj-$(CONFIG_RTC_DRV_SUNXI) += rtc-sunxi.o 121 121 obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o 122 122 obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o 123 123 obj-$(CONFIG_RTC_DRV_TILE) += rtc-tile.o
+310
drivers/rtc/rtc-isl12057.c
··· 1 + /* 2 + * rtc-isl12057 - Driver for Intersil ISL12057 I2C Real Time Clock 3 + * 4 + * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org> 5 + * 6 + * This work is largely based on Intersil ISL1208 driver developed by 7 + * Hebert Valerio Riedel <hvr@gnu.org>. 8 + * 9 + * Detailed datasheet on which this development is based is available here: 10 + * 11 + * http://natisbad.org/NAS2/refs/ISL12057.pdf 12 + * 13 + * This program is free software; you can redistribute it and/or modify 14 + * it under the terms of the GNU General Public License as published by 15 + * the Free Software Foundation; either version 2 of the License, or 16 + * (at your option) any later version. 17 + * 18 + * This program is distributed in the hope that it will be useful, 19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 + * GNU General Public License for more details. 22 + */ 23 + 24 + #include <linux/module.h> 25 + #include <linux/mutex.h> 26 + #include <linux/rtc.h> 27 + #include <linux/i2c.h> 28 + #include <linux/bcd.h> 29 + #include <linux/rtc.h> 30 + #include <linux/of.h> 31 + #include <linux/of_device.h> 32 + #include <linux/regmap.h> 33 + 34 + #define DRV_NAME "rtc-isl12057" 35 + 36 + /* RTC section */ 37 + #define ISL12057_REG_RTC_SC 0x00 /* Seconds */ 38 + #define ISL12057_REG_RTC_MN 0x01 /* Minutes */ 39 + #define ISL12057_REG_RTC_HR 0x02 /* Hours */ 40 + #define ISL12057_REG_RTC_HR_PM BIT(5) /* AM/PM bit in 12h format */ 41 + #define ISL12057_REG_RTC_HR_MIL BIT(6) /* 24h/12h format */ 42 + #define ISL12057_REG_RTC_DW 0x03 /* Day of the Week */ 43 + #define ISL12057_REG_RTC_DT 0x04 /* Date */ 44 + #define ISL12057_REG_RTC_MO 0x05 /* Month */ 45 + #define ISL12057_REG_RTC_YR 0x06 /* Year */ 46 + #define ISL12057_RTC_SEC_LEN 7 47 + 48 + /* Alarm 1 section */ 49 + #define ISL12057_REG_A1_SC 0x07 /* Alarm 1 Seconds */ 50 + #define ISL12057_REG_A1_MN 0x08 /* Alarm 1 Minutes */ 51 + #define ISL12057_REG_A1_HR 0x09 /* Alarm 1 Hours */ 52 + #define ISL12057_REG_A1_HR_PM BIT(5) /* AM/PM bit in 12h format */ 53 + #define ISL12057_REG_A1_HR_MIL BIT(6) /* 24h/12h format */ 54 + #define ISL12057_REG_A1_DWDT 0x0A /* Alarm 1 Date / Day of the week */ 55 + #define ISL12057_REG_A1_DWDT_B BIT(6) /* DW / DT selection bit */ 56 + #define ISL12057_A1_SEC_LEN 4 57 + 58 + /* Alarm 2 section */ 59 + #define ISL12057_REG_A2_MN 0x0B /* Alarm 2 Minutes */ 60 + #define ISL12057_REG_A2_HR 0x0C /* Alarm 2 Hours */ 61 + #define ISL12057_REG_A2_DWDT 0x0D /* Alarm 2 Date / Day of the week */ 62 + #define ISL12057_A2_SEC_LEN 3 63 + 64 + /* Control/Status registers */ 65 + #define ISL12057_REG_INT 0x0E 66 + #define ISL12057_REG_INT_A1IE BIT(0) /* Alarm 1 interrupt enable bit */ 67 + #define ISL12057_REG_INT_A2IE BIT(1) /* Alarm 2 interrupt enable bit */ 68 + #define ISL12057_REG_INT_INTCN BIT(2) /* Interrupt control enable bit */ 69 + #define ISL12057_REG_INT_RS1 BIT(3) /* Freq out control bit 1 */ 70 + #define ISL12057_REG_INT_RS2 BIT(4) /* Freq out control bit 2 */ 71 + #define ISL12057_REG_INT_EOSC BIT(7) /* Oscillator enable bit */ 72 + 73 + #define ISL12057_REG_SR 0x0F 74 + #define ISL12057_REG_SR_A1F BIT(0) /* Alarm 1 interrupt bit */ 75 + #define ISL12057_REG_SR_A2F BIT(1) /* Alarm 2 interrupt bit */ 76 + #define ISL12057_REG_SR_OSF BIT(7) /* Oscillator failure bit */ 77 + 78 + /* Register memory map length */ 79 + #define ISL12057_MEM_MAP_LEN 0x10 80 + 81 + struct isl12057_rtc_data { 82 + struct regmap *regmap; 83 + struct mutex lock; 84 + }; 85 + 86 + static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs) 87 + { 88 + tm->tm_sec = bcd2bin(regs[ISL12057_REG_RTC_SC]); 89 + tm->tm_min = bcd2bin(regs[ISL12057_REG_RTC_MN]); 90 + 91 + if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_MIL) { /* AM/PM */ 92 + tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x0f); 93 + if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_PM) 94 + tm->tm_hour += 12; 95 + } else { /* 24 hour mode */ 96 + tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x3f); 97 + } 98 + 99 + tm->tm_mday = bcd2bin(regs[ISL12057_REG_RTC_DT]); 100 + tm->tm_wday = bcd2bin(regs[ISL12057_REG_RTC_DW]) - 1; /* starts at 1 */ 101 + tm->tm_mon = bcd2bin(regs[ISL12057_REG_RTC_MO]) - 1; /* starts at 1 */ 102 + tm->tm_year = bcd2bin(regs[ISL12057_REG_RTC_YR]) + 100; 103 + } 104 + 105 + static int isl12057_rtc_tm_to_regs(u8 *regs, struct rtc_time *tm) 106 + { 107 + /* 108 + * The clock has an 8 bit wide bcd-coded register for the year. 109 + * tm_year is an offset from 1900 and we are interested in the 110 + * 2000-2099 range, so any value less than 100 is invalid. 111 + */ 112 + if (tm->tm_year < 100) 113 + return -EINVAL; 114 + 115 + regs[ISL12057_REG_RTC_SC] = bin2bcd(tm->tm_sec); 116 + regs[ISL12057_REG_RTC_MN] = bin2bcd(tm->tm_min); 117 + regs[ISL12057_REG_RTC_HR] = bin2bcd(tm->tm_hour); /* 24-hour format */ 118 + regs[ISL12057_REG_RTC_DT] = bin2bcd(tm->tm_mday); 119 + regs[ISL12057_REG_RTC_MO] = bin2bcd(tm->tm_mon + 1); 120 + regs[ISL12057_REG_RTC_YR] = bin2bcd(tm->tm_year - 100); 121 + regs[ISL12057_REG_RTC_DW] = bin2bcd(tm->tm_wday + 1); 122 + 123 + return 0; 124 + } 125 + 126 + /* 127 + * Try and match register bits w/ fixed null values to see whether we 128 + * are dealing with an ISL12057. Note: this function is called early 129 + * during init and hence does need mutex protection. 130 + */ 131 + static int isl12057_i2c_validate_chip(struct regmap *regmap) 132 + { 133 + u8 regs[ISL12057_MEM_MAP_LEN]; 134 + static const u8 mask[ISL12057_MEM_MAP_LEN] = { 0x80, 0x80, 0x80, 0xf8, 135 + 0xc0, 0x60, 0x00, 0x00, 136 + 0x00, 0x00, 0x00, 0x00, 137 + 0x00, 0x00, 0x60, 0x7c }; 138 + int ret, i; 139 + 140 + ret = regmap_bulk_read(regmap, 0, regs, ISL12057_MEM_MAP_LEN); 141 + if (ret) 142 + return ret; 143 + 144 + for (i = 0; i < ISL12057_MEM_MAP_LEN; ++i) { 145 + if (regs[i] & mask[i]) /* check if bits are cleared */ 146 + return -ENODEV; 147 + } 148 + 149 + return 0; 150 + } 151 + 152 + static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm) 153 + { 154 + struct isl12057_rtc_data *data = dev_get_drvdata(dev); 155 + u8 regs[ISL12057_RTC_SEC_LEN]; 156 + int ret; 157 + 158 + mutex_lock(&data->lock); 159 + ret = regmap_bulk_read(data->regmap, ISL12057_REG_RTC_SC, regs, 160 + ISL12057_RTC_SEC_LEN); 161 + mutex_unlock(&data->lock); 162 + 163 + if (ret) { 164 + dev_err(dev, "%s: RTC read failed\n", __func__); 165 + return ret; 166 + } 167 + 168 + isl12057_rtc_regs_to_tm(tm, regs); 169 + 170 + return rtc_valid_tm(tm); 171 + } 172 + 173 + static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm) 174 + { 175 + struct isl12057_rtc_data *data = dev_get_drvdata(dev); 176 + u8 regs[ISL12057_RTC_SEC_LEN]; 177 + int ret; 178 + 179 + ret = isl12057_rtc_tm_to_regs(regs, tm); 180 + if (ret) 181 + return ret; 182 + 183 + mutex_lock(&data->lock); 184 + ret = regmap_bulk_write(data->regmap, ISL12057_REG_RTC_SC, regs, 185 + ISL12057_RTC_SEC_LEN); 186 + mutex_unlock(&data->lock); 187 + 188 + if (ret) 189 + dev_err(dev, "%s: RTC write failed\n", __func__); 190 + 191 + return ret; 192 + } 193 + 194 + /* 195 + * Check current RTC status and enable/disable what needs to be. Return 0 if 196 + * everything went ok and a negative value upon error. Note: this function 197 + * is called early during init and hence does need mutex protection. 198 + */ 199 + static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap) 200 + { 201 + int ret; 202 + 203 + /* Enable oscillator if not already running */ 204 + ret = regmap_update_bits(regmap, ISL12057_REG_INT, 205 + ISL12057_REG_INT_EOSC, 0); 206 + if (ret < 0) { 207 + dev_err(dev, "Unable to enable oscillator\n"); 208 + return ret; 209 + } 210 + 211 + /* Clear oscillator failure bit if needed */ 212 + ret = regmap_update_bits(regmap, ISL12057_REG_SR, 213 + ISL12057_REG_SR_OSF, 0); 214 + if (ret < 0) { 215 + dev_err(dev, "Unable to clear oscillator failure bit\n"); 216 + return ret; 217 + } 218 + 219 + /* Clear alarm bit if needed */ 220 + ret = regmap_update_bits(regmap, ISL12057_REG_SR, 221 + ISL12057_REG_SR_A1F, 0); 222 + if (ret < 0) { 223 + dev_err(dev, "Unable to clear alarm bit\n"); 224 + return ret; 225 + } 226 + 227 + return 0; 228 + } 229 + 230 + static const struct rtc_class_ops rtc_ops = { 231 + .read_time = isl12057_rtc_read_time, 232 + .set_time = isl12057_rtc_set_time, 233 + }; 234 + 235 + static struct regmap_config isl12057_rtc_regmap_config = { 236 + .reg_bits = 8, 237 + .val_bits = 8, 238 + }; 239 + 240 + static int isl12057_probe(struct i2c_client *client, 241 + const struct i2c_device_id *id) 242 + { 243 + struct device *dev = &client->dev; 244 + struct isl12057_rtc_data *data; 245 + struct rtc_device *rtc; 246 + struct regmap *regmap; 247 + int ret; 248 + 249 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | 250 + I2C_FUNC_SMBUS_BYTE_DATA | 251 + I2C_FUNC_SMBUS_I2C_BLOCK)) 252 + return -ENODEV; 253 + 254 + regmap = devm_regmap_init_i2c(client, &isl12057_rtc_regmap_config); 255 + if (IS_ERR(regmap)) { 256 + ret = PTR_ERR(regmap); 257 + dev_err(dev, "regmap allocation failed: %d\n", ret); 258 + return ret; 259 + } 260 + 261 + ret = isl12057_i2c_validate_chip(regmap); 262 + if (ret) 263 + return ret; 264 + 265 + ret = isl12057_check_rtc_status(dev, regmap); 266 + if (ret) 267 + return ret; 268 + 269 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 270 + if (!data) 271 + return -ENOMEM; 272 + 273 + mutex_init(&data->lock); 274 + data->regmap = regmap; 275 + dev_set_drvdata(dev, data); 276 + 277 + rtc = devm_rtc_device_register(dev, DRV_NAME, &rtc_ops, THIS_MODULE); 278 + if (IS_ERR(rtc)) 279 + return PTR_ERR(rtc); 280 + 281 + return 0; 282 + } 283 + 284 + #ifdef CONFIG_OF 285 + static struct of_device_id isl12057_dt_match[] = { 286 + { .compatible = "isl,isl12057" }, 287 + { }, 288 + }; 289 + #endif 290 + 291 + static const struct i2c_device_id isl12057_id[] = { 292 + { "isl12057", 0 }, 293 + { } 294 + }; 295 + MODULE_DEVICE_TABLE(i2c, isl12057_id); 296 + 297 + static struct i2c_driver isl12057_driver = { 298 + .driver = { 299 + .name = DRV_NAME, 300 + .owner = THIS_MODULE, 301 + .of_match_table = of_match_ptr(isl12057_dt_match), 302 + }, 303 + .probe = isl12057_probe, 304 + .id_table = isl12057_id, 305 + }; 306 + module_i2c_driver(isl12057_driver); 307 + 308 + MODULE_AUTHOR("Arnaud EBALARD <arno@natisbad.org>"); 309 + MODULE_DESCRIPTION("Intersil ISL12057 RTC driver"); 310 + MODULE_LICENSE("GPL");
+523
drivers/rtc/rtc-sunxi.c
··· 1 + /* 2 + * An RTC driver for Allwinner A10/A20 3 + * 4 + * Copyright (c) 2013, Carlo Caione <carlo.caione@gmail.com> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, but WITHOUT 12 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 + * more details. 15 + * 16 + * You should have received a copy of the GNU General Public License along 17 + * with this program; if not, write to the Free Software Foundation, Inc., 18 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 + */ 20 + 21 + #include <linux/delay.h> 22 + #include <linux/err.h> 23 + #include <linux/fs.h> 24 + #include <linux/init.h> 25 + #include <linux/interrupt.h> 26 + #include <linux/io.h> 27 + #include <linux/kernel.h> 28 + #include <linux/module.h> 29 + #include <linux/of.h> 30 + #include <linux/of_address.h> 31 + #include <linux/of_device.h> 32 + #include <linux/platform_device.h> 33 + #include <linux/rtc.h> 34 + #include <linux/types.h> 35 + 36 + #define SUNXI_LOSC_CTRL 0x0000 37 + #define SUNXI_LOSC_CTRL_RTC_HMS_ACC BIT(8) 38 + #define SUNXI_LOSC_CTRL_RTC_YMD_ACC BIT(7) 39 + 40 + #define SUNXI_RTC_YMD 0x0004 41 + 42 + #define SUNXI_RTC_HMS 0x0008 43 + 44 + #define SUNXI_ALRM_DHMS 0x000c 45 + 46 + #define SUNXI_ALRM_EN 0x0014 47 + #define SUNXI_ALRM_EN_CNT_EN BIT(8) 48 + 49 + #define SUNXI_ALRM_IRQ_EN 0x0018 50 + #define SUNXI_ALRM_IRQ_EN_CNT_IRQ_EN BIT(0) 51 + 52 + #define SUNXI_ALRM_IRQ_STA 0x001c 53 + #define SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND BIT(0) 54 + 55 + #define SUNXI_MASK_DH 0x0000001f 56 + #define SUNXI_MASK_SM 0x0000003f 57 + #define SUNXI_MASK_M 0x0000000f 58 + #define SUNXI_MASK_LY 0x00000001 59 + #define SUNXI_MASK_D 0x00000ffe 60 + #define SUNXI_MASK_M 0x0000000f 61 + 62 + #define SUNXI_GET(x, mask, shift) (((x) & ((mask) << (shift))) \ 63 + >> (shift)) 64 + 65 + #define SUNXI_SET(x, mask, shift) (((x) & (mask)) << (shift)) 66 + 67 + /* 68 + * Get date values 69 + */ 70 + #define SUNXI_DATE_GET_DAY_VALUE(x) SUNXI_GET(x, SUNXI_MASK_DH, 0) 71 + #define SUNXI_DATE_GET_MON_VALUE(x) SUNXI_GET(x, SUNXI_MASK_M, 8) 72 + #define SUNXI_DATE_GET_YEAR_VALUE(x, mask) SUNXI_GET(x, mask, 16) 73 + 74 + /* 75 + * Get time values 76 + */ 77 + #define SUNXI_TIME_GET_SEC_VALUE(x) SUNXI_GET(x, SUNXI_MASK_SM, 0) 78 + #define SUNXI_TIME_GET_MIN_VALUE(x) SUNXI_GET(x, SUNXI_MASK_SM, 8) 79 + #define SUNXI_TIME_GET_HOUR_VALUE(x) SUNXI_GET(x, SUNXI_MASK_DH, 16) 80 + 81 + /* 82 + * Get alarm values 83 + */ 84 + #define SUNXI_ALRM_GET_SEC_VALUE(x) SUNXI_GET(x, SUNXI_MASK_SM, 0) 85 + #define SUNXI_ALRM_GET_MIN_VALUE(x) SUNXI_GET(x, SUNXI_MASK_SM, 8) 86 + #define SUNXI_ALRM_GET_HOUR_VALUE(x) SUNXI_GET(x, SUNXI_MASK_DH, 16) 87 + 88 + /* 89 + * Set date values 90 + */ 91 + #define SUNXI_DATE_SET_DAY_VALUE(x) SUNXI_DATE_GET_DAY_VALUE(x) 92 + #define SUNXI_DATE_SET_MON_VALUE(x) SUNXI_SET(x, SUNXI_MASK_M, 8) 93 + #define SUNXI_DATE_SET_YEAR_VALUE(x, mask) SUNXI_SET(x, mask, 16) 94 + #define SUNXI_LEAP_SET_VALUE(x, shift) SUNXI_SET(x, SUNXI_MASK_LY, shift) 95 + 96 + /* 97 + * Set time values 98 + */ 99 + #define SUNXI_TIME_SET_SEC_VALUE(x) SUNXI_TIME_GET_SEC_VALUE(x) 100 + #define SUNXI_TIME_SET_MIN_VALUE(x) SUNXI_SET(x, SUNXI_MASK_SM, 8) 101 + #define SUNXI_TIME_SET_HOUR_VALUE(x) SUNXI_SET(x, SUNXI_MASK_DH, 16) 102 + 103 + /* 104 + * Set alarm values 105 + */ 106 + #define SUNXI_ALRM_SET_SEC_VALUE(x) SUNXI_ALRM_GET_SEC_VALUE(x) 107 + #define SUNXI_ALRM_SET_MIN_VALUE(x) SUNXI_SET(x, SUNXI_MASK_SM, 8) 108 + #define SUNXI_ALRM_SET_HOUR_VALUE(x) SUNXI_SET(x, SUNXI_MASK_DH, 16) 109 + #define SUNXI_ALRM_SET_DAY_VALUE(x) SUNXI_SET(x, SUNXI_MASK_D, 21) 110 + 111 + /* 112 + * Time unit conversions 113 + */ 114 + #define SEC_IN_MIN 60 115 + #define SEC_IN_HOUR (60 * SEC_IN_MIN) 116 + #define SEC_IN_DAY (24 * SEC_IN_HOUR) 117 + 118 + /* 119 + * The year parameter passed to the driver is usually an offset relative to 120 + * the year 1900. This macro is used to convert this offset to another one 121 + * relative to the minimum year allowed by the hardware. 122 + */ 123 + #define SUNXI_YEAR_OFF(x) ((x)->min - 1900) 124 + 125 + /* 126 + * min and max year are arbitrary set considering the limited range of the 127 + * hardware register field 128 + */ 129 + struct sunxi_rtc_data_year { 130 + unsigned int min; /* min year allowed */ 131 + unsigned int max; /* max year allowed */ 132 + unsigned int mask; /* mask for the year field */ 133 + unsigned char leap_shift; /* bit shift to get the leap year */ 134 + }; 135 + 136 + static struct sunxi_rtc_data_year data_year_param[] = { 137 + [0] = { 138 + .min = 2010, 139 + .max = 2073, 140 + .mask = 0x3f, 141 + .leap_shift = 22, 142 + }, 143 + [1] = { 144 + .min = 1970, 145 + .max = 2225, 146 + .mask = 0xff, 147 + .leap_shift = 24, 148 + }, 149 + }; 150 + 151 + struct sunxi_rtc_dev { 152 + struct rtc_device *rtc; 153 + struct device *dev; 154 + struct sunxi_rtc_data_year *data_year; 155 + void __iomem *base; 156 + int irq; 157 + }; 158 + 159 + static irqreturn_t sunxi_rtc_alarmirq(int irq, void *id) 160 + { 161 + struct sunxi_rtc_dev *chip = (struct sunxi_rtc_dev *) id; 162 + u32 val; 163 + 164 + val = readl(chip->base + SUNXI_ALRM_IRQ_STA); 165 + 166 + if (val & SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND) { 167 + val |= SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND; 168 + writel(val, chip->base + SUNXI_ALRM_IRQ_STA); 169 + 170 + rtc_update_irq(chip->rtc, 1, RTC_AF | RTC_IRQF); 171 + 172 + return IRQ_HANDLED; 173 + } 174 + 175 + return IRQ_NONE; 176 + } 177 + 178 + static void sunxi_rtc_setaie(int to, struct sunxi_rtc_dev *chip) 179 + { 180 + u32 alrm_val = 0; 181 + u32 alrm_irq_val = 0; 182 + 183 + if (to) { 184 + alrm_val = readl(chip->base + SUNXI_ALRM_EN); 185 + alrm_val |= SUNXI_ALRM_EN_CNT_EN; 186 + 187 + alrm_irq_val = readl(chip->base + SUNXI_ALRM_IRQ_EN); 188 + alrm_irq_val |= SUNXI_ALRM_IRQ_EN_CNT_IRQ_EN; 189 + } else { 190 + writel(SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND, 191 + chip->base + SUNXI_ALRM_IRQ_STA); 192 + } 193 + 194 + writel(alrm_val, chip->base + SUNXI_ALRM_EN); 195 + writel(alrm_irq_val, chip->base + SUNXI_ALRM_IRQ_EN); 196 + } 197 + 198 + static int sunxi_rtc_getalarm(struct device *dev, struct rtc_wkalrm *wkalrm) 199 + { 200 + struct sunxi_rtc_dev *chip = dev_get_drvdata(dev); 201 + struct rtc_time *alrm_tm = &wkalrm->time; 202 + u32 alrm; 203 + u32 alrm_en; 204 + u32 date; 205 + 206 + alrm = readl(chip->base + SUNXI_ALRM_DHMS); 207 + date = readl(chip->base + SUNXI_RTC_YMD); 208 + 209 + alrm_tm->tm_sec = SUNXI_ALRM_GET_SEC_VALUE(alrm); 210 + alrm_tm->tm_min = SUNXI_ALRM_GET_MIN_VALUE(alrm); 211 + alrm_tm->tm_hour = SUNXI_ALRM_GET_HOUR_VALUE(alrm); 212 + 213 + alrm_tm->tm_mday = SUNXI_DATE_GET_DAY_VALUE(date); 214 + alrm_tm->tm_mon = SUNXI_DATE_GET_MON_VALUE(date); 215 + alrm_tm->tm_year = SUNXI_DATE_GET_YEAR_VALUE(date, 216 + chip->data_year->mask); 217 + 218 + alrm_tm->tm_mon -= 1; 219 + 220 + /* 221 + * switch from (data_year->min)-relative offset to 222 + * a (1900)-relative one 223 + */ 224 + alrm_tm->tm_year += SUNXI_YEAR_OFF(chip->data_year); 225 + 226 + alrm_en = readl(chip->base + SUNXI_ALRM_IRQ_EN); 227 + if (alrm_en & SUNXI_ALRM_EN_CNT_EN) 228 + wkalrm->enabled = 1; 229 + 230 + return 0; 231 + } 232 + 233 + static int sunxi_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) 234 + { 235 + struct sunxi_rtc_dev *chip = dev_get_drvdata(dev); 236 + u32 date, time; 237 + 238 + /* 239 + * read again in case it changes 240 + */ 241 + do { 242 + date = readl(chip->base + SUNXI_RTC_YMD); 243 + time = readl(chip->base + SUNXI_RTC_HMS); 244 + } while ((date != readl(chip->base + SUNXI_RTC_YMD)) || 245 + (time != readl(chip->base + SUNXI_RTC_HMS))); 246 + 247 + rtc_tm->tm_sec = SUNXI_TIME_GET_SEC_VALUE(time); 248 + rtc_tm->tm_min = SUNXI_TIME_GET_MIN_VALUE(time); 249 + rtc_tm->tm_hour = SUNXI_TIME_GET_HOUR_VALUE(time); 250 + 251 + rtc_tm->tm_mday = SUNXI_DATE_GET_DAY_VALUE(date); 252 + rtc_tm->tm_mon = SUNXI_DATE_GET_MON_VALUE(date); 253 + rtc_tm->tm_year = SUNXI_DATE_GET_YEAR_VALUE(date, 254 + chip->data_year->mask); 255 + 256 + rtc_tm->tm_mon -= 1; 257 + 258 + /* 259 + * switch from (data_year->min)-relative offset to 260 + * a (1900)-relative one 261 + */ 262 + rtc_tm->tm_year += SUNXI_YEAR_OFF(chip->data_year); 263 + 264 + return rtc_valid_tm(rtc_tm); 265 + } 266 + 267 + static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm) 268 + { 269 + struct sunxi_rtc_dev *chip = dev_get_drvdata(dev); 270 + struct rtc_time *alrm_tm = &wkalrm->time; 271 + struct rtc_time tm_now; 272 + u32 alrm = 0; 273 + unsigned long time_now = 0; 274 + unsigned long time_set = 0; 275 + unsigned long time_gap = 0; 276 + unsigned long time_gap_day = 0; 277 + unsigned long time_gap_hour = 0; 278 + unsigned long time_gap_min = 0; 279 + int ret = 0; 280 + 281 + ret = sunxi_rtc_gettime(dev, &tm_now); 282 + if (ret < 0) { 283 + dev_err(dev, "Error in getting time\n"); 284 + return -EINVAL; 285 + } 286 + 287 + rtc_tm_to_time(alrm_tm, &time_set); 288 + rtc_tm_to_time(&tm_now, &time_now); 289 + if (time_set <= time_now) { 290 + dev_err(dev, "Date to set in the past\n"); 291 + return -EINVAL; 292 + } 293 + 294 + time_gap = time_set - time_now; 295 + time_gap_day = time_gap / SEC_IN_DAY; 296 + time_gap -= time_gap_day * SEC_IN_DAY; 297 + time_gap_hour = time_gap / SEC_IN_HOUR; 298 + time_gap -= time_gap_hour * SEC_IN_HOUR; 299 + time_gap_min = time_gap / SEC_IN_MIN; 300 + time_gap -= time_gap_min * SEC_IN_MIN; 301 + 302 + if (time_gap_day > 255) { 303 + dev_err(dev, "Day must be in the range 0 - 255\n"); 304 + return -EINVAL; 305 + } 306 + 307 + sunxi_rtc_setaie(0, chip); 308 + writel(0, chip->base + SUNXI_ALRM_DHMS); 309 + usleep_range(100, 300); 310 + 311 + alrm = SUNXI_ALRM_SET_SEC_VALUE(time_gap) | 312 + SUNXI_ALRM_SET_MIN_VALUE(time_gap_min) | 313 + SUNXI_ALRM_SET_HOUR_VALUE(time_gap_hour) | 314 + SUNXI_ALRM_SET_DAY_VALUE(time_gap_day); 315 + writel(alrm, chip->base + SUNXI_ALRM_DHMS); 316 + 317 + writel(0, chip->base + SUNXI_ALRM_IRQ_EN); 318 + writel(SUNXI_ALRM_IRQ_EN_CNT_IRQ_EN, chip->base + SUNXI_ALRM_IRQ_EN); 319 + 320 + sunxi_rtc_setaie(wkalrm->enabled, chip); 321 + 322 + return 0; 323 + } 324 + 325 + static int sunxi_rtc_wait(struct sunxi_rtc_dev *chip, int offset, 326 + unsigned int mask, unsigned int ms_timeout) 327 + { 328 + const unsigned long timeout = jiffies + msecs_to_jiffies(ms_timeout); 329 + u32 reg; 330 + 331 + do { 332 + reg = readl(chip->base + offset); 333 + reg &= mask; 334 + 335 + if (reg == mask) 336 + return 0; 337 + 338 + } while (time_before(jiffies, timeout)); 339 + 340 + return -ETIMEDOUT; 341 + } 342 + 343 + static int sunxi_rtc_settime(struct device *dev, struct rtc_time *rtc_tm) 344 + { 345 + struct sunxi_rtc_dev *chip = dev_get_drvdata(dev); 346 + u32 date = 0; 347 + u32 time = 0; 348 + int year; 349 + 350 + /* 351 + * the input rtc_tm->tm_year is the offset relative to 1900. We use 352 + * the SUNXI_YEAR_OFF macro to rebase it with respect to the min year 353 + * allowed by the hardware 354 + */ 355 + 356 + year = rtc_tm->tm_year + 1900; 357 + if (year < chip->data_year->min || year > chip->data_year->max) { 358 + dev_err(dev, "rtc only supports year in range %d - %d\n", 359 + chip->data_year->min, chip->data_year->max); 360 + return -EINVAL; 361 + } 362 + 363 + rtc_tm->tm_year -= SUNXI_YEAR_OFF(chip->data_year); 364 + rtc_tm->tm_mon += 1; 365 + 366 + date = SUNXI_DATE_SET_DAY_VALUE(rtc_tm->tm_mday) | 367 + SUNXI_DATE_SET_MON_VALUE(rtc_tm->tm_mon) | 368 + SUNXI_DATE_SET_YEAR_VALUE(rtc_tm->tm_year, 369 + chip->data_year->mask); 370 + 371 + if (is_leap_year(year)) 372 + date |= SUNXI_LEAP_SET_VALUE(1, chip->data_year->leap_shift); 373 + 374 + time = SUNXI_TIME_SET_SEC_VALUE(rtc_tm->tm_sec) | 375 + SUNXI_TIME_SET_MIN_VALUE(rtc_tm->tm_min) | 376 + SUNXI_TIME_SET_HOUR_VALUE(rtc_tm->tm_hour); 377 + 378 + writel(0, chip->base + SUNXI_RTC_HMS); 379 + writel(0, chip->base + SUNXI_RTC_YMD); 380 + 381 + writel(time, chip->base + SUNXI_RTC_HMS); 382 + 383 + /* 384 + * After writing the RTC HH-MM-SS register, the 385 + * SUNXI_LOSC_CTRL_RTC_HMS_ACC bit is set and it will not 386 + * be cleared until the real writing operation is finished 387 + */ 388 + 389 + if (sunxi_rtc_wait(chip, SUNXI_LOSC_CTRL, 390 + SUNXI_LOSC_CTRL_RTC_HMS_ACC, 50)) { 391 + dev_err(dev, "Failed to set rtc time.\n"); 392 + return -1; 393 + } 394 + 395 + writel(date, chip->base + SUNXI_RTC_YMD); 396 + 397 + /* 398 + * After writing the RTC YY-MM-DD register, the 399 + * SUNXI_LOSC_CTRL_RTC_YMD_ACC bit is set and it will not 400 + * be cleared until the real writing operation is finished 401 + */ 402 + 403 + if (sunxi_rtc_wait(chip, SUNXI_LOSC_CTRL, 404 + SUNXI_LOSC_CTRL_RTC_YMD_ACC, 50)) { 405 + dev_err(dev, "Failed to set rtc time.\n"); 406 + return -1; 407 + } 408 + 409 + return 0; 410 + } 411 + 412 + static int sunxi_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) 413 + { 414 + struct sunxi_rtc_dev *chip = dev_get_drvdata(dev); 415 + 416 + if (!enabled) 417 + sunxi_rtc_setaie(enabled, chip); 418 + 419 + return 0; 420 + } 421 + 422 + static const struct rtc_class_ops sunxi_rtc_ops = { 423 + .read_time = sunxi_rtc_gettime, 424 + .set_time = sunxi_rtc_settime, 425 + .read_alarm = sunxi_rtc_getalarm, 426 + .set_alarm = sunxi_rtc_setalarm, 427 + .alarm_irq_enable = sunxi_rtc_alarm_irq_enable 428 + }; 429 + 430 + static const struct of_device_id sunxi_rtc_dt_ids[] = { 431 + { .compatible = "allwinner,sun4i-rtc", .data = &data_year_param[0] }, 432 + { .compatible = "allwinner,sun7i-a20-rtc", .data = &data_year_param[1] }, 433 + { /* sentinel */ }, 434 + }; 435 + MODULE_DEVICE_TABLE(of, sunxi_rtc_dt_ids); 436 + 437 + static int sunxi_rtc_probe(struct platform_device *pdev) 438 + { 439 + struct sunxi_rtc_dev *chip; 440 + struct resource *res; 441 + const struct of_device_id *of_id; 442 + int ret; 443 + 444 + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); 445 + if (!chip) 446 + return -ENOMEM; 447 + 448 + platform_set_drvdata(pdev, chip); 449 + chip->dev = &pdev->dev; 450 + 451 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 452 + chip->base = devm_ioremap_resource(&pdev->dev, res); 453 + if (IS_ERR(chip->base)) 454 + return PTR_ERR(chip->base); 455 + 456 + chip->irq = platform_get_irq(pdev, 0); 457 + if (chip->irq < 0) { 458 + dev_err(&pdev->dev, "No IRQ resource\n"); 459 + return chip->irq; 460 + } 461 + ret = devm_request_irq(&pdev->dev, chip->irq, sunxi_rtc_alarmirq, 462 + 0, dev_name(&pdev->dev), chip); 463 + if (ret) { 464 + dev_err(&pdev->dev, "Could not request IRQ\n"); 465 + return ret; 466 + } 467 + 468 + of_id = of_match_device(sunxi_rtc_dt_ids, &pdev->dev); 469 + if (!of_id) { 470 + dev_err(&pdev->dev, "Unable to setup RTC data\n"); 471 + return -ENODEV; 472 + } 473 + chip->data_year = (struct sunxi_rtc_data_year *) of_id->data; 474 + 475 + /* clear the alarm count value */ 476 + writel(0, chip->base + SUNXI_ALRM_DHMS); 477 + 478 + /* disable alarm, not generate irq pending */ 479 + writel(0, chip->base + SUNXI_ALRM_EN); 480 + 481 + /* disable alarm week/cnt irq, unset to cpu */ 482 + writel(0, chip->base + SUNXI_ALRM_IRQ_EN); 483 + 484 + /* clear alarm week/cnt irq pending */ 485 + writel(SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND, chip->base + 486 + SUNXI_ALRM_IRQ_STA); 487 + 488 + chip->rtc = rtc_device_register("rtc-sunxi", &pdev->dev, 489 + &sunxi_rtc_ops, THIS_MODULE); 490 + if (IS_ERR(chip->rtc)) { 491 + dev_err(&pdev->dev, "unable to register device\n"); 492 + return PTR_ERR(chip->rtc); 493 + } 494 + 495 + dev_info(&pdev->dev, "RTC enabled\n"); 496 + 497 + return 0; 498 + } 499 + 500 + static int sunxi_rtc_remove(struct platform_device *pdev) 501 + { 502 + struct sunxi_rtc_dev *chip = platform_get_drvdata(pdev); 503 + 504 + rtc_device_unregister(chip->rtc); 505 + 506 + return 0; 507 + } 508 + 509 + static struct platform_driver sunxi_rtc_driver = { 510 + .probe = sunxi_rtc_probe, 511 + .remove = sunxi_rtc_remove, 512 + .driver = { 513 + .name = "sunxi-rtc", 514 + .owner = THIS_MODULE, 515 + .of_match_table = sunxi_rtc_dt_ids, 516 + }, 517 + }; 518 + 519 + module_platform_driver(sunxi_rtc_driver); 520 + 521 + MODULE_DESCRIPTION("sunxi RTC driver"); 522 + MODULE_AUTHOR("Carlo Caione <carlo.caione@gmail.com>"); 523 + MODULE_LICENSE("GPL");
+1 -1
drivers/tty/serial/Kconfig
··· 1034 1034 1035 1035 config SERIAL_MSM_HS 1036 1036 tristate "MSM UART High Speed: Serial Driver" 1037 - depends on ARCH_MSM 1037 + depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 1038 1038 select SERIAL_CORE 1039 1039 help 1040 1040 If you have a machine based on MSM family of SoCs, you
+137 -50
drivers/tty/serial/sh-sci.c
··· 39 39 #include <linux/module.h> 40 40 #include <linux/mm.h> 41 41 #include <linux/notifier.h> 42 + #include <linux/of.h> 42 43 #include <linux/platform_device.h> 43 44 #include <linux/pm_runtime.h> 44 45 #include <linux/scatterlist.h> ··· 58 57 #endif 59 58 60 59 #include "sh-sci.h" 60 + 61 + /* Offsets into the sci_port->irqs array */ 62 + enum { 63 + SCIx_ERI_IRQ, 64 + SCIx_RXI_IRQ, 65 + SCIx_TXI_IRQ, 66 + SCIx_BRI_IRQ, 67 + SCIx_NR_IRQS, 68 + 69 + SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ 70 + }; 71 + 72 + #define SCIx_IRQ_IS_MUXED(port) \ 73 + ((port)->irqs[SCIx_ERI_IRQ] == \ 74 + (port)->irqs[SCIx_RXI_IRQ]) || \ 75 + ((port)->irqs[SCIx_ERI_IRQ] && \ 76 + ((port)->irqs[SCIx_RXI_IRQ] < 0)) 61 77 62 78 struct sci_port { 63 79 struct uart_port port; ··· 1775 1757 if (s->sampling_rate) 1776 1758 return DIV_ROUND_CLOSEST(freq, s->sampling_rate * bps) - 1; 1777 1759 1778 - switch (s->cfg->scbrr_algo_id) { 1779 - case SCBRR_ALGO_1: 1780 - return freq / (16 * bps); 1781 - case SCBRR_ALGO_2: 1782 - return DIV_ROUND_CLOSEST(freq, 32 * bps) - 1; 1783 - case SCBRR_ALGO_3: 1784 - return freq / (8 * bps); 1785 - case SCBRR_ALGO_4: 1786 - return DIV_ROUND_CLOSEST(freq, 16 * bps) - 1; 1787 - } 1788 - 1789 1760 /* Warn, but use a safe default */ 1790 1761 WARN_ON(1); 1791 1762 ··· 2112 2105 port->iotype = UPIO_MEM; 2113 2106 port->line = index; 2114 2107 2115 - if (dev->num_resources) { 2116 - /* Device has resources, use them. */ 2117 - res = platform_get_resource(dev, IORESOURCE_MEM, 0); 2118 - if (res == NULL) 2119 - return -ENOMEM; 2108 + res = platform_get_resource(dev, IORESOURCE_MEM, 0); 2109 + if (res == NULL) 2110 + return -ENOMEM; 2120 2111 2121 - port->mapbase = res->start; 2112 + port->mapbase = res->start; 2122 2113 2123 - for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) 2124 - sci_port->irqs[i] = platform_get_irq(dev, i); 2114 + for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) 2115 + sci_port->irqs[i] = platform_get_irq(dev, i); 2125 2116 2126 - /* The SCI generates several interrupts. They can be muxed 2127 - * together or connected to different interrupt lines. In the 2128 - * muxed case only one interrupt resource is specified. In the 2129 - * non-muxed case three or four interrupt resources are 2130 - * specified, as the BRI interrupt is optional. 2131 - */ 2132 - if (sci_port->irqs[0] < 0) 2133 - return -ENXIO; 2117 + /* The SCI generates several interrupts. They can be muxed together or 2118 + * connected to different interrupt lines. In the muxed case only one 2119 + * interrupt resource is specified. In the non-muxed case three or four 2120 + * interrupt resources are specified, as the BRI interrupt is optional. 2121 + */ 2122 + if (sci_port->irqs[0] < 0) 2123 + return -ENXIO; 2134 2124 2135 - if (sci_port->irqs[1] < 0) { 2136 - sci_port->irqs[1] = sci_port->irqs[0]; 2137 - sci_port->irqs[2] = sci_port->irqs[0]; 2138 - sci_port->irqs[3] = sci_port->irqs[0]; 2139 - } 2140 - } else { 2141 - /* No resources, use old-style platform data. */ 2142 - port->mapbase = p->mapbase; 2143 - for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) 2144 - sci_port->irqs[i] = p->irqs[i] ? p->irqs[i] : -ENXIO; 2125 + if (sci_port->irqs[1] < 0) { 2126 + sci_port->irqs[1] = sci_port->irqs[0]; 2127 + sci_port->irqs[2] = sci_port->irqs[0]; 2128 + sci_port->irqs[3] = sci_port->irqs[0]; 2145 2129 } 2146 2130 2147 2131 if (p->regtype == SCIx_PROBE_REGTYPE) { ··· 2174 2176 break; 2175 2177 } 2176 2178 2177 - /* Set the sampling rate if the baud rate calculation algorithm isn't 2178 - * specified. 2179 + /* SCIFA on sh7723 and sh7724 need a custom sampling rate that doesn't 2180 + * match the SoC datasheet, this should be investigated. Let platform 2181 + * data override the sampling rate for now. 2179 2182 */ 2180 - if (p->scbrr_algo_id == SCBRR_ALGO_NONE) { 2181 - /* SCIFA on sh7723 and sh7724 need a custom sampling rate that 2182 - * doesn't match the SoC datasheet, this should be investigated. 2183 - * Let platform data override the sampling rate for now. 2184 - */ 2185 - sci_port->sampling_rate = p->sampling_rate ? p->sampling_rate 2186 - : sampling_rate; 2187 - } 2183 + sci_port->sampling_rate = p->sampling_rate ? p->sampling_rate 2184 + : sampling_rate; 2188 2185 2189 2186 if (!early) { 2190 2187 sci_port->iclk = clk_get(&dev->dev, "sci_ick"); ··· 2416 2423 return 0; 2417 2424 } 2418 2425 2426 + struct sci_port_info { 2427 + unsigned int type; 2428 + unsigned int regtype; 2429 + }; 2430 + 2431 + static const struct of_device_id of_sci_match[] = { 2432 + { 2433 + .compatible = "renesas,scif", 2434 + .data = (void *)&(const struct sci_port_info) { 2435 + .type = PORT_SCIF, 2436 + .regtype = SCIx_SH4_SCIF_REGTYPE, 2437 + }, 2438 + }, { 2439 + .compatible = "renesas,scifa", 2440 + .data = (void *)&(const struct sci_port_info) { 2441 + .type = PORT_SCIFA, 2442 + .regtype = SCIx_SCIFA_REGTYPE, 2443 + }, 2444 + }, { 2445 + .compatible = "renesas,scifb", 2446 + .data = (void *)&(const struct sci_port_info) { 2447 + .type = PORT_SCIFB, 2448 + .regtype = SCIx_SCIFB_REGTYPE, 2449 + }, 2450 + }, { 2451 + .compatible = "renesas,hscif", 2452 + .data = (void *)&(const struct sci_port_info) { 2453 + .type = PORT_HSCIF, 2454 + .regtype = SCIx_HSCIF_REGTYPE, 2455 + }, 2456 + }, { 2457 + /* Terminator */ 2458 + }, 2459 + }; 2460 + MODULE_DEVICE_TABLE(of, of_sci_match); 2461 + 2462 + static struct plat_sci_port * 2463 + sci_parse_dt(struct platform_device *pdev, unsigned int *dev_id) 2464 + { 2465 + struct device_node *np = pdev->dev.of_node; 2466 + const struct of_device_id *match; 2467 + const struct sci_port_info *info; 2468 + struct plat_sci_port *p; 2469 + int id; 2470 + 2471 + if (!IS_ENABLED(CONFIG_OF) || !np) 2472 + return NULL; 2473 + 2474 + match = of_match_node(of_sci_match, pdev->dev.of_node); 2475 + if (!match) 2476 + return NULL; 2477 + 2478 + info = match->data; 2479 + 2480 + p = devm_kzalloc(&pdev->dev, sizeof(struct plat_sci_port), GFP_KERNEL); 2481 + if (!p) { 2482 + dev_err(&pdev->dev, "failed to allocate DT config data\n"); 2483 + return NULL; 2484 + } 2485 + 2486 + /* Get the line number for the aliases node. */ 2487 + id = of_alias_get_id(np, "serial"); 2488 + if (id < 0) { 2489 + dev_err(&pdev->dev, "failed to get alias id (%d)\n", id); 2490 + return NULL; 2491 + } 2492 + 2493 + *dev_id = id; 2494 + 2495 + p->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 2496 + p->type = info->type; 2497 + p->regtype = info->regtype; 2498 + p->scscr = SCSCR_RE | SCSCR_TE; 2499 + 2500 + return p; 2501 + } 2502 + 2419 2503 static int sci_probe_single(struct platform_device *dev, 2420 2504 unsigned int index, 2421 2505 struct plat_sci_port *p, ··· 2525 2455 2526 2456 static int sci_probe(struct platform_device *dev) 2527 2457 { 2528 - struct plat_sci_port *p = dev_get_platdata(&dev->dev); 2529 - struct sci_port *sp = &sci_ports[dev->id]; 2458 + struct plat_sci_port *p; 2459 + struct sci_port *sp; 2460 + unsigned int dev_id; 2530 2461 int ret; 2531 2462 2532 2463 /* ··· 2538 2467 if (is_early_platform_device(dev)) 2539 2468 return sci_probe_earlyprintk(dev); 2540 2469 2470 + if (dev->dev.of_node) { 2471 + p = sci_parse_dt(dev, &dev_id); 2472 + if (p == NULL) 2473 + return -EINVAL; 2474 + } else { 2475 + p = dev->dev.platform_data; 2476 + if (p == NULL) { 2477 + dev_err(&dev->dev, "no platform data supplied\n"); 2478 + return -EINVAL; 2479 + } 2480 + 2481 + dev_id = dev->id; 2482 + } 2483 + 2484 + sp = &sci_ports[dev_id]; 2541 2485 platform_set_drvdata(dev, sp); 2542 2486 2543 - ret = sci_probe_single(dev, dev->id, p, sp); 2487 + ret = sci_probe_single(dev, dev_id, p, sp); 2544 2488 if (ret) 2545 2489 return ret; 2546 2490 ··· 2607 2521 .name = "sh-sci", 2608 2522 .owner = THIS_MODULE, 2609 2523 .pm = &sci_dev_pm_ops, 2524 + .of_match_table = of_match_ptr(of_sci_match), 2610 2525 }, 2611 2526 }; 2612 2527
+2 -2
drivers/usb/host/r8a66597-hcd.c
··· 94 94 int i = 0; 95 95 96 96 if (r8a66597->pdata->on_chip) { 97 - clk_enable(r8a66597->clk); 97 + clk_prepare_enable(r8a66597->clk); 98 98 do { 99 99 r8a66597_write(r8a66597, SCKE, SYSCFG0); 100 100 tmp = r8a66597_read(r8a66597, SYSCFG0); ··· 138 138 udelay(1); 139 139 140 140 if (r8a66597->pdata->on_chip) { 141 - clk_disable(r8a66597->clk); 141 + clk_disable_unprepare(r8a66597->clk); 142 142 } else { 143 143 r8a66597_bclr(r8a66597, PLLC, SYSCFG0); 144 144 r8a66597_bclr(r8a66597, XCKE, SYSCFG0);
+15 -20
drivers/usb/phy/phy-msm-usb.c
··· 40 40 #include <linux/usb/msm_hsusb_hw.h> 41 41 #include <linux/regulator/consumer.h> 42 42 43 - #include <mach/clk.h> 44 - 45 43 #define MSM_USB_BASE (motg->regs) 46 44 #define DRIVER_NAME "msm_otg" 47 45 ··· 306 308 307 309 static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) 308 310 { 309 - int ret; 311 + int ret = 0; 310 312 311 - if (assert) { 312 - ret = clk_reset(motg->clk, CLK_RESET_ASSERT); 313 - if (ret) 314 - dev_err(motg->phy.dev, "usb hs_clk assert failed\n"); 315 - } else { 316 - ret = clk_reset(motg->clk, CLK_RESET_DEASSERT); 317 - if (ret) 318 - dev_err(motg->phy.dev, "usb hs_clk deassert failed\n"); 319 - } 313 + if (!motg->pdata->link_clk_reset) 314 + return ret; 315 + 316 + ret = motg->pdata->link_clk_reset(motg->clk, assert); 317 + if (ret) 318 + dev_err(motg->phy.dev, "usb link clk reset %s failed\n", 319 + assert ? "assert" : "deassert"); 320 + 320 321 return ret; 321 322 } 322 323 323 324 static int msm_otg_phy_clk_reset(struct msm_otg *motg) 324 325 { 325 - int ret; 326 + int ret = 0; 326 327 327 - ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT); 328 - if (ret) { 329 - dev_err(motg->phy.dev, "usb phy clk assert failed\n"); 328 + if (!motg->pdata->phy_clk_reset) 330 329 return ret; 331 - } 332 - usleep_range(10000, 12000); 333 - ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT); 330 + 331 + ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk); 334 332 if (ret) 335 - dev_err(motg->phy.dev, "usb phy clk deassert failed\n"); 333 + dev_err(motg->phy.dev, "usb phy clk reset failed\n"); 334 + 336 335 return ret; 337 336 } 338 337
+2 -2
drivers/watchdog/davinci_wdt.c
··· 247 247 248 248 static struct platform_driver platform_wdt_driver = { 249 249 .driver = { 250 - .name = "watchdog", 250 + .name = "davinci-wdt", 251 251 .owner = THIS_MODULE, 252 252 .of_match_table = davinci_wdt_of_match, 253 253 }, ··· 267 267 __MODULE_STRING(DEFAULT_HEARTBEAT)); 268 268 269 269 MODULE_LICENSE("GPL"); 270 - MODULE_ALIAS("platform:watchdog"); 270 + MODULE_ALIAS("platform:davinci-wdt");
+1 -2
include/linux/platform_data/gpio-davinci.h
··· 28 28 struct davinci_gpio_platform_data { 29 29 u32 ngpio; 30 30 u32 gpio_unbanked; 31 - u32 intc_irq_num; 32 31 }; 33 32 34 33 35 34 struct davinci_gpio_controller { 36 35 struct gpio_chip chip; 37 - int irq_base; 36 + struct irq_domain *irq_domain; 38 37 /* Serialize access to GPIO registers */ 39 38 spinlock_t lock; 40 39 void __iomem *regs;
-36
include/linux/serial_sci.h
··· 10 10 11 11 #define SCIx_NOT_SUPPORTED (-1) 12 12 13 - enum { 14 - SCBRR_ALGO_NONE, /* Compute sampling rate in the driver */ 15 - SCBRR_ALGO_1, /* clk / (16 * bps) */ 16 - SCBRR_ALGO_2, /* DIV_ROUND_CLOSEST(clk, 32 * bps) - 1 */ 17 - SCBRR_ALGO_3, /* clk / (8 * bps) */ 18 - SCBRR_ALGO_4, /* DIV_ROUND_CLOSEST(clk, 16 * bps) - 1 */ 19 - SCBRR_ALGO_6, /* HSCIF variable sample rate algorithm */ 20 - }; 21 - 22 13 #define SCSCR_TIE (1 << 7) 23 14 #define SCSCR_RIE (1 << 6) 24 15 #define SCSCR_TE (1 << 5) ··· 50 59 /* HSSRR HSCIF */ 51 60 #define HSCIF_SRE 0x8000 52 61 53 - /* Offsets into the sci_port->irqs array */ 54 - enum { 55 - SCIx_ERI_IRQ, 56 - SCIx_RXI_IRQ, 57 - SCIx_TXI_IRQ, 58 - SCIx_BRI_IRQ, 59 - SCIx_NR_IRQS, 60 - 61 - SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ 62 - }; 63 - 64 62 enum { 65 63 SCIx_PROBE_REGTYPE, 66 64 ··· 68 88 SCIx_NR_REGTYPES, 69 89 }; 70 90 71 - #define SCIx_IRQ_MUXED(irq) \ 72 - { \ 73 - [SCIx_ERI_IRQ] = (irq), \ 74 - [SCIx_RXI_IRQ] = (irq), \ 75 - [SCIx_TXI_IRQ] = (irq), \ 76 - [SCIx_BRI_IRQ] = (irq), \ 77 - } 78 - 79 - #define SCIx_IRQ_IS_MUXED(port) \ 80 - ((port)->irqs[SCIx_ERI_IRQ] == \ 81 - (port)->irqs[SCIx_RXI_IRQ]) || \ 82 - ((port)->irqs[SCIx_ERI_IRQ] && \ 83 - ((port)->irqs[SCIx_RXI_IRQ] < 0)) 84 91 /* 85 92 * SCI register subset common for all port types. 86 93 * Not all registers will exist on all parts. ··· 96 129 * Platform device specific platform_data struct 97 130 */ 98 131 struct plat_sci_port { 99 - unsigned long mapbase; /* resource base */ 100 - unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 101 132 unsigned int type; /* SCI / SCIF / IRDA / HSCIF */ 102 133 upf_t flags; /* UPF_* flags */ 103 134 unsigned long capabilities; /* Port features/capabilities */ 104 135 105 136 unsigned int sampling_rate; 106 - unsigned int scbrr_algo_id; /* SCBRR calculation algo */ 107 137 unsigned int scscr; /* SCSCR initialization */ 108 138 109 139 /*
+3
include/linux/usb/msm_hsusb.h
··· 20 20 21 21 #include <linux/types.h> 22 22 #include <linux/usb/otg.h> 23 + #include <linux/clk.h> 23 24 24 25 /** 25 26 * Supported USB modes ··· 136 135 enum msm_usb_phy_type phy_type; 137 136 void (*setup_gpio)(enum usb_otg_state state); 138 137 char *pclk_src_name; 138 + int (*link_clk_reset)(struct clk *link_clk, bool assert); 139 + int (*phy_clk_reset)(struct clk *phy_clk); 139 140 }; 140 141 141 142 /**