This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3352: RTC scratch registers access

Part Number: AM3352

Hi,

I was trying to read scratch registers from rtc_omap platform driver by adding the ioctl call for scratch0 register read; and write a userspace program to get value from scratch0 register.

But, I always get the value as 0. Can you kindly provide me some hints by which I can read the rtc scratch registers from userspace ?

P.S: sysfs entries for scratch registers are not available from kernel 4.15 iirc.

  • I just saw that the sysfs entry for the scratch register0 is now at, /sys/bus/nvmem/devices/omap_rtc_scratch0/nvmem

    Now, I'd like to read and write to this file named nvmem, can you kindly let me know how can I do that ?
    It would be great if you can provide me some links to the documentation of the same.

    Since the boot count is saved in nvmem, I'd like to read the boot count from userspace program.

  • Hi Moses,

    To be able to access RTC registers, check if:

    - RTC poiwer domain is ON

    - RTC module clock is active

    - Kicker mechanism is configured properly

    You can access RTC registers from user space with devmem2 command or application that is based on devmem2.c source code. Refer to below pointers for details:

    https://e2e.ti.com/support/processors/f/791/t/837040

    https://e2e.ti.com/support/processors/f/791/t/269019

    Regards,
    Pavel

  • Pavel,

    I tried using devmem2 to read the rtc scratch registers, but it complained that the operation is not permitted.

    sudo ./devmem2 0x44e3e060
    /dev/mem opened.
    Error at line 75, file devmem2.c (1) [Operation not permitted]
    

    Can you kindly let me know, if I need to make any changes to the rtc_omap.c driver to read the register values using devmem2 ?

  • Moses,

    This is what I have on TMDSSK3358 board with AM335x PSDK Linux v6.01 (kernel 4.19.59), prebuilt images

    http://software-dl.ti.com/processor-sdk-linux/esd/AM335X/latest/index_FDS.html

    root@am335x-evm:~# devmem2 0x44e3e060
    /dev/mem opened.
    Memory mapped at address 0xb6fcd000.
    Read at address  0x44E3E060 (0xb6fcd060): 0x8010E8EC
    root@am335x-evm:~# devmem2 0x44e3e064
    /dev/mem opened.
    Memory mapped at address 0xb6f63000.
    Read at address  0x44E3E064 (0xb6f63064): 0x00000000
    root@am335x-evm:~# devmem2 0x44e3e068
    /dev/mem opened.
    Memory mapped at address 0xb6f81000.
    Read at address  0x44E3E068 (0xb6f81068): 0x010001B0

    Please explore CM_RTC, PRM_RTC and RTCSS registers and compare the values between your custom kernel and TI official kernel (the one that comes with PSDK Linux).

    You can also explore the TI kernel boot up log (attached below), with focus on RTC messages and compare with your custom kernel.


    root@am335x-evm:~# uname -a
    Linux am335x-evm 4.19.59-g5f8c1c6121 #1 PREEMPT Sat Oct 19 17:17:25 UTC 2019 armv7l GNU/Linux
    root@am335x-evm:~# dmesg
    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Linux version 4.19.59-g5f8c1c6121 (oe-user@oe-host) (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #1 PREEMPT Sat Oct 19 17:17:25 UTC 2019
    [    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] OF: fdt: Machine model: TI AM335x EVM-SK
    [    0.000000] Memory policy: Data cache writeback
    [    0.000000] efi: Getting EFI parameters from FDT:
    [    0.000000] efi: UEFI not found.
    [    0.000000] cma: Reserved 48 MiB at 0x8a800000
    [    0.000000] On node 0 totalpages: 65536
    [    0.000000]   Normal zone: 576 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 65536 pages, LIFO batch:15
    [    0.000000] CPU: All CPU(s) started in SVC mode.
    [    0.000000] AM335X ES2.1 (sgx neon)
    [    0.000000] random: get_random_bytes called from start_kernel+0xa4/0x434 with crng_init=0
    [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    [    0.000000] pcpu-alloc: [0] 0 
    [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
    [    0.000000] Kernel command line: console=ttyO0,115200n8 root=PARTUUID=8150b2b3-02 rw rootfstype=ext4 rootwait
    [    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
    [    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
    [    0.000000] Memory: 196296K/262144K available (9216K kernel code, 309K rwdata, 2692K rodata, 1024K init, 253K bss, 16696K reserved, 49152K cma-reserved, 0K highmem)
    [    0.000000] Virtual kernel memory layout:
                       vector  : 0xffff0000 - 0xffff1000   (   4 kB)
                       fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
                       vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
                       lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
                       pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
                       modules : 0xbf000000 - 0xbfe00000   (  14 MB)
                         .text : 0x(ptrval) - 0x(ptrval)   (10208 kB)
                         .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
                         .data : 0x(ptrval) - 0x(ptrval)   ( 310 kB)
                          .bss : 0x(ptrval) - 0x(ptrval)   ( 254 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] rcu: Preemptible hierarchical RCU implementation.
    [    0.000000] 	Tasks RCU enabled.
    [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    [    0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
    [    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [    0.000015] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [    0.000032] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [    0.000042] OMAP clocksource: timer1 at 24000000 Hz
    [    0.000209] timer_probe: no matching timers found
    [    0.000395] Console: colour dummy device 80x30
    [    0.000423] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [    0.000429] This ensures that you still see kernel messages. Please
    [    0.000434] update your kernel commandline.
    [    0.000487] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
    [    0.089167] pid_max: default: 32768 minimum: 301
    [    0.089356] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.089370] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.090168] CPU: Testing write buffer coherency: ok
    [    0.090235] CPU0: Spectre v2: using BPIALL workaround
    [    0.091100] Setting up static identity map for 0x80100000 - 0x80100060
    [    0.091249] rcu: Hierarchical SRCU implementation.
    [    0.091582] EFI services will not be available.
    [    0.092843] devtmpfs: initialized
    [    0.100486] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [    0.100869] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.100894] futex hash table entries: 256 (order: -1, 3072 bytes)
    [    0.104560] pinctrl core: initialized pinctrl subsystem
    [    0.105326] DMI not present or invalid.
    [    0.105760] NET: Registered protocol family 16
    [    0.108053] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [    0.126477] l4_wkup_cm:clk:0010:0: failed to disable
    [    0.179046] cpuidle: using governor ladder
    [    0.179079] cpuidle: using governor menu
    [    0.183709] gpio gpiochip0: (gpio-0-31): added GPIO chardev (254:0)
    [    0.183809] gpiochip_setup_dev: registered GPIOs 0 to 31 on device: gpiochip0 (gpio-0-31)
    [    0.183855] OMAP GPIO hardware version 0.1
    [    0.184607] gpio gpiochip1: (gpio-32-63): added GPIO chardev (254:1)
    [    0.184701] gpiochip_setup_dev: registered GPIOs 32 to 63 on device: gpiochip1 (gpio-32-63)
    [    0.185432] gpio gpiochip2: (gpio-64-95): added GPIO chardev (254:2)
    [    0.185502] gpiochip_setup_dev: registered GPIOs 64 to 95 on device: gpiochip2 (gpio-64-95)
    [    0.186182] gpio gpiochip3: (gpio-96-127): added GPIO chardev (254:3)
    [    0.186251] gpiochip_setup_dev: registered GPIOs 96 to 127 on device: gpiochip3 (gpio-96-127)
    [    0.193381] No ATAGs?
    [    0.193400] hw-breakpoint: debug architecture 0x4 unsupported.
    [    0.206432] edma 49000000.edma: TI EDMA DMA engine driver
    [    0.207043] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixedregulator0[0]'
    [    0.207370] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixedregulator1[0]'
    [    0.207653] of_get_named_gpiod_flags: parsed 'gpio' property of node '/fixedregulator3[0]' - status (0)
    [    0.207972] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixedregulator-v1_8d[0]'
    [    0.208000] v1_8d: supplied by vbat
    [    0.208257] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixedregulator-v3_3d[0]'
    [    0.208280] v3_3d: supplied by vbat
    [    0.210942] SCSI subsystem initialized
    [    0.211407] media: Linux media interface: v0.10
    [    0.211458] videodev: Linux video capture interface: v2.00
    [    0.211546] pps_core: LinuxPPS API ver. 1 registered
    [    0.211554] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [    0.211576] PTP clock support registered
    [    0.211610] EDAC MC: Ver: 3.0.0
    [    0.212707] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [    0.213373] Advanced Linux Sound Architecture Driver Initialized.
    [    0.214596] clocksource: Switched to clocksource timer1
    [    0.222514] NET: Registered protocol family 2
    [    0.223334] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
    [    0.223363] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.223388] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.223411] TCP: Hash tables configured (established 2048 bind 2048)
    [    0.223519] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [    0.223538] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [    0.223681] NET: Registered protocol family 1
    [    0.224285] RPC: Registered named UNIX socket transport module.
    [    0.224299] RPC: Registered udp transport module.
    [    0.224305] RPC: Registered tcp transport module.
    [    0.224311] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.224326] PCI: CLS 0 bytes, default 64
    [    0.225362] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
    [    0.226639] Initialise system trusted keyrings
    [    0.227016] workingset: timestamp_bits=14 max_order=16 bucket_order=2
    [    0.231255] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [    0.232041] NFS: Registering the id_resolver key type
    [    0.232085] Key type id_resolver registered
    [    0.232092] Key type id_legacy registered
    [    0.232133] ntfs: driver 2.1.32 [Flags: R/O].
    [    0.234304] Key type asymmetric registered
    [    0.234323] Asymmetric key parser 'x509' registered
    [    0.234405] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
    [    0.234418] io scheduler noop registered
    [    0.234425] io scheduler deadline registered
    [    0.234792] io scheduler cfq registered (default)
    [    0.234807] io scheduler mq-deadline registered
    [    0.234815] io scheduler kyber registered
    [    0.236615] pinctrl-single 44e10800.pinmux: 142 pins, size 568
    [    0.239922] pwm-backlight backlight: GPIO lookup for consumer enable
    [    0.239935] pwm-backlight backlight: using device tree for GPIO lookup
    [    0.239959] of_get_named_gpiod_flags: can't parse 'enable-gpios' property of node '/backlight[0]'
    [    0.239972] of_get_named_gpiod_flags: can't parse 'enable-gpio' property of node '/backlight[0]'
    [    0.239982] pwm-backlight backlight: using lookup tables for GPIO lookup
    [    0.239989] pwm-backlight backlight: No GPIO consumer enable found
    [    0.240016] pwm-backlight backlight: backlight supply power not found, using dummy regulator
    [    0.240116] pwm-backlight backlight: Linked as a consumer to regulator.0
    [    0.284817] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
    [    0.288618] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a 8250
    [    0.928050] console [ttyS0] enabled
    [    0.933878] omap_rng 48310000.rng: Random Number Generator ver. 20
    [    0.940276] random: fast init done
    [    0.943908] random: crng init done
    [    0.948806] tilcdc-panel panel: found backlight
    [    0.953369] tilcdc-panel panel: GPIO lookup for consumer enable
    [    0.953375] tilcdc-panel panel: using device tree for GPIO lookup
    [    0.953398] of_get_named_gpiod_flags: can't parse 'enable-gpios' property of node '/panel[0]'
    [    0.953412] of_get_named_gpiod_flags: can't parse 'enable-gpio' property of node '/panel[0]'
    [    0.953421] tilcdc-panel panel: using lookup tables for GPIO lookup
    [    0.953429] tilcdc-panel panel: No GPIO consumer enable found
    [    0.953682] OF: graph: no port node found in /ocp/lcdc@4830e000
    [    0.960595] OF: graph: no port node found in /ocp/lcdc@4830e000
    [    0.967095] OF: graph: no port node found in /ocp/lcdc@4830e000
    [    0.973062] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
    [    0.979747] [drm] No driver support for vblank timestamp query.
    [    1.030657] Console: switching to colour frame buffer device 60x34
    [    1.054505] tilcdc 4830e000.lcdc: fb0: DRM emulated frame buffer device
    [    1.061773] [drm] Initialized tilcdc 1.0.0 20121205 for 4830e000.lcdc on minor 0
    [    1.081266] brd: module loaded
    [    1.091373] loop: module loaded
    [    1.097227] mdio_bus fixed-0: GPIO lookup for consumer reset
    [    1.097239] mdio_bus fixed-0: using lookup tables for GPIO lookup
    [    1.097246] mdio_bus fixed-0: No GPIO consumer reset found
    [    1.097268] libphy: Fixed MDIO Bus: probed
    [    1.117474] mdio_bus 4a101000.mdio: GPIO lookup for consumer reset
    [    1.117486] mdio_bus 4a101000.mdio: using device tree for GPIO lookup
    [    1.117512] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/ethernet@4a100000/mdio@4a101000[0]'
    [    1.117527] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/ethernet@4a100000/mdio@4a101000[0]'
    [    1.117536] mdio_bus 4a101000.mdio: using lookup tables for GPIO lookup
    [    1.117543] mdio_bus 4a101000.mdio: No GPIO consumer reset found
    [    1.174651] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
    [    1.182354] davinci_mdio 4a101000.mdio: detected phy mask fffffffc
    [    1.190461] libphy: 4a101000.mdio: probed
    [    1.194507] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver Atheros 8031 ethernet
    [    1.203920] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver Atheros 8031 ethernet
    [    1.214167] cpsw 4a100000.ethernet: Detected MACID = c8:a0:30:a1:ce:56
    [    1.221008] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
    [    1.227474] cpsw 4a100000.ethernet: ALE Table size 1024
    [    1.232763] cpsw 4a100000.ethernet: cpts: overflow check period 500 (jiffies)
    [    1.240803] cpsw 4a100000.ethernet: cpsw: Detected MACID = c8:a0:30:a1:ce:58
    [    1.249292] i2c /dev entries driver
    [    1.254887] cpuidle: enable-method property 'ti,am3352' found operations
    [    1.262099] sdhci: Secure Digital Host Controller Interface driver
    [    1.268358] sdhci: Copyright(c) Pierre Ossman
    [    1.273350] omap_hsmmc 48060000.mmc: GPIO lookup for consumer cd
    [    1.273359] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [    1.273401] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/ocp/mmc@48060000[0]' - status (0)
    [    1.273424] gpio gpiochip0: Persistence not supported for GPIO 6
    [    1.273438] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [    1.282246] omap_hsmmc 48060000.mmc: Got CD GPIO
    [    1.286901] omap_hsmmc 48060000.mmc: GPIO lookup for consumer wp
    [    1.286906] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [    1.286923] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp/mmc@48060000[0]'
    [    1.286936] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp/mmc@48060000[0]'
    [    1.286944] omap_hsmmc 48060000.mmc: using lookup tables for GPIO lookup
    [    1.286951] omap_hsmmc 48060000.mmc: No GPIO consumer wp found
    [    1.287821] omap_hsmmc 481d8000.mmc: GPIO lookup for consumer cd
    [    1.287831] omap_hsmmc 481d8000.mmc: using device tree for GPIO lookup
    [    1.287854] of_get_named_gpiod_flags: can't parse 'cd-gpios' property of node '/ocp/mmc@481d8000[0]'
    [    1.287866] of_get_named_gpiod_flags: can't parse 'cd-gpio' property of node '/ocp/mmc@481d8000[0]'
    [    1.287874] omap_hsmmc 481d8000.mmc: using lookup tables for GPIO lookup
    [    1.287881] omap_hsmmc 481d8000.mmc: No GPIO consumer cd found
    [    1.287889] omap_hsmmc 481d8000.mmc: GPIO lookup for consumer wp
    [    1.287894] omap_hsmmc 481d8000.mmc: using device tree for GPIO lookup
    [    1.287906] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp/mmc@481d8000[0]'
    [    1.287917] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp/mmc@481d8000[0]'
    [    1.287923] omap_hsmmc 481d8000.mmc: using lookup tables for GPIO lookup
    [    1.287929] omap_hsmmc 481d8000.mmc: No GPIO consumer wp found
    [    1.288515] sdhci-pltfm: SDHCI platform and OF driver helper
    [    1.295172] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led1[0]' - status (0)
    [    1.295242] gpio gpiochip1: Persistence not supported for GPIO 4
    [    1.295247] no flags found for gpios
    [    1.295393] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led2[0]' - status (0)
    [    1.295403] gpio gpiochip1: Persistence not supported for GPIO 5
    [    1.295407] no flags found for gpios
    [    1.295491] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led3[0]' - status (0)
    [    1.295500] gpio gpiochip1: Persistence not supported for GPIO 6
    [    1.295504] no flags found for gpios
    [    1.295593] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led4[0]' - status (0)
    [    1.295604] gpio gpiochip1: Persistence not supported for GPIO 7
    [    1.295607] no flags found for gpios
    [    1.296003] ledtrig-cpu: registered to indicate activity on CPUs
    [    1.307337] NET: Registered protocol family 10
    [    1.313294] Segment Routing with IPv6
    [    1.317204] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
    [    1.323854] NET: Registered protocol family 17
    [    1.328758] Key type dns_resolver registered
    [    1.333306] omap_voltage_late_init: Voltage driver support not added
    [    1.340646] Loading compiled-in X.509 certificates
    [    1.354591] of_get_named_gpiod_flags: parsed 'gpio' property of node '/fixedregulator2[0]' - status (0)
    [    1.384823] tps65910 0-002d: No interrupt support, no core IRQ
    [    1.390885] tps65910-gpio tps65910-gpio: ti,en-gpio-sleep not specified
    [    1.390923] gpiochip_find_base: found new base at 506
    [    1.391149] gpio gpiochip4: (tps65910): added GPIO chardev (254:4)
    [    1.391233] gpiochip_setup_dev: registered GPIOs 506 to 511 on device: gpiochip4 (tps65910)
    [    1.392671] vrtc: supplied by vbat
    [    1.399756] vio: supplied by vbat
    [    1.404517] vdd1: supplied by vbat
    [    1.409736] vdd2: supplied by vbat
    [    1.416298] vdig1: supplied by vbat
    [    1.421096] vdig2: supplied by vbat
    [    1.425902] vpll: supplied by vbat
    [    1.430581] vdac: supplied by vbat
    [    1.435284] vaux1: supplied by vbat
    [    1.440060] vaux2: supplied by vbat
    [    1.444842] vaux33: supplied by vbat
    [    1.449728] vmmc: supplied by vbat
    [    1.454406] vbb: supplied by vbat
    [    1.459412] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [    1.465430] cpu cpu0: Linked as a consumer to regulator.9
    [    1.470926] cpu cpu0: Dropping the link to regulator.9
    [    1.476419] cpu cpu0: Linked as a consumer to regulator.9
    [    1.483273] omap_hsmmc 48060000.mmc: GPIO lookup for consumer cd
    [    1.483285] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [    1.483327] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/ocp/mmc@48060000[0]' - status (0)
    [    1.483352] gpio gpiochip0: Persistence not supported for GPIO 6
    [    1.483366] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [    1.492289] omap_hsmmc 48060000.mmc: Got CD GPIO
    [    1.496999] omap_hsmmc 48060000.mmc: GPIO lookup for consumer wp
    [    1.497004] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [    1.497023] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp/mmc@48060000[0]'
    [    1.497036] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp/mmc@48060000[0]'
    [    1.497046] omap_hsmmc 48060000.mmc: using lookup tables for GPIO lookup
    [    1.497054] omap_hsmmc 48060000.mmc: No GPIO consumer wp found
    [    1.497570] omap_hsmmc 48060000.mmc: Linked as a consumer to regulator.19
    [    1.532473] omap_hsmmc 481d8000.mmc: GPIO lookup for consumer cd
    [    1.532500] omap_hsmmc 481d8000.mmc: using device tree for GPIO lookup
    [    1.532558] of_get_named_gpiod_flags: can't parse 'cd-gpios' property of node '/ocp/mmc@481d8000[0]'
    [    1.532600] of_get_named_gpiod_flags: can't parse 'cd-gpio' property of node '/ocp/mmc@481d8000[0]'
    [    1.532623] omap_hsmmc 481d8000.mmc: using lookup tables for GPIO lookup
    [    1.532644] omap_hsmmc 481d8000.mmc: No GPIO consumer cd found
    [    1.532668] omap_hsmmc 481d8000.mmc: GPIO lookup for consumer wp
    [    1.532683] omap_hsmmc 481d8000.mmc: using device tree for GPIO lookup
    [    1.532722] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp/mmc@481d8000[0]'
    [    1.532760] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp/mmc@481d8000[0]'
    [    1.532779] omap_hsmmc 481d8000.mmc: using lookup tables for GPIO lookup
    [    1.532797] omap_hsmmc 481d8000.mmc: No GPIO consumer wp found
    [    1.533620] omap_hsmmc 481d8000.mmc: Linked as a consumer to regulator.6
    [    1.571945] mmc0: host does not support reading read-only switch, assuming write-enable
    [    1.581988] mmc0: new high speed SDHC card at address 0007
    [    1.588868] mmcblk0: mmc0:0007 SD8GB 7.42 GiB 
    [    1.596013]  mmcblk0: p1 p2
    [    1.651892] of_get_named_gpiod_flags: parsed 'gpios' property of node '/gpio_buttons0/switch1[0]' - status (0)
    [    1.652052] gpio gpiochip2: Persistence not supported for GPIO 3
    [    1.652419] of_get_named_gpiod_flags: parsed 'gpios' property of node '/gpio_buttons0/switch2[0]' - status (0)
    [    1.652453] gpio gpiochip2: Persistence not supported for GPIO 2
    [    1.652714] of_get_named_gpiod_flags: parsed 'gpios' property of node '/gpio_buttons0/switch3[0]' - status (0)
    [    1.652748] gpio gpiochip0: Persistence not supported for GPIO 30
    [    1.652981] of_get_named_gpiod_flags: parsed 'gpios' property of node '/gpio_buttons0/switch4[0]' - status (0)
    [    1.653013] gpio gpiochip2: Persistence not supported for GPIO 5
    [    1.653627] input: gpio_buttons0 as /devices/platform/gpio_buttons0/input/input0
    [    1.662423] hctosys: unable to open rtc device (rtc0)
    [    1.669031] lis3_reg: disabling
    [    1.672289] v1_8d: disabling
    [    1.675299] v3_3d: disabling
    [    1.678499] ALSA device list:
    [    1.681522] omap_hsmmc 481d8000.mmc: card claims to support voltages below defined range
    [    1.689735]   No soundcards found.
    [    1.707456] mmc1: new SDIO card at address 0001
    [    9.043225] EXT4-fs (mmcblk0p2): recovery complete
    [    9.052609] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    9.060977] VFS: Mounted root (ext4 filesystem) on device 179:2.
    [    9.081059] devtmpfs: mounted
    [    9.085693] Freeing unused kernel memory: 1024K
    [    9.090804] Run /sbin/init as init process
    [    9.625894] systemd[1]: System time before build time, advancing clock.
    [    9.691483] systemd[1]: systemd 239 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid)
    [    9.713796] systemd[1]: Detected architecture arm.
    [    9.756488] systemd[1]: Set hostname to <am335x-evm>.
    [   10.119050] systemd[1]: File /lib/systemd/system/systemd-journald.service:36 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
    [   10.136432] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
    [   10.230673] systemd[1]: /lib/systemd/system/gadget-init.service:15: Unknown lvalue 'ExecStopPre' in section 'Service'
    [   10.636041] systemd[1]: Listening on Network Service Netlink Socket.
    [   10.677747] systemd[1]: Created slice User and Session Slice.
    [   10.713481] systemd[1]: Created slice system-getty.slice.
    [   10.745598] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
    [   11.408149] cryptodev: loading out-of-tree module taints kernel.
    [   11.475182] cryptodev: driver 1.9 loaded.
    [   11.543951] usbcore: registered new interface driver usbfs
    [   11.601771] usbcore: registered new interface driver hub
    [   11.619299] usbcore: registered new device driver usb
    [   11.720230] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [   11.741238] usbcore: registered new interface driver ftdi_sio
    [   11.775230] usbserial: USB Serial support registered for FTDI USB Serial Device
    [   12.236914] systemd-journald[73]: Received request to flush runtime journal from PID 1
    [   15.185155] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [   15.200596] omap_rtc 44e3e000.rtc: char device (253:0)
    [   15.200633] omap_rtc 44e3e000.rtc: registered as rtc0
    [   15.360219] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/i2c@44e0b000/tlv320aic3106@1b[0]'
    [   15.360244] of_get_named_gpiod_flags: can't parse 'gpio-reset' property of node '/ocp/i2c@44e0b000/tlv320aic3106@1b[0]'
    [   15.360347] tlv320aic3x-codec 0-001b: Linked as a consumer to regulator.5
    [   15.469659] tlv320aic3x-codec 0-001b: Linked as a consumer to regulator.4
    [   16.515643] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
    [   16.560453] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
    [   16.687873] omap-aes 53500000.aes: will run requests pump with realtime priority
    [   17.086357] remoteproc remoteproc0: wkup_m3 is available
    [   17.122669] [drm] Initialized pvr 1.17.4948957 20110701 for 56000000.sgx on minor 1
    [   17.196200] remoteproc remoteproc0: powering up wkup_m3
    [   17.219001] PM: Cannot get wkup_m3_ipc handle
    [   17.262730] PM: Cannot get wkup_m3_ipc handle
    [   17.315940] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 242896
    [   17.324358] remoteproc remoteproc0: remote processor wkup_m3 is now up
    [   17.330937] wkup_m3_ipc 44e11324.wkup_m3_ipc: CM3 Firmware Version = 0x192
    [   18.171217] of_get_named_gpiod_flags: can't parse 'simple-audio-card,hp-det-gpio' property of node '/sound[0]'
    [   18.193658] of_get_named_gpiod_flags: can't parse 'simple-audio-card,mic-det-gpio' property of node '/sound[0]'
    [   18.218146] asoc-simple-card sound: tlv320aic3x-hifi <-> 4803c000.mcasp mapping ok
    [   18.404404] asoc-simple-card sound: ASoC: no DMI vendor name!
    [   18.438291] gpio gpiochip3: Persistence not supported for GPIO 21
    [   18.565396] PM: bootloader does not support rtc-only!
    [   20.275544] net eth0: initializing cpsw version 1.12 (0)
    [   20.536618] Atheros 8031 ethernet 4a101000.mdio:00: attached PHY driver [Atheros 8031 ethernet] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
    [   20.825752] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [   21.335363] net eth1: initializing cpsw version 1.12 (0)
    [   21.610092] Atheros 8031 ethernet 4a101000.mdio:01: attached PHY driver [Atheros 8031 ethernet] (mii_bus:phy_addr=4a101000.mdio:01, irq=POLL)
    [   21.832739] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
    [   25.803303] TI-am335x-tsc TI-am335x-tsc.0.auto: ti,charge-delay not specified
    [   25.888697] input: ti-tsc as /devices/platform/ocp/44e0d000.tscadc/TI-am335x-tsc.0.auto/input/input1
    [   26.645113] am335x-phy-driver 47401300.usb-phy: GPIO lookup for consumer reset
    [   26.645128] am335x-phy-driver 47401300.usb-phy: using device tree for GPIO lookup
    [   26.645162] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
    [   26.645177] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
    [   26.645187] am335x-phy-driver 47401300.usb-phy: using lookup tables for GPIO lookup
    [   26.645195] am335x-phy-driver 47401300.usb-phy: No GPIO consumer reset found
    [   26.645203] am335x-phy-driver 47401300.usb-phy: GPIO lookup for consumer vbus-detect
    [   26.645208] am335x-phy-driver 47401300.usb-phy: using device tree for GPIO lookup
    [   26.645221] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpios' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
    [   26.645233] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpio' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
    [   26.645239] am335x-phy-driver 47401300.usb-phy: using lookup tables for GPIO lookup
    [   26.645245] am335x-phy-driver 47401300.usb-phy: No GPIO consumer vbus-detect found
    [   26.645378] am335x-phy-driver 47401300.usb-phy: 47401300.usb-phy supply vcc not found, using dummy regulator
    [   26.778648] am335x-phy-driver 47401300.usb-phy: Linked as a consumer to regulator.0
    [   26.876780] musb-hdrc musb-hdrc.0: MUSB HDRC host driver
    [   26.882166] musb-hdrc musb-hdrc.0: new USB bus registered, assigned bus number 1
    [   26.893437] am335x-phy-driver 47401b00.usb-phy: GPIO lookup for consumer reset
    [   26.893452] am335x-phy-driver 47401b00.usb-phy: using device tree for GPIO lookup
    [   26.893482] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
    [   26.893497] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
    [   26.893507] am335x-phy-driver 47401b00.usb-phy: using lookup tables for GPIO lookup
    [   26.893515] am335x-phy-driver 47401b00.usb-phy: No GPIO consumer reset found
    [   26.893523] am335x-phy-driver 47401b00.usb-phy: GPIO lookup for consumer vbus-detect
    [   26.893528] am335x-phy-driver 47401b00.usb-phy: using device tree for GPIO lookup
    [   26.893541] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpios' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
    [   26.893553] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpio' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
    [   26.893560] am335x-phy-driver 47401b00.usb-phy: using lookup tables for GPIO lookup
    [   26.893565] am335x-phy-driver 47401b00.usb-phy: No GPIO consumer vbus-detect found
    [   26.893699] am335x-phy-driver 47401b00.usb-phy: 47401b00.usb-phy supply vcc not found, using dummy regulator
    [   27.051067] am335x-phy-driver 47401b00.usb-phy: Linked as a consumer to regulator.0
    [   27.085908] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
    [   27.181729] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [   27.243348] usb usb1: Product: MUSB HDRC host driver
    [   27.327616] usb usb1: Manufacturer: Linux 4.19.59-g5f8c1c6121 musb-hcd
    [   27.409649] usb usb1: SerialNumber: musb-hdrc.0
    [   27.456778] hub 1-0:1.0: USB hub found
    [   27.505042] hub 1-0:1.0: 1 port detected
    [   27.570957] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [   27.682519] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 2
    [   27.758758] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
    [   27.853662] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [   28.001267] remoteproc remoteproc1: 4a334000.pru is available
    [   28.007848] usb usb2: Product: MUSB HDRC host driver
    [   28.012869] usb usb2: Manufacturer: Linux 4.19.59-g5f8c1c6121 musb-hcd
    [   28.115304] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
    [   28.140904] usb usb2: SerialNumber: musb-hdrc.1
    [   28.165108] remoteproc remoteproc2: 4a338000.pru is available
    [   28.171051] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
    [   28.215436] hub 2-0:1.0: USB hub found
    [   28.220160] hub 2-0:1.0: 1 port detected
    [   40.227880] PVR_K: UM DDK-(4948957) and KM DDK-(4948957) match. [ OK ]
    [   40.496236] using random self ethernet address
    [   40.500773] using random host ethernet address
    [   40.516422] using host ethernet address: C8:A0:30:A1:CE:58
    [   40.516506] using random self ethernet address
    [   40.556600] using random host ethernet address
    [   40.563707] using host ethernet address: C8:A0:30:A1:CE:58
    [   40.586271] usb0: HOST MAC c8:a0:30:a1:ce:58
    [   40.639482] usb0: MAC ce:78:16:f0:5f:55
    [   40.698933] Mass Storage Function, version: 2009/09/11
    [   40.704126] LUN: removable file: (no medium)
    [   40.793319] LUN: removable read only file: /dev/mmcblk0p1
    [   40.821652] Number of LUNs=1
    [   40.840080] g_multi gadget: Multifunction Composite Gadget
    [   40.869149] g_multi gadget: g_multi ready
    [   40.995681] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
    [   41.431998] g_multi gadget: high-speed config #2: Multifunction with CDC ECM
    [   41.441031] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready
    [   44.576025] hrtimer: interrupt took 227416 ns
    root@am335x-evm:~# devmem2 0x44e3e060
    /dev/mem opened.
    Memory mapped at address 0xb6fcd000.
    Read at address  0x44E3E060 (0xb6fcd060): 0x8010E8EC
    root@am335x-evm:~# devmem2 0x44e3e064
    /dev/mem opened.
    Memory mapped at address 0xb6f63000.
    Read at address  0x44E3E064 (0xb6f63064): 0x00000000
    root@am335x-evm:~# devmem2 0x44e3e068
    /dev/mem opened.
    Memory mapped at address 0xb6f81000.
    Read at address  0x44E3E068 (0xb6f81068): 0x010001B0
    
    
    


    Regards,
    Pavel

  • Sure, Thanks for the hints.

    I actually wrote a small userspace program to read the nvmem file byte by byte, and I was able to read the scratch registers properly. Now, in order to write to the scratch registers, I've to write some fixed values to the kick registers and I've seen that the kick registers are being written with the proper values in am3352_rtc_unlock function in rtc-omap.c file. I'd like to know, if I can call this function from userspace by someway or I've to write the kick registers from my userspace program itself ?

    If I've to write to the kick registers from userspace, is there any sysfs entry to do the same ? Something under, /sys/class/rtc/rtc0/...

    I think, this is a generic problem, where we want to write something to the rtc general purpose registers and to do that we need to disable write protection. So, if we can do that through userspace that would be great to know. In 4.14 kernel this is possible, and we don't probably have to explicitly call unlock function or something.

  • Moses Christopher said:
    Now, in order to write to the scratch registers, I've to write some fixed values to the kick registers and I've seen that the kick registers are being written with the proper values in am3352_rtc_unlock function in rtc-omap.c file. I'd like to know, if I can call this function from userspace by someway or I've to write the kick registers from my userspace program itself ?

    I do not see how am3352_rtc_unlock() kernel function can be sued by user space. You will need to access kick registers with devmem2 tool or user space application that is based on devmem2.c


    Moses Christopher said:
    If I've to write to the kick registers from userspace, is there any sysfs entry to do the same ? Something under, /sys/class/rtc/rtc0/...

    I am not aware of such sysfs option. I can see we have omap_rtc_scratch0 folder, but I can not advice how and if this can be used.

    root@am335x-evm:/sys/class/rtc/rtc0/device/omap_rtc_scratch0# ls
    nvmem      of_node    power      subsystem  uevent

     

    Regards,
    Pavel

  • Pavel,

    Thanks for the prompt reply,

    I later saw the rtc-omap.c file and realized that during nvmem write the driver is calling rtc unlock function, which means, we don't have to do anything in userspace for writing the RTC Scratch Registers.
    Also, I wrote one simple userspace program to read and write the data to the Scratch Registers using the file operations on the nvmem file present in /sys/bus/nvmem/devices/omap_rtc_scratch0/nvmem, I think, this is the same file which you're referring to.

    Thanks for your support. :-)