Message ID | 20230106200809.330769-7-william.zhang@broadcom.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1011054wrt; Fri, 6 Jan 2023 12:24:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXuGX5GVAAv+ocnEk7VnXJE5tOOtMwvL9lGnktGb1ku/GKZrojyyVNIZogPHu/IXlLcPrH0D X-Received: by 2002:a05:6402:26d5:b0:495:d3fb:a244 with SMTP id x21-20020a05640226d500b00495d3fba244mr5319537edd.3.1673036698755; Fri, 06 Jan 2023 12:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673036698; cv=none; d=google.com; s=arc-20160816; b=SDXVam96Yy9uBWmYD0h3ntpZX853I6G5kJ+NfgVDhNEyJiinmuuNnIGgc+L3rCyv+I uti/mMvytuvmj1N3ug3TUpRnIhY+/6sUU2/un3Y0Fh6mwtABM2qM4cFqlcIV/qOTeFTy I6S0yZ7f4uEXMKbUUsH1BDmAlpT6pHD1NFLNIIr636ljr/tuElYgkfMvxY4JMZibBltF x9wPOGiC74JXzN6K55LMPQ2w7sFpBc9Pg5ZdW4QTUW/A4TqpqSWAH8oZjM/+2aEZbPJW itWlRyGPAY4VSzXyQ3GWzsHfIe19LgHZs1U+YCuzuvNdf9PBKCmOg54AE9wxVicpdGzK JdVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=rO1bnHmghKKN88ytEnN24PPw9mEgSbgPWcKyj3A1PDI=; b=O4nH82Y5lWn/SxYco+4Kz51D3y+jfxemrGlsdokpDnGWXLQ3zDG7I2BzTeYIA3oNNJ G19nF4Nw3NY+mwtfVe2fW8/llmoquoSCqh0c2GufmKGWYMCCnjsfopnEAMiFXwrgjpxm D293ULzjZGeDcImeRru48se0b+lekAxaSuxbJflHF2tUsojP8NjhtFZdrKvksRNXWHEt +rWubb2V8OLo4OVYCoZ2E2QOgmBnjjOEfTTPTYH5KaElSO7L1NHq8JvPkENqIrEno7Vc gp8w0AAd3Nq420wrG2B5E7/mVCloGXHUxAYNdZk3oDRFpdBnMJCbPZlI1ioy+G7XHFG3 Soew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=ZjnHv1LE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a17-20020aa7d751000000b0047ed405b4a7si2282722eds.224.2023.01.06.12.24.34; Fri, 06 Jan 2023 12:24:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=ZjnHv1LE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229817AbjAFUVZ (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Fri, 6 Jan 2023 15:21:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235773AbjAFUUz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Jan 2023 15:20:55 -0500 Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.166.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9345684620; Fri, 6 Jan 2023 12:19:53 -0800 (PST) Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.75.146.107]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id D5160C0000E2; Fri, 6 Jan 2023 12:09:54 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com D5160C0000E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1673035794; bh=SvLodN4cQ6TEbn+PEQP+YZBLKZOuvyU97FI3sOksrF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZjnHv1LEV8rVFlAGo9JwQxczlOuvzW/ybD7ZQ4by8uCkQham3Dj2vxv8adXm/aLVF ENZVCXrYP9pkTLNTxH3GlqKsir4ma60M+VBn4CWpSe4Bm6nuQk7qSU1NU8I0sqscoS giOhM1c7Ok/bFO4wn5ohRe6WVDhV0HAbdSrurcl8= Received: from bcacpedev-irv-3.lvn.broadcom.net (bcacpedev-irv-3.lvn.broadcom.net [10.75.138.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPS id D32F618041CAC6; Fri, 6 Jan 2023 12:09:54 -0800 (PST) Received: by bcacpedev-irv-3.lvn.broadcom.net (Postfix, from userid 28376) id 2C07C101B33; Fri, 6 Jan 2023 12:09:48 -0800 (PST) From: William Zhang <william.zhang@broadcom.com> To: Linux SPI List <linux-spi@vger.kernel.org>, Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com> Cc: anand.gore@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, joel.peshkin@broadcom.com, f.fainelli@gmail.com, jonas.gorski@gmail.com, kursad.oney@broadcom.com, dregan@mail.com, William Zhang <william.zhang@broadcom.com>, Mark Brown <broonie@kernel.org>, linux-kernel@vger.kernel.org Subject: [PATCH 06/16] spi: bcm63xx-hsspi: Endianness fix for ARM based SoC Date: Fri, 6 Jan 2023 12:07:58 -0800 Message-Id: <20230106200809.330769-7-william.zhang@broadcom.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230106200809.330769-1-william.zhang@broadcom.com> References: <20230106200809.330769-1-william.zhang@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754306129635774304?= X-GMAIL-MSGID: =?utf-8?q?1754306129635774304?= |
Series |
spi: bcm63xx-hsspi: driver and doc updates
|
|
Commit Message
William Zhang
Jan. 6, 2023, 8:07 p.m. UTC
HSSPI controller uses big endian for the opcode in the message to the controller ping pong buffer. Use cpu_to_be16 to properly handle the endianness for both big and little endian host. Fixes: 142168eba9dc ("spi: bcm63xx-hsspi: add bcm63xx HSSPI driver") Signed-off-by: Kursad Oney <kursad.oney@broadcom.com> Signed-off-by: William Zhang <william.zhang@broadcom.com> --- drivers/spi/spi-bcm63xx-hsspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi William, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on broonie-spi/for-next krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.2-rc2 next-20230106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next patch link: https://lore.kernel.org/r/20230106200809.330769-7-william.zhang%40broadcom.com patch subject: [PATCH 06/16] spi: bcm63xx-hsspi: Endianness fix for ARM based SoC config: alpha-randconfig-s052-20230106 compiler: alpha-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/8a82a44b50d88a27e55065e9f1bd75f0fccf479a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 git checkout 8a82a44b50d88a27e55065e9f1bd75f0fccf479a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/spi/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] b @@ got restricted __be16 [usertype] @@ drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: expected unsigned short [usertype] b drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: got restricted __be16 [usertype] vim +197 drivers/spi/spi-bcm63xx-hsspi.c 156 157 static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) 158 { 159 struct bcm63xx_hsspi *bs = spi_master_get_devdata(spi->master); 160 unsigned int chip_select = spi->chip_select; 161 u16 opcode = 0; 162 int pending = t->len; 163 int step_size = HSSPI_BUFFER_LEN; 164 const u8 *tx = t->tx_buf; 165 u8 *rx = t->rx_buf; 166 167 bcm63xx_hsspi_set_clk(bs, spi, t->speed_hz); 168 bcm63xx_hsspi_set_cs(bs, spi->chip_select, true); 169 170 if (tx && rx) 171 opcode = HSSPI_OP_READ_WRITE; 172 else if (tx) 173 opcode = HSSPI_OP_WRITE; 174 else if (rx) 175 opcode = HSSPI_OP_READ; 176 177 if (opcode != HSSPI_OP_READ) 178 step_size -= HSSPI_OPCODE_LEN; 179 180 if ((opcode == HSSPI_OP_READ && t->rx_nbits == SPI_NBITS_DUAL) || 181 (opcode == HSSPI_OP_WRITE && t->tx_nbits == SPI_NBITS_DUAL)) 182 opcode |= HSSPI_OP_MULTIBIT; 183 184 __raw_writel(1 << MODE_CTRL_MULTIDATA_WR_SIZE_SHIFT | 185 1 << MODE_CTRL_MULTIDATA_RD_SIZE_SHIFT | 0xff, 186 bs->regs + HSSPI_PROFILE_MODE_CTRL_REG(chip_select)); 187 188 while (pending > 0) { 189 int curr_step = min_t(int, step_size, pending); 190 191 reinit_completion(&bs->done); 192 if (tx) { 193 memcpy_toio(bs->fifo + HSSPI_OPCODE_LEN, tx, curr_step); 194 tx += curr_step; 195 } 196 > 197 __raw_writew(cpu_to_be16(opcode | curr_step), bs->fifo); 198 199 /* enable interrupt */ 200 __raw_writel(HSSPI_PINGx_CMD_DONE(0), 201 bs->regs + HSSPI_INT_MASK_REG); 202 203 /* start the transfer */ 204 __raw_writel(!chip_select << PINGPONG_CMD_SS_SHIFT | 205 chip_select << PINGPONG_CMD_PROFILE_SHIFT | 206 PINGPONG_COMMAND_START_NOW, 207 bs->regs + HSSPI_PINGPONG_COMMAND_REG(0)); 208 209 if (wait_for_completion_timeout(&bs->done, HZ) == 0) { 210 dev_err(&bs->pdev->dev, "transfer timed out!\n"); 211 return -ETIMEDOUT; 212 } 213 214 if (rx) { 215 memcpy_fromio(rx, bs->fifo, curr_step); 216 rx += curr_step; 217 } 218 219 pending -= curr_step; 220 } 221 222 return 0; 223 } 224
Hi William, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on broonie-spi/for-next krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.2-rc2 next-20230106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next patch link: https://lore.kernel.org/r/20230106200809.330769-7-william.zhang%40broadcom.com patch subject: [PATCH 06/16] spi: bcm63xx-hsspi: Endianness fix for ARM based SoC config: microblaze-randconfig-s041-20230108 compiler: microblaze-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/8a82a44b50d88a27e55065e9f1bd75f0fccf479a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 git checkout 8a82a44b50d88a27e55065e9f1bd75f0fccf479a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=microblaze olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/spi/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] value @@ got restricted __be16 [usertype] @@ drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: expected unsigned short [usertype] value drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: got restricted __be16 [usertype] vim +197 drivers/spi/spi-bcm63xx-hsspi.c 156 157 static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) 158 { 159 struct bcm63xx_hsspi *bs = spi_master_get_devdata(spi->master); 160 unsigned int chip_select = spi->chip_select; 161 u16 opcode = 0; 162 int pending = t->len; 163 int step_size = HSSPI_BUFFER_LEN; 164 const u8 *tx = t->tx_buf; 165 u8 *rx = t->rx_buf; 166 167 bcm63xx_hsspi_set_clk(bs, spi, t->speed_hz); 168 bcm63xx_hsspi_set_cs(bs, spi->chip_select, true); 169 170 if (tx && rx) 171 opcode = HSSPI_OP_READ_WRITE; 172 else if (tx) 173 opcode = HSSPI_OP_WRITE; 174 else if (rx) 175 opcode = HSSPI_OP_READ; 176 177 if (opcode != HSSPI_OP_READ) 178 step_size -= HSSPI_OPCODE_LEN; 179 180 if ((opcode == HSSPI_OP_READ && t->rx_nbits == SPI_NBITS_DUAL) || 181 (opcode == HSSPI_OP_WRITE && t->tx_nbits == SPI_NBITS_DUAL)) 182 opcode |= HSSPI_OP_MULTIBIT; 183 184 __raw_writel(1 << MODE_CTRL_MULTIDATA_WR_SIZE_SHIFT | 185 1 << MODE_CTRL_MULTIDATA_RD_SIZE_SHIFT | 0xff, 186 bs->regs + HSSPI_PROFILE_MODE_CTRL_REG(chip_select)); 187 188 while (pending > 0) { 189 int curr_step = min_t(int, step_size, pending); 190 191 reinit_completion(&bs->done); 192 if (tx) { 193 memcpy_toio(bs->fifo + HSSPI_OPCODE_LEN, tx, curr_step); 194 tx += curr_step; 195 } 196 > 197 __raw_writew(cpu_to_be16(opcode | curr_step), bs->fifo); 198 199 /* enable interrupt */ 200 __raw_writel(HSSPI_PINGx_CMD_DONE(0), 201 bs->regs + HSSPI_INT_MASK_REG); 202 203 /* start the transfer */ 204 __raw_writel(!chip_select << PINGPONG_CMD_SS_SHIFT | 205 chip_select << PINGPONG_CMD_PROFILE_SHIFT | 206 PINGPONG_COMMAND_START_NOW, 207 bs->regs + HSSPI_PINGPONG_COMMAND_REG(0)); 208 209 if (wait_for_completion_timeout(&bs->done, HZ) == 0) { 210 dev_err(&bs->pdev->dev, "transfer timed out!\n"); 211 return -ETIMEDOUT; 212 } 213 214 if (rx) { 215 memcpy_fromio(rx, bs->fifo, curr_step); 216 rx += curr_step; 217 } 218 219 pending -= curr_step; 220 } 221 222 return 0; 223 } 224
Hi William, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on broonie-spi/for-next krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.2-rc2 next-20230106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next patch link: https://lore.kernel.org/r/20230106200809.330769-7-william.zhang%40broadcom.com patch subject: [PATCH 06/16] spi: bcm63xx-hsspi: Endianness fix for ARM based SoC config: sh-randconfig-s031-20230108 compiler: sh4-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/8a82a44b50d88a27e55065e9f1bd75f0fccf479a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 git checkout 8a82a44b50d88a27e55065e9f1bd75f0fccf479a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sh olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sh SHELL=/bin/bash drivers/spi/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> drivers/spi/spi-bcm63xx-hsspi.c:197:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __be16 [usertype] @@ drivers/spi/spi-bcm63xx-hsspi.c:197:17: sparse: expected unsigned short volatile [usertype] drivers/spi/spi-bcm63xx-hsspi.c:197:17: sparse: got restricted __be16 [usertype] vim +197 drivers/spi/spi-bcm63xx-hsspi.c 156 157 static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) 158 { 159 struct bcm63xx_hsspi *bs = spi_master_get_devdata(spi->master); 160 unsigned int chip_select = spi->chip_select; 161 u16 opcode = 0; 162 int pending = t->len; 163 int step_size = HSSPI_BUFFER_LEN; 164 const u8 *tx = t->tx_buf; 165 u8 *rx = t->rx_buf; 166 167 bcm63xx_hsspi_set_clk(bs, spi, t->speed_hz); 168 bcm63xx_hsspi_set_cs(bs, spi->chip_select, true); 169 170 if (tx && rx) 171 opcode = HSSPI_OP_READ_WRITE; 172 else if (tx) 173 opcode = HSSPI_OP_WRITE; 174 else if (rx) 175 opcode = HSSPI_OP_READ; 176 177 if (opcode != HSSPI_OP_READ) 178 step_size -= HSSPI_OPCODE_LEN; 179 180 if ((opcode == HSSPI_OP_READ && t->rx_nbits == SPI_NBITS_DUAL) || 181 (opcode == HSSPI_OP_WRITE && t->tx_nbits == SPI_NBITS_DUAL)) 182 opcode |= HSSPI_OP_MULTIBIT; 183 184 __raw_writel(1 << MODE_CTRL_MULTIDATA_WR_SIZE_SHIFT | 185 1 << MODE_CTRL_MULTIDATA_RD_SIZE_SHIFT | 0xff, 186 bs->regs + HSSPI_PROFILE_MODE_CTRL_REG(chip_select)); 187 188 while (pending > 0) { 189 int curr_step = min_t(int, step_size, pending); 190 191 reinit_completion(&bs->done); 192 if (tx) { 193 memcpy_toio(bs->fifo + HSSPI_OPCODE_LEN, tx, curr_step); 194 tx += curr_step; 195 } 196 > 197 __raw_writew(cpu_to_be16(opcode | curr_step), bs->fifo); 198 199 /* enable interrupt */ 200 __raw_writel(HSSPI_PINGx_CMD_DONE(0), 201 bs->regs + HSSPI_INT_MASK_REG); 202 203 /* start the transfer */ 204 __raw_writel(!chip_select << PINGPONG_CMD_SS_SHIFT | 205 chip_select << PINGPONG_CMD_PROFILE_SHIFT | 206 PINGPONG_COMMAND_START_NOW, 207 bs->regs + HSSPI_PINGPONG_COMMAND_REG(0)); 208 209 if (wait_for_completion_timeout(&bs->done, HZ) == 0) { 210 dev_err(&bs->pdev->dev, "transfer timed out!\n"); 211 return -ETIMEDOUT; 212 } 213 214 if (rx) { 215 memcpy_fromio(rx, bs->fifo, curr_step); 216 rx += curr_step; 217 } 218 219 pending -= curr_step; 220 } 221 222 return 0; 223 } 224
Hi William, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on broonie-spi/for-next krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.2-rc2 next-20230106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next patch link: https://lore.kernel.org/r/20230106200809.330769-7-william.zhang%40broadcom.com patch subject: [PATCH 06/16] spi: bcm63xx-hsspi: Endianness fix for ARM based SoC config: sparc-randconfig-s051-20230108 compiler: sparc64-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/8a82a44b50d88a27e55065e9f1bd75f0fccf479a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 git checkout 8a82a44b50d88a27e55065e9f1bd75f0fccf479a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc SHELL=/bin/bash drivers/spi/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] w @@ got restricted __be16 [usertype] @@ drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: expected unsigned short [usertype] w drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: got restricted __be16 [usertype] vim +197 drivers/spi/spi-bcm63xx-hsspi.c 156 157 static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) 158 { 159 struct bcm63xx_hsspi *bs = spi_master_get_devdata(spi->master); 160 unsigned int chip_select = spi->chip_select; 161 u16 opcode = 0; 162 int pending = t->len; 163 int step_size = HSSPI_BUFFER_LEN; 164 const u8 *tx = t->tx_buf; 165 u8 *rx = t->rx_buf; 166 167 bcm63xx_hsspi_set_clk(bs, spi, t->speed_hz); 168 bcm63xx_hsspi_set_cs(bs, spi->chip_select, true); 169 170 if (tx && rx) 171 opcode = HSSPI_OP_READ_WRITE; 172 else if (tx) 173 opcode = HSSPI_OP_WRITE; 174 else if (rx) 175 opcode = HSSPI_OP_READ; 176 177 if (opcode != HSSPI_OP_READ) 178 step_size -= HSSPI_OPCODE_LEN; 179 180 if ((opcode == HSSPI_OP_READ && t->rx_nbits == SPI_NBITS_DUAL) || 181 (opcode == HSSPI_OP_WRITE && t->tx_nbits == SPI_NBITS_DUAL)) 182 opcode |= HSSPI_OP_MULTIBIT; 183 184 __raw_writel(1 << MODE_CTRL_MULTIDATA_WR_SIZE_SHIFT | 185 1 << MODE_CTRL_MULTIDATA_RD_SIZE_SHIFT | 0xff, 186 bs->regs + HSSPI_PROFILE_MODE_CTRL_REG(chip_select)); 187 188 while (pending > 0) { 189 int curr_step = min_t(int, step_size, pending); 190 191 reinit_completion(&bs->done); 192 if (tx) { 193 memcpy_toio(bs->fifo + HSSPI_OPCODE_LEN, tx, curr_step); 194 tx += curr_step; 195 } 196 > 197 __raw_writew(cpu_to_be16(opcode | curr_step), bs->fifo); 198 199 /* enable interrupt */ 200 __raw_writel(HSSPI_PINGx_CMD_DONE(0), 201 bs->regs + HSSPI_INT_MASK_REG); 202 203 /* start the transfer */ 204 __raw_writel(!chip_select << PINGPONG_CMD_SS_SHIFT | 205 chip_select << PINGPONG_CMD_PROFILE_SHIFT | 206 PINGPONG_COMMAND_START_NOW, 207 bs->regs + HSSPI_PINGPONG_COMMAND_REG(0)); 208 209 if (wait_for_completion_timeout(&bs->done, HZ) == 0) { 210 dev_err(&bs->pdev->dev, "transfer timed out!\n"); 211 return -ETIMEDOUT; 212 } 213 214 if (rx) { 215 memcpy_fromio(rx, bs->fifo, curr_step); 216 rx += curr_step; 217 } 218 219 pending -= curr_step; 220 } 221 222 return 0; 223 } 224
Hi William, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on broonie-spi/for-next krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.2-rc3 next-20230111] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next patch link: https://lore.kernel.org/r/20230106200809.330769-7-william.zhang%40broadcom.com patch subject: [PATCH 06/16] spi: bcm63xx-hsspi: Endianness fix for ARM based SoC config: arc-randconfig-s032-20230110 compiler: arceb-elf-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/8a82a44b50d88a27e55065e9f1bd75f0fccf479a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review William-Zhang/dt-bindings-spi-Convert-bcm63xx-hsspi-bindings-to-json-schema/20230107-042320 git checkout 8a82a44b50d88a27e55065e9f1bd75f0fccf479a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arc SHELL=/bin/bash drivers/spi/ sound/soc/codecs/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] s @@ got restricted __be16 [usertype] @@ drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: expected unsigned short [usertype] s drivers/spi/spi-bcm63xx-hsspi.c:197:30: sparse: got restricted __be16 [usertype] vim +197 drivers/spi/spi-bcm63xx-hsspi.c 156 157 static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) 158 { 159 struct bcm63xx_hsspi *bs = spi_master_get_devdata(spi->master); 160 unsigned int chip_select = spi->chip_select; 161 u16 opcode = 0; 162 int pending = t->len; 163 int step_size = HSSPI_BUFFER_LEN; 164 const u8 *tx = t->tx_buf; 165 u8 *rx = t->rx_buf; 166 167 bcm63xx_hsspi_set_clk(bs, spi, t->speed_hz); 168 bcm63xx_hsspi_set_cs(bs, spi->chip_select, true); 169 170 if (tx && rx) 171 opcode = HSSPI_OP_READ_WRITE; 172 else if (tx) 173 opcode = HSSPI_OP_WRITE; 174 else if (rx) 175 opcode = HSSPI_OP_READ; 176 177 if (opcode != HSSPI_OP_READ) 178 step_size -= HSSPI_OPCODE_LEN; 179 180 if ((opcode == HSSPI_OP_READ && t->rx_nbits == SPI_NBITS_DUAL) || 181 (opcode == HSSPI_OP_WRITE && t->tx_nbits == SPI_NBITS_DUAL)) 182 opcode |= HSSPI_OP_MULTIBIT; 183 184 __raw_writel(1 << MODE_CTRL_MULTIDATA_WR_SIZE_SHIFT | 185 1 << MODE_CTRL_MULTIDATA_RD_SIZE_SHIFT | 0xff, 186 bs->regs + HSSPI_PROFILE_MODE_CTRL_REG(chip_select)); 187 188 while (pending > 0) { 189 int curr_step = min_t(int, step_size, pending); 190 191 reinit_completion(&bs->done); 192 if (tx) { 193 memcpy_toio(bs->fifo + HSSPI_OPCODE_LEN, tx, curr_step); 194 tx += curr_step; 195 } 196 > 197 __raw_writew(cpu_to_be16(opcode | curr_step), bs->fifo); 198 199 /* enable interrupt */ 200 __raw_writel(HSSPI_PINGx_CMD_DONE(0), 201 bs->regs + HSSPI_INT_MASK_REG); 202 203 /* start the transfer */ 204 __raw_writel(!chip_select << PINGPONG_CMD_SS_SHIFT | 205 chip_select << PINGPONG_CMD_PROFILE_SHIFT | 206 PINGPONG_COMMAND_START_NOW, 207 bs->regs + HSSPI_PINGPONG_COMMAND_REG(0)); 208 209 if (wait_for_completion_timeout(&bs->done, HZ) == 0) { 210 dev_err(&bs->pdev->dev, "transfer timed out!\n"); 211 return -ETIMEDOUT; 212 } 213 214 if (rx) { 215 memcpy_fromio(rx, bs->fifo, curr_step); 216 rx += curr_step; 217 } 218 219 pending -= curr_step; 220 } 221 222 return 0; 223 } 224
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c index b871fd810d80..63682c8ff955 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c @@ -194,7 +194,7 @@ static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) tx += curr_step; } - __raw_writew(opcode | curr_step, bs->fifo); + __raw_writew(cpu_to_be16(opcode | curr_step), bs->fifo); /* enable interrupt */ __raw_writel(HSSPI_PINGx_CMD_DONE(0),