您尚未登录。

楼主 #1 2020-10-19 09:57:45

jkl
会员
注册时间: 2019-11-18
已发帖子: 265
积分: 148.5

请问一下,X3开发板的内置RTC怎么使用,我添加了以下配置,连设备rtc0设备都没有生成???

RTC debug support                                                                                                                           
  *   RTC non volatile storage support                                                                                                             
   *** RTC interfaces ***                                                                                                                       
  *   /sys/class/rtc/rtcN (sysfs)                                                                                                                 
  *   /proc/driver/rtc (procfs for rtcN)                                                                                                           
  *  /dev/rtcN (character devices)                                                                                                               
   *** on-CPU RTC drivers ***                                                                                                                   
   *   Allwinner A31 RTC                                                                                                                             
   < >   Faraday Technology FTRTC010 RTC                                                                                                             
  < >   Freescale SNVS RTC support                                                                                                                   
   < >   EPSON TOYOCOM RTC-7301SF/DG                                                                                                                 


log:
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.20.0-dirty (root@le-desktop) (gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)) #60 SMP Sat Oct 17 14:43:06 CST 2020
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Sinlinx SinA33
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Reserved 16 MiB at 0x45c00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: Using PSCI v0.1 Function IDs from DT
[    0.000000] random: get_random_bytes called from start_kernel+0xa0/0x3f4 with crng_init=0
[    0.000000] percpu: Embedded 16 pages/cpu @(ptrval) s34444 r8192 d22900 u65536
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32046
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait panic=10
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Memory: 101432K/129196K available (6144K kernel code, 352K rwdata, 1564K rodata, 1024K init, 242K bss, 11380K reserved, 16384K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc8000000 - 0xff800000   ( 888 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc7e2b000   ( 126 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 353 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 243 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000014] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000041] Switching to timer-based delay loop, resolution 41ns
[    0.000844] Console: colour dummy device 80x30
[    0.000939] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.000971] pid_max: default: 32768 minimum: 301
[    0.001316] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.001348] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.002652] CPU: Testing write buffer coherency: ok
[    0.003406] /cpus/cpu@0 missing clock-frequency property
[    0.003451] /cpus/cpu@1 missing clock-frequency property
[    0.003487] /cpus/cpu@2 missing clock-frequency property
[    0.003523] /cpus/cpu@3 missing clock-frequency property
[    0.003550] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.004629] Setting up static identity map for 0x40100000 - 0x40100060
[    0.004915] rcu: Hierarchical SRCU implementation.
[    0.006383] smp: Bringing up secondary CPUs ...
[    0.007876] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.009601] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.011283] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.011472] smp: Brought up 1 node, 4 CPUs
[    0.011520] SMP: Total of 4 processors activated (192.00 BogoMIPS).
[    0.011535] CPU: All CPU(s) started in HYP mode.
[    0.011548] CPU: Virtualization extensions available.
[    0.013312] devtmpfs: initialized
[    0.026257] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.026688] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.026739] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.028532] pinctrl core: initialized pinctrl subsystem
[    0.030568] NET: Registered protocol family 16
[    0.033344] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.035500] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.035525] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.066962] SCSI subsystem initialized
[    0.067383] usbcore: registered new interface driver usbfs
[    0.067486] usbcore: registered new interface driver hub
[    0.067655] usbcore: registered new device driver usb
[    0.068108] pps_core: LinuxPPS API ver. 1 registered
[    0.068127] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.068172] PTP clock support registered
[    0.068613] Advanced Linux Sound Architecture Driver Initialized.
[    0.070386] clocksource: Switched to clocksource arch_sys_counter
[    0.071652] simple-framebuffer 47e2b000.framebuffer: framebuffer at 0x47e2b000, 0x1d4c00 bytes, mapped to 0x(ptrval)
[    0.071687] simple-framebuffer 47e2b000.framebuffer: format=x8r8g8b8, mode=800x600x32, linelength=3200
[    0.091193] Console: switching to colour frame buffer device 100x37
[    0.108262] simple-framebuffer 47e2b000.framebuffer: fb0: simplefb registered!
[    0.124277] NET: Registered protocol family 2
[    0.125445] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
[    0.125504] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.125557] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    0.125609] TCP: Hash tables configured (established 1024 bind 1024)
[    0.125832] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.125923] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.126338] NET: Registered protocol family 1
[    0.127526] RPC: Registered named UNIX socket transport module.
[    0.127554] RPC: Registered udp transport module.
[    0.127569] RPC: Registered tcp transport module.
[    0.127582] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.131230] Initialise system trusted keyrings
[    0.131641] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.147164] NFS: Registering the id_resolver key type
[    0.147237] Key type id_resolver registered
[    0.147254] Key type id_legacy registered
[    0.147337] jffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
[    0.153969] Key type asymmetric registered
[    0.154002] Asymmetric key parser 'x509' registered
[    0.154154] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    0.154178] io scheduler noop registered
[    0.154568] io scheduler cfq registered (default)
[    0.156924] sun4i-usb-phy 1c19400.phy: Linked as a consumer to regulator.3
[    0.159152] sun8i-a23-r-pinctrl 1f02c00.pinctrl: Reset controller missing
[    0.165517] sun8i-a33-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.273513] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.278438] printk: console [ttyS0] disabled
[    0.298782] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 37, base_baud = 1500000) is a U6_16550A
[    0.979965] printk: console [ttyS0] enabled
[    0.993221] drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 429 ili9881c_dsi_probe
[    1.000905] ili9881c-dsi 1ca0000.dsi.0: Linked as a consumer to regulator.2
[    1.007876] drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 445 ili9881c_dsi_probe
[    1.015360] ili9881c-dsi 1ca0000.dsi.0: Couldn't get our reset GPIO
[    1.021826] ili9881c-dsi 1ca0000.dsi.0: Dropping the link to regulator.2
[    1.033633] libphy: Fixed MDIO Bus: probed
[    1.037756] CAN device driver interface
[    1.043364] usbcore: registered new interface driver r8152
[    1.048943] usbcore: registered new interface driver cdc_ether
[    1.054926] usbcore: registered new interface driver cdc_eem
[    1.060687] usbcore: registered new interface driver dm9601
[    1.066323] usbcore: registered new interface driver rndis_host
[    1.072406] usbcore: registered new interface driver cdc_ncm
[    1.078071] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.084635] ehci-platform: EHCI generic platform driver
[    1.090277] ehci-platform 1c1a000.usb: EHCI Host Controller
[    1.095952] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    1.104876] ehci-platform 1c1a000.usb: irq 28, io mem 0x01c1a000
[    1.140402] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    1.148198] hub 1-0:1.0: USB hub found
[    1.152094] hub 1-0:1.0: 1 port detected
[    1.157138] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.163404] ohci-platform: OHCI generic platform driver
[    1.169058] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    1.175765] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[    1.183913] ohci-platform 1c1a400.usb: irq 29, io mem 0x01c1a400
[    1.255852] hub 2-0:1.0: USB hub found
[    1.259696] hub 2-0:1.0: 1 port detected
[    1.264929] usbcore: registered new interface driver cdc_wdm
[    1.270818] usbcore: registered new interface driver usb-storage
[    1.277508] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.288383] usb_phy_generic usb_phy_generic.0.auto: Linked as a consumer to regulator.0
[    1.299215] drivers/rtc/rtc-sun6i.c 521 sun6i_rtc_probe
[    1.304679] i2c /dev entries driver
[    1.313574] sunxi-mmc 1c0f000.mmc: Linked as a consumer to regulator.2
[    1.360421] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[    1.368028] sunxi-mmc 1c10000.mmc: Linked as a consumer to regulator.2
[    1.375734] sunxi-mmc 1c10000.mmc: allocated mmc-pwrseq
[    1.420430] sunxi-mmc 1c10000.mmc: initialized, max. request size: 16384 KB
[    1.428074] sunxi-mmc 1c11000.mmc: Linked as a consumer to regulator.2
[    1.470431] sunxi-mmc 1c11000.mmc: initialized, max. request size: 16384 KB
[    1.479594] usbcore: registered new interface driver usbhid
[    1.485213] usbhid: USB HID core driver
[    1.490621] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    1.496817] NET: Registered protocol family 17
[    1.497851] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.501364] can: controller area network core (rev 20170425 abi 9)
[    1.508383] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.513198] NET: Registered protocol family 29
[    1.521338] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    1.522985] can: raw protocol (rev 20170425)
[    1.528480] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.532731] can: broadcast manager protocol (rev 20170425 t)
[    1.532753] can: netlink gateway (rev 20170425) max_hops=1
[    1.533281] Key type dns_resolver registered
[    1.543940] mmc1: queuing unknown CIS tuple 0x81 (9 bytes)
[    1.546662] Registering SWP/SWPB emulation handler
[    1.552255] mmc0: new high speed SDHC card at address aaaa
[    1.571302] Loading compiled-in X.509 certificates
[    1.573179] mmcblk0: mmc0:aaaa SS08G 7.40 GiB
[    1.585973]  mmcblk0: p1 p2
[    1.593805] sun8i-a23-r-pinctrl 1f02c00.pinctrl: initialized sunXi PIO driver
[    1.602957] drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 429 ili9881c_dsi_probe
[    1.610587] ili9881c-dsi 1ca0000.dsi.0: Linked as a consumer to regulator.2
[    1.617557] drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 445 ili9881c_dsi_probe
[    1.624129] random: fast init done
[    1.625099] drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 451 ili9881c_dsi_probe
[    1.635765] drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 462 ili9881c_dsi_probe
[    1.643179] drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 470 ili9881c_dsi_probe
[    1.645618] mmc2: new DDR MMC card at address 0001
[    1.650608] sun6i-mipi-dsi 1ca0000.dsi: Attached device lhr050h41
[    1.660971] gpio gpiochip1: (1f02c00.pinctrl): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[    1.662840] mmcblk2: mmc2:0001 8GTF4R 7.28 GiB
[    1.671646] sun8i-a23-r-pinctrl 1f02c00.pinctrl: unable to lock HW IRQ 5 for IRQ
[    1.676978] mmcblk2boot0: mmc2:0001 8GTF4R partition 1 4.00 MiB
[    1.683593] genirq: Failed to request resources for tsc2007 (irq 125) on irqchip sunxi_pio_edge
[    1.683803] tsc2007 0-0048: Failed to request irq 125: -5
[    1.690421] mmcblk2boot1: mmc2:0001 8GTF4R partition 2 4.00 MiB
[    1.698569] tsc2007: probe of 0-0048 failed with error -5
[    1.705727]  mmcblk2: p1 p2
[    1.724030] asoc-simple-card sound: sun8i <-> 1c22c00.dai mapping ok
[    1.737812] vcc3v0: disabling
[    1.740877] ALSA device list:
[    1.743854]   #0: sun8i-a33-audio
[    1.753567] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[    1.753907] mmc1: new high speed SDIO card at address 0001
[    1.760933] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[    1.829585] EXT4-fs (mmcblk0p2): recovery complete
[    1.836913] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.845141] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.854388] devtmpfs: mounted
[    1.860133] Freeing unused kernel memory: 1024K
[    1.865074] Run /sbin/init as init process
[    1.930490] usb 2-1: new full-speed USB device number 2 using ohci-platform
[    1.952868] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)


