[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ltib] simple PWM driver for LPC3250

From: Li Yuan-Lung
Subject: [Ltib] simple PWM driver for LPC3250
Date: Thu, 9 Sep 2010 17:16:09 +0800

Dear NXP guys,
I am trying to implement the simple PWM driver for LPC3250 under linux kernel 2.6.34.
Now I am stuck at the register writing. It's seems the Simple-PWM 1 and 2 were not functional.
Using raw_readl and raw_writel to the LPC32XX_CLKPWR_PWM_CLK_CTRL register is work, but which causes segmentation fault to the LPC32XX_PWM1_BASE and LPC32XX_PWM2_BASE.

Please kindly reply to me with some suggestion, thank you.

Here is my partial code in driver module:
//HW init first
tmp = __raw_readl(LPC32XX_CLKPWR_PWM_CLK_CTRL);
printk(KERN_ERR PWM_DRVNAME ": PWM clk reg value 0x%x\n", tmp);


__raw_writel(tmp, LPC32XX_CLKPWR_PWM_CLK_CTRL);//Turn On PWM1 and PWM2

tmp = __raw_readl(LPC32XX_CLKPWR_PWM_CLK_CTRL);
printk(KERN_ERR PWM_DRVNAME ": PWM clk reg value = 0x%x after write.\n", tmp);

tmp = LPC32XX_PWM1_EN | LPC32XX_PWM1_DUTY(127) | LPC32XX_PWM1_RELOADV(10);// 13M/10/256 = 5k
__raw_writel(tmp, LPC32XX_PWM1_BASE);
tmp = LPC32XX_PWM2_EN | LPC32XX_PWM2_DUTY(127) | LPC32XX_PWM2_RELOADV(10);
__raw_writel(tmp, LPC32XX_PWM2_BASE);

tmp = __raw_readl(LPC32XX_PWM1_BASE);
printk(KERN_ERR PWM_DRVNAME ": PWM1 reg value = 0x%x.\n", tmp);
tmp = __raw_readl(LPC32XX_PWM2_BASE);
printk(KERN_ERR PWM_DRVNAME ": PWM2 reg value = 0x%x.\n", tmp);

The result:
# insmod pwm.ko
pwmd: PWM clk reg value 0x0
pwmd: PWM clk reg value = 0x11f after write.
Unable to handle kernel paging request at virtual address 4005c000
pgd = c3d78000
[4005c000] *pgd=00000000
Internal error: Oops: 805 [#1] PREEMPT
last sysfs file:
Modules linked in: pwm(+)
CPU: 0    Not tainted  (2.6.34 #21)
PC is at pwm_init+0x40/0xdc [pwm]
LR is at schedule+0x2cc/0x34c
pc : [<bf0002d8>]    lr : [<c028ace8>]    psr: 60000013
sp : c3dcff20  ip : c3dcfe40  fp : c3dcff3c
r10: 00000000  r9 : c3dce000  r8 : 00000000
r7 : bf000298  r6 : c0365c6c  r5 : 4005c000  r4 : f4004000
r3 : 80000a7f  r2 : 00000000  r1 : 00000000  r0 : bf0004e0
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 0005317f  Table: 83d78000  DAC: 00000015
Process insmod (pid: 393, stack limit = 0xc3dce270)
Stack: (0xc3dcff20 to 0xc3dd0000)
ff20: 0000001d 0000001d 00000000 bf0005c4 c3dcff7c c3dcff40 c00253a8 bf0002a8
ff40: 00011585 bf0005c4 00000000 001361b0 c0026068 00000000 c3dcff7c 00000000
ff60: bf0005c4 00000000 001361b0 c0026068 c3dcffa4 c3dcff80 c00717e8 c0025358
ff80: c00a4654 c00a3048 00000000 00000000 00000000 00000080 00000000 c3dcffa8
ffa0: c0025ec0 c0071730 00000000 00000000 001361b0 00011585 00135fd8 00000000
ffc0: 00000000 00000000 00000000 00000080 00135fc0 00000040 00135fa8 bea0de94
ffe0: bea0d740 bea0d730 000a7e10 000093c0 a0000010 001361b0 80421031 80421431
[<bf000298>] (pwm_init+0x0/0xdc [pwm]) from [<c00253a8>] (do_one_initcall+0x60/0x1ac)
 r5:bf0005c4 r4:00000000
[<c0025348>] (do_one_initcall+0x0/0x1ac) from [<c00717e8>] (sys_init_module+0xc8/0x1f8)
 r8:c0026068 r7:001361b0 r6:00000000 r5:bf0005c4 r4:00000000
[<c0071720>] (sys_init_module+0x0/0x1f8) from [<c0025ec0>] (ret_fast_syscall+0x0/0x2c)
 r7:00000080 r6:00000000 r5:00000000 r4:00000000
Code: eb411323 e59f5080 e59f3080 e59f0080 (e5853000)
---[ end trace 2fda102ac79baf84 ]---
Segmentation fault

Best Regards,

Henry Li
SW Engineer of Climax Co.
TEL: +886-2-2794-0001 ext.231
FAX: +886-2-2792-6618

reply via email to

[Prev in Thread] Current Thread [Next in Thread]