From patchwork Mon Jul 9 06:14:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 169694 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 943122C0210 for ; Mon, 9 Jul 2012 16:36:36 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1So7TK-0000MH-5u; Mon, 09 Jul 2012 06:29:26 +0000 Received: from tx2ehsobe001.messaging.microsoft.com ([65.55.88.11] helo=tx2outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1So7FG-0005St-Sn for linux-arm-kernel@lists.infradead.org; Mon, 09 Jul 2012 06:15:14 +0000 Received: from mail79-tx2-R.bigfish.com (10.9.14.251) by TX2EHSOBE006.bigfish.com (10.9.40.26) with Microsoft SMTP Server id 14.1.225.23; Mon, 9 Jul 2012 06:12:37 +0000 Received: from mail79-tx2 (localhost [127.0.0.1]) by mail79-tx2-R.bigfish.com (Postfix) with ESMTP id D273A4400C6; Mon, 9 Jul 2012 06:12:36 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzc89bhzz1202hzz8275dhz2dh87h2a8h668h839h93fhd24he5bhe96hf0ah107ah) X-FB-DOMAIN-IP-MATCH: fail Received: from mail79-tx2 (localhost.localdomain [127.0.0.1]) by mail79-tx2 (MessageSwitch) id 1341814354554882_4363; Mon, 9 Jul 2012 06:12:34 +0000 (UTC) Received: from TX2EHSMHS020.bigfish.com (unknown [10.9.14.252]) by mail79-tx2.bigfish.com (Postfix) with ESMTP id 82DE08022F; Mon, 9 Jul 2012 06:12:34 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS020.bigfish.com (10.9.99.120) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 9 Jul 2012 06:12:34 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.298.5; Mon, 9 Jul 2012 01:14:49 -0500 Received: from S2101-09.ap.freescale.net ([10.192.185.225]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q696EXE3023210; Sun, 8 Jul 2012 23:14:47 -0700 From: Shawn Guo To: Subject: [PATCH 5/7] ARM: mxs: convert tx28 board to device tree Date: Mon, 9 Jul 2012 14:14:54 +0800 Message-ID: <1341814496-17487-6-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1341814496-17487-1-git-send-email-shawn.guo@linaro.org> References: <1341814496-17487-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [65.55.88.11 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Shawn Guo , =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org The function tx28_init is basically a rewriting of tx28_add_fec0. All those TX28_FEC_* gpio definitions are meant to be used as a temporary solution before we get a generic way to set up board specific gpio pins when booting from device tree. Cc: Lothar Waßmann Signed-off-by: Shawn Guo --- arch/arm/boot/dts/imx28.dtsi | 36 +++++++++++++ arch/arm/boot/dts/tx28.dts | 112 ++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-mxs/mach-mxs.c | 48 +++++++++++++++++- 3 files changed, 195 insertions(+), 1 deletions(-) create mode 100644 arch/arm/boot/dts/tx28.dts diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index 73578cb..518236b 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -186,6 +186,19 @@ fsl,pull-up = <0>; }; + duart_4pins_a: duart-4pins@0 { + reg = <0>; + fsl,pinmux-ids = < + 0x3022 /* MX28_PAD_AUART0_CTS__DUART_RX */ + 0x3032 /* MX28_PAD_AUART0_RTS__DUART_TX */ + 0x3002 /* MX28_PAD_AUART0_RX__DUART_CTS */ + 0x3012 /* MX28_PAD_AUART0_TX__DUART_RTS */ + >; + fsl,drive-strength = <0>; + fsl,voltage = <1>; + fsl,pull-up = <0>; + }; + gpmi_pins_a: gpmi-nand@0 { reg = <0>; fsl,pinmux-ids = < @@ -243,6 +256,19 @@ fsl,pull-up = <0>; }; + auart1_pins_a: auart1@0 { + reg = <0>; + fsl,pinmux-ids = < + 0x3040 /* MX28_PAD_AUART1_RX__AUART1_RX */ + 0x3050 /* MX28_PAD_AUART1_TX__AUART1_TX */ + 0x3060 /* MX28_PAD_AUART1_CTS__AUART1_CTS */ + 0x3070 /* MX28_PAD_AUART1_RTS__AUART1_RTS */ + >; + fsl,drive-strength = <0>; + fsl,voltage = <1>; + fsl,pull-up = <0>; + }; + auart1_2pins_a: auart1-2pins@0 { reg = <0>; fsl,pinmux-ids = < @@ -407,6 +433,16 @@ fsl,pull-up = <1>; }; + pwm0_pins_a: pwm0@0 { + reg = <0>; + fsl,pinmux-ids = < + 0x3100 /* MX28_PAD_PWM0__PWM_0 */ + >; + fsl,drive-strength = <0>; + fsl,voltage = <1>; + fsl,pull-up = <0>; + }; + pwm2_pins_a: pwm2@0 { reg = <0>; fsl,pinmux-ids = < diff --git a/arch/arm/boot/dts/tx28.dts b/arch/arm/boot/dts/tx28.dts new file mode 100644 index 0000000..2737c79 --- /dev/null +++ b/arch/arm/boot/dts/tx28.dts @@ -0,0 +1,112 @@ +/dts-v1/; +/include/ "imx28.dtsi" + +/ { + model = "Ka-Ro electronics TX28 module"; + compatible = "karo,tx28", "fsl,imx28"; + + memory { + reg = <0x40000000 0x08000000>; + }; + + apb@80000000 { + apbh@80000000 { + ssp0: ssp@80010000 { + compatible = "fsl,imx28-mmc"; + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_4bit_pins_a + &mmc0_cd_cfg + &mmc0_sck_cfg>; + bus-width = <4>; + status = "okay"; + }; + + pinctrl@80018000 { + pinctrl-names = "default"; + pinctrl-0 = <&hog_pins_a>; + + hog_pins_a: hog-gpios@0 { + reg = <0>; + fsl,pinmux-ids = < + 0x31d3 /* MX28_PAD_PWM4__GPIO_3_29 */ + 0x4053 /* MX28_PAD_ENET0_TX_CLK__GPIO_4_5 */ + 0x40a3 /* MX28_PAD_ENET0_RXD3__GPIO_4_10 */ + 0x40d3 /* MX28_PAD_ENET0_RX_CLK__GPIO_4_13 */ + >; + fsl,drive-strength = <0>; + fsl,voltage = <1>; + fsl,pull-up = <0>; + }; + + hog_pins_b: hog-gpios-pull@0 { + reg = <0>; + fsl,pinmux-ids = < + 0x4023 /* MX28_PAD_ENET0_RX_EN__GPIO_4_2 */ + 0x4033 /* MX28_PAD_ENET0_RXD0__GPIO_4_3 */ + 0x4043 /* MX28_PAD_ENET0_RXD1__GPIO_4_4 */ + >; + fsl,drive-strength = <0>; + fsl,voltage = <1>; + fsl,pull-up = <1>; + }; + }; + }; + + apbx@80040000 { + i2c0: i2c@80058000 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins_a>; + status = "okay"; + + ds1339: rtc@68 { + compatible = "mxim,ds1339"; + reg = <0x68>; + }; + }; + + pwm: pwm@80064000 { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pins_a>; + status = "okay"; + }; + + duart: serial@80074000 { + pinctrl-names = "default"; + pinctrl-0 = <&duart_4pins_a>; + status = "okay"; + }; + + auart1: serial@8006c000 { + pinctrl-names = "default"; + pinctrl-0 = <&auart1_pins_a>; + status = "okay"; + }; + }; + }; + + ahb@80080000 { + mac0: ethernet@800f0000 { + phy-mode = "rmii"; + pinctrl-names = "default"; + pinctrl-0 = <&mac0_pins_a>; + status = "okay"; + }; + }; + + leds { + compatible = "gpio-leds"; + + user { + label = "Heartbeat"; + gpios = <&gpio4 10 0>; + linux,default-trigger = "heartbeat"; + }; + }; + + backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 5000000>; + brightness-levels = <0 4 8 16 32 64 128 255>; + default-brightness-level = <6>; + }; +}; diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 646bac5..e081666 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c @@ -12,8 +12,9 @@ #include #include +#include #include -#include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include static struct fb_videomode mx23evk_video_modes[] = { { @@ -250,6 +252,47 @@ static void __init apx4devkit_init(void) apx4devkit_phy_fixup); } +#define TX28_FEC_PHY_POWER MXS_GPIO_NR(3, 29) +#define TX28_FEC_PHY_RESET MXS_GPIO_NR(4, 13) +#define TX28_FEC_MODE_1 MXS_GPIO_NR(4, 2) +#define TX28_FEC_MODE_2 MXS_GPIO_NR(4, 3) +#define TX28_FEC_MODE_3 MXS_GPIO_NR(4, 4) +#define TX28_FEC_nINT MXS_GPIO_NR(4, 5) + +static const struct gpio tx28_gpios[] __initconst = { + { TX28_FEC_PHY_POWER, GPIOF_OUT_INIT_LOW, "fec-phy-power" }, + { TX28_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW, "fec-phy-reset" }, + { TX28_FEC_MODE_1, GPIOF_OUT_INIT_LOW, "fec-mode-1" }, + { TX28_FEC_MODE_2, GPIOF_OUT_INIT_LOW, "fec-mode-2" }, + { TX28_FEC_MODE_3, GPIOF_OUT_INIT_LOW, "fec-mode-3" }, + { TX28_FEC_nINT, GPIOF_DIR_IN, "fec-int" }, +}; + +static void __init tx28_init(void) +{ + int ret; + + ret = gpio_request_array(tx28_gpios, ARRAY_SIZE(tx28_gpios)); + if (ret) { + pr_err("%s: failed to request gpios: %d\n", __func__, ret); + return; + } + + /* Power up fec phy */ + gpio_set_value(TX28_FEC_PHY_POWER, 1); + mdelay(26); /* 25ms according to data sheet */ + + /* Mode strap pins */ + gpio_set_value(TX28_FEC_MODE_1, 1); + gpio_set_value(TX28_FEC_MODE_2, 1); + gpio_set_value(TX28_FEC_MODE_3, 1); + + udelay(100); /* minimum assertion time for nRST */ + + /* Deasserting FEC PHY RESET */ + gpio_set_value(TX28_FEC_PHY_RESET, 1); +} + static void __init mxs_machine_init(void) { if (of_machine_is_compatible("fsl,imx28-evk")) @@ -260,6 +303,8 @@ static void __init mxs_machine_init(void) m28evk_init(); else if (of_machine_is_compatible("bluegiga,apx4devkit")) apx4devkit_init(); + else if (of_machine_is_compatible("karo,tx28")) + tx28_init(); of_platform_populate(NULL, of_default_bus_match_table, mxs_auxdata_lookup, NULL); @@ -277,6 +322,7 @@ static const char *imx28_dt_compat[] __initdata = { "crystalfontz,cfa10036", "denx,m28evk", "fsl,imx28-evk", + "karo,tx28", "fsl,imx28", NULL, };