From patchwork Thu Nov 7 20:17:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 178828 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1581553ilf; Thu, 7 Nov 2019 12:17:32 -0800 (PST) X-Google-Smtp-Source: APXvYqy4X9DMyoLw2QDsDhUiOFsi93yiXWhso0jCWedJlWrdN/CJXikBBlSRxeMlMB6dnG8MFwVm X-Received: by 2002:a17:906:6d8a:: with SMTP id h10mr5043657ejt.224.1573157852062; Thu, 07 Nov 2019 12:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573157852; cv=none; d=google.com; s=arc-20160816; b=tNEt2JcrDQksJz5kIf4cHCGsFRerRFl3Qwb/U3c0klDy910459reqikQxJZVF408HR eRwmW1JpXRw08mCvVfx7UbXN6Pb60EzgD4fFcwuCNMaThlt4OR2SHB9dhK8umdLfMqu0 U+q+43FAi5NLveV+qBsTugMx7CYdXeMdUmGiUQ1w0oq1hHqT7+n673Xe+pCDsR9EdJvy tc9x7l/u1lgghRcLc1PEQ/iSYgG59zAM0Vr8xSfHCZvKIv8rhxWRwxzLy229rt3Yaw2A kN69Jla1bEgTon4ty5lM0z4OL1xNXQi8Nibq0LYII92uQgCHISjGq9SNlAshtAx4yhWb Q/dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IfBF8N8O1vGmVN86XMswrU/+wD8KeNGcTXaMDHv5bNc=; b=oAswKPXmjvo1+Pz0bZilBDS+npVFoetn9JNu4TYDB6w6wPvBKGFZ9kgY84lCud3V/y ToVhxFV9IFqV8MZEc3x4xxeT7RbKPQz9afz/2ppoC3KrFyIAXivKbKR/+7Ljc2SAdl0c jaLflbI2i0ObsxjZ4Q0ceFKy/tmMkwr6+wueNp5keObik/qDpJu6/5K/0EdZedUqzNt1 RhMNSaH/FQaWMdbT7Va7JJJvYA2we7xxFpMUrOsbhDjd4qTPb2n6JDObBnDRk1DAp+x3 8O6Aofs6ADqYnXjaYFCr7r9AS2MaTmzegutXYCgGjqDVxrdu35qP6HAT+fBYo1TlHyrA vXig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fChiVLhY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si2137345ejb.49.2019.11.07.12.17.31; Thu, 07 Nov 2019 12:17:32 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=fChiVLhY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727405AbfKGUR1 (ORCPT + 26 others); Thu, 7 Nov 2019 15:17:27 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44309 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbfKGURR (ORCPT ); Thu, 7 Nov 2019 15:17:17 -0500 Received: by mail-wr1-f67.google.com with SMTP id f2so4497360wrs.11 for ; Thu, 07 Nov 2019 12:17:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IfBF8N8O1vGmVN86XMswrU/+wD8KeNGcTXaMDHv5bNc=; b=fChiVLhYdW8MmlavzflarIALwM6oQ0oST9a0xpt5JGB0qZEOMP7X0WdzhndbJXFXKD 6k8LOvZvA/TsBMcho59C3LYvbxjYxz0B/Cy2BlH6plJHiYRj6Q8UZdvSDthBoHwHKpiN lYU4B1emlpo79KIN0NkyazFGkzrtsvMP7v8jmv0bJiIGsicKBClB5c0w9mguUu2YQKrv IfcsibvoqBXkS96uVqk0slcwOz7Ht0tocUPpxc34eo5loD6TpalowitM3JU1+OYEsyIo fkw6xKIKLvF1OZmeSxx5MBOBO2rpemTZADULbrE++JP1JtBSnPL5q5NJuyJ8vihLnp/Y gkKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IfBF8N8O1vGmVN86XMswrU/+wD8KeNGcTXaMDHv5bNc=; b=blQlkxcLih9+7yptZb9FaHptDo5i08+0jJfpqA1xv60Ht0Xv71cIQKLm3MzOB6BnbQ fP02M/jZE0XkpjrsKOpWSp7VTxBrYufwXT4Z8Q6EzCuTqzPJbkIhG9+Fzo9wiMJomvFw mGVSydYD+cHg4sqJXT4Gp1BxsKXmPVhM71ZqbIG6wfQuJ/Wy0K4KJmZn2COWT+BabcQm TO8Bi+VO32ENBnTInP77yQaPuPFkSYc+5Mlwh1qxybZKXq2IdntudqYQJwQmwUOTKU/H q0byx9z1UUKPsyP5tXO1D+qz18SxHIlJJrScsReRB+rn+8BBlFuLgFYh0GWqglrMaYol QU9A== X-Gm-Message-State: APjAAAWNJCV6xVESldwNpxCstK13X+L48UfCKdYM2UBTQH9HK8UhKbtV lS1PivvBxW/+sMTTbQ+OPIG4hQ== X-Received: by 2002:adf:b686:: with SMTP id j6mr4742254wre.186.1573157834960; Thu, 07 Nov 2019 12:17:14 -0800 (PST) Received: from localhost.localdomain ([95.147.198.88]) by smtp.gmail.com with ESMTPSA id d11sm3215162wrn.28.2019.11.07.12.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 12:17:14 -0800 (PST) From: Lee Jones To: gregkh@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Nyekjaer , Marc Kleine-Budde , Sasha Levin , Lee Jones Subject: [PATCH 10/10] can: mcp251x: add support for mcp25625 Date: Thu, 7 Nov 2019 20:17:02 +0000 Message-Id: <20191107201702.27023-10-lee.jones@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191107201702.27023-1-lee.jones@linaro.org> References: <20191107201702.27023-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Nyekjaer [ Upstream commit 35b7fa4d07c43ad79b88e6462119e7140eae955c ] Fully compatible with mcp2515, the mcp25625 have integrated transceiver. This patch adds support for the mcp25625 to the existing mcp251x driver. Signed-off-by: Sean Nyekjaer Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Signed-off-by: Lee Jones Change-Id: I537254af4e09553f04873e3cf6be36dbbfc29c88 --- drivers/net/can/spi/Kconfig | 5 +++-- drivers/net/can/spi/mcp251x.c | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) -- 2.24.0 diff --git a/drivers/net/can/spi/Kconfig b/drivers/net/can/spi/Kconfig index 148cae5871a6..249d2db7d600 100644 --- a/drivers/net/can/spi/Kconfig +++ b/drivers/net/can/spi/Kconfig @@ -2,9 +2,10 @@ menu "CAN SPI interfaces" depends on SPI config CAN_MCP251X - tristate "Microchip MCP251x SPI CAN controllers" + tristate "Microchip MCP251x and MCP25625 SPI CAN controllers" depends on HAS_DMA ---help--- - Driver for the Microchip MCP251x SPI CAN controllers. + Driver for the Microchip MCP251x and MCP25625 SPI CAN + controllers. endmenu diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index c66d699640a9..6f86fdf6c9f1 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c @@ -1,5 +1,5 @@ /* - * CAN bus driver for Microchip 251x CAN Controller with SPI Interface + * CAN bus driver for Microchip 251x/25625 CAN Controller with SPI Interface * * MCP2510 support and bug fixes by Christian Pellegrin * @@ -41,7 +41,7 @@ * static struct spi_board_info spi_board_info[] = { * { * .modalias = "mcp2510", - * // or "mcp2515" depending on your controller + * // "mcp2515" or "mcp25625" depending on your controller * .platform_data = &mcp251x_info, * .irq = IRQ_EINT13, * .max_speed_hz = 2*1000*1000, @@ -237,6 +237,7 @@ static const struct can_bittiming_const mcp251x_bittiming_const = { enum mcp251x_model { CAN_MCP251X_MCP2510 = 0x2510, CAN_MCP251X_MCP2515 = 0x2515, + CAN_MCP251X_MCP25625 = 0x25625, }; struct mcp251x_priv { @@ -279,7 +280,6 @@ static inline int mcp251x_is_##_model(struct spi_device *spi) \ } MCP251X_IS(2510); -MCP251X_IS(2515); static void mcp251x_clean(struct net_device *net) { @@ -639,7 +639,7 @@ static int mcp251x_hw_reset(struct spi_device *spi) /* Wait for oscillator startup timer after reset */ mdelay(MCP251X_OST_DELAY_MS); - + reg = mcp251x_read_reg(spi, CANSTAT); if ((reg & CANCTRL_REQOP_MASK) != CANCTRL_REQOP_CONF) return -ENODEV; @@ -820,9 +820,8 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) /* receive buffer 0 */ if (intf & CANINTF_RX0IF) { mcp251x_hw_rx(spi, 0); - /* - * Free one buffer ASAP - * (The MCP2515 does this automatically.) + /* Free one buffer ASAP + * (The MCP2515/25625 does this automatically.) */ if (mcp251x_is_2510(spi)) mcp251x_write_bits(spi, CANINTF, CANINTF_RX0IF, 0x00); @@ -831,7 +830,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) /* receive buffer 1 */ if (intf & CANINTF_RX1IF) { mcp251x_hw_rx(spi, 1); - /* the MCP2515 does this automatically */ + /* The MCP2515/25625 does this automatically. */ if (mcp251x_is_2510(spi)) clear_intf |= CANINTF_RX1IF; } @@ -1004,6 +1003,10 @@ static const struct of_device_id mcp251x_of_match[] = { .compatible = "microchip,mcp2515", .data = (void *)CAN_MCP251X_MCP2515, }, + { + .compatible = "microchip,mcp25625", + .data = (void *)CAN_MCP251X_MCP25625, + }, { } }; MODULE_DEVICE_TABLE(of, mcp251x_of_match); @@ -1017,6 +1020,10 @@ static const struct spi_device_id mcp251x_id_table[] = { .name = "mcp2515", .driver_data = (kernel_ulong_t)CAN_MCP251X_MCP2515, }, + { + .name = "mcp25625", + .driver_data = (kernel_ulong_t)CAN_MCP251X_MCP25625, + }, { } }; MODULE_DEVICE_TABLE(spi, mcp251x_id_table); @@ -1254,5 +1261,5 @@ module_spi_driver(mcp251x_can_driver); MODULE_AUTHOR("Chris Elston , " "Christian Pellegrin "); -MODULE_DESCRIPTION("Microchip 251x CAN driver"); +MODULE_DESCRIPTION("Microchip 251x/25625 CAN driver"); MODULE_LICENSE("GPL v2");