LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* SPI support for MPC85xx.
From: jbi130 @ 2005-08-24 22:37 UTC (permalink / raw)
  To: linuxppc-embedded

Is there existing SPI support for MPC85xx based boards (8555E in my
case).  I've checked the archives and there appear to be a few
implementations, but none of them for the 85xx.

Any pointers appreciated.

Thanks.

^ permalink raw reply

* [PATCH]: Gianfar PHY Platform update
From: Andy Fleming @ 2005-08-24 23:48 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: Kumar K. Gala

This patch provides the infrastructure needed by the gianfar driver to 
create an MDIO bus, and connect to it.

Signed-off-by: Andy Fleming <afleming@freescale.com>


diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -53,6 +53,10 @@
 
 #include <syslib/ppc85xx_setup.h>
 
+static const char *GFAR_PHY_0 = "phy0:0";
+static const char *GFAR_PHY_1 = "phy0:1";
+static const char *GFAR_PHY_3 = "phy0:3";
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -64,6 +68,7 @@ mpc8540ads_setup_arch(void)
 	bd_t *binfo = (bd_t *) __res;
 	unsigned int freq;
 	struct gianfar_platform_data *pdata;
+	struct gianfar_mdio_data *mdata;
 
 	/* get the core frequency */
 	freq = binfo->bi_intfreq;
@@ -90,34 +95,35 @@ mpc8540ads_setup_arch(void)
 	invalidate_tlbcam_entry(num_tlbcam_entries - 1);
 #endif
 
+	/* setup the board related info for the MDIO bus */
+	mdata = (struct gianfar_mdio_data *) ppc_sys_get_pdata(MPC85xx_MDIO);
+
+	mdata->irq[0] = MPC85xx_IRQ_EXT5;
+	mdata->irq[1] = MPC85xx_IRQ_EXT5;
+	mdata->irq[2] = -1;
+	mdata->irq[3] = MPC85xx_IRQ_EXT5;
+	mdata->irq[31] = -1;
+	mdata->paddr += binfo->bi_immr_base;
+
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 0;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 1;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
 	if (pdata) {
 		pdata->board_flags = 0;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 3;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_3;
 		memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -57,6 +57,10 @@
 #include <syslib/ppc85xx_setup.h>
 
 
+static const char *GFAR_PHY_0 = "phy0:0";
+static const char *GFAR_PHY_1 = "phy0:1";
+static const char *GFAR_PHY_3 = "phy0:3";
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -69,6 +73,7 @@ mpc8560ads_setup_arch(void)
 	bd_t *binfo = (bd_t *) __res;
 	unsigned int freq;
 	struct gianfar_platform_data *pdata;
+	struct gianfar_mdio_data *mdata;
 
 	cpm2_reset();
 
@@ -87,24 +92,28 @@ mpc8560ads_setup_arch(void)
 	mpc85xx_setup_hose();
 #endif
 
+	/* setup the board related info for the MDIO bus */
+	mdata = (struct gianfar_mdio_data *) ppc_sys_get_pdata(MPC85xx_MDIO);
+
+	mdata->irq[0] = MPC85xx_IRQ_EXT5;
+	mdata->irq[1] = MPC85xx_IRQ_EXT5;
+	mdata->irq[2] = -1;
+	mdata->irq[3] = MPC85xx_IRQ_EXT5;
+	mdata->irq[31] = -1;
+	mdata->paddr += binfo->bi_immr_base;
+
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 0;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 1;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -395,6 +395,9 @@ mpc85xx_cds_pcibios_fixup(void)
 
 TODC_ALLOC();
 
+static const char *GFAR_PHY_0 = "phy0:0";
+static const char *GFAR_PHY_1 = "phy0:1";
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -406,6 +409,7 @@ mpc85xx_cds_setup_arch(void)
 	bd_t *binfo = (bd_t *) __res;
 	unsigned int freq;
 	struct gianfar_platform_data *pdata;
+	struct gianfar_mdio_data *mdata;
 
 	/* get the core frequency */
 	freq = binfo->bi_intfreq;
@@ -449,44 +453,42 @@ mpc85xx_cds_setup_arch(void)
 	invalidate_tlbcam_entry(num_tlbcam_entries - 1);
 #endif
 
+	/* setup the board related info for the MDIO bus */
+	mdata = (struct gianfar_mdio_data *) ppc_sys_get_pdata(MPC85xx_MDIO);
+
+	mdata->irq[0] = MPC85xx_IRQ_EXT5;
+	mdata->irq[1] = MPC85xx_IRQ_EXT5;
+	mdata->irq[2] = -1;
+	mdata->irq[3] = -1;
+	mdata->irq[31] = -1;
+	mdata->paddr += binfo->bi_immr_base;
+
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 0;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 1;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 0;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 1;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -92,6 +92,9 @@ sbc8560_early_serial_map(void)
 }
 #endif
 
+static const char *GFAR_PHY_25 = "phy0:25";
+static const char *GFAR_PHY_26 = "phy0:26";
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -103,6 +106,7 @@ sbc8560_setup_arch(void)
 	bd_t *binfo = (bd_t *) __res;
 	unsigned int freq;
 	struct gianfar_platform_data *pdata;
+	struct gianfar_mdio_data *mdata;
 
 	/* get the core frequency */
 	freq = binfo->bi_intfreq;
@@ -127,24 +131,26 @@ sbc8560_setup_arch(void)
 	invalidate_tlbcam_entry(num_tlbcam_entries - 1);
 #endif
 
+	/* setup the board related info for the MDIO bus */
+	mdata = (struct gianfar_mdio_data *) ppc_sys_get_pdata(MPC85xx_MDIO);
+
+	mdata->irq[25] = MPC85xx_IRQ_EXT6;
+	mdata->irq[26] = MPC85xx_IRQ_EXT7;
+	mdata->irq[31] = -1;
+	mdata->paddr += binfo->bi_immr_base;
+
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT6;
-		pdata->phyid = 25;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_25;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->interruptPHY = MPC85xx_IRQ_EXT7;
-		pdata->phyid = 26;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_26;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -92,6 +92,9 @@ static u8 gp3_openpic_initsenses[] __ini
 	0x0,				/* External 11: */
 };
 
+static const char *GFAR_PHY_2 = "phy0:2";
+static const char *GFAR_PHY_4 = "phy0:4";
+
 /*
  * Setup the architecture
  */
@@ -101,6 +104,7 @@ gp3_setup_arch(void)
 	bd_t *binfo = (bd_t *) __res;
 	unsigned int freq;
 	struct gianfar_platform_data *pdata;
+	struct gianfar_mdio_data *mdata;
 
 	cpm2_reset();
 
@@ -119,23 +123,26 @@ gp3_setup_arch(void)
 	mpc85xx_setup_hose();
 #endif
 
+	/* setup the board related info for the MDIO bus */
+	mdata = (struct gianfar_mdio_data *) ppc_sys_get_pdata(MPC85xx_MDIO);
+
+	mdata->irq[2] = MPC85xx_IRQ_EXT5;
+	mdata->irq[4] = MPC85xx_IRQ_EXT5;
+	mdata->irq[31] = -1;
+	mdata->paddr += binfo->bi_immr_base;
+
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 	/*	pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 2;
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_2;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 	/*	pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
-		pdata->interruptPHY = MPC85xx_IRQ_EXT5;
-		pdata->phyid = 4;
-		/* fixup phy address */
-		pdata->phy_reg_addr += binfo->bi_immr_base;
+		pdata->bus_id = GFAR_PHY_4;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
--- a/arch/ppc/syslib/mpc85xx_devices.c
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -25,19 +25,20 @@
 /* We use offsets for IORESOURCE_MEM since we do not know at compile time
  * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup
  */
+struct gianfar_mdio_data mpc85xx_mdio_pdata = {
+	.paddr = MPC85xx_MIIM_OFFSET,
+};
 
 static struct gianfar_platform_data mpc85xx_tsec1_pdata = {
 	.device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
 	    FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
 	    FSL_GIANFAR_DEV_HAS_MULTI_INTR,
-	.phy_reg_addr = MPC85xx_ENET1_OFFSET,
 };
 
 static struct gianfar_platform_data mpc85xx_tsec2_pdata = {
 	.device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
 	    FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
 	    FSL_GIANFAR_DEV_HAS_MULTI_INTR,
-	.phy_reg_addr = MPC85xx_ENET1_OFFSET,
 };
 
 static struct gianfar_platform_data mpc85xx_etsec1_pdata = {
@@ -46,7 +47,6 @@ static struct gianfar_platform_data mpc8
 	    FSL_GIANFAR_DEV_HAS_MULTI_INTR |
 	    FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
 	    FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
-	.phy_reg_addr = MPC85xx_ENET1_OFFSET,
 };
 
 static struct gianfar_platform_data mpc85xx_etsec2_pdata = {
@@ -55,7 +55,6 @@ static struct gianfar_platform_data mpc8
 	    FSL_GIANFAR_DEV_HAS_MULTI_INTR |
 	    FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
 	    FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
-	.phy_reg_addr = MPC85xx_ENET1_OFFSET,
 };
 
 static struct gianfar_platform_data mpc85xx_etsec3_pdata = {
@@ -64,7 +63,6 @@ static struct gianfar_platform_data mpc8
 	    FSL_GIANFAR_DEV_HAS_MULTI_INTR |
 	    FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
 	    FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
-	.phy_reg_addr = MPC85xx_ENET1_OFFSET,
 };
 
 static struct gianfar_platform_data mpc85xx_etsec4_pdata = {
@@ -73,11 +71,10 @@ static struct gianfar_platform_data mpc8
 	    FSL_GIANFAR_DEV_HAS_MULTI_INTR |
 	    FSL_GIANFAR_DEV_HAS_CSUM | FSL_GIANFAR_DEV_HAS_VLAN |
 	    FSL_GIANFAR_DEV_HAS_EXTENDED_HASH,
-	.phy_reg_addr = MPC85xx_ENET1_OFFSET,
 };
 
 static struct gianfar_platform_data mpc85xx_fec_pdata = {
-	.phy_reg_addr = MPC85xx_ENET1_OFFSET,
+	.device_flags = 0,
 };
 
 static struct fsl_i2c_platform_data mpc85xx_fsl_i2c_pdata = {
@@ -718,6 +715,12 @@ struct platform_device ppc_sys_platform_
 				.flags	= IORESOURCE_IRQ,
 			},
 		},
+	},
+	[MPC85xx_MDIO] = {
+		.name = "fsl-gianfar_mdio",
+		.id = 0,
+		.dev.platform_data = &mpc85xx_mdio_pdata,
+		.num_resources = 0,
 	},
 };
 
diff --git a/arch/ppc/syslib/mpc85xx_sys.c b/arch/ppc/syslib/mpc85xx_sys.c
--- a/arch/ppc/syslib/mpc85xx_sys.c
+++ b/arch/ppc/syslib/mpc85xx_sys.c
@@ -24,19 +24,19 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 		.ppc_sys_name	= "8540",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80300000,
-		.num_devices	= 10,
+		.num_devices	= 11,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_FEC, MPC85xx_IIC1,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
-			MPC85xx_PERFMON, MPC85xx_DUART,
+			MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8560",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80700000,
-		.num_devices	= 19,
+		.num_devices	= 20,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -45,14 +45,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 			MPC85xx_CPM_SPI, MPC85xx_CPM_I2C, MPC85xx_CPM_SCC1,
 			MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3, MPC85xx_CPM_SCC4,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2, MPC85xx_CPM_FCC3,
-			MPC85xx_CPM_MCC1, MPC85xx_CPM_MCC2,
+			MPC85xx_CPM_MCC1, MPC85xx_CPM_MCC2, MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8541",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80720000,
-		.num_devices	= 13,
+		.num_devices	= 14,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -60,13 +60,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 			MPC85xx_PERFMON, MPC85xx_DUART,
 			MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8541E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x807A0000,
-		.num_devices	= 14,
+		.num_devices	= 15,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -74,13 +75,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 			MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
 			MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8555",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80710000,
-		.num_devices	= 19,
+		.num_devices	= 20,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -91,13 +93,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
 			MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
 			MPC85xx_CPM_USB,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8555E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80790000,
-		.num_devices	= 20,
+		.num_devices	= 21,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -108,6 +111,7 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
 			MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
 			MPC85xx_CPM_USB,
+			MPC85xx_MDIO,
 		},
 	},
 	/* SVRs on 8548 rev1.0 matches for 8548/8547/8545 */
@@ -115,104 +119,112 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 		.ppc_sys_name	= "8548E",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x80390010,
-		.num_devices	= 13,
+		.num_devices	= 14,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
 			MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8548",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x80310010,
-		.num_devices	= 12,
+		.num_devices	= 13,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
 			MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8547E",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x80390010,
-		.num_devices	= 13,
+		.num_devices	= 14,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
 			MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8547",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x80310010,
-		.num_devices	= 12,
+		.num_devices	= 13,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
 			MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8545E",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x80390010,
-		.num_devices	= 11,
+		.num_devices	= 12,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2,
 			MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8545",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x80310010,
-		.num_devices	= 10,
+		.num_devices	= 11,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2,
 			MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8543E",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x803A0010,
-		.num_devices	= 11,
+		.num_devices	= 12,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2,
 			MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+			MPC85xx_MDIO,
 		},
 	},
 	{
 		.ppc_sys_name	= "8543",
 		.mask 		= 0xFFFF00F0,
 		.value 		= 0x80320010,
-		.num_devices	= 10,
+		.num_devices	= 11,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_eTSEC1, MPC85xx_eTSEC2,
 			MPC85xx_IIC1, MPC85xx_IIC2,
 			MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
 			MPC85xx_PERFMON, MPC85xx_DUART,
+			MPC85xx_MDIO,
 		},
 	},
 	{	/* default match */
diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h
--- a/include/asm-ppc/mpc85xx.h
+++ b/include/asm-ppc/mpc85xx.h
@@ -67,6 +67,8 @@ extern unsigned char __res[];
 #define MPC85xx_DMA3_SIZE	(0x00080)
 #define MPC85xx_ENET1_OFFSET	(0x24000)
 #define MPC85xx_ENET1_SIZE	(0x01000)
+#define MPC85xx_MIIM_OFFSET	(0x24520)
+#define MPC85xx_MIIM_SIZE	(0x00018)
 #define MPC85xx_ENET2_OFFSET	(0x25000)
 #define MPC85xx_ENET2_SIZE	(0x01000)
 #define MPC85xx_ENET3_OFFSET	(0x26000)
@@ -132,6 +134,7 @@ enum ppc_sys_devices {
 	MPC85xx_eTSEC3,
 	MPC85xx_eTSEC4,
 	MPC85xx_IIC2,
+	MPC85xx_MDIO,
 };
 
 /* Internal interrupts are all Level Sensitive, and Positive Polarity */
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -47,14 +47,19 @@
 struct gianfar_platform_data {
 	/* device specific information */
 	u32 device_flags;
-	u32 phy_reg_addr;
 
 	/* board specific information */
 	u32 board_flags;
-	u32 phy_flags;
-	u32 phyid;
-	u32 interruptPHY;
+	const char *bus_id;
 	u8 mac_addr[6];
+};
+
+struct gianfar_mdio_data {
+	/* device specific information */
+	u32 paddr;
+
+	/* board specific information */
+	int irq[32];
 };
 
 /* Flags related to gianfar device features */

^ permalink raw reply

* Re: Source of xparameter_ml300.h
From: T Ziomek @ 2005-08-25  1:20 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: tomz
In-Reply-To: <20050824134404.B1DF668108@ozlabs.org>

On Wed, 24 Aug 2005 akonovalov@ru.mvista.com wrote:
> 
> Grant Likely wrote:
> > Does anyone know the origin of xparameter_ml300.h?  The
> > Xilinx EDK generates an xparameters.h file for each design, but the
> > structure of the file changes between releases.
> >
> > I want to know if xparameters_ml300.h is the exact output produced by
> > EDK or if stuff was changed before it was submitted to the mainline
> > tree.  (ie. all the stuff under the "linux redefines" comment block)
> 
> EDK can also generate the "Linux BSP".
> In this case EDK uses the scripts from (depending on your setup)
> /opt/xilinx/edk/7.1/sw/ThirdParty/bsp/linux_v2_00_b/data/
> In particular, linux_v2_1_0.tcl adds those "linux redefines"
> and renames xparameters.h to xparameters_ml300.h.
> 
> > Also, where can I get the bitstream/systemace file that matches
> > xparameters_ml300.h?
> 
> The most reliable way is to generate both (bitstream and
> xparameters_ml300.h) by yourself. :)
> 
> But if you are speaking about the xparameters_ml300.h in the community
> trees (linuxppc-2.4 and the 2.6 one from kernel.org), this file
> is for the reference design by Xilinx:
> 
> http://www.xilinx.com/ise/embedded/edk6_2docs/ml300_edk3.zip

