exynos4:pinmux:fdt: decode peripheral id
authorPiotr Wilczek <p.wilczek@samsung.com>
Fri, 7 Mar 2014 13:59:38 +0000 (14:59 +0100)
committerMinkyu Kang <mk7.kang@samsung.com>
Wed, 12 Mar 2014 10:54:59 +0000 (19:54 +0900)
This patch adds api to decode peripheral id based on interrupt number.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
arch/arm/cpu/armv7/exynos/pinmux.c

index 645c497370294843beda48a5d28d3234dcc8c97c..8d6e5c11bf40f74bee13bf1f1a0bc0375f0f200f 100644 (file)
@@ -741,6 +741,21 @@ int exynos_pinmux_config(int peripheral, int flags)
 }
 
 #ifdef CONFIG_OF_CONTROL
+static int exynos4_pinmux_decode_periph_id(const void *blob, int node)
+{
+       int err;
+       u32 cell[3];
+
+       err = fdtdec_get_int_array(blob, node, "interrupts", cell,
+                                       ARRAY_SIZE(cell));
+       if (err) {
+               debug(" invalid peripheral id\n");
+               return PERIPH_ID_NONE;
+       }
+
+       return cell[1];
+}
+
 static int exynos5_pinmux_decode_periph_id(const void *blob, int node)
 {
        int err;
@@ -758,6 +773,8 @@ int pinmux_decode_periph_id(const void *blob, int node)
 {
        if (cpu_is_exynos5())
                return  exynos5_pinmux_decode_periph_id(blob, node);
+       else if (cpu_is_exynos4())
+               return  exynos4_pinmux_decode_periph_id(blob, node);
        else
                return PERIPH_ID_NONE;
 }