From 13ae2a40e7d458ad0c2961359c346578a305263d Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Fri, 22 Sep 2017 15:26:33 +0800 Subject: [PATCH 1/2] net: sun8i_emac: Fix build for non-H3/H5 SoCs Only the H3/H5 SoCs have an internal PHY and its related clock and reset controls. Use an #ifdef to guard the internal PHY control code block so it can be built for other SoCs, such as the A83T or A64. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard Reviewed-by: Joe Hershberger Reviewed-by: Jagan Teki --- drivers/net/sun8i_emac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c index 09bbb2cdb5..3ccc6b0bb6 100644 --- a/drivers/net/sun8i_emac.c +++ b/drivers/net/sun8i_emac.c @@ -604,6 +604,8 @@ static void sun8i_emac_board_setup(struct emac_eth_dev *priv) { struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; +#ifdef CONFIG_MACH_SUNXI_H3_H5 + /* Only H3/H5 have clock controls for internal EPHY */ if (priv->use_internal_phy) { /* Set clock gating for ephy */ setbits_le32(&ccm->bus_gate4, BIT(AHB_GATE_OFFSET_EPHY)); @@ -611,6 +613,7 @@ static void sun8i_emac_board_setup(struct emac_eth_dev *priv) /* Deassert EPHY */ setbits_le32(&ccm->ahb_reset2_cfg, BIT(AHB_RESET_OFFSET_EPHY)); } +#endif /* Set clock gating for emac */ setbits_le32(&ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_GMAC)); From 8e2c2d413c37b7fd13641730b706774c08982f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Werner=20B=C3=B6llmann?= Date: Fri, 10 Nov 2017 19:14:20 +0530 Subject: [PATCH 2/2] sunxi: SATA link timeout fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After updating u-boot from v2016.01 to 2017.09, issue with "SATA link 0 timeout." on my Cubietruck board. mdelay milled after moving satapwr code to board. "sunxi: Turn satapwr on from board_init" (sha1: 9fbb0c3aa49f4604b0342cb527a6bd099f92eaeb) After adding the "mdelay(500);" line that was lost in the path the error is gone. Signed-off-by: Werner Böllmann [Rebased and updated change and commit message] Signed-off-by: Jagan Teki Reviewed-by: Jagan Teki --- board/sunxi/board.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 6e13ee32c1..dcacdf3e62 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -217,6 +217,8 @@ int board_init(void) satapwr_pin = sunxi_name_to_gpio(CONFIG_SATAPWR); gpio_request(satapwr_pin, "satapwr"); gpio_direction_output(satapwr_pin, 1); + /* Give attached sata device time to power-up to avoid link timeouts */ + mdelay(500); #endif #ifdef CONFIG_MACPWR macpwr_pin = sunxi_name_to_gpio(CONFIG_MACPWR);