Skip to content

Commit f08e7ed

Browse files
committed
Merge tag 'clk-microchip-6.20' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux into clk-microchip
Pull Microchip clk driver updates from Claudiu Beznea: - clean up microchip/clk-core.c to: -- fix a sparse warning related to multiple initializations of pic32_sclk_ops.determine_rate() -- correct the return values of roclk_get_parent() and sclk_get_parent() -- drop an unused include header - adjust the PolarFire driver Kconfig section as the driver is now used by non-PolarFire devices - update the documentation for the Microchip PIC64GX SoC clock controller * tag 'clk-microchip-6.20' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux: dt-bindings: clock: mpfs-clkcfg: Add pic64gx compatibility dt-bindings: clock: mpfs-ccc: Add pic64gx compatibility clk: microchip: drop POLARFIRE from ARCH_MICROCHIP_POLARFIRE clk: microchip: core: remove unused include asm/traps.h clk: microchip: core: correct return value on *_get_parent() clk: microchip: core: remove duplicate determine_rate on pic32_sclk_ops
2 parents 8f0b4cc + ec8c1f3 commit f08e7ed

4 files changed

Lines changed: 34 additions & 28 deletions

File tree

Documentation/devicetree/bindings/clock/microchip,mpfs-ccc.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ description: |
1717
1818
properties:
1919
compatible:
20-
const: microchip,mpfs-ccc
20+
oneOf:
21+
- items:
22+
- const: microchip,pic64gx-ccc
23+
- const: microchip,mpfs-ccc
24+
- const: microchip,mpfs-ccc
2125

2226
reg:
2327
items:

Documentation/devicetree/bindings/clock/microchip,mpfs-clkcfg.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ description: |
1919
2020
properties:
2121
compatible:
22-
const: microchip,mpfs-clkcfg
22+
oneOf:
23+
- items:
24+
- const: microchip,pic64gx-clkcfg
25+
- const: microchip,mpfs-clkcfg
26+
- const: microchip,mpfs-clkcfg
2327

2428
reg:
2529
oneOf:
@@ -69,6 +73,16 @@ required:
6973
- clocks
7074
- '#clock-cells'
7175

76+
if:
77+
properties:
78+
compatible:
79+
contains:
80+
const: microchip,pic64gx-clkcfg
81+
then:
82+
properties:
83+
reg:
84+
maxItems: 1
85+
7286
additionalProperties: false
7387

7488
examples:

drivers/clk/microchip/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ config COMMON_CLK_PIC32
55

66
config MCHP_CLK_MPFS
77
bool "Clk driver for PolarFire SoC"
8-
depends on ARCH_MICROCHIP_POLARFIRE || COMPILE_TEST
9-
default ARCH_MICROCHIP_POLARFIRE
8+
depends on ARCH_MICROCHIP || COMPILE_TEST
9+
default y
1010
depends on MFD_SYSCON
1111
select AUXILIARY_BUS
1212
select REGMAP_MMIO

drivers/clk/microchip/clk-core.c

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/io.h>
1111
#include <linux/iopoll.h>
1212
#include <asm/mach-pic32/pic32.h>
13-
#include <asm/traps.h>
1413

1514
#include "clk-core.h"
1615

@@ -283,14 +282,13 @@ static u8 roclk_get_parent(struct clk_hw *hw)
283282

284283
v = (readl(refo->ctrl_reg) >> REFO_SEL_SHIFT) & REFO_SEL_MASK;
285284

286-
if (!refo->parent_map)
287-
return v;
288-
289-
for (i = 0; i < clk_hw_get_num_parents(hw); i++)
290-
if (refo->parent_map[i] == v)
291-
return i;
285+
if (refo->parent_map) {
286+
for (i = 0; i < clk_hw_get_num_parents(hw); i++)
287+
if (refo->parent_map[i] == v)
288+
return i;
289+
}
292290

293-
return -EINVAL;
291+
return v;
294292
}
295293

296294
static unsigned long roclk_calc_rate(unsigned long parent_rate,
@@ -780,15 +778,6 @@ static unsigned long sclk_get_rate(struct clk_hw *hw, unsigned long parent_rate)
780778
return parent_rate / div;
781779
}
782780

783-
static int sclk_determine_rate(struct clk_hw *hw,
784-
struct clk_rate_request *req)
785-
{
786-
req->rate = calc_best_divided_rate(req->rate, req->best_parent_rate,
787-
SLEW_SYSDIV, 1);
788-
789-
return 0;
790-
}
791-
792781
static int sclk_set_rate(struct clk_hw *hw,
793782
unsigned long rate, unsigned long parent_rate)
794783
{
@@ -826,13 +815,13 @@ static u8 sclk_get_parent(struct clk_hw *hw)
826815

827816
v = (readl(sclk->mux_reg) >> OSC_CUR_SHIFT) & OSC_CUR_MASK;
828817

829-
if (!sclk->parent_map)
830-
return v;
818+
if (sclk->parent_map) {
819+
for (i = 0; i < clk_hw_get_num_parents(hw); i++)
820+
if (sclk->parent_map[i] == v)
821+
return i;
822+
}
831823

832-
for (i = 0; i < clk_hw_get_num_parents(hw); i++)
833-
if (sclk->parent_map[i] == v)
834-
return i;
835-
return -EINVAL;
824+
return v;
836825
}
837826

838827
static int sclk_set_parent(struct clk_hw *hw, u8 index)
@@ -912,7 +901,6 @@ static int sclk_init(struct clk_hw *hw)
912901
const struct clk_ops pic32_sclk_ops = {
913902
.get_parent = sclk_get_parent,
914903
.set_parent = sclk_set_parent,
915-
.determine_rate = sclk_determine_rate,
916904
.set_rate = sclk_set_rate,
917905
.recalc_rate = sclk_get_rate,
918906
.init = sclk_init,

0 commit comments

Comments
 (0)