Sorry, you need to enable JavaScript to visit this website.

Digilent Pmod Real Time Clock

Unsolved
9 posts / 0 new
neot's picture
neot
Junior(0)
Digilent Pmod Real Time Clock

Hi,
I have a problem with RTC driver on zed board. RTC is Digilent Pmod-RTCC, which has a Microchip MCP7941x compatiable IC onboard. I used DS1307 driver to run it, since MCP7941x does not have its own drivers in Linux and is supposed to be compatible with DS1307.

Below is the bootup output on console.
The error occurs at
cdns-i2c e0004000.ps7-i2c: timeout waiting on completion
rtc-ds1307: probe of 0-006f failed with error -5

Now '/sys/class/rtc' is empty, supposed to have some files and folders related to ds1307.

'/sys/bus/i2c/devices' has '0-006f' 'i2c-0'm and
'/sys/bus/i2c/devices/i2c-0' has
0-006f device name power uevent
delete_device i2c-dev new_device subsystem

I also tried to build ds1307 driver as an module, so that kernel won't load it and I manually load it at user space, still have same problem.

Here's the console output and I have attached the modified DTS file:

Thanks for the help,

Neo

Console output when boot:

Memory: 375964K/524288K available (4604K kernel code, 232K rwdata, 1540K rodata, 188K init, 192K bss, 148324K reserved, 0K highmem)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc060861c (6146 kB)
.init : 0xc0609000 - 0xc0638340 ( 189 kB)
.data : 0xc063a000 - 0xc0674160 ( 233 kB)
.bss : 0xc067416c - 0xc06a42fc ( 193 kB)
Preemptible hierarchical RCU implementation.
Dump stacks of tasks blocking RCU-preempt GP.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
ps7-slcr mapped to e0802000
zynq_clock_init: clkc starts at e0802100
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 3298534883328ns
ps7-ttc #0 at e0804000, irq=43
Console: colour dummy device 80x30
Calibrating delay loop... 1325.46 BogoMIPS (lpj=6627328)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x459b68 - 0x459bc0
L310 cache controller enabled
l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72760000, Cache size: 512 kB
CPU1: Booted secondary processor
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated.
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
regulator-dummy: no parameters
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
syscon f8000000.ps7-slcr: regmap [mem 0xf8000000-0xf8000fff] registered
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ps7-ocmc: ZYNQ OCM pool: 256 KiB @ 0xe0880000
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
Advanced Linux Sound Architecture Driver Initialized.
Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
Freeing initrd memory: 5572K (df5bc000 - dfb2d000)
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
msgmni has been set to 1001
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.ps7-dma: Loaded driver for PL330 DMAC-2364208
dma-pl330 f8003000.ps7-dma: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
console [ttyPS0] enabledat MMIO 0xe0001000 (irq = 82, base_baud = 3124999) is a xuartps
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
xdevcfg f8007000.ps7-dev-cfg: ioremap 0xf8007000 to e0866000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
m25p80 spi0.0: found s25fl256s1, expected n25q128
m25p80 spi0.0: s25fl256s1 (32768 Kbytes)
5 ofpart partitions found on MTD device spi0.0
Creating 5 MTD partitions on "spi0.0":
0x000000000000-0x000000100000 : "qspi-fsbl-uboot"
0x000000100000-0x000000600000 : "qspi-linux"
0x000000600000-0x000000620000 : "qspi-device-tree"
0x000000620000-0x000000c00000 : "qspi-rootfs"
0x000000c00000-0x000001000000 : "qspi-bitstream"
e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
e1000e: Copyright(c) 1999 - 2013 Intel Corporation.
libphy: XEMACPS mii bus: probed
xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ULPI transceiver vendor/product ID 0x0451/0x1507
Found TI TUSB1210 ULPI transceiver.
ULPI integrity check: passed.
zynq-ehci zynq-ehci.0: Xilinx Zynq USB EHCI Host Controller
zynq-ehci zynq-ehci.0: new USB bus registered, assigned bus number 1
zynq-ehci zynq-ehci.0: irq 53, io mem 0x00000000
zynq-ehci zynq-ehci.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
cdns-i2c e0004000.ps7-i2c: timeout waiting on completion
rtc-ds1307: probe of 0-006f failed with error -5
cdns-i2c e0004000.ps7-i2c: 400 kHz mmio e0004000 irq 57
zynq-edac f8006000.ps7-ddrc: ecc not enabled
cpufreq_cpu0: failed to get cpu0 regulator: -19
Xilinx Zynq CpuIdle Driver started
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: no vqmmc regulator found
mmc0: no vmmc regulator found
mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 17
Registering SWP/SWPB emulation handler
regulator-dummy: disabling
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
ALSA device list:
No soundcards found.
Freeing unused kernel memory: 188K (c0609000 - c0638000)
mmc0: new high speed SDHC card at address 0007
mmcblk0: mmc0:0007 SD04G 3.70 GiB
INIT: version 2.88 booting
Starting Bootlog daemon: bootlogd.
Creating /dev/flash/* device nodes
random: dd urandom read with 8 bits of entropy available
starting Busybox inet Daemon: inetd... done.
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
Removing any system startup links for run-postinsts ...
/etc/rcS.d/S99run-postinsts
INIT: Entering runlevel: 5
Configuring network interfaces... udhcpc (v1.22.1) started
Sending discover...
Sending discover...
xemacps e000b000.ps7-ethernet: Set clk to 124999998 Hz
xemacps e000b000.ps7-ethernet: link up (1000/FULL)
Sending discover...
No lease, failing
Starting Dropbear SSH server: Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCJ1NCNGCOE3GIrPP5zwcaynW9GSmfSi3oKE2fLRASYsbhen694XzWmXNgGxs8kC3ow9xL2hbQjnuNYzUbs1bV+nD9MxAreZsSw9stbTkG41MmL9oif/jHmDzgVXIZ/fQXUuUWqh3fHNy2HCySVntJ80lIVMifsp7aCMKbpgBL37e9l1t9fRYvrR7gp5HFV2sU9RB64vCWAzPvEzSWN9pNHwE1YMjURpIskCTrrNEd6ZNlVIG7Y8p1IpQgsCEwzFKbF69vJNcgtgueF9a16Umfvc3dipXiEfHlR75WBBdaBQ3WenrJ5Y3ymR26XQAxrgtnMbCexefnnZaGRy42FuW/F root@zynq
Fingerprint: md5 56:88:73:3e:ea:ed:59:9b:8d:6e:45:40:ad:3f:e3:89
dropbear.
Stopping Bootlog daemon: bootlogd.
Starting tcf-agent: OK

Built with PetaLinux v2014.2 (Yocto 1.6) zynq /dev/ttyPS0
zynq login: root
Password:
login[817]: root login on 'ttyPS0'
root@zynq:~# cd /sys/b
block/ bus/
root@zynq:~# cd /sys/bus/
root@zynq:/sys/bus# ls
amba cpu i2c pci serio
clockevents edac mdio_bus platform spi
clocksource event_source media scsi usb
container hid mmc sdio workqueue
root@zynq:/sys/bus# cd i2c/devices/
root@zynq:/sys/bus/i2c/devices# ls
0-006f i2c-0
root@zynq:/sys/bus/i2c/devices# cd /sys/class/rtc/

DTS File:

/*
* Device Tree Generator version: 1.1
*
* (C) Copyright 2007-2013 Xilinx, Inc.
* (C) Copyright 2007-2013 Michal Simek
* (C) Copyright 2007-2012 PetaLogix Qld Pty Ltd
*
* Michal SIMEK <monstr@monstr.eu>
*
* CAUTION: This file is automatically generated by libgen.
* Version: Xilinx EDK 14.5 EDK_P.58f
*
*/

