Attaching maxrtc(4) to iic

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Attaching maxrtc(4) to iic

Fred
Hi misc@

I'm trying to attach an adafruit DS1307 RTC to my Beagle Bone Black.

I have set:

gpioctl gpio0 attach gpioiic 19 0x3 1

in /etc/rc.securelevel which shows up in dmesg[0] as:

gpioiic0 at gpio0: SDA[20] pull-up, SCL[19]
iic2 at gpioiic0

I am correcting in thinking I need to add an:

maxrtc* at iic?

to sys/arch/armv7/conf/GENERIC and build a new kernel?

Fred

[0] dmesg:
OpenBSD 6.7-current (GENERIC) #299: Sun May 24 18:25:45 MDT 2020
     [hidden email]:/usr/src/sys/arch/armv7/compile/GENERIC
real mem  = 477491200 (455MB)
avail mem = 457682944 (436MB)
random: good seed from bootblocks
mainbus0 at root: TI AM335x BeagleBone Black
cpu0 at mainbus0 mpidr 0: ARM Cortex-A8 r3p2
cpu0: 32KB 64b/line 4-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 256KB 64b/line 8-way L2 cache
omap0 at mainbus0
prcm0 at omap0 rev 0.2
dmtimer0 at omap0 rev 3.1
dmtimer1 at omap0 rev 3.1
simplebus0 at mainbus0: "ocp"
intc0 at simplebus0 rev 5.0
omsysc0 at simplebus0: "target-module"
simplebus1 at simplebus0: "interconnect"
"wkup_m3" at simplebus1 not configured
simplebus2 at simplebus1: "segment"
simplebus3 at simplebus1: "segment"
simplebus4 at simplebus1: "segment"
omsysc1 at simplebus4: "target-module"
simplebus5 at omsysc1: "prcm"
omcm0 at simplebus5: "per-cm"
omclock0 at omcm0: "l4ls-clkctrl"
omclock1 at omcm0: "l3s-clkctrl"
omclock2 at omcm0: "l3-clkctrl"
omclock3 at omcm0: "l4hs-clkctrl"
omclock4 at omcm0: "pruss-ocp-clkctrl"
omclock5 at omcm0: "cpsw-125mhz-clkctrl"
omclock6 at omcm0: "lcdc-clkctrl"
omclock7 at omcm0: "clk-24mhz-clkctrl"
omcm1 at simplebus5: "wkup-cm"
omclock8 at omcm1: "l4-wkup-clkctrl"
omclock9 at omcm1: "l3-aon-clkctrl"
omclock10 at omcm1: "l4-wkup-aon-clkctrl"
omcm2 at simplebus5: "mpu-cm"
omclock11 at omcm2: "mpu-clkctrl"
omcm3 at simplebus5: "l4-rtc-cm"
omclock12 at omcm3: "l4-rtc-clkctrl"
omcm4 at simplebus5: "gfx-l3-cm"
omclock13 at omcm4: "gfx-l3-clkctrl"
omcm5 at simplebus5: "l4-cefuse-cm"
omclock14 at omcm5: "l4-cefuse-clkctrl"
"prm" at simplebus5 not configured
"prm" at simplebus5 not configured
"prm" at simplebus5 not configured
"prm" at simplebus5 not configured
omsysc2 at simplebus4: "target-module"
simplebus6 at omsysc2: "scm"
syscon0 at simplebus6: "scm_conf"
pinctrl0 at simplebus6
"control" at simplebus6 not configured
"wkup_m3_ipc" at simplebus6 not configured
"dma-router" at simplebus6 not configured
omsysc3 at simplebus4: "target-module"
omgpio0 at omsysc3: rev 0.1
gpio0 at omgpio0: 32 pins
omsysc4 at simplebus4: "target-module"
com0 at omsysc4: ti16750, 64 byte fifo
com0: console
omsysc5 at simplebus4: "target-module"
tiiic0 at omsysc5 rev 0.11
iic0 at tiiic0
"ti,tps65217" at iic0 addr 0x24 not configured
"atmel,24c256" at iic0 addr 0x50 not configured
nxphdmi0 at iic0 addr 0x70: rev 0x0301
nxphdmi0: no display detected
omsysc6 at simplebus4: "target-module"
omsysc7 at simplebus4: "target-module"
"timer" at omsysc7 not configured
omsysc8 at simplebus4: "target-module"
omdog0 at omsysc8 rev 0.1
omsysc9 at simplebus4: "target-module"
"rtc" at omsysc9 not configured
simplebus7 at simplebus0: "interconnect"
simplebus8 at simplebus7: "segment"
omsysc10 at simplebus8: "target-module"
omsysc11 at simplebus8: "target-module"
omsysc12 at simplebus8: "target-module"
omsysc13 at simplebus8: "target-module"
omsysc14 at simplebus8: "target-module"
"mcasp" at omsysc14 not configured
omsysc15 at simplebus8: "target-module"
omsysc16 at simplebus8: "target-module"
"timer" at omsysc16 not configured
omsysc17 at simplebus8: "target-module"
"timer" at omsysc17 not configured
omsysc18 at simplebus8: "target-module"
"timer" at omsysc18 not configured
omsysc19 at simplebus8: "target-module"
"timer" at omsysc19 not configured
omsysc20 at simplebus8: "target-module"
"timer" at omsysc20 not configured
omsysc21 at simplebus8: "target-module"
"timer" at omsysc21 not configured
omsysc22 at simplebus8: "target-module"
omgpio1 at omsysc22: rev 0.1
gpio1 at omgpio1: 32 pins
omsysc23 at simplebus8: "target-module"
ommmc0 at omsysc23
sdmmc0 at ommmc0: 4-bit, sd high-speed, mmc high-speed
omsysc24 at simplebus8: "target-module"
omsysc25 at simplebus8: "target-module"
"mailbox" at omsysc25 not configured
omsysc26 at simplebus8: "target-module"
"spinlock" at omsysc26 not configured
simplebus9 at simplebus7: "segment"
omsysc27 at simplebus9: "target-module"
tiiic1 at omsysc27 rev 0.11
iic1 at tiiic1
"atmel,24c256" at iic1 addr 0x54 not configured
"atmel,24c256" at iic1 addr 0x55 not configured
"atmel,24c256" at iic1 addr 0x56 not configured
"atmel,24c256" at iic1 addr 0x57 not configured
omsysc28 at simplebus9: "target-module"
omsysc29 at simplebus9: "target-module"
omsysc30 at simplebus9: "target-module"
omsysc31 at simplebus9: "target-module"
omsysc32 at simplebus9: "target-module"
omgpio2 at omsysc32: rev 0.1
gpio2 at omgpio2: 32 pins
omsysc33 at simplebus9: "target-module"
omgpio3 at omsysc33: rev 0.1
gpio3 at omgpio3: 32 pins
omsysc34 at simplebus9: "target-module"
omsysc35 at simplebus9: "target-module"
omsysc36 at simplebus9: "target-module"
ommmc1 at omsysc36
sdmmc1 at ommmc1: 8-bit
simplebus10 at simplebus7: "segment"
simplebus11 at simplebus7: "segment"
omsysc37 at simplebus11: "target-module"
omsysc38 at simplebus11: "target-module"
omsysc39 at simplebus11: "target-module"
omsysc40 at simplebus11: "target-module"
amdisplay0 at omsysc40
amdisplay0: no display attached.
omsysc41 at simplebus11: "target-module"
omrng0 at omsysc41
simplebus12 at simplebus0: "interconnect"
simplebus13 at simplebus12: "segment"
simplebus14 at simplebus0: "interconnect"
simplebus15 at simplebus14: "segment"
omsysc42 at simplebus15: "target-module"
cpsw0 at omsysc42: version 1.12 (0), address c8:a0:30:ab:cd:81
ukphy0 at cpsw0 phy 0: Generic IEEE 802.3u media interface, rev. 1: OUI
0x0001f0, model 0x000f
simplebus16 at simplebus0: "interconnect"
simplebus17 at simplebus16: "segment"
"edma" at simplebus0 not configured
"tptc" at simplebus0 not configured
"tptc" at simplebus0 not configured
"tptc" at simplebus0 not configured
omsysc43 at simplebus0: "target-module"
ommmc2 at omsysc43
sdmmc2 at ommmc2: 1-bit
omsysc44 at simplebus0: "target-module"
"usb-phy" at omsysc44 not configured
"usb" at omsysc44 not configured
"usb-phy" at omsysc44 not configured
"usb" at omsysc44 not configured
"dma-controller" at omsysc44 not configured
"sram" at simplebus0 not configured
"emif" at simplebus0 not configured
omsysc45 at simplebus0: "target-module"
"sham" at omsysc45 not configured
omsysc46 at simplebus0: "target-module"
"aes" at omsysc46 not configured
sdmmc2: can't enable card
scsibus0 at sdmmc1: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, MMC02G, 0000> removable
sd0: 1832MB, 512 bytes/sector, 3751936 sectors
scsibus1 at sdmmc0: 2 targets, initiator 0
sd1 at scsibus1 targ 1 lun 0: <SD/MMC, SU08G, 0080> removable
sd1: 7580MB, 512 bytes/sector, 15523840 sectors
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on sd1a (df088aa460d72037.a) swap on sd1b dump on sd1b
WARNING: CHECK AND RESET THE DATE!
gpioiic0 at gpio0: SDA[20] pull-up, SCL[19]
iic2 at gpioiic0

