Skip to contentSkip to conversation

arm, am33xx: add defines for gmii_sel_register bits

U-Boot New Heiko Schocher 2 participants 4 messages Jun 4, 2013 – Jun 5, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

move gmii_sel register defines from board code to common place.

Cc Chandan Nath <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rini <[email protected]>
Cc Lars Poeschel <[email protected]>
Cc Enric Balletbo i Serra <[email protected]>
---
 arch/arm/include/asm/arch-am33xx/cpu.h | 8 ++++++++
 board/isee/igep0033/board.c            | 4 ++--
 board/phytec/pcm051/board.c            | 2 --
 board/ti/am335x/board.c                | 6 +-----

4 Dateien ge?ndert, 11 Zeilen hinzugef?gt(+), 9 Zeilen entfernt(-)

arch/arm/include/asm/arch-am33xx/cpu.h +8 -0
index fb44654..6dd3b0a 100644
@@ -364,6 +364,14 @@ struct ctrl_dev {
 	unsigned int resv4[4];
 	unsigned int miisel;		/* offset 0x50 */
 };
+
+/* miisel defines */
+#define MII_MODE_ENABLE		0x0
+#define RMII_MODE_ENABLE        0x5
+#define RGMII_MODE_ENABLE	0xA
+#define RGMII_INT_DELAY		0x30
+#define RMII_CHIPCKL_ENABLE     0xC0
+
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL_STRICT_NAMES */
 
board/isee/igep0033/board.c +2 -2
index 842051f..7ea22be 100644
@@ -38,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
 
 /* MII mode defines */
-#define RMII_MODE_ENABLE	0x4D
+#define RMII_MODE_P1_ENABLE	0x4D
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
@@ -182,7 +182,7 @@ int board_eth_init(bd_t *bis)
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
-	writel(RMII_MODE_ENABLE, &cdev->miisel);
+	writel(RMII_MODE_P1_ENABLE, &cdev->miisel);
 
 	rv = cpsw_register(&cpsw_data);
 	if (rv < 0)
board/phytec/pcm051/board.c +0 -2
index 72c5612..d0314e4 100644
@@ -41,8 +41,6 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
 
 /* MII mode defines */
-#define MII_MODE_ENABLE		0x0
-#define RGMII_MODE_ENABLE	0xA
 #define RMII_RGMII2_MODE_ENABLE	0x49
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
board/ti/am335x/board.c +1 -5
index b04e385..6b96f84 100644
@@ -39,10 +39,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
 
-/* MII mode defines */
-#define MII_MODE_ENABLE		0x0
-#define RGMII_MODE_ENABLE	0x3A
-
 /* GPIO that controls power to DDR on EVM-SK */
 #define GPIO_DDR_VTT_EN		7
 
@@ -465,7 +461,7 @@ int board_eth_init(bd_t *bis)
 		cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
 				PHY_INTERFACE_MODE_MII;
 	} else {
-		writel(RGMII_MODE_ENABLE, &cdev->miisel);
+		writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
 		cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
 				PHY_INTERFACE_MODE_RGMII;
 	}
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 1 line · Heiko Schocher

move gmii_sel register defines from board code to common place.

[snip]

Quoted 3 lines

/* MII mode defines */

board/isee/igep0033/board.c +1 -1
-#define RMII_MODE_ENABLE	0x4D
+#define RMII_MODE_P1_ENABLE	0x4D

[snip]

board/phytec/pcm051/board.c DECLARE_GLOBAL_DATA_PTR; · line 44

Quoted 4 lines

/* MII mode defines */

board/phytec/pcm051/board.c +0 -2
-#define MII_MODE_ENABLE		0x0
-#define RGMII_MODE_ENABLE	0xA
 #define RMII_RGMII2_MODE_ENABLE	0x49

Looks like there's a few bits you're leaving in the board files still, please move them all over since they come from the TRM, right? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130604/cad95e8f/attachment.pgp>
#2 lore raw

Hello Tom,

Am 04.06.2013 23:30, schrieb Tom Rini:

Quoted 8 lines · Heiko Schocher
Quoted 2 lines

move gmii_sel register defines from board code to common place.

[snip]

Quoted 3 lines

/* MII mode defines */

board/isee/igep0033/board.c +1 -1
-#define RMII_MODE_ENABLE	0x4D
+#define RMII_MODE_P1_ENABLE	0x4D

[snip]

Quoted 7 lines

board/phytec/pcm051/board.c DECLARE_GLOBAL_DATA_PTR; · line 44

Quoted 4 lines

