Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
From: Hiremath, Vaibhav @ 2012-11-12  6:38 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <509F8D6B.5070504@compulab.co.il>

On Sun, Nov 11, 2012 at 17:05:07, Igor Grinberg wrote:
> 
> 
> On 11/08/12 20:34, Jon Hunter wrote:
> > 
> > On 11/08/2012 12:17 PM, Paul Walmsley wrote:
> >> On Thu, 8 Nov 2012, Jon Hunter wrote:
> >>
> >>> On 11/08/2012 11:58 AM, Paul Walmsley wrote:
> >>>> On Thu, 8 Nov 2012, Jon Hunter wrote:
> >>>>
> >>>>> Igor was mentioning a h/w scenario where the 32kHz source is not
> >>>>> present. However, I am not sure which devices support this and is
> >>>>> applicable too.
> >>>>
> >>>> Pretty sure Igor is referring to the AM3517/3505.  This is very poorly 
> >>>> documented, but can be observed in the AM3517 TRM Rev B (SPRUGR0B) Figure 
> >>>> 4-23 "PRM Clock Generator" and the AM3517 DM Rev C (SPRS550C) Section 4 
> >>>> "Clock Specifications".
> >>>
> >>> But AFAICT, even in that h/w configuration the internal 32k
> >>> oscillator will be used
> >>
> >> Just to clarify, there's no internal 32k oscillator used on the 3517/3505; 
> >> just a divider from the HF clock.
> > 
> > Ah yes I see that now!
> > 
> >>> and so the gptimer will still have a 32k clock source.
> >>
> >> That's a good question and you might want to check with Igor on that one,
> >> the AM3517 TRM conflicts with the DM as to whether it's available to the 
> >> GPTIMER or not :-(
> > 
> > Well the external 32k and internal divided down version go through the
> > same mux and so that seems to imply either they are both available to
> > the gptimer or neither is.
> 
> Yep, but the /800 do not get you the 32768...
> and that makes the timer suck.
> Of course this can be dealt with in the clock subsystem
> (I remember Paul said that he will look into that), but it will take time.
> 
> Also, what about having the sys_clk instead of 32k for higher precision?
> Is that possible already (without my patch)?
> 

Yes, it is possible. You can choose it through bootargs.

Thanks,
Vaibhav

> 
> -- 
> Regards,
> Igor.
> 

^ permalink raw reply

* [PATCH] ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
From: Hiremath, Vaibhav @ 2012-11-12  6:42 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <509C5495.1010109@ti.com>

On Fri, Nov 09, 2012 at 06:25:49, Hunter, Jon wrote:
> 
> On 11/08/2012 12:06 PM, Hiremath, Vaibhav wrote:
> > On Thu, Nov 08, 2012 at 23:28:53, Hunter, Jon wrote:
> >>
> >> On 11/08/2012 11:47 AM, Hiremath, Vaibhav wrote:
> >>> On Thu, Nov 08, 2012 at 23:09:57, Hunter, Jon wrote:
> >>
> >> [snip]
> >>
> >>>> I think you are missing the point here. For OMAP devices we have two
> >>>> main external clock sources which are the 32kHz clock and the sys_clk
> >>>> (can be a range of frequencies from 12-38.4MHz for OMAP4). The point is
> >>>> for OMAP these clock sources are always present and AFAIK there is no
> >>>> h/w configuration that allows you not to have the 32kHz clock source.
> >>>> PRCM needs it and I think for OMAP1 the reset logic needs it (if memory
> >>>> serves).
> >>>>
> >>>> Igor was mentioning a h/w scenario where the 32kHz source is not
> >>>> present. However, I am not sure which devices support this and is
> >>>> applicable too.
> >>>>
> >>>> So we are not discussing the 32k-sync-timer here. We are discussing
> >>>> whether there are any device configurations where a 32k clock source
> >>>> would not be available for the gptimer.
> >>>>
> >>>
> >>> Exactly that is the point I am trying to make here,
> >>>
> >>> In case of AM33xx, it is certainly possible to build the system without 
> >>> this 32Khz clock. 
> >>>
> >>> Interesting point here is, this 32KHz clock is external clock coming from 
> >>> crystal connected to in-built RTC module.
> >>
> >> Thanks. Looking at the AM3358 data manual it states ...
> >>
> >> "The OSC1 oscillator provides a 32.768-kHz reference clock to the
> >> real-time clock (RTC) and is connected to the RTC_XTALIN and RTC_XTALOUT
> >> terminals. OSC1 is disabled by default after power is applied. This
> >> clock input is optional and may not be required if the RTC is configured
> >> to receive a clock from the internal 32k RC oscillator (CLK_RC32K) or
> >> peripheral PLL (CLK_32KHZ) which receives a reference clock from the
> >> OSC0 input."
> >>
> >> So what is clear to me that an external 32k clock source is optional.
> >> However, it still appears that you will always have an internal 32k
> >> source and so regardless of the h/w configuration, a gptimer will always
> >> have an 32k clock available on the AM335x devices. Is that correct?
> >>
> > 
> > Internal RC oscillator is not accurate at all, so not guaranteed to give 
> > accurate 32.768Hz clock. The oscillation band is from 16Khz to 64Khz.
> > 
> > So it may not be useful as a system clocks, right?
> 
> By the way, according to the AM3358 data manual (paragraph above), even
> if there is no external 32k clock source and if you don't use the
> internal 32k oscillator, you can still generate a 32k clock from the PER
> PLL (CLK_32KHZ). So therefore, there should always be a 32k clock source
> available for the gptimer. Is that correct?

Yes that's correct, but it is from PER domain, so duging suspend time, it 
will be disabled. This can not be treated as a persistent clock.


> 
> At the end of the day, I am just trying to understand if any OMAP/AM
> device supports a h/w configuration where there is no 32k clock source
> available for the gptimer.
> 

I know and completely understand. We need to come up with solution which 
works on all platforms.

Thanks,
Vaibhav

^ permalink raw reply

* [PATCH] Set bit 22 in the PL310 (cache controller) AuxCtlr register
From: Shiraz Hashim @ 2012-11-12  6:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121109095400.GC2357@mudshark.cambridge.arm.com>

On Fri, Nov 09, 2012 at 09:54:01AM +0000, Will Deacon wrote:
> On Fri, Nov 09, 2012 at 04:01:52AM +0000, Shiraz Hashim wrote:
> > From: Catalin Marinas <catalin.marinas@arm.com>
> > 
> > Clearing bit 22 in the PL310 Auxiliary Control register (shared
> > attribute override enable) has the side effect of transforming Normal
> > Shared Non-cacheable reads into Cacheable no-allocate reads.
> > 
> > Coherent DMA buffers in Linux always have a Cacheable alias via the
> > kernel linear mapping and the processor can speculatively load cache
> > lines into the PL310 controller. With bit 22 cleared, Non-cacheable
> > reads would unexpectedly hit such cache lines leading to buffer
> > corruption.
> 
> Is this still the case with recent kernels? I thought the dma-mapping/cma
> work avoided the cacheable alias, but perhaps I'm mistaken.

I haven't used CMA but DMA mappings are still normal memory
non-cacheable.

--
regards
Shiraz

^ permalink raw reply

* [PATCH 1/3] gpio: Add simple poweroff-gpio driver
From: Anton Vorontsov @ 2012-11-12  6:53 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121112060740.GR24583@lunn.ch>

Hi Andrew,

On Mon, Nov 12, 2012 at 07:07:40AM +0100, Andrew Lunn wrote:
[...]
> > > But I suspect Anton may be ready to welcome a driver like this
> > > under drivers/power/* which I think is where it belongs.
> > 
> > Yup. driver/power/reset/ seems appropriate.
> 
> I was unsure where to put it. I will submit new patches with the move.
> 
> I'm not too sure about 'reset' though. Its not a reset operation, the
> power goes off and stays off. Would 'shutdown' or 'power_off' be
> better?

Other folks already wanted drivers/power/reset/ for board reset/poweroff
drivers. But it makes little sense to make both reset and poweroff
directories. So, let's just do 'reset', somebody might have already using
it in their private trees.

Thanks,
Anton.

^ permalink raw reply

* [PATCH] ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
From: Igor Grinberg @ 2012-11-12  7:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <79CD15C6BA57404B839C016229A409A83EB70E88@DBDE01.ent.ti.com>

On 11/12/12 08:38, Hiremath, Vaibhav wrote:
> On Sun, Nov 11, 2012 at 17:05:07, Igor Grinberg wrote:
>>
>>
>> On 11/08/12 20:34, Jon Hunter wrote:
>>>
>>> On 11/08/2012 12:17 PM, Paul Walmsley wrote:
>>>> On Thu, 8 Nov 2012, Jon Hunter wrote:
>>>>
>>>>> On 11/08/2012 11:58 AM, Paul Walmsley wrote:
>>>>>> On Thu, 8 Nov 2012, Jon Hunter wrote:
>>>>>>
>>>>>>> Igor was mentioning a h/w scenario where the 32kHz source is not
>>>>>>> present. However, I am not sure which devices support this and is
>>>>>>> applicable too.
>>>>>>
>>>>>> Pretty sure Igor is referring to the AM3517/3505.  This is very poorly 
>>>>>> documented, but can be observed in the AM3517 TRM Rev B (SPRUGR0B) Figure 
>>>>>> 4-23 "PRM Clock Generator" and the AM3517 DM Rev C (SPRS550C) Section 4 
>>>>>> "Clock Specifications".
>>>>>
>>>>> But AFAICT, even in that h/w configuration the internal 32k
>>>>> oscillator will be used
>>>>
>>>> Just to clarify, there's no internal 32k oscillator used on the 3517/3505; 
>>>> just a divider from the HF clock.
>>>
>>> Ah yes I see that now!
>>>
>>>>> and so the gptimer will still have a 32k clock source.
>>>>
>>>> That's a good question and you might want to check with Igor on that one,
>>>> the AM3517 TRM conflicts with the DM as to whether it's available to the 
>>>> GPTIMER or not :-(
>>>
>>> Well the external 32k and internal divided down version go through the
>>> same mux and so that seems to imply either they are both available to
>>> the gptimer or neither is.
>>
>> Yep, but the /800 do not get you the 32768...
>> and that makes the timer suck.
>> Of course this can be dealt with in the clock subsystem
>> (I remember Paul said that he will look into that), but it will take time.
>>
>> Also, what about having the sys_clk instead of 32k for higher precision?
>> Is that possible already (without my patch)?
>>
> 
> Yes, it is possible. You can choose it through bootargs.

Is the kernel command line the only way for doing this?
I personally dislike it, because it brings multiple maintenance problems.
This must be possible at least through DT.


-- 
Regards,
Igor.

^ permalink raw reply

* [PATCH v3 0/6] ARM: EXYNOS: Add secure firmware support
From: Kukjin Kim @ 2012-11-12  7:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351178560-19188-1-git-send-email-t.figa@samsung.com>

Tomasz Figa wrote:
> 
> Some Exynos-based boards are running with secure firmware running in
> TrustZone secure world, which changes the way some things have to be
> initialized.
> 
> This series adds support for specifying firmware operations, implements
> some firmware operations for Exynos secure firmware and adds a method of
> enabling secure firmware operations on Exynos-based boards through board
> file and device tree.
> 
> Changes since v2
> ( http://thread.gmane.org/gmane.linux.kernel.samsung-soc/12848 )
>   - Made Exynos firmware binding require address
>   - Minor style fixes
> 
> Changes since v1
> ( http://thread.gmane.org/gmane.linux.kernel.samsung-
> soc/12583/focus=12820 )
>   - Changed return types of all operations to int
>   - Defined all operations to return 0 on success, -ENOSYS when not
>     implemented or appropriate error code on error
> 
> Tomasz Figa (6):
>   ARM: Add interface for registering and calling firmware-specific
>     operations
>   ARM: EXYNOS: Add support for secure monitor calls
>   ARM: EXYNOS: Add IO mapping for non-secure SYSRAM.
>   ARM: EXYNOS: Add support for Exynos secure firmware
>   ARM: EXYNOS: Add support for secondary CPU bring-up on Exynos4412
>   ARM: EXYNOS: Add secure firmware support to secondary CPU bring-up
> 
>  .../devicetree/bindings/arm/samsung-boards.txt     | 10 ++++
>  arch/arm/common/Makefile                           |  2 +
>  arch/arm/common/firmware.c                         | 18 ++++++
>  arch/arm/include/asm/firmware.h                    | 31 ++++++++++
>  arch/arm/mach-exynos/Makefile                      |  6 ++
>  arch/arm/mach-exynos/common.c                      | 35 +++++++++++
>  arch/arm/mach-exynos/common.h                      |  2 +
>  arch/arm/mach-exynos/exynos-smc.S                  | 22 +++++++
>  arch/arm/mach-exynos/firmware.c                    | 67 ++++++++++++++++++++++
>  arch/arm/mach-exynos/include/mach/map.h            |  3 +
>  arch/arm/mach-exynos/mach-exynos4-dt.c             |  1 +
>  arch/arm/mach-exynos/platsmp.c                     | 37 ++++++++++--
>  arch/arm/mach-exynos/smc.h                         | 31 ++++++++++
>  arch/arm/plat-samsung/include/plat/map-s5p.h       |  1 +
>  14 files changed, 260 insertions(+), 6 deletions(-)
>  create mode 100644 arch/arm/common/firmware.c
>  create mode 100644 arch/arm/include/asm/firmware.h
>  create mode 100644 arch/arm/mach-exynos/exynos-smc.S
>  create mode 100644 arch/arm/mach-exynos/firmware.c
>  create mode 100644 arch/arm/mach-exynos/smc.h
> 
> --
> 1.7.12

(+ Russell King)

As we discussed, let me pick up this series into Samsung tree.

If any objections, please kindly let me know.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply

* [PATCH v5 0/3] Add pinctrl support and enable audio
From: Bo Shen @ 2012-11-12  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

This patch set is based on linux next master branch
The detail information as following:
  Git: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
  Branch: master
  Commit ID: 75e0ebabd87048b91e4189b90d4af8ef565115db

Detail information about implement as following:
  - atmel ssc: add pinctrl support
  - atmel ssc dai: register dai and pcm directly
  - at91sam9g20ek wm8731: convert to dt support

Bo Shen (3):
  ARM: at91: atmel-ssc: add pinctrl support
  ASoC: atmel-ssc-dai: register dai and pcm directly
  ASoC: at91sam9g20ek-wm8731: convert to dt support

 .../sound/atmel-at91sam9g20ek-wm8731-audio.txt     |   26 +++
 arch/arm/boot/dts/at91sam9260.dtsi                 |   18 ++
 arch/arm/boot/dts/at91sam9263.dtsi                 |   36 ++++
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |   34 ++-
 arch/arm/boot/dts/at91sam9g45.dtsi                 |   36 ++++
 arch/arm/boot/dts/at91sam9n12.dtsi                 |   26 +++
 arch/arm/boot/dts/at91sam9x5.dtsi                  |   32 ++-
 arch/arm/mach-at91/at91sam9260_devices.c           |    9 -
 arch/arm/mach-at91/board-sam9g20ek.c               |    8 +-
 drivers/misc/atmel-ssc.c                           |    8 +
 sound/soc/atmel/Kconfig                            |    3 +-
 sound/soc/atmel/atmel-pcm.c                        |   23 +-
 sound/soc/atmel/atmel-pcm.h                        |    3 +
 sound/soc/atmel/atmel_ssc_dai.c                    |  228 +++++---------------
 sound/soc/atmel/atmel_ssc_dai.h                    |    1 +
 sound/soc/atmel/sam9g20_wm8731.c                   |   89 +++++++-
 16 files changed, 357 insertions(+), 223 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-at91sam9g20ek-wm8731-audio.txt

-- 
1.7.9.5

^ permalink raw reply

* [PATCH v5 1/3] ARM: at91: atmel-ssc: add pinctrl support
From: Bo Shen @ 2012-11-12  7:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352706028-750-1-git-send-email-voice.shen@atmel.com>

Add pinctrl support for atmel ssc peripheral

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Change since v4
  - This is initial version
---
 arch/arm/boot/dts/at91sam9260.dtsi |   18 ++++++++++++++++++
 arch/arm/boot/dts/at91sam9263.dtsi |   36 ++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/at91sam9g45.dtsi |   36 ++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/at91sam9n12.dtsi |   26 ++++++++++++++++++++++++++
 arch/arm/boot/dts/at91sam9x5.dtsi  |   32 +++++++++++++++++++++++++-------
 drivers/misc/atmel-ssc.c           |    8 ++++++++
 6 files changed, 149 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 3164dcd..8e3fe92 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -217,6 +217,22 @@
 					};
 				};
 
+				ssc0 {
+					pinctrl_ssc0_tx: ssc0_tx-0 {
+						atmel,pins =
+							<1 16 0x1 0x1	/* PB16 periph A with pull up */
+							 1 17 0x1 0x1	/* PB17 periph A with pull up */
+							 1 18 0x1 0x1>;	/* PB18 periph A with pull up */
+					};
+
+					pinctrl_ssc0_rx: ssc0_rx-0 {
+						atmel,pins =
+							<1 19 0x1 0x1	/* PB19 periph A with pull up */
+							 1 20 0x1 0x1	/* PB20 periph A with pull up */
+							 1 21 0x1 0x1>;	/* PB21 periph A with pull up */
+					};
+				};
+
 				pioA: gpio at fffff400 {
 					compatible = "atmel,at91rm9200-gpio";
 					reg = <0xfffff400 0x200>;
@@ -350,6 +366,8 @@
 				compatible = "atmel,at91rm9200-ssc";
 				reg = <0xfffbc000 0x4000>;
 				interrupts = <14 4 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
 				status = "disable";
 			};
 
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 96e0bc9..80e0811 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -165,6 +165,38 @@
 					};
 				};
 
