From patchwork Mon Sep 26 12:26:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Vogt X-Patchwork-Id: 675151 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sjPNF33M2z9ryZ for ; Mon, 26 Sep 2016 23:05:49 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 063AAA767C; Mon, 26 Sep 2016 15:05:11 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Eh2f5jqHh_xl; Mon, 26 Sep 2016 15:05:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 696DCA7683; Mon, 26 Sep 2016 15:04:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 37459A759A for ; Mon, 26 Sep 2016 14:47:50 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x1qO4hTrmVF5 for ; Mon, 26 Sep 2016 14:47:50 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) by theia.denx.de (Postfix) with ESMTPS id 0C126A75CF for ; Mon, 26 Sep 2016 14:47:45 +0200 (CEST) Received: from nwb-ext-pat.microfocus.com ([10.120.13.103]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Mon, 26 Sep 2016 14:27:43 +0200 Received: from linux-lm3i.site (nwb-a10-snat.microfocus.com [10.120.13.201]) by nwb-ext-pat.microfocus.com with ESMTP (TLS encrypted); Mon, 26 Sep 2016 13:27:31 +0100 From: Fabian Vogt To: u-boot@lists.denx.de Date: Mon, 26 Sep 2016 14:26:50 +0200 Message-Id: <20160926122651.22132-9-fvogt@suse.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160926122651.22132-1-fvogt@suse.com> References: <20160926122651.22132-1-fvogt@suse.com> X-Mailman-Approved-At: Mon, 26 Sep 2016 15:04:20 +0200 Subject: [U-Boot] [PATCH 8/9] board: rpi: move uart deactivation to board_init X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When using OF_CONTROL, the disabled value of the mini UART platdata gets reset after board_early_init_f. So move detection and disabling to board_init and remove board_early_init_f. This uses the first device using the mini uart driver, as this method works reliably with different device trees or even no device tree at all. Signed-off-by: Fabian Vogt Reviewed-by: Simon Glass --- board/raspberrypi/rpi/rpi.c | 40 ++++++++++++++++++++++++++-------------- include/configs/rpi.h | 1 - 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 6245b36..09bfcc6 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -443,15 +443,6 @@ static void get_board_rev(void) printf("RPI %s (0x%x)\n", model->name, revision); } -int board_init(void) -{ - get_board_rev(); - - gd->bd->bi_boot_params = 0x100; - - return power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD); -} - #ifndef CONFIG_PL01X_SERIAL static bool rpi_is_serial_active(void) { @@ -471,17 +462,38 @@ static bool rpi_is_serial_active(void) return true; } + +/* Disable mini-UART I/O if it's not pinmuxed to our pins. + * The firmware only enables it if explicitly done in config.txt: enable_uart=1 + */ +static void rpi_disable_inactive_uart(void) +{ + struct udevice *dev; + struct bcm283x_mu_serial_platdata *plat; + + if (uclass_get_device_by_driver(UCLASS_SERIAL, + DM_GET_DRIVER(serial_bcm283x_mu), + &dev) || !dev) + return; + + if (!rpi_is_serial_active()) { + plat = dev_get_platdata(dev); + plat->disabled = true; + } +} #endif -int board_early_init_f(void) +int board_init(void) { #ifndef CONFIG_PL01X_SERIAL - /* Disable mini-UART I/O if it's not pinmuxed to our pins */ - if (!rpi_is_serial_active()) - serial_platdata.disabled = true; + rpi_disable_inactive_uart(); #endif - return 0; + get_board_rev(); + + gd->bd->bi_boot_params = 0x100; + + return power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD); } int board_mmc_init(bd_t *bis) diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 8d4ad5d..e9c0417 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -16,7 +16,6 @@ /* Architecture, CPU, etc.*/ #define CONFIG_ARCH_CPU_INIT -#define CONFIG_BOARD_EARLY_INIT_F /* Use SoC timer for AArch32, but architected timer for AArch64 */ #ifndef CONFIG_ARM64