From patchwork Sun Jul 14 11:32:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3283 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 06E1940F88 for ; Sun, 14 Jul 2024 13:33:07 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58bd8406816sf3378024a12.0 for ; Sun, 14 Jul 2024 04:33:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956786; cv=pass; d=google.com; s=arc-20160816; b=ENfPQcAW6+H8qf4jj1m/qaCPKa7E0y5FJzWg6kgHmwOQhBoZ7Ae3XDE7Mhg9IXCA7P Pfj1N+3w4QVLWWybPnRGzWIsa/kph7yZ4bx1hrsCs3pComCwkmEEUjgJOe9Ityn5nU5e aT2OPzllYu8UudGsGvNEhPtSxWI9/4LxUgrizyh+WOaUidVeWYbZmVYDe/93cI63CY+Q 3/rVtDTuqmst2uEXfBq9151SE1Cz5tb34HMl4TWv+TdS4NQi27ZSfEU3a3UgzcCQLkKm t5RrGb2EFPogrfxNgs4PnXr0MYwPqKFu38VP7Po8HNxkY9B8tpg9A6mnZscid6NQKbf2 jIAA== 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=UJVNwS57L/Pa78A3Dim3yYrDzu8bbNKj7XZWsRzGXKQ=; b=zBh7S18htpYtZT2YiOJVhEJkUV+VftPq1qCXooQ4zE3c0JiVpQFGimsQqbBnDQB5Eb tdW0d3mOwzSFi+IV71UsZu9n9QwAo0VpKp0Jig6EdVsnYhD0l/09f2aK3VJbRDTjALPb 0tkmwH+ehGVlqNT7V775/rbHvqppiHGxMMOJfW8mqMecuSR43JLEjZR/ivsani8w59uo kzyVCLp217fjUuXoloZ/v81O0RJ4CsuSQC0FaZSrbCc/SMve7DMrZTy/M3q8eYsWQp2Q yz1Sxo2frQzWxAlyah9KM+UeEEIOLh+i2mrjsz+Td1/HrgzuCwzXnTfz67B97t+1JjT5 Nesw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ApuTeLq7; 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=1720956786; x=1721561586; 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=A9HIEhEpHr2psZdG6vfrk3DVPnpGwVM0aPlLaQvxSzA0MchP80RT+HZKKqX81DEJn5 taiP0cO+rkzuVrXWtUDeYjsKjSkSjSrIBsG10bjOqOt2yhmtWHWvVf5aE+Itlmg/iSGc xE33DuMIxBvpV5UIFl5Hg5FqW9ly0o8g+IP5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956786; x=1721561586; 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=aubCYRB431ShaqK9qANclCMQxs+E6rWMx/wR4KK35anTML3o/8p9sS34ZVeAkb5rcX zusHBijgp+pgY7PfFn8ipa/290OxgcDFk1IyH0yzXLyL++ARBkJL8MvnZoZj0cFv2WNk PgpOXhEgBxxw0wbHWdM68iJNSos9PESveinTQhK7vmQqVWfYpw3lCBlvhzWQofPeihkH 0VeZFbPNglo4FT6aW60UfcICcS+eCpb0sGSzz5FE/V6j9eeiT51kFJu0gIB9M8M7QKiG +CxD1y7GmJuqwrmatMzjKPqV+UoCMlm/dFvvqfM9V7oRcOiixegW9lLc4CVbLgtOuuWg KClA== X-Forwarded-Encrypted: i=2; AJvYcCVe5xNXWotmQfGfNLTTbPqpG9kBS8Di+REa47R1vSFIaVmGgf/BG04PtlrepCKWjiXrO+8/7V1jeF0vFXzc0wROmq0r/h1xqmXPpHqAWhjH2FEJX+Nwo7Kw6CUfSw== X-Gm-Message-State: AOJu0YxvbkYufrSY7ueNDOhqbGT4Y57PEqCOI4V5Ym3Y7+OqBya3KpMF 9CqbfWGVQ/PaJOIpqV1ROvszWcrvIf9/BWEL6wAQcV4A+2K93MGn/m0I8UMr8pJUPw== X-Google-Smtp-Source: AGHT+IE5NEW6MNn51FUYPBPVBChydJUCZp4eVZZvaQL8wBMLvMv5GhYL/z3yI+MuO0+q/RusRJwQWw== X-Received: by 2002:a05:6402:40d2:b0:58a:d4f4:e866 with SMTP id 4fb4d7f45d1cf-594b9b06ceemr13449481a12.6.1720956786543; Sun, 14 Jul 2024 04:33:06 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35d4 with SMTP id 4fb4d7f45d1cf-59821cb697bls1645767a12.0.-pod-prod-01-eu; Sun, 14 Jul 2024 04:33:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV1mjg9ibRgDN+Bj4zsHvgosZhmDJEFaPVrnO6pNr68/plSHzAcZ8AldtgEkKpOAgHaOzxEWUxAV4hULYmo8sBUcKoC+O0m5upHEseo4Phyd0Mj X-Received: by 2002:a17:907:e92:b0:a6f:b715:6cd9 with SMTP id a640c23a62f3a-a780b884b45mr1394068466b.56.1720956784869; Sun, 14 Jul 2024 04:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956784; cv=none; d=google.com; s=arc-20160816; b=wxGoknexIzlfoBe64icxJAuXypJeez825x9Kqw+Z/6e75JaWWXjGEZ+tuZV4hhR2jG yIT1X8nb5WjTVBDIBZJxn20xMSLlPVPv+VS/yGl/dQyKg603wd7wc7x9Q0YwW5CKXhja sYL9aLpjHnVjezRhhM8AslPl974a0/wW80FKt66ZdavW18CqsAMkFV+C+0ILt+aaywhv 7nXwWrS+yAHKEVzbR3Yi3ahd24BskxSJYgeBYf9SiS5NwdmRZl7kjFqq5Va+eNKwp1sw apw6mts6PrZYHMrK89oTRm8yQX+KgTx8/fcWSIDYVADofcErpPGM7luXwLqR7Vc1CWR0 ZztA== 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=WxCKNUkkWKNUa+2BkypJtBadT4H4CtN3rLUpdILDz0s=; b=fjB7KEkrFKrDkwIweUxivBUfuQCC2MhriRFfkhOxmVYeAvl6e/ZBr8XtBNbtPEzLPQ Z8RZLBis4URzdh29GkE4isFaqi/8zgD7EELJ6TxwG3umSp457zi01RaU82afwwnIxWok w0NTzBG7A1qyHeQ/cDSu/RW3y+MwiFNewY0MSW3mHkgxm07xBjGmiXYhhYmfPl/Hyuzf sSOjTVZx/rnHmi+BVZFMp86NBH35oPd82CRE1waD6kLCT7o0eOO8rvB7uOgveBta29Jr h04V3mCyWdDSoY68saapeqGjfJtF/cm1HrN4xQ6kaBtccEdZ5wHq9mqMkDkNs82V1wuf JMsg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ApuTeLq7; 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-a79bc5f7d31sor65496566b.0.2024.07.14.04.33.04 for (Google Transport Security); Sun, 14 Jul 2024 04:33: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; AJvYcCXQi02cWrvsmez9YpC2yBz4q84Tpuzbs/nOo44bPXLxSBL6GvcqnlNc6JycN5PDJ+loCFhQ/rtCE8Fbfmu0IZGXiMZoXN6266R8/Ho3yJ6lvUdQ X-Received: by 2002:a05:6402:1ac4:b0:58d:703b:c1d5 with SMTP id 4fb4d7f45d1cf-594bbe2ba6bmr9480345a12.38.1720956784284; Sun, 14 Jul 2024 04:33:04 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:04 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 01/25] clk: Propagate clk_set_rate() if CLK_SET_PARENT_RATE present for gate and mux Date: Sun, 14 Jul 2024 13:32:38 +0200 Message-ID: <20240714113302.133399-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=ApuTeLq7; 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 Sun Jul 14 11:32:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3284 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 EFE8E412C7 for ; Sun, 14 Jul 2024 13:33:07 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57d3eca4bb7sf5127514a12.1 for ; Sun, 14 Jul 2024 04:33:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956787; cv=pass; d=google.com; s=arc-20160816; b=vrlVAp+w28NFfT1ufkuJcv1urRQkEg1QDoX/IpW8C5zbFEdxJsdc2MVWgu7s3iH/JI xmgY2LORLCw3NDsY8wtwO8NzKxlgxUOq6JgWxZKaVVkA59QlL4BfuP0ZyiZNPuiL77yB RtuFPRqHrT52Y/ieOLlkWvw7E9lHe+8Q1Pf2IdQxMCsOUKMECjhAvOdzqkbKElYVt5l8 pKovGdWQfT+1fOaSqT8wqogLGL+QvdkaLmLmdLDfMlV/urtbsghwDDpgDNMu7p+qBqkO r/YgeVolmtdNWnKd4yzm5Q/6/inlD+VNCb0FxPRinbOWxnu7o33ON+XAqUCaK2hV/9t6 WvnQ== 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=ky3EHJu26GMzO12uzFG1gcmbdsMZYAI11KBrD3XJte4=; b=X8b2BD72bQK6M6xEvPOXPNRJ07CIYbUVPryp+tnMbIDunBw3D1mHurM6hlR4L4KA2s kXI5IZ3E7no8uK3Qq5tf56VogHvdmyskvXhye3o3TEZ93VdgrApfyJtCzMmOlMT1uTQG fwOImY4spYOD3M1LiH06RxNuZJDMaueSaki3pPtEDdKmkdB1JzRvcMr18nnobmN0ykH7 Zg1vtwF/1CxHKR6qzuUZBWVkLsGzbMVslekaXQ1nc1zGlX16lGGhrIN3QJrvZu6Dw+sf mLiskb1zINCkMLqMOBZWgpTeZ4Qo7VjuLYtlWuRFharjxcPMqe6Q4N3Bl2jRH2llZP9i ZYPQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AZ06Fhpe; 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=1720956787; x=1721561587; 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=d35guPQAmT6/93F02ux6Agbf88drh38cKb2VJpcBREa25moQPU2kmc85WOEcmAkSrT kgVsNIuEWWHZgfXWiE9kcFZcKGOwihXPROWfko6pd5EDDs9wJaZ4AwYPhOoHThAT6vP5 uDBucxneQjrGz4SjB3mGjJIq//ZBIq65VXMsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956787; x=1721561587; 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=pcMvT9IUuBnk2dtXbGlylDZAi9528BUkEvu/X8qioSRtrWrmITJBZ9LhzXOH1hS7bq /KvtwP0ETHg3rSyWhlgzV4MSe3H2H5dG+53b6Wc7lMPT+KWD6WrNdp2H7TH6Ka1dShYm nwhRA7NXzEP7nLzORHZPMKltjcyUNeploDid2dVYqvgFXoV3xfBPT6I00HvNRrhYI41v B7uwHq9crnIdSh2ARJ90EvMzT1/07W/oWLqytB55OMq1ZUBKlHPKJ6TeXDB8SVF0l/5C YbCCvLLQwfalu+KtPWT2ntwvDxZBO6Cb+HjVdFQT80l7UBfrVzLK2URaUPbZRBdx4uNK Tnpw== X-Forwarded-Encrypted: i=2; AJvYcCVKqh/qPTEz3oBNzyxDaNYq22fLx6zElSLg/YZ5QqpxdYO7XK+kA5Yg0odxq1Gh2rN9aDb/fvyKkcgRtmhQwKZf63dlD0kfVWH8VEXBl9IYv5UfOX2aSL86IggD7A== X-Gm-Message-State: AOJu0YygfyKPmcZMjxX+N2gnd08UOOCPz7ZWN5TAaqPcK4hYKAjcTgRy LBLI5sjK8YEvhR4Q9iIuh+bMwuGhrITmCNm65IggqFjVA4r6obyl9iwBsrxbehr1M998yE73eQ= = X-Google-Smtp-Source: AGHT+IFyMy1BU0oZx/6JwXsp/4vsJrRNkMmG+C8Ka71bQJkoqXE1dmzJL/wVQAJWAN6pdiYpRVKcbQ== X-Received: by 2002:a50:954d:0:b0:585:412f:ff8f with SMTP id 4fb4d7f45d1cf-5995e1fc866mr5825619a12.4.1720956787625; Sun, 14 Jul 2024 04:33:07 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc94:0:b0:58b:d414:30d1 with SMTP id 4fb4d7f45d1cf-59821cb83bbls85678a12.0.-pod-prod-00-eu; Sun, 14 Jul 2024 04:33:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVqVILcGYVZn4K6w8weTPx8CmkvBTIYjMNgd4q+LOhCdzZkQ86+CIEFprLFPP3aqH2ql2w0MHstUws2VR8vuwRVHLpaEL/CZLatww6GQVejQCoK X-Received: by 2002:a17:906:e099:b0:a72:8c53:1798 with SMTP id a640c23a62f3a-a799cd36c58mr478806866b.30.1720956785929; Sun, 14 Jul 2024 04:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956785; cv=none; d=google.com; s=arc-20160816; b=BCVQPIEm8wXWfO0xc7yZG/Z87HXC0LJY3vvEniNsIM75NPrpYQnkvG2YYytz41Xlvm dHxXMIa32z1Q3qyomQ5KK6xafLkBkkQRMSKpJ47FOHdtOQzUNbS9pRIvwol/YNWpR+Zq uzHqYErfZfTqI7iNIXfvY77k9KtAxi2K9QMt4IfMx3iox89uvQF2YZyb2nWoZC2ECmos 8XzzmCfga+0Lu1gJiU66xUVWxRLghjcvBMWjO9A7Ta8ElGRNhwQXEEbmIH8GiWqb9Kor tAJLYsTjHIw4nDfYkE/34iZ4zs6yyHFMEJp8Cr5s6eAnjMES1H+Jk15KkZL3fAk3grBp f3pg== 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=sZizVj9XqXIrdVswG+e6J7vgQNUAS3XB9GXccsq1VLk=; b=Uuy4NPtuM03CmBH4Mqw2Q+/2Vn4l0wQoQTrQEfNwYz45Fl+hfn9pnjfGa0WjvEqY5y qc5sbNzii3pua++MVVAhD/9LsgZ+w3k5lmHnZ5EXm3xNSTszaLZgHJC4mDi169sFMM5q SMYWW491rtabgPEX/d5Ahrlgv/YzsrCXyB2Qa8mzREeP++439JqtjRpX5C3s7eyyCm8Y 63+d3RD/eabgXoQby3pO3U5p2zEBqlAy8lo5cJyyzChdf0lL8whLn1BVppvYbWmtdhwm kk3BC2q4ayMuMKlVz3LJkGHNas6HAClyVhQMJzd3/NjniUhw1gxsRXmEq8dHysfOIE5f 43+w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AZ06Fhpe; 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-a79a0f75210sor161822066b.5.2024.07.14.04.33.05 for (Google Transport Security); Sun, 14 Jul 2024 04:33:05 -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; AJvYcCVPcPeYHetxHGeIPTVOPHnEsR8yGoBBOCULLKNDQ3vvim1f1P18j5sAS5K5EOM9SM/XucWat12xVvNa+wEl6c5VNr97+RC0/tGb9KSGkIq5AUo9 X-Received: by 2002:a05:6402:3489:b0:58b:bb69:763e with SMTP id 4fb4d7f45d1cf-599642c3317mr6205902a12.7.1720956785513; Sun, 14 Jul 2024 04:33:05 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:05 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 02/25] clk: imx: clk-imx8mn Fix nand and spi clock parent Date: Sun, 14 Jul 2024 13:32:39 +0200 Message-ID: <20240714113302.133399-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=AZ06Fhpe; 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 Sun Jul 14 11:32:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3285 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 78D7240F88 for ; Sun, 14 Jul 2024 13:33:10 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58bee115291sf3546061a12.1 for ; Sun, 14 Jul 2024 04:33:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956790; cv=pass; d=google.com; s=arc-20160816; b=WTlOX6vbJVobDkBJo/uzXBghaS3Be98Wl/A84Be11lTVSB4Y3oeZR19fh9tghwgmBg XeiYwlr5/Ee3TruxRgKstNIdTl/nbcbij0MjpAN+Si1GTQv0iP6M8c01tNh14iO4+eWB 9KpDx8Hw+JIZ9cXqWwi05fmf7csDtf6pCW4qR8lIhLZWwKQjAmsYUIW5IMMJ9QLtQqiQ hOzd8up2DYMxdLlqlE7u/1VdPqnSV8wLjgesoMl8YMvJ9y/mziYwtuQCstWIWCHjZ+VR TOanhSUSWWBHeRo8ktKlUiBycKumRfu7TAv+l/8Yi2VMXptARQEkfnxVezSgQy/TuGb4 VXMg== 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=jQJzBefyMoEKFUwdAp+IRuS99yAP73LEJZFQteMGJFk=; b=NdXufbrUbpIitBK8AvORNi1b4Tf004uvuUtFGrSC3g9OdrB6dmDVG+BnNB/y7ELKCd xPCsv524tWUNjSjTBCIC646JwxcmHYYhLgRMOq4LwkAAwJOAsUc9oTh8PBZukB7iGErV Gl8OHd/9udkMkYfWiRADCJebpK0j1BGyk10IzGGIM3Mk0+JiVmVO82Am5uRYh9ob7mKb Zz2bwINIdEfLjq2sN3LkxYAhUattlS7x9k4pXc3HIMa/x1EPPwtBRt3uZv76U/PaPnjs r4CimVjpuJ3mFeTDiNkEPxfjS2LNoLCU3fo6WBfKnCvbf+ZINSWvBrBlYr1aN7KaYpZd Oi7w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ht2Utu8w; 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=1720956790; x=1721561590; 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=T9M2Pf1s53w2c0HtH17A9OKE5V5gRh29sO7NKWFVyX965lmeub1AcYPnQJJ2S4q2Un RtkVxa2BUyA061KR83H9auDuoYkn+afry2EgaAxLtekrAcnQc4/8+9xIilVHWRIfy8Ta nr0TdDoLLLi4DAzW6sO3/pLbV06E99ZVQ0eis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956790; x=1721561590; 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=dgrJW2DC4GrfSV5Kc9+X0zV1ieM/a1IiDTnrt2ind+ajgkdqsMsYMydxHhVbrNlvM4 iqAlmerAD6X/pd5WoYAJmz7RlJPj0evhXao5jucsgPB/ptaK0vX72pHELYwKav8A29cA QHjGS0FSgD3/OPb+2cKrDLLyEljsqEZ+J19k0ZFFHYcYCOIY7T0T2vyswbjgYcscKOuE przrlvzwsnFcFKaW0fBBUMpddIRATMbOUI5OzR9kd27I3/NIv4ZmryptWIBoKMBf7sB7 pDtmwi/DjxFFSveh9suRx54u2bu66Aj3Wtx+dxoVdy6A22qrLBuI/0yzxd8yAh6toPa7 HHLQ== X-Forwarded-Encrypted: i=2; AJvYcCXdOB5yiOtk2YkCw0whtQ84gp9HWKWkG2DY5xWPSkj91UtPwFWfRWyajOI+M82MipJTv9FYaiJjOruYgbmIiZpaz2QvxJ0GZQuv7Zitkah8WDH05qkfkrCJJXEoYw== X-Gm-Message-State: AOJu0YzMxYxSdR0rCFdnf+ywzKPp4kOrJV1oXF07/YPyvdgO9p0aXuKW +r2n3Adb2XTmp2gHuaaUB7VyAPfjA3tlcPTZWNI/NWt7o1gwP94iD+Zgc6jwPNyLew== X-Google-Smtp-Source: AGHT+IGoE1YylwniTa9rFeZzpLo+Om39qIumuMnuOCKbUq77Q90/ksGaVJUYnp+Y2LMcz/WaO0qhMw== X-Received: by 2002:aa7:df8c:0:b0:58e:a9b7:d351 with SMTP id 4fb4d7f45d1cf-594bb67ebd4mr9886397a12.23.1720956790158; Sun, 14 Jul 2024 04:33:10 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:d5d5:0:b0:58b:b493:fcc9 with SMTP id 4fb4d7f45d1cf-598217e0b7als222579a12.0.-pod-prod-03-eu; Sun, 14 Jul 2024 04:33:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXotsofQeXr4m1bteKu/ExkjjWkJpP/Dz/rkA7mBSYfZ+/UmoCrq38PZv0OFtcSxa6D4Rt1rsJGCdwQJwtBpINIhGnb376ZUKZDaswbOFQSCtZL X-Received: by 2002:a50:fa8c:0:b0:57c:70b0:d541 with SMTP id 4fb4d7f45d1cf-594bb674a9amr10482665a12.20.1720956787582; Sun, 14 Jul 2024 04:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956787; cv=none; d=google.com; s=arc-20160816; b=XbvwAAbmyzUwVTyDybUINtPhakp2t9Ohhy+hx0MJXmCdNw//j9+bzW/uV/y2BO35wU 0AABeGh2cocCLJYUJuSexmg8UcKAjXWmDYWvmSyGPypQgzjo/8inlYdeNBqT/WVmkKsN iScHb3uV2WK/S2LAa7hRzm5O5CEDH5emd++mAmwUOARYsGJT/YJmDcknmT1skIdWXGa6 grCwjIK93J+LALhOezPV+o6SGinJ5ynBmynDmcBYd0TXl7u8kegrfXzC/9XNPT3NTpX7 lkL/3CaShJGTf+T8Q/dLz6ABbr5X2pFNF4isbId+64EyHmAQZj/TbfCC9JmtqlUEpo18 rhsQ== 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=2Icl2A9SdzUtm9waDZrZVHRP8CMFzNocKMmQYW+taho=; b=uLmWJVZ13V6jjFvyR0rBiFL7jk/3Inhxd2Fs75Y3/MdfUY4N7kJ1Z+qjfot6Egzjup jodkea0zZwTDWNSCxC62RaPX0vXPW5NijnjyFZgvE861yOny2VufM/iLGnerlDtlA19m bOZLSoBcnTvi2vsDIZF+iKI1bGAKEqWmSVOpyEqtqHgd4F7DaaYiVoX3tyVSBqIpKluG NLFfwW72ptOrfVmpGZ1opVP9SSiKkmATCIfCoAt+QHC5AHXDcqLdah3JOX5lESe6oh+p 0++tJu8z0qac6b8GpjYd32lx8TsB3vc7iHNViDb0gzkU3LuWeAxxu+c+uNyM3oNB7EtZ P2EA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ht2Utu8w; 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 4fb4d7f45d1cf-59b2504b69esor471287a12.5.2024.07.14.04.33.07 for (Google Transport Security); Sun, 14 Jul 2024 04:33:07 -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; AJvYcCWD2+e9rfAkMIqQNwsTcVPcl0o3WXXhqIX14xtpvE9Ji7EMs7To226oBptvRW/PEhM10jZUn9AqKQlji3z0f09Mf1LJ42HJZMJDeiTrvmDzPRkm X-Received: by 2002:aa7:df8c:0:b0:58e:a9b7:d351 with SMTP id 4fb4d7f45d1cf-594bb67ebd4mr9886344a12.23.1720956787063; Sun, 14 Jul 2024 04:33:07 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:06 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 03/25] clk: imx8mn: Make parent names arrays const pointers Date: Sun, 14 Jul 2024 13:32:40 +0200 Message-ID: <20240714113302.133399-3-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=ht2Utu8w; 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 Sun Jul 14 11:32:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3286 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 E131A412C7 for ; Sun, 14 Jul 2024 13:33:10 +0200 (CEST) Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2ee8f22ef7csf33369291fa.2 for ; Sun, 14 Jul 2024 04:33:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956790; cv=pass; d=google.com; s=arc-20160816; b=lhqWq/aVzNDT0LCCysKetWUGZlVh8aa3w4lCRZGR5/VYWSqT7EJ7WK7cWto/VInuBq D4au7dAd1gsjdj6s4F+mttsrDddnuG8UIJF8kW4XZUshWXLdqeZpwHFkBs4rnO4aHeMl mZNqkDLTPrWFLCHCFBni9JvN+aj8p2dn5Stx6JiYidqSw44wgN6ajVz+/Io+YG7BaeV5 7Iffemvd4HUiJqmZJXKyXCj/KvMvKgGUjRmb/XNG3/9hGh8q6Je5pjJsSCElfA+Rae1T HWCvLzdXg0m16SbIdohgkbxGi8y35ywnVWGiX+rww03UTCns7kKByqdCT3C5dw613NVx zaMw== 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=CNuaMRkDC7NGHl/Tnm1eW1woJhYVo7TJ0yYvUb5bdq0=; b=noTtyex8F2l/vAmGSsXxY1sc7KUo+qlICnKupDumPbsKPET3prW8VCGNMcOZqlnThQ Hhqmyxsop2aw082h2i8n87drUh+5sseg0yh6K8oUxoyd46HgcLBVpEZqRCPXpK5YS3gK V0pBPwcGqtSPYDq9o7SjLnKRDk+bFE1dhYHX2TVg3RsyOgck5Lwqfh/Evo1CoZdi1BlD EpVr6y0FSrfbRhWZa4IWj3kp++euuA4H/9GrUWkNuSgoMg+mDGIe0fRvxDmgetH327Hy Hz9RACBEHW9RGd6qwpH8nBLiyHyAM5H2a27CSecvxW9g06ro9nvVPegwLaJHJ6DATF1R BloA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=LWywQ5tq; 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=1720956790; x=1721561590; 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=bx0Z1nOkn3/3Y8WoJwfFFlL/TUhTPleLfOvhpSLKG5uyOmjgYOJ9AjJwg47yokoGu7 MlW2mBKE86b8msw6qbyG40GTY4FSxbO5FxAmsEYlmJ9E0RGFEumQ1Q17fU43vd6GmeQs Ee9B/ppS2vi/EeS/ui7WC94hI0q7S2ycMsQEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956790; x=1721561590; 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=txAwcJ1JjkPuUF/d9PHdou1jzHQ/3AY1axWjVnB4i5EvwkjhpnWR/R1xq0xMSSVaEE zK/ufLkzbPTX2uX/0nGGxD4iZqthrdDEH18AsERfWeOiaT0G2a8dsgi6Ir3vJsn3i+CA JtW5giwLHH0rb+pvZ1uIZE3pxUAH3lT0lwv1wF1kvUgHCnExosswRHBXOVwJ3c4Zqar+ 3UMigjrtDpv8w0sABKJ9/U957csG/gOSpZz112NmKLfI9bxV9TeBMmeyig5m+V7nKY+B jV+oJqn+/Ubmq7s4XLozYK6zdvohiScuz1HxZ9de1qZ2WALWWtGx34c33QKxvJnKxJae iXJQ== X-Forwarded-Encrypted: i=2; AJvYcCUNMJI7gsJ8lyGL/3io8lsE6i0EPSZLqxGm/LDRhZlw/yQJWSJdH41jxkSfEMzpFbmdEuEtIGQHwpt8cwXn2g37SX+oH8oW1XovWSUkexAp9y5AR+E+2+6fGqrVCA== X-Gm-Message-State: AOJu0YzpnuA9yLUOlKzleQJyUMtk+EdZhhJxop4zX8vC2kvLdc/EXxCW Jf8XE9zlGfdJD41HLNE1hfxe+euQUOW0GHl7JvK1o6foCOv9p3dpxIgmnIYreT0VdwnHsJaToQ= = X-Google-Smtp-Source: AGHT+IElLkAj9Bv7FWe+AXPLMybjTPrVeIgQly58z8qFH5t81HFCojlpgA15QickPjBMAk669JnbmQ== X-Received: by 2002:a05:651c:8b:b0:2ec:4d82:9e93 with SMTP id 38308e7fff4ca-2eeb3198608mr100917281fa.44.1720956790255; Sun, 14 Jul 2024 04:33:10 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:28af:b0:584:b54c:52ad with SMTP id 4fb4d7f45d1cf-59826225ad3ls1676292a12.1.-pod-prod-07-eu; Sun, 14 Jul 2024 04:33:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWTe8ygYMVu6U06koBfM2dTrGriYbwr0mGDkREhXaSB9G5eU8zhcgy9D7z5pYZED0G5PqjhO+gv6yVq+3vbmw8YvDZvcRMY2VzPgI7nqrAMRFyf X-Received: by 2002:a05:6402:2105:b0:579:cd46:cbfd with SMTP id 4fb4d7f45d1cf-594b9ee10fbmr11454197a12.18.1720956788570; Sun, 14 Jul 2024 04:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956788; cv=none; d=google.com; s=arc-20160816; b=rWL0M/37zhEgZaYKaZ8/Ps1/BjnLt4BDYr1ptEkGLbImrqtF1o1ovP4FueAxssTbOq UlIOQibaJEIQL9s0RL+zxng97TTkf14IOxhngZuDPb36yBD/lp6j4kjmLswRsdt8Vv/y YEPbTIYy6EHtvkm5YaAfb2PpmZl6AghJko7mWOHYL1v6G/XvfslmZU1lnWELL/sgKoU/ UulS//BPpC5VP8TIVF//02zJISXuz8UyEWX9ZVQq/40gMSYJn5KKYDf/5FMO3FHopBgz eD5E6eOmIy4Bn3QXHMbwds7GpfU/SoHCZwGWq/MGt39Z5Kpt+CHhcuaAc1Lp/Ci7OWOw K+qA== 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=VH25uA6VjCeFulf8T31TcmN2Z9GlIK0L0mEs51BrVZw=; b=U/513efmy8Z+cJ7WURHiEEScvhJSlfQET5h42opMaukbliZuPkbTPHjfvYn1IOGf7Y HjlSXUjMNRDEDatWqJec09yPknXrThq3SIFGg7XLqhmMSh18qBM0qtv5NwOyq8Ct+PpQ JDal7gTiCZajf3zxhDIDv8yg49XGzaZVofLmiCAaGWZyz2giHrw60VQwjAEKzU05feOr Lw7R4lX6Fkc5IXpv3pyefUxP//c+uqkv4klOTqAVODp+rkT+X8oYCaVjT1/HPbirwMmI /QJPbq3v6qCZaVqHgMU53JwOKDRF8yZRpX23ZrUdroVag/YZM5/O/+cHLQ4j+vQTJ+ph nlIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=LWywQ5tq; 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 4fb4d7f45d1cf-59b26f622easor486977a12.11.2024.07.14.04.33.08 for (Google Transport Security); Sun, 14 Jul 2024 04:33: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; AJvYcCXSDNO4Dsntv/hcC1FXvTPnlOGtLR/zpYV/dtknMVj7z16+OSC0mfT+aIIZSLnIrxwuM4ow2HX5Mmihj8p3UmUuSljJX4NndS6QtR/qpWUoHoQU X-Received: by 2002:aa7:d1cd:0:b0:58f:4420:8126 with SMTP id 4fb4d7f45d1cf-594ba59f937mr9330542a12.20.1720956788194; Sun, 14 Jul 2024 04:33:08 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:07 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 04/25] clk: imx8mm: Make parent names arrays const pointers Date: Sun, 14 Jul 2024 13:32:41 +0200 Message-ID: <20240714113302.133399-4-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=LWywQ5tq; 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 Sun Jul 14 11:32:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3287 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 4E1064130C for ; Sun, 14 Jul 2024 13:33:12 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-57d3eca4c01sf3096437a12.0 for ; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956792; cv=pass; d=google.com; s=arc-20160816; b=RV+VTFHybKy0epluKwXuuewW5DGpGp3pTG2Jl695FqevysEjOVX+lJUztxgaB3Mybb Qv22GmPPg3sr/aAzFXIeBEMUGDrPKndp8ioWxRXnfQxaNtLhZhtN45p77sEbIdtCrzx8 sIcKjvQHwjLfpiPUs1kRJBtOfP6WSu3dww5YaFbIi57ObpFPXKHXuxwuJg9f35aUegBX LE1gJz3j2VH4aio6owVDQPEJGaMMvUrkBZBVI5lTKgw+lOSPaZYezeJIPffb0TIIShq0 6lsCX7aoqeC1B0ArnGBR4WGeMKcP3ayJSCc+u5CCCU8KqS0VgtG/BXuDhPzFvKeivVZA 6OFw== 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=wFpNp2CQY5784WQa+P1o37Sa+CKX/kzNR8PKRzeB920=; b=BKh0MtglLc4bWj3ibjiM6djPpmaOuolyeBp5q24sfHs8Rz+6HjXkwwPyaxeOLJmrFO dQ/kOuPkFCs/mn5P28KPea0wpkYPVgXUrnVZ8oZsWarDBiNBaVvIhlnoAZ7j6JlWx0mm pkamYRK6B/dxJK629eQmCeOoPRvg9Fpt9PMJQjJJXXbDqcvxxd08oBeXK4c4WnDoRuAC nhnhwGbA5ZEDhTM+ejLmdtPw/swvd2DzzBDmlPhpjq6ZqYpZ25DLYHtbsVnG4UejLl64 AwJk4IwrZSOqldz6Mkf0uc3vsmHmwJAuFkX/IRheg0TW0R23fCCT4pXEPhT7kgmMCO4Y Q7QA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lS0HJH0j; 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=1720956792; x=1721561592; 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=d72UVT02300ym4l6ejnNS9V8vPotPyhpFOAuozfgWupRZOlOr/yU+Crh50EFFbqqOF atwVH/6Aad8WaUqlwt5EICFp4WDXjM6jgcPbGhJHfspPfwzxpqM4gAJNw7GQto/sw3ul 5znx+SPwNmzA6npZXU4g7yv02WBEYPtSYNcRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956792; x=1721561592; 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=g5vUf9ujvpAvnz6IAo3QnR3zBGtloOD1gmVrgKZlbKgxL6npoOYyeWp47msIWnYPOD Auz67HA9p7jNhMzx/PV4Ky7x4I5UOo9Eh3jldaxm6+MA+a1JQXgpaEX1gdPsSpMfFyD2 XA9wahKUDnfaWiWWhjmBySK5MbpH4wrmc2O90gMCqAZqLbxQSzL4W1kL++V3nClIzSZ4 u5wAD2fkEeGJlPTR3OyZv2K/Gcjf9jiFWLOWduZ91Akb5DWf1vGe/egBGQ71BTJ2Ez3J PuKm8sVINSllPyM1x+Pm5n9EQr7z891nzqj2kBSM9wEm8utsg6U9pjgc49/0VqINK/Qx xxDA== X-Forwarded-Encrypted: i=2; AJvYcCUetQAeuLF6xBc5Cyk9GXGwCTkBYToiLME42XvxNZFnhdmxgtpuhQG49twHnINJ33VxCQ6sQD26D++bjvkXAQrNsN4A/AXDiibimxhkqRxZkper/6M8jAocEgRwIw== X-Gm-Message-State: AOJu0YypYt2PG5HJxL9cGALSq2n8uo/C/4umCUSACARahAzJxIf3Z5QK NrmG1h4QCuOz62RasfCejaoU7GvuQ9zQL0zx1NtInH6DkF1Sdfz6hvmZsbD7d4Ca8w== X-Google-Smtp-Source: AGHT+IFvVJxke0XTAN8EBKs5F17PNXj7Ewh5X6Wie5N/Zl7h7tL6Si4cpQJILljUcMZnd+JU0dYy/A== X-Received: by 2002:a05:6402:1d53:b0:58b:e192:361e with SMTP id 4fb4d7f45d1cf-595517f4501mr11500059a12.12.1720956792050; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c84e:0:b0:595:7fb0:945a with SMTP id 4fb4d7f45d1cf-5982622a74els1532387a12.1.-pod-prod-02-eu; Sun, 14 Jul 2024 04:33:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvwXbamIn650B4g8HIhbWgfafOPfCOwbUm2YmZ/qjuWUSZKhb/MYClzw4WcLcHBJN5Gp3i+ITcTsFqvJm9pVOdn8LomsqOR9CSoWbg7OZP5KmW X-Received: by 2002:a17:907:da7:b0:a72:50f7:3c6f with SMTP id a640c23a62f3a-a780b688751mr1299919466b.14.1720956789860; Sun, 14 Jul 2024 04:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956789; cv=none; d=google.com; s=arc-20160816; b=Kxu+szkUUbTVu60k2cs0wBCDxcQM5f/jD2YvV3MYaMSxn/7S2G+U6lBZWV3KuDa7Q4 jsI7csozwkPIOAPbZfeBVtubP8JujMC61AxkwJUn0Fbkl+4ZJreZHUsVxOp0MUp1tHik h957cYLMVtLpzE3Ai8qP7wNps7Y7ecDBfcMRqKzFdxzMfu6BDdVVh2YDxUW37FV9V/EV PzwW4icntQzfdCBrBF+nIV+Na1y9VQoZyyBbcF5v2xH2mq4Ylrl8pF9qHF5KyvYgVqWA gY7iRp1w/TWt+1OPGV1Z0e/l8xPKWwktoPGR7V3nZRlQ581IsK5RZlAdkquz0aWJXRpg D9dQ== 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=pAjgSl87BfXAnPzTUWRMuM7jKOO8iHp9BP/ngs9TgUI=; b=qOoWZ4KQvcOmOntPGvVZzjroqjhVfO7CtZhWMwzq/f+9A1HRH6868n6vZa+22H2UNi ye6ryGabLmiSRBvbDGglDNnyWk/8yfNA4/Let/Tr+5lGAe0INYRDurpkt0Y1rkm/MUNO i9snDintnHAVXvRM7Gjrc9EkuYMcPW2C1uXyBK2v+tvbSKm41fqZg/b+2K1PJtINZ1zT IL2++gpHlM/SLar13P9gEIK08dhJnj4kicELeiWzFwtzYXMj/tms3v6gNidQFOar1Jko Uz7NZSawDiVASMn3kC+HSye+krsKfOuRdnirV9a7gCcSgDdKBgMIjoEBHucSZDIt53u1 EYOQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lS0HJH0j; 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-a79bc887596sor49086866b.10.2024.07.14.04.33.09 for (Google Transport Security); Sun, 14 Jul 2024 04:33:09 -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; AJvYcCUrUB1UJTfKr4iRh48J+7rDfWZp7nrWlgPV4n43Q9pXqLSzAosv1XkvNV0kAOHFpw699TsDmV75x8oIRlA5xidwkarZTQmN0Yuuh6qDtC7DPgM9 X-Received: by 2002:a05:6402:26d1:b0:58b:9df0:f9f0 with SMTP id 4fb4d7f45d1cf-594bcba7bf5mr13856346a12.39.1720956789354; Sun, 14 Jul 2024 04:33:09 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:09 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 05/25] clk: imx8mp: Make parent names arrays const pointers Date: Sun, 14 Jul 2024 13:32:42 +0200 Message-ID: <20240714113302.133399-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=lS0HJH0j; 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 Sun Jul 14 11:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3288 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 F045C40F88 for ; Sun, 14 Jul 2024 13:33:12 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-59c1314940csf429509a12.3 for ; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956792; cv=pass; d=google.com; s=arc-20160816; b=ADNx/UPo5tPfBadSlz+PQ9L47GeAb1XxeZqgy2OM+bhYbvi0ZjUyjF4Lxof7aKknVf PiKXEqC6MOMp3LM9a9afM3ssP/ATbgiNudB67RsbZL4JcecBgHx0HWFIBy4p6d9OeN9J XDxpnhcM50emaHrBKN+FhkQm+CXtq12dqGdNlUS/aGzF/OevBcO/zvvtcKw/uC+AfOiQ T2LVxZSzUUf1s/SBNRfLoNfedzrT8yusOuCKNGUOVUzrIjpvS3VDSrMzRPVJ/j+rqUsD yRPOjv7eIH9L4zQTOR4MYxKeoV6kRBslOFmVy3fXBQmfDDKp98WqPxuTblumCCt/CGoc /49g== 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=gf2/GnNlbGMcc4b/R/VQ3P1paAia634YQVT5M+dKa0Q=; b=QyO0i9vRKifvSqOzHNvlGFD8ILBfnTQjH1ESmnSEm21k9p6Tn8mu5GGruN8LYq9+Sj 4HrWMDPI+GI6VOsqGlLuT8cwxt+RNKgu2POfRLVNNGPKMAntHLCUvfukbOJgjUwX6OiV ZtCT0Lx/iM4+rUEtgq0d3hMSgazNdMEtwfvvydY5sqy7crx9PEm9rFNhypmz1Xd1Gdxr Ph1xeVGxN0naBhPX9A+P247UgOxcA+1xbxJAfUxUSAGGjBi2viS2j4vBqki3+EQFSlXg TDGY8CwYsWIGkMS9Pi6u2XW1kNM7CKyrl+DDIBgQYZ4v65A+wLiRmUjf6yvv+q+etuvq klXQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Msfb5rcq; 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=1720956792; x=1721561592; 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=HoosvCWoZryUxBxs/fyrJ8NwmyN/Eld0s0nSfOOoNWUsLxtOXu3chRErUNBrEp+DyX XixGkiCWbVB7ysoPTo7KvTSRTRTTYmyLvVlecHyi+LyRnoTIB7QF+zzPTKfNhs/nULAo clFvf17/7ljlwsjuHvNzYmke3yOmrAISSItKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956792; x=1721561592; 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=Szhv8RH1xr4L71PsbzO6d8C6YOXkh8bi0y1CnLa4rkxEv588JoqSxaUzebobyHpe7l rFMEtg4vqTgeIwsW08OPEwB7pV2zzy1aXesH4uT1MBK7ULnC1gnRH+FGE1nZUIFl3cGN mMEE1skb9a+LMbxK4lgI5rGjIHFNKMeCyNS0nnpURzb/FnoaLbNSIB5DZo43rPE4ptwQ q163zIhM/EqRfzvrNP1tT8imu5s1/7WdKRYg95JQAKlsDHXjeq/2iSqE/adQjJLQVLDl wKEIricGXZmRRIQMZju2khmslsj8VxqqOqTGWSkxbOKmtidvvvFQkuwBiNEiYi7z6MVc gKQA== X-Forwarded-Encrypted: i=2; AJvYcCXm9KsLJfCv7lsJ7XMeWN6OpNjaLBRAIqMnxkdHMRiEyuS5NGbRptouFU81GKF+JVemh9xEnlg/gQzwhYFP2HmBql6mZKWJxSOvUzYC6GDMRFGVjQcyWgFhFJgx0w== X-Gm-Message-State: AOJu0Yz8jiHt5N7Gx3Yj5N3Cwn2smQV6keQN79Ud8IJXBvuE3O+9epMp mOlFYJPJLehKhaB+w9UyIgslHrryxAjfCXyRVHq31QOAHllZTQhSvdEcJAtmIc0czg== X-Google-Smtp-Source: AGHT+IFt/cT7Oda0dHpvzPU/uNzJLkVnArRmCY3aZf50eqxkwmMBErFQVx8TycWZbFu0KwilpBBTXw== X-Received: by 2002:a50:e711:0:b0:57c:61a3:546 with SMTP id 4fb4d7f45d1cf-594bb674a8dmr9601830a12.21.1720956792702; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:df14:0:b0:58b:30e8:e88e with SMTP id 4fb4d7f45d1cf-5982612f083ls198347a12.2.-pod-prod-03-eu; Sun, 14 Jul 2024 04:33:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXnY4ChRIZKvUcfno+7dbM3LbS+DC8PD/ZBXXsO0e/PwpQ47bXOOM1sLHnXdzwvNKvVQihviUBw7coxG+y9jAPrGbb3Pkl0LDggFnI6xTBb603O X-Received: by 2002:a17:906:2342:b0:a77:e1fb:7dec with SMTP id a640c23a62f3a-a780b6b316dmr1002948766b.17.1720956790978; Sun, 14 Jul 2024 04:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956790; cv=none; d=google.com; s=arc-20160816; b=nf0BD3/OmEDZ2Otmvi/EMM3TFw+N24qxq0njE5vVR5FI2qj2BDn+YyVBVgi0W65XqX +F9ocC5FfaGJ1YaZNjkGy/i/+86buwDHQmtGxdoE0omMQZgBKQSP98By2MMM3LNop2mg RaKxBvkLx5f0wgczx8mIB11n+o4Cjv7B/g/8Rb7bIvOudwDpEefTrN3Mn7ZqOQl0sXL7 xPRbQUitxF7obcHgOiRUBRQkYNoRSZGoRNbd8QrdRwQk6P6k5k8cGfoGjc6uBayAF9Wz RL7RO1Gn+15pbi//lC6vlMsvspGttrDY/V4UIYae1MnSszHVUKtLTg3XGt4ph7yMwKjc C0Qw== 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=ZM6WpXIzTra4JCMOlF3IaLPGf1VxwH3at1qwgCPc5b8=; b=Y2H3sFA4eQE6qjuIkEOnDJ7fH1HAqGvpuT2AneV/kU0L5TgP8yLeq4TqgnE/zmq4LA vgEewwhZ7xM8a3QoHFmncXCKWlxYCaNIo1utvjy51szW947M568h/ff4WIpIEB9lrvAb kJkjNzFt+wUjHg88vmHOgtg7vztNpKNRdKZqjeXtcjQT1FotOaJy37efmXKAlq4Da+mA gSuxyFSgmAb4q5UAVJbHLAAeM+kTNFa8c/l0cebzWp9IMXL4CAMsWhWUQcC/hRAOOETx 0+/zd5eQVA+7ri8bln1G9ylynMCW0DktuWiSfFV/pQxObx2YduQjNfwqhSSzDEi6Gllq LhHg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Msfb5rcq; 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-a79bc5b2be9sor37525666b.8.2024.07.14.04.33.10 for (Google Transport Security); Sun, 14 Jul 2024 04:33:10 -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; AJvYcCUHbBf2fv4I16VLD/LkbqmJq26Dw/zWCRVjJwmYJNjtTuqIix9d5z40pdAhZwMNQk2lAkzkhW4MUEuXFOJ0ceOD6mDMr20Yw7+EOhEolzfopD/R X-Received: by 2002:aa7:de01:0:b0:57d:4ca4:61ba with SMTP id 4fb4d7f45d1cf-594baf8775emr9662314a12.10.1720956790607; Sun, 14 Jul 2024 04:33:10 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:10 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 06/25] clk: imx8mn: Prevent clock critical path from disabling during reparent and set_rate Date: Sun, 14 Jul 2024 13:32:43 +0200 Message-ID: <20240714113302.133399-6-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=Msfb5rcq; 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 Sun Jul 14 11:32:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3289 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 3059C412C7 for ; Sun, 14 Jul 2024 13:33:14 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57851ae6090sf3299111a12.3 for ; Sun, 14 Jul 2024 04:33:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956794; cv=pass; d=google.com; s=arc-20160816; b=Aa+hFvIQjyLkrxmsBBcJePqmimBrS+UkgLghiWJMr75putv6qZE4UY7PzVtXchYSnY w1a/DeqCUq3+Z0017yrf6XCY/XxN/Yc6RwtV6IJiaHkvhgQ2aidG6H/hYJVkaYrgK3Fj jnRlVyu3JDvx1dvInknicKI0M/KLBLZsJ6eN9Hr5jkq3J3lwaxmR/b5KClrbRoUYf9gu va6ciIN70U4438TUqJsbFvZ9q0p6YbwwXLJBySKP5hoyGz7JABvCzpIdJTId/E5lIQPi Zz1D406a2S8yuWUde7h31ujAA2oJ/notJ7mYRYvmHGT+8YWFWWxjF1yqG/A3P40bP0yQ AYSg== 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=oBZqcteNav7lt2Spv38m1OfhG6XFnJEFtkmUkUfAlKI=; b=uO+oCcRI+YEdqcvYGoUbFjV4zxZIfK70k3H2zD3HXrZSJ/tLfjznJfFyLxIX8Y53hY CnTChwpXRqcLHKOpa+oETtjnd0b8sbng9wdtHI3FdIb/qzYm3vRIdZRxJA1xBKwQTLid eB1QDCKg214nK8CWklg7bU8ST8xv9ZSHQpjnT0256tDACWyuHl8Z95BDoP2qOemtpwiw My5YpxTsgOw+v+eR3HJTsaLy5koW7wXEwli2PGmIejzCqmZaMspsYZg8MECwsScpLch/ UMlUrMjewMBgEh96XCteJhvk8JNY4HcoJLPSwKDwnlzsQKcOutHluG0SCnNThoqvZPRx WVNQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XycU4TLy; 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=1720956794; x=1721561594; 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=l7gYSD03QxDrKDTFbavK1snqVkvZxzn+Pw9SjRybYK8H6qVFwbE+NjqgWoFX7gHqTU cF7bhY15wCCrwBED6m/gmEGn7HsgOV15dTKYhF+bMaxN7+rATsIJ3WM2C7/WACt/Zdle jwTR4D1EATFfl+RukHJjCg6g53Mxz+IAEptCg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956794; x=1721561594; 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=T8Ab55WlhCVKYbvR/UHAEXTULgDlAXD6akUn0b7w2PzBweA+8grPlr95fi1u+UrSBz 6JHykyo6B4TCslMNrRRTu8s4LjaXSJqw9gzeJAz389FcDmBJPisZISNObNwR8evPFdcQ FXTBSL53E+5Ke5IIWZ3lc2+ZdQrQSjiI+bLxKjUkjU9QsQ55lM7cRX519ezUXiCId5Nl 9L7WXV6UNLa+WNFursDjF3cKZ4BusstYFQCGflOcDbQhE/xpMEF1PFikXZCbV7not8c6 UgD88t68+FTUxgzJ29te54ipmUaP/NM26p5dJ7BMLS3hXjZ+z450Vrgp8H3rQlyeaYKO Jm8A== X-Forwarded-Encrypted: i=2; AJvYcCXXYVvpnGQHUaEWzAveUy78bYsPGq6R9YitMr0sUnn9z4k74EayTrceJbCPwDRz8hYBY5KWSPKyOfJoN94NvP89U7RWdudk81AJLxW0d8yun0eB+1T99WOBwSKEAQ== X-Gm-Message-State: AOJu0YxP8hw0VkPByok0A816nbz6Y3EV+ABEb6YWgbGQcXgmwwQvy9Vs 3BcKneDuvg0oHTUBL2SBvD+xHNdFfCucyOYgT4qXK04/p+CNBJp0dg/ShL6QHDrcJ0PyC0CSYw= = X-Google-Smtp-Source: AGHT+IEIIfJvIj+aH5nbQx3wBLAxpa2qC7N4RsyxOF2NU7wHbilcCW2cSxwDMvJJpfVLihO5H0xZ9g== X-Received: by 2002:a50:9f8b:0:b0:599:4c76:69f6 with SMTP id 4fb4d7f45d1cf-5994c766dfamr5129192a12.1.1720956793887; Sun, 14 Jul 2024 04:33:13 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:308a:b0:58f:749f:1c6c with SMTP id 4fb4d7f45d1cf-5982622cf27ls1718684a12.1.-pod-prod-01-eu; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVsVwsK18ijOZwUTRGJ4wFxXkgDEXQXK2bdVvLvSc/1+XYqxyC9an3+hD2oLkTQMRIVwqYTcjqrIbVdFxFi3eyxSedwwJ7ZOw9tCpJamJw4iffv X-Received: by 2002:a17:907:6d26:b0:a72:8d40:52b8 with SMTP id a640c23a62f3a-a780b68a34cmr1360605066b.3.1720956792273; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956792; cv=none; d=google.com; s=arc-20160816; b=lkLT7WAvzEKzw13wfvOFElzm9IsD/LQa53JyA+A5Ng37BcsOixXvag18UAuLED5Kbu mY4SBQZHgIyg57p6H2XJ2Ow/2tvajIDZu0GWcD/nIA9NN3kjVyLL1Kd/gZ6PMASumLnO kIFT/YCa+bNGtZEA9ZXKF6aTzM6noUe36zIlPLUqwWpCVAC96zwWyyZTv2cVGDiyyig4 fQdgQbRyB78vNCt3b7tevPZAQKnO6E2Vuqj+XmPARHJtZ6N7v4vs58U6R3JxBebxpNTz bbawI22dfiDZE5zKNBYHTGKpYDO0aL9btb6mO552p4qmstbKtNOSopgfxmmAiIUvfFtF /LvQ== 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=A54fgNm4iaPnM41okreuoyvzrdtRA3bvjlLp8NlEZRU=; b=m3GtT0UE+1p+AHE51hkeUpec57+XvZVDQRiD2RN9w43DwJb/Df2fjrr0EJGHMJEdYH AV3SCg+AijjdcwhT7rF7EK9umvAOLfMdZBlSgFkGVOS+uq6x2hYQFCS73vjFbpYsFHuZ A8PGJcZ5efJWvjLBSBXeEaCmHL9nIoe6wYr/KEdWPmZS9jao7W+l4scLE8whgXdsObRs kdx8iHinWrqzG/fh4na5K7RRC3ZuTH08ANPqTvbpUYqCURGPKcEGyfWs8CeBRQFzq8T3 W963bIL8IU15O+1OjVSk1dVFaYSxrV9i7qnKvOB86uBgfYoKFkVMBWDiZaSrEDrDQ57b cqdA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XycU4TLy; 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-a79bc9596dfsor41592366b.13.2024.07.14.04.33.12 for (Google Transport Security); Sun, 14 Jul 2024 04:33:12 -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; AJvYcCWz6IUDy6lLhoVMzaKD/qYxFJhSKoIh2xC2cFxTzNewb03Voizl65TWYmPqOw9bN/FZj8shVuJlwMh408viLj+AS9L9thAbVuF7TemHACu5x2d7 X-Received: by 2002:a50:ee06:0:b0:58c:7c2f:5c0b with SMTP id 4fb4d7f45d1cf-594ba78a00amr9505939a12.25.1720956791864; Sun, 14 Jul 2024 04:33:11 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:11 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 07/25] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Sun, 14 Jul 2024 13:32:44 +0200 Message-ID: <20240714113302.133399-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=XycU4TLy; 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 Sun Jul 14 11:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3290 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 7717040F88 for ; Sun, 14 Jul 2024 13:33:16 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58bd8406816sf3378076a12.0 for ; Sun, 14 Jul 2024 04:33:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956796; cv=pass; d=google.com; s=arc-20160816; b=LADqxAHspq6zFBi+LAQEYYQt65bqVQ94Es4zqlclmxIbjLOYMaAgkYr4Fb8Y8c0tc+ khsr+Zz94YfZzVNaLiUUNXjOiNKmfDjiXOesF5s4PnMaYdrvXpAaM7IQOgjycAi5aYzg oMI5cHQBAJzOhdFnyhJPxRkhY/CwMt+8w4WP/vd1vAOJJHkwEHks0g5j1tTxPaDhUWaR tj8pHuXR9ICdXJq2Jo8KYS64T4JrQurCt/GSaRK02yT53mSo1pYxES5ARNLvtdcmd9kn m7aMw+XJRg0thbIimE9lFEyKwdbepaejLKdudNYcG+iRuy/ANeJws3RJiRYXGMcpo+KG FzyA== 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=IPV1Q8Jt5jKCBPk1OPx3CmE1KLr2FyoNkTec/WSma1s=; b=pl2GeruLTVDNkbcRo5Km/gYswkYc+rGef2BkOgWzouZAqtnz07rMey4tHRBmLOLecc ye4DbSCdQKj86CnQBjSW486vSpbVc9/8Mct4IcVhNSUWXqF63R6xVMBjqstZJkO4A4VO aPVZHmvpjAFXXPiivzP4TRVj5LVQXHYD9nlycNI9cr2XflY7u5pwbBa6HMoKXuub5JpJ 8sfh2dTJaFeX5sNrpSdztnAfUhrAIUHu2GAb5e5YMuZqlUaHAQ9LEZOd4xAPS9MFo41J XmYJwPG+4phZ0B9MtNcm+bVW6Zk24iaWgYVSD8k1xBbeAPHBPPdVRcDBA1tR1A7Jb2zM v1Rg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=d32QXp2g; 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=1720956796; x=1721561596; 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=ILsGLdq0cpPoSO3xbdNdiD5iInN/FPQ8XTksXoREWmPIaniKxaXE95msgv6Y7tyx/l euy9FHcFUyQf/0TZF8DKTv4lewDaqlswrGb83ULzHdiBQdtuyhka49hvpbSDmPU23NNM 3cfXELhC1Q41XhFgsQ8h3f40QEXykiVEdU7Tg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956796; x=1721561596; 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=eGr4/Gs0aBRFwZnBodDnAe1/xqi9xW2W6Y+laG6LYcp8ZnsYuIHvL7pHvq3k9YEfZu xP6tNpkoCt7zyV7qur3VSG8GQOON0G0fpj14eeYO3bncpdOldMk3+5lMSd/cgH+4KIF5 ShAgMKcF4V+E6wRN0bJRNJP1f+NR1s72JSnh5GMrBQLzYWzVqHfw5V/0l1CIERuB5IOA PxsJwwinaRVyjDBsDpIOOqPAjeiVGA5/7K4nIUqOKJ1JrkzS2eL4aleHNhoArTgSCCrw JOHAN0jcUMtKWy9/aj/qTJMYoSh12Fi65VmMfdhlI6C6kA/bg+gjQxkTXK1LYRE7c2aY cFWw== X-Forwarded-Encrypted: i=2; AJvYcCXA40u36nbXbvRSiZw2UhRlGuOHY11rfD8p1R1rO/zYMWI0agBSv8OC8O8preslqDixjrmOGAvxti8R+nNjyRCMXkps1Ho0/6FH9SwKfLXpfXjX4sBiSvEdYOTO/Q== X-Gm-Message-State: AOJu0Yyy9LwYWE0tvJlm4fLOx+emWsKQHs991S6A/q6aaN0RJcADkwzO lwr8pr8v9tpotvH1mEDSTpLQ49udh56r53bx3bxM1H9pcm/RrKVlkubyAG2TxtIcUw== X-Google-Smtp-Source: AGHT+IGaj9Jbs6TwYI66LE0DZeO5l4dWKWK22YZm+tnE8ja6egJH6r7JTuWMbAhZ1uc/8132wJW1Hg== X-Received: by 2002:a05:6402:84d:b0:57d:12c3:eca6 with SMTP id 4fb4d7f45d1cf-594ba0ced20mr9689128a12.18.1720956796153; Sun, 14 Jul 2024 04:33:16 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42d0:b0:599:5a33:7abc with SMTP id 4fb4d7f45d1cf-5995a337c06ls1203859a12.2.-pod-prod-01-eu; Sun, 14 Jul 2024 04:33:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVEawbRtmuX6xiPRa1va3WWSGqY+eB4rMbrMlwCSJS4kYyWn1wpQP8VoMDgSFJX6G5kyD4sgNq7KvekoO+tKcEDKDwIL/6aiqaRuzFwQjZLXyPk X-Received: by 2002:aa7:c507:0:b0:586:2fdf:f827 with SMTP id 4fb4d7f45d1cf-594bb86a504mr8938052a12.31.1720956794307; Sun, 14 Jul 2024 04:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956794; cv=none; d=google.com; s=arc-20160816; b=tXONtw3famVSt0fgOmypNL24aC4uduHaee86TadiD6+lrC/xzc94qsdzGf0/Nf0gD/ lHVhd1JZ2flfX3mO/uIvA2zWcLt3fs41L1RP79T9CC3Ml/8BkmE7zKxabwXfV12oZHGS ma3+kbxqnnAgjdly6ONhJPQ16PPafqlX+G16OwrjSqltEpn/U6exJXuCVYta2TTi2yaJ fIBDnhTBw6lwbEMl2ndp0M9E54igRF1kpawxfsQ9xFJ+QAHoe8BBhSTGYLUVwmS3zStG CugAz7BsjFgNBeEq7FWB2NHpHFoWsW9dQEDki5T9IUDVRjAYmObn2jd3Oz5x4Va1v0HW iNcA== 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=wXgRloJXUBes2/3auLabLhqI99CBV135brwRxbUN+/E=; b=gdh3eTXn8mLa07LxW2Eh2wxODIJkAmca+o8FEaXofUelvwPsjBtyC2f3PLeE1jJGQd 7aXiYYZn/4JX8PigTa3WJg13C7m/8HhraS6t3gEw+oXnw0xGXn6JG8X0QhZUvpYRQkxS mjw9SPS1LPtxV9tF+6lsYBVSm+g+nqd4BUFlO+LmTVPBaoMJJQ+Hd7TmxOYDyQEOeZdL qT870t9KWww+KUF6CVQ0XORIaPohp0ql3Ff12ICtXVzu8QG3L1b27sCkl22WnUZ2BuIk AQdw8N/ZqSrXijBcbpmyYPjyNCWb6P+XGteQVSuEZXZ+x4vsTyS1Hdjs5YAEzIzvku7k ieHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=d32QXp2g; 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 4fb4d7f45d1cf-59b223b28a9sor459585a12.0.2024.07.14.04.33.14 for (Google Transport Security); Sun, 14 Jul 2024 04:33:14 -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; AJvYcCXbXPFO7EdZxrblWbpDfSdWj9ciWJ+PY+WDUTIUGACebiOBFMEhbIFUWSoeYU9fiwWJyvt5Or+Dl6sN4HQqsWJdu+qeuceX/dBh/Vjn+l/2nwzP X-Received: by 2002:a05:6402:234b:b0:58c:909f:3d46 with SMTP id 4fb4d7f45d1cf-594ba0cbe63mr13344929a12.10.1720956793015; Sun, 14 Jul 2024 04:33:13 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:12 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 08/25] clk: clk-uclass: Print clk name in clk_enable/clk_disable Date: Sun, 14 Jul 2024 13:32:45 +0200 Message-ID: <20240714113302.133399-8-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=d32QXp2g; 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 Sun Jul 14 11:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3291 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 4CD92412C7 for ; Sun, 14 Jul 2024 13:33:17 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-59980727364sf2020530a12.3 for ; Sun, 14 Jul 2024 04:33:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956797; cv=pass; d=google.com; s=arc-20160816; b=HrrP93dMJb/PflVzL+XKAe0g2yJ3xM8u7pha9+oz0y4PHBPoFMHvc6rtJF7deeov95 ptn+6+WQfi2TJ2Tsxhi2QxxcyQusi/RzdIaOuegMiqeBMRJNQODUJDkVUVkh/Y/rFDuv GMC5qqensr/Xbjg3IINfmym1unF7w6jVoTyZIHg4FHrfQAiI2Blh5dtVsnvNjrUZVLts hq3p4f4AH7+QB3I7sy192WrA+7/FvQDiyvAmE7E/9YeW9EBmW8rT1f6tscFDrL/yxzbN dndH8idm1RKX97vtHBhjRJabmPpT0/7c+hEbLMjK2/dLv4ubaiHfNtu0PeW3aG+Vfq70 qM8Q== 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=9kggebPEOlm+C5bHesBA30N3L2ufy82vSS9lQILRsCM=; b=lHN0aonvcTmQNjgXjmKM8jnEGdArPymEclXelghCFazdAixKMskj/FN0Qt9hzbD0CD VRzEl3S2JeEm8QHAlXe9LIe5Avf5hGnvgNL31IZgwVkE8bBQHHzIfcZZM89cRL9cqQLC jBT7FqIX46fadfeq6xdLqfFSyQ8oqkFlsppBaw3j8Sa65XEy4lJ1cwka40C0vDAIpcym RsHM+XLoV1noWuFq7wXYa+lX6fR6iYiIikDw1WC7fJ+IT00ltMT/Y7G3U1XRAvBChdzo rx+Med95yM0BiMMAurxcPyxNT36tMzFa7JC+Fbk57ZVit8BbJrx6l6Y+qV0AOb3Re+6Q Rl8A==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KDstL7mZ; 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=1720956797; x=1721561597; 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=LUI+C4njqb3uHMeubWsRUX6GOWgQckE00Wk4c5r+0USUPO54paT0zfDKmvEU9b78+J Oz29aWDWMuHXAtfs8K6d13HM+w61VEsMTwzANeMnujBqffzMdHu9t35ER2f8aS+buKMA B+a9qSSnvayk20NSGzYMhidPKCMCR4FSyaizM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956797; x=1721561597; 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=DxeJftm4lZ1J2Mibd5uLvUID0meDNUXnTGBxM5wxV3yYiCwnqw5KTXhMIubxhbQOmz fsz4odWmav8lYip7olYCvzEN0cAJCH4ozM3C/nyqRfNTLlvPuM3orbnBXxtKJiePcQO+ 3+ieCR+ZmhgCBYCNsRC4nPEyerDh7DalTxoQo19iVfHw3pprGB1YiMJbUwxWhlC3VkjM 4XGUK1ee+l5hgiYHxyUUAP7CoU4khR0H9WSGhVncigEsBsR2tlTmzT1M56s1JfaWUlSt yTAhzDgbGWYmA7nzPIjV9E5Lertz/Vq4KQ6ve7gMKLXWow6z7zb0w09dUF0nnCfC7fsk PPbQ== X-Forwarded-Encrypted: i=2; AJvYcCWw3M0B0GFO4QD+KbLry6vurSk3cJziMshr/AzaUceqCgbpqCwFIo1+FYEa1MDQ2JWmrG4HvVI+WzUbR3a0na5pFGDMMglRGe7VjObGh4zC3i0mI+eq1XHxPA0s4w== X-Gm-Message-State: AOJu0Yzl++c+yJABZ5Dl8vHujxG4dKVef6N/1KIXKn5Gl+ShkcnqbRuE EdLp/QXvbZFmWusIasfq6eAN3De1aJSAn7rvHSDhz/zdB/BKGu+0TDKolNy7CbbAPw== X-Google-Smtp-Source: AGHT+IFo3T02XDVWnonpogcJ4cY6ZmIj47ambpIWQx3ouz95jexq4nou+NIqEGw6KEeaboY3hEvuvA== X-Received: by 2002:a05:6402:210e:b0:57c:74ea:8d24 with SMTP id 4fb4d7f45d1cf-594baf915e7mr12359653a12.18.1720956797055; Sun, 14 Jul 2024 04:33:17 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:c17:b0:58b:b493:fcc1 with SMTP id 4fb4d7f45d1cf-59821cb8394ls978345a12.0.-pod-prod-06-eu; Sun, 14 Jul 2024 04:33:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUyoXRZDuEXoOXImdby6MzDXCGkRzzw+raPKhIral1RLVwhVBTrgM1tbVdnP0Jwqe0pBaKTUL3908RxuMDahsE3XF2qrM7eHxIzJYZDiA7YiGin X-Received: by 2002:a05:6402:28af:b0:58b:9e7c:bcbf with SMTP id 4fb4d7f45d1cf-594bcab046fmr9142410a12.36.1720956795376; Sun, 14 Jul 2024 04:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956795; cv=none; d=google.com; s=arc-20160816; b=R1ptepVoIMTpBRTSHsLQiSBV4yNPTnuuEyRaXYBhgDixABlYFIWxTOMh3naICBDBko tDONZGH5ysmUUQ8P2UjZOIJMofA8F9TRYdoPEwfJhaJtq7swrh14brMB079VkPYL11KK Qf3TyoEUsb5eaAqZIgR3XC17drJblqGL7ATBUE1J65NFWjWxX+9jEIsOKr+qBd5tlPgm Gj9o70kXMZ2ZJ7AAB7Df4lc/iogOAfZj9S5Tn12S52av76Movbrv+XEkAusp1sxo56ng Af6C7gV6IaAfoWtPZ9PpPVhewfLV/GMqyYURd2yFFS156Tgst09lwI48Pcmzpzsj+tva GUcA== 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=TtQziSequcy8tjdL1kUTzpguJ/56ANGboYYuLdQI1+w=; b=URKNKYJjriRnKA31yC4RgSHy5VM36VjSHDT6wIURoT3iAo7/sOCQWwEazgLKE5Gp5i orvN3eF3lu3RZNkCtOewLzAQHEqVsupHorvDFxpRZU5A5O5JYubDrMKxG5Cod+wRe3+b T/MGqAVzXdWPnSGsa+rDxwnyLAFAXq6H/9eP/DLxMLud+POJYMYy5NpXP9j8HkFM+twO 9olDlzzb86DK2f9OIkZM9eTIyZe0KJn6ecOj1q6fcabFoKEPaevdK42Nfa+pZaluMhKl ipqb7/1eOrvTXgbqfeLBD9Rnp6CUPpvgq8NU4CKMeOq2l5NfYrAl9R502lo85VLULtHe /MMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KDstL7mZ; 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 4fb4d7f45d1cf-59b2514283fsor503021a12.6.2024.07.14.04.33.15 for (Google Transport Security); Sun, 14 Jul 2024 04:33:15 -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; AJvYcCUvOEHXmUhIbtupTQgFeCXuDT6ToPtA3RPlleQjgU4XSezHis/rRP/z8SD+hyierQzUB/247q+OgerBUZjrMtG+0/JxwkzbFuWk4mG9FViOXN9R X-Received: by 2002:a05:6402:35c9:b0:59a:a8cc:23a4 with SMTP id 4fb4d7f45d1cf-59aa8cc24c7mr3628536a12.9.1720956794968; Sun, 14 Jul 2024 04:33:14 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:14 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 09/25] clk: clk-uclass: Implement CLK_OPS_PARENT_ENABLE Date: Sun, 14 Jul 2024 13:32:46 +0200 Message-ID: <20240714113302.133399-9-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=KDstL7mZ; 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 Sun Jul 14 11:32:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3292 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2D90140F88 for ; Sun, 14 Jul 2024 13:33:19 +0200 (CEST) Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee90339092sf39878731fa.1 for ; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956798; cv=pass; d=google.com; s=arc-20160816; b=SPttqejdHIcnAzBRK3ze1VrkhJOHYFJYGfy20FUyDOoi/sd2gQAitC4j0g5txmf84U 9Bf/zkpSWV4eE4byZCrRWMroYtYpg4KHFK1PWBxBXd2UMbV9pUSQjhtFJ3o6BvVrgG5c jlXftp7VQQb0CNXVELEpBVveSmfDNwEnBMvVcuDpYj1Hb+yIW8TxGYrwSwfexK3ZqteU SkLBHfL4KZfz3RXefDFjWZyPT8Yaw41Sldcqy5vCLnotvzbYAdbYvHM9ivQEHr+KDbbU 71NDAQRlB1I5gpj+4BuXAvsfmtB+wGEQrw7Hv8EWBFmvspfiFafFKj1cgCfXs36CL9p3 PORQ== 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=kd77x5if9RrEzSqTPg/8DEP5n6Hy8hs6eXio8w8Xs4U=; b=xC1A9cMH2RubJI0v/TFI4L+4VZoqPjSFLhoje/KmunW6zZ/dlO6cvThapZ1yMGlqBo F5jqfIvDxkTeTtkKohWuQiaA/9SyE6MJrp/h42qGduLtE0jZXkyL1DAWFoEkPXL8E62N KR/ruc72dzfoLawhzUP8FaU3HyWhb/DDboUDx3y2zs9wCTFfH1NTYK4QoHPPu3j9vZl/ QU3EOFJt+xIb1xVS9vR4c1LT4hOYE87ORPXfJV3H5Ft94Pu6y5wrhdqNCbxJoxOxpJ5N 4clpdlUMt8nKp6lu1XR135DmNHBk/r769Xwfh63VU38BrsaKx7txagMLR8Ad2hlOOQrC AyFQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=k3XeHeFQ; 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=1720956798; x=1721561598; 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=g3JfECgL9GUYND4QNBSJPBfebqgwbQRb5u1S4c7OFELDpR0vyLO06nfW775PTKFqfw qda1ifLGa4m2PiPhUOVQI0dTD8U5LWCqqwF2pMCYWNfBHxb3M59UkVIAgNrSDulpLpEn MWVjZN61o3iKcdAm8p+HHewdF8h/S86lH6Qig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956798; x=1721561598; 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=hI6jsw3NDeoMUjIDxI97+BxCe0bitA9vuhWnCmnRoSSWKiu/Tt93lgJtNO1Qq40opI HkSeKsbMD0SHL1smDac7DOfUi3DUWEgzF+/RiF9FX3cGNvWfQWTfmC/2TUXtVsUkDSBU Di3KM7l9jUvme5+b0rnqKOa9FC4sOVQYBsee2FeOuEU7LY/mollGyscCHlUWIs6v624Y GnmVc8IK710SRpCnuW2hTmS3blTXQMHBVryc2cGT78FSTZr9klUinsgaUqqnY/fDmTnY Uer+Byj3nMPK4JwwIw1jgnDY/i7xn1Wc5bLl6IBig9pwLlnZ/VH5NiDyLzLnutAapiuN CIXg== X-Forwarded-Encrypted: i=2; AJvYcCVR8nSPTY9khjG+zsZhN1j4SkYTlGhqch3T3g+Ukj9meY5sagt9UtjrdGQXB6E6ybSz95pOcuTX1U8m4HdwxCSp1K5KAWUrW5yParw4J+0eFMw6DAWobRuqnn1Q7A== X-Gm-Message-State: AOJu0Yy7BD2dBFTJktSKWJRZFJ36JZeEVVHgdQfiQa+mO8ld0F7BmUGu z4JNaTQ3CPJ1w2kLhNQ1EPR9kMwCZNqC7j/LSfkI9pjUUhJE6OpyRML/9t64snNlS/twiDN9hw= = X-Google-Smtp-Source: AGHT+IFJEwSuNbW8K/dcoWHT2lzd9hRc7kvQx7yQVDws7xG15xDJw4imSEKIl92/T24CqhKDf8lf0Q== X-Received: by 2002:a2e:b178:0:b0:2ec:5172:dbbc with SMTP id 38308e7fff4ca-2eeb30b9e55mr108215691fa.5.1720956798482; Sun, 14 Jul 2024 04:33:18 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a2e:a554:0:b0:2ec:5504:285e with SMTP id 38308e7fff4ca-2eeddc7edf6ls1413861fa.2.-pod-prod-04-eu; Sun, 14 Jul 2024 04:33:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUe6loItuv/IZHtCns08uB+VxeSezhZW1j3KiMLl6YcFZWh5Ug9Di7E7mBCvnm6TOjLwmV1jD9neUl8nGAW5zptcDQPG5RM3f6ecTpMuWQZRgf+ X-Received: by 2002:a2e:9016:0:b0:2ee:7a3e:4721 with SMTP id 38308e7fff4ca-2eeb318a3b2mr100872321fa.39.1720956796515; Sun, 14 Jul 2024 04:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956796; cv=none; d=google.com; s=arc-20160816; b=y1fKkDJnYIPT/cfQo8eLIy2w5D4BCmDTcC0G3WEIecXNsbZdrNtm/bFw2HumnAAfBM 0Nd6RQSFI1XXR6lD4zICWn3dXRhCwRkGabtRybGdssjy4GOYRfpPP6Z5ZwCwJUkJDNa2 6PZQRim5m6x1QYcLsDjzkE4OC/RqzhPFD7fTuXBDAPAEmmlhT5w7p8k0O9qLxhDMSRwr UGjbXO/ePKW3bHFO7RLZvJSZLJ+DD2nJJycLi2BTkrQY0GwINNzPQFAT3WJuNeuWjkZp WulZG0rBFtWizkttzYwLDQTPCFuG0UgDkD5U2rzLiZ/RX0Koo4mJZLTKUUqHVavO4nfh U62Q== 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=97afnh1Y+FRoOBktTgK4LujHNcGQlE2aYL5NvpHfeTg=; b=cfCrhzevDX/0cS/cCaYVE+MFRf8NTiH9QzFd2jh2QtNGUdnlkOLHbS95P8VrMwthj9 DTzyD6XcOGhNSgc+vLTE0LcmOwh0BDkFbVvg/t2DYXTtQ0pTuVAwaGENSn7+esi2P17o UHN7GoQMrR2oMxP5mMguQP4UFrPptN/i67+XZi64+ULfFIJH/JbstghApgUHvAIgEIx0 aIJ9Isry4V405SnbOX0HkBJeua/cZj6yKB6IFZjXbUnROLyVxwazLWswBJO6iyV004Ha lkbWoRx7M8Uzjgh20wyBPYG3tpEeEPKFk7Fp9YFw6984Cf+s1eDruPk78bgV7uOrgYOV Rxzw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=k3XeHeFQ; 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-2eee17ab5b3sor4146111fa.5.2024.07.14.04.33.16 for (Google Transport Security); Sun, 14 Jul 2024 04:33:16 -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; AJvYcCWzkOrLjbqgAH0TFvXtyrQvg+nSaBnQmdaNtwmQ8MUY6yenLjOk0Um3zq6FNC6CuGkJgdEw+opYBpDQ9h+/cVM7Lln0MCL5kHPu3TspaNLf0ZJy X-Received: by 2002:a2e:7c18:0:b0:2ee:8777:f868 with SMTP id 38308e7fff4ca-2eeb31895f5mr104312431fa.35.1720956796066; Sun, 14 Jul 2024 04:33:16 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:15 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 10/25] clk: imx8mm: Mark IMX8MM_SYS_PLL2 and IMX8MM_SYS_PLL3 as enabled Date: Sun, 14 Jul 2024 13:32:47 +0200 Message-ID: <20240714113302.133399-10-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=k3XeHeFQ; 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 Sun Jul 14 11:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3293 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 803094130C for ; Sun, 14 Jul 2024 13:33:19 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58bd8406816sf3378095a12.0 for ; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956799; cv=pass; d=google.com; s=arc-20160816; b=UOePUPjuwmTLCn4ztUN33UhlVARDWebvNYQ12Qr7TulBeASWECc32aE5b0CBFSBBZC nZhdXE41JzxC7lST1wFyZFJPdllQ7IiWDnOEbP/nOYJVERJsx5f/1RJRiizhMIK0A2eM iSuvl0KSWyeXD0+MvO3CGHOCj1xMXgXdPiwo13n7mGADg/eUAf8YE1eZtmoKm9YWk2s/ 5cddFbTQefMb+my8+1G4Eo8MwdUyDiQOLR+4fewb/0Q26HWd5ENpLOUI2Q1glL6VZ9UQ UiGkoHzAIRNVL7VCpqlMpL2nZKNoCFc+oxk2syh3CgbCAckwBHb3Tcyh43HRB5Aa/ijK LeNw== 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=E4/PHwezXzkY07MCYN8vbs6WgF6/teSC5uT1FrMmskU=; b=Fj2214FB+0gFn1gKEo1RIBeEXapdhxufrTAHNxCjrGSeZJWHHy2rCzUz3HppOt1eEZ 2U8XM4XMkbh+986AjULtA9/+yE+hvqfrFrTqZHqj3Gawak4i7spyVewaSpGIS/J+M42f nCqH2oFSB5L5AQay9RoryboTQ74i7TB13qqYbGkyQTwpSv6U7t/szF1rbYKX4F+pZhVW P+tDiia/Xmj6IpzoL4ZVUJ5HFnSE2vP8knjAOGNAKviL42mGMymM+zfl1w6cp9y81dpD fXRn29lIDZG/X5U6ozleGyFtabqEiUqT53mImVkyPrgQ7gTUst3dgUfw0vX5F5gG0LYX Ny2w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=M+AQEeDD; 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=1720956799; x=1721561599; 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=T02BweQGwJxn8iX37tSw0GuwWqeCosQxKC2Yg41HbqfI8FPDIswPNAIp46SMRCoQSV afSHU20t1CYBQkgPKyz0e8JqgIors0jH/s6vvPP9nR+t/r0KCDS5+5+bzSRT0j3yiGkA +EkFUdhbd5elFpa2V9PsYQe3Px+2+Hn8iFUFE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956799; x=1721561599; 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=snZHwLKmiJ9gdeZM3/VK4FA4i2tE6nVHbayhFq80T0s1QoMKOX3UzZXysLUxJbtaL2 bP81qFXjqhGhI+7Ib2XE7Wp+2wbeHWM6WINv1ak8MgOueA2TInSKiRBMz/H3O+3LN1NG fUCOkxstsuqyKvPAYMYhwQzzujg9HCHyvIAHs55xWTtL+dSWyZVJ7fTtOeu5FwdpWnSh pbLucJ7o5lFyZlV4DKrAUslrABR83EZa/ETcI6HukFZNvosrHe/5tMvrxDwG84c3yasy cnPDZHu8bosRyLuHrQwlukoQ+3VXTq6f1sn30itWkVFsfIsyYM2hTkKf9sey9rBaZqGE QBMg== X-Forwarded-Encrypted: i=2; AJvYcCUAWtWmoBzcOnfm3/woaLnedleRYUHHgf/UulFZBYQ5o+zDV68gBJ1RCgKv7pD6T3tshe2W5Uy8LPPay+pGLz++0yJ3MWniWZxqilvISOH60aju2wvsQI+c+OcUHQ== X-Gm-Message-State: AOJu0Yx50huX/a5DA7R2xhnkjTCkdBRIhZDoPLJ0Yas8IRiaSwOSG7Cr MQaj3U9Siz7QvtZrXBxgZMx6GQ7HXjaSgqSyCKzc4sXZp439Q7xUOSK5GCv7xf2kbA== X-Google-Smtp-Source: AGHT+IHmdGBL24tveT1jraVOuiESdKndRCmTRzrNEPpMGuIndwFEmcz7Y1t9Gk0tI2RNJZx30AIh+w== X-Received: by 2002:a50:ab5a:0:b0:58c:ea9e:2194 with SMTP id 4fb4d7f45d1cf-594bb86a463mr9726818a12.32.1720956799265; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:308a:b0:58f:749f:1c6c with SMTP id 4fb4d7f45d1cf-5982622cf27ls1718694a12.1.-pod-prod-01-eu; Sun, 14 Jul 2024 04:33:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUewneY63hO97beVjScIwluvGC9RBJmCNiH6Qj3+4ipPvJlAnZbP9b4ooYRYIXzELZez09CHD4P9defjf1U2wYP2X1wNX+ZzO/OTN/er8UySgqg X-Received: by 2002:a17:907:6d10:b0:a72:5c3d:4d08 with SMTP id a640c23a62f3a-a780b8856a4mr1397562466b.61.1720956797615; Sun, 14 Jul 2024 04:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956797; cv=none; d=google.com; s=arc-20160816; b=XDKfRTzLmsyjHTXUJsJPlx1vzsVj9nDDnbsQUpiTJuemsI5Bi5dx1ev+NUSoLMMbLI TbQTpKRZIrkip8JtGPINOmiHy3cb+PYku2rkqW+JsyNN8uu1S9bOA+OVFw6kR1yFzes2 07JYFYUYgQjXTfERmcdH76d31ud6LmOhdQt4hosJjwlkEBf1sadnllBfuUBVmSQR+aCV 83UtSKjSb96W8/PSGFptKmb6mf5U1zvhRtvFYTgXKKONxfGGys7Piz+k+JgkFN1uqzqb Hs5kv/tr7z7V0c40i+QvoHnTMTHUMvpo6O1RNbZBtPTsPPjwsuLpyWbOxV2nd48ydaqr CAGg== 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=GNyvZmrveEvhSZuC8Shf4C/8r1OQ6QpqSIJKgwedMJ4=; b=L7il3TgGbpoQApnaVFdxUwGzFoTJ3DKdwDH1y+92fD/6Z2dhk05RedAUjuFnAdegb7 QAQ/iV516n5qyAmniuLOvbGxVYtHJqqQF2JV4r5iICE3BHifKVuAOIwK33bq/ZzCkSfl prOGjhqqJR8AaFJqFBDmlWk6UEJlGDlLpeodUIgKxgay0ScLnKkFYN2ca/u79QTfXJXP +U/sMZtok+2+pwfwOx0BdwH0FbLDE47CLLZcZE0ou+9ShDO1zr0S83H9vd/whplErAas mLPzdje1nRAaKxZmohK3DcLnItpw5711+2Jhs/3K/NBbM3RR3dWCg1mP2bWAy9cYlN+H 9uEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=M+AQEeDD; 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-a79bc8750fbsor47047466b.4.2024.07.14.04.33.17 for (Google Transport Security); Sun, 14 Jul 2024 04:33:17 -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; AJvYcCVSxQndPbXFQ8tNSG/Q+uRx16e8Kx5i4J2SloqioDWYAx8d1gLuCV02DfV3Kfxkt1NuG8sxFdoP522rnyI1iCxVItzP/M8wEmnKp2hr+nE0ouCs X-Received: by 2002:a05:6402:51d3:b0:58e:373a:26a7 with SMTP id 4fb4d7f45d1cf-594ba0cbb90mr13108329a12.13.1720956797292; Sun, 14 Jul 2024 04:33:17 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:16 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 11/25] clk: imx8mn: Mark IMX8MN_SYS_PLL2 and IMX8MN_SYS_PLL3 as enabled Date: Sun, 14 Jul 2024 13:32:48 +0200 Message-ID: <20240714113302.133399-11-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=M+AQEeDD; 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 Sun Jul 14 11:32:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3294 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 1A407412C7 for ; Sun, 14 Jul 2024 13:33:21 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-58e847f01f7sf2946204a12.1 for ; Sun, 14 Jul 2024 04:33:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956801; cv=pass; d=google.com; s=arc-20160816; b=xNsR+Ua4tqiUFll5vhN9P5VZxSFIyfbdsnlDAwnSwW11FTpS8Vq354qNr6ed1qtzhQ BlInhJ7wZhRyIH9TYGuxKXQMlXi7qazLB+ggBuavOr6AK1EGHdVpv8OcD1Oqw5sY9LNM PftkzvLBHedmTsc9AwTuEei0/I0p2hSZ9WReKSrJoJldnJyKtRE8scGoBTjd7CvKXOhJ Nja5hcVwOCysx0y02W7N+n+11ezOADSV0l4NcQ9E7r/gM5MpS6l5qAlMh+9mqJ2K1aMC nW813B2qyqQ3Cagj5/DdsllHQp/DK+bfvid4bOQgaWTzAwRFLRpKsslD3hPNrWqFTLY9 /VIg== 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=W+wzgTLUIGMXIUNgDgJFNnnUJqL/GcoMUfaWXvphm8I=; b=PSg6ZMcC6OtZO31kL7VmUMd5XM5vIAFh9cNlyddWE2WuGX6/BbmsONBHJeAJ9/rCK8 kHBb+7W/LJtiLo8pEAmIPfPIW457sgM+vYIPHn1U10VQQVCSg4pdhlUiNdeQ6cQWBo7L d4KTqLJ720rEFNwoY4O/T4DCCK3IXR9U5Eq0POi7n/F+iBZT4tHJixGbQ7sbnrwiCfL4 QxfDpKHPqk4EjBdBlWK7bIprxrd3zyE7VC8dJxXQI1SdN8q2KY5r9dssFZDGwjyji3hC xBzZSkOrz838+S8JTSQ6xB1JOwjsyzQYZd7H6HwbBPXdQbzqD5elKL30h23hDgx78skD XOwQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=D4fR8hP6; 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=1720956801; x=1721561601; 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=f9ynT/q2QwyrTTfO9JRN/YvkJ86QsOSvBRldVSzAVMMgjwSt7fns1vbCvmjypB03Ry QiV+cmb3em1/+gi4RmUYC33EvV1XpS2Vp1Ke0PbFBiykQHhvMrmO4qJoHVFPRcxKvnrv fRFCO9YF1GRmqFK7ahPgwLFrUTeIE+yEOmbYc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956801; x=1721561601; 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=lGohc9e7tEbyA4vbv9h8CnixBLCbu5hOIveCHsahWSjSyUHrQqPkr0Mh8EQe4xJvtJ 2zKxFSVrLE9sIO2fsZgzgOUwGj/HHy0xdiEumc3TTwKKPbig4A+Os6rP4vpkdtsyBuO6 QilstSB2IJAPFFSjr4zocTMedgNuGleVI7k5zSpSMvj2zwe6vOf4Tv0OC4uWtSVsIoEA iqF3JpPTLByvR64qHe1IP3u+5R5bIf8uRL6tn+U4OZc4ZOnQb8yF5qEKKMTrzrGS3La+ LdN5cK823Q/qnMPUmA7N30ibvK6wKIgyoM4rhYxxreN7Du+y3KwVNNp8AeV4jHjglDla rKCw== X-Forwarded-Encrypted: i=2; AJvYcCWtQvHt4NiwU/JsErJJ7Ru2ugjM2Ic2Ak6/c2P42YcADFgoZSOfjyUtMXPBbjmBQCuH+4i7TigmPHjbjPUdbCqAr+6q9xxanOCzdeirV6GMLtAEPNqS19D0pGgszw== X-Gm-Message-State: AOJu0Ywc9sv8vLv52w9L+5e705l6//1rMicvfbUyLVeWCxj50IMS1AE9 3SoQsnLUayOfA3irLEK+r7o+Ydi0goxJRCgGaksgdB2f+uevjdVihXyxFZmXH+IKIA== X-Google-Smtp-Source: AGHT+IF3zwKNANOOSB/rnoOeTS8EUz9vjLU1QGd/XdWRjuod3WtTU34FEkUMB8kXX44eGzxws505qw== X-Received: by 2002:a05:6402:1ed6:b0:584:a6f8:c0c5 with SMTP id 4fb4d7f45d1cf-594b7d81a1emr13886751a12.0.1720956800775; Sun, 14 Jul 2024 04:33:20 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4310:b0:599:9c73:c392 with SMTP id 4fb4d7f45d1cf-5999c73c484ls1286648a12.2.-pod-prod-04-eu; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUMq4TW68arAkiW2fWR9bFb1V7alciivPaOb6UQMTn8yyxgQcvWrZZSufzwxydsYXeE8RmFARLyyrnkuEkDu+iB9u1ON4kvn4KQnbe04XZm2flS X-Received: by 2002:a17:906:5292:b0:a6f:4a42:1976 with SMTP id a640c23a62f3a-a780b6fee55mr1112908966b.37.1720956799089; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956799; cv=none; d=google.com; s=arc-20160816; b=bjzP8jTiuOG7bWL+iBkQ+QSr7A+t6osGQCLLERP60YOxFAlpH3N0T7Wy/vaQoaOvkB AnG5nlkU717wCnUTWL/aMsN1j1hgtZBIox6cqSOaqiGM1PE7k/s6IBVkqkJ/TjI/BQwy XhewKfpIPi0nmKeltRYxxHoofAqaFA5N4Z4ZVnkUnECS1gs88BCjLeVoiQMhActsyNqq c4wQ03GPaboBiINv9Eekr1fnB20zVxOt8QRYi2XHKIXzOAPM2tzGUMkD2c/wJ8DB5wqs V4At16Vs2U3+4cbdJKS1mHWZlkEjWmgWnQycBa0gO/xWdRNCkCuggMCq9SWBybOvDujF S2yw== 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=Dwur1eXSkR4WbXLgcqMRKeQZr/JVJNzQ6qQzEQQuZjA=; b=CECgrjgmeFQqaGlBpoC6+MD68wkd1bAQCcojm+ewAmDfZiFMqTaGi0VmCI9wop1MZh k9/gPYnPjiTGo9rIYLXZV3d3olLhXf3e9CTNEY1uXPeXCuVtzjJ+zpkLMwbylEHGpQlO NBtHZtOYKLw7fCSnfF7dhnq9+xJVPl8juWzk57B8TNAIMuDCK7mMWtw/QnPQ5Y3Z1OXt f+t7BiGSHpTPlBhsBMAvLJ1sJJtARS98MARZ5OnhNp+dylbH3SmSyadIu6JCRqI6x0a2 m+2KHulEujKT+pih14QM42V7Ka45vGOkCylGjqphrQsMGvSHrXd3CXsF4xE1HqPTrrFw mUYg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=D4fR8hP6; 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-a79bc58929dsor47902666b.1.2024.07.14.04.33.19 for (Google Transport Security); Sun, 14 Jul 2024 04:33:19 -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; AJvYcCWQReknVtd0gZ2mM4qWm0dfshPICysuTq6WoMimSOpLdTFxDBSqFtx/Fz3ZvsM3JJ7OCTA2cy4RV+EZOoRaquQcbO0Qs1ugxt3plRdl0RV+trsl X-Received: by 2002:a05:6402:234f:b0:583:a39e:f469 with SMTP id 4fb4d7f45d1cf-594baf87a01mr13186621a12.17.1720956798706; Sun, 14 Jul 2024 04:33:18 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:18 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 12/25] clk: imx8mn: add video clocks support Date: Sun, 14 Jul 2024 13:32:49 +0200 Message-ID: <20240714113302.133399-12-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=D4fR8hP6; 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 Sun Jul 14 11:32:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3295 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C82AA40F88 for ; Sun, 14 Jul 2024 13:33:22 +0200 (CEST) Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee8f22ef7csf33370481fa.2 for ; Sun, 14 Jul 2024 04:33:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956802; cv=pass; d=google.com; s=arc-20160816; b=ETOlSDrl8TM//Fv67qbAZBeiFtSDaHPzVJMGvPBvwdPoxVXNPI/yrsTdYdytg4WrEE Mn+/PJ0/i2OYTopiKIlDkdtMj8+qmpc1D8sCkrP5CtvsU1TCRW6ygXXWqAbM0DhxJVbr eQIlDEUrZV1BiLbQTynlzp778NQpakhJ6v9ly8c0zQMxOqb+2tEbWhmOOVcfc+r4VfL2 aE1BZalymOTWfoTq19PNhhbhd++rzopkV7v4pot0+/pcSkbAzg9/91J0WCdUznYyJrtt 6GrE5kE0BscEEBImxhni3NH/mj195FSdXvgDRsIMQpmG1sd6pWJ0YepmzedggPDJZk6i S04A== 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=6kKEGq71Flu/bkm/cVIbSE8SvgigKmR7PukApHAGOt4=; b=z5I6RkhTkRdEVbzLtnxA59tY6ouXaBIYwdOS8Uwh8433m7YPPi105bFZKKmSIiCkMR 5CaDFiaX3l5CvQTgTAQFIISLfupE0SHAKLq+CkPZGduf+BI5vGwru4eK2/TbC0Ac/00G fWjzEPwzNW4XO7E/vm6u6uZO17+x2dDtW9a48dnFzWDnWy8rYyNh6TIHZx75LBp6WVxA t+DhAf25i/6wUBbKRUeH5p1yEW8gj8p5YBJOXWn7XT6kSwHtXFVIGTqWfvYRRKn2RQBT INQKft22rMh3SHW8txUnsysLzEAsQ96QmutED7ZZVq7h5JrjPvVgUp1EmvxOMyFOLfZy JHNQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hncgyi1I; 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=1720956802; x=1721561602; 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=LdRIZdsCW4ulI7uCrreeUQruKSZYk6RpFWddPqS47J/dhj+K+QiZ8qKOlgj0RxcLv2 fz9GMiye9ITSenMd6KdvGkEgVoDI3nZxCcSSi7gVIoiktkzsC4kgKpbERNt8kBMFejcn h6W66xE3xqTBwDCSog/Hq/7DEHT0hZLgcut5I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956802; x=1721561602; 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=K1mRkfEc7hc+cHejE5mvlIiTwU45t3P6i5A/zhqjxtrPGDBLL3zm8Aba4AX90vJS/H q/dl9Vnh+oFCgYgPOR1A3GHlcDN6T2nnWSiL/ep69xb0afQE7WDEYrPfNUhYtOU2ILtq gWtUKZ8eHK9aCGdEOBlklSYJ02pdKNi+hKiSURLJquccQudQq+ruwH6Pr5VNTNNzcAyf YkUglb+i9KwxzNfRi1VDPxPetqPUTRQYnbSqv4OSJU/M9YiJ9dv92CJ6lWE8xaSl0MHT zsuHmHtfgyIANCBJJnI6u9503c/QFbXCplVknNU0aFeOqv4+MHa6CoxILS4D+4ecBSfE qGnQ== X-Forwarded-Encrypted: i=2; AJvYcCUonUNa0AtXdFgd1bh6But8JJVCrZceidKWnnVScm1avuK0cFIrXNIK/nFUYUO5C4IvBgShJVkYw43gyM0HAEHx44G8mt9g5Y4u0LFEizJvdsYhQq+ShjGaUtWU+g== X-Gm-Message-State: AOJu0Yzq9AzgFFy+kJueGFMgXchyfYM+v2Dzx4bfNNzNNH6QJ0vAjv14 Vl/+7ZIEApt3tyCT72NWSQ/qTui9sap/xDtvI165DcCQ0KBLTTfrvPNmo8XOHiLNyg== X-Google-Smtp-Source: AGHT+IHMzQyPlQ1DtjjHPp0jPQmT1Q32JwKfDJ71NnSAI4wCltXnIhsOM30qKM9O8fsiN4vEAO6csw== X-Received: by 2002:a2e:a4d8:0:b0:2ee:92ea:8d0a with SMTP id 38308e7fff4ca-2eeb3102734mr94671191fa.23.1720956802116; Sun, 14 Jul 2024 04:33:22 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:2188:f507 with SMTP id 4fb4d7f45d1cf-598267117b9ls1813400a12.2.-pod-prod-07-eu; Sun, 14 Jul 2024 04:33:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3GAdBVCsEsIYOaedn9M/GpwvieDzInCLTASLKswLVU3dDgw24wje7maQABCg/biVt2ABsTzK3967oiA1pzKdL7ubWVsVx6AyPMxgmNX3/UrJS X-Received: by 2002:a05:6402:518d:b0:58c:6edf:d5cb with SMTP id 4fb4d7f45d1cf-594b9b04a3emr11837916a12.4.1720956800303; Sun, 14 Jul 2024 04:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956800; cv=none; d=google.com; s=arc-20160816; b=coXVn5ybicBq49ozZtK4U6qT3mn+9XC7X4aPqssMAiuYHdaXx0h1q6q0Zi7M1c4cz9 w6oSB6VLXq1qVDekDEQOvSWbw7FaQHaFxB9Yjbn88CdBO8HuE/8mLv8jadbLTsHvE2rz /xnpU81U/PMUmiLXDRpUAxUWqBF9LWSIhwA118An0Ietcfta4v7LDQgxCvBP6Rb5nTzC 935wiKv07jsgDj4kMdjqrKd+cvXbLaAC+kcpt+2jpgD/MEFldmrM6fknINDliNKwTLYd vFP01GtwLPzk2lbkMG6wR6VkYdkNAYaH44zrZAfkTVEv6Q0nRK7HFzxcavNcGnx5fR09 Akpw== 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=pN92kYjpsOmjRRzMo1H2dmUWId/oUC158ZaDBtKJHCo=; b=jf62EN7IQ67T78d7la7NJiMr/fbkMwxTrRZAKy8hLskQE76jajLf7oHF3OwSGimYXI WMJ/H3LOqQNQ5fg7DHkVhgJVancl2xvI7f4iHksYDts6BKjdbz/tRWBgt8c+7qUpIoWY hM/2dydb3VLHw1j7YvYE80WhXebQQoQuNx1xcfc8+0R1HY9L8i4IxSAiRLy55TmHOXJ8 Oj/cKr0qdidJxJ6g1xuthQLa2gmom0rA9V4np73C1H8SllnK45TCiGrjEQfy1eh+O2U6 1CRjGMRyJI7Cru5sqW6a3s4GyEOhIT37BFfDjXNBAh8Vyb2rOnLpg8klC0O0syuaYa2i /CKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hncgyi1I; 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 4fb4d7f45d1cf-59b269977aesor500922a12.8.2024.07.14.04.33.20 for (Google Transport Security); Sun, 14 Jul 2024 04:33:20 -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; AJvYcCWxxXDbQ3UjsV7+liV6A8Vj2t3TEuzYobj3YhDTbFudsMOzTBxkmpPypq6jJC/hVfYn6q44O0DGrmlujFDeBhPXUpNCCisCMagMNzdj2ESlYS5c X-Received: by 2002:a05:6402:3551:b0:586:57c:2373 with SMTP id 4fb4d7f45d1cf-594b6eda294mr13676801a12.0.1720956799839; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:19 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 13/25] power: Add iMX8M block ctrl driver for dispmix Date: Sun, 14 Jul 2024 13:32:50 +0200 Message-ID: <20240714113302.133399-13-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=hncgyi1I; 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 Sun Jul 14 11:32:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3296 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 63C92412C7 for ; Sun, 14 Jul 2024 13:33:24 +0200 (CEST) Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee94b0e2e1sf41906231fa.2 for ; Sun, 14 Jul 2024 04:33:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956804; cv=pass; d=google.com; s=arc-20160816; b=ZHUNkmE6q9mVI3042jWxNkpblfT5vk/epFFI6l0KCeql/KZHuBb/ORo5d9UvIA+J7R dl+tTcgIHS+rXegE/bgcd2AFTyGQjWIB+A3vqM84bqbQV8alscFQQjR4qzsY8DviKgFE edglAy47n8rl6Je+KL4/0l0NzDPsjnRIT76a7i3rue7r54rM84aG2wEF0Q/JZ0XwMiDc DWMVremTQo12JmawkQKp1D2jPI0vQBFd9fJBXuNTEIL59w9CQZBvwFiQ6Lnu00OeVPxe Loimns3qhT14jE/ixYfiWM5Czv+qpHjvDDnfy/BIY23VSIdPmKA1CzTcnnBI3RUUpwS+ fcIA== 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=/E3XROKlYgRSO8i1QJwkKWVXkdslFWpsXyXKyzRrfC4=; b=bhzAPkh/jeteBgMvjWuHG5dXmBjF+/5G50m6QGg7hZ2LHHb3a4ybSTs0aspMqb4TYf OT4lFq6M113Ssg/IGRKBVYIsYvfPoBSmGPBVAGrSdqfHKt8cS5vh/MA/XMM3wap7gA1a f96UdmeuCsFlFs78CLAJiUohc7Y38soAIBSMYi72dAG0epVG4EThW8I/q1QNyz7Sul8h 1pAabbSJEABv0/lyVW9CNeFzPAWLBI/tni6IyGMhV/QJYYbYpwwkgTqGF3O9ORLYXKiY 9FU4E4fEFw1LQ9IDbq2XLSucajCGNhCd4j3xtF+eCu3I/fzlAg0sh0evAG8YIRIn6jiy 6cPw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fU57n7aT; 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=1720956804; x=1721561604; 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=nDu91kT9vTQoKmcBL29Tv4Rf7f+QdkJelIVuHc1Eda/NENa8s/PQF2exkUuC9WdXz3 O8TzF+hEFTxx58fSr6lo1NOOciyzMcNwhfe6FO+oowL+8JOLRqrY+epRDJyxtOP3Kews UQEuewNrcyE4hHTX06VwUSe4mTyU4lE+xAm/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956804; x=1721561604; 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=bWOvJvfQfExhl766J/e9rjIRSRZgylfDEi4rT6RoE4rUQZchwY2kg3V6D9hzUPK9uE XKwSq7iXWRZmltkX6DX5alYD9NdvwJCcNyx8duepDSBpScaZwzaefddcVZoAi6rMQkLN w0piWnfFhFAgoovEKo9/vBGe6s/PwHkFWrtUltPxqio4gWcV924fVSpd1lXFupmclCAz mcL8MR3ucHQpjBwma0PM6U/RF2LkreM95bVU4KLpzDMoYSZamvunA49o9vZC9K9nciwx /NNSKG3wBLGWzvmcUPEdCutlrMwE4LtnYN3WEOGNrP6B4Bfse4esCv1lUYe4D9ZlAHWW md3g== X-Forwarded-Encrypted: i=2; AJvYcCUrWW5XkJsjFtdv7IeZP7qQyPQ6KybGe7mSf85FsnUMsKmK/1Eh+RY222mQ5Vf9bGsE7A8VfqOHLMM7O7670gYPd+lNZ2mhVixgEemleq2x4AkV9T69iTBKBhjMPQ== X-Gm-Message-State: AOJu0YzY0VbAfrSbgQCctiOcoseRitABLxYjDj5DZt8iafFm7e4NmjkV IJ5HNG+Hv6tqdUJ/x3X2FSsgVAIiOH8bywpCa4TTCQV58KBbL5JP1CZjfwqOexNoaw== X-Google-Smtp-Source: AGHT+IHXQtC+ngz9T0qqU6CeBxL0ytXaWjg0H4GAl1+04LvcR0d41fBwQNQ14lj2sxVGRcJ8a4Nurw== X-Received: by 2002:a2e:b178:0:b0:2ee:8701:787e with SMTP id 38308e7fff4ca-2eeb30b9b4bmr104986611fa.1.1720956803780; Sun, 14 Jul 2024 04:33:23 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35d4 with SMTP id 4fb4d7f45d1cf-59821cb697bls1645794a12.0.-pod-prod-01-eu; Sun, 14 Jul 2024 04:33:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUrsZsdhchtgKFwl4bFUMUDX7fh7rJH6FpsN4+gYJg1sU+f1L2vC3pmYBPTGCZkPmLHwJe8iLY46/5yG3372n3G8sWE921WSZ223KMIP+S5IEWU X-Received: by 2002:a17:906:e20e:b0:a6f:c268:ff2e with SMTP id a640c23a62f3a-a780b68a303mr1021405666b.5.1720956802048; Sun, 14 Jul 2024 04:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956802; cv=none; d=google.com; s=arc-20160816; b=mcDATvq2VxrFi9U74SInPQ/ZYfRjp+NKzG6cx6OUy9hyEC9pEIngsU4qPDrQxrMSz9 Em42PimaA7XFUDxdLe722X/7GifZRMFGGDz2EjXmYcIsI3bdBWZCh4IONoNI6BjjqcYt glTs9DwDu2lhOiA3D4rY7cp4F3q2d0q5DftWt+Ba0/Sdn0QDm0V6X0dJwEAfv3EScs3p kTIh/gN327BkhEcdii19Z9+rNyxiQs8wiUdjihR8OC0AZDXfNAgsZMyrzrrQ0J+2xEVI 5IPG1pdN6kPOg1WH5IW8uOIS/6YN140XrEEWz4LBy+Qcfu5E6iEUyCNGeI3QV+Jq4V1s +IRA== 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=FGl7tUpjLoNdJizWK44Vm6CYptTGGCJwM4VisAVQ49M=; b=C9Lwsql0dO/gyyYlY030r4q9jSOm/xjU90bl8arDmPPOt8vVkE4tyj1KyH0FspIXzq LTPwsWI+cO2CnqkFcdzInmXGzqQ/YrhKCB7wbn5H4j3CV8EvkSmptZDL0C0rFFN0Hqwq poHh+FecPHsh4WqVcVej7pSweNxLtSn7rhqb++SD4sUwMrSrFRWCnc+k6KsgAU7+yswI VoYtUEXdRt54OFcx7eVZY3fKMRI6wI72MaR64EfQRIhSK6S4kivsfoNqk/udtuoqquPN Gx+sC6/ZrGk7XsKcSHTYzSbRAswkreINMQab5sFGrHcmSXdzyZnYsOxAZTufO6053NC/ Nkyg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fU57n7aT; 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-a79bc87513fsor43557266b.2.2024.07.14.04.33.21 for (Google Transport Security); Sun, 14 Jul 2024 04:33:22 -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; AJvYcCXeXFsOM/X8hFPQhiNcr17zOXvonS/fu9S+J49cwEoCTYHY74OfB8Ftl4o3wQlpj+MSrjS1NnxxKqOn7yjLRwGjuoFZ1E5ZB/4liam6HK7qTJEj X-Received: by 2002:a05:6402:1801:b0:57c:6188:875a with SMTP id 4fb4d7f45d1cf-594bb869e4dmr10008195a12.26.1720956801595; Sun, 14 Jul 2024 04:33:21 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:20 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 14/25] video: Add video link framework Date: Sun, 14 Jul 2024 13:32:51 +0200 Message-ID: <20240714113302.133399-14-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=fU57n7aT; 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 Sun Jul 14 11:32:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3297 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 F357E4130C for ; Sun, 14 Jul 2024 13:33:24 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58e847f01f7sf2946218a12.1 for ; Sun, 14 Jul 2024 04:33:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956804; cv=pass; d=google.com; s=arc-20160816; b=CrFLpj1+3CAadGzrLhtLgUEg/Z53Rwisy72+W1oJayFX8tMfU4y+Td2VK2R7V02eaD K2QlKbT4nXUX2vsSuu+B6okyD94B/w6+0P5ySxd1CeYA4KFKYfF8I8SuI/H2BHCPII21 53vQoihSXX8P0xc8fEh+5a9YQ58RalAJ25/s/ooi6kJ8rht4jRUwTZcXseArrZALdlWw VJiOo6p+pkvMk21wUgMmiEzBXZu00IT6nc/ORVEsaFerqEiYgm4pjU3HWA/+Dah/kchI 3Foga89B74f1AFQS2sJaRaq6oeje/1hqRCOKNBR5rS82abR7UaCBPm+Y+un+mfMyWgWS kkZw== 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=SaYhItvPcTtdaCpNhQUgRDe2oYdwJsNbjuOoG11fKn0=; b=sayZLtW05KyngVDda/FfRzJ+bpThtH47QXAk26Rnsg/OlxzRoXKPoPU1DHwUC6crWD YHCSgF/UnRI0NSwX8BZHYanStamWRQ75imcmB+ewjFvbtMRSN7R6CXgxe6yUWu7LG8eo co4DwE7QkNbl0g48C1de/x/ITSgH3Pfz0Z7BdOVjABURhItKdCo31gL+oToKNAjyI/QL yNqj/znlNcP0nDidFjy7aj7xtqcsjxN3gKNRZ0RsF91hAAC4DwBEZ/BoEWNkZiI9rPE6 A6U5Tsl93pXLNqUSnllxzww2kp5qJ2nPopbWAPoT5KSyGTCzKHx99TZjw0XBhx+wtHBr amXA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iYQns8tN; 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=1720956804; x=1721561604; 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=Xs9gNAzC+1ejFA+ulPXjB3jA7UbRkK88f4LzK9yM2SWhxHyApUREy6SNbzGXHnqUW1 KA8bUDBz8c+6aGm921lS4PtKjI0P0ORk3gFZYHkzFQrEd/Bj+nvQRNLtthoK8zF0F7WP QNvKqbCEs2XsFfo0BAvRHf+D529S9bjoEln3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956804; x=1721561604; 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=LtwoWHv3F0vmo3FgdI5rr4HAvHDoCGg8spsNeuMYMLa/snxjc0na3J51BpHHRZHUxl YNJxFZxbIXI68ZOOd1jdHRtZybCN178LYSFWVbwax/fUlgCw4ScE7QUpg2Q+eCyIA3Kz skbom1jWfz4kimJvPqwL4+uFxA3l1od8iU4QLeukuh6kW5evU4GafqpHhV0oZ2/CeIvJ 1bPCU7+eav6U4fndi2Ls/d4fZK0AYil/cq9L6+oNVdqvtVLnSB+8FJDmjImA9R2jBfN1 CjG9f2F8RGcLRqdbEgFjwhsjVT7PkAvPLU5l7Xty83cETfZqqXQAr/eVOd6uxEbYwzKj hHkw== X-Forwarded-Encrypted: i=2; AJvYcCUZFGl0hjc5J1zr6Q2R4a5hchlgE2/jWWU4eCichEZGPGFWltGfGHYaScARZv0OUMcn05PZhrYyapSO8vwVUOIGdbgoVTo2mJryikL2PyPe/hlDpw/E28Kjmez9aA== X-Gm-Message-State: AOJu0Yy9SBEkvCcuFtJKgZxVGnTkw1LGJerMhE5nwHpBrPVg9WFdA2OR Xid8Jk19QoMxoUTLz0gBwNrTxXZTX6tD+OifeHCSpsjYWNbjqArpqp2C36TwCa1jMw== X-Google-Smtp-Source: AGHT+IHMcpa24dYhNu3xEm5+LWzi42QpzNS5sggi58k60t//3IqMlQm8db470zItptNi/86iK2UXvA== X-Received: by 2002:a05:6402:4408:b0:58c:ccc1:17ec with SMTP id 4fb4d7f45d1cf-594baf9110amr13201993a12.13.1720956804707; Sun, 14 Jul 2024 04:33:24 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2022:b0:58b:fffc:bc33 with SMTP id 4fb4d7f45d1cf-5982622b6cdls1642165a12.1.-pod-prod-04-eu; Sun, 14 Jul 2024 04:33:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUivZC4rJzt8+u+SHdOnf+dzBJsBv3eynEugzCEFI+XoIiQkrQBUFsGFUoEIYjvov+0hyxDrB12j5W+3YJADdSK/S4ZxeJGltcfVHDEpQh59WvN X-Received: by 2002:a05:6402:4408:b0:58c:ccc1:17ec with SMTP id 4fb4d7f45d1cf-594baf9110amr13201954a12.13.1720956802976; Sun, 14 Jul 2024 04:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956802; cv=none; d=google.com; s=arc-20160816; b=MeQ19DOsvh3M21fE7/fdeEVI+6399xRs+XHJpceLhqaVqeCwsHD0pPsc5mLN0xQGd9 Ojbg2ZcnARx5LL9ZhmvNYYQb0HGu/83LCF5+FUnCj71j2JMM4irrF6pU7MG7q81Ck/Mz 9kh65keN92a0eyrBUqTEfArt/i70Pw8x8OR4Rk0FWLJojVyEsDAXU6PgrEJoKYLZDYRp GXZHwEwR9d9vVu6Qf/0+Sd6bX0YJ2m9YXqC4uylbJMMDHGxdBvcUxD/MA1YDIwFk8861 3cfii0hTUkbuyQ+JofxYsVvLFTkN6bV8MZiAE/454n1vq3ArFsUvQP3D2rp79I+wV1gQ cvCQ== 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=0GFDNHh0KoKEVxvH2zEYubRdCCyYvIjfGmSXwFEXqgs=; b=zYu1cgaAnHb2shwEKQUZNwZlHGW01KT7ZECuT3GXfmINTko0nY+Wz/bo5s+ecsKuSS R/UxXuV5M2VmmcOBa/p18WnEtSOK5b7EL3Ogdnp42G88xf9YdKppRBWO+ZqxefxjlTSl HoMTbBRSVKcWKVYG1X5YtNsfHYn5YjPrjJwYK6uIq62Y+YAByjnodGmyW54Vr31++sxY 3ld74dDlbL/pHXFQ2j5kbZHF0he+ctFMGQEX+E9IqGbNXJbnGIpoBIrTFfTIEV43OwGg LjX+xfXTosM4KuKAzTml+TTLzX82tnQxC0nbkz7X7tqt9wtbmJNpA3bQigLMHnyK7IBZ I9Sw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iYQns8tN; 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 4fb4d7f45d1cf-59b26f65fb8sor520230a12.12.2024.07.14.04.33.22 for (Google Transport Security); Sun, 14 Jul 2024 04:33:22 -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; AJvYcCVz0SHM85DgxzIKxU9tYiPN/ci2DRADBpe4eLaawC83ECPF4FjRlo1RVeyU+KsIRLdhodZrLEdciATeOY9cPBl1UiaexBRKn2m8XNyAkwDfgxrJ X-Received: by 2002:a50:cdd1:0:b0:599:4e93:33c9 with SMTP id 4fb4d7f45d1cf-5994e933435mr4993631a12.12.1720956802664; Sun, 14 Jul 2024 04:33:22 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:22 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 15/25] video: bridge: Add check_timing interface Date: Sun, 14 Jul 2024 13:32:52 +0200 Message-ID: <20240714113302.133399-15-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=iYQns8tN; 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 Sun Jul 14 11:32:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3298 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 18AD340F88 for ; Sun, 14 Jul 2024 13:33:26 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58d134ecd3dsf2590623a12.1 for ; Sun, 14 Jul 2024 04:33:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956806; cv=pass; d=google.com; s=arc-20160816; b=fTxYez7lzJ6drGx1crFkqt0njFXKbx6cpQ/e5cZ10b8atigfKg0SJukep8lPsdZ/tW FXMDnSFD9TLrVo8/ggr5qBeQpICr98FJ1oZ0IthN/Ls0Pb2pciCTvBZNA16SQyWRyduS pvTvPfsFSBzmaM9g4AhhC2dDc1FJwjp/mMT/QgIhhQAwa3tmAxLyhiKV6nion+RYp06K b0iDp9MMM4aQlr9/+lpF+DYSIicicU4uGZg+C2287h2iMQ8+ZCKEXAHOpUkffPJ6t7vg aJnY05XTT3bCXZFmwIDAof5by+3B1bif1Zao4J/9g+OXCEMsndkVSTwfvxJ6PMlKWM6F SX9Q== 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=lGxsVpo6wK6Y3UbaphdGYz3aVvsVi0NpTLn49TWFGGQ=; b=lKZHE//dj8/J3ureBMPX7glmP5QfTpn3NXIBIKEAbgwvysNR1Un7D/6iWi5YtW3sRq AOnlMOflGm6V+i9293of/rLz9cJ8VRpUvSQWI3AQSWNwApo6Phg2UreasL0SnpD9HQ3q EJ+l3ne8MfwPnPC0O4XkEbkZ62nE5hJ6yUAhJkheyol+lczaBel4jIGvPJevMLPxh8I2 hI820/eWUCGm7bgqGsE1pj4+Ps1PpJSuYwG3H0auIxxMA8X85OYDc2Io5xcAm6LunVoY 2g87OED+TjFVcHy2OcGb4cXiYtdNb/R6+Ly23vM+cZutNkozkV1aDdt3VruzPLgSyCI6 rIeA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=noaebGx0; 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=1720956806; x=1721561606; 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=AXMpWdLB5ON/Pj4GeYEv+0JruXKq/s2razhmCPjqC09dsu7a0f0ALXdXgjMNT/mYIr SIa2P8K/q8hhPJm1sLD9UyL0ZcWiMsZDVE9rwXx3jQ24EmJTy2K//kwVGUAES+otOhAP WGDcY98JiCpcDx621JVosZql+StEuB6o3sAig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956806; x=1721561606; 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=SvmQGjEVHdHByAq0BtKtMR30axkeYZT6ihYImMGqNBmmeXfP8snGiMKTcabgaeqR0z 3HvK9jADA2o6JrGU59tMC+kIUAY8WBjTRaLyfkQUwxWZBlTmRGjvKQgrb9zfEhaQ12PQ zbYn7XWlQdzmYMsBOcbRsS0mNkzOIfNJzrz4GvotFFjXDX3C5SYlbOmfHTdrGke1iWuR xmrGmivm/jNzt6R/pt6U1E63xmRUWa2DtwOe6T6Gm07gPD8RzR7HxBpzIOIK1cK0969r wjFRzRFwCzXVad/ojcTQ1DfbiTG+k5IwfwADNaTrvGo9rD92/EmThHUqEKrfCqTnW/tl ULFg== X-Forwarded-Encrypted: i=2; AJvYcCXWnr6n9Ractluj/Mly4LkIQzS7/gHLim3dVgu1ORJyxpZpizaWsuc6FT45pQv9bponpJH/ITW340vDzbGfDyCj8psTn1DhirtIHa4kA3kAlX/B8tadFo45mXfQFg== X-Gm-Message-State: AOJu0YwuGjGcjkKcQG9EMsb2Nqeue8dRaOaNzLvN4J7GoPCA+IQl+zn/ OABgEHTgAJ0thWs77+WO+y6nGgiOqdMhHGRfhEadSKOgoIC26+ehw9ktOpY7rCJtcQ== X-Google-Smtp-Source: AGHT+IFDsp/GD4sCsSHxhlMNllRcUonmWaa00oBQdkNUI7FqHsi1OrGtyZbs9uBEH6fNbDJvOiNtlA== X-Received: by 2002:a05:6402:430b:b0:586:6365:b3cf with SMTP id 4fb4d7f45d1cf-594baf8728amr11875951a12.10.1720956805808; Sun, 14 Jul 2024 04:33:25 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4309:b0:599:9a12:f5cc with SMTP id 4fb4d7f45d1cf-5999a12f8e2ls994631a12.1.-pod-prod-06-eu; Sun, 14 Jul 2024 04:33:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVlV6MJ3CRaZWrlkCMZMYJ3PNMudXet0HbO0hFkv+KsG/pNMbmIeRbBJsygJCcwFSqkjSRp+V7Erj81qw5V8psbowArsNy15GAYgtKhln4znJnu X-Received: by 2002:a17:906:b2d7:b0:a77:b81a:2471 with SMTP id a640c23a62f3a-a780b87ef91mr1025780666b.49.1720956804231; Sun, 14 Jul 2024 04:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956804; cv=none; d=google.com; s=arc-20160816; b=KNwGdgLvRyZFdsriDL+BnrACESVkqgsuhDNvRJzTVxBpywfNZLgsCysjt4brPhmbjS p1rRC/Mp6TSIFIUkgONWhDps4PoVJnHqfeD6hRrPqoN9l0vxYAuFeqWbr1sz7C/hl8xN pYrrRxLpqb2noZDb7qgCcjkLsPhWEfYJ+gGJSBeSL0ytBm28bKi+LNlWM8MSpJqCCVFG b/cC1w0WR6WKzZ/3BD4jUkz7zHXEC4O9NW4NlWcYNPVdOwwqShBtwssksejxXuevjKUv UpH0PLALCro05fFlc5e48bv4bqf6Yht0f5r8dnDflBJe3nKyv0JTXLFSu1jI4BFMnJTm QMYQ== 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=xePZ6CiZ9IX9RGJGA5ks0cKCPGhBzXJtt9dl4CJp2Gc=; b=UH85DNL5O7q4MIhrl/My2urCErsfTF6f17Ll7Pst+BatgOzGO/CgBTZy0ehfDQLXxt MbBEZLDRvOQXNq4MzOpxiy9eSC+8bCLixv4xswg6CEp59HuhNJjvG2fZn9kAnFufpPRN ie3Wt9MBpHCRw24nH+sFo4jd81xRpnipWepF+LcabSDv7+9bNHZfEAT2Lvn50WoK5w18 NJbmiVa6DZ7TZHrDuL8JkUZtz2caTp4gHh+er8cwngZdGDd/w/4BOYyYqf6hkU2nyQAw YzFncsCkKBTQKwcTTFW+OPGEvoqwNYH5FWSqeRnELzq89rlQJH/Lt3vPHdRXBdetxJXF xVRA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=noaebGx0; 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-a79bc7a835asor42475066b.14.2024.07.14.04.33.24 for (Google Transport Security); Sun, 14 Jul 2024 04:33:24 -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; AJvYcCW7VPMKfw2HhVnyIAHh0SW35bsw1vFPPieVk76VCT/DEcC5erIqBs2TjLLdNd1q5bL+Cf5qmAQ8tUjzd0OVva7VYesj4xeL/zNFd+82JonfH3Cz X-Received: by 2002:a05:6402:503:b0:58e:450b:da08 with SMTP id 4fb4d7f45d1cf-594bc7c8037mr9326475a12.31.1720956803879; Sun, 14 Jul 2024 04:33:23 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:23 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 16/25] video: dsi_host: add disable host interface Date: Sun, 14 Jul 2024 13:32:53 +0200 Message-ID: <20240714113302.133399-16-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=noaebGx0; 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 Sun Jul 14 11:32:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3299 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id CA9F5412C7 for ; Sun, 14 Jul 2024 13:33:27 +0200 (CEST) Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52e993e31a9sf3449875e87.1 for ; Sun, 14 Jul 2024 04:33:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956807; cv=pass; d=google.com; s=arc-20160816; b=gWCZOCn/WW00Bjo6MLjnZJ4rsWp+qQgczp2FUGnuhEJugSHnhlkrw1rp/c0yx9yNcC 8RdZ159dPZAmpq5+g62MpgGhAPH82Ojzvt4L5hwEy6oyL2Xppj9EIsgLZ8koLdWp/Tyo WQ8/r80W36yWE0yO+qj2Kl99F5yDXvC+90+geiXUC+juBfpgrWrtRKind1mzZIpkvxQF Veh0j5r7lHNy6aypr6iYNIV2Cl1ShMzwSxw02ATdhhUXP+SYEV7QRxsqUYWD1K3UBzdT uSFIzxBP+jihu8oZPX4Y0FVHUCQtRoTH0usUN1FgW6kkvBezVfr7zwkfkxRjO9Q4MT+0 G0qg== 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=7mKH+CU2CBsaTjKiCcSG/zDRwXQ2l2rEH3W7qc243KE=; b=hgMHD4468gtWVGowMuybs2UcoUKVRzIVKawgXL9lTWrnrWaKENqimBm1MNNLH35XUv sODa5Z14GXa7UwpacaT/LVBLGOwPydQuXqsO1w9VhimfoQegtDi/ER5+Fj7PH/xxXTU+ hOxEUp6NSieORJjEUCyNKaGsrxvCFlTGv7FcykzKUe5VB95X3fV6NjfjR+9x5xzFvMbw 5iNQwNZOfUu6N+SadZsgQWw4WRWZqXIlsDGJ/re/T9ivHE7+9ndsG4bcwdDFXZ+VFU3A zF33JoYBDGSRqFDSf32UxQH9NhOe8DDyIlxQ5utK0OL0fwFNmuq6fTBJhN6kt1HWQJkp VtbQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ic4KJRLz; 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=1720956807; x=1721561607; 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=Xw2U70MudFgmnJVjZT14ZgY9rwZywt+ePulY+9rgFjTGToZcYE8BA9HRR79CRsQiJj TQQFaTDK6fR4ahhqwj08wf55R9u5CjVJHOL0gO9RDlN4wg2zYaqQReIz2HhcryPh7AaF p/y54Sl0OIxR+65mqM2ViWWAyR/UY7fv6f8ug= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956807; x=1721561607; 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=sG8u4s+3oLtEmq9GHRbF1QUREQ8nZAytELW5hRy7Cue1GHE7TmRtNoe1E3TJkmj5Q/ riyaU8mf+urcGZEXXHtYLhAEihbHA6ErRH5DAXJbCPTBqHotqolDrhHfQQ21uutkkCtW or0S9KPeLDD+gglxk/CKevrtN1rerX3weLqCzGetOiDJj+dgJ3nPazpjQU7CvX9YCfDm hiDqCWG9z/q+NRfgKPynFuaTYKs4RhRtPEhdohTebbVP0o5go0ZYl4wZ+3sFpbV76OxZ UFKj1vjJQU1iXh8NSqvFMgWkXlZupb54YsRqib+wLLM2pFXCP4vTimaIYNf9EYiVwH17 NnJw== X-Forwarded-Encrypted: i=2; AJvYcCVY81fNBlibpsH+9TtPX0jtwdFfujiBlWudFhSCuOiMtzJXJVnFTEFuacGMTU36HSGsfcqCvEb79mtEihwNr5vxxnll6oeUYgiC+SHGTgoQTMaPexGlZUzq1rAp8w== X-Gm-Message-State: AOJu0Yz93xcuHjF9/GRSgOLlCOBoIyD6xMlgKlf8ZimOBQdn5Ho9AD51 gEzcTqwZOash6oj5adeqM9Wvy9RaPYSDZXahtyYiwiNJVJNOSWfpJAtsE2SbRbh82Q== X-Google-Smtp-Source: AGHT+IHonY1z//QDqygI/2BUVUN+qM/2shdw3PzJDiYRbIG2UQGPwc+RHbktog1Xqh8W5Jxv2ao8LQ== X-Received: by 2002:a05:6512:3c85:b0:52c:dfa7:53a2 with SMTP id 2adb3069b0e04-52eb99cc6a0mr11403903e87.50.1720956807280; Sun, 14 Jul 2024 04:33:27 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:ac2:561b:0:b0:52c:e3d2:83c3 with SMTP id 2adb3069b0e04-52ec4093c35ls1746283e87.0.-pod-prod-07-eu; Sun, 14 Jul 2024 04:33:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXj5NGI/v5+8gEqS3j4Or6Zxke9HbKlrl0JzGWC85MiY1XyZDjXQ7s5YIc1hA8P6PM3ez3B8MSEVxqNOnl+xtQSdFA5ZptdMF9Z9Y20ml2hNQpo X-Received: by 2002:a05:6512:15a0:b0:52c:d750:bd19 with SMTP id 2adb3069b0e04-52eb998fc7cmr13226257e87.8.1720956805460; Sun, 14 Jul 2024 04:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956805; cv=none; d=google.com; s=arc-20160816; b=VU1I7tsHbow35P9UTTF2cuj99BUFo7KWjSR/0Royqx/pdV8qxBJ37oVQblBR/N0DBV KUVsnjwOpea0w3qUFAiS+t1D/2habrvmuvtYZU2f0wE1NlwN0/x9VOVKoo596PfnazYL Gf2+2l+MyPuGZHHBVmehbaaC6+UL55AyFcu+hYNajQumQQxSqoyqdd/8R00yA0kRfXxI Yt5a2FfZICgh8zSFqQ74JyUjPjj3F/1NRmeotg3B7H/Bf7gpxyqZZd/pg7XyFGawo5t9 /iBRKBcCGpHgyw1td8SyCDKhS4Wo4Cz6erUEfuw0CFCGJpAiN6Ye++OreVVoGWeleDRr lRuA== 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=7Do0CQHhjhHJzDjWZqs+xMpFfB8dUgJ0N7HTy3OVzME=; b=YVvoTUh67HqsmZECix/3QsPwoeS9CFm6Df2u9Zw1116khOYdovBbWG1t8mkQ/k1fqm DGt+mjEeH6qeZQTiP6KRXawbtpH+o818idESDYqX/jePTsZKkv3GipahcNQvSA/Y59r+ ehBasNE/XsvdreIMzUASjggBpPaYCJ/vMaJa/Sgsd/myjEE8XS/6I7zgxvBg0jau6iLm gQyHQTSJ8FXl7869E2D1JUBV+aczOnOC6+BwcvweA8V8sW/oscFYztdCw9OUoK5rAyan ZLWBqD+7YDMBzLXBDGWGQPbP4olvy5oBEDKPBUPznAC+5cqDHo2vCpHMti/sPmEfSgAA zScA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ic4KJRLz; 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-52ed2532f29sor454302e87.7.2024.07.14.04.33.25 for (Google Transport Security); Sun, 14 Jul 2024 04:33:25 -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; AJvYcCVxNGFGVRsP8v4T77dNCCfv0UWtz6kfkSyv9GEta6/yIJxlITNZh4w7NL4dHV/I/hTOYW3QPCp1nSWmjAGuyMv73AlhCEAKPoACifn5tlOtON+q X-Received: by 2002:a05:6512:6c7:b0:52c:88d7:ae31 with SMTP id 2adb3069b0e04-52eb99cc65cmr10730657e87.48.1720956804999; Sun, 14 Jul 2024 04:33:24 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:24 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 17/25] video: Update mxsfb video drivers for iMX8MM/iMX8MN display Date: Sun, 14 Jul 2024 13:32:54 +0200 Message-ID: <20240714113302.133399-17-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=ic4KJRLz; 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 Sun Jul 14 11:32:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3300 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 087DF4130C for ; Sun, 14 Jul 2024 13:33:29 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ee87d500casf34695761fa.3 for ; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956808; cv=pass; d=google.com; s=arc-20160816; b=oCYfcTGtRmDsOthzsu7OR7idb8Q0elG1Tx3mdWvZBWEz1E1KUIy1mOG/Q+0KsfiX0k mPELdVZ07pURdqBKQ5p86MUrkEnPetr3wXq/vHRRjEKzZs1jbxm+FHboLf1N2oLaxqJN OJZhXW40oqu+4chmDlmR/PGW3kIZOMUleoBz6GNe1wJXK1ItUFfLT8TPgVm0ikJ9j48i vYgfDWSHxTQdHJ6FSWWe3yM+wsbRrhQIN0+jHQIq/XYpj9b9Gmjj96l1HnlQ+XOD6oiC 0/vp5/Sv/CzHEu+tZuhInVPW4sSPpRF9trYy9chZ1S9FOJmRNls3hjbIcgVgNxHewlx6 OWLQ== 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=NeUn9DKVWzK63oggYHBkrVcUkFTNlwCQbyWRSCAqr+k=; b=L0Ek0OdJuh+TBJCwJamX6u4mvVzAfWYqJWAMRW0TDYxdAc/TAW+KyXsUaf7GAS5k99 rB7Lkg0UGcJ+iW2Cel0Kr6WfvQ7+hBiwFgMbuQmyNhiwozAlAI3Tm270MjZ9VAOkjZwa CNpUk7zldZN/FxHZ/Fe7Y0h3pgO2QatNTvTcVTms1oyRrt6qraRe30a0Afr3DkGzxlSX GM37/BubN69jzYSwe4RVTEkcQaJ5381cAOcpRlsJ66jz4v7xMNJEU1uweXrMKuW8JcQl AHKO+GicyY23dweLZGbhlqZNpsWwGtVQoWcnC74Wd/itCgtn821CZMdYzA6GmzSv049o RByA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TKQh2F7f; 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=1720956808; x=1721561608; 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=hDKEAGgnNLVAVouU5V8WBQ7FkPq+e2+ja/UpDWt1Og8rGbN3dZ+hN7Is7ddse8Cfy8 mD5Xb5M9gC0WO0jZbWnjfktLrDsho7L9+wJOP/UJKQIy7NCO6Hf/5TOPQ0tqLwgIIsRi OGWgYT2QoKpbTgFgLio/Zw53IhxxqxAP4jAhk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956808; x=1721561608; 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=NSnQDbQzy4Lu04GhzTyhqHx/Han2Qx2oVlzQHNZlX6m4EvDV3+H5fCU+NQtKZnwtrR uGd/8Kgd0ni1vpcl/k/xz+p4h718FA73wPOwmbW9lKvJliGAE0yi7TIB7ShWAklZSc/5 VNvhd5yp05XpX99TOLM4A0lqaFlTJ402hohuzlnSSz0qcch6BPF6MvXExQX8u+YZo1wJ 3KnQwyJsrBO2Mzoz44i93dZiiKlez7DZWbkzufad4gdP91LGkxsvVAKBXObpBRrVtLJZ 25tuj0vUWGrC4WK2Ribu+Qa9IDgvk/BWH8kGs4QhAMDNK2NVU35p8/ucLV+ULP4h3Qg7 mXnQ== X-Forwarded-Encrypted: i=2; AJvYcCUWnfc+Tr8IbWzHVxgQS3bF7XcD/Ttrb7qPqCOFTITD3m3LSBoEwZnt28qsi8gdomB5x44S8VDK1DH3nOK+xfOa06rXGfQlmY51Id7aG71X/Y8CGxUoJCJOi7LZRA== X-Gm-Message-State: AOJu0YxhqoaHKRH6rILco0jFQ+/K4MoVOKK+7Eg1lbqmdidKNmECa+Dm ar2Lj+NAItOBvVLwe0ni16sylhS3/4antbqHLS32h1AS33Y5TRxuBk+Lvb8+O2wqDw== X-Google-Smtp-Source: AGHT+IE6bOmSUbbEA/20EmqXOaGsbQJ14z0zCUL4Szsxd/XBfNJi1Imw+BfEZU0/AFl4hyBrZaijqQ== X-Received: by 2002:a05:651c:210c:b0:2eb:f31e:9e7b with SMTP id 38308e7fff4ca-2eeb30e5129mr127011431fa.14.1720956808469; Sun, 14 Jul 2024 04:33:28 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:651c:2ca:b0:2ec:5d3e:a6d2 with SMTP id 38308e7fff4ca-2eec93c1c60ls17836611fa.2.-pod-prod-09-eu; Sun, 14 Jul 2024 04:33:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUlOneIRwbtZXUjPd1GRWI7gfIN9Yeq4+LbA43C5j4d7p8bfK/Qjk8532clMxebiQeLTep4gXcpRARpjAmRTEMo/DmvVSpp0IYyEmptkyIhQvAw X-Received: by 2002:a05:6512:4006:b0:52c:e112:4b0c with SMTP id 2adb3069b0e04-52eb998e476mr12105566e87.9.1720956806411; Sun, 14 Jul 2024 04:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956806; cv=none; d=google.com; s=arc-20160816; b=RQaolQ3Wds0F6gVUcX87H530oW89Hwl8DP0HqJsjRhqaGp5p1/OLPRU4kspvidzVDu oFmTP57rAm8L8BKhoQDF09kq1aleeDV3+35h7KFO8SDWVRJ6otESkMdv3GHUyCnot9Ln altTM+6MjzoxVsJlbEpUNMMdUvupWQHW284Rra+cFSkrgvxtTN0Lcx5cmsspESJXtDMH Pa2vcsb/rNqZLGGbucaT3u2a+1UrvGwgzd4dRHl3DFEpIBGyGx10BiZa3pT3MCLXf1uH Pw6ioYaI+vWZ/PB/WMCuJ+8hLyZKD8T7IXiOBnjk/72bne5vFchxjmK7V31k5RSpgxTq qnpA== 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=f577Itfmu/9K05xBhKcTfwCgaSaiD1SZ0Aez2MLxpmU=; b=Ibm8OUg/pDMCF4Pthx3OCUXH5tTTZ1UtnCeSmWIBaPrFgrO6DaDRrabri0ItLS8g+k HPpa68IBnohythNrSEOyZaEJ62wzc/+Ngn4uN08Fs0vB92VvGzRC5XiguD2bq0GSxQ61 7TUXjzEoITEyAU3KwVZres1Rwhee/Am+1fknROwOOx7pTlU7PmktwO/nOEjJYfbfVwM0 EyG+pSWwxB88Emi7Gy45njpmCL8kp7gwxtwdnlqLXyTZc2uVNdetIw/HuMDRdLrmjKTB 3ZaTxKjZCCs7/4b6c5nzHnGQiCl+mnBJh9sJaNNwzyAjmbNtzuEHG1eHsVSewxBymHuD z2tg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TKQh2F7f; 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-a79bc7ff35bsor37624866b.10.2024.07.14.04.33.26 for (Google Transport Security); Sun, 14 Jul 2024 04:33:26 -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; AJvYcCXJ33AjcGwVCaQsxxaYVEGQN3aupWS6fnpPrWFok/yGDQVPoVK2l+D8Kv28ltSabtn6RvxfKwiWK7jUW+ExK9NVeRHtuS9JNAwf4jHH8n5bgYnv X-Received: by 2002:a05:6402:c8b:b0:57d:10c7:aa4b with SMTP id 4fb4d7f45d1cf-594bc7c835emr9031102a12.30.1720956805993; Sun, 14 Jul 2024 04:33:25 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:25 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 18/25] video: Enable DM_UC_FLAG_SEQ_ALIAS for display and bridge Date: Sun, 14 Jul 2024 13:32:55 +0200 Message-ID: <20240714113302.133399-18-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=TKQh2F7f; 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 Sun Jul 14 11:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3301 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 3A6044135D for ; Sun, 14 Jul 2024 13:33:29 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58e66895fd5sf2711748a12.0 for ; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956809; cv=pass; d=google.com; s=arc-20160816; b=YzwlzA2+YObVdxs8fMcYaKnKUqfaOZULqXfezghH0oQZPX8M6/SUOKQpJXGN3JqXKv OjL/1Zj8gyp206wCl5HuemsIwhSFq1MjPWT2HcW0qi7YSuczRceDJCMe03wR1pH6QmnS 8rf/b23QH6ShJHB/UsC+3MzmBwCmguwwHbKjcbUxzALEraqn2Vm1WqkMbrc7zZSeouYj aEwdjk9PT+1PVujkz0nbeTPanG0J/8SzmTtgksyPjhzgxT99L0O8/hlRBrx4d7t17E7k yWj3F/xlIm4iFBIsPLQD+6NLSKXGxFJuYvkLUg+3awqgZqksjhGn1F1S1SDK1zEFWkl8 Ct7g== 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=OcP0SqfbANmiysRY1ct3ggnr+n+1KFxcXMJBqxzvCsw=; fh=re/H6IHA3P68e0AhxxRCD5JespHQSj61SDXnkeid4bU=; b=NUkYAXVfRgMqur0x45+EvmmiEu4UIo7AUNndkv6vQQIH9gguRKHukgeqdjWQA1FjO/ Tb/DUJ3hg+FkTWdGsTwlTVgCdp7af+cKjXNDHwk9x3nZRWTuWslS3gmVWP4c3fe1ZMMJ 3OOYzad02CQbmH0vHFd6TbRJmXoyH97xhIHNveXAzxUELplpUDrnXevpG0vJBNKS5bKW AsJLaTodNggWZ2HX8OQpphW7eV584Mk+21sbWG4h3wYchDoEZj9sla7hGfvvssYjOn4x 74kL6iYymsLCkvt3XmcMB6ilwihsult7wzUN2QiHA64UeO8iFn8ZRHlqu+aq0PlTBiK7 KoQQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XRrN0AOZ; 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=1720956809; x=1721561609; 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=OcP0SqfbANmiysRY1ct3ggnr+n+1KFxcXMJBqxzvCsw=; b=GbkENbSGjx0xgAUG32Z2RKpAYLhVI8nBJa0ZgPcagccv5lVNJGtbwHUTBAv5gDaZEN cXDAAnabpkQ46CvgF5Xm+Gcae7pOZ7/FUX+NH4nx5V72H91L147mwQ+nwAEjQ4Dt8z3z bveTUO4RxjMMLz5PSkX3QslW5k2aRxbnOpSkk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956809; x=1721561609; 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=OcP0SqfbANmiysRY1ct3ggnr+n+1KFxcXMJBqxzvCsw=; b=JBVkWfhMkQAkr63fsGJsEFdHCzqytXAufKJdjxyujYuMOoHzPJjpXunx4dn6bxbpKP 8n8shTxxZGZ2Pru4wbjtN4qh/LhJqtb02t1DA+AL18g38F2kJNqEyp6XmNbZsBaKxkSL R+UhOkQUUeN3cH1wJ0JzfG5Ew6SXqIS2QKzUFbF7wMTAAEPatJKTIFmposCHqnL0dQWf c7H/jbNQK2BgOyDeoIAsJJ89AjOQjMWvYKsDv+Y2HJaVKJ9wmTbegb8O6Bu0He5Tp78m U5/2LwhH75TbljfR085NiuLRDi9Ccu+A+c90FaCh3wpzSm6K/AjosC75rEZ/Ttdb1Z38 vcxg== X-Forwarded-Encrypted: i=2; AJvYcCXX36dh9Zn7bKKKnHismVnbkcC+zvBHL8Yr6y0hLeKV3U2y1cw+YDWDSFENbp7sNejbIO9CB/AyJAk9HOWEFjbD1ty2nRtWb1NiEMOn1k5aGzW9pE3XVCyq6iBuKQ== X-Gm-Message-State: AOJu0YzaXayrguMWzW0/Yxj+YxfcQdj8w1+scmiWtJoocuqXMwVJORyd cmLo88mFuZmS6W1c10zxvtAtCQWhBO90piNsb5FSZc2Ng1/aOMrDD1fNypUBv0ZBcg== X-Google-Smtp-Source: AGHT+IFA0IQIHMb/lNrfRwSIm7rSYUV46JozPecRaj8TDkEB3pyeRdKcQmD8mNNh/vli1Y+n989pqQ== X-Received: by 2002:a50:8749:0:b0:59c:31fd:266b with SMTP id 4fb4d7f45d1cf-59c31fd267emr807704a12.28.1720956809002; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5249:b0:599:9c73:c397 with SMTP id 4fb4d7f45d1cf-5999c73c4fdls1084942a12.2.-pod-prod-09-eu; Sun, 14 Jul 2024 04:33:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWi+QdhXAJrcrPnSFPwwp5YujpL2rwGXYKIkEqr7NkFaiV4cViA3vIeE8sn/ScScABZsJpw+ETxmK1+Uk6Z+PN+b3XuEFqmX5mta3np52rAF5HM X-Received: by 2002:a50:d513:0:b0:599:7a9c:37b0 with SMTP id 4fb4d7f45d1cf-5997a9c3c27mr4065936a12.35.1720956807402; Sun, 14 Jul 2024 04:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956807; cv=none; d=google.com; s=arc-20160816; b=s2kKQ7TlX7g0p94lGJmHF2t7nY7pgB+CxbmNZ1ADSEJTsHlLy38YeFP1zMH4zBXq/u JoYENCKixi0bVSpGTOzPF4HikIPjLiFkNom0RdaMVnPLR31LjSClSQ2WJwGy40qOGpDV Bu8HWawvXUENr9TomENfY1mJ+bUYEusU2PpRRYIzRQcC0Jkr8XHfItNMoZ3A91CrfTzy oRBimT9ovmdGQXGYuirjRCMfUg75zV8UEnejis2bvdyKlEEkDZUQiXJqoeBHiDZmvUY/ COj9wmbLeHqjKRpZJZxO/l/Und5yAScNMtkPXZjy0av/QIsM9484qGzB+WxpxAbr2S96 nrJg== 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=rc514+uaHWKBiHPYvvxNCrrDcH7xbnYL0XxtEFHj6to=; fh=yQgCFbnorAF88/g/A2ZDoomXR5yzn9vYZPluPD15wJE=; b=GuLWlPaZTLxz24VipFQtNyrmfQkbhm1Mca2eJcklQgK6mK92kRfoqY/1U6FlqmEMJT UbAD8wQ4nKhrO/88s/bEEVt6yvGoFxFWbR1iI6/FcsHRaC8U28sCppXlrjFZHSmy2RzY Iumw6vU8Gvqu+1v2NsaW3oH9uJmCyXRicYGfTSyrLMchkncgj9Hiq4EtthwBGErmB7AD W5MmOpr7oyb43uD6qdwwgrM3Z7Tj8Csg9/px81s+PLEsonTNQFJevfaLAM5TTgjxnLV+ 3hPZfnfWSahPuwRcZNLvGxpSE2VxouAXnVnX815yQvUVsjl/CSHqHNOZ65Y4vEVjW2m+ mtTw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XRrN0AOZ; 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 4fb4d7f45d1cf-59b24a77618sor439906a12.3.2024.07.14.04.33.27 for (Google Transport Security); Sun, 14 Jul 2024 04:33:27 -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; AJvYcCXlb5n8Zx1FsN8h5UigdQRaTzA0h7SPwo3DLvog+4et0PasEudt2jBFlsNaJAy0/hG/A1eZt0eF4Zeb/PGrVbgMxoy+joU99nP3XT//4q+uRVLS X-Received: by 2002:a05:6402:510c:b0:58d:be82:6b1f with SMTP id 4fb4d7f45d1cf-594baf872fcmr12163336a12.10.1720956807008; Sun, 14 Jul 2024 04:33:27 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:26 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 19/25] phy: dphy: add support to calculate the timing based on hs_clk_rate Date: Sun, 14 Jul 2024 13:32:56 +0200 Message-ID: <20240714113302.133399-19-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=XRrN0AOZ; 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: , Upstream Linux commit 22168675bae7. For MIPI-CSI sender use-case it is common to specify the allowed link-frequencies which should be used for the MIPI link and is half the hs-clock rate. This commit adds a helper to calculate the D-PHY timing based on the hs-clock rate so we don't need to calculate the timings within the driver. Signed-off-by: Marco Felsch Acked-by: Vinod Koul Signed-off-by: Sakari Ailus Signed-off-by: Michael Trimarchi --- drivers/phy/phy-core-mipi-dphy.c | 32 +++++++++++++++++++++++++++----- include/phy-mipi-dphy.h | 3 +++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 8fb985a1e6..de467c2352 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -13,21 +13,23 @@ /* * Minimum D-PHY timings based on MIPI D-PHY specification. Derived * from the valid ranges specified in Section 6.9, Table 14, Page 41 - * of the D-PHY specification (v2.1). + * of the D-PHY specification (v1.2). */ -int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, +static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, unsigned int bpp, unsigned int lanes, + unsigned long long hs_clk_rate, struct phy_configure_opts_mipi_dphy *cfg) { - unsigned long long hs_clk_rate; unsigned long long ui; if (!cfg) return -EINVAL; - hs_clk_rate = pixel_clock * bpp; - do_div(hs_clk_rate, lanes); + if (!hs_clk_rate) { + hs_clk_rate = pixel_clock * bpp; + do_div(hs_clk_rate, lanes); + } ui = ALIGN(PSEC_PER_SEC, hs_clk_rate); do_div(ui, hs_clk_rate); @@ -74,6 +76,26 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, return 0; } +int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, + unsigned int bpp, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg) +{ + return phy_mipi_dphy_calc_config(pixel_clock, bpp, lanes, 0, cfg); + +} + +int phy_mipi_dphy_get_default_config_for_hsclk(unsigned long long hs_clk_rate, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg) +{ + if (!hs_clk_rate) + return -EINVAL; + + return phy_mipi_dphy_calc_config(0, 0, lanes, hs_clk_rate, cfg); + +} + /* * Validate D-PHY configuration according to MIPI D-PHY specification * (v1.2, Section Section 6.9 "Global Operation Timing Parameters"). diff --git a/include/phy-mipi-dphy.h b/include/phy-mipi-dphy.h index a877ffee84..1ac128d78d 100644 --- a/include/phy-mipi-dphy.h +++ b/include/phy-mipi-dphy.h @@ -279,6 +279,9 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, unsigned int bpp, unsigned int lanes, struct phy_configure_opts_mipi_dphy *cfg); +int phy_mipi_dphy_get_default_config_for_hsclk(unsigned long long hs_clk_rate, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg); int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *cfg); #endif /* __PHY_MIPI_DPHY_H_ */ From patchwork Sun Jul 14 11:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3302 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 187AF40F88 for ; Sun, 14 Jul 2024 13:33:31 +0200 (CEST) Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2ee87d500casf34695881fa.3 for ; Sun, 14 Jul 2024 04:33:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956810; cv=pass; d=google.com; s=arc-20160816; b=wULWALUOkNDsTTUN7FppKrAW56lGfCIdqrIENXBBw0y3nvZ3uyTcly+2Zqq+B9U7Qf 8jYGklR49iuj78uTikTbn3nICm74hlUpH+axyt86jC3SbJjFhR594ovoluFoNAABxWai XCT610CcmphM5acz03xtwCnVeih7KeixocxVUHamu9N7b+UY/EPcHiAoe3ptfVG4g3RX aAqybTwlzMd4uMIrMe1YhFFlJDcYvXQjvmM7eGxn76Qmk+GMQSs/sMByXgI4L5H4nTOt CNi4aUpIFTgUUF5E/YX+vj7fUdPWTDItn0eR+cuTOlRPVrGqFBMzgssi1xCzO3L+4auz ZwDA== 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=PVfTnoNgWRG2WWFnrXHoSLZ2R+QEXjCyhr42niBzrLQ=; fh=sKVKKuGRG3lH9Gq/3swkbJ1Z+NJk75thbeB5UPVh82c=; b=sNzePiHu4K9Xo+zfqpCFP4TjckIL2Gt43D3S9YYHRMF5sIbpZW5JYZGKkzoDpp31Uh Ot54tgwzRIYsaTbTqxc0a+v3JGkOrkEmkKKcxLCmHtIneJM+BqAq+53G6wUvNUpajmkw 0UmyANaCBl2aJezU/76k4iG9AC5QljyZhHPIuC+SAOZaPkcKAJVLukf+2csceNTIWN9f sGnJJzxki0qS8cYsoU9MgT70eYYO3UjBlk2VD9yAfKqZJYzDjRFEYbbUnOJRXdThniiP +NyEfUFeDo1bRBBECxLto0Vlb2R9NO9snF9cLnyQRdOZh8XlHNMRFBMQ96sNPvJatDBM TRSQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=H6l5y0LE; 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=1720956810; x=1721561610; 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=PVfTnoNgWRG2WWFnrXHoSLZ2R+QEXjCyhr42niBzrLQ=; b=Se950KJHXT1Zaa6HIKFQYl77p6IUSXVwEkU39CmINy253uuS1QESUCa5YeKL+pmkeG AgTTdqhHLsyhyRdKRbcS3ARhPaqyTZamSBtsCas27L3yNxepCsWrT1PyJ77uRqaKtjnD hdlZ3aePQYMATU9KRwqZyeDPPvVyYqw+NFSoo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956810; x=1721561610; 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=PVfTnoNgWRG2WWFnrXHoSLZ2R+QEXjCyhr42niBzrLQ=; b=D25tLbjkZhne8WirK8+A/vg2Y/fJ8TqiLPRs1DMZ8GGGclbLqzE3oWcJFPQg8pM2on ZZJAfaQqAGM/KSa+/Ec/Lzz9WQ1PDCY/G/MYd1swFG8zhOpa6ULHY8/SGx1wcuf3YPAy kqCQ7lk3GerKJurXAlW9tarnzTVxQBOOZczP0sB0VnKimOZQy1+Q3yXDrLqmZyvsPDXZ At6DKK0+C7U5vz75UxyC/3ESGvlsbLi18QatwXN+7Xq3NKjrSKkaUpFgFYxnVLy4hEwp Rddh3ZFKjQihnzT87YPXIYeuAhvL+1kqD+Kh3b6kRQYV3rxZwdfW1ZOYh2wy8nUO6K02 Q7Wg== X-Forwarded-Encrypted: i=2; AJvYcCUY3fdKhcdiGd98sp+rUSWtbHeTaQCommKoykm4FyFVBj/VLcD+zFHyLaBEjUvoJAUFVlsxIt90INTsOMC7BhpfF/O57wM4ioHyuu6tkYx8xMlBhz+YyHLBlosf2w== X-Gm-Message-State: AOJu0YzYQroTkWYN6WJj9TlHfGubou4Hkp6nG1TEslfLCr3LT1uLk/Se jGgC5wtE6Fi8cxPrcUfOGk3iODswluVDQPXhn67dRXXcp2fcHJyV8SbPvaC+0rxQhA== X-Google-Smtp-Source: AGHT+IH8L/klxY2HSE/Q+qFr9T5/gjRae5mlVoWO/nXnz2G2+byzeccrZVi8zv6JaqhYhplGeUjBcQ== X-Received: by 2002:a2e:be05:0:b0:2ee:d5c3:3888 with SMTP id 38308e7fff4ca-2eed5c33979mr48675061fa.4.1720956810530; Sun, 14 Jul 2024 04:33:30 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a2e:a481:0:b0:2ec:4d9a:63bc with SMTP id 38308e7fff4ca-2eec93a6e39ls8813651fa.1.-pod-prod-09-eu; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUFezDt+oLWPSjFiqKAXEk6CyNyqThrB6nXABME7XDKU5QRPfrBnuQrISpuOarg22Y8xcw2c6jZp7sB7GKjkARSJ4bUC8SJSEYM8UWEpLiHTaRE X-Received: by 2002:a05:6512:1049:b0:52e:9ec8:a3fd with SMTP id 2adb3069b0e04-52eb99cb023mr11815044e87.45.1720956808618; Sun, 14 Jul 2024 04:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956808; cv=none; d=google.com; s=arc-20160816; b=BxYYpC1a1Ozn5/YavDNPeOup2SMf6LrLP/fS0ENnjEehEOb/c5j0Ga9S6deI47WwRo XyI6ZSAk6r07nxCpBZLMyj+hwwWP8Dfhpvb7awb5R9LmNhMEFJz6r6en9fQRmZogZM6E mwa87I0u6GupVk0VDFqM7hmYunGbI6Jr+X94qvBst8h9nEGsreZ1f07NX5DK9FMzZ6Dm HtIxyjgJ6LIiD5pYV9jYp3DDuiyUJvu/DlNsjlR50vNSZOKl38XvHTztIund7SFBkEOa QVTbsIaYBIw2pJD/BfYaVqtuJqBkBIGiLPmn8viAR2OBCYJEaQI6/Qf3deVEwHPhjBWT rrRg== 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=UFF3VkS9CogNcGTm1c94A5k2cs51ThCGRz+LfvSTAgU=; fh=ID2ntNf8s7o9iYahA6E9lnu00h6EQE3BPH1yz6GEuiU=; b=cwzSYmgWoqwi6xj+TbqyN4/QkjvNWDFS5R6XOr911YeGA59XxLuLajg2WJo18b5pfq DbXFgbkZseEkb6hyIpLCz+Zl2AT3SjxdKiH3qSSnDAkqlo7e3FjGJCBNADOsNXzrazYO rxS4Qg+z5mc2Wh6djNDpSLUGMRdZfcExVzVgA7UQrlUcn6g2w0Ox2wBYQpaT8S2W+t8N LAJIajwTAjiF6Jmb4RofiRMGZ+XQk/MPZsQXTTICBfj32ELCo76goZl2kaMkLuCRjHdp 2D4dZN+noNBc3yQLXuJvaEh/UtkQ2xwgn+8YX/EbBCHbwfk7XwVRGjydHW//8D6gTmj3 /8Hg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=H6l5y0LE; 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-52ed25641bfsor436145e87.18.2024.07.14.04.33.28 for (Google Transport Security); Sun, 14 Jul 2024 04:33:28 -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+ACcdiszKNp9ntsurRPNqv6sc0sOXngyI3bxE7gYvWTpMR9rfNUty9AK4X8BNTKW0HSBzN0i040ZpzZBBknla5P6Fk1brGv3k8wTSiu8bpr6y X-Received: by 2002:a2e:9cda:0:b0:2ee:bc9a:9d7d with SMTP id 38308e7fff4ca-2eebc9a9f96mr90136801fa.37.1720956808115; Sun, 14 Jul 2024 04:33:28 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:27 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 20/25] phy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure}) Date: Sun, 14 Jul 2024 13:32:57 +0200 Message-ID: <20240714113302.133399-20-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=H6l5y0LE; 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: , Upstream linux commit 3153fa38e38af5. According to the comment of the function phy_mipi_dphy_get_default_config(), it uses minimum D-PHY timings based on MIPI D-PHY specification. They are derived from the valid ranges specified in Section 6.9, Table 14, Page 41 of the D-PHY specification (v1.2). The table 14 explicitly mentions that the minimum T-LPX parameter is 50 nanoseconds and the minimum TA-SURE parameter is T-LPX nanoseconds. Likewise, the kernel doc of the 'lpx' and 'ta_sure' members of struct phy_configure_opts_mipi_dphy mentions that the minimum values are 50000 picoseconds and @lpx picoseconds respectively. Also, the function phy_mipi_dphy_config_validate() checks if cfg->lpx is less than 50000 picoseconds and if cfg->ta_sure is less than cfg->lpx, which hints the same minimum values. Without this patch, the function phy_mipi_dphy_get_default_config() wrongly sets cfg->lpx to 60000 picoseconds and cfg->ta_sure to 2 * cfg->lpx. So, let's correct them to 50000 picoseconds and cfg->lpx respectively. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220216071257.1647703-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Michael Trimarchi --- drivers/phy/phy-core-mipi-dphy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index de467c2352..7a7cc4dc5b 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -64,10 +64,10 @@ static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, cfg->hs_trail = max(4 * 8 * ui, 60000 + 4 * 4 * ui); cfg->init = 100; - cfg->lpx = 60000; + cfg->lpx = 50000; cfg->ta_get = 5 * cfg->lpx; cfg->ta_go = 4 * cfg->lpx; - cfg->ta_sure = 2 * cfg->lpx; + cfg->ta_sure = cfg->lpx; cfg->wakeup = 1000; cfg->hs_clk_rate = hs_clk_rate; From patchwork Sun Jul 14 11:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3303 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 E7039412C7 for ; Sun, 14 Jul 2024 13:33:31 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2eee96e7dc2sf3539831fa.3 for ; Sun, 14 Jul 2024 04:33:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956811; cv=pass; d=google.com; s=arc-20160816; b=Dub7GiI2RN9TDsDr83yqGFnKR25uzIHe7o+VgraWTkXrvNbd0nbk2Y+AIv0qtzwvWx dcNKxKHVAqP5VWW3JTZTEwTXU/1kLoXFMy8xuAT+aJW2SgR/u7bCun7dFSjnLu1R4Pii I5zocA0wZeR2xeALtI2Ik4NFskpMr2/Mh/X2GufeWPexYOL9Tf+UzJy4HqwCFZtC77ub CL45Y+dSVydueQFriLKlTH6Hy4wKrLXkCFpbJvcVyV0vidaYhaPpWtrmXT5Q0fNkTJDc XELvt5x4tSVB6I5Ty6Co1yUn75klz4qrW+u33vnsHK1rv6SsN1b4WQeYJ3KnpDbVMBFn yYNA== 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:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e/RPqzzKrC8KkhhfqoobinWC79JKSHi8lfntzaLm5a0=; fh=sHBOdZe1iBU1L/TV/P5koBFn7mU/qeYZyeAqNq+Nmaw=; b=l6P6hZ/ADRljqqSsOCsMfdStbLOwB/2aZkXxMIW6F460i5+m0IvDw0RUnuxoi/uad2 GETBPdih8CjunYsWQ+5SDEsweKHaqcNz0PRwgSjVfw7j+g7VZWa5Po7BQsniuMZ4e1kh KpExhWz7lfA5xZXGGiubCAyHr9uyHEjT2zLu9uS+P/4NY79EB/26kO7jj+sNVx6W2Aou gEakwNw6CeHJ6Cl05WyHsWK5HnYJ6Hikz611K2O+AGwl5+HlTWu0eCzKfD/MLlTiK8tY QP9YyHHfIRWeH7lUFX5UHFoR4xG+MNvxKLO4nZC3qsGOerL7+dOxwoXtEvQxlmJ4vqai +gZg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qGqV2DOQ; 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=1720956811; x=1721561611; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=e/RPqzzKrC8KkhhfqoobinWC79JKSHi8lfntzaLm5a0=; b=ARgqJIYKdhdSq7vxT51kkElxVo3QkwYyCI9zx4ti2G85ftfqaC8qw4n8fNre/IvufR zPKT3RNvf8Jao43S0g4EjktLno09ijdypA7DlHPyLELsh8NUK09jijFoF2XkTDlsfteL WxOPT+q3iIc5r/5YSFNXUCerGK9/7egk5873M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956811; x=1721561611; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=e/RPqzzKrC8KkhhfqoobinWC79JKSHi8lfntzaLm5a0=; b=LdZkZzJ3aKE/49bKYeAaF9TUoc4d+H4m8I0YumcJxAlskuGT0UCMzemKJ4eMMTRi// iu4A4/oc9Tb7RrBdm4MEw7fHqoskywJR0o43bcCZZ1t48+yp7q9jwwlesRB/YLfJleeR QHmjD+9+c4VlKzgJsyzT1IYkCUvfM2yQrk8ZnaDU/HyUmoyAJS1IGTAAfw+BYKC9804g 8RxtlQokZT+PFcuW51KFuuZ8iXNSBBLQ4S9BjIjRP0xyLrrk7CZ7lLByjL+4pVbdM61t dNv+Y8WjtdKyvvLqYWBEld49b0qjD3i60l2XTU4pYwG9xOYHq+AO0kqNyjQG4J6Q774j PNRA== X-Forwarded-Encrypted: i=2; AJvYcCUdPDzBOyxyNDg+sfoYUckwSR+WpdgXHgd0YD1eqR7oxPFds+gJT504+VVZpsXFjOABizefoZeXhW8o38elZx/Oa2ohOzFXJNkgOG4A1NiIi5yp6wkkaIy0ndpfcA== X-Gm-Message-State: AOJu0YzN8e/Cdl2vxH75eVFWMqIZeq8IDgZdH15gO8VQd2d+bQe9Nkwd l6SAI/F8or9fxzqiXitRMN0J2jQOU8bKOu7UxTADR0C88T3tcL8u3kUZJrHCbbK2lw== X-Google-Smtp-Source: AGHT+IFLkHCR77RbqCLpR/UsWDp8jzbTxlxS4HUOEUNClIy6xbQoICo/uhz9aeiX+9xNz3MpyJiMvg== X-Received: by 2002:a2e:3315:0:b0:2ec:543a:b629 with SMTP id 38308e7fff4ca-2eeb318a0f7mr101049991fa.34.1720956811358; Sun, 14 Jul 2024 04:33:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4310:b0:599:9c73:c392 with SMTP id 4fb4d7f45d1cf-5999c73c484ls1286676a12.2.-pod-prod-04-eu; Sun, 14 Jul 2024 04:33:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOHZKHGvIxazfv63Nf9Y1NhuwyTc7+qlBLO/vkDRieddAInnMBG01pSw1Y2vGs3L7azwXFYtBS+2IOANPjCIczEdGZP/Uwb57XI1nldoPtGqWO X-Received: by 2002:a05:6402:4408:b0:58c:ccc1:17ec with SMTP id 4fb4d7f45d1cf-594baf9110amr13202084a12.13.1720956809698; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956809; cv=none; d=google.com; s=arc-20160816; b=Le+omDhkUB8IrH6nhF2NeIQpbP271gqox+rUwl7WtV4xRdmOuz1hghBzb5+ZQiirsd K+fDngR1nd466CLlo866djyPO0GgPsYB00DCBw6oSXuJvg22LdJlDS6MHTUnNrv4cjKy 4uccC2exUMbBAN5Tu7YsWXPvnOBjEmyX75ynQaqUl8uDSiwOfjKX+h/RN5KeXzc/HEbg J77eZz3agcaqVM9A0L9aYrnbxmCMqVI+RZdn4l6UxK9PgdB5a8squlap3PXUgFTN4rHL kK7ySkyU0aQvT6FPaXvGwjlnROQ0vqJm/kPx4aR1i7h6RhzALgUhpkIL3UCA3cF6cheF 3XFQ== 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=ExSEdrVHAuGJCeNa1DulbUhbsfDuL+nFSoEwjoPzUm8=; fh=IJ/zQD4ke/ryMBbB6veYLmkeM3hoxLQ1KsLD1o2LUew=; b=sqoGh6170Cldp9YRTSx9Z8eKih+WF361FBRWJyfZjlTe5mJ5XjpOUMrrSqdp+2BpYo XfXWlxEAv/j76ObAvGSTXwioS/zx/+UytrE1Ur1x/ALPvRjP7un7ZSwDP2oJzuzeWWx9 TJhRKXnNxuLLbiEt9NK/jZ+hVUUOp8Rri6L1lSJKUAUMFWFcZBiokLy716F8fJWU8tAo mP9d2+3gLUg/8H03SvlOi+PL2yxnkyqjaL8bOBH1Jc0DS/9OPt1Emb85eAoP5wBgyi+2 yeEoZt1YxAbtiERvoBpgm12KqhDBhkG6MUT/mmRpvzOPx3vMA6u9e8P5KW099vRlq0kl S7sg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qGqV2DOQ; 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 4fb4d7f45d1cf-59b26f652f0sor507856a12.10.2024.07.14.04.33.29 for (Google Transport Security); Sun, 14 Jul 2024 04:33:29 -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; AJvYcCVanXrPIcrvQ7Aid5p7X0vxZh7lMuSaBGa289vX5nyQ/MYf96c2pF6tT88GiLQ0H7IbYt2wOvm/Oc9eculDoJrn8nX+T+2OqJue6srGDkc593DM X-Received: by 2002:a05:6402:3588:b0:57c:a4a8:70f0 with SMTP id 4fb4d7f45d1cf-594baf8752dmr13538905a12.15.1720956809376; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:29 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 21/25] phy: dphy: Correct clk_pre parameter Date: Sun, 14 Jul 2024 13:32:58 +0200 Message-ID: <20240714113302.133399-21-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-1-michael@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qGqV2DOQ; 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 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: , Upstream linux commit 9a8406ba1a9a29. The D-PHY specification (v1.2) explicitly mentions that the T-CLK-PRE parameter's unit is Unit Interval(UI) and the minimum value is 8. Also, kernel doc of the 'clk_pre' member of struct phy_configure_opts_mipi_dphy mentions that it should be in UI. However, the dphy core driver wrongly sets 'clk_pre' to 8000, which seems to hint that it's in picoseconds. So, let's fix the dphy core driver to correctly reflect the T-CLK-PRE parameter's minimum value according to the D-PHY specification. I'm assuming that all impacted custom drivers shall program values in TxByteClkHS cycles into hardware for the T-CLK-PRE parameter. The D-PHY specification mentions that the frequency of TxByteClkHS is exactly 1/8 the High-Speed(HS) bit rate(each HS bit consumes one UI). So, relevant custom driver code is changed to program those values as DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE), then. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Tested-by: Liu Ying # RM67191 DSI panel on i.MX8mq EVK Reviewed-by: Andrzej Hajda Reviewed-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Guido Günther # Librem 5 (imx8mq) with it's rather picky panel Reviewed-by: Laurent Pinchart Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220124024007.1465018-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Michael Trimarchi --- drivers/phy/meson-axg-mipi-dphy.c | 2 +- drivers/phy/phy-core-mipi-dphy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/meson-axg-mipi-dphy.c b/drivers/phy/meson-axg-mipi-dphy.c index 3f89de1997..fb10ccca6a 100644 --- a/drivers/phy/meson-axg-mipi-dphy.c +++ b/drivers/phy/meson-axg-mipi-dphy.c @@ -237,7 +237,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy) (DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) | (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24)); regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1, - DIV_ROUND_UP(priv->config.clk_pre, temp)); + DIV_ROUND_UP(priv->config.clk_pre, BITS_PER_BYTE)); regmap_write(priv->regmap, MIPI_DSI_HS_TIM, DIV_ROUND_UP(priv->config.hs_exit, temp) | diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 7a7cc4dc5b..8341b78e0d 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -36,7 +36,7 @@ static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, cfg->clk_miss = 0; cfg->clk_post = 60000 + 52 * ui; - cfg->clk_pre = 8000; + cfg->clk_pre = 8; cfg->clk_prepare = 38000; cfg->clk_settle = 95000; cfg->clk_term_en = 0; From patchwork Sun Jul 14 11:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3304 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 D66304130C for ; Sun, 14 Jul 2024 13:33:32 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58c38bcd765sf2847755a12.1 for ; Sun, 14 Jul 2024 04:33:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956812; cv=pass; d=google.com; s=arc-20160816; b=0M8pY3+vvSiuvCEWBD+X7mts6LJ834wP575tG4vvI+XjNVljcWVXIzbiEzJldR4y0G Cwn1VTIjiVz/tgRMrbUsaOIoL9kMZe4QVqF+lQ4z36KvOHq9P+AeOS3sID7jgKn9D/mk q7IKFlV8vpVxOHGYDxhXXoFaiZdiY1UEJIeU+GhSnfUPK6++/ZDzU9eQzVJBGRVm4+kG HvfgHsJmDrwWa8dvRjNW88iXNnP781CeLbP45DElerd9HMcUFJCNnVUucv586/nqeDn3 RJx+OW6ti7wQCbtdY/A6dcG46pOu2xqWPp+ufPzk1pDOI7kMgcnf4kYaV/3CX7AkeeYx 22qQ== 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=IX2bI+AYYcyF4AJ8YY33jhHNvGyHcGPs5OrGSUzBR5k=; fh=2W66GUJtd3bOqk0XmMI5t+sIlukCwDD6N6fplCtbQsk=; b=pnidpfc1s6oC1ju7w2ZQ2UzoIB6kC4281ZAojPNxwx/1SucWa0uf0OUELXuklifq4L MpP/f3Fw/623WYrKy5HhrzEu2/OQy5+dW/V0oJHl31zy11Fb8ZbQ02UffX8+JCQmw4NC 657VJpI8yv3YFiVHm36+YgFbBIVROoWWYMVkgyBxfyj6C/z0Kn7IivBCfS9GhVs1NOA9 +x5qK4EIbw6gFNoO0geH+4zulYPlPCgnyoxMhtyJd9ssBab1sEbANPdVT4GJhCVufYPo HjiNH9D2qhKGV87UTwUL0OUHW+ocS5DYsoun1qXJmGhEImy06kVbxUwZ69gkXq6U/Vi1 oLqQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EGAVzDCS; 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=1720956812; x=1721561612; 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=IX2bI+AYYcyF4AJ8YY33jhHNvGyHcGPs5OrGSUzBR5k=; b=iupm24BbehmV+prWif57HOjgiuBahDpX/Q3IT/FNlOJCtB/lr4Jfktg1ZKTtOhi6qt yH5xXjsvIRzBceG/yGq+xgs+y3eNdQcJS1wRMc1Nnyr/kbBJGiY4m2aVuAZVosxLXOJg FPFstTZFa9sWUOcKpA6P0u9gCW22D3R3xbex8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956812; x=1721561612; 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=IX2bI+AYYcyF4AJ8YY33jhHNvGyHcGPs5OrGSUzBR5k=; b=c8DiI2Pq+O6aKZ1Oe1ytBFwpmRwD+2yViY6igaMackHwt6zNGCXKW01TMvMwO4t2SM CZ9dqMCBJhbW8OnIreaqBtSS14+i+J2Yd44vLkwg1fgFh8VZ8nS3JrpDwu0tmWRm5ZFD MfVxPhimtc+yfvJL85nf1hPywo+OGQ2vseu5fUvq7lDdSVfpBYulAFNUdAqujqqOwYLq AV4uogcJLDlNzR3WkjNlewXKtknJP7Ngs1wzG9rAKbNb5Rp+/2XvXxw6zwrjsfgdeqju s7uaHPetPf+8rUGpOj3sZYxOXaePxN3IgXlyZNF5Fj9rq91JXKrVKtk1goYPt72niqQD sJGg== X-Forwarded-Encrypted: i=2; AJvYcCUG4+2G8KWk8+rgNq7qyLgm2zgcNW3SEh1jgkuyOJXJDA7Pl1WcZtgiKLoNoX6KsXLhcNP33/OTS6KA5TgGighGHHDDwst6ZkmFSVJCqjiXoxrj/cnN0bLjOKs2iw== X-Gm-Message-State: AOJu0Ywv5bDKeFo6PHAL/ewXwCR7w9FbC4Apn+qXjkJi7W+pNer0ueYP hxUxGrIjC3gK6ib6axD9n5dU5XexezB+cakvmTXWDBfQO/7fOA4cUWQ2dw77CvPIiQ== X-Google-Smtp-Source: AGHT+IGlHWrZer2vAQWUc5dQlRtegAvDrQhQSWeQYaQ/MDt/T+B2cRsE99b2LpsxBXuZV+oJVTVPSw== X-Received: by 2002:a05:6402:350b:b0:58f:ebaa:64bf with SMTP id 4fb4d7f45d1cf-594ba9975bamr12405355a12.2.1720956812564; Sun, 14 Jul 2024 04:33:32 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc94:0:b0:57d:555d:8ddd with SMTP id 4fb4d7f45d1cf-59821cb87f6ls1726680a12.0.-pod-prod-02-eu; Sun, 14 Jul 2024 04:33:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWrLi47MqKZDcrOF3cE3a7OuFNfo3TWzX3kvMkleJ7ZGIADQTqiZbKSyfaI8fjDIXbCygo+eqiieeY9Io2XovxYP44Hznw55mzp0ugPEUrEZVde X-Received: by 2002:a50:9f85:0:b0:59a:a8cc:23a7 with SMTP id 4fb4d7f45d1cf-59aa8cc2436mr3229266a12.0.1720956810848; Sun, 14 Jul 2024 04:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956810; cv=none; d=google.com; s=arc-20160816; b=eRXKBd0qoVsSJaQO6R9pfH+nC1fEUBhN4+Xx0/fpxQjeHmeeL3QcUbtUxaAW4Mh8wc 6/Xv5AmkGyq3n7Tj65773kyduV6glDTJiAry4ttO+ijCdZ+spRlLISek6n2ZvJvKFhG0 ntrzFjMBhIDBgWsTKgdP2zrA7thOsNDxaJ1IhWqWWmbLfc5wvDQHIhdXBXWaSmaCz+u7 GwUitwLXqoA5qQBzyBkkzHYlrk++6iZK0V6zsO7SaCch7dNpOVc0zgStH+X8Afw55YjG gP5M8hocwyJO4EVMHR07g344K46s+0zB+Va1QZNg1vlFnglDe5K7yBGIqoBYA3QBaj6t fRdw== 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=WD7ZmfhocDYBRfei8FW+9wSfSoFIOqwvjpGxjOjRVBs=; fh=tnLa1kZ5wWxJ67NS5WFaTn665pfka0o9vqrl4k9tyGo=; b=PVLL/56aYPvGPHsMOgmXrsbPVhwTcPp96JaBDb1UcnMFAS/6oGeW9mDFkuCQzC13Dv pdbszvpGEN9F7qqPXPUeyjTMkIRDPYB3SQ4kSraHnhiPFyUS2lYCgQEY9Cz9dCOTgFIQ INwPgD7QdmHxGFg5nuZBKANaXzBu5lJLSE1T7bgj5So1Lt4EHCVPj9k1GrIVM2YxjhJs rlan37LAOMcXWpK1LnngsYHdyfxFGaM/D74IYAQyr0dUPlEKk/Q99/v2cDdKWsKjzXsL ohUbLiOCWPkD3hJO1mkYDmkMZiDiw8C1wA/vN8LOF2tlpJF+bjO3ODz0/GdXmJYvSjBO 8Idw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EGAVzDCS; 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 4fb4d7f45d1cf-59b26f64d55sor430495a12.10.2024.07.14.04.33.30 for (Google Transport Security); Sun, 14 Jul 2024 04:33:30 -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; AJvYcCVau7s0sj0KgmLH43IOMZvuF5sMItrMtGEbxWhlBPm7f4UtdZjvvhpB4qEETDKjtnvHNtYrF36vwAlKndNgEEm0SYBY4LA92gE8rsI4nyKcjfcm X-Received: by 2002:a05:6402:348d:b0:58d:81ac:ea90 with SMTP id 4fb4d7f45d1cf-594bcba77e6mr13155416a12.38.1720956810376; Sun, 14 Jul 2024 04:33:30 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:30 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 22/25] lib: div64: sync with Linux Date: Sun, 14 Jul 2024 13:32:59 +0200 Message-ID: <20240714113302.133399-22-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=EGAVzDCS; 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: , Sync with Linux commit fc4a0db4149af ("Merge tag '6.5'"). Cc: Tom Rini Signed-off-by: Michael Trimarchi --- include/linux/math64.h | 110 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/include/linux/math64.h b/include/linux/math64.h index eaa9fd5b96..0e684bb2be 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_MATH64_H #define _LINUX_MATH64_H @@ -12,6 +13,11 @@ /** * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor + * @remainder: pointer to unsigned 32bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor * * This is commonly provided by 32bit archs to provide an optimized 64bit * divide. @@ -24,6 +30,11 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) /** * div_s64_rem - signed 64bit divide with 32bit divisor with remainder + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor + * @remainder: pointer to signed 32bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor */ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) { @@ -33,6 +44,11 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) /** * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * @remainder: pointer to unsigned 64bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor */ static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) { @@ -42,6 +58,10 @@ static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) /** * div64_u64 - unsigned 64bit divide with 64bit divisor + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * + * Return: dividend / divisor */ static inline u64 div64_u64(u64 dividend, u64 divisor) { @@ -53,6 +73,10 @@ static inline u64 div64_u64(u64 dividend, u64 divisor) /** * div64_s64 - signed 64bit divide with 64bit divisor + * @dividend: signed 64bit dividend + * @divisor: signed 64bit divisor + * + * Return: dividend / divisor */ static inline s64 div64_s64(s64 dividend, s64 divisor) { @@ -92,10 +116,14 @@ extern s64 div64_s64(s64 dividend, s64 divisor); /** * div_u64 - unsigned 64bit divide with 32bit divisor + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor * * This is the most common 64bit divide and should be used if possible, * as many 32bit archs can optimize this variant better than a full 64bit * divide. + * + * Return: dividend / divisor */ #ifndef div_u64 static inline u64 div_u64(u64 dividend, u32 divisor) @@ -107,6 +135,10 @@ static inline u64 div_u64(u64 dividend, u32 divisor) /** * div_s64 - signed 64bit divide with 32bit divisor + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor + * + * Return: dividend / divisor */ #ifndef div_s64 static inline s64 div_s64(s64 dividend, s32 divisor) @@ -228,6 +260,24 @@ static inline u64 mul_u64_u64_shr(u64 a, u64 b, unsigned int shift) #endif +#ifndef mul_s64_u64_shr +static inline u64 mul_s64_u64_shr(s64 a, u64 b, unsigned int shift) +{ + u64 ret; + + /* + * Extract the sign before the multiplication and put it back + * afterwards if needed. + */ + ret = mul_u64_u64_shr(abs(a), b, shift); + + if (a < 0) + ret = -((s64) ret); + + return ret; +} +#endif /* mul_s64_u64_shr */ + #ifndef mul_u64_u32_div static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor) { @@ -257,4 +307,64 @@ static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor) } #endif /* mul_u64_u32_div */ +u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div); + +/** + * DIV64_U64_ROUND_UP - unsigned 64bit divide with 64bit divisor rounded up + * @ll: unsigned 64bit dividend + * @d: unsigned 64bit divisor + * + * Divide unsigned 64bit dividend by unsigned 64bit divisor + * and round up. + * + * Return: dividend / divisor rounded up + */ +#define DIV64_U64_ROUND_UP(ll, d) \ + ({ u64 _tmp = (d); div64_u64((ll) + _tmp - 1, _tmp); }) + +/** + * DIV64_U64_ROUND_CLOSEST - unsigned 64bit divide with 64bit divisor rounded to nearest integer + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * + * Divide unsigned 64bit dividend by unsigned 64bit divisor + * and round to closest integer. + * + * Return: dividend / divisor rounded to nearest integer + */ +#define DIV64_U64_ROUND_CLOSEST(dividend, divisor) \ + ({ u64 _tmp = (divisor); div64_u64((dividend) + _tmp / 2, _tmp); }) + +/** + * DIV_U64_ROUND_CLOSEST - unsigned 64bit divide with 32bit divisor rounded to nearest integer + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor + * + * Divide unsigned 64bit dividend by unsigned 32bit divisor + * and round to closest integer. + * + * Return: dividend / divisor rounded to nearest integer + */ +#define DIV_U64_ROUND_CLOSEST(dividend, divisor) \ + ({ u32 _tmp = (divisor); div_u64((u64)(dividend) + _tmp / 2, _tmp); }) + +/** + * DIV_S64_ROUND_CLOSEST - signed 64bit divide with 32bit divisor rounded to nearest integer + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor + * + * Divide signed 64bit dividend by signed 32bit divisor + * and round to closest integer. + * + * Return: dividend / divisor rounded to nearest integer + */ +#define DIV_S64_ROUND_CLOSEST(dividend, divisor)( \ +{ \ + s64 __x = (dividend); \ + s32 __d = (divisor); \ + ((__x > 0) == (__d > 0)) ? \ + div_s64((__x + (__d / 2)), __d) : \ + div_s64((__x - (__d / 2)), __d); \ +} \ +) #endif /* _LINUX_MATH64_H */ From patchwork Sun Jul 14 11:33:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3306 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 C7962412C7 for ; Sun, 14 Jul 2024 13:33:35 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58bd8406816sf3378218a12.0 for ; Sun, 14 Jul 2024 04:33:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956815; cv=pass; d=google.com; s=arc-20160816; b=waqbEb+OhO84GmBFD52inTee9MM7LSHPaK82OhQ0CIak9LuY9LZCyRtYHx7RPbkh1u BRuLf/TENygfhNjqihx/dCVd5ax0zEa5n2PNb3PgWkCQekKhnBy5Jbz/bt6Q+M4yTDe7 DMY+Bhsv6I26jb3zLhjPLPoKcHMPgybqk3lli85kGn7AP83erR1Nfv+L5ZmMOjovOyPp mJQJ7nLCLwYPEWKz5JR9zZp9AArDxDAxxCcv4nR7msTB0w3/KaqZoBFKiyL5kfxt6MW1 tNAzXwu0T70JHJL2qz56rW3TbipFpS7TeyLvf6tRFOIZDhTP5SNShUFdWjBZcZKGv+5o Mr5w== 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=mZTYrtizUpsraR0WzDpDdYWAUoLMae9DnIx+Uvo4Zs0=; fh=Pp3GAgv3imAVvLx5Nj9RENOyPjIGaLW03vEAs6sdEGo=; b=VStUcsqewFsVnN2fCVosrNx6zvF2AGKmJoFPsjQgMPpLw5uQP8GWQ/fq0mO4iEvM1J ZOZqdpobmqRmu8yaYNn/qW5nzcuNrDyS0qlGKBfLq2IWqzS8HJL3rFgqU1hVyM+f5ChK Wu4WpBd9k2OqluC0YL6E39W0kADDsapfio1TCKMOtx+PJDKtkk+245Lk24thwMza9OP+ CCFRFrvyiH/k7hSCZ8NCcxpgDp+8qro/5KYSlg5KbQnyg3IGoqERM5OayE8pAUAKpy8h Am5gxwIq3CjxwxZKwYpY4mZK4NuMFU7DOxdEyN5QB7gQ2WxaJy7zXIH0eEU4BuTq0bR+ We9w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YAKTyNyJ; 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=1720956815; x=1721561615; 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=mZTYrtizUpsraR0WzDpDdYWAUoLMae9DnIx+Uvo4Zs0=; b=NpTLGuc2wqQOr6SOCgoSm5w6a5XmmKzE98yJm4EzWtv7Lgq1oS4oFbFWWF/teDNpZl /nG8DIhGalt4pymKASl0qSYtlkaDb+1oYAOc65tpIOTeG/cJ64m4yE0ycYOaJiG/2K6B zUun5FhNeQ+B1WMxok/uNHUKZqJMpXDaMjmj8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956815; x=1721561615; 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=mZTYrtizUpsraR0WzDpDdYWAUoLMae9DnIx+Uvo4Zs0=; b=wXNnzAj8zJLWiwOvP1AbZ2npRvDTFdczdebFxWN96fPpLyOROvjHr4S9xD7p3JQtwI N2OqmHiR10p16gmHY28oCi5ao/zcsR+ctBF/pNWYZPZ+G8QHR5ipmyQQ5JaYxKNha5i0 AarkqunFD/3bo8GESEYzC6tbXMHAdD7gLRLx0SZ4DDOv0j8VZlf3NlvqFjFSQHGXITHF r9ZlDrswYiubS0Oi+GL62nApYAsa+RI3KVjfGw5lpaFkR6eOg6JuV4qZHf821j6au1dB 7Frudi0x7eOa29TnbZlZJ/fx3PYyAFvgck+uEWnfNfp1NnTi3PC9mE19HTC/LfB2n0+H bhmQ== X-Forwarded-Encrypted: i=2; AJvYcCV9bE8Gz3Fdr+G3b6anML6mcC/chng3o9oK3Lm0lnAs12X7lbmpz3CtI98rsyGX6ffQ9ilnJc5noQ18WbM5STtPhRpWsLD7iRkLh3UQi825tsogEqebWWqcbbEUkw== X-Gm-Message-State: AOJu0Yzs1n0GVI11HynT4y4NtXyoG6aNAGEs+OWMQvwuBAUIAPZkL02s 2lfDh8yfnuQkMoyLabxE0DzCTQFthDK69nbaQtyQSun15Yx8LjsN8ZVTWhcIvq4qjg== X-Google-Smtp-Source: AGHT+IFMi0Oirvr397TZZvvxorE0+PJGEX8DVCQuvoN7WvWb1roCa/V7Llt5PVDVOcN3HVm+Ayf8pA== X-Received: by 2002:a50:8a94:0:b0:58e:450b:d9f9 with SMTP id 4fb4d7f45d1cf-594bb86a64fmr9853853a12.29.1720956815399; Sun, 14 Jul 2024 04:33:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42d0:b0:599:5a33:7abc with SMTP id 4fb4d7f45d1cf-5995a337c06ls1203919a12.2.-pod-prod-01-eu; Sun, 14 Jul 2024 04:33:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfud1SHVVDbq5fjN3CdUiGzjkNmuVGOi+IKz/vzctAJkuqSsUrDGeZqVmBD+0fKp1bZkQR5j9A8bwnyEWVCO2ZShWehYkJRdaD0eTSXCa2lGe0 X-Received: by 2002:a05:6402:1e8c:b0:57c:a886:c402 with SMTP id 4fb4d7f45d1cf-594ba0cb8f1mr12630444a12.12.1720956812718; Sun, 14 Jul 2024 04:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956812; cv=none; d=google.com; s=arc-20160816; b=BTg3ISJ1tyokopbTGnRzUMY1cR+LAiIjXvlyzC5Zd8KIKLvdFJMhBBM2liMw182F4L uFkTU7mx8BYhMLwntcuIhcBpfLug04Ctj6SxhuH3xkb8y0cOim19yBIWVi8NUzPSD+Co CFYqA841Y+MhCTykQ1/yeJwuaNowBBydCR97xD77EqSKjy0nLekXtbXL7+dDigFe23BZ SpGvQg+G4BisKCdNA4pjyqmwfTpaz53P3XlyT1nopX2PwdD8wjau6yguZ2yYaBu0ont/ PWW0txxP4uYASYoFDsMXjLw5OGmPBDcLloNCLLrGPyYjPlJDsZmwo/XEPG5jtlT46gJn FAfQ== 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=U8olgqBno6MslYPgExoAJ7eF5xfi+xsdWqOwX1SeLGc=; fh=cKvdLGdIYLS9Cc4LCAExemoV7PYXAbfAv8UZtwwWMxs=; b=XpeImaW9YzgL+riOXgmOpJvMiPQ8mUD8xf5SQAm8BNikqk0af889CB5kVYotKXp5G1 7U8P9ke/M9gzv66T71RASkdeLf9sUBe8wiLNL8v3E0vZpXhAs9Q+JiMFXKAjwCaCUzZo 1UvT6+AG11Ejqq0MKVyI4B2YHhUFqq5l9GVqOPbImaYCLrM6URFZOJLYc96ui4y/4UUO w9mUVex0gQu+kifuLLGKjlOtE6c5sJVaLvl94om3qTBm0kcRvSSE4qFr0XNpCSjhYecG bKKhGDRvGvnmCaamE21e1mepWN7LbBPzGzmw/p16SQm2sgD+XutWS/vGsUzw/O4PDsHi 0H+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YAKTyNyJ; 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 4fb4d7f45d1cf-59b268a14cdsor444585a12.7.2024.07.14.04.33.32 for (Google Transport Security); Sun, 14 Jul 2024 04:33:32 -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; AJvYcCX9YHeeZxOqFYGUlL4jrhTy0f9lyuCT6cgzKgbH5L+cXIzYSiVTWpd2iVEwlm7r5BXPcapZMcgHidSEAFpJ/6BxmvETGGEUfSV5q5BsTWkWeeGe X-Received: by 2002:aa7:da54:0:b0:57d:ef3:c3b7 with SMTP id 4fb4d7f45d1cf-594bbe2ba17mr9832420a12.36.1720956812020; Sun, 14 Jul 2024 04:33:32 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:31 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 23/25] video: bridge: Add Samsung DSIM bridge Date: Sun, 14 Jul 2024 13:33:00 +0200 Message-ID: <20240714113302.133399-23-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=YAKTyNyJ; 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 | 13 + drivers/video/bridge/Makefile | 1 + drivers/video/bridge/samsung-dsi-host.c | 1567 +++++++++++++++++++++++ drivers/video/bridge/samsung-dsim.c | 148 +++ drivers/video/bridge/samsung-dsim.h | 20 + 5 files changed, 1749 insertions(+) create mode 100644 drivers/video/bridge/samsung-dsi-host.c create mode 100644 drivers/video/bridge/samsung-dsim.c create mode 100644 drivers/video/bridge/samsung-dsim.h diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig index ab91727372..5cb1e7af99 100644 --- a/drivers/video/bridge/Kconfig +++ b/drivers/video/bridge/Kconfig @@ -44,6 +44,19 @@ config VIDEO_BRIDGE_ANALOGIX_ANX6345 The Analogix ANX6345 is RGB-to-DP converter. It enables an eDP LCD panel to be connected to an parallel LCD interface. +config VIDEO_BRIDGE_SAMSUNG_DSIM + bool "Enable IMX SEC DSI video support" + select MIPI_DPHY_HELPERS + select VIDEO_BRIDGE + select VIDEO_LINK + select VIDEO_MIPI_DSI + help + Enables the common driver code for the Samsung + MIPI DSI block found in SoCs from various vendors. + As this does not provide any functionality by itself (but + rather requires a SoC-specific glue driver to call it), it + can not be enabled from the configuration menu. + config VIDEO_BRIDGE_SOLOMON_SSD2825 bool "Solomon SSD2825 bridge driver" depends on PANEL && DM_GPIO diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile index 58697e3cbe..8f49013299 100644 --- a/drivers/video/bridge/Makefile +++ b/drivers/video/bridge/Makefile @@ -8,5 +8,6 @@ obj-$(CONFIG_VIDEO_BRIDGE_PARADE_DP501) += dp501.o obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o +obj-$(CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM) += samsung-dsim.o samsung-dsi-host.o obj-$(CONFIG_VIDEO_BRIDGE_SOLOMON_SSD2825) += ssd2825.o obj-$(CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768) += tc358768.o diff --git a/drivers/video/bridge/samsung-dsi-host.c b/drivers/video/bridge/samsung-dsi-host.c new file mode 100644 index 0000000000..dd3e33c4ed --- /dev/null +++ b/drivers/video/bridge/samsung-dsi-host.c @@ -0,0 +1,1567 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2018 NXP + * + */ + +#define LOG_CATEGORY UCLASS_DSI_HOST + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "samsung-dsim.h" + +#define MIPI_FIFO_TIMEOUT 250000 /* 250ms */ + +#define DRIVER_NAME "samsung_dsi" + +/* reg bit manipulation */ +#define REG_MASK(e, s) (((1 << ((e) - (s) + 1)) - 1) << (s)) +#define REG_PUT(x, e, s) (((x) << (s)) & REG_MASK(e, s)) +#define REG_GET(x, e, s) (((x) & REG_MASK(e, s)) >> (s)) + +#define RGB_STATUS_CMDMODE_INSEL BIT(31) +#define RGB_STATUS_GET_RGBSTATE(x) REG_GET(x, 12, 0) + +#define CLKCTRL_DPHY_SEL_1P5G (0x0 << 29) +#define CLKCTRL_PLLBYPASS BIT(29) +#define CLKCTRL_BYTECLKSRC_DPHY_PLL REG_PUT(0, 26, 25) +#define CLKCTRL_SET_LANEESCCLKEN(x) REG_PUT(x, 23, 19) +#define CLKCTRL_SET_ESCPRESCALER(x) REG_PUT(x, 15, 0) + +#define ESCMODE_SET_STOPSTATE_CNT(X) REG_PUT(x, 31, 21) +#define ESCMODE_FORCESTOPSTATE BIT(20) +#define ESCMODE_FORCEBTA BIT(16) +#define ESCMODE_CMDLPDT BIT(7) +#define ESCMODE_TXLPDT BIT(6) +#define ESCMODE_TXTRIGGERRST BIT(5) + +#define MVPORCH_SET_CMDALLOW(x) REG_PUT(x, 31, 28) +#define MVPORCH_SET_STABLEVFP(x) REG_PUT(x, 26, 16) +#define MVPORCH_SET_MAINVBP(x) REG_PUT(x, 10, 0) + +#define MHPORCH_SET_MAINHFP(x) REG_PUT(x, 31, 16) +#define MHPORCH_SET_MAINHBP(x) REG_PUT(x, 15, 0) + +#define MSYNC_SET_MAINVSA(x) REG_PUT(x, 31, 22) +#define MSYNC_SET_MAINHSA(x) REG_PUT(x, 15, 0) + +#define INTSRC_PLLSTABLE BIT(31) +#define INTSRC_SWRSTRELEASE BIT(30) +#define INTSRC_SFRPLFIFOEMPTY BIT(29) +#define INTSRC_SFRPHFIFOEMPTY BIT(28) +#define INTSRC_FRAMEDONE BIT(24) +#define INTSRC_LPDRTOUT BIT(21) +#define INTSRC_TATOUT BIT(20) +#define INTSRC_RXDATDONE BIT(18) +#define INTSRC_MASK (INTSRC_PLLSTABLE | \ + INTSRC_SWRSTRELEASE | \ + INTSRC_SFRPLFIFOEMPTY | \ + INTSRC_SFRPHFIFOEMPTY | \ + INTSRC_FRAMEDONE | \ + INTSRC_LPDRTOUT | \ + INTSRC_TATOUT | \ + INTSRC_RXDATDONE) + +#define INTMSK_MSKPLLSTABLE BIT(31) +#define INTMSK_MSKSWRELEASE BIT(30) +#define INTMSK_MSKSFRPLFIFOEMPTY BIT(29) +#define INTMSK_MSKSFRPHFIFOEMPTY BIT(28) +#define INTMSK_MSKFRAMEDONE BIT(24) +#define INTMSK_MSKLPDRTOUT BIT(21) +#define INTMSK_MSKTATOUT BIT(20) +#define INTMSK_MSKRXDATDONE BIT(18) + +#define PKTHDR_SET_DATA1(x) REG_PUT(x, 23, 16) +#define PKTHDR_GET_DATA1(x) REG_GET(x, 23, 16) +#define PKTHDR_SET_DATA0(x) REG_PUT(x, 15, 8) +#define PKTHDR_GET_DATA0(x) REG_GET(x, 15, 8) +#define PKTHDR_GET_WC(x) REG_GET(x, 23, 8) +#define PKTHDR_SET_DI(x) REG_PUT(x, 7, 0) +#define PKTHDR_GET_DI(x) REG_GET(x, 7, 0) +#define PKTHDR_SET_DT(x) REG_PUT(x, 5, 0) +#define PKTHDR_GET_DT(x) REG_GET(x, 5, 0) +#define PKTHDR_SET_VC(x) REG_PUT(x, 7, 6) +#define PKTHDR_GET_VC(x) REG_GET(x, 7, 6) + +#define FIFOCTRL_FULLRX BIT(25) +#define FIFOCTRL_EMPTYRX BIT(24) +#define FIFOCTRL_FULLHSFR BIT(23) +#define FIFOCTRL_EMPTYHSFR BIT(22) +#define FIFOCTRL_FULLLSFR BIT(21) +#define FIFOCTRL_EMPTYLSFR BIT(20) +#define FIFOCTRL_FULLHMAIN BIT(11) +#define FIFOCTRL_EMPTYHMAIN BIT(10) +#define FIFOCTRL_FULLLMAIN BIT(9) +#define FIFOCTRL_EMPTYLMAIN BIT(8) +#define FIFOCTRL_NINITRX BIT(4) +#define FIFOCTRL_NINITSFR BIT(3) +#define FIFOCTRL_NINITI80 BIT(2) +#define FIFOCTRL_NINITSUB BIT(1) +#define FIFOCTRL_NINITMAIN BIT(0) + +#define PLLCTRL_DPDNSWAP_CLK BIT(25) +#define PLLCTRL_DPDNSWAP_DAT BIT(24) +#define PLLCTRL_PLLEN BIT(23) +#define PLLCTRL_SET_PMS(x) REG_PUT(x, 19, 1) +#define PLLCTRL_SET_P(x) REG_PUT(x, 18, 13) +#define PLLCTRL_SET_M(x) REG_PUT(x, 12, 3) +#define PLLCTRL_SET_S(x) REG_PUT(x, 2, 0) + +#define MAX_MAIN_HRESOL 2047 +#define MAX_MAIN_VRESOL 2047 +#define MAX_SUB_HRESOL 1024 +#define MAX_SUB_VRESOL 1024 + +/* in KHZ */ +#define MAX_ESC_CLK_FREQ 20000 + +/* dsim all irqs index */ +#define PLLSTABLE 1 +#define SWRSTRELEASE 2 +#define SFRPLFIFOEMPTY 3 +#define SFRPHFIFOEMPTY 4 +#define SYNCOVERRIDE 5 +#define BUSTURNOVER 6 +#define FRAMEDONE 7 +#define LPDRTOUT 8 +#define TATOUT 9 +#define RXDATDONE 10 +#define RXTE 11 +#define RXACK 12 +#define ERRRXECC 13 +#define ERRRXCRC 14 +#define ERRESC3 15 +#define ERRESC2 16 +#define ERRESC1 17 +#define ERRESC0 18 +#define ERRSYNC3 19 +#define ERRSYNC2 20 +#define ERRSYNC1 21 +#define ERRSYNC0 22 +#define ERRCONTROL3 23 +#define ERRCONTROL2 24 +#define ERRCONTROL1 25 +#define ERRCONTROL0 26 + +#define PS_TO_CYCLE(ps, hz) DIV64_U64_ROUND_CLOSEST(((ps) * (hz)), 1000000000000ULL) + +#define MIPI_HFP_PKT_OVERHEAD 6 +#define MIPI_HBP_PKT_OVERHEAD 6 +#define MIPI_HSA_PKT_OVERHEAD 6 + +/* DSIM_STATUS */ +#define DSIM_STOP_STATE_DAT(x) (((x) & 0xf) << 0) +#define DSIM_STOP_STATE_CLK BIT(8) +#define DSIM_TX_READY_HS_CLK BIT(10) +#define DSIM_PLL_STABLE BIT(31) + +/* DSIM_SWRST */ +#define DSIM_FUNCRST BIT(16) +#define DSIM_SWRST BIT(0) + +/* DSIM_TIMEOUT */ +#define DSIM_LPDR_TIMEOUT(x) ((x) << 0) +#define DSIM_BTA_TIMEOUT(x) ((x) << 16) + +/* DSIM_CLKCTRL */ +#define DSIM_ESC_PRESCALER(x) (((x) & 0xffff) << 0) +#define DSIM_ESC_PRESCALER_MASK (0xffff << 0) +#define DSIM_LANE_ESC_CLK_EN_CLK BIT(19) +#define DSIM_LANE_ESC_CLK_EN_DATA(x) (((x) & 0xf) << 20) +#define DSIM_LANE_ESC_CLK_EN_DATA_MASK (0xf << 20) +#define DSIM_BYTE_CLKEN BIT(24) +#define DSIM_BYTE_CLK_SRC(x) (((x) & 0x3) << 25) +#define DSIM_BYTE_CLK_SRC_MASK (0x3 << 25) +#define DSIM_PLL_BYPASS BIT(27) +#define DSIM_ESC_CLKEN BIT(28) +#define DSIM_TX_REQUEST_HSCLK BIT(31) + +/* DSIM_CONFIG */ +#define DSIM_LANE_EN_CLK BIT(0) +#define DSIM_LANE_EN(x) (((x) & 0xf) << 1) +#define DSIM_NUM_OF_DATA_LANE(x) (((x) & 0x3) << 5) +#define DSIM_SUB_PIX_FORMAT(x) (((x) & 0x7) << 8) +#define DSIM_MAIN_PIX_FORMAT_MASK (0x7 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB888 (0x7 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB666 (0x6 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB666_P (0x5 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB565 (0x4 << 12) +#define DSIM_SUB_VC(x) (((x) & 0x3) << 16) +#define DSIM_MAIN_VC(x) (((x) & 0x3) << 18) +#define DSIM_HSA_DISABLE_MODE BIT(20) +#define DSIM_HBP_DISABLE_MODE BIT(21) +#define DSIM_HFP_DISABLE_MODE BIT(22) +/* + * The i.MX 8M Mini Applications Processor Reference Manual, + * Rev. 3, 11/2020 Page 4091 + * The i.MX 8M Nano Applications Processor Reference Manual, + * Rev. 2, 07/2022 Page 3058 + * The i.MX 8M Plus Applications Processor Reference Manual, + * Rev. 1, 06/2021 Page 5436 + * all claims this bit is 'HseDisableMode' with the definition + * 0 = Disables transfer + * 1 = Enables transfer + * + * This clearly states that HSE is not a disabled bit. + * + * The naming convention follows as per the manual and the + * driver logic is based on the MIPI_DSI_MODE_VIDEO_HSE flag. + */ +#define DSIM_HSE_DISABLE_MODE BIT(23) +#define DSIM_AUTO_MODE BIT(24) +#define DSIM_VIDEO_MODE BIT(25) +#define DSIM_BURST_MODE BIT(26) +#define DSIM_SYNC_INFORM BIT(27) +#define DSIM_EOT_DISABLE BIT(28) +#define DSIM_MFLUSH_VS BIT(29) +/* This flag is valid only for exynos3250/3472/5260/5430 */ +#define DSIM_CLKLANE_STOP BIT(30) +#define DSIM_NON_CONTINUOUS_CLKLANE BIT(31) + +/* DSIM_ESCMODE */ +#define DSIM_TX_TRIGGER_RST BIT(4) +#define DSIM_TX_LPDT_LP BIT(6) +#define DSIM_CMD_LPDT_LP BIT(7) +#define DSIM_FORCE_BTA BIT(16) +#define DSIM_FORCE_STOP_STATE BIT(20) +#define DSIM_STOP_STATE_CNT(x) (((x) & 0x7ff) << 21) +#define DSIM_STOP_STATE_CNT_MASK (0x7ff << 21) + +/* DSIM_MDRESOL */ +#define DSIM_MAIN_STAND_BY BIT(31) +#define DSIM_MAIN_VRESOL(x, num_bits) (((x) & ((1 << (num_bits)) - 1)) << 16) +#define DSIM_MAIN_HRESOL(x, num_bits) (((x) & ((1 << (num_bits)) - 1)) << 0) + +/* DSIM_MVPORCH */ +#define DSIM_CMD_ALLOW(x) ((x) << 28) +#define DSIM_STABLE_VFP(x) ((x) << 16) +#define DSIM_MAIN_VBP(x) ((x) << 0) +#define DSIM_CMD_ALLOW_MASK (0xf << 28) +#define DSIM_STABLE_VFP_MASK (0x7ff << 16) +#define DSIM_MAIN_VBP_MASK (0x7ff << 0) + +/* DSIM_MHPORCH */ +#define DSIM_MAIN_HFP(x) ((x) << 16) +#define DSIM_MAIN_HBP(x) ((x) << 0) +#define DSIM_MAIN_HFP_MASK ((0xffff) << 16) +#define DSIM_MAIN_HBP_MASK ((0xffff) << 0) + +/* DSIM_MSYNC */ +#define DSIM_MAIN_VSA(x) ((x) << 22) +#define DSIM_MAIN_HSA(x) ((x) << 0) +#define DSIM_MAIN_VSA_MASK ((0x3ff) << 22) +#define DSIM_MAIN_HSA_MASK ((0xffff) << 0) + +/* DSIM_SDRESOL */ +#define DSIM_SUB_STANDY(x) ((x) << 31) +#define DSIM_SUB_VRESOL(x) ((x) << 16) +#define DSIM_SUB_HRESOL(x) ((x) << 0) +#define DSIM_SUB_STANDY_MASK ((0x1) << 31) +#define DSIM_SUB_VRESOL_MASK ((0x7ff) << 16) +#define DSIM_SUB_HRESOL_MASK ((0x7ff) << 0) + +/* DSIM_INTSRC */ +#define DSIM_INT_PLL_STABLE BIT(31) +#define DSIM_INT_SW_RST_RELEASE BIT(30) +#define DSIM_INT_SFR_FIFO_EMPTY BIT(29) +#define DSIM_INT_SFR_HDR_FIFO_EMPTY BIT(28) +#define DSIM_INT_BTA BIT(25) +#define DSIM_INT_FRAME_DONE BIT(24) +#define DSIM_INT_RX_TIMEOUT BIT(21) +#define DSIM_INT_BTA_TIMEOUT BIT(20) +#define DSIM_INT_RX_DONE BIT(18) +#define DSIM_INT_RX_TE BIT(17) +#define DSIM_INT_RX_ACK BIT(16) +#define DSIM_INT_RX_ECC_ERR BIT(15) +#define DSIM_INT_RX_CRC_ERR BIT(14) + +/* DSIM_FIFOCTRL */ +#define DSIM_RX_DATA_FULL BIT(25) +#define DSIM_RX_DATA_EMPTY BIT(24) +#define DSIM_SFR_HEADER_FULL BIT(23) +#define DSIM_SFR_HEADER_EMPTY BIT(22) +#define DSIM_SFR_PAYLOAD_FULL BIT(21) +#define DSIM_SFR_PAYLOAD_EMPTY BIT(20) +#define DSIM_I80_HEADER_FULL BIT(19) +#define DSIM_I80_HEADER_EMPTY BIT(18) +#define DSIM_I80_PAYLOAD_FULL BIT(17) +#define DSIM_I80_PAYLOAD_EMPTY BIT(16) +#define DSIM_SD_HEADER_FULL BIT(15) +#define DSIM_SD_HEADER_EMPTY BIT(14) +#define DSIM_SD_PAYLOAD_FULL BIT(13) +#define DSIM_SD_PAYLOAD_EMPTY BIT(12) +#define DSIM_MD_HEADER_FULL BIT(11) +#define DSIM_MD_HEADER_EMPTY BIT(10) +#define DSIM_MD_PAYLOAD_FULL BIT(9) +#define DSIM_MD_PAYLOAD_EMPTY BIT(8) +#define DSIM_RX_FIFO BIT(4) +#define DSIM_SFR_FIFO BIT(3) +#define DSIM_I80_FIFO BIT(2) +#define DSIM_SD_FIFO BIT(1) +#define DSIM_MD_FIFO BIT(0) + +/* DSIM_PHYACCHR */ +#define DSIM_AFC_EN BIT(14) +#define DSIM_AFC_CTL(x) (((x) & 0x7) << 5) + +/* DSIM_PLLCTRL */ +#define DSIM_FREQ_BAND(x) ((x) << 24) +#define DSIM_PLL_EN BIT(23) +#define DSIM_PLL_P(x, offset) ((x) << (offset)) +#define DSIM_PLL_M(x) ((x) << 4) +#define DSIM_PLL_S(x) ((x) << 1) + +/* DSIM_PHYCTRL */ +#define DSIM_PHYCTRL_ULPS_EXIT(x) (((x) & 0x1ff) << 0) +#define DSIM_PHYCTRL_B_DPHYCTL_VREG_LP BIT(30) +#define DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP BIT(14) + +/* DSIM_PHYTIMING */ +#define DSIM_PHYTIMING_LPX(x) ((x) << 8) +#define DSIM_PHYTIMING_HS_EXIT(x) ((x) << 0) + +/* DSIM_PHYTIMING1 */ +#define DSIM_PHYTIMING1_CLK_PREPARE(x) ((x) << 24) +#define DSIM_PHYTIMING1_CLK_ZERO(x) ((x) << 16) +#define DSIM_PHYTIMING1_CLK_POST(x) ((x) << 8) +#define DSIM_PHYTIMING1_CLK_TRAIL(x) ((x) << 0) + +/* DSIM_PHYTIMING2 */ +#define DSIM_PHYTIMING2_HS_PREPARE(x) ((x) << 16) +#define DSIM_PHYTIMING2_HS_ZERO(x) ((x) << 8) +#define DSIM_PHYTIMING2_HS_TRAIL(x) ((x) << 0) + +#define DSI_MAX_BUS_WIDTH 4 +#define DSI_NUM_VIRTUAL_CHANNELS 4 +#define DSI_TX_FIFO_SIZE 2048 +#define DSI_RX_FIFO_SIZE 256 +#define DSI_XFER_TIMEOUT_MS 100 +#define DSI_RX_FIFO_EMPTY 0x30800002 + +struct samsung_dsim_driver_data { + const unsigned int *reg_ofs; + unsigned int plltmr_reg; + unsigned int has_freqband:1; + unsigned int has_clklane_stop:1; + unsigned int has_broken_fifoctrl_emptyhdr:1; + unsigned int num_clks; + unsigned int min_freq; + unsigned int max_freq; + unsigned int wait_for_reset; + unsigned int num_bits_resol; + unsigned int pll_p_offset; + const unsigned int *reg_values; + unsigned int pll_fin_min; + unsigned int pll_fin_max; + u16 m_min; + u16 m_max; +}; + +enum reg_idx { + DSIM_STATUS_REG, /* Status register */ + DSIM_RGB_STATUS_REG, /* RGB status register */ + DSIM_SWRST_REG, /* Software reset register */ + DSIM_CLKCTRL_REG, /* Clock control register */ + DSIM_TIMEOUT_REG, /* Time out register */ + DSIM_CONFIG_REG, /* Configuration register */ + DSIM_ESCMODE_REG, /* Escape mode register */ + DSIM_MDRESOL_REG, + DSIM_MVPORCH_REG, /* Main display Vporch register */ + DSIM_MHPORCH_REG, /* Main display Hporch register */ + DSIM_MSYNC_REG, /* Main display sync area register */ + DSIM_INTSRC_REG, /* Interrupt source register */ + DSIM_INTMSK_REG, /* Interrupt mask register */ + DSIM_PKTHDR_REG, /* Packet Header FIFO register */ + DSIM_PAYLOAD_REG, /* Payload FIFO register */ + DSIM_RXFIFO_REG, /* Read FIFO register */ + DSIM_FIFOCTRL_REG, /* FIFO status and control register */ + DSIM_PLLCTRL_REG, /* PLL control register */ + DSIM_PHYCTRL_REG, + DSIM_PHYTIMING_REG, + DSIM_PHYTIMING1_REG, + DSIM_PHYTIMING2_REG, + NUM_REGS +}; + +static const unsigned int exynos_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x00, + [DSIM_SWRST_REG] = 0x04, + [DSIM_CLKCTRL_REG] = 0x08, + [DSIM_TIMEOUT_REG] = 0x0c, + [DSIM_CONFIG_REG] = 0x10, + [DSIM_ESCMODE_REG] = 0x14, + [DSIM_MDRESOL_REG] = 0x18, + [DSIM_MVPORCH_REG] = 0x1c, + [DSIM_MHPORCH_REG] = 0x20, + [DSIM_MSYNC_REG] = 0x24, + [DSIM_INTSRC_REG] = 0x2c, + [DSIM_INTMSK_REG] = 0x30, + [DSIM_PKTHDR_REG] = 0x34, + [DSIM_PAYLOAD_REG] = 0x38, + [DSIM_RXFIFO_REG] = 0x3c, + [DSIM_FIFOCTRL_REG] = 0x44, + [DSIM_PLLCTRL_REG] = 0x4c, + [DSIM_PHYCTRL_REG] = 0x5c, + [DSIM_PHYTIMING_REG] = 0x64, + [DSIM_PHYTIMING1_REG] = 0x68, + [DSIM_PHYTIMING2_REG] = 0x6c, +}; + +static const unsigned int exynos5433_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x04, + [DSIM_RGB_STATUS_REG] = 0x08, + [DSIM_SWRST_REG] = 0x0C, + [DSIM_CLKCTRL_REG] = 0x10, + [DSIM_TIMEOUT_REG] = 0x14, + [DSIM_CONFIG_REG] = 0x18, + [DSIM_ESCMODE_REG] = 0x1C, + [DSIM_MDRESOL_REG] = 0x20, + [DSIM_MVPORCH_REG] = 0x24, + [DSIM_MHPORCH_REG] = 0x28, + [DSIM_MSYNC_REG] = 0x2C, + [DSIM_INTSRC_REG] = 0x34, + [DSIM_INTMSK_REG] = 0x38, + [DSIM_PKTHDR_REG] = 0x3C, + [DSIM_PAYLOAD_REG] = 0x40, + [DSIM_RXFIFO_REG] = 0x44, + [DSIM_FIFOCTRL_REG] = 0x4C, + [DSIM_PLLCTRL_REG] = 0x94, + [DSIM_PHYCTRL_REG] = 0xA4, + [DSIM_PHYTIMING_REG] = 0xB4, + [DSIM_PHYTIMING1_REG] = 0xB8, + [DSIM_PHYTIMING2_REG] = 0xBC, +}; + +enum reg_value_idx { + RESET_TYPE, + PLL_TIMER, + STOP_STATE_CNT, + PHYCTRL_ULPS_EXIT, + PHYCTRL_VREG_LP, + PHYCTRL_SLEW_UP, + PHYTIMING_LPX, + PHYTIMING_HS_EXIT, + PHYTIMING_CLK_PREPARE, + PHYTIMING_CLK_ZERO, + PHYTIMING_CLK_POST, + PHYTIMING_CLK_TRAIL, + PHYTIMING_HS_PREPARE, + PHYTIMING_HS_ZERO, + PHYTIMING_HS_TRAIL +}; + +static const unsigned int reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x0af), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x27), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x09), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const unsigned int exynos5422_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x08), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0d), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x30), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x0a), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0c), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x11), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0d), +}; + +static const unsigned int exynos5433_reg_values[] = { + [RESET_TYPE] = DSIM_FUNCRST, + [PLL_TIMER] = 22200, + [STOP_STATE_CNT] = 0xa, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x190), + [PHYCTRL_VREG_LP] = DSIM_PHYCTRL_B_DPHYCTL_VREG_LP, + [PHYCTRL_SLEW_UP] = DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x07), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0c), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x2d), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x09), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0b), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x10), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), +}; + +static const unsigned int imx8mm_dsim_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x26), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x08), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x58, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 5, + .max_freq = 1500, + .wait_for_reset = 0, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5433_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1500, + .wait_for_reset = 1, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5422_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 2100, + .wait_for_reset = 0, + .num_bits_resol = 12, + /* + * Unlike Exynos, PLL_P(PMS_P) offset 14 is used in i.MX8M Mini/Nano/Plus + * downstream driver - drivers/gpu/drm/bridge/sec-dsim.c + */ + .pll_p_offset = 14, + .reg_values = imx8mm_dsim_reg_values, + .pll_fin_min = 2, + .pll_fin_max = 30, + .m_min = 64, + .m_max = 1023, + .min_freq = 1050, +}; + +static const struct samsung_dsim_driver_data * +samsung_dsim_types[DSIM_TYPE_COUNT] = { + [DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, + [DSIM_TYPE_EXYNOS4210] = &exynos4_dsi_driver_data, + [DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, + [DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, + [DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, + [DSIM_TYPE_IMX8MM] = &imx8mm_dsi_driver_data, + [DSIM_TYPE_IMX8MP] = &imx8mm_dsi_driver_data, +}; + +/* DSIM PLL configuration from spec: + * + * Fout(DDR) = (M * Fin) / (P * 2^S), so Fout / Fin = M / (P * 2^S) + * Fin_pll = Fin / P (6 ~ 12 MHz) + * S: [2:0], M: [12:3], P: [18:13], so + * TODO: 'S' is in [0 ~ 3], 'M' is in, 'P' is in [1 ~ 33] + * + */ + +struct samsung_dsi { + void __iomem *reg_base; + struct clk sclk_mipi; + const struct samsung_dsim_driver_data *driver_data; + + /* kHz clocks */ + u64 pix_clk; + u64 bit_clk; + u64 hs_clock; + + unsigned int lanes; + unsigned int channel; /* virtual channel */ + enum mipi_dsi_pixel_format format; + unsigned long mode_flags; + unsigned int pms; + + struct mipi_dsi_device *device; + u32 max_data_lanes; + + struct mipi_dsi_host dsi_host; + struct display_timing timings; +}; + +static inline void samsung_dsim_write(struct samsung_dsi *dsi, + enum reg_idx idx, u32 val) +{ + writel(val, dsi->reg_base + dsi->driver_data->reg_ofs[idx]); +} + +static inline u32 samsung_dsim_read(struct samsung_dsi *dsi, enum reg_idx idx) +{ + return readl(dsi->reg_base + dsi->driver_data->reg_ofs[idx]); +} + +static int samsung_dsi_wait_for_pkt_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPLFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPLFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_for_hdr_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPHFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPHFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_for_rx_done(struct samsung_dsi *dsim, + unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_RXDATDONE) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_RXDATDONE); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_pll_stable(struct samsung_dsi *dsim) +{ + u32 status; + ulong start; + + start = get_timer(0); /* Get current timestamp */ + + do { + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (status & DSIM_PLL_STABLE) + return 0; + } while (get_timer(0) < (start + 100)); /* Wait 100ms */ + + return -ETIMEDOUT; +} + +static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsi *dsi, + unsigned long fin, + unsigned long fout, + u8 *p, u16 *m, u8 *s) +{ + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; + unsigned long best_freq = 0; + u32 min_delta = 0xffffffff; + u8 p_min, p_max; + u8 _p, best_p; + u16 _m, best_m; + u8 _s, best_s; + + p_min = DIV_ROUND_UP(fin, (MHZ(12))); + p_max = fin / (MHZ(6)); + + for (_p = p_min; _p <= p_max; ++_p) { + for (_s = 0; _s <= 5; ++_s) { + u64 tmp; + u32 delta; + + tmp = (u64)fout * (_p << _s); + do_div(tmp, fin); + _m = tmp; + if (_m < driver_data->m_min || _m > driver_data->m_max) + continue; + + tmp = (u64)_m * fin; + do_div(tmp, _p); + if (tmp < driver_data->min_freq * MHZ(1) || + tmp > driver_data->max_freq * MHZ(1)) + continue; + + tmp = (u64)_m * fin; + do_div(tmp, _p << _s); + + delta = abs(fout - tmp); + if (delta < min_delta) { + best_p = _p; + best_m = _m; + best_s = _s; + min_delta = delta; + best_freq = tmp; + } + } + } + + if (best_freq) { + *p = best_p; + *m = best_m; + *s = best_s; + } + + return best_freq; +} + +static int samsung_dsi_config_pll(struct samsung_dsi *dsim) +{ + int ret; + u32 pllctrl = 0, status, data_lanes_en, stop; + + writel(dsim->driver_data->reg_values[PLL_TIMER], + dsim->reg_base + dsim->driver_data->plltmr_reg); + + /* TODO: config dp/dn swap if requires */ + + pllctrl |= PLLCTRL_SET_PMS(dsim->pms) | PLLCTRL_PLLEN; + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, pllctrl); + + ret = samsung_dsi_wait_pll_stable(dsim); + if (ret) { + log_err("wait for pll stable time out\n"); + return ret; + } + + /* wait for clk & data lanes to go to stop state */ + mdelay(1); + + data_lanes_en = (0x1 << dsim->lanes) - 1; + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (!(status & DSIM_STOP_STATE_CLK)) { + log_err("clock is not in stop state\n"); + return -EBUSY; + } + + stop = DSIM_STOP_STATE_DAT(status); + if ((stop & data_lanes_en) != data_lanes_en) { + log_err("one or more data lanes is not in stop state\n"); + return -EBUSY; + } + + return 0; +} + +static void samsung_dsi_set_main_mode(struct samsung_dsi *dsim) +{ + u32 bpp, hfp_wc, hbp_wc, hsa_wc, wc; + u32 mdresol = 0, mvporch = 0, mhporch = 0, msync = 0; + struct display_timing *timings = &dsim->timings; + unsigned int num_bits_resol = dsim->driver_data->num_bits_resol; + + mdresol |= DSIM_MAIN_VRESOL(timings->vactive.typ, num_bits_resol) | + DSIM_MAIN_HRESOL(timings->hactive.typ, num_bits_resol); + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); + + mvporch |= MVPORCH_SET_MAINVBP(timings->vback_porch.typ) | + MVPORCH_SET_STABLEVFP(timings->vfront_porch.typ) | + MVPORCH_SET_CMDALLOW(0x0); + samsung_dsim_write(dsim, DSIM_MVPORCH_REG, mvporch); + + bpp = mipi_dsi_pixel_format_to_bpp(dsim->format); + + wc = DIV_ROUND_UP(timings->hfront_porch.typ * (bpp >> 3), dsim->lanes); + hfp_wc = wc > MIPI_HFP_PKT_OVERHEAD ? + wc - MIPI_HFP_PKT_OVERHEAD : timings->hfront_porch.typ; + wc = DIV_ROUND_UP(timings->hback_porch.typ * (bpp >> 3), dsim->lanes); + hbp_wc = wc > MIPI_HBP_PKT_OVERHEAD ? + wc - MIPI_HBP_PKT_OVERHEAD : timings->hback_porch.typ; + + mhporch |= MHPORCH_SET_MAINHFP(hfp_wc) | + MHPORCH_SET_MAINHBP(hbp_wc); + + samsung_dsim_write(dsim, DSIM_MHPORCH_REG, mhporch); + + wc = DIV_ROUND_UP(timings->hsync_len.typ * (bpp >> 3), dsim->lanes); + hsa_wc = wc > MIPI_HSA_PKT_OVERHEAD ? + wc - MIPI_HSA_PKT_OVERHEAD : timings->hsync_len.typ; + + msync |= MSYNC_SET_MAINVSA(timings->vsync_len.typ) | + MSYNC_SET_MAINHSA(hsa_wc); + + debug("hfp_wc %u hbp_wc %u hsa_wc %u\n", hfp_wc, hbp_wc, hsa_wc); + + samsung_dsim_write(dsim, DSIM_MSYNC_REG, msync); +} + +static void samsung_dsi_config_dpi(struct samsung_dsi *dsim) +{ + u32 config = 0, rgb_status = 0, data_lanes_en; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) + rgb_status &= ~RGB_STATUS_CMDMODE_INSEL; + else + rgb_status |= RGB_STATUS_CMDMODE_INSEL; + + samsung_dsim_write(dsim, DSIM_RGB_STATUS_REG, rgb_status); + + if (dsim->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) { + config |= DSIM_CLKLANE_STOP; + config |= DSIM_NON_CONTINUOUS_CLKLANE; + } + + if (dsim->mode_flags & MIPI_DSI_MODE_VSYNC_FLUSH) + config |= DSIM_MFLUSH_VS; + + /* disable EoT packets in HS mode */ + if (dsim->mode_flags & MIPI_DSI_MODE_EOT_PACKET) + config |= DSIM_EOT_DISABLE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + config |= DSIM_VIDEO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + config |= DSIM_BURST_MODE; + + else if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + config |= DSIM_SYNC_INFORM; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_AUTO_VERT) + config |= DSIM_AUTO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSE) + config |= DSIM_HSE_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HFP) + config |= DSIM_HFP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HBP) + config |= DSIM_HBP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSA) + config |= DSIM_HSA_DISABLE_MODE; + } + + config |= DSIM_MAIN_VC(dsim->channel); + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + switch (dsim->format) { + case MIPI_DSI_FMT_RGB888: + config |= DSIM_MAIN_PIX_FORMAT_RGB888; + break; + case MIPI_DSI_FMT_RGB666: + config |= DSIM_MAIN_PIX_FORMAT_RGB666; + break; + case MIPI_DSI_FMT_RGB666_PACKED: + config |= DSIM_MAIN_PIX_FORMAT_RGB666_P; + break; + case MIPI_DSI_FMT_RGB565: + config |= DSIM_MAIN_PIX_FORMAT_RGB565; + break; + default: + log_err("invalid pixel format\n"); + break; + } + } + + /* config data lanes number and enable lanes */ + data_lanes_en = BIT(dsim->lanes) - 1; + config |= (DSIM_NUM_OF_DATA_LANE(dsim->lanes - 1) | DSIM_LANE_EN_CLK | + DSIM_LANE_EN(data_lanes_en)); + + debug("DSIM config 0x%x\n", config); + + samsung_dsim_write(dsim, DSIM_CONFIG_REG, config); +} + +static void samsung_dsi_config_cmd_lpm(struct samsung_dsi *dsim, bool enable) +{ + u32 escmode; + + escmode = samsung_dsim_read(dsim, DSIM_ESCMODE_REG); + + if (enable) + escmode |= ESCMODE_CMDLPDT; + else + escmode &= ~ESCMODE_CMDLPDT; + + samsung_dsim_write(dsim, DSIM_ESCMODE_REG, escmode); +} + +static void samsung_dsi_config_dphy(struct samsung_dsi *dsim) +{ + const struct samsung_dsim_driver_data *driver_data = dsim->driver_data; + const unsigned int *reg_values = driver_data->reg_values; + u32 reg; + struct phy_configure_opts_mipi_dphy cfg; + int clk_prepare, lpx, clk_zero, clk_post, clk_trail; + int hs_exit, hs_prepare, hs_zero, hs_trail; + unsigned long long byte_clock = dsim->hs_clock / 8; + + if (driver_data->has_freqband) + return; + + phy_mipi_dphy_get_default_config_for_hsclk(dsim->hs_clock, dsim->lanes, &cfg); + + /* + * TODO: + * The tech Applications Processor manuals for i.MX8M Mini, Nano, + * and Plus don't state what the definition of the PHYTIMING + * bits are beyond their address and bit position. + * After reviewing NXP's downstream code, it appears + * that the various PHYTIMING registers take the number + * of cycles and use various dividers on them. This + * calculation does not result in an exact match to the + * downstream code, but it is very close to the values + * generated by their lookup table, and it appears + * to sync at a variety of resolutions. If someone + * can get a more accurate mathematical equation needed + * for these registers, this should be updated. + */ + + lpx = PS_TO_CYCLE(cfg.lpx, byte_clock); + hs_exit = PS_TO_CYCLE(cfg.hs_exit, byte_clock); + clk_prepare = PS_TO_CYCLE(cfg.clk_prepare, byte_clock); + clk_zero = PS_TO_CYCLE(cfg.clk_zero, byte_clock); + clk_post = PS_TO_CYCLE(cfg.clk_post, byte_clock); + clk_trail = PS_TO_CYCLE(cfg.clk_trail, byte_clock); + hs_prepare = PS_TO_CYCLE(cfg.hs_prepare, byte_clock); + hs_zero = PS_TO_CYCLE(cfg.hs_zero, byte_clock); + hs_trail = PS_TO_CYCLE(cfg.hs_trail, byte_clock); + + /* B D-PHY: D-PHY Master & Slave Analog Block control */ + reg = reg_values[PHYCTRL_ULPS_EXIT] | reg_values[PHYCTRL_VREG_LP] | + reg_values[PHYCTRL_SLEW_UP]; + + samsung_dsim_write(dsim, DSIM_PHYCTRL_REG, reg); + + /* + * T LPX: Transmitted length of any Low-Power state period + * T HS-EXIT: Time that the transmitter drives LP-11 following a HS + * burst + */ + + reg = DSIM_PHYTIMING_LPX(lpx) | DSIM_PHYTIMING_HS_EXIT(hs_exit); + samsung_dsim_write(dsim, DSIM_PHYTIMING_REG, reg); + + /* + * T CLK-PREPARE: Time that the transmitter drives the Clock Lane LP-00 + * Line state immediately before the HS-0 Line state starting the + * HS transmission + * T CLK-ZERO: Time that the transmitter drives the HS-0 state prior to + * transmitting the Clock. + * T CLK_POST: Time that the transmitter continues to send HS clock + * after the last associated Data Lane has transitioned to LP Mode + * Interval is defined as the period from the end of T HS-TRAIL to + * the beginning of T CLK-TRAIL + * T CLK-TRAIL: Time that the transmitter drives the HS-0 state after + * the last payload clock bit of a HS transmission burst + */ + + reg = DSIM_PHYTIMING1_CLK_PREPARE(clk_prepare) | + DSIM_PHYTIMING1_CLK_ZERO(clk_zero) | + DSIM_PHYTIMING1_CLK_POST(clk_post) | + DSIM_PHYTIMING1_CLK_TRAIL(clk_trail); + + samsung_dsim_write(dsim, DSIM_PHYTIMING1_REG, reg); + + /* + * T HS-PREPARE: Time that the transmitter drives the Data Lane LP-00 + * Line state immediately before the HS-0 Line state starting the + * HS transmission + * T HS-ZERO: Time that the transmitter drives the HS-0 state prior to + * transmitting the Sync sequence. + * T HS-TRAIL: Time that the transmitter drives the flipped differential + * state after last payload data bit of a HS transmission burst + */ + + reg = DSIM_PHYTIMING2_HS_PREPARE(hs_prepare) | + DSIM_PHYTIMING2_HS_ZERO(hs_zero) | + DSIM_PHYTIMING2_HS_TRAIL(hs_trail); + + samsung_dsim_write(dsim, DSIM_PHYTIMING2_REG, reg); + + reg = DSIM_BTA_TIMEOUT(0xff) | DSIM_LPDR_TIMEOUT(0xffff); + + samsung_dsim_write(dsim, DSIM_TIMEOUT_REG, reg); +} + +static void samsung_dsim_write_pl_to_sfr_fifo(struct samsung_dsi *dsim, + const void *payload, + size_t length) +{ + u32 pl_data; + + if (!length) + return; + + while (length >= 4) { + pl_data = get_unaligned_le32(payload); + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + payload += 4; + length -= 4; + } + + pl_data = 0; + switch (length) { + case 3: + pl_data |= ((u8 *)payload)[2] << 16; + case 2: + pl_data |= ((u8 *)payload)[1] << 8; + case 1: + pl_data |= ((u8 *)payload)[0]; + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + break; + } +} + +static void samsung_dsim_write_ph_to_sfr_fifo(struct samsung_dsi *dsim, + void *header, bool use_lpm) +{ + u32 pkthdr; + + pkthdr = PKTHDR_SET_DATA1(((u8 *)header)[2]) | /* WC MSB */ + PKTHDR_SET_DATA0(((u8 *)header)[1]) | /* WC LSB */ + PKTHDR_SET_DI(((u8 *)header)[0]); /* Data ID */ + + samsung_dsim_write(dsim, DSIM_PKTHDR_REG, pkthdr); +} + +static int samsung_dsim_read_pl_from_sfr_fifo(struct samsung_dsi *dsim, + void *payload, size_t length) +{ + u8 data_type; + u16 word_count = 0; + u32 fifoctrl, ph, pl; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + if (WARN_ON(fifoctrl & FIFOCTRL_EMPTYRX)) + return -EINVAL; + + ph = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + data_type = PKTHDR_GET_DT(ph); + switch (data_type) { + case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: + dev_err(dsim->device->dev, "peripheral report error: (0-7)%x, (8-15)%x\n", + PKTHDR_GET_DATA0(ph), PKTHDR_GET_DATA1(ph)); + return -EPROTO; + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE: + if (!WARN_ON(length < 2)) { + ((u8 *)payload)[1] = PKTHDR_GET_DATA1(ph); + word_count++; + } + fallthrough; + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: + ((u8 *)payload)[0] = PKTHDR_GET_DATA0(ph); + word_count++; + length = word_count; + break; + case MIPI_DSI_RX_DCS_LONG_READ_RESPONSE: + case MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE: + word_count = PKTHDR_GET_WC(ph); + if (word_count > length) { + dev_err(dsim->device->dev, "invalid receive buffer length\n"); + return -EINVAL; + } + + length = word_count; + + while (word_count >= 4) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + ((u8 *)payload)[0] = pl & 0xff; + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + ((u8 *)payload)[3] = (pl >> 24) & 0xff; + payload += 4; + word_count -= 4; + } + + if (word_count > 0) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + + switch (word_count) { + case 3: + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + case 2: + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + case 1: + ((u8 *)payload)[0] = pl & 0xff; + break; + } + } + + break; + default: + return -EINVAL; + } + + return length; +} + +static void samsung_dsi_init_fifo_pointers(struct samsung_dsi *dsim) +{ + u32 fifoctrl, fifo_ptrs; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + fifo_ptrs = FIFOCTRL_NINITRX | + FIFOCTRL_NINITSFR | + FIFOCTRL_NINITI80 | + FIFOCTRL_NINITSUB | + FIFOCTRL_NINITMAIN; + + fifoctrl &= ~fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); + + fifoctrl |= fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); +} + +static void samsung_dsi_config_clkctrl(struct samsung_dsi *dsim) +{ + u32 clkctrl = 0, data_lanes_en; + u64 byte_clk, esc_prescaler; + + clkctrl |= DSIM_TX_REQUEST_HSCLK; + + /* using 1.5Gbps PHY */ + clkctrl |= CLKCTRL_DPHY_SEL_1P5G; + clkctrl |= DSIM_ESC_CLKEN; + clkctrl &= ~CLKCTRL_PLLBYPASS; + clkctrl |= CLKCTRL_BYTECLKSRC_DPHY_PLL; + clkctrl |= DSIM_BYTE_CLKEN; + + data_lanes_en = (0x1 << dsim->lanes) - 1; + clkctrl |= CLKCTRL_SET_LANEESCCLKEN(0x1 | data_lanes_en << 1); + + /* calculate esc prescaler from byte clock: + * EscClk = ByteClk / EscPrescaler; + */ + byte_clk = dsim->bit_clk >> 3; + esc_prescaler = DIV_ROUND_UP_ULL(byte_clk, MAX_ESC_CLK_FREQ); + + clkctrl |= CLKCTRL_SET_ESCPRESCALER(esc_prescaler); + + debug("DSIM clkctrl 0x%x\n", clkctrl); + + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, clkctrl); +} + +static void samsung_dsi_set_standby(struct samsung_dsi *dsim, bool standby) +{ + u32 mdresol = 0; + + mdresol = samsung_dsim_read(dsim, DSIM_MDRESOL_REG); + + if (standby) + mdresol |= DSIM_MAIN_STAND_BY; + else + mdresol &= ~DSIM_MAIN_STAND_BY; + + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); +} + +static void samsung_dsi_disable_clock(struct samsung_dsi *dsim) +{ + u32 reg; + + reg = samsung_dsim_read(dsim, DSIM_CLKCTRL_REG); + reg &= ~(DSIM_LANE_ESC_CLK_EN_CLK | DSIM_LANE_ESC_CLK_EN_DATA_MASK | + DSIM_ESC_CLKEN | DSIM_BYTE_CLKEN); + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, reg); + + reg = samsung_dsim_read(dsim, DSIM_PLLCTRL_REG); + reg &= ~DSIM_PLL_EN; + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, reg); +} + +static inline struct samsung_dsi *host_to_dsi(struct mipi_dsi_host *host) +{ + return container_of(host, struct samsung_dsi, dsi_host); +} + +static int samsung_dsi_bridge_clk_set(struct samsung_dsi *dsim_host) +{ + int bpp; + unsigned long pix_clk, bit_clk; + unsigned long fin, fout; + u8 p, s; + u16 m; + + bpp = mipi_dsi_pixel_format_to_bpp(dsim_host->format); + if (bpp < 0) + return -EINVAL; + + pix_clk = dsim_host->timings.pixelclock.typ; + bit_clk = DIV_ROUND_UP_ULL(pix_clk * bpp, dsim_host->lanes); + + dsim_host->pix_clk = DIV_ROUND_UP_ULL(pix_clk, 1000); + dsim_host->bit_clk = DIV_ROUND_UP_ULL(bit_clk, 1000); + + fout = dsim_host->bit_clk; + fin = clk_get_rate(&dsim_host->sclk_mipi); + if (fin == 0) { + log_err("Error: DSI PHY reference clock is disabled\n"); + return -EINVAL; + } + + fout = samsung_dsim_pll_find_pms(dsim_host, fin, bit_clk, &p, &m, &s); + if (!fout) { + log_err("failed to find PLL PMS for requested frequency\n"); + return -EINVAL; + } + dsim_host->pms = PLLCTRL_SET_P(p) | PLLCTRL_SET_M(m) | + PLLCTRL_SET_S(s); + dsim_host->hs_clock = fout; + + debug("%s: bitclk %llu pixclk %llu pms 0x%x\n", __func__, + dsim_host->bit_clk, dsim_host->pix_clk, dsim_host->pms); + + return 0; +} + +static int samsung_dsi_bridge_prepare(struct samsung_dsi *dsim_host) +{ + int ret; + + /* At this moment, the dsim bridge's preceding encoder has + * already been enabled. So the dsim can be configed here + */ + + /* config main display mode */ + samsung_dsi_set_main_mode(dsim_host); + + /* config dsim dpi */ + samsung_dsi_config_dpi(dsim_host); + + /* config dsim pll */ + ret = samsung_dsi_config_pll(dsim_host); + if (ret) { + log_err("dsim pll config failed: %d\n", ret); + return ret; + } + + /* config dphy timings */ + samsung_dsi_config_dphy(dsim_host); + + samsung_dsi_init_fifo_pointers(dsim_host); + + /* config esc clock, byte clock and etc */ + samsung_dsi_config_clkctrl(dsim_host); + + return 0; +} + +static int samsung_dsi_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *device) +{ + struct samsung_dsi *dsi = host_to_dsi(host); + + if (!device->lanes || device->lanes > dsi->max_data_lanes) { + log_err("invalid data lanes number\n"); + return -EINVAL; + } + + if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO) || + !((device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) || + (device->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))) { + log_err("unsupported dsi mode\n"); + return -EINVAL; + } + + if (device->format != MIPI_DSI_FMT_RGB888 && + device->format != MIPI_DSI_FMT_RGB565 && + device->format != MIPI_DSI_FMT_RGB666 && + device->format != MIPI_DSI_FMT_RGB666_PACKED) { + log_err("unsupported pixel format: %#x\n", device->format); + return -EINVAL; + } + + dsi->lanes = device->lanes; + dsi->channel = device->channel; + dsi->format = device->format; + dsi->mode_flags = device->mode_flags; + + debug("lanes %u, channel %u, format 0x%x, mode_flags 0x%lx\n", dsi->lanes, + dsi->channel, dsi->format, dsi->mode_flags); + + samsung_dsi_bridge_clk_set(dsi); + samsung_dsi_bridge_prepare(dsi); + + return 0; +} + +static ssize_t samsung_dsi_host_transfer(struct mipi_dsi_host *host, + const struct mipi_dsi_msg *msg) +{ + struct samsung_dsi *dsim = host_to_dsi(host); + int ret, nb_bytes; + bool use_lpm; + struct mipi_dsi_packet packet; + + ret = mipi_dsi_create_packet(&packet, msg); + if (ret) { + dev_err(dsim->device->dev, "failed to create dsi packet: %d\n", ret); + return ret; + } + + /* config LPM for CMD TX */ + use_lpm = msg->flags & MIPI_DSI_MSG_USE_LPM ? true : false; + samsung_dsi_config_cmd_lpm(dsim, use_lpm); + + if (packet.payload_length) { /* Long Packet case */ + /* write packet payload */ + samsung_dsim_write_pl_to_sfr_fifo(dsim, packet.payload, + packet.payload_length); + + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, packet.header, use_lpm); + + ret = samsung_dsi_wait_for_pkt_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait tx done timeout!\n"); + return -EBUSY; + } + } else { + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, packet.header, use_lpm); + + ret = samsung_dsi_wait_for_hdr_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait pkthdr tx done time out\n"); + return -EBUSY; + } + } + + /* read packet payload */ + if (unlikely(msg->rx_buf)) { + ret = samsung_dsi_wait_for_rx_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait rx done time out\n"); + return -EBUSY; + } + + ret = samsung_dsim_read_pl_from_sfr_fifo(dsim, msg->rx_buf, + msg->rx_len); + if (ret < 0) + return ret; + nb_bytes = msg->rx_len; + } else { + nb_bytes = packet.size; + } + + return nb_bytes; +} + +static const struct mipi_dsi_host_ops samsung_dsi_host_ops = { + .attach = samsung_dsi_host_attach, + .transfer = samsung_dsi_host_transfer, +}; + +static int samsung_dsi_init(struct udevice *dev, + struct mipi_dsi_device *device, + struct display_timing *timings, + unsigned int max_data_lanes, + const struct mipi_dsi_phy_ops *phy_ops) +{ + struct samsung_dsi *dsi = dev_get_priv(dev); + struct udevice *dsi_bridge = device->dev; + enum samsung_dsim_type hw_type = (enum samsung_dsim_type)dev_get_driver_data(dsi_bridge); + + dsi->max_data_lanes = max_data_lanes; + dsi->device = device; + dsi->dsi_host.ops = &samsung_dsi_host_ops; + dsi->driver_data = samsung_dsim_types[hw_type]; + device->host = &dsi->dsi_host; + + dsi->reg_base = (void *)dev_read_addr(device->dev); + if ((fdt_addr_t)dsi->reg_base == FDT_ADDR_T_NONE) { + dev_err(device->dev, "dsi dt register address error\n"); + return -EINVAL; + } + + dsi->timings = *timings; + + return 0; +} + +static int samsung_dsi_enable(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* enable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, true); + + return 0; +} + +static int samsung_dsi_disable(struct udevice *dev) +{ + u32 intsrc; + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* disable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, false); + + /* disable esc clock & byte clock & dsim pll */ + samsung_dsi_disable_clock(dsim_host); + + /* Clear all intsrc */ + intsrc = samsung_dsim_read(dsim_host, DSIM_INTSRC_REG); + samsung_dsim_write(dsim_host, DSIM_INTSRC_REG, intsrc); + + return 0; +} + +struct dsi_host_ops samsung_dsi_ops = { + .init = samsung_dsi_init, + .enable = samsung_dsi_enable, + .disable = samsung_dsi_disable, +}; + +static int samsung_dsi_probe(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + int ret; + + ret = clk_get_by_name(dev, "sclk_mipi", &dsim_host->sclk_mipi); + if (ret) + debug("Failed to get sclk_mipi clock\n"); + + return ret; +} + +static const struct udevice_id samsung_dsi_ids[] = { + { .compatible = "samsung,sec-mipi-dsi" }, + { } +}; + +U_BOOT_DRIVER(samsung_dsi) = { + .name = "samsung_dsi", + .id = UCLASS_DSI_HOST, + .of_match = samsung_dsi_ids, + .probe = samsung_dsi_probe, + .remove = samsung_dsi_disable, + .ops = &samsung_dsi_ops, + .priv_auto = sizeof(struct samsung_dsi), +}; diff --git a/drivers/video/bridge/samsung-dsim.c b/drivers/video/bridge/samsung-dsim.c new file mode 100644 index 0000000000..986f1d8308 --- /dev/null +++ b/drivers/video/bridge/samsung-dsim.c @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2019 NXP + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "samsung-dsim.h" + +struct samsung_dsim_priv { + struct mipi_dsi_device device; + void __iomem *base; + struct udevice *panel; + struct udevice *dsi_host; +}; + +static int samsung_dsim_attach(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + struct mipi_dsi_device *device = &priv->device; + struct mipi_dsi_panel_plat *mplat; + struct display_timing timings; + int ret; + + priv->panel = video_link_get_next_device(dev); + if (!priv->panel || device_get_uclass_id(priv->panel) != UCLASS_PANEL) { + dev_err(dev, "get panel device error\n"); + return -ENODEV; + } + + mplat = dev_get_plat(priv->panel); + mplat->device = &priv->device; + + ret = video_link_get_display_timings(&timings); + if (ret) { + dev_err(dev, "decode display timing error %d\n", ret); + return ret; + } + + ret = uclass_get_device(UCLASS_DSI_HOST, 0, &priv->dsi_host); + if (ret) { + dev_err(dev, "No video dsi host detected %d\n", ret); + return ret; + } + + /* allow to use the compatible */ + device->dev = dev; + ret = dsi_host_init(priv->dsi_host, device, &timings, 4, + NULL); + if (ret) { + dev_err(dev, "failed to initialize mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_set_backlight(struct udevice *dev, int percent) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + int ret; + + ret = panel_enable_backlight(priv->panel); + if (ret) { + dev_err(dev, "panel %s enable backlight error %d\n", + priv->panel->name, ret); + return ret; + } + + ret = dsi_host_enable(priv->dsi_host); + if (ret) { + dev_err(dev, "failed to enable mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_probe(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + struct mipi_dsi_device *device = &priv->device; + + device->dev = dev; + + return 0; +} + +static int samsung_dsim_remove(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + int ret; + + if (priv->panel) + device_remove(priv->panel, DM_REMOVE_NORMAL); + + ret = dsi_host_disable(priv->dsi_host); + if (ret) { + dev_err(dev, "failed to enable mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_check_timing(struct udevice *dev, struct display_timing *timings) +{ + timings->flags &= ~DISPLAY_FLAGS_DE_HIGH; + return 0; +} + +struct video_bridge_ops samsung_dsim_ops = { + .attach = samsung_dsim_attach, + .set_backlight = samsung_dsim_set_backlight, + .check_timing = samsung_dsim_check_timing, +}; + +static const struct udevice_id samsung_dsim_ids[] = { + { .compatible = "fsl,imx8mm-mipi-dsim", .data = DSIM_TYPE_IMX8MM }, + { .compatible = "fsl,imx8mn-mipi-dsim", .data = DSIM_TYPE_IMX8MM }, + { } +}; + +U_BOOT_DRIVER(samsung_dsim) = { + .name = "samsung_dsim", + .id = UCLASS_VIDEO_BRIDGE, + .of_match = samsung_dsim_ids, + .bind = dm_scan_fdt_dev, + .remove = samsung_dsim_remove, + .probe = samsung_dsim_probe, + .ops = &samsung_dsim_ops, + .priv_auto = sizeof(struct samsung_dsim_priv), +}; diff --git a/drivers/video/bridge/samsung-dsim.h b/drivers/video/bridge/samsung-dsim.h new file mode 100644 index 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 Sun Jul 14 11:33:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3305 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 8FE4340F88 for ; Sun, 14 Jul 2024 13:33:35 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-57c93227bbesf3252121a12.3 for ; Sun, 14 Jul 2024 04:33:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956815; cv=pass; d=google.com; s=arc-20160816; b=09I0v5OdR4z0l9OhliT8+sVNr9XZycaFTvMBTeVVejGzIZSrFFcUdmn+E6cQ60miGL QOTCd63VKP81y5/JBr1bBl9oidVoHzuF7QPyIQRoGkcQrkqc992Q5Tpf0JFd5Ezln5yF TdsSc5MpW0UI1BezdikoqaCXOvzQOykIUYFi4Ynz+7CLcPcZI2hrLkAD6/R9GpiLgYhU 2/SyJOAr1qkoaJRMTfTq07y184B0ziPiW180fXA19SRE+MRg8o9aJ8ePEKkGAnKQWDdu QnHwZgT+JfJZpF4YFmLSj7oRKNffZeCg85UJ5fcdvc6sPiK305RbGpRFB+nMDchhg+6h h5NQ== 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=DwVh11bjzEDosyxn7dMfcWhBizwJlCEdC75mbJUHpzA=; b=IZHWEBQ5arqAVjgTXJIh3Ov6jw1cw/MQybaXr3/STKByvzgnmvPRiNcXN2w/FfS7H/ oUdFblaeDjmGGqknsC2wCdmm3QNwsyAK355njSenTfrw/305uwJj8RncytD0vSYk3h0f sUUyYPbw4KNB2VgtH+oEtumvXAvawaCk103dQNXQCFnkgmkkeOhJDC5zUsCSHLHyBl10 XsDDnl2G79BHvhb+RP8Xc+TQfoXmbfwPSs/E3hdAVmS/UXape0TyIOpvKSKZeK16MHlB c8Phzn+oYYWKfC/rGMlqdW/a8o4Rs+h9Sb/YYlXpYEWV7OwwOJBtDga8rJ4eRDJFf8Af Ny+g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UjvjEpHt; 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=1720956815; x=1721561615; 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=Ga1GFSYMluysR+/F4sXybRQiSjdygK80uVeUlXxTS82AHIvMkixJoY8CDJ0sBPwzRg HXk4fSIvlgZogeLp58HYmpZsszHZG/dkDr+NObubFqP9xFA8HfedLBDQfn2TMTKdC1BQ uR31fQoqwqbGKuIfTGiLpCnLj9PHn0MZemflw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956815; x=1721561615; 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=c9WwcUy2V8BQmUKXnuDXXkztIpfueT6HMb8I4GdH2U16vyDWX/1Z7mbDvJsOWU8BTX YJonSmElV9PqvFhQGwSsJfrLxF94EX/sptnXXFNH0LoNUz+fAWmddcioAjhonRzbdtXn zp6o9UXPgYUBIahedUtoYT/EcG945ppbHgLu0NF4WERsiiw0QMge2mmknhiNje4Aue7d ax0XcoYJQOnl7bMSmlHQNzx0RRphNooopmTilZwuW1fb12gMb2bXbR6+B/z3O3Jq/Yd/ XmAFNt9sh0j4py9KgZ555rSDQXke6dIQTfnsKGAnCv2JlFeHbnKdqa6p9TeeMMpoaVuR gMAg== X-Forwarded-Encrypted: i=2; AJvYcCVq5qnpqH0DXFUwyVxAxoFlvGlXZYqrAe+MNT8Kgo3Psd2tDjw+L9G+o2wA8S0JDzvsJJCR9AsDilJyj83ixVb0thXhDvZpYxldLyXmwYB7eb+WLZscjePy1L9K2g== X-Gm-Message-State: AOJu0Yy/J0hyepwAdv9/rZY0mg9F4WFaUK72XSkDN2IZje+Hvx2NXt9H SXiCPHRQDWJKOgac+l6oPkBwQo82QVx/FZSzkupZJPchJIwJvkgOPg9x/mkQEd14sQ== X-Google-Smtp-Source: AGHT+IEBqqaEmTTvbfteGjrknbZR4eScEywzPgUv5moOLQ9v1M0X6D9GggQWS9N1Qxk7N4U+IpRilg== X-Received: by 2002:a05:6402:11c8:b0:57d:4cbc:cb59 with SMTP id 4fb4d7f45d1cf-594bb5807b8mr12591241a12.25.1720956815258; Sun, 14 Jul 2024 04:33:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c513:0:b0:57a:a655:87db with SMTP id 4fb4d7f45d1cf-5982622e1b5ls1550108a12.1.-pod-prod-09-eu; Sun, 14 Jul 2024 04:33:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4C/7A7Q4ZfGqgRR0D6Gsq67oAUGL9/n2W0KlvV8aH01QeGzYKyS4ML+3S9Z2C4dRqSOeIUTOjzxxXv/d85N9Z5dp+n/iMcEtQQshAn1i1XFqW X-Received: by 2002:a50:d513:0:b0:599:7a9c:37b0 with SMTP id 4fb4d7f45d1cf-5997a9c3c27mr4066087a12.35.1720956813550; Sun, 14 Jul 2024 04:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956813; cv=none; d=google.com; s=arc-20160816; b=NVIN592fO3fuTHKls8801YpDJ5iWOn5nBnyIywiVuUHT5/CMOcafRNpMQ44GoCCssf en99oaPg0TT/EEwLLlIOlaZdpCwbE5f0ihXenkAPa2dhdcXH+/COPJVqIaJCDLQsX1i+ i5S+GEAoQSpBToN5lPvLk+54z7adF/Fv4IgwNth2hhXcxJoDYi+LOhnLMLzXMkr9GMBh 0E7KQBJPjBsogwHEgspfdXb435E7m8zcQLA4tCbODxMjoiBzO+p3/P1X5PIQN4tflOk0 /vW3iqI+RokO53FZ4c7hD9zTnClmdI+zLts0+oeXGtgxVKfFMYnTgSlbc6XzS9L0y4IG vrng== 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=gMhZKipgTovb0fwtRQIRhzYEVbbb3AR5DZ9Rhf7Ddy4=; b=wLY0j6dF0DEmOVvdFPu3m1Jh3Z5199oYN3hakcOceI3HLNkenzVtN1lyO9EHPF+wLe 4yxw1xdLjdCIkEIKUsHzrwNW9sBAeAt/HsPZSYPAYaaXijkb5F4B5HjJpC67vAYIrPuh ETfSp/er3z2fVJnpOpgFtbh0V9VdDNwUDTgMdGcG8qlmC5xoubr2FQ2ZJpjZUKTbeNos 9ngb6s5U02PYk/8SE9CuKU2UClJuBTJ+7Whc53X3Xa1BnvrzBCXRByvWdhNC/RRyTUIb Tuv3x/4RnPiY9E4ElBoZI92b1+otrxt9Kb7bOTVSu1HSG4+GtShFsJMhRQcR8Kt0lHni GSZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UjvjEpHt; 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 4fb4d7f45d1cf-59b26a8f668sor438819a12.7.2024.07.14.04.33.33 for (Google Transport Security); Sun, 14 Jul 2024 04:33: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; AJvYcCVchVX84CtBUZbGAnAlzoNi2jgK9QQczwJwmxvX+vfAiOE2JNqifzoDRqw7xQs5I7KFx6AAqKvqnQjChN3H3s9bRT8uzLo/4uw9HwQYhQ3LqwOT X-Received: by 2002:a05:6402:5cd:b0:57c:fd20:352c with SMTP id 4fb4d7f45d1cf-594bc7c8337mr12369020a12.34.1720956813147; Sun, 14 Jul 2024 04:33:33 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:32 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 24/25] video: Add Synaptics R63353 panel driver Date: Sun, 14 Jul 2024 13:33:01 +0200 Message-ID: <20240714113302.133399-24-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=UjvjEpHt; 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 Sun Jul 14 11:33:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3307 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id A157B4135D for ; Sun, 14 Jul 2024 13:33:36 +0200 (CEST) Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2eebdfcb63esf35460241fa.2 for ; Sun, 14 Jul 2024 04:33:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956816; cv=pass; d=google.com; s=arc-20160816; b=g9U6OQAPTKLd304w10AcvcdD+dX6KauxXiBKXftXtfLUQB9McRiKRNPP3kTFJ+sAtO 3MRlizNKjGYSqnIeKQEyFl8N3eHEt+JAhiXaG2thWyR+w9D6w9ramHHPG3Ijz5W4K1Me 9jJAYvU+smKkX6MsaqWXVnXBObGt0DvDuHZYvD/zxOAk+HvU9IAumwpwJrHfP0b4/ddl dLtfFkj5NIrUpBulLGD6Rw2N2Ro3bJGmEST5rMHAfNcRFFXmdlzLh+Cp89+jvFXrxkCj aLUS10kdrvyXT+TdhQFCVde3OxvxC/0HuugxpLXhgSc9yYv28GBk/DL99ELWWvH/0Bg6 mAaA== 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=vcwAN8fzM+a8Z628vbIGjWyKX5HpMIVBHG9EeQug1dk=; b=AQq7CozEFhygKAGAOumS/PUpGVelsKq503Jyv2UQ1LDwFxTXD4InBBi42JkIAkPtAQ yCM0G38Pg7IXncBfdMd9t++IeZxUM0cAvodfCE6HUv2euAv4GSg9zT/PrT5DDSPJgsUd 0RbhuiP+o2S8ljn0IEb9PcAfE1HPVM9V0PHPYG34+vwqoDzYi14etCXC4K3c9d1m06I1 XqjzwXm2nP2dxC0Ay9QJAVPNPcTZsUDXLKOgIv0qkhkYyt5yKL+F3/L+QVyn5g/tB6Ei c7pIrRqtpkEw30LLTeB9/M417SUrZ2yJV+/d2VA4/zI6b2jiVB2MLzbRDUNpXKrIGgol QgGw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HEuifgtX; 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=1720956816; x=1721561616; 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=c+ZPmhqX7gNvn16N5e55fdSPmJtYq5hQIEz+VOAdq10yT6wLB+dYiBPEjmrc0kvFaN JsdmL5GYWVf4WT5e5pzUAkaauk8QZJXMTGduu51zRSTYnPQJIMydEGKdEzCT7/cjipZY zB0221YCpKVNK1OySzKuotclL2a/9MD6BwVlg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956816; x=1721561616; 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=izvQ4raqRyBXYykeXYBgf4jUYMkhBUmRLKWqLi79eln2VKf71cDWNuehsGHVgVr3DI kVD0SEDMRiqkcAwe4iRqMLXl7KOpSMcPQt7r7m69pxM8yFhhdSkMVNg6hIMK+RHEaazw yPUTC9dydUWKVq25aeH103YkNzUBp1vZZGrCYXMWCGNGvugiFiDovcwOfQq/VDmveaPq jjKra9HyKh4I1hRloOrQ+tPKkpRSbMz0cS51klLIcwgxHEcnfsM3+36ONAuK3BgxfuZy yaMwrtHN+yVlr+WSMb+OgvtrODU9x7petDpLWICBg5IomKIYs9EV2CFL2Y0iv2UxK50s C2Dw== X-Forwarded-Encrypted: i=2; AJvYcCVIhJIiLFpopI91jx0ABcXEAUBw9UldRPdpIdqHdJDcDgoJnO1FoGPBmS8k2yGYLcBdLlZNtg9xkvyEjzUFx1bafwvHBBko8ZNjc3vZV2WdOr60iz1yCNbzwR4SHw== X-Gm-Message-State: AOJu0YyTKDUoRuGVP85KGoF22bpSiTMxh7M3WejJmJ3Q7BJTFJTA4hwI zgkb679iSnzlF0caS5nyG0uddGgs33RRyP0kEPEA48yP2iZdDqNXSl35rsSqiegycQ== X-Google-Smtp-Source: AGHT+IGlz0RD6R9xCjULHwiH35/y0QAxbjgWUE3TZY/hNqbceAsFTZK01qopt0TpE6e1yc/2Kk4dHg== X-Received: by 2002:a2e:9201:0:b0:2ee:4dc6:fe28 with SMTP id 38308e7fff4ca-2eeb3171703mr95294861fa.40.1720956816097; Sun, 14 Jul 2024 04:33:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c513:0:b0:57a:a655:87db with SMTP id 4fb4d7f45d1cf-5982622e1b5ls1550111a12.1.-pod-prod-09-eu; Sun, 14 Jul 2024 04:33:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWpBb+lsGPKw6UxgIWbQLNvX/5BeUAkUz1XUYJzmCtLKuzmD86HZ9ciIy94IlLiQ96qisv0IaNxkOIFoVA6hGyyGUlb9dAJXYicesqyrJaUYRg3 X-Received: by 2002:a05:6402:350b:b0:58d:b529:7dc2 with SMTP id 4fb4d7f45d1cf-594b7d836d2mr12915562a12.0.1720956814489; Sun, 14 Jul 2024 04:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956814; cv=none; d=google.com; s=arc-20160816; b=QWKL4R0hABgQAqfH6f+aGjQpeVd1E1NLaqfXIucUbzJ7K8e35/iRVDMRGT2WwC9KEn x1dZQS+6A9NeBaCJYIcZjNh9alwerHWjkHb0BNhPnooPEyswQXMfxrYQZ8w4jelmGkES PfKphh1b2gelQgW4B7WIiTCZ19sddRr6wZL895Xjee4eKHunb39SdzvebUvhqVIEe8e8 qFgLtSZlaSBDpEXZxVYH6zvr1rc3LsXb2ln50XMJrVahOw1/6yhF2/WNXI6sGR9E9gKd 6z3ZIqXrRRPfjfFXoz4monm1XhzP3nSemICk+uASwKbATMvkxnFwuwTkhuf7Fh0EmgsU 5ctQ== 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=hySNFwGvA6kzEwV4udksYduLNkEzhnD3jwf5LsEFvAU=; b=tUNh1gaGllnlN3uprIuVEJVJlwpkaenmk2r/4A5C341lnJIiK2KIPDZ0+FTjvBZaC/ 3W9Xgu7AYFZZKmnomLySjrGXAAFi6B719bS9Mrq3ZfJGDE2apTdcyp1WOOgB0juImf8Q tHLkcey/orQhstWytWQFkhMkLQByOV0+OB3PObpKE+0vNb/cgz0Yfv8NiVoD01AikyQA tUfSwZyD2VOqIkrp1U9Uomhf+Ez1v+yHmpyqxdgSd2dIXm4ZjJNWnKkHwPuyNS1aPCG4 d8XWJ/teuZINfLvMODJSUoahTOX1ttuIDMqFfG6PZMbDcE9c4It3UN2AsACtaTi4v/4H xRZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HEuifgtX; 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 4fb4d7f45d1cf-59b2705aaafsor551947a12.10.2024.07.14.04.33.34 for (Google Transport Security); Sun, 14 Jul 2024 04:33: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; AJvYcCWt9npdvzE0N+98bS2o8f6QzyIHyjLtGyG2SK3wV+qnB2e83CSjXKdBNrs91OwU062NJbo2KG+qYTLF9yOuxJoL9YM1WzX1ZfhYIF6bz6fmboI/ X-Received: by 2002:a05:6402:909:b0:58c:4c8d:68c with SMTP id 4fb4d7f45d1cf-594bc7c8321mr12613849a12.26.1720956814152; Sun, 14 Jul 2024 04:33:34 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:33 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 25/25] arm: imx8mn-bsh-smm-s2pro: Enable display on reference design Date: Sun, 14 Jul 2024 13:33:02 +0200 Message-ID: <20240714113302.133399-25-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=HEuifgtX; 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