Skip to contentSkip to conversation

ARM: mxs: add recording support for saif

PATCH Superseded Dong Aisheng 3 participants 8 messages Sep 26, 2011 – Nov 9, 2011

Subsystems (3)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover ARM: mxs: add recording support for saif

Changes since v2:
* separate clkmux code into another patch according to Uwe
* add lock according to Wolfram
* Other minus fixes suggested by Uwe and Wolfram.
* remove Wolfram's fix saif clock setting patch which is in v2 series since Wolfram will reform the clock code and send it out himself. For test purpose, user still needs that patch. People can get it from v2 series.
The patch is:
[PATCH v2 3/3] arm: mxs: disable clock-gates when setting saif-clocks

The patches are based on imx-features branch since commit:
f4f01e31835f.

Changes since v1:
The main changes are move mach-specific code(clkmux in DIGCTL) from saif driver to mach-specific layer based on Wolfram's suggestion.

Note that the last patch is a RFC patch and sent out for testing since without that patch the saif may not work.

Dong Aisheng (3):
ARM: mxs: add saif clkmux functions
ARM: mx28evk: add platform data for saif
ARM: mx28evk: set a initial clock rate for saif

 arch/arm/mach-mxs/clock-mx28.c                  |   67 +++++++++++++++++++++++
 arch/arm/mach-mxs/devices-mx28.h                |    3 +-
 arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +-
 arch/arm/mach-mxs/include/mach/common.h         |    2 +
 arch/arm/mach-mxs/include/mach/devices-common.h |    4 +-
 arch/arm/mach-mxs/include/mach/digctl.h         |   21 +++++++
 arch/arm/mach-mxs/mach-mx28evk.c                |   16 +++++-
 7 files changed, 112 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-mxs/include/mach/digctl.h
#1 lore raw

PATCH v3 1/3 ARM: mxs: add saif clkmux functions

Cc Sascha Hauer <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Uwe Kleine-König <[email protected]>
Cc Mark Brown <[email protected]>
Cc Liam Girdwood <[email protected]>

---
changes since v2:
* This patch is separated from the following patch based on suggestions from Uwe.
[PATCH 2/3] ARM: mx28evk: add platform data for saif
* add lock suggested by Wolfram

---
 arch/arm/mach-mxs/clock-mx28.c          |   58 +++++++++++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++
 2 files changed, 79 insertions(+), 0 deletions(-)
arch/arm/mach-mxs/clock-mx28.c +58 -0
index 7954013..9497346 100644
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/jiffies.h>
 #include <linux/clkdev.h>
+#include <linux/spinlock.h>
 
 #include <asm/clkdev.h>
 #include <asm/div64.h>
@@ -29,6 +30,7 @@
 #include <mach/mx28.h>
 #include <mach/common.h>
 #include <mach/clock.h>
+#include <mach/digctl.h>
 
 #include "regs-clkctrl-mx28.h"
 
@@ -43,6 +45,62 @@ static struct clk emi_clk;
 static struct clk saif0_clk;
 static struct clk saif1_clk;
 static struct clk clk32k_clk;
