summaryrefslogtreecommitdiff
path: root/board/keymile
diff options
context:
space:
mode:
authorTobias Müller <Tobias.Mueller@keymile.com>2015-11-13 15:01:15 +0100
committerTom Rini <trini@konsulko.com>2015-11-18 15:28:30 -0500
commit9ff739e42257099a797572bf21a218ee526c58df (patch)
tree48066a372877db7bf36cd80b40817c404296a603 /board/keymile
parent716e4ffe99152ea572c7913462dcdf981023050f (diff)
downloadu-boot-imx-9ff739e42257099a797572bf21a218ee526c58df.zip
u-boot-imx-9ff739e42257099a797572bf21a218ee526c58df.tar.gz
u-boot-imx-9ff739e42257099a797572bf21a218ee526c58df.tar.bz2
arm/km: Fix LED configuration for 88E1118R PHY (PIGGY3)
Configure PHY LED register for Marvell 88E1118R PHY used on PIGGY3 to match with printed descriptions on PCB Signed-off-by: Tobias Müller <Tobias.Mueller@keymile.com> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com> [trini: Fix typo, CRTL_PAGE -> CTRL_PAGE] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'board/keymile')
-rw-r--r--board/keymile/km_arm/km_arm.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 2938861..64cf2ed 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -37,6 +37,24 @@ DECLARE_GLOBAL_DATA_PTR;
#define REG_IRQ_CIRQ2 0x2d
#define MASK_RBI_DEFECT_16 0x01
+/*
+ * PHY registers definitions
+ */
+#define PHY_MARVELL_OUI 0x5043
+#define PHY_MARVELL_88E1118_MODEL 0x0022
+#define PHY_MARVELL_88E1118R_MODEL 0x0024
+
+#define PHY_MARVELL_PAGE_REG 0x0016
+#define PHY_MARVELL_DEFAULT_PAGE 0x0000
+
+#define PHY_MARVELL_88E1118R_LED_CTRL_PAGE 0x0003
+#define PHY_MARVELL_88E1118R_LED_CTRL_REG 0x0010
+
+#define PHY_MARVELL_88E1118R_LED_CTRL_RESERVED 0x1000
+#define PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB (0x7<<0)
+#define PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT (0x3<<4)
+#define PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK (0x0<<8)
+
/* Multi-Purpose Pins Functionality configuration */
static const u32 kwmpp_config[] = {
MPP0_NF_IO2,
@@ -409,6 +427,9 @@ void reset_phy(void)
/* Configure and enable MV88E1118 PHY on the piggy*/
void reset_phy(void)
{
+ unsigned int oui;
+ unsigned char model, rev;
+
char *name = "egiga0";
if (miiphy_set_current_dev(name))
@@ -416,6 +437,40 @@ void reset_phy(void)
/* reset the phy */
miiphy_reset(name, CONFIG_PHY_BASE_ADR);
+
+ /* get PHY model */
+ if (miiphy_info(name, CONFIG_PHY_BASE_ADR, &oui, &model, &rev))
+ return;
+
+ /* check for Marvell 88E1118R Gigabit PHY (PIGGY3) */
+ if ((oui == PHY_MARVELL_OUI) &&
+ (model == PHY_MARVELL_88E1118R_MODEL)) {
+ /* set page register to 3 */
+ if (miiphy_write(name, CONFIG_PHY_BASE_ADR,
+ PHY_MARVELL_PAGE_REG,
+ PHY_MARVELL_88E1118R_LED_CTRL_PAGE))
+ printf("Error writing PHY page reg\n");
+
+ /*
+ * leds setup as printed on PCB:
+ * LED2 (Link): 0x0 (On Link, Off No Link)
+ * LED1 (Activity): 0x3 (On Activity, Off No Activity)
+ * LED0 (Speed): 0x7 (On 1000 MBits, Off Else)
+ */
+ if (miiphy_write(name, CONFIG_PHY_BASE_ADR,
+ PHY_MARVELL_88E1118R_LED_CTRL_REG,
+ PHY_MARVELL_88E1118R_LED_CTRL_RESERVED |
+ PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB |
+ PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT |
+ PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK))
+ printf("Error writing PHY LED reg\n");
+
+ /* set page register back to 0 */
+ if (miiphy_write(name, CONFIG_PHY_BASE_ADR,
+ PHY_MARVELL_PAGE_REG,
+ PHY_MARVELL_DEFAULT_PAGE))
+ printf("Error writing PHY page reg\n");
+ }
}
#endif