Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2018 12:09:26 +0200
From:      Emmanuel Vadot <manu@bidouilliste.com>
To:        Greg V <greg@unrelenting.technology>
Cc:        Kyle Evans <kevans@freebsd.org>, "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: Allwinner dtb overlays on CURRENT. Also, flashrom SPI!
Message-ID:  <20180726120926.9648d6b691ab7be7cbb37653@bidouilliste.com>
In-Reply-To: <1532598504.2425.0@hraggstad.unrelenting.technology>
References:  <1532548163.59286.0@hraggstad.unrelenting.technology> <CACNAnaGLPgEs0MVMBbit78WGDCOMxxAcTXBYFZgamPZBmf5p3g@mail.gmail.com> <20180725234000.e917566724f997319f8fe2fd@bidouilliste.com> <1532598504.2425.0@hraggstad.unrelenting.technology>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 26 Jul 2018 12:48:24 +0300
Greg V <greg@unrelenting.technology> wrote:

>=20
>=20
> On Thu, Jul 26, 2018 at 12:40 AM, Emmanuel Vadot=20
> <manu@bidouilliste.com> wrote:
> > On Wed, 25 Jul 2018 15:14:29 -0500
> > Kyle Evans <kevans@freebsd.org> wrote:
> >=20
> >>  On Wed, Jul 25, 2018 at 2:49 PM, Greg V=20
> >> <greg@unrelenting.technology> wrote:
> >>  > Hi,
> >>  >
> >>  > One thing I have noticed with CURRENT on an Orange Pi PC: since=20
> >> we're using
> >>  > device trees imported from Linux, some drivers are not accessible=20
> >> out of the
> >>  > box.
> >>  >
> >>  > So I wrote a couple overlays:
> >>  >
> >>  > Thermal sensor: https://github.com/freebsd/freebsd/pull/162
> >>  >
> >=20
> >  This is wrong bindings. Yes I know that it's working with our driver
> > for ths but this is wrong.
> >  1) ths module isn't in ahb but apb.
> >  2) We need nvmem framework to get the sensor calibration data, please
> > see https://reviews.freebsd.org/D16419
>=20
> I guess it's good to have a framework, but the existing driver=20
> communicates with aw_sid directly (aw_sid_read_tscalib), and that seems=20
> to work fine?

 Yeah and this is really gross.
 Also the bindings aren't upstreamed and can't be without nvmem-cells.

> >>  > SPI: https://github.com/freebsd/freebsd/pull/166
> >=20
> >  What is the point of the spigen interface ?
> >  If aw_spi is working on H3 (I haven't check but it should), if you
> > have a good dtb with the spi flash described you can use it directly.
>=20
> Uhhh I'm surprised you don't know what's the point of spigen?
> The point is raw *userspace* access.

 I'm surprised that you thing I don't know what spigen is :)

 If your DTB expose the spi node and the spi flash node when devmatch
start you will have :
Starting devd.
Autoloading module: aw_spi.ko
aw_spi0: <Allwinner SPI> mem 0x1c68000-0x1c68fff irq 27 on simplebus0
spibus0: <OFW SPI bus> on aw_spi0
spibus0: <unknown card> at cs 0 mode 0
Autoloading module: mx25l.ko
mx25l0: <M25Pxx Flash Family> at cs 0 mode 0 on spibus0
mx25l0: device type w25q128, size 16384K in 256 sectors of 64K, erase
size 4K

 This will create a /dev/flash/spi0 where you can dd u-boot directly on
it.

> Like /dev/spidevX.Y on Linux, spigen gives us /dev/spigenX.Y.
> As you can see below, I wrote spigen support for flashrom :)
>=20
> We already have a spigen dtb overlay for the Raspberry Pi.
> So now it's possible to use the same userspace applications that talks=20
> SPI directly (like flashrom) on both RPi and H3!

 Having a spigen for things other than flash is good, for flash I don't
see the point.
=20
> >>  > But not everyone would figure out how to make and even just use=20
> >> overlays?
> >>  >
> >>  > (if anyone is wondering: place them into /boot/dtb/overlays and=20
> >> add a list
> >>  > of them (filenames including extension) to /boot/loader.conf like=20
> >> so:
> >>  >=20
> >> fdt_overlays=3D"sun8i-h3-sid.dtbo,sun8i-h3-ts.dtbo,sun8i-h3-spi.dtbo"=
=20
> >> ? and
> >>  > reboot)
> >>=20
> >>  Just FYI- omitting the extension should also work fine here. If it
> >>  doesn't, that's another bug on its own. =3D)
> >>=20
> >>  > Can someone commit these overlays / add more for other SoCs maybe?
> >>=20
> >>  I think manu was working on some thermal sensor stuff earlier=20
> >> (though
> >>  my memory may be wrong), so we'll see what he says.
> >=20
> >  I am, currently upstreaming bindings/dts changes.
> >=20
> >>  > P.S. I also wrote spigen support for flashrom:
> >>  > https://github.com/flashrom/flashrom/pull/53
> >>  > With this, I can flash and verify a Winbond W25Q32.V flash chip=20
> >> from my
> >>  > Orange Pi! :)


--=20
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180726120926.9648d6b691ab7be7cbb37653>