From patchwork Tue Jul 16 11:56: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: 749 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DFE963F08F for ; Tue, 16 Jul 2019 13:57:59 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id i2sf12237174pfe.1 for ; Tue, 16 Jul 2019 04:57:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563278278; cv=pass; d=google.com; s=arc-20160816; b=QICN2i4bDCA1N/lFJeq0ObRGhDhX9Trh3XZ9kbAWQouNLUQeds7q3YkQK2XVzf+Izx YWo7FqOnMS8Aao/ALq4cvp++oStfMTeyiKBPd8guEXlQjscD99BRpiGVfQFFgOdeovid btTNW9yFOfZ/ftSfqWq3WDZlyo0sX7xcYEjuCNPaO5vBDlDJvJSQxtVsoAP0UY5FRszv EUwZV5gygoN2OXtoJtyo37+Hie0VJIc2Pfg65+u/t31wShPU0skdDmk6lN+soYG7evUN NK115imJV5lD7IiMUJnf1YcbDmGd7+hiLnM7b7X5AOqiT9pw/9G6Alo/JvVdt/yDOuOq Zv9A== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=oCO896K0rAzEeN9W2rVEOdfwPiF8CF7FwET/Cw1V64Q=; b=OGiK2gOvHDvBt+g2RZplLW2IxorA1C0wzitS8PqhPJYDWser6jdrHbn9fpVtRVTW2i IzsGMNfK5khnlMUFbcUXfEXqW4KWwgKf3dyNgAxHa9NwUa9Kg8rX68TwSsKpvf2taiv7 XQf18/vOtPWBDP6/IE2y+U329/+bN+Hb9DCd141rOMPDo89kc087n4NkPVIJIHswIcSd a1JUn1IUur0bM/qdlBcXlN83QQXmbKyMDIpyTfHbpSxecWzbFHFH3h4jQIveuJZljzla 6754i1CvFzc2aUgZj5b9jRCg/BDMop80jINGmNo7j3Zycc/Ti2p4oPKPZ+nxqtQjlCwh VVMA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=V9cyzw4k; 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:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=oCO896K0rAzEeN9W2rVEOdfwPiF8CF7FwET/Cw1V64Q=; b=BGS5s9eXTy7LHFuDS3BaEm6cJYWIilZuihkgOeXjbPd69vI+5EUeTT7NpU6fMYkjzX 5wVCEJ0rQgtZjHNJ5FIuA9mNyjEhFjUPmkleC52D06A+AeGuXdOT72Hqu0VSZSiEfgqS Uw6Tvm93+l0IgU/llqrZQccxGWmumKrsKr/tU= 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: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=oCO896K0rAzEeN9W2rVEOdfwPiF8CF7FwET/Cw1V64Q=; b=uh5nSi5NKpnYR93m+Ol6nfclIGaw6BsCXYgwZRUfElq1C8/HTBxnG1d1YOIzFSqz8/ 84PeLTNPAXT0NHV5C+0FvgaxIRIO8ExnhK/W1++/+x3KuVjjGlURrz+LVQIweTvCrHp3 0AsFP6+KTJn2Jtpz8v+C0nEHCu0W0UbUkPPrRWPxsGOALOVbi7l8/85NeuU2JUNHZvmL LDO/Qxt4Xi5rwyiSp5vnE+TYkXECpM88uesPRoQwsMqAz7OpJOcXAQwmRM7z/wWkEvx2 B+7j+2nq42Rk2BKt1INfk3QY5A5yztzGVsDgssUH4ajyJpZXfLxbK1jGwVlXT+HO7oS/ a+Vg== X-Gm-Message-State: APjAAAUXQps2r2kGIsQ7XmEtEkPGbkhPwf7fhcbmgl/K/pPXM1ZZTxyw SOiruF5daqDicRAegohnggyk5EEG X-Google-Smtp-Source: APXvYqy2OC71/P+O4m38aaCNdDbqVeVVbESJfg1brIRrwTefho+tCtH3av/9josRwlhp8D/YDzMRLg== X-Received: by 2002:a63:f357:: with SMTP id t23mr530228pgj.421.1563278278017; Tue, 16 Jul 2019 04:57:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:26ae:: with SMTP id m43ls7076546pje.2.canary-gmail; Tue, 16 Jul 2019 04:57:57 -0700 (PDT) X-Received: by 2002:a17:902:b688:: with SMTP id c8mr34288954pls.243.1563278277632; Tue, 16 Jul 2019 04:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563278277; cv=none; d=google.com; s=arc-20160816; b=JQGEaxwa2qouTwr3jWsOMQrQVRTStbO75oFZvGVpNmv9KPl/NFhH72TRqP/SquQoev 5bjkHRmUrVJ/lR/hbO37tdhjxggYjehm5iLQ+chamA0fDLQ/TDGk3mQrz2Tp/hoF0tD/ AisJArAkMRRnSceqDV5FFQiN7w2gDFZImhG7/Wsk7BypkC+/1DJYX4tL5rRJQEUE2kS6 A30ffEtQg4nfUjWfNW8nWqiFBKHM6PsUfTFaQnS8qF7u1uSd0yiPY89fnxeXYY0bbeQc k7dM/uTsCyDScEPvl8ZyXRUawQI4s+dxeerqi0PkGhtHkngCpPLCvOaBqrlgy3JKNa28 t0Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=iH5gCfl0OuGYiRTd2UB1cBM68KaQdhsCRty5hxYd3dY=; b=o8sIaftUW64MZc12eXZObiKcDdSlyn8n25cK+qU90H7hRywVDimCMYW1GzN48qWKjh aGsqOdBikFkMBQJ0ePpf5pEz88WqoI6G+34heL22DQNHKCDuzSnLQdDg30l1lrhdQ92U ynJ6XWVeGmIi5j5+lK+XdqrR+rx9WTiPmlBa2lIxy5/99DPmq0ljJBqUvM6XZov6HKZp YCPe/FUWkLhMXe+d2jqeEDHO6uXYt9ois/6OVuXFwcCN+lR79l4mQlvTjhvgi/cgqwGK t1V30fgXpF48XwZuw4ktD+YULOCfMC/zrxm2myB4wFghOSBNK4CDqgUPQjJtHoMrpiib bcQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=V9cyzw4k; 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 f194sor10848393pfa.8.2019.07.16.04.57.57 for (Google Transport Security); Tue, 16 Jul 2019 04:57:57 -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:a63:2cc7:: with SMTP id s190mr21276476pgs.236.1563278276626; Tue, 16 Jul 2019 04:57:56 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id z24sm36269566pfr.51.2019.07.16.04.57.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 04:57:56 -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 00/57] ram: rk3399: Add LPDDR4 support Date: Tue, 16 Jul 2019 17:26:48 +0530 Message-Id: <20190716115745.12585-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 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=V9cyzw4k; 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: , This is next revison of lpddr4 support on rk3399 compared to previous set[1]. It has some changes based on the commit orders and squashing few patches together and rest is same. Thanks to - YouMin Chen - Akash Gajjar - Kever Yang for supporting all the help on this work. Changes for v3: - squash set_rate code in one patch - tested in Rockpro64 and Rock-PI-4 - order them in proper way - rebase on master Changes for v2: - handle LPDDR4 code as part of CONFIG_RAM_RK3399_LPDDR4 - support data_training and set_rate via sdram_rk3399_ops - add proper sys_reg_enc macros - add new patch to rename variable sdram_params with params - fix few commit messages. patch 0001 - 0018: add dram config enc macro patch 0019: configure phy IO in ds odt patch 0020: add LPDDR4 config patch 0021 - 0043: lpddr4 data training changes patch 0044 - 0046: syscon pmu support patch 0047: set 50MHz ddr clock patch 0048: set 400MHz ddr clock patch 0049: LPDDR4-400 timings patch 0050: LPDDR4-800 timings patch 0051 - 0052: lpddr4 set rate patch 0053: enable lpddr4 support on Rockpro64 patch 0054: enable lpddr4 support on Rock-PI 4 patch 0055: add LPDDR-100 timings via dts patch 0056: use LPDDR-100 timings on Rockpro64 patch 0057: use LPDDR-100 timings on Rock-PI 4 [1] https://patchwork.ozlabs.org/cover/1116734/ Any inputs? Jagan. Jagan Teki (57): ram: rk3399: Add ddrtype enc macro ram: rk3399: Add channel number encoder macro ram: rk3399: Add row_3_4 enc macro ram: rk3399: Add chipinfo macro ram: rk3399: Add rank enc macro ram: rk3399: Add column enc macro ram: rk3399: Add bk enc macro ram: rk3399: Add dbw enc macro ram: rk3399: Add cs0_rw macro ram: rk3399: Add cs1_rw macro ram: rk3399: Add bw enc macro ram: rk3399: Rename sys_reg with sys_reg2 ram: rk3399: Update cs0_row to use sys_reg3 ram: rk3399: Update cs1_row to use sys_reg3 ram: rk3399: Add cs1_col enc macro ram: rk3399: Add ddr version enc macro ram: rk3399: Add ddrtimingC0 ram: rk3399: Add DdrMode ram: rk3399: Configure phy IO in ds odt ram: rockchip: Kconfig: Add RK3399 LPDDR4 entry ram: rk3399: Add lpddr4 rank mask for ca training ram: rk3399: Add lpddr4 rank mask for wdql training ram: rk3399: Move mode_sel assignment ram: rk3399: Don't wait for PLL lock in lpddr4 ram: rk3399: Avoid two channel ZQ Cal Start at the same time ram: rk3399: Configure PHY_898, PHY_919 for lpddr4 ram: rk3399: Configure BOOSTP_EN, BOOSTN_EN for lpddr4 ram: rk3399: Configure SLEWP_EN, SLEWN_EN for lpddr4 ram: rk3399: Configure PHY RX_CM_INPUT for lpddr4 ram: rk3399: Map chipselect for lpddr4 ram: rk3399: Configure tsel write ca for lpddr4 ram: rk3399: Don't disable dfi dram clk for lpddr4, rank 1 ram: rk3399: Add IO settings ram: sdram: Configure lpddr4 tsel rd, wr based on IO settings ram: rk3399: Add tsel control clock drive ram: rk3399: Configure soc odt support ram: rk3399: Get lpddr4 tsel_rd_en from io settings ram: rk3399: Update lpddr4 vref based on io settings ram: rk3399: Update lpddr4 mode_sel based on io settings ram: rk3399: Update lpddr4 vref_mode_ac ram: rk3399: Simplify data training first argument ram: rk3399: Handle data training via ops ram: rk3399: Add LPPDR4 mr detection arm: include: rockchip: Add rk3399 pmu file rockchip: rk3399: syscon: Add pmu support rockchip: dts: rk3399: Add u-boot, dm-pre-reloc for pmu clk: rockchip: rk3399: Set 50MHz ddr clock clk: rockchip: rk3399: Set 400MHz ddr clock ram: rk3399: Add LPPDDR4-400 timings inc ram: rk3399: Add LPPDDR4-800 timings inc ram: rk3399: Add set_rate sdram rk3399 ops ram: rk3399: Add lpddr4 set rate support configs: rockpro64: Enable LPDDR4 support configs: rock-pi-4: Enable LPDDR4 support rockchip: dts: rk3399: Add LPDDR4-100 timings rockchip: dts: rk3399: rockpro64: Use LPDDR4-100 dtsi rockchip: dts: rk3399: rock-pi-4: Use LPDDR4-100 dtsi arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi | 1 + arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 1 + arch/arm/dts/rk3399-sdram-lpddr4-100.dtsi | 1537 +++++++++++++++ arch/arm/dts/rk3399-u-boot.dtsi | 4 + .../include/asm/arch-rockchip/pmu_rk3399.h | 72 + .../include/asm/arch-rockchip/sdram_common.h | 31 + .../include/asm/arch-rockchip/sdram_rk3399.h | 29 +- arch/arm/mach-rockchip/rk3399/syscon_rk3399.c | 8 + configs/rock-pi-4-rk3399_defconfig | 1 + configs/rockpro64-rk3399_defconfig | 1 + drivers/clk/rockchip/clk_rk3399.c | 8 + drivers/ram/rockchip/Kconfig | 7 + .../ram/rockchip/sdram-rk3399-lpddr4-400.inc | 1570 +++++++++++++++ .../ram/rockchip/sdram-rk3399-lpddr4-800.inc | 1570 +++++++++++++++ drivers/ram/rockchip/sdram_rk3399.c | 1726 ++++++++++++++--- 15 files changed, 6317 insertions(+), 249 deletions(-) create mode 100644 arch/arm/dts/rk3399-sdram-lpddr4-100.dtsi create mode 100644 arch/arm/include/asm/arch-rockchip/pmu_rk3399.h create mode 100644 drivers/ram/rockchip/sdram-rk3399-lpddr4-400.inc create mode 100644 drivers/ram/rockchip/sdram-rk3399-lpddr4-800.inc