/dts-v1/;
/ {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,zynq-7000";
model = "Xilinx Zynq";
aliases {
ethernet0 = &ps7_ethernet_0;
serial0 = &ps7_uart_1;
spi0 = &ps7_qspi_0;
} ;
chosen {
bootargs = "console=ttyPS0,115200 root=/dev/ram rw earlyprintk";
linux,stdout-path = "/amba@0/serial@e0001000";
} ;
cpus {
#address-cells = <1>;
#size-cells = <0>;
ps7_cortexa9_0: cpu@0 {
bus-handle = <&ps7_axi_interconnect_0>;
clock-latency = <1000>;
clocks = <&clkc 3>;
compatible = "arm,cortex-a9";
device_type = "cpu";
interrupt-handle = <&ps7_scugic_0>;
operating-points = <666667 1000000 333334 1000000 222223 1000000>;
reg = <0x0>;
} ;
ps7_cortexa9_1: cpu@1 {
bus-handle = <&ps7_axi_interconnect_0>;
clocks = <&clkc 3>;
compatible = "arm,cortex-a9";
device_type = "cpu";
interrupt-handle = <&ps7_scugic_0>;
reg = <0x1>;
} ;
} ;
pmu {
compatible = "arm,cortex-a9-pmu";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 5 4>, <0 6 4>;
reg = <0xf8891000 0x1000>, <0xf8893000 0x1000>;
reg-names = "cpu0", "cpu1";
} ;
ps7_ddr_0: memory@0 {
device_type = "memory";
reg = <0x0 0x20000000>;
} ;
ps7_axi_interconnect_0: amba@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,ps7-axi-interconnect-1.00.a", "simple-bus";
ranges ;
ps7_afi_0: ps7-afi@f8008000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = <0xf8008000 0x1000>;
} ;
ps7_afi_1: ps7-afi@f8009000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = <0xf8009000 0x1000>;
} ;
ps7_afi_2: ps7-afi@f800a000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = <0xf800a000 0x1000>;
} ;
ps7_afi_3: ps7-afi@f800b000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = <0xf800b000 0x1000>;
} ;
ps7_ddrc_0: ps7-ddrc@f8006000 {
compatible = "xlnx,zynq-ddrc-1.0";
reg = <0xf8006000 0x1000>;
xlnx,has-ecc = <0x0>;
} ;
ps7_dev_cfg_0: ps7-dev-cfg@f8007000 {
clock-names = "ref_clk", "fclk0", "fclk1", "fclk2", "fclk3";
clocks = <&clkc 12>, <&clkc 15>, <&clkc 16>, <&clkc 17>, <&clkc 18>;
compatible = "xlnx,zynq-devcfg-1.0";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 8 4>;
reg = <0xf8007000 0x100>;
} ;
ps7_dma_s: ps7-dma@f8003000 {
#dma-cells = <1>;
#dma-channels = <8>;
#dma-requests = <4>;
clock-names = "apb_pclk";
clocks = <&clkc 27>;
compatible = "arm,primecell", "arm,pl330";
interrupt-names = "abort", "dma0", "dma1", "dma2", "dma3",
"dma4", "dma5", "dma6", "dma7";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 13 4>, <0 14 4>, <0 15 4>, <0 16 4>, <0 17 4>, <0 40 4>, <0 41 4>, <0 42 4>, <0 43 4>;
reg = <0xf8003000 0x1000>;
} ;
ps7_ethernet_0: ps7-ethernet@e000b000 {
#address-cells = <1>;
#size-cells = <0>;
clock-names = "ref_clk", "aper_clk";
clocks = <&clkc 13>, <&clkc 30>;
compatible = "xlnx,ps7-ethernet-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 22 4>;
local-mac-address = [00 0a 35 00 00 00];
phy-handle = <&phy0>;
phy-mode = "rgmii-id";
reg = <0xe000b000 0x1000>;
xlnx,eth-mode = <0x1>;
xlnx,has-mdio = <0x1>;
xlnx,ptp-enet-clock = <111111115>;
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@0 {
compatible = "marvell,88e1510";
device_type = "ethernet-phy";
reg = <0>;
} ;
} ;
} ;
ps7_globaltimer_0: ps7-globaltimer@f8f00200 {
clocks = <&clkc 4>;
compatible = "arm,cortex-a9-global-timer";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <1 11 0x301>;
reg = <0xf8f00200 0x100>;
} ;
ps7_gpio_0: ps7-gpio@e000a000 {
#gpio-cells = <2>;
clocks = <&clkc 42>;
compatible = "xlnx,zynq-gpio-1.0";
emio-gpio-width = <64>;
gpio-controller ;
gpio-mask-high = <0xc0000>;
gpio-mask-low = <0xfe81>;
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 20 4>;
reg = <0xe000a000 0x1000>;
} ;
ps7_iop_bus_config_0: ps7-iop-bus-config@e0200000 {
compatible = "xlnx,ps7-iop-bus-config-1.00.a";
reg = <0xe0200000 0x1000>;
} ;
ps7_ocmc_0: ps7-ocmc@f800c000 {
compatible = "xlnx,zynq-ocmc-1.0";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 3 4>;
reg = <0xf800c000 0x1000>;
} ;
ps7_pl310_0: ps7-pl310@f8f02000 {
arm,data-latency = <3 2 2>;
arm,tag-latency = <2 2 2>;
cache-level = <2>;
cache-unified ;
compatible = "arm,pl310-cache";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 2 4>;
reg = <0xf8f02000 0x1000>;
} ;
ps7_qspi_0: ps7-qspi@e000d000 {
clock-names = "ref_clk", "pclk";
clocks = <&clkc 10>, <&clkc 43>;
compatible = "xlnx,zynq-qspi-1.0";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 19 4>;
is-dual = <0>;
num-cs = <1>;
reg = <0xe000d000 0x1000>;
xlnx,fb-clk = <0x1>;
xlnx,qspi-mode = <0x0>;
#address-cells = <1>;
#size-cells = <0>;
flash@0 {
compatible = "n25q128";
reg = <0x0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
partition@qspi-fsbl-uboot {
label = "qspi-fsbl-uboot";
reg = <0x0 0x100000>;
};
partition@qspi-linux {
label = "qspi-linux";
reg = <0x100000 0x500000>;
};
partition@qspi-device-tree {
label = "qspi-device-tree";
reg = <0x600000 0x20000>;
};
partition@qspi-rootfs {
label = "qspi-rootfs";
reg = <0x620000 0x5E0000>;
};
partition@qspi-bitstream {
label = "qspi-bitstream";
reg = <0xC00000 0x400000>;
};
};

} ;
ps7_qspi_linear_0: ps7-qspi-linear@fc000000 {
clock-names = "ref_clk", "aper_clk";
clocks = <&clkc 10>, <&clkc 43>;
compatible = "xlnx,ps7-qspi-linear-1.00.a";
reg = <0xfc000000 0x1000000>;
} ;
ps7_scugic_0: ps7-scugic@f8f01000 {
#address-cells = <2>;
#interrupt-cells = <3>;
#size-cells = <1>;
compatible = "arm,cortex-a9-gic", "arm,gic";
interrupt-controller ;
num_cpus = <2>;
num_interrupts = <96>;
reg = <0xf8f01000 0x1000>, <0xf8f00100 0x100>;
} ;
ps7_scutimer_0: ps7-scutimer@f8f00600 {
clocks = <&clkc 4>;
compatible = "arm,cortex-a9-twd-timer";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <1 13 0x301>;
reg = <0xf8f00600 0x20>;
} ;
ps7_scuwdt_0: ps7-scuwdt@f8f00620 {
clocks = <&clkc 4>;
compatible = "xlnx,ps7-scuwdt-1.00.a";
device_type = "watchdog";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <1 14 0x301>;
reg = <0xf8f00620 0xe0>;
} ;
ps7_sd_0: ps7-sdio@e0100000 {
clock-frequency = <50000000>;
clock-names = "clk_xin", "clk_ahb";
clocks = <&clkc 21>, <&clkc 32>;
compatible = "arasan,sdhci-8.9a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 24 4>;
reg = <0xe0100000 0x1000>;
xlnx,has-cd = <0x1>;
xlnx,has-power = <0x0>;
xlnx,has-wp = <0x1>;
} ;
ps7_slcr_0: ps7-slcr@f8000000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,zynq-slcr", "syscon";
ranges ;
reg = <0xf8000000 0x1000>;
clkc: clkc@100 {
#clock-cells = <1>;
clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", "cpu_3or2x",
"cpu_2x", "cpu_1x", "ddr2x", "ddr3x", "dci",
"lqspi", "smc", "pcap", "gem0", "gem1",
"fclk0", "fclk1", "fclk2", "fclk3", "can0",
"can1", "sdio0", "sdio1", "uart0", "uart1",
"spi0", "spi1", "dma", "usb0_aper", "usb1_aper",
"gem0_aper", "gem1_aper", "sdio0_aper", "sdio1_aper", "spi0_aper",
"spi1_aper", "can0_aper", "can1_aper", "i2c0_aper", "i2c1_aper",
"uart0_aper", "uart1_aper", "gpio_aper", "lqspi_aper", "smc_aper",
"swdt", "dbg_trc", "dbg_apb";
compatible = "xlnx,ps7-clkc";
fclk-enable = <0xf>;
ps-clk-frequency = <33333333>;
reg = <0x100 0x100>;
} ;
} ;
ps7_ttc_0: ps7-ttc@f8001000 {
clocks = <&clkc 6>;
compatible = "cdns,ttc";
interrupt-names = "ttc0", "ttc1", "ttc2";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 10 4>, <0 11 4>, <0 12 4>;
reg = <0xf8001000 0x1000>;
} ;
ps7_uart_1: serial@e0001000 {
clock-names = "uart_clk", "pclk";
clocks = <&clkc 24>, <&clkc 41>;
compatible = "xlnx,xuartps", "cdns,uart-r1p8";
current-speed = <115200>;
device_type = "serial";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 50 4>;
port-number = <0>;
reg = <0xe0001000 0x1000>;
xlnx,has-modem = <0x0>;
} ;
ps7_usb_0: ps7-usb@e0002000 {
clocks = <&clkc 28>;
compatible = "xlnx,ps7-usb-1.00.a", "xlnx,zynq-usb-1.00.a";
dr_mode = "host";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 21 4>;
phy_type = "ulpi";
reg = <0xe0002000 0x1000>;
} ;
ps7_xadc: ps7-xadc@f8007100 {
clocks = <&clkc 12>;
compatible = "xlnx,zynq-xadc-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 7 4>;
reg = <0xf8007100 0x20>;
} ;