Also, be aware that the differences between 'xparameters.h' and
'xparameters_ml300.h' are not all you need to worry about.


MontaVista's port to the ML300 also modified various Xilinx driver source
files (the code that appears under .../ppc405_0/include and
.../ppc405_0/libsrc, at least for me).
    Starting with MV's port to the ML300, you need to figure out which IP
versions it was created for (for example, "emac_v1_00_b").  Then you need
to compare that with the IP version used in your system [NOTE 1].  They'll
probably be different, so then you need to either merge MV's changes into
the newer Xilinx code or Xilinx's changes into the MV-modified drivers.
This leaves you with software drivers that match the IP and have the chang-
es needed to work in Linux.

You'll then have to keep an eye on IP versions as your hardware engineers
release new FPGA designs, and periodically repeat the above.  [NOTE 1]
The Tcl script mentioned above may take care of the 'xparameters.h' chang-
es but that's it -- when you're faced with changed Xilinx software you
have to re-port any changed drivers every time.


In addition, MV's porting is not always complete.  For example, their port-
ed EMAC driver supports "No DMA" and "Scatter/Gather DMA" modes but *not*
"Simple DMA".  They don't check certain corner cases, and they work around
Xilinx software driver bugs with an ML300-specific hack that won't work
with other boards (we ran into this when using a different PHY than what's
on the ML300).
    None of this is not documented anywhere that I can find.  Do not assume
that all of the IP+driver functionality you plan on using is ported to Lin-
ux -- check.
    It also looks like the Xilinx software driver bugs that MV found were
not reported to Xilinx but just worked around, so those bugs are probably
still present in your design.  They were in ours...


NOTE 1:  And don't depend on Xilinx's rev numbers changing when their dri-
          ver code does.  I regularly run across situations where consecu-
          tive FPGA designs both use, say, the "gpio_v2_00_a" IP and driver
          yet the driver code has changed.  It is important that you 'diff'
          or whatever all of the driver code for changes each time you re-
          ceive a new FPGA design generated from an XPS with *any* changes
          at all (new version, patches, etc.), even if it appears that the
          patch should not affect any driver code.


In the end, MV's port of Linux is to an ML300 with an old reference design
(even though the ML300 *board* hasn't changed, if that's true).  You're
presumably using more current Xilinx tools and IP, so you'll have to update
the port.  And you'll probably have to do so repeatedly.


It's analagous to MV porting to the [non-FPGA] Acme RealCool rev A board
while you're starting with the RealCool rev C and moving to revs D, E,
etc. every few weeks or months.
    This -- the relatively rapid change of FPGA 'hardware' compared to the
typically much slower changes to a board -- is a fundamental difference be-
tween FPGA and non-FPGA-based systems that you have to deal with.  I'm not
sure MV fully comprehends the consequences of that; if they did I would ex-
pect their port to document what specific IP versions it works with (not to
mention what functionality wasn't ported, but that applies to non-FPGA
hardware as well).

