From patchwork Sun Nov 13 13:37:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9424847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 21ECB60484 for ; Sun, 13 Nov 2016 14:00:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14D5B28A0D for ; Sun, 13 Nov 2016 14:00:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08B8F28A1D; Sun, 13 Nov 2016 14:00:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A502D28A0D for ; Sun, 13 Nov 2016 14:00:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934155AbcKMOAD (ORCPT ); Sun, 13 Nov 2016 09:00:03 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32794 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934146AbcKMOAC (ORCPT ); Sun, 13 Nov 2016 09:00:02 -0500 Received: by mail-wm0-f68.google.com with SMTP id u144so8399306wmu.0 for ; Sun, 13 Nov 2016 06:00:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=xbMX5h+zz1D78I7Gck4mUc0iwMKIxTGguyEA5pXTIgE=; b=xrxhXTxq71bTsOUw0ThDw/p5TX/4F0I7QM9RRzX3+EJk+e3WUBQ/6ZfBQwufHKzE7q exMmWZ5Ezqdg9g+vT4c4EZPRjeoE8r7SwXtv1J8hCzzZQcyZhePWdsaaMncT+z7WgkmW 3F/y6oRida1Fnm8E8iW5Jyp2xKprz1e6xOBCHtyDdJbne9HahkH6Cg6xGziM6P/VyVe+ dcXK4vb3zJLjW6vDjBwxJh0IJz/XN0hOsfXtU0hwiCpZf0pOGVGrdYa3zsSnFna5SNHF L2VuLr3bI9T8j/MHPenSSIxCrgL4LIzBkFRChm15I/68ZQQpvf8qhRZkNh5g5o/+GBBt A83w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=xbMX5h+zz1D78I7Gck4mUc0iwMKIxTGguyEA5pXTIgE=; b=PqFTnS3y9dh9kjssEGRQ+Ks6Cb/pR964QXV6jjJiOWo3vAZIdQ89TA8BhTRntC8CGh qQ9+0z0n+BFfMYvxECbEdC6rIoySC5zx/5iVY/eWqNslYiBKH51JR8dC17/+yV6GxsUF BuoOtTwJrsKK1nle6p5mZ8lBXT0n1Sf1tn0bBo76h/o+REAbwCSYp2LVO/uIiu5ZNK6A MZ4U+BA+i5UPpo+UandCuAIHYg8cDjByXAUA+y2kBNdMj9F/z5K+alRRghmZ5MdQacxM rTksFYtDpvT3+GaGcv4Sbv7GXAb0Ui7ZBkK8ykFcn3bSfNi1eoHS2XY1cM6ZNU5lUxp+ WvtA== X-Gm-Message-State: ABUngvdapimDZECRoFXtvB7Tt6zxOBgIVGUGgLwDvMuP6984G5TLfZL6z7geeccfmwenwQ== X-Received: by 10.28.27.133 with SMTP id b127mr6992812wmb.59.1479044481895; Sun, 13 Nov 2016 05:41:21 -0800 (PST) Received: from ?IPv6:2003:62:5f58:9d00:45b5:f382:329:d09c? (p200300625F589D0045B5F3820329D09C.dip0.t-ipconnect.de. [2003:62:5f58:9d00:45b5:f382:329:d09c]) by smtp.googlemail.com with ESMTPSA id y4sm22645700wjp.0.2016.11.13.05.41.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 05:41:21 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 06/10] spi: fsl-espi: migrate relevant parts of mpc8xxx_spi_probe and of_mpc8xxx_spi_probe To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: Date: Sun, 13 Nov 2016 14:37:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Very little of the library functions mpc8xxx_spi_probe and of_mpc8xxx_spi_probe is relevant for fsl-espi. Therefore migrate the relevant parts to fsl-espi (considering that get_brgfreq() always returns -1 on systems with ESPI) and remove use of these functions. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-fsl-espi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index e378622..58314d7 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -587,9 +587,9 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem, dev_set_drvdata(dev, master); - mpc8xxx_spi_probe(dev, mem, irq); - - master->mode_bits |= SPI_RX_DUAL; + master->mode_bits = SPI_RX_DUAL | SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | + SPI_LSB_FIRST | SPI_LOOP; + master->dev.of_node = dev->of_node; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); master->setup = fsl_espi_setup; master->cleanup = fsl_espi_cleanup; @@ -601,6 +601,16 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem, mpc8xxx_spi = spi_master_get_devdata(master); spin_lock_init(&mpc8xxx_spi->lock); + mpc8xxx_spi->dev = dev; + mpc8xxx_spi->spibrg = fsl_get_sys_freq(); + if (mpc8xxx_spi->spibrg == -1) { + dev_err(dev, "Can't get sys frequency!\n"); + ret = -EINVAL; + goto err_probe; + } + + init_completion(&mpc8xxx_spi->done); + mpc8xxx_spi->local_buf = devm_kmalloc(dev, SPCOM_TRANLEN_MAX, GFP_KERNEL); if (!mpc8xxx_spi->local_buf) { @@ -713,10 +723,6 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) return -EINVAL; } - ret = of_mpc8xxx_spi_probe(ofdev); - if (ret) - return ret; - num_cs = of_fsl_espi_get_chipselects(dev); if (!num_cs) return -EINVAL;