ps7_i2c_0: ps7-i2c@e0004000 {
clock-frequency = <400000>;
clocks = <&clkc 38>;
compatible = "cdns,i2c-r1p10";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 25 4>;
reg = <0xe0004000 0x1000>;
xlnx,has-interrupt = <0x0>;
#address-cells = <1>;
#size-cells = <0>;
rtc0: rtc@6f {
#compatible = "dallas,ds1307";
compatible = "microchip,mcp7941x";
reg = <0x6f>;
};

};

} ;
} ;

lklaproth's picture
lklaproth
Junior(0)
Did you make any progress

Did you make any progress with this issue? We are attempting to connect the Dallas DS3231 RTC to the Zedboard but haven't had any success so far.

Our device tree looks as follows:
ps7_i2c_0: ps7-i2c@e0004000 {
bus-id = <0>;
clock-frequency = <400000>;
clocks = <&clkc 38>;
compatible = "cdns,i2c-r1p10";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 25 4>;
reg = <0xe0004000 0x1000>;
xlnx,has-interrupt = <0x0>;
xlnx,i2c-reset = "";
rtc@68 {
compatible = "dallas,ds3232";
reg = <0x68>;
};
} ;

I have run i2cdetect -l and we can see the following:
i2c-0 i2c Cadence I2C at e0004000 I2C adapter

