arm: socfpga: stratix10: SPI clock support
Subsystems (3)
PATCH 1/1 arm: socfpga: stratix10: SPI clock support
From: Dinesh Maniyam <[email protected]>
This patch is to add SPI clock support for stratix10. Get clock rate function always returning 0 because the DW-SPI driver get the rate from clock node in dts but Stratix10 does not support device tree clock node.To overcome this spi will get the clock_rate directly from spi clock controller override the weaker function.
--- arch/arm/mach-socfpga/clock_manager_s10.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/clock_manager_s10.c +16 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright (C) 2016-2018 Intel Corporation <www.intel.com> +* Copyright (C) 2016-2023 Intel Corporation <www.intel.com> * */
@@ -399,6 +399,21 @@ unsigned int cm_get_l4_sys_free_clk_hz(void)return cm_get_l3_main_clk_hz () /4 ; } +/* +* Override weak dw_spi_get_clk implementation in designware_spi.c driver +*/ + +int dw_spi_get_clk (struct udevice *bus,ulong *rate) +{ + *rate =cm_get_spi_controller_clk_hz (); +if (!*rate) { +printf ("SPI: clock rate is zero" ); +return -EINVAL ; + } + +return 0 ; +} +void cm_print_clock_quick_summary (void ) {printf ("MPU %d kHz\n" , (u32)(cm_get_mpu_clk_hz () /1000 ));
Signature · 1 line
2.26.2
Hi,
Quoted 62 lines
-----Original Message-----
From: Maniyam, Dinesh <[email protected]>
Sent: Thursday, December 7, 2023 3:46 PM
To: [email protected]
Cc: Marek <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: [PATCH] arm: socfpga: stratix10: SPI clock supportFrom: Dinesh Maniyam <[email protected]>
This patch is to add SPI clock support for stratix10. Get clock rate function always returning 0 because the DW-SPI driver get the rate from clock node in dts but Stratix10 does not support device tree clock node.To overcome this spi will get the
clock_ratedirectly from spi clock controller override the weaker function.Signed-off-by Dinesh Maniyam <[email protected]>--- arch/arm/mach-socfpga/clock_manager_s10.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)arch/arm/mach- renamed from arch/arm/mach-socfpga/clock_manager_s10.c +0
-0
socfpga/clock_manager_s10.c
index4b4f0749db..45300336d5100644arch/arm/mach-socfpga/clock_manager_s10.c +15
-2@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright (C) 2016-2018 Intel Corporation <www.intel.com> +* Copyright (C) 2016-2023 Intel Corporation <www.intel.com> * */ @@ -399,6 +399,21 @@ unsigned int cm_get_l4_sys_free_clk_hz(void)return cm_get_l3_main_clk_hz () /4 ; } +/* +* Override weak dw_spi_get_clk implementation in designware_spi.c +driver */ + +int dw_spi_get_clk (struct udevice *bus,ulong *rate) { + *rate =cm_get_spi_controller_clk_hz (); +if (!*rate) { +printf ("SPI: clock rate is zero" ); +return -EINVAL ; + } + +return 0 ; +} +void cm_print_clock_quick_summary (void ) {printf ("MPU %d kHz\n" , (u32)(cm_get_mpu_clk_hz () /1000 )); --
Quoted 1 line
2.26.2
Regards
Tien Fong