* [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY
@ 2016-04-27 7:10 Stefan Roese
2016-04-27 7:10 ` [U-Boot] [PATCH 2/3] arm: spear: x600: Remove EFI support to reduce image size Stefan Roese
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Stefan Roese @ 2016-04-27 7:10 UTC (permalink / raw)
To: u-boot
As the old ethernet PHY is not available any more, the x600 board has
been redesigned with the Micrel KSZ9031 PHY. This patch adds support
to autodetect the PHY and configure the Micrel PHY correctly.
Signed-off-by: Stefan Roese <sr@denx.de>
---
board/spear/x600/x600.c | 80 ++++++++++++++++++++++++++++++++++++-------------
include/configs/x600.h | 2 ++
2 files changed, 61 insertions(+), 21 deletions(-)
diff --git a/board/spear/x600/x600.c b/board/spear/x600/x600.c
index b8edfcd..f8e9fdd 100644
--- a/board/spear/x600/x600.c
+++ b/board/spear/x600/x600.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <micrel.h>
#include <nand.h>
#include <netdev.h>
#include <phy.h>
@@ -69,27 +70,64 @@ void board_nand_init(void)
int board_phy_config(struct phy_device *phydev)
{
- /* Extended PHY control 1, select GMII */
- phy_write(phydev, MDIO_DEVAD_NONE, 23, 0x0020);
-
- /* Software reset necessary after GMII mode selction */
- phy_reset(phydev);
-
- /* Enable extended page register access */
- phy_write(phydev, MDIO_DEVAD_NONE, 31, 0x0001);
-
- /* 17e: Enhanced LED behavior, needs to be written twice */
- phy_write(phydev, MDIO_DEVAD_NONE, 17, 0x09ff);
- phy_write(phydev, MDIO_DEVAD_NONE, 17, 0x09ff);
-
- /* 16e: Enhanced LED method select */
- phy_write(phydev, MDIO_DEVAD_NONE, 16, 0xe0ea);
-
- /* Disable extended page register access */
- phy_write(phydev, MDIO_DEVAD_NONE, 31, 0x0000);
-
- /* Enable clock output pin */
- phy_write(phydev, MDIO_DEVAD_NONE, 18, 0x0049);
+ unsigned short id1, id2;
+
+ /* check whether KSZ9031 or AR8035 has to be configured */
+ id1 = phy_read(phydev, MDIO_DEVAD_NONE, 2);
+ id2 = phy_read(phydev, MDIO_DEVAD_NONE, 3);
+
+ if ((id1 == 0x22) && ((id2 & 0xFFF0) == 0x1620)) {
+ /* PHY configuration for Micrel KSZ9031 */
+ printf("PHY KSZ9031 detected - ");
+
+ phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, 0x1c00);
+
+ /* control data pad skew - devaddr = 0x02, register = 0x04 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC,
+ 0x0000);
+ /* rx data pad skew - devaddr = 0x02, register = 0x05 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC,
+ 0x0000);
+ /* tx data pad skew - devaddr = 0x02, register = 0x05 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC,
+ 0x0000);
+ /* gtx and rx clock pad skew - devaddr = 0x02, reg = 0x08 */
+ ksz9031_phy_extended_write(phydev, 0x02,
+ MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
+ MII_KSZ9031_MOD_DATA_NO_POST_INC,
+ 0x03FF);
+ } else {
+ /* PHY configuration for Vitesse VSC8641 */
+ printf("PHY VSC8641 detected - ");
+
+ /* Extended PHY control 1, select GMII */
+ phy_write(phydev, MDIO_DEVAD_NONE, 23, 0x0020);
+
+ /* Software reset necessary after GMII mode selction */
+ phy_reset(phydev);
+
+ /* Enable extended page register access */
+ phy_write(phydev, MDIO_DEVAD_NONE, 31, 0x0001);
+
+ /* 17e: Enhanced LED behavior, needs to be written twice */
+ phy_write(phydev, MDIO_DEVAD_NONE, 17, 0x09ff);
+ phy_write(phydev, MDIO_DEVAD_NONE, 17, 0x09ff);
+
+ /* 16e: Enhanced LED method select */
+ phy_write(phydev, MDIO_DEVAD_NONE, 16, 0xe0ea);
+
+ /* Disable extended page register access */
+ phy_write(phydev, MDIO_DEVAD_NONE, 31, 0x0000);
+
+ /* Enable clock output pin */
+ phy_write(phydev, MDIO_DEVAD_NONE, 18, 0x0049);
+ }
if (phydev->drv->config)
phydev->drv->config(phydev);
diff --git a/include/configs/x600.h b/include/configs/x600.h
index d7da0b2..160b2c5 100644
--- a/include/configs/x600.h
+++ b/include/configs/x600.h
@@ -80,6 +80,8 @@
#define CONFIG_PHY_RESET_DELAY 10000 /* in usec */
#define CONFIG_PHY_ADDR 0 /* PHY address */
#define CONFIG_PHY_GIGE /* Include GbE speed/duplex detection */
+#define CONFIG_PHY_MICREL
+#define CONFIG_PHY_MICREL_KSZ9031
#define CONFIG_SPEAR_GPIO
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 2/3] arm: spear: x600: Remove EFI support to reduce image size
2016-04-27 7:10 [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY Stefan Roese
@ 2016-04-27 7:10 ` Stefan Roese
2016-05-31 5:57 ` Stefan Roese
2016-04-27 7:10 ` [U-Boot] [PATCH 3/3] arm: spear: Disable I2C designware enable status reg check Stefan Roese
2016-05-31 5:56 ` [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY Stefan Roese
2 siblings, 1 reply; 5+ messages in thread
From: Stefan Roese @ 2016-04-27 7:10 UTC (permalink / raw)
To: u-boot
EFI is not needed on x600. So lets remove the EFI support to make it fit
into the 0x60000 image size limit again.
Signed-off-by: Stefan Roese <sr@denx.de>
---
configs/x600_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/x600_defconfig b/configs/x600_defconfig
index 1a07b9d..41c3983 100644
--- a/configs/x600_defconfig
+++ b/configs/x600_defconfig
@@ -21,3 +21,4 @@ CONFIG_NETDEVICES=y
CONFIG_ETH_DESIGNWARE=y
CONFIG_USE_TINY_PRINTF=y
CONFIG_OF_LIBFDT=y
+# CONFIG_EFI_LOADER is not set
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 3/3] arm: spear: Disable I2C designware enable status reg check
2016-04-27 7:10 [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY Stefan Roese
2016-04-27 7:10 ` [U-Boot] [PATCH 2/3] arm: spear: x600: Remove EFI support to reduce image size Stefan Roese
@ 2016-04-27 7:10 ` Stefan Roese
2016-05-31 5:56 ` [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY Stefan Roese
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2016-04-27 7:10 UTC (permalink / raw)
To: u-boot
The I2C designware controller doesn't support the enable status register.
This patch disables the check on the SPEAr platforms.
Signed-off-by: Stefan Roese <sr@denx.de>
---
include/configs/spear-common.h | 1 +
include/configs/x600.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index c4b6234..365ce6e 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -36,6 +36,7 @@
/* I2C driver configuration */
#define CONFIG_SYS_I2C
#define CONFIG_SYS_I2C_DW
+#define CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED
#if defined(CONFIG_SPEAR600)
#define CONFIG_SYS_I2C_BASE 0xD0200000
#elif defined(CONFIG_SPEAR300)
diff --git a/include/configs/x600.h b/include/configs/x600.h
index 160b2c5..ca28fae 100644
--- a/include/configs/x600.h
+++ b/include/configs/x600.h
@@ -88,6 +88,7 @@
/* I2C config options */
#define CONFIG_SYS_I2C
#define CONFIG_SYS_I2C_DW
+#define CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED
#define CONFIG_SYS_I2C_BASE 0xD0200000
#define CONFIG_SYS_I2C_SPEED 400000
#define CONFIG_SYS_I2C_SLAVE 0x02
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY
2016-04-27 7:10 [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY Stefan Roese
2016-04-27 7:10 ` [U-Boot] [PATCH 2/3] arm: spear: x600: Remove EFI support to reduce image size Stefan Roese
2016-04-27 7:10 ` [U-Boot] [PATCH 3/3] arm: spear: Disable I2C designware enable status reg check Stefan Roese
@ 2016-05-31 5:56 ` Stefan Roese
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2016-05-31 5:56 UTC (permalink / raw)
To: u-boot
On 27.04.2016 09:10, Stefan Roese wrote:
> As the old ethernet PHY is not available any more, the x600 board has
> been redesigned with the Micrel KSZ9031 PHY. This patch adds support
> to autodetect the PHY and configure the Micrel PHY correctly.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
Applied to u-boot-marvell/master
Thanks,
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-31 5:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27 7:10 [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY Stefan Roese
2016-04-27 7:10 ` [U-Boot] [PATCH 2/3] arm: spear: x600: Remove EFI support to reduce image size Stefan Roese
2016-05-31 5:57 ` Stefan Roese
2016-04-27 7:10 ` [U-Boot] [PATCH 3/3] arm: spear: Disable I2C designware enable status reg check Stefan Roese
2016-05-31 5:56 ` [U-Boot] [PATCH 1/3] arm: spear: x600: Add support for Micrel KSZ9031 PHY Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox