From patchwork Thu Sep 10 20:55:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 53397 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id F258C22B19 for ; Thu, 10 Sep 2015 20:55:35 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf11620051wic.3 for ; Thu, 10 Sep 2015 13:55:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=cI3qVZNMDxYW2feHXy4m9AMWUbdOZds8WRmxOO2nI0A=; b=SCfxwZ9jsbMdteLaieDiu7SxHy9yi24tjyA6TlSLoHSDPZxz11r7PuSrRIAiZcJe0e mIKxpvpWbuuKjjqQzFQ7dYefaelQAWhwmK3eO79GDUB5FpkMAui2mwOfz2j1vfrb3xPW B4Hdr28rJdqwqGWJSftj/uVEDXD9JQxEr9W+y4nZxR4pEZn8vHuCZ3Vcs4rsC0NAdIZm noIU+cDXPq2QGEHhx7oYm8soEArLdDIkG6N4+i0AXb361ugRlMgTqPIPhw4H13Iv9g38 Lfz7BTeIQtgDZBgKQ1bIUkJmyHbeCzvtBqQ93jBVpFS7bjM4L7UPZBEYnu1KVCJTWvoi aMYg== X-Gm-Message-State: ALoCoQmYA8Ovxbs7lYsPDlRmGlZM3R8/tSNIgl8SFTRxuwliZUTq0k+Q7yhVDHUMhkGSic0bCHTz X-Received: by 10.112.144.99 with SMTP id sl3mr10129239lbb.12.1441918535243; Thu, 10 Sep 2015 13:55:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.164 with SMTP id t4ls198999lat.84.gmail; Thu, 10 Sep 2015 13:55:35 -0700 (PDT) X-Received: by 10.152.5.71 with SMTP id q7mr2737163laq.92.1441918535093; Thu, 10 Sep 2015 13:55:35 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id sk1si11569737lbb.44.2015.09.10.13.55.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2015 13:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lamp12 with SMTP id p12so35373289lam.0 for ; Thu, 10 Sep 2015 13:55:35 -0700 (PDT) X-Received: by 10.152.18.164 with SMTP id x4mr38757757lad.35.1441918534997; Thu, 10 Sep 2015 13:55:34 -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.112.59.35 with SMTP id w3csp1196236lbq; Thu, 10 Sep 2015 13:55:34 -0700 (PDT) X-Received: by 10.180.37.232 with SMTP id b8mr6225754wik.46.1441918534327; Thu, 10 Sep 2015 13:55:34 -0700 (PDT) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com. [209.85.212.180]) by mx.google.com with ESMTPS id my3si13768837wic.118.2015.09.10.13.55.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2015 13:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.griffin@linaro.org designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180; Received: by wiclk2 with SMTP id lk2so36954292wic.1 for ; Thu, 10 Sep 2015 13:55:34 -0700 (PDT) X-Received: by 10.180.36.212 with SMTP id s20mr158419wij.14.1441918534152; Thu, 10 Sep 2015 13:55:34 -0700 (PDT) Received: from localhost.localdomain (cpc14-aztw22-2-0-cust189.18-1.cable.virginm.net. [82.45.1.190]) by smtp.gmail.com with ESMTPSA id s9sm17508216wjy.16.2015.09.10.13.55.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Sep 2015 13:55:33 -0700 (PDT) From: Peter Griffin To: u-boot@lists.denx.de, trini@konsulko.com, sjg@chromium.org, albert.u.boot@aribaud.net Cc: Peter Griffin Subject: [PATCH v2 7/8] ARM: hikey: hi6220: Migrate over to DM_SERIAL and use UART3 by default. Date: Thu, 10 Sep 2015 21:55:17 +0100 Message-Id: <1441918518-25629-8-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441918518-25629-1-git-send-email-peter.griffin@linaro.org> References: <1441918518-25629-1-git-send-email-peter.griffin@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.griffin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mailfrom=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: , Use DM for the pl01x serial driver on hikey. Also allow UART0 or UART3 to be chosen via Kconfig. By default we now output to UART3 as the latest version of ATF outputs to this UART. Also UART3 comes out on the LS connector, as opposed to UART0 which goes to a unpopulated header. As part of this change we also enable CONFIG_BOARD_EARLY_INIT_F and call the pinmux configuration code for the UART. Before we were relying on ATF having already configured the pin configuration. NB: Upstream Linux kernel doesn't yet support UART3, so serial console will still be output on UART0 when booting a upstream kernel. Signed-off-by: Peter Griffin Reviewed-by: Simon Glass --- arch/arm/Kconfig | 2 +- board/hisilicon/hikey/Kconfig | 7 +++++++ board/hisilicon/hikey/hikey.c | 43 +++++++++++++++++++++++++++++++++++++++++++ configs/hikey_defconfig | 1 + include/configs/hikey.h | 11 ++++------- 5 files changed, 56 insertions(+), 8 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9c2b3ab..5bb568d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -650,6 +650,7 @@ config TARGET_HIKEY select ARM64 select DM select DM_GPIO + select DM_SERIAL help Support for HiKey 96boards platform. It features a HI6220 SoC, with 8xA53 CPU, mali450 gpu, and 1GB RAM. @@ -658,7 +659,6 @@ config TARGET_LS1021AQDS bool "Support ls1021aqds" select CPU_V7 select SUPPORT_SPL - config TARGET_LS1021ATWR bool "Support ls1021atwr" select CPU_V7 diff --git a/board/hisilicon/hikey/Kconfig b/board/hisilicon/hikey/Kconfig index f7f1055..9171502 100644 --- a/board/hisilicon/hikey/Kconfig +++ b/board/hisilicon/hikey/Kconfig @@ -12,4 +12,11 @@ config SYS_SOC config SYS_CONFIG_NAME default "hikey" +config CONS_INDEX + int "UART used for console" + range 1 4 + default 4 + help + The hi6220 SoC has 5 UARTs. For example to use UART0 enter 1 here. + endif diff --git a/board/hisilicon/hikey/hikey.c b/board/hisilicon/hikey/hikey.c index 9948747..c4ae40b 100644 --- a/board/hisilicon/hikey/hikey.c +++ b/board/hisilicon/hikey/hikey.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include #include @@ -69,6 +70,48 @@ U_BOOT_DEVICES(hi6220_gpios) = { DECLARE_GLOBAL_DATA_PTR; +static const struct pl01x_serial_platdata serial_platdata = { +#if CONFIG_CONS_INDEX == 1 + .base = HI6220_UART0_BASE, +#elif CONFIG_CONS_INDEX == 4 + .base = HI6220_UART3_BASE, +#else +#error "Unsuported console index value." +#endif + .type = TYPE_PL011, + .clock = 19200000 +}; + +U_BOOT_DEVICE(hikey_seriala) = { + .name = "serial_pl01x", + .platdata = &serial_platdata, +}; + +#ifdef CONFIG_BOARD_EARLY_INIT_F +int board_uart_init(void) +{ + switch (CONFIG_CONS_INDEX) { + case 1: + hi6220_pinmux_config(PERIPH_ID_UART0); + break; + case 4: + hi6220_pinmux_config(PERIPH_ID_UART3); + break; + default: + debug("%s: Unsupported UART selected\n", __func__); + return -1; + } + + return 0; +} + +int board_early_init_f(void) +{ + board_uart_init(); + return 0; +} +#endif + struct peri_sc_periph_regs *peri_sc = (struct peri_sc_periph_regs *)HI6220_PERI_BASE; diff --git a/configs/hikey_defconfig b/configs/hikey_defconfig index aa4fb0d..ee67c29 100644 --- a/configs/hikey_defconfig +++ b/configs/hikey_defconfig @@ -2,4 +2,5 @@ CONFIG_ARM=y CONFIG_TARGET_HIKEY=y CONFIG_NET=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 # CONFIG_CMD_IMLS is not set diff --git a/include/configs/hikey.h b/include/configs/hikey.h index ae8187a..b7c22e8 100644 --- a/include/configs/hikey.h +++ b/include/configs/hikey.h @@ -31,6 +31,8 @@ /* Flat Device Tree Definitions */ #define CONFIG_OF_LIBFDT +#define CONFIG_BOARD_EARLY_INIT_F + /* Physical Memory Map */ /* CONFIG_SYS_TEXT_BASE needs to align with where ATF loads bl33.bin */ @@ -59,13 +61,8 @@ /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M) -/* PL011 Serial Configuration */ -#define CONFIG_PL011_SERIAL - -#define CONFIG_PL011_CLOCK 19200000 -#define CONFIG_PL01x_PORTS {(void *)0xF8015000} -#define CONFIG_CONS_INDEX 0 - +/* Serial port PL010/PL011 through the device model */ +#define CONFIG_PL01X_SERIAL #define CONFIG_BAUDRATE 115200 #define CONFIG_CMD_USB