Hello,

For development purposes on QEMU, it could be more efficient to mount
the filesystem over NFS instead of flashing it every time. The NFS
mount can be done if there is an emulated ethernet device in QEMU even
if the actual GTA01 does not have an ethernet NIC.

Attached is a patch which maps the smc91c111 ethernet NIC at address
0x5c000000 and initialises it.
Also attached is the patch for the kernel where the ethernet is
registered as a platform device and the mapping is done accordingly.
I'm not sure if this list is the right place to send the kernel patch
but it helps development on qemu.

Hope these patches help.
Thanks,
Salil
diff --git a/hw/neo1973.c b/hw/neo1973.c
index 067cc8d..d23cdf0 100644
--- a/hw/neo1973.c
+++ b/hw/neo1973.c
@@ -619,6 +619,24 @@ static void neo_gps_setup(struct neo_board_s *s)
     s3c_uart_attach(s->cpu->uart[1], s->gps);
 }
 
+
+static void neo_nic_setup(struct neo_board_s *s)
+{
+	if(nd_table[0].vlan){
+	    if(nd_table[0].model == NULL
+		|| strcmp(nd_table[0].model, "smc91c111") == 0){
+		    smc91c111_init(&nd_table[0], 0x5c000000, s->cpu->irq[S3C_PIC_EINT2]);
+	} else if (strcmp(nd_table[0].model, "?") == 0) {
+            fprintf(stderr, "qemu: Supported NICs: smc91c111\n");
+            exit (1);
+        } else {
+            fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
+            exit (1);
+        }
+
+    }
+}
+
 static void neo_reset(void *opaque)
 {
     struct neo_board_s *s = (struct neo_board_s *) opaque;
@@ -696,6 +714,8 @@ static struct neo_board_s *neo1973_init_common(int ram_size, DisplayState *ds,
 
     s3c_adc_setscale(s->cpu->adc, gta01_ts_scale);
 
+    neo_nic_setup(s);
+
     /* Setup initial (reset) machine state */
     qemu_register_reset(neo_reset, s);
 #if 0
diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
index 19a735a..b8434f0 100644
--- a/arch/arm/mach-s3c2410/mach-gta01.c
+++ b/arch/arm/mach-s3c2410/mach-gta01.c
@@ -638,6 +638,28 @@ static struct s3c2410_hcd_info gta01_usb_info = {
 	},
 };
 
+/* Ethernet */
+static struct resource gta01_eth_resources[] = {
+	[0] = {
+		.start	= S3C2410_PA_ETH,
+		.end	= S3C2410_PA_ETH + S3C2410_SZ_ETH - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_EINT2,
+		.end	= IRQ_EINT2,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device gta01_eth_dev = {
+	.name 		= "smc91x",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(gta01_eth_resources),
+	.resource	= gta01_eth_resources,
+};
+
+
 static void __init gta01_map_io(void)
 {
 	s3c24xx_init_io(gta01_iodesc, ARRAY_SIZE(gta01_iodesc));
@@ -714,6 +736,8 @@ static void __init gta01_machine_init(void)
 	request_irq(GTA01_IRQ_MODEM, gta01_modem_irq,
 		    SA_INTERRUPT, "modem", NULL);
 	enable_irq_wake(GTA01_IRQ_MODEM);
+
+	platform_device_register(&gta01_eth_dev);
 }
 
 MACHINE_START(NEO1973_GTA01, "GTA01")
diff --git a/include/asm-arm/arch-s3c2410/gta01.h b/include/asm-arm/arch-s3c2410/gta01.h
index 1cc2099..d944592 100644
--- a/include/asm-arm/arch-s3c2410/gta01.h
+++ b/include/asm-arm/arch-s3c2410/gta01.h
@@ -37,6 +37,8 @@ struct gta01bl_machinfo {
 #define GTA01_IRQ_AUX_KEY	IRQ_EINT6
 #define GTA01_IRQ_PCF50606      IRQ_EINT16
 
+#define GTA01_IRQ_ETH		IRQ_EINT2
+
 /* GTA01v3 */
 #define GTA01v3_GPIO_nGSM_EN	S3C2410_GPG9
 
diff --git a/include/asm-arm/arch-s3c2410/map.h b/include/asm-arm/arch-s3c2410/map.h
index 4505aef..c425d4c 100644
--- a/include/asm-arm/arch-s3c2410/map.h
+++ b/include/asm-arm/arch-s3c2410/map.h
@@ -153,6 +153,11 @@
 #define S3C2440_PA_AC97	   (0x5B000000)
 #define S3C2440_SZ_AC97	   SZ_1M
 
+/* Ethernet */
+
+#define S3C2410_PA_ETH	(0x5C000000)
+#define S3C2410_SZ_ETH	SZ_1M
+
 /* ISA style IO, for each machine to sort out mappings for, if it
  * implements it. We reserve two 16M regions for ISA.
  */

Reply via email to