Of course, even if they did that we'd still have to suffer Xilinx's tenden-
cy to release multiple versions of things without changing their rev num-
bers  :-(


I've been where you're going...
Regards, Tom

-- 
   /"\  ASCII Ribbon Campaign   |   Email to user 'CTZ001'
   \ /                          |             at 'email.mot.com'
    X        Against HTML       |
   / \     in e-mail & news     |

^ permalink raw reply

* [PATCH] ppc: Move 3 more headers to asm-powerpc
From: Becky Bruce @ 2005-08-25  2:40 UTC (permalink / raw)
  To: linuxppc-dev, linuxppc64-dev

Merged several nearly-identical header files from asm-ppc and asm-ppc64 into 
asm-powerpc.  This patch requires Stephen Rothwell's recent [PATCH 1/3] 
Create include/asm-powerpc.

Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>

---
commit 630b4d31338fdf66ff6d3e8f793b4dc2782e09b5
tree d0e785d79a1bca0f09558d181e2cb3cb4105eb0e
parent a9fa7aff4d2ef08fef0d393d1853b65f861e61bb
author Becky Bruce <becky.bruce@freescale.com> Wed, 24 Aug 2005 11:40:41 -0500
committer Becky Bruce <becky.bruce@freescale.com> Wed, 24 Aug 2005 11:40:41 -0500

 include/asm-powerpc/mman.h     |   52 +++++++++
 include/asm-powerpc/termbits.h |  191 ++++++++++++++++++++++++++++++++
 include/asm-powerpc/termios.h  |  236 ++++++++++++++++++++++++++++++++++++++++
 include/asm-ppc/mman.h         |   44 -------
 include/asm-ppc/termbits.h     |  185 -------------------------------
 include/asm-ppc/termios.h      |  232 ---------------------------------------
 include/asm-ppc64/mman.h       |   52 ---------
 include/asm-ppc64/termbits.h   |  193 ---------------------------------
 include/asm-ppc64/termios.h    |  235 ----------------------------------------
 9 files changed, 479 insertions(+), 941 deletions(-)

diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h
new file mode 100644
--- /dev/null
+++ b/include/asm-powerpc/mman.h
@@ -0,0 +1,52 @@
+#ifndef __PPC_MMAN_H__
+#define __PPC_MMAN_H__
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#define PROT_READ	0x1		/* page can be read */
+#define PROT_WRITE	0x2		/* page can be written */
+#define PROT_EXEC	0x4		/* page can be executed */
+#define PROT_SEM	0x8		/* page may be used for atomic ops */
+#define PROT_NONE	0x0		/* page can not be accessed */
+#define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
+#define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
+
+#define MAP_SHARED	0x01		/* Share changes */
+#define MAP_PRIVATE	0x02		/* Changes are private */
+#define MAP_TYPE	0x0f		/* Mask for type of mapping */
+#define MAP_FIXED	0x10		/* Interpret addr exactly */
+#define MAP_ANONYMOUS	0x20		/* don't use a file */
+#define MAP_RENAME      MAP_ANONYMOUS   /* In SunOS terminology */
+#define MAP_NORESERVE   0x40            /* don't reserve swap pages */
+#define MAP_LOCKED	0x80
+
+#define MAP_GROWSDOWN	0x0100		/* stack-like segment */
+#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+#define MAP_EXECUTABLE	0x1000		/* mark it as an executable */
+
+#define MS_ASYNC	1		/* sync memory asynchronously */
+#define MS_INVALIDATE	2		/* invalidate the caches */
+#define MS_SYNC		4		/* synchronous memory sync */
+
+#define MCL_CURRENT     0x2000          /* lock all currently mapped pages */
+#define MCL_FUTURE      0x4000          /* lock all additions to address space */
+
+#define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
+#define MAP_NONBLOCK	0x10000		/* do not block on IO */
+
+#define MADV_NORMAL	0x0		/* default page-in behavior */
+#define MADV_RANDOM	0x1		/* page-in minimum required */
+#define MADV_SEQUENTIAL	0x2		/* read-ahead aggressively */
+#define MADV_WILLNEED	0x3		/* pre-fault pages */
+#define MADV_DONTNEED	0x4		/* discard these pages */
+
+/* compatibility flags */
+#define MAP_ANON	MAP_ANONYMOUS
+#define MAP_FILE	0
+
+#endif /* __PPC_MMAN_H__ */
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h
new file mode 100644
--- /dev/null
+++ b/include/asm-powerpc/termbits.h
@@ -0,0 +1,191 @@
+#ifndef _PPC_TERMBITS_H
+#define _PPC_TERMBITS_H
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+typedef unsigned char	cc_t;
+typedef unsigned int	speed_t;
+typedef unsigned int	tcflag_t;
+
+/*
+ * termios type and macro definitions.  Be careful about adding stuff
+ * to this file since it's used in GNU libc and there are strict rules
+ * concerning namespace pollution.
+ */
+
+#define NCCS 19
+struct termios {
+	tcflag_t c_iflag;		/* input mode flags */
+	tcflag_t c_oflag;		/* output mode flags */
+	tcflag_t c_cflag;		/* control mode flags */
+	tcflag_t c_lflag;		/* local mode flags */
+	cc_t c_cc[NCCS];		/* control characters */
+	cc_t c_line;			/* line discipline (== c_cc[19]) */
+	speed_t c_ispeed;		/* input speed */
+	speed_t c_ospeed;		/* output speed */
+};
+
+/* c_cc characters */
+#define VINTR 	         0
+#define VQUIT 	         1
+#define VERASE 	         2
+#define VKILL	         3
+#define VEOF	         4
+#define VMIN	         5
+#define VEOL	         6
+#define VTIME	         7
+#define VEOL2	         8
+#define VSWTC	         9
+#define VWERASE 	10
+#define VREPRINT	11
+#define VSUSP 		12
+#define VSTART		13
+#define VSTOP		14
+#define VLNEXT		15
+#define VDISCARD	16
+
+/* c_iflag bits */
+#define IGNBRK	0000001
+#define BRKINT	0000002
+#define IGNPAR	0000004
+#define PARMRK	0000010
+#define INPCK	0000020
+#define ISTRIP	0000040
+#define INLCR	0000100
+#define IGNCR	0000200
+#define ICRNL	0000400
+#define IXON	0001000
+#define IXOFF	0002000
+#define IXANY	0004000
+#define IUCLC	0010000
+#define IMAXBEL	0020000
+#define	IUTF8	0040000
+
+/* c_oflag bits */
+#define OPOST	0000001
+#define ONLCR	0000002
+#define OLCUC	0000004
+
+#define OCRNL	0000010
+#define ONOCR	0000020
+#define ONLRET	0000040
+
+#define OFILL	00000100
+#define OFDEL	00000200
+#define NLDLY	00001400
+#define   NL0	00000000
+#define   NL1	00000400
+#define   NL2	00001000
+#define   NL3	00001400
+#define TABDLY	00006000
+#define   TAB0	00000000
+#define   TAB1	00002000
+#define   TAB2	00004000
+#define   TAB3	00006000
+#define   XTABS	00006000	/* required by POSIX to == TAB3 */
+#define CRDLY	00030000
+#define   CR0	00000000
+#define   CR1	00010000
+#define   CR2	00020000
+#define   CR3	00030000
+#define FFDLY	00040000
+#define   FF0	00000000
+#define   FF1	00040000
+#define BSDLY	00100000
+#define   BS0	00000000
+#define   BS1	00100000
+#define VTDLY	00200000
+#define   VT0	00000000
+#define   VT1	00200000
+
+/* c_cflag bit meaning */
+#define CBAUD	0000377
+#define  B0	0000000		/* hang up */
+#define  B50	0000001
+#define  B75	0000002
+#define  B110	0000003
+#define  B134	0000004
+#define  B150	0000005
+#define  B200	0000006
+#define  B300	0000007
+#define  B600	0000010
+#define  B1200	0000011
+#define  B1800	0000012
+#define  B2400	0000013
+#define  B4800	0000014
+#define  B9600	0000015
+#define  B19200	0000016
+#define  B38400	0000017
+#define  EXTA   B19200
+#define  EXTB   B38400
+#define  CBAUDEX 0000000
+#define  B57600   00020
+#define  B115200  00021
+#define  B230400  00022
+#define  B460800  00023
+#define  B500000  00024
+#define  B576000  00025
+#define  B921600  00026
+#define B1000000  00027
+#define B1152000  00030
+#define B1500000  00031
+#define B2000000  00032
+#define B2500000  00033
+#define B3000000  00034
+#define B3500000  00035
+#define B4000000  00036
+
+#define CSIZE	00001400
+#define   CS5	00000000
+#define   CS6	00000400
+#define   CS7	00001000
+#define   CS8	00001400
+
+#define CSTOPB	00002000
+#define CREAD	00004000
+#define PARENB	00010000
+#define PARODD	00020000
+#define HUPCL	00040000
+
+#define CLOCAL	00100000
+#define CRTSCTS	  020000000000		/* flow control */
+
+/* c_lflag bits */
+#define ISIG	0x00000080
+#define ICANON	0x00000100
+#define XCASE	0x00004000
+#define ECHO	0x00000008
+#define ECHOE	0x00000002
+#define ECHOK	0x00000004
+#define ECHONL	0x00000010
+#define NOFLSH	0x80000000
+#define TOSTOP	0x00400000
+#define ECHOCTL	0x00000040
+#define ECHOPRT	0x00000020
+#define ECHOKE	0x00000001
+#define FLUSHO	0x00800000
+#define PENDIN	0x20000000
+#define IEXTEN	0x00000400
+
+/* Values for the ACTION argument to `tcflow'.  */
+#define	TCOOFF		0
+#define	TCOON		1
+#define	TCIOFF		2
+#define	TCION		3
+
+/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
+#define	TCIFLUSH	0
+#define	TCOFLUSH	1
+#define	TCIOFLUSH	2
+
+/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
+#define	TCSANOW		0
+#define	TCSADRAIN	1
+#define	TCSAFLUSH	2
+
+#endif /* _PPC_TERMBITS_H */
diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h
new file mode 100644
--- /dev/null
+++ b/include/asm-powerpc/termios.h
@@ -0,0 +1,236 @@
+#ifndef _PPC_TERMIOS_H
+#define _PPC_TERMIOS_H
+
+/*
+ * Liberally adapted from alpha/termios.h.  In particular, the c_cc[]
+ * fields have been reordered so that termio & termios share the
+ * common subset in the same order (for brain dead programs that don't
+ * know or care about the differences).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <asm/ioctls.h>
+#include <asm/termbits.h>
+
+struct sgttyb {
+	char	sg_ispeed;
+	char	sg_ospeed;
+	char	sg_erase;
+	char	sg_kill;
+	short	sg_flags;
+};
+
+struct tchars {
+	char	t_intrc;
+	char	t_quitc;
+	char	t_startc;
+	char	t_stopc;
+	char	t_eofc;
+	char	t_brkc;
+};
+
+struct ltchars {
+	char	t_suspc;
+	char	t_dsuspc;
+	char	t_rprntc;
+	char	t_flushc;
+	char	t_werasc;
+	char	t_lnextc;
+};
+
+struct winsize {
+	unsigned short ws_row;
+	unsigned short ws_col;
+	unsigned short ws_xpixel;
+	unsigned short ws_ypixel;
+};
+
+#define NCC 10
+struct termio {
+	unsigned short c_iflag;		/* input mode flags */
+	unsigned short c_oflag;		/* output mode flags */
+	unsigned short c_cflag;		/* control mode flags */
+	unsigned short c_lflag;		/* local mode flags */
+	unsigned char c_line;		/* line discipline */
+	unsigned char c_cc[NCC];	/* control characters */
+};
+
+/* c_cc characters */
+#define _VINTR	0
+#define _VQUIT	1
+#define _VERASE	2
+#define _VKILL	3
+#define _VEOF	4
+#define _VMIN	5
+#define _VEOL	6
+#define _VTIME	7
+#define _VEOL2	8
+#define _VSWTC	9
+
+/* line disciplines */
+#define N_TTY		0
+#define N_SLIP		1
+#define N_MOUSE		2
+#define N_PPP		3
+#define N_STRIP		4
+#define N_AX25		5
+#define N_X25		6	/* X.25 async */
+#define N_6PACK		7
+#define N_MASC		8	/* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964		9	/* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL	10	/* Reserved for Profibus <Dave@mvhi.com> */
+#define N_IRDA		11	/* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
+#define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
+#define N_HDLC		13	/* synchronous HDLC */
+#define N_SYNC_PPP	14
+#define N_HCI		15  /* Bluetooth HCI UART */
+
+#ifdef __KERNEL__
+/*                   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  ^S  ^V  ^U  */
+#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
+#endif
+
+#define FIOCLEX		_IO('f', 1)
+#define FIONCLEX	_IO('f', 2)
+#define FIOASYNC	_IOW('f', 125, int)
+#define FIONBIO		_IOW('f', 126, int)
+#define FIONREAD	_IOR('f', 127, int)
+#define TIOCINQ		FIONREAD
+
+#define TIOCGETP	_IOR('t', 8, struct sgttyb)
+#define TIOCSETP	_IOW('t', 9, struct sgttyb)
+#define TIOCSETN	_IOW('t', 10, struct sgttyb)	/* TIOCSETP wo flush */
+
+#define TIOCSETC	_IOW('t', 17, struct tchars)
+#define TIOCGETC	_IOR('t', 18, struct tchars)
+#define TCGETS		_IOR('t', 19, struct termios)
+#define TCSETS		_IOW('t', 20, struct termios)
+#define TCSETSW		_IOW('t', 21, struct termios)
+#define TCSETSF		_IOW('t', 22, struct termios)
+
+#define TCGETA		_IOR('t', 23, struct termio)
+#define TCSETA		_IOW('t', 24, struct termio)
+#define TCSETAW		_IOW('t', 25, struct termio)
+#define TCSETAF		_IOW('t', 28, struct termio)
+
+#define TCSBRK		_IO('t', 29)
+#define TCXONC		_IO('t', 30)
+#define TCFLSH		_IO('t', 31)
+
+#define TIOCSWINSZ	_IOW('t', 103, struct winsize)
+#define TIOCGWINSZ	_IOR('t', 104, struct winsize)
+#define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */
+#define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */
+#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
+
+#define TIOCGLTC	_IOR('t', 116, struct ltchars)
+#define TIOCSLTC	_IOW('t', 117, struct ltchars)
+#define TIOCSPGRP	_IOW('t', 118, int)
+#define TIOCGPGRP	_IOR('t', 119, int)
+
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+
+#define TIOCSTI		0x5412
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
+
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
+#define TIOCSERGETLSR   0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
+#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
+
+/* Used for packet mode */
+#define TIOCPKT_DATA		 0
+#define TIOCPKT_FLUSHREAD	 1
+#define TIOCPKT_FLUSHWRITE	 2
+#define TIOCPKT_STOP		 4
+#define TIOCPKT_START		 8
+#define TIOCPKT_NOSTOP		16
+#define TIOCPKT_DOSTOP		32
+
+/* modem lines */
+#define TIOCM_LE	0x001
+#define TIOCM_DTR	0x002
+#define TIOCM_RTS	0x004
+#define TIOCM_ST	0x008
+#define TIOCM_SR	0x010
+#define TIOCM_CTS	0x020
+#define TIOCM_CAR	0x040
+#define TIOCM_RNG	0x080
+#define TIOCM_DSR	0x100
+#define TIOCM_CD	TIOCM_CAR
+#define TIOCM_RI	TIOCM_RNG
+#define TIOCM_OUT1	0x2000
+#define TIOCM_OUT2	0x4000
+#define TIOCM_LOOP	0x8000
+
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+#ifdef __KERNEL__
+
+/*
+ * Translate a "termio" structure into a "termios". Ugh.
+ */
+#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
+	unsigned short __tmp; \
+	get_user(__tmp,&(termio)->x); \
+	(termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
+}
+
+#define user_termio_to_kernel_termios(termios, termio) \
+({ \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
+	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
+})
+
+/*
+ * Translate a "termios" structure into a "termio". Ugh.
+ */
+#define kernel_termios_to_user_termio(termio, termios) \
+({ \
+	put_user((termios)->c_iflag, &(termio)->c_iflag); \
+	put_user((termios)->c_oflag, &(termio)->c_oflag); \
+	put_user((termios)->c_cflag, &(termio)->c_cflag); \
+	put_user((termios)->c_lflag, &(termio)->c_lflag); \
+	put_user((termios)->c_line,  &(termio)->c_line); \
+	copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
+})
+
+#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
+#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
+
+#endif	/* __KERNEL__ */
+
+#endif	/* _PPC_TERMIOS_H */
diff --git a/include/asm-ppc/mman.h b/include/asm-ppc/mman.h
deleted file mode 100644
--- a/include/asm-ppc/mman.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef __PPC_MMAN_H__
-#define __PPC_MMAN_H__
-
-#define PROT_READ	0x1		/* page can be read */
-#define PROT_WRITE	0x2		/* page can be written */
-#define PROT_EXEC	0x4		/* page can be executed */
-#define PROT_SEM	0x8		/* page may be used for atomic ops */
-#define PROT_NONE	0x0		/* page can not be accessed */
-#define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
-#define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
-
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_TYPE	0x0f		/* Mask for type of mapping */
-#define MAP_FIXED	0x10		/* Interpret addr exactly */
-#define MAP_ANONYMOUS	0x20		/* don't use a file */
-#define MAP_RENAME      MAP_ANONYMOUS   /* In SunOS terminology */
-#define MAP_NORESERVE   0x40            /* don't reserve swap pages */
-#define MAP_LOCKED	0x80
-
-#define MAP_GROWSDOWN	0x0100		/* stack-like segment */
-#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
-#define MAP_EXECUTABLE	0x1000		/* mark it as an executable */
-#define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
-#define MAP_NONBLOCK	0x10000		/* do not block on IO */
-
-#define MS_ASYNC	1		/* sync memory asynchronously */
-#define MS_INVALIDATE	2		/* invalidate the caches */
-#define MS_SYNC		4		/* synchronous memory sync */
-
-#define MCL_CURRENT     0x2000          /* lock all currently mapped pages */
-#define MCL_FUTURE      0x4000          /* lock all additions to address space */
-
-#define MADV_NORMAL	0x0		/* default page-in behavior */
-#define MADV_RANDOM	0x1		/* page-in minimum required */
-#define MADV_SEQUENTIAL	0x2		/* read-ahead aggressively */
-#define MADV_WILLNEED	0x3		/* pre-fault pages */
-#define MADV_DONTNEED	0x4		/* discard these pages */
-
-/* compatibility flags */
-#define MAP_ANON	MAP_ANONYMOUS
-#define MAP_FILE	0
-
-#endif /* __PPC_MMAN_H__ */
diff --git a/include/asm-ppc/termbits.h b/include/asm-ppc/termbits.h
deleted file mode 100644
--- a/include/asm-ppc/termbits.h
+++ /dev/null
@@ -1,185 +0,0 @@
-#ifndef _PPC_TERMBITS_H
-#define _PPC_TERMBITS_H
-
-typedef unsigned char	cc_t;
-typedef unsigned int	speed_t;
-typedef unsigned int	tcflag_t;
-
-/*
- * termios type and macro definitions.  Be careful about adding stuff
- * to this file since it's used in GNU libc and there are strict rules
- * concerning namespace pollution.
- */
-
-#define NCCS 19
-struct termios {
-	tcflag_t c_iflag;		/* input mode flags */
-	tcflag_t c_oflag;		/* output mode flags */
-	tcflag_t c_cflag;		/* control mode flags */
-	tcflag_t c_lflag;		/* local mode flags */
-	cc_t c_cc[NCCS];		/* control characters */
-	cc_t c_line;			/* line discipline (== c_cc[19]) */
-	speed_t c_ispeed;		/* input speed */
-	speed_t c_ospeed;		/* output speed */
-};
-
-/* c_cc characters */
-#define VINTR 	0
-#define VQUIT 	1
-#define VERASE 	2
-#define VKILL	3
-#define VEOF	4
-#define VMIN	5
-#define VEOL	6
-#define VTIME	7
-#define VEOL2	8
-#define VSWTC	9
-
-#define VWERASE 	10
-#define VREPRINT	11
-#define VSUSP 		12
-#define VSTART		13
-#define VSTOP		14
-#define VLNEXT		15
-#define VDISCARD	16
-
-/* c_iflag bits */
-#define IGNBRK	0000001
-#define BRKINT	0000002
-#define IGNPAR	0000004
-#define PARMRK	0000010
-#define INPCK	0000020
-#define ISTRIP	0000040
-#define INLCR	0000100
-#define IGNCR	0000200
-#define ICRNL	0000400
-#define IXON	0001000
-#define IXOFF	0002000
-#define IXANY		0004000
-#define IUCLC		0010000
-#define IMAXBEL	0020000
-#define IUTF8	0040000
-
-/* c_oflag bits */
-#define OPOST	0000001
-#define ONLCR	0000002
-#define OLCUC	0000004
-
-#define OCRNL	0000010
-#define ONOCR	0000020
-#define ONLRET	0000040
-
-#define OFILL	00000100
-#define OFDEL	00000200
-#define NLDLY	00001400
-#define   NL0	00000000
-#define   NL1	00000400
-#define   NL2	00001000
-#define   NL3	00001400
-#define TABDLY	00006000
-#define   TAB0	00000000
-#define   TAB1	00002000
-#define   TAB2	00004000
-#define   TAB3	00006000
-#define   XTABS	00006000	/* required by POSIX to == TAB3 */
-#define CRDLY	00030000
-#define   CR0	00000000
-#define   CR1	00010000
-#define   CR2	00020000
-#define   CR3	00030000
-#define FFDLY	00040000
-#define   FF0	00000000
-#define   FF1	00040000
-#define BSDLY	00100000
-#define   BS0	00000000
-#define   BS1	00100000
-#define VTDLY	00200000
-#define   VT0	00000000
-#define   VT1	00200000
-
-/* c_cflag bit meaning */
-#define CBAUD	0000377
-#define  B0	0000000		/* hang up */
-#define  B50	0000001
-#define  B75	0000002
-#define  B110	0000003
-#define  B134	0000004
-#define  B150	0000005
-#define  B200	0000006
-#define  B300	0000007
-#define  B600	0000010
-#define  B1200	0000011
-#define  B1800	0000012
-#define  B2400	0000013
-#define  B4800	0000014
-#define  B9600	0000015
-#define  B19200	0000016
-#define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CBAUDEX 0000000
-#define  B57600   00020
-#define  B115200  00021
-#define  B230400  00022
-#define  B460800  00023
-#define  B500000  00024
-#define  B576000  00025
-#define  B921600  00026
-#define B1000000  00027
-#define B1152000  00030
-#define B1500000  00031
-#define B2000000  00032
-#define B2500000  00033
-#define B3000000  00034
-#define B3500000  00035
-#define B4000000  00036
-
-#define CSIZE	00001400
-#define   CS5	00000000
-#define   CS6	00000400
-#define   CS7	00001000
-#define   CS8	00001400
-
-#define CSTOPB	00002000
-#define CREAD	00004000
-#define PARENB	00010000
-#define PARODD	00020000
-#define HUPCL	00040000
-
-#define CLOCAL	00100000
-#define CRTSCTS	  020000000000		/* flow control */
-
-/* c_lflag bits */
-#define ISIG	0x00000080
-#define ICANON	0x00000100
-#define XCASE	0x00004000
-#define ECHO	0x00000008
-#define ECHOE	0x00000002
-#define ECHOK	0x00000004
-#define ECHONL	0x00000010
-#define NOFLSH	0x80000000
-#define TOSTOP	0x00400000
-#define ECHOCTL	0x00000040
-#define ECHOPRT	0x00000020
-#define ECHOKE	0x00000001
-#define FLUSHO	0x00800000
-#define PENDIN	0x20000000
-#define IEXTEN	0x00000400
-
-/* Values for the ACTION argument to `tcflow'.  */
-#define	TCOOFF		0
-#define	TCOON		1
-#define	TCIOFF		2
-#define	TCION		3
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
-#define	TCIFLUSH	0
-#define	TCOFLUSH	1
-#define	TCIOFLUSH	2
-
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
-#define	TCSANOW		0
-#define	TCSADRAIN	1
-#define	TCSAFLUSH	2
-
-#endif /* _PPC_TERMBITS_H */
diff --git a/include/asm-ppc/termios.h b/include/asm-ppc/termios.h
deleted file mode 100644
--- a/include/asm-ppc/termios.h
+++ /dev/null
@@ -1,232 +0,0 @@
-#ifndef _PPC_TERMIOS_H
-#define _PPC_TERMIOS_H
-
-/*
- * Liberally adapted from alpha/termios.h.  In particular, the c_cc[]
- * fields have been reordered so that termio & termios share the
- * common subset in the same order (for brain dead programs that don't
- * know or care about the differences).
- */
-
-#include <asm/ioctls.h>
-#include <asm/termbits.h>
-
-struct sgttyb {
-	char	sg_ispeed;
-	char	sg_ospeed;
-	char	sg_erase;
-	char	sg_kill;
-	short	sg_flags;
-};
-
-struct tchars {
-	char	t_intrc;
-	char	t_quitc;
-	char	t_startc;
-	char	t_stopc;
-	char	t_eofc;
-	char	t_brkc;
-};
-
-struct ltchars {
-	char	t_suspc;
-	char	t_dsuspc;
-	char	t_rprntc;
-	char	t_flushc;
-	char	t_werasc;
-	char	t_lnextc;
-};
-
-#define FIOCLEX		_IO('f', 1)
-#define FIONCLEX	_IO('f', 2)
-#define FIOASYNC	_IOW('f', 125, int)
-#define FIONBIO		_IOW('f', 126, int)
-#define FIONREAD	_IOR('f', 127, int)
-#define TIOCINQ		FIONREAD
-#define FIOQSIZE	_IOR('f', 128, loff_t)
-
-#define TIOCGETP	_IOR('t', 8, struct sgttyb)
-#define TIOCSETP	_IOW('t', 9, struct sgttyb)
-#define TIOCSETN	_IOW('t', 10, struct sgttyb)	/* TIOCSETP wo flush */
-
-#define TIOCSETC	_IOW('t', 17, struct tchars)
-#define TIOCGETC	_IOR('t', 18, struct tchars)
-#define TCGETS		_IOR('t', 19, struct termios)
-#define TCSETS		_IOW('t', 20, struct termios)
-#define TCSETSW		_IOW('t', 21, struct termios)
-#define TCSETSF		_IOW('t', 22, struct termios)
-
-#define TCGETA		_IOR('t', 23, struct termio)
-#define TCSETA		_IOW('t', 24, struct termio)
-#define TCSETAW		_IOW('t', 25, struct termio)
-#define TCSETAF		_IOW('t', 28, struct termio)
-
-#define TCSBRK		_IO('t', 29)
-#define TCXONC		_IO('t', 30)
-#define TCFLSH		_IO('t', 31)
-
-#define TIOCSWINSZ	_IOW('t', 103, struct winsize)
-#define TIOCGWINSZ	_IOR('t', 104, struct winsize)
-#define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */
-#define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */
-#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
-
-#define TIOCGLTC	_IOR('t', 116, struct ltchars)
-#define TIOCSLTC	_IOW('t', 117, struct ltchars)
-#define TIOCSPGRP	_IOW('t', 118, int)
-#define TIOCGPGRP	_IOR('t', 119, int)
-
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-
-#define TIOCSTI		0x5412
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-struct winsize {
-	unsigned short ws_row;
-	unsigned short ws_col;
-	unsigned short ws_xpixel;
-	unsigned short ws_ypixel;
-};
-
-#define NCC 10
-struct termio {
-	unsigned short c_iflag;		/* input mode flags */
-	unsigned short c_oflag;		/* output mode flags */
-	unsigned short c_cflag;		/* control mode flags */
-	unsigned short c_lflag;		/* local mode flags */
-	unsigned char c_line;		/* line discipline */
-	unsigned char c_cc[NCC];	/* control characters */
-};
-
-/* c_cc characters */
-#define _VINTR	0
-#define _VQUIT	1
-#define _VERASE	2
-#define _VKILL	3
-#define _VEOF	4
-#define _VMIN	5
-#define _VEOL	6
-#define _VTIME	7
-#define _VEOL2	8
-#define _VSWTC	9
-
-#ifdef __KERNEL__
-/*                   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  ^S  ^V  ^U  */
-#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025"
-#endif	/* __KERNEL__ */
-
-/* modem lines */
-#define TIOCM_LE	0x001
-#define TIOCM_DTR	0x002
-#define TIOCM_RTS	0x004
-#define TIOCM_ST	0x008
-#define TIOCM_SR	0x010
-#define TIOCM_CTS	0x020
-#define TIOCM_CAR	0x040
-#define TIOCM_RNG	0x080
-#define TIOCM_DSR	0x100
-#define TIOCM_CD	TIOCM_CAR
-#define TIOCM_RI	TIOCM_RNG
-#define TIOCM_OUT1	0x2000
-#define TIOCM_OUT2	0x4000
-#define TIOCM_LOOP	0x8000
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-/* line disciplines */
-#define N_TTY		0
-#define N_SLIP		1
-#define N_MOUSE		2
-#define N_PPP		3
-#define N_STRIP		4
-#define N_AX25		5
-#define N_X25		6	/* X.25 async */
-#define N_6PACK		7
-#define N_MASC		8	/* Reserved for Mobitex module <kaz@cafe.net> */
-#define N_R3964		9	/* Reserved for Simatic R3964 module */
-#define N_PROFIBUS_FDL	10	/* Reserved for Profibus <Dave@mvhi.com> */
-#define N_IRDA		11	/* Linux IrDa - http://irda.sourceforge.net/ */
-#define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
-#define N_HDLC		13	/* synchronous HDLC */
-#define N_SYNC_PPP	14
-#define N_HCI		15  /* Bluetooth HCI UART */
-
-#ifdef __KERNEL__
-
-/*
- * Translate a "termio" structure into a "termios". Ugh.
- */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
-	unsigned short __tmp; \
-	get_user(__tmp,&(termio)->x); \
-	(termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
-}
-
-#define user_termio_to_kernel_termios(termios, termio) \
-({ \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
-	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
-})
-
-/*
- * Translate a "termios" structure into a "termio". Ugh.
- */
-#define kernel_termios_to_user_termio(termio, termios) \
-({ \
-	put_user((termios)->c_iflag, &(termio)->c_iflag); \
-	put_user((termios)->c_oflag, &(termio)->c_oflag); \
-	put_user((termios)->c_cflag, &(termio)->c_cflag); \
-	put_user((termios)->c_lflag, &(termio)->c_lflag); \
-	put_user((termios)->c_line,  &(termio)->c_line); \
-	copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
-})
-
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
-
-#endif	/* __KERNEL__ */
-
-#endif	/* _PPC_TERMIOS_H */
diff --git a/include/asm-ppc64/mman.h b/include/asm-ppc64/mman.h
deleted file mode 100644
--- a/include/asm-ppc64/mman.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef __PPC64_MMAN_H__
-#define __PPC64_MMAN_H__
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#define PROT_READ	0x1		/* page can be read */
-#define PROT_WRITE	0x2		/* page can be written */
-#define PROT_EXEC	0x4		/* page can be executed */
-#define PROT_SEM	0x8		/* page may be used for atomic ops */
-#define PROT_NONE	0x0		/* page can not be accessed */
-#define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
-#define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
-
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_TYPE	0x0f		/* Mask for type of mapping */
-#define MAP_FIXED	0x10		/* Interpret addr exactly */
-#define MAP_ANONYMOUS	0x20		/* don't use a file */
-#define MAP_RENAME      MAP_ANONYMOUS   /* In SunOS terminology */
-#define MAP_NORESERVE   0x40            /* don't reserve swap pages */
-#define MAP_LOCKED	0x80
-
-#define MAP_GROWSDOWN	0x0100		/* stack-like segment */
-#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
-#define MAP_EXECUTABLE	0x1000		/* mark it as an executable */
-
-#define MS_ASYNC	1		/* sync memory asynchronously */
-#define MS_INVALIDATE	2		/* invalidate the caches */
-#define MS_SYNC		4		/* synchronous memory sync */
-
-#define MCL_CURRENT     0x2000          /* lock all currently mapped pages */
-#define MCL_FUTURE      0x4000          /* lock all additions to address space */
-
-#define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
-#define MAP_NONBLOCK	0x10000		/* do not block on IO */
-
-#define MADV_NORMAL	0x0		/* default page-in behavior */
-#define MADV_RANDOM	0x1		/* page-in minimum required */
-#define MADV_SEQUENTIAL	0x2		/* read-ahead aggressively */
-#define MADV_WILLNEED	0x3		/* pre-fault pages */
-#define MADV_DONTNEED	0x4		/* discard these pages */
-
-/* compatibility flags */
-#define MAP_ANON	MAP_ANONYMOUS
-#define MAP_FILE	0
-
-#endif /* __PPC64_MMAN_H__ */
diff --git a/include/asm-ppc64/termbits.h b/include/asm-ppc64/termbits.h
deleted file mode 100644
--- a/include/asm-ppc64/termbits.h
+++ /dev/null
@@ -1,193 +0,0 @@
-#ifndef _PPC64_TERMBITS_H
-#define _PPC64_TERMBITS_H
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#include <linux/posix_types.h>
-
-typedef unsigned char	cc_t;
-typedef unsigned int	speed_t;
-typedef unsigned int	tcflag_t;
-
-/*
- * termios type and macro definitions.  Be careful about adding stuff
- * to this file since it's used in GNU libc and there are strict rules
- * concerning namespace pollution.
- */
-
-#define NCCS 19
-struct termios {
-	tcflag_t c_iflag;		/* input mode flags */
-	tcflag_t c_oflag;		/* output mode flags */
-	tcflag_t c_cflag;		/* control mode flags */
-	tcflag_t c_lflag;		/* local mode flags */
-	cc_t c_cc[NCCS];		/* control characters */
-	cc_t c_line;			/* line discipline (== c_cc[19]) */
-	speed_t c_ispeed;		/* input speed */
-	speed_t c_ospeed;		/* output speed */
-};
-
-/* c_cc characters */
-#define VINTR 	         0
-#define VQUIT 	         1
-#define VERASE 	         2
-#define VKILL	         3
-#define VEOF	         4
-#define VMIN	         5
-#define VEOL	         6
-#define VTIME	         7
-#define VEOL2	         8
-#define VSWTC	         9
-#define VWERASE 	10
-#define VREPRINT	11
-#define VSUSP 		12
-#define VSTART		13
-#define VSTOP		14
-#define VLNEXT		15
-#define VDISCARD	16
-
-/* c_iflag bits */
-#define IGNBRK	0000001
-#define BRKINT	0000002
-#define IGNPAR	0000004
-#define PARMRK	0000010
-#define INPCK	0000020
-#define ISTRIP	0000040
-#define INLCR	0000100
-#define IGNCR	0000200
-#define ICRNL	0000400
-#define IXON	0001000
-#define IXOFF	0002000
-#define IXANY	0004000
-#define IUCLC	0010000
-#define IMAXBEL	0020000
-#define	IUTF8	0040000
-
-/* c_oflag bits */
-#define OPOST	0000001
-#define ONLCR	0000002
-#define OLCUC	0000004
-
-#define OCRNL	0000010
-#define ONOCR	0000020
-#define ONLRET	0000040
-
-#define OFILL	00000100
-#define OFDEL	00000200
-#define NLDLY	00001400
-#define   NL0	00000000
-#define   NL1	00000400
-#define   NL2	00001000
-#define   NL3	00001400
-#define TABDLY	00006000
-#define   TAB0	00000000
-#define   TAB1	00002000
-#define   TAB2	00004000
-#define   TAB3	00006000
-#define   XTABS	00006000	/* required by POSIX to == TAB3 */
-#define CRDLY	00030000
-#define   CR0	00000000
-#define   CR1	00010000
-#define   CR2	00020000
-#define   CR3	00030000
-#define FFDLY	00040000
-#define   FF0	00000000
-#define   FF1	00040000
-#define BSDLY	00100000
-#define   BS0	00000000
-#define   BS1	00100000
-#define VTDLY	00200000
-#define   VT0	00000000
-#define   VT1	00200000
-
-/* c_cflag bit meaning */
-#define CBAUD	0000377
-#define  B0	0000000		/* hang up */
-#define  B50	0000001
-#define  B75	0000002
-#define  B110	0000003
-#define  B134	0000004
-#define  B150	0000005
-#define  B200	0000006
-#define  B300	0000007
-#define  B600	0000010
-#define  B1200	0000011
-#define  B1800	0000012
-#define  B2400	0000013
-#define  B4800	0000014
-#define  B9600	0000015
-#define  B19200	0000016
-#define  B38400	0000017
-#define  EXTA   B19200
-#define  EXTB   B38400
-#define  CBAUDEX 0000000
-#define  B57600   00020
-#define  B115200  00021
-#define  B230400  00022
-#define  B460800  00023
-#define  B500000  00024
-#define  B576000  00025
-#define  B921600  00026
-#define B1000000  00027
-#define B1152000  00030
-#define B1500000  00031
-#define B2000000  00032
-#define B2500000  00033
-#define B3000000  00034
-#define B3500000  00035
-#define B4000000  00036
-
-#define CSIZE	00001400
-#define   CS5	00000000
-#define   CS6	00000400
-#define   CS7	00001000
-#define   CS8	00001400
-
-#define CSTOPB	00002000
-#define CREAD	00004000
-#define PARENB	00010000
-#define PARODD	00020000
-#define HUPCL	00040000
-
-#define CLOCAL	00100000
-#define CRTSCTS	  020000000000		/* flow control */
-
-/* c_lflag bits */
-#define ISIG	0x00000080
-#define ICANON	0x00000100
-#define XCASE	0x00004000
-#define ECHO	0x00000008
-#define ECHOE	0x00000002
-#define ECHOK	0x00000004
-#define ECHONL	0x00000010
-#define NOFLSH	0x80000000
-#define TOSTOP	0x00400000
-#define ECHOCTL	0x00000040
-#define ECHOPRT	0x00000020
-#define ECHOKE	0x00000001
-#define FLUSHO	0x00800000
-#define PENDIN	0x20000000
-#define IEXTEN	0x00000400
-
-/* Values for the ACTION argument to `tcflow'.  */
-#define	TCOOFF		0
-#define	TCOON		1
-#define	TCIOFF		2
-#define	TCION		3
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
-#define	TCIFLUSH	0
-#define	TCOFLUSH	1
-#define	TCIOFLUSH	2
-
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
-#define	TCSANOW		0
-#define	TCSADRAIN	1
-#define	TCSAFLUSH	2
-
-#endif /* _PPC64_TERMBITS_H */
diff --git a/include/asm-ppc64/termios.h b/include/asm-ppc64/termios.h
deleted file mode 100644
--- a/include/asm-ppc64/termios.h
+++ /dev/null
@@ -1,235 +0,0 @@
-#ifndef _PPC64_TERMIOS_H
-#define _PPC64_TERMIOS_H
-
-/*
- * Liberally adapted from alpha/termios.h.  In particular, the c_cc[]
- * fields have been reordered so that termio & termios share the
- * common subset in the same order (for brain dead programs that don't
- * know or care about the differences).
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#include <asm/ioctls.h>
-#include <asm/termbits.h>
-
-struct sgttyb {
-	char	sg_ispeed;
-	char	sg_ospeed;
-	char	sg_erase;
-	char	sg_kill;
-	short	sg_flags;
-};
-
-struct tchars {
-	char	t_intrc;
-	char	t_quitc;
-	char	t_startc;
-	char	t_stopc;
-	char	t_eofc;
-	char	t_brkc;
-};
-
-struct ltchars {
-	char	t_suspc;
-	char	t_dsuspc;
-	char	t_rprntc;
-	char	t_flushc;
-	char	t_werasc;
-	char	t_lnextc;
-};
-
-struct winsize {
-	unsigned short ws_row;
-	unsigned short ws_col;
-	unsigned short ws_xpixel;
-	unsigned short ws_ypixel;
-};
-
-#define NCC 10
-struct termio {
-	unsigned short c_iflag;		/* input mode flags */
-	unsigned short c_oflag;		/* output mode flags */
-	unsigned short c_cflag;		/* control mode flags */
-	unsigned short c_lflag;		/* local mode flags */
-	unsigned char c_line;		/* line discipline */
-	unsigned char c_cc[NCC];	/* control characters */
-};
-
-/* c_cc characters */
-#define _VINTR	0
-#define _VQUIT	1
-#define _VERASE	2
-#define _VKILL	3
-#define _VEOF	4
-#define _VMIN	5
-#define _VEOL	6
-#define _VTIME	7
-#define _VEOL2	8
-#define _VSWTC	9
-
-/* line disciplines */
-#define N_TTY		0
-#define N_SLIP		1
-#define N_MOUSE		2
-#define N_PPP		3
-#define N_STRIP		4
-#define N_AX25		5
-#define N_X25		6	/* X.25 async */
-#define N_6PACK		7
-#define N_MASC		8	/* Reserved for Mobitex module <kaz@cafe.net> */
-#define N_R3964		9	/* Reserved for Simatic R3964 module */
-#define N_PROFIBUS_FDL	10	/* Reserved for Profibus <Dave@mvhi.com> */
-#define N_IRDA		11	/* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
-#define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
-#define N_HDLC		13	/* synchronous HDLC */
-#define N_SYNC_PPP	14
-
-#ifdef __KERNEL__
-/*                   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  ^S  ^V  ^U  */
-#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
-#endif
-
-#define FIOCLEX		_IO('f', 1)
-#define FIONCLEX	_IO('f', 2)
-#define FIOASYNC	_IOW('f', 125, int)
-#define FIONBIO		_IOW('f', 126, int)
-#define FIONREAD	_IOR('f', 127, int)
-#define TIOCINQ		FIONREAD
-
-#define TIOCGETP	_IOR('t', 8, struct sgttyb)
-#define TIOCSETP	_IOW('t', 9, struct sgttyb)
-#define TIOCSETN	_IOW('t', 10, struct sgttyb)	/* TIOCSETP wo flush */
-
-#define TIOCSETC	_IOW('t', 17, struct tchars)
-#define TIOCGETC	_IOR('t', 18, struct tchars)
-#define TCGETS		_IOR('t', 19, struct termios)
-#define TCSETS		_IOW('t', 20, struct termios)
-#define TCSETSW		_IOW('t', 21, struct termios)
-#define TCSETSF		_IOW('t', 22, struct termios)
-
-#define TCGETA		_IOR('t', 23, struct termio)
-#define TCSETA		_IOW('t', 24, struct termio)
-#define TCSETAW		_IOW('t', 25, struct termio)
-#define TCSETAF		_IOW('t', 28, struct termio)
-
-#define TCSBRK		_IO('t', 29)
-#define TCXONC		_IO('t', 30)
-#define TCFLSH		_IO('t', 31)
-
-#define TIOCSWINSZ	_IOW('t', 103, struct winsize)
-#define TIOCGWINSZ	_IOR('t', 104, struct winsize)
-#define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */
-#define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */
-#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
-
-#define TIOCGLTC	_IOR('t', 116, struct ltchars)
-#define TIOCSLTC	_IOW('t', 117, struct ltchars)
-#define TIOCSPGRP	_IOW('t', 118, int)
-#define TIOCGPGRP	_IOR('t', 119, int)
-
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-
-#define TIOCSTI		0x5412
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-/* modem lines */
-#define TIOCM_LE	0x001
-#define TIOCM_DTR	0x002
-#define TIOCM_RTS	0x004
-#define TIOCM_ST	0x008
-#define TIOCM_SR	0x010
-#define TIOCM_CTS	0x020
-#define TIOCM_CAR	0x040
-#define TIOCM_RNG	0x080
-#define TIOCM_DSR	0x100
-#define TIOCM_CD	TIOCM_CAR
-#define TIOCM_RI	TIOCM_RNG
-#define TIOCM_OUT1	0x2000
-#define TIOCM_OUT2	0x4000
-#define TIOCM_LOOP	0x8000
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-#ifdef __KERNEL__
-
-/*
- * Translate a "termio" structure into a "termios". Ugh.
- */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
-	unsigned short __tmp; \
-	get_user(__tmp,&(termio)->x); \
-	(termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
-}
-
-#define user_termio_to_kernel_termios(termios, termio) \
-({ \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
-	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
-	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
-})
-
-/*
- * Translate a "termios" structure into a "termio". Ugh.
- */
-#define kernel_termios_to_user_termio(termio, termios) \
-({ \
-	put_user((termios)->c_iflag, &(termio)->c_iflag); \
-	put_user((termios)->c_oflag, &(termio)->c_oflag); \
-	put_user((termios)->c_cflag, &(termio)->c_cflag); \
-	put_user((termios)->c_lflag, &(termio)->c_lflag); \
-	put_user((termios)->c_line,  &(termio)->c_line); \
-	copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
-})
-
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
-
-#endif	/* __KERNEL__ */
-
-#endif	/* _PPC64_TERMIOS_H */

^ permalink raw reply

* RE: Linux Kernel MTD question
From: JohnsonCheng @ 2005-08-25  2:59 UTC (permalink / raw)
  To: 'Alex Zeffertt'; +Cc: linuxppc-embedded
In-Reply-To: <20050824094955.21977185.ajz@cambridgebroadband.com>

Good idea. It works well.
The latest version of mtd utility for erase flash is flash_eraseall.

Thank you very much,
Johnson Cheng

-----Original Message-----
From: Alex Zeffertt [mailto:ajz@cambridgebroadband.com] 
Sent: Wednesday, August 24, 2005 4:50 PM
To: JohnsonCheng
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: Linux Kernel MTD question

Before doing a write to /dev/mtd1 try running 
~# eraseall /dev/mtd1

(eraseall is from the mtd-utils package.)

Alex


On Wed, 24 Aug 2005 13:02:31 +0800
"JohnsonCheng" <johnsoncheng@qnap.com.tw> wrote:

> Dear Ricardo and Wolfgang,
> 
> Very thanks for your kindly support.
> I am sorry I made a mistake.
> Before you mount /dev/mtdblock4, you have to use mke2fs to format it.
> Now I think my MTD function is almost ready, except write.
> When I run "dd if=/dev/mtd1 of=kernel.img", it's OK.
> But when I run "dd if=kernel.img of=/dev/mtd1", it's failed. No error
> message printed, and the process time is shortly, cause Bad CRC.
> 
> Thanks,
> Johnson Cheng
> 
> -----Original Message-----
> From: linuxppc-embedded-bounces@ozlabs.org
> [mailto:linuxppc-embedded-bounces@ozlabs.org] On Behalf Of Ricardo Scop
> Sent: Wednesday, August 24, 2005 3:17 AM
> To: JohnsonCheng; 'Robert P. J. Day'
> Cc: linuxppc-embedded@ozlabs.org
> Subject: Re: Linux Kernel MTD question
> 
> Hi Johnson,
> 
> On Tuesday 23 August 2005 02:31, JohnsonCheng wrote:
> > It doesn't work, too.
> > Error message: Invalid argument.
> Well, do you have an mtdblock4 entry in /dev?
> 
> Also, you should specify your filesystem type to mount, like in:
> 
> mount -t jffs2 /dev/mtdblock4 /mnt
> 
> BTW, -t jffs2 is just an example.
> 
> HTH,
> 
> -Scop.
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> 
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