i2cdetect -r 0 does not return a device on any bus.

asigint's picture
asigint
Junior(0)
Partial Success

I have partial success. Hopefully someone can learn from my progress and help me get it to 100%. I posted my complete steps in a different message: http://zedboard.org/comment/10826#comment-10826

The short summary, the clock is at 6F according to the datasheet, so my I2C device tree looks like:
------------------------
ps7_i2c_0: ps7-i2c@e0004000 {
bus-id = <0>;
clock-frequency = <100000>;
clocks = <&clkc 38>;
compatible = "cdns,i2c-r1p10";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 25 4>;
reg = <0xe0004000 0x1000>;
xlnx,has-interrupt = <0x0>;
#address-cells = <1>;
#size-cells = <0>;
rtc@6F {
compatible = "dallas,ds1337";
reg = <0x6F>;
};
} ;
------------------------

i2cdetect -y -r 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
70: -- -- -- -- -- -- -- --

From this I see that I get UU at 0x6F which implies it's working. Should I have something in the device tree to cover 0x57?

The following in the kernel tells me I have some problems:
--------------------------------
i2c /dev entries driver
cdns-i2c e0004000.ps7-i2c: timeout waiting on completion
rtc-ds1307: probe of 0-006f failed with error -5
cdns-i2c e0004000.ps7-i2c: 100 kHz mmio e0004000 irq 57
...<snip>...
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
--------------------------------
I do get a /dev/rtc0 and a linked /dev/rtc.

