Re: [PATCH] mmc: dw_mmc: enable controller interrupt before calling mmc_start_host

2012-10-25 Thread Yuvaraj CD
Yes,its legal name.Yuvaraj C D.

On Wed, Oct 24, 2012 at 2:49 AM, Chris Ball c...@laptop.org wrote:
 Hi,

 On Mon, Oct 08 2012, Yuvaraj CD wrote:
 As mmc_start_host is getting called before enabling the dw_mmc controller
 interrupt, there is a problem of missing the SDMMC_INT_CMD_DONE for the
 very first command sent by the sdio_reset.
 This problem occurs only when we disable MMC debugging i.e, MMC_DEBUG [=n].
 Hence this patch enables the dw_mmc controller interrupt before 
 mmc_start_host.

 Signed-off-by: Yuvaraj CD yuvaraj...@samsung.com

 Is Yuvaraj CD your legal name?  We should use your full name so that
 we can track copyright attribution properly.

 Thanks!

 - Chris.
 --
 Chris Ball   c...@laptop.org   http://printf.net/
 One Laptop Per Child
 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] DMA: PL330: Free memory allocated for peripheral channels

2012-10-25 Thread Inderpal Singh
Hi Vinod,

Thanks for reviewing.

On 24 October 2012 09:35, Vinod Koul vk...@infradead.org wrote:
 On Fri, 2012-10-05 at 15:47 +0530, Inderpal Singh wrote:
 The allocated memory for peripheral channels is not being freed upon
 failure in probe and in module's remove funtion. It will lead to memory
 leakage. Hence free the allocated memory.

 Signed-off-by: Inderpal Singh inderpal.si...@linaro.org
 ---
  drivers/dma/pl330.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
 index 2ebd4cd..10c6b6a 100644
 --- a/drivers/dma/pl330.c
 +++ b/drivers/dma/pl330.c
 @@ -2962,7 +2962,7 @@ pl330_probe(struct amba_device *adev, const struct 
 amba_id *id)
   ret = dma_async_device_register(pd);
   if (ret) {
   dev_err(adev-dev, unable to register DMAC\n);
 - goto probe_err4;
 + goto probe_err5;
   }

   dev_info(adev-dev,
 @@ -2975,6 +2975,8 @@ pl330_probe(struct amba_device *adev, const struct 
 amba_id *id)

   return 0;

 +probe_err5:
 + kfree(pdmac-peripherals);
  probe_err4:
   pl330_del(pi);
  probe_err3:
 @@ -3025,6 +3027,7 @@ static int __devexit pl330_remove(struct amba_device 
 *adev)
   res = adev-res;
   release_mem_region(res-start, resource_size(res));

 + kfree(pdmac-peripherals);
   kfree(pdmac);

   return 0;

 This looks fine, but if you use devm_ functions then you dont need to do
 all this.
 Can you do that conversion instead?


Good point.
I will do the conversion and send it again.

Regards,
Inder

 --
 Vinod Koul
 Intel Corp.

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] DMA: PL330: Change allocation method to properly free DMA descriptors

2012-10-25 Thread Inderpal Singh
On 24 October 2012 09:40, Vinod Koul vk...@infradead.org wrote:
 On Fri, 2012-10-05 at 15:47 +0530, Inderpal Singh wrote:
 In probe, memory for multiple DMA descriptors were being allocated at once
 and then it was being split and added into DMA pool one by one. The address
 of this memory allocation is not being saved anywhere. To free this memory,
 the address is required. Initially the first node of the pool will be
 pointed by this address but as we use this pool the descs will shuffle and
 hence we will lose the track of the address.

 This patch does following:

 1. Allocates DMA descs one by one and then adds them to pool so that all
descs can be fetched and memory freed one by one. This way runtime
added descs can also be freed.
 2. Free DMA descs in case of error in probe and in module's remove function
 For probe, again you have cleaner code by using devm_kzalloc.

 On 1, if we use the devm_kzalloc then we don't need to allocate in
 chunks right?


Yes, if we use devm_kzalloc we wont have to allocate in chunks.
I will update this patch to use devm_kzalloc and send it again.



 Signed-off-by: Inderpal Singh inderpal.si...@linaro.org
 ---
  drivers/dma/pl330.c |   35 +--
  1 file changed, 25 insertions(+), 10 deletions(-)

 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
 index 10c6b6a..bf71ff7 100644
 --- a/drivers/dma/pl330.c
 +++ b/drivers/dma/pl330.c
 @@ -2541,20 +2541,20 @@ static int add_desc(struct dma_pl330_dmac *pdmac, 
 gfp_t flg, int count)
   if (!pdmac)
   return 0;

 - desc = kmalloc(count * sizeof(*desc), flg);
 - if (!desc)
 - return 0;
 + for (i = 0; i  count; i++) {
 + desc = kmalloc(sizeof(*desc), flg);
 + if (!desc)
 + break;
 + _init_desc(desc);

 - spin_lock_irqsave(pdmac-pool_lock, flags);
 + spin_lock_irqsave(pdmac-pool_lock, flags);

 - for (i = 0; i  count; i++) {
 - _init_desc(desc[i]);
 - list_add_tail(desc[i].node, pdmac-desc_pool);
 - }
 + list_add_tail(desc-node, pdmac-desc_pool);

 - spin_unlock_irqrestore(pdmac-pool_lock, flags);
 + spin_unlock_irqrestore(pdmac-pool_lock, flags);
 + }

 - return count;
 + return i;
  }

  static struct dma_pl330_desc *
 @@ -2857,6 +2857,7 @@ pl330_probe(struct amba_device *adev, const struct 
 amba_id *id)
   struct dma_pl330_platdata *pdat;
   struct dma_pl330_dmac *pdmac;
   struct dma_pl330_chan *pch;
 + struct dma_pl330_desc *desc;
   struct pl330_info *pi;
   struct dma_device *pd;
   struct resource *res;
 @@ -2978,6 +2979,12 @@ pl330_probe(struct amba_device *adev, const struct 
 amba_id *id)
  probe_err5:
   kfree(pdmac-peripherals);
  probe_err4:
 + while (!list_empty(pdmac-desc_pool)) {
 + desc = list_entry(pdmac-desc_pool.next,
 + struct dma_pl330_desc, node);
 + list_del(desc-node);
 + kfree(desc);
 + }
   pl330_del(pi);
  probe_err3:
   free_irq(irq, pi);
 @@ -2994,6 +3001,7 @@ static int __devexit pl330_remove(struct amba_device 
 *adev)
  {
   struct dma_pl330_dmac *pdmac = amba_get_drvdata(adev);
   struct dma_pl330_chan *pch, *_p;
 + struct dma_pl330_desc *desc;
   struct pl330_info *pi;
   struct resource *res;
   int irq;
 @@ -3015,6 +3023,13 @@ static int __devexit pl330_remove(struct amba_device 
 *adev)
   pl330_free_chan_resources(pch-chan);
   }

 + while (!list_empty(pdmac-desc_pool)) {
 + desc = list_entry(pdmac-desc_pool.next,
 + struct dma_pl330_desc, node);
 + list_del(desc-node);
 + kfree(desc);
 + }
 +
   pi = pdmac-pif;

   pl330_del(pi);


 --
 Vinod Koul
 Intel Corp.

Regards,
Inder
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] DMA: PL330: unregister dma_device in module's remove function

2012-10-25 Thread Inderpal Singh
On 24 October 2012 09:49, Vinod Koul vk...@infradead.org wrote:
 On Fri, 2012-10-05 at 15:47 +0530, Inderpal Singh wrote:
 unregister dma_device in module's remove function.

 Signed-off-by: Inderpal Singh inderpal.si...@linaro.org
 ---
  drivers/dma/pl330.c |2 ++
  1 file changed, 2 insertions(+)

 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
 index 4b7a34d..e7dc040 100644
 --- a/drivers/dma/pl330.c
 +++ b/drivers/dma/pl330.c
 @@ -3017,6 +3017,8 @@ static int __devexit pl330_remove(struct amba_device 
 *adev)
   return -EBUSY;
   }

 + dma_async_device_unregister(pdmac-ddma);
 +
   amba_set_drvdata(adev, NULL);

   list_for_each_entry_safe(pch, _p, pdmac-ddma.channels,

 Ok with this one :)

 Tried applying but didn't work out. You would need to regenerate this
 one.


I will regenerate this along with other patches and resend.

With Regards,
Inder

 Thanks
 --
 Vinod Koul
 Intel Corp.

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/4] DMA: PL330: Balance module remove function with probe

2012-10-25 Thread Inderpal Singh
Hi Vinod,

On 24 October 2012 09:44, Vinod Koul vk...@infradead.org wrote:
 On Fri, 2012-10-05 at 15:47 +0530, Inderpal Singh wrote:
 Since peripheral channel resources are not being allocated at probe,
 no need to flush the channels and free the resources in remove function.
 In case, the channel is in use by some client, return EBUSY.

 Signed-off-by: Inderpal Singh inderpal.si...@linaro.org
 ---
  drivers/dma/pl330.c |   13 -
  1 file changed, 8 insertions(+), 5 deletions(-)

 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
 index bf71ff7..4b7a34d 100644
 --- a/drivers/dma/pl330.c
 +++ b/drivers/dma/pl330.c
 @@ -3009,18 +3009,21 @@ static int __devexit pl330_remove(struct amba_device 
 *adev)
   if (!pdmac)
   return 0;

 + /* check if any client is using any channel */
 + list_for_each_entry(pch, pdmac-ddma.channels,
 + chan.device_node) {
 +
 + if (pch-chan.client_count)
 + return -EBUSY;
 + }
 +
   while (!list_empty(pdmac-desc_pool)) {

 Did you get this code executed?
 I think No.

 The dmaengine holds the reference to channels, so if they are in use and
 not freed by client your remove wont be called. So this check is
 redundant


This code will get executed only in case of force removal of the
module which was discussed in the first version of the patch at [1].
Now, if we do not have to think about force removal then this patch
will go back to the first version.

Let me know your view.

[1] https://patchwork.kernel.org/patch/1503171/

Regards,
Inder
 --
 Vinod Koul
 Intel Corp.

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v4 0/6] arm: exynos: add dt based support for exynos5 hdmi

2012-10-25 Thread Inki Dae


 -Original Message-
 From: Kukjin Kim [mailto:kgene@samsung.com]
 Sent: Tuesday, October 23, 2012 11:08 PM
 To: 'Rahul Sharma'; linux-samsung-soc@vger.kernel.org; devicetree-
 disc...@lists.ozlabs.org
 Cc: tomasz.f...@gmail.com; t.stanisl...@samsung.com;
 sw0312@samsung.com; inki@samsung.com; jy0922.s...@samsung.com;
 kyungmin.p...@samsung.com; thomas...@samsung.com; prashant...@samsung.com;
 jo...@samsung.com; s.shir...@samsung.com; r.sh.o...@gmail.com
 Subject: RE: [PATCH v4 0/6] arm: exynos: add dt based support for exynos5
 hdmi
 
 Rahul Sharma wrote:
 
  This patch set adds the DT based support for Samsung's Exynos5250. It
 adds
  device tree nodes for hdmi, mixer, hdmiphy and hdmiddc. The name of
 these
  devices are changed to the one matching with drivers. Exynos-drm and
  exynos
  hdmi-drm-commmon devices are removed from machine init code.
 
  Exynos-drm and exynos hdmi-drm-commmon devices are removed from machine
  init code. Patch set which adds this code is posted to dri-devel list at
  http://comments.gmane.org/gmane.comp.video.dri.devel/75121.
 
  This patchset is based on linux v3.6-rc6, branch v3.7-next/dt-samsung at
  git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
 
  v1:
  - dropped patch for hpd gpio initialisation from machine init.
  - dropped patch for platform device registration.
  - removed platform device registration from non-dt platforms.
 
  v2:
  - removed version information from hdmi, mixer dt nodes.
  - added DT binding documentation for hdmi, mixer, hdmiphy and hdmiddc.
 
  v3:
  - corrected indentations.
  - changed dt node names to name@address format.
 
  v4:
  - added newline at end of device-tree binding document files.
  - removes macros for mixer, hdmi physical addresses.
  - removed @address from mixer and hdmi DT nodes.
 
  Rahul Sharma (6):
dts: exynos: add device tree support for exynos5 hdmi
dts: exynos: add device tree support for exynos5 mixer
dts: exynos: add device tree support for exynos5 hdmiphy
dts: exynos: add device tree support for exynos5 hdmiddc
arm: exynos: add clocks for exynos5 hdmi
arm: exynos: removing exynos-drm device registration from non-dt
  platforms
 
   .../devicetree/bindings/drm/exynos/hdmi.txt|   22
+++
   .../devicetree/bindings/drm/exynos/hdmiddc.txt |   12 
   .../devicetree/bindings/drm/exynos/hdmiphy.txt |   12 
   .../devicetree/bindings/drm/exynos/mixer.txt   |   15 ++
   arch/arm/boot/dts/exynos5250-smdk5250.dts  |   24
 +++-
   arch/arm/boot/dts/exynos5250.dtsi  |   20 +
   arch/arm/mach-exynos/Makefile  |1 -
   arch/arm/mach-exynos/clock-exynos5.c   |   14 -
   arch/arm/mach-exynos/dev-drm.c |   29
 
   arch/arm/mach-exynos/mach-exynos5-dt.c |8 +
   arch/arm/mach-exynos/mach-nuri.c   |3 --
   arch/arm/mach-exynos/mach-origen.c |3 --
   arch/arm/mach-exynos/mach-smdk4x12.c   |3 --
   arch/arm/mach-exynos/mach-smdkv310.c   |3 --
   arch/arm/mach-exynos/mach-universal_c210.c |3 --
   arch/arm/plat-samsung/include/plat/devs.h  |2 -
   16 files changed, 124 insertions(+), 50 deletions(-)
   create mode 100644
 Documentation/devicetree/bindings/drm/exynos/hdmi.txt
   create mode 100644
  Documentation/devicetree/bindings/drm/exynos/hdmiddc.txt
   create mode 100644
  Documentation/devicetree/bindings/drm/exynos/hdmiphy.txt
   create mode 100644
 Documentation/devicetree/bindings/drm/exynos/mixer.txt
   delete mode 100644 arch/arm/mach-exynos/dev-drm.c
 
 Looks OK to me, will apply this whole series.
 
 Inki, if you want to need a topic branch for this series, please let me
 know. I will create it for you.
 

Please merge them. After that, we will. So no need any topic branch. We had
already been tested with the above patch set and worked fine.

Thanks,
Inki Dae

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

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: dw_mmc: enable controller interrupt before calling mmc_start_host

2012-10-25 Thread Chris Ball
Hi,

On Thu, Oct 25 2012, Yuvaraj CD wrote:
 Yes,its legal name.Yuvaraj C D.

Thanks for letting me know; pushed to mmc-next for 3.7.

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/5] ARM: EXYNOS: Enable PMUs for exynos4

2012-10-25 Thread Will Deacon
On Thu, Oct 25, 2012 at 02:41:46AM +0100, Chanho Park wrote:
  On Tue, Oct 23, 2012 at 10:34 PM, Chanho Park
  chanho61.p...@samsung.com wrote:
   This patch defines irq numbers of ARM performance monitoring unit for
  exynos4.
   Firs of all, we need to fix IRQ_PMU correctly and to split pmu
   initialization of exynos from plat-samsung for easily defining it.
  
   The number of CPU cores and PMU irq numbers are vary according to soc
  types.
   So, we need to identify each soc type using soc_is_xxx function and to
   define the pmu irqs dynamically. For example, the exynos4412 has 4 cpu
  cores and pmus.
  
  I wonder if it's worth doing this complexity on the non-DT case for exynos4?
  
  I wish there was more focus on the Samsung platforms for getting the DT
  support up to par with non-DT so you can avoid having to add new platform
  devices like these in the first place.
 
 The DT support of exynos4 is under development.

It seems to have been under development for a while now and changes like
this don't exactly encourage people to chip-in with that effort. Would it
not be better to spend time helping to complete the DT support instead of
retro-fitting static platform devices into the code?

 And many of exynos4 developers still use non-dt boot-up method.

That's not surprising if the DT code is still under development -- it's a
chicken-and-egg problem.

 By this time arm-pmu of exynos did not work. IMO we should fix and support it
 for non-dt users.

I agree that we definitely want to support the PMU on Exynos4, but I'm
tempted to postpone adding that code until DT support is available.

Will
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/6] ARM: EXYNOS: Add secure firmware support

2012-10-25 Thread Tomasz Figa
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

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/6] ARM: EXYNOS: Add support for secure monitor calls

2012-10-25 Thread Tomasz Figa
Some boards use secure monitor calls to communicate with secure
firmware.

This patch adds exynos_smc function which uses smc assembly instruction
to do secure monitor calls.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Tomasz Figa t.f...@samsung.com
---
 arch/arm/mach-exynos/Makefile |  5 +
 arch/arm/mach-exynos/exynos-smc.S | 22 ++
 arch/arm/mach-exynos/smc.h| 31 +++
 3 files changed, 58 insertions(+)
 create mode 100644 arch/arm/mach-exynos/exynos-smc.S
 create mode 100644 arch/arm/mach-exynos/smc.h

diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 9b58024..5c1de47 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -30,6 +30,11 @@ obj-$(CONFIG_EXYNOS4_MCT)+= mct.o
 
 obj-$(CONFIG_HOTPLUG_CPU)  += hotplug.o
 
+obj-$(CONFIG_ARCH_EXYNOS)  += exynos-smc.o
+
+plus_sec := $(call as-instr,.arch_extension sec,+sec)
+AFLAGS_exynos-smc.o:=-Wa,-march=armv7-a$(plus_sec)
+
 # machine support
 
 obj-$(CONFIG_MACH_SMDKC210)+= mach-smdkv310.o