^ permalink raw reply

* How to build an image for whole flash
From: JohnsonCheng @ 2005-08-25  3:21 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

Dear All,

 

My flash is 16M that is mapping on 0xFF000000-0xFFFFFFFF.

mtd0: 0xFF000000-0xFF1FFFFF      Kernel

mtd1: 0xFF200000-0xFF9FFFFF      RootFS

mtd2: 0xFFA00000-0xFFAFFFFF       Config

mtd3: 0xFFF00000-0xFFFFFFFF      U-Boot

 

Now I can build an image for mtd device, for example, dd if=/dev/mtd0
of=kernel.img.

But I don't know how to build a image for whole flash ? 

 

 

Thanks,

Johnson Cheng


[-- Attachment #2: Type: text/html, Size: 4066 bytes --]

^ permalink raw reply

* Re: AC Power handling broken for desktops
From: Olaf Hering @ 2005-08-25  4:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1124922771.5159.134.camel@gaston>

 On Thu, Aug 25, Benjamin Herrenschmidt wrote:

> On Wed, 2005-08-24 at 13:54 +0200, Olaf Hering wrote:
> > My G4/450 runs without AC Power, according to /proc/pmu/info:
> > 
> > PMU driver version     : 2
> > PMU firmware version   : 0c
> > AC Power               : 0
> > Battery count          : 0
> > 
> > It should report 1. Where is the best place to get the
> > PMU_PWR_AC_PRESENT into ac_line_status?
> 
> Do we get the bit set from the PMU ? If not, maybe we should hard code
> that value on non-laptops

Appearently not, how do I check it?

^ permalink raw reply

* Re: AC Power handling broken for desktops
From: Benjamin Herrenschmidt @ 2005-08-25  5:08 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev
In-Reply-To: <20050825045108.GA19792@suse.de>

On Thu, 2005-08-25 at 06:51 +0200, Olaf Hering wrote:
>  On Thu, Aug 25, Benjamin Herrenschmidt wrote:
> 
> > On Wed, 2005-08-24 at 13:54 +0200, Olaf Hering wrote:
> > > My G4/450 runs without AC Power, according to /proc/pmu/info:
> > > 
> > > PMU driver version     : 2
> > > PMU firmware version   : 0c
> > > AC Power               : 0
> > > Battery count          : 0
> > > 
> > > It should report 1. Where is the best place to get the
> > > PMU_PWR_AC_PRESENT into ac_line_status?
> > 
> > Do we get the bit set from the PMU ? If not, maybe we should hard code
> > that value on non-laptops
> 
> Appearently not, how do I check it?

Not sure :) I don't fully know how to decode those power things in the
device-tree... There are bits in darwin tho.

Ben

^ permalink raw reply

* Re: AC Power handling broken for desktops
From: Olaf Hering @ 2005-08-25  5:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1124946481.7906.8.camel@gaston>

 On Thu, Aug 25, Benjamin Herrenschmidt wrote:

> Not sure :) I don't fully know how to decode those power things in the
> device-tree... There are bits in darwin tho.

Maybe just check for !PowerBook and force PMU_PWR_AC_PRESENT in this case.

^ permalink raw reply

* Re: AC Power handling broken for desktops
From: Benjamin Herrenschmidt @ 2005-08-25  5:34 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev
In-Reply-To: <20050825051528.GB19792@suse.de>

On Thu, 2005-08-25 at 07:15 +0200, Olaf Hering wrote:
>  On Thu, Aug 25, Benjamin Herrenschmidt wrote:
> 
> > Not sure :) I don't fully know how to decode those power things in the
> > device-tree... There are bits in darwin tho.
> 
> Maybe just check for !PowerBook and force PMU_PWR_AC_PRESENT in this case.

Yah, you can check that with pmac_feature, there is a "mobile" flag.

Ben

^ permalink raw reply

* Re: Source of xparameter_ml300.h
From: Grant Likely @ 2005-08-25  6:24 UTC (permalink / raw)
  To: T Ziomek, linuxppc-embedded
In-Reply-To: <EDFB2B1ED0A1D7118A0A00065BF2490D1E3A601B@il06exm13>

On Wed, Aug 24, 2005 at 08:20:48PM -0500, T Ziomek wrote:
> On Wed, 24 Aug 2005 akonovalov@ru.mvista.com wrote:
> >
> >Grant Likely wrote:
> >But if you are speaking about the xparameters_ml300.h in the community
> >trees (linuxppc-2.4 and the 2.6 one from kernel.org), this file
> >is for the reference design by Xilinx:
> >
> >http://www.xilinx.com/ise/embedded/edk6_2docs/ml300_edk3.zip
> 
> Also, be aware that the differences between 'xparameters.h' and
> 'xparameters_ml300.h' are not all you need to worry about.
> 
> 
> MontaVista's port to the ML300 also modified various Xilinx driver source
> files (the code that appears under .../ppc405_0/include and
> .../ppc405_0/libsrc, at least for me).
>    Starting with MV's port to the ML300, you need to figure out which IP
> versions it was created for (for example, "emac_v1_00_b").  Then you need
> to compare that with the IP version used in your system [NOTE 1].  They'll
> probably be different, so then you need to either merge MV's changes into
> the newer Xilinx code or Xilinx's changes into the MV-modified drivers.
> This leaves you with software drivers that match the IP and have the chang-
> es needed to work in Linux.
Ah, yes.  I was wondering how much grief I would be dealing with in that
regard.  One of my goals is to get somewhat flexable drivers for basic
cores into mainline, so I'm sure I'll be fighting with this.
> 
>    It also looks like the Xilinx software driver bugs that MV found were
> not reported to Xilinx but just worked around, so those bugs are probably
> still present in your design.  They were in ours...
Thank's for the heads up.  Your email addr's getting a permanent place
in my address book.  :)

> 
> 
> NOTE 1:  And don't depend on Xilinx's rev numbers changing when their dri-
>          ver code does.  I regularly run across situations where consecu-
>          tive FPGA designs both use, say, the "gpio_v2_00_a" IP and driver
>          yet the driver code has changed.  It is important that you 'diff'
>          or whatever all of the driver code for changes each time you re-
>          ceive a new FPGA design generated from an XPS with *any* changes
>          at all (new version, patches, etc.), even if it appears that the
>          patch should not affect any driver code.
Hmm, lovely.

> 
> 
> In the end, MV's port of Linux is to an ML300 with an old reference design
> (even though the ML300 *board* hasn't changed, if that's true).  You're
> presumably using more current Xilinx tools and IP, so you'll have to update
> the port.  And you'll probably have to do so repeatedly.
Ai, I expect so.

IMHO the mainline code should be as simple as possible to adapt to new
boards and their associated xparameters.h.  I've created an xparameters
'abstraction layer' that keeps changes to the board more or less
isolated to the platform bus initialization data structures.  It also
prevents having to recompile the world everytime I use a different
bitstream.  However, that doesn't solve the changes to logic cores (as
you so eloquently pointed out).  At the very least I'd like to get a set
of core drivers ported/written that use #defs to adapt to the
appropriate core version.  I'll never be able to support every core
version, but I should be able to support a number of the more recent
cores.

The difficulty that I have with the current port is that there is still
a fair bit of work to adapt from one xparameters to another.

There is a very real possibilty that I'll be taking on
lots of v2pro work in the near future and I'd like to have a comfortable
foundation to start from.
> 
> 
> It's analagous to MV porting to the [non-FPGA] Acme RealCool rev A board
> while you're starting with the RealCool rev C and moving to revs D, E,
> etc. every few weeks or months.
>    This -- the relatively rapid change of FPGA 'hardware' compared to the
> typically much slower changes to a board -- is a fundamental difference be-
> tween FPGA and non-FPGA-based systems that you have to deal with.  I'm not
> sure MV fully comprehends the consequences of that; if they did I would ex-
> pect their port to document what specific IP versions it works with (not to
> mention what functionality wasn't ported, but that applies to non-FPGA
> hardware as well).
indeed

> 
> Of course, even if they did that we'd still have to suffer Xilinx's tenden-
> cy to release multiple versions of things without changing their rev num-
> bers  :-(
Yes, but we keep coming back because we love it.

s/love it/gluttons for punishment/
> 
> 
> I've been where you're going...
I feel a great sense of foreboding in that remark...  Thanks for the
long response; good info.

Did you use a 2.4 or 2.6 kernel in your work?  Are your driver changes
available for download anywhere?

Thanks,
g.

^ permalink raw reply

* Re: How to build an image for whole flash
From: Wolfgang Denk @ 2005-08-25  7:28 UTC (permalink / raw)
  To: JohnsonCheng; +Cc: linuxppc-embedded
In-Reply-To: <20050825032128.D90A368110@ozlabs.org>

In message <20050825032128.D90A368110@ozlabs.org> you wrote:
>
> My flash is 16M that is mapping on 0xFF000000-0xFFFFFFFF.
> mtd0: 0xFF000000-0xFF1FFFFF      Kernel
> mtd1: 0xFF200000-0xFF9FFFFF      RootFS
> mtd2: 0xFFA00000-0xFFAFFFFF       Config
> mtd3: 0xFFF00000-0xFFFFFFFF      U-Boot
> 
> Now I can build an image for mtd device, for example, dd if=/dev/mtd0
> of=kernel.img.

If you want to copy the image to flash, you got the parameters wrong,
i. e. you must use

	dd if=kernel.img of=/dev/mtd0

(after erasing /dev/mtd0, of course); and using some bs=  option  may
speed up the prcedure a bit, too.

> But I don't know how to build a image for whole flash ? 

What do you mean "for the whole flash"? If you cant to combine the  4
images  into  one big blob you can do so by (1) padding the images to
the full size of each partition; this can be done  using  appropriate
"bs=",   "count="   and   "conv=sync"   parameters  to  dd;  and  (2)
concatenating the images using "cat".

But this is a prtty inefficient way, and you will also have to change
your MTD partitioning to provide a big  partition  which  covers  the
whole flash.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Some people march to the beat of a different drummer. And some people
tango!

^ permalink raw reply

* I2C STOP condition on MPC8245
From: Daniel Ann @ 2005-08-25  7:38 UTC (permalink / raw)
  To: linuxppc-embedded

Hi folks,

Just wondering, if anyone tried i2c multi-master using mpc8245 with
kernel 2.6.x.
Thing is, version of kernel doesnt really matter, since I only have
problem getting mpc8245 to detect STOP condition sent by the
atmega64(the other i2c device).

Not knowing I2C that much, Im curious to know if mpc8245 should raise
an interrupt if it detects STOP condition sent by the master device.

I have no problem with i2c communication if mpc8245 is master, but
only when mpc8245 acts as slave, I cant detect the end of transfer.

If mpc8245 doesnt raise an interrupt when it detect STOP condition,
then how should program running on mpc8245 to know when to stop
reading ?

--=20
Daniel

^ permalink raw reply

* [PATCH] ppc32: disable IBM405_ERR77 and IBM405_ERR51 workarounds for 405EP
From: Eugene Surovegin @ 2005-08-25  7:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-embedded

Disable IBM405_ERR77 and IBM405_ERR51 errata workarounds for 405EP. 
This chip has these problems fixed.

Signed-off-by: Eugene Surovegin <ebs@ebshome.net>

diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -152,13 +152,13 @@ config IBM440EP_ERR42
 # All 405-based cores up until the 405GPR and 405EP have this errata.
 config IBM405_ERR77
 	bool
-	depends on 40x && !403GCX && !405GPR
+	depends on 40x && !403GCX && !405GPR && !405EP
 	default y
 
 # All 40x-based cores, up until the 405GPR and 405EP have this errata.
 config IBM405_ERR51
 	bool
-	depends on 40x && !405GPR
+	depends on 40x && !405GPR && !405EP
 	default y
 
 config BOOKE

^ permalink raw reply

* RE: How to build an image for whole flash
From: JohnsonCheng @ 2005-08-25 10:00 UTC (permalink / raw)
  To: wd; +Cc: linuxppc-embedded
In-Reply-To: <20050825072853.99657352674@atlas.denx.de>

Yes. I add a MTD partition which include whole flash as following:
mtd0: 0xFF000000-0xFF1FFFFF      Kernel
mtd1: 0xFF200000-0xFF9FFFFF      RootFS
mtd2: 0xFFA00000-0xFFAFFFFF      Config
mtd3: 0xFFF00000-0xFFFFFFFF      U-Boot
mtd4: 0xFF000000-0xFFFFFFFF      Flash

then "dd if=/dev/mtd4 of=flash.img".
Bu t I think it's not a good idea.

Thanks,
Johnson Cheng

-----Original Message-----
From: wd@denx.de [mailto:wd@denx.de] 
Sent: Thursday, August 25, 2005 3:29 PM
To: JohnsonCheng
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: How to build an image for whole flash 

In message <20050825032128.D90A368110@ozlabs.org> you wrote:
>
> My flash is 16M that is mapping on 0xFF000000-0xFFFFFFFF.
> mtd0: 0xFF000000-0xFF1FFFFF      Kernel
> mtd1: 0xFF200000-0xFF9FFFFF      RootFS
> mtd2: 0xFFA00000-0xFFAFFFFF       Config
> mtd3: 0xFFF00000-0xFFFFFFFF      U-Boot
> 
> Now I can build an image for mtd device, for example, dd if=/dev/mtd0
> of=kernel.img.

If you want to copy the image to flash, you got the parameters wrong,
i. e. you must use

	dd if=kernel.img of=/dev/mtd0

(after erasing /dev/mtd0, of course); and using some bs=  option  may
speed up the prcedure a bit, too.

> But I don't know how to build a image for whole flash ? 

What do you mean "for the whole flash"? If you cant to combine the  4
images  into  one big blob you can do so by (1) padding the images to
the full size of each partition; this can be done  using  appropriate
"bs=",   "count="   and   "conv=sync"   parameters  to  dd;  and  (2)
concatenating the images using "cat".

But this is a prtty inefficient way, and you will also have to change
your MTD partitioning to provide a big  partition  which  covers  the
whole flash.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Some people march to the beat of a different drummer. And some people
tango!

^ permalink raw reply

* COP Status 0x21
From: Andrew Williams @ 2005-08-25 14:38 UTC (permalink / raw)
  To: linuxppc-embedded

Hello List..
  (hope this is considered "on" topic)

   Situation: New hardware (mcp8347)
              BDI connected, but unable to read PVR
              Prior to the READ I see a "COP status is 0x21"
       =20
   Q. What does a status of 0x21 mean?=20

   Q. I've searched online for some type of a reference to the=20
      COP interface to no avail. Can anyone direct me to=20
      a technical reference?=20


Thanks,
Andrew

-- BDI Config [TARGET] section --
[TARGET]
CPUTYPE     8349                        ;the CPU type
JTAGCLOCK   0                           ;use 16 MHz JTAG clock
BOOTADDR    0xfff00100                  ;boot address used for start-up
break
POWERUP     2000                        ;start delay after power-up
detected in ms
WAKEUP      800                         ;give reset time to complete
STARTUP     RESET                       ;halt immediatelly at the boot
vector
BREAKMODE   HARD                        ;SOFT or HARD, HARD uses PPC
hardware breakpoint
STEPMODE    HWBP                        ;TRACE or HWBP, HWBP uses a
hardware breakpoint


-- BDI Debug Output --
- TARGET: waiting for target Vcc
- TARGET: processing power-up delay
- TARGET: processing user reset request
- BDI asserts HRESET
- Reset JTAG controller passed
- Bypass check: 0x00000001 =3D> 0x00000001
- Bypass check: 0x00000001 =3D> 0x00000001
- JTAG exists check passed
- COP status is 0x21
- Check running state passed
- BDI scans COP freeze command
- BDI removes HRESET
- Target PVR is 0x00000000
- This PVR is not supported
- TARGET: Target PVR is 0x00000000
*** TARGET: resetting target failed
# PPC: This target is not supported
- TARGET: target will be restarted in 10 sec

^ permalink raw reply

* Re: AC Power handling broken for desktops
From: Segher Boessenkool @ 2005-08-25 15:10 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev
In-Reply-To: <20050825051528.GB19792@suse.de>

>> Not sure :) I don't fully know how to decode those power things in the
>> device-tree... There are bits in darwin tho.
>
> Maybe just check for !PowerBook and force PMU_PWR_AC_PRESENT in this 
> case.