Can anyone help with the last detail I must be missing?

asigint's picture
asigint
Junior(0)
Solved

Found this issue. My device tree had:

compatible = "dallas,ds1337";

but needs to be:

compatible = "dallas,mcp7941x";

I made the change and now I'm working.

Hope this can help someone else.

john3's picture
john3
Junior(0)
unable to open rtc device (rtc0)

I am also having problems with rtc... Namely when booting on the Zedboard, I get:

/home/john/Petalinux_2014.4/Avnet-Digilent-ZedBoard-2014.4/components/linux-kernel/linux-xlnx-xenomai/drivers/rtc/hctosys.c: unable to open rtc device (rtc0).

In my device tree(arch/arm/boot/dts/zynq_zed.dts) I do not have this part with: ps7_i2c_0: ps7-i2c@e0004000 and also my device tree is different in comparison with yours. Here is my device tree:

/dts-v1/;
/ {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,zynq-zc770";
model = "Xilinx Zynq";
aliases {
ethernet0 = &ps7_ethernet_0;
serial0 = &ps7_uart_1;
} ;
chosen {
bootargs = "console=ttyPS0,115200 root=/dev/ram rw ip=:::::eth0:dhcp earlyprintk";
linux,stdout-path = "/axi@0/serial@e0001000";
} ;
cpus {
#address-cells = <1>;
#cpus = <0x2>;
#size-cells = <0>;
ps7_cortexa9_0: cpu@0 {
compatible = "xlnx,ps7-cortexa9-1.00.a";
d-cache-line-size = <0x20>;
d-cache-size = <0x8000>;
device_type = "cpu";
i-cache-line-size = <0x20>;
i-cache-size = <0x8000>;
model = "ps7_cortexa9,1.00.a";
reg = <0>;
xlnx,cpu-1x-clk-freq-hz = <0x69f6bcb>;
xlnx,cpu-clk-freq-hz = <0x27bc86bf>;
} ;
ps7_cortexa9_1: cpu@1 {
compatible = "xlnx,ps7-cortexa9-1.00.a";
d-cache-line-size = <0x20>;
d-cache-size = <0x8000>;
device_type = "cpu";
i-cache-line-size = <0x20>;
i-cache-size = <0x8000>;
model = "ps7_cortexa9,1.00.a";
reg = <1>;
xlnx,cpu-1x-clk-freq-hz = <0x69f6bcb>;
xlnx,cpu-clk-freq-hz = <0x27bc86bf>;
} ;
} ;
pmu {
compatible = "arm,cortex-a9-pmu";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 5 4 0 6 4 >;
reg = < 0xf8891000 0x1000 0xf8893000 0x1000 >;
} ;
ps7_ddr_0: memory@0 {
device_type = "memory";
reg = < 0x0 0x20000000 >;
} ;
ps7_axi_interconnect_0: amba@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,ps7-axi-interconnect-1.00.a", "simple-bus";
ranges ;
ps7_afi_0: ps7-afi@f8008000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = < 0xf8008000 0x1000 >;
} ;
ps7_afi_1: ps7-afi@f8009000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = < 0xf8009000 0x1000 >;
} ;
ps7_afi_2: ps7-afi@f800a000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = < 0xf800a000 0x1000 >;
} ;
ps7_afi_3: ps7-afi@f800b000 {
compatible = "xlnx,ps7-afi-1.00.a";
reg = < 0xf800b000 0x1000 >;
} ;
ps7_ddrc_0: ps7-ddrc@f8006000 {
compatible = "xlnx,ps7-ddrc-1.00.a", "xlnx,ps7-ddrc";
reg = < 0xf8006000 0x1000 >;
xlnx,has-ecc = <0x0>;
} ;
ps7_dev_cfg_0: ps7-dev-cfg@f8007000 {
compatible = "xlnx,ps7-dev-cfg-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 8 4 >;
reg = < 0xf8007000 0x1000 >;
} ;
ps7_dma_s: ps7-dma@f8003000 {
#dma-cells = <1>;
#dma-channels = <8>;
#dma-requests = <4>;
arm,primecell-periphid = <0x41330>;
compatible = "xlnx,ps7-dma-1.00.a", "arm,primecell", "arm,pl330";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 13 4 0 14 4 0 15 4 0 16 4 0 17 4 0 40 4 0 41 4 0 42 4 0 43 4 >;
reg = < 0xf8003000 0x1000 >;
} ;
ps7_ethernet_0: ps7-ethernet@e000b000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "xlnx,ps7-ethernet-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 22 1 >;
local-mac-address = [ 00 0a 35 00 00 00 ];
phy-handle = <&phy0>;
phy-mode = "rgmii-id";
reg = < 0xe000b000 0x1000 >;
xlnx,enet-clk-freq-hz = <0x7735940>;
xlnx,enet-reset = <0xffffffff>;
xlnx,enet-slcr-1000mbps-div0 = <0x8>;
xlnx,enet-slcr-1000mbps-div1 = <0x1>;
xlnx,enet-slcr-100mbps-div0 = <0x8>;
xlnx,enet-slcr-100mbps-div1 = <0x5>;
xlnx,enet-slcr-10mbps-div0 = <0x8>;
xlnx,enet-slcr-10mbps-div1 = <0x32>;
xlnx,eth-mode = <0x1>;
xlnx,has-mdio = <0x1>;
xlnx,ptp-enet-clock = <111111115>;
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@7 {
compatible = "marvell,88e1510";
device_type = "ethernet-phy";
reg = <7>;
} ;
} ;
} ;
ps7_gpio_0: ps7-gpio@e000a000 {
#gpio-cells = <2>;
compatible = "xlnx,ps7-gpio-1.00.a";
emio-gpio-width = <64>;
gpio-controller ;
gpio-mask-high = <0xc0000>;
gpio-mask-low = <0xfe81>;
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 20 4 >;
reg = < 0xe000a000 0x1000 >;
} ;
ps7_iop_bus_config_0: ps7-iop-bus-config@e0200000 {
compatible = "xlnx,ps7-iop-bus-config-1.00.a";
reg = < 0xe0200000 0x1000 >;
} ;
ps7_pl310_0: ps7-pl310@f8f02000 {
arm,data-latency = < 3 2 2 >;
arm,tag-latency = < 2 2 2 >;
cache-level = < 2 >;
cache-unified ;
compatible = "xlnx,ps7-pl310-1.00.a", "arm,pl310-cache";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 2 4 >;
reg = < 0xf8f02000 0x1000 >;
} ;
ps7_qspi_0: ps7-qspi@e000d000 {
bus-num = <0>;
compatible = "xlnx,ps7-qspi-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 19 4 >;
is-dual = <0>;
num-chip-select = <1>;
reg = < 0xe000d000 0x1000 >;
speed-hz = <200000000>;
xlnx,fb-clk = <0x1>;
xlnx,qspi-clk-freq-hz = <0xbebc200>;
xlnx,qspi-mode = <0x0>;
#address-cells = <1>;
#size-cells = <0>;
flash@0 {
compatible = "n25q128";
reg = <0x0>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
partition@qspi-fsbl-uboot {
label = "qspi-fsbl-uboot";
reg = <0x0 0x100000>;
};
partition@qspi-linux {
label = "qspi-linux";
reg = <0x100000 0x500000>;
};
partition@qspi-device-tree {
label = "qspi-device-tree";
reg = <0x600000 0x20000>;
};
partition@qspi-rootfs {
label = "qspi-rootfs";
reg = <0x620000 0x5E0000>;
};
partition@qspi-bitstream {
label = "qspi-bitstream";
reg = <0xC00000 0x400000>;
};
};
} ;
ps7_qspi_linear_0: ps7-qspi-linear@fc000000 {
compatible = "xlnx,ps7-qspi-linear-1.00.a";
reg = < 0xfc000000 0x1000000 >;
xlnx,qspi-clk-freq-hz = <0xe4e1c0>;
} ;
ps7_ram_0: ps7-ram@0 {
compatible = "xlnx,ps7-ram-1.00.a", "xlnx,ps7-ocm";
reg = < 0xfffc0000 0x40000 >;
} ;
ps7_scugic_0: ps7-scugic@f8f01000 {
#address-cells = < 2 >;
#interrupt-cells = < 3 >;
#size-cells = < 1 >;
compatible = "xlnx,ps7-scugic-1.00.a", "arm,cortex-a9-gic", "arm,gic";
interrupt-controller ;
linux,phandle = < 0x1 >;
phandle = < 0x1 >;
reg = < 0xf8f01000 0x1000 0xf8f00100 0x100 >;
} ;
ps7_scutimer_0: ps7-scutimer@f8f00600 {
compatible = "xlnx,ps7-scutimer-1.00.a", "arm,cortex-a9-twd-timer";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 1 13 769 >;
reg = < 0xf8f00600 0x20 >;
} ;
ps7_scuwdt_0: ps7-scuwdt@f8f00620 {
compatible = "xlnx,ps7-scuwdt-1.00.a";
device_type = "watchdog";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 1 14 769 >;
reg = < 0xf8f00620 0xe0 >;
} ;
ps7_sd_0: ps7-sdio@e0100000 {
clock-frequency = <50000000>;
compatible = "xlnx,ps7-sdio-1.00.a", "generic-sdhci";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 24 4 >;
reg = < 0xe0100000 0x1000 >;
xlnx,has-cd = <0x1>;
xlnx,has-power = <0x0>;
xlnx,has-wp = <0x1>;
xlnx,sdio-clk-freq-hz = <0x2faf080>;
} ;
ps7_slcr_0: ps7-slcr@f8000000 {
compatible = "xlnx,ps7-slcr-1.00.a", "xlnx,zynq-slcr";
reg = < 0xf8000000 0x1000 >;
clocks {
#address-cells = <1>;
#size-cells = <0>;
armpll: armpll {
#clock-cells = <0>;
clock-output-names = "armpll";
clocks = <&ps_clk>;
compatible = "xlnx,zynq-pll";
lockbit = <0>;
reg = < 0x100 0x110 0x10c >;
} ;
ddrpll: ddrpll {
#clock-cells = <0>;
clock-output-names = "ddrpll";
clocks = <&ps_clk>;
compatible = "xlnx,zynq-pll";
lockbit = <1>;
reg = < 0x104 0x114 0x10c >;
} ;
iopll: iopll {
#clock-cells = <0>;
clock-output-names = "iopll";
clocks = <&ps_clk>;
compatible = "xlnx,zynq-pll";
lockbit = <2>;
reg = < 0x108 0x118 0x10c >;
} ;
ps_clk: ps_clk {
#clock-cells = <0>;
clock-frequency = <33333333>;
clock-output-names = "ps_clk";
compatible = "fixed-clock";
} ;
} ;
} ;
ps7_ttc_0: ps7-ttc@f8001000 {
compatible = "xlnx,ps7-ttc-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 10 4 0 11 4 0 12 4 >;
reg = < 0xf8001000 0x1000 >;
} ;
ps7_uart_1: serial@e0001000 {
compatible = "xlnx,ps7-uart-1.00.a", "xlnx,xuartps";
current-speed = <115200>;
device_type = "serial";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 50 4 >;
port-number = <0>;
reg = < 0xe0001000 0x1000 >;
xlnx,has-modem = <0x0>;
xlnx,uart-clk-freq-hz = <0x2faf080>;
} ;
ps7_usb_0: ps7-usb@e0002000 {
compatible = "xlnx,ps7-usb-1.00.a";
dr_mode = "host";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 21 4 >;
phy_type = "ulpi";
reg = < 0xe0002000 0x1000 >;
xlnx,usb-reset = <0xffffffff>;
} ;
ps7_xadc: ps7-xadc@f8007100 {
compatible = "xlnx,ps7-xadc-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 7 4 >;
reg = < 0xf8007100 0x20 >;
} ;

} ;
} ;

