- add support for MT8186
 - add correct compatible solution for vdosys[0,1] on MT8195
 
 pmic wrapper:
 - add support for MT8365
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCAA1FiEEUdvKHhzqrUYPB/u8L21+TfbCqH4FAmN7w7EXHG1hdHRoaWFz
 LmJnZ0BnbWFpbC5jb20ACgkQL21+TfbCqH7KyA/9GENzKYHhouW/0WiPp4whA3i6
 CU39NsztiHbTcoucymE4dtPBqOFm2PI0KAzkpixe41I0FhWbaleSo60oqPZyoAGZ
 4zdERs/MhpGW8OlHGfDk8x6QS0eoKT+wGNEaDNBp5KY7qeXQudbeUwMqf5ub73JK
 Ply4r3Lakn7NozGzvm55ECRmL+/IfRO5968cKSJNS3Oq43xrndvuGca1TkofQoBO
 uZpnFi+5xi9sxICY6DoXQsiJEhWgjHnNkcMFWkAP2W9wtvb2G8mIF9Axy019eyXD
 9yI5VeTrYRkq1FYStu9TUC9Q+DlWVx3D46EablnWM9R3Td8ZHuPxRByL6AC2LYr/
 vxCxCCY3MASfYPVdnyMBA9wHMz1moEdEwelobW5USmTsXuP+Jv3IVprHGR0h7ux+
 O1BnoRIOmdGjiU63kui/39B+0magZJoqsush8f7MqBXLVMLMl6+HySVSiYsyb/56
 8ZVOQPaphQa0/wFigY+9BYPkJrefq6NPAMaR3CrOVjuAMLt5Mj989jSXHhax29kI
 Q2OQQz3csxomKiDl8sySG6sf6kRFcGFXoETEkTDKDPB0BTD+I0/+Wj4BcShfqlAM
 Oac2eSIyRvqm/4eGr8IPcqRmF/2wHncPRR1wuMHFPqgMM7TOrOUaYovzrbXPlUb+
 YNiBJ/StzuP/M/MBqEQ=
 =HAFo
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmN9QYAACgkQmmx57+YA
 GNk0dg//YhAAVOQa8fzZ4pEjs7IsoUzNnJ1O29Hn/VmaHAsPntzpo8fa/Td+WI7f
 Js+ZwjIXRDv/SL/B0MGxI9fQFyfXr7V6IBZGZ2sfghz1WGCiV42zquSRPJaWXMib
 9JsyeghfhaLbWJBqd7tSGyuSpWC/4XKI1obzSZpTntCADp9a8mW871A+AiX8G4Iw
 XiIWsmbJZcvz5CTNAb7MuxvCT8964Eazcwen6Yxe6NpdhS7jzXurE3CXSG+SMf+4
 I+BDuyTY44d5lhtHHGYn+43vvRl5J42J7A6rNVpoByrvxwtcyIQXeptsJopXFrEg
 ilrvH6bVIoot2ZTi70j1DBiOG398B4hvSY5YLJwKR1aBCyYnwdV8iFZBWNyae+wT
 8MLRU73ygzLQbb2CEiopmpFyVTVVRJcYAdUveIJYgaCdM3IEycYBD5pUZBvpd2Lj
 KdHJm4tVgAqKyh39NxDnCh8aJYWlFYP+NnR/AlJ2c6DKnYWSqk1yfeCR/02gg/1k
 JTqrkC4ebhlIuJm6o7yjItG2HnDwuNnOgugQx5Jp56iPqLYPuuRh6b+SLxUHTTvR
 v5RhZ5cOHuu9ac5AHIaGyu7X3fI31ACCEM2B0iDZ1qRp9+OwCez9WGJNlsgfE5OE
 D7zqdCcm934XDuyawCDQXDEvTSIpFL94RtpIUhoeGyFt3cZtLV0=
 =eHkQ
 -----END PGP SIGNATURE-----

Merge tag 'v6.1-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux into soc/drivers

mmsys:
- add support for MT8186
- add correct compatible solution for vdosys[0,1] on MT8195

pmic wrapper:
- add support for MT8365

