From patchwork Mon Apr 22 09:52:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 16294 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 726B925DEE for ; Mon, 22 Apr 2013 09:53:34 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id gf12sf3548576vcb.6 for ; Mon, 22 Apr 2013 02:52:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :from:to:cc:subject:date:message-id:x-mailer:mime-version :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=l4+e9R/8m6GDtta2fSjFDSm5kgakRbpt1mmmVkpMo0w=; b=BD7EPSab1DRgZg2eQOsEdxa30yUOCuPAaOYPl4vIVkRMjzgMSPnYzDuN6djiPbNdHW NBCPvFsp+DBwWM2WxXntxTZlcCo06jyBrtpHJgwx4vGcwp98RBlIyRx94O3SK+PKUCa1 drb4rDa0Htu+T+1VaxOBNrNddGwHpPLo+wJ3c4Sv7eeJ+Kg4mqnALAp/5+9uSFdMQKts KDqdWbf2QGHlZP/aObgJ+5XSZqLSwkJrVsonE5iVgE1coVfjkgCHgkJbBPtWowIvBL6+ UCtcSwdXkBeUuZLw+8TfYB1BhBUM0niOM0vXZuuVdhjJwa6CZmOFB5AAw+rPUqf1Ui49 nbAw== X-Received: by 10.224.18.133 with SMTP id w5mr5982465qaa.1.1366624368363; Mon, 22 Apr 2013 02:52:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.48.131 with SMTP id l3ls3152792qen.54.gmail; Mon, 22 Apr 2013 02:52:48 -0700 (PDT) X-Received: by 10.220.253.8 with SMTP id my8mr18647838vcb.23.1366624368189; Mon, 22 Apr 2013 02:52:48 -0700 (PDT) Received: from mail-vb0-x236.google.com (mail-vb0-x236.google.com [2607:f8b0:400c:c02::236]) by mx.google.com with ESMTPS id lt9si15549332vcb.31.2013.04.22.02.52.48 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Apr 2013 02:52:48 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::236; Received: by mail-vb0-f54.google.com with SMTP id w16so5667452vbf.13 for ; Mon, 22 Apr 2013 02:52:48 -0700 (PDT) X-Received: by 10.220.169.78 with SMTP id x14mr3398448vcy.41.1366624368011; Mon, 22 Apr 2013 02:52:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp68677veb; Mon, 22 Apr 2013 02:52:47 -0700 (PDT) X-Received: by 10.180.90.70 with SMTP id bu6mr40017437wib.34.1366624366947; Mon, 22 Apr 2013 02:52:46 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com [207.126.144.143]) by mx.google.com with SMTP id p2si38598511eeg.73.2013.04.22.02.52.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Apr 2013 02:52:46 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.143; Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKUXUIZv0bhb655SMi72lZU9KUkmD7Z0Zo@postini.com; Mon, 22 Apr 2013 09:52:46 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7DDDE1FA; Mon, 22 Apr 2013 09:52:26 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3DE734864; Mon, 22 Apr 2013 09:52:20 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 77430A8074; Mon, 22 Apr 2013 11:52:21 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Mon, 22 Apr 2013 11:52:25 +0200 From: Linus Walleij To: Cc: Arnd Bergmann , , Linus Walleij Subject: [PATCH 06/23] ARM: u300: basic device tree support Date: Mon, 22 Apr 2013 11:52:20 +0200 Message-ID: <1366624340-6293-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQk1ziNW/rNApP0GbdLqbIIkDxBDB8rwB8cn/7meNuFUvsVY3HLliHO9m8lQ6JhzqoLOxV90 X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Linus Walleij This register the most basic peripherals and makes the U300 boot to prompt from a device tree. Signed-off-by: Linus Walleij --- Documentation/devicetree/bindings/arm/ste-u300.txt | 9 +++ arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/ste-u300.dts | 86 ++++++++++++++++++++++ arch/arm/mach-u300/core.c | 80 ++++++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/ste-u300.txt create mode 100644 arch/arm/boot/dts/ste-u300.dts diff --git a/Documentation/devicetree/bindings/arm/ste-u300.txt b/Documentation/devicetree/bindings/arm/ste-u300.txt new file mode 100644 index 0000000..222dca5 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/ste-u300.txt @@ -0,0 +1,9 @@ +ST-Ericsson U300 Device Tree Bindings + +For various board the "board" node may contain specific properties +that pertain to this particular board, such as board-specific GPIOs +or board power regulator supplies. + +Required root node property: + +compatible="stericsson,u300"; diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 9c62558..369fba7 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -165,6 +165,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ tegra30-cardhu-a04.dtb \ tegra114-dalmore.dtb \ tegra114-pluto.dtb +dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ vexpress-v2p-ca9.dtb \ vexpress-v2p-ca15-tc1.dtb \ diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts new file mode 100644 index 0000000..80f963c --- /dev/null +++ b/arch/arm/boot/dts/ste-u300.dts @@ -0,0 +1,86 @@ +/* + * Device Tree for the ST-Ericsson U300 Machine and SoC + */ + +/dts-v1/; +/include/ "skeleton.dtsi" + +/ { + model = "ST-Ericsson U300"; + compatible = "stericsson,u300"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + bootargs = "root=/dev/ram0 console=ttyAMA0,115200n8 earlyprintk"; + }; + + aliases { + serial0 = &uart0; + serial1 = &uart1; + }; + + memory { + reg = <0x48000000 0x03c00000>; + }; + + timer: timer0@c0014000 { + compatible = "stericsson,u300-apptimer"; + reg = <0xc0014000 0x1000>; + interrupt-parent = <&vica>; + interrupts = <24 25 26 27>; + }; + + gpio: gpio0@c0016000 { + compatible = "stericsson,gpio-coh901"; + reg = <0xc0016000 0x1000>; + interrupt-parent = <&vicb>; + interrupts = <0 1 2 18 21 22 23>; + interrupt-names = "gpio0", "gpio1", "gpio2", "gpio3", + "gpio4", "gpio5", "gpio6"; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + + pinctrl: pinctrl0@c0011000 { + compatible = "stericsson,pinctrl-u300"; + reg = <0xc0011000 0x1000>; + }; + + amba { + compatible = "arm,amba-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + vica: intc@0xa0001000 { + compatible = "arm,versatile-vic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0xa0001000 0x20>; + }; + + vicb: intc@0xa0002000 { + compatible = "arm,versatile-vic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0xa0002000 0x20>; + }; + + uart0: uart@c0013000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0xc0013000 0x1000>; + interrupt-parent = <&vica>; + interrupts = <22>; + }; + + uart1: uart@c0007000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0xc0007000 0x1000>; + interrupt-parent = <&vicb>; + interrupts = <20>; + }; + }; +}; diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index a683d17..5b42983 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include @@ -698,3 +700,81 @@ MACHINE_START(U300, "Ericsson AB U335 S335/B335 Prototype Board") .init_machine = u300_init_machine, .restart = u300_restart, MACHINE_END + +#ifdef CONFIG_OF + +/* These are mostly to get the right device names for the clock lookups */ +static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = { + OF_DEV_AUXDATA("stericsson,pinctrl-u300", U300_SYSCON_BASE, + "pinctrl-u300", NULL), + OF_DEV_AUXDATA("stericsson,gpio-coh901", U300_GPIO_BASE, + "u300-gpio", &u300_gpio_plat), + OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE, + "uart0", &uart0_plat_data), + OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE, + "uart1", &uart1_plat_data), + OF_DEV_AUXDATA("arm,primecell", U300_MMCSD_BASE, + "mmci", &mmcsd_platform_data), + { /* sentinel */ }, +}; + +static void __init u300_init_irq_dt(void) +{ + struct clk *clk; + + /* initialize clocking early, we want to clock the INTCON */ + u300_clk_init(U300_SYSCON_VBASE); + + /* Bootstrap EMIF and SEMI clocks */ + clk = clk_get_sys("pl172", NULL); + BUG_ON(IS_ERR(clk)); + clk_prepare_enable(clk); + clk = clk_get_sys("semi", NULL); + BUG_ON(IS_ERR(clk)); + clk_prepare_enable(clk); + + /* Clock the interrupt controller */ + clk = clk_get_sys("intcon", NULL); + BUG_ON(IS_ERR(clk)); + clk_prepare_enable(clk); + + irqchip_init(); +} + +static void __init u300_init_machine_dt(void) +{ + u16 val; + + /* Check what platform we run and print some status information */ + u300_init_check_chip(); + + u300_assign_physmem(); + + /* Initialize pinmuxing */ + pinctrl_register_mappings(u300_pinmux_map, + ARRAY_SIZE(u300_pinmux_map)); + + of_platform_populate(NULL, of_default_bus_match_table, + u300_auxdata_lookup, NULL); + + /* Enable SEMI self refresh */ + val = readw(U300_SYSCON_VBASE + U300_SYSCON_SMCR) | + U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE; + writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR); +} + +static const char * u300_board_compat[] = { + "stericsson,u300", + NULL, +}; + +DT_MACHINE_START(U300_DT, "U300 S335/B335 (Device Tree)") + .map_io = u300_map_io, + .init_irq = u300_init_irq_dt, + .init_time = u300_timer_init, + .init_machine = u300_init_machine_dt, + .restart = u300_restart, + .dt_compat = u300_board_compat, +MACHINE_END + +#endif /* CONFIG_OF */