Skip to contentSkip to conversation

da850evm: Add RMII support for EMAC

PATCH New Ben Gardiner 3 participants 7 messages Nov 5, 2010 – Nov 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 da850evm: Add RMII support for EMAC

From: Sudhakar Rajashekhara <[email protected]>

This patch is a port of the work by Sudhakar Rajeshekhara in commit ab3effbcad8851cc65dc5241a01c064d2030a3b2 of
git://arago-project.org/git/people/sandeep/u-boot-davinci.git.

The da850 UI board has on it an RMII PHY which can be used if the MDC line to the MII PHY on the baseboard is disabled and the RMII PHY is enabled by configuring the values of some GPIO pins on the IO expander of the UI board. This patch implements disabling that line via GPIO2[6], configuring the UI board's IO expander and setting only the pinmux settings that are needed for RMII operation.

Tested on da850evm by adding a define for CONFIG_DRIVER_TI_EMAC_USE_RMII.

---

Changes since work of Sudhakar Rajashekhar:
* rebased to 0c0892be0d93a5a892b93739c5eb3bf692fed4ff, resolved conflicts.
* fixup uses of pinmux[x] to pinmux(x)

---
 arch/arm/include/asm/arch-davinci/hardware.h |    4 +
 board/davinci/da8xxevm/common.c              |   14 +++
 board/davinci/da8xxevm/common.h              |    3 +
 board/davinci/da8xxevm/da850evm.c            |  112 +++++++++++++++++++++++++-
 drivers/net/davinci_emac.c                   |   41 +++++++++-
 include/configs/da850evm.h                   |    1 +
 6 files changed, 170 insertions(+), 5 deletions(-)
arch/arm/include/asm/arch-davinci/hardware.h +4 -0
index 3520cf8..da1160a 100644
@@ -150,6 +150,10 @@ typedef volatile unsigned int *	dv_reg_p;
 #define DAVINCI_INTC_BASE			0xfffee000
 #define DAVINCI_BOOTCFG_BASE			0x01c14000
 
+#define GPIO_BANK2_REG_DIR_ADDR			(DAVINCI_GPIO_BASE + 0x38)
+#define GPIO_BANK2_REG_OPDATA_ADDR		(DAVINCI_GPIO_BASE + 0x3c)
+#define GPIO_BANK2_REG_SET_ADDR			(DAVINCI_GPIO_BASE + 0x40)
+#define GPIO_BANK2_REG_CLR_ADDR			(DAVINCI_GPIO_BASE + 0x44)
 #endif /* CONFIG_SOC_DA8XX */
 
 /* Power and Sleep Controller (PSC) Domains */
board/davinci/da8xxevm/common.c +14 -0
index 9cd5204..b33b877 100644
@@ -53,3 +53,17 @@ int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 
 	return 0;
 }
+
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel)
+{
+	int val;
+
+	val = readl(&davinci_syscfg_regs->cfgchip3);
+	if (mode_sel == 0)
+		val &= ~(1 << 8);
+	else
+		val |= (1 << 8);
+	writel(val, &davinci_syscfg_regs->cfgchip3);
+}
+#endif
board/davinci/da8xxevm/common.h +3 -0
index 7ae63a6..8b564f7 100644
@@ -26,5 +26,8 @@ struct lpsc_resource {
 void irq_init(void);
 int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 				    int n_items);
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel);
+#endif
 
 #endif /* __COMMON_H */
board/davinci/da8xxevm/da850evm.c +108 -4

151 lines not on this page · raw message

drivers/net/davinci_emac.c +40 -1

60 lines not on this page · raw message

