2005-09-07 20:20:26 +04:00
/ *
2006-10-04 01:01:26 +04:00
* linux/ a r c h / a r m / p l a t - o m a p / s r a m - f n . S
2005-09-07 20:20:26 +04:00
*
* Functions t h a t n e e d t o b e r u n i n i n t e r n a l S R A M
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
2008-08-05 19:14:15 +04:00
# include < m a c h / i o . h >
# include < m a c h / h a r d w a r e . h >
2005-09-07 20:20:26 +04:00
.text
/ *
* Reprograms U L P D a n d C K C T L .
* /
2008-07-03 13:24:38 +04:00
ENTRY( o m a p1 _ s r a m _ r e p r o g r a m _ c l o c k )
2005-09-07 20:20:26 +04:00
stmfd s p ! , { r0 - r12 , l r } @ save registers on stack
mov r2 , #I O _ A D D R E S S ( D P L L _ C T L ) & 0xff000000
orr r2 , r2 , #I O _ A D D R E S S ( D P L L _ C T L ) & 0x00ff0000
orr r2 , r2 , #I O _ A D D R E S S ( D P L L _ C T L ) & 0x0000ff00
mov r3 , #I O _ A D D R E S S ( A R M _ C K C T L ) & 0xff000000
orr r3 , r3 , #I O _ A D D R E S S ( A R M _ C K C T L ) & 0x00ff0000
orr r3 , r3 , #I O _ A D D R E S S ( A R M _ C K C T L ) & 0x0000ff00
tst r0 , #1 < < 4 @ want lock mode?
beq n e w c k @ nope
bic r0 , r0 , #1 < < 4 @ else clear lock bit
strh r0 , [ r2 ] @ set dpll into bypass mode
orr r0 , r0 , #1 < < 4 @ set lock bit again
newck :
strh r1 , [ r3 ] @ write new ckctl value
strh r0 , [ r2 ] @ write new dpll value
mov r4 , #0x0700 @ let the clocks settle
orr r4 , r4 , #0x00ff
delay : sub r4 , r4 , #1
cmp r4 , #0
bne d e l a y
lock : ldrh r4 , [ r2 ] , #0 @ read back dpll value
tst r0 , #1 < < 4 @ want lock mode?
beq o u t @ nope
tst r4 , #1 < < 0 @ dpll rate locked?
beq l o c k @ try again
out :
ldmfd s p ! , { r0 - r12 , p c } @ restore regs and return
2008-07-03 13:24:38 +04:00
ENTRY( o m a p1 _ s r a m _ r e p r o g r a m _ c l o c k _ s z )
.word . - omap1 _ s r a m _ r e p r o g r a m _ c l o c k