
From: Simon Glass <sjg@chromium.org> These values are used in the devicetree and the C code, so move them to a new dt-bindings header. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/dts/test.dts | 5 +++-- include/dt-bindings/virtio.h | 19 +++++++++++++++++++ include/virtio.h | 5 +---- 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 include/dt-bindings/virtio.h diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 3e8db5c09c6..d0384e9b7e1 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -15,6 +15,7 @@ #include <dt-bindings/input/input.h> #include <dt-bindings/pinctrl/sandbox-pinmux.h> #include <dt-bindings/mux/mux.h> +#include <dt-bindings/virtio.h> / { model = "sandbox"; @@ -1691,7 +1692,7 @@ sandbox_virtio1 { compatible = "sandbox,virtio1"; - virtio-type = <4>; /* rng */ + virtio-type = <VIRTIO_ID_RNG>; }; sandbox_virtio2 { @@ -1700,7 +1701,7 @@ sandbox-virtio-blk { compatible = "sandbox,virtio1"; - virtio-type = <2>; /* block */ + virtio-type = <VIRTIO_ID_BLOCK>; }; sandbox_scmi { diff --git a/include/dt-bindings/virtio.h b/include/dt-bindings/virtio.h new file mode 100644 index 00000000000..9e3fea14567 --- /dev/null +++ b/include/dt-bindings/virtio.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> + * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> + * + * Binding file for virtio IDs + * + * This file is largely based on Linux kernel virtio_*.h files + */ + +#ifndef __DT_BINDINGS_VIRTIO +#define __DT_BINDINGS_VIRTIO + +#define VIRTIO_ID_NET 1 /* virtio net */ +#define VIRTIO_ID_BLOCK 2 /* virtio block */ +#define VIRTIO_ID_RNG 4 /* virtio rng */ +#define VIRTIO_ID_MAX_NUM 27 + +#endif diff --git a/include/virtio.h b/include/virtio.h index 17f894a79e3..ef4eeb16a29 100644 --- a/include/virtio.h +++ b/include/virtio.h @@ -22,13 +22,10 @@ #include <virtio_types.h> #include <dm/device.h> +#include <dt-bindings/virtio.h> #include <linux/bitops.h> #include <linux/bug.h> #include <linux/typecheck.h> -#define VIRTIO_ID_NET 1 /* virtio net */ -#define VIRTIO_ID_BLOCK 2 /* virtio block */ -#define VIRTIO_ID_RNG 4 /* virtio rng */ -#define VIRTIO_ID_MAX_NUM 5 #define VIRTIO_NET_DRV_NAME "virtio-net" #define VIRTIO_BLK_DRV_NAME "virtio-blk" -- 2.43.0