Commit a5ae5a72 authored by Jolly Shah's avatar Jolly Shah
Browse files

zynqmp: pm: Return the buffered PLL mode through IOCTL PLL get mode API



When linux calls pm_ioctl_get_pll_frac_mode() it doesn't expect the actual
mode to be read from hardware, but the value that it is intending to
program. Therefore, we return the buffered value to linux.
Signed-off-by: default avatarMirela Simonovic <mirela.simonovic@aggios.com>
Acked-by: default avatarWill Wong <WILLW@xilinx.com>
Signed-off-by: default avatarJolly Shah <jollys@xilinx.com>
parent 8975f317
...@@ -3153,37 +3153,22 @@ enum pm_ret_status pm_clock_set_pll_mode(enum clock_id clock_id, ...@@ -3153,37 +3153,22 @@ enum pm_ret_status pm_clock_set_pll_mode(enum clock_id clock_id,
} }
/** /**
* pm_ioctl_get_pll_mode() - Get PLL mode * pm_clock_get_pll_mode() - Get PLL mode
* @pll PLL id * @clock_id PLL clock id
* @mode Mode fraction/integar * @mode Location to store the mode (fractional/integer)
* *
* This function returns current PLL mode. * This function returns buffered PLL mode.
* *
* @return Returns status, either success or error+reason * @return Success if mode is stored or error if an argument is invalid
*/ */
enum pm_ret_status pm_api_clk_get_pll_mode(unsigned int pll, enum pm_ret_status pm_clock_get_pll_mode(enum clock_id clock_id,
unsigned int *mode) unsigned int *mode)
{ {
enum pm_ret_status ret = PM_RET_SUCCESS; struct pm_pll *pll = pm_clock_get_pll(clock_id);
unsigned int val, reg;
if (!pm_clock_valid(pll)) if (!pll || !mode)
return PM_RET_ERROR_ARGS; return PM_RET_ERROR_ARGS;
*mode = pll->mode;
if (pm_clock_type(pll) != CLK_TYPE_OUTPUT) return PM_RET_SUCCESS;
return PM_RET_ERROR_NOTSUPPORTED;
if (!ISPLL(pll))
return PM_RET_ERROR_NOTSUPPORTED;
reg = clocks[pll].control_reg + PLL_FRAC_OFFSET;
ret = pm_mmio_read(reg, &val);
val = val & PLL_FRAC_MODE_MASK;
if (val == 0)
*mode = PLL_INT_MODE;
else
*mode = PLL_FRAC_MODE;
return ret;
} }
...@@ -310,7 +310,7 @@ enum pm_ret_status pm_api_clock_getparent(unsigned int clock_id, ...@@ -310,7 +310,7 @@ enum pm_ret_status pm_api_clock_getparent(unsigned int clock_id,
unsigned int *parent_idx); unsigned int *parent_idx);
enum pm_ret_status pm_clock_set_pll_mode(enum clock_id clock_id, enum pm_ret_status pm_clock_set_pll_mode(enum clock_id clock_id,
unsigned int mode); unsigned int mode);
enum pm_ret_status pm_api_clk_get_pll_mode(unsigned int pll, enum pm_ret_status pm_clock_get_pll_mode(enum clock_id clock_id,
unsigned int *mode); unsigned int *mode);
#endif /* PM_API_CLOCK_H */ #endif /* PM_API_CLOCK_H */
...@@ -348,7 +348,7 @@ static enum pm_ret_status pm_ioctl_set_pll_frac_mode ...@@ -348,7 +348,7 @@ static enum pm_ret_status pm_ioctl_set_pll_frac_mode
/** /**
* pm_ioctl_get_pll_frac_mode() - Ioctl function for * pm_ioctl_get_pll_frac_mode() - Ioctl function for
* getting pll mode * getting pll mode
* @pll PLL id * @pll PLL clock id
* @mode Mode fraction/integar * @mode Mode fraction/integar
* *
* This function return current PLL mode * This function return current PLL mode
...@@ -358,7 +358,7 @@ static enum pm_ret_status pm_ioctl_set_pll_frac_mode ...@@ -358,7 +358,7 @@ static enum pm_ret_status pm_ioctl_set_pll_frac_mode
static enum pm_ret_status pm_ioctl_get_pll_frac_mode static enum pm_ret_status pm_ioctl_get_pll_frac_mode
(unsigned int pll, unsigned int *mode) (unsigned int pll, unsigned int *mode)
{ {
return pm_api_clk_get_pll_mode(pll, mode); return pm_clock_get_pll_mode(pll, mode);
} }
/** /**
......
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