+static DEFINE_SPINLOCK(clkmux_lock);
+
+/*
+ * HW_SAIF_CLKMUX_SEL:
+ *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1
+ *		clock pins selected for SAIF1 input clocks.
+ *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and
+ *		SAIF0 clock inputs selected for SAIF1 input clocks.
+ *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ */
+int mxs_saif_clkmux_select(unsigned int clkmux)
+{
+	if (clkmux > 0x3)
+		return -EINVAL;
+
+	spin_lock(&clkmux_lock);
+	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
+	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
+	spin_unlock(&clkmux_lock);
+
+	return 0;
+}
+
+int mxs_get_saif_clk_master_id(unsigned int saif_id)
+{
+	unsigned int saif_clkmux;
+	unsigned int master_id;
+
+	spin_lock(&clkmux_lock);
+	saif_clkmux = (__raw_readl(DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL)
+			& BM_DIGCTL_CTRL_SAIF_CLKMUX) >> BP_DIGCTL_CTRL_SAIF_CLKMUX;
+	switch (saif_clkmux) {
+	case MXS_DIGCTL_SAIF_CLKMUX_DIRECT:
+		master_id = saif_id;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT:
+		master_id = saif_id ? 0 : 1;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0:
+		master_id = 0;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1:
+		master_id = 1;
+		break;
+	default:
+		return -EINVAL;
+	}
+	spin_unlock(&clkmux_lock);
+
+	return master_id;
+}
 
 static int _raw_clk_enable(struct clk *clk)
 {
arch/arm/mach-mxs/include/mach/digctl.h new file +21 -0
new file mode 100644
index 0000000..9bd0496
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __MACH_DIGCTL_H__
+#define __MACH_DIGCTL_H__
+
+/* MXS DIGCTL SAIF CLKMUX */
+#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
+#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
+
+#define HW_DIGCTL_CTRL			0x0
+#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
+#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
+#endif
Signature · 7 lines
1.7.0.4


_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer
#2 lore raw

Re: [PATCH v3 1/3] ARM: mxs: add saif clkmux functions

Quoted 46 lines · Dong Aisheng
Cc Sascha Hauer <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Uwe Kleine-K?nig <[email protected]>
Cc Mark Brown <[email protected]>
Cc Liam Girdwood <[email protected]>

---
changes since v2:
* This patch is separated from the following patch based on suggestions from Uwe.
[PATCH 2/3] ARM: mx28evk: add platform data for saif
* add lock suggested by Wolfram

---
 arch/arm/mach-mxs/clock-mx28.c          |   58 +++++++++++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++
 2 files changed, 79 insertions(+), 0 deletions(-)
arch/arm/mach-mxs/clock-mx28.c +6 -0
index 7954013..9497346 100644
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/jiffies.h>
 #include <linux/clkdev.h>
+#include <linux/spinlock.h>
 
 #include <asm/clkdev.h>
 #include <asm/div64.h>
@@ -29,6 +30,7 @@
 #include <mach/mx28.h>
 #include <mach/common.h>
 #include <mach/clock.h>
+#include <mach/digctl.h>
 
 #include "regs-clkctrl-mx28.h"
 
@@ -43,6 +45,62 @@ static struct clk emi_clk;
 static struct clk saif0_clk;
 static struct clk saif1_clk;
 static struct clk clk32k_clk;
+static DEFINE_SPINLOCK(clkmux_lock);
+
+/*
+ * HW_SAIF_CLKMUX_SEL:

arch/arm/mach-mxs/clock-mx28.c static struct clk emi_clk; · line 61

Quoted 10 lines
arch/arm/mach-mxs/clock-mx28.c +10 -0
+ *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1
+ *		clock pins selected for SAIF1 input clocks.
+ *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and
+ *		SAIF0 clock inputs selected for SAIF1 input clocks.
+ *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ */
+int mxs_saif_clkmux_select(unsigned int clkmux)

Ahem, this seems to be a clk_set_parent function which is exported and bypasses the clk api. No.

Quoted 27 lines
arch/arm/mach-mxs/clock-mx28.c +27 -0
+{
+	if (clkmux > 0x3)
+		return -EINVAL;
+
+	spin_lock(&clkmux_lock);
+	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
+	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
+	spin_unlock(&clkmux_lock);
+
+	return 0;
+}
+
+int mxs_get_saif_clk_master_id(unsigned int saif_id)
+{
+	unsigned int saif_clkmux;
+	unsigned int master_id;
+
+	spin_lock(&clkmux_lock);
+	saif_clkmux = (__raw_readl(DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL)
+			& BM_DIGCTL_CTRL_SAIF_CLKMUX) >> BP_DIGCTL_CTRL_SAIF_CLKMUX;
+	switch (saif_clkmux) {
+	case MXS_DIGCTL_SAIF_CLKMUX_DIRECT:
+		master_id = saif_id;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT:

arch/arm/mach-mxs/clock-mx28.c static struct clk emi_clk; · line 98

Quoted 10 lines
arch/arm/mach-mxs/clock-mx28.c +10 -0
+		master_id = saif_id ? 0 : 1;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0:
+		master_id = 0;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1:
+		master_id = 1;
+		break;
+	default:
+		return -EINVAL;

You return with a spinlock held here. You don't need the spinlock at all in this function as the only register access you have is atomic.

Quoted 40 lines
arch/arm/mach-mxs/clock-mx28.c +5 -0
+	}
+	spin_unlock(&clkmux_lock);
+
+	return master_id;
+}
 
 static int _raw_clk_enable(struct clk *clk)
 {
arch/arm/mach-mxs/include/mach/digctl.h new file +21 -0
new file mode 100644
index 0000000..9bd0496
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __MACH_DIGCTL_H__
+#define __MACH_DIGCTL_H__
+
+/* MXS DIGCTL SAIF CLKMUX */
+#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
+#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
+
+#define HW_DIGCTL_CTRL			0x0
+#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
+#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
+#endif
Signature · 1 line
1.7.0.4
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#3 lore raw

Re: [PATCH v3 1/3] ARM: mxs: add saif clkmux functions

Hi Sascha,

First, thanks for the review.

Quoted 66 lines

-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Wednesday, November 09, 2011 7:36 PM
To: Dong Aisheng-B29396
Cc: alsa-devel at alsa-project.org; linux-arm-kernel at lists.infradead.org; broonie at opensource.wolfsonmicro.com; lrg at ti.com; w.sang at pengutronix.de; u.kleine-koenig at pengutronix.de
Subject: Re: [PATCH v3 1/3] ARM: mxs: add saif clkmux functions

Quoted 7 lines · Dong Aisheng
Cc Sascha Hauer <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Uwe Kleine-K?nig <[email protected]>
Cc Mark Brown <[email protected]>
Cc Liam Girdwood <[email protected]>
Quoted 8 lines

---
changes since v2:
* This patch is separated from the following patch based on suggestions from Uwe.
[PATCH 2/3] ARM: mx28evk: add platform data for saif
* add lock suggested by Wolfram

---
 arch/arm/mach-mxs/clock-mx28.c          |   58

+++++++++++++++++++++++++++++++

Quoted 26 lines
 arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++
 2 files changed, 79 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-mxs/clock-mx28.c index 7954013..9497346 100644

arch/arm/mach-mxs/clock-mx28.c +2 -0
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/jiffies.h>
 #include <linux/clkdev.h>
+#include <linux/spinlock.h>
 
 #include <asm/clkdev.h>
 #include <asm/div64.h>
@@ -29,6 +30,7 @@
 #include <mach/mx28.h>
 #include <mach/common.h>
 #include <mach/clock.h>
+#include <mach/digctl.h>
 
 #include "regs-clkctrl-mx28.h"
 
@@ -43,6 +45,62 @@ static struct clk emi_clk;  static struct clk

saif0_clk; static struct clk saif1_clk; static struct clk clk32k_clk;

arch/arm/mach-mxs/clock-mx28.c static struct clk emi_clk;

Quoted 5 lines
arch/arm/mach-mxs/clock-mx28.c +5 -0
+static DEFINE_SPINLOCK(clkmux_lock);
+
+/*
+ * HW_SAIF_CLKMUX_SEL:
+ *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and

SAIF1

Quoted 2 lines

+ * clock pins selected for SAIF1 input clocks.
+ * CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input

clocks, and

Quoted 2 lines

+ * SAIF0 clock inputs selected for SAIF1 input clocks.
+ * EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1

input

Quoted 2 lines

+ * clocks.
+ * EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1

Quoted 7 lines

input

Quoted 3 lines

+ * clocks.
+ */
+int mxs_saif_clkmux_select(unsigned int clkmux)

Ahem, this seems to be a clk_set_parent function which is exported and bypasses the clk api. No.

I'm afraid this is a little different from clk_set_parent and may not be able to be totally covered by clk api.
For example, how do we treat its real parents pll or osc when we want saif1 as saif0's parent?
Additionally, if we want clk_set_parent(&saif0_clk, &saif1_clk), It seems both CROSSINPUT and EXTMSTR1 can satisfy this requirement, But clk api does not know how to make the decision.

Quoted 32 lines
Quoted 11 lines
arch/arm/mach-mxs/clock-mx28.c +11 -0
+{
+	if (clkmux > 0x3)
+		return -EINVAL;
+
+	spin_lock(&clkmux_lock);
+	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
+	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
+	spin_unlock(&clkmux_lock);
+

arch/arm/mach-mxs/clock-mx28.c static struct clk emi_clk;

Quoted 10 lines
arch/arm/mach-mxs/clock-mx28.c +10 -0
+	return 0;
+}
+
+int mxs_get_saif_clk_master_id(unsigned int saif_id) {
+	unsigned int saif_clkmux;
+	unsigned int master_id;
+
+	spin_lock(&clkmux_lock);
+	saif_clkmux = (__raw_readl(DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL)
+			& BM_DIGCTL_CTRL_SAIF_CLKMUX) >>

BP_DIGCTL_CTRL_SAIF_CLKMUX;

Quoted 10 lines
arch/arm/mach-mxs/clock-mx28.c +10 -0
+	switch (saif_clkmux) {
+	case MXS_DIGCTL_SAIF_CLKMUX_DIRECT:
+		master_id = saif_id;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT:
+		master_id = saif_id ? 0 : 1;
+		break;
+	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0:
+		master_id = 0;
+		break;
Quoted 8 lines

arch/arm/mach-mxs/clock-mx28.c static struct clk emi_clk; · line 98

Quoted 5 lines
arch/arm/mach-mxs/clock-mx28.c +5 -0
+	case MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1:
+		master_id = 1;
+		break;
+	default:
+		return -EINVAL;

You return with a spinlock held here. You don't need the spinlock at all in this function as the only register access you have is atomic.

Sorry for the mistake.
I did not realize register access is atomic before. I can remove it.

Quoted 43 lines
Quoted 37 lines
arch/arm/mach-mxs/clock-mx28.c +5 -0
+	}
+	spin_unlock(&clkmux_lock);
+
+	return master_id;
+}
 
 static int _raw_clk_enable(struct clk *clk)  { diff --git

a/arch/arm/mach-mxs/include/mach/digctl.h b/arch/arm/mach-mxs/include/mach/digctl.h
new file mode 100644
index 0000000..9bd0496

arch/arm/mach-mxs/include/mach/digctl.h new file +22 -1
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __MACH_DIGCTL_H__
+#define __MACH_DIGCTL_H__
+
+/* MXS DIGCTL SAIF CLKMUX */
+#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
+#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
+
+#define HW_DIGCTL_CTRL			0x0
+#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
+#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
+#endif
--
Quoted 4 lines

1.7.0.4

--

Quoted 8 lines

Pengutronix e.K. |
|
Industrial Linux Solutions | http://www.pengutronix.de/
|
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555
|

Regards
Dong Aisheng

#4 lore raw

PATCH v3 2/3 ARM: mx28evk: add platform data for saif

In reply to Dong Aisheng

This is for supporting saif record function.

Cc Sascha Hauer <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Uwe Kleine-König <[email protected]>
Cc Mark Brown <[email protected]>
Cc Liam Girdwood <[email protected]>

---
Changes since v2:
* separate clkmux code into another patch
* A few minus fixes suggested by Uwe & Wolfram.

Changes since v1:
* move saif clkmux code into mach-specific part

---
 arch/arm/mach-mxs/devices-mx28.h                |    3 ++-
 arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +++--
 arch/arm/mach-mxs/include/mach/common.h         |    2 ++
 arch/arm/mach-mxs/include/mach/devices-common.h |    4 +++-
 arch/arm/mach-mxs/mach-mx28evk.c                |   16 ++++++++++++++--
 5 files changed, 24 insertions(+), 6 deletions(-)
arch/arm/mach-mxs/devices-mx28.h +2 -1
index c888710..4f50094 100644
@@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
 		const struct mxsfb_platform_data *pdata);
 
 extern const struct mxs_saif_data mx28_saif_data[] __initconst;
-#define mx28_add_saif(id)              mxs_add_saif(&mx28_saif_data[id])
+#define mx28_add_saif(id, pdata) \
+	mxs_add_saif(&mx28_saif_data[id], pdata)
 
 struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
arch/arm/mach-mxs/devices/platform-mxs-saif.c +3 -2
index 1ec965e..f6e3a60 100644
@@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[] __initconst = {
 };
 #endif
 
-struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
+struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data,
+				const struct mxs_saif_platform_data *pdata)
 {
 	struct resource res[] = {
 		{
@@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
 	};
 
 	return mxs_add_platform_device("mxs-saif", data->id, res,
-					ARRAY_SIZE(res), NULL, 0);
+				ARRAY_SIZE(res), pdata, sizeof(*pdata));
 }
arch/arm/mach-mxs/include/mach/common.h +2 -0
index 635bb5d..bf91a10 100644
@@ -29,4 +29,6 @@ extern void mx28_init_irq(void);
 
 extern void icoll_init_irq(void);
 
+extern int mxs_saif_clkmux_select(unsigned int clkmux);
+extern int mxs_get_saif_clk_master_id(unsigned int saif_id);
 #endif /* __MACH_MXS_COMMON_H__ */
arch/arm/mach-mxs/include/mach/devices-common.h +3 -1
index a8080f4..dc369c1 100644
@@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
 		resource_size_t iobase, int id);
 
 /* saif */