+				ssc0 {
+					pinctrl_ssc0_tx: ssc0_tx-0 {
+						atmel,pins =
+							<1 0 0x2 0x1	/* PB0 periph B with pull up */
+							 1 1 0x2 0x1	/* PB1 periph B with pull up */
+							 1 2 0x2 0x1>;	/* PB2 periph B with pull up */
+					};
+
+					pinctrl_ssc0_rx: ssc0_rx-0 {
+						atmel,pins =
+							<1 3 0x2 0x1	/* PB3 periph B with pull up */
+							 1 4 0x2 0x1	/* PB4 periph B with pull up */
+							 1 5 0x2 0x1>;	/* PB5 periph B with pull up */
+					};
+				};
+
+				ssc1 {
+					pinctrl_ssc1_tx: ssc1_tx-0 {
+						atmel,pins =
+							<1 6 0x1 0x1	/* PB6 periph A with pull up */
+							 1 7 0x1 0x1	/* PB7 periph A with pull up */
+							 1 8 0x1 0x1>;	/* PB8 periph A with pull up */
+					};
+
+					pinctrl_ssc1_rx: ssc1_rx-0 {
+						atmel,pins =
+							<1 9 0x1 0x1	/* PB9 periph A with pull up */
+							 1 10 0x1 0x1	/* PB10 periph A with pull up */
+							 1 11 0x1 0x1>;	/* PB11 periph A with pull up */
+					};
+				};
+
 				pioA: gpio at fffff200 {
 					compatible = "atmel,at91rm9200-gpio";
 					reg = <0xfffff200 0x200>;
@@ -262,6 +294,8 @@
 				compatible = "atmel,at91rm9200-ssc";
 				reg = <0xfff98000 0x4000>;
 				interrupts = <16 4 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
 				status = "disable";
 			};
 
@@ -269,6 +303,8 @@
 				compatible = "atmel,at91rm9200-ssc";
 				reg = <0xfff9c000 0x4000>;
 				interrupts = <17 4 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
 				status = "disable";
 			};
 
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index c40c3eb..b969247 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -198,6 +198,38 @@
 					};
 				};
 
+				ssc0 {
+					pinctrl_ssc0_tx: ssc0_tx-0 {
+						atmel,pins =
+							<3 0 0x1 0x1	/* PD0 periph A with pull up */
+							 3 1 0x1 0x1	/* PD1 periph A with pull up */
+							 3 2 0x1 0x1>;	/* PD2 periph A with pull up */
+					};
+
+					pinctrl_ssc0_rx: ssc0_rx-0 {
+						atmel,pins =
+							<3 3 0x1 0x1	/* PD3 periph A with pull up */
+							 3 4 0x1 0x1	/* PD4 periph A with pull up */
+							 3 5 0x1 0x1>;	/* PD5 periph A with pull up */
+					};
+				};
+
+				ssc1 {
+					pinctrl_ssc1_tx: ssc1_tx-0 {
+						atmel,pins =
+							<3 10 0x1 0x1	/* PD10 periph A with pull up */
+							 3 11 0x1 0x1	/* PD11 periph A with pull up */
+							 3 12 0x1 0x1>;	/* PD12 periph A with pull up */
+					};
+
+					pinctrl_ssc1_rx: ssc1_rx-0 {
+						atmel,pins =
+							<3 13 0x1 0x1	/* PD13 periph A with pull up */
+							 3 14 0x1 0x1	/* PD14 periph A with pull up */
+							 3 15 0x1 0x1>;	/* PD15 periph A with pull up */
+					};
+				};
+
 				pioA: gpio at fffff200 {
 					compatible = "atmel,at91rm9200-gpio";
 					reg = <0xfffff200 0x200>;
@@ -331,6 +363,8 @@
 				compatible = "atmel,at91sam9g45-ssc";
 				reg = <0xfff9c000 0x4000>;
 				interrupts = <16 4 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
 				status = "disable";
 			};
 
