Re: [RFC 17/17] clk: zynq: remove call to of_clk_init

2013-08-26 Thread Sebastian Hesselbarth

On 08/26/13 14:07, Steffen Trumtrar wrote:

On Mon, Aug 26, 2013 at 01:15:11PM +0200, Michal Simek wrote:

I agree with Soren - let's fix the current problem and then when Steffen has 
patches with syscon
we can look at them.

If there is any discussion about early syscon registration please let me know.



Where I'm stuck at the moment is: if I map the whole register space to the
parent node, how do I get its mapped address in the clkc?


Steffen,

if slcr is such an essential part of the SoC, you can choose to provide
zynq_slcr_readl/writel callbacks. You can then use those callback in the
clock driver without knowing the base address. Also, it allows you to
hide slcr specific locking details from subsequent drivers using the
callbacks.


AFAIK the phandle is pretty useless in this early stage. In the pinmuxing
case I should be able to find the registered driver for the lock via the
phandle.


About the slcr phandle, yes, it is useless. IMHO phandles should only
be used if the referenced node is not known in advance, e.g. for gpios
or clocks. As you will always reference slcr node (and only that node)
you can just use of_find_compatible_node instead. But with the callbacks
above, you will solve it without exploiting DT but common non-static
functions instead.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 0/5] ARM: Initial support for Marvell Armada 1500

2013-08-27 Thread Sebastian Hesselbarth

On 08/27/13 16:19, Thomas Petazzoni wrote:

On Fri, 16 Aug 2013 21:41:33 +0200, Sebastian Hesselbarth wrote:

This is a RFC adding initial support for the Marvell Armada 1500
(88DE3100) found on various consumer devices (Chromecast, GoogleTV).

Actually, it is a two-fold RFC also raising discussions on mach-mvebu
cleanup roadmap to allow other SoCs to hop into it. While mach-mvebu
originally was created to add support for Armada 370/XP and merge
existing Marvell Orion familiy into it, I am not so sure about
Armada 1500 fits that well (the mbus has gone!).


After talking a bit with engineers within Marvell that work on this
SoC, I'm inclined to think that using mach-mvebu for this family of SoC
is not a good idea.


Thomas,

thanks for the info below. Reading a little bit through the GPL'ed
source, I also quickly came to the same conclusion. It is more likely
we can reuse some stuff from other SoCs than Orion or Armada 370/XP.


The reasons are:

  * This family of SoC is architecturally completely different from the
family of Orion SoC: they use completely different hardware blocks
(i.e none of the plat-orion stuff would apply, and none of the
Orion device drivers would be useful), they don't use the MBus
mechanism, etc. They are really a different family of SoC, almost as
if they were coming from a different SoC company.

  * The SMP and power management code, as well as all the glue
platform code that typically sits in mach-foo is going to be
substantially, if not completely different from the one in
mach-mvebu. I already believe doing all the glue platform code in
mach-mvebu for all of Kirkwood, Dove, 370/XP, Orion5x and MV78xx0 is
going to be a challenge, so I'd suggest to not add to this challenge
a completely separate family of SOCs.

The codename used for those Armada 1500 SOCs is Berlin, so a name
like mach-berlin, or mach-mvberlin (if we want to keep 'mv' to identify
the founder) seems like a good name.


I have already moved it under mach-mv88de3xxx as for now, all SoCs
Marvell is providing as DE (Digital Entertainment) fit in that. I like
mach-codename style more than plain numbers, maybe I rename the folder
to mach-berlin before posting.

Speaking of berlin, they found a 2WW bomb in my home town center today
and are evacuating apartments. Mine too, so it looks like I'll have
some time to prepare v2 tonight..


Also, to help us understand the organization of the family of SOCs, I
asked a few informations to Marvell, and here is what I could collect:


BGxname CPU corecodenameL2 cache controller 
internal name
BG2 PJ4BArmada1500  Tauros3 
MV88DE3100
BG2-CT  Cortex-A9   N/A PL310   N/A
BG3 Cortex-A15  N/A CA15 integrated N/A


As was told that the Armada X or MV88DEx names are not used during
development, and what Marvell is really using are the BGxx names.


Ok, I'll add that info to Marvell SoC documentation also.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 11/16] ARM: socfpga: remove call to of_clk_init

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove mach specific calls to it.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Dinh Nguyen dingu...@altera.com
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-socfpga/socfpga.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index bfce964..dd0d49c 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,7 +14,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see http://www.gnu.org/licenses/.
  */
-#include linux/clk-provider.h
 #include linux/irqchip.h
 #include linux/of_address.h
 #include linux/of_irq.h
@@ -107,7 +106,6 @@ static void __init socfpga_cyclone5_init(void)
 {
l2x0_of_init(0, ~0UL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-   of_clk_init(NULL);
socfpga_init_clocks();
 }
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 13/16] ARM: tegra: split tegra_pmc_init() in two

2013-08-27 Thread Sebastian Hesselbarth
From: Stephen Warren swar...@nvidia.com

Tegra's board file currently initializes clocks much earlier than those
for most other ARM SoCs. The reason is:

* The PMC HW block is involved in the path of some interrupts (i.e. it
inverts, or not, the IRQ input pin dedicated to the PMIC).

* So, that part of the PMC must be initialized early so that the IRQ
polarity is correct.

* The PMC initialization is currently monolithic, and the PMC has some
clock inputs, so the init routine ends up calling of_clk_get_by_name(),
and hence clocks must be set up early too.

In order to defer clock initialization to the more typical location,
split out the portions of tegra_pmc_init() that are truly IRQ-related
into a separate tegra_pmc_init_irq(), which can be called from the
machine descriptor's .init_irq() function, and defer the rest until
the machine descriptor's .init_machine() function. With arch/arm calling
of_clk_init(NULL) from time_init() this also allows the removal of
.init_time() hook.

Signed-off-by: Stephen Warren swar...@nvidia.com
---
Changelog:
v1-v2:
- took Stephen Warren's patch provided to separate Tegra's pmc_init
- sqashed in .init_time removal and reworded patch text

Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-te...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-tegra/common.c |4 +---
 arch/arm/mach-tegra/pmc.c|   41 ++---
 arch/arm/mach-tegra/pmc.h|1 +
 arch/arm/mach-tegra/tegra.c  |5 +++--
 4 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 94a119a..58dc91c5 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -24,7 +24,6 @@
 #include linux/delay.h
 #include linux/reboot.h
 #include linux/irqchip.h
-#include linux/clk-provider.h
 
 #include asm/hardware/cache-l2x0.h
 
@@ -61,8 +60,7 @@ u32 tegra_uart_config[4] = {
 #ifdef CONFIG_OF
 void __init tegra_dt_init_irq(void)
 {
-   of_clk_init(NULL);
-   tegra_pmc_init();
+   tegra_pmc_init_irq();
tegra_init_irq();
irqchip_init();
tegra_legacy_irq_syscore_init();
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index 8acb881..7916ff9 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -285,13 +285,10 @@ static const struct of_device_id matches[] __initconst = {
{ }
 };
 
-static void __init tegra_pmc_parse_dt(void)
+void __init tegra_pmc_init_irq(void)
 {
struct device_node *np;
-   u32 prop;
-   enum tegra_suspend_mode suspend_mode;
-   u32 core_good_time[2] = {0, 0};
-   u32 lp0_vec[2] = {0, 0};
+   u32 val;
 
np = of_find_matching_node(NULL, matches);
BUG_ON(!np);
@@ -300,6 +297,26 @@ static void __init tegra_pmc_parse_dt(void)
 
tegra_pmc_invert_interrupt = of_property_read_bool(np,
 nvidia,invert-interrupt);
+
+   val = tegra_pmc_readl(PMC_CTRL);
+   if (tegra_pmc_invert_interrupt)
+   val |= PMC_CTRL_INTR_LOW;
+   else
+   val = ~PMC_CTRL_INTR_LOW;
+   tegra_pmc_writel(val, PMC_CTRL);
+}
+
+void __init tegra_pmc_init(void)
+{
+   struct device_node *np;
+   u32 prop;
+   enum tegra_suspend_mode suspend_mode;
+   u32 core_good_time[2] = {0, 0};
+   u32 lp0_vec[2] = {0, 0};
+
+   np = of_find_matching_node(NULL, matches);
+   BUG_ON(!np);
+
tegra_pclk = of_clk_get_by_name(np, pclk);
WARN_ON(IS_ERR(tegra_pclk));
 
@@ -365,17 +382,3 @@ static void __init tegra_pmc_parse_dt(void)
 
pmc_pm_data.suspend_mode = suspend_mode;
 }
-
-void __init tegra_pmc_init(void)
-{
-   u32 val;
-
-   tegra_pmc_parse_dt();
-
-   val = tegra_pmc_readl(PMC_CTRL);
-   if (tegra_pmc_invert_interrupt)
-   val |= PMC_CTRL_INTR_LOW;
-   else
-   val = ~PMC_CTRL_INTR_LOW;
-   tegra_pmc_writel(val, PMC_CTRL);
-}
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h
index 549f8c7..4d5f8f3 100644
--- a/arch/arm/mach-tegra/pmc.h
+++ b/arch/arm/mach-tegra/pmc.h
@@ -39,6 +39,7 @@ bool tegra_pmc_cpu_is_powered(int cpuid);
 int tegra_pmc_cpu_power_on(int cpuid);
 int tegra_pmc_cpu_remove_clamping(int cpuid);
 
+void tegra_pmc_init_irq(void);
 void tegra_pmc_init(void);
 
 #endif
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 5b86055..2e21928 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -16,7 +16,6 @@
  *
  */
 
-#include linux/clocksource.h
 #include linux/kernel.h
 #include linux/init.h
 #include linux/platform_device.h
@@ -44,6 +43,7 @@
 #include common.h
 #include fuse.h
 #include iomap.h
+#include pmc.h
 
 static void __init tegra_dt_init(void)
 {
@@ -51,6 +51,8 @@ static void __init tegra_dt_init(void)
  

[PATCH RFC v2 01/16] ARM: call clk_of_init from time_init

2013-08-27 Thread Sebastian Hesselbarth
Most DT ARM machs require common clock providers initialized before timers.
Currently, arch/arm machs use .init_time to call clk_of_init right before
clocksource_of_init. This prevents to remove that hook and use the default
hook instead. clk_of_init is safe to call for non-DT platforms, so add
the call to ARM arch time_init by default. While at it, also reorder includes
alphabetically.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- reorder includes alphabetically

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-te...@vger.kernel.org
Cc: ker...@stlinux.com
Cc: linux-samsung-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/kernel/time.c |   24 ++--
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 98aee32..dd1028e 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -11,25 +11,26 @@
  *  This file contains the ARM-specific time handling details:
  *  reading the RTC at bootup, etc...
  */
+#include linux/clk-provider.h
+#include linux/clocksource.h
+#include linux/errno.h
 #include linux/export.h
-#include linux/kernel.h
-#include linux/interrupt.h
-#include linux/time.h
 #include linux/init.h
+#include linux/interrupt.h
+#include linux/irq.h
+#include linux/kernel.h
+#include linux/profile.h
 #include linux/sched.h
+#include linux/sched_clock.h
 #include linux/smp.h
+#include linux/time.h
 #include linux/timex.h
-#include linux/errno.h
-#include linux/profile.h
 #include linux/timer.h
-#include linux/clocksource.h
-#include linux/irq.h
-#include linux/sched_clock.h
 
-#include asm/thread_info.h
-#include asm/stacktrace.h
 #include asm/mach/arch.h
 #include asm/mach/time.h
+#include asm/stacktrace.h
+#include asm/thread_info.h
 
 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
 defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
@@ -116,6 +117,9 @@ int __init register_persistent_clock(clock_access_fn 
read_boot,
 
 void __init time_init(void)
 {
+   /* initalize common clocks before timers */
+   of_clk_init(NULL);
+
if (machine_desc-init_time)
machine_desc-init_time();
else
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 16/16] ARM: zynq: Don't call of_clk_init()

2013-08-27 Thread Sebastian Hesselbarth
From: Soren Brinkmann soren.brinkm...@xilinx.com

of_clk_init() has been moved to be called from common code, therefore
remove it from Zynq's clock init routine. Since the Zynq's clock setup
routine relies on an initialized SLCR, zynq_slcr_init() is moved to
init_irq() instead.

Signed-off-by: Soren Brinkmann soren.brinkm...@xilinx.com
---
Cc: Michal Simek michal.si...@xilinx.com
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-zynq/common.c |9 -
 drivers/clk/zynq/clkc.c |4 +++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 5f25256..9f79ebb 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -19,8 +19,7 @@
 #include linux/cpumask.h
 #include linux/platform_device.h
 #include linux/clk.h
-#include linux/clk/zynq.h
-#include linux/clocksource.h
+#include linux/irqchip.h
 #include linux/of_address.h
 #include linux/of_irq.h
 #include linux/of_platform.h
@@ -58,10 +57,10 @@ static void __init zynq_init_machine(void)
of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
 }
 
-static void __init zynq_timer_init(void)
+static void __init zynq_init_irq(void)
 {
+   irqchip_init();
zynq_slcr_init();
-   clocksource_of_init();
 }
 
 static struct map_desc zynq_cortex_a9_scu_map __initdata = {
@@ -104,8 +103,8 @@ static const char * const zynq_dt_match[] = {
 DT_MACHINE_START(XILINX_EP107, Xilinx Zynq Platform)
.smp= smp_ops(zynq_smp_ops),
.map_io = zynq_map_io,
+   .init_irq   = zynq_init_irq,
.init_machine   = zynq_init_machine,
-   .init_time  = zynq_timer_init,
.dt_compat  = zynq_dt_match,
.restart= zynq_system_reset,
 MACHINE_END
diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
index 089d3e3..53b851e 100644
--- a/drivers/clk/zynq/clkc.c
+++ b/drivers/clk/zynq/clkc.c
@@ -206,6 +206,9 @@ static void __init zynq_clk_setup(struct device_node *np)
 
pr_info(Zynq clock init\n);
 
+   if (WARN_ON(!zynq_slcr_base_priv))
+   return;
+
/* get clock output names from DT */
for (i = 0; i  clk_max; i++) {
if (of_property_read_string_index(np, clock-output-names,
@@ -532,5 +535,4 @@ CLK_OF_DECLARE(zynq_clkc, xlnx,ps7-clkc, zynq_clk_setup);
 void __init zynq_clock_init(void __iomem *slcr_base)
 {
zynq_slcr_base_priv = slcr_base;
-   of_clk_init(NULL);
 }
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 15/16] clk: vt8500: remove call to of_clk_init

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove it from corresponding drivers/clk code.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/clk/clk-vt8500.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index 82306f5..218d7ba 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -701,6 +701,4 @@ void __init vtwm_clk_init(void __iomem *base)
return;
 
pmc_base = base;
-
-   of_clk_init(NULL);
 }
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 12/16] ARM: sti: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. To get rid of it, move l2cc init to
.init_machine hook instead.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Srinivas Kandagatla srinivas.kandaga...@st.com
Cc: Stuart Menefy stuart.men...@st.com
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: ker...@stlinux.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-sti/board-dt.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
index 8fe6f0c..1217fb5 100644
--- a/arch/arm/mach-sti/board-dt.c
+++ b/arch/arm/mach-sti/board-dt.c
@@ -7,9 +7,8 @@
  * published by the Free Software Foundation.
  */
 
-#include linux/clk-provider.h
-#include linux/clocksource.h
 #include linux/irq.h
+#include linux/of_platform.h
 #include asm/hardware/cache-l2x0.h
 #include asm/mach/arch.h
 
@@ -28,11 +27,10 @@ void __init stih41x_l2x0_init(void)
l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK);
 }
 
-static void __init stih41x_timer_init(void)
+static void __init stih41x_machine_init(void)
 {
-   of_clk_init(NULL);
-   clocksource_of_init();
stih41x_l2x0_init();
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 static const char *stih41x_dt_match[] __initdata = {
@@ -42,7 +40,7 @@ static const char *stih41x_dt_match[] __initdata = {
 };
 
 DT_MACHINE_START(STM, STiH415/416 SoC with Flattened Device Tree)
-   .init_time  = stih41x_timer_init,
+   .init_machine   = stih41x_machine_init,
.smp= smp_ops(sti_smp_ops),
.dt_compat  = stih41x_dt_match,
 MACHINE_END
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 14/16] ARM: vexpress: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. The call to versatile_sched_clock_init
is moved to .init_early instead, we it is also for non-DT boards.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-vexpress/v2m.c |   14 +-
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 95a469e..4f8b8cb 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -1,12 +1,10 @@
 /*
  * Versatile Express V2M Motherboard Support
  */
-#include linux/clocksource.h
 #include linux/device.h
 #include linux/amba/bus.h
 #include linux/amba/mmci.h
 #include linux/io.h
-#include linux/clocksource.h
 #include linux/smp.h
 #include linux/init.h
 #include linux/of_address.h
@@ -22,7 +20,6 @@
 #include linux/regulator/fixed.h
 #include linux/regulator/machine.h
 #include linux/vexpress.h
-#include linux/clk-provider.h
 #include linux/clkdev.h
 
 #include asm/mach-types.h
@@ -422,16 +419,8 @@ void __init v2m_dt_init_early(void)
pr_warning(vexpress: DT HBI (%x) is not matching 
hardware (%x)!\n, dt_hbi, hbi);
}
-}
-
-static void __init v2m_dt_timer_init(void)
-{
-   of_clk_init(NULL);
 
-   clocksource_of_init();
-
-   versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
-   2400);
+   versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 2400);
 }
 
 static const struct of_device_id v2m_dt_bus_match[] __initconst = {
@@ -458,6 +447,5 @@ DT_MACHINE_START(VEXPRESS_DT, ARM-Versatile Express)
.smp_init   = smp_init_ops(vexpress_smp_init_ops),
.map_io = v2m_dt_map_io,
.init_early = v2m_dt_init_early,
-   .init_time  = v2m_dt_timer_init,
.init_machine   = v2m_dt_init,
 MACHINE_END
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 08/16] ARM: mxs: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
This patch converts clk-imx2[38] clocksource_of_init compatible init
associated with fsl,imx2[38]-clkctrl. With arch/arm calling
of_clk_init(NULL) from time_init(), we can now also remove custom
.init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Shawn Guo shawn@linaro.org
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-mxs/mach-mxs.c |   13 -
 drivers/clk/mxs/clk-imx23.c  |   16 +++-
 drivers/clk/mxs/clk-imx28.c  |   16 +++-
 include/linux/clk/mxs.h  |2 --
 4 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 98f6e2a..cc511a4 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -13,8 +13,6 @@
 #include linux/clk.h
 #include linux/clk/mxs.h
 #include linux/clkdev.h
-#include linux/clocksource.h
-#include linux/clk-provider.h
 #include linux/delay.h
 #include linux/err.h
 #include linux/gpio.h
@@ -490,16 +488,6 @@ static void mxs_restart(enum reboot_mode mode, const char 
*cmd)
soft_restart(0);
 }
 
