From patchwork Mon Aug 19 11:39:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 2846477 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC9B79F271 for ; Mon, 19 Aug 2013 11:40:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24607201DF for ; Mon, 19 Aug 2013 11:40:09 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F540203AD for ; Mon, 19 Aug 2013 11:40:03 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBNoX-0002Ma-1h; Mon, 19 Aug 2013 11:40:01 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBNoU-0003RD-Nj; Mon, 19 Aug 2013 11:39:58 +0000 Received: from smtp33.i.mail.ru ([94.100.177.93]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBNoP-0003Pj-F4 for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2013 11:39:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=MvnQAg2IlLlD2SCcHVOWCDEvwYmQPbxAFxdxFujH4YE=; b=VyF+Yci2+ZkPS7uDqSUYIcLHu8pyNqRJzwDYeb4FbPBDJT7SKyV1f28CaXcBdWIE9aWPghCXqxaWU64XYvYRNEcToh1WD4vpKPh314rSAQPJR3N4LNolVSV89IMD0nfX31YWuHGdUoydl9f/8YzbHuqRhKSx9bW9ImBfZiVyEDg=; Received: from [217.119.30.118] (port=10587 helo=shc.milas.spb.ru) by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1VBNo6-00037e-ES; Mon, 19 Aug 2013 15:39:34 +0400 From: Alexander Shiyan To: linux-can@vger.kernel.org Subject: [PATCH v2 3/3] can: mcp251x: Allow tuning SPI mode and limit maximal SPI speed Date: Mon, 19 Aug 2013 15:39:21 +0400 Message-Id: <1376912361-22133-3-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1376912361-22133-1-git-send-email-shc_work@mail.ru> References: <1376912361-22133-1-git-send-email-shc_work@mail.ru> X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130819_073955_269015_1655F48D X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) Cc: Eric Miao , Alexander Shiyan , Haojian Zhuang , Marc Kleine-Budde , Wolfgang Grandegger , Russell King , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_WEB,RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Patch allow to use different mode settings for SPI (MODE3 for example) and limit maximal speed according to IC datasheet. Signed-off-by: Alexander Shiyan --- drivers/net/can/mcp251x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index a48d3df..c08edc7 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c @@ -1082,7 +1082,11 @@ static int mcp251x_can_probe(struct spi_device *spi) SET_NETDEV_DEV(net, &spi->dev); /* Configure the SPI bus */ - spi->mode = SPI_MODE_0; + spi->mode = spi->mode ? : SPI_MODE_0; + if (mcp251x_is_2510(spi)) + spi->max_speed_hz = spi->max_speed_hz ? : 5 * 1000 * 1000; + else + spi->max_speed_hz = spi->max_speed_hz ? : 10 * 1000 * 1000; spi->bits_per_word = 8; spi_setup(spi);