From patchwork Fri Jun 28 18:43:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hartley Sweeten X-Patchwork-Id: 2801241 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41956BF4A1 for ; Fri, 28 Jun 2013 19:04:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D966202C7 for ; Fri, 28 Jun 2013 19:04:23 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C83AA202C8 for ; Fri, 28 Jun 2013 19:04:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Usdy1-0002Lf-5D; Fri, 28 Jun 2013 19:04:21 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Usdxz-0002La-PK for spi-devel-general@lists.sourceforge.net; Fri, 28 Jun 2013 19:04:19 +0000 X-ACL-Warn: Received: from mail1.bemta8.messagelabs.com ([216.82.243.208]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1Usdxy-0001Us-0Q for spi-devel-general@lists.sourceforge.net; Fri, 28 Jun 2013 19:04:19 +0000 Received: from [216.82.242.115:14201] by server-16.bemta-8.messagelabs.com id DD/91-01682-269DDC15; Fri, 28 Jun 2013 18:43:46 +0000 X-Env-Sender: hartleys@visionengravers.com X-Msg-Ref: server-8.tower-132.messagelabs.com!1372445015!8563127!23 X-Originating-IP: [216.166.12.97] X-StarScan-Received: X-StarScan-Version: 6.9.9; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17091 invoked from network); 28 Jun 2013 18:43:46 -0000 Received: from out001.collaborationhost.net (HELO out001.collaborationhost.net) (216.166.12.97) by server-8.tower-132.messagelabs.com with RC4-SHA encrypted SMTP; 28 Jun 2013 18:43:46 -0000 Received: from etch.local (10.2.3.210) by smtp.collaborationhost.net (10.2.0.21) with Microsoft SMTP Server (TLS) id 8.3.213.0; Fri, 28 Jun 2013 13:43:37 -0500 From: H Hartley Sweeten To: Linux Kernel Subject: [PATCH 2/8] spi: spi-ep93xx: use bits_per_word_mask Date: Fri, 28 Jun 2013 11:43:07 -0700 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Disposition: inline Message-ID: <201306281143.07615.hartleys@visionengravers.com> X-Spam-Score: 0.0 (/) X-Headers-End: 1Usdxy-0001Us-0Q Cc: grant.likely@linaro.org, spi-devel-general@lists.sourceforge.net, mika.westerberg@iki.fi, broonie@kernel.org, Ryan Mallon X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This driver supports 16 to 4 bits per work. Set the bits_per_word_mask to allows the spi core to handle validation. Signed-off-by: H Hartley Sweeten Cc: Ryan Mallon Cc: Mika Westerberg Cc: Mark Brown Cc: Grant Likely --- drivers/spi/spi-ep93xx.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index c633cd0..93ae7b6 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c @@ -272,12 +272,6 @@ static int ep93xx_spi_setup(struct spi_device *spi) struct ep93xx_spi *espi = spi_master_get_devdata(spi->master); struct ep93xx_spi_chip *chip; - if (spi->bits_per_word < 4 || spi->bits_per_word > 16) { - dev_err(&espi->pdev->dev, "invalid bits per word %d\n", - spi->bits_per_word); - return -EINVAL; - } - chip = spi_get_ctldata(spi); if (!chip) { dev_dbg(&espi->pdev->dev, "initial setup for %s\n", @@ -341,10 +335,6 @@ static int ep93xx_spi_transfer(struct spi_device *spi, struct spi_message *msg) /* first validate each transfer */ list_for_each_entry(t, &msg->transfers, transfer_list) { - if (t->bits_per_word) { - if (t->bits_per_word < 4 || t->bits_per_word > 16) - return -EINVAL; - } if (t->speed_hz && t->speed_hz < espi->min_rate) return -EINVAL; } @@ -1022,6 +1012,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev) master->bus_num = pdev->id; master->num_chipselect = info->num_chipselect; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; + master->bits_per_word_mask = 0xfff8; /* 16 to 4 bits per word */ platform_set_drvdata(pdev, master);