From patchwork Thu Sep 29 16:31:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9356745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 109876077B for ; Thu, 29 Sep 2016 16:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0164029BCB for ; Thu, 29 Sep 2016 16:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA51029BCD; Thu, 29 Sep 2016 16:36:14 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D09929BCB for ; Thu, 29 Sep 2016 16:36:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpeIA-0001gM-OJ; Thu, 29 Sep 2016 16:34:38 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpeGM-0000Me-Fk for linux-arm-kernel@lists.infradead.org; Thu, 29 Sep 2016 16:32:47 +0000 Received: by mail-wm0-x229.google.com with SMTP id w84so308814797wmg.1 for ; Thu, 29 Sep 2016 09:32:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K6F+UaPhw8/oFXsqJ1u4V6fRdfXg++jN7q4wJdL6C1g=; b=tra3zXXbG2ktNSH5WvUSPRNSwMnls4HXZ2EdOTuksXy8MIjJZbvTa2/2UwVVsHPHwe bmsyyNsYQ1cFftb4B6WD8WnnAFtcAeyia9UrxqekJDeP+SAC91EV04Igso0S5ObvEXWs oTjiw0PMcGyaOGgHInLSGednJxX1k1aZ3sJrpoPp9b9NTcuVDpzeLRpnGaSqTUt3BbE3 Ehx3B/X2jQNU0kLHY+Ss8UAbLBdvnrHnQSlCBKOrRE/aYLoxkWJW4bTiriijncFNPCCd RloCKP6uKfpBdqCNvvIOPB/+YzUNmxey28wDN4VY7i11dlG5D27Tzh6/ZOXRI8kBRjY3 vIBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K6F+UaPhw8/oFXsqJ1u4V6fRdfXg++jN7q4wJdL6C1g=; b=kdK3gIR5T5EPLE9nvTiIaXJTyrWhChdgc8B/h/CUUD6CltMzS6TVrIFy75TWrrKZ5/ UuNrv1mNPCfdKKyfcsOuFT8xjemuoDhTP7MJ7p+MKwgY3HfLjPRT/eNitNjc+qXtLFAa v1+m1nKVwQXG6t9L8rnU1bS4Z11Q6RZD8hZ0s8j1d8pVi0/8QyPIi4+l0xpMrPW2fBzN Qe4eRjX/BOSj5Sh81lrJT/iM/jruQMwDuf0hJuY+eyOWTWnoXV2nMLRRsq18HgLFDu3m xpquX8NJ0fm8uNaMCIA5DNFVatPHsdrN6hKLMvnz8VhUGUgJABfsE6CLzlZOlLRgVFzo 7TTA== X-Gm-Message-State: AA6/9Rl2GfXKC/YXs6izrN0mTZKOHvcTFKs+SlK2ONdt7zPUc+holAp7Smkv2gEkzaiFHw74 X-Received: by 10.28.236.92 with SMTP id k89mr14725978wmh.122.1475166744625; Thu, 29 Sep 2016 09:32:24 -0700 (PDT) Received: from bgdev-debian.lan (jua06-1-82-242-157-225.fbx.proxad.net. [82.242.157.225]) by smtp.gmail.com with ESMTPSA id q142sm29165898wmd.4.2016.09.29.09.32.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Sep 2016 09:32:24 -0700 (PDT) From: Bartosz Golaszewski To: Kevin Hilman , Michael Turquette , Sekhar Nori , Rob Herring , Mark Rutland , Russell King Subject: [PATCH 6/6] ARM: da850: adjust memory settings for tilcdc Date: Thu, 29 Sep 2016 18:31:55 +0200 Message-Id: <1475166715-7857-7-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1475166715-7857-1-git-send-email-bgolaszewski@baylibre.com> References: <1475166715-7857-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160929_093246_787234_06F7D7CC X-CRM114-Status: GOOD ( 14.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , LKML , arm-soc MIME-Version: 1.0 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 Default memory settings of da850 do not meet the throughput/latency requirements of tilcdc. This results in the image displayed being incorrect and the following warning being displayed by the LCDC drm driver: tilcdc da8xx_lcdc.0: tilcdc_crtc_irq(0x00000020): FIFO underfow Reconfigure the LCDC priority to the highest. This is a workaround for the da850-lcdk board which has the LCD controller enabled in the device tree, but a long-term, system-wide fix is needed for all davinci boards. This patch has been modified for mainline linux. It comes from a downstream TI release for da850[1]. Original author: Vishwanathrao Badarkhe, Manish [1] http://arago-project.org/git/projects/linux-davinci.git?p=projects/linux-davinci.git;a=commitdiff;h=b9bd39a34cc02c3ba2fc15539a2f0bc2b68d25da;hp=6f6c795faa6366a4ebc1037a0235edba6018a991 Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/da8xx-dt.c | 43 ++++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 4 +++ 2 files changed, 47 insertions(+) diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index f8ecc02..9d29670 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -44,9 +44,52 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { #ifdef CONFIG_ARCH_DAVINCI_DA850 +/* + * Adjust the default memory settings to cope with the LCDC + * + * REVISIT: This issue occurs on other davinci boards as well. Find + * a proper system-wide fix. + */ +static void da850_lcdc_adjust_memory_bandwidth(void) +{ + void __iomem *cfg_mstpri1_base; + void __iomem *cfg_mstpri2_base; + void __iomem *emifb; + u32 val; + + /* + * Default master priorities in reg 0 are all lower by default than LCD + * which is set below to 0. Hence don't need to change here. + */ + + /* set EDMA30TC0 and TC1 to lower than LCDC (4 < 0) */ + cfg_mstpri1_base = DA8XX_SYSCFG0_VIRT(DA8XX_MSTPRI1_REG); + val = __raw_readl(cfg_mstpri1_base); + val &= 0xFFFF00FF; + val |= 4 << 8; /* 0-high, 7-low priority*/ + val |= 4 << 12; /* 0-high, 7-low priority*/ + __raw_writel(val, cfg_mstpri1_base); + + /* + * Reconfigure the LCDC priority to the highest to ensure that + * the throughput/latency requirements for the LCDC are met. + */ + cfg_mstpri2_base = DA8XX_SYSCFG0_VIRT(DA8XX_MSTPRI2_REG); + + val = __raw_readl(cfg_mstpri2_base); + val &= 0x0fffffff; + __raw_writel(val, cfg_mstpri2_base); + + /* set BPRIO */ + emifb = ioremap(DA8XX_DDR_CTL_BASE, SZ_4K); + __raw_writel(0x20, emifb + DA8XX_PBBPR_REG); + iounmap(emifb); +} + static void __init da850_init_machine(void) { of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); + da850_lcdc_adjust_memory_bandwidth(); } static const char *const da850_boards_compat[] __initconst = { diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index f9f9713..5549eff 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -56,6 +56,8 @@ extern unsigned int da850_max_speed; #define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x)) #define DA8XX_JTAG_ID_REG 0x18 #define DA8XX_HOST1CFG_REG 0x44 +#define DA8XX_MSTPRI1_REG 0x114 +#define DA8XX_MSTPRI2_REG 0x118 #define DA8XX_CHIPSIG_REG 0x174 #define DA8XX_CFGCHIP0_REG 0x17c #define DA8XX_CFGCHIP1_REG 0x180 @@ -79,6 +81,8 @@ extern unsigned int da850_max_speed; #define DA8XX_AEMIF_CTL_BASE 0x68000000 #define DA8XX_SHARED_RAM_BASE 0x80000000 #define DA8XX_ARM_RAM_BASE 0xffff0000 +#define DA8XX_DDR_CTL_BASE 0xB0000000 +#define DA8XX_PBBPR_REG 0x00000020 void da830_init(void); void da850_init(void);