@@ -338,6 +372,8 @@
 				compatible = "atmel,at91sam9g45-ssc";
 				reg = <0xfffa0000 0x4000>;
 				interrupts = <17 4 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
 				status = "disable";
 			};
 
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 7b644c5..f39ffa3 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -28,6 +28,7 @@
 		tcb1 = &tcb1;
 		i2c0 = &i2c0;
 		i2c1 = &i2c1;
+		ssc0 = &ssc0;
 	};
 	cpus {
 		cpu at 0 {
@@ -199,6 +200,22 @@
 					};
 				};
 
+				ssc0 {
+					pinctrl_ssc0_tx: ssc0_tx-0 {
+						atmel,pins =
+							<0 24 0x1 0x1	/* PA24 periph A with pull up */
+							 0 25 0x1 0x1	/* PA25 periph A with pull up */
+							 0 26 0x1 0x1>;	/* PA26 periph A with pull up */
+					};
+
+					pinctrl_ssc0_rx: ssc0_rx-0 {
+						atmel,pins =
+							<0 27 0x1 0x1	/* PA27 periph A with pull up */
+							 0 28 0x1 0x1	/* PA28 periph A with pull up */
+							 0 29 0x1 0x1>;	/* PA29 periph A with pull up */
+					};
+				};
+
 				pioA: gpio at fffff400 {
 					compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
 					reg = <0xfffff400 0x200>;
@@ -249,6 +266,15 @@
 				status = "disabled";
 			};
 
+			ssc0: ssc at f0010000 {
+				compatible = "atmel,at91sam9g45-ssc";
+				reg = <0xf0010000 0x4000>;
+				interrupts = <28 4 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
+				status = "disable";
+			};
+
 			usart0: serial at f801c000 {
 				compatible = "atmel,at91sam9260-usart";
 				reg = <0xf801c000 0x4000>;
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 1cb26c28..b60e15e 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -88,13 +88,6 @@
 				interrupts = <1 4 7>;
 			};
 
-			ssc0: ssc at f0010000 {
-				compatible = "atmel,at91sam9g45-ssc";
-				reg = <0xf0010000 0x4000>;
-				interrupts = <28 4 5>;
-				status = "disable";
-			};
-
 			tcb0: timer at f8008000 {
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf8008000 0x100>;
@@ -214,6 +207,22 @@
 					};
 				};
 
+				ssc0 {
+					pinctrl_ssc0_tx: ssc0_tx-0 {
+						atmel,pins =
+							<0 24 0x1 0x1	/* PA24 periph A with pull up */
+							 0 25 0x1 0x1	/* PA25 periph A with pull up */
+							 0 26 0x1 0x1>;	/* PA26 periph A with pull up */
+					};
+
+					pinctrl_ssc0_rx: ssc0_rx-0 {
+						atmel,pins =
+							<0 27 0x1 0x1	/* PA27 periph A with pull up */
+							 0 28 0x1 0x1	/* PA28 periph A with pull up */
+							 0 29 0x1 0x1>;	/* PA29 periph A with pull up */
+					};
+				};
+
 				pioA: gpio at fffff400 {
 					compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
 					reg = <0xfffff400 0x200>;
@@ -266,6 +275,15 @@
 				status = "disabled";
 			};
 
+			ssc0: ssc at f0010000 {
+				compatible = "atmel,at91sam9g45-ssc";
+				reg = <0xf0010000 0x4000>;
+				interrupts = <28 4 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
+				status = "disable";
+			};
+
 			usart0: serial at f801c000 {
 				compatible = "atmel,at91sam9260-usart";
 				reg = <0xf801c000 0x200>;
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index a769719..3b3d0e0 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 
 /* Serialize access to ssc_list and user count */
 static DEFINE_SPINLOCK(user_lock);
@@ -131,6 +132,13 @@ static int ssc_probe(struct platform_device *pdev)
 	struct resource *regs;
 	struct ssc_device *ssc;
 	const struct atmel_ssc_platform_data *plat_dat;
+	struct pinctrl *pinctrl;
+
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		dev_err(&pdev->dev, "Failed to request pinctrl\n");
+		return PTR_ERR(pinctrl);
+	}
 
 	ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL);
 	if (!ssc) {
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v5 2/3] ASoC: atmel-ssc-dai: register dai and pcm directly
From: Bo Shen @ 2012-11-12  7:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352706028-750-1-git-send-email-voice.shen@atmel.com>

change the method for register dai and pcm
  - let the atmel-ssc-dai no longer as a standalone platform device
  - remap ssc and then register dai directly
  - register pcm from dai directly

Modify the code which related with this change

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Change since v4 RFC
  - no change
Change since v3 RFC
  - remap ssc and then register dai and pcm directly
Change since v2
  - Register dai and pcm directly according to Mark Brown's suggestion
    - using name to distinguish ssc register for audio or library
      if for audio, the name with dai subfix
      if for library, the name without dai subfix
  - fix the issue for sam9g20-wm8731
    - when register dai and pcm cause the sam9g20-wm8731 doesn't work,
      so fix it
  - Add device tree support
    - Detail information reference atmel-ssc-dai.txt binding document
Change since v1
  No change
---
 arch/arm/mach-at91/at91sam9260_devices.c |    9 --
 arch/arm/mach-at91/board-sam9g20ek.c     |    8 +-
 sound/soc/atmel/atmel-pcm.c              |   23 +--
 sound/soc/atmel/atmel-pcm.h              |    3 +
 sound/soc/atmel/atmel_ssc_dai.c          |  228 +++++++-----------------------
 sound/soc/atmel/atmel_ssc_dai.h          |    1 +
 sound/soc/atmel/sam9g20_wm8731.c         |   13 +-
 7 files changed, 76 insertions(+), 209 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index df7bebf..6959fd2 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -768,14 +768,6 @@ static inline void configure_ssc_pins(unsigned pins)
 		at91_set_A_periph(AT91_PIN_PB21, 1);
 }
 
-static struct platform_device at91sam9260_ssc_dai_device = {
-	.name	= "atmel-ssc-dai",
-	.id	= 0,
-	.dev	= {
-		.parent	= &(at91sam9260_ssc_device.dev),
-	},
-};
-
 /*
  * SSC controllers are accessed through library code, instead of any
  * kind of all-singing/all-dancing driver.  For example one could be
@@ -800,7 +792,6 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins)
 	}
 
 	platform_device_register(pdev);
-	platform_device_register(&at91sam9260_ssc_dai_device);
 }
 
 #else
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 5b6a6f9..f3faf54 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -353,19 +353,13 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
         },
 };
 
-static struct platform_device sam9g20ek_pcm_device = {
-	.name	= "atmel-pcm-audio",
-	.id = -1,
-};
-
 static struct platform_device sam9g20ek_audio_device = {
 	.name   = "at91sam9g20ek-audio",
-	.id     = -1,
+	.id     = 0,
 };
 
 static void __init ek_add_device_audio(void)
 {
-	platform_device_register(&sam9g20ek_pcm_device);
 	platform_device_register(&sam9g20ek_audio_device);
 }
 
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index 9b84f98..40e17d1 100644
--- a/sound/soc/atmel/atmel-pcm.c
+++ b/sound/soc/atmel/atmel-pcm.c
@@ -473,28 +473,17 @@ static struct snd_soc_platform_driver atmel_soc_platform = {
 	.resume		= atmel_pcm_resume,
 };
 
-static int __devinit atmel_soc_platform_probe(struct platform_device *pdev)
+int atmel_pcm_platform_register(struct device *dev)
 {
-	return snd_soc_register_platform(&pdev->dev, &atmel_soc_platform);
+	return snd_soc_register_platform(dev, &atmel_soc_platform);
 }
+EXPORT_SYMBOL(atmel_pcm_platform_register);
 
-static int __devexit atmel_soc_platform_remove(struct platform_device *pdev)
+void atmel_pcm_platform_unregister(struct device *dev)
 {
-	snd_soc_unregister_platform(&pdev->dev);
-	return 0;
+	snd_soc_unregister_platform(dev);
 }
-
-static struct platform_driver atmel_pcm_driver = {
-	.driver = {
-			.name = "atmel-pcm-audio",
-			.owner = THIS_MODULE,
-	},
-
-	.probe = atmel_soc_platform_probe,
-	.remove = __devexit_p(atmel_soc_platform_remove),
-};
-
-module_platform_driver(atmel_pcm_driver);
+EXPORT_SYMBOL(atmel_pcm_platform_unregister);
 
 MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
 MODULE_DESCRIPTION("Atmel PCM module");
diff --git a/sound/soc/atmel/atmel-pcm.h b/sound/soc/atmel/atmel-pcm.h
index 5e0a95e..e6d67b3 100644
--- a/sound/soc/atmel/atmel-pcm.h
+++ b/sound/soc/atmel/atmel-pcm.h
@@ -80,4 +80,7 @@ struct atmel_pcm_dma_params {
 #define ssc_readx(base, reg)            (__raw_readl((base) + (reg)))
 #define ssc_writex(base, reg, value)    __raw_writel((value), (base) + (reg))
 
+int atmel_pcm_platform_register(struct device *dev);
+void atmel_pcm_platform_unregister(struct device *dev);
+
 #endif /* _ATMEL_PCM_H */
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 354341e..4435e19 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -47,13 +47,6 @@
 #include "atmel-pcm.h"
 #include "atmel_ssc_dai.h"
 
-
-#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
-#define NUM_SSC_DEVICES		1
-#else
-#define NUM_SSC_DEVICES		3
-#endif
-
 /*
  * SSC PDC registers required by the PCM DMA engine.
  */
@@ -96,63 +89,24 @@ static struct atmel_ssc_mask ssc_rx_mask = {
 /*
  * DMA parameters.
  */
-static struct atmel_pcm_dma_params ssc_dma_params[NUM_SSC_DEVICES][2] = {
-	{{
-	.name		= "SSC0 PCM out",
-	.pdc		= &pdc_tx_reg,
-	.mask		= &ssc_tx_mask,
-	},
+static struct atmel_pcm_dma_params ssc_dma_params[2] = {
 	{
-	.name		= "SSC0 PCM in",
-	.pdc		= &pdc_rx_reg,
-	.mask		= &ssc_rx_mask,
-	} },
-#if NUM_SSC_DEVICES == 3
-	{{
-	.name		= "SSC1 PCM out",
+	.name		= "SSC PCM out",
 	.pdc		= &pdc_tx_reg,
 	.mask		= &ssc_tx_mask,
 	},
 	{
-	.name		= "SSC1 PCM in",
+	.name		= "SSC PCM in",
 	.pdc		= &pdc_rx_reg,
 	.mask		= &ssc_rx_mask,
-	} },
-	{{
-	.name		= "SSC2 PCM out",
-	.pdc		= &pdc_tx_reg,
-	.mask		= &ssc_tx_mask,
 	},
-	{
-	.name		= "SSC2 PCM in",
-	.pdc		= &pdc_rx_reg,
-	.mask		= &ssc_rx_mask,
-	} },
-#endif
 };
 
-
-static struct atmel_ssc_info ssc_info[NUM_SSC_DEVICES] = {
-	{
-	.name		= "ssc0",
-	.lock		= __SPIN_LOCK_UNLOCKED(ssc_info[0].lock),
-	.dir_mask	= SSC_DIR_MASK_UNUSED,
-	.initialized	= 0,
-	},
-#if NUM_SSC_DEVICES == 3
-	{
-	.name		= "ssc1",
-	.lock		= __SPIN_LOCK_UNLOCKED(ssc_info[1].lock),
+static struct atmel_ssc_info ssc_info = {
+	.name		= "ssc",
+	.lock		= __SPIN_LOCK_UNLOCKED(ssc_info.lock),
 	.dir_mask	= SSC_DIR_MASK_UNUSED,
 	.initialized	= 0,
-	},
-	{
-	.name		= "ssc2",
-	.lock		= __SPIN_LOCK_UNLOCKED(ssc_info[2].lock),
-	.dir_mask	= SSC_DIR_MASK_UNUSED,
-	.initialized	= 0,
-	},
-#endif
 };
 
 
@@ -205,7 +159,7 @@ static irqreturn_t atmel_ssc_interrupt(int irq, void *dev_id)
 static int atmel_ssc_startup(struct snd_pcm_substream *substream,
 			     struct snd_soc_dai *dai)
 {
-	struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
+	struct atmel_ssc_info *ssc_p = &ssc_info;
 	int dir_mask;
 
 	pr_debug("atmel_ssc_startup: SSC_SR=0x%u\n",
@@ -234,7 +188,7 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream,
 static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
 			       struct snd_soc_dai *dai)
 {
-	struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
+	struct atmel_ssc_info *ssc_p = &ssc_info;
 	struct atmel_pcm_dma_params *dma_params;
 	int dir, dir_mask;
 
@@ -285,7 +239,7 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
 static int atmel_ssc_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		unsigned int fmt)
 {
-	struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id];
+	struct atmel_ssc_info *ssc_p = &ssc_info;
 
 	ssc_p->daifmt = fmt;
 	return 0;
@@ -297,7 +251,7 @@ static int atmel_ssc_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
 	int div_id, int div)
 {
-	struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id];
+	struct atmel_ssc_info *ssc_p = &ssc_info;
 
 	switch (div_id) {
 	case ATMEL_SSC_CMR_DIV:
@@ -336,8 +290,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_dai *dai)
 {
 	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
-	int id = dai->id;
-	struct atmel_ssc_info *ssc_p = &ssc_info[id];
+	struct atmel_ssc_info *ssc_p = &ssc_info;
 	struct atmel_pcm_dma_params *dma_params;
 	int dir, channels, bits;
 	u32 tfmr, rfmr, tcmr, rcmr;
@@ -354,7 +307,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 	else
 		dir = 1;
 
-	dma_params = &ssc_dma_params[id][dir];
+	dma_params = &ssc_dma_params[dir];
 	dma_params->ssc = ssc_p->ssc;
 	dma_params->substream = substream;
 
@@ -603,7 +556,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 static int atmel_ssc_prepare(struct snd_pcm_substream *substream,
 			     struct snd_soc_dai *dai)
 {
-	struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
+	struct atmel_ssc_info *ssc_p = &ssc_info;
 	struct atmel_pcm_dma_params *dma_params;
 	int dir;
 
@@ -631,7 +584,7 @@ static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai)
 	if (!cpu_dai->active)
 		return 0;
 
-	ssc_p = &ssc_info[cpu_dai->id];
+	ssc_p = &ssc_info;
 
 	/* Save the status register before disabling transmit and receive */
 	ssc_p->ssc_state.ssc_sr = ssc_readl(ssc_p->ssc->regs, SR);
@@ -660,7 +613,7 @@ static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai)
 	if (!cpu_dai->active)
 		return 0;
 
-	ssc_p = &ssc_info[cpu_dai->id];
+	ssc_p = &ssc_info;
 
 	/* restore SSC register settings */
 	ssc_writel(ssc_p->ssc->regs, TFMR, ssc_p->ssc_state.ssc_tfmr);
@@ -689,28 +642,10 @@ static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai)
 
 static int atmel_ssc_probe(struct snd_soc_dai *dai)
 {
-	struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
-	int ret = 0;
+	struct atmel_ssc_info *ssc_p = &ssc_info;
 
 	snd_soc_dai_set_drvdata(dai, ssc_p);
 
-	/*
-	 * Request SSC device
-	 */
-	ssc_p->ssc = ssc_request(dai->id);
-	if (IS_ERR(ssc_p->ssc)) {
-		printk(KERN_ERR "ASoC: Failed to request SSC %d\n", dai->id);
-		ret = PTR_ERR(ssc_p->ssc);
-	}
-
-	return ret;
-}
-
-static int atmel_ssc_remove(struct snd_soc_dai *dai)
-{
-	struct atmel_ssc_info *ssc_p = snd_soc_dai_get_drvdata(dai);
-
-	ssc_free(ssc_p->ssc);
 	return 0;
 }
 
@@ -728,11 +663,8 @@ static const struct snd_soc_dai_ops atmel_ssc_dai_ops = {
 	.set_clkdiv	= atmel_ssc_set_dai_clkdiv,
 };
 
-static struct snd_soc_dai_driver atmel_ssc_dai[NUM_SSC_DEVICES] = {
-	{
-		.name = "atmel-ssc-dai.0",
+static struct snd_soc_dai_driver atmel_ssc_dai = {
 		.probe = atmel_ssc_probe,
-		.remove = atmel_ssc_remove,
 		.suspend = atmel_ssc_suspend,
 		.resume = atmel_ssc_resume,
 		.playback = {
@@ -746,69 +678,37 @@ static struct snd_soc_dai_driver atmel_ssc_dai[NUM_SSC_DEVICES] = {
 			.rates = ATMEL_SSC_RATES,
 			.formats = ATMEL_SSC_FORMATS,},
 		.ops = &atmel_ssc_dai_ops,
-	},
-#if NUM_SSC_DEVICES == 3
-	{
-		.name = "atmel-ssc-dai.1",
-		.probe = atmel_ssc_probe,
-		.remove = atmel_ssc_remove,
-		.suspend = atmel_ssc_suspend,
-		.resume = atmel_ssc_resume,
-		.playback = {
-			.channels_min = 1,
-			.channels_max = 2,
-			.rates = ATMEL_SSC_RATES,
-			.formats = ATMEL_SSC_FORMATS,},
-		.capture = {
-			.channels_min = 1,
-			.channels_max = 2,
-			.rates = ATMEL_SSC_RATES,
-			.formats = ATMEL_SSC_FORMATS,},
-		.ops = &atmel_ssc_dai_ops,
-	},
-	{
-		.name = "atmel-ssc-dai.2",
-		.probe = atmel_ssc_probe,
-		.remove = atmel_ssc_remove,
-		.suspend = atmel_ssc_suspend,
-		.resume = atmel_ssc_resume,
-		.playback = {
-			.channels_min = 1,
-			.channels_max = 2,
-			.rates = ATMEL_SSC_RATES,
-			.formats = ATMEL_SSC_FORMATS,},
-		.capture = {
-			.channels_min = 1,
-			.channels_max = 2,
-			.rates = ATMEL_SSC_RATES,
-			.formats = ATMEL_SSC_FORMATS,},
-		.ops = &atmel_ssc_dai_ops,
-	},
-#endif
 };
 
-static __devinit int asoc_ssc_probe(struct platform_device *pdev)
+static int asoc_ssc_init(struct device *dev)
 {
-	BUG_ON(pdev->id < 0);
-	BUG_ON(pdev->id >= ARRAY_SIZE(atmel_ssc_dai));
-	return snd_soc_register_dai(&pdev->dev, &atmel_ssc_dai[pdev->id]);
-}
+	int ret;
+
+	ret = snd_soc_register_dai(dev, &atmel_ssc_dai);
+	if (ret) {
+		dev_err(dev, "Could not register DAI: %d\n", ret);
+		goto err;
+	}
+
+	ret = atmel_pcm_platform_register(dev);
+	if (ret) {
+		dev_err(dev, "Could not register PCM: %d\n", ret);
+		goto err_unregister_dai;
+	};
 
-static int __devexit asoc_ssc_remove(struct platform_device *pdev)
-{
-	snd_soc_unregister_dai(&pdev->dev);
 	return 0;
-}
 
-static struct platform_driver asoc_ssc_driver = {
-	.driver = {
-			.name = "atmel-ssc-dai",
-			.owner = THIS_MODULE,
-	},
+err_unregister_dai:
+	snd_soc_unregister_dai(dev);
+err:
+	return ret;
+}
 
-	.probe = asoc_ssc_probe,
-	.remove = __devexit_p(asoc_ssc_remove),
-};
+static void asoc_ssc_exit(struct device *dev)
+{
+	atmel_pcm_platform_unregister(dev);
+	snd_soc_unregister_dai(dev);
+}
 
 /**
  * atmel_ssc_set_audio - Allocate the specified SSC for audio use.
@@ -816,50 +716,32 @@ static struct platform_driver asoc_ssc_driver = {
 int atmel_ssc_set_audio(int ssc_id)
 {
 	struct ssc_device *ssc;
-	static struct platform_device *dma_pdev;
-	struct platform_device *ssc_pdev;
 	int ret;
 
-	if (ssc_id < 0 || ssc_id >= ARRAY_SIZE(atmel_ssc_dai))
-		return -EINVAL;
-
-	/* Allocate a dummy device for DMA if we don't have one already */
-	if (!dma_pdev) {
-		dma_pdev = platform_device_alloc("atmel-pcm-audio", -1);
-		if (!dma_pdev)
-			return -ENOMEM;
-
-		ret = platform_device_add(dma_pdev);
-		if (ret < 0) {
-			platform_device_put(dma_pdev);
-			dma_pdev = NULL;
-			return ret;
-		}
-	}
-
-	ssc_pdev = platform_device_alloc("atmel-ssc-dai", ssc_id);
-	if (!ssc_pdev)
-		return -ENOMEM;
-
 	/* If we can grab the SSC briefly to parent the DAI device off it */
 	ssc = ssc_request(ssc_id);
-	if (IS_ERR(ssc))
-		pr_warn("Unable to parent ASoC SSC DAI on SSC: %ld\n",
+	if (IS_ERR(ssc)) {
+		pr_err("Unable to parent ASoC SSC DAI on SSC: %ld\n",
 			PTR_ERR(ssc));
-	else {
-		ssc_pdev->dev.parent = &(ssc->pdev->dev);
-		ssc_free(ssc);
+		return PTR_ERR(ssc);
+	} else {
+		ssc_info.ssc = ssc;
 	}
 
-	ret = platform_device_add(ssc_pdev);
-	if (ret < 0)
-		platform_device_put(ssc_pdev);
+	ret = asoc_ssc_init(&ssc->pdev->dev);
 
 	return ret;
 }
 EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);
 
-module_platform_driver(asoc_ssc_driver);
+void atmel_ssc_put_audio(void)
+{
+	struct ssc_device *ssc = ssc_info.ssc;
+
+	ssc_free(ssc);
+	asoc_ssc_exit(&ssc->pdev->dev);
+}
+EXPORT_SYMBOL_GPL(atmel_ssc_put_audio);
 
 /* Module information */
 MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou at atmel.com, www.atmel.com");
diff --git a/sound/soc/atmel/atmel_ssc_dai.h b/sound/soc/atmel/atmel_ssc_dai.h
index 5d4f0f9..70c66dd 100644
--- a/sound/soc/atmel/atmel_ssc_dai.h
+++ b/sound/soc/atmel/atmel_ssc_dai.h
@@ -118,5 +118,6 @@ struct atmel_ssc_info {
 };
 
 int atmel_ssc_set_audio(int ssc);
+void atmel_ssc_put_audio(void);
 
 #endif /* _AT91_SSC_DAI_H */
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 228ca6a..eef6eed 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -179,10 +179,10 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
 static struct snd_soc_dai_link at91sam9g20ek_dai = {
 	.name = "WM8731",
 	.stream_name = "WM8731 PCM",
-	.cpu_dai_name = "atmel-ssc-dai.0",
+	.cpu_dai_name = "at91rm9200_ssc.0",
 	.codec_dai_name = "wm8731-hifi",
 	.init = at91sam9g20ek_wm8731_init,
-	.platform_name = "atmel-pcm-audio",
+	.platform_name = "at91rm9200_ssc.0",
 	.codec_name = "wm8731.0-001b",
 	.ops = &at91sam9g20ek_ops,
 };
@@ -204,6 +204,10 @@ static int __devinit at91sam9g20ek_audio_probe(struct platform_device *pdev)
 	if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
 		return -ENODEV;
 
+	ret = atmel_ssc_set_audio(pdev->id);
+	if (ret)
+		goto err;
+
 	/*
 	 * Codec MCLK is supplied by PCK0 - set it up.
 	 */
@@ -211,7 +215,7 @@ static int __devinit at91sam9g20ek_audio_probe(struct platform_device *pdev)
 	if (IS_ERR(mclk)) {
 		printk(KERN_ERR "ASoC: Failed to get MCLK\n");
 		ret = PTR_ERR(mclk);
-		goto err;
+		goto err_ssc_put_audio;
 	}
 
 	pllb = clk_get(NULL, "pllb");
@@ -240,6 +244,8 @@ static int __devinit at91sam9g20ek_audio_probe(struct platform_device *pdev)
 err_mclk:
 	clk_put(mclk);
 	mclk = NULL;
+err_ssc_put_audio:
+	atmel_ssc_put_audio();
 err:
 	return ret;
 }
@@ -248,6 +254,7 @@ static int __devexit at91sam9g20ek_audio_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
+	atmel_ssc_put_audio();
 	snd_soc_unregister_card(card);
 	clk_put(mclk);
 	mclk = NULL;
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 3/3] ASoC: at91sam9g20ek-wm8731: convert to dt support
From: Bo Shen @ 2012-11-12  7:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352706028-750-1-git-send-email-voice.shen@atmel.com>

convert at91sam9g20ek wm8731 to device tree support

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Change since v4 RFC:
  Using the full name of the EK which make it more clear
Change since v3 RFC:
  Remove dai node, remap ssc in place
  without pinctrl added, so don't modify the dtsi file, will be added
  soon
Change since v2:
  No change
Change since v1:
  Add sam9g20-wm8731 binding document
---
 .../sound/atmel-at91sam9g20ek-wm8731-audio.txt     |   26 +++++++
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |   34 ++++++++-
 sound/soc/atmel/Kconfig                            |    3 +-
 sound/soc/atmel/sam9g20_wm8731.c                   |   78 +++++++++++++++++++-
 4 files changed, 133 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-at91sam9g20ek-wm8731-audio.txt

diff --git a/Documentation/devicetree/bindings/sound/atmel-at91sam9g20ek-wm8731-audio.txt b/Documentation/devicetree/bindings/sound/atmel-at91sam9g20ek-wm8731-audio.txt
new file mode 100644
index 0000000..9c5a994
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel-at91sam9g20ek-wm8731-audio.txt
@@ -0,0 +1,26 @@
+* Atmel at91sam9g20ek wm8731 audio complex
+
+Required properties:
+  - compatible: "atmel,at91sam9g20ek-wm8731-audio"
+  - atmel,model: The user-visible name of this sound complex.
+  - atmel,audio-routing: A list of the connections between audio components.
+  - atmel,ssc-controller: The phandle of the SSC controller
+  - atmel,audio-codec: The phandle of the WM8731 audio codec
+Optional properties:
+  - pinctrl-names, pinctrl-0: Please refer to pinctrl-bindings.txt
+
+Example:
+sound {
+	compatible = "atmel,at91sam9g20ek-wm8731-audio";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_pck0_as_mck>;
+
+	atmel,model = "wm8731 @ AT91SAMG20EK";
+
+	atmel,audio-routing =
+		"Ext Spk", "LHPOUT",
+		"Int MIC", "MICIN";
+
+	atmel,ssc-controller = <&ssc0>;
+	atmel,audio-codec = <&wm8731>;
+};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index 689323d..4c37546 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -30,6 +30,16 @@
 
 	ahb {
 		apb {
+			pinctrl at fffff400 {
+				board {
+					pinctrl_pck0_as_mck: pck0_as_mck {
+						atmel,pins =
+							<2 1 0x2 0x0>;	/* PC1 periph B */
+					};
+
+				};
+			};
+
 			dbgu: serial at fffff200 {
 				status = "okay";
 			};
@@ -57,6 +67,11 @@
 				atmel,vbus-gpio = <&pioC 5 0>;
 				status = "okay";
 			};
+
+			ssc0: ssc at fffbc000 {
+				status = "okay";
+				pinctrl-0 = <&pinctrl_ssc0_tx>;
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -120,8 +135,8 @@
 			reg = <0x50>;
 		};
 
-		wm8731 at 1b {
-			compatible = "wm8731";
+		wm8731: wm8731 at 1b {
+			compatible = "wlf,wm8731";
 			reg = <0x1b>;
 		};
 	};
@@ -145,4 +160,19 @@
 			gpio-key,wakeup;
 		};
 	};
+
+	sound {
+		compatible = "atmel,at91sam9g20ek-wm8731-audio";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_pck0_as_mck>;
+
+		atmel,model = "wm8731 @ AT91SAMG20EK";
+
+		atmel,audio-routing =
+			"Ext Spk", "LHPOUT",
+			"Int Mic", "MICIN";
+
+		atmel,ssc-controller = <&ssc0>;
+		atmel,audio-codec = <&wm8731>;
+	};
 };
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index 72b09cf..397ec75 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -16,8 +16,7 @@ config SND_ATMEL_SOC_SSC
 
 config SND_AT91_SOC_SAM9G20_WM8731
 	tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
-	depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC && \
-                   AT91_PROGRAMMABLE_CLOCKS
+	depends on ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
 	select SND_ATMEL_SOC_SSC
 	select SND_SOC_WM8731
 	help
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index eef6eed..6bb9446 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -38,6 +38,8 @@
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
 
+#include <linux/pinctrl/consumer.h>
+
 #include <linux/atmel-ssc.h>
 
 #include <sound/core.h>
@@ -197,14 +199,37 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = {
 
 static int __devinit at91sam9g20ek_audio_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
+	struct device_node *codec_np, *cpu_np;
 	struct clk *pllb;
 	struct snd_soc_card *card = &snd_soc_at91sam9g20ek;
-	int ret;
+	struct pinctrl *pinctrl;
+	int ret, id;
+
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		dev_err(&pdev->dev, "Failed to request pinctrl\n");
+		return PTR_ERR(pinctrl);
+	}
 
-	if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
-		return -ENODEV;
+	if (np) {
+		cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0);
+		if (!cpu_np) {
+			dev_err(&pdev->dev, "codec info missing\n");
+			return -EINVAL;
+		}
+
+		id = of_alias_get_id(cpu_np, "ssc");
+		of_node_put(cpu_np);
+	} else {
+		if (!(machine_is_at91sam9g20ek() ||
+			machine_is_at91sam9g20ek_2mmc()))
+			return -ENODEV;
+
+		id = pdev->id;
+	}
 
-	ret = atmel_ssc_set_audio(pdev->id);
+	ret = atmel_ssc_set_audio(id);
 	if (ret)
 		goto err;
 