include/configs/da850evm.h +1 -0
index 7b04be0..3d5259f 100644
@@ -78,6 +78,7 @@
 #define CONFIG_DRIVER_DAVINCI_I2C
 #define CONFIG_SYS_I2C_SPEED		25000
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C_EXPANDER_ADDR	0x20
 
 /*
  * Flash & Environment
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 da850evm: Add RMII support for EMAC

Quoted 1 line · On Friday, November 05, 2010 17:11:13 Ben Gardiner wrote:
CC Sandeep Paulraj <[email protected]>"

spurious quote in this tag
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101109/673e6e3d/attachment.pgp

#2 lore raw

PATCH v2 1/1 da850: Add RMII support for EMAC

From: Sudhakar Rajashekhara <[email protected]>

From: Sudhakar Rajashekhara <[email protected]>

This patch is a port of the work by Sudhakar Rajeshekhara in commit ab3effbcad8851cc65dc5241a01c064d2030a3b2 of
git://arago-project.org/git/people/sandeep/u-boot-davinci.git.

The da850 UI board has on it an RMII PHY which can be used if the MDC line to the MII PHY on the baseboard is disabled and the RMII PHY is enabled by configuring the values of some GPIO pins on the IO expander of the UI board. This patch implements disabling that line via GPIO2[6], configuring the UI board's IO expander and setting only the pinmux settings that are needed for RMII operation.

Tested on da850evm by adding a define for CONFIG_DRIVER_TI_EMAC_USE_RMII.

---

Changes since V1:
* Removeed spurious quote in Sandeep's CC: line
Changes since work of Sudhakar Rajashekhar:
* rebased to 0c0892be0d93a5a892b93739c5eb3bf692fed4ff, resolved conflicts.
* fixup uses of pinmux[x] to pinmux(x)

---
 arch/arm/include/asm/arch-davinci/hardware.h |    4 +
 board/davinci/da8xxevm/common.c              |   14 +++
 board/davinci/da8xxevm/common.h              |    3 +
 board/davinci/da8xxevm/da850evm.c            |  112 +++++++++++++++++++++++++-
 drivers/net/davinci_emac.c                   |   41 +++++++++-
 include/configs/da850evm.h                   |    1 +
 6 files changed, 170 insertions(+), 5 deletions(-)
arch/arm/include/asm/arch-davinci/hardware.h +4 -0
index 3520cf8..da1160a 100644
@@ -150,6 +150,10 @@ typedef volatile unsigned int *	dv_reg_p;
 #define DAVINCI_INTC_BASE			0xfffee000
 #define DAVINCI_BOOTCFG_BASE			0x01c14000
 
+#define GPIO_BANK2_REG_DIR_ADDR			(DAVINCI_GPIO_BASE + 0x38)
+#define GPIO_BANK2_REG_OPDATA_ADDR		(DAVINCI_GPIO_BASE + 0x3c)
+#define GPIO_BANK2_REG_SET_ADDR			(DAVINCI_GPIO_BASE + 0x40)
+#define GPIO_BANK2_REG_CLR_ADDR			(DAVINCI_GPIO_BASE + 0x44)
 #endif /* CONFIG_SOC_DA8XX */
 
 /* Power and Sleep Controller (PSC) Domains */
board/davinci/da8xxevm/common.c +14 -0
index 9cd5204..b33b877 100644
@@ -53,3 +53,17 @@ int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 
 	return 0;
 }
+
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel)
+{
+	int val;
+
+	val = readl(&davinci_syscfg_regs->cfgchip3);
+	if (mode_sel == 0)
+		val &= ~(1 << 8);
+	else
+		val |= (1 << 8);
+	writel(val, &davinci_syscfg_regs->cfgchip3);
+}
+#endif
board/davinci/da8xxevm/common.h +3 -0
index 7ae63a6..8b564f7 100644
@@ -26,5 +26,8 @@ struct lpsc_resource {
 void irq_init(void);
 int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 				    int n_items);
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel);
+#endif
 
 #endif /* __COMMON_H */
board/davinci/da8xxevm/da850evm.c +108 -4

151 lines not on this page · raw message

drivers/net/davinci_emac.c +40 -1

60 lines not on this page · raw message

