mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 02:15:45 +01:00 
			
		
		
		
	Add devfdt_get_addr_size_index_ptr function with the same functionality as devfdt_get_addr_size_index, but instead a return pointer is given. Suggested-by: Michael Nazzareno Trimarchi <michael@amarulasolutions.com> Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Reviewed-by: Simon Glass <sjg@chromium.org>
		
			
				
	
	
		
			176 lines
		
	
	
		
			5.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			176 lines
		
	
	
		
			5.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0+ */
 | |
| /*
 | |
|  * Copyright (c) 2017 Google, Inc
 | |
|  *
 | |
|  * (C) Copyright 2012
 | |
|  * Pavel Herrmann <morpheus.ibis@gmail.com>
 | |
|  * Marek Vasut <marex@denx.de>
 | |
|  */
 | |
| 
 | |
| #ifndef _DM_FDTADDR_H
 | |
| #define _DM_FDTADDR_H
 | |
| 
 | |
| #include <fdtdec.h>
 | |
| 
 | |
| struct udevice;
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr() - Get the reg property of a device
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  *
 | |
|  * Return: addr
 | |
|  */
 | |
| fdt_addr_t devfdt_get_addr(const struct udevice *dev);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_ptr() - Return pointer to the address of the reg property
 | |
|  *                      of a device
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  *
 | |
|  * Return: Pointer to addr, or NULL if there is no such property
 | |
|  */
 | |
| void *devfdt_get_addr_ptr(const struct udevice *dev);
 | |
| 
 | |
| /**
 | |
|  * devfdt_remap_addr() - Return pointer to the memory-mapped I/O address
 | |
|  *                           of the reg property of a device
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  *
 | |
|  * Return: Pointer to addr, or NULL if there is no such property
 | |
|  */
 | |
| void *devfdt_remap_addr(const 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(const struct udevice *dev, int index);
 | |
| 
 | |
| /**
 | |
|  * devfdt_remap_addr_name() - Get the reg property of a device, indexed by
 | |
|  *                            name, as a memory-mapped I/O pointer
 | |
|  * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
 | |
|  *	  'reg-names' property providing named-based identification. @index
 | |
|  *	  indicates the value to search for in 'reg-names'.
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  *
 | |
|  * Return: Pointer to addr, or NULL if there is no such property
 | |
|  */
 | |
| void *devfdt_remap_addr_name(const struct udevice *dev, const char *name);
 | |
| 
 | |
| /**
 | |
|  * devfdt_map_physmem() - Read device address from reg property of the
 | |
|  *                     device node and map the address into CPU address
 | |
|  *                     space.
 | |
|  *
 | |
|  * @dev: Pointer to device
 | |
|  * @size: size of the memory to map
 | |
|  *
 | |
|  * Return: mapped address, or NULL if the device does not have reg property.
 | |
|  */
 | |
| void *devfdt_map_physmem(const struct udevice *dev, unsigned long size);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_index() - Get the indexed reg property of a device
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  * @index: the 'reg' property can hold a list of <addr, size> pairs
 | |
|  *	   and @index is used to select which one is required
 | |
|  *
 | |
|  * Return: addr
 | |
|  */
 | |
| fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_index_ptr() - Return indexed pointer to the address of the
 | |
|  *                               reg property of a device
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  * @index: the 'reg' property can hold a list of <addr, size> pairs
 | |
|  *	   and @index is used to select which one is required
 | |
|  *
 | |
|  * Return: Pointer to addr, or NULL if there is no such property
 | |
|  */
 | |
| void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_size_index() - Get the indexed reg property of a device
 | |
|  *
 | |
|  * Returns the address and size specified in the 'reg' property of a device.
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  * @index: the 'reg' property can hold a list of <addr, size> pairs
 | |
|  *	   and @index is used to select which one is required
 | |
|  * @size: Pointer to size variable - this function returns the size
 | |
|  *        specified in the 'reg' property here
 | |
|  *
 | |
|  * Return: addr
 | |
|  */
 | |
| fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
 | |
| 				      fdt_size_t *size);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_size_index_ptr() - Return indexed pointer to the address of the
 | |
|  *                                    reg property of a device
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  * @index: the 'reg' property can hold a list of <addr, size> pairs
 | |
|  *	   and @index is used to select which one is required
 | |
|  * @size: Pointer to size variable - this function returns the size
 | |
|  *        specified in the 'reg' property here
 | |
|  *
 | |
|  * Return: Pointer to addr, or NULL if there is no such property
 | |
|  */
 | |
| void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
 | |
| 				     fdt_size_t *size);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_name() - Get the reg property of a device, indexed by name
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
 | |
|  *	  'reg-names' property providing named-based identification. @index
 | |
|  *	  indicates the value to search for in 'reg-names'.
 | |
|  *
 | |
|  * Return: addr
 | |
|  */
 | |
| fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_size_name() - Get the reg property and its size for a device,
 | |
|  *				 indexed by name
 | |
|  *
 | |
|  * Returns the address and size specified in the 'reg' property of a device.
 | |
|  *
 | |
|  * @dev: Pointer to a device
 | |
|  * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
 | |
|  *	  'reg-names' property providing named-based identification. @index
 | |
|  *	  indicates the value to search for in 'reg-names'.
 | |
|  * @size: Pointer to size variable - this function returns the size
 | |
|  *        specified in the 'reg' property here
 | |
|  *
 | |
|  * Return: addr
 | |
|  */
 | |
| fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
 | |
| 				     const char *name, fdt_size_t *size);
 | |
| 
 | |
| /**
 | |
|  * devfdt_get_addr_pci() - Read an address and handle PCI address translation
 | |
|  *
 | |
|  * @dev: Device to read from
 | |
|  * Return: address or FDT_ADDR_T_NONE if not found
 | |
|  */
 | |
| fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
 | |
| 
 | |
| #endif
 |