Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 13/15] ARM: DTS: AM33XX: Add nodes for OCMCRAM and Mailbox
From: Bedia, Vaibhav @ 2012-11-06  5:08 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <50983366.2020007@ti.com>

On Tue, Nov 06, 2012 at 03:15:10, Shilimkar, Santosh wrote:
> On Tuesday 06 November 2012 02:49 AM, Santosh Shilimkar wrote:
> > On Tuesday 06 November 2012 12:59 AM, Kevin Hilman wrote:
> >> "Bedia, Vaibhav" <vaibhav.bedia@ti.com> writes:
> >>
> >>> On Mon, Nov 05, 2012 at 20:23:11, Shilimkar, Santosh wrote:
> >>> [...]
> >>>>>
> >>>> On OMAP the OCMC RAM is always clocked and doesn't need any special
> >>>> clock enable. CM_L3_2_OCMC_RAM_CLKCTRL module mode field is read only.
> >>>> Isn't it same on AMXX ?
> >>>>
> >>>
> >>> On AM33xx, OCMC RAM is in PER domain and the corresponding CLKCLTR
> >>> module
> >>> mode fields are r/w. OCMC RAM needs to be disabled as part of the
> >>> DeepSleep0
> >>> entry to let PER domain transition.
> >>
> >> After DeepSleep0, the ROM code is being given an address in OCMC RAM to
> >> jump to.  If OCMC RAM is disabled as part of suspend, this means that
> >> OCMC RAM contents are maintained even though PER domain transitions?
> >>
> >> If so, that needs to be more clearly documented.
> >>
> > Thats very good point. How does OCMC RAM retains the contents without
> > clock ?
> >
> Ignore the question. I figured out from other patch changelog the OCMC
> RAM supports retention. Please have that clearly captured in
> change log.
> 

Yes, OCMC RAM support retention. Will document that here also.

Regards,
Vaibhav

^ permalink raw reply

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
From: AnilKumar, Chimata @ 2012-11-06  5:13 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <5097F078.50701@ti.com>

On Mon, Nov 05, 2012 at 22:29:36, Cousson, Benoit wrote:
> + Mark
> 
> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > 
> > Set tps65217 PMIC status to OFF if power enable toggle is
> > supported. Also adds platform data flag, which should be
> > passed from board init data.
> > 
> > Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > [anilkumar at ti.com: move the additions to tps65217 MFD driver]
> > Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> > ---
> >  .../devicetree/bindings/regulator/tps65217.txt     |    4 ++++
> >  drivers/mfd/tps65217.c                             |   12 ++++++++++++
> >  2 files changed, 16 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
> > index d316fb8..4f05d20 100644
> > --- a/Documentation/devicetree/bindings/regulator/tps65217.txt
> > +++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
> > @@ -11,6 +11,9 @@ Required properties:
> >    using the standard binding for regulators found at
> >    Documentation/devicetree/bindings/regulator/regulator.txt.
> >  
> > +Optional properties:
> > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
> 
> That sounds like a generic functionality to me. Don't we have some more
> generic way to handle that?

But STATUS_OFF should be set only if Board supports it, otherwise
this change doesn't make sense.

> 
> If not, that should probably not be a TI only attribute.
> 
> It looks like a GPIO like kind of interface at PMIC level.

I agree this should be a generic parameter, but in some regulators this STATUS OFF
control might not be available. This is in my mind while name this parameter.

Thanks
AnilKumar

^ permalink raw reply

* [PATCH 1/6] ARM/dts: omap4-panda: Add pinmux configuration for HDMI
From: Ricardo Neri @ 2012-11-06  5:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <5097BC67.5050508@ti.com>

Hi Tomi,

On 11/05/2012 07:17 AM, Tomi Valkeinen wrote:
> Hi Ricardo,
>
> On 2012-11-05 15:14, Tomi Valkeinen wrote:
>> From: Ricardo Neri <ricardo.neri@ti.com>
>>
>> Add the pinmux configuration for HDMI and TPD12S015A. Configure the
>> gpios for the TPD12S015A and SDA, SCL and CEC for HDMI.
>>
>> Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>   arch/arm/boot/dts/omap4-panda-a4.dts |   17 +++++++++++++++++
>>   arch/arm/boot/dts/omap4-panda.dts    |   18 ++++++++++++++++++
>>   arch/arm/boot/dts/omap4-pandaES.dts  |    9 +++++++++
>>   3 files changed, 44 insertions(+)
>>   create mode 100644 arch/arm/boot/dts/omap4-panda-a4.dts
>
> Ricardo, I modified this and the other dts patch to add new .dts files
> for the board revisions with external pull on the SCL/SDA lines. Can you
> verify that these are correct?

I verified the pinmux values to make sure that the OMAP internal pull is 
not enabled in Pandaboard A4/4430 ES2.3+. It looks correct to me.

I also tested it on 4430 ES2.1 and 4430 ES2.3 SDPs and works fine.

BR,

Ricardo

Tested-by: Ricardo Neri <ricardo.neri@ti.com>
Reviewed-by: Ricardo Neri <ricardo.neri@ti.com>

>
>   Tomi
>
>> diff --git a/arch/arm/boot/dts/omap4-panda-a4.dts b/arch/arm/boot/dts/omap4-panda-a4.dts
>> new file mode 100644
>> index 0000000..75466d2
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/omap4-panda-a4.dts
>> @@ -0,0 +1,17 @@
>> +/*
>> + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
>> + *
>> + * 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.
>> + */
>> +/include/ "omap4-panda.dts"
>> +
>> +/* Pandaboard Rev A4+ have external pullups on SCL & SDA */
>> +&dss_hdmi_pins {
>> +	pinctrl-single,pins = <
>> +		0x5a 0x118	/* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
>> +		0x5c 0x100	/* hdmi_scl.hdmi_scl INPUT | MODE 0 */
>> +		0x5e 0x100	/* hdmi_sda.hdmi_sda INPUT | MODE 0 */
>> +		>;
>> +};
>> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
>> index e8f927c..8060f5b 100644
>> --- a/arch/arm/boot/dts/omap4-panda.dts
>> +++ b/arch/arm/boot/dts/omap4-panda.dts
>> @@ -65,6 +65,8 @@
>>   			&twl6040_pins
>>   			&mcpdm_pins
>>   			&mcbsp1_pins
>> +			&dss_hdmi_pins
>> +			&tpd12s015_pins
>>   	>;
>>
>>   	twl6040_pins: pinmux_twl6040_pins {
>> @@ -92,6 +94,22 @@
>>   			0xc4 0x100	/* abe_mcbsp1_fsx.abe_mcbsp1_fsx INPUT | MODE0 */
>>   		>;
>>   	};
>> +
>> +	dss_hdmi_pins: pinmux_dss_hdmi_pins {
>> +		pinctrl-single,pins = <
>> +			0x5a 0x118	/* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
>> +			0x5c 0x118	/* hdmi_scl.hdmi_scl INPUT PULLUP | MODE 0 */
>> +			0x5e 0x118	/* hdmi_sda.hdmi_sda INPUT PULLUP | MODE 0 */
>> +		>;
>> +	};
>> +
>> +	tpd12s015_pins: pinmux_tpd12s015_pins {
>> +		pinctrl-single,pins = <
>> +			0x22 0x3	/* gpmc_a17.gpio_41 OUTPUT | MODE3 */
>> +			0x48 0x3	/* gpmc_nbe1.gpio_60 OUTPUT | MODE3 */
>> +			0x58 0x10b	/* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */
>> +		>;
>> +	};
>>   };
>>
>>   &i2c1 {
>> diff --git a/arch/arm/boot/dts/omap4-pandaES.dts b/arch/arm/boot/dts/omap4-pandaES.dts
>> index d4ba43a..73bc1a6 100644
>> --- a/arch/arm/boot/dts/omap4-pandaES.dts
>> +++ b/arch/arm/boot/dts/omap4-pandaES.dts
>> @@ -22,3 +22,12 @@
>>   		"AFML", "Line In",
>>   		"AFMR", "Line In";
>>   };
>> +
>> +/* PandaboardES has external pullups on SCL & SDA */
>> +&dss_hdmi_pins {
>> +	pinctrl-single,pins = <
>> +		0x5a 0x118	/* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
>> +		0x5c 0x100	/* hdmi_scl.hdmi_scl INPUT | MODE 0 */
>> +		0x5e 0x100	/* hdmi_sda.hdmi_sda INPUT | MODE 0 */
>> +		>;
>> +};
>>
>
>

^ permalink raw reply

* [Patch v2 3/4] ASoC: atmel-ssc-dai: register platform from DAIs
From: Bo Shen @ 2012-11-06  5:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <50974DE6.50506@atmel.com>

Hi Mark Brown,