@@ -234,6 +259,42 @@ static int __devinit at91sam9g20ek_audio_probe(struct platform_device *pdev)
 	clk_set_rate(mclk, MCLK_RATE);
 
 	card->dev = &pdev->dev;
+
+	/* Parse device node info */
+	if (np) {
+		ret = snd_soc_of_parse_card_name(card, "atmel,model");
+		if (ret)
+			goto err;
+
+		ret = snd_soc_of_parse_audio_routing(card,
+			"atmel,audio-routing");
+		if (ret)
+			goto err;
+
+		/* Parse codec info */
+		at91sam9g20ek_dai.codec_name = NULL;
+		codec_np = of_parse_phandle(np, "atmel,audio-codec", 0);
+		if (!codec_np) {
+			dev_err(&pdev->dev, "codec info missing\n");
+			return -EINVAL;
+		}
+		at91sam9g20ek_dai.codec_of_node = codec_np;
+
+		/* Parse dai and platform info */
+		at91sam9g20ek_dai.cpu_dai_name = NULL;
+		at91sam9g20ek_dai.platform_name = NULL;
+		cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0);
+		if (!cpu_np) {
+			dev_err(&pdev->dev, "dai and pcm info missing\n");
+			return -EINVAL;
+		}
+		at91sam9g20ek_dai.cpu_of_node = cpu_np;
+		at91sam9g20ek_dai.platform_of_node = cpu_np;
+
+		of_node_put(codec_np);
+		of_node_put(cpu_np);
+	}
+
 	ret = snd_soc_register_card(card);
 	if (ret) {
 		printk(KERN_ERR "ASoC: snd_soc_register_card() failed\n");
@@ -262,10 +323,19 @@ static int __devexit at91sam9g20ek_audio_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id at91sam9g20ek_wm8731_dt_ids[] = {
+	{ .compatible = "atmel,at91sam9g20ek-wm8731-audio", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, at91sam9g20ek_wm8731_dt_ids);
+#endif
+
 static struct platform_driver at91sam9g20ek_audio_driver = {
 	.driver = {
 		.name	= "at91sam9g20ek-audio",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(at91sam9g20ek_wm8731_dt_ids),
 	},
 	.probe	= at91sam9g20ek_audio_probe,
 	.remove	= __devexit_p(at91sam9g20ek_audio_remove),
-- 
1.7.9.5

^ permalink raw reply related

* usb clock not found on imx27 when using dt
From: s.hauer at pengutronix.de @ 2012-11-12  7:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352666074.32152.YahooMailNeo@web28806.mail.ir2.yahoo.com>

On Sun, Nov 11, 2012 at 08:34:34PM +0000, Philippe Reynes wrote:
> Hi all,
> 
> I try to add the support of usb on my armadeus apf27,
> but there is a problem when try to reclaim the clock.
> imx_usb mxc-ehci.0: Failed to get clock, err=-2
> 
> To avoid adding too many attachment to this mail,
> I've put all the information on a website. You can
> found them here:? http://ryu.zarb.org/~trem/armadeus/
> 
> 
> The initial issue is in the directory : 20121110
> 
> boot-3.7-rc4.log : boot log with the issue
> linux-3.7-rc4.config : the configuration file for the kernel
> investifation.txt : the description of my investigation.

You should really post the relevant bits on the mailing list. Nobody
visits websites for investigating your issue. Besides, it will not be
in the mailing list archives so people will not find it later.

> 
> 
> I've tried to fix the clock issue, but another issue occurs.
> The information about this "fix" is in : 20121111
> boot-3.7-rc4.log : boot log with the new issue
> issue.txt : the description of the change done on the kernel
> 
> I've got severals questions :
> - does my dts correct with usb change ?
> - does someone has already tested usb on imx27 with dt ?

Please investigate in using the chipidea driver. This will be the way
forward for i.MX.

Sascha

-- 
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 |

^ permalink raw reply

* Porting board initialization for fdt
From: Felipe Balbi @ 2012-11-12  8:01 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAE7jHC-Z9wy=5HPzhZZpupcBVn862ERq1LRF9KQ=Ed7BXiDFBA@mail.gmail.com>

Hi,

On Mon, Nov 12, 2012 at 12:38:37AM +0200, Constantine Shulyupin wrote:
> What is architecture and the best strategy to port board initialization to fdt?
> 
> Let's see for example omap4_ehci_init and usbhs_bdata @
> arch/arm/mach-omap2/board-omap4panda.c.

before getting rid of platform_data, we need to switch over to proper
frameworks for muxing, clock, etc. In case of EHCI, pinctrl migration is
currently under development by Keshava (in Cc). After that we need to
take a look at platform and see if there are any function pointers in
there, if there are, those need to be removed.

> How to perform board specific initializations?
> Can omap4_ehci_init be converted to probe function of new platform
> driver  omap4_ehci?

yeah, that function is actually wrong. First, that GPIO pin belongs to
the HUB driver, not the EHCI driver.

Second, those clocks belong to the PHY, not EHCI either. Before those
details are cleaned up, we will always have hacky solutions which will
break in one way or another.

When those cleanups are done, conversion to FDT is not a problem at all.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121112/e3af94ee/attachment.sig>

^ permalink raw reply

* [PATCH RESEND] ARM: at91: dt: evk-pro3: enable uart0 and uart2
From: Fabio Porcedda @ 2012-11-12  8:09 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 based on v3.7-rc5

 arch/arm/boot/dts/evk-pro3.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/evk-pro3.dts b/arch/arm/boot/dts/evk-pro3.dts
index ce959ee..96e50f5 100644
--- a/arch/arm/boot/dts/evk-pro3.dts
+++ b/arch/arm/boot/dts/evk-pro3.dts
@@ -22,6 +22,14 @@
 				status = "okay";
 			};
 
+			usart0: serial at fffb0000 {
+				status = "okay";
+			};
+
+			usart2: serial at fffb8000 {
+				status = "okay";
+			};
+
 			usb1: gadget at fffa4000 {
 				atmel,vbus-gpio = <&pioC 5 0>;
 				status = "okay";
-- 
1.8.0

^ permalink raw reply related

* [RFC 6/6] ARM: sched: clear SD_SHARE_POWERLINE
From: Vincent Guittot @ 2012-11-12  8:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <5093A7C5.9080605@ti.com>

On 2 November 2012 12:00, Santosh Shilimkar <santosh.shilimkar@ti.com> wrote:
> On Monday 29 October 2012 06:58 PM, Vincent Guittot wrote:
>>
>> On 24 October 2012 17:21, Santosh Shilimkar <santosh.shilimkar@ti.com>
>> wrote:
>>>
>>> On Sunday 07 October 2012 01:13 PM, Vincent Guittot wrote:
>>>>
>>>>
>>>> The ARM platforms take advantage of packing small tasks on few cores.
>>>> This is true even when the cores of a cluster can't be powergated
>>>> independently.
>>>>
>>>>
>>>> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
>>>> ---
>>>>    arch/arm/kernel/topology.c |    5 +++++
>>>>    1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
>>>> index 26c12c6..00511d0 100644
>>>> --- a/arch/arm/kernel/topology.c
>>>> +++ b/arch/arm/kernel/topology.c
>>>> @@ -226,6 +226,11 @@ static inline void update_cpu_power(unsigned int
>>>> cpuid, unsigned int mpidr) {}
>>>>     */
>>>>    struct cputopo_arm cpu_topology[NR_CPUS];
>>>>
>>>> +int arch_sd_share_power_line(void)
>>>> +{
>>>> +       return 0*SD_SHARE_POWERLINE;
>>>> +}
>>>
>>>
>>>
>>> Making this selection of policy based on sched domain will better. Just
>>> gives the flexibility to choose a separate scheme for big and little
>>> systems which will be very convenient.
>>
>>
>> I agree that it would be more flexible to be able to set it for each level
>>
> Will you be addressing that in next version then ?

Hi Santosh,

yes, I will try to address this point for the next version.

Vincent

>
> Regards
> santosh
>

^ permalink raw reply

* [PATCH 1/3] gpio: Add simple poweroff-gpio driver
From: Andrew Lunn @ 2012-11-12  8:25 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <50A020C5.4070506@wwwdotorg.org>

On Sun, Nov 11, 2012 at 03:03:49PM -0700, Stephen Warren wrote:
> On 11/11/2012 09:21 AM, Andrew Lunn wrote:
> > From: Jamie Lentin <jm@lentin.co.uk>
> > 
> > Given appropriate devicetree bindings, this driver registers a
> > pm_power_off function to set a GPIO line high/low to power down
> > your board.
> 
> This feature will be useful for the Tegra TrimSlice board too.

Hi Stephen

Great to hear its usable for others.

> > diff --git a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
> 
> > +Required properties:
> > +- compatible : should be "gpio-poweroff".
> > +- gpios : The GPIO to set high/low, see "gpios property" in
> > +  Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be
> > +  low to power down the board set it to "Active Low", otherwise set
> > +  gpio to "Active High".
> 
> Unfortunately, not all GPIO bindings support active high/low flags in
> the GPIO specifier. As such, the flags there are basically useless.
> Other bindings (e.g. IIRC the fixed-regulator binding) have added a
> separate active-high property to indicate the GPIO polarity. This
> binding should probably follow suite.

Humm, so are you saying of_get_named_gpio_flags() is deprecated?

There is a lot of code using this to get the flag
OF_GPIO_ACTIVE_LOW. Some of these users are very generic code:

drivers/leds/leds-gpio.c:
drivers/input/misc/rotary_encoder.c:
drivers/input/keyboard/gpio_keys.c:
drivers/input/keyboard/gpio_keys_polled.c:
drivers/hwmon/gpio-fan.c:

The only code using the "enable-active-high"
property is drivers/regulator/fixed.c although the binding
documentation twl6040.txt talks about it, but the code does not
implement it.

Could you point me towards some email discussion about this?

Thanks
	Andrew

^ permalink raw reply

* [PATCH 1/1] ARM: dts: imx6q-sabresd: add volume up/down gpio keys
From: Liu Ying @ 2012-11-12  8:26 UTC (permalink / raw)
  To: linux-arm-kernel

Add volume up/down gpio keys support in imx6q-sabresd.dts.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
---
 arch/arm/boot/dts/imx6q-sabresd.dts |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts b/arch/arm/boot/dts/imx6q-sabresd.dts
index e596c28..a424025 100644
--- a/arch/arm/boot/dts/imx6q-sabresd.dts
+++ b/arch/arm/boot/dts/imx6q-sabresd.dts
@@ -38,6 +38,8 @@
 				hog {
 					pinctrl_hog: hoggrp {
 						fsl,pins = <
+							1004 0x80000000 /* MX6Q_PAD_GPIO_4__GPIO_1_4 */
+							1012 0x80000000 /* MX6Q_PAD_GPIO_5__GPIO_1_5 */
 							1402 0x80000000	/* MX6Q_PAD_NANDF_D0__GPIO_2_0 */
 							1410 0x80000000	/* MX6Q_PAD_NANDF_D1__GPIO_2_1 */
 							1418 0x80000000	/* MX6Q_PAD_NANDF_D2__GPIO_2_2 */
@@ -73,4 +75,20 @@
 			};
 		};
 	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		volume-up {
+			label = "Volume Up";
+			gpios = <&gpio1 4 0>;
+			linux,code = <115>; /* KEY_VOLUMEUP */
+		};
+
+		volume-down {
+			label = "Volume Down";
+			gpios = <&gpio1 5 0>;
+			linux,code = <114>; /* KEY_VOLUMEDOWN */
+		};
+	};
 };
-- 
1.7.1

^ permalink raw reply related

* [PATCH v9 RESEND 0/3] watchdog: at91sam9_wdt: add device tree support
From: Fabio Porcedda @ 2012-11-12  8:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

This patchset is for adding device tree support to the
at91sam9_wdt driver.

The "timeout-sec" binding is added by another patchset already sent:
[PATCH v4 0/8] watchdog: dt: add support for the timeout-sec dt property

Changes:
v9:
 - rebased over v3.7-rc1
v8:
 - add __initconst to at91_wdt_dt_ids
v7:
 - split the patchset
 - remove timeout binding
v6:
 - add watchdog core proprty timeout binding
 - add as example to the orion_wdt driver the new timeout binding
v5:
 - split dts commit in two, one for socs and one for boards.
v4:
 - use "atmel,at91sam9260-wdt" as compatible
v3:
 - add heartbeat option
 - default disabled for all the soc, enable only for evk-pro3 board
 - add at91sam9263 and at91sam9g45 soc
v2:
 - add missing to and cc addresses

Based on v3.7-rc5

Fabio Porcedda (3):
  watchdog: at91sam9_wdt: add device tree support
  ARM: at91/dts: add at91sam9_wdt driver to at91sam926x, at91sam9g45
  ARM: at91/dts: evk-pro3: enable watchdog

 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | 15 +++++++++++++++
 arch/arm/boot/dts/at91sam9260.dtsi                       |  6 ++++++
 arch/arm/boot/dts/at91sam9263.dtsi                       |  6 ++++++
 arch/arm/boot/dts/at91sam9g45.dtsi                       |  6 ++++++
 arch/arm/boot/dts/evk-pro3.dts                           |  4 ++++
 drivers/watchdog/at91sam9_wdt.c                          | 11 +++++++++++
 6 files changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt

-- 
1.8.0

^ permalink raw reply

* [PATCH v9 RESEND 1/3] watchdog: at91sam9_wdt: add device tree support
From: Fabio Porcedda @ 2012-11-12  8:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352709447-8306-1-git-send-email-fabio.porcedda@gmail.com>

Tested on an at91sam9260 board (evk-pro3)

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | 15 +++++++++++++++
 drivers/watchdog/at91sam9_wdt.c                          | 11 +++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt

diff --git a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
new file mode 100644
index 0000000..2957ebb
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
@@ -0,0 +1,15 @@
+* Atmel Watchdog Timers
+
+** at91sam9-wdt
+
+Required properties:
+- compatible: must be "atmel,at91sam9260-wdt".
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+Example:
+
+	watchdog at fffffd40 {
+		compatible = "atmel,at91sam9260-wdt";
+		reg = <0xfffffd40 0x10>;
+	};
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 05e1be8..dc42e44 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -32,6 +32,7 @@
 #include <linux/timer.h>
 #include <linux/bitops.h>
 #include <linux/uaccess.h>
+#include <linux/of.h>
 
 #include "at91sam9_wdt.h"
 
@@ -302,11 +303,21 @@ static int __exit at91wdt_remove(struct platform_device *pdev)
 	return res;
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id at91_wdt_dt_ids[] __initconst = {
+	{ .compatible = "atmel,at91sam9260-wdt" },
+	{ /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
+#endif
+
 static struct platform_driver at91wdt_driver = {
 	.remove		= __exit_p(at91wdt_remove),
 	.driver		= {
 		.name	= "at91_wdt",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(at91_wdt_dt_ids),
 	},
 };
 
-- 
1.8.0

^ permalink raw reply related

* [PATCH v9 RESEND 2/3] ARM: at91/dts: add at91sam9_wdt driver to at91sam926x, at91sam9g45
From: Fabio Porcedda @ 2012-11-12  8:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352709447-8306-1-git-send-email-fabio.porcedda@gmail.com>

Tested on an at91sam9260 board (evk-pro3).

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 arch/arm/boot/dts/at91sam9260.dtsi | 6 ++++++
 arch/arm/boot/dts/at91sam9263.dtsi | 6 ++++++
 arch/arm/boot/dts/at91sam9g45.dtsi | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index d410581..bfb5bb6 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -246,6 +246,12 @@
 					trigger-external;
 				};
 			};
+
+			watchdog at fffffd40 {
+				compatible = "atmel,at91sam9260-wdt";
+				reg = <0xfffffd40 0x10>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 3e6e5c1..ff54612 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -195,6 +195,12 @@
 				#size-cells = <0>;
 				status = "disabled";
 			};
+
+			watchdog at fffffd40 {
+				compatible = "atmel,at91sam9260-wdt";
+				reg = <0xfffffd40 0x10>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 3add030..a98c00a 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -262,6 +262,12 @@
 					trigger-value = <0x6>;
 				};
 			};
