Clkout0 on Mini2440

lgm42
I would like to use the clkout0 pin on my Mini2440.
Unfortunately i don't find anything on this pin in the mach-mini2440.c
source file.

So i have little modifications in the mach-mini2440.c from the
mach-anubis.c

I add the structure which describe the clocks :

static struct clk *mini2440_clocks[] __initdata = {
  &s3c24xx_dclk0,
  &s3c24xx_dclk1,
  &s3c24xx_clkout0,
  &s3c24xx_clkout1,
  &s3c24xx_uclk,
};

I use these structures in the mini2440_map_io() function :

static void __init mini2440_map_io(void)
{
  //MODIF NHI Le 23/01/12 : Ajout de la gestion du clkout
  /* initialise the clocks */

  s3c24xx_dclk0.parent = &clk_upll;
  s3c24xx_dclk0.rate   = 12*1000*1000;

  s3c24xx_dclk1.parent = &clk_upll;
  s3c24xx_dclk1.rate   = 24*1000*1000;

  s3c24xx_clkout0.parent  = &s3c24xx_dclk0;
  s3c24xx_clkout1.parent  = &s3c24xx_dclk1;

  s3c24xx_uclk.parent  = &s3c24xx_clkout1;

  s3c24xx_register_clocks(mini2440_clocks, ARRAY_SIZE(mini2440_clocks));

  //FIN MODIF
  s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
  s3c24xx_init_clocks(12000000);
  //s3c24xx_init_clocks(0);
  s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));

  s3c_device_nand.dev.platform_data = &mini2440_nand_info;
  s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
}

I also change the KConfig of the arch/arm/mach-S3C2440 to add the line
select S3C24XX_DCLK
in the config MACH_MINI2440 part.

I recompiled my kernel .... and nothing .... there is no clock on my
clkout0 et clkout1 pins.

Have you an Idea of the thing i could forget ???

Juergen Beisert
Did you also configure "GPH9" for its function as "CLKOUT0"? If not, there
will be never a clock signal at this pin.

lgm42
I will try it and i make a callback.
thanks.

lgm42
It seems to work !!
Thank you very much.
It remains a problem on the frequency of my clkout0. the frequency hasn't
changed even if I change the rate of the dclk0.
I don't really understand the maen of dclk and uclk...

Juergen Beisert
Did you read the datasheet of the S3C2440 CPU? Chapter 7 "CLOCK & POWER
MANAGEMENT"?

lgm42
I read it after I posted my last message....
and find I can't make the frequency I would like to make with this pin
(around 2MHz), so I will add an extern oscillator.

Juergen Beisert
The clock out pins are more to monitor the internal clocks, not to generate
one for external use. For external use you should read the chapter 10 "PWM
TIMER" instead. Only timer 4 is used by the kernel, the other timers are
free to use.

lgm42
Thank you very much for this hint ! 
I will have a look because I've seen GPB1 is also available on the GPIO
interface. 
Do you know if on the kernel there is some functions to drive PWM ?

Juergen Beisert
A little PWM framework is present for the S3C2440. But you need a small
driver to make use of it, and give yourself control to userland.

lgm42
Thank you.
I use the pwm driver wich is used to drive buzzer.
I have to make some modifications to operate and it will be ok for my
frequency.