+#include <sound/saif.h>
 struct mxs_saif_data {
 	int id;
 	resource_size_t iobase;
@@ -103,4 +104,5 @@ struct mxs_saif_data {
 };
 
 struct platform_device *__init mxs_add_saif(
-		const struct mxs_saif_data *data);
+		const struct mxs_saif_data *data,
+		const struct mxs_saif_platform_data *pdata);
arch/arm/mach-mxs/mach-mx28evk.c +14 -2
index 4a3cca3..5aab344 100644
@@ -28,6 +28,7 @@
 
 #include <mach/common.h>
 #include <mach/iomux-mx28.h>
+#include <mach/digctl.h>
 
 #include "devices-mx28.h"
 
@@ -417,6 +418,17 @@ static void __init mx28evk_add_regulators(void)
 static void __init mx28evk_add_regulators(void) {}
 #endif
 
+static int mx28evk_mxs_saif_pinit(void)
+{
+	return mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
+}
+
+static const struct mxs_saif_platform_data
+			mx28evk_mxs_saif_pdata __initconst = {
+	.init = mx28evk_mxs_saif_pinit,
+	.get_master_id = mxs_get_saif_clk_master_id,
+};
+
 static void __init mx28evk_init(void)
 {
 	int ret;
@@ -457,8 +469,8 @@ static void __init mx28evk_init(void)
 
 	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 
-	mx28_add_saif(0);
-	mx28_add_saif(1);
+	mx28_add_saif(0, &mx28evk_mxs_saif_pdata);
+	mx28_add_saif(1, &mx28evk_mxs_saif_pdata);
 
 	mx28_add_mxs_i2c(0);
 	i2c_register_board_info(0, mxs_i2c0_board_info,
Signature · 7 lines
1.7.0.4


_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#5 lore raw

PATCH v3 3/3 ARM: mx28evk: set a initial clock rate for saif

In reply to Dong Aisheng
Cc Sascha Hauer <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Uwe Kleine-König <[email protected]>
Cc Mark Brown <[email protected]>
Cc Liam Girdwood <[email protected]>

---
No changes since v1.

---
 arch/arm/mach-mxs/clock-mx28.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-mxs/clock-mx28.c +9 -0
index 9497346..2daab49 100644
@@ -837,6 +837,15 @@ int __init mx28_clocks_init(void)
 	clk_set_parent(&saif0_clk, &pll0_clk);
 	clk_set_parent(&saif1_clk, &pll0_clk);
 
+	/*
+	 * Set an initial clk rate for saif's internal logic to work properly,
+	 * this is especially for the saif working on EXTMASTER mode that who
+	 * uses other saif's BITCLK&LRCLK but it still needs a basic clk which
+	 * should be bigger enough for its internal logic.
+	 */
+	clk_set_rate(&saif0_clk, 24000000);
+	clk_set_rate(&saif1_clk, 24000000);
+
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
 	mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0);
Signature · 7 lines
1.7.0.4


_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#6 lore raw
In reply to Dong Aisheng

2011/9/26 Dong Aisheng <[email protected]>:

Quoted 18 lines

Changes since v2:
?* separate clkmux code into another patch according to Uwe ?* add lock according to Wolfram
?* Other minus fixes suggested by Uwe and Wolfram.
?* remove Wolfram's fix saif clock setting patch which is in v2 series ? since Wolfram will reform the clock code and send it out himself. ? For test purpose, user still needs that patch. People can get it ? from v2 series.
? The patch is:
? [PATCH v2 3/3] arm: mxs: disable clock-gates when setting saif-clocks

The patches are based on imx-features branch since commit:
f4f01e31835f.

Changes since v1:
The main changes are move mach-specific code(clkmux in DIGCTL) from saif driver to mach-specific layer based on Wolfram's suggestion.

Quoted 7 lines

Note that the last patch is a RFC patch and sent out for testing since without that patch the saif may not work.

Dong Aisheng (3):
?ARM: mxs: add saif clkmux functions
?ARM: mx28evk: add platform data for saif
?ARM: mx28evk: set a initial clock rate for saif

Any comments for this?

Regards
Dong Aisheng

Quoted 16 lines
?arch/arm/mach-mxs/clock-mx28.c ? ? ? ? ? ? ? ? ?| ? 67 +++++++++++++++++++++++
?arch/arm/mach-mxs/devices-mx28.h ? ? ? ? ? ? ? ?| ? ?3 +-
?arch/arm/mach-mxs/devices/platform-mxs-saif.c ? | ? ?5 +-
?arch/arm/mach-mxs/include/mach/common.h ? ? ? ? | ? ?2 +
?arch/arm/mach-mxs/include/mach/devices-common.h | ? ?4 +-
?arch/arm/mach-mxs/include/mach/digctl.h ? ? ? ? | ? 21 +++++++
?arch/arm/mach-mxs/mach-mx28evk.c ? ? ? ? ? ? ? ?| ? 16 +++++-

?7 files changed, 112 insertions(+), 6 deletions(-) ?create mode 100644 arch/arm/mach-mxs/include/mach/digctl.h

_______________________________________________
Alsa-devel mailing list
Alsa-devel at alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#7 lore raw

2011/10/11 Dong Aisheng <[email protected]>:

Quoted 22 lines

2011/9/26 Dong Aisheng <[email protected]>:

Quoted 21 lines

Changes since v2:
?* separate clkmux code into another patch according to Uwe ?* add lock according to Wolfram
?* Other minus fixes suggested by Uwe and Wolfram.
?* remove Wolfram's fix saif clock setting patch which is in v2 series ? since Wolfram will reform the clock code and send it out himself. ? For test purpose, user still needs that patch. People can get it ? from v2 series.
? The patch is:
? [PATCH v2 3/3] arm: mxs: disable clock-gates when setting saif-clocks

The patches are based on imx-features branch since commit:
f4f01e31835f.

Changes since v1:
The main changes are move mach-specific code(clkmux in DIGCTL) from saif driver to mach-specific layer based on Wolfram's suggestion.

Note that the last patch is a RFC patch and sent out for testing since without that patch the saif may not work.

Quoted 7 lines
Quoted 4 lines

Dong Aisheng (3):
?ARM: mxs: add saif clkmux functions
?ARM: mx28evk: add platform data for saif
?ARM: mx28evk: set a initial clock rate for saif

Any comments for this?

This patch is without any comment for a long time.

Sascha, Wolfram, Uwe,
Could you someone help provide some comments?

Regards
Dong Aisheng

Quoted 17 lines
Quoted 16 lines
?arch/arm/mach-mxs/clock-mx28.c ? ? ? ? ? ? ? ? ?| ? 67 +++++++++++++++++++++++
?arch/arm/mach-mxs/devices-mx28.h ? ? ? ? ? ? ? ?| ? ?3 +-
?arch/arm/mach-mxs/devices/platform-mxs-saif.c ? | ? ?5 +-
?arch/arm/mach-mxs/include/mach/common.h ? ? ? ? | ? ?2 +
?arch/arm/mach-mxs/include/mach/devices-common.h | ? ?4 +-
?arch/arm/mach-mxs/include/mach/digctl.h ? ? ? ? | ? 21 +++++++
?arch/arm/mach-mxs/mach-mx28evk.c ? ? ? ? ? ? ? ?| ? 16 +++++-

?7 files changed, 112 insertions(+), 6 deletions(-) ?create mode 100644 arch/arm/mach-mxs/include/mach/digctl.h

_______________________________________________
Alsa-devel mailing list
Alsa-devel at alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel