| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AMD Secure Processor device driver |
|---|
| 3 | 4 | * |
|---|
| 4 | | - * Copyright (C) 2014,2016 Advanced Micro Devices, Inc. |
|---|
| 5 | + * Copyright (C) 2014,2018 Advanced Micro Devices, Inc. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Tom Lendacky <thomas.lendacky@amd.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 33 | 30 | unsigned int irq_count; |
|---|
| 34 | 31 | }; |
|---|
| 35 | 32 | |
|---|
| 36 | | -static const struct acpi_device_id sp_acpi_match[]; |
|---|
| 37 | | -static const struct of_device_id sp_of_match[]; |
|---|
| 33 | +static const struct sp_dev_vdata dev_vdata[] = { |
|---|
| 34 | + { |
|---|
| 35 | + .bar = 0, |
|---|
| 36 | +#ifdef CONFIG_CRYPTO_DEV_SP_CCP |
|---|
| 37 | + .ccp_vdata = &ccpv3_platform, |
|---|
| 38 | +#endif |
|---|
| 39 | + }, |
|---|
| 40 | +}; |
|---|
| 41 | + |
|---|
| 42 | +#ifdef CONFIG_ACPI |
|---|
| 43 | +static const struct acpi_device_id sp_acpi_match[] = { |
|---|
| 44 | + { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] }, |
|---|
| 45 | + { }, |
|---|
| 46 | +}; |
|---|
| 47 | +MODULE_DEVICE_TABLE(acpi, sp_acpi_match); |
|---|
| 48 | +#endif |
|---|
| 49 | + |
|---|
| 50 | +#ifdef CONFIG_OF |
|---|
| 51 | +static const struct of_device_id sp_of_match[] = { |
|---|
| 52 | + { .compatible = "amd,ccp-seattle-v1a", |
|---|
| 53 | + .data = (const void *)&dev_vdata[0] }, |
|---|
| 54 | + { }, |
|---|
| 55 | +}; |
|---|
| 56 | +MODULE_DEVICE_TABLE(of, sp_of_match); |
|---|
| 57 | +#endif |
|---|
| 38 | 58 | |
|---|
| 39 | 59 | static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev) |
|---|
| 40 | 60 | { |
|---|
| .. | .. |
|---|
| 105 | 125 | struct sp_platform *sp_platform; |
|---|
| 106 | 126 | struct device *dev = &pdev->dev; |
|---|
| 107 | 127 | enum dev_dma_attr attr; |
|---|
| 108 | | - struct resource *ior; |
|---|
| 109 | 128 | int ret; |
|---|
| 110 | 129 | |
|---|
| 111 | 130 | ret = -ENOMEM; |
|---|
| .. | .. |
|---|
| 126 | 145 | goto e_err; |
|---|
| 127 | 146 | } |
|---|
| 128 | 147 | |
|---|
| 129 | | - ior = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 130 | | - sp->io_map = devm_ioremap_resource(dev, ior); |
|---|
| 148 | + sp->io_map = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 131 | 149 | if (IS_ERR(sp->io_map)) { |
|---|
| 132 | 150 | ret = PTR_ERR(sp->io_map); |
|---|
| 133 | 151 | goto e_err; |
|---|
| .. | .. |
|---|
| 189 | 207 | struct device *dev = &pdev->dev; |
|---|
| 190 | 208 | struct sp_device *sp = dev_get_drvdata(dev); |
|---|
| 191 | 209 | |
|---|
| 192 | | - return sp_suspend(sp, state); |
|---|
| 210 | + return sp_suspend(sp); |
|---|
| 193 | 211 | } |
|---|
| 194 | 212 | |
|---|
| 195 | 213 | static int sp_platform_resume(struct platform_device *pdev) |
|---|
| .. | .. |
|---|
| 199 | 217 | |
|---|
| 200 | 218 | return sp_resume(sp); |
|---|
| 201 | 219 | } |
|---|
| 202 | | -#endif |
|---|
| 203 | | - |
|---|
| 204 | | -static const struct sp_dev_vdata dev_vdata[] = { |
|---|
| 205 | | - { |
|---|
| 206 | | - .bar = 0, |
|---|
| 207 | | -#ifdef CONFIG_CRYPTO_DEV_SP_CCP |
|---|
| 208 | | - .ccp_vdata = &ccpv3_platform, |
|---|
| 209 | | -#endif |
|---|
| 210 | | - }, |
|---|
| 211 | | -}; |
|---|
| 212 | | - |
|---|
| 213 | | -#ifdef CONFIG_ACPI |
|---|
| 214 | | -static const struct acpi_device_id sp_acpi_match[] = { |
|---|
| 215 | | - { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] }, |
|---|
| 216 | | - { }, |
|---|
| 217 | | -}; |
|---|
| 218 | | -MODULE_DEVICE_TABLE(acpi, sp_acpi_match); |
|---|
| 219 | | -#endif |
|---|
| 220 | | - |
|---|
| 221 | | -#ifdef CONFIG_OF |
|---|
| 222 | | -static const struct of_device_id sp_of_match[] = { |
|---|
| 223 | | - { .compatible = "amd,ccp-seattle-v1a", |
|---|
| 224 | | - .data = (const void *)&dev_vdata[0] }, |
|---|
| 225 | | - { }, |
|---|
| 226 | | -}; |
|---|
| 227 | | -MODULE_DEVICE_TABLE(of, sp_of_match); |
|---|
| 228 | 220 | #endif |
|---|
| 229 | 221 | |
|---|
| 230 | 222 | static struct platform_driver sp_platform_driver = { |
|---|