When I type hwclock

hwclock: can't open '/dev/misc/rtc': No such file or directory...

Also the command hwclock --version gives me:

BusyBox v1.22.1 (2014-11-05 14:23:49 EST) multi-call binary.

Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-t|--systz] [-l|--localtime] [-u|--utc] [-f|--rtc FILE]

Query and set hardware clock (RTC)

-r Show hardware clock time
-s Set system time from hardware clock
-w Set hardware clock from system time
-t Set in-kernel timezone, correct system time
if hardware clock is in local time
-u Assume hardware clock is kept in UTC
-l Assume hardware clock is kept in local time
-f FILE Use specified device (e.g. /dev/rtc2)

And also in /dev I don't even have rtc. The only place where I have it is ./sys/class/rtc.

Can someone tell me how to change my device tree in order to enable RTC?

Thank you in advance,

John

asigint's picture
asigint
Junior(0)
Need to have an I2C section

All your errors say that the kernal is not aware of any I2C.

You need to have an I2C section in the devicetree.

I find that truly knowing what should be in a devicetree is not easy, so I always try to start with something known good and modify to look like what others say work. However, there are some things to watch out for:

1) devicetree format is tied to your kernel version. The format doesn't change often, but there is a change somewhere between 3.8 and 3.14 that is significant. I'm using 3.14, so mine matches that format.
2) Xilinx has a devicetree generator. You can find info on how to use it on their Wiki. When you use it in the SDK, it does a pretty good job of correctly adding peripherals like i2c. It does not do a good job of helping you configure a RTC (or even configure your Ethernet chip fully). So I use it as a starting point, and then compare with a known good devicetree that shipped with my Zed board.
3) Make sure your hardware build has I2C enabled. For me with the microZed, I had to enable it.
4) Make sure you generate a new FSBL if you change the hardware.

