Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * AMD ACPI support for ACPI2platform device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2014,2015 AMD Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Authors: Ken Xue <Ken.Xue@amd.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *	Wu, Jeff <Jeff.Wu@amd.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/clkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/clk-provider.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/platform_data/clk-fch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include "internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct apd_private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * struct apd_device_desc - a descriptor for apd device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * @fixed_clk_rate: fixed rate input clock source for acpi device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *			0 means no fixed rate input clock source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * @properties: build-in properties of the device such as UART
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * @setup: a hook routine to set device resource during create platform device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * Device description defined as acpi_device_id.driver_data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) struct apd_device_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	unsigned int fixed_clk_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct property_entry *properties;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	int (*setup)(struct apd_private_data *pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) struct apd_private_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct acpi_device *adev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	const struct apd_device_desc *dev_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define APD_ADDR(desc)	((unsigned long)&desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) static int acpi_apd_setup(struct apd_private_data *pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	const struct apd_device_desc *dev_desc = pdata->dev_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	if (dev_desc->fixed_clk_rate) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		clk = clk_register_fixed_rate(&pdata->adev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 					dev_name(&pdata->adev->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 					NULL, 0, dev_desc->fixed_clk_rate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		pdata->clk = clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) static int misc_check_res(struct acpi_resource *ares, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	struct resource res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	return !acpi_dev_resource_memory(ares, &res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) static int fch_misc_setup(struct apd_private_data *pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct acpi_device *adev = pdata->adev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	const union acpi_object *obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct platform_device *clkdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct fch_clk_data *clk_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	struct resource_entry *rentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	struct list_head resource_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	clk_data = devm_kzalloc(&adev->dev, sizeof(*clk_data), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	if (!clk_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	INIT_LIST_HEAD(&resource_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	ret = acpi_dev_get_resources(adev, &resource_list, misc_check_res,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 				     NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		return -ENOENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	if (!acpi_dev_get_property(adev, "is-rv", ACPI_TYPE_INTEGER, &obj))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		clk_data->is_rv = obj->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	list_for_each_entry(rentry, &resource_list, node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		clk_data->base = devm_ioremap(&adev->dev, rentry->res->start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 					      resource_size(rentry->res));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	acpi_dev_free_resource_list(&resource_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	clkdev = platform_device_register_data(&adev->dev, "clk-fch",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 					       PLATFORM_DEVID_NONE, clk_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 					       sizeof(*clk_data));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	return PTR_ERR_OR_ZERO(clkdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) static const struct apd_device_desc cz_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	.fixed_clk_rate = 133000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) static const struct apd_device_desc wt_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.fixed_clk_rate = 150000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static struct property_entry uart_properties[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	PROPERTY_ENTRY_U32("reg-io-width", 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	PROPERTY_ENTRY_U32("reg-shift", 2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static const struct apd_device_desc cz_uart_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	.fixed_clk_rate = 48000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	.properties = uart_properties,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static const struct apd_device_desc fch_misc_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	.setup = fch_misc_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #ifdef CONFIG_ARM64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static const struct apd_device_desc xgene_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	.fixed_clk_rate = 100000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) static const struct apd_device_desc vulcan_spi_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	.fixed_clk_rate = 133000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static const struct apd_device_desc hip07_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	.fixed_clk_rate = 200000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static const struct apd_device_desc hip08_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.fixed_clk_rate = 250000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static const struct apd_device_desc hip08_lite_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	.fixed_clk_rate = 125000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static const struct apd_device_desc thunderx2_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	.fixed_clk_rate = 125000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static const struct apd_device_desc nxp_i2c_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	.fixed_clk_rate = 350000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static const struct apd_device_desc hip08_spi_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	.setup = acpi_apd_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	.fixed_clk_rate = 250000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #endif /* CONFIG_ARM64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * Create platform device during acpi scan attach handle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * Return value > 0 on success of creating device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static int acpi_apd_create_device(struct acpi_device *adev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 				   const struct acpi_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	const struct apd_device_desc *dev_desc = (void *)id->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	struct apd_private_data *pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	struct platform_device *pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	if (!dev_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		pdev = acpi_create_platform_device(adev, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	if (!pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	pdata->adev = adev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	pdata->dev_desc = dev_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	if (dev_desc->setup) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		ret = dev_desc->setup(pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			goto err_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	adev->driver_data = pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	pdev = acpi_create_platform_device(adev, dev_desc->properties);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	if (!IS_ERR_OR_NULL(pdev))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	ret = PTR_ERR(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	adev->driver_data = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  err_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	kfree(pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static const struct acpi_device_id acpi_apd_device_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	/* Generic apd devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	{ "AMD0010", APD_ADDR(cz_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	{ "AMDI0010", APD_ADDR(wt_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	{ "AMD0020", APD_ADDR(cz_uart_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	{ "AMDI0020", APD_ADDR(cz_uart_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	{ "AMDI0022", APD_ADDR(cz_uart_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	{ "AMD0030", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	{ "AMD0040", APD_ADDR(fch_misc_desc)},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	{ "HYGO0010", APD_ADDR(wt_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) #ifdef CONFIG_ARM64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	{ "BRCM900D", APD_ADDR(vulcan_spi_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	{ "CAV900D",  APD_ADDR(vulcan_spi_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	{ "CAV9007",  APD_ADDR(thunderx2_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	{ "HISI02A1", APD_ADDR(hip07_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	{ "HISI02A2", APD_ADDR(hip08_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	{ "HISI02A3", APD_ADDR(hip08_lite_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	{ "HISI0173", APD_ADDR(hip08_spi_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	{ "NXP0001", APD_ADDR(nxp_i2c_desc) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static struct acpi_scan_handler apd_handler = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	.ids = acpi_apd_device_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	.attach = acpi_apd_create_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) void __init acpi_apd_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	acpi_scan_add_handler(&apd_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) }