Merge branch 'macb-add-zynqmp-sgmii-dynamic-configuration-support'
Radhey Shyam Pandey says: ==================== macb: add zynqmp SGMII dynamic configuration support This patchset add firmware and driver support to do SD/GEM dynamic configuration. In traditional flow GEM secure space configuration is done by FSBL. However in specific usescases like dynamic designs where GEM is not enabled in base vivado design, FSBL skips GEM initialization and we need a mechanism to configure GEM secure space in linux space at runtime. ==================== Link: https://lore.kernel.org/r/1663158796-14869-1-git-send-email-radhey.shyam.pandey@amd.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
5f4e25641c
|
|
@ -1311,6 +1311,37 @@ int zynqmp_pm_get_feature_config(enum pm_feature_config_id id,
|
|||
id, 0, payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* zynqmp_pm_set_sd_config - PM call to set value of SD config registers
|
||||
* @node: SD node ID
|
||||
* @config: The config type of SD registers
|
||||
* @value: Value to be set
|
||||
*
|
||||
* Return: Returns 0 on success or error value on failure.
|
||||
*/
|
||||
int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value)
|
||||
{
|
||||
return zynqmp_pm_invoke_fn(PM_IOCTL, node, IOCTL_SET_SD_CONFIG,
|
||||
config, value, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(zynqmp_pm_set_sd_config);
|
||||
|
||||
/**
|
||||
* zynqmp_pm_set_gem_config - PM call to set value of GEM config registers
|
||||
* @node: GEM node ID
|
||||
* @config: The config type of GEM registers
|
||||
* @value: Value to be set
|
||||
*
|
||||
* Return: Returns 0 on success or error value on failure.
|
||||
*/
|
||||
int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
|
||||
u32 value)
|
||||
{
|
||||
return zynqmp_pm_invoke_fn(PM_IOCTL, node, IOCTL_SET_GEM_CONFIG,
|
||||
config, value, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(zynqmp_pm_set_gem_config);
|
||||
|
||||
/**
|
||||
* struct zynqmp_pm_shutdown_scope - Struct for shutdown scope
|
||||
* @subtype: Shutdown subtype
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <linux/pm_runtime.h>
|
||||
#include <linux/ptp_classify.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/firmware/xlnx-zynqmp.h>
|
||||
#include "macb.h"
|
||||
|
||||
/* This structure is only used for MACB on SiFive FU540 devices */
|
||||
|
|
@ -4621,6 +4622,25 @@ static int init_reset_optional(struct platform_device *pdev)
|
|||
"failed to init SGMII PHY\n");
|
||||
}
|
||||
|
||||
ret = zynqmp_pm_is_function_supported(PM_IOCTL, IOCTL_SET_GEM_CONFIG);
|
||||
if (!ret) {
|
||||
u32 pm_info[2];
|
||||
|
||||
ret = of_property_read_u32_array(pdev->dev.of_node, "power-domains",
|
||||
pm_info, ARRAY_SIZE(pm_info));
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to read power management information\n");
|
||||
goto err_out_phy_exit;
|
||||
}
|
||||
ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_FIXED, 0);
|
||||
if (ret)
|
||||
goto err_out_phy_exit;
|
||||
|
||||
ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_SGMII_MODE, 1);
|
||||
if (ret)
|
||||
goto err_out_phy_exit;
|
||||
}
|
||||
|
||||
/* Fully reset controller at hardware level if mapped in device tree */
|
||||
ret = device_reset_optional(&pdev->dev);
|
||||
if (ret) {
|
||||
|
|
@ -4629,6 +4649,8 @@ static int init_reset_optional(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
ret = macb_init(pdev);
|
||||
|
||||
err_out_phy_exit:
|
||||
if (ret)
|
||||
phy_exit(bp->sgmii_phy);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,9 @@ enum pm_ioctl_id {
|
|||
/* Runtime feature configuration */
|
||||
IOCTL_SET_FEATURE_CONFIG = 26,
|
||||
IOCTL_GET_FEATURE_CONFIG = 27,
|
||||
/* Dynamic SD/GEM configuration */
|
||||
IOCTL_SET_SD_CONFIG = 30,
|
||||
IOCTL_SET_GEM_CONFIG = 31,
|
||||
};
|
||||
|
||||
enum pm_query_id {
|
||||
|
|
@ -399,6 +402,30 @@ enum pm_feature_config_id {
|
|||
PM_FEATURE_EXTWDT_VALUE = 4,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum pm_sd_config_type - PM SD configuration.
|
||||
* @SD_CONFIG_EMMC_SEL: To set SD_EMMC_SEL in CTRL_REG_SD and SD_SLOTTYPE
|
||||
* @SD_CONFIG_BASECLK: To set SD_BASECLK in SD_CONFIG_REG1
|
||||
* @SD_CONFIG_8BIT: To set SD_8BIT in SD_CONFIG_REG2
|
||||
* @SD_CONFIG_FIXED: To set fixed config registers
|
||||
*/
|
||||
enum pm_sd_config_type {
|
||||
SD_CONFIG_EMMC_SEL = 1,
|
||||
SD_CONFIG_BASECLK = 2,
|
||||
SD_CONFIG_8BIT = 3,
|
||||
SD_CONFIG_FIXED = 4,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum pm_gem_config_type - PM GEM configuration.
|
||||
* @GEM_CONFIG_SGMII_MODE: To set GEM_SGMII_MODE in GEM_CLK_CTRL register
|
||||
* @GEM_CONFIG_FIXED: To set fixed config registers
|
||||
*/
|
||||
enum pm_gem_config_type {
|
||||
GEM_CONFIG_SGMII_MODE = 1,
|
||||
GEM_CONFIG_FIXED = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct zynqmp_pm_query_data - PM query data
|
||||
* @qid: query ID
|
||||
|
|
@ -475,6 +502,9 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
|
|||
int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value);
|
||||
int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload);
|
||||
int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset);
|
||||
int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value);
|
||||
int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
|
||||
u32 value);
|
||||
#else
|
||||
static inline int zynqmp_pm_get_api_version(u32 *version)
|
||||
{
|
||||
|
|
@ -745,6 +775,21 @@ static inline int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset)
|
|||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int zynqmp_pm_set_sd_config(u32 node,
|
||||
enum pm_sd_config_type config,
|
||||
u32 value)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int zynqmp_pm_set_gem_config(u32 node,
|
||||
enum pm_gem_config_type config,
|
||||
u32 value)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FIRMWARE_ZYNQMP_H__ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue