imx6ull read register causes the system to die

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

imx6ull read register causes the system to die

1,858 Views
Boy_club
Contributor II

Hi

   I read/write register(0x20e8000) in the driver, the system will die. The serial port has no error message.

   I check that no other code in the kernel uses this register.

   But this register(0x20e0048) can read/write.

#define GPT 0x20e0048
#define GPT2_CR     0x20e8000

static void __iomem *jtag_tms;
static void __iomem *gpt2_cr;

int init_gpt2(void)
{
    int reg;
    printk("init gpt2\n");

    //if(!request_mem_region(GPT2_CR, 8, "GPT2_CR")){
    //  return -EINVAL;
    //}

    jtag_tms = ioremap(GPT, 4);
    gpt2_cr = ioremap(GPT2_CR, 4);

    reg = readl(jtag_tms);
    printk("JTAG_TMS Mode1 = 0x%x\n", reg);
    reg = 0x01;
    writel(reg, jtag_tms);
    reg = readl(jtag_tms);
    printk("JTAG_TMS Mode2 = 0x%x\n", reg);

    reg = readl(gpt2_cr);
    printk("GPT2 CR = 0x%x\n", reg);

    iounmap(jtag_tms);
    iounmap(gpt2_cr);
//  release_mem_region(GPT2_CR, 8);

    return 0;
}

  

 Please help me , Thanks to all!

Labels (4)
3 Replies

1,003 Views
radhikasomaiya
Senior Contributor II

Hi Boy_club ,

As suggested by igorpadykov , from attached i.MX6ULL Application processor's reference manual section 18.6.23 we have to set CG12 and CG13 for gpt2 peripheral, So can you please try to read/write register 0x20e8000 after setting the value of CCM_CCGR0 with (0x20c4068=0xcfc03f3f).

 

  •  Read CCM_CCGR0 register :

         root@imx6ul7d:~# /unit_tests/memtool -32 0x20c4068 1
         E
         Reading 0x1 count starting at address 0x020C4068

         0x020C4068: C0C03F0F

  • Write CCM_CCGR0 register :

         root@imx6ul7d:~# /unit_tests/memtool -32 0x20c4068=0xcfc03f3f
         Writing 32-bit value 0xCFC03F3F to address 0x020C4068

  

  • Read 0x20e8000 :

         root@imx6ul7d:~# /unit_tests/memtool -32 0x20e8000 1
         E
         Reading 0x1 count starting at address 0x020E8000

         0x020E8000: 00000000

  • Write 0x20e8000 :

         root@imx6ul7d:~# /unit_tests/memtool -32 0x020E8000=0x00000001
         Writing 32-bit value 0x1 to address 0x020E8000

         root@imx6ul7d:~# /unit_tests/memtool -32 0x20e8000 1
         E
         Reading 0x1 count starting at address 0x020E8000

         0x020E8000: 00000001

         root@imx6ul7d:~#

Regards,

Radhika Somaiya.

1,003 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jim

one can check if clock is enabled for module in CCM_CCGRx register

and look at memtool for examples of register access

memtool\test - imx-test - i.MX Driver Test Application Software 

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

0 Kudos

1,003 Views
Boy_club
Contributor II

Hi igorpadykov,

Thanks for your reply!

I check CCM_CCGR1 register. gpio2_clocks (gpio2_clk_enable)      
./memtool -32 0x20c4068 1
E
Reading 0x1 count starting at address 0x020C4068
0x020C4068:  C0C03F3F

I tried to change the CCM_CCGR1 register.
      
./memtool -32 0x20c4068=0x40c03f3f
Writing 32-bit value 0x40C03F3F to address 0x020C4068

then,

./memtool -32 0x20e8000 1
E
Reading 0x1 count starting at address 0x020E8000

The system will still die.

Thanks!

0 Kudos