[uClinux-dev] [PATCH] linux-2.6.11.8-hsc0 espd-4510b/s3c4510b big endian

Håkan Kvist hagar at df.lth.se
Wed Aug 17 07:20:16 EDT 2005


On Wed, Aug 17, 2005 at 01:12:24PM +0200, Håkan Kvist wrote:
> The attached patch is against linux-2.6.11.8-hsc0 and
> makes the espd 4510b/samsung s3c4510b target big endian compatible.
> 
> There is some more changes that has to be made in order to get
> a big endian build up and running, but this is atleast a step 
> in the right direction.
> 

And here is the file.

regards
Håkan
-------------- next part --------------
diff -ur linux-2.6.11.8/drivers/net/arm/eth_s3c4510b.c uClinux-dist-test/linux-2.6.x/drivers/net/arm/eth_s3c4510b.c
--- linux-2.6.11.8/drivers/net/arm/eth_s3c4510b.c	2005-08-17 11:41:11.000000000 +0200
+++ uClinux-dist-test/linux-2.6.x/drivers/net/arm/eth_s3c4510b.c	2005-08-10 14:39:16.000000000 +0200
@@ -159,7 +159,10 @@
 	/* clear received frame bit */
 	outl( ETH_S_BRxRDF, REG_BDMASTAT);
 
-	do {
+        /* Process all frames owned by the cpu, in this manner we can process
+           more that 16 packets at a time */
+        while(pRxFD->m_frameDataPtr.bf.owner == 0) {
+          /*do {*/
 		if ( likely( pRxFD->m_status.bf.good)) {
 			skb = pRxFD->skb;
 
@@ -196,10 +199,19 @@
 		pRxFD->m_frameDataPtr.bf.owner = 1;
 		/* clear status */
 		pRxFD->m_status.ui = 0x0;
+
+
+                /* Verify that BDMA_RX is enabled */
+                if (! (inl(REG_BDMARXCON) & ETH_BRxEn)){
+                  /*outl( 0x3F, REG_BDMASTAT);*/
+                  outl( (inl( REG_BDMARXCON) | ETH_BRxEn),  REG_BDMARXCON);
+                }
+
 		/* advance to next descriptor */
 		pRxFD = pRxFD->m_nextFD;
 
-	} while ( pRxFD != cRxFD);
+               /*} while ( pRxFD != cRxFD);*/
+        }
 
 	priv->m_curRX_FD = pRxFD;
 
@@ -291,7 +303,13 @@
 	/* Set TX Frame flags */
 	priv->m_curTX_FD->m_opt.bf.widgetAlign  = (u32)skb->data - addr; /* compenstate for alignment */
 	priv->m_curTX_FD->m_opt.bf.frameDataDir = 1;
+
+#ifdef __ARMEB__
+	priv->m_curTX_FD->m_opt.bf.littleEndian = 0;
+#else
 	priv->m_curTX_FD->m_opt.bf.littleEndian = 1;
+#endif
+
 	priv->m_curTX_FD->m_opt.bf.macTxIrqEnbl = 1;
 	priv->m_curTX_FD->m_opt.bf.no_crc       = 0;
 	priv->m_curTX_FD->m_opt.bf.no_padding   = 0;
@@ -402,7 +420,14 @@
 	      ETH_BRxDIE    |	/* BDMA Rx Every Received Frame Interrupt Enable */
 	      ETH_BRxNLIE   |	/* BDMA Rx NULL List Interrupt Enable */
 	      ETH_BRxNOIE   |	/* BDMA Rx Not Owner Interrupt Enable */
+
+
+#ifdef __ARMEB__
+      	      ETH_BRxBig |	/* BDMA Rx big endian */
+#else
 	      ETH_BRxLittle |	/* BDMA Rx Little endian */
+#endif
+
 	      ETH_BRxWA10   |	/* BDMA Rx Word Alignment- two invalid bytes */
 	      ETH_BRxEn,	/* BDMA Rx Enable */
 	      REG_BDMARXCON);
