From owner-freebsd-mips@freebsd.org Mon May 20 16:32:20 2019 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E60315B1F1A for ; Mon, 20 May 2019 16:32:20 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EACA862CB; Mon, 20 May 2019 16:32:19 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-yb1-xb2c.google.com with SMTP id k202so5930905ybk.2; Mon, 20 May 2019 09:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2nfonNmmF2FPAcusFCBdhGNk8g7TpHi1DLmeNmyqGnE=; b=ph+Dh3SrfJsyL++p4xKatTZkUMlJ8VBiiSvEw/mQXS6AuJDPA6KFYZUXWyDoi5rTFn KKZg45GdP744RaDjwM1texKQ3NHaAj9rECNh59UchYtk3eFSblrZhAoo+cFG56wClu6C C575aqNrJmLM1HfskhepDSdc9Lbt1y0zSXgj0XPTSa4XQYRkQUu8F43/9abyvsVzdPxV hvKnPnusDPEHQ4UD2+9I28ImJXM7pgrgP0SXMtGXyQ+QbSLdXZISVvKp3YSUI3qc4LMU SwQBQy+/NSPrEx/D1Iw4X7Y8MNnWAJxzd5TRtyfK1c352XDWZSZc6eBfkCZ/5yCmWUWH X4XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2nfonNmmF2FPAcusFCBdhGNk8g7TpHi1DLmeNmyqGnE=; b=qRgpJ0D2lS/6Iv6P7z9+23TW7WKRxkzwOLx1q29EuoEuWvsKr67WWc60f6oA/AzRA8 8yx4KUPh8etkjirAK0djbNXuiKJ0IYbdwfWBjd7npT8+mEzSUjphqkuKmg1+fyboQA1/ +c9+MtmsOMqtdjLddVU7FQ8OaZd491Rf/K3RaV76x/JfwqIcV4ORUUY8Uh4uRSYWHJkZ GcC6uFVxBtmbpCp5rZwVCc/CDakyBkwfHd6jYzgDpwdx3hC/xz6IHSnBRuX7fgr8tNrL s9e3+QNeG7DjR8SCVlxeod1usoIOfs0y8LM+HNDQ3Mur9wooLKP8WrOEk47YoVk5xJwR ZHSg== X-Gm-Message-State: APjAAAX+ib2VuD0tNlQO/HUdUdeeNe6EH+jVnHq878WdP/TM5lgcmdSb KLWmNP2rYvpSBs6XDd+FUZs2jQdVEhVvlCz7CPn9jg== X-Google-Smtp-Source: APXvYqzfU61jJn4YZ8t8qD2PKRNQz+2E1uciMuHnTsDEEiqcl0a7K1n0jKWt27hdMDUqBm4yjHnF4C6lppGRkJXQ6TU= X-Received: by 2002:a25:358b:: with SMTP id c133mr3461623yba.296.1558369938204; Mon, 20 May 2019 09:32:18 -0700 (PDT) MIME-Version: 1.0 References: <1991993923.530828.1556558314174.JavaMail.yahoo.ref@jws704008.mail.kks.yahoo.co.jp> <1991993923.530828.1556558314174.JavaMail.yahoo@jws704008.mail.kks.yahoo.co.jp> <22b68b094cbe7ab1b07673e43f6473906bd2d648.camel@freebsd.org> <20190429195750.409e9d13aea2ff1654a20d3c@bidouilliste.com> <20190429202357.79ac2d8dba8d0bed1caa8203@bidouilliste.com> <130153476.2287928.1556589558764.JavaMail.yahoo@jws700105.mail.ssk.yahoo.co.jp> <14cc3dfbfc7d7eb317129da8fe91485cf77b05af.camel@freebsd.org> In-Reply-To: <14cc3dfbfc7d7eb317129da8fe91485cf77b05af.camel@freebsd.org> From: Adrian Chadd Date: Mon, 20 May 2019 09:32:06 -0700 Message-ID: Subject: Re: spigen problem To: Ian Lepore Cc: Mori Hiroki , Emmanuel Vadot , "freebsd-mips@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 5EACA862CB X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=ph+Dh3Sr; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of adrianchadd@gmail.com designates 2607:f8b0:4864:20::b2c as permitted sender) smtp.mailfrom=adrianchadd@gmail.com X-Spamd-Result: default: False [-6.86 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.89)[-0.890,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(-2.96)[ip: (-9.24), ipnet: 2607:f8b0::/32(-3.25), asn: 15169(-2.26), country: US(-0.06)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[c.2.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FREEMAIL_CC(0.00)[yahoo.co.jp]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 16:32:20 -0000 On Mon, 20 May 2019 at 07:43, Ian Lepore wrote: > > On Sun, 2019-05-19 at 23:36 -0700, Adrian Chadd wrote: > > On Sun, 19 May 2019 at 09:41, Ian Lepore wrote: > > > > > > On Sun, 2019-05-19 at 09:03 -0700, Adrian Chadd wrote: > > > > hi! > > > > > > > > this looks ok to me. I'll go commit this tonight. > > > > > > > > > > > > -a > > > > > > > > > > I actually think it's horrible and we should fix the real problem > > > of > > > supporting hardware that can only do unidirectional > > > transfers. But, > > > doing so is a pretty big job. I've got some ideas on it, but it's > > > not > > > something that's going to get finished in a week or two. > > > > Do you mind if I commit this for now anyway? That at least unblocks > > Mori to do other interesting hacks. > > > > What are your ideas? > > > > > > Sorry, I should have been more specific that my whining didn't amount > to a blocking request, because I just don't have the spare time right > now to even try to address the underlying problem. > > There probably should have been a rule for spi from day one that the > controller driver has to supply a dummy buffer if the caller doesn't > supply a buffer for one of the directions and the controller must do > bidirectional transfers (like if dma is involved). Instead we went the > other way and said callers always must supply bidirectional buffers > even though the case of using both input and output data in one > transfer is exceedingly rare. > > I think a minimal-changes idea that may work is to say that the callers > must supply a buffer for both directions like they do now, but they are > allowed to set either the tx or the rx length to zero to provide a clue > to the controller driver that a transfer in that direction isn't needed > if the hardware can't do it (or if not doing it speeds things up or > makes things easier). We still have to examine and change every > existing controller driver, but the changes would be minimal. Hi! Ok. That makes sense. I can make the AR71xx SPI controller do this with little effort. I don't think we have a lot of SPI drivers in the tree though, so yeah, hopefully it shouldn't be too bad. I think establishing that moving forward as an SPI driver requirement would be great. That way we don't accumulate extra debt. -adrian