From nobody Tue Aug 22 10:25: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 4RVQTc1rzDz4qhHj for ; Tue, 22 Aug 2023 10:25: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 4RVQTZ4SxRz3H4q for ; Tue, 22 Aug 2023 10:25:22 +0000 (UTC) (envelope-from titus@edc.ro) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=edc.ro header.s=mail header.b=OpBatth6; 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 37MAPD4m023911 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Tue, 22 Aug 2023 13:25:13 +0300 (EEST) (envelope-from titus@edc.ro) Received: from tituss-imac.eatlas.local (eatlas.ro [86.126.82.18]) (authenticated bits=0) by mail.edc.ro (8.16.1/8.16.1) with ESMTPSA id 37MAPBN1034460 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 22 Aug 2023 13:25:11 +0300 (EEST) (envelope-from titus@edc.ro) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=edc.ro; s=mail; t=1692699911; bh=WVYT7X88yA3ZCpDtZlWz0v73oW7f87UVMIZk+D2uees=; h=From:Subject:Date:To; b=OpBatth6tk6mTqDaDCxD/rMCFCkTIvkzL1GoS+OMIMTzZc5j5UzD+8p7Qai0a7c92 Gio6jOe86HEESPXviNeZmFwusl9sofSKXyz1uEV/4tZqukvYpcaFUxGPUb1WNwiZa/ oC15Sfzx+ea4rMGparpQf4+9sSlAQy9HoRRz11pw= 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 13.4 \(3608.120.23.2.7\)) Subject: allwinner h616/h618 cpu freq driver Message-Id: Date: Tue, 22 Aug 2023 13:25:12 +0300 To: freebsd-arm X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ns.edc.ro 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_SPF_ALLOW(-0.20)[+ip4:86.126.82.18/32]; R_DKIM_ALLOW(-0.20)[edc.ro:s=mail]; MIME_GOOD(-0.10)[text/plain]; ASN(0.00)[asn:8708, ipnet:86.120.0.0/13, country:RO]; DKIM_TRACE(0.00)[edc.ro:+]; TO_DN_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; 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-Spamd-Bar: -- X-Rspamd-Queue-Id: 4RVQTZ4SxRz3H4q H616 / H618 socs have a slightly different cpu-opp table for the cpu = freq to voltage mapping = --------------------------------------------------------------------------= ---------------------------- opp-table-cpu { compatible =3D "allwinner,sun50i-h616-operating-points"; nvmem-cells =3D <0x4c>; opp-shared; phandle =3D <0x3>; opp-480000000 { clock-latency-ns =3D <0x3b9b0>; opp-hz =3D <0x0 0x1c9c3800>; opp-microvolt-speed0 =3D <0xdbba0 0xdbba0 = 0x10c8e0>; opp-microvolt-speed1 =3D <0xdbba0 0xdbba0 = 0x10c8e0>; opp-microvolt-speed2 =3D <0xdbba0 0xdbba0 = 0x10c8e0>; }; =E2=80=A6.. = --------------------------------------------------------------------------= --------------- instead of the standard opp-table-cpu { compatible =3D "operating-points-v2"; opp-shared; phandle =3D <0x3>; opp-480000000 { opp-hz =3D <0x0 0x1c9c3800>; opp-microvolt =3D <0xc8320>; clock-latency-ns =3D <0x3b9b0>; }; =E2=80=A6.. = --------------------------------------------------------------------------= -- there are 3 sets of voltages listed and the speed key [0-2] is obtained = from the nvmem cell with phandle <0x4c> the question is how will be the best/recommended method to implement = support 1. hack sys/dev/cpufreq/cpufreq_dt.c with a build time option and use = ifdefs 2. duplicate the cpufreq_dt.c code and create a cloned driver from = scratch 3. create a driver that only looks for compatible =3D = "allwinner,sun50i-h616-operating-points=E2=80=9D and then live patches the fdt (reads the nvmem cell and replace opp-microvolt-speedN =3D = with opp-microvolt =3D thanks, Titus=