Re: [PATCH] drivers: genpd: let platform code to register devices into disabled domains

2012-05-11 Thread Rafael J. Wysocki
On Thursday, May 10, 2012, Rafael J. Wysocki wrote:
> On Thursday, May 10, 2012, Marek Szyprowski wrote:
> > Hi Rafael,
> > 
> > On Monday, May 07, 2012 8:45 PM Rafael J. Wysocki wrote:
> > 
> > > On Monday, May 07, 2012, Marek Szyprowski wrote:
> > > > Hi Rafael,
> > > >
> > > > I'm sorry for a late reply, I was on holidays last week and just got 
> > > > back to
> > > > the office.
> > > >
> > > > On Sunday, April 29, 2012 10:55 PM Rafael J. Wysocki wrote:
> > > >
> > > > > On Friday, April 06, 2012, Marek Szyprowski wrote:
> > > > > > Some bootloaders disable power domains on boot and the platform 
> > > > > > startup
> > > > > > code registers them in the 'disabled' state. Current gen_pd code 
> > > > > > assumed
> > > > > > that the devices can be registered only to the power domain which 
> > > > > > is in
> > > > > > 'enabled' state and these devices are active at the time of the
> > > > > > registration. This is not correct in our case. This patch lets 
> > > > > > drivers
> > > > > > to be registered into 'disabled' power domains and finally solves
> > > > > > mysterious freezes and lack of resume/suspend calls on Samsung 
> > > > > > Exynos4
> > > > > > NURI and UniversalC210 platforms.
> > > > > >
> > > > > > Signed-off-by: Marek Szyprowski 
> > > > > > Signed-off-by: Kyungmin Park 
> > > > > > ---
> > > > > >  drivers/base/power/domain.c |7 +--
> > > > > >  1 files changed, 1 insertions(+), 6 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/base/power/domain.c 
> > > > > > b/drivers/base/power/domain.c
> > > > > > index 73ce9fb..05f5799f 100644
> > > > > > --- a/drivers/base/power/domain.c
> > > > > > +++ b/drivers/base/power/domain.c
> > > > > > @@ -1211,11 +1211,6 @@ int __pm_genpd_add_device(struct 
> > > > > > generic_pm_domain *genpd, struct
> > > > > device *dev,
> > > > > >
> > > > > > genpd_acquire_lock(genpd);
> > > > > >
> > > > > > -   if (genpd->status == GPD_STATE_POWER_OFF) {
> > > > > > -   ret = -EINVAL;
> > > > > > -   goto out;
> > > > > > -   }
> > > > > > -
> > > > > > if (genpd->prepared_count > 0) {
> > > > > > ret = -EAGAIN;
> > > > > > goto out;
> > > > > > @@ -1239,7 +1234,7 @@ int __pm_genpd_add_device(struct 
> > > > > > generic_pm_domain *genpd, struct
> > > > > device *dev,
> > > > > > dev_pm_get_subsys_data(dev);
> > > > > > dev->power.subsys_data->domain_data = &gpd_data->base;
> > > > > > gpd_data->base.dev = dev;
> > > > > > -   gpd_data->need_restore = false;
> > > > > > +   gpd_data->need_restore = true;
> > > > >
> > > > > I think that should be:
> > > > >
> > > > > + gpd_data->need_restore = genpd->status == GPD_STATE_POWER_OFF;
> > > > >
> > > > > Otherwise, on the next domain power off the device's state won't be 
> > > > > saved.
> > > > >
> > > > > > list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
> > > > > > if (td)
> > > > > > gpd_data->td = *td;
> > > >
> > > > I've tested the above change and there is problem. Let me explain in 
> > > > detail the
> > > > sw/hw configuration I have.
> > > >
> > > > There is a power domain and the device driver. The device itself also 
> > > > has it's own
> > > > power management code (which enables and disables clocks).  Some power 
> > > > domains are
> > > > disabled by bootloader and some devices in the active power domains 
> > > > have their
> > > > clocks disabled too. In the current runtime pm code the devices were 
> > > > probed in
> > > > 'disabled' state and had to enable itself by calling 
> > > > get_runtime_sync(). My initial
> > > > patch restored runtime pm handling to the old state (the same which was 
> > > > with non
> > > > gen_pd based driver or no power domain driver at all, where runtime pm 
> > > > was handled
> > > > by platform bus). If I apply your patch the runtime_restore
> > > 
> > > I guess you mean .runtime_resume().
> > > 
> > > > callback is not called on first driver probe for devices inside the 
> > > > domain which
> > > > has been left enabled by the bootloader.
> > > 
> > > I don't see why .probe() should depend on the runtime PM framework to call
> > > .runtime_resume() for it.  It looks like .probe() could just call
> > > .runtime_resume() directly if needed.
> > > 
> > > Besides, your change breaks existing code as I said.
> > 
> > Before using gen_pd power domains we had the following flow of 
> > calls/controls:
> > 
> > 1. fimc_probe(fimd_pdev)
> > ...
> > 2. pm_runtime_enable(fimd_pdev->dev)
> > 3. pm_runtime_get_sync(fimd_pdev->dev)
> > 3a. parent device's runtime_resume()
> > 3b. fimc_runtime_resume(fimd_pdev->dev)
> > ...
> > 4. pm_runtime_put(fimd_pdev->dev)
> > ...
> > 5. (runtime put timer kicks off)
> > 5a. fimc_runtime_put(fimd_pdev->dev)
> > 5b. parent device's runtime_suspend()
> > 
> > (this flow assumed that fimc device was the only child of its parent 
> > platform device).
> > 
> > Now with power gen_pd driver with my patch I get 

Re: [PATCH 1/2] iommu/exynos: fix runtime pm support

2012-05-11 Thread Kukjin Kim

On 04/11/12 23:34, Marek Szyprowski wrote:

Fix registration to runtime pw and add missing resume callback.

Signed-off-by: Marek Szyprowski
Acked-by: Kyungmin Park
---
  drivers/iommu/exynos-iommu.c |   20 ++--
  1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index b8daf7c..eef924d 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -651,8 +651,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)

__set_fault_handler(data,&default_fault_handler);

-   if (dev->parent)
-   pm_runtime_enable(dev);
+   pm_runtime_enable(dev);

dev_dbg(dev, "(%s) Initialized\n", data->dbgname);
return 0;
@@ -674,11 +673,28 @@ err_alloc:
return ret;
  }

+static int exynos_pm_resume(struct device *dev)
+{
+   struct sysmmu_drvdata *data;
+
+   data = dev_get_drvdata(dev);
+
+   if (is_sysmmu_active(data))
+   __exynos_sysmmu_enable(data, data->pgtable, NULL);
+
+   return 0;
+}
+
+const struct dev_pm_ops exynos_pm_ops = {
+   .resume =&exynos_pm_resume,
+};
+
  static struct platform_driver exynos_sysmmu_driver = {
.probe  = exynos_sysmmu_probe,
.driver = {
.owner  = THIS_MODULE,
.name   = "exynos-sysmmu",
+   .pm =&exynos_pm_ops,
}
  };



Joerg,

This patch is needed to correct run-time pm for EXYNOS SoCs with System 
MMU after KyongHo's iommu/exynos patch. So if you're ok on this, let me 
apply this in samsung tree.


Thanks.

Best regards,
Kgene.
--
Kukjin Kim , 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] iommu/exynos: Add iommu driver for Exynos Platforms

2012-05-11 Thread Kukjin Kim

On 05/11/12 21:43, Joerg Roedel wrote:

On Fri, May 11, 2012 at 09:27:09PM +0900, KyongHo wrote:

This is the System MMU driver and IOMMU API implementation for Exynos SOC
platforms. Exynos platforms has more than 10 System MMUs dedicated for each
multimedia accelerators.

The System MMU driver is already in arc/arm/plat-s5p but it is moved to
drivers/iommu due to Ohad Ben-Cohen gathered IOMMU drivers there

Any device driver in Exynos platforms that needs to control its System MMU must
call platform_set_sysmmu() to inform System MMU driver who will control it.
platform_set_sysmmu() is defined in

To compile this patch,
you will need "for-next" branch of the linux-samsung.git:
git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
Other patches needed by this patch are merged to the above branch.

Cc: Joerg Roedel
Cc: Kukjin Kim
Signed-off-by: KyongHo Cho


Looks good.

Acked-by: Joerg Roedel

Please get this merged via the Samsung tree. Since the patch depends on
that tree anyway it makes the most sense to be there.


Joerg,
OK, I applied with your ack.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim , 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] iommu/exynos: Add iommu driver for Exynos Platforms

2012-05-11 Thread Joerg Roedel
On Fri, May 11, 2012 at 09:27:09PM +0900, KyongHo wrote:
> This is the System MMU driver and IOMMU API implementation for Exynos SOC
> platforms. Exynos platforms has more than 10 System MMUs dedicated for each
> multimedia accelerators.
> 
> The System MMU driver is already in arc/arm/plat-s5p but it is moved to
> drivers/iommu due to Ohad Ben-Cohen gathered IOMMU drivers there
> 
> Any device driver in Exynos platforms that needs to control its System MMU 
> must
> call platform_set_sysmmu() to inform System MMU driver who will control it.
> platform_set_sysmmu() is defined in 
> 
> To compile this patch,
> you will need "for-next" branch of the linux-samsung.git:
> git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
> Other patches needed by this patch are merged to the above branch.
> 
> Cc: Joerg Roedel 
> Cc: Kukjin Kim 
> Signed-off-by: KyongHo Cho 

Looks good.

Acked-by: Joerg Roedel 

Please get this merged via the Samsung tree. Since the patch depends on
that tree anyway it makes the most sense to be there.

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

--
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] iommu/exynos: Add iommu driver for Exynos Platforms

2012-05-11 Thread KyongHo
This is the System MMU driver and IOMMU API implementation for Exynos SOC
platforms. Exynos platforms has more than 10 System MMUs dedicated for each
multimedia accelerators.

The System MMU driver is already in arc/arm/plat-s5p but it is moved to
drivers/iommu due to Ohad Ben-Cohen gathered IOMMU drivers there

Any device driver in Exynos platforms that needs to control its System MMU must
call platform_set_sysmmu() to inform System MMU driver who will control it.
platform_set_sysmmu() is defined in 

To compile this patch,
you will need "for-next" branch of the linux-samsung.git:
git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
Other patches needed by this patch are merged to the above branch.

Cc: Joerg Roedel 
Cc: Kukjin Kim 
Signed-off-by: KyongHo Cho 
---
 drivers/iommu/Kconfig|   21 +
 drivers/iommu/Makefile   |1 +
 drivers/iommu/exynos-iommu.c | 1076 ++
 3 files changed, 1098 insertions(+), 0 deletions(-)
 create mode 100644 drivers/iommu/exynos-iommu.c

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 3bd9fff..23db792 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -162,4 +162,25 @@ config TEGRA_IOMMU_SMMU
  space through the SMMU (System Memory Management Unit)
  hardware included on Tegra SoCs.
 
+config EXYNOS_IOMMU
+   bool "Exynos IOMMU Support"
+   depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
+   select IOMMU_API
+   help
+ Support for the IOMMU(System MMU) of Samsung Exynos application
+ processor family. This enables H/W multimedia accellerators to see
+ non-linear physical memory chunks as a linear memory in their
+ address spaces
+
+ If unsure, say N here.
+
+config EXYNOS_IOMMU_DEBUG
+   bool "Debugging log for Exynos IOMMU"
+   depends on EXYNOS_IOMMU
+   help
+ Select this to see the detailed log message that shows what
+ happens in the IOMMU driver
+
+ Say N unless you need kernel log message for IOMMU debugging
+
 endif # IOMMU_SUPPORT
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile
index 7ad7a3b..d06dec6 100644
--- a/drivers/iommu/Makefile
+++ b/drivers/iommu/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_OMAP_IOVMM) += omap-iovmm.o
 obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o
 obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o
 obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o
+obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
new file mode 100644
index 000..9a114b9
--- /dev/null
+++ b/drivers/iommu/exynos-iommu.c
@@ -0,0 +1,1076 @@
+/* linux/drivers/iommu/exynos_iommu.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.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.
+ */
+
+#ifdef CONFIG_EXYNOS_IOMMU_DEBUG
+#define DEBUG
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+/* We does not consider super section mapping (16MB) */
+#define SECT_ORDER 20
+#define LPAGE_ORDER 16
+#define SPAGE_ORDER 12
+
+#define SECT_SIZE (1 << SECT_ORDER)
+#define LPAGE_SIZE (1 << LPAGE_ORDER)
+#define SPAGE_SIZE (1 << SPAGE_ORDER)
+
+#define SECT_MASK (~(SECT_SIZE - 1))
+#define LPAGE_MASK (~(LPAGE_SIZE - 1))
+#define SPAGE_MASK (~(SPAGE_SIZE - 1))
+
+#define lv1ent_fault(sent) (((*(sent) & 3) == 0) || ((*(sent) & 3) == 3))
+#define lv1ent_page(sent) ((*(sent) & 3) == 1)
+#define lv1ent_section(sent) ((*(sent) & 3) == 2)
+
+#define lv2ent_fault(pent) ((*(pent) & 3) == 0)
+#define lv2ent_small(pent) ((*(pent) & 2) == 2)
+#define lv2ent_large(pent) ((*(pent) & 3) == 1)
+
+#define section_phys(sent) (*(sent) & SECT_MASK)
+#define section_offs(iova) ((iova) & 0xF)
+#define lpage_phys(pent) (*(pent) & LPAGE_MASK)
+#define lpage_offs(iova) ((iova) & 0x)
+#define spage_phys(pent) (*(pent) & SPAGE_MASK)
+#define spage_offs(iova) ((iova) & 0xFFF)
+
+#define lv1ent_offset(iova) ((iova) >> SECT_ORDER)
+#define lv2ent_offset(iova) (((iova) & 0xFF000) >> SPAGE_ORDER)
+
+#define NUM_LV1ENTRIES 4096
+#define NUM_LV2ENTRIES 256
+
+#define LV2TABLE_SIZE (NUM_LV2ENTRIES * sizeof(long))
+
+#define SPAGES_PER_LPAGE (LPAGE_SIZE / SPAGE_SIZE)
+
+#define lv2table_base(sent) (*(sent) & 0xFC00)
+
+#define mk_lv1ent_sect(pa) ((pa) | 2)
+#define mk_lv1ent_page(pa) ((pa) | 1)
+#define mk_lv2ent_lpage(pa) ((pa) | 1)
+#define mk_lv2ent_spage(pa) ((pa) | 2)
+
+#define CTRL_ENABLE0x5
+#define CTRL_BLOCK 0x7
+#define CTRL_DISABLE   0x0
+
+#define REG_MMU_CTRL   0x000
+#define REG_MMU_CFG0x004
+#define REG_MMU_STATUS 0x008
+#define REG_MMU_FLUSH  0x00C
+#define REG

Re: [PATCH] mtd: m25p80: Add support for Winbond W25Q80BW

2012-05-11 Thread Artem Bityutskiy
On Wed, 2012-05-09 at 04:04 +0530, Thomas Abraham wrote:
> Winbond W25Q80BW is a 8Mbit serial flash memory device.
> 
> Signed-off-by: Thomas Abraham 

Pushed to l2-mtd.git, thanks!

-- 
Best Regards,
Artem Bityutskiy


signature.asc
Description: This is a digitally signed message part


RE: [PATCH] ARM: SAMSUNG: Fix for S3C2412 EBI memory mapping.