Reply | Threaded
Open this post in threaded view
|

Re: Attaching maxrtc(4) to iic

Mark Kettenis
> From: Fred <[hidden email]>
> Date: Sat, 6 Jun 2020 14:57:39 +0100
>
> Hi misc@
>
> I'm trying to attach an adafruit DS1307 RTC to my Beagle Bone Black.
>
> I have set:
>
> gpioctl gpio0 attach gpioiic 19 0x3 1
>
> in /etc/rc.securelevel which shows up in dmesg[0] as:
>
> gpioiic0 at gpio0: SDA[20] pull-up, SCL[19]
> iic2 at gpioiic0
>
> I am correcting in thinking I need to add an:
>
> maxrtc* at iic?
>
> to sys/arch/armv7/conf/GENERIC and build a new kernel?

maxrtc(4) is already enabled, but adding a GPIO btibang i2c bus this
way is not going to make it show up.

The BBB has a couple of hardware i2c controllers.  The pin numbers
above suggest that you actually connected to the pins connected to one
of these i2c controllers.  To enable the clock, you need to enable the
right i2c controller in the device tree and add the RTC device in
there.  The "proper" way to do that is to add a device tree overlay
for the RTC.  However, OpenBSD can't load device tree overlays, so the
overlay has to be loaded by the firmware.  This works on the Raspberry
Pi, but I'm not sure if U-Boot for the BBB can do it.

