How to Enable CKO2 in u-boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Enable CKO2 in u-boot

744 Views
chrisroed
Contributor IV

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.

0 Kudos
2 Replies

440 Views
igorpadykov
NXP Employee
NXP Employee

Hi Chris

most simple way is to connect jtag (or output with debug printfs) register

CCM_CCOSR_CKO2 and its address. Issue may be related to different

addresses, since memory map for each i.MX6 processor is different.

So it is necessary to use appropriate Reference Manual.

Best regards

igor

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

Note: If this post answers your question, please click the Correct Answer button. Thank you!

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

0 Kudos

440 Views
chrisroed
Contributor IV

Hello Igor,

I was writing to the correct addresses.

I ended up changing the iomux to

SETUP_IOMUX_PAD(PAD_GPIO_3__XTALOSC_REF_CLK_24M | MUX_PAD_CTRL(NO_PAD_CTRL));

And that got my 24mhz clock going.  Thanks for the response!

0 Kudos