From owner-svn-src-all@freebsd.org Tue Apr 3 22:10:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC624F84BC5; Tue, 3 Apr 2018 22:10:51 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A65B77F00; Tue, 3 Apr 2018 22:10:51 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85294281D; Tue, 3 Apr 2018 22:10:51 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w33MApFG004568; Tue, 3 Apr 2018 22:10:51 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w33MAosI004549; Tue, 3 Apr 2018 22:10:50 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201804032210.w33MAosI004549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Tue, 3 Apr 2018 22:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331958 - in head/sys/arm/mv: . armada38x armadaxp X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys/arm/mv: . armada38x armadaxp X-SVN-Commit-Revision: 331958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 22:10:52 -0000 Author: mw Date: Tue Apr 3 22:10:50 2018 New Revision: 331958 URL: https://svnweb.freebsd.org/changeset/base/331958 Log: Make get_tclk and get_cpu_freq generic for Marvell armv7 SoCs In GENERIC kernel choosing proper get_tclk and get_cpu_freq implementation must be done in runtime. Kernel for both SoC need to have implementation of each other functions, so common file list mv/files.arm7 is added. Marvell armv5 SoC have their own non-generic implementation of those function. Submitted by: Rafal Kozik Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14739 Added: head/sys/arm/mv/files.arm7 (contents, props changed) Modified: head/sys/arm/mv/armada38x/armada38x.c head/sys/arm/mv/armada38x/std.armada38x head/sys/arm/mv/armadaxp/armadaxp.c head/sys/arm/mv/mv_common.c head/sys/arm/mv/mvvar.h head/sys/arm/mv/std-pj4b.mv Modified: head/sys/arm/mv/armada38x/armada38x.c ============================================================================== --- head/sys/arm/mv/armada38x/armada38x.c Tue Apr 3 21:54:36 2018 (r331957) +++ head/sys/arm/mv/armada38x/armada38x.c Tue Apr 3 22:10:50 2018 (r331958) @@ -61,7 +61,7 @@ get_sar_value_armada38x(void) } uint32_t -get_tclk(void) +get_tclk_armada38x(void) { uint32_t sar; @@ -78,7 +78,7 @@ get_tclk(void) } uint32_t -get_cpu_freq(void) +get_cpu_freq_armada38x(void) { uint32_t sar; Modified: head/sys/arm/mv/armada38x/std.armada38x ============================================================================== --- head/sys/arm/mv/armada38x/std.armada38x Tue Apr 3 21:54:36 2018 (r331957) +++ head/sys/arm/mv/armada38x/std.armada38x Tue Apr 3 22:10:50 2018 (r331958) @@ -1,6 +1,7 @@ # $FreeBSD$ files "../mv/armada38x/files.armada38x" files "../mv/files.mv" +files "../mv/files.arm7" cpu CPU_CORTEXA machine arm armv7 Modified: head/sys/arm/mv/armadaxp/armadaxp.c ============================================================================== --- head/sys/arm/mv/armadaxp/armadaxp.c Tue Apr 3 21:54:36 2018 (r331957) +++ head/sys/arm/mv/armadaxp/armadaxp.c Tue Apr 3 22:10:50 2018 (r331958) @@ -138,7 +138,7 @@ get_sar_value_armadaxp(void) } uint32_t -get_tclk(void) +get_tclk_armadaxp(void) { uint32_t cputype; @@ -152,7 +152,7 @@ get_tclk(void) } uint32_t -get_cpu_freq(void) +get_cpu_freq_armadaxp(void) { return (0); Added: head/sys/arm/mv/files.arm7 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/files.arm7 Tue Apr 3 22:10:50 2018 (r331958) @@ -0,0 +1,3 @@ +# $FreeBSD$ +arm/mv/armada38x/armada38x.c standard +arm/mv/armadaxp/armadaxp.c standard Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Tue Apr 3 21:54:36 2018 (r331957) +++ head/sys/arm/mv/mv_common.c Tue Apr 3 22:10:50 2018 (r331958) @@ -230,6 +230,7 @@ typedef void(*write_cpu_ctrl_t)(uint32_t, uint32_t); typedef uint32_t (*win_read_t)(int); typedef void (*win_write_t)(int, uint32_t); typedef int (*win_cesa_attr_t)(int); +typedef uint32_t (*get_t)(void); struct decode_win_spec { read_cpu_ctrl_t read_cpu_ctrl; @@ -249,6 +250,10 @@ struct decode_win_spec { win_read_t ddr_sz_read; win_write_t ddr_br_write; win_write_t ddr_sz_write; +#if __ARM_ARCH >= 6 + get_t get_tclk; + get_t get_cpu_freq; +#endif }; struct decode_win_spec *soc_decode_win_spec; @@ -273,6 +278,10 @@ static struct decode_win_spec decode_win_specs[] = &ddr_armv7_sz_read, &ddr_armv7_br_write, &ddr_armv7_sz_write, +#if __ARM_ARCH >= 6 + &get_tclk_armada38x, + &get_cpu_freq_armada38x, +#endif }, { &read_cpu_ctrl_armv7, @@ -292,6 +301,10 @@ static struct decode_win_spec decode_win_specs[] = &ddr_armv7_sz_read, &ddr_armv7_br_write, &ddr_armv7_sz_write, +#if __ARM_ARCH >= 6 + &get_tclk_armadaxp, + &get_cpu_freq_armadaxp, +#endif }, { &read_cpu_ctrl_armv5, @@ -311,6 +324,10 @@ static struct decode_win_spec decode_win_specs[] = &ddr_armv5_sz_read, &ddr_armv5_br_write, &ddr_armv5_sz_write, +#if __ARM_ARCH >= 6 + NULL, + NULL, +#endif }, }; @@ -2951,6 +2968,28 @@ struct fdt_fixup_entry fdt_fixup_table[] = { { "mrvl,DB-78460", &fdt_fixup_ranges }, { NULL, NULL } }; + +#if __ARM_ARCH >= 6 +uint32_t +get_tclk(void) +{ + + if (soc_decode_win_spec->get_tclk != NULL) + return soc_decode_win_spec->get_tclk(); + else + return -1; +} + +uint32_t +get_cpu_freq(void) +{ + + if (soc_decode_win_spec->get_cpu_freq != NULL) + return soc_decode_win_spec->get_cpu_freq(); + else + return -1; +} +#endif #ifndef INTRNG static int Modified: head/sys/arm/mv/mvvar.h ============================================================================== --- head/sys/arm/mv/mvvar.h Tue Apr 3 21:54:36 2018 (r331957) +++ head/sys/arm/mv/mvvar.h Tue Apr 3 22:10:50 2018 (r331958) @@ -148,4 +148,9 @@ int mv_pci_devmap(phandle_t, struct devmap_entry *, vm vm_offset_t); int fdt_localbus_devmap(phandle_t, struct devmap_entry *, int, int *); enum soc_family mv_check_soc_family(void); + +uint32_t get_tclk_armadaxp(void); +uint32_t get_tclk_armada38x(void); +uint32_t get_cpu_freq_armadaxp(void); +uint32_t get_cpu_freq_armada38x(void); #endif /* _MVVAR_H_ */ Modified: head/sys/arm/mv/std-pj4b.mv ============================================================================== --- head/sys/arm/mv/std-pj4b.mv Tue Apr 3 21:54:36 2018 (r331957) +++ head/sys/arm/mv/std-pj4b.mv Tue Apr 3 22:10:50 2018 (r331958) @@ -1,6 +1,7 @@ # $FreeBSD$ files "../mv/files.mv" +files "../mv/files.arm7" cpu CPU_MV_PJ4B machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a"