AnsweredAssumed Answered

How to Enable CKO2 in u-boot

Question asked by Chris Roed on Dec 15, 2015
Latest reply on Dec 17, 2015 by Chris Roed

I need to enable CKO2 in uboot with a 24mhz output frequency.  I've added this function which is called in board_init()

 

 

static void setup_camera_clk(void)

{

  struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;

  int reg;

 

  //set pinmux

SETUP_IOMUX_PAD(PAD_GPIO_3__CCM_CLKO2 | 0x000000b0);  //this is how the pin is set up in device tree

 

  //enable clock output

  reg = readl(&mxc_ccm->ccosr);

  printf("ccosr is 0x%x\n",reg);

  reg |= (MXC_CCM_CCOSR_CKO2_EN_OFFSET                    //CKO2 enabled

       | MXC_CCM_CCOSR_CLK_OUT_SEL                                 //CKO2 output is selected

       | (0x0e << MXC_CCM_CCOSR_CKO2_SEL_OFFSET)     //clock is derived from osc_clk, should be 24mhz

  );

  printf("writing ccosr to 0x%x\n",reg);

  writel(reg, &mxc_ccm->ccosr);

}

 

It looks like this is setting the registers, but my clock is not outputting.

First of all, is this the proper way to set the pinmux from u-boot?

Second of all, I noticed that some clocks get disabled in u-boot, although I would assume the osc_clk is derived from the main crystal and should be running...  Either way I'm not sure I chose correctly.

Outcomes