Skip to contentSkip to conversation

U300 device tree and multiplatform

PATCH New Linus Walleij 5 participants 56 messages May 31, 2013 – Jun 13, 2013

Subsystems (14)
lore
Share & tools
lore
#0 lore raw

cover U300 device tree and multiplatform

From: Linus Walleij <[email protected]>

This series of "only" 37 patches, partially sent earlier but here in its final form, will convert the U300 platform to using device tree exclusively, delete board files, and converts the machine to multiplatform.

In order not to artificially split things up, two fixes from Ulf Hansson and Peter Huewe are included.

A pull request will follow unless there are unfixable remarks.

Linus Walleij (37):
ARM: u300: enable delaytimer on the U300
ARM: u300: device tree support for the timer
pinctrl: u300 device tree support
pinctrl: coh901: add device tree support
ARM: u300: basic device tree support
i2c: stu300: device tree support
ARM: u300: register I2C bus drivers from device tree
watchdog: coh901327: devicetree support
ARM: u300: add the COH 901 327 watchdog to device tree
rtc: coh901331: add devicetree support
ARM: u300: add RTC to device tree
ARM: u300: set up board power from device tree
ARM: u300: support regulators in the device tree
ARM: u300: enable MMC/SD card from device tree
dma: coh901318: add devicetree support
ARM: u300: augment device tree with DMA channels
ARM: u300: add the COH 901 318 DMAC to device tree
ARM: u300: add SPI PL022 to the device tree
ARM: u300: probe the U300 dummy-spichip from device tree
ARM: u300: add FSMC flash into the device tree
ARM: u300: delete all static board data
ARM: u300: move debugmacro to debug includes
ARM: u300: remove deps from debug macro
ARM: u300: push down syscon registers
ARM: u300: delete <mach/hardware.h>
ARM: u300: delete <mach/irqs.h>
ARM: u300: localize <mach/u300-regs.h>
ARM: u300: convert to multiplatform
ARM: u300: delete remnant machine headers
ARM: u300: add syscon node
ARM: u300: remove register definition file
clk: move the U300 fixed and fixed-factor to DT
i2c: stu300: do not request a specific clock name
ARM: u300: move the gated system controller clocks to DT
ARM: u300: convert MMC/SD clock to device tree
pinctrl: get rid of all platform data for coh901
spi: pl022: use DMA by default when probing from DT

Peter Huewe (1):
ARM: u300 use module_spi_driver to register driver

Ulf Hansson (1):
ARM: u300: Update MMC configs for u300 defconfig

 Documentation/devicetree/bindings/arm/ste-u300.txt |  46 ++
 .../bindings/clock/ste-u300-syscon-clock.txt       |  80 +++
 .../devicetree/bindings/dma/ste-coh901318.txt      |  32 +
 .../bindings/gpio/gpio-stericsson-coh901.txt       |   7 +
 .../devicetree/bindings/i2c/i2c-st-ddci2c.txt      |  15 +
 .../bindings/timer/stericsson-u300-apptimer.txt    |  18 +
 .../bindings/watchdog/stericsson-coh901327.txt     |  19 +
 arch/arm/Kconfig                                   |  19 +-
 arch/arm/Kconfig.debug                             |   8 +
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/ste-u300.dts                     | 473 +++++++++++++
 arch/arm/configs/u300_defconfig                    |  14 +-
 .../mach/debug-macro.S => include/debug/u300.S}    |   9 +-
 arch/arm/mach-u300/Kconfig                         |  31 +-
 arch/arm/mach-u300/Makefile                        |   2 -
 arch/arm/mach-u300/core.c                          | 759 +++++++--------------
 arch/arm/mach-u300/dummyspichip.c                  |  20 +-
 arch/arm/mach-u300/i2c.c                           | 285 --------
 arch/arm/mach-u300/i2c.h                           |  23 -
 arch/arm/mach-u300/include/mach/hardware.h         |   5 -
 arch/arm/mach-u300/include/mach/irqs.h             |  80 ---
 arch/arm/mach-u300/include/mach/syscon.h           | 592 ----------------
 arch/arm/mach-u300/include/mach/timex.h            |  17 -
 arch/arm/mach-u300/include/mach/u300-regs.h        | 165 -----
 arch/arm/mach-u300/include/mach/uncompress.h       |  45 --
 arch/arm/mach-u300/regulator.c                     |  62 +-
 arch/arm/mach-u300/spi.c                           | 102 ---
 arch/arm/mach-u300/spi.h                           |  26 -
 arch/arm/mach-u300/timer.c                         | 113 +--
 arch/arm/mach-u300/timer.h                         |   1 -
 arch/arm/mach-u300/u300-gpio.h                     |  70 --
 drivers/clk/clk-u300.c                             | 718 +++++++++++++++----
 drivers/dma/coh901318.c                            |  43 ++
 drivers/i2c/busses/i2c-stu300.c                    |  16 +-
 drivers/pinctrl/pinctrl-coh901.c                   |  35 +-
 drivers/pinctrl/pinctrl-u300.c                     |   7 +
 drivers/rtc/rtc-coh901331.c                        |   6 +
 drivers/spi/spi-pl022.c                            |   1 +
 drivers/watchdog/coh901327_wdt.c                   |  12 +-
 include/linux/platform_data/pinctrl-coh901.h       |  22 -
 40 files changed, 1784 insertions(+), 2215 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/ste-u300.txt
 create mode 100644 Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt
 create mode 100644 Documentation/devicetree/bindings/dma/ste-coh901318.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-stericsson-coh901.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-st-ddci2c.txt
 create mode 100644 Documentation/devicetree/bindings/timer/stericsson-u300-apptimer.txt
 create mode 100644 Documentation/devicetree/bindings/watchdog/stericsson-coh901327.txt
 create mode 100644 arch/arm/boot/dts/ste-u300.dts
 rename arch/arm/{mach-u300/include/mach/debug-macro.S => include/debug/u300.S} (78%)
 delete mode 100644 arch/arm/mach-u300/i2c.c
 delete mode 100644 arch/arm/mach-u300/i2c.h
 delete mode 100644 arch/arm/mach-u300/include/mach/hardware.h
 delete mode 100644 arch/arm/mach-u300/include/mach/irqs.h
 delete mode 100644 arch/arm/mach-u300/include/mach/syscon.h
 delete mode 100644 arch/arm/mach-u300/include/mach/timex.h
 delete mode 100644 arch/arm/mach-u300/include/mach/u300-regs.h
 delete mode 100644 arch/arm/mach-u300/include/mach/uncompress.h
 delete mode 100644 arch/arm/mach-u300/spi.c
 delete mode 100644 arch/arm/mach-u300/spi.h
 delete mode 100644 arch/arm/mach-u300/timer.h
 delete mode 100644 arch/arm/mach-u300/u300-gpio.h
 delete mode 100644 include/linux/platform_data/pinctrl-coh901.h
Signature · 1 line
1.7.11.3
#1 lore raw

PATCH 1/39 ARM: u300: enable delaytimer on the U300

From: Linus Walleij <[email protected]>

The U300 can support timer-based delays, so implement this. Skips past jiffy calibration.

---
 arch/arm/mach-u300/timer.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/mach-u300/timer.c +11 -0
index d9e7320..c3d3802 100644
@@ -18,6 +18,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/irq.h>
+#include <linux/delay.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -345,6 +346,12 @@ static u32 notrace u300_read_sched_clock(void)
 	return readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
 }
 
+static unsigned long u300_read_current_timer(void)
+{
+	return readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
+}
+
+static struct delay_timer u300_delay_timer;
 
 /*
  * This sets up the system timers, clock source and clock event.
@@ -362,6 +369,10 @@ void __init u300_timer_init(void)
 
 	setup_sched_clock(u300_read_sched_clock, 32, rate);
 
+	u300_delay_timer.read_current_timer = &u300_read_current_timer;
+	u300_delay_timer.freq = rate;
+	register_current_timer_delay(&u300_delay_timer);
+
 	/*
 	 * Disable the "OS" and "DD" timers - these are designed for Symbian!
 	 * Example usage in cnh1601578 cpu subsystem pd_timer_app.c
Signature · 1 line
1.7.11.3
#2 lore raw

PATCH 2/39 ARM: u300: device tree support for the timer

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds device tree support for the U300 timer, by making the memory base offset and IRQ dynamically assigned, then optionally looking them up from the device tree.

Since the timer needs to be registered before any platform devices are created, we will go into the device tree and look up the "/timer at c0014000" node and read our base address and IRQ from there.

---
ChangeLog v1->v2:
- Use CLOCKSOURCE_OF_DECLARE as suggested by Rob Herring, select this for the machine so we do not get compile warnings.

---
 .../bindings/timer/stericsson-u300-apptimer.txt    |  18 ++++
 arch/arm/Kconfig                                   |   1 +
 arch/arm/mach-u300/timer.c                         | 109 ++++++++++++++-------
 arch/arm/mach-u300/timer.h                         |   1 +
 4 files changed, 91 insertions(+), 38 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/timer/stericsson-u300-apptimer.txt
Documentation/devicetree/bindings/timer/stericsson-u300-apptimer.txt new file +18 -0
new file mode 100644
index 0000000..9499bc8
@@ -0,0 +1,18 @@
+ST-Ericsson U300 apptimer
+
+Required properties:
+
+- compatible : should be "stericsson,u300-apptimer"
+- reg : Specifies base physical address and size of the registers.
+- interrupts : A list of 4 interrupts; one for each subtimer. These
+  are, in order: OS (operating system), DD (device driver) both
+  adopted for EPOC/Symbian with two specific IRQs for these tasks,
+  then GP1 and GP2, which are general-purpose timers.
+
+Example:
+
+timer {
+	compatible = "stericsson,u300-apptimer";
+	reg = <0xc0014000 0x1000>;
+	interrupts = <24 25 26 27>;
+};
arch/arm/Kconfig +1 -0
index d423d58..fbad333 100644
@@ -821,6 +821,7 @@ config ARCH_U300
 	select ARM_VIC
 	select CLKDEV_LOOKUP
 	select CLKSRC_MMIO
+	select CLKSRC_OF
 	select COMMON_CLK
 	select CPU_ARM926T
 	select GENERIC_CLOCKEVENTS
arch/arm/mach-u300/timer.c +71 -38

245 lines not on this page · raw message

arch/arm/mach-u300/timer.h +1 -0
index d34287b..7766dfa 100644
@@ -1 +1,2 @@
 extern void u300_timer_init(void);
+
Signature · 1 line
1.7.11.3
maintainer
#3 lore raw

PATCH 2/39 ARM: u300: device tree support for the timer

Quoted 15 lines · On Friday 31 May 2013 11:18:37 Linus Walleij wrote:
arch/arm/mach-u300/timer.c +15 -0
+
+
+void __init u300_timer_init()
+{
+       u300_timer_setup(U300_TIMER_APP_VBASE, IRQ_U300_TIMER_APP_GP1);
+}
+
+#ifdef CONFIG_OF
+
+static void __init u300_timer_init_of(struct device_node *np)
+{
+       void __iomem *base;
+       struct resource irq_res;
+       int irq;
+

arch/arm/mach-u300/timer.c void __init u300_timer_init(void) · line 459

Quoted 10 lines
arch/arm/mach-u300/timer.c +10 -0
+       base = of_iomap(np, 0);
+       /* Get the IRQ for the GP1 timer */
+       irq = of_irq_to_resource(np, 2, &irq_res);
+       u300_timer_setup(base, irq);
+}
+
+CLOCKSOURCE_OF_DECLARE(u300_timer, "stericsson,u300-apptimer",
+                      u300_timer_init_of);
+
+#endif

You should not need the CONFIG_OF #ifdef, since the CLOCKSOURCE_OF_DECLARE macro is designed to let the function get dropped by the compiler when that is not set.

You might want a CONFIG_ATAGS check for the other function though.

arch/arm/mach-u300/timer.h line 2

Quoted 8 lines
arch/arm/mach-u300/timer.h +1 -0
index d34287b..7766dfa 100644
@@ -1 +1,2 @@
 extern void u300_timer_init(void);
+

You probably didn't mean to include this newline.

Arnd

#4 lore raw

PATCH 2/39 ARM: u300: device tree support for the timer

Quoted 30 lines · Arnd Bergmann
Quoted 13 lines · On Friday 31 May 2013 11:18:37 Linus Walleij wrote:
arch/arm/mach-u300/timer.c +13 -0
+void __init u300_timer_init()
+{
+       u300_timer_setup(U300_TIMER_APP_VBASE, IRQ_U300_TIMER_APP_GP1);
+}
+
+#ifdef CONFIG_OF
+
+static void __init u300_timer_init_of(struct device_node *np)
+{
+       void __iomem *base;
+       struct resource irq_res;
+       int irq;
+

arch/arm/mach-u300/timer.c void __init u300_timer_init(void) · line 459

Quoted 10 lines
arch/arm/mach-u300/timer.c +10 -0
+       base = of_iomap(np, 0);
+       /* Get the IRQ for the GP1 timer */
+       irq = of_irq_to_resource(np, 2, &irq_res);
+       u300_timer_setup(base, irq);
+}
+
+CLOCKSOURCE_OF_DECLARE(u300_timer, "stericsson,u300-apptimer",
+                      u300_timer_init_of);
+
+#endif

You should not need the CONFIG_OF #ifdef, since the CLOCKSOURCE_OF_DECLARE macro is designed to let the function get dropped by the compiler when that is not set.

Quoted 1 line

You might want a CONFIG_ATAGS check for the other function though.

Both the other function and the #ifdef CONFIG_OF are deleted in patch 21. Is this OK?

Quoted 9 lines

arch/arm/mach-u300/timer.h line 2

Quoted 7 lines
arch/arm/mach-u300/timer.h +1 -0
index d34287b..7766dfa 100644
@@ -1 +1,2 @@
 extern void u300_timer_init(void);
+

You probably didn't mean to include this newline.

This entire file is also deleted in patch 21.

I can fix it up if you absolutely want to but it feels like something of an academic exercise.

Yours,
Linus Walleij

maintainer
#5 lore raw

PATCH 2/39 ARM: u300: device tree support for the timer

Quoted 9 lines · On Friday 31 May 2013 13:26:31 Linus Walleij wrote:
Quoted 6 lines

You should not need the CONFIG_OF #ifdef, since the CLOCKSOURCE_OF_DECLARE macro is designed to let the function get dropped by the compiler when that is not set.

You might want a CONFIG_ATAGS check for the other function though.

Both the other function and the #ifdef CONFIG_OF are deleted in patch 21. Is this OK?

Ok, that's fine then.

Quoted 10 lines
Quoted 9 lines

arch/arm/mach-u300/timer.h line 2

Quoted 7 lines
arch/arm/mach-u300/timer.h +1 -0
index d34287b..7766dfa 100644
@@ -1 +1,2 @@
 extern void u300_timer_init(void);
+

You probably didn't mean to include this newline.

Quoted 4 lines

This entire file is also deleted in patch 21.

I can fix it up if you absolutely want to but it feels like something of an academic exercise.

No, not if that is the only change you'd do to this patch.

Arnd

#6 lore raw

PATCH 3/39 pinctrl: u300 device tree support

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds a simple device tree compat string for the U300 pin controller. The base address is already passed properly as a resource and everything works fine.

---
 drivers/pinctrl/pinctrl-u300.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pinctrl/pinctrl-u300.c +7 -0
index 6a3a750..06bfa09 100644
@@ -1105,10 +1105,17 @@ static int u300_pmx_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id u300_pinctrl_match[] = {
+	{ .compatible = "stericsson,pinctrl-u300" },
+	{},
+};
+
+
 static struct platform_driver u300_pmx_driver = {
 	.driver = {
 		.name = DRIVER_NAME,
 		.owner = THIS_MODULE,
+		.of_match_table = u300_pinctrl_match,
 	},
 	.probe = u300_pmx_probe,
 	.remove = u300_pmx_remove,
Signature · 1 line
1.7.11.3
#7 lore raw

PATCH 4/39 pinctrl: coh901: add device tree support

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This makes it possible to probe the COH901 pinctrl driver from the device tree, and assigned the device tree node in the gpio_chip so we can look up cross-references from the device tree. Start grabbing the per-port (bank) IRQs by index instead of by name so we don't have to look up the IRQs by name going forward.

---
ChangeLog v1->v2:
- Alter the driver to look up IRQ by index.
- Alter the bindings accordingly.

---
 .../devicetree/bindings/gpio/gpio-stericsson-coh901.txt      |  7 +++++++
 drivers/pinctrl/pinctrl-coh901.c                             | 12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-stericsson-coh901.txt
Documentation/devicetree/bindings/gpio/gpio-stericsson-coh901.txt new file +7 -0
new file mode 100644
index 0000000..fd665b4
@@ -0,0 +1,7 @@
+ST-Ericsson COH 901 571/3 GPIO controller
+
+Required properties:
+- compatible: Compatible property value should be "stericsson,gpio-coh901"
+- reg: Physical base address of the controller and length of memory mapped
+  region.
+- interrupts: the 0...n interrupts assigned to the different GPIO ports/banks.
drivers/pinctrl/pinctrl-coh901.c +10 -2
index edde3ac..d4f8afd 100644
@@ -773,8 +773,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
 		port->number = portno;
 		port->gpio = gpio;
 
-		port->irq = platform_get_irq_byname(pdev,
-						    port->name);
+		port->irq = platform_get_irq(pdev, portno);
 
 		dev_dbg(gpio->dev, "register IRQ %d for port %s\n", port->irq,
 			port->name);
@@ -811,6 +810,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
 	}
 	dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno);
 
+#ifdef CONFIG_OF_GPIO
+	gpio->chip.of_node = pdev->dev.of_node;
+#endif
 	err = gpiochip_add(&gpio->chip);
 	if (err) {
 		dev_err(gpio->dev, "unable to add gpiochip: %d\n", err);
@@ -864,9 +866,15 @@ static int __exit u300_gpio_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id u300_gpio_match[] = {
+	{ .compatible = "stericsson,gpio-coh901" },
+	{},
+};
+
 static struct platform_driver u300_gpio_driver = {
 	.driver		= {
 		.name	= "u300-gpio",
+		.of_match_table = u300_gpio_match,
 	},
 	.remove		= __exit_p(u300_gpio_remove),
 };
Signature · 1 line
1.7.11.3
#8 lore raw

PATCH 5/39 ARM: u300: basic device tree support

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This register the most basic peripherals and makes the U300 boot to prompt from a device tree.

---
ChangeLog v1->v2:
- Rename nodes in accordance with review comments from Arnd:
- timer0 at x -> timer at x
- gpioN at x -> gpio at x
- pinctrl0 at x -> pinctrl at x
- intc at 0xx -> interrupt-controller at x
- uart at x -> serial at x

---
 Documentation/devicetree/bindings/arm/ste-u300.txt |  9 +++
 arch/arm/boot/dts/Makefile                         |  1 +
 arch/arm/boot/dts/ste-u300.dts                     | 86 ++++++++++++++++++++++
 arch/arm/mach-u300/core.c                          | 81 ++++++++++++++++++++
 4 files changed, 177 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/ste-u300.txt
 create mode 100644 arch/arm/boot/dts/ste-u300.dts
Documentation/devicetree/bindings/arm/ste-u300.txt new file +9 -0
new file mode 100644
index 0000000..222dca5
@@ -0,0 +1,9 @@
+ST-Ericsson U300 Device Tree Bindings
+
+For various board the "board" node may contain specific properties
+that pertain to this particular board, such as board-specific GPIOs
+or board power regulator supplies.
+
+Required root node property:
+
+compatible="stericsson,u300";
arch/arm/boot/dts/Makefile +1 -0
index b9f7121..3dd1316 100644
@@ -197,6 +197,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
 	tegra114-pluto.dtb
 dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \
 	versatile-pb.dtb
+dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb
 dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \
 	vexpress-v2p-ca9.dtb \
 	vexpress-v2p-ca15-tc1.dtb \
arch/arm/boot/dts/ste-u300.dts new file +86 -0

86 lines not on this page · raw message

arch/arm/mach-u300/core.c +81 -0

90 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#9 lore raw

PATCH 6/39 i2c: stu300: device tree support

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds device tree support for the ST DDC I2C driver known as "stu300" in the kernel tree.

---
 Documentation/devicetree/bindings/i2c/i2c-st-ddci2c.txt | 15 +++++++++++++++
 drivers/i2c/busses/i2c-stu300.c                         | 12 ++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-st-ddci2c.txt
Documentation/devicetree/bindings/i2c/i2c-st-ddci2c.txt new file +15 -0
new file mode 100644
index 0000000..bd81a48
@@ -0,0 +1,15 @@
+ST Microelectronics DDC I2C
+
+Required properties :
+- compatible : Must be "st,ddci2c"
+- reg: physical base address of the controller and length of memory mapped
+     region.
+- interrupts: interrupt number to the cpu.
+- #address-cells = <1>;
+- #size-cells = <0>;
+
+Optional properties:
+- Child nodes conforming to i2c bus binding
+
+Examples :
+
drivers/i2c/busses/i2c-stu300.c +12 -0
index 0a6f941..1beaa05a 100644
@@ -17,6 +17,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/of_i2c.h>
 
 /* the name of this kernel module */
 #define NAME "stu300"
@@ -923,6 +924,7 @@ stu300_probe(struct platform_device *pdev)
 	adap->nr = bus_nr;
 	adap->algo = &stu300_algo;
 	adap->dev.parent = &pdev->dev;
+	adap->dev.of_node = pdev->dev.of_node;
 	i2c_set_adapdata(adap, dev);
 
 	/* i2c device drivers may be active on return from add_adapter() */
@@ -934,6 +936,10 @@ stu300_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, dev);
+	dev_info(&pdev->dev, "ST DDC I2C @ %p, irq %d\n",
+		 dev->virtbase, dev->irq);
+	of_i2c_register_devices(adap);
+
 	return 0;
 }
 
@@ -978,11 +984,17 @@ stu300_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id stu300_dt_match[] = {
+	{ .compatible = "st,ddci2c" },
+	{},
+};
+
 static struct platform_driver stu300_i2c_driver = {
 	.driver = {
 		.name	= NAME,
 		.owner	= THIS_MODULE,
 		.pm	= STU300_I2C_PM,
+		.of_match_table = stu300_dt_match,
 	},
 	.remove		= __exit_p(stu300_remove),
 
Signature · 1 line
1.7.11.3
#10 lore raw

PATCH 7/39 ARM: u300: register I2C bus drivers from device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds the two I2C busses to the device tree so these probe properly.

---
 arch/arm/boot/dts/ste-u300.dts | 18 ++++++++++++++++++
 arch/arm/mach-u300/core.c      |  4 ++++
 2 files changed, 22 insertions(+)
arch/arm/boot/dts/ste-u300.dts +18 -0
index 9e423eb..67a1b52 100644
@@ -49,6 +49,24 @@
 		reg = <0xc0011000 0x1000>;
 	};
 
+	i2c0: i2c at c0004000 {
+		compatible = "st,ddci2c";
+		reg = <0xc0004000 0x1000>;
+		interrupt-parent = <&vicb>;
+		interrupts = <8>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+	i2c1: i2c at c0005000 {
+		compatible = "st,ddci2c";
+		reg = <0xc0005000 0x1000>;
+		interrupt-parent = <&vicb>;
+		interrupts = <9>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
 	amba {
 		compatible = "arm,amba-bus";
 		#address-cells = <1>;
arch/arm/mach-u300/core.c +4 -0
index a210b1c..abe9704 100644
@@ -714,6 +714,10 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 		"uart0", &uart0_plat_data),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
 		"uart1", &uart1_plat_data),
+	OF_DEV_AUXDATA("st,ddci2c", U300_I2C0_BASE,
+		"stu300.0", NULL),
+	OF_DEV_AUXDATA("st,ddci2c", U300_I2C1_BASE,
+		"stu300.1", NULL),
 	OF_DEV_AUXDATA("arm,primecell", U300_MMCSD_BASE,
 		"mmci", &mmcsd_platform_data),
 	{ /* sentinel */ },
Signature · 1 line
1.7.11.3
#11 lore raw

PATCH 8/39 watchdog: coh901327: devicetree support

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds support for probing the COH 901 327 watchdog from the device tree and also adds associated bindings.

---
 .../bindings/watchdog/stericsson-coh901327.txt        | 19 +++++++++++++++++++
 drivers/watchdog/coh901327_wdt.c                      | 12 +++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/watchdog/stericsson-coh901327.txt
Documentation/devicetree/bindings/watchdog/stericsson-coh901327.txt new file +19 -0
new file mode 100644
index 0000000..8ffb88e
@@ -0,0 +1,19 @@
+ST-Ericsson COH 901 327 Watchdog timer
+
+Required properties:
+- compatible: must be "stericsson,coh901327".
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- interrupts: the interrupt used for the watchdog timeout warning.
+
+Optional properties:
+- timeout-sec: contains the watchdog timeout in seconds.
+
+Example:
+
+watchdog: watchdog at c0012000 {
+	compatible = "stericsson,coh901327";
+	reg = <0xc0012000 0x1000>;
+	interrupts = <3>;
+	timeout-sec = <60>;
+};
drivers/watchdog/coh901327_wdt.c +9 -3
index b9b8a8b..4bd070f 100644
@@ -354,9 +354,9 @@ static int __init coh901327_probe(struct platform_device *pdev)
 
 	clk_disable(clk);
 
-	if (margin < 1 || margin > 327)
-		margin = 60;
-	coh901327_wdt.timeout = margin;
+	ret = watchdog_init_timeout(&coh901327_wdt, margin, &pdev->dev);
+	if (ret < 0)
+		coh901327_wdt.timeout = 60;
 
 	ret = watchdog_register_device(&coh901327_wdt);
 	if (ret == 0)
@@ -441,10 +441,16 @@ void coh901327_watchdog_reset(void)
 	/* Return and await doom */
 }
 
+static const struct of_device_id coh901327_dt_match[] = {
+	{ .compatible = "stericsson,coh901327" },
+	{},
+};
+
 static struct platform_driver coh901327_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= "coh901327_wdog",
+		.of_match_table = coh901327_dt_match,
 	},
 	.remove		= __exit_p(coh901327_remove),
 	.suspend	= coh901327_suspend,
Signature · 1 line
1.7.11.3
#12 lore raw

PATCH 9/39 ARM: u300: add the COH 901 327 watchdog to device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds the COH 901 327 watchdog to the U300 device tree.

---
 arch/arm/boot/dts/ste-u300.dts | 7 +++++++
 arch/arm/mach-u300/core.c      | 2 ++
 2 files changed, 9 insertions(+)
arch/arm/boot/dts/ste-u300.dts +7 -0
index 67a1b52..f0eb5f4 100644
@@ -49,6 +49,13 @@
 		reg = <0xc0011000 0x1000>;
 	};
 
+	watchdog: watchdog at c0012000 {
+		compatible = "stericsson,coh901327";
+		reg = <0xc0012000 0x1000>;
+		interrupt-parent = <&vicb>;
+		interrupts = <3>;
+	};
+
 	i2c0: i2c at c0004000 {
 		compatible = "st,ddci2c";
 		reg = <0xc0004000 0x1000>;
arch/arm/mach-u300/core.c +2 -0
index abe9704..190e788 100644
@@ -710,6 +710,8 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 		"pinctrl-u300", NULL),
 	OF_DEV_AUXDATA("stericsson,gpio-coh901", U300_GPIO_BASE,
 		"u300-gpio", &u300_gpio_plat),
+	OF_DEV_AUXDATA("stericsson,coh901327", U300_WDOG_BASE,
+		"coh901327_wdog", NULL),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE,
 		"uart0", &uart0_plat_data),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
Signature · 1 line
1.7.11.3
#13 lore raw

PATCH 10/39 rtc: coh901331: add devicetree support

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This add devicetree probe support to the COH 901 331 RTC driver.

Cc Alessandro Zummo <[email protected]>

---
Hi Alessandro, I'm seeking an ACK to take this patch through the ARM SoC tree along with the code making use of it.

---
 drivers/rtc/rtc-coh901331.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/rtc/rtc-coh901331.c +6 -0
index 93c0658..ad6863a 100644
@@ -274,11 +274,17 @@ static void coh901331_shutdown(struct platform_device *pdev)
 	clk_disable_unprepare(rtap->clk);
 }
 
+static const struct of_device_id coh901331_dt_match[] = {
+	{ .compatible = "stericsson,coh901331" },
+	{},
+};
+
 static struct platform_driver coh901331_driver = {
 	.driver = {
 		.name = "rtc-coh901331",
 		.owner = THIS_MODULE,
 		.pm = &coh901331_pm_ops,
+		.of_match_table = coh901331_dt_match,
 	},
 	.remove = __exit_p(coh901331_remove),
 	.shutdown = coh901331_shutdown,
Signature · 1 line
1.7.11.3
#14 lore raw

PATCH 11/39 ARM: u300: add RTC to device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds the COH 901 331 RTC to the U300 device tree.

---
 arch/arm/boot/dts/ste-u300.dts | 7 +++++++
 arch/arm/mach-u300/core.c      | 2 ++
 2 files changed, 9 insertions(+)
arch/arm/boot/dts/ste-u300.dts +7 -0
index f0eb5f4..711a2d9 100644
@@ -56,6 +56,13 @@
 		interrupts = <3>;
 	};
 
+	rtc: rtc at c0017000 {
+		compatible = "stericsson,coh901331";
+		reg = <0xc0017000 0x1000>;
+		interrupt-parent = <&vicb>;
+		interrupts = <10>;
+	};
+
 	i2c0: i2c at c0004000 {
 		compatible = "st,ddci2c";
 		reg = <0xc0004000 0x1000>;
arch/arm/mach-u300/core.c +2 -0
index 190e788..637034b 100644
@@ -712,6 +712,8 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 		"u300-gpio", &u300_gpio_plat),
 	OF_DEV_AUXDATA("stericsson,coh901327", U300_WDOG_BASE,
 		"coh901327_wdog", NULL),
+	OF_DEV_AUXDATA("stericsson,coh901331", U300_RTC_BASE,
+		"rtc-coh901331", NULL),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE,
 		"uart0", &uart0_plat_data),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
Signature · 1 line
1.7.11.3
#15 lore raw

PATCH 12/39 ARM: u300: set up board power from device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds support for setting up the board power from the device tree on the U300. We use a board-specific node in the device tree for the S365 board and bind a regulator for the board power to this node.

---
 Documentation/devicetree/bindings/arm/ste-u300.txt | 13 +++++++
 arch/arm/mach-u300/regulator.c                     | 42 ++++++++++++++++++++--
 2 files changed, 52 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/arm/ste-u300.txt +13 -0
index 222dca5..cd9001a 100644
@@ -7,3 +7,16 @@ or board power regulator supplies.
 Required root node property:
 
 compatible="stericsson,u300";
+
+Boards with the U300 SoC include:
+
+S365 "Small Board U365":
+
+Required node: s365
+
+Example:
+
+s365 {
+	compatible = "stericsson,s365";
+	vana15-supply = <&ab3100_ldo_d_reg>;
+};
arch/arm/mach-u300/regulator.c +39 -3

68 lines not on this page · raw message

Signature · 1 line
1.7.11.3
maintainer
#16 lore raw

PATCH 12/39 ARM: u300: set up board power from device tree

Quoted 9 lines · On Friday 31 May 2013 11:18:47 Linus Walleij wrote:

From: Linus Walleij <[email protected]>

This adds support for setting up the board power from the device tree on the U300. We use a board-specific node in the device tree for the S365 board and bind a regulator for the board power to this node.

This is fairly unusual, I think I've never seen a platform driver registered for a board. Is that the intended method for hogging a regulator?

Arnd

#17 lore raw

PATCH 12/39 ARM: u300: set up board power from device tree

Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · On Friday 31 May 2013 11:18:47 Linus Walleij wrote:

From: Linus Walleij <[email protected]>

This adds support for setting up the board power from the device tree on the U300. We use a board-specific node in the device tree for the S365 board and bind a regulator for the board power to this node.

Quoted 6 lines
Quoted 2 lines

This is fairly unusual, I think I've never seen a platform driver registered for a board. Is that the intended method for hogging a regulator?

There are no precedents AFAICT.

As you can see the previous code uses:
regulator_get(NULL, "vana15");

But that does not match with device tree: it needs some node to tie the regulator to, i.e. a platform device. Else we leave the system in some half-transition to DT.

The siutation is similar to our inability to use clk_get_sys() in pure DT platforms - no node/device there either.

Mark remarked on the first iteration that:

Quoted 3 lines

I would expect this to be bound based on the board name that appears in the device tree which (given the way this stuff mostly works) I'd expect to have a device node available.

This is what I'm trying to do here.

The root node which actually contains the compatible-string for the board itself can *not* be used, as the OF platform core code does not create a platform device for this node, and it cannot reference anything either.

So a single board node directly in the root was the best I could come up with, other suggestions welcome...

Yours,
Linus Walleij

maintainer
#18 lore raw

PATCH 12/39 ARM: u300: set up board power from device tree

Quoted 8 lines · On Friday 31 May 2013 13:33:45 Linus Walleij wrote:

Mark remarked on the first iteration that:

Quoted 3 lines

I would expect this to be bound based on the board name that appears in the device tree which (given the way this stuff mostly works) I'd expect to have a device node available.

This is what I'm trying to do here.

Quoted 7 lines

The root node which actually contains the compatible-string for the board itself can *not* be used, as the OF platform core code does not create a platform device for this node, and it cannot reference anything either.

So a single board node directly in the root was the best I could come up with, other suggestions welcome...

I think I would actually put this into a machine_desc callback for a machine that matches just this one board: If this is truly board specific, this is where it belongs.

Of course we try to have a single machine_desc work with any board normally, but the machine_desc is also the abstraction we already have for boards. There is a device_node for '/', but as you say there is no 'struct device' attached to it.

If it is not really a property of a particular board, but something that you would need for other boards as well, it could perhaps be tied to the syscon functionality, or to ab3100:

ab3100_regulators_probe() could itself set up the the supply and then set the syscon bit. Basically you just move all of arch/arm/mach-u300/regulator.c into drivers/regulator/ab3100.c

Arnd

#19 lore raw

PATCH 12/39 ARM: u300: set up board power from device tree

Quoted 7 lines · Arnd Bergmann

If it is not really a property of a particular board, but something that you would need for other boards as well, it could perhaps be tied to the syscon functionality, or to ab3100:

ab3100_regulators_probe() could itself set up the the supply and then set the syscon bit. Basically you just move all of arch/arm/mach-u300/regulator.c into drivers/regulator/ab3100.c

I think this is more likely the case.

Mark: would you be OK with the ab3100 driver hogging one of its own regulators?

Yours,
Linus Walleij

maintainer
#20 lore raw

PATCH 12/39 ARM: u300: set up board power from device tree

Quoted 2 lines · Linus Walleij

Mark: would you be OK with the ab3100 driver hogging one of its own regulators?

I'm not sure what that means, sorry. Could someone send a patch please?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130601/48f84ed4/attachment.sig>

#21 lore raw

PATCH 12/39 ARM: u300: set up board power from device tree

Quoted 6 lines · Mark Brown
Quoted 2 lines · Linus Walleij

Mark: would you be OK with the ab3100 driver hogging one of its own regulators?

I'm not sure what that means, sorry. Could someone send a patch please?

I've sent a patch so you can see what I mean by this. (Subject [PATCH 2/2] regulators: ab3100: bootstrap board power)

It is changing the stuff proposed so far over to this way of doing things.

If this approach is fine I'd prefer if we keep this on top of the stack instead of me going back to amend everything since it creates a messy rebase-hell for me. The end result is textually identical.

Yours,
Linus Walleij

#22 lore raw

PATCH 13/39 ARM: u300: support regulators in the device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

Now that we have enabled board power and the AB3100 regulators, put the regulator data into the device tree and enable it so we can start to tie regulators to devices. To begin with we're only supplying the power to the board itself.

---
 arch/arm/boot/dts/ste-u300.dts | 79 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
arch/arm/boot/dts/ste-u300.dts +79 -0
index 711a2d9..d1ab4e9 100644
@@ -24,6 +24,11 @@
 		reg = <0x48000000 0x03c00000>;
 	};
 
+	s365 {
+		compatible = "stericsson,s365";
+		vana15-supply = <&ab3100_ldo_d_reg>;
+	};
+
 	timer: timer at c0014000 {
 		compatible = "stericsson,u300-apptimer";
 		reg = <0xc0014000 0x1000>;
@@ -70,6 +75,74 @@
 		interrupts = <8>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+		ab3100: ab3100 at 0x48 {
+			compatible = "stericsson,ab3100";
+			reg = <0x48>;
+			interrupt-parent = <&vica>;
+			interrupts = <0>; /* EXT0 IRQ */
+			ab3100-regulators {
+				compatible = "stericsson,ab3100-regulators";
+				ab3100_ldo_a_reg: ab3100_ldo_a {
+					regulator-compatible = "ab3100_ldo_a";
+					startup-delay-us = <200>;
+					regulator-always-on;
+					regulator-boot-on;
+				};
+				ab3100_ldo_c_reg: ab3100_ldo_c {
+					regulator-compatible = "ab3100_ldo_c";
+					startup-delay-us = <200>;
+				};
+				ab3100_ldo_d_reg: ab3100_ldo_d {
+					regulator-compatible = "ab3100_ldo_d";
+					startup-delay-us = <200>;
+				};
+				ab3100_ldo_e_reg: ab3100_ldo_e {
+					regulator-compatible = "ab3100_ldo_e";
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+					startup-delay-us = <200>;
+					regulator-always-on;
+					regulator-boot-on;
+				};
+				ab3100_ldo_f_reg: ab3100_ldo_f {
+					regulator-compatible = "ab3100_ldo_f";
+					regulator-min-microvolt = <2500000>;
+					regulator-max-microvolt = <2500000>;
+					startup-delay-us = <600>;
+					regulator-always-on;
+					regulator-boot-on;
+				};
+				ab3100_ldo_g_reg: ab3100_ldo_g {
+					regulator-compatible = "ab3100_ldo_g";
+					regulator-min-microvolt = <1500000>;
+					regulator-max-microvolt = <2850000>;
+					startup-delay-us = <400>;
+				};
+				ab3100_ldo_h_reg: ab3100_ldo_h {
+					regulator-compatible = "ab3100_ldo_h";
+					regulator-min-microvolt = <1200000>;
+					regulator-max-microvolt = <2750000>;
+					startup-delay-us = <200>;
+				};
+				ab3100_ldo_k_reg: ab3100_ldo_k {
+					regulator-compatible = "ab3100_ldo_k";
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <2750000>;
+					startup-delay-us = <200>;
+				};
+				ab3100_ext_reg: ab3100_ext {
+					regulator-compatible = "ab3100_ext";
+				};
+				ab3100_buck_reg: ab3100_buck {
+					regulator-compatible = "ab3100_buck";
+					regulator-min-microvolt = <1200000>;
+					regulator-max-microvolt = <1800000>;
+					startup-delay-us = <1000>;
+					regulator-always-on;
+					regulator-boot-on;
+				};
+			};
+		};
 	};
 
 	i2c1: i2c at c0005000 {
@@ -79,6 +152,12 @@
 		interrupts = <9>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+		fwcam0: fwcam at 0x10 {
+			reg = <0x10>;
+		};
+		fwcam1: fwcam at 0x5d {
+			reg = <0x5d>;
+		};
 	};
 
 	amba {
Signature · 1 line
1.7.11.3
#23 lore raw

PATCH 14/39 ARM: u300: enable MMC/SD card from device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds support for the U300 MMC/SD card slot from the device tree boot. No other changes needed.

---
 arch/arm/boot/dts/ste-u300.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/boot/dts/ste-u300.dts +14 -0
index d1ab4e9..ae51dd1 100644
@@ -193,5 +193,19 @@
 			interrupt-parent = <&vicb>;
 			interrupts = <20>;
 		};
+
+		mmcsd: mmcsd at c0001000 {
+			compatible = "arm,pl18x", "arm,primecell";
+			reg = <0xc0001000 0x1000>;
+			interrupt-parent = <&vicb>;
+			interrupts = <6 7>;
+			max-frequency = <24000000>;
+			bus-width = <4>; // SD-card slot
+			mmc-cap-mmc-highspeed;
+			mmc-cap-sd-highspeed;
+			cd-gpios = <&gpio 12 0x4>;
+			cd-inverted;
+			vmmc-supply = <&ab3100_ldo_g_reg>;
+		};
 	};
 };
Signature · 1 line
1.7.11.3
#24 lore raw

PATCH 15/39 dma: coh901318: add devicetree support

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds support for probing the COH 901 318 DMA controller and channels from the device tree.

Contains portions of a sketch patch from Arnd Bergmann.

---
ChangeLog v1->v2:
- Folded in channel translation, request and filtering from the device tree based on a patch by Arnd Bergmann.
- Added device tree binding documentation.

---
 .../devicetree/bindings/dma/ste-coh901318.txt      | 32 ++++++++++++++++
 drivers/dma/coh901318.c                            | 43 ++++++++++++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/ste-coh901318.txt
Documentation/devicetree/bindings/dma/ste-coh901318.txt new file +32 -0
new file mode 100644
index 0000000..091ad05
@@ -0,0 +1,32 @@
+ST-Ericsson COH 901 318 DMA Controller
+
+This is a DMA controller which has begun as a fork of the
+ARM PL08x PrimeCell VHDL code.
+
+Required properties:
+- compatible: should be "stericsson,coh901318"
+- reg: register locations and length
+- interrupts: the single DMA IRQ
+- #dma-cells: must be set to <1>, as the channels on the
+  COH 901 318 are simple and identified by a single number
+- dma-channels: the number of DMA channels handled
+
+Example:
+
+dmac: dma-controller at c00020000 {
+	compatible = "stericsson,coh901318";
+	reg = <0xc0020000 0x1000>;
+	interrupt-parent = <&vica>;
+	interrupts = <2>;
+	#dma-cells = <1>;
+	dma-channels = <40>;
+};
+
+Consumers example:
+
+uart0: serial at c0013000 {
+	compatible = "...";
+	(...)
+	dmas = <&dmac 17 &dmac 18>;
+	dma-names = "tx", "rx";
+};
drivers/dma/coh901318.c +43 -0

84 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#25 lore raw

PATCH 16/39 ARM: u300: augment device tree with DMA channels

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds DMA channel assignments to the MMC/SD-controller and the two UARTs already in the U300 device tree, as we have now defined a way to obtain DMA channels from the device tree.

---
 arch/arm/boot/dts/ste-u300.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/ste-u300.dts +6 -0
index ae51dd1..6be932b 100644
@@ -185,6 +185,8 @@
 			reg = <0xc0013000 0x1000>;
 			interrupt-parent = <&vica>;
 			interrupts = <22>;
+			dmas = <&dmac 17 &dmac 18>;
+			dma-names = "tx", "rx";
 		};
 
 		uart1: serial at c0007000 {
@@ -192,6 +194,8 @@
 			reg = <0xc0007000 0x1000>;
 			interrupt-parent = <&vicb>;
 			interrupts = <20>;
+			dmas = <&dmac 38 &dmac 39>;
+			dma-names = "tx", "rx";
 		};
 
 		mmcsd: mmcsd at c0001000 {
@@ -206,6 +210,8 @@
 			cd-gpios = <&gpio 12 0x4>;
 			cd-inverted;
 			vmmc-supply = <&ab3100_ldo_g_reg>;
+			dmas = <&dmac 14>;
+			dma-names = "rx";
 		};
 	};
 };
Signature · 1 line
1.7.11.3
#26 lore raw

PATCH 17/39 ARM: u300: add the COH 901 318 DMAC to device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds the COH 901 318 DMA controller to the U300 device tree. All devices now converted to device tree so far will start to find their DMA channels.

Note that the U300 is not yet using the device tree to obtain DMA channels, but this is a first step.

---
 arch/arm/boot/dts/ste-u300.dts | 9 +++++++++
 arch/arm/mach-u300/core.c      | 2 ++
 2 files changed, 11 insertions(+)
arch/arm/boot/dts/ste-u300.dts +9 -0
index 6be932b..4dc9f26 100644
@@ -68,6 +68,15 @@
 		interrupts = <10>;
 	};
 
+	dmac: dma-controller at c00020000 {
+		compatible = "stericsson,coh901318";
+		reg = <0xc0020000 0x1000>;
+		interrupt-parent = <&vica>;
+		interrupts = <2>;
+		#dma-cells = <1>;
+		dma-channels = <40>;
+	};
+
 	i2c0: i2c at c0004000 {
 		compatible = "st,ddci2c";
 		reg = <0xc0004000 0x1000>;
arch/arm/mach-u300/core.c +2 -0
index 637034b..7866f54 100644
@@ -714,6 +714,8 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 		"coh901327_wdog", NULL),
 	OF_DEV_AUXDATA("stericsson,coh901331", U300_RTC_BASE,
 		"rtc-coh901331", NULL),
+	OF_DEV_AUXDATA("stericsson,coh901318", U300_DMAC_BASE,
+		"coh901318", NULL),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE,
 		"uart0", &uart0_plat_data),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
Signature · 1 line
1.7.11.3
#27 lore raw

PATCH 18/39 ARM: u300: add SPI PL022 to the device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This registers the PL022 PrimeCell from the U300 device tree. We make a new copy of the platform data for the device tree boot path, as the old platform data is in an older file which will be going away.

---
ChangeLog v1->v2:
- Add DMA channels.

---
 arch/arm/boot/dts/ste-u300.dts | 12 ++++++++++++
 arch/arm/mach-u300/core.c      | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)
arch/arm/boot/dts/ste-u300.dts +12 -0
index 4dc9f26..355ac60 100644
@@ -222,5 +222,17 @@
 			dmas = <&dmac 14>;
 			dma-names = "rx";
 		};
+
+		spi: ssp at c0006000 {
+			compatible = "arm,pl022", "arm,primecell";
+			reg = <0xc0006000 0x1000>;
+			interrupt-parent = <&vica>;
+			interrupts = <23>;
+			dmas = <&dmac 27 &dmac 28>;
+			dma-names = "tx", "rx";
+			num-cs = <3>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
 	};
 };
arch/arm/mach-u300/core.c +19 -0
index 7866f54..d102cb5 100644
@@ -19,6 +19,7 @@
 #include <linux/dmaengine.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/mmci.h>
+#include <linux/amba/pl022.h>
 #include <linux/amba/serial.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
@@ -704,6 +705,22 @@ MACHINE_END
 
 #ifdef CONFIG_OF
 
+static struct pl022_ssp_controller spi_plat_data = {
+	/* If you have several SPI buses this varies, we have only bus 0 */
+	.bus_id = 0,
+	/*
+	 * On the APP CPU GPIO 4, 5 and 6 are connected as generic
+	 * chip selects for SPI. (Same on U330, U335 and U365.)
+	 * TODO: make sure the GPIO driver can select these properly
+	 * and do padmuxing accordingly too.
+	 */
+	.num_chipselect = 3,
+	.enable_dma = 1,
+	.dma_filter = coh901318_filter_id,
+	.dma_rx_param = (void *) U300_DMA_SPI_RX,
+	.dma_tx_param = (void *) U300_DMA_SPI_TX,
+};
+
 /* These are mostly to get the right device names for the clock lookups */
 static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("stericsson,pinctrl-u300", U300_SYSCON_BASE,
@@ -720,6 +737,8 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 		"uart0", &uart0_plat_data),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
 		"uart1", &uart1_plat_data),
+	OF_DEV_AUXDATA("arm,primecell", U300_SPI_BASE,
+		"pl022", &spi_plat_data),
 	OF_DEV_AUXDATA("st,ddci2c", U300_I2C0_BASE,
 		"stu300.0", NULL),
 	OF_DEV_AUXDATA("st,ddci2c", U300_I2C1_BASE,
Signature · 1 line
1.7.11.3
#28 lore raw

PATCH 19/39 ARM: u300: probe the U300 dummy-spichip from device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This probes the U300 dummy-spichip from the device tree and adds the apropriate node to the tree.

---
 arch/arm/boot/dts/ste-u300.dts    | 5 +++++
 arch/arm/mach-u300/dummyspichip.c | 6 ++++++
 2 files changed, 11 insertions(+)
arch/arm/boot/dts/ste-u300.dts +5 -0
index 355ac60..1b20769 100644
@@ -233,6 +233,11 @@
 			num-cs = <3>;
 			#address-cells = <1>;
 			#size-cells = <0>;
+			spi-dummy at 1 {
+				compatible = "arm,pl022-dummy";
+				reg = <1>;
+				spi-max-frequency = <20000000>;
+			};
 		};
 	};
 };
arch/arm/mach-u300/dummyspichip.c +6 -0
index 2785cb6..52962bf 100644
@@ -263,10 +263,16 @@ static int pl022_dummy_remove(struct spi_device *spi)
 	return 0;
 }
 
+static const struct of_device_id pl022_dummy_dt_match[] = {
+	{ .compatible = "arm,pl022-dummy" },
+	{},
+};
+
 static struct spi_driver pl022_dummy_driver = {
 	.driver = {
 		.name	= "spi-dummy",
 		.owner	= THIS_MODULE,
+		.of_match_table = pl022_dummy_dt_match,
 	},
 	.probe	= pl022_dummy_probe,
 	.remove	= pl022_dummy_remove,
Signature · 1 line
1.7.11.3
#29 lore raw

PATCH 20/39 ARM: u300: add FSMC flash into the device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This registers the U300 FSMC flash controller from the device tree, and defines the three partitions. Skip the BBT scan as in the current platform data.

---
 arch/arm/boot/dts/ste-u300.dts | 26 ++++++++++++++++++++++++++
 arch/arm/mach-u300/core.c      |  2 ++
 2 files changed, 28 insertions(+)
arch/arm/boot/dts/ste-u300.dts +26 -0
index 1b20769..b8a8ddb 100644
@@ -77,6 +77,32 @@
 		dma-channels = <40>;
 	};
 
+	/* A NAND flash of 128 MiB */
+	fsmc: flash at 40000000 {
+		compatible = "stericsson,fsmc-nand";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <0x9f800000 0x1000>,	/* FSMC Register*/
+			<0x80000000 0x4000>,	/* NAND Base DATA */
+			<0x80020000 0x4000>,	/* NAND Base ADDR */
+			<0x80010000 0x4000>;	/* NAND Base CMD */
+		reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
+		nand-skip-bbtscan;
+
+		partition at 0 {
+		label = "boot records";
+			reg = <0x0 0x20000>;
+		};
+		partition at 20000 {
+			label = "free";
+			reg = <0x20000 0x7e0000>;
+		};
+		partition at 800000 {
+			label = "platform";
+			reg = <0x800000 0xf800000>;
+		};
+	};
+
 	i2c0: i2c at c0004000 {
 		compatible = "st,ddci2c";
 		reg = <0xc0004000 0x1000>;
arch/arm/mach-u300/core.c +2 -0
index d102cb5..8f9e77a 100644
@@ -733,6 +733,8 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 		"rtc-coh901331", NULL),
 	OF_DEV_AUXDATA("stericsson,coh901318", U300_DMAC_BASE,
 		"coh901318", NULL),
+	OF_DEV_AUXDATA("stericsson,fsmc-nand", U300_NAND_IF_PHYS_BASE,
+		"fsmc-nand", NULL),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE,
 		"uart0", &uart0_plat_data),
 	OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
Signature · 1 line
1.7.11.3
#30 lore raw

PATCH 21/39 ARM: u300: delete all static board data

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

We have now transferred all the U300 peripherals to the device tree, so we just select USE_OF, and delete all static board data, then require that this platform shall be booted using the device tree and nothing else.

This gets rid of the MMCI (PL180), PL022, and serial PL011 platform data entries and more.

---
ChangeLog v1->v2:
- Delete MORE static data! (Platform data and static DMA channel assignments for PL011, PL022, PL180...

---
 arch/arm/Kconfig               |   1 +
 arch/arm/mach-u300/Makefile    |   2 -
 arch/arm/mach-u300/core.c      | 548 +----------------------------------------
 arch/arm/mach-u300/i2c.c       | 285 ---------------------
 arch/arm/mach-u300/i2c.h       |  23 --
 arch/arm/mach-u300/regulator.c |  12 +-
 arch/arm/mach-u300/spi.c       | 102 --------
 arch/arm/mach-u300/spi.h       |  26 --
 arch/arm/mach-u300/timer.c     |  38 +--
 arch/arm/mach-u300/timer.h     |   2 -
 arch/arm/mach-u300/u300-gpio.h |  70 ------
 11 files changed, 22 insertions(+), 1087 deletions(-)
 delete mode 100644 arch/arm/mach-u300/i2c.c
 delete mode 100644 arch/arm/mach-u300/i2c.h
 delete mode 100644 arch/arm/mach-u300/spi.c
 delete mode 100644 arch/arm/mach-u300/spi.h
 delete mode 100644 arch/arm/mach-u300/timer.h
 delete mode 100644 arch/arm/mach-u300/u300-gpio.h
arch/arm/Kconfig +1 -0
index fbad333..2689643 100644
@@ -827,6 +827,7 @@ config ARCH_U300
 	select GENERIC_CLOCKEVENTS
 	select HAVE_TCM
 	select SPARSE_IRQ
+	select USE_OF
 	help
 	  Support for ST-Ericsson U300 series mobile platforms.
 
arch/arm/mach-u300/Makefile +0 -2
index 5a86c58..0f362b6 100644
@@ -7,7 +7,5 @@ obj-m		:=
 obj-n		:=
 obj-		:=
 
-obj-$(CONFIG_SPI_PL022)           += spi.o
 obj-$(CONFIG_MACH_U300_SPIDUMMY)  += dummyspichip.o
-obj-$(CONFIG_I2C_STU300)          += i2c.o
 obj-$(CONFIG_REGULATOR_AB3100)    += regulator.o
arch/arm/mach-u300/core.c +6 -542

618 lines not on this page · raw message

arch/arm/mach-u300/i2c.c deleted +0 -285

285 lines not on this page · raw message

arch/arm/mach-u300/i2c.h deleted +0 -23
deleted file mode 100644
index 485c02e..0000000
@@ -1,23 +0,0 @@
-/*
- * arch/arm/mach-u300/i2c.h
- *
- * Copyright (C) 2009 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- *
- * Register board i2c devices
- * Author: Linus Walleij <[email protected]>
- */
-
-#ifndef MACH_U300_I2C_H
-#define MACH_U300_I2C_H
-
-#ifdef CONFIG_I2C_STU300
-void __init u300_i2c_register_board_devices(void);
-#else
-/* Compile out this stuff if no I2C adapter is available */
-static inline void __init u300_i2c_register_board_devices(void)
-{
-}
-#endif
-
-#endif
arch/arm/mach-u300/regulator.c +3 -9
index 8a67dc6..bbda954 100644
@@ -58,10 +58,7 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 	u32 val;
 
 	pr_info("U300: setting up board power\n");
-	if (pdev)
-		main_power_15 = regulator_get(&pdev->dev, "vana15");
-	else
-		main_power_15 = regulator_get(NULL, "vana15");
+	main_power_15 = regulator_get(&pdev->dev, "vana15");
 
 	if (IS_ERR(main_power_15)) {
 		pr_err("could not get vana15");
@@ -114,11 +111,8 @@ static struct platform_driver s365_board_driver = {
  */
 static int __init u300_init_boardpower(void)
 {
-	if (of_have_populated_dt())
-		return platform_driver_probe(&s365_board_driver,
-					     s365_board_probe);
-	/* Only call this on non-DT boots */
-	return __u300_init_boardpower(NULL);
+	return platform_driver_probe(&s365_board_driver,
+				     s365_board_probe);
 }
 
 device_initcall(u300_init_boardpower);
arch/arm/mach-u300/spi.c deleted +0 -102

102 lines not on this page · raw message

arch/arm/mach-u300/spi.h deleted +0 -26
deleted file mode 100644
index bd3d867..0000000
@@ -1,26 +0,0 @@
-/*
- * arch/arm/mach-u300/spi.h
- *
- * Copyright (C) 2009 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- *
- * Author: Linus Walleij <[email protected]>
- */
-#ifndef SPI_H
-#define SPI_H
-#include <linux/amba/bus.h>
-
-#ifdef CONFIG_SPI_PL022
-void __init u300_spi_init(struct amba_device *adev);
-void __init u300_spi_register_board_devices(void);
-#else
-/* Compile out SPI support if PL022 is not selected */
-static inline void __init u300_spi_init(struct amba_device *adev)
-{
-}
-static inline void __init u300_spi_register_board_devices(void)
-{
-}
-#endif
-
-#endif
arch/arm/mach-u300/timer.c +12 -26
index df1e3b5..f3efef0 100644
@@ -30,8 +30,6 @@
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 
-#include "timer.h"
-
 /*
  * APP side special timer registers
  * This timer contains four timers which can fire an interrupt each.
@@ -361,12 +359,22 @@ static struct delay_timer u300_delay_timer;
 /*
  * This sets up the system timers, clock source and clock event.
  */
-static void __init u300_timer_setup(void __iomem *base, int irq)
+static void __init u300_timer_init_of(struct device_node *np)
 {
+	struct resource irq_res;
+	int irq;
 	struct clk *clk;
 	unsigned long rate;
 
-	u300_timer_base = base;
+	u300_timer_base = of_iomap(np, 0);
+	if (!u300_timer_base)
+		panic("could not ioremap system timer\n");
+
+	/* Get the IRQ for the GP1 timer */
+	irq = of_irq_to_resource(np, 2, &irq_res);
+	if (irq <= 0)
+		panic("no IRQ for system timer\n");
+
 	pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq);
 
 	/* Clock the interrupt controller */
@@ -433,27 +441,5 @@ static void __init u300_timer_setup(void __iomem *base, int irq)
 	 */
 }
 
-
-void __init u300_timer_init()
-{
-	u300_timer_setup(U300_TIMER_APP_VBASE, IRQ_U300_TIMER_APP_GP1);
-}
-
-#ifdef CONFIG_OF
-
-static void __init u300_timer_init_of(struct device_node *np)
-{
-	void __iomem *base;
-	struct resource irq_res;
-	int irq;
-
-	base = of_iomap(np, 0);
-	/* Get the IRQ for the GP1 timer */
-	irq = of_irq_to_resource(np, 2, &irq_res);
-	u300_timer_setup(base, irq);
-}
-
 CLOCKSOURCE_OF_DECLARE(u300_timer, "stericsson,u300-apptimer",
 		       u300_timer_init_of);
-
-#endif
arch/arm/mach-u300/timer.h deleted +0 -2
deleted file mode 100644
index 7766dfa..0000000
@@ -1,2 +0,0 @@
-extern void u300_timer_init(void);
-
arch/arm/mach-u300/u300-gpio.h deleted +0 -70

70 lines not on this page · raw message

Signature · 1 line
1.7.11.3
maintainer
#31 lore raw

PATCH 21/39 ARM: u300: delete all static board data

Quoted 14 lines · On Friday 31 May 2013 11:18:56 Linus Walleij wrote:

/* These are mostly to get the right device names for the clock lookups */

 static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("stericsson,pinctrl-u300", U300_SYSCON_BASE,
arch/arm/mach-u300/core.c +2 -3
@@ -736,17 +204,17 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("stericsson,fsmc-nand", U300_NAND_IF_PHYS_BASE,
                "fsmc-nand", NULL),
        OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE,
-               "uart0", &uart0_plat_data),
+               "uart0", NULL),
        OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
-               "uart1", &uart1_plat_data),
+               "uart1", NULL),
        OF_DEV_AUXDATA("arm,primecell", U300_SPI_BASE,
-               "pl022", &spi_plat_data),

arch/arm/mach-u300/core.c static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = { · line 219

Quoted 10 lines
arch/arm/mach-u300/core.c +2 -1
+               "pl022", NULL),
        OF_DEV_AUXDATA("st,ddci2c", U300_I2C0_BASE,
                "stu300.0", NULL),
        OF_DEV_AUXDATA("st,ddci2c", U300_I2C1_BASE,
                "stu300.1", NULL),
        OF_DEV_AUXDATA("arm,primecell", U300_MMCSD_BASE,
-               "mmci", &mmcsd_platform_data),
+               "mmci", NULL),
        { /* sentinel */ },
 };

I did not see any patch removing the auxdata list in the end. Do you still need it after the clocks are moved over to DT probing?

Arnd

#32 lore raw

PATCH 21/39 ARM: u300: delete all static board data

Quoted 3 lines · Arnd Bergmann

I did not see any patch removing the auxdata list in the end. Do you still need it after the clocks are moved over to DT probing?

Unfortunately yes.

I am still using the device names to resolve pin control handles.

It's on the TODO. Once that is done this can be deleted.

Yours,
Linus Walleij

#33 lore raw

PATCH 22/39 ARM: u300: move debugmacro to debug includes

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This moves the U300 debug macro to the debug headers to make way for multiplatform support.

---
 arch/arm/Kconfig.debug                                            | 8 ++++++++
 .../include/mach/debug-macro.S => include/debug/u300.S}           | 0
 2 files changed, 8 insertions(+)
 rename arch/arm/{mach-u300/include/mach/debug-macro.S => include/debug/u300.S} (100%)
arch/arm/Kconfig.debug +8 -0
index 1d41908..2708ed9 100644
@@ -443,6 +443,13 @@ choice
 		  Say Y here if you want the debug print routines to direct
 		  their output to the uart1 port on SiRFmarco devices.
 
+	config DEBUG_U300_UART
+		bool "Kernel low-level debugging messages via U300 UART0"
+		depends on ARCH_U300
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to the uart port on U300 devices.
+
 	config DEBUG_UX500_UART
 		depends on ARCH_U8500
 		bool "Use Ux500 UART for low-level debug"
@@ -643,6 +650,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
 	default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
 	default "debug/tegra.S" if DEBUG_TEGRA_UART
+	default "debug/u300.S" if DEBUG_U300_UART
 	default "debug/ux500.S" if DEBUG_UX500_UART
 	default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
 		DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1
arch/arm/include/debug/u300.S renamed from arch/arm/mach-u300/include/mach/debug-macro.S +0 -0
similarity index 100%
rename from arch/arm/mach-u300/include/mach/debug-macro.S
rename to arch/arm/include/debug/u300.S
Signature · 1 line
1.7.11.3
#34 lore raw

PATCH 23/39 ARM: u300: remove deps from debug macro

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This rids the dependency to <mach/hardware.h> (which is an implicit dependency to <mach/u300-regs.h>) from the U300 debug macro. Take this opportunity to update the file header.

---
 arch/arm/include/debug/u300.S | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/arm/include/debug/u300.S +3 -6
index 8ae8e4a..6f04f08 100644
@@ -1,14 +1,11 @@
 /*
- *
- * arch-arm/mach-u300/include/mach/debug-macro.S
- *
- *
- * Copyright (C) 2006-2009 ST-Ericsson AB
+ * Copyright (C) 2006-2013 ST-Ericsson AB
  * License terms: GNU General Public License (GPL) version 2
  * Debugging macro include header.
  * Author: Linus Walleij <[email protected]>
  */
-#include <mach/hardware.h>
+#define U300_SLOW_PER_PHYS_BASE		0xc0010000
+#define U300_SLOW_PER_VIRT_BASE		0xff000000
 
 	.macro	addruart, rp, rv, tmp
 	/* If we move the address using MMU, use this. */
Signature · 1 line
1.7.11.3
#35 lore raw

PATCH 24/39 ARM: u300: push down syscon registers

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

Get rid of the <mach/syscon.h> header as a prerequisite for multiplatform support. Do this by pushing the registers down to their respective drivers and deleting the unused remainder.

---
 arch/arm/mach-u300/core.c                |  26 +-
 arch/arm/mach-u300/include/mach/syscon.h | 592 -------------------------------
 arch/arm/mach-u300/regulator.c           |   9 +-
 drivers/clk/clk-u300.c                   | 343 +++++++++++++++++-
 4 files changed, 373 insertions(+), 597 deletions(-)
 delete mode 100644 arch/arm/mach-u300/include/mach/syscon.h
arch/arm/mach-u300/core.c +25 -1
index 13d4812..254fe92 100644
@@ -22,7 +22,31 @@
 #include <asm/mach/arch.h>
 
 #include <mach/u300-regs.h>
-#include <mach/syscon.h>
+
+/*
+ * SYSCON addresses applicable to the core machine.
+ */
+
+/* Chip ID register 16bit (R/-) */
+#define U300_SYSCON_CIDR					(0x400)
+/* SMCR */
+#define U300_SYSCON_SMCR					(0x4d0)
+#define U300_SYSCON_SMCR_FIELD_MASK				(0x000e)
+#define U300_SYSCON_SMCR_SEMI_SREFACK_IND			(0x0008)
+#define U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE			(0x0004)
+#define U300_SYSCON_SMCR_SEMI_EXT_BOOT_MODE_ENABLE		(0x0002)
+/* CPU_SW_DBGEN Software Debug Enable 16bit (R/W) */
+#define U300_SYSCON_CSDR					(0x4f0)
+#define U300_SYSCON_CSDR_SW_DEBUG_ENABLE			(0x0001)
+/* PRINT_CONTROL Print Control 16bit (R/-) */
+#define U300_SYSCON_PCR						(0x4f8)
+#define U300_SYSCON_PCR_SERV_IND				(0x0001)
+/* BOOT_CONTROL 16bit (R/-) */
+#define U300_SYSCON_BCR						(0x4fc)
+#define U300_SYSCON_BCR_ACC_CPU_SUBSYS_VINITHI_IND		(0x0400)
+#define U300_SYSCON_BCR_APP_CPU_SUBSYS_VINITHI_IND		(0x0200)
+#define U300_SYSCON_BCR_EXTRA_BOOT_OPTION_MASK			(0x01FC)
+#define U300_SYSCON_BCR_APP_BOOT_SERV_MASK			(0x0003)
 
 /*
  * Static I/O mappings that are needed for booting the U300 platforms. The
arch/arm/mach-u300/include/mach/syscon.h deleted +0 -592

592 lines not on this page · raw message

arch/arm/mach-u300/regulator.c +6 -3
index bbda954..ab7d7a5 100644
@@ -17,9 +17,12 @@
 #include <linux/regulator/consumer.h>
 /* Those are just for writing in syscon */
 #include <linux/io.h>
-#include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <mach/syscon.h>
+#include <mach/u300-regs.h>
+
+/* Power Management Control 16bit (R/W) */
+#define U300_SYSCON_PMCR					(0x50)
+#define U300_SYSCON_PMCR_DCON_ENABLE				(0x0002)
+#define U300_SYSCON_PMCR_PWR_MGNT_ENABLE			(0x0001)
 
 /*
  * Regulators that power the board and chip and which are
drivers/clk/clk-u300.c +342 -1

349 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#36 lore raw

PATCH 25/39 ARM: u300: delete <mach/hardware.h>

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This file is now unused and can be deleted.

---
 arch/arm/mach-u300/include/mach/hardware.h | 5 -----
 arch/arm/mach-u300/timer.c                 | 1 -
 2 files changed, 6 deletions(-)
 delete mode 100644 arch/arm/mach-u300/include/mach/hardware.h
arch/arm/mach-u300/include/mach/hardware.h deleted +0 -5
deleted file mode 100644
index b99d4ce..0000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-u300/include/mach/hardware.h
- */
-#include <asm/sizes.h>
-#include <mach/u300-regs.h>
arch/arm/mach-u300/timer.c +0 -1
index f3efef0..00499d9 100644
@@ -22,7 +22,6 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 
-#include <mach/hardware.h>
 #include <mach/irqs.h>
 
 /* Generic stuff */
Signature · 1 line
1.7.11.3
#37 lore raw

PATCH 26/39 ARM: u300: delete <mach/irqs.h>

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

All IRQs are now obtained from the device tree, and this file is unused, so delete it.

---
 arch/arm/mach-u300/include/mach/irqs.h | 80 ----------------------------------
 arch/arm/mach-u300/timer.c             |  2 -
 2 files changed, 82 deletions(-)
 delete mode 100644 arch/arm/mach-u300/include/mach/irqs.h
arch/arm/mach-u300/include/mach/irqs.h deleted +0 -80
deleted file mode 100644
index 21d5e76..0000000
@@ -1,80 +0,0 @@
-/*
- *
- * arch/arm/mach-u300/include/mach/irqs.h
- *
- *
- * Copyright (C) 2006-2012 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- * IRQ channel definitions for the U300 platforms.
- * Author: Linus Walleij <[email protected]>
- */
-
-#ifndef __MACH_IRQS_H
-#define __MACH_IRQS_H
-
-#define IRQ_U300_INTCON0_START		32
-#define IRQ_U300_INTCON1_START		64
-/* These are on INTCON0 - 30 lines */
-#define IRQ_U300_IRQ0_EXT		32
-#define IRQ_U300_IRQ1_EXT		33
-#define IRQ_U300_DMA			34
-#define IRQ_U300_VIDEO_ENC_0		35
-#define IRQ_U300_VIDEO_ENC_1		36
-#define IRQ_U300_AAIF_RX		37
-#define IRQ_U300_AAIF_TX		38
-#define IRQ_U300_AAIF_VGPIO		39
-#define IRQ_U300_AAIF_WAKEUP		40
-#define IRQ_U300_PCM_I2S0_FRAME		41
-#define IRQ_U300_PCM_I2S0_FIFO		42
-#define IRQ_U300_PCM_I2S1_FRAME		43
-#define IRQ_U300_PCM_I2S1_FIFO		44
-#define IRQ_U300_XGAM_GAMCON		45
-#define IRQ_U300_XGAM_CDI		46
-#define IRQ_U300_XGAM_CDICON		47
-#define IRQ_U300_XGAM_PDI		49
-#define IRQ_U300_XGAM_PDICON		50
-#define IRQ_U300_XGAM_GAMEACC		51
-#define IRQ_U300_XGAM_MCIDCT		52
-#define IRQ_U300_APEX			53
-#define IRQ_U300_UART0			54
-#define IRQ_U300_SPI			55
-#define IRQ_U300_TIMER_APP_OS		56
-#define IRQ_U300_TIMER_APP_DD		57
-#define IRQ_U300_TIMER_APP_GP1		58
-#define IRQ_U300_TIMER_APP_GP2		59
-#define IRQ_U300_TIMER_OS		60
-#define IRQ_U300_TIMER_MS		61
-#define IRQ_U300_KEYPAD_KEYBF		62
-#define IRQ_U300_KEYPAD_KEYBR		63
-/* These are on INTCON1 - 32 lines */
-#define IRQ_U300_GPIO_PORT0		64
-#define IRQ_U300_GPIO_PORT1		65
-#define IRQ_U300_GPIO_PORT2		66
-
-/* These are for DB3150, DB3200 and DB3350 */
-#define IRQ_U300_WDOG			67
-#define IRQ_U300_EVHIST			68
-#define IRQ_U300_MSPRO			69
-#define IRQ_U300_MMCSD_MCIINTR0		70
-#define IRQ_U300_MMCSD_MCIINTR1		71
-#define IRQ_U300_I2C0			72
-#define IRQ_U300_I2C1			73
-#define IRQ_U300_RTC			74
-#define IRQ_U300_NFIF			75
-#define IRQ_U300_NFIF2			76
-
-/* The DB3350-specific interrupt lines */
-#define IRQ_U300_ISP_F0			77
-#define IRQ_U300_ISP_F1			78
-#define IRQ_U300_ISP_F2			79
-#define IRQ_U300_ISP_F3			80
-#define IRQ_U300_ISP_F4			81
-#define IRQ_U300_GPIO_PORT3		82
-#define IRQ_U300_SYSCON_PLL_LOCK	83
-#define IRQ_U300_UART1			84
-#define IRQ_U300_GPIO_PORT4		85
-#define IRQ_U300_GPIO_PORT5		86
-#define IRQ_U300_GPIO_PORT6		87
-#define U300_VIC_IRQS_END		88
-
-#endif
arch/arm/mach-u300/timer.c +0 -2
index 00499d9..2e1c81d 100644
@@ -22,8 +22,6 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 
-#include <mach/irqs.h>
-
 /* Generic stuff */
 #include <asm/sched_clock.h>
 #include <asm/mach/map.h>
Signature · 1 line
1.7.11.3
#38 lore raw

PATCH 27/39 ARM: u300: localize <mach/u300-regs.h>

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This register base file is now only used in the machine itself so move it down into mach-u300.

---
 arch/arm/mach-u300/core.c                         | 2 +-
 arch/arm/mach-u300/regulator.c                    | 2 +-
 arch/arm/mach-u300/{include/mach => }/u300-regs.h | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename arch/arm/mach-u300/{include/mach => }/u300-regs.h (100%)
arch/arm/mach-u300/core.c +1 -1
index 254fe92..1fdaf81 100644
@@ -21,7 +21,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
 
-#include <mach/u300-regs.h>
+#include "u300-regs.h"
 
 /*
  * SYSCON addresses applicable to the core machine.
arch/arm/mach-u300/regulator.c +1 -1
index ab7d7a5..1cbe88c 100644
@@ -17,7 +17,7 @@
 #include <linux/regulator/consumer.h>
 /* Those are just for writing in syscon */
 #include <linux/io.h>
-#include <mach/u300-regs.h>
+#include "u300-regs.h"
 
 /* Power Management Control 16bit (R/W) */
 #define U300_SYSCON_PMCR					(0x50)
arch/arm/mach-u300/u300-regs.h renamed from arch/arm/mach-u300/include/mach/u300-regs.h +0 -0
similarity index 100%
rename from arch/arm/mach-u300/include/mach/u300-regs.h
rename to arch/arm/mach-u300/u300-regs.h
Signature · 1 line
1.7.11.3
#39 lore raw

PATCH 28/39 ARM: u300: convert to multiplatform

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

Now that we removed our dependency on <mach/*> the U300 can be converted to mutliplatform. Remove the invalid restriction that U300 would not support AUTO_ZRELADDR (it does) and update the defconfig in the process.

---
 arch/arm/Kconfig                | 21 +--------------------
 arch/arm/configs/u300_defconfig | 11 ++++-------
 arch/arm/mach-u300/Kconfig      | 31 +++++++++++++++++++++++++------
 3 files changed, 30 insertions(+), 33 deletions(-)
arch/arm/Kconfig +1 -20
index 2689643..b6f9ce6 100644
@@ -812,25 +812,6 @@ config ARCH_SHARK
 	  Support for the StrongARM based Digital DNARD machine, also known
 	  as "Shark" (<http://www.shark-linux.de/shark.html>).
 
-config ARCH_U300
-	bool "ST-Ericsson U300 Series"
-	depends on MMU
-	select ARCH_REQUIRE_GPIOLIB
-	select ARM_AMBA
-	select ARM_PATCH_PHYS_VIRT
-	select ARM_VIC
-	select CLKDEV_LOOKUP
-	select CLKSRC_MMIO
-	select CLKSRC_OF
-	select COMMON_CLK
-	select CPU_ARM926T
-	select GENERIC_CLOCKEVENTS
-	select HAVE_TCM
-	select SPARSE_IRQ
-	select USE_OF
-	help
-	  Support for ST-Ericsson U300 series mobile platforms.
-
 config ARCH_DAVINCI
 	bool "TI DaVinci"
 	select ARCH_HAS_HOLES_MEMORYMODEL
@@ -2041,7 +2022,7 @@ config CRASH_DUMP
 
 config AUTO_ZRELADDR
 	bool "Auto calculation of the decompressed kernel image address"
-	depends on !ZBOOT_ROM && !ARCH_U300
+	depends on !ZBOOT_ROM
 	help
 	  ZRELADDR is the physical address where the decompressed kernel
 	  image will be placed. If AUTO_ZRELADDR is selected, the address
arch/arm/configs/u300_defconfig +4 -7
index 374000e..a5fa0d9 100644
@@ -1,7 +1,8 @@
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 # CONFIG_SWAP is not set
 CONFIG_SYSVIPC=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_EXPERT=y
 # CONFIG_AIO is not set
@@ -11,12 +12,9 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_LBDAF is not set
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_CFQ is not set
+# CONFIG_ARCH_MULTI_V7 is not set
 CONFIG_ARCH_U300=y
-CONFIG_MACH_U300=y
-CONFIG_MACH_U300_BS335=y
 CONFIG_MACH_U300_SPIDUMMY=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
@@ -44,11 +42,11 @@ CONFIG_I2C=y
 # CONFIG_HWMON is not set
 CONFIG_WATCHDOG=y
 CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_FB=y
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
 # CONFIG_LCD_CLASS_DEVICE is not set
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
-# CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_MMC=y
 CONFIG_MMC_CLKGATE=y
@@ -70,4 +68,3 @@ CONFIG_DEBUG_FS=y
 CONFIG_TIMER_STATS=y
 # CONFIG_DEBUG_PREEMPT is not set
 CONFIG_DEBUG_INFO=y
-# CONFIG_CRC32 is not set
arch/arm/mach-u300/Kconfig +25 -6
index 1f59764..e2f350f 100644
@@ -1,24 +1,45 @@
-if ARCH_U300
-
 menu "ST-Ericsson AB U300/U335 Platform"
 
 comment "ST-Ericsson Mobile Platform Products"
 
-config MACH_U300
-	bool "U300"
+config ARCH_U300
+	bool "ST-Ericsson U300 Series"
+	depends on MMU
+	select ARCH_REQUIRE_GPIOLIB
+	select ARM_AMBA
+	select ARM_PATCH_PHYS_VIRT
+	select ARM_VIC
+	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
+	select CLKSRC_OF
+	select COMMON_CLK
+	select CPU_ARM926T
+	select GENERIC_CLOCKEVENTS
+	select HAVE_TCM
 	select PINCTRL
 	select PINCTRL_COH901
 	select PINCTRL_U300
+	select SPARSE_IRQ
+	select USE_OF
+	help
+	  Support for ST-Ericsson U300 series mobile platforms.
 
 comment "ST-Ericsson U300/U335 Feature Selections"
 
+config MACH_U300
+	depends on ARCH_U300
+	bool "U300"
+	default y
+
 config U300_DEBUG
+	depends on ARCH_U300
 	bool "Debug support for U300"
 	depends on PM
 	help
 		Debug support for U300 in sysfs, procfs etc.
 
 config MACH_U300_SPIDUMMY
+	depends on ARCH_U300
 	bool "SSP/SPI dummy chip"
 	select SPI
 	select SPI_MASTER
@@ -31,5 +52,3 @@ config MACH_U300_SPIDUMMY
 		SPI framework and ARM PL022 support.
 
 endmenu
-
-endif
Signature · 1 line
1.7.11.3
#40 lore raw

PATCH 29/39 ARM: u300: delete remnant machine headers

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

Two files remain in <mach/*> for U300: timex.h and uncompress.h. The former is done away with by using defaults, the latter is unused in multiplatform.

---
 arch/arm/mach-u300/include/mach/timex.h      | 17 -----------
 arch/arm/mach-u300/include/mach/uncompress.h | 45 ----------------------------
 2 files changed, 62 deletions(-)
 delete mode 100644 arch/arm/mach-u300/include/mach/timex.h
 delete mode 100644 arch/arm/mach-u300/include/mach/uncompress.h
arch/arm/mach-u300/include/mach/timex.h deleted +0 -17
deleted file mode 100644
index f233b72..0000000
@@ -1,17 +0,0 @@
-/*
- *
- * arch/arm/mach-u300/include/mach/timex.h
- *
- *
- * Copyright (C) 2006-2009 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- * Platform tick rate definition.
- * Author: Linus Walleij <[email protected]>
- */
-#ifndef __MACH_TIMEX_H
-#define __MACH_TIMEX_H
-
-/* This is for the APP OS GP1 (General Purpose 1) timer */
-#define CLOCK_TICK_RATE		1000000
-
-#endif
arch/arm/mach-u300/include/mach/uncompress.h deleted +0 -45

45 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#41 lore raw

PATCH 30/39 ARM: u300 use module_spi_driver to register driver

In reply to Linus Walleij

From: Peter Huewe <[email protected]>

Removing some boilerplate by using module_spi_driver instead of calling register and unregister in the otherwise empty init/exit functions.

---
 arch/arm/mach-u300/dummyspichip.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
arch/arm/mach-u300/dummyspichip.c +1 -13
index 52962bf..ec0283c 100644
@@ -278,19 +278,7 @@ static struct spi_driver pl022_dummy_driver = {
 	.remove	= pl022_dummy_remove,
 };
 
-static int __init pl022_init_dummy(void)
-{
-	return spi_register_driver(&pl022_dummy_driver);
-}
-
-static void __exit pl022_exit_dummy(void)
-{
-	spi_unregister_driver(&pl022_dummy_driver);
-}
-
-module_init(pl022_init_dummy);
-module_exit(pl022_exit_dummy);
-
+module_spi_driver(pl022_dummy_driver);
 MODULE_AUTHOR("Linus Walleij <[email protected]>");
 MODULE_DESCRIPTION("PL022 SSP/SPI DUMMY Linux driver");
 MODULE_LICENSE("GPL");
Signature · 1 line
1.7.11.3
#42 lore raw

PATCH 31/39 ARM: u300: add syscon node

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This adds a device tree node for the U300 system controller and remaps this dynamically instead of using hard-coded virtual addresses. The board power set-up code is altered to fetch a reference to the syscon using ampersand <&syscon> notation. This way of passing a pointer to the syscon will also be used by the clocks.

---
 Documentation/devicetree/bindings/arm/ste-u300.txt | 30 +++++++++++++++++++---
 arch/arm/boot/dts/ste-u300.dts                     |  6 +++++
 arch/arm/mach-u300/core.c                          | 22 +++++++++++++---
 arch/arm/mach-u300/regulator.c                     | 21 ++++++++++++---
 4 files changed, 69 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/arm/ste-u300.txt +27 -3
index cd9001a..69b5ab0 100644
@@ -8,15 +8,39 @@ Required root node property:
 
 compatible="stericsson,u300";
 
+Required node: syscon
+This contains the system controller.
+- compatible: must be "stericsson,u300-syscon".
+- reg: the base address and size of the system controller.
+
 Boards with the U300 SoC include:
 
 S365 "Small Board U365":
 
 Required node: s365
+This contains the board-specific information.
+- compatible: must be "stericsson,s365".
+- vana15-supply: the regulator supplying the 1.5V to drive the
+  board.
+- syscon: a pointer to the syscon node so we can acccess the
+  syscon registers to set the board as self-powered.
 
 Example:
 
-s365 {
-	compatible = "stericsson,s365";
-	vana15-supply = <&ab3100_ldo_d_reg>;
+/ {
+	model = "ST-Ericsson U300";
+	compatible = "stericsson,u300";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	s365 {
+		compatible = "stericsson,s365";
+		vana15-supply = <&ab3100_ldo_d_reg>;
+		syscon = <&syscon>;
+	};
+
+	syscon: syscon at c0011000 {
+		compatible = "stericsson,u300-syscon";
+		reg = <0xc0011000 0x1000>;
+	};
 };
arch/arm/boot/dts/ste-u300.dts +6 -0
index b8a8ddb..644befd 100644
@@ -27,6 +27,12 @@
 	s365 {
 		compatible = "stericsson,s365";
 		vana15-supply = <&ab3100_ldo_d_reg>;
+		syscon = <&syscon>;
+	};
+
+	syscon: syscon at c0011000 {
+		compatible = "stericsson,u300-syscon";
+		reg = <0xc0011000 0x1000>;
 	};
 
 	timer: timer at c0014000 {
arch/arm/mach-u300/core.c +18 -4
index 1fdaf81..8cfca45 100644
@@ -14,6 +14,7 @@
 #include <linux/platform_data/clk-u300.h>
 #include <linux/platform_data/pinctrl-coh901.h>
 #include <linux/irqchip.h>
+#include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/clocksource.h>
 #include <linux/clk.h>
@@ -48,6 +49,8 @@
 #define U300_SYSCON_BCR_EXTRA_BOOT_OPTION_MASK			(0x01FC)
 #define U300_SYSCON_BCR_APP_BOOT_SERV_MASK			(0x0003)
 
+static void __iomem *syscon_base;
+
 /*
  * Static I/O mappings that are needed for booting the U300 platforms. The
  * only things we need are the areas where we find the timer, syscon and
@@ -171,7 +174,7 @@ static void __init u300_init_check_chip(void)
 	const char unknown[] = "UNKNOWN";
 
 	/* Read out and print chip ID */
-	val = readw(U300_SYSCON_VBASE + U300_SYSCON_CIDR);
+	val = readw(syscon_base + U300_SYSCON_CIDR);
 	/* This is in funky bigendian order... */
 	val = (val & 0xFFU) << 8 | (val >> 8);
 	chip = db_chips;
@@ -244,10 +247,21 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 
 static void __init u300_init_irq_dt(void)
 {
+	struct device_node *syscon;
 	struct clk *clk;
 
+	syscon = of_find_node_by_path("/syscon at c0011000");
+	if (!syscon) {
+		pr_crit("could not find syscon node\n");
+		return;
+	}
+	syscon_base = of_iomap(syscon, 0);
+	if (!syscon_base) {
+		pr_crit("could not remap syscon\n");
+		return;
+	}
 	/* initialize clocking early, we want to clock the INTCON */
-	u300_clk_init(U300_SYSCON_VBASE);
+	u300_clk_init(syscon_base);
 
 	/* Bootstrap EMIF and SEMI clocks */
 	clk = clk_get_sys("pl172", NULL);
@@ -280,9 +294,9 @@ static void __init u300_init_machine_dt(void)
 			u300_auxdata_lookup, NULL);
 
 	/* Enable SEMI self refresh */
-	val = readw(U300_SYSCON_VBASE + U300_SYSCON_SMCR) |
+	val = readw(syscon_base + U300_SYSCON_SMCR) |
 		U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE;
-	writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR);
+	writew(val, syscon_base + U300_SYSCON_SMCR);
 }
 
 static const char * u300_board_compat[] = {
arch/arm/mach-u300/regulator.c +18 -3
index 1cbe88c..273fceb 100644
@@ -16,8 +16,8 @@
 #include <linux/regulator/machine.h>
 #include <linux/regulator/consumer.h>
 /* Those are just for writing in syscon */
+#include <linux/of_address.h>
 #include <linux/io.h>
-#include "u300-regs.h"
 
 /* Power Management Control 16bit (R/W) */
 #define U300_SYSCON_PMCR					(0x50)
@@ -57,10 +57,25 @@ void u300_pm_poweroff(void)
  */
 static int __init __u300_init_boardpower(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
+	struct device_node *syscon_np;
+	static void __iomem *syscon_base;
 	int err;
 	u32 val;
 
 	pr_info("U300: setting up board power\n");
+
+	syscon_np = of_parse_phandle(np, "syscon", 0);
+	if (!syscon_np) {
+		pr_crit("U300: no syscon node\n");
+		return -ENODEV;
+	}
+	syscon_base = of_iomap(syscon_np, 0);
+	if (!syscon_base) {
+		pr_crit("U300: could not remap syscon\n");
+		return -ENODEV;
+	}
+
 	main_power_15 = regulator_get(&pdev->dev, "vana15");
 
 	if (IS_ERR(main_power_15)) {
@@ -81,9 +96,9 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 	 * the rest of the U300 power management is implemented.
 	 */
 	pr_info("U300: disable system controller pull-up\n");
-	val = readw(U300_SYSCON_VBASE + U300_SYSCON_PMCR);
+	val = readw(syscon_base + U300_SYSCON_PMCR);
 	val &= ~U300_SYSCON_PMCR_DCON_ENABLE;
-	writew(val, U300_SYSCON_VBASE + U300_SYSCON_PMCR);
+	writew(val, syscon_base + U300_SYSCON_PMCR);
 
 	/* Register globally exported PM poweroff hook */
 	pm_power_off = u300_pm_poweroff;
Signature · 1 line
1.7.11.3
maintainer
#43 lore raw

PATCH 31/39 ARM: u300: add syscon node

Quoted 22 lines · On Friday 31 May 2013 11:19:06 Linus Walleij wrote:

From: Linus Walleij <[email protected]>

This adds a device tree node for the U300 system controller and remaps this dynamically instead of using hard-coded virtual addresses. The board power set-up code is altered to fetch a reference to the syscon using ampersand <&syscon> notation. This way of passing a pointer to the syscon will also be used by the clocks.

---
 Documentation/devicetree/bindings/arm/ste-u300.txt | 30 +++++++++++++++++++---
 arch/arm/boot/dts/ste-u300.dts                     |  6 +++++
 arch/arm/mach-u300/core.c                          | 22 +++++++++++++---
 arch/arm/mach-u300/regulator.c                     | 21 ++++++++++++---
 4 files changed, 69 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/arm/ste-u300.txt +0 -0
index cd9001a..69b5ab0 100644

Documentation/devicetree/bindings/arm/ste-u300.txt Required root node property: · line 15

Quoted 8 lines
Documentation/devicetree/bindings/arm/ste-u300.txt +5 -0
@@ -8,15 +8,39 @@ Required root node property:
 
 compatible="stericsson,u300";
 
+Required node: syscon
+This contains the system controller.
+- compatible: must be "stericsson,u300-syscon".
+- reg: the base address and size of the system controller.
+

Any reason why you are not making it compatible with "syscon", to use the drivers/mfd/syscon.c driver?

Arnd

#44 lore raw

PATCH 31/39 ARM: u300: add syscon node

Quoted 4 lines · Arnd Bergmann
Quoted 2 lines · On Friday 31 May 2013 11:19:06 Linus Walleij wrote:

compatible="stericsson,u300";

Quoted 8 lines

Documentation/devicetree/bindings/arm/ste-u300.txt Required root node property: · line 15

Quoted 5 lines
Documentation/devicetree/bindings/arm/ste-u300.txt +5 -0
+Required node: syscon
+This contains the system controller.
+- compatible: must be "stericsson,u300-syscon".
+- reg: the base address and size of the system controller.
+

Any reason why you are not making it compatible with "syscon", to use the drivers/mfd/syscon.c driver?

For the first lookup at irq_init() we cannot use it.

This is because that needs to be initialized at irq_init() time to set up the clocks, which are needed by the interrupt controller, it cannot use device matching, as the platform devices are not probed yet.

However I can make it compatible for the board power snippet to make use of it for sure.

But I find no good examples in the kernel on how to grab a referenced syscon node and use the regmap API to read/write registers :-(

Dong: do you have some example to point at for this?

Yours,
Linus Walleij

#45 lore raw

PATCH 31/39 ARM: u300: add syscon node

Hi Linus,

On Fri, May 31, 2013 at 01:55:56PM +0200, Linus Walleij wrote:
[...]

Quoted 6 lines

But I find no good examples in the kernel on how to grab a referenced syscon node and use the regmap API to read/write registers :-(

Dong: do you have some example to point at for this?

No too much in the upstream kernel.
But i think you can see:
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-imx/anatop.c
drivers/regulator/anatop-regulator.c

Regards
Dong Aisheng

#46 lore raw

PATCH 31/39 ARM: u300: add syscon node

In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

Documentation/devicetree/bindings/arm/ste-u300.txt Required root node property: · line 15

Quoted 7 lines

compatible="stericsson,u300";

Documentation/devicetree/bindings/arm/ste-u300.txt +5 -0
+Required node: syscon
+This contains the system controller.
+- compatible: must be "stericsson,u300-syscon".
+- reg: the base address and size of the system controller.
+

Any reason why you are not making it compatible with "syscon", to use the drivers/mfd/syscon.c driver?

I've proposed a patch for this and also altered the board power code to make use of it (it's the only instance that can use the syscon regmap do do its work so far).

Yours,
Linus Walleij

#47 lore raw

PATCH 32/39 ARM: u300: remove register definition file

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

Now that the core file is the only one actually using any of the base addresses, we can delete that header and move the base address definitions into the one and only core file.

---
 arch/arm/mach-u300/core.c      | 113 +++++++++++++++++++++++++++-
 arch/arm/mach-u300/u300-regs.h | 165 -----------------------------------------
 2 files changed, 112 insertions(+), 166 deletions(-)
 delete mode 100644 arch/arm/mach-u300/u300-regs.h
arch/arm/mach-u300/core.c +112 -1
index 8cfca45..6e5744a 100644
@@ -22,7 +22,118 @@
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
 
-#include "u300-regs.h"
+/*
+ * These are the large blocks of memory allocated for I/O.
+ * the defines are used for setting up the I/O memory mapping.
+ */
+
+/* NAND Flash CS0 */
+#define U300_NAND_CS0_PHYS_BASE		0x80000000
+/* NFIF */
+#define U300_NAND_IF_PHYS_BASE		0x9f800000
+/* ALE, CLE offset for FSMC NAND */
+#define PLAT_NAND_CLE			(1 << 16)
+#define PLAT_NAND_ALE			(1 << 17)
+/* AHB Peripherals */
+#define U300_AHB_PER_PHYS_BASE		0xa0000000
+#define U300_AHB_PER_VIRT_BASE		0xff010000
+/* FAST Peripherals */
+#define U300_FAST_PER_PHYS_BASE		0xc0000000
+#define U300_FAST_PER_VIRT_BASE		0xff020000
+/* SLOW Peripherals */
+#define U300_SLOW_PER_PHYS_BASE		0xc0010000
+#define U300_SLOW_PER_VIRT_BASE		0xff000000
+/* Boot ROM */
+#define U300_BOOTROM_PHYS_BASE		0xffff0000
+#define U300_BOOTROM_VIRT_BASE		0xffff0000
+/* SEMI config base */
+#define U300_SEMI_CONFIG_BASE		0x2FFE0000
+
+/*
+ * AHB peripherals
+ */
+
+/* AHB Peripherals Bridge Controller */
+#define U300_AHB_BRIDGE_BASE		(U300_AHB_PER_PHYS_BASE+0x0000)
+/* Vectored Interrupt Controller 0, servicing 32 interrupts */
+#define U300_INTCON0_BASE		(U300_AHB_PER_PHYS_BASE+0x1000)
+#define U300_INTCON0_VBASE		IOMEM(U300_AHB_PER_VIRT_BASE+0x1000)
+/* Vectored Interrupt Controller 1, servicing 32 interrupts */
+#define U300_INTCON1_BASE		(U300_AHB_PER_PHYS_BASE+0x2000)
+#define U300_INTCON1_VBASE		IOMEM(U300_AHB_PER_VIRT_BASE+0x2000)
+/* Memory Stick Pro (MSPRO) controller */
+#define U300_MSPRO_BASE			(U300_AHB_PER_PHYS_BASE+0x3000)
+/* EMIF Configuration Area */
+#define U300_EMIF_CFG_BASE		(U300_AHB_PER_PHYS_BASE+0x4000)
+
+/*
+ * FAST peripherals
+ */
+
+/* FAST bridge control */
+#define U300_FAST_BRIDGE_BASE		(U300_FAST_PER_PHYS_BASE+0x0000)
+/* MMC/SD controller */
+#define U300_MMCSD_BASE			(U300_FAST_PER_PHYS_BASE+0x1000)
+/* PCM I2S0 controller */
+#define U300_PCM_I2S0_BASE		(U300_FAST_PER_PHYS_BASE+0x2000)
+/* PCM I2S1 controller */
+#define U300_PCM_I2S1_BASE		(U300_FAST_PER_PHYS_BASE+0x3000)
+/* I2C0 controller */
+#define U300_I2C0_BASE			(U300_FAST_PER_PHYS_BASE+0x4000)
+/* I2C1 controller */
+#define U300_I2C1_BASE			(U300_FAST_PER_PHYS_BASE+0x5000)
+/* SPI controller */
+#define U300_SPI_BASE			(U300_FAST_PER_PHYS_BASE+0x6000)
+/* Fast UART1 on U335 only */
+#define U300_UART1_BASE			(U300_FAST_PER_PHYS_BASE+0x7000)
+
+/*
+ * SLOW peripherals
+ */
+
+/* SLOW bridge control */
+#define U300_SLOW_BRIDGE_BASE		(U300_SLOW_PER_PHYS_BASE)
+/* SYSCON */
+#define U300_SYSCON_BASE		(U300_SLOW_PER_PHYS_BASE+0x1000)
+#define U300_SYSCON_VBASE		IOMEM(U300_SLOW_PER_VIRT_BASE+0x1000)
+/* Watchdog */
+#define U300_WDOG_BASE			(U300_SLOW_PER_PHYS_BASE+0x2000)
+/* UART0 */
+#define U300_UART0_BASE			(U300_SLOW_PER_PHYS_BASE+0x3000)
+/* APP side special timer */
+#define U300_TIMER_APP_BASE		(U300_SLOW_PER_PHYS_BASE+0x4000)
+#define U300_TIMER_APP_VBASE		IOMEM(U300_SLOW_PER_VIRT_BASE+0x4000)
+/* Keypad */
+#define U300_KEYPAD_BASE		(U300_SLOW_PER_PHYS_BASE+0x5000)
+/* GPIO */
+#define U300_GPIO_BASE			(U300_SLOW_PER_PHYS_BASE+0x6000)
+/* RTC */
+#define U300_RTC_BASE			(U300_SLOW_PER_PHYS_BASE+0x7000)
+/* Bus tracer */
+#define U300_BUSTR_BASE			(U300_SLOW_PER_PHYS_BASE+0x8000)
+/* Event handler (hardware queue) */
+#define U300_EVHIST_BASE		(U300_SLOW_PER_PHYS_BASE+0x9000)
+/* Genric Timer */
+#define U300_TIMER_BASE			(U300_SLOW_PER_PHYS_BASE+0xa000)
+/* PPM */
+#define U300_PPM_BASE			(U300_SLOW_PER_PHYS_BASE+0xb000)
+
+/*
+ * REST peripherals
+ */
+
+/* ISP (image signal processor) */
+#define U300_ISP_BASE			(0xA0008000)
+/* DMA Controller base */
+#define U300_DMAC_BASE			(0xC0020000)
+/* MSL Base */
+#define U300_MSL_BASE			(0xc0022000)
+/* APEX Base */
+#define U300_APEX_BASE			(0xc0030000)
+/* Video Encoder Base */
+#define U300_VIDEOENC_BASE		(0xc0080000)
+/* XGAM Base */
+#define U300_XGAM_BASE			(0xd0000000)
 
 /*
  * SYSCON addresses applicable to the core machine.
arch/arm/mach-u300/u300-regs.h deleted +0 -165

165 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#48 lore raw

PATCH 33/39 clk: move the U300 fixed and fixed-factor to DT

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This converts the fixed and fixed-factor clocks in the U300 platform to register themselves from the device tree.

---
 arch/arm/boot/dts/ste-u300.dts | 44 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/clk-u300.c         | 33 +++++++++++++------------------
 2 files changed, 57 insertions(+), 20 deletions(-)
arch/arm/boot/dts/ste-u300.dts +44 -0
index 644befd..203ec1fc 100644
@@ -33,6 +33,49 @@
 	syscon: syscon at c0011000 {
 		compatible = "stericsson,u300-syscon";
 		reg = <0xc0011000 0x1000>;
+		clk32: app_32_clk at 32k {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <32768>;
+		};
+		pll13: pll13 at 13M {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+		};
+		pll208: pll208 at 208M {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <208000000>;
+		};
+		app208: app_208_clk at 208M {
+			#clock-cells = <0>;
+			compatible = "fixed-factor-clock";
+			clock-div = <1>;
+			clock-mult = <1>;
+			clocks = <&pll208>;
+		};
+		app104: app_104_clk at 104M {
+			#clock-cells = <0>;
+			compatible = "fixed-factor-clock";
+			clock-div = <2>;
+			clock-mult = <1>;
+			clocks = <&pll208>;
+		};
+		app52: app_52_clk at 52M {
+			#clock-cells = <0>;
+			compatible = "fixed-factor-clock";
+			clock-div = <4>;
+			clock-mult = <1>;
+			clocks = <&pll208>;
+		};
+		app26: app_26_clk at 26M {
+			#clock-cells = <0>;
+			compatible = "fixed-factor-clock";
+			clock-div = <2>;
+			clock-mult = <1>;
+			clocks = <&app52>;
+		};
 	};
 
 	timer: timer at c0014000 {
@@ -65,6 +108,7 @@
 		reg = <0xc0012000 0x1000>;
 		interrupt-parent = <&vicb>;
 		interrupts = <3>;
+		clocks = <&clk32>;
 	};
 
 	rtc: rtc at c0017000 {
drivers/clk/clk-u300.c +13 -20
index a41e42e..bebd6c9 100644
@@ -11,6 +11,7 @@
 #include <linux/io.h>
 #include <linux/clk-provider.h>
 #include <linux/spinlock.h>
+#include <linux/of.h>
 
 /* APP side SYSCON registers */
 /* CLK Control Register 16bit (R/W) */
@@ -931,6 +932,17 @@ mclk_clk_register(struct device *dev, const char *name,
 	return clk;
 }
 
+static const __initconst struct of_device_id u300_clk_match[] = {
+	{
+		.compatible = "fixed-clock",
+		.data = of_fixed_clk_setup,
+	},
+	{
+		.compatible = "fixed-factor-clock",
+		.data = of_fixed_factor_clk_setup,
+	},
+};
+
 void __init u300_clk_init(void __iomem *base)
 {
 	u16 val;
@@ -951,26 +963,7 @@ void __init u300_clk_init(void __iomem *base)
 	val |= U300_SYSCON_PMCR_PWR_MGNT_ENABLE;
 	writew(val, syscon_vbase + U300_SYSCON_PMCR);
 
-	/* These are always available (RTC and PLL13) */
-	clk = clk_register_fixed_rate(NULL, "app_32_clk", NULL,
-				      CLK_IS_ROOT, 32768);
-	/* The watchdog sits directly on the 32 kHz clock */
-	clk_register_clkdev(clk, NULL, "coh901327_wdog");
-	clk = clk_register_fixed_rate(NULL, "pll13", NULL,
-				      CLK_IS_ROOT, 13000000);
-
-	/* These derive from PLL208 */
-	clk = clk_register_fixed_rate(NULL, "pll208", NULL,
-				      CLK_IS_ROOT, 208000000);
-	clk = clk_register_fixed_factor(NULL, "app_208_clk", "pll208",
-					0, 1, 1);
-	clk = clk_register_fixed_factor(NULL, "app_104_clk", "pll208",
-					0, 1, 2);
-	clk = clk_register_fixed_factor(NULL, "app_52_clk", "pll208",
-					0, 1, 4);
-	/* The 52 MHz is divided down to 26 MHz */
-	clk = clk_register_fixed_factor(NULL, "app_26_clk", "app_52_clk",
-					0, 1, 2);
+	of_clk_init(u300_clk_match);
 
 	/* Directly on the AMBA interconnect */
 	clk = syscon_clk_register(NULL, "cpu_clk", "app_208_clk", 0, true,
Signature · 1 line
1.7.11.3
#49 lore raw

PATCH 34/39 i2c: stu300: do not request a specific clock name

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

We have used the default clock associated with the block for a long time, only heuristics in the clock system has made this work anyway. This needs to be done away with as we start probing this driver and its clocks exclusively from the device tree.

---
 drivers/i2c/busses/i2c-stu300.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/i2c/busses/i2c-stu300.c +1 -3
index 1beaa05a..d1a6b20 100644
@@ -868,7 +868,6 @@ stu300_probe(struct platform_device *pdev)
 	struct resource *res;
 	int bus_nr;
 	int ret = 0;
-	char clk_name[] = "I2C0";
 
 	dev = devm_kzalloc(&pdev->dev, sizeof(struct stu300_dev), GFP_KERNEL);
 	if (!dev) {
@@ -877,8 +876,7 @@ stu300_probe(struct platform_device *pdev)
 	}
 
 	bus_nr = pdev->id;
-	clk_name[3] += (char)bus_nr;
-	dev->clk = devm_clk_get(&pdev->dev, clk_name);
+	dev->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(dev->clk)) {
 		dev_err(&pdev->dev, "could not retrieve i2c bus clock\n");
 		return PTR_ERR(dev->clk);
Signature · 1 line
1.7.11.3
#50 lore raw

PATCH 35/39 ARM: u300: move the gated system controller clocks to DT

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This moves the slow, fast, AHB bridge and "rest" clocks on the U300 system controller over to registration from the device tree.

---
 .../bindings/clock/ste-u300-syscon-clock.txt       |  57 ++++
 arch/arm/boot/dts/ste-u300.dts                     | 149 ++++++++++
 arch/arm/mach-u300/timer.c                         |   2 +-
 drivers/clk/clk-u300.c                             | 320 ++++++++++++++-------
 4 files changed, 418 insertions(+), 110 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt
Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt new file +57 -0
new file mode 100644
index 0000000..b6a30f5
@@ -0,0 +1,57 @@
+Clock bindings for ST-Ericsson U300 System Controller Clocks
+
+Bindings for the gated system controller clocks:
+
+Required properties:
+- compatible: must be "stericsson,u300-syscon-clk"
+- #clock-cells: must be <0>
+- clock-type: specifies the type of clock:
+  0 = slow clock
+  1 = fast clock
+  2 = rest/remaining clock
+- clock-id: specifies the clock in the type range
+
+Optional properties:
+- clocks: parent clock(s)
+
+The available clocks per type are as follows:
+
+Type:  ID:   Clock:
+-------------------
+0      0     Slow peripheral bridge clock
+0      1     UART0 clock
+0      4     GPIO clock
+0      6     RTC clock
+0      7     Application timer clock
+0      8     Access timer clock
+
+1      0     Fast peripheral bridge clock
+1      1     I2C bus 0 clock
+1      2     I2C bus 1 clock
+1      5     MMC interface peripheral (silicon) clock
+1      6     SPI clock
+
+2      3     CPU clock
+2      4     DMA controller clock
+2      5     External Memory Interface (EMIF) clock
+2      6     NAND flask interface clock
+2      8     XGAM graphics engine clock
+2      9     Shared External Memory Interface (SEMI) clock
+2      10    AHB Subsystem Bridge clock
+2      12    Interrupt controller clock
+
+Example:
+
+gpio_clk: gpio_clk at 13M {
+	#clock-cells = <0>;
+	compatible = "stericsson,u300-syscon-clk";
+	clock-type = <0>; /* Slow */
+	clock-id = <4>;
+	clocks = <&slow_clk>;
+};
+
+gpio: gpio at c0016000 {
+	compatible = "stericsson,gpio-coh901";
+	(...)
+	clocks = <&gpio_clk>;
+};
arch/arm/boot/dts/ste-u300.dts +149 -0

239 lines not on this page · raw message

arch/arm/mach-u300/timer.c +1 -1
index 2e1c81d..390ae5f 100644
@@ -375,7 +375,7 @@ static void __init u300_timer_init_of(struct device_node *np)
 	pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq);
 
 	/* Clock the interrupt controller */
-	clk = clk_get_sys("apptimer", NULL);
+	clk = of_clk_get(np, 0);
 	BUG_ON(IS_ERR(clk));
 	clk_prepare_enable(clk);
 	rate = clk_get_rate(clk);
drivers/clk/clk-u300.c +211 -109

338 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#51 lore raw

PATCH 36/39 ARM: u300: convert MMC/SD clock to device tree

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This converts the last of the U300 clocks to being probed from the device tree.

---
 .../bindings/clock/ste-u300-syscon-clock.txt       | 23 ++++++++++++++++++++++
 arch/arm/boot/dts/ste-u300.dts                     |  9 +++++++--
 drivers/clk/clk-u300.c                             | 22 ++++++++++++++++-----
 3 files changed, 47 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt +23 -0
index b6a30f5..7cafcb9 100644
@@ -55,3 +55,26 @@ gpio: gpio at c0016000 {
 	(...)
 	clocks = <&gpio_clk>;
 };
+
+
+Bindings for the MMC/SD card clock:
+
+Required properties:
+- compatible: must be "stericsson,u300-syscon-mclk"
+- #clock-cells: must be <0>
+
+Optional properties:
+- clocks: parent clock(s)
+
+mmc_mclk: mmc_mclk {
+	#clock-cells = <0>;
+	compatible = "stericsson,u300-syscon-mclk";
+	clocks = <&mmc_pclk>;
+};
+
+mmcsd: mmcsd at c0001000 {
+	compatible = "arm,pl18x", "arm,primecell";
+	clocks = <&mmc_pclk>, <&mmc_mclk>;
+	clock-names = "apb_pclk", "mclk";
+	(...)
+};
arch/arm/boot/dts/ste-u300.dts +7 -2
index 7edc5e5..05a0821 100644
@@ -205,6 +205,11 @@
 			clock-id = <5>;
 			clocks = <&fast_clk>;
 		};
+		mmc_mclk: mmc_mclk {
+			#clock-cells = <0>;
+			compatible = "stericsson,u300-syscon-mclk";
+			clocks = <&mmc_pclk>;
+		};
 		spi_clk: spi_p_clk at 26M {
 			#clock-cells = <0>;
 			compatible = "stericsson,u300-syscon-clk";
@@ -433,8 +438,8 @@
 			reg = <0xc0001000 0x1000>;
 			interrupt-parent = <&vicb>;
 			interrupts = <6 7>;
-			clocks = <&mmc_pclk>;
-			clock-names = "apb_pclk";
+			clocks = <&mmc_pclk>, <&mmc_mclk>;
+			clock-names = "apb_pclk", "mclk";
 			max-frequency = <24000000>;
 			bus-width = <4>; // SD-card slot
 			mmc-cap-mmc-highspeed;
drivers/clk/clk-u300.c +17 -5
index 5f234d3..8774e05 100644
@@ -1139,6 +1139,18 @@ mclk_clk_register(struct device *dev, const char *name,
 	return clk;
 }
 
+static void __init of_u300_syscon_mclk_init(struct device_node *np)
+{
+	struct clk *clk = ERR_PTR(-EINVAL);
+	const char *clk_name = np->name;
+	const char *parent_name;
+
+	parent_name = of_clk_get_parent_name(np, 0);
+	clk = mclk_clk_register(NULL, clk_name, parent_name, false);
+	if (!IS_ERR(clk))
+		of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
+
 static const __initconst struct of_device_id u300_clk_match[] = {
 	{
 		.compatible = "fixed-clock",
@@ -1152,12 +1164,16 @@ static const __initconst struct of_device_id u300_clk_match[] = {
 		.compatible = "stericsson,u300-syscon-clk",
 		.data = of_u300_syscon_clk_init,
 	},
+	{
+		.compatible = "stericsson,u300-syscon-mclk",
+		.data = of_u300_syscon_mclk_init,
+	},
 };
 
+
 void __init u300_clk_init(void __iomem *base)
 {
 	u16 val;
-	struct clk *clk;
 
 	syscon_vbase = base;
 
@@ -1175,8 +1191,4 @@ void __init u300_clk_init(void __iomem *base)
 	writew(val, syscon_vbase + U300_SYSCON_PMCR);
 
 	of_clk_init(u300_clk_match);
-
-	/* Then this special MMC/SD clock */
-	clk = mclk_clk_register(NULL, "mmc_clk", "mmc_p_clk", false);
-	clk_register_clkdev(clk, NULL, "mmci");
 }
Signature · 1 line
1.7.11.3
#52 lore raw

PATCH 37/39 pinctrl: get rid of all platform data for coh901

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

This deletes the dependency on any platform data for the COH901 pin controller. There is only one user in the kernel, and if we at some point want to support more variants, they shall provide their variant info through the device tree.

---
 arch/arm/mach-u300/core.c                    | 12 +-----------
 drivers/pinctrl/pinctrl-coh901.c             | 23 +++++++++--------------
 include/linux/platform_data/pinctrl-coh901.h | 22 ----------------------
 3 files changed, 10 insertions(+), 47 deletions(-)
 delete mode 100644 include/linux/platform_data/pinctrl-coh901.h
arch/arm/mach-u300/core.c +1 -11
index 6e5744a..4f7ac2a 100644
@@ -12,7 +12,6 @@
 #include <linux/pinctrl/machine.h>
 #include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_data/clk-u300.h>
-#include <linux/platform_data/pinctrl-coh901.h>
 #include <linux/irqchip.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
@@ -194,15 +193,6 @@ static void __init u300_map_io(void)
 	iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc));
 }
 
-/*
- * The different variants have a few different versions of the
- * GPIO block, with different number of ports.
- */
-static struct u300_gpio_platform u300_gpio_plat = {
-	.ports = 7,
-	.gpio_base = 0,
-};
-
 static unsigned long pin_pullup_conf[] = {
 	PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1),
 };
@@ -332,7 +322,7 @@ static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("stericsson,pinctrl-u300", U300_SYSCON_BASE,
 		"pinctrl-u300", NULL),
 	OF_DEV_AUXDATA("stericsson,gpio-coh901", U300_GPIO_BASE,
-		"u300-gpio", &u300_gpio_plat),
+		"u300-gpio", NULL),
 	OF_DEV_AUXDATA("stericsson,coh901327", U300_WDOG_BASE,
 		"coh901327_wdog", NULL),
 	OF_DEV_AUXDATA("stericsson,coh901331", U300_RTC_BASE,
drivers/pinctrl/pinctrl-coh901.c +9 -14
index d4f8afd..46ff140 100644
@@ -22,7 +22,6 @@
 #include <linux/slab.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/pinconf-generic.h>
-#include <linux/platform_data/pinctrl-coh901.h>
 #include "pinctrl-coh901.h"
 
 #define U300_GPIO_PORT_STRIDE				(0x30)
@@ -58,8 +57,9 @@
 #define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE		(0x00000001UL)
 
 /* 8 bits per port, no version has more than 7 ports */
+#define U300_GPIO_NUM_PORTS 7
 #define U300_GPIO_PINS_PER_PORT 8
-#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * 7)
+#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS)
 
 struct u300_gpio {
 	struct gpio_chip chip;
@@ -111,9 +111,6 @@ struct u300_gpio_confdata {
 	int outval;
 };
 
-/* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */
-#define BS335_GPIO_NUM_PORTS 7
-
 #define U300_FLOATING_INPUT { \
 	.bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \
 	.output = false, \
@@ -136,7 +133,7 @@ struct u300_gpio_confdata {
 
 /* Initial configuration */
 static const struct __initconst u300_gpio_confdata
-bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
+bs335_gpio_config[U300_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
 	/* Port 0, pins 0-7 */
 	{
 		U300_FLOATING_INPUT,
@@ -630,13 +627,12 @@ static void __init u300_gpio_init_pin(struct u300_gpio *gpio,
 	}
 }
 
-static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio,
-				     struct u300_gpio_platform *plat)
+static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio)
 {
 	int i, j;
 
 	/* Write default config and values to all pins */
-	for (i = 0; i < plat->ports; i++) {
+	for (i = 0; i < U300_GPIO_NUM_PORTS; i++) {
 		for (j = 0; j < 8; j++) {
 			const struct u300_gpio_confdata *conf;
 			int offset = (i*8) + j;
@@ -693,7 +689,6 @@ static struct coh901_pinpair coh901_pintable[] = {
 
 static int __init u300_gpio_probe(struct platform_device *pdev)
 {
-	struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
 	struct u300_gpio *gpio;
 	struct resource *memres;
 	int err = 0;
@@ -707,9 +702,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	gpio->chip = u300_gpio_chip;
-	gpio->chip.ngpio = plat->ports * U300_GPIO_PINS_PER_PORT;
+	gpio->chip.ngpio = U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT;
 	gpio->chip.dev = &pdev->dev;
-	gpio->chip.base = plat->gpio_base;
+	gpio->chip.base = 0;
 	gpio->dev = &pdev->dev;
 
 	memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -755,11 +750,11 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
 		 ((val & 0x0000FE00) >> 9) * 8);
 	writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE,
 	       gpio->base + U300_GPIO_CR);
-	u300_gpio_init_coh901571(gpio, plat);
+	u300_gpio_init_coh901571(gpio);
 
 	/* Add each port with its IRQ separately */
 	INIT_LIST_HEAD(&gpio->port_list);
-	for (portno = 0 ; portno < plat->ports; portno++) {
+	for (portno = 0 ; portno < U300_GPIO_NUM_PORTS; portno++) {
 		struct u300_gpio_port *port =
 			kmalloc(sizeof(struct u300_gpio_port), GFP_KERNEL);
 
include/linux/platform_data/pinctrl-coh901.h deleted +0 -22
deleted file mode 100644
index dfbc65d..0000000
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2007-2012 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- * GPIO block resgister definitions and inline macros for
- * U300 GPIO COH 901 335 or COH 901 571/3
- * Author: Linus Walleij <[email protected]>
- */
-
-#ifndef __MACH_U300_GPIO_U300_H
-#define __MACH_U300_GPIO_U300_H
-
-/**
- * struct u300_gpio_platform - U300 GPIO platform data
- * @ports: number of GPIO block ports
- * @gpio_base: first GPIO number for this block (use a free range)
- */
-struct u300_gpio_platform {
-	u8 ports;
-	int gpio_base;
-};
-
-#endif /* __MACH_U300_GPIO_U300_H */
Signature · 1 line
1.7.11.3
#53 lore raw

PATCH 38/39 spi: pl022: use DMA by default when probing from DT

In reply to Linus Walleij

From: Linus Walleij <[email protected]>

In the past we controlled the selection of DMA for a certain host by a boolean switch in the platform data. Currently there is no way to enable DMA on a PL022 probed from the device tree. Let's default to trying to obtain DMA channels in the DT case, and then we can always fail (and thus fall back to PIO mode).

---
 drivers/spi/spi-pl022.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-pl022.c +1 -0
index 371cc66f..3b24654 100644
@@ -2083,6 +2083,7 @@ pl022_platform_data_dt_get(struct device *dev)
 	}
 
 	pd->bus_id = -1;
+	pd->enable_dma = 1;
 	of_property_read_u32(np, "num-cs", &tmp);
 	pd->num_chipselect = tmp;
 	of_property_read_u32(np, "pl022,autosuspend-delay",
Signature · 1 line
1.7.11.3
#54 lore raw

PATCH 39/39 ARM: u300: Update MMC configs for u300 defconfig

In reply to Linus Walleij

From: Ulf Hansson <[email protected]>

Enable MMC_UNSAFE_RESUME to be accomplish a proper suspend/resume cycle for SD/SDIO/(e)MMC.

ARMMMCI host driver supports clock gating through runtime PM, thus MMC_CLKGATE is not needed. Moreover ARMMMCI can do scatter-gather which means we can explicity disable MMC_BLOCK_BOUNCE, since it's default enabled, to skip unnecessary bounce buffer copying.

---
 arch/arm/configs/u300_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/configs/u300_defconfig +2 -1
index a5fa0d9..fd81a1b 100644
@@ -49,7 +49,8 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
 # CONFIG_USB_SUPPORT is not set
 CONFIG_MMC=y
-CONFIG_MMC_CLKGATE=y
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_BLOCK_BOUNCE is not set
 CONFIG_MMC_ARMMMCI=y
 CONFIG_RTC_CLASS=y
 # CONFIG_RTC_HCTOSYS is not set
Signature · 1 line
1.7.11.3
maintainer
#55 lore raw

cover U300 device tree and multiplatform

In reply to Linus Walleij
Quoted 11 lines · On Friday 31 May 2013 11:18:35 Linus Walleij wrote:

From: Linus Walleij <[email protected]>

This series of "only" 37 patches, partially sent earlier but here in its final form, will convert the U300 platform to using device tree exclusively, delete board files, and converts the machine to multiplatform.

In order not to artificially split things up, two fixes from Ulf Hansson and Peter Huewe are included.

A pull request will follow unless there are unfixable remarks.

Looks great. I have a few final questions, but no show stopper.

Please reply to my comments so we know how to deal with them before you send the pull request.

Arnd