Hi! > I used to delve into zaurus code for awhile ago. There are some local changes > left from that time. > One thing is the change to pxa pcmcia timings. > Here's the original code from 2.6.16: > > static inline u_int pxa2xx_mcxx_hold(u_int pcmcia_cycle_ns, > u_int mem_clk_10khz) > { > u_int code = pcmcia_cycle_ns * mem_clk_10khz; > return (code / 300000) + ((code % 300000) ? 1 : 0) - 1; > } > > static inline u_int pxa2xx_mcxx_asst(u_int pcmcia_cycle_ns, > u_int mem_clk_10khz) > { > u_int code = pcmcia_cycle_ns * mem_clk_10khz; > return (code / 300000) + ((code % 300000) ? 1 : 0) - 1; > } > > static inline u_int pxa2xx_mcxx_setup(u_int pcmcia_cycle_ns, > u_int mem_clk_10khz) > { > u_int code = pcmcia_cycle_ns * mem_clk_10khz; > return (code / 100000) + ((code % 100000) ? 1 : 0) - 1; > } > > I don't know the original reasons why the timings are calculated in this way. > My guess that it's sa1100 adapted to pxa. But the pxa has more control of the > bus cycle. After looking at pxa docs and CF/PCMCIA standard I've changed > the formula to the following: > > static inline u_int pxa2xx_mcxx_hold(u_int hold, > u_int mem_clk_10khz) > { > u_int code = hold * mem_clk_10khz; > return (code / 100000) + ((code % 100000) ? 1 : 0); > } > > static inline u_int pxa2xx_mcxx_asst(u_int cas, > u_int mem_clk_10khz) > { > u_int code = cas * mem_clk_10khz; > if(code % 300000 > 200000) return code/300000; > else return code/300000-1; > } > > static inline u_int pxa2xx_mcxx_setup(u_int set, > u_int mem_clk_10khz) > { > u_int code = set * mem_clk_10khz; > return (code / 100000) + ((code % 100000) ? 1 : 0) - 2; > } > > The functions above take specific time as a parameter, not the whole cycle > length. > For example, pxa2xx_pcmcia_set_mcio looked like this: > static int pxa2xx_pcmcia_set_mcio( int sock, int speed, int clock ) > { > u_int set, cas, hold; > > if(speed == 255) { > set = 70; > hold = 20; > cas = 165; > > > Although I can't guarantee that my calculations are correct, it worked with > all of my CF cards on c3000. > If anyone is interested, I can prepare the patch.
Yes, patch would be nice. I am currently debugging some PCMCIA problems... Question: is/was there situation where your version worked but old one did not? Does it provide faster data rates? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html _______________________________________________ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel