From owner-freebsd-arm@freebsd.org Sun Dec 1 13:41:02 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 9AA8C1AB664 for ; Sun, 1 Dec 2019 13:41:02 +0000 (UTC) (envelope-from ganbold@gmail.com) Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) (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 47QqC16VR5z3Lcn; Sun, 1 Dec 2019 13:41:01 +0000 (UTC) (envelope-from ganbold@gmail.com) Received: by mail-qv1-xf34.google.com with SMTP id v12so338430qvq.2; Sun, 01 Dec 2019 05:41:01 -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=R2D7PNGrNSlAEa6MM/v/0CqVkMAoQIAEWcxtYhPd4L8=; b=qCrnXdiWg+56TWItJTZMBQ2hY4mc597P9Krufz2yRYZvsWBFR2Ti0GiUCpd5CNTDjj 1nFGOT/HQgnpN9FkK1RTZ3b3EAfBQrQ6Q4wvyAbb5exNLjKtfkGaJ5Jb+ljpTes4MjRG s0w1PGzi5SB9cU4rwFJ2YhOFeUanOhew9K7ko9KjPr5X+98ps54OX9XrFbi3fNGpduJe MNTCEAiCXYsapRf7DlkQviC1bKI+lXN2rHmlUrQnS6G3SPVabUmoNcNY3fwRsdbcIOD3 fZUr7lKCK3lfq+IxmQzhNbIPYEMc7W9/DjIBpl1zCliEmWQ8FRaDKbkbsLLPjkQilWVP bc/w== 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=R2D7PNGrNSlAEa6MM/v/0CqVkMAoQIAEWcxtYhPd4L8=; b=TUWE7IABZu5BhwhpFEfVnDK8TqGa8Ia5q0wDcVXKygp4PZ8skBK8gEDjpHuN2bKVSm t1IlmXe/oEx+aZgPHSp/SHCUusSfAvfmqcRJvEB1dOWzR65KRlgwqKwSPSFR9Gz1ji+M SywR2wMHY3rSyHhVovhv60Aa1Y0j3ShyFPbepbsM7GZqG0uInEVqPwhJXE1BUdz4lJbu r3kbNxYkdf1OPkk8JJ0vfTS9MGn2eOdCk01QiF8y+xM9KdMDVYpwpYou49xmh+IFuNN4 cJ9woUdsVbmBr21FUzGWmwNebx8IDesHJPJqfJemdenLEAKBwn6Ta6PiUlcfHJ2k9ZSn kcuA== X-Gm-Message-State: APjAAAWGzegi5mINZgnT5PQzh/2N4mdk9MPcgxaIB+7zBRowYaQjVKmB ydgb+dE0SDqMlNhniJh2z5q1wuklIschlea9Cvs= X-Google-Smtp-Source: APXvYqw/jmMe0daHgmsb9nSvpSe/zi1afckxmjHm+WOIjEH6R8nLHCHJ0mdDdn+2FjodeOmyvsUUH3lwwl1aG+C4Izw= X-Received: by 2002:a05:6214:c3:: with SMTP id f3mr15992858qvs.226.1575207654764; Sun, 01 Dec 2019 05:40:54 -0800 (PST) MIME-Version: 1.0 References: <20191201110716.GA41224@server.rulingia.com> In-Reply-To: <20191201110716.GA41224@server.rulingia.com> From: Ganbold Tsagaankhuu Date: Sun, 1 Dec 2019 21:40:43 +0800 Message-ID: Subject: Re: rk_tsadc breaks (my) Rock64 To: Peter Jeremy Cc: Michal Meloun , "freebsd-arm@freebsd.org" X-Rspamd-Queue-Id: 47QqC16VR5z3Lcn X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=qCrnXdiW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of ganbold@gmail.com designates 2607:f8b0:4864:20::f34 as permitted sender) smtp.mailfrom=ganbold@gmail.com X-Spamd-Result: default: False [-1.89 / 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)[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(-0.99)[-0.994,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.8,0.0.0.6,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_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:41:02 -0000 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. Ganbold > -- > Peter Jeremy >