Skip to contentSkip to conversation

MIPS generic kernels, SEAD-3 & Boston support

PATCH In review Paul Burton 3 participants 26 messages Oct 5, 2016 – Oct 19, 2016

Subsystems (5)
lore
Share & tools
lore
#16 lore raw

PATCH v3 16/18 dt-bindings: Document img,boston-clock binding

In reply to Paul Burton

Add device tree binding documentation for the clocks provided by the MIPS Boston development board from Imagination Technologies, and a header file describing the available clocks for use by device trees & driver.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Changes in v3: None
Changes in v2:
- Add BOSTON_CLK_INPUT to expose the input clock.

 .../devicetree/bindings/clock/img,boston-clock.txt | 27 ++++++++++++++++++++++
 include/dt-bindings/clock/boston-clock.h           | 14 +++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/img,boston-clock.txt
 create mode 100644 include/dt-bindings/clock/boston-clock.h
Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +27 -0
new file mode 100644
index 0000000..c01ea60
@@ -0,0 +1,27 @@
+Binding for Imagination Technologies MIPS Boston clock sources.
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : Should be "img,boston-clock".
+- #clock-cells : Should be set to 1.
+  Values available for clock consumers can be found in the header file:
+    <dt-bindings/clock/boston-clock.h>
+- regmap : Phandle to the Boston platform register system controller.
+  This should contain a phandle to the system controller node covering the
+  platform registers provided by the Boston board.
+
+Example:
+
+	clk_boston: clock {
+		compatible = "img,boston-clock";
+		#clock-cells = <1>;
+		regmap = <&plat_regs>;
+	};
+
+	uart0: uart@17ffe000 {
+		/* ... */
+		clocks = <&clk_boston BOSTON_CLK_SYS>;
+	};
include/dt-bindings/clock/boston-clock.h new file +14 -0
new file mode 100644
index 0000000..a6f0098
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2016 Imagination Technologies
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_BOSTON_CLOCK_H__
+#define __DT_BINDINGS_CLOCK_BOSTON_CLOCK_H__
+
+#define BOSTON_CLK_INPUT 0
+#define BOSTON_CLK_SYS 1
+#define BOSTON_CLK_CPU 2
+
+#endif /* __DT_BINDINGS_CLOCK_BOSTON_CLOCK_H__ */
Signature · 1 line
2.10.0
#23 lore raw

PATCH v3 17/18 clk: boston: Add a driver for MIPS Boston board clocks

In reply to Paul Burton

Add a driver for the clocks provided by the MIPS Boston board from Imagination Technologies. 2 clocks are provided - the system clock & the CPU clock - and each is a simple fixed rate clock whose frequency can be determined by reading a register provided by the board.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>

---

Changes in v3: None
Changes in v2:
- Support BOSTON_CLK_INPUT.
- Register clocks with clk_register_fixed_rate during boot, removing need for clk_ops.
- s/uint32_t/u32/.
- Move driver to a vendor directory.

 drivers/clk/Kconfig             |   1 +
 drivers/clk/Makefile            |   1 +
 drivers/clk/imgtec/Kconfig      |  10 ++++
 drivers/clk/imgtec/Makefile     |   1 +
 drivers/clk/imgtec/clk-boston.c | 101 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 114 insertions(+)
 create mode 100644 drivers/clk/imgtec/Kconfig
 create mode 100644 drivers/clk/imgtec/Makefile
 create mode 100644 drivers/clk/imgtec/clk-boston.c
drivers/clk/Kconfig +1 -0
index e2d9bd7..a6c7e03 100644
@@ -210,6 +210,7 @@ config COMMON_CLK_OXNAS
 
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
+source "drivers/clk/imgtec/Kconfig"
 source "drivers/clk/meson/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/qcom/Kconfig"
drivers/clk/Makefile +1 -0
index 3b6f9cf..8c4c425 100644
@@ -60,6 +60,7 @@ obj-y					+= bcm/
 obj-$(CONFIG_ARCH_BERLIN)		+= berlin/
 obj-$(CONFIG_H8300)			+= h8300/
 obj-$(CONFIG_ARCH_HISI)			+= hisilicon/
+obj-y					+= imgtec/
 obj-$(CONFIG_ARCH_MXC)			+= imx/
 obj-$(CONFIG_MACH_INGENIC)		+= ingenic/
 obj-$(CONFIG_COMMON_CLK_KEYSTONE)	+= keystone/
drivers/clk/imgtec/Kconfig new file +10 -0
new file mode 100644
index 0000000..c2ea745
@@ -0,0 +1,10 @@
+config COMMON_CLK_BOSTON
+	bool "Clock driver for MIPS Boston boards"
+	depends on MIPS || COMPILE_TEST
+	depends on OF
+	select MFD_SYSCON
+	---help---
+	  Enable this to support the system & CPU clocks on the MIPS Boston
+	  development board from Imagination Technologies. These are simple
+	  fixed rate clocks whose rate is determined by reading a platform
+	  provided register.
drivers/clk/imgtec/Makefile new file +1 -0
new file mode 100644
index 0000000..ac779b8
@@ -0,0 +1 @@
+obj-$(CONFIG_COMMON_CLK_BOSTON)		+= clk-boston.o
drivers/clk/imgtec/clk-boston.c new file +101 -0

101 lines not on this page · raw message

Signature · 1 line
2.10.0
#0 lore raw

v3 cover MIPS generic kernels, SEAD-3 & Boston support

This series introduces some infrastructure for building generic kernels which will run on multiple boards depending upon the device tree provided to them by the bootloader. It converts SEAD-3 to make use of this, and adds support for the MIPS Boston development platform.

The Boston support can be tested in QEMU with this patchset applied:

https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg03419.html

To do so, configure the kernel for the generic 64r6el_defconfig & run QEMU like so:

  $ make ARCH=mips 64r6el_defconfig
  $ make ARCH=mips CROSS_COMPILE=my-toolchain-
  $ qemu-system-mips64el -M boston \
      -kernel arch/mips/boot/vmlinux.gz.itb \
      serial stdio

The same kernel binary will also boot on a SEAD-3 if using a bootloader capable of loading the FIT image format (ie. U-Boot). These 2 boards form the starting point for the generic kernels, with Ci20 & Ci40 able to be added easily. Malta will require further work, but I've got most peripherals converted to probe using device tree as a starting point & will submit that separately.

v3 drops some patches which aren't critical & need comments made during review addressing. This series applies atop mips-for-linux-next as of 6a44eb2884ca, but needs the remaining patches of my SEAD-3 DT conversion series to be applied first.

Paul Burton (18):
MIPS: PCI: Use struct list_head lists
MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC
MIPS: PCI: Make pcibios_set_cache_line_size an initcall
MIPS: PCI: Inline pcibios_assign_all_busses
MIPS: PCI: Split pci.c into pci.c & pci-legacy.c
MIPS: PCI: Introduce CONFIG_PCI_DRIVERS_LEGACY
MIPS: PCI: Support generic drivers
MIPS: Sanitise coherentio semantics
MIPS: dma-default: Don't check hw_coherentio if device is non-coherent
MIPS: Support per-device DMA coherence
MIPS: Print CM error reports upon bus errors
MIPS: Adjust MIPS64 CAC_BASE to reflect Config.K0
MIPS: Support generating Flattened Image Trees (.itb)
MIPS: generic: Introduce generic DT-based board support
MIPS: generic: Convert SEAD-3 to a generic board
dt-bindings: Document img,boston-clock binding
clk: boston: Add a driver for MIPS Boston board clocks
MIPS: generic: Support MIPS Boston development boards

 .../devicetree/bindings/clock/img,boston-clock.txt |  27 ++
 arch/mips/Kbuild.platforms                         |   2 +-
 arch/mips/Kconfig                                  | 105 ++++---
 arch/mips/Makefile                                 |  77 +++++-
 arch/mips/alchemy/common/setup.c                   |   6 +-
 arch/mips/boot/Makefile                            |  66 +++++
 arch/mips/boot/dts/Makefile                        |   1 +
 arch/mips/boot/dts/img/Makefile                    |   7 +
 arch/mips/boot/dts/img/boston.dts                  | 230 ++++++++++++++++
 arch/mips/boot/dts/mti/Makefile                    |   2 +-
 arch/mips/boot/dts/mti/sead3.dts                   |   1 +
 arch/mips/configs/generic/32r1.config              |   2 +
 arch/mips/configs/generic/32r2.config              |   3 +
 arch/mips/configs/generic/32r6.config              |   2 +
 arch/mips/configs/generic/64r1.config              |   4 +
 arch/mips/configs/generic/64r2.config              |   5 +
 arch/mips/configs/generic/64r6.config              |   4 +
 arch/mips/configs/generic/board-boston.config      |  46 ++++
 arch/mips/configs/generic/board-sead-3.config      |  32 +++
 arch/mips/configs/generic/eb.config                |   1 +
 arch/mips/configs/generic/el.config                |   1 +
 arch/mips/configs/generic/micro32r2.config         |   4 +
 arch/mips/configs/generic_defconfig                |  96 +++++++
 arch/mips/configs/sead3_defconfig                  | 129 ---------
 arch/mips/configs/sead3micro_defconfig             | 122 ---------
 arch/mips/generic/Kconfig                          |  27 ++
 arch/mips/generic/Makefile                         |  15 +
 arch/mips/generic/Platform                         |  14 +
 .../sead3-dtshim.c => generic/board-sead3.c}       | 106 +++++++-
 arch/mips/generic/init.c                           | 176 ++++++++++++
 arch/mips/generic/irq.c                            |  64 +++++
 arch/mips/generic/proc.c                           |  29 ++
 arch/mips/generic/vmlinux.its.S                    |  56 ++++
 arch/mips/include/asm/addrspace.h                  |   3 +-
 arch/mips/include/asm/device.h                     |   5 +
 arch/mips/include/asm/dma-coherence.h              |  16 +-
 arch/mips/include/asm/dma-mapping.h                |  10 +
 arch/mips/include/asm/mach-generic/dma-coherence.h |  14 +-
 arch/mips/include/asm/mach-generic/spaces.h        |   8 +-
 arch/mips/include/asm/mach-ip27/spaces.h           |   1 +
 .../include/asm/mach-sead3/cpu-feature-overrides.h |  72 -----
 arch/mips/include/asm/mach-sead3/irq.h             |   9 -
 .../include/asm/mach-sead3/kernel-entry-init.h     |  21 --
 arch/mips/include/asm/mach-sead3/sead3-dtshim.h    |  29 --
 arch/mips/include/asm/mach-sead3/war.h             |  24 --
 arch/mips/include/asm/machine.h                    |  63 +++++
 arch/mips/include/asm/pci.h                        |  60 +++-
 arch/mips/kernel/traps.c                           |   3 +
 arch/mips/lib/iomap-pci.c                          |   4 +
 arch/mips/mm/c-r4k.c                               |   7 +-
 arch/mips/mm/dma-default.c                         |  16 +-
 arch/mips/mti-malta/malta-int.c                    |  15 -
 arch/mips/mti-malta/malta-setup.c                  |  10 +-
 arch/mips/mti-sead3/Makefile                       |  15 -
 arch/mips/mti-sead3/Platform                       |   7 -
 arch/mips/mti-sead3/sead3-init.c                   | 100 -------
 arch/mips/mti-sead3/sead3-int.c                    |  23 --
 arch/mips/mti-sead3/sead3-setup.c                  |  39 ---
 arch/mips/mti-sead3/sead3-time.c                   |  91 -------
 arch/mips/pci/Makefile                             |   2 +
 arch/mips/pci/pci-alchemy.c                        |   3 +-
 arch/mips/pci/pci-generic.c                        |  52 ++++
 arch/mips/pci/pci-legacy.c                         | 302 +++++++++++++++++++++
 arch/mips/pci/pci.c                                | 297 +-------------------
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/imgtec/Kconfig                         |  10 +
 drivers/clk/imgtec/Makefile                        |   1 +
 drivers/clk/imgtec/clk-boston.c                    | 101 +++++++
 include/dt-bindings/clock/boston-clock.h           |  14 +
 70 files changed, 1824 insertions(+), 1087 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/img,boston-clock.txt
 create mode 100644 arch/mips/boot/dts/img/Makefile
 create mode 100644 arch/mips/boot/dts/img/boston.dts
 create mode 100644 arch/mips/configs/generic/32r1.config
 create mode 100644 arch/mips/configs/generic/32r2.config
 create mode 100644 arch/mips/configs/generic/32r6.config
 create mode 100644 arch/mips/configs/generic/64r1.config
 create mode 100644 arch/mips/configs/generic/64r2.config
 create mode 100644 arch/mips/configs/generic/64r6.config
 create mode 100644 arch/mips/configs/generic/board-boston.config
 create mode 100644 arch/mips/configs/generic/board-sead-3.config
 create mode 100644 arch/mips/configs/generic/eb.config
 create mode 100644 arch/mips/configs/generic/el.config
 create mode 100644 arch/mips/configs/generic/micro32r2.config
 create mode 100644 arch/mips/configs/generic_defconfig
 delete mode 100644 arch/mips/configs/sead3_defconfig
 delete mode 100644 arch/mips/configs/sead3micro_defconfig
 create mode 100644 arch/mips/generic/Kconfig
 create mode 100644 arch/mips/generic/Makefile
 create mode 100644 arch/mips/generic/Platform
 rename arch/mips/{mti-sead3/sead3-dtshim.c => generic/board-sead3.c} (72%)
 create mode 100644 arch/mips/generic/init.c
 create mode 100644 arch/mips/generic/irq.c
 create mode 100644 arch/mips/generic/proc.c
 create mode 100644 arch/mips/generic/vmlinux.its.S
 delete mode 100644 arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/irq.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/kernel-entry-init.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/sead3-dtshim.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/war.h
 create mode 100644 arch/mips/include/asm/machine.h
 delete mode 100644 arch/mips/mti-sead3/Makefile
 delete mode 100644 arch/mips/mti-sead3/Platform
 delete mode 100644 arch/mips/mti-sead3/sead3-init.c
 delete mode 100644 arch/mips/mti-sead3/sead3-int.c
 delete mode 100644 arch/mips/mti-sead3/sead3-setup.c
 delete mode 100644 arch/mips/mti-sead3/sead3-time.c
 create mode 100644 arch/mips/pci/pci-generic.c
 create mode 100644 arch/mips/pci/pci-legacy.c
 create mode 100644 drivers/clk/imgtec/Kconfig
 create mode 100644 drivers/clk/imgtec/Makefile
 create mode 100644 drivers/clk/imgtec/clk-boston.c
 create mode 100644 include/dt-bindings/clock/boston-clock.h
Signature · 1 line
2.10.0
#1 lore raw

PATCH v3 1/18 MIPS: PCI: Use struct list_head lists

Rather than open-coding a linked list implementation, make use of the one in linux/list.h.

---

Changes in v3:
- Include this patch missed from previous submissions.

Changes in v2: None

 arch/mips/include/asm/pci.h | 3 ++-
 arch/mips/pci/pci.c         | 9 ++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/mips/include/asm/pci.h +2 -1
index 9b63cd4..547e113 100644
@@ -17,6 +17,7 @@
  */
 
 #include <linux/ioport.h>
+#include <linux/list.h>
 #include <linux/of.h>
 
 /*
@@ -25,7 +26,7 @@
  * single controller supporting multiple channels.
  */
 struct pci_controller {
-	struct pci_controller *next;
+	struct list_head list;
 	struct pci_bus *bus;
 	struct device_node *of_node;
 
arch/mips/pci/pci.c +4 -5
index b4c02f2..644ae96 100644
@@ -28,8 +28,7 @@
 /*
  * The PCI controller list.
  */
-
-static struct pci_controller *hose_head, **hose_tail = &hose_head;
+static LIST_HEAD(controllers);
 
 unsigned long PCIBIOS_MIN_IO;
 unsigned long PCIBIOS_MIN_MEM;
@@ -193,8 +192,8 @@ void register_pci_controller(struct pci_controller *hose)
 		goto out;
 	}
 
-	*hose_tail = hose;
-	hose_tail = &hose->next;
+	INIT_LIST_HEAD(&hose->list);
+	list_add(&hose->list, &controllers);
 
 	/*
 	 * Do not panic here but later - this might happen before console init.
@@ -248,7 +247,7 @@ static int __init pcibios_init(void)
 	pcibios_set_cache_line_size();
 
 	/* Scan all of the recorded PCI controllers.  */
-	for (hose = hose_head; hose; hose = hose->next)
+	list_for_each_entry(hose, &controllers, list)
 		pcibios_scanbus(hose);
 
 	pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
Signature · 1 line
2.10.0
#2 lore raw

PATCH v3 2/18 MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC

In reply to Paul Burton

Introduce support for CONFIG_PCI_DOMAINS_GENERIC, allowing for platforms to make use of generic PCI domains instead of the MIPS-specific implementation. The set_pci_need_domain_info function is introduced to abstract away the removed need_domain_info field in struct pci_controller, and pcibios_scanbus is adjusted to use the pci_domain_nr accessor instead of directly accessing the index field.

---

Changes in v3: None
Changes in v2: None

 arch/mips/Kconfig           |  3 +++
 arch/mips/include/asm/pci.h | 21 ++++++++++++++++++++-
 arch/mips/pci/pci.c         |  4 ++--
 3 files changed, 25 insertions(+), 3 deletions(-)
arch/mips/Kconfig +3 -0
index 400cd36..7a75215 100644
@@ -2995,6 +2995,9 @@ config HT_PCI
 config PCI_DOMAINS
 	bool
 
+config PCI_DOMAINS_GENERIC
+	bool
+
 source "drivers/pci/Kconfig"
 
 #
arch/mips/include/asm/pci.h +20 -1
index 547e113..0564692 100644
@@ -39,10 +39,12 @@ struct pci_controller {
 	struct resource *busn_resource;
 	unsigned long busn_offset;
 
+#ifndef CONFIG_PCI_DOMAINS_GENERIC
 	unsigned int index;
 	/* For compatibility with current (as of July 2003) pciutils
 	   and XFree86. Eventually will be removed. */
 	unsigned int need_domain_info;
+#endif
 
 	/* Optional access methods for reading/writing the bus number
 	   of the PCI controller */
@@ -101,7 +103,18 @@ struct pci_dev;
  */
 #define PCI_DMA_BUS_IS_PHYS     (1)
 
-#ifdef CONFIG_PCI_DOMAINS
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+	return pci_domain_nr(bus);
+}
+
+static inline void set_pci_need_domain_info(struct pci_controller *hose,
+					    int need_domain_info)
+{
+	/* nothing to do */
+}
+#elif defined(CONFIG_PCI_DOMAINS)
 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
 
 static inline int pci_proc_domain(struct pci_bus *bus)
@@ -109,6 +122,12 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 	struct pci_controller *hose = bus->sysdata;
 	return hose->need_domain_info;
 }
+
+static inline void set_pci_need_domain_info(struct pci_controller *hose,
+					    int need_domain_info)
+{
+	hose->need_domain_info = need_domain_info;
+}
 #endif /* CONFIG_PCI_DOMAINS */
 
 #endif /* __KERNEL__ */
arch/mips/pci/pci.c +2 -2
index 644ae96..5207c04 100644
@@ -95,8 +95,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 				&resources);
 	hose->bus = bus;
 
-	need_domain_info = need_domain_info || hose->index;
-	hose->need_domain_info = need_domain_info;
+	need_domain_info = need_domain_info || pci_domain_nr(bus);
+	set_pci_need_domain_info(hose, need_domain_info);
 
 	if (!bus) {
 		pci_free_resource_list(&resources);
Signature · 1 line
2.10.0
#3 lore raw

PATCH v3 3/18 MIPS: PCI: Make pcibios_set_cache_line_size an initcall

In reply to Paul Burton

In preparation for allowing configurations in which pcibios_init is not included, make pcibios_set_cache_line_size an initcall. arch_initcall is used such that it runs before the pcibios_init subsys_initcall for platforms that continue to use it.

---

Changes in v3: None
Changes in v2: None

 arch/mips/pci/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/pci/pci.c +3 -3
index 5207c04..30320a4 100644
@@ -220,7 +220,7 @@ out:
 	       "Skipping PCI bus scan due to resource conflict\n");
 }
 
-static void __init pcibios_set_cache_line_size(void)
+static int __init pcibios_set_cache_line_size(void)
 {
 	struct cpuinfo_mips *c = &current_cpu_data;
 	unsigned int lsize;
@@ -238,14 +238,14 @@ static void __init pcibios_set_cache_line_size(void)
 	pci_dfl_cache_line_size = lsize >> 2;
 
 	pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
+	return 0;
 }
+arch_initcall(pcibios_set_cache_line_size);
 
 static int __init pcibios_init(void)
 {
 	struct pci_controller *hose;
 
-	pcibios_set_cache_line_size();
-
 	/* Scan all of the recorded PCI controllers.  */
 	list_for_each_entry(hose, &controllers, list)
 		pcibios_scanbus(hose);
Signature · 1 line
2.10.0
#4 lore raw

PATCH v3 4/18 MIPS: PCI: Inline pcibios_assign_all_busses

In reply to Paul Burton

The MIPS implementation of pcibios_assign_all_busses trivially returns
1. Implement it as a static function in asm/pci.h such that the compiler can inline it & optimise out never-taken paths.

---

Changes in v3: None
Changes in v2: None

 arch/mips/include/asm/pci.h | 6 ++++--
 arch/mips/pci/pci.c         | 5 -----
 2 files changed, 4 insertions(+), 7 deletions(-)
arch/mips/include/asm/pci.h +4 -2
index 0564692..acc651e 100644
@@ -66,8 +66,10 @@ extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 /* Can be used to override the logic in pci_scan_bus for skipping
    already-configured bus numbers - to be used for buggy BIOSes
    or architectures with incomplete PCI setup by the loader */
-
-extern unsigned int pcibios_assign_all_busses(void);
+static inline unsigned int pcibios_assign_all_busses(void)
+{
+	return 1;
+}
 
 extern unsigned long PCIBIOS_MIN_IO;
 extern unsigned long PCIBIOS_MIN_MEM;
arch/mips/pci/pci.c +0 -5
index 30320a4..8cc6ea4 100644
@@ -297,11 +297,6 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
 	return 0;
 }
 
-unsigned int pcibios_assign_all_busses(void)
-{
-	return 1;
-}
-
 int pcibios_enable_device(struct pci_dev *dev, int mask)
 {
 	int err;
Signature · 1 line
2.10.0
#5 lore raw

PATCH v3 5/18 MIPS: PCI: Split pci.c into pci.c & pci-legacy.c

In reply to Paul Burton

Split out the parts of pci.c that are used by existing systems with MIPS-style PCI drivers but that will not be used by systems with more generic PCI drivers such as pcie-xilinx. This is done in preparation for allowing configurations where the code moved to pci-legacy.c is not built.

---

Changes in v3: None
Changes in v2: None

 arch/mips/pci/Makefile     |   1 +
 arch/mips/pci/pci-legacy.c | 302 +++++++++++++++++++++++++++++++++++++++++++++
 arch/mips/pci/pci.c        | 287 +-----------------------------------------
 3 files changed, 306 insertions(+), 284 deletions(-)
 create mode 100644 arch/mips/pci/pci-legacy.c
arch/mips/pci/Makefile +1 -0
index 139ad1d..5666637 100644
@@ -3,6 +3,7 @@
 #
 
 obj-y				+= pci.o
+obj-y				+= pci-legacy.o
 
 #
 # PCI bus host bridge specific code
arch/mips/pci/pci-legacy.c new file +302 -0

302 lines not on this page · raw message

arch/mips/pci/pci.c +3 -284

304 lines not on this page · raw message

Signature · 1 line
2.10.0
#6 lore raw

PATCH v3 6/18 MIPS: PCI: Introduce CONFIG_PCI_DRIVERS_LEGACY

In reply to Paul Burton

Introduce 2 Kconfig symbols, CONFIG_PCI_DRIVERS_GENERIC & CONFIG_PCI_DRIVERS_LEGACY, which indicate whether the system should be built to for PCI drivers using the MIPS-specific struct pci_controller API (hereafter "legacy" drivers) or more generic drivers using only functionality provided by the PCI core (hereafter "generic" drivers).

The Kconfig entries are created such that platforms have to select CONFIG_PCI_DRIVERS_GENERIC if they wish to use it - that is, the default is CONFIG_PCI_DRIVERS_LEGACY so that existing platforms need no modification.

The functions declared in pci.h are rearranged with those provided only by pci-legacy.c being guarded by an #ifdef CONFIG_PCI_DRIVERS_LEGACY to ensure they are only used in configurations where they are implemented.

---

Changes in v3: None
Changes in v2: None

 arch/mips/Kconfig           |  8 ++++++-
 arch/mips/include/asm/pci.h | 54 ++++++++++++++++++++++++++-------------------
 arch/mips/lib/iomap-pci.c   |  4 ++++
 arch/mips/pci/Makefile      |  2 +-
 4 files changed, 43 insertions(+), 25 deletions(-)
arch/mips/Kconfig +7 -1
index 7a75215..d31f839 100644
@@ -2974,7 +2974,6 @@ config PCI
 	bool "Support for PCI controller"
 	depends on HW_HAS_PCI
 	select PCI_DOMAINS
-	select NO_GENERIC_PCI_IOPORT_MAP
 	help
 	  Find out whether you have a PCI motherboard. PCI is the name of a
 	  bus system, i.e. the way the CPU talks to the other stuff inside
@@ -2998,6 +2997,13 @@ config PCI_DOMAINS
 config PCI_DOMAINS_GENERIC
 	bool
 
+config PCI_DRIVERS_GENERIC
+	bool
+
+config PCI_DRIVERS_LEGACY
+	def_bool !PCI_DRIVERS_GENERIC
+	select NO_GENERIC_PCI_IOPORT_MAP
+
 source "drivers/pci/Kconfig"
 
 #
arch/mips/include/asm/pci.h +31 -23

82 lines not on this page · raw message

arch/mips/lib/iomap-pci.c +4 -0
index a629077..8ed3f25 100644
@@ -10,6 +10,8 @@
 #include <linux/export.h>
 #include <asm/io.h>
 
+#ifdef CONFIG_PCI_DRIVERS_LEGACY
+
 void __iomem *__pci_ioport_map(struct pci_dev *dev,
 			       unsigned long port, unsigned int nr)
 {
@@ -40,6 +42,8 @@ void __iomem *__pci_ioport_map(struct pci_dev *dev,
 	return (void __iomem *) (ctrl->io_map_base + port);
 }
 
+#endif /* CONFIG_PCI_DRIVERS_LEGACY */
+
 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
 {
 	iounmap(addr);
arch/mips/pci/Makefile +1 -1
index 5666637..8478210 100644
@@ -3,7 +3,7 @@
 #
 
 obj-y				+= pci.o
-obj-y				+= pci-legacy.o
+obj-$(CONFIG_PCI_DRIVERS_LEGACY)+= pci-legacy.o
 
 #
 # PCI bus host bridge specific code
Signature · 1 line
2.10.0
#7 lore raw

PATCH v3 7/18 MIPS: PCI: Support generic drivers

In reply to Paul Burton

Introduce support for PCI drivers using only functionality provided generically by the PCI subsystem, by adding the minimum arch-provided functions required.

The driver this has been developed for & tested with the xilinx-pcie on a MIPS Boston development board.

---

Changes in v3: None
Changes in v2: None

 arch/mips/Kconfig           |  1 +
 arch/mips/pci/Makefile      |  1 +
 arch/mips/pci/pci-generic.c | 52 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+)
 create mode 100644 arch/mips/pci/pci-generic.c
arch/mips/Kconfig +1 -0
index d31f839..86d5b39 100644
@@ -2998,6 +2998,7 @@ config PCI_DOMAINS_GENERIC
 	bool
 
 config PCI_DRIVERS_GENERIC
+	select PCI_DOMAINS_GENERIC if PCI_DOMAINS
 	bool
 
 config PCI_DRIVERS_LEGACY
arch/mips/pci/Makefile +1 -0
index 8478210..4b82148 100644
@@ -4,6 +4,7 @@
 
 obj-y				+= pci.o
 obj-$(CONFIG_PCI_DRIVERS_LEGACY)+= pci-legacy.o
+obj-$(CONFIG_PCI_DRIVERS_GENERIC)+= pci-generic.o
 
 #
 # PCI bus host bridge specific code
arch/mips/pci/pci-generic.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.10.0
#8 lore raw

PATCH v3 8/18 MIPS: Sanitise coherentio semantics

In reply to Paul Burton

The coherentio variable has previously been used as a boolean value, indicating whether the user specified that coherent I/O should be enabled or disabled. It failed to take into account the case where the user does not specify any preference, in which case it makes sense that we should default to coherent I/O if the hardware supports it (hw_coherentio is non-zero).

Introduce an enum to clarify the 3 different values of coherentio & use it throughout the code, modifying plat_device_is_coherent() & r4k_cache_init() to take into account the default case.

---

Changes in v3: None
Changes in v2: None

 arch/mips/alchemy/common/setup.c                   |  6 +++---
 arch/mips/include/asm/dma-coherence.h              | 12 +++++++++---
 arch/mips/include/asm/mach-generic/dma-coherence.h | 10 +++++++++-
 arch/mips/mm/c-r4k.c                               |  3 ++-
 arch/mips/mm/dma-default.c                         |  7 ++++---
 arch/mips/mti-malta/malta-setup.c                  |  4 ++--
 arch/mips/pci/pci-alchemy.c                        |  3 ++-
 7 files changed, 31 insertions(+), 14 deletions(-)
arch/mips/alchemy/common/setup.c +3 -3
index 2902138..7faaa6d 100644
@@ -48,17 +48,17 @@ void __init plat_mem_setup(void)
 		clear_c0_config(1 << 19); /* Clear Config[OD] */
 
 	hw_coherentio = 0;
-	coherentio = 1;
+	coherentio = IO_COHERENCE_ENABLED;
 	switch (alchemy_get_cputype()) {
 	case ALCHEMY_CPU_AU1000:
 	case ALCHEMY_CPU_AU1500:
 	case ALCHEMY_CPU_AU1100:
-		coherentio = 0;
+		coherentio = IO_COHERENCE_DISABLED;
 		break;
 	case ALCHEMY_CPU_AU1200:
 		/* Au1200 AB USB does not support coherent memory */
 		if (0 == (read_c0_prid() & PRID_REV_MASK))
-			coherentio = 0;
+			coherentio = IO_COHERENCE_DISABLED;
 		break;
 	}
 
arch/mips/include/asm/dma-coherence.h +9 -3
index bc5e85d..4fbce79 100644
@@ -9,14 +9,20 @@
 #ifndef __ASM_DMA_COHERENCE_H
 #define __ASM_DMA_COHERENCE_H
 
+enum coherent_io_user_state {
+	IO_COHERENCE_DEFAULT,
+	IO_COHERENCE_ENABLED,
+	IO_COHERENCE_DISABLED,
+};
+
 #ifdef CONFIG_DMA_MAYBE_COHERENT
-extern int coherentio;
+extern enum coherent_io_user_state coherentio;
 extern int hw_coherentio;
 #else
 #ifdef CONFIG_DMA_COHERENT
-#define coherentio	1
+#define coherentio	IO_COHERENCE_ENABLED
 #else
-#define coherentio	0
+#define coherentio	IO_COHERENCE_DISABLED
 #endif
 #define hw_coherentio	0
 #endif /* CONFIG_DMA_MAYBE_COHERENT */
arch/mips/include/asm/mach-generic/dma-coherence.h +9 -1
index 0f8a354..8484f82 100644
@@ -49,7 +49,15 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
 
 static inline int plat_device_is_coherent(struct device *dev)
 {
-	return coherentio;
+	switch (coherentio) {
+	default:
+	case IO_COHERENCE_DEFAULT:
+		return hw_coherentio;
+	case IO_COHERENCE_ENABLED:
+		return 1;
+	case IO_COHERENCE_DISABLED:
+		return 0;
+	}
 }
 
 #ifndef plat_post_dma_flush
arch/mips/mm/c-r4k.c +2 -1
index 1fc1118..78ac033 100644
@@ -1935,7 +1935,8 @@ void r4k_cache_init(void)
 	__local_flush_icache_user_range	= local_r4k_flush_icache_user_range;
 
 #if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_DMA_MAYBE_COHERENT)
-	if (coherentio) {
+	if ((coherentio == IO_COHERENCE_ENABLED) ||
+	    ((coherentio == IO_COHERENCE_DEFAULT) && hw_coherentio)) {
 		_dma_cache_wback_inv	= (void *)cache_noop;
 		_dma_cache_wback	= (void *)cache_noop;
 		_dma_cache_inv		= (void *)cache_noop;
arch/mips/mm/dma-default.c +4 -3
index 755259c..8b86c61 100644
@@ -25,13 +25,14 @@
 #include <dma-coherence.h>
 
 #ifdef CONFIG_DMA_MAYBE_COHERENT
-int coherentio = 0;	/* User defined DMA coherency from command line. */
+/* User defined DMA coherency from command line. */
+enum coherent_io_user_state coherentio = IO_COHERENCE_DEFAULT;
 EXPORT_SYMBOL_GPL(coherentio);
 int hw_coherentio = 0;	/* Actual hardware supported DMA coherency setting. */
 
 static int __init setcoherentio(char *str)
 {
-	coherentio = 1;
+	coherentio = IO_COHERENCE_ENABLED;
 	pr_info("Hardware DMA cache coherency (command line)\n");
 	return 0;
 }
@@ -39,7 +40,7 @@ early_param("coherentio", setcoherentio);
 
 static int __init setnocoherentio(char *str)
 {
-	coherentio = 0;
+	coherentio = IO_COHERENCE_DISABLED;
 	pr_info("Software DMA cache coherency (command line)\n");
 	return 0;
 }
arch/mips/mti-malta/malta-setup.c +2 -2
index 7e7364b..f1b60748 100644
@@ -154,12 +154,12 @@ static void __init plat_setup_iocoherency(void)
 	 * coherency instead.
 	 */
 	if (plat_enable_iocoherency()) {
-		if (coherentio == 0)
+		if (coherentio == IO_COHERENCE_DISABLED)
 			pr_info("Hardware DMA cache coherency disabled\n");
 		else
 			pr_info("Hardware DMA cache coherency enabled\n");
 	} else {
-		if (coherentio == 1)
+		if (coherentio == IO_COHERENCE_ENABLED)
 			pr_info("Hardware DMA cache coherency unsupported, but enabled from command line!\n");
 		else
 			pr_info("Software DMA cache coherency enabled\n");
arch/mips/pci/pci-alchemy.c +2 -1
index c8994c1..e99ca77 100644
@@ -429,7 +429,8 @@ static int alchemy_pci_probe(struct platform_device *pdev)
 
 	/* Au1500 revisions older than AD have borked coherent PCI */
 	if ((alchemy_get_cputype() == ALCHEMY_CPU_AU1500) &&
-	    (read_c0_prid() < 0x01030202) && !coherentio) {
+	    (read_c0_prid() < 0x01030202) &&
+	    (coherentio == IO_COHERENCE_DISABLED)) {
 		val = __raw_readl(ctx->regs + PCI_REG_CONFIG);
 		val |= PCI_CONFIG_NC;
 		__raw_writel(val, ctx->regs + PCI_REG_CONFIG);
Signature · 1 line
2.10.0
#9 lore raw

PATCH v3 9/18 MIPS: dma-default: Don't check hw_coherentio if device is non-coherent

In reply to Paul Burton

There are no cases where plat_device_is_coherent() will return zero whilst hw_coherentio is non-zero, and acting any differently in such a case doesn't make much sense - if a device is non-coherent with the CPU caches then access to memory "coherent" with DMA must be uncached. Clean up the nonsensical case.

---

Changes in v3: None
Changes in v2: None

 arch/mips/mm/dma-default.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
arch/mips/mm/dma-default.c +3 -4
index 8b86c61..7ae4c55 100644
@@ -161,8 +161,7 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
 	*dma_handle = plat_map_dma_mem(dev, ret, size);
 	if (!plat_device_is_coherent(dev)) {
 		dma_cache_wback_inv((unsigned long) ret, size);
-		if (!hw_coherentio)
-			ret = UNCAC_ADDR(ret);
+		ret = UNCAC_ADDR(ret);
 	}
 
 	return ret;
@@ -190,7 +189,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
 
 	plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL);
 
-	if (!plat_device_is_coherent(dev) && !hw_coherentio)
+	if (!plat_device_is_coherent(dev))
 		addr = CAC_ADDR(addr);
 
 	page = virt_to_page((void *) addr);
@@ -210,7 +209,7 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	unsigned long pfn;
 	int ret = -ENXIO;
 
-	if (!plat_device_is_coherent(dev) && !hw_coherentio)
+	if (!plat_device_is_coherent(dev))
 		addr = CAC_ADDR(addr);
 
 	pfn = page_to_pfn(virt_to_page((void *)addr));
Signature · 1 line
2.10.0
#10 lore raw

PATCH v3 10/18 MIPS: Support per-device DMA coherence

In reply to Paul Burton

On some MIPS systems, a subset of devices may have DMA coherent with CPU caches. For example in systems including a MIPS I/O Coherence Unit (IOCU), some devices may be connected to that IOCU whilst others are not.

Prior to this patch, we have a plat_device_is_coherent() function but no implementation which does anything besides return a global true or false, optionally chosen at runtime. For devices such as those described above this is insufficient.

Fix this by tracking DMA coherence on a per-device basis with a dma_coherent field in struct dev_archdata. Setting this from arch_setup_dma_ops() takes care of devices which set the dma-coherent property via device tree, and any PCI devices beneath a bridge described in DT, automatically.

---

Changes in v3: None
Changes in v2: None

 arch/mips/Kconfig                                  |  4 ++++
 arch/mips/include/asm/device.h                     |  5 +++++
 arch/mips/include/asm/dma-coherence.h              |  4 +++-
 arch/mips/include/asm/dma-mapping.h                | 10 ++++++++++
 arch/mips/include/asm/mach-generic/dma-coherence.h |  4 ++++
 arch/mips/mm/c-r4k.c                               |  4 ++++
 arch/mips/mm/dma-default.c                         |  2 +-
 7 files changed, 31 insertions(+), 2 deletions(-)
arch/mips/Kconfig +4 -0
index 86d5b39..2356439 100644
@@ -1099,6 +1099,10 @@ config DMA_MAYBE_COHERENT
 	select DMA_NONCOHERENT
 	bool
 
+config DMA_PERDEV_COHERENT
+	bool
+	select DMA_MAYBE_COHERENT
+
 config DMA_COHERENT
 	bool
 
arch/mips/include/asm/device.h +5 -0
index c94fafb..21c2082 100644
@@ -11,6 +11,11 @@ struct dma_map_ops;
 struct dev_archdata {
 	/* DMA operations on that device */
 	struct dma_map_ops *dma_ops;
+
+#ifdef CONFIG_DMA_PERDEV_COHERENT
+	/* Non-zero if DMA is coherent with CPU caches */
+	bool dma_coherent;
+#endif
 };
 
 struct pdev_archdata {
arch/mips/include/asm/dma-coherence.h +3 -1
index 4fbce79..72d0eab 100644
@@ -15,7 +15,9 @@ enum coherent_io_user_state {
 	IO_COHERENCE_DISABLED,
 };
 
-#ifdef CONFIG_DMA_MAYBE_COHERENT
+#if defined(CONFIG_DMA_PERDEV_COHERENT)
+/* Don't provide (hw_)coherentio to avoid misuse */
+#elif defined(CONFIG_DMA_MAYBE_COHERENT)
 extern enum coherent_io_user_state coherentio;
 extern int hw_coherentio;
 #else
arch/mips/include/asm/dma-mapping.h +10 -0
index 12fa79e..7aa71b9 100644
@@ -32,4 +32,14 @@ static inline void dma_mark_clean(void *addr, size_t size) {}
 extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction);
 
+#define arch_setup_dma_ops arch_setup_dma_ops
+static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
+				      u64 size, const struct iommu_ops *iommu,
+				      bool coherent)
+{
+#ifdef CONFIG_DMA_PERDEV_COHERENT
+	dev->archdata.dma_coherent = coherent;
+#endif
+}
+
 #endif /* _ASM_DMA_MAPPING_H */
arch/mips/include/asm/mach-generic/dma-coherence.h +4 -0
index 8484f82..61addb1 100644
@@ -49,6 +49,9 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
 
 static inline int plat_device_is_coherent(struct device *dev)
 {
+#ifdef CONFIG_DMA_PERDEV_COHERENT
+	return dev->archdata.dma_coherent;
+#else
 	switch (coherentio) {
 	default:
 	case IO_COHERENCE_DEFAULT:
@@ -58,6 +61,7 @@ static inline int plat_device_is_coherent(struct device *dev)
 	case IO_COHERENCE_DISABLED:
 		return 0;
 	}
+#endif
 }
 
 #ifndef plat_post_dma_flush
arch/mips/mm/c-r4k.c +4 -0
index 78ac033..88cfaf8 100644
@@ -1935,8 +1935,12 @@ void r4k_cache_init(void)
 	__local_flush_icache_user_range	= local_r4k_flush_icache_user_range;
 
 #if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_DMA_MAYBE_COHERENT)
+# if defined(CONFIG_DMA_PERDEV_COHERENT)
+	if (0) {
+# else
 	if ((coherentio == IO_COHERENCE_ENABLED) ||
 	    ((coherentio == IO_COHERENCE_DEFAULT) && hw_coherentio)) {
+# endif
 		_dma_cache_wback_inv	= (void *)cache_noop;
 		_dma_cache_wback	= (void *)cache_noop;
 		_dma_cache_inv		= (void *)cache_noop;
arch/mips/mm/dma-default.c +1 -1
index 7ae4c55..46d5696 100644
@@ -24,7 +24,7 @@
 
 #include <dma-coherence.h>
 
-#ifdef CONFIG_DMA_MAYBE_COHERENT
+#if defined(CONFIG_DMA_MAYBE_COHERENT) && !defined(CONFIG_DMA_PERDEV_COHERENT)
 /* User defined DMA coherency from command line. */
 enum coherent_io_user_state coherentio = IO_COHERENCE_DEFAULT;
 EXPORT_SYMBOL_GPL(coherentio);
Signature · 1 line
2.10.0
#11 lore raw

PATCH v3 11/18 MIPS: Print CM error reports upon bus errors

In reply to Paul Burton

If a bus error occurs on a system with a MIPS Coherence Manager (CM) then the CM may hold useful diagnostic information. Printing this out has so far been left up to boards, with the requirement that they register a board_be_handler function & call mips_cm_error_decode() from there.

In order to avoid boards other than Malta needing to duplicate this code, call mips_cm_error_decode() automatically if the board registers no board_be_handler, and remove the Malta implementation of that.

This patch results in no functional change, but removes a further piece of platform-specific code.

---

Changes in v3: None
Changes in v2: None

 arch/mips/kernel/traps.c          |  3 +++
 arch/mips/mti-malta/malta-int.c   | 15 ---------------
 arch/mips/mti-malta/malta-setup.c |  6 ------
 3 files changed, 3 insertions(+), 21 deletions(-)
arch/mips/kernel/traps.c +3 -0
index 0c0270c..1f5fdee 100644
@@ -49,6 +49,7 @@
 #include <asm/fpu.h>
 #include <asm/fpu_emulator.h>
 #include <asm/idle.h>
+#include <asm/mips-cm.h>
 #include <asm/mips-r2-to-r6-emul.h>
 #include <asm/mipsregs.h>
 #include <asm/mipsmtregs.h>
@@ -445,6 +446,8 @@ asmlinkage void do_be(struct pt_regs *regs)
 
 	if (board_be_handler)
 		action = board_be_handler(regs, fixup != NULL);
+	else
+		mips_cm_error_report();
 
 	switch (action) {
 	case MIPS_BE_DISCARD:
arch/mips/mti-malta/malta-int.c +0 -15
index 9f83224..cb675ec 100644
@@ -290,18 +290,3 @@ void __init arch_init_irq(void)
 
 	setup_irq(corehi_irq, &corehi_irqaction);
 }
-
-void malta_be_init(void)
-{
-	/* Could change CM error mask register. */
-}
-
-int malta_be_handler(struct pt_regs *regs, int is_fixup)
-{
-	/* This duplicates the handling in do_be which seems wrong */
-	int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
-
-	mips_cm_error_report();
-
-	return retval;
-}
arch/mips/mti-malta/malta-setup.c +0 -6
index f1b60748..a01d5de 100644
@@ -42,9 +42,6 @@
 #define ROCIT_CONFIG_GEN0		0x1f403000
 #define  ROCIT_CONFIG_GEN0_PCI_IOCU	BIT(7)
 
-extern void malta_be_init(void);
-extern int malta_be_handler(struct pt_regs *regs, int is_fixup);
-
 static struct resource standard_io_resources[] = {
 	{
 		.name = "dma1",
@@ -301,7 +298,4 @@ void __init plat_mem_setup(void)
 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
 	screen_info_setup();
 #endif
-
-	board_be_init = malta_be_init;
-	board_be_handler = malta_be_handler;
 }
Signature · 1 line
2.10.0
#12 lore raw

PATCH v3 12/18 MIPS: Adjust MIPS64 CAC_BASE to reflect Config.K0

In reply to Paul Burton

On MIPS64 we define the default CAC_BASE as one of the xkphys regions of the virtual address space. Since the CCA is encoded in bits 61:59 of xkphys addresses, fixing CAC_BASE to any particular one prevents us from dynamically changing the CCA as we do for MIPS32 where CAC_BASE is placed within kseg0. In order to make the kernel more generic, drop the current kludge that gives CAC_BASE CCA=3 if CONFIG_DMA_NONCOHERENT is selected (disregarding CONFIG_DMA_MAYBE_COHERENT) & CCA=5 (which is not standardised by the architecture) otherwise. Instead read Config.K0 and generate the appropriate offset into xkphys, presuming that either the bootloader or early kernel code will have configured Config.K0 appropriately. This seems like the best option for a generic implementation.

The ip27 spaces.h is adjusted to set its former value of CAC_BASE, since it's the only user of CAC_BASE from assembly (in its smp_slave_setup macro). This allows the generic case to focus solely on C code without breaking ip27.

---

Changes in v3: None
Changes in v2: None

 arch/mips/include/asm/addrspace.h           | 3 +--
 arch/mips/include/asm/mach-generic/spaces.h | 8 +++-----
 arch/mips/include/asm/mach-ip27/spaces.h    | 1 +
 3 files changed, 5 insertions(+), 7 deletions(-)
arch/mips/include/asm/addrspace.h +1 -2
index c5b04e7..4856adc 100644
@@ -126,8 +126,7 @@
 #define PHYS_TO_XKSEG_UNCACHED(p)	PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
 #define PHYS_TO_XKSEG_CACHED(p)		PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
 #define XKPHYS_TO_PHYS(p)		((p) & TO_PHYS_MASK)
-#define PHYS_TO_XKPHYS(cm, a)		(_CONST64_(0x8000000000000000) | \
-					 (_CONST64_(cm) << 59) | (a))
+#define PHYS_TO_XKPHYS(cm, a)		(XKPHYS | (_ACAST64_(cm) << 59) | (a))
 
 /*
  * The ultimate limited of the 64-bit MIPS architecture:  2 bits for selecting
arch/mips/include/asm/mach-generic/spaces.h +3 -5
index afc96ec..952b0fd 100644
@@ -12,6 +12,8 @@
 
 #include <linux/const.h>
 
+#include <asm/mipsregs.h>
+
 /*
  * This gives the physical RAM offset.
  */
@@ -52,11 +54,7 @@
 #ifdef CONFIG_64BIT
 
 #ifndef CAC_BASE
-#ifdef CONFIG_DMA_NONCOHERENT
-#define CAC_BASE		_AC(0x9800000000000000, UL)
-#else
-#define CAC_BASE		_AC(0xa800000000000000, UL)
-#endif
+#define CAC_BASE	PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
 #endif
 
 #ifndef IO_BASE
arch/mips/include/asm/mach-ip27/spaces.h +1 -0
index b18802a..4775a11 100644
@@ -19,6 +19,7 @@
 #define IO_BASE			0x9200000000000000
 #define MSPEC_BASE		0x9400000000000000
 #define UNCAC_BASE		0x9600000000000000
+#define CAC_BASE		0xa800000000000000
 
 #define TO_MSPEC(x)		(MSPEC_BASE | ((x) & TO_PHYS_MASK))
 #define TO_HSPEC(x)		(HSPEC_BASE | ((x) & TO_PHYS_MASK))
Signature · 1 line
2.10.0
#13 lore raw

PATCH v3 13/18 MIPS: Support generating Flattened Image Trees (.itb)

In reply to Paul Burton

Add support for generating kernel images in the Flattened Image Tree (.itb) format as supported by U-Boot. This format is essentially a Flattened Device Tree binary containing images (kernels, DTBs, ramdisks) and configurations which link those images together. The big advantages of FIT images over the uImage format are:

- We can include FDTs in the kernel image in a way that the bootloader can extract it & manipulate it before providing it to the kernel. Thus we can ship FDTs as part of the kernel giving us the advantages of being able to develop & maintain the DT within the kernel tree, but also have the benefits of the bootloader being able to manipulate the FDT. Example uses for this would be to inject the kernel command line into the chosen node, or to fill in the correct memory size.

- We can include multiple configurations in a single kernel image. This means that a single FIT image can, given appropriate bootloaders, be booted on different boards with the bootloader selecting an appropriate configuration & providing the correct FDT to the kernel.

- We can support a multitude of hashes over the data.

---

Changes in v3: None
Changes in v2: None

 arch/mips/Makefile      |  8 ++++++-
 arch/mips/boot/Makefile | 57 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 1 deletion(-)
arch/mips/Makefile +7 -1
index 598ab29..691a6e1 100644
@@ -262,7 +262,8 @@ KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
 KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
 
 bootvars-y	= VMLINUX_LOAD_ADDRESS=$(load-y) \
-		  VMLINUX_ENTRY_ADDRESS=$(entry-y)
+		  VMLINUX_ENTRY_ADDRESS=$(entry-y) \
+		  PLATFORM=$(platform-y)
 
 LDFLAGS			+= -m $(ld-emul)
 
@@ -302,6 +303,11 @@ boot-y			+= uImage.gz
 boot-y			+= uImage.lzma
 boot-y			+= uImage.lzo
 endif
+boot-y			+= vmlinux.itb
+boot-y			+= vmlinux.gz.itb
+boot-y			+= vmlinux.bz2.itb
+boot-y			+= vmlinux.lzma.itb
+boot-y			+= vmlinux.lzo.itb
 
 # compressed boot image targets (arch/mips/boot/compressed/)
 bootz-y			:= vmlinuz
arch/mips/boot/Makefile +57 -0

60 lines not on this page · raw message

Signature · 1 line
2.10.0
#14 lore raw

PATCH v3 14/18 MIPS: generic: Introduce generic DT-based board support

In reply to Paul Burton

Introduce a "generic" platform, which aims to be board-agnostic by making use of device trees passed by the boot protocol defined in the MIPS UHI (Universal Hosting Interface) specification. Provision is made for supporting boards which use a legacy boot protocol that can't be changed, but adding support for such boards or any others is left to followon patches.

Right now the built kernels expect to be loaded to 0x80100000, ie. in kseg0. This is fine for the vast majority of MIPS platforms, but nevertheless it would be good to remove this limitation in the future by mapping the kernel via the TLB such that it can be loaded anywhere & map itself appropriately.

Configuration is handled by dynamically generating configs using scripts/kconfig/merge_config.sh, somewhat similar to the way powerpc makes use of it. This allows for variations upon the configuration, eg. differing architecture revisions or subsets of driver support for differing boards, to be handled without having a large number of defconfig files.

---

Changes in v3:
- s/targetting/targeting/

Changes in v2:
- Select MIPS_L1_CACHE_SHIFT_7 to be conservative.
- Don't warn about SMP init failure - register_up_smp_ops will always succeed for SMP kernels & we don't care if it fails on UP kernels.
- Improve generic_defconfig & 64 bit config fragments.
- Only probe CPU interrupt controller from code if not listed in DT. Some platforms include it in their DT & need to reference it. Others don't, but we still need the driver probed for the GIC to work as expected.

 arch/mips/Kbuild.platforms                 |   1 +
 arch/mips/Kconfig                          |  52 +++++++++
 arch/mips/Makefile                         |  56 +++++++++
 arch/mips/boot/Makefile                    |  11 +-
 arch/mips/configs/generic/32r1.config      |   2 +
 arch/mips/configs/generic/32r2.config      |   3 +
 arch/mips/configs/generic/32r6.config      |   2 +
 arch/mips/configs/generic/64r1.config      |   4 +
 arch/mips/configs/generic/64r2.config      |   5 +
 arch/mips/configs/generic/64r6.config      |   4 +
 arch/mips/configs/generic/eb.config        |   1 +
 arch/mips/configs/generic/el.config        |   1 +
 arch/mips/configs/generic/micro32r2.config |   4 +
 arch/mips/configs/generic_defconfig        |  96 ++++++++++++++++
 arch/mips/generic/Kconfig                  |  12 ++
 arch/mips/generic/Makefile                 |  13 +++
 arch/mips/generic/Platform                 |  14 +++
 arch/mips/generic/init.c                   | 176 +++++++++++++++++++++++++++++
 arch/mips/generic/irq.c                    |  64 +++++++++++
 arch/mips/generic/proc.c                   |  29 +++++
 arch/mips/generic/vmlinux.its.S            |  31 +++++
 arch/mips/include/asm/machine.h            |  63 +++++++++++
 22 files changed, 643 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/configs/generic/32r1.config
 create mode 100644 arch/mips/configs/generic/32r2.config
 create mode 100644 arch/mips/configs/generic/32r6.config
 create mode 100644 arch/mips/configs/generic/64r1.config
 create mode 100644 arch/mips/configs/generic/64r2.config
 create mode 100644 arch/mips/configs/generic/64r6.config
 create mode 100644 arch/mips/configs/generic/eb.config
 create mode 100644 arch/mips/configs/generic/el.config
 create mode 100644 arch/mips/configs/generic/micro32r2.config
 create mode 100644 arch/mips/configs/generic_defconfig
 create mode 100644 arch/mips/generic/Kconfig
 create mode 100644 arch/mips/generic/Makefile
 create mode 100644 arch/mips/generic/Platform
 create mode 100644 arch/mips/generic/init.c
 create mode 100644 arch/mips/generic/irq.c
 create mode 100644 arch/mips/generic/proc.c
 create mode 100644 arch/mips/generic/vmlinux.its.S
 create mode 100644 arch/mips/include/asm/machine.h
arch/mips/Kbuild.platforms +1 -0
index c5cd63a..9c1e8f9 100644
@@ -11,6 +11,7 @@ platforms += cavium-octeon
 platforms += cobalt
 platforms += dec
 platforms += emma
+platforms += generic
 platforms += jazz
 platforms += jz4740
 platforms += lantiq
arch/mips/Kconfig +52 -0

64 lines not on this page · raw message

arch/mips/Makefile +56 -0

66 lines not on this page · raw message

arch/mips/boot/Makefile +10 -1
index ed65663..2728a9a 100644
@@ -111,13 +111,22 @@ targets += vmlinux.bz2.itb
 targets += vmlinux.lzma.itb
 targets += vmlinux.lzo.itb
 
+ifeq ($(ADDR_BITS),32)
+	itb_addr_cells = 1
+endif
+ifeq ($(ADDR_BITS),64)
+	itb_addr_cells = 2
+endif
+
 quiet_cmd_cpp_its_S = ITS     $@
       cmd_cpp_its_S = $(CPP) $(cpp_flags) -P -C -o $@ $< \
 		        -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
 			-DVMLINUX_BINARY="\"$(3)\"" \
 			-DVMLINUX_COMPRESSION="\"$(2)\"" \
 			-DVMLINUX_LOAD_ADDRESS=$(VMLINUX_LOAD_ADDRESS) \
-			-DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS)
+			-DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS) \
+			-DADDR_BITS=$(ADDR_BITS) \
+			-DADDR_CELLS=$(itb_addr_cells)
 
 $(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
 	$(call if_changed_dep,cpp_its_S,none,vmlinux.bin)
arch/mips/configs/generic/32r1.config new file +2 -0
new file mode 100644
index 0000000..a11cd87
@@ -0,0 +1,2 @@
+CONFIG_CPU_MIPS32_R1=y
+CONFIG_HIGHMEM=y
arch/mips/configs/generic/32r2.config new file +3 -0
new file mode 100644
index 0000000..9570672
@@ -0,0 +1,3 @@
+CONFIG_CPU_MIPS32_R2=y
+CONFIG_MIPS_O32_FP64_SUPPORT=y
+CONFIG_HIGHMEM=y
arch/mips/configs/generic/32r6.config new file +2 -0
new file mode 100644
index 0000000..ca606e7
@@ -0,0 +1,2 @@
+CONFIG_CPU_MIPS32_R6=y
+CONFIG_HIGHMEM=y
arch/mips/configs/generic/64r1.config new file +4 -0
new file mode 100644
index 0000000..7c1ea7e
@@ -0,0 +1,4 @@
+CONFIG_CPU_MIPS64_R1=y
+CONFIG_64BIT=y
+CONFIG_MIPS32_O32=y
+CONFIG_MIPS32_N32=y
arch/mips/configs/generic/64r2.config new file +5 -0
new file mode 100644
index 0000000..b4d31ae
@@ -0,0 +1,5 @@
+CONFIG_CPU_MIPS64_R2=y
+CONFIG_MIPS_O32_FP64_SUPPORT=y
+CONFIG_64BIT=y
+CONFIG_MIPS32_O32=y
+CONFIG_MIPS32_N32=y
arch/mips/configs/generic/64r6.config new file +4 -0
new file mode 100644
index 0000000..7cac033
@@ -0,0 +1,4 @@
+CONFIG_CPU_MIPS64_R6=y
+CONFIG_64BIT=y
+CONFIG_MIPS32_O32=y
+CONFIG_MIPS32_N32=y
arch/mips/configs/generic/eb.config new file +1 -0
new file mode 100644
index 0000000..c5cdc99
@@ -0,0 +1 @@
+CONFIG_CPU_BIG_ENDIAN=y
arch/mips/configs/generic/el.config new file +1 -0
new file mode 100644
index 0000000..ee43fdb
@@ -0,0 +1 @@
+CONFIG_CPU_LITTLE_ENDIAN=y
arch/mips/configs/generic/micro32r2.config new file +4 -0
new file mode 100644
index 0000000..b701fe7
@@ -0,0 +1,4 @@
+CONFIG_CPU_MIPS32_R2=y
+CONFIG_CPU_MICROMIPS=y
+CONFIG_MIPS_O32_FP64_SUPPORT=y
+CONFIG_HIGHMEM=y
arch/mips/configs/generic_defconfig new file +96 -0

96 lines not on this page · raw message

arch/mips/generic/Kconfig new file +12 -0
new file mode 100644
index 0000000..baddb06
@@ -0,0 +1,12 @@
+if MIPS_GENERIC
+
+config LEGACY_BOARDS
+	bool
+	help
+	  Select this from your board if the board must use a legacy, non-UHI,
+	  boot protocol. This will cause the kernel to scan through the list of
+	  supported machines calling their detect functions in turn if the
+	  kernel is booted without being provided with an FDT via the UHI
+	  boot protocol.
+
+endif
arch/mips/generic/Makefile new file +13 -0
new file mode 100644
index 0000000..26e6420
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2016 Imagination Technologies
+# Author: Paul Burton <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation;  either version 2 of the  License, or (at your
+# option) any later version.
+#
+
+obj-y += init.o
+obj-y += irq.o
+obj-y += proc.o
arch/mips/generic/Platform new file +14 -0
new file mode 100644
index 0000000..9a30d69
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2016 Imagination Technologies
+# Author: Paul Burton <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation;  either version 2 of the  License, or (at your
+# option) any later version.
+#
+
+platform-$(CONFIG_MIPS_GENERIC)	+= generic/
+cflags-$(CONFIG_MIPS_GENERIC)	+= -I$(srctree)/arch/mips/include/asm/mach-generic
+load-$(CONFIG_MIPS_GENERIC)	+= 0xffffffff80100000
+all-$(CONFIG_MIPS_GENERIC)	:= vmlinux.gz.itb
arch/mips/generic/init.c new file +176 -0

176 lines not on this page · raw message

arch/mips/generic/irq.c new file +64 -0

64 lines not on this page · raw message

arch/mips/generic/proc.c new file +29 -0
new file mode 100644
index 0000000..42b3325
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 Imagination Technologies
+ * Author: Paul Burton <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/of.h>
+
+#include <asm/bootinfo.h>
+
+const char *get_system_type(void)
+{
+	const char *str;
+	int err;
+
+	err = of_property_read_string(of_root, "model", &str);
+	if (!err)
+		return str;
+
+	err = of_property_read_string_index(of_root, "compatible", 0, &str);
+	if (!err)
+		return str;
+
+	return "Unknown";
+}
arch/mips/generic/vmlinux.its.S new file +31 -0
new file mode 100644
index 0000000..f67fbf1
@@ -0,0 +1,31 @@
+/dts-v1/;
+
+/ {
+	description = KERNEL_NAME;
+	#address-cells = <ADDR_CELLS>;
+
+	images {
+		kernel@0 {
+			description = KERNEL_NAME;
+			data = /incbin/(VMLINUX_BINARY);
+			type = "kernel";
+			arch = "mips";
+			os = "linux";
+			compression = VMLINUX_COMPRESSION;
+			load = /bits/ ADDR_BITS <VMLINUX_LOAD_ADDRESS>;
+			entry = /bits/ ADDR_BITS <VMLINUX_ENTRY_ADDRESS>;
+			hash@0 {
+				algo = "sha1";
+			};
+		};
+	};
+
+	configurations {
+		default = "conf@default";
+
+		conf@default {
+			description = "Generic Linux kernel";
+			kernel = "kernel@0";
+		};
+	};
+};
arch/mips/include/asm/machine.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.10.0
#15 lore raw

PATCH v3 15/18 MIPS: generic: Convert SEAD-3 to a generic board

In reply to Paul Burton

Convert the MIPS SEAD-3 board support to be a generic board, supported by generic kernels.

Because the SEAD-3 boot protocol was defined long ago and we don't want to force a switch to the UHI protocol, SEAD-3 is added as a legacy board which is detected by reading the REVISION register. This may technically not be a valid memory read & future work will include attempting to handle that gracefully. In practice since SEAD-3 is the only legacy board supported by the generic kernel so far the read will only happen on SEAD-3 boards, and even once Malta is converted the same REVISION register exists there too. Other boards such as Boston, Ci20 & Ci40 will use the UHI boot protocol & thus not run any of the legacy board detect functions.

---

Changes in v3: None
Changes in v2: None

 arch/mips/Kbuild.platforms                         |   1 -
 arch/mips/Kconfig                                  |  37 +-----
 arch/mips/Makefile                                 |  13 +++
 arch/mips/boot/dts/mti/Makefile                    |   2 +-
 arch/mips/boot/dts/mti/sead3.dts                   |   1 +
 arch/mips/configs/generic/board-sead-3.config      |  32 +++++
 arch/mips/configs/sead3_defconfig                  | 129 ---------------------
 arch/mips/configs/sead3micro_defconfig             | 122 -------------------
 arch/mips/generic/Kconfig                          |   7 ++
 arch/mips/generic/Makefile                         |   2 +
 .../sead3-dtshim.c => generic/board-sead3.c}       | 106 +++++++++++++++--
 .../include/asm/mach-sead3/cpu-feature-overrides.h |  72 ------------
 arch/mips/include/asm/mach-sead3/irq.h             |   9 --
 .../include/asm/mach-sead3/kernel-entry-init.h     |  21 ----
 arch/mips/include/asm/mach-sead3/sead3-dtshim.h    |  29 -----
 arch/mips/include/asm/mach-sead3/war.h             |  24 ----
 arch/mips/mti-sead3/Makefile                       |  15 ---
 arch/mips/mti-sead3/Platform                       |   7 --
 arch/mips/mti-sead3/sead3-init.c                   | 100 ----------------
 arch/mips/mti-sead3/sead3-int.c                    |  23 ----
 arch/mips/mti-sead3/sead3-setup.c                  |  39 -------
 arch/mips/mti-sead3/sead3-time.c                   |  91 ---------------
 22 files changed, 152 insertions(+), 730 deletions(-)
 create mode 100644 arch/mips/configs/generic/board-sead-3.config
 delete mode 100644 arch/mips/configs/sead3_defconfig
 delete mode 100644 arch/mips/configs/sead3micro_defconfig
 rename arch/mips/{mti-sead3/sead3-dtshim.c => generic/board-sead3.c} (72%)
 delete mode 100644 arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/irq.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/kernel-entry-init.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/sead3-dtshim.h
 delete mode 100644 arch/mips/include/asm/mach-sead3/war.h
 delete mode 100644 arch/mips/mti-sead3/Makefile
 delete mode 100644 arch/mips/mti-sead3/Platform
 delete mode 100644 arch/mips/mti-sead3/sead3-init.c
 delete mode 100644 arch/mips/mti-sead3/sead3-int.c
 delete mode 100644 arch/mips/mti-sead3/sead3-setup.c
 delete mode 100644 arch/mips/mti-sead3/sead3-time.c
arch/mips/Kbuild.platforms +0 -1
index 9c1e8f9..f5f1bdb 100644
@@ -19,7 +19,6 @@ platforms += lasat
 platforms += loongson32
 platforms += loongson64
 platforms += mti-malta
-platforms += mti-sead3
 platforms += netlogic
 platforms += paravirt
 platforms += pic32
arch/mips/Kconfig +1 -36
index 82b45dc..a7d9224 100644
@@ -546,41 +546,6 @@ config MACH_PIC32
 	  Microchip PIC32 is a family of general-purpose 32 bit MIPS core
 	  microcontrollers.
 
-config MIPS_SEAD3
-	bool "MIPS SEAD3 board"
-	select BOOT_ELF32
-	select BOOT_RAW
-	select BUILTIN_DTB
-	select CEVT_R4K
-	select CSRC_R4K
-	select CLKSRC_MIPS_GIC
-	select COMMON_CLK
-	select CPU_MIPSR2_IRQ_VI
-	select CPU_MIPSR2_IRQ_EI
-	select DMA_NONCOHERENT
-	select IRQ_MIPS_CPU
-	select MIPS_GIC
-	select LIBFDT
-	select MIPS_MSC
-	select SYS_HAS_CPU_MIPS32_R1
-	select SYS_HAS_CPU_MIPS32_R2
-	select SYS_HAS_CPU_MIPS32_R6
-	select SYS_HAS_CPU_MIPS64_R1
-	select SYS_SUPPORTS_32BIT_KERNEL
-	select SYS_SUPPORTS_64BIT_KERNEL
-	select SYS_SUPPORTS_BIG_ENDIAN
-	select SYS_SUPPORTS_LITTLE_ENDIAN
-	select SYS_SUPPORTS_SMARTMIPS
-	select SYS_SUPPORTS_MICROMIPS
-	select SYS_SUPPORTS_MIPS16
-	select SYS_SUPPORTS_RELOCATABLE
-	select USB_EHCI_BIG_ENDIAN_DESC
-	select USB_EHCI_BIG_ENDIAN_MMIO
-	select USE_OF
-	help
-	  This enables support for the MIPS Technologies SEAD3 evaluation
-	  board.
-
 config NEC_MARKEINS
 	bool "NEC EMMA2RH Mark-eins board"
 	select SOC_EMMA2RH
@@ -2976,7 +2941,7 @@ endchoice
 choice
 	prompt "Kernel command line type" if !CMDLINE_OVERRIDE
 	default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATH79 && !MACH_INGENIC && \
-					 !MIPS_MALTA && !MIPS_SEAD3 && \
+					 !MIPS_MALTA && \
 					 !CAVIUM_OCTEON_SOC
 	default MIPS_CMDLINE_FROM_BOOTLOADER
 
arch/mips/Makefile +13 -0
index f3e768a..fbf40d3 100644
@@ -488,3 +488,16 @@ $(generic_defconfigs):
 # Prevent generic merge_config rules attempting to merge single fragments
 #
 $(generic_config_dir)/%.config: ;
+
+#
+# Legacy defconfig compatibility - these targets used to be real defconfigs but
+# now that the boards have been converted to use the generic kernel they are
+# wrappers around the generic rules above.
+#
+.PHONY: sead3_defconfig
+sead3_defconfig:
+	$(Q)$(MAKE) 32r2el_defconfig BOARDS=sead-3
+
+.PHONY: sead3micro_defconfig
+sead3micro_defconfig:
+	$(Q)$(MAKE) micro32r2el_defconfig BOARDS=sead-3
arch/mips/boot/dts/mti/Makefile +1 -1
index 144d776..fcabd69 100644
@@ -1,5 +1,5 @@
 dtb-$(CONFIG_MIPS_MALTA)	+= malta.dtb
-dtb-$(CONFIG_MIPS_SEAD3)	+= sead3.dtb
+dtb-$(CONFIG_LEGACY_BOARD_SEAD3)	+= sead3.dtb
 
 obj-y				+= $(patsubst %.dtb, %.dtb.o, $(dtb-y))
 
arch/mips/boot/dts/mti/sead3.dts +1 -0
index 2579ca5..b112879 100644
@@ -10,6 +10,7 @@
 	#address-cells = <1>;
 	#size-cells = <1>;
 	compatible = "mti,sead-3";
+	model = "MIPS SEAD-3";
 	interrupt-parent = <&gic>;
 
 	chosen {
arch/mips/configs/generic/board-sead-3.config new file +32 -0
new file mode 100644
index 0000000..3b5e1ac
@@ -0,0 +1,32 @@
+CONFIG_LEGACY_BOARD_SEAD3=y
+
+CONFIG_AUXDISPLAY=y
+CONFIG_IMG_ASCII_LCD=y
+
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_SYSCON=y
+
+CONFIG_MMC=y
+CONFIG_MMC_SPI=y
+
+CONFIG_MTD=y
+CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_OF_PARTS=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_OF=y
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_GLUEBI=y
+
+CONFIG_NETDEVICES=y
+CONFIG_SMSC911X=y
+CONFIG_SMSC_PHY=y
+
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_OF_PLATFORM=y
+
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
arch/mips/configs/sead3_defconfig deleted +0 -129

129 lines not on this page · raw message

arch/mips/configs/sead3micro_defconfig deleted +0 -122

122 lines not on this page · raw message

arch/mips/generic/Kconfig +7 -0
index baddb06..a606b3f 100644
@@ -9,4 +9,11 @@ config LEGACY_BOARDS
 	  kernel is booted without being provided with an FDT via the UHI
 	  boot protocol.
 
+config LEGACY_BOARD_SEAD3
+	bool "Support MIPS SEAD-3 boards"
+	select LEGACY_BOARDS
+	help
+	  Enable this to include support for booting on MIPS SEAD-3 FPGA-based
+	  development boards, which boot using a legacy boot protocol.
+
 endif
arch/mips/generic/Makefile +2 -0
index 26e6420..7c66494 100644
@@ -11,3 +11,5 @@
 obj-y += init.o
 obj-y += irq.o
 obj-y += proc.o
+
+obj-$(CONFIG_LEGACY_BOARD_SEAD3)	+= board-sead3.o
arch/mips/generic/board-sead3.c renamed from arch/mips/mti-sead3/sead3-dtshim.c +95 -11

164 lines not on this page · raw message

arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h deleted +0 -72

72 lines not on this page · raw message

arch/mips/include/asm/mach-sead3/irq.h deleted +0 -9
deleted file mode 100644
index 5d154cf..0000000
@@ -1,9 +0,0 @@
-#ifndef __ASM_MACH_MIPS_IRQ_H
-#define __ASM_MACH_MIPS_IRQ_H
-
-#define NR_IRQS 256
-
-
-#include_next <irq.h>
-
-#endif /* __ASM_MACH_MIPS_IRQ_H */
arch/mips/include/asm/mach-sead3/kernel-entry-init.h deleted +0 -21
deleted file mode 100644
index 6cccd4d..0000000
@@ -1,21 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Chris Dearman ([email protected])
- * Copyright (C) 2007 Mips Technologies, Inc.
- */
-#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
-#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
-
-	.macro	kernel_entry_setup
-	.endm
-
-/*
- * Do SMP slave processor setup necessary before we can safely execute C code.
- */
-	.macro	smp_slave_setup
-	.endm
-
-#endif /* __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H */
arch/mips/include/asm/mach-sead3/sead3-dtshim.h deleted +0 -29
deleted file mode 100644
index f5d7d9c..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2016 Imagination Technologies
- * Author: Paul Burton <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
-
-#ifndef __MIPS_SEAD3_DTSHIM_H__
-#define __MIPS_SEAD3_DTSHIM_H__
-
-#include <linux/init.h>
-
-#ifdef CONFIG_MIPS_SEAD3
-
-extern void __init *sead3_dt_shim(void *fdt);
-
-#else /* !CONFIG_MIPS_SEAD3 */
-
-static inline void *sead3_dt_shim(void *fdt)
-{
-	return fdt;
-}
-
-#endif /* !CONFIG_MIPS_SEAD3 */
-
-#endif /* __MIPS_SEAD3_DTSHIM_H__ */
arch/mips/include/asm/mach-sead3/war.h deleted +0 -24
deleted file mode 100644
index d068fc4..0000000
@@ -1,24 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <[email protected]>
- */
-#ifndef __ASM_MIPS_MACH_MIPS_WAR_H
-#define __ASM_MIPS_MACH_MIPS_WAR_H
-
-#define R4600_V1_INDEX_ICACHEOP_WAR	0
-#define R4600_V1_HIT_CACHEOP_WAR	0
-#define R4600_V2_HIT_CACHEOP_WAR	0
-#define R5432_CP0_INTERRUPT_WAR		0
-#define BCM1250_M3_WAR			0
-#define SIBYTE_1956_WAR			0
-#define MIPS4K_ICACHE_REFILL_WAR	1
-#define MIPS_CACHE_SYNC_WAR		1
-#define TX49XX_ICACHE_INDEX_INV_WAR	0
-#define ICACHE_REFILLS_WORKAROUND_WAR	1
-#define R10000_LLSC_WAR			0
-#define MIPS34K_MISSED_ITLB_WAR		0
-
-#endif /* __ASM_MIPS_MACH_MIPS_WAR_H */
arch/mips/mti-sead3/Makefile deleted +0 -15
deleted file mode 100644
index 1674b9c..0000000
@@ -1,15 +0,0 @@
-#
-# Carsten Langgaard, [email protected]
-# Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
-#
-# Copyright (C) 2008 Wind River Systems, Inc.
-#   written by Ralf Baechle <[email protected]>
-#
-# Copyright (C) 2012 MIPS Technoligies, Inc.  All rights reserved.
-# Steven J. Hill <[email protected]>
-#
-obj-y := sead3-dtshim.o
-obj-y += sead3-init.o
-obj-y += sead3-int.o
-obj-y += sead3-setup.o
-obj-y += sead3-time.o
arch/mips/mti-sead3/Platform deleted +0 -7
deleted file mode 100644
index 3870924..0000000
@@ -1,7 +0,0 @@
-#
-# MIPS SEAD-3 board
-#
-platform-$(CONFIG_MIPS_SEAD3)	+= mti-sead3/
-cflags-$(CONFIG_MIPS_SEAD3)	+= -I$(srctree)/arch/mips/include/asm/mach-sead3
-load-$(CONFIG_MIPS_SEAD3)	+= 0xffffffff80100000
-all-$(CONFIG_MIPS_SEAD3)	:= $(COMPRESSION_FNAME).srec
arch/mips/mti-sead3/sead3-init.c deleted +0 -100

100 lines not on this page · raw message

arch/mips/mti-sead3/sead3-int.c deleted +0 -23
deleted file mode 100644
index 2e6b732..0000000
@@ -1,23 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
- */
-#include <linux/init.h>
-#include <linux/irqchip.h>
-#include <linux/irqchip/mips-gic.h>
-
-#include <asm/cpu-info.h>
-#include <asm/irq.h>
-
-void __init arch_init_irq(void)
-{
-	irqchip_init();
-
-	pr_info("GIC: %spresent\n", (gic_present) ? "" : "not ");
-	pr_info("EIC: %s\n",
-		(current_cpu_data.options & MIPS_CPU_VEIC) ?  "on" : "off");
-}
-
arch/mips/mti-sead3/sead3-setup.c deleted +0 -39
deleted file mode 100644
index c915e54..0000000
@@ -1,39 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
- * Copyright (C) 2013 Imagination Technologies Ltd.
- */
-#include <linux/init.h>
-#include <linux/libfdt.h>
-#include <linux/of_fdt.h>
-
-#include <asm/prom.h>
-
-#include <asm/mach-sead3/sead3-dtshim.h>
-#include <asm/mips-boards/generic.h>
-
-const char *get_system_type(void)
-{
-	return "MIPS SEAD3";
-}
-
-void __init *plat_get_fdt(void)
-{
-	return (void *)__dtb_start;
-}
-
-void __init plat_mem_setup(void)
-{
-	void *fdt = plat_get_fdt();
-
-	fdt = sead3_dt_shim(fdt);
-	__dt_setup_arch(fdt);
-}
-
-void __init device_tree_init(void)
-{
-	unflatten_and_copy_device_tree();
-}
arch/mips/mti-sead3/sead3-time.c deleted +0 -91

91 lines not on this page · raw message

Signature · 1 line
2.10.0
#25 lore raw

PATCH v3 18/18 MIPS: generic: Support MIPS Boston development boards

In reply to Paul Burton

Add support for the MIPS Boston development board to generic kernels, which essentially amounts to:

- Adding the device tree source for the MIPS Boston board.

- Adding a Kconfig fragment which enables the appropriate drivers for the MIPS Boston board.

With these changes in place generic kernels will support the board by default, and kernels with only the drivers needed for Boston enabled can be configured by setting BOARDS=boston during configuration. For example:

  $ make ARCH=mips 64r6el_defconfig BOARDS=boston

---

Changes in v3: None
Changes in v2: None

 arch/mips/boot/dts/Makefile                   |   1 +
 arch/mips/boot/dts/img/Makefile               |   7 +
 arch/mips/boot/dts/img/boston.dts             | 230 ++++++++++++++++++++++++++
 arch/mips/configs/generic/board-boston.config |  46 ++++++
 arch/mips/generic/Kconfig                     |   8 +
 arch/mips/generic/vmlinux.its.S               |  25 +++
 6 files changed, 317 insertions(+)
 create mode 100644 arch/mips/boot/dts/img/Makefile
 create mode 100644 arch/mips/boot/dts/img/boston.dts
 create mode 100644 arch/mips/configs/generic/board-boston.config
arch/mips/boot/dts/Makefile +1 -0
index fc7a0a9..b9db492 100644
@@ -1,5 +1,6 @@
 dts-dirs	+= brcm
 dts-dirs	+= cavium-octeon
+dts-dirs	+= img
 dts-dirs	+= ingenic
 dts-dirs	+= lantiq
 dts-dirs	+= mti
arch/mips/boot/dts/img/Makefile new file +7 -0
new file mode 100644
index 0000000..ae119d3
@@ -0,0 +1,7 @@
+dtb-$(CONFIG_FIT_IMAGE_FDT_BOSTON)	+= boston.dtb
+
+# Force kbuild to make empty built-in.o if necessary
+obj-					+= dummy.o
+
+always					:= $(dtb-y)
+clean-files				:= *.dtb *.dtb.S
arch/mips/boot/dts/img/boston.dts new file +230 -0

230 lines not on this page · raw message

arch/mips/configs/generic/board-boston.config new file +46 -0

46 lines not on this page · raw message

arch/mips/generic/Kconfig +8 -0
index a606b3f..16eb939 100644
@@ -16,4 +16,12 @@ config LEGACY_BOARD_SEAD3
 	  Enable this to include support for booting on MIPS SEAD-3 FPGA-based
 	  development boards, which boot using a legacy boot protocol.
 
+config FIT_IMAGE_FDT_BOSTON
+	bool "Include FDT for MIPS Boston boards"
+	help
+	  Enable this to include the FDT for the MIPS Boston development board
+	  from Imagination Technologies in the FIT kernel image. You should
+	  enable this if you wish to boot on a MIPS Boston board, as it is
+	  expected by the bootloader.
+
 endif
arch/mips/generic/vmlinux.its.S +25 -0
index f67fbf1..3390e2f 100644
@@ -29,3 +29,28 @@
 		};
 	};
 };
+
+#ifdef CONFIG_FIT_IMAGE_FDT_BOSTON
+/ {
+	images {
+		fdt@boston {
+			description = "img,boston Device Tree";
+			data = /incbin/("boot/dts/img/boston.dtb");
+			type = "flat_dt";
+			arch = "mips";
+			compression = "none";
+			hash@0 {
+				algo = "sha1";
+			};
+		};
+	};
+
+	configurations {
+		conf@boston {
+			description = "Boston Linux kernel";
+			kernel = "kernel@0";
+			fdt = "fdt@boston";
+		};
+	};
+};
+#endif /* CONFIG_FIT_IMAGE_FDT_BOSTON */
Signature · 1 line
2.10.0
#24 lore raw

Re: [PATCH v3 17/18] clk: boston: Add a driver for MIPS Boston board clocks

In reply to Paul Burton
Quoted 9 lines · On Wednesday, 5 October 2016 18:18:23 BST Paul Burton wrote:

Add a driver for the clocks provided by the MIPS Boston board from Imagination Technologies. 2 clocks are provided - the system clock & the CPU clock - and each is a simple fixed rate clock whose frequency can be determined by reading a register provided by the board.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>

Hello,

I realise the merge window may be a busy time for you, but would it be possible to get review of this (preferrably acks!) so Ralf can take it through the MIPS tree as part of Boston board support? It hasn't changed since v2 which was posted on 30th August.

Thanks,
Paul

drivers/clk/Makefile obj-y

Quoted 37 lines

---

Changes in v3: None
Changes in v2:
- Support BOSTON_CLK_INPUT.
- Register clocks with clk_register_fixed_rate during boot, removing need for clk_ops. - s/uint32_t/u32/.
- Move driver to a vendor directory.

 drivers/clk/Kconfig             |   1 +
 drivers/clk/Makefile            |   1 +
 drivers/clk/imgtec/Kconfig      |  10 ++++
 drivers/clk/imgtec/Makefile     |   1 +
 drivers/clk/imgtec/clk-boston.c | 101
++++++++++++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+)
 create mode 100644 drivers/clk/imgtec/Kconfig
 create mode 100644 drivers/clk/imgtec/Makefile
 create mode 100644 drivers/clk/imgtec/clk-boston.c
drivers/clk/Kconfig +1 -0
index e2d9bd7..a6c7e03 100644
@@ -210,6 +210,7 @@ config COMMON_CLK_OXNAS
 
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
+source "drivers/clk/imgtec/Kconfig"
 source "drivers/clk/meson/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/qcom/Kconfig"
drivers/clk/Makefile +0 -0
index 3b6f9cf..8c4c425 100644
@@ -60,6 +60,7 @@ obj-y					
+= bcm/
>  obj-$(CONFIG_ARCH_BERLIN)		+= berlin/
>  obj-$(CONFIG_H8300)			+= h8300/
>  obj-$(CONFIG_ARCH_HISI)			+= hisilicon/
Quoted 73 lines
drivers/clk/Makefile +1 -0
+obj-y					+= imgtec/
 obj-$(CONFIG_ARCH_MXC)			+= imx/
 obj-$(CONFIG_MACH_INGENIC)		+= ingenic/
 obj-$(CONFIG_COMMON_CLK_KEYSTONE)	+= keystone/
drivers/clk/imgtec/Kconfig new file +10 -0
new file mode 100644
index 0000000..c2ea745
@@ -0,0 +1,10 @@
+config COMMON_CLK_BOSTON
+	bool "Clock driver for MIPS Boston boards"
+	depends on MIPS || COMPILE_TEST
+	depends on OF
+	select MFD_SYSCON
+	---help---
+	  Enable this to support the system & CPU clocks on the MIPS Boston
+	  development board from Imagination Technologies. These are simple
+	  fixed rate clocks whose rate is determined by reading a platform
+	  provided register.
drivers/clk/imgtec/Makefile new file +1 -0
new file mode 100644
index 0000000..ac779b8
@@ -0,0 +1 @@
+obj-$(CONFIG_COMMON_CLK_BOSTON)		+= clk-boston.o
(quoted diff) +0 -0

b/drivers/clk/imgtec/clk-boston.c new file mode 100644 index 0000000..14795b8

drivers/clk/imgtec/clk-boston.c new file +40 -0
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2016 Imagination Technologies
+ * Author: Paul Burton <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/mfd/syscon.h>
+
+#include <dt-bindings/clock/boston-clock.h>
+
+#define BOSTON_PLAT_MMCMDIV		0x30
+# define BOSTON_PLAT_MMCMDIV_CLK0DIV	(0xff << 0)
+# define BOSTON_PLAT_MMCMDIV_INPUT	(0xff << 8)
+# define BOSTON_PLAT_MMCMDIV_MUL	(0xff << 16)
+# define BOSTON_PLAT_MMCMDIV_CLK1DIV	(0xff << 24)
+
+#define BOSTON_CLK_COUNT 3
+
+struct clk_boston_state {
+	struct clk *clks[BOSTON_CLK_COUNT];
+	struct clk_onecell_data onecell_data;
+};
+
+static u32 ext_field(u32 val, u32 mask)
+{
+	return (val & mask) >> (ffs(mask) - 1);
+}
+
+static void __init clk_boston_setup(struct device_node *np)
+{
+	unsigned long in_freq, cpu_freq, sys_freq;
maintainer
#17 lore raw

Re: [PATCH v3 16/18] dt-bindings: Document img,boston-clock binding

In reply to Paul Burton
Quoted 35 lines · Paul Burton

Add device tree binding documentation for the clocks provided by the MIPS Boston development board from Imagination Technologies, and a header file describing the available clocks for use by device trees & driver.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Changes in v3: None
Changes in v2:
- Add BOSTON_CLK_INPUT to expose the input clock.

 .../devicetree/bindings/clock/img,boston-clock.txt | 27 ++++++++++++++++++++++
 include/dt-bindings/clock/boston-clock.h           | 14 +++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/img,boston-clock.txt
 create mode 100644 include/dt-bindings/clock/boston-clock.h
Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +4 -0
new file mode 100644
index 0000000..c01ea60
@@ -0,0 +1,27 @@
+Binding for Imagination Technologies MIPS Boston clock sources.
+
+This binding uses the common clock binding[1].
+

Documentation/devicetree/bindings/clock/img,boston-clock.txt line 14

Quoted 10 lines
Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +10 -0
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : Should be "img,boston-clock".
+- #clock-cells : Should be set to 1.
+  Values available for clock consumers can be found in the header file:
+    <dt-bindings/clock/boston-clock.h>
+- regmap : Phandle to the Boston platform register system controller.
+  This should contain a phandle to the system controller node covering the
+  platform registers provided by the Boston board.

Can you just make the clock node a child of the system controller and drop this?

Rob

#18 lore raw

Re: [PATCH v3 16/18] dt-bindings: Document img,boston-clock binding

Quoted 53 lines · On Monday, 10 October 2016 08:01:21 BST Rob Herring wrote:
Quoted 46 lines · Paul Burton

Add device tree binding documentation for the clocks provided by the MIPS Boston development board from Imagination Technologies, and a header file describing the available clocks for use by device trees & driver.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Changes in v3: None
Changes in v2:
- Add BOSTON_CLK_INPUT to expose the input clock.

 .../devicetree/bindings/clock/img,boston-clock.txt | 27
 ++++++++++++++++++++++ include/dt-bindings/clock/boston-clock.h         
  | 14 +++++++++++ 2 files changed, 41 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/clock/img,boston-clock.txt create mode 100644 include/dt-bindings/clock/boston-clock.h

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/clock/img,boston-clock.txt new file mode 100644
index 0000000..c01ea60

Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +13 -0
@@ -0,0 +1,27 @@
+Binding for Imagination Technologies MIPS Boston clock sources.
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : Should be "img,boston-clock".
+- #clock-cells : Should be set to 1.
+  Values available for clock consumers can be found in the header file:
+    <dt-bindings/clock/boston-clock.h>
+- regmap : Phandle to the Boston platform register system controller.
+  This should contain a phandle to the system controller node covering
Quoted 2 lines

the
+ platform registers provided by the Boston board.

Can you just make the clock node a child of the system controller and drop this?

Quoted 1 line

Rob

Hi Rob,

As I mentioned before technically that could be done, but it would really not be at all reflective of the hardware & so seems somewhat contrary to the purpose of a device tree.

Thanks,
Paul

#19 lore raw

Re: [PATCH v3 16/18] dt-bindings: Document img,boston-clock binding

In reply to Rob Herring
Quoted 53 lines · On Monday, 10 October 2016 08:01:21 BST Rob Herring wrote:
Quoted 46 lines · Paul Burton

Add device tree binding documentation for the clocks provided by the MIPS Boston development board from Imagination Technologies, and a header file describing the available clocks for use by device trees & driver.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Changes in v3: None
Changes in v2:
- Add BOSTON_CLK_INPUT to expose the input clock.

 .../devicetree/bindings/clock/img,boston-clock.txt | 27
 ++++++++++++++++++++++ include/dt-bindings/clock/boston-clock.h         
  | 14 +++++++++++ 2 files changed, 41 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/clock/img,boston-clock.txt create mode 100644 include/dt-bindings/clock/boston-clock.h

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/clock/img,boston-clock.txt new file mode 100644
index 0000000..c01ea60

Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +13 -0
@@ -0,0 +1,27 @@
+Binding for Imagination Technologies MIPS Boston clock sources.
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : Should be "img,boston-clock".
+- #clock-cells : Should be set to 1.
+  Values available for clock consumers can be found in the header file:
+    <dt-bindings/clock/boston-clock.h>
+- regmap : Phandle to the Boston platform register system controller.
+  This should contain a phandle to the system controller node covering
Quoted 2 lines

the
+ platform registers provided by the Boston board.

Can you just make the clock node a child of the system controller and drop this?

Quoted 1 line

Rob

Hi Rob,

(Apologies to anyone who received my last; my mail client seems to be misconfigured & previously sent HTML mail.)

As I mentioned before technically that could be done, but it would really not be at all reflective of the hardware & so seems somewhat contrary to the purpose of a device tree.

Thanks,
Paul

maintainer
#20 lore raw

Re: [PATCH v3 16/18] dt-bindings: Document img,boston-clock binding

Quoted 56 lines · Paul Burton
Quoted 53 lines · On Monday, 10 October 2016 08:01:21 BST Rob Herring wrote:
Quoted 46 lines · Paul Burton

Add device tree binding documentation for the clocks provided by the MIPS Boston development board from Imagination Technologies, and a header file describing the available clocks for use by device trees & driver.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Changes in v3: None
Changes in v2:
- Add BOSTON_CLK_INPUT to expose the input clock.

 .../devicetree/bindings/clock/img,boston-clock.txt | 27
 ++++++++++++++++++++++ include/dt-bindings/clock/boston-clock.h
  | 14 +++++++++++ 2 files changed, 41 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/clock/img,boston-clock.txt create mode 100644 include/dt-bindings/clock/boston-clock.h

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/clock/img,boston-clock.txt new file mode 100644
index 0000000..c01ea60

Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +13 -0
@@ -0,0 +1,27 @@
+Binding for Imagination Technologies MIPS Boston clock sources.
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : Should be "img,boston-clock".
+- #clock-cells : Should be set to 1.
+  Values available for clock consumers can be found in the header file:
+    <dt-bindings/clock/boston-clock.h>
+- regmap : Phandle to the Boston platform register system controller.
+  This should contain a phandle to the system controller node covering
Quoted 2 lines

the
+ platform registers provided by the Boston board.

Can you just make the clock node a child of the system controller and drop this?

Quoted 1 line

Rob

Quoted 8 lines

Hi Rob,

(Apologies to anyone who received my last; my mail client seems to be misconfigured & previously sent HTML mail.)

As I mentioned before technically that could be done, but it would really not be at all reflective of the hardware & so seems somewhat contrary to the purpose of a device tree.

Given that you need a reference back to the system controller, it does match the h/w. The system controller h/w contains various functions, therefore the system controller node should contain nodes for those functions (or the sys ctrlr itself could be the clock provider node with no child nodes). Otherwise, what is the parent of the clock node? Root? Root should generally be the top level devices of the SoC, though it gets used for things which have no good parent.

Rob

#21 lore raw

Re: [PATCH v3 16/18] dt-bindings: Document img,boston-clock binding

Quoted 1 line · On Tuesday, 11 October 2016 15:06:46 BST Rob Herring wrote:

On Tue, Oct 11, 2016 at 11:00 AM, Paul Burton <[email protected]>

Quoted 78 lines · wrote:
Quoted 61 lines · On Monday, 10 October 2016 08:01:21 BST Rob Herring wrote:
Quoted 58 lines · Paul Burton
Quoted 51 lines

Add device tree binding documentation for the clocks provided by the MIPS Boston development board from Imagination Technologies, and a header file describing the available clocks for use by device trees & driver.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Changes in v3: None
Changes in v2:
- Add BOSTON_CLK_INPUT to expose the input clock.

 .../devicetree/bindings/clock/img,boston-clock.txt | 27

++++++++++++++++++++++ include/dt-bindings/clock/boston-clock.h

| 14 +++++++++++ 2 files changed, 41 insertions(+)

 create mode 100644

Documentation/devicetree/bindings/clock/img,boston-clock.txt create mode
100644 include/dt-bindings/clock/boston-clock.h

diff --git a/Documentation/devicetree/bindings/clock/img,boston-clock.txt b/Documentation/devicetree/bindings/clock/img,boston-clock.txt new file mode 100644
index 0000000..c01ea60

Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +10 -0
@@ -0,0 +1,27 @@
+Binding for Imagination Technologies MIPS Boston clock sources.
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : Should be "img,boston-clock".
+- #clock-cells : Should be set to 1.
+  Values available for clock consumers can be found in the header

file:

Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +3 -0
+    <dt-bindings/clock/boston-clock.h>
+- regmap : Phandle to the Boston platform register system controller.
+  This should contain a phandle to the system controller node covering
Quoted 2 lines

the
+ platform registers provided by the Boston board.

Can you just make the clock node a child of the system controller and drop this?

Quoted 1 line

Rob

Quoted 8 lines

Hi Rob,

(Apologies to anyone who received my last; my mail client seems to be misconfigured & previously sent HTML mail.)

As I mentioned before technically that could be done, but it would really not be at all reflective of the hardware & so seems somewhat contrary to the purpose of a device tree.

Given that you need a reference back to the system controller, it does match the h/w. The system controller h/w contains various functions, therefore the system controller node should contain nodes for those functions (or the sys ctrlr itself could be the clock provider node with no child nodes). Otherwise, what is the parent of the clock node? Root? Root should generally be the top level devices of the SoC, though it gets used for things which have no good parent.

Quoted 1 line

Rob

Hi Rob,

The "system controller" here is a bunch of registers which contain information about the system - nothing more & nothing less. There are a few random bits of functionality such as system level reset exposed through them, but things like clocks are not part of some coherent block of hardware known as the system controller. The register exposing information about the clocks has no actual connection to the clocks at all - it's just a dumb register whose value is filled in by whomever generates the FPGA bitfile. I don't see how that can be reasonably seen as the clocks being a child of this ecclectic bunch of registers.

Perhaps the use of syscon has been misleading here? I'm using the syscon code purely as a nice way to obtain a regmap to that bunch of registers. Please believe me when I say I know this hardware well enough to know that there isn't a coherent block of system controller hardware that provides the clocks here.

Thanks,
Paul

#22 lore raw

Re: [PATCH v3 16/18] dt-bindings: Document img,boston-clock binding

Quoted 85 lines · Paul Burton
Quoted 1 line · On Tuesday, 11 October 2016 15:06:46 BST Rob Herring wrote:

On Tue, Oct 11, 2016 at 11:00 AM, Paul Burton <[email protected]>

Quoted 78 lines · wrote:
Quoted 61 lines · On Monday, 10 October 2016 08:01:21 BST Rob Herring wrote:
Quoted 58 lines · Paul Burton
Quoted 51 lines

Add device tree binding documentation for the clocks provided by the MIPS Boston development board from Imagination Technologies, and a header file describing the available clocks for use by device trees & driver.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Changes in v3: None
Changes in v2:
- Add BOSTON_CLK_INPUT to expose the input clock.

 .../devicetree/bindings/clock/img,boston-clock.txt | 27

++++++++++++++++++++++ include/dt-bindings/clock/boston-clock.h

| 14 +++++++++++ 2 files changed, 41 insertions(+)

 create mode 100644

Documentation/devicetree/bindings/clock/img,boston-clock.txt create mode
100644 include/dt-bindings/clock/boston-clock.h

diff --git a/Documentation/devicetree/bindings/clock/img,boston-clock.txt b/Documentation/devicetree/bindings/clock/img,boston-clock.txt new file mode 100644
index 0000000..c01ea60

Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +10 -0
@@ -0,0 +1,27 @@
+Binding for Imagination Technologies MIPS Boston clock sources.
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : Should be "img,boston-clock".
+- #clock-cells : Should be set to 1.
+  Values available for clock consumers can be found in the header

file:

Documentation/devicetree/bindings/clock/img,boston-clock.txt new file +3 -0
+    <dt-bindings/clock/boston-clock.h>
+- regmap : Phandle to the Boston platform register system controller.
+  This should contain a phandle to the system controller node covering
Quoted 2 lines

the
+ platform registers provided by the Boston board.

Can you just make the clock node a child of the system controller and drop this?

Quoted 1 line

Rob

Quoted 8 lines

Hi Rob,

(Apologies to anyone who received my last; my mail client seems to be misconfigured & previously sent HTML mail.)

As I mentioned before technically that could be done, but it would really not be at all reflective of the hardware & so seems somewhat contrary to the purpose of a device tree.

Given that you need a reference back to the system controller, it does match the h/w. The system controller h/w contains various functions, therefore the system controller node should contain nodes for those functions (or the sys ctrlr itself could be the clock provider node with no child nodes). Otherwise, what is the parent of the clock node? Root? Root should generally be the top level devices of the SoC, though it gets used for things which have no good parent.

Quoted 1 line

Rob

Hi Rob,

Quoted 7 lines

The "system controller" here is a bunch of registers which contain information about the system - nothing more & nothing less. There are a few random bits of functionality such as system level reset exposed through them, but things like clocks are not part of some coherent block of hardware known as the system controller. The register exposing information about the clocks has no actual connection to the clocks at all - it's just a dumb register whose value is filled in by whomever generates the FPGA bitfile.

This sounds pretty much how every clk controller or syscon/mfd is made. A dumb register set that controls a bunch of hard macros placed by hardware designers. It just so happens that there are other things in this register set that aren't clk controls.

Quoted 3 lines

I don't see how that can be
reasonably seen as the clocks being a child of this ecclectic bunch of registers.

Can you further describe what being a child device means to you? There must be some reason why a child device is wrong from your perspective that isn't coming across here.

Quoted 7 lines

Perhaps the use of syscon has been misleading here? I'm using the syscon code purely as a nice way to obtain a regmap to that bunch of registers. Please believe me when I say I know this hardware well enough to know that there isn't a coherent block of system controller hardware that provides the clocks here.

The problem I have, from a DT perspective, is that the clks are not on the board. Clks that live on the board go to the root of the DT tree under / or some container clks node. In this case the clks are in the SoC, so they should go into the SoC node, not the root. But the SoC node should have a reg property for each child node, and this node wouldn't have a reg property because it uses a regmap, so from a DT perspective that's also the wrong place to put this node.

Therefore, the best solution is to make the clk controller node a child of the syscon, and then the reg property doesn't exist in the clk controller node. This also nicely removes any linuxism of needing to have a regmap property (regmap is not really a hardware concept and is fairly linux specific) because we can grab the regmap handle from the parent device/node.

Technically having the child node for the clk controller part is abusing DT. We should really only have one node for the syscon, which probes a driver that then creates platform devices in software to match up with other drivers for the specific functions that are accessible through the dumb register set. But since we have MFD/syscons quite often, and things get sort of messy when all these different things are going on within one node and thus one big driver, we allow MFDs to be described in DT with sub-nodes that are for the sub-functions so that we can have drivers match up appropriately. Otherwise we're left with a big driver for the MFD that becomes sort of like a board file to register sub devices, or a mash up of all these different functions that use one struct device.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project