* [PATCH v8 0/9] initial suport for Alphascale ASM9260 @ 2014-10-21 10:40 Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 1/9] ARM: add mach-asm9260 Oleksij Rempel ` (9 more replies) 0 siblings, 10 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel This patchset provide initial support for Alpascale ASM9260, ARM based SoC. Changes since laste version: - make sure all driver use of_io_request_and_map - check alignment in Kconfig or Makefile where possible - remove UART driver from this patchset to make review easier. Oleksij Rempel (9): ARM: add mach-asm9260 ARM: add lolevel debug support for asm9260 ARM: clk: add clk-asm9260 driver ARM: irqchip: mxs: prepare driver for HW with different offsets ARM: irqchip: mxs: add Alpascale ASM9260 support ARM: clocksource: add asm9260_timer driver ARM: dts: add DT for Alphascale ASM9260 SoC ARM: add alphascale,acc.txt bindings documentation add Alphascale to vendor-prefixes.txt .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/Kconfig | 2 + arch/arm/Kconfig.debug | 33 +- arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 + arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 ++++ arch/arm/include/debug/asm9260.S | 31 ++ arch/arm/mach-asm9260/Kconfig | 6 + drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 345 +++++++++++++++++++++ drivers/clocksource/Kconfig | 9 + drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 +++++++++++++ drivers/irqchip/Kconfig | 9 + drivers/irqchip/Makefile | 2 +- drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++ drivers/irqchip/irq-mxs.c | 150 ++++++++- include/dt-bindings/clock/alphascale,asm9260.h | 97 ++++++ 19 files changed, 1189 insertions(+), 20 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi create mode 100644 arch/arm/include/debug/asm9260.S create mode 100644 arch/arm/mach-asm9260/Kconfig create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 drivers/clocksource/asm9260_timer.c create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 1/9] ARM: add mach-asm9260 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 2/9] ARM: add lolevel debug support for asm9260 Oleksij Rempel ` (8 subsequent siblings) 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel it is low cost (?) SoC targeted for market in China and India which trying to compete with AT91SAM9G25. Here is some info: http://www.alphascale.com/index.asp?ics/615.html One of products: http://www.aliexpress.com/store/product/2014-hot-sales-FREE-SHIPPING-new-Purple-core-ARM9-development-board-ASM9260T-SDRAM-power-line/433637_1931495721.html In some cases this SoC looks similar to iMX23/iMX28. But currently it makes no sense to merge mach code of this devices. Especially because most differences are already collected mach-mxs folder. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/Kconfig | 2 ++ arch/arm/mach-asm9260/Kconfig | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 arch/arm/mach-asm9260/Kconfig diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5918d40..1b32023 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -849,6 +849,8 @@ config ARCH_VIRT # source "arch/arm/mach-mvebu/Kconfig" +source "arch/arm/mach-asm9260/Kconfig" + source "arch/arm/mach-at91/Kconfig" source "arch/arm/mach-axxia/Kconfig" diff --git a/arch/arm/mach-asm9260/Kconfig b/arch/arm/mach-asm9260/Kconfig new file mode 100644 index 0000000..33b9b28 --- /dev/null +++ b/arch/arm/mach-asm9260/Kconfig @@ -0,0 +1,6 @@ +config MACH_ASM9260 + bool "Alphascale ASM9260" + depends on ARCH_MULTI_V5 + select CPU_ARM926T + help + Support for Alpascale ASM9260 based platform. -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 2/9] ARM: add lolevel debug support for asm9260 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 1/9] ARM: add mach-asm9260 Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 3/9] ARM: clk: add clk-asm9260 driver Oleksij Rempel ` (7 subsequent siblings) 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel Since there is no public documentation, this patch also provide register offsets for different UART units on this SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/Kconfig.debug | 33 ++++++++++++++++++++++++++++++--- arch/arm/include/debug/asm9260.S | 31 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 arch/arm/include/debug/asm9260.S diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index b11ad54..6190f94 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -93,6 +93,27 @@ choice prompt "Kernel low-level debugging port" depends on DEBUG_LL + config DEBUG_ASM9260_UART + bool "Kernel low-level debugging via asm9260 UART" + depends on MACH_ASM9260 + help + Say Y here if you want the debug print routines to direct + their output to an UART or USART port on asm9260 based + machines. + + DEBUG_UART_PHYS | DEBUG_UART_VIRT + + 0x80000000 | 0xf0000000 | UART0 + 0x80004000 | 0xf0004000 | UART1 + 0x80008000 | 0xf0008000 | UART2 + 0x8000c000 | 0xf000c000 | UART3 + 0x80010000 | 0xf0010000 | UART4 + 0x80014000 | 0xf0014000 | UART5 + 0x80018000 | 0xf0018000 | UART6 + 0x8001c000 | 0xf001c000 | UART7 + 0x80020000 | 0xf0020000 | UART8 + 0x80024000 | 0xf0024000 | UART9 + config AT91_DEBUG_LL_DBGU0 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" depends on HAVE_AT91_DBGU0 @@ -1010,6 +1031,7 @@ config DEBUG_STI_UART config DEBUG_LL_INCLUDE string default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 + default "debug/asm9260.S" if DEBUG_ASM9260_UART default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X default "debug/exynos.S" if DEBUG_EXYNOS_UART @@ -1094,6 +1116,7 @@ config DEBUG_UART_PHYS default 0x50008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \ DEBUG_S3C2410_UART2) default 0x7c0003f8 if FOOTBRIDGE + default 0x80010000 if DEBUG_ASM9260_UART default 0x80070000 if DEBUG_IMX23_UART default 0x80074000 if DEBUG_IMX28_UART default 0x80230000 if DEBUG_PICOXCELL_UART @@ -1126,7 +1149,8 @@ config DEBUG_UART_PHYS depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_LL_UART_EFM32 || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || \ - DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART + DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || \ + DEBUG_S3C24XX_UART || DEBUG_ASM9260_UART config DEBUG_UART_VIRT hex "Virtual base address of debug UART" @@ -1134,6 +1158,7 @@ config DEBUG_UART_VIRT default 0xe1000000 if DEBUG_MSM_UART default 0xf0000be0 if ARCH_EBSA110 default 0xf0009000 if DEBUG_CNS3XXX + default 0xf0010000 if DEBUG_ASM9260_UART default 0xf01fb000 if DEBUG_NOMADIK_UART default 0xf0201000 if DEBUG_BCM2835 default 0xf1000300 if DEBUG_BCM_5301X @@ -1194,7 +1219,8 @@ config DEBUG_UART_VIRT default DEBUG_UART_PHYS if !MMU depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || \ - DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART + DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || \ + DEBUG_S3C24XX_UART || DEBUG_ASM9260_UART config DEBUG_UART_8250_SHIFT int "Register offset shift for the 8250 debug UART" @@ -1236,7 +1262,8 @@ config DEBUG_UNCOMPRESS config UNCOMPRESS_INCLUDE string default "debug/uncompress.h" if ARCH_MULTIPLATFORM || ARCH_MSM || \ - PLAT_SAMSUNG || ARCH_EFM32 + PLAT_SAMSUNG || ARCH_EFM32 || \ + MACH_ASM9260 default "mach/uncompress.h" config EARLY_PRINTK diff --git a/arch/arm/include/debug/asm9260.S b/arch/arm/include/debug/asm9260.S new file mode 100644 index 0000000..c70d51f --- /dev/null +++ b/arch/arm/include/debug/asm9260.S @@ -0,0 +1,31 @@ +/* arch/arm/mach-imx/include/mach/debug-macro.S + * + * Debugging macro include header + * + * Copyright (C) 1994-1999 Russell King + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks + * Modified for ASM9260 by Oleksij Remepl <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + + .macro addruart, rp, rv, tmp + ldr \rp, = CONFIG_DEBUG_UART_PHYS + ldr \rv, = CONFIG_DEBUG_UART_VIRT + .endm + + .macro waituart,rd,rx + .endm + + .macro senduart,rd,rx + str \rd, [\rx, #0x50] @ TXDATA + .endm + + .macro busyuart,rd,rx +1002: ldr \rd, [\rx, #0x60] @ STAT + tst \rd, #1 << 27 @ TXEMPTY + beq 1002b @ wait until transmit done + .endm -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 3/9] ARM: clk: add clk-asm9260 driver 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 1/9] ARM: add mach-asm9260 Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 2/9] ARM: add lolevel debug support for asm9260 Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 4/9] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel ` (6 subsequent siblings) 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel Provide CLK support for Alphascale ASM9260 SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 345 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 443 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index f537a0b..ce93551 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -15,6 +15,7 @@ endif # hardware specific clock types # please keep this section sorted lexicographically by file/directory path name +obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c new file mode 100644 index 0000000..df28e07 --- /dev/null +++ b/drivers/clk/clk-asm9260.c @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/clk-provider.h> +#include <linux/spinlock.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <dt-bindings/clock/alphascale,asm9260.h> + +#define HW_AHBCLKCTRL0 0x0020 +#define HW_AHBCLKCTRL1 0x0030 +#define HW_SYSPLLCTRL 0x0100 +#define HW_MAINCLKSEL 0x0120 +#define HW_MAINCLKUEN 0x0124 +#define HW_UARTCLKSEL 0x0128 +#define HW_UARTCLKUEN 0x012c +#define HW_I2S0CLKSEL 0x0130 +#define HW_I2S0CLKUEN 0x0134 +#define HW_I2S1CLKSEL 0x0138 +#define HW_I2S1CLKUEN 0x013c +#define HW_WDTCLKSEL 0x0160 +#define HW_WDTCLKUEN 0x0164 +#define HW_CLKOUTCLKSEL 0x0170 +#define HW_CLKOUTCLKUEN 0x0174 +#define HW_CPUCLKDIV 0x017c +#define HW_SYSAHBCLKDIV 0x0180 +#define HW_I2S0MCLKDIV 0x0190 +#define HW_I2S0SCLKDIV 0x0194 +#define HW_I2S1MCLKDIV 0x0188 +#define HW_I2S1SCLKDIV 0x018c +#define HW_UART0CLKDIV 0x0198 +#define HW_UART1CLKDIV 0x019c +#define HW_UART2CLKDIV 0x01a0 +#define HW_UART3CLKDIV 0x01a4 +#define HW_UART4CLKDIV 0x01a8 +#define HW_UART5CLKDIV 0x01ac +#define HW_UART6CLKDIV 0x01b0 +#define HW_UART7CLKDIV 0x01b4 +#define HW_UART8CLKDIV 0x01b8 +#define HW_UART9CLKDIV 0x01bc +#define HW_SPI0CLKDIV 0x01c0 +#define HW_SPI1CLKDIV 0x01c4 +#define HW_QUADSPICLKDIV 0x01c8 +#define HW_SSP0CLKDIV 0x01d0 +#define HW_NANDCLKDIV 0x01d4 +#define HW_TRACECLKDIV 0x01e0 +#define HW_CAMMCLKDIV 0x01e8 +#define HW_WDTCLKDIV 0x01ec +#define HW_CLKOUTCLKDIV 0x01f4 +#define HW_MACCLKDIV 0x01f8 +#define HW_LCDCLKDIV 0x01fc +#define HW_ADCANACLKDIV 0x0200 + +static struct clk *clks[MAX_CLKS]; +static struct clk_onecell_data clk_data; +static DEFINE_SPINLOCK(asm9260_clk_lock); + +struct asm9260_div_clk { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; +}; + +struct asm9260_gate_data { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; + u8 bit_idx; + unsigned long flags; +}; + +struct asm9260_mux_clock { + u8 mask; + u32 *table; + const char *name; + const char **parent_names; + u8 num_parents; + unsigned long offset; + unsigned long flags; +}; + +static void __iomem *base; + +enum { + REFCLK, SYSPLL, I2S0_MCLK, I2S1_MCLK, RTC_OSC, USB_PLL, +}; + +static const char *clk_names[] = { + [REFCLK] = "oscillator", + [SYSPLL] = "pll", + [I2S0_MCLK] = "i2s0_mclk", + [I2S1_MCLK] = "i2s1_mclk", + [RTC_OSC] = "rtc_osc", + [USB_PLL] = "usb_pll", +}; + +static const struct asm9260_div_clk asm9260_div_clks[] __initconst = { + { CLKID_SYS_CPU, "cpu_div", "main_gate", HW_CPUCLKDIV }, + { CLKID_SYS_AHB, "ahb_div", "cpu_div", HW_SYSAHBCLKDIV }, + + /* i2s has two deviders: one for only external mclk and internal + * devider for all clks. */ + { CLKID_SYS_I2S0M, "i2s0m_div", "i2s0_mclk", HW_I2S0MCLKDIV }, + { CLKID_SYS_I2S1M, "i2s1m_div", "i2s1_mclk", HW_I2S1MCLKDIV }, + { CLKID_SYS_I2S0S, "i2s0s_div", "i2s0_gate", HW_I2S0SCLKDIV }, + { CLKID_SYS_I2S1S, "i2s1s_div", "i2s0_gate", HW_I2S1SCLKDIV }, + + { CLKID_SYS_UART0, "uart0_div", "uart_gate", HW_UART0CLKDIV }, + { CLKID_SYS_UART1, "uart1_div", "uart_gate", HW_UART1CLKDIV }, + { CLKID_SYS_UART2, "uart2_div", "uart_gate", HW_UART2CLKDIV }, + { CLKID_SYS_UART3, "uart3_div", "uart_gate", HW_UART3CLKDIV }, + { CLKID_SYS_UART4, "uart4_div", "uart_gate", HW_UART4CLKDIV }, + { CLKID_SYS_UART5, "uart5_div", "uart_gate", HW_UART5CLKDIV }, + { CLKID_SYS_UART6, "uart6_div", "uart_gate", HW_UART6CLKDIV }, + { CLKID_SYS_UART7, "uart7_div", "uart_gate", HW_UART7CLKDIV }, + { CLKID_SYS_UART8, "uart8_div", "uart_gate", HW_UART8CLKDIV }, + { CLKID_SYS_UART9, "uart9_div", "uart_gate", HW_UART9CLKDIV }, +}; + +static const struct asm9260_gate_data asm9260_mux_gates[] __initconst = { + { 0, "main_gate", "main_mux", HW_MAINCLKUEN, 0 }, + { 0, "uart_gate", "uart_mux", HW_UARTCLKUEN, 0 }, + { 0, "i2s0_gate", "i2s0_mux", HW_I2S0CLKUEN, 0 }, + { 0, "i2s1_gate", "i2s1_mux", HW_I2S1CLKUEN, 0 }, + { 0, "wdt_gate", "wdt_mux", HW_WDTCLKUEN, 0 }, + { 0, "clkout_gate", "clkout_mux", HW_CLKOUTCLKUEN, 0 }, +}; +static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { + /* ahb gates */ + { CLKID_AHB_ROM, "rom", "ahb_div", + HW_AHBCLKCTRL0, 1, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RAM, "ram", "ahb_div", + HW_AHBCLKCTRL0, 2, CLK_IGNORE_UNUSED}, + { CLKID_AHB_GPIO, "gpio", "ahb_div", + HW_AHBCLKCTRL0, 4 }, + { CLKID_AHB_MAC, "mac", "ahb_div", + HW_AHBCLKCTRL0, 5 }, + { CLKID_AHB_EMI, "emi", "ahb_div", + HW_AHBCLKCTRL0, 6, CLK_IGNORE_UNUSED}, + { CLKID_AHB_USB0, "usb0", "ahb_div", + HW_AHBCLKCTRL0, 7 }, + { CLKID_AHB_USB1, "usb1", "ahb_div", + HW_AHBCLKCTRL0, 8 }, + { CLKID_AHB_DMA0, "dma0", "ahb_div", + HW_AHBCLKCTRL0, 9 }, + { CLKID_AHB_DMA1, "dma1", "ahb_div", + HW_AHBCLKCTRL0, 10 }, + { CLKID_AHB_UART0, "uart0", "ahb_div", + HW_AHBCLKCTRL0, 11 }, + { CLKID_AHB_UART1, "uart1", "ahb_div", + HW_AHBCLKCTRL0, 12 }, + { CLKID_AHB_UART2, "uart2", "ahb_div", + HW_AHBCLKCTRL0, 13 }, + { CLKID_AHB_UART3, "uart3", "ahb_div", + HW_AHBCLKCTRL0, 14 }, + { CLKID_AHB_UART4, "uart4", "ahb_div", + HW_AHBCLKCTRL0, 15 }, + { CLKID_AHB_UART5, "uart5", "ahb_div", + HW_AHBCLKCTRL0, 16 }, + { CLKID_AHB_UART6, "uart6", "ahb_div", + HW_AHBCLKCTRL0, 17 }, + { CLKID_AHB_UART7, "uart7", "ahb_div", + HW_AHBCLKCTRL0, 18 }, + { CLKID_AHB_UART8, "uart8", "ahb_div", + HW_AHBCLKCTRL0, 19 }, + { CLKID_AHB_UART9, "uart9", "ahb_div", + HW_AHBCLKCTRL0, 20 }, + { CLKID_AHB_I2S0, "i2s0", "ahb_div", + HW_AHBCLKCTRL0, 21 }, + { CLKID_AHB_I2C0, "i2c0", "ahb_div", + HW_AHBCLKCTRL0, 22 }, + { CLKID_AHB_I2C1, "i2c1", "ahb_div", + HW_AHBCLKCTRL0, 23 }, + { CLKID_AHB_SSP0, "ssp0", "ahb_div", + HW_AHBCLKCTRL0, 24 }, + { CLKID_AHB_IOCONFIG, "ioconf", "ahb_div", + HW_AHBCLKCTRL0, 25 }, + { CLKID_AHB_WDT, "wdt", "ahb_div", + HW_AHBCLKCTRL0, 26 }, + { CLKID_AHB_CAN0, "can0", "ahb_div", + HW_AHBCLKCTRL0, 27 }, + { CLKID_AHB_CAN1, "can1", "ahb_div", + HW_AHBCLKCTRL0, 28 }, + { CLKID_AHB_MPWM, "mpwm", "ahb_div", + HW_AHBCLKCTRL0, 29 }, + { CLKID_AHB_SPI0, "spi0", "ahb_div", + HW_AHBCLKCTRL0, 30 }, + { CLKID_AHB_SPI1, "spi1", "ahb_div", + HW_AHBCLKCTRL0, 31 }, + + { CLKID_AHB_QEI, "qei", "ahb_div", + HW_AHBCLKCTRL1, 0 }, + { CLKID_AHB_QUADSPI0, "quadspi0", "ahb_div", + HW_AHBCLKCTRL1, 1 }, + { CLKID_AHB_CAMIF, "capmif", "ahb_div", + HW_AHBCLKCTRL1, 2 }, + { CLKID_AHB_LCDIF, "lcdif", "ahb_div", + HW_AHBCLKCTRL1, 3 }, + { CLKID_AHB_TIMER0, "timer0", "ahb_div", + HW_AHBCLKCTRL1, 4 }, + { CLKID_AHB_TIMER1, "timer1", "ahb_div", + HW_AHBCLKCTRL1, 5 }, + { CLKID_AHB_TIMER2, "timer2", "ahb_div", + HW_AHBCLKCTRL1, 6 }, + { CLKID_AHB_TIMER3, "timer3", "ahb_div", + HW_AHBCLKCTRL1, 7 }, + { CLKID_AHB_IRQ, "irq", "ahb_div", + HW_AHBCLKCTRL1, 8, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RTC, "rtc", "ahb_div", + HW_AHBCLKCTRL1, 9 }, + { CLKID_AHB_NAND, "nand", "ahb_div", + HW_AHBCLKCTRL1, 10 }, + { CLKID_AHB_ADC0, "adc0", "ahb_div", + HW_AHBCLKCTRL1, 11 }, + { CLKID_AHB_LED, "led", "ahb_div", + HW_AHBCLKCTRL1, 12 }, + { CLKID_AHB_DAC0, "dac0", "ahb_div", + HW_AHBCLKCTRL1, 13 }, + { CLKID_AHB_LCD, "lcd", "ahb_div", + HW_AHBCLKCTRL1, 14 }, + { CLKID_AHB_I2S1, "i2s1", "ahb_div", + HW_AHBCLKCTRL1, 15 }, + { CLKID_AHB_MAC1, "mac1", "ahb_div", + HW_AHBCLKCTRL1, 16 }, +}; + +static const char __initdata *main_mux_p[] = {"oscillator", "pll"}; +static const char __initdata *i2s0_mux_p[] = {"oscillator", "pll", "i2s0m_div"}; +static const char __initdata *i2s1_mux_p[] = {"oscillator", "pll", "i2s1m_div"}; +static const char __initdata *clkout_mux_p[] = {"oscillator", "pll", "rtc"}; +static u32 three_mux_table[] = {0, 1, 3}; + +static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { + { 1, three_mux_table, "main_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_MAINCLKSEL, }, + { 1, three_mux_table, "uart_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_UARTCLKSEL, }, + { 1, three_mux_table, "wdt_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_WDTCLKSEL, }, + { 3, three_mux_table, "i2s0_mux", i2s0_mux_p, + ARRAY_SIZE(i2s0_mux_p), HW_I2S0CLKSEL, }, + { 3, three_mux_table, "i2s1_mux", i2s1_mux_p, + ARRAY_SIZE(i2s1_mux_p), HW_I2S1CLKSEL, }, + { 3, three_mux_table, "clkout_mux", clkout_mux_p, + ARRAY_SIZE(clkout_mux_p), HW_CLKOUTCLKSEL, }, +}; + +static void __init asm9260_acc_init(struct device_node *np) +{ + struct clk *clk; + u32 rate; + int n; + u32 accuracy = 0; + + base = of_io_request_and_map(np, 0, np->name); + if (!base) + panic("%s: unable to map resource", np->name); + + /* register pll */ + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; + + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], + clk_names[REFCLK], 0, rate, accuracy); + + if (IS_ERR(clk)) + panic("%s: can't register REFCLK. Check DT!", np->name); + + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; + + mc->parent_names[0] = clk_names[REFCLK]; + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, + mc->num_parents, mc->flags, base + mc->offset, + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); + } + + /* clock mux gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; + + clk = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* clock div cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; + + clks[dc->idx] = clk_register_divider(NULL, dc->name, + dc->parent_name, CLK_SET_RATE_PARENT, + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, + &asm9260_clk_lock); + } + + /* clock ahb gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; + + clks[gd->idx] = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags, base + gd->reg, + gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* check for errors on leaf clocks */ + for (n = 0; n < MAX_CLKS; n++) { + if (!IS_ERR(clks[n])) + continue; + + pr_err("%s: Unable to register leaf clock %d\n", + np->full_name, n); + goto fail; + } + + /* register clk-provider */ + clk_data.clks = clks; + clk_data.clk_num = MAX_CLKS; + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); + return; +fail: + iounmap(base); +} +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", + asm9260_acc_init); diff --git a/include/dt-bindings/clock/alphascale,asm9260.h b/include/dt-bindings/clock/alphascale,asm9260.h new file mode 100644 index 0000000..04e8db2 --- /dev/null +++ b/include/dt-bindings/clock/alphascale,asm9260.h @@ -0,0 +1,97 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_CLK_ASM9260_H +#define _DT_BINDINGS_CLK_ASM9260_H + +/* ahb gate */ +#define CLKID_AHB_ROM 0 +#define CLKID_AHB_RAM 1 +#define CLKID_AHB_GPIO 2 +#define CLKID_AHB_MAC 3 +#define CLKID_AHB_EMI 4 +#define CLKID_AHB_USB0 5 +#define CLKID_AHB_USB1 6 +#define CLKID_AHB_DMA0 7 +#define CLKID_AHB_DMA1 8 +#define CLKID_AHB_UART0 9 +#define CLKID_AHB_UART1 10 +#define CLKID_AHB_UART2 11 +#define CLKID_AHB_UART3 12 +#define CLKID_AHB_UART4 13 +#define CLKID_AHB_UART5 14 +#define CLKID_AHB_UART6 15 +#define CLKID_AHB_UART7 16 +#define CLKID_AHB_UART8 17 +#define CLKID_AHB_UART9 18 +#define CLKID_AHB_I2S0 19 +#define CLKID_AHB_I2C0 20 +#define CLKID_AHB_I2C1 21 +#define CLKID_AHB_SSP0 22 +#define CLKID_AHB_IOCONFIG 23 +#define CLKID_AHB_WDT 24 +#define CLKID_AHB_CAN0 25 +#define CLKID_AHB_CAN1 26 +#define CLKID_AHB_MPWM 27 +#define CLKID_AHB_SPI0 28 +#define CLKID_AHB_SPI1 29 +#define CLKID_AHB_QEI 30 +#define CLKID_AHB_QUADSPI0 31 +#define CLKID_AHB_CAMIF 32 +#define CLKID_AHB_LCDIF 33 +#define CLKID_AHB_TIMER0 34 +#define CLKID_AHB_TIMER1 35 +#define CLKID_AHB_TIMER2 36 +#define CLKID_AHB_TIMER3 37 +#define CLKID_AHB_IRQ 38 +#define CLKID_AHB_RTC 39 +#define CLKID_AHB_NAND 40 +#define CLKID_AHB_ADC0 41 +#define CLKID_AHB_LED 42 +#define CLKID_AHB_DAC0 43 +#define CLKID_AHB_LCD 44 +#define CLKID_AHB_I2S1 45 +#define CLKID_AHB_MAC1 46 + +/* devider */ +#define CLKID_SYS_CPU 47 +#define CLKID_SYS_AHB 48 +#define CLKID_SYS_I2S0M 49 +#define CLKID_SYS_I2S0S 50 +#define CLKID_SYS_I2S1M 51 +#define CLKID_SYS_I2S1S 52 +#define CLKID_SYS_UART0 53 +#define CLKID_SYS_UART1 54 +#define CLKID_SYS_UART2 55 +#define CLKID_SYS_UART3 56 +#define CLKID_SYS_UART4 56 +#define CLKID_SYS_UART5 57 +#define CLKID_SYS_UART6 58 +#define CLKID_SYS_UART7 59 +#define CLKID_SYS_UART8 60 +#define CLKID_SYS_UART9 61 +#define CLKID_SYS_SPI0 62 +#define CLKID_SYS_SPI1 63 +#define CLKID_SYS_QUADSPI 64 +#define CLKID_SYS_SSP0 65 +#define CLKID_SYS_NAND 66 +#define CLKID_SYS_TRACE 67 +#define CLKID_SYS_CAMM 68 +#define CLKID_SYS_WDT 69 +#define CLKID_SYS_CLKOUT 70 +#define CLKID_SYS_MAC 71 +#define CLKID_SYS_LCD 72 +#define CLKID_SYS_ADCANA 73 + +#define MAX_CLKS 74 +#endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 4/9] ARM: irqchip: mxs: prepare driver for HW with different offsets 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel ` (2 preceding siblings ...) 2014-10-21 10:40 ` [PATCH v8 3/9] ARM: clk: add clk-asm9260 driver Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel ` (5 subsequent siblings) 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel Some HW has similar functionality but different register offsets. Make sure we can change offsets dynamically. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/irqchip/irq-mxs.c | 55 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c index e4acf1e..681125d 100644 --- a/drivers/irqchip/irq-mxs.c +++ b/drivers/irqchip/irq-mxs.c @@ -29,18 +29,39 @@ #include "irqchip.h" +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ +#define SET_REG 4 +#define CLR_REG 8 + #define HW_ICOLL_VECTOR 0x0000 #define HW_ICOLL_LEVELACK 0x0010 #define HW_ICOLL_CTRL 0x0020 #define HW_ICOLL_STAT_OFFSET 0x0070 -#define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10) -#define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10) -#define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004 +#define HW_ICOLL_INTERRUPT0 0x0120 +#define HW_ICOLL_INTERRUPTn(n) ((n) * 0x10) +#define BM_ICOLL_INTR_ENABLE BIT(2) #define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1 #define ICOLL_NUM_IRQS 128 -static void __iomem *icoll_base; +struct icoll_priv { + void __iomem *vector; + void __iomem *levelack; + void __iomem *ctrl; + void __iomem *stat; + void __iomem *intr; + /* number of interrupts per register */ + int intr_per_reg; + void __iomem *clear; +}; + +static struct icoll_priv icoll_priv; static struct irq_domain *icoll_domain; static void icoll_ack_irq(struct irq_data *d) @@ -51,19 +72,19 @@ static void icoll_ack_irq(struct irq_data *d) * BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 unconditionally. */ __raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0, - icoll_base + HW_ICOLL_LEVELACK); + icoll_priv.levelack); } static void icoll_mask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq)); + __raw_writel(BM_ICOLL_INTR_ENABLE, + icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); } static void icoll_unmask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq)); + __raw_writel(BM_ICOLL_INTR_ENABLE, + icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); } static struct irq_chip mxs_icoll_chip = { @@ -76,8 +97,8 @@ asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs) { u32 irqnr; - irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET); - __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR); + irqnr = __raw_readl(icoll_priv.stat); + __raw_writel(irqnr, icoll_priv.vector); handle_domain_irq(icoll_domain, irqnr, regs); } @@ -98,14 +119,22 @@ static struct irq_domain_ops icoll_irq_domain_ops = { static int __init icoll_of_init(struct device_node *np, struct device_node *interrupt_parent) { - icoll_base = of_iomap(np, 0); + void __iomem *icoll_base = of_iomap(np, 0); WARN_ON(!icoll_base); + icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; + icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; + icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; + icoll_priv.stat = icoll_base + HW_ICOLL_STAT_OFFSET; + icoll_priv.intr = icoll_base + HW_ICOLL_INTERRUPT0; + icoll_priv.intr_per_reg = 1; + icoll_priv.clear = NULL; + /* * Interrupt Collector reset, which initializes the priority * for each irq to level 0. */ - stmp_reset_block(icoll_base + HW_ICOLL_CTRL); + stmp_reset_block(icoll_priv.ctrl); icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, &icoll_irq_domain_ops, NULL); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel ` (3 preceding siblings ...) 2014-10-21 10:40 ` [PATCH v8 4/9] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-11-02 2:19 ` Jason Cooper 2014-11-04 13:03 ` Shawn Guo 2014-10-21 10:40 ` [PATCH v8 6/9] ARM: clocksource: add asm9260_timer driver Oleksij Rempel ` (4 subsequent siblings) 9 siblings, 2 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel Freescale iMX23/iMX28 and Alphascale ASM9260 have similar interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. Differences between this devices are fallowing: - different register offsets - different count of intterupt lines per register - ASM9260 don't provide reset bit - ASM9260 don't support FIQ. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/irqchip/Kconfig | 9 +++ drivers/irqchip/Makefile | 2 +- drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++++++++++ drivers/irqchip/irq-mxs.c | 105 ++++++++++++++++++++++++--- 4 files changed, 216 insertions(+), 9 deletions(-) create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index b8632bf..10470cb 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -113,3 +113,12 @@ config IRQ_CROSSBAR The primary irqchip invokes the crossbar's callback which inturn allocates a free irq and configures the IP. Thus the peripheral interrupts are routed to one of the free irqchip interrupt lines. + +config IRQ_MXS + bool "MXS interrupt controller" + select IRQ_DOMAIN + select STMP_DEVICE + default y if MACH_ASM9260 || CONFIG_ARCH_MXS + help + Support for interrupt controller present in Freescale iMX23/iMX28 and + Alphascale ASM9260 SoCs. diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 73052ba..89c7042 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o obj-$(CONFIG_ARCH_MMP) += irq-mmp.o obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o -obj-$(CONFIG_ARCH_MXS) += irq-mxs.o +obj-$(CONFIG_IRQ_MXS) += irq-mxs.o obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o obj-$(CONFIG_METAG) += irq-metag-ext.o diff --git a/drivers/irqchip/alphascale_asm9260-icoll.h b/drivers/irqchip/alphascale_asm9260-icoll.h new file mode 100644 index 0000000..5cec108 --- /dev/null +++ b/drivers/irqchip/alphascale_asm9260-icoll.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef _ALPHASCALE_ASM9260_ICOLL_H +#define _ALPHASCALE_ASM9260_ICOLL_H + +#define ASM9260_NUM_IRQS 64 +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ + +#define ASM9260_HW_ICOLL_VECTOR 0x0000 +/* + * bits 31:2 + * This register presents the vector address for the interrupt currently + * active on the CPU IRQ input. Writing to this register notifies the + * interrupt collector that the interrupt service routine for the current + * interrupt has been entered. + * The exception trap should have a LDPC instruction from this address: + * LDPC ASM9260_HW_ICOLL_VECTOR_ADDR; IRQ exception at 0xffff0018 + */ + +/* + * The Interrupt Collector Level Acknowledge Register is used by software to + * indicate the completion of an interrupt on a specific level. + * This register is written at the very end of an interrupt service routine. If + * nesting is used then the CPU irq must be turned on before writing to this + * register to avoid a race condition in the CPU interrupt hardware. + */ +#define ASM9260_HW_ICOLL_LEVELACK 0x0010 +#define ASM9260_BM_LEVELn(nr) BIT(nr) + +#define ASM9260_HW_ICOLL_CTRL 0x0020 +/* + * ASM9260_BM_CTRL_SFTRST and ASM9260_BM_CTRL_CLKGATE are not available on + * asm9260. + */ +#define ASM9260_BM_CTRL_SFTRST BIT(31) +#define ASM9260_BM_CTRL_CLKGATE BIT(30) +/* disable interrupt level nesting */ +#define ASM9260_BM_CTRL_NO_NESTING BIT(19) +/* + * Set this bit to one enable the RISC32-style read side effect associated with + * the vector address register. In this mode, interrupt in-service is signaled + * by the read of the ASM9260_HW_ICOLL_VECTOR register to acquire the interrupt + * vector address. Set this bit to zero for normal operation, in which the ISR + * signals in-service explicitly by means of a write to the + * ASM9260_HW_ICOLL_VECTOR register. + * 0 - Must Write to Vector register to go in-service. + * 1 - Go in-service as a read side effect + */ +#define ASM9260_BM_CTRL_ARM_RSE_MODE BIT(18) +#define ASM9260_BM_CTRL_IRQ_ENABLE BIT(16) + +#define ASM9260_HW_ICOLL_STAT_OFFSET 0x0030 +/* + * bits 5:0 + * Vector number of current interrupt. Multiply by 4 and add to vector base + * address to obtain the value in ASM9260_HW_ICOLL_VECTOR. + */ + +/* + * RAW0 and RAW1 provides a read-only view of the raw interrupt request lines + * coming from various parts of the chip. Its purpose is to improve diagnostic + * observability. + */ +#define ASM9260_HW_ICOLL_RAW0 0x0040 +#define ASM9260_HW_ICOLL_RAW1 0x0050 + +#define ASM9260_HW_ICOLL_INTERRUPT0 0x0060 +#define ASM9260_HW_ICOLL_INTERRUPTn(n) (0x0060 + ((n) >> 2) * 0x10) +/* + * WARNING: Modifying the priority of an enabled interrupt may result in + * undefined behavior. + */ +#define ASM9260_BM_INT_PRIORITY_MASK 0x3 +#define ASM9260_BM_INT_ENABLE BIT(2) +#define ASM9260_BM_INT_SOFTIRQ BIT(3) + +#define ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n) (((n) & 0x3) << 3) +#define ASM9260_BM_ICOLL_INTERRUPTn_ENABLE(n) (1 << (2 + \ + ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n))) + +#define ASM9260_HW_ICOLL_VBASE 0x0160 +/* + * bits 31:2 + * This bitfield holds the upper 30 bits of the base address of the vector + * table. + */ + +#define ASM9260_HW_ICOLL_CLEAR0 0x01d0 +#define ASM9260_HW_ICOLL_CLEAR1 0x01e0 +#define ASM9260_HW_ICOLL_CLEARn(n) (((n >> 5) * 0x10) \ + + SET_REG) +#define ASM9260_BM_CLEAR_BIT(n) BIT(n & 0x1f) + +/* Scratchpad */ +#define ASM9260_HW_ICOLL_UNDEF_VECTOR 0x01f0 +#endif diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c index 681125d..8c5c3d2 100644 --- a/drivers/irqchip/irq-mxs.c +++ b/drivers/irqchip/irq-mxs.c @@ -1,5 +1,7 @@ /* * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * Add Alphascale ASM9260 support. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +30,7 @@ #include <asm/exception.h> #include "irqchip.h" +#include "alphascale_asm9260-icoll.h" /* * this device provide 4 offsets for each register: @@ -63,6 +66,33 @@ struct icoll_priv { static struct icoll_priv icoll_priv; static struct irq_domain *icoll_domain; +static DEFINE_RAW_SPINLOCK(icoll_lock); + +/* calculate bit offset depending on number of intterupt per register */ +static u32 icoll_intr_bitshift(struct irq_data *d, u32 bit) +{ + /* + * We expect intr_per_reg to be 4 or 1, it means + * "n" will be 3 or 0. + */ + int n = icoll_priv.intr_per_reg - 1; + + /* + * If n = 0, "bit" is never shifted. + * If n = 3, mask lower part of hwirq to convert it + * in 0, 1, 2 or 3 and then multiply it by 8 (or shift by 3) + */ + return bit << ((d->hwirq & n) << n); +} + +/* calculate mem offset depending on number of intterupt per register */ +static void __iomem *icoll_intr_reg(struct irq_data *d) +{ + int n = icoll_priv.intr_per_reg >> 1; + + /* offset = hwirq / intr_per_reg * 0x10 */ + return icoll_priv.intr + ((d->hwirq >> n) * 0x10); +} static void icoll_ack_irq(struct irq_data *d) { @@ -77,14 +107,21 @@ static void icoll_ack_irq(struct irq_data *d) static void icoll_mask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTR_ENABLE, - icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), + icoll_intr_reg(d) + CLR_REG); } static void icoll_unmask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTR_ENABLE, - icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); + raw_spin_lock(&icoll_lock); + if (icoll_priv.clear) + __raw_writel(ASM9260_BM_CLEAR_BIT(d->hwirq), + icoll_priv.clear + + ASM9260_HW_ICOLL_CLEARn(d->hwirq)); + + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), + icoll_intr_reg(d) + SET_REG); + raw_spin_unlock(&icoll_lock); } static struct irq_chip mxs_icoll_chip = { @@ -116,12 +153,34 @@ static struct irq_domain_ops icoll_irq_domain_ops = { .xlate = irq_domain_xlate_onecell, }; +static void __init icoll_add_domain(struct device_node *np, + int num) +{ + icoll_domain = irq_domain_add_linear(np, num, + &icoll_irq_domain_ops, NULL); + + if (!icoll_domain) + panic("%s: unable add irq domain", np->full_name); + irq_set_default_host(icoll_domain); + set_handle_irq(icoll_handle_irq); +} + +static void __iomem * __init icoll_init_iobase(struct device_node *np) +{ + void __iomem *icoll_base; + + icoll_base = of_io_request_and_map(np, 0, np->name); + if (!icoll_base) + panic("%s: unable to map resource", np->full_name); + return icoll_base; +} + static int __init icoll_of_init(struct device_node *np, struct device_node *interrupt_parent) { - void __iomem *icoll_base = of_iomap(np, 0); - WARN_ON(!icoll_base); + void __iomem *icoll_base; + icoll_base = icoll_init_iobase(np); icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; @@ -136,8 +195,38 @@ static int __init icoll_of_init(struct device_node *np, */ stmp_reset_block(icoll_priv.ctrl); - icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, - &icoll_irq_domain_ops, NULL); + icoll_add_domain(np, ICOLL_NUM_IRQS); + return icoll_domain ? 0 : -ENODEV; } IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); + +static int __init asm9260_of_init(struct device_node *np, + struct device_node *interrupt_parent) +{ + void __iomem *icoll_base; + int i; + + icoll_base = icoll_init_iobase(np); + icoll_priv.vector = icoll_base + ASM9260_HW_ICOLL_VECTOR; + icoll_priv.levelack = icoll_base + ASM9260_HW_ICOLL_LEVELACK; + icoll_priv.ctrl = icoll_base + ASM9260_HW_ICOLL_CTRL; + icoll_priv.stat = icoll_base + ASM9260_HW_ICOLL_STAT_OFFSET; + icoll_priv.intr = icoll_base + ASM9260_HW_ICOLL_INTERRUPT0; + icoll_priv.intr_per_reg = 4; + icoll_priv.clear = icoll_base + ASM9260_HW_ICOLL_CLEAR0; + + writel_relaxed(ASM9260_BM_CTRL_IRQ_ENABLE, + icoll_priv.ctrl); + /* + * ASM9260 don't provide reset bit. So, we need to set level 0 + * manually. + */ + for (i = 0; i < 16 * 0x10; i += 0x10) + writel(0, icoll_priv.intr + i); + + icoll_add_domain(np, ASM9260_NUM_IRQS); + + return icoll_domain ? 0 : -ENODEV; +} +IRQCHIP_DECLARE(asm9260, "alphascale,asm9260-icoll", asm9260_of_init); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-10-21 10:40 ` [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel @ 2014-11-02 2:19 ` Jason Cooper 2014-11-04 13:03 ` Shawn Guo 1 sibling, 0 replies; 81+ messages in thread From: Jason Cooper @ 2014-11-02 2:19 UTC (permalink / raw) To: linux-arm-kernel Oleksij, Shawn, Sascha, Top of thread is here: https://lkml.kernel.org/r/1413888020-8790-1-git-send-email-linux at rempel-privat.de On Tue, Oct 21, 2014 at 12:40:16PM +0200, Oleksij Rempel wrote: > Freescale iMX23/iMX28 and Alphascale ASM9260 have similar > interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. > Differences between this devices are fallowing: > - different register offsets > - different count of intterupt lines per register > - ASM9260 don't provide reset bit > - ASM9260 don't support FIQ. > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> > --- > drivers/irqchip/Kconfig | 9 +++ > drivers/irqchip/Makefile | 2 +- > drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++++++++++ > drivers/irqchip/irq-mxs.c | 105 ++++++++++++++++++++++++--- > 4 files changed, 216 insertions(+), 9 deletions(-) > create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h ... > diff --git a/drivers/irqchip/alphascale_asm9260-icoll.h b/drivers/irqchip/alphascale_asm9260-icoll.h > new file mode 100644 > index 0000000..5cec108 > --- /dev/null > +++ b/drivers/irqchip/alphascale_asm9260-icoll.h > @@ -0,0 +1,109 @@ > +/* > + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + */ > + > +#ifndef _ALPHASCALE_ASM9260_ICOLL_H > +#define _ALPHASCALE_ASM9260_ICOLL_H > + > +#define ASM9260_NUM_IRQS 64 > +/* > + * this device provide 4 offsets for each register: > + * 0x0 - plain read write mode > + * 0x4 - set mode, OR logic. > + * 0x8 - clr mode, XOR logic. > + * 0xc - togle mode. > + */ > + > +#define ASM9260_HW_ICOLL_VECTOR 0x0000 > +/* > + * bits 31:2 > + * This register presents the vector address for the interrupt currently > + * active on the CPU IRQ input. Writing to this register notifies the > + * interrupt collector that the interrupt service routine for the current > + * interrupt has been entered. > + * The exception trap should have a LDPC instruction from this address: > + * LDPC ASM9260_HW_ICOLL_VECTOR_ADDR; IRQ exception at 0xffff0018 > + */ > + > +/* > + * The Interrupt Collector Level Acknowledge Register is used by software to > + * indicate the completion of an interrupt on a specific level. > + * This register is written at the very end of an interrupt service routine. If > + * nesting is used then the CPU irq must be turned on before writing to this > + * register to avoid a race condition in the CPU interrupt hardware. > + */ > +#define ASM9260_HW_ICOLL_LEVELACK 0x0010 > +#define ASM9260_BM_LEVELn(nr) BIT(nr) > + > +#define ASM9260_HW_ICOLL_CTRL 0x0020 > +/* > + * ASM9260_BM_CTRL_SFTRST and ASM9260_BM_CTRL_CLKGATE are not available on > + * asm9260. > + */ > +#define ASM9260_BM_CTRL_SFTRST BIT(31) > +#define ASM9260_BM_CTRL_CLKGATE BIT(30) > +/* disable interrupt level nesting */ > +#define ASM9260_BM_CTRL_NO_NESTING BIT(19) > +/* > + * Set this bit to one enable the RISC32-style read side effect associated with > + * the vector address register. In this mode, interrupt in-service is signaled > + * by the read of the ASM9260_HW_ICOLL_VECTOR register to acquire the interrupt > + * vector address. Set this bit to zero for normal operation, in which the ISR > + * signals in-service explicitly by means of a write to the > + * ASM9260_HW_ICOLL_VECTOR register. > + * 0 - Must Write to Vector register to go in-service. > + * 1 - Go in-service as a read side effect > + */ > +#define ASM9260_BM_CTRL_ARM_RSE_MODE BIT(18) > +#define ASM9260_BM_CTRL_IRQ_ENABLE BIT(16) > + > +#define ASM9260_HW_ICOLL_STAT_OFFSET 0x0030 > +/* > + * bits 5:0 > + * Vector number of current interrupt. Multiply by 4 and add to vector base > + * address to obtain the value in ASM9260_HW_ICOLL_VECTOR. > + */ > + > +/* > + * RAW0 and RAW1 provides a read-only view of the raw interrupt request lines > + * coming from various parts of the chip. Its purpose is to improve diagnostic > + * observability. > + */ > +#define ASM9260_HW_ICOLL_RAW0 0x0040 > +#define ASM9260_HW_ICOLL_RAW1 0x0050 > + > +#define ASM9260_HW_ICOLL_INTERRUPT0 0x0060 > +#define ASM9260_HW_ICOLL_INTERRUPTn(n) (0x0060 + ((n) >> 2) * 0x10) > +/* > + * WARNING: Modifying the priority of an enabled interrupt may result in > + * undefined behavior. > + */ > +#define ASM9260_BM_INT_PRIORITY_MASK 0x3 > +#define ASM9260_BM_INT_ENABLE BIT(2) > +#define ASM9260_BM_INT_SOFTIRQ BIT(3) > + > +#define ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n) (((n) & 0x3) << 3) > +#define ASM9260_BM_ICOLL_INTERRUPTn_ENABLE(n) (1 << (2 + \ > + ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n))) > + > +#define ASM9260_HW_ICOLL_VBASE 0x0160 > +/* > + * bits 31:2 > + * This bitfield holds the upper 30 bits of the base address of the vector > + * table. > + */ > + > +#define ASM9260_HW_ICOLL_CLEAR0 0x01d0 > +#define ASM9260_HW_ICOLL_CLEAR1 0x01e0 > +#define ASM9260_HW_ICOLL_CLEARn(n) (((n >> 5) * 0x10) \ > + + SET_REG) > +#define ASM9260_BM_CLEAR_BIT(n) BIT(n & 0x1f) > + > +/* Scratchpad */ > +#define ASM9260_HW_ICOLL_UNDEF_VECTOR 0x01f0 > +#endif > diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c > index 681125d..8c5c3d2 100644 > --- a/drivers/irqchip/irq-mxs.c > +++ b/drivers/irqchip/irq-mxs.c > @@ -1,5 +1,7 @@ > /* > * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. > + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> > + * Add Alphascale ASM9260 support. > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as published by > @@ -28,6 +30,7 @@ > #include <asm/exception.h> > > #include "irqchip.h" > +#include "alphascale_asm9260-icoll.h" > > /* > * this device provide 4 offsets for each register: > @@ -63,6 +66,33 @@ struct icoll_priv { > > static struct icoll_priv icoll_priv; > static struct irq_domain *icoll_domain; > +static DEFINE_RAW_SPINLOCK(icoll_lock); > + > +/* calculate bit offset depending on number of intterupt per register */ > +static u32 icoll_intr_bitshift(struct irq_data *d, u32 bit) > +{ > + /* > + * We expect intr_per_reg to be 4 or 1, it means > + * "n" will be 3 or 0. > + */ > + int n = icoll_priv.intr_per_reg - 1; > + > + /* > + * If n = 0, "bit" is never shifted. > + * If n = 3, mask lower part of hwirq to convert it > + * in 0, 1, 2 or 3 and then multiply it by 8 (or shift by 3) > + */ > + return bit << ((d->hwirq & n) << n); > +} > + > +/* calculate mem offset depending on number of intterupt per register */ > +static void __iomem *icoll_intr_reg(struct irq_data *d) > +{ > + int n = icoll_priv.intr_per_reg >> 1; > + > + /* offset = hwirq / intr_per_reg * 0x10 */ > + return icoll_priv.intr + ((d->hwirq >> n) * 0x10); > +} > > static void icoll_ack_irq(struct irq_data *d) > { > @@ -77,14 +107,21 @@ static void icoll_ack_irq(struct irq_data *d) > > static void icoll_mask_irq(struct irq_data *d) > { > - __raw_writel(BM_ICOLL_INTR_ENABLE, > - icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); > + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), > + icoll_intr_reg(d) + CLR_REG); > } > > static void icoll_unmask_irq(struct irq_data *d) > { > - __raw_writel(BM_ICOLL_INTR_ENABLE, > - icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); > + raw_spin_lock(&icoll_lock); > + if (icoll_priv.clear) > + __raw_writel(ASM9260_BM_CLEAR_BIT(d->hwirq), > + icoll_priv.clear + > + ASM9260_HW_ICOLL_CLEARn(d->hwirq)); > + > + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), > + icoll_intr_reg(d) + SET_REG); > + raw_spin_unlock(&icoll_lock); > } Before I consider merging this, I'd like to see an Ack from the i.MX maintainers that they're ok with these changes. Particularly the blocks I've quoted above. thx, Jason. ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-10-21 10:40 ` [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel 2014-11-02 2:19 ` Jason Cooper @ 2014-11-04 13:03 ` Shawn Guo 2014-11-04 13:13 ` Russell King - ARM Linux ` (2 more replies) 1 sibling, 3 replies; 81+ messages in thread From: Shawn Guo @ 2014-11-04 13:03 UTC (permalink / raw) To: linux-arm-kernel Thanks Jason for pointing me the thread. On Tue, Oct 21, 2014 at 12:40:16PM +0200, Oleksij Rempel wrote: > Freescale iMX23/iMX28 and Alphascale ASM9260 have similar > interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. > Differences between this devices are fallowing: > - different register offsets > - different count of intterupt lines per register > - ASM9260 don't provide reset bit > - ASM9260 don't support FIQ. > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> > --- > drivers/irqchip/Kconfig | 9 +++ > drivers/irqchip/Makefile | 2 +- > drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++++++++++ > drivers/irqchip/irq-mxs.c | 105 ++++++++++++++++++++++++--- > 4 files changed, 216 insertions(+), 9 deletions(-) > create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h > > diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig > index b8632bf..10470cb 100644 > --- a/drivers/irqchip/Kconfig > +++ b/drivers/irqchip/Kconfig > @@ -113,3 +113,12 @@ config IRQ_CROSSBAR > The primary irqchip invokes the crossbar's callback which inturn allocates > a free irq and configures the IP. Thus the peripheral interrupts are > routed to one of the free irqchip interrupt lines. > + > +config IRQ_MXS > + bool "MXS interrupt controller" > + select IRQ_DOMAIN > + select STMP_DEVICE > + default y if MACH_ASM9260 || CONFIG_ARCH_MXS s/CONFIG_ARCH_MXS/ARCH_MXS Even with this change, the 'default y' doesn't seem to work for me. > + help > + Support for interrupt controller present in Freescale iMX23/iMX28 and > + Alphascale ASM9260 SoCs. ... > diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c > index 681125d..8c5c3d2 100644 > --- a/drivers/irqchip/irq-mxs.c > +++ b/drivers/irqchip/irq-mxs.c > @@ -1,5 +1,7 @@ > /* > * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. > + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> > + * Add Alphascale ASM9260 support. > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as published by > @@ -28,6 +30,7 @@ > #include <asm/exception.h> > > #include "irqchip.h" > +#include "alphascale_asm9260-icoll.h" > > /* > * this device provide 4 offsets for each register: > @@ -63,6 +66,33 @@ struct icoll_priv { > > static struct icoll_priv icoll_priv; > static struct irq_domain *icoll_domain; > +static DEFINE_RAW_SPINLOCK(icoll_lock); > + > +/* calculate bit offset depending on number of intterupt per register */ > +static u32 icoll_intr_bitshift(struct irq_data *d, u32 bit) > +{ > + /* > + * We expect intr_per_reg to be 4 or 1, it means > + * "n" will be 3 or 0. > + */ > + int n = icoll_priv.intr_per_reg - 1; > + > + /* > + * If n = 0, "bit" is never shifted. > + * If n = 3, mask lower part of hwirq to convert it > + * in 0, 1, 2 or 3 and then multiply it by 8 (or shift by 3) > + */ > + return bit << ((d->hwirq & n) << n); > +} > + > +/* calculate mem offset depending on number of intterupt per register */ > +static void __iomem *icoll_intr_reg(struct irq_data *d) > +{ > + int n = icoll_priv.intr_per_reg >> 1; > + > + /* offset = hwirq / intr_per_reg * 0x10 */ > + return icoll_priv.intr + ((d->hwirq >> n) * 0x10); > +} > > static void icoll_ack_irq(struct irq_data *d) > { > @@ -77,14 +107,21 @@ static void icoll_ack_irq(struct irq_data *d) > > static void icoll_mask_irq(struct irq_data *d) > { > - __raw_writel(BM_ICOLL_INTR_ENABLE, > - icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); > + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), > + icoll_intr_reg(d) + CLR_REG); > } > > static void icoll_unmask_irq(struct irq_data *d) > { > - __raw_writel(BM_ICOLL_INTR_ENABLE, > - icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); > + raw_spin_lock(&icoll_lock); > + if (icoll_priv.clear) > + __raw_writel(ASM9260_BM_CLEAR_BIT(d->hwirq), > + icoll_priv.clear + > + ASM9260_HW_ICOLL_CLEARn(d->hwirq)); > + > + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), > + icoll_intr_reg(d) + SET_REG); > + raw_spin_unlock(&icoll_lock); > } > > static struct irq_chip mxs_icoll_chip = { > @@ -116,12 +153,34 @@ static struct irq_domain_ops icoll_irq_domain_ops = { > .xlate = irq_domain_xlate_onecell, > }; > > +static void __init icoll_add_domain(struct device_node *np, > + int num) > +{ > + icoll_domain = irq_domain_add_linear(np, num, > + &icoll_irq_domain_ops, NULL); > + > + if (!icoll_domain) > + panic("%s: unable add irq domain", np->full_name); > + irq_set_default_host(icoll_domain); > + set_handle_irq(icoll_handle_irq); > +} > + > +static void __iomem * __init icoll_init_iobase(struct device_node *np) > +{ > + void __iomem *icoll_base; > + > + icoll_base = of_io_request_and_map(np, 0, np->name); LD kernel/built-in.o ../drivers/irqchip/irq-mxs.c: In function ?icoll_init_iobase?: ../drivers/irqchip/irq-mxs.c:172:2: warning: passing argument 3 of ?of_io_request_and_map? discards ?const? qualifier from pointer target type [enabled by default] In file included from ../drivers/irqchip/irq-mxs.c:27:0: ../include/linux/of_address.h:108:15: note: expected ?char *? but argument is of type ?const char *? Shawn > + if (!icoll_base) > + panic("%s: unable to map resource", np->full_name); > + return icoll_base; > +} > + > static int __init icoll_of_init(struct device_node *np, > struct device_node *interrupt_parent) > { > - void __iomem *icoll_base = of_iomap(np, 0); > - WARN_ON(!icoll_base); > + void __iomem *icoll_base; > > + icoll_base = icoll_init_iobase(np); > icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; > icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; > icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; > @@ -136,8 +195,38 @@ static int __init icoll_of_init(struct device_node *np, > */ > stmp_reset_block(icoll_priv.ctrl); > > - icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, > - &icoll_irq_domain_ops, NULL); > + icoll_add_domain(np, ICOLL_NUM_IRQS); > + > return icoll_domain ? 0 : -ENODEV; > } > IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); > + > +static int __init asm9260_of_init(struct device_node *np, > + struct device_node *interrupt_parent) > +{ > + void __iomem *icoll_base; > + int i; > + > + icoll_base = icoll_init_iobase(np); > + icoll_priv.vector = icoll_base + ASM9260_HW_ICOLL_VECTOR; > + icoll_priv.levelack = icoll_base + ASM9260_HW_ICOLL_LEVELACK; > + icoll_priv.ctrl = icoll_base + ASM9260_HW_ICOLL_CTRL; > + icoll_priv.stat = icoll_base + ASM9260_HW_ICOLL_STAT_OFFSET; > + icoll_priv.intr = icoll_base + ASM9260_HW_ICOLL_INTERRUPT0; > + icoll_priv.intr_per_reg = 4; > + icoll_priv.clear = icoll_base + ASM9260_HW_ICOLL_CLEAR0; > + > + writel_relaxed(ASM9260_BM_CTRL_IRQ_ENABLE, > + icoll_priv.ctrl); > + /* > + * ASM9260 don't provide reset bit. So, we need to set level 0 > + * manually. > + */ > + for (i = 0; i < 16 * 0x10; i += 0x10) > + writel(0, icoll_priv.intr + i); > + > + icoll_add_domain(np, ASM9260_NUM_IRQS); > + > + return icoll_domain ? 0 : -ENODEV; > +} > +IRQCHIP_DECLARE(asm9260, "alphascale,asm9260-icoll", asm9260_of_init); > -- > 1.9.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-04 13:03 ` Shawn Guo @ 2014-11-04 13:13 ` Russell King - ARM Linux 2014-11-04 13:15 ` Oleksij Rempel 2014-11-04 13:16 ` Oleksij Rempel 2014-11-04 19:12 ` [PATCH v2] " Oleksij Rempel 2 siblings, 1 reply; 81+ messages in thread From: Russell King - ARM Linux @ 2014-11-04 13:13 UTC (permalink / raw) To: linux-arm-kernel On Tue, Nov 04, 2014 at 09:03:23PM +0800, Shawn Guo wrote: > Thanks Jason for pointing me the thread. > > On Tue, Oct 21, 2014 at 12:40:16PM +0200, Oleksij Rempel wrote: > > +config IRQ_MXS > > + bool "MXS interrupt controller" > > + select IRQ_DOMAIN > > + select STMP_DEVICE > > + default y if MACH_ASM9260 || CONFIG_ARCH_MXS > > s/CONFIG_ARCH_MXS/ARCH_MXS > > Even with this change, the 'default y' doesn't seem to work for me. The only way an option follows its default is if it doesn't have a visible prompt. So: config IRQ_MXS def_bool y if MACH_ASM9260 || ARCH_MXS select IRQ_DOMAIN select STMP_DEVICE will cause it to always be defined to 'y' if either of those options are enabled. Otherwise, if it has a visible prompt, it follows (in order of precedence) whatever the user specifies, the configuration file, or the Kconfig specified default, or 'n'. (Each limited by selects and dependencies.) Is there a particular reason why the option is being offered for user selection? -- FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-04 13:13 ` Russell King - ARM Linux @ 2014-11-04 13:15 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-04 13:15 UTC (permalink / raw) To: linux-arm-kernel Am 04.11.2014 um 14:13 schrieb Russell King - ARM Linux: > On Tue, Nov 04, 2014 at 09:03:23PM +0800, Shawn Guo wrote: >> Thanks Jason for pointing me the thread. >> >> On Tue, Oct 21, 2014 at 12:40:16PM +0200, Oleksij Rempel wrote: >>> +config IRQ_MXS >>> + bool "MXS interrupt controller" >>> + select IRQ_DOMAIN >>> + select STMP_DEVICE >>> + default y if MACH_ASM9260 || CONFIG_ARCH_MXS >> >> s/CONFIG_ARCH_MXS/ARCH_MXS >> >> Even with this change, the 'default y' doesn't seem to work for me. > > The only way an option follows its default is if it doesn't have a visible > prompt. So: > > config IRQ_MXS > def_bool y if MACH_ASM9260 || ARCH_MXS > select IRQ_DOMAIN > select STMP_DEVICE > > will cause it to always be defined to 'y' if either of those options are > enabled. Otherwise, if it has a visible prompt, it follows (in order of > precedence) whatever the user specifies, the configuration file, or the > Kconfig specified default, or 'n'. (Each limited by selects and > dependencies.) Ok, will fix it. > Is there a particular reason why the option is being offered for user > selection? no. -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141104/39bc5dd9/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-04 13:03 ` Shawn Guo 2014-11-04 13:13 ` Russell King - ARM Linux @ 2014-11-04 13:16 ` Oleksij Rempel 2014-11-04 19:12 ` [PATCH v2] " Oleksij Rempel 2 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-04 13:16 UTC (permalink / raw) To: linux-arm-kernel Am 04.11.2014 um 14:03 schrieb Shawn Guo: > Thanks Jason for pointing me the thread. > > On Tue, Oct 21, 2014 at 12:40:16PM +0200, Oleksij Rempel wrote: >> Freescale iMX23/iMX28 and Alphascale ASM9260 have similar >> interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. >> Differences between this devices are fallowing: >> - different register offsets >> - different count of intterupt lines per register >> - ASM9260 don't provide reset bit >> - ASM9260 don't support FIQ. >> >> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> >> --- >> drivers/irqchip/Kconfig | 9 +++ >> drivers/irqchip/Makefile | 2 +- >> drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++++++++++ >> drivers/irqchip/irq-mxs.c | 105 ++++++++++++++++++++++++--- >> 4 files changed, 216 insertions(+), 9 deletions(-) >> create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h >> >> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig >> index b8632bf..10470cb 100644 >> --- a/drivers/irqchip/Kconfig >> +++ b/drivers/irqchip/Kconfig >> @@ -113,3 +113,12 @@ config IRQ_CROSSBAR >> The primary irqchip invokes the crossbar's callback which inturn allocates >> a free irq and configures the IP. Thus the peripheral interrupts are >> routed to one of the free irqchip interrupt lines. >> + >> +config IRQ_MXS >> + bool "MXS interrupt controller" >> + select IRQ_DOMAIN >> + select STMP_DEVICE >> + default y if MACH_ASM9260 || CONFIG_ARCH_MXS > > s/CONFIG_ARCH_MXS/ARCH_MXS Right, thank you. > Even with this change, the 'default y' doesn't seem to work for me. hm... According to this lines it should work: -obj-$(CONFIG_ARCH_MXS) += irq-mxs.o +obj-$(CONFIG_IRQ_MXS) += irq-mxs.o >> + help >> + Support for interrupt controller present in Freescale iMX23/iMX28 and >> + Alphascale ASM9260 SoCs. > > ... > >> diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c >> index 681125d..8c5c3d2 100644 >> --- a/drivers/irqchip/irq-mxs.c >> +++ b/drivers/irqchip/irq-mxs.c >> @@ -1,5 +1,7 @@ >> /* >> * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. >> + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> >> + * Add Alphascale ASM9260 support. >> * >> * This program is free software; you can redistribute it and/or modify >> * it under the terms of the GNU General Public License as published by >> @@ -28,6 +30,7 @@ >> #include <asm/exception.h> >> >> #include "irqchip.h" >> +#include "alphascale_asm9260-icoll.h" >> >> /* >> * this device provide 4 offsets for each register: >> @@ -63,6 +66,33 @@ struct icoll_priv { >> >> static struct icoll_priv icoll_priv; >> static struct irq_domain *icoll_domain; >> +static DEFINE_RAW_SPINLOCK(icoll_lock); >> + >> +/* calculate bit offset depending on number of intterupt per register */ >> +static u32 icoll_intr_bitshift(struct irq_data *d, u32 bit) >> +{ >> + /* >> + * We expect intr_per_reg to be 4 or 1, it means >> + * "n" will be 3 or 0. >> + */ >> + int n = icoll_priv.intr_per_reg - 1; >> + >> + /* >> + * If n = 0, "bit" is never shifted. >> + * If n = 3, mask lower part of hwirq to convert it >> + * in 0, 1, 2 or 3 and then multiply it by 8 (or shift by 3) >> + */ >> + return bit << ((d->hwirq & n) << n); >> +} >> + >> +/* calculate mem offset depending on number of intterupt per register */ >> +static void __iomem *icoll_intr_reg(struct irq_data *d) >> +{ >> + int n = icoll_priv.intr_per_reg >> 1; >> + >> + /* offset = hwirq / intr_per_reg * 0x10 */ >> + return icoll_priv.intr + ((d->hwirq >> n) * 0x10); >> +} >> >> static void icoll_ack_irq(struct irq_data *d) >> { >> @@ -77,14 +107,21 @@ static void icoll_ack_irq(struct irq_data *d) >> >> static void icoll_mask_irq(struct irq_data *d) >> { >> - __raw_writel(BM_ICOLL_INTR_ENABLE, >> - icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); >> + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), >> + icoll_intr_reg(d) + CLR_REG); >> } >> >> static void icoll_unmask_irq(struct irq_data *d) >> { >> - __raw_writel(BM_ICOLL_INTR_ENABLE, >> - icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); >> + raw_spin_lock(&icoll_lock); >> + if (icoll_priv.clear) >> + __raw_writel(ASM9260_BM_CLEAR_BIT(d->hwirq), >> + icoll_priv.clear + >> + ASM9260_HW_ICOLL_CLEARn(d->hwirq)); >> + >> + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), >> + icoll_intr_reg(d) + SET_REG); >> + raw_spin_unlock(&icoll_lock); >> } >> >> static struct irq_chip mxs_icoll_chip = { >> @@ -116,12 +153,34 @@ static struct irq_domain_ops icoll_irq_domain_ops = { >> .xlate = irq_domain_xlate_onecell, >> }; >> >> +static void __init icoll_add_domain(struct device_node *np, >> + int num) >> +{ >> + icoll_domain = irq_domain_add_linear(np, num, >> + &icoll_irq_domain_ops, NULL); >> + >> + if (!icoll_domain) >> + panic("%s: unable add irq domain", np->full_name); >> + irq_set_default_host(icoll_domain); >> + set_handle_irq(icoll_handle_irq); >> +} >> + >> +static void __iomem * __init icoll_init_iobase(struct device_node *np) >> +{ >> + void __iomem *icoll_base; >> + >> + icoll_base = of_io_request_and_map(np, 0, np->name); > > LD kernel/built-in.o > ../drivers/irqchip/irq-mxs.c: In function ?icoll_init_iobase?: > ../drivers/irqchip/irq-mxs.c:172:2: warning: passing argument 3 of ?of_io_request_and_map? discards ?const? qualifier from pointer target type [enabled by default] > In file included from ../drivers/irqchip/irq-mxs.c:27:0: > ../include/linux/of_address.h:108:15: note: expected ?char *? but argument is of type ?const char *? I reported this issue. It should be fixed in of_io_request_and_map. >> + if (!icoll_base) >> + panic("%s: unable to map resource", np->full_name); >> + return icoll_base; >> +} >> + >> static int __init icoll_of_init(struct device_node *np, >> struct device_node *interrupt_parent) >> { >> - void __iomem *icoll_base = of_iomap(np, 0); >> - WARN_ON(!icoll_base); >> + void __iomem *icoll_base; >> >> + icoll_base = icoll_init_iobase(np); >> icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; >> icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; >> icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; >> @@ -136,8 +195,38 @@ static int __init icoll_of_init(struct device_node *np, >> */ >> stmp_reset_block(icoll_priv.ctrl); >> >> - icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, >> - &icoll_irq_domain_ops, NULL); >> + icoll_add_domain(np, ICOLL_NUM_IRQS); >> + >> return icoll_domain ? 0 : -ENODEV; >> } >> IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); >> + >> +static int __init asm9260_of_init(struct device_node *np, >> + struct device_node *interrupt_parent) >> +{ >> + void __iomem *icoll_base; >> + int i; >> + >> + icoll_base = icoll_init_iobase(np); >> + icoll_priv.vector = icoll_base + ASM9260_HW_ICOLL_VECTOR; >> + icoll_priv.levelack = icoll_base + ASM9260_HW_ICOLL_LEVELACK; >> + icoll_priv.ctrl = icoll_base + ASM9260_HW_ICOLL_CTRL; >> + icoll_priv.stat = icoll_base + ASM9260_HW_ICOLL_STAT_OFFSET; >> + icoll_priv.intr = icoll_base + ASM9260_HW_ICOLL_INTERRUPT0; >> + icoll_priv.intr_per_reg = 4; >> + icoll_priv.clear = icoll_base + ASM9260_HW_ICOLL_CLEAR0; >> + >> + writel_relaxed(ASM9260_BM_CTRL_IRQ_ENABLE, >> + icoll_priv.ctrl); >> + /* >> + * ASM9260 don't provide reset bit. So, we need to set level 0 >> + * manually. >> + */ >> + for (i = 0; i < 16 * 0x10; i += 0x10) >> + writel(0, icoll_priv.intr + i); >> + >> + icoll_add_domain(np, ASM9260_NUM_IRQS); >> + >> + return icoll_domain ? 0 : -ENODEV; >> +} >> +IRQCHIP_DECLARE(asm9260, "alphascale,asm9260-icoll", asm9260_of_init); >> -- >> 1.9.1 >> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel at lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141104/2b00bbe1/attachment-0001.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-04 13:03 ` Shawn Guo 2014-11-04 13:13 ` Russell King - ARM Linux 2014-11-04 13:16 ` Oleksij Rempel @ 2014-11-04 19:12 ` Oleksij Rempel 2014-11-04 20:20 ` Thomas Gleixner 2 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-04 19:12 UTC (permalink / raw) To: linux-arm-kernel Freescale iMX23/iMX28 and Alphascale ASM9260 have similar interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. Differences between this devices are fallowing: - different register offsets - different count of intterupt lines per register - ASM9260 don't provide reset bit - ASM9260 don't support FIQ. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Conflicts: drivers/irqchip/Kconfig --- drivers/irqchip/Kconfig | 5 ++ drivers/irqchip/Makefile | 2 +- drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++++++++++ drivers/irqchip/irq-mxs.c | 105 ++++++++++++++++++++++++--- 4 files changed, 212 insertions(+), 9 deletions(-) create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index b21f12f..badc2dc 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -125,3 +125,8 @@ config KEYSTONE_IRQ help Support for Texas Instruments Keystone 2 IRQ controller IP which is part of the Keystone 2 IPC mechanism + +config IRQ_MXS + def_bool y if MACH_ASM9260 || ARCH_MXS + select IRQ_DOMAIN + select STMP_DEVICE diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 173bb5f..fd06d5e 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -5,7 +5,7 @@ obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o obj-$(CONFIG_ARCH_MMP) += irq-mmp.o obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o -obj-$(CONFIG_ARCH_MXS) += irq-mxs.o +obj-$(CONFIG_IRQ_MXS) += irq-mxs.o obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o obj-$(CONFIG_METAG) += irq-metag-ext.o diff --git a/drivers/irqchip/alphascale_asm9260-icoll.h b/drivers/irqchip/alphascale_asm9260-icoll.h new file mode 100644 index 0000000..5cec108 --- /dev/null +++ b/drivers/irqchip/alphascale_asm9260-icoll.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef _ALPHASCALE_ASM9260_ICOLL_H +#define _ALPHASCALE_ASM9260_ICOLL_H + +#define ASM9260_NUM_IRQS 64 +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ + +#define ASM9260_HW_ICOLL_VECTOR 0x0000 +/* + * bits 31:2 + * This register presents the vector address for the interrupt currently + * active on the CPU IRQ input. Writing to this register notifies the + * interrupt collector that the interrupt service routine for the current + * interrupt has been entered. + * The exception trap should have a LDPC instruction from this address: + * LDPC ASM9260_HW_ICOLL_VECTOR_ADDR; IRQ exception at 0xffff0018 + */ + +/* + * The Interrupt Collector Level Acknowledge Register is used by software to + * indicate the completion of an interrupt on a specific level. + * This register is written at the very end of an interrupt service routine. If + * nesting is used then the CPU irq must be turned on before writing to this + * register to avoid a race condition in the CPU interrupt hardware. + */ +#define ASM9260_HW_ICOLL_LEVELACK 0x0010 +#define ASM9260_BM_LEVELn(nr) BIT(nr) + +#define ASM9260_HW_ICOLL_CTRL 0x0020 +/* + * ASM9260_BM_CTRL_SFTRST and ASM9260_BM_CTRL_CLKGATE are not available on + * asm9260. + */ +#define ASM9260_BM_CTRL_SFTRST BIT(31) +#define ASM9260_BM_CTRL_CLKGATE BIT(30) +/* disable interrupt level nesting */ +#define ASM9260_BM_CTRL_NO_NESTING BIT(19) +/* + * Set this bit to one enable the RISC32-style read side effect associated with + * the vector address register. In this mode, interrupt in-service is signaled + * by the read of the ASM9260_HW_ICOLL_VECTOR register to acquire the interrupt + * vector address. Set this bit to zero for normal operation, in which the ISR + * signals in-service explicitly by means of a write to the + * ASM9260_HW_ICOLL_VECTOR register. + * 0 - Must Write to Vector register to go in-service. + * 1 - Go in-service as a read side effect + */ +#define ASM9260_BM_CTRL_ARM_RSE_MODE BIT(18) +#define ASM9260_BM_CTRL_IRQ_ENABLE BIT(16) + +#define ASM9260_HW_ICOLL_STAT_OFFSET 0x0030 +/* + * bits 5:0 + * Vector number of current interrupt. Multiply by 4 and add to vector base + * address to obtain the value in ASM9260_HW_ICOLL_VECTOR. + */ + +/* + * RAW0 and RAW1 provides a read-only view of the raw interrupt request lines + * coming from various parts of the chip. Its purpose is to improve diagnostic + * observability. + */ +#define ASM9260_HW_ICOLL_RAW0 0x0040 +#define ASM9260_HW_ICOLL_RAW1 0x0050 + +#define ASM9260_HW_ICOLL_INTERRUPT0 0x0060 +#define ASM9260_HW_ICOLL_INTERRUPTn(n) (0x0060 + ((n) >> 2) * 0x10) +/* + * WARNING: Modifying the priority of an enabled interrupt may result in + * undefined behavior. + */ +#define ASM9260_BM_INT_PRIORITY_MASK 0x3 +#define ASM9260_BM_INT_ENABLE BIT(2) +#define ASM9260_BM_INT_SOFTIRQ BIT(3) + +#define ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n) (((n) & 0x3) << 3) +#define ASM9260_BM_ICOLL_INTERRUPTn_ENABLE(n) (1 << (2 + \ + ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n))) + +#define ASM9260_HW_ICOLL_VBASE 0x0160 +/* + * bits 31:2 + * This bitfield holds the upper 30 bits of the base address of the vector + * table. + */ + +#define ASM9260_HW_ICOLL_CLEAR0 0x01d0 +#define ASM9260_HW_ICOLL_CLEAR1 0x01e0 +#define ASM9260_HW_ICOLL_CLEARn(n) (((n >> 5) * 0x10) \ + + SET_REG) +#define ASM9260_BM_CLEAR_BIT(n) BIT(n & 0x1f) + +/* Scratchpad */ +#define ASM9260_HW_ICOLL_UNDEF_VECTOR 0x01f0 +#endif diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c index 681125d..8c5c3d2 100644 --- a/drivers/irqchip/irq-mxs.c +++ b/drivers/irqchip/irq-mxs.c @@ -1,5 +1,7 @@ /* * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * Add Alphascale ASM9260 support. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +30,7 @@ #include <asm/exception.h> #include "irqchip.h" +#include "alphascale_asm9260-icoll.h" /* * this device provide 4 offsets for each register: @@ -63,6 +66,33 @@ struct icoll_priv { static struct icoll_priv icoll_priv; static struct irq_domain *icoll_domain; +static DEFINE_RAW_SPINLOCK(icoll_lock); + +/* calculate bit offset depending on number of intterupt per register */ +static u32 icoll_intr_bitshift(struct irq_data *d, u32 bit) +{ + /* + * We expect intr_per_reg to be 4 or 1, it means + * "n" will be 3 or 0. + */ + int n = icoll_priv.intr_per_reg - 1; + + /* + * If n = 0, "bit" is never shifted. + * If n = 3, mask lower part of hwirq to convert it + * in 0, 1, 2 or 3 and then multiply it by 8 (or shift by 3) + */ + return bit << ((d->hwirq & n) << n); +} + +/* calculate mem offset depending on number of intterupt per register */ +static void __iomem *icoll_intr_reg(struct irq_data *d) +{ + int n = icoll_priv.intr_per_reg >> 1; + + /* offset = hwirq / intr_per_reg * 0x10 */ + return icoll_priv.intr + ((d->hwirq >> n) * 0x10); +} static void icoll_ack_irq(struct irq_data *d) { @@ -77,14 +107,21 @@ static void icoll_ack_irq(struct irq_data *d) static void icoll_mask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTR_ENABLE, - icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), + icoll_intr_reg(d) + CLR_REG); } static void icoll_unmask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTR_ENABLE, - icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); + raw_spin_lock(&icoll_lock); + if (icoll_priv.clear) + __raw_writel(ASM9260_BM_CLEAR_BIT(d->hwirq), + icoll_priv.clear + + ASM9260_HW_ICOLL_CLEARn(d->hwirq)); + + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), + icoll_intr_reg(d) + SET_REG); + raw_spin_unlock(&icoll_lock); } static struct irq_chip mxs_icoll_chip = { @@ -116,12 +153,34 @@ static struct irq_domain_ops icoll_irq_domain_ops = { .xlate = irq_domain_xlate_onecell, }; +static void __init icoll_add_domain(struct device_node *np, + int num) +{ + icoll_domain = irq_domain_add_linear(np, num, + &icoll_irq_domain_ops, NULL); + + if (!icoll_domain) + panic("%s: unable add irq domain", np->full_name); + irq_set_default_host(icoll_domain); + set_handle_irq(icoll_handle_irq); +} + +static void __iomem * __init icoll_init_iobase(struct device_node *np) +{ + void __iomem *icoll_base; + + icoll_base = of_io_request_and_map(np, 0, np->name); + if (!icoll_base) + panic("%s: unable to map resource", np->full_name); + return icoll_base; +} + static int __init icoll_of_init(struct device_node *np, struct device_node *interrupt_parent) { - void __iomem *icoll_base = of_iomap(np, 0); - WARN_ON(!icoll_base); + void __iomem *icoll_base; + icoll_base = icoll_init_iobase(np); icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; @@ -136,8 +195,38 @@ static int __init icoll_of_init(struct device_node *np, */ stmp_reset_block(icoll_priv.ctrl); - icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, - &icoll_irq_domain_ops, NULL); + icoll_add_domain(np, ICOLL_NUM_IRQS); + return icoll_domain ? 0 : -ENODEV; } IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); + +static int __init asm9260_of_init(struct device_node *np, + struct device_node *interrupt_parent) +{ + void __iomem *icoll_base; + int i; + + icoll_base = icoll_init_iobase(np); + icoll_priv.vector = icoll_base + ASM9260_HW_ICOLL_VECTOR; + icoll_priv.levelack = icoll_base + ASM9260_HW_ICOLL_LEVELACK; + icoll_priv.ctrl = icoll_base + ASM9260_HW_ICOLL_CTRL; + icoll_priv.stat = icoll_base + ASM9260_HW_ICOLL_STAT_OFFSET; + icoll_priv.intr = icoll_base + ASM9260_HW_ICOLL_INTERRUPT0; + icoll_priv.intr_per_reg = 4; + icoll_priv.clear = icoll_base + ASM9260_HW_ICOLL_CLEAR0; + + writel_relaxed(ASM9260_BM_CTRL_IRQ_ENABLE, + icoll_priv.ctrl); + /* + * ASM9260 don't provide reset bit. So, we need to set level 0 + * manually. + */ + for (i = 0; i < 16 * 0x10; i += 0x10) + writel(0, icoll_priv.intr + i); + + icoll_add_domain(np, ASM9260_NUM_IRQS); + + return icoll_domain ? 0 : -ENODEV; +} +IRQCHIP_DECLARE(asm9260, "alphascale,asm9260-icoll", asm9260_of_init); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v2] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-04 19:12 ` [PATCH v2] " Oleksij Rempel @ 2014-11-04 20:20 ` Thomas Gleixner 2014-11-04 20:27 ` Oleksij Rempel 0 siblings, 1 reply; 81+ messages in thread From: Thomas Gleixner @ 2014-11-04 20:20 UTC (permalink / raw) To: linux-arm-kernel On Tue, 4 Nov 2014, Oleksij Rempel wrote: > Freescale iMX23/iMX28 and Alphascale ASM9260 have similar > interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. > Differences between this devices are fallowing: > - different register offsets > - different count of intterupt lines per register > - ASM9260 don't provide reset bit > - ASM9260 don't support FIQ. Why is this a monolithic patch again. IIRC it was split into a prepatory (imx) and alphascale part earlier. But my memory might trick me. Thanks, tglx ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-04 20:20 ` Thomas Gleixner @ 2014-11-04 20:27 ` Oleksij Rempel 2014-11-04 21:13 ` Thomas Gleixner 0 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-04 20:27 UTC (permalink / raw) To: linux-arm-kernel Am 04.11.2014 um 21:20 schrieb Thomas Gleixner: > On Tue, 4 Nov 2014, Oleksij Rempel wrote: > >> Freescale iMX23/iMX28 and Alphascale ASM9260 have similar >> interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. >> Differences between this devices are fallowing: >> - different register offsets >> - different count of intterupt lines per register >> - ASM9260 don't provide reset bit >> - ASM9260 don't support FIQ. > > Why is this a monolithic patch again. IIRC it was split into a > prepatory (imx) and alphascale part earlier. But my memory might trick > me. It is not monolithic. first patch is "[PATCH v8 4/9] ARM: irqchip: mxs: prepare driver for HW with different offsets". I don't really wont do discus this irq patches now. Please keep attention on first two, /arch/arm/ patches. -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141104/3bc513c1/attachment-0001.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-04 20:27 ` Oleksij Rempel @ 2014-11-04 21:13 ` Thomas Gleixner 0 siblings, 0 replies; 81+ messages in thread From: Thomas Gleixner @ 2014-11-04 21:13 UTC (permalink / raw) To: linux-arm-kernel On Tue, 4 Nov 2014, Oleksij Rempel wrote: > Am 04.11.2014 um 21:20 schrieb Thomas Gleixner: > > On Tue, 4 Nov 2014, Oleksij Rempel wrote: > > > >> Freescale iMX23/iMX28 and Alphascale ASM9260 have similar > >> interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. > >> Differences between this devices are fallowing: > >> - different register offsets > >> - different count of intterupt lines per register > >> - ASM9260 don't provide reset bit > >> - ASM9260 don't support FIQ. > > > > Why is this a monolithic patch again. IIRC it was split into a > > prepatory (imx) and alphascale part earlier. But my memory might trick > > me. > > It is not monolithic. first patch is "[PATCH v8 4/9] ARM: irqchip: mxs: > prepare driver for HW with different offsets". So you sent that very patch out of context and then you wonder why I stumble over that? > I don't really wont do discus this irq patches now. Please keep > attention on first two, /arch/arm/ patches. Then do not send them in the first place. I'm not involved in your arch/arm patches, but I care about the stuff which is supposed to hit the part of the tree which I maintain. Please keep your attention on sending stuff in the right order to the right people at the right time. Thanks, tglx ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 6/9] ARM: clocksource: add asm9260_timer driver 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel ` (4 preceding siblings ...) 2014-10-21 10:40 ` [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 7/9] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel ` (3 subsequent siblings) 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel In some cases asm9260 looks similar to iMX2x. One of exceptions is timer controller. So this patch introduces new driver for this special case. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/clocksource/Kconfig | 9 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 ++++++++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/clocksource/asm9260_timer.c diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index cfd6519..50e248c 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -216,4 +216,13 @@ config CLKSRC_VERSATILE ARM Versatile, RealView and Versatile Express reference platforms. +config ASM9260_TIMER + bool "Alphascale ASM9260 timer driver" + select CLKSRC_MMIO + select CLKSRC_OF + default y if MACH_ASM9260 + help + This enables build of a clocksource and clockevent driver for + the 32-bit System Timer hardware available on a Alphascale ASM9260. + endmenu diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 7fd9fd1..fc93854 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -44,3 +44,4 @@ obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o +obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c new file mode 100644 index 0000000..2c9c993 --- /dev/null +++ b/drivers/clocksource/asm9260_timer.c @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/sched.h> +#include <linux/clk.h> +#include <linux/clocksource.h> +#include <linux/clockchips.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/bitops.h> + +#define DRIVER_NAME "asm9260-timer" + +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ +#define SET_REG 4 +#define CLR_REG 8 + +#define HW_IR 0x0000 /* RW. Interrupt */ +#define BM_IR_CR0 BIT(4) +#define BM_IR_MR3 BIT(3) +#define BM_IR_MR2 BIT(2) +#define BM_IR_MR1 BIT(1) +#define BM_IR_MR0 BIT(0) + +#define HW_TCR 0x0010 /* RW. Timer controller */ +/* BM_C*_RST + * Timer Counter and the Prescale Counter are synchronously reset on the + * next positive edge of PCLK. The counters remain reset until TCR[1] is + * returned to zero. */ +#define BM_C3_RST BIT(7) +#define BM_C2_RST BIT(6) +#define BM_C1_RST BIT(5) +#define BM_C0_RST BIT(4) +/* BM_C*_EN + * 1 - Timer Counter and Prescale Counter are enabled for counting + * 0 - counters are disabled */ +#define BM_C3_EN BIT(3) +#define BM_C2_EN BIT(2) +#define BM_C1_EN BIT(1) +#define BM_C0_EN BIT(0) + +#define HW_DIR 0x0020 /* RW. Direction? */ +/* 00 - count up + * 01 - count down + * 10 - ?? 2^n/2 */ +#define BM_DIR_COUNT_UP 0 +#define BM_DIR_COUNT_DOWN 1 +#define BM_DIR0_SHIFT 0 +#define BM_DIR1_SHIFT 4 +#define BM_DIR2_SHIFT 8 +#define BM_DIR3_SHIFT 12 +#define BM_DIR_DEFAULT (BM_DIR_COUNT_UP << BM_DIR0_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR1_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR2_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR3_SHIFT) + +#define HW_TC0 0x0030 /* RO. Timer counter 0 */ +/* HW_TC*. Timer counter owerflow (0xffff.ffff to 0x0000.0000) do not generate + * interrupt. This registers can be used to detect overflow */ +#define HW_TC1 0x0040 +#define HW_TC2 0x0050 +#define HW_TC3 0x0060 + +#define HW_PR 0x0070 /* RW. prescaler */ +#define BM_PR_DISABLE 0 +#define HW_PC 0x0080 /* RO. Prescaler counter */ +#define HW_MCR 0x0090 /* RW. Match control */ +/* enable interrupt on match */ +#define BM_MCR_INT_EN(n) (1 << (n * 3 + 0)) +/* enable TC reset on match */ +#define BM_MCR_RES_EN(n) (1 << (n * 3 + 1)) +/* enable stop TC on match */ +#define BM_MCR_STOP_EN(n) (1 << (n * 3 + 2)) + +#define HW_MR0 0x00a0 /* RW. Match reg */ +#define HW_MR1 0x00b0 +#define HW_MR2 0x00C0 +#define HW_MR3 0x00D0 + +#define HW_CTCR 0x0180 /* Counter control */ +#define BM_CTCR0_SHIFT 0 +#define BM_CTCR1_SHIFT 2 +#define BM_CTCR2_SHIFT 4 +#define BM_CTCR3_SHIFT 6 +#define BM_CTCR_TM 0 /* Timer mode. Every rising PCLK edge. */ +#define BM_CTCR_DEFAULT (BM_CTCR_TM << BM_CTCR0_SHIFT | \ + BM_CTCR_TM << BM_CTCR1_SHIFT | \ + BM_CTCR_TM << BM_CTCR2_SHIFT | \ + BM_CTCR_TM << BM_CTCR3_SHIFT) + +static struct asm9260_timer_priv { + void __iomem *base; + unsigned long ticks_per_jiffy; +} priv; + +static int asm9260_timer_set_next_event(unsigned long delta, + struct clock_event_device *evt) +{ + /* configure match count for TC0 */ + writel_relaxed(delta, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + return 0; +} + +static void asm9260_timer_set_mode(enum clock_event_mode mode, + struct clock_event_device *evt) +{ + /* stop timer0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); + + switch (mode) { + case CLOCK_EVT_MODE_PERIODIC: + /* disable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + CLR_REG); + /* configure match count for TC0 */ + writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + break; + case CLOCK_EVT_MODE_ONESHOT: + /* enable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + SET_REG); + break; + default: + break; + } +} + +static struct clock_event_device event_dev = { + .name = DRIVER_NAME, + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = asm9260_timer_set_next_event, + .set_mode = asm9260_timer_set_mode, +}; + +static irqreturn_t asm9260_timer_interrupt(int irq, void *dev_id) +{ + struct clock_event_device *evt = dev_id; + + evt->event_handler(evt); + + writel_relaxed(BM_IR_MR0, priv.base + HW_IR); + + return IRQ_HANDLED; +} + +/* + * --------------------------------------------------------------------------- + * Timer initialization + * --------------------------------------------------------------------------- + */ +static void __init asm9260_timer_init(struct device_node *np) +{ + int irq; + struct clk *clk; + int ret; + unsigned long rate; + + priv.base = of_io_request_and_map(np, 0, np->name); + if (!priv.base) + panic("%s: unable to map resource", np->name); + + clk = of_clk_get(np, 0); + + ret = clk_prepare_enable(clk); + if (ret) + panic("Failed to enable clk!\n"); + + irq = irq_of_parse_and_map(np, 0); + ret = request_irq(irq, asm9260_timer_interrupt, IRQF_TIMER, + DRIVER_NAME, &event_dev); + if (ret) + panic("Failed to setup irq!\n"); + + /* set all timers for count-up */ + writel_relaxed(BM_DIR_DEFAULT, priv.base + HW_DIR); + /* disable divider */ + writel_relaxed(BM_PR_DISABLE, priv.base + HW_PR); + /* make sure all timers use every rising PCLK edge. */ + writel_relaxed(BM_CTCR_DEFAULT, priv.base + HW_CTCR); + /* enable interrupt for TC0 and clean setting for all other lines */ + writel_relaxed(BM_MCR_INT_EN(0) , priv.base + HW_MCR); + + rate = clk_get_rate(clk); + clocksource_mmio_init(priv.base + HW_TC1, DRIVER_NAME, rate, + 200, 32, clocksource_mmio_readl_up); + + /* Seems like we can't use counter without match register even if + * actions for MR are disabled. So, set MR to max value. */ + writel_relaxed(0xffffffff, priv.base + HW_MR1); + /* enable TC1 */ + writel_relaxed(BM_C1_EN, priv.base + HW_TCR + SET_REG); + + priv.ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ); + event_dev.cpumask = cpumask_of(0); + clockevents_config_and_register(&event_dev, rate, 0x2c00, 0xfffffffe); +} +CLOCKSOURCE_OF_DECLARE(asm9260_timer, "alphascale,asm9260-timer", + asm9260_timer_init); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 7/9] ARM: dts: add DT for Alphascale ASM9260 SoC 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel ` (5 preceding siblings ...) 2014-10-21 10:40 ` [PATCH v8 6/9] ARM: clocksource: add asm9260_timer driver Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 8/9] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel ` (2 subsequent siblings) 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel for now it is wary basic SoC description with most important IPs needed to make this device work Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 +++++ arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 +++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index b8c5cd3..8943d72 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -492,6 +492,8 @@ dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \ dove-d3plug.dtb \ dove-dove-db.dtb +dtb-$(CONFIG_MACH_ASM9260) += alphascale-asm9260-devkit.dtb + targets += dtbs dtbs_install targets += $(dtb-y) endif diff --git a/arch/arm/boot/dts/alphascale-asm9260-devkit.dts b/arch/arm/boot/dts/alphascale-asm9260-devkit.dts new file mode 100644 index 0000000..c77e2c9 --- /dev/null +++ b/arch/arm/boot/dts/alphascale-asm9260-devkit.dts @@ -0,0 +1,13 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * Licensed under the X11 license or the GPL v2 (or later) + */ + +/dts-v1/; +#include "alphascale-asm9260.dtsi" + +/ { + model = "Alphascale asm9260 Development Kit"; + compatible = "alphascale,asm9260devkit", "alphascale,asm9260"; +}; diff --git a/arch/arm/boot/dts/alphascale-asm9260.dtsi b/arch/arm/boot/dts/alphascale-asm9260.dtsi new file mode 100644 index 0000000..907fc7b --- /dev/null +++ b/arch/arm/boot/dts/alphascale-asm9260.dtsi @@ -0,0 +1,63 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * Licensed under the X11 license or the GPL v2 (or later) + */ + +#include "skeleton.dtsi" +#include <dt-bindings/clock/alphascale,asm9260.h> + +/ { + interrupt-parent = <&icoll>; + + memory { + device_type = "memory"; + reg = <0x20000000 0x2000000>; + }; + + cpus { + #address-cells = <0>; + #size-cells = <0>; + + cpu { + compatible = "arm,arm926ej-s"; + device_type = "cpu"; + clocks = <&acc CLKID_SYS_CPU>; + }; + }; + + osc24m: oscillator { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-accuracy = <30000>; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges; + + acc: clock-controller at 80040000 { + compatible = "alphascale,asm9260-clock-controller"; + #clock-cells = <1>; + clocks = <&osc24m>; + reg = <0x80040000 0x204>; + }; + + icoll: interrupt-controller at 80054000 { + compatible = "alphascale,asm9260-icoll"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x80054000 0x200>; + }; + + timer0: timer at 80088000 { + compatible = "alphascale,asm9260-timer"; + reg = <0x80088000 0x4000>; + clocks = <&acc CLKID_AHB_TIMER0>; + interrupts = <29>; + }; + }; +}; -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 8/9] ARM: add alphascale,acc.txt bindings documentation 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel ` (6 preceding siblings ...) 2014-10-21 10:40 ` [PATCH v8 7/9] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 9/9] add Alphascale to vendor-prefixes.txt Oleksij Rempel 2014-10-26 14:39 ` [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel ACC is for AlphaScale Clock Controller. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt diff --git a/Documentation/devicetree/bindings/clock/alphascale,acc.txt b/Documentation/devicetree/bindings/clock/alphascale,acc.txt new file mode 100644 index 0000000..62e67e8 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/alphascale,acc.txt @@ -0,0 +1,115 @@ +Alphascale Clock Controller + +The ACC (Alphascale Clock Controller) is responsible of choising proper +clock source, setting deviders and clock gates. + +Required properties for the ACC node: + - compatible: must be "alphascale,asm9260-clock-controller" + - reg: must contain the ACC register base and size + - #clock-cells : shall be set to 1. + +Simple one-cell clock specifier format is used, where the only cell is used +as an index of the clock inside the provider. +It is encouraged to use dt-binding for clock index definitions. SoC specific +dt-binding should be included to the device tree descriptor. For example +Alphascale ASM9260: +#include <dt-bindings/clock/alphascale,asm9260.h> + +This binding contains two types of clock providers: + _AHB_ - AHB gate; + _SYS_ - adjustable clock source. Not all peripheral have _SYS_ clock provider. +All clock specific details can be found in the SoC documentation. +CLKID_AHB_ROM 0 +CLKID_AHB_RAM 1 +CLKID_AHB_GPIO 2 +CLKID_AHB_MAC 3 +CLKID_AHB_EMI 4 +CLKID_AHB_USB0 5 +CLKID_AHB_USB1 6 +CLKID_AHB_DMA0 7 +CLKID_AHB_DMA1 8 +CLKID_AHB_UART0 9 +CLKID_AHB_UART1 10 +CLKID_AHB_UART2 11 +CLKID_AHB_UART3 12 +CLKID_AHB_UART4 13 +CLKID_AHB_UART5 14 +CLKID_AHB_UART6 15 +CLKID_AHB_UART7 16 +CLKID_AHB_UART8 17 +CLKID_AHB_UART9 18 +CLKID_AHB_I2S0 19 +CLKID_AHB_I2C0 20 +CLKID_AHB_I2C1 21 +CLKID_AHB_SSP0 22 +CLKID_AHB_IOCONFIG 23 +CLKID_AHB_WDT 24 +CLKID_AHB_CAN0 25 +CLKID_AHB_CAN1 26 +CLKID_AHB_MPWM 27 +CLKID_AHB_SPI0 28 +CLKID_AHB_SPI1 29 +CLKID_AHB_QEI 30 +CLKID_AHB_QUADSPI0 31 +CLKID_AHB_CAMIF 32 +CLKID_AHB_LCDIF 33 +CLKID_AHB_TIMER0 34 +CLKID_AHB_TIMER1 35 +CLKID_AHB_TIMER2 36 +CLKID_AHB_TIMER3 37 +CLKID_AHB_IRQ 38 +CLKID_AHB_RTC 39 +CLKID_AHB_NAND 40 +CLKID_AHB_ADC0 41 +CLKID_AHB_LED 42 +CLKID_AHB_DAC0 43 +CLKID_AHB_LCD 44 +CLKID_AHB_I2S1 45 +CLKID_AHB_MAC1 46 + +CLKID_SYS_CPU 47 +CLKID_SYS_AHB 48 +CLKID_SYS_I2S0M 49 +CLKID_SYS_I2S0S 50 +CLKID_SYS_I2S1M 51 +CLKID_SYS_I2S1S 52 +CLKID_SYS_UART0 53 +CLKID_SYS_UART1 54 +CLKID_SYS_UART2 55 +CLKID_SYS_UART3 56 +CLKID_SYS_UART4 56 +CLKID_SYS_UART5 57 +CLKID_SYS_UART6 58 +CLKID_SYS_UART7 59 +CLKID_SYS_UART8 60 +CLKID_SYS_UART9 61 +CLKID_SYS_SPI0 62 +CLKID_SYS_SPI1 63 +CLKID_SYS_QUADSPI 64 +CLKID_SYS_SSP0 65 +CLKID_SYS_NAND 66 +CLKID_SYS_TRACE 67 +CLKID_SYS_CAMM 68 +CLKID_SYS_WDT 69 +CLKID_SYS_CLKOUT 70 +CLKID_SYS_MAC 71 +CLKID_SYS_LCD 72 +CLKID_SYS_ADCANA 73 + +Example of clock consumer with _SYS_ and _AHB_ sinks. +uart4: serial at 80010000 { + compatible = "alphascale,asm9260-uart"; + reg = <0x80010000 0x4000>; + clocks = <&acc CLKID_SYS_UART4>, <&acc CLKID_AHB_UART4>; + interrupts = <19>; + status = "disabled"; +}; + +Clock consumer with only one, _AHB_ sink. +timer0: timer at 80088000 { + compatible = "alphascale,asm9260-timer"; + reg = <0x80088000 0x4000>; + clocks = <&acc CLKID_AHB_TIMER0>; + interrupts = <29>; +}; + -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 9/9] add Alphascale to vendor-prefixes.txt 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel ` (7 preceding siblings ...) 2014-10-21 10:40 ` [PATCH v8 8/9] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel @ 2014-10-21 10:40 ` Oleksij Rempel 2014-10-26 14:39 ` [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel 9 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-21 10:40 UTC (permalink / raw) To: linux-arm-kernel this company already provided some products, so it make sense to add them to vendor-prefixes.txt list Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Acked-by: Rob Herring <robh@kernel.org> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index ac7269f..23c862f 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -11,6 +11,7 @@ adi Analog Devices, Inc. aeroflexgaisler Aeroflex Gaisler AB ak Asahi Kasei Corp. allwinner Allwinner Technology Co., Ltd. +alphascale AlphaScale Integrated Circuits Systems, Inc. altr Altera Corp. amcc Applied Micro Circuits Corporation (APM, formally AMCC) amd Advanced Micro Devices (AMD), Inc. -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v8 0/9] initial suport for Alphascale ASM9260 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel ` (8 preceding siblings ...) 2014-10-21 10:40 ` [PATCH v8 9/9] add Alphascale to vendor-prefixes.txt Oleksij Rempel @ 2014-10-26 14:39 ` Oleksij Rempel 2014-10-26 15:26 ` Thomas Gleixner 2014-11-02 2:11 ` Jason Cooper 9 siblings, 2 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-10-26 14:39 UTC (permalink / raw) To: linux-arm-kernel Will it be better to split this patch set? For example: part 1 > ARM: add mach-asm9260 > ARM: add lolevel debug support for asm9260 part2 > ARM: irqchip: mxs: prepare driver for HW with different offsets > ARM: irqchip: mxs: add Alpascale ASM9260 support and all other patches separately. this will reduce review time for you and give some hope for me :D Am 21.10.2014 um 12:40 schrieb Oleksij Rempel: > This patchset provide initial support for Alpascale ASM9260, > ARM based SoC. > Changes since laste version: > - make sure all driver use of_io_request_and_map > - check alignment in Kconfig or Makefile where possible > - remove UART driver from this patchset to make review easier. > > Oleksij Rempel (9): > ARM: add mach-asm9260 > ARM: add lolevel debug support for asm9260 > ARM: clk: add clk-asm9260 driver > ARM: irqchip: mxs: prepare driver for HW with different offsets > ARM: irqchip: mxs: add Alpascale ASM9260 support > ARM: clocksource: add asm9260_timer driver > ARM: dts: add DT for Alphascale ASM9260 SoC > ARM: add alphascale,acc.txt bindings documentation > add Alphascale to vendor-prefixes.txt > > .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++ > .../devicetree/bindings/vendor-prefixes.txt | 1 + > arch/arm/Kconfig | 2 + > arch/arm/Kconfig.debug | 33 +- > arch/arm/boot/dts/Makefile | 2 + > arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 + > arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 ++++ > arch/arm/include/debug/asm9260.S | 31 ++ > arch/arm/mach-asm9260/Kconfig | 6 + > drivers/clk/Makefile | 1 + > drivers/clk/clk-asm9260.c | 345 +++++++++++++++++++++ > drivers/clocksource/Kconfig | 9 + > drivers/clocksource/Makefile | 1 + > drivers/clocksource/asm9260_timer.c | 220 +++++++++++++ > drivers/irqchip/Kconfig | 9 + > drivers/irqchip/Makefile | 2 +- > drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++ > drivers/irqchip/irq-mxs.c | 150 ++++++++- > include/dt-bindings/clock/alphascale,asm9260.h | 97 ++++++ > 19 files changed, 1189 insertions(+), 20 deletions(-) > create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt > create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts > create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi > create mode 100644 arch/arm/include/debug/asm9260.S > create mode 100644 arch/arm/mach-asm9260/Kconfig > create mode 100644 drivers/clk/clk-asm9260.c > create mode 100644 drivers/clocksource/asm9260_timer.c > create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h > create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h > -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141026/1589e4d3/attachment-0001.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 0/9] initial suport for Alphascale ASM9260 2014-10-26 14:39 ` [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel @ 2014-10-26 15:26 ` Thomas Gleixner 2014-11-02 2:11 ` Jason Cooper 1 sibling, 0 replies; 81+ messages in thread From: Thomas Gleixner @ 2014-10-26 15:26 UTC (permalink / raw) To: linux-arm-kernel On Sun, 26 Oct 2014, Oleksij Rempel wrote: > Will it be better to split this patch set? > > For example: > part 1 > > ARM: add mach-asm9260 > > ARM: add lolevel debug support for asm9260 > part2 > > ARM: irqchip: mxs: prepare driver for HW with different offsets > > ARM: irqchip: mxs: add Alpascale ASM9260 support > and all other patches separately. If the parts are independent from each other there is no reason to have a big combined patch pile. Thanks, tglx ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 0/9] initial suport for Alphascale ASM9260 2014-10-26 14:39 ` [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-10-26 15:26 ` Thomas Gleixner @ 2014-11-02 2:11 ` Jason Cooper 2014-11-02 6:51 ` Oleksij Rempel 1 sibling, 1 reply; 81+ messages in thread From: Jason Cooper @ 2014-11-02 2:11 UTC (permalink / raw) To: linux-arm-kernel On Sun, Oct 26, 2014 at 03:39:02PM +0100, Oleksij Rempel wrote: > Will it be better to split this patch set? > > For example: > part 1 > > ARM: add mach-asm9260 > > ARM: add lolevel debug support for asm9260 > part2 > > ARM: irqchip: mxs: prepare driver for HW with different offsets > > ARM: irqchip: mxs: add Alpascale ASM9260 support > and all other patches separately. > > this will reduce review time for you and give some hope for me :D I honestly prefer to keep the series together. The subject lines make it clear which parts I need to worry about merging. The big thing is if there are compile-time dependencies between the different subsystems. It doesn't look like there are, but if so, just bring it to our attention. thx, Jason. ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 0/9] initial suport for Alphascale ASM9260 2014-11-02 2:11 ` Jason Cooper @ 2014-11-02 6:51 ` Oleksij Rempel 2014-11-02 18:31 ` Jason Cooper 0 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-02 6:51 UTC (permalink / raw) To: linux-arm-kernel Am 02.11.2014 um 03:11 schrieb Jason Cooper: > On Sun, Oct 26, 2014 at 03:39:02PM +0100, Oleksij Rempel wrote: >> Will it be better to split this patch set? >> >> For example: >> part 1 >>> ARM: add mach-asm9260 >>> ARM: add lolevel debug support for asm9260 >> part2 >>> ARM: irqchip: mxs: prepare driver for HW with different offsets >>> ARM: irqchip: mxs: add Alpascale ASM9260 support >> and all other patches separately. >> >> this will reduce review time for you and give some hope for me :D > > I honestly prefer to keep the series together. The subject lines make > it clear which parts I need to worry about merging. The big thing is > if there are compile-time dependencies between the different subsystems. > It doesn't look like there are, but if so, just bring it to our > attention. Ok, i'll resend updated version against latest arm-soc/for-next.git, or should i take other branch? -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141102/59825532/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 0/9] initial suport for Alphascale ASM9260 2014-11-02 6:51 ` Oleksij Rempel @ 2014-11-02 18:31 ` Jason Cooper 2014-11-02 19:56 ` Oleksij Rempel 0 siblings, 1 reply; 81+ messages in thread From: Jason Cooper @ 2014-11-02 18:31 UTC (permalink / raw) To: linux-arm-kernel On Sun, Nov 02, 2014 at 07:51:42AM +0100, Oleksij Rempel wrote: > Am 02.11.2014 um 03:11 schrieb Jason Cooper: > > On Sun, Oct 26, 2014 at 03:39:02PM +0100, Oleksij Rempel wrote: > >> Will it be better to split this patch set? > >> > >> For example: > >> part 1 > >>> ARM: add mach-asm9260 > >>> ARM: add lolevel debug support for asm9260 > >> part2 > >>> ARM: irqchip: mxs: prepare driver for HW with different offsets > >>> ARM: irqchip: mxs: add Alpascale ASM9260 support > >> and all other patches separately. > >> > >> this will reduce review time for you and give some hope for me :D > > > > I honestly prefer to keep the series together. The subject lines make To be clear, I meant the emails being in the same thread. > > it clear which parts I need to worry about merging. The big thing is > > if there are compile-time dependencies between the different subsystems. > > It doesn't look like there are, but if so, just bring it to our > > attention. > > Ok, i'll resend updated version against latest arm-soc/for-next.git, or > should i take other branch? In general it's best to base against one of Linus' tags (eg v3.18-rc1) and then rebase against something different only if asked. That'll be per subsystem, though. Please don't forget to Cc the mach-mxs/ maintainers on the irqchip changes. thx, Jason. ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 0/9] initial suport for Alphascale ASM9260 2014-11-02 18:31 ` Jason Cooper @ 2014-11-02 19:56 ` Oleksij Rempel 2014-11-02 20:34 ` Jason Cooper 0 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-02 19:56 UTC (permalink / raw) To: linux-arm-kernel Am 02.11.2014 um 19:31 schrieb Jason Cooper: > On Sun, Nov 02, 2014 at 07:51:42AM +0100, Oleksij Rempel wrote: >> Am 02.11.2014 um 03:11 schrieb Jason Cooper: >>> On Sun, Oct 26, 2014 at 03:39:02PM +0100, Oleksij Rempel wrote: >>>> Will it be better to split this patch set? >>>> >>>> For example: >>>> part 1 >>>>> ARM: add mach-asm9260 >>>>> ARM: add lolevel debug support for asm9260 >>>> part2 >>>>> ARM: irqchip: mxs: prepare driver for HW with different offsets >>>>> ARM: irqchip: mxs: add Alpascale ASM9260 support >>>> and all other patches separately. >>>> >>>> this will reduce review time for you and give some hope for me :D >>> >>> I honestly prefer to keep the series together. The subject lines make > > To be clear, I meant the emails being in the same thread. can be split in to parts, but should be within this tread? >>> it clear which parts I need to worry about merging. The big thing is >>> if there are compile-time dependencies between the different subsystems. >>> It doesn't look like there are, but if so, just bring it to our >>> attention. >> >> Ok, i'll resend updated version against latest arm-soc/for-next.git, or >> should i take other branch? > > In general it's best to base against one of Linus' tags (eg v3.18-rc1) > and then rebase against something different only if asked. That'll be > per subsystem, though. just notice, arch/arm related patches are ok on arm-soc/master but fail fail on arm-soc/for-next.git > Please don't forget to Cc the mach-mxs/ maintainers on the irqchip > changes. ok, thx. -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141102/a3d3268d/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v8 0/9] initial suport for Alphascale ASM9260 2014-11-02 19:56 ` Oleksij Rempel @ 2014-11-02 20:34 ` Jason Cooper 2014-11-03 14:14 ` [PATCH v3 0/2] " Oleksij Rempel 0 siblings, 1 reply; 81+ messages in thread From: Jason Cooper @ 2014-11-02 20:34 UTC (permalink / raw) To: linux-arm-kernel On Sun, Nov 02, 2014 at 08:56:46PM +0100, Oleksij Rempel wrote: > Am 02.11.2014 um 19:31 schrieb Jason Cooper: > > On Sun, Nov 02, 2014 at 07:51:42AM +0100, Oleksij Rempel wrote: > >> Am 02.11.2014 um 03:11 schrieb Jason Cooper: > >>> On Sun, Oct 26, 2014 at 03:39:02PM +0100, Oleksij Rempel wrote: > >>>> Will it be better to split this patch set? > >>>> > >>>> For example: > >>>> part 1 > >>>>> ARM: add mach-asm9260 > >>>>> ARM: add lolevel debug support for asm9260 > >>>> part2 > >>>>> ARM: irqchip: mxs: prepare driver for HW with different offsets > >>>>> ARM: irqchip: mxs: add Alpascale ASM9260 support > >>>> and all other patches separately. > >>>> > >>>> this will reduce review time for you and give some hope for me :D > >>> > >>> I honestly prefer to keep the series together. The subject lines make > > > > To be clear, I meant the emails being in the same thread. > > can be split in to parts, but should be within this tread? Sure, no need to over-analyze it. I was just expressing a preference for seeing the big picture. Some maintainers don't care, as long as they are sent the part they are responsible for, and one or two -only- want what they are responsible for. The most important thing, which I mentioned before, is letting us know if the changes in one subsystem have a compile-time dependency on the changes in another subsystem. Then we need to be careful how we merge the patches. > >>> it clear which parts I need to worry about merging. The big thing is > >>> if there are compile-time dependencies between the different subsystems. > >>> It doesn't look like there are, but if so, just bring it to our > >>> attention. > >> > >> Ok, i'll resend updated version against latest arm-soc/for-next.git, or > >> should i take other branch? > > > > In general it's best to base against one of Linus' tags (eg v3.18-rc1) > > and then rebase against something different only if asked. That'll be > > per subsystem, though. > > just notice, arch/arm related patches are ok on arm-soc/master but fail > fail on arm-soc/for-next.git arm-soc/master is still against v3.17-rc3. arm-soc/for-next is against v3.18-rc1. How does this series fare against v3.18-rc1? I've heard it frequently in the past that the goal isn't to remove all conflicts. Maintainers, like arm-soc, prefer to see conflicts because it lets them know where two developers were working on the same code. As a courtesy, we try to let them know of the conflict ahead of time, but that's mainly the job of the sub-arch maintainers. thx, Jason. ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 0/2] initial suport for Alphascale ASM9260 2014-11-02 20:34 ` Jason Cooper @ 2014-11-03 14:14 ` Oleksij Rempel 2014-11-03 14:14 ` [PATCH v3 1/2] ARM: add mach-asm9260 Oleksij Rempel 2014-11-03 14:14 ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel 0 siblings, 2 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-03 14:14 UTC (permalink / raw) To: linux-arm-kernel This is reduced patchset to provide initial support for Alphascale ASM9260. It was rebased against current arm-soc/for-next branch (commit a43109cc14) Oleksij Rempel (2): ARM: add mach-asm9260 ARM: add lolevel debug support for asm9260 arch/arm/Kconfig | 2 ++ arch/arm/Kconfig.debug | 31 ++++++++++++++++++++++++++++--- arch/arm/include/debug/asm9260.S | 31 +++++++++++++++++++++++++++++++ arch/arm/mach-asm9260/Kconfig | 6 ++++++ 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 arch/arm/include/debug/asm9260.S create mode 100644 arch/arm/mach-asm9260/Kconfig -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 1/2] ARM: add mach-asm9260 2014-11-03 14:14 ` [PATCH v3 0/2] " Oleksij Rempel @ 2014-11-03 14:14 ` Oleksij Rempel 2014-11-03 14:14 ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel 1 sibling, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-03 14:14 UTC (permalink / raw) To: linux-arm-kernel it is low cost (?) SoC targeted for market in China and India which trying to compete with AT91SAM9G25. Here is some info: http://www.alphascale.com/index.asp?ics/615.html One of products: http://www.aliexpress.com/store/product/2014-hot-sales-FREE-SHIPPING-new-Purple-core-ARM9-development-board-ASM9260T-SDRAM-power-line/433637_1931495721.html In some cases this SoC looks similar to iMX23/iMX28. But currently it makes no sense to merge mach code of this devices. Especially because most differences are already collected mach-mxs folder. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/Kconfig | 2 ++ arch/arm/mach-asm9260/Kconfig | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 arch/arm/mach-asm9260/Kconfig diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 89c4b5c..fed7eb1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -854,6 +854,8 @@ config ARCH_VIRT # source "arch/arm/mach-mvebu/Kconfig" +source "arch/arm/mach-asm9260/Kconfig" + source "arch/arm/mach-at91/Kconfig" source "arch/arm/mach-axxia/Kconfig" diff --git a/arch/arm/mach-asm9260/Kconfig b/arch/arm/mach-asm9260/Kconfig new file mode 100644 index 0000000..8423be7 --- /dev/null +++ b/arch/arm/mach-asm9260/Kconfig @@ -0,0 +1,6 @@ +config MACH_ASM9260 + bool "Alphascale ASM9260" + depends on ARCH_MULTI_V5 + select CPU_ARM926T + help + Support for Alphascale ASM9260 based platform. -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 2014-11-03 14:14 ` [PATCH v3 0/2] " Oleksij Rempel 2014-11-03 14:14 ` [PATCH v3 1/2] ARM: add mach-asm9260 Oleksij Rempel @ 2014-11-03 14:14 ` Oleksij Rempel 2014-11-03 14:46 ` Rob Herring 1 sibling, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-03 14:14 UTC (permalink / raw) To: linux-arm-kernel Since there is no public documentation, this patch also provide register offsets for different UART units on this SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/Kconfig.debug | 31 ++++++++++++++++++++++++++++--- arch/arm/include/debug/asm9260.S | 31 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 arch/arm/include/debug/asm9260.S diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index d8f6a2e..66c29db 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -93,6 +93,27 @@ choice prompt "Kernel low-level debugging port" depends on DEBUG_LL + config DEBUG_ASM9260_UART + bool "Kernel low-level debugging via asm9260 UART" + depends on MACH_ASM9260 + help + Say Y here if you want the debug print routines to direct + their output to an UART or USART port on asm9260 based + machines. + + DEBUG_UART_PHYS | DEBUG_UART_VIRT + + 0x80000000 | 0xf0000000 | UART0 + 0x80004000 | 0xf0004000 | UART1 + 0x80008000 | 0xf0008000 | UART2 + 0x8000c000 | 0xf000c000 | UART3 + 0x80010000 | 0xf0010000 | UART4 + 0x80014000 | 0xf0014000 | UART5 + 0x80018000 | 0xf0018000 | UART6 + 0x8001c000 | 0xf001c000 | UART7 + 0x80020000 | 0xf0020000 | UART8 + 0x80024000 | 0xf0024000 | UART9 + config AT91_DEBUG_LL_DBGU0 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" depends on HAVE_AT91_DBGU0 @@ -1042,6 +1063,7 @@ config DEBUG_STI_UART config DEBUG_LL_INCLUDE string default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 + default "debug/asm9260.S" if DEBUG_ASM9260_UART default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 default "debug/meson.S" if DEBUG_MESON_UARTAO default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X @@ -1135,6 +1157,7 @@ config DEBUG_UART_PHYS default 0x78000000 if DEBUG_CNS3XXX default 0x7c0003f8 if FOOTBRIDGE default 0x78000000 if DEBUG_CNS3XXX + default 0x80010000 if DEBUG_ASM9260_UART default 0x80070000 if DEBUG_IMX23_UART default 0x80074000 if DEBUG_IMX28_UART default 0x80230000 if DEBUG_PICOXCELL_UART @@ -1171,13 +1194,14 @@ config DEBUG_UART_PHYS DEBUG_LL_UART_EFM32 || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART config DEBUG_UART_VIRT hex "Virtual base address of debug UART" default 0xe0010fe0 if ARCH_RPC default 0xe1000000 if DEBUG_MSM_UART default 0xf0000be0 if ARCH_EBSA110 + default 0xf0010000 if DEBUG_ASM9260_UART default 0xf01fb000 if DEBUG_NOMADIK_UART default 0xf0201000 if DEBUG_BCM2835 default 0xf1000300 if DEBUG_BCM_5301X @@ -1244,7 +1268,7 @@ config DEBUG_UART_VIRT depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART config DEBUG_UART_8250_SHIFT int "Register offset shift for the 8250 debug UART" @@ -1286,7 +1310,8 @@ config DEBUG_UNCOMPRESS config UNCOMPRESS_INCLUDE string default "debug/uncompress.h" if ARCH_MULTIPLATFORM || ARCH_MSM || \ - PLAT_SAMSUNG || ARCH_EFM32 + PLAT_SAMSUNG || ARCH_EFM32 || \ + MACH_ASM9260 default "mach/uncompress.h" config EARLY_PRINTK diff --git a/arch/arm/include/debug/asm9260.S b/arch/arm/include/debug/asm9260.S new file mode 100644 index 0000000..c70d51f --- /dev/null +++ b/arch/arm/include/debug/asm9260.S @@ -0,0 +1,31 @@ +/* arch/arm/mach-imx/include/mach/debug-macro.S + * + * Debugging macro include header + * + * Copyright (C) 1994-1999 Russell King + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks + * Modified for ASM9260 by Oleksij Remepl <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + + .macro addruart, rp, rv, tmp + ldr \rp, = CONFIG_DEBUG_UART_PHYS + ldr \rv, = CONFIG_DEBUG_UART_VIRT + .endm + + .macro waituart,rd,rx + .endm + + .macro senduart,rd,rx + str \rd, [\rx, #0x50] @ TXDATA + .endm + + .macro busyuart,rd,rx +1002: ldr \rd, [\rx, #0x60] @ STAT + tst \rd, #1 << 27 @ TXEMPTY + beq 1002b @ wait until transmit done + .endm -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 2014-11-03 14:14 ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel @ 2014-11-03 14:46 ` Rob Herring 2014-11-04 7:34 ` [PATCH v4] " Oleksij Rempel 2014-11-05 7:13 ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel 0 siblings, 2 replies; 81+ messages in thread From: Rob Herring @ 2014-11-03 14:46 UTC (permalink / raw) To: linux-arm-kernel On Mon, Nov 3, 2014 at 10:14 PM, Oleksij Rempel <linux@rempel-privat.de> wrote: > Since there is no public documentation, this patch also provide register > offsets for different UART units on this SoC. > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> > --- > arch/arm/Kconfig.debug | 31 ++++++++++++++++++++++++++++--- > arch/arm/include/debug/asm9260.S | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 59 insertions(+), 3 deletions(-) > create mode 100644 arch/arm/include/debug/asm9260.S > > diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug > index d8f6a2e..66c29db 100644 > --- a/arch/arm/Kconfig.debug > +++ b/arch/arm/Kconfig.debug > @@ -93,6 +93,27 @@ choice > prompt "Kernel low-level debugging port" > depends on DEBUG_LL > > + config DEBUG_ASM9260_UART > + bool "Kernel low-level debugging via asm9260 UART" > + depends on MACH_ASM9260 > + help > + Say Y here if you want the debug print routines to direct > + their output to an UART or USART port on asm9260 based > + machines. > + > + DEBUG_UART_PHYS | DEBUG_UART_VIRT > + > + 0x80000000 | 0xf0000000 | UART0 > + 0x80004000 | 0xf0004000 | UART1 > + 0x80008000 | 0xf0008000 | UART2 > + 0x8000c000 | 0xf000c000 | UART3 > + 0x80010000 | 0xf0010000 | UART4 > + 0x80014000 | 0xf0014000 | UART5 > + 0x80018000 | 0xf0018000 | UART6 > + 0x8001c000 | 0xf001c000 | UART7 > + 0x80020000 | 0xf0020000 | UART8 > + 0x80024000 | 0xf0024000 | UART9 > + > config AT91_DEBUG_LL_DBGU0 > bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" > depends on HAVE_AT91_DBGU0 > @@ -1042,6 +1063,7 @@ config DEBUG_STI_UART > config DEBUG_LL_INCLUDE > string > default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 > + default "debug/asm9260.S" if DEBUG_ASM9260_UART > default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 > default "debug/meson.S" if DEBUG_MESON_UARTAO > default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X > @@ -1135,6 +1157,7 @@ config DEBUG_UART_PHYS > default 0x78000000 if DEBUG_CNS3XXX > default 0x7c0003f8 if FOOTBRIDGE > default 0x78000000 if DEBUG_CNS3XXX > + default 0x80010000 if DEBUG_ASM9260_UART > default 0x80070000 if DEBUG_IMX23_UART > default 0x80074000 if DEBUG_IMX28_UART > default 0x80230000 if DEBUG_PICOXCELL_UART > @@ -1171,13 +1194,14 @@ config DEBUG_UART_PHYS > DEBUG_LL_UART_EFM32 || \ > DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ > DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ > - DEBUG_UART_BCM63XX > + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART > > config DEBUG_UART_VIRT > hex "Virtual base address of debug UART" > default 0xe0010fe0 if ARCH_RPC > default 0xe1000000 if DEBUG_MSM_UART > default 0xf0000be0 if ARCH_EBSA110 > + default 0xf0010000 if DEBUG_ASM9260_UART > default 0xf01fb000 if DEBUG_NOMADIK_UART > default 0xf0201000 if DEBUG_BCM2835 > default 0xf1000300 if DEBUG_BCM_5301X > @@ -1244,7 +1268,7 @@ config DEBUG_UART_VIRT > depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ > DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ > DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ > - DEBUG_UART_BCM63XX > + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART > > config DEBUG_UART_8250_SHIFT > int "Register offset shift for the 8250 debug UART" > @@ -1286,7 +1310,8 @@ config DEBUG_UNCOMPRESS > config UNCOMPRESS_INCLUDE > string > default "debug/uncompress.h" if ARCH_MULTIPLATFORM || ARCH_MSM || \ > - PLAT_SAMSUNG || ARCH_EFM32 > + PLAT_SAMSUNG || ARCH_EFM32 || \ > + MACH_ASM9260 This should not be needed as multi-platform is enabled. > default "mach/uncompress.h" > > config EARLY_PRINTK > diff --git a/arch/arm/include/debug/asm9260.S b/arch/arm/include/debug/asm9260.S > new file mode 100644 > index 0000000..c70d51f > --- /dev/null > +++ b/arch/arm/include/debug/asm9260.S > @@ -0,0 +1,31 @@ > +/* arch/arm/mach-imx/include/mach/debug-macro.S Wrong filename. Just remove this. > + * > + * Debugging macro include header > + * > + * Copyright (C) 1994-1999 Russell King > + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks > + * Modified for ASM9260 by Oleksij Remepl <linux@rempel-privat.de> > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + */ > + > + .macro addruart, rp, rv, tmp > + ldr \rp, = CONFIG_DEBUG_UART_PHYS > + ldr \rv, = CONFIG_DEBUG_UART_VIRT > + .endm > + > + .macro waituart,rd,rx > + .endm > + > + .macro senduart,rd,rx > + str \rd, [\rx, #0x50] @ TXDATA > + .endm > + > + .macro busyuart,rd,rx > +1002: ldr \rd, [\rx, #0x60] @ STAT > + tst \rd, #1 << 27 @ TXEMPTY > + beq 1002b @ wait until transmit done > + .endm > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4] ARM: add lolevel debug support for asm9260 2014-11-03 14:46 ` Rob Herring @ 2014-11-04 7:34 ` Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-11-05 7:13 ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel 1 sibling, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-04 7:34 UTC (permalink / raw) To: linux-arm-kernel Since there is no public documentation, this patch also provide register offsets for different UART units on this SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/Kconfig.debug | 28 ++++++++++++++++++++++++++-- arch/arm/include/debug/asm9260.S | 29 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/asm9260.S diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index d8f6a2e..606865f 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -93,6 +93,27 @@ choice prompt "Kernel low-level debugging port" depends on DEBUG_LL + config DEBUG_ASM9260_UART + bool "Kernel low-level debugging via asm9260 UART" + depends on MACH_ASM9260 + help + Say Y here if you want the debug print routines to direct + their output to an UART or USART port on asm9260 based + machines. + + DEBUG_UART_PHYS | DEBUG_UART_VIRT + + 0x80000000 | 0xf0000000 | UART0 + 0x80004000 | 0xf0004000 | UART1 + 0x80008000 | 0xf0008000 | UART2 + 0x8000c000 | 0xf000c000 | UART3 + 0x80010000 | 0xf0010000 | UART4 + 0x80014000 | 0xf0014000 | UART5 + 0x80018000 | 0xf0018000 | UART6 + 0x8001c000 | 0xf001c000 | UART7 + 0x80020000 | 0xf0020000 | UART8 + 0x80024000 | 0xf0024000 | UART9 + config AT91_DEBUG_LL_DBGU0 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" depends on HAVE_AT91_DBGU0 @@ -1042,6 +1063,7 @@ config DEBUG_STI_UART config DEBUG_LL_INCLUDE string default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 + default "debug/asm9260.S" if DEBUG_ASM9260_UART default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 default "debug/meson.S" if DEBUG_MESON_UARTAO default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X @@ -1135,6 +1157,7 @@ config DEBUG_UART_PHYS default 0x78000000 if DEBUG_CNS3XXX default 0x7c0003f8 if FOOTBRIDGE default 0x78000000 if DEBUG_CNS3XXX + default 0x80010000 if DEBUG_ASM9260_UART default 0x80070000 if DEBUG_IMX23_UART default 0x80074000 if DEBUG_IMX28_UART default 0x80230000 if DEBUG_PICOXCELL_UART @@ -1171,13 +1194,14 @@ config DEBUG_UART_PHYS DEBUG_LL_UART_EFM32 || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART config DEBUG_UART_VIRT hex "Virtual base address of debug UART" default 0xe0010fe0 if ARCH_RPC default 0xe1000000 if DEBUG_MSM_UART default 0xf0000be0 if ARCH_EBSA110 + default 0xf0010000 if DEBUG_ASM9260_UART default 0xf01fb000 if DEBUG_NOMADIK_UART default 0xf0201000 if DEBUG_BCM2835 default 0xf1000300 if DEBUG_BCM_5301X @@ -1244,7 +1268,7 @@ config DEBUG_UART_VIRT depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART config DEBUG_UART_8250_SHIFT int "Register offset shift for the 8250 debug UART" diff --git a/arch/arm/include/debug/asm9260.S b/arch/arm/include/debug/asm9260.S new file mode 100644 index 0000000..292f85b --- /dev/null +++ b/arch/arm/include/debug/asm9260.S @@ -0,0 +1,29 @@ +/* Debugging macro include header + * + * Copyright (C) 1994-1999 Russell King + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks + * Modified for ASM9260 by Oleksij Remepl <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + + .macro addruart, rp, rv, tmp + ldr \rp, = CONFIG_DEBUG_UART_PHYS + ldr \rv, = CONFIG_DEBUG_UART_VIRT + .endm + + .macro waituart,rd,rx + .endm + + .macro senduart,rd,rx + str \rd, [\rx, #0x50] @ TXDATA + .endm + + .macro busyuart,rd,rx +1002: ldr \rd, [\rx, #0x60] @ STAT + tst \rd, #1 << 27 @ TXEMPTY + beq 1002b @ wait until transmit done + .endm -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v4 0/2] initial suport for Alphascale ASM9260 2014-11-04 7:34 ` [PATCH v4] " Oleksij Rempel @ 2014-11-24 11:08 ` Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 1/2] ARM: add mach-asm9260 Oleksij Rempel ` (2 more replies) 0 siblings, 3 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-24 11:08 UTC (permalink / raw) To: linux-arm-kernel This is reduced patchset to provide initial support for Alphascale ASM9260 Oleksij Rempel (2): ARM: add mach-asm9260 ARM: add lolevel debug support for asm9260 arch/arm/Kconfig | 2 ++ arch/arm/Kconfig.debug | 28 ++++++++++++++++++++++++++-- arch/arm/include/debug/asm9260.S | 29 +++++++++++++++++++++++++++++ arch/arm/mach-asm9260/Kconfig | 6 ++++++ 4 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/asm9260.S create mode 100644 arch/arm/mach-asm9260/Kconfig -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 1/2] ARM: add mach-asm9260 2014-11-24 11:08 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Oleksij Rempel @ 2014-11-24 11:08 ` Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel 2014-11-28 14:09 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann 2 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-24 11:08 UTC (permalink / raw) To: linux-arm-kernel it is low cost (?) SoC targeted for market in China and India which trying to compete with AT91SAM9G25. Here is some info: http://www.alphascale.com/index.asp?ics/615.html One of products: http://www.aliexpress.com/store/product/2014-hot-sales-FREE-SHIPPING-new-Purple-core-ARM9-development-board-ASM9260T-SDRAM-power-line/433637_1931495721.html In some cases this SoC looks similar to iMX23/iMX28. But currently it makes no sense to merge mach code of this devices. Especially because most differences are already collected mach-mxs folder. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/Kconfig | 2 ++ arch/arm/mach-asm9260/Kconfig | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 arch/arm/mach-asm9260/Kconfig diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 89c4b5c..fed7eb1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -854,6 +854,8 @@ config ARCH_VIRT # source "arch/arm/mach-mvebu/Kconfig" +source "arch/arm/mach-asm9260/Kconfig" + source "arch/arm/mach-at91/Kconfig" source "arch/arm/mach-axxia/Kconfig" diff --git a/arch/arm/mach-asm9260/Kconfig b/arch/arm/mach-asm9260/Kconfig new file mode 100644 index 0000000..8423be7 --- /dev/null +++ b/arch/arm/mach-asm9260/Kconfig @@ -0,0 +1,6 @@ +config MACH_ASM9260 + bool "Alphascale ASM9260" + depends on ARCH_MULTI_V5 + select CPU_ARM926T + help + Support for Alphascale ASM9260 based platform. -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v4 2/2] ARM: add lolevel debug support for asm9260 2014-11-24 11:08 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 1/2] ARM: add mach-asm9260 Oleksij Rempel @ 2014-11-24 11:08 ` Oleksij Rempel 2014-11-28 14:09 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann 2 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-24 11:08 UTC (permalink / raw) To: linux-arm-kernel Since there is no public documentation, this patch also provide register offsets for different UART units on this SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/Kconfig.debug | 28 ++++++++++++++++++++++++++-- arch/arm/include/debug/asm9260.S | 29 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/asm9260.S diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index d8f6a2e..606865f 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -93,6 +93,27 @@ choice prompt "Kernel low-level debugging port" depends on DEBUG_LL + config DEBUG_ASM9260_UART + bool "Kernel low-level debugging via asm9260 UART" + depends on MACH_ASM9260 + help + Say Y here if you want the debug print routines to direct + their output to an UART or USART port on asm9260 based + machines. + + DEBUG_UART_PHYS | DEBUG_UART_VIRT + + 0x80000000 | 0xf0000000 | UART0 + 0x80004000 | 0xf0004000 | UART1 + 0x80008000 | 0xf0008000 | UART2 + 0x8000c000 | 0xf000c000 | UART3 + 0x80010000 | 0xf0010000 | UART4 + 0x80014000 | 0xf0014000 | UART5 + 0x80018000 | 0xf0018000 | UART6 + 0x8001c000 | 0xf001c000 | UART7 + 0x80020000 | 0xf0020000 | UART8 + 0x80024000 | 0xf0024000 | UART9 + config AT91_DEBUG_LL_DBGU0 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" depends on HAVE_AT91_DBGU0 @@ -1042,6 +1063,7 @@ config DEBUG_STI_UART config DEBUG_LL_INCLUDE string default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 + default "debug/asm9260.S" if DEBUG_ASM9260_UART default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 default "debug/meson.S" if DEBUG_MESON_UARTAO default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X @@ -1135,6 +1157,7 @@ config DEBUG_UART_PHYS default 0x78000000 if DEBUG_CNS3XXX default 0x7c0003f8 if FOOTBRIDGE default 0x78000000 if DEBUG_CNS3XXX + default 0x80010000 if DEBUG_ASM9260_UART default 0x80070000 if DEBUG_IMX23_UART default 0x80074000 if DEBUG_IMX28_UART default 0x80230000 if DEBUG_PICOXCELL_UART @@ -1171,13 +1194,14 @@ config DEBUG_UART_PHYS DEBUG_LL_UART_EFM32 || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART config DEBUG_UART_VIRT hex "Virtual base address of debug UART" default 0xe0010fe0 if ARCH_RPC default 0xe1000000 if DEBUG_MSM_UART default 0xf0000be0 if ARCH_EBSA110 + default 0xf0010000 if DEBUG_ASM9260_UART default 0xf01fb000 if DEBUG_NOMADIK_UART default 0xf0201000 if DEBUG_BCM2835 default 0xf1000300 if DEBUG_BCM_5301X @@ -1244,7 +1268,7 @@ config DEBUG_UART_VIRT depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART config DEBUG_UART_8250_SHIFT int "Register offset shift for the 8250 debug UART" diff --git a/arch/arm/include/debug/asm9260.S b/arch/arm/include/debug/asm9260.S new file mode 100644 index 0000000..292f85b --- /dev/null +++ b/arch/arm/include/debug/asm9260.S @@ -0,0 +1,29 @@ +/* Debugging macro include header + * + * Copyright (C) 1994-1999 Russell King + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks + * Modified for ASM9260 by Oleksij Remepl <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + + .macro addruart, rp, rv, tmp + ldr \rp, = CONFIG_DEBUG_UART_PHYS + ldr \rv, = CONFIG_DEBUG_UART_VIRT + .endm + + .macro waituart,rd,rx + .endm + + .macro senduart,rd,rx + str \rd, [\rx, #0x50] @ TXDATA + .endm + + .macro busyuart,rd,rx +1002: ldr \rd, [\rx, #0x60] @ STAT + tst \rd, #1 << 27 @ TXEMPTY + beq 1002b @ wait until transmit done + .endm -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH v4 0/2] initial suport for Alphascale ASM9260 2014-11-24 11:08 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 1/2] ARM: add mach-asm9260 Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel @ 2014-11-28 14:09 ` Arnd Bergmann 2014-11-28 14:13 ` Oleksij Rempel ` (3 more replies) 2 siblings, 4 replies; 81+ messages in thread From: Arnd Bergmann @ 2014-11-28 14:09 UTC (permalink / raw) To: linux-arm-kernel On Monday 24 November 2014, Oleksij Rempel wrote: > This is reduced patchset to provide initial support for Alphascale ASM9260 > > Oleksij Rempel (2): > ARM: add mach-asm9260 > ARM: add lolevel debug support for asm9260 > Applied to next/soc, thanks a lot for keeping this up! Are you planning to send some matching dts files for 3.19 as well? Arnd ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 0/2] initial suport for Alphascale ASM9260 2014-11-28 14:09 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann @ 2014-11-28 14:13 ` Oleksij Rempel 2014-11-28 15:05 ` [PATCH] suport for Alphascale ASM9260, part 2 Oleksij Rempel ` (2 subsequent siblings) 3 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 14:13 UTC (permalink / raw) To: linux-arm-kernel Am 28.11.2014 um 15:09 schrieb Arnd Bergmann: > On Monday 24 November 2014, Oleksij Rempel wrote: >> This is reduced patchset to provide initial support for Alphascale ASM9260 >> >> Oleksij Rempel (2): >> ARM: add mach-asm9260 >> ARM: add lolevel debug support for asm9260 >> > > Applied to next/soc, thanks a lot for keeping this up! > > Are you planning to send some matching dts files for 3.19 as well? > > Arnd > Sure i'll send them ASAP. Thank you all for reviewing, applying and patience we me!! :) -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141128/9f13f9b0/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] suport for Alphascale ASM9260, part 2 2014-11-28 14:09 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann 2014-11-28 14:13 ` Oleksij Rempel @ 2014-11-28 15:05 ` Oleksij Rempel 2014-11-28 15:05 ` [PATCH] ARM: clk: add clk-asm9260 driver Oleksij Rempel ` (2 more replies) 2014-11-28 16:50 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 3 siblings, 3 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 15:05 UTC (permalink / raw) To: linux-arm-kernel it is secong logical part of ASM9260 patch set. Oleksij Rempel (1): ARM: clk: add clk-asm9260 driver drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 359 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 457 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clk: add clk-asm9260 driver 2014-11-28 15:05 ` [PATCH] suport for Alphascale ASM9260, part 2 Oleksij Rempel @ 2014-11-28 15:05 ` Oleksij Rempel 2014-11-28 16:34 ` [PATCH] suport for Alphascale ASM9260, part 2 Arnd Bergmann 2015-01-08 8:59 ` Oleksij Rempel 2 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 15:05 UTC (permalink / raw) To: linux-arm-kernel Provide CLK support for Alphascale ASM9260 SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 359 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 457 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index d5fba5b..3c41a68 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -16,6 +16,7 @@ endif # hardware specific clock types # please keep this section sorted lexicographically by file/directory path name +obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c new file mode 100644 index 0000000..6b1c220 --- /dev/null +++ b/drivers/clk/clk-asm9260.c @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/clk-provider.h> +#include <linux/spinlock.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <dt-bindings/clock/alphascale,asm9260.h> + +#define HW_AHBCLKCTRL0 0x0020 +#define HW_AHBCLKCTRL1 0x0030 +#define HW_SYSPLLCTRL 0x0100 +#define HW_MAINCLKSEL 0x0120 +#define HW_MAINCLKUEN 0x0124 +#define HW_UARTCLKSEL 0x0128 +#define HW_UARTCLKUEN 0x012c +#define HW_I2S0CLKSEL 0x0130 +#define HW_I2S0CLKUEN 0x0134 +#define HW_I2S1CLKSEL 0x0138 +#define HW_I2S1CLKUEN 0x013c +#define HW_WDTCLKSEL 0x0160 +#define HW_WDTCLKUEN 0x0164 +#define HW_CLKOUTCLKSEL 0x0170 +#define HW_CLKOUTCLKUEN 0x0174 +#define HW_CPUCLKDIV 0x017c +#define HW_SYSAHBCLKDIV 0x0180 +#define HW_I2S0MCLKDIV 0x0190 +#define HW_I2S0SCLKDIV 0x0194 +#define HW_I2S1MCLKDIV 0x0188 +#define HW_I2S1SCLKDIV 0x018c +#define HW_UART0CLKDIV 0x0198 +#define HW_UART1CLKDIV 0x019c +#define HW_UART2CLKDIV 0x01a0 +#define HW_UART3CLKDIV 0x01a4 +#define HW_UART4CLKDIV 0x01a8 +#define HW_UART5CLKDIV 0x01ac +#define HW_UART6CLKDIV 0x01b0 +#define HW_UART7CLKDIV 0x01b4 +#define HW_UART8CLKDIV 0x01b8 +#define HW_UART9CLKDIV 0x01bc +#define HW_SPI0CLKDIV 0x01c0 +#define HW_SPI1CLKDIV 0x01c4 +#define HW_QUADSPICLKDIV 0x01c8 +#define HW_SSP0CLKDIV 0x01d0 +#define HW_NANDCLKDIV 0x01d4 +#define HW_TRACECLKDIV 0x01e0 +#define HW_CAMMCLKDIV 0x01e8 +#define HW_WDTCLKDIV 0x01ec +#define HW_CLKOUTCLKDIV 0x01f4 +#define HW_MACCLKDIV 0x01f8 +#define HW_LCDCLKDIV 0x01fc +#define HW_ADCANACLKDIV 0x0200 + +static struct clk *clks[MAX_CLKS]; +static struct clk_onecell_data clk_data; +static DEFINE_SPINLOCK(asm9260_clk_lock); + +struct asm9260_div_clk { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; +}; + +struct asm9260_gate_data { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; + u8 bit_idx; + unsigned long flags; +}; + +struct asm9260_mux_clock { + u8 mask; + u32 *table; + const char *name; + const char **parent_names; + u8 num_parents; + unsigned long offset; + unsigned long flags; +}; + +static void __iomem *base; + +enum { + REFCLK, SYSPLL, I2S0_MCLK, I2S1_MCLK, RTC_OSC, USB_PLL, +}; + +static const char *clk_names[] = { + [REFCLK] = "oscillator", + [SYSPLL] = "pll", + [I2S0_MCLK] = "i2s0_mclk", + [I2S1_MCLK] = "i2s1_mclk", + [RTC_OSC] = "rtc_osc", + [USB_PLL] = "usb_pll", +}; + +static const struct asm9260_div_clk asm9260_div_clks[] __initconst = { + { CLKID_SYS_CPU, "cpu_div", "main_gate", HW_CPUCLKDIV }, + { CLKID_SYS_AHB, "ahb_div", "cpu_div", HW_SYSAHBCLKDIV }, + + /* i2s has two deviders: one for only external mclk and internal + * devider for all clks. */ + { CLKID_SYS_I2S0M, "i2s0m_div", "i2s0_mclk", HW_I2S0MCLKDIV }, + { CLKID_SYS_I2S1M, "i2s1m_div", "i2s1_mclk", HW_I2S1MCLKDIV }, + { CLKID_SYS_I2S0S, "i2s0s_div", "i2s0_gate", HW_I2S0SCLKDIV }, + { CLKID_SYS_I2S1S, "i2s1s_div", "i2s0_gate", HW_I2S1SCLKDIV }, + + { CLKID_SYS_UART0, "uart0_div", "uart_gate", HW_UART0CLKDIV }, + { CLKID_SYS_UART1, "uart1_div", "uart_gate", HW_UART1CLKDIV }, + { CLKID_SYS_UART2, "uart2_div", "uart_gate", HW_UART2CLKDIV }, + { CLKID_SYS_UART3, "uart3_div", "uart_gate", HW_UART3CLKDIV }, + { CLKID_SYS_UART4, "uart4_div", "uart_gate", HW_UART4CLKDIV }, + { CLKID_SYS_UART5, "uart5_div", "uart_gate", HW_UART5CLKDIV }, + { CLKID_SYS_UART6, "uart6_div", "uart_gate", HW_UART6CLKDIV }, + { CLKID_SYS_UART7, "uart7_div", "uart_gate", HW_UART7CLKDIV }, + { CLKID_SYS_UART8, "uart8_div", "uart_gate", HW_UART8CLKDIV }, + { CLKID_SYS_UART9, "uart9_div", "uart_gate", HW_UART9CLKDIV }, + + { CLKID_SYS_SPI0, "spi0_div", "main_gate", HW_SPI0CLKDIV }, + { CLKID_SYS_SPI1, "spi1_div", "main_gate", HW_SPI1CLKDIV }, + { CLKID_SYS_QUADSPI, "quadspi_div", "main_gate", HW_QUADSPICLKDIV }, + { CLKID_SYS_SSP0, "ssp0_div", "main_gate", HW_SSP0CLKDIV }, + { CLKID_SYS_NAND, "nand_div", "main_gate", HW_NANDCLKDIV }, + { CLKID_SYS_TRACE, "trace_div", "main_gate", HW_TRACECLKDIV }, + { CLKID_SYS_CAMM, "camm_div", "main_gate", HW_CAMMCLKDIV }, + { CLKID_SYS_MAC, "mac_div", "main_gate", HW_MACCLKDIV }, + { CLKID_SYS_LCD, "lcd_div", "main_gate", HW_LCDCLKDIV }, + { CLKID_SYS_ADCANA, "adcana_div", "main_gate", HW_ADCANACLKDIV }, + + { CLKID_SYS_WDT, "wdt_div", "wdt_gate", HW_WDTCLKDIV }, + { CLKID_SYS_CLKOUT, "clkout_div", "clkout_gate", HW_CLKOUTCLKDIV }, +}; + +static const struct asm9260_gate_data asm9260_mux_gates[] __initconst = { + { 0, "main_gate", "main_mux", HW_MAINCLKUEN, 0 }, + { 0, "uart_gate", "uart_mux", HW_UARTCLKUEN, 0 }, + { 0, "i2s0_gate", "i2s0_mux", HW_I2S0CLKUEN, 0 }, + { 0, "i2s1_gate", "i2s1_mux", HW_I2S1CLKUEN, 0 }, + { 0, "wdt_gate", "wdt_mux", HW_WDTCLKUEN, 0 }, + { 0, "clkout_gate", "clkout_mux", HW_CLKOUTCLKUEN, 0 }, +}; +static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { + /* ahb gates */ + { CLKID_AHB_ROM, "rom", "ahb_div", + HW_AHBCLKCTRL0, 1, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RAM, "ram", "ahb_div", + HW_AHBCLKCTRL0, 2, CLK_IGNORE_UNUSED}, + { CLKID_AHB_GPIO, "gpio", "ahb_div", + HW_AHBCLKCTRL0, 4 }, + { CLKID_AHB_MAC, "mac", "ahb_div", + HW_AHBCLKCTRL0, 5 }, + { CLKID_AHB_EMI, "emi", "ahb_div", + HW_AHBCLKCTRL0, 6, CLK_IGNORE_UNUSED}, + { CLKID_AHB_USB0, "usb0", "ahb_div", + HW_AHBCLKCTRL0, 7 }, + { CLKID_AHB_USB1, "usb1", "ahb_div", + HW_AHBCLKCTRL0, 8 }, + { CLKID_AHB_DMA0, "dma0", "ahb_div", + HW_AHBCLKCTRL0, 9 }, + { CLKID_AHB_DMA1, "dma1", "ahb_div", + HW_AHBCLKCTRL0, 10 }, + { CLKID_AHB_UART0, "uart0", "ahb_div", + HW_AHBCLKCTRL0, 11 }, + { CLKID_AHB_UART1, "uart1", "ahb_div", + HW_AHBCLKCTRL0, 12 }, + { CLKID_AHB_UART2, "uart2", "ahb_div", + HW_AHBCLKCTRL0, 13 }, + { CLKID_AHB_UART3, "uart3", "ahb_div", + HW_AHBCLKCTRL0, 14 }, + { CLKID_AHB_UART4, "uart4", "ahb_div", + HW_AHBCLKCTRL0, 15 }, + { CLKID_AHB_UART5, "uart5", "ahb_div", + HW_AHBCLKCTRL0, 16 }, + { CLKID_AHB_UART6, "uart6", "ahb_div", + HW_AHBCLKCTRL0, 17 }, + { CLKID_AHB_UART7, "uart7", "ahb_div", + HW_AHBCLKCTRL0, 18 }, + { CLKID_AHB_UART8, "uart8", "ahb_div", + HW_AHBCLKCTRL0, 19 }, + { CLKID_AHB_UART9, "uart9", "ahb_div", + HW_AHBCLKCTRL0, 20 }, + { CLKID_AHB_I2S0, "i2s0", "ahb_div", + HW_AHBCLKCTRL0, 21 }, + { CLKID_AHB_I2C0, "i2c0", "ahb_div", + HW_AHBCLKCTRL0, 22 }, + { CLKID_AHB_I2C1, "i2c1", "ahb_div", + HW_AHBCLKCTRL0, 23 }, + { CLKID_AHB_SSP0, "ssp0", "ahb_div", + HW_AHBCLKCTRL0, 24 }, + { CLKID_AHB_IOCONFIG, "ioconf", "ahb_div", + HW_AHBCLKCTRL0, 25 }, + { CLKID_AHB_WDT, "wdt", "ahb_div", + HW_AHBCLKCTRL0, 26 }, + { CLKID_AHB_CAN0, "can0", "ahb_div", + HW_AHBCLKCTRL0, 27 }, + { CLKID_AHB_CAN1, "can1", "ahb_div", + HW_AHBCLKCTRL0, 28 }, + { CLKID_AHB_MPWM, "mpwm", "ahb_div", + HW_AHBCLKCTRL0, 29 }, + { CLKID_AHB_SPI0, "spi0", "ahb_div", + HW_AHBCLKCTRL0, 30 }, + { CLKID_AHB_SPI1, "spi1", "ahb_div", + HW_AHBCLKCTRL0, 31 }, + + { CLKID_AHB_QEI, "qei", "ahb_div", + HW_AHBCLKCTRL1, 0 }, + { CLKID_AHB_QUADSPI0, "quadspi0", "ahb_div", + HW_AHBCLKCTRL1, 1 }, + { CLKID_AHB_CAMIF, "capmif", "ahb_div", + HW_AHBCLKCTRL1, 2 }, + { CLKID_AHB_LCDIF, "lcdif", "ahb_div", + HW_AHBCLKCTRL1, 3 }, + { CLKID_AHB_TIMER0, "timer0", "ahb_div", + HW_AHBCLKCTRL1, 4 }, + { CLKID_AHB_TIMER1, "timer1", "ahb_div", + HW_AHBCLKCTRL1, 5 }, + { CLKID_AHB_TIMER2, "timer2", "ahb_div", + HW_AHBCLKCTRL1, 6 }, + { CLKID_AHB_TIMER3, "timer3", "ahb_div", + HW_AHBCLKCTRL1, 7 }, + { CLKID_AHB_IRQ, "irq", "ahb_div", + HW_AHBCLKCTRL1, 8, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RTC, "rtc", "ahb_div", + HW_AHBCLKCTRL1, 9 }, + { CLKID_AHB_NAND, "nand", "ahb_div", + HW_AHBCLKCTRL1, 10 }, + { CLKID_AHB_ADC0, "adc0", "ahb_div", + HW_AHBCLKCTRL1, 11 }, + { CLKID_AHB_LED, "led", "ahb_div", + HW_AHBCLKCTRL1, 12 }, + { CLKID_AHB_DAC0, "dac0", "ahb_div", + HW_AHBCLKCTRL1, 13 }, + { CLKID_AHB_LCD, "lcd", "ahb_div", + HW_AHBCLKCTRL1, 14 }, + { CLKID_AHB_I2S1, "i2s1", "ahb_div", + HW_AHBCLKCTRL1, 15 }, + { CLKID_AHB_MAC1, "mac1", "ahb_div", + HW_AHBCLKCTRL1, 16 }, +}; + +static const char __initdata *main_mux_p[] = {"oscillator", "pll"}; +static const char __initdata *i2s0_mux_p[] = {"oscillator", "pll", "i2s0m_div"}; +static const char __initdata *i2s1_mux_p[] = {"oscillator", "pll", "i2s1m_div"}; +static const char __initdata *clkout_mux_p[] = {"oscillator", "pll", "rtc"}; +static u32 three_mux_table[] = {0, 1, 3}; + +static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { + { 1, three_mux_table, "main_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_MAINCLKSEL, }, + { 1, three_mux_table, "uart_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_UARTCLKSEL, }, + { 1, three_mux_table, "wdt_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_WDTCLKSEL, }, + { 3, three_mux_table, "i2s0_mux", i2s0_mux_p, + ARRAY_SIZE(i2s0_mux_p), HW_I2S0CLKSEL, }, + { 3, three_mux_table, "i2s1_mux", i2s1_mux_p, + ARRAY_SIZE(i2s1_mux_p), HW_I2S1CLKSEL, }, + { 3, three_mux_table, "clkout_mux", clkout_mux_p, + ARRAY_SIZE(clkout_mux_p), HW_CLKOUTCLKSEL, }, +}; + +static void __init asm9260_acc_init(struct device_node *np) +{ + struct clk *clk; + u32 rate; + int n; + u32 accuracy = 0; + + base = of_io_request_and_map(np, 0, np->name); + if (!base) + panic("%s: unable to map resource", np->name); + + /* register pll */ + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; + + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], + clk_names[REFCLK], 0, rate, accuracy); + + if (IS_ERR(clk)) + panic("%s: can't register REFCLK. Check DT!", np->name); + + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; + + mc->parent_names[0] = clk_names[REFCLK]; + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, + mc->num_parents, mc->flags, base + mc->offset, + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); + } + + /* clock mux gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; + + clk = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* clock div cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; + + clks[dc->idx] = clk_register_divider(NULL, dc->name, + dc->parent_name, CLK_SET_RATE_PARENT, + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, + &asm9260_clk_lock); + } + + /* clock ahb gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; + + clks[gd->idx] = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags, base + gd->reg, + gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* check for errors on leaf clocks */ + for (n = 0; n < MAX_CLKS; n++) { + if (!IS_ERR(clks[n])) + continue; + + pr_err("%s: Unable to register leaf clock %d\n", + np->full_name, n); + goto fail; + } + + /* register clk-provider */ + clk_data.clks = clks; + clk_data.clk_num = MAX_CLKS; + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); + return; +fail: + iounmap(base); +} +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", + asm9260_acc_init); diff --git a/include/dt-bindings/clock/alphascale,asm9260.h b/include/dt-bindings/clock/alphascale,asm9260.h new file mode 100644 index 0000000..04e8db2 --- /dev/null +++ b/include/dt-bindings/clock/alphascale,asm9260.h @@ -0,0 +1,97 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_CLK_ASM9260_H +#define _DT_BINDINGS_CLK_ASM9260_H + +/* ahb gate */ +#define CLKID_AHB_ROM 0 +#define CLKID_AHB_RAM 1 +#define CLKID_AHB_GPIO 2 +#define CLKID_AHB_MAC 3 +#define CLKID_AHB_EMI 4 +#define CLKID_AHB_USB0 5 +#define CLKID_AHB_USB1 6 +#define CLKID_AHB_DMA0 7 +#define CLKID_AHB_DMA1 8 +#define CLKID_AHB_UART0 9 +#define CLKID_AHB_UART1 10 +#define CLKID_AHB_UART2 11 +#define CLKID_AHB_UART3 12 +#define CLKID_AHB_UART4 13 +#define CLKID_AHB_UART5 14 +#define CLKID_AHB_UART6 15 +#define CLKID_AHB_UART7 16 +#define CLKID_AHB_UART8 17 +#define CLKID_AHB_UART9 18 +#define CLKID_AHB_I2S0 19 +#define CLKID_AHB_I2C0 20 +#define CLKID_AHB_I2C1 21 +#define CLKID_AHB_SSP0 22 +#define CLKID_AHB_IOCONFIG 23 +#define CLKID_AHB_WDT 24 +#define CLKID_AHB_CAN0 25 +#define CLKID_AHB_CAN1 26 +#define CLKID_AHB_MPWM 27 +#define CLKID_AHB_SPI0 28 +#define CLKID_AHB_SPI1 29 +#define CLKID_AHB_QEI 30 +#define CLKID_AHB_QUADSPI0 31 +#define CLKID_AHB_CAMIF 32 +#define CLKID_AHB_LCDIF 33 +#define CLKID_AHB_TIMER0 34 +#define CLKID_AHB_TIMER1 35 +#define CLKID_AHB_TIMER2 36 +#define CLKID_AHB_TIMER3 37 +#define CLKID_AHB_IRQ 38 +#define CLKID_AHB_RTC 39 +#define CLKID_AHB_NAND 40 +#define CLKID_AHB_ADC0 41 +#define CLKID_AHB_LED 42 +#define CLKID_AHB_DAC0 43 +#define CLKID_AHB_LCD 44 +#define CLKID_AHB_I2S1 45 +#define CLKID_AHB_MAC1 46 + +/* devider */ +#define CLKID_SYS_CPU 47 +#define CLKID_SYS_AHB 48 +#define CLKID_SYS_I2S0M 49 +#define CLKID_SYS_I2S0S 50 +#define CLKID_SYS_I2S1M 51 +#define CLKID_SYS_I2S1S 52 +#define CLKID_SYS_UART0 53 +#define CLKID_SYS_UART1 54 +#define CLKID_SYS_UART2 55 +#define CLKID_SYS_UART3 56 +#define CLKID_SYS_UART4 56 +#define CLKID_SYS_UART5 57 +#define CLKID_SYS_UART6 58 +#define CLKID_SYS_UART7 59 +#define CLKID_SYS_UART8 60 +#define CLKID_SYS_UART9 61 +#define CLKID_SYS_SPI0 62 +#define CLKID_SYS_SPI1 63 +#define CLKID_SYS_QUADSPI 64 +#define CLKID_SYS_SSP0 65 +#define CLKID_SYS_NAND 66 +#define CLKID_SYS_TRACE 67 +#define CLKID_SYS_CAMM 68 +#define CLKID_SYS_WDT 69 +#define CLKID_SYS_CLKOUT 70 +#define CLKID_SYS_MAC 71 +#define CLKID_SYS_LCD 72 +#define CLKID_SYS_ADCANA 73 + +#define MAX_CLKS 74 +#endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH] suport for Alphascale ASM9260, part 2 2014-11-28 15:05 ` [PATCH] suport for Alphascale ASM9260, part 2 Oleksij Rempel 2014-11-28 15:05 ` [PATCH] ARM: clk: add clk-asm9260 driver Oleksij Rempel @ 2014-11-28 16:34 ` Arnd Bergmann 2015-01-08 8:59 ` Oleksij Rempel 2 siblings, 0 replies; 81+ messages in thread From: Arnd Bergmann @ 2014-11-28 16:34 UTC (permalink / raw) To: linux-arm-kernel On Friday 28 November 2014 16:05:19 Oleksij Rempel wrote: > it is secong logical part of ASM9260 patch set. > Note that there is no reason to wait for one part to be applied before sending the next one, as long as you introduce no build breakage. Arnd ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] clk support for Alphascale asm9260 2014-11-28 15:05 ` [PATCH] suport for Alphascale ASM9260, part 2 Oleksij Rempel @ 2015-01-08 8:59 ` Oleksij Rempel 2014-11-28 16:34 ` [PATCH] suport for Alphascale ASM9260, part 2 Arnd Bergmann 2015-01-08 8:59 ` Oleksij Rempel 2 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 8:59 UTC (permalink / raw) To: mturquette, linux-kernel, linux-arm-kernel; +Cc: Oleksij Rempel Hello, this patch provides clk support for Alphascale asm9260 SoC. As was suggested by one of ARM maintainers, I explicitly ask you to merge this patch :D Oleksij Rempel (1): ARM: clk: add clk-asm9260 driver drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 359 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 457 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] clk support for Alphascale asm9260 @ 2015-01-08 8:59 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 8:59 UTC (permalink / raw) To: linux-arm-kernel Hello, this patch provides clk support for Alphascale asm9260 SoC. As was suggested by one of ARM maintainers, I explicitly ask you to merge this patch :D Oleksij Rempel (1): ARM: clk: add clk-asm9260 driver drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 359 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 457 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clk: add clk-asm9260 driver 2015-01-08 8:59 ` Oleksij Rempel @ 2015-01-08 8:59 ` Oleksij Rempel -1 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 8:59 UTC (permalink / raw) To: mturquette, linux-kernel, linux-arm-kernel; +Cc: Oleksij Rempel Provide CLK support for Alphascale ASM9260 SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 359 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 457 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index d5fba5b..3c41a68 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -16,6 +16,7 @@ endif # hardware specific clock types # please keep this section sorted lexicographically by file/directory path name +obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c new file mode 100644 index 0000000..6b1c220 --- /dev/null +++ b/drivers/clk/clk-asm9260.c @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/clk-provider.h> +#include <linux/spinlock.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <dt-bindings/clock/alphascale,asm9260.h> + +#define HW_AHBCLKCTRL0 0x0020 +#define HW_AHBCLKCTRL1 0x0030 +#define HW_SYSPLLCTRL 0x0100 +#define HW_MAINCLKSEL 0x0120 +#define HW_MAINCLKUEN 0x0124 +#define HW_UARTCLKSEL 0x0128 +#define HW_UARTCLKUEN 0x012c +#define HW_I2S0CLKSEL 0x0130 +#define HW_I2S0CLKUEN 0x0134 +#define HW_I2S1CLKSEL 0x0138 +#define HW_I2S1CLKUEN 0x013c +#define HW_WDTCLKSEL 0x0160 +#define HW_WDTCLKUEN 0x0164 +#define HW_CLKOUTCLKSEL 0x0170 +#define HW_CLKOUTCLKUEN 0x0174 +#define HW_CPUCLKDIV 0x017c +#define HW_SYSAHBCLKDIV 0x0180 +#define HW_I2S0MCLKDIV 0x0190 +#define HW_I2S0SCLKDIV 0x0194 +#define HW_I2S1MCLKDIV 0x0188 +#define HW_I2S1SCLKDIV 0x018c +#define HW_UART0CLKDIV 0x0198 +#define HW_UART1CLKDIV 0x019c +#define HW_UART2CLKDIV 0x01a0 +#define HW_UART3CLKDIV 0x01a4 +#define HW_UART4CLKDIV 0x01a8 +#define HW_UART5CLKDIV 0x01ac +#define HW_UART6CLKDIV 0x01b0 +#define HW_UART7CLKDIV 0x01b4 +#define HW_UART8CLKDIV 0x01b8 +#define HW_UART9CLKDIV 0x01bc +#define HW_SPI0CLKDIV 0x01c0 +#define HW_SPI1CLKDIV 0x01c4 +#define HW_QUADSPICLKDIV 0x01c8 +#define HW_SSP0CLKDIV 0x01d0 +#define HW_NANDCLKDIV 0x01d4 +#define HW_TRACECLKDIV 0x01e0 +#define HW_CAMMCLKDIV 0x01e8 +#define HW_WDTCLKDIV 0x01ec +#define HW_CLKOUTCLKDIV 0x01f4 +#define HW_MACCLKDIV 0x01f8 +#define HW_LCDCLKDIV 0x01fc +#define HW_ADCANACLKDIV 0x0200 + +static struct clk *clks[MAX_CLKS]; +static struct clk_onecell_data clk_data; +static DEFINE_SPINLOCK(asm9260_clk_lock); + +struct asm9260_div_clk { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; +}; + +struct asm9260_gate_data { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; + u8 bit_idx; + unsigned long flags; +}; + +struct asm9260_mux_clock { + u8 mask; + u32 *table; + const char *name; + const char **parent_names; + u8 num_parents; + unsigned long offset; + unsigned long flags; +}; + +static void __iomem *base; + +enum { + REFCLK, SYSPLL, I2S0_MCLK, I2S1_MCLK, RTC_OSC, USB_PLL, +}; + +static const char *clk_names[] = { + [REFCLK] = "oscillator", + [SYSPLL] = "pll", + [I2S0_MCLK] = "i2s0_mclk", + [I2S1_MCLK] = "i2s1_mclk", + [RTC_OSC] = "rtc_osc", + [USB_PLL] = "usb_pll", +}; + +static const struct asm9260_div_clk asm9260_div_clks[] __initconst = { + { CLKID_SYS_CPU, "cpu_div", "main_gate", HW_CPUCLKDIV }, + { CLKID_SYS_AHB, "ahb_div", "cpu_div", HW_SYSAHBCLKDIV }, + + /* i2s has two deviders: one for only external mclk and internal + * devider for all clks. */ + { CLKID_SYS_I2S0M, "i2s0m_div", "i2s0_mclk", HW_I2S0MCLKDIV }, + { CLKID_SYS_I2S1M, "i2s1m_div", "i2s1_mclk", HW_I2S1MCLKDIV }, + { CLKID_SYS_I2S0S, "i2s0s_div", "i2s0_gate", HW_I2S0SCLKDIV }, + { CLKID_SYS_I2S1S, "i2s1s_div", "i2s0_gate", HW_I2S1SCLKDIV }, + + { CLKID_SYS_UART0, "uart0_div", "uart_gate", HW_UART0CLKDIV }, + { CLKID_SYS_UART1, "uart1_div", "uart_gate", HW_UART1CLKDIV }, + { CLKID_SYS_UART2, "uart2_div", "uart_gate", HW_UART2CLKDIV }, + { CLKID_SYS_UART3, "uart3_div", "uart_gate", HW_UART3CLKDIV }, + { CLKID_SYS_UART4, "uart4_div", "uart_gate", HW_UART4CLKDIV }, + { CLKID_SYS_UART5, "uart5_div", "uart_gate", HW_UART5CLKDIV }, + { CLKID_SYS_UART6, "uart6_div", "uart_gate", HW_UART6CLKDIV }, + { CLKID_SYS_UART7, "uart7_div", "uart_gate", HW_UART7CLKDIV }, + { CLKID_SYS_UART8, "uart8_div", "uart_gate", HW_UART8CLKDIV }, + { CLKID_SYS_UART9, "uart9_div", "uart_gate", HW_UART9CLKDIV }, + + { CLKID_SYS_SPI0, "spi0_div", "main_gate", HW_SPI0CLKDIV }, + { CLKID_SYS_SPI1, "spi1_div", "main_gate", HW_SPI1CLKDIV }, + { CLKID_SYS_QUADSPI, "quadspi_div", "main_gate", HW_QUADSPICLKDIV }, + { CLKID_SYS_SSP0, "ssp0_div", "main_gate", HW_SSP0CLKDIV }, + { CLKID_SYS_NAND, "nand_div", "main_gate", HW_NANDCLKDIV }, + { CLKID_SYS_TRACE, "trace_div", "main_gate", HW_TRACECLKDIV }, + { CLKID_SYS_CAMM, "camm_div", "main_gate", HW_CAMMCLKDIV }, + { CLKID_SYS_MAC, "mac_div", "main_gate", HW_MACCLKDIV }, + { CLKID_SYS_LCD, "lcd_div", "main_gate", HW_LCDCLKDIV }, + { CLKID_SYS_ADCANA, "adcana_div", "main_gate", HW_ADCANACLKDIV }, + + { CLKID_SYS_WDT, "wdt_div", "wdt_gate", HW_WDTCLKDIV }, + { CLKID_SYS_CLKOUT, "clkout_div", "clkout_gate", HW_CLKOUTCLKDIV }, +}; + +static const struct asm9260_gate_data asm9260_mux_gates[] __initconst = { + { 0, "main_gate", "main_mux", HW_MAINCLKUEN, 0 }, + { 0, "uart_gate", "uart_mux", HW_UARTCLKUEN, 0 }, + { 0, "i2s0_gate", "i2s0_mux", HW_I2S0CLKUEN, 0 }, + { 0, "i2s1_gate", "i2s1_mux", HW_I2S1CLKUEN, 0 }, + { 0, "wdt_gate", "wdt_mux", HW_WDTCLKUEN, 0 }, + { 0, "clkout_gate", "clkout_mux", HW_CLKOUTCLKUEN, 0 }, +}; +static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { + /* ahb gates */ + { CLKID_AHB_ROM, "rom", "ahb_div", + HW_AHBCLKCTRL0, 1, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RAM, "ram", "ahb_div", + HW_AHBCLKCTRL0, 2, CLK_IGNORE_UNUSED}, + { CLKID_AHB_GPIO, "gpio", "ahb_div", + HW_AHBCLKCTRL0, 4 }, + { CLKID_AHB_MAC, "mac", "ahb_div", + HW_AHBCLKCTRL0, 5 }, + { CLKID_AHB_EMI, "emi", "ahb_div", + HW_AHBCLKCTRL0, 6, CLK_IGNORE_UNUSED}, + { CLKID_AHB_USB0, "usb0", "ahb_div", + HW_AHBCLKCTRL0, 7 }, + { CLKID_AHB_USB1, "usb1", "ahb_div", + HW_AHBCLKCTRL0, 8 }, + { CLKID_AHB_DMA0, "dma0", "ahb_div", + HW_AHBCLKCTRL0, 9 }, + { CLKID_AHB_DMA1, "dma1", "ahb_div", + HW_AHBCLKCTRL0, 10 }, + { CLKID_AHB_UART0, "uart0", "ahb_div", + HW_AHBCLKCTRL0, 11 }, + { CLKID_AHB_UART1, "uart1", "ahb_div", + HW_AHBCLKCTRL0, 12 }, + { CLKID_AHB_UART2, "uart2", "ahb_div", + HW_AHBCLKCTRL0, 13 }, + { CLKID_AHB_UART3, "uart3", "ahb_div", + HW_AHBCLKCTRL0, 14 }, + { CLKID_AHB_UART4, "uart4", "ahb_div", + HW_AHBCLKCTRL0, 15 }, + { CLKID_AHB_UART5, "uart5", "ahb_div", + HW_AHBCLKCTRL0, 16 }, + { CLKID_AHB_UART6, "uart6", "ahb_div", + HW_AHBCLKCTRL0, 17 }, + { CLKID_AHB_UART7, "uart7", "ahb_div", + HW_AHBCLKCTRL0, 18 }, + { CLKID_AHB_UART8, "uart8", "ahb_div", + HW_AHBCLKCTRL0, 19 }, + { CLKID_AHB_UART9, "uart9", "ahb_div", + HW_AHBCLKCTRL0, 20 }, + { CLKID_AHB_I2S0, "i2s0", "ahb_div", + HW_AHBCLKCTRL0, 21 }, + { CLKID_AHB_I2C0, "i2c0", "ahb_div", + HW_AHBCLKCTRL0, 22 }, + { CLKID_AHB_I2C1, "i2c1", "ahb_div", + HW_AHBCLKCTRL0, 23 }, + { CLKID_AHB_SSP0, "ssp0", "ahb_div", + HW_AHBCLKCTRL0, 24 }, + { CLKID_AHB_IOCONFIG, "ioconf", "ahb_div", + HW_AHBCLKCTRL0, 25 }, + { CLKID_AHB_WDT, "wdt", "ahb_div", + HW_AHBCLKCTRL0, 26 }, + { CLKID_AHB_CAN0, "can0", "ahb_div", + HW_AHBCLKCTRL0, 27 }, + { CLKID_AHB_CAN1, "can1", "ahb_div", + HW_AHBCLKCTRL0, 28 }, + { CLKID_AHB_MPWM, "mpwm", "ahb_div", + HW_AHBCLKCTRL0, 29 }, + { CLKID_AHB_SPI0, "spi0", "ahb_div", + HW_AHBCLKCTRL0, 30 }, + { CLKID_AHB_SPI1, "spi1", "ahb_div", + HW_AHBCLKCTRL0, 31 }, + + { CLKID_AHB_QEI, "qei", "ahb_div", + HW_AHBCLKCTRL1, 0 }, + { CLKID_AHB_QUADSPI0, "quadspi0", "ahb_div", + HW_AHBCLKCTRL1, 1 }, + { CLKID_AHB_CAMIF, "capmif", "ahb_div", + HW_AHBCLKCTRL1, 2 }, + { CLKID_AHB_LCDIF, "lcdif", "ahb_div", + HW_AHBCLKCTRL1, 3 }, + { CLKID_AHB_TIMER0, "timer0", "ahb_div", + HW_AHBCLKCTRL1, 4 }, + { CLKID_AHB_TIMER1, "timer1", "ahb_div", + HW_AHBCLKCTRL1, 5 }, + { CLKID_AHB_TIMER2, "timer2", "ahb_div", + HW_AHBCLKCTRL1, 6 }, + { CLKID_AHB_TIMER3, "timer3", "ahb_div", + HW_AHBCLKCTRL1, 7 }, + { CLKID_AHB_IRQ, "irq", "ahb_div", + HW_AHBCLKCTRL1, 8, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RTC, "rtc", "ahb_div", + HW_AHBCLKCTRL1, 9 }, + { CLKID_AHB_NAND, "nand", "ahb_div", + HW_AHBCLKCTRL1, 10 }, + { CLKID_AHB_ADC0, "adc0", "ahb_div", + HW_AHBCLKCTRL1, 11 }, + { CLKID_AHB_LED, "led", "ahb_div", + HW_AHBCLKCTRL1, 12 }, + { CLKID_AHB_DAC0, "dac0", "ahb_div", + HW_AHBCLKCTRL1, 13 }, + { CLKID_AHB_LCD, "lcd", "ahb_div", + HW_AHBCLKCTRL1, 14 }, + { CLKID_AHB_I2S1, "i2s1", "ahb_div", + HW_AHBCLKCTRL1, 15 }, + { CLKID_AHB_MAC1, "mac1", "ahb_div", + HW_AHBCLKCTRL1, 16 }, +}; + +static const char __initdata *main_mux_p[] = {"oscillator", "pll"}; +static const char __initdata *i2s0_mux_p[] = {"oscillator", "pll", "i2s0m_div"}; +static const char __initdata *i2s1_mux_p[] = {"oscillator", "pll", "i2s1m_div"}; +static const char __initdata *clkout_mux_p[] = {"oscillator", "pll", "rtc"}; +static u32 three_mux_table[] = {0, 1, 3}; + +static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { + { 1, three_mux_table, "main_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_MAINCLKSEL, }, + { 1, three_mux_table, "uart_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_UARTCLKSEL, }, + { 1, three_mux_table, "wdt_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_WDTCLKSEL, }, + { 3, three_mux_table, "i2s0_mux", i2s0_mux_p, + ARRAY_SIZE(i2s0_mux_p), HW_I2S0CLKSEL, }, + { 3, three_mux_table, "i2s1_mux", i2s1_mux_p, + ARRAY_SIZE(i2s1_mux_p), HW_I2S1CLKSEL, }, + { 3, three_mux_table, "clkout_mux", clkout_mux_p, + ARRAY_SIZE(clkout_mux_p), HW_CLKOUTCLKSEL, }, +}; + +static void __init asm9260_acc_init(struct device_node *np) +{ + struct clk *clk; + u32 rate; + int n; + u32 accuracy = 0; + + base = of_io_request_and_map(np, 0, np->name); + if (!base) + panic("%s: unable to map resource", np->name); + + /* register pll */ + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; + + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], + clk_names[REFCLK], 0, rate, accuracy); + + if (IS_ERR(clk)) + panic("%s: can't register REFCLK. Check DT!", np->name); + + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; + + mc->parent_names[0] = clk_names[REFCLK]; + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, + mc->num_parents, mc->flags, base + mc->offset, + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); + } + + /* clock mux gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; + + clk = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* clock div cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; + + clks[dc->idx] = clk_register_divider(NULL, dc->name, + dc->parent_name, CLK_SET_RATE_PARENT, + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, + &asm9260_clk_lock); + } + + /* clock ahb gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; + + clks[gd->idx] = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags, base + gd->reg, + gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* check for errors on leaf clocks */ + for (n = 0; n < MAX_CLKS; n++) { + if (!IS_ERR(clks[n])) + continue; + + pr_err("%s: Unable to register leaf clock %d\n", + np->full_name, n); + goto fail; + } + + /* register clk-provider */ + clk_data.clks = clks; + clk_data.clk_num = MAX_CLKS; + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); + return; +fail: + iounmap(base); +} +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", + asm9260_acc_init); diff --git a/include/dt-bindings/clock/alphascale,asm9260.h b/include/dt-bindings/clock/alphascale,asm9260.h new file mode 100644 index 0000000..04e8db2 --- /dev/null +++ b/include/dt-bindings/clock/alphascale,asm9260.h @@ -0,0 +1,97 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_CLK_ASM9260_H +#define _DT_BINDINGS_CLK_ASM9260_H + +/* ahb gate */ +#define CLKID_AHB_ROM 0 +#define CLKID_AHB_RAM 1 +#define CLKID_AHB_GPIO 2 +#define CLKID_AHB_MAC 3 +#define CLKID_AHB_EMI 4 +#define CLKID_AHB_USB0 5 +#define CLKID_AHB_USB1 6 +#define CLKID_AHB_DMA0 7 +#define CLKID_AHB_DMA1 8 +#define CLKID_AHB_UART0 9 +#define CLKID_AHB_UART1 10 +#define CLKID_AHB_UART2 11 +#define CLKID_AHB_UART3 12 +#define CLKID_AHB_UART4 13 +#define CLKID_AHB_UART5 14 +#define CLKID_AHB_UART6 15 +#define CLKID_AHB_UART7 16 +#define CLKID_AHB_UART8 17 +#define CLKID_AHB_UART9 18 +#define CLKID_AHB_I2S0 19 +#define CLKID_AHB_I2C0 20 +#define CLKID_AHB_I2C1 21 +#define CLKID_AHB_SSP0 22 +#define CLKID_AHB_IOCONFIG 23 +#define CLKID_AHB_WDT 24 +#define CLKID_AHB_CAN0 25 +#define CLKID_AHB_CAN1 26 +#define CLKID_AHB_MPWM 27 +#define CLKID_AHB_SPI0 28 +#define CLKID_AHB_SPI1 29 +#define CLKID_AHB_QEI 30 +#define CLKID_AHB_QUADSPI0 31 +#define CLKID_AHB_CAMIF 32 +#define CLKID_AHB_LCDIF 33 +#define CLKID_AHB_TIMER0 34 +#define CLKID_AHB_TIMER1 35 +#define CLKID_AHB_TIMER2 36 +#define CLKID_AHB_TIMER3 37 +#define CLKID_AHB_IRQ 38 +#define CLKID_AHB_RTC 39 +#define CLKID_AHB_NAND 40 +#define CLKID_AHB_ADC0 41 +#define CLKID_AHB_LED 42 +#define CLKID_AHB_DAC0 43 +#define CLKID_AHB_LCD 44 +#define CLKID_AHB_I2S1 45 +#define CLKID_AHB_MAC1 46 + +/* devider */ +#define CLKID_SYS_CPU 47 +#define CLKID_SYS_AHB 48 +#define CLKID_SYS_I2S0M 49 +#define CLKID_SYS_I2S0S 50 +#define CLKID_SYS_I2S1M 51 +#define CLKID_SYS_I2S1S 52 +#define CLKID_SYS_UART0 53 +#define CLKID_SYS_UART1 54 +#define CLKID_SYS_UART2 55 +#define CLKID_SYS_UART3 56 +#define CLKID_SYS_UART4 56 +#define CLKID_SYS_UART5 57 +#define CLKID_SYS_UART6 58 +#define CLKID_SYS_UART7 59 +#define CLKID_SYS_UART8 60 +#define CLKID_SYS_UART9 61 +#define CLKID_SYS_SPI0 62 +#define CLKID_SYS_SPI1 63 +#define CLKID_SYS_QUADSPI 64 +#define CLKID_SYS_SSP0 65 +#define CLKID_SYS_NAND 66 +#define CLKID_SYS_TRACE 67 +#define CLKID_SYS_CAMM 68 +#define CLKID_SYS_WDT 69 +#define CLKID_SYS_CLKOUT 70 +#define CLKID_SYS_MAC 71 +#define CLKID_SYS_LCD 72 +#define CLKID_SYS_ADCANA 73 + +#define MAX_CLKS 74 +#endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH] ARM: clk: add clk-asm9260 driver @ 2015-01-08 8:59 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 8:59 UTC (permalink / raw) To: linux-arm-kernel Provide CLK support for Alphascale ASM9260 SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 359 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 457 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index d5fba5b..3c41a68 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -16,6 +16,7 @@ endif # hardware specific clock types # please keep this section sorted lexicographically by file/directory path name +obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c new file mode 100644 index 0000000..6b1c220 --- /dev/null +++ b/drivers/clk/clk-asm9260.c @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/clk-provider.h> +#include <linux/spinlock.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <dt-bindings/clock/alphascale,asm9260.h> + +#define HW_AHBCLKCTRL0 0x0020 +#define HW_AHBCLKCTRL1 0x0030 +#define HW_SYSPLLCTRL 0x0100 +#define HW_MAINCLKSEL 0x0120 +#define HW_MAINCLKUEN 0x0124 +#define HW_UARTCLKSEL 0x0128 +#define HW_UARTCLKUEN 0x012c +#define HW_I2S0CLKSEL 0x0130 +#define HW_I2S0CLKUEN 0x0134 +#define HW_I2S1CLKSEL 0x0138 +#define HW_I2S1CLKUEN 0x013c +#define HW_WDTCLKSEL 0x0160 +#define HW_WDTCLKUEN 0x0164 +#define HW_CLKOUTCLKSEL 0x0170 +#define HW_CLKOUTCLKUEN 0x0174 +#define HW_CPUCLKDIV 0x017c +#define HW_SYSAHBCLKDIV 0x0180 +#define HW_I2S0MCLKDIV 0x0190 +#define HW_I2S0SCLKDIV 0x0194 +#define HW_I2S1MCLKDIV 0x0188 +#define HW_I2S1SCLKDIV 0x018c +#define HW_UART0CLKDIV 0x0198 +#define HW_UART1CLKDIV 0x019c +#define HW_UART2CLKDIV 0x01a0 +#define HW_UART3CLKDIV 0x01a4 +#define HW_UART4CLKDIV 0x01a8 +#define HW_UART5CLKDIV 0x01ac +#define HW_UART6CLKDIV 0x01b0 +#define HW_UART7CLKDIV 0x01b4 +#define HW_UART8CLKDIV 0x01b8 +#define HW_UART9CLKDIV 0x01bc +#define HW_SPI0CLKDIV 0x01c0 +#define HW_SPI1CLKDIV 0x01c4 +#define HW_QUADSPICLKDIV 0x01c8 +#define HW_SSP0CLKDIV 0x01d0 +#define HW_NANDCLKDIV 0x01d4 +#define HW_TRACECLKDIV 0x01e0 +#define HW_CAMMCLKDIV 0x01e8 +#define HW_WDTCLKDIV 0x01ec +#define HW_CLKOUTCLKDIV 0x01f4 +#define HW_MACCLKDIV 0x01f8 +#define HW_LCDCLKDIV 0x01fc +#define HW_ADCANACLKDIV 0x0200 + +static struct clk *clks[MAX_CLKS]; +static struct clk_onecell_data clk_data; +static DEFINE_SPINLOCK(asm9260_clk_lock); + +struct asm9260_div_clk { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; +}; + +struct asm9260_gate_data { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; + u8 bit_idx; + unsigned long flags; +}; + +struct asm9260_mux_clock { + u8 mask; + u32 *table; + const char *name; + const char **parent_names; + u8 num_parents; + unsigned long offset; + unsigned long flags; +}; + +static void __iomem *base; + +enum { + REFCLK, SYSPLL, I2S0_MCLK, I2S1_MCLK, RTC_OSC, USB_PLL, +}; + +static const char *clk_names[] = { + [REFCLK] = "oscillator", + [SYSPLL] = "pll", + [I2S0_MCLK] = "i2s0_mclk", + [I2S1_MCLK] = "i2s1_mclk", + [RTC_OSC] = "rtc_osc", + [USB_PLL] = "usb_pll", +}; + +static const struct asm9260_div_clk asm9260_div_clks[] __initconst = { + { CLKID_SYS_CPU, "cpu_div", "main_gate", HW_CPUCLKDIV }, + { CLKID_SYS_AHB, "ahb_div", "cpu_div", HW_SYSAHBCLKDIV }, + + /* i2s has two deviders: one for only external mclk and internal + * devider for all clks. */ + { CLKID_SYS_I2S0M, "i2s0m_div", "i2s0_mclk", HW_I2S0MCLKDIV }, + { CLKID_SYS_I2S1M, "i2s1m_div", "i2s1_mclk", HW_I2S1MCLKDIV }, + { CLKID_SYS_I2S0S, "i2s0s_div", "i2s0_gate", HW_I2S0SCLKDIV }, + { CLKID_SYS_I2S1S, "i2s1s_div", "i2s0_gate", HW_I2S1SCLKDIV }, + + { CLKID_SYS_UART0, "uart0_div", "uart_gate", HW_UART0CLKDIV }, + { CLKID_SYS_UART1, "uart1_div", "uart_gate", HW_UART1CLKDIV }, + { CLKID_SYS_UART2, "uart2_div", "uart_gate", HW_UART2CLKDIV }, + { CLKID_SYS_UART3, "uart3_div", "uart_gate", HW_UART3CLKDIV }, + { CLKID_SYS_UART4, "uart4_div", "uart_gate", HW_UART4CLKDIV }, + { CLKID_SYS_UART5, "uart5_div", "uart_gate", HW_UART5CLKDIV }, + { CLKID_SYS_UART6, "uart6_div", "uart_gate", HW_UART6CLKDIV }, + { CLKID_SYS_UART7, "uart7_div", "uart_gate", HW_UART7CLKDIV }, + { CLKID_SYS_UART8, "uart8_div", "uart_gate", HW_UART8CLKDIV }, + { CLKID_SYS_UART9, "uart9_div", "uart_gate", HW_UART9CLKDIV }, + + { CLKID_SYS_SPI0, "spi0_div", "main_gate", HW_SPI0CLKDIV }, + { CLKID_SYS_SPI1, "spi1_div", "main_gate", HW_SPI1CLKDIV }, + { CLKID_SYS_QUADSPI, "quadspi_div", "main_gate", HW_QUADSPICLKDIV }, + { CLKID_SYS_SSP0, "ssp0_div", "main_gate", HW_SSP0CLKDIV }, + { CLKID_SYS_NAND, "nand_div", "main_gate", HW_NANDCLKDIV }, + { CLKID_SYS_TRACE, "trace_div", "main_gate", HW_TRACECLKDIV }, + { CLKID_SYS_CAMM, "camm_div", "main_gate", HW_CAMMCLKDIV }, + { CLKID_SYS_MAC, "mac_div", "main_gate", HW_MACCLKDIV }, + { CLKID_SYS_LCD, "lcd_div", "main_gate", HW_LCDCLKDIV }, + { CLKID_SYS_ADCANA, "adcana_div", "main_gate", HW_ADCANACLKDIV }, + + { CLKID_SYS_WDT, "wdt_div", "wdt_gate", HW_WDTCLKDIV }, + { CLKID_SYS_CLKOUT, "clkout_div", "clkout_gate", HW_CLKOUTCLKDIV }, +}; + +static const struct asm9260_gate_data asm9260_mux_gates[] __initconst = { + { 0, "main_gate", "main_mux", HW_MAINCLKUEN, 0 }, + { 0, "uart_gate", "uart_mux", HW_UARTCLKUEN, 0 }, + { 0, "i2s0_gate", "i2s0_mux", HW_I2S0CLKUEN, 0 }, + { 0, "i2s1_gate", "i2s1_mux", HW_I2S1CLKUEN, 0 }, + { 0, "wdt_gate", "wdt_mux", HW_WDTCLKUEN, 0 }, + { 0, "clkout_gate", "clkout_mux", HW_CLKOUTCLKUEN, 0 }, +}; +static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { + /* ahb gates */ + { CLKID_AHB_ROM, "rom", "ahb_div", + HW_AHBCLKCTRL0, 1, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RAM, "ram", "ahb_div", + HW_AHBCLKCTRL0, 2, CLK_IGNORE_UNUSED}, + { CLKID_AHB_GPIO, "gpio", "ahb_div", + HW_AHBCLKCTRL0, 4 }, + { CLKID_AHB_MAC, "mac", "ahb_div", + HW_AHBCLKCTRL0, 5 }, + { CLKID_AHB_EMI, "emi", "ahb_div", + HW_AHBCLKCTRL0, 6, CLK_IGNORE_UNUSED}, + { CLKID_AHB_USB0, "usb0", "ahb_div", + HW_AHBCLKCTRL0, 7 }, + { CLKID_AHB_USB1, "usb1", "ahb_div", + HW_AHBCLKCTRL0, 8 }, + { CLKID_AHB_DMA0, "dma0", "ahb_div", + HW_AHBCLKCTRL0, 9 }, + { CLKID_AHB_DMA1, "dma1", "ahb_div", + HW_AHBCLKCTRL0, 10 }, + { CLKID_AHB_UART0, "uart0", "ahb_div", + HW_AHBCLKCTRL0, 11 }, + { CLKID_AHB_UART1, "uart1", "ahb_div", + HW_AHBCLKCTRL0, 12 }, + { CLKID_AHB_UART2, "uart2", "ahb_div", + HW_AHBCLKCTRL0, 13 }, + { CLKID_AHB_UART3, "uart3", "ahb_div", + HW_AHBCLKCTRL0, 14 }, + { CLKID_AHB_UART4, "uart4", "ahb_div", + HW_AHBCLKCTRL0, 15 }, + { CLKID_AHB_UART5, "uart5", "ahb_div", + HW_AHBCLKCTRL0, 16 }, + { CLKID_AHB_UART6, "uart6", "ahb_div", + HW_AHBCLKCTRL0, 17 }, + { CLKID_AHB_UART7, "uart7", "ahb_div", + HW_AHBCLKCTRL0, 18 }, + { CLKID_AHB_UART8, "uart8", "ahb_div", + HW_AHBCLKCTRL0, 19 }, + { CLKID_AHB_UART9, "uart9", "ahb_div", + HW_AHBCLKCTRL0, 20 }, + { CLKID_AHB_I2S0, "i2s0", "ahb_div", + HW_AHBCLKCTRL0, 21 }, + { CLKID_AHB_I2C0, "i2c0", "ahb_div", + HW_AHBCLKCTRL0, 22 }, + { CLKID_AHB_I2C1, "i2c1", "ahb_div", + HW_AHBCLKCTRL0, 23 }, + { CLKID_AHB_SSP0, "ssp0", "ahb_div", + HW_AHBCLKCTRL0, 24 }, + { CLKID_AHB_IOCONFIG, "ioconf", "ahb_div", + HW_AHBCLKCTRL0, 25 }, + { CLKID_AHB_WDT, "wdt", "ahb_div", + HW_AHBCLKCTRL0, 26 }, + { CLKID_AHB_CAN0, "can0", "ahb_div", + HW_AHBCLKCTRL0, 27 }, + { CLKID_AHB_CAN1, "can1", "ahb_div", + HW_AHBCLKCTRL0, 28 }, + { CLKID_AHB_MPWM, "mpwm", "ahb_div", + HW_AHBCLKCTRL0, 29 }, + { CLKID_AHB_SPI0, "spi0", "ahb_div", + HW_AHBCLKCTRL0, 30 }, + { CLKID_AHB_SPI1, "spi1", "ahb_div", + HW_AHBCLKCTRL0, 31 }, + + { CLKID_AHB_QEI, "qei", "ahb_div", + HW_AHBCLKCTRL1, 0 }, + { CLKID_AHB_QUADSPI0, "quadspi0", "ahb_div", + HW_AHBCLKCTRL1, 1 }, + { CLKID_AHB_CAMIF, "capmif", "ahb_div", + HW_AHBCLKCTRL1, 2 }, + { CLKID_AHB_LCDIF, "lcdif", "ahb_div", + HW_AHBCLKCTRL1, 3 }, + { CLKID_AHB_TIMER0, "timer0", "ahb_div", + HW_AHBCLKCTRL1, 4 }, + { CLKID_AHB_TIMER1, "timer1", "ahb_div", + HW_AHBCLKCTRL1, 5 }, + { CLKID_AHB_TIMER2, "timer2", "ahb_div", + HW_AHBCLKCTRL1, 6 }, + { CLKID_AHB_TIMER3, "timer3", "ahb_div", + HW_AHBCLKCTRL1, 7 }, + { CLKID_AHB_IRQ, "irq", "ahb_div", + HW_AHBCLKCTRL1, 8, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RTC, "rtc", "ahb_div", + HW_AHBCLKCTRL1, 9 }, + { CLKID_AHB_NAND, "nand", "ahb_div", + HW_AHBCLKCTRL1, 10 }, + { CLKID_AHB_ADC0, "adc0", "ahb_div", + HW_AHBCLKCTRL1, 11 }, + { CLKID_AHB_LED, "led", "ahb_div", + HW_AHBCLKCTRL1, 12 }, + { CLKID_AHB_DAC0, "dac0", "ahb_div", + HW_AHBCLKCTRL1, 13 }, + { CLKID_AHB_LCD, "lcd", "ahb_div", + HW_AHBCLKCTRL1, 14 }, + { CLKID_AHB_I2S1, "i2s1", "ahb_div", + HW_AHBCLKCTRL1, 15 }, + { CLKID_AHB_MAC1, "mac1", "ahb_div", + HW_AHBCLKCTRL1, 16 }, +}; + +static const char __initdata *main_mux_p[] = {"oscillator", "pll"}; +static const char __initdata *i2s0_mux_p[] = {"oscillator", "pll", "i2s0m_div"}; +static const char __initdata *i2s1_mux_p[] = {"oscillator", "pll", "i2s1m_div"}; +static const char __initdata *clkout_mux_p[] = {"oscillator", "pll", "rtc"}; +static u32 three_mux_table[] = {0, 1, 3}; + +static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { + { 1, three_mux_table, "main_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_MAINCLKSEL, }, + { 1, three_mux_table, "uart_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_UARTCLKSEL, }, + { 1, three_mux_table, "wdt_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_WDTCLKSEL, }, + { 3, three_mux_table, "i2s0_mux", i2s0_mux_p, + ARRAY_SIZE(i2s0_mux_p), HW_I2S0CLKSEL, }, + { 3, three_mux_table, "i2s1_mux", i2s1_mux_p, + ARRAY_SIZE(i2s1_mux_p), HW_I2S1CLKSEL, }, + { 3, three_mux_table, "clkout_mux", clkout_mux_p, + ARRAY_SIZE(clkout_mux_p), HW_CLKOUTCLKSEL, }, +}; + +static void __init asm9260_acc_init(struct device_node *np) +{ + struct clk *clk; + u32 rate; + int n; + u32 accuracy = 0; + + base = of_io_request_and_map(np, 0, np->name); + if (!base) + panic("%s: unable to map resource", np->name); + + /* register pll */ + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; + + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], + clk_names[REFCLK], 0, rate, accuracy); + + if (IS_ERR(clk)) + panic("%s: can't register REFCLK. Check DT!", np->name); + + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; + + mc->parent_names[0] = clk_names[REFCLK]; + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, + mc->num_parents, mc->flags, base + mc->offset, + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); + } + + /* clock mux gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; + + clk = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* clock div cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; + + clks[dc->idx] = clk_register_divider(NULL, dc->name, + dc->parent_name, CLK_SET_RATE_PARENT, + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, + &asm9260_clk_lock); + } + + /* clock ahb gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; + + clks[gd->idx] = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags, base + gd->reg, + gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* check for errors on leaf clocks */ + for (n = 0; n < MAX_CLKS; n++) { + if (!IS_ERR(clks[n])) + continue; + + pr_err("%s: Unable to register leaf clock %d\n", + np->full_name, n); + goto fail; + } + + /* register clk-provider */ + clk_data.clks = clks; + clk_data.clk_num = MAX_CLKS; + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); + return; +fail: + iounmap(base); +} +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", + asm9260_acc_init); diff --git a/include/dt-bindings/clock/alphascale,asm9260.h b/include/dt-bindings/clock/alphascale,asm9260.h new file mode 100644 index 0000000..04e8db2 --- /dev/null +++ b/include/dt-bindings/clock/alphascale,asm9260.h @@ -0,0 +1,97 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_CLK_ASM9260_H +#define _DT_BINDINGS_CLK_ASM9260_H + +/* ahb gate */ +#define CLKID_AHB_ROM 0 +#define CLKID_AHB_RAM 1 +#define CLKID_AHB_GPIO 2 +#define CLKID_AHB_MAC 3 +#define CLKID_AHB_EMI 4 +#define CLKID_AHB_USB0 5 +#define CLKID_AHB_USB1 6 +#define CLKID_AHB_DMA0 7 +#define CLKID_AHB_DMA1 8 +#define CLKID_AHB_UART0 9 +#define CLKID_AHB_UART1 10 +#define CLKID_AHB_UART2 11 +#define CLKID_AHB_UART3 12 +#define CLKID_AHB_UART4 13 +#define CLKID_AHB_UART5 14 +#define CLKID_AHB_UART6 15 +#define CLKID_AHB_UART7 16 +#define CLKID_AHB_UART8 17 +#define CLKID_AHB_UART9 18 +#define CLKID_AHB_I2S0 19 +#define CLKID_AHB_I2C0 20 +#define CLKID_AHB_I2C1 21 +#define CLKID_AHB_SSP0 22 +#define CLKID_AHB_IOCONFIG 23 +#define CLKID_AHB_WDT 24 +#define CLKID_AHB_CAN0 25 +#define CLKID_AHB_CAN1 26 +#define CLKID_AHB_MPWM 27 +#define CLKID_AHB_SPI0 28 +#define CLKID_AHB_SPI1 29 +#define CLKID_AHB_QEI 30 +#define CLKID_AHB_QUADSPI0 31 +#define CLKID_AHB_CAMIF 32 +#define CLKID_AHB_LCDIF 33 +#define CLKID_AHB_TIMER0 34 +#define CLKID_AHB_TIMER1 35 +#define CLKID_AHB_TIMER2 36 +#define CLKID_AHB_TIMER3 37 +#define CLKID_AHB_IRQ 38 +#define CLKID_AHB_RTC 39 +#define CLKID_AHB_NAND 40 +#define CLKID_AHB_ADC0 41 +#define CLKID_AHB_LED 42 +#define CLKID_AHB_DAC0 43 +#define CLKID_AHB_LCD 44 +#define CLKID_AHB_I2S1 45 +#define CLKID_AHB_MAC1 46 + +/* devider */ +#define CLKID_SYS_CPU 47 +#define CLKID_SYS_AHB 48 +#define CLKID_SYS_I2S0M 49 +#define CLKID_SYS_I2S0S 50 +#define CLKID_SYS_I2S1M 51 +#define CLKID_SYS_I2S1S 52 +#define CLKID_SYS_UART0 53 +#define CLKID_SYS_UART1 54 +#define CLKID_SYS_UART2 55 +#define CLKID_SYS_UART3 56 +#define CLKID_SYS_UART4 56 +#define CLKID_SYS_UART5 57 +#define CLKID_SYS_UART6 58 +#define CLKID_SYS_UART7 59 +#define CLKID_SYS_UART8 60 +#define CLKID_SYS_UART9 61 +#define CLKID_SYS_SPI0 62 +#define CLKID_SYS_SPI1 63 +#define CLKID_SYS_QUADSPI 64 +#define CLKID_SYS_SSP0 65 +#define CLKID_SYS_NAND 66 +#define CLKID_SYS_TRACE 67 +#define CLKID_SYS_CAMM 68 +#define CLKID_SYS_WDT 69 +#define CLKID_SYS_CLKOUT 70 +#define CLKID_SYS_MAC 71 +#define CLKID_SYS_LCD 72 +#define CLKID_SYS_ADCANA 73 + +#define MAX_CLKS 74 +#endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* Re: [PATCH] ARM: clk: add clk-asm9260 driver 2015-01-08 8:59 ` Oleksij Rempel @ 2015-01-14 23:02 ` Mike Turquette -1 siblings, 0 replies; 81+ messages in thread From: Mike Turquette @ 2015-01-14 23:02 UTC (permalink / raw) To: Oleksij Rempel, linux-kernel, linux-arm-kernel; +Cc: Oleksij Rempel Quoting Oleksij Rempel (2015-01-08 00:59:27) > diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c > new file mode 100644 > index 0000000..6b1c220 > --- /dev/null > +++ b/drivers/clk/clk-asm9260.c <snip> > +static const char *clk_names[] = { > + [REFCLK] = "oscillator", > + [SYSPLL] = "pll", > + [I2S0_MCLK] = "i2s0_mclk", > + [I2S1_MCLK] = "i2s1_mclk", > + [RTC_OSC] = "rtc_osc", > + [USB_PLL] = "usb_pll", > +}; Why keep this list of names? Only clk_names[REFCLK] is used below and it is overwritten by the name supplied by DT. <snip> > +static void __init asm9260_acc_init(struct device_node *np) > +{ > + struct clk *clk; > + u32 rate; > + int n; > + u32 accuracy = 0; > + > + base = of_io_request_and_map(np, 0, np->name); > + if (!base) > + panic("%s: unable to map resource", np->name); > + > + /* register pll */ > + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; > + > + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); > + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); > + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], > + clk_names[REFCLK], 0, rate, accuracy); This is different. Why do the PLLs inherit REFCLKs accuracy? Please see __clk_recalc_accuracies in drivers/clk/clk.c if you haven't already. We propagate accuracy through the clock tree already. > + > + if (IS_ERR(clk)) > + panic("%s: can't register REFCLK. Check DT!", np->name); > + > + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { > + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; > + > + mc->parent_names[0] = clk_names[REFCLK]; > + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, > + mc->num_parents, mc->flags, base + mc->offset, > + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); > + } > + > + /* clock mux gate cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { > + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; > + > + clk = clk_register_gate(NULL, gd->name, > + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, > + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); > + } > + > + /* clock div cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { > + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; > + > + clks[dc->idx] = clk_register_divider(NULL, dc->name, > + dc->parent_name, CLK_SET_RATE_PARENT, > + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, > + &asm9260_clk_lock); > + } > + > + /* clock ahb gate cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { > + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; > + > + clks[gd->idx] = clk_register_gate(NULL, gd->name, > + gd->parent_name, gd->flags, base + gd->reg, > + gd->bit_idx, 0, &asm9260_clk_lock); > + } > + > + /* check for errors on leaf clocks */ > + for (n = 0; n < MAX_CLKS; n++) { > + if (!IS_ERR(clks[n])) > + continue; > + > + pr_err("%s: Unable to register leaf clock %d\n", > + np->full_name, n); > + goto fail; > + } > + > + /* register clk-provider */ > + clk_data.clks = clks; > + clk_data.clk_num = MAX_CLKS; > + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); > + return; > +fail: > + iounmap(base); > +} > +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", > + asm9260_acc_init); Where is the DT binding definition for this clock provider? Thanks, Mike ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clk: add clk-asm9260 driver @ 2015-01-14 23:02 ` Mike Turquette 0 siblings, 0 replies; 81+ messages in thread From: Mike Turquette @ 2015-01-14 23:02 UTC (permalink / raw) To: linux-arm-kernel Quoting Oleksij Rempel (2015-01-08 00:59:27) > diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c > new file mode 100644 > index 0000000..6b1c220 > --- /dev/null > +++ b/drivers/clk/clk-asm9260.c <snip> > +static const char *clk_names[] = { > + [REFCLK] = "oscillator", > + [SYSPLL] = "pll", > + [I2S0_MCLK] = "i2s0_mclk", > + [I2S1_MCLK] = "i2s1_mclk", > + [RTC_OSC] = "rtc_osc", > + [USB_PLL] = "usb_pll", > +}; Why keep this list of names? Only clk_names[REFCLK] is used below and it is overwritten by the name supplied by DT. <snip> > +static void __init asm9260_acc_init(struct device_node *np) > +{ > + struct clk *clk; > + u32 rate; > + int n; > + u32 accuracy = 0; > + > + base = of_io_request_and_map(np, 0, np->name); > + if (!base) > + panic("%s: unable to map resource", np->name); > + > + /* register pll */ > + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; > + > + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); > + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); > + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], > + clk_names[REFCLK], 0, rate, accuracy); This is different. Why do the PLLs inherit REFCLKs accuracy? Please see __clk_recalc_accuracies in drivers/clk/clk.c if you haven't already. We propagate accuracy through the clock tree already. > + > + if (IS_ERR(clk)) > + panic("%s: can't register REFCLK. Check DT!", np->name); > + > + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { > + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; > + > + mc->parent_names[0] = clk_names[REFCLK]; > + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, > + mc->num_parents, mc->flags, base + mc->offset, > + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); > + } > + > + /* clock mux gate cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { > + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; > + > + clk = clk_register_gate(NULL, gd->name, > + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, > + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); > + } > + > + /* clock div cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { > + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; > + > + clks[dc->idx] = clk_register_divider(NULL, dc->name, > + dc->parent_name, CLK_SET_RATE_PARENT, > + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, > + &asm9260_clk_lock); > + } > + > + /* clock ahb gate cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { > + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; > + > + clks[gd->idx] = clk_register_gate(NULL, gd->name, > + gd->parent_name, gd->flags, base + gd->reg, > + gd->bit_idx, 0, &asm9260_clk_lock); > + } > + > + /* check for errors on leaf clocks */ > + for (n = 0; n < MAX_CLKS; n++) { > + if (!IS_ERR(clks[n])) > + continue; > + > + pr_err("%s: Unable to register leaf clock %d\n", > + np->full_name, n); > + goto fail; > + } > + > + /* register clk-provider */ > + clk_data.clks = clks; > + clk_data.clk_num = MAX_CLKS; > + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); > + return; > +fail: > + iounmap(base); > +} > +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", > + asm9260_acc_init); Where is the DT binding definition for this clock provider? Thanks, Mike ^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH] ARM: clk: add clk-asm9260 driver 2015-01-14 23:02 ` Mike Turquette @ 2015-01-15 9:45 ` Oleksij Rempel -1 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-15 9:45 UTC (permalink / raw) To: Mike Turquette, linux-kernel, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 2587 bytes --] Am 15.01.2015 um 00:02 schrieb Mike Turquette: > Quoting Oleksij Rempel (2015-01-08 00:59:27) >> diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c >> new file mode 100644 >> index 0000000..6b1c220 >> --- /dev/null >> +++ b/drivers/clk/clk-asm9260.c > > <snip> > >> +static const char *clk_names[] = { >> + [REFCLK] = "oscillator", >> + [SYSPLL] = "pll", >> + [I2S0_MCLK] = "i2s0_mclk", >> + [I2S1_MCLK] = "i2s1_mclk", >> + [RTC_OSC] = "rtc_osc", >> + [USB_PLL] = "usb_pll", >> +}; > > Why keep this list of names? Only clk_names[REFCLK] is used below and it > is overwritten by the name supplied by DT. Ok. > <snip> > >> +static void __init asm9260_acc_init(struct device_node *np) >> +{ >> + struct clk *clk; >> + u32 rate; >> + int n; >> + u32 accuracy = 0; >> + >> + base = of_io_request_and_map(np, 0, np->name); >> + if (!base) >> + panic("%s: unable to map resource", np->name); >> + >> + /* register pll */ >> + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; >> + >> + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); >> + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); >> + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], >> + clk_names[REFCLK], 0, rate, accuracy); > > This is different. Why do the PLLs inherit REFCLKs accuracy? Please see > __clk_recalc_accuracies in drivers/clk/clk.c if you haven't already. We > propagate accuracy through the clock tree already. clk_register_fixed_rate overwrite accuracy to 0. If i use clk_register_fixed_rate, then half of my clocks has accuracy = 0. >> + >> + if (IS_ERR(clk)) >> + panic("%s: can't register REFCLK. Check DT!", np->name); >> + <snip> >> + >> + /* register clk-provider */ >> + clk_data.clks = clks; >> + clk_data.clk_num = MAX_CLKS; >> + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); >> + return; >> +fail: >> + iounmap(base); >> +} >> +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", >> + asm9260_acc_init); > > Where is the DT binding definition for this clock provider? > > Thanks, > Mike > do you mean this patch? http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/293147.html (probably not last version) Should i resend it to you? -- Regards, Oleksij [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 213 bytes --] ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clk: add clk-asm9260 driver @ 2015-01-15 9:45 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-15 9:45 UTC (permalink / raw) To: linux-arm-kernel Am 15.01.2015 um 00:02 schrieb Mike Turquette: > Quoting Oleksij Rempel (2015-01-08 00:59:27) >> diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c >> new file mode 100644 >> index 0000000..6b1c220 >> --- /dev/null >> +++ b/drivers/clk/clk-asm9260.c > > <snip> > >> +static const char *clk_names[] = { >> + [REFCLK] = "oscillator", >> + [SYSPLL] = "pll", >> + [I2S0_MCLK] = "i2s0_mclk", >> + [I2S1_MCLK] = "i2s1_mclk", >> + [RTC_OSC] = "rtc_osc", >> + [USB_PLL] = "usb_pll", >> +}; > > Why keep this list of names? Only clk_names[REFCLK] is used below and it > is overwritten by the name supplied by DT. Ok. > <snip> > >> +static void __init asm9260_acc_init(struct device_node *np) >> +{ >> + struct clk *clk; >> + u32 rate; >> + int n; >> + u32 accuracy = 0; >> + >> + base = of_io_request_and_map(np, 0, np->name); >> + if (!base) >> + panic("%s: unable to map resource", np->name); >> + >> + /* register pll */ >> + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; >> + >> + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); >> + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); >> + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], >> + clk_names[REFCLK], 0, rate, accuracy); > > This is different. Why do the PLLs inherit REFCLKs accuracy? Please see > __clk_recalc_accuracies in drivers/clk/clk.c if you haven't already. We > propagate accuracy through the clock tree already. clk_register_fixed_rate overwrite accuracy to 0. If i use clk_register_fixed_rate, then half of my clocks has accuracy = 0. >> + >> + if (IS_ERR(clk)) >> + panic("%s: can't register REFCLK. Check DT!", np->name); >> + <snip> >> + >> + /* register clk-provider */ >> + clk_data.clks = clks; >> + clk_data.clk_num = MAX_CLKS; >> + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); >> + return; >> +fail: >> + iounmap(base); >> +} >> +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", >> + asm9260_acc_init); > > Where is the DT binding definition for this clock provider? > > Thanks, > Mike > do you mean this patch? http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/293147.html (probably not last version) Should i resend it to you? -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150115/922f2d38/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH] ARM: clk: add clk-asm9260 driver 2015-01-15 9:45 ` Oleksij Rempel @ 2015-01-19 17:22 ` Mike Turquette -1 siblings, 0 replies; 81+ messages in thread From: Mike Turquette @ 2015-01-19 17:22 UTC (permalink / raw) To: Oleksij Rempel, linux-kernel, linux-arm-kernel Quoting Oleksij Rempel (2015-01-15 01:45:32) > Am 15.01.2015 um 00:02 schrieb Mike Turquette: > > Quoting Oleksij Rempel (2015-01-08 00:59:27) > >> diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c > >> new file mode 100644 > >> index 0000000..6b1c220 > >> --- /dev/null > >> +++ b/drivers/clk/clk-asm9260.c > > > > <snip> > > > >> +static const char *clk_names[] = { > >> + [REFCLK] = "oscillator", > >> + [SYSPLL] = "pll", > >> + [I2S0_MCLK] = "i2s0_mclk", > >> + [I2S1_MCLK] = "i2s1_mclk", > >> + [RTC_OSC] = "rtc_osc", > >> + [USB_PLL] = "usb_pll", > >> +}; > > > > Why keep this list of names? Only clk_names[REFCLK] is used below and it > > is overwritten by the name supplied by DT. > > Ok. > > > <snip> > > > >> +static void __init asm9260_acc_init(struct device_node *np) > >> +{ > >> + struct clk *clk; > >> + u32 rate; > >> + int n; > >> + u32 accuracy = 0; > >> + > >> + base = of_io_request_and_map(np, 0, np->name); > >> + if (!base) > >> + panic("%s: unable to map resource", np->name); > >> + > >> + /* register pll */ > >> + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; > >> + > >> + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); > >> + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); > >> + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], > >> + clk_names[REFCLK], 0, rate, accuracy); > > > > This is different. Why do the PLLs inherit REFCLKs accuracy? Please see > > __clk_recalc_accuracies in drivers/clk/clk.c if you haven't already. We > > propagate accuracy through the clock tree already. > > clk_register_fixed_rate overwrite accuracy to 0. If i use > clk_register_fixed_rate, then half of my clocks has accuracy = 0. Ah, interesting. This is a bug that should be fixed. If a fixed-rate clock has a parent with a non-zero accuracy then we should propagate that accuracy value at registration-time. I'll look into this soon and your solution is fine for now. We can always clean it up later. > > >> + > >> + if (IS_ERR(clk)) > >> + panic("%s: can't register REFCLK. Check DT!", np->name); > >> + > > <snip> > > >> + > >> + /* register clk-provider */ > >> + clk_data.clks = clks; > >> + clk_data.clk_num = MAX_CLKS; > >> + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); > >> + return; > >> +fail: > >> + iounmap(base); > >> +} > >> +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", > >> + asm9260_acc_init); > > > > Where is the DT binding definition for this clock provider? > > > > Thanks, > > Mike > > > > do you mean this patch? > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/293147.html > (probably not last version) > Should i resend it to you? No need to resend. DT binding description looks fine (you can add my Reviewed-by if it is not yet merged), but I like to make sure that the code doesn't get merged before the binding definition. Regards, Mike > > -- > Regards, > Oleksij > ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clk: add clk-asm9260 driver @ 2015-01-19 17:22 ` Mike Turquette 0 siblings, 0 replies; 81+ messages in thread From: Mike Turquette @ 2015-01-19 17:22 UTC (permalink / raw) To: linux-arm-kernel Quoting Oleksij Rempel (2015-01-15 01:45:32) > Am 15.01.2015 um 00:02 schrieb Mike Turquette: > > Quoting Oleksij Rempel (2015-01-08 00:59:27) > >> diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c > >> new file mode 100644 > >> index 0000000..6b1c220 > >> --- /dev/null > >> +++ b/drivers/clk/clk-asm9260.c > > > > <snip> > > > >> +static const char *clk_names[] = { > >> + [REFCLK] = "oscillator", > >> + [SYSPLL] = "pll", > >> + [I2S0_MCLK] = "i2s0_mclk", > >> + [I2S1_MCLK] = "i2s1_mclk", > >> + [RTC_OSC] = "rtc_osc", > >> + [USB_PLL] = "usb_pll", > >> +}; > > > > Why keep this list of names? Only clk_names[REFCLK] is used below and it > > is overwritten by the name supplied by DT. > > Ok. > > > <snip> > > > >> +static void __init asm9260_acc_init(struct device_node *np) > >> +{ > >> + struct clk *clk; > >> + u32 rate; > >> + int n; > >> + u32 accuracy = 0; > >> + > >> + base = of_io_request_and_map(np, 0, np->name); > >> + if (!base) > >> + panic("%s: unable to map resource", np->name); > >> + > >> + /* register pll */ > >> + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; > >> + > >> + clk_names[REFCLK] = of_clk_get_parent_name(np, 0); > >> + accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK])); > >> + clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL], > >> + clk_names[REFCLK], 0, rate, accuracy); > > > > This is different. Why do the PLLs inherit REFCLKs accuracy? Please see > > __clk_recalc_accuracies in drivers/clk/clk.c if you haven't already. We > > propagate accuracy through the clock tree already. > > clk_register_fixed_rate overwrite accuracy to 0. If i use > clk_register_fixed_rate, then half of my clocks has accuracy = 0. Ah, interesting. This is a bug that should be fixed. If a fixed-rate clock has a parent with a non-zero accuracy then we should propagate that accuracy value at registration-time. I'll look into this soon and your solution is fine for now. We can always clean it up later. > > >> + > >> + if (IS_ERR(clk)) > >> + panic("%s: can't register REFCLK. Check DT!", np->name); > >> + > > <snip> > > >> + > >> + /* register clk-provider */ > >> + clk_data.clks = clks; > >> + clk_data.clk_num = MAX_CLKS; > >> + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); > >> + return; > >> +fail: > >> + iounmap(base); > >> +} > >> +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", > >> + asm9260_acc_init); > > > > Where is the DT binding definition for this clock provider? > > > > Thanks, > > Mike > > > > do you mean this patch? > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/293147.html > (probably not last version) > Should i resend it to you? No need to resend. DT binding description looks fine (you can add my Reviewed-by if it is not yet merged), but I like to make sure that the code doesn't get merged before the binding definition. Regards, Mike > > -- > Regards, > Oleksij > ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2] ARM: clk: add clk-asm9260 driver 2015-01-19 17:22 ` Mike Turquette (?) @ 2015-01-20 9:23 ` Oleksij Rempel 2015-01-20 18:13 ` Mike Turquette -1 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2015-01-20 9:23 UTC (permalink / raw) To: mturquette, linux-kernel; +Cc: Oleksij Rempel Provide CLK support for Alphascale ASM9260 SoC. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/clk/Makefile | 1 + drivers/clk/clk-asm9260.c | 348 +++++++++++++++++++++++++ include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ 3 files changed, 446 insertions(+) create mode 100644 drivers/clk/clk-asm9260.c create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index d5fba5b..3c41a68 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -16,6 +16,7 @@ endif # hardware specific clock types # please keep this section sorted lexicographically by file/directory path name +obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c new file mode 100644 index 0000000..88f4ff6 --- /dev/null +++ b/drivers/clk/clk-asm9260.c @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/clk-provider.h> +#include <linux/spinlock.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <dt-bindings/clock/alphascale,asm9260.h> + +#define HW_AHBCLKCTRL0 0x0020 +#define HW_AHBCLKCTRL1 0x0030 +#define HW_SYSPLLCTRL 0x0100 +#define HW_MAINCLKSEL 0x0120 +#define HW_MAINCLKUEN 0x0124 +#define HW_UARTCLKSEL 0x0128 +#define HW_UARTCLKUEN 0x012c +#define HW_I2S0CLKSEL 0x0130 +#define HW_I2S0CLKUEN 0x0134 +#define HW_I2S1CLKSEL 0x0138 +#define HW_I2S1CLKUEN 0x013c +#define HW_WDTCLKSEL 0x0160 +#define HW_WDTCLKUEN 0x0164 +#define HW_CLKOUTCLKSEL 0x0170 +#define HW_CLKOUTCLKUEN 0x0174 +#define HW_CPUCLKDIV 0x017c +#define HW_SYSAHBCLKDIV 0x0180 +#define HW_I2S0MCLKDIV 0x0190 +#define HW_I2S0SCLKDIV 0x0194 +#define HW_I2S1MCLKDIV 0x0188 +#define HW_I2S1SCLKDIV 0x018c +#define HW_UART0CLKDIV 0x0198 +#define HW_UART1CLKDIV 0x019c +#define HW_UART2CLKDIV 0x01a0 +#define HW_UART3CLKDIV 0x01a4 +#define HW_UART4CLKDIV 0x01a8 +#define HW_UART5CLKDIV 0x01ac +#define HW_UART6CLKDIV 0x01b0 +#define HW_UART7CLKDIV 0x01b4 +#define HW_UART8CLKDIV 0x01b8 +#define HW_UART9CLKDIV 0x01bc +#define HW_SPI0CLKDIV 0x01c0 +#define HW_SPI1CLKDIV 0x01c4 +#define HW_QUADSPICLKDIV 0x01c8 +#define HW_SSP0CLKDIV 0x01d0 +#define HW_NANDCLKDIV 0x01d4 +#define HW_TRACECLKDIV 0x01e0 +#define HW_CAMMCLKDIV 0x01e8 +#define HW_WDTCLKDIV 0x01ec +#define HW_CLKOUTCLKDIV 0x01f4 +#define HW_MACCLKDIV 0x01f8 +#define HW_LCDCLKDIV 0x01fc +#define HW_ADCANACLKDIV 0x0200 + +static struct clk *clks[MAX_CLKS]; +static struct clk_onecell_data clk_data; +static DEFINE_SPINLOCK(asm9260_clk_lock); + +struct asm9260_div_clk { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; +}; + +struct asm9260_gate_data { + unsigned int idx; + const char *name; + const char *parent_name; + u32 reg; + u8 bit_idx; + unsigned long flags; +}; + +struct asm9260_mux_clock { + u8 mask; + u32 *table; + const char *name; + const char **parent_names; + u8 num_parents; + unsigned long offset; + unsigned long flags; +}; + +static void __iomem *base; + +static const struct asm9260_div_clk asm9260_div_clks[] __initconst = { + { CLKID_SYS_CPU, "cpu_div", "main_gate", HW_CPUCLKDIV }, + { CLKID_SYS_AHB, "ahb_div", "cpu_div", HW_SYSAHBCLKDIV }, + + /* i2s has two deviders: one for only external mclk and internal + * devider for all clks. */ + { CLKID_SYS_I2S0M, "i2s0m_div", "i2s0_mclk", HW_I2S0MCLKDIV }, + { CLKID_SYS_I2S1M, "i2s1m_div", "i2s1_mclk", HW_I2S1MCLKDIV }, + { CLKID_SYS_I2S0S, "i2s0s_div", "i2s0_gate", HW_I2S0SCLKDIV }, + { CLKID_SYS_I2S1S, "i2s1s_div", "i2s0_gate", HW_I2S1SCLKDIV }, + + { CLKID_SYS_UART0, "uart0_div", "uart_gate", HW_UART0CLKDIV }, + { CLKID_SYS_UART1, "uart1_div", "uart_gate", HW_UART1CLKDIV }, + { CLKID_SYS_UART2, "uart2_div", "uart_gate", HW_UART2CLKDIV }, + { CLKID_SYS_UART3, "uart3_div", "uart_gate", HW_UART3CLKDIV }, + { CLKID_SYS_UART4, "uart4_div", "uart_gate", HW_UART4CLKDIV }, + { CLKID_SYS_UART5, "uart5_div", "uart_gate", HW_UART5CLKDIV }, + { CLKID_SYS_UART6, "uart6_div", "uart_gate", HW_UART6CLKDIV }, + { CLKID_SYS_UART7, "uart7_div", "uart_gate", HW_UART7CLKDIV }, + { CLKID_SYS_UART8, "uart8_div", "uart_gate", HW_UART8CLKDIV }, + { CLKID_SYS_UART9, "uart9_div", "uart_gate", HW_UART9CLKDIV }, + + { CLKID_SYS_SPI0, "spi0_div", "main_gate", HW_SPI0CLKDIV }, + { CLKID_SYS_SPI1, "spi1_div", "main_gate", HW_SPI1CLKDIV }, + { CLKID_SYS_QUADSPI, "quadspi_div", "main_gate", HW_QUADSPICLKDIV }, + { CLKID_SYS_SSP0, "ssp0_div", "main_gate", HW_SSP0CLKDIV }, + { CLKID_SYS_NAND, "nand_div", "main_gate", HW_NANDCLKDIV }, + { CLKID_SYS_TRACE, "trace_div", "main_gate", HW_TRACECLKDIV }, + { CLKID_SYS_CAMM, "camm_div", "main_gate", HW_CAMMCLKDIV }, + { CLKID_SYS_MAC, "mac_div", "main_gate", HW_MACCLKDIV }, + { CLKID_SYS_LCD, "lcd_div", "main_gate", HW_LCDCLKDIV }, + { CLKID_SYS_ADCANA, "adcana_div", "main_gate", HW_ADCANACLKDIV }, + + { CLKID_SYS_WDT, "wdt_div", "wdt_gate", HW_WDTCLKDIV }, + { CLKID_SYS_CLKOUT, "clkout_div", "clkout_gate", HW_CLKOUTCLKDIV }, +}; + +static const struct asm9260_gate_data asm9260_mux_gates[] __initconst = { + { 0, "main_gate", "main_mux", HW_MAINCLKUEN, 0 }, + { 0, "uart_gate", "uart_mux", HW_UARTCLKUEN, 0 }, + { 0, "i2s0_gate", "i2s0_mux", HW_I2S0CLKUEN, 0 }, + { 0, "i2s1_gate", "i2s1_mux", HW_I2S1CLKUEN, 0 }, + { 0, "wdt_gate", "wdt_mux", HW_WDTCLKUEN, 0 }, + { 0, "clkout_gate", "clkout_mux", HW_CLKOUTCLKUEN, 0 }, +}; +static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { + /* ahb gates */ + { CLKID_AHB_ROM, "rom", "ahb_div", + HW_AHBCLKCTRL0, 1, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RAM, "ram", "ahb_div", + HW_AHBCLKCTRL0, 2, CLK_IGNORE_UNUSED}, + { CLKID_AHB_GPIO, "gpio", "ahb_div", + HW_AHBCLKCTRL0, 4 }, + { CLKID_AHB_MAC, "mac", "ahb_div", + HW_AHBCLKCTRL0, 5 }, + { CLKID_AHB_EMI, "emi", "ahb_div", + HW_AHBCLKCTRL0, 6, CLK_IGNORE_UNUSED}, + { CLKID_AHB_USB0, "usb0", "ahb_div", + HW_AHBCLKCTRL0, 7 }, + { CLKID_AHB_USB1, "usb1", "ahb_div", + HW_AHBCLKCTRL0, 8 }, + { CLKID_AHB_DMA0, "dma0", "ahb_div", + HW_AHBCLKCTRL0, 9 }, + { CLKID_AHB_DMA1, "dma1", "ahb_div", + HW_AHBCLKCTRL0, 10 }, + { CLKID_AHB_UART0, "uart0", "ahb_div", + HW_AHBCLKCTRL0, 11 }, + { CLKID_AHB_UART1, "uart1", "ahb_div", + HW_AHBCLKCTRL0, 12 }, + { CLKID_AHB_UART2, "uart2", "ahb_div", + HW_AHBCLKCTRL0, 13 }, + { CLKID_AHB_UART3, "uart3", "ahb_div", + HW_AHBCLKCTRL0, 14 }, + { CLKID_AHB_UART4, "uart4", "ahb_div", + HW_AHBCLKCTRL0, 15 }, + { CLKID_AHB_UART5, "uart5", "ahb_div", + HW_AHBCLKCTRL0, 16 }, + { CLKID_AHB_UART6, "uart6", "ahb_div", + HW_AHBCLKCTRL0, 17 }, + { CLKID_AHB_UART7, "uart7", "ahb_div", + HW_AHBCLKCTRL0, 18 }, + { CLKID_AHB_UART8, "uart8", "ahb_div", + HW_AHBCLKCTRL0, 19 }, + { CLKID_AHB_UART9, "uart9", "ahb_div", + HW_AHBCLKCTRL0, 20 }, + { CLKID_AHB_I2S0, "i2s0", "ahb_div", + HW_AHBCLKCTRL0, 21 }, + { CLKID_AHB_I2C0, "i2c0", "ahb_div", + HW_AHBCLKCTRL0, 22 }, + { CLKID_AHB_I2C1, "i2c1", "ahb_div", + HW_AHBCLKCTRL0, 23 }, + { CLKID_AHB_SSP0, "ssp0", "ahb_div", + HW_AHBCLKCTRL0, 24 }, + { CLKID_AHB_IOCONFIG, "ioconf", "ahb_div", + HW_AHBCLKCTRL0, 25 }, + { CLKID_AHB_WDT, "wdt", "ahb_div", + HW_AHBCLKCTRL0, 26 }, + { CLKID_AHB_CAN0, "can0", "ahb_div", + HW_AHBCLKCTRL0, 27 }, + { CLKID_AHB_CAN1, "can1", "ahb_div", + HW_AHBCLKCTRL0, 28 }, + { CLKID_AHB_MPWM, "mpwm", "ahb_div", + HW_AHBCLKCTRL0, 29 }, + { CLKID_AHB_SPI0, "spi0", "ahb_div", + HW_AHBCLKCTRL0, 30 }, + { CLKID_AHB_SPI1, "spi1", "ahb_div", + HW_AHBCLKCTRL0, 31 }, + + { CLKID_AHB_QEI, "qei", "ahb_div", + HW_AHBCLKCTRL1, 0 }, + { CLKID_AHB_QUADSPI0, "quadspi0", "ahb_div", + HW_AHBCLKCTRL1, 1 }, + { CLKID_AHB_CAMIF, "capmif", "ahb_div", + HW_AHBCLKCTRL1, 2 }, + { CLKID_AHB_LCDIF, "lcdif", "ahb_div", + HW_AHBCLKCTRL1, 3 }, + { CLKID_AHB_TIMER0, "timer0", "ahb_div", + HW_AHBCLKCTRL1, 4 }, + { CLKID_AHB_TIMER1, "timer1", "ahb_div", + HW_AHBCLKCTRL1, 5 }, + { CLKID_AHB_TIMER2, "timer2", "ahb_div", + HW_AHBCLKCTRL1, 6 }, + { CLKID_AHB_TIMER3, "timer3", "ahb_div", + HW_AHBCLKCTRL1, 7 }, + { CLKID_AHB_IRQ, "irq", "ahb_div", + HW_AHBCLKCTRL1, 8, CLK_IGNORE_UNUSED}, + { CLKID_AHB_RTC, "rtc", "ahb_div", + HW_AHBCLKCTRL1, 9 }, + { CLKID_AHB_NAND, "nand", "ahb_div", + HW_AHBCLKCTRL1, 10 }, + { CLKID_AHB_ADC0, "adc0", "ahb_div", + HW_AHBCLKCTRL1, 11 }, + { CLKID_AHB_LED, "led", "ahb_div", + HW_AHBCLKCTRL1, 12 }, + { CLKID_AHB_DAC0, "dac0", "ahb_div", + HW_AHBCLKCTRL1, 13 }, + { CLKID_AHB_LCD, "lcd", "ahb_div", + HW_AHBCLKCTRL1, 14 }, + { CLKID_AHB_I2S1, "i2s1", "ahb_div", + HW_AHBCLKCTRL1, 15 }, + { CLKID_AHB_MAC1, "mac1", "ahb_div", + HW_AHBCLKCTRL1, 16 }, +}; + +static const char __initdata *main_mux_p[] = { NULL, NULL }; +static const char __initdata *i2s0_mux_p[] = { NULL, NULL, "i2s0m_div"}; +static const char __initdata *i2s1_mux_p[] = { NULL, NULL, "i2s1m_div"}; +static const char __initdata *clkout_mux_p[] = { NULL, NULL, "rtc"}; +static u32 three_mux_table[] = {0, 1, 3}; + +static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { + { 1, three_mux_table, "main_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_MAINCLKSEL, }, + { 1, three_mux_table, "uart_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_UARTCLKSEL, }, + { 1, three_mux_table, "wdt_mux", main_mux_p, + ARRAY_SIZE(main_mux_p), HW_WDTCLKSEL, }, + { 3, three_mux_table, "i2s0_mux", i2s0_mux_p, + ARRAY_SIZE(i2s0_mux_p), HW_I2S0CLKSEL, }, + { 3, three_mux_table, "i2s1_mux", i2s1_mux_p, + ARRAY_SIZE(i2s1_mux_p), HW_I2S1CLKSEL, }, + { 3, three_mux_table, "clkout_mux", clkout_mux_p, + ARRAY_SIZE(clkout_mux_p), HW_CLKOUTCLKSEL, }, +}; + +static void __init asm9260_acc_init(struct device_node *np) +{ + struct clk *clk; + const char *ref_clk, *pll_clk = "pll"; + u32 rate; + int n; + u32 accuracy = 0; + + base = of_io_request_and_map(np, 0, np->name); + if (!base) + panic("%s: unable to map resource", np->name); + + /* register pll */ + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; + + ref_clk = of_clk_get_parent_name(np, 0); + accuracy = clk_get_accuracy(__clk_lookup(ref_clk)); + clk = clk_register_fixed_rate_with_accuracy(NULL, pll_clk, + ref_clk, 0, rate, accuracy); + + if (IS_ERR(clk)) + panic("%s: can't register REFCLK. Check DT!", np->name); + + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; + + mc->parent_names[0] = ref_clk; + mc->parent_names[1] = pll_clk; + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, + mc->num_parents, mc->flags, base + mc->offset, + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); + } + + /* clock mux gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; + + clk = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* clock div cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; + + clks[dc->idx] = clk_register_divider(NULL, dc->name, + dc->parent_name, CLK_SET_RATE_PARENT, + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, + &asm9260_clk_lock); + } + + /* clock ahb gate cells */ + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; + + clks[gd->idx] = clk_register_gate(NULL, gd->name, + gd->parent_name, gd->flags, base + gd->reg, + gd->bit_idx, 0, &asm9260_clk_lock); + } + + /* check for errors on leaf clocks */ + for (n = 0; n < MAX_CLKS; n++) { + if (!IS_ERR(clks[n])) + continue; + + pr_err("%s: Unable to register leaf clock %d\n", + np->full_name, n); + goto fail; + } + + /* register clk-provider */ + clk_data.clks = clks; + clk_data.clk_num = MAX_CLKS; + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); + return; +fail: + iounmap(base); +} +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", + asm9260_acc_init); diff --git a/include/dt-bindings/clock/alphascale,asm9260.h b/include/dt-bindings/clock/alphascale,asm9260.h new file mode 100644 index 0000000..04e8db2 --- /dev/null +++ b/include/dt-bindings/clock/alphascale,asm9260.h @@ -0,0 +1,97 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_CLK_ASM9260_H +#define _DT_BINDINGS_CLK_ASM9260_H + +/* ahb gate */ +#define CLKID_AHB_ROM 0 +#define CLKID_AHB_RAM 1 +#define CLKID_AHB_GPIO 2 +#define CLKID_AHB_MAC 3 +#define CLKID_AHB_EMI 4 +#define CLKID_AHB_USB0 5 +#define CLKID_AHB_USB1 6 +#define CLKID_AHB_DMA0 7 +#define CLKID_AHB_DMA1 8 +#define CLKID_AHB_UART0 9 +#define CLKID_AHB_UART1 10 +#define CLKID_AHB_UART2 11 +#define CLKID_AHB_UART3 12 +#define CLKID_AHB_UART4 13 +#define CLKID_AHB_UART5 14 +#define CLKID_AHB_UART6 15 +#define CLKID_AHB_UART7 16 +#define CLKID_AHB_UART8 17 +#define CLKID_AHB_UART9 18 +#define CLKID_AHB_I2S0 19 +#define CLKID_AHB_I2C0 20 +#define CLKID_AHB_I2C1 21 +#define CLKID_AHB_SSP0 22 +#define CLKID_AHB_IOCONFIG 23 +#define CLKID_AHB_WDT 24 +#define CLKID_AHB_CAN0 25 +#define CLKID_AHB_CAN1 26 +#define CLKID_AHB_MPWM 27 +#define CLKID_AHB_SPI0 28 +#define CLKID_AHB_SPI1 29 +#define CLKID_AHB_QEI 30 +#define CLKID_AHB_QUADSPI0 31 +#define CLKID_AHB_CAMIF 32 +#define CLKID_AHB_LCDIF 33 +#define CLKID_AHB_TIMER0 34 +#define CLKID_AHB_TIMER1 35 +#define CLKID_AHB_TIMER2 36 +#define CLKID_AHB_TIMER3 37 +#define CLKID_AHB_IRQ 38 +#define CLKID_AHB_RTC 39 +#define CLKID_AHB_NAND 40 +#define CLKID_AHB_ADC0 41 +#define CLKID_AHB_LED 42 +#define CLKID_AHB_DAC0 43 +#define CLKID_AHB_LCD 44 +#define CLKID_AHB_I2S1 45 +#define CLKID_AHB_MAC1 46 + +/* devider */ +#define CLKID_SYS_CPU 47 +#define CLKID_SYS_AHB 48 +#define CLKID_SYS_I2S0M 49 +#define CLKID_SYS_I2S0S 50 +#define CLKID_SYS_I2S1M 51 +#define CLKID_SYS_I2S1S 52 +#define CLKID_SYS_UART0 53 +#define CLKID_SYS_UART1 54 +#define CLKID_SYS_UART2 55 +#define CLKID_SYS_UART3 56 +#define CLKID_SYS_UART4 56 +#define CLKID_SYS_UART5 57 +#define CLKID_SYS_UART6 58 +#define CLKID_SYS_UART7 59 +#define CLKID_SYS_UART8 60 +#define CLKID_SYS_UART9 61 +#define CLKID_SYS_SPI0 62 +#define CLKID_SYS_SPI1 63 +#define CLKID_SYS_QUADSPI 64 +#define CLKID_SYS_SSP0 65 +#define CLKID_SYS_NAND 66 +#define CLKID_SYS_TRACE 67 +#define CLKID_SYS_CAMM 68 +#define CLKID_SYS_WDT 69 +#define CLKID_SYS_CLKOUT 70 +#define CLKID_SYS_MAC 71 +#define CLKID_SYS_LCD 72 +#define CLKID_SYS_ADCANA 73 + +#define MAX_CLKS 74 +#endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* Re: [PATCH v2] ARM: clk: add clk-asm9260 driver 2015-01-20 9:23 ` [PATCH v2] " Oleksij Rempel @ 2015-01-20 18:13 ` Mike Turquette 0 siblings, 0 replies; 81+ messages in thread From: Mike Turquette @ 2015-01-20 18:13 UTC (permalink / raw) To: Oleksij Rempel, linux-kernel; +Cc: Oleksij Rempel Quoting Oleksij Rempel (2015-01-20 01:23:02) > Provide CLK support for Alphascale ASM9260 SoC. > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Applied to clk-next. Regards, Mike > --- > drivers/clk/Makefile | 1 + > drivers/clk/clk-asm9260.c | 348 +++++++++++++++++++++++++ > include/dt-bindings/clock/alphascale,asm9260.h | 97 +++++++ > 3 files changed, 446 insertions(+) > create mode 100644 drivers/clk/clk-asm9260.c > create mode 100644 include/dt-bindings/clock/alphascale,asm9260.h > > diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile > index d5fba5b..3c41a68 100644 > --- a/drivers/clk/Makefile > +++ b/drivers/clk/Makefile > @@ -16,6 +16,7 @@ endif > > # hardware specific clock types > # please keep this section sorted lexicographically by file/directory path name > +obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o > obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o > obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o > obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o > diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c > new file mode 100644 > index 0000000..88f4ff6 > --- /dev/null > +++ b/drivers/clk/clk-asm9260.c > @@ -0,0 +1,348 @@ > +/* > + * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>. > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms and conditions of the GNU General Public License, > + * version 2, as published by the Free Software Foundation. > + * > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along with > + * this program. If not, see <http://www.gnu.org/licenses/>. > + */ > + > +#include <linux/clk.h> > +#include <linux/clkdev.h> > +#include <linux/err.h> > +#include <linux/io.h> > +#include <linux/clk-provider.h> > +#include <linux/spinlock.h> > +#include <linux/of.h> > +#include <linux/of_address.h> > +#include <dt-bindings/clock/alphascale,asm9260.h> > + > +#define HW_AHBCLKCTRL0 0x0020 > +#define HW_AHBCLKCTRL1 0x0030 > +#define HW_SYSPLLCTRL 0x0100 > +#define HW_MAINCLKSEL 0x0120 > +#define HW_MAINCLKUEN 0x0124 > +#define HW_UARTCLKSEL 0x0128 > +#define HW_UARTCLKUEN 0x012c > +#define HW_I2S0CLKSEL 0x0130 > +#define HW_I2S0CLKUEN 0x0134 > +#define HW_I2S1CLKSEL 0x0138 > +#define HW_I2S1CLKUEN 0x013c > +#define HW_WDTCLKSEL 0x0160 > +#define HW_WDTCLKUEN 0x0164 > +#define HW_CLKOUTCLKSEL 0x0170 > +#define HW_CLKOUTCLKUEN 0x0174 > +#define HW_CPUCLKDIV 0x017c > +#define HW_SYSAHBCLKDIV 0x0180 > +#define HW_I2S0MCLKDIV 0x0190 > +#define HW_I2S0SCLKDIV 0x0194 > +#define HW_I2S1MCLKDIV 0x0188 > +#define HW_I2S1SCLKDIV 0x018c > +#define HW_UART0CLKDIV 0x0198 > +#define HW_UART1CLKDIV 0x019c > +#define HW_UART2CLKDIV 0x01a0 > +#define HW_UART3CLKDIV 0x01a4 > +#define HW_UART4CLKDIV 0x01a8 > +#define HW_UART5CLKDIV 0x01ac > +#define HW_UART6CLKDIV 0x01b0 > +#define HW_UART7CLKDIV 0x01b4 > +#define HW_UART8CLKDIV 0x01b8 > +#define HW_UART9CLKDIV 0x01bc > +#define HW_SPI0CLKDIV 0x01c0 > +#define HW_SPI1CLKDIV 0x01c4 > +#define HW_QUADSPICLKDIV 0x01c8 > +#define HW_SSP0CLKDIV 0x01d0 > +#define HW_NANDCLKDIV 0x01d4 > +#define HW_TRACECLKDIV 0x01e0 > +#define HW_CAMMCLKDIV 0x01e8 > +#define HW_WDTCLKDIV 0x01ec > +#define HW_CLKOUTCLKDIV 0x01f4 > +#define HW_MACCLKDIV 0x01f8 > +#define HW_LCDCLKDIV 0x01fc > +#define HW_ADCANACLKDIV 0x0200 > + > +static struct clk *clks[MAX_CLKS]; > +static struct clk_onecell_data clk_data; > +static DEFINE_SPINLOCK(asm9260_clk_lock); > + > +struct asm9260_div_clk { > + unsigned int idx; > + const char *name; > + const char *parent_name; > + u32 reg; > +}; > + > +struct asm9260_gate_data { > + unsigned int idx; > + const char *name; > + const char *parent_name; > + u32 reg; > + u8 bit_idx; > + unsigned long flags; > +}; > + > +struct asm9260_mux_clock { > + u8 mask; > + u32 *table; > + const char *name; > + const char **parent_names; > + u8 num_parents; > + unsigned long offset; > + unsigned long flags; > +}; > + > +static void __iomem *base; > + > +static const struct asm9260_div_clk asm9260_div_clks[] __initconst = { > + { CLKID_SYS_CPU, "cpu_div", "main_gate", HW_CPUCLKDIV }, > + { CLKID_SYS_AHB, "ahb_div", "cpu_div", HW_SYSAHBCLKDIV }, > + > + /* i2s has two deviders: one for only external mclk and internal > + * devider for all clks. */ > + { CLKID_SYS_I2S0M, "i2s0m_div", "i2s0_mclk", HW_I2S0MCLKDIV }, > + { CLKID_SYS_I2S1M, "i2s1m_div", "i2s1_mclk", HW_I2S1MCLKDIV }, > + { CLKID_SYS_I2S0S, "i2s0s_div", "i2s0_gate", HW_I2S0SCLKDIV }, > + { CLKID_SYS_I2S1S, "i2s1s_div", "i2s0_gate", HW_I2S1SCLKDIV }, > + > + { CLKID_SYS_UART0, "uart0_div", "uart_gate", HW_UART0CLKDIV }, > + { CLKID_SYS_UART1, "uart1_div", "uart_gate", HW_UART1CLKDIV }, > + { CLKID_SYS_UART2, "uart2_div", "uart_gate", HW_UART2CLKDIV }, > + { CLKID_SYS_UART3, "uart3_div", "uart_gate", HW_UART3CLKDIV }, > + { CLKID_SYS_UART4, "uart4_div", "uart_gate", HW_UART4CLKDIV }, > + { CLKID_SYS_UART5, "uart5_div", "uart_gate", HW_UART5CLKDIV }, > + { CLKID_SYS_UART6, "uart6_div", "uart_gate", HW_UART6CLKDIV }, > + { CLKID_SYS_UART7, "uart7_div", "uart_gate", HW_UART7CLKDIV }, > + { CLKID_SYS_UART8, "uart8_div", "uart_gate", HW_UART8CLKDIV }, > + { CLKID_SYS_UART9, "uart9_div", "uart_gate", HW_UART9CLKDIV }, > + > + { CLKID_SYS_SPI0, "spi0_div", "main_gate", HW_SPI0CLKDIV }, > + { CLKID_SYS_SPI1, "spi1_div", "main_gate", HW_SPI1CLKDIV }, > + { CLKID_SYS_QUADSPI, "quadspi_div", "main_gate", HW_QUADSPICLKDIV }, > + { CLKID_SYS_SSP0, "ssp0_div", "main_gate", HW_SSP0CLKDIV }, > + { CLKID_SYS_NAND, "nand_div", "main_gate", HW_NANDCLKDIV }, > + { CLKID_SYS_TRACE, "trace_div", "main_gate", HW_TRACECLKDIV }, > + { CLKID_SYS_CAMM, "camm_div", "main_gate", HW_CAMMCLKDIV }, > + { CLKID_SYS_MAC, "mac_div", "main_gate", HW_MACCLKDIV }, > + { CLKID_SYS_LCD, "lcd_div", "main_gate", HW_LCDCLKDIV }, > + { CLKID_SYS_ADCANA, "adcana_div", "main_gate", HW_ADCANACLKDIV }, > + > + { CLKID_SYS_WDT, "wdt_div", "wdt_gate", HW_WDTCLKDIV }, > + { CLKID_SYS_CLKOUT, "clkout_div", "clkout_gate", HW_CLKOUTCLKDIV }, > +}; > + > +static const struct asm9260_gate_data asm9260_mux_gates[] __initconst = { > + { 0, "main_gate", "main_mux", HW_MAINCLKUEN, 0 }, > + { 0, "uart_gate", "uart_mux", HW_UARTCLKUEN, 0 }, > + { 0, "i2s0_gate", "i2s0_mux", HW_I2S0CLKUEN, 0 }, > + { 0, "i2s1_gate", "i2s1_mux", HW_I2S1CLKUEN, 0 }, > + { 0, "wdt_gate", "wdt_mux", HW_WDTCLKUEN, 0 }, > + { 0, "clkout_gate", "clkout_mux", HW_CLKOUTCLKUEN, 0 }, > +}; > +static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { > + /* ahb gates */ > + { CLKID_AHB_ROM, "rom", "ahb_div", > + HW_AHBCLKCTRL0, 1, CLK_IGNORE_UNUSED}, > + { CLKID_AHB_RAM, "ram", "ahb_div", > + HW_AHBCLKCTRL0, 2, CLK_IGNORE_UNUSED}, > + { CLKID_AHB_GPIO, "gpio", "ahb_div", > + HW_AHBCLKCTRL0, 4 }, > + { CLKID_AHB_MAC, "mac", "ahb_div", > + HW_AHBCLKCTRL0, 5 }, > + { CLKID_AHB_EMI, "emi", "ahb_div", > + HW_AHBCLKCTRL0, 6, CLK_IGNORE_UNUSED}, > + { CLKID_AHB_USB0, "usb0", "ahb_div", > + HW_AHBCLKCTRL0, 7 }, > + { CLKID_AHB_USB1, "usb1", "ahb_div", > + HW_AHBCLKCTRL0, 8 }, > + { CLKID_AHB_DMA0, "dma0", "ahb_div", > + HW_AHBCLKCTRL0, 9 }, > + { CLKID_AHB_DMA1, "dma1", "ahb_div", > + HW_AHBCLKCTRL0, 10 }, > + { CLKID_AHB_UART0, "uart0", "ahb_div", > + HW_AHBCLKCTRL0, 11 }, > + { CLKID_AHB_UART1, "uart1", "ahb_div", > + HW_AHBCLKCTRL0, 12 }, > + { CLKID_AHB_UART2, "uart2", "ahb_div", > + HW_AHBCLKCTRL0, 13 }, > + { CLKID_AHB_UART3, "uart3", "ahb_div", > + HW_AHBCLKCTRL0, 14 }, > + { CLKID_AHB_UART4, "uart4", "ahb_div", > + HW_AHBCLKCTRL0, 15 }, > + { CLKID_AHB_UART5, "uart5", "ahb_div", > + HW_AHBCLKCTRL0, 16 }, > + { CLKID_AHB_UART6, "uart6", "ahb_div", > + HW_AHBCLKCTRL0, 17 }, > + { CLKID_AHB_UART7, "uart7", "ahb_div", > + HW_AHBCLKCTRL0, 18 }, > + { CLKID_AHB_UART8, "uart8", "ahb_div", > + HW_AHBCLKCTRL0, 19 }, > + { CLKID_AHB_UART9, "uart9", "ahb_div", > + HW_AHBCLKCTRL0, 20 }, > + { CLKID_AHB_I2S0, "i2s0", "ahb_div", > + HW_AHBCLKCTRL0, 21 }, > + { CLKID_AHB_I2C0, "i2c0", "ahb_div", > + HW_AHBCLKCTRL0, 22 }, > + { CLKID_AHB_I2C1, "i2c1", "ahb_div", > + HW_AHBCLKCTRL0, 23 }, > + { CLKID_AHB_SSP0, "ssp0", "ahb_div", > + HW_AHBCLKCTRL0, 24 }, > + { CLKID_AHB_IOCONFIG, "ioconf", "ahb_div", > + HW_AHBCLKCTRL0, 25 }, > + { CLKID_AHB_WDT, "wdt", "ahb_div", > + HW_AHBCLKCTRL0, 26 }, > + { CLKID_AHB_CAN0, "can0", "ahb_div", > + HW_AHBCLKCTRL0, 27 }, > + { CLKID_AHB_CAN1, "can1", "ahb_div", > + HW_AHBCLKCTRL0, 28 }, > + { CLKID_AHB_MPWM, "mpwm", "ahb_div", > + HW_AHBCLKCTRL0, 29 }, > + { CLKID_AHB_SPI0, "spi0", "ahb_div", > + HW_AHBCLKCTRL0, 30 }, > + { CLKID_AHB_SPI1, "spi1", "ahb_div", > + HW_AHBCLKCTRL0, 31 }, > + > + { CLKID_AHB_QEI, "qei", "ahb_div", > + HW_AHBCLKCTRL1, 0 }, > + { CLKID_AHB_QUADSPI0, "quadspi0", "ahb_div", > + HW_AHBCLKCTRL1, 1 }, > + { CLKID_AHB_CAMIF, "capmif", "ahb_div", > + HW_AHBCLKCTRL1, 2 }, > + { CLKID_AHB_LCDIF, "lcdif", "ahb_div", > + HW_AHBCLKCTRL1, 3 }, > + { CLKID_AHB_TIMER0, "timer0", "ahb_div", > + HW_AHBCLKCTRL1, 4 }, > + { CLKID_AHB_TIMER1, "timer1", "ahb_div", > + HW_AHBCLKCTRL1, 5 }, > + { CLKID_AHB_TIMER2, "timer2", "ahb_div", > + HW_AHBCLKCTRL1, 6 }, > + { CLKID_AHB_TIMER3, "timer3", "ahb_div", > + HW_AHBCLKCTRL1, 7 }, > + { CLKID_AHB_IRQ, "irq", "ahb_div", > + HW_AHBCLKCTRL1, 8, CLK_IGNORE_UNUSED}, > + { CLKID_AHB_RTC, "rtc", "ahb_div", > + HW_AHBCLKCTRL1, 9 }, > + { CLKID_AHB_NAND, "nand", "ahb_div", > + HW_AHBCLKCTRL1, 10 }, > + { CLKID_AHB_ADC0, "adc0", "ahb_div", > + HW_AHBCLKCTRL1, 11 }, > + { CLKID_AHB_LED, "led", "ahb_div", > + HW_AHBCLKCTRL1, 12 }, > + { CLKID_AHB_DAC0, "dac0", "ahb_div", > + HW_AHBCLKCTRL1, 13 }, > + { CLKID_AHB_LCD, "lcd", "ahb_div", > + HW_AHBCLKCTRL1, 14 }, > + { CLKID_AHB_I2S1, "i2s1", "ahb_div", > + HW_AHBCLKCTRL1, 15 }, > + { CLKID_AHB_MAC1, "mac1", "ahb_div", > + HW_AHBCLKCTRL1, 16 }, > +}; > + > +static const char __initdata *main_mux_p[] = { NULL, NULL }; > +static const char __initdata *i2s0_mux_p[] = { NULL, NULL, "i2s0m_div"}; > +static const char __initdata *i2s1_mux_p[] = { NULL, NULL, "i2s1m_div"}; > +static const char __initdata *clkout_mux_p[] = { NULL, NULL, "rtc"}; > +static u32 three_mux_table[] = {0, 1, 3}; > + > +static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { > + { 1, three_mux_table, "main_mux", main_mux_p, > + ARRAY_SIZE(main_mux_p), HW_MAINCLKSEL, }, > + { 1, three_mux_table, "uart_mux", main_mux_p, > + ARRAY_SIZE(main_mux_p), HW_UARTCLKSEL, }, > + { 1, three_mux_table, "wdt_mux", main_mux_p, > + ARRAY_SIZE(main_mux_p), HW_WDTCLKSEL, }, > + { 3, three_mux_table, "i2s0_mux", i2s0_mux_p, > + ARRAY_SIZE(i2s0_mux_p), HW_I2S0CLKSEL, }, > + { 3, three_mux_table, "i2s1_mux", i2s1_mux_p, > + ARRAY_SIZE(i2s1_mux_p), HW_I2S1CLKSEL, }, > + { 3, three_mux_table, "clkout_mux", clkout_mux_p, > + ARRAY_SIZE(clkout_mux_p), HW_CLKOUTCLKSEL, }, > +}; > + > +static void __init asm9260_acc_init(struct device_node *np) > +{ > + struct clk *clk; > + const char *ref_clk, *pll_clk = "pll"; > + u32 rate; > + int n; > + u32 accuracy = 0; > + > + base = of_io_request_and_map(np, 0, np->name); > + if (!base) > + panic("%s: unable to map resource", np->name); > + > + /* register pll */ > + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; > + > + ref_clk = of_clk_get_parent_name(np, 0); > + accuracy = clk_get_accuracy(__clk_lookup(ref_clk)); > + clk = clk_register_fixed_rate_with_accuracy(NULL, pll_clk, > + ref_clk, 0, rate, accuracy); > + > + if (IS_ERR(clk)) > + panic("%s: can't register REFCLK. Check DT!", np->name); > + > + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { > + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; > + > + mc->parent_names[0] = ref_clk; > + mc->parent_names[1] = pll_clk; > + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, > + mc->num_parents, mc->flags, base + mc->offset, > + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); > + } > + > + /* clock mux gate cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { > + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; > + > + clk = clk_register_gate(NULL, gd->name, > + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, > + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); > + } > + > + /* clock div cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { > + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; > + > + clks[dc->idx] = clk_register_divider(NULL, dc->name, > + dc->parent_name, CLK_SET_RATE_PARENT, > + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, > + &asm9260_clk_lock); > + } > + > + /* clock ahb gate cells */ > + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { > + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; > + > + clks[gd->idx] = clk_register_gate(NULL, gd->name, > + gd->parent_name, gd->flags, base + gd->reg, > + gd->bit_idx, 0, &asm9260_clk_lock); > + } > + > + /* check for errors on leaf clocks */ > + for (n = 0; n < MAX_CLKS; n++) { > + if (!IS_ERR(clks[n])) > + continue; > + > + pr_err("%s: Unable to register leaf clock %d\n", > + np->full_name, n); > + goto fail; > + } > + > + /* register clk-provider */ > + clk_data.clks = clks; > + clk_data.clk_num = MAX_CLKS; > + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); > + return; > +fail: > + iounmap(base); > +} > +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", > + asm9260_acc_init); > diff --git a/include/dt-bindings/clock/alphascale,asm9260.h b/include/dt-bindings/clock/alphascale,asm9260.h > new file mode 100644 > index 0000000..04e8db2 > --- /dev/null > +++ b/include/dt-bindings/clock/alphascale,asm9260.h > @@ -0,0 +1,97 @@ > +/* > + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> > + * > + * This software is licensed under the terms of the GNU General Public > + * License version 2, as published by the Free Software Foundation, and > + * may be copied, distributed, and modified under those terms. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#ifndef _DT_BINDINGS_CLK_ASM9260_H > +#define _DT_BINDINGS_CLK_ASM9260_H > + > +/* ahb gate */ > +#define CLKID_AHB_ROM 0 > +#define CLKID_AHB_RAM 1 > +#define CLKID_AHB_GPIO 2 > +#define CLKID_AHB_MAC 3 > +#define CLKID_AHB_EMI 4 > +#define CLKID_AHB_USB0 5 > +#define CLKID_AHB_USB1 6 > +#define CLKID_AHB_DMA0 7 > +#define CLKID_AHB_DMA1 8 > +#define CLKID_AHB_UART0 9 > +#define CLKID_AHB_UART1 10 > +#define CLKID_AHB_UART2 11 > +#define CLKID_AHB_UART3 12 > +#define CLKID_AHB_UART4 13 > +#define CLKID_AHB_UART5 14 > +#define CLKID_AHB_UART6 15 > +#define CLKID_AHB_UART7 16 > +#define CLKID_AHB_UART8 17 > +#define CLKID_AHB_UART9 18 > +#define CLKID_AHB_I2S0 19 > +#define CLKID_AHB_I2C0 20 > +#define CLKID_AHB_I2C1 21 > +#define CLKID_AHB_SSP0 22 > +#define CLKID_AHB_IOCONFIG 23 > +#define CLKID_AHB_WDT 24 > +#define CLKID_AHB_CAN0 25 > +#define CLKID_AHB_CAN1 26 > +#define CLKID_AHB_MPWM 27 > +#define CLKID_AHB_SPI0 28 > +#define CLKID_AHB_SPI1 29 > +#define CLKID_AHB_QEI 30 > +#define CLKID_AHB_QUADSPI0 31 > +#define CLKID_AHB_CAMIF 32 > +#define CLKID_AHB_LCDIF 33 > +#define CLKID_AHB_TIMER0 34 > +#define CLKID_AHB_TIMER1 35 > +#define CLKID_AHB_TIMER2 36 > +#define CLKID_AHB_TIMER3 37 > +#define CLKID_AHB_IRQ 38 > +#define CLKID_AHB_RTC 39 > +#define CLKID_AHB_NAND 40 > +#define CLKID_AHB_ADC0 41 > +#define CLKID_AHB_LED 42 > +#define CLKID_AHB_DAC0 43 > +#define CLKID_AHB_LCD 44 > +#define CLKID_AHB_I2S1 45 > +#define CLKID_AHB_MAC1 46 > + > +/* devider */ > +#define CLKID_SYS_CPU 47 > +#define CLKID_SYS_AHB 48 > +#define CLKID_SYS_I2S0M 49 > +#define CLKID_SYS_I2S0S 50 > +#define CLKID_SYS_I2S1M 51 > +#define CLKID_SYS_I2S1S 52 > +#define CLKID_SYS_UART0 53 > +#define CLKID_SYS_UART1 54 > +#define CLKID_SYS_UART2 55 > +#define CLKID_SYS_UART3 56 > +#define CLKID_SYS_UART4 56 > +#define CLKID_SYS_UART5 57 > +#define CLKID_SYS_UART6 58 > +#define CLKID_SYS_UART7 59 > +#define CLKID_SYS_UART8 60 > +#define CLKID_SYS_UART9 61 > +#define CLKID_SYS_SPI0 62 > +#define CLKID_SYS_SPI1 63 > +#define CLKID_SYS_QUADSPI 64 > +#define CLKID_SYS_SSP0 65 > +#define CLKID_SYS_NAND 66 > +#define CLKID_SYS_TRACE 67 > +#define CLKID_SYS_CAMM 68 > +#define CLKID_SYS_WDT 69 > +#define CLKID_SYS_CLKOUT 70 > +#define CLKID_SYS_MAC 71 > +#define CLKID_SYS_LCD 72 > +#define CLKID_SYS_ADCANA 73 > + > +#define MAX_CLKS 74 > +#endif > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 0/2] suport for Alphascale ASM9260, part 3 2014-11-28 14:09 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann 2014-11-28 14:13 ` Oleksij Rempel 2014-11-28 15:05 ` [PATCH] suport for Alphascale ASM9260, part 2 Oleksij Rempel @ 2014-11-28 16:50 ` Oleksij Rempel 2014-11-28 16:50 ` [PATCH 1/2] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel ` (2 more replies) 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 3 siblings, 3 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:50 UTC (permalink / raw) To: linux-arm-kernel Oleksij Rempel (2): ARM: irqchip: mxs: prepare driver for HW with different offsets ARM: irqchip: mxs: add Alpascale ASM9260 support drivers/irqchip/Kconfig | 5 + drivers/irqchip/Makefile | 2 +- drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++ drivers/irqchip/irq-mxs.c | 150 ++++++++++++++++++++++++++--- 4 files changed, 249 insertions(+), 17 deletions(-) create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 1/2] ARM: irqchip: mxs: prepare driver for HW with different offsets 2014-11-28 16:50 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel @ 2014-11-28 16:50 ` Oleksij Rempel 2014-11-28 16:50 ` [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel 2015-01-08 9:01 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel 2 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:50 UTC (permalink / raw) To: linux-arm-kernel Some HW has similar functionality but different register offsets. Make sure we can change offsets dynamically. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/irqchip/irq-mxs.c | 55 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c index e4acf1e..681125d 100644 --- a/drivers/irqchip/irq-mxs.c +++ b/drivers/irqchip/irq-mxs.c @@ -29,18 +29,39 @@ #include "irqchip.h" +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ +#define SET_REG 4 +#define CLR_REG 8 + #define HW_ICOLL_VECTOR 0x0000 #define HW_ICOLL_LEVELACK 0x0010 #define HW_ICOLL_CTRL 0x0020 #define HW_ICOLL_STAT_OFFSET 0x0070 -#define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10) -#define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10) -#define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004 +#define HW_ICOLL_INTERRUPT0 0x0120 +#define HW_ICOLL_INTERRUPTn(n) ((n) * 0x10) +#define BM_ICOLL_INTR_ENABLE BIT(2) #define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1 #define ICOLL_NUM_IRQS 128 -static void __iomem *icoll_base; +struct icoll_priv { + void __iomem *vector; + void __iomem *levelack; + void __iomem *ctrl; + void __iomem *stat; + void __iomem *intr; + /* number of interrupts per register */ + int intr_per_reg; + void __iomem *clear; +}; + +static struct icoll_priv icoll_priv; static struct irq_domain *icoll_domain; static void icoll_ack_irq(struct irq_data *d) @@ -51,19 +72,19 @@ static void icoll_ack_irq(struct irq_data *d) * BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 unconditionally. */ __raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0, - icoll_base + HW_ICOLL_LEVELACK); + icoll_priv.levelack); } static void icoll_mask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq)); + __raw_writel(BM_ICOLL_INTR_ENABLE, + icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); } static void icoll_unmask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq)); + __raw_writel(BM_ICOLL_INTR_ENABLE, + icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); } static struct irq_chip mxs_icoll_chip = { @@ -76,8 +97,8 @@ asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs) { u32 irqnr; - irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET); - __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR); + irqnr = __raw_readl(icoll_priv.stat); + __raw_writel(irqnr, icoll_priv.vector); handle_domain_irq(icoll_domain, irqnr, regs); } @@ -98,14 +119,22 @@ static struct irq_domain_ops icoll_irq_domain_ops = { static int __init icoll_of_init(struct device_node *np, struct device_node *interrupt_parent) { - icoll_base = of_iomap(np, 0); + void __iomem *icoll_base = of_iomap(np, 0); WARN_ON(!icoll_base); + icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; + icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; + icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; + icoll_priv.stat = icoll_base + HW_ICOLL_STAT_OFFSET; + icoll_priv.intr = icoll_base + HW_ICOLL_INTERRUPT0; + icoll_priv.intr_per_reg = 1; + icoll_priv.clear = NULL; + /* * Interrupt Collector reset, which initializes the priority * for each irq to level 0. */ - stmp_reset_block(icoll_base + HW_ICOLL_CTRL); + stmp_reset_block(icoll_priv.ctrl); icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, &icoll_irq_domain_ops, NULL); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-28 16:50 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel 2014-11-28 16:50 ` [PATCH 1/2] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel @ 2014-11-28 16:50 ` Oleksij Rempel 2015-09-17 13:17 ` Oleksij Rempel 2015-01-08 9:01 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel 2 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:50 UTC (permalink / raw) To: linux-arm-kernel Freescale iMX23/iMX28 and Alphascale ASM9260 have similar interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. Differences between this devices are fallowing: - different register offsets - different count of intterupt lines per register - ASM9260 don't provide reset bit - ASM9260 don't support FIQ. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/irqchip/Kconfig | 5 ++ drivers/irqchip/Makefile | 2 +- drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++++++++++ drivers/irqchip/irq-mxs.c | 105 ++++++++++++++++++++++++--- 4 files changed, 212 insertions(+), 9 deletions(-) create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index b21f12f..badc2dc 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -125,3 +125,8 @@ config KEYSTONE_IRQ help Support for Texas Instruments Keystone 2 IRQ controller IP which is part of the Keystone 2 IPC mechanism + +config IRQ_MXS + def_bool y if MACH_ASM9260 || ARCH_MXS + select IRQ_DOMAIN + select STMP_DEVICE diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 173bb5f..fd06d5e 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -5,7 +5,7 @@ obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o obj-$(CONFIG_ARCH_MMP) += irq-mmp.o obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o -obj-$(CONFIG_ARCH_MXS) += irq-mxs.o +obj-$(CONFIG_IRQ_MXS) += irq-mxs.o obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o obj-$(CONFIG_METAG) += irq-metag-ext.o diff --git a/drivers/irqchip/alphascale_asm9260-icoll.h b/drivers/irqchip/alphascale_asm9260-icoll.h new file mode 100644 index 0000000..5cec108 --- /dev/null +++ b/drivers/irqchip/alphascale_asm9260-icoll.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef _ALPHASCALE_ASM9260_ICOLL_H +#define _ALPHASCALE_ASM9260_ICOLL_H + +#define ASM9260_NUM_IRQS 64 +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ + +#define ASM9260_HW_ICOLL_VECTOR 0x0000 +/* + * bits 31:2 + * This register presents the vector address for the interrupt currently + * active on the CPU IRQ input. Writing to this register notifies the + * interrupt collector that the interrupt service routine for the current + * interrupt has been entered. + * The exception trap should have a LDPC instruction from this address: + * LDPC ASM9260_HW_ICOLL_VECTOR_ADDR; IRQ exception at 0xffff0018 + */ + +/* + * The Interrupt Collector Level Acknowledge Register is used by software to + * indicate the completion of an interrupt on a specific level. + * This register is written at the very end of an interrupt service routine. If + * nesting is used then the CPU irq must be turned on before writing to this + * register to avoid a race condition in the CPU interrupt hardware. + */ +#define ASM9260_HW_ICOLL_LEVELACK 0x0010 +#define ASM9260_BM_LEVELn(nr) BIT(nr) + +#define ASM9260_HW_ICOLL_CTRL 0x0020 +/* + * ASM9260_BM_CTRL_SFTRST and ASM9260_BM_CTRL_CLKGATE are not available on + * asm9260. + */ +#define ASM9260_BM_CTRL_SFTRST BIT(31) +#define ASM9260_BM_CTRL_CLKGATE BIT(30) +/* disable interrupt level nesting */ +#define ASM9260_BM_CTRL_NO_NESTING BIT(19) +/* + * Set this bit to one enable the RISC32-style read side effect associated with + * the vector address register. In this mode, interrupt in-service is signaled + * by the read of the ASM9260_HW_ICOLL_VECTOR register to acquire the interrupt + * vector address. Set this bit to zero for normal operation, in which the ISR + * signals in-service explicitly by means of a write to the + * ASM9260_HW_ICOLL_VECTOR register. + * 0 - Must Write to Vector register to go in-service. + * 1 - Go in-service as a read side effect + */ +#define ASM9260_BM_CTRL_ARM_RSE_MODE BIT(18) +#define ASM9260_BM_CTRL_IRQ_ENABLE BIT(16) + +#define ASM9260_HW_ICOLL_STAT_OFFSET 0x0030 +/* + * bits 5:0 + * Vector number of current interrupt. Multiply by 4 and add to vector base + * address to obtain the value in ASM9260_HW_ICOLL_VECTOR. + */ + +/* + * RAW0 and RAW1 provides a read-only view of the raw interrupt request lines + * coming from various parts of the chip. Its purpose is to improve diagnostic + * observability. + */ +#define ASM9260_HW_ICOLL_RAW0 0x0040 +#define ASM9260_HW_ICOLL_RAW1 0x0050 + +#define ASM9260_HW_ICOLL_INTERRUPT0 0x0060 +#define ASM9260_HW_ICOLL_INTERRUPTn(n) (0x0060 + ((n) >> 2) * 0x10) +/* + * WARNING: Modifying the priority of an enabled interrupt may result in + * undefined behavior. + */ +#define ASM9260_BM_INT_PRIORITY_MASK 0x3 +#define ASM9260_BM_INT_ENABLE BIT(2) +#define ASM9260_BM_INT_SOFTIRQ BIT(3) + +#define ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n) (((n) & 0x3) << 3) +#define ASM9260_BM_ICOLL_INTERRUPTn_ENABLE(n) (1 << (2 + \ + ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n))) + +#define ASM9260_HW_ICOLL_VBASE 0x0160 +/* + * bits 31:2 + * This bitfield holds the upper 30 bits of the base address of the vector + * table. + */ + +#define ASM9260_HW_ICOLL_CLEAR0 0x01d0 +#define ASM9260_HW_ICOLL_CLEAR1 0x01e0 +#define ASM9260_HW_ICOLL_CLEARn(n) (((n >> 5) * 0x10) \ + + SET_REG) +#define ASM9260_BM_CLEAR_BIT(n) BIT(n & 0x1f) + +/* Scratchpad */ +#define ASM9260_HW_ICOLL_UNDEF_VECTOR 0x01f0 +#endif diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c index 681125d..8c5c3d2 100644 --- a/drivers/irqchip/irq-mxs.c +++ b/drivers/irqchip/irq-mxs.c @@ -1,5 +1,7 @@ /* * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * Add Alphascale ASM9260 support. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +30,7 @@ #include <asm/exception.h> #include "irqchip.h" +#include "alphascale_asm9260-icoll.h" /* * this device provide 4 offsets for each register: @@ -63,6 +66,33 @@ struct icoll_priv { static struct icoll_priv icoll_priv; static struct irq_domain *icoll_domain; +static DEFINE_RAW_SPINLOCK(icoll_lock); + +/* calculate bit offset depending on number of intterupt per register */ +static u32 icoll_intr_bitshift(struct irq_data *d, u32 bit) +{ + /* + * We expect intr_per_reg to be 4 or 1, it means + * "n" will be 3 or 0. + */ + int n = icoll_priv.intr_per_reg - 1; + + /* + * If n = 0, "bit" is never shifted. + * If n = 3, mask lower part of hwirq to convert it + * in 0, 1, 2 or 3 and then multiply it by 8 (or shift by 3) + */ + return bit << ((d->hwirq & n) << n); +} + +/* calculate mem offset depending on number of intterupt per register */ +static void __iomem *icoll_intr_reg(struct irq_data *d) +{ + int n = icoll_priv.intr_per_reg >> 1; + + /* offset = hwirq / intr_per_reg * 0x10 */ + return icoll_priv.intr + ((d->hwirq >> n) * 0x10); +} static void icoll_ack_irq(struct irq_data *d) { @@ -77,14 +107,21 @@ static void icoll_ack_irq(struct irq_data *d) static void icoll_mask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTR_ENABLE, - icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), + icoll_intr_reg(d) + CLR_REG); } static void icoll_unmask_irq(struct irq_data *d) { - __raw_writel(BM_ICOLL_INTR_ENABLE, - icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); + raw_spin_lock(&icoll_lock); + if (icoll_priv.clear) + __raw_writel(ASM9260_BM_CLEAR_BIT(d->hwirq), + icoll_priv.clear + + ASM9260_HW_ICOLL_CLEARn(d->hwirq)); + + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), + icoll_intr_reg(d) + SET_REG); + raw_spin_unlock(&icoll_lock); } static struct irq_chip mxs_icoll_chip = { @@ -116,12 +153,34 @@ static struct irq_domain_ops icoll_irq_domain_ops = { .xlate = irq_domain_xlate_onecell, }; +static void __init icoll_add_domain(struct device_node *np, + int num) +{ + icoll_domain = irq_domain_add_linear(np, num, + &icoll_irq_domain_ops, NULL); + + if (!icoll_domain) + panic("%s: unable add irq domain", np->full_name); + irq_set_default_host(icoll_domain); + set_handle_irq(icoll_handle_irq); +} + +static void __iomem * __init icoll_init_iobase(struct device_node *np) +{ + void __iomem *icoll_base; + + icoll_base = of_io_request_and_map(np, 0, np->name); + if (!icoll_base) + panic("%s: unable to map resource", np->full_name); + return icoll_base; +} + static int __init icoll_of_init(struct device_node *np, struct device_node *interrupt_parent) { - void __iomem *icoll_base = of_iomap(np, 0); - WARN_ON(!icoll_base); + void __iomem *icoll_base; + icoll_base = icoll_init_iobase(np); icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; @@ -136,8 +195,38 @@ static int __init icoll_of_init(struct device_node *np, */ stmp_reset_block(icoll_priv.ctrl); - icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, - &icoll_irq_domain_ops, NULL); + icoll_add_domain(np, ICOLL_NUM_IRQS); + return icoll_domain ? 0 : -ENODEV; } IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); + +static int __init asm9260_of_init(struct device_node *np, + struct device_node *interrupt_parent) +{ + void __iomem *icoll_base; + int i; + + icoll_base = icoll_init_iobase(np); + icoll_priv.vector = icoll_base + ASM9260_HW_ICOLL_VECTOR; + icoll_priv.levelack = icoll_base + ASM9260_HW_ICOLL_LEVELACK; + icoll_priv.ctrl = icoll_base + ASM9260_HW_ICOLL_CTRL; + icoll_priv.stat = icoll_base + ASM9260_HW_ICOLL_STAT_OFFSET; + icoll_priv.intr = icoll_base + ASM9260_HW_ICOLL_INTERRUPT0; + icoll_priv.intr_per_reg = 4; + icoll_priv.clear = icoll_base + ASM9260_HW_ICOLL_CLEAR0; + + writel_relaxed(ASM9260_BM_CTRL_IRQ_ENABLE, + icoll_priv.ctrl); + /* + * ASM9260 don't provide reset bit. So, we need to set level 0 + * manually. + */ + for (i = 0; i < 16 * 0x10; i += 0x10) + writel(0, icoll_priv.intr + i); + + icoll_add_domain(np, ASM9260_NUM_IRQS); + + return icoll_domain ? 0 : -ENODEV; +} +IRQCHIP_DECLARE(asm9260, "alphascale,asm9260-icoll", asm9260_of_init); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support 2014-11-28 16:50 ` [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel @ 2015-09-17 13:17 ` Oleksij Rempel 2015-09-17 14:29 ` Thomas Gleixner 0 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2015-09-17 13:17 UTC (permalink / raw) To: linux-arm-kernel ping, looks like this patches are lost. Am 28.11.2014 um 17:50 schrieb Oleksij Rempel: > Freescale iMX23/iMX28 and Alphascale ASM9260 have similar > interrupt collectors. It makes easy to reuse irq-mxs code for ASM9260. > Differences between this devices are fallowing: > - different register offsets > - different count of intterupt lines per register > - ASM9260 don't provide reset bit > - ASM9260 don't support FIQ. > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> > --- > drivers/irqchip/Kconfig | 5 ++ > drivers/irqchip/Makefile | 2 +- > drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++++++++++ > drivers/irqchip/irq-mxs.c | 105 ++++++++++++++++++++++++--- > 4 files changed, 212 insertions(+), 9 deletions(-) > create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h > > diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig > index b21f12f..badc2dc 100644 > --- a/drivers/irqchip/Kconfig > +++ b/drivers/irqchip/Kconfig > @@ -125,3 +125,8 @@ config KEYSTONE_IRQ > help > Support for Texas Instruments Keystone 2 IRQ controller IP which > is part of the Keystone 2 IPC mechanism > + > +config IRQ_MXS > + def_bool y if MACH_ASM9260 || ARCH_MXS > + select IRQ_DOMAIN > + select STMP_DEVICE > diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile > index 173bb5f..fd06d5e 100644 > --- a/drivers/irqchip/Makefile > +++ b/drivers/irqchip/Makefile > @@ -5,7 +5,7 @@ obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o > obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o > obj-$(CONFIG_ARCH_MMP) += irq-mmp.o > obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o > -obj-$(CONFIG_ARCH_MXS) += irq-mxs.o > +obj-$(CONFIG_IRQ_MXS) += irq-mxs.o > obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o > obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o > obj-$(CONFIG_METAG) += irq-metag-ext.o > diff --git a/drivers/irqchip/alphascale_asm9260-icoll.h b/drivers/irqchip/alphascale_asm9260-icoll.h > new file mode 100644 > index 0000000..5cec108 > --- /dev/null > +++ b/drivers/irqchip/alphascale_asm9260-icoll.h > @@ -0,0 +1,109 @@ > +/* > + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + */ > + > +#ifndef _ALPHASCALE_ASM9260_ICOLL_H > +#define _ALPHASCALE_ASM9260_ICOLL_H > + > +#define ASM9260_NUM_IRQS 64 > +/* > + * this device provide 4 offsets for each register: > + * 0x0 - plain read write mode > + * 0x4 - set mode, OR logic. > + * 0x8 - clr mode, XOR logic. > + * 0xc - togle mode. > + */ > + > +#define ASM9260_HW_ICOLL_VECTOR 0x0000 > +/* > + * bits 31:2 > + * This register presents the vector address for the interrupt currently > + * active on the CPU IRQ input. Writing to this register notifies the > + * interrupt collector that the interrupt service routine for the current > + * interrupt has been entered. > + * The exception trap should have a LDPC instruction from this address: > + * LDPC ASM9260_HW_ICOLL_VECTOR_ADDR; IRQ exception at 0xffff0018 > + */ > + > +/* > + * The Interrupt Collector Level Acknowledge Register is used by software to > + * indicate the completion of an interrupt on a specific level. > + * This register is written at the very end of an interrupt service routine. If > + * nesting is used then the CPU irq must be turned on before writing to this > + * register to avoid a race condition in the CPU interrupt hardware. > + */ > +#define ASM9260_HW_ICOLL_LEVELACK 0x0010 > +#define ASM9260_BM_LEVELn(nr) BIT(nr) > + > +#define ASM9260_HW_ICOLL_CTRL 0x0020 > +/* > + * ASM9260_BM_CTRL_SFTRST and ASM9260_BM_CTRL_CLKGATE are not available on > + * asm9260. > + */ > +#define ASM9260_BM_CTRL_SFTRST BIT(31) > +#define ASM9260_BM_CTRL_CLKGATE BIT(30) > +/* disable interrupt level nesting */ > +#define ASM9260_BM_CTRL_NO_NESTING BIT(19) > +/* > + * Set this bit to one enable the RISC32-style read side effect associated with > + * the vector address register. In this mode, interrupt in-service is signaled > + * by the read of the ASM9260_HW_ICOLL_VECTOR register to acquire the interrupt > + * vector address. Set this bit to zero for normal operation, in which the ISR > + * signals in-service explicitly by means of a write to the > + * ASM9260_HW_ICOLL_VECTOR register. > + * 0 - Must Write to Vector register to go in-service. > + * 1 - Go in-service as a read side effect > + */ > +#define ASM9260_BM_CTRL_ARM_RSE_MODE BIT(18) > +#define ASM9260_BM_CTRL_IRQ_ENABLE BIT(16) > + > +#define ASM9260_HW_ICOLL_STAT_OFFSET 0x0030 > +/* > + * bits 5:0 > + * Vector number of current interrupt. Multiply by 4 and add to vector base > + * address to obtain the value in ASM9260_HW_ICOLL_VECTOR. > + */ > + > +/* > + * RAW0 and RAW1 provides a read-only view of the raw interrupt request lines > + * coming from various parts of the chip. Its purpose is to improve diagnostic > + * observability. > + */ > +#define ASM9260_HW_ICOLL_RAW0 0x0040 > +#define ASM9260_HW_ICOLL_RAW1 0x0050 > + > +#define ASM9260_HW_ICOLL_INTERRUPT0 0x0060 > +#define ASM9260_HW_ICOLL_INTERRUPTn(n) (0x0060 + ((n) >> 2) * 0x10) > +/* > + * WARNING: Modifying the priority of an enabled interrupt may result in > + * undefined behavior. > + */ > +#define ASM9260_BM_INT_PRIORITY_MASK 0x3 > +#define ASM9260_BM_INT_ENABLE BIT(2) > +#define ASM9260_BM_INT_SOFTIRQ BIT(3) > + > +#define ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n) (((n) & 0x3) << 3) > +#define ASM9260_BM_ICOLL_INTERRUPTn_ENABLE(n) (1 << (2 + \ > + ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n))) > + > +#define ASM9260_HW_ICOLL_VBASE 0x0160 > +/* > + * bits 31:2 > + * This bitfield holds the upper 30 bits of the base address of the vector > + * table. > + */ > + > +#define ASM9260_HW_ICOLL_CLEAR0 0x01d0 > +#define ASM9260_HW_ICOLL_CLEAR1 0x01e0 > +#define ASM9260_HW_ICOLL_CLEARn(n) (((n >> 5) * 0x10) \ > + + SET_REG) > +#define ASM9260_BM_CLEAR_BIT(n) BIT(n & 0x1f) > + > +/* Scratchpad */ > +#define ASM9260_HW_ICOLL_UNDEF_VECTOR 0x01f0 > +#endif > diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c > index 681125d..8c5c3d2 100644 > --- a/drivers/irqchip/irq-mxs.c > +++ b/drivers/irqchip/irq-mxs.c > @@ -1,5 +1,7 @@ > /* > * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. > + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> > + * Add Alphascale ASM9260 support. > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as published by > @@ -28,6 +30,7 @@ > #include <asm/exception.h> > > #include "irqchip.h" > +#include "alphascale_asm9260-icoll.h" > > /* > * this device provide 4 offsets for each register: > @@ -63,6 +66,33 @@ struct icoll_priv { > > static struct icoll_priv icoll_priv; > static struct irq_domain *icoll_domain; > +static DEFINE_RAW_SPINLOCK(icoll_lock); > + > +/* calculate bit offset depending on number of intterupt per register */ > +static u32 icoll_intr_bitshift(struct irq_data *d, u32 bit) > +{ > + /* > + * We expect intr_per_reg to be 4 or 1, it means > + * "n" will be 3 or 0. > + */ > + int n = icoll_priv.intr_per_reg - 1; > + > + /* > + * If n = 0, "bit" is never shifted. > + * If n = 3, mask lower part of hwirq to convert it > + * in 0, 1, 2 or 3 and then multiply it by 8 (or shift by 3) > + */ > + return bit << ((d->hwirq & n) << n); > +} > + > +/* calculate mem offset depending on number of intterupt per register */ > +static void __iomem *icoll_intr_reg(struct irq_data *d) > +{ > + int n = icoll_priv.intr_per_reg >> 1; > + > + /* offset = hwirq / intr_per_reg * 0x10 */ > + return icoll_priv.intr + ((d->hwirq >> n) * 0x10); > +} > > static void icoll_ack_irq(struct irq_data *d) > { > @@ -77,14 +107,21 @@ static void icoll_ack_irq(struct irq_data *d) > > static void icoll_mask_irq(struct irq_data *d) > { > - __raw_writel(BM_ICOLL_INTR_ENABLE, > - icoll_priv.intr + CLR_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); > + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), > + icoll_intr_reg(d) + CLR_REG); > } > > static void icoll_unmask_irq(struct irq_data *d) > { > - __raw_writel(BM_ICOLL_INTR_ENABLE, > - icoll_priv.intr + SET_REG + HW_ICOLL_INTERRUPTn(d->hwirq)); > + raw_spin_lock(&icoll_lock); > + if (icoll_priv.clear) > + __raw_writel(ASM9260_BM_CLEAR_BIT(d->hwirq), > + icoll_priv.clear + > + ASM9260_HW_ICOLL_CLEARn(d->hwirq)); > + > + __raw_writel(icoll_intr_bitshift(d, BM_ICOLL_INTR_ENABLE), > + icoll_intr_reg(d) + SET_REG); > + raw_spin_unlock(&icoll_lock); > } > > static struct irq_chip mxs_icoll_chip = { > @@ -116,12 +153,34 @@ static struct irq_domain_ops icoll_irq_domain_ops = { > .xlate = irq_domain_xlate_onecell, > }; > > +static void __init icoll_add_domain(struct device_node *np, > + int num) > +{ > + icoll_domain = irq_domain_add_linear(np, num, > + &icoll_irq_domain_ops, NULL); > + > + if (!icoll_domain) > + panic("%s: unable add irq domain", np->full_name); > + irq_set_default_host(icoll_domain); > + set_handle_irq(icoll_handle_irq); > +} > + > +static void __iomem * __init icoll_init_iobase(struct device_node *np) > +{ > + void __iomem *icoll_base; > + > + icoll_base = of_io_request_and_map(np, 0, np->name); > + if (!icoll_base) > + panic("%s: unable to map resource", np->full_name); > + return icoll_base; > +} > + > static int __init icoll_of_init(struct device_node *np, > struct device_node *interrupt_parent) > { > - void __iomem *icoll_base = of_iomap(np, 0); > - WARN_ON(!icoll_base); > + void __iomem *icoll_base; > > + icoll_base = icoll_init_iobase(np); > icoll_priv.vector = icoll_base + HW_ICOLL_VECTOR; > icoll_priv.levelack = icoll_base + HW_ICOLL_LEVELACK; > icoll_priv.ctrl = icoll_base + HW_ICOLL_CTRL; > @@ -136,8 +195,38 @@ static int __init icoll_of_init(struct device_node *np, > */ > stmp_reset_block(icoll_priv.ctrl); > > - icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, > - &icoll_irq_domain_ops, NULL); > + icoll_add_domain(np, ICOLL_NUM_IRQS); > + > return icoll_domain ? 0 : -ENODEV; > } > IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); > + > +static int __init asm9260_of_init(struct device_node *np, > + struct device_node *interrupt_parent) > +{ > + void __iomem *icoll_base; > + int i; > + > + icoll_base = icoll_init_iobase(np); > + icoll_priv.vector = icoll_base + ASM9260_HW_ICOLL_VECTOR; > + icoll_priv.levelack = icoll_base + ASM9260_HW_ICOLL_LEVELACK; > + icoll_priv.ctrl = icoll_base + ASM9260_HW_ICOLL_CTRL; > + icoll_priv.stat = icoll_base + ASM9260_HW_ICOLL_STAT_OFFSET; > + icoll_priv.intr = icoll_base + ASM9260_HW_ICOLL_INTERRUPT0; > + icoll_priv.intr_per_reg = 4; > + icoll_priv.clear = icoll_base + ASM9260_HW_ICOLL_CLEAR0; > + > + writel_relaxed(ASM9260_BM_CTRL_IRQ_ENABLE, > + icoll_priv.ctrl); > + /* > + * ASM9260 don't provide reset bit. So, we need to set level 0 > + * manually. > + */ > + for (i = 0; i < 16 * 0x10; i += 0x10) > + writel(0, icoll_priv.intr + i); > + > + icoll_add_domain(np, ASM9260_NUM_IRQS); > + > + return icoll_domain ? 0 : -ENODEV; > +} > +IRQCHIP_DECLARE(asm9260, "alphascale,asm9260-icoll", asm9260_of_init); > -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/8f0dfcde/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support 2015-09-17 13:17 ` Oleksij Rempel @ 2015-09-17 14:29 ` Thomas Gleixner 0 siblings, 0 replies; 81+ messages in thread From: Thomas Gleixner @ 2015-09-17 14:29 UTC (permalink / raw) To: linux-arm-kernel On Thu, 17 Sep 2015, Oleksij Rempel wrote: > ping, > > looks like this patches are lost. I said that a hundred times before. The proper mailinglist for drivers/irqchip patches is lkml. See MAINTAINERS. That's where my filters run and I'm not going to collect stuff which comes in via some random other mailinglist. Care to resend? Thanks, tglx ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 0/2] suport for Alphascale ASM9260, part 3 2014-11-28 16:50 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel 2014-11-28 16:50 ` [PATCH 1/2] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel 2014-11-28 16:50 ` [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel @ 2015-01-08 9:01 ` Oleksij Rempel 2 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:01 UTC (permalink / raw) To: linux-arm-kernel Am 28.11.2014 um 17:50 schrieb Oleksij Rempel: > Oleksij Rempel (2): > ARM: irqchip: mxs: prepare driver for HW with different offsets > ARM: irqchip: mxs: add Alpascale ASM9260 support > > drivers/irqchip/Kconfig | 5 + > drivers/irqchip/Makefile | 2 +- > drivers/irqchip/alphascale_asm9260-icoll.h | 109 +++++++++++++++++++++ > drivers/irqchip/irq-mxs.c | 150 ++++++++++++++++++++++++++--- > 4 files changed, 249 insertions(+), 17 deletions(-) > create mode 100644 drivers/irqchip/alphascale_asm9260-icoll.h > Any update here, should i resend this patches? -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150108/4f89be8e/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 0/4] suport for Alphascale ASM9260, part 4 2014-11-28 14:09 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann ` (2 preceding siblings ...) 2014-11-28 16:50 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel @ 2014-11-28 16:54 ` Oleksij Rempel 2014-11-28 16:54 ` [PATCH 1/4] ARM: clocksource: add asm9260_timer driver Oleksij Rempel ` (4 more replies) 3 siblings, 5 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:54 UTC (permalink / raw) To: linux-arm-kernel Oleksij Rempel (4): ARM: clocksource: add asm9260_timer driver ARM: dts: add DT for Alphascale ASM9260 SoC ARM: add alphascale,acc.txt bindings documentation add Alphascale to vendor-prefixes.txt .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 ++ arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 ++++++ drivers/clocksource/Kconfig | 9 + drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 +++++++++++++++++++++ 8 files changed, 424 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi create mode 100644 drivers/clocksource/asm9260_timer.c -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 1/4] ARM: clocksource: add asm9260_timer driver 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel @ 2014-11-28 16:54 ` Oleksij Rempel 2015-01-08 9:07 ` Oleksij Rempel 2014-11-28 16:54 ` [PATCH 2/4] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel ` (3 subsequent siblings) 4 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:54 UTC (permalink / raw) To: linux-arm-kernel In some cases asm9260 looks similar to iMX2x. One of exceptions is timer controller. So this patch introduces new driver for this special case. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/clocksource/Kconfig | 9 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 ++++++++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/clocksource/asm9260_timer.c diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 9042060..a2df6b2 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -223,4 +223,13 @@ config CLKSRC_VERSATILE ARM Versatile, RealView and Versatile Express reference platforms. +config ASM9260_TIMER + bool "Alphascale ASM9260 timer driver" + select CLKSRC_MMIO + select CLKSRC_OF + default y if MACH_ASM9260 + help + This enables build of a clocksource and clockevent driver for + the 32-bit System Timer hardware available on a Alphascale ASM9260. + endmenu diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 756f6f1..b84c3b8 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -46,3 +46,4 @@ obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o +obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c new file mode 100644 index 0000000..2c9c993 --- /dev/null +++ b/drivers/clocksource/asm9260_timer.c @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/sched.h> +#include <linux/clk.h> +#include <linux/clocksource.h> +#include <linux/clockchips.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/bitops.h> + +#define DRIVER_NAME "asm9260-timer" + +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ +#define SET_REG 4 +#define CLR_REG 8 + +#define HW_IR 0x0000 /* RW. Interrupt */ +#define BM_IR_CR0 BIT(4) +#define BM_IR_MR3 BIT(3) +#define BM_IR_MR2 BIT(2) +#define BM_IR_MR1 BIT(1) +#define BM_IR_MR0 BIT(0) + +#define HW_TCR 0x0010 /* RW. Timer controller */ +/* BM_C*_RST + * Timer Counter and the Prescale Counter are synchronously reset on the + * next positive edge of PCLK. The counters remain reset until TCR[1] is + * returned to zero. */ +#define BM_C3_RST BIT(7) +#define BM_C2_RST BIT(6) +#define BM_C1_RST BIT(5) +#define BM_C0_RST BIT(4) +/* BM_C*_EN + * 1 - Timer Counter and Prescale Counter are enabled for counting + * 0 - counters are disabled */ +#define BM_C3_EN BIT(3) +#define BM_C2_EN BIT(2) +#define BM_C1_EN BIT(1) +#define BM_C0_EN BIT(0) + +#define HW_DIR 0x0020 /* RW. Direction? */ +/* 00 - count up + * 01 - count down + * 10 - ?? 2^n/2 */ +#define BM_DIR_COUNT_UP 0 +#define BM_DIR_COUNT_DOWN 1 +#define BM_DIR0_SHIFT 0 +#define BM_DIR1_SHIFT 4 +#define BM_DIR2_SHIFT 8 +#define BM_DIR3_SHIFT 12 +#define BM_DIR_DEFAULT (BM_DIR_COUNT_UP << BM_DIR0_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR1_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR2_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR3_SHIFT) + +#define HW_TC0 0x0030 /* RO. Timer counter 0 */ +/* HW_TC*. Timer counter owerflow (0xffff.ffff to 0x0000.0000) do not generate + * interrupt. This registers can be used to detect overflow */ +#define HW_TC1 0x0040 +#define HW_TC2 0x0050 +#define HW_TC3 0x0060 + +#define HW_PR 0x0070 /* RW. prescaler */ +#define BM_PR_DISABLE 0 +#define HW_PC 0x0080 /* RO. Prescaler counter */ +#define HW_MCR 0x0090 /* RW. Match control */ +/* enable interrupt on match */ +#define BM_MCR_INT_EN(n) (1 << (n * 3 + 0)) +/* enable TC reset on match */ +#define BM_MCR_RES_EN(n) (1 << (n * 3 + 1)) +/* enable stop TC on match */ +#define BM_MCR_STOP_EN(n) (1 << (n * 3 + 2)) + +#define HW_MR0 0x00a0 /* RW. Match reg */ +#define HW_MR1 0x00b0 +#define HW_MR2 0x00C0 +#define HW_MR3 0x00D0 + +#define HW_CTCR 0x0180 /* Counter control */ +#define BM_CTCR0_SHIFT 0 +#define BM_CTCR1_SHIFT 2 +#define BM_CTCR2_SHIFT 4 +#define BM_CTCR3_SHIFT 6 +#define BM_CTCR_TM 0 /* Timer mode. Every rising PCLK edge. */ +#define BM_CTCR_DEFAULT (BM_CTCR_TM << BM_CTCR0_SHIFT | \ + BM_CTCR_TM << BM_CTCR1_SHIFT | \ + BM_CTCR_TM << BM_CTCR2_SHIFT | \ + BM_CTCR_TM << BM_CTCR3_SHIFT) + +static struct asm9260_timer_priv { + void __iomem *base; + unsigned long ticks_per_jiffy; +} priv; + +static int asm9260_timer_set_next_event(unsigned long delta, + struct clock_event_device *evt) +{ + /* configure match count for TC0 */ + writel_relaxed(delta, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + return 0; +} + +static void asm9260_timer_set_mode(enum clock_event_mode mode, + struct clock_event_device *evt) +{ + /* stop timer0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); + + switch (mode) { + case CLOCK_EVT_MODE_PERIODIC: + /* disable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + CLR_REG); + /* configure match count for TC0 */ + writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + break; + case CLOCK_EVT_MODE_ONESHOT: + /* enable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + SET_REG); + break; + default: + break; + } +} + +static struct clock_event_device event_dev = { + .name = DRIVER_NAME, + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = asm9260_timer_set_next_event, + .set_mode = asm9260_timer_set_mode, +}; + +static irqreturn_t asm9260_timer_interrupt(int irq, void *dev_id) +{ + struct clock_event_device *evt = dev_id; + + evt->event_handler(evt); + + writel_relaxed(BM_IR_MR0, priv.base + HW_IR); + + return IRQ_HANDLED; +} + +/* + * --------------------------------------------------------------------------- + * Timer initialization + * --------------------------------------------------------------------------- + */ +static void __init asm9260_timer_init(struct device_node *np) +{ + int irq; + struct clk *clk; + int ret; + unsigned long rate; + + priv.base = of_io_request_and_map(np, 0, np->name); + if (!priv.base) + panic("%s: unable to map resource", np->name); + + clk = of_clk_get(np, 0); + + ret = clk_prepare_enable(clk); + if (ret) + panic("Failed to enable clk!\n"); + + irq = irq_of_parse_and_map(np, 0); + ret = request_irq(irq, asm9260_timer_interrupt, IRQF_TIMER, + DRIVER_NAME, &event_dev); + if (ret) + panic("Failed to setup irq!\n"); + + /* set all timers for count-up */ + writel_relaxed(BM_DIR_DEFAULT, priv.base + HW_DIR); + /* disable divider */ + writel_relaxed(BM_PR_DISABLE, priv.base + HW_PR); + /* make sure all timers use every rising PCLK edge. */ + writel_relaxed(BM_CTCR_DEFAULT, priv.base + HW_CTCR); + /* enable interrupt for TC0 and clean setting for all other lines */ + writel_relaxed(BM_MCR_INT_EN(0) , priv.base + HW_MCR); + + rate = clk_get_rate(clk); + clocksource_mmio_init(priv.base + HW_TC1, DRIVER_NAME, rate, + 200, 32, clocksource_mmio_readl_up); + + /* Seems like we can't use counter without match register even if + * actions for MR are disabled. So, set MR to max value. */ + writel_relaxed(0xffffffff, priv.base + HW_MR1); + /* enable TC1 */ + writel_relaxed(BM_C1_EN, priv.base + HW_TCR + SET_REG); + + priv.ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ); + event_dev.cpumask = cpumask_of(0); + clockevents_config_and_register(&event_dev, rate, 0x2c00, 0xfffffffe); +} +CLOCKSOURCE_OF_DECLARE(asm9260_timer, "alphascale,asm9260-timer", + asm9260_timer_init); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH] clocksource driver for Alphascale asm9260 2014-11-28 16:54 ` [PATCH 1/4] ARM: clocksource: add asm9260_timer driver Oleksij Rempel @ 2015-01-08 9:07 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:07 UTC (permalink / raw) To: daniel.lezcano, tglx, linux-kernel, linux-arm-kernel; +Cc: Oleksij Rempel Hello, this patch provides clocksource support for Alphascale asm9260 SoC. As was suggested..., I explicitly ask you to merge this patch :D Oleksij Rempel (1): ARM: clocksource: add asm9260_timer driver drivers/clocksource/Kconfig | 9 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 ++++++++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/clocksource/asm9260_timer.c -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] clocksource driver for Alphascale asm9260 @ 2015-01-08 9:07 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:07 UTC (permalink / raw) To: linux-arm-kernel Hello, this patch provides clocksource support for Alphascale asm9260 SoC. As was suggested..., I explicitly ask you to merge this patch :D Oleksij Rempel (1): ARM: clocksource: add asm9260_timer driver drivers/clocksource/Kconfig | 9 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 ++++++++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/clocksource/asm9260_timer.c -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clocksource: add asm9260_timer driver 2015-01-08 9:07 ` Oleksij Rempel @ 2015-01-08 9:07 ` Oleksij Rempel -1 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:07 UTC (permalink / raw) To: daniel.lezcano, tglx, linux-kernel, linux-arm-kernel; +Cc: Oleksij Rempel In some cases asm9260 looks similar to iMX2x. One of exceptions is timer controller. So this patch introduces new driver for this special case. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/clocksource/Kconfig | 9 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 ++++++++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/clocksource/asm9260_timer.c diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index f657a48..2d38bf6 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -224,4 +224,13 @@ config CLKSRC_VERSATILE ARM Versatile, RealView and Versatile Express reference platforms. +config ASM9260_TIMER + bool "Alphascale ASM9260 timer driver" + select CLKSRC_MMIO + select CLKSRC_OF + default y if MACH_ASM9260 + help + This enables build of a clocksource and clockevent driver for + the 32-bit System Timer hardware available on a Alphascale ASM9260. + endmenu diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index fae0435..3da4665 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -47,3 +47,4 @@ obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o obj-$(CONFIG_ARCH_INTEGRATOR_AP) += timer-integrator-ap.o obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o +obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c new file mode 100644 index 0000000..2c9c993 --- /dev/null +++ b/drivers/clocksource/asm9260_timer.c @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/sched.h> +#include <linux/clk.h> +#include <linux/clocksource.h> +#include <linux/clockchips.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/bitops.h> + +#define DRIVER_NAME "asm9260-timer" + +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ +#define SET_REG 4 +#define CLR_REG 8 + +#define HW_IR 0x0000 /* RW. Interrupt */ +#define BM_IR_CR0 BIT(4) +#define BM_IR_MR3 BIT(3) +#define BM_IR_MR2 BIT(2) +#define BM_IR_MR1 BIT(1) +#define BM_IR_MR0 BIT(0) + +#define HW_TCR 0x0010 /* RW. Timer controller */ +/* BM_C*_RST + * Timer Counter and the Prescale Counter are synchronously reset on the + * next positive edge of PCLK. The counters remain reset until TCR[1] is + * returned to zero. */ +#define BM_C3_RST BIT(7) +#define BM_C2_RST BIT(6) +#define BM_C1_RST BIT(5) +#define BM_C0_RST BIT(4) +/* BM_C*_EN + * 1 - Timer Counter and Prescale Counter are enabled for counting + * 0 - counters are disabled */ +#define BM_C3_EN BIT(3) +#define BM_C2_EN BIT(2) +#define BM_C1_EN BIT(1) +#define BM_C0_EN BIT(0) + +#define HW_DIR 0x0020 /* RW. Direction? */ +/* 00 - count up + * 01 - count down + * 10 - ?? 2^n/2 */ +#define BM_DIR_COUNT_UP 0 +#define BM_DIR_COUNT_DOWN 1 +#define BM_DIR0_SHIFT 0 +#define BM_DIR1_SHIFT 4 +#define BM_DIR2_SHIFT 8 +#define BM_DIR3_SHIFT 12 +#define BM_DIR_DEFAULT (BM_DIR_COUNT_UP << BM_DIR0_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR1_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR2_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR3_SHIFT) + +#define HW_TC0 0x0030 /* RO. Timer counter 0 */ +/* HW_TC*. Timer counter owerflow (0xffff.ffff to 0x0000.0000) do not generate + * interrupt. This registers can be used to detect overflow */ +#define HW_TC1 0x0040 +#define HW_TC2 0x0050 +#define HW_TC3 0x0060 + +#define HW_PR 0x0070 /* RW. prescaler */ +#define BM_PR_DISABLE 0 +#define HW_PC 0x0080 /* RO. Prescaler counter */ +#define HW_MCR 0x0090 /* RW. Match control */ +/* enable interrupt on match */ +#define BM_MCR_INT_EN(n) (1 << (n * 3 + 0)) +/* enable TC reset on match */ +#define BM_MCR_RES_EN(n) (1 << (n * 3 + 1)) +/* enable stop TC on match */ +#define BM_MCR_STOP_EN(n) (1 << (n * 3 + 2)) + +#define HW_MR0 0x00a0 /* RW. Match reg */ +#define HW_MR1 0x00b0 +#define HW_MR2 0x00C0 +#define HW_MR3 0x00D0 + +#define HW_CTCR 0x0180 /* Counter control */ +#define BM_CTCR0_SHIFT 0 +#define BM_CTCR1_SHIFT 2 +#define BM_CTCR2_SHIFT 4 +#define BM_CTCR3_SHIFT 6 +#define BM_CTCR_TM 0 /* Timer mode. Every rising PCLK edge. */ +#define BM_CTCR_DEFAULT (BM_CTCR_TM << BM_CTCR0_SHIFT | \ + BM_CTCR_TM << BM_CTCR1_SHIFT | \ + BM_CTCR_TM << BM_CTCR2_SHIFT | \ + BM_CTCR_TM << BM_CTCR3_SHIFT) + +static struct asm9260_timer_priv { + void __iomem *base; + unsigned long ticks_per_jiffy; +} priv; + +static int asm9260_timer_set_next_event(unsigned long delta, + struct clock_event_device *evt) +{ + /* configure match count for TC0 */ + writel_relaxed(delta, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + return 0; +} + +static void asm9260_timer_set_mode(enum clock_event_mode mode, + struct clock_event_device *evt) +{ + /* stop timer0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); + + switch (mode) { + case CLOCK_EVT_MODE_PERIODIC: + /* disable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + CLR_REG); + /* configure match count for TC0 */ + writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + break; + case CLOCK_EVT_MODE_ONESHOT: + /* enable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + SET_REG); + break; + default: + break; + } +} + +static struct clock_event_device event_dev = { + .name = DRIVER_NAME, + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = asm9260_timer_set_next_event, + .set_mode = asm9260_timer_set_mode, +}; + +static irqreturn_t asm9260_timer_interrupt(int irq, void *dev_id) +{ + struct clock_event_device *evt = dev_id; + + evt->event_handler(evt); + + writel_relaxed(BM_IR_MR0, priv.base + HW_IR); + + return IRQ_HANDLED; +} + +/* + * --------------------------------------------------------------------------- + * Timer initialization + * --------------------------------------------------------------------------- + */ +static void __init asm9260_timer_init(struct device_node *np) +{ + int irq; + struct clk *clk; + int ret; + unsigned long rate; + + priv.base = of_io_request_and_map(np, 0, np->name); + if (!priv.base) + panic("%s: unable to map resource", np->name); + + clk = of_clk_get(np, 0); + + ret = clk_prepare_enable(clk); + if (ret) + panic("Failed to enable clk!\n"); + + irq = irq_of_parse_and_map(np, 0); + ret = request_irq(irq, asm9260_timer_interrupt, IRQF_TIMER, + DRIVER_NAME, &event_dev); + if (ret) + panic("Failed to setup irq!\n"); + + /* set all timers for count-up */ + writel_relaxed(BM_DIR_DEFAULT, priv.base + HW_DIR); + /* disable divider */ + writel_relaxed(BM_PR_DISABLE, priv.base + HW_PR); + /* make sure all timers use every rising PCLK edge. */ + writel_relaxed(BM_CTCR_DEFAULT, priv.base + HW_CTCR); + /* enable interrupt for TC0 and clean setting for all other lines */ + writel_relaxed(BM_MCR_INT_EN(0) , priv.base + HW_MCR); + + rate = clk_get_rate(clk); + clocksource_mmio_init(priv.base + HW_TC1, DRIVER_NAME, rate, + 200, 32, clocksource_mmio_readl_up); + + /* Seems like we can't use counter without match register even if + * actions for MR are disabled. So, set MR to max value. */ + writel_relaxed(0xffffffff, priv.base + HW_MR1); + /* enable TC1 */ + writel_relaxed(BM_C1_EN, priv.base + HW_TCR + SET_REG); + + priv.ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ); + event_dev.cpumask = cpumask_of(0); + clockevents_config_and_register(&event_dev, rate, 0x2c00, 0xfffffffe); +} +CLOCKSOURCE_OF_DECLARE(asm9260_timer, "alphascale,asm9260-timer", + asm9260_timer_init); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH] ARM: clocksource: add asm9260_timer driver @ 2015-01-08 9:07 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:07 UTC (permalink / raw) To: linux-arm-kernel In some cases asm9260 looks similar to iMX2x. One of exceptions is timer controller. So this patch introduces new driver for this special case. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/clocksource/Kconfig | 9 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/asm9260_timer.c | 220 ++++++++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/clocksource/asm9260_timer.c diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index f657a48..2d38bf6 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -224,4 +224,13 @@ config CLKSRC_VERSATILE ARM Versatile, RealView and Versatile Express reference platforms. +config ASM9260_TIMER + bool "Alphascale ASM9260 timer driver" + select CLKSRC_MMIO + select CLKSRC_OF + default y if MACH_ASM9260 + help + This enables build of a clocksource and clockevent driver for + the 32-bit System Timer hardware available on a Alphascale ASM9260. + endmenu diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index fae0435..3da4665 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -47,3 +47,4 @@ obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o obj-$(CONFIG_ARCH_INTEGRATOR_AP) += timer-integrator-ap.o obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o +obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c new file mode 100644 index 0000000..2c9c993 --- /dev/null +++ b/drivers/clocksource/asm9260_timer.c @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/sched.h> +#include <linux/clk.h> +#include <linux/clocksource.h> +#include <linux/clockchips.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/bitops.h> + +#define DRIVER_NAME "asm9260-timer" + +/* + * this device provide 4 offsets for each register: + * 0x0 - plain read write mode + * 0x4 - set mode, OR logic. + * 0x8 - clr mode, XOR logic. + * 0xc - togle mode. + */ +#define SET_REG 4 +#define CLR_REG 8 + +#define HW_IR 0x0000 /* RW. Interrupt */ +#define BM_IR_CR0 BIT(4) +#define BM_IR_MR3 BIT(3) +#define BM_IR_MR2 BIT(2) +#define BM_IR_MR1 BIT(1) +#define BM_IR_MR0 BIT(0) + +#define HW_TCR 0x0010 /* RW. Timer controller */ +/* BM_C*_RST + * Timer Counter and the Prescale Counter are synchronously reset on the + * next positive edge of PCLK. The counters remain reset until TCR[1] is + * returned to zero. */ +#define BM_C3_RST BIT(7) +#define BM_C2_RST BIT(6) +#define BM_C1_RST BIT(5) +#define BM_C0_RST BIT(4) +/* BM_C*_EN + * 1 - Timer Counter and Prescale Counter are enabled for counting + * 0 - counters are disabled */ +#define BM_C3_EN BIT(3) +#define BM_C2_EN BIT(2) +#define BM_C1_EN BIT(1) +#define BM_C0_EN BIT(0) + +#define HW_DIR 0x0020 /* RW. Direction? */ +/* 00 - count up + * 01 - count down + * 10 - ?? 2^n/2 */ +#define BM_DIR_COUNT_UP 0 +#define BM_DIR_COUNT_DOWN 1 +#define BM_DIR0_SHIFT 0 +#define BM_DIR1_SHIFT 4 +#define BM_DIR2_SHIFT 8 +#define BM_DIR3_SHIFT 12 +#define BM_DIR_DEFAULT (BM_DIR_COUNT_UP << BM_DIR0_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR1_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR2_SHIFT | \ + BM_DIR_COUNT_UP << BM_DIR3_SHIFT) + +#define HW_TC0 0x0030 /* RO. Timer counter 0 */ +/* HW_TC*. Timer counter owerflow (0xffff.ffff to 0x0000.0000) do not generate + * interrupt. This registers can be used to detect overflow */ +#define HW_TC1 0x0040 +#define HW_TC2 0x0050 +#define HW_TC3 0x0060 + +#define HW_PR 0x0070 /* RW. prescaler */ +#define BM_PR_DISABLE 0 +#define HW_PC 0x0080 /* RO. Prescaler counter */ +#define HW_MCR 0x0090 /* RW. Match control */ +/* enable interrupt on match */ +#define BM_MCR_INT_EN(n) (1 << (n * 3 + 0)) +/* enable TC reset on match */ +#define BM_MCR_RES_EN(n) (1 << (n * 3 + 1)) +/* enable stop TC on match */ +#define BM_MCR_STOP_EN(n) (1 << (n * 3 + 2)) + +#define HW_MR0 0x00a0 /* RW. Match reg */ +#define HW_MR1 0x00b0 +#define HW_MR2 0x00C0 +#define HW_MR3 0x00D0 + +#define HW_CTCR 0x0180 /* Counter control */ +#define BM_CTCR0_SHIFT 0 +#define BM_CTCR1_SHIFT 2 +#define BM_CTCR2_SHIFT 4 +#define BM_CTCR3_SHIFT 6 +#define BM_CTCR_TM 0 /* Timer mode. Every rising PCLK edge. */ +#define BM_CTCR_DEFAULT (BM_CTCR_TM << BM_CTCR0_SHIFT | \ + BM_CTCR_TM << BM_CTCR1_SHIFT | \ + BM_CTCR_TM << BM_CTCR2_SHIFT | \ + BM_CTCR_TM << BM_CTCR3_SHIFT) + +static struct asm9260_timer_priv { + void __iomem *base; + unsigned long ticks_per_jiffy; +} priv; + +static int asm9260_timer_set_next_event(unsigned long delta, + struct clock_event_device *evt) +{ + /* configure match count for TC0 */ + writel_relaxed(delta, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + return 0; +} + +static void asm9260_timer_set_mode(enum clock_event_mode mode, + struct clock_event_device *evt) +{ + /* stop timer0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); + + switch (mode) { + case CLOCK_EVT_MODE_PERIODIC: + /* disable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + CLR_REG); + /* configure match count for TC0 */ + writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + break; + case CLOCK_EVT_MODE_ONESHOT: + /* enable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + SET_REG); + break; + default: + break; + } +} + +static struct clock_event_device event_dev = { + .name = DRIVER_NAME, + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = asm9260_timer_set_next_event, + .set_mode = asm9260_timer_set_mode, +}; + +static irqreturn_t asm9260_timer_interrupt(int irq, void *dev_id) +{ + struct clock_event_device *evt = dev_id; + + evt->event_handler(evt); + + writel_relaxed(BM_IR_MR0, priv.base + HW_IR); + + return IRQ_HANDLED; +} + +/* + * --------------------------------------------------------------------------- + * Timer initialization + * --------------------------------------------------------------------------- + */ +static void __init asm9260_timer_init(struct device_node *np) +{ + int irq; + struct clk *clk; + int ret; + unsigned long rate; + + priv.base = of_io_request_and_map(np, 0, np->name); + if (!priv.base) + panic("%s: unable to map resource", np->name); + + clk = of_clk_get(np, 0); + + ret = clk_prepare_enable(clk); + if (ret) + panic("Failed to enable clk!\n"); + + irq = irq_of_parse_and_map(np, 0); + ret = request_irq(irq, asm9260_timer_interrupt, IRQF_TIMER, + DRIVER_NAME, &event_dev); + if (ret) + panic("Failed to setup irq!\n"); + + /* set all timers for count-up */ + writel_relaxed(BM_DIR_DEFAULT, priv.base + HW_DIR); + /* disable divider */ + writel_relaxed(BM_PR_DISABLE, priv.base + HW_PR); + /* make sure all timers use every rising PCLK edge. */ + writel_relaxed(BM_CTCR_DEFAULT, priv.base + HW_CTCR); + /* enable interrupt for TC0 and clean setting for all other lines */ + writel_relaxed(BM_MCR_INT_EN(0) , priv.base + HW_MCR); + + rate = clk_get_rate(clk); + clocksource_mmio_init(priv.base + HW_TC1, DRIVER_NAME, rate, + 200, 32, clocksource_mmio_readl_up); + + /* Seems like we can't use counter without match register even if + * actions for MR are disabled. So, set MR to max value. */ + writel_relaxed(0xffffffff, priv.base + HW_MR1); + /* enable TC1 */ + writel_relaxed(BM_C1_EN, priv.base + HW_TCR + SET_REG); + + priv.ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ); + event_dev.cpumask = cpumask_of(0); + clockevents_config_and_register(&event_dev, rate, 0x2c00, 0xfffffffe); +} +CLOCKSOURCE_OF_DECLARE(asm9260_timer, "alphascale,asm9260-timer", + asm9260_timer_init); -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* Re: [PATCH] ARM: clocksource: add asm9260_timer driver 2015-01-08 9:07 ` Oleksij Rempel @ 2015-01-20 13:56 ` Daniel Lezcano -1 siblings, 0 replies; 81+ messages in thread From: Daniel Lezcano @ 2015-01-20 13:56 UTC (permalink / raw) To: Oleksij Rempel, tglx, linux-kernel, linux-arm-kernel On 01/08/2015 10:07 AM, Oleksij Rempel wrote: > In some cases asm9260 looks similar to iMX2x. One of exceptions is > timer controller. So this patch introduces new driver for this special case. > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> > Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Fixed conflict in the Makefile and applied to my tree. Thanks ! -- Daniel -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clocksource: add asm9260_timer driver @ 2015-01-20 13:56 ` Daniel Lezcano 0 siblings, 0 replies; 81+ messages in thread From: Daniel Lezcano @ 2015-01-20 13:56 UTC (permalink / raw) To: linux-arm-kernel On 01/08/2015 10:07 AM, Oleksij Rempel wrote: > In some cases asm9260 looks similar to iMX2x. One of exceptions is > timer controller. So this patch introduces new driver for this special case. > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> > Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Fixed conflict in the Makefile and applied to my tree. Thanks ! -- Daniel -- <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH] ARM: clocksource: fix compile of asm9260_timer driver on ARCH=parisc 2015-01-20 13:56 ` Daniel Lezcano (?) @ 2015-01-27 7:27 ` Oleksij Rempel 2015-01-27 8:49 ` Daniel Lezcano -1 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2015-01-27 7:27 UTC (permalink / raw) To: daniel.lezcano, linux-kernel, tglx; +Cc: Oleksij Rempel make sure this driver depends on GENERIC_CLOCKEVENTS compiler error was found by kbuild test robot: >> drivers/clocksource/asm9260_timer.c:114:14: warning: its scope is only this definition or declaration, which is probably not what you want >> drivers/clocksource/asm9260_timer.c:124:16: warning: 'struct clock_event_device' declared inside parameter list struct clock_event_device *evt) >> drivers/clocksource/asm9260_timer.c:124:16: warning: 'enum clock_event_mode' declared inside parameter list >> drivers/clocksource/asm9260_timer.c:123:58: error: parameter 1 ('mode') has incomplete type static void asm9260_timer_set_mode(enum clock_event_mode mode, Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- drivers/clocksource/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 13b8152..bfaaae4 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -231,6 +231,7 @@ config CLKSRC_MIPS_GIC config ASM9260_TIMER bool "Alphascale ASM9260 timer driver" + depends on GENERIC_CLOCKEVENTS select CLKSRC_MMIO select CLKSRC_OF default y if MACH_ASM9260 -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* Re: [PATCH] ARM: clocksource: fix compile of asm9260_timer driver on ARCH=parisc 2015-01-27 7:27 ` [PATCH] ARM: clocksource: fix compile of asm9260_timer driver on ARCH=parisc Oleksij Rempel @ 2015-01-27 8:49 ` Daniel Lezcano 2015-01-27 8:51 ` Oleksij Rempel 0 siblings, 1 reply; 81+ messages in thread From: Daniel Lezcano @ 2015-01-27 8:49 UTC (permalink / raw) To: Oleksij Rempel, linux-kernel, tglx On 01/27/2015 08:27 AM, Oleksij Rempel wrote: > make sure this driver depends on GENERIC_CLOCKEVENTS > > compiler error was found by kbuild test robot: > >>> drivers/clocksource/asm9260_timer.c:114:14: warning: its scope is only this definition or declaration, which is probably not what you want >>> drivers/clocksource/asm9260_timer.c:124:16: warning: 'struct clock_event_device' declared inside parameter list > struct clock_event_device *evt) > >>> drivers/clocksource/asm9260_timer.c:124:16: warning: 'enum clock_event_mode' declared inside parameter list >>> drivers/clocksource/asm9260_timer.c:123:58: error: parameter 1 ('mode') has incomplete type > static void asm9260_timer_set_mode(enum clock_event_mode mode, > > Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> I would like to fold this patch with the asm9260 timer patch in order to prevent git bisecting breakage. Ok for you ? > --- > drivers/clocksource/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig > index 13b8152..bfaaae4 100644 > --- a/drivers/clocksource/Kconfig > +++ b/drivers/clocksource/Kconfig > @@ -231,6 +231,7 @@ config CLKSRC_MIPS_GIC > > config ASM9260_TIMER > bool "Alphascale ASM9260 timer driver" > + depends on GENERIC_CLOCKEVENTS > select CLKSRC_MMIO > select CLKSRC_OF > default y if MACH_ASM9260 > -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog ^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH] ARM: clocksource: fix compile of asm9260_timer driver on ARCH=parisc 2015-01-27 8:49 ` Daniel Lezcano @ 2015-01-27 8:51 ` Oleksij Rempel 2015-01-27 9:05 ` Daniel Lezcano 0 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2015-01-27 8:51 UTC (permalink / raw) To: Daniel Lezcano, linux-kernel, tglx [-- Attachment #1: Type: text/plain, Size: 1630 bytes --] Am 27.01.2015 um 09:49 schrieb Daniel Lezcano: > On 01/27/2015 08:27 AM, Oleksij Rempel wrote: >> make sure this driver depends on GENERIC_CLOCKEVENTS >> >> compiler error was found by kbuild test robot: >> >>>> drivers/clocksource/asm9260_timer.c:114:14: warning: its scope is >>>> only this definition or declaration, which is probably not what you >>>> want >>>> drivers/clocksource/asm9260_timer.c:124:16: warning: 'struct >>>> clock_event_device' declared inside parameter list >> struct clock_event_device *evt) >> >>>> drivers/clocksource/asm9260_timer.c:124:16: warning: 'enum >>>> clock_event_mode' declared inside parameter list >>>> drivers/clocksource/asm9260_timer.c:123:58: error: parameter 1 >>>> ('mode') has incomplete type >> static void asm9260_timer_set_mode(enum clock_event_mode mode, >> >> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> > > I would like to fold this patch with the asm9260 timer patch in order to > prevent git bisecting breakage. Ok for you ? Ok, no problem. >> --- >> drivers/clocksource/Kconfig | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig >> index 13b8152..bfaaae4 100644 >> --- a/drivers/clocksource/Kconfig >> +++ b/drivers/clocksource/Kconfig >> @@ -231,6 +231,7 @@ config CLKSRC_MIPS_GIC >> >> config ASM9260_TIMER >> bool "Alphascale ASM9260 timer driver" >> + depends on GENERIC_CLOCKEVENTS >> select CLKSRC_MMIO >> select CLKSRC_OF >> default y if MACH_ASM9260 >> > > -- Regards, Oleksij [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 213 bytes --] ^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH] ARM: clocksource: fix compile of asm9260_timer driver on ARCH=parisc 2015-01-27 8:51 ` Oleksij Rempel @ 2015-01-27 9:05 ` Daniel Lezcano 0 siblings, 0 replies; 81+ messages in thread From: Daniel Lezcano @ 2015-01-27 9:05 UTC (permalink / raw) To: Oleksij Rempel, linux-kernel, tglx On 01/27/2015 09:51 AM, Oleksij Rempel wrote: > Am 27.01.2015 um 09:49 schrieb Daniel Lezcano: >> On 01/27/2015 08:27 AM, Oleksij Rempel wrote: >>> make sure this driver depends on GENERIC_CLOCKEVENTS >>> >>> compiler error was found by kbuild test robot: >>> >>>>> drivers/clocksource/asm9260_timer.c:114:14: warning: its scope is >>>>> only this definition or declaration, which is probably not what you >>>>> want >>>>> drivers/clocksource/asm9260_timer.c:124:16: warning: 'struct >>>>> clock_event_device' declared inside parameter list >>> struct clock_event_device *evt) >>> >>>>> drivers/clocksource/asm9260_timer.c:124:16: warning: 'enum >>>>> clock_event_mode' declared inside parameter list >>>>> drivers/clocksource/asm9260_timer.c:123:58: error: parameter 1 >>>>> ('mode') has incomplete type >>> static void asm9260_timer_set_mode(enum clock_event_mode mode, >>> >>> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> >> >> I would like to fold this patch with the asm9260 timer patch in order to >> prevent git bisecting breakage. Ok for you ? > > Ok, no problem. Done. -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 2/4] ARM: dts: add DT for Alphascale ASM9260 SoC 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 2014-11-28 16:54 ` [PATCH 1/4] ARM: clocksource: add asm9260_timer driver Oleksij Rempel @ 2014-11-28 16:54 ` Oleksij Rempel 2014-11-28 16:54 ` [PATCH 3/4] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel ` (2 subsequent siblings) 4 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:54 UTC (permalink / raw) To: linux-arm-kernel for now it is wary basic SoC description with most important IPs needed to make this device work Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 +++++ arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 +++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 38c89ca..6e24264 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -517,6 +517,8 @@ dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \ dove-dove-db.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt6589-aquaris5.dtb +dtb-$(CONFIG_MACH_ASM9260) += alphascale-asm9260-devkit.dtb + targets += dtbs dtbs_install targets += $(dtb-y) endif diff --git a/arch/arm/boot/dts/alphascale-asm9260-devkit.dts b/arch/arm/boot/dts/alphascale-asm9260-devkit.dts new file mode 100644 index 0000000..c77e2c9 --- /dev/null +++ b/arch/arm/boot/dts/alphascale-asm9260-devkit.dts @@ -0,0 +1,13 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * Licensed under the X11 license or the GPL v2 (or later) + */ + +/dts-v1/; +#include "alphascale-asm9260.dtsi" + +/ { + model = "Alphascale asm9260 Development Kit"; + compatible = "alphascale,asm9260devkit", "alphascale,asm9260"; +}; diff --git a/arch/arm/boot/dts/alphascale-asm9260.dtsi b/arch/arm/boot/dts/alphascale-asm9260.dtsi new file mode 100644 index 0000000..907fc7b --- /dev/null +++ b/arch/arm/boot/dts/alphascale-asm9260.dtsi @@ -0,0 +1,63 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * Licensed under the X11 license or the GPL v2 (or later) + */ + +#include "skeleton.dtsi" +#include <dt-bindings/clock/alphascale,asm9260.h> + +/ { + interrupt-parent = <&icoll>; + + memory { + device_type = "memory"; + reg = <0x20000000 0x2000000>; + }; + + cpus { + #address-cells = <0>; + #size-cells = <0>; + + cpu { + compatible = "arm,arm926ej-s"; + device_type = "cpu"; + clocks = <&acc CLKID_SYS_CPU>; + }; + }; + + osc24m: oscillator { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-accuracy = <30000>; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges; + + acc: clock-controller at 80040000 { + compatible = "alphascale,asm9260-clock-controller"; + #clock-cells = <1>; + clocks = <&osc24m>; + reg = <0x80040000 0x204>; + }; + + icoll: interrupt-controller at 80054000 { + compatible = "alphascale,asm9260-icoll"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x80054000 0x200>; + }; + + timer0: timer at 80088000 { + compatible = "alphascale,asm9260-timer"; + reg = <0x80088000 0x4000>; + clocks = <&acc CLKID_AHB_TIMER0>; + interrupts = <29>; + }; + }; +}; -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 3/4] ARM: add alphascale,acc.txt bindings documentation 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 2014-11-28 16:54 ` [PATCH 1/4] ARM: clocksource: add asm9260_timer driver Oleksij Rempel 2014-11-28 16:54 ` [PATCH 2/4] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel @ 2014-11-28 16:54 ` Oleksij Rempel 2014-11-28 16:54 ` [PATCH 4/4] add Alphascale to vendor-prefixes.txt Oleksij Rempel 2015-01-06 11:06 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 4 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:54 UTC (permalink / raw) To: linux-arm-kernel ACC is for AlphaScale Clock Controller. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt diff --git a/Documentation/devicetree/bindings/clock/alphascale,acc.txt b/Documentation/devicetree/bindings/clock/alphascale,acc.txt new file mode 100644 index 0000000..62e67e8 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/alphascale,acc.txt @@ -0,0 +1,115 @@ +Alphascale Clock Controller + +The ACC (Alphascale Clock Controller) is responsible of choising proper +clock source, setting deviders and clock gates. + +Required properties for the ACC node: + - compatible: must be "alphascale,asm9260-clock-controller" + - reg: must contain the ACC register base and size + - #clock-cells : shall be set to 1. + +Simple one-cell clock specifier format is used, where the only cell is used +as an index of the clock inside the provider. +It is encouraged to use dt-binding for clock index definitions. SoC specific +dt-binding should be included to the device tree descriptor. For example +Alphascale ASM9260: +#include <dt-bindings/clock/alphascale,asm9260.h> + +This binding contains two types of clock providers: + _AHB_ - AHB gate; + _SYS_ - adjustable clock source. Not all peripheral have _SYS_ clock provider. +All clock specific details can be found in the SoC documentation. +CLKID_AHB_ROM 0 +CLKID_AHB_RAM 1 +CLKID_AHB_GPIO 2 +CLKID_AHB_MAC 3 +CLKID_AHB_EMI 4 +CLKID_AHB_USB0 5 +CLKID_AHB_USB1 6 +CLKID_AHB_DMA0 7 +CLKID_AHB_DMA1 8 +CLKID_AHB_UART0 9 +CLKID_AHB_UART1 10 +CLKID_AHB_UART2 11 +CLKID_AHB_UART3 12 +CLKID_AHB_UART4 13 +CLKID_AHB_UART5 14 +CLKID_AHB_UART6 15 +CLKID_AHB_UART7 16 +CLKID_AHB_UART8 17 +CLKID_AHB_UART9 18 +CLKID_AHB_I2S0 19 +CLKID_AHB_I2C0 20 +CLKID_AHB_I2C1 21 +CLKID_AHB_SSP0 22 +CLKID_AHB_IOCONFIG 23 +CLKID_AHB_WDT 24 +CLKID_AHB_CAN0 25 +CLKID_AHB_CAN1 26 +CLKID_AHB_MPWM 27 +CLKID_AHB_SPI0 28 +CLKID_AHB_SPI1 29 +CLKID_AHB_QEI 30 +CLKID_AHB_QUADSPI0 31 +CLKID_AHB_CAMIF 32 +CLKID_AHB_LCDIF 33 +CLKID_AHB_TIMER0 34 +CLKID_AHB_TIMER1 35 +CLKID_AHB_TIMER2 36 +CLKID_AHB_TIMER3 37 +CLKID_AHB_IRQ 38 +CLKID_AHB_RTC 39 +CLKID_AHB_NAND 40 +CLKID_AHB_ADC0 41 +CLKID_AHB_LED 42 +CLKID_AHB_DAC0 43 +CLKID_AHB_LCD 44 +CLKID_AHB_I2S1 45 +CLKID_AHB_MAC1 46 + +CLKID_SYS_CPU 47 +CLKID_SYS_AHB 48 +CLKID_SYS_I2S0M 49 +CLKID_SYS_I2S0S 50 +CLKID_SYS_I2S1M 51 +CLKID_SYS_I2S1S 52 +CLKID_SYS_UART0 53 +CLKID_SYS_UART1 54 +CLKID_SYS_UART2 55 +CLKID_SYS_UART3 56 +CLKID_SYS_UART4 56 +CLKID_SYS_UART5 57 +CLKID_SYS_UART6 58 +CLKID_SYS_UART7 59 +CLKID_SYS_UART8 60 +CLKID_SYS_UART9 61 +CLKID_SYS_SPI0 62 +CLKID_SYS_SPI1 63 +CLKID_SYS_QUADSPI 64 +CLKID_SYS_SSP0 65 +CLKID_SYS_NAND 66 +CLKID_SYS_TRACE 67 +CLKID_SYS_CAMM 68 +CLKID_SYS_WDT 69 +CLKID_SYS_CLKOUT 70 +CLKID_SYS_MAC 71 +CLKID_SYS_LCD 72 +CLKID_SYS_ADCANA 73 + +Example of clock consumer with _SYS_ and _AHB_ sinks. +uart4: serial at 80010000 { + compatible = "alphascale,asm9260-uart"; + reg = <0x80010000 0x4000>; + clocks = <&acc CLKID_SYS_UART4>, <&acc CLKID_AHB_UART4>; + interrupts = <19>; + status = "disabled"; +}; + +Clock consumer with only one, _AHB_ sink. +timer0: timer at 80088000 { + compatible = "alphascale,asm9260-timer"; + reg = <0x80088000 0x4000>; + clocks = <&acc CLKID_AHB_TIMER0>; + interrupts = <29>; +}; + -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 4/4] add Alphascale to vendor-prefixes.txt 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel ` (2 preceding siblings ...) 2014-11-28 16:54 ` [PATCH 3/4] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel @ 2014-11-28 16:54 ` Oleksij Rempel 2015-01-06 11:06 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 4 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-28 16:54 UTC (permalink / raw) To: linux-arm-kernel this company already provided some products, so it make sense to add them to vendor-prefixes.txt list Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Acked-by: Rob Herring <robh@kernel.org> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 723999d..cd17a66 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -11,6 +11,7 @@ adi Analog Devices, Inc. aeroflexgaisler Aeroflex Gaisler AB ak Asahi Kasei Corp. allwinner Allwinner Technology Co., Ltd. +alphascale AlphaScale Integrated Circuits Systems, Inc. altr Altera Corp. amcc Applied Micro Circuits Corporation (APM, formally AMCC) amd Advanced Micro Devices (AMD), Inc. -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 0/4] suport for Alphascale ASM9260, part 4 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel ` (3 preceding siblings ...) 2014-11-28 16:54 ` [PATCH 4/4] add Alphascale to vendor-prefixes.txt Oleksij Rempel @ 2015-01-06 11:06 ` Oleksij Rempel 2015-01-06 14:11 ` Arnd Bergmann 4 siblings, 1 reply; 81+ messages in thread From: Oleksij Rempel @ 2015-01-06 11:06 UTC (permalink / raw) To: linux-arm-kernel Hello all, any updates here? Am 28.11.2014 um 17:54 schrieb Oleksij Rempel: > Oleksij Rempel (4): > ARM: clocksource: add asm9260_timer driver > ARM: dts: add DT for Alphascale ASM9260 SoC > ARM: add alphascale,acc.txt bindings documentation > add Alphascale to vendor-prefixes.txt > > .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++++++ > .../devicetree/bindings/vendor-prefixes.txt | 1 + > arch/arm/boot/dts/Makefile | 2 + > arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 ++ > arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 ++++++ > drivers/clocksource/Kconfig | 9 + > drivers/clocksource/Makefile | 1 + > drivers/clocksource/asm9260_timer.c | 220 +++++++++++++++++++++ > 8 files changed, 424 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt > create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts > create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi > create mode 100644 drivers/clocksource/asm9260_timer.c > -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150106/a7b7bcae/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 0/4] suport for Alphascale ASM9260, part 4 2015-01-06 11:06 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel @ 2015-01-06 14:11 ` Arnd Bergmann 2015-01-08 9:16 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Oleksij Rempel 0 siblings, 1 reply; 81+ messages in thread From: Arnd Bergmann @ 2015-01-06 14:11 UTC (permalink / raw) To: linux-arm-kernel On Tuesday 06 January 2015 12:06:36 Oleksij Rempel wrote: > Hello all, > > any updates here? > > Am 28.11.2014 um 17:54 schrieb Oleksij Rempel: > > Oleksij Rempel (4): > > ARM: clocksource: add asm9260_timer driver > > ARM: dts: add DT for Alphascale ASM9260 SoC > > ARM: add alphascale,acc.txt bindings documentation > > add Alphascale to vendor-prefixes.txt > > > I think this fell through the cracks because you were not very explicit about what you expected to happen with the patches. Please submit the parts that are missing to the respective maintainers again. The clocksource driver should get sent as a standalone patch to the addresses listed in the MAINTAINERS file, the rest should be addressed to arm at kernel.org with an introductory message asking for merging. I usually do some sweeps through my inbox looking for anything with [GIT PULL] in the subject, or mails that got sent to arm at kernel.org, but this one was neither. If we miss some patches that you think should have been merged already, it also helps to send a reminder about it. Arnd ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 2015-01-06 14:11 ` Arnd Bergmann @ 2015-01-08 9:16 ` Oleksij Rempel 2015-01-08 9:16 ` [PATCH 1/3] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel ` (3 more replies) 0 siblings, 4 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:16 UTC (permalink / raw) To: linux-arm-kernel Hello, this patches provide DT support for Alphascale asm9260 SoC. As was suggested..., I explicitly ask you to merge them :D Oleksij Rempel (3): ARM: dts: add DT for Alphascale ASM9260 SoC ARM: add alphascale,acc.txt bindings documentation add Alphascale to vendor-prefixes.txt .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/boot/dts/Makefile | 2 +- arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 +++ arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 +++++++++++ 5 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi -- 1.9.1 ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 1/3] ARM: dts: add DT for Alphascale ASM9260 SoC 2015-01-08 9:16 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Oleksij Rempel @ 2015-01-08 9:16 ` Oleksij Rempel 2015-01-08 9:16 ` [PATCH 2/3] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel ` (2 subsequent siblings) 3 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:16 UTC (permalink / raw) To: linux-arm-kernel for now it is wary basic SoC description with most important IPs needed to make this device work Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- arch/arm/boot/dts/Makefile | 2 +- arch/arm/boot/dts/alphascale-asm9260-devkit.dts | 13 +++++ arch/arm/boot/dts/alphascale-asm9260.dtsi | 63 +++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/alphascale-asm9260-devkit.dts create mode 100644 arch/arm/boot/dts/alphascale-asm9260.dtsi diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 6a3d9a6..2138030 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -552,7 +552,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt6589-aquaris5.dtb \ mt6592-evb.dtb \ mt8127-moose.dtb \ mt8135-evbp1.dtb - +dtb-$(CONFIG_MACH_ASM9260) += alphascale-asm9260-devkit.dtb endif always := $(dtb-y) diff --git a/arch/arm/boot/dts/alphascale-asm9260-devkit.dts b/arch/arm/boot/dts/alphascale-asm9260-devkit.dts new file mode 100644 index 0000000..c77e2c9 --- /dev/null +++ b/arch/arm/boot/dts/alphascale-asm9260-devkit.dts @@ -0,0 +1,13 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * Licensed under the X11 license or the GPL v2 (or later) + */ + +/dts-v1/; +#include "alphascale-asm9260.dtsi" + +/ { + model = "Alphascale asm9260 Development Kit"; + compatible = "alphascale,asm9260devkit", "alphascale,asm9260"; +}; diff --git a/arch/arm/boot/dts/alphascale-asm9260.dtsi b/arch/arm/boot/dts/alphascale-asm9260.dtsi new file mode 100644 index 0000000..907fc7b --- /dev/null +++ b/arch/arm/boot/dts/alphascale-asm9260.dtsi @@ -0,0 +1,63 @@ +/* + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> + * + * Licensed under the X11 license or the GPL v2 (or later) + */ + +#include "skeleton.dtsi" +#include <dt-bindings/clock/alphascale,asm9260.h> + +/ { + interrupt-parent = <&icoll>; + + memory { + device_type = "memory"; + reg = <0x20000000 0x2000000>; + }; + + cpus { + #address-cells = <0>; + #size-cells = <0>; + + cpu { + compatible = "arm,arm926ej-s"; + device_type = "cpu"; + clocks = <&acc CLKID_SYS_CPU>; + }; + }; + + osc24m: oscillator { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-accuracy = <30000>; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges; + + acc: clock-controller at 80040000 { + compatible = "alphascale,asm9260-clock-controller"; + #clock-cells = <1>; + clocks = <&osc24m>; + reg = <0x80040000 0x204>; + }; + + icoll: interrupt-controller at 80054000 { + compatible = "alphascale,asm9260-icoll"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x80054000 0x200>; + }; + + timer0: timer at 80088000 { + compatible = "alphascale,asm9260-timer"; + reg = <0x80088000 0x4000>; + clocks = <&acc CLKID_AHB_TIMER0>; + interrupts = <29>; + }; + }; +}; -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 2/3] ARM: add alphascale,acc.txt bindings documentation 2015-01-08 9:16 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Oleksij Rempel 2015-01-08 9:16 ` [PATCH 1/3] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel @ 2015-01-08 9:16 ` Oleksij Rempel 2015-01-08 9:16 ` [PATCH 3/3] add Alphascale to vendor-prefixes.txt Oleksij Rempel 2015-01-20 0:30 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Olof Johansson 3 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:16 UTC (permalink / raw) To: linux-arm-kernel ACC is for AlphaScale Clock Controller. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> --- .../devicetree/bindings/clock/alphascale,acc.txt | 115 +++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/alphascale,acc.txt diff --git a/Documentation/devicetree/bindings/clock/alphascale,acc.txt b/Documentation/devicetree/bindings/clock/alphascale,acc.txt new file mode 100644 index 0000000..62e67e8 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/alphascale,acc.txt @@ -0,0 +1,115 @@ +Alphascale Clock Controller + +The ACC (Alphascale Clock Controller) is responsible of choising proper +clock source, setting deviders and clock gates. + +Required properties for the ACC node: + - compatible: must be "alphascale,asm9260-clock-controller" + - reg: must contain the ACC register base and size + - #clock-cells : shall be set to 1. + +Simple one-cell clock specifier format is used, where the only cell is used +as an index of the clock inside the provider. +It is encouraged to use dt-binding for clock index definitions. SoC specific +dt-binding should be included to the device tree descriptor. For example +Alphascale ASM9260: +#include <dt-bindings/clock/alphascale,asm9260.h> + +This binding contains two types of clock providers: + _AHB_ - AHB gate; + _SYS_ - adjustable clock source. Not all peripheral have _SYS_ clock provider. +All clock specific details can be found in the SoC documentation. +CLKID_AHB_ROM 0 +CLKID_AHB_RAM 1 +CLKID_AHB_GPIO 2 +CLKID_AHB_MAC 3 +CLKID_AHB_EMI 4 +CLKID_AHB_USB0 5 +CLKID_AHB_USB1 6 +CLKID_AHB_DMA0 7 +CLKID_AHB_DMA1 8 +CLKID_AHB_UART0 9 +CLKID_AHB_UART1 10 +CLKID_AHB_UART2 11 +CLKID_AHB_UART3 12 +CLKID_AHB_UART4 13 +CLKID_AHB_UART5 14 +CLKID_AHB_UART6 15 +CLKID_AHB_UART7 16 +CLKID_AHB_UART8 17 +CLKID_AHB_UART9 18 +CLKID_AHB_I2S0 19 +CLKID_AHB_I2C0 20 +CLKID_AHB_I2C1 21 +CLKID_AHB_SSP0 22 +CLKID_AHB_IOCONFIG 23 +CLKID_AHB_WDT 24 +CLKID_AHB_CAN0 25 +CLKID_AHB_CAN1 26 +CLKID_AHB_MPWM 27 +CLKID_AHB_SPI0 28 +CLKID_AHB_SPI1 29 +CLKID_AHB_QEI 30 +CLKID_AHB_QUADSPI0 31 +CLKID_AHB_CAMIF 32 +CLKID_AHB_LCDIF 33 +CLKID_AHB_TIMER0 34 +CLKID_AHB_TIMER1 35 +CLKID_AHB_TIMER2 36 +CLKID_AHB_TIMER3 37 +CLKID_AHB_IRQ 38 +CLKID_AHB_RTC 39 +CLKID_AHB_NAND 40 +CLKID_AHB_ADC0 41 +CLKID_AHB_LED 42 +CLKID_AHB_DAC0 43 +CLKID_AHB_LCD 44 +CLKID_AHB_I2S1 45 +CLKID_AHB_MAC1 46 + +CLKID_SYS_CPU 47 +CLKID_SYS_AHB 48 +CLKID_SYS_I2S0M 49 +CLKID_SYS_I2S0S 50 +CLKID_SYS_I2S1M 51 +CLKID_SYS_I2S1S 52 +CLKID_SYS_UART0 53 +CLKID_SYS_UART1 54 +CLKID_SYS_UART2 55 +CLKID_SYS_UART3 56 +CLKID_SYS_UART4 56 +CLKID_SYS_UART5 57 +CLKID_SYS_UART6 58 +CLKID_SYS_UART7 59 +CLKID_SYS_UART8 60 +CLKID_SYS_UART9 61 +CLKID_SYS_SPI0 62 +CLKID_SYS_SPI1 63 +CLKID_SYS_QUADSPI 64 +CLKID_SYS_SSP0 65 +CLKID_SYS_NAND 66 +CLKID_SYS_TRACE 67 +CLKID_SYS_CAMM 68 +CLKID_SYS_WDT 69 +CLKID_SYS_CLKOUT 70 +CLKID_SYS_MAC 71 +CLKID_SYS_LCD 72 +CLKID_SYS_ADCANA 73 + +Example of clock consumer with _SYS_ and _AHB_ sinks. +uart4: serial at 80010000 { + compatible = "alphascale,asm9260-uart"; + reg = <0x80010000 0x4000>; + clocks = <&acc CLKID_SYS_UART4>, <&acc CLKID_AHB_UART4>; + interrupts = <19>; + status = "disabled"; +}; + +Clock consumer with only one, _AHB_ sink. +timer0: timer at 80088000 { + compatible = "alphascale,asm9260-timer"; + reg = <0x80088000 0x4000>; + clocks = <&acc CLKID_AHB_TIMER0>; + interrupts = <29>; +}; + -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 3/3] add Alphascale to vendor-prefixes.txt 2015-01-08 9:16 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Oleksij Rempel 2015-01-08 9:16 ` [PATCH 1/3] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel 2015-01-08 9:16 ` [PATCH 2/3] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel @ 2015-01-08 9:16 ` Oleksij Rempel 2015-01-20 0:30 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Olof Johansson 3 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-08 9:16 UTC (permalink / raw) To: linux-arm-kernel this company already provided some products, so it make sense to add them to vendor-prefixes.txt list Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Acked-by: Rob Herring <robh@kernel.org> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 0d35462..c03fc80 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -11,6 +11,7 @@ adi Analog Devices, Inc. aeroflexgaisler Aeroflex Gaisler AB ak Asahi Kasei Corp. allwinner Allwinner Technology Co., Ltd. +alphascale AlphaScale Integrated Circuits Systems, Inc. altr Altera Corp. amcc Applied Micro Circuits Corporation (APM, formally AMCC) amd Advanced Micro Devices (AMD), Inc. -- 1.9.1 ^ permalink raw reply related [flat|nested] 81+ messages in thread
* [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 2015-01-08 9:16 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Oleksij Rempel ` (2 preceding siblings ...) 2015-01-08 9:16 ` [PATCH 3/3] add Alphascale to vendor-prefixes.txt Oleksij Rempel @ 2015-01-20 0:30 ` Olof Johansson 2015-01-20 9:19 ` Oleksij Rempel 3 siblings, 1 reply; 81+ messages in thread From: Olof Johansson @ 2015-01-20 0:30 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jan 08, 2015 at 10:16:44AM +0100, Oleksij Rempel wrote: > Hello, > this patches provide DT support for Alphascale asm9260 SoC. > As was suggested..., I explicitly ask you to merge them :D Thanks, I've applied these three patches to a local asm/dt branch that has been merged into next/dt. -Olof ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 2015-01-20 0:30 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Olof Johansson @ 2015-01-20 9:19 ` Oleksij Rempel 0 siblings, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2015-01-20 9:19 UTC (permalink / raw) To: linux-arm-kernel Am 20.01.2015 um 01:30 schrieb Olof Johansson: > On Thu, Jan 08, 2015 at 10:16:44AM +0100, Oleksij Rempel wrote: >> Hello, >> this patches provide DT support for Alphascale asm9260 SoC. >> As was suggested..., I explicitly ask you to merge them :D > > Thanks, I've applied these three patches to a local asm/dt branch > that has been merged into next/dt. Thank you! -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150120/f5b5e4c4/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 2014-11-03 14:46 ` Rob Herring 2014-11-04 7:34 ` [PATCH v4] " Oleksij Rempel @ 2014-11-05 7:13 ` Oleksij Rempel 1 sibling, 0 replies; 81+ messages in thread From: Oleksij Rempel @ 2014-11-05 7:13 UTC (permalink / raw) To: linux-arm-kernel Should i resend complete patchset, or it is enough to send only updated patch? Am 03.11.2014 um 15:46 schrieb Rob Herring: > On Mon, Nov 3, 2014 at 10:14 PM, Oleksij Rempel <linux@rempel-privat.de> wrote: >> Since there is no public documentation, this patch also provide register >> offsets for different UART units on this SoC. >> >> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> >> --- >> arch/arm/Kconfig.debug | 31 ++++++++++++++++++++++++++++--- >> arch/arm/include/debug/asm9260.S | 31 +++++++++++++++++++++++++++++++ >> 2 files changed, 59 insertions(+), 3 deletions(-) >> create mode 100644 arch/arm/include/debug/asm9260.S >> >> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug >> index d8f6a2e..66c29db 100644 >> --- a/arch/arm/Kconfig.debug >> +++ b/arch/arm/Kconfig.debug >> @@ -93,6 +93,27 @@ choice >> prompt "Kernel low-level debugging port" >> depends on DEBUG_LL >> >> + config DEBUG_ASM9260_UART >> + bool "Kernel low-level debugging via asm9260 UART" >> + depends on MACH_ASM9260 >> + help >> + Say Y here if you want the debug print routines to direct >> + their output to an UART or USART port on asm9260 based >> + machines. >> + >> + DEBUG_UART_PHYS | DEBUG_UART_VIRT >> + >> + 0x80000000 | 0xf0000000 | UART0 >> + 0x80004000 | 0xf0004000 | UART1 >> + 0x80008000 | 0xf0008000 | UART2 >> + 0x8000c000 | 0xf000c000 | UART3 >> + 0x80010000 | 0xf0010000 | UART4 >> + 0x80014000 | 0xf0014000 | UART5 >> + 0x80018000 | 0xf0018000 | UART6 >> + 0x8001c000 | 0xf001c000 | UART7 >> + 0x80020000 | 0xf0020000 | UART8 >> + 0x80024000 | 0xf0024000 | UART9 >> + >> config AT91_DEBUG_LL_DBGU0 >> bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" >> depends on HAVE_AT91_DBGU0 >> @@ -1042,6 +1063,7 @@ config DEBUG_STI_UART >> config DEBUG_LL_INCLUDE >> string >> default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 >> + default "debug/asm9260.S" if DEBUG_ASM9260_UART >> default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 >> default "debug/meson.S" if DEBUG_MESON_UARTAO >> default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X >> @@ -1135,6 +1157,7 @@ config DEBUG_UART_PHYS >> default 0x78000000 if DEBUG_CNS3XXX >> default 0x7c0003f8 if FOOTBRIDGE >> default 0x78000000 if DEBUG_CNS3XXX >> + default 0x80010000 if DEBUG_ASM9260_UART >> default 0x80070000 if DEBUG_IMX23_UART >> default 0x80074000 if DEBUG_IMX28_UART >> default 0x80230000 if DEBUG_PICOXCELL_UART >> @@ -1171,13 +1194,14 @@ config DEBUG_UART_PHYS >> DEBUG_LL_UART_EFM32 || \ >> DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ >> DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ >> - DEBUG_UART_BCM63XX >> + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART >> >> config DEBUG_UART_VIRT >> hex "Virtual base address of debug UART" >> default 0xe0010fe0 if ARCH_RPC >> default 0xe1000000 if DEBUG_MSM_UART >> default 0xf0000be0 if ARCH_EBSA110 >> + default 0xf0010000 if DEBUG_ASM9260_UART >> default 0xf01fb000 if DEBUG_NOMADIK_UART >> default 0xf0201000 if DEBUG_BCM2835 >> default 0xf1000300 if DEBUG_BCM_5301X >> @@ -1244,7 +1268,7 @@ config DEBUG_UART_VIRT >> depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ >> DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ >> DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ >> - DEBUG_UART_BCM63XX >> + DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART >> >> config DEBUG_UART_8250_SHIFT >> int "Register offset shift for the 8250 debug UART" >> @@ -1286,7 +1310,8 @@ config DEBUG_UNCOMPRESS >> config UNCOMPRESS_INCLUDE >> string >> default "debug/uncompress.h" if ARCH_MULTIPLATFORM || ARCH_MSM || \ >> - PLAT_SAMSUNG || ARCH_EFM32 >> + PLAT_SAMSUNG || ARCH_EFM32 || \ >> + MACH_ASM9260 > > This should not be needed as multi-platform is enabled. > >> default "mach/uncompress.h" >> >> config EARLY_PRINTK >> diff --git a/arch/arm/include/debug/asm9260.S b/arch/arm/include/debug/asm9260.S >> new file mode 100644 >> index 0000000..c70d51f >> --- /dev/null >> +++ b/arch/arm/include/debug/asm9260.S >> @@ -0,0 +1,31 @@ >> +/* arch/arm/mach-imx/include/mach/debug-macro.S > > Wrong filename. Just remove this. > >> + * >> + * Debugging macro include header >> + * >> + * Copyright (C) 1994-1999 Russell King >> + * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks >> + * Modified for ASM9260 by Oleksij Remepl <linux@rempel-privat.de> >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> + * >> + */ >> + >> + .macro addruart, rp, rv, tmp >> + ldr \rp, = CONFIG_DEBUG_UART_PHYS >> + ldr \rv, = CONFIG_DEBUG_UART_VIRT >> + .endm >> + >> + .macro waituart,rd,rx >> + .endm >> + >> + .macro senduart,rd,rx >> + str \rd, [\rx, #0x50] @ TXDATA >> + .endm >> + >> + .macro busyuart,rd,rx >> +1002: ldr \rd, [\rx, #0x60] @ STAT >> + tst \rd, #1 << 27 @ TXEMPTY >> + beq 1002b @ wait until transmit done >> + .endm >> -- >> 1.9.1 >> -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 213 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141105/4c410ee5/attachment.sig> ^ permalink raw reply [flat|nested] 81+ messages in thread
end of thread, other threads:[~2015-09-17 14:29 UTC | newest] Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 1/9] ARM: add mach-asm9260 Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 2/9] ARM: add lolevel debug support for asm9260 Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 3/9] ARM: clk: add clk-asm9260 driver Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 4/9] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel 2014-11-02 2:19 ` Jason Cooper 2014-11-04 13:03 ` Shawn Guo 2014-11-04 13:13 ` Russell King - ARM Linux 2014-11-04 13:15 ` Oleksij Rempel 2014-11-04 13:16 ` Oleksij Rempel 2014-11-04 19:12 ` [PATCH v2] " Oleksij Rempel 2014-11-04 20:20 ` Thomas Gleixner 2014-11-04 20:27 ` Oleksij Rempel 2014-11-04 21:13 ` Thomas Gleixner 2014-10-21 10:40 ` [PATCH v8 6/9] ARM: clocksource: add asm9260_timer driver Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 7/9] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 8/9] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel 2014-10-21 10:40 ` [PATCH v8 9/9] add Alphascale to vendor-prefixes.txt Oleksij Rempel 2014-10-26 14:39 ` [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-10-26 15:26 ` Thomas Gleixner 2014-11-02 2:11 ` Jason Cooper 2014-11-02 6:51 ` Oleksij Rempel 2014-11-02 18:31 ` Jason Cooper 2014-11-02 19:56 ` Oleksij Rempel 2014-11-02 20:34 ` Jason Cooper 2014-11-03 14:14 ` [PATCH v3 0/2] " Oleksij Rempel 2014-11-03 14:14 ` [PATCH v3 1/2] ARM: add mach-asm9260 Oleksij Rempel 2014-11-03 14:14 ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel 2014-11-03 14:46 ` Rob Herring 2014-11-04 7:34 ` [PATCH v4] " Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 1/2] ARM: add mach-asm9260 Oleksij Rempel 2014-11-24 11:08 ` [PATCH v4 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel 2014-11-28 14:09 ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann 2014-11-28 14:13 ` Oleksij Rempel 2014-11-28 15:05 ` [PATCH] suport for Alphascale ASM9260, part 2 Oleksij Rempel 2014-11-28 15:05 ` [PATCH] ARM: clk: add clk-asm9260 driver Oleksij Rempel 2014-11-28 16:34 ` [PATCH] suport for Alphascale ASM9260, part 2 Arnd Bergmann 2015-01-08 8:59 ` [PATCH] clk support for Alphascale asm9260 Oleksij Rempel 2015-01-08 8:59 ` Oleksij Rempel 2015-01-08 8:59 ` [PATCH] ARM: clk: add clk-asm9260 driver Oleksij Rempel 2015-01-08 8:59 ` Oleksij Rempel 2015-01-14 23:02 ` Mike Turquette 2015-01-14 23:02 ` Mike Turquette 2015-01-15 9:45 ` Oleksij Rempel 2015-01-15 9:45 ` Oleksij Rempel 2015-01-19 17:22 ` Mike Turquette 2015-01-19 17:22 ` Mike Turquette 2015-01-20 9:23 ` [PATCH v2] " Oleksij Rempel 2015-01-20 18:13 ` Mike Turquette 2014-11-28 16:50 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel 2014-11-28 16:50 ` [PATCH 1/2] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel 2014-11-28 16:50 ` [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel 2015-09-17 13:17 ` Oleksij Rempel 2015-09-17 14:29 ` Thomas Gleixner 2015-01-08 9:01 ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel 2014-11-28 16:54 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 2014-11-28 16:54 ` [PATCH 1/4] ARM: clocksource: add asm9260_timer driver Oleksij Rempel 2015-01-08 9:07 ` [PATCH] clocksource driver for Alphascale asm9260 Oleksij Rempel 2015-01-08 9:07 ` Oleksij Rempel 2015-01-08 9:07 ` [PATCH] ARM: clocksource: add asm9260_timer driver Oleksij Rempel 2015-01-08 9:07 ` Oleksij Rempel 2015-01-20 13:56 ` Daniel Lezcano 2015-01-20 13:56 ` Daniel Lezcano 2015-01-27 7:27 ` [PATCH] ARM: clocksource: fix compile of asm9260_timer driver on ARCH=parisc Oleksij Rempel 2015-01-27 8:49 ` Daniel Lezcano 2015-01-27 8:51 ` Oleksij Rempel 2015-01-27 9:05 ` Daniel Lezcano 2014-11-28 16:54 ` [PATCH 2/4] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel 2014-11-28 16:54 ` [PATCH 3/4] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel 2014-11-28 16:54 ` [PATCH 4/4] add Alphascale to vendor-prefixes.txt Oleksij Rempel 2015-01-06 11:06 ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel 2015-01-06 14:11 ` Arnd Bergmann 2015-01-08 9:16 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Oleksij Rempel 2015-01-08 9:16 ` [PATCH 1/3] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel 2015-01-08 9:16 ` [PATCH 2/3] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel 2015-01-08 9:16 ` [PATCH 3/3] add Alphascale to vendor-prefixes.txt Oleksij Rempel 2015-01-20 0:30 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Olof Johansson 2015-01-20 9:19 ` Oleksij Rempel 2014-11-05 7:13 ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.