include/configs/da850evm.h +1 -0
index 7b04be0..3d5259f 100644
@@ -78,6 +78,7 @@
 #define CONFIG_DRIVER_DAVINCI_I2C
 #define CONFIG_SYS_I2C_SPEED		25000
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C_EXPANDER_ADDR	0x20
 
 /*
  * Flash & Environment
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v3 1/1 da850: Add RMII support for EMAC

From: Sudhakar Rajashekhara <[email protected]>

This patch is a port of the work by Sudhakar Rajeshekhara in commit ab3effbcad8851cc65dc5241a01c064d2030a3b2 of
git://arago-project.org/git/people/sandeep/u-boot-davinci.git.

The da850 UI board has on it an RMII PHY which can be used if the MDC line to the MII PHY on the baseboard is disabled and the RMII PHY is enabled by configuring the values of some GPIO pins on the IO expander of the UI board. This patch implements disabling that line via GPIO2[6], configuring the UI board's IO expander and setting only the pinmux settings that are needed for RMII operation.

Tested on da850evm by adding a define for CONFIG_DRIVER_TI_EMAC_USE_RMII.

CC Sandeep Paulraj <[email protected]>
CC Ben Warren <[email protected]>
CC Mike Frysinger <[email protected]>
CC Sughosh Ganu <[email protected]>

---

Changes since V2:
* rebased this patch onto the patch series by Sugosh
* put the declaration of the the rmii_sel function in arch/arm/include/asm/arch-davinci/da8xx_common.h to match the changes made by sugosh's patch
* reordered the RMII PHY init and EMAC init
Changes since V1:
* Removeed spurious quote in Sandeep's CC: line
Changes since work of Sudhakar Rajashekhar:
* rebased to 0c0892be0d93a5a892b93739c5eb3bf692fed4ff, resolved conflicts.
* fixup uses of pinmux[x] to pinmux(x)

---
 arch/arm/include/asm/arch-davinci/da8xx_common.h |    4 +
 arch/arm/include/asm/arch-davinci/hardware.h     |    4 +
 board/davinci/da8xxevm/common.c                  |   14 +++
 board/davinci/da8xxevm/da850evm.c                |  112 +++++++++++++++++++++-
 drivers/net/davinci_emac.c                       |   41 ++++++++-
 include/configs/da850evm.h                       |    1 +
 6 files changed, 171 insertions(+), 5 deletions(-)
arch/arm/include/asm/arch-davinci/da8xx_common.h +4 -0
index bc3092d..e52f613 100644
@@ -30,4 +30,8 @@ void irq_init(void);
 int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 				    int n_items);
 
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel);
+#endif
+
 #endif /* __COMMON_H */
arch/arm/include/asm/arch-davinci/hardware.h +4 -0
index d006ac1..4ac6906 100644
@@ -150,6 +150,10 @@ typedef volatile unsigned int *	dv_reg_p;
 #define DAVINCI_INTC_BASE			0xfffee000
 #define DAVINCI_BOOTCFG_BASE			0x01c14000
 
+#define GPIO_BANK2_REG_DIR_ADDR			(DAVINCI_GPIO_BASE + 0x38)
+#define GPIO_BANK2_REG_OPDATA_ADDR		(DAVINCI_GPIO_BASE + 0x3c)
+#define GPIO_BANK2_REG_SET_ADDR			(DAVINCI_GPIO_BASE + 0x40)
+#define GPIO_BANK2_REG_CLR_ADDR			(DAVINCI_GPIO_BASE + 0x44)
 #endif /* CONFIG_SOC_DA8XX */
 
 /* Power and Sleep Controller (PSC) Domains */
board/davinci/da8xxevm/common.c +14 -0
index 36bf693..2d9a64b 100644
@@ -53,3 +53,17 @@ int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 
 	return 0;
 }
+
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel)
+{
+	int val;
+
+	val = readl(&davinci_syscfg_regs->cfgchip3);
+	if (mode_sel == 0)
+		val &= ~(1 << 8);
+	else
+		val |= (1 << 8);
+	writel(val, &davinci_syscfg_regs->cfgchip3);
+}
+#endif
board/davinci/da8xxevm/da850evm.c +108 -4

150 lines not on this page · raw message

drivers/net/davinci_emac.c +40 -1

60 lines not on this page · raw message

