From owner-freebsd-arm@FreeBSD.ORG Fri Apr 17 14:14:16 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86B52AA6 for ; Fri, 17 Apr 2015 14:14:16 +0000 (UTC) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) (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 51CD98A1 for ; Fri, 17 Apr 2015 14:14:16 +0000 (UTC) Received: by pdbqd1 with SMTP id qd1so129561325pdb.2 for ; Fri, 17 Apr 2015 07:14:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=4pdFz8tB6Ct6bACmMD3YcqsXz3tRq1vtkJzwR5wmPPQ=; b=SeT6aUl6cCDVcqg4aqA+NyhZSte9hqVI4oujrkJ1p3nc/hw6ELV8g+OpIpsYLIPHZI ox190oB26PpNisGKEN8KCq4R3dYO1Fwy1Y68bw8qc4R1qlWI6NNI2XuwbQ+P5e7pQdxh p7boSiaIAXUVcRVXQoSFpWhF9eqkfxG2nc/zY4EJ8OY9A5yXaJ6sgDjdafi3cKd+1SoV onfRwvYYS0a9HrFaZ7SLOlqgCZBycySlo/XPrJSN3FC6ZJsNYnbPO4c23JziKWEMZukF lfB1tL8fElIQoxwFQYEQhRICVmfdyW2NmK9cq0wmf14mz6YmQXs1XGwfGTY+doOYGsX5 gJgw== X-Gm-Message-State: ALoCoQmsNfjWEZp1eKbkvDRR/iBM0Log6EULubWbgrp/Aut5U9ajBMgIPTBXPDBG3VoMgBpXbCeE X-Received: by 10.66.137.2 with SMTP id qe2mr5809844pab.77.1429280050102; Fri, 17 Apr 2015 07:14:10 -0700 (PDT) Received: from [10.64.24.57] ([69.53.236.236]) by mx.google.com with ESMTPSA id nv13sm10341961pdb.15.2015.04.17.07.14.08 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Apr 2015 07:14:09 -0700 (PDT) Sender: Warner Losh Subject: Re: help with coding a loadable kernel module Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Content-Type: multipart/signed; boundary="Apple-Mail=_98F1A014-E68F-4099-80B6-1FA653B89D02"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b6 From: Warner Losh In-Reply-To: <8C177A8C-F6B2-43D5-925F-A3C33B6CF577@cs.huji.ac.il> Date: Fri, 17 Apr 2015 08:14:08 -0600 Cc: Ian Lepore , freebsd-arm@freebsd.org Message-Id: <064E53E1-0AAA-4373-9225-E0E4694D23A7@bsdimp.com> References: <20150417080839.GO2743@home.opsec.eu> <9B835088-661C-456E-84A7-47BC1835C0CB@cs.huji.ac.il> <20150417095536.GA38091@gmail.com> <32D7EBD3-813E-4062-8A06-ED8E82BA50DA@cs.huji.ac.il> <1429276417.1182.71.camel@freebsd.org> <8C177A8C-F6B2-43D5-925F-A3C33B6CF577@cs.huji.ac.il> To: Daniel Braniss X-Mailer: Apple Mail (2.2098) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 14:14:16 -0000 --Apple-Mail=_98F1A014-E68F-4099-80B6-1FA653B89D02 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 17, 2015, at 8:08 AM, Daniel Braniss = wrote: >=20 >>=20 >> On Apr 17, 2015, at 4:42 PM, Warner Losh wrote: >>=20 >>>=20 >>> On Apr 17, 2015, at 7:26 AM, Daniel Braniss = wrote: >>>=20 >>>>=20 >>>> On Apr 17, 2015, at 4:13 PM, Ian Lepore wrote: >>>>=20 >>>> On Fri, 2015-04-17 at 13:46 +0300, Daniel Braniss wrote: >>>>>> On Apr 17, 2015, at 12:55 PM, Tom Jones wrote: >>>>>>=20 >>>>>> On Fri, Apr 17, 2015 at 12:15:33PM +0300, Daniel Braniss wrote: >>>>>>>=20 >>>>>>>> On Apr 17, 2015, at 11:08 AM, Kurt Jaeger = wrote: >>>>>>>>=20 >>>>>>>> Hi! >>>>>>>>=20 >>>>>>>>> I know I'm embarking on a dangerous trip, but I want to use a = Raspberry Pi >>>>>>>>> and or a BeagleBone to read (and write) RFID cards. >>>>>>>>> Since a driver is needed to use the spibus, I have 2 options = while >>>>>>>>> developing: >>>>>>>> [...] >>>>>>>>> So before I give up on option 2, is there some examples/help? >>>>>>>>=20 >>>>>>>> Are you aware of this book ? >>>>>>>>=20 >>>>>>>> http://www.nostarch.com/bsddrivers.htm = >>>>>>>=20 >>>>>>> no, but before I spend more money (this is getting expensive = :-), >>>>>>> does it explain how to write a loadable module that needs to to = talk >>>>>>> to a spibus? >>>>>>=20 >>>>>> I don't think it does. >>>>>>=20 >>>>>> spibus is very simple, there is one interface call >>>>>>=20 >>>>>> SPIBUS_TRANSFER(device_t, device_t, strcut spi_command); >>>>>>=20 >>>>>=20 >>>>> chicken and egg issue :-), what device_t dev should I use? >>>>> it must point to the spibus =E2=80=A6 >>>>=20 >>>> Your device will be a child of the spibus, and it is the bus that >>>=20 >>> it=E2=80=99s the =E2=80=98child of=E2=80=99 that I have problems. = this will be a loadable module, so >>> it will have to tell the parent that he is no longer an orphan :-) >>=20 >> When you declare the module, one of the parameters are what bus to >> attach to. >>=20 >> If you are using FDT in your system, then you=E2=80=99ll put your = device into the >> FDT tree below the spibus to create the device_t node in the tree. = When >> your module is loaded, its probe routine will be called, and you can >> match based on the compatible string given in the FDT. >>=20 >=20 > I was afraid of that :-), this FDT stuff is new to me, and so far I = was successful > in adding a gpio/led, but grep has not found any spibus. > any chance for a small template/example ? rpi or bbb would help! I=E2=80=99m afraid I don=E2=80=99t have one handy. Warner --Apple-Mail=_98F1A014-E68F-4099-80B6-1FA653B89D02 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVMRUwAAoJEGwc0Sh9sBEAuykP/24Mm7W0yqLNB07a33Q+J5pv aCDy7gVStKYlXRsm7K4RAATNTMC3Argjn080ZkS0r4nr8AUgQ4vhi24ihPmzc2u0 kaUAW36/n/potPAqHm+sheSqAi0g2BuztxmfEhcwj6YESVoNVlkh2O0q4hIIajT6 SYVb1E7CqMB8AmIDYsUYBz9SYp311xHNgzOe1f/TTrXXGoYtjiZSpATX1ojsvegE klzNgG1/sNwG7pHI7khlNNtGFCa1PosgeNAy6M0jxwYc9LiEpJi1W4HIHB7FBgXn bM9inMMNAcYk52sqjV/yRP71yZZ7GZr5xJqYf8MLEqKzao/U9T4gE0LuCI0eDnZ3 eOMLPPBChy6QqMTnCjP/6M/990BxG08R1XBoIs5SjYyyoboVcCyrfK3V7XJcCMBP H8WG3fcPtdS6/Qxp+NgJyRE2CU3S00RlJDySowMFC7t5YvZ6Bc806tZLB4qtJujV 73g4fXluY31T7T/Fhd1tpbf5f0Xd7W8p02jIPmVuW0UwY35xfaxx6ifqIS3CORVd zfMmcnPo6wORAJGQZcXb6GvRbUlFaejMOE05PY4Ba8M46tKrF20egjmek8Gpt09A bbT9mb0veeQI9bMMlqmfj4WxHzOR0LH400wgKRFnmXoTMSIc+Vy7zLkyyCJPzB+0 cBKqfOVHcZNrTu2SY1+H =mVgl -----END PGP SIGNATURE----- --Apple-Mail=_98F1A014-E68F-4099-80B6-1FA653B89D02--