From patchwork Tue Jun 11 14:50:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 495 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 4C5633F08F for ; Tue, 11 Jun 2019 16:54:49 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id r7sf7901802plo.6 for ; Tue, 11 Jun 2019 07:54:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560264888; cv=pass; d=google.com; s=arc-20160816; b=KxDzLvQox7XpuhqVewV7U8Hm3GKrspLS9i+o+cmH/ESGIld/HBRfIpRNkoOeTXq0+h feN2jurvj1qifJbnVV8w3rvq/HF9ZNW/MwyhSpnC1NfuE0ScAWMBAamyX0X/oTfjbHDj Um6kBS0A40NiWRNKEb18tsFw1fc23Oo76hBwAnz/CvnuyHDufIZUJ2tqqfdaw8EtVouM cUk50aoIJeQ6neB4B4hOI098dY9CMZvpdWEphg2NDK81LSf2RreXNfRt8vlgTmtQG8nq ai8jL+qat0rm6xAqaB771+r4IcvUqbJOXCMqH72ZkSYW8NoXeekZTLH+Ar/hnktsg98Z E17A== 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=cTJFVIS0wRShDQJkWnobfOnqtb7bpGvqiegoaDMGUVc=; b=W6qt0/WUV4VoV3AZJSIHNjDrT5mieVUukZE01JnWn3BOarCpTYN9foCylE1+fHx0MU ln+nFLQ8svVwt+NAdzACOJBI8gnHlOUVeZJNFauqsj4STcdMF1JDSuPRGCGQsvUg37gs 7qDk3HBf/A3mjil+z9U0fTHTuQ47NmINWjd+RtHsD9UJ5TEqE9DuDjjsEEwB0gI+/EzR b71gxwzY+NR/xgg/N2q7Fr+nLDbmkbgU0cXtslECYq4OEqsHFoJ1EUlr1q7jmR4lhSew WDlzj9j7WMtM4FmGjHJKvVL8mgCYE1w4lAlRs5EDNgpVfGAJzAGYM+EHczr4TBn5qjvH DRdw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Kf5GydXh; 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=cTJFVIS0wRShDQJkWnobfOnqtb7bpGvqiegoaDMGUVc=; b=XQwAQ58JiWNdPqslHYP8UG+ngGZ9EbPXBUd5Er79XLrrsaHbmb30FUgyZh7byfZ/kE njmLyXaCHJWSO4jV4+5T3dHIdUyHixw3Z4E0wY9VyqrAh0isCkM529taP1kflOJf2M1F pcFXQhfK26tarPSHB3nlt+dLzUtl4bIu2wcN4= 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=cTJFVIS0wRShDQJkWnobfOnqtb7bpGvqiegoaDMGUVc=; b=qxDVdQMEMPDSFvMV87BIr8OmyFZbGhsIkW48TzKUGqjUybdrs/xn7VkmbcZRWXqYly Fe+3HSSN/FVi7KS8exPvLVLRqZEuMfYig1VxsJ+1ijOOGyz4aUb7XoHJM33mb7zD+p/1 JOwfmjcXAqybDncBaGluGi9tbhhHSlXOrWHIc3k0O6LW7x8fOBQuXkYVlMQk60Ns6GAm mSGVN7gvyD0nsPvSVQFbBUdoVo6YAAktcUwzrXxsDctKaNiUgD+sEkjV+d0tkvnVP553 yGT4A/p+vBBQWisvCgwvguUPLwXBa351KQt0WP2QIRnkH5z1tif7WrFHbfbAq9hE81fe +G0Q== X-Gm-Message-State: APjAAAXa79hNz2WY8l6f7IVJQxOmiRGAgu5WrGGw6V/ibMgS9KAIbzll 69I+TkFDZLkl8mzXw8WKK9WMH0Cn X-Google-Smtp-Source: APXvYqxoZDpuD5R20bBvLuvs9wuanLZSBlIFDPJk/Iw2Luo5OA4kE28+A8TEcdq10sfSsM6isAdu4Q== X-Received: by 2002:a17:902:70c4:: with SMTP id l4mr40756844plt.171.1560264888144; Tue, 11 Jun 2019 07:54:48 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8a8f:: with SMTP id p15ls4699984plo.2.gmail; Tue, 11 Jun 2019 07:54:47 -0700 (PDT) X-Received: by 2002:a17:902:934b:: with SMTP id g11mr64004910plp.245.1560264887782; Tue, 11 Jun 2019 07:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560264887; cv=none; d=google.com; s=arc-20160816; b=wxFACpZ5vXlylpMSo7Y8bGDcPFU3v+4VDHKXpxd+4ebjUKuclcmBWQ1MphQnyqIMcm deEDZ5qpCd9H5Vxuv69/DaqHZlacABMhBdnqGGM8IO+iY7ZkZzIyRL8t+GToFVa1+qMD N8yR0TKCjFV/MZo3Cq/VrmbtscF6+Df8PYKEt6XMRmBGnSDJ8xDcEAt9FMOnXKEqPS0m 1RNK/8zLC8vQiQHWhAV7WeyyjcmkljzpIUFlewx5t5NS4H9Y3woFQP7U1Duz05x5EXA0 UGkKzTpDJ/1YOkDzUXqPQ7tBkkb8PqAuTvnkrXuKq9iNb5VbL+hn7I4qaMDK66ib02Om 2dKQ== 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=XhdCNTKPTz7BvpFyl8lpuUkh8SvoRcCSv/2PVP+pBIM=; b=x0p+CElmrlVF/nlj4OPLANZa5OBRqSi/DSknlQP4/wzxwz9jkEK/M0znDjeJoDtALB uK38usV/W+YnKqrz+agumCYZsjsgkqRy3S11LnXMFbVIc0wm7vdl4B2cuXQAPiMhBnFP KxxdQGPF0ZfKMm7KXxp1soIuq3GtRhzRcTCoeS2rcXRZ3lgUdcWvHD+vMt9xKl1wWhYK qWqil6aysGf1L74G8y3oYUFm3l8kAXVguUjG9u66enASlXjmDhAgXE4rRyL6ebp2HTG9 MX3OD3dZiHnNDnTvEvTIIb9E32hjXV9vZ3TEwOsK+up7OVeandD1lrHL5Q1EmVanU77Z /fkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Kf5GydXh; 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 v196sor6658032pgb.58.2019.06.11.07.54.47 for (Google Transport Security); Tue, 11 Jun 2019 07:54:47 -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:a65:60cd:: with SMTP id r13mr20771234pgv.58.1560264887387; Tue, 11 Jun 2019 07:54:47 -0700 (PDT) Received: from localhost.localdomain ([115.97.180.18]) by smtp.gmail.com with ESMTPSA id e9sm16206208pfn.154.2019.06.11.07.54.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 07:54:46 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Cc: gajjar04akash@gmail.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 44/92] ram: rockchip: Add debug sdram driver Date: Tue, 11 Jun 2019 20:20:47 +0530 Message-Id: <20190611145135.21399-45-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190611145135.21399-1-jagan@amarulasolutions.com> References: <20190611145135.21399-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=Kf5GydXh; 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 d723e6dacc..ebf4148b4d 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -122,4 +122,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; + } +}