summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorzms123456 <[email protected]>2024-06-19 19:48:35 +0800
committerGitHub <[email protected]>2024-06-19 19:48:35 +0800
commit3b1ce1e4b68699616cc8395fbae6ee81140f1882 (patch)
tree8772f1aa5cad6487ef62a9001d1158023f18b4b9 /components
parent7250301d3e8c33b57b54c216d6e58c792ac748ff (diff)
[components][drivers]legacy fdt (#9062)
* legacy fdt * update fdt
Diffstat (limited to 'components')
-rwxr-xr-xcomponents/drivers/Kconfig1
-rw-r--r--components/drivers/fdt/Kconfig0
-rw-r--r--components/legacy/Kconfig202
-rw-r--r--components/legacy/fdt/Kconfig15
-rw-r--r--components/legacy/fdt/README.md (renamed from components/drivers/fdt/README.md)0
-rw-r--r--components/legacy/fdt/SConscript (renamed from components/drivers/fdt/SConscript)0
-rw-r--r--components/legacy/fdt/docs/README.md (renamed from components/drivers/fdt/docs/README.md)0
-rw-r--r--components/legacy/fdt/docs/api.md (renamed from components/drivers/fdt/docs/api.md)0
-rw-r--r--components/legacy/fdt/docs/examples.md (renamed from components/drivers/fdt/docs/examples.md)0
-rw-r--r--components/legacy/fdt/docs/version.md (renamed from components/drivers/fdt/docs/version.md)0
-rw-r--r--components/legacy/fdt/examples/SConscript (renamed from components/drivers/fdt/examples/SConscript)0
-rw-r--r--components/legacy/fdt/examples/fdt_test.c (renamed from components/drivers/fdt/examples/fdt_test.c)0
-rw-r--r--components/legacy/fdt/inc/dtb_fwnode.h125
-rw-r--r--components/legacy/fdt/inc/dtb_node.h (renamed from components/drivers/fdt/inc/dtb_node.h)23
-rw-r--r--components/legacy/fdt/libfdt/SConscript (renamed from components/drivers/fdt/libfdt/SConscript)0
-rw-r--r--components/legacy/fdt/libfdt/fdt.c (renamed from components/drivers/fdt/libfdt/fdt.c)0
-rw-r--r--components/legacy/fdt/libfdt/fdt.h (renamed from components/drivers/fdt/libfdt/fdt.h)0
-rw-r--r--components/legacy/fdt/libfdt/fdt_addresses.c (renamed from components/drivers/fdt/libfdt/fdt_addresses.c)0
-rw-r--r--components/legacy/fdt/libfdt/fdt_empty_tree.c (renamed from components/drivers/fdt/libfdt/fdt_empty_tree.c)0
-rw-r--r--components/legacy/fdt/libfdt/fdt_ro.c (renamed from components/drivers/fdt/libfdt/fdt_ro.c)0
-rw-r--r--components/legacy/fdt/libfdt/fdt_rw.c (renamed from components/drivers/fdt/libfdt/fdt_rw.c)0
-rw-r--r--components/legacy/fdt/libfdt/fdt_strerror.c (renamed from components/drivers/fdt/libfdt/fdt_strerror.c)0
-rw-r--r--components/legacy/fdt/libfdt/fdt_sw.c (renamed from components/drivers/fdt/libfdt/fdt_sw.c)0
-rw-r--r--components/legacy/fdt/libfdt/fdt_wip.c (renamed from components/drivers/fdt/libfdt/fdt_wip.c)0
-rw-r--r--components/legacy/fdt/libfdt/libfdt.h (renamed from components/drivers/fdt/libfdt/libfdt.h)0
-rw-r--r--components/legacy/fdt/libfdt/libfdt_env.h (renamed from components/drivers/fdt/libfdt/libfdt_env.h)0
-rw-r--r--components/legacy/fdt/libfdt/libfdt_internal.h (renamed from components/drivers/fdt/libfdt/libfdt_internal.h)0
-rw-r--r--components/legacy/fdt/src/SConscript (renamed from components/drivers/fdt/src/SConscript)0
-rw-r--r--components/legacy/fdt/src/dtb_access.c (renamed from components/drivers/fdt/src/dtb_access.c)22
-rw-r--r--components/legacy/fdt/src/dtb_addr.c (renamed from components/drivers/fdt/src/dtb_addr.c)0
-rw-r--r--components/legacy/fdt/src/dtb_base.c (renamed from components/drivers/fdt/src/dtb_base.c)0
-rw-r--r--components/legacy/fdt/src/dtb_get.c (renamed from components/drivers/fdt/src/dtb_get.c)8
-rw-r--r--components/legacy/fdt/src/dtb_head.c (renamed from components/drivers/fdt/src/dtb_head.c)0
-rw-r--r--components/legacy/fdt/src/dtb_load.c (renamed from components/drivers/fdt/src/dtb_load.c)0
-rw-r--r--components/legacy/fdt/src/dtb_set.c (renamed from components/drivers/fdt/src/dtb_set.c)0
-rw-r--r--components/legacy/usb/Kconfig200
36 files changed, 379 insertions, 217 deletions
diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig
index b7112d9ea6..24856d5cc8 100755
--- a/components/drivers/Kconfig
+++ b/components/drivers/Kconfig
@@ -30,6 +30,5 @@ rsource "ktime/Kconfig"
rsource "clk/Kconfig"
rsource "hwtimer/Kconfig"
rsource "usb/Kconfig"
-rsource "fdt/Kconfig"
endmenu
diff --git a/components/drivers/fdt/Kconfig b/components/drivers/fdt/Kconfig
deleted file mode 100644
index e69de29bb2..0000000000
--- a/components/drivers/fdt/Kconfig
+++ /dev/null
diff --git a/components/legacy/Kconfig b/components/legacy/Kconfig
index d20c0f92f9..67d397949c 100644
--- a/components/legacy/Kconfig
+++ b/components/legacy/Kconfig
@@ -1,200 +1,2 @@
-menu "Using USB legacy version"
- config RT_USING_USB
- bool
- default n
-
- config RT_USING_USB_HOST
- bool "Using USB host"
- default n
- select RT_USING_USB
-
- if RT_USING_USB_HOST
- config RT_USBH_MSTORAGE
- bool "Enable Udisk Drivers"
- default n
- if RT_USBH_MSTORAGE
- config UDISK_MOUNTPOINT
- string "Udisk mount dir"
- default "/"
- endif
- config RT_USBH_HID
- bool "Enable HID Drivers"
- default n
- if RT_USBH_HID
- config RT_USBH_HID_MOUSE
- bool "Enable HID mouse protocol"
- default n
- config RT_USBH_HID_KEYBOARD
- bool "Enable HID keyboard protocol"
- default n
- endif
- endif
- config RT_USING_USB_DEVICE
- bool "Using USB device"
- default n
- select RT_USING_USB
-
- if RT_USING_USB_DEVICE || RT_USING_USB_HOST
- config RT_USBD_THREAD_STACK_SZ
- int "usb thread stack size"
- default 4096
- endif
- if RT_USING_USB_DEVICE
- config USB_VENDOR_ID
- hex "USB Vendor ID"
- default 0x0FFE
- config USB_PRODUCT_ID
- hex "USB Product ID"
- default 0x0001
-
- config RT_USB_DEVICE_COMPOSITE
- bool "Enable composite device"
- default n
- choice
- prompt "Device type"
- default _RT_USB_DEVICE_NONE
- depends on !RT_USB_DEVICE_COMPOSITE
- config _RT_USB_DEVICE_NONE
- bool "Using custom class by register interface"
- select RT_USB_DEVICE_NONE
- config _RT_USB_DEVICE_CDC
- bool "Enable to use device as CDC device"
- select RT_USB_DEVICE_CDC
- config _RT_USB_DEVICE_MSTORAGE
- bool "Enable to use device as Mass Storage device"
- select RT_USB_DEVICE_MSTORAGE
- config _RT_USB_DEVICE_HID
- bool "Enable to use device as HID device"
- select RT_USB_DEVICE_HID
- config _RT_USB_DEVICE_RNDIS
- bool "Enable to use device as rndis device"
- select RT_USB_DEVICE_RNDIS
- depends on RT_USING_LWIP
- config _RT_USB_DEVICE_ECM
- bool "Enable to use device as ecm device"
- select RT_USB_DEVICE_ECM
- depends on RT_USING_LWIP
- config _RT_USB_DEVICE_WINUSB
- bool "Enable to use device as winusb device"
- select RT_USB_DEVICE_WINUSB
- config _RT_USB_DEVICE_AUDIO
- bool "Enable to use device as audio device"
- select RT_USB_DEVICE_AUDIO
- endchoice
- if RT_USB_DEVICE_COMPOSITE
- config RT_USB_DEVICE_CDC
- bool "Enable to use device as CDC device"
- default n
- config RT_USB_DEVICE_NONE
- bool
- default y
- config RT_USB_DEVICE_MSTORAGE
- bool "Enable to use device as Mass Storage device"
- default n
- config RT_USB_DEVICE_HID
- bool "Enable to use device as HID device"
- default n
- config RT_USB_DEVICE_RNDIS
- bool "Enable to use device as rndis device"
- default n
- depends on RT_USING_LWIP
- config RT_USB_DEVICE_ECM
- bool "Enable to use device as ecm device"
- default n
- depends on RT_USING_LWIP
- config RT_USB_DEVICE_WINUSB
- bool "Enable to use device as winusb device"
- default n
- config RT_USB_DEVICE_AUDIO
- bool "Enable to use device as audio device"
- default n
- endif
- if RT_USB_DEVICE_CDC
- config RT_VCOM_TASK_STK_SIZE
- int "virtual com thread stack size"
- default 512
- config RT_CDC_RX_BUFSIZE
- int "virtual com rx buffer size"
- default 128
- config RT_VCOM_TX_USE_DMA
- bool "Enable to use dma for vcom tx"
- default n
- config RT_VCOM_SERNO
- string "serial number of virtual com"
- default "32021919830108"
- config RT_VCOM_SER_LEN
- int "serial number length of virtual com"
- default 14
- config RT_VCOM_TX_TIMEOUT
- int "tx timeout(ticks) of virtual com"
- default 1000
- endif
- if RT_USB_DEVICE_WINUSB
- config RT_WINUSB_GUID
- string "Guid for winusb"
- default "{6860DC3C-C05F-4807-8807-1CA861CC1D66}"
- endif
- if RT_USB_DEVICE_MSTORAGE
- config RT_USB_MSTORAGE_DISK_NAME
- string "msc class disk name"
- default "flash0"
- endif
-
- if RT_USB_DEVICE_RNDIS
- config RNDIS_DELAY_LINK_UP
- bool "Delay linkup media connection"
- select RT_USING_TIMER_SOFT
- default n
- endif
-
- if RT_USB_DEVICE_HID
- config RT_USB_DEVICE_HID_KEYBOARD
- bool "Use to HID device as Keyboard"
- default n
- if RT_USB_DEVICE_HID_KEYBOARD
- config RT_USB_DEVICE_HID_KEYBOARD_NUMBER
- int "Number of Keyboard(max 3)"
- default 1
- range 1 3
- endif
- config RT_USB_DEVICE_HID_MOUSE
- bool "Use to HID device as Mouse"
- default n
- config RT_USB_DEVICE_HID_GENERAL
- bool "Use to HID device as General HID device"
- default y
- if RT_USB_DEVICE_HID_GENERAL
- config RT_USB_DEVICE_HID_GENERAL_OUT_REPORT_LENGTH
- int "General HID device out report length"
- default 63
- range 0 63
-
- config RT_USB_DEVICE_HID_GENERAL_IN_REPORT_LENGTH
- int "General HID device in report length"
- default 63
- range 0 63
- endif
- config RT_USB_DEVICE_HID_MEDIA
- bool "Use to HID device as media keyboard"
- default y
- endif
- if RT_USB_DEVICE_AUDIO
- config RT_USB_DEVICE_AUDIO_MIC
- bool "Use usb mic device as audio device"
- default n
- if RT_USB_DEVICE_AUDIO_MIC
- config RT_USBD_MIC_DEVICE_NAME
- string "audio mic device name"
- default "mic0"
- endif
- config RT_USB_DEVICE_AUDIO_SPEAKER
- bool "Use usb speaker device as audio device"
- default n
- if RT_USB_DEVICE_AUDIO_SPEAKER
- config RT_USBD_SPEAKER_DEVICE_NAME
- string "audio speaker device name"
- default "sound0"
- endif
- endif
- endif
-endmenu
+rsource "usb/Kconfig"
+rsource "fdt/Kconfig"
diff --git a/components/legacy/fdt/Kconfig b/components/legacy/fdt/Kconfig
new file mode 100644
index 0000000000..af3c4efd1a
--- /dev/null
+++ b/components/legacy/fdt/Kconfig
@@ -0,0 +1,15 @@
+config RT_USING_FDT
+ bool "Using fdt legacy version"
+ default n
+ if RT_USING_FDT
+ config RT_USING_FDTLIB
+ bool "Using fdt lib for device drivers"
+ default y
+ config RT_USING_FDT_FWNODE
+ bool "Using fdt fwnode for device drivers"
+ default n
+ config FDT_USING_DEBUG
+ bool "Using fdt debug function "
+ default n
+
+ endif
diff --git a/components/drivers/fdt/README.md b/components/legacy/fdt/README.md
index d8a049c8fc..d8a049c8fc 100644
--- a/components/drivers/fdt/README.md
+++ b/components/legacy/fdt/README.md
diff --git a/components/drivers/fdt/SConscript b/components/legacy/fdt/SConscript
index d916b2dfbc..d916b2dfbc 100644
--- a/components/drivers/fdt/SConscript
+++ b/components/legacy/fdt/SConscript
diff --git a/components/drivers/fdt/docs/README.md b/components/legacy/fdt/docs/README.md
index f57e0a8e75..f57e0a8e75 100644
--- a/components/drivers/fdt/docs/README.md
+++ b/components/legacy/fdt/docs/README.md
diff --git a/components/drivers/fdt/docs/api.md b/components/legacy/fdt/docs/api.md
index 13471de06f..13471de06f 100644
--- a/components/drivers/fdt/docs/api.md
+++ b/components/legacy/fdt/docs/api.md
diff --git a/components/drivers/fdt/docs/examples.md b/components/legacy/fdt/docs/examples.md
index aa3e655987..aa3e655987 100644
--- a/components/drivers/fdt/docs/examples.md
+++ b/components/legacy/fdt/docs/examples.md
diff --git a/components/drivers/fdt/docs/version.md b/components/legacy/fdt/docs/version.md
index 3c3499d91a..3c3499d91a 100644
--- a/components/drivers/fdt/docs/version.md
+++ b/components/legacy/fdt/docs/version.md
diff --git a/components/drivers/fdt/examples/SConscript b/components/legacy/fdt/examples/SConscript
index 463c4814cc..463c4814cc 100644
--- a/components/drivers/fdt/examples/SConscript
+++ b/components/legacy/fdt/examples/SConscript
diff --git a/components/drivers/fdt/examples/fdt_test.c b/components/legacy/fdt/examples/fdt_test.c
index 4bf2879256..4bf2879256 100644
--- a/components/drivers/fdt/examples/fdt_test.c
+++ b/components/legacy/fdt/examples/fdt_test.c
diff --git a/components/legacy/fdt/inc/dtb_fwnode.h b/components/legacy/fdt/inc/dtb_fwnode.h
new file mode 100644
index 0000000000..e8d303e37d
--- /dev/null
+++ b/components/legacy/fdt/inc/dtb_fwnode.h
@@ -0,0 +1,125 @@
+#ifndef __DTB_FWNODE_H__
+#define __DTB_FWNODE_H__
+
+#include "libfdt_env.h"
+#include <rtthread.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+struct fwnode_operations;
+struct rt_device;
+
+#define FWNODE_FLAG_LINKS_ADDED 0x01
+#define FWNODE_FLAG_NOT_DEVICE 0x02
+#define FWNODE_FLAG_INITIALIZED 0x04
+
+#define NR_FWNODE_REFERENCE_ARGS 8
+
+struct fwnode_handle
+{
+ struct fwnode_handle *secondary;
+ const struct fwnode_operations *ops;
+ struct rt_device *dev;
+ struct rt_list_node suppliers;
+ struct rt_list_node consumers;
+ uint8_t flags;
+};
+
+struct fwnode_link
+{
+ struct fwnode_handle *supplier;
+ struct rt_list_node s_hook;
+ struct fwnode_handle *consumer;
+ struct rt_list_node c_hook;
+};
+
+struct fwnode_endpoint
+{
+ unsigned int port;
+ unsigned int id;
+ const struct fwnode_handle *local_fwnode;
+};
+
+struct fwnode_reference_args
+{
+ struct fwnode_handle *fwnode;
+ unsigned int nargs;
+ uint64_t args[NR_FWNODE_REFERENCE_ARGS];
+};
+
+struct fwnode_operations
+{
+ struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
+ void (*put)(struct fwnode_handle *fwnode);
+ bool (*device_is_available)(const struct fwnode_handle *fwnode);
+ const void *(*device_get_match_data)(const struct fwnode_handle *fwnode,
+ const struct rt_device *dev);
+ bool (*property_present)(const struct fwnode_handle *fwnode,
+ const char *propname);
+ int (*property_read_int_array)(const struct fwnode_handle *fwnode,
+ const char *propname,
+ unsigned int elem_size, void *val,
+ size_t nval);
+ int (*property_read_string_array)(const struct fwnode_handle *fwnode_handle,
+ const char *propname, const char **val,
+ size_t nval);
+ const char *(*get_name)(const struct fwnode_handle *fwnode);
+ const char *(*get_name_prefix)(const struct fwnode_handle *fwnode);
+ struct fwnode_handle *(*get_parent)(const struct fwnode_handle *fwnode);
+ struct fwnode_handle *(*get_next_child_node)(const struct fwnode_handle *fwnode,
+ struct fwnode_handle *child);
+ struct fwnode_handle *(*get_named_child_node)(const struct fwnode_handle *fwnode,
+ const char *name);
+ int (*get_reference_args)(const struct fwnode_handle *fwnode,
+ const char *prop, const char *nargs_prop,
+ unsigned int nargs, unsigned int index,
+ struct fwnode_reference_args *args);
+ struct fwnode_handle *(*graph_get_next_endpoint)(const struct fwnode_handle *fwnode,
+ struct fwnode_handle *prev);
+ struct fwnode_handle *(*graph_get_remote_endpoint)(const struct fwnode_handle *fwnode);
+ struct fwnode_handle *(*graph_get_port_parent)(struct fwnode_handle *fwnode);
+ int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
+ struct fwnode_endpoint *endpoint);
+ int (*add_links)(struct fwnode_handle *fwnode);
+};
+
+#define fwnode_has_op(fwnode, op) \
+ ((fwnode) && (fwnode)->ops && (fwnode)->ops->op)
+#define fwnode_call_int_op(fwnode, op, ...) \
+ (fwnode ? (fwnode_has_op(fwnode, op) ? (fwnode)->ops->op(fwnode, ##__VA_ARGS__) : -ENXIO) : -EINVAL)
+
+#define fwnode_call_bool_op(fwnode, op, ...) \
+ (fwnode_has_op(fwnode, op) ? (fwnode)->ops->op(fwnode, ##__VA_ARGS__) : false)
+
+#define fwnode_call_ptr_op(fwnode, op, ...) \
+ (fwnode_has_op(fwnode, op) ? (fwnode)->ops->op(fwnode, ##__VA_ARGS__) : NULL)
+#define fwnode_call_void_op(fwnode, op, ...) \
+ do \
+ { \
+ if (fwnode_has_op(fwnode, op)) \
+ (fwnode)->ops->op(fwnode, ##__VA_ARGS__); \
+ } while (false)
+
+#define get_dev_from_fwnode(fwnode) ((fwnode)->dev)
+
+static inline void fwnode_init(struct fwnode_handle *fwnode,
+ const struct fwnode_operations *ops)
+{
+ fwnode->ops = ops;
+ rt_list_init(&fwnode->consumers);
+ rt_list_init(&fwnode->suppliers);
+}
+
+static inline void fwnode_dev_initialized(struct fwnode_handle *fwnode,
+ bool initialized)
+{
+ if (!fwnode)
+ return;
+
+ if (initialized)
+ fwnode->flags |= FWNODE_FLAG_INITIALIZED;
+ else
+ fwnode->flags &= ~FWNODE_FLAG_INITIALIZED;
+}
+
+#endif //__DTB_FWNODE_H__
diff --git a/components/drivers/fdt/inc/dtb_node.h b/components/legacy/fdt/inc/dtb_node.h
index 7d780e9948..716d4a3082 100644
--- a/components/drivers/fdt/inc/dtb_node.h
+++ b/components/legacy/fdt/inc/dtb_node.h
@@ -10,6 +10,10 @@
#include <rtthread.h>
#include <stdint.h>
+#ifdef RT_USING_FDT_FWNODE
+#include "dtb_fwnode.h"
+#endif
+
//#define RT_DTB_DEBUG
#ifdef RT_DTB_DEBUG
#define debug(fmt, args...) rt_kprintf(fmt, ##args)
@@ -17,9 +21,9 @@
#define debug(fmt, args...)
#endif
-#define ERR_PTR(err) ((void *)((long)(err)))
-#define PTR_ERR(ptr) ((long)(ptr))
-#define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)(-1000))
+#define DTB_ERR_PTR(err) ((void *)((long)(err)))
+#define DTB_PTR_ERR(ptr) ((long)(ptr))
+#define DTB_IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)(-1000))
#define DEV_ROOT_NODE_ADDR_CELLS_DEFAULT 2
#define DEV_ROOT_NODE_SIZE_CELLS_DEFAULT 1
@@ -71,7 +75,10 @@ struct dtb_node
const char *path;
phandle handle;
int level;
-
+#ifdef RT_USING_FDT_FWNODE
+ struct fwnode_handle fwnode;
+ unsigned long _flags;
+#endif
struct dtb_property *properties;
struct dtb_node *parent;
struct dtb_node *child;
@@ -382,4 +389,12 @@ int dtb_node_irq_count(struct dtb_node *dev);
dtb_node_valid(node); \
node = dtb_node_next_subnode(node))
+#ifdef RT_USING_FDT_FWNODE
+extern const struct fwnode_operations of_fwnode_ops;
+static inline void dtb_fwnode_init(struct dtb_node *node)
+{
+ fwnode_init(&node->fwnode, &of_fwnode_ops);
+}
+#endif
+
#endif /* RT_FDT_H__ */
diff --git a/components/drivers/fdt/libfdt/SConscript b/components/legacy/fdt/libfdt/SConscript
index 9efdd16c0a..9efdd16c0a 100644
--- a/components/drivers/fdt/libfdt/SConscript
+++ b/components/legacy/fdt/libfdt/SConscript
diff --git a/components/drivers/fdt/libfdt/fdt.c b/components/legacy/fdt/libfdt/fdt.c
index ecc7e8abee..ecc7e8abee 100644
--- a/components/drivers/fdt/libfdt/fdt.c
+++ b/components/legacy/fdt/libfdt/fdt.c
diff --git a/components/drivers/fdt/libfdt/fdt.h b/components/legacy/fdt/libfdt/fdt.h
index a00161cced..a00161cced 100644
--- a/components/drivers/fdt/libfdt/fdt.h
+++ b/components/legacy/fdt/libfdt/fdt.h
diff --git a/components/drivers/fdt/libfdt/fdt_addresses.c b/components/legacy/fdt/libfdt/fdt_addresses.c
index a8f2ad5ebc..a8f2ad5ebc 100644
--- a/components/drivers/fdt/libfdt/fdt_addresses.c
+++ b/components/legacy/fdt/libfdt/fdt_addresses.c
diff --git a/components/drivers/fdt/libfdt/fdt_empty_tree.c b/components/legacy/fdt/libfdt/fdt_empty_tree.c
index 0f317a4726..0f317a4726 100644
--- a/components/drivers/fdt/libfdt/fdt_empty_tree.c
+++ b/components/legacy/fdt/libfdt/fdt_empty_tree.c
diff --git a/components/drivers/fdt/libfdt/fdt_ro.c b/components/legacy/fdt/libfdt/fdt_ro.c
index ff8b7fbdc0..ff8b7fbdc0 100644
--- a/components/drivers/fdt/libfdt/fdt_ro.c
+++ b/components/legacy/fdt/libfdt/fdt_ro.c
diff --git a/components/drivers/fdt/libfdt/fdt_rw.c b/components/legacy/fdt/libfdt/fdt_rw.c
index 58827ef898..58827ef898 100644
--- a/components/drivers/fdt/libfdt/fdt_rw.c
+++ b/components/legacy/fdt/libfdt/fdt_rw.c
diff --git a/components/drivers/fdt/libfdt/fdt_strerror.c b/components/legacy/fdt/libfdt/fdt_strerror.c
index a62aad11ed..a62aad11ed 100644
--- a/components/drivers/fdt/libfdt/fdt_strerror.c
+++ b/components/legacy/fdt/libfdt/fdt_strerror.c
diff --git a/components/drivers/fdt/libfdt/fdt_sw.c b/components/legacy/fdt/libfdt/fdt_sw.c
index 4834d01b48..4834d01b48 100644
--- a/components/drivers/fdt/libfdt/fdt_sw.c
+++ b/components/legacy/fdt/libfdt/fdt_sw.c
diff --git a/components/drivers/fdt/libfdt/fdt_wip.c b/components/legacy/fdt/libfdt/fdt_wip.c
index a817fefdbe..a817fefdbe 100644
--- a/components/drivers/fdt/libfdt/fdt_wip.c
+++ b/components/legacy/fdt/libfdt/fdt_wip.c
diff --git a/components/drivers/fdt/libfdt/libfdt.h b/components/legacy/fdt/libfdt/libfdt.h
index 8593f10ae8..8593f10ae8 100644
--- a/components/drivers/fdt/libfdt/libfdt.h
+++ b/components/legacy/fdt/libfdt/libfdt.h
diff --git a/components/drivers/fdt/libfdt/libfdt_env.h b/components/legacy/fdt/libfdt/libfdt_env.h
index 3acc87f2bb..3acc87f2bb 100644
--- a/components/drivers/fdt/libfdt/libfdt_env.h
+++ b/components/legacy/fdt/libfdt/libfdt_env.h
diff --git a/components/drivers/fdt/libfdt/libfdt_internal.h b/components/legacy/fdt/libfdt/libfdt_internal.h
index b813e58167..b813e58167 100644
--- a/components/drivers/fdt/libfdt/libfdt_internal.h
+++ b/components/legacy/fdt/libfdt/libfdt_internal.h
diff --git a/components/drivers/fdt/src/SConscript b/components/legacy/fdt/src/SConscript
index 23f4af644e..23f4af644e 100644
--- a/components/drivers/fdt/src/SConscript
+++ b/components/legacy/fdt/src/SConscript
diff --git a/components/drivers/fdt/src/dtb_access.c b/components/legacy/fdt/src/dtb_access.c
index e80192e7b4..dbc5191f7d 100644
--- a/components/drivers/fdt/src/dtb_access.c
+++ b/components/legacy/fdt/src/dtb_access.c
@@ -28,11 +28,11 @@ static void *dtb_node_find_property_value_of_size(const struct dtb_node *dn,
struct dtb_property *prop = dtb_node_get_dtb_node_property(dn, propname, NULL);
if (!prop)
- return ERR_PTR(-EINVAL);
+ return DTB_ERR_PTR(-EINVAL);
if (!prop->value)
- return ERR_PTR(-ENODATA);
+ return DTB_ERR_PTR(-ENODATA);
if (len > prop->size)
- return ERR_PTR(-EOVERFLOW);
+ return DTB_ERR_PTR(-EOVERFLOW);
return prop->value;
}
@@ -44,10 +44,10 @@ int dtb_node_read_u32(const struct dtb_node *dn, const char *propname, uint32_t
if (!dn)
return -EINVAL;
val = dtb_node_find_property_value_of_size(dn, propname, sizeof(*outp));
- if (IS_ERR(val))
+ if (DTB_IS_ERR(val))
{
debug("(not found)\n");
- return PTR_ERR(val);
+ return DTB_PTR_ERR(val);
}
*outp = fdt32_to_cpu(*val);
@@ -72,8 +72,8 @@ int dtb_node_read_u32_array(const struct dtb_node *dn, const char *propname,
val = dtb_node_find_property_value_of_size(dn, propname,
sz * sizeof(*out_values));
- if (IS_ERR(val))
- return PTR_ERR(val);
+ if (DTB_IS_ERR(val))
+ return DTB_PTR_ERR(val);
debug("size %zd, val:%d\n", sz, *val);
while (sz--)
@@ -110,10 +110,10 @@ int dtb_node_read_u32_index(const struct dtb_node *dn, const char *propname,
val = dtb_node_find_property_value_of_size(dn, propname,
sizeof(*outp) * (index + 1));
- if (IS_ERR(val))
+ if (DTB_IS_ERR(val))
{
debug("(not found)\n");
- return PTR_ERR(val);
+ return DTB_PTR_ERR(val);
}
*outp = fdt32_to_cpu(val[index]);
@@ -130,10 +130,10 @@ int dtb_node_read_u64(const struct dtb_node *dn, const char *propname, uint64_t
if (!dn)
return -EINVAL;
val = dtb_node_find_property_value_of_size(dn, propname, sizeof(*outp));
- if (IS_ERR(val))
+ if (DTB_IS_ERR(val))
{
debug("(not found)\n");
- return PTR_ERR(val);
+ return DTB_PTR_ERR(val);
}
*outp = fdt64_to_cpu(*val);
diff --git a/components/drivers/fdt/src/dtb_addr.c b/components/legacy/fdt/src/dtb_addr.c
index 5516ff1e6c..5516ff1e6c 100644
--- a/components/drivers/fdt/src/dtb_addr.c
+++ b/components/legacy/fdt/src/dtb_addr.c
diff --git a/components/drivers/fdt/src/dtb_base.c b/components/legacy/fdt/src/dtb_base.c
index eb71de429a..eb71de429a 100644
--- a/components/drivers/fdt/src/dtb_base.c
+++ b/components/legacy/fdt/src/dtb_base.c
diff --git a/components/drivers/fdt/src/dtb_get.c b/components/legacy/fdt/src/dtb_get.c
index 51c3f5ee1d..e4e700114f 100644
--- a/components/drivers/fdt/src/dtb_get.c
+++ b/components/legacy/fdt/src/dtb_get.c
@@ -69,6 +69,10 @@ static int _dtb_node_get_dtb_nodes_list(struct dtb_node *dtb_node_head, struct d
int pathname_sz;
int node_name_sz;
+#ifdef RT_USING_FDT_FWNODE
+ dtb_fwnode_init(dtb_node_head);
+#endif
+
/* caller alrealy checked current_fdt */
if ((root_off = fdt_path_offset(current_fdt, pathname)) >= 0)
{
@@ -113,7 +117,9 @@ static int _dtb_node_get_dtb_nodes_list(struct dtb_node *dtb_node_head, struct d
{
return FDT_RET_NO_MEMORY;
}
-
+#ifdef RT_USING_FDT_FWNODE
+ dtb_fwnode_init(dtb_node);
+#endif
fdt_exec_status = _dtb_node_get_dtb_properties_list(dtb_node->properties, node_off);
if (fdt_exec_status == FDT_RET_GET_EMPTY)
{
diff --git a/components/drivers/fdt/src/dtb_head.c b/components/legacy/fdt/src/dtb_head.c
index 6142673393..6142673393 100644
--- a/components/drivers/fdt/src/dtb_head.c
+++ b/components/legacy/fdt/src/dtb_head.c
diff --git a/components/drivers/fdt/src/dtb_load.c b/components/legacy/fdt/src/dtb_load.c
index c4ac535fdf..c4ac535fdf 100644
--- a/components/drivers/fdt/src/dtb_load.c
+++ b/components/legacy/fdt/src/dtb_load.c
diff --git a/components/drivers/fdt/src/dtb_set.c b/components/legacy/fdt/src/dtb_set.c
index f0e11b6b4f..f0e11b6b4f 100644
--- a/components/drivers/fdt/src/dtb_set.c
+++ b/components/legacy/fdt/src/dtb_set.c
diff --git a/components/legacy/usb/Kconfig b/components/legacy/usb/Kconfig
new file mode 100644
index 0000000000..d20c0f92f9
--- /dev/null
+++ b/components/legacy/usb/Kconfig
@@ -0,0 +1,200 @@
+menu "Using USB legacy version"
+ config RT_USING_USB
+ bool
+ default n
+
+ config RT_USING_USB_HOST
+ bool "Using USB host"
+ default n
+ select RT_USING_USB
+
+ if RT_USING_USB_HOST
+ config RT_USBH_MSTORAGE
+ bool "Enable Udisk Drivers"
+ default n
+ if RT_USBH_MSTORAGE
+ config UDISK_MOUNTPOINT
+ string "Udisk mount dir"
+ default "/"
+ endif
+ config RT_USBH_HID
+ bool "Enable HID Drivers"
+ default n
+ if RT_USBH_HID
+ config RT_USBH_HID_MOUSE
+ bool "Enable HID mouse protocol"
+ default n
+ config RT_USBH_HID_KEYBOARD
+ bool "Enable HID keyboard protocol"
+ default n
+ endif
+ endif
+ config RT_USING_USB_DEVICE
+ bool "Using USB device"
+ default n
+ select RT_USING_USB
+
+ if RT_USING_USB_DEVICE || RT_USING_USB_HOST
+ config RT_USBD_THREAD_STACK_SZ
+ int "usb thread stack size"
+ default 4096
+ endif
+ if RT_USING_USB_DEVICE
+ config USB_VENDOR_ID
+ hex "USB Vendor ID"
+ default 0x0FFE
+ config USB_PRODUCT_ID
+ hex "USB Product ID"
+ default 0x0001
+
+ config RT_USB_DEVICE_COMPOSITE
+ bool "Enable composite device"
+ default n
+ choice
+ prompt "Device type"
+ default _RT_USB_DEVICE_NONE
+ depends on !RT_USB_DEVICE_COMPOSITE
+ config _RT_USB_DEVICE_NONE
+ bool "Using custom class by register interface"
+ select RT_USB_DEVICE_NONE
+ config _RT_USB_DEVICE_CDC
+ bool "Enable to use device as CDC device"
+ select RT_USB_DEVICE_CDC
+ config _RT_USB_DEVICE_MSTORAGE
+ bool "Enable to use device as Mass Storage device"
+ select RT_USB_DEVICE_MSTORAGE
+ config _RT_USB_DEVICE_HID
+ bool "Enable to use device as HID device"
+ select RT_USB_DEVICE_HID
+ config _RT_USB_DEVICE_RNDIS
+ bool "Enable to use device as rndis device"
+ select RT_USB_DEVICE_RNDIS
+ depends on RT_USING_LWIP
+ config _RT_USB_DEVICE_ECM
+ bool "Enable to use device as ecm device"
+ select RT_USB_DEVICE_ECM
+ depends on RT_USING_LWIP
+ config _RT_USB_DEVICE_WINUSB
+ bool "Enable to use device as winusb device"
+ select RT_USB_DEVICE_WINUSB
+ config _RT_USB_DEVICE_AUDIO
+ bool "Enable to use device as audio device"
+ select RT_USB_DEVICE_AUDIO
+ endchoice
+ if RT_USB_DEVICE_COMPOSITE
+ config RT_USB_DEVICE_CDC
+ bool "Enable to use device as CDC device"
+ default n
+ config RT_USB_DEVICE_NONE
+ bool
+ default y
+ config RT_USB_DEVICE_MSTORAGE
+ bool "Enable to use device as Mass Storage device"
+ default n
+ config RT_USB_DEVICE_HID
+ bool "Enable to use device as HID device"
+ default n
+ config RT_USB_DEVICE_RNDIS
+ bool "Enable to use device as rndis device"
+ default n
+ depends on RT_USING_LWIP
+ config RT_USB_DEVICE_ECM
+ bool "Enable to use device as ecm device"
+ default n
+ depends on RT_USING_LWIP
+ config RT_USB_DEVICE_WINUSB
+ bool "Enable to use device as winusb device"
+ default n
+ config RT_USB_DEVICE_AUDIO
+ bool "Enable to use device as audio device"
+ default n
+ endif
+ if RT_USB_DEVICE_CDC
+ config RT_VCOM_TASK_STK_SIZE
+ int "virtual com thread stack size"
+ default 512
+ config RT_CDC_RX_BUFSIZE
+ int "virtual com rx buffer size"
+ default 128
+ config RT_VCOM_TX_USE_DMA
+ bool "Enable to use dma for vcom tx"
+ default n
+ config RT_VCOM_SERNO
+ string "serial number of virtual com"
+ default "32021919830108"
+ config RT_VCOM_SER_LEN
+ int "serial number length of virtual com"
+ default 14
+ config RT_VCOM_TX_TIMEOUT
+ int "tx timeout(ticks) of virtual com"
+ default 1000
+ endif
+ if RT_USB_DEVICE_WINUSB
+ config RT_WINUSB_GUID
+ string "Guid for winusb"
+ default "{6860DC3C-C05F-4807-8807-1CA861CC1D66}"
+ endif
+ if RT_USB_DEVICE_MSTORAGE
+ config RT_USB_MSTORAGE_DISK_NAME
+ string "msc class disk name"
+ default "flash0"
+ endif
+
+ if RT_USB_DEVICE_RNDIS
+ config RNDIS_DELAY_LINK_UP
+ bool "Delay linkup media connection"
+ select RT_USING_TIMER_SOFT
+ default n
+ endif
+
+ if RT_USB_DEVICE_HID
+ config RT_USB_DEVICE_HID_KEYBOARD
+ bool "Use to HID device as Keyboard"
+ default n
+ if RT_USB_DEVICE_HID_KEYBOARD
+ config RT_USB_DEVICE_HID_KEYBOARD_NUMBER
+ int "Number of Keyboard(max 3)"
+ default 1
+ range 1 3
+ endif
+ config RT_USB_DEVICE_HID_MOUSE
+ bool "Use to HID device as Mouse"
+ default n
+ config RT_USB_DEVICE_HID_GENERAL
+ bool "Use to HID device as General HID device"
+ default y
+ if RT_USB_DEVICE_HID_GENERAL
+ config RT_USB_DEVICE_HID_GENERAL_OUT_REPORT_LENGTH
+ int "General HID device out report length"
+ default 63
+ range 0 63
+
+ config RT_USB_DEVICE_HID_GENERAL_IN_REPORT_LENGTH
+ int "General HID device in report length"
+ default 63
+ range 0 63
+ endif
+ config RT_USB_DEVICE_HID_MEDIA
+ bool "Use to HID device as media keyboard"
+ default y
+ endif
+ if RT_USB_DEVICE_AUDIO
+ config RT_USB_DEVICE_AUDIO_MIC
+ bool "Use usb mic device as audio device"
+ default n
+ if RT_USB_DEVICE_AUDIO_MIC
+ config RT_USBD_MIC_DEVICE_NAME
+ string "audio mic device name"
+ default "mic0"
+ endif
+ config RT_USB_DEVICE_AUDIO_SPEAKER
+ bool "Use usb speaker device as audio device"
+ default n
+ if RT_USB_DEVICE_AUDIO_SPEAKER
+ config RT_USBD_SPEAKER_DEVICE_NAME
+ string "audio speaker device name"
+ default "sound0"
+ endif
+ endif
+ endif
+endmenu