Skip to contentSkip to conversation

ARM: S5PV310: Add support ethernet for SMDKV310 and SMDKC210

PATCH New Sangbeom Kim 4 participants 6 messages Oct 13, 2010 – Oct 22, 2010

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

cover ARM: S5PV310: Add support ethernet for SMDKV310 and SMDKC210

This patch adds support ethernet for SMDKV310 and SMDKC210 boards.

NOTE: Depends on EINT and GPIOlib.

[PATCH 1/2] ARM: S5PV310: Add support SROMC
[PATCH 2/2] ARM: S5PV310: Support ethernet for SMDKV310 and SMDKC210

#1 lore raw

PATCH 1/2 ARM: S5PV310: Add support SROMC

From: Daein Moon <[email protected]>

This patch adds support SROMC for S5PV310 and S5PC210.

---
 arch/arm/mach-s5pv310/cpu.c                    |    5 ++
 arch/arm/mach-s5pv310/include/mach/map.h       |    4 ++
 arch/arm/mach-s5pv310/include/mach/regs-srom.h |   50 ++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-srom.h
arch/arm/mach-s5pv310/cpu.c +5 -0
index ffed262..873783a 100644
@@ -81,6 +81,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
 		.pfn		= __phys_to_pfn(S3C_PA_UART),
 		.length		= SZ_512K,
 		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_SROMC,
+		.pfn		= __phys_to_pfn(S5PV310_PA_SROMC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
 	},
 };
 
arch/arm/mach-s5pv310/include/mach/map.h +4 -0
index 1429510..37294f1 100644
@@ -25,6 +25,8 @@
 
 #define S5PV310_PA_SYSRAM		(0x02025000)
 
+#define S5PV310_PA_SROM_BANK(x)		(0x04000000 + ((x) * 0x01000000))
+
 #define S5PC210_PA_ONENAND		(0x0C000000)
 #define S5P_PA_ONENAND			S5PC210_PA_ONENAND
 
@@ -58,6 +60,8 @@
 
 #define S5PV310_PA_HSMMC(x)		(0x12510000 + ((x) * 0x10000))
 
+#define S5PV310_PA_SROMC		(0x12570000)
+
 #define S5PV310_PA_UART			(0x13800000)
 
 #define S5P_PA_UART(x)			(S5PV310_PA_UART + ((x) * S3C_UART_OFFSET))
arch/arm/mach-s5pv310/include/mach/regs-srom.h new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 1/2 ARM: S5PV310: Add support SROMC

Hello,

Quoted 18 lines · Sangbeom Kim

From: Daein Moon <[email protected]>

This patch adds support SROMC for S5PV310 and S5PC210.

---
 arch/arm/mach-s5pv310/cpu.c                    |    5 ++
 arch/arm/mach-s5pv310/include/mach/map.h       |    4 ++
 arch/arm/mach-s5pv310/include/mach/regs-srom.h |   50 ++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-srom.h
arch/arm/mach-s5pv310/cpu.c +0 -0
index ffed262..873783a 100644

arch/arm/mach-s5pv310/cpu.c static struct map_desc s5pv310_iodesc[] __initdata = { · line 90

Quoted 10 lines
arch/arm/mach-s5pv310/cpu.c +5 -0
@@ -81,6 +81,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
 		.pfn		= __phys_to_pfn(S3C_PA_UART),
 		.length		= SZ_512K,
 		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_SROMC,
+		.pfn		= __phys_to_pfn(S5PV310_PA_SROMC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
 	},
 };

Do You really need to make a permanent mapping for the SROMC area? Cannot the setup code in the mach-smdk*.c call ioremap(S5PV310_PA_SROMC) and put the address it got to the ethernet device? This area will be probably useless for boards other than SMDK.

<snip>

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

#3 lore raw

PATCH 1/2 ARM: S5PV310: Add support SROMC

Quoted 25 lines · Marek Szyprowski

Hello,

Quoted 10 lines · Sangbeom Kim

From: Daein Moon <[email protected]>

This patch adds support SROMC for S5PV310 and S5PC210.

