Commit Graph

22 Commits

Author SHA1 Message Date
Arnd Bergmann
d1d43fae06 HiSilicon driver updates for v6.13
- Add the sysfs to show all HCCS types used on the platform
 - Add the low power feature for HCCS by adjusting the lane number
 - Few cleanups and improvements: correct a PCC typo, verify the die, port
 information, base address and size, update the lane_mode to max_lane_num
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEQeMYD8qOQTc1R/snC8hXbtmJZlwFAmcN3jAVHHh1d2VpNUBo
 aXNpbGljb24uY29tAAoJEAvIV27ZiWZcNBcP/2hYhGkVJynze6XdanfmDnMjUxKL
 CZQwDXEKOJIik9yLtJlPRhh8NuY+UTnsQquUJPY7XbAydjOjVFycwwQaQDiuC5zr
 JYpwgbM2cQ019fqEM8o8Y8mMAoo55bOmqJZ+gs31c7Zi5LeFNEHTXp+glaqTOXBQ
 Oc6H2exR52btPYZps+GfqVcePkaLVsMN/q6/akDTFO02oYALtinnm6R3X2ingEvH
 6+NNOOA/zAYKSKBLHvrquJzPHzCuFNK9D/UX9MkyIGoI3yo3Clxj4la97oevQ1hy
 oEvfgk0/VC/y5P4IUPAyXUIq7H4YeHurZ+gjw79AsH+Ky+WEKHOLnb13HMQAXDqv
 4PqwCE6QUJ0bCJbIxP78y96zzxtDXUqQABQGDtGB1qvDR+h5RiP1ELCWdn0v1DEZ
 R8/LnCIszYNHgQdjgsDgi5E8gttzGFFkMcYUaIwQ+CRd3I4qgowKXdkC2DISTOMS
 lNwp9tDcTouidya5Mxwzpjl0b3jv3Dpq1Vp2/Ck3CHLj1IVWuccFMKsZ4J9JZa7T
 KQjDDHWF1A/AK3N6u0ELxd0L7JHxM9hCwHkPsEU8EkP94FRSSPFPPDnuecx5sPNg
 knhUdEZnaKua3BO8kVZX0KJRZN/4LODytKseblv07sh1qMTfZhl9xTfxmTEzA+9X
 HBiPTnvh7omEaCfH
 =v3A3
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmck/WgACgkQYKtH/8kJ
 UicM1Q/8CzPTCxGEsuwuP3vc+BmSQV0J7sHIzR2XuvUyaxHEvfVCvPomP/eScPst
 bYbB0aGWcII0hfKjfXP4EuwqNWYD6j5rBkH7yuHeUYNh2XHUKFZZ67wIS1+TkbG5
 RVdibU3Bhm/vvJPDoDwcwH23El8At+pq39pT++8Yg6WXCuRwO5rYnnzYLb5xUhA8
 S5xYuvnTNqw/ci7N0d0mIOdGycv+5KMe+cATpWljHlwvqAGrcF1ZkeB2W5MVBnaf
 qRp/mEryohbpkxtIXTWcfGD7yBjIW4yMlpypMhInSr27aVFNYcBnzNVEwK/r1njA
 0hn2VoILhfmlkyEZGHfrdFoOuAf5qvux3s70K5WAnusY8qenmbcYnTihDzGsiBGV
 Udujhr7vk3roKaTyb6yU2sBSEZK1Cp0t4homWT2FpY7bJw0sJSqvU3RxsQK3bNA1
 iVJqyci/00TibSHrhjsEv4kgCOOniSPivK1J41j5CWwblnC5x29z+fjdw6Fk3Rjw
 pMk/K5wdYjQMpqmvoerGy+Tsmj5DNPOV5ZrVJ9GSlGJBCJ2Wke+f/CWUdPI9FIvi
 kyDKuQxlr6JL/r4c8gvey6MOLPEq471SyO6827n4XV9qsNagPffKZap+I5BZdhwM
 kfIoP1qcX2LW6zEGX6U+At/aEZx7BZNNlfSLZVDqbr7BKOXSsWg=
 =AbzF
 -----END PGP SIGNATURE-----

Merge tag 'hisi-drivers-for-6.13' of https://github.com/hisilicon/linux-hisi into arm/drivers

HiSilicon driver updates for v6.13

- Add the sysfs to show all HCCS types used on the platform
- Add the low power feature for HCCS by adjusting the lane number
- Few cleanups and improvements: correct a PCC typo, verify the die, port
information, base address and size, update the lane_mode to max_lane_num

* tag 'hisi-drivers-for-6.13' of https://github.com/hisilicon/linux-hisi:
  soc: hisilicon: kunpeng_hccs: Support low power feature for the specified HCCS type
  soc: hisilicon: kunpeng_hccs: Add used HCCS types sysfs
  soc: hisilicon: kunpeng_hccs: Fix the 'lane_mode' field name in port info structure to 'max_lane_num'
  soc: hisilicon: kunpeng_hccs: Add the check for base address and size of shared memory
  soc: hisilicon: kunpeng_hccs: Return failure on having not die or port information
  soc: hisilicon: kunpeng_hccs: Fix a PCC typo

Link: https://lore.kernel.org/r/671B3FBD.8050905@hisilicon.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-11-01 17:10:16 +01:00
Uwe Kleine-König
511c06e390
soc: Switch back to struct platform_driver::remove()
After commit 0edb555a65 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/soc to use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

On the way do a few whitespace changes to make indention consistent.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Herve Codina <herve.codina@bootlin.com> # for fsl/qe/{qmc,tsa}.c
Acked-by: Bjorn Andersson <andersson@kernel.org> # qcom parts
Acked-by: Gabriel Somlo <gsomlo@gmail.com>
Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au> # aspeed
Link: https://lore.kernel.org/r/20241029074859.509587-2-u.kleine-koenig@baylibre.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-11-01 17:08:57 +01:00
Huisong Li
e3c289c091 soc: hisilicon: kunpeng_hccs: Support low power feature for the specified HCCS type
Add the low power feature for the specified HCCS type by increasing
and decreasing the used lane number of these HCCS ports on platform.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-10-14 08:54:51 +00:00
Huisong Li
23fe8112a2 soc: hisilicon: kunpeng_hccs: Add used HCCS types sysfs
Kunpeng_hccs driver supports multiple HCCS types used on one platform at
the same time. In this case, to find which HCCS types are used on the
platform the user needs to scan the type attribute of all ports, which is
unfriendly to the user. In addition, the aggregated information is also
useful for global control like the low power feature.
So add the sysfs to show all HCCS types used on the platform.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-10-14 08:54:50 +00:00
Huisong Li
b51878373a soc: hisilicon: kunpeng_hccs: Fix the 'lane_mode' field name in port info structure to 'max_lane_num'
The lane mode of HCCS port is an information to user, and actually comes
from the maximum lane number. But it is good and easy for driver to use
the maximum lane number. So fix the 'lane_mode' field name in port info
structure to 'max_lane_num'.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-10-14 08:54:49 +00:00
Huisong Li
3400c85f64 soc: hisilicon: kunpeng_hccs: Add the check for base address and size of shared memory
If the shmem_base_addr from PCCT is zero, hccs_register_pcc_channel will
return success. And then driver will access to illegal address when send
PCC command. In addition, the size of shared memory used for communication
between driver and platform is fixed, namely 64 Bytes which is
unchangeable. So add the verification for hardening code.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-10-14 08:54:48 +00:00
Huisong Li
0c811bd272 soc: hisilicon: kunpeng_hccs: Return failure on having not die or port information
Driver is unavailable if all die number or all port number obtained from
firmware are zero. Although this is unlikely, just to harden the code.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-10-14 08:54:47 +00:00
Huisong Li
1cbe974f81 soc: hisilicon: kunpeng_hccs: Fix a PCC typo
Fix a PCC typo.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-10-14 08:54:46 +00:00
Huisong Li
95d6333e06 soc: hisilicon: kunpeng_hccs: replace MAILBOX dependency with PCC
The kunpeng_hccs driver depends on the Platform Communication Channel
Driver. If the PCC driver is not enabled, this driver will be failed
to probe. And since the PCC driver depends on the MAILBOX, replace
the MAILBOX dependency with the PCC.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-04-25 02:09:46 +00:00
Huisong Li
192f97fe16 soc: hisilicon: kunpeng_hccs: Add the check for obtaining complete port attribute
The hccs_get_all_port_attr() is used to obtain the attribute of all the
ports on a specified DIE from the firmware. However this interface doesn't
ensure whether the firmware reports the complete attribute of all the ports
or not. So this patch adds the check for this.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2024-04-25 01:30:33 +00:00
Huisong Li
be2f78a8a6 soc: hisilicon: kunpeng_hccs: Support the platform with PCC type3 and interrupt ack
Support the platform with PCC type3 and interrupt ack. And a version
specific structure is introduced to handle the difference between the
device in the code.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2023-12-07 06:16:35 +00:00
Huisong Li
a079f32445 soc: hisilicon: kunpeng_hccs: Remove an unused blank line
Remove an unused blank line.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2023-12-07 06:16:34 +00:00
Huisong Li
e1e720f3f2 soc: hisilicon: kunpeng_hccs: Add failure log for no _CRS method
Driver gets the PCC channel id by using the PCC GAS in _CRS.
But, currently, if the firmware has no _CRS method on platform, there
is not any failure log. So this patch adds the log for this.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2023-12-07 06:16:34 +00:00
Huisong Li
734add1a27 soc: hisilicon: kunpeng_hccs: Fix some incorrect format strings
Fix some incorrect format strings.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2023-12-07 06:16:34 +00:00
Linus Torvalds
385903a7ec SoC driver updates for 6.7
The highlights for the driver support this time are
 
  - Qualcomm platforms gain support for the Qualcomm Secure Execution
    Environment firmware interface to access EFI variables on certain
    devices, and new features for multiple platform and firmware drivers.
 
  - Arm FF-A firmware support gains support for v1.1 specification features,
    in particular notification and memory transaction descriptor changes.
 
  - SCMI firmware support now support v3.2 features for clock and DVFS
    configuration and a new transport for Qualcomm platforms.
 
  - Minor cleanups and bugfixes are added to pretty much all the active
    platforms: qualcomm, broadcom, dove, ti-k3, rockchip, sifive, amlogic,
    atmel, tegra, aspeed, vexpress, mediatek, samsung and more.
    In particular, this contains portions of the treewide conversion to
    use __counted_by annotations and the device_get_match_data helper.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmVC10IACgkQYKtH/8kJ
 UifFoQ//Tw7aux88EA2UkyL2Wulv80NwRQn3tQlxI/6ltjBX64yeQ6Y8OzmYdSYK
 20NEpbU7VWOFftN+D6Jp1HLrvfi0OV9uJn3WiTX3ChgDXixpOXo4TYgNNTlb9uZ4
 MrSTG3NkS27m/oTaCmYprOObgSNLq1FRCGIP7w4U9gyMk9N9FSKMpSJjlH06qPz6
 WBLTaIwPgBsyrLfCdxfA1y7AFCAHVxQJO4bp0VWSIalTrneGTeQrd2FgYMUesQ2e
 fIUNCaU4mpmj8XnQ/W19Wsek8FRB+fOh0hn/Gl+iHYibpxusIsn7bkdZ5BOJn2J0
 OY3C1biopaaxXcZ+wmnX9X0ieZ3TDsHzYOEf0zmNGzMZaZkV8kQt4/Ykv77xz6Gc
 4Bl6JI5QZ4rTZvlHYGMYxhy3hKuB31mO2rHbei7eR7J7UmjzWcl5P6HYfCgj7wzH
 crIWj1IR1Nx6Dt/wXf3HlRcEiAEJ2D0M3KIFjAVT239TsxacBfDrRk+YedF2bKbn
 WMYfVM6jJnPOykGg/gMRlttS/o/7TqHBl3y/900Idiijcm3cRPbQ+uKfkpHXftN/
 2vOtsw7pzEg7QQI9GVrb4drTrLvYJ7GQOi4o0twXTCshlXUk2V684jvHt0emFkdX
 ew9Zft4YLAYSmuJ3XqGhhMP63FsHKMlB1aSTKKPeswdIJmrdO80=
 =QIut
 -----END PGP SIGNATURE-----

Merge tag 'soc-drivers-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull SoC driver updates from Arnd Bergmann:
 "The highlights for the driver support this time are

   - Qualcomm platforms gain support for the Qualcomm Secure Execution
     Environment firmware interface to access EFI variables on certain
     devices, and new features for multiple platform and firmware
     drivers.

   - Arm FF-A firmware support gains support for v1.1 specification
     features, in particular notification and memory transaction
     descriptor changes.

   - SCMI firmware support now support v3.2 features for clock and DVFS
     configuration and a new transport for Qualcomm platforms.

   - Minor cleanups and bugfixes are added to pretty much all the active
     platforms: qualcomm, broadcom, dove, ti-k3, rockchip, sifive,
     amlogic, atmel, tegra, aspeed, vexpress, mediatek, samsung and
     more.

     In particular, this contains portions of the treewide conversion to
     use __counted_by annotations and the device_get_match_data helper"

* tag 'soc-drivers-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (156 commits)
  soc: qcom: pmic_glink_altmode: Print return value on error
  firmware: qcom: scm: remove unneeded 'extern' specifiers
  firmware: qcom: scm: add a missing forward declaration for struct device
  firmware: qcom: move Qualcomm code into its own directory
  soc: samsung: exynos-chipid: Convert to platform remove callback returning void
  soc: qcom: apr: Add __counted_by for struct apr_rx_buf and use struct_size()
  soc: qcom: pmic_glink: fix connector type to be DisplayPort
  soc: ti: k3-socinfo: Avoid overriding return value
  soc: ti: k3-socinfo: Fix typo in bitfield documentation
  soc: ti: knav_qmss_queue: Use device_get_match_data()
  firmware: ti_sci: Use device_get_match_data()
  firmware: qcom: qseecom: add missing include guards
  soc/pxa: ssp: Convert to platform remove callback returning void
  soc/mediatek: mtk-mmsys: Convert to platform remove callback returning void
  soc/mediatek: mtk-devapc: Convert to platform remove callback returning void
  soc/loongson: loongson2_guts: Convert to platform remove callback returning void
  soc/litex: litex_soc_ctrl: Convert to platform remove callback returning void
  soc/ixp4xx: ixp4xx-qmgr: Convert to platform remove callback returning void
  soc/ixp4xx: ixp4xx-npe: Convert to platform remove callback returning void
  soc/hisilicon: kunpeng_hccs: Convert to platform remove callback returning void
  ...