On 11/5/2012 13:25, Bo Shen wrote:
> Hi Mark Brown,
>
> On 11/2/2012 22:24, Mark Brown wrote:
>> On Fri, Nov 02, 2012 at 10:34:21AM +0800, Bo Shen wrote:
>>> On 11/1/2012 22:43, Mark Brown wrote:
>>>> On Wed, Oct 31, 2012 at 03:26:59PM +0800, Bo Shen wrote:
>>
>>>>> +dai: dai {
>>>>> +    compatible = "atmel,atmel-ssc-dai";
>>>>> +    atmel,dai-master = <&ssc0>;
>>>>> +};
>>
>>>> This seems to be a purely virtual device which remaps the SSC onto the
>>>> Linux audio subsystem?  If that is the case then it shouldn't appear in
>>>> the device tree,
>>
>>> Yes. This is a purely virtual device. I add this as to the following
>>> reason.
>>
>>> In our case, the ssc can connect to audio codec, DAC and other
>>> devices. In order to avoid duplicate the code, so keep ssc as a
>>> library, register it directly in Linux and use remap method to let
>>> it work onto other different subsystem.
>>
>> Your quote appears to have deleted the bit of my mail where I told you
>> how to fix this.  Is there something unclear in my suggestion that the
>> machine driver directly reference the SSC node?
>>
>
> Sorry for misunderstand. I split your e-mail into two parts. May be you
> miss some parts of my e-mail. You can check the last mail from me. Or
> check the following fully quote.

Anyway, I will sent out a RFC patch series (which will be v3) which 
register dai and platform directly in Linux.

BRs,
Bo Shen

> --------------------------------------------------------------------------
> On 11/1/2012 22:43, Mark Brown wrote:
>  > On Wed, Oct 31, 2012 at 03:26:59PM +0800, Bo Shen wrote:
>  >
>  >> +Required properties:
>  >> +  - compatible: "atmel,atmel-ssc-dai"
>  >> +  - atmel,dai-master: this dai base on which ssc controller
>  >
>  >> +Example:
>  >> +dai: dai {
>  >> +    compatible = "atmel,atmel-ssc-dai";
>  >> +    atmel,dai-master = <&ssc0>;
>  >> +};
>  >
>  > This seems to be a purely virtual device which remaps the SSC onto the
>  > Linux audio subsystem?  If that is the case then it shouldn't appear in
>  > the device tree,
>
> Yes. This is a purely virtual device. I add this as to the following
> reason.
>
> In our case, the ssc can connect to audio codec, DAC and other devices.
> In order to avoid duplicate the code, so keep ssc as a library, register
> it directly in Linux and use remap method to let it work onto other
> different subsystem.
>
> So, for ssc connect to audio codec, use dai to remap the SSC onto the
> Linux audio subsystem. In this way, just let the dai know which ssc
> channel it based on. The remap is just a simple way. Please take
> following code as a reference.
>
> ---<8---
>          if (pdev->dev.of_node) {
>                  struct device_node *np = pdev->dev.of_node;
>                  struct device_node *dai_master_np;
>
>                  dai_master_np = of_parse_phandle(np,
> "atmel,dai-master", 0);
>                  if (!dai_master_np) {
>                          dev_err(&pdev->dev, "No SSC for atmel dai");
>                          return -EINVAL;
>                  }
>
>                  id = of_alias_get_id(dai_master_np, "ssc");
>          } else {
>                  id = to_platform_device(pdev->dev.parent)->id;
>          }
>
>          ssc = ssc_request(id);
>          if (IS_ERR(ssc)) {
>                  dev_err(&pdev->dev, "Failed to request SSC %d\n", id);
>                  return PTR_ERR(ssc);
>          }
>          ssc_info.ssc = ssc;
>          pdev->dev.parent = &(ssc->pdev->dev);
> --->8---
>
> If ssc connect to other devices, also need to remap to other subsystem.
>
>  > the machine driver should just directly reference the
>  > SSC and instantiate any devices required in Linux directly.
>
> I am not fully understand this. So, which do you mean as the following
> two method or any other else?
>
> Our old method:
>    using audio machine driver (e.g: sam9g20_wm8731.c) call
> atmel_ssc_set_audio function to allocate the platform device for
> atmel-ssc-dai and atmel-pcm-audio and then add device.
>
> Code as following:
> ---<8---
> /* 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",
>                          PTR_ERR(ssc));
>          else {
>                  ssc_pdev->dev.parent = &(ssc->pdev->dev);
>                  ssc_free(ssc);
>          }
>
>          ret = platform_device_add(ssc_pdev);
> --->8---
>
> Other SoC do like this:
>    register i2s device, and then register dai, finally register
> platform. So, only one device.
> --------------------------------------------------------------------------
>
> Best regards,
> Bo Shen

^ permalink raw reply

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
From: Bedia, Vaibhav @ 2012-11-06  5:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352108549-9341-3-git-send-email-anilkumar@ti.com>

On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
[...]
>  
> +#define SHUTDOWN_TIME_SEC		2
> +#define SECS_IN_MIN			60
> +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> +
>  static void __iomem	*rtc_base;
>  
[...]
> +
> +	/* Wait few seconds instead of rollover */
> +	do {
> +		omap_rtc_read_time(NULL, &tm);
> +		if (WAIT_AFTER <= tm.tm_sec)
> +			mdelay(WAIT_TIME_MS);
> +	} while (WAIT_AFTER <= tm.tm_sec);

This hardcoded wait for rollover doesn't look good. I see some
helper functions in rtc-lib.c which probably could be used for
converting the current time to elapsed seconds, add the delay and
then convert it back to the time to be programmed in RTC without
worrying about rollover. Why not use that?

> +
> +	/* Add shutdown time to the current value */
> +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> +
> +	if (tm2bcd(&tm) < 0)
> +		return;
> +
> +	pr_info("System will go to power_off state in approx. %d secs\n",
> +			SHUTDOWN_TIME_SEC);
> +
> +	/* Set the ALARM2 time */
> +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> +
> +	/* Enable alarm2 interrupt */
> +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +

These registers are not present in older versions of the IP so how
does that get handled?

You also need to describe the connection between the ALARM2 and the
power off logic in detail.

Regards,
Vaibhav

^ permalink raw reply

* [RFC patch v3 1/4] ARM: at91: atmel-ssc: add platform device id table
From: Bo Shen @ 2012-11-06  5:57 UTC (permalink / raw)
  To: linux-arm-kernel

Add platform device id to check whether the SSC controller support
pdc or dam for data transfer

If match "at91rm9200_ssc", which support pdc for data transfer
If match "at91sam9g45_ssc", which support dma for data transfer

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Change since v2
  No change
Change since v1
  No change
