From patchwork Tue Dec 6 16:59:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 631806 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34FA0C4708C for ; Tue, 6 Dec 2022 16:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234309AbiLFQ7y (ORCPT ); Tue, 6 Dec 2022 11:59:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231869AbiLFQ7w (ORCPT ); Tue, 6 Dec 2022 11:59:52 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5336F28E10; Tue, 6 Dec 2022 08:59:51 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id x22so7665394ejs.11; Tue, 06 Dec 2022 08:59:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e14vmcIMdCGeDCCsvjNA18WeSIg6j6mtLwuur7IIU+k=; b=DasL6y4z17a3uCFNx/cpZaEtMZGDNHEyM17c4YaJ1ardVx4EFQl7yvG6zHcy7yj99w 5EaWyeDNAMzT9ODA06f75MsG1tj4rNaPk6hZsbcBd4WVvlEi/5nT+UPUEw2sEP7BMNrE qpvLhLLfk31orZWq2rSDPDMq0AQ6Z5PWdbVzMzj+J8o04wDhqRyFyHSOl0bYv/0uLI4I 0i1KVGGsjIm1W8OXlgoDmK/ZwBdoCylj9p8JNlNojX5JTmTiuNXVMO5yhdlf7kRMslQH 5pPAj8zYlXyNyNIACxF+QvssYTqX97TR0oz+3LyBnRRO+rqqB1AUyPwgA1eY+PJdg4pA 8Bug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e14vmcIMdCGeDCCsvjNA18WeSIg6j6mtLwuur7IIU+k=; b=VwZ7QjAPKtl5M5tkJMtVcoN1fIZMadTgWDJ0afYhEeyTNTQk+RMKGoAvUdHZ0GFYUf kqqU1nEpWckw6UZIb03dyZ7C6QFROgUCi7kmYag9WlZVLYumeWoMA8Qe2o3Cxa4vdw6z 4vpDypiTk8CY0/WKdVE1Txsu9Lj3s5YY3L+UR2uZMx3OrP2ZHUBQEGdpc9Xkm9OsgSBg a6IgKGYkEjLalX/UApLXm4slgoor1slEuGME9pP3zuIueLMRVGCLD+QIsM8OyPp1g3kF //ytcXLFQzG6OBSD4SeX+rOEimexgVzr9djvNJAa7FjG7OW6jfOxdTVw+u7TqeaE7hFW Xg0w== X-Gm-Message-State: ANoB5pnYzRksKT7bFIXq7QMdG4IC/tUiQxEboHrvks78hNNJqzjo6wWV uDU7lnzGKtbvQXIzQ0lCWBc= X-Google-Smtp-Source: AA0mqf6wKnK8iPkkvl/9lYVOalcWQ2P+mF4+su10vJeBJqLrURueKFlLqp6gapxn8M1H0kpE6fmixA== X-Received: by 2002:a17:907:c242:b0:7c0:b44d:92b2 with SMTP id tj2-20020a170907c24200b007c0b44d92b2mr19536028ejc.754.1670345989874; Tue, 06 Dec 2022 08:59:49 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id 7-20020a170906300700b007812ba2a360sm7621230ejz.149.2022.12.06.08.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:59:49 -0800 (PST) From: Thierry Reding To: Joerg Roedel , Ulf Hansson Cc: Robin Murphy , Adrian Hunter , Jonathan Hunter , Prathamesh Shete , Will Deacon , iommu@lists.linux-foundation.org, linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org, Joerg Roedel Subject: [PATCH v13 1/6] iommu: Add note about struct iommu_fwspec usage Date: Tue, 6 Dec 2022 17:59:40 +0100 Message-Id: <20221206165945.3551774-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206165945.3551774-1-thierry.reding@gmail.com> References: <20221206165945.3551774-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Thierry Reding This structure is to be considered private to the IOMMU API. Except for very few exceptions, IOMMU consumer drivers should treat this as opaque data. Acked-by: Joerg Roedel Signed-off-by: Thierry Reding --- include/linux/iommu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 1690c334e516..dc5e6f5c14fc 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -641,6 +641,10 @@ struct iommu_group *fsl_mc_device_group(struct device *dev); * @flags: IOMMU_FWSPEC_* flags * @num_ids: number of associated device IDs * @ids: IDs which this device may present to the IOMMU + * + * Note that the IDs (and any other information, really) stored in this structure should be + * considered private to the IOMMU device driver and are not to be used directly by IOMMU + * consumers. */ struct iommu_fwspec { const struct iommu_ops *ops; From patchwork Tue Dec 6 16:59:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 631469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1AD6C636F9 for ; Tue, 6 Dec 2022 16:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbiLFQ7z (ORCPT ); Tue, 6 Dec 2022 11:59:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234322AbiLFQ7x (ORCPT ); Tue, 6 Dec 2022 11:59:53 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA6827DC7; Tue, 6 Dec 2022 08:59:52 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id d14so16221473edj.11; Tue, 06 Dec 2022 08:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U6zeSRGZWdZ7f7QPIFSyHPja8tB8Q9I3UXrRVUkvskA=; b=Si9LQmtxXVd4xVbCFzrwpITTbZiXZsxiEYvqVU9vwTwLb1GfpZbv3rschRpsrNTIci 6ln0au/BZA5BJ2yxlpWyj7s0qgOxsJ7GgQRkK6l0sO+JUr9M/0vs1xo4RmDKFi59y5uB P2Fa0NcOQRluAxPTTIfxjIxNYdUygAOEF/VfjeUbUVkOV8NKYPrYrrPBhWmTnPpvLA+Q 9bg/YTGDkqqoyprIoVi+mHwcVQdlywSlXu7+Hz8xvwNRnXGwABOPEEOovchFWGEyUjdO RJ/CvdESeTMWUkiESCoTY80Zu/k5gEkQtIDsDJzpRZId17bo97fdXZimHCZ9/K6mpspt q7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U6zeSRGZWdZ7f7QPIFSyHPja8tB8Q9I3UXrRVUkvskA=; b=rgyHDW5FEOPiuF62Ymm1yNHKBRfKFVwmwCZsdB8yClMwTYPSHGT5l142XT0w3CFo+l 0+99FgXuPgnH2khRg2Zze69krBwJfSCZMFUqxP83DziOl7Qf2w9fLNfK9F02J090xF+u 1UKPokW9we0H6rMDhs/HNEHug0DJLScCgukLJF8L/oMrm5HFxdOg3Hx8lThhBMccNVEz Zf7GHe+62tgkT64mO54/4sm1bDuywLBVDx0+dbjHq0aVJsIwLrly2XYByfU6otInIzgS LH9Evaup/+rv/ZeldqIgvCKORgtlEYmp7kfOEiLveSCxKXcJDyL9cW1TtPCsUEbn7pvJ z15Q== X-Gm-Message-State: ANoB5pn85DIzwgT6CYM5RefCAXgV6YErAIpfKYQTp1I8YDk7vT9OnW8k f/2ddwPSYMtCEXhCRnZTL2Q= X-Google-Smtp-Source: AA0mqf7707fp2kjgiRSjHxsxRsDJw9rz6HYtyiPW+enepsy+W35F4b0ef0VhqG207HOFLTaAyjDTFw== X-Received: by 2002:aa7:cf0d:0:b0:46c:5109:66fa with SMTP id a13-20020aa7cf0d000000b0046c510966famr14672079edy.309.1670345990769; Tue, 06 Dec 2022 08:59:50 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id k5-20020a1709063e0500b007ae32daf4b9sm6366488eji.106.2022.12.06.08.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:59:50 -0800 (PST) From: Thierry Reding To: Joerg Roedel , Ulf Hansson Cc: Robin Murphy , Adrian Hunter , Jonathan Hunter , Prathamesh Shete , Will Deacon , iommu@lists.linux-foundation.org, linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v13 2/6] iommu/tegra: Add tegra_dev_iommu_get_stream_id() helper Date: Tue, 6 Dec 2022 17:59:41 +0100 Message-Id: <20221206165945.3551774-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206165945.3551774-1-thierry.reding@gmail.com> References: <20221206165945.3551774-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Thierry Reding Access to the internals of struct iommu_fwspec by non-IOMMU drivers is discouraged. Many drivers for Tegra SoCs, however, need access to their IOMMU stream IDs so that they can be programmed into various hardware registers. Formalize this access into a common helper to make it easier to audit and maintain. Acked-by: Robin Murphy Signed-off-by: Thierry Reding --- include/linux/iommu.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index dc5e6f5c14fc..f0d72acad7db 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -1186,4 +1186,25 @@ static inline u32 iommu_sva_get_pasid(struct iommu_sva *handle) } #endif /* CONFIG_IOMMU_SVA */ +/* + * Newer generations of Tegra SoCs require devices' stream IDs to be directly programmed into + * some registers. These are always paired with a Tegra SMMU or ARM SMMU, for which the contents + * of the struct iommu_fwspec are known. Use this helper to formalize access to these internals. + */ +#define TEGRA_STREAM_ID_BYPASS 0x7f + +static inline bool tegra_dev_iommu_get_stream_id(struct device *dev, u32 *stream_id) +{ +#ifdef CONFIG_IOMMU_API + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); + + if (fwspec && fwspec->num_ids == 1) { + *stream_id = fwspec->ids[0] & 0xffff; + return true; + } +#endif + + return false; +} + #endif /* __LINUX_IOMMU_H */ From patchwork Tue Dec 6 16:59:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 631805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7689EC63707 for ; Tue, 6 Dec 2022 16:59:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235182AbiLFQ7z (ORCPT ); Tue, 6 Dec 2022 11:59:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234927AbiLFQ7y (ORCPT ); Tue, 6 Dec 2022 11:59:54 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0835028E0F; Tue, 6 Dec 2022 08:59:53 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id z92so21225370ede.1; Tue, 06 Dec 2022 08:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oSPEHSYmi4vlcGVbczR4I6cGH/dyxfXxCF0BQRo95CI=; b=eD1P+puHbw7hKL5IQgc+mzYG6cSuxGIQS/AaGX56IX7gtQYrctEtR/GW66nlDYkxIn 3O7JKdJpYC6Cww+cG5FXTyqPr4WsNMhOb92VA4mbgr3KwwodrphpKw6oLlpdHR4B5tHu R1yO7PR4DbYCrCl9MkDa7ZzpX2qkm5YELriDt1Tc8Nv3Blka90DuFLdRZtAns5tQuHT4 uoPq7T+y6yrhLwybox2FbW92KSNBzBy8qLifDyK0e6YHk9iCPVZGNy9XQSfUWR93Inw4 E/qY4fJROOr8A1d1BFNJOJ//7U8kxc7FzewFAMGwGpzOK8nEifPJ/snMtp/nNuqkErc+ l57w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oSPEHSYmi4vlcGVbczR4I6cGH/dyxfXxCF0BQRo95CI=; b=xENjP6gEIxHUN2AUbDM+7/6123iKnhnMbcfEM27KfMJkx1GSy8EfiCiAubcBPerD8N s01mIEW57JRPNueU6tWxnibytE6I7vKC0anSReWw7Xy1fSGC/aiGe9VTnQ1ltgzcYjBp 4bwXFdPLPFoxAEGQlVPypOHb0E6OtkxaViXNccWsHKzeRrcZfUwr6RI4zdY1br1dP2YB o1f1+Md9maWg/AnaHM7L4+X19M/2ffP8K80QFQLH4GbHawDiQufAbcaK8z09jSmW2UOY xMl2LiR30T8LcMFjG5qoF1OBRfne31VLbFZJCX55bLUK01ZatXKzZ8ygXIIYOLX55n89 gk4g== X-Gm-Message-State: ANoB5pmr+UdxTnOG+0Xqy3l1lRi2uOjWxbSU+j2jzV3IgyiM7gEdD643 xuvcOWmCuODvaRAmxdqQm/c= X-Google-Smtp-Source: AA0mqf6uvAmII/HzPxDOxEezJflXnVZyPaTXTzlFj/NQ1BAv82SWRi42QT4q+LHrfwih6OfFxAOZDQ== X-Received: by 2002:aa7:d417:0:b0:46b:203:f389 with SMTP id z23-20020aa7d417000000b0046b0203f389mr39313635edq.303.1670345991603; Tue, 06 Dec 2022 08:59:51 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id p4-20020a05640210c400b0046c4553010fsm1205110edu.1.2022.12.06.08.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:59:51 -0800 (PST) From: Thierry Reding To: Joerg Roedel , Ulf Hansson Cc: Robin Murphy , Adrian Hunter , Jonathan Hunter , Prathamesh Shete , Will Deacon , iommu@lists.linux-foundation.org, linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v13 3/6] mmc: sdhci-tegra: Sort includes alphabetically Date: Tue, 6 Dec 2022 17:59:42 +0100 Message-Id: <20221206165945.3551774-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206165945.3551774-1-thierry.reding@gmail.com> References: <20221206165945.3551774-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Thierry Reding Sort includes alphabetically to make it easier to add new ones subsequently. Acked-by: Adrian Hunter Signed-off-by: Thierry Reding --- drivers/mmc/host/sdhci-tegra.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 9fc8a61eca54..afa9cbf9cb6f 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -3,28 +3,28 @@ * Copyright (C) 2010 Google, Inc. */ +#include #include #include #include -#include +#include #include -#include -#include -#include #include -#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include +#include #include #include #include #include -#include -#include -#include -#include -#include -#include #include From patchwork Tue Dec 6 16:59:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 631804 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03673C3A5A7 for ; Tue, 6 Dec 2022 16:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235409AbiLFQ75 (ORCPT ); Tue, 6 Dec 2022 11:59:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235201AbiLFQ7z (ORCPT ); Tue, 6 Dec 2022 11:59:55 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A3B72A241; Tue, 6 Dec 2022 08:59:54 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id vp12so7705744ejc.8; Tue, 06 Dec 2022 08:59:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mCJXfYzTI2dyLGbCy2BhHsRfkj/QAMNTLWYIlL2SJZ0=; b=HinPoVulLWiuMrle00EXPBrMG8A9+Sk8uxVoxrXc0/0vV3dDhXyhjXB2qTNL1sVrlV Cpc103HnzTl3Ocdvf0KQD3PfZlWi17u8ic4bnJltjvNDvicHOhDszJx1nXihGs8QWJwS PtCjY0ZluvNVkZMBkG+0NvXSNeGdO6glkJYS8f986N8tgMjl1gdUpvCgscDOruHnaFOv vKg6vtBFAW4PiC6ErBWZjJ6dWagnQAo8UvlihTVII+KT/NUgz0ceCl/2cfgFHg8TdCPL UjWMlkoYEsDfff+OYTjKVce1W2vkHPOo681MiS4D3GM2VYJIKfd4uAWOhtFMpJf+kEW3 HDoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mCJXfYzTI2dyLGbCy2BhHsRfkj/QAMNTLWYIlL2SJZ0=; b=3gp//EsQ+bII/zib7qC8oUsaPxHboBRI8TsyeEoPr/El62d9IXfhq33kz9bGKHjuiq 2TS4zkz4yc4CGS9CbnWolvapS8LN79DFACmz729VqTbbnWCjq8jfUuKbomlmjSw9F0YM 0KD8SmbkIdnckPmW5wP/4P256cZu54v0tnJxNbrmYBL7NuHQpODbBkNqxwbT+A14bLMW Qbv053Hsf6Jb/D53qILTzRS7RfPYb4sODKSsq2if0V3NW5eynqrtMy8up9iMFh75+X/7 EPOtap8i3FXD3OJ+rM/uGqHlOtxI4nXHKzqVHj7roNKWsSBkJ6f5OcJwM7Pc6mlC/nLE hmIg== X-Gm-Message-State: ANoB5pnzEylxbwCBo3SCsTFhhuh56MvtpcFQXUYjeL9sqayvmsEeiVMC xDUga437ZXyFBG+23PjChQQ= X-Google-Smtp-Source: AA0mqf5vcNP3TAUSeQz0iBOLEYKUJ1Pdk8Ld1sRW+14zAs+Oz19IfFCQud0l4ORoeb5io1a5Ap0SfA== X-Received: by 2002:a17:906:2854:b0:7ae:3684:84b0 with SMTP id s20-20020a170906285400b007ae368484b0mr65120459ejc.622.1670345992538; Tue, 06 Dec 2022 08:59:52 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id i4-20020a056402054400b0046c64b0efdbsm1199909edx.33.2022.12.06.08.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:59:52 -0800 (PST) From: Thierry Reding To: Joerg Roedel , Ulf Hansson Cc: Robin Murphy , Adrian Hunter , Jonathan Hunter , Prathamesh Shete , Will Deacon , iommu@lists.linux-foundation.org, linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org, Thierry Reding Subject: [PATCH v13 4/6] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Date: Tue, 6 Dec 2022 17:59:43 +0100 Message-Id: <20221206165945.3551774-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206165945.3551774-1-thierry.reding@gmail.com> References: <20221206165945.3551774-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Prathamesh Shete Create new SoC data structure for Tegra234 platforms. Additional features, tap value configurations are added/updated for Tegra234 platform hence separate Tegra194 and Tegra234 SoC data. Signed-off-by: Aniruddha Tvs Rao Signed-off-by: Prathamesh Shete Acked-by: Adrian Hunter Acked-by: Thierry Reding Signed-off-by: Thierry Reding --- drivers/mmc/host/sdhci-tegra.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index afa9cbf9cb6f..f3f5a4abcafb 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1553,7 +1553,21 @@ static const struct sdhci_tegra_soc_data soc_data_tegra194 = { .max_tap_delay = 139, }; +static const struct sdhci_tegra_soc_data soc_data_tegra234 = { + .pdata = &sdhci_tegra186_pdata, + .dma_mask = DMA_BIT_MASK(39), + .nvquirks = NVQUIRK_NEEDS_PAD_CONTROL | + NVQUIRK_HAS_PADCALIB | + NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | + NVQUIRK_ENABLE_SDR50 | + NVQUIRK_ENABLE_SDR104 | + NVQUIRK_HAS_TMCLK, + .min_tap_delay = 95, + .max_tap_delay = 111, +}; + static const struct of_device_id sdhci_tegra_dt_match[] = { + { .compatible = "nvidia,tegra234-sdhci", .data = &soc_data_tegra234 }, { .compatible = "nvidia,tegra194-sdhci", .data = &soc_data_tegra194 }, { .compatible = "nvidia,tegra186-sdhci", .data = &soc_data_tegra186 }, { .compatible = "nvidia,tegra210-sdhci", .data = &soc_data_tegra210 }, From patchwork Tue Dec 6 16:59:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 631468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB9BFC352A1 for ; Tue, 6 Dec 2022 16:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235335AbiLFQ74 (ORCPT ); Tue, 6 Dec 2022 11:59:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234506AbiLFQ74 (ORCPT ); Tue, 6 Dec 2022 11:59:56 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0F0528E0F; Tue, 6 Dec 2022 08:59:54 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id qk9so7748100ejc.3; Tue, 06 Dec 2022 08:59:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RPp9Cr/5MTANMw37JK8xns8WX2phSmr1abYF48ABHTA=; b=I2U3B96fMxRAZX8Pf44Ji3P8g484nV4dry9i9zkDsFLeff3UDygTegjEFdxZbSMG7s vo+6iC9v/wK/BPe0LRjsKVELItZhFTE0e7BrkmGD2e5LXglAd5jNCJBJlE6ZXiU5Vo5Z 0UU3N7SDaaaiFSskMGklB3mTCZTxKmezkeRANGMdGOMBYuAv1w8+fAg5ubLJCwoFGiyJ TZF+faveqOuCXO+ik4FhcWSgoH6dUOZ2fwE255aFGePN2elCu9G81KP/D/FX3b06RHrm D2tZUYRHLiOA2prRX/DeB+mfxxpSQBW/9kLnsO+TZ695jxYdJyt9a7wGJyLWkFyitAb7 KBMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RPp9Cr/5MTANMw37JK8xns8WX2phSmr1abYF48ABHTA=; b=A0vxTiU3R/9cwGJJy60Upjy8oXuFk2vkHTAoQmulva4buAt3dXBUghnW6vKoFvQI9n T6TuvOUS9mpXP6wAUVR1dRof64c8PPf1A84HE/3zB4LRfRGEprlWjCg0wmqkvTTHv7YM cootRYHQ6Ice24EAOzdm9zqRC283kL+SkH3pfooltXWvF32AdVGIz42vMsp509AwoIcW JjBEjeJJX10BprP6aIDHZ+5I3su43ZgNUJgsmYCIFBA0vBQHOnRQHAno8fMleOKrrxQu TY8X7t90jAboDNMgZoWJv8hArjSBJPvsLEiWocyjiZbWN3ZuaXIM1lWuHZzMYQQ1DivN bA4Q== X-Gm-Message-State: ANoB5pkKjx8Q8AQeOtetGFloR2VsADSMCi0Rh3escFlZPHVlYYmwfkPq Vi0uBs1f3xI6RDmLMzmANSc= X-Google-Smtp-Source: AA0mqf6zC4JgWZrt/cpXpmXgBwbWub+NRW62wYFOlq4bE3A2txLO4s5Ea0MdrkQNv+ndH0ccfkRisA== X-Received: by 2002:a17:906:64e:b0:7b7:c1b9:8cb4 with SMTP id t14-20020a170906064e00b007b7c1b98cb4mr58027663ejb.96.1670345993458; Tue, 06 Dec 2022 08:59:53 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id bo7-20020a0564020b2700b00463597d2c25sm1181892edb.74.2022.12.06.08.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:59:53 -0800 (PST) From: Thierry Reding To: Joerg Roedel , Ulf Hansson Cc: Robin Murphy , Adrian Hunter , Jonathan Hunter , Prathamesh Shete , Will Deacon , iommu@lists.linux-foundation.org, linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org, Thierry Reding Subject: [PATCH v13 5/6] mmc: sdhci-tegra: Add support to program MC stream ID Date: Tue, 6 Dec 2022 17:59:44 +0100 Message-Id: <20221206165945.3551774-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206165945.3551774-1-thierry.reding@gmail.com> References: <20221206165945.3551774-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Prathamesh Shete SMMU clients are supposed to program stream ID from their respective address spaces instead of MC override. Define NVQUIRK_PROGRAM_STREAMID and use it to program SMMU stream ID from the SDMMC client address space. Signed-off-by: Aniruddha TVS Rao Signed-off-by: Prathamesh Shete Acked-by: Adrian Hunter Acked-by: Thierry Reding Signed-off-by: Thierry Reding --- drivers/mmc/host/sdhci-tegra.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index f3f5a4abcafb..fb3823c87cb8 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -3,6 +3,7 @@ * Copyright (C) 2010 Google, Inc. */ +#include #include #include #include @@ -10,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -95,6 +97,8 @@ #define SDHCI_TEGRA_AUTO_CAL_STATUS 0x1ec #define SDHCI_TEGRA_AUTO_CAL_ACTIVE BIT(31) +#define SDHCI_TEGRA_CIF2AXI_CTRL_0 0x1fc + #define NVQUIRK_FORCE_SDHCI_SPEC_200 BIT(0) #define NVQUIRK_ENABLE_BLOCK_GAP_DET BIT(1) #define NVQUIRK_ENABLE_SDHCI_SPEC_300 BIT(2) @@ -122,6 +126,7 @@ #define NVQUIRK_HAS_TMCLK BIT(10) #define NVQUIRK_HAS_ANDROID_GPT_SECTOR BIT(11) +#define NVQUIRK_PROGRAM_STREAMID BIT(12) /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */ #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000 @@ -178,6 +183,7 @@ struct sdhci_tegra { bool enable_hwcq; unsigned long curr_clk_rate; u8 tuned_tap_delay; + u32 stream_id; }; static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg) @@ -1561,6 +1567,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra234 = { NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | NVQUIRK_ENABLE_SDR50 | NVQUIRK_ENABLE_SDR104 | + NVQUIRK_PROGRAM_STREAMID | NVQUIRK_HAS_TMCLK, .min_tap_delay = 95, .max_tap_delay = 111, @@ -1627,6 +1634,19 @@ static int sdhci_tegra_add_host(struct sdhci_host *host) return ret; } +/* Program MC streamID for DMA transfers */ +static void sdhci_tegra_program_stream_id(struct sdhci_host *host) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host); + + if (tegra_host->soc_data->nvquirks & NVQUIRK_PROGRAM_STREAMID) { + tegra_sdhci_writel(host, FIELD_PREP(GENMASK(15, 8), tegra_host->stream_id) | + FIELD_PREP(GENMASK( 7, 0), tegra_host->stream_id), + SDHCI_TEGRA_CIF2AXI_CTRL_0); + } +} + static int sdhci_tegra_probe(struct platform_device *pdev) { const struct sdhci_tegra_soc_data *soc_data; @@ -1687,6 +1707,12 @@ static int sdhci_tegra_probe(struct platform_device *pdev) tegra_sdhci_parse_dt(host); + if (tegra_host->soc_data->nvquirks & NVQUIRK_PROGRAM_STREAMID && + !tegra_dev_iommu_get_stream_id(&pdev->dev, &tegra_host->stream_id)) { + dev_warn(mmc_dev(host->mmc), "missing IOMMU stream ID\n"); + tegra_host->stream_id = 0x7f; + } + tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power", GPIOD_OUT_HIGH); if (IS_ERR(tegra_host->power_gpio)) { @@ -1772,6 +1798,8 @@ static int sdhci_tegra_probe(struct platform_device *pdev) if (rc) goto err_add_host; + sdhci_tegra_program_stream_id(host); + return 0; err_add_host: @@ -1868,6 +1896,8 @@ static int sdhci_tegra_resume(struct device *dev) if (ret) return ret; + sdhci_tegra_program_stream_id(host); + ret = sdhci_resume_host(host); if (ret) goto disable_clk; From patchwork Tue Dec 6 16:59:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 631467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8615C636F9 for ; Tue, 6 Dec 2022 16:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235201AbiLFQ76 (ORCPT ); Tue, 6 Dec 2022 11:59:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235392AbiLFQ74 (ORCPT ); Tue, 6 Dec 2022 11:59:56 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB5042A416; Tue, 6 Dec 2022 08:59:55 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id gh17so7713430ejb.6; Tue, 06 Dec 2022 08:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z+x7sVgmVUy0nFilA/xgoX4WHBeOpUbanqvIivo4H6c=; b=LGz7Kzq8lENoaan4SBI6zDEXk8fp9vwOKrepzBGWOBETMkQNMcbeliyf3aCuhx9p6k d5ixVo3Kjh65WEYHDN9R05qzpMWqiQ9k4TlCMhwjC20RvJXmA6JZyL2zXq+n5ETdmf1x dM0usmfqkIzDWmSCGeQBu81Hgee++KhBtgkvdQyIKjC2eN3Pmv6BVnWRagR/qbjiCd+e RLyi6Ikxen0K7AKtBMc9VpuaeOVF9qNDshqv4PBe5ar/tNCALH8dW+Dd9nePCaLy9Taq JTXL8p9Y4sQYXKe9M5aYc44FZTKeFluq+qHe5I6nQ6OSsFKIATnNftnM7NUKBPv/OjLi Ex2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z+x7sVgmVUy0nFilA/xgoX4WHBeOpUbanqvIivo4H6c=; b=burfE1oWXu7S9jcZIqYwSFEAKPGtV7TdfS10GpFxj0odNbeFkrc9/DBC+K0syNgJp1 T9yV7gDuwrPnuNHZQ8UqSiomI4xy1LHNusWFAWnUnr++EynsyWg34v+Pd6wwLu3ODEjR brhAtR1tVYe4sa6X9gUinNEuH5lCoOmfqHhhq5zbeGHqxmtqdcRp/i8PvMdSVlTG2UrK 02a3myxrItkMOaRCwdemFgcai3mIbbCiQijR/v88qNtmDuaDcmN/V6a7PtEDJMSednSj zIkhLOzxgCAXQkfX2pyF0KX+MhxvkE3eQAayJTWFuZT0kuNSkiT2rMH2V7acEXQYQtlf VQFw== X-Gm-Message-State: ANoB5pmcyP/Ty3OYmcUu/Kfz9/Q7nwWSDz6cPycv8bJ51hluyvf43Ic+ 6c00vU5eVm8fGc+Oki4ZyTG1mCT/UOg= X-Google-Smtp-Source: AA0mqf5QmHP1nzFD7AQZdcqYoVCmZXCASRpkvt5zy3F/Y/FgJAMYj9rWZiXewQseLfanbILzQI5sPA== X-Received: by 2002:a17:906:e244:b0:7c0:f9ec:1dff with SMTP id gq4-20020a170906e24400b007c0f9ec1dffmr7426748ejb.283.1670345994319; Tue, 06 Dec 2022 08:59:54 -0800 (PST) Received: from localhost (p200300e41f201d00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f20:1d00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id s26-20020a170906285a00b007af0f0d2249sm7611273ejc.52.2022.12.06.08.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:59:54 -0800 (PST) From: Thierry Reding To: Joerg Roedel , Ulf Hansson Cc: Robin Murphy , Adrian Hunter , Jonathan Hunter , Prathamesh Shete , Will Deacon , iommu@lists.linux-foundation.org, linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org, Thierry Reding Subject: [PATCH v13 6/6] mmc: sdhci-tegra: Issue CMD and DAT resets together Date: Tue, 6 Dec 2022 17:59:45 +0100 Message-Id: <20221206165945.3551774-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206165945.3551774-1-thierry.reding@gmail.com> References: <20221206165945.3551774-1-thierry.reding@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Prathamesh Shete In case of error condition to avoid system crash Tegra SDMMC controller requires CMD and DAT resets issued together. SDHCI controller FSM goes into bad state due to rapid SD card hot-plug event. Issuing reset on the CMD FSM before DATA FSM results in kernel panic, hence add support to issue CMD and DAT resets together. This is applicable to Tegra186 and later chips. Signed-off-by: Aniruddha TVS Rao Signed-off-by: Prathamesh Shete Acked-by: Adrian Hunter Acked-by: Thierry Reding Signed-off-by: Thierry Reding --- drivers/mmc/host/sdhci-tegra.c | 3 ++- drivers/mmc/host/sdhci.c | 5 +++++ drivers/mmc/host/sdhci.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index fb3823c87cb8..4c2563b27ed6 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1528,7 +1528,8 @@ static const struct sdhci_pltfm_data sdhci_tegra186_pdata = { SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER, .ops = &tegra186_sdhci_ops, }; diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index df1c1d10a338..81f4fed11629 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -270,6 +270,11 @@ enum sdhci_reset_reason { static void sdhci_reset_for_reason(struct sdhci_host *host, enum sdhci_reset_reason reason) { + if (host->quirks2 & SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER) { + sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + return; + } + switch (reason) { case SDHCI_RESET_FOR_INIT: sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index b6f31a7d6152..605eaee805f7 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -478,6 +478,8 @@ struct sdhci_host { * block count. */ #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) +/* Issue CMD and DATA reset together */ +#define SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER (1<<19) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */