Skip to content

Commit

Permalink
axp209: Fix interrupts on sun7i
Browse files Browse the repository at this point in the history
The A20 has some extra control registers for the external NMI interrupt
pin, adding the need to be enable and clear it explictly on sun7i.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
jwrdegoede authored and amery committed Oct 10, 2013
1 parent 4031328 commit b8f96a8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/power/axp_power/axp-cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
#ifndef __LINUX_AXP_CFG_H_
#define __LINUX_AXP_CFG_H_

#include <mach/irqs.h>

#define AXP18_ADDR 0x2C >> 1
#define AXP19_ADDR 0x68 >> 1
#define AXP20_ADDR 0x68 >> 1
#define AXP18_I2CBUS 1
#define AXP19_I2CBUS 0
#define AXP20_I2CBUS 0
#define BATRDC 200 //initial rdc
#define AXP20_IRQNO 0
#define AXP20_IRQNO SW_INT_IRQNO_ENMI


#define LDO1SET 0 //0: LDO1SET connect AGND, 1: LDO1SET connect AIPS, for axp189 LDOSET bonding to AGND
Expand Down
17 changes: 17 additions & 0 deletions drivers/power/axp_power/axp-mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@
#include <linux/delay.h>
#include <linux/reboot.h>
#include <linux/slab.h>
#include <linux/io.h>

#include "axp-cfg.h"
#include "axp18-mfd.h"
#include "axp19-mfd.h"
#include "axp20-mfd.h"

#include <plat/platform.h>
#include <plat/system.h>
#include <plat/sys_config.h>

#define NMI_IRQ_CTRL_REG (SW_VA_IO_BASE + 0x30)
#define NMI_IRQ_PEND_REG (SW_VA_IO_BASE + 0x34)
#define NMI_IRQ_ENABLE_REG (SW_VA_IO_BASE + 0x38)

static int power_start;

static void axp_mfd_irq_work(struct work_struct *work)
Expand All @@ -42,6 +49,11 @@ static void axp_mfd_irq_work(struct work_struct *work)
blocking_notifier_call_chain(
&chip->notifier_list, irqs, NULL);
}

/* The irq raised by the A20 NMI pin needs explict clearing */
if (sunxi_is_sun7i() && chip->client->irq == SW_INT_IRQNO_ENMI)
writel(0x01, NMI_IRQ_PEND_REG);

enable_irq(chip->client->irq);
}

Expand Down Expand Up @@ -302,6 +314,11 @@ static int __devinit axp_mfd_probe(struct i2c_client *client,
goto out_free_chip;
}

/* The irq for the A20 NMI pin needs to be enabled separately */
if (sunxi_is_sun7i() && client->irq == SW_INT_IRQNO_ENMI) {
writel(0x01, NMI_IRQ_PEND_REG); /* Clear any pending irqs */
writel(0x01, NMI_IRQ_ENABLE_REG); /* Enable NMI irq pin */
}

ret = axp_mfd_add_subdevs(chip, pdata);
if (ret)
Expand Down

0 comments on commit b8f96a8

Please sign in to comment.