Hello All,

I am a newbe with kernel development and I would appreciate some hint.
Here is a chunk of code for kernel 2.6.26 which is obviously doesn't fit
new platform driver model and other recent changes. How this
initialization can be done now?
---------------------------------

#define     IO_PHYS        0x01c00000
#define     IO_OFFSET   0xfd000000     /* Virtual IO = 0xfec00000 */
#define     IO_SIZE         0x00400000
#define     IO_VIRT        (IO_PHYS + IO_OFFSET)
#define     io_p2v(pa)    ((pa) + IO_OFFSET)
#define     io_v2p(va)    ((va) - IO_OFFSET)
typedef struct { volatile u32 offset[4096]; } __regbase32;
#define     IO_ADDRESS(x)    io_p2v(x)
#define     __REGV32(vaddr)    ((__regbase32 *)((vaddr)&~4095))
->offset[((vaddr)&4095)>>2]
#define     __REG(paddr)        __REGV32(io_p2v(paddr))

#define    PINMUX1           __REG(0x01C40004)
#define    PWM0_PCR        __REG(0x01C22004)
#define    PWM0_CFG       __REG(0x01C22008)
#define    PWM0_START    __REG(0x01C2200C)
#define    PWM0_PER        __REG(0x01C22014)
#define    PWM0_PH1D    __REG(0x01C22018)

static    void    init_38khz(void)
{
    PINMUX1 |= (1<<4);  //set gio45/PWM0 pin works as PWM0
    PWM0_PCR = 1;
    PWM0_CFG &= ~2; //clear PWM0 mode
    PWM0_CFG |= 2; //set PWM0 contiguous mode
    /* PWM0_PER+1=PWM0_PH1D*2 */
    /* PWM config PWM 38kHz PER=709 PH1D=355 */
    PWM0_PER = 709;
    PWM0_PH1D = 355;
    PWM0_START = 1;
}

---------------------------------


-- 
Best regards
Andrey A. Porodko
 




-- 
Best regards
Andrey A. Porodko
 


_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to