From patchwork Thu Feb 20 13:37:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3687041 X-Patchwork-Delegate: broonie@sirena.org.uk 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 09246BF13A for ; Thu, 20 Feb 2014 13:38:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D28E2017E for ; Thu, 20 Feb 2014 13:38:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4CEA420166 for ; Thu, 20 Feb 2014 13:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754015AbaBTNiL (ORCPT ); Thu, 20 Feb 2014 08:38:11 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34261 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753697AbaBTNiK (ORCPT ); Thu, 20 Feb 2014 08:38:10 -0500 Received: by mail-pa0-f48.google.com with SMTP id kx10so1904358pab.7 for ; Thu, 20 Feb 2014 05:38:09 -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:content-type :mime-version:content-transfer-encoding; bh=csYoVsNBVAK43E0THP2rCWPE8yiB9vWyyLci1GrqP30=; b=gwjr6uLSFJWl1eDm35xkiubiCsiTRJkUkaZZ348r7l7eozpbhvs2ldtSOpSJ+meK1D Hjpqz1BX/hqmTccBvlpZHPPmARsKouSWrYiiv0BSt21GUqMk/1iLHQJRkMofaVltrgVi VbKZX6i1On6iVoD0sG93DuiMRiaK+gD/XMkJLUEWmAOrDw/61htkhqJLEmaLX8njPMJs uE7bc2uClGVVgiddgPybb6kFIcuyix1e6HBfQ9xs2Th/9Y2jma/J9/0VdtuapkgAOwdL r6D6aWmNI3IGm0j6zZw7/VJj8ZC2nf3m9OUQ4y3QdzfzZfc3causfn4/GbVRzEKtPI1K h2Cg== X-Gm-Message-State: ALoCoQkYrkoq/I+5otmfQ8Ghc/h518URIFXcQIjL8dYj4cMa8WXXawFUMq5/2wnZV1NSmKGd8rPr X-Received: by 10.66.160.225 with SMTP id xn1mr2129505pab.108.1392903489226; Thu, 20 Feb 2014 05:38:09 -0800 (PST) Received: from [10.145.55.56] ([60.245.65.194]) by mx.google.com with ESMTPSA id n6sm11335844pbj.22.2014.02.20.05.38.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 05:38:08 -0800 (PST) Message-ID: <1392903476.16767.1.camel@phoenix> Subject: [PATCH] spi: dw: Convert to let spi core validate transfer speed From: Axel Lin To: Mark Brown Cc: Baruch Siach , Jarkko Nikula , linux-spi@vger.kernel.org Date: Thu, 20 Feb 2014 21:37:56 +0800 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 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-dw.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index bf98d63..9e4a0aa 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -439,12 +439,6 @@ static void pump_transfers(unsigned long data) if (transfer->speed_hz != speed) { speed = transfer->speed_hz; - if (speed > dws->max_freq) { - printk(KERN_ERR "MRST SPI0: unsupported" - "freq: %dHz\n", speed); - message->status = -EIO; - goto early_exit; - } /* clk_div doesn't support odd number */ clk_div = dws->max_freq / speed; @@ -809,6 +803,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) master->cleanup = dw_spi_cleanup; master->setup = dw_spi_setup; master->transfer = dw_spi_transfer; + master->max_speed_hz = dws->max_freq; /* Basic HW init */ spi_hw_init(dws);