clk: imx8mp: Add EQoS MAC clock
Subsystems (8)
PATCH v3 1/14 clk: imx8mp: Add EQoS MAC clock
Add clock for the DWMAC EQoS block. This is used among other things to configure the MII clock via DM CLK.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: Add AB from Sean
V3: No change
--- drivers/clk/imx/clk-imx8mp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/clk/imx/clk-imx8mp.c +13 -0
@@ -70,6 +70,14 @@ static const char *imx8mp_i2c6_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_"sys_pll3_out" ,"audio_pll1_out" ,"video_pll1_out" , "audio_pll2_out", "sys_pll1_133m", }; +static const char *imx8mp_enet_qos_sels[] = {"clock-osc-24m" ,"sys_pll2_125m" ,"sys_pll2_50m" , +"sys_pll2_100m" ,"sys_pll1_160m" ,"audio_pll1_out" , +"video_pll1_out" ,"clk_ext4" , }; + +static const char *imx8mp_enet_qos_timer_sels[] = {"clock-osc-24m" ,"sys_pll2_100m" ,"audio_pll1_out" , +"clk_ext1" ,"clk_ext2" ,"clk_ext3" , +"clk_ext4" ,"video_pll1_out" , }; +static const char *imx8mp_usdhc1_sels[] = {"clock-osc-24m" ,"sys_pll1_400m" ,"sys_pll1_800m" ,"sys_pll2_500m" ,"sys_pll3_out" ,"sys_pll1_266m" ,"audio_pll2_out" ,"sys_pll1_100m" , };
@@ -250,6 +258,8 @@ static int imx8mp_clk_probe(struct udevice *dev)clk_dm (IMX8MP_CLK_DRAM_APB ,imx8m_clk_composite_critical ("dram_apb" , imx8mp_dram_apb_sels, base +0xa080 ));clk_dm (IMX8MP_CLK_I2C5 ,imx8m_clk_composite ("i2c5" , imx8mp_i2c5_sels, base +0xa480 ));clk_dm (IMX8MP_CLK_I2C6 ,imx8m_clk_composite ("i2c6" , imx8mp_i2c6_sels, base +0xa500 )); +clk_dm (IMX8MP_CLK_ENET_QOS ,imx8m_clk_composite ("enet_qos" , imx8mp_enet_qos_sels, base +0xa880 )); +clk_dm (IMX8MP_CLK_ENET_QOS_TIMER ,imx8m_clk_composite ("enet_qos_timer" , imx8mp_enet_qos_timer_sels, base +0xa900 ));clk_dm (IMX8MP_CLK_ENET_REF ,imx8m_clk_composite ("enet_ref" , imx8mp_enet_ref_sels, base +0xa980 ));clk_dm (IMX8MP_CLK_ENET_TIMER ,imx8m_clk_composite ("enet_timer" , imx8mp_enet_timer_sels, base +0xaa00 ));clk_dm (IMX8MP_CLK_ENET_PHY_REF ,imx8m_clk_composite ("enet_phy_ref" , imx8mp_enet_phy_ref_sels, base +0xaa80 ));
@@ -292,10 +302,13 @@ static int imx8mp_clk_probe(struct udevice *dev)clk_dm (IMX8MP_CLK_I2C2_ROOT ,imx_clk_gate4 ("i2c2_root_clk" ,"i2c2" , base +0x4180 ,0 ));clk_dm (IMX8MP_CLK_I2C3_ROOT ,imx_clk_gate4 ("i2c3_root_clk" ,"i2c3" , base +0x4190 ,0 ));clk_dm (IMX8MP_CLK_I2C4_ROOT ,imx_clk_gate4 ("i2c4_root_clk" ,"i2c4" , base +0x41a0 ,0 )); +clk_dm (IMX8MP_CLK_QOS_ROOT ,imx_clk_gate4 ("qos_root_clk" ,"ipg_root" , base +0x42c0 ,0 )); +clk_dm (IMX8MP_CLK_QOS_ENET_ROOT ,imx_clk_gate4 ("qos_enet_root_clk" ,"ipg_root" , base +0x42e0 ,0 ));clk_dm (IMX8MP_CLK_QSPI_ROOT ,imx_clk_gate4 ("qspi_root_clk" ,"qspi" , base +0x42f0 ,0 ));clk_dm (IMX8MP_CLK_I2C5_ROOT ,imx_clk_gate2 ("i2c5_root_clk" ,"i2c5" , base +0x4330 ,0 ));clk_dm (IMX8MP_CLK_I2C6_ROOT ,imx_clk_gate2 ("i2c6_root_clk" ,"i2c6" , base +0x4340 ,0 ));clk_dm (IMX8MP_CLK_SIM_ENET_ROOT ,imx_clk_gate4 ("sim_enet_root_clk" ,"enet_axi" , base +0x4400 ,0 )); +clk_dm (IMX8MP_CLK_ENET_QOS_ROOT ,imx_clk_gate4 ("enet_qos_root_clk" ,"sim_enet_root_clk" , base +0x43b0 ,0 ));clk_dm (IMX8MP_CLK_UART1_ROOT ,imx_clk_gate4 ("uart1_root_clk" ,"uart1" , base +0x4490 ,0 ));clk_dm (IMX8MP_CLK_UART2_ROOT ,imx_clk_gate4 ("uart2_root_clk" ,"uart2" , base +0x44a0 ,0 ));clk_dm (IMX8MP_CLK_UART3_ROOT ,imx_clk_gate4 ("uart3_root_clk" ,"uart3" , base +0x44b0 ,0 ));
Signature · 1 line
2.39.1
PATCH v3 2/14 net: Pull board_interface_eth_init() into common code
Move the board_interface_eth_init() into common ethernet uclass code, since this function could be shared by multiple drivers.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V3: New patch
--- drivers/net/dwc_eth_qos.c | 7 ------- net/eth-uclass.c | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/dwc_eth_qos.c +0 -7
@@ -1412,13 +1412,6 @@ err_free_reset_eqos:return ret; } -/* board-specific Ethernet Interface initializations. */ -__weak int board_interface_eth_init (struct udevice *dev, -phy_interface_t interface_type) -{ -return 0 ; -} -static int eqos_probe_resources_stm32 (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);
net/eth-uclass.c +7 -0
@@ -49,6 +49,13 @@ struct eth_uclass_priv {/* eth_errno - This stores the most recent failure code from DM functions */ static int eth_errno; +/* board-specific Ethernet Interface initializations. */ +__weak int board_interface_eth_init (struct udevice *dev, +phy_interface_t interface_type) +{ +return 0 ; +} +static struct eth_uclass_priv *eth_get_uclass_priv (void ) {struct uclass *uc;
Signature · 1 line
2.39.1
Re: [PATCH v3 02/14] net: Pull board_interface_eth_init() into common code
Hi,
Quoted 24 lines · Marek Vasut
Move the
board_interface_eth_init()into common ethernet uclass code, since this function could be shared by multiple drivers.Signed-off-by Marek Vasut <[email protected]>---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V3: New patch
Quoted 4 lines
--- drivers/net/dwc_eth_qos.c | 7 ------- net/eth-uclass.c | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
Related, we do have a way of adding code to run when a device is probed (events). Should we look at using that? Is it better or worse than weak functions?
Regards,
Simon
Re: [PATCH v3 02/14] net: Pull board_interface_eth_init() into common code
Quoted 32 lines · Simon Glass
Hi,
Quoted 24 lines · Marek Vasut
Move the
board_interface_eth_init()into common ethernet uclass code, since this function could be shared by multiple drivers.Signed-off-by Marek Vasut <[email protected]>---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V3: New patchQuoted 4 lines
--- drivers/net/dwc_eth_qos.c | 7 ------- net/eth-uclass.c | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
Quoted 5 lines
Reviewed-by Simon Glass <[email protected]>Related, we do have a way of adding code to run when a device is probed (events). Should we look at using that? Is it better or worse than weak functions?
No, the next step here would be to figure out what to do with the GPR register programming, that'd be likely syscon or similar, but that's for another series.
PATCH v3 3/14 net: dwc_eth_qos: Drop bogus return after goto
In reply to Marek VasutThe return is never triggered due to the goto just above it. Drop it. No functional change.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: Add RB from Ramon
V3: No change
--- drivers/net/dwc_eth_qos.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/dwc_eth_qos.c +0 -1
@@ -1383,7 +1383,6 @@ static int eqos_probe_resources_tegra186(struct udevice *dev)if (ret) {pr_err ("clk_get_by_name(ptp_ref) failed: %d" , ret); goto err_free_clk_rx; -return ret; } ret =clk_get_by_name (dev,"tx" , &eqos->clk_tx);
Signature · 1 line
2.39.1
PATCH v3 4/14 net: dwc_eth_qos: Drop unused dm_gpio_free() on STM32
In reply to Marek VasutThe dm_gpio_free() is never called, because for stm32, the phy_reset_gpio pointer is never valid. This is because only tegra186 ever claims the phy_reset_gpio, all other platforms use the PHY framework to reset the PHY instead. Drop the dm_gpio_free() and dm_gpio_is_valid().
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: - Add RB from Ramon
- Mark eqos variable in eqos_remove_resources_stm32() with __maybe_unused
V3: No change
--- drivers/net/dwc_eth_qos.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/dwc_eth_qos.c +1 -4
@@ -1493,7 +1493,7 @@ static int eqos_remove_resources_tegra186(struct udevice *dev)static int eqos_remove_resources_stm32 (struct udevice *dev) { -struct eqos_priv *eqos =dev_get_priv (dev); +struct eqos_priv *__maybe_unused eqos =dev_get_priv (dev);debug ("%s(dev=%p):\n" , __func__, dev);
@@ -1505,9 +1505,6 @@ static int eqos_remove_resources_stm32(struct udevice *dev)clk_free (&eqos->clk_ck);#endif -if (dm_gpio_is_valid (&eqos->phy_reset_gpio)) -dm_gpio_free (dev, &eqos->phy_reset_gpio); -debug ("%s: OK\n" , __func__);return 0 ; }
Signature · 1 line
2.39.1
PATCH v3 5/14 net: dwc_eth_qos: Staticize eqos_inval_buffer_tegra186()
In reply to Marek VasutThis function is only used within the driver, staticize it.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: - New patch
V3: No change
--- drivers/net/dwc_eth_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dwc_eth_qos.c +1 -1
@@ -108,7 +108,7 @@ void eqos_flush_desc_generic(void *desc)flush_dcache_range (start, end); } -void eqos_inval_buffer_tegra186 (void *buf,size_t size) +static void eqos_inval_buffer_tegra186 (void *buf,size_t size) {unsigned long start = (unsigned long )buf & ~(ARCH_DMA_MINALIGN -1 );unsigned long end =ALIGN (start + size,ARCH_DMA_MINALIGN );
Signature · 1 line
2.39.1
PATCH v3 6/14 net: dwc_eth_qos: Set DMA_MODE SWR bit to reset the MAC
In reply to Marek VasutThe driver currently only waits for DMA_MODE SWR bit to clear itself. This is insufficient e.g. on i.MX8M Plus, where the MAC must be reset before IOMUX GPR[1] content is latched into the MAC and used. Without the proper reset, the i.MX8M Plus MAC variant does not take the value in IOMUX GPR[1] into account, which makes it impossible e.g. to switch interface mode from RGMII to any other.
Since proper reset is desired in general to put the block into defined state, always assert the DMA_MODE SWR bit before waiting for the bit to clear itself.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: Add RB from Ramon
V3: No change
--- drivers/net/dwc_eth_qos.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/dwc_eth_qos.c +6 -0
@@ -761,6 +761,12 @@ static int eqos_start(struct udevice *dev) eqos->reg_access_ok = true; +/* +* Assert the SWR first, the actually reset the MAC and to latch in +* e.g. i.MX8M Plus GPR[1] content, which selects interface mode. +*/ +setbits_le32 (&eqos->dma_regs->mode,EQOS_DMA_MODE_SWR ); + ret =wait_for_bit_le32 (&eqos->dma_regs->mode,EQOS_DMA_MODE_SWR , false, eqos->config->swr_wait, false);
Signature · 1 line
2.39.1
PATCH v3 7/14 net: dwc_eth_qos: Add DM CLK support for i.MX8M Plus
In reply to Marek VasutThe DWMAC clock in i.MX8M Plus were so far configured via ad-hoc architecture code. Replace that with DM clock instead. This way, the driver claims all its required clock, enables and disables them, and even gets the CSR clock rate and sets the TX clock rate, without any need of architecture specific register fiddling. Drop the architecture specific code while at it too.
The adjustment here is modeled after STM32MP15xx clock handling in this driver.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: Turn all the pr_err() into dev_dbg()
V3: No change
--- arch/arm/mach-imx/imx8m/clock_imx8mm.c | 41 -------- drivers/net/dwc_eth_qos_imx.c | 131 +++++++++++++++++++++++-- 2 files changed, 121 insertions(+), 51 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mm.c +0 -41
@@ -872,47 +872,6 @@ int set_clk_eqos(enum enet_freq type) return 0; } - -int imx_eqos_txclk_set_rate (ulong rate) -{ -u32 val; -u32 eqos_post_div; - -/* disable the clock first */ -clock_enable (CCGR_QOS_ETHENET ,0 ); -clock_enable (CCGR_SDMA2 ,0 ); - -switch (rate) { -case 125000000 : - eqos_post_div =1 ; -break ; -case 25000000 : - eqos_post_div =125000000 /25000000 ; -break ; -case 2500000 : - eqos_post_div =125000000 /2500000 ; -break ; -default : -return -EINVAL ; - } - -clock_get_target_val (ENET_QOS_CLK_ROOT , &val); - val &= ~(CLK_ROOT_PRE_DIV_MASK |CLK_ROOT_POST_DIV_MASK ); - val |=CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 ) | -CLK_ROOT_POST_DIV (eqos_post_div -1 ); -clock_set_target_val (ENET_QOS_CLK_ROOT , val); - -/* enable clock */ -clock_enable (CCGR_QOS_ETHENET ,1 ); -clock_enable (CCGR_SDMA2 ,1 ); - -return 0 ; -} - -u32 imx_get_eqos_csr_clk (void ) -{ -return get_root_clk (ENET_AXI_CLK_ROOT ); -}#endif #ifdef CONFIG_FEC_MXC
drivers/net/dwc_eth_qos_imx.c +121 -10
171 lines not on this page · raw message
Signature · 1 line
2.39.1
PATCH v3 8/14 net: dwc_eth_qos: Add i.MX8M Plus RMII support
In reply to Marek VasutWith DM clock support in place, it is easy to add RMII support into the MAC driver. The RMII cannot operate at 1000 Mbps and at 100 and 10 Mbps the clock frequency is 50 MHz and 5 MHz instead of 25 MHz and 2.5 MHz.
The board DT requires the following adjustments to EQoS node:
phy-mode = "rmii";
assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_266M>,
<&clk IMX8MP_SYS_PLL2_100M>, <&clk IMX8MP_SYS_PLL2_50M>;
assigned-clock-rates = <0>, <100000000>, <50000000>;
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: Add RB from Ramon
V3: Handle RGMII_*ID variants
--- drivers/net/dwc_eth_qos_imx.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/net/dwc_eth_qos_imx.c +18 -11
@@ -179,21 +179,28 @@ static int eqos_set_tx_clk_speed_imx(struct udevice *dev)debug ("%s(dev=%p):\n" , __func__, dev); -switch (eqos->phy->speed) { -case SPEED_1000 : - rate =125 *1000 *1000 ; -break ; -case SPEED_100 : - rate =25 *1000 *1000 ; -break ; -case SPEED_10 : - rate =2.5 *1000 *1000 ; -break ; -default : +if (eqos->phy->interface ==PHY_INTERFACE_MODE_RMII ) + rate =5000 ;/* 5000 kHz = 5 MHz */ +else + rate =2500 ;/* 2500 kHz = 2.5 MHz */ + +if (eqos->phy->speed ==SPEED_1000 && + (eqos->phy->interface ==PHY_INTERFACE_MODE_RGMII || + eqos->phy->interface ==PHY_INTERFACE_MODE_RGMII_ID || + eqos->phy->interface ==PHY_INTERFACE_MODE_RGMII_RXID || + eqos->phy->interface ==PHY_INTERFACE_MODE_RGMII_TXID )) { + rate *=50 ;/* Use 50x base rate i.e. 125 MHz */ + }else if (eqos->phy->speed ==SPEED_100 ) { + rate *=10 ;/* Use 10x base rate */ + }else if (eqos->phy->speed ==SPEED_10 ) { + rate *=1 ;/* Use base rate */ + }else {pr_err ("invalid speed %d" , eqos->phy->speed);return -EINVAL ; } + rate *=1000 ;/* clk_set_rate() operates in Hz */ + ret =clk_set_rate (&eqos->clk_tx, rate);if (ret <0 ) {pr_err ("imx (tx_clk, %lu) failed: %d" , rate, ret);
Signature · 1 line
2.39.1
PATCH v3 9/14 net: dwc_eth_qos: Add board_interface_eth_init() for i.MX8M Plus
In reply to Marek VasutImplement common board_interface_eth_init() and call it from the DWMAC driver to configure IOMUXC GPR[1] register according to the PHY mode obtained from DT. This supports all three interface modes supported by the i.MX8M Plus DWMAC and supersedes current board-side configuration of the same IOMUX GPR[1] duplicated in the board files.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: - Add RB from Ramon
- Handle RGMII_ID/RGMII_RXID/RGMII_TXID just like plain RGMII
V3: Make the function more generic, so it can be shared by eqos and fec
--- arch/arm/include/asm/arch-imx8m/imx-regs.h | 8 +++- arch/arm/mach-imx/imx8m/clock_imx8mm.c | 53 +++++++++++++++++++++- drivers/net/dwc_eth_qos_imx.c | 4 ++ 3 files changed, 63 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-imx8m/imx-regs.h +7 -1
@@ -89,7 +89,13 @@#define DDRC_IPS_BASE_ADDR (X ) (0x3d400000 + ((X) * 0x2000000))#define DDR_CSD1_BASE_ADDR 0x40000000 -#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK 0x70000 +#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_RGMII_EN BIT(21) +#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_CLK_TX_CLK_SEL BIT(20) +#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_CLK_GEN_EN BIT(19) +#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK GENMASK(18, 16) +#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MII (0 << 16) +#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_RGMII (1 << 16) +#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_RMII (4 << 16)#define FEC_QUIRK_ENET_MAC #ifdef CONFIG_ARMV8_PSCI /* Final jump location */
arch/arm/mach-imx/imx8m/clock_imx8mm.c +52 -1
74 lines not on this page · raw message
drivers/net/dwc_eth_qos_imx.c +4 -0
@@ -55,6 +55,10 @@ static int eqos_probe_resources_imx(struct udevice *dev)return -EINVAL ; } + ret =board_interface_eth_init (dev, interface); +if (ret) +return -EINVAL ; + eqos->max_speed =dev_read_u32_default (dev,"max-speed" ,0 ); ret =clk_get_by_name (dev,"stmmaceth" , &eqos->clk_master_bus);
Signature · 1 line
2.39.1
PATCH v3 10/14 net: fec_mxc: Add ref clock setup support for i.MX8M Mini/Nano/Plus
In reply to Marek VasutThe FEC ref clock frequency on i.MX8M Mini/Nano/Plus was so far configured via ad-hoc board code. Replace that with DM clock clk_set_rate() instead. This way, the driver claims all its required clock and sets the ref clock rate, without any need of architecture specific register fiddling.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V3: New patch
--- drivers/net/fec_mxc.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/net/fec_mxc.c +32 -0
@@ -1196,6 +1196,33 @@ static void fec_gpio_reset(struct fec_priv *priv) }#endif +static int fecmxc_set_ref_clk (struct clk *clk_ref,phy_interface_t interface) +{ +unsigned int freq; +int ret; + +if (!CONFIG_IS_ENABLED (CLK_CCF )) +return 0 ; + +if (interface ==PHY_INTERFACE_MODE_MII ) + freq =25000000 ; +else if (interface ==PHY_INTERFACE_MODE_RMII ) + freq =50000000 ; +else if (interface ==PHY_INTERFACE_MODE_RGMII || + interface ==PHY_INTERFACE_MODE_RGMII_ID || + interface ==PHY_INTERFACE_MODE_RGMII_RXID || + interface ==PHY_INTERFACE_MODE_RGMII_TXID ) + freq =125000000 ; +else +return -EINVAL ; + + ret =clk_set_rate (clk_ref, freq); +if (ret <0 ) +return ret; + +return 0 ; +} +static int fecmxc_probe (struct udevice *dev) {bool dm_mii_bus = true;
@@ -1253,6 +1280,11 @@ static int fecmxc_probe(struct udevice *dev) ret =clk_get_by_name (dev,"enet_clk_ref" , &priv->clk_ref);if (!ret) { + ret =fecmxc_set_ref_clk (&priv->clk_ref, + pdata->phy_interface); +if (ret) +return ret; + ret =clk_enable (&priv->clk_ref);if (ret)return ret;
Signature · 1 line
2.39.1
PATCH v3 11/14 net: fec_mxc: Add board_interface_eth_init() for i.MX8M Mini/Nano/Plus
In reply to Marek VasutImplement common board_interface_eth_init() and call it from the FEC driver to configure IOMUXC GPR[1] register according to the PHY mode obtained from DT. This supports all three interface modes supported by the i.MX8M Mini/Nano/Plus FEC and supersedes the current board-side configuration of the same IOMUX GPR[1] duplicated in the board files.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V3: New patch
--- arch/arm/include/asm/arch-imx8m/imx-regs.h | 2 + arch/arm/mach-imx/imx8m/clock_imx8mm.c | 48 ++++++++++++++++++++++ drivers/net/fec_mxc.c | 4 ++ 3 files changed, 54 insertions(+)
arch/arm/include/asm/arch-imx8m/imx-regs.h +2 -0
@@ -89,6 +89,7 @@#define DDRC_IPS_BASE_ADDR (X ) (0x3d400000 + ((X) * 0x2000000))#define DDR_CSD1_BASE_ADDR 0x40000000 +#define IOMUXC_GPR_GPR1_GPR_ENET1_RGMII_EN BIT(22)#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_RGMII_EN BIT(21)#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_CLK_TX_CLK_SEL BIT(20)#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_CLK_GEN_EN BIT(19)
@@ -96,6 +97,7 @@#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MII (0 << 16)#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_RGMII (1 << 16)#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_RMII (4 << 16) +#define IOMUXC_GPR_GPR1_GPR_ENET1_TX_CLK_SEL BIT(13)#define FEC_QUIRK_ENET_MAC #ifdef CONFIG_ARMV8_PSCI /* Final jump location */
arch/arm/mach-imx/imx8m/clock_imx8mm.c +48 -0
58 lines not on this page · raw message
drivers/net/fec_mxc.c +4 -0
@@ -1232,6 +1232,10 @@ static int fecmxc_probe(struct udevice *dev)uint32_t start;int ret; + ret =board_interface_eth_init (dev, pdata->phy_interface); +if (ret) +return ret; +if (IS_ENABLED (CONFIG_IMX_MODULE_FUSE )) {if (enet_fused ((ulong )priv->eth)) {printf ("SoC fuse indicates Ethernet@0x%lx is unavailable.\n" , (ulong )priv->eth);
Signature · 1 line
2.39.1
PATCH v3 12/14 arm64: dts: imx8mp: Drop EQoS clock workaround
In reply to Marek VasutThe assigned-clock no longer have to be dropped, the clock are now defined in clk-imx8mp.c and used by DWMAC driver to configure the DWMAC clock. Drop the workarounds from U-Boot specific DT extras.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: No change
V3: No change
--- arch/arm/dts/imx8mp-dhcom-u-boot.dtsi | 6 ------ arch/arm/dts/imx8mp-evk-u-boot.dtsi | 6 ------ arch/arm/dts/imx8mp-icore-mx8mp-edimm2.2-u-boot.dtsi | 6 ------ arch/arm/dts/imx8mp-venice-gw74xx-u-boot.dtsi | 6 ------ arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi | 6 ------ 5 files changed, 30 deletions(-)
arch/arm/dts/imx8mp-dhcom-u-boot.dtsi +0 -6
@@ -33,12 +33,6 @@ u-boot,dm-spl; }; -&eqos { - /delete-property/ assigned-clocks; - /delete-property/ assigned-clock-parents; - /delete-property/ assigned-clock-rates; -}; - &gpio1 { u-boot,dm-spl; };
arch/arm/dts/imx8mp-evk-u-boot.dtsi +0 -6
@@ -131,12 +131,6 @@ u-boot,dm-spl; }; -&eqos { - /delete-property/ assigned-clocks; - /delete-property/ assigned-clock-parents; - /delete-property/ assigned-clock-rates; -}; - ðphy0 { reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; reset-delay-us = <15000>;
arch/arm/dts/imx8mp-icore-mx8mp-edimm2.2-u-boot.dtsi +0 -6
@@ -130,12 +130,6 @@ u-boot,dm-spl; }; -&eqos { - /delete-property/ assigned-clocks; - /delete-property/ assigned-clock-parents; - /delete-property/ assigned-clock-rates; -}; - ðphy0 { reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; reset-delay-us = <15000>;
arch/arm/dts/imx8mp-venice-gw74xx-u-boot.dtsi +0 -6
@@ -20,12 +20,6 @@ }; }; -&eqos { - /delete-property/ assigned-clocks; - /delete-property/ assigned-clock-parents; - /delete-property/ assigned-clock-rates; -}; - ðphy0 { reset-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>; reset-delay-us = <1000>;
arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi +0 -6
@@ -39,12 +39,6 @@ u-boot,dm-spl; }; -&eqos { - /delete-property/ assigned-clocks; - /delete-property/ assigned-clock-parents; - /delete-property/ assigned-clock-rates; -}; - &gpio1 { u-boot,dm-spl; };
Signature · 1 line
2.39.1
PATCH v3 13/14 arm64: imx8mp: Drop EQoS GPR[1] board workaround
In reply to Marek VasutThe EQoS interface mode is now configured in common board_interface_eth_init() and called by EQoS MAC driver when appropriate. Drop the board side duplicates if the same functionality.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V2: Fix the advantech board build
V3: Drop now unused architecture set_clk_eqos() code as well
--- arch/arm/include/asm/arch-imx8m/clock.h | 1 - arch/arm/mach-imx/imx8m/clock_imx8mm.c | 47 ------------------- .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 17 +------ .../dh_imx8mp/imx8mp_dhcom_pdk2.c | 14 ------ board/engicam/imx8mp/icore_mx8mp.c | 16 ------- board/freescale/imx8mp_evk/imx8mp_evk.c | 17 ------- board/gateworks/venice/venice.c | 15 ------ board/msc/sm2s_imx8mp/sm2s_imx8mp.c | 15 ------ board/toradex/verdin-imx8mp/verdin-imx8mp.c | 16 ------- 9 files changed, 1 insertion(+), 157 deletions(-)
arch/arm/include/asm/arch-imx8m/clock.h +0 -1
@@ -276,5 +276,4 @@ int set_clk_qspi(void);void enable_ocotp_clk (unsigned char enable);int enable_i2c_clk (unsigned char enable,unsigned int i2c_num);int set_clk_enet (enum enet_freq type); -int set_clk_eqos (enum enet_freq type);void hab_caam_clock_enable (unsigned char enable);
arch/arm/mach-imx/imx8m/clock_imx8mm.c +0 -47
53 lines not on this page · raw message
board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +1 -16
@@ -113,7 +113,7 @@ static const iomux_v3_cfg_t eqos_rst_pads[] = { MX8MP_PAD_SAI2_RXC__GPIO4_IO22 | MUX_PAD_CTRL(NO_PAD_CTRL), }; -static void setup_iomux_eqos (void ) +static void setup_eqos (void ) {imx_iomux_v3_setup_multiple_pads (eqos_rst_pads,ARRAY_SIZE (eqos_rst_pads));
@@ -124,21 +124,6 @@ static void setup_iomux_eqos(void)gpio_direction_output (EQOS_RST_PAD ,1 ); mdelay(100); } - -static int setup_eqos (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -setup_iomux_eqos (); - -/* set INTF as RGMII, enable RGMII TXC clock */ -clrsetbits_le32 (&gpr->gpr[1 ], -IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK ,BIT (16 )); -setbits_le32 (&gpr->gpr[1 ],BIT (19 ) |BIT (21 )); - -return set_clk_eqos (ENET_125MHZ ); -}#endif /* CONFIG_DWC_ETH_QOS */ int board_phy_config (struct phy_device *phydev)
board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c +0 -14
@@ -37,19 +37,6 @@ int board_phys_sdram_size(phys_size_t *size)return 0 ; } -static void setup_eqos (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -/* Set INTF as RGMII, enable RGMII TXC clock. */ -clrsetbits_le32 (&gpr->gpr[1 ], -IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK ,BIT (16 )); -setbits_le32 (&gpr->gpr[1 ],BIT (19 ) |BIT (21 )); - -set_clk_eqos (ENET_125MHZ ); -} -static void setup_fec (void ) { struct iomuxc_gpr_base_regs *gpr =
@@ -127,7 +114,6 @@ int dh_setup_mac_address(void)int board_init (void ) { -setup_eqos ();setup_fec ();return 0 ; }
board/engicam/imx8mp/icore_mx8mp.c +0 -16
@@ -34,19 +34,6 @@ static void setup_fec(void)setbits_le32 (&gpr->gpr[1 ],BIT (22 )); } -static int setup_eqos (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -/* set INTF as RGMII, enable RGMII TXC clock */ -clrsetbits_le32 (&gpr->gpr[1 ], -IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK ,BIT (16 )); -setbits_le32 (&gpr->gpr[1 ],BIT (19 ) |BIT (21 )); - -return set_clk_eqos (ENET_125MHZ ); -} -#if CONFIG_IS_ENABLED (NET )int board_phy_config (struct phy_device *phydev) {
@@ -61,9 +48,6 @@ int board_init(void)if (IS_ENABLED (CONFIG_FEC_MXC ))setup_fec (); -if (IS_ENABLED (CONFIG_DWC_ETH_QOS )) -setup_eqos (); -return 0 ; }
board/freescale/imx8mp_evk/imx8mp_evk.c +0 -17
@@ -29,19 +29,6 @@ static void setup_fec(void)setbits_le32 (&gpr->gpr[1 ],BIT (22 )); } -static int setup_eqos (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -/* set INTF as RGMII, enable RGMII TXC clock */ -clrsetbits_le32 (&gpr->gpr[1 ], -IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK ,BIT (16 )); -setbits_le32 (&gpr->gpr[1 ],BIT (19 ) |BIT (21 )); - -return set_clk_eqos (ENET_125MHZ ); -} -#if CONFIG_IS_ENABLED (NET )int board_phy_config (struct phy_device *phydev) {
@@ -59,10 +46,6 @@ int board_init(void)setup_fec (); } -if (IS_ENABLED (CONFIG_DWC_ETH_QOS )) { - ret =setup_eqos (); - } -return ret; }
board/gateworks/venice/venice.c +0 -15
@@ -58,19 +58,6 @@ static int setup_fec(void)return 0 ; } -static int setup_eqos (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -/* set INTF as RGMII, enable RGMII TXC clock */ -clrsetbits_le32 (&gpr->gpr[1 ], -IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK ,BIT (16 )); -setbits_le32 (&gpr->gpr[1 ],BIT (19 ) |BIT (21 )); - -return set_clk_eqos (ENET_125MHZ ); -} -int board_phy_config (struct phy_device *phydev) {unsigned short val;
@@ -115,8 +102,6 @@ int board_init(void)if (IS_ENABLED (CONFIG_FEC_MXC ))setup_fec (); -if (IS_ENABLED (CONFIG_DWC_ETH_QOS )) -setup_eqos ();return 0 ; }
board/msc/sm2s_imx8mp/sm2s_imx8mp.c +0 -15
@@ -30,19 +30,6 @@ static void setup_fec(void)setbits_le32 (&gpr->gpr[1 ],BIT (22 )); } -static int setup_eqos (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -/* set INTF as RGMII, enable RGMII TXC clock */ -clrsetbits_le32 (&gpr->gpr[1 ], -IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK ,BIT (16 )); -setbits_le32 (&gpr->gpr[1 ],BIT (19 ) |BIT (21 )); - -return set_clk_eqos (ENET_125MHZ ); -} -int board_phy_config (struct phy_device *phydev) {if (phydev->drv->config)
@@ -54,7 +41,5 @@ int board_init(void) {setup_fec (); -setup_eqos (); -return 0 ; }
board/toradex/verdin-imx8mp/verdin-imx8mp.c +0 -16
@@ -49,19 +49,6 @@ static void setup_fec(void)setbits_le32 (&gpr->gpr[1 ],BIT (22 )); } -static int setup_eqos (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -/* set INTF as RGMII, enable RGMII TXC clock */ -clrsetbits_le32 (&gpr->gpr[1 ], -IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK ,BIT (16 )); -setbits_le32 (&gpr->gpr[1 ],BIT (19 ) |BIT (21 )); - -return set_clk_eqos (ENET_125MHZ ); -} -#if IS_ENABLED (CONFIG_NET )int board_phy_config (struct phy_device *phydev) {
@@ -78,9 +65,6 @@ int board_init(void)if (IS_ENABLED (CONFIG_FEC_MXC ))setup_fec (); -if (IS_ENABLED (CONFIG_DWC_ETH_QOS )) - ret =setup_eqos (); -return ret; }
Signature · 1 line
2.39.1
PATCH v3 14/14 arm64: imx8mm: imx8mn: imx8mp: Drop FEC GPR[1] board workaround
In reply to Marek VasutThe FEC interface mode is now configured in common board_interface_eth_init() and called by FEC MAC driver when appropriate. Drop the board side duplicates if the same functionality.
---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
---
V3: New patch
--- arch/arm/mach-imx/imx8m/clock_imx8mm.c | 51 +------------------ .../dh_imx8mp/imx8mp_dhcom_pdk2.c | 12 ----- board/engicam/imx8mm/icore_mx8mm.c | 15 +----- board/kontron/pitx_imx8m/pitx_imx8m.c | 14 +---- 4 files changed, 3 insertions(+), 89 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mm.c +1 -50
@@ -868,55 +868,7 @@ static int imx8mp_eqos_interface_init(struct udevice *dev, }#endif -#ifdef CONFIG_FEC_MXC -int set_clk_enet (enum enet_freq type) -{ -u32 target; -u32 enet1_ref; - -switch (type) { -case ENET_125MHZ : - enet1_ref =ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_125M_CLK ; -break ; -case ENET_50MHZ : - enet1_ref =ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_50M_CLK ; -break ; -case ENET_25MHZ : - enet1_ref =ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_25M_CLK ; -break ; -default : -return -EINVAL ; - } - -/* disable the clock first */ -clock_enable (CCGR_ENET1 ,0 ); -clock_enable (CCGR_SIM_ENET ,0 ); - -/* set enet axi clock 266Mhz */ - target =CLK_ROOT_ON |ENET_AXI_CLK_ROOT_FROM_SYS1_PLL_266M | -CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 ) | -CLK_ROOT_POST_DIV (CLK_ROOT_POST_DIV1 ); -clock_set_target_val (ENET_AXI_CLK_ROOT , target); - - target =CLK_ROOT_ON | enet1_ref | -CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 ) | -CLK_ROOT_POST_DIV (CLK_ROOT_POST_DIV1 ); -clock_set_target_val (ENET_REF_CLK_ROOT , target); - - target =CLK_ROOT_ON | -ENET1_TIME_CLK_ROOT_FROM_PLL_ENET_MAIN_100M_CLK | -CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 ) | -CLK_ROOT_POST_DIV (CLK_ROOT_POST_DIV4 ); -clock_set_target_val (ENET_TIMER_CLK_ROOT , target); - -/* enable clock */ -clock_enable (CCGR_SIM_ENET ,1 ); -clock_enable (CCGR_ENET1 ,1 ); - -return 0 ; -} - -#ifdef CONFIG_IMX8MP +#if defined(CONFIG_IMX8MP ) && defined(CONFIG_FEC_MXC )static int imx8mp_fec_interface_init (struct udevice *dev,phy_interface_t interface_type,bool mx8mp)
@@ -948,7 +900,6 @@ static int imx8mp_fec_interface_init(struct udevice *dev, return 0; }#endif -#endif int board_interface_eth_init (struct udevice *dev,phy_interface_t interface_type) {
board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c +0 -12
@@ -37,17 +37,6 @@ int board_phys_sdram_size(phys_size_t *size)return 0 ; } -static void setup_fec (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -/* Enable RGMII TX clk output. */ -setbits_le32 (&gpr->gpr[1 ],BIT (22 )); - -set_clk_enet (ENET_125MHZ ); -} -static int dh_imx8_setup_ethaddr (void ) {unsigned char enetaddr[6 ];
@@ -114,7 +103,6 @@ int dh_setup_mac_address(void)int board_init (void ) { -setup_fec ();return 0 ; }
board/engicam/imx8mm/icore_mx8mm.c +1 -14
@@ -29,7 +29,7 @@ static iomux_v3_cfg_t const fec1_rst_pads[] = { IMX8MM_PAD_NAND_DATA01_GPIO3_IO7 | MUX_PAD_CTRL(NO_PAD_CTRL), }; -static void setup_iomux_fec (void ) +static void setup_fec (void ) {imx_iomux_v3_setup_multiple_pads (fec1_rst_pads,ARRAY_SIZE (fec1_rst_pads));
@@ -40,19 +40,6 @@ static void setup_iomux_fec(void)gpio_direction_output (FEC_RST_PAD ,1 ); } -static int setup_fec (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -setup_iomux_fec (); - -/* Use 125M anatop REF_CLK1 for ENET1, not from external */ -clrsetbits_le32 (&gpr->gpr[1 ],13 ,0 ); - -return set_clk_enet (ENET_125MHZ ); -} -int board_phy_config (struct phy_device *phydev) {/* enable rgmii rxc skew and phy mode select to RGMII copper */
board/kontron/pitx_imx8m/pitx_imx8m.c +1 -13
@@ -92,24 +92,12 @@ static iomux_v3_cfg_t const fec1_rst_pads[] = { IMX8MQ_PAD_GPIO1_IO11__GPIO1_IO11 | MUX_PAD_CTRL(NO_PAD_CTRL), }; -static void setup_iomux_fec (void ) +static void setup_fec (void ) {imx_iomux_v3_setup_multiple_pads (fec1_rst_pads,ARRAY_SIZE (fec1_rst_pads)); } -static int setup_fec (void ) -{ -struct iomuxc_gpr_base_regs *gpr = - (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; - -setup_iomux_fec (); - -/* Use 125M anatop REF_CLK1 for ENET1, not from external */ -clrsetbits_le32 (&gpr->gpr[1 ],BIT (13 ) |BIT (17 ),0 ); -return set_clk_enet (ENET_125MHZ ); -} -int board_phy_config (struct phy_device *phydev) {unsigned int val;
Signature · 1 line
2.39.1
Quoted 14 lines · Marek Vasut
Add clock for the DWMAC EQoS block. This is used among other things to configure the MII clock via DM CLK.
Acked-by Sean Anderson <[email protected]>Signed-off-by Marek Vasut <[email protected]>---
Cc: "Ariel D'Alessandro" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Andrey Zhizhikin <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Marek Vasut <[email protected]>
Quoted 8 lines
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tommaso Merciai <[email protected]>
Cc: [email protected]
Quoted 49 lines
---
V2: Add AB from Sean
V3: No change--- drivers/clk/imx/clk-imx8mp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/clk/imx/clk-imx8mp.c +13
-0@@ -70,6 +70,14 @@ static const char *imx8mp_i2c6_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_"sys_pll3_out" ,"audio_pll1_out" ,"video_pll1_out" , "audio_pll2_out", "sys_pll1_133m", }; +static const char *imx8mp_enet_qos_sels[] = {"clock-osc-24m" ,"sys_pll2_125m" ,"sys_pll2_50m" , +"sys_pll2_100m" ,"sys_pll1_160m" ,"audio_pll1_out" , +"video_pll1_out" ,"clk_ext4" , }; + +static const char *imx8mp_enet_qos_timer_sels[] = {"clock-osc-24m" ,"sys_pll2_100m" ,"audio_pll1_out" , +"clk_ext1" ,"clk_ext2" ,"clk_ext3" , +"clk_ext4" ,"video_pll1_out" , }; +static const char *imx8mp_usdhc1_sels[] = {"clock-osc-24m" ,"sys_pll1_400m" ,"sys_pll1_800m" ,"sys_pll2_500m" ,"sys_pll3_out" ,"sys_pll1_266m" ,"audio_pll2_out" ,"sys_pll1_100m" , };@@ -250,6 +258,8 @@ static int imx8mp_clk_probe(struct udevice *dev)clk_dm (IMX8MP_CLK_DRAM_APB ,imx8m_clk_composite_critical ("dram_apb" , imx8mp_dram_apb_sels, base +0xa080 ));clk_dm (IMX8MP_CLK_I2C5 ,imx8m_clk_composite ("i2c5" , imx8mp_i2c5_sels, base +0xa480 ));clk_dm (IMX8MP_CLK_I2C6 ,imx8m_clk_composite ("i2c6" , imx8mp_i2c6_sels, base +0xa500 )); +clk_dm (IMX8MP_CLK_ENET_QOS ,imx8m_clk_composite ("enet_qos" , imx8mp_enet_qos_sels, base +0xa880 )); +clk_dm (IMX8MP_CLK_ENET_QOS_TIMER ,imx8m_clk_composite ("enet_qos_timer" , imx8mp_enet_qos_timer_sels, base +0xa900 ));clk_dm (IMX8MP_CLK_ENET_REF ,imx8m_clk_composite ("enet_ref" , imx8mp_enet_ref_sels, base +0xa980 ));clk_dm (IMX8MP_CLK_ENET_TIMER ,imx8m_clk_composite ("enet_timer" , imx8mp_enet_timer_sels, base +0xaa00 ));clk_dm (IMX8MP_CLK_ENET_PHY_REF ,imx8m_clk_composite ("enet_phy_ref" , imx8mp_enet_phy_ref_sels, base +0xaa80 ));@@ -292,10 +302,13 @@ static int imx8mp_clk_probe(struct udevice *dev)clk_dm (IMX8MP_CLK_I2C2_ROOT ,imx_clk_gate4 ("i2c2_root_clk" ,"i2c2" , base +0x4180 ,0 ));clk_dm (IMX8MP_CLK_I2C3_ROOT ,imx_clk_gate4 ("i2c3_root_clk" ,"i2c3" , base +0x4190 ,0 ));clk_dm (IMX8MP_CLK_I2C4_ROOT ,imx_clk_gate4 ("i2c4_root_clk" ,"i2c4" , base +0x41a0 ,0 )); +clk_dm (IMX8MP_CLK_QOS_ROOT ,imx_clk_gate4 ("qos_root_clk" ,"ipg_root" , base +0x42c0 ,0 )); +clk_dm (IMX8MP_CLK_QOS_ENET_ROOT ,imx_clk_gate4 ("qos_enet_root_clk" ,"ipg_root" , base +0x42e0 ,0 ));clk_dm (IMX8MP_CLK_QSPI_ROOT ,imx_clk_gate4 ("qspi_root_clk" ,"qspi" , base +0x42f0 ,0 ));clk_dm (IMX8MP_CLK_I2C5_ROOT ,imx_clk_gate2 ("i2c5_root_clk" ,"i2c5" , base +0x4330 ,0 ));clk_dm (IMX8MP_CLK_I2C6_ROOT ,imx_clk_gate2 ("i2c6_root_clk" ,"i2c6" , base +0x4340 ,0 ));clk_dm (IMX8MP_CLK_SIM_ENET_ROOT ,imx_clk_gate4 ("sim_enet_root_clk" ,"enet_axi" , base +0x4400 ,0 )); +clk_dm (IMX8MP_CLK_ENET_QOS_ROOT ,imx_clk_gate4 ("enet_qos_root_clk" ,"sim_enet_root_clk" , base +0x43b0 ,0 ));clk_dm (IMX8MP_CLK_UART1_ROOT ,imx_clk_gate4 ("uart1_root_clk" ,"uart1" , base +0x4490 ,0 ));clk_dm (IMX8MP_CLK_UART2_ROOT ,imx_clk_gate4 ("uart2_root_clk" ,"uart2" , base +0x44a0 ,0 ));clk_dm (IMX8MP_CLK_UART3_ROOT ,imx_clk_gate4 ("uart3_root_clk" ,"uart3" , base +0x44b0 ,0 ));