2012-05-11 Thread Kukjin Kim
José Miguel Gonçalves wrote:
> 
> On 10-05-2012 10:25, Kukjin Kim wrote:
> > José Miguel Gonçalves wrote:
> >> While upgrading the kernel on a S3C2412 based board I've noted that it
> was
> >> impossible to boot the board with a 2.6.32 or upper kernel.
> >> I've tracked down the problem to the EBI virtual memory mapping that is
> in
> >> conflict with the IO mapping definition in arch/arm/mach-
> s3c24xx/s3c2412.c.
> >>
> >> Signed-off-by: José Miguel Gonçalves
> >> ---
> >>   arch/arm/plat-samsung/include/plat/map-s3c.h |2 +-
> >>   1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/arch/arm/plat-samsung/include/plat/map-s3c.h
> b/arch/arm/plat-
> >> samsung/include/plat/map-s3c.h
> >> index 7d04875..c0c70a8 100644
> >> --- a/arch/arm/plat-samsung/include/plat/map-s3c.h
> >> +++ b/arch/arm/plat-samsung/include/plat/map-s3c.h
> >> @@ -22,7 +22,7 @@
> >>   #define S3C24XX_VA_WATCHDOG  S3C_VA_WATCHDOG
> >>
> >>   #define S3C2412_VA_SSMC  S3C_ADDR_CPU(0x)
> >> -#define S3C2412_VA_EBIS3C_ADDR_CPU(0x0001)
> >> +#define S3C2412_VA_EBIS3C_ADDR_CPU(0x0010)
> >>
> >>   #define S3C2410_PA_UART  (0x5000)
> >>   #define S3C24XX_PA_UART  S3C2410_PA_UART
> >> --
> >> 1.7.5.4
> > Yeah, as you said, the mapping for SSMC invade EBI area but I think,
> just SZ_4K is enough for SSMC. So following is better in this case. How do
> you think? And there is no problem on your board?
> >
> > diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-
> s3c24xx/s3c2412.c
> > index d4bc7f9..ac906bf 100644
> > --- a/arch/arm/mach-s3c24xx/s3c2412.c
> > +++ b/arch/arm/mach-s3c24xx/s3c2412.c
> > @@ -72,7 +72,7 @@ static struct map_desc s3c2412_iodesc[] __initdata = {
> > {
> > .virtual = (unsigned long)S3C2412_VA_SSMC,
> > .pfn = __phys_to_pfn(S3C2412_PA_SSMC),
> > -   .length  = SZ_1M,
> > +   .length  = SZ_4K,
> > .type= MT_DEVICE,
> > },
> > {
> >
> 
> It does not work! I tried also a 64K length and also did not work. With
> your patch
> my console (with earlyprintk set) only displays the following:
> 
> ## Booting image at 3080 ...
> Image Name:   Linux-3.2.16-inov1
> Created:  2012-05-10  12:42:49 UTC
> Image Type:   ARM Linux Kernel Image (uncompressed)
> Data Size:1202592 Bytes =  1.1 MB
> Load Address: 30008000
> Entry Point:  30008000
> Verifying Checksum ... OK
> OK
> 
> Starting kernel ...
> 
> Uncompressing Linux... done, booting the kernel.
> Linux version 3.2.16-inov1 (jmpg@st-ze) (gcc version 4.6.4 20120402
> (prerelease)
> (crosstool-NG 1.15.2) ) #3 PREEMPT Thu May 10 13:42:48 WEST 2012
> CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
> CPU: VIVT data cache, VIVT instruction cache
> Machine: SMDK2412
> bootconsole [earlycon0] enabled
> Memory policy: ECC disabled, Data cache writeback
> CPU S3C2412 (id 0x32412003)
> 
> My guess is that the MMU initialization on the S3C2412 chip only allows a
> minimum
> of 1MB for the page size.
> 
Hmm, could be... there is no smdk2412 on my desk :(

OK, will apply your fix.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim , 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: [PATCHv2 0/3] Add support for DRM display subsystem

2012-05-11 Thread Kukjin Kim
OK, I thought again and talked to some guys. It's okay to add updated to the
non-dt board files on exynos4 for now. I know, until there is dt coverage
for more drivers, actually it will be difficult to build/support a complete
system with only dt support.

Note, we need to keep adding more and more support for dt for exynos4 and
exynos5. Then only we can stop the development of non-dt board files.

Thanks for many opinions about this and if any objections, feel free to
contact me.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim , 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