Commit a64c36b8 authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'zynqmp-soc-for-v6.3' of https://github.com/Xilinx/linux-xlnx into soc/drivers

arm64: ZynqMP SoC changes for v6.3

Firmware changes
- fix memory leak in error path inside notification code
- trivial comment cleanup
- add workaround for SD tap delay programming with old PMUFW

* tag 'zynqmp-soc-for-v6.3' of https://github.com/Xilinx/linux-xlnx:
  firmware: xilinx: Clear IOCTL_SET_SD_TAPDELAY using PM_MMIO_WRITE
  firmware: xilinx: Remove kernel-doc marking in the code
  driver: soc: xilinx: fix memory leak in xlnx_add_cb_for_notify_event()

Link: https://lore.kernel.org/r/42be5129-3ca2-ddbc-ac3b-6448245b61c2@monstr.euSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 7dbb4a38 a4b2e606
...@@ -738,8 +738,31 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_get_pll_frac_data); ...@@ -738,8 +738,31 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_get_pll_frac_data);
*/ */
int zynqmp_pm_set_sd_tapdelay(u32 node_id, u32 type, u32 value) int zynqmp_pm_set_sd_tapdelay(u32 node_id, u32 type, u32 value)
{ {
return zynqmp_pm_invoke_fn(PM_IOCTL, node_id, IOCTL_SET_SD_TAPDELAY, u32 reg = (type == PM_TAPDELAY_INPUT) ? SD_ITAPDLY : SD_OTAPDLYSEL;
type, value, NULL); u32 mask = (node_id == NODE_SD_0) ? GENMASK(15, 0) : GENMASK(31, 16);
if (value) {
return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
IOCTL_SET_SD_TAPDELAY,
type, value, NULL);
}
/*
* Work around completely misdesigned firmware API on Xilinx ZynqMP.
* The IOCTL_SET_SD_TAPDELAY firmware call allows the caller to only
* ever set IOU_SLCR SD_ITAPDLY Register SD0_ITAPDLYENA/SD1_ITAPDLYENA
* bits, but there is no matching call to clear those bits. If those
* bits are not cleared, SDMMC tuning may fail.
*
* Luckily, there are PM_MMIO_READ/PM_MMIO_WRITE calls which seem to
* allow complete unrestricted access to all address space, including
* IOU_SLCR SD_ITAPDLY Register and all the other registers, access
* to which was supposed to be protected by the current firmware API.
*
* Use PM_MMIO_READ/PM_MMIO_WRITE to re-implement the missing counter
* part of IOCTL_SET_SD_TAPDELAY which clears SDx_ITAPDLYENA bits.
*/
return zynqmp_pm_invoke_fn(PM_MMIO_WRITE, reg, mask, 0, 0, NULL);
} }
EXPORT_SYMBOL_GPL(zynqmp_pm_set_sd_tapdelay); EXPORT_SYMBOL_GPL(zynqmp_pm_set_sd_tapdelay);
......
...@@ -116,8 +116,10 @@ static int xlnx_add_cb_for_notify_event(const u32 node_id, const u32 event, cons ...@@ -116,8 +116,10 @@ static int xlnx_add_cb_for_notify_event(const u32 node_id, const u32 event, cons
INIT_LIST_HEAD(&eve_data->cb_list_head); INIT_LIST_HEAD(&eve_data->cb_list_head);
cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL); cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL);
if (!cb_data) if (!cb_data) {
kfree(eve_data);
return -ENOMEM; return -ENOMEM;
}
cb_data->eve_cb = cb_fun; cb_data->eve_cb = cb_fun;
cb_data->agent_data = data; cb_data->agent_data = data;
......
...@@ -227,7 +227,7 @@ static struct generic_pm_domain *zynqmp_gpd_xlate ...@@ -227,7 +227,7 @@ static struct generic_pm_domain *zynqmp_gpd_xlate
goto done; goto done;
} }
/** /*
* Add index in empty node_id of power domain list as no existing * Add index in empty node_id of power domain list as no existing
* power domain found for current index. * power domain found for current index.
*/ */
......
...@@ -79,6 +79,10 @@ ...@@ -79,6 +79,10 @@
#define EVENT_ERROR_PSM_ERR1 (0x28108000U) #define EVENT_ERROR_PSM_ERR1 (0x28108000U)
#define EVENT_ERROR_PSM_ERR2 (0x2810C000U) #define EVENT_ERROR_PSM_ERR2 (0x2810C000U)
/* ZynqMP SD tap delay tuning */
#define SD_ITAPDLY 0xFF180314
#define SD_OTAPDLYSEL 0xFF180318
enum pm_api_cb_id { enum pm_api_cb_id {
PM_INIT_SUSPEND_CB = 30, PM_INIT_SUSPEND_CB = 30,
PM_ACKNOWLEDGE_CB = 31, PM_ACKNOWLEDGE_CB = 31,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment