Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9540724c authored by Linus Walleij's avatar Linus Walleij
Browse files

ARM: ixp4xx: Add device tree boot support



This adds a minimal support for booting IXP4xx systems
from device tree.

We have to add hacks to the QMGR, NPE and notably also
ethernet and watchdog drivers so that they don't crash
the platform: these drivers are unconditionally starting
to grab regions of statically remapped IO space with no
concern of the device model or other platforms.

We will go in and properly fix these drivers as we go
along but for now this hack gets us to a place where we
can start working on proper device tree support for these
platforms.

Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 50d2c8d2
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -4,6 +4,20 @@ menu "Intel IXP4xx Implementation Options"

comment "IXP4xx Platforms"

config MACH_IXP4XX_OF
	bool
	prompt "Devce Tree IXP4xx boards"
	default y
	select ARM_APPENDED_DTB # Old Redboot bootloaders deployed
	select I2C
	select I2C_IOP3XX
	select PCI
	select SERIAL_OF_PLATFORM
	select TIMER_OF
	select USE_OF
	help
	  Say 'Y' here to support Device Tree-based IXP4xx platforms.

config MACH_NSLU2
	bool
	prompt "Linksys NSLU2"
+3 −0
Original line number Diff line number Diff line
@@ -6,6 +6,9 @@
obj-pci-y	:=
obj-pci-n	:=

# Device tree platform
obj-pci-$(CONFIG_MACH_IXP4XX_OF)	+= ixp4xx-of.o

obj-pci-$(CONFIG_ARCH_IXDP4XX)		+= ixdp425-pci.o
obj-pci-$(CONFIG_MACH_AVILA)		+= avila-pci.o
obj-pci-$(CONFIG_MACH_IXDPG425)		+= ixdpg425-pci.o
+60 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * IXP4xx Device Tree boot support
 */
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>

#include <mach/hardware.h>
#include <mach/ixp4xx-regs.h>

static struct map_desc ixp4xx_of_io_desc[] __initdata = {
	/*
	 * This is needed for runtime system configuration checks,
	 * such as reading if hardware so-and-so is present. This
	 * could eventually be converted into a syscon once all boards
	 * are converted to device tree.
	 */
	{
		.virtual = IXP4XX_EXP_CFG_BASE_VIRT,
		.pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS),
		.length = SZ_4K,
		.type = MT_DEVICE,
	},
#ifdef CONFIG_DEBUG_UART_8250
	/* This is needed for LL-debug/earlyprintk/debug-macro.S */
	{
		.virtual = CONFIG_DEBUG_UART_VIRT,
		.pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
		.length = SZ_4K,
		.type = MT_DEVICE,
	},
#endif
};

static void __init ixp4xx_of_map_io(void)
{
	iotable_init(ixp4xx_of_io_desc, ARRAY_SIZE(ixp4xx_of_io_desc));
}

/*
 * We handle 4 differen SoC families. These compatible strings are enough
 * to provide the core so that different boards can add their more detailed
 * specifics.
 */
static const char *ixp4xx_of_board_compat[] = {
	"intel,ixp42x",
	"intel,ixp43x",
	"intel,ixp45x",
	"intel,ixp46x",
	NULL,
};

DT_MACHINE_START(IXP4XX_DT, "IXP4xx (Device Tree)")
	.map_io		= ixp4xx_of_map_io,
	.dt_compat	= ixp4xx_of_board_compat,
MACHINE_END
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <mach/npe.h>

#define DEBUG_MSG			0
@@ -688,6 +689,10 @@ static int __init npe_init_module(void)

	int i, found = 0;

	/* This driver does not work with device tree */
	if (of_have_populated_dt())
		return -ENODEV;

	for (i = 0; i < NPE_COUNT; i++) {
		struct npe *npe = &npe_tab[i];
		if (!(ixp4xx_read_feature_bits() &
+5 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <mach/qmgr.h>

#include "irqs.h"
@@ -289,6 +290,10 @@ static int qmgr_init(void)
	int i, err;
	irq_handler_t handler1, handler2;

	/* This driver does not work with device tree */
	if (of_have_populated_dt())
		return -ENODEV;

	mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS,
				     IXP4XX_QMGR_REGION_SIZE,
				     "IXP4xx Queue Manager");
Loading