From owner-freebsd-arch@FreeBSD.ORG Mon Jun 24 14:52:22 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D9C715F7 for ; Mon, 24 Jun 2013 14:52:22 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ie0-x233.google.com (mail-ie0-x233.google.com [IPv6:2607:f8b0:4001:c03::233]) by mx1.freebsd.org (Postfix) with ESMTP id AA2131C09 for ; Mon, 24 Jun 2013 14:52:22 +0000 (UTC) Received: by mail-ie0-f179.google.com with SMTP id c10so25249875ieb.10 for ; Mon, 24 Jun 2013 07:52:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=y0/Xs9Aqu4X96QrhSxSUEOr6TSLY8vV81etXPjpDclM=; b=kA9TXQDKUucP9Nt66Mx4xl6ksE3WA+y40eMm0QxZzbPU+Xz1puaRQIOcvkop33cOZ3 G1rgzzp6GQoYO9N/7xgIAPY6P4oNaXFhGsZocqUSQjOsH3docpQbxOAdTnIWCPQgSo4d TX/HXYZOaWmgeQznaGBjWg7H5tkomrWNKhgXmvdxAXYLt5XJE0A7v6ymcD9mdum3jegO UCWQmw23393lIkd1Pc/Mn4ERb+ob/jxRGvsRSm2JtSp4WSzUIuJv7H+2+j4/cKmHIDAv yWmGJOoIPL4qewqM6CGFCe24/4MKb04BU2i7K7ULEtni0F5DkMZ+uy0TXtO+34SqgAxj gidg== X-Received: by 10.50.112.5 with SMTP id im5mr5905752igb.23.1372085542331; Mon, 24 Jun 2013 07:52:22 -0700 (PDT) Received: from [10.0.0.53] (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id kj5sm396200igb.7.2013.06.24.07.52.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Jun 2013 07:52:21 -0700 (PDT) Sender: Warner Losh Subject: Re: FDT Support for GPIO (gpiobus and friends) Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <04AEF097-025D-4B3F-A345-98878AE4A822@ad.com.br> Date: Mon, 24 Jun 2013 08:52:16 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <1142ABEB-7FDA-4CFE-9D12-F8FD2D4C85D6@bsdimp.com> References: <20121205.060056.592894859995638978.hrs@allbsd.org> <04AEF097-025D-4B3F-A345-98878AE4A822@ad.com.br> To: Luiz Otavio O Souza X-Mailer: Apple Mail (2.1085) X-Gm-Message-State: ALoCoQkz1Z8t8yMUNNno4PiXLFmkW4/AzORIhA3Kkp9rCWq/3MLb38DUgruiPS2750QnMiPb4UHv Cc: freebsd-arch@FreeBSD.org, Luiz Otavio O Souza X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 14:52:23 -0000 I'm loving this patch, mostly. But I don't see where the ivar gets freed... Perhaps this is because we = dont' support detaching GPIOs? Warner On Jun 24, 2013, at 6:20 AM, Luiz Otavio O Souza wrote: > On Jun 21, 2013, at 6:05 PM, Luiz Otavio O Souza wrote: >=20 > +int > +gpiobus_fdt_add_child(device_t bus, phandle_t childnode) > +{ > [...] > + /* Add newbus device for the child. */ > + child =3D device_add_child(bus, NULL, -1); >=20 >=20 > This is obviously wrong.. it should only probe the specified type of = drivers... >=20 > The attached patch fix this problem. Now i can have things like: >=20 > Index: bcm2835-rpi-b.dts > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- bcm2835-rpi-b.dts (revision 251700) > +++ bcm2835-rpi-b.dts (working copy) > @@ -518,7 +518,7 @@ >=20 > ok { > label =3D "ok"; > - gpios =3D <&gpio 16 1>; > + gpios =3D <&gpio 16 2 0>; >=20 > /* Don't change this - it configures > * how the led driver determines if > @@ -529,8 +529,24 @@ > /* This is the real default state. */ > linux,default-trigger =3D "default-on"; > }; > + > + blue { > + label =3D "blue"; > + gpios =3D <&sr1 3 2 0>; > + }; > }; >=20 > + shift-registers { > + compatible =3D "gpio-shiftregister"; > + > + sr1: sr1 { > + gpios =3D <&gpio 17 2 0 > + &gpio 21 2 0 > + &gpio 22 2 0>; > + gpio-controller; > + }; > + }; > + > power: regulator { > compatible =3D "broadcom,bcm2835-power-mgr", = "broadcom,bcm2708-power-mgr", "simple-bus"; > #address-cells =3D <1>; >=20 >=20 > And everything attaches correctly: >=20 > gpio0: mem 0x20200000-0x202000af irq = 57,59,58,60 on simplebus0 > gpio0: read-only pins: 46,47,48,49,50,51,52,53. > gpio0: reserved pins: 48,49,50,51,52,53. > gpioc0: on gpio0 > gpiobus0: on gpio0 > gpioled0: at pin(s) 16 on gpiobus0 > gpioshiftreg0: at pin(s) 17,21-22 on = gpiobus0 > gpioc1: on gpioshiftreg0 > gpiobus1: on gpioshiftreg0 > gpioled1: at pin(s) 3 on gpiobus1 >=20 >=20 > Regards, > Luiz >=20 >=20 > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to = "freebsd-arch-unsubscribe@freebsd.org"