diff --git a/arch/arm/mach-exynos/exynos-smc.S 
b/arch/arm/mach-exynos/exynos-smc.S
new file mode 100644
index 000..2e27aa3
--- /dev/null
+++ b/arch/arm/mach-exynos/exynos-smc.S
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics.
+ *
+ * Copied from omap-smc.S Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * 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 linux/linkage.h
+
+/*
+ * Function signature: void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3)
+ */
+
+ENTRY(exynos_smc)
+   stmfd   sp!, {r4-r11, lr}
+   dsb
+   smc #0
+   ldmfd   sp!, {r4-r11, pc}
+ENDPROC(exynos_smc)
diff --git a/arch/arm/mach-exynos/smc.h b/arch/arm/mach-exynos/smc.h
new file mode 100644
index 000..e972390
--- /dev/null
+++ b/arch/arm/mach-exynos/smc.h
@@ -0,0 +1,31 @@
+/*
+ *  Copyright (c) 2012 Samsung Electronics.
+ *
+ * EXYNOS - SMC Call
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_ARCH_EXYNOS_SMC_H
+#define __ASM_ARCH_EXYNOS_SMC_H
+
+#define SMC_CMD_INIT(-1)
+#define SMC_CMD_INFO(-2)
+/* For Power Management */
+#define SMC_CMD_SLEEP   (-3)
+#define SMC_CMD_CPU1BOOT(-4)
+#define SMC_CMD_CPU0AFTR(-5)
+/* For CP15 Access */
+#define SMC_CMD_C15RESUME   (-11)
+/* For L2 Cache Access */
+#define SMC_CMD_L2X0CTRL(-21)
+#define SMC_CMD_L2X0SETUP1  (-22)
+#define SMC_CMD_L2X0SETUP2  (-23)
+#define SMC_CMD_L2X0INVALL  (-24)
+#define SMC_CMD_L2X0DEBUG   (-25)
+
+extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3);
+
+#endif
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 3/6] ARM: EXYNOS: Add IO mapping for non-secure SYSRAM.

2012-10-25 Thread Tomasz Figa
On TrustZone-enabled boards the non-secure SYSRAM is used for secondary
CPU bring-up, so add a mapping for it.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Tomasz Figa t.f...@samsung.com
---
 arch/arm/mach-exynos/common.c| 35 
 arch/arm/mach-exynos/include/mach/map.h  |  3 +++
 arch/arm/plat-samsung/include/plat/map-s5p.h |  1 +
 3 files changed, 39 insertions(+)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 1947be8..cb891a7 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -215,6 +215,33 @@ static struct map_desc exynos4_iodesc1[] __initdata = {
},
 };
 
+static struct map_desc exynos4210_iodesc[] __initdata = {
+   {
+   .virtual= (unsigned long)S5P_VA_SYSRAM_NS,
+   .pfn= __phys_to_pfn(EXYNOS4210_PA_SYSRAM_NS),
+   .length = SZ_4K,
+   .type   = MT_DEVICE,
+   },
+};
+
+static struct map_desc exynos4x12_iodesc[] __initdata = {
+   {
+   .virtual= (unsigned long)S5P_VA_SYSRAM_NS,
+   .pfn= __phys_to_pfn(EXYNOS4x12_PA_SYSRAM_NS),
+   .length = SZ_4K,
+   .type   = MT_DEVICE,
+   },
+};
+
+static struct map_desc exynos5250_iodesc[] __initdata = {
+   {
+   .virtual= (unsigned long)S5P_VA_SYSRAM_NS,
+   .pfn= __phys_to_pfn(EXYNOS5250_PA_SYSRAM_NS),
+   .length = SZ_4K,
+   .type   = MT_DEVICE,
+   },
+};
+
 static struct map_desc exynos5_iodesc[] __initdata = {
{
.virtual= (unsigned long)S3C_VA_SYS,
@@ -322,6 +349,11 @@ static void __init exynos4_map_io(void)
else
iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1));
 
+   if (soc_is_exynos4210())
+   iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc));
+   if (soc_is_exynos4212() || soc_is_exynos4412())
+   iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc));
+
/* initialize device information early */
exynos4_default_sdhci0();
exynos4_default_sdhci1();
@@ -355,6 +387,9 @@ static void __init exynos5_map_io(void)
 {
iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
 
+   if (soc_is_exynos5250())
+   iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
+
s3c_device_i2c0.resource[0].start = EXYNOS5_PA_IIC(0);
s3c_device_i2c0.resource[0].end   = EXYNOS5_PA_IIC(0) + SZ_4K - 1;
s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 8480849..42f 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -26,6 +26,9 @@
 #define EXYNOS4_PA_SYSRAM0 0x02025000
 #define EXYNOS4_PA_SYSRAM1 0x0202
 #define EXYNOS5_PA_SYSRAM  0x0202
+#define EXYNOS4210_PA_SYSRAM_NS0x0203F000
+#define EXYNOS4x12_PA_SYSRAM_NS0x0204F000
+#define EXYNOS5250_PA_SYSRAM_NS0x0204F000
 
 #define EXYNOS4_PA_FIMC0   0x1180
 #define EXYNOS4_PA_FIMC1   0x1181
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h 
b/arch/arm/plat-samsung/include/plat/map-s5p.h
index c2d7bda..c186786 100644
--- a/arch/arm/plat-samsung/include/plat/map-s5p.h
+++ b/arch/arm/plat-samsung/include/plat/map-s5p.h
@@ -22,6 +22,7 @@
 #define S5P_VA_GPIO3   S3C_ADDR(0x0228)
 
 #define S5P_VA_SYSRAM  S3C_ADDR(0x0240)
+#define S5P_VA_SYSRAM_NS   S3C_ADDR(0x0241)
 #define S5P_VA_DMC0S3C_ADDR(0x0244)
 #define S5P_VA_DMC1S3C_ADDR(0x0248)
 #define S5P_VA_SROMC   S3C_ADDR(0x024C)
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 4/6] ARM: EXYNOS: Add support for Exynos secure firmware

