Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1458670 > unrolled thread
| Started by | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| First post | 2016-08-09 14:40 +0200 |
| Last post | 2016-08-09 14:50 +0200 |
| Articles | 20 on this page of 25 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH 00/20] MIPS: SEAD3 device tree conversion Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 02/20] MIPS: SEAD3: Probe interrupt controllers using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 02/20] MIPS: SEAD3: Probe interrupt controllers using DT kbuild test robot <lkp@intel.com> - 2016-08-10 20:30 +0200
[PATCH 12/20] MIPS: SEAD3: Reset via generic syscon-reboot driver & DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 01/20] MIPS: SEAD3: Split obj-y entries across lines Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 07/20] MIPS: SEAD3: Probe EHCI controller using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 05/20] MIPS: SEAD3: Probe ethernet controller using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 14/20] MIPS: SEAD3: Parse memsize in DT shim Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree Jonas Gorski <jonas.gorski@gmail.com> - 2016-08-09 16:10 +0200
[PATCH 11/20] leds: Remove SEAD3 driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 08/20] usb: host: ehci-sead3: Remove non-DT probe code Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 08/20] usb: host: ehci-sead3: Remove non-DT probe code Alan Stern <stern@rowland.harvard.edu> - 2016-08-09 16:30 +0200
[PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT kbuild test robot <lkp@intel.com> - 2016-08-10 20:30 +0200
Re: [PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT kbuild test robot <lkp@intel.com> - 2016-08-10 21:40 +0200
[PATCH 04/20] MIPS: SEAD3: Use generic ns16550a earlycon support Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 13/20] MIPS: SEAD3: Use generic restart-poweroff driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 15/20] MIPS: SEAD3: Drop use of cobalt fbdev driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 19/20] MIPS: SEAD3: Use img-ascii-lcd driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 17/20] dt-bindings: img-ascii-lcd: Document a binding for simple ASCII LCDs Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 16/20] fbdev: cobalt_lcdfb: Drop SEAD3 support Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
Re: [PATCH 16/20] fbdev: cobalt_lcdfb: Drop SEAD3 support Tomi Valkeinen <tomi.valkeinen@ti.com> - 2016-08-10 20:50 +0200
[PATCH 20/20] MIPS: SEAD3: Remove custom read_persistent_clock Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 18/20] auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
Page 1 of 2 [1] 2 Next page →
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 00/20] MIPS: SEAD3 device tree conversion |
| Message-ID | <s4eu6-7y7-3@gated-at.bofh.it> |
Although the SEAD3 board has already made some minimal use of device tree, until now most peripherals have been left probed by platform code. This series converts all SEAD3 peripherals to instead be probed from device tree. The amount of platform code is significantly reduced leaving SEAD3 primed & ready for a wider task of genericising the kernel. Applies atop v4.8-rc1. Paul Burton (20): MIPS: SEAD3: Split obj-y entries across lines MIPS: SEAD3: Probe interrupt controllers using DT MIPS: SEAD3: Probe UARTs using DT MIPS: SEAD3: Use generic ns16550a earlycon support MIPS: SEAD3: Probe ethernet controller using DT usb: host: ehci-sead3: Support probing using device tree MIPS: SEAD3: Probe EHCI controller using DT usb: host: ehci-sead3: Remove non-DT probe code SEAD3: Probe parallel flash via DT MIPS: SEAD3: Use register-bit-led driver via DT for LEDs leds: Remove SEAD3 driver MIPS: SEAD3: Reset via generic syscon-reboot driver & DT MIPS: SEAD3: Use generic restart-poweroff driver MIPS: SEAD3: Parse memsize in DT shim MIPS: SEAD3: Drop use of cobalt fbdev driver fbdev: cobalt_lcdfb: Drop SEAD3 support dt-bindings: img-ascii-lcd: Document a binding for simple ASCII LCDs auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays MIPS: SEAD3: Use img-ascii-lcd driver MIPS: SEAD3: Remove custom read_persistent_clock .../bindings/auxdisplay/img-ascii-lcd.txt | 17 + MAINTAINERS | 6 + arch/mips/Kconfig | 1 - arch/mips/boot/dts/mti/sead3.dts | 228 +++++++++++ arch/mips/configs/sead3_defconfig | 8 + arch/mips/include/asm/mach-sead3/sead3-dtshim.h | 29 ++ arch/mips/include/asm/mips-boards/sead3int.h | 32 -- arch/mips/mti-sead3/Makefile | 10 +- arch/mips/mti-sead3/sead3-console.c | 46 --- arch/mips/mti-sead3/sead3-display.c | 77 ---- arch/mips/mti-sead3/sead3-dtshim.c | 291 ++++++++++++++ arch/mips/mti-sead3/sead3-init.c | 52 --- arch/mips/mti-sead3/sead3-int.c | 27 +- arch/mips/mti-sead3/sead3-lcd.c | 43 -- arch/mips/mti-sead3/sead3-platform.c | 223 ----------- arch/mips/mti-sead3/sead3-reset.c | 40 -- arch/mips/mti-sead3/sead3-setup.c | 77 +--- arch/mips/mti-sead3/sead3-time.c | 8 - drivers/auxdisplay/Kconfig | 9 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/img-ascii-lcd.c | 443 +++++++++++++++++++++ drivers/leds/Kconfig | 10 - drivers/leds/Makefile | 1 - drivers/leds/leds-sead3.c | 78 ---- drivers/usb/host/ehci-sead3.c | 21 +- drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/cobalt_lcdfb.c | 42 -- 27 files changed, 1061 insertions(+), 761 deletions(-) create mode 100644 Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt create mode 100644 arch/mips/include/asm/mach-sead3/sead3-dtshim.h delete mode 100644 arch/mips/include/asm/mips-boards/sead3int.h delete mode 100644 arch/mips/mti-sead3/sead3-console.c delete mode 100644 arch/mips/mti-sead3/sead3-display.c create mode 100644 arch/mips/mti-sead3/sead3-dtshim.c delete mode 100644 arch/mips/mti-sead3/sead3-lcd.c delete mode 100644 arch/mips/mti-sead3/sead3-platform.c delete mode 100644 arch/mips/mti-sead3/sead3-reset.c create mode 100644 drivers/auxdisplay/img-ascii-lcd.c delete mode 100644 drivers/leds/leds-sead3.c -- 2.9.2
[toc] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 02/20] MIPS: SEAD3: Probe interrupt controllers using DT |
| Message-ID | <s4eu6-7y7-17@gated-at.bofh.it> |
| In reply to | #1458670 |
Probe the CPU interrupt controller & optional Global Interrupt
Controller (GIC) using devicetree rather than platform code. Because the
bootloader on SEAD3 does not provide a device tree to the kernel & the
device tree is always built in, we patch out the GIC node during boot if
we detect that a GIC is not present in the system.
The appropriate IRQ domain is discovered by platform code setting up
device IRQ numbers temporarily. It will be removed by further patches
which move the devices towards being probed via device tree.
No behavioural change is intended by this patch.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/boot/dts/mti/sead3.dts | 31 +++++++++
arch/mips/include/asm/mach-sead3/sead3-dtshim.h | 29 ++++++++
arch/mips/include/asm/mips-boards/sead3int.h | 5 --
arch/mips/mti-sead3/Makefile | 1 +
arch/mips/mti-sead3/sead3-dtshim.c | 91 +++++++++++++++++++++++++
arch/mips/mti-sead3/sead3-int.c | 27 ++------
arch/mips/mti-sead3/sead3-platform.c | 43 +++++++++---
arch/mips/mti-sead3/sead3-setup.c | 13 ++--
8 files changed, 196 insertions(+), 44 deletions(-)
create mode 100644 arch/mips/include/asm/mach-sead3/sead3-dtshim.h
create mode 100644 arch/mips/mti-sead3/sead3-dtshim.c
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index e4b317d..051b3a9 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -4,10 +4,13 @@
/memreserve/ 0x00001000 0x000ef000; // ROM data
/memreserve/ 0x000f0000 0x004cc000; // reserved
+#include <dt-bindings/interrupt-controller/mips-gic.h>
+
/ {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mti,sead-3";
+ interrupt-parent = <&gic>;
cpus {
cpu@0 {
@@ -19,4 +22,32 @@
device_type = "memory";
reg = <0x0 0x08000000>;
};
+
+ cpu_intc: interrupt-controller {
+ compatible = "mti,cpu-interrupt-controller";
+
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+
+ gic: interrupt-controller@1b1c0000 {
+ compatible = "mti,gic";
+ reg = <0x1b1c0000 0x20000>;
+
+ interrupt-controller;
+ #interrupt-cells = <3>;
+
+ /*
+ * Declare the interrupt-parent even though the mti,gic
+ * binding doesn't require it, such that the kernel can
+ * figure out that cpu_intc is the root interrupt
+ * controller & should be probed first.
+ */
+ interrupt-parent = <&cpu_intc>;
+
+ timer {
+ compatible = "mti,gic-timer";
+ interrupts = <GIC_LOCAL 1 IRQ_TYPE_NONE>;
+ };
+ };
};
diff --git a/arch/mips/include/asm/mach-sead3/sead3-dtshim.h b/arch/mips/include/asm/mach-sead3/sead3-dtshim.h
new file mode 100644
index 0000000..f5d7d9c
--- /dev/null
+++ b/arch/mips/include/asm/mach-sead3/sead3-dtshim.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 Imagination Technologies
+ * Author: Paul Burton <paul.burton@imgtec.com>
+ *
+ * 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__ */
diff --git a/arch/mips/include/asm/mips-boards/sead3int.h b/arch/mips/include/asm/mips-boards/sead3int.h
index 8932c7d..bd85da3 100644
--- a/arch/mips/include/asm/mips-boards/sead3int.h
+++ b/arch/mips/include/asm/mips-boards/sead3int.h
@@ -12,12 +12,7 @@
#include <linux/irqchip/mips-gic.h>
-/* SEAD-3 GIC address space definitions. */
-#define GIC_BASE_ADDR 0x1b1c0000
-#define GIC_ADDRSPACE_SZ (128 * 1024)
-
/* CPU interrupt offsets */
-#define CPU_INT_GIC 2
#define CPU_INT_EHCI 2
#define CPU_INT_UART0 4
#define CPU_INT_UART1 4
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index 8b03cfb..aad67aa 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -10,6 +10,7 @@
#
obj-y := sead3-lcd.o
obj-y += sead3-display.o
+obj-y += sead3-dtshim.o
obj-y += sead3-init.o
obj-y += sead3-int.o
obj-y += sead3-platform.o
diff --git a/arch/mips/mti-sead3/sead3-dtshim.c b/arch/mips/mti-sead3/sead3-dtshim.c
new file mode 100644
index 0000000..1592d07
--- /dev/null
+++ b/arch/mips/mti-sead3/sead3-dtshim.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 Imagination Technologies
+ * Author: Paul Burton <paul.burton@imgtec.com>
+ *
+ * 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.
+ */
+
+#define pr_fmt(fmt) "sead3-dtshim: " fmt
+
+#include <linux/libfdt.h>
+#include <linux/printk.h>
+
+#include <asm/io.h>
+
+#define SEAD_CONFIG CKSEG1ADDR(0x1b100110)
+#define SEAD_CONFIG_GIC_PRESENT BIT(1)
+
+static unsigned char fdt_buf[16 << 10] __initdata;
+
+static int remove_gic(void *fdt)
+{
+ int gic_off, cpu_off, err;
+ uint32_t cfg, cpu_phandle;
+
+ /* leave the GIC node intact if a GIC is present */
+ cfg = __raw_readl((uint32_t *)SEAD_CONFIG);
+ if (cfg & SEAD_CONFIG_GIC_PRESENT)
+ return 0;
+
+ gic_off = fdt_node_offset_by_compatible(fdt, -1, "mti,gic");
+ if (gic_off < 0) {
+ pr_err("unable to find DT GIC node: %d\n", gic_off);
+ return gic_off;
+ }
+
+ err = fdt_nop_node(fdt, gic_off);
+ if (err) {
+ pr_err("unable to nop GIC node\n");
+ return err;
+ }
+
+ cpu_off = fdt_node_offset_by_compatible(fdt, -1,
+ "mti,cpu-interrupt-controller");
+ if (cpu_off < 0) {
+ pr_err("unable to find CPU intc node: %d\n", cpu_off);
+ return cpu_off;
+ }
+
+ cpu_phandle = fdt_get_phandle(fdt, cpu_off);
+ if (!cpu_phandle) {
+ pr_err("unable to get CPU intc phandle\n");
+ return -EINVAL;
+ }
+
+ err = fdt_setprop_u32(fdt, 0, "interrupt-parent", cpu_phandle);
+ if (err) {
+ pr_err("unable to set root interrupt-parent: %d\n", err);
+ return err;
+ }
+
+ return 0;
+}
+
+void __init *sead3_dt_shim(void *fdt)
+{
+ int err;
+
+ if (fdt_check_header(fdt))
+ panic("Corrupt DT");
+
+ /* if this isn't SEAD3, leave the DT alone */
+ if (fdt_node_check_compatible(fdt, 0, "mti,sead-3"))
+ return fdt;
+
+ err = fdt_open_into(fdt, fdt_buf, sizeof(fdt_buf));
+ if (err)
+ panic("Unable to open FDT: %d", err);
+
+ err = remove_gic(fdt_buf);
+ if (err)
+ panic("Unable to patch FDT: %d", err);
+
+ err = fdt_pack(fdt_buf);
+ if (err)
+ panic("Unable to pack FDT: %d\n", err);
+
+ return fdt_buf;
+}
diff --git a/arch/mips/mti-sead3/sead3-int.c b/arch/mips/mti-sead3/sead3-int.c
index e31e17f..2e6b732 100644
--- a/arch/mips/mti-sead3/sead3-int.c
+++ b/arch/mips/mti-sead3/sead3-int.c
@@ -6,37 +6,18 @@
* Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
*/
#include <linux/init.h>
-#include <linux/irq.h>
+#include <linux/irqchip.h>
#include <linux/irqchip/mips-gic.h>
-#include <linux/io.h>
-#include <asm/irq_cpu.h>
-#include <asm/setup.h>
-
-#include <asm/mips-boards/sead3int.h>
-
-#define SEAD_CONFIG_GIC_PRESENT_SHF 1
-#define SEAD_CONFIG_GIC_PRESENT_MSK (1 << SEAD_CONFIG_GIC_PRESENT_SHF)
-#define SEAD_CONFIG_BASE 0x1b100110
-#define SEAD_CONFIG_SIZE 4
-
-static void __iomem *sead3_config_reg;
+#include <asm/cpu-info.h>
+#include <asm/irq.h>
void __init arch_init_irq(void)
{
- if (!cpu_has_veic)
- mips_cpu_irq_init();
+ irqchip_init();
- sead3_config_reg = ioremap_nocache(SEAD_CONFIG_BASE, SEAD_CONFIG_SIZE);
- gic_present = (__raw_readl(sead3_config_reg) &
- SEAD_CONFIG_GIC_PRESENT_MSK) >>
- SEAD_CONFIG_GIC_PRESENT_SHF;
pr_info("GIC: %spresent\n", (gic_present) ? "" : "not ");
pr_info("EIC: %s\n",
(current_cpu_data.options & MIPS_CPU_VEIC) ? "on" : "off");
-
- if (gic_present)
- gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, CPU_INT_GIC,
- MIPS_GIC_IRQ_BASE);
}
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
index 73b73ef..12cf905 100644
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ b/arch/mips/mti-sead3/sead3-platform.c
@@ -9,8 +9,10 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/irqchip/mips-gic.h>
+#include <linux/irqdomain.h>
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
#include <linux/smsc911x.h>
@@ -204,16 +206,41 @@ static struct platform_device *sead3_platform_devices[] __initdata = {
static int __init sead3_platforms_device_init(void)
{
+ const char *intc_compat;
+ struct device_node *node;
+ struct irq_domain *irqd;
+
+ if (gic_present)
+ intc_compat = "mti,gic"
+ else
+ intc_compat = "mti,cpu-interrupt-controller";
+
+ node = of_find_compatible_node(NULL, NULL, intc_compat);
+ if (!node) {
+ pr_err("unable to find interrupt controller DT node\n");
+ return -ENODEV;
+ }
+
+ irqd = irq_find_host(node);
+ if (!irqd) {
+ pr_err("unable to find interrupt controller IRQ domain\n");
+ return -ENODEV;
+ }
+
if (gic_present) {
- uart8250_data[0].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART0;
- uart8250_data[1].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART1;
- ehci_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_EHCI;
- sead3_net_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_NET;
+ uart8250_data[0].irq = irq_create_mapping(irqd, GIC_INT_UART0);
+ uart8250_data[1].irq = irq_create_mapping(irqd, GIC_INT_UART1);
+ ehci_resources[1].start =
+ irq_create_mapping(irqd, GIC_INT_EHCI);
+ sead3_net_resources[1].start =
+ irq_create_mapping(irqd, GIC_INT_NET);
} else {
- uart8250_data[0].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART0;
- uart8250_data[1].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART1;
- ehci_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_EHCI;
- sead3_net_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_NET;
+ uart8250_data[0].irq = irq_create_mapping(irqd, CPU_INT_UART0);
+ uart8250_data[1].irq = irq_create_mapping(irqd, CPU_INT_UART1);
+ ehci_resources[1].start =
+ irq_create_mapping(irqd, CPU_INT_EHCI);
+ sead3_net_resources[1].start =
+ irq_create_mapping(irqd, CPU_INT_NET);
}
return platform_add_devices(sead3_platform_devices,
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index edfcaf0..c4fc0c6 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -13,6 +13,7 @@
#include <asm/prom.h>
#include <asm/fw/fw.h>
+#include <asm/mach-sead3/sead3-dtshim.h>
#include <asm/mips-boards/generic.h>
const char *get_system_type(void)
@@ -89,20 +90,16 @@ void __init *plat_get_fdt(void)
void __init plat_mem_setup(void)
{
+ void *fdt = plat_get_fdt();
+
/* allow command line/bootloader env to override memory size in DT */
parse_memsize_param();
- /*
- * Load the builtin devicetree. This causes the chosen node to be
- * parsed resulting in our memory appearing
- */
- __dt_setup_arch(__dtb_start);
+ fdt = sead3_dt_shim(fdt);
+ __dt_setup_arch(fdt);
}
void __init device_tree_init(void)
{
- if (!initial_boot_params)
- return;
-
unflatten_and_copy_device_tree();
}
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-08-10 20:30 +0200 |
| Subject | Re: [PATCH 02/20] MIPS: SEAD3: Probe interrupt controllers using DT |
| Message-ID | <s4Gqm-b4-17@gated-at.bofh.it> |
| In reply to | #1458671 |
[Multipart message — attachments visible in raw view] — view raw
Hi Paul,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc1 next-20160809]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Paul-Burton/MIPS-SEAD3-device-tree-conversion/20160809-204707
config: mips-sead3_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
All errors (new ones prefixed by >>):
arch/mips/mti-sead3/sead3-dtshim.c: In function 'remove_gic':
>> arch/mips/mti-sead3/sead3-dtshim.c:55:11: error: 'EINVAL' undeclared (first use in this function)
return -EINVAL;
^
arch/mips/mti-sead3/sead3-dtshim.c:55:11: note: each undeclared identifier is reported only once for each function it appears in
--
arch/mips/mti-sead3/sead3-platform.c: In function 'sead3_platforms_device_init':
>> arch/mips/mti-sead3/sead3-platform.c:215:2: error: expected ';' before 'else'
else
^
vim +/EINVAL +55 arch/mips/mti-sead3/sead3-dtshim.c
49 return cpu_off;
50 }
51
52 cpu_phandle = fdt_get_phandle(fdt, cpu_off);
53 if (!cpu_phandle) {
54 pr_err("unable to get CPU intc phandle\n");
> 55 return -EINVAL;
56 }
57
58 err = fdt_setprop_u32(fdt, 0, "interrupt-parent", cpu_phandle);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 12/20] MIPS: SEAD3: Reset via generic syscon-reboot driver & DT |
| Message-ID | <s4eu6-7y7-31@gated-at.bofh.it> |
| In reply to | #1458670 |
Remove the SEAD3 implementation of _machine_restart & instead make use
of the generic syscon-reboot driver probed via device tree.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/boot/dts/mti/sead3.dts | 12 ++++++++++++
arch/mips/configs/sead3_defconfig | 3 ++-
arch/mips/mti-sead3/sead3-reset.c | 9 ---------
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index 563e2636..d661012 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -84,6 +84,18 @@
};
};
+ fpga_regs: system-controller@1f000000 {
+ compatible = "mti,sead3-fpga", "syscon", "simple-mfd";
+ reg = <0x1f000000 0x200>;
+
+ reboot {
+ compatible = "syscon-reboot";
+ regmap = <&fpga_regs>;
+ offset = <0x50>;
+ mask = <0x4d>;
+ };
+ };
+
system-controller@1f000200 {
compatible = "mti,sead3-cpld", "syscon", "simple-mfd";
reg = <0x1f000200 0x300>;
diff --git a/arch/mips/configs/sead3_defconfig b/arch/mips/configs/sead3_defconfig
index e1c6582..055af30 100644
--- a/arch/mips/configs/sead3_defconfig
+++ b/arch/mips/configs/sead3_defconfig
@@ -80,8 +80,9 @@ CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_HELPER_AUTO is not set
CONFIG_SPI=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_SYSCON=y
CONFIG_SENSORS_ADT7475=y
-CONFIG_MFD_SYSCON=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_LCD_CLASS_DEVICE=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
diff --git a/arch/mips/mti-sead3/sead3-reset.c b/arch/mips/mti-sead3/sead3-reset.c
index e6fb244..8f548f0 100644
--- a/arch/mips/mti-sead3/sead3-reset.c
+++ b/arch/mips/mti-sead3/sead3-reset.c
@@ -13,14 +13,6 @@
#define SOFTRES_REG 0x1f000050
#define GORESET 0x4d
-static void mips_machine_restart(char *command)
-{
- unsigned int __iomem *softres_reg =
- ioremap(SOFTRES_REG, sizeof(unsigned int));
-
- __raw_writel(GORESET, softres_reg);
-}
-
static void mips_machine_halt(void)
{
unsigned int __iomem *softres_reg =
@@ -31,7 +23,6 @@ static void mips_machine_halt(void)
static int __init mips_reboot_setup(void)
{
- _machine_restart = mips_machine_restart;
_machine_halt = mips_machine_halt;
pm_power_off = mips_machine_halt;
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 01/20] MIPS: SEAD3: Split obj-y entries across lines |
| Message-ID | <s4eu6-7y7-29@gated-at.bofh.it> |
| In reply to | #1458670 |
Split the obj-y entries for SEAD3 onto a line each, so that they're more independent & can be modified more clearly by later commits. Signed-off-by: Paul Burton <paul.burton@imgtec.com> --- arch/mips/mti-sead3/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile index 7a584e0..8b03cfb 100644 --- a/arch/mips/mti-sead3/Makefile +++ b/arch/mips/mti-sead3/Makefile @@ -8,8 +8,13 @@ # Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved. # Steven J. Hill <sjhill@mips.com> # -obj-y := sead3-lcd.o sead3-display.o sead3-init.o \ - sead3-int.o sead3-platform.o sead3-reset.o \ - sead3-setup.o sead3-time.o +obj-y := sead3-lcd.o +obj-y += sead3-display.o +obj-y += sead3-init.o +obj-y += sead3-int.o +obj-y += sead3-platform.o +obj-y += sead3-reset.o +obj-y += sead3-setup.o +obj-y += sead3-time.o obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o -- 2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 07/20] MIPS: SEAD3: Probe EHCI controller using DT |
| Message-ID | <s4eu7-7y7-39@gated-at.bofh.it> |
| In reply to | #1458670 |
Probe the SEAD3 EHCI controller using device tree rather than platform
code, in order to reduce the amount of the latter.
Now that no devices probed from platform code require interrupts, remove
the retrieval of the IRQ domain & sead3int.h.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/boot/dts/mti/sead3.dts | 7 ++++
arch/mips/include/asm/mips-boards/sead3int.h | 21 ----------
arch/mips/mti-sead3/sead3-dtshim.c | 15 ++++++-
arch/mips/mti-sead3/sead3-platform.c | 59 ----------------------------
4 files changed, 21 insertions(+), 81 deletions(-)
delete mode 100644 arch/mips/include/asm/mips-boards/sead3int.h
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index 29ed194..66f7947 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -60,6 +60,13 @@
};
};
+ ehci@1b200000 {
+ compatible = "mti,sead3-ehci";
+ reg = <0x1b200000 0x1000>;
+
+ interrupts = <0>; /* GIC 0 or CPU 6 */
+ };
+
/* UART connected to FTDI & miniUSB socket */
uart0: uart@1f000900 {
compatible = "ns16550a";
diff --git a/arch/mips/include/asm/mips-boards/sead3int.h b/arch/mips/include/asm/mips-boards/sead3int.h
deleted file mode 100644
index 7fdb9d4..0000000
--- a/arch/mips/include/asm/mips-boards/sead3int.h
+++ /dev/null
@@ -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.
- *
- * Copyright (C) 2000,2012 MIPS Technologies, Inc. All rights reserved.
- * Douglas Leung <douglas@mips.com>
- * Steven J. Hill <sjhill@mips.com>
- */
-#ifndef _MIPS_SEAD3INT_H
-#define _MIPS_SEAD3INT_H
-
-#include <linux/irqchip/mips-gic.h>
-
-/* CPU interrupt offsets */
-#define CPU_INT_EHCI 2
-
-/* GIC interrupt offsets */
-#define GIC_INT_EHCI GIC_SHARED_TO_HWIRQ(5)
-
-#endif /* !(_MIPS_SEAD3INT_H) */
diff --git a/arch/mips/mti-sead3/sead3-dtshim.c b/arch/mips/mti-sead3/sead3-dtshim.c
index 50f3236..40f8e03 100644
--- a/arch/mips/mti-sead3/sead3-dtshim.c
+++ b/arch/mips/mti-sead3/sead3-dtshim.c
@@ -22,9 +22,10 @@ static unsigned char fdt_buf[16 << 10] __initdata;
static int remove_gic(void *fdt)
{
+ const unsigned int cpu_ehci_int = 2;
const unsigned int cpu_uart_int = 4;
const unsigned int cpu_eth_int = 6;
- int gic_off, cpu_off, uart_off, eth_off, err;
+ int gic_off, cpu_off, uart_off, eth_off, ehci_off, err;
uint32_t cfg, cpu_phandle;
/* leave the GIC node intact if a GIC is present */
@@ -93,6 +94,18 @@ static int remove_gic(void *fdt)
return err;
}
+ ehci_off = fdt_node_offset_by_compatible(fdt, -1, "mti,sead3-ehci");
+ if (ehci_off < 0) {
+ pr_err("unable to find EHCI DT node: %d\n", ehci_off);
+ return ehci_off;
+ }
+
+ err = fdt_setprop_u32(fdt, ehci_off, "interrupts", cpu_ehci_int);
+ if (err) {
+ pr_err("unable to set EHCI interrupts property: %d\n", err);
+ return err;
+ }
+
return 0;
}
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
index f79a890..21047b5 100644
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ b/arch/mips/mti-sead3/sead3-platform.c
@@ -7,16 +7,10 @@
*/
#include <linux/dma-mapping.h>
#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/irqchip/mips-gic.h>
-#include <linux/irqdomain.h>
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
-#include <linux/of.h>
#include <linux/platform_device.h>
-#include <asm/mips-boards/sead3int.h>
-
static struct mtd_partition sead3_mtd_partitions[] = {
{
.name = "User FS",
@@ -118,68 +112,15 @@ static struct platform_device sead3_led_device = {
.id = -1,
};
-static struct resource ehci_resources[] = {
- {
- .start = 0x1b200000,
- .end = 0x1b200fff,
- .flags = IORESOURCE_MEM
- }, {
- .flags = IORESOURCE_IRQ
- }
-};
-
-static u64 sead3_usbdev_dma_mask = DMA_BIT_MASK(32);
-
-static struct platform_device ehci_device = {
- .name = "sead3-ehci",
- .id = 0,
- .dev = {
- .dma_mask = &sead3_usbdev_dma_mask,
- .coherent_dma_mask = DMA_BIT_MASK(32)
- },
- .num_resources = ARRAY_SIZE(ehci_resources),
- .resource = ehci_resources
-};
-
static struct platform_device *sead3_platform_devices[] __initdata = {
&sead3_flash,
&pled_device,
&fled_device,
&sead3_led_device,
- &ehci_device,
};
static int __init sead3_platforms_device_init(void)
{
- const char *intc_compat;
- struct device_node *node;
- struct irq_domain *irqd;
-
- if (gic_present)
- intc_compat = "mti,gic"
- else
- intc_compat = "mti,cpu-interrupt-controller";
-
- node = of_find_compatible_node(NULL, NULL, intc_compat);
- if (!node) {
- pr_err("unable to find interrupt controller DT node\n");
- return -ENODEV;
- }
-
- irqd = irq_find_host(node);
- if (!irqd) {
- pr_err("unable to find interrupt controller IRQ domain\n");
- return -ENODEV;
- }
-
- if (gic_present) {
- ehci_resources[1].start =
- irq_create_mapping(irqd, GIC_INT_EHCI);
- } else {
- ehci_resources[1].start =
- irq_create_mapping(irqd, CPU_INT_EHCI);
- }
-
return platform_add_devices(sead3_platform_devices,
ARRAY_SIZE(sead3_platform_devices));
}
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 05/20] MIPS: SEAD3: Probe ethernet controller using DT |
| Message-ID | <s4eu7-7y7-41@gated-at.bofh.it> |
| In reply to | #1458670 |
Probe the smsc911x ethernet controller using device tree rather than
platform code, reducing the amount of the latter.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/boot/dts/mti/sead3.dts | 12 ++++++++++
arch/mips/include/asm/mips-boards/sead3int.h | 2 --
arch/mips/mti-sead3/sead3-dtshim.c | 15 ++++++++++++-
arch/mips/mti-sead3/sead3-platform.c | 33 ----------------------------
4 files changed, 26 insertions(+), 36 deletions(-)
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index 3f681c5..29ed194 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -87,4 +87,16 @@
no-loopback-test;
};
+
+ eth@1f010000 {
+ compatible = "smsc,lan9115";
+ reg = <0x1f010000 0x10000>;
+ reg-io-width = <4>;
+
+ interrupts = <0>; /* GIC 0 or CPU 6 */
+
+ phy-mode = "mii";
+ smsc,irq-push-pull;
+ smsc,save-mac-address;
+ };
};
diff --git a/arch/mips/include/asm/mips-boards/sead3int.h b/arch/mips/include/asm/mips-boards/sead3int.h
index 3a5e079..7fdb9d4 100644
--- a/arch/mips/include/asm/mips-boards/sead3int.h
+++ b/arch/mips/include/asm/mips-boards/sead3int.h
@@ -14,10 +14,8 @@
/* CPU interrupt offsets */
#define CPU_INT_EHCI 2
-#define CPU_INT_NET 6
/* GIC interrupt offsets */
-#define GIC_INT_NET GIC_SHARED_TO_HWIRQ(0)
#define GIC_INT_EHCI GIC_SHARED_TO_HWIRQ(5)
#endif /* !(_MIPS_SEAD3INT_H) */
diff --git a/arch/mips/mti-sead3/sead3-dtshim.c b/arch/mips/mti-sead3/sead3-dtshim.c
index 8314943..50f3236 100644
--- a/arch/mips/mti-sead3/sead3-dtshim.c
+++ b/arch/mips/mti-sead3/sead3-dtshim.c
@@ -23,7 +23,8 @@ static unsigned char fdt_buf[16 << 10] __initdata;
static int remove_gic(void *fdt)
{
const unsigned int cpu_uart_int = 4;
- int gic_off, cpu_off, uart_off, err;
+ const unsigned int cpu_eth_int = 6;
+ int gic_off, cpu_off, uart_off, eth_off, err;
uint32_t cfg, cpu_phandle;
/* leave the GIC node intact if a GIC is present */
@@ -80,6 +81,18 @@ static int remove_gic(void *fdt)
return uart_off;
}
+ eth_off = fdt_node_offset_by_compatible(fdt, -1, "smsc,lan9115");
+ if (eth_off < 0) {
+ pr_err("unable to find ethernet DT node: %d\n", eth_off);
+ return eth_off;
+ }
+
+ err = fdt_setprop_u32(fdt, eth_off, "interrupts", cpu_eth_int);
+ if (err) {
+ pr_err("unable to set ethernet interrupts property: %d\n", err);
+ return err;
+ }
+
return 0;
}
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
index e772a05..f79a890 100644
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ b/arch/mips/mti-sead3/sead3-platform.c
@@ -14,37 +14,9 @@
#include <linux/mtd/physmap.h>
#include <linux/of.h>
#include <linux/platform_device.h>
-#include <linux/smsc911x.h>
#include <asm/mips-boards/sead3int.h>
-static struct smsc911x_platform_config sead3_smsc911x_data = {
- .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
- .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
- .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
- .phy_interface = PHY_INTERFACE_MODE_MII,
-};
-
-static struct resource sead3_net_resources[] = {
- {
- .start = 0x1f010000,
- .end = 0x1f01ffff,
- .flags = IORESOURCE_MEM
- }, {
- .flags = IORESOURCE_IRQ
- }
-};
-
-static struct platform_device sead3_net_device = {
- .name = "smsc911x",
- .id = 0,
- .dev = {
- .platform_data = &sead3_smsc911x_data,
- },
- .num_resources = ARRAY_SIZE(sead3_net_resources),
- .resource = sead3_net_resources
-};
-
static struct mtd_partition sead3_mtd_partitions[] = {
{
.name = "User FS",
@@ -175,7 +147,6 @@ static struct platform_device *sead3_platform_devices[] __initdata = {
&fled_device,
&sead3_led_device,
&ehci_device,
- &sead3_net_device,
};
static int __init sead3_platforms_device_init(void)
@@ -204,13 +175,9 @@ static int __init sead3_platforms_device_init(void)
if (gic_present) {
ehci_resources[1].start =
irq_create_mapping(irqd, GIC_INT_EHCI);
- sead3_net_resources[1].start =
- irq_create_mapping(irqd, GIC_INT_NET);
} else {
ehci_resources[1].start =
irq_create_mapping(irqd, CPU_INT_EHCI);
- sead3_net_resources[1].start =
- irq_create_mapping(irqd, CPU_INT_NET);
}
return platform_add_devices(sead3_platform_devices,
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 14/20] MIPS: SEAD3: Parse memsize in DT shim |
| Message-ID | <s4eu6-7y7-35@gated-at.bofh.it> |
| In reply to | #1458670 |
Parse the memsize argument provided by the bootloader in the DT shim
code, allowing the user to override it on the command line. This places
all of the DT manipulation code into sead3-dtshim.c.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/mti-sead3/sead3-dtshim.c | 72 ++++++++++++++++++++++++++++++++++++++
arch/mips/mti-sead3/sead3-setup.c | 66 ----------------------------------
2 files changed, 72 insertions(+), 66 deletions(-)
diff --git a/arch/mips/mti-sead3/sead3-dtshim.c b/arch/mips/mti-sead3/sead3-dtshim.c
index 40f8e03..862fb73 100644
--- a/arch/mips/mti-sead3/sead3-dtshim.c
+++ b/arch/mips/mti-sead3/sead3-dtshim.c
@@ -13,6 +13,7 @@
#include <linux/libfdt.h>
#include <linux/printk.h>
+#include <asm/fw/fw.h>
#include <asm/io.h>
#define SEAD_CONFIG CKSEG1ADDR(0x1b100110)
@@ -20,6 +21,73 @@
static unsigned char fdt_buf[16 << 10] __initdata;
+static int append_memory(void *fdt)
+{
+ unsigned long phys_memsize, memsize;
+ __be32 mem_array[2];
+ int err, mem_off;
+ char *var;
+
+ /* find memory size from the bootloader environment */
+ var = fw_getenv("memsize");
+ if (var) {
+ err = kstrtoul(var, 0, &phys_memsize);
+ if (err) {
+ pr_err("Failed to read memsize env variable '%s'\n",
+ var);
+ return -EINVAL;
+ }
+ } else {
+ pr_warn("The bootloader didn't provide memsize: defaulting to 32MB\n");
+ phys_memsize = 32 << 20;
+ }
+
+ /* default to using all available RAM */
+ memsize = phys_memsize;
+
+ /* allow the user to override the usable memory */
+ var = strstr(arcs_cmdline, "memsize=");
+ if (var)
+ memsize = memparse(var + strlen("memsize="), NULL);
+
+ /* if the user says there's more RAM than we thought, believe them */
+ phys_memsize = max_t(unsigned long, phys_memsize, memsize);
+
+ /* find or add a memory node */
+ mem_off = fdt_path_offset(fdt, "/memory");
+ if (mem_off == -FDT_ERR_NOTFOUND)
+ mem_off = fdt_add_subnode(fdt, 0, "memory");
+ if (mem_off < 0) {
+ pr_err("Unable to find or add memory DT node: %d\n", mem_off);
+ return mem_off;
+ }
+
+ err = fdt_setprop_string(fdt, mem_off, "device_type", "memory");
+ if (err) {
+ pr_err("Unable to set memory node device_type: %d\n", err);
+ return err;
+ }
+
+ mem_array[0] = 0;
+ mem_array[1] = cpu_to_be32(phys_memsize);
+ err = fdt_setprop(fdt, mem_off, "reg", mem_array, sizeof(mem_array));
+ if (err) {
+ pr_err("Unable to set memory regs property: %d\n", err);
+ return err;
+ }
+
+ mem_array[0] = 0;
+ mem_array[1] = cpu_to_be32(memsize);
+ err = fdt_setprop(fdt, mem_off, "linux,usable-memory",
+ mem_array, sizeof(mem_array));
+ if (err) {
+ pr_err("Unable to set linux,usable-memory property: %d\n", err);
+ return err;
+ }
+
+ return 0;
+}
+
static int remove_gic(void *fdt)
{
const unsigned int cpu_ehci_int = 2;
@@ -203,6 +271,10 @@ void __init *sead3_dt_shim(void *fdt)
if (err)
panic("Unable to open FDT: %d", err);
+ err = append_memory(fdt_buf);
+ if (err)
+ panic("Unable to patch FDT: %d", err);
+
err = remove_gic(fdt_buf);
if (err)
panic("Unable to patch FDT: %d", err);
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index c4fc0c6..c915e54 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -11,7 +11,6 @@
#include <linux/of_fdt.h>
#include <asm/prom.h>
-#include <asm/fw/fw.h>
#include <asm/mach-sead3/sead3-dtshim.h>
#include <asm/mips-boards/generic.h>
@@ -21,68 +20,6 @@ const char *get_system_type(void)
return "MIPS SEAD3";
}
-static uint32_t get_memsize_from_cmdline(void)
-{
- int memsize = 0;
- char *p = arcs_cmdline;
- char *s = "memsize=";
-
- p = strstr(p, s);
- if (p) {
- p += strlen(s);
- memsize = memparse(p, NULL);
- }
-
- return memsize;
-}
-
-static uint32_t get_memsize_from_env(void)
-{
- int memsize = 0;
- char *p;
-
- p = fw_getenv("memsize");
- if (p)
- memsize = memparse(p, NULL);
-
- return memsize;
-}
-
-static uint32_t get_memsize(void)
-{
- uint32_t memsize;
-
- memsize = get_memsize_from_cmdline();
- if (memsize)
- return memsize;
-
- return get_memsize_from_env();
-}
-
-static void __init parse_memsize_param(void)
-{
- int offset;
- const uint64_t *prop_value;
- int prop_len;
- uint32_t memsize = get_memsize();
-
- if (!memsize)
- return;
-
- offset = fdt_path_offset(__dtb_start, "/memory");
- if (offset > 0) {
- uint64_t new_value;
- /*
- * reg contains 2 32-bits BE values, offset and size. We just
- * want to replace the size value without affecting the offset
- */
- prop_value = fdt_getprop(__dtb_start, offset, "reg", &prop_len);
- new_value = be64_to_cpu(*prop_value);
- new_value = (new_value & ~0xffffffffllu) | memsize;
- fdt_setprop_inplace_u64(__dtb_start, offset, "reg", new_value);
- }
-}
-
void __init *plat_get_fdt(void)
{
return (void *)__dtb_start;
@@ -92,9 +29,6 @@ void __init plat_mem_setup(void)
{
void *fdt = plat_get_fdt();
- /* allow command line/bootloader env to override memory size in DT */
- parse_memsize_param();
-
fdt = sead3_dt_shim(fdt);
__dt_setup_arch(fdt);
}
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree |
| Message-ID | <s4eu7-7y7-45@gated-at.bofh.it> |
| In reply to | #1458670 |
Introduce support for probing the SEAD3 EHCI driver using device tree.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
drivers/usb/host/ehci-sead3.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index 3d86cc2..05db1ae 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -20,6 +20,7 @@
*/
#include <linux/err.h>
+#include <linux/of_irq.h>
#include <linux/platform_device.h>
static int ehci_sead3_setup(struct usb_hcd *hcd)
@@ -96,15 +97,25 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
{
struct usb_hcd *hcd;
struct resource *res;
- int ret;
+ int ret, irq;
if (usb_disabled())
return -ENODEV;
- if (pdev->resource[1].flags != IORESOURCE_IRQ) {
- pr_debug("resource[1] is not IORESOURCE_IRQ");
- return -ENOMEM;
+ if (pdev->dev.of_node) {
+ irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ if (!irq) {
+ dev_err(&pdev->dev, "failed to map IRQ\n");
+ return -ENODEV;
+ }
+ } else {
+ if (pdev->resource[1].flags != IORESOURCE_IRQ) {
+ pr_debug("resource[1] is not IORESOURCE_IRQ");
+ return -ENOMEM;
+ }
+ irq = pdev->resource[1].start;
}
+
hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
if (!hcd)
return -ENOMEM;
@@ -121,8 +132,7 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
/* Root hub has integrated TT. */
hcd->has_tt = 1;
- ret = usb_add_hcd(hcd, pdev->resource[1].start,
- IRQF_SHARED);
+ ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (ret == 0) {
platform_set_drvdata(pdev, hcd);
device_wakeup_enable(hcd->self.controller);
@@ -172,12 +182,19 @@ static const struct dev_pm_ops sead3_ehci_pmops = {
#define SEAD3_EHCI_PMOPS NULL
#endif
+static const struct of_device_id sead3_ehci_of_match[] = {
+ { .compatible = "mti,sead3-ehci" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, sead3_ehci_of_match);
+
static struct platform_driver ehci_hcd_sead3_driver = {
.probe = ehci_hcd_sead3_drv_probe,
.remove = ehci_hcd_sead3_drv_remove,
.shutdown = usb_hcd_platform_shutdown,
.driver = {
.name = "sead3-ehci",
+ .of_match_table = sead3_ehci_of_match,
.pm = SEAD3_EHCI_PMOPS,
}
};
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Jonas Gorski <jonas.gorski@gmail.com> |
|---|---|
| Date | 2016-08-09 16:10 +0200 |
| Subject | Re: [PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree |
| Message-ID | <s4fTb-bN-9@gated-at.bofh.it> |
| In reply to | #1458680 |
Hi,
On 9 August 2016 at 14:35, Paul Burton <paul.burton@imgtec.com> wrote:
> Introduce support for probing the SEAD3 EHCI driver using device tree.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
>
> drivers/usb/host/ehci-sead3.c | 29 +++++++++++++++++++++++------
> 1 file changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
> index 3d86cc2..05db1ae 100644
> --- a/drivers/usb/host/ehci-sead3.c
> +++ b/drivers/usb/host/ehci-sead3.c
> @@ -20,6 +20,7 @@
> */
>
> #include <linux/err.h>
> +#include <linux/of_irq.h>
> #include <linux/platform_device.h>
>
> static int ehci_sead3_setup(struct usb_hcd *hcd)
> @@ -96,15 +97,25 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
> {
> struct usb_hcd *hcd;
> struct resource *res;
> - int ret;
> + int ret, irq;
>
> if (usb_disabled())
> return -ENODEV;
>
> - if (pdev->resource[1].flags != IORESOURCE_IRQ) {
> - pr_debug("resource[1] is not IORESOURCE_IRQ");
> - return -ENOMEM;
> + if (pdev->dev.of_node) {
> + irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
> + if (!irq) {
> + dev_err(&pdev->dev, "failed to map IRQ\n");
> + return -ENODEV;
> + }
> + } else {
> + if (pdev->resource[1].flags != IORESOURCE_IRQ) {
> + pr_debug("resource[1] is not IORESOURCE_IRQ");
> + return -ENOMEM;
> + }
> + irq = pdev->resource[1].start;
> }
> +
Why not just use platform_get_irq(pdev, 0) instead of this whole
block? Then you wouldn't need to care anymore whether resource 1 is
the IRQ resource (and avoid a potential overrun when the device has
only one resource), or if it is probed through of.
> hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
> if (!hcd)
> return -ENOMEM;
> @@ -121,8 +132,7 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
> /* Root hub has integrated TT. */
> hcd->has_tt = 1;
>
> - ret = usb_add_hcd(hcd, pdev->resource[1].start,
> - IRQF_SHARED);
> + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> if (ret == 0) {
> platform_set_drvdata(pdev, hcd);
> device_wakeup_enable(hcd->self.controller);
> @@ -172,12 +182,19 @@ static const struct dev_pm_ops sead3_ehci_pmops = {
> #define SEAD3_EHCI_PMOPS NULL
> #endif
>
> +static const struct of_device_id sead3_ehci_of_match[] = {
> + { .compatible = "mti,sead3-ehci" },
I don't see this compatible documented anywhere, please add binding
documentation for it first (and CC devicetree@vger ).
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, sead3_ehci_of_match);
> +
> static struct platform_driver ehci_hcd_sead3_driver = {
> .probe = ehci_hcd_sead3_drv_probe,
> .remove = ehci_hcd_sead3_drv_remove,
> .shutdown = usb_hcd_platform_shutdown,
> .driver = {
> .name = "sead3-ehci",
> + .of_match_table = sead3_ehci_of_match,
> .pm = SEAD3_EHCI_PMOPS,
> }
> };
Regards
Jonas
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 11/20] leds: Remove SEAD3 driver |
| Message-ID | <s4eu7-7y7-59@gated-at.bofh.it> |
| In reply to | #1458670 |
SEAD3 is now using the generic syscon & regmap based register-bit-led
driver, so remove the unused custom SEAD3 LED driver.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
drivers/leds/Kconfig | 10 ------
drivers/leds/Makefile | 1 -
drivers/leds/leds-sead3.c | 78 -----------------------------------------------
3 files changed, 89 deletions(-)
delete mode 100644 drivers/leds/leds-sead3.c
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 9dcc9b1..025de7e 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -574,16 +574,6 @@ config LEDS_KTD2692
Say Y to enable this driver.
-config LEDS_SEAD3
- tristate "LED support for the MIPS SEAD 3 board"
- depends on LEDS_CLASS && MIPS_SEAD3
- help
- Say Y here to include support for the FLED and PLED LEDs on SEAD3 eval
- boards.
-
- This driver can also be built as a module. If so the module
- will be called leds-sead3.
-
config LEDS_IS31FL32XX
tristate "LED support for ISSI IS31FL32XX I2C LED controller family"
depends on LEDS_CLASS && I2C && OF
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 0684c86..da594cf 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -66,7 +66,6 @@ obj-$(CONFIG_LEDS_VERSATILE) += leds-versatile.o
obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o
obj-$(CONFIG_LEDS_KTD2692) += leds-ktd2692.o
obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o
-obj-$(CONFIG_LEDS_SEAD3) += leds-sead3.o
obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
# LED SPI Drivers
diff --git a/drivers/leds/leds-sead3.c b/drivers/leds/leds-sead3.c
deleted file mode 100644
index eb97a32..0000000
--- a/drivers/leds/leds-sead3.c
+++ /dev/null
@@ -1,78 +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) 2015 Imagination Technologies, Inc.
- */
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/leds.h>
-#include <linux/err.h>
-#include <linux/io.h>
-
-#include <asm/mips-boards/sead3-addr.h>
-
-static void sead3_pled_set(struct led_classdev *led_cdev,
- enum led_brightness value)
-{
- writel(value, (void __iomem *)SEAD3_CPLD_P_LED);
-}
-
-static void sead3_fled_set(struct led_classdev *led_cdev,
- enum led_brightness value)
-{
- writel(value, (void __iomem *)SEAD3_CPLD_F_LED);
-}
-
-static struct led_classdev sead3_pled = {
- .name = "sead3::pled",
- .brightness_set = sead3_pled_set,
- .flags = LED_CORE_SUSPENDRESUME,
-};
-
-static struct led_classdev sead3_fled = {
- .name = "sead3::fled",
- .brightness_set = sead3_fled_set,
- .flags = LED_CORE_SUSPENDRESUME,
-};
-
-static int sead3_led_probe(struct platform_device *pdev)
-{
- int ret;
-
- ret = led_classdev_register(&pdev->dev, &sead3_pled);
- if (ret < 0)
- return ret;
-
- ret = led_classdev_register(&pdev->dev, &sead3_fled);
- if (ret < 0)
- led_classdev_unregister(&sead3_pled);
-
- return ret;
-}
-
-static int sead3_led_remove(struct platform_device *pdev)
-{
- led_classdev_unregister(&sead3_pled);
- led_classdev_unregister(&sead3_fled);
-
- return 0;
-}
-
-static struct platform_driver sead3_led_driver = {
- .probe = sead3_led_probe,
- .remove = sead3_led_remove,
- .driver = {
- .name = "sead3-led",
- },
-};
-
-module_platform_driver(sead3_led_driver);
-
-MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");
-MODULE_DESCRIPTION("SEAD3 LED driver");
-MODULE_LICENSE("GPL");
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 08/20] usb: host: ehci-sead3: Remove non-DT probe code |
| Message-ID | <s4eu7-7y7-51@gated-at.bofh.it> |
| In reply to | #1458670 |
Now that the SEAD3 board is probing the EHCI controller using device
tree, remove the non-DT support from the probe function.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
drivers/usb/host/ehci-sead3.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index 05db1ae..b88ecfe 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -102,18 +102,10 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
if (usb_disabled())
return -ENODEV;
- if (pdev->dev.of_node) {
- irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
- if (!irq) {
- dev_err(&pdev->dev, "failed to map IRQ\n");
- return -ENODEV;
- }
- } else {
- if (pdev->resource[1].flags != IORESOURCE_IRQ) {
- pr_debug("resource[1] is not IORESOURCE_IRQ");
- return -ENOMEM;
- }
- irq = pdev->resource[1].start;
+ irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ if (!irq) {
+ dev_err(&pdev->dev, "failed to map IRQ\n");
+ return -ENODEV;
}
hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Alan Stern <stern@rowland.harvard.edu> |
|---|---|
| Date | 2016-08-09 16:30 +0200 |
| Subject | Re: [PATCH 08/20] usb: host: ehci-sead3: Remove non-DT probe code |
| Message-ID | <s4gcy-je-7@gated-at.bofh.it> |
| In reply to | #1458682 |
On Tue, 9 Aug 2016, Paul Burton wrote:
> Now that the SEAD3 board is probing the EHCI controller using device
> tree, remove the non-DT support from the probe function.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
>
> drivers/usb/host/ehci-sead3.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
> index 05db1ae..b88ecfe 100644
> --- a/drivers/usb/host/ehci-sead3.c
> +++ b/drivers/usb/host/ehci-sead3.c
> @@ -102,18 +102,10 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
> if (usb_disabled())
> return -ENODEV;
>
> - if (pdev->dev.of_node) {
> - irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
> - if (!irq) {
> - dev_err(&pdev->dev, "failed to map IRQ\n");
> - return -ENODEV;
> - }
> - } else {
> - if (pdev->resource[1].flags != IORESOURCE_IRQ) {
> - pr_debug("resource[1] is not IORESOURCE_IRQ");
> - return -ENOMEM;
> - }
> - irq = pdev->resource[1].start;
> + irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
> + if (!irq) {
> + dev_err(&pdev->dev, "failed to map IRQ\n");
> + return -ENODEV;
> }
>
> hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
For both this patch and the 06/20 patch:
Acked-by: Alan Stern <stern@rowland.harvard.edu>
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT |
| Message-ID | <s4eu7-7y7-49@gated-at.bofh.it> |
| In reply to | #1458670 |
Probe the UARTs on SEAD3 boards using device tree rather than platform
code, in order to reduce the amount of the latter. This requires that
CONFIG_SERIAL_OF_PLATFORM be enabled, so enable it in sead3_defconfig.
The SEAD3 DT shim code is extended to read bootloader environment
variables to determine the appropriate UART & mode for kernel console
output & set the stdout-path property of the chosen node accordingly.
In contrast to the old platform code, which appears to have only ever
set "console=ttyS0,38400n8r" with the code in console_config never
having an effect, this will honor the "yamontty" environment variable to
select between the 2 UARTs on the board and then check the "modetty0" or
"modetty1" variable as appropriate to determine the UART configuration.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/boot/dts/mti/sead3.dts | 37 ++++++++++
arch/mips/configs/sead3_defconfig | 2 +
arch/mips/include/asm/mips-boards/sead3int.h | 4 --
arch/mips/mti-sead3/sead3-dtshim.c | 104 ++++++++++++++++++++++++++-
arch/mips/mti-sead3/sead3-init.c | 46 ------------
arch/mips/mti-sead3/sead3-platform.c | 30 --------
6 files changed, 142 insertions(+), 81 deletions(-)
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index 051b3a9..3f681c5 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -12,6 +12,15 @@
compatible = "mti,sead-3";
interrupt-parent = <&gic>;
+ chosen {
+ stdout-path = "uart1:115200";
+ };
+
+ aliases {
+ uart0 = &uart0;
+ uart1 = &uart1;
+ };
+
cpus {
cpu@0 {
compatible = "mti,mips14KEc", "mti,mips14Kc";
@@ -50,4 +59,32 @@
interrupts = <GIC_LOCAL 1 IRQ_TYPE_NONE>;
};
};
+
+ /* UART connected to FTDI & miniUSB socket */
+ uart0: uart@1f000900 {
+ compatible = "ns16550a";
+ reg = <0x1f000900 0x20>;
+ reg-io-width = <4>;
+ reg-shift = <2>;
+
+ clock-frequency = <14745600>;
+
+ interrupts = <3>; /* GIC 3 or CPU 4 */
+
+ no-loopback-test;
+ };
+
+ /* UART connected to RS232 socket */
+ uart1: uart@1f000800 {
+ compatible = "ns16550a";
+ reg = <0x1f000800 0x20>;
+ reg-io-width = <4>;
+ reg-shift = <2>;
+
+ clock-frequency = <14745600>;
+
+ interrupts = <2>; /* GIC 2 or CPU 4 */
+
+ no-loopback-test;
+ };
};
diff --git a/arch/mips/configs/sead3_defconfig b/arch/mips/configs/sead3_defconfig
index dae9354..deb48fb 100644
--- a/arch/mips/configs/sead3_defconfig
+++ b/arch/mips/configs/sead3_defconfig
@@ -39,6 +39,7 @@ CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_GLUEBI=y
+CONFIG_OF=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_CRYPTOLOOP=m
CONFIG_SCSI=y
@@ -70,6 +71,7 @@ CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=2
CONFIG_SERIAL_8250_RUNTIME_UARTS=2
+CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C=y
# CONFIG_I2C_COMPAT is not set
diff --git a/arch/mips/include/asm/mips-boards/sead3int.h b/arch/mips/include/asm/mips-boards/sead3int.h
index bd85da3..3a5e079 100644
--- a/arch/mips/include/asm/mips-boards/sead3int.h
+++ b/arch/mips/include/asm/mips-boards/sead3int.h
@@ -14,14 +14,10 @@
/* CPU interrupt offsets */
#define CPU_INT_EHCI 2
-#define CPU_INT_UART0 4
-#define CPU_INT_UART1 4
#define CPU_INT_NET 6
/* GIC interrupt offsets */
#define GIC_INT_NET GIC_SHARED_TO_HWIRQ(0)
-#define GIC_INT_UART1 GIC_SHARED_TO_HWIRQ(2)
-#define GIC_INT_UART0 GIC_SHARED_TO_HWIRQ(3)
#define GIC_INT_EHCI GIC_SHARED_TO_HWIRQ(5)
#endif /* !(_MIPS_SEAD3INT_H) */
diff --git a/arch/mips/mti-sead3/sead3-dtshim.c b/arch/mips/mti-sead3/sead3-dtshim.c
index 1592d07..8314943 100644
--- a/arch/mips/mti-sead3/sead3-dtshim.c
+++ b/arch/mips/mti-sead3/sead3-dtshim.c
@@ -22,7 +22,8 @@ static unsigned char fdt_buf[16 << 10] __initdata;
static int remove_gic(void *fdt)
{
- int gic_off, cpu_off, err;
+ const unsigned int cpu_uart_int = 4;
+ int gic_off, cpu_off, uart_off, err;
uint32_t cfg, cpu_phandle;
/* leave the GIC node intact if a GIC is present */
@@ -61,6 +62,103 @@ static int remove_gic(void *fdt)
return err;
}
+ uart_off = fdt_node_offset_by_compatible(fdt, -1, "ns16550a");
+ while (uart_off >= 0) {
+ err = fdt_setprop_u32(fdt, uart_off, "interrupts",
+ cpu_uart_int);
+ if (err) {
+ pr_err("unable to set UART interrupts property: %d\n",
+ err);
+ return err;
+ }
+
+ uart_off = fdt_node_offset_by_compatible(fdt, uart_off,
+ "ns16550a");
+ }
+ if (uart_off != -FDT_ERR_NOTFOUND) {
+ pr_err("error searching for UART DT node: %d\n", uart_off);
+ return uart_off;
+ }
+
+ return 0;
+}
+
+static int serial_config(void *fdt)
+{
+ const char *yamontty, *mode_var;
+ char mode_var_name[9], path[18], parity;
+ unsigned int uart, baud, stop_bits;
+ bool hw_flow;
+ int chosen_off, err;
+
+ yamontty = fw_getenv("yamontty");
+ if (!yamontty || !strcmp(yamontty, "tty0")) {
+ uart = 0;
+ } else if (!strcmp(yamontty, "tty1")) {
+ uart = 1;
+ } else {
+ pr_warn("yamontty environment variable '%s' invalid\n",
+ yamontty);
+ uart = 0;
+ }
+
+ baud = stop_bits = 0;
+ parity = 0;
+ hw_flow = false;
+
+ snprintf(mode_var_name, sizeof(mode_var_name), "modetty%u", uart);
+ mode_var = fw_getenv(mode_var_name);
+ if (mode_var) {
+ while (mode_var[0] >= '0' && mode_var[0] <= '9') {
+ baud *= 10;
+ baud += mode_var[0] - '0';
+ mode_var++;
+ }
+ if (mode_var[0] == ',')
+ mode_var++;
+ if (mode_var[0])
+ parity = mode_var[0];
+ if (mode_var[0] == ',')
+ mode_var++;
+ if (mode_var[0])
+ stop_bits = mode_var[0] - '0';
+ if (mode_var[0] == ',')
+ mode_var++;
+ if (!strcmp(mode_var, "hw"))
+ hw_flow = true;
+ }
+
+ if (!baud)
+ baud = 38400;
+
+ if (parity != 'e' && parity != 'n' && parity != 'o')
+ parity = 'n';
+
+ if (stop_bits != 7 && stop_bits != 8)
+ stop_bits = 8;
+
+ WARN_ON(snprintf(path, sizeof(path), "uart%u:%u%c%u%s",
+ uart, baud, parity, stop_bits,
+ hw_flow ? "r" : "") >= sizeof(path));
+
+ /* find or add chosen node */
+ chosen_off = fdt_path_offset(fdt, "/chosen");
+ if (chosen_off == -FDT_ERR_NOTFOUND)
+ chosen_off = fdt_path_offset(fdt, "/chosen@0");
+ if (chosen_off == -FDT_ERR_NOTFOUND)
+ chosen_off = fdt_add_subnode(fdt, 0, "chosen");
+ if (chosen_off < 0) {
+ pr_err("Unable to find or add DT chosen node: %d\n",
+ chosen_off);
+ return chosen_off;
+ }
+
+ err = fdt_setprop_string(fdt, chosen_off, "stdout-path", path);
+ if (err) {
+ pr_err("Unable to set stdout-path property: %d\n", err);
+ return err;
+ }
+
return 0;
}
@@ -83,6 +181,10 @@ void __init *sead3_dt_shim(void *fdt)
if (err)
panic("Unable to patch FDT: %d", err);
+ err = serial_config(fdt_buf);
+ if (err)
+ panic("Unable to patch FDT: %d", err);
+
err = fdt_pack(fdt_buf);
if (err)
panic("Unable to pack FDT: %d\n", err);
diff --git a/arch/mips/mti-sead3/sead3-init.c b/arch/mips/mti-sead3/sead3-init.c
index 3572ea3..e81f5b7 100644
--- a/arch/mips/mti-sead3/sead3-init.c
+++ b/arch/mips/mti-sead3/sead3-init.c
@@ -17,47 +17,6 @@
extern char except_vec_nmi;
extern char except_vec_ejtag_debug;
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-static void __init console_config(void)
-{
- char console_string[40];
- int baud = 0;
- char parity = '\0', bits = '\0', flow = '\0';
- char *s;
-
- if ((strstr(fw_getcmdline(), "console=")) == NULL) {
- s = fw_getenv("modetty0");
- if (s) {
- while (*s >= '0' && *s <= '9')
- baud = baud*10 + *s++ - '0';
- if (*s == ',')
- s++;
- if (*s)
- parity = *s++;
- if (*s == ',')
- s++;
- if (*s)
- bits = *s++;
- if (*s == ',')
- s++;
- if (*s == 'h')
- flow = 'r';
- }
- if (baud == 0)
- baud = 38400;
- if (parity != 'n' && parity != 'o' && parity != 'e')
- parity = 'n';
- if (bits != '7' && bits != '8')
- bits = '8';
- if (flow == '\0')
- flow = 'r';
- sprintf(console_string, " console=ttyS0,%d%c%c%c", baud,
- parity, bits, flow);
- strcat(fw_getcmdline(), console_string);
- }
-}
-#endif
-
static void __init mips_nmi_setup(void)
{
void *base;
@@ -140,11 +99,6 @@ void __init prom_init(void)
else if ((strstr(fw_getcmdline(), "console=ttyS1")) != NULL)
fw_init_early_console(1);
#endif
-#ifdef CONFIG_SERIAL_8250_CONSOLE
- if ((strstr(fw_getcmdline(), "console=")) == NULL)
- strcat(fw_getcmdline(), " console=ttyS0,38400n8r");
- console_config();
-#endif
}
void __init prom_free_prom_memory(void)
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
index 12cf905..e772a05 100644
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ b/arch/mips/mti-sead3/sead3-platform.c
@@ -14,35 +14,10 @@
#include <linux/mtd/physmap.h>
#include <linux/of.h>
#include <linux/platform_device.h>
-#include <linux/serial_8250.h>
#include <linux/smsc911x.h>
#include <asm/mips-boards/sead3int.h>
-#define UART(base) \
-{ \
- .mapbase = base, \
- .irq = -1, \
- .uartclk = 14745600, \
- .iotype = UPIO_MEM32, \
- .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, \
- .regshift = 2, \
-}
-
-static struct plat_serial8250_port uart8250_data[] = {
- UART(0x1f000900), /* ttyS0 = USB */
- UART(0x1f000800), /* ttyS1 = RS232 */
- { },
-};
-
-static struct platform_device uart8250_device = {
- .name = "serial8250",
- .id = PLAT8250_DEV_PLATFORM2,
- .dev = {
- .platform_data = uart8250_data,
- },
-};
-
static struct smsc911x_platform_config sead3_smsc911x_data = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
@@ -195,7 +170,6 @@ static struct platform_device ehci_device = {
};
static struct platform_device *sead3_platform_devices[] __initdata = {
- &uart8250_device,
&sead3_flash,
&pled_device,
&fled_device,
@@ -228,15 +202,11 @@ static int __init sead3_platforms_device_init(void)
}
if (gic_present) {
- uart8250_data[0].irq = irq_create_mapping(irqd, GIC_INT_UART0);
- uart8250_data[1].irq = irq_create_mapping(irqd, GIC_INT_UART1);
ehci_resources[1].start =
irq_create_mapping(irqd, GIC_INT_EHCI);
sead3_net_resources[1].start =
irq_create_mapping(irqd, GIC_INT_NET);
} else {
- uart8250_data[0].irq = irq_create_mapping(irqd, CPU_INT_UART0);
- uart8250_data[1].irq = irq_create_mapping(irqd, CPU_INT_UART1);
ehci_resources[1].start =
irq_create_mapping(irqd, CPU_INT_EHCI);
sead3_net_resources[1].start =
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-08-10 20:30 +0200 |
| Subject | Re: [PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT |
| Message-ID | <s4Gqo-b4-115@gated-at.bofh.it> |
| In reply to | #1458683 |
[Multipart message — attachments visible in raw view] — view raw
Hi Paul,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc1 next-20160809]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Paul-Burton/MIPS-SEAD3-device-tree-conversion/20160809-204707
config: mips-sead3_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
Note: the linux-review/Paul-Burton/MIPS-SEAD3-device-tree-conversion/20160809-204707 HEAD 0eed2040422cad5cd9998891bc53368a6f15871c builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
arch/mips/mti-sead3/sead3-dtshim.c: In function 'remove_gic':
arch/mips/mti-sead3/sead3-dtshim.c:56:11: error: 'EINVAL' undeclared (first use in this function)
return -EINVAL;
^
arch/mips/mti-sead3/sead3-dtshim.c:56:11: note: each undeclared identifier is reported only once for each function it appears in
arch/mips/mti-sead3/sead3-dtshim.c: In function 'serial_config':
arch/mips/mti-sead3/sead3-dtshim.c:94:13: error: implicit declaration of function 'fw_getenv' [-Werror=implicit-function-declaration]
yamontty = fw_getenv("yamontty");
^
>> arch/mips/mti-sead3/sead3-dtshim.c:94:11: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
yamontty = fw_getenv("yamontty");
^
arch/mips/mti-sead3/sead3-dtshim.c:110:11: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
mode_var = fw_getenv(mode_var_name);
^
cc1: all warnings being treated as errors
vim +94 arch/mips/mti-sead3/sead3-dtshim.c
88 const char *yamontty, *mode_var;
89 char mode_var_name[9], path[18], parity;
90 unsigned int uart, baud, stop_bits;
91 bool hw_flow;
92 int chosen_off, err;
93
> 94 yamontty = fw_getenv("yamontty");
95 if (!yamontty || !strcmp(yamontty, "tty0")) {
96 uart = 0;
97 } else if (!strcmp(yamontty, "tty1")) {
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-08-10 21:40 +0200 |
| Subject | Re: [PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT |
| Message-ID | <s4Hw7-YV-63@gated-at.bofh.it> |
| In reply to | #1458683 |
[Multipart message — attachments visible in raw view] — view raw
Hi Paul,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc1 next-20160809]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Paul-Burton/MIPS-SEAD3-device-tree-conversion/20160809-204707
config: mips-sead3_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
Note: the linux-review/Paul-Burton/MIPS-SEAD3-device-tree-conversion/20160809-204707 HEAD 0eed2040422cad5cd9998891bc53368a6f15871c builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
arch/mips/mti-sead3/sead3-dtshim.c: In function 'remove_gic':
arch/mips/mti-sead3/sead3-dtshim.c:56:11: error: 'EINVAL' undeclared (first use in this function)
return -EINVAL;
^
arch/mips/mti-sead3/sead3-dtshim.c:56:11: note: each undeclared identifier is reported only once for each function it appears in
arch/mips/mti-sead3/sead3-dtshim.c: In function 'serial_config':
>> arch/mips/mti-sead3/sead3-dtshim.c:94:13: error: implicit declaration of function 'fw_getenv' [-Werror=implicit-function-declaration]
yamontty = fw_getenv("yamontty");
^
arch/mips/mti-sead3/sead3-dtshim.c:94:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
yamontty = fw_getenv("yamontty");
^
arch/mips/mti-sead3/sead3-dtshim.c:110:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
mode_var = fw_getenv(mode_var_name);
^
cc1: some warnings being treated as errors
vim +/fw_getenv +94 arch/mips/mti-sead3/sead3-dtshim.c
88 const char *yamontty, *mode_var;
89 char mode_var_name[9], path[18], parity;
90 unsigned int uart, baud, stop_bits;
91 bool hw_flow;
92 int chosen_off, err;
93
> 94 yamontty = fw_getenv("yamontty");
95 if (!yamontty || !strcmp(yamontty, "tty0")) {
96 uart = 0;
97 } else if (!strcmp(yamontty, "tty1")) {
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 04/20] MIPS: SEAD3: Use generic ns16550a earlycon support |
| Message-ID | <s4eu7-7y7-57@gated-at.bofh.it> |
| In reply to | #1458670 |
Stop selecting SYS_HAS_EARLY_PRINTK & remove the custom support for
early output to the ns16550a UARTs, instead relying upon generic
ns16550a earlycon support. This reduces the amount of platform code
required for SEAD3 without losing any functionality.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/Kconfig | 1 -
arch/mips/configs/sead3_defconfig | 2 ++
arch/mips/mti-sead3/Makefile | 2 --
arch/mips/mti-sead3/sead3-console.c | 46 -------------------------------------
arch/mips/mti-sead3/sead3-init.c | 6 -----
5 files changed, 2 insertions(+), 55 deletions(-)
delete mode 100644 arch/mips/mti-sead3/sead3-console.c
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2638856..45bbddf 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -513,7 +513,6 @@ config MIPS_SEAD3
select SYS_HAS_CPU_MIPS32_R2
select SYS_HAS_CPU_MIPS32_R6
select SYS_HAS_CPU_MIPS64_R1
- select SYS_HAS_EARLY_PRINTK
select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_64BIT_KERNEL
select SYS_SUPPORTS_BIG_ENDIAN
diff --git a/arch/mips/configs/sead3_defconfig b/arch/mips/configs/sead3_defconfig
index deb48fb..23cce81 100644
--- a/arch/mips/configs/sead3_defconfig
+++ b/arch/mips/configs/sead3_defconfig
@@ -15,6 +15,8 @@ CONFIG_PROFILING=y
CONFIG_OPROFILE=y
CONFIG_MODULES=y
# CONFIG_BLK_DEV_BSG is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="earlycon"
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
CONFIG_NET=y
CONFIG_PACKET=y
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index aad67aa..a58b6d9 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -17,5 +17,3 @@ obj-y += sead3-platform.o
obj-y += sead3-reset.o
obj-y += sead3-setup.o
obj-y += sead3-time.o
-
-obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
diff --git a/arch/mips/mti-sead3/sead3-console.c b/arch/mips/mti-sead3/sead3-console.c
deleted file mode 100644
index 031f47d..0000000
--- a/arch/mips/mti-sead3/sead3-console.c
+++ /dev/null
@@ -1,46 +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/console.h>
-#include <linux/serial_reg.h>
-#include <linux/io.h>
-
-#define SEAD_UART1_REGS_BASE 0xbf000800 /* ttyS1 = DB9 port */
-#define SEAD_UART0_REGS_BASE 0xbf000900 /* ttyS0 = USB port */
-#define PORT(base_addr, offset) ((unsigned int __iomem *)(base_addr+(offset)*4))
-
-static char console_port = 1;
-
-static inline unsigned int serial_in(int offset, unsigned int base_addr)
-{
- return __raw_readl(PORT(base_addr, offset)) & 0xff;
-}
-
-static inline void serial_out(int offset, int value, unsigned int base_addr)
-{
- __raw_writel(value, PORT(base_addr, offset));
-}
-
-void __init fw_init_early_console(char port)
-{
- console_port = port;
-}
-
-int prom_putchar(char c)
-{
- unsigned int base_addr;
-
- base_addr = console_port ? SEAD_UART1_REGS_BASE : SEAD_UART0_REGS_BASE;
-
- while ((serial_in(UART_LSR, base_addr) & UART_LSR_THRE) == 0)
- ;
-
- serial_out(UART_TX, c, base_addr);
-
- return 1;
-}
diff --git a/arch/mips/mti-sead3/sead3-init.c b/arch/mips/mti-sead3/sead3-init.c
index e81f5b7..50f3fcb 100644
--- a/arch/mips/mti-sead3/sead3-init.c
+++ b/arch/mips/mti-sead3/sead3-init.c
@@ -93,12 +93,6 @@ void __init prom_init(void)
board_ejtag_handler_setup = mips_ejtag_setup;
fw_init_cmdline();
-#ifdef CONFIG_EARLY_PRINTK
- if ((strstr(fw_getcmdline(), "console=ttyS0")) != NULL)
- fw_init_early_console(0);
- else if ((strstr(fw_getcmdline(), "console=ttyS1")) != NULL)
- fw_init_early_console(1);
-#endif
}
void __init prom_free_prom_memory(void)
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:40 +0200 |
| Subject | [PATCH 13/20] MIPS: SEAD3: Use generic restart-poweroff driver |
| Message-ID | <s4eu7-7y7-63@gated-at.bofh.it> |
| In reply to | #1458670 |
Remove the custom platform code to restart when instructed to power off,
instead relying upon the generic restart-poweroff driver probed via DT
to do the same thing.
Remove also the halt implementation, which is incorrect. The generic
MIPS version will hang the system as halt should.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/boot/dts/mti/sead3.dts | 4 ++++
arch/mips/configs/sead3_defconfig | 1 +
arch/mips/mti-sead3/Makefile | 1 -
arch/mips/mti-sead3/sead3-reset.c | 31 -------------------------------
4 files changed, 5 insertions(+), 32 deletions(-)
delete mode 100644 arch/mips/mti-sead3/sead3-reset.c
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index d661012..ae2e3ab 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -94,6 +94,10 @@
offset = <0x50>;
mask = <0x4d>;
};
+
+ poweroff {
+ compatible = "restart-poweroff";
+ };
};
system-controller@1f000200 {
diff --git a/arch/mips/configs/sead3_defconfig b/arch/mips/configs/sead3_defconfig
index 055af30..ab4c465 100644
--- a/arch/mips/configs/sead3_defconfig
+++ b/arch/mips/configs/sead3_defconfig
@@ -81,6 +81,7 @@ CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_HELPER_AUTO is not set
CONFIG_SPI=y
CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_RESTART=y
CONFIG_POWER_RESET_SYSCON=y
CONFIG_SENSORS_ADT7475=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index 04ea002..ad722c8 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -13,6 +13,5 @@ obj-y += sead3-display.o
obj-y += sead3-dtshim.o
obj-y += sead3-init.o
obj-y += sead3-int.o
-obj-y += sead3-reset.o
obj-y += sead3-setup.o
obj-y += sead3-time.o
diff --git a/arch/mips/mti-sead3/sead3-reset.c b/arch/mips/mti-sead3/sead3-reset.c
deleted file mode 100644
index 8f548f0..0000000
--- a/arch/mips/mti-sead3/sead3-reset.c
+++ /dev/null
@@ -1,31 +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/io.h>
-#include <linux/pm.h>
-
-#include <asm/reboot.h>
-
-#define SOFTRES_REG 0x1f000050
-#define GORESET 0x4d
-
-static void mips_machine_halt(void)
-{
- unsigned int __iomem *softres_reg =
- ioremap(SOFTRES_REG, sizeof(unsigned int));
-
- __raw_writel(GORESET, softres_reg);
-}
-
-static int __init mips_reboot_setup(void)
-{
- _machine_halt = mips_machine_halt;
- pm_power_off = mips_machine_halt;
-
- return 0;
-}
-arch_initcall(mips_reboot_setup);
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:50 +0200 |
| Subject | [PATCH 15/20] MIPS: SEAD3: Drop use of cobalt fbdev driver |
| Message-ID | <s4eDL-7BJ-9@gated-at.bofh.it> |
| In reply to | #1458670 |
The 2 line * 16 character LCD display on the SEAD3 board has no real use
as a framebuffer device. It's far too small to produce any meaningful
output if used as the kernel console, SEAD3 is a development board that
will essentially always have a far more useful UART connection & the
code in sead3-display.c will overwrite whatever's on the display every
second anyway. Remove this unused code.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/mti-sead3/Makefile | 3 +--
arch/mips/mti-sead3/sead3-lcd.c | 43 -----------------------------------------
2 files changed, 1 insertion(+), 45 deletions(-)
delete mode 100644 arch/mips/mti-sead3/sead3-lcd.c
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index ad722c8..cb6d620 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -8,8 +8,7 @@
# Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved.
# Steven J. Hill <sjhill@mips.com>
#
-obj-y := sead3-lcd.o
-obj-y += sead3-display.o
+obj-y := sead3-display.o
obj-y += sead3-dtshim.o
obj-y += sead3-init.o
obj-y += sead3-int.o
diff --git a/arch/mips/mti-sead3/sead3-lcd.c b/arch/mips/mti-sead3/sead3-lcd.c
deleted file mode 100644
index 10b10ed2..0000000
--- a/arch/mips/mti-sead3/sead3-lcd.c
+++ /dev/null
@@ -1,43 +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/platform_device.h>
-
-static struct resource __initdata sead3_lcd_resource = {
- .start = 0x1f000400,
- .end = 0x1f00041f,
- .flags = IORESOURCE_MEM,
-};
-
-static __init int sead3_lcd_add(void)
-{
- struct platform_device *pdev;
- int retval;
-
- /* SEAD-3 and Cobalt platforms use same display type. */
- pdev = platform_device_alloc("cobalt-lcd", -1);
- if (!pdev)
- return -ENOMEM;
-
- retval = platform_device_add_resources(pdev, &sead3_lcd_resource, 1);
- if (retval)
- goto err_free_device;
-
- retval = platform_device_add(pdev);
- if (retval)
- goto err_free_device;
-
- return 0;
-
-err_free_device:
- platform_device_put(pdev);
-
- return retval;
-}
-
-device_initcall(sead3_lcd_add);
--
2.9.2
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-08-09 14:50 +0200 |
| Subject | [PATCH 19/20] MIPS: SEAD3: Use img-ascii-lcd driver |
| Message-ID | <s4eDM-7BJ-37@gated-at.bofh.it> |
| In reply to | #1458670 |
Probe the img-ascii-lcd driver using device tree in order to display a
message on the SEAD3 board's LCD display, and remove the platform code
that was formerly performing this function. This removes more platform
code and moves SEAD3 further towards being entirely DT-based.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/boot/dts/mti/sead3.dts | 5 +++
arch/mips/mti-sead3/Makefile | 3 +-
arch/mips/mti-sead3/sead3-display.c | 77 -------------------------------------
arch/mips/mti-sead3/sead3-time.c | 2 -
4 files changed, 6 insertions(+), 81 deletions(-)
delete mode 100644 arch/mips/mti-sead3/sead3-display.c
diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index ae2e3ab..a3d2ae1 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -201,6 +201,11 @@
mask = <0x80>;
label = "fled7";
};
+
+ lcd@200 {
+ compatible = "mti,sead3-lcd";
+ offset = <0x200>;
+ };
};
/* UART connected to FTDI & miniUSB socket */
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index cb6d620..1674b9c 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -8,8 +8,7 @@
# Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved.
# Steven J. Hill <sjhill@mips.com>
#
-obj-y := sead3-display.o
-obj-y += sead3-dtshim.o
+obj-y := sead3-dtshim.o
obj-y += sead3-init.o
obj-y += sead3-int.o
obj-y += sead3-setup.o
diff --git a/arch/mips/mti-sead3/sead3-display.c b/arch/mips/mti-sead3/sead3-display.c
deleted file mode 100644
index 9487599..0000000
--- a/arch/mips/mti-sead3/sead3-display.c
+++ /dev/null
@@ -1,77 +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/timer.h>
-#include <linux/io.h>
-#include <asm/mips-boards/generic.h>
-
-static unsigned int display_count;
-static unsigned int max_display_count;
-
-#define LCD_DISPLAY_POS_BASE 0x1f000400
-#define DISPLAY_LCDINSTRUCTION (0*2)
-#define DISPLAY_LCDDATA (1*2)
-#define DISPLAY_CPLDSTATUS (2*2)
-#define DISPLAY_CPLDDATA (3*2)
-#define LCD_SETDDRAM 0x80
-#define LCD_IR_BF 0x80
-
-const char display_string[] = " LINUX ON SEAD3 ";
-
-static void scroll_display_message(unsigned long data);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
-
-static void lcd_wait(unsigned int __iomem *display)
-{
- /* Wait for CPLD state machine to become idle. */
- do { } while (__raw_readl(display + DISPLAY_CPLDSTATUS) & 1);
-
- do {
- __raw_readl(display + DISPLAY_LCDINSTRUCTION);
-
- /* Wait for CPLD state machine to become idle. */
- do { } while (__raw_readl(display + DISPLAY_CPLDSTATUS) & 1);
- } while (__raw_readl(display + DISPLAY_CPLDDATA) & LCD_IR_BF);
-}
-
-void mips_display_message(const char *str)
-{
- static unsigned int __iomem *display;
- char ch;
- int i;
-
- if (unlikely(display == NULL))
- display = ioremap_nocache(LCD_DISPLAY_POS_BASE,
- (8 * sizeof(int)));
-
- for (i = 0; i < 16; i++) {
- if (*str)
- ch = *str++;
- else
- ch = ' ';
- lcd_wait(display);
- __raw_writel((LCD_SETDDRAM | i),
- (display + DISPLAY_LCDINSTRUCTION));
- lcd_wait(display);
- __raw_writel(ch, display + DISPLAY_LCDDATA);
- }
-}
-
-static void scroll_display_message(unsigned long data)
-{
- mips_display_message(&display_string[display_count++]);
- if (display_count == max_display_count)
- display_count = 0;
- mod_timer(&mips_scroll_timer, jiffies + HZ);
-}
-
-void mips_scroll_message(void)
-{
- del_timer_sync(&mips_scroll_timer);
- max_display_count = strlen(display_string) + 1 - 16;
- mod_timer(&mips_scroll_timer, jiffies + 1);
-}
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c
index a120b7a..10b0bf3 100644
--- a/arch/mips/mti-sead3/sead3-time.c
+++ b/arch/mips/mti-sead3/sead3-time.c
@@ -94,6 +94,4 @@ void __init plat_time_init(void)
pr_debug("CPU frequency %d.%02d MHz\n", (est_freq / 1000000),
(est_freq % 1000000) * 100 / 1000000);
-
- mips_scroll_message();
}
--
2.9.2
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web