From patchwork Mon Feb 10 13:48:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3618991 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 19AF09F382 for ; Mon, 10 Feb 2014 13:48:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D70F2010F for ; Mon, 10 Feb 2014 13:48:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 330462016C for ; Mon, 10 Feb 2014 13:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752429AbaBJNsc (ORCPT ); Mon, 10 Feb 2014 08:48:32 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:60181 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408AbaBJNs2 (ORCPT ); Mon, 10 Feb 2014 08:48:28 -0500 Received: by mail-pd0-f176.google.com with SMTP id w10so6099002pde.21 for ; Mon, 10 Feb 2014 05:48:27 -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=NymHIpfOo/A54uSdNVywxoUz3WbTh9HbqA+ReFWEeps=; b=TlM8FV0bI/7I1Tg0w8KyeWsaMCM/waDMy8nnOHrpZ+aY+wJn47hYxSpMSzsjNJOVgH xaEUCY0LgCxXXocISr0LfilCCmS2o7UMfhlrVISw3KSsIKFgbfHmKJEALHXKXllZZuLk CzvafsRFaQWlKrtQ17xzZrv+cgZ0gnY+Ng5FCFCFai1RqUknVwGuXdb4m5e5FQnDPUUN Je03B2o1uqP70nOhUolVJ3X1pCUL+w8hwTH9usE3GUFSvNhpaT/GS1NlbzDYDaxgHPR7 Tc7nBBJ1fUVrLIe0qPnYdKLhkVYhdKAGYLLgtaGkFFCtUZFCMLHLCo74Y644hJNQPDIl 7Gtg== X-Gm-Message-State: ALoCoQmVOEsl8ZTG4b44SMOMu4eZ4LYu83ecd5N2nXhOWR9tMOww8OCzSW3exPIhrcwA6t/KJ4ZY X-Received: by 10.66.144.227 with SMTP id sp3mr26052824pab.100.1392040107253; Mon, 10 Feb 2014 05:48:27 -0800 (PST) Received: from [10.145.55.56] ([60.245.65.194]) by mx.google.com with ESMTPSA id sy2sm42709271pbc.28.2014.02.10.05.48.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 05:48:26 -0800 (PST) Message-ID: <1392040096.4191.1.camel@phoenix> Subject: [PATCH 1/3] spi: tegra114: 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:48:16 +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=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_spi_setup. Signed-off-by: Axel Lin Acked-by: Stephen Warren --- drivers/spi/spi-tegra114.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 0930d60..2f8aba5 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -171,7 +171,6 @@ struct tegra_spi_data { void __iomem *base; phys_addr_t phys; unsigned irq; - u32 spi_max_frequency; u32 cur_speed; struct spi_device *cur_spi; @@ -762,9 +761,6 @@ static int tegra_spi_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); @@ -1018,16 +1014,6 @@ static irqreturn_t tegra_spi_isr(int irq, void *context_data) return IRQ_WAKE_THREAD; } -static void tegra_spi_parse_dt(struct platform_device *pdev, - struct tegra_spi_data *tspi) -{ - struct device_node *np = pdev->dev.of_node; - - if (of_property_read_u32(np, "spi-max-frequency", - &tspi->spi_max_frequency)) - tspi->spi_max_frequency = 25000000; /* 25MHz */ -} - static struct of_device_id tegra_spi_of_match[] = { { .compatible = "nvidia,tegra114-spi", }, {} @@ -1049,8 +1035,9 @@ static int tegra_spi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, master); tspi = spi_master_get_devdata(master); - /* Parse DT */ - tegra_spi_parse_dt(pdev, tspi); + if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency", + &master->max_speed_hz)) + master->max_speed_hz = 25000000; /* 25MHz */ /* the spi->mode bits understood by this driver: */ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;