2023-11-01 14:46:51 -10:00
Uwe Kleine-König
3f40c999de soc/hisilicon: kunpeng_hccs: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Link: https://lore.kernel.org/r/20230925095532.1984344-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2023-10-14 23:27:05 +02:00
Sudeep Holla
a46e42c097 soc: kunpeng_hccs: Migrate to use generic PCC shmem related macros
Use the newly defined common and generic PCC shared memory region
related macros in this driver to replace the locally defined ones.

Cc: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Huisong Li <lihuisong@huawei.com>
Link: https://lore.kernel.org/r/20230927-pcc_defines-v2-4-0b8ffeaef2e5@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2023-09-29 11:55:37 +01:00
Huisong Li
7d6612834d
soc: kunpeng_hccs: fix some sparse warnings about incorrect type
This patch fixes some sparse warnings about incorrect type.
The address about PCC communication space should use '__iomem' tag.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308151142.dH5Muhva-lkp@intel.com/
Fixes: 886bdf9c88 ("soc: hisilicon: Support HCCS driver on Kunpeng SoC")
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Link: https://lore.kernel.org/r/20230816073706.33297-1-lihuisong@huawei.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-08-21 21:05:11 -04:00
Arnd Bergmann
a90d34afee soc: kunpeng_hccs: add MAILBOX dependency
When the mailbox subsystem is disabled, the driver fails to link, so add
an explicit dependency. Some other drivers use 'select' here, but the
dependency seems more logical and more common.

Fixes: 886bdf9c88 ("soc: hisilicon: Support HCCS driver on Kunpeng SoC")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-08-14 17:00:13 +02:00
Arnd Bergmann
37696fa746 soc: kunpeng_hccs: fix size_t format string
Printing a size_t using the %lu format string causes a warning on
architectures that define the type as 'unsigned int':

In file included from include/linux/device.h:15,
                 from include/linux/acpi.h:14,
                 from drivers/soc/hisilicon/kunpeng_hccs.c:25:
drivers/soc/hisilicon/kunpeng_hccs.c: In function 'hccs_get_bd_info':
drivers/soc/hisilicon/kunpeng_hccs.c:441:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]

Use the correct %zu format instead.

Fixes: 886bdf9c88 ("soc: hisilicon: Support HCCS driver on Kunpeng SoC")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-08-12 19:20:11 +02:00
Huisong Li
47f7a25533 soc: hisilicon: add sysfs entry to query information of HCCS
This patch creates chip, die and port directory based on the actual
hardware implementation of platform. Some sysfs entries under these
directories are created to query the health status and port information
of HCCS.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2023-08-08 12:36:30 +00:00
Huisong Li
886bdf9c88 soc: hisilicon: Support HCCS driver on Kunpeng SoC
The Huawei Cache Coherence System (HCCS) is a multi-chip interconnection
bus protocol. This driver is aimed to support some features about HCCS on
Kunpeng SoC, like, querying the health status of HCCS.

This patch adds the probing of HCCS driver, and obtains all HCCS port
information by the dimension of chip and die on platform.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2023-08-08 12:36:29 +00:00