---
 arch/arm/mach-at91/at91rm9200.c          |    6 +++---
 arch/arm/mach-at91/at91rm9200_devices.c  |    6 +++---
 arch/arm/mach-at91/at91sam9260.c         |    2 +-
 arch/arm/mach-at91/at91sam9260_devices.c |    2 +-
 arch/arm/mach-at91/at91sam9261.c         |    6 +++---
 arch/arm/mach-at91/at91sam9261_devices.c |    6 +++---
 arch/arm/mach-at91/at91sam9263.c         |    4 ++--
 arch/arm/mach-at91/at91sam9263_devices.c |    4 ++--
 arch/arm/mach-at91/at91sam9g45.c         |    4 ++--
 arch/arm/mach-at91/at91sam9g45_devices.c |    4 ++--
 arch/arm/mach-at91/at91sam9rl.c          |    4 ++--
 arch/arm/mach-at91/at91sam9rl_devices.c  |    4 ++--
 drivers/misc/atmel-ssc.c                 |   23 +++++++++++++++++++++++
 include/linux/atmel-ssc.h                |    5 +++++
 14 files changed, 54 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index b4f0565..85d53c5 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -184,9 +184,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index a563189..59ceea1 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -752,7 +752,7 @@ static struct resource ssc0_resources[] = {
 };
 
 static struct platform_device at91rm9200_ssc0_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 0,
 	.dev	= {
 		.dma_mask		= &ssc0_dmamask,
@@ -794,7 +794,7 @@ static struct resource ssc1_resources[] = {
 };
 
 static struct platform_device at91rm9200_ssc1_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 1,
 	.dev	= {
 		.dma_mask		= &ssc1_dmamask,
@@ -836,7 +836,7 @@ static struct resource ssc2_resources[] = {
 };
 
 static struct platform_device at91rm9200_ssc2_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 2,
 	.dev	= {
 		.dma_mask		= &ssc2_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index ad29f93..2c8aab0 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -210,7 +210,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260", &twi_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20", &twi_clk),
 	/* more usart lookup table for DT entries */
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 805ef95..9cfdc3f 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -742,7 +742,7 @@ static struct resource ssc_resources[] = {
 };
 
 static struct platform_device at91sam9260_ssc_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 0,
 	.dev	= {
 		.dma_mask		= &ssc_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 8d999eb..4e8c56e 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -174,9 +174,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9261", &twi_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10", &twi_clk),
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 9752f17..299637f 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -706,7 +706,7 @@ static struct resource ssc0_resources[] = {
 };
 
 static struct platform_device at91sam9261_ssc0_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 0,
 	.dev	= {
 		.dma_mask		= &ssc0_dmamask,
@@ -748,7 +748,7 @@ static struct resource ssc1_resources[] = {
 };
 
 static struct platform_device at91sam9261_ssc1_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 1,
 	.dev	= {
 		.dma_mask		= &ssc1_dmamask,
@@ -790,7 +790,7 @@ static struct resource ssc2_resources[] = {
 };
 
 static struct platform_device at91sam9261_ssc2_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 2,
 	.dev	= {
 		.dma_mask		= &ssc2_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 6a01d03..95a5471 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -186,8 +186,8 @@ static struct clk *periph_clocks[] __initdata = {
 static struct clk_lookup periph_clocks_lookups[] = {
 	/* One additional fake clock for macb_hclk */
 	CLKDEV_CON_ID("hclk", &macb_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 8dde220..df89a00 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -1199,7 +1199,7 @@ static struct resource ssc0_resources[] = {
 };
 
 static struct platform_device at91sam9263_ssc0_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 0,
 	.dev	= {
 		.dma_mask		= &ssc0_dmamask,
@@ -1241,7 +1241,7 @@ static struct resource ssc1_resources[] = {
 };
 
 static struct platform_device at91sam9263_ssc1_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 1,
 	.dev	= {
 		.dma_mask		= &ssc1_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 84af1b5..f4f96a6 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -239,8 +239,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi0_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.1", &twi1_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.0", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk),
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index b159607..27e3bf6 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1459,7 +1459,7 @@ static struct resource ssc0_resources[] = {
 };
 
 static struct platform_device at91sam9g45_ssc0_device = {
-	.name	= "ssc",
+	.name	= "at91sam9g45_ssc",
 	.id	= 0,
 	.dev	= {
 		.dma_mask		= &ssc0_dmamask,
@@ -1501,7 +1501,7 @@ static struct resource ssc1_resources[] = {
 };
 
 static struct platform_device at91sam9g45_ssc1_device = {
-	.name	= "ssc",
+	.name	= "at91sam9g45_ssc",
 	.id	= 1,
 	.dev	= {
 		.dma_mask		= &ssc1_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 72e9084..4110b54 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -184,8 +184,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
-	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index d6ca054..01220c7 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -832,7 +832,7 @@ static struct resource ssc0_resources[] = {
 };
 
 static struct platform_device at91sam9rl_ssc0_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 0,
 	.dev	= {
 		.dma_mask		= &ssc0_dmamask,
@@ -874,7 +874,7 @@ static struct resource ssc1_resources[] = {
 };
 
 static struct platform_device at91sam9rl_ssc1_device = {
-	.name	= "ssc",
+	.name	= "at91rm9200_ssc",
 	.id	= 1,
 	.dev	= {
 		.dma_mask		= &ssc1_dmamask,
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index ac00f83..f40abd8 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -68,6 +68,26 @@ void ssc_free(struct ssc_device *ssc)
 }
 EXPORT_SYMBOL(ssc_free);
 
+static struct atmel_ssc_platform_data at91rm9200_config = {
+	.use_dma = 0,
+};
+
+static struct atmel_ssc_platform_data at91sam9g45_config = {
+	.use_dma = 1,
+};
+
+static const struct platform_device_id atmel_ssc_devtypes[] = {
+	{
+		.name = "at91rm9200_ssc",
+		.driver_data = (unsigned long) &at91rm9200_config,
+	}, {
+		.name = "at91sam9g45_ssc",
+		.driver_data = (unsigned long) &at91sam9g45_config,
+	}, {
+		/* sentinel */
+	}
+};
+
 static int ssc_probe(struct platform_device *pdev)
 {
 	struct resource *regs;
@@ -80,6 +100,8 @@ static int ssc_probe(struct platform_device *pdev)
 	}
 
 	ssc->pdev = pdev;
+	ssc->pdata = (struct atmel_ssc_platform_data *)
+			platform_get_device_id(pdev)->driver_data;
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!regs) {
@@ -139,6 +161,7 @@ static struct platform_driver ssc_driver = {
 		.name		= "ssc",
 		.owner		= THIS_MODULE,
 	},
+	.id_table	= atmel_ssc_devtypes,
 	.probe		= ssc_probe,
 	.remove		= __devexit_p(ssc_remove),
 };
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 4eb3175..1ca0e32 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -5,10 +5,15 @@
 #include <linux/list.h>
 #include <linux/io.h>
 
+struct atmel_ssc_platform_data {
+	int			use_dma;
+};
+
 struct ssc_device {
 	struct list_head	list;
 	void __iomem		*regs;
 	struct platform_device	*pdev;
+	struct atmel_ssc_platform_data *pdata;
 	struct clk		*clk;
 	int			user;
 	int			irq;
-- 
1.7.9.5

^ permalink raw reply related

* [RFC patch v3 2/4] ARM: at91: atmel-ssc: add device tree support
From: Bo Shen @ 2012-11-06  5:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352181474-19597-1-git-send-email-voice.shen@atmel.com>

Add atmel-ssc for device tree support

Match "atmel,at91rm9200-ssc" for using pdc for data transfer
Match "atmel,at91sam9g45-ssc" for using pdc for data transfer

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Change since v2
  No change
Change since v1
  change the underscore to dash in atmel-ssc binding document
---
 .../devicetree/bindings/misc/atmel-ssc.txt         |   15 ++++++
 arch/arm/boot/dts/at91sam9260.dtsi                 |    8 ++++
 arch/arm/boot/dts/at91sam9263.dtsi                 |   16 +++++++
 arch/arm/boot/dts/at91sam9g45.dtsi                 |   16 +++++++
 arch/arm/boot/dts/at91sam9x5.dtsi                  |    8 ++++
 arch/arm/mach-at91/at91rm9200.c                    |    3 ++
 arch/arm/mach-at91/at91sam9260.c                   |    1 +
 arch/arm/mach-at91/at91sam9261.c                   |    3 ++
 arch/arm/mach-at91/at91sam9263.c                   |    2 +
 arch/arm/mach-at91/at91sam9g45.c                   |    2 +
 arch/arm/mach-at91/at91sam9rl.c                    |    2 +
 arch/arm/mach-at91/at91sam9x5.c                    |    1 +
 drivers/misc/atmel-ssc.c                           |   49 ++++++++++++++++++--
 13 files changed, 123 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/atmel-ssc.txt

diff --git a/Documentation/devicetree/bindings/misc/atmel-ssc.txt b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
new file mode 100644
index 0000000..38e51ad
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
@@ -0,0 +1,15 @@
+* Atmel SSC driver.
+
+Required properties:
+- compatible: "atmel,at91rm9200-ssc" or "atmel,at91sam9g45-ssc"
+	- atmel,at91rm9200-ssc: support pdc transfer
+	- atmel,at91sam9g45-ssc: support dma transfer
+- reg: Should contain SSC registers location and length
+- interrupts: Should contain SSC interrupt
+
+Example:
+ssc0: ssc at fffbc000 {
+	compatible = "atmel,at91rm9200-ssc";
+	reg = <0xfffbc000 0x4000>;
+	interrupts = <14 4 5>;
+};
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index d410581..aaa42d8 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -29,6 +29,7 @@
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
 		i2c0 = &i2c0;
+		ssc0 = &ssc0;
 	};
 	cpus {
 		cpu at 0 {
@@ -212,6 +213,13 @@
 				status = "disabled";
 			};
 
+			ssc0: ssc at fffbc000 {
+				compatible = "atmel,at91rm9200-ssc";
+				reg = <0xfffbc000 0x4000>;
+				interrupts = <14 4 5>;
+				status = "disable";
+			};
+
 			adc0: adc at fffe0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffe0000 0x100>;
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 3e6e5c1..3b721ee 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -25,6 +25,8 @@
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
 		i2c0 = &i2c0;
+		ssc0 = &ssc0;
+		ssc1 = &ssc1;
 	};
 	cpus {
 		cpu at 0 {
@@ -173,6 +175,20 @@
 				status = "disabled";
 			};
 
+			ssc0: ssc at fff98000 {
+				compatible = "atmel,at91rm9200-ssc";
+				reg = <0xfff98000 0x4000>;
+				interrupts = <16 4 5>;
+				status = "disable";
+			};
+
+			ssc1: ssc at fff9c000 {
+				compatible = "atmel,at91rm9200-ssc";
+				reg = <0xfff9c000 0x4000>;
+				interrupts = <17 4 5>;
+				status = "disable";
+			};
+
 			macb0: ethernet at fffbc000 {
 				compatible = "cdns,at32ap7000-macb", "cdns,macb";
 				reg = <0xfffbc000 0x100>;
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 3add030..cd9af7c 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -31,6 +31,8 @@
 		tcb1 = &tcb1;
 		i2c0 = &i2c0;
 		i2c1 = &i2c1;
+		ssc0 = &ssc0;
+		ssc1 = &ssc1;
 	};
 	cpus {
 		cpu at 0 {
@@ -226,6 +228,20 @@
 				status = "disabled";
 			};
 
+			ssc0: ssc at fff9c000 {
+				compatible = "atmel,at91sam9g45-ssc";
+				reg = <0xfff9c000 0x4000>;
+				interrupts = <16 4 5>;
+				status = "disable";
+			};
+
+			ssc0: ssc at fffa0000 {
+				compatible = "atmel,at91sam9g45-ssc";
+				reg = <0xfffa0000 0x4000>;
+				interrupts = <17 4 5>;
+				status = "disable";
+			};
+
 			adc0: adc at fffb0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffb0000 0x100>;
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 03fc136..69667d0 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -30,6 +30,7 @@
 		i2c0 = &i2c0;
 		i2c1 = &i2c1;
 		i2c2 = &i2c2;
+		ssc0 = &ssc0;
 	};
 	cpus {
 		cpu at 0 {
@@ -87,6 +88,13 @@
 				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>;
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 85d53c5..6d65feb 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -187,6 +187,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffd0000.ssc", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffd4000.ssc", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffd8000.ssc", &ssc2_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 2c8aab0..54d4aea 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -211,6 +211,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260", &twi_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20", &twi_clk),
 	/* more usart lookup table for DT entries */
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 4e8c56e..5c7a482 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -177,6 +177,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffc0000.ssc", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc2_clk),
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9261", &twi_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10", &twi_clk),
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 95a5471..1f523de 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -188,6 +188,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_ID("hclk", &macb_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index f4f96a6..a4282d3 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -241,6 +241,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.1", &twi1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffa0000.ssc", &ssc1_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk),
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 4110b54..b683fdc 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -186,6 +186,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffc0000.ssc", &ssc0_clk),
+	CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc1_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index e503538..18fbbb2 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -231,6 +231,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
+	CLKDEV_CON_DEV_ID("pclk", "f0010000.ssc", &ssc_clk),
 	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
 	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
 	CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index f40abd8..a769719 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -18,6 +18,8 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 
+#include <linux/of.h>
+
 /* Serialize access to ssc_list and user count */
 static DEFINE_SPINLOCK(user_lock);
 static LIST_HEAD(ssc_list);
@@ -29,7 +31,13 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
 
 	spin_lock(&user_lock);
 	list_for_each_entry(ssc, &ssc_list, list) {
-		if (ssc->pdev->id == ssc_num) {
+		if (ssc->pdev->dev.of_node) {
+			if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc")
+				== ssc_num) {
+				ssc_valid = 1;
+				break;
+			}
+		} else if (ssc->pdev->id == ssc_num) {
 			ssc_valid = 1;
 			break;
 		}
@@ -88,10 +96,41 @@ static const struct platform_device_id atmel_ssc_devtypes[] = {
 	}
 };
 
+#ifdef CONFIG_OF
+static const struct of_device_id atmel_ssc_dt_ids[] = {
+	{
+		.compatible = "atmel,at91rm9200-ssc",
+		.data = &at91rm9200_config,
+	}, {
+		.compatible = "atmel,at91sam9g45-ssc",
+		.data = &at91sam9g45_config,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(of, atmel_ssc_dt_ids);
+#endif
+
+static inline const struct atmel_ssc_platform_data * __init
+	atmel_ssc_get_driver_data(struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_ssc_dt_ids, pdev->dev.of_node);
+		if (match == NULL)
+			return NULL;
+		return match->data;
+	}
+
+	return (struct atmel_ssc_platform_data *)
+		platform_get_device_id(pdev)->driver_data;
+}
+
 static int ssc_probe(struct platform_device *pdev)
 {
 	struct resource *regs;
 	struct ssc_device *ssc;
+	const struct atmel_ssc_platform_data *plat_dat;
 
 	ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL);
 	if (!ssc) {
@@ -100,8 +139,11 @@ static int ssc_probe(struct platform_device *pdev)
 	}
 
 	ssc->pdev = pdev;
-	ssc->pdata = (struct atmel_ssc_platform_data *)
-			platform_get_device_id(pdev)->driver_data;
+
+	plat_dat = atmel_ssc_get_driver_data(pdev);
+	if (!plat_dat)
+		return -ENODEV;
+	ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat;
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!regs) {
@@ -160,6 +202,7 @@ static struct platform_driver ssc_driver = {
 	.driver		= {
 		.name		= "ssc",
 		.owner		= THIS_MODULE,
+		.of_match_table	= of_match_ptr(atmel_ssc_dt_ids),
 	},
 	.id_table	= atmel_ssc_devtypes,
 	.probe		= ssc_probe,
-- 
1.7.9.5

^ permalink raw reply related

* [RFC patch v3 3/4] ASoC: atmel-ssc-dai: register dai and pcm directly
From: Bo Shen @ 2012-11-06  5:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352181474-19597-1-git-send-email-voice.shen@atmel.com>

Register dai and pcm directly
fix issue when register dai and pcm directly
Add device tree support
 
Signed-off-by: Bo Shen <voice.shen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
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
---
 .../devicetree/bindings/sound/atmel-ssc-dai.txt    |   15 +
 arch/arm/mach-at91/at91sam9260.c                   |    2 +-
 arch/arm/mach-at91/at91sam9260_devices.c           |    5 +-
 arch/arm/mach-at91/board-sam9g20ek.c               |    6 -
 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                    |  319 +++++++++-----------
 sound/soc/atmel/sam9g20_wm8731.c                   |    4 +-
 9 files changed, 175 insertions(+), 205 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-ssc-dai.txt

diff --git a/Documentation/devicetree/bindings/sound/atmel-ssc-dai.txt b/Documentation/devicetree/bindings/sound/atmel-ssc-dai.txt
new file mode 100644
index 0000000..48ec22a
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel-ssc-dai.txt
@@ -0,0 +1,15 @@
+* Atmel SSC audio driver.
+
+Required properties:
+- compatible: "atmel,at91rm9200-ssc-dai" or "atmel,at91sam9g45-ssc-dai"
+	- atmel,at91rm9200-ssc-dai: support pdc transfer
+	- atmel,at91sam9g45-ssc-dai: support dma transfer
+- reg: Should contain SSC registers location and length
+- interrupts: Should contain SSC interrupt
+
+Example:
+ssc0: ssc at fffbc000 {
+	compatible = "atmel,at91rm9200-ssc-dai";
+	reg = <0xfffbc000 0x4000>;
+	interrupts = <14 4 5>;
+};
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 54d4aea..859526d 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -210,7 +210,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
-	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc_clk),
+	CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc_dai.0", &ssc_clk),
 	CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260", &twi_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20", &twi_clk),
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 9cfdc3f..c7ad6ee 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -725,7 +725,8 @@ static void __init at91_add_device_watchdog(void) {}
  *  SSC -- Synchronous Serial Controller
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
+#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) || \
+	defined(CONFIG_SND_ATMEL_SOC) || defined(CONFIG_SND_ATMEL_SOC_MODULE)
 static u64 ssc_dmamask = DMA_BIT_MASK(32);
 
 static struct resource ssc_resources[] = {
@@ -742,7 +743,7 @@ static struct resource ssc_resources[] = {
 };
 
 static struct platform_device at91sam9260_ssc_device = {
-	.name	= "at91rm9200_ssc",
+	.name	= "at91rm9200_ssc_dai",
 	.id	= 0,
 	.dev	= {
 		.dma_mask		= &ssc_dmamask,
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 5b6a6f9..ebdbf42 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -353,11 +353,6 @@ 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,
@@ -365,7 +360,6 @@ static struct platform_device sam9g20ek_audio_device = {
 
 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/Kconfig b/sound/soc/atmel/Kconfig
index 72b09cf..b51ba54 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 SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
 	select SND_ATMEL_SOC_SSC
 	select SND_SOC_WM8731
 	help
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index 9b84f98..1e9cd2c 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 __devinit 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 __devexit 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..81e3604 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -42,18 +42,13 @@
 #include <sound/initval.h>
 #include <sound/soc.h>
 
+#include <linux/of.h>
+
 #include <mach/hardware.h>
 
 #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 +91,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),
+static struct atmel_ssc_info ssc_info = {
+	.name		= "ssc",
+	.lock		= __SPIN_LOCK_UNLOCKED(ssc_info.lock),
 	.dir_mask	= SSC_DIR_MASK_UNUSED,
 	.initialized	= 0,
-	},
-#if NUM_SSC_DEVICES == 3
-	{
-	.name		= "ssc1",
-	.lock		= __SPIN_LOCK_UNLOCKED(ssc_info[1].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 +161,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 +190,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 +241,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 +253,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 +292,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 +309,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 +558,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 +586,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 +615,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 +644,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 +665,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,118 +680,153 @@ 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,
-	},
+};
+
+static struct atmel_ssc_platform_data at91rm9200_config = {
+	.use_dma = 0,
+};
+
+static struct atmel_ssc_platform_data at91sam9g45_config = {
+	.use_dma = 1,
+};
+
+#ifdef CONFIG_OF
+static const struct of_device_id atmel_ssc_dai_dt_ids[] = {
 	{
-		.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
+		.compatible = "atmel,at91rm9200-ssc-dai",
+		.data = &at91rm9200_config,
+	}, {
+		.compatible = "atmel,at91sam9g45-ssc-dai",
+		.data = &at91sam9g45_config,
+	}, {
+		/* sentinel */
+	}
 };
+MODULE_DEVICE_TABLE(of, atmel_ssc_dai_dt_ids);
+#endif
 
-static __devinit int asoc_ssc_probe(struct platform_device *pdev)
+static inline const struct atmel_ssc_platform_data * __init
+	atmel_ssc_get_driver_data(struct platform_device *pdev)
 {
-	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]);
-}
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_ssc_dai_dt_ids,
+			pdev->dev.of_node);
+		if (match == NULL)
+			return NULL;
+		return match->data;
+	}
 
-static int __devexit asoc_ssc_remove(struct platform_device *pdev)
-{
-	snd_soc_unregister_dai(&pdev->dev);
-	return 0;
+	return (struct atmel_ssc_platform_data *)
+		platform_get_device_id(pdev)->driver_data;
 }
 
-static struct platform_driver asoc_ssc_driver = {
-	.driver = {
-			.name = "atmel-ssc-dai",
-			.owner = THIS_MODULE,
-	},
-
-	.probe = asoc_ssc_probe,
-	.remove = __devexit_p(asoc_ssc_remove),
-};
-
-/**
- * atmel_ssc_set_audio - Allocate the specified SSC for audio use.
- */
-int atmel_ssc_set_audio(int ssc_id)
+static __devinit int asoc_ssc_probe(struct platform_device *pdev)
 {
 	struct ssc_device *ssc;
-	static struct platform_device *dma_pdev;
-	struct platform_device *ssc_pdev;
+	struct resource *regs;
+	const struct atmel_ssc_platform_data *pdata;
 	int ret;
 
-	if (ssc_id < 0 || ssc_id >= ARRAY_SIZE(atmel_ssc_dai))
+	ssc = devm_kzalloc(&pdev->dev, sizeof(ssc), GFP_KERNEL);
+	if (!ssc) {
+		dev_err(&pdev->dev, "out of memory\n");
+		return -ENOMEM;
+	}
+
+	ssc->pdev = pdev;
+
+	pdata = atmel_ssc_get_driver_data(pdev);
+	if (!pdata) {
+		dev_err(&pdev->dev, "no platform data\n");
+		return -ENODEV;
+	}
+	ssc->pdata = (struct atmel_ssc_platform_data *)pdata;
+
+	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!regs) {
+		dev_err(&pdev->dev, "no mmio resource defined\n");
+		return -ENXIO;
+	}
+
+	ssc->regs = devm_request_and_ioremap(&pdev->dev, regs);
+	if (!ssc->regs) {
+		dev_err(&pdev->dev, "ioremap failed\n");
 		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;
+	ssc->clk = devm_clk_get(&pdev->dev, "pclk");
+	if (IS_ERR(ssc->clk)) {
+		dev_err(&pdev->dev, "no pclk clock defined\n");
+		return -EINVAL;
+	}
 
-		ret = platform_device_add(dma_pdev);
-		if (ret < 0) {
-			platform_device_put(dma_pdev);
-			dma_pdev = NULL;
-			return ret;
-		}
+	/* disable all interrupts */
+	clk_enable(ssc->clk);
+	ssc_writel(ssc->regs, IDR, ~0UL);
+	ssc_readl(ssc->regs, SR);
+	clk_disable(ssc->clk);
+
+	ssc->irq = platform_get_irq(pdev, 0);
+	if (!ssc->irq) {
+		dev_err(&pdev->dev, "could not get irq\n");
+		return -ENXIO;
 	}
 
-	ssc_pdev = platform_device_alloc("atmel-ssc-dai", ssc_id);
-	if (!ssc_pdev)
-		return -ENOMEM;
+	ssc_info.ssc = ssc;
 
-	/* 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",
-			PTR_ERR(ssc));
-	else {
-		ssc_pdev->dev.parent = &(ssc->pdev->dev);
-		ssc_free(ssc);
+	platform_set_drvdata(pdev, ssc);
+
+	ret = snd_soc_register_dai(&pdev->dev, &atmel_ssc_dai);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
+		goto err_unregister_dai;
 	}
 
-	ret = platform_device_add(ssc_pdev);
-	if (ret < 0)
-		platform_device_put(ssc_pdev);
+	ret = atmel_pcm_platform_register(&pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
+		goto err;
+	};
+
+	return 0;
 
+err_unregister_dai:
+	snd_soc_unregister_dai(&pdev->dev);
+err:
 	return ret;
 }
-EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);
+
+static int __devexit asoc_ssc_remove(struct platform_device *pdev)
+{
+	atmel_pcm_platform_unregister(&pdev->dev);
+	snd_soc_unregister_dai(&pdev->dev);
+
+	return 0;
+}
+
+static const struct platform_device_id atmel_ssc_dai_devtypes[] = {
+	{
+		.name = "at91rm9200_ssc_dai",
+		.driver_data = (unsigned long) &at91rm9200_config,
+	}, {
+		.name = "at91sam9g45_ssc_dai",
+		.driver_data = (unsigned long) &at91sam9g45_config,
+	}, {
+		/* sentinel */
+	}
+};
+
+static struct platform_driver asoc_ssc_driver = {
+	.driver = {
+		.name		= "atmel-ssc-dai",
+		.owner		= THIS_MODULE,
+		.of_match_table	= of_match_ptr(atmel_ssc_dai_dt_ids),
+	},
+	.id_table = atmel_ssc_dai_devtypes,
+	.probe = asoc_ssc_probe,
+	.remove = __devexit_p(asoc_ssc_remove),
+};
 
 module_platform_driver(asoc_ssc_driver);
 
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index e5e27db..862cbcc 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_dai.0",
 	.codec_dai_name = "wm8731-hifi",
 	.init = at91sam9g20ek_wm8731_init,
-	.platform_name = "atmel-pcm-audio",
+	.platform_name = "at91rm9200_ssc_dai.0",
 	.codec_name = "wm8731.0-001b",
 	.ops = &at91sam9g20ek_ops,
 };
-- 
1.7.9.5

^ permalink raw reply related

* [RFC patch v3 4/4] ASoC: sam9g20-wm8731: convert dt support
From: Bo Shen @ 2012-11-06  5:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352181474-19597-1-git-send-email-voice.shen@atmel.com>

convert sam9g20-wm8731 to device tree support

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Change since v2:
  No change
Change since v1:
  Add sam9g20-wm8731 binding document
---
 .../bindings/sound/atmel-sam9g20-audio-wm8731.txt  |   21 ++++++++
 arch/arm/boot/dts/at91sam9260.dtsi                 |    2 +-
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |   20 +++++++-
 sound/soc/atmel/sam9g20_wm8731.c                   |   51 +++++++++++++++++++-
 4 files changed, 89 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-sam9g20-audio-wm8731.txt

diff --git a/Documentation/devicetree/bindings/sound/atmel-sam9g20-audio-wm8731.txt b/Documentation/devicetree/bindings/sound/atmel-sam9g20-audio-wm8731.txt
new file mode 100644
index 0000000..ad77fb0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel-sam9g20-audio-wm8731.txt
@@ -0,0 +1,21 @@
+* Atmel sam9g20ek audio complex
+
+Required properties:
+  - compatible: "atmel,at91sam9g20-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
+
+Example:
+sound {
+	compatible = "atmel,at91sam9g20-audio";
+	atmel,model = "wm8731 @ sam9g20ek";
+
+	atmel,audio-routing =
+		"Ext Spk", "LHPOUT",
+		"Int MIC", "MICIN";
+
+	atmel,ssc-controller = <&ssc0>;
+	atmel,audio-codec = <&wm8731>;
+};
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index aaa42d8..d322dae 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -214,7 +214,7 @@
 			};
 
 			ssc0: ssc at fffbc000 {
-				compatible = "atmel,at91rm9200-ssc";
+				compatible = "atmel,at91rm9200-ssc-dai";
 				reg = <0xfffbc000 0x4000>;
 				interrupts = <14 4 5>;
 				status = "disable";
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index b06c0db..05706a3 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -51,6 +51,10 @@
 				atmel,vbus-gpio = <&pioC 5 0>;
 				status = "okay";
 			};
+
+			ssc0: ssc at fffbc000 {
+				status = "okay";
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -114,8 +118,8 @@
 			reg = <0x50>;
 		};
 
-		wm8731 at 1b {
-			compatible = "wm8731";
+		wm8731: wm8731 at 1b {
+			compatible = "wlf,wm8731";
 			reg = <0x1b>;
 		};
 	};
@@ -139,4 +143,16 @@
 			gpio-key,wakeup;
 		};
 	};
+
+	sound {
+		compatible = "atmel,at91sam9g20-audio";
+		atmel,model = "wm8731 @ sam9g20ek";
+
+		atmel,audio-routing =
+			"Ext Spk", "LHPOUT",
+			"Int Mic", "MICIN";
+
+		atmel,ssc-controller = <&ssc0>;
+		atmel,audio-codec = <&wm8731>;
+	};
 };
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 862cbcc..36f0fb3 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -197,13 +197,17 @@ 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;
 
-	if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
+	if (!np) {
+		if (!(machine_is_at91sam9g20ek()
+			|| machine_is_at91sam9g20ek_2mmc()))
 		return -ENODEV;
-
+	}
 	/*
 	 * Codec MCLK is supplied by PCK0 - set it up.
 	 */
@@ -230,6 +234,40 @@ 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 dai 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;
+		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 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");
@@ -255,10 +293,19 @@ static int __devexit at91sam9g20ek_audio_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id sam9g20ek_wm8731_dt_ids[] = {
+	{ .compatible = "atmel,at91sam9g20-audio", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sam9g20ek_wm8731_dt_ids);
+#endif
+
 static struct platform_driver at91sam9g20ek_audio_driver = {
 	.driver = {
 		.name	= "at91sam9g20ek-audio",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(sam9g20ek_wm8731_dt_ids),
 	},
 	.probe	= at91sam9g20ek_audio_probe,
 	.remove	= __devexit_p(at91sam9g20ek_audio_remove),
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 04/15] ARM: OMAP2+: hwmod: Update the reset API for AM33XX
From: Hiremath, Vaibhav @ 2012-11-06  6:06 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <B5906170F1614E41A8A28DE3B8D121433EC0336F@DBDE01.ent.ti.com>

On Mon, Nov 05, 2012 at 23:27:52, Bedia, Vaibhav wrote:
> On Mon, Nov 05, 2012 at 12:28:36, Hiremath, Vaibhav wrote:
> [...]
> > > -	u32 mask = 1 << shift;
> > > -
> > > -	/* Check the current status to avoid  de-asserting the line twice */
> > > -	if (am33xx_prm_is_hardreset_asserted(shift, inst, rstctrl_offs) == 0)
> > > -		return -EEXIST;
> > 
> > Any specific reason why you have removed this check?
> 
> During bootup the hardreset line is asserted, so wouldn't that check lead
> to the function always returning without doing anything?
> 

The check is,

/* Check the current status to avoid  de-asserting the line twice */
if (am33xx_prm_is_hardreset_asserted(shift, inst, rstctrl_offs) == 0)
	return -EEXIST;


The code is checking whether the line is already de-asserted (== 0), so I am 
not sure how this will change if hardreset line is asserted during bootup.

Thanks,
Vaibhav

^ permalink raw reply

* [PATCH 06/15] ARM: OMAP2+: hwmod: Enable OCMCRAM registration in AM33XX
From: Hiremath, Vaibhav @ 2012-11-06  6:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <B5906170F1614E41A8A28DE3B8D121433EC03374@DBDE01.ent.ti.com>

On Mon, Nov 05, 2012 at 23:27:53, Bedia, Vaibhav wrote:
> On Mon, Nov 05, 2012 at 12:53:59, Hiremath, Vaibhav wrote:
> > 
> > Can you cut-n-paste the ocmcram hwmod entry outside of #if and resubmit
> > it again?
> > 
> 
> Ok. Will do that in the next version.
> 

Another suggestion, all hwmod patches looks independent and trivial to me, 
so can you submit all hwmod patches separately so that it can go separately?

Thanks,
Vaibhav

> Regards,
> Vaibhav 
> 
> 

^ permalink raw reply

* OMAP baseline test results for v3.7-rc3
From: Hiremath, Vaibhav @ 2012-11-06  6:09 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <alpine.DEB.2.00.1211050239530.23228@utopia.booyaka.com>

On Mon, Nov 05, 2012 at 08:11:24, Paul Walmsley wrote:
> Hi
> 
> On Tue, 30 Oct 2012, Vaibhav Hiremath wrote:
> 
> > This is surprising, I have tested v3.7-rc3 branch on AM335xBone platform
> > and its booting up for me without any issues.
> > Jon had submitted another patch which fixes boot issue on Bone.
> > 
> > https://patchwork.kernel.org/patch/1606471/
> 
> v3.7-rc4 failed for me with a detached .dtb in a quick test.  Probably it 
> is due to the original u-boot that was shipped with the MMC card:
> 

Pulling the tree, let me try now and update you shortly...

> U-Boot 2011.09-00009-gcf6e04d (Mar 08 2012 - 17:15:43)
> arm-arago-linux-gnueabi-gcc (GCC) 4.5.3 20110311 (prerelease)
> 
> 
> Which U-boot are you using these days?
> 

I am using mainline denx u-boot.

Thanks,
Vaibhav

> 
> - Paul
> 

^ permalink raw reply

* [PATCH 0/5] PM Fixes for exynos5
From: Abhilash Kesavan @ 2012-11-06  6:12 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset comprises fixes to properly enable PM support on exynos5.
Based on git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
for-next branch.

Patches 1 and 4 are re-posts of patches sent earlier by Changhwan Youn and
Inderpal Singh respectively. Links follow:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-May/098930.html
http://permalink.gmane.org/gmane.linux.kernel.samsung-soc/10947

Patch 2 is a fix in cpuidle while patch 3 enables the RTC alarm as a wake
up source.

Patch 5 adds a machine specific "flush_cache_all" as it is no longer part
of the core suspend routine. This was suggested by Lorenzo Pieralisi.

These patches have been tested on SMDK5250.

Abhilash Kesavan (3):
  ARM: EXYNOS: fix the hotplug for Cortex-A15
  ARM: EXYNOS5: Remove scu_enable from cpuidle
  ARM: EXYNOS5: Add flush_cache_all in suspend finisher

Inderpal Singh (2):
  ARM: EXYNOS5: Add support for rtc wakeup
  ARM: EXYNOS: Fix soft reboot hang after suspend/resume

 arch/arm/mach-exynos/common.c           |    2 +
 arch/arm/mach-exynos/cpuidle.c          |    3 +-
 arch/arm/mach-exynos/hotplug.c          |   45 ++++++++++++++++++++++++++++--
 arch/arm/mach-exynos/pm.c               |    7 +++++
 arch/arm/plat-samsung/include/plat/pm.h |    2 +
 5 files changed, 55 insertions(+), 4 deletions(-)

^ permalink raw reply

* [PATCH 1/5] ARM: EXYNOS: fix the hotplug for Cortex-A15
From: Abhilash Kesavan @ 2012-11-06  6:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352182356-28989-1-git-send-email-a.kesavan@samsung.com>

The sequence of cpu_enter_lowpower() for Cortex-A15
is different from the sequence for Cortex-A9.
This patch implements cpu_enter_lowpower() for EXYNOS5
SoC which has Cortex-A15 cores.

Signed-off-by: Changhwan Youn <chaos.youn@samsung.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 arch/arm/mach-exynos/hotplug.c |   45 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index f4d7dd2..8c06c4f 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -20,10 +20,11 @@
 #include <asm/smp_plat.h>
 
 #include <mach/regs-pmu.h>
+#include <plat/cpu.h>
 
 #include "common.h"
 
-static inline void cpu_enter_lowpower(void)
+static inline void cpu_enter_lowpower_a9(void)
 {
 	unsigned int v;
 
@@ -45,6 +46,35 @@ static inline void cpu_enter_lowpower(void)
 	  : "cc");
 }
 
+static inline void cpu_enter_lowpower_a15(void)
+{
+	unsigned int v;
+
+	asm volatile(
+	"	mrc	p15, 0, %0, c1, c0, 0\n"
+	"	bic	%0, %0, %1\n"
+	"	mcr	p15, 0, %0, c1, c0, 0\n"
+	  : "=&r" (v)
+	  : "Ir" (CR_C)
+	  : "cc");
+
+	flush_cache_all();
+
+	asm volatile(
+	/*
+	* Turn off coherency
+	*/
+	"	mrc	p15, 0, %0, c1, c0, 1\n"
+	"	bic	%0, %0, %1\n"
+	"	mcr	p15, 0, %0, c1, c0, 1\n"
+	: "=&r" (v)
+	: "Ir" (0x40)
+	: "cc");
+
+	isb();
+	dsb();
+}
+
 static inline void cpu_leave_lowpower(void)
 {
 	unsigned int v;
@@ -103,11 +133,20 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 void __ref exynos_cpu_die(unsigned int cpu)
 {
 	int spurious = 0;
+	int primary_part = 0;
 
 	/*
-	 * we're ready for shutdown now, so do it
+	 * we're ready for shutdown now, so do it.
+	 * Exynos4 is A9 based while Exynos5 is A15; check the CPU part
+	 * number by reading the Main ID register and then perform the
+	 * appropriate sequence for entering low power.
 	 */
-	cpu_enter_lowpower();
+	asm("mrc p15, 0, %0, c0, c0, 0" : "=r"(primary_part) : : "cc");
+	if ((primary_part & 0xfff0) == 0xc0f0)
+		cpu_enter_lowpower_a15();
+	else
+		cpu_enter_lowpower_a9();
+
 	platform_do_lowpower(cpu, &spurious);
 
 	/*
-- 
1.6.6.1

^ permalink raw reply related

* [PATCH 2/5] ARM: EXYNOS5: Add support for rtc wakeup
From: Abhilash Kesavan @ 2012-11-06  6:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352182356-28989-1-git-send-email-a.kesavan@samsung.com>

From: Inderpal Singh <inderpal.singh@samsung.com>

Set the gic arch extension callback to support rtc wakeup.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Inderpal Singh <inderpal.singh@samsung.com>
---
 arch/arm/mach-exynos/common.c           |    2 ++
 arch/arm/plat-samsung/include/plat/pm.h |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 4e577f6..300c40f 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -631,6 +631,8 @@ void __init exynos5_init_irq(void)
 	 * uses GIC instead of VIC.
 	 */
 	s5p_init_irq(NULL, 0);
+
+	gic_arch_extn.irq_set_wake = s3c_irq_wake;
 }
 
 struct bus_type exynos_subsys = {
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index 61fc537..887a0c9 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -107,10 +107,12 @@ extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
 extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
 
 #ifdef CONFIG_PM
+extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
 extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
 extern int s3c24xx_irq_suspend(void);
 extern void s3c24xx_irq_resume(void);
 #else
+#define s3c_irq_wake NULL
 #define s3c_irqext_wake NULL
 #define s3c24xx_irq_suspend NULL
 #define s3c24xx_irq_resume  NULL
-- 
1.6.6.1

^ permalink raw reply related

* [PATCH 3/5] ARM: EXYNOS: Fix soft reboot hang after suspend/resume
From: Abhilash Kesavan @ 2012-11-06  6:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352182356-28989-1-git-send-email-a.kesavan@samsung.com>

From: Inderpal Singh <inderpal.singh@samsung.com>

Upon wake-up, clear the sleep mode set in INFORM1 register.

Signed-off-by: Inderpal Singh <inderpal.singh@samsung.com>
Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 arch/arm/mach-exynos/pm.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index c06c992..8dedeb2 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -312,6 +312,10 @@ static void exynos_pm_resume(void)
 	}
 
 early_wakeup:
+
+	/* Clear SLEEP mode set in INFORM1 */
+	__raw_writel(0x0, S5P_INFORM1);
+
 	return;
 }
 
-- 
1.6.6.1

^ permalink raw reply related

* [PATCH 4/5] ARM: EXYNOS5: Remove scu_enable from cpuidle
From: Abhilash Kesavan @ 2012-11-06  6:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352182356-28989-1-git-send-email-a.kesavan@samsung.com>

Cortex A9 based exynos4 has a memory mapped SCU while the Cortex
A15 based exynos5 does not. Hence, remove the call to scu_enable
for exynos5.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Inderpal Singh <inderpal.singh@samsung.com>
---
 arch/arm/mach-exynos/cpuidle.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index cff0595..8e4ec21 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -116,7 +116,8 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
 	cpu_suspend(0, idle_finisher);
 
 #ifdef CONFIG_SMP
-	scu_enable(S5P_VA_SCU);
+	if (!soc_is_exynos5250())
+		scu_enable(S5P_VA_SCU);
 #endif
 	cpu_pm_exit();
 
-- 
1.6.6.1

^ permalink raw reply related

* [PATCH 5/5] ARM: EXYNOS5: Add flush_cache_all in suspend finisher
From: Abhilash Kesavan @ 2012-11-06  6:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352182356-28989-1-git-send-email-a.kesavan@samsung.com>

The core cpu_suspend code no longer calls flush_cache_all to
optimize the cpu idle flow. Add a call for the same in the
exynos specific suspend code.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 arch/arm/mach-exynos/pm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 8dedeb2..8df6ec5 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -81,6 +81,9 @@ static int exynos_cpu_suspend(unsigned long arg)
 	outer_flush_all();
 #endif
 
+	if (soc_is_exynos5250())
+		flush_cache_all();
+
 	/* issue the standby signal into the pm unit. */
 	cpu_do_idle();
 
-- 
1.6.6.1

^ permalink raw reply related

* OMAP baseline test results for v3.7-rc3
From: Hiremath, Vaibhav @ 2012-11-06  6:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <5097EF44.5030706@mimc.co.uk>

On Mon, Nov 05, 2012 at 22:24:28, Mark Jackson wrote:
> On 31/10/12 13:57, Hiremath, Vaibhav wrote:
> > On Wed, Oct 31, 2012 at 19:11:03, Mark Jackson wrote:
> >> On 30/10/12 14:48, Vaibhav Hiremath wrote:
> >>
> >> Okay, so I'm now coming up against a brick wall regarding U-Boot.
> >>
> >> The Kernel boots fine (as per the tree + patch above) provided I build U-Boot using the
> >> v2011.09_AM335xPSP_04.06.00.06 branch from git://arago-project.org/git/projects/u-boot-am33x.git
> >>
> >> If I try the latest mainline U-Boot (or the TI branch), I just get to "Starting kernel ..." and then
> >> hangs.
> >>
> >> I'm going to raise this query on the U-Boot ML, but can you let me know which U-Boot image you're
> >> using ?
> >>
> > 
> > 
> > I am using Mainline u-boot and it works for me. Can you paste u-boot boot 
> > log and environment variable here?
> > 
> > Thanks,
> > Vaibhav
> 
> So I've now spent several days trying to fix this problem, but still no joy.
> 
> Did my previous emails give any clue as to where I'm going wrong ?
> 
> Thanks for any help you can provide.
> 

Sorry for delayed response, I was really got pulled into other things, now I 
am back.

I looked at your boot-log, didn't understand how it was booting earlier for 
you -


------------------------
mainline U-Boot boot log
------------------------
U-Boot SPL 2012.10-00434-ged296d2 (Oct 31 2012 - 14:18:50)
OMAP SD/MMC: 0
reading u-boot.img
reading u-boot.img


> ------------------------
> mainline U-Boot boot log
> ------------------------
> U-Boot SPL 2012.10-00434-ged296d2 (Oct 31 2012 - 14:18:50)
> OMAP SD/MMC: 0
> reading u-boot.img
> reading u-boot.img
> 
> 
> U-Boot 2012.10-00434-ged296d2 (Oct 31 2012 - 14:18:50)
> 
> I2C:   ready
> DRAM:  256 MiB

This is important, since u-boot relocated DTB file.

> WARNING: Caches not enabled
> MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
> Using default environment
> 
> Net:   cpsw
> Hit any key to stop autoboot:  0
> mmc0 is current device
> SD/MMC found on device 0
> reading uEnv.txt
> 29 bytes read
> Loaded environment from uEnv.txt
> Importing environment from mmc ...
> 4315695 bytes read
> Booting from mmc ...
> ## Booting kernel from Legacy Image at 80200000 ...
>    Image Name:   Linux-3.7.0-rc1-47802-ge7289dc-d
>    Image Type:   ARM Linux Kernel Image (uncompressed)
>    Data Size:    4308448 Bytes = 4.1 MiB
>    Load Address: 80008000
>    Entry Point:  80008000
>    Verifying Checksum ... OK
>    Loading Kernel Image ... OK
> OK
> 

Where is your DTB? Is it appended to Kernel image?
Can you try below sequence/commands from u-boot?


mmc rescan 0
fatload mmc 0 80000000 am335x-bone.dtb
fatload mmc 0 81000000 uImage
setenv bootargs console=ttyO0,115200n8 mem=256M root=/dev/mmcblk0p2 rw noinitrd rootfstype=ext3 rootwait earlyprink=serial
sendln 'bootm 81000000 - 80000000'



To build DTB files, use "make dtbs" command on your kernel home directory.

Thanks,
Vaibhav

> Starting kernel ...
> Mark J.
> 

^ permalink raw reply

* [PATCH] ARM: EXYNOS5: Fix system register base address
From: Abhilash Kesavan @ 2012-11-06  6:16 UTC (permalink / raw)
  To: linux-arm-kernel

Fix incorrect PA of the system register on exynos5.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 arch/arm/mach-exynos/include/mach/map.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index ef4958b..6ef983c 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -55,7 +55,7 @@
 #define EXYNOS_PA_CHIPID		0x10000000
 
 #define EXYNOS4_PA_SYSCON		0x10010000
-#define EXYNOS5_PA_SYSCON		0x10050100
+#define EXYNOS5_PA_SYSCON		0x10050000
 
 #define EXYNOS4_PA_PMU			0x10020000
 #define EXYNOS5_PA_PMU			0x10040000
-- 
1.6.6.1

^ permalink raw reply related

* OMAP baseline test results for v3.7-rc3
From: Hiremath, Vaibhav @ 2012-11-06  6:17 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121030185102.GC4804@arwen.pp.htv.fi>

On Wed, Oct 31, 2012 at 00:21:02, Balbi, Felipe wrote:
> Hi,
> 
> On Tue, Oct 30, 2012 at 10:58:59AM -0700, Tony Lindgren wrote:
> > * Felipe Balbi <balbi@ti.com> [121030 10:34]:
> > > Hi,
> > > 
> > > On Tue, Oct 30, 2012 at 09:27:28AM -0700, Tony Lindgren wrote:
> > > > * Vaibhav Hiremath <hvaibhav@ti.com> [121030 07:50]:
> > > > > > 
> > > > > > MMC is dependent on EDMA-DMA conversion patches from Matt, which he has 
> > > > > > already submitted to the list recently. So MMC support will come along with
> > > > > > EDMA support. DMA-EDMA patches are targeted for v3.8, lets see how it goes.
> > > > 
> > > > This is a bogus dependency, the MMC driver needs to also work
> > > > without DMA.
> > > 
> > > heh, too bad driver errors out when it doesn't find DMA channels :-)
> > 
> > It should just print a warning instead and continue.
> >  
> > > 1869         host->rx_chan = dma_request_channel(mask, omap_dma_filter_fn, &rx_req);
> > > 1870         if (!host->rx_chan) {
> > > 1871                 dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
> > > 1872                 ret = -ENXIO;
> > > 1873                 goto err_irq;
> > > 1874         }
> > > 1875 
> > > 1876         host->tx_chan = dma_request_channel(mask, omap_dma_filter_fn, &tx_req);
> > > 1877         if (!host->tx_chan) {
> > > 1878                 dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req);
> > > 1879                 ret = -ENXIO;
> > > 1880                 goto err_irq;
> > > 1881         }
> > > 
> > > in fact, if DMAENGINE isn't enabled, this won't even compile due to
> > > omap_dma_filter_fn() right ?
> > 
> > It should, CONFIG_DMADEVICES is optional. If it does not compile,
> > then there's a bug somewhere.
> 
> you're right, there's a static inline nop for when we don't have omap
> dma engine driver compiled.
> 
> nevermind.
> 

Did anybody tried polling mode MMC support on OMAP devices in the past?

Thanks,
Vaibhav

> -- 
> balbi
> 

^ permalink raw reply

* [PATCH RFC] ARM: EXYNOS5: Setup legacy i2c controller interrupts on SMDK5250
From: Abhilash Kesavan @ 2012-11-06  6:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Exynos5 we have a new high-speed i2c controller. The interrupt
sources for the legacy and new controller are muxed and are controlled
via the SYSCON I2C_CFG register.
At reset the interrupt source is configured for the high-speed controller,
to continue using the old i2c controller we need to modify the I2C_CFG
register.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
This is a hack, I am not quite clear on how to handle this via DT. Suggestions
welcome.

 arch/arm/mach-exynos/mach-exynos5-dt.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index ed37273..badffd4 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -13,10 +13,12 @@
 #include <linux/serial_core.h>
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
+#include <linux/io.h>
 
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
 #include <mach/map.h>
+#include <mach/regs-pmu.h>
 
 #include <plat/cpu.h>
 #include <plat/regs-serial.h>
@@ -89,6 +91,12 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
 	{},
 };
 
+static void exynos5_i2c_setup(void)
+{
+	/* Setup the low-speed i2c controller interrupts */
+	writel(0x0, EXYNOS5_SYS_I2C_CFG);
+}
+
 static void __init exynos5250_dt_map_io(void)
 {
 	exynos_init_io(NULL, 0);
@@ -97,6 +105,8 @@ static void __init exynos5250_dt_map_io(void)
 
 static void __init exynos5250_dt_machine_init(void)
 {
+	exynos5_i2c_setup();
+
 	of_platform_populate(NULL, of_default_bus_match_table,
 				exynos5250_auxdata_lookup, NULL);
 }
-- 
1.6.6.1

^ permalink raw reply related

* [PATCH 1/5] ARM: EXYNOS: fix the hotplug for Cortex-A15
From: Kyungmin Park @ 2012-11-06  6:21 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352182356-28989-2-git-send-email-a.kesavan@samsung.com>

Hi,

On 11/6/12, Abhilash Kesavan <a.kesavan@samsung.com> wrote:
> The sequence of cpu_enter_lowpower() for Cortex-A15
> is different from the sequence for Cortex-A9.
> This patch implements cpu_enter_lowpower() for EXYNOS5
> SoC which has Cortex-A15 cores.
>
> Signed-off-by: Changhwan Youn <chaos.youn@samsung.com>
> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>
> ---
>  arch/arm/mach-exynos/hotplug.c |   45
> +++++++++++++++++++++++++++++++++++++--
>  1 files changed, 42 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-exynos/hotplug.c
> b/arch/arm/mach-exynos/hotplug.c
> index f4d7dd2..8c06c4f 100644
> --- a/arch/arm/mach-exynos/hotplug.c
> +++ b/arch/arm/mach-exynos/hotplug.c
> @@ -20,10 +20,11 @@
>  #include <asm/smp_plat.h>
>
>  #include <mach/regs-pmu.h>
> +#include <plat/cpu.h>
>
>  #include "common.h"
>
> -static inline void cpu_enter_lowpower(void)
> +static inline void cpu_enter_lowpower_a9(void)
>  {
>  	unsigned int v;
>
> @@ -45,6 +46,35 @@ static inline void cpu_enter_lowpower(void)
>  	  : "cc");
>  }
>
> +static inline void cpu_enter_lowpower_a15(void)
> +{
> +	unsigned int v;
> +
> +	asm volatile(
> +	"	mrc	p15, 0, %0, c1, c0, 0\n"
> +	"	bic	%0, %0, %1\n"
> +	"	mcr	p15, 0, %0, c1, c0, 0\n"
> +	  : "=&r" (v)
> +	  : "Ir" (CR_C)
> +	  : "cc");
> +
> +	flush_cache_all();
> +
> +	asm volatile(
> +	/*
> +	* Turn off coherency
> +	*/
> +	"	mrc	p15, 0, %0, c1, c0, 1\n"
> +	"	bic	%0, %0, %1\n"
> +	"	mcr	p15, 0, %0, c1, c0, 1\n"
> +	: "=&r" (v)
> +	: "Ir" (0x40)
> +	: "cc");
> +
> +	isb();
> +	dsb();
> +}
> +
>  static inline void cpu_leave_lowpower(void)
>  {
>  	unsigned int v;
> @@ -103,11 +133,20 @@ static inline void platform_do_lowpower(unsigned int
> cpu, int *spurious)
>  void __ref exynos_cpu_die(unsigned int cpu)
>  {
>  	int spurious = 0;
> +	int primary_part = 0;
>
>  	/*
> -	 * we're ready for shutdown now, so do it
> +	 * we're ready for shutdown now, so do it.
> +	 * Exynos4 is A9 based while Exynos5 is A15; check the CPU part
> +	 * number by reading the Main ID register and then perform the
> +	 * appropriate sequence for entering low power.
>  	 */
> -	cpu_enter_lowpower();
> +	asm("mrc p15, 0, %0, c0, c0, 0" : "=r"(primary_part) : : "cc");
> +	if ((primary_part & 0xfff0) == 0xc0f0)
Doesn't better to use soc_is_exynos5250? Actullay, it's better to use
soc_is_exynos5 for all exynos5 series. but not it doesn't have these
macro.

Thank you,
Kyungmin Park
> +		cpu_enter_lowpower_a15();
> +	else
> +		cpu_enter_lowpower_a9();
> +
>  	platform_do_lowpower(cpu, &spurious);
>
>  	/*
> --
> 1.6.6.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply

* [PATCH 1/8] PWMSS: Add PWM Subsystem driver for parent<->child relationship
From: Bedia, Vaibhav @ 2012-11-06  6:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352106749-9437-2-git-send-email-avinashphilip@ti.com>

On Mon, Nov 05, 2012 at 14:42:22, Philip, Avinash wrote:
[...]
> +pwmss0: pwmss at 48300000 {
> +	compatible = "ti,am33xx-pwmss";
> +	reg = <0x48300000 0x10
> +		0x48300100 0x80
> +		0x48300180 0x80
> +		0x48300200 0x80>;
Do you really need the 4 address ranges here? You eventually do add in
child nodes with other address ranges so isn't the first entry sufficient?
I haven't really looked at the DT details so it is enforced by that let me
know.

[...]
> +
> +#define PWMSS_CLKCONFIG		8
> +

This #def can use a comment.

> +void pwmss_submodule_state_change(struct device *dev, int pos, bool enable)
> +{
> +	struct pwmss_info *info = dev_get_drvdata(dev);
> +	u16 val;
> +
> +	val = readw(info->mmio_base + PWMSS_CLKCONFIG);
> +	if (enable)
> +		val |= 1 << pos;
> +	else
> +		val &= ~(1 << pos);
> +	mutex_lock(&info->pwmss_lock);
> +	writew(val , info->mmio_base + PWMSS_CLKCONFIG);
> +	mutex_unlock(&info->pwmss_lock);
> +}
> +EXPORT_SYMBOL(pwmss_submodule_state_change);

I see a clk_en_ack field in the clock status register. You should be checking that.

[...]

> +
> +MODULE_DESCRIPTION("pwmss driver");
> +MODULE_AUTHOR("Texas Instruments");
> +MODULE_LICENSE("GPL");
> diff --git a/drivers/pwm/tipwmss.h b/drivers/pwm/tipwmss.h
> new file mode 100644
> index 0000000..83fdc29
> --- /dev/null
> +++ b/drivers/pwm/tipwmss.h
> @@ -0,0 +1,8 @@

License text?
 
> +#ifdef CONFIG_PWM_TIPWMSS
> +extern void pwmss_submodule_state_change(struct device *dev, int pos,
> +		bool enable);
> +#else
> +static inline void pwmss_submodule_state_change(struct device *dev, int pos,
> +		bool enable)
> +{}
> +#endif

Regards,
Vaibhav

^ permalink raw reply

* [PATCH 6/8] pwm: pwm-tiehrpwm: Adding TBCLK gating support.
From: Bedia, Vaibhav @ 2012-11-06  6:46 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1352106749-9437-7-git-send-email-avinashphilip@ti.com>

On Mon, Nov 05, 2012 at 14:42:27, Philip, Avinash wrote:
[...]

> +	/* Some platforms require explicit tbclk gating */
> +	if (of_property_read_bool(pdev->dev.of_node, "tbclkgating")) {
> +		pc->tbclk = clk_get(&pdev->dev, "tbclk");
> +		if (IS_ERR(pc->tbclk)) {
> +			dev_err(&pdev->dev, "Could not get EHRPWM TBCLK\n");
> +			return PTR_ERR(pc->tbclk);
> +		}
> +	}
> +
> +	/* Enable tbclk & leave */
> +	if (pc->tbclk)
> +		clk_enable(pc->tbclk);
> +

Here also why are you leaving this clock always running?

Regards,
Vaibhav

^ permalink raw reply


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