+
+			watchdog at fffffd40 {
+				compatible = "atmel,at91sam9260-wdt";
+				reg = <0xfffffd40 0x10>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
-- 
1.8.0

^ permalink raw reply related

* [PATCH v9 RESEND 3/3] ARM: at91/dts: evk-pro3: enable watchdog
From: Fabio Porcedda @ 2012-11-12  8:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352709447-8306-1-git-send-email-fabio.porcedda@gmail.com>

Tested on evk-pro3.

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 arch/arm/boot/dts/evk-pro3.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/evk-pro3.dts b/arch/arm/boot/dts/evk-pro3.dts
index b7354e6..ce959ee 100644
--- a/arch/arm/boot/dts/evk-pro3.dts
+++ b/arch/arm/boot/dts/evk-pro3.dts
@@ -26,6 +26,10 @@
 				atmel,vbus-gpio = <&pioC 5 0>;
 				status = "okay";
 			};
+
+			watchdog at fffffd40 {
+				status = "okay";
+			};
 		};
 
 		usb0: ohci at 00500000 {
-- 
1.8.0

^ permalink raw reply related

* [PATCH resend] rtc: i.MX dryice: Add devicetree support
From: Sascha Hauer @ 2012-11-12  8:42 UTC (permalink / raw)
  To: linux-arm-kernel

Add devicetree probing, fixing some whitespace damage along the way.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Just a resend with Andrew Morton on Cc since I got no reaction from the RTC
Maintainer.

 Documentation/devicetree/bindings/rtc/imx-di.txt |   19 +++++++++++++++++++
 drivers/rtc/rtc-imxdi.c                          |   12 +++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/imx-di.txt

diff --git a/Documentation/devicetree/bindings/rtc/imx-di.txt b/Documentation/devicetree/bindings/rtc/imx-di.txt
new file mode 100644
index 0000000..42b92b5
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/imx-di.txt
@@ -0,0 +1,19 @@
+* i.MX25 dryice Real Time Clock controller
+
+This RTC is part of the i.MX25 dryice module. Documentation for this
+unit is not publically available. This binding only makes use of the
+RTC.
+
+Required properties:
+- compatible: should be "fsl,imx25-rtc"
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- interrupts: interrupt source for the dryice module
+
+Example:
+
+	dryice at 53ffc000 {
+		compatible = "fsl,imx25-dryice", "fsl,imx25-rtc";
+		reg = <0x53ffc000 0x4000>;
+		interrupts = <25>;
+	};
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
index 891cd6c..b2fe920 100644
--- a/drivers/rtc/rtc-imxdi.c
+++ b/drivers/rtc/rtc-imxdi.c
@@ -493,11 +493,17 @@ static int __devexit dryice_rtc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id of_dryice_rtc_match[] = {
+	{ .compatible = "fsl,imx25-rtc", },
+	{ },
+};
+
 static struct platform_driver dryice_rtc_driver = {
 	.driver = {
-		   .name = "imxdi_rtc",
-		   .owner = THIS_MODULE,
-		   },
+		.name = "imxdi_rtc",
+		.owner = THIS_MODULE,
+		.of_match_table = of_dryice_rtc_match,
+	},
 	.remove = __devexit_p(dryice_rtc_remove),
 };
 
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 00/17] atmel SoC SPI controller with dmaengine and DT
From: Wenyou Yang @ 2012-11-12  8:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This set of patches is to add dmaengine and DT support for atmel spi.
The work is based on Jean-Christophe, Nicolas and Richard's work.
I have tested it on at91sam9x5ek, at91sam9m10g45ek.

It is based on v3.7-rc5.

Best Regards,
Wenyou Yang.

Jean-Christophe PLAGNIOL-VILLARD (3):
  of: add dma-mask binding
  of_spi: add generic binding support to specify cs gpio
  spi/atmel_spi: add DT support

Nicolas Ferre (5):
  spi/atmel_spi: add physical base address
  spi/atmel_spi: call unmapping on transfers buffers
  spi/atmel_spi: status information passed through controller data
  spi/atmel_spi: add flag to controller data for lock operations
  spi/atmel_spi: add dmaengine support

Richard Genoud (6):
  spi/atmel_spi: Fix spi-atmel driver to adapt to slave_config changes
  spi/atmel_spi: correct 16 bits transfers using PIO
  spi/atmel_spi: correct 16 bits transfer with DMA
  ARM: at91: add clocks for spi DT entries
  ARM: dts: add spi nodes for atmel SoC
  ARM: dts: add spi nodes for atmel boards

