]> rtime.felk.cvut.cz Git - shark/motorek-5200.git/commitdiff
Working interrupt
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 15 Jan 2009 16:37:23 +0000 (17:37 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 15 Jan 2009 16:37:34 +0000 (17:37 +0100)
motorek.c

index 4c69cb672b17f4d18410c725a9bc350e18f0eb30..b0c15e27ad7f529c95c91cd2db10d6f51534c23a 100644 (file)
--- a/motorek.c
+++ b/motorek.c
@@ -65,13 +65,21 @@ DEVICE_ATTR(action,0644,show_action,store_action);
 static void pwm_width(struct mpc52xx_gpt *gpt, u16 width)
 {
        out_be32(&gpt->pwm, (width<<16) | MPC52xx_GPT_PWM_OP);
+       //printk("pwm: %p=0x%x\n", gpt, width);
+
 }
 
 static void __devinit pwm_init(struct mpc52xx_gpt *gpt)
 {
+       //while (((unsigned)gpt & 0xff) != 0x50) gpt++;
        out_be32(&gpt->count, (1<<16) | PWM_PERIOD);
        pwm_width(gpt, 0);
        out_be32(&gpt->mode, MPC52xx_GPT_MODE_PWM);
+
+       //out_be32(&gpt->pwm, (500<<16) | MPC52xx_GPT_PWM_OP); /* REMOVE ME */
+
+       //out_be32(&gpt->mode, MPC52xx_GPT_MODE_GPIO | (2<<4));
+       //printk("pwm: %p\n", gpt);
 }
 
 static void  pwm_done(struct mpc52xx_gpt *gpt)
@@ -150,12 +158,11 @@ static int __devinit motorek_probe(struct of_device* dev,
                return -ENXIO;
        }
 
-/*     /\* FIXME: This should be specified in device-tree *\/ */
-/*     m->irq = irq_create_of_mapping( */
+       m->irq = irq_of_parse_and_map(dn, 0);
 
-/*     err = request_irq(m->irq, motorek_irq, 0, "motorek", m); */
-/*     if (err) */
-/*             return err; */
+       err = request_irq(m->irq, motorek_irq, 0, "motorek", m);
+       if (err)
+               return err;
 
        motorek_init(m);
 
@@ -180,6 +187,8 @@ static int __devexit motorek_remove(struct of_device* dev)
 
        printk(KERN_NOTICE "Removing motorek\n");
 
+       free_irq(m->irq, m);
+
        motorek_done(m);
        return 0;
 }