From patchwork Fri Sep 13 09:55:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3469 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3FF6D41280 for ; Fri, 13 Sep 2024 11:57:04 +0200 (CEST) Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a8d15eff783sf112229866b.3 for ; Fri, 13 Sep 2024 02:57:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221424; cv=pass; d=google.com; s=arc-20240605; b=FEquHWIsI6ynhbcWcdvGovzjI389pq+0uZmu+xrROtHHgGn2BZ0CQHt9bUNk/+COVa UPZylwNgCr8lvFIse5RD/A/UEFf895VNZZ9QG4RHFyvSNpLycEiKsnyeE3yJAOnsR2i4 ZkCSVHvCoz8oKV7tznoQHFeMdjwzTvVDVU3gtdK7Tk9KkSrrfL+Q4syXRenkQbtmRmHm WHu1GbKiEqomsIeP4YUJvzcq8AnoyB59EftO/BIL2ccj8uo4RHTuOlB2ujkOIqVkT+h7 klzQFFCiFtVSTIT+bWW7Q53GB6gbm/XGUFe9s78mn3ueAn5sqmr+6gPzUy4u1BaBTp+l lySQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=lKavKFMmh3C3a3RQxVc+z8GTUqYYPBpzHKzY7t3mR80=; fh=PJQfx2Dk93IevpdN6liEEP59LS23+nJPPO4eXsNvVZY=; b=KO3W12Vx0pEcUiENQn25bNyFYOMwDumT/+gXxxr8Pxi3xIeqV+Ra8dohWvKPAFxiSx vOX0DjgkY+Jg5xNAQCiJKprZ/BIESK0LJK41QgrhWJOfhq4uYEbOlL46tro6UkMvyFJp FzOcHl4HLKzzQz8Hh3kS3CcpxvIXK5qZC2uTSy+XW92W4MTL607mEIqu8bDUNKzPXk3+ 5hmVYpm5iru124JsC73lLlMTu/By+w4HDUkKKiuVaTLyDoJHgc68BgTPf4rwJ2UVCpMm 73WvdAs6NHvOpyPbO13y1P7RphteP4LF0Yqs17fHsUCKJQslLVatphFRrXSaVAac90hs xiCA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OK+Wixix; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221424; x=1726826224; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lKavKFMmh3C3a3RQxVc+z8GTUqYYPBpzHKzY7t3mR80=; b=oRx9q/EvqdMBGTxpLHGx0gd1NaMDdmojliDr/xhLuEOLWVccl4UoKJvUNfBHDAGft9 X7npudFI9+rHa0Q77STjPlY3l3mY8HPzfeeAsyrupOxrrGeGNpzLoVzguVjJ6KHPtlmX JG0j1eY3JrORXhnPGEckJZb/3iGdvhkH3Ay6Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221424; x=1726826224; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lKavKFMmh3C3a3RQxVc+z8GTUqYYPBpzHKzY7t3mR80=; b=Qs84gyb+C3Uxuk1IbQv5HR2E63hs+CeyIPXzzWXhOLz0Wxd6jIKOA+qsrS5WRDTl/F 2HKCeYgN/heanID0uhqw0KdCEeV4Fq/gUepB8NLgYtX+AHtLV4Ros/OVtmUhInDBPW4u 2XUF47YBawZjph3vHr+eAfSXJK0Ck8H/iF1PTziRJ3NRPNH3PDswJ5cuaINnDaeb83sO YloT8IEQlqnBgWoA3OjlAHoH1ebd+4JZFhPg0kv4IRIwiCx0WyimJOcHYXJvOo5hMnUn XxySTH1ytIBvl8jdCNjTJYBJVkK6s9Yc2B+hPq7wDxPpHZ7AcATMuL/vP3w5IrssNrWW vRwQ== X-Forwarded-Encrypted: i=2; AJvYcCX+I7k8bcIk9HVoLVLmEpGjdoGPCW0qRdHSGryBulstLun7DlhND8+/jxmVbUR8LtCXtW1z/fw7qKGT0Qy3@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzRm0Jt5qHNj/1CaiucpofTjBJe09aAhTyFe890ft3XdQOLXYOw MoXhKtFl3B7UpTyGExICpd2XbwBSqE9pxzjDRVKCzicakOsl8X6sdmL0s+QRjJDJ/g== X-Google-Smtp-Source: AGHT+IFSYBbn6SgxrlZQXWmwHmD2phiUd2sU9WDUE9Edqv9YYIyt5mlHtBb9B+GwqQVPxxPl4W5X+g== X-Received: by 2002:a50:c94b:0:b0:5a2:68a2:ae57 with SMTP id 4fb4d7f45d1cf-5c413e522ddmr3820026a12.31.1726221423618; Fri, 13 Sep 2024 02:57:03 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:524b:b0:5c3:cb56:e6b0 with SMTP id 4fb4d7f45d1cf-5c413e236afls672407a12.0.-pod-prod-07-eu; Fri, 13 Sep 2024 02:57:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVKoyPOYQAo0PnXs1ylmp4jROth/+NKdWPOb2hDS7wRfJ1wXxaXjHoIyb9wftsIxgj+xbC90pVBNN7SivdS@amarulasolutions.com X-Received: by 2002:a17:907:e24e:b0:a86:8f8f:4761 with SMTP id a640c23a62f3a-a9029452990mr529364066b.25.1726221422035; Fri, 13 Sep 2024 02:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221422; cv=none; d=google.com; s=arc-20160816; b=e5z4v0bX0MatDoJ8A6V3k0XYPL9+ey/GGaLSZCa/DVwCH9+vqZp8aZpKEI0kCA08o8 oOrHToHgsLE3l1L68GS9T27G8GbIGWAbQq1IE06a2e6bYRsGlZfNGJEMcoHz/dHM0WEB hExE3ibu56zSf/dUSHzvTVOI4RPLkc27V82jzwUUV/dLqDInlzqqRugvEN1+48NOtBnp PC2hrZwaUp9PFYS9ppf5+pCuDuHg6XWvmNBHHS20peSSXPYa22HyqABOkcRYS0UO+TzW 6r9cotK9F73ZsKVt5eDbiqygfT/P26TIAmQ3DZxS5/acHpQXM/AP7xBmcXiDYDdDt/Ta Whtg== 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=jE25Jwvxv1lQqd9B0PMvAa/3bguXHPwmlQrK/A2JMtE=; fh=JG4AH/5QjmqBTYfdJ6V+SDfDDKJuW7qvp7kg6uYOmXc=; b=wRehaPlvAhRNK2eKwIa05FvJzoHFYhQX6N/S1xMDe/6Wd0aY8jPsCcq83rmJoJHE4D sTQnWhTkuCFRpOChuf+Q+yPD3JjSwxV47YdEf2wD4bWcoVWCzrq2WapBqiZUB065LBBn YaaopVxcci119kxZZLWzI8gFQFs+QLi/qnkHwyvLerEU/r3bdyNauCzpfJTyGMVuP7Tz ZyrWuNKSy8RZgAshPAqEprobuGq+We+ofvsaTipteUZNTSV+HQL/tIaTiD4o59UhMnsj e23ijIuslhYVRO446mi2X7aXkbqSjPp0c/kCgLWwh6+vLZk6Z6TmUzGUI2zwCFVwgvaD RFtQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OK+Wixix; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25d2938bsor430959266b.21.2024.09.13.02.57.01 for (Google Transport Security); Fri, 13 Sep 2024 02:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCX/Z7t5Plz6GDE4tHUPvhm9FiL4V+0KAEcp/pW2PB4hmQTuqiA+uFDf0+pBqVrZBFm/0zhP6E1u0vimhuK8@amarulasolutions.com X-Received: by 2002:a17:906:bc26:b0:a8d:2ec3:94f4 with SMTP id a640c23a62f3a-a902964d007mr497794666b.54.1726221420786; Fri, 13 Sep 2024 02:57:00 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:00 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Alexander Dahl , Ashok Reddy Soma , Eugen Hristev , Igor Prusov , Jan Kiszka , Julien Masson , Lukasz Majewski , Marek Vasut , Mattijs Korpershoek , Sean Anderson , Simon Glass , Tom Rini , Yang Xiwen Subject: [PATCH 01/26] clk: Propagate clk_set_rate() if CLK_SET_PARENT_RATE present for gate and mux Date: Fri, 13 Sep 2024 11:55:43 +0200 Message-ID: <20240913095622.72377-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OK+Wixix; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Gate and mux does not have .set_rate operation, but they could have CLK_SET_PARENT_RATE flag set. In that case it's usually possible to find a parent up the tree which is capable of setting the rate (div, pll, etc). Add clk_generic_set_rate to allow them to trasverse the clock tree. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/clk-gate.c | 1 + drivers/clk/clk-mux.c | 2 +- drivers/clk/clk-uclass.c | 20 ++++++++++++++++++++ drivers/clk/clk.c | 9 +++++++++ include/clk.h | 9 +++++++++ include/linux/clk-provider.h | 1 + 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index bf1c6a93b468..bd0d3d44ac8c 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -115,6 +115,7 @@ const struct clk_ops clk_gate_ops = { .enable = clk_gate_enable, .disable = clk_gate_disable, .get_rate = clk_generic_get_rate, + .set_rate = clk_generic_set_rate, }; struct clk *clk_register_gate(struct device *dev, const char *name, diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 62477e15d27a..4feb8e8c821d 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -150,13 +150,13 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) #else writel(reg, mux->reg); #endif - return 0; } const struct clk_ops clk_mux_ops = { .get_rate = clk_generic_get_rate, .set_parent = clk_mux_set_parent, + .set_rate = clk_generic_set_rate, }; struct clk *clk_hw_register_mux_table(struct device *dev, const char *name, diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 16169dac2340..e8db9b0ff2fd 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -515,6 +515,26 @@ ulong clk_get_parent_rate(struct clk *clk) return pclk->rate; } +ulong clk_set_parent_rate(struct clk *clk, ulong rate) +{ + const struct clk_ops *ops; + struct clk *pclk; + + debug("%s(clk=%p)\n", __func__, clk); + if (!clk_valid(clk)) + return 0; + + pclk = clk_get_parent(clk); + if (IS_ERR(pclk)) + return -ENODEV; + + ops = clk_dev_ops(pclk->dev); + if (!ops->set_rate) + return -ENOSYS; + + return clk_set_rate(pclk, rate); +} + ulong clk_round_rate(struct clk *clk, ulong rate) { const struct clk_ops *ops; diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index b8c2e8d531b9..67c6b23231ff 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -13,6 +13,7 @@ #include #include #include +#include int clk_register(struct clk *clk, const char *drv_name, const char *name, const char *parent_name) @@ -60,6 +61,14 @@ ulong clk_generic_get_rate(struct clk *clk) return clk_get_parent_rate(clk); } +ulong clk_generic_set_rate(struct clk *clk, ulong rate) +{ + if (clk->flags & CLK_SET_RATE_PARENT) + return clk_set_parent_rate(clk, rate); + + return clk_get_parent_rate(clk); +} + const char *clk_hw_get_name(const struct clk *hw) { assert(hw); diff --git a/include/clk.h b/include/clk.h index 045e923a529b..f0fd524ee519 100644 --- a/include/clk.h +++ b/include/clk.h @@ -452,6 +452,15 @@ struct clk *clk_get_parent(struct clk *clk); */ ulong clk_get_parent_rate(struct clk *clk); +/** + * clk_set_parent_rate() - Set parent of current clock rate. + * @clk: A clock struct that was previously successfully requested by + * clk_request/get_by_*(). + * + * Return: clock rate in Hz, or -ve error code. + */ +ulong clk_set_parent_rate(struct clk *clk, ulong rate); + /** * clk_round_rate() - Adjust a rate to the exact rate a clock can provide * @clk: A clock struct that was previously successfully requested by diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 59f9c241b846..459fa2d15ceb 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -253,6 +253,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, const char *clk_hw_get_name(const struct clk *hw); ulong clk_generic_get_rate(struct clk *clk); +ulong clk_generic_set_rate(struct clk *clk, ulong rate); struct clk *dev_get_clk_ptr(struct udevice *dev); From patchwork Fri Sep 13 09:55:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3470 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C10D9412C3 for ; Fri, 13 Sep 2024 11:57:04 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5c4143287d1sf450365a12.1 for ; Fri, 13 Sep 2024 02:57:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221424; cv=pass; d=google.com; s=arc-20240605; b=CDMVKbtSI0oQcqM6vquXLCvNCQk2EFYbpB8TfKWRvFplC6E3tSZsGu8Okyg2JRlQU7 ELbmkY/TXhHzRKmDb+DmzSHl/E5zeR4QnppXQY24cP1VPvLifRYDwvEIwaToq6llZK6d oqpv7IYG4Logtp8TjpbhkDKlvR4gSPOIvjvpWYyADItaVUBL80WBnH3fLwrtWV1SQUfm 72K7UrbXRV6ygNHfVRKoeosztkARMfUoCQk6VlECQL4P09Ic2eSuiLqU+YjOpxlIwuBP T8dOCGbbRHr7BzOY7anx2zl0Chi4N/wdHFT6xPehaedMO2ETnyyLjD20F8BWnWZ8avhy ggsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=6TG0FSuJ/ZlCG6Cih9Nd4JiITRiXYUVbHw41KI5wPSU=; fh=/B+b3rq48suNxwrT2Ix+mn8IujFp63sVCDWOK6/nfcM=; b=hWqLaC8zSEFFVCG/D6dQmlOxVT/mNFges8ItEilHMk7FNr5VncnyccDvbfJ5ksYOut PrhZHkhgq3EwIbEchVvbPAFqh/EFOeo5Xa8GYaSSGnpBpEv6/2Vwu6mabLusYB3yOtnP kIi6Xuumd+qMNvMfVirAkR0+V5nolUbC2o+DTh4ynG7LFeAoVpSd28oSwToPcf4bWm5H 5lveVrxjMQsjx71zgp8FhZieoPE+YDo//0M8pBw8K0Bn8ANDTsqlwM8qEsfMtZlWX+q2 JU/mpizdiCdMA1OQL56CHSQYWtC3UJQtnKlcdqW6vDqelhcj1nHnZjXDmTuq0uwQN1n8 spXw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=G7SXahpl; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221424; x=1726826224; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=6TG0FSuJ/ZlCG6Cih9Nd4JiITRiXYUVbHw41KI5wPSU=; b=TLK5Nzeyu9PTDfCO67tlpzjdemLudfqw5eTGuMpd6z0ziHvknmo0sv1GJ8HDxTAG4S hlMtu+ZM0RSk7QX5XZQnnPd/Xbh1fQrynvzdYQWZEgHoN+0hduHv/r8nZn3xCN7nY7r8 EMJFcnv9/hBDsxfdbDIpWHaHqwPM4Pi21Lwzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221424; x=1726826224; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6TG0FSuJ/ZlCG6Cih9Nd4JiITRiXYUVbHw41KI5wPSU=; b=Xn8PMlMNojTz8eiCM2qdf6SMiTLe7vHWNUaXOZ9kOTXksfdhG9EIL6LB06RYy0WsM2 M7kGJDspnrzYEFlOKc+hsTxq2UBLng/MnRikZ/EQb20F5mC38Dhpt5DRN5mSvblw+Aer 29RMwg+xDfLpU/z+vIU9M61qI7V1UYLNOeLBYMf1BZYGFigvaPdLO+rL/i/t3PqOoSy/ XLtbHaasrrR3gPrj3iemcvYkXwVNS2PWtwdw/wwklOVQ9LZ+HcL2v6f2N/k/lOZfraWm vkUK0mUfnGTnwIHc5ClKdl9gS46EUHoKhwDx/DAW8t2nLxlDB7e/yjijj16oH2uv3nnb KPfw== X-Forwarded-Encrypted: i=2; AJvYcCXG7qnxQSiec1srBqG+a+qjf4yqQg4bK8kfHc5tCuGfpUMHJaS+FcLpU9HmhxmnoTTcalfEz349ZNnBjpj2@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzJF+a5UR0Ysnnou0CfrYJth8kMdvpus+PJ5i41BTY41X7L7jVv ktED7Ego12UuxHteZ2kio6t9CP/iYZBbcPq0THK9t0XOS5gg5kmpWpqGhCO3vi2fXOHH5TnDLA= = X-Google-Smtp-Source: AGHT+IH5bdMfH8DQyknOnDdCd1YoERRdj+y94WNuoUOyGJVS69lUukyYrQsl7/FtU19MxV4rH0Yu3A== X-Received: by 2002:a05:6402:26cb:b0:5c4:23b2:ec35 with SMTP id 4fb4d7f45d1cf-5c423b2ecc4mr282176a12.10.1726221424068; Fri, 13 Sep 2024 02:57:04 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a50:9b57:0:b0:5c4:2438:78d2 with SMTP id 4fb4d7f45d1cf-5c424387a1bls16091a12.2.-pod-prod-04-eu; Fri, 13 Sep 2024 02:57:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWfq7NncrFMr1KDm4CcL71jV7QF38gcLMDjJwhnZdF24YdkwXesMKciANVcsoRHIDQv8g/31C2LSvWbRYvy@amarulasolutions.com X-Received: by 2002:a17:906:6a0b:b0:a8d:2ab2:c9a0 with SMTP id a640c23a62f3a-a904814cbe4mr151271766b.53.1726221422525; Fri, 13 Sep 2024 02:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221422; cv=none; d=google.com; s=arc-20160816; b=Q/k6X+MeMm9azLJfwTTSjPE0aNuwmLf1lPPCZwZUlZs4RTjulws9siOpj+hfSJmN0g nFgR265oVkRu4oDTYF6OnBP3/bZFg9XhhaXa4eWwOM+XoGwNQ6MEcit6VXkcUKYZct0N K9mmrbP1s2QJGvXdB7nNH4Q6VbBQasM+gSP0EfIyFFULVYPubOWGc3OxiSZHixZ4b1OU n2w6p9Io1cH2pVHnW7aChOXWsu1JgOJAGUO9lTTlgn/eSp9KiRH+GeC8og9f8SooAZOM HP+q9lu8uTp4HTZ873IH19L2rmJMJd/Fcytf11yzGwf2qdH3rKbJf1P2Bqci+u5tHZUx EdxA== 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=YX5eqLwY3E1X9i2vX7+YausFj30i2Y01yBnLyTg+prA=; fh=DGDdkrTUanEiVdp/0bN1mhbwPWe+k5TrzV1D7eR/r/o=; b=IWfIla0s+IIYlwGiyNgD4WymvcBWsKgcbZxiofubmHZ2fEL9tu6dBofV3RFPpLbs8J taZStF1x0ikFgeBUsOJ5vkBu5KUmko91UGv51TK+mDEsPj+398WROsqXF723yU57ANKi yK+0cpDBzOPDslmOJkyMUFdPogr7V2rFHd155Hhe8v5S7xPiy6gz5649L8MBafOTeo3P DguI2+RwzfLv9gnhL679FaN30syHWJ9DsmgjPge3iphOb6HDqgSaUKsDYiFRHPZdYo+c dwTZeSoICxKBVg47G/aqj4/+sRdwIC98dVdl6XSbUEDJwIfAHtXY+f42d96vKyR0JlNz qQKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=G7SXahpl; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25ccab27sor430277466b.19.2024.09.13.02.57.02 for (Google Transport Security); Fri, 13 Sep 2024 02:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWx/eRBME5J0d2R00824wL44rdO/yI/5zfJdtP7AoZd9gS9hBiA9/NqNWsjxkARjcG4aH1IDxAqOBfeUtN0@amarulasolutions.com X-Received: by 2002:a17:907:7f8a:b0:a8a:572c:709f with SMTP id a640c23a62f3a-a9047b4815emr154574166b.5.1726221421922; Fri, 13 Sep 2024 02:57:01 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:01 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Fabio Estevam , Hou Zhiqiang , Lukasz Majewski , Nicolas Heemeryck , Sean Anderson , Tom Rini Subject: [PATCH 02/26] clk: imx8mn: Prevent clock critical path from disabling during reparent and set_rate Date: Fri, 13 Sep 2024 11:55:44 +0200 Message-ID: <20240913095622.72377-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=G7SXahpl; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi This commit ensures that critical clock paths are not disabled during reparent and set_rate operations within the clock framework, paving the way for the inclusion of new features. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk-imx8mn.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 125215e84f41..c96a2ebaa19a 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -29,10 +29,19 @@ static const char * const imx8mn_a53_sels[] = {"clock-osc-24m", "arm_pll_out", " "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", "audio_pll1_out", "sys_pll3_out", }; +static const char * const imx8mn_noc_sels[] = {"osc_24m", "sys_pll1_800m", "sys_pll3_out", + "sys_pll2_1000m", "sys_pll2_500m", "audio_pll1_out", + "video_pll_out", "audio_pll2_out", }; + static const char * const imx8mn_ahb_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_800m", "sys_pll1_400m", "sys_pll2_125m", "sys_pll3_out", "audio_pll1_out", "video_pll_out", }; +static const char * const imx8mn_main_axi_sels[] = {"osc_24m", "sys_pll2_333m", "sys_pll1_800m", + "sys_pll2_250m", "sys_pll2_1000m", + "audio_pll1_out", "video_pll_out", + "sys_pll1_100m",}; + static const char * const imx8mn_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_250m", "sys_pll2_200m", "audio_pll1_out", "video_pll_out", "sys_pll3_out", }; @@ -67,6 +76,9 @@ static const char * const imx8mn_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400 "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mn_gic_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll1_800m", "clk_ext2", + "clk_ext4", "audio_pll2_out" }; #if CONFIG_IS_ENABLED(DM_SPI) static const char * const imx8mn_ecspi1_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out", @@ -286,15 +298,18 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_CLK_IPG_ROOT, imx_clk_divider2("ipg_root", "ahb", base + 0x9080, 0, 1)); + /* BUS */ + clk_dm(IMX8MN_CLK_MAIN_AXI, + imx8m_clk_composite_critical("main_axi", imx8mn_main_axi_sels, base + 0x8800)); clk_dm(IMX8MN_CLK_ENET_AXI, - imx8m_clk_composite("enet_axi", imx8mn_enet_axi_sels, - base + 0x8880)); + imx8m_clk_composite("enet_axi", imx8mn_enet_axi_sels, base + 0x8880)); clk_dm(IMX8MN_CLK_NAND_USDHC_BUS, - imx8m_clk_composite_critical("nand_usdhc_bus", - imx8mn_nand_usdhc_sels, + imx8m_clk_composite_critical("nand_usdhc_bus", imx8mn_nand_usdhc_sels, base + 0x8900)); clk_dm(IMX8MN_CLK_USB_BUS, imx8m_clk_composite("usb_bus", imx8mn_usb_bus_sels, base + 0x8b80)); + clk_dm(IMX8MN_CLK_NOC, + imx8m_clk_composite_critical("noc", imx8mn_noc_sels, base + 0x8d00)); /* IP */ clk_dm(IMX8MN_CLK_USDHC1, @@ -389,7 +404,8 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_CLK_PWM4_ROOT, imx_clk_gate4("pwm4_root_clk", "pwm4", base + 0x42b0, 0)); #endif - + clk_dm(IMX8MN_CLK_GIC, + imx8m_clk_composite_critical("gic", imx8mn_gic_sels, base + 0xb200)); #if CONFIG_IS_ENABLED(DM_SPI) clk_dm(IMX8MN_CLK_ECSPI1, imx8m_clk_composite("ecspi1", imx8mn_ecspi1_sels, base + 0xb280)); From patchwork Fri Sep 13 09:55:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3471 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5467A411AB for ; Fri, 13 Sep 2024 11:57:06 +0200 (CEST) Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2f760cbd9desf15614621fa.0 for ; Fri, 13 Sep 2024 02:57:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221425; cv=pass; d=google.com; s=arc-20240605; b=dztNHERahy5ftLeQopVfy4Pb6dAumcBIYGHi4HhM0lveO4tGZM4ryYEVa1sxmtjX6+ m3c8A6m5DbIC6jJs59egxZGn1XJ2txb4nW4DiaFQQSabi8jq6VyGStF0XK9rWFReMmOB eg6ttGnt9+tzqYkBJE5kaYXALjINTY/apygvQK8PaVGH2OoRyK+hpw05kZjliEpEMwtL tLJt2/PxB4LYT8NKOuibO9hhLbln6Vt/VfNVm2EzZLSu88vr+eeTL/9+rDTSKjriP5Hr F6FsJNv0lBQvgeeCUAD4edRGeXY0k1ep2yuvBVfcij2vO6Eeh1MCq0lLzODfgp8Mf4Vc Y0Kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=ppvup/Czz8fQ0eR3vbloJI/90ot3sAybYlGgF0ba0oI=; fh=0YXpq982Jrmyc5+1MxcT7DFpAnGANunpSYgClPt9g5Q=; b=c8v/l1oSHSG4n+XdNQN34eu8QJCP9Q+GQGRy8opmRKvmIApPVuoqnooWohV3mnVVYK yA9/K7vOgyCW40V108aZkt6io3Ut/cUHcBmLqqvYGTMauAUSoPfxlO7w35cfbFqIWH66 3ibEKvaVdc57FEiwQ1mYyA03NsoabqhHBJTTPA01GTiPouvbE54X0YW5T1OfUgV65mvW +XAW4GCGggKVXzcVCGevJthm14DdtuRdqQNxwzBIwNj6kHalzAOBthISGMlNa6w8GaBd G47csOOYD7DCpWDDIHzslTUditC8FtXZ1SqXzIlmEY2FAYIz90iBjlmU0XD82iQ7ZHrl vjZg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="SY/Pw8TQ"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221425; x=1726826225; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ppvup/Czz8fQ0eR3vbloJI/90ot3sAybYlGgF0ba0oI=; b=hySAJy1xonvVMSJ8qUrtrFHd3S4G5AFAZJYJV0vgyrLMwNxCqRpiMYQ9n2Ysw8SaCz kpKT0ivZ4u/gZcFG/6foIu1/2YMkPSQp5+Xn83ZBDdfcGFH5IYlPImxd5vSTXVvyYiYf Ce0VdnOkE/KvMFEVKJ52lHUzRm1eTNZbIBPF0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221425; x=1726826225; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ppvup/Czz8fQ0eR3vbloJI/90ot3sAybYlGgF0ba0oI=; b=RhkVQsOCm5IscwCEPEucRNqEAk+l2K4wVw753gAHguQPXNxpI3geuPQjqG9Rrw45xN nYpD9FQQzLZ05m4sXIer+vZXgv1zuU5FZKYFC+x1uki4LM6XlFgbxb09g3IhLzeFmjFF Awld24d9zfRvY9cfXBY7fKf6UIZHkvqcRe9HVZkrepBvFWo/2lu9bE29+w2L2RDvrZOz iUTgwLy6tjv0C198cCrCw/JCuPRj4Aq5uBQtlm/sH7fPE+1PKx3I3uj974UYIWcumoWb GUaA4t3y1GgtN6snEmP8LS9Vfnq69C/hwGZreLystdo42pUMJbGkAgyI/z2mC3hClnZJ 7g7Q== X-Forwarded-Encrypted: i=2; AJvYcCUUAX5g/xXtVLeR5HK7R4XY0VjaTAldLFasZXLe4A3G+p0u3Nyak6fUwaki6LX/+u3szvC/ZlKq8ePq1mpc@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxHCX2rnxhdd/hRCeS3pSACfzaHzqbrbIeOcmaYXvVnPep/aq5/ fMjU29FwY2+HYap2bxzmAbJEblnb3aaKPqVeUMM52CAPcd9Yq2iG4UNHTexG/Di5FQ== X-Google-Smtp-Source: AGHT+IFKJIrp9wxQl+fvxUb94TjGhDOm2qlMe2MzjukKPJTVARY1M6mYZv/l5HFTcwYYw4i8eJIN1Q== X-Received: by 2002:a05:6512:3c9c:b0:530:daaa:271c with SMTP id 2adb3069b0e04-53678fba2damr3519157e87.16.1726221425435; Fri, 13 Sep 2024 02:57:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:3d93:b0:52c:e511:acdf with SMTP id 2adb3069b0e04-53678e09181ls915000e87.0.-pod-prod-08-eu; Fri, 13 Sep 2024 02:57:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWCuW5jakumPmHLDO3uDUL8EDVUnL4DL+0Gl5E+fjLXpIlD3hoSu5Qvtu4pKzt9veAqRapJYDH2xb3upaaD@amarulasolutions.com X-Received: by 2002:a05:6512:1106:b0:536:53dd:6584 with SMTP id 2adb3069b0e04-53678fc99aamr3501244e87.34.1726221423594; Fri, 13 Sep 2024 02:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221423; cv=none; d=google.com; s=arc-20160816; b=kxHHXGudWQld9oconq+oF+tFATDAd0Vw3tHrZbAf8UgANLp+FxqH8h/1+4L3dExFkd pFy2suwJvguGa/mq7Fv5gYpHLjdNpuwvDjHqM0vT5IqStbHoEntUZf+sP0xODEyXI+vh FnJQlGjik0S1fmMnDF01EXi1nfB+qG4PeKDD/WwBvOoIN0PfaEtRy+re38vlXDeEEuJx mgiHpcZtvHzjRSMWXR279l3ioeSKOE2ypGfOQlg/Be3FU0EqxnBJ1eGYXq3Euuvdk/J0 FDjKLbw0JbJjMvhcYe9YZlq4twDnCXe0AhCyBAK9L5nnPtFQFOIY/ZADsSdKFus2/EVG Rd6g== 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=PyaFmNCSWcMYfKku/Mr27YgQakO6Oi+2kFb/osBneFg=; fh=VTNuctJIBBgGnWi05TMBjvOYXhgI7DJEqtz/RAL3S8E=; b=zXI6upSzxF9RXvGEziX6hAOWVCFafMnj+oqeKHYgQ5PdtBc9dBDbzsRQRgQdVxzSPY nhwDKORzg2hGMISDy1r6ajPws4GlvE3NvrmMVlhxrnlpj1k/bDo7b2L7B1Mgvut6pDy+ Msv8ATrEc+rKcPmfcG9FveC0O+O9kKpSLuIep3xs02ae69jcfSgfQcTjt3p0/OgeJZxT UbiMI7CnjyPLsvjYZQAUdvAuXOtS1B7Y6Ipde6LGwgljb1jRnW4Tp6c9ONt8/Ssrk2Np 3mW+z684E1N2tzF12qkcJUKdg7qFw6tQZQh/7i22FTLVpfe0xoYvFItm9Lhl6HgjIhmM JnXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="SY/Pw8TQ"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25045a4fsor523123866b.0.2024.09.13.02.57.03 for (Google Transport Security); Fri, 13 Sep 2024 02:57:03 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVTzdNWnoCfjCi1rnrFVkBckjZKnybnV2lMfOnjpKJLW6aHNwOQ5RziUocGsOgve7DARogU7/NcpZyrx0Gv@amarulasolutions.com X-Received: by 2002:a17:907:c7c4:b0:a86:7021:1368 with SMTP id a640c23a62f3a-a9029434ca4mr601239966b.21.1726221423050; Fri, 13 Sep 2024 02:57:03 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:02 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Hou Zhiqiang , Lukasz Majewski , Marek Vasut , Sean Anderson , Tim Harvey , Tom Rini Subject: [PATCH 03/26] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Fri, 13 Sep 2024 11:55:45 +0200 Message-ID: <20240913095622.72377-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="SY/Pw8TQ"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi This commit ensures that critical clock paths are not disabled during reparent and set_rate operations within the clock framework, paving the way for the inclusion of new features. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk-imx8mm.c | 64 +++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c index a91c6767fac5..432348a15cad 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -27,11 +27,25 @@ static const char * const imx8mm_a53_sels[] = {"clock-osc-24m", "arm_pll_out", " "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", "audio_pll1_out", "sys_pll3_out", }; +#ifndef CONFIG_SPL_BUILD +static const char * const imx8mm_noc_sels[] = {"clock-osc-24m", "sys_pll1_800m", "sys_pll3_out", + "sys_pll2_1000m", "sys_pll2_500m", "audio_pll1_out", + "video_pll1_out", "audio_pll2_out", }; + +static const char * const imx8mm_noc_apb_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll3_out", + "sys_pll2_333m", "sys_pll2_200m", + "sys_pll1_800m", "audio_pll1_out", + "video_pll1_out", }; + static const char * const imx8mm_ahb_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_800m", "sys_pll1_400m", "sys_pll2_125m", "sys_pll3_out", "audio_pll1_out", "video_pll1_out", }; -#ifndef CONFIG_SPL_BUILD +static const char * const imx8mm_main_axi_sels[] = {"clock-osc-24m", "sys_pll2_333m", + "sys_pll1_800m", "sys_pll2_250m", + "sys_pll2_1000m", "audio_pll1_out", + "video_pll1_out", "sys_pll1_100m",}; + static const char * const imx8mm_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_250m", "sys_pll2_200m", "audio_pll1_out", "video_pll1_out", "sys_pll3_out", }; @@ -47,6 +61,11 @@ static const char * const imx8mm_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2 static const char * const imx8mm_enet_phy_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", "sys_pll2_200m", "sys_pll2_500m", "video_pll1_out", "audio_pll2_out", }; + +static const char * const imx8mm_dram_apb_sels[] = {"clock-osc-24m", "sys_pll2_200m", + "sys_pll1_40m", "sys_pll1_160m", + "sys_pll1_800m", "sys_pll3_out", + "sys_pll2_250m", "audio_pll2_out", }; #endif static const char * const imx8mm_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", @@ -82,8 +101,9 @@ static const char * const imx8mm_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m" "audio_pll2_out", "sys_pll1_133m", }; #if CONFIG_IS_ENABLED(PCIE_DW_IMX) -static const char * const imx8mm_pcie1_ctrl_sels[] = {"clock-osc-24m", "sys_pll2_250m", "sys_pll2_200m", - "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_500m", +static const char * const imx8mm_pcie1_ctrl_sels[] = {"clock-osc-24m", "sys_pll2_250m", + "sys_pll2_200m", "sys_pll1_266m", + "sys_pll1_800m", "sys_pll2_500m", "sys_pll2_333m", "sys_pll3_out", }; static const char * const imx8mm_pcie1_phy_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll2_500m", @@ -135,6 +155,10 @@ static const char * const imx8mm_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_10 "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; +static const char * const imx8mm_gic_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll1_800m", "clk_ext2", + "clk_ext4", "audio_pll2_out" }; + #if CONFIG_IS_ENABLED(DM_SPI) static const char * const imx8mm_ecspi1_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out", @@ -283,18 +307,34 @@ static int imx8mm_clk_probe(struct udevice *dev) imx_clk_divider2("arm_a53_div", "arm_a53_cg", base + 0x8000, 0, 3)); - clk_dm(IMX8MM_CLK_AHB, - imx8m_clk_composite_critical("ahb", imx8mm_ahb_sels, - base + 0x9000)); clk_dm(IMX8MM_CLK_IPG_ROOT, imx_clk_divider2("ipg_root", "ahb", base + 0x9080, 0, 1)); +#ifndef CONFIG_SPL_BUILD + /* BUS */ + clk_dm(IMX8MM_CLK_MAIN_AXI, + imx8m_clk_composite_critical("main_axi", + imx8mm_main_axi_sels, base + 0x8800)); + clk_dm(IMX8MM_CLK_ENET_AXI, + imx8m_clk_composite("enet_axi", imx8mm_enet_axi_sels, base + 0x8880)); + clk_dm(IMX8MM_CLK_NOC, + imx8m_clk_composite_critical("noc", imx8mm_noc_sels, base + 0x8d00)); + clk_dm(IMX8MM_CLK_NOC_APB, + imx8m_clk_composite_critical("noc_apb", imx8mm_noc_apb_sels, + base + 0x8d80)); + clk_dm(IMX8MM_CLK_AHB, + imx8m_clk_composite_critical("ahb", imx8mm_ahb_sels, base + 0x9000)); + clk_dm(IMX8MM_CLK_DRAM_APB, + imx8m_clk_composite_critical("dram_apb", imx8mm_dram_apb_sels, + base + 0xa080)); +#endif + clk_dm(IMX8MM_CLK_NAND_USDHC_BUS, - imx8m_clk_composite_critical("nand_usdhc_bus", - imx8mm_nand_usdhc_sels, + imx8m_clk_composite_critical("nand_usdhc_bus", imx8mm_nand_usdhc_sels, base + 0x8900)); + clk_dm(IMX8MM_CLK_USB_BUS, - imx8m_clk_composite("usb_bus", imx8mm_usb_bus_sels, base + 0x8b80)); + imx8m_clk_composite("usb_bus", imx8mm_usb_bus_sels, base + 0x8b80)); /* IP */ #if CONFIG_IS_ENABLED(PCIE_DW_IMX) @@ -358,9 +398,6 @@ static int imx8mm_clk_probe(struct udevice *dev) /* clks not needed in SPL stage */ #ifndef CONFIG_SPL_BUILD - clk_dm(IMX8MM_CLK_ENET_AXI, - imx8m_clk_composite("enet_axi", imx8mm_enet_axi_sels, - base + 0x8880)); clk_dm(IMX8MM_CLK_ENET_REF, imx8m_clk_composite("enet_ref", imx8mm_enet_ref_sels, base + 0xa980)); @@ -396,6 +433,9 @@ static int imx8mm_clk_probe(struct udevice *dev) imx_clk_gate4("pcie1_root_clk", "pcie1_ctrl", base + 0x4250, 0)); #endif + clk_dm(IMX8MM_CLK_GIC, + imx8m_clk_composite_critical("gic", imx8mm_gic_sels, base + 0xb200)); + #if CONFIG_IS_ENABLED(DM_SPI) clk_dm(IMX8MM_CLK_ECSPI1, imx8m_clk_composite("ecspi1", imx8mm_ecspi1_sels, base + 0xb280)); From patchwork Fri Sep 13 09:55:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3472 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3336941280 for ; Fri, 13 Sep 2024 11:57:07 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5c2483adeeasf402114a12.1 for ; Fri, 13 Sep 2024 02:57:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221427; cv=pass; d=google.com; s=arc-20240605; b=L4mRbsn9Ud3EnOvXievBN3hWaVVYlPZrkpF/h2ZVH48PfuPv+Vq5bjsQTEBfwOn3Yz LZcOElkcU36beIIqdlaUD8u8T9wIf6yEo1lUJWEp/1/PWV3g30L0Njg+K53REUGDY5Dh hfFXKNkz48JsQekaMausptnAQu6pWvH8zT2xl73OxKaMER2NR/m0yQTG/LNyj31ufqVx AX7O0KLgN2xqJr9sx5tPdsQ8+K4vVcNwD42NK75h3yFOWRwnhEvOxCZefhgq/qkVhqYg pAjp6vtOMpw0RkPjaZM+1sQCAM8tPyrRDgZMd6CBatKbmdQfNK0uCAG1cGBXbQN6Vvga /Dtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=fZIwj3jt3oMrXU07Zq48yDI5uQ+ZJLXFK6HeytY1BvI=; fh=kU5w7wtY5geboDSdi6POmZL/SeRPWXeAvLwf6ogtb9U=; b=lgHW3tXcIR1m//ls/e7dEc540J+8IQS2HvdhE1RDEr+kCib6kxUnK/zicxnNyUuZEm SlHHXlWjPYZl0YPgkUzFlWFs/mxbpstdaTK8Jjo/YVfY5/wszf0dipEwti7fLCx9oE1K WSpjSgXG4FaZujk0535UsMjy2un7kieDMtDT+SMiiPbV+mDxl7r2zZORpmv8BoUtSim0 PlXbECr2gJxip25Av3tkGe5w7dvTbZ4/g/VgdPwpBYysDxZ88BPdWg9KcJsZlX7i03Np ceQV43/xQLrJervdMw2ZOVdw7LunxlQcUhRWJIgBIozwopclvvqyxGRM2WP4CBDN4fss qobw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BKXOeLKu; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221427; x=1726826227; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=fZIwj3jt3oMrXU07Zq48yDI5uQ+ZJLXFK6HeytY1BvI=; b=adxr+RtohWpzwcMCqCX+6BCpCvi9XAYtc2zXsPQq7VxDAtJXYb8hYt7mgD9DwgPBYJ +cQ2AKp3W6s5sQ4UmGvHJGESdZKthrs0B78vWi+YyVEEcUwRT8GPOCZWmO3EKQ0SmkZ3 NW+mEBbjDRmoVvfnccSHJZqpO+vTB71wKRBqg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221427; x=1726826227; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fZIwj3jt3oMrXU07Zq48yDI5uQ+ZJLXFK6HeytY1BvI=; b=mfTFuntK2sXRH5CCaDSc2gwvc4fXnpvxJFLcmdfqxZmr/zlyDYLfkWHALWn9UGzobF fI+GXoWVkxTJSc3SIceNpM+8Zi8NQjQu8Uc5SzVeMRy9H5ueSRAsB6QvZGprZTcReQTM xHbdRjQpe7v2YalItZhg2aP3Z10Bguh7QiPy/l/CRncXZIT+6ptqfBxdSa9djBPOmUet l1PIchK74a0IGelXKDHFinkisa++qoEK4oPtA5jNZMM3INa0iOSBmZoJsl9zrGnYsa0r 2hGI6TtvqS+wvFd14MXID7nzuyN8JSu/lz4otKIi4CRr1saMN6FH9zhJk7bNimzR+BmI cH/A== X-Forwarded-Encrypted: i=2; AJvYcCVN1c316INqMukFWQvlBw48CwgmsRAABIHU9T3GLRu2saZcPlr6fFC7oumljvaXQSEpNo0N5B+zRkz16iJO@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yzu6q4kR0cqD248yjemTPktyEBesLwIyTbTRGw4kVW+ZrTyE1y6 xPQDoyLRU9phepmLoVYJgVIHGBXhnMLKAyXjsEQi8AbIzHRrwJIB1kXv7boobTWiDQ== X-Google-Smtp-Source: AGHT+IHQxFVBOnrEaeOo8KKpNuOlw16fv+CjVm1ku74+7jpZwnEiWq1XYQ+nmgzFmRNAIG1MpOnuew== X-Received: by 2002:a05:6402:27ca:b0:5c4:13c7:971c with SMTP id 4fb4d7f45d1cf-5c413c7979emr6032092a12.12.1726221426618; Fri, 13 Sep 2024 02:57:06 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:524b:b0:5c2:2b24:94d3 with SMTP id 4fb4d7f45d1cf-5c413e2627cls3820a12.0.-pod-prod-00-eu; Fri, 13 Sep 2024 02:57:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsXaNhOmy488X/EVOhlMCHIT9jhTsaVDjVyCN6YqS2n/ccmD6FWNar9e1e7Pmg7C8bEDdfY6PmrABLlxKw@amarulasolutions.com X-Received: by 2002:a17:907:869f:b0:a8d:55e1:a653 with SMTP id a640c23a62f3a-a8ffab6fb3cmr1086871866b.13.1726221424935; Fri, 13 Sep 2024 02:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221424; cv=none; d=google.com; s=arc-20160816; b=C8ZE0nitHe+SmuOnSi53IFNMu+PiwjECYaOfpgcTKTlY2XNdGcUy0Y7DSH3fxmgYan KzsTQFB9K2VAnQrfICogX0NbqmtqhBFP1FHqTi+YcTB470wb6jAlpNWhVZooOwugAA3K uI81m2ps994BkO4qkp7W9jkmo1EH42+uAOOlgerdvRIFvheMc2aqebSt09l9VDUTRmpf bBWQBaWTyeiCuwGDFrrq5sMYjeJ3LzUAM18WIYMiRqesjdck8G2qaWRWN3H8exxzve6J aMizScEsktqXlyuUIP0v823tCOYSa5UgRGoKZRGi6M/6fdJNNVQvnoLAuTWAnPqv8eaJ h7VQ== 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=o+wxQULqTeVZWboi9dNaAJm4xPm5Im/JzcL1kgm415c=; fh=JQh9fXFBwH4EtdSOCpYvBI9pVf0xuMetat1tXB9A4ko=; b=ROkLKFG7qGXMtgU3g5udF2+SIgr+FV5b3MHadDxpsyrIxfAL8qNx21pW7BcY2qkw4i d4uL4ModweC8cBjLkuYnGU3JMDbDpYnOI1CC9gFUYcQP7A3SaKZYTmAGMswzCoQGD+ic j2IGIo+JgOsVW6a7UzHNehOjlavFCk4vfolppGndwgeLTbxPUm3He4I0/8pJzqj32o3v 4wb/qDTnUBUuu+Iv24GJqcJFrMGDi2xPumJ4pClLEfBb0GHzCnY0Y+fgg/rVSQu6KrYn zr1OG0plclzZ5bLywCbqGvkNDAVySEe/AWCUdgtih/R0zdJANxXtQKzT5/ohYH5d0mG7 /Fpw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BKXOeLKu; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a9047750edbsor60517666b.5.2024.09.13.02.57.04 for (Google Transport Security); Fri, 13 Sep 2024 02:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWfsEFJZCThHowqyup/Vo+aJeWtClKj5LqPIWauXxenX0DtzOIlH84obbn3KdujfppkPMNjfO19iiNTtFgo@amarulasolutions.com X-Received: by 2002:a17:907:1c1b:b0:a8d:4e69:4030 with SMTP id a640c23a62f3a-a8ffabc2359mr1172142966b.19.1726221424382; Fri, 13 Sep 2024 02:57:04 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:04 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Ashok Reddy Soma , Eugen Hristev , Julien Masson , Lukasz Majewski , Maksim Kiselev , Mattijs Korpershoek , Sam Protsenko , Sean Anderson , Tom Rini Subject: [PATCH 04/26] clk: clk-uclass: Implement CLK_OPS_PARENT_ENABLE Date: Fri, 13 Sep 2024 11:55:46 +0200 Message-ID: <20240913095622.72377-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BKXOeLKu; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi There are scenario that we need to enable the new parent clock before reparent, or we need to do the same with clk_set_rate. The patch cover those scenario Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/clk-uclass.c | 47 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index e8db9b0ff2fd..b571a3620222 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -582,7 +582,9 @@ static void clk_clean_rate_cache(struct clk *clk) ulong clk_set_rate(struct clk *clk, ulong rate) { const struct clk_ops *ops; + struct clk *pclk; struct clk *clkp; + ulong ret; debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate); if (!clk_valid(clk)) @@ -597,11 +599,37 @@ ulong clk_set_rate(struct clk *clk, ulong rate) /* Clean up cached rates for us and all child clocks */ clk_clean_rate_cache(clkp); - return ops->set_rate(clk, rate); + if (clk->flags & CLK_SET_RATE_UNGATE) { + ret = clk_enable(clk); + if (ret) + return ret; + } + + pclk = clk_get_parent(clk); + if (pclk) { + if (clk->flags & CLK_OPS_PARENT_ENABLE) { + ret = clk_enable(pclk); + if (ret) + goto out; + } + } + + ret = ops->set_rate(clk, rate); + + if (pclk && clk->flags & CLK_OPS_PARENT_ENABLE) + clk_disable(pclk); + +out: + if (clk->flags & CLK_SET_RATE_UNGATE) + clk_disable(clk); + + return ret; } int clk_set_parent(struct clk *clk, struct clk *parent) { + struct clk *old_parent; + const struct clk_ops *ops; int ret; @@ -613,6 +641,15 @@ int clk_set_parent(struct clk *clk, struct clk *parent) if (!ops->set_parent) return -ENOSYS; + if (clk->enable_count) + clk_enable(parent); + + old_parent = clk_get_parent(clk); + if (clk->flags & CLK_OPS_PARENT_ENABLE) { + clk_enable(old_parent); + clk_enable(parent); + } + ret = ops->set_parent(clk, parent); if (ret) return ret; @@ -620,6 +657,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent) if (CONFIG_IS_ENABLED(CLK_CCF)) ret = device_reparent(clk->dev, parent->dev); + if (clk->flags & CLK_OPS_PARENT_ENABLE) { + clk_disable(parent); + clk_disable(old_parent); + } + + if (clk->enable_count) + clk_disable(old_parent); + return ret; } From patchwork Fri Sep 13 09:55:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3473 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 18BCA412D2 for ; Fri, 13 Sep 2024 11:57:08 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5c24e546f3fsf1064813a12.1 for ; Fri, 13 Sep 2024 02:57:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221428; cv=pass; d=google.com; s=arc-20240605; b=JkC0lxYCrIxyps3WjiprZtdnoLYm7//oXdv0sAzN7OkM0afCNE/nseTJ09xMQjIvqQ W9xIKLbBC7jTOyUZU+zj+BhoOJexli1U2611M+SVNBLrFGlK6a1CUu9JF43KMKSKImZP mrfwZUmwey3QTODctGmxDGX34JwoaQSAH3zzIsKhABNGYlYXLX45n5oBhwvPALx3ezi/ 79NhihcO8ONEDUeAcMozMtYoGb2x8dsuyv2HbM7dKSWx5nSsBcPzMYRSSYKG0+lQq4FK 0R80W8xXIULfuLjrmv5oBEpUr6gGEolJhFJeSokGvkukxGjHM0YY/javXMVyhN50k9bn tBvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=Gpbut0KAPN9OcoWJIqzfgCoNbwKHXJxIxCnu/prRtVU=; fh=l2NtubBxusUxLYUUrrU98d81tjOJOb20ZOJgvBZZCjE=; b=SzBk1WLQ0VAfvBxym0Mc+BQ+kCFMcfcUwFvrdd5L3q7swYtcrVxLfJOcAQ8Z8f9l+B cmH9Yja3whKp+I9Jw3prGZ4bWwz+6gWipZc8YUIIHMC+qMnvlI+shPn3U/EWPmQSXYR6 LWpWayH3c3t0fn5iecaEZSWfVkBSXRXEDakn/CcOVEPAcGR+2DsJWpoOPfAgVS69z6vn 6wOLYtaPONIcsNagAkjYhoZ/5xkV1md5E46oDG/C/OaS3sOraYUT4+0xGIchwC+CUWEx BuRD77WCUr80bijKS+N6dklbJWCqGnK+es4R2xYV+wj7BQzuFiHDslE31eQHffPxSAKq X6+w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TryMknPD; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221428; x=1726826228; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Gpbut0KAPN9OcoWJIqzfgCoNbwKHXJxIxCnu/prRtVU=; b=XAttGzqOghLg5hPg331eurvhib7WPEq74Wn+dtqZvk7UB9g8O/baX26PXeLsEEOE4i BiJkEjKCfHfcavwNVOMlwePm1bAAwV4r8tlsPAOSG1wQGTi8zalgR8gT4owXyV7PwzzE sL65OH92VHJbJfbuBEfp8Wj31xV57+bkv5/OI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221428; x=1726826228; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Gpbut0KAPN9OcoWJIqzfgCoNbwKHXJxIxCnu/prRtVU=; b=G8OHYwuMSwEibaKXyT1nU7cdMINwKjPSsf2WA99NJwsZqxcQ6DgmtrOIK+2t4fQdIW +59fqYZRN49FGt29PebvbFO1dsDPrqFkZ7OtXY0GpImM2Q/9f8kKphXNPCG0myx6mv37 0Ly5arxFRyGqfxzTLlYrqOfCVZDuklutM/N4sElw6SEQkD2+sKfYEIbvKzvw8cb2O04h 6SkDPx+U2f1igK/wAwT5HuMDSvRuQJ8IxlOdY1w1Ip9NlIzRLAcF3zAGmaal46ka5otf Z4+djyel5IIWB8emSlXSujWLKOKCZShuKaRtZ8ONxCIaALx+H5UJusl3ywkY/PpoJKzS in9w== X-Forwarded-Encrypted: i=2; AJvYcCWUPIdyYzieQiF98wztLQFwUONwSarOmkP/Iw0KBXzjt1S7kGmlf8V7bDEb+/q9GpDlO7LJ4e4LP9xMCrs7@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yz+1VHNmZMSTO7xAvuQq5N794psEH1+dXh1jCV6QTvTXiiRo989 Rr252ud+bK4cJKVwU0PUcu9PaaOpgRtmxWDaVM7WR3JR3wpTk/Yn1RjE1AUSxsoJUg== X-Google-Smtp-Source: AGHT+IEXp1WaU1KmnvJe/kGLKoZluFujGhvlVmljObZZ0iZA2yzytgPyJ4ATlfYNK3n02yZmICv19A== X-Received: by 2002:a05:6402:1e8a:b0:5c2:6311:844f with SMTP id 4fb4d7f45d1cf-5c413e1fd9cmr4091613a12.17.1726221427687; Fri, 13 Sep 2024 02:57:07 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2552:b0:5be:ef89:e79e with SMTP id 4fb4d7f45d1cf-5c41408cb34ls73946a12.2.-pod-prod-02-eu; Fri, 13 Sep 2024 02:57:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVveKAplEZHIQ9TAA4+rFA6dl8b1FrqCaGfjN7Fh/4yLmTspYXNqBd2GxbTj6AkeqwHxJjBzncMPFSWgeCV@amarulasolutions.com X-Received: by 2002:a17:906:d7dd:b0:a7a:b4bd:d0eb with SMTP id a640c23a62f3a-a902944e611mr506683266b.24.1726221426107; Fri, 13 Sep 2024 02:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221426; cv=none; d=google.com; s=arc-20160816; b=i3159BosnO0E4dw31VbFVvRVgrRYC+k47Nn9hPkFrvcVQSqVyMWXhiMJvaDQi1PE+s uDmY1Zdmz/TDdiOeofiCWgDSX0BUyqjFMHCeI1Eh3Wg2FVZpiqEK5UNmajN2gnig1QTB 0fZBFuZHKVy70b0ogT0IlwZVOAaofD9ppDbpGty6NYc+f4olmv5e7FqVHGWqC+iJJhXK uinddqu5VybvL0H7vSIU/xm03KXCVe7JhSRT9VMC+iezR0NxSelvtZ/lf7x8avAZPnQq kWvZ6kIKVpBmaKpmCLDSgntIVYnn3ZOVDElBC6ShEntdwNbatMuroOACwv228J/k48a4 HC5g== 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=DayMO+BG8fGqGpPxigAvYP6Gde782r5ZKw0Wsq4LiYs=; fh=wMsQUoyFwHXRmGXtS5+PYZfeGnrLkFxE2NXaPaknLRU=; b=LJFAHjNdqcMJsVRF2BOtUCmyk4E5bJQq/EmEV/XX1GYvIdsRK3DHMDybJgYDYPIk4w IxOAIgVl/yjug6Dry6ARaDehkgdBOnqZeIyz/XucV7LHeLarv/iYpLVhuD0+BmLnO/ZT e7DuRfFVlumkmSFpXmfhtJYG8VlILsrF5I4O0Ec3CGFtngzI1W04Y81vk7nnt3vRRbqM TgTTzPqjOBsZkjJETQokWt2zfBVK8BEaOLjR1Gk4BCWvnsXBsZu1/0EfNl8S7bkoaY+p vODqxeWsTh8UT7VEojOPMyvvZw1wdssysXuyGL+YUdgJdvJgrQPrn578bfhDCOIyp7aq 8IBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TryMknPD; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25cc6aa4sor403368066b.18.2024.09.13.02.57.06 for (Google Transport Security); Fri, 13 Sep 2024 02:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXYW7kjSusxOICMg4qg0PlWLHNyCZs1dN47yByFjWJs/Y0ZR94an5cIe22+aA11MJJKZaWKu0/nXItSwf1+@amarulasolutions.com X-Received: by 2002:a17:907:f747:b0:a8d:6921:e181 with SMTP id a640c23a62f3a-a902943273bmr496515866b.16.1726221425488; Fri, 13 Sep 2024 02:57:05 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:05 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Hou Zhiqiang , Lukasz Majewski , Marek Vasut , Sean Anderson , Tim Harvey , Tom Rini Subject: [PATCH 05/26] clk: imx8mm: Mark IMX8MM_SYS_PLL2 and IMX8MM_SYS_PLL3 as enabled Date: Fri, 13 Sep 2024 11:55:47 +0200 Message-ID: <20240913095622.72377-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TryMknPD; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Both clock are enabled by the bootloader and we need to increase their reference count to avoid disable during reparent operation. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk-imx8mm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c index 432348a15cad..0e71ceefe96c 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -176,6 +176,8 @@ static const char * const imx8mm_ecspi3_sels[] = {"clock-osc-24m", "sys_pll2_200 static int imx8mm_clk_probe(struct udevice *dev) { void __iomem *base; + struct clk *clk; + int ret; base = (void *)ANATOP_BASE_ADDR; @@ -458,6 +460,13 @@ static int imx8mm_clk_probe(struct udevice *dev) clk_dm(IMX8MM_CLK_QSPI_ROOT, imx_clk_gate4("qspi_root_clk", "qspi", base + 0x42f0, 0)); #endif + ret = clk_get_by_id(IMX8MM_SYS_PLL2, &clk); + if (!ret) + clk_enable(clk); + + ret = clk_get_by_id(IMX8MM_SYS_PLL3, &clk); + if (!ret) + clk_enable(clk); clk_dm(IMX8MM_CLK_ARM, imx_clk_mux2_flags("arm_core", base + 0x9880, 24, 1, From patchwork Fri Sep 13 09:55:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3474 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 36E52412C3 for ; Fri, 13 Sep 2024 11:57:09 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5c2580e0434sf1214556a12.0 for ; Fri, 13 Sep 2024 02:57:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221429; cv=pass; d=google.com; s=arc-20240605; b=ZisEH3MF7D9zjX7LVGRWUoc0BA3AmySnWLTciiww8tEPM+omzY3G8FPeWruGOk4kXu IGgeihe9LvP6xkAwRgs2f+MVnVOcqP4IfAaNTztLKUorDnVTSvn3sgrCGbyxAFaUMn4V ureYAKZ0wFcZuN0QT3KJbnF17tHXMTqopmSjJ7a3L+pjH0o8+u+wAwutLYnidjuPdOBm uYiWTQFitpFlarxnvtVbJxn1RC5e2WXShl/cRz8mDuIPlM4kzBGORaDMxY6IjifeTuVb rAP4wdE1xnozof98fE23tQI9GWyPjeCUbh16d2ygMzQW0q22r3CpTIksmBJWWkqZpN8T aomA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=sYgMZ/qEyY3h9h48rMuFExGNm6fuXtbv+rtSCc8iNaA=; fh=4BDN+2yGWFhfWFuQBdbJ/3lQ+XKGJRiQz6Sez2rBvpw=; b=ZYdIR+rR2M8xxs4I6Yn0YHs9qF/lsHGZRnJS8uZGFSHfgiJpKMYR3ZwjyXkWeDfHq7 t7reMswyxmCmPrXXATUxOOKEXMj/TPOskPHTcyUqxZO1rkWSMmP4mwLZZENCm4la+9ZE de6kRLxfPQbp9lnHjOP7Lqym2RsRMQKB8mEdP+A36aFMlAxj9xkIDz1rTiYTakbjOiDT icCcdh2fFBixy//X498gh7+5xjqUH0LQEz9JHUVWspHOXyaVllgPl8+LQMW7g7phjX1Y 2UsTLu4uU/72bZKpNHqGowUxoPqnI8C1ZrNnTfvbVFN0zNT4KNN0hsgGQT23ElnwUWES iSZg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YVAVZAMb; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221429; x=1726826229; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=sYgMZ/qEyY3h9h48rMuFExGNm6fuXtbv+rtSCc8iNaA=; b=ZxYW/HaAWFQQg5MUX6Y8OG0aki0ALk4lUik66uUwWSx6dJDu52zpVkT517zLQUlwOu Gte2vmy8vKIzILhidXuz37zcnjO1XUB7QsHazHTcJEFGhR1Jns3Iohpz19MjplWbLA0Z a6w+j2BYJcpBYBcyWPFGFXROROD44q+uGFGVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221429; x=1726826229; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sYgMZ/qEyY3h9h48rMuFExGNm6fuXtbv+rtSCc8iNaA=; b=mskpg8eOQxcYFvrsCxH7O4o99rvPhv7uWcY39KH3Te+jveHgz35out/IVMHeYpux9C NpdjYt63EmU8Utkrp8YhPRUZjbqHSmoxGtqk+2xh+WBNyaJJ71YG1Vu6AMQ3dgUeTvbW H1sSMRcsY/w86BaJaFNeTY73X3QfEfV0tuX1hOdcL2qz2+ooeGtU6dArqflYL1ufqxzB BOHNLJpT8DX2UvvC/3QV+6YRf3cBFIDFumhoRzpfMx4u5bKF9Jt4DIFvgKTXc/0wAXWM dyZSVKnhsdFFoClpDxXODaz3uJT7BkTLaVymHU+tTaGNU8BsrRF/4NIpPTRVdPfkJg2X 7fqA== X-Forwarded-Encrypted: i=2; AJvYcCWUychWSeoJdih5QCEQk5fpih9cKIKl7hAsQQI4+gRtIps0x0cA7VWqvO5g4t1sG6u1pvKs9/atY2WE9NoK@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw6obFYpJ+tOLypdOxsznwWP7SL3F69u43mtk27ggrtUk0RfGYT Fs3jqFbpZOv9IvXFpxjCLTB2wNqYJivSU7UCIAlVSQPF7ehXzsimzhAFor+vhkoTcw== X-Google-Smtp-Source: AGHT+IHL7K/4eRWaFNo7GLHFP5PAWGe9BVyg4rVeh5IbWdi5XstRtZ3tXxu7k4p3kkEudZ2Bk0jg/w== X-Received: by 2002:a05:6402:26c1:b0:5c3:d1ce:262f with SMTP id 4fb4d7f45d1cf-5c413e1fe53mr5634190a12.15.1726221428847; Fri, 13 Sep 2024 02:57:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:34cc:b0:5be:bd2b:61e9 with SMTP id 4fb4d7f45d1cf-5c413e27dbals1137125a12.0.-pod-prod-08-eu; Fri, 13 Sep 2024 02:57:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1Xei/2QP4HwLq3H70EdJEvPNW18PQ41HsXkTXEO1luR6uLue7KnTv2IhFWrJxZPAB92lSfQAePf+6qQmL@amarulasolutions.com X-Received: by 2002:a17:907:1ca0:b0:a86:c825:7678 with SMTP id a640c23a62f3a-a9029690fedmr615963966b.64.1726221427190; Fri, 13 Sep 2024 02:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221427; cv=none; d=google.com; s=arc-20160816; b=Offc4TuwYQBnDxOfMCir7DDugvcMUxzsUdxaLo1cQAO98EfLMuVzbQKOq03y/xV9VE gMuRlAU+IM8YUIVWTsVpv9NT4zD+NALzkQcEDGXp8p0LofVYacFRkWpNjoSPsHbx2yxf te+ar3LaAXyRa4kzZViqkGQMiyST1abRw2iUkj6bgdTDgFAO2g+OG8MKin76EVWP2VZY uZ8cRZ9hV+53+9qoNN7EPf4Q+TJWRmzmY9FFbG8ATcqcC1E4q4BFU8ffqC/AHe79CUyt q/l3p3NwUHDkWNcg6c7FD5TYxnKhfssP6L8Jh2Wbf6b6AekjW6GEvF5tBvMdkjP9i6FF wvag== 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=uD1BzqlMGtRVMj1ZQ9GmxLP+c5TtzKKgaOSr/TKj2SA=; fh=DXCsrm60RrsPpUrNp8eyuXQcORtUCKJxmo45uTA0sDc=; b=PfE4TMZXYZr0goGjPwzdeCT0xHBQOiZlrRc8uuzetjauSZC1syMLuqv3EPvBKHEHka bXgFD87Axmlh8cSoLUvlbMZ3f8ZU8Aes2bUN+p9T09Sys0JQ8F59LKkDvanPbwJbAzvr HbFaJfcqhBal0qxahO3J2iP1ULJoo/sHS0afDa0WzeyjtAK30KwS4w6b1lojm0N04m9Y YvgNdX8pKBSzZiF/hVvtsY8no0JGnG+vLHWsP6W+YjsRRyq4bvKi5h58RM1ibE7OT3Xc ju5yzfhJ8tQmt0hy8rZGJQs/FCo3DkKtRg18JRfsxbGwGdArGm4dCR4UZ54UOlaC+aaF zgUQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YVAVZAMb; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25c389e2sor516282666b.15.2024.09.13.02.57.07 for (Google Transport Security); Fri, 13 Sep 2024 02:57:07 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCV5g4DLW6NBboHGK5fmmx8EXtquVHqYm44xcI0H//2mzaNCRuwVHNyjqKzMitslMoXe/li6wdd9gRnBxcdJ@amarulasolutions.com X-Received: by 2002:a17:906:c151:b0:a90:1ed4:dec6 with SMTP id a640c23a62f3a-a902961bf01mr683128166b.43.1726221426636; Fri, 13 Sep 2024 02:57:06 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:06 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Fabio Estevam , Hou Zhiqiang , Lukasz Majewski , Nicolas Heemeryck , Sean Anderson , Tom Rini Subject: [PATCH 06/26] clk: imx8mn: Mark IMX8MN_SYS_PLL2 and IMX8MN_SYS_PLL3 as enabled Date: Fri, 13 Sep 2024 11:55:48 +0200 Message-ID: <20240913095622.72377-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YVAVZAMb; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Both clock are enabled by the bootloader and we need to increase their reference count to avoid disable during reparent operation. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk-imx8mn.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index c96a2ebaa19a..449ebf2d0733 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -154,6 +154,7 @@ static const char * const imx8mn_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_10 static int imx8mn_clk_probe(struct udevice *dev) { struct clk osc_24m_clk; + struct clk *clk; void __iomem *base; int ret; @@ -420,6 +421,13 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_CLK_ECSPI3_ROOT, imx_clk_gate4("ecspi3_root_clk", "ecspi3", base + 0x4090, 0)); #endif + ret = clk_get_by_id(IMX8MN_SYS_PLL2, &clk); + if (!ret) + clk_enable(clk); + + ret = clk_get_by_id(IMX8MN_SYS_PLL3, &clk); + if (!ret) + clk_enable(clk); clk_dm(IMX8MN_CLK_ARM, imx_clk_mux2_flags("arm_core", base + 0x9880, 24, 1, From patchwork Fri Sep 13 09:55:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3475 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C5F53411AB for ; Fri, 13 Sep 2024 11:57:11 +0200 (CEST) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-536589936d3sf1685262e87.0 for ; Fri, 13 Sep 2024 02:57:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221431; cv=pass; d=google.com; s=arc-20240605; b=j7mWDzY1urWowwnx2P3Wf1pGPMYtXYudV1svbOHXtxJ9WUHTcNHr2v0AcneCDe3zRd ce2//MN+cd3IAdP7IHnPjPMQQWkBOmzrZMd5JYEZI72HcD3HqT85c4RxFOOcoIYaIQQk mvdIind5ntLsDEj5wj+Z9ptVbxeFeyW7dZCp375DhIhoorOCWvtzjRPU3IhoIkmzW/+2 gRZ1NsH+asXDuXGmOpfCVVeMmTiBKFYrxpk2txQJREDxjPFtu/11ORHKMfR6nWAxZ7BZ vDAfNbe8O26JMTdyZjXNgc26hmQU31e2484ncESbqTT1DFuBSKSIF3adGyL783bN7F/Y vGXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=vfNvEepGLyY7HQt6oAySjIBwdiRXE9Tu/8D4qfyVq98=; fh=1iD/KuvhfUC38qn2fOJYCQs+DMD1Yklhen3OminBYAM=; b=O3DcwLyPxz5oUKCSRb/ltu4W+t23sCIukLPEQkIzcybtMnA3NiQ4o/OEPmREFkQRVt nmii3AG+e8lOBHdtWwRipyVCV6KTa1pLzB4Dj19BldX6oMpiZ5FJEa10A48tIPpK6jsK GRF4UjcrZ9Pku/rOrnM+0jxCLsoa+h2YN9k5vEhcUW3j7o9F9Xzgpo1IdeS+vcvByycj jh1NbShlZQA1/YWmvGAOVGulL3zuME9J25rQt3Fj+YLcuWpyfMgJNjw6Ux3KI8NKcbR4 CVU4Ft/acbHh8ms524NdWPaqsIp2Wvg4Ipe36GXMZitmUBTuL+lFXlX6jzInF8mlXHru EpCw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AiLYp8ha; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221431; x=1726826231; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=vfNvEepGLyY7HQt6oAySjIBwdiRXE9Tu/8D4qfyVq98=; b=V5wrhB6/H70g+TvyGrT5dGncqUetAEhghRRlPKvEbQ75CerDdeh/J02u4zx0pjqFko PMaWlhJzuNUKxbDHwEaxADd4ly7zPeOefmU6AlEmWDGyLzmawK62ASKy6jWnVJ6KL0h2 wFTOjxfUT+TVkyCWIH5maoPnlZbBKO1nycbZI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221431; x=1726826231; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vfNvEepGLyY7HQt6oAySjIBwdiRXE9Tu/8D4qfyVq98=; b=b4apgVvOT1M86b5OMiOSK3QdizQPTW6BEaXUdLV8+RxDj261sfhTpO6mLBwhqng2jn 1XjFA243cYdvsFUYRhFvRbf1CD46ojex/9zReLRohhOF7Xv0LeyV6KlvJvq1bmDr+n97 8REzUNktjlqaH5cFSSKQPBFEtweqRFEPPQCjSBFhNSK4gv8cYSGCEOFAEv/D5rQJFSE7 qVHY5KMSGVuHOUel2VQJ3Y230hfumvet4gfRst5qDzE97bAS2E52t3WbSm90AzNjO+hv XNZ6PQpV3/fCJXtjU8mu/SQSbp5H6fumBWFkVCf1jhITceB8PFKdbmlEJ5tke9USleW8 KWlw== X-Forwarded-Encrypted: i=2; AJvYcCVH/31TQ6l0JJB7fr2A4zr5mfJBuvJX/3i8xDWyS0BVtAPHqTiRJ5cyIHwdAJWZyxOcP3Cijh83zXtnJMTa@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx8E+rmOqxyJEomTpB6bC7F8VpTnmRmWEKQrQdl82sYpCCIB9yY uVFfOPlxoYgk5wienMVHMjaGNbYflXEQxkCPx0BvUXoBZizPyn38zPXx+zuqHN33jQ== X-Google-Smtp-Source: AGHT+IG/a9ACGKVpgDvC3UCcGv9O4p+/edg/iP/+I5cURRAhupkTHveFfl63Z7VDdEYi1uB+CoawSw== X-Received: by 2002:a05:6512:3f0d:b0:52b:bf8e:ffea with SMTP id 2adb3069b0e04-53678feb0f9mr3926673e87.40.1726221431055; Fri, 13 Sep 2024 02:57:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:ea5:b0:52f:c300:1e1f with SMTP id 2adb3069b0e04-53678f630c4ls934710e87.1.-pod-prod-02-eu; Fri, 13 Sep 2024 02:57:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVLjX/pVeTqPL7v0VBJBKRdxo5dAcxvmSf0dBYqMe/KcSFXrin+grmuTV0iHVAQ1zP9yrwImGxXYRY9jQe3@amarulasolutions.com X-Received: by 2002:a05:6512:3b0e:b0:536:55ae:7444 with SMTP id 2adb3069b0e04-53678fba506mr3862974e87.22.1726221429240; Fri, 13 Sep 2024 02:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221429; cv=none; d=google.com; s=arc-20160816; b=SLJYGRd452QdExhAfrveXUGXuf/ZQYO/kWs+ARPAgU8PPN4+ayrOnYSFjSJKwGxzrt IjvN84TRkKgCbNUI7lySuafMo0uepNWdQ8DQG9/Ouv2Lct7/h9plUfKAytuFnhjSdzhu DtmjqTPorwOWtRohrEYX5ODVztRIfU+J0yCOtWQWEp3USRAhdqX5Wx7wd9HdYI9/ESZm 4z9uVbHVVRIf1mqRHbks+W4zON8FnwxJttO8kVfz+tzLyAyn/aVRGYtcvuyneQq+oLj3 H+jqrUo0JN8vxf1tZHH6dNvcpxr6LccgEBJ4agaREcrwjUc6umK7U1LA3tNGAARWJcfy 58GA== 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=tkMh91Hn86vFyByeQQFNsm5+zhBASEKSgno6mbETJI4=; fh=A9i34bCcdP2YZTwOHnjDd49K8lUgC+Zb0XjBvKK2Hd0=; b=HkIR3tT5kuOOOCvSgeO2SRVo92vNSgPnK+jhkrLQvT8n62xrrpk8W2qWF4sKHUeW64 VtUqxEXWpwTGAnbFIx048jF/fLxWCknoJdWlYFrJktH6h3cbXpyc6KAGTzzHKqKRI63S yeu2kQL3ZfhVFsPr7EcFUB9nxb5sRIYbKll06m5+Ao4+Swf7bEN1qEBA3o0KNT5ZhHFa AsXuPnWXrvONw3Fnv2wieP/I7F7C6AerALD6Mb723q+6SbP3NPLVCWhybkfrLdhMyl59 Eh6wnyAx4QM2WISJLbIc0VC+J8mX6k9NGSvPTrr/dx3ClEKXXk/fCwfMsD63EVYqN3Bs bYMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AiLYp8ha; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 2adb3069b0e04-5365f86feccsor4461353e87.10.2024.09.13.02.57.09 for (Google Transport Security); Fri, 13 Sep 2024 02:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVyAoJCBwykkszZnAQPaGfYepehUStzDljOTTZ3efhTogoukozHn4j6/Wp2nq/sG9Kmxbt4CSQnEOTQUYTa@amarulasolutions.com X-Received: by 2002:a05:6512:3d23:b0:52c:99c9:bef6 with SMTP id 2adb3069b0e04-53678fb1929mr3438130e87.7.1726221427752; Fri, 13 Sep 2024 02:57:07 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:07 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Fabio Estevam , Hou Zhiqiang , Lukasz Majewski , Nicolas Heemeryck , Sean Anderson , Tom Rini Subject: [PATCH 07/26] clk: imx8mn: add video clocks support Date: Fri, 13 Sep 2024 11:55:49 +0200 Message-ID: <20240913095622.72377-8-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AiLYp8ha; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Add clocks support for the video subsystem. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk-imx8mn.c | 97 +++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 7 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 449ebf2d0733..7ea4c90fa137 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -17,6 +17,7 @@ static u32 share_count_nand; static const char * const pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; +static const char * const video_pll_bypass_sels[] = {"video_pll", "video_pll_ref_sel", }; static const char * const dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", }; static const char * const arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", }; static const char * const sys_pll1_bypass_sels[] = {"sys_pll1", "sys_pll1_ref_sel", }; @@ -47,17 +48,52 @@ static const char * const imx8mn_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_2 "video_pll_out", "sys_pll3_out", }; #ifndef CONFIG_SPL_BUILD -static const char * const imx8mn_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", - "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", +static const char * const imx8mn_disp_axi_sels[] = {"clock-osc-24m", "sys_pll2_1000m", + "sys_pll1_800m", "sys_pll3_out", "sys_pll1_40m", + "audio_pll2_out", "clk_ext1", "clk_ext4", }; + +static const char * const imx8mn_disp_apb_sels[] = {"clock-osc-24m", "sys_pll2_125m", + "sys_pll1_800m", "sys_pll3_out", "sys_pll1_40m", + "audio_pll2_out", "clk_ext1", "clk_ext3", }; + +static const char * const imx8mn_disp_pixel_sels[] = {"clock-osc-24m", "video_pll_out", + "audio_pll2_out", "audio_pll1_out", + "sys_pll1_800m", "sys_pll2_1000m", + "sys_pll3_out", "clk_ext4", }; + +static const char * const imx8mn_dsi_core_sels[] = {"clock-osc-24m", "sys_pll1_266m", + "sys_pll2_250m", "sys_pll1_800m", + "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_dsi_phy_sels[] = {"clock-osc-24m", "sys_pll2_125m", + "sys_pll2_100m", "sys_pll1_800m", + "sys_pll2_1000m", "clk_ext2", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_dsi_dbi_sels[] = {"clock-osc-24m", "sys_pll1_266m", + "sys_pll2_100m", "sys_pll1_800m", + "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_camera_pixel_sels[] = {"clock-osc-24m", "sys_pll1_266m", + "sys_pll2_250m", "sys_pll1_800m", + "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", + "sys_pll2_50m", "sys_pll2_100m", + "sys_pll1_160m", "audio_pll1_out", "video_pll_out", "clk_ext4", }; -static const char * const imx8mn_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", - "clk_ext1", "clk_ext2", "clk_ext3", - "clk_ext4", "video_pll_out", }; +static const char * const imx8mn_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", + "audio_pll1_out", "clk_ext1", "clk_ext2", + "clk_ext3", "clk_ext4", "video_pll_out", }; static const char * const imx8mn_enet_phy_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", - "sys_pll2_200m", "sys_pll2_500m", "audio_pll1_out", - "video_pll_out", "audio_pll2_out", }; + "sys_pll2_200m", "sys_pll2_500m", + "audio_pll1_out", "video_pll_out", + "audio_pll2_out", }; #endif static const char * const imx8mn_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", @@ -151,6 +187,10 @@ static const char * const imx8mn_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_10 "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; +#ifndef CONFIG_SPL_BUILD +static unsigned int share_count_disp; +#endif + static int imx8mn_clk_probe(struct udevice *dev) { struct clk osc_24m_clk; @@ -191,8 +231,19 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_SYS_PLL3, imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel", base + 0x114, &imx_1416x_pll)); + clk_dm(IMX8MN_VIDEO_PLL_REF_SEL, + imx_clk_mux("video_pll_ref_sel", base + 0x28, 0, 2, + pll_ref_sels, ARRAY_SIZE(pll_ref_sels))); + clk_dm(IMX8MN_VIDEO_PLL1, + imx_clk_pll14xx("video_pll", "video_pll_ref_sel", + base + 0x28, &imx_1443x_pll)); /* PLL bypass out */ + clk_dm(IMX8MN_VIDEO_PLL_BYPASS, + imx_clk_mux_flags("video_pll_bypass", base + 0x28, 16, 1, + video_pll_bypass_sels, + ARRAY_SIZE(video_pll_bypass_sels), + CLK_SET_RATE_PARENT)); clk_dm(IMX8MN_DRAM_PLL_BYPASS, imx_clk_mux_flags("dram_pll_bypass", base + 0x50, 4, 1, dram_pll_bypass_sels, @@ -220,6 +271,9 @@ static int imx8mn_clk_probe(struct udevice *dev) CLK_SET_RATE_PARENT)); /* PLL out gate */ + clk_dm(IMX8MN_VIDEO_PLL_OUT, + imx_clk_gate("video_pll_out", "video_pll_bypass", + base + 0x28, 13)); clk_dm(IMX8MN_DRAM_PLL_OUT, imx_clk_gate("dram_pll_out", "dram_pll_bypass", base + 0x50, 13)); @@ -376,6 +430,35 @@ static int imx8mn_clk_probe(struct udevice *dev) /* clks not needed in SPL stage */ #ifndef CONFIG_SPL_BUILD + clk_dm(IMX8MN_CLK_DISP_AXI, + imx8m_clk_composite("disp_axi", imx8mn_disp_axi_sels, base + 0x8a00)); + clk_dm(IMX8MN_CLK_DISP_APB, + imx8m_clk_composite("disp_apb", imx8mn_disp_apb_sels, base + 0x8a80)); + clk_dm(IMX8MN_CLK_DISP_PIXEL, + __imx8m_clk_composite("disp_pixel", imx8mn_disp_pixel_sels, base + 0xa500, + CLK_SET_RATE_PARENT)); + clk_dm(IMX8MN_CLK_DSI_CORE, + imx8m_clk_composite("dsi_core", imx8mn_dsi_core_sels, base + 0xbb00)); + clk_dm(IMX8MN_CLK_DSI_PHY_REF, + imx8m_clk_composite("dsi_phy_ref", imx8mn_dsi_phy_sels, base + 0xbb80)); + clk_dm(IMX8MN_CLK_DSI_DBI, + imx8m_clk_composite("dsi_dbi", imx8mn_dsi_dbi_sels, base + 0xbc00)); + clk_dm(IMX8MN_CLK_CAMERA_PIXEL, + imx8m_clk_composite("camera_pixel", imx8mn_camera_pixel_sels, base + 0xbd00)); + + clk_dm(IMX8MN_CLK_DISP_AXI_ROOT, + imx_clk_gate2_shared2("disp_axi_root_clk", "disp_axi", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_DISP_APB_ROOT, + imx_clk_gate2_shared2("disp_apb_root_clk", "disp_apb", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_CAMERA_PIXEL_ROOT, + imx_clk_gate2_shared2("camera_pixel_clk", "camera_pixel", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_DISP_PIXEL_ROOT, + imx_clk_gate2_shared2("disp_pixel_clk", "disp_pixel", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_ENET_REF, imx8m_clk_composite("enet_ref", imx8mn_enet_ref_sels, base + 0xa980)); From patchwork Fri Sep 13 09:55:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3476 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3217341280 for ; Fri, 13 Sep 2024 11:57:12 +0200 (CEST) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-5356aaecdf6sf707327e87.2 for ; Fri, 13 Sep 2024 02:57:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221431; cv=pass; d=google.com; s=arc-20240605; b=A8tBUEGWx6OoJRdoJqg/R4woMJItdsIFqel1fw+Vwg5A6caQzLE0B/cXxeEJDlKboj FTzUWaBgbZwv77u7o0mJBQDz0ke+5Xd6eNeH0p1BsIhmAR5IBq6kLHH0c3cQKjjXcmEF F8YdZ8xaPOQLSDVRy74/ZVrAOMIZWf9x1s2SmReNHNVGxGF2H/oTLfbobhHVoj6UgiLP BsZzDKnxZLv8+b0TxckhqjXLI4NTE3NBN3Y18cc0oYtaiONcdTfupUzNBxQlpXBKjWwM W30X7n/ddhdIL2FIaM+44TjkF/h2TLWJFkfBd75tOxZReI43ARsoFMXTdL33fGo1EHki Q0nw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=U9yg/npHBFuwcZbpwSRNuBCFNBD9BOwxFlkY7Ekw+Qs=; fh=hOa/8OGYsMm3SADQP7lhxNvC1tW2RbFAwUm30PPCj3k=; b=SEetCv/VLB2CuuE/MWsNPH3pEqNcipkNEVkS0tGay15WGQzxdp0mGymZ1yIMxPDiRl PO1r9/TzITMJhwn5IB+XPTphzTB78vCPpgYTykNMG0QBclZk8kGki4C6dIQfmYz7EYMh ePHSVvYK5cMpJe7vSxwHE2Z5xjc0xWcWbWrcwdKNMp17MhDF2Xqkk6nKg+zq23w8NAn5 0JENeOW3yC+/FDiwIv3byXBs1KjQPH5fJq9LYiOK2CBeQc3kYURTXYGvC4kgTQXEePkT 2XWMzzEPXjfSRCExUCFBqqrky67wdBQ7EFEbVM8pSMXRKH++PPqUyoOFW/xHO81gGric SF3w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KprSd4Nd; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221431; x=1726826231; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=U9yg/npHBFuwcZbpwSRNuBCFNBD9BOwxFlkY7Ekw+Qs=; b=poz3C96zK4CjVVV9/bjyzkrEcI3CaisMnnUGCL9ZtY/wVpvwka9foLxECQrRoJqBPc 9pVSKYPtMY37kmh24zuo1W+IHejf9FOh7NtnfLSINmtmXW1rTo7UwO9ToAQpzLkiI8i9 kgf57Lf4hxBGaIW3EdWhu8kve8CZkRdxjP6cs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221431; x=1726826231; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=U9yg/npHBFuwcZbpwSRNuBCFNBD9BOwxFlkY7Ekw+Qs=; b=plVQsrrepSY4iGeakB6bLzDW1vMiaByvHJ7zHojIPzng7cIOVXTYDTQUr/+aAPQ+Dp ZTuxkMlMO/BkHUpxwNC9jKQ98Qw+8JR/JxtROhYIqhJyi6BnTwzAsoeTQ1iOKRlTsvRu JBvq00Ah3JIl33RU/8HTrhtY4fYwLnGXHx4oFbEwxhitljenweEmurscZlPmvFhtY1Qe VAeFYx0r8Ym13jKdmqiukMYZ7HF5mGBjxAuo7eM6peuK7wBmX7BN+aWgfDBIMRrbCZQg FEeUB6+mFzoilK/0L/OKKkXhFZmPyVFeU9J/hLC8TDgPBdi06T0QQ1Ev/PdAUs4dZM59 /QVQ== X-Forwarded-Encrypted: i=2; AJvYcCXalr6TB0ZA6mCa3QORppwG/Zbum55J/IYwQrv7AmANvbUMqqiJ8vVJxuHe9c1n01QTbS4JRNwq7tWy1peV@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yy5OQOngLWNXRmEYR8/V52Y6K+NXwynteTyFcROnxpOhrSSP5Kt HGVtrPVkohH5xSLdm+/+T49frTYI7BcP1H6sV+BkvVYUGAu0Abvps8W8sIeOtNbbXA== X-Google-Smtp-Source: AGHT+IEAZqvbtcT8Khlv4tFyJtmKy3dq5SdVFoRsDLwBJUuWne7Tg3n2SIIZYQbPWZ33ami7XbTPWA== X-Received: by 2002:a05:6512:2345:b0:52e:9b2f:c313 with SMTP id 2adb3069b0e04-5367fed6fd4mr1570728e87.22.1726221431384; Fri, 13 Sep 2024 02:57:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:34cc:b0:5c4:1372:c199 with SMTP id 4fb4d7f45d1cf-5c413e2811els676572a12.0.-pod-prod-06-eu; Fri, 13 Sep 2024 02:57:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUOmlO1RLgR0IZn2RrLScUNRlNOKD8D7i5FLc2/jGIlyOzNEjGxMO07s5z8zwmDOi/z5HU7gVfrjvrfSfyU@amarulasolutions.com X-Received: by 2002:a17:906:fe4d:b0:a8d:1655:a42c with SMTP id a640c23a62f3a-a9047b4afccmr172417966b.1.1726221429653; Fri, 13 Sep 2024 02:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221429; cv=none; d=google.com; s=arc-20160816; b=Hfh762czsK0rqiW6ynaPcY+4QUCtROJcCscIdKfuseCNJBl6HE0a3kUedEGyJ2Tsf1 QiAWJdEryZlqv9awbyTuSurbEj7paoRtZWQhB19ENNbIeCqJljef9u10A2kkQXBbXwbN ME9XumJduaAztkzYKqxyBCNqVWhUd55yWwhwjFf+JW7D7TNL0mJH3jHMP/sd7FzBVdte 2qEMOLBHIRf1CEGAvPF69x4YKJkR6xMEkRigJlxuqqcLNJYrBIqEyHLkKKhF8TrLMrdT P4DJnxxpGYdMlDR57k7Z3AaEgXeB88huJjDt2DEnaKQDH1ddfg3+smEQy4g5hLEgTGZ4 knuw== 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=x2avQ3f+LlSKpWnLEZG75p6uGV1IhRjabYa/XERRt3A=; fh=C/ccRPRvC8SsyG8x8WhCfsVmY1ms9St3NFyxJ7kU3Y4=; b=W3ZaHnXMmHDAWwV72/DNlJyJSJ9WI8EyvNiLo2JUS66BBXQ35jRr+V5bnzkbrOW8FZ qmHQykZvkpjme1/f+Yb0yO2waBGd2NCtGbEWbPFdnbqjUCsOrImZgsVTOXM4itqBoNFW PIu7UdEyeyErNJH9FalIxBFhBPsPdG1+5Hy1+6lrzoKkuK7UTVcosXoNLXEB8LRKU9MI jaSMWJ7dVvZKtQ+3hRqgBRTmZdjHZL1/OgufuwYs0prXg2wBGm1pk4t1MdxjxYLzt+Mk 34hWve/dEYxDKOQjqlYgmgg4UyJAOXxuAEDgyJqKJg3NPQ1a0zKyQT36BJv6vQI1JRRj jQ7w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KprSd4Nd; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d258604fdsor435759366b.2.2024.09.13.02.57.09 for (Google Transport Security); Fri, 13 Sep 2024 02:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUiSpu61MeNez3xYpL2nr9prHQxAPe9YRNF80yjoybw1LL4zaDKTWpwsNWHK+C7+UYvzuV9HkK40o0M2Etw@amarulasolutions.com X-Received: by 2002:a17:907:6e8f:b0:a8d:c3b:b16 with SMTP id a640c23a62f3a-a9047d1afaemr150708966b.28.1726221428931; Fri, 13 Sep 2024 02:57:08 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:08 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Ye Li , Dario Binacchi , AKASHI Takahiro , Jaehoon Chung , Tom Rini Subject: [PATCH 08/26] power: Add iMX8M block ctrl driver for dispmix Date: Fri, 13 Sep 2024 11:55:50 +0200 Message-ID: <20240913095622.72377-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KprSd4Nd; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Add iMX8 block ctrl driver for displaymix on iMX8MM/iMX8MN and mediamix on iMX8MP. To support blk ctrl driver, the power domain driver on iMX8M needs update to add relevant PGC domains Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/power/domain/Kconfig | 6 + drivers/power/domain/Makefile | 1 + drivers/power/domain/imx8m-blk-ctrl.c | 438 ++++++++++++++++++++++ drivers/power/domain/imx8m-power-domain.c | 213 ++++++++++- 4 files changed, 656 insertions(+), 2 deletions(-) create mode 100644 drivers/power/domain/imx8m-blk-ctrl.c diff --git a/drivers/power/domain/Kconfig b/drivers/power/domain/Kconfig index bd82d2f7044b..fb006b6e8e28 100644 --- a/drivers/power/domain/Kconfig +++ b/drivers/power/domain/Kconfig @@ -40,6 +40,12 @@ config IMX8M_POWER_DOMAIN Enable support for manipulating NXP i.MX8M on-SoC power domains via requests to the ATF. +config IMX8M_BLK_CTRL + bool "Enable i.MX8M block control driver" + depends on POWER_DOMAIN && ARCH_IMX8M + help + Enable support for manipulating NXP i.MX8M on-SoC block control driver + config IMX8MP_HSIOMIX_BLKCTRL bool "Enable i.MX8MP HSIOMIX domain driver" depends on POWER_DOMAIN && IMX8MP diff --git a/drivers/power/domain/Makefile b/drivers/power/domain/Makefile index 2daab73eb758..46849fd2a4db 100644 --- a/drivers/power/domain/Makefile +++ b/drivers/power/domain/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_APPLE_PMGR_POWER_DOMAIN) += apple-pmgr.o obj-$(CONFIG_BCM6328_POWER_DOMAIN) += bcm6328-power-domain.o obj-$(CONFIG_IMX8_POWER_DOMAIN) += imx8-power-domain-legacy.o imx8-power-domain.o obj-$(CONFIG_IMX8M_POWER_DOMAIN) += imx8m-power-domain.o +obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8m-blk-ctrl.o obj-$(CONFIG_IMX8MP_HSIOMIX_BLKCTRL) += imx8mp-hsiomix.o obj-$(CONFIG_MTK_POWER_DOMAIN) += mtk-power-domain.o obj-$(CONFIG_MESON_GX_VPU_POWER_DOMAIN) += meson-gx-pwrc-vpu.o diff --git a/drivers/power/domain/imx8m-blk-ctrl.c b/drivers/power/domain/imx8m-blk-ctrl.c new file mode 100644 index 000000000000..4c89078b991b --- /dev/null +++ b/drivers/power/domain/imx8m-blk-ctrl.c @@ -0,0 +1,438 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2023 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BLK_SFT_RSTN 0x0 +#define BLK_CLK_EN 0x4 +#define BLK_MIPI_RESET_DIV 0x8 /* Mini/Nano/Plus DISPLAY_BLK_CTRL only */ + +#define DOMAIN_MAX_CLKS 4 + +struct imx8m_blk_ctrl_domain { + struct clk clks[DOMAIN_MAX_CLKS]; + struct power_domain power_dev; +}; + +struct imx8m_blk_ctrl { + void __iomem *base; + struct power_domain bus_power_dev; + struct imx8m_blk_ctrl_domain *domains; +}; + +struct imx8m_blk_ctrl_domain_data { + const char *name; + const char * const *clk_names; + const char *gpc_name; + int num_clks; + u32 rst_mask; + u32 clk_mask; + u32 mipi_phy_rst_mask; +}; + +struct imx8m_blk_ctrl_data { + int max_reg; + const struct imx8m_blk_ctrl_domain_data *domains; + int num_domains; + u32 bus_rst_mask; + u32 bus_clk_mask; +}; + +static int imx8m_blk_ctrl_request(struct power_domain *power_domain) +{ + return 0; +} + +static int imx8m_blk_ctrl_free(struct power_domain *power_domain) +{ + return 0; +} + +static int imx8m_blk_ctrl_enable_domain_clk(struct udevice *dev, ulong domain_id, bool enable) +{ + int ret, i; + struct imx8m_blk_ctrl *priv = (struct imx8m_blk_ctrl *)dev_get_priv(dev); + struct imx8m_blk_ctrl_data *drv_data = + (struct imx8m_blk_ctrl_data *)dev_get_driver_data(dev); + + debug("%s num_clk %u\n", __func__, drv_data->domains[domain_id].num_clks); + + for (i = 0; i < drv_data->domains[domain_id].num_clks; i++) { + debug("%s clk %s\n", __func__, drv_data->domains[domain_id].clk_names[i]); + if (enable) + ret = clk_enable(&priv->domains[domain_id].clks[i]); + else + ret = clk_disable(&priv->domains[domain_id].clks[i]); + if (ret && ret != -ENOENT) { + printf("Failed to %s domain clk %s\n", enable ? "enable" : "disable", + drv_data->domains[domain_id].clk_names[i]); + return ret; + } + } + + return 0; +} + +static int imx8m_blk_ctrl_power_on(struct power_domain *power_domain) +{ + struct udevice *dev = power_domain->dev; + struct imx8m_blk_ctrl *priv = (struct imx8m_blk_ctrl *)dev_get_priv(dev); + struct imx8m_blk_ctrl_data *drv_data = + (struct imx8m_blk_ctrl_data *)dev_get_driver_data(dev); + int ret; + + debug("%s, id %lu\n", __func__, power_domain->id); + + if (!priv->domains[power_domain->id].power_dev.dev) + return -ENODEV; + + ret = power_domain_on(&priv->bus_power_dev); + if (ret < 0) { + printf("Failed to power up bus domain %d\n", ret); + return ret; + } + + /* Enable bus clock and deassert bus reset */ + setbits_le32(priv->base + BLK_CLK_EN, drv_data->bus_clk_mask); + setbits_le32(priv->base + BLK_SFT_RSTN, drv_data->bus_rst_mask); + + /* wait for reset to propagate */ + udelay(5); + + /* put devices into reset */ + clrbits_le32(priv->base + BLK_SFT_RSTN, drv_data->domains[power_domain->id].rst_mask); + if (drv_data->domains[power_domain->id].mipi_phy_rst_mask) + clrbits_le32(priv->base + BLK_MIPI_RESET_DIV, d + rv_data->domains[power_domain->id].mipi_phy_rst_mask); + + /* enable upstream and blk-ctrl clocks to allow reset to propagate */ + ret = imx8m_blk_ctrl_enable_domain_clk(dev, power_domain->id, true); + if (ret) { + printf("failed to enable clocks\n"); + goto bus_powerdown; + } + + /* ungate clk */ + setbits_le32(priv->base + BLK_CLK_EN, drv_data->domains[power_domain->id].clk_mask); + + /* power up upstream GPC domain */ + ret = power_domain_on(&priv->domains[power_domain->id].power_dev); + if (ret < 0) { + printf("Failed to power up peripheral domain %d\n", ret); + goto clk_disable; + } + + /* wait for reset to propagate */ + udelay(5); + + /* release reset */ + setbits_le32(priv->base + BLK_SFT_RSTN, drv_data->domains[power_domain->id].rst_mask); + if (drv_data->domains[power_domain->id].mipi_phy_rst_mask) + setbits_le32(priv->base + BLK_MIPI_RESET_DIV, + drv_data->domains[power_domain->id].mipi_phy_rst_mask); + + return 0; +clk_disable: + imx8m_blk_ctrl_enable_domain_clk(dev, power_domain->id, false); +bus_powerdown: + power_domain_off(&priv->bus_power_dev); + return ret; +} + +static int imx8m_blk_ctrl_power_off(struct power_domain *power_domain) +{ + struct udevice *dev = power_domain->dev; + struct imx8m_blk_ctrl *priv = (struct imx8m_blk_ctrl *)dev_get_priv(dev); + struct imx8m_blk_ctrl_data *drv_data = + (struct imx8m_blk_ctrl_data *)dev_get_driver_data(dev); + + debug("%s, id %lu\n", __func__, power_domain->id); + + if (!priv->domains[power_domain->id].power_dev.dev) + return -ENODEV; + + /* put devices into reset and disable clocks */ + if (drv_data->domains[power_domain->id].mipi_phy_rst_mask) + clrbits_le32(priv->base + BLK_MIPI_RESET_DIV, + drv_data->domains[power_domain->id].mipi_phy_rst_mask); + + /* assert reset */ + clrbits_le32(priv->base + BLK_SFT_RSTN, drv_data->domains[power_domain->id].rst_mask); + + /* gate clk */ + clrbits_le32(priv->base + BLK_CLK_EN, drv_data->domains[power_domain->id].clk_mask); + + /* power down upstream GPC domain */ + power_domain_off(&priv->domains[power_domain->id].power_dev); + + imx8m_blk_ctrl_enable_domain_clk(dev, power_domain->id, false); + + /* power down bus domain */ + power_domain_off(&priv->bus_power_dev); + + return 0; +} + +static int imx8m_blk_ctrl_probe(struct udevice *dev) +{ + int ret, i, j; + struct imx8m_blk_ctrl *priv = (struct imx8m_blk_ctrl *)dev_get_priv(dev); + struct imx8m_blk_ctrl_data *drv_data = + (struct imx8m_blk_ctrl_data *)dev_get_driver_data(dev); + + priv->base = dev_read_addr_ptr(dev); + if (!priv->base) + return -EINVAL; + + priv->domains = kcalloc(drv_data->num_domains, + sizeof(struct imx8m_blk_ctrl_domain), GFP_KERNEL); + + ret = power_domain_get_by_name(dev, &priv->bus_power_dev, "bus"); + if (ret) { + printf("Failed to power_domain_get_by_name %s\n", "bus"); + return ret; + } + + for (j = 0; j < drv_data->num_domains; j++) { + ret = power_domain_get_by_name(dev, &priv->domains[j].power_dev, + drv_data->domains[j].gpc_name); + if (ret) + continue; + + for (i = 0; i < drv_data->domains[j].num_clks; i++) { + ret = clk_get_by_name(dev, drv_data->domains[j].clk_names[i], + &priv->domains[j].clks[i]); + if (ret) { + printf("Failed to get clk %s\n", drv_data->domains[j].clk_names[i]); + return ret; + } + } + } + + return 0; +} + +static int imx8m_blk_ctrl_remove(struct udevice *dev) +{ + struct imx8m_blk_ctrl *priv = (struct imx8m_blk_ctrl *)dev_get_priv(dev); + + kfree(priv->domains); + + return 0; +} + +static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] = { + [IMX8MM_DISPBLK_PD_CSI_BRIDGE] = { + .name = "dispblk-csi-bridge", + .clk_names = (const char *[]){ "csi-bridge-axi", "csi-bridge-apb", + "csi-bridge-core", }, + .num_clks = 3, + .gpc_name = "csi-bridge", + .rst_mask = BIT(0) | BIT(1) | BIT(2), + .clk_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5), + }, + [IMX8MM_DISPBLK_PD_LCDIF] = { + .name = "dispblk-lcdif", + .clk_names = (const char *[]){ "lcdif-axi", "lcdif-apb", "lcdif-pix", }, + .num_clks = 3, + .gpc_name = "lcdif", + .clk_mask = BIT(6) | BIT(7), + }, + [IMX8MM_DISPBLK_PD_MIPI_DSI] = { + .name = "dispblk-mipi-dsi", + .clk_names = (const char *[]){ "dsi-pclk", "dsi-ref", }, + .num_clks = 2, + .gpc_name = "mipi-dsi", + .rst_mask = BIT(5), + .clk_mask = BIT(8) | BIT(9), + .mipi_phy_rst_mask = BIT(17), + }, + [IMX8MM_DISPBLK_PD_MIPI_CSI] = { + .name = "dispblk-mipi-csi", + .clk_names = (const char *[]){ "csi-aclk", "csi-pclk" }, + .num_clks = 2, + .gpc_name = "mipi-csi", + .rst_mask = BIT(3) | BIT(4), + .clk_mask = BIT(10) | BIT(11), + .mipi_phy_rst_mask = BIT(16), + }, +}; + +static const struct imx8m_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = { + .max_reg = 0x2c, + .domains = imx8mm_disp_blk_ctl_domain_data, + .num_domains = ARRAY_SIZE(imx8mm_disp_blk_ctl_domain_data), + .bus_rst_mask = BIT(6), + .bus_clk_mask = BIT(12), +}; + +static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = { + [IMX8MN_DISPBLK_PD_MIPI_DSI] = { + .name = "dispblk-mipi-dsi", + .clk_names = (const char *[]){ "dsi-pclk", "dsi-ref", }, + .num_clks = 2, + .gpc_name = "mipi-dsi", + .rst_mask = BIT(0) | BIT(1), + .clk_mask = BIT(0) | BIT(1), + .mipi_phy_rst_mask = BIT(17), + }, + [IMX8MN_DISPBLK_PD_MIPI_CSI] = { + .name = "dispblk-mipi-csi", + .clk_names = (const char *[]){ "csi-aclk", "csi-pclk" }, + .num_clks = 2, + .gpc_name = "mipi-csi", + .rst_mask = BIT(2) | BIT(3), + .clk_mask = BIT(2) | BIT(3), + .mipi_phy_rst_mask = BIT(16), + }, + [IMX8MN_DISPBLK_PD_LCDIF] = { + .name = "dispblk-lcdif", + .clk_names = (const char *[]){ "lcdif-axi", "lcdif-apb", "lcdif-pix", }, + .num_clks = 3, + .gpc_name = "lcdif", + .rst_mask = BIT(4) | BIT(5), + .clk_mask = BIT(4) | BIT(5), + }, + [IMX8MN_DISPBLK_PD_ISI] = { + .name = "dispblk-isi", + .clk_names = (const char *[]){ "disp_axi", "disp_apb", "disp_axi_root", + "disp_apb_root"}, + .num_clks = 4, + .gpc_name = "isi", + .rst_mask = BIT(6) | BIT(7), + .clk_mask = BIT(6) | BIT(7), + }, +}; + +static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = { + .max_reg = 0x84, + .domains = imx8mn_disp_blk_ctl_domain_data, + .num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data), + .bus_rst_mask = BIT(8), + .bus_clk_mask = BIT(8), +}; + +static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[] = { + [IMX8MP_MEDIABLK_PD_MIPI_DSI_1] = { + .name = "mediablk-mipi-dsi-1", + .clk_names = (const char *[]){ "apb", "phy", }, + .num_clks = 2, + .gpc_name = "mipi-dsi1", + .rst_mask = BIT(0) | BIT(1), + .clk_mask = BIT(0) | BIT(1), + .mipi_phy_rst_mask = BIT(17), + }, + [IMX8MP_MEDIABLK_PD_MIPI_CSI2_1] = { + .name = "mediablk-mipi-csi2-1", + .clk_names = (const char *[]){ "apb", "cam1" }, + .num_clks = 2, + .gpc_name = "mipi-csi1", + .rst_mask = BIT(2) | BIT(3), + .clk_mask = BIT(2) | BIT(3), + .mipi_phy_rst_mask = BIT(16), + }, + [IMX8MP_MEDIABLK_PD_LCDIF_1] = { + .name = "mediablk-lcdif-1", + .clk_names = (const char *[]){ "disp1", "apb", "axi", }, + .num_clks = 3, + .gpc_name = "lcdif1", + .rst_mask = BIT(4) | BIT(5) | BIT(23), + .clk_mask = BIT(4) | BIT(5) | BIT(23), + }, + [IMX8MP_MEDIABLK_PD_ISI] = { + .name = "mediablk-isi", + .clk_names = (const char *[]){ "axi", "apb" }, + .num_clks = 2, + .gpc_name = "isi", + .rst_mask = BIT(6) | BIT(7), + .clk_mask = BIT(6) | BIT(7), + }, + [IMX8MP_MEDIABLK_PD_MIPI_CSI2_2] = { + .name = "mediablk-mipi-csi2-2", + .clk_names = (const char *[]){ "apb", "cam2" }, + .num_clks = 2, + .gpc_name = "mipi-csi2", + .rst_mask = BIT(9) | BIT(10), + .clk_mask = BIT(9) | BIT(10), + .mipi_phy_rst_mask = BIT(30), + }, + [IMX8MP_MEDIABLK_PD_LCDIF_2] = { + .name = "mediablk-lcdif-2", + .clk_names = (const char *[]){ "disp2", "apb", "axi", }, + .num_clks = 3, + .gpc_name = "lcdif2", + .rst_mask = BIT(11) | BIT(12) | BIT(24), + .clk_mask = BIT(11) | BIT(12) | BIT(24), + }, + [IMX8MP_MEDIABLK_PD_ISP] = { + .name = "mediablk-isp", + .clk_names = (const char *[]){ "isp", "axi", "apb" }, + .num_clks = 3, + .gpc_name = "isp", + .rst_mask = BIT(16) | BIT(17) | BIT(18), + .clk_mask = BIT(16) | BIT(17) | BIT(18), + }, + [IMX8MP_MEDIABLK_PD_DWE] = { + .name = "mediablk-dwe", + .clk_names = (const char *[]){ "axi", "apb" }, + .num_clks = 2, + .gpc_name = "dwe", + .rst_mask = BIT(19) | BIT(20) | BIT(21), + .clk_mask = BIT(19) | BIT(20) | BIT(21), + }, + [IMX8MP_MEDIABLK_PD_MIPI_DSI_2] = { + .name = "mediablk-mipi-dsi-2", + .clk_names = (const char *[]){ "phy", }, + .num_clks = 1, + .gpc_name = "mipi-dsi2", + .rst_mask = BIT(22), + .clk_mask = BIT(22), + .mipi_phy_rst_mask = BIT(29), + }, +}; + +static const struct imx8m_blk_ctrl_data imx8mp_media_blk_ctl_dev_data = { + .max_reg = 0x138, + .domains = imx8mp_media_blk_ctl_domain_data, + .num_domains = ARRAY_SIZE(imx8mp_media_blk_ctl_domain_data), + .bus_rst_mask = BIT(8), + .bus_clk_mask = BIT(8), +}; + +static const struct udevice_id imx8m_blk_ctrl_ids[] = { + {.compatible = "fsl,imx8mm-disp-blk-ctrl", .data = (ulong)&imx8mm_disp_blk_ctl_dev_data}, + {.compatible = "fsl,imx8mn-disp-blk-ctrl", .data = (ulong)&imx8mn_disp_blk_ctl_dev_data}, + {.compatible = "fsl,imx8mp-media-blk-ctrl", .data = (ulong)&imx8mp_media_blk_ctl_dev_data}, + {} +}; + +struct power_domain_ops imx8m_blk_ctrl_ops = { + .request = imx8m_blk_ctrl_request, + .rfree = imx8m_blk_ctrl_free, + .on = imx8m_blk_ctrl_power_on, + .off = imx8m_blk_ctrl_power_off, +}; + +U_BOOT_DRIVER(imx8m_blk_ctrl) = { + .name = "imx8m_blk_ctrl", + .id = UCLASS_POWER_DOMAIN, + .of_match = imx8m_blk_ctrl_ids, + .bind = dm_scan_fdt_dev, + .probe = imx8m_blk_ctrl_probe, + .remove = imx8m_blk_ctrl_remove, + .priv_auto = sizeof(struct imx8m_blk_ctrl), + .ops = &imx8m_blk_ctrl_ops, + .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF, +}; diff --git a/drivers/power/domain/imx8m-power-domain.c b/drivers/power/domain/imx8m-power-domain.c index 8b6870c86463..40fec70d954a 100644 --- a/drivers/power/domain/imx8m-power-domain.c +++ b/drivers/power/domain/imx8m-power-domain.c @@ -32,17 +32,31 @@ DECLARE_GLOBAL_DATA_PTR; #define IMX8M_OTG1_A53_DOMAIN BIT(4) #define IMX8M_PCIE1_A53_DOMAIN BIT(3) +#define IMX8MM_VPUH1_A53_DOMAIN BIT(15) +#define IMX8MM_VPUG2_A53_DOMAIN BIT(14) +#define IMX8MM_VPUG1_A53_DOMAIN BIT(13) +#define IMX8MM_DISPMIX_A53_DOMAIN BIT(12) +#define IMX8MM_VPUMIX_A53_DOMAIN BIT(10) +#define IMX8MM_GPUMIX_A53_DOMAIN BIT(9) +#define IMX8MM_GPU_A53_DOMAIN (BIT(8) | BIT(11)) +#define IMX8MM_DDR1_A53_DOMAIN BIT(7) #define IMX8MM_OTG2_A53_DOMAIN BIT(5) #define IMX8MM_OTG1_A53_DOMAIN BIT(4) #define IMX8MM_PCIE_A53_DOMAIN BIT(3) +#define IMX8MM_MIPI_A53_DOMAIN BIT(2) +#define IMX8MN_DISPMIX_A53_DOMAIN BIT(12) +#define IMX8MN_GPUMIX_A53_DOMAIN BIT(9) +#define IMX8MN_DDR1_A53_DOMAIN BIT(7) #define IMX8MN_OTG1_A53_DOMAIN BIT(4) #define IMX8MN_MIPI_A53_DOMAIN BIT(2) #define IMX8MP_HSIOMIX_A53_DOMAIN BIT(19) +#define IMX8MP_MEDIAMIX_A53_DOMAIN BIT(12) #define IMX8MP_USB2_PHY_A53_DOMAIN BIT(5) #define IMX8MP_USB1_PHY_A53_DOMAIN BIT(4) #define IMX8MP_PCIE_PHY_A53_DOMAIN BIT(3) +#define IMX8MP_MIPI_PHY1_A53_DOMAIN BIT(2) #define IMX8MP_GPC_PU_PGC_SW_PUP_REQ 0x0d8 #define IMX8MP_GPC_PU_PGC_SW_PDN_REQ 0x0e4 @@ -50,35 +64,72 @@ DECLARE_GLOBAL_DATA_PTR; #define GPC_PU_PGC_SW_PUP_REQ 0x0f8 #define GPC_PU_PGC_SW_PDN_REQ 0x104 +#define IMX8M_PCIE2_SW_Pxx_REQ BIT(13) +#define IMX8M_MIPI_CSI2_SW_Pxx_REQ BIT(12) +#define IMX8M_MIPI_CSI1_SW_Pxx_REQ BIT(11) +#define IMX8M_DISP_SW_Pxx_REQ BIT(10) +#define IMX8M_HDMI_SW_Pxx_REQ BIT(9) +#define IMX8M_VPU_SW_Pxx_REQ BIT(8) +#define IMX8M_GPU_SW_Pxx_REQ BIT(7) +#define IMX8M_DDR2_SW_Pxx_REQ BIT(6) +#define IMX8M_DDR1_SW_Pxx_REQ BIT(5) #define IMX8M_PCIE2_SW_Pxx_REQ BIT(13) #define IMX8M_OTG2_SW_Pxx_REQ BIT(3) #define IMX8M_OTG1_SW_Pxx_REQ BIT(2) #define IMX8M_PCIE1_SW_Pxx_REQ BIT(1) +#define IMX8MM_VPUH1_SW_Pxx_REQ BIT(13) +#define IMX8MM_VPUG2_SW_Pxx_REQ BIT(12) +#define IMX8MM_VPUG1_SW_Pxx_REQ BIT(11) +#define IMX8MM_DISPMIX_SW_Pxx_REQ BIT(10) +#define IMX8MM_VPUMIX_SW_Pxx_REQ BIT(8) +#define IMX8MM_GPUMIX_SW_Pxx_REQ BIT(7) +#define IMX8MM_GPU_SW_Pxx_REQ (BIT(6) | BIT(9)) +#define IMX8MM_DDR1_SW_Pxx_REQ BIT(5) #define IMX8MM_OTG2_SW_Pxx_REQ BIT(3) #define IMX8MM_OTG1_SW_Pxx_REQ BIT(2) #define IMX8MM_PCIE_SW_Pxx_REQ BIT(1) +#define IMX8MM_MIPI_SW_Pxx_REQ BIT(0) +#define IMX8MN_DISPMIX_SW_Pxx_REQ BIT(10) +#define IMX8MN_GPUMIX_SW_Pxx_REQ BIT(7) +#define IMX8MN_DDR1_SW_Pxx_REQ BIT(5) #define IMX8MN_OTG1_SW_Pxx_REQ BIT(2) #define IMX8MN_MIPI_SW_Pxx_REQ BIT(0) #define IMX8MP_HSIOMIX_Pxx_REQ BIT(17) +#define IMX8MP_MEDIMIX_Pxx_REQ BIT(10) #define IMX8MP_USB2_PHY_Pxx_REQ BIT(3) #define IMX8MP_USB1_PHY_Pxx_REQ BIT(2) #define IMX8MP_PCIE_PHY_SW_Pxx_REQ BIT(1) +#define IMX8MP_MIPI_PHY1_SW_Pxx_REQ BIT(0) #define GPC_M4_PU_PDN_FLG 0x1bc #define IMX8MP_GPC_PU_PWRHSK 0x190 #define GPC_PU_PWRHSK 0x1fc +#define IMX8MM_GPUMIX_HSK_PWRDNACKN BIT(29) +#define IMX8MM_GPU_HSK_PWRDNACKN (BIT(27) | BIT(28)) +#define IMX8MM_VPUMIX_HSK_PWRDNACKN BIT(26) +#define IMX8MM_DISPMIX_HSK_PWRDNACKN BIT(25) #define IMX8MM_HSIO_HSK_PWRDNACKN (BIT(23) | BIT(24)) +#define IMX8MM_GPUMIX_HSK_PWRDNREQN BIT(11) +#define IMX8MM_GPU_HSK_PWRDNREQN (BIT(9) | BIT(10)) +#define IMX8MM_VPUMIX_HSK_PWRDNREQN BIT(8) +#define IMX8MM_DISPMIX_HSK_PWRDNREQN BIT(7) #define IMX8MM_HSIO_HSK_PWRDNREQN (BIT(5) | BIT(6)) +#define IMX8MN_GPUMIX_HSK_PWRDNACKN (BIT(29) | BIT(27)) +#define IMX8MN_DISPMIX_HSK_PWRDNACKN BIT(25) #define IMX8MN_HSIO_HSK_PWRDNACKN BIT(23) +#define IMX8MN_GPUMIX_HSK_PWRDNREQN (BIT(11) | BIT(9)) +#define IMX8MN_DISPMIX_HSK_PWRDNREQN BIT(7) #define IMX8MN_HSIO_HSK_PWRDNREQN BIT(5) +#define IMX8MP_MEDIAMIX_PWRDNACKN BIT(30) #define IMX8MP_HSIOMIX_PWRDNACKN BIT(28) +#define IMX8MP_MEDIAMIX_PWRDNREQN BIT(14) #define IMX8MP_HSIOMIX_PWRDNREQN BIT(12) /* @@ -92,15 +143,31 @@ DECLARE_GLOBAL_DATA_PTR; #define IMX8M_PGC_OTG2 19 #define IMX8M_PGC_PCIE2 29 +#define IMX8MM_PGC_MIPI 16 #define IMX8MM_PGC_PCIE 17 #define IMX8MM_PGC_OTG1 18 #define IMX8MM_PGC_OTG2 19 - +#define IMX8MM_PGC_DDR1 21 +#define IMX8MM_PGC_GPU2D 22 +#define IMX8MM_PGC_GPUMIX 23 +#define IMX8MM_PGC_VPUMIX 24 +#define IMX8MM_PGC_GPU3D 25 +#define IMX8MM_PGC_DISPMIX 26 +#define IMX8MM_PGC_VPUG1 27 +#define IMX8MM_PGC_VPUG2 28 +#define IMX8MM_PGC_VPUH1 29 + +#define IMX8MN_PGC_MIPI 16 #define IMX8MN_PGC_OTG1 18 +#define IMX8MN_PGC_DDR1 21 +#define IMX8MN_PGC_GPUMIX 23 +#define IMX8MN_PGC_DISPMIX 26 +#define IMX8MP_PGC_MIPI1 12 #define IMX8MP_PGC_PCIE 13 #define IMX8MP_PGC_USB1 14 #define IMX8MP_PGC_USB2 15 +#define IMX8MP_PGC_MEDIAMIX 22 #define IMX8MP_PGC_HSIOMIX 29 #define GPC_PGC_CTRL(n) (0x800 + (n) * 0x40) @@ -142,6 +209,7 @@ struct imx8m_power_domain_plat { void __iomem *base; int resource_id; int has_pd; + int count; }; #if defined(CONFIG_IMX8MM) || defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MQ) @@ -230,6 +298,82 @@ static const struct imx_pgc_domain imx8mm_pgc_domains[] = { }, .pgc = BIT(IMX8MM_PGC_OTG2), }, + + [IMX8MM_POWER_DOMAIN_GPUMIX] = { + .bits = { + .pxx = IMX8MM_GPUMIX_SW_Pxx_REQ, + .map = IMX8MM_GPUMIX_A53_DOMAIN, + .hskreq = IMX8MM_GPUMIX_HSK_PWRDNREQN, + .hskack = IMX8MM_GPUMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_GPUMIX), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_GPU] = { + .bits = { + .pxx = IMX8MM_GPU_SW_Pxx_REQ, + .map = IMX8MM_GPU_A53_DOMAIN, + .hskreq = IMX8MM_GPU_HSK_PWRDNREQN, + .hskack = IMX8MM_GPU_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_GPU2D) | BIT(IMX8MM_PGC_GPU3D), + }, + + [IMX8MM_POWER_DOMAIN_VPUMIX] = { + .bits = { + .pxx = IMX8MM_VPUMIX_SW_Pxx_REQ, + .map = IMX8MM_VPUMIX_A53_DOMAIN, + .hskreq = IMX8MM_VPUMIX_HSK_PWRDNREQN, + .hskack = IMX8MM_VPUMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_VPUMIX), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_VPUG1] = { + .bits = { + .pxx = IMX8MM_VPUG1_SW_Pxx_REQ, + .map = IMX8MM_VPUG1_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_VPUG1), + }, + + [IMX8MM_POWER_DOMAIN_VPUG2] = { + .bits = { + .pxx = IMX8MM_VPUG2_SW_Pxx_REQ, + .map = IMX8MM_VPUG2_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_VPUG2), + }, + + [IMX8MM_POWER_DOMAIN_VPUH1] = { + .bits = { + .pxx = IMX8MM_VPUH1_SW_Pxx_REQ, + .map = IMX8MM_VPUH1_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_VPUH1), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_DISPMIX] = { + .bits = { + .pxx = IMX8MM_DISPMIX_SW_Pxx_REQ, + .map = IMX8MM_DISPMIX_A53_DOMAIN, + .hskreq = IMX8MM_DISPMIX_HSK_PWRDNREQN, + .hskack = IMX8MM_DISPMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_DISPMIX), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_MIPI] = { + .bits = { + .pxx = IMX8MM_MIPI_SW_Pxx_REQ, + .map = IMX8MM_MIPI_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_MIPI), + }, }; static const struct imx_pgc_domain_data imx8mm_pgc_domain_data = { @@ -258,6 +402,36 @@ static const struct imx_pgc_domain imx8mn_pgc_domains[] = { }, .pgc = BIT(IMX8MN_PGC_OTG1), }, + + [IMX8MN_POWER_DOMAIN_GPUMIX] = { + .bits = { + .pxx = IMX8MN_GPUMIX_SW_Pxx_REQ, + .map = IMX8MN_GPUMIX_A53_DOMAIN, + .hskreq = IMX8MN_GPUMIX_HSK_PWRDNREQN, + .hskack = IMX8MN_GPUMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MN_PGC_GPUMIX), + .keep_clocks = true, + }, + + [IMX8MN_POWER_DOMAIN_DISPMIX] = { + .bits = { + .pxx = IMX8MN_DISPMIX_SW_Pxx_REQ, + .map = IMX8MN_DISPMIX_A53_DOMAIN, + .hskreq = IMX8MN_DISPMIX_HSK_PWRDNREQN, + .hskack = IMX8MN_DISPMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MN_PGC_DISPMIX), + .keep_clocks = true, + }, + + [IMX8MN_POWER_DOMAIN_MIPI] = { + .bits = { + .pxx = IMX8MN_MIPI_SW_Pxx_REQ, + .map = IMX8MN_MIPI_A53_DOMAIN, + }, + .pgc = BIT(IMX8MN_PGC_MIPI), + }, }; static const struct imx_pgc_domain_data imx8mn_pgc_domain_data = { @@ -268,7 +442,15 @@ static const struct imx_pgc_domain_data imx8mn_pgc_domain_data = { #endif #ifdef CONFIG_IMX8MP -static const struct imx_pgc_domain imx8mp_pgc_domains[] = { +static const struct imx_pgc_domain imx8mp_pgc_domains[19] = { + [IMX8MP_POWER_DOMAIN_MIPI_PHY1] = { + .bits = { + .pxx = IMX8MP_MIPI_PHY1_SW_Pxx_REQ, + .map = IMX8MP_MIPI_PHY1_A53_DOMAIN, + }, + .pgc = BIT(IMX8MP_PGC_MIPI1), + }, + [IMX8MP_POWER_DOMAIN_PCIE_PHY] = { .bits = { .pxx = IMX8MP_PCIE_PHY_SW_Pxx_REQ, @@ -293,6 +475,17 @@ static const struct imx_pgc_domain imx8mp_pgc_domains[] = { .pgc = BIT(IMX8MP_PGC_USB2), }, + [IMX8MP_POWER_DOMAIN_MEDIAMIX] = { + .bits = { + .pxx = IMX8MP_MEDIMIX_Pxx_REQ, + .map = IMX8MP_MEDIAMIX_A53_DOMAIN, + .hskreq = IMX8MP_MEDIAMIX_PWRDNREQN, + .hskack = IMX8MP_MEDIAMIX_PWRDNACKN, + }, + .pgc = BIT(IMX8MP_PGC_MEDIAMIX), + .keep_clocks = true, + }, + [IMX8MP_POWER_DOMAIN_HSIOMIX] = { .bits = { .pxx = IMX8MP_HSIOMIX_Pxx_REQ, @@ -329,6 +522,11 @@ static int imx8m_power_domain_on(struct power_domain *power_domain) u32 pgc; int ret; + if (pdata->count > 0) { /* Already on */ + pdata->count++; + return 0; + } + if (pdata->clk.count) { ret = clk_enable_bulk(&pdata->clk); if (ret) { @@ -373,6 +571,8 @@ static int imx8m_power_domain_on(struct power_domain *power_domain) if (!domain->keep_clocks && pdata->clk.count) clk_disable_bulk(&pdata->clk); + pdata->count++; + return 0; out_clk_disable: @@ -391,6 +591,13 @@ static int imx8m_power_domain_off(struct power_domain *power_domain) u32 pgc; int ret; + if (!pdata->count) { /* Already off */ + return 0; + } else if (pdata->count > 1) { + pdata->count--; + return 0; + } + /* Enable reset clocks for all devices in the domain */ if (!domain->keep_clocks && pdata->clk.count) { ret = clk_enable_bulk(&pdata->clk); @@ -439,6 +646,8 @@ static int imx8m_power_domain_off(struct power_domain *power_domain) if (pdata->has_pd) power_domain_off(&pdata->pd); + pdata->count--; + return 0; out_clk_disable: From patchwork Fri Sep 13 09:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3477 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E8D07412D2 for ; Fri, 13 Sep 2024 11:57:12 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5c25f015a67sf482812a12.0 for ; Fri, 13 Sep 2024 02:57:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221432; cv=pass; d=google.com; s=arc-20240605; b=HMDmRTCdK8sxluELhnlpT68pJRr2MKe7xTLJEtduUAVAvYctZqi+rWqwSUjnfZUHdp kyFP2EuOI1mTQ4isjAE/Rr2tpEfatZzpdm6I+PZRvjTbjSXtY8lAi+KkHQ0WcOlZNTKQ LmcwlocUrW3Wd1A/sp4t/v9XDU3Fb6znb7pQ7FK6wSTOLgLCXnDBi+ss9TC+QzHvWWmC TU5hdfaBUYwNO1sQd9gWpFseIUkYnjBqAJvgSDWgw857VjPrzNfdCicCFhwU3kbfAgay uhSBflEvU8EA/CgPY1o5zlGSpJHoPrkNpUwTS+zUjnmf20pxkE0E55fPbzXaLFfBQkum NRQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=zDhQo5uNaorlYKZCAQPRsWUOUHe3bQVmk8ZdE25uNfQ=; fh=1vk5QawRjRz6PzuiXAMZX3cFop4e/c7+ANAqaEJru4k=; b=lez/hlPv5XThk9N/bVfU0ExpftMtmOBLxk09I+uB/rPzEqc5S9eZJLZLjZVlqhPaMd zGw3IF8trgAPc+F/9aB+MZjt2fEcAkXAS/YcSssX+Uz/NmFBI0YwOhB4s+GTWLEvF/cy KMTId66OLVYw1Jc5mht6rgl6lNTzXRDqLMPt7WQLYuZHdbxqrBLK5uW/fst3RapEoabL fwtgc2iLM6VqkJ3sWrbP7ZgwnBa8lVVigop64U7MFlopwGBXoAKAFRWJn/urF+poHN1U Wbxe4edSnhVPKMyna5K4cQpHnT5Su9+TrDHc4/eVm4Qoyn8Huw7yzgP5GOKlcZzWTYTw /ntg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Iv/GeZhA"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221432; x=1726826232; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=zDhQo5uNaorlYKZCAQPRsWUOUHe3bQVmk8ZdE25uNfQ=; b=ZXZq0ThWDxbCtRMAfiVUtwTnxG1mvFR037+IJkjrHQ4u1Yf+xljoHOal928uMJZWeD BVUL1q0En9xlm2ZQpOdS2jWA3UXYB9uyHe3LNH+Y5bORMhL35DdxLprN0GdKlWVMyorl /NR6Tpm0sJRnftCFuMRD0oyAcrm6pyj9ARQ5M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221432; x=1726826232; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zDhQo5uNaorlYKZCAQPRsWUOUHe3bQVmk8ZdE25uNfQ=; b=FWsB6AwiCTvOGzSEgCac7pbp6gqujbn26FBCmGm/BhNb95PpTaZq1ilAxxRFt8fT5s 9Y+0YZMtXOJqKl1wouAtp+d5LmaRC6m1kWatrUCnExOJweEZG/s0nI9+4dudi8g4t5ae 3Dl4A/qldobuslWuXtjmW7MzBixePWg5MynJudqwkJWCq1cY/7e3BrIlKigYoh1LNY4o XCLVZV5q6frCIy2KLxf3FMFBw3q27CQ3I5XdVgOfbf59e3Fw7K6vmqrkRjtS7V3dmVrF JndymJJE500Rj5F8b+NaLkpnw2k1bh9OSe6ovsGOyWwhyjydm8SoEHy8JBNkIi6pypz8 erNQ== X-Forwarded-Encrypted: i=2; AJvYcCW09GCkzkkBCCr+u56FWFUIqtqZMosMcUkrNzeJVEJcPN6EUIukgTUhusjNdMkVqgTHi+cFPIOKt/aAEx85@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx2n6x2c3BC+5k+iPCm6MNV5CeE8YcSEvTFdlKMr1RzQDgC7MvY wA+xiK+Dfx43T9WwFy36/8WGyBWvQcVIuDcWez3HlTwhV3FeP35ZCD2JRsv2FrcdrA== X-Google-Smtp-Source: AGHT+IGd4K9ou4DIHfGW0YX9j+J9ZVRKDzjFvtBbwoEun6jqvWff8IQR2jwDqaMajxnBYvpnoHBvdg== X-Received: by 2002:a05:6402:1d4f:b0:5c4:132b:2f62 with SMTP id 4fb4d7f45d1cf-5c41e1ace5cmr1724853a12.28.1726221432497; Fri, 13 Sep 2024 02:57:12 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:50d3:b0:5c4:1370:8039 with SMTP id 4fb4d7f45d1cf-5c414089f70ls134204a12.1.-pod-prod-04-eu; Fri, 13 Sep 2024 02:57:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9hYdrTy3qPoIW6JUhkLPP6tXVTpy7SfCt1JtrngW3K5OdP5kIcwohqEksVyJPt4bAhRsLkzHR0N0hqSrE@amarulasolutions.com X-Received: by 2002:a17:907:3f27:b0:a86:86d7:2890 with SMTP id a640c23a62f3a-a9048109cf3mr152821966b.50.1726221430968; Fri, 13 Sep 2024 02:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221430; cv=none; d=google.com; s=arc-20160816; b=u5i6Ms88asQB8doXSs8e884Us1zfIcNtBQisAMLZmJYeICWfz3k7ex4GElfPGs1+Bo cXV3cC9WOgaapuHRU9XQ7zgUo3VBHSyhqik9+zqur+laCtySW8zAGs/oRyg0pXR7vP6M t6QLFlOiv8m5IwPMOCrvk97z/KBdnV7Y1HSt4mi7oOE9MKulwkB0XT9/8dLtAwqp61fS K9thPfmk87g/Jg3UYsQyltwqsFOWc77aCFgBFFqen65UZcHLyoBHd/0an13Mov10f3RL RSm3F4cXVNYMi+UuPRgfT9DS51Kw+2xBachGKQG7TIHyF4GB18IPUOUYtG8I2pi3cbUb 4N4A== 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=5x3GP+YKQVY12npakM9KZwdv485eryAZdD/Wk+gMeNY=; fh=fCR0Gz8Q57BvNh2Q0V/rHHWcdLW5PkjctrWU8EDyHuQ=; b=K0kQyWrlxLDqyoE/QOhxPqDey296cjcK5Af69EKAxLj10fwFM2G7vT5iOLqVyadGw3 UFSwkB8lH2bLOLCGjHKNxvOoxIfRa+ZvklOAIVc2+ZhAQtetwvqyK8vMHtywoXppay2d FWiglGf6xvrh66UxGXQrJJlg/RkFCCBShgKlZKHM2U11TF1bNoI2EOZxiDGwDeFw6QR1 wv0ehYuNS7EBNoYeQNFXH5E4rVlkY6PPTAhxD0keWAsB47XT281eVD4PRKEzH4TALj5D K2iXY1zw/oxnXATXsKP555dUekek1eQz/4s5p26T7OOMVA6cr+SII87jhqP7X3OfUxO3 WJ8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Iv/GeZhA"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25a44284sor454711866b.12.2024.09.13.02.57.10 for (Google Transport Security); Fri, 13 Sep 2024 02:57:10 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWXN1IjU9pWhYbD1DnYhoIXCGcyKhbz5vWl+8ZIQWiC9tzdhe4YmZvhcv8kuQ/PzZy1dCqbfujqerG3sCyl@amarulasolutions.com X-Received: by 2002:a17:907:d1a:b0:a8d:3338:a48c with SMTP id a640c23a62f3a-a9047b459c1mr164962666b.7.1726221430315; Fri, 13 Sep 2024 02:57:10 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:09 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Ye Li , Dario Binacchi , Anatolij Gustschin , Anton Bambura , Heinrich Schuchardt , =?utf-8?q?Jonas_Schw=C3=B6bel?= , Marek Vasut , Simon Glass , Svyatoslav Ryhel , Tom Rini Subject: [PATCH 09/26] video: Add video link framework Date: Fri, 13 Sep 2024 11:55:51 +0200 Message-ID: <20240913095622.72377-10-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Iv/GeZhA"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi The video link framework bases a port-endpoint gragh in DTB to connect the video components in uclass like: video, display, bridge, and panel. Using the port-endpoint gragh, we manage multiple video link and user can select one of them for splash screen. Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- common/stdio.c | 4 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/video_link.c | 529 +++++++++++++++++++++++++++++++++++++ include/video_link.h | 19 ++ 5 files changed, 559 insertions(+) create mode 100644 drivers/video/video_link.c create mode 100644 include/video_link.h diff --git a/common/stdio.c b/common/stdio.c index a61220ce4b9c..66360c97ed12 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -340,6 +341,9 @@ int stdio_add_devices(void) struct udevice *vdev; int ret; + if (IS_ENABLED(CONFIG_VIDEO_LINK)) + video_link_init(); + if (!IS_ENABLED(CONFIG_SYS_CONSOLE_IS_IN_ENV)) { for (ret = uclass_first_device_check(UCLASS_VIDEO, &vdev); diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 6e79694fd192..cafdc15f9fe2 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -833,6 +833,12 @@ config VIDEO_SEPS525 source "drivers/video/zynqmp/Kconfig" source "drivers/video/nexell/Kconfig" +config VIDEO_LINK + bool "Enable video link framework support" + help + This option enables a video link framework basing on port-endpoint graph + to connect video components. + config CONSOLE_SCROLL_LINES int "Number of lines to scroll the console by" default 1 diff --git a/drivers/video/Makefile b/drivers/video/Makefile index f3f70cd04a17..9fd3645994f1 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_$(SPL_TPL_)SIMPLE_PANEL) += simple_panel.o obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.o obj-$(CONFIG_$(SPL_TPL_)BMP) += bmp.o +obj-$(CONFIG_VIDEO_LINK) += video_link.o endif obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_backlight.o diff --git a/drivers/video/video_link.c b/drivers/video/video_link.c new file mode 100644 index 000000000000..001a759faab9 --- /dev/null +++ b/drivers/video/video_link.c @@ -0,0 +1,529 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 NXP + * + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +struct of_endpoint { + unsigned int port; + unsigned int id; + ofnode local_node; +}; + +#define MAX_LINKS 3 +#define MAX_LINK_DEVICES 5 + +struct video_link { + struct udevice *link_devs[MAX_LINK_DEVICES]; + int dev_num; +}; + +struct video_link video_links[MAX_LINKS]; +struct video_link temp_stack; +ulong video_links_num; +ulong curr_video_link; +bool video_off; + +ofnode ofnode_get_child_by_name(ofnode parent, const char *name) +{ + ofnode child; + const char *child_name; + + for (child = ofnode_first_subnode(parent); + ofnode_valid(child); + child = ofnode_next_subnode(child)) { + child_name = ofnode_get_name(child); + + if (!strncmp(child_name, name, strlen(name))) + break; + } + return child; +} + +ofnode ofnode_graph_get_next_endpoint(ofnode parent, + ofnode prev) +{ + ofnode endpoint; + ofnode port; + const char *name; + + if (!ofnode_valid(prev)) { + ofnode node; + + node = ofnode_find_subnode(parent, "ports"); + if (ofnode_valid(node)) + parent = node; + + port = ofnode_get_child_by_name(parent, "port"); + if (!ofnode_valid(port)) { + debug("no port node found in 0x%lx\n", parent.of_offset); + return ofnode_null(); + } + + endpoint = ofnode_first_subnode(port); + if (ofnode_valid(endpoint)) { + debug("get next endpoint %s\n", ofnode_get_name(endpoint)); + return endpoint; + } + } else { + port = ofnode_get_parent(prev); + endpoint = ofnode_next_subnode(prev); + if (ofnode_valid(endpoint)) { + debug("get next endpoint %s\n", ofnode_get_name(endpoint)); + return endpoint; + } + } + + debug("port %s\n", ofnode_get_name(port)); + + while (1) { + do { + port = ofnode_next_subnode(port); + if (!ofnode_valid(port)) + return ofnode_null(); + + name = ofnode_get_name(port); + } while (strncmp(name, "port", 4)); + + /* + * Now that we have a port node, get the next endpoint by + * getting the next child. If the previous endpoint is NULL this + * will return the first child. + */ + endpoint = ofnode_first_subnode(port); + if (ofnode_valid(endpoint)) { + debug("get next endpoint %s\n", ofnode_get_name(endpoint)); + return endpoint; + } + } + + return ofnode_null(); +} + +#define for_each_endpoint_of_node(parent, child) \ + for (child = ofnode_graph_get_next_endpoint(parent, ofnode_null()); ofnode_valid(child); \ + child = ofnode_graph_get_next_endpoint(parent, child)) + +int ofnode_graph_get_endpoint_count(ofnode node) +{ + ofnode endpoint; + int num = 0; + + for_each_endpoint_of_node(node, endpoint) + num++; + + return num; +} + +int ofnode_graph_parse_endpoint(ofnode node, + struct of_endpoint *endpoint) +{ + ofnode port_node = ofnode_get_parent(node); + + memset(endpoint, 0, sizeof(*endpoint)); + + endpoint->local_node = node; + /* + * It doesn't matter whether the two calls below succeed. + * If they don't then the default value 0 is used. + */ + ofnode_read_u32(port_node, "reg", &endpoint->port); + ofnode_read_u32(node, "reg", &endpoint->id); + + return 0; +} + +ofnode ofnode_graph_get_endpoint_by_regs(const ofnode parent, + int port_reg, int reg) +{ + struct of_endpoint endpoint; + ofnode node; + + for_each_endpoint_of_node(parent, node) { + ofnode_graph_parse_endpoint(node, &endpoint); + if (((port_reg == -1) || endpoint.port == port_reg) && + ((reg == -1) || endpoint.id == reg)) { + debug("get node %s\n", ofnode_get_name(node)); + + return node; + } + } + + return ofnode_null(); +} + +ofnode ofnode_graph_get_remote_endpoint(ofnode node) +{ + ofnode remote; + u32 phandle; + int ret; + + ret = ofnode_read_u32(node, "remote-endpoint", &phandle); + if (ret) { + printf("required remote-endpoint property isn't provided\n"); + return ofnode_null(); + } + + remote = ofnode_get_by_phandle(phandle); + if (!ofnode_valid(remote)) { + printf("failed to find remote-endpoint\n"); + return ofnode_null(); + } + + return remote; +} + +ofnode ofnode_graph_get_port_parent(ofnode node) +{ + unsigned int depth; + + if (!ofnode_valid(node)) + return ofnode_null(); + + /* + * Preserve usecount for passed in node as of_get_next_parent() + * will do of_node_put() on it. + */ + + /* Walk 3 levels up only if there is 'ports' node. */ + for (depth = 3; depth && ofnode_valid(node); depth--) { + node = ofnode_get_parent(node); + const char *name = ofnode_get_name(node); + + if (depth == 2 && strcmp(name, "ports")) + break; + } + return node; +} + +ofnode ofnode_graph_get_remote_port_parent(ofnode node) +{ + ofnode np, pp; + + /* Get remote endpoint node. */ + np = ofnode_graph_get_remote_endpoint(node); + + pp = ofnode_graph_get_port_parent(np); + + return pp; +} + +int find_device_by_ofnode(ofnode node, struct udevice **pdev) +{ + int ret; + + if (!ofnode_is_enabled(node)) + return -2; + + ret = uclass_find_device_by_ofnode(UCLASS_DISPLAY, node, pdev); + if (!ret) + return 0; + + ret = uclass_find_device_by_ofnode(UCLASS_DSI_HOST, node, pdev); + if (!ret) + return 0; + + ret = uclass_find_device_by_ofnode(UCLASS_VIDEO_BRIDGE, node, pdev); + if (!ret) + return 0; + + ret = uclass_find_device_by_ofnode(UCLASS_PANEL, node, pdev); + if (!ret) + return 0; + + return -1; +} + +static void video_link_stack_push(struct udevice *dev) +{ + if (temp_stack.dev_num < MAX_LINK_DEVICES) { + temp_stack.link_devs[temp_stack.dev_num] = dev; + temp_stack.dev_num++; + } +} + +static void video_link_stack_pop(void) +{ + if (temp_stack.dev_num > 0) { + temp_stack.link_devs[temp_stack.dev_num] = NULL; + temp_stack.dev_num--; + } +} + +static int duplicate_video_link(void) +{ + if (video_links_num < MAX_LINKS) { + video_links[video_links_num] = temp_stack; + video_links_num++; + + debug("duplicate links num %lu, temp_stack num %d\n", + video_links_num, temp_stack.dev_num); + return 0; + } + + return -ENODEV; +} + +static void video_link_add_node(struct udevice *peer_dev, struct udevice *dev, ofnode dev_node) +{ + int ret = 0; + ofnode remote, endpoint_node; + struct udevice *remote_dev; + bool find = false; + + debug("endpoint cnt %d\n", ofnode_graph_get_endpoint_count(dev_node)); + + video_link_stack_push(dev); + + for_each_endpoint_of_node(dev_node, endpoint_node) { + remote = ofnode_graph_get_remote_port_parent(endpoint_node); + if (!ofnode_valid(remote)) + continue; + + debug("remote %s\n", ofnode_get_name(remote)); + ret = find_device_by_ofnode(remote, &remote_dev); + if (!ret) { + debug("remote dev %s\n", remote_dev->name); + + if (peer_dev && peer_dev == remote_dev) + continue; + + /* it is possible that ofnode of remote_dev is not equal to remote */ + video_link_add_node(dev, remote_dev, remote); + + find = true; + } + } + + /* leaf node or no valid new endpoint, now copy the entire stack to a new video link */ + if (!find) { + ret = duplicate_video_link(); + if (ret) + printf("video link is full\n"); + } + + video_link_stack_pop(); +} + +struct udevice *video_link_get_next_device(struct udevice *curr_dev) +{ + int i, ret; + + if (video_off) + return NULL; + + if (curr_video_link >= video_links_num) { + printf("current video link is not correct\n"); + return NULL; + } + + for (i = 0; i < video_links[curr_video_link].dev_num; i++) { + if (video_links[curr_video_link].link_devs[i] == curr_dev) { + if ((i + 1) < video_links[curr_video_link].dev_num) { + ret = device_probe(video_links[curr_video_link].link_devs[i + 1]); + if (ret) { + printf("probe device is failed, ret %d\n", ret); + return NULL; + } + + return video_links[curr_video_link].link_devs[i + 1]; + } + + debug("fail to find next device, already last one\n"); + return NULL; + } + } + + return NULL; +} + +struct udevice *video_link_get_video_device(void) +{ + int ret; + + if (video_off) + return NULL; + + if (curr_video_link >= video_links_num) + return NULL; + + if (video_links[curr_video_link].dev_num == 0) + return NULL; + + ret = device_probe(video_links[curr_video_link].link_devs[0]); + if (ret) { + printf("probe video device failed, ret %d\n", ret); + return NULL; + } + + return video_links[curr_video_link].link_devs[0]; +} + +int video_link_get_display_timings(struct display_timing *timings) +{ + int i = 0; + int ret; + struct udevice *dev; + + if (video_off) + return -EPERM; + + if (curr_video_link >= video_links_num) + return -ENODEV; + + if (video_links[curr_video_link].dev_num == 0) + return -ENODEV; + + for (i = video_links[curr_video_link].dev_num - 1; i >= 0 ; i--) { + dev = video_links[curr_video_link].link_devs[i]; + if (device_get_uclass_id(dev) == UCLASS_PANEL) { + ret = device_probe(video_links[curr_video_link].link_devs[i]); + if (ret) { + printf("fail to probe panel device %s\n", dev->name); + return ret; + } + + ret = panel_get_display_timing(dev, timings); + if (ret) { + ret = ofnode_decode_display_timing(dev_ofnode(dev), 0, timings); + if (ret) { + printf("fail to get panel timing %s\n", dev->name); + return ret; + } + } + + return 0; + } else if (device_get_uclass_id(dev) == UCLASS_DISPLAY || + device_get_uclass_id(dev) == UCLASS_VIDEO) { + ret = ofnode_decode_display_timing(dev_ofnode(dev), 0, timings); + if (!ret) + return 0; + } + } + + return -EINVAL; +} + +static void list_videolink(bool current_only) +{ + ulong index = 0; + int j; + bool match; + + /* dump the link */ + debug("video link number: %lu\n", video_links_num); + + for (index = 0; index < video_links_num; index++) { + match = false; + if (curr_video_link == index) + match = true; + else if (current_only) + continue; + + printf("[%c]-Video Link %lu", (match) ? '*' : ' ', index); + + if (match) { + struct udevice *video_dev = video_link_get_video_device(); + + if (video_dev) { + printf(" (%u x %u)", video_get_xsize(video_dev), + video_get_ysize(video_dev)); + } + } + + printf("\n"); + + for (j = 0; j < video_links[index].dev_num; j++) { + printf("\t[%d] %s, %s\n", j, video_links[index].link_devs[j]->name, + dev_get_uclass_name(video_links[index].link_devs[j])); + } + } +} + +static int do_videolink(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) +{ + char cmd = 'l'; + int ret = 0; + + if (argc > 1) + cmd = argv[1][0]; + + switch (cmd) { + case 'l': /* list */ + list_videolink(false); + break; + default: + ret = CMD_RET_USAGE; + break; + } + + return ret; +} + +int video_link_init(void) +{ + struct udevice *dev; + ulong env_id; + int off; + + memset(&video_links, 0, sizeof(video_links)); + memset(&temp_stack, 0, sizeof(temp_stack)); + + for (uclass_find_first_device(UCLASS_VIDEO, &dev); + dev; + uclass_find_next_device(&dev)) { + video_link_add_node(NULL, dev, dev_ofnode(dev)); + } + + if (video_links_num == 0) { + printf("Fail to setup video link\n"); + return -ENODEV; + } + + /* Read the env variable for default video link */ + off = env_get_yesno("video_off"); + if (off == 1) { + video_off = true; + return 0; + } + + env_id = env_get_ulong("video_link", 10, 0); + if (env_id < video_links_num) + curr_video_link = env_id; + + list_videolink(true); + + return 0; +} + +int video_link_shut_down(void) +{ + struct udevice *video_dev = video_link_get_video_device(); + + if (video_dev) + device_remove(video_dev, DM_REMOVE_NORMAL); + + return 0; +} + +#if CONFIG_IS_ENABLED(SYS_LONGHELP) +static char video_link_help_text[] = + "list\n" + " - show video link info, set video_link variable to select link"; +#endif + +U_BOOT_CMD(videolink, 5, 1, do_videolink, + "list and select video link", video_link_help_text +); diff --git a/include/video_link.h b/include/video_link.h new file mode 100644 index 000000000000..5350bfa9e9d1 --- /dev/null +++ b/include/video_link.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + */ + +#ifndef __VIDEO_LINK +#define __VIDEO_LINK + +int video_link_init(void); + +int video_link_shut_down(void); + +struct udevice *video_link_get_next_device(struct udevice *curr_dev); + +struct udevice *video_link_get_video_device(void); + +int video_link_get_display_timings(struct display_timing *timings); + +#endif From patchwork Fri Sep 13 09:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3478 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3211F412C3 for ; Fri, 13 Sep 2024 11:57:14 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5c25cf44030sf1202665a12.0 for ; Fri, 13 Sep 2024 02:57:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221434; cv=pass; d=google.com; s=arc-20240605; b=hKW3rQXzJx1yJuzVLyG1+RvqbWngU2yf4t1R9Y4D/ByBtcVscwDETThl3ortgKE5oo c7SViolnjDbeQzatO4DbMJi89/2L/Xh9bLUcBj56g01M9dV67LKbFdjRusCpb0NbIqNs 3zsvO3ZKNKiuZQl1oG4WLucdfloSRYT/f3l8L9qf60jGqtYjf+8WbgDPYVxktkaO6WD4 WCZ4RbLSe2S4dmY14fdKO50KQBgrz3RI5PuswTif9henNmDkFKFm2Ad6QBiJw2/1tlYI DJo0pxuWUxPcTdbipQ2ASDbsIVUNR889OwZeqVlnpq8f8MRmHqCLKh+2348Z6BBceXKa 66BQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=zbA3bhKgzT2GIl70JQXZLMSeIhsAnZHbOr3Zjf6ftJM=; fh=X/IOgz6F1CZDF0UTR4hb4hFfFy2xXnj6XlhK36WB2UQ=; b=Ou0ZBBlvbil/kEE/UYmWOxWH1MlXd0NjyiWgLTzLuXMfZW2y4XrnyvTR+BY1kiqu02 WuZM2FfJGZNdKwSUnbtjeYQzRuyS5YUOjBp7ql3KAvRR/eJH9x5Tzup5fM2bP8UPfD1I 9uz2LT3KtPWARzmL1pndOrC9pHyKCc3+kyUMaSB+XG62Z97xXPzfYjf9KQYDLgp3IIQJ oaxFvlx5Kuu8Nk1smhp2Ob1iC2tzMlC34WF03wXNtAwJjeBJYbT4T/GiJspFHxZAf933 k2b332wFPajJlZcEHpjRyooetClgUd2VIVeoJxzEhvKjUlGjREkIegPgb4AWwa8C1FFa CTsw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EoZ76suQ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221434; x=1726826234; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=zbA3bhKgzT2GIl70JQXZLMSeIhsAnZHbOr3Zjf6ftJM=; b=YF4inTq/pbP8UwBtyMekpGdWBkNidaMtNr01/HA9foRrVzn7SpaSP2f3iKcbW+Mm5w PKZmip59lD4tU98uaIphxWOsMpLUnICP9prNWqElxVANpXffSgG6mWpvoOro9TmdYZWC DSxBEztlyGzqKQWL2M4Sye4aMPZJgc63OUiO4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221434; x=1726826234; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zbA3bhKgzT2GIl70JQXZLMSeIhsAnZHbOr3Zjf6ftJM=; b=IqQTy4W3Jql8Dn7clxsW7IVAoSVrWoJS/3n/9dMkdLXPyYgtDYJCXafkid4/WVjNTZ oz7MsLTmStXTxUABC6vUZ5mRgGqo/uZFfvVPomfzml32bKWOV3lxUZ86p7YnZMRBnrhN j6/1wrD/8sN3vYUQV63EvKhqJCXL5Q+mgJ0nTnExDqGE2QpiVUNnkFE5SIsl7phVFTZc DS/7JGJUeISSzOp54eCBWRGNqFfHCMgirfOMnW/6PLJUaF5A5bNvaOmy9cV3xks1NO1w cl6am57DlaO5y5bS/ZrIjggmrGAkJtI351QNBh3/ZsMzKuLFxGqfXsealnu+zpHisKaD 8+vQ== X-Forwarded-Encrypted: i=2; AJvYcCW5fkwxHQtp1SeXVQPjfI5rco3UgeWiSd0H/egIxM+OmuEi8rBk3Sv+Hzi4uHKbyfvkyvC4NaXGPtJvcTJI@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxNLTaHmgbCKBthKjdMf+HVgPfXwfysnWz0aagsQuJl5CnpEl3R xG92B7WN9VaTSf8YryNqMK768c10yo7xyuM/AmnLr2uAuRBzHY3SMeU2tfuJWp4mcA== X-Google-Smtp-Source: AGHT+IHXgnx4D5pAXMDIuaTM+36HvZlU8fnQpcOwj69YfaLluIZSyHTcsqdh9JLK1RjFJHTNjwLYag== X-Received: by 2002:a05:6402:2805:b0:5c4:a64:e7fc with SMTP id 4fb4d7f45d1cf-5c413e119cfmr4978303a12.13.1726221433751; Fri, 13 Sep 2024 02:57:13 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2685:b0:5be:dded:4357 with SMTP id 4fb4d7f45d1cf-5c41408e81dls608936a12.2.-pod-prod-09-eu; Fri, 13 Sep 2024 02:57:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWGR57AEuJDzJIHbz2J/7HIwZwXP1x8U8hP/cvinHESHsGuii3fJAGkVfFawHvONuyVol4mftGKYZlmk3sr@amarulasolutions.com X-Received: by 2002:a17:907:d59d:b0:a86:78fd:1df0 with SMTP id a640c23a62f3a-a90294d0a7dmr567854566b.34.1726221432111; Fri, 13 Sep 2024 02:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221432; cv=none; d=google.com; s=arc-20160816; b=A1z0b/Ng3Cf20fIBhGc3f5cZcDaTgg6gGbNfdfQAwVzM8l+6Ll0cp8djojloBo8r5h NRYM7kRAy80ZxpvCl1FVKwaTcKZZA3zxfM7RQnMi7rY2gGACiGZCggbZE+/hc517dFiF pH/6JfcMhexCj/yJlQ7Q0UB9nKTcL9odaT31a34MxraPRw7K/zZTIJxw8p9DSbgJAy45 Ii3gaV4aVJQdEK5Rf3rAUzqM7SXWCwwgCv0qKzPY/5fDwxsQf3GhNdOzGkoYte+2mO0J CYxFmeyJsNjl7SrvTrAcpG3LgbH/NLT7d/ZX8areIesa9k+B0ul63J+BTlMLx6psT2pF FXyw== 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=FFRO6COzZ3cv5Gq5S+ZSJewQI2yeUOKQWAgGGqlan8k=; fh=gkhhEFD8CuFOfh/cB0hPSX67PepGDSu/ge4uyfRduNE=; b=dT+ItHU/NTGubnksJ0lAkV9bHQSBGmE6z+nQjm2rwJR7ezn64JaWJz7QM7Z1UzPntY tAhYYdvn+QPBD/Oj7d2UBHXaK7Lo1epRQrBUrrCSaZsQ9Y2KQF6TiJtrlKzNPg8ZOZTh rtDm4VQt/D74+jECjvcqRLqOFVyEz+M4eywr0PAaSuGLLbbWnJ1WYnKBx4VZcy3aMFe/ gcayDSCmEUt+8N4yJEZx6cTZaNlGErQqrW4wKg+6m6myTVtk5xbz5UaaKu8s0T+l/y5t kizrEiVonZVpu0c5fD19SxDhTIPXYIHRA1RKp538bVz+s1bLGA7/YW986vypKCGq5DK8 YeEA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EoZ76suQ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25c2aea9sor449727066b.13.2024.09.13.02.57.12 for (Google Transport Security); Fri, 13 Sep 2024 02:57:12 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCV0EqxlZ93maEmXKNY/MCAFdIJErhRPjB/ztg8zTSkhyPFYu4hwzBOS8V9v5snIYRLmYInw6e3r58N5jNBO@amarulasolutions.com X-Received: by 2002:a17:907:1b05:b0:a72:69e8:f039 with SMTP id a640c23a62f3a-a902941d803mr498746166b.12.1726221431502; Fri, 13 Sep 2024 02:57:11 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:11 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Ye Li , Dario Binacchi , Anatolij Gustschin , Peter Robinson , Tom Rini Subject: [PATCH 10/26] video: bridge: Add check_timing interface Date: Fri, 13 Sep 2024 11:55:52 +0200 Message-ID: <20240913095622.72377-11-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EoZ76suQ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Add new interface check_timing to video bridge uclass. For bridge device who may update timing needs to implement the callback. So host device can sync the timing with the bridge. Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/bridge/video-bridge-uclass.c | 10 ++++++++++ include/video_bridge.h | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index 2084a2e03ee8..7432107238cc 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -48,6 +48,16 @@ int video_bridge_check_attached(struct udevice *dev) return ops->check_attached(dev); } +int video_bridge_check_timing(struct udevice *dev, struct display_timing *timing) +{ + struct video_bridge_ops *ops = video_bridge_get_ops(dev); + + if (ops->check_timing) + return ops->check_timing(dev, timing); + + return 0; +} + int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size) { struct video_bridge_ops *ops = video_bridge_get_ops(dev); diff --git a/include/video_bridge.h b/include/video_bridge.h index 3b429eac578a..8b71b04a1119 100644 --- a/include/video_bridge.h +++ b/include/video_bridge.h @@ -44,6 +44,17 @@ struct video_bridge_ops { */ int (*check_attached)(struct udevice *dev); + /** + * check_timing() - check if the timing need update after the bridge device attached + * + * This method is optional - if not provided then return 0 + * + * @dev: Device to check + * @active: The timing to be checked and updated + * Return: 0 if OK, -ve on error + */ + int (*check_timing)(struct udevice *dev, struct display_timing *timing); + /** * set_backlight() - Set the backlight brightness * @@ -98,6 +109,15 @@ int video_bridge_set_active(struct udevice *dev, bool active); */ int video_bridge_check_attached(struct udevice *dev); +/** + * check_timing() - check if the timing need update after the bridge device attached + * + * @dev: Device to check + * @active: The timing to be checked and updated + * Return: 0 if OK, -ve on error + */ +int video_bridge_check_timing(struct udevice *dev, struct display_timing *timing); + /** * video_bridge_read_edid() - Read information from EDID * From patchwork Fri Sep 13 09:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3479 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 54788411AB for ; Fri, 13 Sep 2024 11:57:15 +0200 (CEST) Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-5366124fe3fsf1744084e87.0 for ; Fri, 13 Sep 2024 02:57:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221435; cv=pass; d=google.com; s=arc-20240605; b=Nnu6vxtZnZcRuMO1vbCUgSSoJKjusLVt608+0dLPoM4guetHEdDoZlahdbJW+leboK xdjwMHTSq4sV7b1G0ItJlXd4VLugNZK5GFTfG5ayx6M1sRjI/YU9eIbou0uLeglils6J uoDc5nyQdVc5BZaf/cdMVDii0siBNgsuziChiKdLZKcZTJ3rQHM8sbSnRWSI4hckg/UH wXVD0ecavXuQmRqMM2tUcV7onKVtwUE54jXy7PdwE+WI1gfGHvoXQmgm9JKdPRHDldON pxEOA9x9eAjgNht6EYJjjG6RW8uLzFA1BeWL+T0yaJf393bZC2AGnPU0MGX//8iXev6a sj4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=UClicEcAVC/CqTMq9B6fjFHwlAS7gSMbuedwX0MrCVo=; fh=chNrxHjLk7vo61n+ry6Y/j9smtFkS8rBoO/S+VAnGdQ=; b=EVMTVUlEHMs5hEL6tYapbJuC+JP58PA2xTjN6a3a94HnH2FAwog+xCLxHJZT+uM+XW YcydZpV+4rMqAIxjSPUuuwBr1CRzj5r5RhkKZeaH2BEZLHXeWblA/4SFkLdJOSdvo7Je JUruC6wwG/0OruX2W8o0p796VU5f8Cl9aAQDjk+XwcLkU496N0PSSP6ofIlQ3AsFCjP9 sSeN99KuxwhAqD8Yk1xD71/3l3Ne4q6Aqfo7Iy3eC3XT8LDw5CAGRCRCf+UPM2/r8+9Z 9CjZlnfA8yh/07y1XPxM+a9w2a4Onk7y9l4a8Ph2q3jkDMkNORJbRn7ROdgqCGhKsuCo 5IAA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qdf34cDy; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221435; x=1726826235; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=UClicEcAVC/CqTMq9B6fjFHwlAS7gSMbuedwX0MrCVo=; b=N7Prvma5D3Ao6Lqb3Vq+zeGEzRLiJmmnKXMWAvAPwir9OXUyHf3HBLQgrTxGbth3un d/erAE5ZWQf+KOqDvxpDIPZwQ6G1fFHqPYhocDfC+pd9t+YkBhFcoBkDb73lJmt2SN5/ Cqy/TortxRgmsSAoOa3fTxRPneeV621lbaMLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221435; x=1726826235; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UClicEcAVC/CqTMq9B6fjFHwlAS7gSMbuedwX0MrCVo=; b=C0DYNpMyb57F3z30VFRWGwehUuBGMR1Vvv99jWfRoiCq1u+Si3cSR0jKTh+bgEB9Gx 0oyQfkL1QcUI/vIlLSUN+DGGL0j8F4yBQ1xvQeEh1QW6YAQxvUAdSKJd8GhDpjaP8td5 m5xgvmEbwVMzw3+NyL7rlFtV4amdqbOnlt4wNFTeTpvQSuXq96oa1Y+RyZeRyn25O/H7 DOkVd70hOXFyyCvRqn21u7YVBzCwVO8s3BO+kZqfD4rZvAvnGpGEtXthzHAOCLA81WYm u1nvx5Tdleg6UwjdxbiYV7JEqhh7kTpb4wysBcL7CLxP3eJMdWwQKOc7CYh+HyFA3MOq IcUg== X-Forwarded-Encrypted: i=2; AJvYcCWARS4nymntgQsbrtvyIgHv8YbAkXCX4PTYnYGic9mU1PY5SfFQA8g7pJ0aKsV5ZoU4cZkJorkuOOG8sjoN@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx6Ll52e4bbGxaJT/ewQYZvEPhIiCIWqT71527DCaLHJUmvLaWq RzX7H2/DMfWds0nNuUi5XbRfBmWoIABKKdXvb1haM9ZwPwlvTD66cXXLn/wU75oehw== X-Google-Smtp-Source: AGHT+IHBUp7MJLj8veUTyEhcYIpsVql6+yGWJlQPYez+vJHpnzKY3KzCKbTAX022h2XZMD7A/76wFg== X-Received: by 2002:a05:6512:10ca:b0:535:6ad6:2d40 with SMTP id 2adb3069b0e04-53678fb7386mr3788185e87.11.1726221434669; Fri, 13 Sep 2024 02:57:14 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:35cc:b0:5c2:7524:8454 with SMTP id 4fb4d7f45d1cf-5c4140908e4ls1351979a12.2.-pod-prod-01-eu; Fri, 13 Sep 2024 02:57:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX/u2zt8MB2CkT1HCWIIj37sqG6nl+CIgd1kVVRlFAHGIemL2dHiHQVaN/RsuYCdEo4uiKmqSvipP5mmVeA@amarulasolutions.com X-Received: by 2002:a17:907:6d14:b0:a8e:a578:2b63 with SMTP id a640c23a62f3a-a902966303amr561931266b.55.1726221433115; Fri, 13 Sep 2024 02:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221433; cv=none; d=google.com; s=arc-20160816; b=itD4c8vNLwotuB0e01N9GNyPyBBFvkR3ZEjE0VfA/iUNU5wSqjvRi7wLVqIgd9myW/ O8fD3bw8XV5tkYswM8OB2s/wPPwgUvj+6r1tJUgIQ+z70pGqyRt32BPTv1Nw8zpA94CM RvfoitSGGhhdgVMc4V+lkqk+71UYDLNzgXDouODAJ3zlF6Mm/38LDE9vcKn+OzrggPHC 2iG/QgwKblh+nJmNP2o8aVFUET9DFLpmuiwM0YAN6nsxP2e867PNtQ7QTsUxpl4cL6Gp Ktn6uWkyKCDfrymgDEm23WpbXdqCySfNWsPLcZyJhWs8EYZZGYHlFJ9bkph2S5eh0o38 rFHg== 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=sxKn7zYHdkKdM/iSFyU24zxOLq0ckhHvTkHpRTNJoDw=; fh=VAw4Gy2/+jyBvX25B72X4j/VKAEUQMfjhraJGJxM0m0=; b=rgl4svvMSC72hFgO/hXYM/mgM+3hxg4Dr9sIKy6MGKB2oepszpgyi9T1ZXdOCjSG/G ayA9zu7Nz5xoDzsJu2p8qFpq5Oj0tDt8EmypcM6KOxkxqjIzbgCAdl08xBCovX7zqxis 5Xgri+Rr5y0C6Yeku9iY/qBIDObJrqUQWObInnkF/aPIqdOLfuZsfLEBHp8Z+COAAtSE dR8Zloyq8bYGZ/Qf19Ew8dax+/7DfdN98TmTpkDOxx3Mxfejiez2eB8+qPuf6jJ1cwBy 23v8hxMrL/tCjmuBvlTPfr3L4tg6HFCflP6LH+gNLlpk95w4/t2QYbcfuqbqHr3nRR4x BYgA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qdf34cDy; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d258f117dsor457173466b.6.2024.09.13.02.57.13 for (Google Transport Security); Fri, 13 Sep 2024 02:57:13 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXIR49Udq/Ln8r0P31e8VBP40D9g30q93Acu7oIsq/cRVDf7bbbSBElufWNruPxbnPwqAmaqxpBpG6HY5jM@amarulasolutions.com X-Received: by 2002:a17:907:e61a:b0:a8a:913e:418b with SMTP id a640c23a62f3a-a9029438eedmr569126066b.20.1726221432570; Fri, 13 Sep 2024 02:57:12 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:12 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Ye Li , Dario Binacchi , Anatolij Gustschin , Peter Robinson , Tom Rini Subject: [PATCH 11/26] video: dsi_host: add disable host interface Date: Fri, 13 Sep 2024 11:55:53 +0200 Message-ID: <20240913095622.72377-12-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qdf34cDy; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Current operations structure has provided disable callback, but there is no API from dsi_host uclass to use it. Add this disable host interface, so that dsi bridge can call it to disable host Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/dsi-host-uclass.c | 10 ++++++++++ include/dsi_host.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/video/dsi-host-uclass.c b/drivers/video/dsi-host-uclass.c index fde275ad7e2e..745991f8dd94 100644 --- a/drivers/video/dsi-host-uclass.c +++ b/drivers/video/dsi-host-uclass.c @@ -34,6 +34,16 @@ int dsi_host_enable(struct udevice *dev) return ops->enable(dev); } +int dsi_host_disable(struct udevice *dev) +{ + struct dsi_host_ops *ops = dsi_host_get_ops(dev); + + if (!ops->disable) + return -ENOSYS; + + return ops->disable(dev); +} + UCLASS_DRIVER(dsi_host) = { .id = UCLASS_DSI_HOST, .name = "dsi_host", diff --git a/include/dsi_host.h b/include/dsi_host.h index 83f8839db68d..5873ab698d9e 100644 --- a/include/dsi_host.h +++ b/include/dsi_host.h @@ -70,4 +70,12 @@ int dsi_host_init(struct udevice *dev, */ int dsi_host_enable(struct udevice *dev); +/** + * dsi_host_disable + * + * @dev: dsi host device + * @return 0 if OK, -ve on error + */ +int dsi_host_disable(struct udevice *dev); + #endif From patchwork Fri Sep 13 09:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3480 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3C68841280 for ; Fri, 13 Sep 2024 11:57:16 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5c244732fe0sf1212348a12.3 for ; Fri, 13 Sep 2024 02:57:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221436; cv=pass; d=google.com; s=arc-20240605; b=f7rtkBgflPFQn84MZoJTSKXeDWJPPWy8VhgdQfjz7VbS1f84d0nWjaQicr5Aehu967 bibTul2vkMozh9IW2zQakJ+Gk47spU/612HAkkFd5JJbM7dSJZ9Jx68PvwCzOqrNRoeV oJT9kqRfe+NwZvw0cXOTf74off7GW55EFn0Y4gv2WBA1x8zYitXKdlJim/5/0I9piif6 rhi57XcC2MGjL3mwW7/3Rpq36SlOYvrV6y/Wxi0Yn58VUQ5QmQnpHj1pa5Sy+mUtnf+A oi1FV+05OtnGCGhRv485JU4mZbQYAoHeOhvlgddCxtO1UkmeDJ7i5PxiT1+4dj7qnMZ/ aOZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=/sbimWxLABSY3mwKyxNpL+1AgdJUKKUCh7RCoDFV4Ew=; fh=Z0NLAIA9DKFRRX+fIAWzfNuLKihNH833m9EanZxuZxc=; b=ZfSp8hE9u4aenPzh9aaCHZPXqZ3B8G41xt8xpRN5Jh6oKNfnIQNyVFxntW1Lw1WQcG Y2yxzsXIWAf9RvOIgHSpZpJWEduNlMASJuV9PRSdzddouwlxJAsQseRAq56TqYYjAZIB chaBJ1lOgLfZlv3jguIKv1IRuaGMgFSDl+cqZxWMB8OSnD0ku6e4b19zK9Aio+7eU6IF hBsh0dL1/nHIGdTkMl4LGxoMPwO530yxPuSMZTa36Soi8I1L1+jbg8j+ICHOOiQMdVJ/ JGk3fFhvm81/LJZRjUhT/qq6/zh2ArqklwjTAj8QH0bEVduba2BmUDblvN/qVoJhihmP MmbQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="aq09rl/T"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221436; x=1726826236; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=/sbimWxLABSY3mwKyxNpL+1AgdJUKKUCh7RCoDFV4Ew=; b=Ziy77b5rApxkWz6gTynlYaGlcTPG4w6bnnKOcnc7mPmyypd94CHxItn0YCw9Cln/yE XT9iEO8OYOrhEFmYYfToa7aMKF9TLxnWYhN2i14mx9pEcIhkDzlvB3PRLovoJgprcI22 bPR5XLs6Z9sFWTGwrNKh6yDaD1XJDTuYINphA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221436; x=1726826236; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/sbimWxLABSY3mwKyxNpL+1AgdJUKKUCh7RCoDFV4Ew=; b=tQsZ+3bXYImCWwmsHVFRiYsNwc689k83y9z7F/t3jUVTvsp5QobDTk35fPcBuI6uAd idUZb/dXWPHZOVmoktBoUXNA1WQ+ceU/StASgkNio5VMMMcdGfNUlJYDYUIwpEoHg9YT 36SJw+w9LxrZh3wgxsMKCU3FUzK6lA/5LcMfBBPaXy5F0T8DxiO+bB3nLij+Rd4Z7NUL Rmqr7lZ55gP4OtkLRIOS6vS3+kq452Gdh6+gn+h8Y6eFLTdg8sbMrqSAlBijI7vhyJUf T9gy1CHl7coF1yGBKcaoUU/dcanAchzvmZcHPta8KPqQSHEjwEZbEc3laAueA7tdWpE7 aIhQ== X-Forwarded-Encrypted: i=2; AJvYcCWptgFKPIy7oAshJBNWZDPSghZAy0AqYe6sCo8Cx4CRGvf4eCpFT4K0TQb67chy0QXWDFEmqMcBaFsNKTOi@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxfXfjBSSQGtLkgaTvPC6y8supF75qIuPHr302kRrS4/m0n4/so k7tgDoSjX/7WSrvdzGlhMmr4TgGuaOmiCJPTzLC2clyTtwLPR+vC48bMyktPwaytgA== X-Google-Smtp-Source: AGHT+IHomNs7UERFBxJSv9pZ96+MxpMdn6otziIUW4uwnCY9WoC8RVFmfMXpZet6wG9yTfJxcCyS3g== X-Received: by 2002:a05:6402:40c4:b0:5c4:23ba:95c4 with SMTP id 4fb4d7f45d1cf-5c423ba9733mr290621a12.9.1726221435807; Fri, 13 Sep 2024 02:57:15 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2685:b0:5be:dded:4357 with SMTP id 4fb4d7f45d1cf-5c41408e81dls608990a12.2.-pod-prod-09-eu; Fri, 13 Sep 2024 02:57:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW97WAqkrqAXYgi3fyjUAsgnX70EhyCiUJKR9jW3TNPGRVfKRWw7gU17aqzsgrPl/rWuEnkg7ySOkMf+fTY@amarulasolutions.com X-Received: by 2002:a17:907:e26a:b0:a7a:8da1:eb00 with SMTP id a640c23a62f3a-a902941faefmr512725366b.7.1726221434367; Fri, 13 Sep 2024 02:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221434; cv=none; d=google.com; s=arc-20160816; b=ec+QIf0FaUPs2l/GD09lJ+N3iaP/K0t2wGCh4maKZBe0HRjWHcpS9BnT1dZm41Q4rg 2rCydu60hWJA8hLJmwQWJ9msMb4313jqD3Y+hLUmjigTVZQsFOr88PM2kFKnU3TcpEuE RF6jUV9CSYR8/nEAImWM7cvy+kPkqzJBognaW6bjtFvNOiTdPjT04aeL+xKev57u+luN KKa3SxkYLP8ESbbTLACHwTidby7Ab+jUeWNwu/TyfaoTBCUL/WkMc7vjYRurfbfAPbL+ VlVTT5tPEfVx02q6k2Z4PHOy8w/jjpgTAIjWS3HMf7C0UXUwkLBSbYTpFyqcN3BYh26U BqPQ== 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=4mvzLq45UAwkCCqqyJ82Yf/IOCaPYS9JtH6sYR6xojk=; fh=CDDqr4lWtnqRpVrMct3+CKfiCLipSN4UcbAcnlo34vI=; b=Lw0tPtHwvoXYgH9caIC9tV6SjgB85EYzlYHaX6pg133daIEJpjBqfv1aHOfncY8b03 eg/VE844rPfIc1DDe/eGMm4QE2wxW/6JCQsH9XoOsXhxsya5w+dCJmLutRwhOAHEYwJJ 0AFmjy6tQxiazJOm2HTZvPz/G/+EQqO47hN5OGdvyxn7vhs8GQ0B31WSxp//+I/n5zHj iy667ItpSpWtXt2m5Bw7YYPyITTcZsfMsqz1lXq04aFpHWLJ5DyY9tWi3y1hyRyEwb7j DrM1sTktdwwpRvx3YcJrEIbewVM8Ic6RM7c+iCYcDXgkQXuXCcirVtjRG0opUImvIgUo wVag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="aq09rl/T"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d258167b2sor420068266b.4.2024.09.13.02.57.14 for (Google Transport Security); Fri, 13 Sep 2024 02:57:14 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUNz/0eDrsbZJjAmSeggyBflyn87jE07VS9OpIJJPa4VNTfTnBheKZQwJWQ4sEJFp8KbxLWn3DV/Pz+HWG7@amarulasolutions.com X-Received: by 2002:a17:906:c104:b0:a7a:c083:857b with SMTP id a640c23a62f3a-a902961a6c6mr580328166b.42.1726221433667; Fri, 13 Sep 2024 02:57:13 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:13 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Ye Li , Dario Binacchi , Anatolij Gustschin , Peter Robinson , =?utf-8?q?S=C3=A9bastien_Szymanski?= , Tom Rini Subject: [PATCH 12/26] video: Update mxsfb video drivers for iMX8MM/iMX8MN display Date: Fri, 13 Sep 2024 11:55:54 +0200 Message-ID: <20240913095622.72377-13-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="aq09rl/T"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Update mxsfb for LCD video driver Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/mxsfb.c | 139 ++++++++++++++++++++++++++++-------------- 1 file changed, 93 insertions(+), 46 deletions(-) diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 792d6314d15e..45431f0a1047 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -21,8 +21,13 @@ #include #include #include +#include +#include +#include +#include #include "videomodes.h" +#include #define PS2KHZ(ps) (1000000000UL / (ps)) #define HZ2PS(hz) (1000000000UL / ((hz) / 1000)) @@ -30,6 +35,11 @@ #define BITS_PP 18 #define BYTES_PP 4 +struct mxsfb_priv { + fdt_addr_t reg_base; + struct udevice *disp_dev; +}; + struct mxs_dma_desc desc; /** @@ -56,9 +66,10 @@ __weak void mxsfb_system_setup(void) */ static void mxs_lcd_init(struct udevice *dev, u32 fb_addr, - struct display_timing *timings, int bpp) + struct display_timing *timings, int bpp, bool bridge) { - struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; + struct mxsfb_priv *priv = dev_get_priv(dev); + struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)priv->reg_base; const enum display_flags flags = timings->flags; uint32_t word_len = 0, bus_width = 0; uint8_t valid_data = 0; @@ -109,7 +120,7 @@ static void mxs_lcd_init(struct udevice *dev, u32 fb_addr, } #else /* Kick in the LCDIF clock */ - mxs_set_lcdclk(MXS_LCDIF_BASE, timings->pixelclock.typ / 1000); + mxs_set_lcdclk(priv->reg_base, timings->pixelclock.typ / 1000); #endif /* Restart the LCDIF block */ @@ -142,26 +153,30 @@ static void mxs_lcd_init(struct udevice *dev, u32 fb_addr, LCDIF_CTRL_BYPASS_COUNT | LCDIF_CTRL_LCDIF_MASTER, ®s->hw_lcdif_ctrl); - writel(valid_data << LCDIF_CTRL1_BYTE_PACKING_FORMAT_OFFSET, + writel((valid_data << LCDIF_CTRL1_BYTE_PACKING_FORMAT_OFFSET) | + LCDIF_CTRL1_RECOVER_ON_UNDERFLOW, ®s->hw_lcdif_ctrl1); + if (bridge) + writel(LCDIF_CTRL2_OUTSTANDING_REQS_REQ_16, ®s->hw_lcdif_ctrl2); + mxsfb_system_setup(); writel((timings->vactive.typ << LCDIF_TRANSFER_COUNT_V_COUNT_OFFSET) | timings->hactive.typ, ®s->hw_lcdif_transfer_count); - vdctrl0 = LCDIF_VDCTRL0_ENABLE_PRESENT | LCDIF_VDCTRL0_ENABLE_POL | + vdctrl0 = LCDIF_VDCTRL0_ENABLE_PRESENT | LCDIF_VDCTRL0_VSYNC_PERIOD_UNIT | LCDIF_VDCTRL0_VSYNC_PULSE_WIDTH_UNIT | timings->vsync_len.typ; - if(flags & DISPLAY_FLAGS_HSYNC_HIGH) + if (flags & DISPLAY_FLAGS_HSYNC_HIGH) vdctrl0 |= LCDIF_VDCTRL0_HSYNC_POL; - if(flags & DISPLAY_FLAGS_VSYNC_HIGH) + if (flags & DISPLAY_FLAGS_VSYNC_HIGH) vdctrl0 |= LCDIF_VDCTRL0_VSYNC_POL; - if(flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) + if (flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) vdctrl0 |= LCDIF_VDCTRL0_DOTCLK_POL; - if(flags & DISPLAY_FLAGS_DE_HIGH) + if (flags & DISPLAY_FLAGS_DE_HIGH) vdctrl0 |= LCDIF_VDCTRL0_ENABLE_POL; writel(vdctrl0, ®s->hw_lcdif_vdctrl0); @@ -198,10 +213,10 @@ static void mxs_lcd_init(struct udevice *dev, u32 fb_addr, } static int mxs_probe_common(struct udevice *dev, struct display_timing *timings, - int bpp, u32 fb) + int bpp, u32 fb, bool bridge) { /* Start framebuffer */ - mxs_lcd_init(dev, fb, timings, bpp); + mxs_lcd_init(dev, fb, timings, bpp, bridge); #ifdef CONFIG_VIDEO_MXS_MODE_SYSTEM /* @@ -212,7 +227,8 @@ static int mxs_probe_common(struct udevice *dev, struct display_timing *timings, * sets the RUN bit, then waits until it gets cleared and repeats this * infinitelly. This way, we get smooth continuous updates of the LCD. */ - struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; + struct mxsfb_priv *priv = dev_get_priv(dev); + struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)priv->reg_base; memset(&desc, 0, sizeof(struct mxs_dma_desc)); desc.address = (dma_addr_t)&desc; @@ -229,9 +245,9 @@ static int mxs_probe_common(struct udevice *dev, struct display_timing *timings, return 0; } -static int mxs_remove_common(u32 fb) +static int mxs_remove_common(phys_addr_t reg_base, u32 fb) { - struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; + struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)(reg_base); int timeout = 1000000; if (!fb) @@ -258,6 +274,7 @@ static int mxs_of_get_timings(struct udevice *dev, int ret = 0; u32 display_phandle; ofnode display_node; + struct mxsfb_priv *priv = dev_get_priv(dev); ret = ofnode_read_u32(dev_ofnode(dev), "display", &display_phandle); if (ret) { @@ -278,10 +295,19 @@ static int mxs_of_get_timings(struct udevice *dev, return -EINVAL; } - ret = ofnode_decode_display_timing(display_node, 0, timings); - if (ret) { - dev_err(dev, "failed to get any display timings\n"); - return -EINVAL; + priv->disp_dev = video_link_get_next_device(dev); + if (priv->disp_dev) { + ret = video_link_get_display_timings(timings); + if (ret) { + dev_err(dev, "failed to get any video link display timings\n"); + return -EINVAL; + } + } else { + ret = ofnode_decode_display_timing(display_node, 0, timings); + if (ret) { + dev_err(dev, "failed to get any display timings\n"); + return -EINVAL; + } } return ret; @@ -291,20 +317,58 @@ static int mxs_video_probe(struct udevice *dev) { struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); + struct mxsfb_priv *priv = dev_get_priv(dev); struct display_timing timings; u32 bpp = 0; u32 fb_start, fb_end; int ret; + bool enable_bridge = false; debug("%s() plat: base 0x%lx, size 0x%x\n", __func__, plat->base, plat->size); + priv->reg_base = dev_read_addr(dev); + if (priv->reg_base == FDT_ADDR_T_NONE) { + dev_err(dev, "lcdif base address is not found\n"); + return -EINVAL; + } + ret = mxs_of_get_timings(dev, &timings, &bpp); if (ret) return ret; - ret = mxs_probe_common(dev, &timings, bpp, plat->base); + if (priv->disp_dev) { + if (IS_ENABLED(CONFIG_VIDEO_BRIDGE)) { + if (device_get_uclass_id(priv->disp_dev) == UCLASS_VIDEO_BRIDGE) { + ret = video_bridge_attach(priv->disp_dev); + if (ret) { + dev_err(dev, "fail to attach bridge\n"); + return ret; + } + + ret = video_bridge_set_backlight(priv->disp_dev, 80); + if (ret) { + dev_err(dev, "fail to set backlight\n"); + return ret; + } + + enable_bridge = true; + video_bridge_check_timing(priv->disp_dev, &timings); + } + } + + if (device_get_uclass_id(priv->disp_dev) == UCLASS_PANEL) { + ret = panel_enable_backlight(priv->disp_dev); + if (ret) { + dev_err(dev, "panel %s enable backlight error %d\n", + priv->disp_dev->name, ret); + return ret; + } + } + } + + ret = mxs_probe_common(dev, &timings, bpp, plat->base, enable_bridge); if (ret) return ret; @@ -343,33 +407,9 @@ static int mxs_video_probe(struct udevice *dev) static int mxs_video_bind(struct udevice *dev) { struct video_uc_plat *plat = dev_get_uclass_plat(dev); - struct display_timing timings; - u32 bpp = 0; - u32 bytes_pp = 0; - int ret; - ret = mxs_of_get_timings(dev, &timings, &bpp); - if (ret) - return ret; - - switch (bpp) { - case 32: - case 24: - case 18: - bytes_pp = 4; - break; - case 16: - bytes_pp = 2; - break; - case 8: - bytes_pp = 1; - break; - default: - dev_err(dev, "invalid bpp specified (bpp = %i)\n", bpp); - return -EINVAL; - } - - plat->size = timings.hactive.typ * timings.vactive.typ * bytes_pp; + /* Max size supported by LCDIF, because in bind, we can't probe panel */ + plat->size = 1920 * 1080 * 4 * 2; return 0; } @@ -377,8 +417,12 @@ static int mxs_video_bind(struct udevice *dev) static int mxs_video_remove(struct udevice *dev) { struct video_uc_plat *plat = dev_get_uclass_plat(dev); + struct mxsfb_priv *priv = dev_get_priv(dev); + + if (priv->disp_dev) + device_remove(priv->disp_dev, DM_REMOVE_NORMAL); - mxs_remove_common(plat->base); + mxs_remove_common(priv->reg_base, plat->base); return 0; } @@ -389,6 +433,8 @@ static const struct udevice_id mxs_video_ids[] = { { .compatible = "fsl,imx6sx-lcdif" }, { .compatible = "fsl,imx7ulp-lcdif" }, { .compatible = "fsl,imxrt-lcdif" }, + { .compatible = "fsl,imx8mm-lcdif" }, + { .compatible = "fsl,imx8mn-lcdif" }, { /* sentinel */ } }; @@ -400,4 +446,5 @@ U_BOOT_DRIVER(mxs_video) = { .probe = mxs_video_probe, .remove = mxs_video_remove, .flags = DM_FLAG_PRE_RELOC | DM_FLAG_OS_PREPARE, + .priv_auto = sizeof(struct mxsfb_priv), }; From patchwork Fri Sep 13 09:55:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3481 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 92115412D2 for ; Fri, 13 Sep 2024 11:57:17 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5c25c45afb2sf846358a12.1 for ; Fri, 13 Sep 2024 02:57:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221437; cv=pass; d=google.com; s=arc-20240605; b=L8j7NXInSeBVwsyGu4GW5mNNoaCUFFI5hZQPrqUFHrM+lNaXQ2uJjem7oyD78dCbER oRePZSQBamkcfAk8SBXxilkBAHb8+GVbPxkBww8Hq++oIlbZHWC2kHnUArymGpuOzVTN uYFlZmN+bByP1zgFp5mvMp2E0vyvWt4pHNX9GwfUXZLAaBdqh75VwStaVNEbX5pz5RiL 9djKOpPjDhyUCtV+qqWbnzz58DgIzfANIZng2qe0ThCHK5LWF9F24+MrXeUE1p1HpXDy NC3c/iJ0StniGytT8rQm74KK7BtYuN5zounIpyOuSlJy0iz1pcIfFJOK9A5lP/edwpuT gjrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=Z8XMrwnYAX9rt6vQZv7CjawQCAPIRiSR/cDvU+Jpbx4=; fh=IyOFzTpLJKSi7ay82kA3QhOr30L6azGdFsQvrlZ9rvk=; b=alPgG9EeG/nY9bImqlH8wFhpsIbAgIhTnDdJvTnfVgkzi7VDz0C5Q/wYZjf0PZsCrJ M3JGVwx+goSx6gnd6s7/8I6C6oFfC2RgPbYe3L1EhZ5XzWDV42AnfiAc5pmtuoI9dXjW HX80vh7Zb2+BNRQRkzHwBsfu7ITO11LlhtWM8kbqQitz26vppyiHCFaT9mb0vGPoi+qU LXPF8FQkOBZAgSUkWsTQzX9oZaH86nz2Ba2X7yITXOaD3qWleZL+dYuOLY/TAtT7eoSh 0xbC7uHdufJwP2Xee+xEFaGI0N85WTD5CupVV0T2XYBg8OFh1TVIFSpT/oLOloUdRqIS nmsA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rKWkD69V; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221437; x=1726826237; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Z8XMrwnYAX9rt6vQZv7CjawQCAPIRiSR/cDvU+Jpbx4=; b=rhbm6qu72aJDq7klqEDO3gLRf+MPgtPuQLW/2NRzDK5i6mC59/fxqkXpqXEWQqOloz D5dNL5u9dnUmP5ApaZgsuKaln8gUMz+Rah8to/Vs+32SO7XmrgrYFsipDKXzvm41GB91 20KRBOJdb+3Y9coZHXg2qiGxTsI7S6Lfx12Mw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221437; x=1726826237; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z8XMrwnYAX9rt6vQZv7CjawQCAPIRiSR/cDvU+Jpbx4=; b=oiF0YFRJ/kmppEYfeOVAexgI0z0NefrZnxUpo34xGidVahub+TAS6aSbFuUKcCaUy4 24AvmdChO2a/CBWLfyLBv+qj6yqXLWyNz+Z2WL90tqohmre1KHsogNu6mVmMBCU8l4ZO Hk6SLRYBgqw1DW62er9Jy/5APzLex4nl/fqHjbVSNGUM9ExiTrRjXYqCaDRpvquEvatd 9tYIMX/gEWWKAtsycCjHQCecPurTA5AXiIKxY9wC/IIJrIakjEBiKpbQJ/1DiTURoVo9 95oqARhR7ougECIwZw5/HQHK0HwN3SqyJ0c20EOu+mM1MDyby13rG9Tl+xkPMeI+llwB vRzg== X-Forwarded-Encrypted: i=2; AJvYcCXxqHbESFYzfpSWUbo9ydFCrglDg2UHqnU7lvJ4/WONErTwPLR/0S94Hf9Oqk2BJ8VS+RCr89hlkaQeln0q@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Ywb8fgXBTM9YbnfhCvY/FX9yUJu4tguc25leP8MBAlVchAjGd0T BJ7whLq3BANzqCFDXyvXmfQMtRDISsoOhgqx+XpLQhOSOC1hTKG4aZKMAOYTzx4xgA== X-Google-Smtp-Source: AGHT+IFq2tTTZd5nOQOPQAJH3JDZdJQNb1ptxaU6QLOME3L5Uk01CDDJtoP9iQ9Q/gtp1HfZvrf8AA== X-Received: by 2002:a05:6402:3510:b0:57c:c166:ba6 with SMTP id 4fb4d7f45d1cf-5c413e2000fmr3963415a12.19.1726221437207; Fri, 13 Sep 2024 02:57:17 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:3486:b0:5c2:5248:a5fa with SMTP id 4fb4d7f45d1cf-5c414089cbfls196786a12.1.-pod-prod-09-eu; Fri, 13 Sep 2024 02:57:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkijcM/EK4jM+kBOxR/n2ubh84MXR0KBAPKuQYWOc6GyJDSCv+yQwL3EqCiEl/V7T9mmStVnsqqw67T3Sz@amarulasolutions.com X-Received: by 2002:a17:906:c108:b0:a86:b762:52ec with SMTP id a640c23a62f3a-a902961ba18mr517257966b.51.1726221435439; Fri, 13 Sep 2024 02:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221435; cv=none; d=google.com; s=arc-20160816; b=GLZ+m6WyX2aHYnV//N+ODVwPRfXY1QlNEw8lcGpP78BQubLMI6hNJw1VM3tSnvHpe/ wMeJApaZbxKm5LmEHFmDGl9D4BMd74sjHsmi/h2KElqwNXTSI7pm+4lgyLoUJkaWUjxz kbWIzgkSWOLSoA2SYSLvtg/uuP8OPIAxHHgvaVnb8oZyHEuq2kVacBn6I2pgWNuKzhsr XXCCWhylp6PE5ToTjeZ1EgLB33X4xD/9kEhhE9Wq3/U4Mo2QUjLH5x8lLMVplxXBmSvD bXhb35Ey2RhTUsrTLCXq1lo920v8bnD0sTgF/KNdIczgA/k/S2UI7kyJdHuD5rHduGgg 5ccQ== 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=AVL7EGugm4I6U3aHVcRzLaFABjeS2e0n8QBMoPvCjac=; fh=ImE8pzTTYoBeGukeX6+FIEq/1M+SnWbqZDEDIvK8pI4=; b=fOSn0pMWnjB27/bdxEnoAbmh+Vw0jfQluxfWFgeOaBFdQI+qSjv2OgopT3l6XOJNOU h7wF4UvMvIEUCbfFc+Sux9726yYL8/f+bEnKu/x/TZIG0QeYnzdn8aYAfQ2L/9O0W8qI Rk1C2RfSVBXZdabWuvJZc7ApAaUd9OziLlVBpSZvdPLTEFBfssDgDhy62zMjE5hCapHG k7Tw6Cob0UennM8pz631ckvqI5Q7JM7MuHkptDcNU1hkOi7N/IUzkzdQv5QYrebhkuyV YKRL0lgKD8nSjbJLCFO4G8yQ/816rDbVqHZTmr03+5YUmtPlephXrYyMx2geU5viDkxC ihvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rKWkD69V; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25c9d8a5sor464117566b.18.2024.09.13.02.57.15 for (Google Transport Security); Fri, 13 Sep 2024 02:57:15 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWVacFFGbumNVBuBu8BSfpOA/nNm2k+5nnWSlHrUESDAxIB7g9NqKqb1/ef4UEXbYmL47bJhUcyX98fruPP@amarulasolutions.com X-Received: by 2002:a17:907:3daa:b0:a90:34bf:844 with SMTP id a640c23a62f3a-a9034bf08efmr433220366b.59.1726221434834; Fri, 13 Sep 2024 02:57:14 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:14 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Ye Li , Dario Binacchi , Anatolij Gustschin , Peter Robinson , Tom Rini Subject: [PATCH 13/26] video: Enable DM_UC_FLAG_SEQ_ALIAS for display and bridge Date: Fri, 13 Sep 2024 11:55:55 +0200 Message-ID: <20240913095622.72377-14-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rKWkD69V; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi To support multiple display or bridge devices, enable the flag, so we can assign the req seq via DTB alias Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/bridge/video-bridge-uclass.c | 1 + drivers/video/display-uclass.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index 7432107238cc..5e2b76851fed 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -145,6 +145,7 @@ int video_bridge_set_active(struct udevice *dev, bool active) UCLASS_DRIVER(video_bridge) = { .id = UCLASS_VIDEO_BRIDGE, .name = "video_bridge", + .flags = DM_UC_FLAG_SEQ_ALIAS, .per_device_auto = sizeof(struct video_bridge_priv), .pre_probe = video_bridge_pre_probe, }; diff --git a/drivers/video/display-uclass.c b/drivers/video/display-uclass.c index 61a73e1bc2a6..07f05be7dd17 100644 --- a/drivers/video/display-uclass.c +++ b/drivers/video/display-uclass.c @@ -80,5 +80,6 @@ bool display_in_use(struct udevice *dev) UCLASS_DRIVER(display) = { .id = UCLASS_DISPLAY, .name = "display", + .flags = DM_UC_FLAG_SEQ_ALIAS, .per_device_plat_auto = sizeof(struct display_plat), }; From patchwork Fri Sep 13 09:55:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3482 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E8F1B411AB for ; Fri, 13 Sep 2024 11:57:19 +0200 (CEST) Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-5365c0e2eafsf1522576e87.3 for ; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221439; cv=pass; d=google.com; s=arc-20240605; b=f+y7os7P1UgQwtAWI43pvZVcLyffu6WzRA89s8nMmf0c1/K/dUeogml6Twc7z5OtN8 cWMOilPI1d8qBqvhk+9sWn/0NwFmZ8gdpcZ04uSv/M7YsooDlnZwy39YO7arocw522xM 630dzBIeWhI+2S9tOmK06Nz6GNcchaUxB02yaJXkKtGGuOlNW38IWuQaX+A+m4yJjN7F OMn+8/SfTiFM+TaO6cvY201W4tP3fBUEcmNcSMFDQ4ZRP1+nb+cq30JWTw6teAIzAAsZ Ua9KXOQepFS6CbRjQLjSdJsrrYxx0YykIw8fyS344JLd1cF+7HOLR285NTGfQTc9RiV/ D4xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=uL1OoYs/gKTsf7H88WOjiuFVhJ01U/C6euw1ZPjpcDw=; fh=hobjEWrsUDIGN8ryMLMc2xDg//12+SUIX2969R27bYc=; b=YbN+m9aBy0PRR1ItsbAZ2KfMbhEtMdHN8/7XH1KyDVwUeWB/m3W6F05rSjX88xEfnr 2UFASlvCBq1W8JYTYF8gFl2/IUqq8IRMVYPcBGg2zWzTc6tOurgHXBEPWTGLkmq2Blbz U7QpnWvm619Bqpb8/vWdAf1lhGh4ZOm2HzFa1vyNH7SsmbuqfKRAdDTmVJLZTC6mVjdy TVZGwqb2w08RpFVnCqeIx6FZwtSe/VHkUwcQAHN89ft6jeEp537MGjZ+5zdgGvw63tvb i3b1Z+04SzJibu+ovIzC4DOmxAc2aywgTNA8zbMRCaGnoCp5YAJ6uygxQJYINCSrl8qi Wv1g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WSjPthxs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221439; x=1726826239; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=uL1OoYs/gKTsf7H88WOjiuFVhJ01U/C6euw1ZPjpcDw=; b=lt/gXSGdkIjVJddmy4FPL+FrhNiFxzQOIHdTW/ZPLJbeQTk3vZRDG7i/V5fVnv/LmW JUTKfB0Lg+nE+JDWCkuEfizGRwhY3UWAkHAMADDhD0rcWS/9e255M/nmNG6kIJY5+tq0 lHZWoTS54kpo8ZiIYBVqyRMVbParl8REPp8m8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221439; x=1726826239; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uL1OoYs/gKTsf7H88WOjiuFVhJ01U/C6euw1ZPjpcDw=; b=mpPSHTj0VVfpnintO9oXfX9/Zl/R5YvFUnwSIso864MnyG6y+erPwXZM9ppNZVNdaa /7o3R1hWDycNKhjp79X7VZ+31Lz/iFlBHtG6m4lWq9UUiLKSzprFgS+V4swbTeZq0V3f zRohyF/OpmhrFRi/VHzosYFuCRjFEnecusuPiTvRe9HdP1jr2VFasxK3sJd8tGsQqJBA gx+UBq3SDVNuT1rPfN2HAyEAPFKYC3nNYrKMKqHO1ASdkh8jie4MgW1TLud9Q+xNZ/81 Lqt50SglltAOiIzTxbmTr6ksaThC2Hsmq0YgxsGiKZhSuUVBdcQoPI9i+UAyjrrXQ5Qd ivtg== X-Forwarded-Encrypted: i=2; AJvYcCVPQAxgMH8P32tb+Qhr5u2Cp/FHAytS5TFNoxmEL3K4977PvtZrbKMRZZ7Gp0/2hxVgIy7sn2fKeXScCfeI@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx4LcvOgl9KKOOk9W3oAhcaL12D3YPgHf3aa31RrBzGEa47Wcuj WixcLZVt8OA0CVWrzTE3+XkUJOcak2srkJck1zoKWPHANvzvsa8oumn28XVIsOJiQQ== X-Google-Smtp-Source: AGHT+IGOCTIYDZawUnZB9NyicIb2P4oxSmH0/cCHgaXN1IQyZWPsrZHmYIusRb1/RfqEqRHeEwyqJg== X-Received: by 2002:a05:6512:3b0e:b0:536:55ae:7444 with SMTP id 2adb3069b0e04-53678fba506mr3863353e87.22.1726221439171; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:3d93:b0:533:482f:afba with SMTP id 2adb3069b0e04-53678e09580ls936445e87.0.-pod-prod-02-eu; Fri, 13 Sep 2024 02:57:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWYdorrE3CVxGp2eIgDWLfblczneUOhj2G2Nn/hq35buTrzdvfq4f6y5SzruszQYthNsQiewmRNzaYX8qbq@amarulasolutions.com X-Received: by 2002:a05:6512:3989:b0:52c:8abe:51fb with SMTP id 2adb3069b0e04-53678fb1facmr3560282e87.10.1726221437447; Fri, 13 Sep 2024 02:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221437; cv=none; d=google.com; s=arc-20160816; b=K2AfTHeVyHIpDgeXZ5/34OKiESQT6T4IvtQ4kQUW9SA1L6H+ZfbM2DHOKxLo57Dy4+ 47qTl9CdwezpBdWGgl8FMR8AZFUfW961AWwzty0XMvYUbCEi15c5ugClE6nRT9X0d0ze Y2DaFazeU+VMSfYt2GXe/augniVJpeFx5G6ZxxXh/sTWPMQzFsl35mjlveTl0w8jEnlQ 6o66FOykW5kWRjjTZwvvHDcd4bPzo8eAhx7WtQkMQtVZeMLTLOCZHRGKhSl+LJBuhKY4 aLlPP0/DguXZt3WY59pmAFaW4PAlRQO9sNP354tjm/o/0wnTDVM1AWpEg1PJy10Qcw/o 8gZQ== 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=gwi4cPqbH0Gum7XAARv0sguyMNQwlnsuLBp/em7mdL8=; fh=xJB+ANC/AGIXMJJX+c8UmTT5qBOgEVyMqM/3hAVsxxk=; b=asu10T+gT/R1AZIfKAYUIx3+Zze9Oumk6iuX6aYgLt4zf3RQiLiWX1al7FMH/OIiJj qSLlHBfaF12cOxQUOzyUC+p9SuG0FYqQokl6gebjOguC6TPRm0qy0kK9N9gyySr9YwDI w9nW6yuRVQ3fwUI3P5tof5aBycXd5FIUUvr9bkQqdnolI1qPYAHTGCnZh7UCZPgz6zys JpVpzRT/cIyoWsyObvouyuT7Pvu85TRpDCuwl1ttlzxUNpaeETi9APYcWVejkxEp3YC8 Pb+ogZgbGiATq6JwaQgD2ByISQqgkntXKNcsceao1tzqyfghjtX/yhGOVJ48VLlK6leF y6SQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WSjPthxs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 2adb3069b0e04-5365f868f65sor4179190e87.6.2024.09.13.02.57.17 for (Google Transport Security); Fri, 13 Sep 2024 02:57:17 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWPQBpxuARAxvqozbV5HFmm/6tb3gIw7xFqxpWeLvqkBXakpji+nODFnpD4Z97PFDvmyQM0oFQMVLAGkxzy@amarulasolutions.com X-Received: by 2002:a05:6512:3f03:b0:52c:cc38:592c with SMTP id 2adb3069b0e04-53678f616demr3681093e87.0.1726221436131; Fri, 13 Sep 2024 02:57:16 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:15 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Marco Felsch , Vinod Koul , Sakari Ailus , Dario Binacchi , Igor Prusov , Joe Hershberger , Liu Ying , Stefan Bosch , Tom Rini Subject: [PATCH 14/26] phy: dphy: add support to calculate the timing based on hs_clk_rate Date: Fri, 13 Sep 2024 11:55:56 +0200 Message-ID: <20240913095622.72377-15-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WSjPthxs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Upstream Linux commit 22168675bae7. For MIPI-CSI sender use-case it is common to specify the allowed link-frequencies which should be used for the MIPI link and is half the hs-clock rate. This commit adds a helper to calculate the D-PHY timing based on the hs-clock rate so we don't need to calculate the timings within the driver. Signed-off-by: Marco Felsch Acked-by: Vinod Koul Signed-off-by: Sakari Ailus Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/phy/phy-core-mipi-dphy.c | 30 +++++++++++++++++++++++++----- include/phy-mipi-dphy.h | 3 +++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 8fb985a1e682..727c2b040520 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -13,21 +13,23 @@ /* * Minimum D-PHY timings based on MIPI D-PHY specification. Derived * from the valid ranges specified in Section 6.9, Table 14, Page 41 - * of the D-PHY specification (v2.1). + * of the D-PHY specification (v1.2). */ -int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, +static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, unsigned int bpp, unsigned int lanes, + unsigned long long hs_clk_rate, struct phy_configure_opts_mipi_dphy *cfg) { - unsigned long long hs_clk_rate; unsigned long long ui; if (!cfg) return -EINVAL; - hs_clk_rate = pixel_clock * bpp; - do_div(hs_clk_rate, lanes); + if (!hs_clk_rate) { + hs_clk_rate = pixel_clock * bpp; + do_div(hs_clk_rate, lanes); + } ui = ALIGN(PSEC_PER_SEC, hs_clk_rate); do_div(ui, hs_clk_rate); @@ -74,6 +76,24 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, return 0; } +int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, + unsigned int bpp, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg) +{ + return phy_mipi_dphy_calc_config(pixel_clock, bpp, lanes, 0, cfg); +} + +int phy_mipi_dphy_get_default_config_for_hsclk(unsigned long long hs_clk_rate, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg) +{ + if (!hs_clk_rate) + return -EINVAL; + + return phy_mipi_dphy_calc_config(0, 0, lanes, hs_clk_rate, cfg); +} + /* * Validate D-PHY configuration according to MIPI D-PHY specification * (v1.2, Section Section 6.9 "Global Operation Timing Parameters"). diff --git a/include/phy-mipi-dphy.h b/include/phy-mipi-dphy.h index a877ffee845d..1ac128d78dfe 100644 --- a/include/phy-mipi-dphy.h +++ b/include/phy-mipi-dphy.h @@ -279,6 +279,9 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, unsigned int bpp, unsigned int lanes, struct phy_configure_opts_mipi_dphy *cfg); +int phy_mipi_dphy_get_default_config_for_hsclk(unsigned long long hs_clk_rate, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg); int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *cfg); #endif /* __PHY_MIPI_DPHY_H_ */ From patchwork Fri Sep 13 09:55:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3483 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 77269412C3 for ; Fri, 13 Sep 2024 11:57:20 +0200 (CEST) Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-5334aba4422sf1278560e87.3 for ; Fri, 13 Sep 2024 02:57:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221440; cv=pass; d=google.com; s=arc-20240605; b=Joh+Y9IKkWGXmoa19Solzl8NgbslN17QaA/sDBNqLJnzAy6UiNPcMlJlN0MHMWcv/u ZexJdTXPteNXuyqBmnqugOCNE/VmuCOQXZeqWMCYQge/QP3UnIBFE3iytPaFras46XO5 d405ZABrjPbF+FRVZAyEVUDCyC84HOgxhlHJcuZiiKEWd3VrbJbs4bVpzCMrgL5wkfuG AOdqwESJfEPjS5TCg5UNB5L8heUNyuIvbTcg6neAp8nAnMUaO50hK2o8IsffgeLDIzYm 5qGUZEtRTSzUzXGL74M4V/kPSCSMU/Mm2EozyBd2oR9UjkNt0eiqV1ClF1fwMveONktD M+Rg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=v4hlMU7ZmVPRapdtNSyGumMjy7eC7izKO0CYZa3Ps/0=; fh=N+GEu3/Y+vUfiNvnWCoe4x54tTetB72xZ3A4vS5Lnj8=; b=JdrfivDowxiyc7T1H/TcY1LFGiWVY7BEYb4HwuXOp90lxofTWXD+n2yW5DG8EtJKDa I5DvvqCeeSQhelk6YSyxrilgJaBqSoKLXvH7bZV+9PpTh5CX7h873br084sG5ihHjrT3 gryrZTNtcyNODMyrqPpwj+51rud6sVdcBHMNNk62I/1ubes9iZztMXD03zTjEnTHm08H 0mwBv3QcC1dPEdPsN+8LaMrtNoQcJE1/oHw76oCbsLce/796lJgUxIdQsBvpQb+VTsP8 Diy4Fj9S2HA9njmqmlj4wxPukRG3eKzYT/GlcNPnoeIUSuLc8VgJS3gZx+urVCVHNaOG xJlA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Qd6in5+O; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221440; x=1726826240; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=v4hlMU7ZmVPRapdtNSyGumMjy7eC7izKO0CYZa3Ps/0=; b=KP4ETLiNo/nnod2t0FPRTclRFZ2QeaIAOQ6tkCLj7WyckCa67I20LcHTjxuORCA1qt YEqyZlD9xM6i9UrnhMQnbxasGij2RRe5ZcI1Kx6FzPuYtgJrzSN0Loua2p29cUP8WiFB G1rbw2gN8J0hAiUmr5q7vSUynjuJfggjxDMLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221440; x=1726826240; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v4hlMU7ZmVPRapdtNSyGumMjy7eC7izKO0CYZa3Ps/0=; b=ihQHtAD5mT65U3FNWiA+rZcPcV1ddBPTvMIc6Ni10fVP6fL/d+t7EZDOfF8ZETcuQg 6hxxqlSzP1qwbl65NFS0giyQ493TMzTMsmcMtcGWB0kaIe10z5P9q/vJj1XpyhDpCmDG Kn9kywtU+8okAOyWzIYhpCjxUswJPCb/yTkWeMMkzMu1Y2MbGia8BZlZQcrHKj2giFoc rn1H8WKeKKUFNORtRYTJe7a9LzCQBSRUrscKl30n1rhvwj12us/eFUIlqJ4XREN4WhtE xIkiwfmOa9DEPjt7QmvMxOBVULc/30rvwc5tSN5gr4fYAIqBkP00cmTeH4RjctuaIha4 Swpw== X-Forwarded-Encrypted: i=2; AJvYcCXKmGEeWE2/uJSY4lmRB2Ix8PCNy+ZDTDNXubzwuA3QvQdX9/z6sI3IXWfyRi7F8fvmwRkKZAP1aNQBdBfv@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxkH8P1qMAnUUJegzxmQEvXIRSyt9XgldjPEiZoN18IKuhBjoE1 iO7g0THuODNWPc7cWNbUuTUjTSRtgOkzx55FzKZQ+lC8au+LLx9W3YOuyeBIAvLhUKaBoD4Jpg= = X-Google-Smtp-Source: AGHT+IH6t6p6GgllUg51U5ugJ4L6AAF5WWjqDPNP2GSUutzozHLyDUIFlTk5TnzTZ7xSP6uOy5x3ZQ== X-Received: by 2002:a05:6512:6c7:b0:52c:d819:517e with SMTP id 2adb3069b0e04-53678fc9947mr3703877e87.30.1726221439809; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:3d93:b0:52c:e511:acdf with SMTP id 2adb3069b0e04-53678e09181ls915117e87.0.-pod-prod-08-eu; Fri, 13 Sep 2024 02:57:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUGsG3zD3WizVddOs3bfljC1BftukwBhoCch3uqDLJI23MYKsrQ4iC5zNCICc5MLMaSpCp2iY9jKgIC04wP@amarulasolutions.com X-Received: by 2002:a05:6512:1390:b0:52c:90b6:170f with SMTP id 2adb3069b0e04-53678fc854dmr4114624e87.29.1726221438206; Fri, 13 Sep 2024 02:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221438; cv=none; d=google.com; s=arc-20160816; b=F/sQePA/gsqpKEf4MitbZanguHLtYyOtnBs2FnraKClrg2eVVGk8V1Q4p9vKIvTa37 iOT55yJLuVmfHRQd1byn8Rubh8uHp60Y8HJeVsqGfoVAwIAZZu1m8aypo2A14yVKjv3t gq5h60CJMbWF3N3HwrvcgWiCox3lpjggK8hC5ia3OTAGySb7I2BDyCpilXJf4q32UDCi 537VzOQjlmTDye+hfLLpquXftnjXoQa/OXkjDiqB/ytGnIv5TWVU/6kSXPkY0iJy02iG YrOY53eKBAKi6ZrUIJGgziME9pR0CA/izVNDvEwa1fZDeld5XtsgqkXMtduNkEGGB+zE DM1g== 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=DUQmvYAOCNrD+j4utYa3bxEavO03hv/rn6c6e2GiH8Y=; fh=C8oVdHApJ2duxlYDsSk01H88M26I/xPsDWq66WV5Afg=; b=TvKqal0Mm8/MKjolzhVFmynDOY8NThvl2pNphiC+8KDrHJ10fto1XemeqrzJ1u4jks hKaxUJQWUmTNFMKrHnjDpnOEC0oYQPmK/Jeg4zIjzNHhsXtqlNSrY6L+KdQIfKW4HMx2 Cn2LH5dh2RWa0c69Cz12UQnE77yQCmI/FGHlceTFwJ2tpfJKtNl0EaD8nGH7reQJuKMA ScTfnks1SJ4XyCTOD24CmIYVodQPfbpUiv2Xg/ApMKRUxuUfUPUBDGQwWxafyBCN7Hb8 PJIxvizER9KlknKGCq8hDTMj/tccX/IqeLwuV/eGlfk9y86X4xw+BtPmRKoQoTetIWqX jEqg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Qd6in5+O; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25c3822fsor539518866b.13.2024.09.13.02.57.18 for (Google Transport Security); Fri, 13 Sep 2024 02:57:18 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCV+aO3vLqNbagX0Ecx8/naJe2ixOonwC46uCwWwAnf74CJLV6jGQeDTZ7V0upspgq90sYA/zeqSkYGLMluZ@amarulasolutions.com X-Received: by 2002:a17:907:c7c4:b0:a86:7021:1368 with SMTP id a640c23a62f3a-a9029434ca4mr601307066b.21.1726221437507; Fri, 13 Sep 2024 02:57:17 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:17 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Liu Ying , Vinod Koul , Dario Binacchi , Andrzej Hajda , Igor Prusov , Joe Hershberger , Tom Rini Subject: [PATCH 15/26] phy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure}) Date: Fri, 13 Sep 2024 11:55:57 +0200 Message-ID: <20240913095622.72377-16-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Qd6in5+O; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Upstream linux commit 3153fa38e38af5. According to the comment of the function phy_mipi_dphy_get_default_config(), it uses minimum D-PHY timings based on MIPI D-PHY specification. They are derived from the valid ranges specified in Section 6.9, Table 14, Page 41 of the D-PHY specification (v1.2). The table 14 explicitly mentions that the minimum T-LPX parameter is 50 nanoseconds and the minimum TA-SURE parameter is T-LPX nanoseconds. Likewise, the kernel doc of the 'lpx' and 'ta_sure' members of struct phy_configure_opts_mipi_dphy mentions that the minimum values are 50000 picoseconds and @lpx picoseconds respectively. Also, the function phy_mipi_dphy_config_validate() checks if cfg->lpx is less than 50000 picoseconds and if cfg->ta_sure is less than cfg->lpx, which hints the same minimum values. Without this patch, the function phy_mipi_dphy_get_default_config() wrongly sets cfg->lpx to 60000 picoseconds and cfg->ta_sure to 2 * cfg->lpx. So, let's correct them to 50000 picoseconds and cfg->lpx respectively. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220216071257.1647703-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/phy/phy-core-mipi-dphy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 727c2b040520..79cab9125002 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -64,10 +64,10 @@ static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, cfg->hs_trail = max(4 * 8 * ui, 60000 + 4 * 4 * ui); cfg->init = 100; - cfg->lpx = 60000; + cfg->lpx = 50000; cfg->ta_get = 5 * cfg->lpx; cfg->ta_go = 4 * cfg->lpx; - cfg->ta_sure = 2 * cfg->lpx; + cfg->ta_sure = cfg->lpx; cfg->wakeup = 1000; cfg->hs_clk_rate = hs_clk_rate; From patchwork Fri Sep 13 09:55:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3484 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BE6E341280 for ; Fri, 13 Sep 2024 11:57:21 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2f75ea32971sf6838611fa.1 for ; Fri, 13 Sep 2024 02:57:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221441; cv=pass; d=google.com; s=arc-20240605; b=Lg1Kj7VPGJML818O5CSdSuuChprDVFA6UHt0Wbw5yPKLwazL8bUzhvVcdrE9t4jr/s ATSV7qr0irZ4n+YoT7sJjkHXBneiP31nTtspBwM/cdFO/G66vxEDdtnihzURdHcFZWow UnFaSSyU7eHTlsVgFZVSP7YsYF3bOq1/jX04BitwWIYzS2hcRyLXWW+KrCjDmuwzQFgn cQkeZx2Hfxg9uoECngEHb4kIAR2b4Bti9gpaB0t/c2gW7WjOf2saySHKhyaXY5oUdvNq /M8iAWol0lGZmKlRxWa/MVNNKtnjnWqSvNwD1pbMBT4TBtVL0+oU1EQqWal2aI/YOyjG 70oA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W0EHT0h/TTNP95rM4CkU2i5KVDthbO8IMIz0xlRCHks=; fh=lCACNT4PduREOfO701qsvfzVfJMbbFs6smooLTS8iU4=; b=HFY1Ir1dD2QVqavbWqC7xEvJrWHtdMevAMslaqzk306PI7dRnvrUaXBZDIcXvoLgeQ DTTRoIIJA+LIRK92JgNQvNTPEGsOmmGBBjuTNvQGG3odS44cjLhvYjIWcy/OhRQN85wk CUZEMpoGPgKsgeFqV5GVuyanOkp8oKDPBIGSDHaucOiV+mjkL3xhoYU8XDuXFKAnhRpf qjlcd6zWC383MDteA1StfIfr+6nhYVVDj4iWqY3fRm7OVGwmfIqJDuCsUrLXDwDs9j0s DTJ/lh/fuo8TWnVwNjf8Al3o/NQRIqoPTRLmWpDBT/SNQeriA8C+uZqPabwZ98+QEIBX sHvA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fI6j78l0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221441; x=1726826241; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=W0EHT0h/TTNP95rM4CkU2i5KVDthbO8IMIz0xlRCHks=; b=SDW4IJpphByd0d7BlIc8sO0SNBGJm8EnFtVmMUR9JljFMRWsTjd1RZrwJGgm+2CfrJ i/GLGZIhvT4UR+PAmWAZXz2KLO0vNYv/OPdZmriYxMmTtEe0Xj77zHHWP4NrzjLv3tkr DsWeX34TQiuPBFjzM4S1mG+pEKfZ0rpo5YzVY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221441; x=1726826241; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=W0EHT0h/TTNP95rM4CkU2i5KVDthbO8IMIz0xlRCHks=; b=Q4EBNjjQbenHf5ULs3F6bEW7Bwm2tlEkOXGQp/q5SHxYoXAJI/KCeT+0Ay5hSYXFOk NPTuwS5+YkgpzUtNpDCjMT7RDwN8C7769Gcpdm9pLN4nB2eDdBDeLbLJhMWGZFSZ8avX 1I4jL6ju8U/AeIWcLNCoFT1SiX3xew3WvOWNYMnnDyoAA0xH97cVFpcZROddEY810q5T bleodwhDf8wQnqWxrcrVdiUeiUa2nQFp9eHC5MC3MJo49WrNDTgFLylrp+sWzCFAz4it nvkcv+BI/bUzAV6XOY22KjEbKfxwL26LnkPafsmsoODYLXLKzyxaLw5vWXZAvqb8qyW8 NtDQ== X-Forwarded-Encrypted: i=2; AJvYcCXkTFIeRVswWVcYDoKLr8BDjc0pGyOsqovuFHgMsAHcLFeCxAnpZ44pqLCJlZr3kL9S8+qyCFd2/LTaLzBp@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxM889w3cAXbf23TkqMy/HewfSfCvVExwBiMQJgjcdxj8hObRaW /lwPpVNZzNsJUJ0YKFDFHizZLN5lv1Mg59cNjcwb+pu8sg00bWZMEAuHjDIHG8rz/A== X-Google-Smtp-Source: AGHT+IEineS+9YGeNiIWNI+HbtEuiPC9FG6rcImRx58djYqGr3rps7bJ0SF7tAszvGibKfGXePN37w== X-Received: by 2002:a2e:a584:0:b0:2ef:248a:aed4 with SMTP id 38308e7fff4ca-2f791b5cc2emr13381351fa.42.1726221441056; Fri, 13 Sep 2024 02:57:21 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:50d3:b0:5c4:1370:8039 with SMTP id 4fb4d7f45d1cf-5c414089f70ls134389a12.1.-pod-prod-04-eu; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX1OHlRgHnvXVh+6Tvzo8JDk5XXz+ib5pGPTM6CkpR+IR/jEVwfUdVWMrH7Mb3d48Fk8yhQHNdImK9HvtMX@amarulasolutions.com X-Received: by 2002:a17:907:36c8:b0:a86:7199:af37 with SMTP id a640c23a62f3a-a9048151092mr155390166b.58.1726221439466; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221439; cv=none; d=google.com; s=arc-20160816; b=XZOb4ePj2aYoaqsBtaF0dnIhCcRDMhIg929/C121NbYWAXmg3h2NcZio1vOD73z/cV gY6Q3T6esRZtHGHcqxo2uwlGDHiKFxxDevPaqAFVeNAFX88k7aTJFnJWgXVCCmiy5PHO E7wKQ6EyyKkuduBa78Nazs7qw9vmGL+PTAAjTlu0iEu73DGYjZh+vjKawENZfvz//Z2U 3qorfnGA/F7NjbF8vYAmEA75g0XAIyVbYg90ZkGRaFBITPy9Ku/Rce1unJCQPE6QUlSX 0jFChpm7uKt8M2exo2e9g8JwvpzU0/Ae+5Kc5pNvf3ayY3R2LhgqpCAOvX86f7FxvpyF ic3Q== 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=fJ6Zjs8lUX/jMH8JhmryfFLNpN3PXuow+IQQ28EHkRM=; fh=UKOsHSZZt1EFOy2ECsruEI6TyiF1qYXyeNMtwIP/2oI=; b=1AWOJMRumU6iYmUqMcafWAC17msM/jifSh3iVT/cby6EBZ5tCdoXaCHXk2v7N+rJrQ HT/Sa5/gkm2YsxwEnBXcUddupwEQc1lcZeF4+PkOHTRWudFOrIJsio6/O8Yub0LK+d0m BtRRAkKcUXeUA45LUTIX6JDPB0xEB2S+uN6Zb/QR7C6fpEZZyb2MF1iw3yB0MULNeSgE klsKqfh3sLoFqLQsH0Hf+UjyXQ/PCrb3D2N1pbd3Aet1kDJHnPKsNoQvt5iPpbMXrjgj QsGAXCXL/srFka9sbWtK4v4dt30ofDd+p93T98DLdOPqvI2w8e1R04qX3iaZl3kccQSw pd+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fI6j78l0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25ccab27sor430294466b.19.2024.09.13.02.57.19 for (Google Transport Security); Fri, 13 Sep 2024 02:57:19 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUtiNJtlcbZmckpogeXhl0F1eiI7/iQtlKTxZIeHfk789livoEk2Ls1pdGQTkG9pHs5JtZX82jF575XhlOs@amarulasolutions.com X-Received: by 2002:a17:906:c113:b0:a8a:835f:4cb9 with SMTP id a640c23a62f3a-a9048105fd9mr184073166b.46.1726221438905; Fri, 13 Sep 2024 02:57:18 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:18 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Liu Ying , Andrzej Hajda , Neil Armstrong , =?utf-8?q?Guido_G=C3=BCnther?= , Laurent Pinchart , Vinod Koul , Dario Binacchi , Igor Prusov , Joe Hershberger , Neil Armstrong , Sakari Ailus , Sean Anderson , Tom Rini , u-boot-amlogic@groups.io Subject: [PATCH 16/26] phy: dphy: Correct clk_pre parameter Date: Fri, 13 Sep 2024 11:55:58 +0200 Message-ID: <20240913095622.72377-17-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fI6j78l0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com 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: , From: Michael Trimarchi Upstream linux commit 9a8406ba1a9a29. The D-PHY specification (v1.2) explicitly mentions that the T-CLK-PRE parameter's unit is Unit Interval(UI) and the minimum value is 8. Also, kernel doc of the 'clk_pre' member of struct phy_configure_opts_mipi_dphy mentions that it should be in UI. However, the dphy core driver wrongly sets 'clk_pre' to 8000, which seems to hint that it's in picoseconds. So, let's fix the dphy core driver to correctly reflect the T-CLK-PRE parameter's minimum value according to the D-PHY specification. I'm assuming that all impacted custom drivers shall program values in TxByteClkHS cycles into hardware for the T-CLK-PRE parameter. The D-PHY specification mentions that the frequency of TxByteClkHS is exactly 1/8 the High-Speed(HS) bit rate(each HS bit consumes one UI). So, relevant custom driver code is changed to program those values as DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE), then. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Tested-by: Liu Ying # RM67191 DSI panel on i.MX8mq EVK Reviewed-by: Andrzej Hajda Reviewed-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Guido Günther # Librem 5 (imx8mq) with it's rather picky panel Reviewed-by: Laurent Pinchart Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220124024007.1465018-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/phy/meson-axg-mipi-dphy.c | 2 +- drivers/phy/phy-core-mipi-dphy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/meson-axg-mipi-dphy.c b/drivers/phy/meson-axg-mipi-dphy.c index 3f89de19970b..fb10ccca6ac1 100644 --- a/drivers/phy/meson-axg-mipi-dphy.c +++ b/drivers/phy/meson-axg-mipi-dphy.c @@ -237,7 +237,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy) (DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) | (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24)); regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1, - DIV_ROUND_UP(priv->config.clk_pre, temp)); + DIV_ROUND_UP(priv->config.clk_pre, BITS_PER_BYTE)); regmap_write(priv->regmap, MIPI_DSI_HS_TIM, DIV_ROUND_UP(priv->config.hs_exit, temp) | diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 79cab9125002..27cff85709d9 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -36,7 +36,7 @@ static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, cfg->clk_miss = 0; cfg->clk_post = 60000 + 52 * ui; - cfg->clk_pre = 8000; + cfg->clk_pre = 8; cfg->clk_prepare = 38000; cfg->clk_settle = 95000; cfg->clk_term_en = 0; From patchwork Fri Sep 13 09:55:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3485 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id A8421412D2 for ; Fri, 13 Sep 2024 11:57:22 +0200 (CEST) Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a8a8308cceasf297970666b.0 for ; Fri, 13 Sep 2024 02:57:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221442; cv=pass; d=google.com; s=arc-20240605; b=Cy75c9FlgWv5pIsDh9jfWp+yz2GT3XVPFnjqo2SjcHh7V+Y5acgMw7kDt8EiJFNH0W dVyAhmxrAuHGHD0g15yAl43d0NTLC2BJO7iYvBvkJsB886++8K/I43Bv9jwzNuEMBjNy lccni8k+VAfZc/i5+G/dAXEgzfX2m9Ueca6pmRwDFoyCrbH1ZCd6GO9ndT4c1SVGPihH UjOmBrCFsZs1QlPKuULjBBiqJURZo6lBqD/0ZM/kCWh5qrBAIPj4PZJAigy4nhNtyvCF mBxlY9b4AB+MdkGynL1jus2etATAvAKy4HPtiT59Qf4L0Wcm+gnGwmcTS5W1gEa8zOAp cYGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=R4ZXZ97cT7BL3O7fWZjBbfjBa8+jsTaXXvNXmSOop5c=; fh=YKEyjnW9UZgrQOD5gGLkyScnrjVCaPnVSQys+JNiR4w=; b=NT77XN7x7g2C13bwp0U/IojHahpOdsS4y1TZ322CNKX6j82AayCZ1OW/mZM6QQTXfl QZ8CirZAfNoiUmjE7OsfVbCsDoAxeZNCWbn9QS/0qw4g8jYQSg8m2+BlP91Xzm3H4jPI BnOG0krZnr7+rERiGNC3FWdMAx/rgieRmxLcrOqcXQiAFR4JxOv8etvgOVoGQjSbIryW CUY6ocXw1w4anxcByAGuWERq7TqmU+4bgQknXYYLPk4kUBcx5ExLE5C1+AP0+urky1yH 2M7sKJdbGdskaS6HV5hDuMI3i5dB1VIxacI8eS8nOV28oQeEV/wKesQF4bhgKYwOPsMW z2QQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="S8/9bTFG"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221442; x=1726826242; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=R4ZXZ97cT7BL3O7fWZjBbfjBa8+jsTaXXvNXmSOop5c=; b=XifkgMUjsClNRi+FT82YoadtirZWg/4Jy5idRuK5e4kfB3yaWfmbYMyGaGCSkXEbpp oig/ne6szN2Yzjm9BOHMKb5W8E2SZIVG6w38xJD87TSdJVEZ9KG4Z0mKejXaed/aZk8w HGOQlJbTIchfrYcYC+Ds3sZ/wQL3zeFwdxBxI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221442; x=1726826242; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R4ZXZ97cT7BL3O7fWZjBbfjBa8+jsTaXXvNXmSOop5c=; b=qWbkV+MhodaOQGl1ffBE9lCNPERdFPq8lO+M1+1Zw6iI7eWQn3tHFsXM0R0sjPTohA FistOflUD/4cS92h0Sv0Z36lnHB+N7bf3G3NnMrCnbrdjGRmgI4qY1TzAvM5do6mcsgR L3ESd4VEi1BRoBFQASB5HUDJKGe1XXyWGk1kyss2nzBTOy39pTxWCJ6TsaUjrZRHiiju pcKWAm+1W2Rvr9Nc1JEmeyw2dfAtScdYzCPW5pdLzg+yf0SZs3gDfrt4K0gtoWU1VPsv MHo50V37+zPbBcKYLq7oTosdjizUwXdkCVmlmReqCk6oyIQY+yk658oI2eDDqBhPeY5C n/jw== X-Forwarded-Encrypted: i=2; AJvYcCU33jj+XGu92sG31kzRKsw3jHc0Z070/vKxZzbLfVw8/qkZSU8Q3JyoEdW3wKg0Rmw6hUUJbDdXwF6CnU2R@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzHBpcokDd/uhtrubmxQIgviJrVqcBeUovdSRoz3oF6ZB/lhVVs a/X3ybBVrwivEnm6cG4aoffy+6u6ZUP45j/fQQhpzlA2wA6Tet55RKqOruiA1L0Lhg== X-Google-Smtp-Source: AGHT+IHe8WhVfwZy14bOchBnHbUf9boSA8yyRy6FvblEqqNhcCwSnvoC5B/70xNXB5FVeCwSj9/9Vg== X-Received: by 2002:a05:6402:4144:b0:5c2:6f35:41af with SMTP id 4fb4d7f45d1cf-5c4018e5d05mr15887773a12.16.1726221442299; Fri, 13 Sep 2024 02:57:22 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:3488:b0:5c2:1813:8ca8 with SMTP id 4fb4d7f45d1cf-5c414091549ls2898a12.2.-pod-prod-00-eu; Fri, 13 Sep 2024 02:57:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVhY324sA+KBiHRjbCYk9IZ0qjEpDmilVTW09M3h+ic8OKMbhJfonEyq01zlb/pWra9DFxoz9SjoVd6JXQk@amarulasolutions.com X-Received: by 2002:a17:907:1b20:b0:a90:1f60:7b2d with SMTP id a640c23a62f3a-a902a09a509mr587124666b.0.1726221440550; Fri, 13 Sep 2024 02:57:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221440; cv=none; d=google.com; s=arc-20160816; b=bgjUoZ67RL8CEKpfrsmLB/c4kmiT/pLYJK4Uxm+RGxksyPnQhugNKYILo5SozCc91B PpdZgg/D5dk5SxisUlPhsDgKDGSiYE89HGCv//ZmW0X2dgCclFc3yVWCDWM63C6zkSP+ RBzXsCSa1py9IE3RbOn1xpxV17qS1sE+ycDt0ib9XKgF68IaJRX5LKNY/VASFesrZ8K9 dUIUGe6KRt2I8pj0p3hKrujwQJck/Vmwof9EF1b5mhZz7lW88vXNQGIN21aMI30rtHxh Lk24Q38aqID5TTDrZBnuMWCuXzlM7a+v5tYnx87CXa/+3S3pJ5YmdliT0hMZcXIQ0p4J gIpg== 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=vW7qJEHzB7K7Vuq5gSZygAenGvtTILGG5LHRpzHYU+k=; fh=F0xh9+9UNQaRTOxSCAhdiXPHilWdCRXc/paLnYn7H8Y=; b=gQwEOWD46xVw3zKjahnueuBqjClFZ1rU5SdgvpHMoIZf7ltMLKPV7SpOEFVVzdjT4m 7wFMIMDpKvXxxyQ5likqtCCBysW1gzoKR/fAKI0k8+zWKx2qtrOvH1+cFZap/iWuYg8O YoTS7P81x+/Z+MKRhbPyawtMg/Z3r5Un4aNXxZh3Mp/3rsx2O0zYuF3eYNTBzDg8Xa/J +I/VrnN2fG4vGRlcVcP8c8fMQd4+bi05WJib2aiMWaNo96otc1Sdc5TJvMynpF8lNFV/ o/Fo4nFNLzAE3I1HYL4Fj7QIS5e+GCIsT9qV+HXC4YYm3u8vg8vDEznEqAhnG8QHih8M e/FQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="S8/9bTFG"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a904760d336sor63341366b.1.2024.09.13.02.57.20 for (Google Transport Security); Fri, 13 Sep 2024 02:57:20 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXBRjKtyW2ogVwxzK+9exrxIVVJVnI0127l7bd8MPk7R0/uZ1LbTJLt7PrQGj/zNZRmRYGvQL6nzsBmFO3f@amarulasolutions.com X-Received: by 2002:a17:907:6e8f:b0:a7a:acae:340b with SMTP id a640c23a62f3a-a902a8f7d52mr575358666b.31.1726221439869; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:19 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Tom Rini Subject: [PATCH 17/26] lib: div64: sync with Linux Date: Fri, 13 Sep 2024 11:55:59 +0200 Message-ID: <20240913095622.72377-18-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="S8/9bTFG"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Sync with Linux commit fc4a0db4149af ("Merge tag '6.5'"). Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- include/linux/math64.h | 110 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/include/linux/math64.h b/include/linux/math64.h index eaa9fd5b9685..82bd7472a32c 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_MATH64_H #define _LINUX_MATH64_H @@ -12,6 +13,11 @@ /** * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor + * @remainder: pointer to unsigned 32bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor * * This is commonly provided by 32bit archs to provide an optimized 64bit * divide. @@ -24,6 +30,11 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) /** * div_s64_rem - signed 64bit divide with 32bit divisor with remainder + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor + * @remainder: pointer to signed 32bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor */ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) { @@ -33,6 +44,11 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) /** * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * @remainder: pointer to unsigned 64bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor */ static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) { @@ -42,6 +58,10 @@ static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) /** * div64_u64 - unsigned 64bit divide with 64bit divisor + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * + * Return: dividend / divisor */ static inline u64 div64_u64(u64 dividend, u64 divisor) { @@ -53,6 +73,10 @@ static inline u64 div64_u64(u64 dividend, u64 divisor) /** * div64_s64 - signed 64bit divide with 64bit divisor + * @dividend: signed 64bit dividend + * @divisor: signed 64bit divisor + * + * Return: dividend / divisor */ static inline s64 div64_s64(s64 dividend, s64 divisor) { @@ -92,10 +116,14 @@ extern s64 div64_s64(s64 dividend, s64 divisor); /** * div_u64 - unsigned 64bit divide with 32bit divisor + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor * * This is the most common 64bit divide and should be used if possible, * as many 32bit archs can optimize this variant better than a full 64bit * divide. + * + * Return: dividend / divisor */ #ifndef div_u64 static inline u64 div_u64(u64 dividend, u32 divisor) @@ -107,6 +135,10 @@ static inline u64 div_u64(u64 dividend, u32 divisor) /** * div_s64 - signed 64bit divide with 32bit divisor + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor + * + * Return: dividend / divisor */ #ifndef div_s64 static inline s64 div_s64(s64 dividend, s32 divisor) @@ -228,6 +260,24 @@ static inline u64 mul_u64_u64_shr(u64 a, u64 b, unsigned int shift) #endif +#ifndef mul_s64_u64_shr +static inline u64 mul_s64_u64_shr(s64 a, u64 b, unsigned int shift) +{ + u64 ret; + + /* + * Extract the sign before the multiplication and put it back + * afterwards if needed. + */ + ret = mul_u64_u64_shr(abs(a), b, shift); + + if (a < 0) + ret = -((s64)ret); + + return ret; +} +#endif /* mul_s64_u64_shr */ + #ifndef mul_u64_u32_div static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor) { @@ -257,4 +307,64 @@ static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor) } #endif /* mul_u64_u32_div */ +u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div); + +/** + * DIV64_U64_ROUND_UP - unsigned 64bit divide with 64bit divisor rounded up + * @ll: unsigned 64bit dividend + * @d: unsigned 64bit divisor + * + * Divide unsigned 64bit dividend by unsigned 64bit divisor + * and round up. + * + * Return: dividend / divisor rounded up + */ +#define DIV64_U64_ROUND_UP(ll, d) \ + ({ u64 _tmp = (d); div64_u64((ll) + _tmp - 1, _tmp); }) + +/** + * DIV64_U64_ROUND_CLOSEST - unsigned 64bit divide with 64bit divisor rounded to nearest integer + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * + * Divide unsigned 64bit dividend by unsigned 64bit divisor + * and round to closest integer. + * + * Return: dividend / divisor rounded to nearest integer + */ +#define DIV64_U64_ROUND_CLOSEST(dividend, divisor) \ + ({ u64 _tmp = (divisor); div64_u64((dividend) + _tmp / 2, _tmp); }) + +/** + * DIV_U64_ROUND_CLOSEST - unsigned 64bit divide with 32bit divisor rounded to nearest integer + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor + * + * Divide unsigned 64bit dividend by unsigned 32bit divisor + * and round to closest integer. + * + * Return: dividend / divisor rounded to nearest integer + */ +#define DIV_U64_ROUND_CLOSEST(dividend, divisor) \ + ({ u32 _tmp = (divisor); div_u64((u64)(dividend) + _tmp / 2, _tmp); }) + +/** + * DIV_S64_ROUND_CLOSEST - signed 64bit divide with 32bit divisor rounded to nearest integer + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor + * + * Divide signed 64bit dividend by signed 32bit divisor + * and round to closest integer. + * + * Return: dividend / divisor rounded to nearest integer + */ +#define DIV_S64_ROUND_CLOSEST(dividend, divisor)( \ +{ \ + s64 __x = (dividend); \ + s32 __d = (divisor); \ + ((__x > 0) == (__d > 0)) ? \ + div_s64((__x + (__d / 2)), __d) : \ + div_s64((__x - (__d / 2)), __d); \ +} \ +) #endif /* _LINUX_MATH64_H */ From patchwork Fri Sep 13 09:56:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3486 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 81985411AB for ; Fri, 13 Sep 2024 11:57:24 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2f7564eda12sf4962261fa.3 for ; Fri, 13 Sep 2024 02:57:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221444; cv=pass; d=google.com; s=arc-20240605; b=DsowjKtyXddBZahhESZ39QjcaxejgkmjTqzmTZajv4dgEmZGKl6exLn4H5d3IKqrIE 4ceuxf/UEs6ciR03wxsHlUV1n4ErZ3yMrmx2qqpfm7ep2dFr2046PEA5yFXz5iJNvess jxVr8ZV7Hi4LviybUORGINovo3iH5KJholr75iVS+sO8ZFex6aToikdvMxvGpHuKo34n eUZNB/G9Pb1SfHKFyZYtRCEl7AwxtCbJWL/Y3iJPp76OyUhfk8d4GwGMX6Ehx+Q5LJlP jQAGHeicoKfZuwhsKl/I9Ubu4a+NBeDPDeBJAFmatEmQHV15e6eg46q7rePr4EQP+hlG hj7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=TuKGB23lOs998iq3raCiFOOgbV12P15mut2w6FlTW0o=; fh=WLI4qRWZrvni5BPPrK1dGCYu/+OxkxhCDgbCFmUEriM=; b=acn1SdHCik5wsUWudUkXuxm8W7Fq0fnWjlXoXlAedrgoXB/fSVcpe3YfIYHniUcTp9 TmhDX1/QxllORp56MtXi1XoUc74EPpn/mXadqqG8I79TFZ1KZ28c4R5bQvkGslXd3snz c9AtdNW6x1X7Xhiq/kcGZRFk01M3PMqCS+YgDkZJlEEZHE3krgUP6MyuNB7SET5Fkx9N Txw7P69/Qr0KmeSHdZisnuzp/2C9wyY1sOBnL01HRwjlO47+chrD4rTgPo6SXcbzbAei YS3EUPdzNT3DLhv1Um2ptuNzqQf3mpkYqbiqRyXonLW6yfYw/u0Omiv37wDVlDI8HyNj 49jw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GE2NbAPs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221444; x=1726826244; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=TuKGB23lOs998iq3raCiFOOgbV12P15mut2w6FlTW0o=; b=FzjNhBlgEaqxwUq7csUhUYftNgV+vezu4lCpXePPPP/CC5IAlPdMRrMF5inXH0rd2c YC2ujxk6cVgoaisY0tICmpY9g1aqw59E8utoSH6CfvEpzEHlULC5uQ/taXZqZIhAYJ20 ilYXkyFaZlBEmdkKjSJBOcw2iPFj2iPqBZDWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221444; x=1726826244; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TuKGB23lOs998iq3raCiFOOgbV12P15mut2w6FlTW0o=; b=TjHqKKlStLBpt4bk7UnThewFvEtfrHXU8DcpkU5HazbVlTDZwvfLg5h4X47nLGein1 46MRyZ2K1IDkyShZJle6tCXkgtZcLH4Tqeq5MeEkC40D9KqFrNgfIm6o/9jIClwfV9PW art8jQjlxrHZVqHgxIve7vVHAeY1U3PLzM2ZPceow54JSiuOB9WhXW56X8bIg8fuUYFH IG41uPo+n9dwt9T5BTTx3TBtrFSUYFuYaPo5aozu6lesCQE/0L36lW0xfUoBjz9JeRZC O6cfVahBYI/FLsNjisxiaF6Qh4JRXOlrmPrkXFXUC74iAhJhKdaiKGAUUB9RZKJ5cze4 gL8w== X-Forwarded-Encrypted: i=2; AJvYcCVOmnrnN9J39WUbqEkAwbULN1k+Wuw8Bzst7uwnJSiwOxxCtlQp1J6NJ5jUHWxqNPR/ajGvsbecE6tpn1ME@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzhGCJxdZafGh8TTG4hv3BYpNEJ5HXUOz5Jw4skIuhOCXcGQWbr 9vI2CMvHziS5mYAtMWfhBje7L03UPxUzEijTHMN4m03htbUV2segV2PUDarVX01MHw== X-Google-Smtp-Source: AGHT+IHUH3GoBoJzPwjevDNt4FIL3KAtE662gcZssRWuNBbm9fjM/X9kEbcU6W7K+WgULc8EqBgWRg== X-Received: by 2002:a2e:beac:0:b0:2f6:6101:5a63 with SMTP id 38308e7fff4ca-2f7918e839fmr15594001fa.2.1726221443752; Fri, 13 Sep 2024 02:57:23 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a50:9b57:0:b0:5c4:2438:78d2 with SMTP id 4fb4d7f45d1cf-5c424387a1bls16358a12.2.-pod-prod-04-eu; Fri, 13 Sep 2024 02:57:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWE9YnCg9rhIwOjYz6rVlIL/5DTsCjyh4x7lLola9Myyi2PFcMJRvSGqV/dTgVxFejjkzAQbNmOSZGI2oXi@amarulasolutions.com X-Received: by 2002:a17:906:794f:b0:a8d:2faf:d341 with SMTP id a640c23a62f3a-a9047b47d7amr167950966b.10.1726221442246; Fri, 13 Sep 2024 02:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221442; cv=none; d=google.com; s=arc-20160816; b=n6W1Yiog1P1yrc+sPTP8MGjHoe+9nnos2/nu99zPevytOCbuV9sJI5Rzkw068+wTQy P2EzqYKxxjETeV/5sktrj62fkJPsJXQE4UIwhz1FBhDjNIxHsiZiXwcEkk1Nk172Vj4o ycSH0m2pO2kL/o4ALx28+YoZ1LxKoMj3I/n0b9Vd6ts+MOlXvdgD/2SgJjr7nT9SY6tf RIleMa+3uvoyb3sQ3SukOtzZ9Ll7K4DfXMsEfbWJQV7EAUkozdVRuIJ2Y0f72/nR/fqF qH2e25eqpBgqvOdCoEpLlTp5wk4sL00VHWn/tC5n/TcUKQv1Qs/SfU3IFUWj70mw3NEQ 8REg== 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=PhwXeIeS/hlgsZV8274n84kaNvg2X3ApN2J4Hg53Mb4=; fh=NiJUB31DArbX6oGCxBL7qeQ7x1qWIaprDOFc4G1RpHM=; b=hZRpUqcqj+m6kjt8xfipRbC/gvrnzG8LyBcGLpQAbi2+lIZXk0a4doPW6PtGQIzdDs tgcWb09w+U3Uc9Ht2i7rq3Yc6E78ioUyfgJIS5fQWtVw0HUY47ggytvp4ilebrLdP9oH uOmBibXvtk354KVLiiTQ0VVuxskLoow8DQ3HXmEhbP01r/A2TPu84uehZmiWpuHp+gwZ kxz3c8i45Q20t+thk0WaWBUt8iE7+LJ5ay9CcP3acBvZ3bvo/G+ux4fB+H1Ep9UMoBZY 7Do7ePpXxV0bTf4ienz1paBSQ/GuNGcXDlY+ck4Vfi8aKHeo6uefMaVFNP99vwF3shEJ Y4CQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GE2NbAPs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d259511e4sor440742866b.5.2024.09.13.02.57.22 for (Google Transport Security); Fri, 13 Sep 2024 02:57:22 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXEcZphs0KOh3e8u3jupCX2/i7Te04qpmvjhbyW6dSkSiJ3Iq96dcrqEkmJeSH8Qww8IOnJrVq3SwtkAx0w@amarulasolutions.com X-Received: by 2002:a17:906:794f:b0:a8d:2faf:d341 with SMTP id a640c23a62f3a-a9047b47d7amr167947266b.10.1726221441327; Fri, 13 Sep 2024 02:57:21 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:20 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Anatolij Gustschin , =?utf-8?q?Jonas_Schw=C3=B6bel?= , Svyatoslav Ryhel , Tom Rini Subject: [PATCH 18/26] video: bridge: Add Samsung DSIM bridge Date: Fri, 13 Sep 2024 11:56:00 +0200 Message-ID: <20240913095622.72377-19-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GE2NbAPs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Samsung MIPI DSIM controller is common DSI IP that can be used in various SoCs like Exynos, i.MX8M Mini/Nano. In order to access this DSI controller between various platform SoCs, the ideal way to incorporate this in the as a bridge that can support all different platform. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/bridge/Kconfig | 13 + drivers/video/bridge/Makefile | 1 + drivers/video/bridge/samsung-dsi-host.c | 1567 +++++++++++++++++++++++ drivers/video/bridge/samsung-dsim.c | 148 +++ drivers/video/bridge/samsung-dsim.h | 20 + 5 files changed, 1749 insertions(+) create mode 100644 drivers/video/bridge/samsung-dsi-host.c create mode 100644 drivers/video/bridge/samsung-dsim.c create mode 100644 drivers/video/bridge/samsung-dsim.h diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig index ab9172737201..5cb1e7af9935 100644 --- a/drivers/video/bridge/Kconfig +++ b/drivers/video/bridge/Kconfig @@ -44,6 +44,19 @@ config VIDEO_BRIDGE_ANALOGIX_ANX6345 The Analogix ANX6345 is RGB-to-DP converter. It enables an eDP LCD panel to be connected to an parallel LCD interface. +config VIDEO_BRIDGE_SAMSUNG_DSIM + bool "Enable IMX SEC DSI video support" + select MIPI_DPHY_HELPERS + select VIDEO_BRIDGE + select VIDEO_LINK + select VIDEO_MIPI_DSI + help + Enables the common driver code for the Samsung + MIPI DSI block found in SoCs from various vendors. + As this does not provide any functionality by itself (but + rather requires a SoC-specific glue driver to call it), it + can not be enabled from the configuration menu. + config VIDEO_BRIDGE_SOLOMON_SSD2825 bool "Solomon SSD2825 bridge driver" depends on PANEL && DM_GPIO diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile index 58697e3cbe90..8f49013299ae 100644 --- a/drivers/video/bridge/Makefile +++ b/drivers/video/bridge/Makefile @@ -8,5 +8,6 @@ obj-$(CONFIG_VIDEO_BRIDGE_PARADE_DP501) += dp501.o obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o +obj-$(CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM) += samsung-dsim.o samsung-dsi-host.o obj-$(CONFIG_VIDEO_BRIDGE_SOLOMON_SSD2825) += ssd2825.o obj-$(CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768) += tc358768.o diff --git a/drivers/video/bridge/samsung-dsi-host.c b/drivers/video/bridge/samsung-dsi-host.c new file mode 100644 index 000000000000..dd3e33c4edc7 --- /dev/null +++ b/drivers/video/bridge/samsung-dsi-host.c @@ -0,0 +1,1567 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2018 NXP + * + */ + +#define LOG_CATEGORY UCLASS_DSI_HOST + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "samsung-dsim.h" + +#define MIPI_FIFO_TIMEOUT 250000 /* 250ms */ + +#define DRIVER_NAME "samsung_dsi" + +/* reg bit manipulation */ +#define REG_MASK(e, s) (((1 << ((e) - (s) + 1)) - 1) << (s)) +#define REG_PUT(x, e, s) (((x) << (s)) & REG_MASK(e, s)) +#define REG_GET(x, e, s) (((x) & REG_MASK(e, s)) >> (s)) + +#define RGB_STATUS_CMDMODE_INSEL BIT(31) +#define RGB_STATUS_GET_RGBSTATE(x) REG_GET(x, 12, 0) + +#define CLKCTRL_DPHY_SEL_1P5G (0x0 << 29) +#define CLKCTRL_PLLBYPASS BIT(29) +#define CLKCTRL_BYTECLKSRC_DPHY_PLL REG_PUT(0, 26, 25) +#define CLKCTRL_SET_LANEESCCLKEN(x) REG_PUT(x, 23, 19) +#define CLKCTRL_SET_ESCPRESCALER(x) REG_PUT(x, 15, 0) + +#define ESCMODE_SET_STOPSTATE_CNT(X) REG_PUT(x, 31, 21) +#define ESCMODE_FORCESTOPSTATE BIT(20) +#define ESCMODE_FORCEBTA BIT(16) +#define ESCMODE_CMDLPDT BIT(7) +#define ESCMODE_TXLPDT BIT(6) +#define ESCMODE_TXTRIGGERRST BIT(5) + +#define MVPORCH_SET_CMDALLOW(x) REG_PUT(x, 31, 28) +#define MVPORCH_SET_STABLEVFP(x) REG_PUT(x, 26, 16) +#define MVPORCH_SET_MAINVBP(x) REG_PUT(x, 10, 0) + +#define MHPORCH_SET_MAINHFP(x) REG_PUT(x, 31, 16) +#define MHPORCH_SET_MAINHBP(x) REG_PUT(x, 15, 0) + +#define MSYNC_SET_MAINVSA(x) REG_PUT(x, 31, 22) +#define MSYNC_SET_MAINHSA(x) REG_PUT(x, 15, 0) + +#define INTSRC_PLLSTABLE BIT(31) +#define INTSRC_SWRSTRELEASE BIT(30) +#define INTSRC_SFRPLFIFOEMPTY BIT(29) +#define INTSRC_SFRPHFIFOEMPTY BIT(28) +#define INTSRC_FRAMEDONE BIT(24) +#define INTSRC_LPDRTOUT BIT(21) +#define INTSRC_TATOUT BIT(20) +#define INTSRC_RXDATDONE BIT(18) +#define INTSRC_MASK (INTSRC_PLLSTABLE | \ + INTSRC_SWRSTRELEASE | \ + INTSRC_SFRPLFIFOEMPTY | \ + INTSRC_SFRPHFIFOEMPTY | \ + INTSRC_FRAMEDONE | \ + INTSRC_LPDRTOUT | \ + INTSRC_TATOUT | \ + INTSRC_RXDATDONE) + +#define INTMSK_MSKPLLSTABLE BIT(31) +#define INTMSK_MSKSWRELEASE BIT(30) +#define INTMSK_MSKSFRPLFIFOEMPTY BIT(29) +#define INTMSK_MSKSFRPHFIFOEMPTY BIT(28) +#define INTMSK_MSKFRAMEDONE BIT(24) +#define INTMSK_MSKLPDRTOUT BIT(21) +#define INTMSK_MSKTATOUT BIT(20) +#define INTMSK_MSKRXDATDONE BIT(18) + +#define PKTHDR_SET_DATA1(x) REG_PUT(x, 23, 16) +#define PKTHDR_GET_DATA1(x) REG_GET(x, 23, 16) +#define PKTHDR_SET_DATA0(x) REG_PUT(x, 15, 8) +#define PKTHDR_GET_DATA0(x) REG_GET(x, 15, 8) +#define PKTHDR_GET_WC(x) REG_GET(x, 23, 8) +#define PKTHDR_SET_DI(x) REG_PUT(x, 7, 0) +#define PKTHDR_GET_DI(x) REG_GET(x, 7, 0) +#define PKTHDR_SET_DT(x) REG_PUT(x, 5, 0) +#define PKTHDR_GET_DT(x) REG_GET(x, 5, 0) +#define PKTHDR_SET_VC(x) REG_PUT(x, 7, 6) +#define PKTHDR_GET_VC(x) REG_GET(x, 7, 6) + +#define FIFOCTRL_FULLRX BIT(25) +#define FIFOCTRL_EMPTYRX BIT(24) +#define FIFOCTRL_FULLHSFR BIT(23) +#define FIFOCTRL_EMPTYHSFR BIT(22) +#define FIFOCTRL_FULLLSFR BIT(21) +#define FIFOCTRL_EMPTYLSFR BIT(20) +#define FIFOCTRL_FULLHMAIN BIT(11) +#define FIFOCTRL_EMPTYHMAIN BIT(10) +#define FIFOCTRL_FULLLMAIN BIT(9) +#define FIFOCTRL_EMPTYLMAIN BIT(8) +#define FIFOCTRL_NINITRX BIT(4) +#define FIFOCTRL_NINITSFR BIT(3) +#define FIFOCTRL_NINITI80 BIT(2) +#define FIFOCTRL_NINITSUB BIT(1) +#define FIFOCTRL_NINITMAIN BIT(0) + +#define PLLCTRL_DPDNSWAP_CLK BIT(25) +#define PLLCTRL_DPDNSWAP_DAT BIT(24) +#define PLLCTRL_PLLEN BIT(23) +#define PLLCTRL_SET_PMS(x) REG_PUT(x, 19, 1) +#define PLLCTRL_SET_P(x) REG_PUT(x, 18, 13) +#define PLLCTRL_SET_M(x) REG_PUT(x, 12, 3) +#define PLLCTRL_SET_S(x) REG_PUT(x, 2, 0) + +#define MAX_MAIN_HRESOL 2047 +#define MAX_MAIN_VRESOL 2047 +#define MAX_SUB_HRESOL 1024 +#define MAX_SUB_VRESOL 1024 + +/* in KHZ */ +#define MAX_ESC_CLK_FREQ 20000 + +/* dsim all irqs index */ +#define PLLSTABLE 1 +#define SWRSTRELEASE 2 +#define SFRPLFIFOEMPTY 3 +#define SFRPHFIFOEMPTY 4 +#define SYNCOVERRIDE 5 +#define BUSTURNOVER 6 +#define FRAMEDONE 7 +#define LPDRTOUT 8 +#define TATOUT 9 +#define RXDATDONE 10 +#define RXTE 11 +#define RXACK 12 +#define ERRRXECC 13 +#define ERRRXCRC 14 +#define ERRESC3 15 +#define ERRESC2 16 +#define ERRESC1 17 +#define ERRESC0 18 +#define ERRSYNC3 19 +#define ERRSYNC2 20 +#define ERRSYNC1 21 +#define ERRSYNC0 22 +#define ERRCONTROL3 23 +#define ERRCONTROL2 24 +#define ERRCONTROL1 25 +#define ERRCONTROL0 26 + +#define PS_TO_CYCLE(ps, hz) DIV64_U64_ROUND_CLOSEST(((ps) * (hz)), 1000000000000ULL) + +#define MIPI_HFP_PKT_OVERHEAD 6 +#define MIPI_HBP_PKT_OVERHEAD 6 +#define MIPI_HSA_PKT_OVERHEAD 6 + +/* DSIM_STATUS */ +#define DSIM_STOP_STATE_DAT(x) (((x) & 0xf) << 0) +#define DSIM_STOP_STATE_CLK BIT(8) +#define DSIM_TX_READY_HS_CLK BIT(10) +#define DSIM_PLL_STABLE BIT(31) + +/* DSIM_SWRST */ +#define DSIM_FUNCRST BIT(16) +#define DSIM_SWRST BIT(0) + +/* DSIM_TIMEOUT */ +#define DSIM_LPDR_TIMEOUT(x) ((x) << 0) +#define DSIM_BTA_TIMEOUT(x) ((x) << 16) + +/* DSIM_CLKCTRL */ +#define DSIM_ESC_PRESCALER(x) (((x) & 0xffff) << 0) +#define DSIM_ESC_PRESCALER_MASK (0xffff << 0) +#define DSIM_LANE_ESC_CLK_EN_CLK BIT(19) +#define DSIM_LANE_ESC_CLK_EN_DATA(x) (((x) & 0xf) << 20) +#define DSIM_LANE_ESC_CLK_EN_DATA_MASK (0xf << 20) +#define DSIM_BYTE_CLKEN BIT(24) +#define DSIM_BYTE_CLK_SRC(x) (((x) & 0x3) << 25) +#define DSIM_BYTE_CLK_SRC_MASK (0x3 << 25) +#define DSIM_PLL_BYPASS BIT(27) +#define DSIM_ESC_CLKEN BIT(28) +#define DSIM_TX_REQUEST_HSCLK BIT(31) + +/* DSIM_CONFIG */ +#define DSIM_LANE_EN_CLK BIT(0) +#define DSIM_LANE_EN(x) (((x) & 0xf) << 1) +#define DSIM_NUM_OF_DATA_LANE(x) (((x) & 0x3) << 5) +#define DSIM_SUB_PIX_FORMAT(x) (((x) & 0x7) << 8) +#define DSIM_MAIN_PIX_FORMAT_MASK (0x7 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB888 (0x7 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB666 (0x6 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB666_P (0x5 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB565 (0x4 << 12) +#define DSIM_SUB_VC(x) (((x) & 0x3) << 16) +#define DSIM_MAIN_VC(x) (((x) & 0x3) << 18) +#define DSIM_HSA_DISABLE_MODE BIT(20) +#define DSIM_HBP_DISABLE_MODE BIT(21) +#define DSIM_HFP_DISABLE_MODE BIT(22) +/* + * The i.MX 8M Mini Applications Processor Reference Manual, + * Rev. 3, 11/2020 Page 4091 + * The i.MX 8M Nano Applications Processor Reference Manual, + * Rev. 2, 07/2022 Page 3058 + * The i.MX 8M Plus Applications Processor Reference Manual, + * Rev. 1, 06/2021 Page 5436 + * all claims this bit is 'HseDisableMode' with the definition + * 0 = Disables transfer + * 1 = Enables transfer + * + * This clearly states that HSE is not a disabled bit. + * + * The naming convention follows as per the manual and the + * driver logic is based on the MIPI_DSI_MODE_VIDEO_HSE flag. + */ +#define DSIM_HSE_DISABLE_MODE BIT(23) +#define DSIM_AUTO_MODE BIT(24) +#define DSIM_VIDEO_MODE BIT(25) +#define DSIM_BURST_MODE BIT(26) +#define DSIM_SYNC_INFORM BIT(27) +#define DSIM_EOT_DISABLE BIT(28) +#define DSIM_MFLUSH_VS BIT(29) +/* This flag is valid only for exynos3250/3472/5260/5430 */ +#define DSIM_CLKLANE_STOP BIT(30) +#define DSIM_NON_CONTINUOUS_CLKLANE BIT(31) + +/* DSIM_ESCMODE */ +#define DSIM_TX_TRIGGER_RST BIT(4) +#define DSIM_TX_LPDT_LP BIT(6) +#define DSIM_CMD_LPDT_LP BIT(7) +#define DSIM_FORCE_BTA BIT(16) +#define DSIM_FORCE_STOP_STATE BIT(20) +#define DSIM_STOP_STATE_CNT(x) (((x) & 0x7ff) << 21) +#define DSIM_STOP_STATE_CNT_MASK (0x7ff << 21) + +/* DSIM_MDRESOL */ +#define DSIM_MAIN_STAND_BY BIT(31) +#define DSIM_MAIN_VRESOL(x, num_bits) (((x) & ((1 << (num_bits)) - 1)) << 16) +#define DSIM_MAIN_HRESOL(x, num_bits) (((x) & ((1 << (num_bits)) - 1)) << 0) + +/* DSIM_MVPORCH */ +#define DSIM_CMD_ALLOW(x) ((x) << 28) +#define DSIM_STABLE_VFP(x) ((x) << 16) +#define DSIM_MAIN_VBP(x) ((x) << 0) +#define DSIM_CMD_ALLOW_MASK (0xf << 28) +#define DSIM_STABLE_VFP_MASK (0x7ff << 16) +#define DSIM_MAIN_VBP_MASK (0x7ff << 0) + +/* DSIM_MHPORCH */ +#define DSIM_MAIN_HFP(x) ((x) << 16) +#define DSIM_MAIN_HBP(x) ((x) << 0) +#define DSIM_MAIN_HFP_MASK ((0xffff) << 16) +#define DSIM_MAIN_HBP_MASK ((0xffff) << 0) + +/* DSIM_MSYNC */ +#define DSIM_MAIN_VSA(x) ((x) << 22) +#define DSIM_MAIN_HSA(x) ((x) << 0) +#define DSIM_MAIN_VSA_MASK ((0x3ff) << 22) +#define DSIM_MAIN_HSA_MASK ((0xffff) << 0) + +/* DSIM_SDRESOL */ +#define DSIM_SUB_STANDY(x) ((x) << 31) +#define DSIM_SUB_VRESOL(x) ((x) << 16) +#define DSIM_SUB_HRESOL(x) ((x) << 0) +#define DSIM_SUB_STANDY_MASK ((0x1) << 31) +#define DSIM_SUB_VRESOL_MASK ((0x7ff) << 16) +#define DSIM_SUB_HRESOL_MASK ((0x7ff) << 0) + +/* DSIM_INTSRC */ +#define DSIM_INT_PLL_STABLE BIT(31) +#define DSIM_INT_SW_RST_RELEASE BIT(30) +#define DSIM_INT_SFR_FIFO_EMPTY BIT(29) +#define DSIM_INT_SFR_HDR_FIFO_EMPTY BIT(28) +#define DSIM_INT_BTA BIT(25) +#define DSIM_INT_FRAME_DONE BIT(24) +#define DSIM_INT_RX_TIMEOUT BIT(21) +#define DSIM_INT_BTA_TIMEOUT BIT(20) +#define DSIM_INT_RX_DONE BIT(18) +#define DSIM_INT_RX_TE BIT(17) +#define DSIM_INT_RX_ACK BIT(16) +#define DSIM_INT_RX_ECC_ERR BIT(15) +#define DSIM_INT_RX_CRC_ERR BIT(14) + +/* DSIM_FIFOCTRL */ +#define DSIM_RX_DATA_FULL BIT(25) +#define DSIM_RX_DATA_EMPTY BIT(24) +#define DSIM_SFR_HEADER_FULL BIT(23) +#define DSIM_SFR_HEADER_EMPTY BIT(22) +#define DSIM_SFR_PAYLOAD_FULL BIT(21) +#define DSIM_SFR_PAYLOAD_EMPTY BIT(20) +#define DSIM_I80_HEADER_FULL BIT(19) +#define DSIM_I80_HEADER_EMPTY BIT(18) +#define DSIM_I80_PAYLOAD_FULL BIT(17) +#define DSIM_I80_PAYLOAD_EMPTY BIT(16) +#define DSIM_SD_HEADER_FULL BIT(15) +#define DSIM_SD_HEADER_EMPTY BIT(14) +#define DSIM_SD_PAYLOAD_FULL BIT(13) +#define DSIM_SD_PAYLOAD_EMPTY BIT(12) +#define DSIM_MD_HEADER_FULL BIT(11) +#define DSIM_MD_HEADER_EMPTY BIT(10) +#define DSIM_MD_PAYLOAD_FULL BIT(9) +#define DSIM_MD_PAYLOAD_EMPTY BIT(8) +#define DSIM_RX_FIFO BIT(4) +#define DSIM_SFR_FIFO BIT(3) +#define DSIM_I80_FIFO BIT(2) +#define DSIM_SD_FIFO BIT(1) +#define DSIM_MD_FIFO BIT(0) + +/* DSIM_PHYACCHR */ +#define DSIM_AFC_EN BIT(14) +#define DSIM_AFC_CTL(x) (((x) & 0x7) << 5) + +/* DSIM_PLLCTRL */ +#define DSIM_FREQ_BAND(x) ((x) << 24) +#define DSIM_PLL_EN BIT(23) +#define DSIM_PLL_P(x, offset) ((x) << (offset)) +#define DSIM_PLL_M(x) ((x) << 4) +#define DSIM_PLL_S(x) ((x) << 1) + +/* DSIM_PHYCTRL */ +#define DSIM_PHYCTRL_ULPS_EXIT(x) (((x) & 0x1ff) << 0) +#define DSIM_PHYCTRL_B_DPHYCTL_VREG_LP BIT(30) +#define DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP BIT(14) + +/* DSIM_PHYTIMING */ +#define DSIM_PHYTIMING_LPX(x) ((x) << 8) +#define DSIM_PHYTIMING_HS_EXIT(x) ((x) << 0) + +/* DSIM_PHYTIMING1 */ +#define DSIM_PHYTIMING1_CLK_PREPARE(x) ((x) << 24) +#define DSIM_PHYTIMING1_CLK_ZERO(x) ((x) << 16) +#define DSIM_PHYTIMING1_CLK_POST(x) ((x) << 8) +#define DSIM_PHYTIMING1_CLK_TRAIL(x) ((x) << 0) + +/* DSIM_PHYTIMING2 */ +#define DSIM_PHYTIMING2_HS_PREPARE(x) ((x) << 16) +#define DSIM_PHYTIMING2_HS_ZERO(x) ((x) << 8) +#define DSIM_PHYTIMING2_HS_TRAIL(x) ((x) << 0) + +#define DSI_MAX_BUS_WIDTH 4 +#define DSI_NUM_VIRTUAL_CHANNELS 4 +#define DSI_TX_FIFO_SIZE 2048 +#define DSI_RX_FIFO_SIZE 256 +#define DSI_XFER_TIMEOUT_MS 100 +#define DSI_RX_FIFO_EMPTY 0x30800002 + +struct samsung_dsim_driver_data { + const unsigned int *reg_ofs; + unsigned int plltmr_reg; + unsigned int has_freqband:1; + unsigned int has_clklane_stop:1; + unsigned int has_broken_fifoctrl_emptyhdr:1; + unsigned int num_clks; + unsigned int min_freq; + unsigned int max_freq; + unsigned int wait_for_reset; + unsigned int num_bits_resol; + unsigned int pll_p_offset; + const unsigned int *reg_values; + unsigned int pll_fin_min; + unsigned int pll_fin_max; + u16 m_min; + u16 m_max; +}; + +enum reg_idx { + DSIM_STATUS_REG, /* Status register */ + DSIM_RGB_STATUS_REG, /* RGB status register */ + DSIM_SWRST_REG, /* Software reset register */ + DSIM_CLKCTRL_REG, /* Clock control register */ + DSIM_TIMEOUT_REG, /* Time out register */ + DSIM_CONFIG_REG, /* Configuration register */ + DSIM_ESCMODE_REG, /* Escape mode register */ + DSIM_MDRESOL_REG, + DSIM_MVPORCH_REG, /* Main display Vporch register */ + DSIM_MHPORCH_REG, /* Main display Hporch register */ + DSIM_MSYNC_REG, /* Main display sync area register */ + DSIM_INTSRC_REG, /* Interrupt source register */ + DSIM_INTMSK_REG, /* Interrupt mask register */ + DSIM_PKTHDR_REG, /* Packet Header FIFO register */ + DSIM_PAYLOAD_REG, /* Payload FIFO register */ + DSIM_RXFIFO_REG, /* Read FIFO register */ + DSIM_FIFOCTRL_REG, /* FIFO status and control register */ + DSIM_PLLCTRL_REG, /* PLL control register */ + DSIM_PHYCTRL_REG, + DSIM_PHYTIMING_REG, + DSIM_PHYTIMING1_REG, + DSIM_PHYTIMING2_REG, + NUM_REGS +}; + +static const unsigned int exynos_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x00, + [DSIM_SWRST_REG] = 0x04, + [DSIM_CLKCTRL_REG] = 0x08, + [DSIM_TIMEOUT_REG] = 0x0c, + [DSIM_CONFIG_REG] = 0x10, + [DSIM_ESCMODE_REG] = 0x14, + [DSIM_MDRESOL_REG] = 0x18, + [DSIM_MVPORCH_REG] = 0x1c, + [DSIM_MHPORCH_REG] = 0x20, + [DSIM_MSYNC_REG] = 0x24, + [DSIM_INTSRC_REG] = 0x2c, + [DSIM_INTMSK_REG] = 0x30, + [DSIM_PKTHDR_REG] = 0x34, + [DSIM_PAYLOAD_REG] = 0x38, + [DSIM_RXFIFO_REG] = 0x3c, + [DSIM_FIFOCTRL_REG] = 0x44, + [DSIM_PLLCTRL_REG] = 0x4c, + [DSIM_PHYCTRL_REG] = 0x5c, + [DSIM_PHYTIMING_REG] = 0x64, + [DSIM_PHYTIMING1_REG] = 0x68, + [DSIM_PHYTIMING2_REG] = 0x6c, +}; + +static const unsigned int exynos5433_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x04, + [DSIM_RGB_STATUS_REG] = 0x08, + [DSIM_SWRST_REG] = 0x0C, + [DSIM_CLKCTRL_REG] = 0x10, + [DSIM_TIMEOUT_REG] = 0x14, + [DSIM_CONFIG_REG] = 0x18, + [DSIM_ESCMODE_REG] = 0x1C, + [DSIM_MDRESOL_REG] = 0x20, + [DSIM_MVPORCH_REG] = 0x24, + [DSIM_MHPORCH_REG] = 0x28, + [DSIM_MSYNC_REG] = 0x2C, + [DSIM_INTSRC_REG] = 0x34, + [DSIM_INTMSK_REG] = 0x38, + [DSIM_PKTHDR_REG] = 0x3C, + [DSIM_PAYLOAD_REG] = 0x40, + [DSIM_RXFIFO_REG] = 0x44, + [DSIM_FIFOCTRL_REG] = 0x4C, + [DSIM_PLLCTRL_REG] = 0x94, + [DSIM_PHYCTRL_REG] = 0xA4, + [DSIM_PHYTIMING_REG] = 0xB4, + [DSIM_PHYTIMING1_REG] = 0xB8, + [DSIM_PHYTIMING2_REG] = 0xBC, +}; + +enum reg_value_idx { + RESET_TYPE, + PLL_TIMER, + STOP_STATE_CNT, + PHYCTRL_ULPS_EXIT, + PHYCTRL_VREG_LP, + PHYCTRL_SLEW_UP, + PHYTIMING_LPX, + PHYTIMING_HS_EXIT, + PHYTIMING_CLK_PREPARE, + PHYTIMING_CLK_ZERO, + PHYTIMING_CLK_POST, + PHYTIMING_CLK_TRAIL, + PHYTIMING_HS_PREPARE, + PHYTIMING_HS_ZERO, + PHYTIMING_HS_TRAIL +}; + +static const unsigned int reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x0af), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x27), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x09), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const unsigned int exynos5422_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x08), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0d), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x30), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x0a), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0c), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x11), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0d), +}; + +static const unsigned int exynos5433_reg_values[] = { + [RESET_TYPE] = DSIM_FUNCRST, + [PLL_TIMER] = 22200, + [STOP_STATE_CNT] = 0xa, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x190), + [PHYCTRL_VREG_LP] = DSIM_PHYCTRL_B_DPHYCTL_VREG_LP, + [PHYCTRL_SLEW_UP] = DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x07), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0c), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x2d), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x09), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0b), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x10), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), +}; + +static const unsigned int imx8mm_dsim_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x26), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x08), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x58, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 5, + .max_freq = 1500, + .wait_for_reset = 0, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5433_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1500, + .wait_for_reset = 1, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5422_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 2100, + .wait_for_reset = 0, + .num_bits_resol = 12, + /* + * Unlike Exynos, PLL_P(PMS_P) offset 14 is used in i.MX8M Mini/Nano/Plus + * downstream driver - drivers/gpu/drm/bridge/sec-dsim.c + */ + .pll_p_offset = 14, + .reg_values = imx8mm_dsim_reg_values, + .pll_fin_min = 2, + .pll_fin_max = 30, + .m_min = 64, + .m_max = 1023, + .min_freq = 1050, +}; + +static const struct samsung_dsim_driver_data * +samsung_dsim_types[DSIM_TYPE_COUNT] = { + [DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, + [DSIM_TYPE_EXYNOS4210] = &exynos4_dsi_driver_data, + [DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, + [DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, + [DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, + [DSIM_TYPE_IMX8MM] = &imx8mm_dsi_driver_data, + [DSIM_TYPE_IMX8MP] = &imx8mm_dsi_driver_data, +}; + +/* DSIM PLL configuration from spec: + * + * Fout(DDR) = (M * Fin) / (P * 2^S), so Fout / Fin = M / (P * 2^S) + * Fin_pll = Fin / P (6 ~ 12 MHz) + * S: [2:0], M: [12:3], P: [18:13], so + * TODO: 'S' is in [0 ~ 3], 'M' is in, 'P' is in [1 ~ 33] + * + */ + +struct samsung_dsi { + void __iomem *reg_base; + struct clk sclk_mipi; + const struct samsung_dsim_driver_data *driver_data; + + /* kHz clocks */ + u64 pix_clk; + u64 bit_clk; + u64 hs_clock; + + unsigned int lanes; + unsigned int channel; /* virtual channel */ + enum mipi_dsi_pixel_format format; + unsigned long mode_flags; + unsigned int pms; + + struct mipi_dsi_device *device; + u32 max_data_lanes; + + struct mipi_dsi_host dsi_host; + struct display_timing timings; +}; + +static inline void samsung_dsim_write(struct samsung_dsi *dsi, + enum reg_idx idx, u32 val) +{ + writel(val, dsi->reg_base + dsi->driver_data->reg_ofs[idx]); +} + +static inline u32 samsung_dsim_read(struct samsung_dsi *dsi, enum reg_idx idx) +{ + return readl(dsi->reg_base + dsi->driver_data->reg_ofs[idx]); +} + +static int samsung_dsi_wait_for_pkt_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPLFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPLFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_for_hdr_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPHFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPHFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_for_rx_done(struct samsung_dsi *dsim, + unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_RXDATDONE) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_RXDATDONE); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_pll_stable(struct samsung_dsi *dsim) +{ + u32 status; + ulong start; + + start = get_timer(0); /* Get current timestamp */ + + do { + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (status & DSIM_PLL_STABLE) + return 0; + } while (get_timer(0) < (start + 100)); /* Wait 100ms */ + + return -ETIMEDOUT; +} + +static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsi *dsi, + unsigned long fin, + unsigned long fout, + u8 *p, u16 *m, u8 *s) +{ + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; + unsigned long best_freq = 0; + u32 min_delta = 0xffffffff; + u8 p_min, p_max; + u8 _p, best_p; + u16 _m, best_m; + u8 _s, best_s; + + p_min = DIV_ROUND_UP(fin, (MHZ(12))); + p_max = fin / (MHZ(6)); + + for (_p = p_min; _p <= p_max; ++_p) { + for (_s = 0; _s <= 5; ++_s) { + u64 tmp; + u32 delta; + + tmp = (u64)fout * (_p << _s); + do_div(tmp, fin); + _m = tmp; + if (_m < driver_data->m_min || _m > driver_data->m_max) + continue; + + tmp = (u64)_m * fin; + do_div(tmp, _p); + if (tmp < driver_data->min_freq * MHZ(1) || + tmp > driver_data->max_freq * MHZ(1)) + continue; + + tmp = (u64)_m * fin; + do_div(tmp, _p << _s); + + delta = abs(fout - tmp); + if (delta < min_delta) { + best_p = _p; + best_m = _m; + best_s = _s; + min_delta = delta; + best_freq = tmp; + } + } + } + + if (best_freq) { + *p = best_p; + *m = best_m; + *s = best_s; + } + + return best_freq; +} + +static int samsung_dsi_config_pll(struct samsung_dsi *dsim) +{ + int ret; + u32 pllctrl = 0, status, data_lanes_en, stop; + + writel(dsim->driver_data->reg_values[PLL_TIMER], + dsim->reg_base + dsim->driver_data->plltmr_reg); + + /* TODO: config dp/dn swap if requires */ + + pllctrl |= PLLCTRL_SET_PMS(dsim->pms) | PLLCTRL_PLLEN; + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, pllctrl); + + ret = samsung_dsi_wait_pll_stable(dsim); + if (ret) { + log_err("wait for pll stable time out\n"); + return ret; + } + + /* wait for clk & data lanes to go to stop state */ + mdelay(1); + + data_lanes_en = (0x1 << dsim->lanes) - 1; + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (!(status & DSIM_STOP_STATE_CLK)) { + log_err("clock is not in stop state\n"); + return -EBUSY; + } + + stop = DSIM_STOP_STATE_DAT(status); + if ((stop & data_lanes_en) != data_lanes_en) { + log_err("one or more data lanes is not in stop state\n"); + return -EBUSY; + } + + return 0; +} + +static void samsung_dsi_set_main_mode(struct samsung_dsi *dsim) +{ + u32 bpp, hfp_wc, hbp_wc, hsa_wc, wc; + u32 mdresol = 0, mvporch = 0, mhporch = 0, msync = 0; + struct display_timing *timings = &dsim->timings; + unsigned int num_bits_resol = dsim->driver_data->num_bits_resol; + + mdresol |= DSIM_MAIN_VRESOL(timings->vactive.typ, num_bits_resol) | + DSIM_MAIN_HRESOL(timings->hactive.typ, num_bits_resol); + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); + + mvporch |= MVPORCH_SET_MAINVBP(timings->vback_porch.typ) | + MVPORCH_SET_STABLEVFP(timings->vfront_porch.typ) | + MVPORCH_SET_CMDALLOW(0x0); + samsung_dsim_write(dsim, DSIM_MVPORCH_REG, mvporch); + + bpp = mipi_dsi_pixel_format_to_bpp(dsim->format); + + wc = DIV_ROUND_UP(timings->hfront_porch.typ * (bpp >> 3), dsim->lanes); + hfp_wc = wc > MIPI_HFP_PKT_OVERHEAD ? + wc - MIPI_HFP_PKT_OVERHEAD : timings->hfront_porch.typ; + wc = DIV_ROUND_UP(timings->hback_porch.typ * (bpp >> 3), dsim->lanes); + hbp_wc = wc > MIPI_HBP_PKT_OVERHEAD ? + wc - MIPI_HBP_PKT_OVERHEAD : timings->hback_porch.typ; + + mhporch |= MHPORCH_SET_MAINHFP(hfp_wc) | + MHPORCH_SET_MAINHBP(hbp_wc); + + samsung_dsim_write(dsim, DSIM_MHPORCH_REG, mhporch); + + wc = DIV_ROUND_UP(timings->hsync_len.typ * (bpp >> 3), dsim->lanes); + hsa_wc = wc > MIPI_HSA_PKT_OVERHEAD ? + wc - MIPI_HSA_PKT_OVERHEAD : timings->hsync_len.typ; + + msync |= MSYNC_SET_MAINVSA(timings->vsync_len.typ) | + MSYNC_SET_MAINHSA(hsa_wc); + + debug("hfp_wc %u hbp_wc %u hsa_wc %u\n", hfp_wc, hbp_wc, hsa_wc); + + samsung_dsim_write(dsim, DSIM_MSYNC_REG, msync); +} + +static void samsung_dsi_config_dpi(struct samsung_dsi *dsim) +{ + u32 config = 0, rgb_status = 0, data_lanes_en; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) + rgb_status &= ~RGB_STATUS_CMDMODE_INSEL; + else + rgb_status |= RGB_STATUS_CMDMODE_INSEL; + + samsung_dsim_write(dsim, DSIM_RGB_STATUS_REG, rgb_status); + + if (dsim->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) { + config |= DSIM_CLKLANE_STOP; + config |= DSIM_NON_CONTINUOUS_CLKLANE; + } + + if (dsim->mode_flags & MIPI_DSI_MODE_VSYNC_FLUSH) + config |= DSIM_MFLUSH_VS; + + /* disable EoT packets in HS mode */ + if (dsim->mode_flags & MIPI_DSI_MODE_EOT_PACKET) + config |= DSIM_EOT_DISABLE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + config |= DSIM_VIDEO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + config |= DSIM_BURST_MODE; + + else if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + config |= DSIM_SYNC_INFORM; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_AUTO_VERT) + config |= DSIM_AUTO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSE) + config |= DSIM_HSE_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HFP) + config |= DSIM_HFP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HBP) + config |= DSIM_HBP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSA) + config |= DSIM_HSA_DISABLE_MODE; + } + + config |= DSIM_MAIN_VC(dsim->channel); + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + switch (dsim->format) { + case MIPI_DSI_FMT_RGB888: + config |= DSIM_MAIN_PIX_FORMAT_RGB888; + break; + case MIPI_DSI_FMT_RGB666: + config |= DSIM_MAIN_PIX_FORMAT_RGB666; + break; + case MIPI_DSI_FMT_RGB666_PACKED: + config |= DSIM_MAIN_PIX_FORMAT_RGB666_P; + break; + case MIPI_DSI_FMT_RGB565: + config |= DSIM_MAIN_PIX_FORMAT_RGB565; + break; + default: + log_err("invalid pixel format\n"); + break; + } + } + + /* config data lanes number and enable lanes */ + data_lanes_en = BIT(dsim->lanes) - 1; + config |= (DSIM_NUM_OF_DATA_LANE(dsim->lanes - 1) | DSIM_LANE_EN_CLK | + DSIM_LANE_EN(data_lanes_en)); + + debug("DSIM config 0x%x\n", config); + + samsung_dsim_write(dsim, DSIM_CONFIG_REG, config); +} + +static void samsung_dsi_config_cmd_lpm(struct samsung_dsi *dsim, bool enable) +{ + u32 escmode; + + escmode = samsung_dsim_read(dsim, DSIM_ESCMODE_REG); + + if (enable) + escmode |= ESCMODE_CMDLPDT; + else + escmode &= ~ESCMODE_CMDLPDT; + + samsung_dsim_write(dsim, DSIM_ESCMODE_REG, escmode); +} + +static void samsung_dsi_config_dphy(struct samsung_dsi *dsim) +{ + const struct samsung_dsim_driver_data *driver_data = dsim->driver_data; + const unsigned int *reg_values = driver_data->reg_values; + u32 reg; + struct phy_configure_opts_mipi_dphy cfg; + int clk_prepare, lpx, clk_zero, clk_post, clk_trail; + int hs_exit, hs_prepare, hs_zero, hs_trail; + unsigned long long byte_clock = dsim->hs_clock / 8; + + if (driver_data->has_freqband) + return; + + phy_mipi_dphy_get_default_config_for_hsclk(dsim->hs_clock, dsim->lanes, &cfg); + + /* + * TODO: + * The tech Applications Processor manuals for i.MX8M Mini, Nano, + * and Plus don't state what the definition of the PHYTIMING + * bits are beyond their address and bit position. + * After reviewing NXP's downstream code, it appears + * that the various PHYTIMING registers take the number + * of cycles and use various dividers on them. This + * calculation does not result in an exact match to the + * downstream code, but it is very close to the values + * generated by their lookup table, and it appears + * to sync at a variety of resolutions. If someone + * can get a more accurate mathematical equation needed + * for these registers, this should be updated. + */ + + lpx = PS_TO_CYCLE(cfg.lpx, byte_clock); + hs_exit = PS_TO_CYCLE(cfg.hs_exit, byte_clock); + clk_prepare = PS_TO_CYCLE(cfg.clk_prepare, byte_clock); + clk_zero = PS_TO_CYCLE(cfg.clk_zero, byte_clock); + clk_post = PS_TO_CYCLE(cfg.clk_post, byte_clock); + clk_trail = PS_TO_CYCLE(cfg.clk_trail, byte_clock); + hs_prepare = PS_TO_CYCLE(cfg.hs_prepare, byte_clock); + hs_zero = PS_TO_CYCLE(cfg.hs_zero, byte_clock); + hs_trail = PS_TO_CYCLE(cfg.hs_trail, byte_clock); + + /* B D-PHY: D-PHY Master & Slave Analog Block control */ + reg = reg_values[PHYCTRL_ULPS_EXIT] | reg_values[PHYCTRL_VREG_LP] | + reg_values[PHYCTRL_SLEW_UP]; + + samsung_dsim_write(dsim, DSIM_PHYCTRL_REG, reg); + + /* + * T LPX: Transmitted length of any Low-Power state period + * T HS-EXIT: Time that the transmitter drives LP-11 following a HS + * burst + */ + + reg = DSIM_PHYTIMING_LPX(lpx) | DSIM_PHYTIMING_HS_EXIT(hs_exit); + samsung_dsim_write(dsim, DSIM_PHYTIMING_REG, reg); + + /* + * T CLK-PREPARE: Time that the transmitter drives the Clock Lane LP-00 + * Line state immediately before the HS-0 Line state starting the + * HS transmission + * T CLK-ZERO: Time that the transmitter drives the HS-0 state prior to + * transmitting the Clock. + * T CLK_POST: Time that the transmitter continues to send HS clock + * after the last associated Data Lane has transitioned to LP Mode + * Interval is defined as the period from the end of T HS-TRAIL to + * the beginning of T CLK-TRAIL + * T CLK-TRAIL: Time that the transmitter drives the HS-0 state after + * the last payload clock bit of a HS transmission burst + */ + + reg = DSIM_PHYTIMING1_CLK_PREPARE(clk_prepare) | + DSIM_PHYTIMING1_CLK_ZERO(clk_zero) | + DSIM_PHYTIMING1_CLK_POST(clk_post) | + DSIM_PHYTIMING1_CLK_TRAIL(clk_trail); + + samsung_dsim_write(dsim, DSIM_PHYTIMING1_REG, reg); + + /* + * T HS-PREPARE: Time that the transmitter drives the Data Lane LP-00 + * Line state immediately before the HS-0 Line state starting the + * HS transmission + * T HS-ZERO: Time that the transmitter drives the HS-0 state prior to + * transmitting the Sync sequence. + * T HS-TRAIL: Time that the transmitter drives the flipped differential + * state after last payload data bit of a HS transmission burst + */ + + reg = DSIM_PHYTIMING2_HS_PREPARE(hs_prepare) | + DSIM_PHYTIMING2_HS_ZERO(hs_zero) | + DSIM_PHYTIMING2_HS_TRAIL(hs_trail); + + samsung_dsim_write(dsim, DSIM_PHYTIMING2_REG, reg); + + reg = DSIM_BTA_TIMEOUT(0xff) | DSIM_LPDR_TIMEOUT(0xffff); + + samsung_dsim_write(dsim, DSIM_TIMEOUT_REG, reg); +} + +static void samsung_dsim_write_pl_to_sfr_fifo(struct samsung_dsi *dsim, + const void *payload, + size_t length) +{ + u32 pl_data; + + if (!length) + return; + + while (length >= 4) { + pl_data = get_unaligned_le32(payload); + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + payload += 4; + length -= 4; + } + + pl_data = 0; + switch (length) { + case 3: + pl_data |= ((u8 *)payload)[2] << 16; + case 2: + pl_data |= ((u8 *)payload)[1] << 8; + case 1: + pl_data |= ((u8 *)payload)[0]; + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + break; + } +} + +static void samsung_dsim_write_ph_to_sfr_fifo(struct samsung_dsi *dsim, + void *header, bool use_lpm) +{ + u32 pkthdr; + + pkthdr = PKTHDR_SET_DATA1(((u8 *)header)[2]) | /* WC MSB */ + PKTHDR_SET_DATA0(((u8 *)header)[1]) | /* WC LSB */ + PKTHDR_SET_DI(((u8 *)header)[0]); /* Data ID */ + + samsung_dsim_write(dsim, DSIM_PKTHDR_REG, pkthdr); +} + +static int samsung_dsim_read_pl_from_sfr_fifo(struct samsung_dsi *dsim, + void *payload, size_t length) +{ + u8 data_type; + u16 word_count = 0; + u32 fifoctrl, ph, pl; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + if (WARN_ON(fifoctrl & FIFOCTRL_EMPTYRX)) + return -EINVAL; + + ph = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + data_type = PKTHDR_GET_DT(ph); + switch (data_type) { + case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: + dev_err(dsim->device->dev, "peripheral report error: (0-7)%x, (8-15)%x\n", + PKTHDR_GET_DATA0(ph), PKTHDR_GET_DATA1(ph)); + return -EPROTO; + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE: + if (!WARN_ON(length < 2)) { + ((u8 *)payload)[1] = PKTHDR_GET_DATA1(ph); + word_count++; + } + fallthrough; + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: + ((u8 *)payload)[0] = PKTHDR_GET_DATA0(ph); + word_count++; + length = word_count; + break; + case MIPI_DSI_RX_DCS_LONG_READ_RESPONSE: + case MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE: + word_count = PKTHDR_GET_WC(ph); + if (word_count > length) { + dev_err(dsim->device->dev, "invalid receive buffer length\n"); + return -EINVAL; + } + + length = word_count; + + while (word_count >= 4) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + ((u8 *)payload)[0] = pl & 0xff; + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + ((u8 *)payload)[3] = (pl >> 24) & 0xff; + payload += 4; + word_count -= 4; + } + + if (word_count > 0) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + + switch (word_count) { + case 3: + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + case 2: + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + case 1: + ((u8 *)payload)[0] = pl & 0xff; + break; + } + } + + break; + default: + return -EINVAL; + } + + return length; +} + +static void samsung_dsi_init_fifo_pointers(struct samsung_dsi *dsim) +{ + u32 fifoctrl, fifo_ptrs; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + fifo_ptrs = FIFOCTRL_NINITRX | + FIFOCTRL_NINITSFR | + FIFOCTRL_NINITI80 | + FIFOCTRL_NINITSUB | + FIFOCTRL_NINITMAIN; + + fifoctrl &= ~fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); + + fifoctrl |= fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); +} + +static void samsung_dsi_config_clkctrl(struct samsung_dsi *dsim) +{ + u32 clkctrl = 0, data_lanes_en; + u64 byte_clk, esc_prescaler; + + clkctrl |= DSIM_TX_REQUEST_HSCLK; + + /* using 1.5Gbps PHY */ + clkctrl |= CLKCTRL_DPHY_SEL_1P5G; + clkctrl |= DSIM_ESC_CLKEN; + clkctrl &= ~CLKCTRL_PLLBYPASS; + clkctrl |= CLKCTRL_BYTECLKSRC_DPHY_PLL; + clkctrl |= DSIM_BYTE_CLKEN; + + data_lanes_en = (0x1 << dsim->lanes) - 1; + clkctrl |= CLKCTRL_SET_LANEESCCLKEN(0x1 | data_lanes_en << 1); + + /* calculate esc prescaler from byte clock: + * EscClk = ByteClk / EscPrescaler; + */ + byte_clk = dsim->bit_clk >> 3; + esc_prescaler = DIV_ROUND_UP_ULL(byte_clk, MAX_ESC_CLK_FREQ); + + clkctrl |= CLKCTRL_SET_ESCPRESCALER(esc_prescaler); + + debug("DSIM clkctrl 0x%x\n", clkctrl); + + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, clkctrl); +} + +static void samsung_dsi_set_standby(struct samsung_dsi *dsim, bool standby) +{ + u32 mdresol = 0; + + mdresol = samsung_dsim_read(dsim, DSIM_MDRESOL_REG); + + if (standby) + mdresol |= DSIM_MAIN_STAND_BY; + else + mdresol &= ~DSIM_MAIN_STAND_BY; + + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); +} + +static void samsung_dsi_disable_clock(struct samsung_dsi *dsim) +{ + u32 reg; + + reg = samsung_dsim_read(dsim, DSIM_CLKCTRL_REG); + reg &= ~(DSIM_LANE_ESC_CLK_EN_CLK | DSIM_LANE_ESC_CLK_EN_DATA_MASK | + DSIM_ESC_CLKEN | DSIM_BYTE_CLKEN); + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, reg); + + reg = samsung_dsim_read(dsim, DSIM_PLLCTRL_REG); + reg &= ~DSIM_PLL_EN; + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, reg); +} + +static inline struct samsung_dsi *host_to_dsi(struct mipi_dsi_host *host) +{ + return container_of(host, struct samsung_dsi, dsi_host); +} + +static int samsung_dsi_bridge_clk_set(struct samsung_dsi *dsim_host) +{ + int bpp; + unsigned long pix_clk, bit_clk; + unsigned long fin, fout; + u8 p, s; + u16 m; + + bpp = mipi_dsi_pixel_format_to_bpp(dsim_host->format); + if (bpp < 0) + return -EINVAL; + + pix_clk = dsim_host->timings.pixelclock.typ; + bit_clk = DIV_ROUND_UP_ULL(pix_clk * bpp, dsim_host->lanes); + + dsim_host->pix_clk = DIV_ROUND_UP_ULL(pix_clk, 1000); + dsim_host->bit_clk = DIV_ROUND_UP_ULL(bit_clk, 1000); + + fout = dsim_host->bit_clk; + fin = clk_get_rate(&dsim_host->sclk_mipi); + if (fin == 0) { + log_err("Error: DSI PHY reference clock is disabled\n"); + return -EINVAL; + } + + fout = samsung_dsim_pll_find_pms(dsim_host, fin, bit_clk, &p, &m, &s); + if (!fout) { + log_err("failed to find PLL PMS for requested frequency\n"); + return -EINVAL; + } + dsim_host->pms = PLLCTRL_SET_P(p) | PLLCTRL_SET_M(m) | + PLLCTRL_SET_S(s); + dsim_host->hs_clock = fout; + + debug("%s: bitclk %llu pixclk %llu pms 0x%x\n", __func__, + dsim_host->bit_clk, dsim_host->pix_clk, dsim_host->pms); + + return 0; +} + +static int samsung_dsi_bridge_prepare(struct samsung_dsi *dsim_host) +{ + int ret; + + /* At this moment, the dsim bridge's preceding encoder has + * already been enabled. So the dsim can be configed here + */ + + /* config main display mode */ + samsung_dsi_set_main_mode(dsim_host); + + /* config dsim dpi */ + samsung_dsi_config_dpi(dsim_host); + + /* config dsim pll */ + ret = samsung_dsi_config_pll(dsim_host); + if (ret) { + log_err("dsim pll config failed: %d\n", ret); + return ret; + } + + /* config dphy timings */ + samsung_dsi_config_dphy(dsim_host); + + samsung_dsi_init_fifo_pointers(dsim_host); + + /* config esc clock, byte clock and etc */ + samsung_dsi_config_clkctrl(dsim_host); + + return 0; +} + +static int samsung_dsi_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *device) +{ + struct samsung_dsi *dsi = host_to_dsi(host); + + if (!device->lanes || device->lanes > dsi->max_data_lanes) { + log_err("invalid data lanes number\n"); + return -EINVAL; + } + + if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO) || + !((device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) || + (device->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))) { + log_err("unsupported dsi mode\n"); + return -EINVAL; + } + + if (device->format != MIPI_DSI_FMT_RGB888 && + device->format != MIPI_DSI_FMT_RGB565 && + device->format != MIPI_DSI_FMT_RGB666 && + device->format != MIPI_DSI_FMT_RGB666_PACKED) { + log_err("unsupported pixel format: %#x\n", device->format); + return -EINVAL; + } + + dsi->lanes = device->lanes; + dsi->channel = device->channel; + dsi->format = device->format; + dsi->mode_flags = device->mode_flags; + + debug("lanes %u, channel %u, format 0x%x, mode_flags 0x%lx\n", dsi->lanes, + dsi->channel, dsi->format, dsi->mode_flags); + + samsung_dsi_bridge_clk_set(dsi); + samsung_dsi_bridge_prepare(dsi); + + return 0; +} + +static ssize_t samsung_dsi_host_transfer(struct mipi_dsi_host *host, + const struct mipi_dsi_msg *msg) +{ + struct samsung_dsi *dsim = host_to_dsi(host); + int ret, nb_bytes; + bool use_lpm; + struct mipi_dsi_packet packet; + + ret = mipi_dsi_create_packet(&packet, msg); + if (ret) { + dev_err(dsim->device->dev, "failed to create dsi packet: %d\n", ret); + return ret; + } + + /* config LPM for CMD TX */ + use_lpm = msg->flags & MIPI_DSI_MSG_USE_LPM ? true : false; + samsung_dsi_config_cmd_lpm(dsim, use_lpm); + + if (packet.payload_length) { /* Long Packet case */ + /* write packet payload */ + samsung_dsim_write_pl_to_sfr_fifo(dsim, packet.payload, + packet.payload_length); + + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, packet.header, use_lpm); + + ret = samsung_dsi_wait_for_pkt_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait tx done timeout!\n"); + return -EBUSY; + } + } else { + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, packet.header, use_lpm); + + ret = samsung_dsi_wait_for_hdr_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait pkthdr tx done time out\n"); + return -EBUSY; + } + } + + /* read packet payload */ + if (unlikely(msg->rx_buf)) { + ret = samsung_dsi_wait_for_rx_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait rx done time out\n"); + return -EBUSY; + } + + ret = samsung_dsim_read_pl_from_sfr_fifo(dsim, msg->rx_buf, + msg->rx_len); + if (ret < 0) + return ret; + nb_bytes = msg->rx_len; + } else { + nb_bytes = packet.size; + } + + return nb_bytes; +} + +static const struct mipi_dsi_host_ops samsung_dsi_host_ops = { + .attach = samsung_dsi_host_attach, + .transfer = samsung_dsi_host_transfer, +}; + +static int samsung_dsi_init(struct udevice *dev, + struct mipi_dsi_device *device, + struct display_timing *timings, + unsigned int max_data_lanes, + const struct mipi_dsi_phy_ops *phy_ops) +{ + struct samsung_dsi *dsi = dev_get_priv(dev); + struct udevice *dsi_bridge = device->dev; + enum samsung_dsim_type hw_type = (enum samsung_dsim_type)dev_get_driver_data(dsi_bridge); + + dsi->max_data_lanes = max_data_lanes; + dsi->device = device; + dsi->dsi_host.ops = &samsung_dsi_host_ops; + dsi->driver_data = samsung_dsim_types[hw_type]; + device->host = &dsi->dsi_host; + + dsi->reg_base = (void *)dev_read_addr(device->dev); + if ((fdt_addr_t)dsi->reg_base == FDT_ADDR_T_NONE) { + dev_err(device->dev, "dsi dt register address error\n"); + return -EINVAL; + } + + dsi->timings = *timings; + + return 0; +} + +static int samsung_dsi_enable(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* enable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, true); + + return 0; +} + +static int samsung_dsi_disable(struct udevice *dev) +{ + u32 intsrc; + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* disable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, false); + + /* disable esc clock & byte clock & dsim pll */ + samsung_dsi_disable_clock(dsim_host); + + /* Clear all intsrc */ + intsrc = samsung_dsim_read(dsim_host, DSIM_INTSRC_REG); + samsung_dsim_write(dsim_host, DSIM_INTSRC_REG, intsrc); + + return 0; +} + +struct dsi_host_ops samsung_dsi_ops = { + .init = samsung_dsi_init, + .enable = samsung_dsi_enable, + .disable = samsung_dsi_disable, +}; + +static int samsung_dsi_probe(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + int ret; + + ret = clk_get_by_name(dev, "sclk_mipi", &dsim_host->sclk_mipi); + if (ret) + debug("Failed to get sclk_mipi clock\n"); + + return ret; +} + +static const struct udevice_id samsung_dsi_ids[] = { + { .compatible = "samsung,sec-mipi-dsi" }, + { } +}; + +U_BOOT_DRIVER(samsung_dsi) = { + .name = "samsung_dsi", + .id = UCLASS_DSI_HOST, + .of_match = samsung_dsi_ids, + .probe = samsung_dsi_probe, + .remove = samsung_dsi_disable, + .ops = &samsung_dsi_ops, + .priv_auto = sizeof(struct samsung_dsi), +}; diff --git a/drivers/video/bridge/samsung-dsim.c b/drivers/video/bridge/samsung-dsim.c new file mode 100644 index 000000000000..986f1d830844 --- /dev/null +++ b/drivers/video/bridge/samsung-dsim.c @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2019 NXP + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "samsung-dsim.h" + +struct samsung_dsim_priv { + struct mipi_dsi_device device; + void __iomem *base; + struct udevice *panel; + struct udevice *dsi_host; +}; + +static int samsung_dsim_attach(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + struct mipi_dsi_device *device = &priv->device; + struct mipi_dsi_panel_plat *mplat; + struct display_timing timings; + int ret; + + priv->panel = video_link_get_next_device(dev); + if (!priv->panel || device_get_uclass_id(priv->panel) != UCLASS_PANEL) { + dev_err(dev, "get panel device error\n"); + return -ENODEV; + } + + mplat = dev_get_plat(priv->panel); + mplat->device = &priv->device; + + ret = video_link_get_display_timings(&timings); + if (ret) { + dev_err(dev, "decode display timing error %d\n", ret); + return ret; + } + + ret = uclass_get_device(UCLASS_DSI_HOST, 0, &priv->dsi_host); + if (ret) { + dev_err(dev, "No video dsi host detected %d\n", ret); + return ret; + } + + /* allow to use the compatible */ + device->dev = dev; + ret = dsi_host_init(priv->dsi_host, device, &timings, 4, + NULL); + if (ret) { + dev_err(dev, "failed to initialize mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_set_backlight(struct udevice *dev, int percent) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + int ret; + + ret = panel_enable_backlight(priv->panel); + if (ret) { + dev_err(dev, "panel %s enable backlight error %d\n", + priv->panel->name, ret); + return ret; + } + + ret = dsi_host_enable(priv->dsi_host); + if (ret) { + dev_err(dev, "failed to enable mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_probe(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + struct mipi_dsi_device *device = &priv->device; + + device->dev = dev; + + return 0; +} + +static int samsung_dsim_remove(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + int ret; + + if (priv->panel) + device_remove(priv->panel, DM_REMOVE_NORMAL); + + ret = dsi_host_disable(priv->dsi_host); + if (ret) { + dev_err(dev, "failed to enable mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_check_timing(struct udevice *dev, struct display_timing *timings) +{ + timings->flags &= ~DISPLAY_FLAGS_DE_HIGH; + return 0; +} + +struct video_bridge_ops samsung_dsim_ops = { + .attach = samsung_dsim_attach, + .set_backlight = samsung_dsim_set_backlight, + .check_timing = samsung_dsim_check_timing, +}; + +static const struct udevice_id samsung_dsim_ids[] = { + { .compatible = "fsl,imx8mm-mipi-dsim", .data = DSIM_TYPE_IMX8MM }, + { .compatible = "fsl,imx8mn-mipi-dsim", .data = DSIM_TYPE_IMX8MM }, + { } +}; + +U_BOOT_DRIVER(samsung_dsim) = { + .name = "samsung_dsim", + .id = UCLASS_VIDEO_BRIDGE, + .of_match = samsung_dsim_ids, + .bind = dm_scan_fdt_dev, + .remove = samsung_dsim_remove, + .probe = samsung_dsim_probe, + .ops = &samsung_dsim_ops, + .priv_auto = sizeof(struct samsung_dsim_priv), +}; diff --git a/drivers/video/bridge/samsung-dsim.h b/drivers/video/bridge/samsung-dsim.h new file mode 100644 index 000000000000..9bb2a379589b --- /dev/null +++ b/drivers/video/bridge/samsung-dsim.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2024 Amarula Solutions + */ + +#ifndef SAMSUNG_DSIM_H +#define SAMSUNG_DSIM_H + +enum samsung_dsim_type { + DSIM_TYPE_EXYNOS3250, + DSIM_TYPE_EXYNOS4210, + DSIM_TYPE_EXYNOS5410, + DSIM_TYPE_EXYNOS5422, + DSIM_TYPE_EXYNOS5433, + DSIM_TYPE_IMX8MM, + DSIM_TYPE_IMX8MP, + DSIM_TYPE_COUNT, +}; + +#endif From patchwork Fri Sep 13 09:56:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3487 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 69D5B41280 for ; Fri, 13 Sep 2024 11:57:25 +0200 (CEST) Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a8a8d9a2a52sf154251666b.1 for ; Fri, 13 Sep 2024 02:57:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221445; cv=pass; d=google.com; s=arc-20240605; b=juHm62WptgJ8/Xk1tCOInvFcQdrx854r7KKMdP/PNmRVB1Wh2tt/00eGgOjz2HnLpW vU+PnxXEgFdfULidDVrQIrMyZV0Txp338cpi6n3CoYlE/A2qwfVxkJCOJ+YKtvJdHBWC aunDJp57ZHWCd8OmJi+lnjQcIeqjmbMBZ8x/cH5aPR739p1HyAGqWuqHUzLe6wgVDUfn yuifXci4F0N0kABTjASEl6PNfhx/GhTMzf3tzn/ddLL46MvTVQkFLlyoTEMCYgphCDBz gi84e8P6ydz5y1EkA+KhyzE/0AXJjCaMhTZAOccyGa9TuU6qxmjIul7rvfSKDfAOYTwU J3cQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=079s86zXqJHeXZMbpG4rBezEn3QfKKe/y+SXvQWQ7PA=; fh=eG8YzjNNyXUQFEXY1WPvhCh7Ru9DMc0Tw/OtemUV0t4=; b=PltGVT8KtBtb5M3yTUh5dhsh1q9zqPqmFAw5hcfnrNmoqIV5d1ZVR/S6sNOz7b0FXb m18CLklcpKG+1xwyfoiQfVupHYpxPioL0Sfr84sN2TdzmhpZAMf5WfG9ABt1Fpm8BY1b VDbWuWPp7N3kw0eZvHMP+SxOiAR7oxLa3Beb1g8AHA5wvT1UvBwVH7ocVdjN+4eAuxiD 6xYjLaJM9qXlx6RDtgMrAGySgn0bPYTe3Ki2UnHdu3JkPeq4P2Y8z38unOh4IOtVmaz9 f8cgugeA3FvDsAPVSNVbFkEh9/wNMfQqJHx6mD6MTjlgq4dGMi7d+UbfDzQs7RywcSiV vOqw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GVuTxsRy; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221445; x=1726826245; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=079s86zXqJHeXZMbpG4rBezEn3QfKKe/y+SXvQWQ7PA=; b=cu/JzYUMainmZmAq+Put9XaqWN+myFoRyD0V4vyuh9lh+LVmvHoJ+RDmIOun2XEXMy Yf2r1k2YS2g5ylkMSLQ7VTZOry8bygdvfCH8cPH7l4PvWelzrSHKQgfEwdyY4lb0OG2B EhOP9qFlqXca8ViKAHa1QB1J+q73T8ELG/DLc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221445; x=1726826245; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=079s86zXqJHeXZMbpG4rBezEn3QfKKe/y+SXvQWQ7PA=; b=M7unuDJO35k+/PI2/j8+zZrdes9UBhhblCulKqh5oafIwd4eceFlMFi/qTBXPOIpHd x0lmBViIyGLMwTpxldOrPA/FLCYr3c8ZqIXSJ0NWHqx6QyZUZpDT3BpKI7q7CiU7dE1q AsHUeUHCGx4m9j6N3+nUJqNdRDkihPf5JGF4PtO+ZW7wDBa7icoTHz7rtOPOx5fVea8U xFKAX5vIzKP9Xlu5eTqu+yZGG6AXFn0560IqPW2fSOxKUb7/NyjcrjcAQtaUW/tgTyNE TFZQRVKTvCx1OnYb69v7r/MTA+VxcVXst4cikpgxx2Brpch+8buFBTruGO8zjS5kGkYZ Gomw== X-Forwarded-Encrypted: i=2; AJvYcCUTtyfA7+qUEVhmHy8e7ebE9tdVcD6QoCBMeN2VLX0M7zoxiRMVqsLhP5Jmj7G2lY2hlIf5nM5nunMxj72N@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxkUmSH+uYfMoYgh6Cr2yD8uQRpb6cf8Mdfp5BTin8OW5aUYUoP naGCDDlXQ5e1raAd+oIBjqC2kWSJnn8t6wGntTP8/2rF6RysYrWI+0hNrGf85rXqkw== X-Google-Smtp-Source: AGHT+IFmRlr+6jPMFrZ45yJXB2bRarP5dRpGsW8Ef9ArF6Tvw3FPMIKizLzXqfqxOYHSl4S3wcVijA== X-Received: by 2002:a05:6402:27c6:b0:5c3:c530:e98d with SMTP id 4fb4d7f45d1cf-5c413e5461emr5866685a12.30.1726221444954; Fri, 13 Sep 2024 02:57:24 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5191:b0:5bf:bf:efe4 with SMTP id 4fb4d7f45d1cf-5c41408e99dls878306a12.2.-pod-prod-08-eu; Fri, 13 Sep 2024 02:57:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWlN670JU2n9WCpHyUMLWAdV13ssh5efOcP7U/4CzlIQu96k9cwnNKTn+/V6pHqXs2V5O7T9Df6lTo3DgPP@amarulasolutions.com X-Received: by 2002:a17:907:6d28:b0:a8d:1655:a423 with SMTP id a640c23a62f3a-a9029678c66mr643200666b.56.1726221443231; Fri, 13 Sep 2024 02:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221443; cv=none; d=google.com; s=arc-20160816; b=oiUyL4GfSRP/0rNsIzbk0fYUaq1GCz4/wmo39TPBGwtHj9Xj9x45MStAy6rvxENz5b FXGijDcYshasvbvwWHt9EH4holXZ4lIzkQs9M5X/HT6nCwVGryd0gy7nh/cZ29xeowZD o4dw3ymxpp/1ljN2fSn2fplMD8hDSwc6xodwWKZh41oMwZJASOo3K9MdcDydAuumGT8Y XkMIlLJ39Nq210csomgHEdz930iRBD4uVjVSm4omAD2dkSvDbaW6rkCQadmHRQk+G2hX IfrzxjYMYtBKlXTyrmUiXvIqk71qAEUt9lY+ozN1ZVasIvZnLLt69FxtvaTtOjdNP/O8 GY+w== 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=2GgTThR+n11+skGn4WqROLHbBMugAuPOtEXUsD/jtyU=; fh=TQxcIonlndKeDLLf2aJ022SE1lGjYyaVu9kgu/GOGgI=; b=FyZL6/qkRsuKnFuqCI2GinelcfY3sXIvij6Sz/SnhmrYELEFVF6MUmHVh/blGAoEb/ yOqrWAkTiFM9hRLYzIZLmS2bkKC8IwpO5gUCnOTLs2OqN768kOHQL/jB+LgoA/4ukTnt q8t3Af9R/HagPI4oCprc9f7EGNoJdDrQUYZ3JzF886rATH3s7RLaHdZzhMrxo918NEQA Cxy9ra1OEMSPMPQ8FO5a3GirO/hQfNGQ/YIlhYXdVQWdiwCqn2Xs9d4dMhRJR8VgeqTg bk9IcYg6bIZMRO8QmFNK0OXz7IwKvvye8RAkF/EQMnhVxSVRrhfvF91MCGKzzIr/mGvv Bflw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GVuTxsRy; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d258354b3sor548373466b.4.2024.09.13.02.57.23 for (Google Transport Security); Fri, 13 Sep 2024 02:57:23 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUhgOercUxZAPfayDHf4YrPrlNNk3yHvBy0Tk6+aQRueq9FrOqXZ9cZ40C1Ocly2h0CH6U9JoR+30c/LbKh@amarulasolutions.com X-Received: by 2002:a17:907:2da3:b0:a7d:9f92:9107 with SMTP id a640c23a62f3a-a9029690793mr628556066b.58.1726221442620; Fri, 13 Sep 2024 02:57:22 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:22 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Anatolij Gustschin , Anton Bambura , =?utf-8?q?Jonas_Schw=C3=B6bel?= , Simon Glass , Svyatoslav Ryhel , Tom Rini , Ye Li Subject: [PATCH 19/26] video: Add Synaptics R63353 panel driver Date: Fri, 13 Sep 2024 11:56:01 +0200 Message-ID: <20240913095622.72377-20-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GVuTxsRy; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi The LS068B3SX02 panel is based on the Synaptics R63353 Controller. Add a driver for it. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/Kconfig | 8 ++ drivers/video/Makefile | 1 + drivers/video/synaptics-r63353.c | 228 +++++++++++++++++++++++++++++++ 3 files changed, 237 insertions(+) create mode 100644 drivers/video/synaptics-r63353.c diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index cafdc15f9fe2..520577976571 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -627,6 +627,14 @@ config VIDEO_LCD_SSD2828_RESET The reset pin of SSD2828 chip. This takes a string in the format understood by 'sunxi_name_to_gpio' function, e.g. PH1 for pin 1 of port H. +config VIDEO_LCD_SYNAPTICS_R63353 + tristate "Synaptics R63353-based DSI LCD panels support" + select VIDEO_MIPI_DSI + default n + help + Say Y if you want to enable support for panels based on the + Synaptics R63353 controller. + config VIDEO_LCD_TDO_TL070WSH30 bool "TDO TL070WSH30 DSI LCD panel support" select VIDEO_MIPI_DSI diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 9fd3645994f1..4d836efcfa41 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -66,6 +66,7 @@ obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o obj-$(CONFIG_VIDEO_LCD_RENESAS_R69328) += renesas-r69328.o obj-$(CONFIG_VIDEO_LCD_SAMSUNG_LTL106HL02) += samsung-ltl106hl02.o obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o +obj-$(CONFIG_VIDEO_LCD_SYNAPTICS_R63353) += synaptics-r63353.o obj-$(CONFIG_VIDEO_LCD_TDO_TL070WSH30) += tdo-tl070wsh30.o obj-$(CONFIG_VIDEO_MCDE_SIMPLE) += mcde_simple.o obj-${CONFIG_VIDEO_MESON} += meson/ diff --git a/drivers/video/synaptics-r63353.c b/drivers/video/synaptics-r63353.c new file mode 100644 index 000000000000..86d2aea346b2 --- /dev/null +++ b/drivers/video/synaptics-r63353.c @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Synaptics R63353 Controller driver + * + * Copyright (C) 2020 BSH Hausgerate GmbH + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define R63353_INSTR(...) { \ + .len = ARRAY_SIZE(((u8[]) {__VA_ARGS__})), \ + .data = (const u8 *)&(const u8 []){__VA_ARGS__} \ + } + +struct r63353_instr { + size_t len; + const u8 * const data; +}; + +static const struct r63353_instr init_sequence[] = { + R63353_INSTR(0x51, 0xff), + R63353_INSTR(0x53, 0x0c), + R63353_INSTR(0x55, 0x00), + R63353_INSTR(0x84, 0x00), + R63353_INSTR(0x29), + R63353_INSTR(0x11), +}; + +struct r63353_panel_priv { + struct udevice *dvdd; + struct udevice *avdd; + struct udevice *backlight; + struct gpio_desc reset_gpio; +}; + +static const struct display_timing default_timing = { + .pixelclock.typ = 70000000, + .hactive.typ = 640, + .hfront_porch.typ = 35, + .hsync_len.typ = 2, + .hback_porch.typ = 150, + .vactive.typ = 1280, + .vfront_porch.typ = 2, + .vsync_len.typ = 4, + .vback_porch.typ = 1, + .flags = DISPLAY_FLAGS_DE_LOW, +}; + +static int r63353_panel_enable_backlight(struct udevice *dev) +{ + struct r63353_panel_priv *priv = dev_get_priv(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); + struct mipi_dsi_device *dsi = plat->device; + int i, ret; + + ret = mipi_dsi_attach(dsi); + if (ret < 0) + return ret; + + ret = mipi_dsi_dcs_soft_reset(dsi); + if (ret < 0) { + dev_err(dev, "Failed to do Software Reset (%d)\n", ret); + goto fail; + } + + mdelay(20); + + ret = mipi_dsi_dcs_enter_sleep_mode(dsi); + if (ret < 0) { + dev_err(dev, "Failed to enter sleep mode (%d)\n", ret); + goto fail; + } + + for (i = 0; i < ARRAY_SIZE(init_sequence); i++) { + const struct r63353_instr *instr = &init_sequence[i]; + + ret = mipi_dsi_dcs_write_buffer(dsi, instr->data, instr->len); + if (ret < 0) + goto fail; + } + + mdelay(120); + + ret = mipi_dsi_dcs_exit_sleep_mode(dsi); + if (ret < 0) { + dev_err(dev, "Failed to exit sleep mode (%d)\n", ret); + goto fail; + } + + mdelay(10); + + /* This call starts sending the data on the display (LINUX LOGO) */ + ret = mipi_dsi_dcs_set_display_on(dsi); + if (ret < 0) { + dev_err(dev, "Failed to set display ON (%d)\n", ret); + goto fail; + } + + ret = backlight_enable(priv->backlight); + if (ret) + return ret; + + return 0; + +fail: + dm_gpio_set_value(&priv->reset_gpio, 0); + + return ret; +} + +static int r63353_panel_get_display_timing(struct udevice *dev, + struct display_timing *timing) +{ + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); + struct mipi_dsi_device *device = plat->device; + + memcpy(timing, &default_timing, sizeof(*timing)); + + /* fill characteristics of DSI data link */ + if (device) { + device->lanes = plat->lanes; + device->format = plat->format; + device->mode_flags = plat->mode_flags; + } + + return 0; +} + +static int r63353_panel_of_to_plat(struct udevice *dev) +{ + struct r63353_panel_priv *priv = dev_get_priv(dev); + int ret; + + ret = device_get_supply_regulator(dev, "dvdd-supply", &priv->dvdd); + if (ret) { + dev_err(dev, "failed to get power dvdd supply\n"); + return ret; + } + + ret = device_get_supply_regulator(dev, "avdd-supply", &priv->avdd); + if (ret) { + dev_err(dev, "failed to get power avdd supply\n"); + return ret; + } + + ret = gpio_request_by_name(dev, "reset-gpios", 0, &priv->reset_gpio, + GPIOD_IS_OUT); + if (ret) { + dev_err(dev, "failed to get RESET GPIO\n"); + return ret; + } + + return 0; +} + +static int r63353_panel_probe(struct udevice *dev) +{ + struct r63353_panel_priv *priv = dev_get_priv(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); + int ret; + + ret = regulator_set_enable(priv->avdd, true); + if (ret) { + dev_err(dev, "Failed to enable avdd regulator (%d)\n", ret); + return ret; + } + + mdelay(25); + + ret = regulator_set_enable(priv->dvdd, true); + if (ret) { + dev_err(dev, "Failed to enable dvdd regulator (%d)\n", ret); + regulator_set_enable(priv->avdd, false); + return ret; + } + + dm_gpio_set_value(&priv->reset_gpio, 0); + mdelay(10); + dm_gpio_set_value(&priv->reset_gpio, 1); + mdelay(120); + + /* fill characteristics of DSI data link */ + plat->lanes = 2; + plat->format = MIPI_DSI_FMT_RGB888; + plat->mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | + MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM | + MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_EOT_PACKET; + + ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev, + "backlight", &priv->backlight); + if (ret) { + dev_err(dev, "%s: Warning: cannot get backlight: ret=%d\n", + __func__, ret); + if (ret != -ENOENT) + return ret; + } + + return 0; +} + +static const struct panel_ops r63353_panel_ops = { + .enable_backlight = r63353_panel_enable_backlight, + .get_display_timing = r63353_panel_get_display_timing, +}; + +static const struct udevice_id r63353_panel_ids[] = { + { .compatible = "syna,r63353" }, + { .compatible = "sharp,ls068b3sx02" }, + { } /* sentinel */ +}; + +U_BOOT_DRIVER(r63353_panel) = { + .name = "r63353_panel", + .id = UCLASS_PANEL, + .of_match = r63353_panel_ids, + .ops = &r63353_panel_ops, + .of_to_plat = r63353_panel_of_to_plat, + .probe = r63353_panel_probe, + .plat_auto = sizeof(struct mipi_dsi_panel_plat), + .priv_auto = sizeof(struct r63353_panel_priv), +}; From patchwork Fri Sep 13 09:56:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3488 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 69D2F412C3 for ; Fri, 13 Sep 2024 11:57:26 +0200 (CEST) Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-374c960ee7asf557481f8f.3 for ; Fri, 13 Sep 2024 02:57:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221446; cv=pass; d=google.com; s=arc-20240605; b=grjLdMks+I5XDOxZ6dNWV7YqFsyfMDC/fa0h5jMPR7H0lKb91DhZTR30SN/DOb0MM1 uZqNNq46nHxHo2RfjnRMC3sYIEM6Y5hYd+RzfzBQpsAwoQDw3oj4v7zjSQfMnVsMu5QP a18MXaZqhCFh+K/XPcjL0rSJDNSyqrnD591bqJ9Wdhht0Qr23zlh7cXTOE5QtrWlez6Z gYZKVFXqg9Uo9wyjtuQGPijgftewacLBTNIHwdYLE6RGlbkiXZKcjMH60bD2gWDCiRa6 OwYfuWQEYePB5m1gajceIp0t1WaL54F0dAJ/25zMFcnVlniBxTCr3tKwLDOTuD0taEKB IPDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=CzuajjWZwxQM+FP5r6OX5biAAVfQZbr/6cnP0dP1L10=; fh=AbelcxTkKwE9GeyD9yTMyl/UnmbmLvgSVkwjBkAwDRU=; b=hgROdG/BbM8erm+VbWLgE+tLXA/yxtH/K+oqvbDaXEHyjsWhdED/nAino2o2W0sSP2 AY5pXR695aV5VyLawpS/KzZkSqJQUJomhhO5i8Y2N0t30DsJ3ZmT2PUJ/P79YvPJ5QiW Fapdp5TuoprqTkEorXF6NM5ku+mTyHqmCdTYCZM1ePxoma9ETgh0whXpgfk/CmyYyF0V O1TENHzSpGQhoOp+9cpVtk4u8E3PmB2rFEednDcTw87iWybm5AQsOcv8d+GSQ65x4SA0 8p2kvSRn8pNSoHc4ZXiLov3+NMnahOwCHd81rlQwEaJ6zCu/9bF6nrlMUKvzKv8/KmZw Dh2w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ODGha2Op; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221446; x=1726826246; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=CzuajjWZwxQM+FP5r6OX5biAAVfQZbr/6cnP0dP1L10=; b=mFzPdSeOSkZjH1LSi6Bo9xsUm4I1VZljqsNxfImRE9I4k8WVEOhGNM17qqQevC2PPA VNNC5bNDrX0Q9AyllHoBMG8guNGt3zO6YCcXVxUQ5uQpfjvDQ9FNHKVvXThK2c8qs5/s RojdJp+DVo4otqHMCoIFaTCooqme8Vj/WVnu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221446; x=1726826246; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CzuajjWZwxQM+FP5r6OX5biAAVfQZbr/6cnP0dP1L10=; b=DgvwZl3bnJeP87TQKfo1t1iwR9YrNel+fP+qTmY3B2ax8Ehxj/YXeoRA7xtDJdpGUr g4lVBPKNo3cjkvDElmmm758rdM9wghBb8iT46RZMHebCsg2tVG1Ewbk5rvhGqIXlH1Ay gV4acwobJml9UqbKN1SkcFj6At779lkmcA0LVXedM2NNwOevbjsf9o0E8WJj3uAgU+BC 42soje73Ao+RhBTbGmULBtN+pSz5Bh+UYOXKMDF3BE3ESQSCML7uVRuGpTssEqp/k+Ii RYWGuKd8IbGcNSJf/1Cof4jA0x29WUPamYghsJMVp2NO/D1N7YlH/vqfIgwjbAIJUMt/ Lifg== X-Forwarded-Encrypted: i=2; AJvYcCXTvog73iIqq+epiBYVPn2+K98n+U+Hdg8LeLJyhfSy+hzurheQ1EMaeVgMiqBVOlkil5FE5c9xnyeamqUp@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yxrgb2m1e31OVkkzUX7/MC++Vb3hf9X7/LVQ4+zpR7f4v/ukm5W RktE2eg15x5RNk6NNYc/X1Zv8VYUVi4BOw8jjxpMSdSDGtvfyq3lO52rVgMGBTb0tLqF347f7A= = X-Google-Smtp-Source: AGHT+IFZ4ghcpUJkQgFRuhMEWK3Ka+ivbiQYdLMUoG65HZEN6/7etNJchzS5S5RwKe8Il+RoATt1Kg== X-Received: by 2002:adf:e546:0:b0:374:ba2b:4d1c with SMTP id ffacd0b85a97d-378d61f09cfmr1739717f8f.31.1726221445927; Fri, 13 Sep 2024 02:57:25 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b93:b0:42c:c82f:e2f with SMTP id 5b1f17b1804b1-42cdb51b0c6ls11623475e9.2.-pod-prod-05-eu; Fri, 13 Sep 2024 02:57:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUNmHpwgYSt0fTXxnDb4wg6VY9bKahIp/w9qKHBnInHWtLu/kD31iMjaRUSclQQmVoDRS6+7Sq/tMk2OuHP@amarulasolutions.com X-Received: by 2002:a05:600c:5102:b0:42c:b9a5:bd95 with SMTP id 5b1f17b1804b1-42d86cdb06cmr20116235e9.0.1726221444475; Fri, 13 Sep 2024 02:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221444; cv=none; d=google.com; s=arc-20160816; b=paomdMnTOLT4cUXJKwQFPNP8DdkHuBpr83S+ef9ARmSinltK5iwzEN7+LITKr2ATIS 94VGzIIsksEhP4ngWGe+NVaowMZjiFq0vjzCUKQJKIHJzaUkZPeFw/L2AaRFX9f5wasi jD0W71hy+M1oD7OZkj6VW3jlNjeN16GFDB4JiaCD384Q7nlJN0WCegLZ/hZjha+KNmjP Li/5UkkCwKWNtwKjzeLJevdplH4rbQR/pd0SUA/LcljeOg6eTfYV6CGm4/dEzNk8ArTW 8CpJ/lNuRLm40FFTyhoDTK/0Snk6eLrFy/tcPOzKzu2ZxmTsRoDbRnwMGOOVPAiZwN1J u9+w== 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=dBwSq5ZmOlgcVv1nfYy6SQy98WXEHyPhDxPXNiUuXhY=; fh=goV+NmmZ0Q/UEgF4PF4xVYl+k1y9yNmX/twIkOi4Htw=; b=figH/PWzaMEdK+70uIWj2Hen/tclQZt8KHhHpUt/Ju1TRYyfKYmQH6lps60ehsnbDr Y7vmbl4xkwYujiDHkJMMK1ksgrIPByPDZX5hdhwsouS6PxeeHq+5++j5SgDKHyu+BTEB 8Jo/3Xr/Vn9d3Kqg5UwcESPWey5mOfIGBi9Km1x6iCG7sd8vF2R4k4701C20t2pZV68b s5TnLo2jjtY8yNCE39u0/vaKrjtuhirbQ0azJbVsOBx5e5a0WlU1gG2q5CITpVcHGLkH /uwnPb+hMzx0WlUdx3sI6KENi335W/WwCnNguaVHpXtByxtJgtUFmYfPKcYpIr/Dnwlt kjWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ODGha2Op; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42cde491d17sor19364215e9.12.2024.09.13.02.57.24 for (Google Transport Security); Fri, 13 Sep 2024 02:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCX+8ny8WCPGVdyublYCnuhDLZUIccYayDkmfozsfnhVHq5z1u4hsYwMhEbcN9/rIwiACUyI601mIEmQEU5k@amarulasolutions.com X-Received: by 2002:a05:6000:1862:b0:374:cc4b:596e with SMTP id ffacd0b85a97d-378d6235e10mr1875542f8f.37.1726221443935; Fri, 13 Sep 2024 02:57:23 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:23 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Fabio Estevam , Marcel Ziswiler , "NXP i.MX U-Boot Team" , Patrick Barsanti , Sean Anderson , Simon Glass , Stefano Babic , Svyatoslav Ryhel , Tom Rini Subject: [PATCH 20/26] imx8mn_bsh_smm_s2/pro: Enable display on reference design Date: Fri, 13 Sep 2024 11:56:02 +0200 Message-ID: <20240913095622.72377-21-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ODGha2Op; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , From: Michael Trimarchi Co-developed-by: Dario Binacchi Signed-off-by: Dario Binacchi Signed-off-by: Michael Trimarchi --- .../dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi | 23 +++++++++++++++++++ configs/imx8mn_bsh_smm_s2_defconfig | 15 ++++++++++++ configs/imx8mn_bsh_smm_s2pro_defconfig | 15 ++++++++++++ 3 files changed, 53 insertions(+) diff --git a/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi b/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi index 19b0d8977539..8cae580e2851 100644 --- a/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi +++ b/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi @@ -6,6 +6,19 @@ #include "imx8mn-u-boot.dtsi" +/ { + aliases { + display0 = &lcdif; + }; + + samsung_dsi_host: dsi-host { + compatible = "samsung,sec-mipi-dsi"; + clocks = <&clk IMX8MN_CLK_DSI_PHY_REF>; + clock-names = "sclk_mipi"; + status = "okay"; + }; +}; + &{/soc@0/bus@30800000/i2c@30a20000/pmic@4b} { bootph-pre-ram; }; @@ -30,6 +43,16 @@ bootph-pre-ram; }; +&lcdif { + display = <&display0>; + + /* panel is r8g8b8 */ + display0: display@0 { + bits-per-pixel = <24>; + bits-per-color = <8>; + }; +}; + &pinctrl_i2c1 { bootph-pre-ram; }; diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig index b4351a392eff..2fa8bc22747e 100644 --- a/configs/imx8mn_bsh_smm_s2_defconfig +++ b/configs/imx8mn_bsh_smm_s2_defconfig @@ -56,6 +56,7 @@ CONFIG_SYS_PROMPT="> " CONFIG_CMD_FUSE=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_BMP=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand" CONFIG_MTDPARTS_DEFAULT="gpmi-nand:64m(nandboot),16m(nandfit),32m(nandkernel),1m(nanddtb),8m(nandtee),-(nandrootfs)" @@ -74,6 +75,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x40480000 CONFIG_FASTBOOT_BUF_SIZE=0x20000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_UUU_SUPPORT=y +CONFIG_DM_GPIO_LOOKUP_LABEL=y +CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y CONFIG_MXC_GPIO=y CONFIG_DM_I2C=y # CONFIG_MMC is not set @@ -94,12 +97,17 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX8M_BLK_CTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_PWM=y +CONFIG_PWM_IMX=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y @@ -112,5 +120,12 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_VIDEO=y +CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y +CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y +CONFIG_VIDEO_MXS=y +CONFIG_BMP_16BPP=y +CONFIG_BMP_24BPP=y +CONFIG_BMP_32BPP=y CONFIG_IMX_WATCHDOG=y # CONFIG_FAT_WRITE is not set diff --git a/configs/imx8mn_bsh_smm_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig index 0faa3376fd3d..b6b62b9d53f9 100644 --- a/configs/imx8mn_bsh_smm_s2pro_defconfig +++ b/configs/imx8mn_bsh_smm_s2pro_defconfig @@ -53,6 +53,7 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_MMC=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_BMP=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y @@ -68,6 +69,8 @@ CONFIG_FASTBOOT_BUF_SIZE=0x20000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_UUU_SUPPORT=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_DM_GPIO_LOOKUP_LABEL=y +CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y CONFIG_MXC_GPIO=y CONFIG_DM_I2C=y CONFIG_SUPPORT_EMMC_BOOT=y @@ -83,12 +86,17 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX8M_BLK_CTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_PWM=y +CONFIG_PWM_IMX=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y @@ -101,5 +109,12 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_VIDEO=y +CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y +CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y +CONFIG_VIDEO_MXS=y +CONFIG_BMP_16BPP=y +CONFIG_BMP_24BPP=y +CONFIG_BMP_32BPP=y CONFIG_IMX_WATCHDOG=y # CONFIG_FAT_WRITE is not set From patchwork Fri Sep 13 09:56:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3489 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 028AB411AB for ; Fri, 13 Sep 2024 11:57:28 +0200 (CEST) Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2f77be8ff40sf7050511fa.0 for ; Fri, 13 Sep 2024 02:57:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221447; cv=pass; d=google.com; s=arc-20240605; b=YT2uc6G8elb8GfM/W6C4mknHw2vnV25CskxSlqHpJTor7inoeDuTEY1DSoyAhVcIy/ 3dLG74f+zSLCxrj0B6FnysuRdQ2jPvMPtroqVep7vB0+JudrgnQsqHeOgXR/QNdbwQME 0wKBfEhEzEROZ8JTbQAScnT9+5EGhvURoYsGJWi86UFxkfzAncpZb/2LIF2KIcTYIXGZ HAIC5heyNk2Qz0hllbiPILSMQ+DIrscks5c8gjtafyKVNEgMpm+CSBuOmmr5kbDb6prY CrFEcnIKZBdrjJoPbvyXUWDNnsaohT7hc8qdRMbHFo5Xz6ocJIUnp31JrXco5z7zK2ot wOIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=C5gxN853jQJ45VImKXAD+tG7o8JfyL6Pzw9LRSnDRpo=; fh=giRMStTZJPL8DoMflebO+jI2Dz7Qb+g6LF31Po0NjGo=; b=WBHPmrwPE5Jm13bPaRbn+w64cZC46P/z6x5feQf/i64Jo0htBvtmvcXjSUrfqmwXDf +xdLugcY5S8NxrgW7Fknvew799MN9fulFQauwo8xQoBIoLhTNx20BT3419dMh4nLmJnt kpAon0XSngk2mt3BX1N/BnaFwAfhQEIltmZ4cYcHT0xXFJtGOU+J/ygcsSr3MbTbK3E0 GXz08wZlUoyJa/I7omSq++zIGHzL/bmBlmuNumZpr+iWn3D/jEE1kVBezXStC2MOR3uQ eb9lOsYlld9svrI8kg7yMDjPXA4WQCvyaG3lhizUBcIOX1/1x5WOO6Mu/T9sJHfXMY7N lmKg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YRyYFg+k; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221447; x=1726826247; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=C5gxN853jQJ45VImKXAD+tG7o8JfyL6Pzw9LRSnDRpo=; b=C7ZycY/3vhh4xd5D6rm1uxWZmA3S2oeChDTtXC2z5RDBdoMJclHp77zXTIDqmJSPQ3 TaPh0dYKFRjNpKLFZmlvVdpDFmFaUEtE1hbnrmIz4rna7WQXx6nAzC3wwz0pcwCSXt4d 9AUEwTM6wSJevswLRm3HXQ5XJ52kweqO4T3bI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221447; x=1726826247; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=C5gxN853jQJ45VImKXAD+tG7o8JfyL6Pzw9LRSnDRpo=; b=IbovLkhVQCWle4AIDfY/k7Sx170OqGAEaomdFUfphdV+QAfdxhcZHXDA60WrFxtvop FatIR1RCg+hZZ3JuhBaRnQ4/t0GVYTJHjFTb4AHtN63W4uPownWhmMcJ/AEaxCc0c6Xx EuDowNVW3k+g1uZjpobGE7ZyBYmaMPKy8DZUnqhjXyuixgYlp6B4100NaKUgCZeJcGcz rJcsYAVYwQZ3LdfKPx5B06VPypwEpnCR1lOgdtFrPaa0lf9W3322eWPgWuODsckVgZcZ 2z1bEbb82p2CbYd5A3/HBr/eHXpxX+oaN6qvk/hLlbSdi31anR9SUQZkFiNEFprNWxjm XCcw== X-Forwarded-Encrypted: i=2; AJvYcCUM+h+gY/Pwj9FCZ8IHrcf/1xy6jQ6bgSxHtMtKrrr16Q2jjwp3YXK0oiHbjFA1a/Bm1pB0uThF1CUtZdgO@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw+uB6m5xqZPFu+oGV3ywWcpaTIatzKaz2nVwelub0SCsmJZ2l4 J7MJnjOtXXZluzyEIOVpXRmxH+l4umigS5qsaV/vv1zDcwT1tS0eqsvKDdeG1C4gZDhN9jFJRQ= = X-Google-Smtp-Source: AGHT+IGycfMQLjL6lxJmmMUl6tCInWS1pQa9lySeOFE2FFjkWe8+qrV9cJVQ8m3EwxX1DBg7wJVKlA== X-Received: by 2002:a05:6512:10d2:b0:535:d4e9:28ca with SMTP id 2adb3069b0e04-5367ff33836mr1578020e87.55.1726221447334; Fri, 13 Sep 2024 02:57:27 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:124b:b0:536:7377:640d with SMTP id 2adb3069b0e04-5367b75e064ls121212e87.2.-pod-prod-04-eu; Fri, 13 Sep 2024 02:57:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUy1/NaVzKO0+OngpIIpbs+e25WBNWCh6SOEdkRxTI6dlmB95mgOhKMLTD5nxFLZBw7JdrUV3UraZ3VHzrm@amarulasolutions.com X-Received: by 2002:a05:6512:3ca5:b0:535:6cde:5c4d with SMTP id 2adb3069b0e04-5367feb9b81mr1587177e87.3.1726221445530; Fri, 13 Sep 2024 02:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221445; cv=none; d=google.com; s=arc-20160816; b=HXGZ6e70xlfCymYYTsmXoMuob9sQ7PPGXqpOKY3kdzcB1VOWm3iVm6wqH0BfA2AzYR F3Oa4rr5elFQCbTu+oQK5q8CKXkyhfOdmgEAQEMyrNnbPBUAAdEUlfCcY5KhJ40xw3pa VpMPSmr41aevXhrgLnAm8u3qo/PBjtt2sPnt/AxKXTHjiUWRsyXzIaf25ogMbAvqMC5V URMfVe47uS2OdMXSnCQRlQdXKuWtEZtHTN2J9TMoRrMRLBiNfmkvjcEdAId4vULcpXGw njC2mhdaodPF29l8xZNWHu2puB5gdYDLxqB9vcHxVyvhIZM5tEktq04sopAbdeUbhC88 HFZA== 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=md9mav7G8ivFcb3vIm88GhY4xo0dNUxOtAaZPAgiaTw=; fh=lGukRekjB0unz/I7WDK/K/HyeiVp6qrpfVKoW3K549Y=; b=bL9LaCpyxqaXP4oS3tQcukZsykAmqfZxxAGkExovM0AJV7hWmnpQ3V12u9FHBjRkw7 482vDTPcPd6B001Dv8SF7dAA2ExSIJ4ofxisnvyHay1GTAINW+no1+ycgAkR1Z21rxbc GZcPFooMxaE1gbg9mD5kAJfOAiBn2RiN9PwgDbdk3lLLQpJxwTW0NoPDiKynp4bGlvC0 7QjMdN28yM4900yLaeFi0JFDrxWiqZ9Hx0CiyFwOSoFqnGHG9ZjJDWG/ttQWQ83antH6 z9+R+OjG7OLHnvxbdEUEoZxujqEgD9WVG7sqI8Z/gAdHO2x6ypTwu+peFumh39I0qxGF /hAw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YRyYFg+k; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25a44284sor454727466b.12.2024.09.13.02.57.25 for (Google Transport Security); Fri, 13 Sep 2024 02:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCX7M5ByqGdem3BT116BZKsE7wE2V/zZW/C16jB6HHsZhhBnTf67/+TlKdhHYNBKS2pIdosa6/hEhFv4iEgm@amarulasolutions.com X-Received: by 2002:a17:907:6e8b:b0:a89:f1b9:d391 with SMTP id a640c23a62f3a-a9047c9c504mr149174166b.14.1726221444987; Fri, 13 Sep 2024 02:57:24 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:24 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Devarsh Thakkar , Nikhil M Jain , Simon Glass , Tom Rini Subject: [PATCH 21/26] boot: fdt_simplefb: add a debug message Date: Fri, 13 Sep 2024 11:56:03 +0200 Message-ID: <20240913095622.72377-22-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YRyYFg+k; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , The printed information is useful when adding support for the simple frame buffer to a board. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- boot/fdt_simplefb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c index 53415548459a..22aaad9d5c5b 100644 --- a/boot/fdt_simplefb.c +++ b/boot/fdt_simplefb.c @@ -61,6 +61,8 @@ static int fdt_simplefb_configure_node(void *blob, int off) return -EINVAL; } + debug("Simple frame buffer at 0x%lx, pixels %dx%d, format %s\n", + fb_base, xsize, ysize, name); return fdt_setup_simplefb_node(blob, off, fb_base, xsize, ysize, xsize * (1 << bpix) / 8, name); } From patchwork Fri Sep 13 09:56:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3490 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4319341280 for ; Fri, 13 Sep 2024 11:57:29 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5c25e0a50bfsf1252950a12.0 for ; Fri, 13 Sep 2024 02:57:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221449; cv=pass; d=google.com; s=arc-20240605; b=UXyXDOvztFO9KA/5WhneoMQkJ5sbcqwMJe19trhcHUJ3Pj4qHcjExlTF34JrH/AENu 8C9mtosR5sl/IB/Lg7qoocV/W3+WkI+xJ5DQjwhwvwtQoidKexkFCGZXiaqihdqlxjuY To85I15WTdU80v1aWzieZQ3smdV8felfJoNXZC5rKZiWJ5+ErQuRocRw2x2i2h+y1wyn KVxI+oIiDdjMur4zIzn4C+fNITGiRqnm5kj+otX9a7zfYQFUgG1ML3qKG+GVE0lsCRBT KbfYfLHngMDwt3B4qBM/eIeVdhL5L0hsI0u9dAwsopv+bAIEJKFlGVTQsOU/lEmB/ew6 QwoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=1SCW9OyiOoMbhxoyd9NXY7+Z1Gv4KOrpmaTsxAhiIBU=; fh=y5vDFOYhjBUBuYaqy0SVwDzwjlwTB8fSdvMehYdqVcQ=; b=UyrpnMogxy93gcx0zY54XF+VAyiiYlViu+3h/3XuDuEj4hX0sleOWUA59P2Y2QHgQr mClI2ffIhwODCAsiqeCNOfh4/jtRu8WxFgHS7CbjUNrb3WfXIZ5tSyoyhB+XDe+QKeef VIg7DVFHX2hRVQej+mCldQUvA1cvcuof6NyR+DiN1jmoYuDdDPvgg638VnT6LOfdbUah Mkb1Akatw0ahAvk+e12lEGgbqvqv6cpDg+DExYzHR49YoCyfPadB6lqQ+pzawQXJvGNn 5gnc1fgb2peMvV/YfhGz3lpz1yk5BMCnCrtUT9VC3Z5iNf8rw/FkwkzHbSMPWJF6af/6 fQUg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=M9xS+gav; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221449; x=1726826249; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=1SCW9OyiOoMbhxoyd9NXY7+Z1Gv4KOrpmaTsxAhiIBU=; b=a9MM+gxmDYk8A0isvcg7pbPB+hZnLeaxFqdHpTSfyeQMM6WiCZnh3rIGoQ5uw7AKtw XEBHrqLGQ1sejyJU+YEJxnhsCCAMFVYK+PMPFd9fDKYezgNx6/Rd4zSfErZ0dx9cU1nX VI28Q5JTMNer75nxCyf/eT09r1ntUbWQybxZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221449; x=1726826249; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1SCW9OyiOoMbhxoyd9NXY7+Z1Gv4KOrpmaTsxAhiIBU=; b=iyzuptvsgTpazVqKDbSg2OyKoev4TV1/zhNuwpyU9LTXsbpND8PC4XrSWiT92Z8Q+h FjcjyC56g4QABS8Dd9H+dgbyaWnuEdjmiYhL08v89bkS5olUEUylktCUx9gw5HJnmeuw 6D/GprWLXJEx4QAXcDrG5WrWeJS7+0PEaRD4kLHHPNgHdQ4y3yuEDNkSYHg5XBfZAJaJ hQuwhB5y79ADJjwxP/EAwbidVGc7jLjlTbtjIXdEKsQrDx51LmWI3Uy+fIS1KIeeF2X7 pjrY8eLsfJz3aOcMj2xGfL9w8N+kfUW82WyGhhdJhw4xRmjddXrDAR2Ykdrhkuf+0UJL 6o3A== X-Forwarded-Encrypted: i=2; AJvYcCU41AFIBvrBlkoiKJlxw7nENiwTV+VQay66Zd8z+QvLK07HOa7x46Vna4YMYj0AgPUhq9bVhwSiCnkyiTVB@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxjEzWT4TXpKVk6MBmi7Zzoj5CqtEcSdGIS7i27k4CnOghyhBmr DFscLLTirnEiWecf1waMw7aF3Ky6C1WGLZRY470UOKA9Hf26GV8Z/frA8PQbXVq5Ug== X-Google-Smtp-Source: AGHT+IGAdJd+FjlpruObXKxG5+BEatrme+3pbn5ARVXIsDeyFHPYDTt/1TagWYQgHuzD+4SIZOku5Q== X-Received: by 2002:a05:6402:4012:b0:5c2:7699:fa95 with SMTP id 4fb4d7f45d1cf-5c413e1ff4amr5163360a12.19.1726221448789; Fri, 13 Sep 2024 02:57:28 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:35cc:b0:5c2:7524:8454 with SMTP id 4fb4d7f45d1cf-5c4140908e4ls1352160a12.2.-pod-prod-01-eu; Fri, 13 Sep 2024 02:57:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXUs6WgoCXzff6WYPLDUu3L0wUriJhMxv0FuK5IICF+6Dmn2Ccs5y1b0IjO8sj0a1siK3wawMTFoYj8XI3s@amarulasolutions.com X-Received: by 2002:a17:907:e6c3:b0:a8a:6c5d:63b2 with SMTP id a640c23a62f3a-a9029438c89mr563890666b.18.1726221447240; Fri, 13 Sep 2024 02:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221447; cv=none; d=google.com; s=arc-20160816; b=aJb6lTPMgybOB4HB+7Ajd70ZMOBWAegmW5eT8RdnrzkaLcWbG5uC6W8UMBRmwPibV6 57rX5FFl4/RHxyHunTv9VSXtHNWZH9d3VwpbM/SeX+mwOPWf55Y31XSH4Rd+b4vZPCqb S6KuF/yLRTAHUFTFMTEs2vadYpaadZ3fbAuz1gM+dbRZ2bo/kHZmaIlYnfzeYGm59N+5 FsTh1Z7UzSY+khl1f9qx+lIRQyyWwcAuYH85J9bD5Dh2YqpwTsT36UM+3pJXGFVz+KZ2 J/H0Dvgn7GIQaS1MBaKC9Z4Pfm6P7cCsk6BTdPkDK1Z8G9Gxhf6F78LgjRLE3faljMGY 7Ihw== 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=XyZMgmVmdG4fiZHCiw9uZQLu6FufQEMaaUVl/Ul2c4M=; fh=vOfbJGEJndI8ZyXOJGzrxh8kcxovIW23dIe1kjXooB0=; b=zVjr3jpdFir3PDfZ7xOUOYSs0stPqcYynR16DM7m4w3o3xmrI6D0DumAPSqqewO1jJ bX+C/Cap+1wmj3Pq3rD/V1izNSbU1zsJOjtVzJud3L1OIGuqzJGZZaZZschDlFx2jY2o QV4PyjImz73N7jCs5Cq/F+k8DAfq/2wpchowBxy38nrn6NAKpucQdhCPhgPOlwpNl3xO WPuAGaZ2JeYZpSLdQfRSp3AWOERSFZnp5VHZWeiPJx1Vd0Rvkmh6tse0tbFNutPTkABT h0wYp8lLeCauUReauoHdYDG6BWMO1Tk0MdOTWBHokjyctX4Xr/FqARY85IUO2kGGWgnz oD3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=M9xS+gav; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25c2374csor471265066b.16.2024.09.13.02.57.26 for (Google Transport Security); Fri, 13 Sep 2024 02:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUDblE2aqvWl/wpWdjUh/SRQCS9lir9FPblQVbyO4Ux8otBLcK0LnYkHYXtu41YOe/te/uvDnXKlvoYD7eY@amarulasolutions.com X-Received: by 2002:a17:906:d7ce:b0:a8d:4e13:55f9 with SMTP id a640c23a62f3a-a9029438220mr553279966b.19.1726221446083; Fri, 13 Sep 2024 02:57:26 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:25 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Anatolij Gustschin , Peter Robinson , =?utf-8?q?S=C3=A9bastien_Szymanski?= , Tom Rini , Ye Li Subject: [PATCH 22/26] video: mxsfb: support simple frame-buffer Date: Fri, 13 Sep 2024 11:56:04 +0200 Message-ID: <20240913095622.72377-23-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=M9xS+gav; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , If you want to pass the frame-buffer to the kernel, the video output is initialized by U-Boot, and kept by the kernel. The patch does not turn off the power domains or reset the peripheral if you want to support such feature. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/mxsfb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 45431f0a1047..06b2a2461246 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -422,7 +422,8 @@ static int mxs_video_remove(struct udevice *dev) if (priv->disp_dev) device_remove(priv->disp_dev, DM_REMOVE_NORMAL); - mxs_remove_common(priv->reg_base, plat->base); + if (!IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB)) + mxs_remove_common(priv->reg_base, plat->base); return 0; } @@ -445,6 +446,10 @@ U_BOOT_DRIVER(mxs_video) = { .bind = mxs_video_bind, .probe = mxs_video_probe, .remove = mxs_video_remove, +#if !IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) .flags = DM_FLAG_PRE_RELOC | DM_FLAG_OS_PREPARE, +#else + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_OS_PREPARE | DM_FLAG_LEAVE_PD_ON, +#endif .priv_auto = sizeof(struct mxsfb_priv), }; From patchwork Fri Sep 13 09:56:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3491 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id EADB0412D2 for ; Fri, 13 Sep 2024 11:57:29 +0200 (CEST) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-535682ab6e9sf1740424e87.1 for ; Fri, 13 Sep 2024 02:57:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221449; cv=pass; d=google.com; s=arc-20240605; b=X1kIgVBeIWrVJ+kJNXNjHMaPiMtkeerAmFiG51PTVhOcV/9os0P4MV21rPPj4vi4CL kk9wEgmZjGQxAoD79dnpKFPidUQrWAjn87emtRp4rIfGEt6Jjdv7e+OFJ9jD6lVGpptu NBcZYYjrh96cHySXL5TmJfNK/AU1XL+Xls5m2/Ep8Yl0pn2uYeTYBr0cIO7Ql9EJOrsw Vo2XvUhXeS8k3r0mbFEHlpRIo5K+NPbBblmwWl2j1jbf8yRP0ngvH597Vd2horlmin+x UDEa8y7PvhHInghgzhA2ax6jPE24+avMnXT0mfk3NQP6fc20IViMS62VJ/1m8I6Qd4/i acow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=/XUp0p7AkzNk1ONJJNSENyULRDOvlQdmO0oITrNJcQo=; fh=ITzchc4jVGwmbFhdC9dOaONyFuUAHjwJozeIDyUKBRQ=; b=HL8HWIYoXgp275P7fE6UIxML5z/6zKrnvcqbAuM6RZfcon2hrGhHNYcRp6c/+xxbF5 L9TlqL7Bq3YeizlyW3Yb2sXu71PrYLsXTCqI+/bCweZpfZNf2vJ2mgy+CjifwAbataBT Q7l88az9Wj77U9GkMXV+YbGeU9EhdD+5n5+CHI+Oa/73UH4ztvIVMKU0AqitCJdz4Eg0 HPJa/CHceSiAqy18Nskw0zu0WY5Ss/I2c2PePr62IDGtg4JgJFXSHO1K5fWlfj+gfDgZ ZSiSam55ezPPU+TxMnoQfFJG5ATybEIAZoNjyICtDwmeHJML9wt9tcYgpgy4X9whfTKR T0Gw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="p2+jl/Dt"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221449; x=1726826249; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=/XUp0p7AkzNk1ONJJNSENyULRDOvlQdmO0oITrNJcQo=; b=DfAvmTCFFSNav0wzN8QCyV1wA5jYFHJ7VnFupxb+TrJNlNuuGqVdhVHr3TzaDMKPei 68OMYchiOlrvLSnK8SOLOuWzHZDESbTknKdZKTfdaAEFLgJaQ1fXxHVGW86j37A9V62W KSXHtM1PpMw2UqB03H6uedF+HXiR/u5RiPUiM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221449; x=1726826249; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/XUp0p7AkzNk1ONJJNSENyULRDOvlQdmO0oITrNJcQo=; b=WC+e7gFSm2WC/jS9w96K4jtMjzKpHPOspJFmwdT1yTFZvaZmQrbw88Fs4fYIgHbp4M MyCpr5+otqVrdTA0+0/ivrPWSxuR0gQcCFbA1XGBLvOmPctzF83h2v0ZgWpjPo8VOtH6 2B7JwAx5RojMX3On2m5gYiezkIGrWVyCc9oab77VjP6T0kmJNGvfzzxA7K1d8JBDuIuu Hf/9tyUPj7hQHB55SZAiyG1xe8ePyqI/PeDQ4+jBF0Gw1MYzy5hXFAx64Xz7ve289O9Z 80KgE6SZ8/vi3AurGj+HWUqeKos5Y4QMoY0NNeiin93+bdWrbeOSnsBtNKiy5ti9DeVZ pobQ== X-Forwarded-Encrypted: i=2; AJvYcCUJ4izXV2cy5OwC73OBWVppnLMYcIPm6sRr5NkDu8JPeIeKyPjHvMur2B2yk5deKMhY66gQpASUHjnY7fvG@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw7AcDeL+f8iVx3Oq+ZChNuZRB4mnvhWVPzADnrVKqrkzPXesZa +lsmiMJ6ckWf++MVHpOzbb+oH9hQOrsc1rJFoZDMvgEVkPN/C3Vt1eusFHsoInjSyA== X-Google-Smtp-Source: AGHT+IEsXH39j70Wx6M9POJNG1qNeGBGc/w5O3NT2kyvPXzjP9yExE1Zn6FsvP8KUc28vFWmqWICVw== X-Received: by 2002:ac2:4c41:0:b0:52e:f58b:65ee with SMTP id 2adb3069b0e04-53678ff48ebmr3812369e87.57.1726221449247; Fri, 13 Sep 2024 02:57:29 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2695:b0:5c2:6fff:9f71 with SMTP id 4fb4d7f45d1cf-5c41408b7ccls803505a12.1.-pod-prod-03-eu; Fri, 13 Sep 2024 02:57:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVxS0sNemIaXzMbuwxXjXMppHPNdWUkvFiIj7+pSzfcaXAD5YCJkgQxPnr4qzrjnREmPEaGY5G7zaBiWghY@amarulasolutions.com X-Received: by 2002:a17:907:f70c:b0:a8a:8de6:a605 with SMTP id a640c23a62f3a-a90294fe83dmr605219466b.17.1726221447748; Fri, 13 Sep 2024 02:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221447; cv=none; d=google.com; s=arc-20160816; b=w5/66L4nqlDWI5bpHPMJ9DOVb/+L0bJyaq5XB0+1MAlhpOhsf3X3p6dFQ2nYFU7yIl MQQkOps/IAa0as4jg7MJb7qZbADCdLJ+jQ2fK2dwrqIUrUKL7sBNLD9T/zI6pUIbyuaQ yrZwM8CgkdGX3Fs1O8ev6HDILqVVO8l6O/3lXxwb2Wy4ZqpjjLV2APd7IGmxn8TQTtT1 Gmf5yXXh5PZwe21Eck4tnse3DOrMB5kXUuFEDeIWQvpuYqWNa25gcN37tknd4IrguXMR hfdssW67cfYK5JxgVjD8cSCw6cNNFV7J/EvWCtP+NMHYboWhZ35WU8fPsV5CwrrwemWT 6gjA== 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=uMqrX/ueWFxmHIyE51MucJPFAAWhhqGdobRjvQZoM2o=; fh=VQkiAiEJlXZMsnMIlA16uDjkjCBCf0pWHJtbdu1SPoI=; b=kp2wEHdSF3arC6PMdAw4fh0alZm45ieKQ7PRo56QD1RyHdqrAkzVrOE5RE9ddBBsd3 Rynntyd+jFn0zLqp27FrW4apt333aJX9Zxdg1DzauMne5F14OAjxdglZMicCM2fVBfVH EFamtgryu3daIn14Ar/4MXtBdxYE2UOaq8k4mmfKed+IVxfo3eYzy+/3jYddyyxeVT+7 /to/QQ1w2LogdAv9Dhy6UBMxUSackd2qmJZLQIUzpssVuhl+wgfX1aNDPyv2izZMJpUS hDlE5PW14YgF9Uf7rE7DKqa5HQpjzJEoG7EJ6/1eeBQ1uDkMm8Hg5G7iCpU8OLudsIpG 9jUQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="p2+jl/Dt"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d258f297dsor478459266b.8.2024.09.13.02.57.27 for (Google Transport Security); Fri, 13 Sep 2024 02:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUmv2S9/c9xUy8MmnqSx9aypF0dqzLtmjb6eUygPe8+vbnZhyzE6B270dob0Yf2QSpjv0EM/CuTxcNwu3Gn@amarulasolutions.com X-Received: by 2002:a17:907:e6e8:b0:a86:7ddf:2909 with SMTP id a640c23a62f3a-a90294fcf3bmr574413166b.14.1726221447125; Fri, 13 Sep 2024 02:57:27 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:26 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Anatolij Gustschin , Minkyu Kang , Tom Rini Subject: [PATCH 23/26] video: bridge: samsung: support simple frame-buffer Date: Fri, 13 Sep 2024 11:56:05 +0200 Message-ID: <20240913095622.72377-24-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="p2+jl/Dt"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , If you want to pass the frame-buffer to the kernel, the video output is initialized by U-Boot, and kept by the kernel. The patch does not turn off the power domains or disable the peripheral if you want to support such feature. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/bridge/samsung-dsi-host.c | 9 +++++++++ drivers/video/bridge/samsung-dsim.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/video/bridge/samsung-dsi-host.c b/drivers/video/bridge/samsung-dsi-host.c index dd3e33c4edc7..2d0e8f71a756 100644 --- a/drivers/video/bridge/samsung-dsi-host.c +++ b/drivers/video/bridge/samsung-dsi-host.c @@ -1281,6 +1281,7 @@ static void samsung_dsi_set_standby(struct samsung_dsi *dsim, bool standby) samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); } +#if (!IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB)) static void samsung_dsi_disable_clock(struct samsung_dsi *dsim) { u32 reg; @@ -1294,6 +1295,7 @@ static void samsung_dsi_disable_clock(struct samsung_dsi *dsim) reg &= ~DSIM_PLL_EN; samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, reg); } +#endif static inline struct samsung_dsi *host_to_dsi(struct mipi_dsi_host *host) { @@ -1515,6 +1517,12 @@ static int samsung_dsi_enable(struct udevice *dev) return 0; } +#if IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) +static int samsung_dsi_disable(struct udevice *dev) +{ + return 0; +} +#else static int samsung_dsi_disable(struct udevice *dev) { u32 intsrc; @@ -1532,6 +1540,7 @@ static int samsung_dsi_disable(struct udevice *dev) return 0; } +#endif struct dsi_host_ops samsung_dsi_ops = { .init = samsung_dsi_init, diff --git a/drivers/video/bridge/samsung-dsim.c b/drivers/video/bridge/samsung-dsim.c index 986f1d830844..36e45abb3009 100644 --- a/drivers/video/bridge/samsung-dsim.c +++ b/drivers/video/bridge/samsung-dsim.c @@ -144,5 +144,8 @@ U_BOOT_DRIVER(samsung_dsim) = { .remove = samsung_dsim_remove, .probe = samsung_dsim_probe, .ops = &samsung_dsim_ops, +#if IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) + .flags = DM_FLAG_LEAVE_PD_ON, +#endif .priv_auto = sizeof(struct samsung_dsim_priv), }; From patchwork Fri Sep 13 09:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3492 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 74C2E411AB for ; Fri, 13 Sep 2024 11:57:31 +0200 (CEST) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-5365b801741sf876538e87.2 for ; Fri, 13 Sep 2024 02:57:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221451; cv=pass; d=google.com; s=arc-20240605; b=Jz2jqEAmPmwm59hJgNwwnTF6nsGWAk2n2xYvcgFNi1a6mdQM0ssJs4rOVO3mYDjW9H US15tObrmvP8ozhnZ9AJSDAL0b5KSTFDd6JrkXb2bOZ9e4DIKCS/kilJ94G9Ht+xdrsn hGRhlc9x1U/WdIE8IkZAxsIHuNpdV+xgK0Um9HOBcO/XiigJFpECB3kX6TGWZ3PTZ/rr q5Qsh5Vg89G6HKzadcU2hHZ5iQEH5Cc5DLKKsZK1IlARRCT8zB9yX9YMuau+2f7Tt+nP CuxmUotK0KZOlfsvTyH9X6K6BQZ4BDjmHP7z1ZzMfkzIXk4tT6597u7BlI4aUnGVaibF DoHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=zQ0CxJAmVMgUkXfBrLBApMilg93hGIa9QMfzZzfiRDs=; fh=mUyxw6ZpMV9AQB4Il1EIZ3/M2riPXCBHjkaLFQvE6eM=; b=eQRKn7GCcZafR2Z6l/YvxK2uK0mEPE3hzyNCOlY6DHFb00l26oGW/p58cOP2wiXvu0 L8OPTwaYcBEOKyGH38c3ChLB6kCTcaY+61VTi6Pc49fvqkBXL47MuRmCT9vjTghqUaT4 8ptnHpmwRYdGsm2JrRMGmaOFja4iwJ/isAB/nbnzXu2+cK0UVBK/jm7zGsPeYguHja2h 4U3UeSWQPTygUrbVqoANfMLoXhg5bSdETqPjYMhR3RMoXhKilldDu5/CHT4DUXl4yqtN rfTLs5pRU8fVsYZfTnZPFumdA2qBd51Y9XzXDmVqfZTZJN/u52ktj/cLc3LQ48pLlbk1 GF4A==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ei8NY9o9; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221451; x=1726826251; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=zQ0CxJAmVMgUkXfBrLBApMilg93hGIa9QMfzZzfiRDs=; b=HJQoCVv+Psrs7LjPEGpVNtwH2VjlnNWFBrKI9lPdpbHAZsNqEigWsY0dkZwFAxy2Xw 68YItr+O9oTv2t+2u/YWApN4gDfAPvx4eYwyjKXBBpv8em0W3KcAvrj3yb7NEMipemcj bCbjvRuA0xIxkFrx9EJIDITPDXc5FhiopltIc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221451; x=1726826251; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zQ0CxJAmVMgUkXfBrLBApMilg93hGIa9QMfzZzfiRDs=; b=H+RbjuDVtLR3F9Kf6K66FW7w6382q07N+XE+rSGeX8NS7hCoY3lZ4KJPT75JwrpmFD wsDpcfOCjcSe5XC1eH5MCxy7EBDfvoPzN8BBMV+VqTYz6HcnCah/7gXl4u9YyifEhzmx +AajdDSwj68ddUZHFOJUnWxUMZEHwD+XiowV5/wZ0OpVcXC8ouvyc7wJn2GlFdP2LSpI jOLlAGlZjdNUEysENY38g9uwUX4vjPPPoTH5NXnRQyAFVrcnqmcij2XUUd9x5awncD4B OwR8FoOAXeD2SlSIjQAnQVBAJu9vubfUC1t3ZZNKR91Q9w+SFYERieGVn/0wbSthv1JT BrXg== X-Forwarded-Encrypted: i=2; AJvYcCVVC+Ixz5wio6l8x3ww2LfZaSBCdbtfPRZtUMRvLbLu0d2AmYQMfv5AvBKUXzkNFa6ihUosZ+oogFb4S47/@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyfIXp4fp88AIstOJrv6l/0sL25KoH4iCnYF4ka4flwRCJ+5+Rq cICutYsEGlFTKLXnY3kX8wCitlJ467+GzobSlnaikKAbdPjUVGb0v3AIG3PgSRaM8A== X-Google-Smtp-Source: AGHT+IFQrw3Jn/AJ75/rnfCJ5CfK69q+lBG7U1V5agolYBxBANcxjqOJqE0zsbbGE+vauGauW5NfVg== X-Received: by 2002:a05:6512:114c:b0:52e:9921:6dff with SMTP id 2adb3069b0e04-5367fee53f2mr1932560e87.26.1726221450733; Fri, 13 Sep 2024 02:57:30 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:4019:b0:533:482f:afc3 with SMTP id 2adb3069b0e04-53678e094ecls69618e87.0.-pod-prod-05-eu; Fri, 13 Sep 2024 02:57:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWP1ZBip3C+Hg805XY4jl+FdgfAx38rHv84FW/5KxMkUu1eBW8ju469dcsCPZcWIubbQ/6Ga662SuBJdV38@amarulasolutions.com X-Received: by 2002:a05:6512:238b:b0:52e:932d:88ab with SMTP id 2adb3069b0e04-5367fee25a8mr2092643e87.23.1726221448853; Fri, 13 Sep 2024 02:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221448; cv=none; d=google.com; s=arc-20160816; b=HjcxE/21fGpEg7yYeOK8pdm0bsnlLyGwwIh8HiNEvmg6gTlkElUxBiahHgLE6SJcf6 CvNeaTQsbhOPw1x6a4tmU50UtXHM4NXr9kC/JfDN3u/iNaz4B+vopLW8GXf0NdXTgUSZ rKkRrCSo/GOSkFiZBQmchJ7ny3BY6bgLy7DJBxUUhgKYqJOWhQe3qDOP2+MhTKYUwwWE OaldHyquzVqO4GnOixMj/bXHfCo/E1mlbAiEdV/5hl7Jg6Fxy+wc9gm0RpKTtPhBfdPu z943zaDJhcW1RgwidVxZcTgmKW4//Ayja07s4sKfdAQMmo3SVQhEs9Iw7NoHq3w8WeZj q5Zg== 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=KxLcrsk7KRUbBJ1NKSDZt5CMW8u++VHiwt7yzGRE7kA=; fh=Eyyy8FmQ9GXk8FoArf6Eh17UmFeiQdQ2vnjfPRkjMmw=; b=XE1/ar+X2WmD49R7NpHomckPMPsjEFSAq3zrNmUsuVjIYuvrHYXP6x8mbQR8nfYSAa IIjnRaJ8pXLQlOhbhVBPOSwDtPqi20MyKaLl7ac/ZibMm+DaR6HnitEqchP98TLvjZ7A wQJQWDJsDPFvO8cgT+cVETzb1LIAzws6VB+w7Tdj7xgraTgk9OTGELfGkIf34g1t4nl5 ocnvGNCfKstc9oPINkUM1ZtfzGSPhJ0G0YdfSs6YlElbqa4Xby82cCp3icBNXTWwKfp6 CzsQMqC9cG59CsPMhTYn5mt82y+7DIJfCHq3A/3FT7eB9lcY+b+10T5cid0WX3R1r8FB R74g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ei8NY9o9; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 2adb3069b0e04-5365f884df3sor4822430e87.14.2024.09.13.02.57.28 for (Google Transport Security); Fri, 13 Sep 2024 02:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXsHNdA/tXLSQ9mIr6jjfL1nFxjdJhGo1REOM7fXEAed34v/BO2rB/l85DVdZq6Ym4XucyW5ghBrVi1b6Sd@amarulasolutions.com X-Received: by 2002:ac2:4c4a:0:b0:52c:76ac:329b with SMTP id 2adb3069b0e04-5367fef1b91mr1744190e87.35.1726221448156; Fri, 13 Sep 2024 02:57:28 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:27 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Tom Rini Subject: [PATCH 24/26] imx8mn_bsh_smm_s2/pro: support simple frame-buffer Date: Fri, 13 Sep 2024 11:56:06 +0200 Message-ID: <20240913095622.72377-25-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ei8NY9o9; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , If you want to pass the frame-buffer to the kernel, the video output is initialized by U-Boot, and kept by the kernel. The commit modifies the device tree to be passed to the kernel just before launching it, to prevent the kernel from reinitializing hardware that has already been configured by the bootloader. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c | 99 +++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c b/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c index c99896873991..87eb4e7ed63e 100644 --- a/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c +++ b/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c @@ -5,6 +5,8 @@ #include #include +#include +#include int board_init(void) { @@ -20,3 +22,100 @@ int board_late_init(void) return 0; } + +#if (IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_FDT_SIMPLEFB) && \ + IS_ENABLED(CONFIG_VIDEO)) +static void smm_s2_setup_simplefb(void *blob) +{ +#define DT_BLK_CTRL_NODE_PATH "/soc@0/bus@32c00000/blk-ctrl@32e28000" +#define DT_GPC_NODE_PATH "/soc@0/bus@30000000/gpc@303a0000" +#define DT_MIPI_DSI_NODE_PATH "/soc@0/bus@32c00000/dsi@32e10000" +#define DT_LCDIF_NODE_PATH "/soc@0/bus@32c00000/lcdif@32e00000" + + const char *dt_addnode[][2] = { + { DT_BLK_CTRL_NODE_PATH, "lcdif" }, + { DT_BLK_CTRL_NODE_PATH, "mipi-dsi" }, + }; + + const char *dt_addprop[][2] = { + { "/regulator-3v3-O2", "regulator-boot-on" }, + { "/regulator-3v3-O3", "regulator-boot-on" }, + { DT_GPC_NODE_PATH "/pgc/power-domain@3", "fsl,boot-on" }, + { DT_GPC_NODE_PATH "/pgc/power-domain@4", "fsl,boot-on" }, + { DT_BLK_CTRL_NODE_PATH "/lcdif", "fsl,boot-on" }, + { DT_BLK_CTRL_NODE_PATH "/mipi-dsi", "fsl,boot-on" }, + { DT_MIPI_DSI_NODE_PATH, "samsung,boot-on" }, + { DT_MIPI_DSI_NODE_PATH "/panel@0", "syna,boot-on" }, + { DT_LCDIF_NODE_PATH, "fsl,boot-on" }, + }; + const char *dt_delprop[][2] = { + { DT_BLK_CTRL_NODE_PATH, "assigned-clock-rates" }, + { DT_GPC_NODE_PATH "/pgc/power-domain@3", "assigned-clock-rates" }, // pgc_dispmix + { DT_LCDIF_NODE_PATH, "assigned-clock-rates" }, + }; + int i, ret, offset; + + ret = fdt_simplefb_enable_and_mem_rsv(blob); + if (ret) { + printf("Failed to enable framebuffer DTS node\n"); + return; + } + + for (i = 0; i < ARRAY_SIZE(dt_addnode); i++) { + const char *path = dt_addnode[i][0]; + const char *node = dt_addnode[i][1]; + + offset = fdt_path_offset(blob, path); + if (offset < 0) { + printf("Missing node %s, err=%s\n", path, + fdt_strerror(offset)); + continue; + } + + offset = fdt_find_or_add_subnode(blob, offset, node); + if (offset < 0) + printf("Failed to create node %s, err=%s\n", path, + fdt_strerror(offset)); + else + debug("Add node %s:%s\n", path, node); + } + + for (i = 0; i < ARRAY_SIZE(dt_addprop); i++) { + const char *path = dt_addprop[i][0]; + const char *prop = dt_addprop[i][1]; + + ret = fdt_find_and_setprop(blob, path, prop, NULL, 0, 1); + if (ret < 0) + printf("Failed to add property %s:%s, err=%s\n", path, prop, + fdt_strerror(ret)); + else + debug("Add property %s:%s\n", path, prop); + } + + for (i = 0; i < ARRAY_SIZE(dt_delprop); i++) { + const char *path = dt_delprop[i][0]; + const char *prop = dt_delprop[i][1]; + + offset = fdt_path_offset(blob, path); + if (offset < 0) { + printf("Missing node %s\n", path); + continue; + } + + ret = fdt_delprop(blob, offset, prop); + if (ret < 0) + printf("Failed to delete property %s:%s\n", path, prop); + else + debug("Delete property %s:%s\n", path, prop); + } +} +#endif + +int ft_board_setup(void *blob, struct bd_info *bd) +{ + if (IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_FDT_SIMPLEFB) && + IS_ENABLED(CONFIG_VIDEO)) + smm_s2_setup_simplefb(blob); + + return 0; +} From patchwork Fri Sep 13 09:56:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3493 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 29AB841280 for ; Fri, 13 Sep 2024 11:57:33 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2f760dce28bsf14809021fa.2 for ; Fri, 13 Sep 2024 02:57:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221452; cv=pass; d=google.com; s=arc-20240605; b=Kk0KZMtv5Z1sfjX2C17X9LEozRTfkeAwARTW6l+aBQvrp9aR8YACYrv6oL2EJIL2dV N2+zmvmtFf/hZgTDC37vcLY/iU73QzRKHWsOM4PVeIlDK0AfRjmYXzz4z8kRF3BpK/8i Hq26k7be4DxeYQKfR7cNWTnscDssjegZhKTMxQG0n++ZaHOL0ojYX8iEVml45dIHd2Av OOGNt2XWvPWIaqLROLILc+20H7wJ8zbG4IYGA+Lc78V6TtYi/tuc4K73JcIyDAsZIdWY DicUd+17an/9YCWl0pjVvOErGHHvyINchOjqRBcdkUMOEoqZNGagk2EkfyinjKdV+1/7 UDig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=TGP043JwEEPrKWD+LNZx5SSLLF+8gJP94Ua8lBFV4Rw=; fh=p31stwEscEsPQ0YkUegrwvKwInonP9N6JgbYAmnWWIg=; b=NYYnP4aqGnUulsgr0P5BC/kgnJobm9YFQI18PviuuisRRSn9JWuJ7alQMjEIt/Uga+ H6rkyvAGSDDBw2CppLKgxcrYyX3xS0Z4asYWvLihg3Oi9kLk6XL9H6GTgNYRamYLse9f +cbUcDqpP/ZChseRULwUnaZYe2WIbQrgchdch+QHHD0SbUjjyTOD2s1NmoKM2COr1Z6I qDzaVT9rqZJjlZsjj1z70ZXT/yXsq6Mno84YVxGT50XdUfQJcX0MnGDqperhAaIxN4wn Tzkr5K60+DAanuWo8augCxKRIrp4fW0IWq7J696IzaSFGMTwY9DEudOcvwDTsCm8kfmc f/Xg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hr03ITnA; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221452; x=1726826252; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=TGP043JwEEPrKWD+LNZx5SSLLF+8gJP94Ua8lBFV4Rw=; b=V6xwqNhhXk1xnrGOEeRzGHl2D+VWY5ObSVI+lRXBm2UF9GpIfevkLVzWjh2cjG9nJe 7an94Qyel+DLhjPmTZznTYR3seTr3DTvmAt+qCCoblG+JWM6Jt7ZLCTCRvCrmIEKOoDl oPWimBMcvnD0H+XuAP9Qe1lNrUobFC6W9HEms= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221452; x=1726826252; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TGP043JwEEPrKWD+LNZx5SSLLF+8gJP94Ua8lBFV4Rw=; b=GB2pHkjvvjP1slyMPOsAqpsJGKHY/tbj9BQYxg58TwdR5kBmZ9g2x2ZnUISJXyhbo9 zZUkIAsabU3Hk+3aIV7pWNdDqb+ts66r2P8GdLNunuS3NSnj6kyWrrI+Lf4SrD+Ljc/D TniUr2l2puuSByKvT5etrQC2ULyHsfZBRHulfpjdVbHNaAZXofdtvX92wH6eN+TBVa72 7pCorZG39XzywsYsR5BQpIwIRdko/wBoJwFpdiXpneqTn+wFXxuw0yi7k3jzkG4qRcKo iLlFQdlFc39N7DZ4YOv5e20wSUEuFuHW5JW/VfgaBdiBWc47oTydcLU0LdkMb34SlGG4 yrPw== X-Forwarded-Encrypted: i=2; AJvYcCWUiWN8DYs76XVQJFt02xMd5rih7fmhrhsL2lTuIYbYN8kcwvyV7WS+7Y5F8+hxTvRKK3KJtmBbES1jV+J/@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yy4L230H2cG/JkzpKmKBS9ZsGoiwWjM3zwE0DsiT0/HkNMqERbt /TyCVs1vuEKi4VFytOHquIIxExTbT4bkdbtQ6ZBZQx21hkpYFLwlMQ9zZnFrnUuguA== X-Google-Smtp-Source: AGHT+IEhnE3ApaFswvPUMqW+c8WR2YnGXT4B34mMPro3mUvoPTqExVZurtDlGuimoiTYmqtG0aQKdQ== X-Received: by 2002:a2e:4c09:0:b0:2f7:6d92:1a30 with SMTP id 38308e7fff4ca-2f787dc3cddmr25680391fa.14.1726221452422; Fri, 13 Sep 2024 02:57:32 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:34cb:b0:5c2:61a7:62df with SMTP id 4fb4d7f45d1cf-5c413e2a336ls1349232a12.0.-pod-prod-01-eu; Fri, 13 Sep 2024 02:57:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnqhVgEpYQf3RzjUnOUdDDq0D8hk3P3ZflLmnUE9alPcUBH3EM6Vcgbx6izpCWGEz0OW9JmDIQRf0GhDuy@amarulasolutions.com X-Received: by 2002:a17:906:c153:b0:a8a:8a31:c481 with SMTP id a640c23a62f3a-a9029615808mr647955366b.42.1726221450916; Fri, 13 Sep 2024 02:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221450; cv=none; d=google.com; s=arc-20160816; b=xQCcSXlfyIwKAcb60KsXpsMMyRa9zw084OEmmqCxcCddKhQaaR0gW3rTXaqbI6cR6r rdVV6pkeOUhMBGVUhLjYseGEDAxaJ5kdr23fnYzVTkOxDmwx4gI4UlEA+KUw8O5skdd0 4KMnLEYVZZykBMWVd6aZo4iAWofm3/3RPG7Sx9945Y1EO/ZFbAU5FQK7l91R8qCpsY+8 EaN4eMVQGmtFEXEhlcSPgBJfaTr9WpfOcTteX8Zb0MqPeggrqLiLRQjJnA68zHeLoKZi LkcAUasJfUCQC+t3q5VUUYNhA1Ow6E31HifaDAWKJmXuu/NDvBh5nqZdK8xarCfF4uEa 4Psg== 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=etkA6VA9tRrzouIACYAZ8RzC4lkECV9vmUTMOSxzUys=; fh=q0fIIL3zT6GBvnhtYxLgxGGfuiknKaOm9m0iMIipJVU=; b=e9QqtTwSKDJw8RvL40W56Uerd9fsgDLYw4kd9QKZoJckXA/csgFCb1LKu/a44eHYX5 weBw3/PczpAs8mBAeJebL7gI4nYKj5Tjxd7bNkOhVnMNk81GqNOsfs3cdCYd1HPChSf+ X380Dtc6+tAetSrSzMaCmefDCoyk5fls5qxxkLxrALvwBy7s+69lHSjrdLeimYGu1quA uZRqhNDPjaMUp5vOu2hzJbYWayjzUHwpikWtVu+0f98tc9AwUaTMibRSAmoShdRlBvF3 jDf8/zsORvG8f5nYJnm6l+++OXZlHM3pzB19ObEAqpjyg+3o8ffXcLyEKox55XIVaHES yZfg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hr03ITnA; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25d121cfsor478307966b.21.2024.09.13.02.57.30 for (Google Transport Security); Fri, 13 Sep 2024 02:57:30 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCW+DlZGtlD/yKNTFiuLk/cRKvOawVCE01ALms2eFThgzJs5WrA4fPRjz6o5Kkl3tEn8VnAudOu60KfirGvW@amarulasolutions.com X-Received: by 2002:a17:907:e269:b0:a8d:3338:a497 with SMTP id a640c23a62f3a-a90293dbfd1mr548603366b.4.1726221450294; Fri, 13 Sep 2024 02:57:30 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:29 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Marcel Ziswiler , Patrick Barsanti , Peng Fan , Sean Anderson , Simon Glass , Tom Rini Subject: [PATCH 25/26] imx8mn_bsh_smm_s2/pro: enable simple frame-buffer Date: Fri, 13 Sep 2024 11:56:07 +0200 Message-ID: <20240913095622.72377-26-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hr03ITnA; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- configs/imx8mn_bsh_smm_s2_defconfig | 3 +++ configs/imx8mn_bsh_smm_s2pro_defconfig | 3 +++ 2 files changed, 6 insertions(+) diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig index 2fa8bc22747e..4982b58407c6 100644 --- a/configs/imx8mn_bsh_smm_s2_defconfig +++ b/configs/imx8mn_bsh_smm_s2_defconfig @@ -28,7 +28,9 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000 CONFIG_SPL_LOAD_FIT=y CONFIG_SYS_BOOTM_LEN=0x2000000 CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y +CONFIG_FDT_SIMPLEFB=y CONFIG_DEFAULT_FDT_FILE="freescale/imx8mn-bsh-smm-s2.dtb" CONFIG_SYS_CBSIZE=2048 CONFIG_SYS_PBSIZE=2067 @@ -124,6 +126,7 @@ CONFIG_VIDEO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y +CONFIG_VIDEO_DT_SIMPLEFB=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y diff --git a/configs/imx8mn_bsh_smm_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig index b6b62b9d53f9..7ae99adf7fad 100644 --- a/configs/imx8mn_bsh_smm_s2pro_defconfig +++ b/configs/imx8mn_bsh_smm_s2pro_defconfig @@ -29,7 +29,9 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000 CONFIG_SPL_LOAD_FIT=y CONFIG_SYS_BOOTM_LEN=0x2000000 CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y +CONFIG_FDT_SIMPLEFB=y CONFIG_DEFAULT_FDT_FILE="freescale/imx8mn-bsh-smm-s2pro.dtb" CONFIG_SYS_CBSIZE=2048 CONFIG_SYS_PBSIZE=2067 @@ -113,6 +115,7 @@ CONFIG_VIDEO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y +CONFIG_VIDEO_DT_SIMPLEFB=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y From patchwork Fri Sep 13 09:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3494 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D1808411AB for ; Fri, 13 Sep 2024 11:57:34 +0200 (CEST) Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-5365ec02d32sf1779055e87.2 for ; Fri, 13 Sep 2024 02:57:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221454; cv=pass; d=google.com; s=arc-20240605; b=K4snHci2dzlSATBrj6aIDMGPCDkyN7MdvCCTj0Hrb60yqym5KVVDWxLuibTCPpXIvm sYsXsvhzr2zYXRrkv8VpuQ5N323rcxCvA1nPOrDk+Dv7XiJbiQg2R96UIpf/yMhyDMcK UrPEtQr8VYFk4HyfaAVLdQht5zCmSf92p/M26Wb1o3OBY8BhvHTrNknrWqGpHAQqZktq KFycjmg9xdeFZ/RJRsd99qIn638Xrp7tYeOe/bxGMSrpt15DX4s3l4CFUPItmQj2JUPC rJZDhTCqNaPeT15BGqsr9I3u3iauUAtusmlO109dvSgJHpaZC3SqRY0V5Et0KcIpsuak 0zag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=mrlgVycuWIH+DWYvL7wSoDSR1MfMLG5HlSpcTcdFFaY=; fh=lABOxr89pIYBmxcySNo6pUdsaebGf29xNTNfKET/B+c=; b=IRuO/rJKuJGWF/rdV+BBvV8t/n/tWj08weZPk46beNkjUTRqGB3UKeYU7YalTxpAXF Y2KqxBaXJwkKzooFGq4LKCOgfU5zWNBeVdsAVpo5UGcIid5LenhHIkLmHPXIRwuhwwEh 7J03dF0bT3XoezDP/Wk3RakLVCKodDr+n7PuPWs2eQkzmNWF6lepnbvsRz3je4dY1tmQ hpJf/rTg/jDqRi6ZrbrEgPm3EGZU6LTIXDD6XiSSOgCgpkLDsCxdpOyZIAtiFVQmP7hl dVcr2atNjxnXHsgee/pJJAL3La4HAi6fxOvYIZ64XtdsDL+rdczGEqHhuV3IZ2GnIR04 +v5g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IcDa2oTJ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221454; x=1726826254; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mrlgVycuWIH+DWYvL7wSoDSR1MfMLG5HlSpcTcdFFaY=; b=n04dskfW1bT1oolOy7TreXCRqJC5WAl5qcpPNY0VmdokFA+mcn6zqqj6APFNhuAw1s tD6bvJAQKvfNxYBrA22A+nQfBbxIuk9Fh8//6Ciz41BhnWA2fOcUye63CJOq3uVm7ns1 g+ZoN5pDv8aNa5G/ziUdwJh6OY2dlSe+66zb0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221454; x=1726826254; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mrlgVycuWIH+DWYvL7wSoDSR1MfMLG5HlSpcTcdFFaY=; b=svaOuIzoB7ppr2lZRhaCf5BDYBqEr+XLKZ7qJv9HMVbjY/DjQbDGEOvO6NtbyCfa6o Ac5Ov098W5OQFTNlSZuvZsSS8zw+DtaNQaKIVROhm4ewPqFg0Fy8woVy5qyNwuYbO8Km LN1EPcBcDnX52mrrKL3t+yREvPdTB9jjSZwfX7vwXYgx/fJoNzMxys8FWiOFBL7k1pHT sOzEpGJPZWimbQYd06Sb1R+t0kjD72JtN4xAKg4N5P2EcJ4ai32DmY57eXJp5qxhe6+q G0JEPEqcCVPw5uj9kR4gapxPVLjRUIz4LFz97LsdudsD7Oi4aXN4MIQBlf2F38ei1uG/ Y1Fw== X-Forwarded-Encrypted: i=2; AJvYcCU5SbOoiOjdYXS3oVW4WyjbpJ6Gy5S9qKeQXezw7df7tSQzSFQ6i9A/wbVvrxUTEq9UT++MP6Ehu87LAgew@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Ywckli/NqgRh0wneDZX74Ts+z8eQUfp/wCCV6esImpeDnJeMqf4 e14L7MAuxR98RaFem+1cBCZeafIXvBnAAm0jmpHM2FEjzawuvELz4TU1pNfVRXbzJA== X-Google-Smtp-Source: AGHT+IG1kMzGKGCoBxRzQSRE/QfX2fKP5XMkeMZghx3XXcZsLIRyE+B9XpmX1WVjMGe3auh0YZprHg== X-Received: by 2002:a05:6512:3052:b0:52e:768e:4d1f with SMTP id 2adb3069b0e04-53678fcdc2emr3847570e87.36.1726221454107; Fri, 13 Sep 2024 02:57:34 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:acf:b0:52e:9923:a1c2 with SMTP id 2adb3069b0e04-53678f67af0ls7101e87.1.-pod-prod-03-eu; Fri, 13 Sep 2024 02:57:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXaGPkhDM0cBeqA8zt4T5ZRE2sD2FLaUGZoE0p8UC8EplxyuM0EqZrmNmzP6oPfrpBcU4Rn1o2WckdumbtA@amarulasolutions.com X-Received: by 2002:a05:6512:3e17:b0:52c:df3d:4e9d with SMTP id 2adb3069b0e04-53678feb12amr4171880e87.37.1726221452281; Fri, 13 Sep 2024 02:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221452; cv=none; d=google.com; s=arc-20160816; b=qfLM40D2DIV1fAaFsiUnrd0W9uw+86vfTe90hVIjO590V7TlUg3zTk8cNxz9LsiSVX QGtJr37FitEfbcDeddAezY8qMRXQJezYFvoOkT4XkSSiWSxsWP3efPT6MaYnDiiR0PGy 32pHJc4HW1ehUlXPUrqSzxHFWYT80wq8qy7hTGQUc//lt5L8Vt18gNzPLncWPYWNpa4A pdkdU6dSzl+6JsGXx5A7iatMujkLR7JZhsICQgsny+hj7bh22ij0ILSg1BwSs9/FyiH3 Df8q3r2QMY2/d6kso6YD0NUUjlYcQWBPgonewVF7/DCQ20gvh7GU2L9UhovP3xExxopI Ai+w== 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=L7mEd5w5V+Lck0eWh6HqPKgdx4EIxLO43nvUmkqR8js=; fh=nZDgkfZLLKRjFzYAEj+H49oyGsDy3t5oKtmz9KunIG0=; b=t1KjM+80JdEpxcDraZo8m/cZDhLcfgbtZb+CHFFx6bViGNcWfmAy7v5c1m/Vd0eFgJ i6BJ0z4/wU2H91yLAJTE2QZBd2DUqo1X7WjGbOJpHgqTmX1jfGIeBBmB39SgmH0eIs0l sCwf/8gmCio+a32FdvVZL8RMTWb43+QLB0KzuRoX8IZN+yKxmHDZw2X401a/tWfcMFSE 7D2u724ATP/vOd1UnzPUziIc1k/Y1yEhGo6xyEoTH6ATi3vCzIB10wq77DwbKdqRwYkI pLs/Xjd8KcOKuiIGFMYJybscvd+NFLHhWzowjpcotOYMmUeEPwYZdKUScQZT7STTs2iU 4s7w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IcDa2oTJ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a8d25d0156bsor485254966b.20.2024.09.13.02.57.32 for (Google Transport Security); Fri, 13 Sep 2024 02:57:32 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCV+yaZHHe3/aAm+MDTv5dUUEgehiq2ERdUE8/ba9RAHsuIVpyZ0P8YcVfXfh5Dc+T+pfhqmxz5WPQA87WH1@amarulasolutions.com X-Received: by 2002:a17:907:6096:b0:a8b:6ee7:ba26 with SMTP id a640c23a62f3a-a90294a88d5mr595854766b.1.1726221451563; Fri, 13 Sep 2024 02:57:31 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:31 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Marcel Ziswiler , Martyn Welch , Patrick Barsanti , Peng Fan , Sean Anderson , Simon Glass , Svyatoslav Ryhel , Tom Rini Subject: [PATCH 26/26] imx8mn_bsh_smm_s2/pro: add splash screen with BSH logo Date: Fri, 13 Sep 2024 11:56:08 +0200 Message-ID: <20240913095622.72377-27-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IcDa2oTJ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@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: , Display the BSH logo with features VIDEO_LOGO and SPLASH_SCREEN on imx8mn_bsh_smm_s2/pro boards. With CONFIG_SYS_VENDOR = "bsh", the logo bsh.bmp is selected, loaded at the address indicated by splashimage and centered with "splashpos=m,m". Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- configs/imx8mn_bsh_smm_s2_defconfig | 3 +++ configs/imx8mn_bsh_smm_s2pro_defconfig | 3 +++ include/configs/imx8mn_bsh_smm_s2.h | 1 + include/configs/imx8mn_bsh_smm_s2_common.h | 4 ++++ include/configs/imx8mn_bsh_smm_s2pro.h | 1 + tools/logos/bsh.bmp | Bin 0 -> 10644 bytes 6 files changed, 12 insertions(+) create mode 100644 tools/logos/bsh.bmp diff --git a/tools/logos/bsh.bmp b/tools/logos/bsh.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5b6fb1ebd50d70c7f5ce4a51042271e9634d8d81 GIT binary patch literal 10644 zcmeI2eOy%4)_~XQUh}nk@sis0dX-ZAhBT2#Ny(20Qj*A^GBYuaRLsZ-%1<&s((=`` zt{GWmp;?v|R#;eMWQ9c*Rv1NP)bu?~Uz643efB?U;34fOib)pl9$(KWM1C!Wg9lM8-BvOf9ZAE>cQsbmLJrG{B%F1r}XIFOJaNU zmY%VFq-W1Q(yM1*>D{ZJ^y%GS`u2&FetqMmf4@^Du0Nl+0TLfKP)?0MO$MAgNCpl_ zkkbYZmO-Z_O2QyM38%~8gd|BEe1@E!I7E_8A1Y@gCCiXAl4a^3uXKT z*>d6d9Lc`$BFWCaSaNbMk&F0Te9;8Cs(g~Nz#7ig1#EF;7WtUBsNqjD! zlq-`jpCY-FuaGIZQ{{>&)8vXPu9T@$uas%i^5n{CS4rNL)8(qX88ZE2DJYmD*Is*_%$ZXt*UhkEse z==vL^xQI{jjdH^cbLGYx=gHg~=gYjg3uOMhg|cA&LRq+Akt|$TB8wK?Bqb$_<))i% zmc=(Mk((DUktH`Tm8DCT$P*8k@&xoiCf*>Kn0a`%Q( zx%=*Wq_lLS+;h*pvT@_Ra_`3b7}Pkw+fcCfl|>Dvxe^Odfl5yKH}Khiu=zLw4+V zTpoY?33=j)3aO~rDLX5klqYvSB~Ly1v^@3H)AIDwl~P%`OLpygMxJ@*S$X!EDye#Q zx9qOsv->%D?z!jX`RA*py7~oq;e|c2XU~iBBA=QUYow;;C3)$ky|Q=j%kuKeugEK} zyehB0S}V1D_SNo_efwUM*Is*FUVpt#>gwK*H{RGU`}gmcH}}6OZ@u}Jy!BSS)Yl)7 z0|(xgx8Ht8-g)O8dH3CSrQzKMIoNPe4jz0@-g~c68XMo2_uqeCKKS4RX=-Yc51T%e zk3RfJKKkfm`S{~Qa_G<}^2sNkNON< z^3_*g$=6?hE#G|ejePsfxAN_`Uh#Up^4)jeiO=Vg@4x?Ee)!=B`SHge<)}^2;y3$l=3><=0<-mEV5*jnD7$`|rO?AP|s0{`fKL#qVn761XQyeYZN&hg7*9!~8zxr!v2q-=$`Db3oIXQ*C0_m70%k zZOiB|_l_;xy@Yuyg>(+r4J#dK$DUYb9hu?GS2AC0=C`;OF>7U*i-Frk53g`$tq;uZ zG!o3t<9CIbdnllTxid<=DFJQPI^Crey7jnn-Ksluj~-NCY(Tpi7E%YTe_5{FS{NIK z1higDwNTTvo9f?1WB6;H?o?k)K<64Q$fY3PRz0_%Z(5*Bq9*?(RWmh5C+I9K(RJvm z*5;F2JWEbAmaNlk?etG0m!W0q`*(}>?7;zDc|wjZ?-|hYzvZa!9|0{x&nk!BN3<&v zi?p_DKrd$ez-flNR#Q~FiAHOI9_kXbD1r4lK{ONAg1?D+VEME?*2X)uIO9*D*8R&_ z>!JYxt<_v@*TdK~TRoj!-Qk?*fKEks?Q-k!sph$7YAtuWPbDtEIuFOz4!Z82MrRZ{ z2S%XOK$+oCP7_wda}t&^w!L3Kt27z=Qni^et8Gx2Hzx+PFWhMLEwgqEG7(YPDWHw^ zIcD}Te`O62?W7fq8eRDj7|R(icL)i_la<^%3T_*1?iJ82+7`=H*E8y9^Rwb1tBM`X zR%5C|NhHcU26PkL6%d-VU1t-4(b^sRqEB*Wt=4c-hk$0FS+#Mg_2_g6jQKR0(YW5k zb+jRk)H%e=9?1UV&Fn!UY%X!x<{!if_dC|4MWAoPrbP~$c*r<0hc!>tB<-(VI~cuH zNKfaU8tnFI7veoui+B=#eDvsY?Gk0~+7Yy~X<*n|Fyrjx?m;b0M1U8@3gWhHd(qC? z3~eu3^6+RwI}>Y@bT`rC)#-MRMQHcU{?Os_&>?+=0h3} za}~1%#v=AkNK_CnN!Zd(y*CGKB?l}+W(YDKZNuzHVl?A8(FCpOVaEF6QM7v5U&fkA z5t!>4U*AeRC7^{6s~~29O;*r^kJw?n^jtgih*I8UoFdE~-ydvVdqpOqpZwlH1V;(Yv$TT361H-3n$&PKU zbw*=h1kNJHw}nu4LK#M+4MPK2A5JPGHE@m2&gv)og+v0@G}-)+5yJ7RqCE;yDLU4` zDTK2I&O)OzoWlM{g|FIN67-3)s|zwdWSktE0A(E`QyFoyU<6J%{N*7O6L(EmlFLlp zdE_pxv$%FO_7C$2Tl_XB^$npUBUOh~HI!LU%D7J9+UQ#m&fv_M!FbK0qrFK(;sATR zH=cG-e?~x8Fp>zv$$|YNP->w}4WSH0rU}XtW;Vl^ZS3IMW;RZikf+0GX>tZJy6|XA zdh={l{YW`gPZ}H(x0#F>jd>9`s~9h9r4Vt4H407)J7cVUc1>e!c7{_xesFVD-#=UA z)IcdAtXiZ}A#FuV37mQCdvhvTt>Fx^;&`j^;DVr6*s~hOLKtqfb*{-dQE>LdaWYa$ z1X2YW=Y?>Fz^NjxZRSf4Xf}+FT)R1lToJOySmW&eZmkq@!+t1KqsW>1ZBiOfjC?zV zYopO*oe&CnyqNLI`9Y6hjE6CuSTgyIDle5>tqP?QikopFa2o7>%xNW&M|VL|TMMm2 z%lgq~m1c2X#X`4Phs+vc4=0411Lg%SBEvUpH%OVpm7Cv2aoXuX&gM0cZ0?CbvN@oY zLv`uZB*!9F&t|!^%%09ug%qQH_{sQ82I8y^x6922tvqZ!sBt`{Vpee%{uK_Vil;)= z6UoJBF#6Yqld!^OgtW!UQE!@gvpN~GJy(93BZROh5gKT6)@i^Y!g03*HJR!27X@_fAPm)<9v z$j?*``_dq49e zwsYFM`IgxVjX`phR*`l5+7VAmXv-OqZNe7BKRJxmp>_#LfNw1#op zv%<7?Lvj1QBC9*zcsNNt*zM+4p1WVO=$YIO47-fJ+@lD#19aqBxoF*hbhdpO4MgPF zf14+k&C~M^3iiA_uNM7|o@7U!NT_b#NM%;5HS`oK@ue@hC0G4qCzI{WzMSscVze1EnjLb!C5Ur>l%%M^)+JGg`b&HXNcd zspnRkF+K21cU{!VV<(y?*#=9K)XS4Jxwe9g<<-vY>dsWsdxt?WRgTD3TjuQhtX3W?eHXO0T2K6MMAs^4D`2H+{n<|cSrN|R&XKHd8}(cl^pF@ZRdP0S zZifpefjrhm*PhdoZ?Yng%FwwogtHwEwL2u+>2ex3!HLq{oUO)V^r9`qGpp71@*yO4 zE36`B_n;*o(k3EAb=$daFCWffP4l?3c23YQES?1;ff={IrsgStQb5(=zCVaSG5z)Q z5K4vh%8M<_m@9{p!AO*P#=3s;Btm>5isSH>j{e%Ct!YAcB^0;IhBFvWE)|*88G*6_ zeValUJ{X(uC<8t#O+{&H-g2tc{*FeXEZml6+oPraiL(lh?WCc^LaB#hG@5fXgh5uz zbo3P*?N1}Nl)!K@Yj-H7vh+Z4J&eFH`WA*zYM`uU#cV%Jy>F^-FZI9cA^R`f7Qc4J znwSvEDk$Yp>fuj>k`1L1iq#j+ApaF|->z$p_9hF0$=_~=NnbY?Ml}rAzX%kgZ9*%B zXlk}QT-6K7beHSkm@cH0e$jeJ?g;URPGBhB&|l9ES_5YR)+Avk*@4+4C{0i%La{m{ zP^`9A2GP`@ZJ`vSVG@??hY?Heq(gw>dP%knx5m}jO5!Q{bOC zY8=!A&Y>!pCD^wW`%)k#sgJd+<4vZ?J@qhcXHR|$@w(NLSwTCw$HP0Lc2Ki9Q=NKb zEZizqB2|6((ah;&-XxENYb}bvHP$@RN@dSC@E(>oNaX2G>Y@HhgFrV7ISq2G?uOEg z<|zILz$VB&m}iYRC&O)ayYV1>#@~yn2lMn|`!+0I+u3(v+Xe=7Ggd4?L!<4Il!~&R z-C9N6+=htgqF$b>v2Iu}vN+L{MiE~jb~)ou=66!9*w$a<5c9jqsHP~Ezf^B`n3u+#12 z9qvGLF0LQ!yy2e$*{^BTK5exOhSeWV;7R0T*PfZyPwwradrlA5LzXZm-uT+UGjVlA zVAyKXVQ{w+A>JhSn*vtcuQR9~yJ{)gOy#XXSqDFvHqGy{MY5bwgSzpke4N z)%Ly2IxSWo_gjq-IJUlYD1FUYRG2P|Q zU6jQ42D{Zi+^KttiPmaOp?*!$^|s!#dc#S?j9YO|w|;eqMQ0*1sqBRu;&Fx+>k{Ip zTAN0@-(=`vc781p5JiU*$NYgaT2{fljR~<7zNtRv8v3j5_a-*eR6y>pN=z!9&jh}& zXk-@PQkVeY)o^%1zARwT%%rUKC5kkQ(f-73azzHg~Lvs z+0wChW!~-3-8*c>l<)Tc%noN4(fQ^%@=h-l&%7(e9j2dMZRYp6^$oLbw?5z4X-8u?Q~>Gj9nI#uJLVht?L)f0O|90Mxnuv|;Mo7WIQIWej_rg0FL^-p EzX&OIXaE2J literal 0 HcmV?d00001 diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig index 4982b58407c6..b3190945c59c 100644 --- a/configs/imx8mn_bsh_smm_s2_defconfig +++ b/configs/imx8mn_bsh_smm_s2_defconfig @@ -123,10 +123,13 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_VIDEO_LOGO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y diff --git a/configs/imx8mn_bsh_smm_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig index 7ae99adf7fad..db83a326c053 100644 --- a/configs/imx8mn_bsh_smm_s2pro_defconfig +++ b/configs/imx8mn_bsh_smm_s2pro_defconfig @@ -112,10 +112,13 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_VIDEO_LOGO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y diff --git a/include/configs/imx8mn_bsh_smm_s2.h b/include/configs/imx8mn_bsh_smm_s2.h index deeed9c2f582..c8bd55fd3744 100644 --- a/include/configs/imx8mn_bsh_smm_s2.h +++ b/include/configs/imx8mn_bsh_smm_s2.h @@ -38,6 +38,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ MEM_LAYOUT_ENV_SETTINGS \ NANDARGS \ + SPLASH_ENV_SETTINGS \ BOOTENV #define PHYS_SDRAM_SIZE SZ_256M diff --git a/include/configs/imx8mn_bsh_smm_s2_common.h b/include/configs/imx8mn_bsh_smm_s2_common.h index 204fc4b31647..5d6b22e04139 100644 --- a/include/configs/imx8mn_bsh_smm_s2_common.h +++ b/include/configs/imx8mn_bsh_smm_s2_common.h @@ -21,6 +21,10 @@ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_mfg=echo Running fastboot mode; fastboot usb 0\0" \ +#define SPLASH_ENV_SETTINGS \ + "splashimage=0x5bb00000\0" \ + "splashpos=m,m\0" \ + /* Link Definitions */ #define CFG_SYS_INIT_RAM_ADDR 0x40000000 diff --git a/include/configs/imx8mn_bsh_smm_s2pro.h b/include/configs/imx8mn_bsh_smm_s2pro.h index 8619fdde7fdb..dd26e0b885d2 100644 --- a/include/configs/imx8mn_bsh_smm_s2pro.h +++ b/include/configs/imx8mn_bsh_smm_s2pro.h @@ -25,6 +25,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ MEM_LAYOUT_ENV_SETTINGS \ EMMCARGS \ + SPLASH_ENV_SETTINGS \ BOOTENV #define PHYS_SDRAM_SIZE SZ_512M