Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1162564rwb; Wed, 16 Nov 2022 13:05:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf43XsMfQCekdAAszwbIgWkbK95PwKluZHhUK1mKiuQqNMwfP+zKZ2m9/gRQoIxAYrl8mJa5 X-Received: by 2002:a17:906:4992:b0:7b2:7af1:9958 with SMTP id p18-20020a170906499200b007b27af19958mr6065310eju.288.1668632731452; Wed, 16 Nov 2022 13:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668632731; cv=none; d=google.com; s=arc-20160816; b=QcBejnSIKiClnv8O16XsCvd/CGo31dqgsIkU9XltB86a+kGzHF4S4YyAxtlI9nFrLd o2E0MI/8fxsN4vJwgiFtfBgvDuzxPS5b0R/p+ukYNVMGiCgfqVTkkHVlaOGubm+6Pobm AqLbVi5vmVCubDBnkLaMcBMsfhfWl7G6u0XesUv3+YeVpPRs+kvhaygB9e/Wo6JUTya8 d/uL9/f+ZcXdoOXnNpfPCtFFZcH8czJnJruQYlonkX60fXBmskE97Ey3Vl0H/7QhazNU Mp1pxtcDwkQVh3SaXROjayKFnedaNGiRZivvKf0y9MV1/i430JX+47i8CSqmUVxxadst HqrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CeVee7WTu+MIVK7s97PRG5d4Tw3kKV6cU2vVtZ3DItQ=; b=OBkI+weGA3BYG9dQTB4oP+lJ7a/oknbBZgQ+de3V4jOIwsTOb0j8FaK4UurwJX0WiT WEnE5r0jNw5SFb0NRk8KgwOc7NgwKgJLu2lLRqni81IPZOdYeYo3SyXxfj24CQvEF6eS pCDfIo7fxVmhmmhpWMElSvB4lkoEen1rI0bfi5IQkV68s6sz/0Z6uN+vENnUb9wbjENY zlLp3/9MU9F3DK7zxq/+RxhAmRwuV9Z3JW7vNKdIVBhctEx0wOQt6yGdi72uTvFV+f6i wzADRe5qdUkp/RH0eWqg5EKfQZMhQjWsEyv0T5vLCTlXGAI8dx/EBMv6ebBM39Mjh5IV eqUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=ofPkZh1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd39-20020a17090796a700b007acf3aed468si15559770ejc.786.2022.11.16.13.05.10; Wed, 16 Nov 2022 13:05:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=ofPkZh1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236124AbiKPU5j (ORCPT + 90 others); Wed, 16 Nov 2022 15:57:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234407AbiKPUyC (ORCPT ); Wed, 16 Nov 2022 15:54:02 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D89D5FE0 for ; Wed, 16 Nov 2022 12:53:36 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id a5so28422895edb.11 for ; Wed, 16 Nov 2022 12:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.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=CeVee7WTu+MIVK7s97PRG5d4Tw3kKV6cU2vVtZ3DItQ=; b=ofPkZh1sJHCSjcXBt5MSofHDe4685qhi1/Uc6LWnRd5EToxTmQIbpUn6ccrEQAQAns SXavK0S2kbOubR/NRJ7cDZLF6RKWaQ4G757sspLKT7U2Nq1FQa21mr8+z+tgJN1JAHar bAGuACN8zSgXgSFsxzahOcOiGZtZqtaI3ADgt8nVKKhB/xQ5NRUK8cjr9uuVpDjrECJG ZIM8hXLVCMHjmTEFYN/pf8GLR66Zi1gz5BAhY62LqokcHeYn5zUnYo+GMZQSk9oRLSrz 5o59LVtNJfrNkQhOE//fxGY7XlXdPB/LDl9sjti2Spkq8u58gt9NoQCSLUs3GqyCorT1 nZKA== 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=CeVee7WTu+MIVK7s97PRG5d4Tw3kKV6cU2vVtZ3DItQ=; b=0cg8XZD3zRCUtgcE4eiNPsS98XYX/ZX16E7fTGbMPOG/8CokZK2cKo+gknUyglhR89 jxjX6YTT77d+vcTwSlEaGwwWMdV5P4j5t8YiDhQzCJb4XJq8MTeQTRZMNWOc2cc8wdJM 6/n8ETZD/AFJ+Q/XuC8snkwlLTGytXiVLiL5V1UW+8UQgwGyihk8q2Wf63Tjo/zToR0r xqAPlzxGl96v7DoE+bGQRa9kAtnX52WVI4ut2Srsv5rE+FiT79zZJ4SIcJaoWtz2OWb4 MayfroTyJO622nQ0Ys/suKtdLpo8vsBOQkltcmreruOnCmNOiauVoUoTwK3GUSd7eE0w 6qwA== X-Gm-Message-State: ANoB5pkUrLNcRy6MOtqdrw9mRrPsPryU664AgdyCx+YaBkDML2EoTmM9 aiqS1YW0OIEiRl5SoBUWo7ataP3KNEk3sg== X-Received: by 2002:a05:6402:17c2:b0:459:443a:faf4 with SMTP id s2-20020a05640217c200b00459443afaf4mr20696086edy.297.1668632016031; Wed, 16 Nov 2022 12:53:36 -0800 (PST) Received: from blmsp.fritz.box ([2001:4090:a244:804b:353b:565:addf:3aa7]) by smtp.gmail.com with ESMTPSA id kv17-20020a17090778d100b007aece68483csm6782828ejc.193.2022.11.16.12.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 12:53:35 -0800 (PST) From: Markus Schneider-Pargmann To: Chandrasekar Ramakrishnan , Marc Kleine-Budde , Wolfgang Grandegger Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann Subject: [PATCH 15/15] can: tcan4x5x: Specify separate read/write ranges Date: Wed, 16 Nov 2022 21:53:08 +0100 Message-Id: <20221116205308.2996556-16-msp@baylibre.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116205308.2996556-1-msp@baylibre.com> References: <20221116205308.2996556-1-msp@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Specify exactly which registers are read/writeable in the chip. This is supposed to help detect any violations in the future. Signed-off-by: Markus Schneider-Pargmann --- drivers/net/can/m_can/tcan4x5x-regmap.c | 43 +++++++++++++++++++++---- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/m_can/tcan4x5x-regmap.c b/drivers/net/can/m_can/tcan4x5x-regmap.c index d4b79d2d4598..19215c39cd5b 100644 --- a/drivers/net/can/m_can/tcan4x5x-regmap.c +++ b/drivers/net/can/m_can/tcan4x5x-regmap.c @@ -90,16 +90,47 @@ static int tcan4x5x_regmap_read(void *context, return 0; } -static const struct regmap_range tcan4x5x_reg_table_yes_range[] = { +static const struct regmap_range tcan4x5x_reg_table_wr_range[] = { + /* Device ID and SPI Registers */ + regmap_reg_range(0x000c, 0x001c), + /* Device configuration registers and Interrupt Flags*/ + regmap_reg_range(0x0800, 0x080c), + regmap_reg_range(0x0814, 0x0814), + regmap_reg_range(0x0820, 0x0820), + regmap_reg_range(0x0830, 0x0830), + /* M_CAN */ + regmap_reg_range(0x100c, 0x102c), + regmap_reg_range(0x1048, 0x1048), + regmap_reg_range(0x1050, 0x105c), + regmap_reg_range(0x1080, 0x1088), + regmap_reg_range(0x1090, 0x1090), + regmap_reg_range(0x1098, 0x10a0), + regmap_reg_range(0x10a8, 0x10b0), + regmap_reg_range(0x10b8, 0x10c0), + regmap_reg_range(0x10c8, 0x10c8), + regmap_reg_range(0x10d0, 0x10d4), + regmap_reg_range(0x10e0, 0x10e4), + regmap_reg_range(0x10f0, 0x10f0), + regmap_reg_range(0x10f8, 0x10f8), + /* MRAM */ + regmap_reg_range(0x8000, 0x87fc), +}; + +static const struct regmap_range tcan4x5x_reg_table_rd_range[] = { regmap_reg_range(0x0000, 0x001c), /* Device ID and SPI Registers */ regmap_reg_range(0x0800, 0x083c), /* Device configuration registers and Interrupt Flags*/ regmap_reg_range(0x1000, 0x10fc), /* M_CAN */ regmap_reg_range(0x8000, 0x87fc), /* MRAM */ }; -static const struct regmap_access_table tcan4x5x_reg_table = { - .yes_ranges = tcan4x5x_reg_table_yes_range, - .n_yes_ranges = ARRAY_SIZE(tcan4x5x_reg_table_yes_range), +static const struct regmap_access_table tcan4x5x_reg_table_wr = { + .yes_ranges = tcan4x5x_reg_table_wr_range, + .n_yes_ranges = ARRAY_SIZE(tcan4x5x_reg_table_wr_range), +}; + +static const struct regmap_access_table tcan4x5x_reg_table_rd = { + .yes_ranges = tcan4x5x_reg_table_rd_range, + .n_yes_ranges = ARRAY_SIZE(tcan4x5x_reg_table_rd_range), }; static const struct regmap_config tcan4x5x_regmap = { @@ -107,8 +138,8 @@ static const struct regmap_config tcan4x5x_regmap = { .reg_stride = 4, .pad_bits = 8, .val_bits = 32, - .wr_table = &tcan4x5x_reg_table, - .rd_table = &tcan4x5x_reg_table, + .wr_table = &tcan4x5x_reg_table_wr, + .rd_table = &tcan4x5x_reg_table_rd, .max_register = TCAN4X5X_MAX_REGISTER, .cache_type = REGCACHE_NONE, .read_flag_mask = (__force unsigned long) -- 2.38.1