From owner-freebsd-embedded@freebsd.org Tue Aug 18 22:48:05 2015 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 D33859BD506 for ; Tue, 18 Aug 2015 22:48:05 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id B04301C1E for ; Tue, 18 Aug 2015 22:48:05 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id AD60F9BD503; Tue, 18 Aug 2015 22:48:05 +0000 (UTC) Delivered-To: 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 ACF439BD502 for ; Tue, 18 Aug 2015 22:48:05 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: from mail-la0-x231.google.com (mail-la0-x231.google.com [IPv6:2a00:1450:4010:c03::231]) (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 108D71C1C for ; Tue, 18 Aug 2015 22:48:05 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: by lahi9 with SMTP id i9so108448921lah.2 for ; Tue, 18 Aug 2015 15:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=XgkL/VaxMGlpAtsyP5uYRuWQnscQeL9EiWWGLHjPMaM=; b=Z58JFPNVK5n/U+MRcXcHCk+ooXy3xZ+sJAbrvfiNHStTZVnGcOR23g4ZTO6zcogj+D WW5uNpunc6rsUpKkNtiivWcb8hmiDjE3OBkDpOcQmGjAzq2do9c6Em1tN+QZxzje7Eqv LsVxZYdsWox2JSDQN66gBKdTi3VJYKnUSGo3thQTSN/H7/aX+Og/QoCrPJYJaA2qD6C5 7cqMOLtolbwWx4GNgeYxPu7xMjGcjrm3e07frhIIWEA00GQfdXprS4kodlwgQm2LUp2A /Svl/KUuqfXd2yeAwn+UdGNlx6h08PnoP1sy/VjhhMhyypCt5hBXx13A0LJBUcF5e8dF DBLg== X-Received: by 10.112.137.164 with SMTP id qj4mr8311363lbb.105.1439938083046; Tue, 18 Aug 2015 15:48:03 -0700 (PDT) MIME-Version: 1.0 References: <20150817160423.GB3078@gmail.com> In-Reply-To: <20150817160423.GB3078@gmail.com> From: Brian Fundakowski Feldman Date: Tue, 18 Aug 2015 22:47:52 +0000 Message-ID: Subject: Re: spigen(4) SPI Generic IO interface -- need comments To: Tom Jones Cc: embedded@freebsd.org Content-Type: multipart/mixed; boundary=089e0115fd1cf06895051d9db585 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2015 22:48:05 -0000 --089e0115fd1cf06895051d9db585 Content-Type: text/plain; charset=UTF-8 On Mon, Aug 17, 2015 at 12:04 PM Tom Jones wrote: > On Mon, Aug 17, 2015 at 10:00:26AM -0400, Brian Fundakowski Feldman wrote: > > I'm woefully out-of-practice with my kernel hackery (but still pretty > > proficient in jiggery-pokery) so I would like to get comments on a little > > driver I just made for interfacing arbitrarily in userland with SPI > > components. The only thing I'm exposing is a /dev/spigenN node with a > > single transfer ioctl and I put together a test circuit and program with > an > > MCP3008 10-bit ADC IC to validate that it basically works, other than the > > limitation that the transfers must be octet-multiply-sized, but I haven't > > looked at the SoC's (I'm using a Raspberry Pi 2) data sheet to tell > whether > > that's just a limit on the spibus(4) interface or the Broadcom SPI driver > > or the Broadcom SoC itself. > > > > I hit one snag in development where I simply called the ioctl wrong and > > found copyin(9) to page fault HARD if given a bogus user address to copy > > from, and panic the kernel. I can post up the test program if anyone > wants > > but it's very trivial: I just align the start bit and the command data > into > > the least significant bits of the first octet, shift it up two positions > so > > the NULs get clocked out as part of the command field, and provide two > > octets for the data field to retrieve back the 10-bit digital value. > > Oh, cool. > > I did the same earlier this year, have you seen[1]?. > > The FreeBSD i2c api is the same/very similar the linux one[2][3]. Have you > considered adding some of the ioctls[3] or the data structures to make it > easier to port code? > > [1]: > https://lists.freebsd.org/pipermail/freebsd-embedded/2015-April/002466.html > [2]: https://www.kernel.org/doc/Documentation/i2c/dev-interface > [3]: > https://www.freebsd.org/cgi/man.cgi?query=iic&apropos=0&sektion=0&manpath=FreeBSD+10.2-RELEASE&arch=default&format=html > [4]: https://www.kernel.org/doc/Documentation/spi/spidev I've iterated a bit on this to try to make some more sensible API, behaving reasonably about being able to set the SPI clock speed. I'm going to implement an mmap handler so I can have my low-latency operation mode, as well. I don't like the Linux APIs one bit because it's just not safe to allow all those configuration changes on a per-transfer basis... Moving this to -embedded because it's more apt than -hackers. --089e0115fd1cf06895051d9db585 Content-Type: application/octet-stream; name="spigen.patch" Content-Disposition: attachment; filename="spigen.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: 14f42ff4ece7e1ec3fe1 SW5kZXg6IGFybS9icm9hZGNvbS9iY20yODM1L2JjbTI4MzVfc3BpLmMKPT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0g YXJtL2Jyb2FkY29tL2JjbTI4MzUvYmNtMjgzNV9zcGkuYwkocmV2aXNpb24gMjg2ODkwKQorKysg YXJtL2Jyb2FkY29tL2JjbTI4MzUvYmNtMjgzNV9zcGkuYwkod29ya2luZyBj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cnkuICovCisJaWYgKGNsb2NrX3NwZWVkX2h6ICE9IDAgJiYgY2xvY2tfc3BlZWRfaHogIT0g c2MtPnNjX2Nsb2NrX3NwZWVkKQorCQliY21fc3BpX3NldF9jbG9ja19zcGVlZChzYywgc2MtPnNj X2Nsb2NrX3NwZWVkKTsKKwogCS8qIFJlbGVhc2UgdGhlIGNvbnRyb2xsZXIgYW5kIHdha2V1cCB0 aGUgbmV4dCB0aHJlYWQgd2FpdGluZyBmb3IgaXQuICovCiAJc2MtPnNjX2ZsYWdzID0gMDsKIAl3 YWtldXBfb25lKGRldik7CkBAIC00ODcsNiArNTA5LDcgQEAKIAlyZXR1cm4gKGVycik7CiB9CiAK Kwogc3RhdGljIHBoYW5kbGVfdAogYmNtX3NwaV9nZXRfbm9kZShkZXZpY2VfdCBidXMsIGRldmlj ZV90IGRldikKIHsKSW5kZXg6IGFybS9icm9hZGNvbS9iY20yODM1L2JjbTI4MzVfc3BpdmFyLmgK PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PQotLS0gYXJtL2Jyb2FkY29tL2JjbTI4MzUvYmNtMjgzNV9zcGl2YXIuaAkocmV2 aXNpb24gMjg2ODkwKQorKysgYXJtL2Jyb2FkY29tL2JjbTI4MzUvYmNtMjgzNV9zcGl2YXIuaAko d29ya2luZyBjb3B5KQpAQCAtNTQsNiArNTQsNyBAQAogCXVpbnQzMl90CQlzY19yZWFkOwogCXVp bnQzMl90CQlzY19mbGFnczsKIAl1aW50MzJfdAkJc2Nfd3JpdHRlbjsKKwl1aW50MzJfdAkJc2Nf Y2xvY2tfc3BlZWQ7CiAJdm9pZCAqCQkJc2NfaW50cmhhbmQ7CiB9OwogCkluZGV4OiBhcm0vY29u Zi9SUEkyCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT0KLS0tIGFybS9jb25mL1JQSTIJKHJldml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lmIC8qICFfU1lTX1NQSUdFTklPX0hfICovCgpQcm9wZXJ0eSBj aGFuZ2VzIG9uOiBzeXMvc3BpZ2VuaW8uaApfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCkFkZGVkOiBzdm46ZW9sLXN0eWxl CiMjIC0wLDAgKzEgIyMKK25hdGl2ZQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIHByb3BlcnR5CkFk ZGVkOiBzdm46a2V5d29yZHMKIyMgLTAsMCArMSAjIworRnJlZUJTRD0lSApcIE5vIG5ld2xpbmUg YXQgZW5kIG9mIHByb3BlcnR5CkFkZGVkOiBzdm46bWltZS10eXBlCiMjIC0wLDAgKzEgIyMKK3Rl eHQvcGxhaW4KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBwcm9wZXJ0eQo= --089e0115fd1cf06895051d9db585-- From owner-freebsd-embedded@freebsd.org Thu Aug 20 18:51:21 2015 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 BB3CA9BF1D4 for ; Thu, 20 Aug 2015 18:51:21 +0000 (UTC) (envelope-from karl@denninger.net) Received: from fs.denninger.net (wsip-70-169-168-7.pn.at.cox.net [70.169.168.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "NewFS.denninger.net", Issuer "NewFS.denninger.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C5AF10EE for ; Thu, 20 Aug 2015 18:51:20 +0000 (UTC) (envelope-from karl@denninger.net) Received: from [192.168.1.40] (localhost [127.0.0.1]) by fs.denninger.net (8.15.2/8.14.8) with ESMTP id t7KIpCJW010015 for ; Thu, 20 Aug 2015 13:51:12 -0500 (CDT) (envelope-from karl@denninger.net) Received: from [192.168.1.40] [192.168.1.40] (Via SSLv3 AES128-SHA) ; by Spamblock-sys (LOCAL/AUTH) Thu Aug 20 13:51:12 2015 Message-ID: <55D6217B.8000805@denninger.net> Date: Thu, 20 Aug 2015 13:50:35 -0500 From: Karl Denninger User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-embedded@freebsd.org Subject: Ue0/ue1 flapping Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms070509000200030302030701" X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2015 18:51:21 -0000 This is a cryptographically signed message in MIME format. --------------ms070509000200030302030701 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Raspberry Pi, FreeBSD 11.0-CURRENT #0 r285923: Mon Jul 27 22:55:03 CDT 20= 15 Two interfaces, the on-board and a Lenovo dongle (as ue1); both are flapping at an irregular rate. ue0: link state changed to DOWN ue0.3: link state changed to DOWN ue0: link state changed to UP ue0.3: link state changed to UP ue1: link state changed to DOWN ue1: link state changed to UP ue0: link state changed to DOWN ue0.3: link state changed to DOWN ue0: link state changed to UP ue0.3: link state changed to UP I have a vlan defined on ue0, but ue1 has only one network on it. I've tried pinning the media type at the switch it is plugged into thinking perhaps it's fighting with the switch it's connected to, but that's not it -- it makes no difference. Nor does it appear to be traffic related. The flapping hoses the snmp daemon that is running on the machine, causing it to "go deaf." Interestingly enough it doesn't interrupt a ssh session that you may have open if/when it happens. Any ideas on how I can figure out why (e.g. what condition the interface code is seeing?) the interfaces are resetting? This is all I have in the dmesg. --=20 Karl Denninger karl@denninger.net /The Market Ticker/ /[S/MIME encrypted email preferred]/ --------------ms070509000200030302030701 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGXzCC BlswggRDoAMCAQICASkwDQYJKoZIhvcNAQELBQAwgZAxCzAJBgNVBAYTAlVTMRAwDgYDVQQI EwdGbG9yaWRhMRIwEAYDVQQHEwlOaWNldmlsbGUxGTAXBgNVBAoTEEN1ZGEgU3lzdGVtcyBM TEMxHDAaBgNVBAMTE0N1ZGEgU3lzdGVtcyBMTEMgQ0ExIjAgBgkqhkiG9w0BCQEWE0N1ZGEg U3lzdGVtcyBMTEMgQ0EwHhcNMTUwNDIxMDIyMTU5WhcNMjAwNDE5MDIyMTU5WjBaMQswCQYD VQQGEwJVUzEQMA4GA1UECBMHRmxvcmlkYTEZMBcGA1UEChMQQ3VkYSBTeXN0ZW1zIExMQzEe MBwGA1UEAxMVS2FybCBEZW5uaW5nZXIgKE9DU1ApMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A MIICCgKCAgEAuYRY+EB2mGtZ3grlVO8TmnEvduVFA/IYXcCmNSOC1q+pTVjylsjcHKBcOPb9 TP1KLxdWP+Q1soSORGHlKw2/HcVzShDW5WPIKrvML+Ry0XvIvNBu9adTiCsA9nci4Cnf98XE hVpenER0qbJkBUOGT1rP4iAcfjet0lEgzPEnm+pAxv6fYSNp1WqIY9u0b1pkQiaWrt8hgNOc rJOiLbc8CeQ/DBP6rUiQjYNO9/aPNauEtHkNNfR9RgLSfGUdZuOCmJqnIla1HsrZhA5p69Bv /e832BKiNPaH5wF6btAiPpTr2sRhwQO8/IIxcRX1Vxd1yZbjYtJGw+9lwEcWRYAmoxkzKLPi S6Zo/6z5wgNpeK1H+zOioMoZIczgI8BlX1iHxqy/FAvm4PHPnC8s+BLnJLwr+jvMNHm82QwL J9hC5Ho8AnFU6TkCuq+P2V8/clJVqnBuvTUKhYMGS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MBcGA1UEChMQ Q3VkYSBTeXN0ZW1zIExMQzEcMBoGA1UEAxMTQ3VkYSBTeXN0ZW1zIExMQyBDQTEiMCAGCSqG SIb3DQEJARYTQ3VkYSBTeXN0ZW1zIExMQyBDQQIBKTANBgkqhkiG9w0BAQEFAASCAgAh+n7/ dZBPvHeVr2mr3cQyQV7+labXiszP1ra5qh3s4lKG5qWecS92Zp82D4AjoYgJrz6coC48nIS6 oiTVti+m1XQX0sb7oNwQ+ZCWwUNXcrTvjnQeT3VaeiVKBeIVQyT4Ku+rr/HrUdbH/17nCN/9 xN4/ZQlnDhMIOlCKMAE+KXl0VAPUcWAquwk7wu6LCIELxzV9odD1dKbO9kLrdujnDD+ONv7N s3I1uypkQwATKcewD51Ys5aFQgoWVn3pzrtXZ0yiVf6vRATkhXTaIILm/yGpoaSuio9kyBx4 zMGE01mxuPBWvVa4O2Qu4ZZtV8eH7o1S34b1kiXN/YqoYFYvMqNyFXGDKtaX6Px03Kuj2zkV ZhY+bJOHWJrdmJ+nl4SjlOY9TBzFYA17Oe7tlYylu3T4ayJmKlkRkOgL/i0WOcjT5VbkWR5O LRqE2Dnv4hsZ1db5XilXJkT6KKDRgz0bhO8R/37J19oNLjdd7VILUqy+zhAx4ZOqKYJg/+ZP GAV15Ckdby6CBDEQ46QbXZ/kmgIDxn9ee4n/EWI664TsQYTx3+zjDLSjZkQlNw/oYSODmLCX Nim3dn/i0svsRaTZtq0Qtp0rNRTsj0szcETjPzDnFc3usk/424nxkyraLt4HCaw58uIYQAUF uqLE8aTLhwjVRUfh5nWCF6enGe/NsQAAAAAAAA== --------------ms070509000200030302030701-- From owner-freebsd-embedded@freebsd.org Thu Aug 20 20:23:37 2015 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 A49E69BF08B for ; Thu, 20 Aug 2015 20:23:37 +0000 (UTC) (envelope-from huubsch@xs4all.nl) Received: from lb3-smtp-cloud2.xs4all.net (lb3-smtp-cloud2.xs4all.net [194.109.24.29]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client CN "*.xs4all.nl", Issuer "GlobalSign Domain Validation CA - SHA256 - G2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 394FFEB for ; Thu, 20 Aug 2015 20:23:36 +0000 (UTC) (envelope-from huubsch@xs4all.nl) Received: from iMac-van-Huub.fritz.box ([83.160.119.88]) by smtp-cloud2.xs4all.net with ESMTP id 78NN1r00C1uXTTF018NPYY; Thu, 20 Aug 2015 22:22:24 +0200 Message-ID: <55D636FE.9020005@xs4all.nl> Date: Thu, 20 Aug 2015 22:22:22 +0200 From: Huub Schuurmans User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: freebsd-embedded@freebsd.org Subject: Re: Ue0/ue1 flapping References: <55D6217B.8000805@denninger.net> In-Reply-To: <55D6217B.8000805@denninger.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2015 20:23:37 -0000 Karl Denninger schreef op 20/08/15 om 20:50: > Raspberry Pi, FreeBSD 11.0-CURRENT #0 r285923: Mon Jul 27 22:55:03 CDT 2015 > > Two interfaces, the on-board and a Lenovo dongle (as ue1); both are > flapping at an irregular rate. > We have also experienced this flapping with Alix-2d13 boards if two usb-lan adapters are in use. One adapter is stable, at least on Freebsd9.0 or older. On the Alix-board usb-lan adapters do not work at all for FreeBSD versions more recent than 9.0 (we tested various adapters with different chips). We don't want to switch to Linux (no problems there as far as I know/have tested) but will abandon usb-interfaces and install managed switches. There is an old bug report about this, but nobody has picked up on it. Use linux or a managed switch. Huub From owner-freebsd-embedded@freebsd.org Thu Aug 20 21:46:55 2015 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 27C3E9BE02C for ; Thu, 20 Aug 2015 21:46:55 +0000 (UTC) (envelope-from karl@denninger.net) Received: from fs.denninger.net (wsip-70-169-168-7.pn.at.cox.net [70.169.168.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "NewFS.denninger.net", Issuer "NewFS.denninger.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CFB8C198D for ; Thu, 20 Aug 2015 21:46:54 +0000 (UTC) (envelope-from karl@denninger.net) Received: from [192.168.1.40] (localhost [127.0.0.1]) by fs.denninger.net (8.15.2/8.14.8) with ESMTP id t7KLkpN9076921 for ; Thu, 20 Aug 2015 16:46:51 -0500 (CDT) (envelope-from karl@denninger.net) Received: from [192.168.1.40] [192.168.1.40] (Via SSLv3 AES128-SHA) ; by Spamblock-sys (LOCAL/AUTH) Thu Aug 20 16:46:51 2015 Message-ID: <55D64AA7.40305@denninger.net> Date: Thu, 20 Aug 2015 16:46:15 -0500 From: Karl Denninger User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-embedded@freebsd.org Subject: Re: Ue0/ue1 flapping References: <55D6217B.8000805@denninger.net> <55D636FE.9020005@xs4all.nl> In-Reply-To: <55D636FE.9020005@xs4all.nl> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms060000070206070509080605" X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2015 21:46:55 -0000 This is a cryptographically signed message in MIME format. --------------ms060000070206070509080605 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 8/20/2015 15:22, Huub Schuurmans wrote: > Karl Denninger schreef op 20/08/15 om 20:50: >> Raspberry Pi, FreeBSD 11.0-CURRENT #0 r285923: Mon Jul 27 22:55:03 CDT= 2015 >> >> Two interfaces, the on-board and a Lenovo dongle (as ue1); both are >> flapping at an irregular rate. >> > We have also experienced this flapping with Alix-2d13 boards if two > usb-lan adapters are in use. One adapter is stable, at least on > Freebsd9.0 or older. > On the Alix-board usb-lan adapters do not work at all for FreeBSD > versions more recent than 9.0 (we tested various adapters with differen= t > chips). We don't want to switch to Linux (no problems there as far as I= > know/have tested) but will abandon usb-interfaces and install managed > switches. > > There is an old bug report about this, but nobody has picked up on it. > Use linux or a managed switch. > > Huub > I have reconfigured to use a managed switch and thus am able to drop the second phy -- we'll see if that resolves it.... hopefully so. --=20 Karl Denninger karl@denninger.net /The Market Ticker/ /[S/MIME encrypted email preferred]/ --------------ms060000070206070509080605 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGXzCC BlswggRDoAMCAQICASkwDQYJKoZIhvcNAQELBQAwgZAxCzAJBgNVBAYTAlVTMRAwDgYDVQQI EwdGbG9yaWRhMRIwEAYDVQQHEwlOaWNldmlsbGUxGTAXBgNVBAoTEEN1ZGEgU3lzdGVtcyBM TEMxHDAaBgNVBAMTE0N1ZGEgU3lzdGVtcyBMTEMgQ0ExIjAgBgkqhkiG9w0BCQEWE0N1ZGEg U3lzdGVtcyBMTEMgQ0EwHhcNMTUwNDIxMDIyMTU5WhcNMjAwNDE5MDIyMTU5Wj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8Wj/ O93W17a1oN6ZZTOwPnnP3fsW9BGHpnXcBBNF6Z/wUZAJ1JODUIGMvR98ENEY965ohA14ArOf 0BGj6iLgI1T1ie3+grO1/BvrbCX8Xk1D3L5CmSHH/u5F8C1as4VJ91L07rTXXDPs3MumR8t9 uwc3i8li8lgoCAO3fe8G5cGotyJyQw3+p3ndpn7T9FhQESyCK4DFvjAZdDYR7ACya0xxRNzn jlExlJ6bjWnBEwla1iCgWAWLyLcDTiK86l0nZaOUbeX1o3cIzviRzNhXt/8VZ+UxMLM2gnen Id2okMwd1LB93T4nibQEzm7pl6/NbpKDyUHuolxdbW0TvUfWa/t97DVXFy8OTSb+JoBRKvvx 83oRmc3x4TjI9ew+hB//bNiKvplItwAAAAAAAA== --------------ms060000070206070509080605-- From owner-freebsd-embedded@freebsd.org Fri Aug 21 03:35:56 2015 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 F152F9BECF0 for ; Fri, 21 Aug 2015 03:35:55 +0000 (UTC) (envelope-from karl@denninger.net) Received: from fs.denninger.net (wsip-70-169-168-7.pn.at.cox.net [70.169.168.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "NewFS.denninger.net", Issuer "NewFS.denninger.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DDE116BF for ; Fri, 21 Aug 2015 03:35:54 +0000 (UTC) (envelope-from karl@denninger.net) Received: from [192.168.1.40] (localhost [127.0.0.1]) by fs.denninger.net (8.15.2/8.14.8) with ESMTP id t7L3Zqev080170 for ; Thu, 20 Aug 2015 22:35:53 -0500 (CDT) (envelope-from karl@denninger.net) Received: from [192.168.1.40] [192.168.1.40] (Via SSLv3 AES128-SHA) ; by Spamblock-sys (LOCAL/AUTH) Thu Aug 20 22:35:53 2015 Message-ID: <55D69C73.9030909@denninger.net> Date: Thu, 20 Aug 2015 22:35:15 -0500 From: Karl Denninger User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-embedded@freebsd.org Subject: Re: Ue0/ue1 flapping References: <55D6217B.8000805@denninger.net> <55D636FE.9020005@xs4all.nl> <55D64AA7.40305@denninger.net> In-Reply-To: <55D64AA7.40305@denninger.net> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms040401070402040801010709" X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 03:35:56 -0000 This is a cryptographically signed message in MIME format. --------------ms040401070402040801010709 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 8/20/2015 16:46, Karl Denninger wrote: > > On 8/20/2015 15:22, Huub Schuurmans wrote: >> Karl Denninger schreef op 20/08/15 om 20:50: >>> Raspberry Pi, FreeBSD 11.0-CURRENT #0 r285923: Mon Jul 27 22:55:03 CD= T 2015 >>> >>> Two interfaces, the on-board and a Lenovo dongle (as ue1); both are >>> flapping at an irregular rate. >>> >> We have also experienced this flapping with Alix-2d13 boards if two >> usb-lan adapters are in use. One adapter is stable, at least on >> Freebsd9.0 or older. >> On the Alix-board usb-lan adapters do not work at all for FreeBSD >> versions more recent than 9.0 (we tested various adapters with differe= nt >> chips). We don't want to switch to Linux (no problems there as far as = I >> know/have tested) but will abandon usb-interfaces and install managed >> switches. >> >> There is an old bug report about this, but nobody has picked up on it.= >> Use linux or a managed switch. >> >> Huub >> > I have reconfigured to use a managed switch and thus am able to drop > the second phy -- we'll see if that resolves it.... hopefully so. > > --=20 > // Unfortunately, even with only one interface in the machine (two VLANs configured on it); that is, just the internal one, it still flaps. A lot. --=20 Karl Denninger karl@denninger.net /The Market Ticker/ /[S/MIME encrypted email preferred]/ --------------ms040401070402040801010709 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGXzCC BlswggRDoAMCAQICASkwDQYJKoZIhvcNAQELBQAwgZAxCzAJBgNVBAYTAlVTMRAwDgYDVQQI EwdGbG9yaWRhMRIwEAYDVQQHEwlOaWNldmlsbGUxGTAXBgNVBAoTEEN1ZGEgU3lzdGVtcyBM TEMxHDAaBgNVBAMTE0N1ZGEgU3lzdGVtcyBMTEMgQ0ExIjAgBgkqhkiG9w0BCQEWE0N1ZGEg U3lzdGVtcyBMTEMgQ0EwHhcNMTUwNDIxMDIyMTU5WhcNMjAwNDE5MDIyMTU5WjBaMQswCQYD VQQGEwJVUzEQMA4GA1UECBMHRmxvcmlkYTEZMBcGA1UEChMQQ3VkYSBTeXN0ZW1zIExMQzEe MBwGA1UEAxMVS2FybCBEZW5uaW5nZXIgKE9DU1ApMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A MIICCgKCAgEAuYRY+EB2mGtZ3grlVO8TmnEvduVFA/IYXcCmNSOC1q+pTVjylsjcHKBcOPb9 TP1KLxdWP+Q1soSORGHlKw2/HcVzShDW5WPIKrvML+Ry0XvIvNBu9adTiCsA9nci4Cnf98XE hVpenER0qbJkBUOGT1rP4iAcfjet0lEgzPEnm+pAxv6fYSNp1WqIY9u0b1pkQiaWrt8hgNOc rJOiLbc8CeQ/DBP6rUiQjYNO9/aPNauEtHkNNfR9RgLSfGUdZuOCmJqnIla1HsrZhA5p69Bv /e832BKiNPaH5wF6btAiPpTr2sRhwQO8/IIxcRX1Vxd1yZbjYtJGw+9lwEcWRYAmoxkzKLPi S6Zo/6z5wgNpeK1H+zOioMoZIcz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RACCzGBmaCBljCBkDELMAkGA1UE BhMCVVMxEDAOBgNVBAgTB0Zsb3JpZGExEjAQBgNVBAcTCU5pY2V2aWxsZTEZMBcGA1UEChMQ Q3VkYSBTeXN0ZW1zIExMQzEcMBoGA1UEAxMTQ3VkYSBTeXN0ZW1zIExMQyBDQTEiMCAGCSqG SIb3DQEJARYTQ3VkYSBTeXN0ZW1zIExMQyBDQQIBKTANBgkqhkiG9w0BAQEFAASCAgBVe7Gy Zr+WowgOy0kWmFMj1IfaBJ6c8WAhABKLIEkhGWxUPwZBDPGfsYZ9oW4Xiz323+mExHfhkdqq 7LynTiT5IOG+7MWF2I+B4k+/sUelqzCDxxquOkw7iSZXuUBvjLg5GuczKuQ7ERzmvELG3B+v w0I1+mjrXfFjigCqzBojipf2pkaCzLA7Lf54wTHtssN/llH/up6Ux5iOeTPSF68t9jLmKErK qG+IyR1GukkIT25tWdCYiffKaWyDWcg4VHDaTigljO0XIX8RPPCCuXGD0RMRH0gS8Egz+w71 BvFzzmXl1XBHkKDmULZF4EJA3fzzlwuvzH4t8Nq51diW1uk0LcxOnCnfm65upGKigpnDCekq D2JmcdPzEBB0TSk5PQvCc9lmlUiSHDkK4DPmWxMUps2Go4c2qIz6BtFYrbLeJcJNKjCJbKFE pLZKCDJiRSQn9vvaxhNAMg0MeJ37UJx115VAipQgea30iMEUmECNFRJH0DXBPB/7leUpH5Ml QRiiHABISbioH/R3J3h56AgbJz137/yslPmbQc3BxcNT0VTQbq0EeR2gMZIQFh/7jUvXZhBk 2yf0x2ltPx+MaWo7O0DQ4X9SqCZwfJDqXCyXwTUM2miSuclB449ZT3S6UB2n6AZyQPShhL9t qnB9rQbsfXrqLSCr189wv44BKsRrzAAAAAAAAA== --------------ms040401070402040801010709-- From owner-freebsd-embedded@freebsd.org Sat Aug 22 18:23:35 2015 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 838DC9BFB16 for ; Sat, 22 Aug 2015 18:23:35 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 5EB58C9 for ; Sat, 22 Aug 2015 18:23:35 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 5E0019BFB15; Sat, 22 Aug 2015 18:23:35 +0000 (UTC) Delivered-To: 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 439909BFB14 for ; Sat, 22 Aug 2015 18:23:35 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (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 0B98CC8; Sat, 22 Aug 2015 18:23:35 +0000 (UTC) (envelope-from brianfundakowskifeldman@gmail.com) Received: by iodb91 with SMTP id b91so111747875iod.1; Sat, 22 Aug 2015 11:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SahEo2HB1j842Qtzevvx3iDMgJ52yjafp5ijf3kRysg=; b=XGGHVSwq5O02og/HdX41PIj0doihjrUZQd9BajyRQrUjX/zo9mHAUcCbVSERyOmsVy UjxZN6ozCIqB1OY43YxAgviOXifv7eITfZrPxLuSd2aWXFauU5WeuGWMMP5199IGZRO+ zDw5cFBb43UdekoBc0dDIvyKl8WpuNMOKJ46rp5NBzw3alUENJZwxppdtUBZYDRv1Sbr 0Vqa26gg5XICyuIzz7r91rBWh7BG1wUYEmsEkMDEMOsJ5TZVp+8w71uUF+f7QuW224po 5MZMxJaZOHtTzlfYHASzpRvhRIm67tICQQ1fpTMt87JOWJ7bsdJKBGasikY/+x2Svh4C a+GA== MIME-Version: 1.0 X-Received: by 10.107.19.94 with SMTP id b91mr11904817ioj.144.1440267814018; Sat, 22 Aug 2015 11:23:34 -0700 (PDT) Received: by 10.107.18.155 with HTTP; Sat, 22 Aug 2015 11:23:33 -0700 (PDT) In-Reply-To: References: <20150817160423.GB3078@gmail.com> Date: Sat, 22 Aug 2015 14:23:33 -0400 Message-ID: Subject: Re: spigen(4) SPI Generic IO interface -- need comments From: Brian Fundakowski Feldman To: Tom Jones , loos@freebsd.org Cc: embedded@freebsd.org Content-Type: multipart/mixed; boundary=001a113f3c707013b3051dea7b77 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2015 18:23:35 -0000 --001a113f3c707013b3051dea7b77 Content-Type: text/plain; charset=UTF-8 I've added a couple more features: * clock adjustment via ioctl, independent per spigenN device * mmap(2) support for very low latency On Tue, Aug 18, 2015 at 6:47 PM, Brian Fundakowski Feldman < brianfundakowskifeldman@gmail.com> wrote: > On Mon, Aug 17, 2015 at 12:04 PM Tom Jones wrote: > >> On Mon, Aug 17, 2015 at 10:00:26AM -0400, Brian Fundakowski Feldman wrote: >> > I'm woefully out-of-practice with my kernel hackery (but still pretty >> > proficient in jiggery-pokery) so I would like to get comments on a >> little >> > driver I just made for interfacing arbitrarily in userland with SPI >> > components. The only thing I'm exposing is a /dev/spigenN node with a >> > single transfer ioctl and I put together a test circuit and program >> with an >> > MCP3008 10-bit ADC IC to validate that it basically works, other than >> the >> > limitation that the transfers must be octet-multiply-sized, but I >> haven't >> > looked at the SoC's (I'm using a Raspberry Pi 2) data sheet to tell >> whether >> > that's just a limit on the spibus(4) interface or the Broadcom SPI >> driver >> > or the Broadcom SoC itself. >> > >> > I hit one snag in development where I simply called the ioctl wrong and >> > found copyin(9) to page fault HARD if given a bogus user address to copy >> > from, and panic the kernel. I can post up the test program if anyone >> wants >> > but it's very trivial: I just align the start bit and the command data >> into >> > the least significant bits of the first octet, shift it up two >> positions so >> > the NULs get clocked out as part of the command field, and provide two >> > octets for the data field to retrieve back the 10-bit digital value. >> >> Oh, cool. >> >> I did the same earlier this year, have you seen[1]?. >> >> The FreeBSD i2c api is the same/very similar the linux one[2][3]. Have you >> considered adding some of the ioctls[3] or the data structures to make it >> easier to port code? >> >> [1]: >> https://lists.freebsd.org/pipermail/freebsd-embedded/2015-April/002466.html >> [2]: https://www.kernel.org/doc/Documentation/i2c/dev-interface >> [3]: >> https://www.freebsd.org/cgi/man.cgi?query=iic&apropos=0&sektion=0&manpath=FreeBSD+10.2-RELEASE&arch=default&format=html >> [4]: https://www.kernel.org/doc/Documentation/spi/spidev > > > I've iterated a bit on this to try to make some more sensible API, > behaving reasonably about being able to set the SPI clock speed. I'm going > to implement an mmap handler so I can have my low-latency operation mode, > as well. I don't like the Linux APIs one bit because it's just not safe to > allow all those configuration changes on a per-transfer basis... > > Moving this to -embedded because it's more apt than -hackers. > --001a113f3c707013b3051dea7b77 Content-Type: application/octet-stream; name="spigen_with_mmap.patch" Content-Disposition: attachment; filename="spigen_with_mmap.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_idne77xk1 SW5kZXg6IGFybS9icm9hZGNvbS9iY20yODM1L2JjbTI4MzVfc3BpLmMKPT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0g YXJtL2Jyb2FkY29tL2JjbTI4MzUvYmNtMjgzNV9zcGkuYwkocmV2aXNpb24gM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21ldGhvZF90IHNwaWdlbl9tZXRob2RzW10gPSB7CisJLyogRGV2 aWNlIGludGVyZmFjZSAqLworCURFVk1FVEhPRChkZXZpY2VfcHJvYmUsCQlzcGlnZW5fcHJvYmUp LAorCURFVk1FVEhPRChkZXZpY2VfYXR0YWNoLAlzcGlnZW5fYXR0YWNoKSwKKwlERVZNRVRIT0Qo ZGV2aWNlX2RldGFjaCwJc3BpZ2VuX2RldGFjaCksCisKKwl7IDAsIDAgfQorfTsKKworc3RhdGlj IGRyaXZlcl90IHNwaWdlbl9kcml2ZXIgPSB7CisJInNwaWdlbiIsCisJc3BpZ2VuX21ldGhvZHMs CisJc2l6ZW9mKHN0cnVjdCBzcGlnZW5fc29mdGMpLAorfTsKKworRFJJVkVSX01PRFVMRShzcGln ZW4sIHNwaWJ1cywgc3BpZ2VuX2RyaXZlciwgc3BpZ2VuX2RldmNsYXNzLCAwLCAwKTsKClByb3Bl cnR5IGNoYW5nZXMgb246IGRldi9zcGlidXMvc3BpZ2VuLmMKX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwpBZGRlZDogc3Zu OmVvbC1zdHlsZQojIyAtMCwwICsxICMjCituYXRpdmUKXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBw cm9wZXJ0eQpBZGRlZDogc3ZuOmtleXdvcmRzCiMjIC0wLDAgKzEgIyMKK0ZyZWVCU0Q9JUgKXCBO byBuZXdsaW5lIGF0IGVuZCBvZiBwcm9wZXJ0eQpBZGRlZDogc3ZuOm1pbWUtdHlwZQojIyAtMCww ICsxICMjCit0ZXh0L3BsYWluClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgcHJvcGVydHkKSW5kZXg6 IHN5cy9zcGlnZW5pby5oCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9zcGlnZW5pby5oCShyZXZpc2lvbi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tleXdvcmRzCiMjIC0w LDAgKzEgIyMKK0ZyZWVCU0Q9JUgKXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBwcm9wZXJ0eQpBZGRl ZDogc3ZuOm1pbWUtdHlwZQojIyAtMCwwICsxICMjCit0ZXh0L3BsYWluClwgTm8gbmV3bGluZSBh dCBlbmQgb2YgcHJvcGVydHkK --001a113f3c707013b3051dea7b77-- From owner-freebsd-embedded@freebsd.org Sat Aug 22 21:55:30 2015 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 936A49BEC08 for ; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 72200FFF for ; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 6FC709BEC07; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) Delivered-To: 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 56F0E9BEC05 for ; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (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 21EE4FFE; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by iods203 with SMTP id s203so114542112iod.0; Sat, 22 Aug 2015 14:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=dmU19OGoWj5DDOCS1J6UD59LkYVoWR7C8qsRcxMkNM8=; b=C0/QzHy+Lu69+xM6X6lA43cwe3sjz8mqInWOayuOjKJHkL8edKAxVazyIDTxYrryg+ QlHWYtWJ2jPFSXncXw6eMPjj1VsKPsKb/q5mz9SNAKmUI0bR9T89TqQz2P4nDy3Tn+46 0xiXFKyrdSPn/9tpX/ZBELXyK/QwXhWp782D8sHarfmeDwnhnauuDj8d9mwjejx0Uw3u wX3OHYYleexviup3Q0MhtGd0dTHja7+W0hVDlVnztKVjCE27SGDXLBkaxdemAusFBmBt C1ZwkW0I/+OcJ7TaiMJdJK7vcqtl5mRatiYGIoUX2HK8jRhya2I7Z5i5vfC081oH3cho JP+A== MIME-Version: 1.0 X-Received: by 10.107.131.196 with SMTP id n65mr12680307ioi.75.1440280529537; Sat, 22 Aug 2015 14:55:29 -0700 (PDT) Received: by 10.36.38.133 with HTTP; Sat, 22 Aug 2015 14:55:27 -0700 (PDT) In-Reply-To: References: <20150817160423.GB3078@gmail.com> Date: Sat, 22 Aug 2015 14:55:27 -0700 Message-ID: Subject: Re: spigen(4) SPI Generic IO interface -- need comments From: Adrian Chadd To: Brian Fundakowski Feldman Cc: Tom Jones , Luiz Otavio O Souza , "freebsd-embedded@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2015 21:55:30 -0000 Hi! This looks cool! Is there any reason why the clock isn't per transaction? -a On 22 August 2015 at 11:23, Brian Fundakowski Feldman wrote: > I've added a couple more features: > * clock adjustment via ioctl, independent per spigenN device > * mmap(2) support for very low latency > > On Tue, Aug 18, 2015 at 6:47 PM, Brian Fundakowski Feldman < > brianfundakowskifeldman@gmail.com> wrote: > >> On Mon, Aug 17, 2015 at 12:04 PM Tom Jones wrote: >> >>> On Mon, Aug 17, 2015 at 10:00:26AM -0400, Brian Fundakowski Feldman wrote: >>> > I'm woefully out-of-practice with my kernel hackery (but still pretty >>> > proficient in jiggery-pokery) so I would like to get comments on a >>> little >>> > driver I just made for interfacing arbitrarily in userland with SPI >>> > components. The only thing I'm exposing is a /dev/spigenN node with a >>> > single transfer ioctl and I put together a test circuit and program >>> with an >>> > MCP3008 10-bit ADC IC to validate that it basically works, other than >>> the >>> > limitation that the transfers must be octet-multiply-sized, but I >>> haven't >>> > looked at the SoC's (I'm using a Raspberry Pi 2) data sheet to tell >>> whether >>> > that's just a limit on the spibus(4) interface or the Broadcom SPI >>> driver >>> > or the Broadcom SoC itself. >>> > >>> > I hit one snag in development where I simply called the ioctl wrong and >>> > found copyin(9) to page fault HARD if given a bogus user address to copy >>> > from, and panic the kernel. I can post up the test program if anyone >>> wants >>> > but it's very trivial: I just align the start bit and the command data >>> into >>> > the least significant bits of the first octet, shift it up two >>> positions so >>> > the NULs get clocked out as part of the command field, and provide two >>> > octets for the data field to retrieve back the 10-bit digital value. >>> >>> Oh, cool. >>> >>> I did the same earlier this year, have you seen[1]?. >>> >>> The FreeBSD i2c api is the same/very similar the linux one[2][3]. Have you >>> considered adding some of the ioctls[3] or the data structures to make it >>> easier to port code? >>> >>> [1]: >>> https://lists.freebsd.org/pipermail/freebsd-embedded/2015-April/002466.html >>> [2]: https://www.kernel.org/doc/Documentation/i2c/dev-interface >>> [3]: >>> https://www.freebsd.org/cgi/man.cgi?query=iic&apropos=0&sektion=0&manpath=FreeBSD+10.2-RELEASE&arch=default&format=html >>> [4]: https://www.kernel.org/doc/Documentation/spi/spidev >> >> >> I've iterated a bit on this to try to make some more sensible API, >> behaving reasonably about being able to set the SPI clock speed. I'm going >> to implement an mmap handler so I can have my low-latency operation mode, >> as well. I don't like the Linux APIs one bit because it's just not safe to >> allow all those configuration changes on a per-transfer basis... >> >> Moving this to -embedded because it's more apt than -hackers. >> > > _______________________________________________ > freebsd-embedded@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-embedded > To unsubscribe, send any mail to "freebsd-embedded-unsubscribe@freebsd.org"