Skip to content

Commit

Permalink
Merge pull request torvalds#86 from william-wfei/hikey
Browse files Browse the repository at this point in the history
perf(pmu event): hikey: enable pmu on hikey board
  • Loading branch information
ldts committed Jun 18, 2015
2 parents 9592220 + f12c14e commit 5ee2650
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
10 changes: 10 additions & 0 deletions arch/arm64/boot/dts/hi6220.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@
mask = <0x48698284>;
};

acpu_ctrl: acpu_ctrl@f6504000 {
compatible = "hisilicon,acpuctrl";
reg = <0x0 0xf6504000 0x0 0x1000>;
};

pmu {
compatible = "arm,armv8-pmuv3";
interrupts = <0 99 4>;
};

smb {
compatible = "simple-bus";
#address-cells = <2>;
Expand Down
15 changes: 14 additions & 1 deletion arch/arm64/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,19 @@ static void armv8pmu_disable_event(struct hw_perf_event *hwc, int idx)
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}

static irqreturn_t armv8pmu_handle_irq_none(int irq_num, void *dev)
{
int next;
if (num_online_cpus() > 1) {
next = cpumask_next(smp_processor_id(), cpu_online_mask);
if (next > nr_cpu_ids)
next = cpumask_next(-1, cpu_online_mask);
irq_set_affinity(irq_num, cpumask_of(next));
}

return IRQ_NONE;
}

static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
{
u32 pmovsr;
Expand All @@ -1085,7 +1098,7 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
* Did an overflow occur?
*/
if (!armv8pmu_has_overflowed(pmovsr))
return IRQ_NONE;
return armv8pmu_handle_irq_none(irq_num, dev);

/*
* Handle the counter(s) overflow(s)
Expand Down
19 changes: 17 additions & 2 deletions drivers/misc/hi6220-sysconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@

#define reset_offset 0x334
#define pclk_offset 0x230
#define armv8_pmu_offset 0x0EC
#define PMUSSI_REG_EX(pmu_base, reg_addr) (((reg_addr) << 2) + (char *)pmu_base)

static int __init hi6220_sysconf(void)
{
static void __iomem *base = NULL, *base1 = NULL;
struct device_node *node, *node1;
static void __iomem *base = NULL, *base1 = NULL, *base2 = NULL;
struct device_node *node, *node1, *node2;
unsigned char ret;

node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
Expand All @@ -40,6 +41,16 @@ static int __init hi6220_sysconf(void)
return -ENOMEM;
}

node2 = of_find_compatible_node(NULL, NULL, "hisilicon,acpuctrl");
if (!node2)
return -ENOENT;

base2 = of_iomap(node2, 0);
if (base2 == NULL) {
printk(KERN_ERR "hi6220: acpuctrl reg iomap failed!\n");
return -ENOMEM;
}

/*Disable UART1 reset and set pclk*/
writel(BIT(5), base + reset_offset);
writel(BIT(5), base + pclk_offset);
Expand All @@ -64,8 +75,12 @@ static int __init hi6220_sysconf(void)
ret |= 0x40;
*(volatile unsigned char*)PMUSSI_REG_EX(base1, 0x1c) = ret;

/*enable armv8-pmu*/
writel(0xff, base2 + armv8_pmu_offset);

iounmap(base);
iounmap(base1);
iounmap(base2);

return 0;
}
Expand Down

0 comments on commit 5ee2650

Please sign in to comment.