From patchwork Thu Feb 28 11:05:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10832783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D13E01399 for ; Thu, 28 Feb 2019 11:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5C542DAF7 for ; Thu, 28 Feb 2019 11:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9A482DD8A; Thu, 28 Feb 2019 11:05:19 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable 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 1F39A2DCE3 for ; Thu, 28 Feb 2019 11:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731334AbfB1LFR (ORCPT ); Thu, 28 Feb 2019 06:05:17 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:44076 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731102AbfB1LFR (ORCPT ); Thu, 28 Feb 2019 06:05:17 -0500 Received: from ramsan ([84.194.111.163]) by michel.telenet-ops.be with bizsmtp id iB5F1z00R3XaVaC06B5FBD; Thu, 28 Feb 2019 12:05:15 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1gzJV5-0007Tm-2D; Thu, 28 Feb 2019 12:05:15 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1gzJV5-0000UP-0R; Thu, 28 Feb 2019 12:05:15 +0100 From: Geert Uytterhoeven To: Mark Brown Cc: Yoshihiro Shimoda , Wolfram Sang , linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] spi: sh-msiof: Restrict bits per word to 8/16/24/32 on R-Car Gen2/3 Date: Thu, 28 Feb 2019 12:05:13 +0100 Message-Id: <20190228110513.1833-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 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 While the MSIOF variants in older SuperH and SH/R-Mobile SoCs support bits-per-word values in the full range 8..32, the variants present in R-Car Gen2 and Gen3 SoCs are restricted to 8, 16, 24, or 32. Obtain the value from family-specific sh_msiof_chipdata to fix this. Reported-by: Yoshihiro Shimoda Signed-off-by: Geert Uytterhoeven Reviewed-by: Simon Horman --- Tested on SH-Mobile AG5 with 12 bits per word. drivers/spi/spi-sh-msiof.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 6e83368874839d09..48535e95102c9b08 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -32,6 +32,7 @@ #include struct sh_msiof_chipdata { + u32 bits_per_word_mask; u16 tx_fifo_size; u16 rx_fifo_size; u16 ctlr_flags; @@ -1072,6 +1073,7 @@ static int sh_msiof_transfer_one(struct spi_controller *ctlr, } static const struct sh_msiof_chipdata sh_data = { + .bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32), .tx_fifo_size = 64, .rx_fifo_size = 64, .ctlr_flags = 0, @@ -1079,6 +1081,8 @@ static const struct sh_msiof_chipdata sh_data = { }; static const struct sh_msiof_chipdata rcar_gen2_data = { + .bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) | + SPI_BPW_MASK(24) | SPI_BPW_MASK(32), .tx_fifo_size = 64, .rx_fifo_size = 64, .ctlr_flags = SPI_CONTROLLER_MUST_TX, @@ -1086,6 +1090,8 @@ static const struct sh_msiof_chipdata rcar_gen2_data = { }; static const struct sh_msiof_chipdata rcar_gen3_data = { + .bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) | + SPI_BPW_MASK(24) | SPI_BPW_MASK(32), .tx_fifo_size = 64, .rx_fifo_size = 64, .ctlr_flags = SPI_CONTROLLER_MUST_TX, @@ -1410,7 +1416,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) ctlr->setup = sh_msiof_spi_setup; ctlr->prepare_message = sh_msiof_prepare_message; ctlr->slave_abort = sh_msiof_slave_abort; - ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32); + ctlr->bits_per_word_mask = chipdata->bits_per_word_mask; ctlr->auto_runtime_pm = true; ctlr->transfer_one = sh_msiof_transfer_one;