Skip to contentSkip to conversation

ARM: OMAP2420: Fix ethernet support

PATCH New Jon Hunter 2 participants 4 messages Nov 13, 2012 – Dec 14, 2012

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author
#0 lore raw

cover ARM: OMAP2420: Fix ethernet support

Fix ethernet support for OMAP2420 and remove legacy code for ethernet configuration.

Jon Hunter (2):
ARM: OMAP2420: Fix ethernet support for OMAP2420 H4
ARM: OMAP: Remove debug-devices.c

 arch/arm/mach-omap2/board-h4.c      |   80 +++++++-----------------------
 arch/arm/mach-omap2/debug-devices.h |    9 ----
 arch/arm/plat-omap/Makefile         |    1 -
 arch/arm/plat-omap/debug-devices.c  |   93 -----------------------------------
 4 files changed, 19 insertions(+), 164 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/debug-devices.h
 delete mode 100644 arch/arm/plat-omap/debug-devices.c
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/2 ARM: OMAP2420: Fix ethernet support for OMAP2420 H4

Ethernet is not currently working on the OMAP2420 H4 board. In commit f604931 (ARM: OMAP: abstract debug card setup (smc, leds)) the function h4_init_smc91x() that initialised the ethernet controller was renamed to h4_init_debug() but was never called when initialising the board.

Adding a call to h4_init_debug() fixes ethernet support, however, instead of using the legacy H4 code migrate the H4 to use the gpmc_smc91x_init() function instead and remove the legacy H4 code.

---
 arch/arm/mach-omap2/board-h4.c |   80 ++++++++++------------------------------
 1 file changed, 19 insertions(+), 61 deletions(-)
arch/arm/mach-omap2/board-h4.c +19 -61
index 8d04bf8..2adba9d 100644
@@ -34,19 +34,16 @@
 #include <plat/menelaus.h>
 #include <plat/dma.h>
 #include <plat/gpmc.h>
-#include "debug-devices.h"
 
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
 
 #include "common.h"
+#include "gpmc-smc91x.h"
 #include "mux.h"
 #include "control.h"
 
 #define H4_FLASH_CS	0
-#define H4_SMC91X_CS	1
-
-#define H4_ETHR_GPIO_IRQ		92
 
 #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
 static const uint32_t board_matrix_keys[] = {
@@ -250,71 +247,31 @@ static u32 is_gpmc_muxed(void)
 		return 0;
 }
 
-static inline void __init h4_init_debug(void)
-{
-	int eth_cs;
-	unsigned long cs_mem_base;
-	unsigned int muxed, rate;
-	struct clk *gpmc_fck;
-
-	eth_cs	= H4_SMC91X_CS;
+#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE)
 
-	gpmc_fck = clk_get(NULL, "gpmc_fck");	/* Always on ENABLE_ON_INIT */
-	if (IS_ERR(gpmc_fck)) {
-		WARN_ON(1);
-		return;
-	}
-
-	clk_prepare_enable(gpmc_fck);
-	rate = clk_get_rate(gpmc_fck);
-	clk_disable_unprepare(gpmc_fck);
-	clk_put(gpmc_fck);
+static struct omap_smc91x_platform_data board_smc91x_data = {
+	.cs		= 1,
+	.gpio_irq	= 92,
+	.flags		= GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_LOWLEVEL,
+};
 
+static void __init board_smc91x_init(void)
+{
 	if (is_gpmc_muxed())
-		muxed = 0x200;
-	else
-		muxed = 0;
-
-	/* Make sure CS1 timings are correct */
-	gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1,
-			  0x00011000 | muxed);
-
-	if (rate >= 160000000) {
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
-	} else if (rate >= 130000000) {
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
-	} else {/* rate = 100000000 */
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F);
-		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2);
-	}
-
-	if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
-		printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
-		goto out;
-	}
+		board_smc91x_data.flags |= GPMC_MUX_ADD_DATA;
 
-	udelay(100);
+	omap_mux_init_gpio(board_smc91x_data.gpio_irq, OMAP_PIN_INPUT);
+	gpmc_smc91x_init(&board_smc91x_data);
+}
 
-	omap_mux_init_gpio(92, 0);
-	if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ) < 0)
-		gpmc_cs_free(eth_cs);
+#else
 
-out:
-	clk_disable_unprepare(gpmc_fck);
-	clk_put(gpmc_fck);
+static inline void board_smc91x_init(void)
+{
 }
 
+#endif
+
 static void __init h4_init_flash(void)
 {
 	unsigned long base;
@@ -371,6 +328,7 @@ static void __init omap_h4_init(void)
 	omap_serial_init();
 	omap_sdrc_init(NULL, NULL);
 	h4_init_flash();
+	board_smc91x_init();
 
 	omap_display_init(&h4_dss_data);
 }
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/2 ARM: OMAP: Remove debug-devices.c

In reply to Jon Hunter

The OMAP2420 H4 board was the only board using the plat-omap/debug-devices.c code for configuring ethernet support. Now that OMAP2420 H4 has been migrated to use the generic gpmc code for configuring ethernet support, the debug-devices.c file is no longer used and so remove it and its header file.

---
 arch/arm/mach-omap2/debug-devices.h |    9 ----
 arch/arm/plat-omap/Makefile         |    1 -
 arch/arm/plat-omap/debug-devices.c  |   93 -----------------------------------
 3 files changed, 103 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/debug-devices.h
 delete mode 100644 arch/arm/plat-omap/debug-devices.c
arch/arm/mach-omap2/debug-devices.h deleted +0 -9
deleted file mode 100644
index a4edbd2..0000000
@@ -1,9 +0,0 @@
-#ifndef _OMAP_DEBUG_DEVICES_H
-#define _OMAP_DEBUG_DEVICES_H
-
-#include <linux/types.h>
-
-/* for TI reference platforms sharing the same debug card */
-extern int debug_card_init(u32 addr, unsigned gpio);
-
-#endif
arch/arm/plat-omap/Makefile +0 -1
index dacaee0..1eca088 100644
@@ -12,7 +12,6 @@ obj-  :=
 obj-$(CONFIG_ARCH_OMAP2PLUS) += omap_device.o
 
 obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
-obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
 obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
 i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
 obj-y += $(i2c-omap-m) $(i2c-omap-y)
arch/arm/plat-omap/debug-devices.c deleted +0 -93

93 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#3 lore raw

cover ARM: OMAP2420: Fix ethernet support

In reply to Jon Hunter
Quoted 2 lines · Jon Hunter

Fix ethernet support for OMAP2420 and remove legacy code for ethernet configuration.

Thanks applying both into omap-for-v3.8/fixes-for-merge-window.

Regards,

Tony

Quoted 15 lines

Jon Hunter (2):
ARM: OMAP2420: Fix ethernet support for OMAP2420 H4
ARM: OMAP: Remove debug-devices.c

 arch/arm/mach-omap2/board-h4.c      |   80 +++++++-----------------------
 arch/arm/mach-omap2/debug-devices.h |    9 ----
 arch/arm/plat-omap/Makefile         |    1 -
 arch/arm/plat-omap/debug-devices.c  |   93 -----------------------------------
 4 files changed, 19 insertions(+), 164 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/debug-devices.h
 delete mode 100644 arch/arm/plat-omap/debug-devices.c
Signature · 1 line
1.7.9.5