diff options
author | 2015-08-04 12:17:53 -0700 | |
---|---|---|
committer | 2015-08-04 15:44:42 -0700 | |
commit | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch) | |
tree | 1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/drivers/staging/board | |
parent | 98260f3884f4a202f9ca5eabed40b1354c489b29 (diff) |
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base.
It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and
the base is:
commit 0917f823c59692d751951bf5ea699a2d1e2f26a2
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Sat Jul 25 12:13:34 2015 +0200
Prepare v4.1.3-rt3
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
We lose all the git history this way and it's not good. We
should apply another opnfv project repo in future.
Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/drivers/staging/board')
-rw-r--r-- | kernel/drivers/staging/board/Kconfig | 9 | ||||
-rw-r--r-- | kernel/drivers/staging/board/Makefile | 2 | ||||
-rw-r--r-- | kernel/drivers/staging/board/TODO | 2 | ||||
-rw-r--r-- | kernel/drivers/staging/board/board.c | 40 | ||||
-rw-r--r-- | kernel/drivers/staging/board/board.h | 20 | ||||
-rw-r--r-- | kernel/drivers/staging/board/kzm9d.c | 19 |
6 files changed, 92 insertions, 0 deletions
diff --git a/kernel/drivers/staging/board/Kconfig b/kernel/drivers/staging/board/Kconfig new file mode 100644 index 000000000..0a89ad163 --- /dev/null +++ b/kernel/drivers/staging/board/Kconfig @@ -0,0 +1,9 @@ +config STAGING_BOARD + bool "Staging Board Support" + depends on OF_ADDRESS + depends on BROKEN + help + Select to enable per-board staging support code. + + If in doubt, say N here. + diff --git a/kernel/drivers/staging/board/Makefile b/kernel/drivers/staging/board/Makefile new file mode 100644 index 000000000..65d39ecfa --- /dev/null +++ b/kernel/drivers/staging/board/Makefile @@ -0,0 +1,2 @@ +obj-y := board.o +obj-$(CONFIG_ARCH_EMEV2) += kzm9d.o diff --git a/kernel/drivers/staging/board/TODO b/kernel/drivers/staging/board/TODO new file mode 100644 index 000000000..8db70e10a --- /dev/null +++ b/kernel/drivers/staging/board/TODO @@ -0,0 +1,2 @@ +* replace platform device code with DT nodes once the driver supports DT +* remove staging board code when no more platform devices are needed diff --git a/kernel/drivers/staging/board/board.c b/kernel/drivers/staging/board/board.c new file mode 100644 index 000000000..d5a6abc84 --- /dev/null +++ b/kernel/drivers/staging/board/board.c @@ -0,0 +1,40 @@ +#include <linux/init.h> +#include <linux/device.h> +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include "board.h" + +static bool find_by_address(u64 base_address) +{ + struct device_node *dn = of_find_all_nodes(NULL); + struct resource res; + + while (dn) { + if (!of_address_to_resource(dn, 0, &res)) { + if (res.start == base_address) { + of_node_put(dn); + return true; + } + } + dn = of_find_all_nodes(dn); + } + + return false; +} + +bool __init board_staging_dt_node_available(const struct resource *resource, + unsigned int num_resources) +{ + unsigned int i; + + for (i = 0; i < num_resources; i++) { + const struct resource *r = resource + i; + + if (resource_type(r) == IORESOURCE_MEM) + if (find_by_address(r->start)) + return true; /* DT node available */ + } + + return false; /* Nothing found */ +} diff --git a/kernel/drivers/staging/board/board.h b/kernel/drivers/staging/board/board.h new file mode 100644 index 000000000..2390ed6c3 --- /dev/null +++ b/kernel/drivers/staging/board/board.h @@ -0,0 +1,20 @@ +#ifndef __BOARD_H__ +#define __BOARD_H__ +#include <linux/init.h> +#include <linux/of.h> + +bool board_staging_dt_node_available(const struct resource *resource, + unsigned int num_resources); + +#define board_staging(str, fn) \ +static int __init runtime_board_check(void) \ +{ \ + if (of_machine_is_compatible(str)) \ + fn(); \ + \ + return 0; \ +} \ + \ +late_initcall(runtime_board_check) + +#endif /* __BOARD_H__ */ diff --git a/kernel/drivers/staging/board/kzm9d.c b/kernel/drivers/staging/board/kzm9d.c new file mode 100644 index 000000000..533f3026e --- /dev/null +++ b/kernel/drivers/staging/board/kzm9d.c @@ -0,0 +1,19 @@ +/* Staging board support for KZM9D. Enable not-yet-DT-capable devices here. */ + +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include "board.h" + +static const struct resource usbs1_res[] __initconst = { + DEFINE_RES_MEM(0xe2800000, 0x2000), + DEFINE_RES_IRQ(159), +}; + +static void __init kzm9d_init(void) +{ + if (!board_staging_dt_node_available(usbs1_res, ARRAY_SIZE(usbs1_res))) + platform_device_register_simple("emxx_udc", -1, usbs1_res, + ARRAY_SIZE(usbs1_res)); +} + +board_staging("renesas,kzm9d", kzm9d_init); |