Commit fc031da9 authored by Mao Minkai's avatar Mao Minkai Committed by guzitao
Browse files

drivers: acpi: add sw64 support

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8YQTI



--------------------------------

Add acpi drivers for SW64.

Signed-off-by: default avatarMao Minkai <maominkai@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent 18e9f08d
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ struct apd_private_data {
	const struct apd_device_desc *dev_desc;
};

#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || \
defined(CONFIG_ARM64) || defined(CONFIG_SW64)
#define APD_ADDR(desc)	((unsigned long)&desc)

static int acpi_apd_setup(struct apd_private_data *pdata)
@@ -178,6 +179,18 @@ static const struct apd_device_desc hip08_spi_desc = {
};
#endif /* CONFIG_ARM64 */

#ifdef CONFIG_SW64
static const struct apd_device_desc sunway_i2c_desc = {
	.setup = acpi_apd_setup,
	.fixed_clk_rate = 25000000,
};

static const struct apd_device_desc sunway_spi_desc = {
	.setup = acpi_apd_setup,
	.fixed_clk_rate = 25000000,
};
#endif

#endif

/*
@@ -246,6 +259,10 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
	{ "HISI02A3", APD_ADDR(hip08_lite_i2c_desc) },
	{ "HISI0173", APD_ADDR(hip08_spi_desc) },
	{ "NXP0001", APD_ADDR(nxp_i2c_desc) },
#endif
#ifdef CONFIG_SW64
	{ "HISI02A1", APD_ADDR(sunway_i2c_desc) },
	{ "HISI0173", APD_ADDR(sunway_spi_desc) },
#endif
	{ }
};
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
config ACPI_NUMA
	bool "NUMA support"
	depends on NUMA
	depends on (X86 || IA64 || ARM64 || LOONGARCH)
	depends on (X86 || IA64 || ARM64 || LOONGARCH || SW64)
	default y if IA64 || ARM64

config ACPI_HMAT
+1 −1
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ int __init srat_disabled(void)
	return acpi_numa < 0;
}

#if defined(CONFIG_X86) || defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH)
#if defined(CONFIG_X86) || defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH) || defined(CONFIG_SW64)
/*
 * Callback for SLIT parsing.  pxm_to_node() returns NUMA_NO_NODE for
 * I/O localities since SRAT does not list them.  I/O localities are
+26 −0
Original line number Diff line number Diff line
@@ -186,6 +186,32 @@ static struct mcfg_fixup mcfg_quirks[] = {
	LOONGSON_ECAM_MCFG("\0", 1),
	LOONGSON_ECAM_MCFG("LOONGSON", 1),
#endif /* LOONGARCH */

#ifdef CONFIG_SW64
#define _SW64_ECAM_QUIRK(rev, seg) \
	{ "SUNWAY", "SUNWAY. ", rev, seg, MCFG_BUS_ANY, &sw64_pci_ecam_ops }
#define SW64_ECAM_QUIRK(rev, node)	_SW64_ECAM_QUIRK(rev, node * 8 + 0),\
					_SW64_ECAM_QUIRK(rev, node * 8 + 1),\
					_SW64_ECAM_QUIRK(rev, node * 8 + 2),\
					_SW64_ECAM_QUIRK(rev, node * 8 + 3),\
					_SW64_ECAM_QUIRK(rev, node * 8 + 4),\
					_SW64_ECAM_QUIRK(rev, node * 8 + 5),\
					_SW64_ECAM_QUIRK(rev, node * 8 + 6),\
					_SW64_ECAM_QUIRK(rev, node * 8 + 7)

	/**
	 * According to the address space of sw64, up to 8 nodes supported
	 * with a maximum of 8 pcie controllers per node
	 */
	SW64_ECAM_QUIRK(1, 0x00),
	SW64_ECAM_QUIRK(1, 0x01),
	SW64_ECAM_QUIRK(1, 0x02),
	SW64_ECAM_QUIRK(1, 0x03),
	SW64_ECAM_QUIRK(1, 0x04),
	SW64_ECAM_QUIRK(1, 0x05),
	SW64_ECAM_QUIRK(1, 0x06),
	SW64_ECAM_QUIRK(1, 0x07),
#endif /* SW64 */
};

static char mcfg_oem_id[ACPI_OEM_ID_SIZE];