From patchwork Mon Jun 17 07:31:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 616 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 29F903F36F for ; Mon, 17 Jun 2019 09:38:53 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id a5sf5536652pla.3 for ; Mon, 17 Jun 2019 00:38:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560757132; cv=pass; d=google.com; s=arc-20160816; b=QEgP4eWMKFRJO4G4C28h5jsKX8V4Uu8AGwXANWCxcgqXo58/yROxK0+220WTfeTQ1E wl7IwHzP6JXgoZTkY+7/8DYHvRfz+lwzFGmt7rVtzibeS3dRn2tuo8RtSH7DeFPMawfV Elfwk8vugVhWs7iZBBX71DJx3sIX/fDQHJEOKoFJY4hizsLg8gtYe3hWChBw4WP0ByZv O7DTbqc2F80vOj+IuRXim+wwQkFMTs5qddxrWJfSHIQ1csvABXV0IpTp00ObJFLYUEKm jimv0LYHJ30XiVVwuLvvAT/xb3uU9jwGEqlfPcPu4sKjev0GPcioQcFTJtI4wQPJUX4S OPSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=3q+hXlMuU1svu+nRPWpaarGosAkXEA/O89366A0nIws=; b=mOTy9/3b+GoTJHuGBXhrE+nNexasLnT5bjkdvbqTEXgmU2GkldWiQXilRIPtJbU2ek Ez3ayZ9LlEfjUcHcDwmFFIH6H+G3JhQNjuud+DObwIuWF6HphW5FKBWSqhbXSFS4FlYx lsOlKH6OuvF6mS5XVhtZA5yq6duMKZNhOIMptLXOwVj7ki+6PxBDXg+bZLiVv0/UNrqm cdgsqtWX7c03iHXiJI7BBvER8kQoJYXoTdFgp2492vGsKdtlhQ1ob1hTTAfRxn4t4Alw u+A7WKmLy2Q+PT3k63d3BobD2Iinz9NGPWQRWOvRdidXD0SRohLOyOJh6ZdPQqTD0XQ0 m5eQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="CFzp/s0Z"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=3q+hXlMuU1svu+nRPWpaarGosAkXEA/O89366A0nIws=; b=WWx4ZvR5yAgeUd+HDqiLByQluxER8TTW/w00eJKXvVrdWOH40PeUWrAXLf7z9lKQfM h2DWRbXoY10Vmi8jrU7TX0l3jEzLVs7vEpLB/dPqISFHKA9SX+EQdKQUPRr9LEpx3uYz 2uHOh0UDAbqU+8DLSgwsQYHdo1kz0OzhVH9Yc= 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:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=3q+hXlMuU1svu+nRPWpaarGosAkXEA/O89366A0nIws=; b=fP/ZpJ1Zm4NrGgeGsSbxTJ23y7sNCPcNWk9Ib/7Q/JIdyt9PW4ja48LPetp+OgClTQ h1sibQLLR4PkNH3CN6dq8uGmlsU3vU8n7jNIYMGs0xXsqkaU1wbBWIlq1iTy1HH/QMYR eCs/lz8jTVBF73l6WlzhyvAmGvzHCxqErJ1645/+/siYXdLs1hfldp+rtUKvad6gKVVU esRQhTJTIGXxhK91ni2QT62z6d1sSUUULeq0yzqW47XZwvtrD4D+FjTA5uBGURQCMnPc QoB+h47WRez1YDUazB7mtvPQyZZ5Am+wegXkH+uCv+PfMoDtuYTRu6gxvocqjz4rL/IP 4Mxw== X-Gm-Message-State: APjAAAXDM9El/dtCuF4XRAW6gR2D0n1uLQ5UfSYsucEdlnDd2zN9mDN6 +T6/HAfcQdDOJFl8S9X2vxDNpMAF X-Google-Smtp-Source: APXvYqxmALcodDUt+UG+LX26JjAT5y2kQS0FgWhYzQGfHMwsSikq8dYOoiCieAhutrHzD7wSb/6xKg== X-Received: by 2002:a63:6b07:: with SMTP id g7mr49630825pgc.325.1560757131928; Mon, 17 Jun 2019 00:38:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:1021:: with SMTP id b30ls3754748pla.1.gmail; Mon, 17 Jun 2019 00:38:51 -0700 (PDT) X-Received: by 2002:a17:902:23:: with SMTP id 32mr44986968pla.34.1560757131652; Mon, 17 Jun 2019 00:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560757131; cv=none; d=google.com; s=arc-20160816; b=tX2yLOWXMXQNny8YSVlHTJatoy/wDoxHItd4NGHA6uIM/LQhpHdT4ZR32Nq1vtxlgI sfFVZ89b+QxX3Ki4QD+h2xctscIuvrdmAA+D+99Wi7Df5mHFtJdzxvyb3RGg4GSidrK5 IV8sMCP6NfG2Y37u9aORpsFJw03JzKQxIAPwIc5KEhHqv227go+1Cojasjo0mepbFXws acNh1Pfhzniod9KRHQVtSHdR5Gb25bhgL98VXqecvT7Ez2WRNsEG4vCsYYgsem1d1NcE GtOL1p5k102q6apyO7BFWYGuVVDw3RVMOtxdqTdISBSft6QAKACQ3Mtjk78V/CAa1sG7 tiEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jRvNUQciWx/J7/TaVO7vWC94juvCrT8NQKcs05MRHVE=; b=hmhMEecxgFk4hEu1idZiu7pOyPkWkgVL+nPQay4TD7QxpaDOAG7M0Wx0YmXNuRsItw XKjQcMgTWkyZwlzc25lOSAmWIbhGCfABa3xycoaF9fFfB0ZUAPt0fnXpltZLeAcC2h8J 7Cx8I+A4lIPMAbQDr4mIVXLilIX/jnGwUyIxV63TiQfacd8Vv0HHtPm5XoD8Rs7WUk2g 4NEtg9FC2vPbU+Kl7Ag707hYkqlfN2+A9ioJVm6S8G0gleAfGmH4udBmmAPms3d77Df6 +MTRu6vZuRFlkMkCOu1RvIr9bFT7WjLbjM5GZQg7MjhtDAYkAJ/luaLLvGzT/5qmxJWo Af3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="CFzp/s0Z"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f194sor10671334pfa.8.2019.06.17.00.38.51 for (Google Transport Security); Mon, 17 Jun 2019 00:38:51 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a62:ac1a:: with SMTP id v26mr91317067pfe.184.1560757131365; Mon, 17 Jun 2019 00:38:51 -0700 (PDT) Received: from localhost.localdomain ([49.206.203.245]) by smtp.gmail.com with ESMTPSA id m41sm15205998pje.18.2019.06.17.00.38.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 00:38:50 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Cc: Manivannan Sadhasivam , gajjar04akash@gmail.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2 45/99] ram: rockchip: Add debug sdram driver Date: Mon, 17 Jun 2019 13:01:58 +0530 Message-Id: <20190617073252.27810-46-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190617073252.27810-1-jagan@amarulasolutions.com> References: <20190617073252.27810-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="CFzp/s0Z"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add sdram driver to handle debug across rockchip SoCs. This would help to improve code debugging feature for sdram drivers in rockchip family, whoever wants to debug the driver should call these core debug code on their respective platform sdram drivers. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen --- .../include/asm/arch-rockchip/sdram_common.h | 9 +++++ drivers/ram/rockchip/Kconfig | 9 +++++ drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_debug.c | 34 +++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 drivers/ram/rockchip/sdram_debug.c diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index c290fd89c9..0cb737d665 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -123,4 +123,13 @@ size_t rockchip_sdram_size(phys_addr_t reg); /* Called by U-Boot board_init_r for Rockchip SoCs */ int dram_init(void); + +#if !defined(CONFIG_RAM_ROCKCHIP_DEBUG) +inline void sdram_print_dram_type(unsigned char dramtype) +{ +} +#else +void sdram_print_dram_type(unsigned char dramtype); +#endif /* CONFIG_RAM_ROCKCHIP_DEBUG */ + #endif diff --git a/drivers/ram/rockchip/Kconfig b/drivers/ram/rockchip/Kconfig index 995cb487b8..151ffb684d 100644 --- a/drivers/ram/rockchip/Kconfig +++ b/drivers/ram/rockchip/Kconfig @@ -7,6 +7,15 @@ config RAM_ROCKCHIP if RAM_ROCKCHIP +config RAM_ROCKCHIP_DEBUG + bool "Rockchip ram drivers debugging" + help + This enables debugging ram driver API's for the platforms + based on Rockchip SoCs. + + This is an option for developers to understand the ram drivers + initialization, configurations and etc. + config RAM_RK3399 bool "Ram driver for Rockchip RK3399" default ROCKCHIP_RK3399 diff --git a/drivers/ram/rockchip/Makefile b/drivers/ram/rockchip/Makefile index 07d4b62a9d..feb1f82d00 100644 --- a/drivers/ram/rockchip/Makefile +++ b/drivers/ram/rockchip/Makefile @@ -3,6 +3,7 @@ # Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH # +obj-$(CONFIG_RAM_ROCKCHIP_DEBUG) += sdram_debug.o obj-$(CONFIG_ROCKCHIP_RK3368) = dmc-rk3368.o obj-$(CONFIG_ROCKCHIP_RK3128) = sdram_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) = sdram_rk3188.o diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c new file mode 100644 index 0000000000..c13e140fa5 --- /dev/null +++ b/drivers/ram/rockchip/sdram_debug.c @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * (C) Copyright 2019 Rockchip Electronics Co., Ltd + * (C) Copyright 2019 Amarula Solutions. + * Author: Jagan Teki + */ + +#include +#include +#include + +void sdram_print_dram_type(unsigned char dramtype) +{ + switch (dramtype) { + case DDR3: + printascii("DDR3"); + break; + case DDR4: + printascii("DDR4"); + break; + case LPDDR2: + printascii("LPDDR2"); + break; + case LPDDR3: + printascii("LPDDR3"); + break; + case LPDDR4: + printascii("LPDDR4"); + break; + default: + printascii("Unknown Device"); + break; + } +}