Or just if battery count is 0, assume AC power ;-)


Segher

^ permalink raw reply

* RE: COP Status 0x21
From: Andrew Williams @ 2005-08-25 15:19 UTC (permalink / raw)
  To: linuxppc-embedded

<insert favorite curses here>

  Spend 6 hours searching, draft an email to the list, and solve=20
problem 20 minutes later. Compared my BDI to a co-workers and=20
and discovered that although we had the same firmware, we didn't have=20
the same "Logic" version in the device. Reflashed and I can=20
now read the PVR correctly.

  Sorry to waste everyone's time on this.

Andrew

  =20

> -----Original Message-----
> From: linuxppc-embedded-bounces@ozlabs.org=20
> [mailto:linuxppc-embedded-bounces@ozlabs.org] On Behalf Of=20
> Williams, Andrew [CAR:9D30:EXCH]
> Sent: August 25, 2005 10:38 AM
> To: linuxppc-embedded@ozlabs.org
> Subject: COP Status 0x21
>=20
>=20
> Hello List..
>   (hope this is considered "on" topic)
>=20
>    Situation: New hardware (mcp8347)
>               BDI connected, but unable to read PVR
>               Prior to the READ I see a "COP status is 0x21"
>        =20
>    Q. What does a status of 0x21 mean?=20
>=20
>    Q. I've searched online for some type of a reference to the=20
>       COP interface to no avail. Can anyone direct me to=20
>       a technical reference?=20
>=20
>=20
> Thanks,
> Andrew
>=20
> -- BDI Config [TARGET] section --
> [TARGET]
> CPUTYPE     8349                        ;the CPU type
> JTAGCLOCK   0                           ;use 16 MHz JTAG clock
> BOOTADDR    0xfff00100                  ;boot address used=20
> for start-up
> break
> POWERUP     2000                        ;start delay after power-up
> detected in ms
> WAKEUP      800                         ;give reset time to complete
> STARTUP     RESET                       ;halt immediatelly at the boot
> vector
> BREAKMODE   HARD                        ;SOFT or HARD, HARD uses PPC
> hardware breakpoint
> STEPMODE    HWBP                        ;TRACE or HWBP, HWBP uses a
> hardware breakpoint
>=20
>=20
> -- BDI Debug Output --
> - TARGET: waiting for target Vcc
> - TARGET: processing power-up delay
> - TARGET: processing user reset request
> - BDI asserts HRESET
> - Reset JTAG controller passed
> - Bypass check: 0x00000001 =3D> 0x00000001
> - Bypass check: 0x00000001 =3D> 0x00000001
> - JTAG exists check passed
> - COP status is 0x21
> - Check running state passed
> - BDI scans COP freeze command
> - BDI removes HRESET
> - Target PVR is 0x00000000
> - This PVR is not supported
> - TARGET: Target PVR is 0x00000000
> *** TARGET: resetting target failed
> # PPC: This target is not supported
> - TARGET: target will be restarted in 10 sec=20
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org=20
> https://ozlabs.org/mailman/listinfo/linuxppc-> embedded
>=20
>=20

^ permalink raw reply

* Re: COP Status 0x21
From: Grant Likely @ 2005-08-25 16:18 UTC (permalink / raw)
  To: Andrew Williams, linuxppc-embedded
In-Reply-To: <713043CE8B8E1348AF3C546DBE02C1B4049162C5@zcarhxm2.corp.nortel.com>

On Thu, Aug 25, 2005 at 11:19:31AM -0400, Andrew Williams wrote:
> <insert favorite curses here>
> 
>   Spend 6 hours searching, draft an email to the list, and solve 
> problem 20 minutes later. Compared my BDI to a co-workers and 
> and discovered that although we had the same firmware, we didn't have 
> the same "Logic" version in the device. Reflashed and I can 
> now read the PVR correctly.
> 
>   Sorry to waste everyone's time on this.
Ah, but the next person to have this problem (should) find your post
when they search.  :)

^ permalink raw reply

* Re: Source of xparameter_ml300.h
From: T Ziomek @ 2005-08-25 22:17 UTC (permalink / raw)
  To: Grant Likely; +Cc: T Ziomek, linuxppc-embedded
In-Reply-To: <20050825062425.GA5607@siegfried.thelikelysolution.ca>

On Thu, 25 Aug 2005, Grant Likely wrote:
> On Wed, Aug 24, 2005 at 08:20:48PM -0500, T Ziomek wrote:
>>
>> Also, be aware that the differences between 'xparameters.h' and
>> 'xparameters_ml300.h' are not all you need to worry about.

BTW, I took a approach different from MV's for 'xparameters.h'.  Seeing no
reason why that file *had* to be changed for Linux (and because the folks
doing the Xilinx hardware releases I use only use the 'standalone' BSP and
hence never run that Tcl script), I instead added a 'linux.xparameters.h'
file.  This file first includes 'xparameters.h' and then #defs all of the
Linux-specific stuff.
    Then I changed all Linux #includes of 'xparameters.h' to pull in my new
file instead.

My 'linux.xparameters.h' hasn't changed since I created it Feb. 2, though
I've worked with a dozen or more 'xparameters.h' files in that time.

IMO, this two files approach is better all-around, with better separation
of concerns and no Tcl script.

>>    Starting with MV's port to the ML300, you need to figure out which IP
>> versions it was created for (for example, "emac_v1_00_b").  Then you need
>> to compare that with the IP version used in your system [NOTE 1].  They'll
>> probably be different, so then you need to either merge MV's changes into
>> the newer Xilinx code or Xilinx's changes into the MV-modified drivers.
>> This leaves you with software drivers that match the IP and have the chang-
>> es needed to work in Linux.
>
> Ah, yes.  I was wondering how much grief I would be dealing with in that
> regard.  One of my goals is to get somewhat flexable drivers for basic
> cores into mainline, so I'm sure I'll be fighting with this.

I keep wanting to implement a "2 files" approach like that above for the
driver files.  It's not as simple to do, and so far I keep enduring the
periodic hack session rather than investing time looking for a better solu-
tion.

Oh yeah, another minor type of change I had to deal with -- in cases where
a peripheral is on a different bus between the ML300 and our board I had to
make changes such as "OPB" -> "PLB".  No big deal there, though I wonder if
it should really be necessary.  Does Xilinx IP have significant bus-specific
differences (e.g. OPB EMAC vs. PLB EMAC)?  I wouldn't expect so...

>>    It also looks like the Xilinx software driver bugs that MV found were
>> not reported to Xilinx but just worked around, so those bugs are probably
>> still present in your design.  They were in ours...
> Thank's for the heads up.  Your email addr's getting a permanent place
> in my address book.  :)

:-(

Just kidding; I've been meaning for months now to put this stuff out on the
maillist (partly because I'm way overdue on "giving back" and partly to see
if I was missing some obvious Easy Way).

>> NOTE 1:  And don't depend on Xilinx's rev numbers changing when their dri-
>>          ver code does.  I regularly run across situations where consecu-
>>          tive FPGA designs both use, say, the "gpio_v2_00_a" IP and driver
>>          yet the driver code has changed.  It is important that you 'diff'
>>          or whatever all of the driver code for changes each time you re-
>>          ceive a new FPGA design generated from an XPS with *any* changes
>>          at all (new version, patches, etc.), even if it appears that the
>>          patch should not affect any driver code.
> Hmm, lovely.

Don't get me started...

> IMHO the mainline code should be as simple as possible to adapt to new
> boards and their associated xparameters.h.  I've created an xparameters
> 'abstraction layer' that keeps changes to the board more or less
> isolated to the platform bus initialization data structures.  It also
> prevents having to recompile the world everytime I use a different
> bitstream.  However, that doesn't solve the changes to logic cores (as
> you so eloquently pointed out).  At the very least I'd like to get a set
> of core drivers ported/written that use #defs to adapt to the
> appropriate core version.  I'll never be able to support every core
> version, but I should be able to support a number of the more recent
> cores.
>
> The difficulty that I have with the current port is that there is still
> a fair bit of work to adapt from one xparameters to another.
>
> There is a very real possibilty that I'll be taking on
> lots of v2pro work in the near future and I'd like to have a comfortable
> foundation to start from.

Exactly what I keep wanting to do.  I expect you'll be glad you have it.

One thing I *did* do was completely remove Xilinx-sourced files (or files
based on Xilinx-supplied code) from the kernel tree.  So things like
.../arch/ppc/platforms/xilinx_ocp and .../drivers/net/xilinx_enet/x* are not
used at all.  In my thinking that stuff doesn't belong in the kernel tree
because it changes so often (again, the board vs. FPGA issue) (and I fully
expect to get re-educated, because I really don't know enough to spout off
about what should or shouldn't be in the kernel tree).
    I did of course have to change Makefiles and the like to pull the neces-
sary headers and C from my (external to the kernel tree) 'ppc405_0' dir.
And it's not a complete solution; my ppc405_0 tree isn't accounted for when
Linux builds all of its dependencies so I have to remember when to delete
a certain subtree's *.[oa] files to force rebuilds.
    Being a one-man band in a research group it works okay for me, but with-
out more work it certainly isn't scalable to a large team and wouldn't be
appropriate for product development.

>> I've been where you're going...
> I feel a great sense of foreboding in that remark...  Thanks for the
> long response; good info.
>
> Did you use a 2.4 or 2.6 kernel in your work?  Are your driver changes
> available for download anywhere?

So far we're using MV Pro 3.1, which is based on a 2.4 kernel.  Pro 4.0 is
2.6 based and starting to become available; I haven't yet checked on the
PPC405 / ML300 port.

Working for A Big Corporation, I can't easily get my changes onto an FTP
site.  I'll provide them on request instead, but note that I'll be out of
the office this Friday.  Plus I'll have to doublecheck them for the proper
copyright & licensing notices.  But still, next week should be no problem.

The files I've been modifying are
.../include/xbasic_types.h
.../include/xdma_channel.h  [1]
.../include/xemac.h  [1]
.../libsrc/dma_v*/src/xdma_channel_sg.c
.../libsrc/emac_v*/src/xemac.c
.../libsrc/emac_v*/src/xemac_g.c
.../libsrc/emac_v*/src/xemac_intr_dma.c

[1] : Since these two are duplicated within the driver tree (another peeve
       of mine), I also delete .../libsrc/dma_v*/src/xdma_channel.h and
       .../libsrc/emac_v*/src/xemac.h to avoid having to make the same
       changes twice.

Descriptions of the specific changes made follow.  I believe all but the
first are just re-applying changes MV made in their port to Linux.

.../include/xbasic_types.h
     Make 'Xuint32' and 'Xint32' 'int's rather than 'long's.

.../include/xdma_channel.h
     Add 'VirtPtr' and 'PhyPtr' elements to 'XDmaChannel' struct.
     Add 'PhyPtr' arg to XDmaChannel_CreateSgList()'s signature.

.../include/xemac.h
     Add 'PhysAddress' element to 'XEmac_Config' and 'XEmac' structs.
     Add 'PhyPtr' arg to XEmac_SetSgRecvSpace()'s and XEmac_SetSgSendSpace()'s
           signatures.

.../libsrc/dma_v*/src/xdma_channel_sg.c
     Add P_TO_V() and V_TO_P() macros.
     Add 'PhyPtr' arg to XDmaChannel_CreateSgList() and add setting of
     'InstancePtr's 'VirtPtr' and 'PhyPtr' fields.

.../libsrc/emac_v*/src/xemac.c
     Add setting of 'InstancePtr's 'PhysAddress' field in XEmac_Initialize().

.../libsrc/emac_v*/src/xemac_g.c
     Init 'XYZ' struct's new 'PhysAddress' element.

.../libsrc/emac_v*/src/xemac_intr_dma.c
     Pass 'PhysAddress' rather than 'BaseAddress' to XBufDescriptor_SetDestAd-
           dress() in XEmac_SgSend()
     Pass 'PhysAddress' rather than 'BaseAddress' to XBufDescriptor_SetSrcAd-
           dress() in XEmac_SgRecv().
     Add 'PhyPtr' arg to XEmac_SetSgRecvSpace() and pass it to XDmaChannel_Cre-
           ateSgList().
     Add 'PhyPtr' arg to XEmac_SetSgSendSpace() and pass it to XDmaChannel_Cre-
           ateSgList().

Looking at my archived of hacked ppc405_0 trees it looks like I have the
following hacked driver directories:  dma_v1_00_a, emac_v1_00_e, emac_v1_00_f
and emac_v2_00_c .  Of course there's no certainty one 'dma_v1_00_a' is the
same as another...

That's it, for now.
Tom

-- 
   /"\  ASCII Ribbon Campaign   |   Email to user 'CTZ001'
   \ /                          |             at 'email.mot.com'
    X        Against HTML       |
   / \     in e-mail & news     |

^ permalink raw reply

* Re: Source of xparameter_ml300.h
From: Grant Likely @ 2005-08-25 23:02 UTC (permalink / raw)
  To: T Ziomek; +Cc: T Ziomek, linuxppc-embedded
In-Reply-To: <Pine.WNT.4.61.0508251610280.2688@holyoke.labs.mot.com>

On Thu, Aug 25, 2005 at 05:17:16PM -0500, T Ziomek wrote:
> On Thu, 25 Aug 2005, Grant Likely wrote:
> >On Wed, Aug 24, 2005 at 08:20:48PM -0500, T Ziomek wrote:
> >>
> >>Also, be aware that the differences between 'xparameters.h' and
> >>'xparameters_ml300.h' are not all you need to worry about.
> 
> BTW, I took a approach different from MV's for 'xparameters.h'.  Seeing no
> reason why that file *had* to be changed for Linux (and because the folks
> doing the Xilinx hardware releases I use only use the 'standalone' BSP and
> hence never run that Tcl script), I instead added a 'linux.xparameters.h'
> file.  This file first includes 'xparameters.h' and then #defs all of the
> Linux-specific stuff.
>    Then I changed all Linux #includes of 'xparameters.h' to pull in my new
> file instead.
> 
> My 'linux.xparameters.h' hasn't changed since I created it Feb. 2, though
> I've worked with a dozen or more 'xparameters.h' files in that time.
> 
> IMO, this two files approach is better all-around, with better separation
> of concerns and no Tcl script.
Yes!  My opinion exactly.  I'm doing pretty close to the same thing.  

> 
> [Lots of really great info snipped]
>
> >Thank's for the heads up.  Your email addr's getting a permanent place
> >in my address book.  :)
> 
> :-(
:P

> 
> Just kidding; I've been meaning for months now to put this stuff out on the
> maillist (partly because I'm way overdue on "giving back" and partly to see
> if I was missing some obvious Easy Way).
I'm going to be off work for the next 13 weeks (hooray!) on parental
leave.  In that time I plan to get a bunch of this stuff cleaned up and
submitted to mainline.  If you send me your patches then I'll get them
included in my tree.  If it's too big to email then I'll setup a
location that you can scp it to.

That way we can both get credit
s/credit/blaimed/

:)