---
 arch/arm/mach-s5pv310/cpu.c                    |    5 ++
 arch/arm/mach-s5pv310/include/mach/map.h       |    4 ++
 arch/arm/mach-s5pv310/include/mach/regs-srom.h |   50

++++++++++++++++++++++++

arch/arm/mach-s5pv310/cpu.c static struct map_desc s5pv310_iodesc[] __initdata =

Quoted 8 lines
 3 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-srom.h
arch/arm/mach-s5pv310/cpu.c +0 -0
index ffed262..873783a 100644
@@ -81,6 +81,11 @@ static struct map_desc s5pv310_iodesc[] __initdata =

{

Quoted 12 lines

arch/arm/mach-s5pv310/cpu.c static struct map_desc s5pv310_iodesc[] __initdata = { · line 90

Quoted 10 lines
arch/arm/mach-s5pv310/cpu.c +5 -0
 		.pfn		= __phys_to_pfn(S3C_PA_UART),
 		.length		= SZ_512K,
 		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_SROMC,
+		.pfn		= __phys_to_pfn(S5PV310_PA_SROMC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
 	},
 };

Do You really need to make a permanent mapping for the SROMC area? Cannot

the

Quoted 1 line

setup code in the mach-smdk*.c call ioremap(S5PV310_PA_SROMC) and put the

address it

Quoted 1 line

got to the ethernet device? This area will be probably useless for boards

other than

Quoted 2 lines

SMDK.

Hi,

It seems to be useless because only ethernet device uses the SROM interface. Will this mapping be ready for devices that will use the SROM interface in boards
other than SMDK?

Best regards,
Daein Moon

Quoted 13 lines

<snip>

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

PATCH 1/2 ARM: S5PV310: Add support SROMC

In reply to Marek Szyprowski
Quoted 16 lines · Marek Szyprowski

Hello,

Quoted 10 lines · Sangbeom Kim

From: Daein Moon <[email protected]>

This patch adds support SROMC for S5PV310 and S5PC210.

---
 arch/arm/mach-s5pv310/cpu.c                    |    5 ++
 arch/arm/mach-s5pv310/include/mach/map.h       |    4 ++
 arch/arm/mach-s5pv310/include/mach/regs-srom.h |   50

++++++++++++++++++++++++

Quoted 8 lines

arch/arm/mach-s5pv310/cpu.c static struct map_desc s5pv310_iodesc[] __initdata =

Quoted 8 lines
 3 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-srom.h
arch/arm/mach-s5pv310/cpu.c +0 -0
index ffed262..873783a 100644
@@ -81,6 +81,11 @@ static struct map_desc s5pv310_iodesc[] __initdata =

{

Quoted 4 lines
Quoted 4 lines
arch/arm/mach-s5pv310/cpu.c +1 -0
 		.pfn		= __phys_to_pfn(S3C_PA_UART),
 		.length		= SZ_512K,
 		.type		= MT_DEVICE,
+	}, {
Quoted 8 lines

arch/arm/mach-s5pv310/cpu.c static struct map_desc s5pv310_iodesc[] __initdata = { · line 90

Quoted 6 lines
arch/arm/mach-s5pv310/cpu.c +4 -0
+		.virtual	= (unsigned long)S5P_VA_SROMC,
+		.pfn		= __phys_to_pfn(S5PV310_PA_SROMC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
 	},
 };

Do You really need to make a permanent mapping for the SROMC area? Cannot

the

Quoted 5 lines

setup code in the mach-smdk*.c call ioremap(S5PV310_PA_SROMC) and put the address it
got to the ethernet device? This area will be probably useless for boards other than
SMDK.

Hi Marek,

I think, this mapping is no problem to me even though only SMDK needs it now.
Actually, SROM bank can be used to connect other outside chips...we don't know that now.
Also S3C64XX also mapped SROM bank with same method...

But seems need to update it for common usage when we implement SROMC for other SoCs later.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#5 lore raw

PATCH 2/2 ARM: S5PV310: Support ethernet for SMDKV310 and SMDKC210

In reply to Sangbeom Kim

From: Daein Moon <[email protected]>

This patch adds to support ethernet for SMDKV310 and SMDKC210 board.
- define smc911x resources
- define configurations of smc911x platform data
- define platform device "smsc911x"
- initialize srom controller for lan9215 chip

---
 arch/arm/mach-s5pv310/mach-smdkc210.c |   61 +++++++++++++++++++++++++++++++++
 arch/arm/mach-s5pv310/mach-smdkv310.c |   61 +++++++++++++++++++++++++++++++++
 2 files changed, 122 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv310/mach-smdkc210.c +61 -0
index d2cf694..14aca19 100644
@@ -12,6 +12,8 @@
 #include <linux/gpio.h>
 #include <linux/mmc/host.h>
 #include <linux/platform_device.h>
+#include <linux/smsc911x.h>
+#include <linux/io.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
@@ -24,6 +26,7 @@
 #include <plat/sdhci.h>
 
 #include <mach/map.h>
+#include <mach/regs-srom.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
 #define SMDKC210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
@@ -106,6 +109,37 @@ static struct s3c_sdhci_platdata smdkc210_hsmmc3_pdata __initdata = {
 	.clk_type		= S3C_SDHCI_CLK_DIV_EXTERNAL,
 };
 
+static struct resource smdkc210_smsc911x_resources[] = {
+	[0] = {
+		.start	= S5PV310_PA_SROM_BANK(1),
+		.end	= S5PV310_PA_SROM_BANK(1) + SZ_64K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_EINT(5),
+		.end	= IRQ_EINT(5),
+		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
+	},
+};
+
+static struct smsc911x_platform_config smsc9215_config = {
+	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
+	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
+	.flags		= SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
+	.phy_interface	= PHY_INTERFACE_MODE_MII,
+	.mac		= {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
+};
+
+static struct platform_device smdkc210_smsc911x = {
+	.name		= "smsc911x",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(smdkc210_smsc911x_resources),
+	.resource	= smdkc210_smsc911x_resources,
+	.dev		= {
+		.platform_data  = &smsc9215_config,
+	},
+};
+
 static struct platform_device *smdkc210_devices[] __initdata = {
 	&s3c_device_hsmmc0,
 	&s3c_device_hsmmc1,
@@ -113,8 +147,33 @@ static struct platform_device *smdkc210_devices[] __initdata = {
 	&s3c_device_hsmmc3,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&smdkc210_smsc911x,
 };
 
+static void __init smdkc210_smsc911x_init(void)
+{
+	u32 cs1;
+
+	/* configure nCS1 width to 16 bits */
+	cs1 = __raw_readl(S5PV310_SROM_BW) &
+		    ~(S5PV310_SROM_BW__CS_MASK <<
+				    S5PV310_SROM_BW__NCS1__SHIFT);
+	cs1 |= ((1 << S5PV310_SROM_BW__DATAWIDTH__SHIFT) |
+		(1 << S5PV310_SROM_BW__WAITENABLE__SHIFT) |
+		(1 << S5PV310_SROM_BW__BYTEENABLE__SHIFT)) <<
+		S5PV310_SROM_BW__NCS1__SHIFT;
+	__raw_writel(cs1, S5PV310_SROM_BW);
+
+	/* set timing for nCS1 suitable for ethernet chip */
+	__raw_writel((0x1 << S5PV310_SROM_BCX__PMC__SHIFT) |
+		     (0x9 << S5PV310_SROM_BCX__TACP__SHIFT) |
+		     (0xc << S5PV310_SROM_BCX__TCAH__SHIFT) |
+		     (0x1 << S5PV310_SROM_BCX__TCOH__SHIFT) |
+		     (0x6 << S5PV310_SROM_BCX__TACC__SHIFT) |
+		     (0x1 << S5PV310_SROM_BCX__TCOS__SHIFT) |
+		     (0x1 << S5PV310_SROM_BCX__TACS__SHIFT), S5PV310_SROM_BC1);
+}
+
 static void __init smdkc210_map_io(void)
 {
 	s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -124,6 +183,8 @@ static void __init smdkc210_map_io(void)
 
 static void __init smdkc210_machine_init(void)
 {
+	smdkc210_smsc911x_init();
+
 	s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata);
 	s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata);
arch/arm/mach-s5pv310/mach-smdkv310.c +61 -0

93 lines not on this page · raw message

Signature · 1 line
1.6.2.5