Received: by 10.223.164.202 with SMTP id h10csp48560wrb; Mon, 13 Nov 2017 13:18:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMb+cxZVAYYShQc7MoM4cRZC7NG7iB4h/+N94A8drzgfLI5G8lKhuc2Qlrj7AM0QJ2l4AUm7 X-Received: by 10.159.247.136 with SMTP id e8mr8389342pls.335.1510607923334; Mon, 13 Nov 2017 13:18:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510607923; cv=none; d=google.com; s=arc-20160816; b=PIDzrAuTIAXB1GrsurJV3ntv6kW9pBbf8lnHrZ/x9Vgw9cJebVrwwY6j0j4imzSVBc 7qlqI86zCavkhf7MMTVznOyAy30p88Pktd8RtMnqZSI7dSA6QoZzUi2g/cCda4CEilC3 uVPB6qSGoz/Q2i0w97Q1nXNVaIjNfN0A3WXSL9pj/69eQgq9dFJelMNs7eV4g0gJu1D9 pLNRPDAp9CS8XJKTdxJcU5zXYR5F7ttbsfTaWoAJGqjmyQApOqIMofA0vfZoQW9ZJsme i+g9Cj/E0y5xrAU0BHfCTtfgfcf41TiQ7pMF1Ak5aljbz810kEnqpXsR+JmXSh+Cmo2P j9dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature:arc-authentication-results; bh=p3PNERbZ+AjpozfYuOpNOZQS9Vc184gXZsh1Xuvlh9Q=; b=RA7cGj+Osuna6lHAUpBSTd21RH/julNWeFFmVxSw7ZhlGOfjZa979w5Nof+jsH+WRr EGJxjf4vKZbR6HCQitypETjL0I0gMKtvLP08B860pKyn8XPkKpE8ILvCFbtpG10uTzMI g6J4NiD7AuVIg9F2NVKfnWZNJXwOUERUGedWynsk54eSboCd9M0HF9f7owOiuXdmYWdx viIYOhoGGnSUnnl6qo4tTP0IKaqzEO3zk9swVNgu8Dpemsp+k17p3KmxCkuqspZK3Fon Bkt+OP9DB0EAvnKAmy4Uvs2N9SNJLXqKK74kt1cznxtaePr9Nd8XCmrs5jnAatJO0XZR Jnlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=gU+wyI0I; 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 x1si12860793pfj.295.2017.11.13.13.18.30; Mon, 13 Nov 2017 13:18:43 -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=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=gU+wyI0I; 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 S1755852AbdKMVRw (ORCPT + 87 others); Mon, 13 Nov 2017 16:17:52 -0500 Received: from mail-wr0-f176.google.com ([209.85.128.176]:45818 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755810AbdKMVRo (ORCPT ); Mon, 13 Nov 2017 16:17:44 -0500 Received: by mail-wr0-f176.google.com with SMTP id y9so15700097wrb.2 for ; Mon, 13 Nov 2017 13:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc; bh=p3PNERbZ+AjpozfYuOpNOZQS9Vc184gXZsh1Xuvlh9Q=; b=gU+wyI0IdIxrlDOprGn3ad56HskIY0MXHzEjX+lCQ5r7BrW7leOrRnpaGIJRaCA/jv DxHkwG88E0jiMl49kiBnPTw2AAY68L5AgTkk47T6+h1Vq9bIyhVcJvLzTBtfUYjUlCZJ c4+jJQhNUxI1FZRZKVdxWEFlTVg5QxxXavMmOkq5j9cEenoDl8aNWCii3EbbiyzWQ05Q Mb+TnQhQ1jbMlAR6jTQ6vej2Eksrb6ncxCcLn0GUbWVH9VHvqIobi5giB+CXtsUOZHTe aipPB+Q/E4jApEgreWvr3qFyXmgo/ZU27e/42LBY+WLc4FYue0WIWRkoX46apKzkOY+y j3WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=p3PNERbZ+AjpozfYuOpNOZQS9Vc184gXZsh1Xuvlh9Q=; b=ZjaPPi8rkASUB9Og0hCFUu+jIYOjiG7W8ONEeoCJXJEl9z+2y90iQiUdzU/KayWCMu b1jV9ZEfcrr4qA+r4hESDhVyPQgXfW0hKTxI5TyGYJOE9KqcaVKosxJoKfHEYwKKnzjW 53mEaK3wdg17PJpGkVzo7wiNTPBeAeiRvWqaR5U6r1A7EstU0vQ9f62VYEA4BDKTqWKU EaK/bQm+gXs0mHg2Ob3AhcrN0sUvplqWk+/nCTYg9zjbwb9SN9dN6mjY1u1WgsONQp7L Efa05JsLMAgCfMlMkrcjSbGc4QOFgqtUy4C8bUaK01YVpGlxi/fSJkOi4IuXjmOnDZDw NMXA== X-Gm-Message-State: AJaThX6BvDl4YsSbijIIHIwwOKZPaWBe6td9sjjDulwIfmT4zBHT4CYV Aehmj1xMlU7G8CJkwLPBpkoPf2Ll0GrlV8HJ0J+KwQ== X-Received: by 10.223.134.157 with SMTP id 29mr7790916wrx.72.1510607862760; Mon, 13 Nov 2017 13:17:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.209.197 with HTTP; Mon, 13 Nov 2017 13:17:42 -0800 (PST) From: Tim Harvey Date: Mon, 13 Nov 2017 13:17:42 -0800 Message-ID: Subject: MCP251x SPI CAN controller on Cavium ThunderX To: Mark Brown , Jan Glauber , linux-spi@vger.kernel.org Cc: "linux-kernel@vger.kernel.org" , Wolfgang Grandegger , Marc Kleine-Budde Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mark/Jan, I have been unsuccessful getting a MCP251x SPI based CAN controller working on a CN80xx using Linux mainline. When a register is read from the mcp251x driver the octeon_spi_do_transfer() gets a spi_message with a single spi_xfer of len=3, a tx_buf, and an rx_buf which I believe is supposed to shift out 3 bytes out MOSI and shift in 3 bytes from MISO where the last byte shifted in would be the response. The cavium CN80xx MPI_TX register has fields for 'Number of bytes to transmit' (TXNUM) and 'Total number of bytes to shift (transmit and receive)' (TOTNUM) and these are both getting set to 3 by octeon_spi_do_transfer() but I find that this causes unexpected data in the shifted in response unless I make TOTNUM = TXNUM + 1. I should also note that Cavium has a software suite called the 'BDK' which provides a CLI to SPI transfers which allows you to set the TXNUM and TOTNUM fields uniquely and if I send a 2-byte command (TXNUM=2) to read a register (READ command followed by the register) and a 1 byte read (thus TOTNUM=3) then I get the response from the mcp251x I expect. Is there something I'm misunderstanding about the Linux SPI API and perhaps is there a bug in the cavium SPI controller driver or do I perhaps have it configured wrong with respect to CPHA and/or CPOL? Thanks, Tim From 1584377676803359925@xxx Sat Nov 18 04:44:57 +0000 2017 X-GM-THRID: 1584377676803359925 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread