Amlogic drivers changes for v6.6:

- Add C3 Power Domains
 - Explicitly include correct DT includes in Amlogic SoC drivers
 - fix to avoid potential NULL pointer dereference in meson_sm
 - Merge of genpd-v6.5-rc1-1 to move genpd amlogic drivers
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPVPGJshWBf4d9CyLd9zb2sjISdEFAmTM+6IACgkQd9zb2sjI
 SdHRHg//YW+Xj0fK9braP1COux5mKmqltYokFL3wWz7nBKYNsQwzUtY9VS187/hM
 FST60rV+X175yOibNgspN76oK6dDQGkiNtNFZlD6N5HeN/UyiziCucN8GR8reVDK
 NDyv8gkO5aiXHAi9TUGuyMhFE38O8GGln7p05czDpKA4teRAUfWnafixupo/e8/r
 grLVSyNnmWECB5jF077LzgHuHBhXbHeFVQVLUaq5NClucSsqbaq4o21tYLkGAo67
 eqQ7Mnlu0/080V2oBeuaWPJMWgLoAEmmarUFI02l7jc5ar717gu4Dqv9wu9F89rc
 jTKv+YtMiTq7vYyUQtaWZlqGDq/sEU19hWmqS7CqLC4eEOEkiWY2Sn5FH8SnkN8F
 NuuB12LJ8tFvczL07Q6Hv1fHe4UfyXe77GlKDgtn/GFqYCUmZop6wUhap0l+S/2S
 lbDpiDRo+kq02vsGrEUE9vimiL3FBCjr6r45tutnG0icTF0kE73WRuhYB3mkiJ0R
 Hz+4TrcjciTVLaBBKgJsGqomUb6qb7XEsUw11WehYW1IJAoEKCLhTK7S6ij88gaD
 UHphUkPFxGDIbjE79PrGw91pG3NStwXDBntH9vu8RwTEKLgBATdCK893rzH0hRJY
 RreFHYHWEicaBj3kpxXtXhXy0RSgN5b4VBB3/gfqqqUxTW4aIn4=
 =eBDR
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmTXWaIACgkQYKtH/8kJ
 Uic6aw//S4F9FArxHq8iGNFgfEpvXITdniqIxSsGBFXuKA/Vkl2QlffjmEbmkRvv
 t/AIJTNAy/PGr8FhYoW00O+9MiDbCVcMZDdl5aT252kGYCm2DfqF5C2/28ZorBtk
 LAJs9UyyHIlDZvCZL7aRDvoLojKVGuId33uRKzUI9DTRA6SIRGiHvhqLJYRf9AGo
 6dR6lqcwCD4FiJNJ07loAsUbMY5p3lnDV/hwS5uu3q4Z1kMpfwcgP61GszlSU0Z8
 20yOUnDjZhOdz5Oprm6jAn0gNY0up5Ndd3wHSlScu9fUrN/BHY+Lbp4qa2hSFOMa
 tyGJPHE2EJG+zFdQpoWTDFuUwqbXyAQ4qyQyZwYqUbz1dW4oCwbtwINVtdQfVrQP
 IGuiRx9ZweahUYp6CdiG7EyH2FUir08hjUQuNwFOQZV2RVya73cF+AGrqyvA/zbn
 mUrMk8XD8rb+4WBbKFwMsRGFQ3CosDt5fsKdHGXljBBAMbSHP3PIsQKu+ejHQmVJ
 txMDN/s30iOJ7lU3W9LpqYhhxjh72OLL4iG+hI2faz+mp0qsKhV/k9iOrpvWY4it
 InNvKXiV/mxIDe0/qudde9vXBV8R5WEt1yyF7aTZDdnm1QzRncXy6kBBA1GSy12S
 gdDN/YwiFDsVOZIgXYp/qW7dKmhpt9KIoGLWSLyK/hbfZ+WBbLk=
 =jJE/
 -----END PGP SIGNATURE-----

Merge tag 'amlogic-drivers-for-v6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux into soc/drivers

Amlogic drivers changes for v6.6:
- Add C3 Power Domains
- Explicitly include correct DT includes in Amlogic SoC drivers
- fix to avoid potential NULL pointer dereference in meson_sm
- Merge of genpd-v6.5-rc1-1 to move genpd amlogic drivers

* tag 'amlogic-drivers-for-v6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux:
  firmware: meson_sm: fix to avoid potential NULL pointer dereference
  soc: amlogic: Explicitly include correct DT includes
  soc: c3: Add support for power domains controller
  dt-bindings: power: add Amlogic C3 power domains
  soc: amlogic: use name instead of index as criterion

