Message ID | 20200820121323.564-2-linux.amoon@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Enable RTC on Odroid N2 | expand |
Anand Moon <linux.amoon@gmail.com> writes: > Enable RTC PCF8563 node on Odroid-N2 SBC, In order to > support the RTC wakealarm feature for suspend and resume. > Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 > timer device to prevent it being assigned to /dev/rtc0 > which disto userspace tools assume is a clock device. > > Cc: Neil Armstrong <narmstrong@baylibre.com> > Cc: Kevin Hilman <khilman@baylibre.com> > Suggested-by: Christian Hewitt <christianshewitt@gmail.com> > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > --- > Changes V3 > --Drop the INI GPIOAO.BIT7 pinctrl. Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to wakeup the system? If so, this should be included as part of this patch. It probably still works because the bootloader configures this GPIO as input, but the kernel should not rely on the booloader for that, so please include as part of this patch. Other than that, this is looking OK. Curious how you're testing this? When I tested with rtcwake (from buildroot), I'm getting this: / # rtcwake -d rtc0 -m mem -s4 rtcwake: RTC_RD_TIME: Invalid argument Kevin
Hi Kevin, Thanks for your review comments. On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: > > Anand Moon <linux.amoon@gmail.com> writes: > > > Enable RTC PCF8563 node on Odroid-N2 SBC, In order to > > support the RTC wakealarm feature for suspend and resume. > > Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 > > timer device to prevent it being assigned to /dev/rtc0 > > which disto userspace tools assume is a clock device. > > > > Cc: Neil Armstrong <narmstrong@baylibre.com> > > Cc: Kevin Hilman <khilman@baylibre.com> > > Suggested-by: Christian Hewitt <christianshewitt@gmail.com> > > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > > --- > > Changes V3 > > --Drop the INI GPIOAO.BIT7 pinctrl. > > Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to > wakeup the system? If so, this should be included as part of this > patch. > > It probably still works because the bootloader configures this GPIO as > input, but the kernel should not rely on the booloader for that, so > please include as part of this patch. > Ok I will figure out the correct pinctrl need for this settings. looking into the Odroid N2 schematics. > Other than that, this is looking OK. > > Curious how you're testing this? > > When I tested with rtcwake (from buildroot), I'm getting this: > > / # rtcwake -d rtc0 -m mem -s4 > rtcwake: RTC_RD_TIME: Invalid argument > > Kevin On my side I have tested on ArcLinux using mainline u-boot. # uname -a Linux archl-on2e 5.9.0-rc1-00105-gaabe42051eab #1 SMP PREEMPT Thu Aug 20 10:38:40 UTC 2020 aarch64 GNU/Linux # sudo hwclock --show 2020-08-21 10:12:09.964155+05:30 # timedatectl status Local time: Fri 2020-08-21 10:12:30 IST Universal time: Fri 2020-08-21 04:42:30 UTC RTC time: Fri 2020-08-21 04:42:32 Time zone: Asia/Kolkata (IST, +0530) System clock synchronized: yes NTP service: active RTC in local TZ: no # rtcwake -d rtc0 -m mem -s4 rtcwake: wakeup from "mem" using rtc0 at Fri Aug 21 04:20:33 2020 [ 113.003840] PM: suspend entry (deep) [ 113.004122] Filesystems sync: 0.000 seconds [ 113.386993] Freezing user space processes ... (elapsed 0.003 seconds) done. [ 113.391925] OOM killer disabled. [ 113.395132] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 113.405562] meson8b-dwmac ff3f0000.ethernet eth0: Link is Down [ 113.534222] Disabling non-boot CPUs ... [ 113.535014] CPU1: shutdown [ 113.535113] psci: CPU1 killed (polled 0 ms) [ 113.541518] CPU2: shutdown [ 113.541971] psci: CPU2 killed (polled 0 ms) [ 113.547949] CPU3: shutdown [ 113.548743] psci: CPU3 killed (polled 0 ms) [ 113.554753] CPU4: shutdown [ 113.555558] psci: CPU4 killed (polled 0 ms) [ 113.561863] CPU5: shutdown [ 113.563556] psci: CPU5 killed (polled 0 ms) bl30 get wakeup sources! process command 00000006 bl30 enter suspend! Little core clk suspend rate 500000000 Big core clk suspend rate 24000000 store restore gp0 pll suspend_counter: 1 Enter ddr suspend DMC_DRAM_STAT11: 0x544 ddr suspend time: 2178us alarm=0S process command 00000001 GPIOA_11/13 off cec ver:2018/04/19 CEC cfg:0x0000 WAKEUP GPIO cfg:0x00000000 use vddee new table! kern log_addr:0x00 cec T: 00 err: tx not finish flag cec reset Set cec pinmux:0x11 Set cec log_addr:0x10,ADDR0:10 use vddee new table! exit_reason:0x03 Enter ddr resume ddr resume time: 124us store restore gp0 pll cfg15 3b00000 cfg15 33b00000 Lit[ 113.567994] Enabling non-boot CPUs ... [ 113.568486] Detected VIPT I-cache on CPU1 [ 113.568579] CPU1: Booted secondary processor 0x0000000001 [0x410fd034] [ 113.569409] CPU1 is up [ 113.579874] Detected VIPT I-cache on CPU2 [ 113.579918] arch_timer: CPU2: Trapping CNTVCT access [ 113.579932] CPU2: Booted secondary processor 0x0000000100 [0x410fd092] [ 113.580221] cpufreq: cpufreq_online: CPU2: Running at unlisted freq: 499999 KHz [ 113.601661] cpufreq: cpufreq_online: CPU2: Unlisted initial frequency changed to: 500000 KHz [ 113.610292] CPU2 is up [ 113.612682] Detected VIPT I-cache on CPU3 [ 113.612706] arch_timer: CPU3: Trapping CNTVCT access [ 113.612713] CPU3: Booted secondary processor 0x0000000101 [0x410fd092] [ 113.613064] CPU3 is up [ 113.630312] Detected VIPT I-cache on CPU4 [ 113.630336] arch_timer: CPU4: Trapping CNTVCT access [ 113.630344] CPU4: Booted secondary processor 0x0000000102 [0x410fd092] [ 113.630733] CPU4 is up [ 113.647997] Detected VIPT I-cache on CPU5 [ 113.648020] arch_timer: CPU5: Trapping CNTVCT access [ 113.648028] CPU5: Booted secondary processor 0x0000000103 [0x410fd092] [ 113.648448] CPU5 is up tle core clk resume rate 500000000 Big core clk resume rate 50000000 [ 113.694610] meson8b-dwmac ff3f0000.ethernet eth0: No Safety Features support found [ 113.696672] meson8b-dwmac ff3f0000.ethernet eth0: configuring for phy/rgmii link mode [ 113.731329] usb usb1: root hub lost power or was reset [ 113.731573] usb usb2: root hub lost power or was reset [ 114.092879] usb 2-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd [ 114.244300] usb 1-1: reset high-speed USB device number 2 using xhci-hcd [ 114.771933] usb 1-1.4: reset full-speed USB device number 3 using xhci-hcd [ 114.967002] OOM killer enabled. [ 114.967165] Restarting tasks ... done. # rtcwake -d rtc1 -m mem -s4 rtcwake: wakeup from "mem" using rtc1 at Thu Jan 1 00:02:32 1970 [ 147.661305] PM: suspend entry (deep) [ 147.661836] Filesystems sync: 0.000 seconds [ 148.016605] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 148.019636] OOM killer disabled. [ 148.022805] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 148.032945] meson8b-dwmac ff3f0000.ethernet eth0: Link is Down [ 148.167760] Disabling non-boot CPUs ... [ 148.169733] CPU1: shutdown [ 148.170846] psci: CPU1 killed (polled 0 ms) [ 148.177272] CPU2: shutdown [ 148.178390] psci: CPU2 killed (polled 0 ms) [ 148.184226] CPU3: shutdown [ 148.184293] psci: CPU3 killed (polled 0 ms) [ 148.190565] CPU4: shutdown [ 148.190631] psci: CPU4 killed (polled 0 ms) [ 148.197579] CPU5: shutdown [ 148.198689] psci: CPU5 killed (polled 0 ms) bl30 get wakeup sources! process command 00000006 bl30 enter suspend! Little core clk suspend rate 250000000 Big core clk suspend rate 24000000 store restore gp0 pll suspend_counter: 1 Enter ddr suspend ddr suspend time: 16us alarm=4S process command 00000001 GPIOA_11/13 off cec ver:2018/04/19 CEC cfg:0x0000 WAKEUP GPIO cfg:0x00000000 use vddee new table! kern log_addr:0x00 cec T: 00 err: tx not finish flag cec reset Set cec pinmux:0x11 Set cec log_addr:0x10,ADDR0:10 use vddee new table! exit_reason:0x03 Enter ddr resume ddr resume time: 231us store restore gp0 pll cfg15 3b00000 cfg15 33b00000 Litt[ 148.205717] Enabling non-boot CPUs ... [ 148.206395] Detected VIPT I-cache on CPU1 [ 148.206552] CPU1: Booted secondary processor 0x0000000001 [0x410fd034] [ 148.208110] CPU1 is up [ 148.217759] Detected VIPT I-cache on CPU2 [ 148.217815] arch_timer: CPU2: Trapping CNTVCT access [ 148.217831] CPU2: Booted secondary processor 0x0000000100 [0x410fd092] [ 148.219095] cpufreq: cpufreq_online: CPU2: Running at unlisted freq: 999999 KHz [ 148.239430] cpufreq: cpufreq_online: CPU2: Unlisted initial frequency changed to: 1000000 KHz [ 148.248209] CPU2 is up [ 148.250643] Detected VIPT I-cache on CPU3 [ 148.250668] arch_timer: CPU3: Trapping CNTVCT access [ 148.250676] CPU3: Booted secondary processor 0x0000000101 [0x410fd092] [ 148.251068] CPU3 is up [ 148.268231] Detected VIPT I-cache on CPU4 [ 148.268256] arch_timer: CPU4: Trapping CNTVCT access [ 148.268263] CPU4: Booted secondary processor 0x0000000102 [0x410fd092] [ 148.268686] CPU4 is up [ 148.285889] Detected VIPT I-cache on CPU5 [ 148.285913] arch_timer: CPU5: Trapping CNTVCT access [ 148.285921] CPU5: Booted secondary processor 0x0000000103 [0x410fd092] [ 148.286416] CPU5 is up le core clk resume rate 250000000 Big core clk resume rate 50000000 [ 148.338091] meson8b-dwmac ff3f0000.ethernet eth0: No Safety Features support found [ 148.340483] meson8b-dwmac ff3f0000.ethernet eth0: configuring for phy/rgmii link mode [ 148.454331] usb usb1: root hub lost power or was reset [ 148.454575] usb usb2: root hub lost power or was reset [ 148.814331] usb 2-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd [ 148.965394] usb 1-1: reset high-speed USB device number 2 using xhci-hcd [ 149.493501] usb 1-1.4: reset full-speed USB device number 3 using xhci-hcd [ 149.689468] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 [ 149.692835] Mem abort info: [ 149.695588] ESR = 0x96000004 [ 149.698471] EC = 0x25: DABT (current EL), IL = 32 bits [ 149.703825] SET = 0, FnV = 0 [ 149.706732] EA = 0, S1PTW = 0 [ 149.709922] Data abort info: [ 149.712767] ISV = 0, ISS = 0x00000004 [ 149.716559] CM = 0, WnR = 0 [ 149.719509] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000d42d4000 [ 149.725909] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000 [ 149.732643] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 149.738040] Modules linked in: rfkill snd_soc_hdmi_codec dw_hdmi_i2s_audio dw_hdmi_cec meson_gxl realtek dwmac_generic dwmac_meson8b stmmac_platform stmmac rc_odroid meson_dw_hdmi meson_ir axg_audio dw_hdmi snd_soc_meson_g12a_toacodec meson_drm sclk_div rtc_pcf8563 rc_core cec snd_soc_meson_g12a_tohdmitx clk_phase snd_soc_meson_codec_glue nvmem_meson_efuse crct10dif_ce snd_soc_meson_axg_sound_card drm_kms_helper snd_soc_meson_card_utils meson_rng pwm_meson rtc_meson_vrtc rng_core reset_meson_audio_arb mdio_mux_meson_g12a display_connector mdio_xpcs snd_soc_meson_axg_tdmout snd_soc_meson_axg_tdmin snd_soc_meson_axg_toddr meson_canvas snd_soc_meson_axg_frddr snd_soc_meson_t9015 snd_soc_meson_axg_fifo snd_soc_simple_amplifier snd_soc_meson_axg_tdm_interface snd_soc_meson_axg_tdm_formatter drm ip_tables x_tables ipv6 [ 149.809601] CPU: 3 PID: 417 Comm: rtcwake Not tainted 5.9.0-rc1-00105-gaabe42051eab #1 [ 149.817393] Hardware name: Hardkernel ODROID-N2 (DT) [ 149.822344] pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--) [ 149.827906] pc : sugov_start+0x40/0x120 [ 149.831687] lr : cpufreq_start_governor+0x54/0x90 [ 149.836275] sp : ffff80001279bb20 [ 149.839561] x29: ffff80001279bb20 x28: ffff0000d424c600 [ 149.844817] x27: 0000000000000000 x26: 0000000000000000 [ 149.850075] x25: ffff0000f2854218 x24: ffff800011ad1d84 [ 149.855336] x23: ffff800011ab9980 x22: ffff8000116671b0 [ 149.860595] x21: ffff800011aba360 x20: ffff0000f2854000 [ 149.865855] x19: 0000000000000000 x18: 0000000000000001 [ 149.871116] x17: 0000000000000000 x16: 0000000000000000 [ 149.876380] x15: 000001bc458f2e9c x14: 0000000000000362 [ 149.881639] x13: 0000000000000001 x12: 0000000000000000 [ 149.886899] x11: 0000000000000001 x10: 00000000000009c0 [ 149.892165] x9 : ffff80001279b860 x8 : ffff0000d424d020 [ 149.897425] x7 : ffff0000d8d32e00 x6 : ffff0000f2854250 [ 149.902685] x5 : ffff80001279ba90 x4 : 0000000000000000 [ 149.907945] x3 : 0000000000000000 x2 : 00000000000003e8 [ 149.913208] x1 : ffff800011ad1bb0 x0 : 00000000ffffffff [ 149.918472] Call trace: [ 149.920945] sugov_start+0x40/0x120 [ 149.924388] cpufreq_start_governor+0x54/0x90 [ 149.928689] cpufreq_resume+0x88/0x170 [ 149.932398] dpm_resume+0x1c8/0x1e8 [ 149.935836] dpm_resume_end+0x18/0x30 [ 149.939465] suspend_devices_and_enter+0x23c/0x4d8 [ 149.944197] pm_suspend+0x258/0x2c0 [ 149.947645] state_store+0x8c/0x118 [ 149.951133] kobj_attr_store+0x18/0x30 [ 149.954841] sysfs_kf_write+0x44/0x58 [ 149.958445] kernfs_fop_write+0xfc/0x218 [ 149.962340] vfs_write+0xf0/0x230 [ 149.965609] ksys_write+0x6c/0xf8 [ 149.968889] __arm64_sys_write+0x1c/0x28 [ 149.972788] el0_svc_common.constprop.0+0x6c/0x168 [ 149.977510] do_el0_svc+0x24/0x90 [ 149.980787] el0_sync_handler+0x90/0x198 [ 149.984649] el0_sync+0x158/0x180 [ 149.987985] Code: f9405013 910d82b5 912602f7 12800000 (f9400661) [ 149.993970] ---[ end trace f23c646bedf2247c ]--- Best Regards -Anand
hi All, On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: > > Hi Kevin, > > Thanks for your review comments. > > On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: > > > > Anand Moon <linux.amoon@gmail.com> writes: > > > > > Enable RTC PCF8563 node on Odroid-N2 SBC, In order to > > > support the RTC wakealarm feature for suspend and resume. > > > Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 > > > timer device to prevent it being assigned to /dev/rtc0 > > > which disto userspace tools assume is a clock device. > > > > > > Cc: Neil Armstrong <narmstrong@baylibre.com> > > > Cc: Kevin Hilman <khilman@baylibre.com> > > > Suggested-by: Christian Hewitt <christianshewitt@gmail.com> > > > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > > > --- > > > Changes V3 > > > --Drop the INI GPIOAO.BIT7 pinctrl. > > > > Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to > > wakeup the system? If so, this should be included as part of this > > patch. > > > > It probably still works because the bootloader configures this GPIO as > > input, but the kernel should not rely on the booloader for that, so > > please include as part of this patch. > > > > Ok I will figure out the correct pinctrl need for this settings. > looking into the Odroid N2 schematics. > I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. So from the schematics it is seen below. RTC INT GPIOAO_7 (AV46) GPIOAO_7 (JTAG_A_TMS // TSIN_A_DIN0 // TDMB_FS // TDMB_SLV_FS) But the S922X datasheet this pin *AV46* shows to following settings, AN16 DVSS AV46 GPIOAO_7 BD19 BOOT_11 From the schematics it BOOT_11 is linked to BOOT_11 (NAND_CE0) BD19 So can I conclude that BOOT_11 (nand_ce0_pins) pin linked to the RTC INT setting Please can somebody help me with correct pinctrl settings. Best Regards -Anand Moon
On 24/08/2020 15:41, Anand Moon wrote: > hi All, > > On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: >> >> Hi Kevin, >> >> Thanks for your review comments. >> >> On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: >>> >>> Anand Moon <linux.amoon@gmail.com> writes: >>> >>>> Enable RTC PCF8563 node on Odroid-N2 SBC, In order to >>>> support the RTC wakealarm feature for suspend and resume. >>>> Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 >>>> timer device to prevent it being assigned to /dev/rtc0 >>>> which disto userspace tools assume is a clock device. >>>> >>>> Cc: Neil Armstrong <narmstrong@baylibre.com> >>>> Cc: Kevin Hilman <khilman@baylibre.com> >>>> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> >>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com> >>>> --- >>>> Changes V3 >>>> --Drop the INI GPIOAO.BIT7 pinctrl. >>> >>> Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to >>> wakeup the system? If so, this should be included as part of this >>> patch. >>> >>> It probably still works because the bootloader configures this GPIO as >>> input, but the kernel should not rely on the booloader for that, so >>> please include as part of this patch. >>> >> >> Ok I will figure out the correct pinctrl need for this settings. >> looking into the Odroid N2 schematics. >> > > I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. Simply add: interrupt-parent = <&gpio_intc>; interrupts = <7 IRQ_TYPE_LEVEL_LOW>; to reflect the interrupt connection. No need to setup pinctrl here since the GPIO input is always connected to the gpio irq generator whatever pinctrl mode is set. Neil > > So from the schematics it is seen below. > RTC INT GPIOAO_7 (AV46) GPIOAO_7 (JTAG_A_TMS // TSIN_A_DIN0 // > TDMB_FS // TDMB_SLV_FS) > > But the S922X datasheet this pin *AV46* shows to following settings, > AN16 DVSS AV46 GPIOAO_7 BD19 BOOT_11 > > From the schematics it BOOT_11 is linked to > BOOT_11 (NAND_CE0) BD19 > > So can I conclude that BOOT_11 (nand_ce0_pins) pin linked to the RTC INT setting > Please can somebody help me with correct pinctrl settings. > > Best Regards > -Anand Moon >
Hi Neil, On Mon, 24 Aug 2020 at 19:20, Neil Armstrong <narmstrong@baylibre.com> wrote: > > On 24/08/2020 15:41, Anand Moon wrote: > > hi All, > > > > On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: > >> > >> Hi Kevin, > >> > >> Thanks for your review comments. > >> > >> On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: > >>> > >>> Anand Moon <linux.amoon@gmail.com> writes: > >>> > >>>> Enable RTC PCF8563 node on Odroid-N2 SBC, In order to > >>>> support the RTC wakealarm feature for suspend and resume. > >>>> Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 > >>>> timer device to prevent it being assigned to /dev/rtc0 > >>>> which disto userspace tools assume is a clock device. > >>>> > >>>> Cc: Neil Armstrong <narmstrong@baylibre.com> > >>>> Cc: Kevin Hilman <khilman@baylibre.com> > >>>> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> > >>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com> > >>>> --- > >>>> Changes V3 > >>>> --Drop the INI GPIOAO.BIT7 pinctrl. > >>> > >>> Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to > >>> wakeup the system? If so, this should be included as part of this > >>> patch. > >>> > >>> It probably still works because the bootloader configures this GPIO as > >>> input, but the kernel should not rely on the booloader for that, so > >>> please include as part of this patch. > >>> > >> > >> Ok I will figure out the correct pinctrl need for this settings. > >> looking into the Odroid N2 schematics. > >> > > > > I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. > > > Simply add: > > interrupt-parent = <&gpio_intc>; > interrupts = <7 IRQ_TYPE_LEVEL_LOW>; > > to reflect the interrupt connection. > > No need to setup pinctrl here since the GPIO input is always connected to the gpio irq generator whatever pinctrl mode is set. > > Neil > Thanks for this input. Best Regards -Anand Moon
On Mon 24 Aug 2020 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote: > On 24/08/2020 15:41, Anand Moon wrote: >> hi All, >> >> On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: >>> >>> Hi Kevin, >>> >>> Thanks for your review comments. >>> >>> On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: >>>> >>>> Anand Moon <linux.amoon@gmail.com> writes: >>>> >>>>> Enable RTC PCF8563 node on Odroid-N2 SBC, In order to >>>>> support the RTC wakealarm feature for suspend and resume. >>>>> Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 >>>>> timer device to prevent it being assigned to /dev/rtc0 >>>>> which disto userspace tools assume is a clock device. >>>>> >>>>> Cc: Neil Armstrong <narmstrong@baylibre.com> >>>>> Cc: Kevin Hilman <khilman@baylibre.com> >>>>> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> >>>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com> >>>>> --- >>>>> Changes V3 >>>>> --Drop the INI GPIOAO.BIT7 pinctrl. >>>> >>>> Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to >>>> wakeup the system? If so, this should be included as part of this >>>> patch. >>>> >>>> It probably still works because the bootloader configures this GPIO as >>>> input, but the kernel should not rely on the booloader for that, so >>>> please include as part of this patch. >>>> >>> >>> Ok I will figure out the correct pinctrl need for this settings. >>> looking into the Odroid N2 schematics. >>> >> >> I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. > > > Simply add: > > interrupt-parent = <&gpio_intc>; > interrupts = <7 IRQ_TYPE_LEVEL_LOW>; > > to reflect the interrupt connection. > > No need to setup pinctrl here since the GPIO input is always connected > to the gpio irq generator whatever pinctrl mode is set. It is actually better to setup pinctrl. Yes the irq controller can work whatever the pin setup but if an output function is active it can mess with what the irq controller gets. Think about applying/removing bias if necessary too. > > Neil > >> >> So from the schematics it is seen below. >> RTC INT GPIOAO_7 (AV46) GPIOAO_7 (JTAG_A_TMS // TSIN_A_DIN0 // >> TDMB_FS // TDMB_SLV_FS) >> >> But the S922X datasheet this pin *AV46* shows to following settings, >> AN16 DVSS AV46 GPIOAO_7 BD19 BOOT_11 >> >> From the schematics it BOOT_11 is linked to >> BOOT_11 (NAND_CE0) BD19 >> >> So can I conclude that BOOT_11 (nand_ce0_pins) pin linked to the RTC INT setting >> Please can somebody help me with correct pinctrl settings. >> >> Best Regards >> -Anand Moon >>
Hi Jerome On Mon, 24 Aug 2020 at 20:00, Jerome Brunet <jbrunet@baylibre.com> wrote: > > > On Mon 24 Aug 2020 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote: > > > On 24/08/2020 15:41, Anand Moon wrote: > >> hi All, > >> > >> On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: > >>> > >>> Hi Kevin, > >>> > >>> Thanks for your review comments. > >>> > >>> On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: > >>>> > >>>> Anand Moon <linux.amoon@gmail.com> writes: > >>>> > >>>>> Enable RTC PCF8563 node on Odroid-N2 SBC, In order to > >>>>> support the RTC wakealarm feature for suspend and resume. > >>>>> Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 > >>>>> timer device to prevent it being assigned to /dev/rtc0 > >>>>> which disto userspace tools assume is a clock device. > >>>>> > >>>>> Cc: Neil Armstrong <narmstrong@baylibre.com> > >>>>> Cc: Kevin Hilman <khilman@baylibre.com> > >>>>> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> > >>>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com> > >>>>> --- > >>>>> Changes V3 > >>>>> --Drop the INI GPIOAO.BIT7 pinctrl. > >>>> > >>>> Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to > >>>> wakeup the system? If so, this should be included as part of this > >>>> patch. > >>>> > >>>> It probably still works because the bootloader configures this GPIO as > >>>> input, but the kernel should not rely on the booloader for that, so > >>>> please include as part of this patch. > >>>> > >>> > >>> Ok I will figure out the correct pinctrl need for this settings. > >>> looking into the Odroid N2 schematics. > >>> > >> > >> I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. > > > > > > Simply add: > > > > interrupt-parent = <&gpio_intc>; > > interrupts = <7 IRQ_TYPE_LEVEL_LOW>; > > > > to reflect the interrupt connection. I have tried this setting, but it is not working. [alarm@archl-on2e ~]$ dmesg| grep rtc [ 5.378002] meson-vrtc ff8000a8.rtc: registered as rtc1 [ 5.942307] rtc-pcf8563 0-0051: pcf8563_write_block_data: err=-110 addr=0e, data=03 [ 5.942316] rtc-pcf8563 0-0051: pcf8563_probe: write error [ 5.945983] rtc-pcf8563: probe of 0-0051 failed with error -5 > > > > No need to setup pinctrl here since the GPIO input is always connected > > to the gpio irq generator whatever pinctrl mode is set. > > It is actually better to setup pinctrl. Yes the irq controller can work > whatever the pin setup but if an output function is active it can mess with > what the irq controller gets. > > Think about applying/removing bias if necessary too. > Ok, I am trying to add a new pinctrl configuration for TSIN_A_DIN0 // TDMB_FS // TDMB_SLV_FS But it's still not working at my end. -Anand
On Tue 25 Aug 2020 at 11:01, Anand Moon <linux.amoon@gmail.com> wrote: > Hi Jerome > > On Mon, 24 Aug 2020 at 20:00, Jerome Brunet <jbrunet@baylibre.com> wrote: >> >> >> On Mon 24 Aug 2020 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote: >> >> > On 24/08/2020 15:41, Anand Moon wrote: >> >> hi All, >> >> >> >> On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: >> >>> >> >>> Hi Kevin, >> >>> >> >>> Thanks for your review comments. >> >>> >> >>> On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: >> >>>> >> >>>> Anand Moon <linux.amoon@gmail.com> writes: >> >>>> >> >>>>> Enable RTC PCF8563 node on Odroid-N2 SBC, In order to >> >>>>> support the RTC wakealarm feature for suspend and resume. >> >>>>> Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 >> >>>>> timer device to prevent it being assigned to /dev/rtc0 >> >>>>> which disto userspace tools assume is a clock device. >> >>>>> >> >>>>> Cc: Neil Armstrong <narmstrong@baylibre.com> >> >>>>> Cc: Kevin Hilman <khilman@baylibre.com> >> >>>>> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> >> >>>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com> >> >>>>> --- >> >>>>> Changes V3 >> >>>>> --Drop the INI GPIOAO.BIT7 pinctrl. >> >>>> >> >>>> Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to >> >>>> wakeup the system? If so, this should be included as part of this >> >>>> patch. >> >>>> >> >>>> It probably still works because the bootloader configures this GPIO as >> >>>> input, but the kernel should not rely on the booloader for that, so >> >>>> please include as part of this patch. >> >>>> >> >>> >> >>> Ok I will figure out the correct pinctrl need for this settings. >> >>> looking into the Odroid N2 schematics. >> >>> >> >> >> >> I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. >> > >> > >> > Simply add: >> > >> > interrupt-parent = <&gpio_intc>; >> > interrupts = <7 IRQ_TYPE_LEVEL_LOW>; >> > >> > to reflect the interrupt connection. > > I have tried this setting, but it is not working. > > [alarm@archl-on2e ~]$ dmesg| grep rtc > [ 5.378002] meson-vrtc ff8000a8.rtc: registered as rtc1 > [ 5.942307] rtc-pcf8563 0-0051: pcf8563_write_block_data: err=-110 > addr=0e, data=03 > [ 5.942316] rtc-pcf8563 0-0051: pcf8563_probe: write error > [ 5.945983] rtc-pcf8563: probe of 0-0051 failed with error -5 > -110 is timeout ... either you i2c bus is broken and you device is not at 0x51. In both case, it has nothing to do with the interrupt configuration > >> > >> > No need to setup pinctrl here since the GPIO input is always connected >> > to the gpio irq generator whatever pinctrl mode is set. >> >> It is actually better to setup pinctrl. Yes the irq controller can work >> whatever the pin setup but if an output function is active it can mess with >> what the irq controller gets. >> >> Think about applying/removing bias if necessary too. >> > > Ok, I am trying to add a new pinctrl configuration for > TSIN_A_DIN0 // TDMB_FS // TDMB_SLV_FS > But it's still not working at my end. Either you are quite confused when it comes to pinctrl or I am. TSIN and TDM have nothing to do with an i2c RTC. > > -Anand
hi Jerome On Tue, 25 Aug 2020 at 20:00, Jerome Brunet <jbrunet@baylibre.com> wrote: > > > On Tue 25 Aug 2020 at 11:01, Anand Moon <linux.amoon@gmail.com> wrote: > > > Hi Jerome > > > > On Mon, 24 Aug 2020 at 20:00, Jerome Brunet <jbrunet@baylibre.com> wrote: > >> > >> > >> On Mon 24 Aug 2020 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote: > >> > >> > On 24/08/2020 15:41, Anand Moon wrote: > >> >> hi All, > >> >> > >> >> On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: > >> >>> > >> >>> Hi Kevin, > >> >>> > >> >>> Thanks for your review comments. > >> >>> > >> >>> On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: > >> >>>> > >> >>>> Anand Moon <linux.amoon@gmail.com> writes: > >> >>>> > >> >>>>> Enable RTC PCF8563 node on Odroid-N2 SBC, In order to > >> >>>>> support the RTC wakealarm feature for suspend and resume. > >> >>>>> Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 > >> >>>>> timer device to prevent it being assigned to /dev/rtc0 > >> >>>>> which disto userspace tools assume is a clock device. > >> >>>>> > >> >>>>> Cc: Neil Armstrong <narmstrong@baylibre.com> > >> >>>>> Cc: Kevin Hilman <khilman@baylibre.com> > >> >>>>> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> > >> >>>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com> > >> >>>>> --- > >> >>>>> Changes V3 > >> >>>>> --Drop the INI GPIOAO.BIT7 pinctrl. > >> >>>> > >> >>>> Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to > >> >>>> wakeup the system? If so, this should be included as part of this > >> >>>> patch. > >> >>>> > >> >>>> It probably still works because the bootloader configures this GPIO as > >> >>>> input, but the kernel should not rely on the booloader for that, so > >> >>>> please include as part of this patch. > >> >>>> > >> >>> > >> >>> Ok I will figure out the correct pinctrl need for this settings. > >> >>> looking into the Odroid N2 schematics. > >> >>> > >> >> > >> >> I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. > >> > > >> > > >> > Simply add: > >> > > >> > interrupt-parent = <&gpio_intc>; > >> > interrupts = <7 IRQ_TYPE_LEVEL_LOW>; > >> > > >> > to reflect the interrupt connection. > > > > I have tried this setting, but it is not working. > > > > [alarm@archl-on2e ~]$ dmesg| grep rtc > > [ 5.378002] meson-vrtc ff8000a8.rtc: registered as rtc1 > > [ 5.942307] rtc-pcf8563 0-0051: pcf8563_write_block_data: err=-110 > > addr=0e, data=03 > > [ 5.942316] rtc-pcf8563 0-0051: pcf8563_probe: write error > > [ 5.945983] rtc-pcf8563: probe of 0-0051 failed with error -5 > > > > -110 is timeout ... either you i2c bus is broken and you device is not > at 0x51. In both case, it has nothing to do with the interrupt configuration > I have check the I2C bus on the device for rtc and it return correctly. $ sudo i2cdetect -l i2c-1 i2c DesignWare HDMI I2C adapter i2c-0 i2c Meson I2C adapter I2C adapter $ $ sudo 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: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- > > > >> > > >> > No need to setup pinctrl here since the GPIO input is always connected > >> > to the gpio irq generator whatever pinctrl mode is set. > >> > >> It is actually better to setup pinctrl. Yes the irq controller can work > >> whatever the pin setup but if an output function is active it can mess with > >> what the irq controller gets. > >> > >> Think about applying/removing bias if necessary too. > >> > > > > Ok, I am trying to add a new pinctrl configuration for > > TSIN_A_DIN0 // TDMB_FS // TDMB_SLV_FS > > But it's still not working at my end. > > Either you are quite confused when it comes to pinctrl or I am. Basically I dont want to keep repeating silly mistakes. > TSIN and TDM have nothing to do with an i2c RTC. Yes I understand this clearly, that's why I have dropped the RTC INT gpio pinctrl settings.Without this setting RTC driver works fine and their is no issue rtcwakeup during suspend and resume in my testing. -Anand
Hi All, On Wed, 26 Aug 2020 at 12:29, Anand Moon <linux.amoon@gmail.com> wrote: > > hi Jerome > > On Tue, 25 Aug 2020 at 20:00, Jerome Brunet <jbrunet@baylibre.com> wrote: > > > > > > On Tue 25 Aug 2020 at 11:01, Anand Moon <linux.amoon@gmail.com> wrote: > > > > > Hi Jerome > > > > > > On Mon, 24 Aug 2020 at 20:00, Jerome Brunet <jbrunet@baylibre.com> wrote: > > >> > > >> > > >> On Mon 24 Aug 2020 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote: > > >> > > >> > On 24/08/2020 15:41, Anand Moon wrote: > > >> >> hi All, > > >> >> > > >> >> On Fri, 21 Aug 2020 at 10:13, Anand Moon <linux.amoon@gmail.com> wrote: > > >> >>> > > >> >>> Hi Kevin, > > >> >>> > > >> >>> Thanks for your review comments. > > >> >>> > > >> >>> On Fri, 21 Aug 2020 at 01:03, Kevin Hilman <khilman@baylibre.com> wrote: > > >> >>>> > > >> >>>> Anand Moon <linux.amoon@gmail.com> writes: > > >> >>>> > > >> >>>>> Enable RTC PCF8563 node on Odroid-N2 SBC, In order to > > >> >>>>> support the RTC wakealarm feature for suspend and resume. > > >> >>>>> Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 > > >> >>>>> timer device to prevent it being assigned to /dev/rtc0 > > >> >>>>> which disto userspace tools assume is a clock device. > > >> >>>>> > > >> >>>>> Cc: Neil Armstrong <narmstrong@baylibre.com> > > >> >>>>> Cc: Kevin Hilman <khilman@baylibre.com> > > >> >>>>> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> > > >> >>>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com> > > >> >>>>> --- > > >> >>>>> Changes V3 > > >> >>>>> --Drop the INI GPIOAO.BIT7 pinctrl. > > >> >>>> > > >> >>>> Why did you drop this GPIO? Isn't this the GPIO that the RTC uses to > > >> >>>> wakeup the system? If so, this should be included as part of this > > >> >>>> patch. > > >> >>>> > > >> >>>> It probably still works because the bootloader configures this GPIO as > > >> >>>> input, but the kernel should not rely on the booloader for that, so > > >> >>>> please include as part of this patch. > > >> >>>> > > >> >>> > > >> >>> Ok I will figure out the correct pinctrl need for this settings. > > >> >>> looking into the Odroid N2 schematics. > > >> >>> > > >> >> > > >> >> I am trying to map the RTC INT pinctrl, ie RTC INT GPIOAO.BIT7. > > >> > > > >> > > > >> > Simply add: > > >> > > > >> > interrupt-parent = <&gpio_intc>; > > >> > interrupts = <7 IRQ_TYPE_LEVEL_LOW>; > > >> > > > >> > to reflect the interrupt connection. > > > > > > I have tried this setting, but it is not working. > > > > > > [alarm@archl-on2e ~]$ dmesg| grep rtc > > > [ 5.378002] meson-vrtc ff8000a8.rtc: registered as rtc1 > > > [ 5.942307] rtc-pcf8563 0-0051: pcf8563_write_block_data: err=-110 > > > addr=0e, data=03 > > > [ 5.942316] rtc-pcf8563 0-0051: pcf8563_probe: write error > > > [ 5.945983] rtc-pcf8563: probe of 0-0051 failed with error -5 > > > > > > > -110 is timeout ... either you i2c bus is broken and you device is not > > at 0x51. In both case, it has nothing to do with the interrupt configuration > > > I have check the I2C bus on the device for rtc and it return correctly. > > $ sudo i2cdetect -l > i2c-1 i2c DesignWare HDMI I2C adapter > i2c-0 i2c Meson I2C adapter I2C adapter > $ > $ sudo 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: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- > 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > 70: -- -- -- -- -- -- -- -- > > > > > > >> > > > >> > No need to setup pinctrl here since the GPIO input is always connected > > >> > to the gpio irq generator whatever pinctrl mode is set. > > >> > > >> It is actually better to setup pinctrl. Yes the irq controller can work > > >> whatever the pin setup but if an output function is active it can mess with > > >> what the irq controller gets. > > >> > > >> Think about applying/removing bias if necessary too. > > >> > > > > > > Ok, I am trying to add a new pinctrl configuration for > > > TSIN_A_DIN0 // TDMB_FS // TDMB_SLV_FS > > > But it's still not working at my end. > > > > Either you are quite confused when it comes to pinctrl or I am. > > Basically I dont want to keep repeating silly mistakes. > > > TSIN and TDM have nothing to do with an i2c RTC. > > Yes I understand this clearly, that's why I have dropped the > RTC INT gpio pinctrl settings.Without this setting RTC driver > works fine and their is no issue rtcwakeup during suspend > and resume in my testing. > Just want to clear my confusion on RTC INT gpio setting is not needed. I did not find any other example to support this changes. So I have enable the debug logs on rtc-pcf8563.c with this current patch at my end. [0] https://pastebin.com/F2UA665H -Best Regards Anand
Hi Anand (I haven't re-read all of this discussion, so apologies if something in my reply doesn't make sense) On Sat, Aug 29, 2020 at 6:31 PM Anand Moon <linux.amoon@gmail.com> wrote: [...] > Just want to clear my confusion on RTC INT gpio setting is not needed. > I did not find any other example to support this changes. > So I have enable the debug logs on rtc-pcf8563.c with this current > patch at my end. my understanding is that your testing procedure is to simply use your original patch and see if rtc wake-up is working. since GPIOAO_7 is not explicitly mentioned in your testing procedure I'm assuming that you're not configuring it anywhere. Kevin's concern is what happens when that GPIO is configured incorrectly (for example by some u-boot bug, firmware issue, ...). for example: have you tried to configure GPIOAO_7 in u-boot as output low pin and see if rtc wake-up is still working? In your previous replies you mentioned various pin mux settings related to TSIN_A_DIN0 // TDMB_FS // TDMB_SLV_FS I don't know how those are related to the RTC My suggestion is to look at arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi - it has a eth_phy_irq_pins definition and apply something similar on Odroid-N2 Best regards, Martin
Hi Martin, On Sun, 30 Aug 2020 at 01:26, Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote: > > Hi Anand > > (I haven't re-read all of this discussion, so apologies if something > in my reply doesn't make sense) > > On Sat, Aug 29, 2020 at 6:31 PM Anand Moon <linux.amoon@gmail.com> wrote: > [...] > > Just want to clear my confusion on RTC INT gpio setting is not needed. > > I did not find any other example to support this changes. > > So I have enable the debug logs on rtc-pcf8563.c with this current > > patch at my end. > my understanding is that your testing procedure is to simply use your > original patch and see if rtc wake-up is working. > since GPIOAO_7 is not explicitly mentioned in your testing procedure > I'm assuming that you're not configuring it anywhere. Yes... > Kevin's concern is what happens when that GPIO is configured > incorrectly (for example by some u-boot bug, firmware issue, ...). for > example: have you tried to configure GPIOAO_7 in u-boot as output low > pin and see if rtc wake-up is still working? Yes I will check this later. Meanwhile I have checked this feature with _mainline u-boot_ and _odroid-n2 u-boot_ and the result is that rtc wakeup works. > > In your previous replies you mentioned various pin mux settings > related to TSIN_A_DIN0 // TDMB_FS // TDMB_SLV_FS > I don't know how those are related to the RTC > My suggestion is to look at > arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi - it has a > eth_phy_irq_pins definition and apply something similar on Odroid-N2 > Thanks for your suggestion, I have given this a try see below. But any new pinctrl setting leads to RTC probe failure. # dmesg | grep rtc [ 5.308536] meson-vrtc ff8000a8.rtc: registered as rtc1 [ 5.483978] rtc-pcf8563 0-0051: pcf8563_probe [ 5.487549] rtc-pcf8563 0-0051: pcf8563_write_block_data: err=-6 addr=0e, data=03 [ 5.490116] rtc-pcf8563 0-0051: pcf8563_probe: write error [ 5.552763] rtc-pcf8563: probe of 0-0051 failed with error -5 ------------------&------------------------------------ $ git diff arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts index 35a31cf181e2..dad54f8a947f 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts @@ -206,6 +206,15 @@ vddao_3v3: regulator-vddao_3v3 { regulator-always-on; }; + /* Make sure the rtc irq pin is properly configured as input */ + rtc_irq_pins: rtc-pin-irq { + mux { + groups = "GPIOAO_7"; + function = "gpio_periphs"; + bias-disable; + }; + }; + hdmi-connector { compatible = "hdmi-connector"; type = "a"; @@ -481,7 +490,8 @@ hdmi_tx_tmds_out: endpoint { &i2c3 { pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; - pinctrl-names = "default"; + pinctrl-1 = <&rtc_irq_pins>; + pinctrl-names = "default", "gpio_periphs"; status = "okay"; rtc0: rtc@51 { -Anand
Hi Anand, On Sun, Aug 30, 2020 at 3:12 PM Anand Moon <linux.amoon@gmail.com> wrote: [...] > + /* Make sure the rtc irq pin is properly configured as input */ > + rtc_irq_pins: rtc-pin-irq { > + mux { > + groups = "GPIOAO_7"; > + function = "gpio_periphs"; check meson_g12a_aobus_functions in drivers/pinctrl/meson/pinctrl-meson-g12a.c GPIOAO_7 doesn't support "gpio_periphs", instead I think it should be "gpio_aobus" I'm surprised that you don't seem to be getting errors from the pin controller driver about this. On the other hand you have not attached the full kernel log, so maybe it's in there but hidden somewhere > + bias-disable; shouldn't there be output-disable or input-enable here? > + }; > + }; > + > hdmi-connector { > compatible = "hdmi-connector"; > type = "a"; > @@ -481,7 +490,8 @@ hdmi_tx_tmds_out: endpoint { > > &i2c3 { > pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; > - pinctrl-names = "default"; > + pinctrl-1 = <&rtc_irq_pins>; > + pinctrl-names = "default", "gpio_periphs"; I am not expecting this to work because it means that the I2C driver would have to manage the "gpio_periphs" pin state (but there's no pinctrl_* call in drivers/i2c/busses/i2c-meson.c) instead I would try: &i2c3 { pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>, <&rtc_irq_pins>; pinctrl-names = "default"; ... }; or even: rtc0: rtc@51 { pinctrl-0 = <&rtc_irq_pins>; pinctrl-names = "default"; ... }; Best regards, Martin
Hi Martin. On Sun, 30 Aug 2020 at 19:34, Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote: > > Hi Anand, > > On Sun, Aug 30, 2020 at 3:12 PM Anand Moon <linux.amoon@gmail.com> wrote: > [...] > > + /* Make sure the rtc irq pin is properly configured as input */ > > + rtc_irq_pins: rtc-pin-irq { > > + mux { > > + groups = "GPIOAO_7"; > > + function = "gpio_periphs"; > check meson_g12a_aobus_functions in drivers/pinctrl/meson/pinctrl-meson-g12a.c > GPIOAO_7 doesn't support "gpio_periphs", instead I think it should be > "gpio_aobus" > Thanks for this information, I really learned a lot on this feature.. > I'm surprised that you don't seem to be getting errors from the pin > controller driver about this. > On the other hand you have not attached the full kernel log, so maybe > it's in there but hidden somewhere > > > + bias-disable; > shouldn't there be output-disable or input-enable here? > Thanks for this information and correction. > > + }; > > + }; > > + > > hdmi-connector { > > compatible = "hdmi-connector"; > > type = "a"; > > @@ -481,7 +490,8 @@ hdmi_tx_tmds_out: endpoint { > > > > &i2c3 { > > pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; > > - pinctrl-names = "default"; > > + pinctrl-1 = <&rtc_irq_pins>; > > + pinctrl-names = "default", "gpio_periphs"; > I am not expecting this to work because it means that the I2C driver > would have to manage the "gpio_periphs" pin state (but there's no > pinctrl_* call in drivers/i2c/busses/i2c-meson.c) > instead I would try: > &i2c3 { > pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>, <&rtc_irq_pins>; > pinctrl-names = "default"; > > ... > }; > > or even: > rtc0: rtc@51 { > pinctrl-0 = <&rtc_irq_pins>; > pinctrl-names = "default"; > > ... > }; > Thanks for the input on the IRC, I followed Neil's suggestion to work for me. Best regards, -Anand
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts index 34fffa6d859d..35a31cf181e2 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts @@ -19,6 +19,8 @@ / { aliases { serial0 = &uart_AO; ethernet0 = ðmac; + rtc0 = &rtc0; + rtc1 = &vrtc; }; dioo2133: audio-amplifier-0 { @@ -477,6 +479,18 @@ hdmi_tx_tmds_out: endpoint { }; }; +&i2c3 { + pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; + pinctrl-names = "default"; + status = "okay"; + + rtc0: rtc@51 { + reg = <0x51>; + compatible = "nxp,pcf8563"; + wakeup-source; + }; +}; + &ir { status = "okay"; pinctrl-0 = <&remote_input_ao_pins>;
Enable RTC PCF8563 node on Odroid-N2 SBC, In order to support the RTC wakealarm feature for suspend and resume. Also assign an alias to the pcf8563 to rtc0 and meson-vrtc to rtc1 timer device to prevent it being assigned to /dev/rtc0 which disto userspace tools assume is a clock device. Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Kevin Hilman <khilman@baylibre.com> Suggested-by: Christian Hewitt <christianshewitt@gmail.com> Signed-off-by: Anand Moon <linux.amoon@gmail.com> --- Changes V3 --Drop the INI GPIOAO.BIT7 pinctrl. --Added missing RTC alias so that rtc get assigned correcly, as suggested by Chris Hewitt. changes v2 --Fix the missing INT (GPIOAO.BIT7) pinctrl. --Fix the missing rtcwakeup. --Drop the clock not required clock property by the PCF8563 driver. --- .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+)