From patchwork Mon Mar 25 07:45:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Lo X-Patchwork-Id: 10868117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 360F017E0 for ; Mon, 25 Mar 2019 07:45:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC4728B6B for ; Mon, 25 Mar 2019 07:45:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1227C2910F; Mon, 25 Mar 2019 07:45:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 99BF028B6B for ; Mon, 25 Mar 2019 07:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=1EOUG58XBPqKWwjWpBHGcNg/fEMcHPIQLH4d5/0QiQc=; b=uR8my8rYPaQnVf 7VSHzFfeuwJbqfeuM4YtJv/HGjnmoxJsHF1OupM+Epne0k3ZR9u1/4MEPtr/Ox0FTSOGRbtQHlHgP V4g8heRSEbhG6uLG50CQbF0AWTKZvkEuzmGokglDDBvJHjT4StOtDmdUcEIxwo/K9Pps5YyMT7uu4 RvVNPt1yiAULlVVNHLvmzfhJlXsKD4DSlgNuvDtrxR3WYz4ni89QrNJoVEPvDIXtlvJ5yP/ujzSOu htvqEOYcGteIGBxcteJjRjmeksCEIH28Ohm2z0TR/dF8o/skvkcLjxLvCnscpistR2STo4/+NOLrE im8bpTSen3w7oCV/ZVVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8KIa-0005e6-EE; Mon, 25 Mar 2019 07:45:36 +0000 Received: from hqemgate15.nvidia.com ([216.228.121.64]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8KIX-0005dj-GY for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2019 07:45:35 +0000 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 25 Mar 2019 00:45:28 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 25 Mar 2019 00:45:32 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 25 Mar 2019 00:45:32 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 25 Mar 2019 07:45:32 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 25 Mar 2019 07:45:31 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 25 Mar 2019 07:45:31 +0000 Received: from josephl-linux.nvidia.com (Not Verified[10.19.108.132]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 25 Mar 2019 00:45:30 -0700 From: Joseph Lo To: Thierry Reding , Peter De Schrijver , Jonathan Hunter , "Rob Herring" , Stephen Boyd Subject: [PATCH 0/8] Add EMC scaling support for Tegra210 Date: Mon, 25 Mar 2019 15:45:15 +0800 Message-ID: <20190325074523.26456-1-josephl@nvidia.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-NVConfidentiality: public DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1553499928; bh=eDKfvymPODbXseh5PJR3dt/y5H+YJ7LevxZ5PwjWeIw=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Transfer-Encoding: Content-Type; b=kI3EjYrwZ7Snry7XdeuSTEHoNlcIm7rAvqoaJYJj+s52WHB4cUH8XZ6mshqiX+VZO GtroCJxj/1VWFfa9oA0txI1B8EOqCOTi+qKKd+oa+cpYeyty5Ltyu6a0CS7cu9yZVh oB9NP/Sf4CrlfEnNuCsmo+Pq3g4tSDS3O1LcRE2c26L0XqmVUuLVrtdsxoR8muEPbq h7+hFUDG4lSO5fdw6T6TGQqx9r/W5Jutg376bUrhzFYdELWa5GeIpMEZbfH+3464ti YD+rWMnTpOpu9NC0HU+A0dZAyGcrLeiWj7yy9FiQlgkg2qWf86yB+ucQ/cQekPT0Xb enPy8gUNyV7sQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190325_004533_571198_1AFBAE79 X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Joseph Lo Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This series introduces the EMC clock scaling support for Tegra210. There are three parts of this series. i. The DT bindings of the EMC table and how to deal with them. To support LPDDR4 DRAM devices, the EMC table with timing data must be trained before it can be used. The bootloader firmware will help to do that at the early boot stage. And help to merge the trained timing data into the DTB that EMC driver in the kernel will use later for EMC clock scaling. And for backward compatibility to support the upstreaming devices, like Jetson TX1 and Shield, the bindings should remain the same. Which means we may not able to change the bindings currently. ii. The EMC driver will use the trained EMC table with the ram code that the platform used to update the EMC registers for clock scaling. And to support higher rates (above 800MHz), periodic training is needed. This will be done by a timer. And two EMC sources will be used (PLL_M and PLL_MB) for the rate switching above or equal to 665MHz. It will check the current source and switch to another one dynamically. iii. The detail sequence for EMC scaling support, this includes how we update the table to EMC registers and the periodic training support. Here are the details and dependency of these patches. Patch 1 is the binding document of the EMC node and table. Patch 2 is the clock driver update for EMC scaling support. Need to note that with the update of the MC clock, the patch 3 (EMC clock driver) and patch 6 (EMC node in DT) will be needed to make MC clock to work normally. Patch 3 is the EMC clock driver. It can get the trained table from the firmware and know the current EMC status, like the rate and source clock. Patch 4 adds more APIs and support code. Tha will be needed for the EMC scaling sequence. Patch 5 adds the EMC scaling sequence code. With this, we can support EMC clock scaling now. Patch 6 introduces the EMC node in DT. Patch 7 adds EMC table of ram code 0. Patch 8 adds EMC table of ram code 1. Joseph Lo (8): dt-bindings: memory: tegra: Add Tegra210 EMC bindings clk: tegra: clock changes for emc scaling support on Tegra210 memory: tegra: Add Tegra210 EMC clock driver memory: tegra: add EMC scaling support code for Tegra210 memory: tegra: Add EMC scaling sequence code for Tegra210 arm64: tegra: Add external memory controller node for Tegra210 arm64: tegra: Add EMC table of ram code 0 for Tegra210 Shield platform arm64: tegra: Add EMC table of ram code 1 for Tegra210 Shield platform .../nvidia,tegra210-emc.txt | 605 + .../boot/dts/nvidia/tegra210-p2894-emc.dtsi | 24851 ++++++++++++++++ .../arm64/boot/dts/nvidia/tegra210-p2894.dtsi | 1 + arch/arm64/boot/dts/nvidia/tegra210.dtsi | 23 + drivers/clk/tegra/clk-tegra210.c | 112 +- drivers/memory/tegra/Kconfig | 10 + drivers/memory/tegra/Makefile | 1 + drivers/memory/tegra/tegra210-dt-parse.c | 340 + drivers/memory/tegra/tegra210-emc-cc-r21021.c | 1962 ++ drivers/memory/tegra/tegra210-emc-reg.h | 1482 + drivers/memory/tegra/tegra210-emc.c | 1814 ++ include/dt-bindings/clock/tegra210-car.h | 4 +- include/linux/clk/tegra.h | 5 + 13 files changed, 31192 insertions(+), 18 deletions(-) create mode 100644 Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.txt create mode 100644 arch/arm64/boot/dts/nvidia/tegra210-p2894-emc.dtsi create mode 100644 drivers/memory/tegra/tegra210-dt-parse.c create mode 100644 drivers/memory/tegra/tegra210-emc-cc-r21021.c create mode 100644 drivers/memory/tegra/tegra210-emc-reg.h create mode 100644 drivers/memory/tegra/tegra210-emc.c Acked-By: Peter De Schrijver