From owner-freebsd-arm@freebsd.org Mon Dec 30 04:40:30 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 7F8AE1D4A1E for ; Mon, 30 Dec 2019 04:40:30 +0000 (UTC) (envelope-from gdotten@gmail.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (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 47mPqx4htSz4X9W; Mon, 30 Dec 2019 04:40:29 +0000 (UTC) (envelope-from gdotten@gmail.com) Received: by mail-qt1-x82f.google.com with SMTP id e12so28991500qto.2; Sun, 29 Dec 2019 20:40:29 -0800 (PST) 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=0JjF4OQEyqKqHS0C7RShwNS3lbnsVqo8jRtmEVN6rEw=; b=qgAUTYZiMLBC1Ap8/qOZaIZK3J0tXNtZEVX6MZT8QXVn1VMYJilwZGkb3UYW2akrHq urWrE8qMT/tZjQbFsRPKBoTbMfFl66oiAzkyAuEoPxLpSWHbDvCFvmpSPHw4x2GhtHOx BXg+GW029tHb9Rtn/nLGwIQ3Vw44p8CqmgTRXeE26F4JDnFuV3idkdg5cXZ49GqHry8R xgJAiDWc2QyV5T5d+oDLBx3GNRjfpgwxEMDrI9YUpdt2NAxCuJnlnVT1sjNJrBX1GVAx UeIUOnm9pK/j8BLDyRX6qUw2B6QZPukVuhjIZqzYXd+gEOdAK/RxzqOQK0W5mreVHoKa KRtA== 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=0JjF4OQEyqKqHS0C7RShwNS3lbnsVqo8jRtmEVN6rEw=; b=IAi4aqlCNszvzsp6wYzFjJ04aLLeAN+JkuMSKVUkQUKFYN/1Xlz02PNGULbouhTZDR bf9WpYkXRXevmZSzLIYUWJrWnU2sEDRHrkOMtI6NPFDQMDkz46t8FUq+cz8rVt56HOLz S4qPtTZTRmieUYtKkZSLlebmYo/RA11BGxyt9pc18+VHYysh65J3tA0FvhDf9D1d9xI+ sqKBKTwM754H2ZqTmsStTVLgShHLe/k2bVQ3IJL4TvjdLXA/8CKR4AFdhFCYXBzEZHRH /NQ8JgEaRS+C7yhT3/kmn0I6Vn1zfsc4loxVSwCs2VsrCYfN/zr0JNT7oImgT61dB+t9 Bt+w== X-Gm-Message-State: APjAAAVaf+XE/BlXX+gq86tByxkEXWCvDvO7yBHXKpYFm07ffmDX5whk 6gm2NKojy3aq8zyzheUxQA27wjG8oIsabX7vLHKlH+J3 X-Google-Smtp-Source: APXvYqwf/SAkHoy60p/8lD2SeVHhIg7l7AyFTqj7F7QFz17KRsVDh+0InKHcnxLV3AgxFir5aBbyTTyIToW2sRjr5X4= X-Received: by 2002:aed:2344:: with SMTP id i4mr48485086qtc.136.1577680828203; Sun, 29 Dec 2019 20:40:28 -0800 (PST) MIME-Version: 1.0 References: <20191228161726.9efb08df5b69eaa0a0ff478f@bidouilliste.com> In-Reply-To: <20191228161726.9efb08df5b69eaa0a0ff478f@bidouilliste.com> From: Gary Otten Date: Sun, 29 Dec 2019 23:40:19 -0500 Message-ID: Subject: Re: SPI support for A64-OLinuXino board Allwinner A64 processor To: Emmanuel Vadot Cc: freebsd-arm@freebsd.org, ian@freebsd.org X-Rspamd-Queue-Id: 47mPqx4htSz4X9W X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=qgAUTYZi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of gdotten@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) smtp.mailfrom=gdotten@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; 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)[3]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.00)[ip: (-9.31), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[f.2.8.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]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Mon, 30 Dec 2019 04:40:30 -0000 Thanks, Ian Lepore mentioned this too, spigen wasn't loaded. I have now loaded spigen. The driver appears to be working, but I am not seeing any output. I can toggle pins PC0,PC1,PC2, PC3 with gpioctl, but I don't get anything with spi. I also had another odd behavior with BANK E. not having any output, using gpoictl, I was not able to get any pin on Bank E to toggle. I did turn on the voltage regulator as suggested. I wonder if FreeBSD is properly setting the configuration registers for each port/pin of the the A64. Basically letting the A64 know to use alt function or general gpio in/out in the proper way for each pin, maybe some of the (default?) settings for the more popular pine boards work, but don't work correctly for the Olimex A64 board, or maybe there is some setting in the overlays that I am overlooking that need to be set to use an alt function or gpio in/out to get the pins to function properly. If in the overlay I have spi0 enabled, should I still be able to toggle the pins with gpioctl? Thanks for the help. My diagnostics ****************************************** root@:/dev # spi -i Device name: /dev/spigen0.0 Device mode: 2 Device speed: 500000 root@:/dev # spi -d r -m 0 -C '9F 00' -v -c 2 Binary output of 2 bytes 2 command bytes and 2 data bytes read from SPI device | 0 1 2 3 4 5 6 7 8 9 A B C D E F | | 0 | 00 00 00 00 | .... | I On Sat, Dec 28, 2019 at 10:44 AM Emmanuel Vadot wrote: > On Wed, 25 Dec 2019 19:12:28 -0500 > Gary Otten wrote: > > > Thanks, I have created the following overlay and tried a variety of > other > > things but I haven't been able to get spigen0.0 to appear in /dev. > > > > > > > > /* $FreeBSD$ */ > > /dts-v1/; > > /plugin/; > > > > / { > > compatible = "allwinner,sun50i-a64"; > > }; > > > > &{/soc/spi@1c68000} { > > > > status = "okay"; > > > > spigen0: spigen0 { > > compatible = "freebsd,spigen"; > > reg = <0>; > > spi-max-frequency = <500000>; > > status = "okay"; > > }; > > > > }; > > > > > > > > Some diagnostics > > > > ------------------------------------------------------- > > On Boot > > > > Loading DTB overlays: 'sun50i-a64-spi-spidev' > > /boot/dtb/overlays/sun50i-a64-spi-spidev.dtbo size=0x15c > > applying DTB overlay '/boot/dtb/overlays/sun50i-a64-spi-spidev.dtbo' > > .. > > .... > > ..... > > > > Autoloading module: aw_spi.ko > > aw_spi0: mem 0x1c68000-0x1c68fff irq 29 on simplebus0 > > spibus0: on aw_spi0 > > spibus0: at cs 0 mode 0 > > > > > > ------------------------------------------------------- > > root@:/boot/dtb/overlays # kldstat > > Id Refs Address Size Name > > 1 5 0xffff000000000000 144dda8 kernel > > 2 1 0xffff000054c00000 41000 aw_spi.ko > > > > ------------------------------------------------------- > > root@:/boot/dtb/overlays # devinfo > > .. > > ... > > aw_spi0 > > spibus0 > > > > ------------------------------------------------------- > > root@:/boot/dtb/overlays # devinfo > > > > .... > > ...... > > Node 0x2f60: spi@1c68000 > > Node 0x309c: spigen0 > > _______________________________________________ > > freebsd-arm@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" > > Hi Gary, > > You overlay worked for me on the pine64-lts. Here is what I did : > - Use https://github.com/evadot/freebsd/commits/aw_spigen > - aw_spi is autoloaded via devmatch > - kldload spigen (it's not in GENERIC for arm64, maybe we should add it > or do some devmatch magic) > - root@pine64-lts:~ # spi -i > Device name: /dev/spigen0.0 > Device mode: 0 > Device speed: 500000 > root@pine64-lts:~ # spi -d r -m 0 -C '9F 00' -v -c 2 > Binary output of 2 bytes > 2 command bytes and 2 data bytes read from SPI device > | 0 1 2 3 4 5 6 7 8 9 A B C D E F > | | 0 | 00 ef 40 18 | > ..@. | > > Maybe you just forgot to load spigen ? > > -- > Emmanuel Vadot >