include/configs/da850evm.h +1 -0
index 7b04be0..e9babc4 100644
@@ -78,6 +78,7 @@
 #define CONFIG_DRIVER_DAVINCI_I2C
 #define CONFIG_SYS_I2C_SPEED		25000
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C_EXPANDER_ADDR   0x20
 
 /*
  * Flash & Environment
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v4 1/1 da850: Add RMII support for EMAC

From: Sudhakar Rajashekhara <[email protected]>

This patch is a port of the work by Sudhakar Rajeshekhara in commit ab3effbcad8851cc65dc5241a01c064d2030a3b2 of
git://arago-project.org/git/people/sandeep/u-boot-davinci.git.

The da850 UI board has on it an RMII PHY which can be used if the MDC line to the MII PHY on the baseboard is disabled and the RMII PHY is enabled by configuring the values of some GPIO pins on the IO expander of the UI board. This patch implements disabling that line via GPIO2[6], configuring the UI board's IO expander and setting only the pinmux settings that are needed for RMII operation.

Tested on da850evm by adding a define for CONFIG_DRIVER_TI_EMAC_USE_RMII.

CC Sandeep Paulraj <[email protected]>
CC Mike Frysinger <[email protected]>
CC Sughosh Ganu <[email protected]>

---

Changes since V3:
* removed Ben Warren from the CC since he isn't the net custodian anymore
* rebased ontop of Stefano's SPI patches and Sugosh's hawkboard patches; current commits look like:
[PATCH V4][NEXT] da850: Add RMII support for EMAC -- Sudhakar Rajashekhara <[email protected]> 2010-11-18 09:59:37 -0500 Add board support for hawkboard -- Sughosh Ganu <[email protected]> 2010-11-01 23:30:34 +0530 Remove board_init_f function from nand_boot.c -- Sughosh Ganu <[email protected]> 2010-11-01 23:29:27 +0530 Move and rename common headers from under board/davinci. -- Sughosh Ganu <[email protected]> 2010-11-01 23:28:38 +0530
da850: Enable SPI Flash -- Stefano Babic <[email protected]> 2010-11-11 15:38:02 +0100
da8xx: Add cpu_is_da8xx macros -- Sudhakar Rajashekhara <[email protected]> 2010-11-11 15:38:01 +0100
Net: clarify board/cpu_eth_init calls -- Ben Warren <[email protected]> 2010-08-31 23:05:04 -0700 Changes since V2:
* rebased this patch onto the patch series by Sugosh
* put the declaration of the the rmii_sel function in
arch/arm/include/asm/arch-davinci/da8xx_common.h to match the changes
made by sugosh's patch
* reordered the RMII PHY init and EMAC init
Changes since V1:
* Removeed spurious quote in Sandeep's CC: line
Changes since work of Sudhakar Rajashekhar:
* rebased to 0c0892be0d93a5a892b93739c5eb3bf692fed4ff, resolved conflicts.
* fixup uses of pinmux[x] to pinmux(x)

---
 arch/arm/include/asm/arch-davinci/da8xx_common.h |    4 +
 arch/arm/include/asm/arch-davinci/hardware.h     |    4 +
 board/davinci/da8xxevm/common.c                  |   14 +++
 board/davinci/da8xxevm/da850evm.c                |  112 +++++++++++++++++++++-
 drivers/net/davinci_emac.c                       |   41 ++++++++-
 include/configs/da850evm.h                       |    1 +
 6 files changed, 171 insertions(+), 5 deletions(-)
arch/arm/include/asm/arch-davinci/da8xx_common.h +4 -0
index bc3092d..e52f613 100644
@@ -30,4 +30,8 @@ void irq_init(void);
 int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 				    int n_items);
 
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel);
+#endif
+
 #endif /* __COMMON_H */
arch/arm/include/asm/arch-davinci/hardware.h +4 -0
index ef616c1..b95fa97 100644
@@ -152,6 +152,10 @@ typedef volatile unsigned int *	dv_reg_p;
 #define DAVINCI_BOOTCFG_BASE			0x01c14000
 #define JTAG_ID_REG                            (DAVINCI_BOOTCFG_BASE + 0x18)
 
