From patchwork Mon Feb 10 13:51:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3619011 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 5986CBF418 for ; Mon, 10 Feb 2014 13:51:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A144F2010F for ; Mon, 10 Feb 2014 13:51:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F18AE2016C for ; Mon, 10 Feb 2014 13:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752452AbaBJNv1 (ORCPT ); Mon, 10 Feb 2014 08:51:27 -0500 Received: from mail-pd0-f169.google.com ([209.85.192.169]:60962 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752418AbaBJNv0 (ORCPT ); Mon, 10 Feb 2014 08:51:26 -0500 Received: by mail-pd0-f169.google.com with SMTP id v10so6145979pde.0 for ; Mon, 10 Feb 2014 05:51:25 -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=ko0Gq1Hi4XqMsvwS6nyQ0K2VbOBlc1GOzz091vEPuPw=; b=NalakK5lzjsf/oUfPArBLW7ohincF6a2dEotdCjV6/BCD4md8H2t7Hb+jvUCsbn7XN JBFjFgFR9Ru3f6IQ+1YG8vVS/3Uo7DudKTjYW62tBeBh8jwT4f/tQ/GY+88+3CjNYwDG L2CiTUsPiGIF2oUDOJLVfPNCqFpyFwmSQBDgg/AGe4yM0sEFEyISTZi0FAhuCowcpL1X q1hAklni1aRvspeJvz76emo69AGCSS2Fmy/6D2S9LTMJsfw7Xbt3lYioKR91zifQ525k cHoz3OEdgoxukxfHh/exJbNcLSbP94XABdlrQdIH1HwcHqjSBQvrFOLFTkLnqcJ8rXhx E2eQ== X-Gm-Message-State: ALoCoQlQGF2yG8Syq+5LQZTp0lwf/j4R/HL/W4bi5AZoR/gtZQdhXLAYYHgjr58fZhu07AJA5HkN X-Received: by 10.66.191.42 with SMTP id gv10mr25756906pac.125.1392040285722; Mon, 10 Feb 2014 05:51:25 -0800 (PST) Received: from [10.145.55.56] ([60.245.65.194]) by mx.google.com with ESMTPSA id y9sm111351147pas.10.2014.02.10.05.51.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 05:51:25 -0800 (PST) Message-ID: <1392040273.4191.5.camel@phoenix> Subject: [PATCH 3/3] spi: tegra20-slink: Convert to use master->max_speed_hz From: Axel Lin To: Mark Brown Cc: Laxman Dewangan , Stephen Warren , Thierry Reding , linux-spi@vger.kernel.org Date: Mon, 10 Feb 2014 21:51:13 +0800 In-Reply-To: <1392040096.4191.1.camel@phoenix> References: <1392040096.4191.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=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 Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will handle checking transfer speed. In additional, since commit 052eb2d49006 'spi: core: Set max_speed_hz of spi_device default to max_speed_hz of controller', spi core will also set default spi->max_speed_hz if it is not set. So remove the duplicate code in tegra_slink_setup. Signed-off-by: Axel Lin --- drivers/spi/spi-tegra20-slink.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index 8d62710..9a060aa 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -170,7 +170,6 @@ struct tegra_slink_data { void __iomem *base; phys_addr_t phys; unsigned irq; - u32 spi_max_frequency; u32 cur_speed; struct spi_device *cur_spi; @@ -762,8 +761,6 @@ static int tegra_slink_setup(struct spi_device *spi) BUG_ON(spi->chip_select >= MAX_CHIP_SELECT); - /* Set speed to the spi max fequency if spi device has not set */ - spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency; ret = pm_runtime_get_sync(tspi->dev); if (ret < 0) { dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); @@ -998,15 +995,6 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data) return IRQ_WAKE_THREAD; } -static void tegra_slink_parse_dt(struct tegra_slink_data *tspi) -{ - struct device_node *np = tspi->dev->of_node; - - if (of_property_read_u32(np, "spi-max-frequency", - &tspi->spi_max_frequency)) - tspi->spi_max_frequency = 25000000; /* 25MHz */ -} - static const struct tegra_slink_chip_data tegra30_spi_cdata = { .cs_hold_time = true, }; @@ -1061,7 +1049,9 @@ static int tegra_slink_probe(struct platform_device *pdev) tspi->chip_data = cdata; spin_lock_init(&tspi->lock); - tegra_slink_parse_dt(tspi); + if (of_property_read_u32(tspi->dev->of_node, "spi-max-frequency", + &master->max_speed_hz)) + master->max_speed_hz = 25000000; /* 25MHz */ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!r) {