From patchwork Sat May 9 08:15:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Tomer X-Patchwork-Id: 1286571 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=JoxvNaA7; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49K0Pn2KcQz9sSc for ; Sat, 9 May 2020 18:15:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9B04580466; Sat, 9 May 2020 10:15:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JoxvNaA7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A45F8043D; Sat, 9 May 2020 10:15:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 37BCB801D6 for ; Sat, 9 May 2020 10:15:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=amittomer25@gmail.com Received: by mail-pj1-x1041.google.com with SMTP id mq3so5358224pjb.1 for ; Sat, 09 May 2020 01:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yTL5SOIzfVKvJoUoehDwjg7XqgEJwGBfXCfzqwk7f50=; b=JoxvNaA7kGXH4N6os8agMY16+9GKbZiKVRd0Bst6O0XMUnfX6EjFBAFnKtOL8nDnTG qvca9E0OjsFjZOmcWyn1Tlo6f5ES9m40CglRfXCN0MA6Tt0cQwOw8C/sNKMC80ev2K5+ 3oH3LknT66e6Lm6g9AoA2ZpWqUV36LKLQfMfyAQTuv1kSS5v3YTIW0X0g06tLuz+K6Q0 I57N4g4fqzvU8lEWZ0sL8K7UZ9gyqIfk1i8zI96m7vURFC0lPK/eGH5tKAWL7ya6dFEk 2Auq9NpFgJZx1HVj6wdYRD658WNuZgqAPhEUCFs1pJBOPjqNempHLKmjJNefsakapm17 KZXA== 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=yTL5SOIzfVKvJoUoehDwjg7XqgEJwGBfXCfzqwk7f50=; b=RuYY7WoIRs1zmzFvBSpUZTdsOi6zAwzj23gdT6j3i1W6oxNOOZhWU31BzPN9d6GMqo vnIbBqQXPfFyYo0qZgJ6dPIo5uUOU1vJxoml3kwH3Q4ymjLwROxNKT/JJaTdSAbI9v8q A6F7lZKZ7wZE330RTW1xlKgRPWUr+krPR1LKUZu2MMCnD0/DR+qILI8uFqXAa9dtUfUr mWODK6+1C6wquorI4/AzOjEhgS6lE1bNFxH5ZGzRWHqWmNdPTK3USxji9TOv4IYS+IFy NGByvmyXJtNIcSpBkX684IsrrRvZDeoRn+QL5C3Ct2r3ZD0UIlwCiavdosL0arp7cU2V egBw== X-Gm-Message-State: AGi0PuZgz8in6HFRqgDG6lz32v6EdQ6MmnhBp2MVWsrhc1zxMRi/RqYG CsXxyuaPIz58sYKPRScZjc+tK74t2Dw= X-Google-Smtp-Source: APiQypLgvbEHCSKp0Efnr51TThKHSUHnnQ3URSnFUm92WxL1kwOW87/rowmbDPeZjHutpwlsC1Z/pQ== X-Received: by 2002:a17:90a:68cb:: with SMTP id q11mr10103034pjj.15.1589012125243; Sat, 09 May 2020 01:15:25 -0700 (PDT) Received: from localhost.localdomain ([106.215.22.163]) by smtp.gmail.com with ESMTPSA id p189sm3969576pfp.135.2020.05.09.01.15.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2020 01:15:24 -0700 (PDT) From: Amit Singh Tomar To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, manivannan.sadhasivam@linaro.org, trini@konsulko.com Subject: [PATCH v4 1/2] Actions: OWL: Calculate SDRAM size Date: Sat, 9 May 2020 13:45:07 +0530 Message-Id: <1589012108-11064-2-git-send-email-amittomer25@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589012108-11064-1-git-send-email-amittomer25@gmail.com> References: <1589012108-11064-1-git-send-email-amittomer25@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Calculate the SDRAM size from DDR capacity register registers instead of using hard-coded value. This is quite useful to get correct size on differnt boards based on Actions OWL family of SoCs (S700 and S900). There is no documentation available that talks about DDR registers, and this is very much taken from vendor source. This commit lets Linux boot on Cubieboard7-lite(based on S700). Signed-off-by: Amit Singh Tomar Reviewed-by: Manivannan Sadhasivam --- Changes since v3: * Fixed S900 support as suggested by Mani. * Changes the function name to owl_get_ddrcap. Changes since v2: * Fixed the variable name so that it can compile for S900. Changes since v1: * added support for S900 * updated the commit message to reflect common OWL support. --- arch/arm/mach-owl/soc.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-owl/soc.c b/arch/arm/mach-owl/soc.c index 409cbd319f20..fcf61d39b63a 100644 --- a/arch/arm/mach-owl/soc.c +++ b/arch/arm/mach-owl/soc.c @@ -13,14 +13,34 @@ #include #include +#define DMM_INTERLEAVE_PER_CH_CFG 0xe0290028 + DECLARE_GLOBAL_DATA_PTR; +unsigned int owl_get_ddrcap(void) +{ + unsigned int val, cap; + + /* ddr capacity register initialized by ddr driver + * in early bootloader + */ +#if defined(CONFIG_MACH_S700) + val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0x7; + cap = (val + 1) * 256; +#elif defined(CONFIG_MACH_S900) + val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0xf; + cap = 64 * (1 << val); +#endif + + return cap; +} + /* * dram_init - sets uboots idea of sdram size */ int dram_init(void) { - gd->ram_size = CONFIG_SYS_SDRAM_SIZE; + gd->ram_size = owl_get_ddrcap() * 1024 * 1024; return 0; } From patchwork Sat May 9 08:15:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Tomer X-Patchwork-Id: 1286572 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=bkGF2Eam; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49K0Px3fSTz9sSc for ; Sat, 9 May 2020 18:15:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 92A948044A; Sat, 9 May 2020 10:15:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bkGF2Eam"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7ACA28048E; Sat, 9 May 2020 10:15:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 546FB801D6 for ; Sat, 9 May 2020 10:15:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=amittomer25@gmail.com Received: by mail-pj1-x102f.google.com with SMTP id e6so5327585pjt.4 for ; Sat, 09 May 2020 01:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6txT6QwnXt4x6L2Wu3sIy5p4sTcy+33Ty1I+EqUFAfo=; b=bkGF2EamSZxYw0+oiH8mN0bXif9/lqa/OCR+hsu9ceJXHzemgvJUQvPc0o+9Q9hIag T+MfsyoUCrUbtlej16h8w+LWciREpOUIdwFSwD5wD4F0L5rfLOmtN1vTroD9v8z7Utm/ p86yMUqe6R7CeCX7gCRb/irYNbCV4IMEavL7KMUgoO63HJYo8VNG3MqYFuT8MI79N80y TABOP/6sIdvWVTqPo6++0AlyajkoPQeaCOKaJnX8pgUIbu3NleRfd7b8H3esFncj+PtM 9s3TEIVXL/vzCFhv6RkotMqHvnWRHeducYNqV+MHMsaW5xw/jL5mxTJB+mrsx3ttf+Zr F6LQ== 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=6txT6QwnXt4x6L2Wu3sIy5p4sTcy+33Ty1I+EqUFAfo=; b=oO/pG02MhwEyExfKC9U1E86dPMHFmSs2VJrX6WazfvbiFZd1lOKEq9gcc1uBrh6phN q4wzgKhaGZsfLe/XJE1EG/B/M27os9m9UjY0RNw4svWEvdBihsxQv9kww0Pt09SpZPml zrQU0iognvuiHDK1n/P+BPRnpxES+j8Ow36Eq0a/LYm1F8UYRbCcdyAyznjtjZG4IWGD YC6uFMv8l5XMFeeYsb9zsc9bGJD8ZR7iL2AnpXHzldJBilKnqzVtAPg92HPQvTwexeOO Z+P6mw/z2y2n0J9kyE971GwZWe5CXJyvgxbRPQBtfzk/opWOlPylF3ZkO7+oWI7Mif8x X8HA== X-Gm-Message-State: AGi0PuYX9iNMreBSvd6vgdSRvr/WyTV0DSa+t8lvNHPvlAFZeVM8+vnN 86NLCI3LUobOUT8yPjuUN4TYhqBX/Qc= X-Google-Smtp-Source: APiQypK9HYGy3GuGCAYm0tW9woCCxtS45dH3ziRk4cFtuJQBsuhK+xTAtbBTmucG/91sDbAF69kIhw== X-Received: by 2002:a17:90a:d709:: with SMTP id y9mr10971236pju.50.1589012128560; Sat, 09 May 2020 01:15:28 -0700 (PDT) Received: from localhost.localdomain ([106.215.22.163]) by smtp.gmail.com with ESMTPSA id p189sm3969576pfp.135.2020.05.09.01.15.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2020 01:15:27 -0700 (PDT) From: Amit Singh Tomar To: u-boot@lists.denx.de Cc: andre.przywara@arm.com, manivannan.sadhasivam@linaro.org, trini@konsulko.com Subject: [PATCH v4 2/2] arm: actions: remove "CONFIG_SYS_SDRAM_SIZE" for Actions Owl Semi SoCs Date: Sat, 9 May 2020 13:45:08 +0530 Message-Id: <1589012108-11064-3-git-send-email-amittomer25@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589012108-11064-1-git-send-email-amittomer25@gmail.com> References: <1589012108-11064-1-git-send-email-amittomer25@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Now that, we calculate SDRAM size by reading DDR registers, "CONFIG_SYS_SDRAM_SIZE" is no more needed. This commit removes "CONFIG_SYS_SDRAM_SIZE" from common configuration file. Signed-off-by: Amit Singh Tomar Reviewed-by: Manivannan Sadhasivam --- * No change since previous version. --- include/configs/owl-common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/owl-common.h b/include/configs/owl-common.h index f77a5fa4c114..7634578f856d 100644 --- a/include/configs/owl-common.h +++ b/include/configs/owl-common.h @@ -12,7 +12,6 @@ /* SDRAM Definitions */ #define CONFIG_SYS_SDRAM_BASE 0x0 -#define CONFIG_SYS_SDRAM_SIZE 0x80000000 /* Generic Timer Definitions */ #define COUNTER_FREQUENCY (24000000) /* 24MHz */