From patchwork Thu Feb 2 14:56:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 723086 X-Patchwork-Delegate: sbabic@denx.de 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 3vDjkv6R9Vz9s7G for ; Fri, 3 Feb 2017 01:56:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 27C894B64F; Thu, 2 Feb 2017 15:56:48 +0100 (CET) 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 Bx_G1zEtKb98; Thu, 2 Feb 2017 15:56:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3BA194B646; Thu, 2 Feb 2017 15:56:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A9D84B5B4 for ; Thu, 2 Feb 2017 15:56:25 +0100 (CET) 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 Q8jbF-5MktC8 for ; Thu, 2 Feb 2017 15:56:25 +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-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by theia.denx.de (Postfix) with ESMTPS id 604784B5A1 for ; Thu, 2 Feb 2017 15:56:25 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id c85so4604505wmi.1 for ; Thu, 02 Feb 2017 06:56:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WJHRCol6TWzNK/fHt1rFIJ44EnqMD0ZOZsA6RbTK/O8=; b=NbFk+TbsAARnc9ETg2eS/GtGDeD08rAP+Zhf6CdG8e+lxyiSr29VNCueZNzWGC2I6Q JiSJJQJP5MbFd/8N9RMcmQPyd+mqLhjfUiyzE8bNfEpMh8394Kg2rwtYDeVY5WDYGI49 BY6Hy+eXkyx2thiEtNthdY9vh4Y+ypXBhWE44KWmb2rlMge0bCrJ899++8JtvTVK25ec IXuL6wi4ljrn1FwFD8kSGo6KiXLxSn4UtTzZLjNf3/1whcKPMt47PO+3m/wKiq2gmkwh WgYyYLdLG98NT4fzP1RjJElMMABylwqwmafCNbTpRmw4Pgqrq83chmiEHTmUA4DRlNFj MEvg== X-Gm-Message-State: AIkVDXLSbcQ3xI32lTfL5/isWI9HOx0ExgxSVrW3AkOa3venzSA5u01/QmWJGa7aiuyphw== X-Received: by 10.28.57.131 with SMTP id g125mr7738649wma.33.1486047384989; Thu, 02 Feb 2017 06:56:24 -0800 (PST) Received: from jagan-XPS-13-9350.homenet.telecomitalia.it (host211-95-static.0-79-b.business.telecomitalia.it. [79.0.95.211]) by smtp.gmail.com with ESMTPSA id s26sm39984869wra.26.2017.02.02.06.56.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Feb 2017 06:56:24 -0800 (PST) From: Jagan Teki To: Stefano Babic Date: Thu, 2 Feb 2017 15:56:02 +0100 Message-Id: <1486047373-31676-5-git-send-email-jagan@openedev.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486047373-31676-1-git-send-email-jagan@openedev.com> References: <1486047373-31676-1-git-send-email-jagan@openedev.com> Cc: u-boot@lists.denx.de, Jagan Teki , Matteo Lisi Subject: [U-Boot] [PATCH v3 04/15] imx6: Add src_base structure define macro 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" Instead of initializing 'struct src' to SRC_BASE_ADDR on every function better to have global define macro. Cc: Stefano Babic Signed-off-by: Jagan Teki --- arch/arm/imx-common/init.c | 6 ++---- arch/arm/imx-common/spl.c | 3 +-- arch/arm/include/asm/arch-mx6/imx-regs.h | 2 ++ arch/arm/include/asm/imx-common/sys_proto.h | 4 +--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/arm/imx-common/init.c b/arch/arm/imx-common/init.c index 036ebb2..5b4f828 100644 --- a/arch/arm/imx-common/init.c +++ b/arch/arm/imx-common/init.c @@ -119,11 +119,9 @@ void boot_mode_apply(unsigned cfg_val) #if defined(CONFIG_MX6) u32 imx6_src_get_boot_mode(void) { - struct src *psrc = (struct src *)SRC_BASE_ADDR; - if (imx6_is_bmode_from_gpr9()) - return readl(&psrc->gpr9); + return readl(&src_base->gpr9); else - return readl(&psrc->sbmr1); + return readl(&src_base->sbmr1); } #endif diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c index acf268d..c8723bb 100644 --- a/arch/arm/imx-common/spl.c +++ b/arch/arm/imx-common/spl.c @@ -19,8 +19,7 @@ /* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 register */ u32 spl_boot_device(void) { - struct src *psrc = (struct src *)SRC_BASE_ADDR; - unsigned int bmode = readl(&psrc->sbmr2); + unsigned int bmode = readl(&src_base->sbmr2); u32 reg = imx6_src_get_boot_mode(); /* diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 6727c56..646013d 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -473,6 +473,8 @@ struct src { u32 gpr10; }; +#define src_base ((struct src *)SRC_BASE_ADDR) + #define SRC_SCR_M4_ENABLE_OFFSET 22 #define SRC_SCR_M4_ENABLE_MASK (1 << 22) #define SRC_SCR_M4C_NON_SCLR_RST_OFFSET 4 diff --git a/arch/arm/include/asm/imx-common/sys_proto.h b/arch/arm/include/asm/imx-common/sys_proto.h index ba95641..673527a 100644 --- a/arch/arm/include/asm/imx-common/sys_proto.h +++ b/arch/arm/include/asm/imx-common/sys_proto.h @@ -78,9 +78,7 @@ enum imx6_bmode { static inline u8 imx6_is_bmode_from_gpr9(void) { - struct src *psrc = (struct src *)SRC_BASE_ADDR; - - return readl(&psrc->gpr10) & IMX6_SRC_GPR10_BMODE; + return readl(&src_base->gpr10) & IMX6_SRC_GPR10_BMODE; } u32 imx6_src_get_boot_mode(void);