From patchwork Sun Jul 14 07:09: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: 3233 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 9823440F59 for ; Sun, 14 Jul 2024 09:10:29 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-57851ae6090sf3203633a12.3 for ; Sun, 14 Jul 2024 00:10:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941029; cv=pass; d=google.com; s=arc-20160816; b=j4Wrpu4azccgcFD5epTQyYYtaqDoTqOnWl9GpG7ZSCj8kyoNMDnP+j6S7XyYSXfvHw sJOVXUHHvUPHMZQjRCKtzaOvkm33esuyQjxB4xW0aA8UlymafvuS5jFP5CRwbitcRjK6 RGqtkAXXqmVPZjsel0wU5f0CG4k5/auC337J98UvjBo7QWOhgpcEQJSMj/WyTuml6ME4 3h7L4oumZjVAjubPdVxR0tUJy9y2kx75ybjumqDkk1awMnjQD6twY+rRsQiQEodX9Pga KCcQIfKzRaI45PVy+3kXj4V+kcUf7+G0UNHfR8rjtcvs6TUVcx6eQnPon4OhJ/yjFrny PwdQ== 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=YqNG1tBisBysDcce+YjATakUIo4qzDBrh+6kVxpi+3E=; b=clauItbEwShYqQL6m94R0TMK59DdI3QbFr2arps8adviWLZ80SFXlfY9lWiQWvZAlz JaFg58eBshoC3jAcRXGSEfLCxg68HqFr5FGKWQsd3qRwawJiFTaNL7c2QvkP79KO1pbO rrA+LyC6ojOjYGDyx6A+SEQ0QQdXwMbqBm0Ro6JZWC5F3gYYUVSgIq1wMyp0yNQE5WZP Y2Z8t1zwXVag5n0nCRfEgVBrV3h3FguW21YcUUY/Ttg1qd2oWVQms0FkA30R5UCVSBrn lOj9JB3U+203VQN4x7ZncWhms8U92IHsATQCNLWqOzKUr3GslBBxx1U7GfPDcLpdD9md P8dw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HUDi5hJ8; 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=1720941029; x=1721545829; 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=TUKaFwn2lQJDG0/4bRDxCG+flzEzj7u5Isrt5TmWofOceue6c2GqxVnJZ7BAN7FZy9 lyd5GoG4OpUisW8uxyBPtH/sIPn6GdoTOrGKwXqkYedy9f1d2ZSlgkXRigX9O7Fdbp6g AaDrkwLtajusXWrngHABNx1lx1g71CUCdy8Tg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941029; x=1721545829; 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=OO8S6qgisFsnF7klm0xxi1Gg89ypdbs54kzjoWsaj1ACo4WwaXPMI15O7mjoIcgnU4 yfsJJMC9Ow+2GytcSVka4mUin+oJCZ77LBh2ZbYdajnrIOV7wQv7C4k5weccdnfTjoSj Kn2L7SwJ4Y77EVykIbpOzoVIvoe88oNUjDJgvvgCWGzsF8lrxaTbp+z8HlwNUCucz4Ke 7lY98KH8Vb+rjrZwXS49hUGrN3laEz2Y6/+SB9pHBUKC4U9PfW7MUNTQniQt9y+Kvi1u ZlomT9CbBPBSDrbp5OYwDj/TNNmvewZTHzyjduhdiGFicHOL2IRJ3+d+9Jc4Ky6l4XRo D7Zg== X-Forwarded-Encrypted: i=2; AJvYcCX45vXI5PbbbFNwwy53SZiHEjiyAY4zOZf5oldBBMFsPC6MfJZBssuScoxdMZibXiMlss9U72XeT/FjFwF+HRUuCIBfOPVYjRxny5gVG3pjUQ7s3/rjuFLFaOmsow== X-Gm-Message-State: AOJu0YxFSpTBvJnB0eAipuXrLOYfSRNEyFdkDgv6QaAPqRlz/sh2PrCd ihZO5ci21/gFZSoqtbhX7/fZqxKgw/NXWdz14wQSCaB+fGRhjn3EaTwKSvK0IsvjFabv96RDew= = X-Google-Smtp-Source: AGHT+IEu/LO6318LXbJ+C7G7TPEt4Mu2RCzX4oAYJrgJUIS2EFIgfWEhMrUMiT48TQpRCA6rQQFngw== X-Received: by 2002:aa7:da54:0:b0:57d:ef3:c3b7 with SMTP id 4fb4d7f45d1cf-594bbe2ba17mr9474903a12.36.1720941028732; Sun, 14 Jul 2024 00:10:28 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35d4 with SMTP id 4fb4d7f45d1cf-59821cb697bls1605454a12.0.-pod-prod-01-eu; Sun, 14 Jul 2024 00:10:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWiDz5cv+LHgsCzagJkOREF2cKuEuH/w8+i8kgn0BomWOIm5g09h9m+FPyjwXMOdggi62Nm7gHBXLZcjZMtKASYwM3YaUETj5Dum7HMM+2JlsMe X-Received: by 2002:a17:907:7e83:b0:a72:80b8:ba64 with SMTP id a640c23a62f3a-a780b6b20b0mr1190636966b.25.1720941026849; Sun, 14 Jul 2024 00:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941026; cv=none; d=google.com; s=arc-20160816; b=HLqwxCrweMTIL9VjaVsyEmpHdQNxY9wKT+AlFgZTxfTAvidSkgPAHAIknQ1msi64HD BIOMmyxn/wqFFgCGpk6vrx8yiPUyuDvu976HSG9ruPKWGvIssII8BXvB5agHjKuSmmV0 F4a8j98AE03f4Dk1ZGpU1O/9kKR6Y9OnnjmfY6KFrXki6zuvzlh+Fma+Fgh84JTPQxlW zMRJdPzVv2DL8Vo0t6IcyBRABzWR3hJ1OhBdIuxZ/xTETyC2UR67xbDggbihZLPLcmjH HHa/90tpaR0qoNQE/foicgizxGBs6GJ3PQvX3KMyML147L2qDyPCYQjUkOcgu+nyNmv8 lC7g== 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=nQEn8a+3c9EWRp/tFwgeplNZ21kduKtST31RkxU0yqk=; b=xwQL3/TjGOV5LH/ZBN/BeGpaKMQfKx/Iom1zemmqQSmgtDCpJZZWCm6chHzuxdQIEw NyO4faAwcRD7O5M+y3Gnaf8YgYES+clPz33EjIxgZrr0eVRgtmNt6NmTn+kOOJu0GLap J2WTWvg4DJVTf+kPvj2JE7cKaiClcPFIDrBxdx9c4DKUbhH9UAuclw9hBmWPNbJF1HWf F2wYp49vo8AMnongtUpfglaaeN8KGBilQ5f1oUog16x1MXggKAJOme4Nt1lmJ6tU2eYQ 13w/IK6otiY/Mk8Vy0DSSjWX889o18j6UsnjfQCU5fC7zAGWWsPoBgop0pSk5b2kdI/B 0Q2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HUDi5hJ8; 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-a79bc95978asor42300166b.16.2024.07.14.00.10.26 for (Google Transport Security); Sun, 14 Jul 2024 00:10: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; AJvYcCW+LL6GgDj60WM++hi63R0z1PiAj65jg1qYJqcgYYnDuWEYlwWeap+Xsn0SmPK8IUtiNUW1mcM07mvEU0fM9LR9pS+e1hfgqsywuVADmjNYgIw/ X-Received: by 2002:a17:906:3e47:b0:a72:76c8:ef68 with SMTP id a640c23a62f3a-a780b89f574mr903311566b.69.1720941026233; Sun, 14 Jul 2024 00:10:26 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:25 -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 09:09:59 +0200 Message-ID: <20240714071023.10417-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=HUDi5hJ8; 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 07:10: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: 3234 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 6E93840F59 for ; Sun, 14 Jul 2024 09:10:32 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-59c1314940csf326804a12.3 for ; Sun, 14 Jul 2024 00:10:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941032; cv=pass; d=google.com; s=arc-20160816; b=A7wUpUQhmSRyJMCuwEMktNjEGEKCDjjfG5mUXzIbImtgbW46iCd5bMfFM5sfUCszA8 UN9gxt7vBy6jJySWI2YrR4WK/3z9J10Pxee0xDDYvFiuqyS47B/N9wbL1GHOAN0ojhnz OEVQw/Qx5NFKbTuMjOE+bz8Py1JfUUh05FTbn7i0D52sYvKeU2sFSayD5GnzN1ldX4F4 6JWHYJ62NKxrdmgZ2TT9FY014X+oWmz83Ew8mkXRvgRSpdc/P0xIeK94eNs1thT4F9bD Y7a3jc1mkcjRcW6lEBbJX9dN2CxPNDnLjb4Dtq69kOTS5o/fvce1QqeAz373O5g/nbKx 4eDw== 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=eN1899HDWnas0uLaO5NldEAakqVQwPC+O97I93AHQwU=; b=UXxlIHqialzKsP0gDBE6NZn4DkMSEkeyvtEyXZDB7U4FxCyzpQoUwy1HkyAz/1SjAh HcEifJQeNU9pTgtsjTKtRBNieO1ushKYAPvo72yfwAU0+MjdUKVpsBzXCIx69Wfc7kSR Xir978erYBgzZBvnkTuhDEpGMmtZzU0ZfBQbvPe/qYufATcvyRNgVyqoTSPa8cspvX3T H6UzCeDruR5rkatX5A6PvDXw0kx+bHTZA9OL5qU39xA9fJ7qNBqeP/JhmZ4V6tNXaarQ 49PjuHKA4l05O+dvR7E5B+fn6iDk8qea5blZQIDYJereYd4WOzhatszlEnFvsAVhh+wM yMmw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SG1Gz3iX; 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=1720941032; x=1721545832; 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=Z7ArH+cC9ZghJLLNxSgRwQrLfFIFmD4DJhx8oc2PK0jnlBygQZ4uKzcDWAmjp65c/n HOOTsC/iVFnEMkAubspUWYFeJ+TQwaxrZISUSbAY/CBo3tsHZoDSE8BKXzLOYh5p0I1d Zi3YCmU62wQEs+CIhWoHt22QN6RdrfZiXaNwg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941032; x=1721545832; 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=xDyOaQdKYxd1kMkZhbCE4icPvTOSD7GkLrSp5nivi66vF/wvxm8Z0PCnDtFyJYP9Mp /MarB2A77OPEAUNHfq/TVBoXcTNu4rkKGsz+7X6Ym045HcZC3EeU7hWxpqLu+dC1oHja DV+CwSWn+pPzkDbLnMf4psMj3XeUV55sTOFzZ/N/DH/WL9L/4VOsNMGyVkizgar3hfxS 2j5VzR5VOE6bNd0bFxNIy5OoHyZsFG3momLx+mJB2Jghp+t1px7bC9mzRz6YKPYi7EGG qtGA9BnjtmNQkTBA7w7B1jKRHdhzQAPrbmgBaB7n3q/l7TgEfQAP8bgNFi85Jyuwf6w7 zmXw== X-Forwarded-Encrypted: i=2; AJvYcCU1CT/ZCmICLpYaGQxFbTKw4HqV5oEDa9iZsuXDy5JZdbibimLug1gY18b/U8CRNPnsBniTZoYGmuAz1Ez0TmTWHLD7gnRTggWJsufkGQqpWPwZhN4JH05xbt+UnQ== X-Gm-Message-State: AOJu0YyTCyvFEmu5mHWHvDbklA0dXAKPdB93bjONg9SiELOhcO5BalzW BOutXMCY67jOWs8DoRk/3vTy1CnJU+ckQR7O7Hy0jl/3kXKApwIXX5uTy8QaJGKn/A== X-Google-Smtp-Source: AGHT+IFDim/3cu5VE3Y06uRl041BEgcaR1MOc1VhJoY4GkURbtxU/7XCe1BDRMW9KVXn+Nq8zwjJpQ== X-Received: by 2002:a50:fa8c:0:b0:57c:70b0:d541 with SMTP id 4fb4d7f45d1cf-594bb674a9amr10157452a12.20.1720941032160; Sun, 14 Jul 2024 00:10:32 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:df14:0:b0:58b:30e8:e88e with SMTP id 4fb4d7f45d1cf-5982612f083ls160260a12.2.-pod-prod-03-eu; Sun, 14 Jul 2024 00:10:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX8RtVOrp7tOPIe+Q1jfszz40TwpCmQP+0FPb5pEg5KbUGFgDYJsMcBwNyp6TYgkOld2J+cpruI5KZMnKZZWqAbj16TLWQpPdihlbOZc2jssXhW X-Received: by 2002:a17:906:31c1:b0:a77:cc6f:e791 with SMTP id a640c23a62f3a-a780b705299mr888686666b.38.1720941028426; Sun, 14 Jul 2024 00:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941028; cv=none; d=google.com; s=arc-20160816; b=LQ0uNoHeim/kXPfIJZR2XiNxnbXkr+H9izw2SFOOFVGvGsRqbWxyW7a6mPvuVDs5LZ +GQLl6+wUOo3PiW0HkaJeYhwJkjQSJ1HDGgWWPi67BUDIgHJBU6NKouoth8g8KA9Rrog UhWFEh4c9pW538VLe4pJ5WGAo6pGzdWnOgEcdOZR2eYYNh4inWhHAQrevz1Nde+WMX1b CVItIUo45NVT+4At8acMsdT/FcTDXNgmUxqmrv+111rND6jK1KLr3GtPU5tCvrK48TYX 0xtNmiElySVfLS/T5skxZfZ9Fk/R1YK1SYZ++TPWTNiCH4CmTZgQ7LSb2u7jDwskk3/Y T4qw== 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=HyMmLNgu2rgirGrEZU2Pkcv+LHgqkGCEXqry7kuRRE8=; b=PWeLyFw6tO/cDbVyoBju9mLbvDieRtf24HxaAwrWaWrNEpKa/Cr/6O2upCLlO4ZSI0 4R5/pbmoV8Y0Q4NjKfR9s08E362Xkr1pwSrxEagB8bUBl1FI9gfgEAEfrCZ+HCutAKHt FI8T8emArIqHgwdc5gvLr9k9TbLaufOmpGN8hac+gRgG8lAwis4HkmYAx4t9Eglq+JfV YAfRNHwIWeNaxiONdaMf9dRWboy29nzU5Oj5OpeiiBYoRQFPsehPkp+eEUlfWX0rlXni qfqQwzIV9WsVq7ZAeO2Yj8sKdD8iML02Cn80pliOqEiFdRWCzLcbB54Z5dpkoFlVwfbR ck7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SG1Gz3iX; 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-a79bc7cf083sor41167466b.13.2024.07.14.00.10.28 for (Google Transport Security); Sun, 14 Jul 2024 00:10: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; AJvYcCWuVmMe3W7x0x02THypSDFIkj/IUoXMYsACwebqEidqMTFwo3+QcMySPPxyZEm+UEyQbaKwqM0ImCdYAw+EEvj6Tn1bi9PumCPUvw8adLoiKlji X-Received: by 2002:a17:906:50c:b0:a77:c6c4:2bb7 with SMTP id a640c23a62f3a-a780b68a8c6mr1059812166b.1.1720941027998; Sun, 14 Jul 2024 00:10:27 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:26 -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 09:10:00 +0200 Message-ID: <20240714071023.10417-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=SG1Gz3iX; 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 07:10: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: 3235 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 308D6412C7 for ; Sun, 14 Jul 2024 09:10:32 +0200 (CEST) Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a77c539bfbcsf265992666b.1 for ; Sun, 14 Jul 2024 00:10:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941032; cv=pass; d=google.com; s=arc-20160816; b=W9UHAzJAc7EzTm+dg0qp1eOlQ2+9G5v+laCobH1rzBoyU+xHPN+yiB2UjaGeF6dSSw 0IWfW6nw0LsyEv96JuwUT/cwN6OqSargcf1BqeiykCAU3OnJhLzBKRaWqJrFEYE0od55 O1zMnfnkCVO3EPef59p+QIdsB0tCG9QIy41RkfPvWiRLo2EDX/Ck2xM4y+91geeAl8Tk nJoBHBw1SyCC1caai1No37u/3fEtobFLpZ+R/CRzmir2v8LI318OnCWakYg8+8Rdu+oB x0UV9Y+pS9b/Cqe+SSdmTHE1fIYE+pod6epmLkIQ639EEC5Bmw3/K4ok1on2hjRjw+8E IUjQ== 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=9KaV0EPVLbWnNJm2/3G9fOhi/c+j0RsiXb0Kq5vXC5Q=; b=QTKo1t1WmRTYAvu9RgljYphDyot6YDXbLj0v6o/ACt697uo7ZZpuAslUblMdWsm7mn YccqqksW0/mfNHdEDkZGqxs5BjORsjvx44NrRGSXfrHfAGZM4Hlg8+kwqvF5lfI3LdI0 w8sT/bnlNFomuM+Q5JshDWuDT1brBr8AjSnhMPmQbOM6Zbw/Vw58KIFEiQLljRK8Ebwk tRfwg3cG88bDqTyxBu6whynPqWhju1r/BR0ys5iM9iabSntGQgdQso5r5FhdkeZEa1Du FsrUQP1d21hkk4i9BDisBh2tBw6UYvO/jAWamsLokQwM9iYgd7vNRhzW8zpr7XVCHfgZ 955w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TWt6UBFi; 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=1720941032; x=1721545832; 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=Qfc1HgJEqRNkglPBtflK+8awbmPYLN1dRxfUC5H8U+r0UqcIB/uunFWGbayX0ZHfbQ uy7X1wAgfqsUIJNh+1/I4bStprUL3NhfcVAj5HLmoUAWBkA8qRObbi1Ub4yvN3Kg0U3u vwlvdVTouCLpWaAEylC7wpfcelaCpnkr2LMo0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941032; x=1721545832; 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=RCbp3nxJPYyOnL5LrXTXMS+TxbQZ+WEnaHIpOU61uVyW1VUoKGsSXz03ukIGFjAHlN izpNm0jLh4vY0244p04x1dbzphWPTSAsnq/vsRfgvYKTsiJkZmqXyP9NpMaKtgCVOBKN Ax3Xey48BbI1wdLtfR/5Pg5El61cbRUHHQUAuSvSEX/scOiEiUIeOMMkwpztj4rI/Fzk UL7k7L5J1AiJqbZWMyj+ULcgqMrqJUZLOPN5hwh5HBdRI/a3BysqRb2mZ1wfCF/MpGUF Rz/k0xGVdZ2qJckxp9iasNRcquXlg0UeHf/NRnMOMKIYZFO4S3YDAXwOS8Qdq99HhQT/ RQDA== X-Forwarded-Encrypted: i=2; AJvYcCVdHhE30z564FbyFRKyIs6LILmJiC+rvuDYL/UI9dAoho2zcnlgWpmlkcw9UY2KJE+D+h1ah8LhO2mmZcdVioJvU1U3Hrvx9u3tQWnIa3iamVa6tO0NNQ6dz02yXA== X-Gm-Message-State: AOJu0YyvVwz/c1cVUm2WTOI9Ei5zjZE+AtUPE7vQ+2HZQuHdVCnHPBCT GCnlun/ZpEbVSeBTFO2tux9Z9yzlpBXQjZQWToaot843Au2iE8G7gk1wDH75E4d/pDmI34OcMQ= = X-Google-Smtp-Source: AGHT+IFSQsO/8NUYfXKJgZEE+vLXs9BD1cfIq+69QXF2bEybx+CLR0x2S973szwxKjmaUsESkwORcg== X-Received: by 2002:a17:907:9808:b0:a6f:1036:98cf with SMTP id a640c23a62f3a-a780b88354emr1231526366b.54.1720941031548; Sun, 14 Jul 2024 00:10:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:32e:b0:58b:ce37:ebce with SMTP id 4fb4d7f45d1cf-59825c4211fls172578a12.1.-pod-prod-03-eu; Sun, 14 Jul 2024 00:10:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWA1QrXRvZp3phbh32iR7vxzHw5k69QyKAtgQFARXnwx2KH7h2VmX7jn8m31DSc9oa2VypV0eqMVUwV1BHRHlg7H3JixKzBug4d5pAYi5OmnaAL X-Received: by 2002:a17:907:7e94:b0:a77:a529:4457 with SMTP id a640c23a62f3a-a780b6b3611mr1363024666b.25.1720941029739; Sun, 14 Jul 2024 00:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941029; cv=none; d=google.com; s=arc-20160816; b=iEyefNamsMTUX3Ws79DD6UJf0xxjT+ngB2HUl0Wit+Q4sTd7mLMgVQzqxvSXcoWVwD 6zEw20f8Dk5Rpg4FhtZyfi5vNjeYNXu2+FXp76/GWIPmqTT12J1ogl2L6PnWe8SbY7ZD ZVmYYNS4fbfGcCOg1zZIug0cJHwWw2yytuH5xg9WS1TsovGiK/wVtV5E0el1xz8Ho696 G2ZBFHc4QBy8otk0e9Dv9UmKEufYgLxeJM67fRsv8zUl9xpsIOnYWgJ6mG8zSOQlskqn DbPP/eW05EMvlrwWAPBqST63+ABuNRb/SfN0djhNzUgyNHQs7qLiuMxxtNqN5Nqxmo3V 1lbQ== 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=3TDiE7YBLvdruLNWOXzOXfVH+mJoyNV27UnYjOLtUqg=; b=R5eaCaiVElMbTQ8THM0x7THCYsviMj8xICB/oYMBJTktqnJVwLbalBg+O7SsXmEgRI y5fYnn7PYaqnpN1gF/bKIw18SKJIqlb81jzx0tfdHp521/cGoMQnIJEjZhXu2ksmncYW r3gVUPpVdUuQvkvwm9vo0jaY3sM/j1v2hLMlzwTki6y5LzyUo/IXuuCMiff7GI8Z4ET4 D2J0zcPbUWMvm/pmeU2VIDum0bl1coa/tIK/Roof0POcSgAnoGrt7Fi2IDJOgv3fz7TM qRrsFlSI6KHxP14kpAgxdqKAVpo1ywvveQtFyOFOKhwngdVDC+a//GchvwJG0NaUnMCs BB3g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TWt6UBFi; 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-a79bc7fcd2csor38425066b.20.2024.07.14.00.10.29 for (Google Transport Security); Sun, 14 Jul 2024 00:10: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; AJvYcCUgGwVAav8hj7tX1Mu84yj5P8doVSy7NBM4T+MIvoIH79y0X+fnhRcWsL1NMAEdI3Vtr1oSL8KXO5/E7z6V0fx9C2kV8E8x4BOZE7xxlM6UZmhe X-Received: by 2002:a17:906:dc92:b0:a77:cc46:80f7 with SMTP id a640c23a62f3a-a780b6b3a9cmr1234853266b.28.1720941029170; Sun, 14 Jul 2024 00:10:29 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:28 -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 09:10:01 +0200 Message-ID: <20240714071023.10417-3-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=TWt6UBFi; 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 07:10: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: 3236 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 417784130C for ; Sun, 14 Jul 2024 09:10:33 +0200 (CEST) Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a7275e17256sf308264666b.0 for ; Sun, 14 Jul 2024 00:10:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941033; cv=pass; d=google.com; s=arc-20160816; b=u21yw2ZZPFM2gD2OuGZXfv3sqUJHxIVj63eOs3spx5MwltT/un6AHcq6tCWKgH8ftp rOiMcz+UTCzp7cY/It98p+NbpZjwgOhdFD/7OapV0QCZkUdQlKQHqI44mKquuizlLODP pScj9j9lXuQ29dnWBcxtzakXhvh2EjwkYhsZnjEMfHgj1sCa2XKsXw3Gcy9vOPeLECPy Ek8toq4Vj1ycsWFxp7TrWOozADdxIea7YnKHs/WzrsrydyBp+3LHUK5w+wKVdV+WXIXs kaJWHPV4R2dz5QGyd0jGTv3bdBN863JYgrV6LkKP0hegFR+WhgoGEjR8SaX0ddfw3zze skeQ== 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=gMGWmcktCdTOAu4L6i5jjy98uWSsS+5/xLYTWwyOYAc=; b=HyERbIc4cebT9TokmwxjbT0VJFGqlIovh6f8m5AQmAtsNLGqkv3qN1sfQGI7E9dhqJ 32Kt7WJDGdEU+6IKFH4biStMFhrn7AHzPpX+6DqGr2enZ/CiDLKxQiQX6hr0sypuqv6s CFlRZ+dxV3gYaEleljbjWjENa9lZ1IbkGK4Q5Wr+uIAVwnxPl6MKGitUAKuQNl6RuWu8 tVw7dWUkvPW3kzdZIB+x7R81s8NH1aHuumHUDPsYet4CFDDla5Ix01zYOvJMz+mFMB/X 1eJdf1LiIebTPR6KFTobku4jJLTYZXfq6ruMAjZ3j/0WwlRT8VQx2aR2qV9XD3IO82G5 k+ug==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J4rAlg3o; 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=1720941033; x=1721545833; 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=Yx66+3VnvScWkRvfq2kCIpOaJhSMMiT5Ml6X6y4vuWjJOb8gL4jbCubCz3Fgyx5rqD v5wYtDV+HwS8TffTiN0QiIvP46jd3ZVOoAzvS0YVxBTt6FZBgmY9RDSqaj5DU+Ba1dPm gBI+i9ZKG05+/dI6JMyVzDS+XRIVPiwWzCKDw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941033; x=1721545833; 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=A0eKaFWBLu6F0g20wVV8Fprs/HqJ90cyc1aj0HRfEB4l9dHVx8zd7r6tWsqxtt8n0n FqvdMn9YmyOCptD9sVXcMx3GZm4eKOVVEsTsEuJ1PteW4KqaHqoLQIzV1SWDXgZW+Iuz 57fPCpT/cyOLvKhXfeCLPe6snYzTTGlFt/fY3UPJT2J4SgfiwVYOcYOb7jgt+V1fGn5f tUlRvQh6s4gdAWOJM2/iHCQRYE+xxd6QCtapg2PzZM5Vhg/WO9+LCVggUn9+QqpI8ZdI i8b2zhJS97V67dgtoa1iGwMvMu/nwgfbiuoVLefNPh9RM0Z25bNPdvrY677CxyIWTODr uPng== X-Forwarded-Encrypted: i=2; AJvYcCWB8Afl54JZViscN8UJ1ADJ/BIVtalYUlqrDQbUakJweZb0Zv5HXWvjOEWdvqfaxQot3hdZYgmK2NrmnwEWWaAb8KkkXy2Ij0DSBKz8XG4TW09CEPKxxjyOgkyysw== X-Gm-Message-State: AOJu0YzyjM2K7K7wvQOxV7/kx20/x8EZyRAulIhhowzo2fXVjA25kHkl MB9QQk8rP/4OqJboaSsFCGkFLzoTraEIqTSG0ABYDyISZN2FywRz0pfiEA7rv9kJLw== X-Google-Smtp-Source: AGHT+IFomVp/cuI1BIY2j921S00+pmNXo1tuWxyIKHfsLbN48o9Q29FnhYV8YcuE+2eEUbyYGxrS1g== X-Received: by 2002:a17:906:c154:b0:a6f:dc17:500a with SMTP id a640c23a62f3a-a780b6b3a86mr1350004966b.23.1720941032717; Sun, 14 Jul 2024 00:10:32 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:32e:b0:58b:ce37:ebce with SMTP id 4fb4d7f45d1cf-59825c4211fls172582a12.1.-pod-prod-03-eu; Sun, 14 Jul 2024 00:10:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4bs3ZtmtgyA5G0ae9jJJpOzSfj3o1Ev/GOgJIOIFRQQuGs3As3HOe0LwOZ/POPvf9F6zzEoJ1OnA2lleorWCnd3bOL9COIstPNezcaNSOwtAo X-Received: by 2002:a17:906:1709:b0:a77:c0f5:69cc with SMTP id a640c23a62f3a-a780b88341fmr1097506066b.61.1720941030968; Sun, 14 Jul 2024 00:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941030; cv=none; d=google.com; s=arc-20160816; b=oawJ8dM9AnDvd40Y+A4WTqO+9IkJCl9jUHn3idQlYGn6y7wHjXWAjDTipUVWe7IK/v dYqgcfZYbPLFZiCXKOePL7xz17e4rYUot0GlDL4XByC3X+qTLCBhGCtqUTA0zBSEELsc iLANSMDrB0xpWD2wcfbHxsPvpepvzpwUBFveMSsrLKpJvzadQofyQGUz0PraluHe/Kx0 HMsy18YQj8CqCpe4l3MeB1/b3AbubA8Yw470X69TN1gDexwGJNCRO4uTyZ4dqbQ0Ws8Q P5DLC+TvkRB7fkqfAjpVwIhAvgxlAYkjv9m+7lvdD4iCD7qfbwast5fSxo817nhDIPTB P3gA== 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=1Jf+geR4SeCjiXMUc347VF2Mgnkqu3HQjBCsoE3RLmw=; b=m4mTxra5jKaztQXz/q5VoAeKsd1cv5ex68R+sLqn6aVKP8m2iwzAu1WnCoeAYvghFg EYIRxGjefdmE3zOVRjBlDOtcjvaRGpCvl8a1FSo9ggROChSJuprPTMtbtUB49hWXqTyI sd3B2NnR8j44HCs5LxviVEFfigvFdt+fkJCNmVAbPgMP4GLFeybB0F4XNkHi682mES3R i0rlfhElEp7e+ta9odes+LbrmUuD2AoqMHz+YduZk55AWSae1w2PlSEaLwt8+D/CBGGb 7fTHdFej3ndA3y/mptEHVxzuvTFdz7F9gcWoXXmLrUX34lZiIHWbNImx2Ug5LNRSAXdT ratw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J4rAlg3o; 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-a79bc5e467esor40942266b.9.2024.07.14.00.10.30 for (Google Transport Security); Sun, 14 Jul 2024 00:10: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; AJvYcCXWcR+1B+mZJ3F2MVNDjvwHGXD88lTYrzuzhWO3QZv3li9OOLZ1gcSCeM0W75Ag3LlNeDModEjNUG73fUhkDJv2RzWvhSfHmc+z28joOtWpYUE4 X-Received: by 2002:a17:907:7da7:b0:a77:e48d:bc8 with SMTP id a640c23a62f3a-a780b6b3a6emr1396968466b.21.1720941030422; Sun, 14 Jul 2024 00:10:30 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:30 -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 09:10:02 +0200 Message-ID: <20240714071023.10417-4-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=J4rAlg3o; 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 07:10:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3237 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 55A814135D for ; Sun, 14 Jul 2024 09:10:34 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58cdd86c091sf2985920a12.3 for ; Sun, 14 Jul 2024 00:10:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941034; cv=pass; d=google.com; s=arc-20160816; b=AtljmwNzkCt4DHZpekNtwvLQJR8i2JXWm52N4q52XaQfj0B5j7wvpIZ/q+Kfm62ADE m4vxYqMT92r/lXSyIQseXUkArm373LTvpz/QZONKwVNLn+nRjqt4LWqy3FYp2QHkVfT5 YRByburC0DygAi0WVq3OyNwcOnncWELtRvPgrb4wsATBAf0QVOYpBRvowzDkau9tDE36 EKhfgPlULX8cHkPfZ0wi3CIXfJv1mE6njLewSQCNOMGMKfNt0vINPpZaOHHs0hgiGNpp 9sGrgmF9THJ8O2e8kQ3EM9gDy2FeGNN1giyihyg8o1NlG8d5YctNrsQXYtaQNVkfWZzX 5G1A== 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=ft7LgeuXP04iqNoQfhMB4otQa4NGyv0If+vv6WUzz2U=; b=AxFbTy6mVA+Nd7IW9yomshmUQAXsi9oHncnYxx6I2bqFwn2+n3fKiLwKBRtAvLGq5A 7PMkCsf35zGQhBkT8H4AetKuEcZJWEtZ+CennXhk8gnX0m9M2/MBn/Jhhj1uuU0+94KD KaDO14GKwq5Ml8FpRdFmgUXDbH+Nyh0m3IsJ4xAUn9LX88rmT8jyOzwJnbvXK/UKfar8 k4ZIWFlP4cwFW4IFGEJiIhLgAP7LLYpNgx9tUQvuX0moT8//3Mkavvjfv+bBAyJNQmKS b8fMlDHXzMcRMkGQCgHYJf3477yAtTi3/mPQax56oCSniNCmOjJ+PUEjXDWWlWLvAb/L YSPg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fTwrgMma; 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=1720941034; x=1721545834; 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=p74dOYs6lrlx8xzJrWYfX3rbZJHl1DAaEP8qnU2r6wMz302Az1hsNgqmc970RZ85I8 1fD6arxeZHQuZ1bK10f/2T6hzsO0w3CdU15X9TGsCwqe/DV5MxDtfeEcrZLJogd5o9di 3eXZnORjCElv5dzxbF0EKn61W1qMRbZ2834RY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941034; x=1721545834; 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=QeLiuBkB3s9C+Rfd58n7bUNrqnc+Q9K/RXPWRV8Su197cWQ52p447ytvNNGAZVfjlz wTg/ICdsmlHGtAEEDvHt3O/gK3bIa3mCanTlbvWP1VX569qbAmRG+qp4psHnaXET7VT0 x1/Rq9pBbx+ZK6uIb1YzPNMnjRGd3iF3aQUvsEmnsaSlf0HWDQdc35SxsvpmMUkzkdgV dw0jBdEgUKt1TnjgJv7N00yijiKkQtIEN3PKSwJrvcMQtiHla2N1toypKDM8rotlbmAH 30SsknzKAdZovn/37GWMIWAWnRjHQTjJmMOrQkr8zMeJa6zOq2au+w1A/BsXu0kwFOmQ 1BRA== X-Forwarded-Encrypted: i=2; AJvYcCUBbROKQSZwh8aDvZRw/DEbCFTqnwitdjmaw388o36EQguovQIdaVv5DNuqCwbWDQ+BVtGi4MPAaSfudyNx1p/8j1X3np5pVuH65Sq9IUaaEOB1m0c6lGhe538yVg== X-Gm-Message-State: AOJu0Ywta3vBwPYrzEk09HLwkUluX+YsTiznAIeDSOsda7g2Crya76n0 p2dwGQJkego9GV/6KPkNuQesLXVwCJ7ZO2zanH1dfBBQtRshtVXUb5LIlRrNOfzkSQ== X-Google-Smtp-Source: AGHT+IEQZFlxWxGvzNuwo1ZsJZRlz0w3cLuQS5v42cx9owcfpxNsosrdQISGzDsf902rvMLXTL73Yw== X-Received: by 2002:a05:6402:5208:b0:58c:7b28:f1c7 with SMTP id 4fb4d7f45d1cf-594bcba63b6mr11726923a12.38.1720941034032; Sun, 14 Jul 2024 00:10:34 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4310:b0:599:9c73:c392 with SMTP id 4fb4d7f45d1cf-5999c73c484ls1238523a12.2.-pod-prod-04-eu; Sun, 14 Jul 2024 00:10:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWQ9Wlq6jiXNVR3LzAMmtin8atvuqUrRufiXCgP79l1zJi5EIlKUf/YwK2QdjMNka3n10qQ9+NclKnCMoNJdSNNVLIPKLY9BizL2hRClpa+1nto X-Received: by 2002:a17:907:6d26:b0:a72:55da:fb27 with SMTP id a640c23a62f3a-a780b68894cmr1349608766b.5.1720941032177; Sun, 14 Jul 2024 00:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941032; cv=none; d=google.com; s=arc-20160816; b=v4r32bE8NtHQQm0cf2yavrssd+ilNfhprCDu6UI8nVDLv/dzpHEzKvVXWHlDsBtWLf zu1REfNQZvPeyPL4yG1TfzxlnAvg7BXf4yhCr3WLZ/Its03B+oqkulgNSErRypdJ5pj/ IRJzMuaTefvq8AGCAE4msoTSwTaiBteW3UJUDDRuVmzILBxqJQw09rxXFsPayae9ZCHW vTmLOxKElhZgWstgZUJ7Bg2WbL4Uq8c1t9We9j3xYGr2+hcB4PwRgwO2thw/Bjg/TTe3 YG9GmXsCkDU7vcvGxmTJlWeTLosWryoo0KznQI9cK0hznG4IBBvJB3qlWhUY0shyf8q0 2SdA== 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=YdtnGvAgvGte8JhObVOj4OS969uzj/VfafwQUEGLFUI=; b=CMdAzUEdRWJF9pPNaQyrmzbC4dMNvS48b7hIPo82HtewfEeHMGxFysXOoYI/0qbU/w Q6GkxuF0BQyjl9lc615xkWjFsU2q/2/IVgpZYLyHkkt9Ec8tMX2ivz9wTLXoTmxhL1ng xPv5kQF6BIdpbjfi7sMFZ6LiAu3qu3WrUpfCKPn9tRHiK/hndBrBzHDA/rI0GbYovTnf pK2WTjxPmrctW7dP3wp9uEUybcsCtNxsm+217mr9WFhs1YORqRD5MK/0rjPBhDGN33vX 5vcJTMHTQw8F6XyoUoy6Dyrt8gekpLgUjvx31eCXNPkpnS4gxFNT5N34R8cTNK7cFSiJ TosQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fTwrgMma; 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-a79bc58927csor41439466b.3.2024.07.14.00.10.32 for (Google Transport Security); Sun, 14 Jul 2024 00:10: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; AJvYcCX8NdKMo9escwGnFfWNpV6jdN91+EMRBzrVAAoyrpv3UR4eYpgrytyVRaLGHH9i/6U87ZYRUJ20Hj+74T3lqqEkubTTuXcaMt++2y4pQLuiNIeW X-Received: by 2002:a17:906:d1c7:b0:a77:e2b1:9cb9 with SMTP id a640c23a62f3a-a780b881caemr1067914266b.48.1720941031727; Sun, 14 Jul 2024 00:10:31 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:31 -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 09:10:03 +0200 Message-ID: <20240714071023.10417-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=fTwrgMma; 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 07:10:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3238 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 C7B3E41497 for ; Sun, 14 Jul 2024 09:10:35 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58d24cad85asf2761834a12.2 for ; Sun, 14 Jul 2024 00:10:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941035; cv=pass; d=google.com; s=arc-20160816; b=l+AZuMYmabLtV2Z3rCpgdC0dPVfWM7YrbCXhN/jRf5TqJeJK3mIfGqtDLHQfwF7Vrn 2fqoN7bVs74SKxUs5zRaKf5NQjS1DHb91VBCtnyRf7blJPdr947gpL13hAFVPE8ecnCm 10Ib3Ec3OlhQ0DiWcoJJXZHztmz6MaEhOWYChhE/7/vXao9eYVXmlKtYm/kqobxn6zPh cMH5ZAmbw2KUjIKPjxUtHwA7dCdPi65iYmkXR31VAROuGjJg4rz0qgCPcuN17c44HRDr Jr6S7l9t+8E8Cy7NU8WLN2gHRN8k7aQsDbpognq/bB6//8xgwGxwwGoBl99FYU2ehsOw opnw== 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=LcuJnwrGwlQv2flgE7GZcW16odJqL4yQvZN7X+b/FEg=; b=Qtq7EDbVle3zHhQ7kjLUCljNOxl7RmMfA41icjGf01SYw82sVJAhCxjDeEIIGvcshm /t+AAuZySqpUYzzJ4EcbMqcxqsnKHEdND0SDzrNPeousl7xZsgDGZ7oBrpVWVcAw89qO 8qyaj+tZ1sNWIurnhG+0zHTbLjgVZfWM9WRRgOe7xvtAww9CfjsK92g5V0rKeO+f+DvF 1H38omGrx2Q5Kbx3vDJ/q/JevugJU/vGxXFMAsmFgspE/IQWcDhBLdn81/ppAwnucGFP Uu3QzZj2DxHvUsrs2HlJpXtz2wRMiygdg9LJZHC7Ikqf2JmxJBzXBNRNYwlmAAaq3WsF UFgQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mZY9rjje; 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=1720941035; x=1721545835; 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=Ei2ArS9+QRagnvHdV319q29oSeg0UD5WLPETYGCZR/QFe+xQOYKNQVRkXfZ6calo3z H83QPR5gan4gePUzNgSJP8xD5t0OMWR6xl8uYGuIeg3jIR5Idu30RVOk1YX2Li1s8C2x NrPNbLGPzs/RGuPVXoq+Bsxe+YhDOjBVboIIo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941035; x=1721545835; 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=vzz4E6XFGq6DMZvpnXyWBfhf6NLXsyPRIa0cVf1opf47xiNNDBM2kklQf096Qaaf/l rNKVJwYjXdOiQfL3xYPpcTqyIWCIKYthWB8QcAq89PNXy7zDNsFaYeeVhSFokv8y+Bzl 5Oe1bc1lYnoB53rsI93Lmu2keC23zafzamujf3I7j6EW3uBS5Dqye/pc8ZMNLuw6fFzl xYVmadDubgyc6wmYA0XxmuNLMXt7TMVRRiXKE2C27USAWgHsMZ9tS2ojkG30ccBqslZB 2m+RtVyNh6ePOF9A2N2NPHzU54fmz8IYiCZ0xnzV9I1/LsT8ZoJrmPKIglWXszY3dPUx 2NmQ== X-Forwarded-Encrypted: i=2; AJvYcCXVIFNWuzob6T8BBamGuUVDXBwdKD4+d9P3KQRZkUckaIfec4sziPHzwLbzEMGdkyz2bI6Sfn2t6tzUczLkPWAH5ziRMzmfjUFA4zQZFH7RtsOzqep74qAzCt3XYg== X-Gm-Message-State: AOJu0Yy+gEwzMvbG0Vwme6SMu8B7GvdY+Hs9ZXt3LUAlonTFxnLAck1T yA4QkTKV4CmhCHsUoKOM9xouNECE8MavtklhYbRC+l7pZqkgLsFC//9dSVxVGsEabQ== X-Google-Smtp-Source: AGHT+IFa4i/Agvk5QVTPQi9YbEczOiU5712Yv2YNh6eFVKxkvKCr97fSEN/AYW68JQdeosDyth3hzQ== X-Received: by 2002:a05:6402:5ce:b0:57c:6d89:eaf0 with SMTP id 4fb4d7f45d1cf-594baf912efmr12530155a12.14.1720941035469; Sun, 14 Jul 2024 00:10:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35c2 with SMTP id 4fb4d7f45d1cf-59821cb8e5cls1830718a12.0.-pod-prod-04-eu; Sun, 14 Jul 2024 00:10:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW30SLLGmNBFgxVPGxUt0Z1FNZQRrO+AEKL0a2b4LZxe+SZ1SKV36XQO89RjrfA/0wsdWWsVUIm/+m7kcpnuza3Sla5L5Jw5DIdpWdJ23+w0kF8 X-Received: by 2002:a17:907:7d8d:b0:a77:eaf7:a63 with SMTP id a640c23a62f3a-a780b688a35mr1399545066b.10.1720941033700; Sun, 14 Jul 2024 00:10:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941033; cv=none; d=google.com; s=arc-20160816; b=f1j7SnwRPBxOqI6JLtgRXjZjChbuLM2h8Qa3Fpt7KqF7j8gZgKxfKRT9gxDuzfGkKp hD4PU+hR96Ym2eMWymDb3bik58mxAvI/w5Wh3eB1F0lht7+mVD1BTLM+dZRwxKVyoUyq MsxIC7o1hm9qfOz8YoIJLmFzo2S/5RZKp7Rc5br499l0realhxOJLCoMvsCkd5TbHxEJ AvUF2k3Wb52G29heUSysLJhw22aZJCRLfE9GAD8wx6LV3Q3motYaQyHbD1xqzMu1+iaz 4YQZ4PNJrAmCYGZCiUy/kdEWXjK7f8GxYPdHCXceW5KPkzAQvxMbYbwTCUvCfNOpKttO 7B0Q== 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=iVGD+lfmmT226tD58Ob0nPL4esaftr22Z3dFgeULo18=; b=imSIT7u7vBxAlFhIwnkhFLUc0E+3Ey48gzXISJpu5gz+R6PWz61JkFGgDK1s79EmO8 p4+lkWwdIp0kXFNVpep63XHr4G7/lssN18rsFKA9xW3bNUDCWNjvlxV6qOk+KQ589MkS jSSsbOma2VKNgATifX3AZ1k7SoNUs/tEU97TX1KAKcz66f1CcjXyoo+Uiz2XVtIVpJOO Mn0pStcrwMHhJfvHqJSCesX7Xhu8NSCwYEAY1/wVmnuVa4k1QbNC2Jcp8pNBSCXa/vU7 F2iBbRXP8dPM54nydq+BfR9OdlafDelhEgAlvNx8bPtsDjlqkc7DECaHfgQOLFoSwLmA aSYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mZY9rjje; 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-a79bc5b3f5csor33755466b.9.2024.07.14.00.10.33 for (Google Transport Security); Sun, 14 Jul 2024 00:10: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; AJvYcCW9wvAB6g6dl0SeK+eBEUFnFN9cim02985IdFraB7p98Sf0bAfG2s/btQ0IJmlLZ4wAB/yAYtkTuqxbLh/SrO3B+778rtRnXkOxxwtc7T3SMWKB X-Received: by 2002:a17:907:720c:b0:a77:d880:2c91 with SMTP id a640c23a62f3a-a780b68873amr1358314666b.16.1720941033330; Sun, 14 Jul 2024 00:10:33 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:32 -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 09:10:04 +0200 Message-ID: <20240714071023.10417-6-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=mZY9rjje; 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 07:10:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3239 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 200FD40F59 for ; Sun, 14 Jul 2024 09:10:38 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58bd84067fdsf3260880a12.0 for ; Sun, 14 Jul 2024 00:10:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941038; cv=pass; d=google.com; s=arc-20160816; b=JO4SG94PJu8brY5xVIF6mnIW2oBkB80uTonCEW/Rvyjo554Sc4MPiRwg/vE5C3fGih gf4vrZtyG1Go3UEh4mJQ7M95+7h1/1oQJAucGr660wn3PyYwS1TWxdsCbw0nDjWAT/Ml 9yQCqNZcTafe9Tj0ZNlGLolbksdmoRTg14xJ3snquHttx5b+H33u+bScgOi1mNybyAJX gWLldPlsx0AoZR9ueZO1mJL62aqyrbDiapIV/nGdxi1WqLp4l9Oc1pPiDnbV+KFFOA43 GJHWBSc8UObAsQBFww28vvkvCtStiUKcnqKapue/XPRCZ9PtbnGFkDHBZ4LKGLGwutmE 7z8g== 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=wYKq5mCgDAdDFqqPtCF6bLKRQWHuszbFY2M0QQobudA=; b=Eb/zUy3W+Pde1g+rA217Jtp/aeqXBD8L1Tj6kypM3upOeZZxIdLdOknDZmA0px4fRF NEC5iltWQPFqjxYpDCQ2JDRy6rfYetEYR7ky/YmWOOzAZtZjPrrFoCqZJPtXdGNeqOXD r0dfTcqdK5A3IZQVQFECTCNxM5ltncyWssISfCWTN3QihFbHbRtsihPBi2LklLrADNNR FMEmj7k3S6ISapQ7XuPm7uI4WjmUOTHP0hzraINEciaFVc1nnz28U+FRN8IoHzoikTMr SbVj31fF0dJmvEN67/8O8aDMzNo23plLIC5Y/66ud/o1Pk04c+sYy/ROTkQ0VMQQvqVr 097g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iFLkAk95; 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=1720941038; x=1721545838; 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=QheXYYitMRWjkgfgHjOBp+djFAAU6NhDMkp5suMMbU9q/XAHqa5vcnUw+nOefjzEsc oeprnGjE/xEq7i+9VuGkXrJRYUtbAzYHUPIQOGJokixcdEYA2ehFC5Cf+uenJ6+tCdE+ e4SGVMpYibbSCR0tgiY9ZzOevT01d+E7a8Hf0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941038; x=1721545838; 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=dgYfseyxF9QX8XyFGLl4vCfZqtKB+5e9fJ4LKRgJ1mtfRvNxW3bgwoWIQQYNxUJ8Os jDTn1Lvql6ufCbPzlYCLvstPEFKgFvsT/9Czlh6RNc287cKfBaeCqvolVzdV0XVOOHp2 CmuiVWQ2Exgar2drf8s/qgB/abEhwhKidu0UVowncqcragE09YwIGaP+BuFYCJGQi8ij 4MOevaLI3RRD4c0zPAvj6HSSVhuKvFRTKcfLtI3XhpU8WXH2sX02UgNhjocbwgPJ100F unmCfrQyggyoQ2unqINcAUkEy6iCgiUZxleVVHgtLKRkesbGF5vzwwPlftMoUtm5VGNn BRpg== X-Forwarded-Encrypted: i=2; AJvYcCVuODn8C6HDgn28LVv/fexgVnyyIHozoUJeiXWZcTu8OLMUWse75fEAiiQq4WXhEpU7pRmGm0Td9cuZpZS+XkxhWA9kee9bprdZbf+w3QwMHjoCpzoX/gwnnNbc+Q== X-Gm-Message-State: AOJu0YyXDOm5ULrlmOdKVejhPFbdlROsA354cj+tXrll//FFQnWOluhp l281EeCxKXpn5MKVeWpbcYnCoB3fHNyF0fNHOWFASPxeFikUEtUzJnoc/mEyBgnRBUrT6iC+Hg= = X-Google-Smtp-Source: AGHT+IHtL54MxtWDdifnOAxA40MTE5GTPdV9wjsHq5AxIYk5o2lDJTaOBVVJEFaVQNom+tz5pltyqA== X-Received: by 2002:a50:9b42:0:b0:57d:2659:9141 with SMTP id 4fb4d7f45d1cf-594ba59f968mr8706122a12.24.1720941037824; Sun, 14 Jul 2024 00:10:37 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:2188:f507 with SMTP id 4fb4d7f45d1cf-598267117b9ls1771872a12.2.-pod-prod-07-eu; Sun, 14 Jul 2024 00:10:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXq5+7VrzLhpo73VSIIs5Wpqx3oyGkjFQKaxLMpAIaeX8htYhKciEuNJ6p8Dipg/fIpjMjAX2OWjRdn90fD4zIszs5O59K+oeNSkOMKoG8n+vl7 X-Received: by 2002:a17:906:4ed6:b0:a77:c199:9cfc with SMTP id a640c23a62f3a-a780b8856e6mr913024166b.57.1720941036039; Sun, 14 Jul 2024 00:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941036; cv=none; d=google.com; s=arc-20160816; b=nvJGaIbXPxJ5i/JaFmFNyWxiiRp/85MWF/4Bq1VH4Jt9irkWFb0H3KvO90BUsLEewU bwUTeRT7rCFEMLPNerQ/Hlm8ZmeZdklnyPmF2sFaSQPsN/DetLR46OKK5X1tlAbfp7pM rWQ5ppwVuOrT9jeadMx8tu76hwrnPiddMU7DtzgAzCpFMdHS3L8eJpSQUG3EVrOpbVyv suj+kVS4kaf77IWcgPLY9AccBlThne7Aq4k7BVqQ/RZtSeqQoVVpN3E1rk3JkLa39smg Hzzg5y7YprZP4417ADr2VOl0T7sjYmd/F/CpWdJHE8sT0naBTpTWBpPRuDHCxSYQpwGf gYdw== 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=4zbbfpvTLnMKJhCHbxe/BD8U8LVHOQEah/IyG8LC0js=; b=CKQtnUb8C5oaJLtHKtqyRIEF10HH9JiTRvheykFi+sv4vTn2Lw0TaQloo970Rf9Kb9 aDYlJPTsIdTqUT2p4TRbWToIrVIQw4d6nZaYBiPk1Y6r2W6aU/917msLhfgDT9cpiCEE Bdv6dIWROak8OlJyOFN51ydSQnT3UTtWgD+DGh2AYUWqNFe54LKkEkuJruNlCUyJRyYF T/bcecROSLAHKxLjgG4LwOe+PrLWHA9ITKp02JDMhbgEJY1bKvM6JNTInx0IZBz942kH hQIMsayDMJ+3Jci4u5zDMnvPywXo1d7Ix2u7XKAgI/Ap/3CLE5TNVi9EoCWCdM8BUEw1 n/Sg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iFLkAk95; 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-a79bc7b2cb4sor35190066b.13.2024.07.14.00.10.35 for (Google Transport Security); Sun, 14 Jul 2024 00:10:36 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCW10Bji0Wa72ZV3RBZluY28DOfY023FZkxY+1pF6wRpkfAjXnDIUAjt3Zg4WHse1W9ZCVZZzHFTbV5/dlRKEUF0c48scuQzyDXOgVQ85UB1GEdt X-Received: by 2002:a17:907:7783:b0:a77:af6b:d1a8 with SMTP id a640c23a62f3a-a780b89f497mr915556766b.64.1720941034604; Sun, 14 Jul 2024 00:10:34 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:34 -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 09:10:05 +0200 Message-ID: <20240714071023.10417-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=iFLkAk95; 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 07:10:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3240 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 17AF6412C7 for ; Sun, 14 Jul 2024 09:10:39 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-59c335f48d6sf308747a12.1 for ; Sun, 14 Jul 2024 00:10:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941039; cv=pass; d=google.com; s=arc-20160816; b=ioEAoy7yDo8fxzgYJH+wB6VjQzP8AwMtLQeXbM/Evn+uAyoDfX1i6wMT9e9evPx0eU 1PCDAwDPgoAw7ufSyipywcBjdp8ghJRSY9OZinXPqh0l3N09zlNdyDpBrd65kGgmdqgG 3ybEkuCGf2749E2Gfoh+azv0HqcFBtIkYgkLXM31djxG9iEctOpFDPUQHmHrHDfKCTuC dCJcq3RzTiHLKEpQA2jPKqFn1iePZKmtGradDYSpNLH+tXHIAsPxtF8NpjA0KZt/gWRp ArXHP+LrusrLxbLNkzwiMfM/2q/L/tt6+p6VW1pp9Q9DcK8yS+vaxQZo7zdgFKCR4Mpn CWmw== 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=3fkyGyCplEz1JH2p74T9JiRzbLeUqyRsuwaYj6eK5g4=; b=aTJS752RJzHoYCLebWkA4RpeK17dNHBq3wY/gp+6NlifNFFIiT/bbUzMCaDZdLxz4K Z040OF1C7uDusJzFitX1QSU9MMGDQYjCkb7jqdxDVSD+rKZt/0rOsO67ycdIShk22D1Z Gob3ctQwGFXaVd1DvqKR7jcXZHfj3HfcOCHMwVpYAK16zAzgmboR355dYvME20Z2hb6u qsR27X3UoG+CCvWmCIiJ8uwhFXCIsSAVsfJ3KLMf2XUzKY8xGvB3NbqPhIwNgoczSQFe +/ydDxmRsMRqPn2ieWYhfXGbHRljOpokPS/yuNy4fR+NL06jQZMTrd/YtBzMHAUzx+/K pWGQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="S6/lnFsW"; 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=1720941039; x=1721545839; 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=rbxwQpxJuko/G0ZYM3YL3nbIM9ae/9/aVKYVJqThjwZvKAFUclwDsW/ZswN2Cr/D4G /fAzEfAwehH2ifuNAOlpSNhlcqGDz+1sLs1YCfwH7fr/XuIA9v/geU/0v/pKOAs+WfTa b9zXcQNA8LjwI+cwOBgIgbUEFIAzAIilT/hgU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941039; x=1721545839; 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=OVlBtz09JkVlvuZi4DLrNcXdlfKSRonQ5Qoxemq7kl8sloTsm/7hyfcVcZLBfy/wJv MVJeqchMLVIlCTQ/+WS2icIF8i0f+7oiAnA+D6lWpmaF7jsLTSuIk2bMrCw8x2B52F2p oAJBd1brZ0RAn36G0h8F26FR0eQkeTmDbMN8qacgtbUgwXP5S4fnlfGw4zBfv/r435bC M6B02XEtgTtOnqdWhgykepw3uY/Gwx1+pZAXkW2HQDz47Ui2BjXlJUEzVHbcRWOR1tLP jxhZ8DKcmX7v9te3u0vfRbC+k45LUy9YK/qc0hqhDdK+uTiSkn4kACGXQNzuM/ZdGMb2 h9JQ== X-Forwarded-Encrypted: i=2; AJvYcCUzZ5voRInOS7qSKf3Myi52/2r/zlMzO9Qx4MHZZ3f2bvH5fTy455nRGBN/p8LixB4WzqJWb/uNybp6vNTHiw0a5oE2N7Wh1GpXvjDIozaaDydF+qCoS8P5JrtAlw== X-Gm-Message-State: AOJu0Yzp7eK8e94l80xtxm6PIcCqoJS5NXCsnOqyVs54Fniml/QGSkdq D7YlgSeOY9DdT4bOZba1SnQEw61N/dap/ZJ1zkwzBoo+2LShKBAMSE/6Y88mF0JCFA== X-Google-Smtp-Source: AGHT+IGbOKW4nIxEmypB0hfr/tBouC2oqNDvujBknRe/eTVHIXS/GHyTIxEjQTDzfRjGT4ul2Z730g== X-Received: by 2002:a50:9b42:0:b0:57d:2659:9141 with SMTP id 4fb4d7f45d1cf-594ba59f968mr8706143a12.24.1720941038760; Sun, 14 Jul 2024 00:10:38 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:2188:f507 with SMTP id 4fb4d7f45d1cf-598267117b9ls1771875a12.2.-pod-prod-07-eu; Sun, 14 Jul 2024 00:10:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUGwcboc/nA0RTkZN83ETGuIAdYowEdx2+N4v8J7I/nKzx9q8eGiZaJte367fwSIxbKDQFJCmrMJbnsMqQRCVr78Y/pwTzpU6KB3rq9qVwFmORS X-Received: by 2002:a17:906:2450:b0:a71:fe3b:8ebb with SMTP id a640c23a62f3a-a780b6b1fb1mr1018374166b.24.1720941037072; Sun, 14 Jul 2024 00:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941037; cv=none; d=google.com; s=arc-20160816; b=RkQTkiI/hoSPbUyhXpygRMAK7TGVyhdhuSbWo4V8XpK0DDvuMdBJHUPSGn9cc08i/i 4KSpxzX6KUyZEw/3wjB2In9xAogfBxhKju/tfS7n1k9q1TcjjNykrUxBs5WpHg8IOURt wMzDLvqrGqIAvNbpLzl3bzE+/fNTbzHJ07zMRM8ComzhRAm3fm9vONXt07aN3O+nVICv SZMGcTidYMYyeGkU3oArKZyY5nql5chHiDAopq2fIWbM+VKmgKMnNXbiABQzljHVCWji 0ERB5GWjD7A8UamaPRi3MsXaemNp8jAj9AQ9W3UzKtdfEUxgu+8XViJELrorJJ04rKjk a9Sw== 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=JzdLna/M+50CS/brKgh6oBGUy1h0z82T+L0ucZLijI0=; b=SB5tUE69MTQivHCHNyCx0K8WlkDj8MmwsoI7j41gqjn+z31pW+V7vjZxYvC9/ODiWP ywe2WdsWI9y0+ACBkPEIFMnQbGfg7x0DF1OaNBdF/CIvTY6JTUkBOk2RSL87NrLJls4F kCqQvdzL6jUwu4Qgbi3/XW4x8uBMf6v1/wPWkXT0dYH1MHzDiOYQkBqAL9etjq6J7daP nGtvjcnBoGrYi6eSKWFKMdzMKat9tvo7G0AekzfP2gkXk5V440lo2jSmdUXdH6+/Mp80 SMLMGP4TT7PAgArqTjBWCeowtvv3E19fIISR+qdYVx46c7KoZF7Pb1aouzOhWseT3QeO F2Cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="S6/lnFsW"; 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-a79bc5892a8sor39969566b.1.2024.07.14.00.10.37 for (Google Transport Security); Sun, 14 Jul 2024 00:10:37 -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; AJvYcCUYox4IQUjsO376F1//9KWEGJZneC3HBDrdfTqD6rbpU4LtQnD2URdLyw/WkviZR5aWtkGtdQYSA1/lerbwSmXg7qABek0l7F51Ug6pYM2wY/D/ X-Received: by 2002:a17:907:7f23:b0:a72:4b31:13b5 with SMTP id a640c23a62f3a-a780b88664fmr1303718766b.54.1720941036677; Sun, 14 Jul 2024 00:10:36 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:36 -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 09:10:06 +0200 Message-ID: <20240714071023.10417-8-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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="S6/lnFsW"; 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 07:10:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3241 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 5DDB24130C for ; Sun, 14 Jul 2024 09:10:40 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-59c1314940csf326879a12.3 for ; Sun, 14 Jul 2024 00:10:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941040; cv=pass; d=google.com; s=arc-20160816; b=nNvcgeGWruPyF1tdBlqAoFtAo7VPx25Id+V9/3Iv8GRJ0MAhwc0YY52YMRrd1Zbsgq tKTRBs5gLILCT6iJfQWcKyhsq8aP0yCWr2woeX1cVusF9IqH6SzIy/vk5o+7YEW36ZXh x36mvVRMQlPZSrATgrxqWRVHRtS+3G8QFfU942/6eRgxXYC8ATUAlU1UNEMQ0dUac/pW XXxQPeC1KzbOGtiBLPTB/uSC3zLqQS4kAKNN94EUSXIPw+k2n/FW/UE2jePX1gRu6NjD UNVCZTtZZ60ire3j9VuBixdaHu3mrL9Niy73dQzVPUAffWc56KIVDOW3s0K5dESzsCYP z/xg== 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=cFUocPk8ylRLBWkTYQX6XPXsAyUQS7krMnNPFrvKdBI=; b=bO0ShoKMNf+cCfkBFU9TyrS9VkoiVaaFbLhghNL8xis+x6i2wCj+nmcTeS7JL1wWsg 2mnQ6K7zUNUF+RIdTvrh6CVl6ahFDgzhBVM0bq2uRsytGMqqLufTcpkzzMgjzqBgOyCl OYcIEmJmvTw7jMXUeXI46JLoXuRKTvuyOVBC4r2wLgo1QQcWiN38PXYoZwzbgYSjUGmz Yoyf/qkzspyhVPEEgj70UpLib8FuaUAkVJQwp7x9mwWEo/QaCUa882EpafmJZc1bo/aY d7vvRPTC8HGhMbG9fdlB6uhTR1Q+YQ5wvCIzENfuu9LoKVX0hr3CELgIobVF5Kr9kI53 LyiA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=k3UYu+Yg; 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=1720941040; x=1721545840; 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=nCBMgQtBMB7ofZOd7GPyHPCWBgwTmZ9w4ZTcgQ4l8vWrEUh/S+nwdbc+dvB/4UR9/3 BZS6eZ20n5awge1MPGCaYRL7ifzYrXHBFIcG0QV/stRQjCE4qexWZKDj+ik83+2XmawU NLbKSa6IeB9Dhiv2Za6EPfPE2pRgk6kUkyj08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941040; x=1721545840; 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=bQxhahpUq95SPO21YmV/ASBQ0EVzAqU3vg+ugDE4RV6SfqWqWunUqxfOufHQfofNzQ xBePrsgvyKiRZKsc8HKksTvO4vyvskHaSRUg4WdbDUfJv08GI0SqGI5AvYdsLrwKFRcE fp1qMNjJ9KdtahZvTpxK6NwH4H1n7nVEgrlpfdL9tqlFhDpOLvVPLZwr+QTefOl4c9// fkc9IVp2KQOydkJSKh6VBxhG3XlMJxomIu9Gk0hz3WqCR3+CUk/3nH54PD6g6CBAEDcw NYmKjC2mrSw3uwrY33Q34p8HQx5PNdAd6q1vCo7/uSylFIPzVboBHt87CLLgsmo4g+wp 9O6A== X-Forwarded-Encrypted: i=2; AJvYcCV+dD8JOlg2qzQzTRrzmcwiWjfLuUz8qYLV0ctTSI3T5QIXvyrL/UAOCZ+dAYScSWise7hr1WVptgKQigUaac7i4p1yiZ/v1HwKSeVPSca3wz6YEY5IXfmYO/ruow== X-Gm-Message-State: AOJu0YxXNEsqc3lXRcY/PBRpe/tLjOful5sDXyiUWiytOVKuMGKbws0U o478IfNL2JE6vvrZjFabK9gM/vQ/v2A2K4F4vZFo14rMJrjSv4GbnpYMG/L1El5IxQ== X-Google-Smtp-Source: AGHT+IFV4v8LpSoXil8v1Rl9972rQmJHqqHx/LhOjZrQs4QAzPAB1w6Ia4Czp2V1C1TsuWjUcuiKsA== X-Received: by 2002:a05:6402:5187:b0:57d:6326:c658 with SMTP id 4fb4d7f45d1cf-594b7d840admr13336477a12.0.1720941040131; Sun, 14 Jul 2024 00:10:40 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:32e:b0:58b:ce37:ebce with SMTP id 4fb4d7f45d1cf-59825c4211fls172606a12.1.-pod-prod-03-eu; Sun, 14 Jul 2024 00:10:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXf2RBe8MBpART1rwQBNLg7Wa4oNztH5wGDcM3vUvqTjfwFWSLyRqI4wG+mjBHFhYnM5NeO0anjCtgBIcgnU4RNbnp+NFtD0Cl2BYcGLDcE2JR X-Received: by 2002:a17:906:a2d4:b0:a65:7643:3849 with SMTP id a640c23a62f3a-a780b89e7a1mr954552666b.73.1720941038561; Sun, 14 Jul 2024 00:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941038; cv=none; d=google.com; s=arc-20160816; b=sYt8jPEsBIOLeB4TEE0BMw9lK9XJbIXk2CSkBxm7pf1IRrSGlopHW1HPKA4vYWvhbt A9f/AWzumBnJXuw5VNvyPUwE+lllxHmZQrzWfc+elRH1ByxAAMObUle647sOGK0Fe5Xa Ra0tyALWt8b3iESH7nEl3YpYzpHRSLoDWw9c2jkZhY37HlW37+WanfAPcucFsSAyASDz AVDarHCSILwWtvlaNSC7Sep58WTwXnK0r6pcSM6dDl32Kj6rX2SQr2C54vD9BpmePafy 9Ppb2qSuNaT6NIpuUCiIyaEiCLyISr03NvYh1tT7LYAWe4leSmV3I8DAeHmduF7UrPav johg== 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=spqgk3ArcxlpIQSA1cpOkqKMmjNKVMkFsKl/OyhXraw=; b=XyFe+q/zvhYmy/+tyDRyiZM29iI5np383EO92HFIC0A65q+CCoKpiRYSDeaLz0m3Ds I6pWt/ZRpGkqMo8aZAJq3Z49bre8PLVVV9OMlYysMavNVvhbUeK/TdtvXBO7mQbFuoS3 JlXNv1b5VQEeYTfRzVF2Z1ixyh4+RWynHw1OwXo0yQuPfcqJnuSkuzj7nxUkw6Dkv4lx OMs8ZKQFthyegl0Uoq23aL3478c2zb9GmQG38Gm4vPcHDnZ0sPl5NnMh2aFv8ZJ0IFaE Kpv7mmizrmlr3Qpb0tcmFeURUSs8FC8CcXnwDqTTbvPV/+QY8FnGIRTctZJaJTJ3wFCU WX+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=k3UYu+Yg; 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-a79bc7cf0cdsor40915466b.16.2024.07.14.00.10.38 for (Google Transport Security); Sun, 14 Jul 2024 00:10:38 -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; AJvYcCVa1AfpcS67Fr2d9j27eR+xithYwAfjggeR4IYq7Tew4Pf7i/oEHsD/WYS0js4RUGbn1LjDIINCBUQM4f/I1EPoZRr4Io5xc78q7U2fVAdMm7Ce X-Received: by 2002:a17:906:d1c7:b0:a77:cd3c:e9b4 with SMTP id a640c23a62f3a-a780b6b389bmr1059910266b.24.1720941037784; Sun, 14 Jul 2024 00:10:37 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:37 -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 09:10:07 +0200 Message-ID: <20240714071023.10417-9-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=k3UYu+Yg; 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 07:10:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3242 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2A9974135D for ; Sun, 14 Jul 2024 09:10:43 +0200 (CEST) Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2ee81ff717fsf36570111fa.3 for ; Sun, 14 Jul 2024 00:10:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941042; cv=pass; d=google.com; s=arc-20160816; b=xAu8De07m04JKeYABkiifjywjllljo5bllRIn4NK7VixPtyxYtzFh1laISvmmS4F9A 1uiczkBrUT4S4fV3tEWhvFhAcQU1j4eydSBCiVy3g7JwQ8NgedJc1biK4snU/5R+Aai2 d4xi0LLQsMmzmpBEU0tq38sNN2BU+ISvCfii2LFf5Lhfr+tu2sQ1Zcxi2kF5EgTf/65C tskTGFArNXoQvKpJ/IvaIJlVpPvv2guOxZBfK/AAhi5I3O9dzCz6KVlgWfCqaO3re8iG KRp0nhxtqiZeWofjxM5FiiRZLNKufzTOVN/G1LTyUoKP4BZpYw7EutXjKUjHuWieMlzp j/AQ== 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=AH9jtjhwFhFWX3jYhA8Xz0E9HUiAM0+jLCe8y1dW+84=; b=Qqmi+KgZ3ipcu1EyDu0tgEqc3uLU5TF7QNwq/IG4NL9W/We6LC6VMBknrMR61YFTNU 7peUuFOUetRsunNmoNi7IyOWmsDabm8nLffe2SE9m2SV/AtIr7RavK1U8TIcHVi+eWru IKVYdwScwF8T/OMgEjRl+wyyhh9Z6ModdPnGC6QmfXDRJQXZ3TGd4vFqjw/D7tQnhNTD GD7AOaF51KYJwI8m7Z6O/Hg/sVBPFdwO24kQa++X4wHRv1Oy73z7XOWwpQFY4XkL3JZr Ami87sX0VlmzYV3DYQlOcTm4TV3G5k1zHIRhcRVUzWw2enbaBRTehXLUX8CEAL/qzh5C QJeg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fmv7rG33; 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=1720941042; x=1721545842; 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=g1DVQsww1/aN+sYsO1ubd4/aKpOkCN7TNyfwZPsfMQeFWxP1JhU7slX9+9znbqHhuM 0vL1DuTnjbxHWvFp5aIQ5ZMB9/tuN1iriXS+wwssrAORcf4cErA9m3dD73P3giHuqVRZ pk/Atmix0PFtOz+H+UIZNp6eTV23DUVJdXDtY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941042; x=1721545842; 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=dWE5Z4Y33NJBVoHF8mGtkGq1+NGEuxkFeI1bfRSzSX5NsWFhVVFoU621j3UrmuAJn6 vVp0QlFuZRQdnjfHH2FqfDtHsUsQ9s4gASbf3a2xbwDrUMrxYnLxDnZr7NPJsWDW3z+G ZlMLiegBP/GBDahMC/aivKI2zylAw3gbSdVY3gJlPFrpUhkflhDDYBannVbuIDLPFg7E zc9tzMyYtXjy0s3eBjmnBUQob4RN5goedAnQ0B++iGxBRthnjaoRu7hlObwWbih6zOz/ 9Ze59PV1zRG8jP4EPuTqM4cp9lJhm6Fxkq/7SFa9jXMZVYsCaD+zTU2jbL9TixYb4DiM rLWg== X-Forwarded-Encrypted: i=2; AJvYcCWg+26nUxBpmcRQZ5dHHh8u+RZ/e/ilF0Ms+X7ZRyd7OxGRwTXBLS7wnmyz2cBgiPTJYnaYVk0/EA9d+XjXCB6xU8OjMSD9A+TMGhPXb8obK2Hd9vuVrwqmv1dEdQ== X-Gm-Message-State: AOJu0YxWrDunC55gIXbeUQJKPUXCz320K2xd0FqZBaIdEfUCRkkyNHip +V1TkqOB7C9gRW7CCKKMo5lLULuXWeYDnPbgLxjK2mqjGVIFTIS2YMyuvkRAbe3Cqg== X-Google-Smtp-Source: AGHT+IE2NY5lO4QUlxJuZPcR0uwhV8qSLjHc5ky7DhiYzSR6XsBF4oGZOmg4I0rmuTk2ZfGsVnIl6g== X-Received: by 2002:a2e:a792:0:b0:2ec:63f:fe91 with SMTP id 38308e7fff4ca-2eeb3181609mr146350841fa.38.1720941042454; Sun, 14 Jul 2024 00:10:42 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a2e:b527:0:b0:2ed:35a6:458f with SMTP id 38308e7fff4ca-2eec8da5812ls14533651fa.0.-pod-prod-08-eu; Sun, 14 Jul 2024 00:10:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfHeQmjiASqf8MFCDNk1R6Ym8QuLsQTa5cbWoFP0OLDrVIsPeYcrzGO8MiJ/g6t0829f1xcGr81IcBHSYxMue+r+8Ha5LDCzFesY9JwHSzatqN X-Received: by 2002:a17:906:d29b:b0:a77:c330:ad9d with SMTP id a640c23a62f3a-a780b8826cdmr1143186266b.61.1720941039338; Sun, 14 Jul 2024 00:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941039; cv=none; d=google.com; s=arc-20160816; b=h24k+ckIFE1nmsYlA28dYEy27Wapjy8ekfsM2bWuujaMm2QG6K62nz7Kr2llV6EAXe IVOXJpP9F3OBrMVxylJNwMWlN5a4lO8PjVaikMHIBii/NKrjCPjfCx1DDFUjU6JiN5Vc 4+JfPJYN4jkM7v9mBFEt9s88OemEdrWEZNuuX0OGeO9WCL0zHfcKJPwqMJpDq5IbV0Ha NFxqHcPMm6vbud9fpd7P+vER+ATOrumdqXaXsuMg7Vv2BbyVJz+dFNkrjeDUtmSVZ5vS torxtk4ARD9zlKwd94QU/kxF7+9xuaOtIpyjO5rg3IXesxxTOgggOScXtGgrQxXiQm/X 2tWw== 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=KwmSWO14LTBF9TCC0iVmOAUqEfdJApxV/800fXUBf5o=; b=qybT+ekCso6HQkE0jsIMjjyP7jZcrICZGdv50d+Ck4Vo06RHJM8Z6vPNrTdKyv0Zam LGgM597Pp+LTDDzlCIzZlTbLIdOEWLcC3uu7KZTRW5m4vtgjhtY2+dorrFw+qp8jFi53 2TlX7XChOFP5bXE3ZemW0o2KTbucXP8morm1H6aRH12oJzhUjuw7+iCRXXpTD1kXB7w4 K2UyjBlZDJWaFwBOmp20+mrP1MYOrnQWSTLzny7rMgnRL7046XD9f5rZGqJj7yIEJxbb sSqg++bb3UUxXCWKud1ZT5BqSc3BP2DYjGN2gaOVJe3ihaWO6IYr2D43jSNaYmISiiip MtVQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fmv7rG33; 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-a79bc592984sor42598066b.1.2024.07.14.00.10.39 for (Google Transport Security); Sun, 14 Jul 2024 00:10:39 -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; AJvYcCX7YCcolmSP+n1fqqeMZxXzRX38ui465VpWgS+qJAgMiZaEI7yPodrafeiNwDa7vlKfgURF9h1hfuDa/gra0A/BGt7KBZ6FC/JJR057wI0jRh31 X-Received: by 2002:a17:906:4a59:b0:a6f:ad2f:ac4b with SMTP id a640c23a62f3a-a780b68923amr930210666b.2.1720941038913; Sun, 14 Jul 2024 00:10:38 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:38 -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 09:10:08 +0200 Message-ID: <20240714071023.10417-10-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=fmv7rG33; 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 07:10:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3243 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 6347F40F59 for ; Sun, 14 Jul 2024 09:10:42 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58c98ce7d00sf2709918a12.1 for ; Sun, 14 Jul 2024 00:10:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941042; cv=pass; d=google.com; s=arc-20160816; b=ODJMXAWzNAwZrOtNPa8SP0icpI1sZpQyemyH8cnkcumwvIQV1CXx5Glz0U+rhNzJyL JCgYluQryQ7Mr0HoJrEt9sdAldnKRfP0Fcle7XM2J2o33VsJdXDwKZAA7pUsf5Syw/SF TbscUeyH8dtsgHrTGYYLzfZsp76JW76wZWLL1kxKtxCSOFqmHmgBdh1pT+64PhD0f4Hg +tIcQwfhhohdTqXFxGjJRMt8MwJ27A4l1eCAVihwNf4MEQIBeKjUc63B9UXPyeYyoqkE kD7svI+FNKU1HS3b5N47Eu9RBKb8BVDvSOPFJH0m1xvQF0/HI3xif4tZDRvGE0znIz7D Pilg== 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=WjEJvYg7fnYZ/XgwH2X5k9L5+m1sQhgGWv8WIXq0m+s=; b=LoSB6go7nSNpQWjPUxoxZSU+T5qBGcTlF1hki7abOouCbHSF7wKs2lWLcDhJ0lcgJX mr0MJwx728i4bx0K//GJLb1i54i6QE0gi7gfYvoZV7daEPVxe43ku+TBGXkk1ho7J1ta aIxV1YGdZzwaDwJOCeC5FxOIX0zRqZohYAUd29WS3l9zUqF3ga3/0YG2HIdrjTVl/OSM TF1FoL7c6ERz/32ytcWiG3RyR3YheUQH/Bne3qlm4m/ki0SlqhGG07CdJW1GpgBsTXEr sqtXbdT8SM1MxO1SslGjdhDNfOdeZxEkyG/uTeFlZEjKB4KjzeAQcywJC9cYS5VhNpOG SCgw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=O2WODHUx; 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=1720941042; x=1721545842; 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=MZGjYTDeuLG2JjSwHZtCrkuycwMmYoeNx2APZMrpEWSe3KhwWyM1x+P8qLg4Aogdga MSWq6z8S/Cf/NINaMaiHjw8SKIdTqQzIXMjZwaYHe1t7oBwxJm7/mAybUH1jjw0JsANl irtTeRGaDvoJ8xnthHREbFYL0guZ4X8AAKL1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941042; x=1721545842; 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=BIFygywmOIHZ/gTZiSgOfh11uba6KRnEMiVKnKJg7phfiP5Lh1blkNzbbJgqf6JVCT R/bkFt9Hiyi089qLtT35GSENTanAHVp3hrvqAPhzs7qVKHmlQISwkGe96ik9diRJEJj0 TeBpx41uHHpdwfVk0R3Wa/yxkoDqqDFS8wD6YK0U31AB/0u9J2MO1QJnN7p1xWZZxsIg DpCKboqV1TlUdzVr8qrBkuGfhxaBAJ8e36A0dzV3/e/z1Oa0oM/yHGRwqbCHlzKijt9g oW8gGaS8gIYwEyoI1vnQJIBrw8fNh1P74IVLTSXXaWRljOXDUFpNd0bTgjB+jihJzHyU OJ7Q== X-Forwarded-Encrypted: i=2; AJvYcCXjAvddw759WiEnSmcUmkR2/DTyHdTu8Rc4PVp+R0flOiXEcyvV4mHUbE/Zl46Jdjen9gxWi5V8F1MyVkTsTG3Yr+O9oiUuB0Lw6sAULvb8xsDneOotfBaNRAwuew== X-Gm-Message-State: AOJu0Ywcx259JNLAy7Q7/k1DzOOWEm+OLnQz+c/Ljmls7pps9OkxyQQW F0RNt7PahHVG+hSz7lfexzakVNHctkyIC+QNPKLcVq6aH0J2Ay7KONzzH8NEkNWgkg== X-Google-Smtp-Source: AGHT+IEg/XbYOcPyai7jLuYFrpWXSfXgj6vrVRw+IDKPnZHQr06HEmav+6leU2X9ZMMTqLL6zIPTcg== X-Received: by 2002:a05:6402:2925:b0:57d:46f4:7df5 with SMTP id 4fb4d7f45d1cf-594ba694c93mr9328932a12.23.1720941042147; Sun, 14 Jul 2024 00:10:42 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35d4 with SMTP id 4fb4d7f45d1cf-59821cb697bls1605494a12.0.-pod-prod-01-eu; Sun, 14 Jul 2024 00:10:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVlmNAogIuEs/0XNEsuek3LH8l5MCDUTW7jqfqulUztN/bwn9+2SpMt1J61C/teA6Q0P7QUFj56IpLePQhn/zioxC48hx7uZrcTlcIe/JMkzO2m X-Received: by 2002:a17:906:311b:b0:a77:bfca:da56 with SMTP id a640c23a62f3a-a780b705409mr1031498166b.40.1720941040520; Sun, 14 Jul 2024 00:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941040; cv=none; d=google.com; s=arc-20160816; b=CiHUkBRwd/MoaRcwteIO7eHpM5QYiye87G1J27Nc4MwhEeFq8dJEaUJpzYLWm4ByXV mh9YRfOlFN+vk/E8X3yF00OSU0JzdmxuF1BT+dALcMlvJ7SHn+KdFrqyjWrZyyzl+apu 4PKTNAuLLjRo8f/Hj5F1ZEfBwCk2GuaqcSd5rh5V34gIcFwCL4f7QzpnLINSUakgZzRP lF3UosBcgXV+ISshawy9D+ef1kUfaVnB6hrIx8R3sL8Rb+glNQuS7nR6dfC13MzcZjyg 8wCZlZ/tHSziCOTLQb5IsLDsYYEkVyeebOfkHU2RMh3DLpLKyoW9+VI812KdpssgBhJq 0Cxw== 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=q01n3OcuKeKl0/r8AXXOX+Afd4hWHKI9zinz7COpJyo=; b=EmqsvHo72tK95uBfo3jH5Fvn3A+xRaYI+9aKC7QQfMVxfvZ8dgeLeBi3e/5B6u5Iza HvN2WWwx6Uy5TU1p/nkkP/x/yWo5zI9ONHSav2W5TFpkwIBqyyZafE8I7Tq5mcKrUuD+ 8f08XLV9dZMaw/rcSYOif5b033l/YROzf/ZCY/yjGfZW9dTbY78+48LeG89ybxGAo6IR +gtFVGQJy3ihKCcgmuJ5Qpf6onMzfnMEwWgcVaQwMOXPaaJyuA+EJgLGWq/FS5SpxyJg ijtevYNhlptfYh3kiaho2dW2/PHKFlso0sguZYq9hZelRDTGDfWtfRqfID9wK31VYNXZ DYnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=O2WODHUx; 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-a79bc884c58sor42667966b.5.2024.07.14.00.10.40 for (Google Transport Security); Sun, 14 Jul 2024 00:10:40 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXcRkYfIlgm1z2rs1wE+MTQ0b07TKv40PqV8UMudd6IZb9vFqnpXY58EI6aIfhOSF8ri/ntw1JWXmJX9FwyTC+DKrXuTWxGLu7WgKOB3tEOMmms X-Received: by 2002:a17:906:1850:b0:a6f:4f2c:1936 with SMTP id a640c23a62f3a-a780b70525fmr1080160466b.44.1720941040100; Sun, 14 Jul 2024 00:10:40 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:39 -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 09:10:09 +0200 Message-ID: <20240714071023.10417-11-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=O2WODHUx; 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 07:10:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3244 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 44DF941497 for ; Sun, 14 Jul 2024 09:10:44 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-58b3fcf235dsf2642676a12.2 for ; Sun, 14 Jul 2024 00:10:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941044; cv=pass; d=google.com; s=arc-20160816; b=TOdhUAA86knZi32aAfX2cILacPBsgVwbr6tl1WQW+rQ13rvOSKJR5SNURqdNT3BbfJ 8HW3ikCZWFExkr34yKChENW94AsAYOEmZIeP74dIPu2VCS+D+k/p5lhzH8vFT8Br6KCv up8lvIXPV7NitJB8C2xgFAcQMpzQYwrPEbI9phSIojAKObnGT6gFcs5FGyuR+G+2EbXk 13qn8WJlJD4V+7dQR5Ti137sWwphmYuAjdhUWT7VDZa/Ak5K0zmIuHd6cOJI4QSg3Daf Ds0KmH+pH8d+8mODx/BaVkh7XGLMV6qLj17zhUjjt0dNOrV1uRW0QAUJGXhSeTjACP0N Bfaw== 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=CiKzGiPu3X2IkJpBJDXoC8WzJe9XNmOXuj6rBYJ208g=; b=WU8tA8ZXfwxsTpHBcO87olRDHGhn4KyOWtKK4K1rRxslqDPn9tXDQrMMc4ovLeXjHo cFpj/i+8Zj67Puo+TYWPT7jJrW1+uM1Tz2JLCVbQitoKl0CKvShHALnywP7nA5nkiOk2 6ecHBS13KhxPJMN1SD9/b4IdCYzBPw5LuxIpHJqJ++TwgWcShxT1YPLGS8pbIySD338K Hpq2kONngfM0DZYHzudKNA0HXqWfT+aQCfgJOgQgezQil+n9n+PlxkK2iwIijLB9s20H AVGU4vH9Or3IQqzUmsS+eq7ZMOkOjdNoA7iSDjYVkqLC9R8MMnkJpb/MmrO7EWptP2WA W6hw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YgbA6eNQ; 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=1720941044; x=1721545844; 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=oZQJysRnDocUfcgDChHskPDGEakh5aG7sOlYXe0151uhzN09VsUl2ZNapi3iUA5pF8 LFfXgh51+nQdb4OOYpKdd1b8wELEyqiQF+eCJfKCbiCWLLXtB5V3ZVLW1gxvjU5hWKeP pDwdXR09WkKo/Tte7JVcMlGojYFheM5yLByVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941044; x=1721545844; 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=TMR95vssJpQszRquNKeL9weeQzghuSe875OFzvsoNh5eNEFWHp/B54g+bOigs7QXqm skUNgB+uUQyComSw5he8paTgKLmH9TxbWr5WH7Ee+ZHotQ4WcUh+7vk7Nc4quMVfaTth YzcHXui6Ve0eOM85jKWh04dZVgKAOqFvcFfcTcUpW14UV7Ec15vD+RstdxPbteznRm9X lObgj7wk2ZIWTsk/eMiC5pMO7ud9zQ1ES2evGqDVBdwRWXUEj+0kzG/FI3/8UD3yZIMP 69SrMlShmACNS85VWBTHAxzUarQhoMCCj2uLFw7Doxr9lqCq3GI68iSsvR2rIQctqXDe kxJA== X-Forwarded-Encrypted: i=2; AJvYcCXIxziyvt6Ih3PnbIAWOF6K4TYlWut+DHvcH8WJGveNyODty4SqOeZvNtqlEo2XOgM6cWG32ltyKKf6J3aiesiFqAuCJ6N8g65MUlhz+LK4i1GmiUBDUxcrd5xmKQ== X-Gm-Message-State: AOJu0YziflAm6W0fMsJN8p7L+AMZeisWGn4D6Di4wBTlD12Ua1QxYQCt QTxmafhaXomY7ZeQH6zT5FkZ4c5DcTgfWJvdg/tr9+VxswNSrduRN+5nlzqw536Njg== X-Google-Smtp-Source: AGHT+IHjILuRvJfYtRLyuaxGbprli2MbBRwAksKOncZ9r/SsFFowSUGsBn0lnamma+sL2dZbNd3yPQ== X-Received: by 2002:a05:6402:4301:b0:57a:4c22:bd with SMTP id 4fb4d7f45d1cf-594baa8bb40mr12014761a12.7.1720941044022; Sun, 14 Jul 2024 00:10:44 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc94:0:b0:57d:555d:8ddd with SMTP id 4fb4d7f45d1cf-59821cb87f6ls1686845a12.0.-pod-prod-02-eu; Sun, 14 Jul 2024 00:10:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXkJAxyYDVxGERdnvRBADs11etCeM4ozAWVdPqDjVQaNaFQ4odrvbZTV8XpyJ734x0obE8Tayr3K1hECvBdG+tN6eglRk54hbKBuZRe/pcNcF5 X-Received: by 2002:a17:906:2ed4:b0:a72:6849:cb0f with SMTP id a640c23a62f3a-a780b881dbbmr1017999266b.62.1720941042293; Sun, 14 Jul 2024 00:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941042; cv=none; d=google.com; s=arc-20160816; b=UO6nfjBb2rqmhWlVWve6gEUz9PdxxDe+qOwlCoGqwthuM1t8NNeT2CtCmR/rk4xDRy IxhrhoKXh64OMvBPUEM3Zu5uHq3x2r/sZ6OkidXYeUxEuxJFFXrxLjHcZut9dQEQKoJR Lv8ZduHMWTQvaXnB382QCy5mLYlY5qzdEDwciYtB1jY5TTaw651cU+3duI1fDgYWMnvu jOyiurWdIqnZ30a0vqn2yzQOyjZKjhEwCPQNUAaZztXTRXTTEc1QXArVVXQOFowexAqB IFMiy7NMPkTeJ5dIG+zcyCs5l3J22DMB7lwiBTyyBMApoSNIHy8qBAopjhPPMXjbNSBH aViQ== 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=alU8NCszoLKs55UZWh+B9/hGGfEx4hP0uUmjH0WrIVI=; b=lruGtVgBJU7fNC7/Dlgnxb60iYqHUmXSqUuSobT7P6ikNojvlyzLuoMz3QqW3jb2e0 7KQxCYSweTkp6xosABvYRZDgcAxpRkgfjUcbNG7wAz20xL4KuSziFZNGNPjYN9lM2njS 8Cmjg1iTPD7vs3X2XyxFnE6vb36iADiwk+4CUWIpdav/w8fmSljktZOyewMFNA37kKQt kP26I7V6geM85J0o9heMidJqX7k5zRj5/bvw3yvshN82LLZRI/hNvSChQzEj6cE9d83F cCizmhLqV+WFeA7DPG9tzSSeX7Lsz+F3wEHZOmsrLH5W6YvVMJHwrGHX5w9jr1sY4i5F gpQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YgbA6eNQ; 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-a79bc86319fsor50244766b.1.2024.07.14.00.10.42 for (Google Transport Security); Sun, 14 Jul 2024 00:10:42 -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; AJvYcCWvbsWg/U8n6W+EDcGXmXEDCKC56NjgJ2bV99ObwfqUvTz2Fah898CNwdFFMUY2VHt7grGnswPaWYyNv60D6o/8xCHVSkqajlidULSKsR98xUVF X-Received: by 2002:a17:906:57ce:b0:a77:dd1c:6274 with SMTP id a640c23a62f3a-a780b89ca67mr968712466b.69.1720941041924; Sun, 14 Jul 2024 00:10:41 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:41 -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 09:10:10 +0200 Message-ID: <20240714071023.10417-12-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=YgbA6eNQ; 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 07:10:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3245 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 BFBE7412C7 for ; Sun, 14 Jul 2024 09:10:45 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58bb70e381bsf2848743a12.2 for ; Sun, 14 Jul 2024 00:10:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941045; cv=pass; d=google.com; s=arc-20160816; b=k+Bv+D5VWbz2HGbpBDqEr2kOJz5HyCh5LUx0AWqclpLeQpF5ozdRIufuBURUOHFmNS Mxrce6cWCcGZYrc8adkugRCtVe46LH0HzwjrnZM/7T2VwQcK4O9Lz88IqeantOataVuU EHdQoube0bL0Dzq0VdcJa6e5BNyphT6LCyVO3ailufx2G5incEapzy7utXZq2OULMdi2 CwmmEVQDLPnirQIqVfwGEbal36jqy8NgXpVv73BHxaItru3DvTJS48ZA/UmnFcrG/DXG N6puTr0gVaQ1h2vRhwe21+ku1Bwo89j0jPTKhg4OwMDtxSEPhdHhBswNzUfCyEXThua3 hZjw== 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=khe97kqCcw1SbW2HDgf+dYhsilaOhKJWY5KN8N8tlfM=; b=xR4Dll4Ljgoal5AfjgqFouHRnPN+7k/rSQY19WxKnAh8y+k2C6P/xKsipBoaZ/mo/h PNp2r2dfDnmd+/x6NvECXJ8hX09DxoxQpYhVHbt7G7P87yBVqF6EgYyJOniehYVaSmt0 3mxFlvFy8fTMEhlkiu3aVewSeIY/N7YORm1VNSfv3RqWXP70IC3rYFnWqrk/RHESWC6g J/Z4c261dXhZ3s3T6H+Fw1tqujngapj0kjlC66YUdX3i99/9Sjz5/NqR9YBTb/cD2wRM ntkf3GyP4sgev9pXqeB+EoNRnE43otF/NKnpA/3olN9kC/RVctT+mSn+Ovbf1lvXYbph RKFA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A3Mu3ioG; 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=1720941045; x=1721545845; 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=YeClbumM9cS43on3NZgUSq0miiCq0hNBATqEDrhyOUb66Ng7QDMYEAzcmPNlfSLF9q OEqPZ+xbMLmKSIS6dZ1paHrGJR8z4OF5S3BHVEXNNVLZI9CXlxoZmbmDukZ70oU/O0S1 tO4IoIhyLKdjlIv3cnIF0zE6wQHihStD/tjjY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941045; x=1721545845; 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=Rawp/IJ86QFn1pLa4Td7Ex8j4BTIn1JLUFLjigea6aKLJBAOtgp4HSt1zSA20Spn8N vW0JOrCKgVQcPm2evKLHzA6bEqr982ExOgRaV2McDaDu219jhYirm7ZWQttTjEnm6rnc FX8DIJn+g8vQ5N2RO+FqesQrJgz2isebU2cYr+xYU66b9d1dk1p06UJnjn5wgeBBqR24 OHHsNMV3hsZUzdIzlvNOnolzZN4INIvR3AHiYXwasoTKOgFTVeBIKYPqjqRiQSnITz2X 35RXadUqmFo2kfD+9id5XB09XrkRVRxABNai5tS9EdozTtC+xVyR0qNKQEwnsMZLOlJz vIOA== X-Forwarded-Encrypted: i=2; AJvYcCXroQHTtXu7JrAdaLyeKJwD0ooxal+oNLzAStw489BVqcxhuDo8XFp7gERVSNCLh93cUg82B3C8vg7JrBqX280ZMrJztAFQMNs0p4k052W1vdE7nWuCoo2VLDyiFQ== X-Gm-Message-State: AOJu0Yz4dxjfvcejUhUfVvEgowFa7x1EYrDwWgFNRAkdKJoZ7Hi0QwJ7 luNmpFErYGAzYBI6L2gOwKhztMmlCDweCyQKXcTgolEZi1+opkRXCHRGE56IJp9qMP3uRRBvuw= = X-Google-Smtp-Source: AGHT+IFQ1NniYDiQUzUn4O3mwXw85igFUjCculeCHDHLBJOF4y7EdbXqD08JkAU4PV+ulWPgkGmtNQ== X-Received: by 2002:a50:ed93:0:b0:58d:b529:7dc3 with SMTP id 4fb4d7f45d1cf-594ba59f8cbmr8794559a12.19.1720941045525; Sun, 14 Jul 2024 00:10:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35d4 with SMTP id 4fb4d7f45d1cf-59821cb697bls1605506a12.0.-pod-prod-01-eu; Sun, 14 Jul 2024 00:10:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVbPomQ5P58pUh87bpDz/3y26OTiVqHxLkRpI+sP1TAvUmBUWDgIA9ay5VGD0M9ShVKgM8MKuGGdKxBOp4y6XT602Tke2Voq6CYBjg7Q4MZb5Bx X-Received: by 2002:a17:906:c8c6:b0:a77:d85c:86f5 with SMTP id a640c23a62f3a-a780b884b5dmr1017675266b.53.1720941043880; Sun, 14 Jul 2024 00:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941043; cv=none; d=google.com; s=arc-20160816; b=u0ZUlzLSCA5ub3/XxWZLln4c27Z+kEFubmDjuw01zKwvb7P19/97LWt55Kfi0yHxx5 o13Fq2i37jtHvP3lN43uS2cMcCUEszWCJoGL6xG3Ss9x1tREjlSjgDiqlB3jFOiLq6yL 3rbkIec8Meg9gwn3AdK5ZUZTgf4CKypcri2BvAMMGLz6XmuSaGfU2mjKy9mr8ia+wPRn t0N/VVeq7bGTdWaZBmC239fXG8QpOqpHML6xPKBLeuwZxhxuhvB7V7DQ5TB5E3woysZS r8g6heieGfsavh2PbAITxNwoVGBzkexPZ2Si29vNGX5q4VyJOFMbliJa9CMxypEUjwDh lGsQ== 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=uzdoEwRtySls0V5JUqKFcIEIKfJh5JSk8ZXKNPBn1tI=; b=NhVLy6IxLzI4oPGVVIe/S+CpMZflI/YbwQ+LjbY80VKUAJgy12b8nFjIDRb6OuM97w AqFcsgfxQdaS6LoDzh2ToXYUAY0EyO/i2dK09hYdxG0yXAu4vjaJWdhdOteivhoLDGtZ cKNi6W8l3WC9vwCqjZ7n7L/o++LvUlW8xjsT8uJyGCR2qcRb1p2zglYrDiODHfNUUVZw 0KniNF7Xma6hdQ13c0xBI8ZVcjEqTh4mQJDpqz5mXEyIjbw4x6Dt2E+7/h84sUIS+74m lChGchaBJQFCysD5wWza+UvYpDpL8652ix+wprB9QHoeR7d85NPQeWZhKCE7hlLOnXbC HIjA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A3Mu3ioG; 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-a79bc885e67sor36831066b.6.2024.07.14.00.10.43 for (Google Transport Security); Sun, 14 Jul 2024 00:10:43 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCX53ekWk3l5iIGf/7I0v+4etftcW1evipjNSanicsXYc6/1FX1mZiTLJZQb6LnzkGcAMbvYnVZGXs8eoNy55fZpGuF6klTmL976gY9KXLyNeeKI X-Received: by 2002:a17:906:1850:b0:a6f:4f2c:1936 with SMTP id a640c23a62f3a-a780b70525fmr1080168266b.44.1720941043402; Sun, 14 Jul 2024 00:10:43 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:43 -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 09:10:11 +0200 Message-ID: <20240714071023.10417-13-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=A3Mu3ioG; 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 07:10:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3247 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 59E8540F59 for ; Sun, 14 Jul 2024 09:10:47 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-58e66895fd5sf2635884a12.0 for ; Sun, 14 Jul 2024 00:10:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941047; cv=pass; d=google.com; s=arc-20160816; b=FlA0nNaIpyXqcH39du1gKw/UmK9bv1bM+DNm2qduorDYZUXTnKTd5pxTdVIP/WIK65 F93zZpQQtU8uVweh6bbSx1C/JGFoS5UQq/vbAUckxL6Shufb9jI/Gy2UAku54pxscwl+ qF9/NRUE1krhPlC3M+DwrESvOGNaQmlHBKN60Busm7zkdIsrUk6PESFJDOAQBrZJJZfh Zf6scswQP3Cn8lJptpEU+Xi1QIdDhQg3NDx7E7IBM80Z47wjuL9LkJgLdlcd7SgsqC2s iWe2Fiq0u8K0/coFCPYymo+9sJaHC2Xa2QBI7z7uhzhzzU0gkZ+Z8fGpihT1R5bVlldX TdkA== 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=s2EFMKlxb/ukXKrU8AiONMgezdp+E5/2ydc9+AZ4CKo=; b=M5Zl2hynLknnkPtlZTxG4bH64UsJMj7Rsl4zvhMQl/sPH4ZbslJrNQvu04vByUtQdb g5kTD9/kgGrXiFLIM3T/lU/vzPQPJRNR02bWZdR7so171e8WBteniQFTqZwFfbewSVbo xvNPK5NHEQk9FkxO3uuX2fCkRms7Td0c4I7qRU/bUgxg5P2cmJgeBODDwOKSApaZSfaZ cYeitK6EH+YXG2fQK/ZfR8UVr/5Asz1yTse5l1zTH8qOHak+KPaPopLocJoVaTrgoUbz 9qlK8xyG7WG7X6J/c0O/bNTisqxgAMeAVO234mHHEvLcN35VxUbNoRRsIs1T6njDS00M U6cw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KnEFn2KX; 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=1720941047; x=1721545847; 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=ENGVcKcrTc0rl96YcWy/Hg7H7pgnXF1oEHRy+VEELBI14eNPQf41iVz7lYeosz107N Vr8iZruWzi02lIMtQlaQqQ76m3VVi92YlBBuwlrltY8/aGa8lRIJxqsKqqjIEYgMk+GG BPKnePsnbEfKiKKCUZSDSnaX7ydc68inBdhzE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941047; x=1721545847; 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=i1s4m8Z/ejGAJgqtsI3vsr/A2RvLwE+OsggYm1Ac37cv1tKIvObNcjL1ktCobWo/jT V5YpTSpsVc5e19ZbLyh3YtUYSADedqD0bViyzzouaG7+HYP4EtV7A3Aoz1VfyCk3A6tB ocTME91SvVVOkAXt16x9x3ohQrlW8j0OZ1TOU5mYptS2nqC83IptNn2PpEegChypDMtF CmQnT55KfMvRHJEcOSC8PfvMhCuI0Rf6mnUtOXQO/DlKfBKu9wvGznZF2oLpWNa9t2Y/ YofMKI3FwC32hEtg0REKqelEqY55XakxqkSu5BEsNdH05prUbGKjfDMXi++o4QIZ5ali 7UHQ== X-Forwarded-Encrypted: i=2; AJvYcCUgTF57B6DCpevA3AfPtNHyG6HDUY5RYCjiNDudA7Uk8v6y7v61jaV2H74Qa3x7BgWwXcyADHn3fEHVnlOvvMP44wYa/EbuoJILMQrE1e6/QU2sJ3e1NDXie7oMNA== X-Gm-Message-State: AOJu0YzAl1Tqff2y9soGCgoIWTvvdh2eTbgwIQbcWvV4cvNXAiZPedDp eW2dg6lOB58a4757pE5tsrIGzvwduMq2Mq3bX/L5p5vVpASD7cBiNpmFn8Ei5Eigpw== X-Google-Smtp-Source: AGHT+IHTCIeov4Mq6ILPFowdPL5XBNe06iVdGnxKnJg6X4+WwCkpgTdzeZ3ShTJAFYX9bhO9tBJtbA== X-Received: by 2002:a05:6402:288d:b0:58e:2f0a:d5c8 with SMTP id 4fb4d7f45d1cf-594bcab1593mr8552021a12.38.1720941047040; Sun, 14 Jul 2024 00:10:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c513:0:b0:57a:a655:87db with SMTP id 4fb4d7f45d1cf-5982622e1b5ls1517060a12.1.-pod-prod-09-eu; Sun, 14 Jul 2024 00:10:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOrYhiK5IepUxXAJ619k42mq6V7C7vsnKCJ/03wyxOfviqak9iPjjtvRcyRfDI5uCPkYObrUah/r+MOoc2qh35E90gPjSfruS1HwA0T76RGiqZ X-Received: by 2002:a17:906:4a59:b0:a77:cdaa:88ab with SMTP id a640c23a62f3a-a780b68a52cmr844384266b.15.1720941045259; Sun, 14 Jul 2024 00:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941045; cv=none; d=google.com; s=arc-20160816; b=jjG0xD+BYYUFjNjtEkKgymYP6qBJyd3wPVg5kJzqTKV8vdiE5zuTkkQIh8aoDYKgXy jVjKPgsQ/xoQ61SmhfHe+1vkNGjYupT1iwsE2HHUNRCmNqZe+EKSEIot0DCxGPEFjT7Z 5lk01IpCt//aLT5ucYXeE5n9Hmm7bYqcApBOS/R4RcC1M0QS2CzUpQajLKHHsPnKBEEr z5MSInJKKnNm2t1zpuFelL39E/detlPEqyY+QjPpkVEOcmk0dIcEXoM2PsL/k25QXsV9 TgzWGhkR32VtC0w6H6auyTOwZklQKeiao0vUE358TowytMcBmHyjc1Hkh0IloiA4rE79 XvNw== 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=XO980y7dauEOqR/dGt/cqt2XsaYdtfKufxSYoj7rbOA=; b=ZCxUkwSq/gj4Ggr7dadeg1z7GH3BefvJ2+PuAsiR4MehTov4fHVqW9yjX+10KpLm2r 4ITXwFdqhp+H9JL+wIndrvVYWqLW/Tx68TF8Ou1pxHzKd0daKvdGr+pSmcTEMQEx/ufi ms73YQBxB3+VVF+Zcek3QhMkpXdt5NyomyTgTMNFbENsMENzTx9UDfbf/BgSVIwGaUr7 CMkGVZ2B97z4TQwMCyL6NoJFFP+xNtsd4gWWCeGllKg5WvfoT3LfM+CMxl9GWSr/DRi4 k31HXp+dwSScZfcQw0AH2yjldYabNrSpYme0XGbGoaoKjwWrfTp3ef+UF4kEuA/JC0iu l1sg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KnEFn2KX; 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-a79bc86ad29sor61327366b.13.2024.07.14.00.10.45 for (Google Transport Security); Sun, 14 Jul 2024 00:10:45 -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; AJvYcCUi4NBy7SPCqWYlzTrFyAnzCBhU2kkfWB0SH2oXHogjCuQhxhjKXVUpVSZL59Tk53cA/7xw/5ydZvMBvBuffi/WnYPVImUFKocBlMkdURKMORgW X-Received: by 2002:a17:907:c1e:b0:a77:e2e3:3559 with SMTP id a640c23a62f3a-a780b68a332mr1121904366b.14.1720941044774; Sun, 14 Jul 2024 00:10:44 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:44 -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 09:10:12 +0200 Message-ID: <20240714071023.10417-14-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=KnEFn2KX; 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 07:10:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3246 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 5406B4130C for ; Sun, 14 Jul 2024 09:10:48 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5998e08a7e4sf1795590a12.0 for ; Sun, 14 Jul 2024 00:10:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941048; cv=pass; d=google.com; s=arc-20160816; b=eAxds+vyJ3ajLjsHSYUd8ARlR2Er5LpUvvtlra9Ta+gkA4N9oqN+pGX/7AMBITMbj4 R9qr6pEj80gxCDRRBj5fZhoTTikShHIGKIsJTbRRBolMGeTTnvtgYq92fUpytyYPb2Wk D8Lc4gDR48yzohxdOAYpW1NdPjyP177qvRcCz2vINZxoa09jTTvNH14e9p/ggoBczGHx 8jkufZFoRCva9SQRRzcio8nPYX4i3ouBOhWRyekJhqCOvdfRlvC8zOTzQWd1ehMIRuvi vA7DNrmNK/FdydIvcRIUMv0GxyEeH07QQQRq538eg4s97gXEe4LUl81wS23vSTi91I+/ nOag== 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=dsH41V6NlfsziaTSy1WXHMNNv3h3uvdScHk3k+0kovU=; b=DTgiQJqKoa5gKb2USA93robirkooa8m68bcjmLsMlfxPu4dqekfcxO2KGLkIfDQywe qIU5x40XAFVp7fw96jq9OFlXHDa0DOXKEdIbKttLuiFIBtDtzBkLz4PbUi+2RYh3rZHM qeiYNG2zCFilCaoxhzIz83MI+y3sK+QnOrNwH2sxVsZdpd9C36CogL0gUOEmPQ1ZMNo5 caAb53JCkJQYmj+0+1nAOJ+MLFyeBucxfqvf9SwBlBFpd6JBvLwOalh3V6GpR1YnofK/ Mz3mYJOFee4t1qFbiZVkhCyZDQKpCDWuqteEWtdPkK7KuzpH/c1P4BG2h7JbdAGd/0r5 uSQg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=nw6qteQM; 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=1720941048; x=1721545848; 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=MNJSdRqEVXhIyITSeSN65Uo7W6EJ7ybc4lasuBb55L4D7nUnYyQdOipoppT6RpwlcY X58QjFAuEuj6zwOEl+uTPDt8H976ku6xLvrg5AJb1VLhs+or6fHz/T82jtxImyPobhQg g13srf+oIWFXWL0q9SLxxY7PvDLL1R/aMrwHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941048; x=1721545848; 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=wdiyCvXH5Gh2uMuBMaVaj6sD987v6wCMg21QtKRrlTeOk0x7ED+pkwufOq8h6IrfhX M6vgMzqIEmFjiAUc5yzoGEqq7p+eXYZkRFZMh9LvvOMgjSPZgtVzPY8nBfomik7jtK1O NZ/v8LkAnj/WHuifMRVqg+ZEG0m2CbpfG2wB9GOKlr9jIsLkeBfamxhTm4VPi/qriXif n/MPqplW5uYnheaE4OXcFrYz4anDvlJb9Bdn/TbSrQ4+HS4A9kIbqXrCeIfyGAzszO5R YxYPLlmXCyKsVojzkxVzokzM37mABI6w7Ip3cpjCBmAASIFkhQBEx1iWijsDjJdcOqCb gV7A== X-Forwarded-Encrypted: i=2; AJvYcCUD+hSRj1C6932gBRxx03ok9yJocMrqlgkSkKBIfvACG+nrDgPFJwJsJN1dbTccirsGCaUgZvI+Ko/hN1CJEx3u52942+NBsyB2CAJi/ibWT9ZEaR9uq/trctN0QQ== X-Gm-Message-State: AOJu0Yx8im8PaoGFjITpbogS8+5gdPOdR78F7h8o0db9JTMxvUB8zw/X X1PO/ZF4RY/x7BgKn6uWLvUlKaIE6s8VeFVxsj5osOXKCNQ9ri1PzG0VkrHCYRK63g== X-Google-Smtp-Source: AGHT+IGZWfxYMKeJghybkzUBQ9zXfOabXIJ5PQUsdzp9ii//Y+Z0U6s6VB11TyIi183m+CHa1YGk7A== X-Received: by 2002:a05:6402:11cd:b0:57d:2db9:15e7 with SMTP id 4fb4d7f45d1cf-594baf917e8mr14682302a12.12.1720941048038; Sun, 14 Jul 2024 00:10:48 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5249:b0:599:9c73:c38b with SMTP id 4fb4d7f45d1cf-5999c73c444ls979361a12.2.-pod-prod-08-eu; Sun, 14 Jul 2024 00:10:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXciXCWWxydqvwTCp/nxEl+LpzaG0e8i7gMKzM8PXTgljozg4e6oIlB5qObEQAsDAFywm3dNwNOMZHG9VCuOSDVaD5Az4BgSYNWHaa/95Af6Dex X-Received: by 2002:a17:906:1388:b0:a77:c4f6:9f9b with SMTP id a640c23a62f3a-a780b6b194cmr1149169966b.26.1720941046396; Sun, 14 Jul 2024 00:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941046; cv=none; d=google.com; s=arc-20160816; b=VELRTiN4QQ2mUf/y44gDmLnu7/uyZjURhJLGoLyMurMYI/H+ntdhz++tZUGEIPH+9P iCuXqOdjkk2ths8avhhvZONlIVYrB2SVvruqDsN6n5aNbri/ZopBt+91cSVTSAPJvZgC h7IONrqaV7cUs6eUcpxp5/fp2MfyzV54Y71/q8cmwP7k9QILb7TJ5gxPJprFi4DSWDuk U3QFAs/GEy/fntGwXCfhDgHPCg2xLxh0Z/VRPP9MCFF7QzGzAdIIDZL3rjO3wijPnS+1 A4Pj3znvkfEti1UglRYSwoepzIX3ZZXC7B8fSfSk52Id7mD1qvjVHlFMzbUi7Bruf+IT UL5g== 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=X12b0e+cwvhWNuQ7Goyxjsst9LUXKmeDiAgTrzqdflk=; b=V5L+YhIpjMoZq8IKNOuVy3xbQ42WUFGoCf8+1QhhShULqwp1fqRCkTslVRLVDltCfS O8TIp2Gx8JZgK1kLtDDUubQGvWY/rMVvOxTZzy6HGbvTxivY3FQ56zCoPBxjVGzBaK4q u/Ke9q2ZbKgEG3BCPLPV3a2i90v+HilWiOALBU3M1eIWSu/98spnYGRWN3IibKZfrO4K /nq8RCZghg465+1jDKxeBTSEGwxr0LEaZ+N6qwMN8Nwa6jjzZlr2TwnBkOGaEVPKLOh5 ZAVGs8d5Dgsvjpz1oXS/dkRHaREuxn3SnRqlVMw2irwUQv9hkcrlfRMJvU46roQECJY8 CjHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=nw6qteQM; 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-a79bc7f6218sor52415366b.20.2024.07.14.00.10.46 for (Google Transport Security); Sun, 14 Jul 2024 00:10:46 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWbpc7zEQpz8CnDHGkN/YvMm6CXvYxV4iv7BDKvXt0nt2/Ov19YzKtQpylzr5k9E0yhlA8cTeEbbFt9BvtdeqnpiO8kBF5G0Sn0nLHB7mwK5Gbu X-Received: by 2002:a17:906:66da:b0:a6f:58a6:fed8 with SMTP id a640c23a62f3a-a780b6b2029mr1044077066b.28.1720941045980; Sun, 14 Jul 2024 00:10:45 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:45 -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 09:10:13 +0200 Message-ID: <20240714071023.10417-15-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=nw6qteQM; 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 07:10:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3250 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 9D0064130C for ; Sun, 14 Jul 2024 09:10:52 +0200 (CEST) Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52e969d34a9sf3822429e87.2 for ; Sun, 14 Jul 2024 00:10:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941052; cv=pass; d=google.com; s=arc-20160816; b=qj8VC2ePo2HhFDb41VcjFc43S8Gt++n+9RMV2yC85E5WsPxi0AxboUWcdiXUEh/Qiq vYNmrTRAuRUnIcgi9PnkL2j07FWhkIDfcXFW78Zho8/j10G5pjKnuDK5nK9c4W1sW5Vo wTgtyFzq1/yWgJnCnF6M0OkIV/AiARdAEft4nrSWcbkGs0qzPWXQEnX1PXea+AOkCPuU /ZTY7/Q7e4ieChn64KQoXOUW2QXxRqy5z1wEWmgt1lzTxC4gowgQDYghaGHAodPFSMAb t55jx9bCEgABHwIof69GSyUXmLXVoodWMkwwlgc5aOv7Vbav3ehZ5Ec8cdx1+/Y8qzch fVYQ== 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=c554Tec6qKoi2KwIxuC6PFQuYRDCWnMXiTiX3l4IsCE=; b=sbBriYzZUVqAxkPEM+w8+HMu9lXcPbeVznnm5dDe52YEgbwOVXUStlnyFjM5S+qyYT dzbkac7wRQjYnba1z+kM5LIkSJq7lQSAYvMLoPGboqkNAvY4ZvugWXbZKGjI1eUJeRvJ xJRbkK/xqn5I1vGOJcwfGm1aQ4szrjzw5ohvDDJxv1oWv1qTkmUs1BVjlDp+I3g3FLCp zP7Ry4+QeMhbUcS10WQ7wb1SAPgn3ai7m3q4l8bpE69rXdn8/vY4aVEKowvWVv9Bwu2t rtaUCMFVArFtDMQcBuO+9UT5DTMSPII/AyBj+OGhFuH5Pgqp8ifnvTioEJgjvg2Q2GHX WgRQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YwYK6+Pv; 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=1720941052; x=1721545852; 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=VINk4Vv333ecmNI76LyXdpOodglU+T44bq08qqaJL8UXJ3Q4y8W+DxFXvrfS6dms9j +uHCa3wdyAlBLjFkz38J6TPv04XYX7XKAFqBjUEfecHFaVQvUI1KWodvnyam/6vc6sIb XAYLvOAVJ42RFWPXp1F8q81DVlJ7ZKF3BINu0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941052; x=1721545852; 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=WhwAfhIKeTyDzFXIEKlHXafH8IihbxvfTHoiBEA3Olfi0uGysNazbwYfRb03QNnZ00 XPdM6hqvTH3mrF4yjNYIrMR+Pg0bam1dOtSl9kamdFTI5xyG6nySrXmRywYEocMJTGK5 cMwRqjkpswu4wNN9+jv57pIgnxUqN3gAR8IP6PN3R1eCnERs2bf06yu4mKsdIIyvIxCk LNbJpYhdIp374q8kqyenbEzUHNPoB9eNw/qntJ5LdNUtLTEqb9nSoadFFrWt4FIYrBiZ b37hylkHFdFfdzwdjsjD5ElF7p80h9tpjpMvHyV9vBpp2MtxWcPFvrpQjWToE+IJRjU/ d4oQ== X-Forwarded-Encrypted: i=2; AJvYcCWPGFZs7t3fJt5RujtWLmQVFnxmJtkkNBwnSsdeHgNTWYD8toMLb0Pi2NAOtLkxlk/d+8Oi+l/DkDRhl89QTceXw8Fe5E0tBRcH/b5fS+9IpWMw+NReJEaRyDP9Fg== X-Gm-Message-State: AOJu0YwPeaweMgun/wqPx11aatmCsAIq3PcWmoKuWytzcJAGvb7wxWt5 Th0hRtVPhSqVTGoMblS/H0U4e+UYErH+z5d3YiXIoNRSvXUD3uM8RHhXsaMoykeuJw== X-Google-Smtp-Source: AGHT+IEJfRJ2yrd7/DrxU+cOopMPOLMznyciG84pHol/PfXxr+P6o2uDhUKGLZuf42ZNKEJ8BL9yEQ== X-Received: by 2002:a05:6512:4016:b0:52e:d0f8:2d43 with SMTP id 2adb3069b0e04-52ed0f82f09mr3226497e87.17.1720941052080; Sun, 14 Jul 2024 00:10:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a19:ac02:0:b0:52e:97da:24d7 with SMTP id 2adb3069b0e04-52ec4504d84ls1715365e87.1.-pod-prod-05-eu; Sun, 14 Jul 2024 00:10:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWUrfWjcsiu3HXDw6e7DPrm2IPYt9hCvgsWaygaFPM3+9Z1+Pt4ucgZMvLmM6xrvsdMG3YgFsM3lfMCz1xQ1/hlvzrYf116yGzKfDBfaOmFnLb0 X-Received: by 2002:a05:6512:3ca5:b0:52b:c33a:aa7c with SMTP id 2adb3069b0e04-52eb99d652emr12711241e87.65.1720941048077; Sun, 14 Jul 2024 00:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941048; cv=none; d=google.com; s=arc-20160816; b=blRReDL8CKb5UI4AuQkgR3SETcI+vep5JJye4qZ43ZOaUyhwopYTXyhJFlfF61Ju++ jDpg8g5Jd+lElj5DA59KGWeaDP96C+kOKteCXAkh+1E8aTmw0lgtS+fWt3aZSFVkBuKz 7LM+bwW/3ll3F4zkGMW+qkoBW4PLnJJ2jKtw6cF+UliHy/9M3SiKO7xqe1l+RcgdMxB1 EKmSE3DV5c9PCsE8GQpfsuPSe40UB6N0gzI+HzbUTBqV2CDCM+wfy+toiLyCmsHkR6mU twWrLo47G76w7tmWZp3TRfITWd54kyMAw9nz50wWy/lryASaOjQAd2yb3XP0TwpA1w3m rUtA== 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=AOMtFlnClidtKrXSwj75CSt8dLfJaW8XYO6OncuthHE=; b=TEEtyyTi7OM79b6I5fTOZdOjmq9DWL2fSlSmiM5iEbAUE5EV0JCvwqps8EnkQs19Ht tvezhLs5FkRFGAzWYdYifsY4IH3js9zJr9dd2GJQsQzKDQzipbxdY4oV038ok6uqpMXV /XTQtFD3XIiKhXLHW78puY+8rgID7LMAGyUoyXr9tHf/dAZTEJFK4e4LfKgH5KKON6Mo fPiumPoCPL6ysUZM5QRvoUhHRLbL08hROPLIJgBXdR6vjJmPKAkU1l+ts0hznrgR7Z6r RbljifEqaAdXxHWJdQYtMDSgV77lTk3hrTzPWeM17PwuuELJqVclCGkNWxxDZR8SKWfc S2bw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YwYK6+Pv; 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-52ed25929aesor454764e87.26.2024.07.14.00.10.47 for (Google Transport Security); Sun, 14 Jul 2024 00:10:48 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXWzrJzdlVL4MGv3CXbRu4cyQvtdghFVq4be7y+wRE60oKbTMbgdV5aRgg8TYyWJsn2/AvtHO7Iu9RgPeDb2k5m+zrvQ7+mth3LLIeEL0fvMv8s X-Received: by 2002:a05:6512:4016:b0:52e:d0f8:2d43 with SMTP id 2adb3069b0e04-52ed0f82f09mr3226332e87.17.1720941047571; Sun, 14 Jul 2024 00:10:47 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:46 -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 09:10:14 +0200 Message-ID: <20240714071023.10417-16-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=YwYK6+Pv; 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 07:10:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3248 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 233C9412C7 for ; Sun, 14 Jul 2024 09:10:51 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58cdd86c091sf2986071a12.3 for ; Sun, 14 Jul 2024 00:10:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941051; cv=pass; d=google.com; s=arc-20160816; b=nPcfpUl2JgOd9oqz37EMPrYbAlrZI5ZeqUc4lczyUmVZm6JnKCt4vEN/2JHfmtDZKq PI9LOWU4gjIDmJPSf/no22ggOlxAg4JuVHT+rJXXLIWMIs1NrFFVdeUKDbw9hS6CSGQz KRhecf2Pauv1PvHAbYJGv+sWThFGQ3d61iC7Jcm9GbZSYg7312Wh0iNyRmqSiKIHgvEt ZXNH9juWgNPlk8R1IlVJ/VEMuMYMsdy2hQq5PCMQfg0luPvsvvfFHj5j03RkURJm8w9H II8VxcHLp2PoFiLIQpzV7tyejoxxHEd5L9pBf7/+CHIHU4zv7lSTgJlvgAWE0ZeW2OGK +m1g== 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=oX6qgex7klFO2rbFAx2EBt27yBN0we/WYIWiwnWCB/8=; b=tI2QsG4lPmh5VKEjN6nmcx2jF0vWH08b21bh3uDswzNoWkqFYvHfJdFPt6tY34SKAP JemT+emNqSn6WU/zd4NysCs3tuAx4vP6HIB/lwJyvdBaXrDcidqhGlIbZSAxn/8vMXcV MoAN/sGncEAurkdXcibGdab/QNbR9as/mqKUytwyqT6SHlnsHEV+GorAD8UwomAj+mC1 00w4Kn+2SoQP46nFMkX4oKV4z9clrI6CIFE0DtkN53OGI6kMVwDwbyHxHchpY25GjcLI 17YvbUFhplNgxv70i/iMLKCHI2OOOXOhjbiaTEGaqFoi302op0le/uGopSjuziCXgKuQ StBg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QJX0iNEY; 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=1720941051; x=1721545851; 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=O1DwB8lfEFxKWmQSo0CLo7pkiJLKf4jNjDTnxkf/CB/dQrCcuK3ITR+1Q4PGb3ALx1 7SP9S2lCVM4KZwIvExuXESvlvMiyUNPBxWVQglWDyklatuPJpBvSwQq3tlIrTjL1KIBH 62NTmAhiF/wPIcKenyaaYGRP8sp0FyKsa1yPE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941051; x=1721545851; 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=w0v08sZ5t7Cqe3qqwSxNIhoQd7TSYZYQyt/oTj1r3LAQSoo7mCqlnTGA8G2kqsB5o1 CB0g/lm50v/pAdkS3buZf1t5haiVVc9x7I/ZR4yrxLFwqZeN+14VI+iWeMxPdFKV52t5 UE+S8RYuoB5j8ErKMGzyx76pLI4XG+jdlnJeYsk0KkWRoZFjBah6xK1lkWaw/B/11u9g UwC1r/GD0OuB3VNjOdobl5LewFlFupKrLHOKbiDINu/2stSWu1GqDLVxNrnUytl5uYaQ aT9/q4JXF7LDRgBZLwDyhiS92BB9sJc2Ys7LdbASdilX4ktj+hzEhnFfKEDc3lU7SttR 3++g== X-Forwarded-Encrypted: i=2; AJvYcCV6nCQzC7OvJwaQUpLP9lwwNzP0AC42M+NlW3TkOj2/NNYSJMhSYD587/x15fecQyKJhhcjRHsdPTVCwo1+ULmPZVv3y7aXL4Yy4sdDNVUc7d5kE+FT0+PQNucv0A== X-Gm-Message-State: AOJu0Yw67FoUGiYieBbo8lnYFSMSQTtnyxB/2dUhyNmR8QkU/rYWBb2y R+erJKuMux7WMhcoLuF1ZfmpwVyi6Bd+3kK0PCqGDvasonWgln0OnsZxDebi1VmmSw== X-Google-Smtp-Source: AGHT+IGvzmikHbBhr/QYqNi7Nc1TVMutSHWlo61rdl0hGo7T+jRvpU0AhhhdNzuk2hbahJxS403MCw== X-Received: by 2002:a05:6402:60f:b0:57c:7486:3f7d with SMTP id 4fb4d7f45d1cf-594bb56a567mr9096509a12.19.1720941050864; Sun, 14 Jul 2024 00:10:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4310:b0:599:9c73:c392 with SMTP id 4fb4d7f45d1cf-5999c73c484ls1238602a12.2.-pod-prod-04-eu; Sun, 14 Jul 2024 00:10:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWPjAZgXLOLVk+nzkIR6ZZyTZLXlm17y5nUDmx7D1bKa+09qPMj1jJ6gYsReqSrorcA+ho62IVm/Mp7lz0c+gHwQYkOl5USn/e21BjTEf2bIuNt X-Received: by 2002:a17:906:3989:b0:a77:cd4f:e4f5 with SMTP id a640c23a62f3a-a780b89ca7dmr1007891666b.68.1720941049225; Sun, 14 Jul 2024 00:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941049; cv=none; d=google.com; s=arc-20160816; b=l8vS5UhxNTYGAKa+8UdYS4K3vDbL8akIjemb6MZKBKowQboDf33zWsC99KvZa9Ea4W 1cynqKi/5OlxlHTDa6nNNybMnR42SNlvBh46HbwbEseMktmV2iP1kmr/zmIdmzA65W0c Gqrba/4GhsJU5POGdAYS4OJGDdAHxRUGkSbVy8vzhCbmzxR8fB8PtrG67cv4eddyuvpL nQ8Czj0yDcpN9ToX4Qx6wAcP4+Dk+f3hBlFsBInoU/m06rxUFrpgPPJ+mJ8fxINi6fUr pG49AImfFqlv70/0oYisj4cS4UAaSRXt2TimnpP6UfY9F1tPTn8aMtK4ywrDbB9l07wF 2R3g== 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=M5FBtg+rPq+VGZ8UhU7lRS9ehphXz+BpwFSx/mfbt78=; b=P/MuUdSuq2afl4RB2vWZDqwO15cusvHa2ze4EwwtWfSwUQ7XKHa3dXsNgHDI8LSpBH CY/GEeDClT4YAKu7KtuS9CF+GLt4GM85R0YtVGeq/rOr0G9J79vvB71POrfQgrKH2LgO 7jiDW8GjxhkOoyQdFAIeMQMZB0VRPbiarTny/zjH0LddYhlXxSVHe9U+gsSJ7Sejp9/b RpmJ9DgZaezR9Dk+7GbbBl7HKMBNJNx6QBFn28HUecLOvKfv9hjhDe/zHDfoNMgdfOEK DAv2qpnsi2U2EDfTWL/AHoPYsICslPRGwiSJWJ3RwrgaHhGdol2keCfPNhcRDcCgxi/F K3gQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QJX0iNEY; 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-a79bc5a3a79sor35001366b.8.2024.07.14.00.10.49 for (Google Transport Security); Sun, 14 Jul 2024 00:10:49 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXYObprW7o46tiKZGVIownqaFeAyzOXoPVMen3Id7v0ufoJBN7fiUNEqmrJex8nrPsphEL/GJXjU9Got6uw2hCl68WlMF5YPRPDQPKFadcUx+7l X-Received: by 2002:a17:906:f10c:b0:a77:c824:b4c4 with SMTP id a640c23a62f3a-a780b6b1886mr1136497866b.19.1720941048794; Sun, 14 Jul 2024 00:10:48 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:48 -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 09:10:15 +0200 Message-ID: <20240714071023.10417-17-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=QJX0iNEY; 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 07:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3249 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 3440040F59 for ; Sun, 14 Jul 2024 09:10:52 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57c93227bbesf3151001a12.3 for ; Sun, 14 Jul 2024 00:10:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941052; cv=pass; d=google.com; s=arc-20160816; b=eGWdkPAaDRqqvS+V2HgOLUiikj2BUnL8B7ZtmrNCyPtGM5NxNGVEx72d7XcQOHrM61 TJAHN3pM+P6VE3hY/hUm4XVMkPXOfhDBLR/m0t7wgX7RXXSUYYI4k2p+/iC7iCI3knYP uja6cIrIMxVbzynXuzMnAKVKOfmuJa2x6qMsd/Zo00g9HS5VE+XoZd5pa2bQQLe+kKWZ HctipEITLTgIx0xYN6/zleo+SpZ4flCwqNakSjgRz51WAPEtOSnPkkTBsykttBHEAvSX GR5QqnEITm17r1CwIzHwCMbVITWSeBY8Xo9UjiSxFbuQukS6A9URNH3kEEMx+bHq6+ja d6Lg== 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=j7qGrGmq5xK/SgcE6XvxSD+wOvQdOA9IAJPPBoTHaZU=; b=AKsOHP+h5191i/YwEq7jFgzp78rKFFjSVMlve/tgg4rywXCFNETf3R9/s0ZNA0u/1Z XvRoxJXPIf1tfeaNHs2n/uXf9SOn8+sUcYzPJtwY+zmSL1yf6YUiS4bWFZOomVL8q9lU K+POVEVQn8UuAV3xMF37gpHHLSzSl+yddyKwi//5Kon/+ICNNgpMBylY2RaH1thqDOov ZKcX8iSWSBkBNArPA9ZstcMR4NQdaJ94FTUZqFSfbmxoqaIvhq7yYu3L7QwWdmf3yupK JqiBq9Mc3CLwLsICLFfmIQAQBAeXhA30ynXKBeZjG7SQEQ4LQxC36TBAy0yrnjE/FxQB GlKA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=a4MYYZJQ; 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=1720941052; x=1721545852; 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=D/mvQKEKGJl0/GViyEk0Oz9QFkfVD0F2p7Kjj9tPLKAt61Pto/0yd7GUAx++Q2Ckr5 G6dSVaeneQB834dHfozCxGQLzmDyVrDuyi+qNzwkL38Dv39JmA3B6LyodUNNYzFd3zdg ZosiUYCwqK0vj+IPWxWn1671l8T/XwbxYCFBg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941052; x=1721545852; 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=YeHz2Rmvs1g/+xvyEE4nU5VC9YdBkdHft0+82P4BH5WIKtXqrKX6vKA2kAhUXiE9ri MbfEbyZq+BaKzhFtqbJJTLjTkbv/xK01S2zOqL/X02RL4DGnBcZL5SC+6u656F+8BTkb iJK/kAfuK/EOa+vTn7hyTC8e/9pAMzFoNJ6sUKlyw8Qief9n+daPmxQuJxaXHRCdT7Fb 5RPESHbd/ME3VfxrYC2rP/9faSucRiVuv0HYvqzmkVjCRMwoLNNceumNG5mB4WR3JPt2 DMJNEgoDOMmAtmWd+KtCeixStLVEsKk0sbopOD2/6E+KMTl/6DDqNGtXg1aVwqmBdZBi ii8w== X-Forwarded-Encrypted: i=2; AJvYcCXkSjNp71AGs0EDUA/rfhKsNIdAXfMe0I6y71uXC2GTM1bXECvXb3rVm06XNwunP/n/j8otIh9/MrJwoHMV04HmSXUIqeuH9T4yfFW6/AFY7vi8tYkkEcra23rPnQ== X-Gm-Message-State: AOJu0Yw6U2zSxBDdzCHEYTTeu9f7BK2vpriTaLkHJ904Re3y4qG2Y7kE FyORZw810Sv90AMapp3xGwfxVKwz7emhvKkoZCOv+exq3JgRrrceVk/ksYBftwXJuA== X-Google-Smtp-Source: AGHT+IFgpvInc9Q09IqZ/fA4yVB54X6XQ/M2tOUcL/GOs5VHoIpcTmDH/LxNfMl1W/5DBYyFABMHIQ== X-Received: by 2002:a05:6402:40ce:b0:58d:5799:d6dd with SMTP id 4fb4d7f45d1cf-594bcab132bmr9619942a12.40.1720941051934; Sun, 14 Jul 2024 00:10:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c513:0:b0:57a:a655:87db with SMTP id 4fb4d7f45d1cf-5982622e1b5ls1517078a12.1.-pod-prod-09-eu; Sun, 14 Jul 2024 00:10:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVVMnGBKFoz0s8iQlQLos88c5WjOeWz0LThXadcQVFlB4q+hBuBFFHOkOEM2HHW9nwXxRbbI4QmPStteblWW3NV270IZor3Gcz5Fk5cFyuVrJa+ X-Received: by 2002:a17:906:395b:b0:a74:84e8:9994 with SMTP id a640c23a62f3a-a780b7053e5mr1115361366b.45.1720941050327; Sun, 14 Jul 2024 00:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941050; cv=none; d=google.com; s=arc-20160816; b=ZcMO18+ejPS6JTQ0b/zcsnb+uO+EfhaGH9ywlLUkyl9QVY9osDBtnQTjYDfjaGnkzv MyZGXWweUKHwIzlOVxLCcnxS9IZTiKSW/xNa0XdU6AaPynENi3YNldMZdbig4sYbuLS4 gaI0Aby0Stxgt5TF5jmt7wwHAWk7McRJBa6z+cbJJPH8cTfD/4n8MEq92vjdoeH3REeB HTAG4WrnuX+L18ePj9DdEuhBbcP1X5vK/QczvzXl2WfqS+HhRkizO4SfeKA6RWAhLEXC y56MX1MqmQFv3E4OHxWkgP/o+GfHxT0xB5nAqDJCfiFfizRUOL7V83dVKrzjfC+bNbw8 EGCA== 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=2iJDeDcFxszXWOzv45YOkO3h+wJRPCYeECaSl12q+CA=; b=QuifZ4ZjvXSUTsAQ5iXZjgWBZxH/W3c1ASJrwlBzS+FahkB8trZs3klKK3lN+d3idu qJo7WgKwgcbIuWHATJES6B2X7wqQ10PSZB8rTaVL+9GM9FvwFXRRMNGzbujaLlW8LA94 gLInQnQ39tkeHwYG7DqWhsctYj/YjdG9y5KmCtr66N3mzAuE4Jmf2sG3nje9WjK/zElI khd12a1FOR24FghGXLBcQmcLyfplBaQ0KUUbQW4ju4XPjQj03WzjwMrTL30T+SSHatzE C8hZGt7b20wYQtauGCe3EBm2/vgnMjXMXjNR3uvV7UtfFv5s62IIJJlIpgdsm7c/ict3 Mj+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=a4MYYZJQ; 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-a79bc86b2f2sor65205466b.14.2024.07.14.00.10.50 for (Google Transport Security); Sun, 14 Jul 2024 00:10:50 -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; AJvYcCXit3fKhcJDP36rjlfKiTfPInRrBPdjtaQBgggByEnjj55Sa3sMNOvBCjzYgkUftmCs1XIi2OcDNnROVl0Y929qgdY4rMFymFm1sOqdb0zVdUQN X-Received: by 2002:a17:906:2797:b0:a72:8100:c3e with SMTP id a640c23a62f3a-a780b884507mr942637166b.48.1720941049963; Sun, 14 Jul 2024 00:10:49 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:49 -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 09:10:16 +0200 Message-ID: <20240714071023.10417-18-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=a4MYYZJQ; 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 07:10:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3251 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 698B34135D for ; Sun, 14 Jul 2024 09:10:53 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58d152f7f67sf2882873a12.1 for ; Sun, 14 Jul 2024 00:10:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941053; cv=pass; d=google.com; s=arc-20160816; b=YnzodLTO6fFHR6Mhjt59vNd5NiszAHobghAgi3nzUi0N4U9D2BqPkHt2T6S222mrPW kCLDI6xwPaM5ciIsRalGrxoaLPz8AHN8CDlGcJMi8OsVPvbk4Ozrw1JnEgLv7OyPOMOY hb8K2bWD3v6qxOmq2PtNWzDuGJNvd3RiVs1yiftT4R4t1jtgnkaYnriNewI0zUsolYyP KqAU0gMuNK1W6eFUqKiM0/BE58uFDcYzehgeuJTecYXpdYKKcZmMoGWE9LleYevCTu3z DZBjX+GrKuqIonaFXqBTBn8Uea2m7oQ4kYbfddiPgMnm/w6KTrGpWIrJN8zG1mEaw/M0 GYbw== 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=CQaK2VLV8RuxbFuXjvDxUGiRvmFebTHFAlQx1lEl+qs=; b=Sx8favYp86b1VCh2q+KJjRzk+ztctutbuUrMXmpRxruOlO+B2sbPty1hbd2KhljGdG qjg4IddGK9FN+OH3yRIjRl+7loGqWYdG0hKAs5pFMAl33t5xZjJbYKe2oFT3V2OkY3z9 z52fCgj98C9VddEbvAoWaWnjTm0kQfMjW1FfZaKTDZ9wTdIGMwzKr+yc4lSA1e5GGHdD xfzK4JB1tbJ1GIZAk+pE2GI5WZMKcHDcqqEAmVcvZb4k0ZSxm4OgWud+zhT6kEdLPv4o F2TKrjQL1k3O7TXyuGOcziI1q9gab/fJy4YC8whn9Mm87AM7oanWFvjnP/iHhfhBm3tZ Uftw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=U1hXRj7J; 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=1720941053; x=1721545853; 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=D0b11StQxlFXyCCspkhmdSmi9QlAuay4E/EqtkSKKXG6fBpMpfZ/m4/pXEvkFpBVZ1 fGQyz2oxqP7fsQFvhzIrydmDKfhIbp2GP3hIW03mnJBxNWd4CXWeIPvPgp6aL/JGINTK GNOKKs44m+drUBqIAjS9WN8K0pW6H202Qavvs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941053; x=1721545853; 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=fzQO6UWm/5jjyskubOCCH2Vfw+/Zvn40cUKwb+EfDDR0iO/+MpWFLSlJW3yddNlOhb MacgmukLvGPKFQzm7r7MsmTonuaErzcOUNfj+apyw9BC0u/aYcQYpX3o/YqWrBFbj1Bb sgmF//5SwpH4tMCcGc0A5TlC+O9UrVBzsCPcdoAy3C6IFvce+8J6mQX+qTTVF5i4CvwI 2JW9h92Kpj956OjP3q3XOM3B4Rc0pPpGxkgs4vZI8X+/4oi0Mm8TkgXCInwg3adA8d0f 603zmuD92D1WJkmy8l9LgpigbpWQS+i+rDLUzTPA3Tq6Ls4HczPNRml3+hbq44oWHL/i oD6A== X-Forwarded-Encrypted: i=2; AJvYcCXKH6SGbtsBOLqh1rj/EBJsusG2lXUb/sXa9lwn+dOTVs0dyPRLwHQ0xqrTWDkP6CHT6ZvFdnhlCPiGNpnokBEwQBy11YMzoaDuQ5KMO7bVuPoup/DhC3BPJEYPTA== X-Gm-Message-State: AOJu0Yzyz+hAP1ccZKyzBcfb7HpZK+5BaY+ai7kGx7qOpmVMXr4CFzCb dszWPziOLvfhpUjqAOCBjjidl7Ck5MPbK9tNUannXoBp+4/d7bsWEnaVm54vtmFn9w== X-Google-Smtp-Source: AGHT+IHSRPxRid0L3FmQz7Nsp6mwk1rxKg5LGp7EjT9rXJCF/80kXTUrYSN9WXmXGS6j0TAD7U9iYQ== X-Received: by 2002:a05:6402:3588:b0:58b:db7c:93cd with SMTP id 4fb4d7f45d1cf-594bcba681bmr13998607a12.36.1720941053172; Sun, 14 Jul 2024 00:10:53 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:585:2014:4d24 with SMTP id 4fb4d7f45d1cf-59821cb8976ls1555842a12.0.-pod-prod-08-eu; Sun, 14 Jul 2024 00:10:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVLspYgENPkHJQHZERrVqRVwj5vYaSvWoMDD2CtWjroZpLaO63f/MiuRioOmtsA1eyU9yQ/xdtMhPRYNYho7bOASxiAAki5q15OiLTL/LUiI6Uy X-Received: by 2002:a17:906:1388:b0:a77:c4f6:9f9b with SMTP id a640c23a62f3a-a780b6b194cmr1149182466b.26.1720941051380; Sun, 14 Jul 2024 00:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941051; cv=none; d=google.com; s=arc-20160816; b=tU45DyNJU2cM+i8SF/tHXLFhXqJy4R78r4TOxGfFdH/KjaY3E/3YTUJXIZD2/Plljm B0lv++Oe04A1F97iSEzmML04ppsufiouKkCYZdxNCtX9T7wgaVs5LKwA/r349eEGzPpK R+XPF8psPQ56llO1RdhdGK7hQYNCIiCglIbC2rr3QWx1ffwuQGokaKoOSByJPccNzcBx ZZ3N2Mmqk9uf6TM3+nnyXX++UdLIC0xRgLb+4C/hhppBqzD85+xRK+efQ20r2OKHCx2G uEqizZbAvvlzN/Lti2jp5i0kWMHb0WMR9ZlCwlRpsJFrSviW8qRZdForEiefeKyuDeaX vUKw== 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=mSoL1nz5iOuE9iIPr6zKDMBWYScKykJNyVnpLPqEZkY=; b=gDL4WOqJ5oXRgtz+ZllqRgkxbG58JplYkKXijWEDZgg3TP8oLykfi2u1E/CX/Kxghc /sOJXq6vcQYKmxk7KiwKlVSrxlm5pi9NTu1E+qqRxeGO3lnP/z6sJeVIsxHPJjn5En8h VA3hmhxxERTwpJ6JD8MTmM1t0qxTpHdZYdzmbdRU2WQCw1pUz0tyYJ3ecOkQ1NJ5Lz31 Qg67HCnThC3VndBvda1jnJBaMaOfwsGp2+DUky20+/laN+jlWpflwf921vQEU7lIbU0g mEQfLapEiEavFAGvMMby23UreXbsBSg1TigbrlU84EBgu7xG+YIOaKP7ZMZbYXUD0zeN jirA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=U1hXRj7J; 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-a79bc5dc347sor38049966b.11.2024.07.14.00.10.51 for (Google Transport Security); Sun, 14 Jul 2024 00:10:51 -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; AJvYcCWTY0GN3cfKVUwnRmvuAzARoE4KaIi8j+XbDTJb5Fity3LhBE5w+3C+aLiWGQBLdtNsW+Tjb8uJGwhMHsHMN7lZsQgo9MwRq4LWXwLtOcxBQF66 X-Received: by 2002:a17:907:94d4:b0:a72:44d8:3051 with SMTP id a640c23a62f3a-a780b688a5cmr1467617166b.16.1720941050977; Sun, 14 Jul 2024 00:10:50 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:50 -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 09:10:17 +0200 Message-ID: <20240714071023.10417-19-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=U1hXRj7J; 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 07:10:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3253 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 BAAA1412C7 for ; Sun, 14 Jul 2024 09:10:54 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-58d6fdee657sf3174058a12.2 for ; Sun, 14 Jul 2024 00:10:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941054; cv=pass; d=google.com; s=arc-20160816; b=LHD6d4jGiUnG2aoUjcteRE1ziNRF4KxP5BgjutrBDrGx4c6XRYf4SMuNn4npQfdmjl nXUx6THnNhgRFWC/BNqlY2NRj6M0AorKuRbsndgbOQqRHQPRU9VGJo3A2GsakvH+7sPD AwsaSFWt6jw07Q2UMZr74/E4H/fICs5Owscxg/tVs4aFWfPxtqSbINod2qH8UBkT7rft Cx35/nmuMhq9kU8kp/a1jAWR5NYQY1XDrbpZCarQjUpUDySYQbTmUGzLc059Jtc4G4Ls uGvnhTzmPcUYvI9fepiWuU80dZjCeBqZI7TH04VmwD0k1WQTH9UNscXp4e7l2w5UtjWd FxVw== 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=i10I9YRlNYS41nWoE/ehxJAS1YmiKkROEWLhIFclSgQ=; b=qjehZJmKbC67xS09eUvf6w504RJTirEP3ikdZtGKsU44mp70exyIRaNNAz9OypkIJI f+Okk+O2fQbaPz9w7+yCGq4Iy72re70/mmXvmPRbJ07ai/h2VskOYYwqhBnY2E2v6L8x GKJzyqRNdX3z5b6DFx5BxVvs0rZyEdlRwGWBWIxCMG7jm8dxZ0NPLEcpavfnn51+6Bya EfpjnIuOnmZhSw6r0Q4b+D4mTsV6zrOts7lws0oz8CTZCs6pRIyFDMDqlwwzfpCIlZjS jxYuHg6XNURne0so/Q82ODf86ptCjp6xObiQmosCYZI57XifykHXSnYVs/Uu+PO8hUxT u3oA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=beld683d; 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=1720941054; x=1721545854; 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=BjeSEhy+BZWzmI9m0Soh5ZtKVKjojFRLPl6Bc2vWY6Xr4HGFbvt5/RaREnJ18ZfFXV y0mepZ+zmywOl2P29VIQts0ml/xOdGEeB6YZandvNEKEgUO7rJazYOgjAWupvkxc/lsX ghY43RKCUQ8XJxqTreu0Y2gXDfSqL4DqMz+CY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941054; x=1721545854; 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=ujX86+SRJu0LxJ12H2aoxXZ9OuqOC3lMSCeFlzj73tES3HzP5khB1Jit7SiBa5QyX5 +1ibIWMpZlyqvYlNp6oJYNVM8tpup6Fm2IZxXPyMj7RPZeEvreLOSK+0uJ6YgNSShoz5 hx8mBBj4OJN+9EOdN3gyBVtrEu0btICZwejbu4nWIVQwhanYhZvmQRDlw6wzpw2rWnQK 0y5Y/L1XHD2uSukcIJ3EN338u/Gfy4v1nRUCFpWE+XGm1ExO2NPRcCyyn2tNQDqTE0Wq eUo81v+oaYAcqrIiANDosbXmA5Qmf+5y98PosB8JrPXUccu91CK2kymd0wubef22cYUp foxA== X-Forwarded-Encrypted: i=2; AJvYcCW/VIo8spDGFbmkCs8wzux99nHy/dzDxx996h+irH2zAiEEF0P0yix21vFyKWUGamr9md7HdDKDcGGNJbmsMfj2aIjY0xwVeWWkq5uNagqz+6+f1wF81AfCVZnCdg== X-Gm-Message-State: AOJu0Yx8XsPDPYN8sZNErIdozetpXWV+Cd16qInFQSl22qPmGxzwGYKS 4BMyY2kzVjd1j26+MLVb0rWEEiku+QK8liaoKq21/Qps0C3ZpwzOS+Aimaf2rbUIlg== X-Google-Smtp-Source: AGHT+IHNIyo2w5MNfpPD7aP+ayN2myXubf6yNuG3KOL1iInB6FNRdTzInW5UGuTeVfSEWJW/wPqFbw== X-Received: by 2002:a05:6402:2293:b0:57c:7471:a0dd with SMTP id 4fb4d7f45d1cf-594baf8753cmr9608109a12.12.1720941054420; Sun, 14 Jul 2024 00:10:54 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:d5d5:0:b0:58b:b493:fcc9 with SMTP id 4fb4d7f45d1cf-598217e0b7als178639a12.0.-pod-prod-03-eu; Sun, 14 Jul 2024 00:10:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWO1N54UAxJPCRypSbq+a5B054QsLy6FNLSvQ2k5TzRSfSaeBzeSxjAOQ3z/r1Ymj5sMQCcb9lMJrj908EONu8lnjcGYQ/khmWw51ITy4L5gH4V X-Received: by 2002:a17:906:7107:b0:a72:40b4:c845 with SMTP id a640c23a62f3a-a780b8833ffmr996014166b.51.1720941052614; Sun, 14 Jul 2024 00:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941052; cv=none; d=google.com; s=arc-20160816; b=oXuqmBfemwie7dbWGDTfMSx6etIW6yEWyEtfw7eiAG/u9uLNp3pXWb+p7rSinj/yUy USLjMsQLQb/qT8AE54BgwobrapOZytdGz0BMPrmD+OdLwSrAODWMvOhhrT5a4wwVTOoX n+tIHAaRoEYX+WUfBpFx4SWHzjthz2GAOlm5GWUqnfGomWEIruAQ4LBrNazs7Af6JtW/ RH1zm76s7B0qANtDWViq4IHQkisEI+9VV/+FJf/WYyuqvIdJ56LnUEa9h0ncZF8XpD/w RkQL9URsX7IDM6GR3TFWQbWQ1xsrMeAWzv9yzEozSsKGa5x3nuhBTFt260EUkt08M5tJ eGBw== 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=CEQAE1H3XQY8MNFgtq8HMpboqn7psHrQEmt3OuqYVBU=; b=rER+Zr4x0HGYNowQxkn1g5aSNeeUf63cKRNHIrw+jsmOsngx03d71D9TtXNjbqG1uW irHFuo1i1jKxKRlt/EC4IBaL+IK6RxneBIfcUGaN6tX8Nvc7ZFeakyi/Pg8VbkZlSmu8 5s8lfXji7V6itmEzaghg+L5sQW92O4YjWH+5Tj4lm0317J7ZaQ+0v2Ho5PtyTnWFAvyB uz381JgeVXsy1jeGuRKYxv2CRvS1c4S8bU+Qsqj5dnsY8KrM/LGtuumHeifWYoQblM80 OY4cELrKKtCRT/aCQeIyqgO1vPi0mpKIMaN+ZBtfcx40Ce6V1NRjM3AkH9oGvVBdXp6C VMjQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=beld683d; 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-a79bc7cf325sor36170766b.15.2024.07.14.00.10.52 for (Google Transport Security); Sun, 14 Jul 2024 00:10:52 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUHHuiUuxR3Uw/Fb8f4mNdirK1ksPhPtc/KgINgZ2/+7keGAyysr2PNGUjouvmFpLtu0QGoTD/2W5CGbsQnItAEcDiwlQrokk7AzrO8DDtgjc2+ X-Received: by 2002:a17:907:868e:b0:a72:603f:1ea2 with SMTP id a640c23a62f3a-a780b8834f8mr1246227266b.62.1720941052119; Sun, 14 Jul 2024 00:10:52 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:51 -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 09:10:18 +0200 Message-ID: <20240714071023.10417-20-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=beld683d; 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 07:10:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3252 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 AC70440F59 for ; Sun, 14 Jul 2024 09:10:56 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58c98ce7d00sf2710009a12.1 for ; Sun, 14 Jul 2024 00:10:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941056; cv=pass; d=google.com; s=arc-20160816; b=xYDR3YIMFpRvbo28S+phP8tcARUHW9mUx9MRpa+rA/mtvvb63xWyxS0MripBPdxypq dzIeay6wYvfdKrqhNbzYJzylDPGwayucu06qkety2TMKcI1mqawPOtttua5OJLm00e4g X7M/AocJ1I1kTRcqPiaFIkiB4GGHBTy5zVslYgMcMBflYb36Uu1KIsNvzgylY7tbXRh/ 1Twlh2oYodFAtmP3zp7jrhjUv7tdAuuFBpgHdroBwIqrican24vt3D5mU5HeO6aQv1AK Q55OnxPTdp7ZdHg5GAljhY/wGMPcifau+K8XyDz7HILQaSeV+TfwMksqI0sx5IQupz3N 8R1A== 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=zRFU9Zg/wZicCGbSQs3TVzdpXUX1Zs82SnX4ynPm09Y=; b=Oo1MGqD6VWumtQP/j2oc7I+9EfI83ECZa1Ti0x41LBv3+M51RT4c9Ky7Px5kQjir38 FpLJd+4eFkf7ESM5fkYK0sZAa5rvt/OIosKn9JL1iumBLfx7ErQHN1MHABl7Gkn2Aox2 66P+NZPMDk3CXHKP1rdbP84qygPPpVRuKPRajhoQRuluSGBDSDfRMeM8WA/otrEtO8yX c+P2fBHu+k48OM5dvyav3xiunZ6KDHDC0X7ybFT7bO9dzcNfQHhcfHVV9ACkOwUSyiz+ nIL3Esz0JAtxsIxQ8DIm6+KROdWMXzgiOGLOJL4L9KVU3/yNpcnAZu+RflsVHWXVgx22 KYfg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Z+oFSqQG; 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=1720941056; x=1721545856; 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=QWBIsXiN6pa+TgD0iG+ayiwxxi9djckIxbESH0Hv/b/Lf9GbTV6WPtDXMA8Fv76YAn m0+Ie1Ki+JRCxe2Jijd+SzD7hom9jpe3aLSurEoj6SSEDn6wAqnf3wF3qvQzclTCyg4s orKg9gkm8cvaip7EtzHsS0usEfjj39qTw1DbY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941056; x=1721545856; 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=W0mOJHzxL7nW8j5mY7zC+IANYTvuamaoo/AXH7TTKb6YG31qVsfFjeVLYUUTTtDLqU 9g5HkL3QhVf+eK2gtvwtCShJJw4lUsfn96Mk+FVBjXz1vmVN68UGEAh/xgsKm6LzISfs HndOI2mvaJR2qcNQH5jCycw88g/UbjOIS1Ng7dvULWJ3P4N5r5lGFNw7WW7W/IqLblB+ XflY6sReI3t2ZctEmrKcHcOiMvdlJCoUhscCqb7mxIPYSaHl4NLvHCPyK8q5tSIcIaBP 7W+oc1DslCemQ/TknCdmlqOswb/4ar7gHoezZU4aF08Lz/Env/nNY+3T+cBHbUCNwL0B Zbyg== X-Forwarded-Encrypted: i=2; AJvYcCUgxHVc5k7+CB59hO62jlye3cH57xyFSlo8lmgBNDQ6dqnvx5rIlZyGBglwJeHp66ZofVWKNJxzRPZ2HOzxmpetX9dwRUPI0iKisaaG1DrSSIZGZNQTIjP7Pzed9w== X-Gm-Message-State: AOJu0YxHyarXEH+CCN1YXDga9re8tgKp1sZauAXTE7cPsEdxA85T0nTm TEzwI/2Sk19a5wN03PrC+NHS0qw7UY91OaiJun3vb+mOObzFPZULljXz74rGCbCcEA== X-Google-Smtp-Source: AGHT+IHQcGwX4sr9YIJTuJFg/PPRJnA1YeB4J7JDrhvgLt6FYuIqxcwigtK9JXITsJdJTwHyYtd3fw== X-Received: by 2002:aa7:c307:0:b0:57d:1e27:65ea with SMTP id 4fb4d7f45d1cf-594bb869e59mr9478755a12.34.1720941056433; Sun, 14 Jul 2024 00:10:56 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35d4 with SMTP id 4fb4d7f45d1cf-59821cb697bls1605537a12.0.-pod-prod-01-eu; Sun, 14 Jul 2024 00:10:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0O55qmzW8wF697qCFzc+Q0oA8eul7QJGfknjoG4xo+Mb64iq9KdfK01bu4bsdNjbtBfz3lAKMOwE0xhodisxvmy1qeCylpAgvn4cNqpTIuC5g X-Received: by 2002:a17:906:81d2:b0:a77:c8a8:fd71 with SMTP id a640c23a62f3a-a780b6b30d9mr972882666b.32.1720941054706; Sun, 14 Jul 2024 00:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941054; cv=none; d=google.com; s=arc-20160816; b=DnPFp0oEGDCABxKXF+PELXxBO6sje+3XR7m4x0o7+yRczYPgx9KyDJNt50remLJJef yIA+RvoYLWw2LtOERtMbQhPWZXvukn4ffF38giTZtvmtnf2+e5yHv+ZqsNtjNHxPEFJm tyB+jz99Zb5msIiy7XhXKq/wqRLsjto190KVhL95cEv/22/anenUjH5+WelY9HQBnwDR zyxNzOi1ftLMRGrOWrvAEKawVM0APiM4f4kohc0O/gqhs6JdhgMRsl+f07s35O1zvSLP N9Al6DR+tvERBLb3/lcVsTJQCKxAdWYHaEEyn7ZFdbYK+1M5aLsEYUnHOrvJTO4fBAlj fbkw== 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=c+dnZnjcFElaQVxlBKB6mEYH1XRimgs6GOpBXkplKCQ=; b=vJx3GIWqmCTqpij63s3Gh6/7m6td5LwKY54CrciPtKPyeDfnM4XxzPtPgRtZIifp3p 080z07150V5aPisNrxZtmv1XIbI4WJEq3PS3PofQ6wtF6DLg8Xnz7f17xk9khiP12rRY os8A6k+QvWUDoM1K9nTIkgogifc69gJQZL8I+zPqBywneF5cbe0gdTf+Nzm6YSRzETEB 39xm7WsSAxSOs8lPeGfXUzVF5U8C/AMT91VSzTg6n5VXMstW8MsFCH/0n5eCSVYV14CG zhzQrCk/Rheroro1yD/+K9QVSTC5M7e24mMODNTJ36xrciAdKamTs8oph2dcdLhSJdgX lJlg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Z+oFSqQG; 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-a79bc96e4desor36963866b.21.2024.07.14.00.10.54 for (Google Transport Security); Sun, 14 Jul 2024 00:10:54 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWYCamj0e9MkUjZOIV+gjXbnLNBl7BmCy2rnsYfxmwCu6VRMKWyweZYlpzWgYlJ8taKIfIAmfih8SO+g+eha+1ZJ5vqZY/DAYx1p08rjN6oN7WC X-Received: by 2002:a17:906:389:b0:a77:b8d4:ae6e with SMTP id a640c23a62f3a-a780b6b1fa5mr1023043766b.23.1720941053254; Sun, 14 Jul 2024 00:10:53 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:52 -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 09:10:19 +0200 Message-ID: <20240714071023.10417-21-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=Z+oFSqQG; 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 07:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3254 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 8EB244130C for ; Sun, 14 Jul 2024 09:10:58 +0200 (CEST) Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52e9763468asf3308000e87.1 for ; Sun, 14 Jul 2024 00:10:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941058; cv=pass; d=google.com; s=arc-20160816; b=VsK2s3GW+tSrHd5z54ttyS0Q+woaYoS2ThSHsazM6WBO7Ednbs/PzI8MZZkMbjegSb fBuNkDz1R7U7pCZZ5LNkkwV3jLPxUOFhww/ZFUrl4OmSDLdX5TPXrBTOD4jI4OkjqXBV TC3P2/CPqUNNhXKn5brvU9uHwqX64bDIsnny1H4rU43OYZj+yKFwnMICa23bxxAmvpI1 /Aoeq2CUY21z49pRQgtfSQAnDpGzjpT77WaZaKHYHMJHkVceLSyfhC2BKS4KxfzZSY/q 83rQ5D8na+caAyGxw+XoqYpAAPd9B+xXZHEywRfhS/z0hAYc9qPZMzUDDkcmk3xH04lq YmBw== 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=mVb1s4j4Jvx3naUM0bIGfqITSBerhM/XaSvHP7bjfqw=; b=Xh2ESrqQ6xbyrc87+MPCdhmCs99MdV4y8piMxw445gmX8bA02R1gZwFxzhfStZTyXT ILXi0zYbIrrgXoGCFvDh93eg07nWzlxYlMlePNF8xpuwIu518RqFoi8MxyxbEkMEBboU IErOva+LqnEOa3fB5SPplk3+6KKwpL0lzLWTJSI6zJ93f8ueX519g3DV3rh3rqJq1r9E grpgmlMlfWFbPVp1gvGRCcUUtEZSiTutlvxc5T+8HlCdd5NG3Mu5UjC0r0UnpR6YsDlA pyDoKxMePFhnPftSoqgO6uSYHB2NMq4YFCY/9KzaWU52ia60PRKwuYgxqAoifCORsDcg RYFQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IyOvyizb; 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=1720941058; x=1721545858; 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=gGvd4wXtnsyRWCd43Xk6J3eE6AQmUYB+dg8BCvqiDz43F4qY4KcIzeAxZ++HKYNM3Y yOym10ZMjZPwpI1VDn/hlf3QrPzKHD0LsmAhMP9MarM/aOFXcgJQ4/xnEkpPlPsWYQYx 9ChcuaC8hyl18ZvnNuX2WYwv0xVuwI2y+nx6o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941058; x=1721545858; 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=sNGOvfHjgvnFpszFNg9fp3Siw8qHZkWfrs3R5/lbLiTSx7NqM32oSAMSILyxl8sSKJ jN6zQecV05KL19DanU+89rWwwKaS2lmBGXrgS5mPDFBPRmLmqW6/28Bm/hIV/CH48EKQ DhQPDYI+CXh8JZdUR2VMXYRqKe3zK+t6iPdZkaREoPvl8e/LW/0d9hY2yhd34vjWAB64 XmBL20Su6F0LIHbu5kjHW8epT7kJbQUMQl4yz7k9C5ezv2k7At4HPmbj0aVE56EwWT5K CfnPiKppeHCN5RBYg/+HqqprlkRVPLxb7WovMTwEt03Nx9+kcZXL77dRgbpry2RvRzWX fO6w== X-Forwarded-Encrypted: i=2; AJvYcCWo2hi74JHxiw6485yrA3qRNMQ9qa7U4J2LM5kzXJy2MfyT897f9B3la+PMLQcb/kY7/kVCfTaxmIqRmwHWDKpKFLyQC9GHeM3gd5VztwYShmzSeNxsTPK6PdizCA== X-Gm-Message-State: AOJu0YzZPFNbOTbDUKFDhalIy6q4w9E8QTDdGaokP6sPJ7TvnwfHfvtf 1ZBPvaTdrS00CRVl5Q5wdixFjZVIbSJznYT8XV5l2WT7CFticKYTEOG5wQY129XVTQ== X-Google-Smtp-Source: AGHT+IGkNp8/tYDDRKZpHO+Smmt4qaw6CMUcuozW0nvzXYFdctRzsyVhxAZkA9urzF+d3XTmN64uLQ== X-Received: by 2002:a05:6512:4016:b0:52e:d0f8:2d43 with SMTP id 2adb3069b0e04-52ed0f82f09mr3226686e87.17.1720941057884; Sun, 14 Jul 2024 00:10:57 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:ac2:51ae:0:b0:52e:9d2f:232 with SMTP id 2adb3069b0e04-52ec409caa0ls1647138e87.0.-pod-prod-05-eu; Sun, 14 Jul 2024 00:10:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVn09QMVSsIRZKhY7ATGn8pTViNLYrK7go/QqPHCK0efNu6SHe72OV7BAJzF1t+sb2Kv77Augv5/37HPDZQ/gS1R8Jnhsr+qHaGsu+X2bwnW4+0 X-Received: by 2002:a05:6512:3e0c:b0:529:b718:8d00 with SMTP id 2adb3069b0e04-52eb9991e93mr16547533e87.8.1720941055867; Sun, 14 Jul 2024 00:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941055; cv=none; d=google.com; s=arc-20160816; b=cmLK6Rr8DXEQBRM1adjkYSac/alL/cGw+VtJq54/k2NQpnoa7xkctXat/hVOMNdqet JZz8pXpgj95JlS7ZhC0XsrUOA1V6vnXGox5hv2SrNii7UtfIMB7Gbi4H/dzIM9eoYQR5 qcn8qO6kg6QHvCh9JUNJ3cZ9B3l/F1c2REWFnfQql8Bpxq6HcR40I3+GACHSvRjGIuCS kWWXK2ibltqtAvvIWw7u86AE6XQpz3naHC7wJcAKriPVPiSlEhINSnmoakL6kj+SfgQK sKrXgL9Jt/DGBk6NNixOpWx/FLUBA8+WjvjOEY6xXHKij2/mcrE5Z1QLJkVl+kBND16J VBNw== 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=GuF3ebhf0Y2ZZdJ44j86HegNCYzAKV36pAha8tA7EMM=; b=CwnO6BqO+E0DannV3zvfPL1yETCKZsWloe/t9k7J7IV2A1x1UVGsqj7UCYev6bbSPz E+dxoiogwBQNPwF/IUDRfEzTHEQCuhQjD2F/UDP1N8bAvMFE4kulgWxP2F5/QFRs/zlI RwAcjLC1KkW5NxOVksVkStYG/9y2/cb0jb5VtU7Hb+fc2uiegiGnH2/hmMLEDrf3a67X PdXHwyTluPim8JbhlB3D5tDJEz+ch6+yeAD57dZskCcL+oSf4uN2lTs6mqf2DlB+KJ5Z fkC9cDrvDNpTZk1ff1w+5QIjMYiie5HSzFi6vQLpPvllpE6uVJ9ov5jFf7o5Kh4D4J/q ULHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IyOvyizb; 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-52ed2542d64sor450756e87.3.2024.07.14.00.10.55 for (Google Transport Security); Sun, 14 Jul 2024 00:10:55 -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; AJvYcCXcT45zkmWw0yxLr+DQpHnpYF98b3qQRrMRSrkwfPGSmNvujJIgnN4VJL1sfriZZ4NxuR9Lh7eNse6YKWI/e0uP4i0vcVfEhLWmWI2/TWsHDa+q X-Received: by 2002:a05:6512:3ca5:b0:52b:c33a:aa7c with SMTP id 2adb3069b0e04-52eb99d652emr12711446e87.65.1720941055435; Sun, 14 Jul 2024 00:10:55 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:55 -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 09:10:20 +0200 Message-ID: <20240714071023.10417-22-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=IyOvyizb; 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 07:10:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3255 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E4F6D40F59 for ; Sun, 14 Jul 2024 09:11:00 +0200 (CEST) Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2eebc944683sf34247711fa.0 for ; Sun, 14 Jul 2024 00:11:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941060; cv=pass; d=google.com; s=arc-20160816; b=02mc47+wB1Sz1Cse7KxnqyWz77i9COYNTvBceXJIwdvjdIpiVy+VBVTuX0KyE47/Tm KQhv7X+5v61z3SsnSqiUb5xaWoYEiY/p/8Q7k3iarF9YRKUJMzfOEjc7lEM3DYEcAxd/ Pdnom9Qy0hxfekS8cbtL78uUEO8JfmspWqGfXL0uPEmC0UNdNM7TvAlvoPmlI52jQSSC 3UUSl/gjqncJEJy5b8EBT+2GoJxOlWo3uPg9Ib1Av8GIG89A8/Xd5uaUVy6OIxN7wSbj 0g3pO9KYLl4DveHxzfmu8nyfyDcl4WXh7SnYgZYT1HSlNGNDNZeQ4RXf3AhLq1GU5TyC 1scA== 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=yve0SoKRSyTjEAJBVl68Q5CwK+P3lLCJIVgIhBVDob4=; fh=yGTZTCeX6l0uQiZraXXQzNnAOKrINbgwGWSx2jLzz5s=; b=AL3Hk6rVhIhzSskcA5ghv0TCfSG2Xocd4EYwp3lLrOSexZQEiz3gX/5TCRASsbUCOn DXhqkVN0jJKE2FmXkSIzYIW/p6KptZeobRu7PmCzMeSSYLq+MS2rXNtZ7tNiaYdG3uf7 YHUzg4spNdOoNUvwsJAczZPxQiWB9O6/bVMEDJtOs+kcfu7p/uB/UUpZAEueAEHI0X0k X17Xd4kgVPCRneKwI/t7nIJaaL0HkwF0frPCFFI0RmGIgbBgSTR5yKAZb+E57edAuU7Q 3vXeOFM3Mjb7DZMxNO+qiJ01zPyufgQK2X3SYTBGXRh5IIlgGOy9/28ZEz35Xv6QBI2t CtJQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="q/jDR79U"; 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=1720941060; x=1721545860; 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=yve0SoKRSyTjEAJBVl68Q5CwK+P3lLCJIVgIhBVDob4=; b=EY3hKVPIQ4G3MI7+UGW684sEt3k7yLdAkER3g3fVQVsy0NBmojCv1T9wmZuxhVQakS zpWR2HeQBKbzKF5sgWFTwUYSd+1C+SR479Kz+Xk1jCfGDRhMXIpfxz+xup2sj0G+1jDk f+a9/yXmQflrtB34ADOCHPlPoWDQdh4X5jZzs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941060; x=1721545860; 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=yve0SoKRSyTjEAJBVl68Q5CwK+P3lLCJIVgIhBVDob4=; b=pEb1OBbFMOY5SzUq+isbEvPzIrnOFdzkqvffzQ8kRBEGi8F4qbT6giqaxEVkrLpsv3 hEuJIPO6g7HAMDKBgQ7uGQQzxt3lUIw4zAwxSFX6ysbf86R5occTwJWzH6BvgIMfCkbY W39ZFjzdXQbKdv7hRrXjSWOxnjxTxJ3LoXm1AtUdMr4BHY7hdCFPgGFc7NymHIP15JxL D8UdzAVhD7cxnec78lp0uW29PyBtacIspTGngOvx5rBRuMljwyS8xmzIn/aZvso5ENp2 Z5a0wuSwKNxyX9fs0EQ6UtEmlAK0ej6QXDnHlDFrW82dCiZdwy9QUyjsoHKK51KIaJwN VkMA== X-Forwarded-Encrypted: i=2; AJvYcCUf8QGUBkVgRINbLqPoY+4soJlqV+F6aKIE8WEzWI+xb4Mx4EpEsLNkcyMpnSAK3zgFlwVmCO/GM8wLYC72VEOS0tjUFrrCQCVE0HDREZcQMMvykmunaqAs+vk7ww== X-Gm-Message-State: AOJu0YytkzunjRWerfSXCPWv9twfRsDACa6w/BzAwfCCexWto7GR6v7Y Gj0u3QQYtchNA55DTNmzlpdWm7WNlDCGEcD94LLbFjdYelFOmQxyH9rTbsSs2lTo5g== X-Google-Smtp-Source: AGHT+IFcTrXYv4PuzPvZY71JQ07jjcVQCzCvHOhC51ABY8IUTmHPvihhO28/Iunms+9qmgq8faLR5A== X-Received: by 2002:a2e:a792:0:b0:2ec:63f:fe91 with SMTP id 38308e7fff4ca-2eeb3181609mr146356781fa.38.1720941060323; Sun, 14 Jul 2024 00:11:00 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:354e:b0:426:6982:f5de with SMTP id 5b1f17b1804b1-427989d83bdls13127285e9.1.-pod-prod-08-eu; Sun, 14 Jul 2024 00:10:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVneA4RXOnzRWf44ieBJTd7czjxZrphpgamBWOWOb4oww+CxLjgVJ986Q/4wExCXxxVkomS8vUK7QnjrxvZtxnLCgsOdpEszAzaYxXSmTwQhFuP X-Received: by 2002:a17:907:10c2:b0:a75:2495:a6a3 with SMTP id a640c23a62f3a-a780b89d121mr1096528666b.67.1720941058276; Sun, 14 Jul 2024 00:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941058; cv=none; d=google.com; s=arc-20160816; b=drnTzOPSnE7cjK5Q4F2sJnwMngGIHACapQfKxwM9BNby1aTT5lZpsgvG70s8bf/vB3 rRH4ooNt8sahwnCi/bs7cfMq3LJftKWCM+Q87Vbu+RJFkFx+bTGPwjXffxUdac/8f6xV MG0rRhpvcxYvtK6rzUMYZHA8biOwEosQhhYsmnB06J5VT1Vvlp6GczjjvbP03A6XwB4P inL/R2qWN8rlsWcKcOQ2TnlfCABz8dFzm0dTvOeYCJ96lvaAlt8cgIvoX7IJJfJb3upf s+vauZ+kOQluZZS9F+Bh5nMv/0YZfSnUO+B5g3riu9s9uLB/+Bk52tanZqLeweDgWoKk pvWQ== 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=84Yhrm/oqxma55CxB61qWGOAaOcChVC6bGWfbh5/Iac=; fh=hpGzqBhQ/aF7qZhIgUmJH/OsNBcTtpvnZBKmqxwrhjQ=; b=cAs6yr52UJNWQe6kiPsf7zJ0xki8J48FCRw+kPhoCzptaVwgTZgYDE/3SoQmgHHlbQ Ls9exLM4Gk7+wIAfdWOUFsHEHxPnFyQD0/a6srchKNmNHBCf+1vD+BpQyMqrZHltkWtr Ayb0SSvGAADOqdzPTUj1BmBAfUqOm1myOUUn7YzPv63n/Klb4aKAnDCCAgt6KOyVMMwm m05MeIcPd64uIkqXgIH6H4CS5Wa7wE4rQg3SqIPA/Qq1Ee9+023jwQtQBo80aHacCjyN B1In75UzYVQ5dkrt0mHxAJkLrXWec3FseF88boGem7CbBPyGnZUGSaEUQhh6v98aQjFw D4Lw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="q/jDR79U"; 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-a79bc592974sor38400766b.2.2024.07.14.00.10.58 for (Google Transport Security); Sun, 14 Jul 2024 00:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVljgFqdDJlScD8R89ByLKPTF9LBQfTN3bXZEbhe9Rf1Cue8DBIj9XNTT5wkmj3k7aS53J8ktUUcjjEiNylGE5jPmdlzKEWLm1uADacWRLI0rpb X-Received: by 2002:a17:906:d9d1:b0:a77:ec9f:d9c1 with SMTP id a640c23a62f3a-a780b89d4bemr1106498366b.70.1720941057507; Sun, 14 Jul 2024 00:10:57 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:57 -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 09:10:21 +0200 Message-ID: <20240714071023.10417-23-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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="q/jDR79U"; 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 | 21 + drivers/video/bridge/Makefile | 2 + drivers/video/bridge/samsung-dsi-host.c | 1638 +++++++++++++++++++++++ drivers/video/bridge/samsung-dsim.c | 149 +++ drivers/video/bridge/samsung-dsim.h | 20 + 5 files changed, 1830 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..de21cb9dbc 100644 --- a/drivers/video/bridge/Kconfig +++ b/drivers/video/bridge/Kconfig @@ -44,6 +44,27 @@ config VIDEO_BRIDGE_ANALOGIX_ANX6345 The Analogix ANX6345 is RGB-to-DP converter. It enables an eDP LCD panel to be connected to an parallel LCD interface. +config VIDEO_BRIDGE_SAMSUNG_HOST_DSI + bool "Support Samsung common video bridge" + depends on VIDEO_BRIDGE + select VIDEO_MIPI_DSI + select MIPI_DPHY_HELPERS + help + Enables the common driver code for the Samsung + MIPI DSI block found in SoCs from various vendors. + As this does not provide any functionality by itself (but + rather requires a SoC-specific glue driver to call it), it + can not be enabled from the configuration menu. + +config VIDEO_BRIDGE_SAMSUNG_DSIM + bool "Enable IMX SEC DSI video support" + select VIDEO_BRIDGE + select VIDEO_BRIDGE_SAMSUNG_HOST_DSI + select VIDEO_LINK + help + This option enables support DSI internal bridge which can be used on + devices which have DSI devices connected. + config VIDEO_BRIDGE_SOLOMON_SSD2825 bool "Solomon SSD2825 bridge driver" depends on PANEL && DM_GPIO diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile index 58697e3cbe..4d722cf626 100644 --- a/drivers/video/bridge/Makefile +++ b/drivers/video/bridge/Makefile @@ -8,5 +8,7 @@ obj-$(CONFIG_VIDEO_BRIDGE_PARADE_DP501) += dp501.o obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o +obj-$(CONFIG_VIDEO_BRIDGE_SAMSUNG_HOST_DSI) += samsung-dsi-host.o +obj-$(CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM) += samsung-dsim.o obj-$(CONFIG_VIDEO_BRIDGE_SOLOMON_SSD2825) += ssd2825.o obj-$(CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768) += tc358768.o diff --git a/drivers/video/bridge/samsung-dsi-host.c b/drivers/video/bridge/samsung-dsi-host.c new file mode 100644 index 0000000000..d476bb0ecf --- /dev/null +++ b/drivers/video/bridge/samsung-dsi-host.c @@ -0,0 +1,1638 @@ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2018 NXP + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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_TXREQUESTHSCLK BIT(31) +#define CLKCTRL_DPHY_SEL_1G BIT(29) +#define CLKCTRL_DPHY_SEL_1P5G (0x0 << 29) +#define CLKCTRL_ESCCLKEN BIT(28) +#define CLKCTRL_PLLBYPASS BIT(29) +#define CLKCTRL_BYTECLKSRC_DPHY_PLL REG_PUT(0, 26, 25) +#define CLKCTRL_BYTECLKEN BIT(24) +#define CLKCTRL_SET_LANEESCCLKEN(x) REG_PUT(x, 23, 19) +#define CLKCTRL_SET_ESCPRESCALER(x) REG_PUT(x, 15, 0) + +#define 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 + +/* Dispmix Control & GPR Registers */ +#define DISPLAY_MIX_SFT_RSTN_CSR 0x00 +#ifdef CONFIG_IMX8MN +#define MIPI_DSI_I_PRESETn_SFT_EN BIT(0) | BIT(1) +#else + #define MIPI_DSI_I_PRESETn_SFT_EN BIT(5) +#endif +#define DISPLAY_MIX_CLK_EN_CSR 0x04 + +#ifdef CONFIG_IMX8MN +#define MIPI_DSI_PCLK_SFT_EN BIT(0) +#define MIPI_DSI_CLKREF_SFT_EN BIT(1) +#else + #define MIPI_DSI_PCLK_SFT_EN BIT(8) + #define MIPI_DSI_CLKREF_SFT_EN BIT(9) +#endif +#define GPR_MIPI_RESET_DIV 0x08 + /* Clock & Data lanes reset: Active Low */ + #define GPR_MIPI_S_RESETN BIT(16) + #define GPR_MIPI_M_RESETN BIT(17) + +#define 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_PLL_DPDNSWAP_CLK (1 << 25) +#define DSIM_PLL_DPDNSWAP_DAT (1 << 24) +#define DSIM_FREQ_BAND(x) ((x) << 24) +#define DSIM_PLL_EN BIT(23) +#define DSIM_PLL_P(x, offset) ((x) << (offset)) +#define DSIM_PLL_M(x) ((x) << 4) +#define DSIM_PLL_S(x) ((x) << 1) + +/* DSIM_PHYCTRL */ +#define DSIM_PHYCTRL_ULPS_EXIT(x) (((x) & 0x1ff) << 0) +#define DSIM_PHYCTRL_B_DPHYCTL_VREG_LP BIT(30) +#define DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP BIT(14) + +/* DSIM_PHYTIMING */ +#define DSIM_PHYTIMING_LPX(x) ((x) << 8) +#define DSIM_PHYTIMING_HS_EXIT(x) ((x) << 0) + +/* DSIM_PHYTIMING1 */ +#define DSIM_PHYTIMING1_CLK_PREPARE(x) ((x) << 24) +#define DSIM_PHYTIMING1_CLK_ZERO(x) ((x) << 16) +#define DSIM_PHYTIMING1_CLK_POST(x) ((x) << 8) +#define DSIM_PHYTIMING1_CLK_TRAIL(x) ((x) << 0) + +/* DSIM_PHYTIMING2 */ +#define DSIM_PHYTIMING2_HS_PREPARE(x) ((x) << 16) +#define DSIM_PHYTIMING2_HS_ZERO(x) ((x) << 8) +#define DSIM_PHYTIMING2_HS_TRAIL(x) ((x) << 0) + +#define DSI_MAX_BUS_WIDTH 4 +#define DSI_NUM_VIRTUAL_CHANNELS 4 +#define DSI_TX_FIFO_SIZE 2048 +#define DSI_RX_FIFO_SIZE 256 +#define DSI_XFER_TIMEOUT_MS 100 +#define DSI_RX_FIFO_EMPTY 0x30800002 + +struct samsung_dsim_driver_data { + const unsigned int *reg_ofs; + unsigned int plltmr_reg; + unsigned int has_freqband:1; + unsigned int has_clklane_stop:1; + unsigned int has_broken_fifoctrl_emptyhdr:1; + unsigned int num_clks; + unsigned int min_freq; + unsigned int max_freq; + unsigned int wait_for_reset; + unsigned int num_bits_resol; + unsigned int pll_p_offset; + const unsigned int *reg_values; + unsigned int pll_fin_min; + unsigned int pll_fin_max; + u16 m_min; + u16 m_max; +}; + +enum reg_idx { + DSIM_STATUS_REG, /* Status register */ + DSIM_RGB_STATUS_REG, /* RGB status register */ + DSIM_SWRST_REG, /* Software reset register */ + DSIM_CLKCTRL_REG, /* Clock control register */ + DSIM_TIMEOUT_REG, /* Time out register */ + DSIM_CONFIG_REG, /* Configuration register */ + DSIM_ESCMODE_REG, /* Escape mode register */ + DSIM_MDRESOL_REG, + DSIM_MVPORCH_REG, /* Main display Vporch register */ + DSIM_MHPORCH_REG, /* Main display Hporch register */ + DSIM_MSYNC_REG, /* Main display sync area register */ + DSIM_INTSRC_REG, /* Interrupt source register */ + DSIM_INTMSK_REG, /* Interrupt mask register */ + DSIM_PKTHDR_REG, /* Packet Header FIFO register */ + DSIM_PAYLOAD_REG, /* Payload FIFO register */ + DSIM_RXFIFO_REG, /* Read FIFO register */ + DSIM_FIFOCTRL_REG, /* FIFO status and control register */ + DSIM_PLLCTRL_REG, /* PLL control register */ + DSIM_PHYCTRL_REG, + DSIM_PHYTIMING_REG, + DSIM_PHYTIMING1_REG, + DSIM_PHYTIMING2_REG, + NUM_REGS +}; + +static const unsigned int exynos_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x00, + [DSIM_SWRST_REG] = 0x04, + [DSIM_CLKCTRL_REG] = 0x08, + [DSIM_TIMEOUT_REG] = 0x0c, + [DSIM_CONFIG_REG] = 0x10, + [DSIM_ESCMODE_REG] = 0x14, + [DSIM_MDRESOL_REG] = 0x18, + [DSIM_MVPORCH_REG] = 0x1c, + [DSIM_MHPORCH_REG] = 0x20, + [DSIM_MSYNC_REG] = 0x24, + [DSIM_INTSRC_REG] = 0x2c, + [DSIM_INTMSK_REG] = 0x30, + [DSIM_PKTHDR_REG] = 0x34, + [DSIM_PAYLOAD_REG] = 0x38, + [DSIM_RXFIFO_REG] = 0x3c, + [DSIM_FIFOCTRL_REG] = 0x44, + [DSIM_PLLCTRL_REG] = 0x4c, + [DSIM_PHYCTRL_REG] = 0x5c, + [DSIM_PHYTIMING_REG] = 0x64, + [DSIM_PHYTIMING1_REG] = 0x68, + [DSIM_PHYTIMING2_REG] = 0x6c, +}; + +static const unsigned int exynos5433_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x04, + [DSIM_RGB_STATUS_REG] = 0x08, + [DSIM_SWRST_REG] = 0x0C, + [DSIM_CLKCTRL_REG] = 0x10, + [DSIM_TIMEOUT_REG] = 0x14, + [DSIM_CONFIG_REG] = 0x18, + [DSIM_ESCMODE_REG] = 0x1C, + [DSIM_MDRESOL_REG] = 0x20, + [DSIM_MVPORCH_REG] = 0x24, + [DSIM_MHPORCH_REG] = 0x28, + [DSIM_MSYNC_REG] = 0x2C, + [DSIM_INTSRC_REG] = 0x34, + [DSIM_INTMSK_REG] = 0x38, + [DSIM_PKTHDR_REG] = 0x3C, + [DSIM_PAYLOAD_REG] = 0x40, + [DSIM_RXFIFO_REG] = 0x44, + [DSIM_FIFOCTRL_REG] = 0x4C, + [DSIM_PLLCTRL_REG] = 0x94, + [DSIM_PHYCTRL_REG] = 0xA4, + [DSIM_PHYTIMING_REG] = 0xB4, + [DSIM_PHYTIMING1_REG] = 0xB8, + [DSIM_PHYTIMING2_REG] = 0xBC, +}; + +enum reg_value_idx { + RESET_TYPE, + PLL_TIMER, + STOP_STATE_CNT, + PHYCTRL_ULPS_EXIT, + PHYCTRL_VREG_LP, + PHYCTRL_SLEW_UP, + PHYTIMING_LPX, + PHYTIMING_HS_EXIT, + PHYTIMING_CLK_PREPARE, + PHYTIMING_CLK_ZERO, + PHYTIMING_CLK_POST, + PHYTIMING_CLK_TRAIL, + PHYTIMING_HS_PREPARE, + PHYTIMING_HS_ZERO, + PHYTIMING_HS_TRAIL +}; + +static const unsigned int reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x0af), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x27), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x09), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const unsigned int exynos5422_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x08), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0d), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x30), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x0a), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0c), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x11), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0d), +}; + +static const unsigned int exynos5433_reg_values[] = { + [RESET_TYPE] = DSIM_FUNCRST, + [PLL_TIMER] = 22200, + [STOP_STATE_CNT] = 0xa, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x190), + [PHYCTRL_VREG_LP] = DSIM_PHYCTRL_B_DPHYCTL_VREG_LP, + [PHYCTRL_SLEW_UP] = DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x07), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0c), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x2d), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x09), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0b), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x10), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), +}; + +static const unsigned int imx8mm_dsim_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x26), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x08), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x58, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 5, + .max_freq = 1500, + .wait_for_reset = 0, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5433_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1500, + .wait_for_reset = 1, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5422_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 2100, + .wait_for_reset = 0, + .num_bits_resol = 12, + /* + * Unlike Exynos, PLL_P(PMS_P) offset 14 is used in i.MX8M Mini/Nano/Plus + * downstream driver - drivers/gpu/drm/bridge/sec-dsim.c + */ + .pll_p_offset = 14, + .reg_values = imx8mm_dsim_reg_values, + .pll_fin_min = 2, + .pll_fin_max = 30, + .m_min = 64, + .m_max = 1023, + .min_freq = 1050, +}; + +static const struct samsung_dsim_driver_data * +samsung_dsim_types[DSIM_TYPE_COUNT] = { + [DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, + [DSIM_TYPE_EXYNOS4210] = &exynos4_dsi_driver_data, + [DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, + [DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, + [DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, + [DSIM_TYPE_IMX8MM] = &imx8mm_dsi_driver_data, + [DSIM_TYPE_IMX8MP] = &imx8mm_dsi_driver_data, +}; + +/* DSIM PLL configuration from spec: + * + * Fout(DDR) = (M * Fin) / (P * 2^S), so Fout / Fin = M / (P * 2^S) + * Fin_pll = Fin / P (6 ~ 12 MHz) + * S: [2:0], M: [12:3], P: [18:13], so + * TODO: 'S' is in [0 ~ 3], 'M' is in, 'P' is in [1 ~ 33] + * + */ + +struct samsung_dsi { + void __iomem *reg_base; + struct clk sclk_mipi; + const struct samsung_dsim_driver_data *driver_data; + + /* kHz clocks */ + uint64_t pix_clk; + uint64_t bit_clk; + uint64_t 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; + uint32_t max_data_lanes; + uint64_t max_data_rate; + + 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) +{ + uint32_t intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPLFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPLFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_for_hdr_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + uint32_t intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPHFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPHFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + + +static int samsung_dsi_wait_for_rx_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + uint32_t intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_RXDATDONE) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_RXDATDONE); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_pll_stable(struct samsung_dsi *dsim) +{ + uint32_t status; + ulong start; + + start = get_timer(0); /* Get current timestamp */ + + do { + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (status & 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; + uint32_t pllctrl = 0, status, data_lanes_en, stop; + + writel(dsim->driver_data->reg_values[PLL_TIMER], + dsim->reg_base + dsim->driver_data->plltmr_reg); + + /* TODO: config dp/dn swap if requires */ + + pllctrl |= PLLCTRL_SET_PMS(dsim->pms) | PLLCTRL_PLLEN; + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, pllctrl); + + ret = samsung_dsi_wait_pll_stable(dsim); + if (ret) { + printf("wait for pll stable time out\n"); + return ret; + } + + /* wait for clk & data lanes to go to stop state */ + mdelay(1); + + data_lanes_en = (0x1 << dsim->lanes) - 1; + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (!(status & DSIM_STOP_STATE_CLK)) { + printf("clock is not in stop state\n"); + return -EBUSY; + } + + stop = DSIM_STOP_STATE_DAT(status); + if ((stop & data_lanes_en) != data_lanes_en) { + printf("one or more data lanes is not in stop state\n"); + return -EBUSY; + } + + return 0; +} + +static void samsung_dsi_set_main_mode(struct samsung_dsi *dsim) +{ + uint32_t bpp, hfp_wc, hbp_wc, hsa_wc, wc; + uint32_t mdresol = 0, mvporch = 0, mhporch = 0, msync = 0; + struct display_timing *timings = &dsim->timings; + + mdresol |= DSIM_MAIN_VRESOL(timings->vactive.typ) | + DSIM_MAIN_HRESOL(timings->hactive.typ); + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); + + mvporch |= MVPORCH_SET_MAINVBP(timings->vback_porch.typ) | + MVPORCH_SET_STABLEVFP(timings->vfront_porch.typ) | + MVPORCH_SET_CMDALLOW(0x0); + samsung_dsim_write(dsim, DSIM_MVPORCH_REG, mvporch); + + bpp = mipi_dsi_pixel_format_to_bpp(dsim->format); + + wc = DIV_ROUND_UP(timings->hfront_porch.typ* (bpp >> 3), + dsim->lanes); + hfp_wc = wc > MIPI_HFP_PKT_OVERHEAD ? + wc - MIPI_HFP_PKT_OVERHEAD : timings->hfront_porch.typ; + wc = DIV_ROUND_UP(timings->hback_porch.typ * (bpp >> 3), + dsim->lanes); + hbp_wc = wc > MIPI_HBP_PKT_OVERHEAD ? + wc - MIPI_HBP_PKT_OVERHEAD : timings->hback_porch.typ; + + mhporch |= MHPORCH_SET_MAINHFP(hfp_wc) | + MHPORCH_SET_MAINHBP(hbp_wc); + + samsung_dsim_write(dsim, DSIM_MHPORCH_REG, mhporch); + + wc = DIV_ROUND_UP(timings->hsync_len.typ * (bpp >> 3), + dsim->lanes); + hsa_wc = wc > MIPI_HSA_PKT_OVERHEAD ? + wc - MIPI_HSA_PKT_OVERHEAD : timings->hsync_len.typ; + + msync |= MSYNC_SET_MAINVSA(timings->vsync_len.typ) | + MSYNC_SET_MAINHSA(hsa_wc); + + debug("hfp_wc %u hbp_wc %u hsa_wc %u\n", hfp_wc, hbp_wc, hsa_wc); + + samsung_dsim_write(dsim, DSIM_MSYNC_REG, msync); +} + +static void samsung_dsi_config_dpi(struct samsung_dsi *dsim) +{ + uint32_t config = 0, rgb_status = 0, data_lanes_en; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) + rgb_status &= ~RGB_STATUS_CMDMODE_INSEL; + else + rgb_status |= RGB_STATUS_CMDMODE_INSEL; + + samsung_dsim_write(dsim, DSIM_RGB_STATUS_REG, rgb_status); + + if (dsim->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) { + config |= DSIM_CLKLANE_STOP; + config |= DSIM_NON_CONTINUOUS_CLKLANE; + } + + if (dsim->mode_flags & MIPI_DSI_MODE_VSYNC_FLUSH) + config |= DSIM_MFLUSH_VS; + + /* disable EoT packets in HS mode */ + if (dsim->mode_flags & MIPI_DSI_MODE_EOT_PACKET) + config |= DSIM_EOT_DISABLE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + config |= DSIM_VIDEO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + config |= DSIM_BURST_MODE; + + else if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + config |= DSIM_SYNC_INFORM; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_AUTO_VERT) + config |= DSIM_AUTO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSE) + config |= DSIM_HSE_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HFP) + config |= DSIM_HFP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HBP) + config |= DSIM_HBP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSA) + config |= DSIM_HSA_DISABLE_MODE; + } + + config |= DSIM_MAIN_VC(dsim->channel); + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + switch (dsim->format) { + case MIPI_DSI_FMT_RGB888: + config |= DSIM_MAIN_PIX_FORMAT_RGB888; + break; + case MIPI_DSI_FMT_RGB666: + config |= DSIM_MAIN_PIX_FORMAT_RGB666; + break; + case MIPI_DSI_FMT_RGB666_PACKED: + config |= DSIM_MAIN_PIX_FORMAT_RGB666_P; + break; + case MIPI_DSI_FMT_RGB565: + config |= DSIM_MAIN_PIX_FORMAT_RGB565; + break; + default: + printf("invalid pixel format\n"); + break; + } + } + + /* config data lanes number and enable lanes */ + data_lanes_en = BIT(dsim->lanes) - 1; + config |= (DSIM_NUM_OF_DATA_LANE(dsim->lanes - 1) | DSIM_LANE_EN_CLK | + DSIM_LANE_EN(data_lanes_en)); + + debug("DSIM config 0x%x\n", config); + + samsung_dsim_write(dsim, DSIM_CONFIG_REG, config); +} + +static void samsung_dsi_config_cmd_lpm(struct samsung_dsi *dsim, + bool enable) +{ + uint32_t escmode; + + escmode = samsung_dsim_read(dsim, DSIM_ESCMODE_REG); + + if (enable) + escmode |= ESCMODE_CMDLPDT; + else + escmode &= ~ESCMODE_CMDLPDT; + + samsung_dsim_write(dsim, DSIM_ESCMODE_REG, escmode); +} + +static void samsung_dsi_config_dphy(struct samsung_dsi *dsim) +{ + 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) +{ + uint32_t pl_data; + + if (!length) + return; + + while (length >= 4) { + pl_data = get_unaligned_le32(payload); + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + payload += 4; + length -= 4; + } + + pl_data = 0; + switch (length) { + case 3: + pl_data |= ((u8 *)payload)[2] << 16; + case 2: + pl_data |= ((u8 *)payload)[1] << 8; + case 1: + pl_data |= ((u8 *)payload)[0]; + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + break; + } +} + +static void samsung_dsim_write_ph_to_sfr_fifo(struct samsung_dsi *dsim, + void *header, + bool use_lpm) +{ + uint32_t pkthdr; + + pkthdr = PKTHDR_SET_DATA1(((u8 *)header)[2]) | /* WC MSB */ + PKTHDR_SET_DATA0(((u8 *)header)[1]) | /* WC LSB */ + PKTHDR_SET_DI(((u8 *)header)[0]); /* Data ID */ + + samsung_dsim_write(dsim, DSIM_PKTHDR_REG, pkthdr); +} + +static int samsung_dsim_read_pl_from_sfr_fifo(struct samsung_dsi *dsim, + void *payload, + size_t length) +{ + uint8_t data_type; + uint16_t word_count = 0; + uint32_t fifoctrl, ph, pl; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + if (WARN_ON(fifoctrl & FIFOCTRL_EMPTYRX)) + return -EINVAL; + + ph = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + data_type = PKTHDR_GET_DT(ph); + switch (data_type) { + case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: + dev_err(dsim->device->dev, "peripheral report error: (0-7)%x, (8-15)%x\n", + PKTHDR_GET_DATA0(ph), PKTHDR_GET_DATA1(ph)); + return -EPROTO; + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE: + if (!WARN_ON(length < 2)) { + ((u8 *)payload)[1] = PKTHDR_GET_DATA1(ph); + word_count++; + } + /* fall through */ + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: + ((u8 *)payload)[0] = PKTHDR_GET_DATA0(ph); + word_count++; + length = word_count; + break; + case MIPI_DSI_RX_DCS_LONG_READ_RESPONSE: + case MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE: + word_count = PKTHDR_GET_WC(ph); + if (word_count > length) { + dev_err(dsim->device->dev, "invalid receive buffer length\n"); + return -EINVAL; + } + + length = word_count; + + while (word_count >= 4) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + ((u8 *)payload)[0] = pl & 0xff; + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + ((u8 *)payload)[3] = (pl >> 24) & 0xff; + payload += 4; + word_count -= 4; + } + + if (word_count > 0) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + + switch (word_count) { + case 3: + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + case 2: + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + case 1: + ((u8 *)payload)[0] = pl & 0xff; + break; + } + } + + break; + default: + return -EINVAL; + } + + return length; +} + +static void samsung_dsi_init_fifo_pointers(struct samsung_dsi *dsim) +{ + uint32_t fifoctrl, fifo_ptrs; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + fifo_ptrs = FIFOCTRL_NINITRX | + FIFOCTRL_NINITSFR | + FIFOCTRL_NINITI80 | + FIFOCTRL_NINITSUB | + FIFOCTRL_NINITMAIN; + + fifoctrl &= ~fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); + + fifoctrl |= fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); +} + +static void samsung_dsi_config_clkctrl(struct samsung_dsi *dsim) +{ + uint32_t clkctrl = 0, data_lanes_en; + uint64_t byte_clk, esc_prescaler; + + clkctrl |= CLKCTRL_TXREQUESTHSCLK; + + /* using 1.5Gbps PHY */ + clkctrl |= CLKCTRL_DPHY_SEL_1P5G; + clkctrl |= CLKCTRL_ESCCLKEN; + clkctrl &= ~CLKCTRL_PLLBYPASS; + clkctrl |= CLKCTRL_BYTECLKSRC_DPHY_PLL; + clkctrl |= CLKCTRL_BYTECLKEN; + + data_lanes_en = (0x1 << dsim->lanes) - 1; + clkctrl |= CLKCTRL_SET_LANEESCCLKEN(0x1 | data_lanes_en << 1); + + /* calculate esc prescaler from byte clock: + * EscClk = ByteClk / EscPrescaler; + */ + byte_clk = dsim->bit_clk >> 3; + esc_prescaler = DIV_ROUND_UP_ULL(byte_clk, MAX_ESC_CLK_FREQ); + + clkctrl |= CLKCTRL_SET_ESCPRESCALER(esc_prescaler); + + debug("DSIM clkctrl 0x%x\n", clkctrl); + + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, clkctrl); +} + +static void samsung_dsi_set_standby(struct samsung_dsi *dsim, + bool standby) +{ + uint32_t mdresol = 0; + + mdresol = samsung_dsim_read(dsim, DSIM_MDRESOL_REG); + + if (standby) + mdresol |= DSIM_MAIN_STAND_BY; + else + mdresol &= ~DSIM_MAIN_STAND_BY; + + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); +} + +static void samsung_dsi_disable_clkctrl(struct samsung_dsi *dsim) +{ + uint32_t clkctrl; + + clkctrl = samsung_dsim_read(dsim, DSIM_CLKCTRL_REG); + + clkctrl &= ~CLKCTRL_TXREQUESTHSCLK; + clkctrl &= ~CLKCTRL_ESCCLKEN; + clkctrl &= ~CLKCTRL_BYTECLKEN; + + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, clkctrl); +} + +static void samsung_dsi_disable_pll(struct samsung_dsi *dsim) +{ + uint32_t pllctrl; + + pllctrl = samsung_dsim_read(dsim, DSIM_PLLCTRL_REG); + + pllctrl &= ~PLLCTRL_PLLEN; + + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, pllctrl); +} + +static inline struct samsung_dsi *host_to_dsi(struct mipi_dsi_host *host) +{ + return container_of(host, struct samsung_dsi, dsi_host); +} + +static int samsung_dsi_bridge_clk_set(struct samsung_dsi *dsim_host) +{ + int bpp; + unsigned long pix_clk, bit_clk; + unsigned long fin, fout; + 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); + +#if 0 + if (bit_clk > dsim_host->max_data_rate) { + printf("request bit clk freq exceeds lane's maximum value\n"); + return -EINVAL; + } +#endif + + dsim_host->pix_clk = DIV_ROUND_UP_ULL(pix_clk, 1000); + dsim_host->bit_clk = DIV_ROUND_UP_ULL(bit_clk, 1000); + + fout = dsim_host->bit_clk; + fin = clk_get_rate(&dsim_host->sclk_mipi); + if (fin == 0) { + printf("Error: DSI PHY reference clock is disabled\n"); + return -EINVAL; + } + + fout = samsung_dsim_pll_find_pms(dsim_host, fin, bit_clk, &p, &m, &s); + if (!fout) { + printf("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) { + printf("dsim pll config failed: %d\n", ret); + return ret; + } + + /* config dphy timings */ + samsung_dsi_config_dphy(dsim_host); + + samsung_dsi_init_fifo_pointers(dsim_host); + + /* config esc clock, byte clock and etc */ + samsung_dsi_config_clkctrl(dsim_host); + + return 0; +} + +static int samsung_dsi_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *device) +{ + struct samsung_dsi *dsi = host_to_dsi(host); + + if (!device->lanes || device->lanes > dsi->max_data_lanes) { + printf("invalid data lanes number\n"); + return -EINVAL; + } + + if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO) || + !((device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) || + (device->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))) { + printf("unsupported dsi mode\n"); + return -EINVAL; + } + + if (device->format != MIPI_DSI_FMT_RGB888 && + device->format != MIPI_DSI_FMT_RGB565 && + device->format != MIPI_DSI_FMT_RGB666 && + device->format != MIPI_DSI_FMT_RGB666_PACKED) { + printf("unsupported pixel format: %#x\n", device->format); + return -EINVAL; + } + + dsi->lanes = device->lanes; + dsi->channel = device->channel; + dsi->format = device->format; + dsi->mode_flags = device->mode_flags; + + debug("lanes %u, channel %u, format 0x%x, mode_flags 0x%lx\n", dsi->lanes, + dsi->channel, dsi->format, dsi->mode_flags); + + samsung_dsi_bridge_clk_set(dsi); + samsung_dsi_bridge_prepare(dsi); + + return 0; +} + +static ssize_t samsung_dsi_host_transfer(struct mipi_dsi_host *host, + const struct mipi_dsi_msg *msg) +{ + struct samsung_dsi *dsim = host_to_dsi(host); + int ret, nb_bytes; + bool use_lpm; + struct mipi_dsi_packet packet; + +#ifdef DEBUG + int i = 0; + const u8 *p = msg->tx_buf; + + printf("samsung_dsi_host_transfer\n"); + for (; i < msg->tx_len; i++) { + printf("0x%.2x ", *(u8 *)p); + p++; + } + printf("\n"); +#endif + + ret = mipi_dsi_create_packet(&packet, msg); + if (ret) { + dev_err(dsim->device->dev, "failed to create dsi packet: %d\n", ret); + return ret; + } + + /* config LPM for CMD TX */ + use_lpm = msg->flags & MIPI_DSI_MSG_USE_LPM ? true : false; + samsung_dsi_config_cmd_lpm(dsim, use_lpm); + + if (packet.payload_length) { /* Long Packet case */ + /* write packet payload */ + samsung_dsim_write_pl_to_sfr_fifo(dsim, + packet.payload, + packet.payload_length); + + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, + packet.header, + use_lpm); + + ret = samsung_dsi_wait_for_pkt_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait tx done timeout!\n"); + return -EBUSY; + } + } else { + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, + packet.header, + use_lpm); + + ret = samsung_dsi_wait_for_hdr_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait pkthdr tx done time out\n"); + return -EBUSY; + } + } + + /* read packet payload */ + if (unlikely(msg->rx_buf)) { + ret = samsung_dsi_wait_for_rx_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait rx done time out\n"); + return -EBUSY; + } + + ret = samsung_dsim_read_pl_from_sfr_fifo(dsim, + msg->rx_buf, + msg->rx_len); + if (ret < 0) + return ret; + nb_bytes = msg->rx_len; + } else { + nb_bytes = packet.size; + } + + return nb_bytes; + +} + + +static const struct mipi_dsi_host_ops samsung_dsi_host_ops = { + .attach = samsung_dsi_host_attach, + .transfer = samsung_dsi_host_transfer, +}; + +static int samsung_dsi_init(struct udevice *dev, + struct mipi_dsi_device *device, + struct display_timing *timings, + unsigned int max_data_lanes, + const struct mipi_dsi_phy_ops *phy_ops) +{ + struct samsung_dsi *dsi = dev_get_priv(dev); + struct udevice *dsi_bridge = device->dev; + enum samsung_dsim_type hw_type = (enum samsung_dsim_type) dev_get_driver_data(dsi_bridge); + + dsi->max_data_lanes = max_data_lanes; + dsi->device = device; + dsi->dsi_host.ops = &samsung_dsi_host_ops; + dsi->driver_data = samsung_dsim_types[hw_type]; + device->host = &dsi->dsi_host; + + dsi->reg_base = (void *)dev_read_addr(device->dev); + if ((fdt_addr_t)dsi->reg_base == FDT_ADDR_T_NONE) { + dev_err(device->dev, "dsi dt register address error\n"); + return -EINVAL; + } + + dsi->timings = *timings; + + return 0; +} + +static int samsung_dsi_enable(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* enable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, true); + + return 0; +} + +static int samsung_dsi_disable(struct udevice *dev) +{ + uint32_t intsrc; + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* disable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, false); + + /* disable esc clock & byte clock */ + samsung_dsi_disable_clkctrl(dsim_host); + + /* disable dsim pll */ + samsung_dsi_disable_pll(dsim_host); + + /* Clear all intsrc */ + intsrc = samsung_dsim_read(dsim_host, DSIM_INTSRC_REG); + samsung_dsim_write(dsim_host, DSIM_INTSRC_REG, intsrc); + + return 0; +} + +struct dsi_host_ops samsung_dsi_ops = { + .init = samsung_dsi_init, + .enable = samsung_dsi_enable, + .disable = samsung_dsi_disable, +}; + +static int samsung_dsi_probe(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + int ret; + + ret = clk_get_by_name(dev, "sclk_mipi", &dsim_host->sclk_mipi); + if (ret) + debug("Failed to get sclk_mipi clock\n"); + + return ret; +} + +static const struct udevice_id samsung_dsi_ids[] = { + { .compatible = "samsung,sec-mipi-dsi" }, + { } +}; + +U_BOOT_DRIVER(samsung_dsi) = { + .name = "samsung_dsi", + .id = UCLASS_DSI_HOST, + .of_match = samsung_dsi_ids, + .probe = samsung_dsi_probe, + .remove = samsung_dsi_disable, + .ops = &samsung_dsi_ops, + .priv_auto = sizeof(struct samsung_dsi), +}; diff --git a/drivers/video/bridge/samsung-dsim.c b/drivers/video/bridge/samsung-dsim.c new file mode 100644 index 0000000000..ca5d99a909 --- /dev/null +++ b/drivers/video/bridge/samsung-dsim.c @@ -0,0 +1,149 @@ +// 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 07:10:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3256 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 A6492412C7 for ; Sun, 14 Jul 2024 09:11:01 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-59c1314940csf327052a12.3 for ; Sun, 14 Jul 2024 00:11:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941061; cv=pass; d=google.com; s=arc-20160816; b=la7+GfOmZw87pX9lbVSnpkaHWDS4HghhRh19gSier3HpZWcxdvRV6YYT61hug+4K6R 0qT3sFDTjIdPAoPqJMRqsxfALwshGoAtCtWTOpFNmCGcspT3QatmtULSCjqEsOwo+XEh 1J6AhtufoEk9E9nxKBlVbnGhnwDu3/NkpExZwMVk+V2JN4I+BZx+4PNQpzeSNOoRBGHk tDBW6tJdWRm08AK3MnIYQwRu2ajf08ogplQl6LSZgmHcHDz02ZsLI1U9ONaZ7T7ih0y9 ntliEb/ryqYW8GLt1/EJmplpXT0lPpTm9Cz6ffnP1M8ogEMWrzn/oPovHeLVpsK1nxm0 MILw== 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=ovgjggMhY10bgnylXzBrcDgpgoVmx8wKNmk2u2rgSHw=; b=lzeu8kzFrqdqkWxSJ3o+sV5k7cbq8FR/daMycAbXmXYxh0/GhFDdJm8izrPFGXCWu3 ZixQe7cuAdJhIhGQRIn7916tmUpnmVzhr5pR0PPndF7BkcOZiyB5jhFdYAu0dj/1NRea 8EgYdewYCH0ckU+fDSHSqXfVavDUv8/2OHabQe89sstvnY0/+fI6Kr5x/QwemKo3WDaQ Ha+sPNpGdM87TCnF8iRZvwGwhalrIxKRxjKjvgDfiaEOq+vNskkLGeUkhx2E+4m4PdYr PxCvszUg1JUyTnYvHXAhHqpYX4cFZVN8Yoqgq0sfP5VXYRDb7lnY7V0xGopszUX76qiQ XfTA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eBSc66Ir; 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=1720941061; x=1721545861; 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=Pyuekm2lhGOZeO5Y+oB2Ku5CxyzUxtBFZrjnj4zUYRk8Nmsh6bIQVjcrxlklopOgVD hbvUCgjZVdWzDiB3kgVrQpEesmGVpfm9BAXeE5tTkaLujo41F/3Uajt5lJ5VgZqjMfXn ktno774Fi7bVqfYr42vBNtmQgJFUGAfL2RXr8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941061; x=1721545861; 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=ULi0NodS7sr4voc29rm7Sgg+d4GqvoZnj3yCyfChq4tsEbmsTqKlc86KjKVMNiil9g /hLivz4jI3pIrm60i+1La8oqHcnSp+S4xctvavRjNi2/W301i0jlA0BJfxxAniKxg2zH bK96g/lDRxeJW7Eew5jpNCrHCBivl9OxKspnFYWXNozyxglalOrnQfS5WPlXMQ09oRMN Y5wCaEF5cRXGFyfphSVJBGjfZKpxPXf701JG9EKbSd3E7MdUJ7x5tMe/fsu1t8KB30rJ t/t55zrDiS40fZKE+/QMWFw5vcxjqmErK7i7ZAcKW45EI9nh20fexYK0URBEuPcZRsFW Ow1g== X-Forwarded-Encrypted: i=2; AJvYcCVRfEOrSRiTYnvD82IwNJQchVpX2iTPZ7bKXOmWxu3V5IdlUhnMWYJzO2AxCV5+ylBsdE25kmqqwsndhfaGCoi7ckkUQeLLFfJeeJKMtXxBQiK25emnvNPEu8r4CQ== X-Gm-Message-State: AOJu0YxMlcxIxru8GH7s/ZZHDlkuzxpLp0AFRrKb6wLWTzYOFhH2NBmi 8j47La2MSyPt82PRV79rg79t/QLzKeRx8SkZw4nI+yPxiXLuUtLtti8wfKhUZq01ng== X-Google-Smtp-Source: AGHT+IEDdcjajhgm/Qox4BwlnKUAfACnZlhYIPb5ZpFUyGGNeSAA0NI/iiAvdNlma2N5Opd7i3dRMg== X-Received: by 2002:a05:6402:33d8:b0:58c:f5bd:eb65 with SMTP id 4fb4d7f45d1cf-594bb674df7mr9203726a12.22.1720941061369; Sun, 14 Jul 2024 00:11:01 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:32e:b0:58b:ce37:ebce with SMTP id 4fb4d7f45d1cf-59825c4211fls172645a12.1.-pod-prod-03-eu; Sun, 14 Jul 2024 00:11:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUAhyr50Z0IO0LnDcXck0n4K6zUQ9J904FLosxyNFKVhFjRGvg2v1mxoSdzHYVz44IOPX5mJuzNW7v35jcLxFO1Q81IbX3MaV6NCLdf+pp1ML0t X-Received: by 2002:a05:6402:5bc6:b0:587:2dd0:93ec with SMTP id 4fb4d7f45d1cf-594bc7c7e36mr10413208a12.30.1720941059768; Sun, 14 Jul 2024 00:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941059; cv=none; d=google.com; s=arc-20160816; b=qx1co//nAe978BPo996uoE/aD3xcUYXGfgBywigeUUJr0Hdk4HCYGfmv+eo+YKdyR2 CcUhZYt+qW0wn/o1a6mwUHJoGtPpvryJnLNJzyXA/I1afOq/XbzkGqvVlU2+f1EnzNBS wYFGfNDht5aUNHf7ZZ3Y0Pk8pmz2baNnoVgBI1z4d+QzhXlszYWiTeb6TRTK3dbngzoe +fvIJo4DU3B+ehwK0vVcaw3KGq4LlDpVZhyfWjewo5LUqDvzum53QftuywDPsdZTBOxP T64y6xnAf191vrlW8BNMUydpEzBGtfLB5QrLYI3JtnvMXhrny5Fg+BpJIBAcB/CdWHyJ mgMw== 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=NriyXSVvwmImr68Vj/dTmnbJf35Xb73PBz6HTBe2OgU=; b=MGxOqXW32FFZvWmi/P7npqBtdoAzq7W4XjG12EeE8pi7CazYsFkyFflLKtdD6zy7aG IC0B0D8VsCPVUDkMHTp3pZiJnDSww/Kl15Sdir/5LBvVHEYIBp4mjhhbTgeYCt4ErB1e N0mbl/vNxBT6LYJdbPKbDwO7b4kBLxm8D0fnq7eUYc+9+VjUbH+V0qk3+CvClPKqdOn5 8vjA7VI3Oz9hPgPUuygRkeV6fMJKmcobIA1LXsuFCQJsusoVYMvVQdcsUnbzXQpxtcCh 0RSSdeiomas5KxSGFNQDy5xdSMsWwZjVjQkoS+UnEDfIywbtCsAoKchsBOqoUo9sJa6N g3oQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eBSc66Ir; 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-59b2504b69esor410101a12.5.2024.07.14.00.10.59 for (Google Transport Security); Sun, 14 Jul 2024 00:10:59 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUwpgMRNtfPaGLQQRkCp5dP1Plvta3YMoSM9UD4IZRlrMzUPd1wa0tRlvWMugsw7IhRTfA1FqDwmLh1aWB3jwE+wMTBJwP7nLZ9aulE+SWHaord X-Received: by 2002:a17:906:dc93:b0:a77:e1fb:7de9 with SMTP id a640c23a62f3a-a780b68aabfmr1149843166b.5.1720941059349; Sun, 14 Jul 2024 00:10:59 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:58 -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 09:10:22 +0200 Message-ID: <20240714071023.10417-24-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=eBSc66Ir; 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 07:10:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3257 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 BE9E74130C for ; Sun, 14 Jul 2024 09:11:02 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-59c1314940csf327064a12.3 for ; Sun, 14 Jul 2024 00:11:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941062; cv=pass; d=google.com; s=arc-20160816; b=UDA9PVPhUeVBSERDE+KxdxRjP6AXczUph1NlqwKxIqpzVnRCMmbs853xhMTdpWgPCs kOE+3OiOix4CJEyS3DWY0CFSNURLTsIPN6PFb/G03JSikNMj8icphq9fytOO7FVa/sSK dd5tVapOxo7cB10svjPMTkHjW39XGPELBnDPjeHFZKC9Cckwu5tgfpAtHqwqfBcI7WC3 ZC63ywvpnm5n4hy8W+gaNebOBeWVpUHK9hbw8sonF+9bmoUveg6nt+H6jB+A7xImQ8Sq tcn4FyIBu3WD0kNwk9wkNTCkgJYDVy1wWFMIgKW1f3F3mhk/g9Ljr8MoiEySEfAAPWD7 Bz9w== 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=IOXI1TSAn3WVGIazBAG/zqvC2moYKLgOnPkDMJs8JeI=; b=mNmrJhDeZcr7T2h4naL1RSRPuArNkf3UQHX+LwazCX/uiUg9F9q4Ey8YqGnryk9C4s mR/I1ALZhfpOBkoS5J3BJqjFoHBJj1ouKYvDPtEH0X+reGhryae7/1420H+aXbEQ4tfO f+bhWTos90Y+QfIJ1miHLqkwOEC8dxhlcXpdZextEMLcoRTjBkqh4vfeGo8J+OsoKW89 kT6SnltcC6l2Gx/TJp5MrU+qG7pbjQFZyPNfihcZ4krnFwNMZ6MwaTK1Tv29Q6+zpHen neuGlbEGoNmdHDMIhWqf+QDxEqIyEt/gfn9q1Y1E+O+ZHd8Oy6AyjzY3RZAwn+Ow6avD ud4A==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="hCeQRR/u"; 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=1720941062; x=1721545862; 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=OQ/qCkC/Va4NuMbzEIdKdI42UQWrtzUlaVbs3pidaTHWyNvjWq3CFAzVU/osW5OwGp 1mAkNKdi2Jy8o/n7LfVoXRyGilRj+FiUX3XTj3qcaGiY4l5lshD6MNXcDLkpwL9HGaF1 YTkO6S7pETVAhGo3a6TBqF1b876kgAEOtFHjM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941062; x=1721545862; 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=RgCW8UdkgD+mMCiyyLS76fKMrb7Rx7YRtMNCBVfYvcYQxKWR3pjG9EA/fMB2rV5sEZ M5gzEwcfM1oTDWCJ40CIm7yFurrbK3MlQw+dsUGPeQCTDOCFIxZetiR/hR9aHK0kkw8x 9n9dZICx+JRK0yec3RkFlwE25aMzzOdnIICU7VFWsY9gB5wdsBtEXSk/hIPhBbeDXnFn UFz0nEwVBuVlSmWdfPsTzWzz6xSvkRAj9CgaxAFoQuGmW7PdvE2RSmis1Yr4oxw6a4zx o9xdqW+yKAM08n6UNdEmoJhG4t6VgleoWtv0SGHBInIQD7KnSamDiqF3dYc7uiUoq1WS qJJg== X-Forwarded-Encrypted: i=2; AJvYcCXPBX1FFMe3m/VCqzdWOXj/kyxb4m5FRe9UV0xMBjz67akEpUj10Wez6A8V0QjTlmTj846yM/ChxBtU/3h/RPLMxHZoQU8ob4Uh786/LIb5vw93ShiZJu+UeQBosA== X-Gm-Message-State: AOJu0YyzSfZ0OYSILSnYzLDZLP0HKtt3LGioR9ZN5nOPoAT0eOxho3rx oiTGEvLurs2hayy4i05ber9a6L1nnAEIVwFXri9R2+AhHKQdJGYMI7SxmBggoHX6bw== X-Google-Smtp-Source: AGHT+IFUnnsSiZbfjlurFLv3k0uRTE4Awb8x1zOGseMJSqyYm43NnfVZ5qDlZoz83uuONvAPUkTbxw== X-Received: by 2002:a05:6402:2707:b0:57c:6234:e95b with SMTP id 4fb4d7f45d1cf-594ba98fafdmr13181527a12.5.1720941062545; Sun, 14 Jul 2024 00:11:02 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:d5d5:0:b0:58b:b493:fcc9 with SMTP id 4fb4d7f45d1cf-598217e0b7als178664a12.0.-pod-prod-03-eu; Sun, 14 Jul 2024 00:11:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWcXfHtBOagupCPteVjZv9/5fw1aeAtPlB6pGe2qBIxUIw7LVp13qukWt458wPDDplSdVoXUoOzjWLFQM+EoUmE5YhBnFhEtOBcEfio6v5EqbTn X-Received: by 2002:a05:6402:17d4:b0:582:9fb8:11a1 with SMTP id 4fb4d7f45d1cf-594bcaaf426mr9914966a12.35.1720941060904; Sun, 14 Jul 2024 00:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941060; cv=none; d=google.com; s=arc-20160816; b=JCuGPRYC5fnuFbtDDOFxv6HkJICrZ1yHNR6YQOGCPT7PSC2gZO7ZunI0xAOi67233j CehXJmxE6lpvYM7NO7DNPESvXErJBvlaap+Mx3oG5dIi4D5iqoFdbcQwWGJBkYr+QCKs 9sbJCa1zYpcstUmfLNipbyt1K8dOvSf5TSpjDy66Mz/BV0hyHZ+3TonhW0z3YcffWt/a NXi0uh1Ch3ySMWZOfoGJDQ5HCjjn/KUpduAPQgA57OyFZxNYuskyDkTKVBdr22dYLBvE vY7Pn9/G4DbJU2xP59BcgDvmhmHsL1CzWpIRZNyQiwQlZGC8ik7rLiBYl2JxckKrfNUs MXhw== 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=Uq6bk7joN8IxG4d7h5qf4b/imZalDLHnKVNBuGsbbUQ=; b=nP1II+8qhxjWzx6GWERlj7BpMjDUR9NJ6xLJQeVUGYDVb9PnXkQl3DUPmg0Z8qRw4R drTFbN8i0HBANWiNS8zew3Q7QNEjpSTxGC6JSD10tb+9ltFsA9y36cMQoSdzqNT5eQXa P5LHrtTWVFEEbAxwNRRJeB/4SYi8ZlLgp3FA2xWOI/qgD2JAMsdb1dGTQZVcjMX6QmqG gdDoTtmg0sbgyNSdN+GFMAV8w2GuAWfc00Jrrx9MYmjuFPy77C8gdPX99GZJAQnw8Ueh BMLslpOzsc7QYNYNAbKP6/YE2PRQ55onWMMPFQk1dRBv0ijvs6BCfRhiR9jUw4FUQH+Z PqOA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="hCeQRR/u"; 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-59b24a6f4ffsor499547a12.2.2024.07.14.00.11.00 for (Google Transport Security); Sun, 14 Jul 2024 00:11:00 -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; AJvYcCUuDIW/TW7zY5PGJVPUR8gEpaN4PUnP257s7sP8V1Cy1ZeEMCDgrUpggUAZ0mybriOz6SPmuNlBuzi6rArXtRi+Mql5LCCdNYXPwUp2CzbfINM/ X-Received: by 2002:a17:907:6d10:b0:a6f:4fc8:2665 with SMTP id a640c23a62f3a-a780b883563mr1345373966b.50.1720941060547; Sun, 14 Jul 2024 00:11:00 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:11:00 -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 09:10:23 +0200 Message-ID: <20240714071023.10417-25-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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="hCeQRR/u"; 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