From patchwork Mon Feb 10 13:49:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3619001 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 3A288BF418 for ; Mon, 10 Feb 2014 13:49:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DDDA2016C for ; Mon, 10 Feb 2014 13:49:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 941EE20179 for ; Mon, 10 Feb 2014 13:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751970AbaBJNt4 (ORCPT ); Mon, 10 Feb 2014 08:49:56 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:51618 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751791AbaBJNtz (ORCPT ); Mon, 10 Feb 2014 08:49:55 -0500 Received: by mail-pd0-f171.google.com with SMTP id g10so6092708pdj.16 for ; Mon, 10 Feb 2014 05:49:55 -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=15MhfHlIwsUcb8UnZIlnqk3/WNfD1BRThaotZBGoWBw=; b=ZNprM6dvO2VLZHRs5ogyAxmDN7mOt8E2WdRW98i+O/5XaH91AOdHJrDW0ra79d4uPv gdUNn7OcNuaeCBWuvIyAYLonJiq23rebAY9qzslpCPvuh+dVY2NGQR8+c5ISGw1X0Ptd HbkZfg3EC77zM+68ReD9WuV90CEhigYmoSdLmwx15ZiNDzZ3e4IqTPDpwuhRj1ZvdlC/ 5hINJfZbBRFjuI0OAaZhvzFCP6TuM0oKNK8steZBu1ZGNvHZlZyykjw419k3gmP/4Mbs X+WVs3OAl2JvZXywHlgc8i4TQ8fiGgjcxEzHaaqxxr56OYv301HfC+nWX1DWnFXi240g xymw== X-Gm-Message-State: ALoCoQlLEkqWMsWLBZbXAg9Tk+tyz9m/Kl/+wLKr3SxbrHDL7dxofuEp7ZDqox5brEOSqGYtDR7s X-Received: by 10.66.146.229 with SMTP id tf5mr26029886pab.50.1392040195335; Mon, 10 Feb 2014 05:49:55 -0800 (PST) Received: from [10.145.55.56] ([60.245.65.194]) by mx.google.com with ESMTPSA id bz4sm42749429pbb.12.2014.02.10.05.49.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 05:49:54 -0800 (PST) Message-ID: <1392040189.4191.3.camel@phoenix> Subject: [PATCH 2/3] spi: tegra20-sflash: 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:49:49 +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 tegra_sflash_setup(). Signed-off-by: Axel Lin --- drivers/spi/spi-tegra20-sflash.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 18037ab..5db73c0 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c @@ -120,7 +120,6 @@ struct tegra_sflash_data { struct reset_control *rst; void __iomem *base; unsigned irq; - u32 spi_max_frequency; u32 cur_speed; struct spi_device *cur_spi; @@ -314,15 +313,6 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, return tegra_sflash_start_cpu_based_transfer(tsd, t); } -static int tegra_sflash_setup(struct spi_device *spi) -{ - struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master); - - /* Set speed to the spi max fequency if spi device has not set */ - spi->max_speed_hz = spi->max_speed_hz ? : tsd->spi_max_frequency; - return 0; -} - static int tegra_sflash_transfer_one_message(struct spi_master *master, struct spi_message *msg) { @@ -429,15 +419,6 @@ static irqreturn_t tegra_sflash_isr(int irq, void *context_data) return handle_cpu_based_xfer(tsd); } -static void tegra_sflash_parse_dt(struct tegra_sflash_data *tsd) -{ - struct device_node *np = tsd->dev->of_node; - - if (of_property_read_u32(np, "spi-max-frequency", - &tsd->spi_max_frequency)) - tsd->spi_max_frequency = 25000000; /* 25MHz */ -} - static struct of_device_id tegra_sflash_of_match[] = { { .compatible = "nvidia,tegra20-sflash", }, {} @@ -466,7 +447,6 @@ static int tegra_sflash_probe(struct platform_device *pdev) /* the spi->mode bits understood by this driver: */ master->mode_bits = SPI_CPOL | SPI_CPHA; - master->setup = tegra_sflash_setup; master->transfer_one_message = tegra_sflash_transfer_one_message; master->auto_runtime_pm = true; master->num_chipselect = MAX_CHIP_SELECT; @@ -478,7 +458,9 @@ static int tegra_sflash_probe(struct platform_device *pdev) tsd->dev = &pdev->dev; spin_lock_init(&tsd->lock); - tegra_sflash_parse_dt(tsd); + if (of_property_read_u32(tsd->dev->of_node, "spi-max-frequency", + &master->max_speed_hz)) + master->max_speed_hz = 25000000; /* 25MHz */ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); tsd->base = devm_ioremap_resource(&pdev->dev, r);