* tag 'v6.1-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux:
  soc: mediatek: Add deprecated compatible to mmsys
  soc: mediatek: pwrap: add mt8365 SoC support
  soc: mediatek: pwrap: add support for sys & tmr clocks
  dt-bindings: soc: mediatek: pwrap: add MT8365 SoC bindings
  soc: mediatek: add mtk-mmsys support for mt8195 vdosys0
  Revert "soc: mediatek: add mtk-mmsys support for mt8195 vdosys0"
  dt-bindings: arm: mediatek: mmsys: change compatible for MT8195
  soc: mediatek: Add all settings to mtk_mmsys_ddp_dpi_fmt_config func

Link: https://lore.kernel.org/r/cc756001-a942-90b0-b79d-62c1fc189828@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2022-11-22 22:39:09 +01:00
commit 919977b690
7 changed files with 176 additions and 152 deletions

View File

@ -32,14 +32,26 @@ properties:
- mediatek,mt8183-mmsys
- mediatek,mt8186-mmsys
- mediatek,mt8192-mmsys
- mediatek,mt8195-mmsys
- mediatek,mt8365-mmsys
- const: syscon
- description: vdosys0 and vdosys1 are 2 display HW pipelines,
so mt8195 binding should be deprecated.
deprecated: true
items:
- const: mediatek,mt8195-mmsys
- const: syscon
- items:
- const: mediatek,mt7623-mmsys
- const: mediatek,mt2701-mmsys
- const: syscon
- items:
- const: mediatek,mt8195-vdosys0
- const: mediatek,mt8195-mmsys
- const: syscon
reg:
maxItems: 1

View File

@ -30,6 +30,7 @@ Required properties in pwrap device node.
"mediatek,mt8186-pwrap" for MT8186 SoCs
"mediatek,mt8188-pwrap", "mediatek,mt8195-pwrap" for MT8188 SoCs
"mediatek,mt8195-pwrap" for MT8195 SoCs
"mediatek,mt8365-pwrap" for MT8365 SoCs
"mediatek,mt8516-pwrap" for MT8516 SoCs
- interrupts: IRQ for pwrap in SOC
- reg-names: "pwrap" is required; "pwrap-bridge" is optional.
@ -39,6 +40,8 @@ Required properties in pwrap device node.
- clock-names: Must include the following entries:
"spi": SPI bus clock
"wrap": Main module clock
"sys": Optional system module clock
"tmr": Optional timer module clock
- clocks: Must contain an entry for each entry in clock-names.
Optional properities:

View File

@ -5,9 +5,11 @@
/* Values for DPI configuration in MMSYS address space */
#define MT8186_MMSYS_DPI_OUTPUT_FORMAT 0x400
#define DPI_FORMAT_MASK 0x1
#define DPI_RGB888_DDR_CON BIT(0)
#define DPI_RGB565_SDR_CON BIT(1)
#define MT8186_DPI_FORMAT_MASK GENMASK(1, 0)
#define MT8186_DPI_RGB888_SDR_CON 0
#define MT8186_DPI_RGB888_DDR_CON 1
#define MT8186_DPI_RGB565_SDR_CON 2
#define MT8186_DPI_RGB565_DDR_CON 3
#define MT8186_MMSYS_OVL_CON 0xF04
#define MT8186_MMSYS_OVL0_CON_MASK 0x3

View File

