From patchwork Sun Mar 29 14:03:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sperl X-Patchwork-Id: 6117031 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A7573BF4A6 for ; Sun, 29 Mar 2015 14:03:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD9FC20165 for ; Sun, 29 Mar 2015 14:03:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D826320279 for ; Sun, 29 Mar 2015 14:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753404AbbC2ODx (ORCPT ); Sun, 29 Mar 2015 10:03:53 -0400 Received: from 212-186-180-163.dynamic.surfer.at ([212.186.180.163]:58074 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbbC2ODv convert rfc822-to-8bit (ORCPT ); Sun, 29 Mar 2015 10:03:51 -0400 Received: from msmac.intern.sperl.org (account martin@sperl.org [10.10.10.11] verified) by sperl.org (CommuniGate Pro SMTP 6.1.2) with ESMTPSA id 6290423; Sun, 29 Mar 2015 14:03:46 +0000 From: Martin Sperl Subject: [PATCH 4/6] spi: bcm2835: warn about native-chip-selects being used Message-Id: <0330B85B-A297-482B-80A9-E01F236D33D2@martin.sperl.org> Date: Sun, 29 Mar 2015 16:03:26 +0200 To: Mark Brown , Stephen Warren , lee@kernel.org, linux-spi@vger.kernel.org, linux-rpi-kernel Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) X-Mailer: Apple Mail (2.2070.6) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Signed-off-by: Martin Sperl Tested-by: Martin Sperl --- drivers/spi/spi-bcm2835.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) Applies against spi - topic/bcm2835 Could get replaced by something similar to this. if (!gpio_is_valid(spi->gpio_cs)) { if (spi->chip_select == 0) { spi->gpio_cs = 8; gpio_set_output(spi->gpio_cs); } if (spi->chip_select == 1) { spi->gpio_cs = 7; gpio_set_output(spi->gpio_cs); } } But I do not know what is the correct call to use. diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index adf157b..601fc5e 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -82,6 +82,7 @@ struct bcm2835_spi { u8 *rx_buf; int tx_len; int rx_len; + bool native_cs_use_warning_done; }; static inline u32 bcm2835_rd(struct bcm2835_spi *bs, unsigned reg) @@ -287,6 +288,9 @@ static void bcm2835_spi_set_cs(struct spi_device *spi, bool gpio_level) static int bcm2835_spi_setup(struct spi_device *spi) { + struct spi_master *master = spi->master; + struct bcm2835_spi *bs = spi_master_get_devdata(master); + /* * sanity checking the native-chipselects */ @@ -294,6 +298,14 @@ static int bcm2835_spi_setup(struct spi_device *spi) return 0; if (gpio_is_valid(spi->cs_gpio)) return 0; + /* we are in the native chipselect case now, + * so warn about the fact that some things may not work as well + */ + if (!bs->native_cs_use_warning_done) { + dev_warn(&spi->dev, + "setup: native chipselect is used - some driver functions/optimizations are not applied\n"); + bs->native_cs_use_warning_done = 1; + } if (spi->chip_select < 3) return 0;