DS3234 clock on SPI1

Running kernel 4.4 and trying to read a DS3234 clock on the second SPI
port I can suppress the HDMI pins in uEnv.txt with:

dtb=am335x-boneblack-emmc-overlay.dtb
optargs=cape_disable=bone_capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

(uEnv.txt isn’t loading the “universal overlay”.)

Loading BB-SPIDEV0 and BB-SPI1CLK then produces the expected /dev/spidev1.0,
/dev/spidev1.1 and /dev/rtc1 devices.

dmesg says:
bone_capemgr bone_capemgr: part_number ‘BB-SPI1CLK’, version ‘N/A’
bone_capemgr bone_capemgr: slot #6: override
bone_capemgr bone_capemgr: Using override eeprom data at slot 6
bone_capemgr bone_capemgr: slot #6: ‘Override Board Name,00A0,Override Manuf,BB-SPI1CLK’
ds3234 spi2.0: Control Reg: 0x00
ds3234 spi2.0: Ctrl/Stat Reg: 0x00
ds3234 spi2.0: rtc core: registered ds3234 as rtc1
bone_capemgr bone_capemgr: slot #6: dtbo ‘BB-SPI1CLK-00A0.dtbo’ loaded; overlay id #1

However, there’s no spi pingroup, and the relevant pins remain in mode 7
not mode 3, and are unclaimed:

pin 100 (44e10990.0) 00000027 pinctrl-single
pin 101 (44e10994.0) 00000027 pinctrl-single
pin 102 (44e10998.0) 00000027 pinctrl-single
pin 103 (44e1099c.0) 00000027 pinctrl-single

pin 100 (44e10990.0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 101 (44e10994.0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 102 (44e10998.0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 103 (44e1099c.0): (MUX UNCLAIMED) (GPIO UNCLAIMED)

and reading the clocks gives:

quid ~ # hwclock -f /dev/rtc0 -r
Sat Jul 2 21:00:10 2016 .954216 seconds
quid ~ # hwclock -f /dev/rtc1 -r
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc1 to read the time failed: Invalid argument
quid ~ #

The clock overlay worked in 3.8, and I think I’ve updated it correctly for
4.4. Can anyone spot what I’ve missed?

/*
** Dallas DS3234 RTC SPI driver test.

Have you updated the device tree compiler ? Here, I’m assuming you simply upgraded the kernel form an image that initially had 3.8.x installed . . .

http://www.embeddedhobbyist.com/2015/09/beaglebone-black-updating-device-tree-files/

Additionally. You did set the time on the RTC before trying to read from it ?

cs-gpios = <&gpio3 17 0>; /* Is this needed ??? */

Double check your pin here make sure it’s right. Someone was just saying yesterday that the GPIO banks got restructured, and some address got switched around. So it is entirely possible the pin you’re after is no longer on GPIO3 gpio bank.

Ok, sorry scratch all the above. I remember Robert saying a few days ago that SPI must be loaded early at boot in order for it to work correctly. Some kind of glitch. Read teh last post here: https://groups.google.com/forum/#!searchin/beagleboard/SPI$20Robert|sort:date/beagleboard/vCFU_NWRdgo/7QGgua-QCgAJ

Additionally . . .

dtb=am335x-boneblack-emmc-overlay.dtb
optargs=cape_disable=bone_capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

Your optargs line is not longer required. Using the am335x-boneblack-emmc-overlay.dtb board file disables hdmi video and audio already.

bone_capemgr bone_capemgr: slot #6: dtbo ‘BB-SPI1CLK-00A0.dtbo’ loaded; overlay id #1

Your overlay seems to be loaded correctly.

One other thing caught my eye that I’m not sure is right or not. P9.28, your CS pin, is active low ? Is that correct ? I was reading this: http://www.sciencegizmo.com.au/?p=105 But if you look towards the bottom for his device tree overlay for the rPI

DS3234 Real Time Clock Bitbang Device Tree Overlay

gpio-mosi = <&gpio 5 0>;
gpio-miso = <&gpio 6 0>;
gpio-sck = <&gpio 13 0>;
cs-gpios = <&gpio 12 1>;

He has the CS / CE line as active high. So perhaps a moot point, but it caught my eye.

quid ~ # hwclock -f /dev/rtc1 -r
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc1 to read the time failed: Invalid argument

The only time I’ve personally seen this hwclock error is when I attempt to use a non rtc0 ( → /dev/rtc ) clock without being root. e.g. $ sudo hwclock -r -rtc /dev/rtc1 <— not run as root user, so will fail with default file permissions. But I’m also using an ds3232( I2C ).

Did you double check to make sure the rtc-ds3234 module was loaded via lsmod ?