From patchwork Sat Jul 13 08:45:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3207 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 570A940F45 for ; Sat, 13 Jul 2024 10:45:34 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-57c93227bbesf2631936a12.3 for ; Sat, 13 Jul 2024 01:45:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860334; cv=pass; d=google.com; s=arc-20160816; b=LoFO2T3VE47/nO/5qbGBwQXGzSQ2bLeX97umXVbdd7z3ftwNQeqecECjMUrU7jTEzZ A0mHSMAFb2chim446jgIiwAssIs7cUM3C8RUISNkQQTuHeGDmB1WOES+3wjN13RfLlHl KKYtLWc26ID/7NKFIbsgSbbZ9KNIMpvfQvJCMm1mNsaf7Xb4T/Exz6HOAqgM9FAzNwnZ r4A9W0uBjkme6m8Wo+OwCIiUPS6s1nolxkYyDxD2onWUoptFO3oMJUSqbcFBlfvgE1+V KohQY7xQ3iCsB5EF7FfRr3CI9scByDkohTQAdDBLM1F8iexwkIy2k8FP6Iwewilpk/pQ U4VA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=jIs6Vq7SG1FP+1F7Pt9VcFBRZE72WyIUwXFlmh/9ESc=; fh=Ds5ekb0u2UZWVVAmczgo5Fj7ap/nCnoKqbzqS5h3koU=; b=sHdMiuHUAreSE0httPL8lMxIR+/G/u64l0rZAOIUvrmE5P7lezaCYXs1UOYEtxKq/K MxZKRxtUxU7HnpNhd6r/CsAfiztvjjYgG3c2H3YfOxkS123cl0wwLjkNXQC+V0o/YXgN M4upgUcTMM2hHUUud6/taLBnDK7ZFZdRJebctLKPpdBD49nNJ51OX9JDLcGMHNzPMnMs GO4LyjdH0vTI0ozW6Qiz6ANMmDry7lu2iqN6Gba3C7c0AGJjkfWIozqlKuHGwzddxINl LHarr52zBGQvqwaYIwNICRIymjrZkqaRmGtcPIsFF1sOgmbAqWWW8/bWA7nZtTHc8Kyl Nfrg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MWfruml6; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860334; x=1721465134; 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:message-id:date:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to; bh=jIs6Vq7SG1FP+1F7Pt9VcFBRZE72WyIUwXFlmh/9ESc=; b=nj6NKG6HTZwp46JM26g4NdmTwyqT2TjhNeA1aHRRf6yVqUPOuB7OtwzCrmlSvyoTZf 2QzjzTrQ9AtKH7lu6eAOAMfcdW18h6N5Mct+TXttIabYUbE3YKnwlhmlyYXn9bKyVdq/ Em1LMVrTYSp2QseLc4t9buz69xxTAnb1mN6ho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860334; x=1721465134; 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 :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jIs6Vq7SG1FP+1F7Pt9VcFBRZE72WyIUwXFlmh/9ESc=; b=E+AuCk2gp6ls754mVtq2TXyIe9Wza63wa0RnuiOgRPjPIp7rUNidzR0OX5o3JP6A71 BWwbv6iNL6CjGKhfYjXc4mGV2lvcHnxSIZ6+0Vo3cmiWmf5VBThZQ7LIDKeqM6Y/hI+N GsUFDZprqnxq4/tm3UsC1+ppxduIszp4p/laiKH/cZD4NQbubleJx4r6ryo8dOpQJS9f ykNTbgvm8uDJ+Iee9Pd2fZBrS50a9nShXe3Z+gLZtsKy2ZvRtFZa1duKJAvJjdH4oZez qnDNot1IIlEgyFoxXfZfnln2PDouV++zK+M4G1YQyJskRduI1rppPPJyzTvcMxEp0bH9 GjIw== X-Forwarded-Encrypted: i=2; AJvYcCVq/ZiaXiWpAHkuAD5r89upZCr6LR8lJzGd7yj1yE06tuH7B3odlmzcmrAgTKksgSw8JQIil8H3MH/8l1PWURQAvLjjd81uBHCMNMFg5X4/EHzY6p8uAsNFg8uhtA== X-Gm-Message-State: AOJu0Yx01OMrSax1OBzQUV9MAoWBT14imnRSPIyVVKKhrudACzJZsWIw 3t2pXJt29Fgj0sEzyaUnYV4Td7VMSOHEdb6KxlUEWUycPRqPSwWq2Klf5mLgRzRdgw== X-Google-Smtp-Source: AGHT+IHHm+TDZRglPiiRkLKb6SuE5RVgytQew9CNWxKGx2am4i3JVQsHb2g0wvpJdsNTegdr9JGJ0g== X-Received: by 2002:a05:6402:2114:b0:58c:a94b:9356 with SMTP id 4fb4d7f45d1cf-594baf910e8mr9999918a12.18.1720860333769; Sat, 13 Jul 2024 01:45:33 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:585:2014:4d17 with SMTP id 4fb4d7f45d1cf-59821dad88cls1502935a12.0.-pod-prod-09-eu; Sat, 13 Jul 2024 01:45:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVzR3qmM1VhIZVdcn2BqON25opnHhqqzMsLRXPThYdTBWry6qMUIyV+71aUPyzbC0qnaeixVlYc+2EDhdeqV6QeZ9uPlkrCr97qg9mWYjbxcoZq X-Received: by 2002:a17:907:d90:b0:a77:d773:54e0 with SMTP id a640c23a62f3a-a780b89ea4emr1170564266b.68.1720860331944; Sat, 13 Jul 2024 01:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860331; cv=none; d=google.com; s=arc-20160816; b=Pygm8SSGw0+4yOpj6W6Nj0PAI/2STkFTqvPBudP7xTccN9aKaAuBVN/vNsjvEHhHL7 jILy5grfdGNCT1rL6Pjyd7GbzS4yo2HNNNQrNFz4OMufFLaeVU0UA/j9w++E37t73TPu 2gjvxkzGJo47GPtPmPZ+1jhXR6lzal40GUOyDoErM5vMlfTjv7UtHSk0MgT86I/8luTM juFX+zckvPNdSlWeM2u1OleM9fPJZlHpeWfORXPuO7dPCShTUJCbzeJmMsZHHqgxFPxv xxiTL4BKLepk+/YPEVmi3rvTs0LcVqBP1oOXhtdKTC1LCUvK4hEOjEshugPuAxqOr2ft Nofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=mLFlSS3LOz2z5PbDNHqhhOO8pKuSllLzwO6lu7HBbUw=; fh=P6Gag59oPNPqoNeya0/1dv9MKI/rJeDEfqjhXm61znA=; b=lqpKDlLJp3tWNG360Jpp4k5/GYKI+W36RlN0Tg1p/IA+fZVAT8xpxQNYJCvGV3ChHs t1200/+8/ncRhtZJMLLFmB5T6TDovwzFSUpQivhC1HQAQX0g+wR0SLlb7ZTKf70qBQTW vAEu9qvp3e1DfEyazqcMXm18+C4wv7ogigoU8iOvut/3hxsjceJS9M4E4nyaeqdKfKQ1 s4X1Q1Eq88hDGfXcZhlQZd4HeteJLqvywWh1KH+6tdaeWlqZn2XZHAshMxABaGaesetB LOf2IUpaeJaoYbqnXQL47bKg1zaWepml5nBh07Qgn2W3ckWe421G8sj9DRgWGrUV7/D6 jfmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MWfruml6; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc87eb59sor10557166b.19.2024.07.13.01.45.31 for (Google Transport Security); Sat, 13 Jul 2024 01:45:31 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXgsdhafXfKMZIVm4nDT5i/wo9rN8+9lNFQSM39iiiQ3AkBzbQXTKWoewHf0S3Bo3x0uNhQCNZ/1mKqUTmEDsQOoXORwvNVLCz85j6kQ6CBswBc X-Received: by 2002:a17:907:2d2c:b0:a77:cacf:58b5 with SMTP id a640c23a62f3a-a780b68a364mr1237583266b.1.1720860331281; Sat, 13 Jul 2024 01:45:31 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:30 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Sam Protsenko Subject: [PATCH 01/21] clk: Propagate clk_set_rate() if CLK_SET_PARENT_RATE present for gate and mux Date: Sat, 13 Jul 2024 10:45:06 +0200 Message-ID: <20240713084526.922537-1-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MWfruml6; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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. Cc: Sam Protsenko Signed-off-by: Michael Trimarchi --- 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 bf1c6a93b4..bd0d3d44ac 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 62477e15d2..4feb8e8c82 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 4c832f1a53..d768e5ad2e 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -516,6 +516,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 b8c2e8d531..67c6b23231 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 af23e4f347..1900377edd 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 59f9c241b8..459fa2d15c 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 Sat Jul 13 08:45:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3208 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 8FE6740F88 for ; Sat, 13 Jul 2024 10:45:35 +0200 (CEST) Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a77c6ea022fsf534620066b.1 for ; Sat, 13 Jul 2024 01:45:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860335; cv=pass; d=google.com; s=arc-20160816; b=SevF/U3EtvZfh28GH/7AXQUXhI1MRxlVF0ZhFOQ+TO0GJwxTa5t67WARChVhMKI8Ql GJlJEepWkGeyNJ82WaykjrJoXeY7upugIPCor45C7CSuFCO4vn9ZZWbk4E35B+ztGrVM 2+QTMTW+Oz8YsUUKAid+R1lbj8NXnU3GeSDY4hY5bz5WMf74U88QOm1MGfg3Ddy9RMYr gIfbwG9Bq3CaH+AT5P0CTDCkk/BWYmlwGm5IwodpOCiFFtDbWSZ3WcjKNnAgtnK9ioen 8uDF4qJeFiigYhvIta1mVWMvJis5B+wlmkiOWeUiy/4XfJqG/ILooJlsXyUnGck353/N NkeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=7/5J050ySnLHJQ7KDtfTRML36AUqcRoWHq6EjO2jgUo=; fh=b1Y+K5Ex1mSEkXlUihigzOG51HLIHJ5Yq+HppiLCgyM=; b=vNWxKLFj3gwcqOKXQm7XfpU1BJIm1JLJpCUwx/2h5VUJP/Sx6r9R2Z4Noera1IRP7+ 7Qv+pnzusMVO9ijOPOexm43QnIu7oLEb9yaos2AMajByJD9Ntsp4DiVNuoJIzJs/UvhP 9YQcqvbCGATnhTsvjizs7o9k2U9qgNLLHORbAOGWfwcN901zk7KrLno+nD5Xb4TgHnyA sp1ymdQIH4qmpebdV2XAjO2JuA6bpKAuH2DGpLwGyaWtiNjytRTBaWj7vR6eVsZEqTfz naICCD78uFMmvP6eY7Za6HH6N5QPTJ8Z21eHZQCkN2mPp6K/U5L1cuUtyoTREiF8j0Kp fXMg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XaufhEE0; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860335; x=1721465135; 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=7/5J050ySnLHJQ7KDtfTRML36AUqcRoWHq6EjO2jgUo=; b=m3s6BMcS2sYDj8BGOHymPrInvk3B8wOVv7l1+zZGVrE7eZwgUdd/gULyoEnizNQI86 dNIXvp4LmWJJnLN72usz8QT2QmrGT6wnJpNgfXzaoEaZgeAnUM+IRmgHM+KtMNPUGagw W1PrVDjwefVU3aw7ColpWVU3pXRYpD4EgSVK8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860335; x=1721465135; 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=7/5J050ySnLHJQ7KDtfTRML36AUqcRoWHq6EjO2jgUo=; b=vdn3S3AV4F0gryxB49BfBevObabApysPgh0asxdql3fsTD/o3q5VySMMznMXQXcaY8 7CS5skL5YIpqLIbqpAScPo80zZXyn5ZFCAYIWdnSN1hrvK1EUXl1vKmEyg5+uvDOQBCL mepjwSIXrclLyaMMtSevitUdtOHrL1uVNX0zc40xjrGOAJBooLxZnZPBel1967V/6ano T0okY0c+uN+48vuJi6Ds0Jk71cfPhyBH321xD8IsJGuzvXcwxBmSAaisCCqwGtvEtIrr clWCQV3CtzN6ZUl8lDDLmFIinyYMNs2cyx7xW6cyK5c0pWiKrjFG+lj4B7PKFvRrYyLi Nd8g== X-Forwarded-Encrypted: i=2; AJvYcCXGwbY8p52s83OciRJfH1FclIN7IhoqBsjMRINjRnrBqbR6d4fS60Kr6XL79lbp97JSX+tt8spJ7D1x0p4Qdmkw4nvxDAPGnI4DnVqJ4Plt3/8+QC5moM+hDMzmsQ== X-Gm-Message-State: AOJu0YwyzuJVzHt70p2opAfMsUrW4OG1azJSVxnuUawWIN/8e7Ns/ZH7 cEFOBfPdAVNU1H4HU3cp7jnBgLnVBHIKCiKQskcLmU1v09THVBpUkZiSJHd+OCgTGQ== X-Google-Smtp-Source: AGHT+IGpS8kWuSrPo570q2HV87+JNXliGlUsBxsfj4S5HwRsj8PupOGOOFogg1q8ZcfzGvxFZqcTrQ== X-Received: by 2002:a50:f616:0:b0:57d:40e3:2a71 with SMTP id 4fb4d7f45d1cf-5995e7c9c2bmr4161938a12.6.1720860335145; Sat, 13 Jul 2024 01:45:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c84e:0:b0:583:9e8e:cd8c with SMTP id 4fb4d7f45d1cf-5982622465cls238065a12.1.-pod-prod-00-eu; Sat, 13 Jul 2024 01:45:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUY9kwLA/NoErmAKNTclwguB0bkQkOBMXh9wgZD9faFQEZgYGT6qznwhYZDbAIDwuWXTKXITjPCldD5zz3hAqfdNfbF/eT14o56hYnq7s3JIbrB X-Received: by 2002:a17:906:5ad4:b0:a77:e031:bb86 with SMTP id a640c23a62f3a-a799cc278abmr311204166b.7.1720860333356; Sat, 13 Jul 2024 01:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860333; cv=none; d=google.com; s=arc-20160816; b=i5n8h3C7iSUE0vooauPF/ciVbEx4e7L1MADxf4cqUPaI6nVuVbksHr3Y89NYdeNt+G tRG2KtADJ1ros+PR7XqlQRGgOAOD9KYRFKfS5ks3L5q7zJdLvU2haJStNu3lDJVecgX+ e46N4gwxQ2OU0yA5vEuq/kTeooGSrBaR+J/GU41XPuinOHQg/QuypWMNE6vfVHUGwsWE NcXbCpRosfRnAK8ZrKj9/Jh87BQKhbMu0TMZgUybIFuZFiuEOiI8dv6ZT/HqQJuR/fie bKjE1Q6nQahB7TwzyEvEYz7Y6gtVf1VeB3K325TU6D+X+0oyP0JGW/bnw/+QcU5pyjKC 5Tlg== 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=Yh4v3D3pWHHqrsVDjmkbDuP1IwQL+jZVx5ue+4JboHQ=; fh=BwxKDAqbg6IsjJZPkKZuc7Mt8yFogFJVF8VpIUpJfDc=; b=mDUuBT5NAGz92CJDQFHpjGAxTTJI4FMkBTjApwD5KZuHw6P8jadzPdhkDBkGw5Ft2v US8EeJMore+CeTorqMPOcKWQv3bj8bkOKcIXcWvadV5oCFzAnPhm/P6MIls5uSaT2MVo M2OPHb0HGUaXDR7PMvjQXlrkOgy39+6grT5pKyULjtnKwTo5YHqyGVjBk14awNKFkNYV iA/76tZLkjKN3awYGJ/7yOKtcS0Vleqf6Gh2hPevg4ovrKCnc3O6dHxxUp1AzCSADICG 6p7+A9sgPjxnfcRhQUAFuYJzdsQYk+DOMu+z+q7TKOwv68MsGTIpkbbTY3xUy0TD/XSj QKBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XaufhEE0; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bb632e6csor25587066b.1.2024.07.13.01.45.33 for (Google Transport Security); Sat, 13 Jul 2024 01:45:33 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVpba5KYp4wMMaiQVafMTvHJUEQs9Kr7QDWndjsW7RgStHZaxkHoFaYf9rsHvSGLsH8qKZGxIPo0ZMbiyXXOnSq2XFNGliN8erkaj6bnhOBBBZ+ X-Received: by 2002:a17:907:7d87:b0:a6f:6337:1ad5 with SMTP id a640c23a62f3a-a799d392e8amr454674866b.27.1720860332973; Sat, 13 Jul 2024 01:45:32 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:32 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Marek Vasut Subject: [PATCH 02/21] clk: imx: clk-imx8mn Fix nand and spi clock parent Date: Sat, 13 Jul 2024 10:45:07 +0200 Message-ID: <20240713084526.922537-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XaufhEE0; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 osc_24m is the clock-output-name and not the one that is used as internal name reference from the strcmp. The clock that use osc_24m, will not be able to reparent it as they should. We need anyway register the osc_24m clock fixed factor in the clock tree. Fixes: 710c4ffb890 ("clk: imx: clk-imx8mn add gpmi nand clocks") Fixes: 85b1c11989c ("clk: imx: Add ECSPI to iMX8MN") Cc: Marek Vasut Signed-off-by: Michael Trimarchi --- drivers/clk/imx/clk-imx8mn.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index ed9e16d7c1..bfd1677520 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -57,15 +57,15 @@ static const char *imx8mn_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sy "sys_pll3_out", "sys_pll1_266m", "audio_pll2_out", "sys_pll1_100m", }; #if CONFIG_IS_ENABLED(DM_SPI) -static const char *imx8mn_ecspi1_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m", +static const char *imx8mn_ecspi1_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", }; -static const char *imx8mn_ecspi2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m", +static const char *imx8mn_ecspi2_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", }; -static const char *imx8mn_ecspi3_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m", +static const char *imx8mn_ecspi3_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 @@ -105,7 +105,7 @@ static const char *imx8mn_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sy static const char *imx8mn_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m", "sys_pll2_500m", "audio_pll2_out", "sys_pll1_266m", "sys_pll3_out", "sys_pll1_100m", }; -static const char * const imx8mn_nand_sels[] = {"osc_24m", "sys_pll2_500m", "audio_pll1_out", +static const char * const imx8mn_nand_sels[] = {"clock-osc-24m", "sys_pll2_500m", "audio_pll1_out", "sys_pll1_400m", "audio_pll2_out", "sys_pll3_out", "sys_pll2_250m", "video_pll_out", }; @@ -119,7 +119,9 @@ 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; void __iomem *base; + int ret; base = (void *)ANATOP_BASE_ADDR; @@ -238,6 +240,11 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_SYS_PLL2_1000M, imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1)); + ret = clk_get_by_name(dev, "osc_24m", &osc_24m_clk); + if (ret) + return ret; + clk_dm(IMX8MN_CLK_24M, dev_get_clk_ptr(osc_24m_clk.dev)); + base = dev_read_addr_ptr(dev); if (!base) return -EINVAL; From patchwork Sat Jul 13 08:45:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3209 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 7423940F45 for ; Sat, 13 Jul 2024 10:45:37 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ee90339092sf31849621fa.1 for ; Sat, 13 Jul 2024 01:45:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860337; cv=pass; d=google.com; s=arc-20160816; b=e4BVADhAzDENcmzuHRFlz0J44L2qs2+pV7qPsYRoBsLSiFZDbVYauEjGpitRXM+YW0 q1c8bWTjM/IXoPBIffzE7ZX9EJd0M/YIXNt6ytWAqpyYGZYIt+pNPPvtjOWbKxDiAYPT Tn6LRTI6cWCuZ+kaUS02VOWi/+HUZVDA7l5j0ZiZQlbXIHH1u1aCeUuq4rz93Ap3CAch 0los0I+4u666Ej0dtINbSDmQAtIY/wPLVmcuLgr2gq6orAu/fsd+QVudNuwLsR7Q3W6r Tp9PEQ2kHwcV2qorMWzXI8g5SfRoqednuYxXKaDMT0nS5fYctkJ/9i3ywLdNatUZ/e4m FeKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=scphWvKlhwaHW2PncH3OWX0DxCgnxVCSW49fKLNBVb4=; fh=5s6rCs+2EWenVtI8DEr2CigmBmveAA/DRxOCgkKrTjM=; b=b4UDkHhPNS1f4qDkgFIa9wJT+1QiM83osOFhTF6eOLxPgcD1T3z+XXtOw8ABs6tfmg b6tDV54sJq0UmgMeFLvCp3PqjUvE3VSeRJy9ZWwuy1DC6VoHynIDh62NHcE/nTcf+WY3 g/YUn27rJZCGOEcGxM01hyrj98N8FfMWNZPJGSDV51zi412+SB8tegzd9/4k4NfSHnmc P1s2qmnXDMUX8UNBlpn0F5wPaU1BLfFH2ubqlp/SC3DtV3e39d/5LQGZ7HlwcYMH/e05 VQpvQfsnnLtUFdp11e7NRU5kNxfNkxiNnf6OQ+skiVPhIPsmYooHrxE2bI8W6ujtXxXq XnHA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EH7R+BzG; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860337; x=1721465137; 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=scphWvKlhwaHW2PncH3OWX0DxCgnxVCSW49fKLNBVb4=; b=aEyQ69QNhbmZ5C/FApCykU0bKOYB+UnMQmDtxeUFn1d6XsVG/nF9atZuN7qPzAR8CV JeGqgEFHnb38ie3+EGkhIfLGFozmskpiVC+RhT7wUFkJm39MVT/lH5FnglE/ZKCgcXjb SITaVmTkb8aR5Mnqx+Y6St4uMr3d5QgKGi7lY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860337; x=1721465137; 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=scphWvKlhwaHW2PncH3OWX0DxCgnxVCSW49fKLNBVb4=; b=lYfwoNlSoyeSzGOoOHfrAiK0WyqPGoa2z4NQCmL3MKpBFVqogiFw2TZYoYjGQt3Aev lqMj2+qoR4R8jLIMs2i8arhPYcFW3Kmu0Yp/HUyKMIKxjEkg69PViFbA/dM2yfQMI8wz ull08PXfBAmj7eMIji/DfkZL6nttZZ5yhRQ0B+SWt699ftrDc7Orwmwofy+T0GdvKqsL 11pSbwfrXeONxhV+zLzwKBGpHwVi3shRMIP64fRBIQYFoIDeWMsVulQbEvSP+BAW7tZE +RE2mb15kt0UQb3aw7oVRMxLhzJXnv316hT+6ZziXm9Ne7jUPYonkJy6eRaoWd15U8Ix TPdw== X-Forwarded-Encrypted: i=2; AJvYcCVWatZyfKlmOgEQRZjlFz6AeJ14WLUJaUklYEnXq34+MIbgEr0SNTeRnSS3WHRCimuXKRPuU4Erbthne2GnePE/CZbm2GdgP9j5ufMBEDq8U3XB9q0SJj12gjqfXw== X-Gm-Message-State: AOJu0Yxe0A6eUHPhoUWuqdwa0jW5h7whCqmPjR0iN7eu32MvWT8ApNxr qHzUEOOopy3peQ6FDeqIlAvn4l1dLGIhtjExUkW6j4IWLZWC6n6eLEiNOVutxKm6ktbuiW3yXg= = X-Google-Smtp-Source: AGHT+IEKhRlqDdUyrXVB7kh1cIplEfEpRkJRDgckP07BSPFoXqWVxYPsvnXM/OR2xmo/OcJCK6+AiA== X-Received: by 2002:a2e:9c8b:0:b0:2eb:f472:e7d3 with SMTP id 38308e7fff4ca-2eeb30ba1a2mr88229501fa.6.1720860336694; Sat, 13 Jul 2024 01:45:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4310:b0:599:9c73:c392 with SMTP id 4fb4d7f45d1cf-5999c73c484ls1033139a12.2.-pod-prod-04-eu; Sat, 13 Jul 2024 01:45:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUiUsGT6Ox6HJdh4nCo1POnVkSax8e1oodyXikm2XXpSpsk5mMwJEOUvv8g/FG+lyUiu6oen855hyy9/gCJvGtsPesKMDZa2hkfJgULfr/FSjz0 X-Received: by 2002:a17:907:3f1c:b0:a79:8149:966e with SMTP id a640c23a62f3a-a79814997eamr843468966b.1.1720860334814; Sat, 13 Jul 2024 01:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860334; cv=none; d=google.com; s=arc-20160816; b=w0uaSdMvVlRyTeV/CnjgAqJNFFv8Gq8hWX3hd11mboZZxCG46ajmvOZ8GAQWwkZsL6 B+1WvgsGS9up6RpVSyoMoI02+ZhSvV1Qs8pioBXPtzK/m+EafDmrnccz80IK9GEvhSV3 Y2W+MHS2k0G5w0zZHEQRnKh0hYES5m4Z3LA0A0fX54MXT1A6+6Omgm3B8aqgBm0A3TBi 4YB+IyfPjSH86IAmBwldC0N/fgtdS91yrAMs1ZZITkCG4eq4sHID8mx/jHyhgCr9BsFj S465BNMWfhpE+wB6Cjp2MSj5g0wsZPzO9kiJDZQeoQmHeTMf9SORaWgjn+c/NmdIesrF Xtqg== 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=NeWtkS9gbnw1LCxaD4G1Iqu+SKOGYmscDMuGheSgVMw=; fh=eYUTi2o/M4xXunFCBbVuZHm89jvHoxz08l64e6M6Sp4=; b=W4v2PylE/HvmNK4hqTDHv9cta7ZsAJaZDbdxw7ovhSos9R7yFkJQ6DT5NtghpoWRql Wj6Pq6pv3RpvqCpgaFb1n14sE0zlo6RSyqU9lb+L/3iJ6JPExELkVikeFAowBsbq8c+v FSNSs65xzChsMLP2lApuvVSrSyIxGXTnt3ACHFvuS3jJR4jVA4i5wL3Hcm7PN1nK16WW c73F27/Kh85GKucnNa8/DUihyH/fJMrV1buuKVm37IqszDLUs6IjnMvSlfs6b/kuEZ3B wncN8gKEE4FRvC+mE9YXxTYFg5py8c3kWKUfOZ7LDLksSjip/Krn9JT85+VHUb0MAYqC q06g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EH7R+BzG; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5892b3sor11933466b.4.2024.07.13.01.45.34 for (Google Transport Security); Sat, 13 Jul 2024 01:45:34 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUoHadFJOAl/zpSy+TaI9JWoutPm2EY8z+dNhb7Qg79aaNsVSYnb+xWn3wfcZeRMTRZBMF7eqVxwjvGWz/1G7hYtiBQFy7u0QtmreSe2miywhLD X-Received: by 2002:a17:907:ea1:b0:a72:883f:f3dd with SMTP id a640c23a62f3a-a780b881e1bmr1164230766b.56.1720860334254; Sat, 13 Jul 2024 01:45:34 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:33 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 03/21] clk: imx8mn: Make parent names arrays const pointers Date: Sat, 13 Jul 2024 10:45:08 +0200 Message-ID: <20240713084526.922537-3-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EH7R+BzG; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 arrays containing the mux selectors need to be of const pointer to const char. Signed-off-by: Michael Trimarchi --- drivers/clk/imx/clk-imx8mn.c | 142 ++++++++++++++++++++--------------- 1 file changed, 81 insertions(+), 61 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index bfd1677520..8911e342f1 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -16,106 +16,126 @@ static u32 share_count_nand; -static const char *pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; -static const char *dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", }; -static const char *arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", }; -static const char *sys_pll1_bypass_sels[] = {"sys_pll1", "sys_pll1_ref_sel", }; -static const char *sys_pll2_bypass_sels[] = {"sys_pll2", "sys_pll2_ref_sel", }; -static const char *sys_pll3_bypass_sels[] = {"sys_pll3", "sys_pll3_ref_sel", }; +static const char * const pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; +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", }; +static const char * const sys_pll2_bypass_sels[] = {"sys_pll2", "sys_pll2_ref_sel", }; +static const char * const sys_pll3_bypass_sels[] = {"sys_pll3", "sys_pll3_ref_sel", }; -static const char *imx8mn_a53_sels[] = {"clock-osc-24m", "arm_pll_out", "sys_pll2_500m", "sys_pll2_1000m", - "sys_pll1_800m", "sys_pll1_400m", "audio_pll1_out", "sys_pll3_out", }; +static const char * const imx8mn_a53_sels[] = {"clock-osc-24m", "arm_pll_out", "sys_pll2_500m", + "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", + "audio_pll1_out", "sys_pll3_out", }; -static const char *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_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 *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", }; +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", }; #ifndef CONFIG_SPL_BUILD -static const char *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_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 *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 *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", }; +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", }; #endif -static const char *imx8mn_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_200m", - "sys_pll1_133m", "sys_pll3_out", "sys_pll2_250m", "audio_pll1_out", }; +static const char * const imx8mn_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", + "sys_pll2_200m", "sys_pll1_133m", "sys_pll3_out", + "sys_pll2_250m", "audio_pll1_out", }; static const char * const imx8mn_usb_bus_sels[] = {"clock-osc-24m", "sys_pll2_500m", "sys_pll1_800m", - "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", - "clk_ext4", "audio_pll2_out", }; + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext4", "audio_pll2_out", }; -static const char *imx8mn_usdhc1_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", "sys_pll2_500m", - "sys_pll3_out", "sys_pll1_266m", "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mn_usdhc1_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_out", "sys_pll1_100m", }; -static const char *imx8mn_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", "sys_pll2_500m", - "sys_pll3_out", "sys_pll1_266m", "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mn_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_out", "sys_pll1_100m", }; #if CONFIG_IS_ENABLED(DM_SPI) -static const char *imx8mn_ecspi1_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", }; +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", + "sys_pll2_250m", "audio_pll2_out", }; -static const char *imx8mn_ecspi2_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", }; +static const char * const imx8mn_ecspi2_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", }; -static const char *imx8mn_ecspi3_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", }; +static const char * const imx8mn_ecspi3_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 *imx8mn_i2c1_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mn_i2c1_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mn_i2c2_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mn_i2c2_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mn_i2c3_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mn_i2c3_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mn_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mn_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll_out", + "audio_pll2_out", "sys_pll1_133m", }; #ifndef CONFIG_SPL_BUILD -static const char *imx8mn_pwm1_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext1", "sys_pll1_80m", "video_pll_out", }; +static const char * const imx8mn_pwm1_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext1", + "sys_pll1_80m", "video_pll_out", }; -static const char *imx8mn_pwm2_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext1", "sys_pll1_80m", "video_pll_out", }; +static const char * const imx8mn_pwm2_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext1", + "sys_pll1_80m", "video_pll_out", }; -static const char *imx8mn_pwm3_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext2", "sys_pll1_80m", "video_pll_out", }; +static const char * const imx8mn_pwm3_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext2", + "sys_pll1_80m", "video_pll_out", }; -static const char *imx8mn_pwm4_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext2", "sys_pll1_80m", "video_pll_out", }; +static const char * const imx8mn_pwm4_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext2", + "sys_pll1_80m", "video_pll_out", }; #endif -static const char *imx8mn_wdog_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_160m", "m7_alt_pll", - "sys_pll2_125m", "sys_pll3_out", "sys_pll1_80m", "sys_pll2_166m", }; +static const char * const imx8mn_wdog_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_160m", + "m7_alt_pll", "sys_pll2_125m", "sys_pll3_out", + "sys_pll1_80m", "sys_pll2_166m", }; -static const char *imx8mn_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", "sys_pll2_500m", - "sys_pll3_out", "sys_pll1_266m", "audio_pll2_clk", "sys_pll1_100m", }; +static const char * const imx8mn_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_clk", "sys_pll1_100m", }; -static const char *imx8mn_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m", "sys_pll2_500m", - "audio_pll2_out", "sys_pll1_266m", "sys_pll3_out", "sys_pll1_100m", }; +static const char * const imx8mn_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m", + "sys_pll2_500m", "audio_pll2_out", "sys_pll1_266m", + "sys_pll3_out", "sys_pll1_100m", }; static const char * const imx8mn_nand_sels[] = {"clock-osc-24m", "sys_pll2_500m", "audio_pll1_out", "sys_pll1_400m", "audio_pll2_out", "sys_pll3_out", "sys_pll2_250m", "video_pll_out", }; static const char * const imx8mn_usb_core_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", - "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", - "clk_ext3", "audio_pll2_out", }; + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext3", "audio_pll2_out", }; static const char * const imx8mn_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", - "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", - "clk_ext3", "audio_pll2_out", }; + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext3", "audio_pll2_out", }; static int imx8mn_clk_probe(struct udevice *dev) { From patchwork Sat Jul 13 08:45:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3210 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 E3A4340F45 for ; Sat, 13 Jul 2024 10:45:38 +0200 (CEST) Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a77df0dc240sf259932466b.3 for ; Sat, 13 Jul 2024 01:45:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860338; cv=pass; d=google.com; s=arc-20160816; b=qFdRziCdZ2wBXabIkEGMvY8gFbAfyNw5kL9H8/fVT8AgLc1/5u8LKlKx5rLHpGWVCx 68S+ERt98nkwz/kTBf6pxz7BfqoVv8E2Mew1bp613OqsVnc1v2gu0T+v3oDJw3myiE8a h/XiikuahYORuy8VN6H6V8hNpIBlvhPzo2moKKDXuZHqVSuuKHyAysM09fjxQ9d2v1bF leHg3uA/GXGX8+9x9UKTFA7HCkGhCw0XfS16jSaF20JEIjjC9pH+Askdpn/Ggo9yvw1g rN3JYLLaq2jHrwlsJWKfqou8HQFDGN7Pz//Jw2s1woPb1OBly8Qb6RF0Th+C/+4+AIMf 37LQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=98nLGDFvK3d3pl6lAZ5SJvFCIhQhD2uRZo8TGAUefS8=; fh=sW94HaKfADH9Gxrr49uVb9HacCojpoYaYmkzHoc5VYs=; b=r3dAKzB6zRgHBezqifuRb2W7BZO8XIPGpEkXuewEfagQMhuMrUigUuGGQpo4RQJf7C GwE23jbOjESOEkXuum4nbSouJVEMzipKQ7S0HBRvgDemJJP72HphzU+buRbg3G09ZsS6 u4EJIjQOmF16/xi29rCtbRDtTs1ogsgZgkpWX/RaauSn0nSEE81D29ER35XaXI/6tKHI pGQy7yHC9y0c4cH4cqAIxtXki/w9dYW8QdPYQHXQSRIHzcG2epPuA6t2P8dLHnBR7XAu Vf3RnUFaT0izfg78PafYbtHn0fMiK3QK7v4olZwBC4pthB+qj5E/6hdXLwFjwU3CDrPb +Gjw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGCOxL3y; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860338; x=1721465138; 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=98nLGDFvK3d3pl6lAZ5SJvFCIhQhD2uRZo8TGAUefS8=; b=GMAF39ZayYDFdf9ylhAmE5c5lj9WHhxV4nAMpfRcr+i0L4y8h8/9lMetrS7mFBhnj0 DAL9D1aKBzBuacCJ3JSKB9blsh6+YVI9tLFYJ9z7dlwVPE2jBvGXSsChnQkUfmyYgtSz +47ETmz0cuI872AgDluFayF2RBB/vKImP5tTQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860338; x=1721465138; 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=98nLGDFvK3d3pl6lAZ5SJvFCIhQhD2uRZo8TGAUefS8=; b=vQuZF1sy5aZs4sOy3y9FbBCs8hl5IchA/Fl+LyUtasXR8nVLpWxboIaxDiIUuxVKT2 WPx2+Z28+9KlcGq5YZL+XX5hiGC73ONK6CA+5J/BJt04SrLDiy8vocN1AUw4gD6LqqUL cwBFtI2VZ4gXxN2tevA0xHUO1M1gCI6pGdY2p1e8Hw6tLPDEbEA5c9uZVx9aelZhNj8w 8BVGYyDWhA1zAqbSCUbPfg3QFfgHRPdVWBCozBH6cbIL3Ht3KdqPqKILcJqEpKGqMZd7 rWTLmgYFKn6TMwouboxFMTBav/GhEH/7Mg4mmS9Wb4rH9WGfqdyNXoLVhFqGq/isl2x/ xsTw== X-Forwarded-Encrypted: i=2; AJvYcCVfKhoTelaIDaoWW05IjUp72E230+ea7JdTH3iRgEGlM8ud5CpoyvvDWJ33GucEnSiNDtQwYz94aYaXzBGjDzBAu5bljZc4VMwVkmpH8phcYPqFrfNoalsR9v4t1g== X-Gm-Message-State: AOJu0Yx2X25RZwDnc7arHUKFzhHLc65rkcbfeBOMqxgCb7UwxZ8sujNa 8nIE+S2KAy3U8PbXCsqQsp+ShQJysB+ASITrGpUmFzxgJJxyuNKrqYpa0X7dxm/4wQ== X-Google-Smtp-Source: AGHT+IH1FW7WuPbG2cDECzzcRiLjganJhjBJiA47w3smgEJNN3stKus3ICcwsS1LmLzwemzbXvIsxQ== X-Received: by 2002:a50:8e59:0:b0:58e:11e:4e3a with SMTP id 4fb4d7f45d1cf-594bb56aa0bmr8129390a12.18.1720860338623; Sat, 13 Jul 2024 01:45:38 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:32e:b0:58b:ce37:ebce with SMTP id 4fb4d7f45d1cf-59825c4211els1025241a12.1.-pod-prod-03-eu; Sat, 13 Jul 2024 01:45:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDwCM0/oSu0yqt2mNbNglEHeIsIUs0xbf0lBkNDxJzREoUn5dQMkWjqNoJwnx/brTxL4EF9M7bYc7gsE2/OGXKExFspmZQe/RmL7pncxNMGzfn X-Received: by 2002:a17:906:c149:b0:a75:3c31:4f58 with SMTP id a640c23a62f3a-a780b6b3b67mr1086302066b.32.1720860336866; Sat, 13 Jul 2024 01:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860336; cv=none; d=google.com; s=arc-20160816; b=zYfWDU7eZ8IGb40G2DWnafJsBh/yqT46r5tMyCKbtggGB8m+JuuqHSPy5NHBqIaiOw fu817rHKejDmEXozLB02NqhWNYkkI0oSW6Eya4hNusEPgtzZIq4JR+xy4qSyZU3eqTy1 wY9E3arujFt/12dch9+eQhUm9zo4RFdsuJXaOTjDAN6o4fE1S8lZM9NGJM0H9ntw8DWu cFtnRpUx8dti4qzQVOcqQ3Y9DVMGq0R9VHBjaXQaQ1OrQLDXsbVCUqM2U2J2ZXiRcgGi fiJI7GlauEmevIGYtDCBDTjia+cPZw9/lBjZGSU/TB5pxFgfshn/08KFvKeg7u8KeXJ5 oOZg== 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=buiSbQzLP0gfv4iQQlsY8tHFLp+E5GR4KdSjucy5p3E=; fh=m42N7sxPSDBUdi/1RTYHaTU99xzcDFdlkDyLTJ9rfrM=; b=YzMPECwB64YuplvSvAQGkXN1mx7qlEVS8C+pJc4ALJlOjqvvrnarQDN2ITHu1L9cr7 aEnhOOTemKxCV2kXKZjfS9sy6/lvAlDvv4EO0isvb5SX/P6UgveXmUd7yF26XOsqrTey FedqK5ZMhEyukFmA4YTu0n3gqWMOIHDspCKLoAFj309GyIddYS8QSJJ71Fjkw1dnLgd3 098sj/CkDyr/KYZicJ+i00BR4Kf4+KL9m7itHiBB77B1EAfuFPEm7aK/kL1nwKVbN70h ZIlI0Kq04ovvl0e7CWfUnGxA4N/QMU3gcsr2GRGxUsOHkSdoWAfS8OmyariYFz/zbSZo FPcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGCOxL3y; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc7cf0cdsor14267266b.16.2024.07.13.01.45.36 for (Google Transport Security); Sat, 13 Jul 2024 01:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXOiWWBGcxsq3E7CFlkzaSmsLSyj/8ejmvH0FHxfc9BGYjw3WQOII/2tVn7bvd7Urx/RLSsKddNtBjAI1j6QE+tUGHNnsM9Kls93vTg3Z6+N6p+ X-Received: by 2002:a17:907:1759:b0:a6f:4bf2:daa2 with SMTP id a640c23a62f3a-a780b68a8a3mr898250166b.15.1720860336244; Sat, 13 Jul 2024 01:45:36 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:35 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 04/21] clk: imx8mm: Make parent names arrays const pointers Date: Sat, 13 Jul 2024 10:45:09 +0200 Message-ID: <20240713084526.922537-4-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGCOxL3y; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 arrays containing the mux selectors need to be of const pointer to const char. Signed-off-by: Michael Trimarchi --- drivers/clk/imx/clk-imx8mm.c | 157 +++++++++++++++++++++-------------- 1 file changed, 93 insertions(+), 64 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c index 70e2e53bde..e538f047b3 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -14,108 +14,137 @@ #include "clk.h" -static const char *pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; -static const char *dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", }; -static const char *arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", }; -static const char *sys_pll1_bypass_sels[] = {"sys_pll1", "sys_pll1_ref_sel", }; -static const char *sys_pll2_bypass_sels[] = {"sys_pll2", "sys_pll2_ref_sel", }; -static const char *sys_pll3_bypass_sels[] = {"sys_pll3", "sys_pll3_ref_sel", }; +static const char * const pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; +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", }; +static const char * const sys_pll2_bypass_sels[] = {"sys_pll2", "sys_pll2_ref_sel", }; +static const char * const sys_pll3_bypass_sels[] = {"sys_pll3", "sys_pll3_ref_sel", }; -static const char *imx8mm_a53_sels[] = {"clock-osc-24m", "arm_pll_out", "sys_pll2_500m", "sys_pll2_1000m", - "sys_pll1_800m", "sys_pll1_400m", "audio_pll1_out", "sys_pll3_out", }; +static const char * const imx8mm_a53_sels[] = {"clock-osc-24m", "arm_pll_out", "sys_pll2_500m", + "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", + "audio_pll1_out", "sys_pll3_out", }; -static const char *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", }; +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 *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", }; +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", }; -static const char *imx8mm_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", "sys_pll2_100m", - "sys_pll1_160m", "audio_pll1_out", "video_pll1_out", "clk_ext4", }; +static const char * const imx8mm_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", + "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", + "video_pll1_out", "clk_ext4", }; -static const char *imx8mm_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", "clk_ext1", "clk_ext2", - "clk_ext3", "clk_ext4", "video_pll1_out", }; +static const char * const imx8mm_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", + "clk_ext1", "clk_ext2", "clk_ext3", + "clk_ext4", "video_pll1_out", }; -static const char *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_enet_phy_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", + "sys_pll2_200m", "sys_pll2_500m", "video_pll1_out", + "audio_pll2_out", }; #endif -static const char *imx8mm_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_200m", - "sys_pll1_133m", "sys_pll3_out", "sys_pll2_250m", "audio_pll1_out", }; +static const char * const imx8mm_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", + "sys_pll2_200m", "sys_pll1_133m", "sys_pll3_out", + "sys_pll2_250m", "audio_pll1_out", }; -static const char *imx8mm_usb_bus_sels[] = {"clock-osc-24m", "sys_pll2_500m", "sys_pll1_800m", "sys_pll2_100m", - "sys_pll2_200m", "clk_ext2", "clk_ext4", "audio_pll2_out", }; +static const char * const imx8mm_usb_bus_sels[] = {"clock-osc-24m", "sys_pll2_500m", "sys_pll1_800m", + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext4", "audio_pll2_out", }; -static const char *imx8mm_usdhc1_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", "sys_pll2_500m", - "sys_pll3_out", "sys_pll1_266m", "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mm_usdhc1_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_out", "sys_pll1_100m", }; -static const char *imx8mm_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", "sys_pll2_500m", - "sys_pll3_out", "sys_pll1_266m", "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mm_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_out", "sys_pll1_100m", }; -static const char *imx8mm_i2c1_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll1_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mm_i2c1_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mm_i2c2_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll1_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mm_i2c2_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mm_i2c3_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll1_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mm_i2c3_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mm_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", "sys_pll3_out", "audio_pll1_out", - "video_pll1_out", "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mm_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; #if CONFIG_IS_ENABLED(PCIE_DW_IMX) -static const char *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_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 *imx8mm_pcie1_phy_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll2_500m", "clk_ext1", "clk_ext2", - "clk_ext3", "clk_ext4", "sys_pll1_400m", }; +static const char * const imx8mm_pcie1_phy_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll2_500m", + "clk_ext1", "clk_ext2", "clk_ext3", + "clk_ext4", "sys_pll1_400m", }; -static const char *imx8mm_pcie1_aux_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll2_50m", "sys_pll3_out", - "sys_pll2_100m", "sys_pll1_80m", "sys_pll1_160m", "sys_pll1_200m", }; +static const char * const imx8mm_pcie1_aux_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll2_50m", + "sys_pll3_out", "sys_pll2_100m", "sys_pll1_80m", + "sys_pll1_160m", "sys_pll1_200m", }; #endif #ifndef CONFIG_SPL_BUILD -static const char *imx8mm_pwm1_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext1", "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mm_pwm1_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext1", + "sys_pll1_80m", "video_pll1_out", }; -static const char *imx8mm_pwm2_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext1", "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mm_pwm2_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext1", + "sys_pll1_80m", "video_pll1_out", }; -static const char *imx8mm_pwm3_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext2", "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mm_pwm3_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext2", + "sys_pll1_80m", "video_pll1_out", }; -static const char *imx8mm_pwm4_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", "sys_pll1_40m", - "sys_pll3_out", "clk_ext2", "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mm_pwm4_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext2", + "sys_pll1_80m", "video_pll1_out", }; #endif -static const char *imx8mm_wdog_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_160m", "vpu_pll_out", - "sys_pll2_125m", "sys_pll3_out", "sys_pll1_80m", "sys_pll2_166m", }; +static const char * const imx8mm_wdog_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_160m", + "vpu_pll_out", "sys_pll2_125m", "sys_pll3_out", + "sys_pll1_80m", "sys_pll2_166m", }; -static const char *imx8mm_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", "sys_pll2_500m", - "sys_pll3_out", "sys_pll1_266m", "audio_pll2_clk", "sys_pll1_100m", }; +static const char * const imx8mm_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_clk", "sys_pll1_100m", }; #if CONFIG_IS_ENABLED(NXP_FSPI) -static const char *imx8mm_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m", "sys_pll2_500m", - "audio_pll2_out", "sys_pll1_266m", "sys_pll3_out", "sys_pll1_100m", }; +static const char * const imx8mm_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m", + "sys_pll2_500m", "audio_pll2_out", "sys_pll1_266m", + "sys_pll3_out", "sys_pll1_100m", }; #endif -static const char *imx8mm_usb_core_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", "sys_pll2_100m", - "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; +static const char * const imx8mm_usb_core_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext3", "audio_pll2_out", }; -static const char *imx8mm_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", "sys_pll2_100m", - "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; +static const char * const imx8mm_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext3", "audio_pll2_out", }; #if CONFIG_IS_ENABLED(DM_SPI) -static const char *imx8mm_ecspi1_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", }; +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", + "sys_pll2_250m", "audio_pll2_out", }; -static const char *imx8mm_ecspi2_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", }; +static const char * const imx8mm_ecspi2_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", }; -static const char *imx8mm_ecspi3_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", }; +static const char * const imx8mm_ecspi3_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 int imx8mm_clk_probe(struct udevice *dev) From patchwork Sat Jul 13 08:45:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3211 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 6E3F640F45 for ; Sat, 13 Jul 2024 10:45:42 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58e66895fd5sf2187548a12.0 for ; Sat, 13 Jul 2024 01:45:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860342; cv=pass; d=google.com; s=arc-20160816; b=sNYbLhOOqjr1FLtJDbetbnFr2p86WKc+GufqHRUKUovPrperT6fbxpIkv7I1MEpvYS Io9c3adk79SkE8WYzi5WhkiVbP919XLjy4aymg4DBnXfO9HZfX6RwQKlMccV8FGDZz+r mNZgvHDKPBhwDX3TZCxwm30QOvSxKNtCDZdf7RoL3ZQ1rDRvnKhycsZ0XmErVps7uvvb T1JQX5D9/grb+ZDZdyvrlW8HHu8cKdI6Wn4dTexXeFNedM/np7DCX0I1i+zoTtDWPNfy 7JU+vah3YhgigqKgZhuaVJQeY8U1qgmyat7lSmyro7+vML2cDv/vS7v9hCug2/ATqkO5 dyag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=K0qzmPR7VV+OMpuFjP9BPZ9GPA94hBDeSRKP8Ov2y+g=; fh=B4BRhENShi+hjNXD22fDcsrctsR5eEYKzDet/ycw7tU=; b=cpPVJK6oysQH+u5hnPDdjgVmnBYXmqghOIpE4Nmos1MK3AwONgTPZj4RtQYf/Ja9d8 7pGeZ7Glj+NfgfcKdRKl8ONSdJSFmBoFW9eEDwZZLoAIwUPck0YAydLCWJXvF2s3QiWK sjwpxJyXtyQfpnHFDDtwYeG/dIV3b023L8vCMm02ImXjxiT86NpM5LsjPJ74UhXQXaf9 7kPwj9UyFWYJCO2O77AtbfXdXdBiwYLQiPr1OUG0wiiCq47j/XAOIHZTJh0egxwkFP07 ZNRJSg1lRDuHZ4WxCIV2mE2X8vPFtHk36tLrvhfKERoZrgVIaWiKMTB2G2GsTdlVb3NG VJHw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XJdpnsBm; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860342; x=1721465142; 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=K0qzmPR7VV+OMpuFjP9BPZ9GPA94hBDeSRKP8Ov2y+g=; b=bKei5o9BPp2XbGDx4/vTM7gO86HPI2HBWWQwkv3D3Wsu5Jzs6Prsryl1FBKMsp75QZ Gru5emGq78CSdkUcB7NddipmHfoouJOy9RQBWy+xrfrb2pmjg2S5WL7ju/PSnRaNPjro f7sD4IuojSV/mrjv8cegDs1YuStr/7teeGy7o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860342; x=1721465142; 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=K0qzmPR7VV+OMpuFjP9BPZ9GPA94hBDeSRKP8Ov2y+g=; b=EHnP+cvRfIDiEeOq3C/b7trQyh5zYE81ZfhHS2gFGaB5NVQHJ4IhQYNJylYTr4632k 44lHLYK4wb2RrG7ZbAipIl0j8t+fXYdsTwPyqGKoe8Rgdd3RCrrvQ00BHnHDmPTXJ/7v mbGLPizDT0z1ib5r0Ld2PqEClEL6NwMaqp14R2lSNGGWtcG5j3D8ebhraGgJaFQ4uEpz vwplJUaMVyXbcX4B6Bl/g4THzdFXx4iVPAIbWU8Bb0jky6ptvsXHiF9/7EtZHPpHYT0R AVtSvCC5BZ/9Cw34OK3XF/bWx2TNHMVwEl9Yptup1BP77POBzfQ3s1G6BBiMYPPU+0qa SVIg== X-Forwarded-Encrypted: i=2; AJvYcCWmQQ3uEB269U2eRIWi6vlU9jHU5GbbbPiVP3dNZ0ujhppTLUa6mQrREdLLmOHpQ6l5lQD2QTbKNlvII+NmPDZaXA8EYs3bOpblAl2cZ+mpwXnW2+MwAj6T477Jyw== X-Gm-Message-State: AOJu0Yw4Elq1PL5VZPLEIkLZKaOETI+hRbRW0sOCEe3R6xQMKuJuj5kv OZIVM0P/HTrQyrN04MiTOs8lYmU9ivArdzJf/B4hh+LhxbBZVzDDNGR2HsO+TTTyUg== X-Google-Smtp-Source: AGHT+IHEjX3vM4YcXduSOy0VXasEDyXWnhxkfQ/dnYlF28liK+Daciy0/QQtzf97+LA4rY3tg805Sw== X-Received: by 2002:a05:6402:2684:b0:58c:95eb:e59e with SMTP id 4fb4d7f45d1cf-594bcab126amr10031288a12.39.1720860342064; Sat, 13 Jul 2024 01:45:42 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c513:0:b0:57a:a655:87db with SMTP id 4fb4d7f45d1cf-5982622e1b5ls1360978a12.1.-pod-prod-09-eu; Sat, 13 Jul 2024 01:45:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXexwoHY3HZvSw6Xnsy47glA4nH7GiiiPWUAy1eTetc1yVm3QnDjuCaz7FWbGUwNSvFuFnWAjYN+WmFjP4QCJzDzmL6VMAFbQ3lbZFyyV3BX4/n X-Received: by 2002:a17:907:60d4:b0:a77:e0ed:8bc with SMTP id a640c23a62f3a-a780b68a411mr1179720566b.4.1720860340303; Sat, 13 Jul 2024 01:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860340; cv=none; d=google.com; s=arc-20160816; b=NL/tio5d2P4+De87Z570KsbevjrJiaphW1noy2/9gy8tdqO9xrP0CX+Hs5p44CC47y Rm8pvnTvzJLGW9fc/rO7RiDsCKmU0HnBVfyFFgk/m4Poz3f3xpy8C497ZiBD5PHJnp+g yi1XIZef0bW0U0an7rHHb5GbabtzewuqEnTkGfgvnJAKAkEU8Hi5DBhbSTFPGjQiC3B8 9teY6urDtHD+8F7fZR1FOdFXlExDfDDD4+O/11a6gwk5M2T+a53UXqnRRAkBLfU718zD u9P4Zzs82BuzWhrEQMScDxx++DQhdvCfDAoyBm8ygCRSUeoz1vj/l2FTz2D5mWyZ9K2u N2vA== 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=QX5kacvy5aDw93Qbo6FzNpAxa7xLxA+iAJoBrMTOwto=; fh=SwK1vWE6lIUVizmB5iDhPD32ZC1uxu+Y7fdHHRZgSn0=; b=UUv/4tjLTFwctJkKkxDtyc4Zl8E/JDubwZbhPQy0BV+UWebK75i4DX8Dnfv9CQHnCw rBEpXfzfq/K/XAdOyuSn9NOYtyfbem3lMxsNr+VHLKEpSLCWZ67Ahnd5e/6lHY9oV239 VAQD/+s/06zMRvxb0w8mLHXmVJbof5ktu5yZf8Wm5I1+m1VH1skkm3OeebPi6jSitTci uu3I9Rd1XxOAUGE0sp+7FNXQ8ZuJ34Ggp0oBSphyGMZ7G7ti4kKc5YWcYWZKBQTLnfRd h4IAir5TFuTccQFJzx1ZU3R+X9LyS/SoIKwRC1Z4nUh9/jBrqt6l+ZtgU7cNm6CQmosI z4BA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XJdpnsBm; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc7ff95asor11554166b.11.2024.07.13.01.45.40 for (Google Transport Security); Sat, 13 Jul 2024 01:45:40 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXYvyRH+CHsLLETrFdE4DYOXzblecN5AF4pu5VtHS9oJ/yfdyIOalSn7bo5HfaIQA3pfFMIlEzGRj9mwmUpWVRm+YmWOX4ln/OB778NMHguHND6 X-Received: by 2002:a17:906:2bc5:b0:a77:aebc:8fb1 with SMTP id a640c23a62f3a-a780b6b1befmr849354466b.17.1720860338809; Sat, 13 Jul 2024 01:45:38 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:38 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 05/21] clk: imx8mp: Make parent names arrays const pointers Date: Sat, 13 Jul 2024 10:45:10 +0200 Message-ID: <20240713084526.922537-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XJdpnsBm; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 arrays containing the mux selectors need to be of const pointer to const char. Signed-off-by: Michael Trimarchi --- drivers/clk/imx/clk-imx8mp.c | 242 +++++++++++++++++------------------ 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c index 1f498b6ba4..6b18483c81 100644 --- a/drivers/clk/imx/clk-imx8mp.c +++ b/drivers/clk/imx/clk-imx8mp.c @@ -14,178 +14,178 @@ #include "clk.h" -static const char *pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; -static const char *dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", }; -static const char *arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", }; -static const char *sys_pll1_bypass_sels[] = {"sys_pll1", "sys_pll1_ref_sel", }; -static const char *sys_pll2_bypass_sels[] = {"sys_pll2", "sys_pll2_ref_sel", }; -static const char *sys_pll3_bypass_sels[] = {"sys_pll3", "sys_pll3_ref_sel", }; +static const char * const pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; +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", }; +static const char * const sys_pll2_bypass_sels[] = {"sys_pll2", "sys_pll2_ref_sel", }; +static const char * const sys_pll3_bypass_sels[] = {"sys_pll3", "sys_pll3_ref_sel", }; -static const char *imx8mp_a53_sels[] = {"clock-osc-24m", "arm_pll_out", "sys_pll2_500m", - "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", - "audio_pll1_out", "sys_pll3_out", }; +static const char * const imx8mp_a53_sels[] = {"clock-osc-24m", "arm_pll_out", "sys_pll2_500m", + "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", + "audio_pll1_out", "sys_pll3_out", }; -static const char *imx8mp_hsio_axi_sels[] = {"clock-osc-24m", "sys_pll2_500m", "sys_pll1_800m", - "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", - "clk_ext4", "audio_pll2_out", }; +static const char * const imx8mp_hsio_axi_sels[] = {"clock-osc-24m", "sys_pll2_500m", "sys_pll1_800m", + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext4", "audio_pll2_out", }; -static const char *imx8mp_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 imx8mp_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 *imx8mp_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", }; +static const char * const imx8mp_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", }; -static const char *imx8mp_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", - "sys_pll2_200m", "sys_pll1_133m", "sys_pll3_out", - "sys_pll2_250m", "audio_pll1_out", }; +static const char * const imx8mp_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", + "sys_pll2_200m", "sys_pll1_133m", "sys_pll3_out", + "sys_pll2_250m", "audio_pll1_out", }; -static const char *imx8mp_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 imx8mp_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 *imx8mp_noc_io_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 imx8mp_noc_io_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 *imx8mp_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", }; +static const char * const imx8mp_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", }; -static const char *imx8mp_dram_alt_sels[] = {"clock-osc-24m", "sys_pll1_800m", "sys_pll1_100m", - "sys_pll2_500m", "sys_pll2_1000m", "sys_pll3_out", - "audio_pll1_out", "sys_pll1_266m", }; +static const char * const imx8mp_dram_alt_sels[] = {"clock-osc-24m", "sys_pll1_800m", "sys_pll1_100m", + "sys_pll2_500m", "sys_pll2_1000m", "sys_pll3_out", + "audio_pll1_out", "sys_pll1_266m", }; -static const char *imx8mp_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", }; +static const char * const imx8mp_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", }; static const char * const imx8mp_pcie_aux_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll2_50m", "sys_pll3_out", "sys_pll2_100m", "sys_pll1_80m", "sys_pll1_160m", "sys_pll1_200m", }; -static const char *imx8mp_i2c5_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", - "sys_pll3_out", "audio_pll1_out", "video_pll1_out", - "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mp_i2c5_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mp_i2c6_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", - "sys_pll3_out", "audio_pll1_out", "video_pll1_out", - "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mp_i2c6_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mp_enet_qos_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", - "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", - "video_pll1_out", "clk_ext4", }; +static const char * const imx8mp_enet_qos_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", + "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", + "video_pll1_out", "clk_ext4", }; -static const char *imx8mp_enet_qos_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", - "clk_ext1", "clk_ext2", "clk_ext3", - "clk_ext4", "video_pll1_out", }; +static const char * const imx8mp_enet_qos_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", + "clk_ext1", "clk_ext2", "clk_ext3", + "clk_ext4", "video_pll1_out", }; -static const char *imx8mp_usdhc1_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", - "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", - "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mp_usdhc1_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_out", "sys_pll1_100m", }; -static const char *imx8mp_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", - "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", - "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mp_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_out", "sys_pll1_100m", }; -static const char *imx8mp_i2c1_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", - "sys_pll3_out", "audio_pll1_out", "video_pll1_out", - "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mp_i2c1_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mp_i2c2_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", - "sys_pll3_out", "audio_pll1_out", "video_pll1_out", - "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mp_i2c2_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mp_i2c3_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", - "sys_pll3_out", "audio_pll1_out", "video_pll1_out", - "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mp_i2c3_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mp_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", - "sys_pll3_out", "audio_pll1_out", "video_pll1_out", - "audio_pll2_out", "sys_pll1_133m", }; +static const char * const imx8mp_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m", + "sys_pll3_out", "audio_pll1_out", "video_pll1_out", + "audio_pll2_out", "sys_pll1_133m", }; -static const char *imx8mp_uart1_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", - "sys_pll2_100m", "sys_pll3_out", "clk_ext2", - "clk_ext4", "audio_pll2_out", }; +static const char * const imx8mp_uart1_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", + "sys_pll2_100m", "sys_pll3_out", "clk_ext2", + "clk_ext4", "audio_pll2_out", }; -static const char *imx8mp_uart2_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", - "sys_pll2_100m", "sys_pll3_out", "clk_ext2", - "clk_ext3", "audio_pll2_out", }; - -static const char *imx8mp_uart3_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", - "sys_pll2_100m", "sys_pll3_out", "clk_ext2", - "clk_ext4", "audio_pll2_out", }; +static const char * const imx8mp_uart2_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", + "sys_pll2_100m", "sys_pll3_out", "clk_ext2", + "clk_ext3", "audio_pll2_out", }; -static const char *imx8mp_uart4_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", - "sys_pll2_100m", "sys_pll3_out", "clk_ext2", - "clk_ext3", "audio_pll2_out", }; +static const char * const imx8mp_uart3_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", + "sys_pll2_100m", "sys_pll3_out", "clk_ext2", + "clk_ext4", "audio_pll2_out", }; -static const char *imx8mp_usb_core_ref_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", - "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", +static const char * const imx8mp_uart4_sels[] = {"clock-osc-24m", "sys_pll1_80m", "sys_pll2_200m", + "sys_pll2_100m", "sys_pll3_out", "clk_ext2", "clk_ext3", "audio_pll2_out", }; -static const char *imx8mp_usb_phy_ref_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", - "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", - "clk_ext3", "audio_pll2_out", }; +static const char * const imx8mp_usb_core_ref_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext3", "audio_pll2_out", }; + +static const char * const imx8mp_usb_phy_ref_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", + "clk_ext3", "audio_pll2_out", }; -static const char *imx8mp_gic_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", - "sys_pll2_100m", "sys_pll1_800m", - "sys_pll2_500m", "clk_ext4", "audio_pll2_out" }; +static const char * const imx8mp_gic_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll1_800m", + "sys_pll2_500m", "clk_ext4", "audio_pll2_out" }; -static const char *imx8mp_pwm1_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", - "sys_pll1_40m", "sys_pll3_out", "clk_ext1", - "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mp_pwm1_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext1", + "sys_pll1_80m", "video_pll1_out", }; -static const char *imx8mp_pwm2_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", - "sys_pll1_40m", "sys_pll3_out", "clk_ext1", - "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mp_pwm2_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext1", + "sys_pll1_80m", "video_pll1_out", }; -static const char *imx8mp_pwm3_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", - "sys_pll1_40m", "sys_pll3_out", "clk_ext2", - "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mp_pwm3_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext2", + "sys_pll1_80m", "video_pll1_out", }; -static const char *imx8mp_pwm4_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", - "sys_pll1_40m", "sys_pll3_out", "clk_ext2", - "sys_pll1_80m", "video_pll1_out", }; +static const char * const imx8mp_pwm4_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m", + "sys_pll1_40m", "sys_pll3_out", "clk_ext2", + "sys_pll1_80m", "video_pll1_out", }; -static const char *imx8mp_ecspi1_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", +static const char * const imx8mp_ecspi1_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", }; -static const char *imx8mp_ecspi2_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", +static const char * const imx8mp_ecspi2_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", }; -static const char *imx8mp_ecspi3_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", +static const char * const imx8mp_ecspi3_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", }; -static const char *imx8mp_wdog_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_160m", - "vpu_pll_out", "sys_pll2_125m", "sys_pll3_out", - "sys_pll1_80m", "sys_pll2_166m" }; +static const char * const imx8mp_wdog_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_160m", + "vpu_pll_out", "sys_pll2_125m", "sys_pll3_out", + "sys_pll1_80m", "sys_pll2_166m" }; -static const char *imx8mp_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m", - "sys_pll2_500m", "audio_pll2_out", "sys_pll1_266m", - "sys_pll3_out", "sys_pll1_100m", }; +static const char * const imx8mp_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m", + "sys_pll2_500m", "audio_pll2_out", "sys_pll1_266m", + "sys_pll3_out", "sys_pll1_100m", }; -static const char *imx8mp_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", - "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", - "audio_pll2_out", "sys_pll1_100m", }; +static const char * const imx8mp_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m", + "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m", + "audio_pll2_out", "sys_pll1_100m", }; -static const char *imx8mp_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", - "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", - "video_pll1_out", "clk_ext4", }; +static const char * const imx8mp_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", + "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", + "video_pll1_out", "clk_ext4", }; -static const char *imx8mp_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", - "clk_ext1", "clk_ext2", "clk_ext3", - "clk_ext4", "video_pll1_out", }; +static const char * const imx8mp_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", + "clk_ext1", "clk_ext2", "clk_ext3", + "clk_ext4", "video_pll1_out", }; -static const char *imx8mp_enet_phy_ref_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", - "sys_pll2_200m", "sys_pll2_500m", "audio_pll1_out", - "video_pll1_out", "audio_pll2_out", }; +static const char * const imx8mp_enet_phy_ref_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", + "sys_pll2_200m", "sys_pll2_500m", "audio_pll1_out", + "video_pll1_out", "audio_pll2_out", }; -static const char *imx8mp_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; +static const char * const imx8mp_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; static int imx8mp_clk_probe(struct udevice *dev) { From patchwork Sat Jul 13 08:45:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3212 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 4527740F45 for ; Sat, 13 Jul 2024 10:45:44 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ee87e69b53sf26565481fa.0 for ; Sat, 13 Jul 2024 01:45:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860343; cv=pass; d=google.com; s=arc-20160816; b=Wke1aILSaN5WG3H+Keke83wKF9DYSpYvLnSIMcrz/a7RdfxmeYYGgJfsKbv4AU8lpi NhQmD69M+qJLT864vd2CAj9oGMz3yEy9+DLMSXyetKYDUr3J5Sg4Khajix0evGgZ4HAS 1UDplAmbYmm40Hi05IUVXaWTQZ4c+2563J5ue3HnnS7F1RChoUDa1dXpUYpp3HwMBYnV zmyPAy6CfZdv1pupSYPnHPH3mv2xJm4+2LhLNSApIB+bP4CapLd5IbjUuSIMWo+EQIGo GoMoskXB9N5ur4J1/xmtGKuEzIROJnAP2WoIMEInzZNNewlv3lihHEkYAVxraAdn5Q6s p5IA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=8qdnLrivdNrFXhMAk0C0fqqSnCxd9xDXvPRaNC72H18=; fh=FgUx06f5TVMCyoRlgj5LEkFfn0QBmmkQZDV7oUjTNh8=; b=DU5d44HNEOFQ5hWs6IdaQHu2BzOX5MyxF1h4GbGOAXziqM1OL8inOjfAJaPpst9OkM uG+aYQ1gQCG7rZmTBtlFl+rZ+aeuPAunbHFG78D5yBfdkGjAu46BjNdFCIP0r2D4OhqN cEZ2q4rPOTNQybPPqqInTUHq52d4nWtZLljcQtg1rNmeuxbgney6tYvnNSi0zxH02I0I FveoMPdZ4/CQFa7OabXdvvupVPWcZ+k0dtVI4hAk8viBNBdm04+aeKTNMBrKs2jkyz0H q0RHpjItOQLk5nVV2CAlszLVx3qQ20eNLpNPDpwPM8NPn9/0bpT0d9oGsLyG8G3MF6lI MQiQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Rmm41dXe; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860343; x=1721465143; 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=8qdnLrivdNrFXhMAk0C0fqqSnCxd9xDXvPRaNC72H18=; b=MZuliUFAXnCLvJlxIN2OhzNlM6N6/UeYV5rBnifNsRT4eexOp3nZ+88zwEdsffPuc2 1MoJ9KL6HiFm3pPsEVG4iYWdAnsHdxElGrmsToQ3nBuRPexYLjSkC0Vo4uzRKkFqef8k Pw4U5tuiXOjzTR69aj4oFWJQjAJt6nYHRoFfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860343; x=1721465143; 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=8qdnLrivdNrFXhMAk0C0fqqSnCxd9xDXvPRaNC72H18=; b=kOpaXsvQBkH+rErp2WjNXjEcK0YubTra9iYoOuLgNY+YdXkUbHSWzKd/zE65wtGozM 6rZYr56Pdpno0sQWxPoLuytWJrjMuqG9DQmSFc4qwXsEft0yycicMNSfsq5sikFpv3GA LCFvrEkf5SdshByYL41+UHo4AE9kIQBDeSqhY2Hk8Kaxn8L1dPSaMch56hI0k8J4CXmV NmaxhuXHLXKgsilQ/Iv1Z+UDBD491vfsiKB3t4Qth0pOlm4RAvOKfrz/XYNpLQoZmFuS 52H8h+ixjHZMs8Rk4g3hpw7ErkU37I9JPMc67CGm7fIqJr/R0vWNQuvMovmf+rry/hmm DSSA== X-Forwarded-Encrypted: i=2; AJvYcCUclsGPIoroA0eCHJfeEi9aPQkzagS1PtEDZ3F2MhRVTDrxszPBe2CzF//cXaRwWsoFCgAI5mhMyDwD+k0OknOBluaO+sukajZad3xj61KAGoXGW7FbCvEpQx7vpw== X-Gm-Message-State: AOJu0YzNPVuzTkXrIW+0YypwhpnKrCvGa+R2sNJ4uyFzOCTQtw6666HU oFSLN2/63qbrZyfXzQ78DUcbNoRmonSiks5cwAjE7cIDxfKlL7IOUumCwfrjI6f/Ag== X-Google-Smtp-Source: AGHT+IG7XZKZh818aaI5yNOW1aEavRB+OsmMiX5/jsDgsDE0YieDprTpocAltQzfEBQP4vRy3O80SQ== X-Received: by 2002:a2e:99c8:0:b0:2ec:a022:880c with SMTP id 38308e7fff4ca-2eeb30e4669mr116220241fa.22.1720860343538; Sat, 13 Jul 2024 01:45:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a2e:b527:0:b0:2ec:4f80:327a with SMTP id 38308e7fff4ca-2eec8d9e150ls14370311fa.0.-pod-prod-05-eu; Sat, 13 Jul 2024 01:45:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3xJX+/tEgRk8pN41SK6dUWtitMG51+5L50PqTPN1gfNJBF6Wokf9hk0fqXNDJe0ss7sKqjJIRyaOSwCyFdMRz5zdyhBsIpkL0JOu4UfM99ti7 X-Received: by 2002:a2e:830c:0:b0:2ea:e74c:40a2 with SMTP id 38308e7fff4ca-2eeb30e5025mr101121471fa.20.1720860341498; Sat, 13 Jul 2024 01:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860341; cv=none; d=google.com; s=arc-20160816; b=h9zyetc+kZLjnftihPSf3m2NW9Now1DPkgeCZUu8Uo/aijtLtLZOyNnxSqqz4lyqGG 9RPfyAXYVw+Xaq5jbHx43SG+2LidabeuiWaZNsAVc4tdQh76OGlVmSS8qG+rJUFyn41C NgDVYmQJpwVeSSuc8ad7LuW4Kq4rOtN1AvV83MnndJINO35jUV8kCGIxkyHjC0rB4PIL thik5IZzzQNgtOmohW++E5+FbOBtd5czTZexu4+6mHFOlxbxojf0NjexFlNkmT/v/y1q WnldkAKw2kRq+qtA877rysDOmFFWhm6ma5jdkujgqmfDeKe+SYVmdhYKLoHdrqK3pOca xZ9g== 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=VP9KqOTtJ/8Wr2y0b8PuGdr0YGsfHTaxYMfqijnhSv8=; fh=4xkDntNBOxLGVOGhnoIYpgaSX2OBvPePY18RRH4BIlI=; b=MXbB6s9dlWLjpw3w75aftUR7K0pq8hMnHwWNkbY7Uhpcmggrp48WlBhEADL00+fU1P V2uShkta1lNvz1J7dyAFJVKMS6Kh64wxM6yuXY3DfAq+Jjhbzkdnxhe0n+5QlTRm+U5H 0eOZZ7vc4NwhuJTsfB4AwZ+wwX0PhZzAKXDjsi72ioTxf7WxX9hWBAOTZuJyaVrpL4qM Cqhw9sohU/50jirGEIVnQvq2RmILs7avVz4mDOAyQLuUl+2Ffs/T/YIN2MROSns6xWXg z6OJ2oLKyzoyLttVZpNz4u9q3RY3F49wxELRvCcf6xb78lxZIu0/ePX4l24he4i/85J3 /m5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Rmm41dXe; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 38308e7fff4ca-2eee179d7e4sor1520871fa.2.2024.07.13.01.45.41 for (Google Transport Security); Sat, 13 Jul 2024 01:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWLMw/PMN0+OtH95jvIR5GAiOuOOmp5OqnaFYOUhGZXKRCsbmtal3k3DlhL64jSem0MU2fnT48GlDI7sIU5Gu5ZrjYLO9FGZyp5YzEl7Gh2n1g8 X-Received: by 2002:a2e:97cb:0:b0:2ee:7a54:3b14 with SMTP id 38308e7fff4ca-2eeb30bb388mr115288891fa.7.1720860340953; Sat, 13 Jul 2024 01:45:40 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:40 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 06/21] clk: imx8mn: Prevent clock critical path from disabling during reparent and set_rate Date: Sat, 13 Jul 2024 10:45:11 +0200 Message-ID: <20240713084526.922537-6-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Rmm41dXe; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- drivers/clk/imx/clk-imx8mn.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 8911e342f1..e089012477 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -27,10 +27,18 @@ 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", }; @@ -65,6 +73,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", @@ -284,15 +295,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, @@ -387,7 +401,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 Sat Jul 13 08:45:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3213 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 C913540F45 for ; Sat, 13 Jul 2024 10:45:45 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58b92b79a46sf4774610a12.0 for ; Sat, 13 Jul 2024 01:45:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860345; cv=pass; d=google.com; s=arc-20160816; b=lF7+dc8pRiC3Zz1PkHPIOr/g9+lbvwgsvP9srUxEdiP9kwHNKXPnixtI0MnxGB3oB8 huqfUivfncX42cZj4SxnNDhJwbKj0vHIlRa22da7wureA1aJHMCBPHkpkFrfJ2wsynkc 2+LW5RBZ6QikNh9pvGQi+5FQ1bfQ3ywto/Z+xYbS7nJAN6pFV1/XUWJspfpBdC9LHcYf 5sm2NwgHqmt0hylGGPlumrdwZBoLyKIvosQGya/ftuho2XT4dvuBxSiigV7cLzMYJ3rA NPyr5CYTY0xe/i8X/q9hCodhJ9ug83fHWpued/A2252Ec27yzZbbpaJUxcZQNTAvK0pS FQSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=chNxDfO3ru0vE/ex6/6kVvGPM0MfBdG7mbFIksUbpjk=; fh=5TuJ+EX9pHQA0NMoNA9POzhWHKBFOndcMV3wyubjoV8=; b=NetpAcrskZL3enSEhy2BUE7uwG2r5yRyro8fJpEJaOFtNLJK8nxqbf/Yj9INesqTum ZYGfOTuhy5FraqEH86V7h6mE/p0oT+cky7f3Z6e7p4OKxpKcGXV76d3Ymr67MCBV7WJl J8Mq8RF5Gc9ZDYX2tK4O2hSwS3JKByttGoWKMeS3ZCK3aq20BCfUJDETpWA2htXzJcPp IMZwLItTUVHE9po+uHOiy46Ev1h2D85PJCpqiL7gJ/2ldBTZG/xpJ4HTZPqgmbsdgamI /aLGan/MJM+V25wYSkpdwaCZu0lcmCFiTQ2z8PUuQ+EoVNJZuHWE+EUvMbDFmHC8BzpC 3Djg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jkx1E+XW; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860345; x=1721465145; 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=chNxDfO3ru0vE/ex6/6kVvGPM0MfBdG7mbFIksUbpjk=; b=JHGodQFO1Zl/EpYM76ZFY3Mg+WSSogW0OPCxkZa6vgZUFfcl3t0a20E8clzoAhpmCT uc+tZEQ2OORAH3w+l3JvoOfdB0HTKp/SQgxSL2AO0n5fDIHk939ufbteWQ6SGmhBTLp5 JDBdRmy+1L1vmgSzGukvxqfUOCUSSN2IBZGDk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860345; x=1721465145; 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=chNxDfO3ru0vE/ex6/6kVvGPM0MfBdG7mbFIksUbpjk=; b=uxJs+6o/efFFgn7GQGgsnDGq5WTW/rT/oCgeIbYUKO2fdXayuyI1NQQM7m/t9xlsIg uxFiAaXVWKOfBEv2L2QFC2DnWNKIg6zElUq5CQekee9fWBq50ZTbUTjhYQHAIS2twIlR qsG2Rzy4NxqeCAAzG6Unh8b+6X98zGt7LiPdT3lMnSc3DZV4T0EPNJVQNSPlH4iHve7d x1YFq4nuX+U+mD31ll3AVLohN30XhmQkNaxevQlSbghkuY9XlP9a/Y5x0kkaUCT6iiOC Rqxm98wkJXDRe6VEnt++qxBX330LF4nZKCZhXbhhO/RAUn8Yvep7OlJSOC0C7KeuWt1J OvUQ== X-Forwarded-Encrypted: i=2; AJvYcCX9dbr91fWX7iOZuVvzcxS1MMN5DpHFa8EEy7RLkXrTGGAVqnbYZJ5fCmHEx36c+RrowctZEQUFCyk3soBTmLPoLexC5jvRLx2op0XsQt/DI1L8XwvNp8gBljIMBA== X-Gm-Message-State: AOJu0YxGZLymaNxpQK8NbvD8CMbbUxCgCh9QuIqS2oBRDoMbnpM/+5TZ inR+xer6gWQBjIDLCV9NRZ5pc7SL+q6iNJySynbVm4wUw+NoMzV3Lff0L0y1rKhhdQ== X-Google-Smtp-Source: AGHT+IF236umqZ2b5nLGOyszX++9QtNaL3O3Hn77QsECErWbbBjNIX74Fan1d6tNC9qGTEtjiJucuQ== X-Received: by 2002:a50:d4d6:0:b0:595:7779:1f7 with SMTP id 4fb4d7f45d1cf-59960008613mr3333049a12.16.1720860345482; Sat, 13 Jul 2024 01:45:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:1766:62e9 with SMTP id 4fb4d7f45d1cf-5982661bbbdls309758a12.2.-pod-prod-00-eu; Sat, 13 Jul 2024 01:45:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWu9aZHIh3ntXtj317o4D30CaHCNcOGrhD73XSllgetuod/9PrHlVJx5KYxr0s6LXLyrPlVxxuqcepjLIJKXuyFiQVpbKKLi8HY6mBDDfp6g/r1 X-Received: by 2002:a17:907:846:b0:a77:f5fc:cb61 with SMTP id a640c23a62f3a-a799cd67784mr472184466b.0.1720860343749; Sat, 13 Jul 2024 01:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860343; cv=none; d=google.com; s=arc-20160816; b=PWNKSMdhvqVNn7vu5RUVfdiQBQnSU+C0bPOJQ1f8S+QJ+3s9DM1a+TrDE6l3nQi8oy bqr+RNxquzn/q64YpafDFNcoePeVpfHBTc0Xg+iSV+wyVw0A+NbRn1NAdCSv4Ekvc+wM /bZrbsmXhv5xVAIwpYVv00w3F1vNmelv4/r98DgDZeJvZKjXrPiKnY8VEzhCEVr436V3 onhswwe6ElHN34+kIE7Qu17VDf37hYsACNAhJu+FRrMbrxcEbM8x46eJ6/Qkbn2vcwaD sm9DUQ1f4qIReFLr4BAdJkjl93PF08ZDrqVrvElQOr8rUut7XGm8dYLd9VvRRlAWugNO d/Zg== 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=LC/8L7NUGYg45ARL2mO02nABwby5f4t+d+oF9CPd4v8=; fh=B/pluHHsDZ9uJPUtsY1TlBCJu4umNQ0UwwjNPLntG24=; b=OsSQ5uUA1oqjJ/vvpmgwWqr2GsNFYEDxpC6943ZXk1bPlGhunSDy8tW1HpYju5QPSo VYFgi4i8sm/lJi2BZ8ALxANTNiorrt2GILdIzrYW2y+oWErtzchsRaWfJzaJvsNuAMzV Cxdt3Sho1u5t/M9Hn2c/RjVlfpZ70aJSvqZS3gD4t9gO4nelr6BRKsJoQgQ1fqCWSrKO sRB0d8lSuhYDMQkQEImm5sH3/8OC7o2grTylVXyJ9eflEbDm9YJ48huxpoQDogWdMlva ljHuMtZVd36ay1mUziiqUVI2D/oo5s3+iBJOC4Db2eFwFg+qf5rRl6LXxYnMARlLKe6H 4RpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jkx1E+XW; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bb77f073sor19125566b.8.2024.07.13.01.45.43 for (Google Transport Security); Sat, 13 Jul 2024 01:45:43 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCW4n9z3UxBMF8dfkH6MyW+6JE+e6UcOX//IcwZU3GM4qCSubyKZhoYHrgQuh+5QZSnUGIV2M2IOaiD1M4XEHkccAx8a0FuugRqRRYKXgNgjca9F X-Received: by 2002:a17:906:c083:b0:a77:a1f1:cfa0 with SMTP id a640c23a62f3a-a799d3a5aaamr341425966b.36.1720860342371; Sat, 13 Jul 2024 01:45:42 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:41 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 07/21] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Sat, 13 Jul 2024 10:45:12 +0200 Message-ID: <20240713084526.922537-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jkx1E+XW; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- drivers/clk/imx/clk-imx8mm.c | 58 ++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c index e538f047b3..685e7df0e5 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -25,11 +25,23 @@ 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", }; @@ -45,6 +57,10 @@ 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", @@ -133,6 +149,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", @@ -281,18 +301,30 @@ 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)); - clk_dm(IMX8MM_CLK_NAND_USDHC_BUS, - 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)); +#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, base + 0x8900)); + + clk_dm(IMX8MM_CLK_USB_BUS, imx8m_clk_composite("usb_bus", + imx8mm_usb_bus_sels, base + 0x8b80)); /* IP */ #if CONFIG_IS_ENABLED(PCIE_DW_IMX) @@ -356,9 +388,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)); @@ -394,6 +423,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 Sat Jul 13 08:45:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3214 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 E29C840F45 for ; Sat, 13 Jul 2024 10:45:46 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-57d3eca4bb7sf3939544a12.1 for ; Sat, 13 Jul 2024 01:45:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860346; cv=pass; d=google.com; s=arc-20160816; b=ip1ZYQvnDGACCwFSl/23b4V1aYXOod+0+ScTtISt8fLiFlwbQvnYvdPH5MJuUDMIv6 GVik3cKgZJzAJqQfr0m5qg8wj4mcTm9grAA4xPNn7s4L1vdWV/0FyfHIAvOfDVUIyIlB FmdOHYrXfFB5dsRMnjN51ByRhFq9xUts+lFQ7FRTPeZPOcMwWrw34WovaBELkrpv2Auk eP410epnDDxvaDLQh7h8/3m/CmKTROl2ofUoYMFSmc7kpdwASNkLVSRPUAZZKUtpur6S SKBgwru9OSJ388bnFcN91xQ4NbZhdHVNsXptn/WhFBa/9KJpSyCF+iZdjnw438zKIept XthA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=knY4D99gkaJx4Ut/tHtwX71I9JGiN7dVwVq0Jqes/jo=; fh=s6rLb60hAMJx7KrZWquIlpJ9OpzbpqsdOC+6aMSzYTQ=; b=hAxnEYBShy8ZcvESpuASCV6nLTCKBDDGCBAkPoNxISQBrcZEZXk4uSwb7w19DW62j5 OCDju6KZgQVEVwiAdMRO16NTLmw32GqizHBsSqZA+tBlunkIfRo2T/4w1CttBpw4024V vkLdQUmuWUr/7v0Kp3ti8mIVmq7v2bVAXTVKfzF+wVoLRQUNnMEIjwzCyLPJ6Ms6uUAh EDEt1Tw5IxhDtYzLtVKZOx9htDMVTT/XAnRwUIbqkSyzfgmlvS5/XBxcVA4ARJUIj6c8 14XlxtIiWjjRfxfqJOCkgdcCoBAOhE5pLSZathGEB8hAiEiSTHSUQMFwAnzqzJskHL72 PaQA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cLeLCfVg; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860346; x=1721465146; 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=knY4D99gkaJx4Ut/tHtwX71I9JGiN7dVwVq0Jqes/jo=; b=UCk55lVjq65xpnRFqV0UjhC98gWlNzA3XsNu+47c4n719ZewzrsmF+HBYVnBpJoO4m FREAlF/VgtpD4c56UPQa/w8dKlN+px6L1O18XZB91/WTm9yEbwm1gmJ25seuLYPrHPY7 cvMNxkdKnml6oXJ7UtIp8AIp72ZE5an8QXnIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860346; x=1721465146; 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=knY4D99gkaJx4Ut/tHtwX71I9JGiN7dVwVq0Jqes/jo=; b=ObMQMXxrdKq1NR2BTtNsk208YbrKmO2DKw3V2CRgof1ZQ3IJ3MM0PWWMVwhqqEWFqO uqRU7h2beUHGBR0QJqq9z5IB6nPomTkc4m9ZxC94Tq3LLtt2dP8pRT6JEZNy+d+xSe3H RDa5ES7nYoknWPYHGnQyKEFJIHKieKB1UWBC+7GLvz/J0XPbQ26fmNV7ApnJlt+xJbLs 75rQVmecQdH0EsFxdGWAbUwKxaNxDPol+EECx4ZQD2irYUHrD3B7MdhvGVnF5ywopy67 LawV4tgufuxC4FRqrBQrRGpMfl91/8qdUMj9MSSu5QcGKX0Z9hdSEwTYh4h762vQHXwT VxBg== X-Forwarded-Encrypted: i=2; AJvYcCVwYXjYwnQbP0WGs2IVf6GLV6QDTwgVXR1zUQ7LRqMzMkSw9lZZ62oVByvBkWOLjqofTA+4RK9Op1dQ2J4Zmmlxtur67dXppsGybJzp1w4/UsDuj+yvVgifwx1oMw== X-Gm-Message-State: AOJu0YznASABPmRYl94qt9b3tUK/8H6JbZHiDNYVTRRVbCUm0y1e7K6l LlokXXLQ9sTA7gFQl/bxsipZyRR8X8zAqBWFpQ6mvYGMud0Z7MDnS405fxqGgv4JfA== X-Google-Smtp-Source: AGHT+IHbhgLVXAISlaMPNkeLfR9SVMJxqZhNFbpBFz9+qeo67fcIoozq2dsDVMFDFfKFc+Q3MP+olQ== X-Received: by 2002:a05:6402:34d5:b0:57c:7f3a:6c81 with SMTP id 4fb4d7f45d1cf-599642c3368mr4405094a12.8.1720860346557; Sat, 13 Jul 2024 01:45:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c84e:0:b0:583:9e8e:cd8c with SMTP id 4fb4d7f45d1cf-5982622465cls238085a12.1.-pod-prod-00-eu; Sat, 13 Jul 2024 01:45:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUDWrMXAE6VGPXHpRXULnkzF0DFwB7VJhkGCUGQin20grqud8BzKol8A3CRtt1xiiKMc/3I5giFrXezJpXdKjQ5GUg7nHI+K3gy5kG5oBTi6sfT X-Received: by 2002:a17:907:7f14:b0:a77:db04:8ceb with SMTP id a640c23a62f3a-a799cc6ab6cmr484477066b.19.1720860344931; Sat, 13 Jul 2024 01:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860344; cv=none; d=google.com; s=arc-20160816; b=ke6LRoalKhfwjvhqOuqksqGuTVSmt7eDS5vzOWcaPMEsNFszWU+s35dfDWspJ2qB7Y RfHGkMEOKhXMBy43tTpKT86rcQLtQQ8Goo01jlUUzhO6rrFRtmBARwnh6nuhB6IfSiJ2 Dzs6B6SbKxjuxFuK5uRdnxBGTlEfzzX5Ntj0hkbp0OXHqNb3iFY+76sAbIPmeOrjHPIu OPcQeaEdawG+cth1Jg9g+v8tGSIJtXyVaCHrtUI1De7pc+j0YUR+93R1K+/9KL4kGxGg 9t8tO1KEE2a6oQyr1/5ZTKn/Vopq32I904VKdU7gFrnNs/G+RUgiSEseNjlRxb+twm/T 3lEA== 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=foWmJWDioSf02GceU1FIQIyZLcR6DFpqNRRaCaq36Ls=; fh=JdvExH7dJhxLyhv9DCalmioomCM9DAPRDwahTLtixsA=; b=L7m155ULI5qWZUOCU6amC50rQDBGtS5C/L2VZ1oDKBlaVkVI8xGr8wmi1JUsdaO2YS YwElCezmhVZwHo8yiuci7Ckh8RtRtwQpKMQI//mIu0RgLsj9USQ2mSVgEZOQWFUHcwD0 3mMlooFX31haw9epRs9NqsYTjlDKDTviBS01zPi3wGezodi8RHvB/a9Ju7/uzcd2Ll/5 5k2PnIonUuDgT+2FsvUP2UDS64uitrc0HSMgUIVbRrrxh6MLrMHLMzwNdiu4xPTiocYc od/r/FjZNPeQGSzkVWIaNqVdtDefh/EjBlLVqoUTulSqm/hxlTz2Q53uf97dtlIqByZo Y7bw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cLeLCfVg; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79a0ccf267sor137769266b.1.2024.07.13.01.45.44 for (Google Transport Security); Sat, 13 Jul 2024 01:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCU63elKC6OTTR/mVNyLyMskWOI0G2EGmY4YfjP3smqcbCWa0nNwOb7GNuhxnu/e2OffaLn697ku8JC4d76tbPIQMXCL4xMc1ZVFS1ZS2+7sGEX+ X-Received: by 2002:a17:906:fe4b:b0:a6f:e7a0:91cf with SMTP id a640c23a62f3a-a799cd005ddmr431662066b.24.1720860344481; Sat, 13 Jul 2024 01:45:44 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:44 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 08/21] clk: clk-uclass: Print clk name in clk_enable/clk_disable Date: Sat, 13 Jul 2024 10:45:13 +0200 Message-ID: <20240713084526.922537-8-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cLeLCfVg; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , Print clk name in clk_enable and clk_disable. Make sense to know what clock get disabled/enabled before a system crash or system hang. Signed-off-by: Michael Trimarchi --- drivers/clk/clk-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index d768e5ad2e..76f1026164 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -630,7 +630,7 @@ int clk_enable(struct clk *clk) struct clk *clkp = NULL; int ret; - debug("%s(clk=%p)\n", __func__, clk); + debug("%s(clk=%p name=%s)\n", __func__, clk, clk->dev->name); if (!clk_valid(clk)) return 0; ops = clk_dev_ops(clk->dev); @@ -691,7 +691,7 @@ int clk_disable(struct clk *clk) struct clk *clkp = NULL; int ret; - debug("%s(clk=%p)\n", __func__, clk); + debug("%s(clk=%p name=%s)\n", __func__, clk, clk->dev->name); if (!clk_valid(clk)) return 0; ops = clk_dev_ops(clk->dev); From patchwork Sat Jul 13 08:45:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3215 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 29D4740F45 for ; Sat, 13 Jul 2024 10:45:48 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57d3eca4bb7sf3939555a12.1 for ; Sat, 13 Jul 2024 01:45:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860348; cv=pass; d=google.com; s=arc-20160816; b=An3M3ii93cweeyrXUQ/eLCGfslBPiPEZjQf99AlCsBpsBAAf9TT1TO/eNuIFs8JNdv eStGSHUFSYQLrpy5o5ne6RODPUZE5HT3wtCsAX3FZsjNKKIzpZC4964kJZKR72is1pKO 7if8Y9Z/vFPGMMf5xK1z8xOi0xihP816XhbZG6B8m+hs2I/zA13DJKXPkMRdLPVaB9UZ vAz+JN+NLBflINAOZ9ZbMeugxZejmajWT02LsrWJWyIyPr2DBZg6fhlV+pZixe+kYVEp J00FbFjqu0HJ6BmUoub5dUyMFYkylKR8Yq+A2aPuJZ4gzymdSW3He66+CzcAs8vnA7wz lJBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=60k/FQlEKgyC1/tqIm6PqldQOacYgyn4UB4ymJpHg7A=; fh=QMDNQ/qs1pL8GsD9rJy+xoD1kyNDzQh/FXYGhse2PMM=; b=YnP8+Ij3BOgsxyEoFdfxsxt6AoVnWbeuBgI7enMdlTQI26CHZigZU57ndZdojQMxj7 WSoZbXy6i8yjnaF/9QdVJ3VW1iO9mr+jOPSwsO1c29iwOKn815t9jb+RR+pjxpGr1/4W 1LuATA/TovyJI0PFOJEwRXdDW2Nfc70mz9FYsqpOPJKgzrEoGlek9uH0Ux6lU9+9HRiP GEtj9UjWNuPiE+nrnbzdFPfeLiCge8skdbkpT28rQJAEYOu3SaSAGuxgxQKPtpEc7XDA GxJi6sGQhg56hMFiHkKE9c9piyaM5/hcAALx0bbuciZbln6SafrHjCxjVGTCeRQpSVkv E57w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rG3P8a00; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860348; x=1721465148; 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=60k/FQlEKgyC1/tqIm6PqldQOacYgyn4UB4ymJpHg7A=; b=oAKIzLJjePXGbW9rPJsGcZBeQyskaqPfxOWbvVTHcVw52Ny18389QX9eXU+9mrGiRs afOOjUJQ0HswHLV9P+IaJ1GXfCMnbD4F8VrgoDXJZGDGLKrv2S4g4BhApwayk7GkfFi6 EGRfxoyst0ijWGejsUpfnOT58i0o7xIgx+4sc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860348; x=1721465148; 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=60k/FQlEKgyC1/tqIm6PqldQOacYgyn4UB4ymJpHg7A=; b=Cnqu9FOI83O73SNGOL8gFcj5rxuLJxQIpRKmp/+VZZK40QngTYcl0+Uap81db7AhAM MJ4gwukHxrdot4nkOSic3tJ8ijookSD3RwAOsOBdcEbmvU5XiIJcSPs6ZKtxJylW5NkJ rVIaUxU4O3puUCucw+3CNMvIlLYs76s4eSWkwbjAlunlC72//aKDjmRY6GX0MIPGhBI7 j9UnzCmE4oEvemammbFzPuYtgR7/OY+XDkYmcmsG+kyC5eEzlUInnIcqdCIwzhpagQm7 6IzupFZ6P+r7gTnCRlsQkP14Tg1UteJcyhxj84Az2JOZJlIAqgGcZhZm0kZ3efCsoZTd dueg== X-Forwarded-Encrypted: i=2; AJvYcCXZhq8xU5ECamarCLtdmHjFQivXz1i1Vd2BiS7RW8u6WQw1LTn+/ruYK0ejk+S2JoCLhsnnHkJsf08a3CgRI0asIo1vYuAGxoeYQf7bfqWvDN3szImrwbA2pw3FLA== X-Gm-Message-State: AOJu0YyvQ+JeXTlAT++R6SCwJ6kY70l4mgP8pS7yUiqZJ8f9gJ9/SonN YQup9TQZIFy5VUT0fEhvA9VrwxH/kVUbOghVZoejxFiFrS54NsW7w37TQFu15ashpA== X-Google-Smtp-Source: AGHT+IHa4H8Vqf+RfUQ1Z9wQjEF/QiNWlkcTiMnMIRwxL5ZGPau7ajwRBY6USZsBsanUqULU+eSjiQ== X-Received: by 2002:a50:9ee9:0:b0:57d:5442:a709 with SMTP id 4fb4d7f45d1cf-5995b5b2bafmr4127792a12.0.1720860347857; Sat, 13 Jul 2024 01:45:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:1766:62e9 with SMTP id 4fb4d7f45d1cf-5982661bbbdls309771a12.2.-pod-prod-00-eu; Sat, 13 Jul 2024 01:45:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvemuZAWc1siorxAYM37zWzuIaL6G99PbTZrpzw9V3caSBvUVoc59tg6a7ByzUbtNX+7ugUVd4Whma9u3jA89KTKp493c6Uua0xLf+KJRjdIwI X-Received: by 2002:a17:907:97cf:b0:a77:e420:9e5d with SMTP id a640c23a62f3a-a799d3a44e5mr415569566b.34.1720860346178; Sat, 13 Jul 2024 01:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860346; cv=none; d=google.com; s=arc-20160816; b=WayMwzUm8Yx5gmJqZF21Vg2Hu588GVg2Q1JnxEWVW+GtZnQI4GUPbo0oiC3Lry0sQg rxaHgEAgCZYvWCb4YmW1RAVA72fTFzepUUt+5hJv5KDdo3ZTCjeOnh9hjiXZwCiDIE4R OyloB8/b1HRRIJI5RUgrcp+1HC19snYnbcsHFNw3o4h++iF6WSn1Uqn8RZ2f6t28lzng WMtzwDLDL79bFDdE+JEZiY3Yv7Zo1Dggjm0XCDiEF6lIhQA1dugQr/aNJiZng+6N7sgk tw9f0rM56Rkg0Nkbl/tZfGgdJLYgr6LGuLIJtNHMFudToWKOo5l1J/3B6c9V3MyHwgxQ i/NA== 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=KAkcJmy0TY38eaMN2Z+V8FYCp2Mn3ohX0YwuxdG5GUE=; fh=aft38vyJe99oN79xCuofrQJl004hjORV+9Iilh+o9m8=; b=Ht6701L4LDGO2yM+diXzV2Bs/Tc4JCTpjQXKcMEYvhuALwH18YiXGjrP6OdqvPFhaS zSGVvAAY0VDc/kf7CctTH9U7MP6jAugXZkGM8FemnW3SZwFjbrX/76ex2vH67ZnyCxWt Zi0yGU1FAuYrNF/ppxRNGPMFq81I+U6hcm1I3Gd5CdHItquYbdbjC1dM1gskUXM1yT3s suiH7R1znuip8Yef2hfqxuFu/kzh6H1GJ3iP55ySh0i+OF51zKMLjZZhhtGK77QH2DUF YegEt+2A2lnRPFAlDzsToVPnRgy5UM+Bbtq9+4Of+vz4zFbjGXEhTy1Enc9LCbIsQtdg WrTA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rG3P8a00; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79a0fa06b9sor93072266b.8.2024.07.13.01.45.46 for (Google Transport Security); Sat, 13 Jul 2024 01:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVKnp1YG2KWlwBp1rU+yHAJa6kTrBcSqtgaIm2z7P8FMXHzLz3Nm6ZD9YO3HWXvs8Y1KFpW1PuY7ZaOsr7zGFIDTR5x/1aXM/UPFLOFnsLX3AcZ X-Received: by 2002:a17:906:81cc:b0:a6e:f869:d718 with SMTP id a640c23a62f3a-a799d380e3dmr310536466b.21.1720860345787; Sat, 13 Jul 2024 01:45:45 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:45 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 09/21] clk: clk-uclass: Implement CLK_OPS_PARENT_ENABLE Date: Sat, 13 Jul 2024 10:45:14 +0200 Message-ID: <20240713084526.922537-9-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rG3P8a00; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- 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 76f1026164..8faf5a56e1 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -583,7 +583,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)) @@ -598,11 +600,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; @@ -614,6 +642,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; @@ -621,6 +658,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 Sat Jul 13 08:45:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3216 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 6621340F45 for ; Sat, 13 Jul 2024 10:45:49 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-58e847f01f7sf2386073a12.1 for ; Sat, 13 Jul 2024 01:45:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860349; cv=pass; d=google.com; s=arc-20160816; b=JzDSL83qykcPH3d6adhyetnr3hgSTWeb/2P++huYfLtc7aReyJAKhMtfhljLqYpMqM Sp49qbJQE30bxOE4OpLUINiKVqG0wf958WVD70wjO/w1Mgj5jPWRH0g6C0+yMPRgMijp 67eJJl/XyZnLAFU/xWBsd6lEmyUGPQSJsLwbvT/XaVBZjsqpMryUlm82pcf3s+ZV8PHn +QD21mHVCwk9AwvQDIHXJ5S36vqzOrC4Vw01XB9VRsSHgWs+Rua/28GKdqKd2Ro1TNzT LuXa+kSmkKeEAMXaMBn7N4avt1Q5Us57WIdSlE0m/1lgzY4Ue+RbEeSxxS+NVhAauERw m1kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=vIF3W6+H/29MWIAWRO5JlXMXvf2fIuRp7j4wrl5OUOY=; fh=BbuaDmGRRKfr+099pHzjzWMCi+nUSIRGvhaf1kYnbX8=; b=ylwnCa2lUVPDKQPuJtI2fPZejJLkT2Eii4XbVlmwVAQT8ZG+xLDXNA2FAk+sAyBTz6 gjDEWqyD5PDdP7tmTXu+RWYUrAHy/xKMRpCH9w/eCODa7ZeoA2vE1Ge8O8ekpEbndJSe n7WFRePVaPZjD/rALnRATc93tObiAOzxeaA35puWDsnxOkSKNPG89gRoeABUS9BUqJBY fj6SiM5LyTepkpp2k/nfgzvxwQY1gNgezGrqthJipdM4rihC7UaH4p9dfzuFmRQvrpGk zj/Id2uWEKCVf7czet7nDLY7SwNtI+UNUzmaPo8oTj+CMaSbA4a6VZf/AYIst/Qrgdsp xKbg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=F8yC9Lk7; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860349; x=1721465149; 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=vIF3W6+H/29MWIAWRO5JlXMXvf2fIuRp7j4wrl5OUOY=; b=TXFWEE7QBl7YkZT+adMemDY7fftcFnPfyla1mE1Wpk1jp45K5OoVIuxfkpDxZe8ZrQ 0MlOpNazuCGzBIBcOvqX8Wk18OftOMzlOpGV0Pryt3qK3eF8fofIMLdJaapUDhu4rU1F cRYHCEl6swXPmI48M10kiCQAXcA+zHQ71HELw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860349; x=1721465149; 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=vIF3W6+H/29MWIAWRO5JlXMXvf2fIuRp7j4wrl5OUOY=; b=SsBT9V2oeH+2kiZwwgLpRZiO/nVdOP+BtMCdVP8dEvYPi8qng0jqeUgdg4SOve8SH2 ZeCfEUmCeFMYOBs9fXub+tlrWM4p4W4r3hiRHD7BHvThGXS6vaCDdpIanW+LUsCcnl6S SMhO4AuUU1QRRmXLNwmjDaf7qPxNJ8uhDJ9OfC3lJ2m1l4yQ4u5eY6mePJK2h/7CFSfS l10xe40BKj0AVo/xMUATFOYGdDgPT/qEu6w6vGY1yzFCeafs4HrXVhxnMuMfUvMPZr8f sWMfswodRVl4TRxrD9Co2AsnfNq4py+L+2mu/Y4syUctBA1Cq5gvl9Vho9yPRb67Ud3l BxwQ== X-Forwarded-Encrypted: i=2; AJvYcCUtn+QV0xoprLA8qhNZ9WF/vswJjtaUnr8zn8sKSU9uavk5bDirfKyzcAKZnC3muivKmMnjQ2ZeB/03qWNEc+JiB2LGdZWoOxya6ezqenVoMvnDawEHftszRDvTkA== X-Gm-Message-State: AOJu0YxczPMMWhWungTl3ypMzoVdC0KAezwzAxkys82myqENFCCYLqq3 HaFr99Dp6FTEsgBK83Vtx4QfoSMDC6d5YserTzjOxxewP1xxFxGEQfdk7EOGawH5VA== X-Google-Smtp-Source: AGHT+IFL1SQaoFc9FFgmxNk06r4Ag3OrhVmtp81PfxFWvH8NuqLnbvX3LXobjlvfk3iUA3CMR3M9Yw== X-Received: by 2002:aa7:df99:0:b0:58b:eb96:81e4 with SMTP id 4fb4d7f45d1cf-594bc7c8191mr7586795a12.34.1720860349096; Sat, 13 Jul 2024 01:45:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35c2 with SMTP id 4fb4d7f45d1cf-59821cb8e5cls1630991a12.0.-pod-prod-04-eu; Sat, 13 Jul 2024 01:45:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXlf/0Kh7udeq7J9nyDyjqwM8cW22ttxhvcK2jmFOUjImOQb87DjZUq3jjCyNb/kInD6SDKfpZ8I1Mk1dM/sHrRXC32lFRQtrL2ra+cEiVtNO/2 X-Received: by 2002:a17:906:1709:b0:a77:c9cc:f96f with SMTP id a640c23a62f3a-a780b68821emr954122866b.7.1720860347349; Sat, 13 Jul 2024 01:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860347; cv=none; d=google.com; s=arc-20160816; b=frbUZTLmhWC+RdIUH/T4QciAnsAnTh0EpsaA88ge2+JDF2oq2sx1CqR7k1wT8RdNb5 VQ3B7er+merCW+hLXE+HHUuIPNDLAcD2EkAALCvr1H2t36IGjb1OroSOkzhZiXeClMnV vA3/hIEjHPt+VadnHK0/0beS7NrwIApKWauNWqNztQNXAErdSGExr+5G5P+3YVEq4xEr h9ODG/BfiswPc/rrxqiWLF+JenUse6MGJiObXiXvsxwf65p1LrcCPthPZSifVaIDOQOv h1SVMew9tGswMQoOBRDmqLDBF8DoNkPEtNwbtPpBr7hImMkOEHa5bbu3cNmIrBsMHknk 6Liw== 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=XSpr8l2v3lDkCrPLrAQAobF17k5cHwQOoCp6wCJuW4E=; fh=mi6k7Cc9sLbMfffWUgqpmwc2inkS/ktn60fdEfp7+tw=; b=hnQ0DQ5DeOaoUcw7v50Lg4kPosmbl+dVDyhv26DPeRF//TG2dO+LhnH5Yr0lanZWNY 7k1SOsaFS4vyWTWLATdhov+s4V1NWNPeRQjQRkKmFxpq/yzw8KA7e64eumaKjuvlbssC rRi92EIdUySkll2ETfwJ3JmUWLrWsAODTLiimF2Tw7gMdHOHhn93CXI6v0Q5eW8xfhXj yVl43gXmMYIjuMDZnAW99jcC1VdfLAg4OjziPoj2Dw5sw7R9FvLNgPscFEIqB25rc30i g+b+YRqt/SBNKv5HIz/qcnlhK3/IlahBAY9EITp5ZKU6H4YiZCju3ANgqcJHw+KN4YbD A5XA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=F8yC9Lk7; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5a360bsor13073666b.6.2024.07.13.01.45.47 for (Google Transport Security); Sat, 13 Jul 2024 01:45:47 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXRWDOddkFLO2Hxbme9yLimRLhKJ9N66OVDt5beM9xq5CSXrSvJ+Tew03YWMeW6cIYY0a/fshkph6tV1ZVWLF2jq6D6+3PCuMG6iR0mwEUDiv32 X-Received: by 2002:a17:907:94d4:b0:a77:d63e:d8fd with SMTP id a640c23a62f3a-a780b688204mr1179250966b.12.1720860346986; Sat, 13 Jul 2024 01:45:46 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:46 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 10/21] clk: imx8mm: Mark IMX8MM_SYS_PLL2 and IMX8MM_SYS_PLL3 as enabled Date: Sat, 13 Jul 2024 10:45:15 +0200 Message-ID: <20240713084526.922537-10-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=F8yC9Lk7; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- 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 685e7df0e5..275f119686 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -170,6 +170,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; @@ -448,6 +450,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); return 0; } From patchwork Sat Jul 13 08:45:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3217 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 731DD40F45 for ; Sat, 13 Jul 2024 10:45:50 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58c08df32e7sf2219341a12.2 for ; Sat, 13 Jul 2024 01:45:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860350; cv=pass; d=google.com; s=arc-20160816; b=R8uYa2FrjTihc8CZn2fgSOYpbuEa+4smEGPZJTwn7gGQAcWjLsClWlNy202h6Pjqtf mW0SCw9mWeIySNaPISI39RxlmGNUdHxZD7YBRwGGDTQhpjOx9YMLwTUiYFxB55EISoYT TlHo5vhQkltjSL7rxBASqi+Z6i7cZG0E/9tddDk1H9JG7v3QTrmKwZHxTtVy8oIWr9yF TmFyulrtnV7vlTbITb5AipJ30vXfe7IfNXn0Oo5AKHoxyHaQv4+uIUIon0AgSPCn7obh B26xOsNQZ6W9sqfNuxyPxkyM1m9nJl3PrrlzIAMm3PVEUZF+Cmt6elSkIMouQX71f23s Aw3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Pay4LHamcuM842Ez+J6dPA4j6b9Zd+ZqUHzsa8PQO8Y=; fh=1fK8/bzBuE2l5WTYetBCV4X93ie/gLvLDekwK/Rk0VU=; b=fFuFby9wOmQcYq5AWNAZfi+ySKwbmwLr8IeQD8rnY6aeMuOfiJOyIG3pUxnraNGM0O rfDxJs2vJNdVj6KNvYAE2mzfEO6BZCNPECxCnXojldu+3Bpf6x/iImj61FXcYu2pqEol 3zVCk5mdwIhplJG3dKKd3/pvy1YY+zW1tnriigEURhvDcAx3ibod+NHhpKl+Ff+bD7zc te99I2XP/R9dsBm183h4xOoXjvOCCDclypQRB0A1cksc6HUuBZ/PW9LVEdLu4sMjgoZk b1El+SsAHKb0PwIE6338ML1x8LtlwCZTdyHwkhb84cU2GzNgyag+BqT3YhKCOis4I+bF /rOQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CNuhW4xb; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860350; x=1721465150; 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=Pay4LHamcuM842Ez+J6dPA4j6b9Zd+ZqUHzsa8PQO8Y=; b=AVY7c60UlIomhkgp+zzt8Dafx0MWRHgMPlLcB5XEEdpIPTVMuaLX1z/ZX9U+MnrrAr zDYUp+gMA7VRLw3QyM9+6CsJI/y4SzMi5Olz4Pm27+FWeJQkj1wEPbXMTFE1XzbT5ZXM 1acqvT6nFcKe+0HncrpUSrPcGrfhB0MU8pQV0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860350; x=1721465150; 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=Pay4LHamcuM842Ez+J6dPA4j6b9Zd+ZqUHzsa8PQO8Y=; b=I/4Klr18puO/1/rCpC8yCNeDU1JFxzYAKGJNK508XI27teE/X3wtlh56zS+sQUdR2J Rzq40rJag9TgDKG4E06HZ0O9irxBs2EJIjg1ICdQDWSmfceph4ptuuhmIxggPBMOQvXZ y1wCY7Akp5JLHoPF9XmFsTgP9We9svn03NNBIm2LrEQqIHfHxtdQWu02tiAHZtFCzl5V 3fepXEb9q9FZlr7TwrzMctDeKsfpBq/0MFc5YfgVDzVP9u0t+/0m6rdInJ/g9kAbKdNA ahq4D/SUKzUwWQv1w5CYsftm+CHvNRHtQcNosN3jrCKm92ZQdQckqGxrg7hk6PZDnv4V hf7A== X-Forwarded-Encrypted: i=2; AJvYcCUVVW3YNcFDk7RVJJCfIm7K3Yo4QgwGs3A2aUmg0NFqW7JjMCg0JWpgqBTLZIoK9OFkW+NkPFsL8JjSu+SiaTctZ4e7PI2txUiEnC0VXrn2YJskcOZlv9u+9sIVUQ== X-Gm-Message-State: AOJu0YwXWsCxunl05q51/fnLTGdsVsaC5eaMJSyLmQxEo3BBB23OYOc5 38mfIpnUeZsBg/haw1EasRRkyvDxx54n7JnrzPbj91NIel8SrR0ifytxdPUCmuZYaA== X-Google-Smtp-Source: AGHT+IGIHir29ib0wbpNMBsRwkUeG1TFFPzUDMde+qXCrwJzK5RXYx7qlAblaViRJemCxa2oPCQvgA== X-Received: by 2002:a05:6402:1906:b0:57c:cba1:444e with SMTP id 4fb4d7f45d1cf-594baf91412mr11696520a12.13.1720860350176; Sat, 13 Jul 2024 01:45:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5249:b0:599:9c73:c38b with SMTP id 4fb4d7f45d1cf-5999c73c444ls778556a12.2.-pod-prod-08-eu; Sat, 13 Jul 2024 01:45:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCiVVcB4YVMMMGOOT0gP6WA/tECwReQZFe6jekxlgd50E72IEbDukVChqThUbkgBaGLkbwg2/iO8rTHCh8WQnikGC7p9u91kYUfu9C7Qsr9sfk X-Received: by 2002:a17:907:d93:b0:a75:20f7:2c71 with SMTP id a640c23a62f3a-a780b6ff667mr1372698866b.38.1720860348489; Sat, 13 Jul 2024 01:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860348; cv=none; d=google.com; s=arc-20160816; b=ESfe76CUTboQVeL/08bfycyZfNH+1VSbzzxqwnfxKAK6hkop5LALq0IV143eeBYHa/ YmkTxI91mwNAat65RpULXgAo0ImoNU4fR6ZXwu0EZt66uA0Hq1e4xab+TAZ3lNWW6KHe ArdAvWHf4e7JZyWTNMaGV0NnvoCj4oSMQBOJT+7o/sRins1g8c5ijhQspec4ouhE2AmO lRRVfxZq6j86UzMlkgPanTjERtMsNB9EJBsbHnqKgI5jauc/XJFPP//Ebeny5LH3zp3u mgReXpU154rbTlyDvXfBtTYDVjfi2cGqS2fKkCOI/Dvpg2B7qSl6DxqTmH/P0XyiIw+4 arRQ== 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=bL+iY8GJscfGuPbpaMLJJRV7zDCCqvZpDtY8BSVmQU4=; fh=Ie9Prfp0coxpk/9nHPJ21PQafTcQFrk8Cqo2w1dhpcE=; b=eC3MabXCR1dAStepb4upXi7S5QWMzttXPR2vmBGmhjFyWjVypgxynKQodzdeuZtHOA aLdVoJq6hS+VlPTnFJ0dZig36JcephouQYnDlcGOybA07ela1zQ8nLUGQfI+Vr/W9tef oiPd/j32zGR1i54bn16DWa4dWo9ZpMmQYX68sDwXXZHT1Lj7ZUVyubs8X3ev62MZbR+e BAhHA811chv6/Hdvn2WXHcTJz1m4zYTI9A97mq1cmSb3S7SHL4+fd/OKEYgsfeubO14s U88eke5uB6EaICwSleSY6hzA+ql+z6PpTRDCNKyH0JgKDPrS9b2wy2YRC92qTEVgSgnU mnDQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CNuhW4xb; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5928d3sor14249666b.3.2024.07.13.01.45.48 for (Google Transport Security); Sat, 13 Jul 2024 01:45:48 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXFhgfvWZ5/JfSdA/LaZmr2FaRwBLA6rCvpJ32VVsZriw8eHkRspcCDcs5LEdLaQb7y07+i26D4z2NvEVOpSgxSWui/HXG7yTtu3Zhv6Iy/6Jwi X-Received: by 2002:a17:906:b898:b0:a6f:5f8f:6c43 with SMTP id a640c23a62f3a-a780b882706mr863513366b.56.1720860348135; Sat, 13 Jul 2024 01:45:48 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:47 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 11/21] clk: imx8mn: Mark IMX8MN_SYS_PLL2 and IMX8MN_SYS_PLL3 as enabled Date: Sat, 13 Jul 2024 10:45:16 +0200 Message-ID: <20240713084526.922537-11-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CNuhW4xb; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- 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 e089012477..31d2faa97a 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -151,6 +151,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; @@ -417,6 +418,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); return 0; } From patchwork Sat Jul 13 08:45:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3218 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 3612C40F45 for ; Sat, 13 Jul 2024 10:45:52 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57a524f1f7esf1914404a12.2 for ; Sat, 13 Jul 2024 01:45:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860352; cv=pass; d=google.com; s=arc-20160816; b=LJfCjU0soFfEFQEqutr0SkldTqgKYzxp2WdcEDSvjIJPCtoar/19kZtMyqWsbsjEtV H86W1Evj5rlVh2N+XNvrQ2bLRz9IE8c7nW8bL63h2cPFKD95OH+120U5kx1rbqO6Q7oS Pd1zm0P0QA7dVKbV5H+vmeYstMeRXZWu0rb/t+ttnVuSEx8HypIM4OgmoN5HlsbDZT5+ lTBQazs1jrvrNO6t8oFKllvkvq5XRuHCbiAzqqxuXIY3GMS4BP6JeW0QsEczwgOp4PHZ tcHKuzg0yQuWOiuEpssjEwyO6HInpqKt35G+XkKcEZFqhk7rAWnEwRG/xSyCEqxrETLI 1Veg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=mNVLAZIjA25iiyrZJDvR87DiT9sYQPHDITbfFQfdUnI=; fh=bVI0u7EwAIYmok6piIKVibwwsrYlav0bmyeoiMfLrcQ=; b=YqRd84GIETQP3RM7v1b73ggAr1ctabgSL4n5FkN2J8fy2vTYCKc/2bffMLtMC/+/VQ xmxeJptmj4myI5FBN5KB0Uki8Pkl/3gT9PUjP60TYTRk9+MfTtyyGroBtKn7yDNfNoqp xDQfoe+FKB8r2+8Q20y+dQwCPxwxzpDdYtrlU0AVDTBLT72yHUM10YL7G3YDEQsfh1Gx tqRi5e835CF7Ij5CPIhjufjEnGsUyPxLUUlqdO9k4MoARdws2Sp+oezzzInc5OxFp6qb dPRX2XzKCBRr4mFCSXNnnHXGNRPzgpCHEDzP3/PrBy622x56g/xquegqKqKF9XuvJmPh sh+g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kGLrvIkt; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860352; x=1721465152; 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=mNVLAZIjA25iiyrZJDvR87DiT9sYQPHDITbfFQfdUnI=; b=GjUtd49X2CAnI5m1QE3FJgMs+m92ZVWS6Xk6NKXCOdaybWR94TIQFwMiTtequo+VOB 06kQkOUiuJEbBHaCjyFOO/xTEX2G9A2j9XVD+upknLQRtVQwdF4uhAn4E8qutITFbTlY rzCQztQ8q81/mKmkPa53jrqBpQoUEUNf7KpfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860352; x=1721465152; 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=mNVLAZIjA25iiyrZJDvR87DiT9sYQPHDITbfFQfdUnI=; b=aNOQ32YppQ18oQEL04SSGBwp6ilT0qrG/ZKmKviNcBazfQupiygEaxfwRe3/6h0OAI AW+nKV4fuooRpzq0k+3zN7s0aVEViFeh3m/ybd8lZpYZS73ax6RT/OUPUh6nvucFlQu1 Roasx3L+p8JM9AdiqGkYJZv9fCHurLrt1c2KtAz3u+jyYX85/wdXtj24Mf+Mv1wSFiPT eFRk6chOm0dQrNr+PiJ1TeP0JdO/+P53JjzD9zL3DPq6IvUJZxHTizziRIO+OpdIN5Ai TiNx6TgI1GIo2YGXtuQr7/PSqVMOZn3peT3gR28tjfHbetFkRKcqWm2/c5W4yf3Kwz2T A44g== X-Forwarded-Encrypted: i=2; AJvYcCV7EP0vMV2J4Yt3u2uh33kveoPTZHRj0TXN3cKAYY6+30UNK2sRHFUc8w1ZQtIo7JIMHr6E3hcrDvuHdHtQ8QnIIJePe9NM8hW680RdGqv9TR4RuqmUwhKzlRJ1Pw== X-Gm-Message-State: AOJu0YzZ9Z7mrQcwv0Tf63OuNKLaxnda1olgShwcKS/3JlqAcNpP2Abj +DVaSL6UuTTxQOReqwIROHEFXxTGowUfsE7/jTw6zJH3f63dpDDCzjpSJpa2mfr5ZQ== X-Google-Smtp-Source: AGHT+IFx15T5fVghcwB1in0YGwothhoPL4E7HqzhMKd8ehmVCw7OsccPTHOvTkPYjRRVN9Nrc14iPA== X-Received: by 2002:a05:6402:1c87:b0:58b:7413:db00 with SMTP id 4fb4d7f45d1cf-594bbe2b9e5mr9014112a12.37.1720860351909; Sat, 13 Jul 2024 01:45:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:2188:f507 with SMTP id 4fb4d7f45d1cf-598267117b9ls1569802a12.2.-pod-prod-07-eu; Sat, 13 Jul 2024 01:45:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOXpqNwxU0cWEiwrLUQoUOI8zFiaWhqZ/Sk+FqoV0d2/KAyq68yffruSIlSL4vzOxOHxYrp+gnJrtiZeZtWnYcJcvQq3jJlJHISsIrb2368tOX X-Received: by 2002:a17:906:4c55:b0:a77:c080:11fc with SMTP id a640c23a62f3a-a780b7009eemr731452266b.36.1720860349951; Sat, 13 Jul 2024 01:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860349; cv=none; d=google.com; s=arc-20160816; b=ryWzqW0BXcqWXe0wCQV3i4Yio5cpK68Fudav1pRknGpJhhAYitc+9gwnNFQ8/lA9Z/ sdBgmIK3ETrpYxHf0g9N2TeHBv1e9lss8AZE8Wk4S07iMDtjO6kc5OIw8o2kv1lwVOMJ h0OYB6tc6tcrYgiD/mRDRCam/Grteiuf4m405d8p4hETs0fOQl67peCx1z6HLzBYuJQ9 +XlvAdMWACE0txo0e9gg8MGbUEmcFIEbQvu5+2stbs3kXbUM+q60mqkEXcXB0TAfTz3w Kstf4QY6NFupCIn5aHv361EQlkiL+5O/UPH7xV2tG6adPh4qzvBrpVDc/iuiK9EPT+cp 0BcA== 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=BOsftV1B156FqKPDCerCP9N5GFz4CWFhQ+t16qP3mVE=; fh=+nOU8GO/Hrsw4vm5rWGxMSsdCuMsn6lnzU7eLJH933Y=; b=biDQYD9aHzQMRigKHGUxuOgwPvEvWy3dnW+at44+nLRItGcXo5QnwsvdgcdrDDcMPu BHAHDR9ZsIpKxPDxPQ7w3O64+5pEtUGCTLulxf+yPHgZ6cmRP6wUuvlHgVdYm0d39HjO q2Ntm8JiiXJATF9zgIsD5nXOrkaI6d1u8AkO0hRQr3VuMeQisIgUKtb5C8BRdi7fvis3 GYefR33h7unyh1JusCr+RXe5gMRRdrKEcx4dA+25uy8YcrGN4H5ojdn7ezmgqf4DcXYg WDaSPMXIzooHOe3hgIoqYQEs1vdVwn8G3paE2dgG6NUnjxg7MG4QZTFCsbLsUd/ar6DA lOrg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kGLrvIkt; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc7d0048sor15897666b.17.2024.07.13.01.45.49 for (Google Transport Security); Sat, 13 Jul 2024 01:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWh2ydxBw5oZkmfAbjWiWD5pbg0b+Lyv8/tZ6JJOCUSQCDkILyTVHAdH6UaEPk30UYvlO4Bv2Oz7iAFtSg/2VBK0lWxSfqT73/xO5mguE6QSod+ X-Received: by 2002:a17:906:260d:b0:a72:b287:1e04 with SMTP id a640c23a62f3a-a780b70106fmr762602466b.34.1720860349507; Sat, 13 Jul 2024 01:45:49 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:49 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 12/21] clk: imx8mn: add video clocks support Date: Sat, 13 Jul 2024 10:45:17 +0200 Message-ID: <20240713084526.922537-12-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kGLrvIkt; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , Add clocks support for the video subsystem. Signed-off-by: Michael Trimarchi --- drivers/clk/imx/clk-imx8mn.c | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 31d2faa97a..089f5169da 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", }; @@ -44,6 +45,34 @@ 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_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", }; @@ -148,6 +177,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; @@ -188,8 +221,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, @@ -217,6 +261,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)); @@ -373,6 +420,31 @@ 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 Sat Jul 13 08:45:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3219 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 12B5E40F45 for ; Sat, 13 Jul 2024 10:45:55 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57cad6e94e5sf2504984a12.3 for ; Sat, 13 Jul 2024 01:45:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860355; cv=pass; d=google.com; s=arc-20160816; b=EA5R8tnqkzlEfR4hbi2ZxBuHG75zJsID7TwTYxe5lmLywWwa53kYvT/bYvrg3EzrZb Ex84kSQiKKtrbhphv2+JxM+z15Q50D/l15zSnjOJiRGLteUzJtXi6H2jjonYwZjoZC2e Tp62phungRYGjJX0h7gRqnVSIFi23q6LIzqWpaC4njl8YLk+szyl0qzTygQfvawP/xKa Dxh+C93x/H1Pub6Rgur9yrOJGt63Lr/ZD2mMMZ3BgQtQ+vahZaCF14dLc6CW7nB1A6Ct nhVJMYnticvR1xvavliNsqy3xwRr+ZMHgDkdyRun9qRx9wiJHl6h6Y10KN1LY4Jc8sx7 8ASA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=dgx60E9RmipZyfF/HhiylaYEZri313sHdQH9DIBHVYw=; fh=HPPdt/2c9HlU0sE1rcjTSrEPDgUWFpeZ2pWTnp/QXBg=; b=DMwK4cVRI+sWnABUINXszKa+wV6fU9m1A4+98pumXm5qN88jsLDaQOxceoibqpYJj4 EECBxp+uuZ6dnVC6A8wjutHAEQNB0yyRthILTU4wtpciS7m2fDJQAVzuuD85+Tmo39pC tfLrV2NIf+QmMsJfQxj5PpslcpG1gWEQtAqOuciN8A2ZtUKEVt7psAEgIOq9YlDu5pZL RkWWE5vTlNu1ZuJsSRFEoCqEoSOBRqvpB7O5hOFWF/1jo03lvnOqrv3WEKhWpNQceNeo CCHC1yIdY4m4XJqPJDW7baTvcIEF3hjfsvcHee14Gkg+bQ56vD7h+6wObZThcz1VC6V3 /zjA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mYaTQtpT; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860355; x=1721465155; 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=dgx60E9RmipZyfF/HhiylaYEZri313sHdQH9DIBHVYw=; b=Cd3PrKTUD1s/0wd4e+QJExqvSr0H9UhETneHpkhAhvAkD5tZcLhE9UhsqJcKgDw80V 7tYx75xyrmsQodACJfWbi1QMdrcmDzGt3KnT5TepYLF1MEiPe2ldXHXxOvzfV0eDUEL5 2EfBK2W+q53CS1s0VTZ2b1dzjDCOyKKmkXF/g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860355; x=1721465155; 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=dgx60E9RmipZyfF/HhiylaYEZri313sHdQH9DIBHVYw=; b=nF17CZgshMk/X3Z+ZRcL39oNujWDrS19Dnk1ruR8H0LBq9S0Cs/EKsQzyl1CBDX9Ll FXcGwkbAlwK76hHsOqy+ZMsumcLflFg99kqKUaRXbnrx30ijgUrecsaFoNNQjoIG7r8E vVo6B1N1mo0IoDrcSu5GfjJJ9C9xKmatJqFOVBsKf3Oh47PwKmsCrt5J6/qyVgMXBQIy 3ulHQ2IUK0aaHAgq5xoYee6KDTVBzj2Rhzn+0kJOqsTXw5Phk0dTEm9S3oXOa77KGf7N KITt5Sk5JEHCrtV+g/IEAvLoWxHEtTvYN5JMQYxKrt9SwFzXFmfH4XZziGaOO+15oAoQ otpQ== X-Forwarded-Encrypted: i=2; AJvYcCXFXGetShJwACmTTULAHsOnTu6Nz7w+O8SwGZyVVbekzmc1NF+rH3BtU90u16SH9PBgDNJDp+DbKwrpyi6s7gQ0UfUdiXbS2d3XmoKFSz65x9dYXfolKxbZU8H4nQ== X-Gm-Message-State: AOJu0Yw33M+8LEYSBD4gWJVuu/h6gPtBvqXACoqLpYC0XQRi2Z1bTRCf I1Bk9Z8PICpq0fqhv5JJiilYoM4ydD/qiw5RN+5MYybdXEN8nOc+iuw/EkUZKuKMBPJspZp+Vw= = X-Google-Smtp-Source: AGHT+IEhKf16HrhCVMukMbRbcsCKUASFaRGkowgzxqeuQVfFgOJolBExACa3QXIjcIszrAnLNH/JiQ== X-Received: by 2002:a05:6402:2353:b0:58b:1737:1143 with SMTP id 4fb4d7f45d1cf-594b9b047d4mr11871595a12.9.1720860354788; Sat, 13 Jul 2024 01:45:54 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:28af:b0:584:b54c:52ad with SMTP id 4fb4d7f45d1cf-59826225ad3ls1441550a12.1.-pod-prod-07-eu; Sat, 13 Jul 2024 01:45:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVe7o6aFQthOjnQEm3n0kDxVBglDfPZydOJcx73RwViRJBwDAwuUZvYSPyUzkdYwi9qFQG7+GpyvnGiiyhav6wrnvvCOae+M8d0HMUrCZYnMUti X-Received: by 2002:a17:906:6a25:b0:a77:c657:5942 with SMTP id a640c23a62f3a-a780b88b3d8mr1187364766b.52.1720860353006; Sat, 13 Jul 2024 01:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860352; cv=none; d=google.com; s=arc-20160816; b=l0K6HNJaoqoUbhmybAu0/9hBu2/g2mVFn0XRRYpMXA+uMcchLx78ji6tAFYNu+mgz/ oiKTRjVcvALhm+DicNUAX6W5N76Ep//KvvOnuxx4DBDn67TER8DLkNfhf3CDoIvBy5ia qkcPdi8L6KcFlDsIjhS63oHZjuXbT/BxyKHHxFBR+FnSOQxVLrli2dSst2QQXY+CFn5n DMF8WFQsRZgrUs2SMyKBbrXcCc/KSfGwsvQzt83NRuDQMjdX/Pe5HM2S9Jy3NIR5yo4F 8kijw590Is0RejmhDEgZ70C7cokGTOUmJtRJ6u+2u23Kk3nkeV25Yj0G7J73UHWluQLG ZIzw== 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=0uk9VoPniMCe+Ec0R9Nd8X+G0f1feA7adOIsejSE3AE=; fh=Iq9Z5OmSZK5YViijo4Nmpr0RqZPW2CW69o5yTViBHpg=; b=eCSsAD6xSp2eWrAAmX8dUGJGQtreMPmzMW5C81LTS/dqzhxdHGLbnp5zVojnvQXXFe XE4A6CXZSft7QexvDwlHqfCDQXwmYmbOHSs5fmN+jmC2cNpQVOun8TxW27rCxCcHLDO+ FMTuKdNTDTiC/s8/yBrk020ibdeirwmFQmNkAG4CDBDLW8oXzWMaipDSj0CNoKzVox4z kXxnW++q+Q+V4AURDoIIIUPp/FMgT2hixGZojNDIIgi5hpaqgtNUVJZXgBti1voCfk+d HDb8rwzO46O/SNXT9frIkNVDbBml4xbDgLylaPXh96xnXKo4yMgMFMAnIhbkZ5A+Lh5s m79A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mYaTQtpT; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5a3444sor13113966b.5.2024.07.13.01.45.52 for (Google Transport Security); Sat, 13 Jul 2024 01:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXuIMK7tMLiMWR64US8UU9jTyxFJ3H0sAhZZD3mY+yNZsWdOUi0LuDwAxvQJRhPkWxvb2r1eMnC86ItA8Y10B65TwoY7QJzavZZai7VIZGXWrje X-Received: by 2002:a17:906:d1c5:b0:a75:473b:c984 with SMTP id a640c23a62f3a-a780b70542amr872835366b.43.1720860352409; Sat, 13 Jul 2024 01:45:52 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:52 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Ye Li Subject: [PATCH 13/21] power: Add iMX8M block ctrl driver for dispmix Date: Sat, 13 Jul 2024 10:45:18 +0200 Message-ID: <20240713084526.922537-13-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mYaTQtpT; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- drivers/power/domain/Kconfig | 6 + drivers/power/domain/Makefile | 1 + drivers/power/domain/imx8m-blk-ctrl.c | 431 ++++++++++++++++++++++ drivers/power/domain/imx8m-power-domain.c | 213 ++++++++++- 4 files changed, 649 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 bd82d2f704..fb006b6e8e 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 2daab73eb7..46849fd2a4 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 0000000000..3c22d9de38 --- /dev/null +++ b/drivers/power/domain/imx8m-blk-ctrl.c @@ -0,0 +1,431 @@ +// 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, drv_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 8b6870c864..40fec70d95 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 Sat Jul 13 08:45:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3220 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 D7E6A40F45 for ; Sat, 13 Jul 2024 10:45:56 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58bd84067fdsf2687690a12.0 for ; Sat, 13 Jul 2024 01:45:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860356; cv=pass; d=google.com; s=arc-20160816; b=IZprUkT/8n5qPx0ztRyXfCf+mW5nBWhzPbgkBmAYrneUK7jwy2stDpMQsms7uI5JUo mErjctZdndW8k0TCt6dA725R/07FaZHeI9TEgqEKux2CpwYVs9wWIGgaNMtHMDcR+mJt nt+lCvAaoT7Qy7E091/QE/BsWO80KuaxiDHx39gLJSot9apetMlVBP0m8+a2gvZQhdtn dNx5BG+b8LyjfBj6FVgp6BBXHidcvuFusP8DXOeSa+4ap00BlDjJ0S2tjZIqiDvbRIZ2 QQUNdOhSpTUVJ/vyEH9wI+2ABAdos/MbI5RDaR/JCms8os01ycL+CBhlH33B6p4aaIoP TU7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=EGw9hIRkwT3tSjEQ3nqYOOdBA4Irx2tY4/xRaMl3SAU=; fh=U6Vf+jVT99Cq+w3LKL/MJRnHkju3Vw6crIGScINHBRw=; b=M4ZeCq3qnSb3F0isutlOhqE0B493FCzTEbS1Zb+ql7Ak95iyUzVSKOJljTx96vFO6D VbPasF55/z2z6XLUawHP3pJ1vS1dz+B46Wn/Zb/zqnUlGM0AeT+1vWovh3EUD5ad9sM2 LHUMEmjs0usxFdEXPQQU4/EzxzzhehMaTCgWIYJ5EIHW2GQuk6z6PYj3HJD2IgVaiDoa VUNYIN4NYunuhkUocObHSsc62Tdt7x1Vw+s3iWcNUP+qJm7AE/8SrhneopDX8+BkGkks ZNtmHaATzG3bqILxkhJw2OuX6lsoBZaDV/Y+gLD1LT+NzkFA0UdvTIMKyaedT2L73z8c 0pCA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GxVzgc29; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860356; x=1721465156; 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=EGw9hIRkwT3tSjEQ3nqYOOdBA4Irx2tY4/xRaMl3SAU=; b=ojJnDPtCrWWFP6S1dD5zKb+kWpNr/wvRA94wJGKl5ouW6im9X0dy6o8SQpVUYQ9O+F 9ddHNe/D8hDrGJ9oDFTUrND7XAN2NelK2TwmeNaxzeTPRevhC5BC5PcNw57q96zrZoNv zAUODzKeBEv7w7wC9eij0bHWCgPaORtkKUVLg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860356; x=1721465156; 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=EGw9hIRkwT3tSjEQ3nqYOOdBA4Irx2tY4/xRaMl3SAU=; b=bkuJ2vWfb9D/4aDrQMyk31HofmLhNQfhhMDI3CRO1u9iflPrEmILzkn0sQFHDLjLkF 8YIPOZiqA/e4NxxY/TC3bELXVLX9a4Z8z8haZC8HaTUE3emqAOTGZNqCcS+1Gi79mgsy 4xIHZX6q+jfqi+B/XJ0cKpN2wKqyMUxtw8JOEMa02SxiRJtSXjfMIfK8dCKoARLatMkS F8a+70k7b9g8ylT+uxkJ7mwYpYyHrP8qWs/COjtSZm/YkED79/E+5igF03R5hROeXIkB lqE5jddFOlyvZ0nAcwWdE61Tei7U4RtrK53rVW/SE5bhqH14d3o/axgS9kxrLbli+1XA xU7g== X-Forwarded-Encrypted: i=2; AJvYcCWBtwg/qy6uJB9J0h+3FRJ+a5ocLmSCb3x9Oq1L/r0TKgx9utE3sEnlAjGJYxwByABogeVNr0oBvdb4OJZYNR+ZoeiRMsg1ZHEAI8Xd83tsaCXYQhjxu8tT7JL+uA== X-Gm-Message-State: AOJu0Yxy/mBeJ5vTncgIqbR1pcE7f6jfvMgu4bMbkJ8ADUDwfEkPe9DC RzFR+IJOWrsp9TsOU3HFvpo2yDdJzZwNceZmgTXJufhGKlorFz3M9hi6YtiP0MGHFQ== X-Google-Smtp-Source: AGHT+IEMLDwUIkwoJAGBqpgJ/9G4JH2k4Wkq7Za4fpJD0lQRC69PtOZNWy+AqF5GVd7V5aZwbDoGcQ== X-Received: by 2002:a50:ee0b:0:b0:58d:836e:5d83 with SMTP id 4fb4d7f45d1cf-594ba59f8eamr8185667a12.22.1720860356580; Sat, 13 Jul 2024 01:45:56 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:2188:f507 with SMTP id 4fb4d7f45d1cf-598267117b9ls1569831a12.2.-pod-prod-07-eu; Sat, 13 Jul 2024 01:45:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVMIXWRegLr6+4qZvPKvM9pDZQt2G1gGPvx+YGCT1M9mQ2aVENjoArnQhEk9JDSepqY7GBfEe9O5gPHmf43eofh67aBOLR1H+L/pnb4JA3qvI2M X-Received: by 2002:a17:906:260d:b0:a72:b287:1e04 with SMTP id a640c23a62f3a-a780b70106fmr762609866b.34.1720860354876; Sat, 13 Jul 2024 01:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860354; cv=none; d=google.com; s=arc-20160816; b=y1FxbRfhQvJ9WQESxupZG38u3nvWmMEBkRMT9Yy5iXXU4aHV0sc/GsC1OhW/gdpnCw cs50Xzj6XjoRXeqWvE+Q32lMonkEBr/m0vIGvFmlwSdkfCX+Vx0P6iXCxdtSEvjo4+iu 9MXhRZ5IVXgC6Cbhp2Pm30anFhUjA6JO20l31bMVGng2/MzKWWg80IrPIATtYLLhq23Y Jakhe3X1ZAKuWAbvmzPwgDykZTUEqOkPEyycQLJ3Hs+wb2LdvdWOUwb+o8i0cijCEz9Z 2JbsDKuSNJFpSjFLvaj6RJ6k4luK/wR2q+MKan6WleucxvuWWPUUtFOLwpLDQ0stQQAO 2Sew== 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=Z3W0hoRpyMm4WoJgMyNV8HWNsiT1Mc0t5TiaWe9taTw=; fh=C/EzQxJh8QKJud29KecolqYGROV4Cj/h1Kc3niIfg18=; b=YpaGDGsKJA4jyXs6npBp4W68vVIAyzUt4BpyzB9VZjyuWfcOEYj7AFqpYaRVaJIarb oil8GlcJGk+Hd/PwJp7r8kNVFpMfuXUtWrUJ0h7c32tgbPcGu2EcPzaenS7qVHYw5AoY 7Et/lVdZrAKHkaDoX3FGLtW8VCMfx1QRiTnEA6puLdMcS0i3VSQ2YAEbxz5ZEL2i2P0r fwEVRHLOIF/4Lhk2PYY3o6VZC3XBzosrKxi3L6BOoyIy0ketGYtziku0i6zxY50NSp3M r8sgZNQ0omvVqS65MKaV/zMo1UzICokhnQ9jI1jfmK2IsBN0/1GDzR6LiVK6Jk5S0YO0 ULsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GxVzgc29; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc588acbsor14183166b.2.2024.07.13.01.45.54 for (Google Transport Security); Sat, 13 Jul 2024 01:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWtyPxsu7QCALIvD7ju2pa3WgqXeT5xN8Fx7qBdgQMTyj2NPrBuRxjXKRbqODlne3freB8xNrYMf89MHths8XctYVx6AWN6KqjiFXRcSzwDZiaB X-Received: by 2002:a17:906:3ad8:b0:a77:e48d:bb1 with SMTP id a640c23a62f3a-a780b68a2ebmr761278566b.2.1720860354353; Sat, 13 Jul 2024 01:45:54 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:53 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Ye Li Subject: [PATCH 14/21] video: Add video link framework Date: Sat, 13 Jul 2024 10:45:19 +0200 Message-ID: <20240713084526.922537-14-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GxVzgc29; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 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 --- common/stdio.c | 4 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/bmp.c | 11 +- drivers/video/video_link.c | 533 +++++++++++++++++++++++++++++++++++++ include/video_link.h | 19 ++ 6 files changed, 573 insertions(+), 1 deletion(-) 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 a61220ce4b..66360c97ed 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 7808ae7919..d2432d67a4 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -798,6 +798,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 f3f70cd04a..9fd3645994 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/bmp.c b/drivers/video/bmp.c index 291ed36440..3ac835d45d 100644 --- a/drivers/video/bmp.c +++ b/drivers/video/bmp.c @@ -17,6 +17,7 @@ #include #include #include +#include #include /* @@ -124,7 +125,15 @@ int bmp_display(ulong addr, int x, int y) } addr = map_to_sysmem(bmp); - ret = uclass_first_device_err(UCLASS_VIDEO, &dev); + if (IS_ENABLED(CONFIG_VIDEO_LINK)) { + dev = video_link_get_video_device(); + if (!dev) + ret = -ENODEV; + else + ret = 0; + } else { + ret = uclass_first_device_err(UCLASS_VIDEO, &dev); + } if (!ret) { bool align = false; diff --git a/drivers/video/video_link.c b/drivers/video/video_link.c new file mode 100644 index 0000000000..52d37e8230 --- /dev/null +++ b/drivers/video/video_link.c @@ -0,0 +1,533 @@ +// 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 = 0; +ulong curr_video_link = 0; +bool video_off = false; + +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]; + } else { + 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; +} + +#ifdef CONFIG_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 0000000000..5350bfa9e9 --- /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 Sat Jul 13 08:45:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3221 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 2392D40F45 for ; Sat, 13 Jul 2024 10:45:59 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58c38bcd765sf2276715a12.1 for ; Sat, 13 Jul 2024 01:45:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860359; cv=pass; d=google.com; s=arc-20160816; b=mKFAUdlbYDKJqeyKxNP/3qVuQQ+lBWcFYKdg0cUpfHuKiAEnTKXgD20a3oo6mMwidL RLU+eVBOBhaGlGMvN5AyCdREIXy+LTZJhQ80gIC7IAZ+qvJH194r7VoaOdU/6kBU2/V0 8sKgJw8/3OrjxyWmqziXAIbHy+TolzJY2R3VBrF6t/tUW3Xh2h/eLawDfXZgbheeYMxl zsBy4zoKt43bCuhVJsaVUEc0rAcj7gCto3PTyrkgqUb0bIQo6hOZpv8cVmO7v75ajMUt ljSbD/e+9C5j2XeSnIrxcMl8I4gsH05p5Lsdj6pePxj053Z3j7IgSH8ZMMdinmZwNuGf EFBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=MRXg1fUr7XdBl6XUJ6jNsXS8plF3TvfQ6XYHmhnROGg=; fh=js7IXGd3JW3wA7xkqNx7VnfTouOTSv4JcHfpH9MVRcw=; b=ZTFi11U9b9E+ypmPTuU7AJhSNGmRC3rJyqFhd1MYscCjMLVFMe5Rqvt5rW2HA4QYnY evvhp+iyZCVZvzGFbWOSPzW049ct4WMQ79Zn7VS/9uo454a7Nf/vD37EHOPQXVE0tu6g EP0zqE5tFeKmzBnuIYsvN1Sd0Os7xerP9IVZwYpvaNV1QLbBCQv0OsVdY7DVYwRA1aPR Rof+zUHt7t8ew+UhuXBkg/hiWaQ9KW1Rqgrw4RmS13SATPgwCaGY+R4pp25IXEyd47eM pxxysfgSJ7cdxGhWXPNO5pCGfT/WcjY9PCtZ7XD0XsDn6cEWntOIt0ZTYn+sv7uFfP0p Oq3Q==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BuIYNrAI; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860359; x=1721465159; 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=MRXg1fUr7XdBl6XUJ6jNsXS8plF3TvfQ6XYHmhnROGg=; b=LDvyLyFOn7FRvkNv4A0QtFGSxMENKFJRFWtAJOUscz0A+/5uYQS/5sKmVahoJwhQJr LFyeI2gK7Oq2TjOU4iOPrsbCRXrbNVJjyEQyqhBx51dV/yFEZaknJQuCbEwpJPbbblTk FbZiVxq0XOb7GO8xtEVJNtypjYL8gfwnIILi8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860359; x=1721465159; 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=MRXg1fUr7XdBl6XUJ6jNsXS8plF3TvfQ6XYHmhnROGg=; b=bsjhCgIXhlkc3IlfmY7wi09O8ASb0kyIs5FCTBid0FMY/QJTl8h1PDgFBRhpYen07/ EqrkQ1ltXFvY9vyNiqkGXK6sr7/NOBfSN4X1qPKiiOBM4nuhCPTJZ36ia+O9/3+PepIX vk4dJYwaGmzuAAZny1Nwh+k23uqD+7w4C5u00hjbYJF92iyr5weohP/wxFX1j4Sk0h8t 6WrZRlb+2tgGFYYXDeisW+BMMdAB6og/Ar2CNllvQ5/eBQJkMqATfpUuC9G35JBEm7pg E9hWnI/Gm7nHoevzMyWzwBUCVGT7WaNk7NaQVNGf+c2RZ3HUaYPLAziS3fRmebYrH0hc tHWA== X-Forwarded-Encrypted: i=2; AJvYcCW53LvDxdl7Eu3C8xQkS+lHPJsJsZh57aDmcEAN7eQl+rvvC24EvwJMSvGrqpKnysv+dYmIs26HHSORR6yfjSrCrBD8yY9oP4DblEzLReuoTcJ8FtOSFwgOmJK+1w== X-Gm-Message-State: AOJu0YzUybsyHe6Jz+QgCHmtKaTanCJrlVBXpfWZeT4p3qYoCLF8RPGc G24BsC45uNdU3a+HMoNlYLxuWt7NMNYit5p7lBxmCB1zBkQsyyGB2lgodi4+RRCgtg== X-Google-Smtp-Source: AGHT+IH3sZd/qY8ou+jNhk94pn+6sufuI1/yrlT5itamPxqGCXw6q4Cp/1nxyggK1Ppcp0Kq1kciGg== X-Received: by 2002:a05:6402:231a:b0:58d:c542:2500 with SMTP id 4fb4d7f45d1cf-594baf87753mr7201126a12.10.1720860358778; Sat, 13 Jul 2024 01:45:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:58b:4780:bb2f with SMTP id 4fb4d7f45d1cf-59826710febls1371326a12.2.-pod-prod-02-eu; Sat, 13 Jul 2024 01:45:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGDmwaOpkdWrFhY0VZ3BAajSvH5pxhdGpw7lcVOu7NWwdOAF3wffwqp4LF7qlGNxhwtkPLmXaiXP7zaZHGFmxGzRddfwkzVndKysGC/0uPba0O X-Received: by 2002:a17:906:6895:b0:a6f:718f:39b6 with SMTP id a640c23a62f3a-a780b6b1818mr854890466b.25.1720860357088; Sat, 13 Jul 2024 01:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860357; cv=none; d=google.com; s=arc-20160816; b=W3f7NxjDGQ6M0pY1bwsGuAZAKD7ZC7jm+QXEM/Rp/1EqCc+oerCJR7vzLeKzU0x0vX qX2h9llNuY2ZPypriVBLyJ38LXL+ojjZZW3Z8qDn2LUdbWNIcbKy4gnPxHq3qycv8XO0 t+N3KSAUGNWFk/pB0w904kXCsm23YcDaaKB1FrXIjYQ/rkLWvJmap2qzS3UH4lvXyeFV aqwmtRz78GDRip9q0hj1SbsH4uQeXSMUYxkKL00umtao6jSRMwaKTDPS5iOGvHuA4KCY WwL9UXEL9HaP2gVzsQQBVvZNiWKnO1pJ+WhTUhrW+8JU2328mYbuwSRC+Jx5Re+WVw6d aqAQ== 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=TTOWBx8DMPu8LybIgtKiJrsWkTkUWek75Fh0Xk6RnBA=; fh=T0eakuPA9/1C/gYLfl/OKloPLpkEw41bA0DsBXHV9bo=; b=jLrttqJQsRTMu3XGU1BRVo4YPsIE6HkWMxbM8XP3wGgXKTYvmkHkGH0MrPvMOXla2y CIhPY4dc6cUarhXDXIhKRVa/BaI5sLC2t6OgbW+OPbvZr2PybFUoEgxXLdwczBRbUtKb SM/doRXGLyZEXQrKRnKhp83aLCSH7X/P8Lr3AdLLw24lxy1CFNrbl1EwylVjqBAQa9pU XkUoxImCH+GWHhK1V7RGWjid3ubE4Nzzcnu7l0f6qmoEtPs603iW8Wt9VHNeYxGMPKuv T1YmhbK+x3E+dxhC5NIyrmsGj9mMZsEYtXzIjd8weQLyytiAXi9CDaPj+B3VSc3mriaF av7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BuIYNrAI; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc950436sor14164266b.13.2024.07.13.01.45.57 for (Google Transport Security); Sat, 13 Jul 2024 01:45:57 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXHeQE3qboPg8tx6N4bU/vBe+A/cCH67vV5ar3rsm5nIGd+tgi0cuRsfUNaIOr9LW4cDVz6hailSVFtp1/r8UGZOC4iLgB+DuebkbI0j9CgYWR2 X-Received: by 2002:a17:906:4a54:b0:a77:f2c5:84bf with SMTP id a640c23a62f3a-a780b6881ecmr822211366b.2.1720860355619; Sat, 13 Jul 2024 01:45:55 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:55 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Ye Li Subject: [PATCH 15/21] video: bridge: Add check_timing interface Date: Sat, 13 Jul 2024 10:45:20 +0200 Message-ID: <20240713084526.922537-15-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BuIYNrAI; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- 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 2084a2e03e..7432107238 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 3b429eac57..8b71b04a11 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 Sat Jul 13 08:45:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3222 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 3D28540F45 for ; Sat, 13 Jul 2024 10:46:00 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58bd84067fdsf2687714a12.0 for ; Sat, 13 Jul 2024 01:46:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860360; cv=pass; d=google.com; s=arc-20160816; b=LoXzbFcMxa5cRphSCJ7CRHm7N7uR8iE3P2sTnvg52Ph4GODMgr6DfActbisHeU6ETe W+eR8QFx8g+D9QCA4gp8nC9AtzGba/f9abfLWjlbW94OWbUJpcbsB7B/qnFsDY/vhjSq rGg32QRfS4yLfk2QWJH3I9np4rlTvHgprB0zuIkA/kVafE9+qlCu39rWj/UFUtKewmFH sgLsNizvpfzzvJChmS/iPEPYRhEGB5QA4Oj8/OPhN5bb5OVBeTGhev6DRGszmtuI/jbS SG9X2j1LLBqM3iBLNmXspT6EQvhJ/3Jz5ng9rIyxW/FmobErvOzvY94yFbIqk6oa6WOP mVOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=4xfP90RdggRJLNG0N6//LJOQdFV/TURb60b9BTLPZ64=; fh=8f0brc332PQup+qAdBW2fClBUXe81QIl359vHnpB3yI=; b=aFj8ujityWVwypjmYSMvOQuyrTN6inS/Nq5sZHkc4M0lzk1OoprveEbMvILsGaCvL+ ceOIXhpPz1ck35M50GPB957AAeCRiEViLbbg7uCHODUBwZNngIksjd0kmTeIaBe0Me76 WrqlW0NhLsPKLiQEokYUNGQqVYAjwaiPSK+HFat0tsbYjmRN/q7fADpvSUIjy7L6DiiL Y/iZIIaEGkFUHLHI3tg9E+XnZaTYwh/CAi9gnKmWiUcAgWsXgdUfitL3k7F2vZ/BiXVY BqPc929jMqx/lf9EALNkD64XiXdvdn/a4EjSLlmFyhqfwQ7xKSd8H1xfHGm6/1jkqzSK KnZQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=g7rePXUm; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860360; x=1721465160; 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=4xfP90RdggRJLNG0N6//LJOQdFV/TURb60b9BTLPZ64=; b=CiCq2UfX64EXJwnyTrFfdfRF9e8kWjeDhjfv0XlwOWVvkTpIteOpeP0P4WKXXM94td YSkHVcxZxhMXxeMvqohd/LsfifFbP+rIu6tgrOwsy/R3uY1uwDG8HkMhzsEAkGlclKCg NcXj0FZv/8WSCz3hrkDMcwVNF38FEN3Ad3Kuo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860360; x=1721465160; 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=4xfP90RdggRJLNG0N6//LJOQdFV/TURb60b9BTLPZ64=; b=aMbsHnAx0piwf5xFprZXN0+uh/17cR/poRt5jiUrMT1KknwR3H3i3DXaYEuCmkysSF c0TvrukQkNxhIqNOkWw9uMBrfC5oTEaIm64ModaggOBkt8IazpP7sAHlpKm+CFms4Mcb E7ZsucVBsDihp4pZioZr2zAxxS8a8bos9IRVmWsZRXqEuBUoWx6EVpvhtqnjTcxi/dNJ E0bY9VNvnD/CR4SpOJeAsuj3qTEWuscpfEUXzz1/7IMqVY/QlUG8qCZO55dJ5O0/qyik jwBNETYcpn/f3ZNqO4/dF6E+TdMGG3eHSoFTN6bKenbnL3Z+sSMo21sLn4L9hqDaatWO MPbQ== X-Forwarded-Encrypted: i=2; AJvYcCXrQn51JG1D206E6G/AFH1FERMXHrovfyqDKlhG1JAdLDzuKA1XyqvuFfUW9++T12xnfRpPKFw9e3tCssQy2+eNJPdzgQrBxnGIQwcY/G2fr41CHpqX1HghBAgfGg== X-Gm-Message-State: AOJu0YzU58F2wT4YlOek8Hha+v3AzzMgLIzkA0+BXj4d0qSqouHWCeCU JKtzf5QTE0Y8145HWzmaD4D49ugZXgxHzwiqWnStX5RLLGgFV8ZSC1d6o2zkyh6OuA== X-Google-Smtp-Source: AGHT+IEBSwkb72l0sn2uVQEdIaq8ucy1Ulw6vavL0pD5+So2yXihXNIgHOw+o31S0ZrO5rAIWMRSPA== X-Received: by 2002:a05:6402:50d1:b0:57c:6d9a:9149 with SMTP id 4fb4d7f45d1cf-594b9ee143dmr11356906a12.15.1720860359856; Sat, 13 Jul 2024 01:45:59 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:28af:b0:584:b54c:52ad with SMTP id 4fb4d7f45d1cf-59826225ad3ls1441575a12.1.-pod-prod-07-eu; Sat, 13 Jul 2024 01:45:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsJ7LTYLsWgIHxxmVZQmDQq3dfZ1+T0rFtJFA4DzSwFNfuPRLwl40nB0He/NjQhKZhrAwMZpdE3t7XEv/Bm/xMm0sIFYDOvg5uFqCHqI7+9HyK X-Received: by 2002:a17:907:d8a:b0:a72:7c0d:8fdc with SMTP id a640c23a62f3a-a780b68a311mr1129187766b.14.1720860358238; Sat, 13 Jul 2024 01:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860358; cv=none; d=google.com; s=arc-20160816; b=tXhxk5VBZTIVJZwj/jDXKGd5stbMhJi+QwZ7+xT8sn0ZLJY8HlQHb71MYgRkZlSP/a 8vCJOMWtf5AaedoJRDDh4JGOgd/y2MZAzUqlcwSJB9q7uzoMXreGC+t+GJzJi4KlCLCU ALP1ncm650jCyi5HOb/QpIw4DQUHD+oOPPAxGnMlz5CCZrGF2zObdTn4ai4HmqDBkTXe H4at4jbKtMyynx/Sg4CUK/QRYsAbjJju/Yikd3m0/bimdmLzlW6x7VJYhwP0ZUFTq5PQ NyK1V43U6EfTv7751CcUsCbAXPeEvONX4iAS9HVacnlwNJn1ABFm4Jy2HhGqUBZRO9kh E94w== 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=YxMxmC45u6BRcdQ8JSeIqRT2MubiYL3G2YLSKPpcuPk=; fh=34GU1C+B4cwIhIHqVAsT4G51ROrDI6fT29/7rSljN+I=; b=AJ+F6V17m9Vjwv2Jfu1dOwivZ/8X9ojH5H7TnRI42mf9AkC3Ey5YchKZMRR+YwjLHD futmTj8uDiYp6ZJBPYpuQNtnTPHNo0qBx0IQiZGjxb7ADQwKtabfm+KCMAcU6txDoYxU jtwhdEyA04VmXpjDSeq0quT6eZTKRcEyPwcjgMfN07tIi0yJ6mljqoZpe6GIdpjqYJ5g SYNkhYlgB+XYaMZAwGSK2JP0ofHZR59khvxhK918s6QroQbewiBwg6fE+D9SRbh1cj5z smRJ1CDZ02QMI2OKd17dMgqN9uDiF+XELkIrjZrGP8gdccmarDsRvJKSxbkYkfmjEW7R 81zg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=g7rePXUm; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5b7df6sor12428466b.10.2024.07.13.01.45.58 for (Google Transport Security); Sat, 13 Jul 2024 01:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCW/n8deMRpO7emJrhgRDhXE8FPIeqHVuWenZAvu4mIM2vXGaFrIJ0WfIrOvh2if7gtecL021AuiiDc0OL1niUYM1vlfKqLw7DFb5vI3mbN0YXBx X-Received: by 2002:a17:906:d195:b0:a72:b4c9:2be8 with SMTP id a640c23a62f3a-a780b89f634mr750709066b.72.1720860357902; Sat, 13 Jul 2024 01:45:57 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:57 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Ye Li Subject: [PATCH 16/21] video: dsi_host: add disable host interface Date: Sat, 13 Jul 2024 10:45:21 +0200 Message-ID: <20240713084526.922537-16-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=g7rePXUm; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- 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 fde275ad7e..745991f8dd 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 83f8839db6..5873ab698d 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 Sat Jul 13 08:45:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3223 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 23C8340F45 for ; Sat, 13 Jul 2024 10:46:02 +0200 (CEST) Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52e969d34a9sf3184856e87.2 for ; Sat, 13 Jul 2024 01:46:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860361; cv=pass; d=google.com; s=arc-20160816; b=g0r7c00bRHDbG8XSHPu3cKgXeQbf1PukND5IhHowbaZYxieVN8Cvj09LhpHLlsnsku 3iCBYOhzUo+L5vE93c4k+g+rm6C0cyCgnf6AWVd7Ynl8SVzGZTXwacuYT85HpN9DBLsR 94mRfYOsKY2iV0yCs8xv24TH2rBVeZ+1m0bGOtaHJqUeKHz5xk0e9XlKYWPhp5mQOCEC EKM+OVG9duAkNi5CmmRgyCr2+m+AsgzaGUeBFGqUBoUjT91IkcfZkhuvgMFPyalM/WAN vEnAk9O6U9uIwI3q2Wlyzb1llPNg4j1DrxAYVOvBLhllQa9XYRJdpd/IsWQxA/5qv66o VNpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=krP4NUGSkeUMNK8SEII3obvO7Ty4Vj7hFPOtuUS94Cs=; fh=piiZG4bYg+VUnUmbFj69Lv4Lk7Sr4CshsOClnvQC8/Y=; b=xd9p09slNMVk7I8rJsaLcDClHEl2IRwqGqyvTR5ywy1qzZzD+LA0YymOGhaG1eOQuu rJA4zPlb0izm4K8t1dEXrXybzvWWmgBKZxLoMTlxnL1ZAsDwn5Zfko+yv/v5iz9CeyXy 95scynITXd7kidB1t09SILEFkPH8T//dWcXZivBA44p8shNEwKtuhVtHjpCTryqdE7kz r0/BLJHJI1Jdnhq0bhcPPEa3kiZbZVJco1q2pxoEglf32oyKuIA2NT6RxE7ZT3h7r03X vDPOlf2VB3ZpT1iEsimfc4a0sZyXV2Czt8Rew+859q/Ht6E9xU/ZEJdpAx+DIVe3AVm+ ZIkQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="JkSi/f8R"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860361; x=1721465161; 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=krP4NUGSkeUMNK8SEII3obvO7Ty4Vj7hFPOtuUS94Cs=; b=XNviO2IrR0LofzHLk9cWce2uH5elKgAt+5njyra5uChU+eedbES9FY+2mOcab6/IlB TGyM9oabY5clMgp9aLDBlljgtuZmanQgpm13rX7w4vw7FE+MR1bnKw09CPhoiU74oWMV +l65ZnBMoNCzwrj4YggfKH5NoA4L5/h8gwYLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860361; x=1721465161; 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=krP4NUGSkeUMNK8SEII3obvO7Ty4Vj7hFPOtuUS94Cs=; b=Kqz2Ew+RCY8/CZua+Voq2O0L2vvwV2VaWFZ+zRTLaFZBAyLs2V2tdq7MqlENMYWOE4 Aad//v1W7zKaHaJIkYf4LouOs8qxonlR8aFjk++NOasvPfLgq6lt3lUN56EuapvQQEDX ulfv5KwHARN6RODjlo5JAzkFgzFb54BkxUhHxtbBabksMeAwX67/Fntm/ibbuXIdmgid 8KoCllazx42OWCCDvb7+ZcQKduSPFz6Je0H7Mza4kjCJ2THek/2A7X2MRkJ5ta2FV0ah fcu/2kWsvmjbMFCyGl53UsTW5Lskl+fabp29InKsEl0cWMAmetUsJ5mlhJPYodJU7MR9 kRRw== X-Forwarded-Encrypted: i=2; AJvYcCWEYcBke9UM35TIDfgmv0QwFH2HJoGIUSQ18/ZprkruLxvL/U/AgmNJq2lRX+QvY1V4vULw8ryej0P38+D4s8xfZB7aWBO8jN4KOQhBakDKR3f3JYM8JVqVL7ZLNg== X-Gm-Message-State: AOJu0Yw9tORjOr7LYh20bnQ2f+uNYOZ5+717e4ucxTua65oRTfnZCqGA v7/sAH64A0egdiuczrynlZ+o7WSdXZxp1KNy5RjAqZVJrqx3NtH7SQd98ixwDgNzMyeaTZZuoQ= = X-Google-Smtp-Source: AGHT+IGCRpIM7Band/9oHqu0GPyeN6Cj0XQpElrg2GG5LuC7GpRdMQUDjFVz3Z8SyKkNUCkwnqIS5w== X-Received: by 2002:a05:6512:3c9d:b0:52c:84ac:8fa2 with SMTP id 2adb3069b0e04-52eb9991e70mr11190717e87.7.1720860361632; Sat, 13 Jul 2024 01:46:01 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a19:ac02:0:b0:52e:97da:24d7 with SMTP id 2adb3069b0e04-52ec4504d84ls1501742e87.1.-pod-prod-05-eu; Sat, 13 Jul 2024 01:46:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9YLqLg4Q7TaCCwdjF8DpOkrfQmw+2M5L8X3GEM9T8+UyZ5WgIa2WCKE7Ei0mDY0jhVcXItx5Gaxbj+/T8HsYeLgTfrxih4kEC2svKbWxAS/wR X-Received: by 2002:a19:5f4d:0:b0:52c:d5ac:d42 with SMTP id 2adb3069b0e04-52eb9991e65mr9414962e87.9.1720860359641; Sat, 13 Jul 2024 01:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860359; cv=none; d=google.com; s=arc-20160816; b=Jj4TysIpWA4mLWjOti2BkCTTvTLcOP7OtNsslP5oWpXsdO0i8AR2WYDeI9pQ3TA13k FAIGdnCQ+XgQu4mFANVpGi20FCLaP1V7ubH/GKD6q6vv3eNE8WKmWxN+YLJix+6i/M82 KH3Rd2sppOIujuATcWnZHvkIkM8BqAg348Dkbr24nUQAjyFlRaWaBkaGtVVE5reZZeSt bOxtXA4uBeqgWdOJARjxb6JdtUkHbZFKaduXOqTRe1s1jSZRsPaNGIseDexqpD7yvvEq LMch7hWwBEio9qFCE1QoLqgwlm+4nMPiqTKUnkLKAIlK7XL4NIA7pxC+nThg5I44Nakk yHjA== 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=Hmbbxb1F+DyFqKbkxqGn2PPIwpqkWAvkpsklF4VY2yo=; fh=djMPBp3h5t/g3kNNKl7GoXFBv67ZwMAwZrO2SS7uVRE=; b=xGq1TezhxkGPR1tixollwXF13wbIISRgGCFteZoNLU06P+B/kWGLim0Bo7icWkPyUe m8TZQwdTg8pYKE+Pw9KQvAg+DO0QOYEzH4qz+lLYfFbvOmnshDGQkG/x8J3vFZI+j2/W 8u4UipAdAAGt1Xld6OFi/VhDNbpFr5ctdTlCDC83A/x4Ger2rvDLbI06H5CbI/pjCPdz M+dybc19h1OWjBKeLNk6U9rMSmeykX523Mgku3fnMZ9baZqeE53f7m25KM4d6mi0EK6X bBr7inmjLbC5y0lmmTiylk37WI4WUsU7TBD4ZdyvvpRRkin+nIf9lf/M0qMQIi/qaH8P lo2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="JkSi/f8R"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-52ed2584e9bsor130657e87.20.2024.07.13.01.45.59 for (Google Transport Security); Sat, 13 Jul 2024 01:45:59 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUer+M9JqfsmSPvJ//g4BoHAsaqka08fHOHhyCTgPNzljHnDMOHBuJZ4gCrqDFrngCyUtPuJVHz+/XRZnUpEsfU8uADBruA0M3aW+NTiZNMOkwy X-Received: by 2002:a05:6512:1286:b0:52d:582e:4111 with SMTP id 2adb3069b0e04-52eb999b398mr12284817e87.18.1720860359163; Sat, 13 Jul 2024 01:45:59 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:58 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Ye Li Subject: [PATCH 17/21] video: Update mxsfb video drivers for iMX8MM/iMX8MN display Date: Sat, 13 Jul 2024 10:45:22 +0200 Message-ID: <20240713084526.922537-17-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="JkSi/f8R"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , Update mxsfb for LCD video driver Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi --- drivers/video/mxsfb.c | 141 ++++++++++++++++++++++++++++-------------- 1 file changed, 95 insertions(+), 46 deletions(-) diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 792d6314d1..4186ccd002 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); + } +#endif + + 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,14 @@ 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); + + debug("%s\n", __func__); + + 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 +435,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 +448,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 Sat Jul 13 08:45:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3224 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 7652740F45 for ; Sat, 13 Jul 2024 10:46:03 +0200 (CEST) Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7275e17256sf253158266b.0 for ; Sat, 13 Jul 2024 01:46:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860363; cv=pass; d=google.com; s=arc-20160816; b=YV43+5xBRrQXJLnC/o90bFyA8gRM7hi4Snc2ofRph7+BF8MsmhqETX7ait0L9yKzPg Fvtkqzf1wHM6JvqjC65xuDhw6NopcyizNfdpeKMbly9TkYmD7G2PTFJfMVHvSnwV0Krr ENwSShU3q+vb/2Hd/lXPh9LteN+knLqy0r929Td7udUGa7qyFm/hRxWR6lZPGGRLxRwG NVLANWH0lrPVVrmddSUR+rgKwuOTJ2qZsTB+QYXCArZZMaI/0wQMo3seN9J6shTsOP66 K8JBw6zsZk3Yxi7BZSwSZS/qekxrvMRSiM9djrfpHaTPhZR8L69FwN1QWUMDJ0YrQ1SE XEOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ycPE2mlbSQubwQNcEx96JIiJkd7INBcE7JRwNsNWzt0=; fh=4EzI/Zo9Yl+fUFsvx5eFaOA9N9RcHWWxzHFQ83HJufg=; b=ewwCbmGfxkdIoXp/GvJqdS2BKuAnyxEg3ZKm5Wjioa890IzwFDL4vOL0VZ/6zL1hvY UD5ykEULKZEU4nQ1CbiLmiYS+V0nnwILhdmb3Ieo+2Lk/8bZfgbH9xoB4uL3lfqUq7rD Tv+QyT3iqJrmoVNBF2jVi3vJXRf35n+oUMc3zAaKLFK9d0YJIxX+QeiwickV0NMT9jxc GXM9casSg8pLBfjGzBF2GaalWTXORM+O8UxEgcY1ZgqwHJQc57NoUANZ8cZffMOxAwad LHUtArc73cvBtR49FgfE+cd7K5pu09eTalV2RmEyQnIeMnGgoPercDFslkHYBspY+jiA iAzw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fxae+eTW; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860363; x=1721465163; 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=ycPE2mlbSQubwQNcEx96JIiJkd7INBcE7JRwNsNWzt0=; b=Wm8UMMN6tULkJO0AiN90FUNPSKBtt3kkl6eUjk0ow646g57/GZlWdhw6mLHvGqw6C3 EyI80wHn2/KWE/6bgmiWAGk32B8vMfDYEmyXWWLIY9SKAhbQRKFpNltSC/iwPk9tHyAe ck0V4TgA5+3AYFfNdsOHLyHxvm5Ewkvp/L5kc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860363; x=1721465163; 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=ycPE2mlbSQubwQNcEx96JIiJkd7INBcE7JRwNsNWzt0=; b=qfOpps+flS8xduRSt+ai2RMtWnwlFQVUIfrHKQfXuFHvS63cWPEgNSiYM5b9E28O6H H840W3ECAg4ZCdfASy8+YD7ChaePDwg2QDlcROcVUJGNOj2e1QCkRtqyihKjKKcEiAYd +KNr1Z0Za+DojJjgrmkhmb8TeDumz55hq3HeYpYgvPPmXfhQEcpQ5nky8W04vrcbX8Q1 Oa8NQS9FRTTByP2DgmhO6S22lX2rqrr0pcwpWRLAc2ZE3a6oSQdJSz83TdSH0XlRiVv3 +ZJiuBwBVFCw2M//Mhh6o2xRas5L6GPMLcpzPqTI129WoZta4kD4miGgemcroUvixTNK M1Ew== X-Forwarded-Encrypted: i=2; AJvYcCUCDegMOVkjFlXc7Ur6RiuGpXL1mYLtdSYV5hDItArMoNgZiGAWBsOpQpqpVx8dsOujSuNxn5Rv4r35T8IpjLT3OcfWYk4fPDWDE6IFAIJ2J9Sc+8QBv7Zdwr0fbg== X-Gm-Message-State: AOJu0YxaVxM1PjsAHKHCcsVYMwpsx4xVyCekEjX1mwzLG1j6vgOYoH+a N+PdhcRCTOV/9Ks9Wm3x0BbrcdMyJ+2Q1Dc7wA+B/t60TOly3TOPIDoh4HppEytxow== X-Google-Smtp-Source: AGHT+IFHmvsDegXecrMKzPyimWwCjSgCkj1QcZ+phk4IEavuofQfHsfI34qLgmXPudisy/qGdx6iog== X-Received: by 2002:a05:6402:2c4:b0:58e:4e62:429b with SMTP id 4fb4d7f45d1cf-594bc7c7e95mr7936284a12.33.1720860363139; Sat, 13 Jul 2024 01:46:03 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:df14:0:b0:58b:30e8:e88e with SMTP id 4fb4d7f45d1cf-5982612f082ls1145301a12.2.-pod-prod-03-eu; Sat, 13 Jul 2024 01:46:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXXm8bM7YvTwiHMr/LCr54tfdvLJ1yUw1fDO6W87mp9sxlxkTbdWg4jf8UkaWfxRcqndrXUbnT2/HXqTarg1Ttyi1wX4ZGHGYg6qcEE1DymOAIY X-Received: by 2002:a17:906:3090:b0:a77:b410:b1ed with SMTP id a640c23a62f3a-a780b7016aemr846299266b.36.1720860361222; Sat, 13 Jul 2024 01:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860361; cv=none; d=google.com; s=arc-20160816; b=NpQHCKxIbybDXOQB7Bnvn0AR/wBKgl2O5rXzPipX4cviEpblXyzmw+VotGiGkmefJY PbWTTxsDR3EBVbYdZ1OX1QSKrvPf0jCHhY+TSOB9N57XJ+NzsXa2NKSqUN3vIp+AGm3L FYLrGUsPZZ48+QEp83oFvDR4P3N6e6FJJy/PgKNcIGMGCMjRRkbSY+K0qu1eskAxh0cx WJPFE+EVViYRw+kzu5hoyM31tvLvwz4A3HMUaJ/g4hXC6C5LrZCz85ecDumtSCAgdu6e aGHKre2wpY+/4G3c/22q2nC2szGdLpVSUkH5TIhALY1ie94kHsqqXmZKHIS/p21+alZD 8pmg== 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=flYtP2nYRzA7N3pgINbKAREeIoA3rNIfIC69iQgAyww=; fh=f9g0JGECnyXS4MM47GMRQbAViJjPktXUhdTSxmvFNX4=; b=Fx9xNEbvT7M3kfkOAug6UYLtF+RdDX19mRp/YjevyqjeFs/k8ggKFbHq2gmzFnw/KA fMdoG45+ivhKyGsvJRQj8vLe+erOvYC3sfQ+Zqy1sTwEp7HRDKdfcdW+dK5WTc/9Wjo2 peVMXgaIp1lHqOB4cfNZikfIuaYpSJr9Rf+G5c7EyNbQDO92a+7zRinti35uL4QJaZPG GfnIB6SZ515QwXcafTOPO/t2Tx0YyIWT1v3btx3viD4S4zeIDnEDn3UuYXUxLMiqPpeN R50NPWXVB9mTkdMcgl/Ap5xAP/xWGdhLoyBfTeq3whnzU/eehTvVqdBvzJVixtp9kSgP u3wQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fxae+eTW; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc7fcedfsor9817266b.18.2024.07.13.01.46.01 for (Google Transport Security); Sat, 13 Jul 2024 01:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUM/v+FX151v3IZrHry8f5mhDZpBVhtj8m+x0+LQjS3Gbp7YUO453pIVfe6usOusA1O4J2PrPpsaQJeN2f9Y1rAm7hLpK4ddZmVA5oE2SRyfmMQ X-Received: by 2002:a17:906:6b01:b0:a77:dbf0:d29 with SMTP id a640c23a62f3a-a780b705373mr801684766b.46.1720860360680; Sat, 13 Jul 2024 01:46:00 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:46:00 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com, Ye Li Subject: [PATCH 18/21] video: Enable DM_UC_FLAG_SEQ_ALIAS for display and bridge Date: Sat, 13 Jul 2024 10:45:23 +0200 Message-ID: <20240713084526.922537-18-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fxae+eTW; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- 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 7432107238..5e2b76851f 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 61a73e1bc2..07f05be7dd 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 Sat Jul 13 08:45:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3227 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 DDBC740F45 for ; Sat, 13 Jul 2024 10:46:22 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58bee115291sf2793293a12.1 for ; Sat, 13 Jul 2024 01:46:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860382; cv=pass; d=google.com; s=arc-20160816; b=xkhUTynOYYTtlfdsViB7nTuDDzj4PGuD+4MmyWPEk88es7GKcDDCB+4CyQJAupknvc Siv753dy2Abx4FE/+buKKsJht8e1QwhlY4rdP/gbTqTLOm7DdxeUVt8+K7iaxlN1qdcd SsXoCNpjL7OlQ4CDxIaDwEXunA6vEBXTf1ZKGki3vzOyeyM1U6FREmT3tRbIMrBPy1u5 OMZXrbFDPNCtwghStWURIEI0cP8r/6Nq65p7wxtCfCqm1jU4Q7MzYPee4A5x9dTgxevQ i0bEljo2MDL6sAveM/NprDsR4fAJPin3Gh9+zdQ2jJnvUfegUywNlWKRf1H1ZHEarVSM /ccA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=cD3lMb9kzFPRomxgyO/Isjmnbl7+DHBEHKHR/w3cmb8=; fh=gm8LREO9VCeAwoFsGx9ts6QcNqP/es2oe/e0R4thFWY=; b=f0iy+0KFEQ5pRvrtKIOJaIGDQk29SBgfceDwBvdLHeF6LsI0s7G2FXzd0Xd08xl5HW j78okO+VTqUapWiuzI3M1lnwFsOP55nbUrrqt8F5jpj/YyxVLgiaaG8GO8iOAAosxbFM OnxA0PjxNbR+sNfRME7GSgkBuxRX9WbwQNhjR0fIT2GWOprm9/GRHeq9jxxTK1Ll9C3z nHYfxX6C9/93wX1wHrmdOzklDrfktKXV3S4vm4gFFqO/ORq4A2RnB7tMVsbCKbnull3G B70ADFowLfTfSyOqrbqWL9uQ/w9Ob1qXYhSdp2drezbgbe36N9ovcK6nEMdZpx4+6ONW g4rg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZmO2Q3Wr; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860382; x=1721465182; 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=cD3lMb9kzFPRomxgyO/Isjmnbl7+DHBEHKHR/w3cmb8=; b=ePrXgD2r08a4VLZKIx0+pkx/lT6lvVuarpRSeltUdQEF2INQh8uaN5iKIzt5tF0izm AUMzp8q3felWX5p3oqq6fAO5gnlW0dJwwyAWusTqHd9eq664wM+X07JqCwuV4O5Fz8FM VF5OYWaBI9bk0DT1LYcjGiJ/FXv//vX88qN2k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860382; x=1721465182; 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=cD3lMb9kzFPRomxgyO/Isjmnbl7+DHBEHKHR/w3cmb8=; b=Ua7MPxjFK/HEpumT340ATaU1liHFCtMhApRW0DBJr2Uiqye6qmnrGC8EtmA1m17FjY n5piXwtQB8xRdRyl0UFck2euZ5p4TBd0NwhEp7W2tIv+onFXtYbsQX9WrsGep7i4UnnD 04sjFfhK6PgtLptL8CfsPkZH+hcPdmUfISNNmF6nlzsFYNX4sFXu+ccqGw5eLjEuDmCr OZjXP6X/1MJc0xaWR+RmT2qMDSxA4P4REFwImqafbZQaG8RmXIlh9tvcWaoUkKg3IJty JyUSAJLzr0H++gH3UZWlE40O+DrCcGo5s0OyLqu0n4+t9z4EmS3XQu+ZI+cn4QLqj40b IZEA== X-Forwarded-Encrypted: i=2; AJvYcCVmq0Hz/ndz2WjB5iuM5qRTAMDGcZ0yIbrHIJKbEckTY561o2E8Sf2QS45D+X4z4Hpw9wBiEq4yqrZyMRPiaabNOrCMYqkbpE0bCY3SbtYhzSoZgcO6qrLvgb8j0A== X-Gm-Message-State: AOJu0YzwrhY/JgIOKYC8JKAPMZx8uqge9uNmXNAxIfW/2GB5oehvJKRO AY6QVqMvFYkWA23Sy0N4dAW+we/RstgBKGRtj8gvGQ8cS9eDnzR8aNXAIy01vuXDOQ== X-Google-Smtp-Source: AGHT+IFAILI93e/EZgjR/ueumtpYqmHv/5G/WKJTwH0j0SxafzcnoELMgX6/eMJeVrdGyF/Jc7pWzg== X-Received: by 2002:a05:6402:13d6:b0:58b:b864:ec77 with SMTP id 4fb4d7f45d1cf-594bcab03a8mr11768087a12.39.1720860382552; Sat, 13 Jul 2024 01:46:22 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:32e:b0:58b:ce37:ebce with SMTP id 4fb4d7f45d1cf-59825c4211els1025394a12.1.-pod-prod-03-eu; Sat, 13 Jul 2024 01:46:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVZoPLK0sSGS/c/bACxzDkA2prdjTUnatMBARbwHb1KqQGUTkjgaLpo1enNmU293dlvaaqy/64MwBILSIUZ1/8jT4POgRKMgObexCA0mMw6gAHf X-Received: by 2002:a17:907:7247:b0:a77:e2e3:3546 with SMTP id a640c23a62f3a-a780b68a8d1mr1190956666b.9.1720860364176; Sat, 13 Jul 2024 01:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860364; cv=none; d=google.com; s=arc-20160816; b=XBq8B0ytjcNtrrvAZ3yoCHYB9CFrsQILTJg2l4KffCSY0Rqp4LywrWa2PNQOEY/m4P d60ZbGcN9eDOtRYVCzhIT/UZ9H2LERTyH6AZhkvsWie6UcXJJ5cXA5L1fjWFl76qhkM+ sIFklCfA3Dzes5iVLf5Zg3nKg9XcDdXhMADLy+o4vaJN9eErEI8iGYYmgheFhsxjzMAI FGa99MhZliI+0OoWJzUS8P3+joU5K/5w+UImPQwbPdMvKL/eL4yq2s3WBknceKBPXzMt AWhBUftXnNwGg5bLyCeay6AXpaSVsETjc9ZSfR36hTuywVIOOXiK0e0qJ76RX6RlbXzf H3Uw== 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=plHI+GYMAxYfbD7urbscmPKD2fyN/7pw70Cf6Kk5RjU=; fh=tFMEJLtuCaMoW6vlxtkh6Ek7rvQs3Pg1LFMGIQod9m0=; b=ffe3VQUX8g9KVSGRNxvI12sVMpY8GsCCmHOUae8RIuyDwKM3EXZkhVe07Kv3ueui2L n8XVolEF+tq+F8xvN0siTnhfrk97y6EeyhMBRvH0g8Y3oLQg+vuUdhzdVwXcG/1u3SPT ZqTwpmv5wxIsm25OWJ+H8ThCe87HpTkxBxIWOacfT9CKRHHLFz3AFUeQYj60SYl+f3eT 9eJLd1I72p8YBOcVAiKOsWkO+Vihb17xg3dIQuT8Utss05RLuAQEdSW9740RudZ8r9gZ d+/vx6MEFUdjkvFLRsAKK7BjxORSoP4fsiq1/y5Q3tWr+7eKq8VlAthsIp1g5x4CZ1I0 MPaA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZmO2Q3Wr; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5e6fdcsor16408266b.11.2024.07.13.01.46.04 for (Google Transport Security); Sat, 13 Jul 2024 01:46:04 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCW2MRPj8UdQ0nZU1sEUN+oKrElQPPIUbkEnOjF+8vAITpwa4q62MuSnbGTAVWrn94oWDOgxjduTRtk3e9HNd/omOU3qQBIcBp6sscf7TwD2KjJq X-Received: by 2002:a17:907:7247:b0:a77:e2e3:3546 with SMTP id a640c23a62f3a-a780b68a8d1mr1190954166b.9.1720860363272; Sat, 13 Jul 2024 01:46:03 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:46:02 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 19/21] video: bridge: Add Samsung DSIM bridge Date: Sat, 13 Jul 2024 10:45:24 +0200 Message-ID: <20240713084526.922537-19-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZmO2Q3Wr; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 --- drivers/video/bridge/Kconfig | 20 + drivers/video/bridge/Makefile | 2 + drivers/video/bridge/samsung-dsi-host.c | 1884 +++++++++++++++++++++++ drivers/video/bridge/samsung-dsim.c | 148 ++ drivers/video/bridge/samsung-dsim.h | 20 + 5 files changed, 2074 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 ab91727372..a8e31fd2c2 100644 --- a/drivers/video/bridge/Kconfig +++ b/drivers/video/bridge/Kconfig @@ -44,6 +44,26 @@ 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_HOST_DSI + bool "Support Samsung common video bridge" + depends on VIDEO_BRIDGE + 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_SAMSUNG_DSIM + bool "Enable IMX SEC DSI video support" + select VIDEO_BRIDGE + select VIDEO_BRIDGE_SAMSUNG_HOST_DSI + select VIDEO_LINK + help + This option enables support DSI internal bridge which can be used on + devices which have DSI devices connected. + 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 58697e3cbe..4d722cf626 100644 --- a/drivers/video/bridge/Makefile +++ b/drivers/video/bridge/Makefile @@ -8,5 +8,7 @@ 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_HOST_DSI) += samsung-dsi-host.o +obj-$(CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM) += samsung-dsim.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 0000000000..db98eed04d --- /dev/null +++ b/drivers/video/bridge/samsung-dsi-host.c @@ -0,0 +1,1884 @@ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2018 NXP + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#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)) + +/* register bit fields */ +#define STATUS_PLLSTABLE BIT(31) +#define STATUS_SWRSTRLS BIT(20) +#define STATUS_TXREADYHSCLK BIT(10) +#define STATUS_ULPSCLK BIT(9) +#define STATUS_STOPSTATECLK BIT(8) +#define STATUS_GET_ULPSDAT(x) REG_GET(x, 7, 4) +#define STATUS_GET_STOPSTATEDAT(x) REG_GET(x, 3, 0) + +#define RGB_STATUS_CMDMODE_INSEL BIT(31) +#define RGB_STATUS_GET_RGBSTATE(x) REG_GET(x, 12, 0) + +#define CLKCTRL_TXREQUESTHSCLK BIT(31) +#define CLKCTRL_DPHY_SEL_1G BIT(29) +#define CLKCTRL_DPHY_SEL_1P5G (0x0 << 29) +#define CLKCTRL_ESCCLKEN BIT(28) +#define CLKCTRL_PLLBYPASS BIT(29) +#define CLKCTRL_BYTECLKSRC_DPHY_PLL REG_PUT(0, 26, 25) +#define CLKCTRL_BYTECLKEN BIT(24) +#define CLKCTRL_SET_LANEESCCLKEN(x) REG_PUT(x, 23, 19) +#define CLKCTRL_SET_ESCPRESCALER(x) REG_PUT(x, 15, 0) + +#define TIMEOUT_SET_BTAOUT(x) REG_PUT(x, 23, 16) +#define TIMEOUT_SET_LPDRTOUT(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 MDRESOL_MAINSTANDBY BIT(31) +#define MDRESOL_SET_MAINVRESOL(x) REG_PUT(x, 27, 16) +#define MDRESOL_SET_MAINHRESOL(x) REG_PUT(x, 11, 0) + +#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 PHYTIMING_SET_M_TLPXCTL(x) REG_PUT(x, 15, 8) +#define PHYTIMING_SET_M_THSEXITCTL(x) REG_PUT(x, 7, 0) + +#define PHYTIMING1_SET_M_TCLKPRPRCTL(x) REG_PUT(x, 31, 24) +#define PHYTIMING1_SET_M_TCLKZEROCTL(x) REG_PUT(x, 23, 16) +#define PHYTIMING1_SET_M_TCLKPOSTCTL(x) REG_PUT(x, 15, 8) +#define PHYTIMING1_SET_M_TCLKTRAILCTL(x) REG_PUT(x, 7, 0) + +#define PHYTIMING2_SET_M_THSPRPRCTL(x) REG_PUT(x, 23, 16) +#define PHYTIMING2_SET_M_THSZEROCTL(x) REG_PUT(x, 15, 8) +#define PHYTIMING2_SET_M_THSTRAILCTL(x) REG_PUT(x, 7, 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 + +/* Dispmix Control & GPR Registers */ +#define DISPLAY_MIX_SFT_RSTN_CSR 0x00 +#ifdef CONFIG_IMX8MN +#define MIPI_DSI_I_PRESETn_SFT_EN BIT(0) | BIT(1) +#else + #define MIPI_DSI_I_PRESETn_SFT_EN BIT(5) +#endif +#define DISPLAY_MIX_CLK_EN_CSR 0x04 + +#ifdef CONFIG_IMX8MN +#define MIPI_DSI_PCLK_SFT_EN BIT(0) +#define MIPI_DSI_CLKREF_SFT_EN BIT(1) +#else + #define MIPI_DSI_PCLK_SFT_EN BIT(8) + #define MIPI_DSI_CLKREF_SFT_EN BIT(9) +#endif +#define GPR_MIPI_RESET_DIV 0x08 + /* Clock & Data lanes reset: Active Low */ + #define GPR_MIPI_S_RESETN BIT(16) + #define GPR_MIPI_M_RESETN BIT(17) + +#define PS2KHZ(ps) (1000000000UL / (ps)) + +#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_PLL_DPDNSWAP_CLK (1 << 25) +#define DSIM_PLL_DPDNSWAP_DAT (1 << 24) +#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 */ + uint64_t pix_clk; + uint64_t bit_clk; + + unsigned int lanes; + unsigned int channel; /* virtual channel */ + enum mipi_dsi_pixel_format format; + unsigned long mode_flags; + unsigned int pms; + u8 p; + u16 m; + u8 s; + + struct mipi_dsi_device *device; + uint32_t max_data_lanes; + uint64_t max_data_rate; + + struct mipi_dsi_host dsi_host; + struct display_timing timings; +}; + +struct samsung_dsi_range { + uint32_t min; + uint32_t max; +}; + +/* DPHY timings structure */ +struct samsung_dsi_dphy_timing { + uint32_t bit_clk; /* MHz */ + + uint32_t clk_prepare; + uint32_t clk_zero; + uint32_t clk_post; + uint32_t clk_trail; + + uint32_t hs_prepare; + uint32_t hs_zero; + uint32_t hs_trail; + + uint32_t lpx; + uint32_t hs_exit; +}; + +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]); +} + + +#define DSIM_DPHY_TIMING(bclk, cpre, czero, cpost, ctrail, \ + hpre, hzero, htrail, lp, hexit) \ + .bit_clk = bclk, \ + .clk_prepare = cpre, \ + .clk_zero = czero, \ + .clk_post = cpost, \ + .clk_trail = ctrail, \ + .hs_prepare = hpre, \ + .hs_zero = hzero, \ + .hs_trail = htrail, \ + .lpx = lp, \ + .hs_exit = hexit + +/* descending order based on 'bit_clk' value */ +static const struct samsung_dsi_dphy_timing dphy_timing[] = { + { DSIM_DPHY_TIMING(2100, 19, 91, 22, 19, 20, 35, 22, 15, 26), }, + { DSIM_DPHY_TIMING(2090, 19, 91, 22, 19, 19, 35, 22, 15, 26), }, + { DSIM_DPHY_TIMING(2080, 19, 91, 21, 18, 19, 35, 22, 15, 26), }, + { DSIM_DPHY_TIMING(2070, 18, 90, 21, 18, 19, 35, 22, 15, 25), }, + { DSIM_DPHY_TIMING(2060, 18, 90, 21, 18, 19, 34, 22, 15, 25), }, + { DSIM_DPHY_TIMING(2050, 18, 89, 21, 18, 19, 34, 22, 15, 25), }, + { DSIM_DPHY_TIMING(2040, 18, 89, 21, 18, 19, 34, 21, 15, 25), }, + { DSIM_DPHY_TIMING(2030, 18, 88, 21, 18, 19, 34, 21, 15, 25), }, + { DSIM_DPHY_TIMING(2020, 18, 88, 21, 18, 19, 34, 21, 15, 25), }, + { DSIM_DPHY_TIMING(2010, 18, 87, 21, 18, 19, 34, 21, 15, 25), }, + { DSIM_DPHY_TIMING(2000, 18, 87, 21, 18, 19, 33, 21, 15, 25), }, + { DSIM_DPHY_TIMING(1990, 18, 87, 21, 18, 18, 33, 21, 14, 24), }, + { DSIM_DPHY_TIMING(1980, 18, 86, 21, 18, 18, 33, 21, 14, 24), }, + { DSIM_DPHY_TIMING(1970, 17, 86, 21, 17, 18, 33, 21, 14, 24), }, + { DSIM_DPHY_TIMING(1960, 17, 85, 21, 17, 18, 33, 21, 14, 24), }, + { DSIM_DPHY_TIMING(1950, 17, 85, 21, 17, 18, 32, 21, 14, 24), }, + { DSIM_DPHY_TIMING(1940, 17, 84, 20, 17, 18, 32, 21, 14, 24), }, + { DSIM_DPHY_TIMING(1930, 17, 84, 20, 17, 18, 32, 20, 14, 24), }, + { DSIM_DPHY_TIMING(1920, 17, 84, 20, 17, 18, 32, 20, 14, 24), }, + { DSIM_DPHY_TIMING(1910, 17, 83, 20, 17, 18, 32, 20, 14, 23), }, + { DSIM_DPHY_TIMING(1900, 17, 83, 20, 17, 18, 32, 20, 14, 23), }, + { DSIM_DPHY_TIMING(1890, 17, 82, 20, 17, 18, 31, 20, 14, 23), }, + { DSIM_DPHY_TIMING(1880, 17, 82, 20, 17, 17, 31, 20, 14, 23), }, + { DSIM_DPHY_TIMING(1870, 17, 81, 20, 17, 17, 31, 20, 14, 23), }, + { DSIM_DPHY_TIMING(1860, 16, 81, 20, 17, 17, 31, 20, 13, 23), }, + { DSIM_DPHY_TIMING(1850, 16, 80, 20, 16, 17, 31, 20, 13, 23), }, + { DSIM_DPHY_TIMING(1840, 16, 80, 20, 16, 17, 30, 20, 13, 23), }, + { DSIM_DPHY_TIMING(1830, 16, 80, 20, 16, 17, 30, 20, 13, 22), }, + { DSIM_DPHY_TIMING(1820, 16, 79, 20, 16, 17, 30, 19, 13, 22), }, + { DSIM_DPHY_TIMING(1810, 16, 79, 19, 16, 17, 30, 19, 13, 22), }, + { DSIM_DPHY_TIMING(1800, 16, 78, 19, 16, 17, 30, 19, 13, 22), }, + { DSIM_DPHY_TIMING(1790, 16, 78, 19, 16, 17, 30, 19, 13, 22), }, + { DSIM_DPHY_TIMING(1780, 16, 77, 19, 16, 16, 29, 19, 13, 22), }, + { DSIM_DPHY_TIMING(1770, 16, 77, 19, 16, 16, 29, 19, 13, 22), }, + { DSIM_DPHY_TIMING(1760, 16, 77, 19, 16, 16, 29, 19, 13, 22), }, + { DSIM_DPHY_TIMING(1750, 15, 76, 19, 16, 16, 29, 19, 13, 21), }, + { DSIM_DPHY_TIMING(1740, 15, 76, 19, 15, 16, 29, 19, 13, 21), }, + { DSIM_DPHY_TIMING(1730, 15, 75, 19, 15, 16, 28, 19, 12, 21), }, + { DSIM_DPHY_TIMING(1720, 15, 75, 19, 15, 16, 28, 19, 12, 21), }, + { DSIM_DPHY_TIMING(1710, 15, 74, 19, 15, 16, 28, 18, 12, 21), }, + { DSIM_DPHY_TIMING(1700, 15, 74, 19, 15, 16, 28, 18, 12, 21), }, + { DSIM_DPHY_TIMING(1690, 15, 73, 19, 15, 16, 28, 18, 12, 21), }, + { DSIM_DPHY_TIMING(1680, 15, 73, 18, 15, 16, 28, 18, 12, 21), }, + { DSIM_DPHY_TIMING(1670, 15, 73, 18, 15, 15, 27, 18, 12, 20), }, + { DSIM_DPHY_TIMING(1660, 15, 72, 18, 15, 15, 27, 18, 12, 20), }, + { DSIM_DPHY_TIMING(1650, 14, 72, 18, 15, 15, 27, 18, 12, 20), }, + { DSIM_DPHY_TIMING(1640, 14, 71, 18, 15, 15, 27, 18, 12, 20), }, + { DSIM_DPHY_TIMING(1630, 14, 71, 18, 15, 15, 27, 18, 12, 20), }, + { DSIM_DPHY_TIMING(1620, 14, 70, 18, 14, 15, 26, 18, 12, 20), }, + { DSIM_DPHY_TIMING(1610, 14, 70, 18, 14, 15, 26, 17, 12, 20), }, + { DSIM_DPHY_TIMING(1600, 14, 70, 18, 14, 15, 26, 17, 12, 20), }, + { DSIM_DPHY_TIMING(1590, 14, 69, 18, 14, 15, 26, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1580, 14, 69, 18, 14, 15, 26, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1570, 14, 68, 18, 14, 15, 26, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1560, 14, 68, 18, 14, 14, 25, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1550, 14, 67, 18, 14, 14, 25, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1540, 13, 67, 17, 14, 14, 25, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1530, 13, 66, 17, 14, 14, 25, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1520, 13, 66, 17, 14, 14, 25, 17, 11, 19), }, + { DSIM_DPHY_TIMING(1510, 13, 66, 17, 13, 14, 24, 17, 11, 18), }, + { DSIM_DPHY_TIMING(1500, 13, 65, 17, 13, 14, 24, 16, 11, 18), }, + { DSIM_DPHY_TIMING(1490, 13, 65, 17, 13, 14, 24, 16, 11, 18), }, + { DSIM_DPHY_TIMING(1480, 13, 64, 17, 13, 14, 24, 16, 11, 18), }, + { DSIM_DPHY_TIMING(1470, 13, 64, 17, 13, 14, 24, 16, 11, 18), }, + { DSIM_DPHY_TIMING(1460, 13, 63, 17, 13, 13, 24, 16, 10, 18), }, + { DSIM_DPHY_TIMING(1450, 13, 63, 17, 13, 13, 23, 16, 10, 18), }, + { DSIM_DPHY_TIMING(1440, 13, 63, 17, 13, 13, 23, 16, 10, 18), }, + { DSIM_DPHY_TIMING(1430, 12, 62, 17, 13, 13, 23, 16, 10, 17), }, + { DSIM_DPHY_TIMING(1420, 12, 62, 17, 13, 13, 23, 16, 10, 17), }, + { DSIM_DPHY_TIMING(1410, 12, 61, 16, 13, 13, 23, 16, 10, 17), }, + { DSIM_DPHY_TIMING(1400, 12, 61, 16, 13, 13, 23, 16, 10, 17), }, + { DSIM_DPHY_TIMING(1390, 12, 60, 16, 12, 13, 22, 15, 10, 17), }, + { DSIM_DPHY_TIMING(1380, 12, 60, 16, 12, 13, 22, 15, 10, 17), }, + { DSIM_DPHY_TIMING(1370, 12, 59, 16, 12, 13, 22, 15, 10, 17), }, + { DSIM_DPHY_TIMING(1360, 12, 59, 16, 12, 13, 22, 15, 10, 17), }, + { DSIM_DPHY_TIMING(1350, 12, 59, 16, 12, 12, 22, 15, 10, 16), }, + { DSIM_DPHY_TIMING(1340, 12, 58, 16, 12, 12, 21, 15, 10, 16), }, + { DSIM_DPHY_TIMING(1330, 11, 58, 16, 12, 12, 21, 15, 9, 16), }, + { DSIM_DPHY_TIMING(1320, 11, 57, 16, 12, 12, 21, 15, 9, 16), }, + { DSIM_DPHY_TIMING(1310, 11, 57, 16, 12, 12, 21, 15, 9, 16), }, + { DSIM_DPHY_TIMING(1300, 11, 56, 16, 12, 12, 21, 15, 9, 16), }, + { DSIM_DPHY_TIMING(1290, 11, 56, 16, 12, 12, 21, 15, 9, 16), }, + { DSIM_DPHY_TIMING(1280, 11, 56, 15, 11, 12, 20, 14, 9, 16), }, + { DSIM_DPHY_TIMING(1270, 11, 55, 15, 11, 12, 20, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1260, 11, 55, 15, 11, 12, 20, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1250, 11, 54, 15, 11, 11, 20, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1240, 11, 54, 15, 11, 11, 20, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1230, 11, 53, 15, 11, 11, 19, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1220, 10, 53, 15, 11, 11, 19, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1210, 10, 52, 15, 11, 11, 19, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1200, 10, 52, 15, 11, 11, 19, 14, 9, 15), }, + { DSIM_DPHY_TIMING(1190, 10, 52, 15, 11, 11, 19, 14, 8, 14), }, + { DSIM_DPHY_TIMING(1180, 10, 51, 15, 11, 11, 19, 13, 8, 14), }, + { DSIM_DPHY_TIMING(1170, 10, 51, 15, 10, 11, 18, 13, 8, 14), }, + { DSIM_DPHY_TIMING(1160, 10, 50, 15, 10, 11, 18, 13, 8, 14), }, + { DSIM_DPHY_TIMING(1150, 10, 50, 15, 10, 11, 18, 13, 8, 14), }, + { DSIM_DPHY_TIMING(1140, 10, 49, 14, 10, 10, 18, 13, 8, 14), }, + { DSIM_DPHY_TIMING(1130, 10, 49, 14, 10, 10, 18, 13, 8, 14), }, + { DSIM_DPHY_TIMING(1120, 10, 49, 14, 10, 10, 17, 13, 8, 14), }, + { DSIM_DPHY_TIMING(1110, 9, 48, 14, 10, 10, 17, 13, 8, 13), }, + { DSIM_DPHY_TIMING(1100, 9, 48, 14, 10, 10, 17, 13, 8, 13), }, + { DSIM_DPHY_TIMING(1090, 9, 47, 14, 10, 10, 17, 13, 8, 13), }, + { DSIM_DPHY_TIMING(1080, 9, 47, 14, 10, 10, 17, 13, 8, 13), }, + { DSIM_DPHY_TIMING(1070, 9, 46, 14, 10, 10, 17, 12, 8, 13), }, + { DSIM_DPHY_TIMING(1060, 9, 46, 14, 10, 10, 16, 12, 7, 13), }, + { DSIM_DPHY_TIMING(1050, 9, 45, 14, 9, 10, 16, 12, 7, 13), }, + { DSIM_DPHY_TIMING(1040, 9, 45, 14, 9, 10, 16, 12, 7, 13), }, + { DSIM_DPHY_TIMING(1030, 9, 45, 14, 9, 9, 16, 12, 7, 12), }, + { DSIM_DPHY_TIMING(1020, 9, 44, 14, 9, 9, 16, 12, 7, 12), }, + { DSIM_DPHY_TIMING(1010, 8, 44, 13, 9, 9, 15, 12, 7, 12), }, + { DSIM_DPHY_TIMING(1000, 8, 43, 13, 9, 9, 15, 12, 7, 12), }, + { DSIM_DPHY_TIMING( 990, 8, 43, 13, 9, 9, 15, 12, 7, 12), }, + { DSIM_DPHY_TIMING( 980, 8, 42, 13, 9, 9, 15, 12, 7, 12), }, + { DSIM_DPHY_TIMING( 970, 8, 42, 13, 9, 9, 15, 12, 7, 12), }, + { DSIM_DPHY_TIMING( 960, 8, 42, 13, 9, 9, 15, 11, 7, 12), }, + { DSIM_DPHY_TIMING( 950, 8, 41, 13, 9, 9, 14, 11, 7, 11), }, + { DSIM_DPHY_TIMING( 940, 8, 41, 13, 8, 9, 14, 11, 7, 11), }, + { DSIM_DPHY_TIMING( 930, 8, 40, 13, 8, 8, 14, 11, 6, 11), }, + { DSIM_DPHY_TIMING( 920, 8, 40, 13, 8, 8, 14, 11, 6, 11), }, + { DSIM_DPHY_TIMING( 910, 8, 39, 13, 8, 8, 14, 11, 6, 11), }, + { DSIM_DPHY_TIMING( 900, 7, 39, 13, 8, 8, 13, 11, 6, 11), }, + { DSIM_DPHY_TIMING( 890, 7, 38, 13, 8, 8, 13, 11, 6, 11), }, + { DSIM_DPHY_TIMING( 880, 7, 38, 12, 8, 8, 13, 11, 6, 11), }, + { DSIM_DPHY_TIMING( 870, 7, 38, 12, 8, 8, 13, 11, 6, 10), }, + { DSIM_DPHY_TIMING( 860, 7, 37, 12, 8, 8, 13, 11, 6, 10), }, + { DSIM_DPHY_TIMING( 850, 7, 37, 12, 8, 8, 13, 10, 6, 10), }, + { DSIM_DPHY_TIMING( 840, 7, 36, 12, 8, 8, 12, 10, 6, 10), }, + { DSIM_DPHY_TIMING( 830, 7, 36, 12, 8, 8, 12, 10, 6, 10), }, + { DSIM_DPHY_TIMING( 820, 7, 35, 12, 7, 7, 12, 10, 6, 10), }, + { DSIM_DPHY_TIMING( 810, 7, 35, 12, 7, 7, 12, 10, 6, 10), }, + { DSIM_DPHY_TIMING( 800, 7, 35, 12, 7, 7, 12, 10, 6, 10), }, + { DSIM_DPHY_TIMING( 790, 6, 34, 12, 7, 7, 11, 10, 5, 9), }, + { DSIM_DPHY_TIMING( 780, 6, 34, 12, 7, 7, 11, 10, 5, 9), }, + { DSIM_DPHY_TIMING( 770, 6, 33, 12, 7, 7, 11, 10, 5, 9), }, + { DSIM_DPHY_TIMING( 760, 6, 33, 12, 7, 7, 11, 10, 5, 9), }, + { DSIM_DPHY_TIMING( 750, 6, 32, 12, 7, 7, 11, 9, 5, 9), }, + { DSIM_DPHY_TIMING( 740, 6, 32, 11, 7, 7, 11, 9, 5, 9), }, + { DSIM_DPHY_TIMING( 730, 6, 31, 11, 7, 7, 10, 9, 5, 9), }, + { DSIM_DPHY_TIMING( 720, 6, 31, 11, 7, 6, 10, 9, 5, 9), }, + { DSIM_DPHY_TIMING( 710, 6, 31, 11, 6, 6, 10, 9, 5, 8), }, + { DSIM_DPHY_TIMING( 700, 6, 30, 11, 6, 6, 10, 9, 5, 8), }, + { DSIM_DPHY_TIMING( 690, 5, 30, 11, 6, 6, 10, 9, 5, 8), }, + { DSIM_DPHY_TIMING( 680, 5, 29, 11, 6, 6, 9, 9, 5, 8), }, + { DSIM_DPHY_TIMING( 670, 5, 29, 11, 6, 6, 9, 9, 5, 8), }, + { DSIM_DPHY_TIMING( 660, 5, 28, 11, 6, 6, 9, 9, 4, 8), }, + { DSIM_DPHY_TIMING( 650, 5, 28, 11, 6, 6, 9, 9, 4, 8), }, + { DSIM_DPHY_TIMING( 640, 5, 28, 11, 6, 6, 9, 8, 4, 8), }, + { DSIM_DPHY_TIMING( 630, 5, 27, 11, 6, 6, 9, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 620, 5, 27, 11, 6, 6, 8, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 610, 5, 26, 10, 6, 5, 8, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 600, 5, 26, 10, 6, 5, 8, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 590, 5, 25, 10, 5, 5, 8, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 580, 4, 25, 10, 5, 5, 8, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 570, 4, 24, 10, 5, 5, 7, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 560, 4, 24, 10, 5, 5, 7, 8, 4, 7), }, + { DSIM_DPHY_TIMING( 550, 4, 24, 10, 5, 5, 7, 8, 4, 6), }, + { DSIM_DPHY_TIMING( 540, 4, 23, 10, 5, 5, 7, 8, 4, 6), }, + { DSIM_DPHY_TIMING( 530, 4, 23, 10, 5, 5, 7, 7, 3, 6), }, + { DSIM_DPHY_TIMING( 520, 4, 22, 10, 5, 5, 7, 7, 3, 6), }, + { DSIM_DPHY_TIMING( 510, 4, 22, 10, 5, 5, 6, 7, 3, 6), }, + { DSIM_DPHY_TIMING( 500, 4, 21, 10, 5, 4, 6, 7, 3, 6), }, + { DSIM_DPHY_TIMING( 490, 4, 21, 10, 5, 4, 6, 7, 3, 6), }, + { DSIM_DPHY_TIMING( 480, 4, 21, 9, 4, 4, 6, 7, 3, 6), }, + { DSIM_DPHY_TIMING( 470, 3, 20, 9, 4, 4, 6, 7, 3, 5), }, + { DSIM_DPHY_TIMING( 460, 3, 20, 9, 4, 4, 5, 7, 3, 5), }, + { DSIM_DPHY_TIMING( 450, 3, 19, 9, 4, 4, 5, 7, 3, 5), }, + { DSIM_DPHY_TIMING( 440, 3, 19, 9, 4, 4, 5, 7, 3, 5), }, + { DSIM_DPHY_TIMING( 430, 3, 18, 9, 4, 4, 5, 7, 3, 5), }, + { DSIM_DPHY_TIMING( 420, 3, 18, 9, 4, 4, 5, 6, 3, 5), }, + { DSIM_DPHY_TIMING( 410, 3, 17, 9, 4, 4, 5, 6, 3, 5), }, + { DSIM_DPHY_TIMING( 400, 3, 17, 9, 4, 3, 4, 6, 3, 5), }, + { DSIM_DPHY_TIMING( 390, 3, 17, 9, 4, 3, 4, 6, 2, 4), }, + { DSIM_DPHY_TIMING( 380, 3, 16, 9, 4, 3, 4, 6, 2, 4), }, + { DSIM_DPHY_TIMING( 370, 2, 16, 9, 3, 3, 4, 6, 2, 4), }, + { DSIM_DPHY_TIMING( 360, 2, 15, 9, 3, 3, 4, 6, 2, 4), }, + { DSIM_DPHY_TIMING( 350, 2, 15, 9, 3, 3, 3, 6, 2, 4), }, + { DSIM_DPHY_TIMING( 340, 2, 14, 8, 3, 3, 3, 6, 2, 4), }, + { DSIM_DPHY_TIMING( 330, 2, 14, 8, 3, 3, 3, 6, 2, 4), }, + { DSIM_DPHY_TIMING( 320, 2, 14, 8, 3, 3, 3, 5, 2, 4), }, + { DSIM_DPHY_TIMING( 310, 2, 13, 8, 3, 3, 3, 5, 2, 3), }, + { DSIM_DPHY_TIMING( 300, 2, 13, 8, 3, 3, 3, 5, 2, 3), }, + { DSIM_DPHY_TIMING( 290, 2, 12, 8, 3, 2, 2, 5, 2, 3), }, + { DSIM_DPHY_TIMING( 280, 2, 12, 8, 3, 2, 2, 5, 2, 3), }, + { DSIM_DPHY_TIMING( 270, 2, 11, 8, 3, 2, 2, 5, 2, 3), }, + { DSIM_DPHY_TIMING( 260, 1, 11, 8, 3, 2, 2, 5, 1, 3), }, + { DSIM_DPHY_TIMING( 250, 1, 10, 8, 2, 2, 2, 5, 1, 3), }, + { DSIM_DPHY_TIMING( 240, 1, 9, 8, 2, 2, 1, 5, 1, 3), }, + { DSIM_DPHY_TIMING( 230, 1, 8, 8, 2, 2, 1, 5, 1, 2), }, + { DSIM_DPHY_TIMING( 220, 1, 8, 8, 2, 2, 1, 5, 1, 2), }, + { DSIM_DPHY_TIMING( 210, 1, 7, 7, 2, 2, 1, 4, 1, 2), }, + { DSIM_DPHY_TIMING( 200, 1, 7, 7, 2, 2, 1, 4, 1, 2), }, + { DSIM_DPHY_TIMING( 190, 1, 7, 7, 2, 1, 1, 4, 1, 2), }, + { DSIM_DPHY_TIMING( 180, 1, 6, 7, 2, 1, 0, 4, 1, 2), }, + { DSIM_DPHY_TIMING( 170, 1, 6, 7, 2, 1, 0, 4, 1, 2), }, + { DSIM_DPHY_TIMING( 160, 1, 6, 7, 2, 1, 0, 4, 1, 2), }, + { DSIM_DPHY_TIMING( 150, 0, 5, 7, 2, 1, 0, 4, 1, 1), }, + { DSIM_DPHY_TIMING( 140, 0, 5, 7, 1, 1, 0, 4, 1, 1), }, + { DSIM_DPHY_TIMING( 130, 0, 4, 7, 1, 1, 0, 4, 0, 1), }, + { DSIM_DPHY_TIMING( 120, 0, 4, 7, 1, 1, 0, 4, 0, 1), }, + { DSIM_DPHY_TIMING( 110, 0, 3, 7, 1, 0, 0, 4, 0, 1), }, + { DSIM_DPHY_TIMING( 100, 0, 3, 7, 1, 0, 0, 3, 0, 1), }, + { DSIM_DPHY_TIMING( 90, 0, 2, 7, 1, 0, 0, 3, 0, 1), }, + { DSIM_DPHY_TIMING( 80, 0, 2, 6, 1, 0, 0, 3, 0, 1), }, +}; + +static inline int dphy_timing_default_cmp(const void *key, const void *elt) +{ + const struct samsung_dsi_dphy_timing *_key = key; + const struct samsung_dsi_dphy_timing *_elt = elt; + + /* find an element whose 'bit_clk' is equal to the + * the key's 'bit_clk' value or, the difference + * between them is less than 5. + */ + if (abs((int)(_elt->bit_clk - _key->bit_clk)) <= 5) + return 0; + + if (_key->bit_clk < _elt->bit_clk) + /* search bottom half */ + return 1; + else + /* search top half */ + return -1; +} + +static const struct samsung_dsi_dphy_timing *dphy_timing_search(int start, int size, + struct samsung_dsi_dphy_timing *key) +{ + int ret; + + if (size == 0) + return NULL; + + ret = dphy_timing_default_cmp(key, &dphy_timing[start + (size >> 1)]); + if (ret == -1) + return dphy_timing_search(start, size >> 1, key); + else if (ret == 1) + return dphy_timing_search(start + (size >> 1) + 1, size - 1 - (size >> 1), key); + else + return &dphy_timing[start + (size >> 1)]; +} + +static int samsung_dsi_wait_for_pkt_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + uint32_t 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) +{ + uint32_t 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) +{ + uint32_t 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) +{ + uint32_t status; + ulong start; + + start = get_timer(0); /* Get current timestamp */ + + do { + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (status & STATUS_PLLSTABLE) + 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; + uint32_t 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) { + printf("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 & STATUS_STOPSTATECLK)) { + printf("clock is not in stop state\n"); + return -EBUSY; + } + + stop = STATUS_GET_STOPSTATEDAT(status); + if ((stop & data_lanes_en) != data_lanes_en) { + printf("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) +{ + uint32_t bpp, hfp_wc, hbp_wc, hsa_wc, wc; + uint32_t mdresol = 0, mvporch = 0, mhporch = 0, msync = 0; + struct display_timing *timings = &dsim->timings; + + mdresol |= MDRESOL_SET_MAINVRESOL(timings->vactive.typ) | + MDRESOL_SET_MAINHRESOL(timings->hactive.typ); + 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) +{ + uint32_t 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: + printf("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) +{ + uint32_t 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) +{ + uint32_t phytiming = 0, phytiming1 = 0, phytiming2 = 0, timeout = 0; + struct samsung_dsi_dphy_timing key = { 0 }; + const struct samsung_dsi_dphy_timing *match = NULL; + + key.bit_clk = DIV_ROUND_CLOSEST_ULL(dsim->bit_clk, 1000); + + match = dphy_timing_search(0, ARRAY_SIZE(dphy_timing), &key); + if (!match) { + printf("Fail to find DPHY timing for %uMhz\n", key.bit_clk); + return; + } + + phytiming |= PHYTIMING_SET_M_TLPXCTL(match->lpx) | + PHYTIMING_SET_M_THSEXITCTL(match->hs_exit); + samsung_dsim_write(dsim, DSIM_PHYTIMING_REG, phytiming); + + phytiming1 |= PHYTIMING1_SET_M_TCLKPRPRCTL(match->clk_prepare) | + PHYTIMING1_SET_M_TCLKZEROCTL(match->clk_zero) | + PHYTIMING1_SET_M_TCLKPOSTCTL(match->clk_post) | + PHYTIMING1_SET_M_TCLKTRAILCTL(match->clk_trail); + samsung_dsim_write(dsim, DSIM_PHYTIMING1_REG, phytiming1); + + phytiming2 |= PHYTIMING2_SET_M_THSPRPRCTL(match->hs_prepare) | + PHYTIMING2_SET_M_THSZEROCTL(match->hs_zero) | + PHYTIMING2_SET_M_THSTRAILCTL(match->hs_trail); + samsung_dsim_write(dsim, DSIM_PHYTIMING2_REG, phytiming2); + + timeout |= TIMEOUT_SET_BTAOUT(0xff) | + TIMEOUT_SET_LPDRTOUT(0xff); + samsung_dsim_write(dsim, DSIM_TIMEOUT_REG, timeout); +} + +static void samsung_dsim_write_pl_to_sfr_fifo(struct samsung_dsi *dsim, + const void *payload, + size_t length) +{ + uint32_t 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) +{ + uint32_t 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) +{ + uint8_t data_type; + uint16_t word_count = 0; + uint32_t 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++; + } + /* fall through */ + 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) +{ + uint32_t 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) +{ + uint32_t clkctrl = 0, data_lanes_en; + uint64_t byte_clk, esc_prescaler; + + clkctrl |= CLKCTRL_TXREQUESTHSCLK; + + /* using 1.5Gbps PHY */ + clkctrl |= CLKCTRL_DPHY_SEL_1P5G; + clkctrl |= CLKCTRL_ESCCLKEN; + clkctrl &= ~CLKCTRL_PLLBYPASS; + clkctrl |= CLKCTRL_BYTECLKSRC_DPHY_PLL; + clkctrl |= CLKCTRL_BYTECLKEN; + + 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) +{ + uint32_t mdresol = 0; + + mdresol = samsung_dsim_read(dsim, DSIM_MDRESOL_REG); + + if (standby) + mdresol |= MDRESOL_MAINSTANDBY; + else + mdresol &= ~MDRESOL_MAINSTANDBY; + + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); +} + +static void samsung_dsi_disable_clkctrl(struct samsung_dsi *dsim) +{ + uint32_t clkctrl; + + clkctrl = samsung_dsim_read(dsim, DSIM_CLKCTRL_REG); + + clkctrl &= ~CLKCTRL_TXREQUESTHSCLK; + clkctrl &= ~CLKCTRL_ESCCLKEN; + clkctrl &= ~CLKCTRL_BYTECLKEN; + + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, clkctrl); +} + +static void samsung_dsi_disable_pll(struct samsung_dsi *dsim) +{ + uint32_t pllctrl; + + pllctrl = samsung_dsim_read(dsim, DSIM_PLLCTRL_REG); + + pllctrl &= ~PLLCTRL_PLLEN; + + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, pllctrl); +} + +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; + + 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); + +#if 0 + if (bit_clk > dsim_host->max_data_rate) { + printf("request bit clk freq exceeds lane's maximum value\n"); + return -EINVAL; + } +#endif + + 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) { + printf("Error: DSI PHY reference clock is disabled\n"); + return -EINVAL; + } + + fout = samsung_dsim_pll_find_pms(dsim_host, fin, bit_clk, &dsim_host->p, &dsim_host->m, &dsim_host->s); + if (!fout) { + printf("failed to find PLL PMS for requested frequency\n"); + return -EINVAL; + } + dsim_host->pms = PLLCTRL_SET_P(dsim_host->p) | + PLLCTRL_SET_M(dsim_host->m) | + PLLCTRL_SET_S(dsim_host->s); + + 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) { + printf("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) { + printf("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))) { + printf("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) { + printf("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; + +#ifdef DEBUG + int i = 0; + const u8 *p = msg->tx_buf; + + printf("samsung_dsi_host_transfer\n"); + for (; i < msg->tx_len; i++) { + printf("0x%.2x ", *(u8 *)p); + p++; + } + printf("\n"); +#endif + + 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) +{ + uint32_t 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 */ + samsung_dsi_disable_clkctrl(dsim_host); + + /* disable dsim pll */ + samsung_dsi_disable_pll(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 0000000000..9fd6e49bbd --- /dev/null +++ b/drivers/video/bridge/samsung-dsim.c @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * 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 0000000000..9bb2a37958 --- /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 Sat Jul 13 08:45:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3225 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 3166840F45 for ; Sat, 13 Jul 2024 10:46:09 +0200 (CEST) Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2ee8b7eafffsf27441691fa.1 for ; Sat, 13 Jul 2024 01:46:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860368; cv=pass; d=google.com; s=arc-20160816; b=cdnLS6/oAlIiJL+pJ5h3Yem9iVasmycMhQr9WaKl3YmXeHpDDG4rW5aTNUiPHu5WJi 0mI7WQUZGlg022Do43hGYI/5M4rJ7Zyc9datMomAG6WPsrjSIQ5Vs2f3dqPT3/RJMbus 8P/H3uyCiDEmesFqB7lQpeHePawSvn2h5AuziR2Jj9HgAPNS3ARlBvuVewBLa2amoIki ww3GNzAfcK65mbXd4sORHf4Z68ldrF1SIK7ketyJMa1+6VNNR93bkLp7KUleq7X/+eiR l0JU2p8HaW6/HjpjtH9Gb60yluul221jAPOebbl5T9jyEPCNmADmVmN5gMxjzDbkk9tX pQSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=zsE0kENFnL8X5qh20uvJtlN3Nekz2Fzm2zchXHqsRpU=; fh=8CQDETxhuT8soO4NBpXxdoI0GKAcUf1G25vlQt6/NSI=; b=c4e511Vox9iDYZqSgtpxXLh/idsP6MMhNhxvtYpa5zxUBg2oWB7H1C0JA+2l3VIWak Wk5k++ASTCuhEY90dtDuFGGvhnXJ8ybXV3ryYFQrLrFBrz25W0nfeoxWMoZywpf1Q1xH F6MeqTdELhYeRmL9Bgz9AX/812Jny+yL3uKZs+m3gpyrYwzchnmFBggdzYq92XN72FfG 9pNhKH1piKhh2ycE9ztnBjbD9aOpo4M5REc1F0gIuweOnWrM4znPMLbdKsU8/ImflExJ /FD35Fy36aqqblRRsfte+F+0glzDNy+Ou89j1xBnwDX0w95Jgp68ajKXbkALV6Bc3vB2 1evw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o45Kahqr; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860368; x=1721465168; 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=zsE0kENFnL8X5qh20uvJtlN3Nekz2Fzm2zchXHqsRpU=; b=I76v+oTxKm25Aoi2XuUlGpI27eBiGyfJPgXTnjhzst2WBqnpfywlmtqnUiMEis9p4G RZuzwMrxq8ssG8qLiJzARvQJzY3+jl4dJ2YzLbsMBGwf1SVEvaP9L8UaGPr2WdWtQIUp u5Vvi5oeC3NsKCBWRvOx/gmydrF1zln60FoeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860368; x=1721465168; 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=zsE0kENFnL8X5qh20uvJtlN3Nekz2Fzm2zchXHqsRpU=; b=fJheWvkXSvNmh/bBAeWoEiGsDHKa1RL63tmc2IKp33dlYNgBZPAPcEWIMPSd+nPrj1 RUT+5HTUJv3xJKA97nMETjbEqhpya5rnNQyPMf3KkdoJ6hX4R+KI3ixVqS/UIRpZ/NG1 urAjGqq+tJzvthh3umWpBRjLqVXFZs8MsV+3f/GCJvNeC23+dMO4F2PVLKpAWEJUoghn Y0sanC64GaM1buNVfJUYzO16GRtj1tGT+UY7DoiQms1WxuuMOV+PguSgkbofZCs3WcLD tgc+QFqG/phXwwGsYnyAASqd6y80bl1G2AxJk+gxHAftleKsKwJigjzqxwCIXuytv/qo 6rBw== X-Forwarded-Encrypted: i=2; AJvYcCWFAgUD64629Lww8/MiOfu9nMvYWMeWPKHloXc8X7jVwuEim7Cni6QhI1yf4f4PYNiJDo1EQ27vUyrABXeg2Y/YqN0tyzr45xkQ9TsQfgOSacWi3exoNB0Q7H8wug== X-Gm-Message-State: AOJu0YzjjVQojeBa9AmOyr2+mXBZBjOxz2ESt6x+sgt51GYtu6KWQCED ScutPbZfy6mC8yYC2PKplh4dxhnJqsJPTUvUylGHFYELd0TBHrwHPDwz3QAjiXfq7Q== X-Google-Smtp-Source: AGHT+IHXo9TNLiws/RzPk0Ue9BxHrMzbam5eb8XPbt0RnRWXnOi1c5WCH7b8+OLFYDkraSBapayjAw== X-Received: by 2002:a05:6512:ba6:b0:52e:bdd4:610b with SMTP id 2adb3069b0e04-52ebdd4635dmr8198457e87.4.1720860368589; Sat, 13 Jul 2024 01:46:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:3d0f:b0:52e:9bed:f9c4 with SMTP id 2adb3069b0e04-52ec40750fbls4900e87.0.-pod-prod-01-eu; Sat, 13 Jul 2024 01:46:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW09VHfbYZFta+lXXtthUZDkHTDNMbbbHeA7exb7SGe/tUHdT71PcoaFENd4zy5uGqmVqyLGgwh818gIvnTURPaZoltx4SZ9hAxwUhBI7zYgAuA X-Received: by 2002:a05:6512:3f0a:b0:52c:df6e:9517 with SMTP id 2adb3069b0e04-52eb9990c8bmr9596456e87.11.1720860366529; Sat, 13 Jul 2024 01:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860366; cv=none; d=google.com; s=arc-20160816; b=FrrYQDQRksGCfs0pZPS0TIUBi+jiguqlXOfJvYN1vgFOfYOTk0b+IXHYDmFM5yMmYY fMaCdHHNF15+zJg3g7nzr/jG1ZhQI2uJiLMdwZ4NXMzevtkr/YzWIAbtPYL/cLaW/yFg +l8KL1dPRa/SpBFQyqofXsEiWWozYHBBDQdhLfbKGQZhK6U/2EluWiejznrmB9It1xbV rKxPGe5/rzWIi6f2cdBgMAKFhNX6v1M2in/S2oOSljZWPQmqoM6DgY3SK0+6lYv5cWto YhqyCYcRaMmCNrro9eY9VykYaaUOpGWiIiXOr361Mf64YyofABfUx7ec86nCmF+1/X2s +Z0g== 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=533G33PCRJeQk802BHhs4iEvwTKMoiBQLtOWe/MSr6U=; fh=izGMF3Mtqjl7x3WIKIFbfYB/EnJLmvyDfQQ6d0Crs7U=; b=ATDjlQm7MVsr76SZ/c3CRXmRoVKamCi4OwBxCI53NNMXSToi1F/TzRPbFFLmdigT7f w33xRs40Ln2JYA8F65Qx39avee3nQwpJQfVL5H5src9/s2PibTFK+SZuXHATFHnjtqSh 4pLn/DANR2DS5VNTmVar8GbAO2l1GnXd9fsGesVSNIyHSnp2mz3zPRu0WVW5xYnU/bP3 scxxVQX4lwM4LONQeO18gCblQB4adunCkqBZ2KCPnq5RnCD+B7wBuQexKCw2zKUr22fP ZmmOKf6OZt25fFKli11/ZgRb07vbHoeARXZWEQqtMMUI5JXhAPE2SsQSAeDzH2PnmroX q87g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o45Kahqr; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5f7d31sor18679966b.0.2024.07.13.01.46.06 for (Google Transport Security); Sat, 13 Jul 2024 01:46:06 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCX7I/+q07u+sdVy4QhFG5UnetZelV2VcfR+YkoLUDHg3snn9qOUn8r6I2yNYmi9kpMBFzaYQk6G1CF3dpCyMYdgISP2rY3j+Uzy24UzGUfBfmzw X-Received: by 2002:a17:907:9809:b0:a77:c314:d621 with SMTP id a640c23a62f3a-a780b68a2f8mr1210527766b.13.1720860366063; Sat, 13 Jul 2024 01:46:06 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:46:05 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 20/21] video: Add Synaptics R63353 panel driver Date: Sat, 13 Jul 2024 10:45:25 +0200 Message-ID: <20240713084526.922537-20-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o45Kahqr; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 LS068B3SX02 panel is based on the Synaptics R63353 Controller. Add a driver for it. Signed-off-by: Michael Trimarchi --- drivers/video/Kconfig | 8 ++ drivers/video/Makefile | 1 + drivers/video/synaptics-r63353.c | 230 +++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+) create mode 100644 drivers/video/synaptics-r63353.c diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index d2432d67a4..9f7cf196e3 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -592,6 +592,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 9fd3645994..4d836efcfa 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 0000000000..25db9c3e70 --- /dev/null +++ b/drivers/video/synaptics-r63353.c @@ -0,0 +1,230 @@ +// 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; + + debug("%s: called\n", __func__); + + 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 Sat Jul 13 08:45:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3226 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 8792040F45 for ; Sat, 13 Jul 2024 10:46:10 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57cad6e94e5sf2505105a12.3 for ; Sat, 13 Jul 2024 01:46:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860370; cv=pass; d=google.com; s=arc-20160816; b=wkjVpgEGUSF/bOs0GUNulSUdOCcLGbJqr0J4y8Hr01CAd6GOgCaCDQOjPfmALD9xTZ p0f3O0DjO3V/iYQI8qAwD+2YA9fXxMNviDvH2d0KnOTSdcg2pSOQxt8tfePhl79niZH8 +myf5GbLmEEOBzQMY6ak+YO+lvu2QVHtOXeG8xyKDMMW4Cqqu6QxqGoFhLDo2ATpC+vt Imv7+1ldz1ZLYLqrhLhMGTJmQUasKRDyFsHEjaB7fRSLT4vhVrPbgqrU4Vxrf3gexD9A SRGli1WZqjXpzyduBnbPGRGBBwC17CAVuLAFpv+hHsoDSVMF3SJ/H2IACXpbZ0Yn1vfg 8l0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=4CO/LHlAs//sjP9llxXWAqLkOrnAQAVn99mXj3ZwmDI=; fh=sHstBO86N/I0s60VIjlZ6d3qkmEFOvZG2GkeetJo/5U=; b=XekoHrswPcoqA2NsH1IBdHDAtPGPflqIS+g50Ts+jgJA9ony2EvYjhSqazdFpB1zaP 1qIbgvIbets0cENvO/RAAiegEv3iiJRoI8sXP/czWzxSi7k+1eKdhloakg3dtXgaY6BW cyuPJAUIOJhN/Dy3tXlaEA9vZy5A3L4YCIGjl4yAVDNBWrQNiJOtjIHY+cLa2ZznAh0j XEI/LJf6vISzfRmxs3pRVcVt8dNvhtjE/yolfYK9BWgeZZ+dfvOltzahmrrb23DdMKkH leeZe+UhP8pJ0zn6Zh3zfmYmexaJ+TX2UG3RUkaIbAscoA+6Xwm9YqdwZBMTsy4snlHo SJXQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A2Vb7q7P; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720860370; x=1721465170; 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=4CO/LHlAs//sjP9llxXWAqLkOrnAQAVn99mXj3ZwmDI=; b=D+UQkerCU/IIdIFS+fTaQHiaY3ZDo6cha9FLDAlAbm9lSaohNSda25Tv1XdHH90Jor hhIU5ti4K9h9P76DW4CAvNsNaRtBvF7Q5+YVqwVDPEUEFDZTvNoLKOpM/6NWoUWwnr+z KnLCYdhXCRBsMzHb73LfMJv7LpyR3jlt6QHuc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860370; x=1721465170; 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=4CO/LHlAs//sjP9llxXWAqLkOrnAQAVn99mXj3ZwmDI=; b=CGPf1YIO/x+AidJEAcobRRl+t9QAi1uQ4BvcphwC2nasoDpDH2meQPKfol8OoOwHZZ ++rKvmMGm1pGkMemiaR/lss5F7OREJbdHbAPNWJLfwRTa7k78q6R96IM2WaGfnsifIie SZcaCmReqPsZ9HpVjiX8TNoEfg/hv+263dEdd3ycsQpuVhuis5WWAylOiogp12Pr38Xs 2orkVSatWoavy9tBDpGZFVvn16fB4/JcdA/yPRcwI7QnfpYeWq/Ktv2gzTcXxC1K99jH QBMrwiV6DOzbh+8XPhkB4tjtAD1THZh/M/uWQPTfz0RFOlhf4R4gHyugdim/9Ouohdoz xy3A== X-Forwarded-Encrypted: i=2; AJvYcCXmFRrqMx+JEPSGHYPXDs08WBi56pklHoGM0K/jv3kROpjwd26J6GqiPYNJ4cR1+IwcHt1cx1F1Dk/747wP+S11yfNmxj66et8u8OcS+97EVoLJzyDKWYg5WmZE4Q== X-Gm-Message-State: AOJu0YxSJPdbsYpSh+mvZ5+yIzBilqryiouC6U9MOcCd64bZScXjMP/7 tY1Rwf9RFKlnYgGxAw/GtsMabqyOS+D9KBI+bcgqeSEcyXSt2htumeFir9EmGflwXg== X-Google-Smtp-Source: AGHT+IF1MnNeB5lnuGqbmz+sl2OrC7H7qJZytIVu0oHTvV3sQmDSecfCbTHSuW68/xXX49HJo1oBug== X-Received: by 2002:aa7:da15:0:b0:58d:3ab3:9d33 with SMTP id 4fb4d7f45d1cf-594bb86a698mr8444703a12.32.1720860370241; Sat, 13 Jul 2024 01:46:10 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:28af:b0:584:b54c:52ad with SMTP id 4fb4d7f45d1cf-59826225ad3ls1441599a12.1.-pod-prod-07-eu; Sat, 13 Jul 2024 01:46:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW6iQw7fgsg0VU2D+8UD40sySbhIIieGjYp0vwcA/xkfBmQMyVvk+AaT3RhCJ6Zduqbbqa/hQ72bNYmCRvgaEvPNLSOqfjfj+P4Mt5To+6xrjw2 X-Received: by 2002:a17:906:c796:b0:a77:cf9d:f496 with SMTP id a640c23a62f3a-a780b7050c1mr829083966b.39.1720860368564; Sat, 13 Jul 2024 01:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860368; cv=none; d=google.com; s=arc-20160816; b=B4y0KauFy5rGP4n8Qc77McKBHF0v45m31kYMBLpjRNMHiVk7P4njdcGVKFArrbBj96 if2dM32NAN5o9v0m6rFbC9R4wxGvmfnOSOp3bbiv5II5WemZQksR4LSnX43ULAibhAo4 Rue4tA2fQNQWA0uYJGGJ6TYzKq6a4jJxQDR25LlDhwV9AgxEnsbc0XzlDKpmpyttFf8n qXS5aK9wz514df3tr8CccyrGai4YFiSurQ6iMvrDWhF6PwHO4ICQaQqNXDfB21Df8ccF fpXGBmy2QI/D21aGxRclFvD3Wk0TddAYurEsHH8G89Svr5Cm0NA5ajkksjXzeGH+nVf3 dbmQ== 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=MSvv985Gr2XgDVOd+9v34PRXSpBauM0+dQsIEzreLgU=; fh=AnzrFby1IKaKtpOx/XYnSzUUzZ0rR4jqE52+5q8HBr8=; b=mThIZyoXw4FOYmNTz7qKDDYFNcYGP7qbqRPYgOdOQX3Tlc1JqqjJ1hXU8I23MPqHoa M0yEeUVWbv9lPg6KdvUXLnX996sAlLgUIV2qeqn4umTZ/IE4taK+tkswwNMzfSgTak/X 8XvaWielc4fTVF2CE+U4KEbhv5flHsobyuz4hTbgWB6wu8WDA2y0IDJrFEvMVLnR3QZO 7MkKcY7GjfTbQFHfX9o8329PuSANhaxJGskKJKoLQbg7t8uivc2eqt97oigVLYoAHTp6 UmgKGUlWpCGvnAoU4c14mbowk6FfmLJ53XjvQGG9pYUdixmQsUOIAkM7cAEY3mfwqOpI ZcMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A2Vb7q7P; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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-a79bc5b47basor12830666b.9.2024.07.13.01.46.08 for (Google Transport Security); Sat, 13 Jul 2024 01:46:08 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXbSFavZ9itn5kFcJnbNwFLPEmdMvBVgaiFBZjJtLPHUXu64lwMX1mLEKt1RHMh6VfJWZ/JiCT0PnPduqlold2c4iGcYwwkBfDs6A33+N4RgUM4 X-Received: by 2002:a17:907:9689:b0:a79:8318:288f with SMTP id a640c23a62f3a-a7983182b04mr802616766b.16.1720860368207; Sat, 13 Jul 2024 01:46:08 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:46:07 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 21/21] arm: imx8mn-bsh-smm-s2pro: Enable display on reference design Date: Sat, 13 Jul 2024 10:45:26 +0200 Message-ID: <20240713084526.922537-21-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A2Vb7q7P; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , Signed-off-by: Michael Trimarchi --- .../dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi | 23 +++++++++++++++++++ configs/imx8mn_bsh_smm_s2pro_defconfig | 14 +++++++++++ 2 files changed, 37 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 19b0d89775..8cae580e28 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_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig index 0faa3376fd..eb1275a443 100644 --- a/configs/imx8mn_bsh_smm_s2pro_defconfig +++ b/configs/imx8mn_bsh_smm_s2pro_defconfig @@ -68,6 +68,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 +85,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 +108,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_LOGO=y +CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y +CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y +CONFIG_VIDEO_MXS=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_IMX_WATCHDOG=y # CONFIG_FAT_WRITE is not set