浏览代码

i.MX27 audmux: Fix register offsets

We have two holes in the register space. The driver did not
handle this. Fix it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer 15 年之前
父节点
当前提交
4c8b581dd2
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      arch/arm/plat-mxc/audmux-v1.c

+ 7 - 2
arch/arm/plat-mxc/audmux-v1.c

@@ -28,7 +28,9 @@
 
 static void __iomem *audmux_base;
 
-#define MXC_AUDMUX_V1_PCR(x)	((x) * 4)
+static unsigned char port_mapping[] = {
+	0x0, 0x4, 0x8, 0x10, 0x14, 0x1c,
+};
 
 int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr)
 {
@@ -37,7 +39,10 @@ int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr)
 		return -ENOSYS;
 	}
 
-	writel(pcr, audmux_base + MXC_AUDMUX_V1_PCR(port));
+	if (port >= ARRAY_SIZE(port_mapping))
+		return -EINVAL;
+
+	writel(pcr, audmux_base + port_mapping[port]);
 
 	return 0;
 }