2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2017-05-19 02:09:02 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Google, Inc
|
|
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DM_OF_EXTRA_H
|
|
|
|
#define _DM_OF_EXTRA_H
|
|
|
|
|
|
|
|
#include <dm/ofnode.h>
|
|
|
|
|
|
|
|
enum fmap_compress_t {
|
|
|
|
FMAP_COMPRESS_NONE,
|
2021-03-15 05:00:29 +00:00
|
|
|
FMAP_COMPRESS_LZMA,
|
2018-10-01 18:22:08 +00:00
|
|
|
FMAP_COMPRESS_LZ4,
|
2021-03-15 05:00:29 +00:00
|
|
|
|
|
|
|
FMAP_COMPRESS_COUNT,
|
|
|
|
FMAP_COMPRESS_UNKNOWN,
|
2017-05-19 02:09:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum fmap_hash_t {
|
|
|
|
FMAP_HASH_NONE,
|
|
|
|
FMAP_HASH_SHA1,
|
|
|
|
FMAP_HASH_SHA256,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* A flash map entry, containing an offset and length */
|
|
|
|
struct fmap_entry {
|
|
|
|
uint32_t offset;
|
|
|
|
uint32_t length;
|
|
|
|
uint32_t used; /* Number of bytes used in region */
|
|
|
|
enum fmap_compress_t compress_algo; /* Compression type */
|
2018-10-01 18:22:08 +00:00
|
|
|
uint32_t unc_length; /* Uncompressed length */
|
2017-05-19 02:09:02 +00:00
|
|
|
enum fmap_hash_t hash_algo; /* Hash algorithm */
|
|
|
|
const uint8_t *hash; /* Hash value */
|
|
|
|
int hash_size; /* Hash size */
|
2021-03-15 05:00:29 +00:00
|
|
|
/* Node pointer if CBFS, else NULL */
|
|
|
|
const struct cbfs_cachenode *cbfs_node;
|
|
|
|
/* Hash node pointer if CBFS, else NULL */
|
|
|
|
const struct cbfs_cachenode *cbfs_hash_node;
|
2017-05-19 02:09:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2022-01-12 09:53:49 +00:00
|
|
|
* ofnode_read_fmap_entry() - Read a flash entry from the fdt
|
2017-05-19 02:09:02 +00:00
|
|
|
*
|
2022-01-12 09:53:49 +00:00
|
|
|
* @node: Reference to node to read
|
|
|
|
* @entry: Place to put offset and size of this node
|
|
|
|
* Return: 0 if ok, -ve on error
|
2017-05-19 02:09:02 +00:00
|
|
|
*/
|
2018-06-11 19:07:17 +00:00
|
|
|
int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry);
|
2017-05-19 02:09:02 +00:00
|
|
|
|
2018-06-11 19:07:18 +00:00
|
|
|
/**
|
|
|
|
* ofnode_decode_region() - Decode a memory region from a node
|
|
|
|
*
|
|
|
|
* Look up a property in a node which contains a memory region address and
|
|
|
|
* size. Then return a pointer to this address.
|
|
|
|
*
|
|
|
|
* The property must hold one address with a length. This is only tested on
|
|
|
|
* 32-bit machines.
|
|
|
|
*
|
2022-01-12 09:53:49 +00:00
|
|
|
* @node: ofnode to examine
|
|
|
|
* @prop_name: name of property to find
|
|
|
|
* @basep: Returns base address of region
|
|
|
|
* @sizep: Returns size of region
|
|
|
|
* Return: 0 if ok, -1 on error (property not found)
|
2018-06-11 19:07:18 +00:00
|
|
|
*/
|
|
|
|
int ofnode_decode_region(ofnode node, const char *prop_name, fdt_addr_t *basep,
|
|
|
|
fdt_size_t *sizep);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ofnode_decode_memory_region()- Decode a named region within a memory bank
|
|
|
|
*
|
|
|
|
* This function handles selection of a memory region. The region is
|
|
|
|
* specified as an offset/size within a particular type of memory.
|
|
|
|
*
|
|
|
|
* The properties used are:
|
|
|
|
*
|
|
|
|
* <mem_type>-memory<suffix> for the name of the memory bank
|
|
|
|
* <mem_type>-offset<suffix> for the offset in that bank
|
|
|
|
*
|
|
|
|
* The property value must have an offset and a size. The function checks
|
|
|
|
* that the region is entirely within the memory bank.5
|
|
|
|
*
|
2022-01-12 09:53:49 +00:00
|
|
|
* @config_node: ofnode containing the properties (invalid for "/config")
|
|
|
|
* @mem_type: Type of memory to use, which is a name, such as
|
|
|
|
* "u-boot" or "kernel".
|
|
|
|
* @suffix: String to append to the memory/offset
|
|
|
|
* property names
|
|
|
|
* @basep: Returns base of region
|
|
|
|
* @sizep: Returns size of region
|
|
|
|
* Return: 0 if OK, -ive on error
|
2018-06-11 19:07:18 +00:00
|
|
|
*/
|
|
|
|
int ofnode_decode_memory_region(ofnode config_node, const char *mem_type,
|
|
|
|
const char *suffix, fdt_addr_t *basep,
|
|
|
|
fdt_size_t *sizep);
|
|
|
|
|
2021-03-14 12:14:46 +00:00
|
|
|
/**
|
|
|
|
* ofnode_phy_is_fixed_link() - Detect fixed-link pseudo-PHY device
|
|
|
|
*
|
|
|
|
* This function detects whether the ethernet controller connects to a
|
|
|
|
* fixed-link pseudo-PHY device.
|
|
|
|
*
|
|
|
|
* This function supports the following two DT bindings:
|
|
|
|
* - the new DT binding, where 'fixed-link' is a sub-node of the
|
2022-01-12 09:53:49 +00:00
|
|
|
* Ethernet device
|
2021-03-14 12:14:46 +00:00
|
|
|
* - the old DT binding, where 'fixed-link' is a property with 5
|
2022-01-12 09:53:49 +00:00
|
|
|
* cells encoding various information about the fixed PHY
|
2021-03-14 12:14:46 +00:00
|
|
|
*
|
|
|
|
* If both new and old bindings exist, the new one is preferred.
|
|
|
|
*
|
2022-01-12 09:53:49 +00:00
|
|
|
* @eth_node: ofnode containing the fixed-link subnode/property
|
|
|
|
* @phy_node: if fixed-link PHY detected, containing the PHY ofnode
|
|
|
|
* Return: true if a fixed-link pseudo-PHY device exists, false otherwise
|
2021-03-14 12:14:46 +00:00
|
|
|
*/
|
|
|
|
bool ofnode_phy_is_fixed_link(ofnode eth_node, ofnode *phy_node);
|
|
|
|
|
net: introduce a helper to determine whether to use in-band autoneg
Certain serial SERDES protocols like 1000base-x, 2500base-x, SGMII,
USXGMII can operate either in a mode where the PHY (be it on-board or
inside an SFP module) passes the link parameters (speed, duplex, pause)
to the MAC through in-band through control words standardized by IEEE
802.3 clause 37, or in a mode where the MAC must configure (force) its
link parameters based on information obtained out-of-band (MDIO reads,
guesswork etc).
In Linux, the OF node property named "managed" is parsed by the phylink
framework, and the convention is that if a driver uses phylink, then the
presence of this property means that in-band autoneg should be enabled,
otherwise it shouldn't.
To be compatible with the OF node bindings of drivers that use phylink
in Linux, introduce parsing support for this property in U-Boot too.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-09-29 15:04:39 +00:00
|
|
|
/**
|
|
|
|
* ofnode_eth_uses_inband_aneg() - Detect whether MAC should use in-band autoneg
|
|
|
|
*
|
|
|
|
* This function detects whether the Ethernet controller should use IEEE 802.3
|
|
|
|
* clause 37 in-band autonegotiation for serial protocols such as 1000base-x,
|
|
|
|
* SGMII, USXGMII, etc. The property is relevant when the Ethernet controller
|
|
|
|
* is connected to an on-board PHY or an SFP cage, and is not relevant when it
|
|
|
|
* has a fixed link (in that case, in-band autoneg should not be used).
|
|
|
|
*
|
2022-01-12 09:53:49 +00:00
|
|
|
* @eth_node: ofnode belonging to the Ethernet controller
|
|
|
|
* Return: true if in-band autoneg should be used, false otherwise
|
net: introduce a helper to determine whether to use in-band autoneg
Certain serial SERDES protocols like 1000base-x, 2500base-x, SGMII,
USXGMII can operate either in a mode where the PHY (be it on-board or
inside an SFP module) passes the link parameters (speed, duplex, pause)
to the MAC through in-band through control words standardized by IEEE
802.3 clause 37, or in a mode where the MAC must configure (force) its
link parameters based on information obtained out-of-band (MDIO reads,
guesswork etc).
In Linux, the OF node property named "managed" is parsed by the phylink
framework, and the convention is that if a driver uses phylink, then the
presence of this property means that in-band autoneg should be enabled,
otherwise it shouldn't.
To be compatible with the OF node bindings of drivers that use phylink
in Linux, introduce parsing support for this property in U-Boot too.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-09-29 15:04:39 +00:00
|
|
|
*/
|
|
|
|
bool ofnode_eth_uses_inband_aneg(ofnode eth_node);
|
|
|
|
|
2017-05-19 02:09:02 +00:00
|
|
|
#endif
|