Commit 63eb7a36 authored by Rajan Vaja's avatar Rajan Vaja Committed by Jolly Shah
Browse files

zynqmp: pm: Add IOCTLs for global storage access



Add IOCTLs to read/write global general storage and
persistent global general storage registers access.

Signed-off-by: default avatarRajan Vaja <rajanv@xilinx.com>
Signed-off-by: default avatarJolly Shah <jollys@xilinx.com>
parent 1a3f02b5
......@@ -395,6 +395,82 @@ static enum pm_ret_status pm_ioctl_get_pll_frac_data
return pm_api_clk_get_pll_frac_data(pll, data);
}
/**
* pm_ioctl_write_ggs() - Ioctl function for writing
* global general storage (ggs)
* @index GGS register index
* @value Register value to be written
*
* This function writes value to GGS register.
*
* @return Returns status, either success or error+reason
*/
static enum pm_ret_status pm_ioctl_write_ggs(unsigned int index,
unsigned int value)
{
if (index >= GGS_NUM_REGS)
return PM_RET_ERROR_ARGS;
return pm_mmio_write(GGS_BASEADDR + (index << 2), 0xFFFFFFFF, value);
}
/**
* pm_ioctl_read_ggs() - Ioctl function for reading
* global general storage (ggs)
* @index GGS register index
* @value Register value
*
* This function returns GGS register value.
*
* @return Returns status, either success or error+reason
*/
static enum pm_ret_status pm_ioctl_read_ggs(unsigned int index,
unsigned int *value)
{
if (index >= GGS_NUM_REGS)
return PM_RET_ERROR_ARGS;
return pm_mmio_read(GGS_BASEADDR + (index << 2), value);
}
/**
* pm_ioctl_write_pggs() - Ioctl function for writing persistent
* global general storage (pggs)
* @index PGGS register index
* @value Register value to be written
*
* This function writes value to PGGS register.
*
* @return Returns status, either success or error+reason
*/
static enum pm_ret_status pm_ioctl_write_pggs(unsigned int index,
unsigned int value)
{
if (index >= PGGS_NUM_REGS)
return PM_RET_ERROR_ARGS;
return pm_mmio_write(PGGS_BASEADDR + (index << 2), 0xFFFFFFFF, value);
}
/**
* pm_ioctl_read_pggs() - Ioctl function for reading persistent
* global general storage (pggs)
* @index PGGS register index
* @value Register value
*
* This function returns PGGS register value.
*
* @return Returns status, either success or error+reason
*/
static enum pm_ret_status pm_ioctl_read_pggs(unsigned int index,
unsigned int *value)
{
if (index >= PGGS_NUM_REGS)
return PM_RET_ERROR_ARGS;
return pm_mmio_read(PGGS_BASEADDR + (index << 2), value);
}
/**
* pm_api_ioctl() - PM IOCTL API for device control and configs
* @node_id Node ID of the device
......@@ -452,6 +528,18 @@ enum pm_ret_status pm_api_ioctl(enum pm_node_id nid,
case IOCTL_GET_PLL_FRAC_DATA:
ret = pm_ioctl_get_pll_frac_data(arg1, value);
break;
case IOCTL_WRITE_GGS:
ret = pm_ioctl_write_ggs(arg1, arg2);
break;
case IOCTL_READ_GGS:
ret = pm_ioctl_read_ggs(arg1, value);
break;
case IOCTL_WRITE_PGGS:
ret = pm_ioctl_write_pggs(arg1, arg2);
break;
case IOCTL_READ_PGGS:
ret = pm_ioctl_read_pggs(arg1, value);
break;
default:
ret = PM_RET_ERROR_NOTSUPPORTED;
}
......
......@@ -27,6 +27,10 @@ enum pm_ioctl_id {
IOCTL_GET_PLL_FRAC_MODE,
IOCTL_SET_PLL_FRAC_DATA,
IOCTL_GET_PLL_FRAC_DATA,
IOCTL_WRITE_GGS,
IOCTL_READ_GGS,
IOCTL_WRITE_PGGS,
IOCTL_READ_PGGS,
};
enum rpu_oper_mode {
......
......@@ -303,4 +303,12 @@
#define IOU_SLCR_CAN_MIO_CTRL (IOU_SLCR_BASEADDR + 0x304)
#define IOU_SLCR_WDT_CLK_SEL (IOU_SLCR_BASEADDR + 0x300)
/* Global general storage register base address */
#define GGS_BASEADDR (0xFFD80030U)
#define GGS_NUM_REGS (4)
/* Persistent global general storage register base address */
#define PGGS_BASEADDR (0xFFD80050U)
#define PGGS_NUM_REGS (4)
#endif /* __ZYNQMP_DEF_H__ */
Supports Markdown
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