-static void __init mxs_timer_init(void)
-{
-   if (of_machine_is_compatible(fsl,imx23))
-   mx23_clocks_init();
-   else
-   mx28_clocks_init();
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static const char *mxs_dt_compat[] __initdata = {
fsl,imx28,
fsl,imx23,
@@ -508,7 +496,6 @@ static const char *mxs_dt_compat[] __initdata = {
 
 DT_MACHINE_START(MXS, Freescale MXS (Device Tree))
.handle_irq = icoll_handle_irq,
-   .init_time  = mxs_timer_init,
.init_machine   = mxs_machine_init,
.init_late  = mxs_pm_init,
.dt_compat  = mxs_dt_compat,
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index c396fe3..7eb1d1a 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -12,6 +12,7 @@
 #include linux/clk.h
 #include linux/clk/mxs.h
 #include linux/clkdev.h
+#include linux/clk-provider.h
 #include linux/err.h
 #include linux/init.h
 #include linux/io.h
@@ -100,19 +101,17 @@ static enum imx23_clk clks_init_on[] __initdata = {
cpu, hbus, xbus, emi, uart,
 };
 
-int __init mx23_clocks_init(void)
+static void __init mx23_clocks_init(struct device_node *np)
 {
-   struct device_node *np;
u32 i;
 
+   clkctrl = of_iomap(np, 0);
+   WARN_ON(!clkctrl);
+
np = of_find_compatible_node(NULL, NULL, fsl,imx23-digctl);
digctrl = of_iomap(np, 0);
WARN_ON(!digctrl);
 
-   np = of_find_compatible_node(NULL, NULL, fsl,imx23-clkctrl);
-   clkctrl = of_iomap(np, 0);
-   WARN_ON(!clkctrl);
-
clk_misc_init();
 
clks[ref_xtal] = mxs_clk_fixed(ref_xtal, 2400);
@@ -162,7 +161,7 @@ int __init mx23_clocks_init(void)
if (IS_ERR(clks[i])) {
pr_err(i.MX23 clk %d: register failed with %ld\n,
i, PTR_ERR(clks[i]));
-   return PTR_ERR(clks[i]);
+   return;
}
 
clk_data.clks = clks;
@@ -171,6 +170,5 @@ int __init mx23_clocks_init(void)
 
for (i = 0; i  ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
-
-   return 0;
 }
+CLK_OF_DECLARE(imx23_clkctrl, fsl,imx23-clkctrl, mx23_clocks_init);
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 4faf0af..12d3f3d 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -12,6 +12,7 @@
 #include linux/clk.h
 #include linux/clk/mxs.h
 #include linux/clkdev.h
+#include linux/clk-provider.h
 #include linux/err.h
 #include linux/init.h
 #include linux/io.h
@@ -154,19 +155,17 @@ static enum imx28_clk clks_init_on[] __initdata = {
cpu, hbus, xbus, emi, uart,
 };
 
-int __init mx28_clocks_init(void)
+static void __init mx28_clocks_init(struct device_node *np)
 {
-   struct device_node *np;
u32 i;
 
+   clkctrl = of_iomap(np, 0);
+   WARN_ON(!clkctrl);
+
np = of_find_compatible_node(NULL, NULL, fsl,imx28-digctl);
digctrl = of_iomap(np, 0);
WARN_ON(!digctrl);
 
-   np = of_find_compatible_node(NULL, NULL, fsl,imx28-clkctrl);
-   clkctrl = of_iomap(np, 0);
-   WARN_ON(!clkctrl);
-
clk_misc_init();
 
clks[ref_xtal] = mxs_clk_fixed(ref_xtal, 2400);
@@ -239,7 +238,7 @@ int __init mx28_clocks_init(void)
if (IS_ERR(clks[i])) {
pr_err(i.MX28 clk %d: register failed with %ld\n,
i, PTR_ERR(clks[i]));
-   return PTR_ERR(clks[i]);
+   return;
}
 
clk_data.clks = clks;
@@ -250,6 +249,5

[PATCH RFC v2 09/16] ARM: nspire: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-nspire/nspire.c |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
index 99e2609..4b2ed2e 100644
--- a/arch/arm/mach-nspire/nspire.c
+++ b/arch/arm/mach-nspire/nspire.c
@@ -14,11 +14,9 @@
 #include linux/of_platform.h
 #include linux/irqchip.h
 #include linux/irqchip/arm-vic.h
-#include linux/clk-provider.h
 #include linux/clkdev.h
 #include linux/amba/bus.h
 #include linux/amba/clcd.h
-#include linux/clocksource.h
 
 #include asm/mach/arch.h
 #include asm/mach-types.h
@@ -65,12 +63,6 @@ static void __init nspire_init(void)
nspire_auxdata, NULL);
 }
 
-static void __init nspire_init_time(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void nspire_restart(char mode, const char *cmd)
 {
void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
@@ -83,7 +75,6 @@ static void nspire_restart(char mode, const char *cmd)
 DT_MACHINE_START(NSPIRE, TI-NSPIRE)
.dt_compat  = nspire_dt_match,
.map_io = nspire_map_io,
-   .init_time  = nspire_init_time,
.init_machine   = nspire_init,
.restart= nspire_restart,
 MACHINE_END
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 10/16] ARM: rockchip: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-rockchip/rockchip.c |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-rockchip/rockchip.c 
b/arch/arm/mach-rockchip/rockchip.c
index 724d2d8..82c0b07 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -19,18 +19,10 @@
 #include linux/init.h
 #include linux/of_platform.h
 #include linux/irqchip.h
-#include linux/dw_apb_timer.h
-#include linux/clk-provider.h
 #include asm/mach/arch.h
 #include asm/mach/map.h
 #include asm/hardware/cache-l2x0.h
 
-static void __init rockchip_timer_init(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void __init rockchip_dt_init(void)
 {
l2x0_of_init(0, ~0UL);
@@ -47,6 +39,5 @@ static const char * const rockchip_board_dt_compat[] = {
 
 DT_MACHINE_START(ROCKCHIP_DT, Rockchip Cortex-A9 (Device Tree))
.init_machine   = rockchip_dt_init,
-   .init_time  = rockchip_timer_init,
.dt_compat  = rockchip_board_dt_compat,
 MACHINE_END
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 07/16] ARM: mvebu: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- only remove of_clk_init from custom timer hook, further cleanup
  will be carried out later (Reported by Gregory Clement)

Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-mvebu/armada-370-xp.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c 
b/arch/arm/mach-mvebu/armada-370-xp.c
index 829b573..164c62b 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -14,7 +14,6 @@
 
 #include linux/kernel.h
 #include linux/init.h
-#include linux/clk-provider.h
 #include linux/of_address.h
 #include linux/of_platform.h
 #include linux/io.h
@@ -36,7 +35,6 @@ static void __init armada_370_xp_map_io(void)
 
 static void __init armada_370_xp_timer_and_clk_init(void)
 {
-   of_clk_init(NULL);
armada_370_xp_timer_init();
coherency_init();
BUG_ON(mvebu_mbus_dt_init());
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 06/16] ARM: kirkwood: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-kirkwood/board-dt.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-kirkwood/board-dt.c 
b/arch/arm/mach-kirkwood/board-dt.c
index 82d3ad8..a32a3e5 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -15,7 +15,6 @@
 #include linux/of.h
 #include linux/of_platform.h
 #include linux/clk-provider.h
-#include linux/clocksource.h
 #include linux/dma-mapping.h
 #include linux/irqchip.h
 #include linux/kexec.h
@@ -66,12 +65,6 @@ static void __init kirkwood_legacy_clk_init(void)
clk_prepare_enable(clk);
 }
 
-static void __init kirkwood_dt_time_init(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void __init kirkwood_dt_init_early(void)
 {
mvebu_mbus_init(marvell,kirkwood-mbus,
@@ -122,7 +115,6 @@ DT_MACHINE_START(KIRKWOOD_DT, Marvell Kirkwood (Flattened 
Device Tree))
/* Maintainer: Jason Cooper ja...@lakedaemon.net */
.map_io = kirkwood_map_io,
.init_early = kirkwood_dt_init_early,
-   .init_time  = kirkwood_dt_time_init,
.init_machine   = kirkwood_dt_init,
.restart= kirkwood_restart,
.dt_compat  = kirkwood_dt_board_compat,
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 05/16] ARM: imx: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- added missing CLK_OF_DECLARE for imx51 and imx53 (Reported by Sascha Hauer)
  mx53_clocks_init can be converted as it is used DT only, mx51_clocks_init
  still is used by non-DT.

Cc: Sascha Hauer ker...@pengutronix.de
Cc: Shawn Guo shawn@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-imx/clk-imx51-imx53.c |   29 ++---
 arch/arm/mach-imx/common.h  |4 
 arch/arm/mach-imx/imx51-dt.c|6 --
 arch/arm/mach-imx/mach-imx53.c  |6 --
 arch/arm/mach-imx/mach-imx6q.c  |   14 +++---
 arch/arm/mach-imx/mach-imx6sl.c |7 ---
 arch/arm/mach-imx/mach-vf610.c  |9 -
 7 files changed, 13 insertions(+), 62 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c 
b/arch/arm/mach-imx/clk-imx51-imx53.c
index 1a56a33..1b796db 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -11,6 +11,7 @@
 #include linux/clk.h
 #include linux/io.h
 #include linux/clkdev.h
+#include linux/clk-provider.h
 #include linux/of.h
 #include linux/err.h
 
@@ -131,8 +132,6 @@ static void __init mx5_clocks_common_init(unsigned long 
rate_ckil,
 {
int i;
 
-   of_clk_init(NULL);
-
clk[dummy] = imx_clk_fixed(dummy, 0);
clk[ckil] = imx_obtain_fixed_clock(ckil, rate_ckil);
clk[osc] = imx_obtain_fixed_clock(osc, rate_osc);
@@ -465,12 +464,16 @@ int __init mx51_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
return 0;
 }
 
-int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
-   unsigned long rate_ckih1, unsigned long rate_ckih2)
+static void __init mx51_clocks_init_dt(struct device_node *np)
+{
+   mx51_clocks_init(0, 0, 0, 0);
+}
+CLK_OF_DECLARE(imx51_ccm, fsl,imx51-ccm, mx51_clocks_init_dt);
+
+static void __init mx53_clocks_init(struct device_node *np)
 {
int i;
unsigned long r;
-   struct device_node *np;
 
clk[pll1_sw] = imx_clk_pllv2(pll1_sw, osc, MX53_DPLL1_BASE);
clk[pll2_sw] = imx_clk_pllv2(pll2_sw, osc, MX53_DPLL2_BASE);
@@ -529,12 +532,11 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
pr_err(i.MX53 clk %d: register failed with %ld\n,
i, PTR_ERR(clk[i]));
 
-   np = of_find_compatible_node(NULL, NULL, fsl,imx53-ccm);
clk_data.clks = clk;
clk_data.clk_num = ARRAY_SIZE(clk);
of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
 
-   mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
+   mx5_clocks_common_init(0, 0, 0, 0);
 
clk_register_clkdev(clk[vpu_gate], NULL, imx53-vpu.0);
clk_register_clkdev(clk[i2c3_gate], NULL, imx21-i2c.2);
@@ -566,16 +568,5 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
 
r = clk_round_rate(clk[usboh3_per_gate], 5400);
clk_set_rate(clk[usboh3_per_gate], r);
-
-   return 0;
-}
-
-int __init mx51_clocks_init_dt(void)
-{
-   return mx51_clocks_init(0, 0, 0, 0);
-}
-
-int __init mx53_clocks_init_dt(void)
-{
-   return mx53_clocks_init(0, 0, 0, 0);
 }
+CLK_OF_DECLARE(imx53_ccm, fsl,imx53-ccm, mx53_clocks_init);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd7..28e8ca0 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -63,13 +63,9 @@ extern int mx31_clocks_init(unsigned long fref);
 extern int mx35_clocks_init(void);
 extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
unsigned long ckih1, unsigned long ckih2);
-extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
-   unsigned long ckih1, unsigned long ckih2);
 extern int mx25_clocks_init_dt(void);
 extern int mx27_clocks_init_dt(void);
 extern int mx31_clocks_init_dt(void);
-extern int mx51_clocks_init_dt(void);
-extern int mx53_clocks_init_dt(void);
 extern struct platform_device *mxc_register_gpio(char *name, int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
 extern void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e5..bece8a6 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata = {
NULL
 };
 
-static void __init imx51_timer_init(void)
-{
-   mx51_clocks_init_dt();
-}
-
 DT_MACHINE_START(IMX51_DT, Freescale i.MX51 (Device Tree Support))
.map_io = mx51_map_io

[PATCH RFC v2 00/16] ARM: provide common arch init for DT clocks

2013-08-27 Thread Sebastian Hesselbarth
This RFC converts arch/arm to provide a common arch init for DT clock
providers. Currently, the call to of_clk_init(NULL) to initialize DT
clock providers is spread among several mach-dirs. Since most machs
require DT clocks initialized before timers, no initcall can be used.

By adding of_clk_init(NULL) to ARM time_init(), we can remove all
mach-specific .init_time hooks that basically called of_clk_init before
starting timers.

Based on the previous version, this one now includes patches provided by
Stephen Warren for mach-tegra and Soren Brinkmann for mach-zynq.

With mach-tegra now requiring clocks as late as the other machs, the
patch to protect of_clk_init() from being called twice, has been dropped.

The RFCv2 is based on next-20130827 and has been compile tested for
multi_v7_defconfig and mach-dove. All single patches have also been sent
to the respective maintainers and corresponding mailing lists.

Before going for a real patch set after v3.11 drops, I prefer to have
Tested-by or Acked-by for at least mach-imx, mach-mxs, mach-sti, and
mach-vexpress. Others are trivial, prepared by maintainers (mach-tegra
and mach-zynq), or have already been Acked-by (mach-highbank).

Also, I'd like to know if the patches should be grouped by mach- or
rather been split into mach- preparation and .init_time removal.

Sebastian Hesselbarth (14):
  ARM: call clk_of_init from time_init
  ARM: dove: remove custom .init_time hook
  ARM: exynos: remove custom .init_time hook
  ARM: highbank: remove custom .init_time hook
  ARM: imx: remove custom .init_time hook
  ARM: kirkwood: remove custom .init_time hook
  ARM: mvebu: remove custom .init_time hook
  ARM: mxs: remove custom .init_time hook
  ARM: nspire: remove custom .init_time hook
  ARM: rockchip: remove custom .init_time hook
  ARM: socfpga: remove call to of_clk_init
  ARM: sti: remove custom .init_time hook
  ARM: vexpress: remove custom .init_time hook
  clk: vt8500: remove call to of_clk_init

Soren Brinkmann (1):
  ARM: zynq: Don't call of_clk_init()

Stephen Warren (1):
  ARM: tegra: split tegra_pmc_init() in two

 arch/arm/kernel/time.c |   24 +++---
 arch/arm/mach-dove/board-dt.c  |   17 +
 arch/arm/mach-exynos/common.c  |7 -
 arch/arm/mach-exynos/common.h  |1 -
 arch/arm/mach-exynos/mach-exynos4-dt.c |1 -
 arch/arm/mach-exynos/mach-exynos5-dt.c |1 -
 arch/arm/mach-highbank/highbank.c  |   23 +
 arch/arm/mach-imx/clk-imx51-imx53.c|   29 +++--
 arch/arm/mach-imx/common.h |4 ---
 arch/arm/mach-imx/imx51-dt.c   |6 
 arch/arm/mach-imx/mach-imx53.c |6 
 arch/arm/mach-imx/mach-imx6q.c |   14 ++
 arch/arm/mach-imx/mach-imx6sl.c|7 -
 arch/arm/mach-imx/mach-vf610.c |9 ---
 arch/arm/mach-kirkwood/board-dt.c  |8 --
 arch/arm/mach-mvebu/armada-370-xp.c|2 -
 arch/arm/mach-mxs/mach-mxs.c   |   13 --
 arch/arm/mach-nspire/nspire.c  |9 ---
 arch/arm/mach-rockchip/rockchip.c  |9 ---
 arch/arm/mach-socfpga/socfpga.c|2 -
 arch/arm/mach-sti/board-dt.c   |   10 +++
 arch/arm/mach-tegra/common.c   |4 +--
 arch/arm/mach-tegra/pmc.c  |   41 +--
 arch/arm/mach-tegra/pmc.h  |1 +
 arch/arm/mach-tegra/tegra.c|5 ++-
 arch/arm/mach-vexpress/v2m.c   |   14 +--
 arch/arm/mach-zynq/common.c|9 +++
 drivers/clk/clk-highbank.c |   10 +--
 drivers/clk/clk-vt8500.c   |2 -
 drivers/clk/mxs/clk-imx23.c|   16 +---
 drivers/clk/mxs/clk-imx28.c|   16 +---
 drivers/clk/zynq/clkc.c|4 ++-
 include/linux/clk/mxs.h|2 -
 33 files changed, 95 insertions(+), 231 deletions(-)

---
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-te...@vger.kernel.org
Cc: ker...@stlinux.com
Cc: linux-samsung-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 03/16] ARM: exynos: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Kukjin Kim kgene@samsung.com
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-samsung-...@vger.kernel.org 
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-exynos/common.c  |7 ---
 arch/arm/mach-exynos/common.h  |1 -
 arch/arm/mach-exynos/mach-exynos4-dt.c |1 -
 arch/arm/mach-exynos/mach-exynos5-dt.c |1 -
 4 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index ba95e5d..587625b 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -27,7 +27,6 @@
 #include linux/irqdomain.h
 #include linux/of_address.h
 #include linux/clocksource.h
-#include linux/clk-provider.h
 #include linux/irqchip/arm-gic.h
 #include linux/irqchip/chained_irq.h
 
@@ -367,12 +366,6 @@ static void __init exynos5_map_io(void)
iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
 }
 
-void __init exynos_init_time(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 struct bus_type exynos_subsys = {
.name   = exynos-core,
.dev_name   = exynos-core,
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 8646a14..f0fa205 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -16,7 +16,6 @@
 #include linux/of.h
 
 void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
-void exynos_init_time(void);
 
 struct map_desc;
 void exynos_init_io(void);
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c 
b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 0099c6c..7458dd4 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -54,7 +54,6 @@ DT_MACHINE_START(EXYNOS4210_DT, Samsung Exynos4 (Flattened 
Device Tree))
.init_early = exynos_firmware_init,
.init_machine   = exynos4_dt_machine_init,
.init_late  = exynos_init_late,
-   .init_time  = exynos_init_time,
.dt_compat  = exynos4_dt_compat,
.restart= exynos4_restart,
.reserve= exynos4_reserve,
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index f874b77..8829da2 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -76,7 +76,6 @@ DT_MACHINE_START(EXYNOS5_DT, SAMSUNG EXYNOS5 (Flattened 
Device Tree))
.map_io = exynos_init_io,
.init_machine   = exynos5_dt_machine_init,
.init_late  = exynos_init_late,
-   .init_time  = exynos_init_time,
.dt_compat  = exynos5_dt_compat,
.restart= exynos5_restart,
.reserve= exynos5_reserve,
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 02/16] ARM: dove: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. While at it, also remove some obsolete
includes.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-dove/board-dt.c |   17 +
 1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index 9a116d7..b527728 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -9,26 +9,12 @@
  */
 
 #include linux/init.h
-#include linux/clk-provider.h
-#include linux/clocksource.h
-#include linux/irqchip.h
-#include linux/of.h
+#include linux/mbus.h
 #include linux/of_platform.h
-#include linux/platform_data/usb-ehci-orion.h
 #include asm/hardware/cache-tauros2.h
 #include asm/mach/arch.h
-#include mach/dove.h
-#include mach/pm.h
-#include plat/common.h
-#include plat/irq.h
 #include common.h
 
-static void __init dove_dt_time_init(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void __init dove_dt_init(void)
 {
pr_info(Dove 88AP510 SoC\n);
@@ -47,7 +33,6 @@ static const char * const dove_dt_board_compat[] = {
 
 DT_MACHINE_START(DOVE_DT, Marvell Dove (Flattened Device Tree))
.map_io = dove_map_io,
-   .init_time  = dove_dt_time_init,
.init_machine   = dove_dt_init,
.restart= dove_restart,
.dt_compat  = dove_dt_board_compat,
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 04/16] ARM: highbank: remove custom .init_time hook

2013-08-27 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. Highbank clock provider need a reference
to system registers, as a workaround current clk driver maps those
independent of arch code now.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
Acked-by: Rob Herring rob.herr...@calxeda.com
---
Cc: Rob Herring rob.herr...@calxeda.com
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-highbank/highbank.c |   23 +++
 drivers/clk/clk-highbank.c|   10 +++---
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-highbank/highbank.c 
b/arch/arm/mach-highbank/highbank.c
index 8881579..fa36d14 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -27,7 +27,6 @@
 #include linux/of_address.h
 #include linux/smp.h
 #include linux/amba/bus.h
-#include linux/clk-provider.h
 
 #include asm/cacheflush.h
 #include asm/cputype.h
@@ -88,20 +87,6 @@ static void __init highbank_init_irq(void)
 #endif
 }
 
-static void __init highbank_timer_init(void)
-{
-   struct device_node *np;
-
-   /* Map system registers */
-   np = of_find_compatible_node(NULL, NULL, calxeda,hb-sregs);
-   sregs_base = of_iomap(np, 0);
-   WARN_ON(!sregs_base);
-
-   of_clk_init(NULL);
-
-   clocksource_of_init();
-}
-
 static void highbank_power_off(void)
 {
highbank_set_pwr_shutdown();
@@ -160,6 +145,13 @@ static struct notifier_block highbank_platform_nb = {
 
 static void __init highbank_init(void)
 {
+   struct device_node *np;
+
+   /* Map system registers */
+   np = of_find_compatible_node(NULL, NULL, calxeda,hb-sregs);
+   sregs_base = of_iomap(np, 0);
+   WARN_ON(!sregs_base);
+
pm_power_off = highbank_power_off;
highbank_pm_init();
 
@@ -178,7 +170,6 @@ static const char *highbank_match[] __initconst = {
 DT_MACHINE_START(HIGHBANK, Highbank)
.smp= smp_ops(highbank_smp_ops),
.init_irq   = highbank_init_irq,
-   .init_time  = highbank_timer_init,
.init_machine   = highbank_init,
.dt_compat  = highbank_match,
.restart= highbank_restart,
diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
index 2e08cb0..2e7e9d9 100644
--- a/drivers/clk/clk-highbank.c
+++ b/drivers/clk/clk-highbank.c
@@ -20,8 +20,7 @@
 #include linux/clk-provider.h
 #include linux/io.h
 #include linux/of.h
-
-extern void __iomem *sregs_base;
+#include linux/of_address.h
 
 #define HB_PLL_LOCK_5000x2000
 #define HB_PLL_LOCK0x1000
@@ -280,6 +279,7 @@ static __init struct clk *hb_clk_init(struct device_node 
*node, const struct clk
const char *clk_name = node-name;
const char *parent_name;
struct clk_init_data init;
+   struct device_node *srnp;
int rc;
 
rc = of_property_read_u32(node, reg, reg);
@@ -290,7 +290,11 @@ static __init struct clk *hb_clk_init(struct device_node 
*node, const struct clk
if (WARN_ON(!hb_clk))
return NULL;
 
-   hb_clk-reg = sregs_base + reg;
+   /* Map system registers */
+   srnp = of_find_compatible_node(NULL, NULL, calxeda,hb-sregs);
+   hb_clk-reg = of_iomap(srnp, 0);
+   BUG_ON(!hb_clk-reg);
+   hb_clk-reg += reg;
 
of_property_read_string(node, clock-output-names, clk_name);
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC v2 13/16] ARM: tegra: split tegra_pmc_init() in two

2013-08-27 Thread Sebastian Hesselbarth

On 08/27/13 23:59, Stephen Warren wrote:

On 08/27/2013 03:28 PM, Sebastian Hesselbarth wrote:

From: Stephen Warren swar...@nvidia.com

Tegra's board file currently initializes clocks much earlier than those
for most other ARM SoCs. The reason is:

* The PMC HW block is involved in the path of some interrupts (i.e. it
inverts, or not, the IRQ input pin dedicated to the PMIC).

* So, that part of the PMC must be initialized early so that the IRQ
polarity is correct.

* The PMC initialization is currently monolithic, and the PMC has some
clock inputs, so the init routine ends up calling of_clk_get_by_name(),
and hence clocks must be set up early too.

In order to defer clock initialization to the more typical location,
split out the portions of tegra_pmc_init() that are truly IRQ-related
into a separate tegra_pmc_init_irq(), which can be called from the
machine descriptor's .init_irq() function, and defer the rest until
the machine descriptor's .init_machine() function. With arch/arm calling
of_clk_init(NULL) from time_init() this also allows the removal of
.init_time() hook.

Signed-off-by: Stephen Warren swar...@nvidia.com
---
Changelog:
v1-v2:
- took Stephen Warren's patch provided to separate Tegra's pmc_init
- sqashed in .init_time removal and reworded patch text


I think it'd be better to keep the 2 patches separate so the two logical
changes are in different patches. I suppose it isn't a huge deal though.

Either way, on this patch, your S-o-b line is missing above.


Stephen,

I was already wondering here, if I should separate the patches into 
preparation and actual removal. I put that question into the cover

letter and removed it from this patch text ;)

As you suggest to use preparation/removal, I will take that approach
for the final patch set. Will take you original unmodified patch then.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC v2 01/16] ARM: call clk_of_init from time_init

2013-08-27 Thread Sebastian Hesselbarth

On 08/28/13 00:19, Sören Brinkmann wrote:

On Tue, Aug 27, 2013 at 11:27:55PM +0200, Sebastian Hesselbarth wrote:

Most DT ARM machs require common clock providers initialized before timers.
Currently, arch/arm machs use .init_time to call clk_of_init right before
clocksource_of_init. This prevents to remove that hook and use the default
hook instead. clk_of_init is safe to call for non-DT platforms, so add
the call to ARM arch time_init by default. While at it, also reorder includes
alphabetically.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- reorder includes alphabetically

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-te...@vger.kernel.org
Cc: ker...@stlinux.com
Cc: linux-samsung-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
  arch/arm/kernel/time.c |   24 ++--
  1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 98aee32..dd1028e 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -11,25 +11,26 @@

[ ... ]

  void __init time_init(void)
  {
+   /* initalize common clocks before timers */
+   of_clk_init(NULL);
+
if (machine_desc-init_time)
machine_desc-init_time();
else


This forces zynq to move some initialization our clock code relies on to
init_irq(). Also, the current code already takes an approach of
doing either common init or machine specific init.


Soeren,

you know that patch 16/16 takes care of zynq's clock init?

It's your own patch you provided from the last RFC. Looking at it, it
moves  zynq_sclr_init() to .init_irq and removes the call to
of_clk_init() from zynq_clock_init() which is called by
zynq_sclr_init().

Isn't that solving the above issues for mach-zynq?


I think it might be better to move the call to of_clk_init() down into
the else branch of the if-else.


Possibly, yes. But we could also unconditionally call of_clk_init() at
the beginning of time_init() and call clocksource_of_init() at the end.
That will make .init_time() to some fixup hook between initialization of 
clocks and timers.



Though, this probably contradicts the purpose of the whole series.


Hmm, the purpose was to allow most platforms to remove a custom
.init_time hook only calling of_clk_init() and clocksource_of_init().

If we move of_clk_init() above also in the else-branch the purpose
is still met.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 4/6] ARM: add Marvell Berlin UART0 lowlevel debug

2013-08-27 Thread Sebastian Hesselbarth
This adds UART0 as found on Marvell 88DE3xxx SoCs, e.g. Armada 1500
to the list of possible lowlevel debug options.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- have separate DEBUG option due to separate mach- directory

Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Russell King li...@arm.linux.org.uk
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/Kconfig.debug |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index f793599..89617d4 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -94,6 +94,14 @@ choice
depends on ARCH_BCM2835
select DEBUG_UART_PL01X
 
+   config DEBUG_BERLIN_UART
+   bool Marvell Berlin (88DE3xxx) Debug UART
+   depends on ARCH_BERLIN
+   select DEBUG_UART_8250
+   help
+ Say Y here if you want kernel low-level debugging support
+ on Marvell Berlin (88DE3xxx) based platforms.
+
config DEBUG_CLPS711X_UART1
bool Kernel low-level debugging messages via UART1
depends on ARCH_CLPS711X
@@ -957,6 +965,7 @@ config DEBUG_UART_PHYS
default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \
ARCH_ORION5X
+   default 0xf7fc9000 if DEBUG_BERLIN_UART
default 0xfe80 if ARCH_IOP32X
default 0xffc02000 if DEBUG_SOCFPGA_UART
default 0xffd82340 if ARCH_IOP13XX
@@ -979,6 +988,7 @@ config DEBUG_UART_VIRT
default 0xf210 if DEBUG_PXA_UART1
default 0xf409 if ARCH_LPC32XX
default 0xf420 if ARCH_GEMINI
+   default 0xf7fc9000 if DEBUG_BERLIN_UART
default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
default 0xf809 if DEBUG_VEXPRESS_UART0_RS1
default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 5/6] ARM: add Armada 1500 and Sony NSZ-GS7 device tree files

2013-08-27 Thread Sebastian Hesselbarth
This adds very basic device tree files for the Marvell Armada 1500 SoC
(88DE3100) and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has
nodes for cpus, some clocks, l2 cache controller, local timer, apb timers,
uart, and interrupt controllers. The Sony NSZ-GS7 is a GoogleTV consumer
device comprising the Armada 1500 SoC above.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- add binding documentation (Reported by Jason Cooper)
- change l2cc from aurora to tauros3 (Reported by Thomas Petazzoni)
- add copyright reference
- adapt compatibles to mach-berlin instead of mach-mvebu

Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Russell King li...@arm.linux.org.uk
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 .../devicetree/bindings/arm/marvell,berlin.txt |   23 ++
 arch/arm/boot/dts/Makefile |2 +
 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts  |   29 +++
 arch/arm/boot/dts/mv88de3100.dtsi  |  222 
 4 files changed, 276 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/marvell,berlin.txt
 create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
 create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi

diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt 
b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
new file mode 100644
index 000..a4c3056
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
@@ -0,0 +1,23 @@
+Marvell Berlin (88DE3xxx) family SoCs Device Tree Bindings
+---
+
+Boards with a SoC of the Marvell Berlin (88DE3xxx) family, e.g. Armada 1500
+shall have the following properties:
+
+* Required root node properties:
+compatible: must contain marvell,berlin
+
+In addition, the above compatible shall be extended with the specific
+SoC used, i.e.
+marvell,88de3100 for Marvell 88DE3100 (Armada 1500),
+marvell,88de3010 for Marvell 88DE3010 (Armada 1000),
+marvell,88de3005 for Marvell 88DE3005 (Armada 1500-mini)
+
+* Example:
+
+/ {
+   model = Sony NSZ-GS7;
+   compatible = marvell,88de3100, marvell,berlin;
+
+   ...
+}
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index d45058e..2989b51 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -43,6 +43,8 @@ dtb-$(CONFIG_ARCH_AT91)   += sama5d35ek.dtb
 
 dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
 dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += \
+   mv88de3100-sony-nsz-gs7.dtb
 dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
da850-evm.dtb
 dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
diff --git a/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts 
b/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
new file mode 100644
index 000..1081bc1
--- /dev/null
+++ b/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
@@ -0,0 +1,29 @@
+/*
+ * Device Tree file for Sony NSZ-GS7
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include mv88de3100.dtsi
+
+/ {
+   model = Sony NSZ-GS7;
+   compatible = sony,nsz-gs7, marvell,88de3100, marvell,berlin;
+
+   chosen {
+   bootargs = console=ttyS0,115200 earlyprintk verbose debug;
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x4000; /* 1 GB */
+   };
+};
+
+uart0 { status = okay; };
diff --git a/arch/arm/boot/dts/mv88de3100.dtsi 
b/arch/arm/boot/dts/mv88de3100.dtsi
new file mode 100644
index 000..04328a6
--- /dev/null
+++ b/arch/arm/boot/dts/mv88de3100.dtsi
@@ -0,0 +1,222 @@
+/*
+ * Device Tree Include file for Marvell 88DE3100 (Armada 1500) SoC
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include skeleton.dtsi
+#include dt-bindings/interrupt-controller/arm-gic.h
+
+/ {
+   model = Marvell 88DE3100 (Armada 1500) SoC;
+   compatible = marvell,88de3100, marvell,berlin;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   cpu@0 {
+   compatible = marvell,sheeva-v7;
+   device_type = cpu;
+   next-level-cache = l2;
+   reg = 0

[PATCH RFC v2 2/6] ARM: add Marvell Berlin SoC familiy to Marvell doc

2013-08-27 Thread Sebastian Hesselbarth
This adds known facts and rumors about the Marvell Berlin (88DE3xxx) SoC
family to the Marvell SoC documentation.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- initial patch

Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 Documentation/arm/Marvell/README |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/Documentation/arm/Marvell/README b/Documentation/arm/Marvell/README
index 8f08a86..dc0dfdd6 100644
--- a/Documentation/arm/Marvell/README
+++ b/Documentation/arm/Marvell/README
@@ -126,6 +126,28 @@ Dove family (application processor)
   Core: ARMv7 compatible
   Directory: arch/arm/mach-dove
 
+Berlin family (Digital Entertainment)
+-
+
+  Flavors:
+   88DE3005, Armada 1500-mini
+   Design name:BG2-CT
+   Core:   ARM Cortex-A9, PL310 L2CC
+   88DE3010, Armada 1000
+   Design name:unknown
+   Core:   Marvell Sheeva (possibly PJ4A/B, Tauros2/3)
+   Product Brief:  
http://www.marvell.com/digital-entertainment/assets/armada_1000_pb.pdf
+   88DE3100, Armada 1500
+   Design name:BG2
+   Core:   Marvell PJ4B (ARMv7), Tauros3 L2CC
+   Product Brief:  
http://www.marvell.com/digital-entertainment/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
+   88DE
+   Design name:BG3
+   Core:   ARM Cortex-A15, CA15 integrated L2CC
+
+  Homepage: http://www.marvell.com/digital-entertainment/
+  Directory: arch/arm/mach-berlin
+
 PXA 2xx/3xx/93x/95x family
 --
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 6/6] ARM: add initial support for Marvell Berlin SoCs

2013-08-27 Thread Sebastian Hesselbarth
This adds initial support for the Marvell Berlin (88DE3xxx) SoC family
and basic machine setup for Armada 1500 (88DE3100) SoCs.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- nuke .map_io (Reported by Arnd Bergmann)
- add copyright reference
- switch to mach-berlin instead of mach-mvebu

Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Russell King li...@arm.linux.org.uk
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/Kconfig  |2 +
 arch/arm/Makefile |1 +
 arch/arm/mach-berlin/Kconfig  |   24 
 arch/arm/mach-berlin/Makefile |1 +
 arch/arm/mach-berlin/berlin.c |   49 +
 5 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-berlin/Kconfig
 create mode 100644 arch/arm/mach-berlin/Makefile
 create mode 100644 arch/arm/mach-berlin/berlin.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d41b122..329be50 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -930,6 +930,8 @@ source arch/arm/mach-bcm/Kconfig
 
 source arch/arm/mach-bcm2835/Kconfig
 
+source arch/arm/mach-berlin/Kconfig
+
 source arch/arm/mach-clps711x/Kconfig
 
 source arch/arm/mach-cns3xxx/Kconfig
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a37a50f..3ba332b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -147,6 +147,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 machine-$(CONFIG_ARCH_AT91)+= at91
 machine-$(CONFIG_ARCH_BCM) += bcm
 machine-$(CONFIG_ARCH_BCM2835) += bcm2835
+machine-$(CONFIG_ARCH_BERLIN)  += berlin
 machine-$(CONFIG_ARCH_CLPS711X)+= clps711x
 machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
 machine-$(CONFIG_ARCH_DAVINCI) += davinci
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
new file mode 100644
index 000..56a671e
--- /dev/null
+++ b/arch/arm/mach-berlin/Kconfig
@@ -0,0 +1,24 @@
+config ARCH_BERLIN
+   bool Marvell Berlin (88DE3xxx) SoCs if ARCH_MULTI_V7
+   select GENERIC_CLOCKEVENTS
+   select GENERIC_IRQ_CHIP
+   select COMMON_CLK
+   select DW_APB_ICTL
+   select DW_APB_TIMER_OF
+
+if ARCH_BERLIN
+
+menu Marvell Berlin (88DE3xxx) SoC variants
+
+config MACH_MV88DE3100
+   bool Marvell 88DE3100 (Armada 1500)
+   select ARM_GIC
+   select CACHE_L2X0
+   select CPU_PJ4B
+   select HAVE_ARM_TWD if LOCAL_TIMERS
+   select HAVE_SMP
+   select LOCAL_TIMERS if SMP
+
+endmenu
+
+endif
diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
new file mode 100644
index 000..ab69fe9
--- /dev/null
+++ b/arch/arm/mach-berlin/Makefile
@@ -0,0 +1 @@
+obj-y += berlin.o
diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
new file mode 100644
index 000..8ed03c8
--- /dev/null
+++ b/arch/arm/mach-berlin/berlin.c
@@ -0,0 +1,49 @@
+/*
+ * Device Tree support for Marvell Berlin (88DE3xxx) platforms.
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include linux/clk-provider.h
+#include linux/clocksource.h
+#include linux/init.h
+#include linux/io.h
+#include linux/kernel.h
+#include linux/of_platform.h
+#include asm/hardware/cache-l2x0.h
+#include asm/mach/arch.h
+
+static void __init berlin_init_time(void)
+{
+   /* with arch-wide of_clk_init, .init_time can be removed */
+   of_clk_init(NULL);
+   clocksource_of_init();
+}
+
+static void __init berlin_init_machine(void)
+{
+   /*
+* with DT probing for Tauros L2CC, .init_machine can be removed
+* Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc
+*/
+   l2x0_of_init(0x70c0, 0xfeff);
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const berlin_dt_compat[] = {
+   marvell,berlin,
+   NULL,
+};
+
+DT_MACHINE_START(BERLIN_DT, Marvell Berlin)
+   .dt_compat  = berlin_dt_compat,
+   .init_machine   = berlin_init_machine,
+   .init_time  = berlin_init_time,
+MACHINE_END
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 0/6] ARM: Initial support for Marvell Armada 1500

2013-08-27 Thread Sebastian Hesselbarth
This is the second RFC to add initial support for the Marvell Armada 1500
(88DE3100) found on various consumer devices. The changes compared to v1
have been quite fundamental, so I'll also summarize them in this cover letter.

I have addressed the following comments given during v1:
- moved to new mach-berlin subdir to reflect the difference from Armada 370/XP.
- removed redundant map_io hook and reduced DT soc range
- added SoC binding documentation
- added to Marvell SoC documentation
- have extra DEBUG_ Kconfig option for Marvell Berlin SoCs
- build with multi_v7_defconfig
- reorder things alphabetically

Comments I have not addressed:
- left .init_time hook as common arch clock init is currently under
  discussion in a separate patch set (comment added)
- left non-DT l2x0_of_init as I was allowed to choose only one cleanup
  out of the two prerequesites (comment added)

Also, I added copyright credits to the Asus Cube GPL'ed 2.6 kernel
source I was using as datasheet replacement. I have taken virtually
nothing out of it except register offsets, irq numbers, and clock
hierarchy. Actually, I would even put Marvell's direct copyright into
it just because I'd love to see them to continue their community efforts
they have started in the past. Anyway, I am not affiliated with Marvell,
so I cannot just make them resposible for the current, rudimentary SoC
skeleton patches.

This time the patches have been based on linux-next's next-20130827
tag, which better reflects the targeted 1 or 2 merge windows.

Sebastian Hesselbarth (6):
  irqchip: add DesignWare APB ICTL interrupt controller
  ARM: add Marvell Berlin SoC familiy to Marvell doc
  ARM: add Marvell Berlin and Armada 1500 to multi_v7_defconfig
  ARM: add Marvell Berlin UART0 lowlevel debug
  ARM: add Armada 1500 and Sony NSZ-GS7 device tree files
  ARM: add initial support for Marvell Berlin SoCs

 Documentation/arm/Marvell/README   |   22 ++
 .../devicetree/bindings/arm/marvell,berlin.txt |   23 ++
 .../interrupt-controller/snps,dw-apb-ictl.txt  |   29 +++
 arch/arm/Kconfig   |2 +
 arch/arm/Kconfig.debug |   10 +
 arch/arm/Makefile  |1 +
 arch/arm/boot/dts/Makefile |2 +
 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts  |   29 +++
 arch/arm/boot/dts/mv88de3100.dtsi  |  222 
 arch/arm/configs/multi_v7_defconfig|2 +
 arch/arm/mach-berlin/Kconfig   |   24 ++
 arch/arm/mach-berlin/Makefile  |1 +
 arch/arm/mach-berlin/berlin.c  |   49 +
 drivers/irqchip/Kconfig|4 +
 drivers/irqchip/Makefile   |1 +
 drivers/irqchip/irq-dw-apb-ictl.c  |  142 +
 16 files changed, 563 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/marvell,berlin.txt
 create mode 100644 
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
 create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi
 create mode 100644 arch/arm/mach-berlin/Kconfig
 create mode 100644 arch/arm/mach-berlin/Makefile
 create mode 100644 arch/arm/mach-berlin/berlin.c
 create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c

---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC v2 1/6] irqchip: add DesignWare APB ICTL interrupt controller

2013-08-27 Thread Sebastian Hesselbarth
This adds an irqchip driver and corresponding devicetree binding for the
secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- added copyright reference

Note:
The driver has been sent as a separate patch before, I decided to take it
back into the RFC. There is no other platform using it yet and this way I
can track all changes. Sorry for the noise caused by the individual patch.

Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Thomas Gleixner t...@linutronix.de
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 .../interrupt-controller/snps,dw-apb-ictl.txt  |   29 
 drivers/irqchip/Kconfig|4 +
 drivers/irqchip/Makefile   |1 +
 drivers/irqchip/irq-dw-apb-ictl.c  |  142 
 4 files changed, 176 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c

diff --git 
a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt 
b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
new file mode 100644
index 000..7ccd1ba
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
@@ -0,0 +1,29 @@
+Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+Synopsys DesignWare provides interrupt controller IP for APB known as
+dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
+APB bus, e.g. Marvell Armada 1500.
+
+Required properties:
+- compatible: shall be snps,dw-apb-ictl
+- reg: base address of interrupt registers starting with ENABLE_LOW register
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: number of cells to encode an interrupt source, shall be 1
+- interrupts: interrupt reference to primary interrupt controller
+- interrupt-parent: (optional) reference specific primary interrupt controller
+
+The interrupt sources map to the corresponding bits in the interrupt
+registers, i.e.
+- 0 maps to bit 0 of low interrupts,
+- 1 maps to bit 1 of low interrupts,
+- 32 maps to bit 0 of high interrupts, and so on.
+
+Example:
+   aic: interrupt-controller@3000 {
+   compatible = snps,dw-apb-ictl;
+   reg = 0x3000 0xc00;
+   interrupt-controller;
+   #interrupt-cells = 1;
+   interrupt-parent = gic;
+   interrupts = GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH;
+   };
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 3792a1a..940638d 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -30,6 +30,10 @@ config ARM_VIC_NR
  The maximum number of VICs available in the system, for
  power management.
 
+config DW_APB_ICTL
+   bool
+   select IRQ_DOMAIN
+
 config IMGPDC_IRQ
bool
select GENERIC_IRQ_CHIP
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 81e8cd4..e5bfb19 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_ARCH_SPEAR3XX)   += spear-shirq.o
 obj-$(CONFIG_ARM_GIC)  += irq-gic.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
 obj-$(CONFIG_ARM_VIC)  += irq-vic.o
+obj-$(CONFIG_DW_APB_ICTL)  += irq-dw-apb-ictl.o
 obj-$(CONFIG_IMGPDC_IRQ)   += irq-imgpdc.o
 obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)  += irq-renesas-intc-irqpin.o
diff --git a/drivers/irqchip/irq-dw-apb-ictl.c 
b/drivers/irqchip/irq-dw-apb-ictl.c
new file mode 100644
index 000..bbcacee
--- /dev/null
+++ b/drivers/irqchip/irq-dw-apb-ictl.c
@@ -0,0 +1,142 @@
+/*
+ * Synopsys DW APB ICTL irqchip driver.
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include linux/io.h
+#include linux/irq.h
+#include linux/irqchip/chained_irq.h
+#include linux/of_address.h
+#include linux/of_irq.h
+
+#include irqchip.h
+
+#define APB_INT_ENABLE_L   0x00
+#define APB_INT_ENABLE_H   0x04
+#define APB_INT_MASK_L 0x08
+#define APB_INT_MASK_H 0x0c
+#define APB_INT_FINALSTATUS_L  0x30
+#define APB_INT_FINALSTATUS_H  0x34
+
+static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
+{
+   struct irq_chip *chip = irq_get_chip(irq);
+   struct

[PATCH RFC v2 3/6] ARM: add Marvell Berlin and Armada 1500 to multi_v7_defconfig

2013-08-27 Thread Sebastian Hesselbarth
This adds the Marvell Berlin (88DE3xxx) SoC family and Marvell Armada 1500
(88DE3100) to the multi_v7_defconfig.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- initial patch due to separate mach- directory

Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Russell King li...@arm.linux.org.uk
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/configs/multi_v7_defconfig |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index 6e572c6..a017677 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -6,6 +6,8 @@ CONFIG_ARCH_MVEBU=y
 CONFIG_MACH_ARMADA_370=y
 CONFIG_MACH_ARMADA_XP=y
 CONFIG_ARCH_BCM=y
+CONFIG_ARCH_BERLIN=y
+CONFIG_MACH_MV88DE3100=y
 CONFIG_GPIO_PCA953X=y
 CONFIG_ARCH_HIGHBANK=y
 CONFIG_ARCH_KEYSTONE=y
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] ARM: Dove: Add the audio devices in DT

2013-08-28 Thread Sebastian Hesselbarth

On 08/28/2013 11:34 AM, Jean-Francois Moine wrote:

This patch adds the nodes to instantiate the audio devices of the Dove
boards.

Signed-off-by: Jean-Francois Moine moin...@free.fr
---
  arch/arm/boot/dts/dove.dtsi  | 18 ++
  1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 499abad..78227e2 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -573,6 +573,24 @@
phy-handle = ethphy;
};
};
+
+   i2s0: audio-controller@b {
+   compatible = marvell,mvebu-audio;


[added Gregory to Cc]

Jean-Francois,

as Mark Brown already took the bindings patch for above generic
compatible, how are we going to discriminate different
implementations/features of Dove, Kirkwood, and Armada 370?

Sebastian


+   reg = 0xb 0x2210;
+   interrupts = 19, 20;
+   clocks = gate_clk 12;
+   clock-names = internal;
+   status = disabled;
+   };
+
+   i2s1: audio-controller@b4000 {
+   compatible = marvell,mvebu-audio;
+   reg = 0xb4000 0x2210;
+   interrupts = 21, 22;
+   clocks = gate_clk 13;
+   clock-names = internal;
+   status = disabled;
+   };
};
};
  };




--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] ARM: Dove: Add the audio device to the Cubox DT

2013-08-28 Thread Sebastian Hesselbarth

On 08/28/2013 11:35 AM, Jean-Francois Moine wrote:

This patch activates the audio device of the Cubox and sets the i2s
and S/PDIF pins.

Signed-off-by: Jean-Francois Moine moin...@free.fr
---
  arch/arm/boot/dts/dove-cubox.dts  | 13 +
  1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index 4af59b6..003d95b 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -132,3 +132,16 @@
reg = 0;
};
  };
+
+pinctrl {
+   pmx_audio1_i2s1_spdifo: pmx-audio1-i2s1-spdifo {
+   marvell,pins = mpp_audio1;
+   marvell,function = i2s1/spdifo;
+   };
+};
+
+i2s1 {
+   status = okay;
+   pinctrl-0 = pmx_audio1_i2s1_spdifo;
+   pinctrl-names = default;
+};


Please also add the external clock connected from si5351.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] ARM: Dove: Add the audio devices in DT

2013-08-28 Thread Sebastian Hesselbarth

On 08/28/2013 12:19 PM, Thomas Petazzoni wrote:

Sebastian, Jean-François,

On Wed, 28 Aug 2013 12:13:07 +0200, Sebastian Hesselbarth wrote:

On 08/28/2013 11:34 AM, Jean-Francois Moine wrote:

This patch adds the nodes to instantiate the audio devices of the Dove
boards.

Signed-off-by: Jean-Francois Moine moin...@free.fr
---
   arch/arm/boot/dts/dove.dtsi  | 18 ++
   1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 499abad..78227e2 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -573,6 +573,24 @@
phy-handle = ethphy;
};
};
+
+   i2s0: audio-controller@b {
+   compatible = marvell,mvebu-audio;


[added Gregory to Cc]

Jean-Francois,

as Mark Brown already took the bindings patch for above generic
compatible, how are we going to discriminate different
implementations/features of Dove, Kirkwood, and Armada 370?


I agree that mvebu-audio is not a really good compatible string. It
should use the first SoC that introduced the IP block, so that if
future SOCs have variations, we can introduce separate compatible
strings.

So for now, the compatible string should be kirkwood-audio.


Unfortunately, mvebu-audio has already been taken by Mark. Also, we
know the differences for the three SoCs now and should have a compatible
for each (and maybe mvebu-audio for fallback).

Also, we'll need to distinguish between the different audio controllers
on a single SoC, i.e. i2s0 and i2s1. I suggest checking the (phys) reg
base passed.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] ARM: Dove: Add the audio devices in DT

2013-08-28 Thread Sebastian Hesselbarth

On 08/28/13 13:15, Thomas Petazzoni wrote:

On Wed, 28 Aug 2013 12:26:31 +0200, Sebastian Hesselbarth wrote:

as Mark Brown already took the bindings patch for above generic
compatible, how are we going to discriminate different
implementations/features of Dove, Kirkwood, and Armada 370?


I agree that mvebu-audio is not a really good compatible string. It
should use the first SoC that introduced the IP block, so that if
future SOCs have variations, we can introduce separate compatible
strings.

So for now, the compatible string should be kirkwood-audio.


Unfortunately, mvebu-audio has already been taken by Mark. Also, we
know the differences for the three SoCs now and should have a compatible
for each (and maybe mvebu-audio for fallback).


For 3.12, right? So 3.12 hasn't been released yet, so it's still time
to fix this.


I guess, yes.


Also, we'll need to distinguish between the different audio controllers
on a single SoC, i.e. i2s0 and i2s1. I suggest checking the (phys) reg
base passed.


For what reason does the driver needs to know whether it's the instance
0 or instance 1 ? If it's needed for some specific reason, then there
should probably be something like marvell,i2s-channel-id = 0 and
marvell,i2s-channel-id = 1.


On Dove, audio1 has SPDIF out, audio0 hasn't. Russell also mentioned to
get rid of i2s and use audio instead. Most SoC's controllers are
i2s only but as soon as SPDIF comes into play, it is a different
interface protocol.

I am fine with having a marvell,channel-id (no i2s) to discriminate
the instances, although reg offset should be sufficient.

Jean-Francois: Can you please also rename the DT nodes to audio0 and
audio1 instead?

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] ARM: Dove: Add the audio devices in DT

2013-08-28 Thread Sebastian Hesselbarth

On 08/28/13 13:58, Thomas Petazzoni wrote:

On Wed, 28 Aug 2013 13:44:51 +0200, Sebastian Hesselbarth wrote:

Also, we'll need to distinguish between the different audio controllers
on a single SoC, i.e. i2s0 and i2s1. I suggest checking the (phys) reg
base passed.


For what reason does the driver needs to know whether it's the instance
0 or instance 1 ? If it's needed for some specific reason, then there
should probably be something like marvell,i2s-channel-id = 0 and
marvell,i2s-channel-id = 1.


On Dove, audio1 has SPDIF out, audio0 hasn't. Russell also mentioned to
get rid of i2s and use audio instead. Most SoC's controllers are
i2s only but as soon as SPDIF comes into play, it is a different
interface protocol.

I am fine with having a marvell,channel-id (no i2s) to discriminate
the instances, although reg offset should be sufficient.


Well, the reg offset is a possibility, but it's not really nice, and
would have to be adapted to each and every SoC even if the reset of the
audio IP is the same.

Though, if the difference between the two units is the availability of
SPDIF support, then we shouldn't encode the channel number, but instead
the availability of SPDIF, i.e:

audio0 {
reg = ... ...;
compatible = marvell,kirkwood-audio;
marvell,has-spdif;


Agree, if you make it marvell,has-spdif-in and marvell,has-spdif-out
Dove has either i2s-only or i2s+spdifo, kirkwood has i2s+spdifo+spdifi
for the one audio controller available. Can't tell for Armada 370.

BTW, you might have followed some of the DT discussions with Mark
before; as he insists on having a separate sound card node, he might
argue that above property should be part of that node instead.

Last patch discussion [1] I followed on some spdif sound nodes, took the
patch up to v11 or so. Mainly, because the author updated it too
quickly, but looks like audio bindings are (still) worth a lot of
discussion.

[1] http://comments.gmane.org/gmane.linux.alsa.devel/112004

Sebastian


};

audio1 {
reg = ... ...;
compatible = marvell,kirkwood-audio;
};




--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC v2 5/6] ARM: add Armada 1500 and Sony NSZ-GS7 device tree files

2013-08-28 Thread Sebastian Hesselbarth

On 08/28/13 14:14, Jason Cooper wrote:

On Wed, Aug 28, 2013 at 02:14:33AM +0200, Sebastian Hesselbarth wrote:

This adds very basic device tree files for the Marvell Armada 1500 SoC
(88DE3100) and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has
nodes for cpus, some clocks, l2 cache controller, local timer, apb timers,
uart, and interrupt controllers. The Sony NSZ-GS7 is a GoogleTV consumer
device comprising the Armada 1500 SoC above.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- add binding documentation (Reported by Jason Cooper)
- change l2cc from aurora to tauros3 (Reported by Thomas Petazzoni)
- add copyright reference
- adapt compatibles to mach-berlin instead of mach-mvebu

Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Russell King li...@arm.linux.org.uk
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
  .../devicetree/bindings/arm/marvell,berlin.txt |   23 ++
  arch/arm/boot/dts/Makefile |2 +
  arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts  |   29 +++
  arch/arm/boot/dts/mv88de3100.dtsi  |  222 
  4 files changed, 276 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/arm/marvell,berlin.txt
  create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
  create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi

diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt 
b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
new file mode 100644
index 000..a4c3056
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
@@ -0,0 +1,23 @@
+Marvell Berlin (88DE3xxx) family SoCs Device Tree Bindings
+---
+
+Boards with a SoC of the Marvell Berlin (88DE3xxx) family, e.g. Armada 1500
+shall have the following properties:
+
+* Required root node properties:
+compatible: must contain marvell,berlin
+
+In addition, the above compatible shall be extended with the specific
+SoC used, i.e.
+marvell,88de3100   for Marvell 88DE3100 (Armada 1500),
+marvell,88de3010   for Marvell 88DE3010 (Armada 1000),
+marvell,88de3005   for Marvell 88DE3005 (Armada 1500-mini)
+
+* Example:
+
+/ {
+   model = Sony NSZ-GS7;
+   compatible = marvell,88de3100, marvell,berlin;


I would make this:

compatible = sony,nsz-gs7, marvell,88de3100, marvell,berlin;


Ok.


+
+   ...
+}
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index d45058e..2989b51 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -43,6 +43,8 @@ dtb-$(CONFIG_ARCH_AT91)   += sama5d35ek.dtb

  dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
  dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += \
+   mv88de3100-sony-nsz-gs7.dtb
  dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
da850-evm.dtb
  dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
diff --git a/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts 
b/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
new file mode 100644
index 000..1081bc1
--- /dev/null
+++ b/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
@@ -0,0 +1,29 @@
+/*
+ * Device Tree file for Sony NSZ-GS7
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include mv88de3100.dtsi
+
+/ {
+   model = Sony NSZ-GS7;
+   compatible = sony,nsz-gs7, marvell,88de3100, marvell,berlin;
+
+   chosen {
+   bootargs = console=ttyS0,115200 earlyprintk verbose debug;


I would remove 'verbose debug' before official submission, no point to
defaulting to log-spammer.


Agree.

Maybe, for the next patches, I'll add some I/O device drivers that
allow you to actually boot into some rootfs. All those fooHCI IP
shouldn't be that hard - hopefully some quirks only.

I also had a look at I2C and SPI, both DW IP with mainline drivers
available. SPI needs a little DT tweaking and I did not carry out any
functional tests, yet.

Thanks for the constant reviews!

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 5/5] ARM: mvebu: add board init for Armada 1500

2013-08-18 Thread Sebastian Hesselbarth

On 08/17/2013 09:08 PM, Arnd Bergmann wrote:

On Friday 16 August 2013, Jason Cooper wrote:

+
+#define ARMADA_1500_REG_BASE_VIRT  0xf600
+#define ARMADA_1500_REG_BASE_SIZE  0x0300
+
+static struct map_desc armada_1500_io_desc[] __initdata = {
+   {
+   .virtual= ARMADA_1500_REG_BASE_VIRT,
+   .pfn= __phys_to_pfn(ARMADA_1500_REG_BASE_VIRT),
+   .length = ARMADA_1500_REG_BASE_SIZE,
+   .type   = MT_DEVICE,
+   },
+};


You should really try to find out what driver uses this. If you have a 
requirement
that VIRT == PHYS here, the most likely explanation is that some driver 
accidentally
uses readl/writel on the physical address rather than on the result of ioremap.

You can try shrinking the area using bisection until you have found the 
offending
driver based on the address.


While bringing up timer and irq, I had no luck without that mapping,
but I didn't try without later on. There is no driver requiring it,
as I either only use mainline drivers that never knew about A1500
before, or I have written it on my own (dw-apb-ictl).

I don't think it is required and will try to remove it, now that I
know I have set up core stuff correctly and it boots.


+static void __init armada_1500_timer_and_clk_init(void)
+{
+   of_clk_init(NULL);
+   clocksource_of_init();
+}
+
+static void __init armada_1500_dt_init(void)
+{
+   l2x0_of_init(0x70c0, 0xfeff);


New platforms should call this as 'l2x0_of_init(0, 0);' and get the bits from 
DT.


Ok.


Note that we should really change the common code to do both the of_clk_init()
and the l2x0_of_init() automatically, but that needs to be done with some care,
in order to not break any of the existing platforms. Would you be able to do
one of the two? We can then get the next person that wants to add a platform
to do the last one ;-)


Scary but that reduces armada-1500.c to MACH descriptor and DT
compatible only ;) I don't expect any weird hacks required for
it anyway.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 5/5] ARM: mvebu: add board init for Armada 1500

2013-08-18 Thread Sebastian Hesselbarth

On 08/17/2013 09:12 PM, Arnd Bergmann wrote:

On Friday 16 August 2013, Sebastian Hesselbarth wrote:

+config MACH_ARMADA_1500
+   bool Marvell Armada 1500 boards
+   select ARMADA_1500_CLK
+   select ARM_GIC
+   select CACHE_L2X0
+   select CPU_PJ4B
+   select DW_APB_TIMER_OF
+   select LOCAL_TIMERS if SMP
+   select HAVE_ARM_TWD if LOCAL_TIMERS
+   select HAVE_SMP
+   select PINCTRL_ARMADA_1500


Hmm, I also noticed that this enables support for both the Cortex-A9
(using GIC and L2X0) and the PJ4 based variants of Armada 1500. I
wonder if we should have separate options for the two. E.g. if you
want to build a kernel for the Chromecast, there would be no need to
enabled PJ4 support.

I have not been able to find out which core is used in most of the
production Google TV boxes.


AFAIK, there is Armada 1500 (88de3100) used in every Google TV 2nd Gen
devices, some older multimedia boxes also used Armada 1000 (88de3010),
and Chromecast comprises Armada 1500-mini (88de3005).

We should be able to find out if it is PJ4B or Cortex-A9 by checking
any CPU register?

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 4/5] ARM: mvebu: add Armada 1500 and Sony NSZ-GS7 device tree files

2013-08-18 Thread Sebastian Hesselbarth

On 08/17/2013 09:28 PM, Arnd Bergmann wrote:

On Friday 16 August 2013, Sebastian Hesselbarth wrote:

+   cpu@0 {
+   compatible = marvell,sheeva-v7;
+   device_type = cpu;
+   next-level-cache = l2;
+   reg = 0;
+   };

...

+   l2: l2-cache-controller@1ac {
+   compatible = marvell,aurora-outer-cache;
+   reg = 0x1ac 0x1000;
+   cache-level = 2;
+   };
+
+   gic: interrupt-controller@1ad {
+   compatible = arm,cortex-a9-gic;
+   reg = 0x1ad1000 0x1000
+  0x1ad0100 0x0100;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   };
+
+   local-timer@1ad0600 {
+   compatible = arm,cortex-a9-twd-timer;
+   reg = 0x1ad0600 0x20;
+   interrupts = GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH;
+   clocks = cpu0clk;
+   };


This seems like a strange combination. I would have expected either 
PJ4+Aurora+apbtimer
or A9+pl310+localtimer, based on what I found in the chromecast kernel source.
Do you have more information here about what is used on the two variants?


I have no clue, what combination it really is. Unfortunately,
Marvell didn't release any open datasheets, of course.

I can only look at GPL'd Asus Cube kernel, I used for getting an idea
of what was required for initial support and reg offsets, irqs and
friends. They bring up twd as localtimer. Also, grep'ing the Cube
kernel sources in mach-mv88de3100 gives hits for CONFIG_PJ4 (note the
missing B), l2x0, smp_twd, apb_timer.

No hits for pl310, A9.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 0/5] ARM: Initial support for Marvell Armada 1500

2013-08-18 Thread Sebastian Hesselbarth

On 08/17/2013 09:32 PM, Arnd Bergmann wrote:

On Friday 16 August 2013, Sebastian Hesselbarth wrote:

This is a RFC adding initial support for the Marvell Armada 1500
(88DE3100) found on various consumer devices (Chromecast, GoogleTV).

Actually, it is a two-fold RFC also raising discussions on mach-mvebu
cleanup roadmap to allow other SoCs to hop into it. While mach-mvebu
originally was created to add support for Armada 370/XP and merge
existing Marvell Orion familiy into it, I am not so sure about
Armada 1500 fits that well (the mbus has gone!).

If you are brave enough to try this on any GoogleTV, hit Google for
instructions on how to get a unlocked u-boot and void your warranty :)
The patches are based on v3.11-rc5 directly.

This cover letter and the separate patches have also been Cc'd to the
respective maintainers to clear up some questions before posting a real
patch set.


Great stuff!


Thanks! I thought you'd be interested in this, so I Cc'd you :)


Regarding the question about the directory, is there going to be any
shared code with the files present in mach-mvebu, e.g. the SMP support
that I assume is planned for a later point?


I must admit, I never had a close look at the gory early start-up
internals, so all of this is quite new to me. Of course, I plan to
use both cores and therefore add SMP.


If there is shared code, it's probably best to have it in here. Otherwise
I don't care either way: We have precedent for fairly unrelated platforms
(ev2+shmobile, or the mach-bcm) being in the same directory for practical
reasons, and you can also create an almost empty directory now as we are
likely going to consolidate all trivial platforms in the future. Once
the l2x0 and clock init code as well as the early mapping has been
addressed, there won't be any platform code left.


As Thomas already mentioned, Armada 1500 doesn't fit mach-mvebu exactly
because it's from a different business unit within Marvell. And it is
kind of different from what I expected, most notably register addresses
are really different (see mvebu.S).

We either put it into mach-mvebu and pretend to consolidate Marvell SoCs
in there. Pro would be that it is close to other Armadas there, con is
that Armada is codename for virtually any Marvell SoC lately.

If we want a new mach- directory, I'd suggest either mach-berlin which
looks like some nickname for 88de3xxx SoCs or simply boring
mach-88de3xxx.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 5/5] ARM: mvebu: add board init for Armada 1500

2013-08-19 Thread Sebastian Hesselbarth

On 08/17/13 21:08, Arnd Bergmann wrote:

On Friday 16 August 2013, Jason Cooper wrote:

+
+#define ARMADA_1500_REG_BASE_VIRT  0xf600
+#define ARMADA_1500_REG_BASE_SIZE  0x0300
+
+static struct map_desc armada_1500_io_desc[] __initdata = {
+   {
+   .virtual= ARMADA_1500_REG_BASE_VIRT,
+   .pfn= __phys_to_pfn(ARMADA_1500_REG_BASE_VIRT),
+   .length = ARMADA_1500_REG_BASE_SIZE,
+   .type   = MT_DEVICE,
+   },
+};


You should really try to find out what driver uses this. If you have a 
requirement
that VIRT == PHYS here, the most likely explanation is that some driver 
accidentally
uses readl/writel on the physical address rather than on the result of ioremap.

You can try shrinking the area using bisection until you have found the 
offending
driver based on the address.


I just removed the above and it still works. Must have been a placebo
for me to believe it made it working.


+static void __init armada_1500_timer_and_clk_init(void)
+{
+   of_clk_init(NULL);
+   clocksource_of_init();
+}
+
+static void __init armada_1500_dt_init(void)
+{
+   l2x0_of_init(0x70c0, 0xfeff);


New platforms should call this as 'l2x0_of_init(0, 0);' and get the bits from 
DT.


Is there any work on get the bits from DT already? I looked in
arm-soc/for-next and for-next but couldn't find any parsing of
aux_*.


Note that we should really change the common code to do both the of_clk_init()
and the l2x0_of_init() automatically, but that needs to be done with some care,
in order to not break any of the existing platforms. Would you be able to do
one of the two? We can then get the next person that wants to add a platform
to do the last one ;-)


Haven't had a look at cache init, but of_clk_init(NULL). Since most
platforms need clocks prior timer, I guess any initcall is too late?
Below init sequence guessing may be wrong, but that is what I read
from init/main.c and arm arch init.

Looking through arch/ there is arc, arm, arm64, and metag using
of_clk_init(NULL).

arch/arc/plat-tb10x and arch/arm64 call it right before
of_platform_populate which is after time_init() and too late for
us, arch/metag calls it within time_init().

On arch/arm of_clk_init(NULL) is heavily spread among mach- subdirs
with exynos, highbank, imx (all sub-machs), mvebu, nspire, rockchip,
sti, and vexpress calling it in .init_time; tegra calls it even
earlier in .init_irq, socfpga in .init_machine. With latest clocksource
driver for Orion, -dove, -orion5x, and -mv78xx0, will also need clocks
prior timer.

If we are going for an arch/arm specific call to of_clk_init(NULL),
we could also call it from time_init(); after asking the tegra guys
about the specific requirement to have them (and the drivers using
it) ready before timers have been initialized.

For the transition period, we should add a static bool to of_clk_init
to WARN_ON double registration attempts.

I could prepare some patches to convert existing arch/arm users to
get some noise on the corresponding mailing lists. Maybe one of the
tegra guys is also reading this and can comment on .init_irq before.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] irqchip: add DesignWare APB ICTL interrupt controller

2013-08-19 Thread Sebastian Hesselbarth
This adds an irqchip driver and corresponding devicetree binding for the
secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Note: This single patch is separated from an RFC for initial support of
Marvell Armada 1500 [1]. The RFC needs some more work, while this driver is
fairly self-contained.

[1] 
http://lists-archives.com/linux-kernel/27893855-arm-initial-support-for-marvell-armada-1500.html

Cc: Thomas Gleixner t...@linutronix.de
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 .../interrupt-controller/snps,dw-apb-ictl.txt  |   29 
 drivers/irqchip/Kconfig|4 +
 drivers/irqchip/Makefile   |1 +
 drivers/irqchip/irq-dw-apb-ictl.c  |  139 
 4 files changed, 173 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c

diff --git 
a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt 
b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
new file mode 100644
index 000..7ccd1ba
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
@@ -0,0 +1,29 @@
+Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+Synopsys DesignWare provides interrupt controller IP for APB known as
+dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
+APB bus, e.g. Marvell Armada 1500.
+
+Required properties:
+- compatible: shall be snps,dw-apb-ictl
+- reg: base address of interrupt registers starting with ENABLE_LOW register
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: number of cells to encode an interrupt source, shall be 1
+- interrupts: interrupt reference to primary interrupt controller
+- interrupt-parent: (optional) reference specific primary interrupt controller
+
+The interrupt sources map to the corresponding bits in the interrupt
+registers, i.e.
+- 0 maps to bit 0 of low interrupts,
+- 1 maps to bit 1 of low interrupts,
+- 32 maps to bit 0 of high interrupts, and so on.
+
+Example:
+   aic: interrupt-controller@3000 {
+   compatible = snps,dw-apb-ictl;
+   reg = 0x3000 0xc00;
+   interrupt-controller;
+   #interrupt-cells = 1;
+   interrupt-parent = gic;
+   interrupts = GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH;
+   };
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 1fea003..f38164c 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -30,6 +30,10 @@ config ARM_VIC_NR
  The maximum number of VICs available in the system, for
  power management.
 
+config DW_APB_ICTL
+   bool
+   select IRQ_DOMAIN
+
 config ORION_IRQCHIP
bool
select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index e65c41a..54164e1 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_ARCH_SPEAR3XX)   += spear-shirq.o
 obj-$(CONFIG_ARM_GIC)  += irq-gic.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
 obj-$(CONFIG_ARM_VIC)  += irq-vic.o
+obj-$(CONFIG_DW_APB_ICTL)  += irq-dw-apb-ictl.o
 obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)  += irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o
diff --git a/drivers/irqchip/irq-dw-apb-ictl.c 
b/drivers/irqchip/irq-dw-apb-ictl.c
new file mode 100644
index 000..3af7d30
--- /dev/null
+++ b/drivers/irqchip/irq-dw-apb-ictl.c
@@ -0,0 +1,139 @@
+/*
+ * Synopsys DW APB ICTL irqchip driver.
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include linux/io.h
+#include linux/irq.h
+#include linux/irqchip/chained_irq.h
+#include linux/of_address.h
+#include linux/of_irq.h
+
+#include irqchip.h
+
+#define APB_INT_ENABLE_L   0x00
+#define APB_INT_ENABLE_H   0x04
+#define APB_INT_MASK_L 0x08
+#define APB_INT_MASK_H 0x0c
+#define APB_INT_FINALSTATUS_L  0x30
+#define APB_INT_FINALSTATUS_H  0x34
+
+static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
+{
+   struct irq_chip *chip = irq_get_chip(irq);
+   struct irq_chip_generic *gc = irq_get_handler_data(irq);
+   struct irq_domain *d = gc-private;
+   u32 stat;
+   int n

[RFC 15/17] ARM: vexpress: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- call to versatile_sched_clock_init is moved to .init_early. It is
  there for non-DT and existing DT init_early takes care of mapping
  its registers.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-vexpress/v2m.c |   14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 95a469e..4f8b8cb 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -1,12 +1,10 @@
 /*
  * Versatile Express V2M Motherboard Support
  */
-#include linux/clocksource.h
 #include linux/device.h
 #include linux/amba/bus.h
 #include linux/amba/mmci.h
 #include linux/io.h
-#include linux/clocksource.h
 #include linux/smp.h
 #include linux/init.h
 #include linux/of_address.h
@@ -22,7 +20,6 @@
 #include linux/regulator/fixed.h
 #include linux/regulator/machine.h
 #include linux/vexpress.h
-#include linux/clk-provider.h
 #include linux/clkdev.h
 
 #include asm/mach-types.h
@@ -422,16 +419,8 @@ void __init v2m_dt_init_early(void)
pr_warning(vexpress: DT HBI (%x) is not matching 
hardware (%x)!\n, dt_hbi, hbi);
}
-}
-
-static void __init v2m_dt_timer_init(void)
-{
-   of_clk_init(NULL);
 
-   clocksource_of_init();
-
-   versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
-   2400);
+   versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 2400);
 }
 
 static const struct of_device_id v2m_dt_bus_match[] __initconst = {
@@ -458,6 +447,5 @@ DT_MACHINE_START(VEXPRESS_DT, ARM-Versatile Express)
.smp_init   = smp_init_ops(vexpress_smp_init_ops),
.map_io = v2m_dt_map_io,
.init_early = v2m_dt_init_early,
-   .init_time  = v2m_dt_timer_init,
.init_machine   = v2m_dt_init,
 MACHINE_END
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 17/17] clk: zynq: remove call to of_clk_init

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove it from corresponding drivers/clk code.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Michal Simek michal.si...@xilinx.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/clk/zynq/clkc.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
index 089d3e3..7ca6362 100644
--- a/drivers/clk/zynq/clkc.c
+++ b/drivers/clk/zynq/clkc.c
@@ -532,5 +532,4 @@ CLK_OF_DECLARE(zynq_clkc, xlnx,ps7-clkc, zynq_clk_setup);
 void __init zynq_clock_init(void __iomem *slcr_base)
 {
zynq_slcr_base_priv = slcr_base;
-   of_clk_init(NULL);
 }
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 01/17] clk: ensure __clk_of_table is only initialized once

