From owner-freebsd-arm@freebsd.org Sun Dec 1 13:54:14 2019 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 191001ABC35 for ; Sun, 1 Dec 2019 13:54:14 +0000 (UTC) (envelope-from ganbold@gmail.com) Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QqVD5p9sz3M9s; Sun, 1 Dec 2019 13:54:12 +0000 (UTC) (envelope-from ganbold@gmail.com) Received: by mail-qk1-x731.google.com with SMTP id d124so14765589qke.6; Sun, 01 Dec 2019 05:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EfBO+pB+11BTqqQ/+nVVle6fh726VMkt9UnFYn1fAm8=; b=Wu/FT282XTHkYmotwm2sYFz+9l0IxHGrSKHfMRJ1DBBTUVrLzbKBMusn+vCQNGUmxF XFAsUJ49YTwwm576UYzu0k+stGPZ9xGJa3JeR0GKqxXUUpWRSiA2xU69nWNhq7HNjVUn UAl/8WzFsdzc1LgEh2GbavgD90zD65R4YjFq/MVbMJ4Px6MN4gixlYVOAyzjCKMvHPUM A1h/lfTq7ks/XCBzBSfxUYD1iXNaiDI2z7u9l38RhG5CNu1muFSv5sinknHl9nPtGKOh GjDEigIcGlXfFCHqDp8Wwa43k11m+LHtkamDjGHuldWZkcQK4Yw55u1jHRtkDDsyjUeS d2zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EfBO+pB+11BTqqQ/+nVVle6fh726VMkt9UnFYn1fAm8=; b=H2+u24eKCo50Y/GFikzCpKHrniMPdHtvyUt9CAdG8j4y9X4RsBNTRA6O7sf2wGY4zt J2l/8KLnPBIONP1iFLCz360FuWYScyBhD/nJh8hnQrmFhk+vbVQW2htF1lYg0uOfHhnw 9+XhrV03j52j3cUjhvWONdeqWfvsIll84Ax3SokDM8Q3BBhN/rC2KNJQNFpx8b8mzlwN RUC2QZozDe6pHj1jcdMlW7Kb+VKYSS82M6rWx5c/ItO4yKPbsoJYYA2UTG0EvRH/fgyH Lmp6KKNWmXsy314NGxEd7HA34uOofzNtyrIiZR+DHodSVDarGoWdq9pVYg2WXdAr1tJF W1zA== X-Gm-Message-State: APjAAAUl5B7vehsR+NV2qn4xTKFcIVhszpigxQx/w1fpAwcXaSPjr+uX eJ35DU/mDSP6obWm2pbkeeGgATqRHsgdGpn6y6hD34Jp X-Google-Smtp-Source: APXvYqxabz8n06MZwBJjjbD6+Qjxb0kMq06Vfn1mFXHXbaNCwJNyKplP5+bcLPwe0VyBDwM85iqBIpFpM8GVczrbTCE= X-Received: by 2002:a37:8185:: with SMTP id c127mr27396986qkd.43.1575208450960; Sun, 01 Dec 2019 05:54:10 -0800 (PST) MIME-Version: 1.0 References: <20191201110716.GA41224@server.rulingia.com> In-Reply-To: From: Ganbold Tsagaankhuu Date: Sun, 1 Dec 2019 21:54:00 +0800 Message-ID: Subject: Re: rk_tsadc breaks (my) Rock64 To: Peter Jeremy Cc: Michal Meloun , "freebsd-arm@freebsd.org" X-Rspamd-Queue-Id: 47QqVD5p9sz3M9s X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Wu/FT282; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of ganbold@gmail.com designates 2607:f8b0:4864:20::731 as permitted sender) smtp.mailfrom=ganbold@gmail.com X-Spamd-Result: default: False [-1.90 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; URI_COUNT_ODD(1.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; MIME_BASE64_TEXT(0.10)[]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-9.28), ipnet: 2607:f8b0::/32(-2.25), asn: 15169(-1.94), country: US(-0.05)]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; SH_EMAIL_ZRD(0.00)[0.0.0.8,0.0.0.5,0.0.0.6]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; SH_EMAIL_DBL_DONT_QUERY_IPS(0.00)[0.0.0.6,0.0.0.8,0.0.0.5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[1.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 13:54:14 -0000 On Sun, Dec 1, 2019 at 9:40 PM Ganbold Tsagaankhuu wrote: > > > On Sun, Dec 1, 2019 at 7:07 PM Peter Jeremy 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: mem >> 0xff450000-0xff45ffff on ofwbus0 >> ... >> rk_tsadc0: 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 >> >