@ -26,61 +26,26 @@ static const struct mtk_mmsys_driver_data mt2701_mmsys_driver_data = {
.num_routes = ARRAY_SIZE(mmsys_default_routing_table),
};
static const struct mtk_mmsys_match_data mt2701_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt2701_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = {
.clk_driver = "clk-mt2712-mm",
.routes = mmsys_default_routing_table,
.num_routes = ARRAY_SIZE(mmsys_default_routing_table),
};
static const struct mtk_mmsys_match_data mt2712_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt2712_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt6779_mmsys_driver_data = {
.clk_driver = "clk-mt6779-mm",
};
static const struct mtk_mmsys_match_data mt6779_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt6779_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt6797_mmsys_driver_data = {
.clk_driver = "clk-mt6797-mm",
};
static const struct mtk_mmsys_match_data mt6797_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt6797_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt8167_mmsys_driver_data = {
.clk_driver = "clk-mt8167-mm",
.routes = mt8167_mmsys_routing_table,
.num_routes = ARRAY_SIZE(mt8167_mmsys_routing_table),
};
static const struct mtk_mmsys_match_data mt8167_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt8167_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = {
.clk_driver = "clk-mt8173-mm",
.routes = mmsys_default_routing_table,
@ -88,13 +53,6 @@ static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = {
.sw0_rst_offset = MT8183_MMSYS_SW0_RST_B,
};
static const struct mtk_mmsys_match_data mt8173_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt8173_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = {
.clk_driver = "clk-mt8183-mm",
.routes = mmsys_mt8183_routing_table,
@ -102,13 +60,6 @@ static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = {
.sw0_rst_offset = MT8183_MMSYS_SW0_RST_B,
};
static const struct mtk_mmsys_match_data mt8183_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt8183_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt8186_mmsys_driver_data = {
.clk_driver = "clk-mt8186-mm",
.routes = mmsys_mt8186_routing_table,
@ -116,13 +67,6 @@ static const struct mtk_mmsys_driver_data mt8186_mmsys_driver_data = {
.sw0_rst_offset = MT8186_MMSYS_SW0_RST_B,
};
static const struct mtk_mmsys_match_data mt8186_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt8186_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = {
.clk_driver = "clk-mt8192-mm",
.routes = mmsys_mt8192_routing_table,
@ -130,66 +74,25 @@ static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = {
.sw0_rst_offset = MT8186_MMSYS_SW0_RST_B,
};
static const struct mtk_mmsys_match_data mt8192_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt8192_mmsys_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = {
.io_start = 0x1c01a000,
.clk_driver = "clk-mt8195-vdo0",
.routes = mmsys_mt8195_routing_table,
.num_routes = ARRAY_SIZE(mmsys_mt8195_routing_table),
};
static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = {
.io_start = 0x1c100000,
.clk_driver = "clk-mt8195-vdo1",
};
static const struct mtk_mmsys_match_data mt8195_mmsys_match_data = {
.num_drv_data = 2,
.drv_data = {
&mt8195_vdosys0_driver_data,
&mt8195_vdosys1_driver_data,
},
};
static const struct mtk_mmsys_driver_data mt8365_mmsys_driver_data = {
.clk_driver = "clk-mt8365-mm",
.routes = mt8365_mmsys_routing_table,
.num_routes = ARRAY_SIZE(mt8365_mmsys_routing_table),
};
static const struct mtk_mmsys_match_data mt8365_mmsys_match_data = {
.num_drv_data = 1,
.drv_data = {
&mt8365_mmsys_driver_data,
},
};
struct mtk_mmsys {
void __iomem *regs;
const struct mtk_mmsys_driver_data *data;
spinlock_t lock; /* protects mmsys_sw_rst_b reg */
struct reset_controller_dev rcdev;
phys_addr_t io_start;
};
static int mtk_mmsys_find_match_drvdata(struct mtk_mmsys *mmsys,
const struct mtk_mmsys_match_data *match)
{
int i;
for (i = 0; i < match->num_drv_data; i++)
if (mmsys->io_start == match->drv_data[i]->io_start)
return i;
return -EINVAL;
}
void mtk_mmsys_ddp_connect(struct device *dev,
enum mtk_ddp_comp_id cur,
enum mtk_ddp_comp_id next)
@ -238,12 +141,27 @@ static void mtk_mmsys_update_bits(struct mtk_mmsys *mmsys, u32 offset, u32 mask,
void mtk_mmsys_ddp_dpi_fmt_config(struct device *dev, u32 val)
{
if (val)
mtk_mmsys_update_bits(dev_get_drvdata(dev), MT8186_MMSYS_DPI_OUTPUT_FORMAT,
DPI_RGB888_DDR_CON, DPI_FORMAT_MASK);
else
mtk_mmsys_update_bits(dev_get_drvdata(dev), MT8186_MMSYS_DPI_OUTPUT_FORMAT,
DPI_RGB565_SDR_CON, DPI_FORMAT_MASK);
struct mtk_mmsys *mmsys = dev_get_drvdata(dev);
switch (val) {
case MTK_DPI_RGB888_SDR_CON:
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB888_SDR_CON);
break;
case MTK_DPI_RGB565_SDR_CON:
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB565_SDR_CON);
break;
case MTK_DPI_RGB565_DDR_CON:
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB565_DDR_CON);
break;
case MTK_DPI_RGB888_DDR_CON:
default:
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB888_DDR_CON);
break;
}
}
EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_dpi_fmt_config);
@ -304,9 +222,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct platform_device *clks;
struct platform_device *drm;
const struct mtk_mmsys_match_data *match_data;
struct mtk_mmsys *mmsys;
struct resource *res;
int ret;
mmsys = devm_kzalloc(dev, sizeof(*mmsys), GFP_KERNEL);
@ -332,27 +248,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
return ret;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, "Couldn't get mmsys resource\n");
return -EINVAL;
}
mmsys->io_start = res->start;
match_data = of_device_get_match_data(dev);
if (match_data->num_drv_data > 1) {
/* This SoC has multiple mmsys channels */
ret = mtk_mmsys_find_match_drvdata(mmsys, match_data);
if (ret < 0) {
dev_err(dev, "Couldn't get match driver data\n");
return ret;
}
mmsys->data = match_data->drv_data[ret];
} else {
dev_dbg(dev, "Using single mmsys channel\n");
mmsys->data = match_data->drv_data[0];
}
mmsys->data = of_device_get_match_data(&pdev->dev);
platform_set_drvdata(pdev, mmsys);
clks = platform_device_register_data(&pdev->dev, mmsys->data->clk_driver,
@ -373,47 +269,51 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
static const struct of_device_id of_match_mtk_mmsys[] = {
{
.compatible = "mediatek,mt2701-mmsys",
.data = &mt2701_mmsys_match_data,
.data = &mt2701_mmsys_driver_data,
},
{
.compatible = "mediatek,mt2712-mmsys",
.data = &mt2712_mmsys_match_data,
.data = &mt2712_mmsys_driver_data,
},
{
.compatible = "mediatek,mt6779-mmsys",
.data = &mt6779_mmsys_match_data,
.data = &mt6779_mmsys_driver_data,
},
{
.compatible = "mediatek,mt6797-mmsys",
.data = &mt6797_mmsys_match_data,
.data = &mt6797_mmsys_driver_data,
},
{
.compatible = "mediatek,mt8167-mmsys",
.data = &mt8167_mmsys_match_data,
.data = &mt8167_mmsys_driver_data,
},
{
.compatible = "mediatek,mt8173-mmsys",
.data = &mt8173_mmsys_match_data,
.data = &mt8173_mmsys_driver_data,
},
{
.compatible = "mediatek,mt8183-mmsys",
.data = &mt8183_mmsys_match_data,
.data = &mt8183_mmsys_driver_data,
},
{
.compatible = "mediatek,mt8186-mmsys",
.data = &mt8186_mmsys_match_data,
.data = &mt8186_mmsys_driver_data,
},
{
.compatible = "mediatek,mt8192-mmsys",
.data = &mt8192_mmsys_match_data,
.data = &mt8192_mmsys_driver_data,
},
{ /* deprecated compatible */
.compatible = "mediatek,mt8195-mmsys",
.data = &mt8195_vdosys0_driver_data,
},
{
.compatible = "mediatek,mt8195-mmsys",
.data = &mt8195_mmsys_match_data,
.compatible = "mediatek,mt8195-vdosys0",
.data = &mt8195_vdosys0_driver_data,
},
{
.compatible = "mediatek,mt8365-mmsys",
.data = &mt8365_mmsys_match_data,
.data = &mt8365_mmsys_driver_data,
},
{ }
};

View File

@ -87,18 +87,12 @@ struct mtk_mmsys_routes {
};
struct mtk_mmsys_driver_data {
const resource_size_t io_start;
const char *clk_driver;
const struct mtk_mmsys_routes *routes;
const unsigned int num_routes;
const u16 sw0_rst_offset;
};
struct mtk_mmsys_match_data {
unsigned short num_drv_data;
const struct mtk_mmsys_driver_data *drv_data[];
};
/*
* Routes in mt8173, mt2701, mt2712 are different. That means
* in the same register address, it controls different input/output

View File

@ -983,6 +983,68 @@ static int mt8195_regs[] = {
[PWRAP_WACS2_RDATA] = 0x8A8,
};
static int mt8365_regs[] = {
[PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8,
[PWRAP_CSHEXT_WRITE] = 0x24,
[PWRAP_CSHEXT_READ] = 0x28,
[PWRAP_STAUPD_PRD] = 0x3c,
[PWRAP_STAUPD_GRPEN] = 0x40,
[PWRAP_STAUPD_MAN_TRIG] = 0x58,
[PWRAP_STAUPD_STA] = 0x5c,
[PWRAP_WRAP_STA] = 0x60,
[PWRAP_HARB_INIT] = 0x64,
[PWRAP_HARB_HPRIO] = 0x68,
[PWRAP_HIPRIO_ARB_EN] = 0x6c,
[PWRAP_HARB_STA0] = 0x70,
[PWRAP_HARB_STA1] = 0x74,
[PWRAP_MAN_EN] = 0x7c,
[PWRAP_MAN_CMD] = 0x80,
[PWRAP_MAN_RDATA] = 0x84,
[PWRAP_MAN_VLDCLR] = 0x88,
[PWRAP_WACS0_EN] = 0x8c,
[PWRAP_INIT_DONE0] = 0x90,
[PWRAP_WACS0_CMD] = 0xc00,
[PWRAP_WACS0_RDATA] = 0xc04,
[PWRAP_WACS0_VLDCLR] = 0xc08,
[PWRAP_WACS1_EN] = 0x94,
[PWRAP_INIT_DONE1] = 0x98,
[PWRAP_WACS2_EN] = 0x9c,
[PWRAP_INIT_DONE2] = 0xa0,
[PWRAP_WACS2_CMD] = 0xc20,
[PWRAP_WACS2_RDATA] = 0xc24,
[PWRAP_WACS2_VLDCLR] = 0xc28,
[PWRAP_INT_EN] = 0xb4,
[PWRAP_INT_FLG_RAW] = 0xb8,
[PWRAP_INT_FLG] = 0xbc,
[PWRAP_INT_CLR] = 0xc0,
[PWRAP_SIG_ADR] = 0xd4,
[PWRAP_SIG_MODE] = 0xd8,
[PWRAP_SIG_VALUE] = 0xdc,
[PWRAP_SIG_ERRVAL] = 0xe0,
[PWRAP_CRC_EN] = 0xe4,
[PWRAP_TIMER_EN] = 0xe8,
[PWRAP_TIMER_STA] = 0xec,
[PWRAP_WDT_UNIT] = 0xf0,
[PWRAP_WDT_SRC_EN] = 0xf4,
[PWRAP_WDT_FLG] = 0xfc,
[PWRAP_DEBUG_INT_SEL] = 0x104,
[PWRAP_CIPHER_KEY_SEL] = 0x1c4,
[PWRAP_CIPHER_IV_SEL] = 0x1c8,
[PWRAP_CIPHER_RDY] = 0x1d0,
[PWRAP_CIPHER_MODE] = 0x1d4,
[PWRAP_CIPHER_SWRST] = 0x1d8,
[PWRAP_DCM_EN] = 0x1dc,
[PWRAP_DCM_DBC_PRD] = 0x1e0,
[PWRAP_EINT_STA0_ADR] = 0x44,
[PWRAP_EINT_STA1_ADR] = 0x48,
[PWRAP_INT1_EN] = 0xc4,
[PWRAP_INT1_FLG] = 0xcc,
[PWRAP_INT1_CLR] = 0xd0,
[PWRAP_WDT_SRC_EN_1] = 0xf8,
};
static int mt8516_regs[] = {
[PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4,
@ -1139,6 +1201,7 @@ enum pwrap_type {
PWRAP_MT8183,
PWRAP_MT8186,
PWRAP_MT8195,
PWRAP_MT8365,
PWRAP_MT8516,
};
@ -1171,6 +1234,8 @@ struct pmic_wrapper {
const struct pwrap_slv_type *slave;
struct clk *clk_spi;
struct clk *clk_wrap;
struct clk *clk_sys;
struct clk *clk_tmr;
struct reset_control *rstc;
struct reset_control *rstc_bridge;
@ -1596,6 +1661,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp)
case PWRAP_MT6797:
case PWRAP_MT8173:
case PWRAP_MT8186:
case PWRAP_MT8365:
case PWRAP_MT8516:
pwrap_writel(wrp, 1, PWRAP_CIPHER_EN);
break;
@ -2104,6 +2170,19 @@ static struct pmic_wrapper_type pwrap_mt8195 = {
.init_soc_specific = NULL,
};
static const struct pmic_wrapper_type pwrap_mt8365 = {
.regs = mt8365_regs,
.type = PWRAP_MT8365,
.arb_en_all = 0x3ffff,
.int_en_all = 0x7f1fffff,
.int1_en_all = 0x0,
.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
.caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_WDT_SRC1,
.init_reg_clock = pwrap_common_init_reg_clock,
.init_soc_specific = NULL,
};
static struct pmic_wrapper_type pwrap_mt8516 = {
.regs = mt8516_regs,
.type = PWRAP_MT8516,
@ -2141,6 +2220,7 @@ static const struct of_device_id of_pwrap_match_tbl[] = {
{ .compatible = "mediatek,mt8183-pwrap", .data = &pwrap_mt8183 },
{ .compatible = "mediatek,mt8186-pwrap", .data = &pwrap_mt8186 },
{ .compatible = "mediatek,mt8195-pwrap", .data = &pwrap_mt8195 },
{ .compatible = "mediatek,mt8365-pwrap", .data = &pwrap_mt8365 },
{ .compatible = "mediatek,mt8516-pwrap", .data = &pwrap_mt8516 },
{ /* sentinel */ }
};
@ -2214,6 +2294,20 @@ static int pwrap_probe(struct platform_device *pdev)
return PTR_ERR(wrp->clk_wrap);
}
wrp->clk_sys = devm_clk_get_optional(wrp->dev, "sys");
if (IS_ERR(wrp->clk_sys)) {
return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_sys),
"failed to get clock: %pe\n",
wrp->clk_sys);
}
wrp->clk_tmr = devm_clk_get_optional(wrp->dev, "tmr");
if (IS_ERR(wrp->clk_tmr)) {
return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_tmr),
"failed to get clock: %pe\n",
wrp->clk_tmr);
}
ret = clk_prepare_enable(wrp->clk_spi);
if (ret)
return ret;
@ -2222,6 +2316,14 @@ static int pwrap_probe(struct platform_device *pdev)
if (ret)
goto err_out1;
ret = clk_prepare_enable(wrp->clk_sys);
if (ret)
goto err_out2;
ret = clk_prepare_enable(wrp->clk_tmr);
if (ret)
goto err_out3;
/* Enable internal dynamic clock */
if (HAS_CAP(wrp->master->caps, PWRAP_CAP_DCM)) {
pwrap_writel(wrp, 1, PWRAP_DCM_EN);
@ -2236,7 +2338,7 @@ static int pwrap_probe(struct platform_device *pdev)
ret = pwrap_init(wrp);
if (ret) {
dev_dbg(wrp->dev, "init failed with %d\n", ret);
goto err_out2;
goto err_out4;
}
}
@ -2250,7 +2352,7 @@ static int pwrap_probe(struct platform_device *pdev)
if (!(pwrap_readl(wrp, PWRAP_WACS2_RDATA) & mask_done)) {
dev_dbg(wrp->dev, "initialization isn't finished\n");
ret = -ENODEV;
goto err_out2;
goto err_out4;
}
/* Initialize watchdog, may not be done by the bootloader */
@ -2288,7 +2390,7 @@ static int pwrap_probe(struct platform_device *pdev)
IRQF_TRIGGER_HIGH,
"mt-pmic-pwrap", wrp);
if (ret)
goto err_out2;
goto err_out4;
wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, wrp->slave->regops->regmap);
if (IS_ERR(wrp->regmap)) {
@ -2300,11 +2402,15 @@ static int pwrap_probe(struct platform_device *pdev)
if (ret) {
dev_dbg(wrp->dev, "failed to create child devices at %pOF\n",
np);
goto err_out2;
goto err_out4;
}
return 0;
err_out4:
clk_disable_unprepare(wrp->clk_tmr);
err_out3:
clk_disable_unprepare(wrp->clk_sys);
err_out2:
clk_disable_unprepare(wrp->clk_wrap);
err_out1:

View File

@ -9,6 +9,13 @@
enum mtk_ddp_comp_id;
struct device;
enum mtk_dpi_out_format_con {
MTK_DPI_RGB888_SDR_CON,
MTK_DPI_RGB888_DDR_CON,
MTK_DPI_RGB565_SDR_CON,
MTK_DPI_RGB565_DDR_CON
};
enum mtk_ddp_comp_id {
DDP_COMPONENT_AAL0,
DDP_COMPONENT_AAL1,