ecspi1 on mx51, but no clk got form the pin CSPI1_SCLK

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

ecspi1 on mx51, but no clk got form the pin CSPI1_SCLK

Jump to solution
1,350 Views
zhaozhao
Contributor III

Hi all,

   I am going to use the ecspi1 on mx51, but I can not get the clk form CSPI1_SCLK, the oscillometer ouput nothing.

The PIN MX51_PIN_CSPI1_SCLK is set as  the default.

Using the driver :drivers/spi/mxc_spi.c

the code below has been executed, and there is no error.

master_drv_data->clk = clk_get(&pdev->dev, "cspi_clk");

  

    clk_enable(master_drv_data->clk);

    master_drv_data->spi_ipg_clk = clk_get_rate(master_drv_data->clk);

 

In order to observe the clk of escpi1, I add this at the end of mxc_spi_probe().:

clk_enable(master_drv_data->clk);

To make sure that the clk set is ture. I dump the registers of CCM:

CCGR4: 0xc0350000

anyone can help me on this?

Thanks

Labels (2)
Tags (2)
0 Kudos
1 Solution
903 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello, Zhao,

      I feel you replaced SPI nor Flash with ads7486, and SPI bus num should also be 0, that is .bus_num = 0, if this parameter equals to 1, corresponding SPI port should be CSPI2.

      Would you like to try !

Reagards,

Weidong

View solution in original post

0 Kudos
7 Replies
903 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello,Zhao,

     you don't need to modify spi driver.

     Please tell me the following information :

1. your bsp version.

2. in BSP file (mx51_babbage.c)

(1)Please paste your CSPI1 initialization code here.

(2)Please paste CPSI1 IOMUX code here.

(3)Please paste CPSI1 register code here.

(4)If you use SPI_BOARD_INFO structure , please paste it here.

regards,

Weidong

0 Kudos
903 Views
zhaozhao
Contributor III

Hi, Weidong

      Thank you for your reply.

    1. I'm using a custom mx51 board from third party

the bsp version is  L2.6.31_10.05.02 .

We are using different peripheries,so the kernel has been modified a lot. (But  when I use linux-2.6-imx.git - Freescale i.MX Linux Tree the imx-android-r10.4 branch, I got the same question)

    2. in BSP file(i arm using mx51_3stack.c)

    (1) CSPI1 initialization  ?

    (2) CSPI1 IOMUX code:

static struct mxc_iomux_pin_cfg __initdata mxc_iomux_pins[] = {

   {

     MX51_PIN_CSPI1_MOSI, IOMUX_CONFIG_ALT0,

     (PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_DRV_HIGH |

                  PAD_CTL_SRE_FAST),

     },

    {

     MX51_PIN_CSPI1_SCLK, IOMUX_CONFIG_ALT0,

     (PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_DRV_HIGH |

                  PAD_CTL_SRE_FAST),

     },

     {     

     MX51_PIN_CSPI1_MISO, IOMUX_CONFIG_ALT0,

     (PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_DRV_HIGH |

                  PAD_CTL_SRE_FAST),

     },

}

       (3) CSPI1 register code:

static struct resource mxcspi1_resources[] = {

    {

        .start = CSPI1_BASE_ADDR,

        .end = CSPI1_BASE_ADDR + SZ_4K - 1,

        .flags = IORESOURCE_MEM,

    },

    {

        .start = MXC_INT_CSPI1,

        .end = MXC_INT_CSPI1,

        .flags = IORESOURCE_IRQ,

    },

};

struct platform_device mxcspi1_device = {

    .name = "mxc_spi",

    .id = 0,

    .num_resources = ARRAY_SIZE(mxcspi1_resources),

    .resource = mxcspi1_resources,

};

static struct mxc_spi_master mxcspi1_data = {

    .maxchipselect = 4,

    .spi_version = 23,

    .chipselect_active = mx51_3ds_gpio_spi_chipselect_active,

    .chipselect_inactive = mx51_3ds_gpio_spi_chipselect_inactive,

    //.chipselect_active = mx51_babbage_gpio_spi_chipselect_active,

    //.chipselect_inactive = mx51_babbage_gpio_spi_chipselect_inactive,

};

.......

mxc_register_device(&mxcspi1_device, &mxcspi1_data);

     (4)  SPI_BOARD_INFO

spi_register_board_info(mx51_spi_devices,

                    ARRAY_SIZE(mx51_spi_devices));

.,......

static struct spi_board_info mx51_spi_devices[] __initdata = {

    {

     .modalias = "ads7846",

//     .max_speed_hz = 25000000,  /* max spi clock (SCK) speed in HZ */

     .bus_num = 1,

     .chip_select = 0,

//     .platform_data = &mxc_spi_flash_data[1],},

//     .chip_select    = 3,        /* can be 2 or 3, depending on J2 jumper */

     .max_speed_hz   = 1000000,  /* (max sample rate @ 3V) * (cmd + data + overhead) */

//     .bus_num    = 0,

     .platform_data  = &ads_info,

//     .irq        = AT91_PIN_PC4,

     .irq = IOMUX_TO_IRQ(MX51_PIN_GPIO1_3),

     },

};

is this you need?

With what I have set, I cannot get clk from the pin CSPI1_SCLK.

Thank you.

0 Kudos
904 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello, Zhao,

      I feel you replaced SPI nor Flash with ads7486, and SPI bus num should also be 0, that is .bus_num = 0, if this parameter equals to 1, corresponding SPI port should be CSPI2.

      Would you like to try !

Reagards,

Weidong

0 Kudos
903 Views
zhaozhao
Contributor III

Hi, Weidong

     I change the bus_num to 0, but the question is still there..

     The bus_num seem to select spi for the device ads7846. Now I am trying to get the spi clk ,but still failed. I am not sure that the spi can work normally.

Thank you

0 Kudos
903 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello,Zhao,

        From your settings in BSP, I can't find issue. did you select ads7486 driver when you configure linux kernel by "make menuconfig" command ? In additon, CSPI clock is not continous, when controller comunicate with external device, this clock outputs.

regards,

Weidong

903 Views
zhaozhao
Contributor III

Hi Weidong

     This has been solved.  It seems a hardware circuit problem.

     when I use the flow cmdline, I get the clk.

$ /unit_tests/mxc_spi_test1.out -D 0

There is spi clk output only when data transfering. 

Thank you !

0 Kudos
903 Views
zhaozhao
Contributor III

Hi, Weidong

     Thank you for your reply. I am busy doing other things. I will be back on this question later .

     Thank you!

0 Kudos