From patchwork Mon Jul 15 18:28:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 740 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 7B2FD3F08F for ; Mon, 15 Jul 2019 20:29:45 +0200 (CEST) Received: by mail-pg1-f197.google.com with SMTP id a21sf4119014pgv.0 for ; Mon, 15 Jul 2019 11:29:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563215384; cv=pass; d=google.com; s=arc-20160816; b=lLtuISmoNpUX+z8pRSxjX7poh+e1owpnSZRCZ7XBom75L14V69ShAS30uI46ej5Dao dHe8BP5NTStGpbHsMUKUZhJrmVE88ig1drZUXnfE/BO0R8nc9SqP+ELxSKRWIuPhS6Wm dOlCm7TV4vi5ZyIWwVB0UMfjZ2W6wx1EPqtgvZZ6FBOk+gr45D8NwTHnCfuZVfjUMz+/ A/0gAUe/2mAYkO9Y3sY0j9vspj8wtR/I6pbfj076lXsu5yDFzwoYGaGGb1goG38jsdmQ n6NJILio0kPOXHtPbBN70qnOh+3zdG378qmGecQxEl9J7PAwsePj1C/avKoT1+P1Q1+D FbMA== 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=1OF5kBmO87CrC3EqV3IED1VT5ecy7khHQMVqCv9RQR0=; b=rZ6rNrUBeKIBxCsrE5YSjHU1RRTWxbecG3f9fx+ujUdcbdSqPvlZqCYPwi46fNSQQP q9wPCjumqEiRb1u16LGI97nk3JKySCyW0FGVTEk1yY0WSBnGi8/NFdz3UX7bF414SD08 tqv17kzmECrIGvVmWpLlHHA9EO7FPABPTkURlsg6Em+r/ABLqy4QJJ4I/v37Xqmk888n J6m0csAx4WPursVMO0m8G51+k/aRCEUcmvPuIsZM5iMwS89eBtb62z3dzizCe6KbcZBz 7oKWM7ssXM10SvvGpUuPtV/XFDyJ03HQk6LDAXO5lQleLEk1qbhVsoEWPCTCgqWsVGIJ 7oLw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J2nMrr7G; 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=1OF5kBmO87CrC3EqV3IED1VT5ecy7khHQMVqCv9RQR0=; b=X1QFT0LZnDctDKLhvG048qOD25G2Qdgbg3h1OsbcCWeHx6IHs1/U06pKHF/TGQCd0h lB/4gMEgjLkq6eS+3SsneBO4LwduOES95ghb2zQNfLyM3Xnf0Jiv9j84FWQELNb5Ee4l xATg0NDIkBX+E//k0AMKlTLGghZsN7DnDZ3y0= 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=1OF5kBmO87CrC3EqV3IED1VT5ecy7khHQMVqCv9RQR0=; b=DB96nTHUzLHPTHBhnYZdp/N/fSGCkW5+QQBvzAaurYL71+PdFeYqg9fZNZF0IJm4Xf 0lzaSMpGbPrfMFIvPaMaLtz9ANFBuuBwDP44toUEeI/pV1/u1PvyaSen8kJO9AOwGJdJ i2jgR1WEHX91TE+rOo+NRiiJpKFikKp6BxqCRLaBjRXIatqlzXI9o6OZyqCzeBKzklVg u9l4svjeKmCHFjprUjaKigGgWUjJd+7TKSngExS8J25NTIRKuusZuAX4ktZuQSYTfV/T dvwwQfyrFZvo0Ksn5yvuwL0EsqZBti5Jn8M6cMxM1lb7SbCB+laaSFivEdq0t8wj6ELs ZUYg== X-Gm-Message-State: APjAAAXTmfRvzMmhTpD1R7G9Ierk4sLZOIPxiSNW04AAubqWJ7o5SOKi 5bkwOJoDGsCps0RYNWLYBIueETHu X-Google-Smtp-Source: APXvYqzXCctRDL0wZ6EpWcoIirbjB4YBFKwBL6zpc8urFpexzXWYEiwnLXl8N7blpL3egfb5FPxXZA== X-Received: by 2002:a17:90a:26ef:: with SMTP id m102mr30402644pje.50.1563215384285; Mon, 15 Jul 2019 11:29:44 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:26ae:: with SMTP id m43ls6195732pje.2.canary-gmail; Mon, 15 Jul 2019 11:29:44 -0700 (PDT) X-Received: by 2002:a17:902:54d:: with SMTP id 71mr29275407plf.140.1563215383981; Mon, 15 Jul 2019 11:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563215383; cv=none; d=google.com; s=arc-20160816; b=k6+t/yrRyMRRiUX609LUFeXEvus7hyogAveORsCXKbQ/m33SNZ4ntqPB4k1047KyWs sxWKjXKeXlgzAwYRCn4KP5fJkViF27hWoTR5Ch422S+d+tuHIbB0+INOUwK9CjTprTeE 0it8kWXgWte5ZY1H/YUO87f/nOOX1JzMPsl/qi9xIiugHUooEdUAYnnlprSZui8gh1DO aKze4xyBe+gr/iQ15hJ/NqLlKaQ5XT/wsP/1rzY15WXRPQkTl2ReNUVOXOpzvV25SpoJ 0xK8M4fYjEEp0LMnFpPX2jcCBn/bmvMTCueHTBE52GuG0RY2Am/hej+FKK/br1ecjLV0 e7Aw== 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=vaHztGW3hwCuSUcDRVrDyfWmbZxTrQqSnJP6VTuJxYA=; b=PT8MCgaPRVremR2vZ9fudVFaKKvyxg0oAFd77oYzHrqBo5LSu3NyMzy13mI7znf1fB fIFoYTETeHWeidBEeU6vA8U5elToUuW7BWyRylF5yA8xAjYJ51pZAOLNdS83vWsSjmNI Dx7Q5x2bORvXET1F6MufzYHocgRwISUQCqPX3cnK0J0Fp/t5w0L+hJAZl7BKNS3HA+Y8 gct86pEeSaNNJ4EhdjXzSRV5XOk5hxEVPxIMzPhCes/X81cTqOZz/s7zXdeJonXov1Pw 7pMl+R8C9EQdhOrw+6Mv2cIv9gu5o1VG9Lt8zmezjQA4CYdrnle1ug2N+vh6w2FIzspq mA0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J2nMrr7G; 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 z6sor22102351pju.12.2019.07.15.11.29.43 for (Google Transport Security); Mon, 15 Jul 2019 11:29:43 -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:a17:90a:7148:: with SMTP id g8mr31135109pjs.51.1563215383427; Mon, 15 Jul 2019 11:29:43 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:43 -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 v3 10/18] ram: rockchip: Add debug sdram driver Date: Mon, 15 Jul 2019 23:58:48 +0530 Message-Id: <20190715182856.21688-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190715182856.21688-1-jagan@amarulasolutions.com> References: <20190715182856.21688-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=J2nMrr7G; 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 Reviewed-by: Kever Yang --- .../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 7ac25af327..171b233f95 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -92,4 +92,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; + } +}