From patchwork Tue Feb 18 14:02:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3670961 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4FE94BF13A for ; Tue, 18 Feb 2014 14:03:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DE46201D3 for ; Tue, 18 Feb 2014 14:02:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 035BF2016C for ; Tue, 18 Feb 2014 14:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755483AbaBROCx (ORCPT ); Tue, 18 Feb 2014 09:02:53 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35454 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755393AbaBROCx (ORCPT ); Tue, 18 Feb 2014 09:02:53 -0500 Received: by mail-pa0-f47.google.com with SMTP id kp14so16731693pab.34 for ; Tue, 18 Feb 2014 06:02:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=cQRR3du0QI50q+fnVJ+zUyJfL2hrz1m6XLNiL0Bxaxg=; b=hp1flVI1ZDEORV4CMjXUl+OfB8uHLvO4vUzTJB6NAn/cIIAchuDCk8lIC6ULJJmC/E FffZQl2Jw7VYeZ0n2nLXTiT0TRkBEJqC3j4WkbAIeP7kh5i3Yc33zRi6uATyd3Dg83uR 2Cv4N+8+LmeE0YP5aVg5awVO88xGZagIDw+ziNc7YyyKKtNFVtZ46J2JNUj7zV6RHHc2 k1qpK/0bWP2PiD8K764UE867biJ22kNG2g3fsyT6dwqryVVEw39mHO1OgnW/q27b3PUV GVjKmfYzC5UOOZZVX4SDSOZFnTcaTUdDOS43zsXFICO97IwDg2WGTwuc3Bb0hUqee5Vp uZiQ== X-Gm-Message-State: ALoCoQk7rvU8fFLrgpofvI3Q8SMMYKOTrSL7ayLrOtjPFcMmIzL3m1Efb/K4GFcCtibq15oJoemF X-Received: by 10.68.229.164 with SMTP id sr4mr32877686pbc.82.1392732172787; Tue, 18 Feb 2014 06:02:52 -0800 (PST) Received: from [192.168.0.102] (218-164-138-164.dynamic.hinet.net. [218.164.138.164]) by mx.google.com with ESMTPSA id zc6sm143030700pab.18.2014.02.18.06.02.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:02:52 -0800 (PST) Message-ID: <1392732167.22192.1.camel@phoenix> Subject: [PATCH 2/2] spi: omap2-mcspi: Convert to let spi core validate transfer speed From: Axel Lin To: Mark Brown Cc: Stefan =?ISO-8859-1?Q?S=F8rensen?= , Victor Kamensky , Illia Smyrnov , linux-spi@vger.kernel.org Date: Tue, 18 Feb 2014 22:02:47 +0800 In-Reply-To: <1392732096.22192.0.camel@phoenix> References: <1392732096.22192.0.camel@phoenix> X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Set master->max_speed_hz and master->min_speed_hz then spi core will handle checking transfer speed. So we can remove the same checking in this driver. Signed-off-by: Axel Lin --- drivers/spi/spi-omap2-mcspi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 82cbe73..2941c5b 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1212,8 +1212,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, void *rx_buf = t->rx_buf; unsigned len = t->len; - if (t->speed_hz > OMAP2_MCSPI_MAX_FREQ - || (len && !(rx_buf || tx_buf))) { + if ((len && !(rx_buf || tx_buf))) { dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n", t->speed_hz, len, @@ -1222,12 +1221,6 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, t->bits_per_word); return -EINVAL; } - if (t->speed_hz && t->speed_hz < (OMAP2_MCSPI_MAX_FREQ >> 15)) { - dev_dbg(mcspi->dev, "speed_hz %d below minimum %d Hz\n", - t->speed_hz, - OMAP2_MCSPI_MAX_FREQ >> 15); - return -EINVAL; - } if (m->is_dma_mapped || len < DMA_MIN_BYTES) continue; @@ -1339,6 +1332,8 @@ static int omap2_mcspi_probe(struct platform_device *pdev) master->transfer_one_message = omap2_mcspi_transfer_one_message; master->cleanup = omap2_mcspi_cleanup; master->dev.of_node = node; + master->max_speed_hz = OMAP2_MCSPI_MAX_FREQ; + master->min_speed_hz = OMAP2_MCSPI_MAX_FREQ >> 15; platform_set_drvdata(pdev, master);