Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4911782imm; Tue, 7 Aug 2018 09:20:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmf51/D1EEX1+LKdIHwTtgGwHfoAL0exW4woA9/7YK74ZopiPVqzO3rhmNVryqCoAkEFEU X-Received: by 2002:a63:3e4d:: with SMTP id l74-v6mr19727831pga.355.1533658810984; Tue, 07 Aug 2018 09:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533658810; cv=none; d=google.com; s=arc-20160816; b=oFV0J8oxxLaKONJAedX+fKUWKfKSXXeXngNJHZYgo0YKgWpI5gmBPxLyKHKtOQG6Zo FcP60ZawL1VgRR+jL2fX6C1WcS3z6xfE+Kgiq2LljGROJUsmH+lwjfuXTwyS2jax40cm 5+40kmzMdopiDr0Ub4kcfIuU0fxgZu/sEDelQ07x8Ie8TzR9S+cbjScT/gSvY9kZNepT BUI4ewOfXNoE0fMfIFzN/WMsbixfXhoUWvyCBE23ulXEyOl9bPTqe1ERrQRM7eZ9RMhV zWOAvv82UOqUDCVjTf+OQL69aRwIfOyz/NHOUErnSZn/tnl5saiHZwAJDBfyEZmnFKTR fq5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=gKeRskldp+rbp8U6hME/OJgCk/AGTWmV6+scjTRThgk=; b=tRnI6S2FL9NUyYl9NyF13qysRDAne2+xEEFgvoa3h8zxor8EjOicd3+9fznzN/FDS7 HRR20dgOfyMdvgLHDi3eQb2khXq+S3PRsJj/qlIXWlMGo39zKfbZBzWUUoWwHu3JmVkd VjayERWRSiTdgUdj9damK8VkTaR5O/0YOTaDoNw3Sm6lXbFB+6GaaYq8rdd8V5XfuD/4 iYpboccp4xM4aEUBqBomcLW5WJ7TZ88bvnbNZLa7HwbMxoo5FTY2jqrzCRnP7TmwUw4U GInOwfHZaxdywpZNJYBaTAXT1UHPV4dXxhtKHK/u0l1xDBntePJc7lr1oU45svYmrTFD yr1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 72-v6si1967415pfv.131.2018.08.07.09.19.56; Tue, 07 Aug 2018 09:20:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389685AbeHGRFU convert rfc822-to-8bit (ORCPT + 99 others); Tue, 7 Aug 2018 13:05:20 -0400 Received: from smtp.asem.it ([151.1.184.197]:52938 "EHLO smtp.asem.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389070AbeHGRFU (ORCPT ); Tue, 7 Aug 2018 13:05:20 -0400 Received: from webmail.asem.it by asem.it (smtp.asem.it) (SecurityGateway 4.0.1) with ESMTP id SG003402552.MSG for ; Tue, 07 Aug 2018 16:50:33 +0200S Received: from ASAS044.asem.intra (172.16.16.44) by ASAS044.asem.intra (172.16.16.44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 7 Aug 2018 16:50:34 +0200 Received: from ASAS044.asem.intra ([::1]) by ASAS044.asem.intra ([::1]) with mapi id 15.01.1261.035; Tue, 7 Aug 2018 16:50:34 +0200 From: Flavio Suligoi To: Marc Kleine-Budde , Wolfgang Grandegger CC: "David S . Miller" , "linux-can@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v4] can: sja1000: plx_pci: add support for ASEM CAN raw device Thread-Topic: [PATCH v4] can: sja1000: plx_pci: add support for ASEM CAN raw device Thread-Index: AQHULh6yQFQM3QxnwE20VaCkmHfx3qS0MzsAgAAqsFc= Date: Tue, 7 Aug 2018 14:50:34 +0000 Message-ID: <10b11fc8317e41888204fa6378580908@asem.it> References: <53dae6d6-c25b-71d5-b43f-1d444d9c352b@pengutronix.de> <1533626239-4065-1-git-send-email-f.suligoi@asem.it>, In-Reply-To: Accept-Language: it-IT, en-US Content-Language: it-IT X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.17.160] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-SGHeloLookup-Result: pass smtp.helo=webmail.asem.it (ip=172.16.16.44) X-SGSPF-Result: none (smtp.asem.it) X-SGOP-RefID: str=0001.0A0B0206.5B69B1BA.0098,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 (_st=1 _vt=0 _iwf=0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/07/2018 04:11 PM, Marc Kleine-Budde wrote: >On 08/07/2018 09:17 AM, Flavio Suligoi wrote: >> This patch adds support for ASEM opto-isolated dual channels >> CAN raw device (http://www.asem.it) >> >> Signed-off-by: Flavio Suligoi >> --- >> >> v2: - rename ASEM_... constants to reduce space size; >> - remove "else" in "plx_pci_reset_asem_dual_can_raw" function to avoid >> strings breaking >> v3: - fix wrong comment for PLX_LINT2_POL >> - put string into just one line in "plx_pci_reset_asem_dual_can_raw" >> function >> v4: - remove unnecessary variable "reset_bar" in >> "plx_pci_reset_asem_dual_can_raw" function >> >> drivers/net/can/sja1000/Kconfig | 1 + >> drivers/net/can/sja1000/plx_pci.c | 66 ++++++++++++++++++++++++++++++++++++++- >> 2 files changed, 66 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig >> index 1e65cb6..f6dc899 100644 >> --- a/drivers/net/can/sja1000/Kconfig >> +++ b/drivers/net/can/sja1000/Kconfig >> @@ -88,6 +88,7 @@ config CAN_PLX_PCI >> - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/) >> - IXXAT Automation PC-I 04/PCI card (http://www.ixxat.com/) >> - Connect Tech Inc. CANpro/104-Plus Opto (CRG001) card (http://www.connecttech.com) >> + - ASEM CAN raw - 2 isolated CAN channels (www.asem.it) >> >> config CAN_TSCAN1 >> tristate "TS-CAN1 PC104 boards" >> diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c >> index f8ff25c..79fc327 100644 >> --- a/drivers/net/can/sja1000/plx_pci.c >> +++ b/drivers/net/can/sja1000/plx_pci.c >> @@ -46,7 +46,8 @@ MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, " >> "esd CAN-PCIe/2000, " >> "Connect Tech Inc. CANpro/104-Plus Opto (CRG001), " >> "IXXAT PC-I 04/PCI, " >> - "ELCUS CAN-200-PCI") >> + "ELCUS CAN-200-PCI, " >> + "ASEM DUAL CAN-RAW") >> MODULE_LICENSE("GPL v2"); >> >> #define PLX_PCI_MAX_CHAN 2 >> @@ -70,7 +71,9 @@ struct plx_pci_card { >> */ >> >> #define PLX_LINT1_EN 0x1 /* Local interrupt 1 enable */ >> +#define PLX_LINT1_POL (1 << 1) /* Local interrupt 1 polarity */ >> #define PLX_LINT2_EN (1 << 3) /* Local interrupt 2 enable */ >> +#define PLX_LINT2_POL (1 << 4) /* Local interrupt 2 polarity */ >> #define PLX_PCI_INT_EN (1 << 6) /* PCI Interrupt Enable */ >> #define PLX_PCI_RESET (1 << 30) /* PCI Adapter Software Reset */ >> >> @@ -92,6 +95,9 @@ struct plx_pci_card { >> */ >> #define PLX_PCI_OCR (OCR_TX0_PUSHPULL | OCR_TX1_PUSHPULL) >> >> +/* OCR setting for ASEM Dual CAN raw */ >> +#define ASEM_PCI_OCR 0xfe >> + >> /* >> * In the CDR register, you should set CBP to 1. >> * You will probably also want to set the clock divider value to 7 >> @@ -145,10 +151,20 @@ struct plx_pci_card { >> #define MOXA_PCI_VENDOR_ID 0x1393 >> #define MOXA_PCI_DEVICE_ID 0x0100 >> >> +#define ASEM_RAW_CAN_VENDOR_ID 0x10b5 >> +#define ASEM_RAW_CAN_DEVICE_ID 0x9030 >> +#define ASEM_RAW_CAN_SUB_VENDOR_ID 0x3000 >> +#define ASEM_RAW_CAN_SUB_DEVICE_ID 0x1001 >> +#define ASEM_RAW_CAN_SUB_DEVICE_ID_BIS 0x1002 >> +#define ASEM_RAW_CAN_RST_REGISTER 0x54 >> +#define ASEM_RAW_CAN_RST_MASK_CAN1 0x20 >> +#define ASEM_RAW_CAN_RST_MASK_CAN2 0x04 >> + >> static void plx_pci_reset_common(struct pci_dev *pdev); >> static void plx9056_pci_reset_common(struct pci_dev *pdev); >> static void plx_pci_reset_marathon_pci(struct pci_dev *pdev); >> static void plx_pci_reset_marathon_pcie(struct pci_dev *pdev); >> +static void plx_pci_reset_asem_dual_can_raw(struct pci_dev *pdev); >> >> struct plx_pci_channel_map { >> u32 bar; >> @@ -269,6 +285,14 @@ static struct plx_pci_card_info plx_pci_card_info_moxa = { >> /* based on PLX9052 */ >> }; >> >> +static struct plx_pci_card_info plx_pci_card_info_asem_dual_can = { >> + "ASEM Dual CAN raw PCI", 2, >> + PLX_PCI_CAN_CLOCK, ASEM_PCI_OCR, PLX_PCI_CDR, >> + {0, 0x00, 0x00}, { {2, 0x00, 0x00}, {4, 0x00, 0x00} }, >> + &plx_pci_reset_asem_dual_can_raw >> + /* based on PLX9030 */ >> +}; >> + >> static const struct pci_device_id plx_pci_tbl[] = { >> { >> /* Adlink PCI-7841/cPCI-7841 */ >> @@ -375,6 +399,20 @@ static const struct pci_device_id plx_pci_tbl[] = { >> 0, 0, >> (kernel_ulong_t)&plx_pci_card_info_moxa >> }, >> + { >> + /* ASEM Dual CAN raw */ >> + ASEM_RAW_CAN_VENDOR_ID, ASEM_RAW_CAN_DEVICE_ID, >> + ASEM_RAW_CAN_SUB_VENDOR_ID, ASEM_RAW_CAN_SUB_DEVICE_ID, >> + 0, 0, >> + (kernel_ulong_t)&plx_pci_card_info_asem_dual_can >> + }, >> + { >> + /* ASEM Dual CAN raw -new model */ >> + ASEM_RAW_CAN_VENDOR_ID, ASEM_RAW_CAN_DEVICE_ID, >> + ASEM_RAW_CAN_SUB_VENDOR_ID, ASEM_RAW_CAN_SUB_DEVICE_ID_BIS, >> + 0, 0, >> + (kernel_ulong_t)&plx_pci_card_info_asem_dual_can >> + }, >> { 0,} >> }; >> MODULE_DEVICE_TABLE(pci, plx_pci_tbl); >> @@ -524,6 +562,32 @@ static void plx_pci_reset_marathon_pcie(struct pci_dev *pdev) >> } >> } >> >> +/* Special reset function for ASEM Dual CAN raw card */ >> +static void plx_pci_reset_asem_dual_can_raw(struct pci_dev *pdev) >> +{ >> + void __iomem *bar0_addr; >> + u8 tmpval; >> + >> + plx_pci_reset_common(pdev); >> + >> + bar0_addr = pci_iomap(pdev, 0, 0); >> + if (!bar0_addr) { >> + dev_err(&pdev->dev, "Failed to remap reset space %d (BAR%d)\n", >> + 0, 0); > >I've put both 0 directly into the string while applying the patch. > >Tnx, >Marc Thanks, Flavio > >-- >Pengutronix e.K. | Marc Kleine-Budde | >Industrial Linux Solutions | Phone: +49-231-2826-924 | >Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | >Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |