svn commit: r331958 - in head/sys/arm/mv: . armada38x armadaxp

Marcin Wojtas mw at FreeBSD.org
Tue Apr 3 22:10:52 UTC 2018


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 <rk at semihalf.com>
  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"


More information about the svn-src-all mailing list