From patchwork Wed Nov 16 20:53:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 21276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp60572wrr; Wed, 16 Nov 2022 13:04:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6mqeaLmcCj8rjJWc6jDXfYy0b0mb7hRdYHxZyB4+Kc7DAF6RQBfP3Rf3at1497HpUzdt1H X-Received: by 2002:a17:906:bc83:b0:7b2:8008:6466 with SMTP id lv3-20020a170906bc8300b007b280086466mr4750779ejb.347.1668632659257; Wed, 16 Nov 2022 13:04:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668632659; cv=none; d=google.com; s=arc-20160816; b=Uc+GJDHDHRDQJgw//5ZRbQm1cMras+A2KQ/L++DpR5G7KkT92ZemUSJdqHvKu8UxO9 KI2crHbAp5pLeZkEJWuzfX0SU+Tioi+OB0I5UIAGxwzOdstkzemZ2sO8BZRa/rNGEQH9 Ec64V3POWFdEg53XuV7ewq48NKSUoo8MfQq7+kkUUgdqdMTtlRDYB8FJp5K7wBFQv3ld E4IBCiOE3KElGAP/94bTtDV//Gs0SclwWA56o4TCj0LHl3HG2tkJm/KH012mj6MtbhMv Wk7aobG7BbfyX/9hSIg1Yk1n6B+lXTAfPfEPOtV5laPQjMzzD+7jdqGfIKZlJY4mCv7b hgPQ== 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 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.03.55; Wed, 16 Nov 2022 13:04:19 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749688159342365050?= X-GMAIL-MSGID: =?utf-8?q?1749688159342365050?= 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)