Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Dec 2019 21:54:00 +0800
From:      Ganbold Tsagaankhuu <ganbold@gmail.com>
To:        Peter Jeremy <peter@rulingia.com>
Cc:        Michal Meloun <mmel@freebsd.org>, "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: rk_tsadc breaks (my) Rock64
Message-ID:  <CAGtf9xOraC7-gVbAUHBg%2B4c11Qr-Bx23Sdayq925Ni4tEw=geQ@mail.gmail.com>
In-Reply-To: <CAGtf9xNjnoJHTnUiJmZb3Q6VQsPjLkYmpfABY8a6jdO9i5bt-Q@mail.gmail.com>
References:  <20191201110716.GA41224@server.rulingia.com> <CAGtf9xNjnoJHTnUiJmZb3Q6VQsPjLkYmpfABY8a6jdO9i5bt-Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 1, 2019 at 9:40 PM Ganbold Tsagaankhuu <ganbold@gmail.com>
wrote:

>
>
> On Sun, Dec 1, 2019 at 7:07 PM Peter Jeremy <peter@rulingia.com> wrote:
>
>> r355173 added code to read the Rockchip temperature sensors.
>> Unfortunately,
>> this breaks on my Rock64.  I've tried to understand what's going wrong but
>> haven't managed to make much headway.  It looks like there some
>> configuration
>> missing from syscon that tsadc needs but I'm not sure what (and I don't
>> really
>> understand what syscon is doing).  I'd appreciate any insights.
>>
>> Relevant extract from the dmesg:
>> simple_mfd0: <Simple MFD (Multi-Functions Device)> mem
>> 0xff450000-0xff45ffff on ofwbus0
>> ...
>> rk_tsadc0: <RockChip temperature sensors> mem 0xff250000-0xff2500ff irq
>> 22 on ofwbus0
>> rk_tsadc0: nclocks=1, nparents=-1
>> rk_tsadc0: Set clk_tsadc to 50000
>> panic: data abort with spinlock held
>> cpuid = 0
>> time = 1
>> KDB: stack backtrace:
>> ...
>> data_abort() at do_el1h_sync+0x144
>>          pc = 0xffff00000053f590  lr = 0xffff00000053e8c8
>>          sp = 0xffff000000010530  fp = 0xffff000000010560
>>
>> do_el1h_sync() at handle_el1h_sync+0x78
>>          pc = 0xffff00000053e8c8  lr = 0xffff000000525078
>>          sp = 0xffff000000010570  fp = 0xffff000000010680
>>
>> handle_el1h_sync() at simple_mfd_syscon_write_4+0x60
>>          pc = 0xffff000000525078  lr = 0xffff0000000fb028
>>          sp = 0xffff000000010690  fp = 0xffff000000010740
>>
>> simple_mfd_syscon_write_4() at tsadc_attach+0x44c
>>          pc = 0xffff0000000fb028  lr = 0xffff000000553b58
>>          sp = 0xffff000000010750  fp = 0xffff0000000107c0
>>
>> tsadc_attach() at device_attach+0x3e0
>>          pc = 0xffff000000553b58  lr = 0xffff00000028ad1c
>>          sp = 0xffff0000000107d0  fp = 0xffff000000010830
>>
>> device_attach() at bus_generic_new_pass+0x12c
>>          pc = 0xffff00000028ad1c  lr = 0xffff00000028cb58
>>          sp = 0xffff000000010840  fp = 0xffff000000010870
>> ...
>> Stopped at      generic_bs_w_4: undefined       b8226823
>>
>> Relevant extract from FDT:
>>         syscon@ff100000 {
>>                 compatible = "rockchip,rk3328-grf", "syscon",
>> "simple-mfd";
>>                 reg = <0x0 0xff100000 0x0 0x1000>;
>>                 #address-cells = <0x1>;
>>                 #size-cells = <0x1>;
>>                 phandle = <0x13>;
>>                 io-domains {
>>                         compatible = "rockchip,rk3328-io-voltage-domain";
>>                         status = "okay";
>>                         vccio1-supply = <0x20>;
>>                         vccio2-supply = <0x22>;
>>                         vccio3-supply = <0x20>;
>>                         vccio4-supply = <0x21>;
>>                         vccio5-supply = <0x20>;
>>                         vccio6-supply = <0x20>;
>>                         pmuio-supply = <0x20>;
>>                         phandle = <0x14>;
>>                 };
>>                 grf-gpio {
>>                         compatible = "rockchip,rk3328-grf-gpio";
>>                         gpio-controller;
>>                         #gpio-cells = <0x2>;
>>                         phandle = <0x15>;
>>                 };
>>                 power-controller {
>>                         compatible = "rockchip,rk3328-power-controller";
>>                         #power-domain-cells = <0x1>;
>>                         #address-cells = <0x1>;
>>                         #size-cells = <0x0>;
>>                         phandle = <0x16>;
>>                         pd_hevc@6 {
>>
>>                                 reg = <0x6>;
>>                         };
>>                         pd_video@5 {
>>
>>                                 reg = <0x5>;
>>                         };
>>                         pd_vpu@8 {
>>
>>                                 reg = <0x8>;
>>                         };
>>                 };
>>                 reboot-mode {
>>                         compatible = "syscon-reboot-mode";
>>                         offset = <0x5c8>;
>>                         mode-normal = <0x5242c300>;
>>                         mode-recovery = <0x5242c303>;
>>                         mode-bootloader = <0x5242c309>;
>>                         mode-loader = <0x5242c301>;
>>                 };
>>         };
>> ...
>>         tsadc@ff250000 {
>>                 compatible = "rockchip,rk3328-tsadc";
>>                 reg = <0x0 0xff250000 0x0 0x100>;
>>                 interrupts = <0x0 0x3a 0x4>;
>>                 assigned-clocks = <0x46 0x24>;
>>                 assigned-clock-rates = <0xc350>;
>>                 clocks = <0x46 0x24 0x46 0xd5>;
>>                 clock-names = "tsadc", "apb_pclk";
>>                 pinctrl-names = "init", "default", "sleep";
>>                 pinctrl-0 = <0x7c>;
>>                 pinctrl-1 = <0x7d>;
>>                 pinctrl-2 = <0x7c>;
>>                 resets = <0x46 0x42>;
>>                 reset-names = "tsadc-apb";
>>                 rockchip,grf = <0x13>;
>>                 rockchip,hw-tshut-temp = <0x186a0>;
>>                 #thermal-sensor-cells = <0x1>;
>>                 status = "okay";
>>                 rockchip,hw-tshut-mode = <0x0>;
>>                 rockchip,hw-tshut-polarity = <0x0>;
>>                 phandle = <0x30>;
>>         };
>>
>>
> What dts are you using?
> The syscon should be syscon@ff770000.
> In my case:
> ...
>         syscon@ff770000 {
>
>                 compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd";
>                 reg = <0x0 0xff770000 0x0 0x10000>;
>                 #address-cells = <0x1>;
>                 #size-cells = <0x1>;
>                 phandle = <0x82>;
> ...
>         tsadc@ff260000 {
>
>                 compatible = "rockchip,rk3399-tsadc";
>                 reg = <0x0 0xff260000 0x0 0x100>;
>                 interrupts = <0x0 0x61 0x4 0x0>;
>                 assigned-clocks = <0x81 0x4f>;
>                 assigned-clock-rates = <0xb71b0>;
>                 clocks = <0x81 0x4f 0x81 0x164>;
>                 clock-names = "tsadc", "apb_pclk";
>                 resets = <0x81 0xe8>;
>                 reset-names = "tsadc-apb";
>                 rockchip,grf = <0x82>;
>                 rockchip,hw-tshut-temp = <0x17318>;
>                 pinctrl-names = "init", "default", "sleep";
>                 pinctrl-0 = <0x112>;
>                 pinctrl-1 = <0x113>;
>                 pinctrl-2 = <0x112>;
>                 #thermal-sensor-cells = <0x1>;
>                 status = "okay";
>                 rockchip,hw-tshut-mode = <0x1>;
>                 rockchip,hw-tshut-polarity = <0x1>;
>                 phandle = <0x3a>;
>         };
> ...
>
> here http://dpaste.com/3MTFPPG is full dts I'm using on NanoPC-T4 board.
>

Sorry, I missed that you seem to be using rk3328 based board.
In my case it is rk3399 board and it is working.

Ganbold



>
> Ganbold
>
>
>> --
>> Peter Jeremy
>>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGtf9xOraC7-gVbAUHBg%2B4c11Qr-Bx23Sdayq925Ni4tEw=geQ>