[U-Boot] [PATCH v1 10/14] imx: clock: Introduce set_fec_clock() to configure ETH clock (imx6)
Marek Vasut
marex at denx.de
Wed Jan 2 01:16:36 UTC 2019
On 1/2/19 12:37 AM, Lukasz Majewski wrote:
> This patch provides a generic way to setup ENET (ETH) clocks for imx6(q)
> based boards. Previously this was performed per board in the
> board_eth_init() function.
>
> Signed-off-by: Lukasz Majewski <lukma at denx.de>
> ---
>
> arch/arm/include/asm/arch-mx6/clock.h | 1 +
> arch/arm/mach-imx/mx6/clock.c | 17 +++++++++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/arch/arm/include/asm/arch-mx6/clock.h b/arch/arm/include/asm/arch-mx6/clock.h
> index a9481a5fea..9a217349f5 100644
> --- a/arch/arm/include/asm/arch-mx6/clock.h
> +++ b/arch/arm/include/asm/arch-mx6/clock.h
> @@ -72,6 +72,7 @@ int enable_i2c_clk(unsigned char enable, unsigned i2c_num);
> int enable_spi_clk(unsigned char enable, unsigned spi_num);
> void enable_ipu_clock(void);
> int enable_fec_anatop_clock(int fec_id, enum enet_freq freq);
> +int set_fec_clock(int fec_id, enum enet_freq freq);
> void enable_enet_clk(unsigned char enable);
> int enable_lcdif_clock(u32 base_addr, bool enable);
> void enable_qspi_clk(int qspi_num);
> diff --git a/arch/arm/mach-imx/mx6/clock.c b/arch/arm/mach-imx/mx6/clock.c
> index 366a4e3c6b..8a4fb23090 100644
> --- a/arch/arm/mach-imx/mx6/clock.c
> +++ b/arch/arm/mach-imx/mx6/clock.c
> @@ -902,6 +902,17 @@ void enable_qspi_clk(int qspi_num)
> #endif
>
> #ifdef CONFIG_FEC_MXC
> +static void select_fec_clock_source(int fec_id)
How is the fec_id() used in here ? Shouldn't this be part of
enable_fec_anatop_clock() ?
> +{
> + struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
> +
> + if (is_mx6dq()) {
> + /* set gpr1[21] to select anatop clock */
> + setbits_le32(&iomuxc_regs->gpr[1],
> + IOMUXC_GPR1_ENET_CLK_SEL_MASK);
> + }
> +}
> +
> int enable_fec_anatop_clock(int fec_id, enum enet_freq freq)
> {
> u32 reg = 0;
> @@ -976,6 +987,12 @@ int enable_fec_anatop_clock(int fec_id, enum enet_freq freq)
> #endif
> return 0;
> }
> +
> +int set_fec_clock(int fec_id, enum enet_freq freq)
> +{
> + select_fec_clock_source(fec_id);
> + return enable_fec_anatop_clock(fec_id, freq);
> +}
> #endif
>
> static u32 get_usdhc_clk(u32 port)
>
--
Best regards,
Marek Vasut
More information about the U-Boot
mailing list