I2s driver - sorry for the last unreadable mail
Pedro just send me this routine:
static int I2S_setup(){int i;
// u32 val32;
// CDM
&nbs= p; struct mpc52xx_cdm __iomem *cdm;
//
// /* GPIO= Modification */
struct mpc52xx_gpio __iomem *gpio;
// /* END GPIO Modification */
//
&nb= sp; cdm =3D ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE)= ; gpio =3D ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), M= PC52xx_GPIO_SIZE); //
switch(psc_num) {
= case 1:
&= nbsp; initiator_tx =3D SDMA_INITIATOR_PSC1_TX;
= initiator_rx =3D SDMA_IN= ITIATOR_PSC1_RX;
 = ; break;
case 2:
&nb= sp; initiator_tx =3D SDMA_INITIATOR_P= SC2_TX; initiat= or_rx =3D SDMA_INITIATOR_PSC2_RX;
= break;
default:=
panic("snd-I2S= mgt.o: invalid value for psc_num (%i)\n",psc_num); &n= bsp; break;
};
= /* 528MHz/(0x1f+1)=3D16.5 MHz */
c= dm->mclken_div_psc2 =3D 0x8001; // Mhz MCLK ( Khz * )
&nb= sp; psc->command =3D (MPC52xx_PSC_TX_DISABLE | MPC52xx_PSC_RX_DISABLE); /* PSC2 CODEC with Master Clock */ &nb= sp; gpio->port_config |=3D 0x70;
/* PSC2 clock ena= ble */
cdm->clk_enables |=3D 0x40;
 = ; // PSC reset
psc->command =3D MPC52xx_PSC_= RST_RX; psc->command =3D MPC52xx_PSC_RST_TX;
&n= bsp; psc->command =3D MPC52xx_PSC_SEL_MODE_REG_1; &= nbsp; psc->command =3D MPC52xx_PSC_RST_ERR_STAT;
// PSC setup I2S
psc->mod= e =3D 0;
psc->rfalarm =3D RX_ALARM;
 = ; psc->tfalarm =3D TX_ALARM;
psc->r= fcntl =3D RX_GRAN;
psc->tfcntl =3D TX_GRAN; psc->mpc52xx_psc_imr =3D 0x0000;
&nbs= p; psc->sicr =3D 0x0FE00000;
psc->ctur = =3D 0x1f; //Frame length 0x17
psc->ccr =3D 0x3= f5D; //LRCK KHz, BitCLK MHz 0x3f05!
//  = ; psc->sicr |=3D /* DELAY_TIME_SLOT |*/ MULTIWD_ENABLE | CLK_POL_RISING; // =
// psc->sicr |=3D GEN_CLK_INT;
&nbs= p; psc->command =3D MPC52xx_PSC_RST_RX;  = ; psc->command =3D MPC52xx_PSC_RST_TX; psc->com= mand =3D MPC52xx_PSC_SEL_MODE_REG_1; psc->command = =3D MPC52xx_PSC_RST_ERR_STAT; //
// // setup the = sdma tasks
tx_sdma =3D sdma_alloc(PERIODS_HW+1); &= nbsp; rx_sdma =3D sdma_alloc(PERIODS_HW+1);
= if (!tx_sdma || !rx_sdma) {
= printk("sdma_alloc failed\n");
re= turn -ENOMEM;
}
// asimmini
/= / sdma_gen_bd_rx_init(rx_sdma, (phys_addr_t)&(psc-&g= t;rfdata), PERIODSIZE_HW, initiator_rx, 6);
sdma_gen_bd_rx_init(0, rx_sdma, (phys_addr_t)&(psc->rfdata), initia= tor_rx, 6,PERIODSIZE_HW);
// sdma_gen_bd_tx_init(tx_s= dma, (phys_addr_t)&(psc->tfdata), PERIODSIZE_HW, initiator_tx, 6); sdma_gen_bd_tx_init(0, tx_sdma, (phys_addr_t)&(psc= ->tfdata), initiator_tx, 6);
printk("txtask is= %d rxtask is %d\n", tx_sdma->tasknum, rx_sdma->tasknum); //
&= nbsp; // prepare the ring buffers ASIMMINI //for(i=3D0;i
//  = ; tasknum %d\n", sdma_irq(rx_sdma), MPC52xx_SDMA_IRQ_BASE + rx_sdma->tas= knum); if (request_irq(sdma_irq(rx_sdma), I2S_rx_irq,= 0, "SPI rx dma", NULL)){ printk(K= ERN_ERR "SPI: SDMA rx irq allocation failed\n");
&nbs= p; return -EINVAL;
}
else
prin= tk("SPI: SDA rx irq allocation succeded\n");
if (requ= est_irq(sdma_irq(tx_sdma), I2S_tx_irq, 0, "SPI tx dma", NULL)){ &n= bsp; printk(KERN_ERR "SPI: SDMA tx irq allocation = failed\n");
return -EINVAL;
&nb= sp; }
else
&= nbsp; printk("SPI: SDA tx irq allocation succeded\n");
 = ;
//
// // clear any pending interrupts sdma_clear_irq(tx_sdma);
sdma_cle= ar_irq(rx_sdma);
//
printk("Before activating the= tasks\n");
// // activate the tasks
// &nbs= p; sdma_enable(tx_sdma);
// sdma_enable(rx_sdma= );
//
// printk("about to enable SPI psc\n");
udelay(100);
//
//  = ; // enable transmitter and receiver
psc->command = =3D MPC52xx_PSC_TX_ENABLE | MPC52xx_PSC_RX_ENABLE;
// // &nbs= p; psc->command =3D MPC52xx_PSC_TX_ENABLE;
//
//
// // = I2S_print(__FUNCTION__);
//
// // pc= m1680_read();
// // pcm1= 680_configure(44100);
// // pcm1680_read();
= return 0;
}
But i have some problems.
i don't= have any of thiese functions:
sdma_allocrx_sdma
sdma_gen_bd_= rx_initsdma_gen_bd_tx_initsdma_irqsdma_clear_irq
and som= e define:I2S_rx_irqI2S_tx_irq
=0A= =0A=0A=0A=0A =0AInviato da Yahoo! Mai= l.=0A
=0AIl servizio di posta con lo spazio illimitato.