设备树节点:
rtc: rtc@1f00000 {
            compatible = "allwinner,sun8i-a23-rtc";
            reg = <0x01f00000 0x400>;
            interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
                     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
            clock-output-names = "osc32k", "osc32k-out";
            clocks = <&ext_osc32k>;
            #clock-cells = <1>;
        };

离线

#2 2020-10-19 10:04:17

孤星泪
会员
注册时间: 2020-03-18
已发帖子: 235
积分: 231

Re: 请问一下,X3开发板的内置RTC怎么使用,我添加了以下配置,连设备rtc0设备都没有生成???

[    1.299215] drivers/rtc/rtc-sun6i.c 521 sun6i_rtc_probe



注册设备那地方加一些调试语句

离线

楼主 #3 2020-10-19 10:25:39

jkl
会员
注册时间: 2019-11-18
已发帖子: 265
积分: 148.5

Re: 请问一下,X3开发板的内置RTC怎么使用,我添加了以下配置,连设备rtc0设备都没有生成???

孤星泪 说:

[    1.299215] drivers/rtc/rtc-sun6i.c 521 sun6i_rtc_probe



注册设备那地方加一些调试语句

感觉是驱动不对,在probe函数的第二个printk之前就死了!
static int sun6i_rtc_probe(struct platform_device *pdev)
{
    struct sun6i_rtc_dev *chip = sun6i_rtc;
    int ret;
    printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__);
    if (!chip)
        return -ENODEV;

    platform_set_drvdata(pdev, chip);
    chip->dev = &pdev->dev;
    printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__);
    chip->irq = platform_get_irq(pdev, 0);
    if (chip->irq < 0) {
        dev_err(&pdev->dev, "No IRQ resource\n");
        return chip->irq;
    }
    printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__);
    ret = devm_request_irq(&pdev->dev, chip->irq, sun6i_rtc_alarmirq,
                   0, dev_name(&pdev->dev), chip);
    if (ret) {
        dev_err(&pdev->dev, "Could not request IRQ\n");
        return ret;
    }
    printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__);
    /* clear the alarm counter value */
    writel(0, chip->base + SUN6I_ALRM_COUNTER);

    /* disable counter alarm */
    writel(0, chip->base + SUN6I_ALRM_EN);

    /* disable counter alarm interrupt */
    writel(0, chip->base + SUN6I_ALRM_IRQ_EN);

    /* disable week alarm */
    writel(0, chip->base + SUN6I_ALRM1_EN);

    /* disable week alarm interrupt */
    writel(0, chip->base + SUN6I_ALRM1_IRQ_EN);

    /* clear counter alarm pending interrupts */
    writel(SUN6I_ALRM_IRQ_STA_CNT_IRQ_PEND,
           chip->base + SUN6I_ALRM_IRQ_STA);

    /* clear week alarm pending interrupts */
    writel(SUN6I_ALRM1_IRQ_STA_WEEK_IRQ_PEND,
           chip->base + SUN6I_ALRM1_IRQ_STA);

    /* disable alarm wakeup */
    writel(0, chip->base + SUN6I_ALARM_CONFIG);
    printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__);
    clk_prepare_enable(chip->losc);
    printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__);
    chip->rtc = devm_rtc_device_register(&pdev->dev, "rtc-sun6i",
                         &sun6i_rtc_ops, THIS_MODULE);
    if (IS_ERR(chip->rtc)) {
        dev_err(&pdev->dev, "unable to register device\n");
        return PTR_ERR(chip->rtc);
    }
    printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__);
    dev_info(&pdev->dev, "RTC enabled\n");

    return 0;
}

离线

#4 2020-10-19 10:48:41

孤星泪
会员
注册时间: 2020-03-18
已发帖子: 235
积分: 231

Re: 请问一下,X3开发板的内置RTC怎么使用,我添加了以下配置,连设备rtc0设备都没有生成???

那可能是同文件夹下面的全志其他rtc驱动程序?

离线

楼主 #5 2020-10-19 11:08:42

jkl
会员
注册时间: 2019-11-18
已发帖子: 265
积分: 148.5

Re: 请问一下,X3开发板的内置RTC怎么使用,我添加了以下配置,连设备rtc0设备都没有生成???

孤星泪 说:

那可能是同文件夹下面的全志其他rtc驱动程序?

我使用的是主线的内核4.20的,目录下支持的RTC驱动的兼容属性:
rtc-sun6i:
{ .compatible = "allwinner,sun6i-a31-rtc" },

rtc-sunxi:
{ .compatible = "allwinner,sun4i-a10-rtc", .data = &data_year_param[0] },
{ .compatible = "allwinner,sun7i-a20-rtc", .data = &data_year_param[1] },
没有a33或者a23的兼容属性,这是不是代表目前主线还不支持X3芯片内置的RTC了,那就需要移植了,请问您有什么好的建议吗?

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn