r3171 - trunk/src/target/kernel/patches

laforge at sita.openmoko.org laforge at sita.openmoko.org
Mon Oct 15 12:54:15 CEST 2007


Author: laforge
Date: 2007-10-15 12:54:10 +0200 (Mon, 15 Oct 2007)
New Revision: 3171

Modified:
   trunk/src/target/kernel/patches/gta01-vibrator.patch
   trunk/src/target/kernel/patches/s3c2410-pwm.patch
Log:
S3c24xx timer4 doesn't have PWM support, so don't even try to use it for that.
Also, refuse to reconfigure the prescaler 1 (shared between timer 2,3,4), since
that would modify the kernel timer clock tick.


Modified: trunk/src/target/kernel/patches/gta01-vibrator.patch
===================================================================
--- trunk/src/target/kernel/patches/gta01-vibrator.patch	2007-10-15 09:54:48 UTC (rev 3170)
+++ trunk/src/target/kernel/patches/gta01-vibrator.patch	2007-10-15 10:54:10 UTC (rev 3171)
@@ -6,7 +6,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.22.5-moko/drivers/leds/leds-gta01.c
-@@ -0,0 +1,187 @@
+@@ -0,0 +1,188 @@
 +/*
 + * LED driver for the FIC GTA01 (Neo1973) GSM Phone Vibrator
 + *
@@ -100,8 +100,9 @@
 +	struct gta01_vib_priv *vp = pdev_to_vpriv(pdev);
 +
 +	vp->pwm->timerid= PWM3;
-+	vp->pwm->prescaler = 0x0000;
-+	vp->pwm->divider = S3C2410_TCFG1_MUX3_DIV8;
++	/* use same prescaler as arch/arm/plat-s3c24xx/time.c */
++	vp->pwm->prescaler = (6 - 1) / 2;
++	vp->pwm->divider = S3C2410_TCFG1_MUX3_DIV16;
 +	vp->pwm->counter = COUNTER;
 +	vp->pwm->comparer = COUNTER;
 +

Modified: trunk/src/target/kernel/patches/s3c2410-pwm.patch
===================================================================
--- trunk/src/target/kernel/patches/s3c2410-pwm.patch	2007-10-15 09:54:48 UTC (rev 3170)
+++ trunk/src/target/kernel/patches/s3c2410-pwm.patch	2007-10-15 10:54:10 UTC (rev 3171)
@@ -38,7 +38,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.22.5-moko/arch/arm/mach-s3c2410/pwm.c
-@@ -0,0 +1,222 @@
+@@ -0,0 +1,234 @@
 +/*
 + * arch/arm/mach-s3c2410/3c2410-pwm.c
 + *
@@ -118,7 +118,7 @@
 +	tcfg0 = __raw_readl(S3C2410_TCFG0);
 +
 +	/* divider & scaler slection */
-+	switch(s3c2410_pwm->timerid) {
++	switch (s3c2410_pwm->timerid) {
 +	case PWM0:
 +		tcfg1 &= ~S3C2410_TCFG1_MUX0_MASK;
 +		tcfg0 &= ~S3C2410_TCFG_PRESCALER0_MASK;
@@ -136,8 +136,7 @@
 +		tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK;
 +		break;
 +	case PWM4:
-+		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
-+		tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK;
++		/* timer four is not capable of doing PWM */
 +		break;
 +	default:
 +		return -1;
@@ -145,11 +144,23 @@
 +
 +	/* divider & scaler values */
 +	tcfg1 |= s3c2410_pwm->divider;
-+	tcfg0 |= s3c2410_pwm->prescaler;
-+
 +	__raw_writel(tcfg1, S3C2410_TCFG1);
-+	__raw_writel(tcfg0, S3C2410_TCFG0);
 +
++	switch (s3c2410_pwm->timerid) {
++	case PWM0:
++	case PWM1:
++		tcfg0 |= s3c2410_pwm->prescaler;
++		__raw_writel(tcfg0, S3C2410_TCFG0);
++		break;
++	default:
++		if ((tcfg0 | s3c2410_pwm->prescaler) != tcfg0) {
++			printk(KERN_WARNING "not changing prescaler of PWM %u,"
++			       " since it's shared with timer4 (clock tick)\n",
++			       s3c2410_pwm->timerid);
++		}
++		break;
++	}
++
 +	/* timer count and compare buffer initial values */
 +	tcnt = s3c2410_pwm->counter;
 +	tcmp = s3c2410_pwm->comparer;
@@ -189,8 +200,9 @@
 +		tcon &= ~S3C2410_TCON_T3MANUALUPD;
 +		break;
 +	case PWM4:
-+		tcon |= S3C2410_TCON_T4START;
-+		tcon &= ~S3C2410_TCON_T4MANUALUPD;
++		/* timer four is not capable of doing PWM */
++	default:
++		return -1;
 +	}
 +
 +	__raw_writel(tcon, S3C2410_TCON);
@@ -228,9 +240,9 @@
 +		tcon |= S3C2410_TCON_T3MANUALUPD;
 +		break;
 +	case PWM4:
-+		tcon &= ~0x00080000;
-+		tcon |= S3C2410_TCON_T4RELOAD;
-+		tcon |= S3C2410_TCON_T3MANUALUPD;
++		/* timer four is not capable of doing PWM */
++	default:
++		return -1;
 +	}
 +
 +	__raw_writel(tcon, S3C2410_TCON);





More information about the commitlog mailing list