From patchwork Fri Oct 2 09:16:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 1375618 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=wcMxvYZc; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C2krc4ryfz9ryj for ; Fri, 2 Oct 2020 19:16:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DF41982366; Fri, 2 Oct 2020 11:16:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="wcMxvYZc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 768DA822F1; Fri, 2 Oct 2020 11:16:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8A6A781BF9 for ; Fri, 2 Oct 2020 11:16:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=narmstrong@baylibre.com Received: by mail-wr1-x441.google.com with SMTP id w5so953819wrp.8 for ; Fri, 02 Oct 2020 02:16:14 -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 :mime-version:content-transfer-encoding; bh=VCa6tY0SJuY+7pxkTM1JSjuiia+vESV2fSnudmzR064=; b=wcMxvYZcgmKBIjEYTDU79HUN/SmI4P17bGcbbrMT8Q5e8pugN1p0rIA7rTANujbklx pLC1+di9EUBBZPDqSDSp0jM2iMT3/2s08oDKMzE2oQMldtvyQ72ZvXxtXI6jKCv4HoA1 krzyBx0cF+2IsEa3AQVo0i1albGzlVeai8A+Yt/XqE5ZPWuXS/3pFfDAIINEgWeFSE20 d35vEsMPjXudgpT+Xk/Nvu8rUJmr91ftTos3NI1llSyYg9eoH6tCUYe0nsSlCsSA8ZFM bMx/dfWnO/2aJHIcwy/IFTthZjqL9sVf/kolG4xdvpJLHP08sI2T4/sKByfDccXBLd+m +4Eg== 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:content-transfer-encoding; bh=VCa6tY0SJuY+7pxkTM1JSjuiia+vESV2fSnudmzR064=; b=gaFehp3iOOnYwM48urIJEJSV8m19i+NX1HZpbLLJ1k6gH+0/YWeEqv5dVOkLOcfknN nkXTcULFAuC538xRAHGPrHY/LkiIba1SrwkbPIk/DR/WOsXsmRTmJBKmo+xEaseta5iS eSWYDl4BtjBlSUi1nGjm099fFy+lHo/3GKWRzEln/LYj8I3M3Tq5Fh0YqXKbrU43EhyX J+4BLOYOa9+kYN+Eqqc7+/EXo0ffKM8f4At8M0JrLqXELnr8d2eR1LwMtNpHrk5LYAyF udjzz/E2HGP158rDcVG1wGFnjoujO0Gkm5QgwoKBHGy4vbaALZRVRALRt22Rc8L7e8UP 8Rtg== X-Gm-Message-State: AOAM532j1x2Dm4XBDFpjhNK1t9ecxNg06kY1hwbyvofUze2DKbsQRrlb +y0SduZV+rQxbDFcYy9R9YQhAl+EVzcHcMjieQQ= X-Google-Smtp-Source: ABdhPJz7DVYLGP4YDusqGr2SiXN5b9mIm6p20fVJUFhyqaN8z63whn9jmdPpys2ny0qNGoSR7BsKYg== X-Received: by 2002:a5d:4b86:: with SMTP id b6mr1856861wrt.173.1601630173977; Fri, 02 Oct 2020 02:16:13 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:19c6:62a7:d765:db15]) by smtp.gmail.com with ESMTPSA id m10sm1096644wmi.9.2020.10.02.02.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2020 02:16:13 -0700 (PDT) From: Neil Armstrong To: yannick.fertre@st.com, patrick.delaunay@st.com, agust@denx.de Cc: u-boot@lists.denx.de, u-boot-amlogic@groups.io, Neil Armstrong Subject: [PATCH 2/2] video: dw-mipi-dsi: permit configuring the escape clock rate Date: Fri, 2 Oct 2020 11:16:09 +0200 Message-Id: <20201002091609.1023621-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201002091609.1023621-1-narmstrong@baylibre.com> References: <20201002091609.1023621-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The Amlogic D-PHY in the Amlogic AXG SoC Family does support a frequency higher than 10MHz for the TX Escape Clock, thus make the target rate configurable. This is based on the Linux commit [1] and adapted to the U-Boot driver. Signed-off-by: Neil Armstrong [1] a328ca7e4af3 ("drm/bridge: dw-mipi-dsi: permit configuring the escape clock rate") Signed-off-by: Neil Armstrong --- drivers/video/dw_mipi_dsi.c | 20 ++++++++++++++++---- include/mipi_dsi.h | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c index 8f909a4e9f..12a55cfbec 100644 --- a/drivers/video/dw_mipi_dsi.c +++ b/drivers/video/dw_mipi_dsi.c @@ -483,15 +483,27 @@ static void dw_mipi_dsi_set_mode(struct dw_mipi_dsi *dsi, static void dw_mipi_dsi_init_pll(struct dw_mipi_dsi *dsi) { + const struct mipi_dsi_phy_ops *phy_ops = dsi->phy_ops; + unsigned int esc_rate; + u32 esc_clk_division; + /* * The maximum permitted escape clock is 20MHz and it is derived from - * lanebyteclk, which is running at "lane_mbps / 8". Thus we want: + * lanebyteclk, which is running at "lane_mbps / 8". + */ + if (phy_ops->get_esc_clk_rate) + phy_ops->get_esc_clk_rate(dsi->device, &esc_rate); + else + esc_rate = 20; /* Default to 20MHz */ + + /* + * We want: * - * (lane_mbps >> 3) / esc_clk_division < 20 + * (lane_mbps >> 3) / esc_clk_division < X * which is: - * (lane_mbps >> 3) / 20 > esc_clk_division + * (lane_mbps >> 3) / X > esc_clk_division */ - u32 esc_clk_division = (dsi->lane_mbps >> 3) / 20 + 1; + esc_clk_division = (dsi->lane_mbps >> 3) / esc_rate + 1; dsi_write(dsi, DSI_PWR_UP, RESET); diff --git a/include/mipi_dsi.h b/include/mipi_dsi.h index 55c7ab3328..4ca05f71e2 100644 --- a/include/mipi_dsi.h +++ b/include/mipi_dsi.h @@ -123,6 +123,7 @@ struct mipi_dsi_phy_ops { void (*post_set_mode)(void *priv_data, unsigned long mode_flags); int (*get_timing)(void *priv_data, unsigned int lane_mbps, struct mipi_dsi_phy_timing *timing); + void (*get_esc_clk_rate)(void *priv_data, unsigned int *esc_clk_rate); }; /**