Alternatively you build your own device tree for the BBB with the i2c
controller enabled and the RTC added and copy it to the SD-card that
you're booting from.

Cheers,

Mark

> [0] dmesg:
> OpenBSD 6.7-current (GENERIC) #299: Sun May 24 18:25:45 MDT 2020
>      [hidden email]:/usr/src/sys/arch/armv7/compile/GENERIC
> real mem  = 477491200 (455MB)
> avail mem = 457682944 (436MB)
> random: good seed from bootblocks
> mainbus0 at root: TI AM335x BeagleBone Black
> cpu0 at mainbus0 mpidr 0: ARM Cortex-A8 r3p2
> cpu0: 32KB 64b/line 4-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
> cpu0: 256KB 64b/line 8-way L2 cache
> omap0 at mainbus0
> prcm0 at omap0 rev 0.2
> dmtimer0 at omap0 rev 3.1
> dmtimer1 at omap0 rev 3.1
> simplebus0 at mainbus0: "ocp"
> intc0 at simplebus0 rev 5.0
> omsysc0 at simplebus0: "target-module"
> simplebus1 at simplebus0: "interconnect"
> "wkup_m3" at simplebus1 not configured
> simplebus2 at simplebus1: "segment"
> simplebus3 at simplebus1: "segment"
> simplebus4 at simplebus1: "segment"
> omsysc1 at simplebus4: "target-module"
> simplebus5 at omsysc1: "prcm"
> omcm0 at simplebus5: "per-cm"
> omclock0 at omcm0: "l4ls-clkctrl"
> omclock1 at omcm0: "l3s-clkctrl"
> omclock2 at omcm0: "l3-clkctrl"
> omclock3 at omcm0: "l4hs-clkctrl"
> omclock4 at omcm0: "pruss-ocp-clkctrl"
> omclock5 at omcm0: "cpsw-125mhz-clkctrl"
> omclock6 at omcm0: "lcdc-clkctrl"
> omclock7 at omcm0: "clk-24mhz-clkctrl"
> omcm1 at simplebus5: "wkup-cm"
> omclock8 at omcm1: "l4-wkup-clkctrl"
> omclock9 at omcm1: "l3-aon-clkctrl"
> omclock10 at omcm1: "l4-wkup-aon-clkctrl"
> omcm2 at simplebus5: "mpu-cm"
> omclock11 at omcm2: "mpu-clkctrl"
> omcm3 at simplebus5: "l4-rtc-cm"
> omclock12 at omcm3: "l4-rtc-clkctrl"
> omcm4 at simplebus5: "gfx-l3-cm"
> omclock13 at omcm4: "gfx-l3-clkctrl"
> omcm5 at simplebus5: "l4-cefuse-cm"
> omclock14 at omcm5: "l4-cefuse-clkctrl"
> "prm" at simplebus5 not configured
> "prm" at simplebus5 not configured
> "prm" at simplebus5 not configured
> "prm" at simplebus5 not configured
> omsysc2 at simplebus4: "target-module"
> simplebus6 at omsysc2: "scm"
> syscon0 at simplebus6: "scm_conf"
> pinctrl0 at simplebus6
> "control" at simplebus6 not configured
> "wkup_m3_ipc" at simplebus6 not configured
> "dma-router" at simplebus6 not configured
> omsysc3 at simplebus4: "target-module"
> omgpio0 at omsysc3: rev 0.1
> gpio0 at omgpio0: 32 pins
> omsysc4 at simplebus4: "target-module"
> com0 at omsysc4: ti16750, 64 byte fifo
> com0: console
> omsysc5 at simplebus4: "target-module"
> tiiic0 at omsysc5 rev 0.11
> iic0 at tiiic0
> "ti,tps65217" at iic0 addr 0x24 not configured
> "atmel,24c256" at iic0 addr 0x50 not configured
> nxphdmi0 at iic0 addr 0x70: rev 0x0301
> nxphdmi0: no display detected
> omsysc6 at simplebus4: "target-module"
> omsysc7 at simplebus4: "target-module"
> "timer" at omsysc7 not configured
> omsysc8 at simplebus4: "target-module"
> omdog0 at omsysc8 rev 0.1
> omsysc9 at simplebus4: "target-module"
> "rtc" at omsysc9 not configured
> simplebus7 at simplebus0: "interconnect"
> simplebus8 at simplebus7: "segment"
> omsysc10 at simplebus8: "target-module"
> omsysc11 at simplebus8: "target-module"
> omsysc12 at simplebus8: "target-module"
> omsysc13 at simplebus8: "target-module"
> omsysc14 at simplebus8: "target-module"
> "mcasp" at omsysc14 not configured
> omsysc15 at simplebus8: "target-module"
> omsysc16 at simplebus8: "target-module"
> "timer" at omsysc16 not configured
> omsysc17 at simplebus8: "target-module"
> "timer" at omsysc17 not configured
> omsysc18 at simplebus8: "target-module"
> "timer" at omsysc18 not configured
> omsysc19 at simplebus8: "target-module"
> "timer" at omsysc19 not configured
> omsysc20 at simplebus8: "target-module"
> "timer" at omsysc20 not configured
> omsysc21 at simplebus8: "target-module"
> "timer" at omsysc21 not configured
> omsysc22 at simplebus8: "target-module"
> omgpio1 at omsysc22: rev 0.1
> gpio1 at omgpio1: 32 pins
> omsysc23 at simplebus8: "target-module"
> ommmc0 at omsysc23
> sdmmc0 at ommmc0: 4-bit, sd high-speed, mmc high-speed
> omsysc24 at simplebus8: "target-module"
> omsysc25 at simplebus8: "target-module"
> "mailbox" at omsysc25 not configured
> omsysc26 at simplebus8: "target-module"
> "spinlock" at omsysc26 not configured
> simplebus9 at simplebus7: "segment"
> omsysc27 at simplebus9: "target-module"
> tiiic1 at omsysc27 rev 0.11
> iic1 at tiiic1
> "atmel,24c256" at iic1 addr 0x54 not configured
> "atmel,24c256" at iic1 addr 0x55 not configured
> "atmel,24c256" at iic1 addr 0x56 not configured
> "atmel,24c256" at iic1 addr 0x57 not configured
> omsysc28 at simplebus9: "target-module"
> omsysc29 at simplebus9: "target-module"
> omsysc30 at simplebus9: "target-module"
> omsysc31 at simplebus9: "target-module"
> omsysc32 at simplebus9: "target-module"
> omgpio2 at omsysc32: rev 0.1
> gpio2 at omgpio2: 32 pins
> omsysc33 at simplebus9: "target-module"
> omgpio3 at omsysc33: rev 0.1
> gpio3 at omgpio3: 32 pins
> omsysc34 at simplebus9: "target-module"
> omsysc35 at simplebus9: "target-module"
> omsysc36 at simplebus9: "target-module"
> ommmc1 at omsysc36
> sdmmc1 at ommmc1: 8-bit
> simplebus10 at simplebus7: "segment"
> simplebus11 at simplebus7: "segment"
> omsysc37 at simplebus11: "target-module"
> omsysc38 at simplebus11: "target-module"
> omsysc39 at simplebus11: "target-module"
> omsysc40 at simplebus11: "target-module"
> amdisplay0 at omsysc40
> amdisplay0: no display attached.
> omsysc41 at simplebus11: "target-module"
> omrng0 at omsysc41
> simplebus12 at simplebus0: "interconnect"
> simplebus13 at simplebus12: "segment"
> simplebus14 at simplebus0: "interconnect"
> simplebus15 at simplebus14: "segment"
> omsysc42 at simplebus15: "target-module"
> cpsw0 at omsysc42: version 1.12 (0), address c8:a0:30:ab:cd:81
> ukphy0 at cpsw0 phy 0: Generic IEEE 802.3u media interface, rev. 1: OUI
> 0x0001f0, model 0x000f
> simplebus16 at simplebus0: "interconnect"
> simplebus17 at simplebus16: "segment"
> "edma" at simplebus0 not configured
> "tptc" at simplebus0 not configured
> "tptc" at simplebus0 not configured
> "tptc" at simplebus0 not configured
> omsysc43 at simplebus0: "target-module"
> ommmc2 at omsysc43
> sdmmc2 at ommmc2: 1-bit
> omsysc44 at simplebus0: "target-module"
> "usb-phy" at omsysc44 not configured
> "usb" at omsysc44 not configured
> "usb-phy" at omsysc44 not configured
> "usb" at omsysc44 not configured
> "dma-controller" at omsysc44 not configured
> "sram" at simplebus0 not configured
> "emif" at simplebus0 not configured
> omsysc45 at simplebus0: "target-module"
> "sham" at omsysc45 not configured
> omsysc46 at simplebus0: "target-module"
> "aes" at omsysc46 not configured
> sdmmc2: can't enable card
> scsibus0 at sdmmc1: 2 targets, initiator 0
> sd0 at scsibus0 targ 1 lun 0: <SD/MMC, MMC02G, 0000> removable
> sd0: 1832MB, 512 bytes/sector, 3751936 sectors
> scsibus1 at sdmmc0: 2 targets, initiator 0
> sd1 at scsibus1 targ 1 lun 0: <SD/MMC, SU08G, 0080> removable
> sd1: 7580MB, 512 bytes/sector, 15523840 sectors
> vscsi0 at root
> scsibus2 at vscsi0: 256 targets
> softraid0 at root
> scsibus3 at softraid0: 256 targets
> bootfile: sd0a:/bsd
> boot device: sd0
> root on sd1a (df088aa460d72037.a) swap on sd1b dump on sd1b
> WARNING: CHECK AND RESET THE DATE!
> gpioiic0 at gpio0: SDA[20] pull-up, SCL[19]
> iic2 at gpioiic0
>
>