|
112 | 112 | #define SFC_VER_3 0x3 |
113 | 113 | #define SFC_VER_4 0x4 |
114 | 114 | #define SFC_VER_5 0x5 |
| 115 | +#define SFC_VER_8 0x8 |
115 | 116 |
|
116 | 117 | /* Delay line controller register */ |
117 | 118 | #define SFC_DLL_CTRL0 0x3C |
@@ -216,6 +217,22 @@ static u32 rockchip_sfc_get_max_iosize(struct rockchip_sfc *sfc) |
216 | 217 | return SFC_MAX_IOSIZE_VER3; |
217 | 218 | } |
218 | 219 |
|
| 220 | +static int rockchip_sfc_clk_set_rate(struct rockchip_sfc *sfc, unsigned long speed) |
| 221 | +{ |
| 222 | + if (sfc->version >= SFC_VER_8) |
| 223 | + return clk_set_rate(sfc->clk, speed * 2); |
| 224 | + else |
| 225 | + return clk_set_rate(sfc->clk, speed); |
| 226 | +} |
| 227 | + |
| 228 | +static unsigned long rockchip_sfc_clk_get_rate(struct rockchip_sfc *sfc) |
| 229 | +{ |
| 230 | + if (sfc->version >= SFC_VER_8) |
| 231 | + return clk_get_rate(sfc->clk) / 2; |
| 232 | + else |
| 233 | + return clk_get_rate(sfc->clk); |
| 234 | +} |
| 235 | + |
219 | 236 | static void rockchip_sfc_irq_unmask(struct rockchip_sfc *sfc, u32 mask) |
220 | 237 | { |
221 | 238 | u32 reg; |
@@ -518,12 +535,12 @@ static int rockchip_sfc_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op |
518 | 535 |
|
519 | 536 | if (unlikely(mem->spi->max_speed_hz != sfc->speed[cs]) && |
520 | 537 | !has_acpi_companion(sfc->dev)) { |
521 | | - ret = clk_set_rate(sfc->clk, mem->spi->max_speed_hz); |
| 538 | + ret = rockchip_sfc_clk_set_rate(sfc, mem->spi->max_speed_hz); |
522 | 539 | if (ret) |
523 | 540 | goto out; |
524 | 541 | sfc->speed[cs] = mem->spi->max_speed_hz; |
525 | 542 | dev_dbg(sfc->dev, "set_freq=%dHz real_freq=%ldHz\n", |
526 | | - sfc->speed[cs], clk_get_rate(sfc->clk)); |
| 543 | + sfc->speed[cs], rockchip_sfc_clk_get_rate(sfc)); |
527 | 544 | } |
528 | 545 |
|
529 | 546 | rockchip_sfc_adjust_op_work((struct spi_mem_op *)op); |
|
0 commit comments