Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp289003lqg; Fri, 1 Mar 2024 05:31:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWo+dnsQgcmfxwJomptdaP2fitCteLydu8j4qEMwSAz/O3CIca0M/44sRm+8HBp7U5C80swVMDn6ZuVcYeAqfS4rY2ZwXk2vpl/cTmLzw== X-Google-Smtp-Source: AGHT+IEj/qKvRa2R5rbS1Qe/FLENNnbIJNJsJcJrM9Q4HdOad84Tg7XRQCoQOaRpteSyXxUAkMv4 X-Received: by 2002:a17:906:4e91:b0:a44:93cc:9a02 with SMTP id v17-20020a1709064e9100b00a4493cc9a02mr1036877eju.25.1709299861065; Fri, 01 Mar 2024 05:31:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709299860; cv=pass; d=google.com; s=arc-20160816; b=P+tQC05oLdK2JVpWMXg1L9J9BGMhc0F4NxnzF0ea3kRu46e9X5N89dK/IgQBpj0Q5N scX9sNAgqoiC08kakzt3vGKYnlpVChCZ9oHzrbjOMwrnyriPw4OBeNIYQ8XFIYQVz9Po Ht/2+mPevLgsLiim1aSv14P7FRer56tsXQXjAJmJiP49gRXjOlC1Q6Qv/33fB03SJjGA R2Lz1fnDYhLowbHRbdjqFyHWDrwd8qDSvxajPAEUumdOwZ1cEI6Z+yH0tDRVR7d9Y8N1 9/mg7N0xHxIUV/NPwM/WvMx2dA0xf758XU9zr96M19CDSRp7gD436OLRUmABbWrdQPnU rkkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=eriiuV0GykLlbuAXJSOmUH2Oy4ZLAtT7rwXfRbbGWeQ=; fh=7+QqR+U+m0B5ryyywou1kgMZVOfT/GgVHz0ZH2Lvlxg=; b=L5/juL6V2mTAEr7XMcEKkmLceE5lgxZVjeO9H1V7xHs2TB86VMb3v2cGHrjYMqMWmL c06wKN+5Z8Z29oiNz2358ibgBYDoFeUrp0ONlw+x941wjk5G2sPB9vUBWbWpdZm7qFoo 9q0n1HVFsMB1FDXJb35aYa/nkmAcg0grCII8I7/IhVip6SDglyBduELl0ai/zhNNNXur 7nS+JoKbJF72/6i1n3d2X8MZUB3AS9CcUnnNultNqkFYpSopj1mk52w7PvHcXSc0+HXT QD4Mp5XIXFAv/RPhjO2lA5wJphSGcicv1I37jzttNXVJsR6PYxQxhq8BlLxPPAUZPOli yyIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=ZLRXecQB; arc=pass (i=1 spf=pass spfdomain=salutedevices.com dkim=pass dkdomain=salutedevices.com dmarc=pass fromdomain=salutedevices.com); spf=pass (google.com: domain of linux-crypto+bounces-2431-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=salutedevices.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hv10-20020a17090760ca00b00a446b381830si830197ejc.946.2024.03.01.05.31.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 05:31:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2431-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=ZLRXecQB; arc=pass (i=1 spf=pass spfdomain=salutedevices.com dkim=pass dkdomain=salutedevices.com dmarc=pass fromdomain=salutedevices.com); spf=pass (google.com: domain of linux-crypto+bounces-2431-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=salutedevices.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 665311F23550 for ; Fri, 1 Mar 2024 13:31:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49C746F08B; Fri, 1 Mar 2024 13:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b="ZLRXecQB" X-Original-To: linux-crypto@vger.kernel.org Received: from mx1.sberdevices.ru (mx1.sberdevices.ru [37.18.73.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B443915A8; Fri, 1 Mar 2024 13:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.18.73.165 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709299814; cv=none; b=Uiwr8jseUiIyzsQ1QTeA4MSu0vRCL3gp2SKIfpA23e7RkHNPAzJOOtRhcbdqCvj+atpydy9qXZEjwDhYWHL8OTR/TAzTP+xAK6Hx5RYnwd5PNKSf6XWk1TrfRS+JQ6wEc7AJnlI4gXfvMyuwOCPVPCculvH5UX4OvfKG9/q5qXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709299814; c=relaxed/simple; bh=OBHA3EskLCh9U+qWy0Rgh3w86yBFud/cEGQWQvUQdfA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sEh/UfdOsaglP86BBhsGNjf6+oUVtwOxoRM2VggVV00/LKje3zds2CV9l1jcR/iPxC0i2j/XTMYb3L79N9qEksj2NuhYtwJIcDur2ZXDXDhbKCfsYADnLoOb2KUZ3csvWwBd/3AdXFtlgn+zK8nAzgJYeHpI2sg8Wg/oxCjzJGk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com; spf=pass smtp.mailfrom=salutedevices.com; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b=ZLRXecQB; arc=none smtp.client-ip=37.18.73.165 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=salutedevices.com Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id BB1B21000DD; Fri, 1 Mar 2024 16:30:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru BB1B21000DD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1709299802; bh=eriiuV0GykLlbuAXJSOmUH2Oy4ZLAtT7rwXfRbbGWeQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=ZLRXecQBGn6t21qq1TYiwvZySXeBYNqRN15RTRtH1S1K9YtTGZ3zDEtC2kCWvWdNS 5SphuhiXJZe8Jo8ItcNf+mvyjDl1CdGmdoD297Q88EDlHAhPhvz/MtdsDb72Fr5+ui Qwwo4Gn46sDey0oFVk5/VqavZkXOw0qPfVn8NyjiOyWuanWR8bJx8F8lgfZkd1f8qq 6JXDEANMRtaC4Nu+DyO9nV707PdELBGBcJffIRkZoqfeLZmuFujs6tz9Cy3P8j4x34 aN8v0mu9zYoCqzOr0PN9+TR6iNOHdvUrmG0v90FUBbkfPwo3IJP4pumpT0Jcjwtg1r T0A/sb6E06xEw== Received: from smtp.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Fri, 1 Mar 2024 16:30:02 +0300 (MSK) Received: from user-A520M-DS3H.sigma.sbrf.ru (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 1 Mar 2024 16:30:01 +0300 From: Alexey Romanov To: , , , , , , , , , , CC: , , , , , , Alexey Romanov Subject: [PATCH v5 02/21] drviers: crypto: meson: add platform data Date: Fri, 1 Mar 2024 16:29:17 +0300 Message-ID: <20240301132936.621238-3-avromanov@salutedevices.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301132936.621238-1-avromanov@salutedevices.com> References: <20240301132936.621238-1-avromanov@salutedevices.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 183875 [Feb 29 2024] X-KSMG-AntiSpam-Version: 6.1.0.3 X-KSMG-AntiSpam-Envelope-From: avromanov@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 7 0.3.7 6d6bf5bd8eea7373134f756a2fd73e9456bb7d1a, {Tracking_from_domain_doesnt_match_to}, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2024/02/29 19:21:00 #23899999 X-KSMG-AntiVirus-Status: Clean, skipped To support other Amlogic SoC's we have to use platform data: descriptors and status registers offsets are individual for each SoC series. Signed-off-by: Alexey Romanov --- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 2 +- drivers/crypto/amlogic/amlogic-gxl-core.c | 22 +++++++++++++++++---- drivers/crypto/amlogic/amlogic-gxl.h | 11 +++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c index b19032f92415..7eff3ae7356f 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c +++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c @@ -225,7 +225,7 @@ static int meson_cipher(struct skcipher_request *areq) reinit_completion(&mc->chanlist[flow].complete); mc->chanlist[flow].status = 0; - writel(mc->chanlist[flow].t_phy | 2, mc->base + (flow << 2)); + writel(mc->chanlist[flow].t_phy | 2, mc->base + ((mc->pdata->descs_reg + flow) << 2)); wait_for_completion_interruptible_timeout(&mc->chanlist[flow].complete, msecs_to_jiffies(500)); if (mc->chanlist[flow].status == 0) { diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c index 35ec64df5b3a..e9e733ed98e0 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-core.c +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "amlogic-gxl.h" @@ -30,9 +31,10 @@ static irqreturn_t meson_irq_handler(int irq, void *data) for (flow = 0; flow < mc->flow_cnt; flow++) { if (mc->chanlist[flow].irq == irq) { - p = readl(mc->base + ((0x04 + flow) << 2)); + p = readl(mc->base + ((mc->pdata->status_reg + flow) << 2)); if (p) { - writel_relaxed(0xF, mc->base + ((0x4 + flow) << 2)); + writel_relaxed(0xF, mc->base + + ((mc->pdata->status_reg + flow) << 2)); mc->chanlist[flow].status = 1; complete(&mc->chanlist[flow].complete); return IRQ_HANDLED; @@ -254,6 +256,10 @@ static int meson_crypto_probe(struct platform_device *pdev) if (!mc) return -ENOMEM; + mc->pdata = of_device_get_match_data(&pdev->dev); + if (!mc->pdata) + return -EINVAL; + mc->dev = &pdev->dev; platform_set_drvdata(pdev, mc); @@ -319,9 +325,17 @@ static void meson_crypto_remove(struct platform_device *pdev) clk_disable_unprepare(mc->busclk); } +static const struct meson_pdata meson_gxl_pdata = { + .descs_reg = 0x0, + .status_reg = 0x4, +}; + static const struct of_device_id meson_crypto_of_match_table[] = { - { .compatible = "amlogic,gxl-crypto", }, - {} + { + .compatible = "amlogic,gxl-crypto", + .data = &meson_gxl_pdata, + }, + {}, }; MODULE_DEVICE_TABLE(of, meson_crypto_of_match_table); diff --git a/drivers/crypto/amlogic/amlogic-gxl.h b/drivers/crypto/amlogic/amlogic-gxl.h index 79177cfa8b88..9ad75da214ff 100644 --- a/drivers/crypto/amlogic/amlogic-gxl.h +++ b/drivers/crypto/amlogic/amlogic-gxl.h @@ -78,6 +78,16 @@ struct meson_flow { #endif }; +/* + * struct meson_pdata - SoC series dependent data. + * @reg_descs: offset to descriptors register + * @reg_status: offset to status register + */ +struct meson_pdata { + u32 descs_reg; + u32 status_reg; +}; + /* * struct meson_dev - main container for all this driver information * @base: base address of amlogic-crypto @@ -93,6 +103,7 @@ struct meson_dev { void __iomem *base; struct clk *busclk; struct device *dev; + const struct meson_pdata *pdata; struct meson_flow *chanlist; atomic_t flow; int flow_cnt; -- 2.34.1