The bottom line, your tree looks enough like mine that assuming I2C is enabled in your BIT file, you probably can just past my I2C section into your devicetree.

john3's picture
john3
Junior(0)
hardware build

Thank you for your reply. Can you please tell me how to check if my hardware build has I2C enabled? I am booting my zedboard by using uImage, devicetree.dtb, uradisk.image.gz and BOOT.BIN....BOOT.BIN that I am using is the one I am getting with petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga pre-built/linux/implementation/download.bit --uboot.. Namely I am using download.bit from pre-built folder i.e. I did not use Vivado for its generation.

asigint's picture
asigint
Junior(0)
I don't use Petalinux...I

I don't use Petalinux...I find it strives to simplify things by hiding to many critical settings.

I can't speak for the Zedboard, but I know the microZed does not have I2C enabled for any of their factory images (likely since the microZed alone doesn't need I2C).

I would start by looking through the Zedboard getting started guide to see if any of their examples use I2C.

There are also full reference designs available on this website. If you download the right one for your board, and open it in Vivado, it's pretty easy to see if I2C is enabled, and pretty easy to enable if it isn't.

asigint's picture
asigint
Junior(0)
zedboard

actually, looking back at your post, if the zedboard has an RTC, it is very likely I2C controlled, and very likely the factory images (available in the download section here) support it. I would start by downloading those and verifying I2C and your RTC work. Then start making small changes.