From patchwork Mon Nov 17 15:17:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 5322411 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 7CF859F1E1 for ; Mon, 17 Nov 2014 15:17:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC5CE20115 for ; Mon, 17 Nov 2014 15:17:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE1F420120 for ; Mon, 17 Nov 2014 15:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752811AbaKQPR1 (ORCPT ); Mon, 17 Nov 2014 10:17:27 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:34635 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752419AbaKQPR1 (ORCPT ); Mon, 17 Nov 2014 10:17:27 -0500 Received: by mail-pd0-f171.google.com with SMTP id r10so21348815pdi.2 for ; Mon, 17 Nov 2014 07:17:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7m1XFH963BXfG+gUloFJ6IIEWzztrM3OK2XNfy+soL0=; b=dUwvl6n2U0D25t5E4SmQJrRYmJATZvnp+d10Y9rUkIkHNqZmX5cEoNXiLBumo9Zoyd zQZl86mHrrAGylmWiqAGMunmaPZiQfQAxnIDC/8ngEKB7aUIGy3u/XC7jTHi3CP7V6ki G+nxFe1/KsZmr0e1j9Ku8VAFudBIdRnHNnV9jsr3L11xsfRdCOmKeIZXTNf29lA1lgtk uPgvkr5Idko4b6lUIERoDBbrnjP7dmZ1aBILC5e3bbf1DNw9SvqqKCMrikW1VIILI1tm /5I/i4IOrA7QRZRgmFDJzzZO3ND9cHGoNdr3c+G0Bm/XI9rqcbiq6ydj8wj0lYFYVcaU xYXw== X-Received: by 10.68.227.161 with SMTP id sb1mr29835425pbc.5.1416237446629; Mon, 17 Nov 2014 07:17:26 -0800 (PST) Received: from localhost.localdomain ([140.207.223.187]) by mx.google.com with ESMTPSA id xd3sm5778407pbc.54.2014.11.17.07.17.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Nov 2014 07:17:26 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: workgroup.linux@csr.com, Qipan Li , Barry Song Subject: [PATCH 2/2] spi: sirf: assign spi_master's max_speed_hz member Date: Mon, 17 Nov 2014 23:17:03 +0800 Message-Id: <1416237423-3606-2-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416237423-3606-1-git-send-email-21cnbao@gmail.com> References: <1416237423-3606-1-git-send-email-21cnbao@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 From: Qipan Li if spi device has no frequency, spi core will setup the default frequency to max_speed_hz of spi_master according to int spi_setup(struct spi_device *spi) { ... if (!spi->max_speed_hz) spi->max_speed_hz = spi->master->max_speed_hz; ... } this patch moves CSR SiRFSoC SPI frequency set to follow SPI core behaviour. Signed-off-by: Qipan Li Signed-off-by: Barry Song --- drivers/spi/spi-sirf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index f63de78..90dc05b 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -134,6 +134,7 @@ ALIGNED(x->len) && (x->len < 2 * PAGE_SIZE)) #define SIRFSOC_MAX_CMD_BYTES 4 +#define SIRFSOC_SPI_DEFAULT_FRQ 1000000 struct sirfsoc_spi { struct spi_bitbang bitbang; @@ -629,9 +630,6 @@ static int spi_sirfsoc_setup(struct spi_device *spi) { struct sirfsoc_spi *sspi; - if (!spi->max_speed_hz) - return -EINVAL; - sspi = spi_master_get_devdata(spi->master); if (spi->cs_gpio == -ENOENT) @@ -683,6 +681,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH; master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(12) | SPI_BPW_MASK(16) | SPI_BPW_MASK(32); + master->max_speed_hz = SIRFSOC_SPI_DEFAULT_FRQ; sspi->bitbang.master->dev.of_node = pdev->dev.of_node; /* request DMA channels */