2013-08-19 Thread Sebastian Hesselbarth
This patch ensures DT clock providers are only initialized once by
using a static bool that is set after first call to of_clk_init().

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/clk/clk.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 56a00db..0a8a750 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2117,9 +2117,15 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
 void __init of_clk_init(const struct of_device_id *matches)
 {
struct device_node *np;
+   static bool table_done;
 
-   if (!matches)
+   if (!matches) {
+   /* init __clk_of_table drivers only once */
+   if (table_done)
+   return;
matches = __clk_of_table;
+   table_done = true;
+   }
 
for_each_matching_node(np, matches) {
const struct of_device_id *match = of_match_node(matches, np);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 16/17] clk: vt8500: remove call to of_clk_init

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove it from corresponding drivers/clk code.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Tony Prisk li...@prisktech.co.nz
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/clk/clk-vt8500.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index 82306f5..218d7ba 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -701,6 +701,4 @@ void __init vtwm_clk_init(void __iomem *base)
return;
 
pmc_base = base;
-
-   of_clk_init(NULL);
 }
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 13/17] ARM: sti: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- replacing .init_time with .init_machine isn't really cleanup, but
  there is no direct DT probing of l2cc. Anyway, I chose this conversion
  so we have no more custom .init_time left. With DT support for l2cc,
  temporary .init_machine hook can be removed again.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Srinivas Kandagatla srinivas.kandaga...@st.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-sti/board-dt.c |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
index 8fe6f0c..1217fb5 100644
--- a/arch/arm/mach-sti/board-dt.c
+++ b/arch/arm/mach-sti/board-dt.c
@@ -7,9 +7,8 @@
  * published by the Free Software Foundation.
  */
 
-#include linux/clk-provider.h
-#include linux/clocksource.h
 #include linux/irq.h
+#include linux/of_platform.h
 #include asm/hardware/cache-l2x0.h
 #include asm/mach/arch.h
 
@@ -28,11 +27,10 @@ void __init stih41x_l2x0_init(void)
l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK);
 }
 
-static void __init stih41x_timer_init(void)
+static void __init stih41x_machine_init(void)
 {
-   of_clk_init(NULL);
-   clocksource_of_init();
stih41x_l2x0_init();
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 static const char *stih41x_dt_match[] __initdata = {
@@ -42,7 +40,7 @@ static const char *stih41x_dt_match[] __initdata = {
 };
 
 DT_MACHINE_START(STM, STiH415/416 SoC with Flattened Device Tree)
-   .init_time  = stih41x_timer_init,
+   .init_machine   = stih41x_machine_init,
.smp= smp_ops(sti_smp_ops),
.dt_compat  = stih41x_dt_match,
 MACHINE_END
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 03/17] ARM: dove: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. While at it, also remove some obsolete
includes.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Jason Cooper ja...@lakedaemon.net
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-dove/board-dt.c |   16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index 9a116d7..5ea4491 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -9,26 +9,13 @@
  */
 
 #include linux/init.h
-#include linux/clk-provider.h
-#include linux/clocksource.h
-#include linux/irqchip.h
+#include linux/mbus.h
 #include linux/of.h
 #include linux/of_platform.h
-#include linux/platform_data/usb-ehci-orion.h
 #include asm/hardware/cache-tauros2.h
 #include asm/mach/arch.h
-#include mach/dove.h
-#include mach/pm.h
-#include plat/common.h
-#include plat/irq.h
 #include common.h
 
-static void __init dove_dt_time_init(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void __init dove_dt_init(void)
 {
pr_info(Dove 88AP510 SoC\n);
@@ -47,7 +34,6 @@ static const char * const dove_dt_board_compat[] = {
 
 DT_MACHINE_START(DOVE_DT, Marvell Dove (Flattened Device Tree))
.map_io = dove_map_io,
-   .init_time  = dove_dt_time_init,
.init_machine   = dove_dt_init,
.restart= dove_restart,
.dt_compat  = dove_dt_board_compat,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 12/17] ARM: socfpga: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Dinh Nguyen dingu...@altera.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-socfpga/socfpga.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index bfce964..dd0d49c 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,7 +14,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see http://www.gnu.org/licenses/.
  */
-#include linux/clk-provider.h
 #include linux/irqchip.h
 #include linux/of_address.h
 #include linux/of_irq.h
@@ -107,7 +106,6 @@ static void __init socfpga_cyclone5_init(void)
 {
l2x0_of_init(0, ~0UL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-   of_clk_init(NULL);
socfpga_init_clocks();
 }
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 14/17] ARM: tegra: remove .init_time hook to clocksource_of_init

2013-08-19 Thread Sebastian Hesselbarth
clocksource_of_init is called on NULL .init_time hook automatically.
Just get rid of it.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- tegra calls of_clk_init(NULL) in .init_irq already. With of_clk_init
  checking for multiple calls with NULL argument, it is safe to remove
  the custom .init_time hook. I have added mach-tegra to make maintainers
  aware of this RFC.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-tegra/tegra.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 5b86055..28563d9 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -16,7 +16,6 @@
  *
  */
 
-#include linux/clocksource.h
 #include linux/kernel.h
 #include linux/init.h
 #include linux/platform_device.h
@@ -119,7 +118,6 @@ DT_MACHINE_START(TEGRA_DT, NVIDIA Tegra SoC (Flattened 
Device Tree))
.smp= smp_ops(tegra_smp_ops),
.init_early = tegra_init_early,
.init_irq   = tegra_dt_init_irq,
-   .init_time  = clocksource_of_init,
.init_machine   = tegra_dt_init,
.init_late  = tegra_dt_init_late,
.restart= tegra_assert_system_reset,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 02/17] ARM: call clk_of_init from time_init

2013-08-19 Thread Sebastian Hesselbarth
Most DT ARM machs require common clock providers initialized before timers.
Currently, arch/arm machs use .init_time to call clk_of_init right before
clocksource_of_init. This prevents to remove that hook and use the default
hook instead. clk_of_init now checks for multiple calls to it, so add
the call to ARM arch time_init by default.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Mike Turquette mturque...@linaro.org 
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org 
Cc: linux-kernel@vger.kernel.org 
---
 arch/arm/kernel/time.c |4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 98aee32..94b51b8 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -22,6 +22,7 @@
 #include linux/errno.h
 #include linux/profile.h
 #include linux/timer.h
+#include linux/clk-provider.h
 #include linux/clocksource.h
 #include linux/irq.h
 #include linux/sched_clock.h
@@ -116,6 +117,9 @@ int __init register_persistent_clock(clock_access_fn 
read_boot,
 
 void __init time_init(void)
 {
+   /* initalize common clocks before timers */
+   of_clk_init(NULL);
+
if (machine_desc-init_time)
machine_desc-init_time();
else
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 00/17] ARM: provide common arch init for DT clocks

2013-08-19 Thread Sebastian Hesselbarth
This RFC converts arch/arm to provide a common arch init for DT clock
providers. Currently, the call to of_clk_init(NULL) to initialize DT
clock providers is spread among several mach-dirs. Since most machs
require DT clocks initialized before timers, no initcall can be used.

By adding of_clk_init(NULL) to ARM time_init(), we can remove all
mach-specific .init_time hooks that basically called of_clk_init before
starting timers. Some machs use the hook for more initialization, that
has been moved to other hooks where required.

The only exception is mach-tegra which requires clocks even earlier in
.init_irq. To allow machs to call clk_of_init at any time earlier than
time_init(), we first need to ensure drivers in __clk_of_table are only
initialized once.

The RFC is based on next-20130819 to catch up with future clock related
changes. It has been tested on mach-mvebu and compile tested for all the
other machs modified. All single patches have also been sent to the
respective maintainers.

Although some patches also modify files in mach-foo and drivers/clk, I
decided to keep them in a single patch to also show what would be
required for a common arch clock init.

Sebastian Hesselbarth (17):
  clk: ensure __clk_of_table is only initialized once
  ARM: call clk_of_init from time_init
  ARM: dove: remove custom .init_time hook
  ARM: exynos: remove custom .init_time hook
  ARM: highbank: remove custom .init_time hook
  ARM: imx: remove custom .init_time hook
  ARM: kirkwood: remove custom .init_time hook
  ARM: mvebu: remove custom .init_time hook
  ARM: mxs: remove custom .init_time hook
  ARM: nspire: remove custom .init_time hook
  ARM: rockchip: remove custom .init_time hook
  ARM: socfpga: remove custom .init_time hook
  ARM: sti: remove custom .init_time hook
  ARM: tegra: remove .init_time hook to clocksource_of_init
  ARM: vexpress: remove custom .init_time hook
  clk: vt8500: remove call to of_clk_init
  clk: zynq: remove call to of_clk_init

 arch/arm/kernel/time.c   |4 
 arch/arm/mach-dove/board-dt.c|   16 +---
 arch/arm/mach-exynos/common.c|7 ---
 arch/arm/mach-exynos/common.h|1 -
 arch/arm/mach-exynos/mach-exynos4-dt.c   |1 -
 arch/arm/mach-exynos/mach-exynos5-dt.c   |1 -
 arch/arm/mach-highbank/highbank.c|   23 +++
 arch/arm/mach-imx/clk-imx51-imx53.c  |   12 
 arch/arm/mach-imx/common.h   |2 --
 arch/arm/mach-imx/imx51-dt.c |6 --
 arch/arm/mach-imx/mach-imx53.c   |6 --
 arch/arm/mach-imx/mach-imx6q.c   |   14 +++---
 arch/arm/mach-imx/mach-imx6sl.c  |7 ---
 arch/arm/mach-imx/mach-vf610.c   |9 -
 arch/arm/mach-kirkwood/board-dt.c|8 
 arch/arm/mach-mvebu/armada-370-xp.c  |   11 +--
 arch/arm/mach-mxs/mach-mxs.c |   13 -
 arch/arm/mach-nspire/nspire.c|9 -
 arch/arm/mach-rockchip/rockchip.c|9 -
 arch/arm/mach-socfpga/socfpga.c  |2 --
 arch/arm/mach-sti/board-dt.c |   10 --
 arch/arm/mach-tegra/tegra.c  |2 --
 arch/arm/mach-vexpress/v2m.c |   14 +-
 drivers/clk/clk-highbank.c   |   10 +++---
 drivers/clk/clk-vt8500.c |2 --
 drivers/clk/clk.c|8 +++-
 drivers/clk/mxs/clk-imx23.c  |   16 +++-
 drivers/clk/mxs/clk-imx28.c  |   16 
 drivers/clk/zynq/clkc.c  |1 -
 drivers/clocksource/time-armada-370-xp.c |7 +++
 include/linux/clk/mxs.h  |2 --
 include/linux/time-armada-370-xp.h   |   16 
 32 files changed, 53 insertions(+), 212 deletions(-)
 delete mode 100644 include/linux/time-armada-370-xp.h

---
Cc: Mike Turquette mturque...@linaro.org
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 09/17] ARM: mxs: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- clk-imx2[38] are converted to clocksource_of_init compatible init
  associated with fsl,imx2[38]-clkctrl

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Shawn Guo shawn@linaro.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-mxs/mach-mxs.c |   13 -
 drivers/clk/mxs/clk-imx23.c  |   16 +++-
 drivers/clk/mxs/clk-imx28.c  |   16 
 include/linux/clk/mxs.h  |2 --
 4 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 98f6e2a..cc511a4 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -13,8 +13,6 @@
 #include linux/clk.h
 #include linux/clk/mxs.h
 #include linux/clkdev.h
-#include linux/clocksource.h
-#include linux/clk-provider.h
 #include linux/delay.h
 #include linux/err.h
 #include linux/gpio.h
@@ -490,16 +488,6 @@ static void mxs_restart(enum reboot_mode mode, const char 
*cmd)
soft_restart(0);
 }
 
-static void __init mxs_timer_init(void)
-{
-   if (of_machine_is_compatible(fsl,imx23))
-   mx23_clocks_init();
-   else
-   mx28_clocks_init();
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static const char *mxs_dt_compat[] __initdata = {
fsl,imx28,
fsl,imx23,
@@ -508,7 +496,6 @@ static const char *mxs_dt_compat[] __initdata = {
 
 DT_MACHINE_START(MXS, Freescale MXS (Device Tree))
.handle_irq = icoll_handle_irq,
-   .init_time  = mxs_timer_init,
.init_machine   = mxs_machine_init,
.init_late  = mxs_pm_init,
.dt_compat  = mxs_dt_compat,
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index c396fe3..7c2794d 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -12,6 +12,7 @@
 #include linux/clk.h
 #include linux/clk/mxs.h
 #include linux/clkdev.h
+#include linux/clk-provider.h
 #include linux/err.h
 #include linux/init.h
 #include linux/io.h
@@ -100,19 +101,17 @@ static enum imx23_clk clks_init_on[] __initdata = {
cpu, hbus, xbus, emi, uart,
 };
 
-int __init mx23_clocks_init(void)
+void __init mx23_clocks_init(struct device_node *np)
 {
-   struct device_node *np;
u32 i;
 
+   clkctrl = of_iomap(np, 0);
+   WARN_ON(!clkctrl);
+
np = of_find_compatible_node(NULL, NULL, fsl,imx23-digctl);
digctrl = of_iomap(np, 0);
WARN_ON(!digctrl);
 
-   np = of_find_compatible_node(NULL, NULL, fsl,imx23-clkctrl);
-   clkctrl = of_iomap(np, 0);
-   WARN_ON(!clkctrl);
-
clk_misc_init();
 
clks[ref_xtal] = mxs_clk_fixed(ref_xtal, 2400);
@@ -162,7 +161,7 @@ int __init mx23_clocks_init(void)
if (IS_ERR(clks[i])) {
pr_err(i.MX23 clk %d: register failed with %ld\n,
i, PTR_ERR(clks[i]));
-   return PTR_ERR(clks[i]);
+   return;
}
 
clk_data.clks = clks;
@@ -171,6 +170,5 @@ int __init mx23_clocks_init(void)
 
for (i = 0; i  ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
-
-   return 0;
 }
+CLK_OF_DECLARE(imx23_clkctrl, fsl,imx23-clkctrl, mx23_clocks_init);
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 4faf0af..5627fa2 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -12,6 +12,7 @@
 #include linux/clk.h
 #include linux/clk/mxs.h
 #include linux/clkdev.h
+#include linux/clk-provider.h
 #include linux/err.h
 #include linux/init.h
 #include linux/io.h
@@ -154,19 +155,17 @@ static enum imx28_clk clks_init_on[] __initdata = {
cpu, hbus, xbus, emi, uart,
 };
 
-int __init mx28_clocks_init(void)
+void __init mx28_clocks_init(struct device_node *np)
 {
-   struct device_node *np;
u32 i;
 
+   clkctrl = of_iomap(np, 0);
+   WARN_ON(!clkctrl);
+
np = of_find_compatible_node(NULL, NULL, fsl,imx28-digctl);
digctrl = of_iomap(np, 0);
WARN_ON(!digctrl);
 
-   np = of_find_compatible_node(NULL, NULL, fsl,imx28-clkctrl);
-   clkctrl = of_iomap(np, 0);
-   WARN_ON(!clkctrl);
-
clk_misc_init();
 
clks[ref_xtal] = mxs_clk_fixed(ref_xtal, 2400);
@@ -239,7 +238,7 @@ int __init mx28_clocks_init(void)
if (IS_ERR(clks[i])) {
pr_err(i.MX28 clk %d: register failed with %ld\n,
i, PTR_ERR(clks[i]));
-   return PTR_ERR(clks[i]);
+   return;
}
 
clk_data.clks = clks;
@@ -251,5 +250,6 @@ int __init mx28_clocks_init(void)
for (i = 0

[RFC 06/17] ARM: imx: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- Although mx5_clocks_common_init() is shared with non-DT, removing
  of_clk_init(NULL) should be fine, as it only registers DT clk providers.
- For imx6q, printing of silicon revision has been moved from .init_time
  to .init_machine hook.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Sascha Hauer ker...@pengutronix.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-imx/clk-imx51-imx53.c |   12 
 arch/arm/mach-imx/common.h  |2 --
 arch/arm/mach-imx/imx51-dt.c|6 --
 arch/arm/mach-imx/mach-imx53.c  |6 --
 arch/arm/mach-imx/mach-imx6q.c  |   14 +++---
 arch/arm/mach-imx/mach-imx6sl.c |7 ---
 arch/arm/mach-imx/mach-vf610.c  |9 -
 7 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c 
b/arch/arm/mach-imx/clk-imx51-imx53.c
index 1a56a33..5955a54 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -131,8 +131,6 @@ static void __init mx5_clocks_common_init(unsigned long 
rate_ckil,
 {
int i;
 
-   of_clk_init(NULL);
-
clk[dummy] = imx_clk_fixed(dummy, 0);
clk[ckil] = imx_obtain_fixed_clock(ckil, rate_ckil);
clk[osc] = imx_obtain_fixed_clock(osc, rate_osc);
@@ -569,13 +567,3 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
 
return 0;
 }
-
-int __init mx51_clocks_init_dt(void)
-{
-   return mx51_clocks_init(0, 0, 0, 0);
-}
-
-int __init mx53_clocks_init_dt(void)
-{
-   return mx53_clocks_init(0, 0, 0, 0);
-}
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd7..0ce8313 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -68,8 +68,6 @@ extern int mx53_clocks_init(unsigned long ckil, unsigned long 
osc,
 extern int mx25_clocks_init_dt(void);
 extern int mx27_clocks_init_dt(void);
 extern int mx31_clocks_init_dt(void);
-extern int mx51_clocks_init_dt(void);
-extern int mx53_clocks_init_dt(void);
 extern struct platform_device *mxc_register_gpio(char *name, int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
 extern void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e5..bece8a6 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata = {
NULL
 };
 
-static void __init imx51_timer_init(void)
-{
-   mx51_clocks_init_dt();
-}
-
 DT_MACHINE_START(IMX51_DT, Freescale i.MX51 (Device Tree Support))
.map_io = mx51_map_io,
.init_early = imx51_init_early,
.init_irq   = mx51_init_irq,
.handle_irq = imx51_handle_irq,
-   .init_time  = imx51_timer_init,
.init_machine   = imx51_dt_init,
.init_late  = imx51_init_late,
.dt_compat  = imx51_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 98c5894..c9c4d8d 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -36,17 +36,11 @@ static const char *imx53_dt_board_compat[] __initdata = {
NULL
 };
 
-static void __init imx53_timer_init(void)
-{
-   mx53_clocks_init_dt();
-}
-
 DT_MACHINE_START(IMX53_DT, Freescale i.MX53 (Device Tree Support))
.map_io = mx53_map_io,
.init_early = imx53_init_early,
.init_irq   = mx53_init_irq,
.handle_irq = imx53_handle_irq,
-   .init_time  = imx53_timer_init,
.init_machine   = imx53_dt_init,
.init_late  = imx53_init_late,
.dt_compat  = imx53_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index b605098..ad71738 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -11,9 +11,7 @@
  */
 
 #include linux/clk.h
-#include linux/clk-provider.h
 #include linux/clkdev.h
-#include linux/clocksource.h
 #include linux/cpu.h
 #include linux/delay.h
 #include linux/export.h
@@ -192,6 +190,9 @@ static void __init imx6q_1588_init(void)
 
 static void __init imx6q_init_machine(void)
 {
+   imx_print_silicon_rev(cpu_is_imx6dl() ? i.MX6DL : i.MX6Q,
+ imx6q_revision());
+
imx6q_enet_phy_init();
 
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@ -289,14 +290,6 @@ static void __init imx6q_init_irq(void)
irqchip_init();
 }
 
-static void __init imx6q_timer_init(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-   imx_print_silicon_rev(cpu_is_imx6dl

[RFC 10/17] ARM: nspire: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-nspire/nspire.c |9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
index 99e2609..4b2ed2e 100644
--- a/arch/arm/mach-nspire/nspire.c
+++ b/arch/arm/mach-nspire/nspire.c
@@ -14,11 +14,9 @@
 #include linux/of_platform.h
 #include linux/irqchip.h
 #include linux/irqchip/arm-vic.h
-#include linux/clk-provider.h
 #include linux/clkdev.h
 #include linux/amba/bus.h
 #include linux/amba/clcd.h
-#include linux/clocksource.h
 
 #include asm/mach/arch.h
 #include asm/mach-types.h
@@ -65,12 +63,6 @@ static void __init nspire_init(void)
nspire_auxdata, NULL);
 }
 
-static void __init nspire_init_time(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void nspire_restart(char mode, const char *cmd)
 {
void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
@@ -83,7 +75,6 @@ static void nspire_restart(char mode, const char *cmd)
 DT_MACHINE_START(NSPIRE, TI-NSPIRE)
.dt_compat  = nspire_dt_match,
.map_io = nspire_map_io,
-   .init_time  = nspire_init_time,
.init_machine   = nspire_init,
.restart= nspire_restart,
 MACHINE_END
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 08/17] ARM: mvebu: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- coherency, mbus, and cache init are moved to .init_machine hook
- time-armada-370-xp is converted to clocksource_of_init compatible init

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-mvebu/armada-370-xp.c  |   11 +--
 drivers/clocksource/time-armada-370-xp.c |7 +++
 include/linux/time-armada-370-xp.h   |   16 
 3 files changed, 4 insertions(+), 30 deletions(-)
 delete mode 100644 include/linux/time-armada-370-xp.h

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c 
b/arch/arm/mach-mvebu/armada-370-xp.c
index 829b573..139f572 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -14,11 +14,9 @@
 
 #include linux/kernel.h
 #include linux/init.h
-#include linux/clk-provider.h
 #include linux/of_address.h
 #include linux/of_platform.h
 #include linux/io.h
-#include linux/time-armada-370-xp.h
 #include linux/dma-mapping.h
 #include linux/mbus.h
 #include asm/hardware/cache-l2x0.h
@@ -34,19 +32,13 @@ static void __init armada_370_xp_map_io(void)
debug_ll_io_init();
 }
 
-static void __init armada_370_xp_timer_and_clk_init(void)
+static void __init armada_370_xp_dt_init(void)
 {
-   of_clk_init(NULL);
-   armada_370_xp_timer_init();
coherency_init();
BUG_ON(mvebu_mbus_dt_init());
 #ifdef CONFIG_CACHE_L2X0
l2x0_of_init(0, ~0UL);
 #endif
-}
-
-static void __init armada_370_xp_dt_init(void)
-{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
@@ -59,7 +51,6 @@ DT_MACHINE_START(ARMADA_XP_DT, Marvell Armada 370/XP (Device 
Tree))
.smp= smp_ops(armada_xp_smp_ops),
.init_machine   = armada_370_xp_dt_init,
.map_io = armada_370_xp_map_io,
-   .init_time  = armada_370_xp_timer_and_clk_init,
.restart= mvebu_restart,
.dt_compat  = armada_370_xp_dt_compat,
 MACHINE_END
diff --git a/drivers/clocksource/time-armada-370-xp.c 
b/drivers/clocksource/time-armada-370-xp.c
index 847cab6..67904cf 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -30,7 +30,6 @@
 #include linux/module.h
 #include linux/sched_clock.h
 #include linux/percpu.h
-#include linux/time-armada-370-xp.h
 
 /*
  * Timer block registers.
@@ -217,13 +216,11 @@ static struct notifier_block armada_370_xp_timer_cpu_nb = 
{
.notifier_call = armada_370_xp_timer_cpu_notify,
 };
 
-void __init armada_370_xp_timer_init(void)
+void __init armada_370_xp_timer_init(struct device_node *np)
 {
u32 u;
-   struct device_node *np;
int res;
 
-   np = of_find_compatible_node(NULL, NULL, marvell,armada-370-xp-timer);
timer_base = of_iomap(np, 0);
WARN_ON(!timer_base);
local_base = of_iomap(np, 1);
@@ -293,3 +290,5 @@ void __init armada_370_xp_timer_init(void)
if (!res)
armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
 }
+CLOCKSOURCE_OF_DECLARE(armada_370_xp_timer, marvell,armada-370-xp-timer,
+  armada_370_xp_timer_init);
diff --git a/include/linux/time-armada-370-xp.h 
b/include/linux/time-armada-370-xp.h
deleted file mode 100644
index 6fb0856..000
--- a/include/linux/time-armada-370-xp.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Marvell Armada 370/XP SoC timer handling.
- *
- * Copyright (C) 2012 Marvell
- *
- * Lior Amsalem al...@marvell.com
- * Gregory CLEMENT gregory.clem...@free-electrons.com
- * Thomas Petazzoni thomas.petazz...@free-electrons.com
- *
- */
-#ifndef __TIME_ARMADA_370_XPPRCMU_H
-#define __TIME_ARMADA_370_XPPRCMU_H
-
-void armada_370_xp_timer_init(void);
-
-#endif
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 11/17] ARM: rockchip: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-rockchip/rockchip.c |9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-rockchip/rockchip.c 
b/arch/arm/mach-rockchip/rockchip.c
index 724d2d8..82c0b07 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -19,18 +19,10 @@
 #include linux/init.h
 #include linux/of_platform.h
 #include linux/irqchip.h
-#include linux/dw_apb_timer.h
-#include linux/clk-provider.h
 #include asm/mach/arch.h
 #include asm/mach/map.h
 #include asm/hardware/cache-l2x0.h
 
-static void __init rockchip_timer_init(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void __init rockchip_dt_init(void)
 {
l2x0_of_init(0, ~0UL);
@@ -47,6 +39,5 @@ static const char * const rockchip_board_dt_compat[] = {
 
 DT_MACHINE_START(ROCKCHIP_DT, Rockchip Cortex-A9 (Device Tree))
.init_machine   = rockchip_dt_init,
-   .init_time  = rockchip_timer_init,
.dt_compat  = rockchip_board_dt_compat,
 MACHINE_END
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 04/17] ARM: exynos: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Kukjin Kim kgene@samsung.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-exynos/common.c  |7 ---
 arch/arm/mach-exynos/common.h  |1 -
 arch/arm/mach-exynos/mach-exynos4-dt.c |1 -
 arch/arm/mach-exynos/mach-exynos5-dt.c |1 -
 4 files changed, 10 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index ba95e5d..587625b 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -27,7 +27,6 @@
 #include linux/irqdomain.h
 #include linux/of_address.h
 #include linux/clocksource.h
-#include linux/clk-provider.h
 #include linux/irqchip/arm-gic.h
 #include linux/irqchip/chained_irq.h
 
@@ -367,12 +366,6 @@ static void __init exynos5_map_io(void)
iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
 }
 
-void __init exynos_init_time(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 struct bus_type exynos_subsys = {
.name   = exynos-core,
.dev_name   = exynos-core,
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 8646a14..f0fa205 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -16,7 +16,6 @@
 #include linux/of.h
 
 void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
-void exynos_init_time(void);
 
 struct map_desc;
 void exynos_init_io(void);
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c 
b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 0099c6c..7458dd4 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -54,7 +54,6 @@ DT_MACHINE_START(EXYNOS4210_DT, Samsung Exynos4 (Flattened 
Device Tree))
.init_early = exynos_firmware_init,
.init_machine   = exynos4_dt_machine_init,
.init_late  = exynos_init_late,
-   .init_time  = exynos_init_time,
.dt_compat  = exynos4_dt_compat,
.restart= exynos4_restart,
.reserve= exynos4_reserve,
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index f874b77..8829da2 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -76,7 +76,6 @@ DT_MACHINE_START(EXYNOS5_DT, SAMSUNG EXYNOS5 (Flattened 
Device Tree))
.map_io = exynos_init_io,
.init_machine   = exynos5_dt_machine_init,
.init_late  = exynos_init_late,
-   .init_time  = exynos_init_time,
.dt_compat  = exynos5_dt_compat,
.restart= exynos5_restart,
.reserve= exynos5_reserve,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 07/17] ARM: kirkwood: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Jason Cooper ja...@lakedaemon.net
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-kirkwood/board-dt.c |8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arm/mach-kirkwood/board-dt.c 
b/arch/arm/mach-kirkwood/board-dt.c
index 82d3ad8..a32a3e5 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -15,7 +15,6 @@
 #include linux/of.h
 #include linux/of_platform.h
 #include linux/clk-provider.h
-#include linux/clocksource.h
 #include linux/dma-mapping.h
 #include linux/irqchip.h
 #include linux/kexec.h
@@ -66,12 +65,6 @@ static void __init kirkwood_legacy_clk_init(void)
clk_prepare_enable(clk);
 }
 
-static void __init kirkwood_dt_time_init(void)
-{
-   of_clk_init(NULL);
-   clocksource_of_init();
-}
-
 static void __init kirkwood_dt_init_early(void)
 {
mvebu_mbus_init(marvell,kirkwood-mbus,
@@ -122,7 +115,6 @@ DT_MACHINE_START(KIRKWOOD_DT, Marvell Kirkwood (Flattened 
Device Tree))
/* Maintainer: Jason Cooper ja...@lakedaemon.net */
.map_io = kirkwood_map_io,
.init_early = kirkwood_dt_init_early,
-   .init_time  = kirkwood_dt_time_init,
.init_machine   = kirkwood_dt_init,
.restart= kirkwood_restart,
.dt_compat  = kirkwood_dt_board_compat,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC 05/17] ARM: highbank: remove custom .init_time hook

2013-08-19 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. Highbank clock provider need a reference
to system registers, as a workaround current clk driver maps those
independent of arch code now.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- I suggest to consolidate the four single clock providers into a single
  provider with one node if possible.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Rob Herring rob.herr...@calxeda.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-highbank/highbank.c |   23 +++
 drivers/clk/clk-highbank.c|   10 +++---
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-highbank/highbank.c 
b/arch/arm/mach-highbank/highbank.c
index 1894dcf..efa9496 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -27,7 +27,6 @@
 #include linux/of_address.h
 #include linux/smp.h
 #include linux/amba/bus.h
-#include linux/clk-provider.h
 
 #include asm/cacheflush.h
 #include asm/cputype.h
@@ -88,20 +87,6 @@ static void __init highbank_init_irq(void)
 #endif
 }
 
-static void __init highbank_timer_init(void)
-{
-   struct device_node *np;
-
-   /* Map system registers */
-   np = of_find_compatible_node(NULL, NULL, calxeda,hb-sregs);
-   sregs_base = of_iomap(np, 0);
-   WARN_ON(!sregs_base);
-
-   of_clk_init(NULL);
-
-   clocksource_of_init();
-}
-
 static void highbank_power_off(void)
 {
highbank_set_pwr_shutdown();
@@ -160,6 +145,13 @@ static struct notifier_block highbank_platform_nb = {
 
 static void __init highbank_init(void)
 {
+   struct device_node *np;
+
+   /* Map system registers */
+   np = of_find_compatible_node(NULL, NULL, calxeda,hb-sregs);
+   sregs_base = of_iomap(np, 0);
+   WARN_ON(!sregs_base);
+
pm_power_off = highbank_power_off;
highbank_pm_init();
 
@@ -181,7 +173,6 @@ DT_MACHINE_START(HIGHBANK, Highbank)
 #endif
.smp= smp_ops(highbank_smp_ops),
.init_irq   = highbank_init_irq,
-   .init_time  = highbank_timer_init,
.init_machine   = highbank_init,
.dt_compat  = highbank_match,
.restart= highbank_restart,
diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
index 2e08cb0..2e7e9d9 100644
--- a/drivers/clk/clk-highbank.c
+++ b/drivers/clk/clk-highbank.c
@@ -20,8 +20,7 @@
 #include linux/clk-provider.h
 #include linux/io.h
 #include linux/of.h
-
-extern void __iomem *sregs_base;
+#include linux/of_address.h
 
 #define HB_PLL_LOCK_5000x2000
 #define HB_PLL_LOCK0x1000
@@ -280,6 +279,7 @@ static __init struct clk *hb_clk_init(struct device_node 
*node, const struct clk
const char *clk_name = node-name;
const char *parent_name;
struct clk_init_data init;
+   struct device_node *srnp;
int rc;
 
rc = of_property_read_u32(node, reg, reg);
@@ -290,7 +290,11 @@ static __init struct clk *hb_clk_init(struct device_node 
*node, const struct clk
if (WARN_ON(!hb_clk))
return NULL;
 
-   hb_clk-reg = sregs_base + reg;
+   /* Map system registers */
+   srnp = of_find_compatible_node(NULL, NULL, calxeda,hb-sregs);
+   hb_clk-reg = of_iomap(srnp, 0);
+   BUG_ON(!hb_clk-reg);
+   hb_clk-reg += reg;
 
of_property_read_string(node, clock-output-names, clk_name);
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/2013 09:26 AM, Sascha Hauer wrote:

On Tue, Aug 20, 2013 at 04:04:20AM +0200, Sebastian Hesselbarth wrote:

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- Although mx5_clocks_common_init() is shared with non-DT, removing
   of_clk_init(NULL) should be fine, as it only registers DT clk providers.
- For imx6q, printing of silicon revision has been moved from .init_time
   to .init_machine hook.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Sascha Hauer ker...@pengutronix.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
  arch/arm/mach-imx/clk-imx51-imx53.c |   12 
  arch/arm/mach-imx/common.h  |2 --
  arch/arm/mach-imx/imx51-dt.c|6 --
  arch/arm/mach-imx/mach-imx53.c  |6 --
  arch/arm/mach-imx/mach-imx6q.c  |   14 +++---
  arch/arm/mach-imx/mach-imx6sl.c |7 ---
  arch/arm/mach-imx/mach-vf610.c  |9 -
  7 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c 
b/arch/arm/mach-imx/clk-imx51-imx53.c
index 1a56a33..5955a54 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -131,8 +131,6 @@ static void __init mx5_clocks_common_init(unsigned long 
rate_ckil,
  {
int i;

-   of_clk_init(NULL);
-
clk[dummy] = imx_clk_fixed(dummy, 0);
clk[ckil] = imx_obtain_fixed_clock(ckil, rate_ckil);
clk[osc] = imx_obtain_fixed_clock(osc, rate_osc);
@@ -569,13 +567,3 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,

return 0;
  }
-
-int __init mx51_clocks_init_dt(void)
-{
-   return mx51_clocks_init(0, 0, 0, 0);
-}
-
-int __init mx53_clocks_init_dt(void)
-{
-   return mx53_clocks_init(0, 0, 0, 0);
-}
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd7..0ce8313 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -68,8 +68,6 @@ extern int mx53_clocks_init(unsigned long ckil, unsigned long 
osc,
  extern int mx25_clocks_init_dt(void);
  extern int mx27_clocks_init_dt(void);
  extern int mx31_clocks_init_dt(void);
-extern int mx51_clocks_init_dt(void);
-extern int mx53_clocks_init_dt(void);
  extern struct platform_device *mxc_register_gpio(char *name, int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
  extern void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e5..bece8a6 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata = {
NULL
  };

-static void __init imx51_timer_init(void)
-{
-   mx51_clocks_init_dt();
-}
-
  DT_MACHINE_START(IMX51_DT, Freescale i.MX51 (Device Tree Support))
.map_io = mx51_map_io,
.init_early = imx51_init_early,
.init_irq   = mx51_init_irq,
.handle_irq = imx51_handle_irq,
-   .init_time  = imx51_timer_init,


On i.MX5 the init_time hook calls mx5x_clocks_init_dt which calls
mx5x_clocks_init which not only calls of_clk_init() but also registers
all clocks in the system. You can't remove it.

I am missing some

CLK_OF_DECLARE(imx51, fsl,imx51-ccm, imx51_clocks_init);
CLK_OF_DECLARE(imx53, fsl,imx53-ccm, imx53_clocks_init);

Somewhere.


Sascha,

you are right, I forgot to add the two lines above as replacement for
the now removed direct call. If the general approach is accepted, I'll
add them for sure.

Do imx51/imx53 still boot with CLK_OF_DECLARE added?

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/2013 11:10 AM, Sascha Hauer wrote:

On Tue, Aug 20, 2013 at 10:48:44AM +0200, Sebastian Hesselbarth wrote:

On 08/20/2013 09:26 AM, Sascha Hauer wrote:

On i.MX5 the init_time hook calls mx5x_clocks_init_dt which calls
mx5x_clocks_init which not only calls of_clk_init() but also registers
all clocks in the system. You can't remove it.

I am missing some

CLK_OF_DECLARE(imx51, fsl,imx51-ccm, imx51_clocks_init);
CLK_OF_DECLARE(imx53, fsl,imx53-ccm, imx53_clocks_init);

Somewhere.


Sascha,

you are right, I forgot to add the two lines above as replacement for
the now removed direct call. If the general approach is accepted, I'll
add them for sure.

Do imx51/imx53 still boot with CLK_OF_DECLARE added?


I can test this once the whole series arrived here. So far I only have
6/16 and 10/17. I probably need at least 1/17.


Yeah, I am having troubles with linux-arm-kernel rejecting my mails
because of a suspicious header. I have no clue, what has changed lately
with my mails sent by git send-email to make them get stuck.

I didn't add all sub-arch maintainers to the whole set, that would
have been simply too many.

You need patches [1], [2], and 6 for imx which I will send a v2 in
a second. Ok for you to get them from lkml?

Sebastian

[1] https://lkml.org/lkml/2013/8/19/591
[2] https://lkml.org/lkml/2013/8/19/592

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v2] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- Although mx5_clocks_common_init() is shared with non-DT, removing
  of_clk_init(NULL) should be fine, as it only registers DT clk providers.
- For imx6q, printing of silicon revision has been moved from .init_time
  to .init_machine hook.

Changelog:
v1-v2:
- added missing CLK_OF_DECLARE for imx51 and imx53 (Reported by Sascha Hauer)
  mx53_clocks_init can be converted as it is used DT only, mx51_clocks_init
  still is used by non-DT.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Sascha Hauer ker...@pengutronix.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-imx/clk-imx51-imx53.c |   29 ++---
 arch/arm/mach-imx/common.h  |4 
 arch/arm/mach-imx/imx51-dt.c|6 --
 arch/arm/mach-imx/mach-imx53.c  |6 --
 arch/arm/mach-imx/mach-imx6q.c  |   14 +++---
 arch/arm/mach-imx/mach-imx6sl.c |7 ---
 arch/arm/mach-imx/mach-vf610.c  |9 -
 7 files changed, 13 insertions(+), 62 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c 
b/arch/arm/mach-imx/clk-imx51-imx53.c
index 1a56a33..1b796db 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -11,6 +11,7 @@
 #include linux/clk.h
 #include linux/io.h
 #include linux/clkdev.h
+#include linux/clk-provider.h
 #include linux/of.h
 #include linux/err.h
 
@@ -131,8 +132,6 @@ static void __init mx5_clocks_common_init(unsigned long 
rate_ckil,
 {
int i;
 
-   of_clk_init(NULL);
-
clk[dummy] = imx_clk_fixed(dummy, 0);
clk[ckil] = imx_obtain_fixed_clock(ckil, rate_ckil);
clk[osc] = imx_obtain_fixed_clock(osc, rate_osc);
@@ -465,12 +464,16 @@ int __init mx51_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
return 0;
 }
 
-int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
-   unsigned long rate_ckih1, unsigned long rate_ckih2)
+static void __init mx51_clocks_init_dt(struct device_node *np)
+{
+   mx51_clocks_init(0, 0, 0, 0);
+}
+CLK_OF_DECLARE(imx51_ccm, fsl,imx51-ccm, mx51_clocks_init_dt);
+
+static void __init mx53_clocks_init(struct device_node *np)
 {
int i;
unsigned long r;
-   struct device_node *np;
 
clk[pll1_sw] = imx_clk_pllv2(pll1_sw, osc, MX53_DPLL1_BASE);
clk[pll2_sw] = imx_clk_pllv2(pll2_sw, osc, MX53_DPLL2_BASE);
@@ -529,12 +532,11 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
pr_err(i.MX53 clk %d: register failed with %ld\n,
i, PTR_ERR(clk[i]));
 
-   np = of_find_compatible_node(NULL, NULL, fsl,imx53-ccm);
clk_data.clks = clk;
clk_data.clk_num = ARRAY_SIZE(clk);
of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
 
-   mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
+   mx5_clocks_common_init(0, 0, 0, 0);
 
clk_register_clkdev(clk[vpu_gate], NULL, imx53-vpu.0);
clk_register_clkdev(clk[i2c3_gate], NULL, imx21-i2c.2);
@@ -566,16 +568,5 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
 
r = clk_round_rate(clk[usboh3_per_gate], 5400);
clk_set_rate(clk[usboh3_per_gate], r);
-
-   return 0;
-}
-
-int __init mx51_clocks_init_dt(void)
-{
-   return mx51_clocks_init(0, 0, 0, 0);
-}
-
-int __init mx53_clocks_init_dt(void)
-{
-   return mx53_clocks_init(0, 0, 0, 0);
 }
+CLK_OF_DECLARE(imx53_ccm, fsl,imx53-ccm, mx53_clocks_init);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd7..28e8ca0 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -63,13 +63,9 @@ extern int mx31_clocks_init(unsigned long fref);
 extern int mx35_clocks_init(void);
 extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
unsigned long ckih1, unsigned long ckih2);
-extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
-   unsigned long ckih1, unsigned long ckih2);
 extern int mx25_clocks_init_dt(void);
 extern int mx27_clocks_init_dt(void);
 extern int mx31_clocks_init_dt(void);
-extern int mx51_clocks_init_dt(void);
-extern int mx53_clocks_init_dt(void);
 extern struct platform_device *mxc_register_gpio(char *name, int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
 extern void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e5..bece8a6 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata

Re: [RFC 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/13 12:20, Russell King - ARM Linux wrote:

On Tue, Aug 20, 2013 at 11:20:06AM +0200, Sebastian Hesselbarth wrote:

Yeah, I am having troubles with linux-arm-kernel rejecting my mails
because of a suspicious header. I have no clue, what has changed lately
with my mails sent by git send-email to make them get stuck.


I believe David feels the same way as I do wrt thread hijacking on
mailing lists.  The problem is that it seems all too easy for people
to hit the reply button on some random message from the mailing list,
change the subject line, and then type an entirely new email into the
body not related to the message they hit reply on.

So, any message which doesn't look like it's a reply to the preceding
message gets held for moderation.  However, git came along and broke
that - because every patch sent as a threaded reply to a cover email
is effectively a hijack.  Therefore, there's an exception to this -
if the subject line starts with [PATCH then it will be allowed through.

This means if you want to send a RFC, it must be [PATCH RFC not just
[RFC, because [RFC isn't whitelisted.  Maybe it should be, but that
is David's decision now.


Russell,

I already guessed it has something to do with the In-reply-to line, as
only the patches but not the cover letter gets stuck. Thanks for
pointing me at the missing PATCH prefix and sorry for the noise on
the moderators screen.

For me it is fine not to expand the whitelist and after reading
SubmittingPatches again, it clearly says that RFC is just a tag to be
added after PATCH.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/13 12:42, Russell King - ARM Linux wrote:

On Tue, Aug 20, 2013 at 12:37:18PM +0200, Sebastian Hesselbarth wrote:

I already guessed it has something to do with the In-reply-to line, as
only the patches but not the cover letter gets stuck. Thanks for
pointing me at the missing PATCH prefix and sorry for the noise on
the moderators screen.


I just want to be clear about something there: I have nothing what so
ever to do with the running of these lists anymore.

While I may know some of the policies, that is as far as it goes; I
don't have any access to the admin or moderation side of these lists.



Small typo, huge difference: It should have been moderator's screen,
i.e. David's, of course.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 08/17] ARM: mvebu: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/13 14:50, Ezequiel Garcia wrote:

I've only received a few patches of this series. I *think*
using RFC alone is not correct in LAKML and for some reason
you're required to use RFC/PATCH.


Ezequiel,

we already sorted out, why they got stuck on LAKML. It is because
of the missing PATCH prefix, I'll add that in future postings for sure.

But the patches should have been managed to get through to LKML.


Maybe that's why I'm getting only the patches where I'm Cced?


I try to keep Cc list as short as possible, so I only put Gregory as the 
maintainer of mach-mvebu on Cc.



Could you please re-send this? The series looks promising and I'd like
to take a peep :-)


No, I am not going to resend v1 but only updates. For a single mach
you need patches [1], [2], and the one supposed for your mach.


BTW, some of this (but not all) has already been posted [1, 2] and
is on its way to v3.12 through Daniel Lezcano.

(Maybe you already noticed, but just in case...)

[1] http://www.spinics.net/lists/arm-kernel/msg265509.html
[2] http://comments.gmane.org/gmane.linux.ports.arm.kernel/260179


I expect machs to move until all of it has been Ack'ed, so I
based in on most recent tag of linux-next yesterday.

Sebastian

[1] https://lkml.org/lkml/2013/8/19/591
[2] https://lkml.org/lkml/2013/8/19/592

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 02/17] ARM: call clk_of_init from time_init

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/2013 05:46 PM, Stephen Warren wrote:

On 08/19/2013 08:04 PM, Sebastian Hesselbarth wrote:

Most DT ARM machs require common clock providers initialized before timers.
Currently, arch/arm machs use .init_time to call clk_of_init right before
clocksource_of_init. This prevents to remove that hook and use the default
hook instead. clk_of_init now checks for multiple calls to it, so add
the call to ARM arch time_init by default.


Some SoCs call this function in .init_irq() rather than .init_time().
Perhaps we adjust this patch to do that instead. That way, we can
presumably get rid of patch 1/17 since we can eliminate any duplicate
calls, and adjust patch 14/17 (Tegra board file) to remove its custom
call to of_clock_init(NULL)?


Currently as of -next from yesterday, only tegra is requiring clocks
that early, while others are fine with them close to timers. I really
have no strong opinion on that. That decision should rather be made
by those with a far more complete insight of the consequences than I
have.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 05/17] ARM: highbank: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/2013 09:12 PM, Rob Herring wrote:

On 08/19/2013 09:04 PM, Sebastian Hesselbarth wrote:

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. Highbank clock provider need a reference
to system registers, as a workaround current clk driver maps those
independent of arch code now.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- I suggest to consolidate the four single clock providers into a single
   provider with one node if possible.


And how do you suggest doing that while maintaining the DT ABI?


Rob,

I am aware of ABI status of the DT bindings and the discussion about
deprecating/cleanup of what went in in the past. Maybe suggest is a
little bit too strong and should have been would be nice to have.

But looking at clk-highbank, all providers depend on the same register.
If you'd introduce e.g. a new calxeda,core-clocks that sets up the
four providers and also CLK_OF_DECLARE the same init with one out of
the  four existing compatibles shouldn't that maintain backwards
compatibility?

Anyway, I was just puting the note above to raise some comment on it.
You actually gave a good one to leave it as is.


---
  arch/arm/mach-highbank/highbank.c |   23 +++
  drivers/clk/clk-highbank.c|   10 +++---
  2 files changed, 14 insertions(+), 19 deletions(-)


Acked-by: Rob Herring rob.herr...@calxeda.com


Ok, I keep that in mind until all other issues are resolved.

Thanks,
  Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 02/17] ARM: call clk_of_init from time_init

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/2013 09:52 PM, Stephen Warren wrote:

On 08/20/2013 01:47 PM, Sebastian Hesselbarth wrote:

On 08/20/2013 05:46 PM, Stephen Warren wrote:

Some SoCs call this function in .init_irq() rather than .init_time().
Perhaps we adjust this patch to do that instead. That way, we can
presumably get rid of patch 1/17 since we can eliminate any duplicate
calls, and adjust patch 14/17 (Tegra board file) to remove its custom
call to of_clock_init(NULL)?


Currently as of -next from yesterday, only tegra is requiring clocks
that early, while others are fine with them close to timers. I really
have no strong opinion on that. That decision should rather be made
by those with a far more complete insight of the consequences than I
have.


Perhaps if Tegra is a special-case, it shouldn't rely on the generic
init_time() callback, and hence you could still eliminate patch 1/17?



Perhaps Tegra is the common case but other SoC haven't dug deep enough?
IMHO from a HW point-of-view clocks are really among the essential
things that need to be running before you can do anything useful.

Just consider boot loaders that run fine without irqs but don't without
clocks (even if just represented by API). Maybe you are right, and we
should call of_clk_init(NULL) as early as possible. That would also
eliminate patch 1/17 as you suggest.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/9] PCI: mvebu: add support for reset on GPIO

2013-08-13 Thread Sebastian Hesselbarth

[Added DT maintainers directly for a question below]

On 08/13/13 02:56, Kumar Gala wrote:

On Aug 12, 2013, at 1:46 PM, Sebastian Hesselbarth wrote:


This patch adds a check for DT passed reset-gpios property and deasserts/
asserts reset pin on probe/remove with configurable delay. Corresponding
binding documentation is also updated.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com

[...]

diff --git a/Documentation/devicetree/bindings/pci/mvebu-pci.txt 
b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
index 638673a..f2fa261 100644
--- a/Documentation/devicetree/bindings/pci/mvebu-pci.txt
+++ b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
@@ -76,6 +76,8 @@ and the following optional properties:
- marvell,pcie-lane: the physical PCIe lane number, for ports having
   multiple lanes. If this property is not found, we assume that the
   value is 0.
+- reset-gpios: optional gpio to PERST#
+- reset-delay-ms: delay in ms to wait after reset de-assertion


Both of these should probably be marvell,reset...


Kumar,

as Thomas already mentioned, non-prefixed foo-gpios are quite common.
As reset gpios are likely to be common among SoC pci controller setups,
I though I'd stick with the non-prefixed property. But I have no strong
opinion about it - but let's see how DT jurisdiction will vote :)


Does reset-delay-ms vary per board? I can't remember where the

discussion got to about configuration info.

Hmm, for Dove SoC, I only have one board to test - but the driver
currently is for 4 different SoCs. I just did some quick evaluation
of the reset delay required to bring up the device on the D3Plug.
Using 10ms was too short, 20ms worked.

I guess there will be other SoC/boards requiring different delays
but I am fine with hardcoded 20ms and re-introduce reset-delay property
only if it is really required. The driver's default is 20ms anyway.



Example:


It's usually good to update example to show all optional properties.


Ok, will add the properties to one of the example ports.

Thanks,

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/9] PCI: mvebu: move clock enable before register access

2013-08-13 Thread Sebastian Hesselbarth

On 08/13/13 09:11, Thomas Petazzoni wrote:

On Mon, 12 Aug 2013 20:46:47 +0200, Sebastian Hesselbarth wrote:

+   port-clk = of_clk_get_by_name(child, NULL);
+   if (IS_ERR(port-clk)) {
+   dev_err(pdev-dev, PCIe%d.%d: cannot get clock\n,
+  port-port, port-lane);
+   iounmap(port-base);


You shouldn't iounmap() here in case of error, since the register
mapping hasn't been done yet.


Dooh, it was in my testing branch, but I failed to transfer that when
separating the changes to single patches. Will update.


+   port-haslink = 0;
+   continue;
+   }
+   clk_prepare_enable(port-clk);


Nitpick, an empty new line between the closing } and the
clk_prepare_enable() line would be nice.


Ok, as Theirry mentioned to check for clk_prepare_enable's return value
that would give a new if (..) anyway. Although, it might be the first
driver ever checking for this return value ;)


+
port-base = mvebu_pcie_map_registers(pdev, child, port);
if (!port-base) {
dev_err(pdev-dev, PCIe%d.%d: cannot map registers\n,
@@ -916,22 +926,9 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
 port-port, port-lane);


and maybe here you could unprepare+release the clock if we haven't
managed to remap registers?


Ack.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/9] PCI: mvebu: increment nports only for registered ports

2013-08-13 Thread Sebastian Hesselbarth

On 08/13/13 09:15, Thomas Petazzoni wrote:

Dear Sebastian Hesselbarth,

On Mon, 12 Aug 2013 20:46:48 +0200, Sebastian Hesselbarth wrote:


diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index d5fe674..0a359d7 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -842,21 +842,21 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
return ret;
}

+   i = 0;
for_each_child_of_node(pdev-dev.of_node, child) {
if (!of_device_is_available(child))
continue;
-   pcie-nports++;
+   i++;
}

-   pcie-ports = devm_kzalloc(pdev-dev, pcie-nports *
+   pcie-ports = devm_kzalloc(pdev-dev, i *
   sizeof(struct mvebu_pcie_port),
   GFP_KERNEL);
if (!pcie-ports)
return -ENOMEM;

-   i = 0;
for_each_child_of_node(pdev-dev.of_node, child) {
-   struct mvebu_pcie_port *port = pcie-ports[i];
+   struct mvebu_pcie_port *port = pcie-ports[pcie-nports];

if (!of_device_is_available(child))
continue;
@@ -929,7 +929,7 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
port-dn = child;
spin_lock_init(port-conf_lock);
mvebu_sw_pci_bridge_init(port);
-   i++;
+   pcie-nports++;
}


I think I'd prefer using 'i' in this loop, and then after the loop have
a:

pcie-nports = i;

assignment. That's nitpicking, but I don't like the fact that within
the loop 'pcie-nports' doesn't mean Number of enabled PCIe ports,
but means Last enabled PCIe port.


Ok, I'll use 'i' in both loops and assign it like you suggested.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/9] PCI: mvebu: remove subsys_initcall

2013-08-13 Thread Sebastian Hesselbarth

On 08/13/13 10:06, Thierry Reding wrote:

On Tue, Aug 13, 2013 at 09:19:59AM +0200, Thomas Petazzoni wrote:

On Mon, 12 Aug 2013 20:46:49 +0200, Sebastian Hesselbarth wrote:

This removes the subsys_initcall from the driver and converts it to
a normal platform_driver. Also, drvdata is set and a remove functions
is added to disable the clock and free resources.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com


I'm OK with this, just a comment below.


+static int mvebu_pcie_remove(struct platform_device *pdev)
+{
+   struct mvebu_pcie *pcie = platform_get_drvdata(pdev);
+   struct mvebu_pcie_port *port = pcie-ports[0];
+   int i;
+
+   for (i = 0; i  pcie-nports; i++, port++) {
+   clk_disable_unprepare(port-clk);
+   kfree(port-name);
+   }
+
+   return 0;
+}


I believe the -remove() part is quite useless. The driver is a 'bool'
in Kconfig, so it cannot be compiled as a module, and I'm not sure
there a way to remove the platform device that corresponds to the PCIe
controller.


There is. You can write the device's name to the driver's unbind file in
sysfs. What I ended up doing for Tegra was not to provide a .remove() at
all and set the struct device_driver's .suppress_bind_attrs to true.

[...]

That said, I agree with Thomas that it's not useful (and potentially
even dangerous) to add the .remove() at this point in time.


Thierry, Thomas,

I will not introduce the .remove and set .suppress_bind_attrs = true as
Thierry suggested.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/9] PCI: mvebu: add support for reset on GPIO

2013-08-13 Thread Sebastian Hesselbarth

On 08/13/13 12:03, Thierry Reding wrote:

On Tue, Aug 13, 2013 at 10:30:30AM +0200, Thomas Petazzoni wrote:

Dear Thierry Reding,

On Tue, 13 Aug 2013 10:09:56 +0200, Thierry Reding wrote:


+- reset-gpios: optional gpio to PERST#
+- reset-delay-ms: delay in ms to wait after reset de-assertion


I remember some recent discussion about this, and we now have this reset
framework, so perhaps it makes more sense to use the reset binding for
this? Cc'ing Stephen (as part of the device tree bindings maintainers
team) who was involved in that recent reset bindings discussion.


I also thought about this, but the reset framework seems to be designed
for reset controller IPs, i.e special IPs that are controlling reset
signals. Looking at Documentation/devicetree/bindings/reset/reset.txt,
I'm not sure to see how this would apply to GPIO-controlled reset
signals.


See:


http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg36900.html

which seems to have carried over to this at some point:

http://www.spinics.net/lists/devicetree/msg00521.html

Some of the messages in between I can't find in any archive, sorry.


Thierry, Sascha,

thanks for the input. Flipping through the above discussion, I guess
using reset-gpios and reset-delay-us should be fine?

I can also remove the delay property for now, as I cannot find a final
conclusion about the configurable delay.

In the driver, I will stick to bare gpiolib and wait for gpio-reset
driver to become available. Currently, we don't have sophisticated
reset handling in pci-mvebu anyway.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/9] ARM: dove: add PCIe controllers to SoC DT

2013-08-13 Thread Sebastian Hesselbarth

On 08/12/13 22:04, Jason Cooper wrote:

On Mon, Aug 12, 2013 at 08:46:53PM +0200, Sebastian Hesselbarth wrote:

This adds a node for the pcie controllers found on Dove SoCs to the
SoC DT include.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
---
  arch/arm/boot/dts/dove.dtsi |   54 +++
  1 file changed, 54 insertions(+)


patches 7-9 applied to mvebu/dove_mbus since the dependencies are
cleaner that way.


Jason,

I will have to slightly modify the reset-gpio property names and that
requires a fixup patch for patch 8. Can you still squash it or do you
need a proper patch?

Sebastian

---


diff --git a/arch/arm/boot/dts/dove-d3plug.dts b/arch/arm/boot/dts/dove-d3plug.dts
index ead90eb..f5f59bb 100644
--- a/arch/arm/boot/dts/dove-d3plug.dts
+++ b/arch/arm/boot/dts/dove-d3plug.dts
@@ -91,7 +91,7 @@
 	pcie-port@0 {
 		status = okay;
 		reset-gpios = gpio0 26 1;
-		reset-delay-ms = 20;
+		reset-delay-us = 2;
 		pinctrl-0 = pmx_camera_gpio;
 		pinctrl-names = default;
 	};


[PATCH v2 3/5] PCI: mvebu: remove subsys_initcall

2013-08-13 Thread Sebastian Hesselbarth
This removes the subsys_initcall from the driver and converts it to
a normal platform_driver. Also, drvdata is set and a remove functions
is added to disable the clock and free resources. As pci driver removal
currently is not supported, set .suppress_bind_attrs to permit unbinding.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- do not add .remove and set .suppress_bind_attrs to permit currently
  unsupported driver unloading/unbinding (Reported by Thierry Reding and
  Thomas Petazzoni)
- Note: I left the platform_set_drvdata(), as we will require that later
  for device removal.

Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Bjorn Helgaas bhelg...@google.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Thierry Reding thierry.red...@gmail.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-...@vger.kernel.org
---
 drivers/pci/host/pci-mvebu.c |   33 ++---
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index d2e9ae7..bd7092a 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -165,7 +165,7 @@ static void mvebu_pcie_set_local_dev_nr(struct 
mvebu_pcie_port *port, int nr)
  * BAR[0,2] - disabled, BAR[1] - covers all DRAM banks
  * WIN[0-3] - DRAM bank[0-3]
  */
-static void __init mvebu_pcie_setup_wins(struct mvebu_pcie_port *port)
+static void mvebu_pcie_setup_wins(struct mvebu_pcie_port *port)
 {
const struct mbus_dram_target_info *dram;
u32 size;
@@ -217,7 +217,7 @@ static void __init mvebu_pcie_setup_wins(struct 
mvebu_pcie_port *port)
   port-base + PCIE_BAR_CTRL_OFF(1));
 }
 
-static void __init mvebu_pcie_setup_hw(struct mvebu_pcie_port *port)
+static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port)
 {
u16 cmd;
u32 mask;
@@ -628,7 +628,7 @@ static struct pci_ops mvebu_pcie_ops = {
.write = mvebu_pcie_wr_conf,
 };
 
-static int __init mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
+static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 {
struct mvebu_pcie *pcie = sys_to_pcie(sys);
int i;
@@ -647,7 +647,7 @@ static int __init mvebu_pcie_setup(int nr, struct 
pci_sys_data *sys)
return 1;
 }
 
-static int __init mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 
pin)
+static int mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 {
struct of_irq oirq;
int ret;
@@ -704,7 +704,7 @@ resource_size_t mvebu_pcie_align_resource(struct pci_dev 
*dev,
return start;
 }
 
-static void __init mvebu_pcie_enable(struct mvebu_pcie *pcie)
+static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 {
struct hw_pci hw;
 
@@ -727,10 +727,8 @@ static void __init mvebu_pcie_enable(struct mvebu_pcie 
*pcie)
  * ... property for one that matches the given port/lane. Once
  * found, maps it.
  */
-static void __iomem * __init
-mvebu_pcie_map_registers(struct platform_device *pdev,
-struct device_node *np,
-struct mvebu_pcie_port *port)
+static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
+ struct device_node *np, struct mvebu_pcie_port *port)
 {
struct resource regs;
int ret = 0;
@@ -786,7 +784,7 @@ static int mvebu_get_tgt_attr(struct device_node *np, int 
devfn,
return -ENOENT;
 }
 
-static void __init mvebu_pcie_msi_enable(struct mvebu_pcie *pcie)
+static void mvebu_pcie_msi_enable(struct mvebu_pcie *pcie)
 {
struct device_node *msi_node;
 
@@ -801,7 +799,7 @@ static void __init mvebu_pcie_msi_enable(struct mvebu_pcie 
*pcie)
pcie-msi-dev = pcie-pdev-dev;
 }
 
-static int __init mvebu_pcie_probe(struct platform_device *pdev)
+static int mvebu_pcie_probe(struct platform_device *pdev)
 {
struct mvebu_pcie *pcie;
struct device_node *np = pdev-dev.of_node;
@@ -814,6 +812,7 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
return -ENOMEM;
 
pcie-pdev = pdev;
+   platform_set_drvdata(pdev, pcie);
 
/* Get the PCIe memory and I/O aperture */
mvebu_mbus_get_pcie_mem_aperture(pcie-mem);
@@ -956,16 +955,12 @@ static struct platform_driver mvebu_pcie_driver = {
.name = mvebu-pcie,
.of_match_table =
   of_match_ptr(mvebu_pcie_of_match_table),
+   /* driver unloading/unbinding currently not supported */
+   .suppress_bind_attrs = true,
},
+   .probe = mvebu_pcie_probe,
 };
-
-static int __init mvebu_pcie_init(void)
-{
-   return platform_driver_probe(mvebu_pcie_driver,
-mvebu_pcie_probe);
-}
-
-subsys_initcall(mvebu_pcie_init);
+module_platform_driver

[PATCH v2 5/5] PCI: mvebu: add support for Marvell Dove SoCs

2013-08-13 Thread Sebastian Hesselbarth
This patch adds a compatible for the PCIe controller found on Marvell
Dove SoCs. Binding documentation and Kconfig entry are also updated.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- nothing changed

Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Bjorn Helgaas bhelg...@google.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-...@vger.kernel.org
---
 Documentation/devicetree/bindings/pci/mvebu-pci.txt |1 +
 drivers/pci/host/Kconfig|2 +-
 drivers/pci/host/pci-mvebu.c|1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pci/mvebu-pci.txt 
b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
index 8bb3245..08c716b 100644
--- a/Documentation/devicetree/bindings/pci/mvebu-pci.txt
+++ b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
@@ -5,6 +5,7 @@ Mandatory properties:
 - compatible: one of the following values:
 marvell,armada-370-pcie
 marvell,armada-xp-pcie
+marvell,dove-pcie
 marvell,kirkwood-pcie
 - #address-cells, set to 3
 - #size-cells, set to 2
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index 1184ff6..492eec9 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -3,7 +3,7 @@ menu PCI host controller drivers
 
 config PCI_MVEBU
bool Marvell EBU PCIe controller
-   depends on ARCH_MVEBU || ARCH_KIRKWOOD
+   depends on ARCH_MVEBU || ARCH_DOVE || ARCH_KIRKWOOD
 
 config PCIE_DW
bool
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index a9ad4b3..88c6790 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -975,6 +975,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 static const struct of_device_id mvebu_pcie_of_match_table[] = {
{ .compatible = marvell,armada-xp-pcie, },
{ .compatible = marvell,armada-370-pcie, },
+   { .compatible = marvell,dove-pcie, },
{ .compatible = marvell,kirkwood-pcie, },
{},
 };
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/5] PCI: mvebu: increment nports only for registered ports

2013-08-13 Thread Sebastian Hesselbarth
The number of ports is probed by counting the number of available child nodes.
Later on, the registration of a port can fail and cause a mismatch between
the -nports counter and registered ports. This patch modifies the counting
strategy, to make -nports represent the number of registered ports instead
of the number of available childs.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- also use 'i' as iterator during port parsing and assign at the end of
  probing (Reported by Thomas Pettazoni)

Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Bjorn Helgaas bhelg...@google.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-...@vger.kernel.org
---
 drivers/pci/host/pci-mvebu.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1533fda..d2e9ae7 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -842,13 +842,14 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
return ret;
}
 
+   i = 0;
for_each_child_of_node(pdev-dev.of_node, child) {
if (!of_device_is_available(child))
continue;
-   pcie-nports++;
+   i++;
}
 
-   pcie-ports = devm_kzalloc(pdev-dev, pcie-nports *
+   pcie-ports = devm_kzalloc(pdev-dev, i *
   sizeof(struct mvebu_pcie_port),
   GFP_KERNEL);
if (!pcie-ports)
@@ -934,8 +935,8 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
i++;
}
 
+   pcie-nports = i;
mvebu_pcie_msi_enable(pcie);
-
mvebu_pcie_enable(pcie);
 
return 0;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/5] ARM: dove: DT PCIe support

2013-08-13 Thread Sebastian Hesselbarth
This patch set adds support for the PCIe controllers found on Marvell
Dove SoCs. It depends on mvebu-pci patches sent by Thomas Petazzoni.
The ARM Dove related patches have already been taken by Jason Cooper
and have been removed from v2 of this patch set. Changelog is added
to the individual patch emails.

Patches 1 and 2 fix some minor issues with pci-mvebu by moving
clk_prepare_enable before accessing any controller registers and
counting sucessfully registered ports only.

Patch 3 converts pci-mvebu from subsys_initcall registration to
normal platform driver registration to allow it to fail with
EPROBE_DEFER later.

Patch 4 adds DT parsing for reset (PERST#) GPIO pins and delay to
wait for PCIe devices after reset de-assertion.

Patch 5 finally adds a compatible to pci-mvebu for Dove SoCs.

[Patch 6-9 have already been taken by Jason Cooper]

Sebastian Hesselbarth (5):
  PCI: mvebu: move clock enable before register access
  PCI: mvebu: increment nports only for registered ports
  PCI: mvebu: remove subsys_initcall
  PCI: mvebu: add support for reset on GPIO
  PCI: mvebu: add support for Marvell Dove SoCs

 .../devicetree/bindings/pci/mvebu-pci.txt  |7 ++
 drivers/pci/host/Kconfig   |2 +-
 drivers/pci/host/pci-mvebu.c   |   99 +---
 3 files changed, 71 insertions(+), 37 deletions(-)

---
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Bjorn Helgaas bhelg...@google.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Thierry Reding thierry.red...@gmail.com
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-...@vger.kernel.org
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/5] PCI: mvebu: move clock enable before register access

2013-08-13 Thread Sebastian Hesselbarth
The clock passed to PCI controller found on MVEBU SoCs may come from a
clock gate. This requires the clock to be enabled before any registers
are accessed. Therefore, move the clock enable before register iomap to
ensure it is enabled.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- remove iounmap, add clk_disable_unprepare on failure
  (Reported by Thomas Pettazoni)

Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Bjorn Helgaas bhelg...@google.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Thierry Reding thierry.red...@gmail.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-...@vger.kernel.org
---
 drivers/pci/host/pci-mvebu.c |   25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 6aa0daf..1533fda 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -897,10 +897,22 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
continue;
}
 
+   port-clk = of_clk_get_by_name(child, NULL);
+   if (IS_ERR(port-clk)) {
+   dev_err(pdev-dev, PCIe%d.%d: cannot get clock\n,
+  port-port, port-lane);
+   continue;
+   }
+
+   ret = clk_prepare_enable(port-clk);
+   if (ret)
+   continue;
+
port-base = mvebu_pcie_map_registers(pdev, child, port);
if (!port-base) {
dev_err(pdev-dev, PCIe%d.%d: cannot map registers\n,
port-port, port-lane);
+   clk_disable_unprepare(port-clk);
continue;
}
 
@@ -916,22 +928,9 @@ static int __init mvebu_pcie_probe(struct platform_device 
*pdev)
 port-port, port-lane);
}
 
-   port-clk = of_clk_get_by_name(child, NULL);
-   if (IS_ERR(port-clk)) {
-   dev_err(pdev-dev, PCIe%d.%d: cannot get clock\n,
-  port-port, port-lane);
-   iounmap(port-base);
-   port-haslink = 0;
-   continue;
-   }
-
port-dn = child;
-
-   clk_prepare_enable(port-clk);
spin_lock_init(port-conf_lock);
-
mvebu_sw_pci_bridge_init(port);
-
i++;
}
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/5] PCI: mvebu: add support for reset on GPIO

2013-08-13 Thread Sebastian Hesselbarth
This patch adds a check for DT passed reset-gpios property and deasserts/
asserts reset pin on probe/remove with configurable delay. Corresponding
binding documentation is also updated.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- use reset API compatible bindings (Reported by Kumar Gala and Thierry
  Reding)
- add gpio properties to DT examples (Reported by Kumar Gala)
- only fail (return) on EPROBE_DEFER and skip port parsing otherwise
- use us delay instead of ms delay

Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Bjorn Helgaas bhelg...@google.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Thierry Reding thierry.red...@gmail.com
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-...@vger.kernel.org
---
 .../devicetree/bindings/pci/mvebu-pci.txt  |6 
 drivers/pci/host/pci-mvebu.c   |   33 +++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pci/mvebu-pci.txt 
b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
index 638673a..8bb3245 100644
--- a/Documentation/devicetree/bindings/pci/mvebu-pci.txt
+++ b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
@@ -76,6 +76,8 @@ and the following optional properties:
 - marvell,pcie-lane: the physical PCIe lane number, for ports having
   multiple lanes. If this property is not found, we assume that the
   value is 0.
+- reset-gpios: optional gpio to PERST#
+- reset-delay-us: delay in us to wait after reset de-assertion
 
 Example:
 
@@ -138,6 +140,10 @@ pcie-controller {
interrupt-map = 0 0 0 0 mpic 58;
marvell,pcie-port = 0;
marvell,pcie-lane = 0;
+   /* low-active PERST# reset on GPIO 25 */
+   reset-gpios = gpio0 25 1;
+   /* wait 20ms for device settle after reset deassertion */
+   reset-delay-us = 2;
clocks = gateclk 5;
status = disabled;
};
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index bd7092a..a9ad4b3 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -9,14 +9,17 @@
 #include linux/kernel.h
 #include linux/pci.h
 #include linux/clk.h
+#include linux/delay.h
+#include linux/gpio.h
 #include linux/module.h
 #include linux/mbus.h
 #include linux/msi.h
 #include linux/slab.h
 #include linux/platform_device.h
 #include linux/of_address.h
-#include linux/of_pci.h
 #include linux/of_irq.h
+#include linux/of_gpio.h
+#include linux/of_pci.h
 #include linux/of_platform.h
 
 /*
@@ -126,6 +129,9 @@ struct mvebu_pcie_port {
unsigned int io_target;
unsigned int io_attr;
struct clk *clk;
+   int reset_gpio;
+   int reset_active_low;
+   char *reset_name;
struct mvebu_sw_pci_bridge bridge;
struct device_node *dn;
struct mvebu_pcie *pcie;
@@ -857,6 +863,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
i = 0;
for_each_child_of_node(pdev-dev.of_node, child) {
struct mvebu_pcie_port *port = pcie-ports[i];
+   enum of_gpio_flags flags;
 
if (!of_device_is_available(child))
continue;
@@ -897,6 +904,30 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
continue;
}
 
+   port-reset_gpio = of_get_named_gpio_flags(child,
+  reset-gpios, 0, flags);
+   if (gpio_is_valid(port-reset_gpio)) {
+   u32 reset_udelay = 2;
+
+   port-reset_active_low = flags  OF_GPIO_ACTIVE_LOW;
+   port-reset_name = kasprintf(GFP_KERNEL,
+pcie%d.%d-reset, port-port, port-lane);
+   of_property_read_u32(child, reset-delay-us,
+reset_udelay);
+
+   ret = devm_gpio_request_one(pdev-dev,
+   port-reset_gpio, GPIOF_DIR_OUT, port-reset_name);
+   if (ret) {
+   if (ret == -EPROBE_DEFER)
+   return ret;
+   continue;
+   }
+
+   gpio_set_value(port-reset_gpio,
+  (port-reset_active_low) ? 1 : 0);
+   udelay(reset_udelay);
+   }
+
port-clk = of_clk_get_by_name(child, NULL);
if (IS_ERR(port-clk)) {
dev_err(pdev-dev, PCIe%d.%d: cannot get clock\n,
-- 
1.7.10.4

--
To unsubscribe from this list

Re: [PATCH v2 4/5] PCI: mvebu: add support for reset on GPIO

2013-08-14 Thread Sebastian Hesselbarth

On 08/14/2013 11:07 AM, Thierry Reding wrote:

On Tue, Aug 13, 2013 at 02:25:23PM +0200, Sebastian Hesselbarth wrote:
[...]

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c

[...]

@@ -897,6 +904,30 @@ static int mvebu_pcie_probe(struct platform_device *pdev)

[...]

+   u32 reset_udelay = 2;

[...]

+   udelay(reset_udelay);


udelay(2) is probably not a good idea. You should probably use
something like usleep_range() or msleep() here. Also see:

Documentation/timers/timers-howto.txt


Thierry,

thanks for mentioning this. I clearly got distracted from ms to us
switch due to the different reset API convention. As the delay will
be most likely 10ms+, we should change the above to
msleep(reset_udelay/1000) instead.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/8] drm/i2c: tda998x: fix sync generation and calculation

2013-08-14 Thread Sebastian Hesselbarth

On 08/14/13 14:41, Russell King - ARM Linux wrote:

On Tue, Aug 06, 2013 at 12:20:16AM +0200, Sebastian Hesselbarth wrote:

+   de_pix_s = mode-htotal - mode-hdisplay;
+   de_pix_e = de_pix_s + mode-hdisplay;
+   hs_pix_s = mode-hsync_start - mode-hdisplay;
+   hs_pix_e = hs_pix_s + mode-hsync_end - mode-hsync_start;


I still think the above is over-complicating the calculation and making it
less readable.


Yeah, you also didn't like it the last time. I must admit, I have
left it that way because I did all the near-end/far-end scope checks
on the calculation above and I wasn't that eager to touch them again.

But I agree and will revert the lines in question and update the
others accordingly.


The values in 'mode' represent this timing representation:
0=hdshdehss  hse   ht
|-|-|---||

What we want to do is to rotate that around to this:
0 hss  hse   hds   ht=hde
|-|---||-|

 From that, you can see quite clearly that the end of the displayed line
is now at htotal, and the start of the displayed line (hds) is hdisplay
clocks before that.  So:

de_pix_e = mode-htotal;
de_pix_s = de_pix_e - mode-hdisplay;

Everything else (hss, hse) has moved to the left by hdisplay clocks, so:

hs_pix_s = mode-hsync_start - mode-hdisplay;
hs_pix_e = mode-hsync_end - mode-hdisplay;

That's what you get if you simplify your calculations as well.  If we then
go back and look at the original code:

-   hs_start   = mode-hsync_start - mode-hdisplay;
-   hs_end = mode-hsync_end - mode-hdisplay;
-   de_start   = mode-htotal - mode-hdisplay;
-   de_end = mode-htotal;

it's what was originally there, so I don't see any point in touching that
calculation.

We also have:

-   ref_pix = 3 + hs_start;
+   ref_pix  = 3 + mode-hsync_start - mode-hdisplay;

which we can see is also the same calculation in essence.  I don't think
the change helps readability.



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/8] drm/i2c: tda998x: add video and audio input configuration

2013-08-14 Thread Sebastian Hesselbarth

On 08/14/13 16:12, Russell King - ARM Linux wrote:

On Tue, Aug 06, 2013 at 12:20:15AM +0200, Sebastian Hesselbarth wrote:

@@ -0,0 +1,23 @@
+#ifndef __TDA998X_H__
+#define __TDA998X_H__
+
+enum tda998x_audio_format {
+   AFMT_I2S,
+   AFMT_SPDIF,
+};
+
+struct tda998x_encoder_params {
+   int audio_cfg;
+   int audio_clk_cfg;
+   enum tda998x_audio_format audio_format;
+   int audio_sample_rate;
+   char audio_frame[6];
+   int swap_a, mirr_a;
+   int swap_b, mirr_b;
+   int swap_c, mirr_c;
+   int swap_d, mirr_d;
+   int swap_e, mirr_e;
+   int swap_f, mirr_f;
+};


You really should pick my version of this header file from the message
I sent earlier:

e1ulloe-00058q...@rmk-pc.arm.linux.org.uk
[PATCH RFC 7/8] drm/i2c: nxp-tda998x: add video and audio input 
configuration

if you're going to suggest that it's something I produced.



Right, that one above must have been the one I made up from the
one RFC you forgot to add it. I must have messed it up and will
take yours, of course.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 6/8] drm/i2c: tda998x: fix sync generation and calculation

2013-08-14 Thread Sebastian Hesselbarth
This fixes the wrong sync generation and sync calculation of TDA998x
for HS/VS-based sync detection.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
Tested-by: Darren Etheridge detheri...@ti.com
---
Changelog:
v1-v2:
- revert calculation of hs/de_pix_s/e (Reported by Russell King)

Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/i2c/tda998x_drv.c |  181 +++--
 1 file changed, 115 insertions(+), 66 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 2b64dfa..92fcb3d 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -140,8 +140,12 @@ struct tda998x_priv {
 #define REG_VS_LINE_END_1_LSB REG(0x00, 0xae) /* write */
 #define REG_VS_PIX_END_1_MSB  REG(0x00, 0xaf) /* write */
 #define REG_VS_PIX_END_1_LSB  REG(0x00, 0xb0) /* write */
+#define REG_VS_LINE_STRT_2_MSBREG(0x00, 0xb1) /* write */
+#define REG_VS_LINE_STRT_2_LSBREG(0x00, 0xb2) /* write */
 #define REG_VS_PIX_STRT_2_MSB REG(0x00, 0xb3) /* write */
 #define REG_VS_PIX_STRT_2_LSB REG(0x00, 0xb4) /* write */
+#define REG_VS_LINE_END_2_MSB REG(0x00, 0xb5) /* write */
+#define REG_VS_LINE_END_2_LSB REG(0x00, 0xb6) /* write */
 #define REG_VS_PIX_END_2_MSB  REG(0x00, 0xb7) /* write */
 #define REG_VS_PIX_END_2_LSB  REG(0x00, 0xb8) /* write */
 #define REG_HS_PIX_START_MSB  REG(0x00, 0xb9) /* write */
@@ -152,21 +156,29 @@ struct tda998x_priv {
 #define REG_VWIN_START_1_LSB  REG(0x00, 0xbe) /* write */
 #define REG_VWIN_END_1_MSBREG(0x00, 0xbf) /* write */
 #define REG_VWIN_END_1_LSBREG(0x00, 0xc0) /* write */
+#define REG_VWIN_START_2_MSB  REG(0x00, 0xc1) /* write */
+#define REG_VWIN_START_2_LSB  REG(0x00, 0xc2) /* write */
+#define REG_VWIN_END_2_MSBREG(0x00, 0xc3) /* write */
+#define REG_VWIN_END_2_LSBREG(0x00, 0xc4) /* write */
 #define REG_DE_START_MSB  REG(0x00, 0xc5) /* write */
 #define REG_DE_START_LSB  REG(0x00, 0xc6) /* write */
 #define REG_DE_STOP_MSB   REG(0x00, 0xc7) /* write */
 #define REG_DE_STOP_LSB   REG(0x00, 0xc8) /* write */
 #define REG_TBG_CNTRL_0   REG(0x00, 0xca) /* write */
+# define TBG_CNTRL_0_TOP_TGL  (1  0)
+# define TBG_CNTRL_0_TOP_SEL  (1  1)
+# define TBG_CNTRL_0_DE_EXT   (1  2)
+# define TBG_CNTRL_0_TOP_EXT  (1  3)
 # define TBG_CNTRL_0_FRAME_DIS(1  5)
 # define TBG_CNTRL_0_SYNC_MTHD(1  6)
 # define TBG_CNTRL_0_SYNC_ONCE(1  7)
 #define REG_TBG_CNTRL_1   REG(0x00, 0xcb) /* write */
-# define TBG_CNTRL_1_VH_TGL_0 (1  0)
-# define TBG_CNTRL_1_VH_TGL_1 (1  1)
-# define TBG_CNTRL_1_VH_TGL_2 (1  2)
-# define TBG_CNTRL_1_VHX_EXT_DE   (1  3)
-# define TBG_CNTRL_1_VHX_EXT_HS   (1  4)
-# define TBG_CNTRL_1_VHX_EXT_VS   (1  5)
+# define TBG_CNTRL_1_H_TGL(1  0)
+# define TBG_CNTRL_1_V_TGL(1  1)
+# define TBG_CNTRL_1_TGL_EN   (1  2)
+# define TBG_CNTRL_1_X_EXT(1  3)
+# define TBG_CNTRL_1_H_EXT(1  4)
+# define TBG_CNTRL_1_V_EXT(1  5)
 # define TBG_CNTRL_1_DWIN_DIS (1  6)
 #define REG_ENABLE_SPACE  REG(0x00, 0xd6) /* write */
 #define REG_HVF_CNTRL_0   REG(0x00, 0xe4) /* write */
@@ -735,43 +747,70 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *adjusted_mode)
 {
struct tda998x_priv *priv = to_tda998x_priv(encoder);
-   uint16_t hs_start, hs_end, line_start, line_end;
-   uint16_t vwin_start, vwin_end, de_start, de_end;
-   uint16_t ref_pix, ref_line, pix_start2;
+   uint16_t ref_pix, ref_line, n_pix, n_line;
+   uint16_t hs_pix_s, hs_pix_e;
+   uint16_t vs1_pix_s, vs1_pix_e, vs1_line_s, vs1_line_e;
+   uint16_t vs2_pix_s, vs2_pix_e, vs2_line_s, vs2_line_e;
+   uint16_t vwin1_line_s, vwin1_line_e;
+   uint16_t vwin2_line_s, vwin2_line_e;
+   uint16_t de_pix_s, de_pix_e;
uint8_t reg, div, rep;
 
-   hs_start   = mode-hsync_start - mode-hdisplay;
-   hs_end = mode-hsync_end - mode-hdisplay;
-   line_start = 1;
-   line_end   = 1 + mode-vsync_end - mode-vsync_start;
-   vwin_start = mode-vtotal - mode-vsync_start;
-   vwin_end   = vwin_start + mode-vdisplay;
-   de_start   = mode-htotal - mode-hdisplay;
-   de_end = mode-htotal;
-
-   pix_start2 = 0;
-   if (mode-flags  DRM_MODE_FLAG_INTERLACE)
-   pix_start2 = (mode-htotal / 2) + hs_start;
-
-   /* TODO how is this value calculated?  It is 2 for all common
-* formats in the tables in out

[PATCH v2 7/8] drm/i2c: tda998x: prepare for broken sync workaround

2013-08-14 Thread Sebastian Hesselbarth
Some LCD controller cannot provide valid VESA style sync, i.e. coincident
HS/VS edges. First, this patch adds hskew passed from the adjusted_mode to
reference pixel calculation to allow those controllers to add an offset
relative to the expected reference pixel.

Signed-off-by: Darren Etheridge detheri...@ti.com
Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
for v1:
- reword comment

Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/i2c/tda998x_drv.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 92fcb3d..c2bd711 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -782,6 +782,14 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
de_pix_s = mode-htotal - mode-hdisplay;
ref_pix  = 3 + hs_pix_s;
 
+   /*
+* Attached LCD controllers may generate broken sync. Allow
+* those to adjust the position of the rising VS edge by adding
+* HSKEW to ref_pix.
+*/
+   if (adjusted_mode-flags  DRM_MODE_FLAG_HSKEW)
+   ref_pix += adjusted_mode-hskew;
+
if ((mode-flags  DRM_MODE_FLAG_INTERLACE) == 0) {
ref_line = 1 + mode-vsync_start - mode-vdisplay;
vwin1_line_s = mode-vtotal - mode-vdisplay - 1;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/8] Several NXP TDA998x patches

2013-08-14 Thread Sebastian Hesselbarth
This patch set picks up several patches sent during the past months
related with NXP TDA998x HDMI transmitter driver. The patches have
been tested on Marvell Dove (Armada DRM) on several HDMI and DVI modes
with audio playing on S/PDIF.

I bumped all patches to v2, although only patches 2, 5, and 6 have
changed. I also fixed a typo in commit line of patch 8. As Darren
Etheridge already gave his Tested-by and tilcdc related patches have
not changed, I added it to all patches for v2, too.

I have not added Russell King's Tested-by, as I hope he will have a
close look at what I changed after his review comments.

Darren Etheridge (1):
  drm/tilcdc fixup mode to workaround sync for tda998x

Russell King (5):
  drm/i2c: tda998x: fix EDID reading on TDA19988 devices
  drm/i2c: tda998x: ensure VIP output mux is properly set
  drm/i2c: tda998x: fix npix/nline programming
  drm/i2c: tda998x: prepare for video input configuration
  drm/i2c: tda998x: add video and audio input configuration

Sebastian Hesselbarth (2):
  drm/i2c: tda998x: fix sync generation and calculation
  drm/i2c: tda998x: prepare for broken sync workaround

 drivers/gpu/drm/i2c/tda998x_drv.c |  481 +++--
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c  |7 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave.c |   27 +-
 include/drm/i2c/tda998x.h |   30 ++
 4 files changed, 467 insertions(+), 78 deletions(-)
 create mode 100644 include/drm/i2c/tda998x.h

---
Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 5/8] drm/i2c: tda998x: add video and audio input configuration

2013-08-14 Thread Sebastian Hesselbarth
From: Russell King rmk+ker...@arm.linux.org.uk

This patch adds tda998x specific parameters to allow it to be configured
for different boards using it. Also, this implements rudimentary audio
support for S/PDIF attached controllers.

Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
Tested-by: Darren Etheridge detheri...@ti.com
---
Changelog:
for v1:
- set AUDIO_DIV to SERCLK/16 for modes with pixclk 100MHz
- also calculate CTS
v1-v2:
- Remove CTS calculation as it isn't used in current TDA998x setup
  (Reported by Russell King)
- Remove debug left-over (Reported by Russell King)
- Use correct tda998x include (Reported by Russell King)

Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/i2c/tda998x_drv.c |  268 +++--
 include/drm/i2c/tda998x.h |   30 +
 2 files changed, 290 insertions(+), 8 deletions(-)
 create mode 100644 include/drm/i2c/tda998x.h

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 527d11b..2b64dfa 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -23,7 +23,7 @@
 #include drm/drm_crtc_helper.h
 #include drm/drm_encoder_slave.h
 #include drm/drm_edid.h
-
+#include drm/i2c/tda998x.h
 
 #define DBG(fmt, ...) DRM_DEBUG(fmt\n, ##__VA_ARGS__)
 
@@ -32,9 +32,11 @@ struct tda998x_priv {
uint16_t rev;
uint8_t current_page;
int dpms;
+   bool is_hdmi_sink;
u8 vip_cntrl_0;
u8 vip_cntrl_1;
u8 vip_cntrl_2;
+   struct tda998x_encoder_params params;
 };
 
 #define to_tda998x_priv(x)  ((struct tda998x_priv 
*)to_encoder_slave(x)-slave_priv)
@@ -71,10 +73,13 @@ struct tda998x_priv {
 # define I2C_MASTER_DIS_MM(1  0)
 # define I2C_MASTER_DIS_FILT  (1  1)
 # define I2C_MASTER_APP_STRT_LAT  (1  2)
+#define REG_FEAT_POWERDOWNREG(0x00, 0x0e) /* read/write */
+# define FEAT_POWERDOWN_SPDIF (1  3)
 #define REG_INT_FLAGS_0   REG(0x00, 0x0f) /* read/write */
 #define REG_INT_FLAGS_1   REG(0x00, 0x10) /* read/write */
 #define REG_INT_FLAGS_2   REG(0x00, 0x11) /* read/write */
 # define INT_FLAGS_2_EDID_BLK_RD  (1  1)
+#define REG_ENA_ACLK  REG(0x00, 0x16) /* read/write */
 #define REG_ENA_VP_0  REG(0x00, 0x18) /* read/write */
 #define REG_ENA_VP_1  REG(0x00, 0x19) /* read/write */
 #define REG_ENA_VP_2  REG(0x00, 0x1a) /* read/write */
@@ -113,6 +118,7 @@ struct tda998x_priv {
 #define REG_VIP_CNTRL_5   REG(0x00, 0x25) /* write */
 # define VIP_CNTRL_5_CKCASE   (1  0)
 # define VIP_CNTRL_5_SP_CNT(x)(((x)  3)  1)
+#define REG_MUX_APREG(0x00, 0x26) /* read/write */
 #define REG_MUX_VP_VIP_OUTREG(0x00, 0x27) /* read/write */
 #define REG_MAT_CONTRLREG(0x00, 0x80) /* write */
 # define MAT_CONTRL_MAT_SC(x) (((x)  3)  0)
@@ -175,6 +181,12 @@ struct tda998x_priv {
 # define HVF_CNTRL_1_PAD(x)   (((x)  3)  4)
 # define HVF_CNTRL_1_SEMI_PLANAR  (1  6)
 #define REG_RPT_CNTRL REG(0x00, 0xf0) /* write */
+#define REG_I2S_FORMATREG(0x00, 0xfc) /* read/write */
+# define I2S_FORMAT(x)(((x)  3)  0)
+#define REG_AIP_CLKSELREG(0x00, 0xfd) /* write */
+# define AIP_CLKSEL_FS(x) (((x)  3)  0)
+# define AIP_CLKSEL_CLK_POL(x)(((x)  1)  2)
+# define AIP_CLKSEL_AIP(x)(((x)  7)  3)
 
 
 /* Page 02h: PLL settings */
@@ -198,6 +210,12 @@ struct tda998x_priv {
 #define REG_PLL_SCGR1 REG(0x02, 0x09) /* read/write */
 #define REG_PLL_SCGR2 REG(0x02, 0x0a) /* read/write */
 #define REG_AUDIO_DIV REG(0x02, 0x0e) /* read/write */
+# define AUDIO_DIV_SERCLK_1   0
+# define AUDIO_DIV_SERCLK_2   1
+# define AUDIO_DIV_SERCLK_4   2
+# define AUDIO_DIV_SERCLK_8   3
+# define AUDIO_DIV_SERCLK_16  4
+# define AUDIO_DIV_SERCLK_32  5
 #define REG_SEL_CLK   REG(0x02, 0x11) /* read/write */
 # define SEL_CLK_SEL_CLK1 (1  0)
 # define SEL_CLK_SEL_VRF_CLK(x)   (((x)  3)  1)
@@ -216,6 +234,11 @@ struct tda998x_priv {
 
 
 /* Page 10h: information frames and packets */
+#define REG_IF1_HB0   REG(0x10, 0x20) /* read/write */
+#define REG_IF2_HB0   REG(0x10, 0x40) /* read/write */
+#define REG_IF3_HB0   REG(0x10, 0x60) /* read/write */
+#define REG_IF4_HB0   REG(0x10, 0x80) /* read/write */
+#define REG_IF5_HB0   REG(0x10, 0xa0) /* read/write */
 
 
 /* Page 11h: audio settings and content info packets */
@@ -225,10 +248,33

[PATCH v2 8/8] drm/tilcdc fixup mode to workaround sync for tda998x

2013-08-14 Thread Sebastian Hesselbarth
From: Darren Etheridge detheri...@ti.com

Add a fixup function that will flip the hsync priority and
add a hskew value that is used to shift the tda998x to the
right by a variable number of pixels depending on the mode.
This works around an issue with the sync timings that tilcdc
is outputing.

Signed-off-by: Darren Etheridge detheri...@ti.com
Tested-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- fix typo in commit line (s/workaound/workaround)

Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c  |7 ++-
 drivers/gpu/drm/tilcdc/tilcdc_slave.c |   27 ++-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 7418dcd..6d05240 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -379,7 +379,12 @@ static int tilcdc_crtc_mode_set(struct drm_crtc *crtc,
else
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_SYNC_EDGE);
 
-   if (mode-flags  DRM_MODE_FLAG_NHSYNC)
+   /*
+* use value from adjusted_mode here as this might have been
+* changed as part of the fixup for slave encoders to solve the
+* issue where tilcdc timings are not VESA compliant
+*/
+   if (adjusted_mode-flags  DRM_MODE_FLAG_NHSYNC)
tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_HSYNC);
else
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_HSYNC);
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave.c 
b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
index 0bf5999..f6e9c26 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_slave.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
@@ -73,13 +73,38 @@ static void slave_encoder_prepare(struct drm_encoder 
*encoder)
tilcdc_crtc_set_panel_info(encoder-crtc, slave_info);
 }
 
+static bool slave_encoder_fixup(struct drm_encoder *encoder,
+   const struct drm_display_mode *mode,
+   struct drm_display_mode *adjusted_mode)
+{
+   /*
+* tilcdc does not generate VESA-complient sync but aligns
+* VS on the second edge of HS instead of first edge.
+* We use adjusted_mode, to fixup sync by aligning both rising
+* edges and add HSKEW offset to let the slave encoder fix it up.
+*/
+   adjusted_mode-hskew = mode-hsync_end - mode-hsync_start;
+   adjusted_mode-flags |= DRM_MODE_FLAG_HSKEW;
+
+   if (mode-flags  DRM_MODE_FLAG_NHSYNC) {
+   adjusted_mode-flags |= DRM_MODE_FLAG_PHSYNC;
+   adjusted_mode-flags = ~DRM_MODE_FLAG_NHSYNC;
+   } else {
+   adjusted_mode-flags |= DRM_MODE_FLAG_NHSYNC;
+   adjusted_mode-flags = ~DRM_MODE_FLAG_PHSYNC;
+   }
+
+   return drm_i2c_encoder_mode_fixup(encoder, mode, adjusted_mode);
+}
+
+
 static const struct drm_encoder_funcs slave_encoder_funcs = {
.destroy= slave_encoder_destroy,
 };
 
 static const struct drm_encoder_helper_funcs slave_encoder_helper_funcs = {
.dpms   = drm_i2c_encoder_dpms,
-   .mode_fixup = drm_i2c_encoder_mode_fixup,
+   .mode_fixup = slave_encoder_fixup,
.prepare= slave_encoder_prepare,
.commit = drm_i2c_encoder_commit,
.mode_set   = drm_i2c_encoder_mode_set,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/8] drm/i2c: tda998x: fix EDID reading on TDA19988 devices

2013-08-14 Thread Sebastian Hesselbarth
From: Russell King rmk+ker...@arm.linux.org.uk

TDA19988 devices need their RAM enabled in order to read EDID
information.  Add support for this.

Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Rob Clark robdcl...@gmail.com
Tested-by: Darren Etheridge detheri...@ti.com
Tested-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/i2c/tda998x_drv.c |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index e68b58a..d71c408 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -229,6 +229,8 @@ struct tda998x_priv {
 
 /* Page 12h: HDCP and OTP */
 #define REG_TX3   REG(0x12, 0x9a) /* read/write */
+#define REG_TX4   REG(0x12, 0x9b) /* read/write */
+# define TX4_PD_RAM   (1  1)
 #define REG_TX33  REG(0x12, 0xb8) /* read/write */
 # define TX33_HDMI(1  1)
 
@@ -673,6 +675,7 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, 
int blk)
 static uint8_t *
 do_get_edid(struct drm_encoder *encoder)
 {
+   struct tda998x_priv *priv = to_tda998x_priv(encoder);
int j = 0, valid_extensions = 0;
uint8_t *block, *new;
bool print_bad_edid = drm_debug  DRM_UT_KMS;
@@ -680,6 +683,9 @@ do_get_edid(struct drm_encoder *encoder)
if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
return NULL;
 
+   if (priv-rev == TDA19988)
+   reg_clear(encoder, REG_TX4, TX4_PD_RAM);
+
/* base block fetch */
if (read_edid_block(encoder, block, 0))
goto fail;
@@ -689,7 +695,7 @@ do_get_edid(struct drm_encoder *encoder)
 
/* if there's no extensions, we're done */
if (block[0x7e] == 0)
-   return block;
+   goto done;
 
new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
if (!new)
@@ -716,9 +722,15 @@ do_get_edid(struct drm_encoder *encoder)
block = new;
}
 
+done:
+   if (priv-rev == TDA19988)
+   reg_set(encoder, REG_TX4, TX4_PD_RAM);
+
return block;
 
 fail:
+   if (priv-rev == TDA19988)
+   reg_set(encoder, REG_TX4, TX4_PD_RAM);
dev_warn(encoder-dev-dev, failed to read EDID\n);
kfree(block);
return NULL;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/8] drm/i2c: tda998x: fix npix/nline programming

2013-08-14 Thread Sebastian Hesselbarth
From: Russell King rmk+ker...@arm.linux.org.uk

The npix/nline registers are supposed to be programmed with the total
number of pixels/lines, not the displayed pixels/lines, and not minus
one either.

Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Tested-by: Darren Etheridge detheri...@ti.com
Tested-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/i2c/tda998x_drv.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index cb9b13a..a701411 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -587,8 +587,8 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
reg_set(encoder, REG_VIP_CNTRL_3, VIP_CNTRL_3_H_TGL);
 
reg_write(encoder, REG_VIDFORMAT, 0x00);
-   reg_write16(encoder, REG_NPIX_MSB, mode-hdisplay - 1);
-   reg_write16(encoder, REG_NLINE_MSB, mode-vdisplay - 1);
+   reg_write16(encoder, REG_NPIX_MSB, mode-htotal);
+   reg_write16(encoder, REG_NLINE_MSB, mode-vtotal);
reg_write16(encoder, REG_VS_LINE_STRT_1_MSB, line_start);
reg_write16(encoder, REG_VS_LINE_END_1_MSB, line_end);
reg_write16(encoder, REG_VS_PIX_STRT_1_MSB, hs_start);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/8] drm/i2c: tda998x: prepare for video input configuration

2013-08-14 Thread Sebastian Hesselbarth
From: Russell King rmk+ker...@arm.linux.org.uk

The video-input-port (VIP) is highly configurable. This prepares
current driver to allow to configure VIP configuration, as some
boards connect lcd controller and TDA998x pin-swapped and depend
on VIP to swap the pins by register configuration.

Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Tested-by: Darren Etheridge detheri...@ti.com
Tested-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/i2c/tda998x_drv.c |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index a701411..527d11b 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -32,6 +32,9 @@ struct tda998x_priv {
uint16_t rev;
uint8_t current_page;
int dpms;
+   u8 vip_cntrl_0;
+   u8 vip_cntrl_1;
+   u8 vip_cntrl_2;
 };
 
 #define to_tda998x_priv(x)  ((struct tda998x_priv 
*)to_encoder_slave(x)-slave_priv)
@@ -448,12 +451,9 @@ tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
reg_write(encoder, REG_ENA_VP_1, 0xff);
reg_write(encoder, REG_ENA_VP_2, 0xff);
/* set muxing after enabling ports: */
-   reg_write(encoder, REG_VIP_CNTRL_0,
-   VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3));
-   reg_write(encoder, REG_VIP_CNTRL_1,
-   VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1));
-   reg_write(encoder, REG_VIP_CNTRL_2,
-   VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5));
+   reg_write(encoder, REG_VIP_CNTRL_0, priv-vip_cntrl_0);
+   reg_write(encoder, REG_VIP_CNTRL_1, priv-vip_cntrl_1);
+   reg_write(encoder, REG_VIP_CNTRL_2, priv-vip_cntrl_2);
break;
case DRM_MODE_DPMS_OFF:
/* disable audio and video ports */
@@ -823,6 +823,10 @@ tda998x_encoder_init(struct i2c_client *client,
if (!priv)
return -ENOMEM;
 
+   priv-vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3);
+   priv-vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1);
+   priv-vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5);
+
priv-current_page = 0;
priv-cec = i2c_new_dummy(client-adapter, 0x34);
priv-dpms = DRM_MODE_DPMS_OFF;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/8] drm/i2c: tda998x: ensure VIP output mux is properly set

2013-08-14 Thread Sebastian Hesselbarth
From: Russell King rmk+ker...@arm.linux.org.uk

When switching between various drivers for this device, it's possible
that some critical registers are left containing values which affect
the device operation.  One such case encountered is the VIP output
mux register.  This defaults to 0x24 on powerup, but other drivers may
set this to 0x12.  This results in incorrect colours.

Fix this by ensuring that the register is always set to the power on
default setting.

Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Tested-by: Darren Etheridge detheri...@ti.com
Tested-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Changelog:
v1-v2:
- move reg_write to tda998x_reset as last patch was based on an
  old version (Reported by Russell King)

Cc: David Airlie airl...@linux.ie
Cc: Darren Etheridge detheri...@ti.com
Cc: Rob Clark robdcl...@gmail.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/i2c/tda998x_drv.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index d71c408..cb9b13a 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -110,6 +110,7 @@ struct tda998x_priv {
 #define REG_VIP_CNTRL_5   REG(0x00, 0x25) /* write */
 # define VIP_CNTRL_5_CKCASE   (1  0)
 # define VIP_CNTRL_5_SP_CNT(x)(((x)  3)  1)
+#define REG_MUX_VP_VIP_OUTREG(0x00, 0x27) /* read/write */
 #define REG_MAT_CONTRLREG(0x00, 0x80) /* write */
 # define MAT_CONTRL_MAT_SC(x) (((x)  3)  0)
 # define MAT_CONTRL_MAT_BP(1  2)
@@ -415,6 +416,9 @@ tda998x_reset(struct drm_encoder *encoder)
reg_write(encoder, REG_PLL_SCGR1,0x5b);
reg_write(encoder, REG_PLL_SCGR2,0x00);
reg_write(encoder, REG_PLL_SCG2, 0x10);
+
+   /* Write the default value MUX register */
+   reg_write(encoder, REG_MUX_VP_VIP_OUT, 0x24);
 }
 
 /* DRM encoder functions */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v1 4/5] ARM: mvebu: add Armada 1500 and Sony NSZ-GS7 device tree files

2013-08-16 Thread Sebastian Hesselbarth
This adds very basic device tree files for the Marvell Armada 1500 SoC
and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has nodes for
cpus, some clocks, l2 cache controller, local timer, apb timers, uart,
and interrupt controllers.

The clocks are fixed-clock placeholders until a real DT clock provider
is available. Cache controller node may be wrong and was just guessed
out of Armada 370 and GPL'd 1500 source. Timers except clocksource have
not really been tested.

The separation into soc/apb and soc/sm-apb may be removed, but it looks
like Armada 1500 has a separate peripheral bus for the System Manager
core that can also been accessed by CPUs. (If you look closely on GTV
boot logs, you can see SM and CPU fighting for UART ;) )

The Sony NSZ-GS7 is a GoogleTV consumer device comprising the SoC above.
Since last week or so, there is a way to install a custom u-boot and
boot stock, unsigned kernels easily. Just ask Google about it, if you
are willing to void your warranty.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Rob Herring rob.herr...@calxeda.com
Cc: Pawel Moll pawel.m...@arm.com
Cc: Mark Rutland mark.rutl...@arm.com
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Ian Campbell ian.campb...@citrix.com
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: devicet...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/boot/dts/Makefile |3 +-
 arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts |   29 +++
 arch/arm/boot/dts/armada-1500.dtsi |  225 
 3 files changed, 256 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts
 create mode 100644 arch/arm/boot/dts/armada-1500.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 641b3c9..3186904 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -103,7 +103,8 @@ dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
armada-370-rd.dtb \
armada-xp-db.dtb \
armada-xp-gp.dtb \
-   armada-xp-openblocks-ax3-4.dtb
+   armada-xp-openblocks-ax3-4.dtb \
+   armada-1500-sony-nsz-gs7.dtb
 dtb-$(CONFIG_ARCH_MXC) += \
imx25-karo-tx25.dtb \
imx25-pdk.dtb \
diff --git a/arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts 
b/arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts
new file mode 100644
index 000..b76c4b8
--- /dev/null
+++ b/arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts
@@ -0,0 +1,29 @@
+/*
+ * Device Tree file for Sony NSZ-GS7
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include armada-1500.dtsi
+
+/ {
+   model = Sony NSZ-GS7;
+   compatible = sony,nsz-gs7, marvell,armada-1500;
+
+   chosen {
+   bootargs = console=ttyS0,115200 earlyprintk verbose debug;
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x4000; /* 1 GB */
+   };
+};
+
+uart0 { status = okay; };
diff --git a/arch/arm/boot/dts/armada-1500.dtsi 
b/arch/arm/boot/dts/armada-1500.dtsi
new file mode 100644
index 000..51e0420
--- /dev/null
+++ b/arch/arm/boot/dts/armada-1500.dtsi
@@ -0,0 +1,225 @@
+/*
+ * Device Tree Include file for Marvell Armada 1500 SoC
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include skeleton.dtsi
+#include dt-bindings/interrupt-controller/arm-gic.h
+
+/ {
+   model = Marvell Armada 1500 SoC;
+   compatible = marvell,armada-1500;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   cpu@0 {
+   compatible = marvell,sheeva-v7;
+   device_type = cpu;
+   next-level-cache = l2;
+   reg = 0;
+   };
+
+   cpu@1 {
+   compatible = marvell,sheeva-v7;
+   device_type = cpu;
+   next-level-cache = l2;
+   reg = 1;
+   };
+   };
+
+   clocks {
+   /* 25MHz reference crystal */
+   ref25: oscillator {
+   compatible = fixed-clock;
+   #clock-cells = 0;
+   clock-frequency = 2500;
+   };
+
+   cpu0clk: cpu0-clock

[RFC v1 5/5] ARM: mvebu: add board init for Armada 1500

2013-08-16 Thread Sebastian Hesselbarth
This adds initial setup for the Marvell Armada 1500 SoCs. The code
is fairly straight-forward, but especially _timer_and_clk_init()
can be simplified by using default arch hooks. I will have some time
until mach-mvebu is prepared for other SoCs moving over, so I can
catch up with latest machine simplifications.

I am not so sure about the .map_io but I didn't yet fully understand
the mapping requirement. Anyway, it is required for iomap and friends
to work and basically remaps physical register addressed onto the same
virtual addresses.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-mvebu/Kconfig   |   15 +
 arch/arm/mach-mvebu/Makefile  |   13 
 arch/arm/mach-mvebu/armada-1500.c |   63 +
 3 files changed, 85 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-mvebu/armada-1500.c

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 9eb63d7..e2e93ed 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -36,6 +36,21 @@ config MACH_ARMADA_370
  Say 'Y' here if you want your kernel to support boards based
  on the Marvell Armada 370 SoC with device tree.
 
+config MACH_ARMADA_1500
+   bool Marvell Armada 1500 boards
+   select ARMADA_1500_CLK
+   select ARM_GIC
+   select CACHE_L2X0
+   select CPU_PJ4B
+   select DW_APB_TIMER_OF
+   select LOCAL_TIMERS if SMP
+   select HAVE_ARM_TWD if LOCAL_TIMERS
+   select HAVE_SMP
+   select PINCTRL_ARMADA_1500
+   help
+ Say 'Y' here if you want your kernel to support boards based
+ on the Marvell Armada 1500 SoC with device tree.
+
 config MACH_ARMADA_XP
bool Marvell Armada XP boards
select ARMADA_XP_CLK
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 2d04f0e..2e10b4a 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -1,10 +1,11 @@
 ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
-I$(srctree)/arch/arm/plat-orion/include
 
-AFLAGS_coherency_ll.o  := -Wa,-march=armv7-a
+AFLAGS_coherency_ll.o  := -Wa,-march=armv7-a
 
-obj-y   += system-controller.o
-obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o
-obj-$(CONFIG_ARCH_MVEBU)+= coherency.o coherency_ll.o pmsu.o
-obj-$(CONFIG_SMP)+= platsmp.o headsmp.o
-obj-$(CONFIG_HOTPLUG_CPU)+= hotplug.o
+obj-y  += system-controller.o
+obj-$(CONFIG_MACH_ARMADA_370_XP)   += armada-370-xp.o
+obj-$(CONFIG_MACH_ARMADA_1500) += armada-1500.o
+obj-$(CONFIG_ARCH_MVEBU)   += coherency.o coherency_ll.o pmsu.o
+obj-$(CONFIG_SMP)  += platsmp.o headsmp.o
+obj-$(CONFIG_HOTPLUG_CPU)  += hotplug.o
diff --git a/arch/arm/mach-mvebu/armada-1500.c 
b/arch/arm/mach-mvebu/armada-1500.c
new file mode 100644
index 000..b7c556b
--- /dev/null
+++ b/arch/arm/mach-mvebu/armada-1500.c
@@ -0,0 +1,63 @@
+/*
+ * Device Tree support for Armada 1500 platforms.
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include linux/clk-provider.h
+#include linux/clocksource.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/io.h
+#include linux/of_platform.h
+#include asm/hardware/cache-l2x0.h
+#include asm/mach/arch.h
+#include asm/mach/map.h
+#include asm/mach/time.h
+#include common.h
+#include coherency.h
+
+#define ARMADA_1500_REG_BASE_VIRT  0xf600
+#define ARMADA_1500_REG_BASE_SIZE  0x0300
+
+static struct map_desc armada_1500_io_desc[] __initdata = {
+   {
+   .virtual= ARMADA_1500_REG_BASE_VIRT,
+   .pfn= __phys_to_pfn(ARMADA_1500_REG_BASE_VIRT),
+   .length = ARMADA_1500_REG_BASE_SIZE,
+   .type   = MT_DEVICE,
+   },
+};
+
+static void __init armada_1500_map_io(void)
+{
+   iotable_init(armada_1500_io_desc, ARRAY_SIZE(armada_1500_io_desc));
+}
+
+static void __init armada_1500_timer_and_clk_init(void)
+{
+   of_clk_init(NULL);
+   clocksource_of_init();
+}
+
+static void __init armada_1500_dt_init(void)
+{
+   l2x0_of_init(0x70c0, 0xfeff);
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const armada_1500_dt_compat

[RFC v1 3/5] ARM: mvebu: add Armada 150 uart to lowlevel debug

2013-08-16 Thread Sebastian Hesselbarth
This adds UART0 as found on the Armada 1500 to the lowlevel debug of
mach-mvebu. Unfortunately, default register base addresses for Armada
370/XP switched from 0xd00 to 0xf10. So, we finally end up
in three different lowlevel setups:

 (a) Armada 1500 (possibly also Armada 1000, or MV88DE3xxx in general)
 (b) Armada 370/XP with new bootloader mapping at 0xf100 and
 the other Orion SoCs (Dove, Kirkwood, Orion5x, MV78xx0)
 (c) Armada 370/XP with old bootloader mapping at 0xd000

Now, mach-mvebu has been a Armada 370/XP-only playground for a while
but with great work of Thomas, Gregory, and the others we have moved
almost all drivers to DT. I suggest to clean-up a little and find
some meaningful names for the DEBUG_ Kconfigs.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/include/debug/mvebu.S |   26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/debug/mvebu.S b/arch/arm/include/debug/mvebu.S
index 6517311..ca41c02 100644
--- a/arch/arm/include/debug/mvebu.S
+++ b/arch/arm/include/debug/mvebu.S
@@ -11,19 +11,25 @@
  * published by the Free Software Foundation.
 */
 
-#ifdef CONFIG_DEBUG_MVEBU_UART_ALTERNATE
-#define ARMADA_370_XP_REGS_PHYS_BASE   0xf100
-#else
-#define ARMADA_370_XP_REGS_PHYS_BASE   0xd000
+#if defined(CONFIG_MACH_ARMADA_1500)
+#define MVEBU_REGS_PHYS_BASE   0xf7f8
+#define MVEBU_REGS_VIRT_BASE   0xf7f8
+#define MVEBU_UART0_OFFSET 0x00049000
+#elif defined(CONFIG_DEBUG_MVEBU_UART)
+#define MVEBU_REGS_PHYS_BASE   0xd000
+#define MVEBU_REGS_VIRT_BASE   0xfec0
+#define MVEBU_UART0_OFFSET 0x00012000
+#else /* CONFIG_DEBUG_MVEBU_UART_ALTERNATE */
+#define MVEBU_REGS_PHYS_BASE   0xf100
+#define MVEBU_REGS_VIRT_BASE   0xfec0
+#define MVEBU_UART0_OFFSET 0x00012000
 #endif
 
-#define ARMADA_370_XP_REGS_VIRT_BASE   0xfec0
-
.macro  addruart, rp, rv, tmp
-   ldr \rp, =ARMADA_370_XP_REGS_PHYS_BASE
-   ldr \rv, =ARMADA_370_XP_REGS_VIRT_BASE
-   orr \rp, \rp, #0x00012000
-   orr \rv, \rv, #0x00012000
+   ldr \rp, =MVEBU_REGS_PHYS_BASE
+   ldr \rv, =MVEBU_REGS_VIRT_BASE
+   orr \rp, \rp, #MVEBU_UART0_OFFSET
+   orr \rv, \rv, #MVEBU_UART0_OFFSET
.endm
 
 #define UART_SHIFT 2
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 4/5] ARM: mvebu: add Armada 1500 and Sony NSZ-GS7 device tree files

2013-08-16 Thread Sebastian Hesselbarth

On 08/16/2013 09:50 PM, Jason Cooper wrote:

On Fri, Aug 16, 2013 at 09:41:37PM +0200, Sebastian Hesselbarth wrote:

This adds very basic device tree files for the Marvell Armada 1500 SoC
and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has nodes for
cpus, some clocks, l2 cache controller, local timer, apb timers, uart,
and interrupt controllers.

[...]

---
  arch/arm/boot/dts/Makefile |3 +-
  arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts |   29 +++
  arch/arm/boot/dts/armada-1500.dtsi |  225 
  3 files changed, 256 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts
  create mode 100644 arch/arm/boot/dts/armada-1500.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 641b3c9..3186904 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -103,7 +103,8 @@ dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
armada-370-rd.dtb \
armada-xp-db.dtb \
armada-xp-gp.dtb \
-   armada-xp-openblocks-ax3-4.dtb
+   armada-xp-openblocks-ax3-4.dtb \
+   armada-1500-sony-nsz-gs7.dtb


alphabetical.


Dammit, true! ;)


And now I need to pick up a googleTV...


Jep, go shopping :)

Unfortunately, I (again) put too many people in Cc and all 5 patches
are stuck waiting for moderator approval. With 5 DT maintainers it isn't
easy to get those though to MLs.

Sebastian

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v1 1/5] irqchip: add Armada 1500 APB interrupt controller

2013-08-16 Thread Sebastian Hesselbarth
This adds irqchip drivers for the secondary interrupt controllers found
on Armada 1500 APB and SYSMGT APB bus.

I tried to find a compatible irqchip driver within v3.11-rc5, but there
is no. I guess that it is a common IP core to buy for your SoC, so maybe
one of the maintainers knows a better name for it. Could be DesignWare
type-of as timers are DW, too.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: Thomas Gleixner t...@linutronix.de
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/irqchip/Makefile  |1 +
 drivers/irqchip/irq-armada-1500-apb.c |  108 +
 2 files changed, 109 insertions(+)
 create mode 100644 drivers/irqchip/irq-armada-1500-apb.c

diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index e65c41a..f02f4db 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_IRQCHIP)  += irqchip.o
 
+obj-$(CONFIG_MACH_ARMADA_1500) += irq-armada-1500-apb.o
 obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o
 obj-$(CONFIG_ARCH_EXYNOS)  += exynos-combiner.o
 obj-$(CONFIG_ARCH_MVEBU)   += irq-armada-370-xp.o
diff --git a/drivers/irqchip/irq-armada-1500-apb.c 
b/drivers/irqchip/irq-armada-1500-apb.c
new file mode 100644
index 000..8626eb1
--- /dev/null
+++ b/drivers/irqchip/irq-armada-1500-apb.c
@@ -0,0 +1,108 @@
+/*
+ * Marvell Armada 1500 SoC APB IRQ chip driver.
+ *
+ * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include linux/io.h
+#include linux/irq.h
+#include linux/irqchip/chained_irq.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/of_irq.h
+#include asm/exception.h
+#include asm/mach/irq.h
+
+#include irqchip.h
+
+#define APB_INT_ENABLE 0x00
+#define APB_INT_MASK   0x08
+#define APB_INT_FINALSTATUS0x30
+
+static void armada_1500_apb_irq_handler(unsigned int irq, struct irq_desc 
*desc)
+{
+   struct irq_chip *chip = irq_get_chip(irq);
+   struct irq_chip_generic *gc = irq_get_handler_data(irq);
+   struct irq_domain *d = gc-private;
+   u32 stat;
+
+   chained_irq_enter(chip, desc);
+
+   stat = readl_relaxed(gc-reg_base + APB_INT_FINALSTATUS);
+
+   while (stat) {
+   u32 hwirq = ffs(stat) - 1;
+   generic_handle_irq(irq_find_mapping(d, gc-irq_base + hwirq));
+   stat = ~(1  hwirq);
+   }
+   chained_irq_exit(chip, desc);
+}
+
+static int __init armada_1500_apb_irq_init(struct device_node *np,
+  struct device_node *parent)
+{
+   unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
+   struct resource r;
+   struct irq_domain *domain;
+   struct irq_chip_generic *gc;
+   int ret, irq;
+
+   domain = irq_domain_add_linear(np, 32,
+  irq_generic_chip_ops, NULL);
+   if (!domain) {
+   pr_err(%s: unable to add irq domain\n, np-name);
+   return -ENOMEM;
+   }
+
+   ret = irq_alloc_domain_generic_chips(domain, 32, 1, np-name,
+handle_level_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE);
+   if (ret) {
+   pr_err(%s: unable to alloc irq domain gc\n, np-name);
+   return ret;
+   }
+
+   ret = of_address_to_resource(np, 0, r);
+   if (ret) {
+   pr_err(%s: unable to get resource\n, np-name);
+   return ret;
+   }
+
+   if (!request_mem_region(r.start, resource_size(r), np-name)) {
+   pr_err(%s: unable to request mem region\n, np-name);
+   return -ENOMEM;
+   }
+
+   /* Map the parent interrupt for the chained handler */
+   irq = irq_of_parse_and_map(np, 0);
+   if (irq = 0) {
+   pr_err(%s: unable to parse irq\n, np-name);
+   return -EINVAL;
+   }
+
+   gc = irq_get_domain_generic_chip(domain, 0);
+   gc-private = domain;
+   gc-reg_base = ioremap(r.start, resource_size(r));
+   if (!gc-reg_base) {
+   pr_err(%s: unable to map resource\n, np-name);
+   return -ENOMEM;
+   }
+
+   gc-chip_types[0].regs.mask = APB_INT_MASK;
+   gc-chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
+   gc-chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
+
+   /* mask and enable all interrupts */
+   writel(~0, gc-reg_base + APB_INT_MASK);
+   writel(~0, gc

[RFC v1 2/5] ARM: mvebu: add Armada 1500 to defconfig

2013-08-16 Thread Sebastian Hesselbarth
This adds the Armada 1500 to the list of Marvell MVEBU SoCs built by
default config.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/configs/mvebu_defconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 731814e..299062a 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -10,6 +10,7 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_ARCH_MVEBU=y
 CONFIG_MACH_ARMADA_370=y
+CONFIG_MACH_ARMADA_1500=y
 CONFIG_MACH_ARMADA_XP=y
 # CONFIG_CACHE_L2X0 is not set
 # CONFIG_SWP_EMULATE is not set
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v1 0/5] ARM: Initial support for Marvell Armada 1500

2013-08-16 Thread Sebastian Hesselbarth
This is a RFC adding initial support for the Marvell Armada 1500
(88DE3100) found on various consumer devices (Chromecast, GoogleTV).

Actually, it is a two-fold RFC also raising discussions on mach-mvebu
cleanup roadmap to allow other SoCs to hop into it. While mach-mvebu
originally was created to add support for Armada 370/XP and merge
existing Marvell Orion familiy into it, I am not so sure about
Armada 1500 fits that well (the mbus has gone!).

If you are brave enough to try this on any GoogleTV, hit Google for
instructions on how to get a unlocked u-boot and void your warranty :)
The patches are based on v3.11-rc5 directly.

This cover letter and the separate patches have also been Cc'd to the
respective maintainers to clear up some questions before posting a real
patch set.

Sebastian Hesselbarth (5):
  irqchip: add Armada 1500 APB interrupt controller
  ARM: mvebu: add Armada 1500 to defconfig
  ARM: mvebu: add Armada 150 uart to lowlevel debug
  ARM: mvebu: add Armada 1500 and Sony NSZ-GS7 device tree files
  ARM: mvebu: add board init for Armada 1500

 arch/arm/boot/dts/Makefile |3 +-
 arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts |   29 +++
 arch/arm/boot/dts/armada-1500.dtsi |  225 
 arch/arm/configs/mvebu_defconfig   |1 +
 arch/arm/include/debug/mvebu.S |   26 +--
 arch/arm/mach-mvebu/Kconfig|   15 ++
 arch/arm/mach-mvebu/Makefile   |   13 +-
 arch/arm/mach-mvebu/armada-1500.c  |   63 +++
 drivers/irqchip/Makefile   |1 +
 drivers/irqchip/irq-armada-1500-apb.c  |  108 
 10 files changed, 467 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/boot/dts/armada-1500-sony-nsz-gs7.dts
 create mode 100644 arch/arm/boot/dts/armada-1500.dtsi
 create mode 100644 arch/arm/mach-mvebu/armada-1500.c
 create mode 100644 drivers/irqchip/irq-armada-1500-apb.c

---
Cc: Rob Herring rob.herr...@calxeda.com
Cc: Pawel Moll pawel.m...@arm.com
Cc: Mark Rutland mark.rutl...@arm.com
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Ian Campbell ian.campb...@citrix.com
Cc: Russell King li...@arm.linux.org.uk
Cc: Jason Cooper ja...@lakedaemon.net
Cc: Andrew Lunn and...@lunn.ch
Cc: Gregory Clement gregory.clem...@free-electrons.com
Cc: Thomas Gleixner t...@linutronix.de
Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com
Cc: Arnd Bergmann a...@arndb.de
Cc: devicet...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 5/5] ARM: mvebu: add board init for Armada 1500

2013-08-17 Thread Sebastian Hesselbarth

On 08/16/2013 10:48 PM, Jason Cooper wrote:

On Fri, Aug 16, 2013 at 09:41:38PM +0200, Sebastian Hesselbarth wrote:

This adds initial setup for the Marvell Armada 1500 SoCs. The code
is fairly straight-forward, but especially _timer_and_clk_init()
can be simplified by using default arch hooks. I will have some time
until mach-mvebu is prepared for other SoCs moving over, so I can
catch up with latest machine simplifications.

I am not so sure about the .map_io but I didn't yet fully understand
the mapping requirement. Anyway, it is required for iomap and friends
to work and basically remaps physical register addressed onto the same
virtual addresses.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---

[...]

+obj-$(CONFIG_MACH_ARMADA_1500) += armada-1500.o


guess what?  :)

I swear I had a more substantive comment when I started this.  But after
a suitable application of gray matter, these nits were all that were
left. :(


Jason,

thanks for teaching me the alphabet again :) Of course, all your 
comments will be fixed for a real patch set.


I hope Thomas and Gregory will have some time to comment on the
mach-mvebu integration soon which also affects Orion SoCs.

But its weekend, next merge window is far, above just fails to boot
into anything useful due to the lack of drivers - relax :)

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v1 1/5] irqchip: add Armada 1500 APB interrupt controller

2013-08-17 Thread Sebastian Hesselbarth

On 08/16/2013 09:41 PM, Sebastian Hesselbarth wrote:

This adds irqchip drivers for the secondary interrupt controllers found
on Armada 1500 APB and SYSMGT APB bus.

I tried to find a compatible irqchip driver within v3.11-rc5, but there
is no. I guess that it is a common IP core to buy for your SoC, so maybe
one of the maintainers knows a better name for it. Could be DesignWare
type-of as timers are DW, too.


From a quick look into Synopsys DW ip library, it probably matches 
dw_apb_ictl best and should be named accordingly. Next round will

name the source dw_apb_ictl.c and corresponding compatible
snps,dw-apb-ictl.

In addition, it looks like the ip can support up to 64 irqs. For orion
irq, I have used a mavell,#interrupts to allow to pass the number of
supported irqs. Above driver should also exploit a similar
snps-prefixed property.

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    1   2   3   4   5   6   7   8   9   10   >