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@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14739
This commit is contained in:
parent
091cd2f18d
commit
526de79be2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331958
@ -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;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $FreeBSD$
|
||||
files "../mv/armada38x/files.armada38x"
|
||||
files "../mv/files.mv"
|
||||
files "../mv/files.arm7"
|
||||
cpu CPU_CORTEXA
|
||||
machine arm armv7
|
||||
|
||||
|
@ -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);
|
||||
|
3
sys/arm/mv/files.arm7
Normal file
3
sys/arm/mv/files.arm7
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
arm/mv/armada38x/armada38x.c standard
|
||||
arm/mv/armadaxp/armadaxp.c standard
|
@ -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
|
||||
},
|
||||
};
|
||||
|
||||
@ -2952,6 +2969,28 @@ struct fdt_fixup_entry fdt_fixup_table[] = {
|
||||
{ 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
|
||||
fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
|
||||
|
@ -148,4 +148,9 @@ int mv_pci_devmap(phandle_t, struct devmap_entry *, vm_offset_t,
|
||||
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_ */
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user