This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

question about DMtimer, how to use 2 DMtimer in 1 module?

Dear sir

question about DMtimer, how to use 2 DMtimer in 1 moudle?

I tested the timer 1 and 2.

There is no problem at the time of each operation.

But I do not know how to initialize a timer two well.

1. .dts file

//===================================

 am33xx_module_timer4 {
  compatible = "am33xx_module_timer4";
  status = "okay";
  pinctrl-names = "default";
  pinctrl-0 = <&timer4_pins_default>;
  pinctrl-1 = <&timer4_pins_sleep>;
  DMtimer4 = <&timer4>;
 };

 am33xx_module_timer7 {
  compatible = "am33xx_module_timer4";
  status = "okay";
  pinctrl-names = "default";
  pinctrl-0 = <&timer7_pins_default>;
  pinctrl-1 = <&timer7_pins_sleep>;
  DMtimer7 = <&timer7>;
 };

//=======================================

2. module inital

//=======================================

static int print_module_init(struct platform_device *pdev)

{

.

/* Attempt to request a timer based on the device node */
 timer_device_node = of_parse_phandle(pdev->dev.of_node, "DMtimer4", 0);   
 SGTDev.timer_ptr = omap_dm_timer_request_by_node(timer_device_node);

 if(SGTDev.timer_ptr == NULL){
  /* no timers available */
  printk(KERN_INFO "Can't request specified DM Timer\n");
  return -1;
 }  

.

.

.
 /* Attempt to request a timer based on the device node */
 timer_device_node = of_parse_phandle(pdev->dev.of_node, "DMtimer7", 1);   
 SGTDev.timer7_ptr = omap_dm_timer_request_by_node(timer_device_node);

 if(SGTDev.timer_ptr7 == NULL){
  /* no timers available */
  printk(KERN_INFO "Can't request specified DM Timer\n");
  return -1;
 }  

.

.

}

static const struct of_device_id test_module_timer_of_match[] = {
 { .compatible   = "am33xx_module_timer4" },
};

//============================================

What should I do to fix it?

best regards 

  • Hi,

    I will ask the Linux team to check this.
  • Hi,

    Which SDK release is this? I couldn't find the code fragments in 2. module inital when I ran grep command in the kernel sources of the latest TI SDK, I guess you've customized the driver.  

    Also the timer device tree nodes seem strange to me.. In official TI releases you have the following definition in am33xx.dtsi:

    timer4: timer@48044000 {

                compatible = "ti,am335x-timer";

                reg = <0x48044000 0x400>;

                interrupts = <92>;

                ti,hwmods = "timer4";

                ti,timer-pwm;

    };

    AND

    timer7: timer@4804a000 {

                 compatible = "ti,am335x-timer";

                 reg = <0x4804a000 0x400>;

                 interrupts = <95>;

                 ti,hwmods = "timer7";

                 ti,timer-pwm;

    };

    To enable timer4 & timer7 in your kernel you need to add pinmux settings & the following two nodes in your .dts file:

    &timer4 {

                 pinctrl-names = "default";

                 pinctrl-0 = <&timer4_pins_default>;

                 status = "okay";

    }

    &timer7 {

                 pinctrl-names = "default";

                 pinctrl-0 = <&timer7_pins_default>;

                 status = "okay";

    }

    And the dmtimer driver will initialize both timers without modifying it. 

    Best Regards, 

    Yordan

  • hi

    First of all, thank you for your thoughtful response.

    but I still have problems with the DMtimer.

    I have same problems.




    1. .dts file

    timer4 {
    compatible = "ti,am335x-timer";
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&timer4_pins_default>;
    pinctrl-1 = <&timer4_pins_sleep>;
    DMtimer = <&timer4>;
    };

    timer7 {
    compatible = "ti,am335x-timer";
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&timer7_pins_default>;
    pinctrl-1 = <&timer7_pins_sleep>;
    DMtimer1 = <&timer7>;
    };




    2. module .C file

    timer_device_node = of_parse_phandle(pdev->dev.of_node, "DMtimer", 0);

    SGTDev.timer_ptr = omap_dm_timer_request_by_node(timer_device_node);

    if(SGTDev.timer_ptr == NULL){

    printk( "\n\nCan't request specified DM Timer4\n\n");
    return -1;
    }
    else
    {
    printk( "\n\nOK request specified DM Timer4\n\n");
    }




    timer_device_node = of_parse_phandle(pdev->dev.of_node, "DMtimer1", 1);


    SGTDev.stb = omap_dm_timer_request_by_node(timer_device_node);


    if(SGTDev.stb == NULL){
    printk( "\n\nCan't request specified DM Timer7\n\n");
    return -1;
    }
    else
    {
    printk( "\n\nOK request specified DM Timer7\n\n");

    }




    3. match table

    static const struct of_device_id test_module_timer_of_match[] = {
    { .compatible = "ti,am335x-timer" },
    };




    4. error message[ 24.134385] DM timer1: starting moudle init
    [ 24.139298] OK request specified DM Timer4
    [ 24.152860] Can't request specified DM Timer7
    [ 24.162884] timer irq: probe of timer4.10 failed with error -1




    I ask you for a check of the above problems.

    Thank you for answer.
  • Does anyone find the solution of above problem?
    I have gone through DMTimer.c file and understood that you can request timer by either id or timer capability or node. I have tried all three methods, but still not able to configiure specified timer. I want to configure timer 7 for input capture functionality. I'm using beaglebone black with following configuration
    Ti sdk = 02.00.01.07
    uname -r = linux-4.1.13
    Can anyone shed light on this issue??
    Regards,
    Amey