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
This commit is contained in:
commit
4f964cfef3
@ -21,6 +21,15 @@ description: |
|
||||
1 -- DIF1
|
||||
2 -- DIF2
|
||||
3 -- DIF3
|
||||
- 9FGV0841:
|
||||
0 -- DIF0
|
||||
1 -- DIF1
|
||||
2 -- DIF2
|
||||
3 -- DIF3
|
||||
4 -- DIF4
|
||||
5 -- DIF5
|
||||
6 -- DIF6
|
||||
7 -- DIF7
|
||||
|
||||
maintainers:
|
||||
- Marek Vasut <marex@denx.de>
|
||||
@ -30,6 +39,7 @@ properties:
|
||||
enum:
|
||||
- renesas,9fgv0241
|
||||
- renesas,9fgv0441
|
||||
- renesas,9fgv0841
|
||||
|
||||
reg:
|
||||
description: I2C device address
|
||||
|
@ -7,6 +7,7 @@
|
||||
* Currently supported:
|
||||
* - 9FGV0241
|
||||
* - 9FGV0441
|
||||
* - 9FGV0841
|
||||
*
|
||||
* Copyright (C) 2022 Marek Vasut <marex@denx.de>
|
||||
*/
|
||||
@ -42,6 +43,7 @@
|
||||
#define RS9_REG_DID 0x6
|
||||
#define RS9_REG_BCP 0x7
|
||||
|
||||
#define RS9_REG_VID_MASK GENMASK(3, 0)
|
||||
#define RS9_REG_VID_IDT 0x01
|
||||
|
||||
#define RS9_REG_DID_TYPE_FGV (0x0 << RS9_REG_DID_TYPE_SHIFT)
|
||||
@ -49,16 +51,10 @@
|
||||
#define RS9_REG_DID_TYPE_DMV (0x2 << RS9_REG_DID_TYPE_SHIFT)
|
||||
#define RS9_REG_DID_TYPE_SHIFT 0x6
|
||||
|
||||
/* Supported Renesas 9-series models. */
|
||||
enum rs9_model {
|
||||
RENESAS_9FGV0241,
|
||||
RENESAS_9FGV0441,
|
||||
};
|
||||
|
||||
/* Structure to describe features of a particular 9-series model */
|
||||
struct rs9_chip_info {
|
||||
const enum rs9_model model;
|
||||
unsigned int num_clks;
|
||||
u8 outshift;
|
||||
u8 did;
|
||||
};
|
||||
|
||||
@ -160,14 +156,12 @@ static const struct regmap_config rs9_regmap_config = {
|
||||
|
||||
static u8 rs9_calc_dif(const struct rs9_driver_data *rs9, int idx)
|
||||
{
|
||||
enum rs9_model model = rs9->chip_info->model;
|
||||
|
||||
if (model == RENESAS_9FGV0241)
|
||||
return BIT(idx + 1);
|
||||
else if (model == RENESAS_9FGV0441)
|
||||
return BIT(idx);
|
||||
|
||||
return 0;
|
||||
/*
|
||||
* On 9FGV0241, the DIF OE0 is BIT(1) and DIF OE(1) is BIT(2),
|
||||
* on 9FGV0441 and 9FGV0841 the DIF OE0 is BIT(0) and so on.
|
||||
* Increment the index in the 9FGV0241 special case here.
|
||||
*/
|
||||
return BIT(idx + rs9->chip_info->outshift);
|
||||
}
|
||||
|
||||
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)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
vid &= RS9_REG_VID_MASK;
|
||||
if (vid != RS9_REG_VID_IDT || did != rs9->chip_info->did)
|
||||
return dev_err_probe(&client->dev, -ENODEV,
|
||||
"Incorrect VID/DID: %#02x, %#02x. Expected %#02x, %#02x\n",
|
||||
@ -380,20 +375,27 @@ static int __maybe_unused rs9_resume(struct device *dev)
|
||||
}
|
||||
|
||||
static const struct rs9_chip_info renesas_9fgv0241_info = {
|
||||
.model = RENESAS_9FGV0241,
|
||||
.num_clks = 2,
|
||||
.outshift = 1,
|
||||
.did = RS9_REG_DID_TYPE_FGV | 0x02,
|
||||
};
|
||||
|
||||
static const struct rs9_chip_info renesas_9fgv0441_info = {
|
||||
.model = RENESAS_9FGV0441,
|
||||
.num_clks = 4,
|
||||
.outshift = 0,
|
||||
.did = RS9_REG_DID_TYPE_FGV | 0x04,
|
||||
};
|
||||
|
||||
static const struct rs9_chip_info renesas_9fgv0841_info = {
|
||||
.num_clks = 8,
|
||||
.outshift = 0,
|
||||
.did = RS9_REG_DID_TYPE_FGV | 0x08,
|
||||
};
|
||||
|
||||
static const struct i2c_device_id rs9_id[] = {
|
||||
{ "9fgv0241", .driver_data = (kernel_ulong_t)&renesas_9fgv0241_info },
|
||||
{ "9fgv0441", .driver_data = (kernel_ulong_t)&renesas_9fgv0441_info },
|
||||
{ "9fgv0841", .driver_data = (kernel_ulong_t)&renesas_9fgv0841_info },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, rs9_id);
|
||||
@ -401,6 +403,7 @@ MODULE_DEVICE_TABLE(i2c, rs9_id);
|
||||
static const struct of_device_id clk_rs9_of_match[] = {
|
||||
{ .compatible = "renesas,9fgv0241", .data = &renesas_9fgv0241_info },
|
||||
{ .compatible = "renesas,9fgv0441", .data = &renesas_9fgv0441_info },
|
||||
{ .compatible = "renesas,9fgv0841", .data = &renesas_9fgv0841_info },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, clk_rs9_of_match);
|
||||
|
Loading…
x
Reference in New Issue
Block a user