Wenyou Yang (3):
  spi/atmel_spi: add version propety as the spi data
  spi/atmel_spi: add function to read the spi data from the dts
  mtd: m25p80: change the m25p80_read to reading page to page

 Documentation/devicetree/bindings/spi/spi-bus.txt  |    6 +
 .../devicetree/bindings/spi/spi_atmel.txt          |   27 +
 arch/arm/boot/dts/at91sam9260.dtsi                 |   34 +
 arch/arm/boot/dts/at91sam9263.dtsi                 |   34 +
 arch/arm/boot/dts/at91sam9263ek.dts                |    9 +
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |    9 +
 arch/arm/boot/dts/at91sam9g25ek.dts                |    9 +
 arch/arm/boot/dts/at91sam9g45.dtsi                 |   34 +
 arch/arm/boot/dts/at91sam9m10g45ek.dts             |    9 +
 arch/arm/boot/dts/at91sam9n12.dtsi                 |   34 +
 arch/arm/boot/dts/at91sam9n12ek.dts                |    9 +
 arch/arm/boot/dts/at91sam9x5.dtsi                  |   34 +
 arch/arm/mach-at91/at91sam9260.c                   |    2 +
 arch/arm/mach-at91/at91sam9g45.c                   |    2 +
 arch/arm/mach-at91/at91sam9n12.c                   |    2 +
 arch/arm/mach-at91/at91sam9x5.c                    |    2 +
 drivers/mtd/devices/m25p80.c                       |   44 +-
 drivers/of/platform.c                              |   23 +-
 drivers/spi/spi-atmel.c                            |  728 ++++++++++++++++++--
 drivers/spi/spi.c                                  |   55 +-
 include/linux/spi/spi.h                            |    3 +
 21 files changed, 1045 insertions(+), 64 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt

-- 
1.7.9.5

^ permalink raw reply

* [PATCH 01/17] of: add dma-mask binding
From: Wenyou Yang @ 2012-11-12  8:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352710357-3265-1-git-send-email-wenyou.yang@atmel.com>

From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

This will allow each device to specify its dma-mask for this we use the
coherent_dma_mask as pointer. By default the dma-mask will be set to
DMA_BIT_MASK(32).
The microblaze architecture hook is drop

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: grant.likely at secretlab.ca
Cc: rob.herring at calxeda.com
Cc: devicetree-discuss at lists.ozlabs.org
---
 drivers/of/platform.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index b80891b..31ed405 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -130,6 +130,21 @@ void of_device_make_bus_id(struct device *dev)
 	dev_set_name(dev, "%s.%d", node->name, magic - 1);
 }
 
+static void of_get_dma_mask(struct device *dev, struct device_node *np)
+{
+	const __be32 *prop;
+	int len;
+
+	prop = of_get_property(np, "dma-mask", &len);
+
+	dev->dma_mask = &dev->coherent_dma_mask;
+
+	if (!prop)
+		dev->coherent_dma_mask = DMA_BIT_MASK(32);
+	else
+		dev->coherent_dma_mask = of_read_number(prop, len / 4);
+}
+
 /**
  * of_device_alloc - Allocate and initialize an of_device
  * @np: device node to assign to device
@@ -171,10 +186,8 @@ struct platform_device *of_device_alloc(struct device_node *np,
 		WARN_ON(of_irq_to_resource_table(np, res, num_irq) != num_irq);
 	}
 
+	of_get_dma_mask(&dev->dev, np);
 	dev->dev.of_node = of_node_get(np);
-#if defined(CONFIG_MICROBLAZE)
-	dev->dev.dma_mask = &dev->archdata.dma_mask;
-#endif
 	dev->dev.parent = parent;
 
 	if (bus_id)
@@ -211,10 +224,6 @@ struct platform_device *of_platform_device_create_pdata(
 	if (!dev)
 		return NULL;
 
-#if defined(CONFIG_MICROBLAZE)
-	dev->archdata.dma_mask = 0xffffffffUL;
-#endif
-	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	dev->dev.bus = &platform_bus_type;
 	dev->dev.platform_data = platform_data;
 
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 02/17] of_spi: add generic binding support to specify cs gpio
From: Wenyou Yang @ 2012-11-12  8:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352710357-3265-1-git-send-email-wenyou.yang@atmel.com>

From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

This will allow to use gpio for chip select with no modification in the
driver binding

When use the cs-gpios, the gpio number will be passed via the cs_gpio field
and the number of chip select will automatically increased.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: devicetree-discuss at lists.ozlabs.org
Cc: spi-devel-general at lists.sourceforge.net
Cc: grant.likely at secretlab.ca
Cc: rob.herring at calxeda.com
Cc: rob at landley.net
Cc: richard.genoud at gmail.com
---
Hi, Richard,

This patch based on the original patch from Jean-Christophe, 
 	[PATCH] of_spi: add generic binding support to specify cs gpio
and merged the patch from Richard Genoud,
	[PATCH] [BUG] SPI: array out of bound => no CS

Could you sign your signature in this patch?

Best Regards,
Wenyou Yang

 Documentation/devicetree/bindings/spi/spi-bus.txt |    6 +++
 drivers/spi/spi.c                                 |   55 +++++++++++++++++++--
 include/linux/spi/spi.h                           |    3 ++
 3 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
index d2c33d0..7f59ae30 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
 - #size-cells     - should be zero.
 - compatible      - name of SPI bus controller following generic names
     		recommended practice.
+- cs-gpios	  - (optional) gpios chip select.
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -21,6 +22,8 @@ assumption that board specific platform code will be used to manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
+If cs-gpios is used the number of chip select will automatically increased.
+
 Optional property:
 - num-cs : total number of chipselects
 
@@ -37,6 +40,9 @@ contain the following properties.
 - spi-cs-high     - (optional) Empty property indicating device requires
     		chip select active high
 
+If a gpio chipselect is used for the SPI slave the gpio number will be passed
+via the controller_data
+
 SPI example for an MPC5200 SPI bus:
 	spi at f00 {
 		#address-cells = <1>;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 84c2861..74e6577 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -30,6 +30,7 @@
 #include <linux/slab.h>
 #include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
+#include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
 #include <linux/export.h>
 #include <linux/sched.h>
@@ -327,6 +328,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master)
 	spi->dev.parent = &master->dev;
 	spi->dev.bus = &spi_bus_type;
 	spi->dev.release = spidev_release;
+	spi->cs_gpio = -EINVAL;
 	device_initialize(&spi->dev);
 	return spi;
 }
@@ -344,15 +346,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
 int spi_add_device(struct spi_device *spi)
 {
 	static DEFINE_MUTEX(spi_add_lock);
-	struct device *dev = spi->master->dev.parent;
+	struct spi_master *master = spi->master;
+	struct device *dev = master->dev.parent;
 	struct device *d;
 	int status;
 
 	/* Chipselects are numbered 0..max; validate. */
-	if (spi->chip_select >= spi->master->num_chipselect) {
+	if (spi->chip_select >= master->num_chipselect) {
 		dev_err(dev, "cs%d >= max %d\n",
 			spi->chip_select,
-			spi->master->num_chipselect);
+			master->num_chipselect);
 		return -EINVAL;
 	}
 
@@ -376,6 +379,9 @@ int spi_add_device(struct spi_device *spi)
 		goto done;
 	}
 
+	if (master->cs_gpios)
+		spi->cs_gpio = master->cs_gpios[spi->chip_select];
+
 	/* Drivers may modify this initial i/o setup, but will
 	 * normally rely on the device being setup.  Devices
 	 * using SPI_CS_HIGH can't coexist well otherwise...
@@ -946,6 +952,45 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
 }
 EXPORT_SYMBOL_GPL(spi_alloc_master);
 
+#ifdef CONFIG_OF
+static int of_spi_register_master(struct spi_master *master)
+{
+	int nb, i;
+	int *cs;
+	struct device_node *np = master->dev.of_node;
+
+	if (!np)
+		return 0;
+
+	nb = of_gpio_named_count(np, "cs-gpios");
+
+	if (nb < 1)
+		return 0;
+
+	cs = devm_kzalloc(&master->dev,
+			  sizeof(int) * (master->num_chipselect + nb),
+			  GFP_KERNEL);
+	master->cs_gpios = cs;
+
+	if (!master->cs_gpios)
+		return -ENOMEM;
+
+	memset(cs, -EINVAL, master->num_chipselect);
+	cs += master->num_chipselect;
+	master->num_chipselect += nb;
+
+	for (i = 0; i < nb; i++)
+		cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+
+	return 0;
+}
+#else
+static int of_spi_register_master(struct spi_master *master)
+{
+	return 0;
+}
+#endif
+
 /**
  * spi_register_master - register SPI master controller
  * @master: initialized master, originally from spi_alloc_master()
@@ -977,6 +1022,10 @@ int spi_register_master(struct spi_master *master)
 	if (!dev)
 		return -ENODEV;
 
+	status = of_spi_register_master(master);
+	if (status)
+		return status;
+
 	/* even if it's just one always-selected device, there must
 	 * be@least one chipselect
 	 */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index fa702ae..f629189 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -90,6 +90,7 @@ struct spi_device {
 	void			*controller_state;
 	void			*controller_data;
 	char			modalias[SPI_NAME_SIZE];
+	int			cs_gpio;	/* chip select gpio */
 
 	/*
 	 * likely need more hooks for more protocol options affecting how
@@ -362,6 +363,8 @@ struct spi_master {
 	int (*transfer_one_message)(struct spi_master *master,
 				    struct spi_message *mesg);
 	int (*unprepare_transfer_hardware)(struct spi_master *master);
+	/* gpio chip select */
+	int			*cs_gpios;
 };
 
 static inline void *spi_master_get_devdata(struct spi_master *master)
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 03/17] spi/atmel_spi: add physical base address
From: Wenyou Yang @ 2012-11-12  8:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352710357-3265-1-git-send-email-wenyou.yang@atmel.com>

From: Nicolas Ferre <nicolas.ferre@atmel.com>

Needed for future use with dmaengine enabled driver.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: grant.likely at secretlab.ca
Cc: spi-devel-general at lists.sourceforge.net
---
 drivers/spi/spi-atmel.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 16d6a83..2e040be 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -188,6 +188,7 @@
 struct atmel_spi {
 	spinlock_t		lock;
 
+	resource_size_t		phybase;
 	void __iomem		*regs;
 	int			irq;
 	struct clk		*clk;
@@ -961,6 +962,7 @@ static int __devinit atmel_spi_probe(struct platform_device *pdev)
 	as->regs = ioremap(regs->start, resource_size(regs));
 	if (!as->regs)
 		goto out_free_buffer;
+	as->phybase = regs->start;
 	as->irq = irq;
 	as->clk = clk;
 
-- 
1.7.9.5

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox