From patchwork Wed Sep 11 15:10:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3431 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 454BD3F251 for ; Wed, 11 Sep 2024 17:10:44 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cb115566esf38488705e9.2 for ; Wed, 11 Sep 2024 08:10:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067444; cv=pass; d=google.com; s=arc-20240605; b=JOFpu6d+zBpHZOR4XyQgd21TDio7jsKC5M5ZGtd9+dKFoLTjRg8oc4FlLQFC8LUPYh J2zTrUMjh9gOXMt/5ZcGBuphCtOjtdWDbsJy7uWec/dFtUJjsXP4Giz9jFbRCOWFFj9+ 89vkqBEX0uma5EjTPndTExCvigz0EJJGu0yyUCtOBkkNfK7BgayHkRbFTsIEVdKE+z8p Y8SzxpAqwpHS9vpxA81eGtj4jGA4VMKi6EdyZXbbWd07rfSGnD7jwTse9WurxXHwWg28 HadKsmgOqZHBvRjzXZd3M/DGfNATXbuweKVbSEx3sYjdWXfic6KnfV040d3jBAwR2S6l 9F3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:to :from:dkim-signature; bh=xblviIT/WPvwubo1pGbcNmLEU88wwTkV/I5WUrxc7pM=; fh=eSbpZxRfVwFW0dxDYjIyHM1VhRmN3wUtQCouEXrdA1g=; b=YMN0osBM/WFvDrkaC7CV1EODd7tU9ePypWXNegGrp26AYyONSr32T9XiuQM/oHu1BB mbJa0/pUBkzlkcMyi/45G6SuA3YD1vGoiq6/Vimnmc31NDH/qTTbbA96g4giB2wv5s02 JWx+rHts4VmkawtS7iQnadwwGOt6CVn52lURtcnFXvvduZQyoukXNZD/89dqfyUBX22c FsoIt8tQlPtKXj0YsCSx2Go7aCFNPLZAp1x0pDmWb8AoWcDVDfLhhYaBKwNFeevINICm Dae7n3DYK+Meas+RGFGArvlAsP0M9on69pcdOzR2XRkfuqJr5QRHvSh/1DgD8Si2ClYe 4/fQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gd46WgvV; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067444; x=1726672244; 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:to:from:from :to:cc:subject:date:message-id:reply-to; bh=xblviIT/WPvwubo1pGbcNmLEU88wwTkV/I5WUrxc7pM=; b=NTN9TRCJ69DK3lafWB5oC5dSnvlMKDTn4Btt3JzFSp82YOGqr6/I5u1NoYGlT1Cg/1 QLo768J3u9Yt752lAjRURptuUsjKIilQvV09mZxIX5xNHgL6d0LmX+BM+xeUIt1cILZ3 M+LfqYYBULNtIaBoafb/HHnjRL+J8L5LKZcgw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067444; x=1726672244; 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:to:from:x-beenthere:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xblviIT/WPvwubo1pGbcNmLEU88wwTkV/I5WUrxc7pM=; b=gQBvLFWlq+VvN8/PWq6tGB+zN/6Slmr9LLN9WuLtRSjTPtyKitM4e1EEatRjmGPio/ /PJ2KwvnLf1f8PyFFfg1Nzka9h0SKD0tNT6AqWZIa7HRzBTgMgZTn0amobgXxliu7Rij w0DwYTG9max26+Y1f/uRmxezdHGZrrPGh5ePJ4bmhoIPISMYT6SwU0e6HfSC1Bhue6WV R4LuEKk6OMtX7Zat6slQWnNcU9+herc3kd5imstDqWDfd4yK3hG74GgJ6Lq7hdiCD0fd bQvTU2tclY1wWOuuymxyNLgywrr9/0FLQ8glntMyo7YNRcJO8A9pyjFkWZWoQ4WIlZmt P0gw== X-Forwarded-Encrypted: i=2; AJvYcCWpR8P1MfbZ0o5L64XkDN88PKyXFDHO6Cx5Fv8EDKCcpdqCpE5UUBSsCEr0sxQAeHCqJrEk+Ts4NrL28Rrh@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxNcjkhn4IWydhBqBbrHaSHrionOLwwghuzn5iXg2LL6caHrS81 Da5OxwyiIGlzx7buiNrSNgJF+vaq9MmoojsZlHKqTa4X6wrAE+tFp9gGsIh8nk5GBJC4a4jtKQ= = X-Google-Smtp-Source: AGHT+IHY8nGtnev1u9R8OzFECCQir5ROogI/fCu2XBMcvo+BQJcpRtLZnK880zwwyI9t4KsRQvGXyQ== X-Received: by 2002:a05:600c:34d1:b0:42c:b995:20db with SMTP id 5b1f17b1804b1-42cb99524damr95478825e9.5.1726067443684; Wed, 11 Sep 2024 08:10:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b93:b0:42c:af5b:fac1 with SMTP id 5b1f17b1804b1-42cdb16c789ls110075e9.1.-pod-prod-05-eu; Wed, 11 Sep 2024 08:10:42 -0700 (PDT) X-Received: by 2002:a05:600c:1c18:b0:42c:b74c:d8c4 with SMTP id 5b1f17b1804b1-42cb74cdbc5mr110712225e9.31.1726067441770; Wed, 11 Sep 2024 08:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067441; cv=none; d=google.com; s=arc-20160816; b=osB2gniaTrYoqSgQROZRyn1/v158TYM4DLHvPOuJOkov3M1HjqwfdqD6Tp/5QliKiJ TkGny+ls7+6AiGwq/Y2AJBtFcWf/vLLam/oHJDC7JDRsivZ88OrtfdxqpG28WuE+yUww URn/OLS55CG8plDvbauAyIJKM26xwAllEes/OBFsdph2emzmNvCGJsSbx2FRQrM8Qhog 4BfBVeKBi+SD3EJvwmzE8zDLR+tHaKpS/AjZtMia7B2wSBNaI+v2IRUbN6EexmSMIUX6 v9/9X38GHR6m6LoEGJXsbSSnv5iIt4O4MKBAlKU+hKt9PNlxF7z9SfQvgmkWJSJMqgOC XRGg== 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:to :from:dkim-signature; bh=/JG1v401FFHy3BRmgsxC2pPyQqhHicxf8qoeqtOnH7k=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=wnHGGXttfC5GNQ6NHLd+Ccq8CgahoQjSN61XC0QwkKXZiGKR6k1GsNgNeID1bLFmrc zU5yDjZI2MT4LDwBICORUCt5oCsjilAFFSjx39zoCjMU+EkcOhQXVLRFnLPuPJHI/wQJ 3mUcpK7iVwSErUmw356DasIiVjVYhKO2UQSMDDVZmPCTu9cKsKhcpMCrVjC3qyTXgY3Q b6ANzHQi7IuaZTuIEOcoig36K7LMbxDEM4DBwAJD1MVb4Z2LxISaIjqCHlMs0jphxQdF 2XtSa72RwL0VF0zD6OCRAlcmdF1rJPuMf2m4AFwKnISYWGNO0rwj04xnvUiTdRq0Uwko 4BCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gd46WgvV; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2abf65sor47399395e9.3.2024.09.11.08.10.41 for (Google Transport Security); Wed, 11 Sep 2024 08:10:41 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1c9f:b0:42c:bcc8:5882 with SMTP id 5b1f17b1804b1-42cbcc85cf9mr78088945e9.7.1726067440929; Wed, 11 Sep 2024 08:10:40 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:40 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 01/27] clk: Propagate clk_set_rate() if CLK_SET_PARENT_RATE present for gate and mux Date: Wed, 11 Sep 2024 17:10:13 +0200 Message-ID: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gd46WgvV; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Gate and mux does not have .set_rate operation, but they could have CLK_SET_PARENT_RATE flag set. In that case it's usually possible to find a parent up the tree which is capable of setting the rate (div, pll, etc). Add clk_generic_set_rate to allow them to trasverse the clock tree. Signed-off-by: Michael Trimarchi --- drivers/clk/clk-gate.c | 1 + drivers/clk/clk-mux.c | 2 +- drivers/clk/clk-uclass.c | 20 ++++++++++++++++++++ drivers/clk/clk.c | 9 +++++++++ include/clk.h | 9 +++++++++ include/linux/clk-provider.h | 1 + 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index bf1c6a93b468..bd0d3d44ac8c 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -115,6 +115,7 @@ const struct clk_ops clk_gate_ops = { .enable = clk_gate_enable, .disable = clk_gate_disable, .get_rate = clk_generic_get_rate, + .set_rate = clk_generic_set_rate, }; struct clk *clk_register_gate(struct device *dev, const char *name, diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 62477e15d27a..4feb8e8c821d 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -150,13 +150,13 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) #else writel(reg, mux->reg); #endif - return 0; } const struct clk_ops clk_mux_ops = { .get_rate = clk_generic_get_rate, .set_parent = clk_mux_set_parent, + .set_rate = clk_generic_set_rate, }; struct clk *clk_hw_register_mux_table(struct device *dev, const char *name, diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index c48a62ba099b..7d2c82e3bee4 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -515,6 +515,26 @@ ulong clk_get_parent_rate(struct clk *clk) return pclk->rate; } +ulong clk_set_parent_rate(struct clk *clk, ulong rate) +{ + const struct clk_ops *ops; + struct clk *pclk; + + debug("%s(clk=%p)\n", __func__, clk); + if (!clk_valid(clk)) + return 0; + + pclk = clk_get_parent(clk); + if (IS_ERR(pclk)) + return -ENODEV; + + ops = clk_dev_ops(pclk->dev); + if (!ops->set_rate) + return -ENOSYS; + + return clk_set_rate(pclk, rate); +} + ulong clk_round_rate(struct clk *clk, ulong rate) { const struct clk_ops *ops; diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index b8c2e8d531b9..67c6b23231ff 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -13,6 +13,7 @@ #include #include #include +#include int clk_register(struct clk *clk, const char *drv_name, const char *name, const char *parent_name) @@ -60,6 +61,14 @@ ulong clk_generic_get_rate(struct clk *clk) return clk_get_parent_rate(clk); } +ulong clk_generic_set_rate(struct clk *clk, ulong rate) +{ + if (clk->flags & CLK_SET_RATE_PARENT) + return clk_set_parent_rate(clk, rate); + + return clk_get_parent_rate(clk); +} + const char *clk_hw_get_name(const struct clk *hw) { assert(hw); diff --git a/include/clk.h b/include/clk.h index af23e4f34753..1900377eddb3 100644 --- a/include/clk.h +++ b/include/clk.h @@ -452,6 +452,15 @@ struct clk *clk_get_parent(struct clk *clk); */ ulong clk_get_parent_rate(struct clk *clk); +/** + * clk_set_parent_rate() - Set parent of current clock rate. + * @clk: A clock struct that was previously successfully requested by + * clk_request/get_by_*(). + * + * Return: clock rate in Hz, or -ve error code. + */ +ulong clk_set_parent_rate(struct clk *clk, ulong rate); + /** * clk_round_rate() - Adjust a rate to the exact rate a clock can provide * @clk: A clock struct that was previously successfully requested by diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 59f9c241b846..459fa2d15ceb 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -253,6 +253,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, const char *clk_hw_get_name(const struct clk *hw); ulong clk_generic_get_rate(struct clk *clk); +ulong clk_generic_set_rate(struct clk *clk, ulong rate); struct clk *dev_get_clk_ptr(struct udevice *dev); From patchwork Wed Sep 11 15:10:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3432 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BCE7A42E89 for ; Wed, 11 Sep 2024 17:10:44 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cae209243sf32180035e9.1 for ; Wed, 11 Sep 2024 08:10:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067444; cv=pass; d=google.com; s=arc-20240605; b=DJXOZ1un9V7UPrwL2TbZtGN/dsfc0ZFEnwHvE2CiXCRtR8C4ajesUr8owDZffz3g6m 780W5Y1zZ9N9bV53ICCCfrv/1sYiDjcMGAYonIgPkql/P+nOvwk1DJ8MPtNmJ9hhG73y WpExat5acNQdhhb73U7YotdPZwj8PckVsFGKBug8a5bTNnriagkrDqMdIsuaVBhS6LC4 tVq/zOX9nn2gH2PoEGVMItqV8BfoPy86+H0Ko2kaVl4MyhNXtgJdh6/PuRRfbx4N3VBz 7mJstB5ApkeHeO91Wys+N9/AwIr+KhmYGdlLq8QHfxJac1AIs1M3W52t9eMdR07S47ag jEzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=qD6MhRxhmPO8rTf7aAEqSp06zF31DIO3ajypcBua6gQ=; fh=i57bRfBYBr0nVxFQCuTNGOsGBashoXaoSDngyD4eO/M=; b=jkE7JHC8DDme1C5xuPodyPVBmVFhIM6wnACKxJz04iL9UVMEovyCf27bKZ+ydXH09N 6SPK4VvrEu/7bNkeZP2mTQF+vxYlESGlJYj5fmO/3L2Zm+ikDKldjf6Lkkyjdby2eY9C 5otLMkNGdix19vq8UepChS6IV9JJ38O39i/VE2KqCngqlD41KUA/GsFZsTzls2VCGPRH iZSGirlS+r/Dvl3zz+M3YET00dj2wImZITDyGvpyQjDCt3hrakddE+0zL7QuEit6dqGI fIJ4ANeJ2cUeERgByRfwmNP3mHNpposftyXg+JFkME9kznP1SIO9IWl9lpnpWX/YU8Y8 Lung==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f8T7N9iW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067444; x=1726672244; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=qD6MhRxhmPO8rTf7aAEqSp06zF31DIO3ajypcBua6gQ=; b=DUBb/MrGndJ3XGoTyVcvSekZzNIk7K4xyAL1WcKIz+fHz23Lh2CbAoMJENe3diZY2v fvX9VOw4UKUGbg2reylE3KUMRrjqO4v7VM5hdfF+G10UTfk0eFqDeVwR5WqU/1loikzW VJUTR3oyjSSCm6cgD1a4V/xD1nTaAPaARXYFw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067444; x=1726672244; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qD6MhRxhmPO8rTf7aAEqSp06zF31DIO3ajypcBua6gQ=; b=hCr0a9NKwLHvrgdjKxs/xUxn8Oq1B1wTv8mfizRsJaHTl2zt6PNBeBJVTNpivrlpAm 7RFt+xQlbZZ5l1CtP9K7/u4OGQs5L/8R9aSEXmQYwD6eaT9a0vSVoEwHHTJ1BeCJDrXy iDvuVJi3CmOWHXPcLZQwQcF46ZxYu9PAMSkV7egC6k/BlDHf+Xsv+1VMq2Bp5Eno3yqN oTUXMk1JqKlsUyEXTj1rS6ZGyabkwqU2ynCUxAa+zbT+uBqiUA0pcbegB7xxZwrKaHB8 LJwvqUPf1j1QpjPc19er40IelGKj220XrThx/6JeEgl93PKlAj73ay+8cjyQ5pEgBiVY 3moQ== X-Forwarded-Encrypted: i=2; AJvYcCVvxT+C25Z+wC4Odv6bUMljvrehv/bK97jTua9ban38DdF+kp977jVYNAKJ2DYWPWxyB7mVqxryj5ZY9vkn@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyGqeaF+wX3mUdo7cjxrE5L0LvMEuKnfdrmcHkJyCDq3ux262XR OBH3o9znJwpMnNU07tbW+IWMCq+0MGeEdzd2BjfgPn37OygERt3ngps/XkOQzAMfew== X-Google-Smtp-Source: AGHT+IF04mHEUl1tIRi5Fkk2lGvje1vFYVeVj/jYJAdri4VjYrZKIXiGSEae15E/ow1nrnkPwLmPsg== X-Received: by 2002:a05:600c:5109:b0:426:6b85:bafb with SMTP id 5b1f17b1804b1-42cae73dab8mr102528305e9.20.1726067444233; Wed, 11 Sep 2024 08:10:44 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1c1a:b0:42c:b037:5fba with SMTP id 5b1f17b1804b1-42cdb176790ls62615e9.2.-pod-prod-06-eu; Wed, 11 Sep 2024 08:10:43 -0700 (PDT) X-Received: by 2002:a05:600c:4ed1:b0:42a:a6d2:3270 with SMTP id 5b1f17b1804b1-42cae73df5cmr113979065e9.21.1726067442612; Wed, 11 Sep 2024 08:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067442; cv=none; d=google.com; s=arc-20160816; b=H1kgvabocMEUQpMPbkO2cmRxrsoG7+x+4rNgiFIU0rGm+s1jIqslyiUQHASJHLVy2n gJDD5EY33bPDVexw/C34mfKynitroUcLyp1TCsKzJOYDUp51pwIKr9A4t7/As3KdGgvf DGU/eg/PmTU8S/e3naifS7r5/YmASaoWEHcxWB+D5sUhwfItFIjYtFlj30NNRefY3BRK TdPJyBCgWzBilMW/RcHVKk141flF01tjDPhpMLdq7Hn8g4BCa1ZXJoz8cP/lJ/TntTnZ AXvHjBMinjdwSu3oW+xmZcTnRZD0U8rt1vK6B8KQvLAjw7hMucb8j2gblBQB4sdnds+8 zTgQ== 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:to:from:dkim-signature; bh=z+vH7JnBUdCxbHSNHeYAv/LSH/K9w1Cmau7Y6C7/Mx0=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=Qei5BbS97TqmWq4HZnsT4YExIgAEa87tXv0UxftrXXNR+1GPBQ/yiCV1MHB9lxyL0e 4eLE+sU5RpO7SrqeZp2Z3YVGLpTxwOu2uM8L8J6CG3TomzP1rxjeSpPjcH6hhHTklgSf xkEOSY+EtTvE8gykH+4oaegrwN5ULX2MT9JX8k6l4/+G0QdLkC3gDS4OYeEQzPS7XHNC Vce4bP6nBbo+cwzhphAwTeyi4azhcgOyEdK9VDJsKk++XIqVCBolGyaf0yEyu+/8hy96 MsyoYaLgyuc2EzjEB2pBTClA36223OxG93ZpdM3fYh1364fhdfC59hJQFNHmvJloYqYb fpdA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f8T7N9iW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2c53absor37552555e9.7.2024.09.11.08.10.42 for (Google Transport Security); Wed, 11 Sep 2024 08:10:42 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4f88:b0:426:62c5:4741 with SMTP id 5b1f17b1804b1-42cae70a06bmr108872065e9.2.1726067441870; Wed, 11 Sep 2024 08:10:41 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:41 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 02/27] clk: imx8mn: Prevent clock critical path from disabling during reparent and set_rate Date: Wed, 11 Sep 2024 17:10:14 +0200 Message-ID: <20240911151039.2914886-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f8T7N9iW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi This commit ensures that critical clock paths are not disabled during reparent and set_rate operations within the clock framework, paving the way for the inclusion of new features. Signed-off-by: Michael Trimarchi --- 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 8911e342f18b..e089012477a6 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 Wed Sep 11 15:10:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3433 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D981F42E8A for ; Wed, 11 Sep 2024 17:10:45 +0200 (CEST) Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-374b69e65e8sf910114f8f.0 for ; Wed, 11 Sep 2024 08:10:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067445; cv=pass; d=google.com; s=arc-20240605; b=RAMaOInzqauD3qT5L2DBHF211FUUVgrdGKu+fryG63DoJ4Y+bfmEzKWnIqRttZPxYX DzVmD2fO2/LKAlvQ/pmatWUo7L7Ll0Im0o5XLNKQBD6nki+IXp6ggGbVXRd83tIzYE3b yNz9R4uCItftViaGWfyBLNnSgkpolXV8Y8XzPiVHXtK42pru76whpu07uwpmCKWKUcxD 8nFx9EQgj+5iAEDfZ8Ppcm3Sfge7XoT2KGXIgw96ou8cz9j3HWC/KUra1x1EWQYIs19U JYxkFxEp/n2vhRepVC92EZ5m7Qw0bDsUM834qDbpEhqDM/fXwjCaSPh1H28xIU1upmrs S4Pg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=FrXBIv97q4vE3yaXHAQ60FgMBVSGB9SS/gXweDthaSQ=; fh=JGngl2qfq7eir61fTQb0iGI8lmlWX7+yCG0HwMWsnXA=; b=Cn9/WObTjh/NM2phVjy61pI2i8u20MMxcGveACL5LPhBEGbi7Fv3+dA5aLwIXAVvAU SJXyznSuiPB5dGhuKwvymLiXcy1yjgMkN0HybzQMbg5lh3GP6bB0xurjdIc1xOJ+DITT 4i+7n9IJ1Y/szd+QX6Jw3fLAV7e8BAvSWopDqPJ0A5v0GNoCcp9PRVUqlpcVCWRQgcDW 93TEqwds8l0U8/uyLpLjUGjgLYpIhq3SY58xFj86K9Z+PtG8FvWVK70crHf6unfAl8Ti hj/g3ZkSTOnwKodziMF00ghpo/zf23+3PxkP7nS0Y6LNLZDCU8lgNzr3SEcy+ZN4qFBu HcLg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YWULq8T8; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067445; x=1726672245; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=FrXBIv97q4vE3yaXHAQ60FgMBVSGB9SS/gXweDthaSQ=; b=bJgoY1Ezgj08f2cguLlRNsCq1lZMhJoMF1jEHsUUW610HbIrt659LX3J49RmV6t5HG P/GwfgTUASBziqyBhyIul1tpYr3OJCggjm/pWU62zbHwoBp9cSm3TXE2GURTcCEZ31a/ lZFy2ufJErxrwweMeIVtkmYFK60S4RAmK+jBg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067445; x=1726672245; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FrXBIv97q4vE3yaXHAQ60FgMBVSGB9SS/gXweDthaSQ=; b=sePEcxSpRyjcxdmUawyRdl8eDfvGVsty0JNPo/kRPAAyiIkomSmA8VzBPdr57bmouW +6QnDRAXk5c96DDOOhhQf/BL32G8a758ItXWbZ7tciblPVM3Ks5HFuD2EdI56slALOOe NNHMsvtU8fFe4owvGhfn01U/SpIz3z9pQIcKO7oNZW5/47+gQBPX8bOL2sKdCRsu555G eogFfahbL6IQ7jhKJicUDQCRntDG38vRjVRiLvtnqebwggy4DHZDa48O5rd+gIXKlOMw D6LvOkM3oXmfFM+5v6BHXURkk1sHAzZJU8nnjwtx2mwNU0OAB2Ji29WwekGVQPBJOCO4 Oo3Q== X-Forwarded-Encrypted: i=2; AJvYcCW50HO8K2Kerpd1OlGAZzfORb92qrzYZeeASbcilW278Qo7V+A9LL8MC5btgTq1xmBEMChFUsqtlPRbQ4tX@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yy7ZuN3ObAsfVW5qiyo+Gb4IQfsDxxGi49DhySQe/ZOWTgI7r8I VlS5ZKppny/r/6MTZ5xrt2EFA37WeR+O8uFJ9PRy/aTd6BQFZuD4+xAnPHUy1UgFlw== X-Google-Smtp-Source: AGHT+IH2GR8HzPdkGwyELM3mBQxpIvkIdV5vHR/bX2x55C4s2MMJO9SsTviAA1Em+ffScl+Yg8NGlg== X-Received: by 2002:adf:eb8b:0:b0:371:88b9:256d with SMTP id ffacd0b85a97d-378b07966f2mr2202759f8f.6.1726067445413; Wed, 11 Sep 2024 08:10:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:564b:0:b0:374:d287:ec15 with SMTP id ffacd0b85a97d-378a8b7ac34ls617885f8f.1.-pod-prod-03-eu; Wed, 11 Sep 2024 08:10:44 -0700 (PDT) X-Received: by 2002:adf:dd84:0:b0:375:56ed:a3a0 with SMTP id ffacd0b85a97d-378b07feb88mr2213312f8f.43.1726067443813; Wed, 11 Sep 2024 08:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067443; cv=none; d=google.com; s=arc-20160816; b=L23F6Eh6MwtGpYmIZen2irPJLs6FyzOq8vH+RYTWichuD9s+YzGpWXi0yV/yxpJuWW 1YYFA7G2Ehlhht7hi019Fo/p0asR4bePoXachmBeNbSNrfWdDWPQJrvfA99D4q0HHWnR C6G8ujpQY+ZL6ock2Yd1Fa0HXXS2yf+AVNNUI0Y4wX3nErDhVmaAE/N5HQ5cxgo/t2uf 23O01tpxyP4Dz9HTDzAYFN45V+HdDCYPEnQKAU4OJiRUy3ptphkeRBsCIvrHpvh24pj3 QbdeZil6cJb9gaMweAKnqXGwqJSWVUgMzPpqfK8A2B+8mkOkogTrxkXX/cHOczHB0ZZj ftQg== 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:to:from:dkim-signature; bh=jDWptbH9w/9zBY+KHy9Xv9lgS/KNlcO7NFqasYaIoQ0=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=C7DzvnynspQyGqx62mjMN9Y7mq4ndkoe9SdWZ92bOY6W4aavCOvC4ITD+J1jgmwwi1 LJXFQTvfUpcaOP0iiyrC6YJ6Tuw/h5phKLxwnPFp1DegFzNk+Wq7YtScIqKp+Ymlq9M2 sgnGXIqiEfrxVLOt0bArjEtdGe4fe8HfE2Fmmr5O+DYU4+1dERZYUVuvzQMKGnnpaaeH MyXppGVrkHXoNZnOD2mBpD1HPCb7yNbQldKZIzM77V4LEQbhf1OxRAkwAsPUvnlH6WRW 7IiXrnqCgwtQCJFjKe/c88Uuhzqi7y+3UwKYAtzCq8tyq6RbLfuWZ+5JzJ+2ke/50kOr dwHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YWULq8T8; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2b1b33sor36563855e9.5.2024.09.11.08.10.43 for (Google Transport Security); Wed, 11 Sep 2024 08:10:43 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4510:b0:42c:b309:8d18 with SMTP id 5b1f17b1804b1-42ccd32e264mr22843365e9.19.1726067442967; Wed, 11 Sep 2024 08:10:42 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:42 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 03/27] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Wed, 11 Sep 2024 17:10:15 +0200 Message-ID: <20240911151039.2914886-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YWULq8T8; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi This commit ensures that critical clock paths are not disabled during reparent and set_rate operations within the clock framework, paving the way for the inclusion of new features. Signed-off-by: Michael Trimarchi --- 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 e538f047b310..685e7df0e568 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 Wed Sep 11 15:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3434 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1794242E8B for ; Wed, 11 Sep 2024 17:10:47 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-378929f1a4esf2248855f8f.1 for ; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067446; cv=pass; d=google.com; s=arc-20240605; b=Vru3rWe364Lo1su4fXlFewHbKv6xjdx26OekS1YOMa5fgOo0cnxwXmE0BrIehAQpBy iHYvjPQtcOjFz9EP800mREuBJ8qGkg8uDYzgv9rvPwMgWHwFKurGMx1OeHIlTXRfvZ8d GCAPDb60z/5djZPEYZv0hKkyaZQ3S0/x3tYajLJTOHdp+kHmhzG620OXZAzz4OuzWTT5 AEFUGUDWn9X1RluMYT24L7frcE0MQVkQL4nwLkVow42a1uz7LiscXTpllwtX9cJsy5IQ /BmYM/zTPSODl2tWgA0+86e5Vr7Iu5z/VAfXTlqGqVLg5UyXCYOVD3eaAN4UVS4207gK T/TA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=YwFgVMjqqjKX2FVYa+KaulKqAVPw91S+t0CLFvgIXIY=; fh=+ZOWWIvbSiJSADsg4EwXjkcx2q/mfxDQ+DRXME1ZZi8=; b=g54w9Vr9okBs1EsT3Mxo/JyzhtyciBjfcz4L9oXZKAnAon8UxErYkmn4CMXkPw7O3s IdwWqb6YB3tTxcK8n/icl3tHFYUlJ2TVlqBLZfrIoTuOaX9s7s+7DLviG3yCdW90hIld 66fqTXlKK3Scc7aj2+ydJBk1XP7g+IAD5mbxZRN5VBR2i9pCdy3ZcsPetj25fo+kckUD 0Q87B2EvToOQH41TB38VpNCalv8KUDHRB1XEsXST2I8tKV8mxNffdxAWpEfosUIq1BlM q3F8IcR6x8GVNqTdOCAl+7aIPkuf08y3dQTvVu+MCrptMc/4jJnWAQRtdvW4Jcokc2pC r5HQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E31CUenZ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067446; x=1726672246; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=YwFgVMjqqjKX2FVYa+KaulKqAVPw91S+t0CLFvgIXIY=; b=QTnldy8MEFbHA7tIqUF7QQe/dgJTxFxxV0rttJplA9tctg1YsG3iRfXnT7WmDAHPhz HNRbhTVUy5piwHyEvMSI3iNVUjTYkYD+yo3wULDd2EqRdV5sHkmwuaBo9R9GpkiJCLHd JoBIyv4vEVQoyqTWcFEJa0fRauR8O9KLETp1s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067446; x=1726672246; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YwFgVMjqqjKX2FVYa+KaulKqAVPw91S+t0CLFvgIXIY=; b=Ik+5aKn+rrBosGTBH7PZpc0n5F3cXmKQ9MdyCcvY42+XWdtFSAcvKuebn9Obtg9a/C 4x5xD7VFzgGjYciYDT4MWxlcmIz1pACrf1NR3peQRZl2yKRG4gsoOuw5EBabEV+0HV7G esI9fObRBuV43UT9FnXibxSEbBm4B60YglHP4KN81FPvReGKGWT4IBmYn2RS3QYaw5eK 1xrn5hlBRxjG1JZvjmVZ3TBRxmOYtM5OtY16WhW/6eaZRZj14yokBKacLQWyJaggkNea Xf4gbi1IVtZqrf+qUUI79HQANkq/6OF0V8vQu/tTEcRGdybcApZWfDroZDm9mvO/CPeH Ul6w== X-Forwarded-Encrypted: i=2; AJvYcCXpLpdvBci9uFZcDGPm9Q+2Tiyn8cutMBIIPW7/Sx2+uR3E+1lT0nabReQkcRJozWEsZhYIGOSIx7ig6ZTD@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyAupTA36tO+Yg6MYud+w8T7GqxX1c9q5+0XOP9jGRg9sN7+v3M onCnezKbt4TMzFPc/E4/HcmnU0Ac5A4e3I2qcVqQceyk14W11SktdU2Cg4zQ7TPPXw== X-Google-Smtp-Source: AGHT+IE/Gl6jI8dqcejiRu0Dz7J/HWKxEn824G3snJdo5khdI9cdd/H7KONuH60qcyeAlwSyFUHYkQ== X-Received: by 2002:adf:e90d:0:b0:374:c1a9:b97b with SMTP id ffacd0b85a97d-378895c53fbmr9749858f8f.8.1726067446486; Wed, 11 Sep 2024 08:10:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:4004:0:b0:374:c0b6:44c0 with SMTP id ffacd0b85a97d-37887fbd4b7ls1781176f8f.0.-pod-prod-09-eu; Wed, 11 Sep 2024 08:10:45 -0700 (PDT) X-Received: by 2002:a05:6000:542:b0:374:c57b:a90f with SMTP id ffacd0b85a97d-37889659729mr10717457f8f.42.1726067444935; Wed, 11 Sep 2024 08:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067444; cv=none; d=google.com; s=arc-20160816; b=mYVwoZPRg4A1vT0+i/VY3r9uG+dawIjvon0esf0CzhImyOWMf0pX/A5OdSg+CIULe5 rgF/6qTwPgRGfV+xCz0hWnHLJSFbJMWXQITwtoH45hd56jzUBkH15vfjtt4I6ojnEOoJ 9uSb3RbmyRr73ZAad9dUvBSvMK3zTjrCwYPpwIVqVapIErh9aXx+vY3UsuqIdbMOeYT2 p66eZwX4Nnx4kzaJcnid0d5UeoJRb5tVDpB887E/z9OMGeJuS/YAD4IJhEgtDGZxY99G 8TVsITrvzzVVa8nA4Hht2V/VG9yjXolUWRw0sENkjK0F3gHe5JhSE1FHNdIzOJi1pJGQ 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:to:from:dkim-signature; bh=naTm3Opt6jf0xEq0yickJe+E/Y+IqsC0GJnFWRLLBUU=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=RDR6mId5Ca6Pq8+qce4RtUiX9Y42Sv46X8oEesmdWSggoZoM7cSloSM4ZCxyu6l9aq TtyRu2SxIv+7MqNFTMoDGfRyu3xTSQGl5P4z5TIeOEHMKLRZr9fXYZ5dBu/FOtvA0WbC Ea14gWXkVaA402LI26Dw34tu4PlrxKkN/Ts3rmTTqZV2lIScxXJ7A/UygdG3dPISn1Ug iqYFx1+EuNAdo1tHQHaizfREdrZT2Zz3sG67EMfOSylqhzDrRk3DUaq0TEA3X7lLJ32m JMi/8p+3guFNH9Ul+zeat9z7Dr/R3Y/9vjQOh2kLNh6STGgc64EfFnxVTOtL0p8+edDp tYhw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E31CUenZ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-3789560298esor2404297f8f.1.2024.09.11.08.10.44 for (Google Transport Security); Wed, 11 Sep 2024 08:10:44 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6000:781:b0:374:c56c:fbc7 with SMTP id ffacd0b85a97d-378895ca924mr12600647f8f.15.1726067444170; Wed, 11 Sep 2024 08:10:44 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:43 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 04/27] clk: clk-uclass: Print clk name in clk_enable/clk_disable Date: Wed, 11 Sep 2024 17:10:16 +0200 Message-ID: <20240911151039.2914886-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E31CUenZ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi 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 7d2c82e3bee4..4c2ca9909469 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -629,7 +629,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); @@ -690,7 +690,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 Wed Sep 11 15:10:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3435 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D2A5F3F251 for ; Wed, 11 Sep 2024 17:10:47 +0200 (CEST) Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-374b981dd62sf1126943f8f.3 for ; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067447; cv=pass; d=google.com; s=arc-20240605; b=DuApqJ86NBdlUQvwdDE46++eVNUK4V+NkI9Dgu8byWk2RNhpj2cxnz+nP47Mdhz+iJ VAOaD51K+HU4u01+X1UU1g9cdomvaCdYq5HhbuxhcDVaWBPyCJwTahEDs9pMBiVBGd4a QFcmNNEtPTMEGnFb8GExxOew3IRIQg8H5DqZs4AUapZJzuILDmGbZ/YpIHYeHIoWb6vg +AYQeriYzP6X5iKk+ohzIiBGs1UcCA2cIx2Y1uv7IfUTWbUx+q+UgT1Th7MsN825DNZj vmyEUwia4MMBIzWmJjxYFaiJ8p7rOTrit8j8MY5MN+OvaHelsWMnx9F7INyLvf6NY9ZT KsVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=3cbXJCzhgmZMFX6CdOZO/HaMhXvnRkZctjE0kNj1+x4=; fh=5Vzml24XOX0wWNwyeimJd+TcPbcmTJhAohMtrIHzgV8=; b=Z02uzbNF2xYX2IIFh2mV+MxKZbSzh8bdRJ9I5ju1Akm30JkQFfbesR6c9Bve3T50F9 7B1ogWt+Jq0K+bZ0iekg5LoEL9jnkC8zKKPwjcD87xcpoczAAxUhqCeR8sqQ0y98rAAC VNMMKku6s+sGqMWUMv2KnKT8FrlYi2Xjh/Jq1bWyYICF/yYLDpyZjZgwB14ByBGFpuKc EhsFM5KqVpvehHnTGHasQUngsKSex2hbRBoRig+CC0q9DU/5OhqcI/Ip7AkU/LIG1WyU 5xTpKACNTpfB/9W+xtzIUJ2qPg6iEvU2BSA1lhcIt4CG+jVyz4EDkto0+5b7sAHAfKOq 9isg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XYzoITJJ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067447; x=1726672247; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=3cbXJCzhgmZMFX6CdOZO/HaMhXvnRkZctjE0kNj1+x4=; b=FkG0rZchKQ7Z50fiZWO48D2yB7fByjzzYfCUkMGxeAoyFtS8TpeRg75Z3j6rv4kAO5 kKaJou+qKyQ9Ccfx+mn6dfMlXWQSVqrl5575JDZrLFgX2gu/Bl95fSmHM5GbpaLn7/Qr XQoaFmabPwcaqLSnMSVLM2WxF+yCJIJfdm01A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067447; x=1726672247; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3cbXJCzhgmZMFX6CdOZO/HaMhXvnRkZctjE0kNj1+x4=; b=hq24rduDVFWQSsNwfNz4hk1z+omUFBeJyKvjQsydshiwf3sxl63udabXKD47sStL+B TW5DUXnh9r9JrKvRqsSFw4yQ9Agu4WiiaTttiXU2TpvrwKQYUyizl20hCOFSmvN279v/ 07Dd8BvaE6eApG3WjRI/vt5pp27oS7gWSNZBSJXe0AJ9eCkilyCXYpRVD7R4jN13A9ZS FkcWD2jX9c+A9jXpfjI/zOYHALBU4l4zBwxOu53gd5jdAEEeqh12qcg4ZlbkQpjUEeUT 0TGcQ23ODNyr8pNR+S/qng3ZvaBh0ulVYijxpGYvzO2vmwiA2t9yhjw/gBHWd7fvQm9e 2dPA== X-Forwarded-Encrypted: i=2; AJvYcCVEn9psix/An9OTGhH2VEcX0GqkDTsdkijK+6RxC6oZ6w/H8MRt23hxCOVkgR2cNAVbkurw36IcHrKRB2X0@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxilYQAA6MNwKFtOmKnqxnuNNIpSwD1auN9jg0ANuSgCEJ748QT nSs5nt+2hg+FyQrbUiB/1lrZpmKsbcuYTiFaGH1uQCLlErecUL3jqI4mDhzZJ0XT2A== X-Google-Smtp-Source: AGHT+IFGV7ztaTc0bm5PVPZGjotH/37yJl8vMjt1KFhmMkeGe8e11uFAPIEsbMe1GUXQzHKBe7ex5g== X-Received: by 2002:a5d:4907:0:b0:377:284d:9946 with SMTP id ffacd0b85a97d-378b07c8664mr2326282f8f.30.1726067447388; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b87:b0:42c:af42:6403 with SMTP id 5b1f17b1804b1-42cbde647e2ls12291385e9.0.-pod-prod-02-eu; Wed, 11 Sep 2024 08:10:46 -0700 (PDT) X-Received: by 2002:a05:600c:3b0f:b0:428:23c8:1e54 with SMTP id 5b1f17b1804b1-42ccd32deb6mr31961605e9.18.1726067445823; Wed, 11 Sep 2024 08:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067445; cv=none; d=google.com; s=arc-20160816; b=C0iYGSKhEoSpMKwUfz6VlbOM27+9YdWew5NtkC6GAyvv/Q4pwcYbG2qMEdgcFGtl0p Ffc19fCbKdGsPBDP5XIYH6gHzpiYdVGkMKxY4XiUwuNH/+D/deLYuETluhh7ybiu51Rg V6YyBpGR+NmPg6ew4K3MQWB4lsFcXLBpHSsqWKWswcGt27zsfUqPjX81i30+FSrEKdmw o7nCor4aJso6jFwExWNioJ+F90a7WmaJC0VVnIYTgn6KTf7BdkSzN9TDT2Crcm1yUKsy PQEvM0mlf5qplWDR0GA4DBftGb+POYQleQ+Qu4CSn2igleh69dFVfIHcOz/Xk4wYafd3 zUbQ== 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:to:from:dkim-signature; bh=lvYIhATKa8CPAeak+8bmtlwFxaGBD71PECtAMFCv/Bg=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=oVfKXb7X/4liyVQXqNRj8u8lVpEz4U/cKijLoB61HzRKGOry6+vXd4Jzc3tk/hEx9m O/IL2jRZXLdoqWPi+Jv/1uvX2wW4XrlcfaHwhI2VYHO5vp/29StcD2tCNzaLyNz+FPv9 ngPhY9axt3f42t0G3RHGCKAxgWU20kCYKMMbIU3y92rcdDv1qh9JjEYh6rFjsN87MAWb Npi4rQPjG/+U6ZNXKzly0OrOpuIiMPg+Berb+hZ6ea049tThjllFU+aK419QHAfDQFau LFyrLDM3iqpBeSAMbx+GLBFPSiAkljHx6eP0a7yIyG0vy3L/DErqvJ8jrMVea4Pv3h+m GtMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XYzoITJJ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2b17d4sor29475455e9.4.2024.09.11.08.10.45 for (Google Transport Security); Wed, 11 Sep 2024 08:10:45 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4ecf:b0:426:66a2:b200 with SMTP id 5b1f17b1804b1-42ccd29c3cbmr29921705e9.0.1726067445100; Wed, 11 Sep 2024 08:10:45 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:44 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 05/27] clk: clk-uclass: Implement CLK_OPS_PARENT_ENABLE Date: Wed, 11 Sep 2024 17:10:17 +0200 Message-ID: <20240911151039.2914886-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XYzoITJJ; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi There are scenario that we need to enable the new parent clock before reparent, or we need to do the same with clk_set_rate. The patch cover those scenario Signed-off-by: Michael Trimarchi --- 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 4c2ca9909469..fdce69cb48e0 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -582,7 +582,9 @@ static void clk_clean_rate_cache(struct clk *clk) ulong clk_set_rate(struct clk *clk, ulong rate) { const struct clk_ops *ops; + struct clk *pclk; struct clk *clkp; + ulong ret; debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate); if (!clk_valid(clk)) @@ -597,11 +599,37 @@ ulong clk_set_rate(struct clk *clk, ulong rate) /* Clean up cached rates for us and all child clocks */ clk_clean_rate_cache(clkp); - return ops->set_rate(clk, rate); + if (clk->flags & CLK_SET_RATE_UNGATE) { + ret = clk_enable(clk); + if (ret) + return ret; + } + + pclk = clk_get_parent(clk); + if (pclk) { + if (clk->flags & CLK_OPS_PARENT_ENABLE) { + ret = clk_enable(pclk); + if (ret) + goto out; + } + } + + ret = ops->set_rate(clk, rate); + + if (pclk && clk->flags & CLK_OPS_PARENT_ENABLE) + clk_disable(pclk); + +out: + if (clk->flags & CLK_SET_RATE_UNGATE) + clk_disable(clk); + + return ret; } int clk_set_parent(struct clk *clk, struct clk *parent) { + struct clk *old_parent; + const struct clk_ops *ops; int ret; @@ -613,6 +641,15 @@ int clk_set_parent(struct clk *clk, struct clk *parent) if (!ops->set_parent) return -ENOSYS; + if (clk->enable_count) + clk_enable(parent); + + old_parent = clk_get_parent(clk); + if (clk->flags & CLK_OPS_PARENT_ENABLE) { + clk_enable(old_parent); + clk_enable(parent); + } + ret = ops->set_parent(clk, parent); if (ret) return ret; @@ -620,6 +657,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent) if (CONFIG_IS_ENABLED(CLK_CCF)) ret = device_reparent(clk->dev, parent->dev); + if (clk->flags & CLK_OPS_PARENT_ENABLE) { + clk_disable(parent); + clk_disable(old_parent); + } + + if (clk->enable_count) + clk_disable(old_parent); + return ret; } From patchwork Wed Sep 11 15:10:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3436 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D59AE42E89 for ; Wed, 11 Sep 2024 17:10:48 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-378929f1a4esf2248878f8f.1 for ; Wed, 11 Sep 2024 08:10:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067448; cv=pass; d=google.com; s=arc-20240605; b=EYwLIlSShqQH9qru3RP8+t2jvyd3MlB7t6XrLFDpMwX3xIiamqn0t1KzF5n7MnfyyS 6bAHDHxrtsIwCig+KatOf3j+uQItWj3XclVnxFGDFNQrQ0XaAxtMk6s0WyUbrOhrGSnF BHNkI1L4HEmHGXwmi2FF5VBJ8sI0TibLq+qwb+rWHdT30wlGVcxexrh2PzaBtqGiLZLi 7+SUcQAjzfv2O8wJ3Et01JFCpaNi2RTO6Bvfa1fpVjxhrQFzgQjY8VtB+qjnYlJD7PIw E4lTGFAYzjgfebe/ciocPvBjWAmQDrg8LM67Vi1yJ3vRqhO9BXMFm07HwbAraK6UTdCS OvsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=iauPY9f+ryFjjIZe7ja1zCS0TWL1H1KiJvL7+a/i6eo=; fh=Pokxv+l831iZeIKII6NqvEv+yrJuUfjMwDzJi0OPw9M=; b=Irjk8U3v0m+Kq3dAy45eu0jlNyf61C/t/1ullHYowP52tpH0kQHJg8uGD0JJrPjp98 nj81Y+ECKmmob+5oa+0EnIJoPQaXaYYz02vagk6JVaS5zHCr5MSaAkzE0YActXizBnHl RZzMZIb2fqUG52DpeAaMxm0HztwRqeLh+3WdbT5a8vKLHBJqxyxEdhzJDoCoC8dPtJ/R aMPJoA2G/SWhPBW8bqx2BUKvCY1RARn06Bch6IWwDzESB1XpqB28arrDc/82AUahmUCm giUi7RCFXj5uBXkYiEVckwExf4RV6S0Lw5REG4RxQl223f9Em+ovlvII/lquAtj7ePU1 cG2g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qUWcU5rh; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067448; x=1726672248; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=iauPY9f+ryFjjIZe7ja1zCS0TWL1H1KiJvL7+a/i6eo=; b=pYJR0gh6sKWxuXL+toP8hYrEBx9OHPC4BfQEfKUsr9tnSI6xkhI0JBI29FT52/Pf7X C+1Jx1ZdviifRFG1rlQdGqBNdqeeTQUnImj4vOsHaj5fTtPK0OdxxqXZiiyBvVQXd26V 5IFK9/EUwaSS1rNCz3ht/DoP+4VycFgK4nbzg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067448; x=1726672248; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iauPY9f+ryFjjIZe7ja1zCS0TWL1H1KiJvL7+a/i6eo=; b=Taf5Yek5rIns+VyuiPmHW+SG/p786xk/S2Ssbs6IVuhk9K2LxwIbUEmemQkcOJDKyS YtjvIoKG9/DKkiIdsIVi8a9Sh00f9ttx/A3IQpKlMWgGNWBw87+b6tyLfGHOLu82wJxO BCk1qSFIr2SrNWTYOhN+Tc53IJeGtbjw6rEh5B/mvgKGZ4/CGoyZFaPcdssIOPBznCNM Y6VBD/Wz2KRPreVz5go7D3Y+7tZPu06eSgcQlj6t+zvxGeJarlVAwcXRjMKsGHLb2oYP cNxhGP76yBIONLZMahX7aUgpzRemwnc8MjxSeG3tq6m7k2CgVasxg/bW+OP749RzELe6 48Wg== X-Forwarded-Encrypted: i=2; AJvYcCWUi9RbSFiXKnzG+pWtCSt1OjA8DeAXzuz8zNKWCEC3HZ6rMtxKp4kNqNzn+IejW7b1AdEnYcRJdyvipZDt@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzoiSXSt+UOXIe/CxK3nSz7tuZr9h+JdJ/Z8qyaesaQElAiHTaj jyYdyk/+WWdZ94UIeu0EsOD2Obc/bgnJY1UqrcvHdj2Ic7TmX3rOJWMtgd/8Bo5WhQ== X-Google-Smtp-Source: AGHT+IGNv9OnC9ehR1i36S//1LH/zoY9776+DG/d6TPPrMXBYyynUyrd396oQiAAUmRFGdJU9H1qPQ== X-Received: by 2002:adf:e552:0:b0:374:cd36:8533 with SMTP id ffacd0b85a97d-3788967a404mr9265848f8f.54.1726067448354; Wed, 11 Sep 2024 08:10:48 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:f001:0:b0:374:d111:63a3 with SMTP id ffacd0b85a97d-378883bbce2ls1460757f8f.1.-pod-prod-09-eu; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) X-Received: by 2002:a5d:5545:0:b0:374:c269:df6e with SMTP id ffacd0b85a97d-378895ddf36mr11349230f8f.25.1726067446815; Wed, 11 Sep 2024 08:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067446; cv=none; d=google.com; s=arc-20160816; b=uIxAiB9wDIQzBnNXHk7grVbIxnVMQrrjU3OCwcjdZSYcvueTT1QN7yODzh0rxqaeHd WQxibRRA2oq/+CPzrGrgRU0+zurdwaz6fS7oSP9F6dxk5dIDViY9SFmwOYJl0xD0ce9a TeDZ7bGFUldAHV+BJTt8wu8ZDwB9UvlYEIu5hYGBXgQIb9KBXF2X6C/21+rdpVLVVU7S QbMdymDZiGCeBaubMRX6o531A7w1R/YdNWFD58mqqQULzXdGS5ZHdCjgWCpTODCfjqVA n33pt/UX6l7nOsJO8YMDFfGYbaVobgOODyN3jtr/cM0wu0qT5IOrTg2870zuSsqFpNFX oRjw== 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:to:from:dkim-signature; bh=MJb8L3BBTTjtu/5QlLxxiEltpkrooBUgYXQnQgVtbv0=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=d6+VOfYra3+q2SMqgl9BozXbWlEJQzDvEybK0MpTdi99IbqOZTu6uzitv0j0PawErr iAH8pYsfFUpjnmjpFjdmpBTe+Ezpn06KjkL/qZrTx1gBcBiAWzNRD33MMVSbn8KaSGFq ZkVsVadHV88pWfZV81702ZYaK4ty/wGxSqLp7pP1o3m/FHDDtGRE27bkfQ3pEYYr1pHp Iw91O9hZ0VDEBQTSNILyAtltifMzUV4k9PTqJ8djLt5g75o3xygAElX1yCcsv7LfdRnO 5YgudpJF8nhzYtYKZqBD/nQOV8f+tUIVhg5SyIaOJtzyfLCgqvDpQ6Mx6k8qIVJLCdBZ x2Jw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qUWcU5rh; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-3789560331fsor2307884f8f.2.2024.09.11.08.10.46 for (Google Transport Security); Wed, 11 Sep 2024 08:10:46 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:adf:f74c:0:b0:374:caf6:ca2f with SMTP id ffacd0b85a97d-37889675924mr12029077f8f.45.1726067446158; Wed, 11 Sep 2024 08:10:46 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:45 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 06/27] clk: imx8mm: Mark IMX8MM_SYS_PLL2 and IMX8MM_SYS_PLL3 as enabled Date: Wed, 11 Sep 2024 17:10:18 +0200 Message-ID: <20240911151039.2914886-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qUWcU5rh; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Both clock are enabled by the bootloader and we need to increase their reference count to avoid disable during reparent operation. Signed-off-by: Michael Trimarchi --- 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 685e7df0e568..275f1196865b 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 Wed Sep 11 15:10:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3437 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 001094354D for ; Wed, 11 Sep 2024 17:10:49 +0200 (CEST) Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3789c3541e9sf1488830f8f.2 for ; Wed, 11 Sep 2024 08:10:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067449; cv=pass; d=google.com; s=arc-20240605; b=ZecUB8A8hvx4wtQaCYX4wHd1Qm2CV92iSNAiHNjJ6JJmZr+/K8R3pdRXHPwDfEN2AT KYAaSd0nyO+5WuNf5gL+rcd4M7aeLy2qcDA7c80USqXUjIjs02soSaHJKBVfXkom1KjP Q+somP18M246dv/jCUDruJt/iwHO6JFMy7zpFGvkPQAWxH3XgIV+K3hUBKvmIG0x8/Hh 9GiqNvvu0xPMmuIdX91xqYja7Nj7K82TjsaJ998mSs7P3JTB6ciweuTS4EN5diyXx8yW B/Td1YJL/NORBYmVoBV6fZ1xPsBBoFPjhBB5C3V0tnys4aeXHBPX6gSHoYOP2kSnArC9 3MqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=iieuy0uPnv0ybZtqO7U7MYXCZZ7LXWmhQvzZ6mr1/uM=; fh=TULMjkArA7IMAVGmOQT7hYhVQrIUKxjBJs9Q56n7IGw=; b=FIEuoHZWA/TRaIwmy4nsQzuiRuh4udUq4ycv9IxqWxRH3lBTf99jExlXwMFmbGSwjp mbyiw0XwgTNkhcFy+yOMSkk829hqj7VbFKYogWQCsHGxTu5RCQ4sYP4vQBNxtT1DobaY psieLVrySdHQCOmAEFbGe48pPB+hJa8gllTfnHqGOT6Q9UmzcpFbDqTJdSxEtAslHC9D iNzJrBtGpXo9Vq0aPUb6luf5HnN1yP+rR75mhZo81RnOHqgBR9azLuPSbXdyi/tckhsu mRhhry7rUliAhFgRcSyFUhiQukKWhgexx7STxkvaurFRSv/GZrddW0Wqtcz8s7+LMFgU V6Ug==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Qar2tRN7; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067449; x=1726672249; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=iieuy0uPnv0ybZtqO7U7MYXCZZ7LXWmhQvzZ6mr1/uM=; b=Jk9Wfc7nSXWjRAKRvHVk5OE0Kh1XWCvg9tvsu3IG0sVXRvDhScO8T4d0QFzfoY16jF y5fxKbVTUldf+Rvo/NeR+s9lyh7fBKUud+3Q+/BlfZFt7x/pug2Tw5LEUuthQhUiPbau +rtHFpCpDCVXiaurxuQBFl5uwKiT5loeX9+X4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067449; x=1726672249; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iieuy0uPnv0ybZtqO7U7MYXCZZ7LXWmhQvzZ6mr1/uM=; b=DblAvTVCJO2ovhpePPhHVFu9NupbRW6lGHBd0CjEmQWPOw4TNDqpVRLDwDjKn8jGSW mIO537CDzRHf5mKw6Y6cnECG2TIrrcpsW0Fep+fCkfzV9J4jw1xDuHaUoysVbAoqvlLu cjJMY9v+vEAFYX3knCG6HAMqwks1UqbG0jrhY+wxZTNWsNYCsAbrN+7CXLzwj+K+6xIj eAbAsoGpCGLTZBuTsvdpvi5ylcQi2dSvQYTXkNshVCIMuS0ryI2rAYxpbdxvMVnFFXoc FIzvAaX5jllMEJ/UKuZJEc+owXkrBZRP3M5G5DqtgJ0KPZSkfRGNsoBFzYttW7InkzAQ oZFA== X-Forwarded-Encrypted: i=2; AJvYcCWUcv5hIIotS09pP/6/KCuT+yarRc8NLQzUB0/YWmGs6PaWtcIInkNsbm8wnPr8yqFGnzE+uAplooCfSNaC@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxAzbwhUW4qzlfk1gGY3Zp3EdxIJUlCPLarjV4VkESmjwJt0jw8 khKEtGgB0BnJWll5Uww/IFf07PSOzEIu8yLjSSY4qnxK2EY/CTUkRBHR8dQKdn9E9Q== X-Google-Smtp-Source: AGHT+IG9B7QF88XhnH8UBgRzLGJRbLSBU4sw8ixkPIGfimFyyE+f3QWmffMQuqxUFgxuGDiVLxnp8g== X-Received: by 2002:adf:9b93:0:b0:374:c040:b015 with SMTP id ffacd0b85a97d-3788969b7dbmr11640489f8f.57.1726067449468; Wed, 11 Sep 2024 08:10:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:510a:b0:42c:af5b:fad1 with SMTP id 5b1f17b1804b1-42caf5bfcd2ls18242705e9.1.-pod-prod-09-eu; Wed, 11 Sep 2024 08:10:48 -0700 (PDT) X-Received: by 2002:a05:600c:4798:b0:42c:a574:6364 with SMTP id 5b1f17b1804b1-42ca574664amr126330945e9.12.1726067447882; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067447; cv=none; d=google.com; s=arc-20160816; b=bXF5xuexyE20H6wH7BZSAuXgHDmQvjR7ML8zpjSi5QdTlXW/E7Wnb8qWc2oMCyzvFA cS5AoQ4qAtVXsuqfZQ6N5d08PkSbp4yshf3nMCRW1z58m3xflDMTEMWbZt0OQT6sOGDh 0BKwsMckJ83xwvEUi9L6/Eqgm90NISFQCgWB5zm38q9QsQ8DxJfTPobAKIXA65DmyzpZ EoqvPWalDSIN2j2LRbwl+M98ij+9zMz9LB+YgYKTWgaELWqHp6F2yQjrG25EQ2K6VKuA xBtyWXJNBW0lLoqep8gqPwSeL3+vMwomfX74JHvFXGw5yMxKkEyMZ8VdtUZ2nBf4VNKs 4G3w== 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:to:from:dkim-signature; bh=kWsyeuNuyXRiGvMqRv7xYcPZNquHRAzCR6o7cCFgnrw=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=vh5vcm5NYpxHUjwgJFaVV/a5V/nZpvczFV75mS3VlyBhOMsC2zeK2A5HW/tBTK+BLf WBd9FpXfR0pIWhMeCHSsYBWojbccpXk08uUM+PaM6UCuJvyCbL3trEQnR9LYXeQwb82k lJBx3r5L4y0p69Syxl+YWA0qRIIGZqffgZpu6yFtMmFF+g3br1nF9cyi/0vMePlVoABm 3wBaQ8wqFXcc7vsdbjbM/nUzkkfFoRIuxG03mnKNQ1qccwic14DHq48X/eVJNL1FslHq AXraZjzphoGHcUV5K7CRIC7xw1n4ehfRUEPaxrJXcX1KSerWG4JbxVIxu+1bjYUOJCJM DYvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Qar2tRN7; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf30bb0asor39495985e9.12.2024.09.11.08.10.47 for (Google Transport Security); Wed, 11 Sep 2024 08:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4798:b0:42c:a574:6364 with SMTP id 5b1f17b1804b1-42ca574664amr126330585e9.12.1726067447031; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:46 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 07/27] clk: imx8mn: Mark IMX8MN_SYS_PLL2 and IMX8MN_SYS_PLL3 as enabled Date: Wed, 11 Sep 2024 17:10:19 +0200 Message-ID: <20240911151039.2914886-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Qar2tRN7; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Both clock are enabled by the bootloader and we need to increase their reference count to avoid disable during reparent operation. Signed-off-by: Michael Trimarchi --- 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 e089012477a6..31d2faa97a3e 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 Wed Sep 11 15:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3438 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2ACC842E8A for ; Wed, 11 Sep 2024 17:10:51 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3787ea79dcesf3411088f8f.2 for ; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067451; cv=pass; d=google.com; s=arc-20240605; b=UbTUWjzTAefIOjOo0OWcwDtmEhRUVxUgJuuQpX3quBViV7zF2gfOA8ykvPpCHsiZzf 8tJDpkvl26yEAap0eJHv1xIoWkxVakfLnmS3BdCQkylTYiU6P6r/7Qn9DgCEhNBV1YTW 33ZVfF1G7nF6VUbt/ccklNMNEaRCcW2XMVfjuA6P4xInbeaaN/Tm8de/amnaiapOM77T tQNqDZBtiWFEibHUWiHTBwSyozkQTspvArmPv0WXdlnhC39xBu0uT1GDYYeJ2dXlZw5A yWYlW0vRqLNiswhKsfQUGa/Msny3DvsmT3N17dGgwkGdVR/gpwLNrUGp4jsSzFNh6tpl mBVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; fh=ixXYVobIRgYIaj4Cl4sN/sYoP3f7MsMBXsiME40Lewo=; b=NfnHXCRopvoriGSeVf08WVcqD7Gn5/pqX68Ow6H9+8hgcCZ7OadY0+DplPzo0eWl5v Gp4xsefKG5MwtMpL9oCAuvDFsVPOXLn4jLR5DeOXmGaO9pAcL4Gy0+/3u4Ew8S5tpklu W4iYMpUjZWBttTvzjxMbYCZLyWxQ81DGi9UVGuq0DT0/sW1V3kCZs3QoAvPbFhdXRszA 0rdsAmjE6ieZFRwQp4RsDica4X6UV+dBhOQ71Xfua/nOk6HEoo31YWDMXIEjSjkoDiQN YXC8Ve8Rk0HO/nTsYO94YBSqG0H1AEnHC/qWxzef4AmS+YyaHUH0RI4OhICoHljroRDK 4+JA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gOlhhVIs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067451; x=1726672251; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; b=NdTY01BvC6Eb4/qp67smd8KdqZfCRNh6Nlpw+urGs7/BdrFAyer6cahlbv8TQY/XMj p6+r/ioEaUR0duOZWm37cTpYYMHxAykaGuDRidjz1cLSpnkHxg4JiHYqM5d1FCgu14mJ DsJIWCFkH/eFM6jgP4sd7L8lrFVddMxKukfqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067451; x=1726672251; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; b=AeXGFsxQz0ebZ4jOAaotGa9Qu5If+t6BMMXvIUYTtwWHC5oqYQ5H82bQFJ6+FJFRHR vBroBX+hBx2JucRboD+rrIb1YkmmxZ3jKX9vGvn3IF55rKCBOl9flyM8nJf673EqA8fL p1by5Gp1wVCcmZnM8XwkmVaLptCJrcsVHXL0uQkRIK47+EMS2wY6ZPLihp4q/0Ar6LjB K7wYGlYXwJt05s68jtp1gLAfF/LPWtWvrEtlU4XMcCm4QOeZ0pytnHDXCy4VjlrmXfXk by6pCc9CiOgrMNYMSKFOROuawmC2btLFIaqwwEgL439GPgpuL7EDpDh/n3aQyonKA5hr hamg== X-Forwarded-Encrypted: i=2; AJvYcCVrs26t6LRUnO4YrHx3mtavimdKY5A/Y6JBks1PBx98C1fDdE+YfKbz78hYPez6fqDKlt/y4ifvpYiFbJ2x@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzW404o0/ikyG09jba7zMFocaMQLi/tCQex2XNL87METrJvB0yc 1UP8UbNYdYm4nCvgpK2czI4MFXt0yARJpihSmumApU2EL/dKHR1E28CMI2LJ0lX5IA== X-Google-Smtp-Source: AGHT+IGHnmxrKCxYlKUa67yhzU43wXN8nXND6CHe+24v6X8FTt1Xn4hnfeORQwiLWI/oNYTQx35PrA== X-Received: by 2002:a05:6000:188d:b0:378:7f65:e13a with SMTP id ffacd0b85a97d-378949ef5ffmr10536132f8f.2.1726067450663; Wed, 11 Sep 2024 08:10:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1913:b0:42c:af5b:fabd with SMTP id 5b1f17b1804b1-42cdb168be7ls65065e9.1.-pod-prod-06-eu; Wed, 11 Sep 2024 08:10:49 -0700 (PDT) X-Received: by 2002:a05:600c:1e10:b0:426:6e95:78d6 with SMTP id 5b1f17b1804b1-42cae709278mr105892505e9.4.1726067448654; Wed, 11 Sep 2024 08:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067448; cv=none; d=google.com; s=arc-20160816; b=M/eKbzqYKqM2yYqawstczH7GvpE07i3ahVV57Z/0AxkBTqLpk0bjxBYevdIKulmTpc 1Y9Vpy+3mxi4PPvfxi7lQdAvPgVEmL1ZA0G9JAZ8aN+10zwcycQv2O22bEIXiIzaRVvN 0bZpiEfzxaV4wOsckBs8kLQleN17cmxV5tsSHtUjAOEbtE1sb7auB7QgW0f9q78ffI0Y uaTRmb8ZMOVMGPu1YzWZDazhyQSf3Dk/5GXYa7fgpmfJD9wbPcT1FTI1e/kl4sG4fCb4 Os6qVgCM35GWDiiCcob6IvWiJFBHezm0EqFz+yndNI9o5+WrNx0pBhw968BmjUI5Kv10 Au4Q== 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:to:from:dkim-signature; bh=oaGGzg1ZcW8MunpfHTSkfDsZrsx9ImjK3JuQuUVolOE=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=eG9LvzV6bdoXz8SJNtYQuxxfocQ28+CpAM8c+MyiftAzlYmcnc1B+aAd0gWbK2t4g6 f9KYovm0JM0AlUZVwpdCI3iyHfsy0qPMFDPnVOXryyXB3p8u38YKqD8MW4GzxIsKYcdb FdESG/1/UIDd+mBGGAjcogFf6a8RdXrg1gvmC74PIElHAv96JFylV8HXjaLYitIdvRU4 gvivd/A6ix86rsMGWIgh+NdkTf1LCJgKH6KtdGCo6tMB9h7Nrl9QT46zfF9zCYG1RKcz ATLZVPJ7j0Q1dCAUkCjmCiEE6BtVlN4AIdaOQqnW3Llhe0oSV8R9r2C6l5m5aFzPRxbD uiKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gOlhhVIs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2b1c4dsor23626015e9.6.2024.09.11.08.10.48 for (Google Transport Security); Wed, 11 Sep 2024 08:10:48 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:5107:b0:426:5ef5:bcb1 with SMTP id 5b1f17b1804b1-42cae709f0cmr93661215e9.6.1726067447964; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:47 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 08/27] clk: imx8mn: add video clocks support Date: Wed, 11 Sep 2024 17:10:20 +0200 Message-ID: <20240911151039.2914886-8-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gOlhhVIs; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Add clocks support for the video subsystem. Signed-off-by: Michael Trimarchi --- 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 31d2faa97a3e..089f5169da1a 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 Wed Sep 11 15:10:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3439 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id EAFD542E8B for ; Wed, 11 Sep 2024 17:10:51 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cbfc2aac6sf14017775e9.1 for ; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067451; cv=pass; d=google.com; s=arc-20240605; b=h+K7gI8Os44RMUVK5ZliNFPHDRs7ff9qeSjbDhKQ15mk+vtlQcone4pLNwbaRPh7BJ Qnr2HOiNSSk2bT0F1LGCOEbf0H6v+FLp+7XHDBn0NAh3rKrHkWQeR6N9x2QS3IvIAs/b GyqOVF/qys+jmOsNhz6VN/+ugkGfaPrtFUz5dWrdDMllOKTGX1ZCqZ65dovjh74MU8ws KlrJBDz+qSRvQ32yMQcNLbYl3O5VY7xY8vMJs/dd+y1nN2BWAyp7ly21HD/c+Js/UeKG cHLCmEljTBYkwSVIxYS5tTiS3Z7qWQVnlRUzvttlZOpv14FZCKbsqpZEbbey23CVDaS3 UQcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=v3OxefpvdoeH50yprl42ZDBcjf0eFnaPZgpf0nBsokI=; fh=i6OWw+9v5jg59R8pw05hS7o0tfnYnqTy5melSMpmgqU=; b=DCiMHIih6VDvZgEVBWAYTOVKtK7kieYUQAmtUQpnl1Can7vhcxiJuFkfnobcmL2wpG 5Mq3+wzuQvDddqww2z3EGDMWpolCFvhcHuZpgOZfZ4kWqqOb376SXTwpJFWv1YNhODyv tzmLxs8MtqnxNZq//gugB8M31i2FFGZXJKKm1eKKHbrjgW+D89OzknEI3SrFLgvu7QXH RZb3qUg/CXBhS9s8yftYK5eHSYKK41iLLdubZX8CBk3kRIOv0C63J/rZ+FNh7/6+IxJX OLMbFh2iwYHMFxyg4B33mU0QMoTLZ16Xn7y/lNxBqAhM6yicJlrxb2MnsSX7fqJiUz9C RmAw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZHOqVl4G; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067451; x=1726672251; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=v3OxefpvdoeH50yprl42ZDBcjf0eFnaPZgpf0nBsokI=; b=KgToliH2pRGZSOyfqJbC15UC1z0WAf8w3MSo0dJFJuIQzHHMVJ1igkAL5xlcu71maV 8bnzE0HZRNCMgbjDfoICDj9rzAuyI9iN2AWy/QTRQKUwTUwHayOHHju+cqPwAkmD9P8c 92j7he+/0L/EwibXC7/Fv4W6f2mcM8yfqYVBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067451; x=1726672251; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=v3OxefpvdoeH50yprl42ZDBcjf0eFnaPZgpf0nBsokI=; b=BwSrzMoyXaeULaahH5cIqf/DrChBOBJWe2ZW+uiEHWxitGsv3WFoKSlrMheVEHpuzG MwKmvuJaEPcCz/5XPun6KHaCwnruzMCSm0FaDaSIkeFTGG3IKRl+fiDNBS1qiiqx7CHK +hrGsL8x9PpL0uSVCZGJNIsjTP04oNi9oABo/lP+FQLXxjr0rJZdei0rgdtsiZx4w5Yi 65stk5/orV/ElYuc+exmtq5e9+hXUPmpnOKLbWn3pGqfaZU0kZb3lDCta7nXLWmF0hK/ 1LdslpUDalzzYtlEomfqqSjrWtSs8zAFah930IltTEAeKue0Zy/38SUvadRlwO/+fsbz tUTQ== X-Forwarded-Encrypted: i=2; AJvYcCVITkFiW8ksGG2Eiejff+MCWAxB4Eh9jgkUxXc5g6CqJN5/A0mHCPI9IF5G9SUXwbOzusQk0h0/CJJ+QBFQ@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwobS3Wb8vnyujizKpNBt43K9VD1DSvNF/+qiPqqdD1PYpzuLBJ /hSDuUWXhFE44wLCA1hwyP+h7kk/nBQTuzXNZdtBjmYI4fNqhh37QNqL62oebG88Cg== X-Google-Smtp-Source: AGHT+IGPIkeeDDFcOuH9ajd9Dpe+VuWnkdH2kF/iuZ3E8iGc2NljQJNqpWGrZkoJEil7gXZSWthfHg== X-Received: by 2002:a05:600c:3c88:b0:428:eb6:2e73 with SMTP id 5b1f17b1804b1-42c9f9e0d14mr138101435e9.29.1726067451554; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a7b:cbcd:0:b0:42c:af42:6401 with SMTP id 5b1f17b1804b1-42caf4265ffls19207645e9.0.-pod-prod-01-eu; Wed, 11 Sep 2024 08:10:50 -0700 (PDT) X-Received: by 2002:a05:600c:1d0f:b0:42c:b4f1:f281 with SMTP id 5b1f17b1804b1-42cb4f1f41amr90378255e9.34.1726067450016; Wed, 11 Sep 2024 08:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067450; cv=none; d=google.com; s=arc-20160816; b=t4mGRlnx1v2NbZsZwS+w6+TYc1iEK29QUrEgvq7sLMl7ULi3H/BUn+qKe0B7ifnJ4i NVKSl6Utvt9L81PfMV4f5S/NMCZFP2vDkjROgLenG9A0ulfpe9BnlE+sSENxGWxDbcwM kCd/y3bke/DZ6wx91MIU/wnyUuIkmE+kdDvCu5Lyfq50TZR5Jg8XIE7GM2AzrPRO+1CJ CMwQKaHF3NZEBzhasSzlwc+V4aCb80NlCfCaCXVa9VKGj7o2uUaWxRiq+WAVahUxOTq1 rC2bdDFv6uzQ0Yi18cEq5CxdwSg0ZIrAnojcyOHgLvl3l+2A9lZPn2GUHdvHeNny/EsM 9xvQ== 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:to:from:dkim-signature; bh=wd8z27M+2rT/HE8v2FCmgjkp6Y/sl22jU7/0tzRq3EQ=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=TpOXdzhwe241qx8bgM9eTTarKWCITnnQCytw1brkk2jrX9oJc5ooYmWP/1ozUrm959 MZcJsXyunF3HW6HYgIYv3vO/JkfOQjonLWVB3WobRwXQKvRuIate6iMZZYYnzeRbTgpB r90wixk8/49P+yb71xPsbhbXMXc0EFouDgLiAxt3fywT/beOCpjjwTpVtbmXmdQAFaI/ nXHnOtNtO2y2ncbVKh9FvP7fDYVaCl2OiSRrKPrvIn17Oqgp/NfDVFOF7gaZ8SW49A/0 Gem2bFm+zweXbg+zKUNaCcyxBna33xSYL7l2GLYzkYgsjTbmKQtI3NG9/NUpGr73x9Mt 7FIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZHOqVl4G; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2e0faesor35796165e9.10.2024.09.11.08.10.49 for (Google Transport Security); Wed, 11 Sep 2024 08:10:49 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:154a:b0:42c:b377:3f5f with SMTP id 5b1f17b1804b1-42cb377413bmr100053055e9.14.1726067448921; Wed, 11 Sep 2024 08:10:48 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:48 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 09/27] power: Add iMX8M block ctrl driver for dispmix Date: Wed, 11 Sep 2024 17:10:21 +0200 Message-ID: <20240911151039.2914886-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZHOqVl4G; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Add iMX8 block ctrl driver for displaymix on iMX8MM/iMX8MN and mediamix on iMX8MP. To support blk ctrl driver, the power domain driver on iMX8M needs update to add relevant PGC domains Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi --- 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 bd82d2f7044b..fb006b6e8e28 100644 --- a/drivers/power/domain/Kconfig +++ b/drivers/power/domain/Kconfig @@ -40,6 +40,12 @@ config IMX8M_POWER_DOMAIN Enable support for manipulating NXP i.MX8M on-SoC power domains via requests to the ATF. +config IMX8M_BLK_CTRL + bool "Enable i.MX8M block control driver" + depends on POWER_DOMAIN && ARCH_IMX8M + help + Enable support for manipulating NXP i.MX8M on-SoC block control driver + config IMX8MP_HSIOMIX_BLKCTRL bool "Enable i.MX8MP HSIOMIX domain driver" depends on POWER_DOMAIN && IMX8MP diff --git a/drivers/power/domain/Makefile b/drivers/power/domain/Makefile index 2daab73eb758..46849fd2a4db 100644 --- a/drivers/power/domain/Makefile +++ b/drivers/power/domain/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_APPLE_PMGR_POWER_DOMAIN) += apple-pmgr.o obj-$(CONFIG_BCM6328_POWER_DOMAIN) += bcm6328-power-domain.o obj-$(CONFIG_IMX8_POWER_DOMAIN) += imx8-power-domain-legacy.o imx8-power-domain.o obj-$(CONFIG_IMX8M_POWER_DOMAIN) += imx8m-power-domain.o +obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8m-blk-ctrl.o obj-$(CONFIG_IMX8MP_HSIOMIX_BLKCTRL) += imx8mp-hsiomix.o obj-$(CONFIG_MTK_POWER_DOMAIN) += mtk-power-domain.o obj-$(CONFIG_MESON_GX_VPU_POWER_DOMAIN) += meson-gx-pwrc-vpu.o diff --git a/drivers/power/domain/imx8m-blk-ctrl.c b/drivers/power/domain/imx8m-blk-ctrl.c new file mode 100644 index 000000000000..3c22d9de3822 --- /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 8b6870c86463..40fec70d954a 100644 --- a/drivers/power/domain/imx8m-power-domain.c +++ b/drivers/power/domain/imx8m-power-domain.c @@ -32,17 +32,31 @@ DECLARE_GLOBAL_DATA_PTR; #define IMX8M_OTG1_A53_DOMAIN BIT(4) #define IMX8M_PCIE1_A53_DOMAIN BIT(3) +#define IMX8MM_VPUH1_A53_DOMAIN BIT(15) +#define IMX8MM_VPUG2_A53_DOMAIN BIT(14) +#define IMX8MM_VPUG1_A53_DOMAIN BIT(13) +#define IMX8MM_DISPMIX_A53_DOMAIN BIT(12) +#define IMX8MM_VPUMIX_A53_DOMAIN BIT(10) +#define IMX8MM_GPUMIX_A53_DOMAIN BIT(9) +#define IMX8MM_GPU_A53_DOMAIN (BIT(8) | BIT(11)) +#define IMX8MM_DDR1_A53_DOMAIN BIT(7) #define IMX8MM_OTG2_A53_DOMAIN BIT(5) #define IMX8MM_OTG1_A53_DOMAIN BIT(4) #define IMX8MM_PCIE_A53_DOMAIN BIT(3) +#define IMX8MM_MIPI_A53_DOMAIN BIT(2) +#define IMX8MN_DISPMIX_A53_DOMAIN BIT(12) +#define IMX8MN_GPUMIX_A53_DOMAIN BIT(9) +#define IMX8MN_DDR1_A53_DOMAIN BIT(7) #define IMX8MN_OTG1_A53_DOMAIN BIT(4) #define IMX8MN_MIPI_A53_DOMAIN BIT(2) #define IMX8MP_HSIOMIX_A53_DOMAIN BIT(19) +#define IMX8MP_MEDIAMIX_A53_DOMAIN BIT(12) #define IMX8MP_USB2_PHY_A53_DOMAIN BIT(5) #define IMX8MP_USB1_PHY_A53_DOMAIN BIT(4) #define IMX8MP_PCIE_PHY_A53_DOMAIN BIT(3) +#define IMX8MP_MIPI_PHY1_A53_DOMAIN BIT(2) #define IMX8MP_GPC_PU_PGC_SW_PUP_REQ 0x0d8 #define IMX8MP_GPC_PU_PGC_SW_PDN_REQ 0x0e4 @@ -50,35 +64,72 @@ DECLARE_GLOBAL_DATA_PTR; #define GPC_PU_PGC_SW_PUP_REQ 0x0f8 #define GPC_PU_PGC_SW_PDN_REQ 0x104 +#define IMX8M_PCIE2_SW_Pxx_REQ BIT(13) +#define IMX8M_MIPI_CSI2_SW_Pxx_REQ BIT(12) +#define IMX8M_MIPI_CSI1_SW_Pxx_REQ BIT(11) +#define IMX8M_DISP_SW_Pxx_REQ BIT(10) +#define IMX8M_HDMI_SW_Pxx_REQ BIT(9) +#define IMX8M_VPU_SW_Pxx_REQ BIT(8) +#define IMX8M_GPU_SW_Pxx_REQ BIT(7) +#define IMX8M_DDR2_SW_Pxx_REQ BIT(6) +#define IMX8M_DDR1_SW_Pxx_REQ BIT(5) #define IMX8M_PCIE2_SW_Pxx_REQ BIT(13) #define IMX8M_OTG2_SW_Pxx_REQ BIT(3) #define IMX8M_OTG1_SW_Pxx_REQ BIT(2) #define IMX8M_PCIE1_SW_Pxx_REQ BIT(1) +#define IMX8MM_VPUH1_SW_Pxx_REQ BIT(13) +#define IMX8MM_VPUG2_SW_Pxx_REQ BIT(12) +#define IMX8MM_VPUG1_SW_Pxx_REQ BIT(11) +#define IMX8MM_DISPMIX_SW_Pxx_REQ BIT(10) +#define IMX8MM_VPUMIX_SW_Pxx_REQ BIT(8) +#define IMX8MM_GPUMIX_SW_Pxx_REQ BIT(7) +#define IMX8MM_GPU_SW_Pxx_REQ (BIT(6) | BIT(9)) +#define IMX8MM_DDR1_SW_Pxx_REQ BIT(5) #define IMX8MM_OTG2_SW_Pxx_REQ BIT(3) #define IMX8MM_OTG1_SW_Pxx_REQ BIT(2) #define IMX8MM_PCIE_SW_Pxx_REQ BIT(1) +#define IMX8MM_MIPI_SW_Pxx_REQ BIT(0) +#define IMX8MN_DISPMIX_SW_Pxx_REQ BIT(10) +#define IMX8MN_GPUMIX_SW_Pxx_REQ BIT(7) +#define IMX8MN_DDR1_SW_Pxx_REQ BIT(5) #define IMX8MN_OTG1_SW_Pxx_REQ BIT(2) #define IMX8MN_MIPI_SW_Pxx_REQ BIT(0) #define IMX8MP_HSIOMIX_Pxx_REQ BIT(17) +#define IMX8MP_MEDIMIX_Pxx_REQ BIT(10) #define IMX8MP_USB2_PHY_Pxx_REQ BIT(3) #define IMX8MP_USB1_PHY_Pxx_REQ BIT(2) #define IMX8MP_PCIE_PHY_SW_Pxx_REQ BIT(1) +#define IMX8MP_MIPI_PHY1_SW_Pxx_REQ BIT(0) #define GPC_M4_PU_PDN_FLG 0x1bc #define IMX8MP_GPC_PU_PWRHSK 0x190 #define GPC_PU_PWRHSK 0x1fc +#define IMX8MM_GPUMIX_HSK_PWRDNACKN BIT(29) +#define IMX8MM_GPU_HSK_PWRDNACKN (BIT(27) | BIT(28)) +#define IMX8MM_VPUMIX_HSK_PWRDNACKN BIT(26) +#define IMX8MM_DISPMIX_HSK_PWRDNACKN BIT(25) #define IMX8MM_HSIO_HSK_PWRDNACKN (BIT(23) | BIT(24)) +#define IMX8MM_GPUMIX_HSK_PWRDNREQN BIT(11) +#define IMX8MM_GPU_HSK_PWRDNREQN (BIT(9) | BIT(10)) +#define IMX8MM_VPUMIX_HSK_PWRDNREQN BIT(8) +#define IMX8MM_DISPMIX_HSK_PWRDNREQN BIT(7) #define IMX8MM_HSIO_HSK_PWRDNREQN (BIT(5) | BIT(6)) +#define IMX8MN_GPUMIX_HSK_PWRDNACKN (BIT(29) | BIT(27)) +#define IMX8MN_DISPMIX_HSK_PWRDNACKN BIT(25) #define IMX8MN_HSIO_HSK_PWRDNACKN BIT(23) +#define IMX8MN_GPUMIX_HSK_PWRDNREQN (BIT(11) | BIT(9)) +#define IMX8MN_DISPMIX_HSK_PWRDNREQN BIT(7) #define IMX8MN_HSIO_HSK_PWRDNREQN BIT(5) +#define IMX8MP_MEDIAMIX_PWRDNACKN BIT(30) #define IMX8MP_HSIOMIX_PWRDNACKN BIT(28) +#define IMX8MP_MEDIAMIX_PWRDNREQN BIT(14) #define IMX8MP_HSIOMIX_PWRDNREQN BIT(12) /* @@ -92,15 +143,31 @@ DECLARE_GLOBAL_DATA_PTR; #define IMX8M_PGC_OTG2 19 #define IMX8M_PGC_PCIE2 29 +#define IMX8MM_PGC_MIPI 16 #define IMX8MM_PGC_PCIE 17 #define IMX8MM_PGC_OTG1 18 #define IMX8MM_PGC_OTG2 19 - +#define IMX8MM_PGC_DDR1 21 +#define IMX8MM_PGC_GPU2D 22 +#define IMX8MM_PGC_GPUMIX 23 +#define IMX8MM_PGC_VPUMIX 24 +#define IMX8MM_PGC_GPU3D 25 +#define IMX8MM_PGC_DISPMIX 26 +#define IMX8MM_PGC_VPUG1 27 +#define IMX8MM_PGC_VPUG2 28 +#define IMX8MM_PGC_VPUH1 29 + +#define IMX8MN_PGC_MIPI 16 #define IMX8MN_PGC_OTG1 18 +#define IMX8MN_PGC_DDR1 21 +#define IMX8MN_PGC_GPUMIX 23 +#define IMX8MN_PGC_DISPMIX 26 +#define IMX8MP_PGC_MIPI1 12 #define IMX8MP_PGC_PCIE 13 #define IMX8MP_PGC_USB1 14 #define IMX8MP_PGC_USB2 15 +#define IMX8MP_PGC_MEDIAMIX 22 #define IMX8MP_PGC_HSIOMIX 29 #define GPC_PGC_CTRL(n) (0x800 + (n) * 0x40) @@ -142,6 +209,7 @@ struct imx8m_power_domain_plat { void __iomem *base; int resource_id; int has_pd; + int count; }; #if defined(CONFIG_IMX8MM) || defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MQ) @@ -230,6 +298,82 @@ static const struct imx_pgc_domain imx8mm_pgc_domains[] = { }, .pgc = BIT(IMX8MM_PGC_OTG2), }, + + [IMX8MM_POWER_DOMAIN_GPUMIX] = { + .bits = { + .pxx = IMX8MM_GPUMIX_SW_Pxx_REQ, + .map = IMX8MM_GPUMIX_A53_DOMAIN, + .hskreq = IMX8MM_GPUMIX_HSK_PWRDNREQN, + .hskack = IMX8MM_GPUMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_GPUMIX), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_GPU] = { + .bits = { + .pxx = IMX8MM_GPU_SW_Pxx_REQ, + .map = IMX8MM_GPU_A53_DOMAIN, + .hskreq = IMX8MM_GPU_HSK_PWRDNREQN, + .hskack = IMX8MM_GPU_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_GPU2D) | BIT(IMX8MM_PGC_GPU3D), + }, + + [IMX8MM_POWER_DOMAIN_VPUMIX] = { + .bits = { + .pxx = IMX8MM_VPUMIX_SW_Pxx_REQ, + .map = IMX8MM_VPUMIX_A53_DOMAIN, + .hskreq = IMX8MM_VPUMIX_HSK_PWRDNREQN, + .hskack = IMX8MM_VPUMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_VPUMIX), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_VPUG1] = { + .bits = { + .pxx = IMX8MM_VPUG1_SW_Pxx_REQ, + .map = IMX8MM_VPUG1_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_VPUG1), + }, + + [IMX8MM_POWER_DOMAIN_VPUG2] = { + .bits = { + .pxx = IMX8MM_VPUG2_SW_Pxx_REQ, + .map = IMX8MM_VPUG2_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_VPUG2), + }, + + [IMX8MM_POWER_DOMAIN_VPUH1] = { + .bits = { + .pxx = IMX8MM_VPUH1_SW_Pxx_REQ, + .map = IMX8MM_VPUH1_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_VPUH1), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_DISPMIX] = { + .bits = { + .pxx = IMX8MM_DISPMIX_SW_Pxx_REQ, + .map = IMX8MM_DISPMIX_A53_DOMAIN, + .hskreq = IMX8MM_DISPMIX_HSK_PWRDNREQN, + .hskack = IMX8MM_DISPMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MM_PGC_DISPMIX), + .keep_clocks = true, + }, + + [IMX8MM_POWER_DOMAIN_MIPI] = { + .bits = { + .pxx = IMX8MM_MIPI_SW_Pxx_REQ, + .map = IMX8MM_MIPI_A53_DOMAIN, + }, + .pgc = BIT(IMX8MM_PGC_MIPI), + }, }; static const struct imx_pgc_domain_data imx8mm_pgc_domain_data = { @@ -258,6 +402,36 @@ static const struct imx_pgc_domain imx8mn_pgc_domains[] = { }, .pgc = BIT(IMX8MN_PGC_OTG1), }, + + [IMX8MN_POWER_DOMAIN_GPUMIX] = { + .bits = { + .pxx = IMX8MN_GPUMIX_SW_Pxx_REQ, + .map = IMX8MN_GPUMIX_A53_DOMAIN, + .hskreq = IMX8MN_GPUMIX_HSK_PWRDNREQN, + .hskack = IMX8MN_GPUMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MN_PGC_GPUMIX), + .keep_clocks = true, + }, + + [IMX8MN_POWER_DOMAIN_DISPMIX] = { + .bits = { + .pxx = IMX8MN_DISPMIX_SW_Pxx_REQ, + .map = IMX8MN_DISPMIX_A53_DOMAIN, + .hskreq = IMX8MN_DISPMIX_HSK_PWRDNREQN, + .hskack = IMX8MN_DISPMIX_HSK_PWRDNACKN, + }, + .pgc = BIT(IMX8MN_PGC_DISPMIX), + .keep_clocks = true, + }, + + [IMX8MN_POWER_DOMAIN_MIPI] = { + .bits = { + .pxx = IMX8MN_MIPI_SW_Pxx_REQ, + .map = IMX8MN_MIPI_A53_DOMAIN, + }, + .pgc = BIT(IMX8MN_PGC_MIPI), + }, }; static const struct imx_pgc_domain_data imx8mn_pgc_domain_data = { @@ -268,7 +442,15 @@ static const struct imx_pgc_domain_data imx8mn_pgc_domain_data = { #endif #ifdef CONFIG_IMX8MP -static const struct imx_pgc_domain imx8mp_pgc_domains[] = { +static const struct imx_pgc_domain imx8mp_pgc_domains[19] = { + [IMX8MP_POWER_DOMAIN_MIPI_PHY1] = { + .bits = { + .pxx = IMX8MP_MIPI_PHY1_SW_Pxx_REQ, + .map = IMX8MP_MIPI_PHY1_A53_DOMAIN, + }, + .pgc = BIT(IMX8MP_PGC_MIPI1), + }, + [IMX8MP_POWER_DOMAIN_PCIE_PHY] = { .bits = { .pxx = IMX8MP_PCIE_PHY_SW_Pxx_REQ, @@ -293,6 +475,17 @@ static const struct imx_pgc_domain imx8mp_pgc_domains[] = { .pgc = BIT(IMX8MP_PGC_USB2), }, + [IMX8MP_POWER_DOMAIN_MEDIAMIX] = { + .bits = { + .pxx = IMX8MP_MEDIMIX_Pxx_REQ, + .map = IMX8MP_MEDIAMIX_A53_DOMAIN, + .hskreq = IMX8MP_MEDIAMIX_PWRDNREQN, + .hskack = IMX8MP_MEDIAMIX_PWRDNACKN, + }, + .pgc = BIT(IMX8MP_PGC_MEDIAMIX), + .keep_clocks = true, + }, + [IMX8MP_POWER_DOMAIN_HSIOMIX] = { .bits = { .pxx = IMX8MP_HSIOMIX_Pxx_REQ, @@ -329,6 +522,11 @@ static int imx8m_power_domain_on(struct power_domain *power_domain) u32 pgc; int ret; + if (pdata->count > 0) { /* Already on */ + pdata->count++; + return 0; + } + if (pdata->clk.count) { ret = clk_enable_bulk(&pdata->clk); if (ret) { @@ -373,6 +571,8 @@ static int imx8m_power_domain_on(struct power_domain *power_domain) if (!domain->keep_clocks && pdata->clk.count) clk_disable_bulk(&pdata->clk); + pdata->count++; + return 0; out_clk_disable: @@ -391,6 +591,13 @@ static int imx8m_power_domain_off(struct power_domain *power_domain) u32 pgc; int ret; + if (!pdata->count) { /* Already off */ + return 0; + } else if (pdata->count > 1) { + pdata->count--; + return 0; + } + /* Enable reset clocks for all devices in the domain */ if (!domain->keep_clocks && pdata->clk.count) { ret = clk_enable_bulk(&pdata->clk); @@ -439,6 +646,8 @@ static int imx8m_power_domain_off(struct power_domain *power_domain) if (pdata->has_pd) power_domain_off(&pdata->pd); + pdata->count--; + return 0; out_clk_disable: From patchwork Wed Sep 11 15:10:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3440 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C6AD34355B for ; Wed, 11 Sep 2024 17:10:52 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cb998fd32sf16709455e9.1 for ; Wed, 11 Sep 2024 08:10:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067452; cv=pass; d=google.com; s=arc-20240605; b=fcGD9J47Ak+pdNKZ9SnfFMXmdw99ZJL85PdhOlWBgZhj1KIUo86+1bo5ovDB0rho8x xmwCluASvCMNUk7csUIyJB0QR8rfyCdpm0hawjQJaUz8GgS7gmcj7sLOjdoOuim2FGuL PJAQc1hx2E9yM+okz5GD58AzSQfYp5b/6BFQ00pYA3VS7JaJevYqJew86CvZfyKdwLXO YIOUKmZd7v5gqqJe14FBAIQJLV7uJGzOwxYgG+dFlYZokPSUsLJuYFqjZGIwi8Q7+hrA Q2BFufxJ93WGwutQSBzCNfYehISN6nL7ylTIaJ3IYdEm4nnew888L9ltPZVGte3oTDyD v1hQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=DvFwX50THA4u3Zf6glDHlBeQHHY6+5p8etzQ+IXb7/Q=; fh=akg7a8X8erzKxUHbTKarmnhrtrnIBISySBeh+E0Sr7g=; b=Xo71mhTAypnpiTKzbCVmZSHjq96OnaZSpUCTigYScWcVBIjA1dJBrCbkd+UU6yHTQ5 49SEbbtlCHfOztcmChOGRNHIHZTPzrJQIQlzu3/TVXvVRtpVf52g2vkWV9dDVaDtX1z0 mZuexzh2U0AffZYcvfvx9+WWltmTDKAj/fjO23d2X3BRLaoEXBaRl2g33pssH1zao2cm sXrZyFZT/yPA6546VxREVuVuHPK6E3J56xio+aE0xzGpIshOG5Bs30x/skaq05VSd+Jl 2P0f/r38Noe0B7XCRHh1VZPunj5w4ccZx+CtcxHSA3ScPkaz8iaLfdx7czQRa1Ek4F4G 59xQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f49s1quW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067452; x=1726672252; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=DvFwX50THA4u3Zf6glDHlBeQHHY6+5p8etzQ+IXb7/Q=; b=cFnXXvWuBhAK8eSe6QAx7zXmHm85iBcpGC8ngE3C6brooZ4RjdYs8WMUzSTM8tNW66 Ww2eSTZSlAO8N2K1cD9kG08NZ+iSadk63k8xFr3zMK6ssC6QFmO2Gn6PuNRF+jt3qbnV H43uzOP+z9sENSKIHXwhny1vtdqT9ZndmeWdQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067452; x=1726672252; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DvFwX50THA4u3Zf6glDHlBeQHHY6+5p8etzQ+IXb7/Q=; b=nb/EZabycMcu71vbCgezfzDt42ter5lA/rcN8NLSiroKuEea5seJqmFeNj+TuR90Ya MvgardZHJ4Emnde6lzEY8R7zQmQVWK4g+XcNJfuB8sfa8tZwPj2Y3MxNmfTe5co0Ed0y nOXnj3L9rhV3gUwrZH2m+3JoeCLhV5JlnA3Qs2Zw+RkZUA+uXzOgMOz0yD6nBbQoP6p0 YtviYPBd+cBX6vIe7aGvkykbXb9Um39MUJmCVnZPTXD2OKJuD5hYiHVhWqLRNLlbG2C8 vkMUBXqXd/bNhD9EFNynkbmP6ydqcjdnIAliezAFz5oTDBSH00qnTbNeNfQ7SHls24Ob PwEw== X-Forwarded-Encrypted: i=2; AJvYcCVqEyOAuQYzMwRuAc9/qYhUJQi1J1xpH6FgkzJkguEqqdF7sPPcBzbCbVZ4lkNZMkjrER5ic1l5dQmAKpws@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzY9WyJ15hNKx0ruVMJwt9lQai6gHKeSxV0x9n/6X7I2b3RRs3Y jcSysfvbYh4CkZz19fvs7SugTIgLNbandVLrAXDHUyAFmVoHhsULBzGCarzK/2bK0g== X-Google-Smtp-Source: AGHT+IGJNzbb+L0fKFaQLGG6T8XQGnBVAEb8oupgJ5Frlr46MmzAvSqU2l19rjTl1+dL+L4bNToppw== X-Received: by 2002:a05:600c:3514:b0:42c:b995:20ca with SMTP id 5b1f17b1804b1-42ccd35b3aemr25821355e9.24.1726067452303; Wed, 11 Sep 2024 08:10:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1c94:b0:42c:bb08:9fa6 with SMTP id 5b1f17b1804b1-42cbde62c62ls11779715e9.0.-pod-prod-03-eu; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) X-Received: by 2002:a05:600c:5493:b0:42c:bf0b:c489 with SMTP id 5b1f17b1804b1-42ccd32eb20mr29984425e9.18.1726067450755; Wed, 11 Sep 2024 08:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067450; cv=none; d=google.com; s=arc-20160816; b=jAo+1PxrWWGUoJewLeCFsu7AELoLqN5UHRgiy59nT84wnq5YW9WcRm04D/V0O2BLXc FOC1wQGJHLzzMJ/pNs000wHF0Xzv4Fy+f+VONKe+lD6j2LStRbZfpsT9fFxqXXptBgER VN6HSvvZsrDL1+zRo+X/duVz6lFVoJ0WiynfxYTXXH8s0W2pHVfoyAEOejOsRRsS1vdW 8LdwAmX7CQL5bKQBF1PaLPPYc3LmavW0vq5iCMoF4WVMTOveVdQ6uiAiootekes3Oirg wgXFiUMbQphq8kPsxtVQP/HVhgosm+BW+sZcm5bYWqkSoRktQl45CN2K4vANQG2bZnfg RXmg== 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:to:from:dkim-signature; bh=gOCHrWPzA0nRLkrpYHIKhAVeBP9s2BYQHRem+n9Klw4=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=xxclsjLG3nLDXAZeK/D+eXSvOxLm2BHyxkZKuAqcAXEwzTuJLBTg46vN8dcB9VBhFU R1cIIzKNlBycR8vDXZLjx0DL6Wg7yr1w6QCpCcTfzU/JXsd87UOrgDs6n9x/ZhqJvfzu 2QBXN/MOPxxWBV7EdHobE47SMcpqIhidJIjS5bEzZQu69pCWYH2l76UaYa+R3DTV1tMA gtyaals7yIocPONfS87goHhKWXUbNSfJwY5ro9TdlQWDZOl0anGNGcgIu82qfvBwcDbs Cn+Ypxtu/mgJEPdGp1kwQQ2sGL7K/5QMGlKvB/sDHN0+HpKhP9We/JQ96Xwgrd7rhv1A A8Bw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f49s1quW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2e061dsor36567465e9.10.2024.09.11.08.10.50 for (Google Transport Security); Wed, 11 Sep 2024 08:10:50 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4a83:b0:42c:be90:fa2f with SMTP id 5b1f17b1804b1-42ccd35ae35mr29112495e9.25.1726067449850; Wed, 11 Sep 2024 08:10:49 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:49 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 10/27] video: Add video link framework Date: Wed, 11 Sep 2024 17:10:22 +0200 Message-ID: <20240911151039.2914886-10-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f49s1quW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi The video link framework bases a port-endpoint gragh in DTB to connect the video components in uclass like: video, display, bridge, and panel. Using the port-endpoint gragh, we manage multiple video link and user can select one of them for splash screen. Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi --- common/stdio.c | 4 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/video_link.c | 533 +++++++++++++++++++++++++++++++++++++ include/video_link.h | 19 ++ 5 files changed, 563 insertions(+) create mode 100644 drivers/video/video_link.c create mode 100644 include/video_link.h diff --git a/common/stdio.c b/common/stdio.c index a61220ce4b9c..66360c97ed12 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -340,6 +341,9 @@ int stdio_add_devices(void) struct udevice *vdev; int ret; + if (IS_ENABLED(CONFIG_VIDEO_LINK)) + video_link_init(); + if (!IS_ENABLED(CONFIG_SYS_CONSOLE_IS_IN_ENV)) { for (ret = uclass_first_device_check(UCLASS_VIDEO, &vdev); diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7808ae7919e0..d2432d67a460 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 f3f70cd04a17..9fd3645994f1 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_$(SPL_TPL_)SIMPLE_PANEL) += simple_panel.o obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.o obj-$(CONFIG_$(SPL_TPL_)BMP) += bmp.o +obj-$(CONFIG_VIDEO_LINK) += video_link.o endif obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_backlight.o diff --git a/drivers/video/video_link.c b/drivers/video/video_link.c new file mode 100644 index 000000000000..52d37e823009 --- /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 000000000000..5350bfa9e9d1 --- /dev/null +++ b/include/video_link.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + */ + +#ifndef __VIDEO_LINK +#define __VIDEO_LINK + +int video_link_init(void); + +int video_link_shut_down(void); + +struct udevice *video_link_get_next_device(struct udevice *curr_dev); + +struct udevice *video_link_get_video_device(void); + +int video_link_get_display_timings(struct display_timing *timings); + +#endif From patchwork Wed Sep 11 15:10:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3441 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6A4C54355C for ; Wed, 11 Sep 2024 17:10:53 +0200 (CEST) Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42cb050acc3sf5955445e9.1 for ; Wed, 11 Sep 2024 08:10:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067453; cv=pass; d=google.com; s=arc-20240605; b=erAkea93RjwWHZXzjtfbnpMgznhWbVHaj6f8ARw63Qad3b1Ap3tE/QgzAPBj/0pa5v fmIOGG4Kp2kIuYy1JT3S83Gbz7OFYwgi17KDDuvdwBvtI8MLklxHs7d2gUJhI4tZ/XrX XWPR4Jwin2i1NpQMOnU0IrELdYbqNUfSXxn7FUMm6Hs6DNCekFZEaA7VHe2o7xk9nGzJ gnC+dh7FoBX4UQES4kM9JY/fLF1SZMZ6HR3fgbLHO3P1/Kt4nyzrR5lregpkzLx12uqX PFQHoIbDCyNPw8PDq2fec0motWmZqMh4pXgZL914P3G16RHiEBV5wjC0xL9uV4b1yFU9 CE3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=qmTPwqBR9rbXKSBUWJhSJIri8cFmBf9EvddF4MLIYE4=; fh=eHH8ciw1bHmaIbJJVtZ/AY3fDXB75EqljBnA+BAoSBE=; b=el5Z6+oDOnYZWTHSkgDelaMXmRi/CJPpWzjHw/xEXlS5ff6ZZoCQ7Z10+2itrZ8R5Q KvPT9vwQp6hr8P6dz8aWcPoxOhwGWY4/RyjbD5D3dB8/W1SokJ08Fy5TndGkUMLkVigy 3eoSDlIaCclOwYyhjTuwsyZ8BuBzedCiyvYvqmeMUnjRrdow2qs9CN1Zj39MqPxvYkiG 2io/VlrCNaL2eIR1zghyyMwz0Apkpqhhkzomm3p+8XrssNCoDLIj+dalnfomiNtffxHy RAIvd9Z+9vOHt2QEQZulDJ7SXu4Y/Vcb/Exn5JkHYkMxefvrA/zvb+jh0NMeS44DEsmQ sCPA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YBIoaeIK; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067453; x=1726672253; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=qmTPwqBR9rbXKSBUWJhSJIri8cFmBf9EvddF4MLIYE4=; b=G87Rfn4juP3AL+OerTG8lXQEgrT6ZQBNemwCX2Qccm3s1jLphhP8hLu5MJ7E+WmasC D+6TzBp8GJozUtBKc9UGYoxVh279F707xsknRvdmTOHxdYZDqBAao5yZeGZpXqAzR9DG xk8w8HKGNi2NIoh7VOqwQSEcMa4Tn3TwKrR10= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067453; x=1726672253; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qmTPwqBR9rbXKSBUWJhSJIri8cFmBf9EvddF4MLIYE4=; b=rJVSYIwsoHiL4d6LPcJzrBTU+ktwSLV5yEvJ+arD8zXSVH7Fk3+/7oeAy35Pm9o7tQ ohY4O6O5BcI93rRE91kEyktnS7G+PJ2AFDjvaqY4Y9Iz5RBy6Pi+KbMuxBX65LqqSoJ1 l/gf9dHMtnYWSEUfQHYp/ymfEgQRcalDcXFZ3yFRu+Sp9HA72ophkk57Xi7HQKFZqIc5 IFu+gHXeN9sjAiK1yZw5S23bV4ozGb6D/CNCL2q0P62kwLUUH+yHxQlCsvv3oCVuqyvb q0NoacMM7Qph6YD7qUgB5Bjrc3hk0bu87NisycvF3LCWoAsOjDBeIqgS+Sos8EFso1Ne o5cQ== X-Forwarded-Encrypted: i=2; AJvYcCXTznkiZU1KeIFlfI/lzMq8+uebFNxwaGntTkAM6eSJ/CAzu+BVfTAc+8dN/LkjivfzZpcHVCCaQDIilt/X@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yzv6OSDbjk8fepEFjtYjC6X1rCl82XSwsTQMAKbtyd0pnXfTLZC o5OvYouFH65Sbn88tmcGGCU8a6Hkip3ids967DdR98daujZgkbNaLoSMzmCzhUMQOw== X-Google-Smtp-Source: AGHT+IFh+1RPCBsDKEvq+9i8DYqQyKD7BLt7/5iLyeLyzqNcaoeNCtNBaPcPerZjvoGMoMGZMVPRXw== X-Received: by 2002:a05:600c:5110:b0:42c:b377:3f55 with SMTP id 5b1f17b1804b1-42cbddb7f79mr41509585e9.3.1726067452987; Wed, 11 Sep 2024 08:10:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:19d1:b0:42c:ad31:3843 with SMTP id 5b1f17b1804b1-42ccde3c699ls3984785e9.0.-pod-prod-00-eu; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) X-Received: by 2002:a05:600c:1553:b0:42c:b603:422 with SMTP id 5b1f17b1804b1-42cbddd70abmr42051865e9.8.1726067451527; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067451; cv=none; d=google.com; s=arc-20160816; b=f1VwfcMR7TwBBN0kI9jGd5jQiDBlnwtXCqMjl9q5ZN4xeG1QiCi7tw+sYpcZRdr/16 OnZ3adfR3RwVijVYvBrHPRuSm+XL7RFB92N52tRBXOBbeCvlajR46+DE8GjqZ3TvB6N7 ShxbA29Dc2r7YjQgB481Hj2OMfYD4/pI22nvW7X2qZCc51jXWsjB5LGVKeDwo8JCyV12 GWL1GerGBiCyRgasHrzK9tR4VZk8To55IaqQBoT8hVtGCxhmrf0BVDn13bCeN9ncjM7U XxvIV8SrH0Aa3wnJ9/Ciiu1RfBYcVQw7YylIugtGD/JdZAQEBdc8ktkCBhg/s87Ah6qr Sxpg== 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:to:from:dkim-signature; bh=18UE/TjtsBSoQafY0oEo7+M0f8SVrTD2gpyVr8YhC8E=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=SgHVbTu331YluK3xhiLEcC4OH/lIkTpNoJ7jLoE9lK4ZkNSAi1T0oD0CDOAL+ZcGAW +kB5KRIiVJc1NCB6o6YekCXswmsTskJVHQoG3Kd5TtpsnKh9X+jrNqW+Nak4+FLwEwDX oZlGgIQSIXi+faRFXWUFB7wocRVIwZ9yx+Xy999gA9UKEnSExhMdV0YaV2cyCQtPWf2s eq0RgYYccYPQSD1goBT9w5feKW2Mesmepo2gm987rn+g5DAdGBnSjVg+pZIUAdlTtMUo as3okPbRyavo/UDP4d0k+bNJc+zH68DRGq0ciLHndNhM2PTw4ovcSkTXom89439sUnD4 O9sA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YBIoaeIK; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42cb10c08fbsor22469895e9.1.2024.09.11.08.10.51 for (Google Transport Security); Wed, 11 Sep 2024 08:10:51 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:46d1:b0:42c:b336:8f1 with SMTP id 5b1f17b1804b1-42cbde016c9mr42080345e9.13.1726067450888; Wed, 11 Sep 2024 08:10:50 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:50 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 11/27] video: bridge: Add check_timing interface Date: Wed, 11 Sep 2024 17:10:23 +0200 Message-ID: <20240911151039.2914886-11-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YBIoaeIK; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Add new interface check_timing to video bridge uclass. For bridge device who may update timing needs to implement the callback. So host device can sync the timing with the bridge. Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi --- drivers/video/bridge/video-bridge-uclass.c | 10 ++++++++++ include/video_bridge.h | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index 2084a2e03ee8..7432107238cc 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -48,6 +48,16 @@ int video_bridge_check_attached(struct udevice *dev) return ops->check_attached(dev); } +int video_bridge_check_timing(struct udevice *dev, struct display_timing *timing) +{ + struct video_bridge_ops *ops = video_bridge_get_ops(dev); + + if (ops->check_timing) + return ops->check_timing(dev, timing); + + return 0; +} + int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size) { struct video_bridge_ops *ops = video_bridge_get_ops(dev); diff --git a/include/video_bridge.h b/include/video_bridge.h index 3b429eac578a..8b71b04a1119 100644 --- a/include/video_bridge.h +++ b/include/video_bridge.h @@ -44,6 +44,17 @@ struct video_bridge_ops { */ int (*check_attached)(struct udevice *dev); + /** + * check_timing() - check if the timing need update after the bridge device attached + * + * This method is optional - if not provided then return 0 + * + * @dev: Device to check + * @active: The timing to be checked and updated + * Return: 0 if OK, -ve on error + */ + int (*check_timing)(struct udevice *dev, struct display_timing *timing); + /** * set_backlight() - Set the backlight brightness * @@ -98,6 +109,15 @@ int video_bridge_set_active(struct udevice *dev, bool active); */ int video_bridge_check_attached(struct udevice *dev); +/** + * check_timing() - check if the timing need update after the bridge device attached + * + * @dev: Device to check + * @active: The timing to be checked and updated + * Return: 0 if OK, -ve on error + */ +int video_bridge_check_timing(struct udevice *dev, struct display_timing *timing); + /** * video_bridge_read_edid() - Read information from EDID * From patchwork Wed Sep 11 15:10:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3442 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5C8EE3F251 for ; Wed, 11 Sep 2024 17:10:54 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cae209243sf32180955e9.1 for ; Wed, 11 Sep 2024 08:10:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067454; cv=pass; d=google.com; s=arc-20240605; b=dgKDtHuNnn/lT9iZSK+SwjNBT4G845sDmWKaSS0qgbkd3WwqILfTN8jXtGH0Lxl5jD oZSKqz9GIwnUeLCVfPNBwrQ0GVe6MRMCo0QWTYKbvQCkaOcweA6tWGqPzD13ZFmvcXvz KEeTppDdfnWzLt6+p249pvKn33YrKkfouG8U3PqVuROG1Xo36EqbMDylqtqcPI6XgB8U UVzFXWxojzWDmSAZhfCIu8h1NRwTv79oOxH6ydh9EFZE+O0q2x69DI1e/CUmES5c3pHE PKqCjelUwLONyymH/CbPNRhBUTp0JT714BsRg+H9rXKU0GkmVtdG2iO8N3tu/8NiORIw NBCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=ArFQy4MPcHAqWTOS5HHlPVC7kZmpCi1kR7q+SeLvCN4=; fh=Ni+jfmxckEJswsPt84hOs03WrcQoIrXvRnqjTjxxcJM=; b=e7LSBs9m787vhqe4rmVlHnew4Q3uRwyz0rVIsPhi+t0FvB1xIN2rwyeJG3VqDXOvXW hzmKb2peZLpaQk3OE3ZGGw2cmXNLt9cz53jjrbU/PsCZT3fwF6EZi6LgrEI5cVblAa1q VPvF7MwZ/8k8fRgzZeVBaMbdVtZP+QJT0Np43+F8hLRnddhHAGlP2QX0fAn5/xrPT1bm yZG9Vvz2wrTn1Sw5DurE+Kxw27CFvLbdWRrLLoxHaeK9A1lhhvbPdM9BE7HOSVOt0VRG 4Me2zcGM2Mt4GnnEc9LlTLf4LrTP/g12Vq8kXW/pW5qeRHNrtRfr3xBoUYogg4snN34N z0XQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="n1/pwP3G"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067454; x=1726672254; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ArFQy4MPcHAqWTOS5HHlPVC7kZmpCi1kR7q+SeLvCN4=; b=ZjzvUGt1xrLdZY3AN64NllH5qjvsNbjFbC/rLI9Pu6SK3L6oRzyK+wbnUUbkf9sql4 Oyvo4l3RhoiulRpWCZBpc/D92H7Kpve/qEAkrjD/ABlLPJlYOnNxPFeX87xf8amwZN6F T0eTIqQQnuX7441+gSv5DZjn73DaRCkgIAnjs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067454; x=1726672254; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ArFQy4MPcHAqWTOS5HHlPVC7kZmpCi1kR7q+SeLvCN4=; b=bxKZfz9NrlUGtNQfkEr5xxBf93BqAQrQ7c2D7P0cReSDgGw9YVDhWwG6SpPINf9LS5 jkVPia+EDqa5+2tBIWysKZNsjcZdb4kkocWbgJYNG10saqjo8v04BcqP5rbYOURFQaor tFa0oRVLPMLCCZLEa0GOhOX6UEuBmSRrkxyeIFgFxmPHRdb2NGWQluXvkmL9sO60ScGf 8X2MGuRSUgtbpsbZOi6vMD69RlLUBb419Gjpp7PEgYZyhN9A142WTlHsEpFA5it/mtcW PxA1neSTZ9OArWOpyLQLsEAjWST8bjOqHNBfsgoy3h0nPV64+C8H2EVqvSN7pp/ZKGQC rU1g== X-Forwarded-Encrypted: i=2; AJvYcCVw7PwDlCLWwON7dXdey7SFw6+gV0ylIQfhoEVoY1Dfs83RrKnJQ4JJgDEpw3Bh7wqzIOjbJso4q4Zq/faF@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx9jwdGgXvKZZ9pZhJYJSmKVjse7LZUuUH7Y2EZQUkhlNTaSkiB YspmcUpSHc1vW8OY5ylmJjO4HqEofuG6L6ElkHCsGT2S5VW0gz5DDN0aVwMaTtTgkA== X-Google-Smtp-Source: AGHT+IHqTeD7LKF783YMpO12gwjeBgnfo6fGZW9sD7OSf9/UFWZGDOWEh1p6LB1eZUK0dsPj5nGlrg== X-Received: by 2002:a05:600c:1d90:b0:426:593c:935d with SMTP id 5b1f17b1804b1-42cae7093c7mr106898945e9.5.1726067453994; Wed, 11 Sep 2024 08:10:53 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b23:b0:42c:ad31:384a with SMTP id 5b1f17b1804b1-42cdb0484cbls133555e9.0.-pod-prod-06-eu; Wed, 11 Sep 2024 08:10:52 -0700 (PDT) X-Received: by 2002:a05:600c:19ce:b0:426:5dc8:6a63 with SMTP id 5b1f17b1804b1-42cae76cf47mr107213905e9.30.1726067452544; Wed, 11 Sep 2024 08:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067452; cv=none; d=google.com; s=arc-20160816; b=ZbFndbfUQtEUy7lCoa5sLjqmhqSyop5+gRipWj+RPGs759FiL4346E20YTBWy1YUmI rljKVuWkeThHvj1foJt43OwkxIza5vUFeg63NGr4prHm0s0ffNP4eI96DRlFON3l/vJl wxHOL4VI7flGBgokT/zjbQhfjEkVJKcJrQzv86oLaWtHy34c0sERrj+60GG89ho1kB7G RQa4cmc1EcqAAsHgnf+Ng95A0nBIqQTxyKwUamwzZOghUqKfsPuZ5NUR7ASuLSnVN9iU aD2vEgOiyvcH+BxNCg5af2vW/ieU9Cya2LWoM+Y+g2KNVlTjCMUMji8ZS1WPvO5O2RTO V2RA== 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:to:from:dkim-signature; bh=+G3YJHmN2wVHjbQwepNjO/RbB0P6DWTMuf1v7Yxgzqs=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=ZxJ7Ud8vzTLmw24zLvRH1njOJGhMWQ8+ZM6d/O5XwqfR2z70ilTvj/FuqFJV+wMbfa CDw4ZVdRQtONXDhHpD77SMoMzGl5MObuDYrcOOGwgCBcKw8/x1V8GfdCl40/F8JK/8IH X3rclc82Iz+8u1YLuv2hLm9/r8fGQyvastV5kBsJLDCTkXhIY3ReX4QUurc8wSn5Q989 jf2YSxMwjWRSopJS9KWzi7H8oaylZ44ptRCMuNL+gxjvdBnTIdEz8jmEXJSb2lpjUWrN N8LgESWUK1txojwa27TjD9faHGjKETUKTllAP7FVw8/k+9ahgHLoLGWlGAHTcAlD3xiR l3fA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="n1/pwP3G"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf307afbsor23626455e9.12.2024.09.11.08.10.52 for (Google Transport Security); Wed, 11 Sep 2024 08:10:52 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:adf:fb4e:0:b0:374:ce8b:bc65 with SMTP id ffacd0b85a97d-37894a6b6f8mr8219871f8f.56.1726067451792; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:51 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 12/27] video: dsi_host: add disable host interface Date: Wed, 11 Sep 2024 17:10:24 +0200 Message-ID: <20240911151039.2914886-12-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="n1/pwP3G"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Current operations structure has provided disable callback, but there is no API from dsi_host uclass to use it. Add this disable host interface, so that dsi bridge can call it to disable host Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi --- drivers/video/dsi-host-uclass.c | 10 ++++++++++ include/dsi_host.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/video/dsi-host-uclass.c b/drivers/video/dsi-host-uclass.c index fde275ad7e2e..745991f8dd94 100644 --- a/drivers/video/dsi-host-uclass.c +++ b/drivers/video/dsi-host-uclass.c @@ -34,6 +34,16 @@ int dsi_host_enable(struct udevice *dev) return ops->enable(dev); } +int dsi_host_disable(struct udevice *dev) +{ + struct dsi_host_ops *ops = dsi_host_get_ops(dev); + + if (!ops->disable) + return -ENOSYS; + + return ops->disable(dev); +} + UCLASS_DRIVER(dsi_host) = { .id = UCLASS_DSI_HOST, .name = "dsi_host", diff --git a/include/dsi_host.h b/include/dsi_host.h index 83f8839db68d..5873ab698d9e 100644 --- a/include/dsi_host.h +++ b/include/dsi_host.h @@ -70,4 +70,12 @@ int dsi_host_init(struct udevice *dev, */ int dsi_host_enable(struct udevice *dev); +/** + * dsi_host_disable + * + * @dev: dsi host device + * @return 0 if OK, -ve on error + */ +int dsi_host_disable(struct udevice *dev); + #endif From patchwork Wed Sep 11 15:10:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3443 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AA52842E89 for ; Wed, 11 Sep 2024 17:10:55 +0200 (CEST) Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-374c581ce35sf3496847f8f.3 for ; Wed, 11 Sep 2024 08:10:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067455; cv=pass; d=google.com; s=arc-20240605; b=OGFpf03k6r5M4FYIIag8nWsQHejvxhLILIopgrXvj4JEVyOnXOV+Idlu+A4XN/3qLt y+H2kFb3V03kEqwxLh0DMJpXmVSIvWqat2WGq2Z5hS2WGzk6MVxERSX7u3DgWrkzxR9y Upe1RHoEddq5G44i0riJ22ICdTYae78Xp3waSZPzmRbGgbW9fZ3ng76FDko8Vv8GJ5KI jCglY7ptm+B5Ul0YVynezMa1cRCv7UvmjFdcXv+7wIsxlkhMHIwO01Aa3Rfq32CYmcHS 2ZD1sktUv32DaH16WdIFY4Oq48xxiWN0Ouhv61Lm2kvQR3Fh+mYpJV5SDu/DhzSHxrMr yDbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=1qjXluEZqIJ4ivd7s/zLuoeS4yndFJ8JwctijI6n0D8=; fh=FfS3SK5cROBa03wfbsZNpPN44wEq3j0nrLXNhbaTmAI=; b=TzTLR7cEioRCseuDDNULkeHiL3OGeOulJUUCsCVXutUutYJ6Vh61KFc0xXtJd9kwZk O7X9LyziP3n+MV0V4xS/VIQuJYn7PTfYObZJyKVySrTyttcE68v3yCaqZaPHygNCpAZg e36vnZyVCUIw+E0uqX+izkuuEhRw61JTBuNWayyqF8VlLG8Cuas8EvtIKwjQh6iYnzTa Eay0ddwtxSLnZckkRFooSynr7RUHOlqOGQszRtDGM4eRmnMzRyEOsTK5xRBLaxyTtBQV k21gU+EqzBNrK2mU/iFHzGsMEFE/L9PoEoE3xwHl1abnJzS/3OLZUHHEXbR2sXfL8Z0A +9sA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rRzzdn8b; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067455; x=1726672255; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=1qjXluEZqIJ4ivd7s/zLuoeS4yndFJ8JwctijI6n0D8=; b=cT66cs1AfO98LjotfWhvblSuR7htrgABIzPJ4eXpzp/MFPgvamHgkg8fT9hTvKM401 UepwTa10Lnf90QwiDCtjeplv9Bvw/mcu3mkbDrF4EuAkMEAq7eHuIMkBmOvzOxmfDtV/ YUfcKqC4j46sqfyZ4qnZtShjTnjKBiNJKr/9M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067455; x=1726672255; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1qjXluEZqIJ4ivd7s/zLuoeS4yndFJ8JwctijI6n0D8=; b=hrw5g32sGu0EeAZl9JsyjT+eoCuy9ei7n0VsNbUUWzkSepRoKieU9v8GirNJ+SCzh7 6hlHw99ueB0+qAazEF18VK+NIXcdS7/UF4ytXTLEgnCDbFJPrtOe6wQoVvUFIqq86CPh L3nVjOaWQqeS8Oh0Zg9EtpzEW3HSU6KI4thdfFLaqGT/4oJ3fLopxu+JDmMO136pqs1w bLIdxB5o2+I77g2E9z0czt6a/Qhb/n8NvgWySxzS3cJDuBS91eCtBcq7Ks7FktBZc4I8 EgdteI2Zz66L0gJRG90Lppp7PcgYRC/3+sx6P62c6X25t0E/VDPGB6vOAAyK3a++6Z2h hmIg== X-Forwarded-Encrypted: i=2; AJvYcCVXVD3J5gAhtwPD36IldoJJkKk+V8tYOzDm3r+d1kc0khB6QzyR1RpZfnbRR58kWwFGD7ZDVJ1hn1m7P+vo@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yyf0pt3ebP4rl1qezdfjL/rDPs2UdLkkolYZg/vdnM4Fo+M/4PL dgdjDdWs2PFnpf/MofS14KdfsAbO+94qZ6uQLEYaslwCq7DFL/Cg3cZwIG1o3Ho5YQ== X-Google-Smtp-Source: AGHT+IEQSgPWRwttRJxBhoCpHZu/GSJAKVAFOaXrVXopx8y0Jdww9bdhHf5c16glIzNH0/+m3gE9UQ== X-Received: by 2002:a5d:658b:0:b0:377:205f:c494 with SMTP id ffacd0b85a97d-378895c541cmr11033709f8f.11.1726067455160; Wed, 11 Sep 2024 08:10:55 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:6845:0:b0:377:2d98:7c90 with SMTP id ffacd0b85a97d-378883d759dls1863718f8f.2.-pod-prod-09-eu; Wed, 11 Sep 2024 08:10:54 -0700 (PDT) X-Received: by 2002:a5d:558d:0:b0:374:c671:2324 with SMTP id ffacd0b85a97d-378896591d5mr10495981f8f.44.1726067453676; Wed, 11 Sep 2024 08:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067453; cv=none; d=google.com; s=arc-20160816; b=E17Gwnj+xq2J8RCO7f5jFXDlgBxg3LwTI1fw2dux3Wjkn+iU+oxIeLRn30KcrIj6md 0BqJZl0cYxNsOKR437ivWfljB/utIBjWvVCqGv6b6MnqCsnMex2wgBkX1Gc+mmwyQ8Pg RBJq+vGSKdmXsveEkkSiBp8GFBehwNchv7FZcAXVCwzskSPNNZKs1lhxOmRZJahtWUA/ IUuLxYgBOygItKMtXRxG7//akSk0tQeDadhVP15zbjEJfKm4Ol5d/CcGZrEcAv2Q8q/Q h/sjErUHr3cTQEgOxIBc5+pL4pFHzyf47tp/dK/v2D7LORwfTPP/cDt5aKxLF4vmdj/U HINA== 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:to:from:dkim-signature; bh=z8nF2JDMXf0aSXakTOuvB/aSZNwxPB0i3IX2I/2bdOc=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=oP511oLfR9lJTALeJtyZSV8bakUuvebs7Xf7ysjqtHNAxLemfG9y1Wj9aI4QrE65fZ VulXNjgF9/jqATJPMUt1vB5YumCFSol8rDw/bL5iW8Kdpzp1oN+wq3e9lw5vgEnolxMa WmhwGZhrJemedgqxQgUxwdfiqCGtzqw8pCz9wVKzfkzsKWNi2SEUIkzrCdCE3SSQoX/I wWQ3fZrGdgvMEuBs4EfNFbMisRf8GSVZkffHvcKKfu85XW5HfeO0L6mXkKpp1ka9KS6E lZh2bolJIaFzKkwCwDvYc3Xv2luDZLlOkQjTwzLDR2VrriY9JnSALXY0/osMgnZ82QzF DyZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rRzzdn8b; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf301b51sor39504615e9.10.2024.09.11.08.10.53 for (Google Transport Security); Wed, 11 Sep 2024 08:10:53 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:3b1d:b0:42c:b750:1a1e with SMTP id 5b1f17b1804b1-42cb7501dc3mr89467655e9.0.1726067452803; Wed, 11 Sep 2024 08:10:52 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:52 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 13/27] video: Update mxsfb video drivers for iMX8MM/iMX8MN display Date: Wed, 11 Sep 2024 17:10:25 +0200 Message-ID: <20240911151039.2914886-13-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rRzzdn8b; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Update mxsfb for LCD video driver Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi --- 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 792d6314d15e..4186ccd00209 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 Wed Sep 11 15:10:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3444 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 656B34355E for ; Wed, 11 Sep 2024 17:10:56 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-374c54e188dsf553633f8f.1 for ; Wed, 11 Sep 2024 08:10:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067456; cv=pass; d=google.com; s=arc-20240605; b=PLWGQCzrlspVuUG7lfl3SY3nABQpyg+41FariCI/ZdXTdC+7ngi80i3VbVzHOrK8GN zydplClggYmE2ZjMX3hYRpGKgVU6mNnPzsZqi8YZ2lfPO2CjAHaEA2OtcplMRyEIbW8S kJO6COB9fGck3YuKCw/zDhPGr6DkGl7BvwF9/vW5fmIfytmiRWQcmAA+V+dDnwDUnRVZ jdAmLd4ZrOYjoVCXnEieujL0URcX4g0gjwitOXkhInN8cTsISDm9ORVTnekyD8zDWX9F ype2OLtP9wFzjXWqxxHVJPeG8dhhs5xXoKFpk2B9GdVEN6h3ROwPANV9gODidaewpZ3U ZSEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=GYI325t50TqvqVzBXl0dylB83R1c44SEFpBCc1vV53g=; fh=vbo0C6TICT89E/Q837gmw4uRSaR1IjkdT+WXp+z54iA=; b=I2sxjauER6Q0CGq+WaWENuPSgFD++jejYhLP8RsT3bnxiwRyy8b8PdqYf0727tsIsM EM60JMpOGlNFNTaOVZK+3KDMglJcs+PuPqe+7v1Qjxwp9aMCDAjFp3EnXR9vYdTs2/CD DkSwMTvN8ZsAt+1JhUuDoVeRfN8KlJ27RwkQ9Xx2fLlO9TrVtopAiSCmsGzWH/7bHbt9 62ILt8Ze3GZO786Ox5/L8FVFJILsAn/RbLRJuidycEEpZhSgVGsoagpWHlWkxBXIL52X e/hQ19UASEyGkJ2Y25+KKV8bDMAD4a9oJMSb1LQaIeNlruFHKlYgLrFeCKDYcXdO6BNp HQfg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RJRevF2M; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067456; x=1726672256; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=GYI325t50TqvqVzBXl0dylB83R1c44SEFpBCc1vV53g=; b=T2Az0TkZvWbDFUq2l4pKcO6E4rAJulWOIUU1rrbyiTGtpgncKZfo4jLzdzJ5GUke7G iQrpCwkmby9TkbjJ2rII+IK3WMXDt0CRlERORuv6T1F8KOA/vlO/6AmFj4/Xc10shIuu l7tZaHh+/HOWusQdfOXMGUmmJsEnNUa8L2fC0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067456; x=1726672256; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GYI325t50TqvqVzBXl0dylB83R1c44SEFpBCc1vV53g=; b=ZQ0MRoTUrcjdAdxcDauxywNdQLiyiNTJsw/lfUOVZZL6Nec6R/iyHjneY8KSV8xY3/ 725ERatbnGk45f7aQYjEiNPSElzZ6qgBdhx1X7BMcUwg596XspeDpmyRrIYdAVeqsnv8 dL7TOoFPRR9uaniK3OsN5iScAmBR1B9ivH9sdxvzQI6QfVFI4/PnuiBJSKZGQIC1/RmV HNeR2+arf/cXqhuOQN1wyqwbqonlr99pTxPX2wJjgQ5nTY6IXJObBgd50pnR9bW47UTf uzsRwH1eXIvOo8DZtJMgLowSESieYIDu+E3HURUsltdoMoGgHOrpKdDVzgVJSbKaA6ab ethQ== X-Forwarded-Encrypted: i=2; AJvYcCXZgFfuXcvM5NzwYlW6/Y922alsS8qZcw2Uy3g63Ev8xdMSdXKOlVZmU2QH0ZNg9V0VbfSarScrA7EOn+Jj@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yz5ep9qv1Uc0IvHFIli0eA7BHEaMOCGk2IB1f0OA1jZavTqeNQF gKy2Turajismy5CpPbZyyst2T8dMPvh/x+hRDQoojdcZhzCyRrRjZyCWT6Krx6ETMg== X-Google-Smtp-Source: AGHT+IGf3AqdnJBv3vYovvE0dkaxwqimbfSyjAMomkilIgud8XI1filsTvio7wxlf/pK/k7MUUNk7g== X-Received: by 2002:a05:6000:144e:b0:374:c7cd:8818 with SMTP id ffacd0b85a97d-378a8a7aabemr5126344f8f.22.1726067455981; Wed, 11 Sep 2024 08:10:55 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3511:b0:42c:b606:e7d8 with SMTP id 5b1f17b1804b1-42cce00d937ls3548155e9.1.-pod-prod-00-eu-canary; Wed, 11 Sep 2024 08:10:54 -0700 (PDT) X-Received: by 2002:adf:e5ca:0:b0:374:bf6b:1021 with SMTP id ffacd0b85a97d-378a8aae173mr4203834f8f.27.1726067454549; Wed, 11 Sep 2024 08:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067454; cv=none; d=google.com; s=arc-20160816; b=Z9muH4b8rOP4KHdtOmyhZBG7h2TbXk4GpWbZe2GzX5QAmDGD285fyTLHHYgA5Yfv0m d3sm9/6UWsvIDzOcWKzTx2u9+zsJaT3ExP5XQYa0AzpxcaoiMGZZGRQv8SPPAUbxEAiG 3jB4Ab1G5RE6S5beNjRWx7inV8eTBwWF5yE3cVbqlLK31umX7w2ArYgQpsHn0YGsjpol U6KNc6rmf0MRXXSSrliUllbX7Lf/o/03elBj5sqI70rKDLUGgj01fny8NGE6jE8XxjX8 hlJGsP95ddtUTuv+dDTVQMqirt2L7dHrTstfxFyFpqLEaW2LPM1ryw3e1BlHu+GVJaS9 KkgA== 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:to:from:dkim-signature; bh=a86JFaoQ8c+qIPUXnYmUJIpO5dOSF621iR1yQirrag8=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=0AERm5Ej53RkwSE5uchxUUBDyavAf9cunGq1XdOaaRFspdHvOVEERuOIqrKaoZQD7J rRWX5L41mRB9Ce46e4bxz8I/qctLXfk0AI1ixYH6rkECdee/aWrqDxoeXav5oYwfFdoP TfAGa+/gIJDOBLPa9flte5rwwa2CVbn+6MuPAV7GuL2fSWJT0iOYayoaBMTeGboWiQVV n2X8vBrL28IvrGG/dNuKXoUYKzu0hnXKeZTkxxIKwtfKMIfYN52lJbe2bM+kJ6OlE7Ok VtrX86y59W1+rWGaN9WsqVx4EfaYpZ2tAlCOIvl9D0z2shR0oAhaIf9OJvpTVCNy9LgX erig==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RJRevF2M; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caebae903sor24876775e9.5.2024.09.11.08.10.54 for (Google Transport Security); Wed, 11 Sep 2024 08:10:54 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1da1:b0:42c:b8e5:34d5 with SMTP id 5b1f17b1804b1-42cbde02677mr42968345e9.15.1726067453838; Wed, 11 Sep 2024 08:10:53 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:53 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 14/27] video: Enable DM_UC_FLAG_SEQ_ALIAS for display and bridge Date: Wed, 11 Sep 2024 17:10:26 +0200 Message-ID: <20240911151039.2914886-14-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RJRevF2M; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi To support multiple display or bridge devices, enable the flag, so we can assign the req seq via DTB alias Signed-off-by: Ye Li Signed-off-by: Michael Trimarchi --- drivers/video/bridge/video-bridge-uclass.c | 1 + drivers/video/display-uclass.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index 7432107238cc..5e2b76851fed 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -145,6 +145,7 @@ int video_bridge_set_active(struct udevice *dev, bool active) UCLASS_DRIVER(video_bridge) = { .id = UCLASS_VIDEO_BRIDGE, .name = "video_bridge", + .flags = DM_UC_FLAG_SEQ_ALIAS, .per_device_auto = sizeof(struct video_bridge_priv), .pre_probe = video_bridge_pre_probe, }; diff --git a/drivers/video/display-uclass.c b/drivers/video/display-uclass.c index 61a73e1bc2a6..07f05be7dd17 100644 --- a/drivers/video/display-uclass.c +++ b/drivers/video/display-uclass.c @@ -80,5 +80,6 @@ bool display_in_use(struct udevice *dev) UCLASS_DRIVER(display) = { .id = UCLASS_DISPLAY, .name = "display", + .flags = DM_UC_FLAG_SEQ_ALIAS, .per_device_plat_auto = sizeof(struct display_plat), }; From patchwork Wed Sep 11 15:10:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3445 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 704234354D for ; Wed, 11 Sep 2024 17:10:57 +0200 (CEST) Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-374bb1e931csf550015f8f.0 for ; Wed, 11 Sep 2024 08:10:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067457; cv=pass; d=google.com; s=arc-20240605; b=TUa5+WKcsLaLeLiJ9o1e/SZFXstXryeT1/XjA2/1V6YgSc/yMs5BNa6UnUoX/LJAX8 PmrzclbqnqZnpFAJVeQvJBdzImJFNViY0/RP/CpW5JpqhVzksslejisAhWc7F6k/kkXG ndu7+8mLoFU/KxWKvrFCKhRPBi5BLHqDPzEubA0NaTj9/i2X81OLJAX3z8LjDc+DvRvo EDfYvvhCAA1ndOJVuAXqM17zgnjpNQBXFBYyeNhZv6Nz/Lz+vWhx7DBnFJSppk/cUB6n VldMoiHzKozIDBDnBVk1KHz2uMHgLmYcfHCrJkdiWXt/bD/IQazXpFL3L2UpjKz1Y+JX ufww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=k06/0Ab/FgDmzjsB1xNXwl8FQ2gso+evSdFzyXi39N8=; fh=mFJEKEGp7P0rJtdXaPikBf9TXSAZiee3Xr1Q+dL2tNE=; b=Vt7jtAtceFo447uOirA7ketJDPz0PgbTULbRB+PqXOHxs5XBdaVuPanQ/KOzMB9JyB yV1n0JjovlK1h1InXbw0t8mXCx9eBg8fSToDh97M73blGZxZezFw9OSqFcreAdXagT6I FV5JLvsQPXsiKK5gHpsZA2Minm/UzeVzKdOOnngZU4ggi0eOW1zNZ/iODekfIwCwM9jL 0IRRRk3PolSIz8eIMAjhsKyYE3cmQO16Y39XEELsI7qFzbYTutzS2f3Fa/ZLmGGj/aRh t7HFPXxkTzouNZCTPWKQdfq8lVgGkKgUItvTURvoqbrc4qmzkOWvuUaoP3diOb30OqIY E2MA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A2iFH+hG; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067457; x=1726672257; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=k06/0Ab/FgDmzjsB1xNXwl8FQ2gso+evSdFzyXi39N8=; b=EFV5vVs2Xbh5Zp7RS9pzxcMQ2obKzZt1FlsAhriCecQaMtlVdGRjJRRGbJYCu13CbC b1WHWKmAXOm5rmsQfK4xNw4oy3mi3z3SvOzAqVAVNY1eMc8exK0HWnJW8iTq+puyivFU z9L7pGjoaSIk12WaJdxiRjlMSOa1zyBh6rcCI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067457; x=1726672257; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k06/0Ab/FgDmzjsB1xNXwl8FQ2gso+evSdFzyXi39N8=; b=HhcDlnIBpOAabp1aPW4+sLx11iRpWiGASWpgYrt6cJmmhHi2I5yU0c/K/7GBX6ohDg A5uARqlfabj9472Ej0JZ1bShXG3nlB9QMHpAl49Nzb8tjSTICz/4Y2c2/JuwABTsa6Ea fzOicXhj+F4i67tsn03i/JIEG3wkXiRsAb/ESy1Rj9Urek7o6awR26o1JHtXyM4ujbK7 YqNQg1V0DENA+ct+/aW/QRiitbhYhvy62rqkxZeFXE+OzviSfcLzoVVonWq7vX218Sc0 kP70FsskcZOBipcSoonZ4ClCl+5owEbrlJOZ7BRbIhi39/XBaVuHe+RecIlUqO88Byun AInQ== X-Forwarded-Encrypted: i=2; AJvYcCWjQkFWZGPo9MTxKsB0L/UwgZs/tzwFxSvmmN6Fb+UOKBgwki89Ju/MO9QdTA27N9pboc+kwGV1eEO6Xk1J@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YztIajqm7FfXA5MiKSc1wlgZv5MXm6ROXEsp1LUjapYwelBxi5I cbpZP/EmK4r5CArHKeynbEql59bOnLrfbYuJOG/JY5+nW5D6nYgbV7zijEKXMhRfKw== X-Google-Smtp-Source: AGHT+IH/kwzrOWc+IzTtdVac/MiGOkWIBMPUc+mDNs72kw1cxJMaMhvwWvOizd5LjXDoAkCBUCN2kw== X-Received: by 2002:a5d:4ec9:0:b0:374:c4c2:5ad5 with SMTP id ffacd0b85a97d-378a8a792fcmr4553614f8f.27.1726067457016; Wed, 11 Sep 2024 08:10:57 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:f001:0:b0:374:c124:db78 with SMTP id ffacd0b85a97d-378883bbd01ls1302175f8f.1.-pod-prod-00-eu; Wed, 11 Sep 2024 08:10:56 -0700 (PDT) X-Received: by 2002:adf:f842:0:b0:374:cb84:13d3 with SMTP id ffacd0b85a97d-378a8a1caf9mr4300591f8f.12.1726067455568; Wed, 11 Sep 2024 08:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067455; cv=none; d=google.com; s=arc-20160816; b=wa1g2SGn2o3D7SXAycHaHMFx0yocYgb2jh8M7TUN9act/JZ+SgriojRtw9tF25iC83 6LX5lOoZEJoXIpbVfVWioDU+rIrq+QYQQyvd9GVTB6DWL1xCIIj+rzrBl9IOWhnfv8ZX AGTXVFETr6jmi4t178ivGQzsrwlFn2kUPfjCjcofO+XauJEnJ/kuG8e3g5S5POzKu3jj GpQ7ZErfsZLc5h1o4LzZz76Alo49g/2SBDzWR1Z389nr7zkOl6ZKZFZ3FYmm4aTxSRKG kNONLz+romVSgyS4rof8+2sJFgBpeedQwVfj7d08JGMkDWUbwofHmDKRevyIUH9OlZfY kt4g== 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:to:from:dkim-signature; bh=sva8w17y0XyKKEPL2HBX2MmC5Cmrpq7flOOHEHkSPG0=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=M+lzAiw0o2GbdxXwGyw+idk8doxiKWP36ZGWIiCZXFNQCmHoi2g/QWDA3n1b955trx z+WwW54WQnxvDXSimZs6WUSbfH6zxW96yFFKzHDD7obMG0899bqMdbZ7E0P+Ygw86NT1 KrH24ukjMAh2Ymx59lSQj7Fm7CMt0ppf3OYjAjL3fnz8v1ADAiAn0vu2BxM6E4NDkfOz q7WmcVzxoXVbHsWedk1T6pA90KyFRRISwAEOJYnXzvWqjlpjA6h1nDcZroBhWUp59pkp sNaA55bgzgxhrj3JlOM/TzKRvW+L2D9KjDaEyEofy4Cjy9tzUotR/2n4NuEGXsQgAESa zQbg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A2iFH+hG; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caeb3068dsor24896205e9.2.2024.09.11.08.10.55 for (Google Transport Security); Wed, 11 Sep 2024 08:10:55 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1da1:b0:42c:b8e5:34d5 with SMTP id 5b1f17b1804b1-42cbde02677mr42968645e9.15.1726067454829; Wed, 11 Sep 2024 08:10:54 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:54 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 15/27] phy: dphy: add support to calculate the timing based on hs_clk_rate Date: Wed, 11 Sep 2024 17:10:27 +0200 Message-ID: <20240911151039.2914886-15-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A2iFH+hG; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Upstream Linux commit 22168675bae7. For MIPI-CSI sender use-case it is common to specify the allowed link-frequencies which should be used for the MIPI link and is half the hs-clock rate. This commit adds a helper to calculate the D-PHY timing based on the hs-clock rate so we don't need to calculate the timings within the driver. Signed-off-by: Marco Felsch Acked-by: Vinod Koul Signed-off-by: Sakari Ailus Signed-off-by: Michael Trimarchi --- 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 8fb985a1e682..de467c235266 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 a877ffee845d..1ac128d78dfe 100644 --- a/include/phy-mipi-dphy.h +++ b/include/phy-mipi-dphy.h @@ -279,6 +279,9 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, unsigned int bpp, unsigned int lanes, struct phy_configure_opts_mipi_dphy *cfg); +int phy_mipi_dphy_get_default_config_for_hsclk(unsigned long long hs_clk_rate, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg); int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *cfg); #endif /* __PHY_MIPI_DPHY_H_ */ From patchwork Wed Sep 11 15:10:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3446 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 93BB342E8A for ; Wed, 11 Sep 2024 17:10:58 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cbcf60722sf20886625e9.1 for ; Wed, 11 Sep 2024 08:10:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067458; cv=pass; d=google.com; s=arc-20240605; b=Bz16NkVDj6+6mAYU5KO6idbWe7b2KbylsgNaY0yaEGnXoxwm0MMI9GMOBdi2a6fkAE 8ONBp37IIVF2Ner3TP4Z83Kb6wX4GhTsZZG3Yf5Z1iYoi+GiWZQ3w/LKwpa6w5llg/oH gYaQ5RgWNXvOmOzhOxE/cyyHWLp/iz73KRBoGqtr6yQVLtSEiTupQBOu0vtthmx+M9/Y MLBNS/Pq48PMa9hmA8h70551qxYMx69hg1HcLSp664/Vok1gc/8Oi3OB0qFIJcitwxro KLUit93lp6UD+HtJcXgKf0lRYsWKlJZH+5TpeuOf1UKpSNiKNy+a8GoXYjtf9pBrq4SM wMUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=9ng4CwlxHxc6pwVyN9Fn6m6v+d9l4sL1wbU+U0oV8jY=; fh=mG2YtyIDtaogaGhVi6W8XraYdCUC+3z2eC1KHeb/fxA=; b=VLDGZigmg4hcryl+GBYvHRA8k+KRAGY8LheVzfbKXln/cwK9ANUm8ch8OQeRFTvQcE KWShbwR4XduWEk39Mk1+IjSmEFxIkqXFaekjIujwI0fmtP82hFg0D51BQE+rxJtrGwxg szgbQd9xv+LiB7Xg0jVddYOB6jcZ4IoQ3oloNiFF9mPLW+fHuhICixL5BifmxKfxlk/A W/iN6pZ17vVCGfuhYFuJAv7xrg1qzsoc9I/aZxJ5bcNIT0FiQN63ZBZFO+e0w5b8xeQM LmIOK+OuSpsDJNvS1JiZgX++IerA5/l+xhPKFNp/5+7XbYNnk+33KkUQ/S8Np//iz5t4 1NIA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WARFrEyC; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067458; x=1726672258; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=9ng4CwlxHxc6pwVyN9Fn6m6v+d9l4sL1wbU+U0oV8jY=; b=F9dfcLPYWH9jMqknllzCklxv+awLgeBjIY3/Mtq6GLn60pzsBcHZM+QjGcacSYIusn DFMNU9WkENY7CarsPXnwF8LZbQlYtZiXOINerc7CZ8nsCfdc43a46deL1S7UiFraFcOT XTI7iVJ2aNXDc98ycmbPj1z0UeTKhtwnwycqA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067458; x=1726672258; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9ng4CwlxHxc6pwVyN9Fn6m6v+d9l4sL1wbU+U0oV8jY=; b=RkxqXDnFKuAG4ApgILK5chwiXQEi5U1oBZyZ4GOCeVAAFrUp0+3ARMbgmqMSzofags wS7ECMiiEwISWJggfLFFno/XedbChcRO9wGF7Tj9TyexMjzEpZfvDjRLvZOfRirhCmQe up00dWRRAOheKZiFltKJn3aoB3LKCXvhVP5y11hQiCfxXTsV2Van+v/N7DscPAJbgvte hj9WoYyKVUscy3wdPIesM6TWm0PoPhzqfHEZFbnK/0o96eORxnDzz+h1BpN7PHF1Y5nU A7axxtOua3osw9tPjc93lTsVn9+Pq9NmYpqAbTvRUKXtzXlD+yCTXY2WZj9rvYtpG22P fBFg== X-Forwarded-Encrypted: i=2; AJvYcCXMk9T8GhPp2cVBbU/RhrLwam7FuVZnTWoVRm08BeFa6LIEPxSJOzLizaeIOWvdIgF3OacEKrh83t8dDAGV@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YycWo8LMEuViv2f4v+VXL002rHXWa86ikx90O8Uc6AGywG0IYf7 1gkCDZrLBWw2sReNFESkKX+QQ4Z47pHBWmvaRm9edA2LJuMpDR4fvMKOYw83fT6O3w== X-Google-Smtp-Source: AGHT+IGQLCUJQPMY1eMXw2r15LSPQiLtRdxCkOx/QCvobZVqk1B701Dr5u5wPbllHYgjaynLeZvKvw== X-Received: by 2002:a05:600c:3ca1:b0:42b:8a35:1acf with SMTP id 5b1f17b1804b1-42c9f9ca788mr148108365e9.25.1726067458128; Wed, 11 Sep 2024 08:10:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1c12:b0:42c:af5b:facc with SMTP id 5b1f17b1804b1-42caf5bfd0cls22162425e9.1.-pod-prod-07-eu; Wed, 11 Sep 2024 08:10:56 -0700 (PDT) X-Received: by 2002:a05:600c:4f4e:b0:42c:b4f5:47a9 with SMTP id 5b1f17b1804b1-42cb4f54c54mr100493985e9.14.1726067456474; Wed, 11 Sep 2024 08:10:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067456; cv=none; d=google.com; s=arc-20160816; b=Ojs4Rdq3SwGwNRfYb3e2W1+nwsNbc3gOKESgxy96IcmVKZs0zz9gR6gQQZEkWPrs69 TS3qzwVgh43S058f8zOgaYvQbQvWD297bJN5DmNhyXqAgfd3Sp1Fn/XSPYLT6tP9U+1S wMhiaM3l5ZN/ksYILoouw/sROVTES9ekyJ6/HUe08z2+Y6dKwq48goNHL5Un6H3Y21U6 AWnQNkxKPYr34uyp1XkrL61MJlmWVJxLqSr0vTWFnvkMqHm5i18sMVARPNyRKYb/XowF /tQdTvtteSq6G0LQnR48+kRugZl424DRvJ/ArZDgSVMs7M5P1O6S/N7k7lPyJjvCiNzz g0+A== 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:to:from:dkim-signature; bh=5iW6rpXTdrXWar1+QLqcytSL5S0X3ZyAp83NCIocMAo=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=KKqKX+r2G+/iEJOTncJZpM8YC/5z7jn+2C44RfaURyuWQscUkpcvFFRZTpqdHzZYlK ceupvbein+4Yftf0K+ZN4W3yMdKCzq9h3N3qqwtxxuTfg1bxKDhtHzf+L4Y6TTuIIWO5 b3/9bE0haSogMsmrn9pp2z95olmJLv5L1SO1Rvba4sHNBxXC5tA8/9UFBrgy6Ko7oWUl LWYlRmxY/LiJ5VTlMH2iMJQMQwUKo7IMUIiYmN4G/8z8X7hqYybNgN0kkhwZWTk2aRjW wxQurlbvYKVV9B8DvznK4+wPGhGZKqtjKcDYoHnORxWt6UjB2G0r0rkXhvDn85pAPOYr vjCQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WARFrEyC; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf30aba1sor39619815e9.13.2024.09.11.08.10.56 for (Google Transport Security); Wed, 11 Sep 2024 08:10:56 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1d22:b0:42c:baf9:bee7 with SMTP id 5b1f17b1804b1-42cbaf9c20dmr67893985e9.12.1726067455732; Wed, 11 Sep 2024 08:10:55 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:55 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 16/27] phy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure}) Date: Wed, 11 Sep 2024 17:10:28 +0200 Message-ID: <20240911151039.2914886-16-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WARFrEyC; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Upstream linux commit 3153fa38e38af5. According to the comment of the function phy_mipi_dphy_get_default_config(), it uses minimum D-PHY timings based on MIPI D-PHY specification. They are derived from the valid ranges specified in Section 6.9, Table 14, Page 41 of the D-PHY specification (v1.2). The table 14 explicitly mentions that the minimum T-LPX parameter is 50 nanoseconds and the minimum TA-SURE parameter is T-LPX nanoseconds. Likewise, the kernel doc of the 'lpx' and 'ta_sure' members of struct phy_configure_opts_mipi_dphy mentions that the minimum values are 50000 picoseconds and @lpx picoseconds respectively. Also, the function phy_mipi_dphy_config_validate() checks if cfg->lpx is less than 50000 picoseconds and if cfg->ta_sure is less than cfg->lpx, which hints the same minimum values. Without this patch, the function phy_mipi_dphy_get_default_config() wrongly sets cfg->lpx to 60000 picoseconds and cfg->ta_sure to 2 * cfg->lpx. So, let's correct them to 50000 picoseconds and cfg->lpx respectively. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220216071257.1647703-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Michael Trimarchi --- 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 de467c235266..7a7cc4dc5bdf 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 Wed Sep 11 15:10:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3447 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5675642E8B for ; Wed, 11 Sep 2024 17:10:59 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cb808e9fcsf24006215e9.0 for ; Wed, 11 Sep 2024 08:10:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067459; cv=pass; d=google.com; s=arc-20240605; b=MBcDUJxxggyAb9HHSHGGsZJATUJuNwMF2pBmZn9kL7S/TLP2HrtjXG40Eu6nRHgmcX Oz3x+37I3nxvMh3laQG+EnzjJDoDidkyXb0pWgbc8jouTm/XJK4RTziYP5Kjv99Mjf0l p6sLXKn5E82Qa7PxOjsXTWV2c/DkDc+FzK2mTtskEcSZDN3RG0KG6XOK0jNey0J8++Gi 1n32bZxV+l35cwuPJXNNcLRpp/kSXfAahqQOFUu1R/Dro8B6VQ3uPIwPFMAN/GPPmJlD N01NBheWP5eddnI9VvU3HAURpH/m1fIyeNGFZErBmZrIJ8Gb0VOODrDZdQDpxaIUZJzd LkLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dPn9fUSeLS/3B5nD9h/rslOuEetTp3itjVCqKxFV0Ok=; fh=JArklfTyLEngQIrO0SQsRmRE8EaZdaE+mqUcm41P1po=; b=lE5WvMkIxxGMI3nepGLSBJ8waAYzNL/RPikrGUhGlDyETNaXxeDvA0LqTckrVH6mla Ih5U+zN3xWNVT8mZTKBEYWOgZBj1XDqttWTyTOpPo76jgUmnGJ4fufi3vbfIfKpLsnX6 Dbzen0IWgXBB0L1bcIpPn+hrOVTnO0sgOX+AEE2ki8dTYrJjtrYkD08oCHOkuX9iYbVM dwXk+gUGih3ndGPrNyU8b0EKmNb5e80jDu0zdXBAGAx7/5MTxqYPUAvOmtCQ0DW3r0kU kqRaEVD2KKzTtYYyFc6ZZcoGf/SgqOsINyAnng2i5+09Yg5UDco7PI1q/YykJ+9q+WbR dlGQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=b6HHh7Yf; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067459; x=1726672259; 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:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dPn9fUSeLS/3B5nD9h/rslOuEetTp3itjVCqKxFV0Ok=; b=GxndP8kYwwLbKISw6N6t6BsvZwl49rOiYdV+Ru50Lr2KhtvQs2qMX1e1xwPFsadoJZ PTbKrMuIuilcikf7rWVWyv7Q9HVA6RPSaBkHs4fMc/pbiTuV7RWLSB1dIGBSq+9FI3Ff zVGqjZyA1jnNzqo3Kn6P9l1QYvh7ji+W5d5vc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067459; x=1726672259; 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:to:from:x-beenthere:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dPn9fUSeLS/3B5nD9h/rslOuEetTp3itjVCqKxFV0Ok=; b=nRrulQIVtypNYGC7LsF1lEn+Jd/B32r8QszdF4arRP6JMUx7fsmJvSwaF1i7Y1Bzpj h46DVS2Og/gZgfqmcNUZMCKgILWWjelmX/o6gg4nGeRZ59PVr0Vg2xzGyUMz+Ov13rnG LtFXzeNaQ3R9lwMSnBopWA+Zz305Os6++vUAGHwPafl1tTOFiyAl8OH+xXtt0ZktAtww HfT/UYKHyLgc2/tJ3ZNlNc6PSqGiqBSFlSeS5dka6R1wJu6KV7QR87oq9eTb5iInWvBb NQsUE63WZC1G0c+M8mTg8rmSIXxRylvmRF07r8Z/XmwCTWkGfEa8I1trEjv9JWvLA+z7 y+VA== X-Forwarded-Encrypted: i=2; AJvYcCUP+0uHe8usL/e4fXDIATh1DNoVhjDSoYPMQw7/fKiXH3bEOsOKzH/kxpvw4f4MRc/DHtrnmXh5kighEp3a@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwwjEiK3PGmBqjY8RVki4BLvwBf0hwIpYCIMFr6VeCknrD1OX8C zSTJwqFyduP4dxy/Fb3HrtcgfYCoD/rW/zmYj8WasEdV7foTr7tCwjs/lVv86a3uEg== X-Google-Smtp-Source: AGHT+IErHF87raEs5hXWMuWzDXBIhVgZNAOKxoA7X1Fzlq2LnMEbxVmRaQmpyAuVS+1rFwb9Mrxpuw== X-Received: by 2002:a05:600c:1d13:b0:426:5440:8541 with SMTP id 5b1f17b1804b1-42cae76d033mr97117955e9.27.1726067458901; Wed, 11 Sep 2024 08:10:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:5f82:0:b0:374:ce97:5b7e with SMTP id ffacd0b85a97d-378c1d0c041ls23640f8f.2.-pod-prod-06-eu; Wed, 11 Sep 2024 08:10:57 -0700 (PDT) X-Received: by 2002:a05:6000:2ac:b0:374:c2cf:c01c with SMTP id ffacd0b85a97d-37894a52a4fmr11323452f8f.48.1726067457454; Wed, 11 Sep 2024 08:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067457; cv=none; d=google.com; s=arc-20160816; b=qbOK1JUqHmcnPIc5603aIJ4J9GtMHniM7IQktM4r689x6CGnHs48JPED8trWykS+LB Kn2/CiV5jO1hpmuw4SCGWr6LgYH87p0mYGKS8gdRKLcmJlhYuWZnbv3MEB+00mr88G20 gGIP7+Lvv5t7JB6t5/QI2g2sK9htFoJpUETaja4wFfpUSpxSXOOsjhSGQFfwzA0ExQoX +l/XjVnnuA1KRaVGWVN/CvztSi34NlPoBh4xWJq1C7Bs2ryYmTrJiHS6QGkSo7VkuyEH xTrbafEvPkEVgoykVekB+iLTgChaDbZN1SmeS6Y/+O4R2fUpvyb9lvb/648rcuFQrmxx bGxg== 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:to:from:dkim-signature; bh=sMoy9Seih1wvvH2n9n2dryAliQeG+qx1G+lhic58brk=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=eL02O6LvyI4KKYo5HT+eUWhup8KIZAVybM20CrErA1rk1mCzJ/bg9M3GoYZCkRoTMw AZqw0adyCPy9Oa8+RYVznodCGcdUeIz13yyZzE1zmlo5pTrRDKnbkwEU/6oOqEqknMwT 8IwEpyKDEZspYpzj3Md2BXqCnVgbmvCZQwdoRF/v6rYvAP9ifzXrbytCUghv3oI7T0M4 cptCPbwa6ab/XaKWcJqvvoKex17t2Gb3EYAjMXICPZtQplUg9vspKjLwSHv4NASW94iA rMIoEgDhcWzygivNroY9Fb5rrDmx3HGLQdNq7kt4lQcSyo+tDb0lUOcwJ2jaZ2wOFy09 DWvg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=b6HHh7Yf; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2b16a1sor36292965e9.4.2024.09.11.08.10.57 for (Google Transport Security); Wed, 11 Sep 2024 08:10:57 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1d14:b0:426:63b4:73b0 with SMTP id 5b1f17b1804b1-42cae79d2c2mr109172875e9.34.1726067456621; Wed, 11 Sep 2024 08:10:56 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:56 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 17/27] phy: dphy: Correct clk_pre parameter Date: Wed, 11 Sep 2024 17:10:29 +0200 Message-ID: <20240911151039.2914886-17-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=b6HHh7Yf; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Upstream linux commit 9a8406ba1a9a29. The D-PHY specification (v1.2) explicitly mentions that the T-CLK-PRE parameter's unit is Unit Interval(UI) and the minimum value is 8. Also, kernel doc of the 'clk_pre' member of struct phy_configure_opts_mipi_dphy mentions that it should be in UI. However, the dphy core driver wrongly sets 'clk_pre' to 8000, which seems to hint that it's in picoseconds. So, let's fix the dphy core driver to correctly reflect the T-CLK-PRE parameter's minimum value according to the D-PHY specification. I'm assuming that all impacted custom drivers shall program values in TxByteClkHS cycles into hardware for the T-CLK-PRE parameter. The D-PHY specification mentions that the frequency of TxByteClkHS is exactly 1/8 the High-Speed(HS) bit rate(each HS bit consumes one UI). So, relevant custom driver code is changed to program those values as DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE), then. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Tested-by: Liu Ying # RM67191 DSI panel on i.MX8mq EVK Reviewed-by: Andrzej Hajda Reviewed-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Guido Günther # Librem 5 (imx8mq) with it's rather picky panel Reviewed-by: Laurent Pinchart Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220124024007.1465018-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Michael Trimarchi --- drivers/phy/meson-axg-mipi-dphy.c | 2 +- drivers/phy/phy-core-mipi-dphy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/meson-axg-mipi-dphy.c b/drivers/phy/meson-axg-mipi-dphy.c index 3f89de19970b..fb10ccca6ac1 100644 --- a/drivers/phy/meson-axg-mipi-dphy.c +++ b/drivers/phy/meson-axg-mipi-dphy.c @@ -237,7 +237,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy) (DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) | (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24)); regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1, - DIV_ROUND_UP(priv->config.clk_pre, temp)); + DIV_ROUND_UP(priv->config.clk_pre, BITS_PER_BYTE)); regmap_write(priv->regmap, MIPI_DSI_HS_TIM, DIV_ROUND_UP(priv->config.hs_exit, temp) | diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 7a7cc4dc5bdf..8341b78e0dd8 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 Wed Sep 11 15:10:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3448 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1D1864355B for ; Wed, 11 Sep 2024 17:11:00 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-378929f1a4esf2248971f8f.1 for ; Wed, 11 Sep 2024 08:11:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067460; cv=pass; d=google.com; s=arc-20240605; b=fyjRPTDiuOw3HGkJGSRhr335ujeAhKYR9lFUwZiGrnS2rJG+4Sz6dsak3egymhPjeZ mMf7bVZ5CJHxYIWoxGYr1K+BtESNrEsp6VJRpBFe5wmJ1QpVX343say/HTgVV53PXhaG yS+Tp11J+m+QYK0uGgoErnbcy8PctNwK9xxjAqfu1Zd0r8BMOgIIBUSg7SP6MeWm9Xyy 7jssQ9ciwiW2u0FcyKSO3UDy7j5c5iuHfjawIavVsrHAOgPXx9WObr/GHWdGSNWhZY+g X9nTt9ij+LHgH+6t3/zKb+VvPCouykUAwMPieus6SScd7gZy6b15MXEPfGTj6pxeV6Sr y+5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=+PjFIaIwye3hiWKqNtFxvxOu+c5W414KF3J2fkwTkrA=; fh=L8oLKBqEXjJrCbiSC0ZfbcYnhmjV1gdtR7i8lnNY1Qs=; b=lxULrjm9MnR2L0FlcVg4naxplYP9dmKwMVsOXS+afrjnDmdx7Yfo3z7pAcywm1WNJR rUnmd4xSddLlnEoD/GyEtyyJ5V3QaXFP7FGz2BCw9zH03JaWZ6yWdaqdWibsglZAVbBN J8eKjHAVwSe/Vujww26J4tH2C7mlisVaVQwyUMIkKsmWr5eKN5d83j6JJQ7J7cFhsJ40 GrUpDLWiOegFAitAuf93VHfb9e/LnlkJwYnjbWy3t/WKA5PkOahCyA69A7LEmoVoEaot g7pxmwpFG5+y9AWPHluz0/RbodXa5tWBYm9SphF7IeDeTxBR4L+W38II17FQVA/ODebV ZiBA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=efPvNUfW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067460; x=1726672260; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=+PjFIaIwye3hiWKqNtFxvxOu+c5W414KF3J2fkwTkrA=; b=b4lsLTBIIY58zT/b7rDvV9Y43vTUyDlRNi+S61xUgqvgYVULnk59TloIr6c0Cui6ya i5lJSx5T19hx0hrPuWYHqJCtw+K8zaXwpNkXXaUYhN8+vA5T3g1+Sap2RPdsFsrE7AHz 0SEhNPzKuy6OA/J0nI1jmOUGqcCAmOWlyMd4Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067460; x=1726672260; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+PjFIaIwye3hiWKqNtFxvxOu+c5W414KF3J2fkwTkrA=; b=YwBH1qH0vq76iw+8Uh4QpwrXbhI2Wjz8dA4CXqphyrsNd9+0yNQmNij+K2YYsTFKUF G4b7jnWcZLSudl18986dqVh197RHH4qNAxnBgR4p+OJZA4IaYXKgmB44W8IErJaS1MSr VFAzSl8DJvjWJswX29CoTCs5nbvG3aa/atkg+BoZU8yC1m0OF1vwxJS7Hi6PfncVPfoN R+6xX8klZcmV5w/Lmp+ldJSqHHeASkiJyKjel1QlqKw1+RDlOFamtE7IgH684FKDafSx 4GRXPu6fYz0kFpjTKwuwkuKADWGiFSj1iFo3UZ4PPoz+BAWKwa/qrZPAPoUzrbbmeWWS XWiQ== X-Forwarded-Encrypted: i=2; AJvYcCVF9Q2+fWKJGsaiWK2koH8PmBioQCDSUg9CMxGWRqOPSKPfAX3NkgA2uD/rL7KfekcDMOrTIT9bjSA117PS@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yygx6KNzPdws1xlzu+8ij2e4/kJe6UkyrQ/OFVaPS73WitqwLCo BVy6xvrDehE3BuvjR9RIWUra4G28OaF5F7/fYGcYWIbyJC9TCgx9oXXwIy1bS1OR+g== X-Google-Smtp-Source: AGHT+IHcaRF8oEuooq3+AtFQ5Y2vJofBy+a0nUa974zOzqxMqdozMQBRxejqCkPGnFEJO1+d/MkEUQ== X-Received: by 2002:a5d:5d82:0:b0:378:90fe:f753 with SMTP id ffacd0b85a97d-37890fef859mr9114302f8f.28.1726067459672; Wed, 11 Sep 2024 08:10:59 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1caa:b0:42c:c82f:e5b with SMTP id 5b1f17b1804b1-42cc82f10ddls7954745e9.2.-pod-prod-09-eu; Wed, 11 Sep 2024 08:10:58 -0700 (PDT) X-Received: by 2002:a05:600c:5248:b0:42c:b23f:7ba5 with SMTP id 5b1f17b1804b1-42cb23f7d26mr116925675e9.10.1726067458184; Wed, 11 Sep 2024 08:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067458; cv=none; d=google.com; s=arc-20160816; b=gqyhKL98GVUc61hIEceuh6G3CxGqBIkjrYmjGE0xvfOgThY//73L2tdNrgIaeK28XJ PP07cjXQcnfnpJbSoywte2RaBofoaKmy3GnkO3NzZOlunflUPtjsPrU3XbkwsnVgARUo Jrqoqbj2qcGBnoDCqkx/X9rtJw7vxUmm5SetuuRLygdco46/K0eIWM3Uj0ou5bqVpBCt spk/woNfcwbp2xuiA+uvoGmRczPCd13bGpHBDzWe+WjxMNn8RCT+NV7ZN865iSuF5cEX hASYLTaxOki+tYKuWSkgY/rvjTV9kJN+JSzYGMFCsOBFmNeNIHd+W0kdQsbZme9k08En mC9g== 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:to:from:dkim-signature; bh=XzvabhpATxW1DmCBaEyNON19zj4DFTmPK3v1IpWaSMA=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=Hf1bku91XqoS9l++uk9kdWtIgotK/Ddw1HIUu8lRLoQJgFeOAGo+rJcpQL0AHahqcw 7gb60Jq6KGMvTNf6P5n9mcLixr+QweENqMDXvHYSSXNYMROBmVlCGwbs/cWXp92EHluB CsC+8JKzHmCuFIwIUdf6gkIpAemBHZ9mukeJqdO9qsFZDuggKrcWkdmvnSpX50Of/Rbl n/9M4ocPgtNFguwViIjhQR9CbZaTSP8UfhxWD2RBe1cPGXqZuOQncIVnTYV7B82PMB3w UXQ2eD0Ho2CEKhZPb25mlTMEqVs0G3gxDMVVqiowFisTP2rwPM1XbhAwBCkBqFrNOd2Q N9DA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=efPvNUfW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2ab4d6sor39547535e9.2.2024.09.11.08.10.58 for (Google Transport Security); Wed, 11 Sep 2024 08:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:3b1d:b0:42c:b750:1a1e with SMTP id 5b1f17b1804b1-42cb7501dc3mr89469495e9.0.1726067457374; Wed, 11 Sep 2024 08:10:57 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:57 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 18/27] lib: div64: sync with Linux Date: Wed, 11 Sep 2024 17:10:30 +0200 Message-ID: <20240911151039.2914886-18-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=efPvNUfW; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Sync with Linux commit fc4a0db4149af ("Merge tag '6.5'"). Signed-off-by: Michael Trimarchi --- include/linux/math64.h | 110 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/include/linux/math64.h b/include/linux/math64.h index eaa9fd5b9685..0e684bb2beef 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 Wed Sep 11 15:10:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3449 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B0DAF3F251 for ; Wed, 11 Sep 2024 17:11:02 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cb080ab53sf29911255e9.0 for ; Wed, 11 Sep 2024 08:11:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067462; cv=pass; d=google.com; s=arc-20240605; b=TTrBNPiaAE1oGkI455/0fuiQSajnHSws5h8cDw1JPtFLrmt6aMofasr2fCWt9nA6nr dQsrx69C/AClmflK4HjYf6tW8pTNtjxlZJzhftaPmPbyJRqFK1ba4JXZjPlLx59dKAvc KHjQrsSl1pp1mrWQZhtriNLZYUAjehbkKSet15jOvm0veZaeMx+/OSfUp4Ykxj1IiBPo Ry/m95/tZxiXNoX1LWOudoBA5drP6h/JZG+zcYq9y3mIpxFBKF4BuCAI7oRoGp14uJhc yMTjiX6tbYKR+9cu9mdmW2uOLRsBtmb6jaXWpN8zb1sY3K7yqa9lTbEEi7t9bUmPBEeQ 0Dew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=U44OoUX1WXeVoMOXudjxa228T8igW8a/MPqkj3xR+hc=; fh=VGlmo8EiWEw75V2+PH3tPmniyZ5yx3M2MniaVEqve8s=; b=NWf+nluiw6HfGztGu7FW4LuslYR+S+cEojm3ITpzVozYi4+agtviouk88JuGHsmcCD Act0DlZfn+zODwANuMJBrfvKRH/hNV5gXZ6cJay9QkS1TORx5ATseoVwoh041g5lbijK P9lKLwWr9RBMwnqIKqyKtaIsb4Tyr3U41HBCs7a/R94RshJ/sDvfQ85Dt2BvjkjbxFMM +cFezKbMc4dCofv/C9JBau6TcAVGdHv69L1RvZUIjoRGYCUdZHH/7e0PgRRsv4QG6t6B 1jh5QHrZAC8JVANkYwCGuzjwz6R6hmozAB+Z4ZztirUzwKTMtk55ZO9IGPaikErR2B53 t5VA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="k1Y/WdO1"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067462; x=1726672262; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=U44OoUX1WXeVoMOXudjxa228T8igW8a/MPqkj3xR+hc=; b=UP6/guMYwk2pmyo460V567zdOJGwlt6Erk4l0JVhS03AWW3g7U7wmy5nYvVAyWCJ34 ZMYyHxV5df5grwWdAfl8DRV62Tb//kl+9iUKG6AQ3DZvdheitAbDLNyIcPY0iTkgIhp7 FAqqz+7BrA1zI/fHfIDSPZuO2GoActj9PnfBU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067462; x=1726672262; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U44OoUX1WXeVoMOXudjxa228T8igW8a/MPqkj3xR+hc=; b=n9YrnGSU3tNPn/zsZRqspYpku+q52hKC9ifhF/6GeLvZGn7T4BlmLFcaQkCd2/MvSy z15XXEbXNCkJ0ifYGsyI/7suOMTqfhi5egNNn0nVADjUj4WlvW4/WeGqv7XemzMgldD+ Xjttv6kIWDaJQF3AEfzCip2sKq9bmr7g+2CFzUJVzIK9D+BZ2o0uWuL1z42hCjw9efNj vBlGXj8akpG9rkAKvaROwrqZFvC6viybKlHl9Pj/WB9E40ALrTtVp5k3DdHaSQDRQsG6 XBM4U+G+lT+w5AxRDBJ0RWQlhEyFsSx+KvQfLOEhFBLkF8jYaot3nN5S9qA8GfmgSfjJ eMxw== X-Forwarded-Encrypted: i=2; AJvYcCWZ38VCdkbKj3fcyt/MAIyDxyh8dZT2ZJqRfItMG30glj1VLQr/QN5kf3ibvYJ97vFVHA/D6QQ6Vbo8Qc7q@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzEQ8FUlvse5ZqLmoTqCuTtKVhHUnyTNBe6s0jmoux1ibq5BRZW UJhr95NnRGez18YekBDk+OnPGu3lp6mbNyKY+vk/z1viD4VbigRbUMgKw8mj9ng9kA== X-Google-Smtp-Source: AGHT+IFv3rCYgFYFYageXjYz5xpEvyHkFeSib2TWseLCjeenYI3lDTUD/hK7WBN1QfxSlAAkoxQFPw== X-Received: by 2002:a05:600c:3b9a:b0:42c:af06:718 with SMTP id 5b1f17b1804b1-42caf060aa3mr102593095e9.28.1726067462303; Wed, 11 Sep 2024 08:11:02 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:f411:0:b0:368:4489:3f45 with SMTP id ffacd0b85a97d-378883d0021ls1287141f8f.2.-pod-prod-01-eu; Wed, 11 Sep 2024 08:11:01 -0700 (PDT) X-Received: by 2002:a05:6000:b48:b0:374:c3a3:1f4f with SMTP id ffacd0b85a97d-378895d6dc0mr11197068f8f.24.1726067460728; Wed, 11 Sep 2024 08:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067460; cv=none; d=google.com; s=arc-20160816; b=j6UnG5ktFtJF23aPMUbxssI02s+P0GnUxy/Ghi+NLFngO73wZqSXKY32jPX9tAI9dp 8bknJQwTLm9n1h9q35iupBS1o0UJdRRER3Mrx3IaqMybwpMejWM5Gm8rptbJIRoWcDpT D4FGZEX6Q8WPfj29Sr6h7FkwZG2XrKTLs20x5hHU8geiUeFwmdWxy8Zgog5//rSheIOo P7Yd4QpZ//Ad9nfBvztj6J48CEmizP5UhYOilWsg3t1tAgCzlucRks+OwkYgdRZ4Acw2 Qba6yRAUzk2uEyp89zrgrWZWzLIrEE/S/AY0Xaurex9wj7pcS47UwuEFc72ghUg9+rSn 4l8Q== 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:to:from:dkim-signature; bh=Gkf26pevCqGkNJhWgB1W6hYVu+XfMNJhZSG9WHgHL7M=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=CJmbToD9TlGgdSu1O3b1ro/Qs2WFH8snEk98lay/V6MRRp467MCSlJGbtQI7ZMWL0o a/HxJA0jnZKhEWceojaUruWuTi4xeWQv0HxN96TORnFB+KtiHCSYQQqKqZhiGcu8sWX0 Xsxj6+PP7qalAa5DmfCCvfTwsrxi60Dpwc6GMboFqd9oQAFuYWUNhMvkKuzTjnfeGiSS 0J07Zv+YO3N69wGqyV4Rkx8ZC2+GMS5L8d9lsz6vkhtJLUQmB8BeHwnhVL8Wp/423fJF Bq9mE05mz45zhHPydSF7d7HWqd8fHTZmrxJsDEulDEQiSJWkiB/uZJr98Z3+pAINYjVM wnZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="k1Y/WdO1"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-378956caf78sor2510700f8f.9.2024.09.11.08.11.00 for (Google Transport Security); Wed, 11 Sep 2024 08:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a5d:6608:0:b0:375:b52:7d75 with SMTP id ffacd0b85a97d-3788968c671mr11543662f8f.53.1726067459095; Wed, 11 Sep 2024 08:10:59 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:58 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 19/27] video: bridge: Add Samsung DSIM bridge Date: Wed, 11 Sep 2024 17:10:31 +0200 Message-ID: <20240911151039.2914886-19-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="k1Y/WdO1"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Samsung MIPI DSIM controller is common DSI IP that can be used in various SoCs like Exynos, i.MX8M Mini/Nano. In order to access this DSI controller between various platform SoCs, the ideal way to incorporate this in the as a bridge that can support all different platform. Signed-off-by: Michael Trimarchi --- drivers/video/bridge/Kconfig | 13 + drivers/video/bridge/Makefile | 1 + drivers/video/bridge/samsung-dsi-host.c | 1567 +++++++++++++++++++++++ drivers/video/bridge/samsung-dsim.c | 148 +++ drivers/video/bridge/samsung-dsim.h | 20 + 5 files changed, 1749 insertions(+) create mode 100644 drivers/video/bridge/samsung-dsi-host.c create mode 100644 drivers/video/bridge/samsung-dsim.c create mode 100644 drivers/video/bridge/samsung-dsim.h diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig index ab9172737201..5cb1e7af9935 100644 --- a/drivers/video/bridge/Kconfig +++ b/drivers/video/bridge/Kconfig @@ -44,6 +44,19 @@ config VIDEO_BRIDGE_ANALOGIX_ANX6345 The Analogix ANX6345 is RGB-to-DP converter. It enables an eDP LCD panel to be connected to an parallel LCD interface. +config VIDEO_BRIDGE_SAMSUNG_DSIM + bool "Enable IMX SEC DSI video support" + select MIPI_DPHY_HELPERS + select VIDEO_BRIDGE + select VIDEO_LINK + select VIDEO_MIPI_DSI + help + Enables the common driver code for the Samsung + MIPI DSI block found in SoCs from various vendors. + As this does not provide any functionality by itself (but + rather requires a SoC-specific glue driver to call it), it + can not be enabled from the configuration menu. + config VIDEO_BRIDGE_SOLOMON_SSD2825 bool "Solomon SSD2825 bridge driver" depends on PANEL && DM_GPIO diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile index 58697e3cbe90..8f49013299ae 100644 --- a/drivers/video/bridge/Makefile +++ b/drivers/video/bridge/Makefile @@ -8,5 +8,6 @@ obj-$(CONFIG_VIDEO_BRIDGE_PARADE_DP501) += dp501.o obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o +obj-$(CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM) += samsung-dsim.o samsung-dsi-host.o obj-$(CONFIG_VIDEO_BRIDGE_SOLOMON_SSD2825) += ssd2825.o obj-$(CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768) += tc358768.o diff --git a/drivers/video/bridge/samsung-dsi-host.c b/drivers/video/bridge/samsung-dsi-host.c new file mode 100644 index 000000000000..dd3e33c4edc7 --- /dev/null +++ b/drivers/video/bridge/samsung-dsi-host.c @@ -0,0 +1,1567 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2018 NXP + * + */ + +#define LOG_CATEGORY UCLASS_DSI_HOST + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "samsung-dsim.h" + +#define MIPI_FIFO_TIMEOUT 250000 /* 250ms */ + +#define DRIVER_NAME "samsung_dsi" + +/* reg bit manipulation */ +#define REG_MASK(e, s) (((1 << ((e) - (s) + 1)) - 1) << (s)) +#define REG_PUT(x, e, s) (((x) << (s)) & REG_MASK(e, s)) +#define REG_GET(x, e, s) (((x) & REG_MASK(e, s)) >> (s)) + +#define RGB_STATUS_CMDMODE_INSEL BIT(31) +#define RGB_STATUS_GET_RGBSTATE(x) REG_GET(x, 12, 0) + +#define CLKCTRL_DPHY_SEL_1P5G (0x0 << 29) +#define CLKCTRL_PLLBYPASS BIT(29) +#define CLKCTRL_BYTECLKSRC_DPHY_PLL REG_PUT(0, 26, 25) +#define CLKCTRL_SET_LANEESCCLKEN(x) REG_PUT(x, 23, 19) +#define CLKCTRL_SET_ESCPRESCALER(x) REG_PUT(x, 15, 0) + +#define ESCMODE_SET_STOPSTATE_CNT(X) REG_PUT(x, 31, 21) +#define ESCMODE_FORCESTOPSTATE BIT(20) +#define ESCMODE_FORCEBTA BIT(16) +#define ESCMODE_CMDLPDT BIT(7) +#define ESCMODE_TXLPDT BIT(6) +#define ESCMODE_TXTRIGGERRST BIT(5) + +#define MVPORCH_SET_CMDALLOW(x) REG_PUT(x, 31, 28) +#define MVPORCH_SET_STABLEVFP(x) REG_PUT(x, 26, 16) +#define MVPORCH_SET_MAINVBP(x) REG_PUT(x, 10, 0) + +#define MHPORCH_SET_MAINHFP(x) REG_PUT(x, 31, 16) +#define MHPORCH_SET_MAINHBP(x) REG_PUT(x, 15, 0) + +#define MSYNC_SET_MAINVSA(x) REG_PUT(x, 31, 22) +#define MSYNC_SET_MAINHSA(x) REG_PUT(x, 15, 0) + +#define INTSRC_PLLSTABLE BIT(31) +#define INTSRC_SWRSTRELEASE BIT(30) +#define INTSRC_SFRPLFIFOEMPTY BIT(29) +#define INTSRC_SFRPHFIFOEMPTY BIT(28) +#define INTSRC_FRAMEDONE BIT(24) +#define INTSRC_LPDRTOUT BIT(21) +#define INTSRC_TATOUT BIT(20) +#define INTSRC_RXDATDONE BIT(18) +#define INTSRC_MASK (INTSRC_PLLSTABLE | \ + INTSRC_SWRSTRELEASE | \ + INTSRC_SFRPLFIFOEMPTY | \ + INTSRC_SFRPHFIFOEMPTY | \ + INTSRC_FRAMEDONE | \ + INTSRC_LPDRTOUT | \ + INTSRC_TATOUT | \ + INTSRC_RXDATDONE) + +#define INTMSK_MSKPLLSTABLE BIT(31) +#define INTMSK_MSKSWRELEASE BIT(30) +#define INTMSK_MSKSFRPLFIFOEMPTY BIT(29) +#define INTMSK_MSKSFRPHFIFOEMPTY BIT(28) +#define INTMSK_MSKFRAMEDONE BIT(24) +#define INTMSK_MSKLPDRTOUT BIT(21) +#define INTMSK_MSKTATOUT BIT(20) +#define INTMSK_MSKRXDATDONE BIT(18) + +#define PKTHDR_SET_DATA1(x) REG_PUT(x, 23, 16) +#define PKTHDR_GET_DATA1(x) REG_GET(x, 23, 16) +#define PKTHDR_SET_DATA0(x) REG_PUT(x, 15, 8) +#define PKTHDR_GET_DATA0(x) REG_GET(x, 15, 8) +#define PKTHDR_GET_WC(x) REG_GET(x, 23, 8) +#define PKTHDR_SET_DI(x) REG_PUT(x, 7, 0) +#define PKTHDR_GET_DI(x) REG_GET(x, 7, 0) +#define PKTHDR_SET_DT(x) REG_PUT(x, 5, 0) +#define PKTHDR_GET_DT(x) REG_GET(x, 5, 0) +#define PKTHDR_SET_VC(x) REG_PUT(x, 7, 6) +#define PKTHDR_GET_VC(x) REG_GET(x, 7, 6) + +#define FIFOCTRL_FULLRX BIT(25) +#define FIFOCTRL_EMPTYRX BIT(24) +#define FIFOCTRL_FULLHSFR BIT(23) +#define FIFOCTRL_EMPTYHSFR BIT(22) +#define FIFOCTRL_FULLLSFR BIT(21) +#define FIFOCTRL_EMPTYLSFR BIT(20) +#define FIFOCTRL_FULLHMAIN BIT(11) +#define FIFOCTRL_EMPTYHMAIN BIT(10) +#define FIFOCTRL_FULLLMAIN BIT(9) +#define FIFOCTRL_EMPTYLMAIN BIT(8) +#define FIFOCTRL_NINITRX BIT(4) +#define FIFOCTRL_NINITSFR BIT(3) +#define FIFOCTRL_NINITI80 BIT(2) +#define FIFOCTRL_NINITSUB BIT(1) +#define FIFOCTRL_NINITMAIN BIT(0) + +#define PLLCTRL_DPDNSWAP_CLK BIT(25) +#define PLLCTRL_DPDNSWAP_DAT BIT(24) +#define PLLCTRL_PLLEN BIT(23) +#define PLLCTRL_SET_PMS(x) REG_PUT(x, 19, 1) +#define PLLCTRL_SET_P(x) REG_PUT(x, 18, 13) +#define PLLCTRL_SET_M(x) REG_PUT(x, 12, 3) +#define PLLCTRL_SET_S(x) REG_PUT(x, 2, 0) + +#define MAX_MAIN_HRESOL 2047 +#define MAX_MAIN_VRESOL 2047 +#define MAX_SUB_HRESOL 1024 +#define MAX_SUB_VRESOL 1024 + +/* in KHZ */ +#define MAX_ESC_CLK_FREQ 20000 + +/* dsim all irqs index */ +#define PLLSTABLE 1 +#define SWRSTRELEASE 2 +#define SFRPLFIFOEMPTY 3 +#define SFRPHFIFOEMPTY 4 +#define SYNCOVERRIDE 5 +#define BUSTURNOVER 6 +#define FRAMEDONE 7 +#define LPDRTOUT 8 +#define TATOUT 9 +#define RXDATDONE 10 +#define RXTE 11 +#define RXACK 12 +#define ERRRXECC 13 +#define ERRRXCRC 14 +#define ERRESC3 15 +#define ERRESC2 16 +#define ERRESC1 17 +#define ERRESC0 18 +#define ERRSYNC3 19 +#define ERRSYNC2 20 +#define ERRSYNC1 21 +#define ERRSYNC0 22 +#define ERRCONTROL3 23 +#define ERRCONTROL2 24 +#define ERRCONTROL1 25 +#define ERRCONTROL0 26 + +#define PS_TO_CYCLE(ps, hz) DIV64_U64_ROUND_CLOSEST(((ps) * (hz)), 1000000000000ULL) + +#define MIPI_HFP_PKT_OVERHEAD 6 +#define MIPI_HBP_PKT_OVERHEAD 6 +#define MIPI_HSA_PKT_OVERHEAD 6 + +/* DSIM_STATUS */ +#define DSIM_STOP_STATE_DAT(x) (((x) & 0xf) << 0) +#define DSIM_STOP_STATE_CLK BIT(8) +#define DSIM_TX_READY_HS_CLK BIT(10) +#define DSIM_PLL_STABLE BIT(31) + +/* DSIM_SWRST */ +#define DSIM_FUNCRST BIT(16) +#define DSIM_SWRST BIT(0) + +/* DSIM_TIMEOUT */ +#define DSIM_LPDR_TIMEOUT(x) ((x) << 0) +#define DSIM_BTA_TIMEOUT(x) ((x) << 16) + +/* DSIM_CLKCTRL */ +#define DSIM_ESC_PRESCALER(x) (((x) & 0xffff) << 0) +#define DSIM_ESC_PRESCALER_MASK (0xffff << 0) +#define DSIM_LANE_ESC_CLK_EN_CLK BIT(19) +#define DSIM_LANE_ESC_CLK_EN_DATA(x) (((x) & 0xf) << 20) +#define DSIM_LANE_ESC_CLK_EN_DATA_MASK (0xf << 20) +#define DSIM_BYTE_CLKEN BIT(24) +#define DSIM_BYTE_CLK_SRC(x) (((x) & 0x3) << 25) +#define DSIM_BYTE_CLK_SRC_MASK (0x3 << 25) +#define DSIM_PLL_BYPASS BIT(27) +#define DSIM_ESC_CLKEN BIT(28) +#define DSIM_TX_REQUEST_HSCLK BIT(31) + +/* DSIM_CONFIG */ +#define DSIM_LANE_EN_CLK BIT(0) +#define DSIM_LANE_EN(x) (((x) & 0xf) << 1) +#define DSIM_NUM_OF_DATA_LANE(x) (((x) & 0x3) << 5) +#define DSIM_SUB_PIX_FORMAT(x) (((x) & 0x7) << 8) +#define DSIM_MAIN_PIX_FORMAT_MASK (0x7 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB888 (0x7 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB666 (0x6 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB666_P (0x5 << 12) +#define DSIM_MAIN_PIX_FORMAT_RGB565 (0x4 << 12) +#define DSIM_SUB_VC(x) (((x) & 0x3) << 16) +#define DSIM_MAIN_VC(x) (((x) & 0x3) << 18) +#define DSIM_HSA_DISABLE_MODE BIT(20) +#define DSIM_HBP_DISABLE_MODE BIT(21) +#define DSIM_HFP_DISABLE_MODE BIT(22) +/* + * The i.MX 8M Mini Applications Processor Reference Manual, + * Rev. 3, 11/2020 Page 4091 + * The i.MX 8M Nano Applications Processor Reference Manual, + * Rev. 2, 07/2022 Page 3058 + * The i.MX 8M Plus Applications Processor Reference Manual, + * Rev. 1, 06/2021 Page 5436 + * all claims this bit is 'HseDisableMode' with the definition + * 0 = Disables transfer + * 1 = Enables transfer + * + * This clearly states that HSE is not a disabled bit. + * + * The naming convention follows as per the manual and the + * driver logic is based on the MIPI_DSI_MODE_VIDEO_HSE flag. + */ +#define DSIM_HSE_DISABLE_MODE BIT(23) +#define DSIM_AUTO_MODE BIT(24) +#define DSIM_VIDEO_MODE BIT(25) +#define DSIM_BURST_MODE BIT(26) +#define DSIM_SYNC_INFORM BIT(27) +#define DSIM_EOT_DISABLE BIT(28) +#define DSIM_MFLUSH_VS BIT(29) +/* This flag is valid only for exynos3250/3472/5260/5430 */ +#define DSIM_CLKLANE_STOP BIT(30) +#define DSIM_NON_CONTINUOUS_CLKLANE BIT(31) + +/* DSIM_ESCMODE */ +#define DSIM_TX_TRIGGER_RST BIT(4) +#define DSIM_TX_LPDT_LP BIT(6) +#define DSIM_CMD_LPDT_LP BIT(7) +#define DSIM_FORCE_BTA BIT(16) +#define DSIM_FORCE_STOP_STATE BIT(20) +#define DSIM_STOP_STATE_CNT(x) (((x) & 0x7ff) << 21) +#define DSIM_STOP_STATE_CNT_MASK (0x7ff << 21) + +/* DSIM_MDRESOL */ +#define DSIM_MAIN_STAND_BY BIT(31) +#define DSIM_MAIN_VRESOL(x, num_bits) (((x) & ((1 << (num_bits)) - 1)) << 16) +#define DSIM_MAIN_HRESOL(x, num_bits) (((x) & ((1 << (num_bits)) - 1)) << 0) + +/* DSIM_MVPORCH */ +#define DSIM_CMD_ALLOW(x) ((x) << 28) +#define DSIM_STABLE_VFP(x) ((x) << 16) +#define DSIM_MAIN_VBP(x) ((x) << 0) +#define DSIM_CMD_ALLOW_MASK (0xf << 28) +#define DSIM_STABLE_VFP_MASK (0x7ff << 16) +#define DSIM_MAIN_VBP_MASK (0x7ff << 0) + +/* DSIM_MHPORCH */ +#define DSIM_MAIN_HFP(x) ((x) << 16) +#define DSIM_MAIN_HBP(x) ((x) << 0) +#define DSIM_MAIN_HFP_MASK ((0xffff) << 16) +#define DSIM_MAIN_HBP_MASK ((0xffff) << 0) + +/* DSIM_MSYNC */ +#define DSIM_MAIN_VSA(x) ((x) << 22) +#define DSIM_MAIN_HSA(x) ((x) << 0) +#define DSIM_MAIN_VSA_MASK ((0x3ff) << 22) +#define DSIM_MAIN_HSA_MASK ((0xffff) << 0) + +/* DSIM_SDRESOL */ +#define DSIM_SUB_STANDY(x) ((x) << 31) +#define DSIM_SUB_VRESOL(x) ((x) << 16) +#define DSIM_SUB_HRESOL(x) ((x) << 0) +#define DSIM_SUB_STANDY_MASK ((0x1) << 31) +#define DSIM_SUB_VRESOL_MASK ((0x7ff) << 16) +#define DSIM_SUB_HRESOL_MASK ((0x7ff) << 0) + +/* DSIM_INTSRC */ +#define DSIM_INT_PLL_STABLE BIT(31) +#define DSIM_INT_SW_RST_RELEASE BIT(30) +#define DSIM_INT_SFR_FIFO_EMPTY BIT(29) +#define DSIM_INT_SFR_HDR_FIFO_EMPTY BIT(28) +#define DSIM_INT_BTA BIT(25) +#define DSIM_INT_FRAME_DONE BIT(24) +#define DSIM_INT_RX_TIMEOUT BIT(21) +#define DSIM_INT_BTA_TIMEOUT BIT(20) +#define DSIM_INT_RX_DONE BIT(18) +#define DSIM_INT_RX_TE BIT(17) +#define DSIM_INT_RX_ACK BIT(16) +#define DSIM_INT_RX_ECC_ERR BIT(15) +#define DSIM_INT_RX_CRC_ERR BIT(14) + +/* DSIM_FIFOCTRL */ +#define DSIM_RX_DATA_FULL BIT(25) +#define DSIM_RX_DATA_EMPTY BIT(24) +#define DSIM_SFR_HEADER_FULL BIT(23) +#define DSIM_SFR_HEADER_EMPTY BIT(22) +#define DSIM_SFR_PAYLOAD_FULL BIT(21) +#define DSIM_SFR_PAYLOAD_EMPTY BIT(20) +#define DSIM_I80_HEADER_FULL BIT(19) +#define DSIM_I80_HEADER_EMPTY BIT(18) +#define DSIM_I80_PAYLOAD_FULL BIT(17) +#define DSIM_I80_PAYLOAD_EMPTY BIT(16) +#define DSIM_SD_HEADER_FULL BIT(15) +#define DSIM_SD_HEADER_EMPTY BIT(14) +#define DSIM_SD_PAYLOAD_FULL BIT(13) +#define DSIM_SD_PAYLOAD_EMPTY BIT(12) +#define DSIM_MD_HEADER_FULL BIT(11) +#define DSIM_MD_HEADER_EMPTY BIT(10) +#define DSIM_MD_PAYLOAD_FULL BIT(9) +#define DSIM_MD_PAYLOAD_EMPTY BIT(8) +#define DSIM_RX_FIFO BIT(4) +#define DSIM_SFR_FIFO BIT(3) +#define DSIM_I80_FIFO BIT(2) +#define DSIM_SD_FIFO BIT(1) +#define DSIM_MD_FIFO BIT(0) + +/* DSIM_PHYACCHR */ +#define DSIM_AFC_EN BIT(14) +#define DSIM_AFC_CTL(x) (((x) & 0x7) << 5) + +/* DSIM_PLLCTRL */ +#define DSIM_FREQ_BAND(x) ((x) << 24) +#define DSIM_PLL_EN BIT(23) +#define DSIM_PLL_P(x, offset) ((x) << (offset)) +#define DSIM_PLL_M(x) ((x) << 4) +#define DSIM_PLL_S(x) ((x) << 1) + +/* DSIM_PHYCTRL */ +#define DSIM_PHYCTRL_ULPS_EXIT(x) (((x) & 0x1ff) << 0) +#define DSIM_PHYCTRL_B_DPHYCTL_VREG_LP BIT(30) +#define DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP BIT(14) + +/* DSIM_PHYTIMING */ +#define DSIM_PHYTIMING_LPX(x) ((x) << 8) +#define DSIM_PHYTIMING_HS_EXIT(x) ((x) << 0) + +/* DSIM_PHYTIMING1 */ +#define DSIM_PHYTIMING1_CLK_PREPARE(x) ((x) << 24) +#define DSIM_PHYTIMING1_CLK_ZERO(x) ((x) << 16) +#define DSIM_PHYTIMING1_CLK_POST(x) ((x) << 8) +#define DSIM_PHYTIMING1_CLK_TRAIL(x) ((x) << 0) + +/* DSIM_PHYTIMING2 */ +#define DSIM_PHYTIMING2_HS_PREPARE(x) ((x) << 16) +#define DSIM_PHYTIMING2_HS_ZERO(x) ((x) << 8) +#define DSIM_PHYTIMING2_HS_TRAIL(x) ((x) << 0) + +#define DSI_MAX_BUS_WIDTH 4 +#define DSI_NUM_VIRTUAL_CHANNELS 4 +#define DSI_TX_FIFO_SIZE 2048 +#define DSI_RX_FIFO_SIZE 256 +#define DSI_XFER_TIMEOUT_MS 100 +#define DSI_RX_FIFO_EMPTY 0x30800002 + +struct samsung_dsim_driver_data { + const unsigned int *reg_ofs; + unsigned int plltmr_reg; + unsigned int has_freqband:1; + unsigned int has_clklane_stop:1; + unsigned int has_broken_fifoctrl_emptyhdr:1; + unsigned int num_clks; + unsigned int min_freq; + unsigned int max_freq; + unsigned int wait_for_reset; + unsigned int num_bits_resol; + unsigned int pll_p_offset; + const unsigned int *reg_values; + unsigned int pll_fin_min; + unsigned int pll_fin_max; + u16 m_min; + u16 m_max; +}; + +enum reg_idx { + DSIM_STATUS_REG, /* Status register */ + DSIM_RGB_STATUS_REG, /* RGB status register */ + DSIM_SWRST_REG, /* Software reset register */ + DSIM_CLKCTRL_REG, /* Clock control register */ + DSIM_TIMEOUT_REG, /* Time out register */ + DSIM_CONFIG_REG, /* Configuration register */ + DSIM_ESCMODE_REG, /* Escape mode register */ + DSIM_MDRESOL_REG, + DSIM_MVPORCH_REG, /* Main display Vporch register */ + DSIM_MHPORCH_REG, /* Main display Hporch register */ + DSIM_MSYNC_REG, /* Main display sync area register */ + DSIM_INTSRC_REG, /* Interrupt source register */ + DSIM_INTMSK_REG, /* Interrupt mask register */ + DSIM_PKTHDR_REG, /* Packet Header FIFO register */ + DSIM_PAYLOAD_REG, /* Payload FIFO register */ + DSIM_RXFIFO_REG, /* Read FIFO register */ + DSIM_FIFOCTRL_REG, /* FIFO status and control register */ + DSIM_PLLCTRL_REG, /* PLL control register */ + DSIM_PHYCTRL_REG, + DSIM_PHYTIMING_REG, + DSIM_PHYTIMING1_REG, + DSIM_PHYTIMING2_REG, + NUM_REGS +}; + +static const unsigned int exynos_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x00, + [DSIM_SWRST_REG] = 0x04, + [DSIM_CLKCTRL_REG] = 0x08, + [DSIM_TIMEOUT_REG] = 0x0c, + [DSIM_CONFIG_REG] = 0x10, + [DSIM_ESCMODE_REG] = 0x14, + [DSIM_MDRESOL_REG] = 0x18, + [DSIM_MVPORCH_REG] = 0x1c, + [DSIM_MHPORCH_REG] = 0x20, + [DSIM_MSYNC_REG] = 0x24, + [DSIM_INTSRC_REG] = 0x2c, + [DSIM_INTMSK_REG] = 0x30, + [DSIM_PKTHDR_REG] = 0x34, + [DSIM_PAYLOAD_REG] = 0x38, + [DSIM_RXFIFO_REG] = 0x3c, + [DSIM_FIFOCTRL_REG] = 0x44, + [DSIM_PLLCTRL_REG] = 0x4c, + [DSIM_PHYCTRL_REG] = 0x5c, + [DSIM_PHYTIMING_REG] = 0x64, + [DSIM_PHYTIMING1_REG] = 0x68, + [DSIM_PHYTIMING2_REG] = 0x6c, +}; + +static const unsigned int exynos5433_reg_ofs[] = { + [DSIM_STATUS_REG] = 0x04, + [DSIM_RGB_STATUS_REG] = 0x08, + [DSIM_SWRST_REG] = 0x0C, + [DSIM_CLKCTRL_REG] = 0x10, + [DSIM_TIMEOUT_REG] = 0x14, + [DSIM_CONFIG_REG] = 0x18, + [DSIM_ESCMODE_REG] = 0x1C, + [DSIM_MDRESOL_REG] = 0x20, + [DSIM_MVPORCH_REG] = 0x24, + [DSIM_MHPORCH_REG] = 0x28, + [DSIM_MSYNC_REG] = 0x2C, + [DSIM_INTSRC_REG] = 0x34, + [DSIM_INTMSK_REG] = 0x38, + [DSIM_PKTHDR_REG] = 0x3C, + [DSIM_PAYLOAD_REG] = 0x40, + [DSIM_RXFIFO_REG] = 0x44, + [DSIM_FIFOCTRL_REG] = 0x4C, + [DSIM_PLLCTRL_REG] = 0x94, + [DSIM_PHYCTRL_REG] = 0xA4, + [DSIM_PHYTIMING_REG] = 0xB4, + [DSIM_PHYTIMING1_REG] = 0xB8, + [DSIM_PHYTIMING2_REG] = 0xBC, +}; + +enum reg_value_idx { + RESET_TYPE, + PLL_TIMER, + STOP_STATE_CNT, + PHYCTRL_ULPS_EXIT, + PHYCTRL_VREG_LP, + PHYCTRL_SLEW_UP, + PHYTIMING_LPX, + PHYTIMING_HS_EXIT, + PHYTIMING_CLK_PREPARE, + PHYTIMING_CLK_ZERO, + PHYTIMING_CLK_POST, + PHYTIMING_CLK_TRAIL, + PHYTIMING_HS_PREPARE, + PHYTIMING_HS_ZERO, + PHYTIMING_HS_TRAIL +}; + +static const unsigned int reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x0af), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x27), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x09), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const unsigned int exynos5422_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x08), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0d), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x30), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x0a), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0c), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x11), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0d), +}; + +static const unsigned int exynos5433_reg_values[] = { + [RESET_TYPE] = DSIM_FUNCRST, + [PLL_TIMER] = 22200, + [STOP_STATE_CNT] = 0xa, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0x190), + [PHYCTRL_VREG_LP] = DSIM_PHYCTRL_B_DPHYCTL_VREG_LP, + [PHYCTRL_SLEW_UP] = DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x07), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0c), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x09), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x2d), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0e), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x09), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x0b), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x10), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), +}; + +static const unsigned int imx8mm_dsim_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = DSIM_PHYCTRL_ULPS_EXIT(0xaf), + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x26), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x08), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + +static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x50, + .has_freqband = 1, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, +}; + +static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { + .reg_ofs = exynos_reg_ofs, + .plltmr_reg = 0x58, + .num_clks = 2, + .max_freq = 1000, + .wait_for_reset = 1, + .num_bits_resol = 11, + .pll_p_offset = 13, + .reg_values = reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 5, + .max_freq = 1500, + .wait_for_reset = 0, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5433_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 1500, + .wait_for_reset = 1, + .num_bits_resol = 12, + .pll_p_offset = 13, + .reg_values = exynos5422_reg_values, + .pll_fin_min = 6, + .pll_fin_max = 12, + .m_min = 41, + .m_max = 125, + .min_freq = 500, +}; + +static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 2100, + .wait_for_reset = 0, + .num_bits_resol = 12, + /* + * Unlike Exynos, PLL_P(PMS_P) offset 14 is used in i.MX8M Mini/Nano/Plus + * downstream driver - drivers/gpu/drm/bridge/sec-dsim.c + */ + .pll_p_offset = 14, + .reg_values = imx8mm_dsim_reg_values, + .pll_fin_min = 2, + .pll_fin_max = 30, + .m_min = 64, + .m_max = 1023, + .min_freq = 1050, +}; + +static const struct samsung_dsim_driver_data * +samsung_dsim_types[DSIM_TYPE_COUNT] = { + [DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, + [DSIM_TYPE_EXYNOS4210] = &exynos4_dsi_driver_data, + [DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, + [DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, + [DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, + [DSIM_TYPE_IMX8MM] = &imx8mm_dsi_driver_data, + [DSIM_TYPE_IMX8MP] = &imx8mm_dsi_driver_data, +}; + +/* DSIM PLL configuration from spec: + * + * Fout(DDR) = (M * Fin) / (P * 2^S), so Fout / Fin = M / (P * 2^S) + * Fin_pll = Fin / P (6 ~ 12 MHz) + * S: [2:0], M: [12:3], P: [18:13], so + * TODO: 'S' is in [0 ~ 3], 'M' is in, 'P' is in [1 ~ 33] + * + */ + +struct samsung_dsi { + void __iomem *reg_base; + struct clk sclk_mipi; + const struct samsung_dsim_driver_data *driver_data; + + /* kHz clocks */ + u64 pix_clk; + u64 bit_clk; + u64 hs_clock; + + unsigned int lanes; + unsigned int channel; /* virtual channel */ + enum mipi_dsi_pixel_format format; + unsigned long mode_flags; + unsigned int pms; + + struct mipi_dsi_device *device; + u32 max_data_lanes; + + struct mipi_dsi_host dsi_host; + struct display_timing timings; +}; + +static inline void samsung_dsim_write(struct samsung_dsi *dsi, + enum reg_idx idx, u32 val) +{ + writel(val, dsi->reg_base + dsi->driver_data->reg_ofs[idx]); +} + +static inline u32 samsung_dsim_read(struct samsung_dsi *dsi, enum reg_idx idx) +{ + return readl(dsi->reg_base + dsi->driver_data->reg_ofs[idx]); +} + +static int samsung_dsi_wait_for_pkt_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPLFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPLFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_for_hdr_done(struct samsung_dsi *dsim, unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_SFRPHFIFOEMPTY) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_SFRPHFIFOEMPTY); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_for_rx_done(struct samsung_dsi *dsim, + unsigned long timeout) +{ + u32 intsrc; + + do { + intsrc = samsung_dsim_read(dsim, DSIM_INTSRC_REG); + if (intsrc & INTSRC_RXDATDONE) { + samsung_dsim_write(dsim, DSIM_INTSRC_REG, INTSRC_RXDATDONE); + return 0; + } + + udelay(1); + } while (--timeout); + + return -ETIMEDOUT; +} + +static int samsung_dsi_wait_pll_stable(struct samsung_dsi *dsim) +{ + u32 status; + ulong start; + + start = get_timer(0); /* Get current timestamp */ + + do { + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (status & DSIM_PLL_STABLE) + return 0; + } while (get_timer(0) < (start + 100)); /* Wait 100ms */ + + return -ETIMEDOUT; +} + +static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsi *dsi, + unsigned long fin, + unsigned long fout, + u8 *p, u16 *m, u8 *s) +{ + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; + unsigned long best_freq = 0; + u32 min_delta = 0xffffffff; + u8 p_min, p_max; + u8 _p, best_p; + u16 _m, best_m; + u8 _s, best_s; + + p_min = DIV_ROUND_UP(fin, (MHZ(12))); + p_max = fin / (MHZ(6)); + + for (_p = p_min; _p <= p_max; ++_p) { + for (_s = 0; _s <= 5; ++_s) { + u64 tmp; + u32 delta; + + tmp = (u64)fout * (_p << _s); + do_div(tmp, fin); + _m = tmp; + if (_m < driver_data->m_min || _m > driver_data->m_max) + continue; + + tmp = (u64)_m * fin; + do_div(tmp, _p); + if (tmp < driver_data->min_freq * MHZ(1) || + tmp > driver_data->max_freq * MHZ(1)) + continue; + + tmp = (u64)_m * fin; + do_div(tmp, _p << _s); + + delta = abs(fout - tmp); + if (delta < min_delta) { + best_p = _p; + best_m = _m; + best_s = _s; + min_delta = delta; + best_freq = tmp; + } + } + } + + if (best_freq) { + *p = best_p; + *m = best_m; + *s = best_s; + } + + return best_freq; +} + +static int samsung_dsi_config_pll(struct samsung_dsi *dsim) +{ + int ret; + u32 pllctrl = 0, status, data_lanes_en, stop; + + writel(dsim->driver_data->reg_values[PLL_TIMER], + dsim->reg_base + dsim->driver_data->plltmr_reg); + + /* TODO: config dp/dn swap if requires */ + + pllctrl |= PLLCTRL_SET_PMS(dsim->pms) | PLLCTRL_PLLEN; + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, pllctrl); + + ret = samsung_dsi_wait_pll_stable(dsim); + if (ret) { + log_err("wait for pll stable time out\n"); + return ret; + } + + /* wait for clk & data lanes to go to stop state */ + mdelay(1); + + data_lanes_en = (0x1 << dsim->lanes) - 1; + status = samsung_dsim_read(dsim, DSIM_STATUS_REG); + if (!(status & DSIM_STOP_STATE_CLK)) { + log_err("clock is not in stop state\n"); + return -EBUSY; + } + + stop = DSIM_STOP_STATE_DAT(status); + if ((stop & data_lanes_en) != data_lanes_en) { + log_err("one or more data lanes is not in stop state\n"); + return -EBUSY; + } + + return 0; +} + +static void samsung_dsi_set_main_mode(struct samsung_dsi *dsim) +{ + u32 bpp, hfp_wc, hbp_wc, hsa_wc, wc; + u32 mdresol = 0, mvporch = 0, mhporch = 0, msync = 0; + struct display_timing *timings = &dsim->timings; + unsigned int num_bits_resol = dsim->driver_data->num_bits_resol; + + mdresol |= DSIM_MAIN_VRESOL(timings->vactive.typ, num_bits_resol) | + DSIM_MAIN_HRESOL(timings->hactive.typ, num_bits_resol); + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); + + mvporch |= MVPORCH_SET_MAINVBP(timings->vback_porch.typ) | + MVPORCH_SET_STABLEVFP(timings->vfront_porch.typ) | + MVPORCH_SET_CMDALLOW(0x0); + samsung_dsim_write(dsim, DSIM_MVPORCH_REG, mvporch); + + bpp = mipi_dsi_pixel_format_to_bpp(dsim->format); + + wc = DIV_ROUND_UP(timings->hfront_porch.typ * (bpp >> 3), dsim->lanes); + hfp_wc = wc > MIPI_HFP_PKT_OVERHEAD ? + wc - MIPI_HFP_PKT_OVERHEAD : timings->hfront_porch.typ; + wc = DIV_ROUND_UP(timings->hback_porch.typ * (bpp >> 3), dsim->lanes); + hbp_wc = wc > MIPI_HBP_PKT_OVERHEAD ? + wc - MIPI_HBP_PKT_OVERHEAD : timings->hback_porch.typ; + + mhporch |= MHPORCH_SET_MAINHFP(hfp_wc) | + MHPORCH_SET_MAINHBP(hbp_wc); + + samsung_dsim_write(dsim, DSIM_MHPORCH_REG, mhporch); + + wc = DIV_ROUND_UP(timings->hsync_len.typ * (bpp >> 3), dsim->lanes); + hsa_wc = wc > MIPI_HSA_PKT_OVERHEAD ? + wc - MIPI_HSA_PKT_OVERHEAD : timings->hsync_len.typ; + + msync |= MSYNC_SET_MAINVSA(timings->vsync_len.typ) | + MSYNC_SET_MAINHSA(hsa_wc); + + debug("hfp_wc %u hbp_wc %u hsa_wc %u\n", hfp_wc, hbp_wc, hsa_wc); + + samsung_dsim_write(dsim, DSIM_MSYNC_REG, msync); +} + +static void samsung_dsi_config_dpi(struct samsung_dsi *dsim) +{ + u32 config = 0, rgb_status = 0, data_lanes_en; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) + rgb_status &= ~RGB_STATUS_CMDMODE_INSEL; + else + rgb_status |= RGB_STATUS_CMDMODE_INSEL; + + samsung_dsim_write(dsim, DSIM_RGB_STATUS_REG, rgb_status); + + if (dsim->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) { + config |= DSIM_CLKLANE_STOP; + config |= DSIM_NON_CONTINUOUS_CLKLANE; + } + + if (dsim->mode_flags & MIPI_DSI_MODE_VSYNC_FLUSH) + config |= DSIM_MFLUSH_VS; + + /* disable EoT packets in HS mode */ + if (dsim->mode_flags & MIPI_DSI_MODE_EOT_PACKET) + config |= DSIM_EOT_DISABLE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + config |= DSIM_VIDEO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + config |= DSIM_BURST_MODE; + + else if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + config |= DSIM_SYNC_INFORM; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_AUTO_VERT) + config |= DSIM_AUTO_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSE) + config |= DSIM_HSE_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HFP) + config |= DSIM_HFP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HBP) + config |= DSIM_HBP_DISABLE_MODE; + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_HSA) + config |= DSIM_HSA_DISABLE_MODE; + } + + config |= DSIM_MAIN_VC(dsim->channel); + + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO) { + switch (dsim->format) { + case MIPI_DSI_FMT_RGB888: + config |= DSIM_MAIN_PIX_FORMAT_RGB888; + break; + case MIPI_DSI_FMT_RGB666: + config |= DSIM_MAIN_PIX_FORMAT_RGB666; + break; + case MIPI_DSI_FMT_RGB666_PACKED: + config |= DSIM_MAIN_PIX_FORMAT_RGB666_P; + break; + case MIPI_DSI_FMT_RGB565: + config |= DSIM_MAIN_PIX_FORMAT_RGB565; + break; + default: + log_err("invalid pixel format\n"); + break; + } + } + + /* config data lanes number and enable lanes */ + data_lanes_en = BIT(dsim->lanes) - 1; + config |= (DSIM_NUM_OF_DATA_LANE(dsim->lanes - 1) | DSIM_LANE_EN_CLK | + DSIM_LANE_EN(data_lanes_en)); + + debug("DSIM config 0x%x\n", config); + + samsung_dsim_write(dsim, DSIM_CONFIG_REG, config); +} + +static void samsung_dsi_config_cmd_lpm(struct samsung_dsi *dsim, bool enable) +{ + u32 escmode; + + escmode = samsung_dsim_read(dsim, DSIM_ESCMODE_REG); + + if (enable) + escmode |= ESCMODE_CMDLPDT; + else + escmode &= ~ESCMODE_CMDLPDT; + + samsung_dsim_write(dsim, DSIM_ESCMODE_REG, escmode); +} + +static void samsung_dsi_config_dphy(struct samsung_dsi *dsim) +{ + const struct samsung_dsim_driver_data *driver_data = dsim->driver_data; + const unsigned int *reg_values = driver_data->reg_values; + u32 reg; + struct phy_configure_opts_mipi_dphy cfg; + int clk_prepare, lpx, clk_zero, clk_post, clk_trail; + int hs_exit, hs_prepare, hs_zero, hs_trail; + unsigned long long byte_clock = dsim->hs_clock / 8; + + if (driver_data->has_freqband) + return; + + phy_mipi_dphy_get_default_config_for_hsclk(dsim->hs_clock, dsim->lanes, &cfg); + + /* + * TODO: + * The tech Applications Processor manuals for i.MX8M Mini, Nano, + * and Plus don't state what the definition of the PHYTIMING + * bits are beyond their address and bit position. + * After reviewing NXP's downstream code, it appears + * that the various PHYTIMING registers take the number + * of cycles and use various dividers on them. This + * calculation does not result in an exact match to the + * downstream code, but it is very close to the values + * generated by their lookup table, and it appears + * to sync at a variety of resolutions. If someone + * can get a more accurate mathematical equation needed + * for these registers, this should be updated. + */ + + lpx = PS_TO_CYCLE(cfg.lpx, byte_clock); + hs_exit = PS_TO_CYCLE(cfg.hs_exit, byte_clock); + clk_prepare = PS_TO_CYCLE(cfg.clk_prepare, byte_clock); + clk_zero = PS_TO_CYCLE(cfg.clk_zero, byte_clock); + clk_post = PS_TO_CYCLE(cfg.clk_post, byte_clock); + clk_trail = PS_TO_CYCLE(cfg.clk_trail, byte_clock); + hs_prepare = PS_TO_CYCLE(cfg.hs_prepare, byte_clock); + hs_zero = PS_TO_CYCLE(cfg.hs_zero, byte_clock); + hs_trail = PS_TO_CYCLE(cfg.hs_trail, byte_clock); + + /* B D-PHY: D-PHY Master & Slave Analog Block control */ + reg = reg_values[PHYCTRL_ULPS_EXIT] | reg_values[PHYCTRL_VREG_LP] | + reg_values[PHYCTRL_SLEW_UP]; + + samsung_dsim_write(dsim, DSIM_PHYCTRL_REG, reg); + + /* + * T LPX: Transmitted length of any Low-Power state period + * T HS-EXIT: Time that the transmitter drives LP-11 following a HS + * burst + */ + + reg = DSIM_PHYTIMING_LPX(lpx) | DSIM_PHYTIMING_HS_EXIT(hs_exit); + samsung_dsim_write(dsim, DSIM_PHYTIMING_REG, reg); + + /* + * T CLK-PREPARE: Time that the transmitter drives the Clock Lane LP-00 + * Line state immediately before the HS-0 Line state starting the + * HS transmission + * T CLK-ZERO: Time that the transmitter drives the HS-0 state prior to + * transmitting the Clock. + * T CLK_POST: Time that the transmitter continues to send HS clock + * after the last associated Data Lane has transitioned to LP Mode + * Interval is defined as the period from the end of T HS-TRAIL to + * the beginning of T CLK-TRAIL + * T CLK-TRAIL: Time that the transmitter drives the HS-0 state after + * the last payload clock bit of a HS transmission burst + */ + + reg = DSIM_PHYTIMING1_CLK_PREPARE(clk_prepare) | + DSIM_PHYTIMING1_CLK_ZERO(clk_zero) | + DSIM_PHYTIMING1_CLK_POST(clk_post) | + DSIM_PHYTIMING1_CLK_TRAIL(clk_trail); + + samsung_dsim_write(dsim, DSIM_PHYTIMING1_REG, reg); + + /* + * T HS-PREPARE: Time that the transmitter drives the Data Lane LP-00 + * Line state immediately before the HS-0 Line state starting the + * HS transmission + * T HS-ZERO: Time that the transmitter drives the HS-0 state prior to + * transmitting the Sync sequence. + * T HS-TRAIL: Time that the transmitter drives the flipped differential + * state after last payload data bit of a HS transmission burst + */ + + reg = DSIM_PHYTIMING2_HS_PREPARE(hs_prepare) | + DSIM_PHYTIMING2_HS_ZERO(hs_zero) | + DSIM_PHYTIMING2_HS_TRAIL(hs_trail); + + samsung_dsim_write(dsim, DSIM_PHYTIMING2_REG, reg); + + reg = DSIM_BTA_TIMEOUT(0xff) | DSIM_LPDR_TIMEOUT(0xffff); + + samsung_dsim_write(dsim, DSIM_TIMEOUT_REG, reg); +} + +static void samsung_dsim_write_pl_to_sfr_fifo(struct samsung_dsi *dsim, + const void *payload, + size_t length) +{ + u32 pl_data; + + if (!length) + return; + + while (length >= 4) { + pl_data = get_unaligned_le32(payload); + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + payload += 4; + length -= 4; + } + + pl_data = 0; + switch (length) { + case 3: + pl_data |= ((u8 *)payload)[2] << 16; + case 2: + pl_data |= ((u8 *)payload)[1] << 8; + case 1: + pl_data |= ((u8 *)payload)[0]; + samsung_dsim_write(dsim, DSIM_PAYLOAD_REG, pl_data); + break; + } +} + +static void samsung_dsim_write_ph_to_sfr_fifo(struct samsung_dsi *dsim, + void *header, bool use_lpm) +{ + u32 pkthdr; + + pkthdr = PKTHDR_SET_DATA1(((u8 *)header)[2]) | /* WC MSB */ + PKTHDR_SET_DATA0(((u8 *)header)[1]) | /* WC LSB */ + PKTHDR_SET_DI(((u8 *)header)[0]); /* Data ID */ + + samsung_dsim_write(dsim, DSIM_PKTHDR_REG, pkthdr); +} + +static int samsung_dsim_read_pl_from_sfr_fifo(struct samsung_dsi *dsim, + void *payload, size_t length) +{ + u8 data_type; + u16 word_count = 0; + u32 fifoctrl, ph, pl; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + if (WARN_ON(fifoctrl & FIFOCTRL_EMPTYRX)) + return -EINVAL; + + ph = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + data_type = PKTHDR_GET_DT(ph); + switch (data_type) { + case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: + dev_err(dsim->device->dev, "peripheral report error: (0-7)%x, (8-15)%x\n", + PKTHDR_GET_DATA0(ph), PKTHDR_GET_DATA1(ph)); + return -EPROTO; + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE: + if (!WARN_ON(length < 2)) { + ((u8 *)payload)[1] = PKTHDR_GET_DATA1(ph); + word_count++; + } + fallthrough; + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: + ((u8 *)payload)[0] = PKTHDR_GET_DATA0(ph); + word_count++; + length = word_count; + break; + case MIPI_DSI_RX_DCS_LONG_READ_RESPONSE: + case MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE: + word_count = PKTHDR_GET_WC(ph); + if (word_count > length) { + dev_err(dsim->device->dev, "invalid receive buffer length\n"); + return -EINVAL; + } + + length = word_count; + + while (word_count >= 4) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + ((u8 *)payload)[0] = pl & 0xff; + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + ((u8 *)payload)[3] = (pl >> 24) & 0xff; + payload += 4; + word_count -= 4; + } + + if (word_count > 0) { + pl = samsung_dsim_read(dsim, DSIM_RXFIFO_REG); + + switch (word_count) { + case 3: + ((u8 *)payload)[2] = (pl >> 16) & 0xff; + case 2: + ((u8 *)payload)[1] = (pl >> 8) & 0xff; + case 1: + ((u8 *)payload)[0] = pl & 0xff; + break; + } + } + + break; + default: + return -EINVAL; + } + + return length; +} + +static void samsung_dsi_init_fifo_pointers(struct samsung_dsi *dsim) +{ + u32 fifoctrl, fifo_ptrs; + + fifoctrl = samsung_dsim_read(dsim, DSIM_FIFOCTRL_REG); + + fifo_ptrs = FIFOCTRL_NINITRX | + FIFOCTRL_NINITSFR | + FIFOCTRL_NINITI80 | + FIFOCTRL_NINITSUB | + FIFOCTRL_NINITMAIN; + + fifoctrl &= ~fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); + + fifoctrl |= fifo_ptrs; + samsung_dsim_write(dsim, DSIM_FIFOCTRL_REG, fifoctrl); + udelay(500); +} + +static void samsung_dsi_config_clkctrl(struct samsung_dsi *dsim) +{ + u32 clkctrl = 0, data_lanes_en; + u64 byte_clk, esc_prescaler; + + clkctrl |= DSIM_TX_REQUEST_HSCLK; + + /* using 1.5Gbps PHY */ + clkctrl |= CLKCTRL_DPHY_SEL_1P5G; + clkctrl |= DSIM_ESC_CLKEN; + clkctrl &= ~CLKCTRL_PLLBYPASS; + clkctrl |= CLKCTRL_BYTECLKSRC_DPHY_PLL; + clkctrl |= DSIM_BYTE_CLKEN; + + data_lanes_en = (0x1 << dsim->lanes) - 1; + clkctrl |= CLKCTRL_SET_LANEESCCLKEN(0x1 | data_lanes_en << 1); + + /* calculate esc prescaler from byte clock: + * EscClk = ByteClk / EscPrescaler; + */ + byte_clk = dsim->bit_clk >> 3; + esc_prescaler = DIV_ROUND_UP_ULL(byte_clk, MAX_ESC_CLK_FREQ); + + clkctrl |= CLKCTRL_SET_ESCPRESCALER(esc_prescaler); + + debug("DSIM clkctrl 0x%x\n", clkctrl); + + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, clkctrl); +} + +static void samsung_dsi_set_standby(struct samsung_dsi *dsim, bool standby) +{ + u32 mdresol = 0; + + mdresol = samsung_dsim_read(dsim, DSIM_MDRESOL_REG); + + if (standby) + mdresol |= DSIM_MAIN_STAND_BY; + else + mdresol &= ~DSIM_MAIN_STAND_BY; + + samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); +} + +static void samsung_dsi_disable_clock(struct samsung_dsi *dsim) +{ + u32 reg; + + reg = samsung_dsim_read(dsim, DSIM_CLKCTRL_REG); + reg &= ~(DSIM_LANE_ESC_CLK_EN_CLK | DSIM_LANE_ESC_CLK_EN_DATA_MASK | + DSIM_ESC_CLKEN | DSIM_BYTE_CLKEN); + samsung_dsim_write(dsim, DSIM_CLKCTRL_REG, reg); + + reg = samsung_dsim_read(dsim, DSIM_PLLCTRL_REG); + reg &= ~DSIM_PLL_EN; + samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, reg); +} + +static inline struct samsung_dsi *host_to_dsi(struct mipi_dsi_host *host) +{ + return container_of(host, struct samsung_dsi, dsi_host); +} + +static int samsung_dsi_bridge_clk_set(struct samsung_dsi *dsim_host) +{ + int bpp; + unsigned long pix_clk, bit_clk; + unsigned long fin, fout; + u8 p, s; + u16 m; + + bpp = mipi_dsi_pixel_format_to_bpp(dsim_host->format); + if (bpp < 0) + return -EINVAL; + + pix_clk = dsim_host->timings.pixelclock.typ; + bit_clk = DIV_ROUND_UP_ULL(pix_clk * bpp, dsim_host->lanes); + + dsim_host->pix_clk = DIV_ROUND_UP_ULL(pix_clk, 1000); + dsim_host->bit_clk = DIV_ROUND_UP_ULL(bit_clk, 1000); + + fout = dsim_host->bit_clk; + fin = clk_get_rate(&dsim_host->sclk_mipi); + if (fin == 0) { + log_err("Error: DSI PHY reference clock is disabled\n"); + return -EINVAL; + } + + fout = samsung_dsim_pll_find_pms(dsim_host, fin, bit_clk, &p, &m, &s); + if (!fout) { + log_err("failed to find PLL PMS for requested frequency\n"); + return -EINVAL; + } + dsim_host->pms = PLLCTRL_SET_P(p) | PLLCTRL_SET_M(m) | + PLLCTRL_SET_S(s); + dsim_host->hs_clock = fout; + + debug("%s: bitclk %llu pixclk %llu pms 0x%x\n", __func__, + dsim_host->bit_clk, dsim_host->pix_clk, dsim_host->pms); + + return 0; +} + +static int samsung_dsi_bridge_prepare(struct samsung_dsi *dsim_host) +{ + int ret; + + /* At this moment, the dsim bridge's preceding encoder has + * already been enabled. So the dsim can be configed here + */ + + /* config main display mode */ + samsung_dsi_set_main_mode(dsim_host); + + /* config dsim dpi */ + samsung_dsi_config_dpi(dsim_host); + + /* config dsim pll */ + ret = samsung_dsi_config_pll(dsim_host); + if (ret) { + log_err("dsim pll config failed: %d\n", ret); + return ret; + } + + /* config dphy timings */ + samsung_dsi_config_dphy(dsim_host); + + samsung_dsi_init_fifo_pointers(dsim_host); + + /* config esc clock, byte clock and etc */ + samsung_dsi_config_clkctrl(dsim_host); + + return 0; +} + +static int samsung_dsi_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *device) +{ + struct samsung_dsi *dsi = host_to_dsi(host); + + if (!device->lanes || device->lanes > dsi->max_data_lanes) { + log_err("invalid data lanes number\n"); + return -EINVAL; + } + + if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO) || + !((device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) || + (device->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))) { + log_err("unsupported dsi mode\n"); + return -EINVAL; + } + + if (device->format != MIPI_DSI_FMT_RGB888 && + device->format != MIPI_DSI_FMT_RGB565 && + device->format != MIPI_DSI_FMT_RGB666 && + device->format != MIPI_DSI_FMT_RGB666_PACKED) { + log_err("unsupported pixel format: %#x\n", device->format); + return -EINVAL; + } + + dsi->lanes = device->lanes; + dsi->channel = device->channel; + dsi->format = device->format; + dsi->mode_flags = device->mode_flags; + + debug("lanes %u, channel %u, format 0x%x, mode_flags 0x%lx\n", dsi->lanes, + dsi->channel, dsi->format, dsi->mode_flags); + + samsung_dsi_bridge_clk_set(dsi); + samsung_dsi_bridge_prepare(dsi); + + return 0; +} + +static ssize_t samsung_dsi_host_transfer(struct mipi_dsi_host *host, + const struct mipi_dsi_msg *msg) +{ + struct samsung_dsi *dsim = host_to_dsi(host); + int ret, nb_bytes; + bool use_lpm; + struct mipi_dsi_packet packet; + + ret = mipi_dsi_create_packet(&packet, msg); + if (ret) { + dev_err(dsim->device->dev, "failed to create dsi packet: %d\n", ret); + return ret; + } + + /* config LPM for CMD TX */ + use_lpm = msg->flags & MIPI_DSI_MSG_USE_LPM ? true : false; + samsung_dsi_config_cmd_lpm(dsim, use_lpm); + + if (packet.payload_length) { /* Long Packet case */ + /* write packet payload */ + samsung_dsim_write_pl_to_sfr_fifo(dsim, packet.payload, + packet.payload_length); + + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, packet.header, use_lpm); + + ret = samsung_dsi_wait_for_pkt_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait tx done timeout!\n"); + return -EBUSY; + } + } else { + /* write packet header */ + samsung_dsim_write_ph_to_sfr_fifo(dsim, packet.header, use_lpm); + + ret = samsung_dsi_wait_for_hdr_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait pkthdr tx done time out\n"); + return -EBUSY; + } + } + + /* read packet payload */ + if (unlikely(msg->rx_buf)) { + ret = samsung_dsi_wait_for_rx_done(dsim, MIPI_FIFO_TIMEOUT); + if (ret) { + dev_err(dsim->device->dev, "wait rx done time out\n"); + return -EBUSY; + } + + ret = samsung_dsim_read_pl_from_sfr_fifo(dsim, msg->rx_buf, + msg->rx_len); + if (ret < 0) + return ret; + nb_bytes = msg->rx_len; + } else { + nb_bytes = packet.size; + } + + return nb_bytes; +} + +static const struct mipi_dsi_host_ops samsung_dsi_host_ops = { + .attach = samsung_dsi_host_attach, + .transfer = samsung_dsi_host_transfer, +}; + +static int samsung_dsi_init(struct udevice *dev, + struct mipi_dsi_device *device, + struct display_timing *timings, + unsigned int max_data_lanes, + const struct mipi_dsi_phy_ops *phy_ops) +{ + struct samsung_dsi *dsi = dev_get_priv(dev); + struct udevice *dsi_bridge = device->dev; + enum samsung_dsim_type hw_type = (enum samsung_dsim_type)dev_get_driver_data(dsi_bridge); + + dsi->max_data_lanes = max_data_lanes; + dsi->device = device; + dsi->dsi_host.ops = &samsung_dsi_host_ops; + dsi->driver_data = samsung_dsim_types[hw_type]; + device->host = &dsi->dsi_host; + + dsi->reg_base = (void *)dev_read_addr(device->dev); + if ((fdt_addr_t)dsi->reg_base == FDT_ADDR_T_NONE) { + dev_err(device->dev, "dsi dt register address error\n"); + return -EINVAL; + } + + dsi->timings = *timings; + + return 0; +} + +static int samsung_dsi_enable(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* enable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, true); + + return 0; +} + +static int samsung_dsi_disable(struct udevice *dev) +{ + u32 intsrc; + struct samsung_dsi *dsim_host = dev_get_priv(dev); + + /* disable data transfer of dsim */ + samsung_dsi_set_standby(dsim_host, false); + + /* disable esc clock & byte clock & dsim pll */ + samsung_dsi_disable_clock(dsim_host); + + /* Clear all intsrc */ + intsrc = samsung_dsim_read(dsim_host, DSIM_INTSRC_REG); + samsung_dsim_write(dsim_host, DSIM_INTSRC_REG, intsrc); + + return 0; +} + +struct dsi_host_ops samsung_dsi_ops = { + .init = samsung_dsi_init, + .enable = samsung_dsi_enable, + .disable = samsung_dsi_disable, +}; + +static int samsung_dsi_probe(struct udevice *dev) +{ + struct samsung_dsi *dsim_host = dev_get_priv(dev); + int ret; + + ret = clk_get_by_name(dev, "sclk_mipi", &dsim_host->sclk_mipi); + if (ret) + debug("Failed to get sclk_mipi clock\n"); + + return ret; +} + +static const struct udevice_id samsung_dsi_ids[] = { + { .compatible = "samsung,sec-mipi-dsi" }, + { } +}; + +U_BOOT_DRIVER(samsung_dsi) = { + .name = "samsung_dsi", + .id = UCLASS_DSI_HOST, + .of_match = samsung_dsi_ids, + .probe = samsung_dsi_probe, + .remove = samsung_dsi_disable, + .ops = &samsung_dsi_ops, + .priv_auto = sizeof(struct samsung_dsi), +}; diff --git a/drivers/video/bridge/samsung-dsim.c b/drivers/video/bridge/samsung-dsim.c new file mode 100644 index 000000000000..986f1d830844 --- /dev/null +++ b/drivers/video/bridge/samsung-dsim.c @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2024 Amarula Solutions + * Copyright 2019 NXP + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "samsung-dsim.h" + +struct samsung_dsim_priv { + struct mipi_dsi_device device; + void __iomem *base; + struct udevice *panel; + struct udevice *dsi_host; +}; + +static int samsung_dsim_attach(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + struct mipi_dsi_device *device = &priv->device; + struct mipi_dsi_panel_plat *mplat; + struct display_timing timings; + int ret; + + priv->panel = video_link_get_next_device(dev); + if (!priv->panel || device_get_uclass_id(priv->panel) != UCLASS_PANEL) { + dev_err(dev, "get panel device error\n"); + return -ENODEV; + } + + mplat = dev_get_plat(priv->panel); + mplat->device = &priv->device; + + ret = video_link_get_display_timings(&timings); + if (ret) { + dev_err(dev, "decode display timing error %d\n", ret); + return ret; + } + + ret = uclass_get_device(UCLASS_DSI_HOST, 0, &priv->dsi_host); + if (ret) { + dev_err(dev, "No video dsi host detected %d\n", ret); + return ret; + } + + /* allow to use the compatible */ + device->dev = dev; + ret = dsi_host_init(priv->dsi_host, device, &timings, 4, + NULL); + if (ret) { + dev_err(dev, "failed to initialize mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_set_backlight(struct udevice *dev, int percent) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + int ret; + + ret = panel_enable_backlight(priv->panel); + if (ret) { + dev_err(dev, "panel %s enable backlight error %d\n", + priv->panel->name, ret); + return ret; + } + + ret = dsi_host_enable(priv->dsi_host); + if (ret) { + dev_err(dev, "failed to enable mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_probe(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + struct mipi_dsi_device *device = &priv->device; + + device->dev = dev; + + return 0; +} + +static int samsung_dsim_remove(struct udevice *dev) +{ + struct samsung_dsim_priv *priv = dev_get_priv(dev); + int ret; + + if (priv->panel) + device_remove(priv->panel, DM_REMOVE_NORMAL); + + ret = dsi_host_disable(priv->dsi_host); + if (ret) { + dev_err(dev, "failed to enable mipi dsi host\n"); + return ret; + } + + return 0; +} + +static int samsung_dsim_check_timing(struct udevice *dev, struct display_timing *timings) +{ + timings->flags &= ~DISPLAY_FLAGS_DE_HIGH; + return 0; +} + +struct video_bridge_ops samsung_dsim_ops = { + .attach = samsung_dsim_attach, + .set_backlight = samsung_dsim_set_backlight, + .check_timing = samsung_dsim_check_timing, +}; + +static const struct udevice_id samsung_dsim_ids[] = { + { .compatible = "fsl,imx8mm-mipi-dsim", .data = DSIM_TYPE_IMX8MM }, + { .compatible = "fsl,imx8mn-mipi-dsim", .data = DSIM_TYPE_IMX8MM }, + { } +}; + +U_BOOT_DRIVER(samsung_dsim) = { + .name = "samsung_dsim", + .id = UCLASS_VIDEO_BRIDGE, + .of_match = samsung_dsim_ids, + .bind = dm_scan_fdt_dev, + .remove = samsung_dsim_remove, + .probe = samsung_dsim_probe, + .ops = &samsung_dsim_ops, + .priv_auto = sizeof(struct samsung_dsim_priv), +}; diff --git a/drivers/video/bridge/samsung-dsim.h b/drivers/video/bridge/samsung-dsim.h new file mode 100644 index 000000000000..9bb2a379589b --- /dev/null +++ b/drivers/video/bridge/samsung-dsim.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2024 Amarula Solutions + */ + +#ifndef SAMSUNG_DSIM_H +#define SAMSUNG_DSIM_H + +enum samsung_dsim_type { + DSIM_TYPE_EXYNOS3250, + DSIM_TYPE_EXYNOS4210, + DSIM_TYPE_EXYNOS5410, + DSIM_TYPE_EXYNOS5422, + DSIM_TYPE_EXYNOS5433, + DSIM_TYPE_IMX8MM, + DSIM_TYPE_IMX8MP, + DSIM_TYPE_COUNT, +}; + +#endif From patchwork Wed Sep 11 15:10:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3450 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D686D4355C for ; Wed, 11 Sep 2024 17:11:02 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cae209243sf32181535e9.1 for ; Wed, 11 Sep 2024 08:11:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067462; cv=pass; d=google.com; s=arc-20240605; b=KVRAgyEQVaXM+aRIlHTVKnxdaMLEXQYb4myuyw4IQEdNHIiReOk3T8bHOP6oBo7Bhw gRT3dwlyDqAXfIXTG18omN1cFvxqTFSKBEcuojemjW3OGTCfcqgkaz90XHe3zWwVUs9k 2rWzJq1DhCPuMa9geJsu6/msPB4Ls447Uwt1hkXjsIhTk6dvGyuO+1dQIHiOMo4HZ98V WThh/Klev1WrdGeWmOUCxkZWZfogg7ChBCOjPr9LT06BOF4M1LX1rJZnE5ChV6ALTpue gb5Ip46kh3cLql3y+z9xasZEzDAChgZfg0FlHhE1iLc1+uslV+AxkV8znrWkDg4t/1aK 6K/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=CkyywR9sPN15zuNAh5hVWX9kHYxVLuxyYB8oxVa4r40=; fh=xV1MyTTZ0oDmiPUuwfsrTWNo17cknC2DwGmR76bg/+0=; b=CLV6B1tqkTdV/2MatlMkd9ih3hteK7iaGRCkRMZLckyDMGcoqX1rNp+lQoCl2uWukt 5W2LKcpT8PcJOYoYiFhH2dlxBCwRGUlt+Qpn2BfL8kJEwiEkz7fMew48l82UpzBhMFSs SkasZb5Y/WNX+Si7iufKScspVvUbkmGcOfVUGx++k0o25JxsVlo+t1r5jYgYWPNqeMcd DGDdjAqvWuzRA1I8zWrGiwXHGqv5SJ7PpDjA3J6uIJ722ZwU9heRMbruqlZeERYcg0uF A9KfG9ZJjhGRCjK1lH4N23vc74M5vNU5Wt0UXzsRG2YnQ4IQAQRCnDsqtR+Ke47y8u9N h/VA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=V2N2Thyf; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067462; x=1726672262; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=CkyywR9sPN15zuNAh5hVWX9kHYxVLuxyYB8oxVa4r40=; b=oz42oYcjHELafBKHZjLGVox+0dKXOErKzQvpW+mtvYaIL3m0U9ARPmNjAVUepk2R6K T8N4kz+/qhB3NWqzL0uC1bed1LXRYl+Dq2q1i0Jo2ntP9yZiFwnRigZ6PhaOI/Bc6mJA wLEXE4b8vGUqvD13DJ4nR6KfYll+/p+KGjzgg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067462; x=1726672262; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CkyywR9sPN15zuNAh5hVWX9kHYxVLuxyYB8oxVa4r40=; b=Do4VIvSgzzkEztjCGIsm+3RHJU/ZjSSs3hFB34ZsNb99xTxkZAPLy+VgOfgSc4hhLG rnOFWHEbaJ225UCdTTogHpWvw5U6ifmOKdK/XXvNUM9+bsK/tHbPT7XKvCSuz7xYny8J ZtDzdpO61QyTbO9RzQsTRwx2cM9HeDZ6aUYmvnB6ijUDmczvXTAkA1qX8GlJc5+TfeIR vkza0whCtn7jLfjk0pkY0hfs7Bn0M5knqxi5ieOWgefRcuncFn1BStyMwKNJbqkmhWG6 xG/OSM9tMyL3ryqXcIDayPwT+HJZvQY0dcK3K1jNNWcZgR5u95iRnOWaCt6cMMpa83Jz clcw== X-Forwarded-Encrypted: i=2; AJvYcCUNfgFFDy6JjDl1imFRA/oS4Gge6cwC+ugUHdj0cJImUtd+ygclmevRltl1K19ZpulzLEJI1EIDD8p2kZKZ@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Ywo32Ni8lBFBk3wc9yTzAUJj1KEOa4XC+hMk++NDk5hk6jIPP2D gfettwBA200MS6DruEgB38XxwKFGmvicLyZDm+b8y8hQAhcy2g5vSsijS9SdRGjR4Q== X-Google-Smtp-Source: AGHT+IGuOxO44OAS0XGSZ/M/nq1mZsgrLlN+vXrw6YfmYqrwJ9boJZimS9G4pZ2wqBHhAA/Jgps1tw== X-Received: by 2002:a05:600c:1e10:b0:426:6e95:78d6 with SMTP id 5b1f17b1804b1-42cae709278mr105898095e9.4.1726067462427; Wed, 11 Sep 2024 08:11:02 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:5f82:0:b0:374:ce97:5b7e with SMTP id ffacd0b85a97d-378c1d0c041ls23678f8f.2.-pod-prod-06-eu; Wed, 11 Sep 2024 08:11:01 -0700 (PDT) X-Received: by 2002:a5d:4cc3:0:b0:374:ca4f:bd70 with SMTP id ffacd0b85a97d-37894a6b20amr8861084f8f.53.1726067461035; Wed, 11 Sep 2024 08:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067461; cv=none; d=google.com; s=arc-20160816; b=Nhwb0+YSSq9hn9zUmFVHwi85Dp2G7Z/X6qj1uzyhjLzlIi3SnZjXgddj4sWw/nvyxh aQkjyz2iLgO/X/1DCkbMRzu1gp4cvYVm8nT9CXE6rrLQGFt9TLXFVoEFkODLo33Pi6Tl hiv6zI9Vn329N7NE3/QckBnjSykk5CkZy5yPUgRyOOGyr2SFvCnAcCg19eqplr1D3crW 2hNnVu2mQvM9fPoSdMf3CtuWbGR1YiGs//EQuJPiByZzuhZLGASQwsRKYWa7ftH1KCQR BmsjemXgBcDiFnNNL2zMkcXJBrjDC8GyGFBzmarDUpAOZPGRY1DEIOC4uOC822yilti8 uBFg== 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:to:from:dkim-signature; bh=4Zn8ClwdXoAcaHA+tk5biLFrXll9qgGw9IRC/fcfxXM=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=bCEkdkfqLSKZl791FtFPhA0V0UUP1a4cvulk/fRzAcp2itupBt93eBAePXsWVDDikM Hu1+MzPkUfqZv/fM6+9cTX6Jm2j8OBPvfXYaTnB50DCry3vl6U8SsVgAMQym1lsn0nJO 8wFlwtk7UkUfRhOsWR1KmpjvhjxSLNBv1gxdlPFqtoyGXx+vKGTh/VUMYTQgKKeu2W4f o2j77BMmEAOQ1fh74jqoDcx/hDIcDutfSsVGEF/sJybnKHPUswRFZeSlH06KBdb4g/yB GsSoZP0A2V0QC7nTiMvHwtFHk5JTv2XExBZI0245p+HyoFTjjHVnMpQqPXFLMPs4X/TD tB1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=V2N2Thyf; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-378956b2538sor1952416f8f.7.2024.09.11.08.11.00 for (Google Transport Security); Wed, 11 Sep 2024 08:11:01 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:adf:f6c2:0:b0:376:274c:c8b3 with SMTP id ffacd0b85a97d-378949ef869mr8754790f8f.5.1726067460159; Wed, 11 Sep 2024 08:11:00 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:59 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 20/27] video: Add Synaptics R63353 panel driver Date: Wed, 11 Sep 2024 17:10:32 +0200 Message-ID: <20240911151039.2914886-20-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=V2N2Thyf; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi The LS068B3SX02 panel is based on the Synaptics R63353 Controller. Add a driver for it. Signed-off-by: Michael Trimarchi --- 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 d2432d67a460..9f7cf196e3ac 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 9fd3645994f1..4d836efcfa41 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -66,6 +66,7 @@ obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o obj-$(CONFIG_VIDEO_LCD_RENESAS_R69328) += renesas-r69328.o obj-$(CONFIG_VIDEO_LCD_SAMSUNG_LTL106HL02) += samsung-ltl106hl02.o obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o +obj-$(CONFIG_VIDEO_LCD_SYNAPTICS_R63353) += synaptics-r63353.o obj-$(CONFIG_VIDEO_LCD_TDO_TL070WSH30) += tdo-tl070wsh30.o obj-$(CONFIG_VIDEO_MCDE_SIMPLE) += mcde_simple.o obj-${CONFIG_VIDEO_MESON} += meson/ diff --git a/drivers/video/synaptics-r63353.c b/drivers/video/synaptics-r63353.c new file mode 100644 index 000000000000..25db9c3e707a --- /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 Wed Sep 11 15:10:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3451 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id CEFC842E89 for ; Wed, 11 Sep 2024 17:11:03 +0200 (CEST) Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-374c54e188dsf553695f8f.1 for ; Wed, 11 Sep 2024 08:11:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067463; cv=pass; d=google.com; s=arc-20240605; b=YSv2bQvMW2DHmuaupd+27duXgviWFF6GO7Fsra8y93pn/+A8B+GLXEgj7X2NQQp6vp tz/DhRdTtUQoZggXkK/riPKjEUj6EZ/s2agVXLP2ygBgB84BYKO7Ag2nW0UPQnFn0XuV Tp1KNEQd3IIe8SP9dczJeqyEbqLeznv1GTFf8rkao0hT+MGJNfwoJM+RWM1trwdirCO4 NBqJrH8S1cbKtZT7MCGZ/iB9aC62CLPK6SsJHjgpJCCZZvyCbQAFuGeB4cWIMKlSbqyJ ZFpqlinZ3wTvLNe2njAVK+fjRYZq+9RHVmFt68GrzidtqafOPNc6Axxs0YmkeqmYP0HG 9pSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=AWnsXwsKPYNlfpULRSQ907qevgeJzExft3eEOFeFWZE=; fh=OV+5RzIcbptlHsdCw710f/c2It5Ke7QU6JMUKAyzmdw=; b=FTF8fQeuNpXKnim0HGmtJtgbuIkJo+ysYnWtlBuUPlhTHB6GeeRr/O0WCvnQF7pnIL z2nTGpUeyvzIzE97U95vaytOF07WUVwg3fHEjuAlMZ3QyimA7ZPbAf6Y8THSJqOMHoJ1 a6iFFUz+K1pTNsrZZNLwyAVuwPcjZKcOTXkaUAwzTvyVN62nZUN9WC0HlQV+O8smzcwV oYpZp1o4SteurDunn9VDcWixIwKxmwlOw82khxZF09QCD5c1DDVF9PohjFp0ZBq3y+XS xlYI7/NTxulcW1c2rJkQGVMJswKZ93BTa/VtjT89akRHcf/457ESG+7XB2p4Nl6wIERT AxJg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XnNnHJKB; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067463; x=1726672263; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=AWnsXwsKPYNlfpULRSQ907qevgeJzExft3eEOFeFWZE=; b=XrnVbJKkVhoPbqwTvRR/z3OG/sNy1G7DC+BIb1hJ1OmOfuLT+gw4x+OrCV5lpjpfz3 RH55jQ743mSBeMHedFLgIPcVgroVYFNfAZ/E6HszTEucIG8j1QEs2PQO4putCaIqlcSM +/upnK1sPlg8n0/g8sFGlo5x45YUkHN4o+uRw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067463; x=1726672263; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AWnsXwsKPYNlfpULRSQ907qevgeJzExft3eEOFeFWZE=; b=XOFIUpEyiMLSdMFmFwAdtMi0aytZ99RFRIvtjZVCmZkuO52QboT14KLe9t9CKj7YMg +FmD5GSa0wRk/IlhkivNvqAS5KocqMNgwAW/eO2qN2CK0XOWmsyk+2Lj2sqBmy+XaC1D VU9EQplHg16Fs4V5xSORMY0mRMfihpDSPQNVITTs9jkxrv04gHc5T/+ZBZC160uMOaBu iTWo8e1Fo982ffYXiT0Ok/xjPAoC2ugGX/H8bApEe/adePrgs4gvbbwg5Hi1aQzs631J CyuZW52z8WUTOwSQPSYUz3slCG0ZG5uYedsfzlmo/GKfgGNN1O8FoISKPXscZi1MkzHV 5Urg== X-Forwarded-Encrypted: i=2; AJvYcCV5Vrf963gi7RakJmhsi/q2TsmyYhl/7Umkz6ZDTfKDVAUUj2JEfXpHCSzACr+8qO3r5YC+YGSY3Dkh1CmY@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzJtOGsO7H3FIY3YaKaAfAd9kdkjUNl3nLTL2lMAAZ/ZQlKOBi8 psKKIUCjUSj8fGcDFw2GdGwYEicsxwRnMNhf+vdvWtFLd2dwDejkObnmLcke1qtcgw== X-Google-Smtp-Source: AGHT+IEATustEJ0hhel/5Tjf8vzM40hc0WRrBQ6g1roX9RpSJ5cP5lrt5f6UbHk/YOC6jdVgmNlMeQ== X-Received: by 2002:a05:6000:1961:b0:376:e2f4:5414 with SMTP id ffacd0b85a97d-378a89e66a4mr4138051f8f.5.1726067463355; Wed, 11 Sep 2024 08:11:03 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1d03:b0:42c:b22e:fc4f with SMTP id 5b1f17b1804b1-42ccdfe830fls3922515e9.2.-pod-prod-00-eu; Wed, 11 Sep 2024 08:11:02 -0700 (PDT) X-Received: by 2002:a05:600c:3516:b0:426:5e32:4857 with SMTP id 5b1f17b1804b1-42cbdb83f4cmr42470945e9.0.1726067461895; Wed, 11 Sep 2024 08:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067461; cv=none; d=google.com; s=arc-20160816; b=L1V/PJv5XO5pV+5J9bdCjswx/saEpg86N+f4R3qTsRiIaUQ4495r1TzgpexIV7t2N7 s0mrwuXJDqfdgyLtNvE5/O/135aq7hN5M9UNhydsU/OqN9NHd8sLskOwf6+24S36T0Gl 3Uo2QCavEaOeHuE749Cg/8gfE6yUq45/5zIHkhD9vt8EvHUmDb8WYnupPTz0XOebl37O +KT6XRYsCiYbld6l7ZXeOxJNGUJruUGmCEpWq1JGtUNg0bxNTKFKxvgWBMvQ8J8GCORn IPzm1uax7wmGjz5MOSCtCSort/PxQX2rHckR8Q4pAPp92s0CZZXWzL/7RkwS5nQjEGjC Rh2g== 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:to:from:dkim-signature; bh=c9yw7+2C3BKKxQbuJAyT+06WYAYEHCmMAdjuWYzIyj4=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=QZjKJUfaBg3pusH/GTU4RoR2tKpMNLfuvTcRfhGaRHknuYK6ErUtAKUsw7BYHLD+2Q H+DnN/mR/gH+02inaQdi3Low5ah8fDREYF7YE0m/pWmrcrbVKWsPzlkWV1ctryfXMnA0 hlYpy2/YiRTE7aQmhl95TdJtWPrhwbiZcAQ6L/t24MCX4dSk01+mOrG/PHZ3rXCxNaDv lIMqYG0EWsy2FztfthtbQOWpPVO2Jl90RDLZzHLk2Y9nHGniOJogGSLvF6hgRfy2wAFv ntDB105c5Tvu5uwmh2jffnb7QJHB1qled+s4MN4vhLCi+72/iFsvoZNsA/gT2Hw3Zx3/ UR/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XnNnHJKB; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caedab3a7sor24865355e9.6.2024.09.11.08.11.01 for (Google Transport Security); Wed, 11 Sep 2024 08:11:01 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:310a:b0:42c:b67b:816b with SMTP id 5b1f17b1804b1-42cbddb89c4mr44502865e9.1.1726067461128; Wed, 11 Sep 2024 08:11:01 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:00 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 21/27] imx8mn_bsh_smm_s2/pro: Enable display on reference design Date: Wed, 11 Sep 2024 17:10:33 +0200 Message-ID: <20240911151039.2914886-21-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XnNnHJKB; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Co-developed-by: Dario Binacchi Signed-off-by: Dario Binacchi Signed-off-by: Michael Trimarchi --- .../dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi | 23 +++++++++++++++++++ configs/imx8mn_bsh_smm_s2_defconfig | 15 ++++++++++++ configs/imx8mn_bsh_smm_s2pro_defconfig | 15 ++++++++++++ 3 files changed, 53 insertions(+) diff --git a/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi b/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi index 19b0d8977539..8cae580e2851 100644 --- a/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi +++ b/arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi @@ -6,6 +6,19 @@ #include "imx8mn-u-boot.dtsi" +/ { + aliases { + display0 = &lcdif; + }; + + samsung_dsi_host: dsi-host { + compatible = "samsung,sec-mipi-dsi"; + clocks = <&clk IMX8MN_CLK_DSI_PHY_REF>; + clock-names = "sclk_mipi"; + status = "okay"; + }; +}; + &{/soc@0/bus@30800000/i2c@30a20000/pmic@4b} { bootph-pre-ram; }; @@ -30,6 +43,16 @@ bootph-pre-ram; }; +&lcdif { + display = <&display0>; + + /* panel is r8g8b8 */ + display0: display@0 { + bits-per-pixel = <24>; + bits-per-color = <8>; + }; +}; + &pinctrl_i2c1 { bootph-pre-ram; }; diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig index b4351a392eff..2fa8bc22747e 100644 --- a/configs/imx8mn_bsh_smm_s2_defconfig +++ b/configs/imx8mn_bsh_smm_s2_defconfig @@ -56,6 +56,7 @@ CONFIG_SYS_PROMPT="> " CONFIG_CMD_FUSE=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_BMP=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand" CONFIG_MTDPARTS_DEFAULT="gpmi-nand:64m(nandboot),16m(nandfit),32m(nandkernel),1m(nanddtb),8m(nandtee),-(nandrootfs)" @@ -74,6 +75,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x40480000 CONFIG_FASTBOOT_BUF_SIZE=0x20000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_UUU_SUPPORT=y +CONFIG_DM_GPIO_LOOKUP_LABEL=y +CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y CONFIG_MXC_GPIO=y CONFIG_DM_I2C=y # CONFIG_MMC is not set @@ -94,12 +97,17 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX8M_BLK_CTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_PWM=y +CONFIG_PWM_IMX=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y @@ -112,5 +120,12 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_VIDEO=y +CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y +CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y +CONFIG_VIDEO_MXS=y +CONFIG_BMP_16BPP=y +CONFIG_BMP_24BPP=y +CONFIG_BMP_32BPP=y CONFIG_IMX_WATCHDOG=y # CONFIG_FAT_WRITE is not set diff --git a/configs/imx8mn_bsh_smm_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig index 0faa3376fd3d..b6b62b9d53f9 100644 --- a/configs/imx8mn_bsh_smm_s2pro_defconfig +++ b/configs/imx8mn_bsh_smm_s2pro_defconfig @@ -53,6 +53,7 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_MMC=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_BMP=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y @@ -68,6 +69,8 @@ CONFIG_FASTBOOT_BUF_SIZE=0x20000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_UUU_SUPPORT=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_DM_GPIO_LOOKUP_LABEL=y +CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y CONFIG_MXC_GPIO=y CONFIG_DM_I2C=y CONFIG_SUPPORT_EMMC_BOOT=y @@ -83,12 +86,17 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y +CONFIG_POWER_DOMAIN=y +CONFIG_IMX8M_POWER_DOMAIN=y +CONFIG_IMX8M_BLK_CTRL=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_BD71837=y CONFIG_SPL_DM_PMIC_BD71837=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_PWM=y +CONFIG_PWM_IMX=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y @@ -101,5 +109,12 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_VIDEO=y +CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y +CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y +CONFIG_VIDEO_MXS=y +CONFIG_BMP_16BPP=y +CONFIG_BMP_24BPP=y +CONFIG_BMP_32BPP=y CONFIG_IMX_WATCHDOG=y # CONFIG_FAT_WRITE is not set From patchwork Wed Sep 11 15:10:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3452 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AB4354355E for ; Wed, 11 Sep 2024 17:11:04 +0200 (CEST) Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-374c79bf194sf1368183f8f.0 for ; Wed, 11 Sep 2024 08:11:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067464; cv=pass; d=google.com; s=arc-20240605; b=e+pyPXfCsyAI7h/nbRB74iv37keY/h0AX8pgcEXLVmv1gF2mf/VFHju2xaLJMq5Qs5 o+ZAg8ZyzZuI/9dGO3npxf6QncFDS10RkxkalT+KvAmRktO7sGx8aHgFkvfAzxyhWiLq +by4p+UjqeN4tqOWz3FpNUmlHP/W6wsOo4SeTwbqtZieSJUp5K1Ir3gYTms7HT/Ucte5 KYCkc7Az4+lH+s/n8kRkdvdbypmP/nJF6Hma8EdM5En91L6Wzy2GBji4j27WnXZZ3/Ti I/lK/7Hg9zYX4E2DdcP1yJgx4P9EAn0dF5+V+SRbJJnMcX+498XRW5jRC7vD4tyGjTGK tRBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=yO+q7rToPplOFa45NIP2fCi9rUtXUWkZ4lB3JMo4iVU=; fh=RAh+90N7g6/BMIq6FJQi85SdEZEtNea0ptwYeLxy5EM=; b=ZGdp6HgBVtsgMxPFDvm1LYPsV/vD3TjNBIk/Bg2Qh6+DxH/wk93HAjTS/pxjx+UdI2 ro0M3eSFCcTZdKodt2RM1A+4XlYBKOVJfxWzPgi1p7Ukv/pz9b1Svwqrn69zCHznrcSX ShMny5nC0pIHahGLRQZ8meYevwZPy53H+8hWVvX2bK4STcm7wv1m1Q10YN2AK7Rejg5H ZS2Y0akMsnB0IFWYwtJeIj0/MwPu/LQuQ1v4me3ID+adZh00sxHQnOM8YvPZHA4ywnVx Y6LSHFyiaNCZu0IbWftS94Q+12VPe6AM2Q8dgcJouBGfQj7RJus57PBU4ortff+nvdmk 6+FQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JihZGqNO; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067464; x=1726672264; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=yO+q7rToPplOFa45NIP2fCi9rUtXUWkZ4lB3JMo4iVU=; b=JrVdYvbst/wPlO2DaXy1aEwDFWUi3HE3M7EAQFZSdICyv2ryRR134uBmnJR7bXxU48 E1LJRzxF1KSavIqfBUoeVWRpjy5LyBM5TOsSWxdotAThsvLHo6AYjZZ2IB4Zx2NhkRI+ lCdyE8fZR68eQUy3CWYo06bsqpKRqtWIpEpYI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067464; x=1726672264; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yO+q7rToPplOFa45NIP2fCi9rUtXUWkZ4lB3JMo4iVU=; b=Isw7dHVz9rxV3SDHJ0/TtnbnVB+2NMHLJgjCB0E3guJzftO0RchdnMZbt/XR4BYaYn fxj2NtieGMTChJD/ra/Ha8qhN3AHbGbxjrON3/PEqlHbokyuK58vhpzCmfVEoYir8GGt gXRzWvP6AgCvlYBokknPtCJuTO9ETCN3u2EjTKGGwAdRZ45n9ULfnW0F4fBvU7S1Fnmx vMuNsuGzTK5A1KTbdPHjN9S/1jfAWRJsHmk6LZdpfncMK6oclmdz/mFWn5BICHNdMy5Y PBb+q3SFH6utPKz7lY26bWxZNdt64PmLuQqTDpzpl98SLZX7fGlUpK/lRYz5O8lHANdH q1Rw== X-Forwarded-Encrypted: i=2; AJvYcCUHrKPS7ujPk7kDCNBM1LpMxG9OIxitMELzn8Z79DBLva6WPkRahxfra3agcll+MOkjNFzgLClFGR0IKR1C@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxUQUr5+6s50TMxW77jjd5OpH+DBGuSYUemFuButUmA8v8+ENoA /ESJpkC89jT7rxH64vIXJaeVyXTqPARoHvqnnomqlj8s//rm/znvWOcd0u3PwzdOvQ== X-Google-Smtp-Source: AGHT+IHbYF3WJLZfakGMU0Cjt4Or9gFboDyPxf85V0stHXR//Lx8scm2mAtqKqw3692oDYdt/SX7hA== X-Received: by 2002:a05:6000:1190:b0:371:844f:e0c with SMTP id ffacd0b85a97d-378b0791f5cmr2285284f8f.10.1726067464277; Wed, 11 Sep 2024 08:11:04 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:6712:0:b0:368:31b2:9e93 with SMTP id ffacd0b85a97d-378a8b9f6c8ls802708f8f.1.-pod-prod-02-eu; Wed, 11 Sep 2024 08:11:03 -0700 (PDT) X-Received: by 2002:a05:600c:1987:b0:428:10d7:a4b1 with SMTP id 5b1f17b1804b1-42ccd35b222mr31356805e9.25.1726067462795; Wed, 11 Sep 2024 08:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067462; cv=none; d=google.com; s=arc-20160816; b=cuk8BXeQUisH+uFbUptcgZjl78RpzG2tW6DPQlSV+SRx6xlBOPrm2YMA3roJwWLCde Qmwj2M+8W5POIf8tgs38j6WmT8j8D7KB9C89smVtSSygLepJ3LZkghc53EbnmxJsTrBC /nVjStEJ5KA5aztOH9lVeqDQXo1ITwBPk81+9VUVMyfcO7zgrydICGiiN+Qhz3v7dipk OfP23E8/k9uBu6Zubx7GHVOB9NEc0BuMVgTz7LhNVyeZvsAsX6MKaBlon77nEmQW2nk4 pMZpvDkj2SWrgi2rtKqIqDDhntzHfI9FBIe6oYJUnq3DEVDWVGcDQXJyLFMVdDZQWnmq pDOw== 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:to:from:dkim-signature; bh=y8Cn3ywTNKgStcI1e10YyY5OE7hFCy4IB472OZwKbsg=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=yfmzhijHSBbGPozN6vJ/7qukOxxoaOJ3HDneamv7m6Ugk5tmm2wkb4/YH2Wf4OSbQT mo7Nkb2GRsAL0CoxsTO0PSCe2tOSIe1udjQHdUaRMf1XWoafhDfnCnIG6a6x4bwTw7/8 we9fS/snobiepkL42DPzEAk8bJT9gd7AKcuHajeiN4wKABpCafXDNrz/O3yrhD5xuwhH X8foN9HzXUZUg2pq6tf7QzLoUJfRF22+qUkniMGtUonhEuJ4NuS968Bj6UHonsFQWT8p jiBYXjJvUGMugSDdZ1tjmCVOBFDRBW/qXeXwq6vbW6r41FQqg86nXKk9aA+ANS5yO9o2 a3nQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JihZGqNO; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2a9e13sor41325715e9.2.2024.09.11.08.11.02 for (Google Transport Security); Wed, 11 Sep 2024 08:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4e90:b0:42c:b037:5fce with SMTP id 5b1f17b1804b1-42ccd30c0eamr31488285e9.3.1726067462155; Wed, 11 Sep 2024 08:11:02 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:01 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 22/27] boot: fdt_simplefb: add a debug message Date: Wed, 11 Sep 2024 17:10:34 +0200 Message-ID: <20240911151039.2914886-22-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JihZGqNO; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The printed information is useful when adding support for the simple frame buffer to a board. Co-Developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- boot/fdt_simplefb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c index 53415548459a..22aaad9d5c5b 100644 --- a/boot/fdt_simplefb.c +++ b/boot/fdt_simplefb.c @@ -61,6 +61,8 @@ static int fdt_simplefb_configure_node(void *blob, int off) return -EINVAL; } + debug("Simple frame buffer at 0x%lx, pixels %dx%d, format %s\n", + fb_base, xsize, ysize, name); return fdt_setup_simplefb_node(blob, off, fb_base, xsize, ysize, xsize * (1 << bpix) / 8, name); } From patchwork Wed Sep 11 15:10:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3453 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 76ACD43562 for ; Wed, 11 Sep 2024 17:11:05 +0200 (CEST) Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42cb9e14ab6sf20682905e9.3 for ; Wed, 11 Sep 2024 08:11:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067465; cv=pass; d=google.com; s=arc-20240605; b=Z+k4JAnfqNf22LVBBkccVbypB522PLud5CeXa2/rYwK6+lBf4gNp1XaNXwO1fLGACD eYrCGI2iV+iriHDaPfwkRQNyMtbI8pVX0Zzb43AlFWinzzioeUXmM1JH0pIAntVNaNCv T+Rnm95aFj+B/f9y+8hvtXsCudaOEp41CTmxNlioD/rqtz7bOTSzjVl+Yq4P1n75NXBR PRBbU/ZsL0jdteeIGmaz/F3bbQ6lXMQlTW8zfS79y7qEOwewfTkUspO/TB/9RjvYxMdy JtCN3yj5brXXV3P3TFke7Qt7WYnBLGFVBeCkv7er6914w4uhaIqm/s+CYew9EaFb5aht AcKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=DcRYhecmxRt+4pS0Aj+xzpaGfhNEfwD3pMJY/3AdMDM=; fh=be4ayNPQk9GB3Kuu8/996a7pOFcaa6bAyDomGdvffnU=; b=QptsMHLtqiqATNZLh/9Xz07FpwjkKOO1EBQACbz7fn1mN+Zkd4czJBwQ95QGXnj2Ap LLpN5mQOH24K3WNM39V10yPxV91eNPN9irgU/OcIvq19pzxYIWNHpS9JmBdDJs4kMFi4 hIjQ21whoxOY8JfFCNa/wrY0gnSeCG7Dn/lowA0PiY9qL8rOhGbRU40umCQEA3DxnIRG 78nClE4zGZiKX8lNFn50uAClb/4GB2QSDCxek9h0zDDRF+g2hEeBZjrVzLubdbYYUZG1 5bCvG/rZGhZnvN2HT4RDHOslaEBmY5aoX/+rWAMzSKhddjp7SdEngXZhtM8T4O/7Magz BfaA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JqgsZO5X; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067465; x=1726672265; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=DcRYhecmxRt+4pS0Aj+xzpaGfhNEfwD3pMJY/3AdMDM=; b=riIAOxt6eeI5chWNV4Irp4hv57E/3hxrRYpR/LVMLQ6+IyOSlMe8M+DEFLv1KEn31J oE7ihGByQxWfQ/qGA9ENVU7KWTpIEgBTa1/1BZ9lWnXURzg3Mn6MVIuAjDqFrTZCcYrF HA1CeHpfISHCDufEz4DDV1fRbVDlyO90Rjd8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067465; x=1726672265; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DcRYhecmxRt+4pS0Aj+xzpaGfhNEfwD3pMJY/3AdMDM=; b=UVGbOe/DBQJsIpEDOnRCKbziobNAtMrWAY4QYxblKQrRCCkP5Ozck6kNPoC4x6CgG9 STU875PMlFlZG9/fL+DOGG54qGPkVKozUS9vcxLImmgphKLjY+mDVCzRTpwRl42nlce/ eRAUbWzuEDN/Ecda76nVFl1bw/g6GidI9CpTQFYvXbJS1YMRw7Z5aTYq/jsA4wK3YZAF 6KsQI1yyg7Ely4olqxgDHZU9HqZy/7bXY/SfOZvzjH8B97eqv6X6RaZHBarF2zLjWnEV pivzXV/V6Kip+g445xd3WKBE/ubIIB2+Kkttq/nbisH8hrb8RcWjRtYLeD5utUuPi5bR 2QFg== X-Forwarded-Encrypted: i=2; AJvYcCW57aLMhZu2d8Nxkty3jd1Bq1H5eycGd5xW2rY6fAH6lzHAkFHKskwdB+gKZUNSjLIQDanaIw+u7rPjVOwS@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwqqaRG72HpNZnoFpob5Kt1Qp4wrhQpt4rGej6s4UazA+gla9Q4 IXM6eOl1chxJ7K+AEh/da1XEy1IPukgsK3miR7ELI3ooAJMorL4m3Z2VzrkPJLWQhg== X-Google-Smtp-Source: AGHT+IFhuKmyoz6C8UqWnneS3eTRjfiIrO+VHHz4k6FB7VXAtIaY8PFFHGnatuuvELAuiVcC19pZQg== X-Received: by 2002:a05:600c:5246:b0:42c:b843:792b with SMTP id 5b1f17b1804b1-42cb8437b03mr79198495e9.2.1726067465104; Wed, 11 Sep 2024 08:11:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:4fcc:b0:42c:b0f2:87f7 with SMTP id 5b1f17b1804b1-42cb0f28b2als19204375e9.1.-pod-prod-01-eu; Wed, 11 Sep 2024 08:11:04 -0700 (PDT) X-Received: by 2002:a05:600c:3b29:b0:42c:bae0:f059 with SMTP id 5b1f17b1804b1-42cbae0f243mr67682955e9.5.1726067463669; Wed, 11 Sep 2024 08:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067463; cv=none; d=google.com; s=arc-20160816; b=RB8Ls1ZAUbvzkSdIM2QVU6a8X0pJq/IpntFhMCqGiMpdYPTFyG54z15FIQwyfLZVcp RkNohUtYgE7twLo1QeB+1wsqHhYYzrwEM4wpTnQaEdJcn3D4/XqS3Dhu4273NcxnE5nK UTr8eVwDiFJv3rbDXhTTW/66jTjZjFWv8aMeaUfflygFs9bQ6aVxVf+dGONzlmR9k6jK ds3B5RdXsRgb5iOdSW8D37XOOu2WFTf8GGG7rA/IjHM4uX5rBzF7xE4jqRTUoq0g78lG Qo7FlaITfE8AfAzU/UQfd1wohUdrl4+3ZqMs14I1ES9Q88qme//VIQBo7d7CFTMn6wkB zPDw== 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:to:from:dkim-signature; bh=ALh9R2Q2/nmneDvWCm9dK0rj17eHj1CtEQoS84jlZJc=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=jhVslk1YWOqx1sE4hlo1VVbBUwZNFdgjHuddqJLefMyqeMzXqFDv7vxLkmYTZQWhQT ZEVBSE/V5EpQYnbPv7VqkwlG1p5SGzxhRAEOwVVzBC9gEMreBM0vBJE5swkz5KTxsHpy jiF1kvVmFqDliHLf/gdbcu5AI5LEYg+ZedM8w2Bgeal6mHgIocjXnn4GEYmAsJlVM3sy RkbOC6NDXKkNZZRqUOwponTB7rHIhCW29gnGDgFG90RxYtWp9CnVlO1XW88EjjnjwVWD rS9I6VZ+ldumXWP1dLwnQ+eqWRyJNTiFezb1NKBwpTfn+xV9vb0c6comD4Z9ok7m+T56 GU6g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JqgsZO5X; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf308b12sor35782455e9.12.2024.09.11.08.11.03 for (Google Transport Security); Wed, 11 Sep 2024 08:11:03 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1d0f:b0:42c:b4f1:f281 with SMTP id 5b1f17b1804b1-42cb4f1f41amr90384215e9.34.1726067463002; Wed, 11 Sep 2024 08:11:03 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:02 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 23/27] video: mxsfb: support simple frame-buffer Date: Wed, 11 Sep 2024 17:10:35 +0200 Message-ID: <20240911151039.2914886-23-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JqgsZO5X; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If you want to pass the frame-buffer to the kernel, the video output is initialized by U-Boot, and kept by the kernel. The patch does not turn off the power domains or reset the peripheral if you want to support such feature. Co-Developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/mxsfb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 4186ccd00209..254e470230c7 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -424,7 +424,8 @@ static int mxs_video_remove(struct udevice *dev) if (priv->disp_dev) device_remove(priv->disp_dev, DM_REMOVE_NORMAL); - mxs_remove_common(priv->reg_base, plat->base); + if (!IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB)) + mxs_remove_common(priv->reg_base, plat->base); return 0; } @@ -447,6 +448,10 @@ U_BOOT_DRIVER(mxs_video) = { .bind = mxs_video_bind, .probe = mxs_video_probe, .remove = mxs_video_remove, +#if !IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) .flags = DM_FLAG_PRE_RELOC | DM_FLAG_OS_PREPARE, +#else + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_OS_PREPARE | DM_FLAG_LEAVE_PD_ON, +#endif .priv_auto = sizeof(struct mxsfb_priv), }; From patchwork Wed Sep 11 15:10:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3454 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 7AC814354D for ; Wed, 11 Sep 2024 17:11:06 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cb0b0514bsf36709435e9.1 for ; Wed, 11 Sep 2024 08:11:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067466; cv=pass; d=google.com; s=arc-20240605; b=glN15aZgZEtnGtb3EkSeEvvDNEHBag90iPNF6YLrV0Rwxt+z7pFIhkDZ2PWpdLptca OZOBZa/DWsoxCnMFbPv5uk7wagYNa0nTnblngFfcHTMDkb75IOtn3brddzzGjdJicM9O sz+BXqVyq4xrFsuMt86h6rwGZUJhJjPG+xClbSf4R6eq+waYp+Kdb4lD8yE4Z2pJOltx QTaCvjpg69vgWC+MwR3xNNgrZpy+/pLJ6lm3WOPinkKMbMH9sMly7jtT8x06GJmsRxsX Dz4azxjQOKqfig0ES30XlSxw6vTdhdzlkn38YkDiFhAYyHntxVHA3PemXu87qXkf8+2p HMJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=DjOKZ9vyLpv5X/MDfj5W4v4VrilDVZDK5DqqEBkpcPk=; fh=044EVVmxQN2hd8Uw1bloaPxcoEjxUqjOyJBhV/y1p0c=; b=iT5xEAiUoauN+PD46B5a1PAsbvLNshZ0pLxbXM1Xclj/7AlhKRv/nqhnO/Ckvb+KuF qlVwFc+kJZYeDQpcZYRud7SaU3RYlo0oSk/ZNduLGsfeBVFKa2zRV5dLGWS0jJc0o1zs vKzQlkKXXTwj5veC9xHYQFQqNgKnb0/GU81FW6RgKxQ+XF2QLy8K+YSnd8FldC88y83x WgpT9yBGGXjyrl94eGDIDanOg6/DDiplH+/7j47OBctrpeBGr7C9XI2VbLWWkfmrCMlO Ityt4ZlkeS1oi0OuDlo+QFrcNe4rume4jx8a9FEbusSL/ChFnJ1NIraetcQGo86GHDJX hRGQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NfaJot5g; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067466; x=1726672266; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=DjOKZ9vyLpv5X/MDfj5W4v4VrilDVZDK5DqqEBkpcPk=; b=CFlL+kp0Jjsg5Fw+aUhp8J0XtsS4VayqlCjWKDsmbQsaG/GpfUy0vaPpeLfMIX7Ywq tp56iuiOQaAh963q3Z5sz6Uz8EmDRXLJyHM+OX3EXpA3GtYIDfiz4U2nsidabYjEXquI LZhr89rqC8SLPleiGHwx72uCQCtgXLm4bzKxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067466; x=1726672266; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DjOKZ9vyLpv5X/MDfj5W4v4VrilDVZDK5DqqEBkpcPk=; b=dWlOakL5u52u9jEoHN3JzHyMa31sEh70g4LvbBv0CJjb11baFXu+GIvEkuo1RclIpD 7TzvLDH05zBZNSUfAEJKg5dkWkPPJESzdqKshY9qTYWzeD29pCifJLTgOY8k+78pb2K4 /wp2+i3Whjct+v2FXDvgtQosqwGeg8i/eTOm6/K+O7G9fhYTnsNW/A+FoxUevXZGXrfv GtcIzcPuYGa03UElt80zbamD70cp4lbiQfpdnENLC4LjgyYcVj3cpvwSr/FfwDDka11g QDbf/AhIplJsAMVGv1IPULA7AnGvcgOl9fDsP+MniOkfZHffunqpk11jRuXHzutb9qDu FCKQ== X-Forwarded-Encrypted: i=2; AJvYcCUnsF7VgGKw+zrcfQnigL2wmsVVJZL/Rm6Km9bnvLOWLYzw9y2/z7FrOxD3MKUXnNJ6EIRWiNmCWsN/Q8HB@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxnQT3W1WQIk7/ErhpFbQXyyevWWa6gb4GLIQL6t7V1wBbESN14 os596TdfaCrmCORJt3dEeHqfFncM9qgAO3mRdFoHivDz3goN8a6MeVgwLGQxRgEbHw== X-Google-Smtp-Source: AGHT+IE9+PkTZF1bmUyLZ94pWB1EinpxZLzd38H0MZuwZC8E1n2i05UEoB9XKIIjPSnZ2Ssi74T31Q== X-Received: by 2002:a05:600c:4ec9:b0:42c:af06:703 with SMTP id 5b1f17b1804b1-42caf060a7cmr115995275e9.31.1726067466057; Wed, 11 Sep 2024 08:11:06 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:2d03:b0:42c:ad31:3854 with SMTP id 5b1f17b1804b1-42cad313adcls18241605e9.0.-pod-prod-09-eu; Wed, 11 Sep 2024 08:11:04 -0700 (PDT) X-Received: by 2002:a05:600c:4f8a:b0:42c:cd88:d0f4 with SMTP id 5b1f17b1804b1-42ccd88d30emr29889265e9.22.1726067464548; Wed, 11 Sep 2024 08:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067464; cv=none; d=google.com; s=arc-20160816; b=K9qefLylxAQU7ttRUSmDawMuVFkDNpCm+kwqY7QNWAd6kKqSbIrAd5t4smn8hTxgrs 5HcYILrQErd0IdhFCxgrLCGHojdlv2YdlG/J6tQFLEhTroHfMYa9CMEe41UVoU8aK7To IH5qoMEphe14T9w6B8swiN3B3ks6OoGeHFxH0zDI2utH0WYP3B9esLUqIlTWkDYuw3ZS JLdNjNlbHMyFdPNjbcgt4ri4b5YWwutKRRCFNRariKzDomT8jemzDVCulejIENJd/Wm9 MSO+X49LYayBJk6zAVQIrnwNzs0zZwkxqGrWqZwYJO3RnNkERe+B59egCpHopmNwkpPE 67XQ== 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:to:from:dkim-signature; bh=K3ZlEaLv20JF4KYXi9FV/6iNqYvymJIuA7pyrzR+jKE=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=eJfLFLK3tQbRZvb9fjRI2QEu+xVcrAjD8ksGWAbnqnKyq8pnx3zQKDhS3x+kjvXliI HYkt9zN6RGOJtoxNvvkLTXMpMZmZ+lJyNSR7hddTH7LudFCC/dRUJPWRaSg+RObVLDs1 v56u7fbPOENtQsH8dhDWXC1U+L/IwFRcyoi21B1lpC7/9xBF+c9HGx3aZeDjQft+JO7q +86b25+Ctk3tjzm2ogFdWrOl2ERaM7+dnYqSuh7dOh4/2O3MufZ7lk3ISx7YVNv30zR/ xEyO8Kb+o+9QwE0QPVKlx/KWQjqobKZMlPCz77jkGcU2G/++pg+wcntf9YhmYrZdp/W0 zruw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NfaJot5g; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2ab4d6sor39548335e9.2.2024.09.11.08.11.04 for (Google Transport Security); Wed, 11 Sep 2024 08:11:04 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1ca0:b0:42c:b995:2100 with SMTP id 5b1f17b1804b1-42cb99524bcmr72507865e9.6.1726067463827; Wed, 11 Sep 2024 08:11:03 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:03 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 24/27] video: bridge: samsung: support simple frame-buffer Date: Wed, 11 Sep 2024 17:10:36 +0200 Message-ID: <20240911151039.2914886-24-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NfaJot5g; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If you want to pass the frame-buffer to the kernel, the video output is initialized by U-Boot, and kept by the kernel. The patch does not turn off the power domains or disable the peripheral if you want to support such feature. Co-Developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/video/bridge/samsung-dsi-host.c | 9 +++++++++ drivers/video/bridge/samsung-dsim.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/video/bridge/samsung-dsi-host.c b/drivers/video/bridge/samsung-dsi-host.c index dd3e33c4edc7..2d0e8f71a756 100644 --- a/drivers/video/bridge/samsung-dsi-host.c +++ b/drivers/video/bridge/samsung-dsi-host.c @@ -1281,6 +1281,7 @@ static void samsung_dsi_set_standby(struct samsung_dsi *dsim, bool standby) samsung_dsim_write(dsim, DSIM_MDRESOL_REG, mdresol); } +#if (!IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB)) static void samsung_dsi_disable_clock(struct samsung_dsi *dsim) { u32 reg; @@ -1294,6 +1295,7 @@ static void samsung_dsi_disable_clock(struct samsung_dsi *dsim) reg &= ~DSIM_PLL_EN; samsung_dsim_write(dsim, DSIM_PLLCTRL_REG, reg); } +#endif static inline struct samsung_dsi *host_to_dsi(struct mipi_dsi_host *host) { @@ -1515,6 +1517,12 @@ static int samsung_dsi_enable(struct udevice *dev) return 0; } +#if IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) +static int samsung_dsi_disable(struct udevice *dev) +{ + return 0; +} +#else static int samsung_dsi_disable(struct udevice *dev) { u32 intsrc; @@ -1532,6 +1540,7 @@ static int samsung_dsi_disable(struct udevice *dev) return 0; } +#endif struct dsi_host_ops samsung_dsi_ops = { .init = samsung_dsi_init, diff --git a/drivers/video/bridge/samsung-dsim.c b/drivers/video/bridge/samsung-dsim.c index 986f1d830844..6e5a12218315 100644 --- a/drivers/video/bridge/samsung-dsim.c +++ b/drivers/video/bridge/samsung-dsim.c @@ -144,5 +144,8 @@ U_BOOT_DRIVER(samsung_dsim) = { .remove = samsung_dsim_remove, .probe = samsung_dsim_probe, .ops = &samsung_dsim_ops, +#if IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) + .flags = DM_FLAG_LEAVE_PD_ON, +#endif .priv_auto = sizeof(struct samsung_dsim_priv), }; From patchwork Wed Sep 11 15:10:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3455 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9159B42E8A for ; Wed, 11 Sep 2024 17:11:07 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cb940cd67sf29964035e9.0 for ; Wed, 11 Sep 2024 08:11:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067467; cv=pass; d=google.com; s=arc-20240605; b=eWwWgml4vRwifVDonK2f9p8iFjaE0LyOjRqWkFrOUn46QMtc99/507IEDWNI5LDne6 yqvpBR7xvdu1c7qcCCs1bxsDy2L/wTgoXBjiZPcr8hzue6QH4IiHmdRXtuHTBTRgX9rE CNEgkks8eM2ASYtempYKKZKnHbafPuc1kz59DLWhyh7w8G2f5KVuh9eQjkmelVacEdFp pLdb8T2dlAYD9RhoZ+UkkpPZpSmBeazpMqKRYt3lLo3ELzkKK6kXxB60aYiKoWKNlqCw eKxg2LhgFkIkSzCIEfVsf6Nc5Y/H95Pps468C6JrFWRwa44LDVnpux42sHSpboSZ3YTy v/Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=jIytob1JLGwMBnloa0lPwbV4ant84b5RNc9QjHFAD4g=; fh=RcMz3lLJ+ydWayN9jVq2Oj9HFrvWj93lmAahPazGtqU=; b=Tke6goBgXKSKXI/SZCTvDoHQivXpvDZTR2uCLFjC/duRbKi8/iS8sQc7jSKzt7gojb IRJoR1mcffdoor3UxlSlCe3+Y/CwxzjbDGndwQ+pzPQlwo8WWILV/nO6J9bG8by1ei3g BeGrGb/EyZysokGeuWthE49uMynpv/o27iA6ssMx4VF+n64IXSIZwZX29KzEuTthFdL/ Sas3a3NvRdYqYi5dFK2HrkpNbrMVGYRBMZbaV6jbaVsnn/MC7Skea6tHB+Q5LH7r4VTU 8kd6hhubPaHFPRrrU+BkfheYt333cPSsngH4OwyB08bsCKtMqz8aHovLEzEckPUCRZAs Yw5w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p8krCr3B; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067467; x=1726672267; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=jIytob1JLGwMBnloa0lPwbV4ant84b5RNc9QjHFAD4g=; b=pyaLy/u7lTBPdSEKnSXYi+kbA6P9PkpJqMsqoZx8BoCfz9PLD41PmdHNhOXBPGRj6X lxoah4SF5OPf04MEWgS61NWGb2rEQS6eMLMSzxXRDZoilmBo2kVPDxY4uI7xWHBIYL3e 7MDSQd1cPTO2yIJKSabxUr+puqhVru9xchfh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067467; x=1726672267; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jIytob1JLGwMBnloa0lPwbV4ant84b5RNc9QjHFAD4g=; b=vvtM4W4ydDkO0yKEdo3YnNO0E4eWQuw0qdLgAgFJrjc1zLTR08B286B+JblVdc7tnc T5TPLYXlSjwY7OTCp8AEBYcZa5qep+LrnGetPpCeHOqbmEYKMFABzKinjEPl1EB3pi4L WZ/ST0WN8akJb02+XfeSzgqesbo36UgHi0yCg9ahLQWpong3wEd0/1gtekAsfHyndTg5 lQ5rRHBoZqD3GOZNi1jC5A2vHEwWPPMRT0imOvtQtVQTKLFF03wwwtcEM3y/FzvDblCs MFwfV9lYSxvrkngSelOkKVQILjWau9AWIiPzjfyln9JI62S3iEAWjWi3lNZY8KzcB14l zvSA== X-Forwarded-Encrypted: i=2; AJvYcCWIuBwUKpysqYHS6Occxiuc25czgv/+E9qjR4gY28ZBz739S4h0dWJcuaKfhpW3vl9XeOCW4aXZBl7syZ7z@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw9IyOJBSapyUFuLzAuQ+QqmTu93JKfUBnQqjRZbGbfh8aOyVjF UVN2AbmrltY1oSUnZoZxvIPxTqLHvEHNvqFiBs1i25pZgnkLMBT0GabAcE78cP1GZw== X-Google-Smtp-Source: AGHT+IF3fYktowLo/5XoMafu9zFTco7C/tSHH4kI+1lWVHStiXPkoiO1Z7JgDJ/RO7u1z0Mwt84a/Q== X-Received: by 2002:a05:600c:1c9f:b0:42c:bcc8:5882 with SMTP id 5b1f17b1804b1-42cbcc85cf9mr78104565e9.7.1726067467139; Wed, 11 Sep 2024 08:11:07 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b93:b0:42c:af5b:fac1 with SMTP id 5b1f17b1804b1-42cdb16c789ls111805e9.1.-pod-prod-05-eu; Wed, 11 Sep 2024 08:11:06 -0700 (PDT) X-Received: by 2002:a05:600c:1c9e:b0:42c:b508:750e with SMTP id 5b1f17b1804b1-42cb50877femr112595595e9.11.1726067465737; Wed, 11 Sep 2024 08:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067465; cv=none; d=google.com; s=arc-20160816; b=Oxmz0WN35KEK9C2/y9+3qZeZbZqke4Q5ePd7RbXWNCdOngWKmqpbZdwVZBr3NkO80b ltCNMo8YrgZk0ziXrr4ItUCwRJ2Tjz1o4s9sW13hGdHiBF/2uGUnua2oPY7xL4o9Qq/F mzRqB6yT6rhjvzDdLv9nW7J1BZn8WoGHTuMg1aUvMtDtopfEvSKcoTzpHdbUItlWMtSg b2G4CWdxWDhGUhxSCza4ZM7O10M7wFznNMDLvDKGGrhLF3YXh+1+ZPAVEYcDvieq04gY xOumyvOHVKTxJInC2aEM1OMEbR32+IeUdopDhokETh51JsLOO3GIDO4qOgMsTtZRpplq IxPg== 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:to:from:dkim-signature; bh=jgSUdG7rW0Jf1oZnwnMTlSi+xK7g1Ded7BTigAFFf0Y=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=kOVCmspGMhhMKRTABOnPxO3rYcIAW6S6UeG9ugw6sMRtoyZvIO6RAUBYca9vsHOOqU buQN+FuELirsaDTVjYGM/jDDLTr8eOXUBZL7wRIDyLqN5bwJdwPTmABQTUFigpkF8JCe dDnfmd05JfpvLq3XF5FNbkmZDq++cGkvXqtak6nMCr3IbIgQt3UUIkeTkvxPLVXSjDDT qd/cjvgRrGrK96/iG0aYTzO1j7jOpMTInm9wDi7RQIyZq58Rt4aMczvEMzBQbZSeX2aP e35eckyKpH78sKm4lm92tzMwyKtmceN9oJF31RHNe0BHoGAtn/FokmiHyNv4R5Noj66q LQYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p8krCr3B; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2e1e74sor47367835e9.9.2024.09.11.08.11.05 for (Google Transport Security); Wed, 11 Sep 2024 08:11:05 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1d24:b0:42c:bbd5:727b with SMTP id 5b1f17b1804b1-42cbbd57a08mr91888915e9.25.1726067465018; Wed, 11 Sep 2024 08:11:05 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:04 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 25/27] imx8mn_bsh_smm_s2/pro: support simple frame-buffer Date: Wed, 11 Sep 2024 17:10:37 +0200 Message-ID: <20240911151039.2914886-25-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p8krCr3B; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If you want to pass the frame-buffer to the kernel, the video output is initialized by U-Boot, and kept by the kernel. The commit modifies the device tree to be passed to the kernel just before launching it, to prevent the kernel from reinitializing hardware that has already been configured by the bootloader. Co-Developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c | 98 +++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c b/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c index c99896873991..fe2f91b82a2c 100644 --- a/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c +++ b/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c @@ -5,6 +5,8 @@ #include #include +#include +#include int board_init(void) { @@ -20,3 +22,99 @@ int board_late_init(void) return 0; } + +#if (IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_FDT_SIMPLEFB) && \ + IS_ENABLED(CONFIG_VIDEO)) +static void smm_s2_setup_simplefb(void *blob) +{ +#define DT_BLK_CTRL_NODE_PATH "/soc@0/bus@32c00000/blk-ctrl@32e28000" +#define DT_GPC_NODE_PATH "/soc@0/bus@30000000/gpc@303a0000" +#define DT_MIPI_DSI_NODE_PATH "/soc@0/bus@32c00000/dsi@32e10000" +#define DT_LCDIF_NODE_PATH "/soc@0/bus@32c00000/lcdif@32e00000" + + const char *dt_addnode[][2] = { + { DT_BLK_CTRL_NODE_PATH, "lcdif" }, + { DT_BLK_CTRL_NODE_PATH, "mipi-dsi" }, + }; + + const char *dt_addprop[][2] = { + { "/regulator-3v3-O2", "regulator-boot-on" }, + { "/regulator-3v3-O3", "regulator-boot-on" }, + { DT_GPC_NODE_PATH"/pgc/power-domain@3", "fsl,boot-on" }, + { DT_GPC_NODE_PATH"/pgc/power-domain@4", "fsl,boot-on" }, + { DT_BLK_CTRL_NODE_PATH"/lcdif", "fsl,boot-on" }, + { DT_BLK_CTRL_NODE_PATH"/mipi-dsi", "fsl,boot-on" }, + { DT_MIPI_DSI_NODE_PATH, "samsung,boot-on" }, + { DT_MIPI_DSI_NODE_PATH"/panel@0", "syna,boot-on" }, + { DT_LCDIF_NODE_PATH, "fsl,boot-on" }, + }; + const char *dt_delprop[][2] = { + { DT_BLK_CTRL_NODE_PATH, "assigned-clock-rates" }, + { DT_GPC_NODE_PATH"/pgc/power-domain@3", "assigned-clock-rates" }, // pgc_dispmix + { DT_LCDIF_NODE_PATH, "assigned-clock-rates" }, + }; + int i, ret, offset; + + ret = fdt_simplefb_enable_and_mem_rsv(blob); + if (ret) { + printf("Failed to enable framebuffer DTS node\n"); + return; + } + + for (i = 0; i < ARRAY_SIZE(dt_addnode); i++) { + const char *path = dt_addnode[i][0]; + const char *node = dt_addnode[i][1]; + + offset = fdt_path_offset(blob, path); + if (offset < 0) { + printf("Missing node %s, err=%s\n", path, + fdt_strerror(offset)); + continue; + } + + offset = fdt_find_or_add_subnode(blob, offset, node); + if (offset < 0) + printf("Failed to create node %s, err=%s\n", path, + fdt_strerror(offset)); + else + debug("Add node %s:%s\n", path, node); + } + + for (i = 0; i < ARRAY_SIZE(dt_addprop); i++) { + const char *path = dt_addprop[i][0]; + const char *prop = dt_addprop[i][1]; + ret = fdt_find_and_setprop(blob, path, prop, NULL, 0, 1); + if (ret < 0) + printf("Failed to add property %s:%s, err=%s\n", path, prop, + fdt_strerror(ret)); + else + debug("Add property %s:%s\n", path, prop); + } + + for (i = 0; i < ARRAY_SIZE(dt_delprop); i++) { + const char *path = dt_delprop[i][0]; + const char *prop = dt_delprop[i][1]; + + offset = fdt_path_offset(blob, path); + if (offset < 0) { + printf("Missing node %s\n", path); + continue; + } + + ret = fdt_delprop(blob, offset, prop); + if (ret < 0) + printf("Failed to delete property %s:%s\n", path, prop); + else + debug("Delete property %s:%s\n", path, prop); + } +} +#endif + +int ft_board_setup(void *blob, struct bd_info *bd) +{ + if (IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_FDT_SIMPLEFB) && + IS_ENABLED(CONFIG_VIDEO)) + smm_s2_setup_simplefb(blob); + + return 0; +} From patchwork Wed Sep 11 15:10:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3456 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6FBDF42E8B for ; Wed, 11 Sep 2024 17:11:08 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cbadcbb6esf17482725e9.2 for ; Wed, 11 Sep 2024 08:11:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067468; cv=pass; d=google.com; s=arc-20240605; b=Wdjtzc0C+vVDRfXKk74Dm3oEqJTIcZ55BdsMH8+1QG+vkcPF48osFS6PzbDP0HP5aP s7OJTkxV/ZNfXRLhvN0rnHLoxNjyck4Qa/oXQj0MlZizQx3CIDEFzpGLTH/miVozSDI3 bW/sWatL/UqjLJ/k5fz3I1UVruh6vXggAXjClMz4ysbFJhR7zsuBOecACsoXl2Yud2jI UJ6CK2zGWwO+Q8EjLqmp4VvIc8AjcotWfF0GjTKSIRlqujPhB29NhzJjvBJT2IXYKiM9 RpvFW4aZLJjI02/ARvspFMC5hr3vw9EqD9Vi3u5+TWoRgmRWlMRXYK4pRj/4IG6ayR7W 31mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=46SKgX7L4gIOVffSvyGWqJ476yCICsK0QfmeX4sK08Y=; fh=FzGk0ZfEHqEftjTrAXwnzKy+w/J9/sX5t8YpE4qA+k4=; b=dTjiyhGf+GPtFv1zfA7Vs8IGBX4aYFvGBlq7xeDAWSiRBvan7RMxsNq2zDPNlu4/8O i0D7+wxK14u/sG3mtAh88XElv7c9NLkJNgmi1j5zijqdPzeoww5xFE1IuUD6kA6IV6y5 MgV3XcoiC7NLVGIpaDHfvA3QvC+/AnBKL1xg9X0orrQis/Mf81JnNmrR8dIV/iIRZCM0 MSpqyNloNVT/AIJt7OFtNoEE01cPOKaK92iBPp8Z4QF/0houPYq2Di6tK6b3GjuomW7s 4LKmZdvJfS60FHzKQ1eJubIEqKZj07g8DYXG1WGxqojMYx6fO/auPx/3LoZAfyZNyDjf k6ag==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZKmp4kAu; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067468; x=1726672268; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=46SKgX7L4gIOVffSvyGWqJ476yCICsK0QfmeX4sK08Y=; b=AQ3uN93Kb16foY9f/WimxfWPRdSZHW1Uiz4O3KlzWg6vCNWZ4GtTQu6dkIYt3YWwcF Brw4h3eV1lGkpJufdvk1iGW4QEDNIUfMlNySJRpHh5jD90+MxIY/dnDUG5ieMz1eq1QE C2h8dJyzm0b3w09TvhEO04gQxkRrjAxlr5kac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067468; x=1726672268; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=46SKgX7L4gIOVffSvyGWqJ476yCICsK0QfmeX4sK08Y=; b=PjxD9sC7a0+pwr9LtF0p4q+VttGAOZshPylhtpWnOGdGw2YXwqX7pahDwBGgWPqPlC HyjpJfmCuzZrOVLDU6B4Uca9NGfJi/AwGQIfjGXAR1ak+UKGcTiHDf52me1MSBDRejjJ ay0Url63zrgtQ/6uCe4aoiPZdeTFmwnDNzESfe0hl9KhaBp7VgdqVQq7LB9SrXoKLVnL 0KpDTLba3xHD3FnJhuzhaavQLq3LAmoUvvoKVrL+ZMRkGQun4DGBDIYruyLRvbEEMVzu BDFFkU+BNgJxH7E9P7ulvHzgepkYed/eMT2aVWARiotcz9tYi/9ZvzLPonKStgxpeeFL u6iw== X-Forwarded-Encrypted: i=2; AJvYcCVJD3B7LSsP10F4Q8B+m6sZayo7My2vTxa+RUJBaP5FHC2JQaQE0Wz80TqjwmBSJKLVRS51M69QTgZ+x/ME@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx4RadL0yLcE91aEQrhzH9v2tBxrjdHEZVqwEUNCU/U6SESTEKI isPGV2S5gW+eIJjDya51tSAzvqCEDd2ZIURSvAODob2l2rNSpIZYIam2jS/UAxd+Tg== X-Google-Smtp-Source: AGHT+IGzPHmzAvI5KF1d1A5dxESHYDnp9lZ0WXSYl7ViqRJPoNGhMKZMCTgKgUvWHbMjZY4OQm2K+w== X-Received: by 2002:a05:600c:4ecf:b0:426:66a2:b200 with SMTP id 5b1f17b1804b1-42ccd29c3cbmr29931885e9.0.1726067468079; Wed, 11 Sep 2024 08:11:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:5f56:0:b0:374:c9ad:49bf with SMTP id ffacd0b85a97d-378a8a8fe7cls1139324f8f.0.-pod-prod-02-eu; Wed, 11 Sep 2024 08:11:06 -0700 (PDT) X-Received: by 2002:a05:600c:4f4a:b0:42c:bd4d:e8dd with SMTP id 5b1f17b1804b1-42ccd324f99mr27139015e9.11.1726067466548; Wed, 11 Sep 2024 08:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067466; cv=none; d=google.com; s=arc-20160816; b=chQuwsIx4VGFIkLOmy1M2WHXnNJQ9kVFRJ3AC9W9tG02+wg2GuD0hRY36OcqLAYMSn zZGgATxTqJ76Dd4lvFkIb6/jr5cmDS8UKyD6U/8J6+YGrIy5NmyOIrup03QUdJolPeWx j4PMC8PYvx/64yphxTwJgHSYyjh/s0g/PW82P6d4rQHiia6BiPMrPxvpQSOzboi7zUs3 TbyFIXTWU+Li5/RAazpSRyL7L4TkTQvBl0hdYyE+tIO7iaT1ujzF5vnRLKjJEAKcD9GH ZPJONt794qW1XZGB31WX7u4vER3LOaAuIe9Pezsn+KVSik/AeFLf+Lz8bpqPKvEjtWKH 5tlw== 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:to:from:dkim-signature; bh=+ZDyTeWn8uFnHqOsNNWx/VRun0cW6e0ee3mn+PAmXAc=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=OkwUcUErsCEMIkkwV/WDALJw4EGXEeU4YYjaZceRD1+gV9nA6rIcYIHYvS3XQQm8Oe ms5+hb9XrrngtoWh5WyqYSKAYEEenwu9ivmHafkga2CPmSR5mIlYo37ZXORyVlHZ+Thk T1eS0MGVlJleAAYn1f/oeEpv5GosP/MkTGQuT6HI8Dkhs3ygn2SLr8t6YMvegYJEitKH LH+w3Z2HVRV043/qWXaDeCekz42d9o1agUnT17B3H3n7rvY4B2ULOqDrBoP/GJPvjtfb AgbE8NyD1jQXbMVtHPR4sCMCWWxwf0NGAH1C3EU0k6+rwRvtupbyG0fDvtVCTjS3WvOD Q3Tg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZKmp4kAu; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2b1ad8sor41347995e9.5.2024.09.11.08.11.06 for (Google Transport Security); Wed, 11 Sep 2024 08:11:06 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4e90:b0:42c:b037:5fce with SMTP id 5b1f17b1804b1-42ccd30c0eamr31490045e9.3.1726067465951; Wed, 11 Sep 2024 08:11:05 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:05 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 26/27] imx8mn_bsh_smm_s2/pro: enable simple frame-buffer Date: Wed, 11 Sep 2024 17:10:38 +0200 Message-ID: <20240911151039.2914886-26-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZKmp4kAu; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Co-Developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- configs/imx8mn_bsh_smm_s2_defconfig | 3 +++ configs/imx8mn_bsh_smm_s2pro_defconfig | 3 +++ 2 files changed, 6 insertions(+) diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig index 2fa8bc22747e..4982b58407c6 100644 --- a/configs/imx8mn_bsh_smm_s2_defconfig +++ b/configs/imx8mn_bsh_smm_s2_defconfig @@ -28,7 +28,9 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000 CONFIG_SPL_LOAD_FIT=y CONFIG_SYS_BOOTM_LEN=0x2000000 CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y +CONFIG_FDT_SIMPLEFB=y CONFIG_DEFAULT_FDT_FILE="freescale/imx8mn-bsh-smm-s2.dtb" CONFIG_SYS_CBSIZE=2048 CONFIG_SYS_PBSIZE=2067 @@ -124,6 +126,7 @@ CONFIG_VIDEO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y +CONFIG_VIDEO_DT_SIMPLEFB=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y diff --git a/configs/imx8mn_bsh_smm_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig index b6b62b9d53f9..7ae99adf7fad 100644 --- a/configs/imx8mn_bsh_smm_s2pro_defconfig +++ b/configs/imx8mn_bsh_smm_s2pro_defconfig @@ -29,7 +29,9 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000 CONFIG_SPL_LOAD_FIT=y CONFIG_SYS_BOOTM_LEN=0x2000000 CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y +CONFIG_FDT_SIMPLEFB=y CONFIG_DEFAULT_FDT_FILE="freescale/imx8mn-bsh-smm-s2pro.dtb" CONFIG_SYS_CBSIZE=2048 CONFIG_SYS_PBSIZE=2067 @@ -113,6 +115,7 @@ CONFIG_VIDEO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y +CONFIG_VIDEO_DT_SIMPLEFB=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y From patchwork Wed Sep 11 15:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3457 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id A31794355B for ; Wed, 11 Sep 2024 17:11:09 +0200 (CEST) Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3771b6da3cesf3564131f8f.3 for ; Wed, 11 Sep 2024 08:11:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067469; cv=pass; d=google.com; s=arc-20240605; b=lzRNnoVd3Tp8bQxhzCUIhvK49sO6ayqTN+XPs34yBWLr7hYKwWbagZSkNgJOFhuAqv d/PazdcHqEw66L2oAV8iHykOdb7uHPQb9Y65wVzykJlv2c8by/IiF6MGz0J1EKiNoyGl CD23KIc8tyw3YKvjHZJCC5hOQrVBaHOXh278DgkJ5anOcdiitcJnzz3XQwsZ8sNBgy69 cUy5AbC0VulLem4Ynrq6zQhbSAnIz8OU5KeuaLns1NT/hynS6QQIqAlYThCtMPKjFnP8 B+c1sB2iXLOxkSuthKjdxIeu2JiTENp6pAc9eJnCVe5Sg9IFEIGR2vzqZTvyP7jnlx9Q 42Wg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=4SlS984JNth2UiF/7fjnJVHc+g8VgMXnx6vFzrcbCcc=; fh=ZuWt15ZkZit6JRbzSwYRCbGs30lmk92NatJQRi4dWKE=; b=ejviTycuU1ojkhZljvjuEILZrIHfyE7cgUZP2NCLy8iEGuvNIhW0Dox3cpBe/31XaR CDX56MdwTl9lkLeSSliQTiSfrv+M7JAp4EfrA6rQlbmCSg3f8FEvyo39/GjDk9UgD5WB NVLhLcDyLz0WBSkXCVHojNlaSdB85WnVLLwx9PrsWCDh7uGAt8Phc7gyaBKTsCwDRz80 2ZjYrzblSYLQWVopjq+QpHIeC6XlnSPG0oabUCCqzwAJGAeilQ9Vb8vaEb5dxQrvhoIZ RRkpkp33xJtWmzKbYbTQ3XYorYhai19o0h9bqJcXQai3l/3Vw8em/KSwaAKOWmx5qp4R YjNg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jXG3Zc41; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726067469; x=1726672269; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=4SlS984JNth2UiF/7fjnJVHc+g8VgMXnx6vFzrcbCcc=; b=pi/ZPLxbSHtPKhVqcUNkGFyBwvTKQwNGYLtHunRZTlrfqmYP/lYhmJcMdvGaLIXJeU VLFs+2go+xsaR9CsR7o5v4EV2ZtHX8rMGWI1srVreaDoV8xkGMAVxiO5CAmXdg9HGS5i X/4SlzQEhfjXtE2SSFutMc/d1iFkZd47sYQ7k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067469; x=1726672269; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4SlS984JNth2UiF/7fjnJVHc+g8VgMXnx6vFzrcbCcc=; b=PH+b/D+twjFRFUi2A+Bi5jV9OFwti/dE0O47D/2TEUUGbXf7SjQ0sX5J98GzJ9soa9 8TXS0zHDidFnWSIbIPQl+elA1q8a2uc8jIzZ4XqHP8tpP40Slitdl8VZ4bTL2q7in9YY UHL92Pf6t1+GxPS4bqNwTWgymx8RC4COxoZ3b/mb9X3idbql0nRuJEB3kImuZUDMy5J4 civPF6KOGzJMpWME83WcrY/R9vBr6Fr9DxV27j3RYuoVYr4X7MY+KV0CE4PGjwjQfbTt //mZ7xFJXIRlBbMtBiLhmmpD47VPxGX8V0Gg3nNPqt2Ebjw/2I7+UdnwFTf1e9A4gJF/ b5kw== X-Forwarded-Encrypted: i=2; AJvYcCU4IyxfVrqJaIqrVug3DMmCtvdf8xeOEudautAP6L0VmpKI2EMoBECiibhuwAuiiAxo3HeIaKUBtxWfgF/z@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx3gyCdlin3sMopzOuMCOFbzVmjyn20ubCu3RD2HfW5JPVrhjLs 7Hh/0QomjLMjpRehqY6RtJ7N3UPhF2lnbsYNbfDSOPFIrc2RZFmWzNwNP9rMmzh35A== X-Google-Smtp-Source: AGHT+IGaoPsY5Rh/BpGBJf9r4TeEvT6IoCnVnmF1IKVHKKqflZ0j5JqWWXKpiD1GwgK/EbuuVoTi8Q== X-Received: by 2002:a5d:4584:0:b0:374:c95e:1636 with SMTP id ffacd0b85a97d-378949f7c06mr9159546f8f.21.1726067469176; Wed, 11 Sep 2024 08:11:09 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1c1a:b0:42c:b037:5fba with SMTP id 5b1f17b1804b1-42cdb176790ls63175e9.2.-pod-prod-06-eu; Wed, 11 Sep 2024 08:11:08 -0700 (PDT) X-Received: by 2002:a05:600c:314c:b0:42b:af5a:109 with SMTP id 5b1f17b1804b1-42cae76cf52mr106652375e9.24.1726067467812; Wed, 11 Sep 2024 08:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067467; cv=none; d=google.com; s=arc-20160816; b=dmVazT+nmfr8fLbvn09kBRxs+GFLik3SmSlPTemqKfA/eWi5i1XGNAEesIcJxQlrMX 36a749kQosEr1B0A+Jc2A+VfSs/wuuIgWahSOy7nF9J5T3JIjCk1yNugvFLTFfYwh8qr FkqfBQbtvDSTb4EwQVzq8Dn6HxTtZK3VuQei7eiaQIFoQ3s0UtAr8HD846KPICTazHjb IKG24y0KkijutvmOj8034jK/GcPmLESLv0qWFrKCwDdriKjwnwghG+kI95rVPp0mceJc WVSLmYzCYSA2W8D7iQIrzPDuKIex0hcAltVhzvkrZpt6QS+7OIf7XVv4T7S0obgM2QRT SVCA== 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:to:from:dkim-signature; bh=6A/snDcmtKRjnJYUnIqhUMlaHlPydU8WZayqTI8yrcw=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=yv4d8OKaZgj90YMBOKr/mLM0/C3UPmbSX/pHjlUOmxxJly0h2mNTCHNmaaxNSl684W mEWivjET0fL1twpTcZoDIFfQvTmfwtyr8i2VqRA1A2/WCGUknhtvYklyKpwP0FvYEWKR oRZQ9TYUF8tXkgqP9GeLIp0UonnZ8YbJzldNKF/g/BSllO+AMHbn2S6kPXRB7QVrlvpA ED5obJuJ6IC6zqexclJsIyHGCD3zuSqL4JGmF1g9UffTEJYegvoBG4zEWGNXggaI0dKq rhCNSA+nSGKkDWSW2cLWeSX1PBhkiIGq7Ul9Vb0F+PUP3Y2Yw9diLsytbFEueILRkHNE VKMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jXG3Zc41; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42caf2a819esor37602835e9.3.2024.09.11.08.11.07 for (Google Transport Security); Wed, 11 Sep 2024 08:11:07 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:1e27:b0:42c:a7cc:cb64 with SMTP id 5b1f17b1804b1-42cae709f46mr109499845e9.3.1726067466826; Wed, 11 Sep 2024 08:11:06 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:06 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 27/27] imx8mn_bsh_smm_s2/pro: add splash screen with BSH logo Date: Wed, 11 Sep 2024 17:10:39 +0200 Message-ID: <20240911151039.2914886-27-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jXG3Zc41; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Display the BSH logo with features VIDEO_LOGO and SPLASH_SCREEN on imx8mn_bsh_smm_s2/pro boards. With CONFIG_SYS_VENDOR = "bsh", the logo bsh.bmp is selected, loaded at the address indicated by splashimage and centered with "splashpos=m,m". Co-Developed-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- configs/imx8mn_bsh_smm_s2_defconfig | 3 +++ configs/imx8mn_bsh_smm_s2pro_defconfig | 3 +++ include/configs/imx8mn_bsh_smm_s2.h | 1 + include/configs/imx8mn_bsh_smm_s2_common.h | 4 ++++ include/configs/imx8mn_bsh_smm_s2pro.h | 1 + tools/logos/bsh.bmp | Bin 0 -> 10644 bytes 6 files changed, 12 insertions(+) create mode 100644 tools/logos/bsh.bmp diff --git a/tools/logos/bsh.bmp b/tools/logos/bsh.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5b6fb1ebd50d70c7f5ce4a51042271e9634d8d81 GIT binary patch literal 10644 zcmeI2eOy%4)_~XQUh}nk@sis0dX-ZAhBT2#Ny(20Qj*A^GBYuaRLsZ-%1<&s((=`` zt{GWmp;?v|R#;eMWQ9c*Rv1NP)bu?~Uz643efB?U;34fOib)pl9$(KWM1C!Wg9lM8-BvOf9ZAE>cQsbmLJrG{B%F1r}XIFOJaNU zmY%VFq-W1Q(yM1*>D{ZJ^y%GS`u2&FetqMmf4@^Du0Nl+0TLfKP)?0MO$MAgNCpl_ zkkbYZmO-Z_O2QyM38%~8gd|BEe1@E!I7E_8A1Y@gCCiXAl4a^3uXKT z*>d6d9Lc`$BFWCaSaNbMk&F0Te9;8Cs(g~Nz#7ig1#EF;7WtUBsNqjD! zlq-`jpCY-FuaGIZQ{{>&)8vXPu9T@$uas%i^5n{CS4rNL)8(qX88ZE2DJYmD*Is*_%$ZXt*UhkEse z==vL^xQI{jjdH^cbLGYx=gHg~=gYjg3uOMhg|cA&LRq+Akt|$TB8wK?Bqb$_<))i% zmc=(Mk((DUktH`Tm8DCT$P*8k@&xoiCf*>Kn0a`%Q( zx%=*Wq_lLS+;h*pvT@_Ra_`3b7}Pkw+fcCfl|>Dvxe^Odfl5yKH}Khiu=zLw4+V zTpoY?33=j)3aO~rDLX5klqYvSB~Ly1v^@3H)AIDwl~P%`OLpygMxJ@*S$X!EDye#Q zx9qOsv->%D?z!jX`RA*py7~oq;e|c2XU~iBBA=QUYow;;C3)$ky|Q=j%kuKeugEK} zyehB0S}V1D_SNo_efwUM*Is*FUVpt#>gwK*H{RGU`}gmcH}}6OZ@u}Jy!BSS)Yl)7 z0|(xgx8Ht8-g)O8dH3CSrQzKMIoNPe4jz0@-g~c68XMo2_uqeCKKS4RX=-Yc51T%e zk3RfJKKkfm`S{~Qa_G<}^2sNkNON< z^3_*g$=6?hE#G|ejePsfxAN_`Uh#Up^4)jeiO=Vg@4x?Ee)!=B`SHge<)}^2;y3$l=3><=0<-mEV5*jnD7$`|rO?AP|s0{`fKL#qVn761XQyeYZN&hg7*9!~8zxr!v2q-=$`Db3oIXQ*C0_m70%k zZOiB|_l_;xy@Yuyg>(+r4J#dK$DUYb9hu?GS2AC0=C`;OF>7U*i-Frk53g`$tq;uZ zG!o3t<9CIbdnllTxid<=DFJQPI^Crey7jnn-Ksluj~-NCY(Tpi7E%YTe_5{FS{NIK z1higDwNTTvo9f?1WB6;H?o?k)K<64Q$fY3PRz0_%Z(5*Bq9*?(RWmh5C+I9K(RJvm z*5;F2JWEbAmaNlk?etG0m!W0q`*(}>?7;zDc|wjZ?-|hYzvZa!9|0{x&nk!BN3<&v zi?p_DKrd$ez-flNR#Q~FiAHOI9_kXbD1r4lK{ONAg1?D+VEME?*2X)uIO9*D*8R&_ z>!JYxt<_v@*TdK~TRoj!-Qk?*fKEks?Q-k!sph$7YAtuWPbDtEIuFOz4!Z82MrRZ{ z2S%XOK$+oCP7_wda}t&^w!L3Kt27z=Qni^et8Gx2Hzx+PFWhMLEwgqEG7(YPDWHw^ zIcD}Te`O62?W7fq8eRDj7|R(icL)i_la<^%3T_*1?iJ82+7`=H*E8y9^Rwb1tBM`X zR%5C|NhHcU26PkL6%d-VU1t-4(b^sRqEB*Wt=4c-hk$0FS+#Mg_2_g6jQKR0(YW5k zb+jRk)H%e=9?1UV&Fn!UY%X!x<{!if_dC|4MWAoPrbP~$c*r<0hc!>tB<-(VI~cuH zNKfaU8tnFI7veoui+B=#eDvsY?Gk0~+7Yy~X<*n|Fyrjx?m;b0M1U8@3gWhHd(qC? z3~eu3^6+RwI}>Y@bT`rC)#-MRMQHcU{?Os_&>?+=0h3} za}~1%#v=AkNK_CnN!Zd(y*CGKB?l}+W(YDKZNuzHVl?A8(FCpOVaEF6QM7v5U&fkA z5t!>4U*AeRC7^{6s~~29O;*r^kJw?n^jtgih*I8UoFdE~-ydvVdqpOqpZwlH1V;(Yv$TT361H-3n$&PKU zbw*=h1kNJHw}nu4LK#M+4MPK2A5JPGHE@m2&gv)og+v0@G}-)+5yJ7RqCE;yDLU4` zDTK2I&O)OzoWlM{g|FIN67-3)s|zwdWSktE0A(E`QyFoyU<6J%{N*7O6L(EmlFLlp zdE_pxv$%FO_7C$2Tl_XB^$npUBUOh~HI!LU%D7J9+UQ#m&fv_M!FbK0qrFK(;sATR zH=cG-e?~x8Fp>zv$$|YNP->w}4WSH0rU}XtW;Vl^ZS3IMW;RZikf+0GX>tZJy6|XA zdh={l{YW`gPZ}H(x0#F>jd>9`s~9h9r4Vt4H407)J7cVUc1>e!c7{_xesFVD-#=UA z)IcdAtXiZ}A#FuV37mQCdvhvTt>Fx^;&`j^;DVr6*s~hOLKtqfb*{-dQE>LdaWYa$ z1X2YW=Y?>Fz^NjxZRSf4Xf}+FT)R1lToJOySmW&eZmkq@!+t1KqsW>1ZBiOfjC?zV zYopO*oe&CnyqNLI`9Y6hjE6CuSTgyIDle5>tqP?QikopFa2o7>%xNW&M|VL|TMMm2 z%lgq~m1c2X#X`4Phs+vc4=0411Lg%SBEvUpH%OVpm7Cv2aoXuX&gM0cZ0?CbvN@oY zLv`uZB*!9F&t|!^%%09ug%qQH_{sQ82I8y^x6922tvqZ!sBt`{Vpee%{uK_Vil;)= z6UoJBF#6Yqld!^OgtW!UQE!@gvpN~GJy(93BZROh5gKT6)@i^Y!g03*HJR!27X@_fAPm)<9v z$j?*``_dq49e zwsYFM`IgxVjX`phR*`l5+7VAmXv-OqZNe7BKRJxmp>_#LfNw1#op zv%<7?Lvj1QBC9*zcsNNt*zM+4p1WVO=$YIO47-fJ+@lD#19aqBxoF*hbhdpO4MgPF zf14+k&C~M^3iiA_uNM7|o@7U!NT_b#NM%;5HS`oK@ue@hC0G4qCzI{WzMSscVze1EnjLb!C5Ur>l%%M^)+JGg`b&HXNcd zspnRkF+K21cU{!VV<(y?*#=9K)XS4Jxwe9g<<-vY>dsWsdxt?WRgTD3TjuQhtX3W?eHXO0T2K6MMAs^4D`2H+{n<|cSrN|R&XKHd8}(cl^pF@ZRdP0S zZifpefjrhm*PhdoZ?Yng%FwwogtHwEwL2u+>2ex3!HLq{oUO)V^r9`qGpp71@*yO4 zE36`B_n;*o(k3EAb=$daFCWffP4l?3c23YQES?1;ff={IrsgStQb5(=zCVaSG5z)Q z5K4vh%8M<_m@9{p!AO*P#=3s;Btm>5isSH>j{e%Ct!YAcB^0;IhBFvWE)|*88G*6_ zeValUJ{X(uC<8t#O+{&H-g2tc{*FeXEZml6+oPraiL(lh?WCc^LaB#hG@5fXgh5uz zbo3P*?N1}Nl)!K@Yj-H7vh+Z4J&eFH`WA*zYM`uU#cV%Jy>F^-FZI9cA^R`f7Qc4J znwSvEDk$Yp>fuj>k`1L1iq#j+ApaF|->z$p_9hF0$=_~=NnbY?Ml}rAzX%kgZ9*%B zXlk}QT-6K7beHSkm@cH0e$jeJ?g;URPGBhB&|l9ES_5YR)+Avk*@4+4C{0i%La{m{ zP^`9A2GP`@ZJ`vSVG@??hY?Heq(gw>dP%knx5m}jO5!Q{bOC zY8=!A&Y>!pCD^wW`%)k#sgJd+<4vZ?J@qhcXHR|$@w(NLSwTCw$HP0Lc2Ki9Q=NKb zEZizqB2|6((ah;&-XxENYb}bvHP$@RN@dSC@E(>oNaX2G>Y@HhgFrV7ISq2G?uOEg z<|zILz$VB&m}iYRC&O)ayYV1>#@~yn2lMn|`!+0I+u3(v+Xe=7Ggd4?L!<4Il!~&R z-C9N6+=htgqF$b>v2Iu}vN+L{MiE~jb~)ou=66!9*w$a<5c9jqsHP~Ezf^B`n3u+#12 z9qvGLF0LQ!yy2e$*{^BTK5exOhSeWV;7R0T*PfZyPwwradrlA5LzXZm-uT+UGjVlA zVAyKXVQ{w+A>JhSn*vtcuQR9~yJ{)gOy#XXSqDFvHqGy{MY5bwgSzpke4N z)%Ly2IxSWo_gjq-IJUlYD1FUYRG2P|Q zU6jQ42D{Zi+^KttiPmaOp?*!$^|s!#dc#S?j9YO|w|;eqMQ0*1sqBRu;&Fx+>k{Ip zTAN0@-(=`vc781p5JiU*$NYgaT2{fljR~<7zNtRv8v3j5_a-*eR6y>pN=z!9&jh}& zXk-@PQkVeY)o^%1zARwT%%rUKC5kkQ(f-73azzHg~Lvs z+0wChW!~-3-8*c>l<)Tc%noN4(fQ^%@=h-l&%7(e9j2dMZRYp6^$oLbw?5z4X-8u?Q~>Gj9nI#uJLVht?L)f0O|90Mxnuv|;Mo7WIQIWej_rg0FL^-p EzX&OIXaE2J literal 0 HcmV?d00001 diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig index 4982b58407c6..b3190945c59c 100644 --- a/configs/imx8mn_bsh_smm_s2_defconfig +++ b/configs/imx8mn_bsh_smm_s2_defconfig @@ -123,10 +123,13 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_VIDEO_LOGO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y diff --git a/configs/imx8mn_bsh_smm_s2pro_defconfig b/configs/imx8mn_bsh_smm_s2pro_defconfig index 7ae99adf7fad..db83a326c053 100644 --- a/configs/imx8mn_bsh_smm_s2pro_defconfig +++ b/configs/imx8mn_bsh_smm_s2pro_defconfig @@ -112,10 +112,13 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_VIDEO_LOGO=y CONFIG_VIDEO_LCD_SYNAPTICS_R63353=y CONFIG_VIDEO_BRIDGE_SAMSUNG_DSIM=y CONFIG_VIDEO_MXS=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_BMP_32BPP=y diff --git a/include/configs/imx8mn_bsh_smm_s2.h b/include/configs/imx8mn_bsh_smm_s2.h index deeed9c2f582..c8bd55fd3744 100644 --- a/include/configs/imx8mn_bsh_smm_s2.h +++ b/include/configs/imx8mn_bsh_smm_s2.h @@ -38,6 +38,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ MEM_LAYOUT_ENV_SETTINGS \ NANDARGS \ + SPLASH_ENV_SETTINGS \ BOOTENV #define PHYS_SDRAM_SIZE SZ_256M diff --git a/include/configs/imx8mn_bsh_smm_s2_common.h b/include/configs/imx8mn_bsh_smm_s2_common.h index 204fc4b31647..5d6b22e04139 100644 --- a/include/configs/imx8mn_bsh_smm_s2_common.h +++ b/include/configs/imx8mn_bsh_smm_s2_common.h @@ -21,6 +21,10 @@ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_mfg=echo Running fastboot mode; fastboot usb 0\0" \ +#define SPLASH_ENV_SETTINGS \ + "splashimage=0x5bb00000\0" \ + "splashpos=m,m\0" \ + /* Link Definitions */ #define CFG_SYS_INIT_RAM_ADDR 0x40000000 diff --git a/include/configs/imx8mn_bsh_smm_s2pro.h b/include/configs/imx8mn_bsh_smm_s2pro.h index 8619fdde7fdb..dd26e0b885d2 100644 --- a/include/configs/imx8mn_bsh_smm_s2pro.h +++ b/include/configs/imx8mn_bsh_smm_s2pro.h @@ -25,6 +25,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ MEM_LAYOUT_ENV_SETTINGS \ EMMCARGS \ + SPLASH_ENV_SETTINGS \ BOOTENV #define PHYS_SDRAM_SIZE SZ_512M