1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright 2019 Google LLC
4 * Copyright 2020 B&R Industrial Automation GmbH - http://www.br-automation.com
7 #ifndef __ASM_ARCH_FSP_BINDINGS_H
8 #define __ASM_ARCH_FSP_BINDINGS_H
10 #include <asm/arch/fsp/fsp_m_upd.h>
12 #define ARRAY_SIZE_OF_MEMBER(s, m) (ARRAY_SIZE((((s *)0)->m)))
13 #define SIZE_OF_MEMBER(s, m) (sizeof((((s *)0)->m)))
24 * struct fsp_binding - Binding describing devicetree/FSP relationships
25 * @offset: Offset within the FSP config structure
26 * @propname: Name of property to read
27 * @type: Type of the property to read
28 * @count: If the property is expected to be an array, this is the
29 * number of expected elements
30 * Set to 0 if the property is expected to be a scalar
32 * The struct fsp_binding is used to describe the relationship between
33 * values stored in devicetree and where they are placed in the FSP
34 * configuration structure.
44 * LPDDR4 helper routines for configuring the memory UPD for LPDDR4 operation.
45 * There are four physical LPDDR4 channels, each 32-bits wide. There are two
46 * logical channels using two physical channels together to form a 64-bit
47 * interface to memory for each logical channel.
56 LP4_NUM_PHYS_CHANNELS,
60 * The DQs within a physical channel can be bit-swizzled within each byte.
61 * Within a channel the bytes can be swapped, but the DQs need to be routed
62 * with the corresponding DQS (strobe).
74 /* Provide bit swizzling per DQS and byte swapping within a channel */
75 struct lpddr4_chan_swizzle_cfg {
76 u8 dqs[LP4_NUM_BYTE_LANES][DQ_BITS_PER_DQS];
79 struct lpddr4_swizzle_cfg {
80 struct lpddr4_chan_swizzle_cfg phys[LP4_NUM_PHYS_CHANNELS];
84 * fsp_m_update_config_from_dtb() - Read FSP-M config from devicetree node
85 * @node: Valid node reference to read property from
86 * @cfg: Pointer to FSP-M config structure
87 * @return 0 on success, -ve on error
89 * This function reads the configuration for FSP-M from the provided
90 * devicetree node and saves it in the FSP-M configuration structure.
91 * Configuration options that are not present in the devicetree are
92 * left at their current value.
94 int fsp_m_update_config_from_dtb(ofnode node, struct fsp_m_config *cfg);