From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.225]) by ozlabs.org (Postfix) with ESMTP id 434ED67B7F for ; Thu, 8 Jun 2006 08:27:31 +1000 (EST) Received: by wr-out-0506.google.com with SMTP id 55so509985wri for ; Wed, 07 Jun 2006 15:27:30 -0700 (PDT) From: "Trueskew" To: Subject: MPC5200B SPI PSC3 Problem Date: Wed, 7 Jun 2006 15:21:22 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00EE_01C68A46.09E05B40" Message-ID: <44875165.40800d0c.36a8.3e2e@mx.gmail.com> List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This is a multi-part message in MIME format. ------=_NextPart_000_00EE_01C68A46.09E05B40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit We have an AIC26 codec connected to our Lite5200B platform via J21. I've used MPC5200BUG to configure PSC3 as an SPI master, along with some samples I've found online (including here) and some I received from Freescale. Although the transfers seem to be working as expected (please see the output file at the end of this message), I get only 0xffff back. This occurs whether or not the device is attached to J21. A scope shows that PSC3_8 (SPI_SS) and PSC3_9 (SPI_CLK) are low at all times, and I'm concerned I'm still doing something wrong with respect to enabling SPI over PSC3. I'm including my driver initialization code, my write code, and output showing the write behavior. If someone could comment on it, I would greatly appreciate it... or if someone flat out has code to do this, I'd be happy to take it from you. I've seen a few variations, but whether I use them directly or modify them as I need to, I can't seem to get past this. Of course, any other suggestions are welcome. Thanks. Sal --------------------------------------------------------------------------- Initialization Code --------------------------------------------------------------------------- #define GPIO_PSC3_PORT_CONFIG_MASK 0x00000f00 #ifdef SPI_USE_MCLK #define GPIO_PSC3_PORT_CONFIG 0x00000700 /* PSC3 mode with mclk */ #else /* SPI_USE_MCLK */ #define GPIO_PSC3_PORT_CONFIG 0x00000600 /* PSC3 mode */ #endif /* SPI_USE_MCLK */ #define CDM_PSC3_MCLK_ENABLE 0x00000080 #define CDM_PSC3_MCLK_CONFIG 0x8020 /* Divide Fvco ftom 528 to 16Mhz */ #define PSC3_SICR_REG_VALUE 0x0280f000 /* 16-bit select Codec SPI master mode, msb first, UseEOF=1. GenClk=1, SIM, CPOL and CPHA are function input */ ... /* Select the Pin-Muxing for PSC3 Codec mode */ gpio = (struct mpc52xx_gpio *) ioremap(MPC52xx_GPIO, sizeof(struct mpc52xx_gpio)); if(gpio) { port_config = gpio->port_config; port_config &= ~GPIO_PSC3_PORT_CONFIG_MASK; port_config |= GPIO_PSC3_PORT_CONFIG; gpio->port_config = port_config; iounmap(gpio); } else { return(-1); } #ifdef SPI_USE_MCLK /* PSC clock enable */ g_pCDM->clk_enables |= CDM_PSC3_MCLK_ENABLE; g_pCDM->mclken_div_psc3 = CDM_PSC3_MCLK_CONFIG; #endif /* SPI_USE_MCLK */ /* Disable rx and tx */ g_pPSC->command = MPC52xx_PSC_RST_RX; g_pPSC->command = MPC52xx_PSC_RST_TX; g_pPSC->command = MPC52xx_PSC_SEL_MODE_REG_1; g_pPSC->command = MPC52xx_PSC_RST_ERR_STAT; g_pPSC->command = MPC52xx_PSC_RX_DISABLE | MPC52xx_PSC_TX_DISABLE; g_pPSC->mode = 0; g_pPSC->sicr = PSC3_SICR_REG_VALUE; #ifdef SPI_USE_MCLK g_pPSC->ccr=0x0703; /* set SCK and DSCKL delay */ #else /* SPI_USE_MCLK */ g_pPSC->ccr=0x0003; /* set SCK and DSCKL delay must be > 2 */ #endif /* SPI_USE_MCLK */ g_pPSC->ctur=0x00; /* Set DTL delay 2us */ g_pPSC->ctlr=0x84; g_pPSC->rfalarm=100; /* Alarm values taken from SPI example sample */ g_pPSC->tfalarm=1; g_pPSC->rfcntl &= 0xf8; /* 0 byte granularity */ g_pPSC->tfcntl = 1; /* Enable rx & tx */ g_pPSC->command = MPC52xx_PSC_RST_RX; g_pPSC->command = MPC52xx_PSC_RST_TX; g_pPSC->command = MPC52xx_PSC_SEL_MODE_REG_1; g_pPSC->command = MPC52xx_PSC_RST_ERR_STAT; g_pPSC->command = MPC52xx_PSC_RX_ENABLE | MPC52xx_PSC_TX_ENABLE; --------------------------------------------------------------------------- Write code --------------------------------------------------------------------------- static int mpc52xx_spi_transfer(u16 *p_usBuffer, u16 p_usCount) { u16 usIndex, usTemp; printk("------------------------------------------------------\n"); printk("Entry: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); g_pPSC->command = MPC52xx_PSC_RST_RX; g_pPSC->command = MPC52xx_PSC_RST_TX; g_pPSC->command = MPC52xx_PSC_SEL_MODE_REG_1; g_pPSC->command = MPC52xx_PSC_RST_ERR_STAT; g_pPSC->command = MPC52xx_PSC_RX_ENABLE | MPC52xx_PSC_TX_ENABLE; printk("TX-RX Enable: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); /* Clean out the read FIFO */ usIndex = 0; while(g_pPSC->mpc52xx_psc_status & MPC52xx_PSC_SR_RXRDY) { usTemp = g_pPSC->mpc52xx_psc_buffer_16; printk("Flushing Rx FIFO: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); udelay(100000); udelay(100000); udelay(100000); udelay(100000); udelay(100000); usIndex++; if(usIndex == 10) return(-1); } /* Send out the buffer */ g_pPSC->command = MPC52xx_PSC_RX_ENABLE | MPC52xx_PSC_TX_DISABLE; for(usIndex=0; usIndexmpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); g_pPSC->mpc52xx_psc_buffer_16 = p_usBuffer[usIndex]; printk("Sent: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); } g_pPSC->command = MPC52xx_PSC_RX_ENABLE | MPC52xx_PSC_TX_ENABLE; usTemp = 0; while(g_pPSC->tfnum) { printk("TFNUM Wait: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); udelay(100000); udelay(100000); udelay(100000); udelay(100000); udelay(100000); usTemp++; if(usTemp == 10) return(-1); }; printk("TxRDY: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); for(usIndex=0; usIndexmpc52xx_psc_status & MPC52xx_PSC_SR_RXRDY)) { printk("RxRDY Wait: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); udelay(100000); udelay(100000); udelay(100000); udelay(100000); udelay(100000); usTemp++; if(usTemp == 10) return(-1); }; printk("RxRDY: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); p_usBuffer[usIndex] = g_pPSC->mpc52xx_psc_buffer_16; printk(" Received %04x\n", p_usBuffer[usIndex]); } printk("EXIT: psc=%x status=%04x tfstat=%04x rfstat=%04x mode=%02x\n tfnum %3d rfnum %3d\n", (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tfstat,g_pPSC- >mode, g_pPSC->tfnum, g_pPSC->rfnum); return(usIndex); } --------------------------------------------------------------------------- Output --------------------------------------------------------------------------- The lines below are a capture of register settings from my driver, along with output lines when trying to write 16 bit words to our device. This output is consistent whether the device is connected or not (via J21). Basic operation, delimited by "------...---": - Disable TX, Enable RX (despite the "TX-RX Enable" heading) - Send word 1 - Send word 2 - Enable TX, Enable RX - Wait for tfnum == 0 - Receive data port_config=91051624 sicr=0280f000 clk_enables=00ffffff div_psc3=800f ------------------------------------------------------ Entry: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=33 tfnum 0 rfnum 0 TX-RX Enable: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=33 tfnum 0 rfnum 0 Sending 0880: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 0 Sent: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 2 rfnum 0 Sending bb00: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 2 rfnum 0 Sent: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 4 rfnum 0 TFNUM Wait: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 2 rfnum 0 TxRDY: psc=f0002400 status=0500 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 4 RxRDY: psc=f0002400 status=0500 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 4 Received ffff RxRDY: psc=f0002400 status=0500 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 2 Received ffff EXIT: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 0 ------------------------------------------------------ Entry: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 0 TX-RX Enable: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=33 tfnum 0 rfnum 0 Sending 8820: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 0 Sent: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 2 rfnum 0 Sending 0000: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 2 rfnum 0 Sent: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 4 rfnum 0 TFNUM Wait: psc=f0002400 status=0000 tfstat=0002 rfstat=0002 mode=07 tfnum 2 rfnum 0 TxRDY: psc=f0002400 status=0500 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 4 RxRDY: psc=f0002400 status=0500 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 4 Received ffff RxRDY: psc=f0002400 status=0500 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 2 Received ffff EXIT: psc=f0002400 status=0400 tfstat=0003 rfstat=0003 mode=07 tfnum 0 rfnum 0 ------=_NextPart_000_00EE_01C68A46.09E05B40 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
We have an AIC26 codec connected to our Lite5200B = platform via=20 J21.  I've used MPC5200BUG to configure PSC3 as an SPI master, = along with=20 some samples I've found online (including=20 here) and some I = received from=20 Freescale.  Although the transfers seem to be working as expected = (please=20 see the output file at the end of = this=20 message), I get only 0xffff back.  This occurs whether or = not the=20 device is attached to J21.  A scope shows that PSC3_8 (SPI_SS) and = PSC3_9=20 (SPI_CLK) are low at all times, and I'm concerned I'm still doing = something=20 wrong with respect to enabling SPI over PSC3. 
 
I'm including=20 my driver initialization code, my write code, and output showing = the=20 write behavior.  If someone could comment on it, I would greatly = appreciate=20 it... or if someone flat out has = code to do=20 this, I'd be happy to take it from you.  I've seen a few = variations, but=20 whether I use them directly or modify them as I need to, I can't = seem to=20 get past this.  Of course, any other suggestions are=20 welcome.
 
Thanks.
Sal
 
----------------------------------------------------------------= -----------
Initialization=20 Code
-----------------------------------------------------------------= ----------
#define=20 GPIO_PSC3_PORT_CONFIG_MASK 0x00000f00
#ifdef = SPI_USE_MCLK
  =20 #define      GPIO_PSC3_PORT_CONFIG = 0x00000700  /*=20 PSC3 mode with mclk */
#else  /* SPI_USE_MCLK */
   = #define      GPIO_PSC3_PORT_CONFIG = 0x00000600  /*=20 PSC3 mode */
#endif /* SPI_USE_MCLK */
 
#define      =20 CDM_PSC3_MCLK_ENABLE = 0x00000080
#define      =20 CDM_PSC3_MCLK_CONFIG 0x8020      /* Divide Fvco = ftom=20 528 to=20
           &nb= sp;           &nbs= p;            = ;            =  =20 16Mhz */
 
#define       =20 PSC3_SICR_REG_VALUE 0x0280f000  /* 16-bit select Codec SPI=20
           &nb= sp;           &nbs= p;            = ;            =  =20 master mode, msb first,=20
           &nb= sp;           &nbs= p;            = ;            =  =20 UseEOF=3D1. GenClk=3D1, SIM,=20
           &nb= sp;           &nbs= p;            = ;            =  =20 CPOL and CPHA are=20
           &nb= sp;           &nbs= p;            = ;            =  =20 function input */ =20
...           =             &= nbsp;           &n= bsp;          =20
   /* Select the Pin-Muxing for PSC3 Codec mode = */
  =20 gpio =3D (struct mpc52xx_gpio *) = ioremap(MPC52xx_GPIO,
    =20 sizeof(struct mpc52xx_gpio));
   if(gpio)
  =20 {
      port_config =3D=20 gpio->port_config;
      port_config = &=3D=20 ~GPIO_PSC3_PORT_CONFIG_MASK;
      = port_config |=3D=20 GPIO_PSC3_PORT_CONFIG;
      = gpio->port_config =3D=20 port_config;
      = iounmap(gpio);
  =20 }
   else
   = {
     =20 return(-1);
   }
 
#ifdef SPI_USE_MCLK
   /* = PSC clock=20 enable */
   g_pCDM->clk_enables |=3D=20 CDM_PSC3_MCLK_ENABLE;
   g_pCDM->mclken_div_psc3 =3D=20 CDM_PSC3_MCLK_CONFIG;
#endif /* SPI_USE_MCLK */
 
   /* Disable rx and tx=20 */
   g_pPSC->command =3D = MPC52xx_PSC_RST_RX;
  =20 g_pPSC->command =3D MPC52xx_PSC_RST_TX;
   = g_pPSC->command =3D=20 MPC52xx_PSC_SEL_MODE_REG_1;
   g_pPSC->command =3D=20 MPC52xx_PSC_RST_ERR_STAT;
   g_pPSC->command =3D=20 MPC52xx_PSC_RX_DISABLE | MPC52xx_PSC_TX_DISABLE; 
 
   g_pPSC->mode =3D = 0;
  =20 g_pPSC->sicr =3D PSC3_SICR_REG_VALUE;
 
   #ifdef = SPI_USE_MCLK
  =20 g_pPSC->ccr=3D0x0703;       /* set SCK = and DSCKL=20 delay */
   #else  /* SPI_USE_MCLK */
  =20 g_pPSC->ccr=3D0x0003;       /* set SCK = and DSCKL=20 delay must be > 2 */
   #endif /* SPI_USE_MCLK = */
 
  =20 g_pPSC->ctur=3D0x00;        /* Set = DTL delay=20 2us */
   g_pPSC->ctlr=3D0x84;
 
  =20 g_pPSC->rfalarm=3D100;      /* Alarm values = taken from=20 SPI example sample */
   = g_pPSC->tfalarm=3D1;
 
   g_pPSC->rfcntl &=3D = 0xf8;       /* 0 byte granularity=20 */
   g_pPSC->tfcntl =3D 1;
 
   /* Enable rx & tx=20 */
   g_pPSC->command =3D = MPC52xx_PSC_RST_RX;
  =20 g_pPSC->command =3D MPC52xx_PSC_RST_TX;
   = g_pPSC->command =3D=20 MPC52xx_PSC_SEL_MODE_REG_1;
   g_pPSC->command =3D=20 MPC52xx_PSC_RST_ERR_STAT;
   g_pPSC->command =3D=20 MPC52xx_PSC_RX_ENABLE | MPC52xx_PSC_TX_ENABLE; 
 
----------------------------------------------------------------= -----------
Write=20 code
-----------------------------------------------------------------= ----------
static=20 int mpc52xx_spi_transfer(u16 *p_usBuffer, u16 = p_usCount)
{
  =20 u16 usIndex, usTemp;
 
  =20 printk("------------------------------------------------------\n");
&n= bsp; =20 printk("Entry:         psc=3D%x=20 status=3D%04x tfstat=3D%04x rfstat=3D%04x mode=3D%02x\n   = tfnum %3d =20 rfnum %3d\n",
    =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
    =20 g_pPSC->tfnum, g_pPSC->rfnum);
   g_pPSC->command = =3D=20 MPC52xx_PSC_RST_RX;
   g_pPSC->command =3D=20 MPC52xx_PSC_RST_TX;
   g_pPSC->command =3D=20 MPC52xx_PSC_SEL_MODE_REG_1;
   g_pPSC->command =3D=20 MPC52xx_PSC_RST_ERR_STAT;
   g_pPSC->command =3D=20 MPC52xx_PSC_RX_ENABLE | MPC52xx_PSC_TX_ENABLE;
   = printk("TX-RX=20 Enable:  psc=3D%x status=3D%04x tfstat=3D%04x rfstat=3D%04x = mode=3D%02x\n  =20 tfnum %3d  rfnum %3d\n",
    =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
    =20 g_pPSC->tfnum, g_pPSC->rfnum);
 
   /* Clean out the read FIFO = */
   usIndex =3D 0;
  =20 while(g_pPSC->mpc52xx_psc_status & = MPC52xx_PSC_SR_RXRDY)
  =20 {
      usTemp =3D=20 g_pPSC->mpc52xx_psc_buffer_16;
     =20 printk("Flushing Rx FIFO: psc=3D%x status=3D%04x tfstat=3D%04x = rfstat=3D%04x=20 mode=3D%02x\n   tfnum %3d  rfnum=20 %3d\n",
       =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
       =20 g_pPSC->tfnum, g_pPSC->rfnum);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 usIndex++;
      if(usIndex =3D=3D 10)=20 return(-1);
   }
 
   /* Send out the buffer=20 */
   g_pPSC->command =3D MPC52xx_PSC_RX_ENABLE |=20 MPC52xx_PSC_TX_DISABLE;
   for(usIndex=3D0; = usIndex<p_usCount;=20 usIndex++)
   {
      = printk("Sending=20 %04x:  psc=3D%x status=3D%04x tfstat=3D%04x rfstat=3D%04x = mode=3D%02x\n  =20 tfnum %3d  rfnum = %3d\n",
       =20 p_usBuffer[usIndex],=20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
       =20 g_pPSC->tfnum, g_pPSC->rfnum);
     =20 g_pPSC->mpc52xx_psc_buffer_16 =3D=20 p_usBuffer[usIndex];
     =20 printk("Sent:          = psc=3D%x=20 status=3D%04x tfstat=3D%04x rfstat=3D%04x mode=3D%02x\n   = tfnum %3d =20 rfnum %3d\n",
       =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
       =20 g_pPSC->tfnum, g_pPSC->rfnum);
   }
  =20 g_pPSC->command =3D MPC52xx_PSC_RX_ENABLE |=20 MPC52xx_PSC_TX_ENABLE;
   usTemp =3D 0;
  =20 while(g_pPSC->tfnum)
   = {
     =20 printk("TFNUM Wait:   psc=3D%x status=3D%04x tfstat=3D%04x = rfstat=3D%04x=20 mode=3D%02x\n   tfnum %3d  rfnum=20 %3d\n",
       =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
       =20 g_pPSC->tfnum, g_pPSC->rfnum);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 udelay(100000);
     =20 usTemp++;
      if(usTemp =3D=3D 10)=20 return(-1);
   };
  =20 printk("TxRDY:         psc=3D%x=20 status=3D%04x tfstat=3D%04x rfstat=3D%04x mode=3D%02x\n   = tfnum %3d =20 rfnum %3d\n",
    =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
    =20 g_pPSC->tfnum, g_pPSC->rfnum);
   for(usIndex=3D0;=20 usIndex<p_usCount; usIndex++)
  =20 {
      usTemp =3D=20 0;
      = while(!(g_pPSC->mpc52xx_psc_status &=20 MPC52xx_PSC_SR_RXRDY))
     =20 {
         printk("RxRDY=20 Wait:    psc=3D%x status=3D%04x tfstat=3D%04x = rfstat=3D%04x=20 mode=3D%02x\n   tfnum %3d  rfnum=20 %3d\n",
          =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
        =   =20 g_pPSC->tfnum,=20 g_pPSC->rfnum);
        =20 udelay(100000);
        =20 udelay(100000);
        =20 udelay(100000);
        =20 udelay(100000);
        =20 udelay(100000);
        =20 usTemp++;
         if(usTemp = =3D=3D 10)=20 return(-1);
     =20 };
     =20 printk("RxRDY:         psc=3D%x=20 status=3D%04x tfstat=3D%04x rfstat=3D%04x mode=3D%02x\n   = tfnum %3d =20 rfnum %3d\n",
       =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
       =20 g_pPSC->tfnum, g_pPSC->rfnum);
     =20 p_usBuffer[usIndex] =3D=20 g_pPSC->mpc52xx_psc_buffer_16;
     =20 printk("  Received %04x\n", p_usBuffer[usIndex]);
  =20 }
 
  =20 printk("EXIT:          = psc=3D%x=20 status=3D%04x tfstat=3D%04x rfstat=3D%04x mode=3D%02x\n   = tfnum %3d =20 rfnum %3d\n",
    =20 (int)g_pPSC,g_pPSC->mpc52xx_psc_status,g_pPSC->tfstat,g_pPSC->tf= stat,g_pPSC->mode,
    =20 g_pPSC->tfnum, g_pPSC->rfnum);
  =20 return(usIndex);
}
 

----------------------------------------------------------------= -----------
Output
------------------------------------------------= ---------------------------
The=20 lines below are a capture of register settings from my driver,
along = with=20 output lines when trying to write 16 bit words to our
device.  = This=20 output is consistent whether the device is connected
or not (via = J21). =20 Basic operation, delimited by "------...---":
 
  - Disable TX, Enable RX (despite the "TX-RX Enable"=20 heading)
  - Send word 1
  - Send word 2
  - = Enable TX,=20 Enable RX
  - Wait for tfnum =3D=3D 0
  - Receive=20 data
 
port_config=3D91051624 sicr=3D0280f000 = clk_enables=3D00ffffff=20 div_psc3=3D800f
------------------------------------------------------=
Entry:        =20 psc=3Df0002400 status=3D0400 tfstat=3D0003 rfstat=3D0003 = mode=3D33
  =20 tfnum   0  rfnum   0
TX-RX Enable: =20 psc=3Df0002400 status=3D0400 tfstat=3D0003 rfstat=3D0003 = mode=3D33
  =20 tfnum   0  rfnum   0
Sending 0880: =20 psc=3Df0002400 status=3D0400 tfstat=3D0003 rfstat=3D0003 = mode=3D07
  =20 tfnum   0  rfnum  =20 0
Sent:          = psc=3Df0002400=20 status=3D0000 tfstat=3D0002 rfstat=3D0002 mode=3D07
   = tfnum  =20 2  rfnum   0
Sending bb00:  psc=3Df0002400 = status=3D0000=20 tfstat=3D0002 rfstat=3D0002 mode=3D07
   tfnum   = 2 =20 rfnum  =20 0
Sent:          = psc=3Df0002400=20 status=3D0000 tfstat=3D0002 rfstat=3D0002 mode=3D07
   = tfnum  =20 4  rfnum   0
TFNUM Wait:   psc=3Df0002400 = status=3D0000=20 tfstat=3D0002 rfstat=3D0002 mode=3D07
   tfnum   = 2 =20 rfnum   = 0
TxRDY:        =20 psc=3Df0002400 status=3D0500 tfstat=3D0003 rfstat=3D0003 = mode=3D07
  =20 tfnum   0  rfnum  =20 4
RxRDY:         = psc=3Df0002400=20 status=3D0500 tfstat=3D0003 rfstat=3D0003 mode=3D07
   = tfnum  =20 0  rfnum   4
  Received=20 ffff
RxRDY:         = psc=3Df0002400=20 status=3D0500 tfstat=3D0003 rfstat=3D0003 mode=3D07
   = tfnum  =20 0  rfnum   2
  Received=20 ffff
EXIT:          = psc=3Df0002400=20 status=3D0400 tfstat=3D0003 rfstat=3D0003 mode=3D07
   = tfnum  =20 0  rfnum  =20 0
------------------------------------------------------
Entry:&nbs= p;       =20 psc=3Df0002400 status=3D0400 tfstat=3D0003 rfstat=3D0003 = mode=3D07
  =20 tfnum   0  rfnum   0
TX-RX Enable: =20 psc=3Df0002400 status=3D0400 tfstat=3D0003 rfstat=3D0003 = mode=3D33
  =20 tfnum   0  rfnum   0
Sending 8820: =20 psc=3Df0002400 status=3D0400 tfstat=3D0003 rfstat=3D0003 = mode=3D07
  =20 tfnum   0  rfnum  =20 0
Sent:          = psc=3Df0002400=20 status=3D0000 tfstat=3D0002 rfstat=3D0002 mode=3D07
   = tfnum  =20 2  rfnum   0
Sending 0000:  psc=3Df0002400 = status=3D0000=20 tfstat=3D0002 rfstat=3D0002 mode=3D07
   tfnum   = 2 =20 rfnum  =20 0
Sent:          = psc=3Df0002400=20 status=3D0000 tfstat=3D0002 rfstat=3D0002 mode=3D07
   = tfnum  =20 4  rfnum   0
TFNUM Wait:   psc=3Df0002400 = status=3D0000=20 tfstat=3D0002 rfstat=3D0002 mode=3D07
   tfnum   = 2 =20 rfnum   = 0
TxRDY:        =20 psc=3Df0002400 status=3D0500 tfstat=3D0003 rfstat=3D0003 = mode=3D07
  =20 tfnum   0  rfnum  =20 4
RxRDY:         = psc=3Df0002400=20 status=3D0500 tfstat=3D0003 rfstat=3D0003 mode=3D07
   = tfnum  =20 0  rfnum   4
  Received=20 ffff
RxRDY:         = psc=3Df0002400=20 status=3D0500 tfstat=3D0003 rfstat=3D0003 mode=3D07
   = tfnum  =20 0  rfnum   2
  Received=20 ffff
EXIT:          = psc=3Df0002400=20 status=3D0400 tfstat=3D0003 rfstat=3D0003 mode=3D07
   = tfnum  =20 0  rfnum   0
------=_NextPart_000_00EE_01C68A46.09E05B40--