+#define GPIO_BANK2_REG_DIR_ADDR			(DAVINCI_GPIO_BASE + 0x38)
+#define GPIO_BANK2_REG_OPDATA_ADDR		(DAVINCI_GPIO_BASE + 0x3c)
+#define GPIO_BANK2_REG_SET_ADDR			(DAVINCI_GPIO_BASE + 0x40)
+#define GPIO_BANK2_REG_CLR_ADDR			(DAVINCI_GPIO_BASE + 0x44)
 #endif /* CONFIG_SOC_DA8XX */
 
 /* Power and Sleep Controller (PSC) Domains */
board/davinci/da8xxevm/common.c +14 -0
index 36bf693..2d9a64b 100644
@@ -53,3 +53,17 @@ int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
 
 	return 0;
 }
+
+#if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_MACH_DAVINCI_DA850_EVM)
+void da850_emac_mii_mode_sel(int mode_sel)
+{
+	int val;
+
+	val = readl(&davinci_syscfg_regs->cfgchip3);
+	if (mode_sel == 0)
+		val &= ~(1 << 8);
+	else
+		val |= (1 << 8);
+	writel(val, &davinci_syscfg_regs->cfgchip3);
+}
+#endif
board/davinci/da8xxevm/da850evm.c +108 -4

150 lines not on this page · raw message

drivers/net/davinci_emac.c +40 -1

60 lines not on this page · raw message

include/configs/da850evm.h +1 -0
index 8e273b4..b78dea5 100644
@@ -88,6 +88,7 @@
 #define CONFIG_DRIVER_DAVINCI_I2C
 #define CONFIG_SYS_I2C_SPEED		25000
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C_EXPANDER_ADDR   0x20
 
 /*
  * Flash & Environment
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 1/1 da850evm: Add RMII support for EMAC

In reply to Ben Gardiner

Hi Ben,

Quoted 6 lines

From: Sudhakar Rajashekhara <[email protected]>

This patch is a port of the work by Sudhakar Rajeshekhara in commit ab3effbcad8851cc65dc5241a01c064d2030a3b2 of
git://arago-project.org/git/people/sandeep/u-boot-davinci.git.

Quoted 8 lines

The da850 UI board has on it an RMII PHY which can be used if the MDC line to the MII PHY on the baseboard is disabled and the RMII PHY is enabled by configuring the values of some GPIO pins on the IO expander of the UI board. This patch implements disabling that line via GPIO2[6], configuring the UI board's IO expander and setting only the pinmux settings that are needed for RMII operation.

Tested on da850evm by adding a define for CONFIG_DRIVER_TI_EMAC_USE_RMII.

Thanks a lot for going ahead and mainline parts which linger for months in TI only trees.

While talking about those features - is anybody working on enabling the SPI flash in mainline for da850evm?

Thanks
Detlev

Signature · 8 lines
Two  monks went  fishing in an  electron river.  The first monk drew out his
network, and out flopped a hacker.  The second monk cried, "The poor hacker!
How can  it live outside of the  network?"   The first monk said,  "When you
have learned to live outside the network, then you will know."
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#6 lore raw

PATCH 1/1 da850evm: Add RMII support for EMAC

Quoted 5 lines · Mike Frysinger
Quoted 1 line · On Friday, November 05, 2010 17:11:13 Ben Gardiner wrote:
CC Sandeep Paulraj <[email protected]>"

spurious quote in this tag
-mike

Oops. Thanks for catching that, Mike.

Quoted 5 lines · Detlev Zundel

Hi Ben,

[...]
Thanks a lot for going ahead and mainline parts which linger for months in TI only trees.

You're welcome / it is my pleasure.

Quoted 2 lines

While talking about those features - is anybody working on enabling the SPI flash in mainline for da850evm?

I can say that I won't be. We're interested in NAND flash support only -- as you may have already guessed from earlier tested-by's. If TI doesn't step-up to add SD and USB (host) support to mainline I plan to also pick up the slack there.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca