mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 09:52:31 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -34,6 +34,18 @@ fdt_addr_t devfdt_get_addr(struct udevice *dev);
|
||||
*/
|
||||
void *devfdt_get_addr_ptr(struct udevice *dev);
|
||||
|
||||
/**
|
||||
* devfdt_remap_addr_index() - Return indexed pointer to the memory-mapped
|
||||
* I/O address of the reg property of a device
|
||||
* @index: the 'reg' property can hold a list of <addr, size> pairs
|
||||
* and @index is used to select which one is required
|
||||
*
|
||||
* @dev: Pointer to a device
|
||||
*
|
||||
* Return: Pointer to addr, or NULL if there is no such property
|
||||
*/
|
||||
void *devfdt_remap_addr_index(struct udevice *dev, int index);
|
||||
|
||||
/**
|
||||
* devfdt_map_physmem() - Read device address from reg property of the
|
||||
* device node and map the address into CPU address
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#ifndef __PINCTRL_H
|
||||
#define __PINCTRL_H
|
||||
|
||||
#define PINNAME_SIZE 10
|
||||
#define PINMUX_SIZE 40
|
||||
|
||||
/**
|
||||
* struct pinconf_param - pin config parameters
|
||||
*
|
||||
@@ -32,29 +35,33 @@ struct pinconf_param {
|
||||
* depending on your necessity.
|
||||
*
|
||||
* @get_pins_count: return number of selectable named pins available
|
||||
* in this driver. (necessary to parse "pins" property in DTS)
|
||||
* in this driver. (necessary to parse "pins" property in DTS)
|
||||
* @get_pin_name: return the pin name of the pin selector,
|
||||
* called by the core to figure out which pin it shall do
|
||||
* operations to. (necessary to parse "pins" property in DTS)
|
||||
* operations to. (necessary to parse "pins" property in DTS)
|
||||
* @get_groups_count: return number of selectable named groups available
|
||||
* in this driver. (necessary to parse "groups" property in DTS)
|
||||
* in this driver. (necessary to parse "groups" property in DTS)
|
||||
* @get_group_name: return the group name of the group selector,
|
||||
* called by the core to figure out which pin group it shall do
|
||||
* operations to. (necessary to parse "groups" property in DTS)
|
||||
* operations to. (necessary to parse "groups" property in DTS)
|
||||
* @get_functions_count: return number of selectable named functions available
|
||||
* in this driver. (necessary for pin-muxing)
|
||||
* in this driver. (necessary for pin-muxing)
|
||||
* @get_function_name: return the function name of the muxing selector,
|
||||
* called by the core to figure out which mux setting it shall map a
|
||||
* certain device to. (necessary for pin-muxing)
|
||||
* certain device to. (necessary for pin-muxing)
|
||||
* @pinmux_set: enable a certain muxing function with a certain pin.
|
||||
* The @func_selector selects a certain function whereas @pin_selector
|
||||
* selects a certain pin to be used. On simple controllers one of them
|
||||
* may be ignored. (necessary for pin-muxing against a single pin)
|
||||
* may be ignored. (necessary for pin-muxing against a single pin)
|
||||
* @pinmux_group_set: enable a certain muxing function with a certain pin
|
||||
* group. The @func_selector selects a certain function whereas
|
||||
* group. The @func_selector selects a certain function whereas
|
||||
* @group_selector selects a certain set of pins to be used. On simple
|
||||
* controllers one of them may be ignored.
|
||||
* (necessary for pin-muxing against a pin group)
|
||||
* @pinmux_property_set: enable a pinmux group. @pinmux_group should specify the
|
||||
* pin identifier and mux settings. The exact format of a pinmux group is
|
||||
* left up to the driver. The pin selector for the mux-ed pin should be
|
||||
* returned on success. (necessary to parse the "pinmux" property in DTS)
|
||||
* @pinconf_num_params: number of driver-specific parameters to be parsed
|
||||
* from device trees (necessary for pin-configuration)
|
||||
* @pinconf_params: list of driver_specific parameters to be parsed from
|
||||
@@ -67,6 +74,14 @@ struct pinconf_param {
|
||||
* pointing a config node. (necessary for pinctrl_full)
|
||||
* @set_state_simple: do needed pinctrl operations for a peripherl @periph.
|
||||
* (necessary for pinctrl_simple)
|
||||
* @get_pin_muxing: display the muxing of a given pin.
|
||||
* @gpio_request_enable: requests and enables GPIO on a certain pin.
|
||||
* Implement this only if you can mux every pin individually as GPIO. The
|
||||
* affected GPIO range is passed along with an offset(pin number) into that
|
||||
* specific GPIO range - function selectors and pin groups are orthogonal
|
||||
* to this, the core will however make sure the pins do not collide.
|
||||
* @gpio_disable_free: free up GPIO muxing on a certain pin, the reverse of
|
||||
* @gpio_request_enable
|
||||
*/
|
||||
struct pinctrl_ops {
|
||||
int (*get_pins_count)(struct udevice *dev);
|
||||
@@ -80,6 +95,7 @@ struct pinctrl_ops {
|
||||
unsigned func_selector);
|
||||
int (*pinmux_group_set)(struct udevice *dev, unsigned group_selector,
|
||||
unsigned func_selector);
|
||||
int (*pinmux_property_set)(struct udevice *dev, u32 pinmux_group);
|
||||
unsigned int pinconf_num_params;
|
||||
const struct pinconf_param *pinconf_params;
|
||||
int (*pinconf_set)(struct udevice *dev, unsigned pin_selector,
|
||||
@@ -130,6 +146,42 @@ struct pinctrl_ops {
|
||||
* @return mux value (SoC-specific, e.g. 0 for input, 1 for output)
|
||||
*/
|
||||
int (*get_gpio_mux)(struct udevice *dev, int banknum, int index);
|
||||
|
||||
/**
|
||||
* get_pin_muxing() - show pin muxing
|
||||
*
|
||||
* This allows to display the muxing of a given pin. It's useful for
|
||||
* debug purpose to know if a pin is configured as GPIO or as an
|
||||
* alternate function and which one.
|
||||
* Typically it is used by a PINCTRL driver with knowledge of the SoC
|
||||
* pinctrl setup.
|
||||
*
|
||||
* @dev: Pinctrl device to use
|
||||
* @selector: Pin selector
|
||||
* @buf Pin's muxing description
|
||||
* @size Pin's muxing description length
|
||||
* return 0 if OK, -ve on error
|
||||
*/
|
||||
int (*get_pin_muxing)(struct udevice *dev, unsigned int selector,
|
||||
char *buf, int size);
|
||||
|
||||
/**
|
||||
* gpio_request_enable: requests and enables GPIO on a certain pin.
|
||||
*
|
||||
* @dev: Pinctrl device to use
|
||||
* @selector: Pin selector
|
||||
* return 0 if OK, -ve on error
|
||||
*/
|
||||
int (*gpio_request_enable)(struct udevice *dev, unsigned int selector);
|
||||
|
||||
/**
|
||||
* gpio_disable_free: free up GPIO muxing on a certain pin.
|
||||
*
|
||||
* @dev: Pinctrl device to use
|
||||
* @selector: Pin selector
|
||||
* return 0 if OK, -ve on error
|
||||
*/
|
||||
int (*gpio_disable_free)(struct udevice *dev, unsigned int selector);
|
||||
};
|
||||
|
||||
#define pinctrl_get_ops(dev) ((struct pinctrl_ops *)(dev)->driver->ops)
|
||||
@@ -331,6 +383,53 @@ int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index);
|
||||
* @return pins count
|
||||
*/
|
||||
int pinctrl_get_pins_count(struct udevice *dev);
|
||||
|
||||
/**
|
||||
* pinctrl_get_pin_name() - Returns the pin's name
|
||||
*
|
||||
* This allows to display the pin's name for debug purpose
|
||||
*
|
||||
* @dev: Pinctrl device to use
|
||||
* @selector Pin index within pin-controller
|
||||
* @buf Pin's name
|
||||
* @return 0 if OK, -ve on error
|
||||
*/
|
||||
int pinctrl_get_pin_name(struct udevice *dev, int selector, char *buf,
|
||||
int size);
|
||||
|
||||
/**
|
||||
* pinctrl_get_pin_muxing() - Returns the muxing description
|
||||
*
|
||||
* This allows to display the muxing description of the given pin for
|
||||
* debug purpose
|
||||
*
|
||||
* @dev: Pinctrl device to use
|
||||
* @selector Pin index within pin-controller
|
||||
* @buf Pin's muxing description
|
||||
* @size Pin's muxing description length
|
||||
* @return 0 if OK, -ve on error
|
||||
*/
|
||||
int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf,
|
||||
int size);
|
||||
|
||||
/**
|
||||
* pinctrl_gpio_request() - request a single pin to be used as GPIO
|
||||
*
|
||||
* @dev: GPIO peripheral device
|
||||
* @offset: the GPIO pin offset from the GPIO controller
|
||||
* @return: 0 on success, or negative error code on failure
|
||||
*/
|
||||
int pinctrl_gpio_request(struct udevice *dev, unsigned offset);
|
||||
|
||||
/**
|
||||
* pinctrl_gpio_free() - free a single pin used as GPIO
|
||||
*
|
||||
* @dev: GPIO peripheral device
|
||||
* @offset: the GPIO pin offset from the GPIO controller
|
||||
* @return: 0 on success, or negative error code on failure
|
||||
*/
|
||||
int pinctrl_gpio_free(struct udevice *dev, unsigned offset);
|
||||
|
||||
#else
|
||||
static inline int pinctrl_select_state(struct udevice *dev,
|
||||
const char *statename)
|
||||
@@ -367,6 +466,29 @@ static inline int pinctrl_get_pins_count(struct udevice *dev)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int pinctrl_get_pin_name(struct udevice *dev, int selector, char *buf,
|
||||
int size)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf,
|
||||
int size)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int pinctrl_gpio_request(struct udevice *dev, unsigned offset)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int pinctrl_gpio_free(struct udevice *dev, unsigned offset)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __PINCTRL_H */
|
||||
|
||||
@@ -270,6 +270,18 @@ int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
|
||||
*/
|
||||
int dev_read_addr_cells(struct udevice *dev);
|
||||
|
||||
/**
|
||||
* dev_remap_addr_index() - Get the indexed reg property of a device
|
||||
* as a memory-mapped I/O pointer
|
||||
*
|
||||
* @dev: Device to read from
|
||||
* @index: the 'reg' property can hold a list of <addr, size> pairs
|
||||
* and @index is used to select which one is required
|
||||
*
|
||||
* Return: pointer or NULL if not found
|
||||
*/
|
||||
void *dev_remap_addr_index(struct udevice *dev, int index);
|
||||
|
||||
/**
|
||||
* dev_read_size_cells() - Get the number of size cells for a device's node
|
||||
*
|
||||
@@ -588,6 +600,11 @@ static inline int dev_read_addr_cells(struct udevice *dev)
|
||||
return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
|
||||
}
|
||||
|
||||
static inline void *dev_remap_addr_index(struct udevice *dev, int index)
|
||||
{
|
||||
return devfdt_remap_addr_index(dev, index);
|
||||
}
|
||||
|
||||
static inline int dev_read_size_cells(struct udevice *dev)
|
||||
{
|
||||
/* NOTE: this call should walk up the parent stack */
|
||||
|
||||
@@ -57,6 +57,8 @@ enum {
|
||||
enum {
|
||||
DM_TEST_TYPE_FIRST = 0,
|
||||
DM_TEST_TYPE_SECOND,
|
||||
|
||||
DM_TEST_TYPE_COUNT,
|
||||
};
|
||||
|
||||
/* The number added to the ping total on each probe */
|
||||
|
||||
@@ -89,6 +89,7 @@ enum uclass_id {
|
||||
UCLASS_THERMAL, /* Thermal sensor */
|
||||
UCLASS_TIMER, /* Timer device */
|
||||
UCLASS_TPM, /* Trusted Platform Module TIS interface */
|
||||
UCLASS_UFS, /* Universal Flash Storage */
|
||||
UCLASS_USB, /* USB bus */
|
||||
UCLASS_USB_DEV_GENERIC, /* USB generic device */
|
||||
UCLASS_USB_HUB, /* USB hub */
|
||||
|
||||
@@ -267,17 +267,31 @@ int uclass_get_device_by_driver(enum uclass_id id, const struct driver *drv,
|
||||
* uclass_first_device() - Get the first device in a uclass
|
||||
*
|
||||
* The device returned is probed if necessary, and ready for use
|
||||
* Devices that fail to probe are skipped
|
||||
*
|
||||
* This function is useful to start iterating through a list of devices which
|
||||
* are functioning correctly and can be probed.
|
||||
*
|
||||
* @id: Uclass ID to look up
|
||||
* @devp: Returns pointer to the first device in that uclass if no error
|
||||
* occurred, or NULL if there is no first device, or an error occurred with
|
||||
* that device.
|
||||
* @return 0 if OK (found or not found), other -ve on error
|
||||
* occurred, or NULL if there is no usable device
|
||||
*/
|
||||
int uclass_first_device(enum uclass_id id, struct udevice **devp);
|
||||
void uclass_first_device(enum uclass_id id, struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_next_device() - Get the next device in a uclass
|
||||
*
|
||||
* The device returned is probed if necessary, and ready for use
|
||||
* Devices that fail to probe are skipped
|
||||
*
|
||||
* This function is useful to start iterating through a list of devices which
|
||||
* are functioning correctly and can be probed.
|
||||
*
|
||||
* @devp: On entry, pointer to device to lookup. On exit, returns pointer
|
||||
* to the next device in the uclass if no error occurred, or NULL if there is
|
||||
* no next device
|
||||
*/
|
||||
void uclass_next_device(struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_first_device_err() - Get the first device in a uclass
|
||||
@@ -286,27 +300,24 @@ int uclass_first_device(enum uclass_id id, struct udevice **devp);
|
||||
*
|
||||
* @id: Uclass ID to look up
|
||||
* @devp: Returns pointer to the first device in that uclass, or NULL if none
|
||||
* @return 0 if found, -ENODEV if not found, other -ve on error
|
||||
* Return: 0 if found, -ENODEV if not found, other -ve on error
|
||||
*/
|
||||
int uclass_first_device_err(enum uclass_id id, struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_next_device() - Get the next device in a uclass
|
||||
* uclass_next_device_err() - Get the next device in a uclass
|
||||
*
|
||||
* The device returned is probed if necessary, and ready for use
|
||||
*
|
||||
* This function is useful to start iterating through a list of devices which
|
||||
* are functioning correctly and can be probed.
|
||||
*
|
||||
* @devp: On entry, pointer to device to lookup. On exit, returns pointer
|
||||
* to the next device in the uclass if no error occurred, or NULL if there is
|
||||
* no next device, or an error occurred with that next device.
|
||||
* @return 0 if OK (found or not found), other -ve on error
|
||||
* to the next device in the uclass if no error occurred, or -ENODEV if
|
||||
* there is no next device.
|
||||
* @return 0 if found, -ENODEV if not found, other -ve on error
|
||||
*/
|
||||
int uclass_next_device(struct udevice **devp);
|
||||
int uclass_next_device_err(struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_first_device() - Get the first device in a uclass
|
||||
* uclass_first_device_check() - Get the first device in a uclass
|
||||
*
|
||||
* The device returned is probed if necessary, and ready for use
|
||||
*
|
||||
@@ -322,7 +333,7 @@ int uclass_next_device(struct udevice **devp);
|
||||
int uclass_first_device_check(enum uclass_id id, struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_next_device() - Get the next device in a uclass
|
||||
* uclass_next_device_check() - Get the next device in a uclass
|
||||
*
|
||||
* The device returned is probed if necessary, and ready for use
|
||||
*
|
||||
@@ -336,6 +347,20 @@ int uclass_first_device_check(enum uclass_id id, struct udevice **devp);
|
||||
*/
|
||||
int uclass_next_device_check(struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_first_device_drvdata() - Find the first device with given driver data
|
||||
*
|
||||
* This searches through the devices for a particular uclass looking for one
|
||||
* that has the given driver data.
|
||||
*
|
||||
* @id: Uclass ID to check
|
||||
* @driver_data: Driver data to search for
|
||||
* @devp: Returns pointer to the first matching device in that uclass, if found
|
||||
* @return 0 if found, -ENODEV if not found, other -ve on error
|
||||
*/
|
||||
int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data,
|
||||
struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_resolve_seq() - Resolve a device's sequence number
|
||||
*
|
||||
@@ -351,6 +376,23 @@ int uclass_next_device_check(struct udevice **devp);
|
||||
*/
|
||||
int uclass_resolve_seq(struct udevice *dev);
|
||||
|
||||
/**
|
||||
* uclass_id_foreach_dev() - Helper function to iteration through devices
|
||||
*
|
||||
* This creates a for() loop which works through the available devices in
|
||||
* a uclass ID in order from start to end.
|
||||
*
|
||||
* If for some reason the uclass cannot be found, this does nothing.
|
||||
*
|
||||
* @id: enum uclass_id ID to use
|
||||
* @pos: struct udevice * to hold the current device. Set to NULL when there
|
||||
* are no more devices.
|
||||
* @uc: temporary uclass variable (struct udevice *)
|
||||
*/
|
||||
#define uclass_id_foreach_dev(id, pos, uc) \
|
||||
if (!uclass_get(id, &uc)) \
|
||||
list_for_each_entry(pos, &uc->dev_head, uclass_node)
|
||||
|
||||
/**
|
||||
* uclass_foreach_dev() - Helper function to iteration through devices
|
||||
*
|
||||
@@ -379,4 +421,20 @@ int uclass_resolve_seq(struct udevice *dev);
|
||||
#define uclass_foreach_dev_safe(pos, next, uc) \
|
||||
list_for_each_entry_safe(pos, next, &uc->dev_head, uclass_node)
|
||||
|
||||
/**
|
||||
* uclass_foreach_dev_probe() - Helper function to iteration through devices
|
||||
* of given uclass
|
||||
*
|
||||
* This creates a for() loop which works through the available devices in
|
||||
* a uclass in order from start to end. Devices are probed if necessary,
|
||||
* and ready for use.
|
||||
*
|
||||
* @id: Uclass ID
|
||||
* @dev: struct udevice * to hold the current device. Set to NULL when there
|
||||
* are no more devices.
|
||||
*/
|
||||
#define uclass_foreach_dev_probe(id, dev) \
|
||||
for (int _ret = uclass_first_device_err(id, &dev); !_ret && dev; \
|
||||
_ret = uclass_next_device_err(&dev))
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user