2012-10-25 Thread Tomasz Figa
Some Exynos-based boards contain secure firmware and must use firmware
operations to set up some hardware.

This patch adds firmware operations for Exynos secure firmware and a way
for board code and device tree to specify that they must be used.

Example of use:

In board code:

...MACHINE_START(...)
/* ... */
.init_early = exynos_firmware_init,
/* ... */
MACHINE_END

In device tree:

/ {
/* ... */

firmware@0203F000 {
compatible = samsung,secure-firmware;
reg = 0x0203F000 0x1000;
};

/* ... */
};

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Tomasz Figa t.f...@samsung.com
---
 .../devicetree/bindings/arm/samsung-boards.txt | 10 
 arch/arm/mach-exynos/Makefile  |  1 +
 arch/arm/mach-exynos/common.h  |  2 +
 arch/arm/mach-exynos/firmware.c| 67 ++
 arch/arm/mach-exynos/mach-exynos4-dt.c |  1 +
 5 files changed, 81 insertions(+)
 create mode 100644 arch/arm/mach-exynos/firmware.c

diff --git a/Documentation/devicetree/bindings/arm/samsung-boards.txt 
b/Documentation/devicetree/bindings/arm/samsung-boards.txt
index 0bf68be..2168ed3 100644
--- a/Documentation/devicetree/bindings/arm/samsung-boards.txt
+++ b/Documentation/devicetree/bindings/arm/samsung-boards.txt
@@ -6,3 +6,13 @@ Required root node properties:
 - compatible = should be one or more of the following.
 (a) samsung,smdkv310 - for Samsung's SMDKV310 eval board.
 (b) samsung,exynos4210  - for boards based on Exynos4210 SoC.
+
+Optional:
+- firmware node, specifying presence and type of secure firmware:
+- compatible: only samsung,secure-firmware is currently supported
+- reg: address of non-secure SYSRAM used for communication with 
firmware
+
+   firmware@0203F000 {
+   compatible = samsung,secure-firmware;
+   reg = 0x0203F000 0x1000;
+   };
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 5c1de47..b464333 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_EXYNOS4_MCT) += mct.o
 obj-$(CONFIG_HOTPLUG_CPU)  += hotplug.o
 
 obj-$(CONFIG_ARCH_EXYNOS)  += exynos-smc.o
+obj-$(CONFIG_ARCH_EXYNOS)  += firmware.o
 
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_exynos-smc.o:=-Wa,-march=armv7-a$(plus_sec)
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index dac146d..5f1d393 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -22,6 +22,8 @@ void exynos4_restart(char mode, const char *cmd);
 void exynos5_restart(char mode, const char *cmd);
 void exynos_init_late(void);
 
+void exynos_firmware_init(void);
+
 #ifdef CONFIG_PM_GENERIC_DOMAINS
 int exynos_pm_late_initcall(void);
 #else
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
new file mode 100644
index 000..15d3c87
--- /dev/null
+++ b/arch/arm/mach-exynos/firmware.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics.
+ * Kyungmin Park kyungmin.p...@samsung.com
+ * Tomasz Figa t.f...@samsung.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 linux/kernel.h
+#include linux/init.h
+#include linux/of.h
+#include linux/of_address.h
+
+#include asm/firmware.h
+
+#include mach/map.h
+
+#include smc.h
+
+static int exynos_do_idle(void)
+{
+exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
+return 0;
+}
+
+static int exynos_cpu_boot(int cpu)
+{
+   exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
+   return 0;
+}
+
+static int exynos_cpu_boot_reg(int cpu, void __iomem **ptr)
+{
+   *ptr = S5P_VA_SYSRAM_NS + 0x1c + 4*cpu;
+   return 0;
+}
+
+static const struct firmware_ops exynos_firmware_ops = {
+   .do_idle= exynos_do_idle,
+   .cpu_boot   = exynos_cpu_boot,
+   .cpu_boot_reg   = exynos_cpu_boot_reg,
+};
+
+void __init exynos_firmware_init(void)
+{
+   if (of_have_populated_dt()) {
+   struct device_node *nd;
+   const __be32 *addr;
+
+   nd = of_find_compatible_node(NULL, NULL,
+   samsung,secure-firmware);
+   if (!nd)
+   return;
+
+   addr = of_get_address(nd, 0, NULL, NULL);
+   if (!addr) {
+   pr_err(%s: No address specified.\n, __func__);
+   return;
+   }
+   }
+
+   pr_info(Running under secure firmware.\n);
+
+   register_firmware_ops(exynos_firmware_ops);
+}
diff --git 

