From patchwork Sun Apr 23 17:25:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2870 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 38DAE3F259 for ; Sun, 23 Apr 2023 19:25:47 +0200 (CEST) Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f1763fac8bsf22307825e9.1 for ; Sun, 23 Apr 2023 10:25:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682270747; cv=pass; d=google.com; s=arc-20160816; b=jqn7U5i5nN+wA+oCMTK1jnfzuYH3ohM9U553f9tC2FO3VAUcLdauWe2xZChP2zMq9z HRJB6tCu5X+IG2FMOuosU1eIIdasoZh6Z+LtzGeiauKqI9pd4AtsSU2o276I+qeqrpkR 4IOHdvru87i4hRCaFy5X49pp3kb7rLZBuhoO9N6HJzNIc9D6YD1xBEuCfyCzSRhPXYPF UcGLR4kPIBhBasYo8+OoWOXPaNWBbgAIhzFut5Z6Azsy6SluU/v69tAfhJn6gvFNW3b5 QnjYAtxOfUGKIJ57djSJG+73KJ2zUwiSq7eQ1Qt2o4j5AuE10VSQCmbEi1+BkIT5W5uX Vg4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=8BHpNH16XOUtq1X9NBUP5kWQ6oRpll83eugmsLKTG/c=; b=NC+m8ZQDvdIuiXKrsezXGOCYjSPA9stkobGRcsMDGBkJmUqVIW+Us82f9EbLxNU8iJ K4zUgkxCIuUA1X0dTPahOQUStL2flfpCayF3M9gAg1WLf7ufhuZRrW7Ll0sczNDWYDI8 ElVejt0JNSjPu6+Nlf84gikPgattEEUxQE9eOfez9nnj81V9P+JEJRUPiBuAr1cGRRas 19xVor9jJ4x3oJTmX6cjnDxvWGO7p6pGQ6LMcLMReWmURf5N6/CqYa5V26JO80JJmiu/ 5QY+mqCHbuXmDoZbYbTnD+7iPV8RkxAtimGuplSAb7nRmt1i5B5ONU8U3D76r4sed//v /ddQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kFx5aT3Z; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1682270747; x=1684862747; 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:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=8BHpNH16XOUtq1X9NBUP5kWQ6oRpll83eugmsLKTG/c=; b=EyKteoQtdP+wNYqf0Jgwphhvqi1TsT10GL9rftS9V9NkWDKxdCer4jE2omGqEu87/4 79MBMPD5zA46Dmm6TbvH8JOkbRSa56DFdjzHOgIgVEkvysQdMOhi39ZIzBJQUVETpLJq s3QEYJ3GU+fxiPAOMpYhpWEYb9AM0bCoHKm5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682270747; x=1684862747; 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:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8BHpNH16XOUtq1X9NBUP5kWQ6oRpll83eugmsLKTG/c=; b=CrrST22p/QftRu5J9ejR+BX1IpEGGf19Za7c71YI0fdHf34goixVl/3UcyymYy3uES fxx0ez6DqwlB14SHmPPNzHWywgHWoyVvZXBzBpr+Xm9KpOgKfpi6AzzTa9dHL93NnAMU ef4LozL7Hw3BCw/hclIo+5h5eIzcn4ptKQpkW295NA/z2WwXSeXqH/lEEs1wAMIy2vxa D98VY5E+XLjawj74YZDbZdnpLgSER6i4qMSFwIq/Oq/jXpXopKqZ4tNX42XmrZkJyN04 gigsnTzKZ/+hEJmUbQHmqNVrJLGi3xp1iaG+X2qJ5C3tFmPJhoDk4pVAkLJMvLQ9enhG 1C+g== X-Gm-Message-State: AAQBX9dRhrL5PxRLwOG5D1LApNvYJyRcPHTjVANsHN3nZ3ax9GnAh7Ua PZwzZWYCixs5daFWeVKFCZrL4uCU X-Google-Smtp-Source: AKy350YsSU98p717Cze7p0Y1v8YzCnB15MK/y/YIrfahC0mR+PZt4ujXm6SCNGiF0qJkx/OXlAswGQ== X-Received: by 2002:a1c:ed07:0:b0:3f1:72ec:4011 with SMTP id l7-20020a1ced07000000b003f172ec4011mr1574780wmh.2.1682270747007; Sun, 23 Apr 2023 10:25:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1c27:b0:3f1:758c:dd3a with SMTP id j39-20020a05600c1c2700b003f1758cdd3als6204847wms.1.-pod-canary-gmail; Sun, 23 Apr 2023 10:25:45 -0700 (PDT) X-Received: by 2002:a05:600c:b99:b0:3f1:7619:f0f6 with SMTP id fl25-20020a05600c0b9900b003f17619f0f6mr6379551wmb.9.1682270745459; Sun, 23 Apr 2023 10:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682270745; cv=none; d=google.com; s=arc-20160816; b=wGwxELbXYM/Zoqz1X6dhvgVeXedU4VZ1+ar+N5fK+Gn6v1ah1mB5T7tGLeazUkWw02 rE6801hT6NSaCCZ7EWDxIT7fy97uo11PQd3HKTnrvLExKPS5N7ezTWCIISSu2HxP9q3+ V44yP5vJXD5/Xdz0wHD2SIUumSQzTgnxfWdU52Ftyk1sEJkjRcuaMDbMVRzp4mgEjCYU 543otPDjuFrQveIeMcse0MfP0Il8fwRDwboiWxXETuMPuC9ziNidD8+owy6OvzD/2EVs Dj/aa++Cnz/W6RWthLt/gsvYJgk1EqcNu+AjvgaBGAlO4w9NnENtfe97kMDhM8sonQhl p38Q== 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:cc:to:from:dkim-signature; bh=MbxDPqhzMCS7xX3Keeglii9B+3fU/m4LAIoQKCOvlGw=; b=lba2NaJ19Js543KOcnAOWgi8XI2L+n/ZGxixhrBKxM1RPzs+knWcIuLbyw+xc4s614 1SL0xS6qiS8usn7fPiD4SoA924/WDIczwMOcOAs7e4lrD1Mveq2yS4g2lMaFuHge1EGB He2ZzKZ7ppOa1iIBS5EJ4f7ZmqAyri9A66i1Lqm6Q64FPMwe7Xy4/RbzON5EmwnohWLJ 8u1/PuWby+f2bSbuq60m+bHs3xX2jGlNgLA2w2IGoZQ5GulNMxPFmEPo79D8RGzncC+C qWkSwzdfZB3QjXXsoki0+nmNO+BKENEGP724AYxOE1jaMYR4O0/bTc1/xBezfZsI6XJr lARg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kFx5aT3Z; 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 Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id o7-20020a05600c378700b003f175d0615csor3190912wmr.44.2023.04.23.10.25.45 for (Google Transport Security); Sun, 23 Apr 2023 10:25: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:a1c:e904:0:b0:3ed:3268:5f35 with SMTP id q4-20020a1ce904000000b003ed32685f35mr6156037wmc.18.1682270745255; Sun, 23 Apr 2023 10:25:45 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.. ([37.159.119.249]) by smtp.gmail.com with ESMTPSA id j32-20020a05600c1c2000b003f173987ec2sm13511653wms.22.2023.04.23.10.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 10:25:44 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Amarula patchwork , michael@amarulasolutions.com, Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 4/4] can: bxcan: add support for single peripheral configuration Date: Sun, 23 Apr 2023 19:25:28 +0200 Message-Id: <20230423172528.1398158-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230423172528.1398158-1-dario.binacchi@amarulasolutions.com> References: <20230423172528.1398158-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=kFx5aT3Z; 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 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: , Add support for bxCAN controller in single peripheral configuration: - primary bxCAN - dedicated Memory Access Controller unit - 512-byte SRAM memory - 14 fiter banks Signed-off-by: Dario Binacchi --- drivers/net/can/bxcan.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/bxcan.c b/drivers/net/can/bxcan.c index e26ccd41e3cb..9bcbbb85da6e 100644 --- a/drivers/net/can/bxcan.c +++ b/drivers/net/can/bxcan.c @@ -155,6 +155,7 @@ struct bxcan_regs { u32 reserved0[88]; /* 0x20 */ struct bxcan_mb tx_mb[BXCAN_TX_MB_NUM]; /* 0x180 - tx mailbox */ struct bxcan_mb rx_mb[BXCAN_RX_MB_NUM]; /* 0x1b0 - rx mailbox */ + u32 reserved1[12]; /* 0x1d0 */ }; struct bxcan_priv { @@ -922,6 +923,12 @@ static int bxcan_get_berr_counter(const struct net_device *ndev, return 0; } +static const struct regmap_config bxcan_gcan_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + static int bxcan_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -942,11 +949,18 @@ static int bxcan_probe(struct platform_device *pdev) gcan = syscon_regmap_lookup_by_phandle(np, "st,gcan"); if (IS_ERR(gcan)) { - dev_err(dev, "failed to get shared memory base address\n"); - return PTR_ERR(gcan); + primary = true; + gcan = devm_regmap_init_mmio(dev, + regs + sizeof(struct bxcan_regs), + &bxcan_gcan_regmap_config); + if (IS_ERR(gcan)) { + dev_err(dev, "failed to get filter base address\n"); + return PTR_ERR(gcan); + } + } else { + primary = of_property_read_bool(np, "st,can-primary"); } - primary = of_property_read_bool(np, "st,can-primary"); clk = devm_clk_get(dev, NULL); if (IS_ERR(clk)) { dev_err(dev, "failed to get clock\n");