Received: by 10.223.164.202 with SMTP id h10csp688953wrb; Wed, 15 Nov 2017 06:26:04 -0800 (PST) X-Google-Smtp-Source: AGs4zMY6L37NQIEMsGgJqnqVVf1U5CV3B5aElR1aTiBS+pRBiTK9pMPwwMIaGX7ZwG0VRZp3GZq/ X-Received: by 10.84.232.202 with SMTP id x10mr15931689plm.101.1510755964448; Wed, 15 Nov 2017 06:26:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755964; cv=none; d=google.com; s=arc-20160816; b=ObQH0I1DN1jNe+g67M80SCD7DZJt5X6AGOi9Yp0DmeHi4Tff3j8+yluM4Cjmb8J3OP PBL0L5v5OqREj6SBL9J4FMLAmH0phhIyMCoyoB/d3WlL2nk2l/dpPpvrcWly8lUyHT7E LCk6cnh7Y5B6O83+iMg4jKXCLUTaeMzvwo0qMYw1jThtkdLKlzg0zaSlYF3pdjFoeSRR oJNZOQTAvA8DUVn35VXKjmhpLpXKDOHBGuLQ+mxTRPaca4+FjDadbNy6fC9f+1EV6Psr oNEX/JEn0eefAd16nSVeQ9lzjhyl8N60JQWKBT82XMxgj1fr9/NK3/us9G7ZKvDovtg+ l2iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=zcZFQF7FGH0IEOXXsOnSOl9E7GjwrMBi1MFjDN5vcNA=; b=le1sgi90k0uvqG9Lto/kvOe2gD5LSITJZr1HvLjv+GlrZ4hko+7A++2D2tM6NTT1+g 21Ey0cF55ktWYbHiSlUJJ5xXwX+POfTZA7B0XISg+6an8POmES8lagTJFN7FwsVB1ECS NDvMCxMh1bQSArYk2PEUaBEALkyTlh+sjqkpN8+nI2AS2gMJ2O7pdiSaa/cMjQ0v3bUg J2itBiuTzJQtfmeYOol+lGr2bX+RhPJhym9NufxYTJ0pwf7LypK33Ku4P5VFAZId7ngT yJzkAZF2Jjq/xrayD1sIT5qCqRx8vwqlLlcB3zwbpsC3pjvCbYWK/AnQ6B/xjfzP1Cev hFfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=K8DFgXHb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v124si17612542pgv.557.2017.11.15.06.25.51; Wed, 15 Nov 2017 06:26:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=K8DFgXHb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754750AbdKOOYv (ORCPT + 89 others); Wed, 15 Nov 2017 09:24:51 -0500 Received: from mail-bl2nam02on0056.outbound.protection.outlook.com ([104.47.38.56]:49984 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756208AbdKOOYl (ORCPT ); Wed, 15 Nov 2017 09:24:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zcZFQF7FGH0IEOXXsOnSOl9E7GjwrMBi1MFjDN5vcNA=; b=K8DFgXHbwclV27l3MO0eoyPL1U68BbsVk8G4oifSuQaITVm3jzZs/2gU8r6+s3ch3pryb5wdFte6NT2+iyXCrap0Lt22i9xqkfe5X6T8iGApubK0ehGY+Ugarx36q7s6bdM21HJgjdeeX+fzEKvW0p56W4Ci0TM1ydejMjjMz4M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jan.Glauber@cavium.com; Received: from hc (88.67.135.65) by CY1PR07MB2585.namprd07.prod.outlook.com (10.167.16.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Wed, 15 Nov 2017 14:24:36 +0000 Date: Wed, 15 Nov 2017 15:24:25 +0100 From: Jan Glauber To: Marc Kleine-Budde Cc: Mark Brown , Tim Harvey , linux-spi@vger.kernel.org, "linux-kernel@vger.kernel.org" , Wolfgang Grandegger , linux-can , David Daney Subject: Re: MCP251x SPI CAN controller on Cavium ThunderX Message-ID: <20171115142425.GB6331@hc> References: <20171114120207.xbee2cgsai4qka46@sirena.org.uk> <20171115120754.GC3011@hc> <36b04940-83a6-93a7-f7e1-d0acc8c135d9@pengutronix.de> <1feffea6-00de-6e73-309a-bd9619c19666@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1feffea6-00de-6e73-309a-bd9619c19666@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [88.67.135.65] X-ClientProxiedBy: VI1P189CA0029.EURP189.PROD.OUTLOOK.COM (10.165.188.42) To CY1PR07MB2585.namprd07.prod.outlook.com (10.167.16.135) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0cd6ef1-8c86-47f8-1a7b-08d52c349ab0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258);SRVR:CY1PR07MB2585; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2585;3:RlSoSto7EOrw2Y2JzBvJ7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Hh+v3vGLUFuRGhRB5MtGRa3kZ1Gy8Hq/ITp6jH3LpL8kPylyDEz8chk7G7FWfq6gYosfu7LNjbAW3V9MceGYzs8pLZM8Sg71ZJ7CJVN5YiPSvxsNhlqKd9jsMoIH1+sfYK9Fe53Ctu1kj4RFRnu9UryV538daukfkXbMavvOxiZvsoSoaUhdGA+jpe+2lee5oLzlzyjq5hK6voRIPJFQn9FjGnwmVEEuxndKn5aK1U/6AugsCNSMHewhUVs/NAZ1nMrd8+vSDWAepXlyri/GVlIahnBM8YpE3icn+Vcc1jkqAm7RlryCxN8tTG30Qfpf3Uno0vlhoRr6CS6PmEKJcbt48Qbhg+4CCZhBJCmT8hsJZcacaMx1N5oEEAfUiSFKRVA/kgZ0w2GXnQsny7GCRVrOwo/0vxvpqgvMNqLXQg16dgel7dJrMh/zDxE=;4:C9LVvMYfre6M1HBmARf+9BfA2wkYUf+DI8djBwI9oCCi4AOjZ9C/I5aFZTTcg6P8rHIVDz37Uq1eWZUgmscLe4LrmmZ+yNDH3dJCgGW9fT0h29q3zmgTdqvm9m1jVX9+6zU5D5WsA8wvYrM/5TpB1eILnYjUivKOxmRAyWswWsZCQhCpTBH3dE1pN84F7aSpF5XpdAtBki9vizv9CECXrI7I+i0xvdh2CQ31myizfK/xm8wjrqgyfB48Y93HvLaoT7WviEL3XE5BAICPxbC7IQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3231022)(100000703101)(100105400095)(93006095)(10201501046)(3002001)(6041248)(20161123560025)(20161123564025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR07MB2585;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR07MB2585; X-Forefront-PRVS: 0492FD61DD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(376002)(346002)(199003)(189002)(24454002)(101416001)(47776003)(305945005)(16526018)(189998001)(55016002)(9686003)(25786009)(7736002)(83506002)(107886003)(97736004)(72206003)(53936002)(33656002)(6246003)(4326008)(478600001)(50986999)(229853002)(54356999)(76176999)(2906002)(6496005)(54906003)(93886005)(66066001)(106356001)(8936002)(58126008)(6916009)(16586007)(50466002)(3846002)(23726003)(6116002)(1076002)(316002)(5660300001)(81166006)(33716001)(81156014)(8676002)(105586002)(2950100002)(68736007)(53546010)(6666003)(42882006)(18370500001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2585;H:hc;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2585;23:WcghzfcpKkbQj1zQ31UuSlTyugFTs6SsPkS9P3oat?= =?us-ascii?Q?q2kqnsQT3FKdE+LW19mO8gCqVZNEUs3+64q7H81k4R1p7c1uBpP0/67tGTn3?= =?us-ascii?Q?eBegvLRwBhqtHz8a7rdq0CmSoytHSDaQnpQF3qq2EHgWmKXCGssS/jdEGCk4?= =?us-ascii?Q?gfRdE0tpFOgzJOuRAzYZlWcLYun4/rgTeZxlvSlk5Px17RKPkcTsPinBnb+H?= =?us-ascii?Q?apog0M/dsLY1zOB5D11a88HYcAMNBUbEBuqxJd9k8fKEhqo3Ir3VFtNE5tmn?= =?us-ascii?Q?oiMeKbiDiE/JQv+T7MHRuzoJkiYLypG7RgXj/wsIGLpdjcG8o0gAgVJ1aRfz?= =?us-ascii?Q?4EfXFuyQyIwhJJvTSlOEJKrWuTvjx16ZxDWOQcPfyjmOFHbVg+kurx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rg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2017 14:24:36.7322 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0cd6ef1-8c86-47f8-1a7b-08d52c349ab0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2585 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 15, 2017 at 02:31:45PM +0100, Marc Kleine-Budde wrote: > On 11/15/2017 01:40 PM, Marc Kleine-Budde wrote: > > mcp251x_spi_trans() is called with len=3, > > priv->spi_tx_buf and priv->spi_rx_buf point to previously allocared memory > > > > priv->spi_tx_buf has been filled before calling mcp251x_spi_trans(). > > > #define OCTEON_SPI_MAX_BYTES 9 > > > static int octeon_spi_do_transfer(struct octeon_spi *p, > > struct spi_message *msg, > > struct spi_transfer *xfer, > > bool last_xfer) > > { > > struct spi_device *spi = msg->spi; > > union cvmx_mpi_cfg mpi_cfg; > > union cvmx_mpi_tx mpi_tx; > > unsigned int clkdiv; > > int mode; > > bool cpha, cpol; > > const u8 *tx_buf; > > u8 *rx_buf; > > int len; > > int i; > > > > mode = spi->mode; > > cpha = mode & SPI_CPHA; > > cpol = mode & SPI_CPOL; > > > > clkdiv = p->sys_freq / (2 * xfer->speed_hz); > > > > mpi_cfg.u64 = 0; > > > > mpi_cfg.s.clkdiv = clkdiv; > > mpi_cfg.s.cshi = (mode & SPI_CS_HIGH) ? 1 : 0; > > mpi_cfg.s.lsbfirst = (mode & SPI_LSB_FIRST) ? 1 : 0; > > mpi_cfg.s.wireor = (mode & SPI_3WIRE) ? 1 : 0; > > mpi_cfg.s.idlelo = cpha != cpol; > > mpi_cfg.s.cslate = cpha ? 1 : 0; > > mpi_cfg.s.enable = 1; > > > > if (spi->chip_select < 4) > > p->cs_enax |= 1ull << (12 + spi->chip_select); > > mpi_cfg.u64 |= p->cs_enax; > > > > if (mpi_cfg.u64 != p->last_cfg) { > > p->last_cfg = mpi_cfg.u64; > > writeq(mpi_cfg.u64, p->register_base + OCTEON_SPI_CFG(p)); > > } > > tx_buf = xfer->tx_buf; > > rx_buf = xfer->rx_buf; > > len = xfer->len; > > while (len > OCTEON_SPI_MAX_BYTES) { > > for (i = 0; i < OCTEON_SPI_MAX_BYTES; i++) { > > u8 d; > > if (tx_buf) > > d = *tx_buf++; > > else > > d = 0; > > writeq(d, p->register_base + OCTEON_SPI_DAT0(p) + (8 * i)); > > } > > mpi_tx.u64 = 0; > > mpi_tx.s.csid = spi->chip_select; > > mpi_tx.s.leavecs = 1; > > mpi_tx.s.txnum = tx_buf ? OCTEON_SPI_MAX_BYTES : 0; > > This looks fishy, OCTEON_SPI_MAX_BYTES is 9.... Because there are 9 registers in MPI_DAT(0..8). > > mpi_tx.s.totnum = OCTEON_SPI_MAX_BYTES; > > writeq(mpi_tx.u64, p->register_base + OCTEON_SPI_TX(p)); > > > > octeon_spi_wait_ready(p); > > if (rx_buf) > > for (i = 0; i < OCTEON_SPI_MAX_BYTES; i++) { > > u64 v = readq(p->register_base + OCTEON_SPI_DAT0(p) + (8 * i)); > > *rx_buf++ = (u8)v; > > } > > len -= OCTEON_SPI_MAX_BYTES; > > } > > > > for (i = 0; i < len; i++) { > > u8 d; > > if (tx_buf) > > d = *tx_buf++; > > else > > d = 0; > > writeq(d, p->register_base + OCTEON_SPI_DAT0(p) + (8 * i)); > > } > > > > mpi_tx.u64 = 0; > > mpi_tx.s.csid = spi->chip_select; > > if (last_xfer) > > mpi_tx.s.leavecs = xfer->cs_change; > > else > > mpi_tx.s.leavecs = !xfer->cs_change; > > mpi_tx.s.txnum = tx_buf ? len : 0; > > mpi_tx.s.totnum = len; > > writeq(mpi_tx.u64, p->register_base + OCTEON_SPI_TX(p)); > > > > octeon_spi_wait_ready(p); > > if (rx_buf) > > for (i = 0; i < len; i++) { > > u64 v = readq(p->register_base + OCTEON_SPI_DAT0(p) + (8 * i)); > > *rx_buf++ = (u8)v; > > } > > Personally I'd fold this into the while loop, as there's quite some code > duplication. Of course your have to improve the "if (last_xfer)" a bit. I've not written that code, just split it for shared arm64 & mips usage and avoided re-writing it completely on purpose :) If it turns out that we need to change this code I might consider making changes like this. Adding David who might know more about this driver. --Jan From 1584141063519266029@xxx Wed Nov 15 14:04:05 +0000 2017 X-GM-THRID: 1583987213767022680 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread