From patchwork Fri Feb 17 17:52:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 729836 X-Patchwork-Delegate: jagannadh.teki@gmail.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 3vRd6d57G7z9rxw for ; Mon, 20 Feb 2017 20:06:49 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 69A09B39F1; Mon, 20 Feb 2017 09:43:21 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 fQEdllaVhFLr; Mon, 20 Feb 2017 09:43:21 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F415162EE2; Mon, 20 Feb 2017 09:30:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54D1C4A05F for ; Fri, 17 Feb 2017 21:10:15 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 couEsoFdXNSV for ; Fri, 17 Feb 2017 21:10:15 +0100 (CET) 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 mail.theobroma-systems.com (vegas.theobroma-systems.com [144.76.126.164]) by theia.denx.de (Postfix) with ESMTPS id 2B9A24A026 for ; Fri, 17 Feb 2017 21:10:15 +0100 (CET) Received: from [86.59.122.178] (port=54339 helo=android.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1cemiH-0000pF-I9; Fri, 17 Feb 2017 18:52:57 +0100 From: Philipp Tomsich To: u-boot@lists.denx.de Date: Fri, 17 Feb 2017 18:52:44 +0100 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: <7f26717e37f121545ef8cf50838615d8de292999.1487349600.git.philipp.tomsich@theobroma-systems.com> References: <5209f12ba10211990f861187aa9c59c1f7148ce5.1487349600.git.philipp.tomsich@theobroma-systems.com> <74674e242cf87497ed57a37b96821e7cf9c1227e.1487349600.git.philipp.tomsich@theobroma-systems.com> <3c7b1cdadabb3eed64fa84a1c5475e0c5b443ef8.1487349600.git.philipp.tomsich@theobroma-systems.com> <7f26717e37f121545ef8cf50838615d8de292999.1487349600.git.philipp.tomsich@theobroma-systems.com> Cc: Albert Aribaud , Andre Przywara , Hans de Goede , Klaus Goger , Maxime Ripard , Philipp Tomsich , Jagan Teki Subject: [U-Boot] [PATCH v1 07/11] sunxi: Scan DT tree node '/clocks' on sunxi boards 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" Moving to a DT-based clock framework on sunxi requires the subnodes of /clocks to be bound on boot-up. As /clocks does not contain a compatible-string, the U-Boot DT parsing code ignores it (and any subnodes). To overcome this limitation, the sunxi board-init code retrieves the /clocks node and explicitly starts a DM scan of the subnodes. Signed-off-by: Philipp Tomsich --- board/sunxi/board.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 89edf2e..838e89f 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -1,39 +1,40 @@ /* * (C) Copyright 2012-2013 Henrik Nordstrom * (C) Copyright 2013 Luke Kenneth Casson Leighton * * (C) Copyright 2007-2011 * Allwinner Technology Co., Ltd. * Tom Cubie * * Some board init for the Allwinner A10-evb board. * * SPDX-License-Identifier: GPL-2.0+ */ #include #include #include #include #include #include #include #include #include #include #include #ifndef CONFIG_ARM64 #include #endif #include #include #include +#include #include #include #include #include #include #include #include #include @@ -109,76 +110,87 @@ static int setup_led(void) int board_init(void) { __maybe_unused int id_pfr1, ret; + int __maybe_unused offset; gd->bd->bi_boot_params = (PHYS_SDRAM_0 + 0x100); +#if defined(CONFIG_CLK) + /* Sunxi device trees have their clock definitions in a tree + * below /clocks, which is a node without a compatible-string. + * We need to manually locate it and scan its subnodes. + */ + offset = fdt_path_offset(gd->fdt_blob, "/clocks"); + if (offset > 0) + dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, offset, false); +#endif + #ifndef CONFIG_ARM64 asm volatile("mrc p15, 0, %0, c0, c1, 1" : "=r"(id_pfr1)); debug("id_pfr1: 0x%08x\n", id_pfr1); /* Generic Timer Extension available? */ if ((id_pfr1 >> CPUID_ARM_GENTIMER_SHIFT) & 0xf) { uint32_t freq; debug("Setting CNTFRQ\n"); /* * CNTFRQ is a secure register, so we will crash if we try to * write this from the non-secure world (read is OK, though). * In case some bootcode has already set the correct value, * we avoid the risk of writing to it. */ asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r"(freq)); if (freq != CONFIG_TIMER_CLK_FREQ) { debug("arch timer frequency is %d Hz, should be %d, fixing ...\n", freq, CONFIG_TIMER_CLK_FREQ); #ifdef CONFIG_NON_SECURE printf("arch timer frequency is wrong, but cannot adjust it\n"); #else asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(CONFIG_TIMER_CLK_FREQ)); #endif } } #endif /* !CONFIG_ARM64 */ sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_USB3); sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_USB3); gpio_request(SUNXI_GPC(3), "STM32 Boot0"); sunxi_gpio_set_cfgpin(SUNXI_GPC(3), SUNXI_GPIO_OUTPUT); gpio_request(SUNXI_GPC(26), "STM32 Reset"); sunxi_gpio_set_cfgpin(SUNXI_GPC(26), SUNXI_GPIO_OUTPUT); #if !defined(CONFIG_DM_GPIO) gpio_request(SUNXI_GPA(7), "PHY Reset"); sunxi_gpio_set_cfgpin(SUNXI_GPA(7), SUNXI_GPIO_OUTPUT); gpio_direction_output(SUNXI_GPA(7), 0); #endif gpio_direction_output(SUNXI_GPC(3), 0); gpio_direction_output(SUNXI_GPC(26), 0); mdelay(10); gpio_direction_output(SUNXI_GPC(26), 1); #if !defined(CONFIG_DM_GPIO) gpio_direction_output(SUNXI_GPA(7), 1); #endif setup_led(); ret = axp_gpio_init(); if (ret) return ret; #ifdef CONFIG_SATAPWR gpio_request(CONFIG_SATAPWR, "satapwr"); gpio_direction_output(CONFIG_SATAPWR, 1); #endif #ifdef CONFIG_MACPWR gpio_request(CONFIG_MACPWR, "macpwr"); gpio_direction_output(CONFIG_MACPWR, 1); #endif /* Uses dm gpio code so do this here and not in i2c_init_board() */ return soft_i2c_board_init(); } @@ -1018,24 +1030,23 @@ U_BOOT_CMD( int board_fit_config_name_match(const char *name) { #ifdef CONFIG_SPL_LOAD_FIT const char *cmp_str; #ifdef CONFIG_DEFAULT_DEVICE_TREE cmp_str = CONFIG_DEFAULT_DEVICE_TREE; #else return 0; #endif /* Differentiate the two Pine64 board DTs by their DRAM size. */ if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) { if ((gd->ram_size > 512 * 1024 * 1024)) return !strstr(name, "plus"); else return !!strstr(name, "plus"); } else { return strcmp(name, cmp_str); } #endif } -