> [Lots more really great stuff snipped]
> 
> That's it, for now.
> Tom
You rock!  Thanks for the help.  I'm particularly interested in seeing
you linux.xparameters.h.

Cheers,
g.

^ permalink raw reply

* rebuild net-snmp 5.0.6 from eldk 3.1.1
From: 徐小威的EMAIL @ 2005-08-26  0:48 UTC (permalink / raw)
  To: linuxppc-embedded

Hi All:

    Anybody know how to setting fedora linux 3 environment to cross
compile netsnmp 5.0.6
contain in the eldk 3.1.1.

   I'v try to modify net-snmp.spec for using pcc_8xx-gcc, but still got
probems.

[root@banana SPECS]# ppc_8xx-rpmbuild -ba --with ee net-snmp.spec
Executing(%prep): /bin/sh -e /opt/eldk/var/tmp/rpm-tmp.4936
+ umask 022
+ cd /opt/eldk/usr/src/denx/BUILD
+ cd /opt/eldk/usr/src/denx/BUILD
+ rm -rf net-snmp-5.0.6
+ /bin/gzip -dc /opt/eldk/usr/src/denx/SOURCES/net-snmp-5.0.6.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd net-snmp-5.0.6
+ echo 'Patch #9 (net-snmp-5.0.1-initializer.patch):'
Patch #9 (net-snmp-5.0.1-initializer.patch):
+ patch -p1 -b --suffix .initializer -s
+ echo 'Patch #10 (net-snmp-5.0.1-nolibelf.patch):'
Patch #10 (net-snmp-5.0.1-nolibelf.patch):
+ patch -p1 -b --suffix .nolibelf -s
+ echo 'Patch #11 (net-snmp-5.0.6-syslog.patch):'
Patch #11 (net-snmp-5.0.6-syslog.patch):
+ patch -p1 -b --suffix .syslog -s
+ echo 'Patch #12 (net-snmp-5.0.6-nodb.patch):'
Patch #12 (net-snmp-5.0.6-nodb.patch):
+ patch -p1 -b --suffix .nodb -s
+ echo 'Patch #13 (net-snmp-5.0.6-compat.patch):'
Patch #13 (net-snmp-5.0.6-compat.patch):
+ patch -p1 -b --suffix .compat -s
+ echo 'Patch #14 (net-snmp-5.0.6-smux.patch):'
Patch #14 (net-snmp-5.0.6-smux.patch):
+ patch -p1 -b --suffix .smux -s
+ echo 'Patch #15 (net-snmp-5.0.6-libtool.patch):'
Patch #15 (net-snmp-5.0.6-libtool.patch):
+ patch -p1 -b --suffix .libtool -s
+ echo 'Patch #16 (net-snmp-5.0.6-smux_pktsz_err_rpt.patch):'
Patch #16 (net-snmp-5.0.6-smux_pktsz_err_rpt.patch):
+ patch -p1 -b --suffix .smux_pktsz_err_rpt -s
+ perl -pi -e 's|'\''\$install_libdir'\''|'\''/usr/lib'\''|' ltmain.sh
+ exit 0
Executing(%build): /bin/sh -e /opt/eldk/var/tmp/rpm-tmp.96354
+ umask 022
+ cd /opt/eldk/usr/src/denx/BUILD
+ cd net-snmp-5.0.6
+ endianess=little
+ endianess=big
+ CFLAGS='-O2 -g -fsigned-char'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -fsigned-char'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -fsigned-char'
+ export FFLAGS
+ ./configure --host=i386-pc-linux-gnu --build=i386-pc-linux-gnu --
target=ppc-denx-linux --program-prefix= --prefix=/usr --exec-prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --
datadir=/usr/share --includedir=/usr/include/net-snmp --libdir=/usr/lib
--libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com
--mandir=/usr/share/man --infodir=/usr/share/info --host=ee --enable-
static --enable-shared --with-cc=/opt/eldk/usr/bin/ppc_8xx-gcc --with-
ar=/opt/eldk/usr/bin/ppc_8xx-ar '--with-cflags=-O2 -g -fsigned-char' --
with-sys-location=Unknown --with-logfile=/var/log/snmpd.log --with-
persistent-directory=/var/net-snmp '--with-mib-modules=host agentx smux'
--with-libwrap=/usr/lib --sysconfdir=/etc --enable-ipv6 --enable-ucd-
snmp-compatibility --with-endianness=big --disable-debugging --enable-
mini-agent --with-default-snmp-version=2 --with-sys-
contact=root@localhost
creating cache ./config.cache
using default enterprise.net-snmp
using default enterprise sysOID NET-SNMP-MIB::netSnmpAgentOIDs...
using default notifications NET-SNMP-MIB::netSnmpNotifications
checking if I need to feed myself to ksh... no
checking for gcc... /opt/eldk/usr/bin/ppc_8xx-gcc
checking whether the C compiler (/opt/eldk/usr/bin/ppc_8xx-gcc -O2 -g -
fsigned-char ) works... yes
checking whether the C compiler (/opt/eldk/usr/bin/ppc_8xx-gcc -O2 -g -
fsigned-char ) is a cross-compiler... yes
checking whether we are using GNU C... yes
checking whether /opt/eldk/usr/bin/ppc_8xx-gcc accepts -g... yes
checking how to run the C preprocessor... /opt/eldk/usr/bin/ppc_8xx-gcc
-E
checking for AIX... no
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for executable suffix... no
checking host system type... Invalid configuration `ee': machine `ee'
not recognized

checking build system type... i386-pc-linux-gnu
checking for ld used by GCC... /opt/eldk/usr/ppc-linux/bin/ld
checking if the linker (/opt/eldk/usr/ppc-linux/bin/ld) is GNU ld... yes
checking for /opt/eldk/usr/ppc-linux/bin/ld option to reload object
files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependant libraries... unknown
checking for object suffix... o
./configure: line 2477: test: !=: unary operator expected
checking command to parse /usr/bin/nm -B output... ok
checking for dlfcn.h... yes
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for /opt/eldk/usr/bin/ppc_8xx-gcc option to produce PIC... -
fPIC
checking if /opt/eldk/usr/bin/ppc_8xx-gcc PIC flag -fPIC works... yes
checking if /opt/eldk/usr/bin/ppc_8xx-gcc static flag -static works...
yes
checking if /opt/eldk/usr/bin/ppc_8xx-gcc supports -c -o file.o... yes
checking if /opt/eldk/usr/bin/ppc_8xx-gcc supports -c -o file.lo...
checking if /opt/eldk/usr/bin/ppc_8xx-gcc supports -fno-rtti -fno-
exceptions... yes
checking whether the linker (/opt/eldk/usr/ppc-linux/bin/ld) supports
shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... no
checking if libtool supports shared libraries... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... cross
checking whether -lc should be explicitly linked in... no
creating libtool
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln -s works... (cached) yes
checking whether make sets ${MAKE}... yes
checking for ps... /bin/ps
checking for perl... /usr/bin/perl
checking for whoami... whoami
checking for sed... sed
checking for autoconf... no
checking for autoheader... no
checking for uname... /bin/uname
checking for working const... yes
checking for inline... inline
checking for net-snmp version number... 5.0.6
checking for developer gcc flags... none
checking host system type... config.sub: missing argument
Try `config.sub --help' for more information.

checking target system type... powerpc-denx-linux-gnu
checking build system type... i386-pc-linux-gnu
checking for system include file... net-snmp/system/linux.h
checking for machine-type include file... net-snmp/machine/generic.h
checking for /opt/eldk/usr/bin/ppc_8xx-gcc... no
checking for additional cpp flags... -x c
checking ipv6 stack type... linux-glibc, yes, using libc
checking whether we have to build PIC code... no
checking for and configuring transport modules to use...  Callback Unix
TCP UDP TCPIPv6 UDPIPv6.
checking for security modules to use...  usm
checking for and configuring mib modules to use...  snmpv3mibs
mibII/snmp_mib mibII/system_mib mibII/sysORTable examples/ucdDemoPublic
mibII/vacm_vars host agentx smux mibII/ipv6.
checking for and configuring mib modules pieces to use...  snmpv3mibs
mibII/snmp_mib mibII/system_mib mibII/sysORTable examples/ucdDemoPublic
mibII/vacm_vars host agentx smux mibII/ipv6 snmpv3/snmpEngine
snmpv3/snmpMPDStats snmpv3/usmStats snmpv3/usmUser util_funcs
mibII/vacm_context host/hr_system host/hr_storage host/hr_device
host/hr_other host/hr_proc host/hr_network host/hr_print host/hr_disk
host/hr_partition host/hr_filesys host/hr_swrun host/hr_swinst
agentx/master agentx/subagent smux/smux mibII/interfaces mibII/at
mibII/var_route mibII/route_write ucd-snmp/loadave agentx/protocol
agentx/client agentx/master_admin agentx/agentx_config mibII/ip
mibII/kernel_linux mibII/ipAddr.
checking if directories need to be created... .
checking default mib files to read... SNMPv2-MIB:RFC1213-MIB:SNMP-VIEW-
BASED-ACM-MIB:SNMP-COMMUNITY-MIB:HOST-RESOURCES-MIB:HOST-RESOURCES-
TYPES:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:SNMP-FRAMEWORK-
MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB
checking for location of system kernel... unknown
checking for mount table location... /etc/mtab
checking for location of swap device... none
checking for asin in -lm... yes
checking for gethostbyname... yes
checking for getservbyname... yes
checking for kstat_lookup in -lkstat... no
checking for nlist in -lmld... no
checking for EVP_md5 in -lcrypto... yes
checking for AES_cfb128_encrypt... yes
checking for tcpd.h... yes
checking for TCP wrappers library -lwrap... no
checking for yp_get_default_domain... no
checking for yp_get_default_domain in -lnsl... yes
checking for TCP wrappers library -lwrap linked with -lnsl... yes
checking for zlib.h... yes
checking for gzread in -lz... yes
checking for bzread in -lbz2... no
checking for BZ2_bzread in -lbz2... yes
checking for poptParseArgvString in -lpopt... yes
checking for Fopen in -lrpmio... yes
checking for rpmGetFilesystemList in -lrpm... no
checking for rpmdbOpen in -lrpmdb... no
checking for kvm_read in -lkvm... no
checking for dlopen in -ldl... (cached) yes
checking for kvm_openfiles... no
checking for nlist... no
checking for knlist... no
checking for kvm_getprocs... no
checking whether we need -ldevstat for diskio MIB... no
checking for ANSI C header files... yes
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for stdarg.h... yes
checking for string.h... yes
checking for fcntl.h... yes
checking for limits.h... yes
checking for sys/file.h... yes
checking for sys/ioctl.h... yes
checking for syslog.h... yes
checking for unistd.h... yes
checking for netinet/tcpip.h... no
checking for netinet/in.h... yes
checking for netinet/ip.h... yes
checking for netinet/ip_icmp.h... yes
checking for net/if.h... yes
checking for netdb.h... yes
checking for sys/dmap.h... no
checking for machine/pte.h... no
checking for xti.h... no
checking for sys/sockio.h... no
checking for sys/socket.h... yes
checking for sys/un.h... yes
checking for fstab.h... yes
checking for sys/fs.h... no
checking for mtab.h... no
checking for ufs/fs.h... no
checking for ufs/ffs/fs.h... no
checking for sys/fixpoint.h... no
checking for machine/param.h... no
checking for sys/vm.h... no
checking for vm/vm.h... no
checking for sys/vmmeter.h... no
checking for sys/vmparam.h... no
checking for sys/vmmac.h... no
checking for sys/vmsystm.h... no
checking for sys/mbuf.h... no
checking for sys/time.h... yes
checking for sys/swap.h... yes
checking for inet/mib2.h... no
checking for sys/statvfs.h... yes
checking for sys/vfs.h... yes
checking for sys/mnttab.h... no
checking for sys/user.h... yes
checking for sys/proc.h... no
checking for sys/select.h... yes
checking for mntent.h... yes
checking for sys/mntent.h... no
checking for kstat.h... no
checking for utsname.h... no
checking for sys/utsname.h... yes
checking for sys/cdefs.h... yes
checking for getopt.h... yes
checking for locale.h... yes
checking for pthread.h... yes
checking for sys/loadavg.h... no
checking for regex.h... yes
checking for linux/tasks.h... no
checking for pwd.h... yes
checking for grp.h... yes
checking for utmpx.h... yes
checking for malloc.h... yes
checking for sys/param.h... yes
checking for net/if_dl.h... no
checking for sys/sysctl.h... yes
checking for stdlib.h... yes
checking for net/if_mib.h... no
checking for net/if_types.h... no
checking for net/if_var.h... no
checking for sys/queue.h... yes
checking for osreldate.h... no
checking for machine/types.h... no
checking for sys/socketvar.h... yes
checking for sys/conf.h... no
checking for netinet/in_systm.h... yes
checking for netinet/tcp.h... yes
checking for netinet/udp.h... yes
checking for netinet/in_var.h... no
checking for netinet/if_ether.h... yes
checking for netinet/ip_var.h... no
checking for netinet/tcp_timer.h... no
checking for netinet/tcp_var.h... no
checking for netinet/tcp_fsm.h... no
checking for netinet/udp_var.h... no
checking for netinet/icmp_var.h... no
checking for sys/protosw.h... no
checking for nlist.h... no
checking for ioctls.h... no
checking for asm/page.h... yes
checking for netipx/ipx.h... yes
checking for arpa/inet.h... yes
checking for kvm.h... no
checking for sys/pool.h... no
checking for uvm/uvm_param.h... no
checking for uvm/uvm_extern.h... no
checking for vm/vm_param.h... no
checking for vm/vm_extern.h... no
checking for sys/mount.h... yes
checking for vm/swap_pager.h... no
checking for ufs/ufs/dinode.h... no
checking for sys/stat.h... yes
checking for sys/vnode.h... no
checking for ufs/ufs/quota.h... no
checking for ufs/ufs/inode.h... no
checking for sys/hashing.h... no
checking for sys/tcpipstats.h... no
checking for sys/sysmp.h... no
checking for err.h... yes
checking for sys/filio.h... no
checking for sgtty.h... yes
checking for sys/statfs.h... yes
checking for net/route.h... yes
checking for sys/dkio.h... no
checking for sys/diskio.h... no
checking for sys/pstat.h... no
checking for linux/hdreg.h... yes
checking for pkglocs.h... no
checking for pkginfo.h... no
checking for winsock.h... no
checking for io.h... no
checking for sys/stream.h... no
checking for netinet/ip6.h... yes
checking for netinet6/in6_var.h... no
checking for netinet6/in6_pcb.h... no
checking for netinet6/ip6_var.h... no
checking for netinet6/tcp6.h... no
checking for netinet6/tcp6_fsm.h... no
checking for netinet6/nd6.h... no
checking for netinet6/tcp6_timer.h... no
checking for netinet6/tcp6_var.h... no
checking for dlfcn.h... (cached) yes
checking for search.h... yes
checking for rpmio.h... no
checking for rpm/rpmio.h... yes
checking for netinet/in_pcb.h... no
checking for sys/disklabel.h... no
checking for openssl/hmac.h... yes
checking for openssl/evp.h... yes
checking for openssl/aes.h... yes
checking for openssl/des.h... yes
checking for lpstat... /usr/bin/lpstat
checking for cgetnext... no
checking for authentication support... OpenSSL Support
checking for off_t... yes
checking for pid_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for socklen_t... yes
checking for in_addr_t... yes
checking for correct flags to ps...
checking for working alloca.h... yes
checking for alloca... yes
checking whether /opt/eldk/usr/bin/ppc_8xx-gcc needs -traditional... no
checking for 8-bit clean memcmp... no
checking return type of signal handlers... void
checking for getmntent in -lsun... no
checking for getmntent in -lseq... no
checking for getmntent in -lgen... no
checking for getmntent... yes
checking for setmntent... yes
checking for gethostname... yes
checking for uname... yes
checking for gettimeofday... yes
checking for select... yes
checking for socket... yes
checking for strtol... yes
checking for strtoul... yes
checking for strchr... yes
checking for strdup... yes
checking for memcpy... yes
checking for memmove... yes
checking for index... yes
checking for bcopy... yes
checking for strcasestr... yes
checking for regcomp... yes
checking for signal... yes
checking for setsid... yes
checking for sigset... yes
checking for sigblock... yes
checking for sighold... yes
checking for strerror... yes
checking for setenv... yes
checking for vsnprintf... yes
checking for snprintf... yes
checking for sigaction... yes
checking for snprintf... (cached) yes
checking for strtoul... (cached) yes
checking for random... yes
checking for lrand48... yes
checking for rand... yes
checking for execv... yes
checking for system... yes
checking for fork... yes
checking for getpid... yes
checking for strncasecmp... yes
checking for sigalrm... no
checking for rpmGetPath... no
checking for getloadavg... yes
checking for getaddrinfo... yes
checking for getipnodebyname... no
checking for statvfs... yes
checking for statfs... yes
checking for getdtablesize... yes
checking for getfsstat... no
checking for usleep... yes
checking for setlocale... yes
checking for tcgetattr... yes
checking for if_nameindex... yes
checking for if_freenameindex... yes
checking for getpagesize... yes
checking for dlopen... yes
checking for mkstemp... yes
checking for getpwnam... yes
checking for getgrnam... yes
checking for setgid... yes
checking for setuid... yes
checking for setgroups... yes
checking for setitimer... yes
checking for SIOCGIFADDR in sys/ioctl.h... yes
checking for two-argument statfs with struct fs_data (Ultrix)... no
checking if __FUNCTION__ is defined... yes
checking for sigaction.sa_sigaction... yes
checking for sockaddr.sa_len... no
checking for sockaddr.sa_union.sa_generic.sa_family2... no
checking for rtentry.rt_dst... yes
checking type of rtentry structure... Unknown
unknown
checking for struct rtentry... rtentry
checking for rtentry.rt_unit... no
checking for rtentry.rt_refcnt... no
checking for rtentry.rt_hash... no
checking for rtentry.rt_use... no
checking for tcpstat.tcp_rcvmemdrop... no
checking for ifnet.if_mtu... no
checking if _KERNEL needs to be defined for if_mtu... no
checking for ifaddr.ifa_next... yes
checking for ifnet.if_baudrate... no
checking for ifnet.if_baudrate.ifs_value... no
checking for ifnet.if_speed... yes
checking for ifnet.if_type... yes
checking for ifnet.if_imcasts... no
checking for ifnet.if_iqdrops... yes
checking for ifnet.if_noproto... no
checking for ifnet.if_omcasts... no
checking for ifnet.if_xname... no
checking for ifnet.if_lastchange.tv_sec... no
checking for ifnet.if_obytes... yes
checking for ifnet.if_ibytes... yes
checking for ifnet.if_addrlist... no
checking for ifnet.if_addrhead.tqh_first... no
checking for udpstat.udps_discard... no
checking for udpstat.udps_noport... no
checking for udpstat.udps_noportbcast... no
checking for udpstat.udps_fullsock... no
checking for arphd.at_next... no
checking for swdevt.sw_nblksenabled... no
checking for statvfs.f_frsize... yes
checking for statvfs.f_files... yes
checking for nlist.n_value... no
checking for ipstat.ips_cantforward... no
checking for ipstat.ips_cantfrag... no
checking for ipstat.ips_delivered... no
checking for ipstat.ips_fragdropped... no
checking for ipstat.ips_fragtimeout... no
checking for ipstat.ips_localout... no
checking for ipstat.ips_noproto... no
checking for ipstat.ips_noroute... no
checking for ipstat.ips_odropped... no
checking for ipstat.ips_ofragments... no
checking for ipstat.ips_reassembled... no
checking for des_ks_struct.weak_key... no
configure: warning: Can't check sysctl, manually define CAN_USE_SYSCTL
if platform support available
checking whether TCP timers depend on `hz'... no
checking Default version of SNMP to use... (cached) 2
checking System Contact Information... (cached) root@localhost
checking System Location... (cached) Unknown
checking Location to write logfile... (cached) /var/log/snmpd.log
checking Location to write persistent information... (cached) /var/net-
snmp
updating cache ./config.cache
creating ./config.status
creating Makefile
creating snmplib/Makefile
creating apps/Makefile
creating apps/snmpnetstat/Makefile
creating agent/Makefile
creating agent/helpers/Makefile
creating agent/mibgroup/Makefile
creating local/Makefile
creating testing/Makefile
creating man/Makefile
creating mibs/Makefile
creating net-snmp-config
creating include/net-snmp/net-snmp-config.h
+ make
/opt/eldk/usr/bin/../lib/gcc-lib/ppc-linux/3.3.3/../../../../ppc-
linux/bin/ld: cannot open output file .libs/: Is a directorycollect2: ld
returned 1 exit status
make[1]: *** [libnetsnmp.la] Error 1
make: *** [subdirs] Error 1
error: Bad exit status from /opt/eldk/var/tmp/rpm-tmp.96354 (%build)