Link: https://lore.kernel.org/r/77e328b5-0d47-36e8-f62d-c745df06fb87@linaro.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2023-08-12 12:06:26 +02:00
commit f1c047c2f7
7 changed files with 60 additions and 7 deletions

View File

@ -12,7 +12,7 @@ maintainers:
- Jianxin Pan <jianxin.pan@amlogic.com>
description: |+
Secure Power Domains used in Meson A1/C1/S4 SoCs, and should be the child node
Secure Power Domains used in Meson A1/C1/S4 & C3 SoCs, and should be the child node
of secure-monitor.
properties:
@ -20,6 +20,7 @@ properties:
enum:
- amlogic,meson-a1-pwrc
- amlogic,meson-s4-pwrc
- amlogic,c3-pwrc
"#power-domain-cells":
const: 1

View File

@ -292,6 +292,8 @@ static int __init meson_sm_probe(struct platform_device *pdev)
return -ENOMEM;
chip = of_match_device(meson_sm_ids, dev)->data;
if (!chip)
return -EINVAL;
if (chip->cmd_shmem_in_base) {
fw->sm_shmem_in_base = meson_sm_map_shmem(chip->cmd_shmem_in_base,

View File

@ -4,13 +4,12 @@
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/bitfield.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/reset-controller.h>
#include <linux/reset.h>
#include <linux/clk.h>

View File

@ -5,13 +5,12 @@
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/bitfield.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/reset.h>
#include <linux/clk.h>
#include <linux/module.h>

View File

@ -7,10 +7,11 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/io.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <dt-bindings/power/meson-a1-power.h>
#include <dt-bindings/power/amlogic,c3-pwrc.h>
#include <dt-bindings/power/meson-s4-power.h>
#include <linux/arm-smccc.h>
#include <linux/firmware/meson/meson_sm.h>
@ -120,6 +121,22 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
SEC_PD(RSA, 0),
};
static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
SEC_PD(C3_NNA, 0),
SEC_PD(C3_AUDIO, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_SDIOA, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_EMMC, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_USB_COMB, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_SDCARD, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_ETH, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_GE2D, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_CVE, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_GDC_WRAP, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_ISP_TOP, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_MIPI_ISP_WRAP, GENPD_FLAG_ALWAYS_ON),
SEC_PD(C3_VCODEC, 0),
};
static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
SEC_PD(S4_DOS_HEVC, 0),
SEC_PD(S4_DOS_VDEC, 0),
@ -179,7 +196,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
for (i = 0 ; i < match->count ; ++i) {
struct meson_secure_pwrc_domain *dom = &pwrc->domains[i];
if (!match->domains[i].index)
if (!match->domains[i].name)
continue;
dom->pwrc = pwrc;
@ -202,6 +219,11 @@ static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = {
.count = ARRAY_SIZE(a1_pwrc_domains),
};
static struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = {
.domains = c3_pwrc_domains,
.count = ARRAY_SIZE(c3_pwrc_domains),
};
static struct meson_secure_pwrc_domain_data meson_secure_s4_pwrc_data = {
.domains = s4_pwrc_domains,
.count = ARRAY_SIZE(s4_pwrc_domains),
@ -212,6 +234,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = {
.compatible = "amlogic,meson-a1-pwrc",
.data = &meson_secure_a1_pwrc_data,
},
{
.compatible = "amlogic,c3-pwrc",
.data = &amlogic_secure_c3_pwrc_data,
},
{
.compatible = "amlogic,meson-s4-pwrc",
.data = &meson_secure_s4_pwrc_data,

View File

@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/soc/amlogic/meson-canvas.h>
#include <linux/of_address.h>

View File

@ -0,0 +1,25 @@
/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
/*
* Copyright (c) 2023 Amlogic, Inc.
* Author: hongyu chen1 <hongyu.chen1@amlogic.com>
*/
#ifndef _DT_BINDINGS_AMLOGIC_C3_POWER_H
#define _DT_BINDINGS_AMLOGIC_C3_POWER_H
#define PWRC_C3_NNA_ID 0
#define PWRC_C3_AUDIO_ID 1
#define PWRC_C3_RESV_SEC_ID 2
#define PWRC_C3_SDIOA_ID 3
#define PWRC_C3_EMMC_ID 4
#define PWRC_C3_USB_COMB_ID 5
#define PWRC_C3_SDCARD_ID 6
#define PWRC_C3_ETH_ID 7
#define PWRC_C3_RESV0_ID 8
#define PWRC_C3_GE2D_ID 9
#define PWRC_C3_CVE_ID 10
#define PWRC_C3_GDC_WRAP_ID 11
#define PWRC_C3_ISP_TOP_ID 12
#define PWRC_C3_MIPI_ISP_WRAP_ID 13
#define PWRC_C3_VCODEC_ID 14
#endif