From patchwork Wed Feb 19 09:34: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: 3679631 X-Patchwork-Delegate: broonie@sirena.org.uk Return-Path: X-Original-To: patchwork-linux-spi@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 92C519F35F for ; Wed, 19 Feb 2014 09:34:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ACBE72016C for ; Wed, 19 Feb 2014 09:34:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5BB62015E for ; Wed, 19 Feb 2014 09:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276AbaBSJez (ORCPT ); Wed, 19 Feb 2014 04:34:55 -0500 Received: from mail-pd0-f179.google.com ([209.85.192.179]:56107 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751809AbaBSJex (ORCPT ); Wed, 19 Feb 2014 04:34:53 -0500 Received: by mail-pd0-f179.google.com with SMTP id fp1so144187pdb.24 for ; Wed, 19 Feb 2014 01:34:53 -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=LNLRkrp7MeETku2+BxUO235Vu7pfwJY4NWWBa3i0XL0=; b=Gy435f5ntqw7OjV6HPFMk/af7pkdXfC9Bg8H3SzuNqeKrZhl6AUuMcwNFQF61vIcP+ 8MZdh1U+em+rA9mJQ/cdX3gGgo+9LsS6plPDL2wPQ0I0YFVAlCqbf2wlLizJ+4N5uNBr hvzJdiWxioCfB0QmSF2MQkxga7PLF3VNWRkrPC6dcYzqTbJ9dkgjhqRD/J9IyJ1eTFxu ndXO/rK7d7vkbIgIDiabqdFYUO9nQ0pq9TeWZYB7ijlG27nv55+nJYDJlLAYkVBnZ2jt bO9O/5miFlKfSVbpuMqzpbt3FhIlGJKM6yiDLCU20oxN9Zlaxup0A1A1IJ8HnglzB+xt 7XWA== X-Gm-Message-State: ALoCoQmlYF+vHikD1TKYItScLdyqdsu29ioHD+nZRm7sv05QglhElqVthMNrkfWz802RETnWgN+n X-Received: by 10.66.136.103 with SMTP id pz7mr1062756pab.140.1392802493290; Wed, 19 Feb 2014 01:34:53 -0800 (PST) Received: from [192.168.0.102] (218-164-139-158.dynamic.hinet.net. [218.164.139.158]) by mx.google.com with ESMTPSA id vf7sm63794814pbc.5.2014.02.19.01.34.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 01:34:51 -0800 (PST) Message-ID: <1392802487.7991.3.camel@phoenix> Subject: [RFT][PATCH 2/2] spi: octeon: Convert to let spi core validate transfer speed From: Axel Lin To: Mark Brown Cc: David Daney , John Crispin , linux-spi@vger.kernel.org Date: Wed, 19 Feb 2014 17:34:47 +0800 In-Reply-To: <1392802252.7991.1.camel@phoenix> References: <1392802252.7991.1.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 then spi core will handle checking transfer speed. The behavior is different from current code when the speed_hz is greater than the maximum transfer speed supported by the controller. Unless there is other good reason, I think we had better make the behavior consistent with what spi core does. Signed-off-by: Axel Lin --- drivers/spi/spi-octeon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/spi/spi-octeon.c b/drivers/spi/spi-octeon.c index b47245c..c5e2f71 100644 --- a/drivers/spi/spi-octeon.c +++ b/drivers/spi/spi-octeon.c @@ -66,8 +66,6 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, cpol = mode & SPI_CPOL; speed_hz = xfer->speed_hz ? : spi->max_speed_hz; - if (speed_hz > OCTEON_SPI_MAX_CLOCK_HZ) - speed_hz = OCTEON_SPI_MAX_CLOCK_HZ; clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz); @@ -211,6 +209,7 @@ static int octeon_spi_probe(struct platform_device *pdev) master->transfer_one_message = octeon_spi_transfer_one_message; master->bits_per_word_mask = SPI_BPW_MASK(8); + master->max_speed_hz = OCTEON_SPI_MAX_CLOCK_HZ; master->dev.of_node = pdev->dev.of_node; err = devm_spi_register_master(&pdev->dev, master);