RPM build errors:
    Bad exit status from /opt/eldk/var/tmp/rpm-tmp.96354 (%build)

^ permalink raw reply

* Address mapping PPC 405
From: P. Sadik @ 2005-08-26  1:31 UTC (permalink / raw)
  To: linuxppc-embedded

Hello,

  I have a question on how PPC addressing works. I am familiar with
the MIPS architecture and new to PPC.

  On MIPS, there are KUSEG (0x0000_0000 to 0x07FF_FFFF)
which is always translated using TLB. Then there are two
un-translated areas KSEG0 (0x8000_0000 which is cached)
and KSEG1 (0xA000_0000).

  Hence, the kernel is compiled with .text at 0x8000_0000. For kernel
itself, the TLB is never consulted. All the local peripherals will be mappe=
d to=20
0xA000_0000. That means, from kernel, if I have to access a register of any=
=20
peripheral, I can use the un-mapped address and everything will work.

 On PPC I see that, the kernel .text is at 0xC000_0000. Is it a=20
translated address? If it is, for running kernel code, the CPU has to
consult the TLB always?

 Another question is regarding addressing local peripherals. I am using
an ML310 board from Xilinx and it has DDR mapped to 0x0000_0000
to 0x0FFF_FFFF (256 MB). Now, I need to add an IP to the PLB.
For that, I am thinking of using 0x2000_0000 to 0x2000_0FFF.
Now, my driver need to access the registers within the above region.
How will I do that? It is an I/O, hence should I use ioremap, or can
I access it directly? What role cache will play in this case?

 The third question is, can I use de-referencing of address. Is it O.K
to use pointers to access the registers, or do I have to use read/write
variants?=20

  I would appreciate a lot if you could give some insight into this. Any
pointers or reading materials will be very helpful.

Thanks and regards,

Sadik.

^ permalink raw reply

* Re: Address mapping PPC 405
From: Grant Likely @ 2005-08-26  3:10 UTC (permalink / raw)
  To: P. Sadik; +Cc: linuxppc-embedded
In-Reply-To: <ea43f4f9050825183121655ba2@mail.gmail.com>

On Thu, Aug 25, 2005 at 06:31:22PM -0700, P. Sadik wrote:
> Hello,
> 
>  On PPC I see that, the kernel .text is at 0xC000_0000. Is it a 
> translated address? If it is, for running kernel code, the CPU has to
> consult the TLB always?
Typically, PPC systems have RAM based at physical address 0 which is
mapped up to 0xc0000000.  Once the MMU is turned on the TLB is consulted
for every memory access.
> 
>  Another question is regarding addressing local peripherals. I am using
> an ML310 board from Xilinx and it has DDR mapped to 0x0000_0000
> to 0x0FFF_FFFF (256 MB). Now, I need to add an IP to the PLB.
> For that, I am thinking of using 0x2000_0000 to 0x2000_0FFF.
> Now, my driver need to access the registers within the above region.
> How will I do that? It is an I/O, hence should I use ioremap, or can
> I access it directly? What role cache will play in this case?
You can put your peripherals anywhere within the address space as long
as they don't conflict with each other.  You must add a page mapping for
each peripheral because once the MMU is turned on you can no longer
access physical addresses directly.  I believe ioremap is the correct
facility to do this.

> 
>  The third question is, can I use de-referencing of address. Is it O.K
> to use pointers to access the registers, or do I have to use read/write
> variants? 
Since there is no seperate IO memory space you can access the registers
with simple pointers.

Whether or not it is a good idea (based on coding conventions) I'll
leave for someone else to answer.  :)

> 
>   I would appreciate a lot if you could give some insight into this. Any
> pointers or reading materials will be very helpful.
Keep me updated on your progress.  I'm working on the ML300 and a couple
of the MEMEC boards to make v2pro support more flexible in 2.6.x, and
I'd like to hear about your experiences.

Cheers,
g.
> 
> Thanks and regards,
> 
> Sadik.
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

^ permalink raw reply

* problem mounting ROOT-NFS
From: Nuguru Susheel @ 2005-08-26 10:37 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,

  I lately upgraded to Bestcomm API v2.2 from v2.1 , but root-nfs doesnt
mount while booting from ram, but when booting from FLASH (Compact Flash
and also NOR) it does well. This problem could be seen when I try to
boot on MPC5200 RevA.=20

 Then I switched to MPC5200 RevB to see it is the same here, but with
same u.boot.bin and kernel image everything boot well on Rev B. I have
compared the Environment perameters passed from u-boot to the kernel and
everything seems to be the same. I also looked into the Errata to check
if anything else regarding bestcomm or fec has changed, but couldnt
figure out anything.

console messages while booting on MPC5200 RevA from ram goes this
way ...



  =20
U-Boot 1.1.1 (Aug 24 2005 - 09:56:03)

CPU:   MPC5200 (JTAG ID 0001101d) at 396 MHz
       Bus 132 MHz, IPB 66 MHz, PCI 33 MHz
Board: Mitron, Type is not set
DRAM:  64 MB
FLASH:  4 MB
FPGA:  OK
SPI:   MPC5200_spi,mki_ad initialised
BL:    (channel 2, dutycycle 50, freq 500) initialised
Video: SMI720 @ 640x480x8 28kHz 53Hz
In:    serial
Out:   serial
Err:   serial
NAND:  128 MB at 0x28001000
Net:   FEC ETHERNET
IDE:   no card
 0
=3D> tftpboot 800000 u-boot.bin
Using FEC ETHERNET device
TFTP from server 192.168.1.61; our IP address is 192.168.30.130
Filename 'u-boot.bin'.
Load address: 0x800000
Loading: T invalid RARP header

TFTP error: 'File not found' (1)
Starting again


Abort
=3D> tftpboot 800000 pImage
Using FEC ETHERNET device
TFTP from server 192.168.1.61; our IP address is 192.168.30.130
Filename 'pImage'.
Load address: 0x800000
Loading:
#################################################################

#################################################################

#################################################################
         #
done
Bytes transferred =3D 1001433 (f47d9 hex)
=3D> bootm 800000
## Booting image at 00800000 ...
   Image Name:   Linux-2.4.21-rc1
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1001369 Bytes =3D 977.9 kB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Mitron CVS tag: mct3_moto1_update
Memory BAT mapping: BAT2=3D64Mb, BAT3=3D0Mb, residual: 0Mb
Linux version 2.4.21-rc1 (nuguru@SW-server) (gcc version 2.95.4 20010319
(prerelease/franzo/20011204)) #5 Fri Aug 26 09:51:30 EEST 2005
Mitron SGVT port (C) 2003 Mitron Oy (mitron@mitron.fi)
On node 0 totalpages: 16384
zone(0): 16384 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: nfsroot=3D192.168.1.61:/tftpboot/rootfs
ip=3D192.168.30.130:192.168.1.61:192.168.1.1:255.255.0.0:SGVT_180::off
root=3D/dev/nfs video=3Dscarlet:dev:0,no_pal console=3DttyS0;init=3D/bin/sh=
;
mgt5100_pic.c/mgt5100_init_irq: using configuration from FPGA binary
file
mgt5100_init_irq: external FPGA interrupt controller (by Mitron Oy)
initialized
Calibrating delay loop... 263.78 BogoMIPS
Memory: 61828k available (1768k kernel code, 576k data, 76k init, 0k
highmem)
Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode cache hash table entries: 4096 (order: 3, 32768 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 4096 (order: 2, 16384 bytes)
Page-cache hash table entries: 16384 (order: 4, 65536 bytes)
POSIX conformance testing by UNIFIX
PCI: Probing PCI hardware
Memory resource not set for host bridge 0
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
hwblock: Identification failure!
hwblock: Checksum failure!
hwblock: Forcing fallback
hwblock: Configuring for MC=EF=BF=BDerial.c->init_chipsels: mfdev->count !=
=3D
SGVT_RS_TABLE_SIZE
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ
SERIAL_PCI enabled
uart00 at 0xc5076000 (irq =3D 92) is a TI16750
uart01 at 0xc5078008 (irq =3D 92) is a TI16750
uart02 at 0xc507a010 (irq =3D 92) is a TI16750
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
Uniform Multi-Platform E-IDE driver Revision: 7.00beta-2.4
ide: Assuming 33MHz system bus speed for PIO modes; override with
idebus=3Dxx
SCSI subsystem driver Revision: 1.00
usb.c: registered new driver usbdevfs
usb.c: registered new driver hub
usb-ohci-embedded.c: USB OHCI at membase 0xf0001000, IRQ 44
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
usb.c: registered new driver hiddev
usb.c: registered new driver hid
hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz>
hid-core.c: USB HID support drivers
usb.c: registered new driver usblp
printer.c: v0.11: USB Printer Device Class driver
pegasus.c: v0.4.26 (2002/03/21):Pegasus/Pegasus II USB Ethernet driver
usb.c: registered new driver pegasus
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
eth0: Phy @ 0x0, type LXT971 (0x001378e2)
Mitron multi chip CAN driver 0.4 inited
Mitron SPI core functionality initialized
spi-core.o: adapter SGVT SPI host registered as adapter 0.
spi_add_driver: driver MKI driver registered.
kb_probe_func: MKI keyboard 0 found. Versions: hw:3.1 sw:2.2
spi_attach_client: client [SGVT SPI keyboard] registered to adapter
[SGVT SPI host](pos. 0).
MKI initialized succesfully
SGVT_WDT: Software Watchdog Timer version 0.1, timeout 60 sec.
SGVT Bank 0: Found 1 x16 devices at 0x0 in 8-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
SGVT Bank 0: Swapping erase regions for broken CFI table.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Creating 3 MTD partitions on "SGVT Bank 0":
0x00000000-0x00200000 : "kernel"
0x00200000-0x00280000 : "logo1"
0x00280000-0x00300000 : "logo2"
Initialised PWM buzzer, v. 0.2
Nov. I/O 0.1 succesfully initialized
spi_add_driver: driver A/D driver registered.
spi_attach_client: client [SGVT SPI A/D converter] registered to adapter
[SGVT SPI host](pos. 5).
SPI A/D initialized succesfully
ppcpmw 0.8 initialized
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 4096)
eth0: config: auto-negotiation off, 100FDX, 100HDX, 10FDX, 10HDX.
IP-Config: Complete:
      device=3Deth0, addr=3D192.168.30.130, mask=3D255.255.0.0,
gw=3D192.168.1.1,
     host=3DSGVT_180, domain=3D, nis-domain=3D(none),
     bootserver=3D192.168.1.61, rootserver=3D192.168.1.61, rootpath=3D
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
Looking up port of RPC 100003/2 on 192.168.1.61
eth0: status: link up, 100 Mbps Full Duplex, auto-negotiation complete.
portmap: server 192.168.1.61 not responding, timed out
Root-NFS: Unable to get nfsd port number from server, using default
Looking up port of RPC 100005/1 on 192.168.1.61

then it stays until I reset the core :-(

 any hints  ???

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox