Skip to content

Commit 4f964cf

Browse files
committed
Merge branch 'clk-rs9' into clk-next
* clk-rs9: clk: rs9: Add support for 9FGV0841 clk: rs9: Replace model check with bitshift from chip data clk: rs9: Limit check to vendor ID in VID register dt-bindings: clk: rs9: Add 9FGV0841
2 parents a4dcb2f + f0e5e18 commit 4f964cf

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

Documentation/devicetree/bindings/clock/renesas,9series.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ description: |
2121
1 -- DIF1
2222
2 -- DIF2
2323
3 -- DIF3
24+
- 9FGV0841:
25+
0 -- DIF0
26+
1 -- DIF1
27+
2 -- DIF2
28+
3 -- DIF3
29+
4 -- DIF4
30+
5 -- DIF5
31+
6 -- DIF6
32+
7 -- DIF7
2433
2534
maintainers:
2635
- Marek Vasut <[email protected]>
@@ -30,6 +39,7 @@ properties:
3039
enum:
3140
- renesas,9fgv0241
3241
- renesas,9fgv0441
42+
- renesas,9fgv0841
3343

3444
reg:
3545
description: I2C device address

drivers/clk/clk-renesas-pcie.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Currently supported:
88
* - 9FGV0241
99
* - 9FGV0441
10+
* - 9FGV0841
1011
*
1112
* Copyright (C) 2022 Marek Vasut <[email protected]>
1213
*/
@@ -42,23 +43,18 @@
4243
#define RS9_REG_DID 0x6
4344
#define RS9_REG_BCP 0x7
4445

46+
#define RS9_REG_VID_MASK GENMASK(3, 0)
4547
#define RS9_REG_VID_IDT 0x01
4648

4749
#define RS9_REG_DID_TYPE_FGV (0x0 << RS9_REG_DID_TYPE_SHIFT)
4850
#define RS9_REG_DID_TYPE_DBV (0x1 << RS9_REG_DID_TYPE_SHIFT)
4951
#define RS9_REG_DID_TYPE_DMV (0x2 << RS9_REG_DID_TYPE_SHIFT)
5052
#define RS9_REG_DID_TYPE_SHIFT 0x6
5153

52-
/* Supported Renesas 9-series models. */
53-
enum rs9_model {
54-
RENESAS_9FGV0241,
55-
RENESAS_9FGV0441,
56-
};
57-
5854
/* Structure to describe features of a particular 9-series model */
5955
struct rs9_chip_info {
60-
const enum rs9_model model;
6156
unsigned int num_clks;
57+
u8 outshift;
6258
u8 did;
6359
};
6460

@@ -160,14 +156,12 @@ static const struct regmap_config rs9_regmap_config = {
160156

161157
static u8 rs9_calc_dif(const struct rs9_driver_data *rs9, int idx)
162158
{
163-
enum rs9_model model = rs9->chip_info->model;
164-
165-
if (model == RENESAS_9FGV0241)
166-
return BIT(idx + 1);
167-
else if (model == RENESAS_9FGV0441)
168-
return BIT(idx);
169-
170-
return 0;
159+
/*
160+
* On 9FGV0241, the DIF OE0 is BIT(1) and DIF OE(1) is BIT(2),
161+
* on 9FGV0441 and 9FGV0841 the DIF OE0 is BIT(0) and so on.
162+
* Increment the index in the 9FGV0241 special case here.
163+
*/
164+
return BIT(idx + rs9->chip_info->outshift);
171165
}
172166

173167
static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx)
@@ -333,6 +327,7 @@ static int rs9_probe(struct i2c_client *client)
333327
if (ret < 0)
334328
return ret;
335329

330+
vid &= RS9_REG_VID_MASK;
336331
if (vid != RS9_REG_VID_IDT || did != rs9->chip_info->did)
337332
return dev_err_probe(&client->dev, -ENODEV,
338333
"Incorrect VID/DID: %#02x, %#02x. Expected %#02x, %#02x\n",
@@ -380,27 +375,35 @@ static int __maybe_unused rs9_resume(struct device *dev)
380375
}
381376

382377
static const struct rs9_chip_info renesas_9fgv0241_info = {
383-
.model = RENESAS_9FGV0241,
384378
.num_clks = 2,
379+
.outshift = 1,
385380
.did = RS9_REG_DID_TYPE_FGV | 0x02,
386381
};
387382

388383
static const struct rs9_chip_info renesas_9fgv0441_info = {
389-
.model = RENESAS_9FGV0441,
390384
.num_clks = 4,
385+
.outshift = 0,
391386
.did = RS9_REG_DID_TYPE_FGV | 0x04,
392387
};
393388

389+
static const struct rs9_chip_info renesas_9fgv0841_info = {
390+
.num_clks = 8,
391+
.outshift = 0,
392+
.did = RS9_REG_DID_TYPE_FGV | 0x08,
393+
};
394+
394395
static const struct i2c_device_id rs9_id[] = {
395396
{ "9fgv0241", .driver_data = (kernel_ulong_t)&renesas_9fgv0241_info },
396397
{ "9fgv0441", .driver_data = (kernel_ulong_t)&renesas_9fgv0441_info },
398+
{ "9fgv0841", .driver_data = (kernel_ulong_t)&renesas_9fgv0841_info },
397399
{ }
398400
};
399401
MODULE_DEVICE_TABLE(i2c, rs9_id);
400402

401403
static const struct of_device_id clk_rs9_of_match[] = {
402404
{ .compatible = "renesas,9fgv0241", .data = &renesas_9fgv0241_info },
403405
{ .compatible = "renesas,9fgv0441", .data = &renesas_9fgv0441_info },
406+
{ .compatible = "renesas,9fgv0841", .data = &renesas_9fgv0841_info },
404407
{ }
405408
};
406409
MODULE_DEVICE_TABLE(of, clk_rs9_of_match);

0 commit comments

Comments
 (0)