[PATCH v3 5/6] ARM: EXYNOS: Add support for secondary CPU bring-up on Exynos4412

2012-10-25 Thread Tomasz Figa
Exynos4412 uses different information register for each core. This patch
adjusts the bring-up code to take that into account.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Tomasz Figa t.f...@samsung.com
---
 arch/arm/mach-exynos/platsmp.c | 30 --
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index f93d820..4ca8ff1 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -36,8 +36,22 @@
 
 extern void exynos4_secondary_startup(void);
 
-#define CPU1_BOOT_REG  (samsung_rev() == EXYNOS4210_REV_1_1 ? \
-   S5P_INFORM5 : S5P_VA_SYSRAM)
+static inline void __iomem *cpu_boot_reg_base(void)
+{
+   if (soc_is_exynos4210()  samsung_rev() == EXYNOS4210_REV_1_1)
+   return S5P_INFORM5;
+   return S5P_VA_SYSRAM;
+}
+
+static inline void __iomem *cpu_boot_reg(int cpu)
+{
+   void __iomem *boot_reg;
+
+   boot_reg = cpu_boot_reg_base();
+   if (soc_is_exynos4412())
+   boot_reg += 4*cpu;
+   return boot_reg;
+}
 
 /*
  * Write pen_release in a way that is guaranteed to be visible to all
@@ -84,6 +98,7 @@ static void __cpuinit exynos_secondary_init(unsigned int cpu)
 static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct 
task_struct *idle)
 {
unsigned long timeout;
+   unsigned long phys_cpu = cpu_logical_map(cpu);
 
/*
 * Set synchronisation state between this boot processor
@@ -99,7 +114,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, 
struct task_struct
 * Note that pen_release is the hardware CPU ID, whereas
 * cpu is Linux's internal ID.
 */
-   write_pen_release(cpu_logical_map(cpu));
+   write_pen_release(phys_cpu);
 
if (!(__raw_readl(S5P_ARM_CORE1_STATUS)  S5P_CORE_LOCAL_PWR_EN)) {
__raw_writel(S5P_CORE_LOCAL_PWR_EN,
@@ -133,7 +148,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int 
cpu, struct task_struct
smp_rmb();
 
__raw_writel(virt_to_phys(exynos4_secondary_startup),
-   CPU1_BOOT_REG);
+   cpu_boot_reg(phys_cpu));
gic_raise_softirq(cpumask_of(cpu), 0);
 
if (pen_release == -1)
@@ -181,6 +196,8 @@ static void __init exynos_smp_init_cpus(void)
 
 static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
 {
+   int i;
+
if (!soc_is_exynos5250())
scu_enable(scu_base_addr());
 
@@ -190,8 +207,9 @@ static void __init exynos_smp_prepare_cpus(unsigned int 
max_cpus)
 * until it receives a soft interrupt, and then the
 * secondary CPU branches to this address.
 */
-   __raw_writel(virt_to_phys(exynos4_secondary_startup),
-   CPU1_BOOT_REG);
+   for (i = 1; i  max_cpus; ++i)
+   __raw_writel(virt_to_phys(exynos4_secondary_startup),
+   cpu_boot_reg(cpu_logical_map(i)));
 }
 
 struct smp_operations exynos_smp_ops __initdata = {
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 6/6] ARM: EXYNOS: Add secure firmware support to secondary CPU bring-up

2012-10-25 Thread Tomasz Figa
Boards using secure firmware must use different CPU boot registers and
call secure firmware to boot the CPU.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Tomasz Figa t.f...@samsung.com
---
 arch/arm/mach-exynos/platsmp.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 4ca8ff1..9f8bdaf 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -25,6 +25,7 @@
 #include asm/hardware/gic.h
 #include asm/smp_plat.h
 #include asm/smp_scu.h
+#include asm/firmware.h
 
 #include mach/hardware.h
 #include mach/regs-clock.h
@@ -47,6 +48,8 @@ static inline void __iomem *cpu_boot_reg(int cpu)
 {
void __iomem *boot_reg;
 
+   if (!call_firmware_op(cpu_boot_reg, cpu, boot_reg))
+   return boot_reg;
boot_reg = cpu_boot_reg_base();
if (soc_is_exynos4412())
boot_reg += 4*cpu;
@@ -149,6 +152,10 @@ static int __cpuinit exynos_boot_secondary(unsigned int 
cpu, struct task_struct
 
__raw_writel(virt_to_phys(exynos4_secondary_startup),
cpu_boot_reg(phys_cpu));
+
+   /* Call Exynos specific smc call */
+   call_firmware_op(cpu_boot, phys_cpu);
+
gic_raise_softirq(cpumask_of(cpu), 0);
 
if (pen_release == -1)
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] S3C24XX: add clockevent/clocksource support

2012-10-25 Thread Tomasz Figa
Hi Romain,

On Wednesday 24 of October 2012 22:56:40 Romain Naour wrote:
 Hi,
 
 This patch converts the s3c24xx timer driver to the
 clocksource/clockevent API. I made some test on a mini2440 board and I
 had to reduce timers frequency to 1MHz in order to produce a timer's
 overflow every 64ms. Initial timer's frequency (8,45MHz) provide only
 7ms between each overflow. It is not enough. As timers were previously
 used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use
 an external 12MHz signal to clock the timers (tclk1). So, I changed
 their configuration to select internal pclk clock instead, but I can't
 test it. Also, I created a new file (s3c24xx_time.c) to avoid impacting
 the s3c64xx. Kernel rev v3.7-rc1
 
 Do you have any comments on this patch ?

Generally looks fine, but I have some doubts:

- Isn't 64ms still way too little for overflow period? Someone who is more 
into Linux time keeping should comment on this.

- Much of the code is duplicated from s5p-time, maybe s5p-time could be 
made a generic samsung-time instead? It could be also used for S3C64xx.

CC'ing Heiko and Sylwester, as they might find this patch interesting.

Best regards,
Tomasz Figa

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v5 3/5] ARM: EXYNOS: Enable PMUs for exynos4

2012-10-25 Thread Chanho Park
 -Original Message-
 From: Will Deacon [mailto:will.dea...@arm.com]
 Sent: Thursday, October 25, 2012 11:41 PM
 To: Chanho Park
 Cc: 'Olof Johansson'; kgene@samsung.com; linux-samsung-
 s...@vger.kernel.org; linux-arm-ker...@lists.infradead.org;
 li...@arm.linux.org.uk; ben-li...@fluff.org; kyungmin.p...@samsung.com;
 sachin.ka...@linaro.org; thomas.abra...@linaro.org
 Subject: Re: [PATCH v5 3/5] ARM: EXYNOS: Enable PMUs for exynos4
 
 On Thu, Oct 25, 2012 at 02:41:46AM +0100, Chanho Park wrote:
   On Tue, Oct 23, 2012 at 10:34 PM, Chanho Park
   chanho61.p...@samsung.com wrote:
This patch defines irq numbers of ARM performance monitoring unit
for
   exynos4.
Firs of all, we need to fix IRQ_PMU correctly and to split pmu
initialization of exynos from plat-samsung for easily defining it.
   
The number of CPU cores and PMU irq numbers are vary according to
soc
   types.
So, we need to identify each soc type using soc_is_xxx function
and to define the pmu irqs dynamically. For example, the
exynos4412 has 4 cpu
   cores and pmus.
  
   I wonder if it's worth doing this complexity on the non-DT case for
 exynos4?
  
   I wish there was more focus on the Samsung platforms for getting the
   DT support up to par with non-DT so you can avoid having to add new
   platform devices like these in the first place.
 
  The DT support of exynos4 is under development.
 
 It seems to have been under development for a while now and changes like
 this don't exactly encourage people to chip-in with that effort. Would it not
 be better to spend time helping to complete the DT support instead of retro-
 fitting static platform devices into the code?

The purposes of this patchset are two things.
The first thing is that fixing incorrect interrupt definition of the exynos4.
We already have arm-pmu platform device for s3c and s5p Samsung platforms.
However, it did not work in case of exynos series platform. I separate it from
plat-samsung code to support easily for exynos platforms. Please see that
the purpose of added platform device is fixing and supporting arm-pmu without
difficulty.
The next one is arm-pmu DT support for exynos4 and 5. You can see it in this
patchset(4 and 5).

 
  And many of exynos4 developers still use non-dt boot-up method.
 
 That's not surprising if the DT code is still under development -- it's a 
 chicken-
 and-egg problem.
 
  By this time arm-pmu of exynos did not work. IMO we should fix and
  support it for non-dt users.
 
 I agree that we definitely want to support the PMU on Exynos4, but I'm
 tempted to postpone adding that code until DT support is available.

I already included DT support for exynos4(except exynos4412) in this patchset.
(Please see the [PATCH v5 5/5] ARM: EXYNOS: Add arm-pmu DT binding for 
exynos421x)

Best regards,
Chanho Park

 
 Will

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html