From nobody Tue Oct 24 20:43:12 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SFPCc4fHhz4xVfb for ; Tue, 24 Oct 2023 20:43:24 +0000 (UTC) (envelope-from titus@edc.ro) Received: from eatlas.ro (eatlas.ro [86.126.82.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "eatlas.ro", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SFPCb1r9kz4blf for ; Tue, 24 Oct 2023 20:43:22 +0000 (UTC) (envelope-from titus@edc.ro) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=edc.ro header.s=mail header.b=LAETgWYV; spf=pass (mx1.freebsd.org: domain of titus@edc.ro designates 86.126.82.18 as permitted sender) smtp.mailfrom=titus@edc.ro; dmarc=none Received: from mail.edc.ro ([10.1.4.58]) by eatlas.ro (8.16.1/8.16.1) with ESMTPS id 39OKhD8m005040 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Tue, 24 Oct 2023 23:43:13 +0300 (EEST) (envelope-from titus@edc.ro) Received: from [192.168.1.7] (79-114-68-1.rdsnet.ro [79.114.68.1] (may be forged)) (authenticated bits=0) by mail.edc.ro (8.16.1/8.16.1) with ESMTPSA id 39OKhBdC054669 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Oct 2023 23:43:11 +0300 (EEST) (envelope-from titus@edc.ro) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=edc.ro; s=mail; t=1698180191; bh=TkfRLRoxzfwAoiqreHf3bdoUCllnMojG8XyWQzWghZA=; h=From:Subject:Date:To; b=LAETgWYV1zgjiLo+42wRVzOddngkPpb45TjETNspN2tE4nNcQKiJ5fD1fzcc3HwEX aRZKMFlxEa+VPbbtMseW+e/Bdiylv71+vHPiLin4g5GZLEEwqtKNBGuecwp4viPlVs d+Y8+OtUNMjZeX+snqn3XWjOXP+qi3jmt8nIvvZA= From: titus Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: RK3568 clock tree problems Message-Id: Date: Tue, 24 Oct 2023 23:43:12 +0300 To: freebsd-arm X-Mailer: Apple Mail (2.3445.104.21) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ns.edc.ro X-Spamd-Bar: -- X-Spamd-Result: default: False [-3.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MV_CASE(0.50)[]; R_DKIM_ALLOW(-0.20)[edc.ro:s=mail]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; BLOCKLISTDE_FAIL(0.00)[79.114.68.1:server fail,86.126.82.18:server fail]; DKIM_TRACE(0.00)[edc.ro:+]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:8708, ipnet:86.120.0.0/13, country:RO]; TO_DN_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[edc.ro]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Queue-Id: 4SFPCb1r9kz4blf while trying to make emmc work on an opi 3b i spotted some possible = problems with the clock tree / drivers the problems won=E2=80=99t surface if you don=E2=80=99t want to set to = many frequencies but still rk_clk_mux.c=20 will select any bogus frequency from the last parent if the initial = set_clock_freq call had ROUND_UP or ROUND_DOWN flag because it does not keeps a best frequency rk_clk_mux.c may select a =E2=80=9CBUSY=E2=80=9D parent if the parent = chosen is busy and it need its freq adjusted and the function will fail = but return succes because the=20 last call that sets the parent freq will ignore return code (the = set_freq function succeeds when DRYRUN is set even if the clock is busy) rk_clk_composite will not try to find a good frequency starting with the = current parent but with the first one and may change parent when only changing the div is possible neither of the above will stop searching if the required freq is reached rk3568_cru has incorrect div with definitions for some clocks which make = their designed frequency unconfigurable ex div25m with a parent of 1GHz has a div width of 5 bits instead of 6 i have some rough/wip patches if anyone needs them