From patchwork Wed Mar 26 15:44:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3894111 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 68ACC9F369 for ; Wed, 26 Mar 2014 15:44:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 878D02021C for ; Wed, 26 Mar 2014 15:44:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 735BC20158 for ; Wed, 26 Mar 2014 15:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753842AbaCZPo2 (ORCPT ); Wed, 26 Mar 2014 11:44:28 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:49873 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803AbaCZPo1 (ORCPT ); Wed, 26 Mar 2014 11:44:27 -0400 Received: by mail-pd0-f181.google.com with SMTP id p10so2028090pdj.12 for ; Wed, 26 Mar 2014 08:44:27 -0700 (PDT) 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=qlcR1j2ZokutceqJtFiczItVyxwFPi6MrD16Ki45kxI=; b=IKbTTCr6fqnh1bjHGzS/xwt/4qoT/rg8Bzer6sdF/eHgaMAKJo7vh1GLClo6eqiFtS DgM6uroOe0Cssu2L6vTP1PUTVacGE+2fwQRjX4tFDBEuiP1tIxzBOYuJyzYiByXq8WlM fhBWKRU3sO0WtmcrRKQfAIXDyQ+R+kMAiXylwskb1XQ4JkZ9I0eEdWqGIeiR1fG9kPFz V/yv8GeR2YiIWGuOJ3fhY55r6GDh+IzW0MQAZQrFhICUE+pGvc4Mlsb6i8XjM34seFJx odzkJItExSgCI/Lgn7kyyB5BEg3sckUX00Qe1rlZmd+a4WXP0E6QEI0TIMGGueiruD1/ NnOg== X-Gm-Message-State: ALoCoQm8OamN+2G0otY5X5iAmSyjYI8JMQNxvNK11K+ZTcd3uGw3mABK/3l048LFkeFf8SzN9vFE X-Received: by 10.68.28.69 with SMTP id z5mr87131489pbg.121.1395848666931; Wed, 26 Mar 2014 08:44:26 -0700 (PDT) Received: from [10.145.55.57] ([60.245.65.194]) by mx.google.com with ESMTPSA id ha2sm59746031pbb.8.2014.03.26.08.44.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Mar 2014 08:44:25 -0700 (PDT) Message-ID: <1395848658.11134.1.camel@phoenix> Subject: [PATCH] spi: clps711x: Convert to use master->max_speed_hz From: Axel Lin To: Mark Brown Cc: Alexander Shiyan , linux-spi@vger.kernel.org Date: Wed, 26 Mar 2014 23:44:18 +0800 X-Mailer: Evolution 3.8.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.3 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 highest transfer speed to master->max_speed_hz and then we can remove hw->max_speed. Signed-off-by: Axel Lin --- drivers/spi/spi-clps711x.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index d623500..4cd62f6 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c @@ -32,7 +32,6 @@ struct spi_clps711x_data { struct regmap *syscon; struct regmap *syscon1; struct clk *spi_clk; - u32 max_speed_hz; u8 *tx_buf; u8 *rx_buf; @@ -51,16 +50,17 @@ static int spi_clps711x_setup(struct spi_device *spi) static void spi_clps711x_setup_xfer(struct spi_device *spi, struct spi_transfer *xfer) { - struct spi_clps711x_data *hw = spi_master_get_devdata(spi->master); + struct spi_master *master = spi->master; + struct spi_clps711x_data *hw = spi_master_get_devdata(master); /* Setup SPI frequency divider */ - if (!xfer->speed_hz || (xfer->speed_hz >= hw->max_speed_hz)) + if (xfer->speed_hz >= master->max_speed_hz) regmap_update_bits(hw->syscon1, SYSCON_OFFSET, SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(3)); - else if (xfer->speed_hz >= (hw->max_speed_hz / 2)) + else if (xfer->speed_hz >= (master->max_speed_hz / 2)) regmap_update_bits(hw->syscon1, SYSCON_OFFSET, SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(2)); - else if (xfer->speed_hz >= (hw->max_speed_hz / 8)) + else if (xfer->speed_hz >= (master->max_speed_hz / 8)) regmap_update_bits(hw->syscon1, SYSCON_OFFSET, SYSCON1_ADCKSEL_MASK, SYSCON1_ADCKSEL(1)); else @@ -182,7 +182,7 @@ static int spi_clps711x_probe(struct platform_device *pdev) ret = PTR_ERR(hw->spi_clk); goto err_out; } - hw->max_speed_hz = clk_get_rate(hw->spi_clk); + master->max_speed_hz = clk_get_rate(hw->spi_clk); platform_set_drvdata(pdev, master); @@ -220,7 +220,7 @@ static int spi_clps711x_probe(struct platform_device *pdev) if (!ret) { dev_info(&pdev->dev, "SPI bus driver initialized. Master clock %u Hz\n", - hw->max_speed_hz); + master->max_speed_hz); return 0; }