/* MII mode defines */

board/phytec/pcm051/board.c +0 -2
-#define MII_MODE_ENABLE		0x0
-#define RGMII_MODE_ENABLE	0xA
 #define RMII_RGMII2_MODE_ENABLE	0x49

Looks like there's a few bits you're leaving in the board files still, please move them all over since they come from the TRM, right? Thanks!

Done.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH v2 1/1 arm, am33xx: add defines for gmii_sel_register bits

In reply to Heiko Schocher

move gmii_sel register defines from board code to common place.

Cc Chandan Nath <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rini <[email protected]>
Cc Lars Poeschel <[email protected]>
Cc Enric Balletbo i Serra <[email protected]>

---
- changes for v2:
defined all bits used in the gmii_sel register as Tom Rini suggested

 arch/arm/include/asm/arch-am33xx/cpu.h | 21 +++++++++++++++++++++
 board/isee/igep0033/board.c            |  7 ++-----
 board/phytec/pcm051/board.c            |  2 --
 board/ti/am335x/board.c                |  6 +-----

4 Dateien ge?ndert, 24 Zeilen hinzugef?gt(+), 12 Zeilen entfernt(-)

arch/arm/include/asm/arch-am33xx/cpu.h +21 -0
index fb44654..98e15c0 100644
@@ -364,6 +364,27 @@ struct ctrl_dev {
 	unsigned int resv4[4];
 	unsigned int miisel;		/* offset 0x50 */
 };
+
+/* gmii_sel register defines */
+#define GMII1_SEL_MII		0x0
+#define GMII1_SEL_RMII		0x1
+#define GMII1_SEL_RGMII		0x2
+#define GMII1_SEL_NOTUSED	0x3
+#define GMII2_SEL_MII		0x0
+#define GMII2_SEL_RMII		0x4
+#define GMII2_SEL_RGMII		0x8
+#define GMII2_SEL_NOTUSED	0xc
+#define RGMII1_IDMODE		BIT(4)
+#define RGMII2_IDMODE		BIT(5)
+#define RMII1_IO_CLK_EN		BIT(6)
+#define RMII2_IO_CLK_EN		BIT(7)
+
+#define MII_MODE_ENABLE		(GMII1_SEL_MII | GMII2_SEL_MII)
+#define RMII_MODE_ENABLE        (GMII1_SEL_RMII | GMII2_SEL_RMII)
+#define RGMII_MODE_ENABLE	(GMII1_SEL_RGMII | GMII2_SEL_RGMII)
+#define RGMII_INT_DELAY		(RGMII1_IDMODE | RGMII2_IDMODE)
+#define RMII_CHIPCKL_ENABLE     (RMII1_IO_CLK_EN | RMII2_IO_CLK_EN)
+
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL_STRICT_NAMES */
 
board/isee/igep0033/board.c +2 -5
index 842051f..d7cf7d0 100644
@@ -36,10 +36,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
-
-/* MII mode defines */
-#define RMII_MODE_ENABLE	0x4D
-
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
 static const struct ddr_data ddr3_data = {
@@ -182,7 +178,8 @@ int board_eth_init(bd_t *bis)
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
-	writel(RMII_MODE_ENABLE, &cdev->miisel);
+	writel((GMII1_SEL_RMII | GMII2_SEL_NOTUSED | RMII1_IO_CLK_EN),
+	       &cdev->miisel);
 
 	rv = cpsw_register(&cpsw_data);
 	if (rv < 0)
board/phytec/pcm051/board.c +0 -2
index 72c5612..d0314e4 100644
@@ -41,8 +41,6 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
 
 /* MII mode defines */
-#define MII_MODE_ENABLE		0x0
-#define RGMII_MODE_ENABLE	0xA
 #define RMII_RGMII2_MODE_ENABLE	0x49
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
board/ti/am335x/board.c +1 -5
index b04e385..6b96f84 100644
@@ -39,10 +39,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
 
-/* MII mode defines */
-#define MII_MODE_ENABLE		0x0
-#define RGMII_MODE_ENABLE	0x3A
-
 /* GPIO that controls power to DDR on EVM-SK */
 #define GPIO_DDR_VTT_EN		7
 
@@ -465,7 +461,7 @@ int board_eth_init(bd_t *bis)
 		cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
 				PHY_INTERFACE_MODE_MII;
 	} else {
-		writel(RGMII_MODE_ENABLE, &cdev->miisel);
+		writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
 		cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
 				PHY_INTERFACE_MODE_RGMII;
 	}
Signature · 1 line
1.7.11.7