From owner-freebsd-arm@freebsd.org Thu Dec 19 17:29:24 2019 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 154021E6057 for ; Thu, 19 Dec 2019 17:29:24 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47dzQC4njVz3QHl for ; Thu, 19 Dec 2019 17:29:23 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1576776562; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=Xz8OW8gzSjvsuoGcaX4fF3oKC850KLck4b0SmAGFjet1cDq9HrOP7b1+w1QsDDI2KaswpNR+IlrDR 24KcBXqrz3a0/f8DJyoXkG2LHljO55aBpt/tyA7QWPWYpXVEKFlN5nGztosEqwfeHQheGGFIg1uHKr U6xNI2fX/2QE5q+e+yoh3lZJI38XoPDPARiHSL1EuOtb9iQ+unvcj3/a0f6SPswthYU62h1J44cEsi NEPTbtYEbe0+DkibZI+8m7/V2LwTXKAiENzL+wfQyw0D1qJas7N/UcJw5oSwwVRmbVbhd69ky+Kg9l uwvJnxbHYmXpXo5w16EFgoSKGYEb18g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=0h5jJJ7qWiz4vgZD424xsR9d5ixGjdtUQRYHFLXMDi4=; b=kxlWhX0cP+iTDZ+1uYKmP8/AWEQRXxV3TQHy4dwgRYhayT/ytoANI3CRVkcB2we7dUpCx46wQFNv0 tL2EqkhQU+wMagqaIEsRSZOBO9RgvW2eHPTN1qjTmkPKhnAZWCxk3UVQM3x7xRNxHyloty6uE058pb BACrqTETKJJEmvWqvwBFzKZ2CZZJc5Hs03I3s9Uprdz4OrOBi1IH6s98tzziJ7f0Eq46zicP4cUdz7 GApM9xjhKNCaMPBWJyfciTBGQiK8llpyXaQJ1s+l4E/c8EaWpC8Le4Gck+KC0zP5yCEW5AEbiq2lTA 0Shm6732gINufggBmPesHjc1/3Vslqw== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=0h5jJJ7qWiz4vgZD424xsR9d5ixGjdtUQRYHFLXMDi4=; b=lhV30irr3J0PcmazNCORXH6ElKAafH9hbo3zH8SkEs79MzyG7UlOIhOJS/e/LY76Za2WWrYXI+Tlh D9mC1CWYnROX8NZiKM3Pq2djuJ/QALM9ruIy8aQjVtQ+a8xTKPJvfRY+6TOVCwdjyliLR048p3UATx DOWZqm6l0CuLp8GTKu8GfAJ7b1ByffISNv7mnKQwL3dSiXWF+33Q+N2uFeDtL2+MvD7sFL1pL64EMg 1Y6Zmk7cI0Mu5m+UcBTPbn+1pGvsYueStyYeJ75htGDc9vpsR8FNBavbiWLyJ2CLUqRacljPxKANX9 +88ieDhrI/VX6FPs9AJ7yvQdmXkUlrA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 15827699-2285-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 15827699-2285-11ea-b80c-052b4a66b6b2; Thu, 19 Dec 2019 17:29:20 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xBJHTGNG061579; Thu, 19 Dec 2019 10:29:16 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <78c7d14bb681f8bca11525bf61cf871c6e89c235.camel@freebsd.org> Subject: Re: gpioiic FDT overlays for sun8i-h3 From: Ian Lepore To: Nick Kostirya Cc: Milan Obuch , freebsd-arm@freebsd.org Date: Thu, 19 Dec 2019 10:29:16 -0700 In-Reply-To: <20191219095935.6fed7431@i11.co> References: <20191128152901.39dbeb4d@thinkpad> <20191128062149.577be86eb7dc15ae5805f31a@bidouilliste.com> <20191129153754.28fb5763@thinkpad> <20191129144316.739c8664@zeta.dino.sk> <20191129155431.05d4e14f@thinkpad> <20191129150944.67a2b723a6724c46f7559f96@bidouilliste.com> <0ce78262af1dd3b404b9a85a780933d7e11f008e.camel@freebsd.org> <20191129201244.0bc85b09@thinkpad> <20191219095935.6fed7431@i11.co> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47dzQC4njVz3QHl X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; NEURAL_HAM_LONG(-0.99)[-0.987,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2019 17:29:24 -0000 On Thu, 2019-12-19 at 09:59 +0200, Nick Kostirya wrote: > On Mon, 02 Dec 2019 17:04:58 -0700 > Ian Lepore wrote: > > > > > > > > Well, it did turn complicated, but I got it all worked out. > > > > Are you building an image from source code, or using a downloaded > > snapshot or release image, or what? > > > > If you are building from source, apply the attached patch to your > > source tree and rebuild the kernel. > > > > If you are using a prebuilt image, then I'll get these changes > > merged > > to the stable-12 tree this week, and the next stable-12 snapshot > > images > > will include what you need. I think those images get built every > > Thursday. > > > > -- Ian > > > It doesn't work. > > I missed something. But what it is? > > > I use > FreeBSD-12.1-STABLE-arm-armv7-GENERICSD-20191212-r355610.img > > > > grep gpioiic /boot/loader.conf > > gpioiic_load="YES" > fdt_overlays="sun8i-h3-sid,sun8i-h3-ths,sun8i-h3-opp,sun8i-h3- > i2c0,sun8i-h3-gpioiic" > > > I did make /boot/dtb/overlays/sun8i-h3-gpioiic.dtbo from > > > cat sun8i-h3-gpioiic.dtso > > /dts-v1/; > /plugin/; > > / { > compatible = "allwinner,sun8i-h3"; > }; > > &{/soc/pinctrl@1c20800} { > gpioiic@0 { > compatible = "allwinner,sun8i-h3,gpioiic"; > scl = <0>; /* GPIO pin 00 (PA0) */ > sda = <2>; /* GPIO pin 02 (PA2) */ > }; > }; > > I see gpioiic in ofwdump: > > ofwdump -a | grep -B 1 gpio > > Node 0x1b7c: pinctrl@1c20800 > Node 0x1c74: gpioiic@0 > > > But I do not see in /dev and devinfo > > :-( > > Nick. The gpioiic node needs to be defined at the root of the devicetree, not under the pinctrl node. Assuming that all pins are configured as gpios by default (they are on most SOCs) you probably don't need a pinctrl node for them at all. If you do, someone who knows allwinner stuff better than me would have to provide an example of that part. To add the gpioiic driver node using pins 0 and 2 like your example, I think it should be just this: /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; }; &{/} { gpioiic@0 { compatible = "i2c-gpio"; scl-gpios = <&pio 0 0 GPIO_ACTIVE_HIGH>; sdl-gpios = <&pio 0 2 GPIO_ACTIVE_HIGH>; }; That should be enough to attach the i2c bus and the iic driver which will give you a /dev/iic# node for userland access to the bus. If you want to add slave devices that have kernel drivers, they get added as child nodes within gpioiic@0, like this: &{/} { gpioiic@0 { compatible = "i2c-gpio"; scl-gpios = <&pio 0 0 GPIO_ACTIVE_HIGH>; sdl-gpios = <&pio 0 2 GPIO_ACTIVE_HIGH>; eeprom@50 { compatible = "atmel,24c512"; reg = <0x50>; }; rtc@51 { compatible="nxp,pcf2127"; reg = <0x51>; }; }; }; -- Ian