@@ -449,7 +474,9 @@
  */
 static int __s3c4510b_init(struct net_device *dev)
 {
-#define __REDBOOT_MAC__ (1)
+  /* HAKAN CHANGED */
+  /*#define __REDBOOT_MAC__ (1)*/
+#define __REDBOOT_MAC__ (0)
 #if	(__REDBOOT_MAC__ == 1)
 	volatile unsigned long cam_value;
 #endif /* __REDBOOT_MAC__ */
diff -ur linux-2.6.11.8/drivers/net/arm/eth_s3c4510b.h uClinux-dist-test/linux-2.6.x/drivers/net/arm/eth_s3c4510b.h
--- linux-2.6.11.8/drivers/net/arm/eth_s3c4510b.h	2005-08-17 11:41:12.000000000 +0200
+++ uClinux-dist-test/linux-2.6.x/drivers/net/arm/eth_s3c4510b.h	2005-08-10 11:24:54.000000000 +0200
@@ -193,7 +193,10 @@
 #define TX_OptNoPadding		(0x01)
 #define TX_OptNoCRCMode		(0x02)
 #define TX_OptMACTxIntEn	(0x04)
-#define TX_OptLittleEndian	(0x08)
+
+/*This is not used anywhere? */
+#define TX_OptLittleEndian	(0x08) 
+
 #define TX_OptFrameDataPtrInc	(0x10)
 #define TX_OptWA01		(0x20)
 #define TX_OptWA10		(0x40)
@@ -201,8 +204,13 @@
 
 /*  bit field for frame data pointer word */
 typedef struct __BF_FrameDataPtr {
+#ifdef __ARMEB__
+	u32   owner: 1;
+	u32 dataPtr:31;
+#else
 	u32 dataPtr:31;
 	u32   owner: 1;
+#endif
 } BF_FrameDataPtr;
 
 typedef union _FrameDataPtr {
@@ -211,6 +219,15 @@
 } FrameDataPtr;
 
 typedef struct __BF_TX_Options {
+#ifdef __ARMEB__
+	u32      reserved:25;
+	u32   widgetAlign: 2;
+	u32  frameDataDir: 1;
+	u32  littleEndian: 1;
+	u32  macTxIrqEnbl: 1;
+	u32        no_crc: 1;
+	u32    no_padding: 1;
+#else
 	u32    no_padding: 1;
 	u32        no_crc: 1;
 	u32  macTxIrqEnbl: 1;
@@ -218,6 +235,7 @@
 	u32  frameDataDir: 1;
 	u32   widgetAlign: 2;
 	u32      reserved:25;
+#endif
 } BF_TX_Options;
 
 typedef union _TX_Options {
@@ -226,6 +244,23 @@
 } TX_Options;
 
 typedef struct __BF_RX_Status {
+#ifdef __ARMEB__
+	u32        halted: 1;
+	u32          good: 1;
+	u32     parityErr: 1;
+	u32     reserved3: 1;
+	u32       longErr: 1;
+	u32      overFlow: 1;
+	u32        crcErr: 1;
+	u32      alignErr: 1;
+	u32      rx10stat: 1;
+	u32         intRx: 1;
+	u32       ctrlRcv: 1;
+	u32     reserved2: 1;
+	u32       overMax: 1;
+	u32     reserved1: 3;
+	u32           len:16;	/*  frame length */
+#else
 	u32           len:16;	/*  frame length */
 	u32     reserved1: 3;
 	u32       overMax: 1;
@@ -241,6 +276,7 @@
 	u32     parityErr: 1;
 	u32          good: 1;
 	u32        halted: 1;
+#endif
 } BF_RX_Status;
 
 typedef union _RX_Status {
@@ -249,6 +285,22 @@
 } RX_Status;
 
 typedef struct __BF_TX_Status {
+#ifdef __ARMEB__
+	u32        halted: 1;
+	u32      complete: 1;
+	u32     parityErr: 1;
+	u32      lateColl: 1;
+	u32         SQErr: 1;
+	u32     noCarrier: 1;
+	u32         defer: 1;
+	u32      underRun: 1;
+	u32         intTx: 1;
+	u32        paused: 1;
+	u32       txDefer: 1;
+	u32        exColl: 1;
+	u32     txCollCnt: 4;
+	u32           len:16;	/*  frame length */
+#else
 	u32           len:16;	/*  frame length */
 	u32     txCollCnt: 4;
 	u32        exColl: 1;
@@ -263,6 +315,7 @@
 	u32     parityErr: 1;
 	u32      complete: 1;
 	u32        halted: 1;
+#endif
 } BF_TX_Status;
 
 typedef union _TX_Status {
diff -ur linux-2.6.11.8/include/asm-arm/arch-espd_4510b/uart.h uClinux-dist-test/linux-2.6.x/include/asm-arm/arch-tac_4510b/uart.h
--- linux-2.6.11.8/include/asm-arm/arch-espd_4510b/uart.h	2005-08-17 11:41:17.000000000 +0200
+++ uClinux-dist-test/linux-2.6.x/include/asm-arm/arch-tac_4510b/uart.h	2005-08-10 11:30:28.000000000 +0200
@@ -30,12 +30,21 @@
 
 /* UART LINE CONTROL register */
 typedef struct __BF_UART_LINE_CTRL {
+#ifdef __ARMEB__
+	u32     unused:24;
+	u32  infra_red: 1;
+	u32        clk: 1;
+	u32     parity: 3;
+	u32      nStop: 1;
+	u32    wordLen: 2;
+#else
 	u32    wordLen: 2;
 	u32      nStop: 1;
 	u32     parity: 3;
 	u32        clk: 1;
 	u32  infra_red: 1;
 	u32     unused:24;
+#endif
 } BF_UART_LINE_CTRL;
 
 typedef union _UART_LINE_CTRL {
@@ -45,6 +54,15 @@
 
 /* UART CONTROL register */
 typedef struct __BF_UART_CTRL {
+#ifdef __ARMEB__
+	u32     unused:24;
+	u32   loopBack: 1;
+	u32  sendBreak: 1;
+	u32        DSR: 1;
+	u32     txMode: 2;
+	u32      rxIrq: 1;
+	u32     rxMode: 2;
+#else
 	u32     rxMode: 2;
 	u32      rxIrq: 1;
 	u32     txMode: 2;
@@ -52,6 +70,7 @@
 	u32  sendBreak: 1;
 	u32   loopBack: 1;
 	u32     unused:24;
+#endif
 } BF_UART_CTRL;
 
 typedef union _UART_CTRL {
@@ -61,6 +80,17 @@
 
 /* UART STATUS register */
 typedef struct __BF_UART_STAT {
+#ifdef __ARMEB__
+	u32       unused:24;
+	u32   txComplete: 1;
+	u32   txBufEmpty: 1;
+	u32      rxReady: 1;
+	u32          DTR: 1;
+	u32     breakIrq: 1;
+	u32        frame: 1;
+	u32       parity: 1;
+	u32      overrun: 1;
+#else
 	u32      overrun: 1;
 	u32       parity: 1;
 	u32        frame: 1;
@@ -70,6 +100,7 @@
 	u32   txBufEmpty: 1;
 	u32   txComplete: 1;
 	u32       unused:24;
+#endif
 } BF_UART_STAT;
 
 typedef union _UART_STAT {
@@ -79,9 +110,15 @@
 
 /* UART BAUD_DIV register */
 typedef struct __BF_UART_BAUD_DIV {
+#ifdef __ARMEB__
+	u32    unused:16;
+	u32      cnt0:12;
+	u32      cnt1: 4;
+#else
 	u32      cnt1: 4;
 	u32      cnt0:12;
 	u32    unused:16;
+#endif
 } BF_UART_BAUD_DIV;
 
 typedef union _UART_BAUD_DIV {


More information about the uClinux-dev mailing list