From owner-freebsd-embedded@freebsd.org Fri May 27 02:00:49 2016 Return-Path: Delivered-To: freebsd-embedded@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90CA7B4AE0B for ; Fri, 27 May 2016 02:00:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E82617DC for ; Fri, 27 May 2016 02:00:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x234.google.com with SMTP id l63so64902477ita.1 for ; Thu, 26 May 2016 19:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to; bh=P7Q+BSsQbIHyiuFBNDXlM/Z/V4Rn+mrkW9TZyyOpOo0=; b=SijqJHq5BRzteB9WmeGERlQqCniMKYW+drKJzVZ39rbwJhHftOyV66Q58tyes9Fe3B sHWmajCRJBk03VK8ZnG0PktrJ6424hUqB1xbwOeiPvDAsEtJgnwO6TZl5lw2eGyKuzwv hCubHovpWgAhtXhg8dtpBgqDUX2+PoDB87odtX4b8//P5FkRyCP/LrjI+ByRs8OmUnjd 1bEzui/rPbKoGhLz9ZeLJgFWYQ6ybDdiry0nPC/Ytuc7BRfe0v9RdxLNZrxY1p6QDO/U ew/LSA7aYSsC3ROqTL8QzJD/Oa1PqBjniPPRSBMNrtOnARvuRqpR8DnkLaG1pBjLQF78 dPbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:date:message-id:subject:from :to; bh=P7Q+BSsQbIHyiuFBNDXlM/Z/V4Rn+mrkW9TZyyOpOo0=; b=lruJZQGWm0i5+uLwFKGFZomsg4OsdY3P3mxME3ILXFscWtlO3KPyHTfgUPD/ycqykt u0TJM5bu8kvOInz/MaMWRGu7secobaII2Uf8UbY9Y/fkCMVmTsJmHtQ76cAwAW7L0sYF mOqHiERNycK0EimLVNHe7hTBUnXPYVAPoMhLIxGLJZafGWboYTxZPxeRyHEAnXBq9sxW XUPfb1tx7H4k4vEAGBiE+WiUmXWrNN0/YQZ4B/aUeJjQQaT20B5voctRGjQ+ogBr+Hvq SWvgLEgMeOmKbb0I1rVKiq+lRLJTyUPwPs0IZvU/ygCej0lA2i/bWhiOOPXN/MZN1Z+w 5tIA== X-Gm-Message-State: ALyK8tI8oy7P9FkN5mwCc4D63c8FgGpr78n0EQnXCdpsZlUgV7bLjFPDVzEdHnEkJLkY1o1lOs4S/aa7DTLy0A== MIME-Version: 1.0 X-Received: by 10.36.73.146 with SMTP id e18mr5556126itd.80.1464314448592; Thu, 26 May 2016 19:00:48 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.113.3 with HTTP; Thu, 26 May 2016 19:00:48 -0700 (PDT) Date: Thu, 26 May 2016 19:00:48 -0700 X-Google-Sender-Auth: UttxX-4BM-rTd8rC22t_g4OTvEI Message-ID: Subject: spibus: migrate to bus acquire/release semantics From: Adrian Chadd To: "freebsd-embedded@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 02:00:49 -0000 hi, Here's the first part of the work needed to bring mmcspi into the tree. It also fixes concurrent SPI controller accesses for a variety of controllers which currently don't consistently implement it - AR71xx spi doesn't, but brcm2835 spi does. https://reviews.freebsd.org/D6588 I'd appreciate some feedback and testing. Now, this doesn't implement it for all of the controllers, only the simple ones. The broadcom and other arm ones aren't migrated, because CS is asserted in a variety of different ways there. Now, it's not a /huge/ deal, it just means that CS isn't asserted for the entirety of a transaction set. For mmcspi (which I think assumes this is the case), we may have to add a controller ivar that indicates if it supports it or not, so mmcspi and other devices can implement it appropriately. Another good example of this would be an LCD controller. Ideally you'd do this: * acquire SPI bus * assert command line * do SPI transaction, with CS asserted * deassert command line, assert data line * do SPI transaction, with CS asserted * release SPI bus Now, CS doesn't have to be asserted between transactions, but the command/data commands have to happen together like that. Thanks! -adrian