You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Olof Johansson:
"This contains platform-related driver updates for ARM and ARM64.
Highlights:
- ARM SCMI (System Control & Management Interface) driver cleanups
- Hisilicon support for LPC bus w/ ACPI
- Reset driver updates for several platforms: Uniphier,
- Rockchip power domain bindings and hardware descriptions for
several SoCs.
- Tegra memory controller reset improvements"
* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (59 commits)
ARM: tegra: fix compile-testing PCI host driver
soc: rockchip: power-domain: add power domain support for px30
dt-bindings: power: add binding for px30 power domains
dt-bindings: power: add PX30 SoCs header for power-domain
soc: rockchip: power-domain: add power domain support for rk3228
dt-bindings: power: add binding for rk3228 power domains
dt-bindings: power: add RK3228 SoCs header for power-domain
soc: rockchip: power-domain: add power domain support for rk3128
dt-bindings: power: add binding for rk3128 power domains
dt-bindings: power: add RK3128 SoCs header for power-domain
soc: rockchip: power-domain: add power domain support for rk3036
dt-bindings: power: add binding for rk3036 power domains
dt-bindings: power: add RK3036 SoCs header for power-domain
dt-bindings: memory: tegra: Remove Tegra114 SATA and AFI reset definitions
memory: tegra: Remove Tegra114 SATA and AFI reset definitions
memory: tegra: Register SMMU after MC driver became ready
soc: mediatek: remove unneeded semicolon
soc: mediatek: add a fixed wait for SRAM stable
soc: mediatek: introduce a CAPS flag for scp_domain_data
soc: mediatek: reuse regmap_read_poll_timeout helpers
...
This commit is contained in:
@@ -15,23 +15,13 @@ Required Properties:
|
||||
Optional Properties:
|
||||
- label: Human readable string with domain name. Will be visible in userspace
|
||||
to let user to distinguish between multiple domains in SoC.
|
||||
- clocks: List of clock handles. The parent clocks of the input clocks to the
|
||||
devices in this power domain are set to oscclk before power gating
|
||||
and restored back after powering on a domain. This is required for
|
||||
all domains which are powered on and off and not required for unused
|
||||
domains.
|
||||
- clock-names: The following clocks can be specified:
|
||||
- oscclk: Oscillator clock.
|
||||
- clkN: Input clocks to the devices in this power domain. These clocks
|
||||
will be reparented to oscclk before switching power domain off.
|
||||
Their original parent will be brought back after turning on
|
||||
the domain. Maximum of 4 clocks (N = 0 to 3) are supported.
|
||||
- asbN: Clocks required by asynchronous bridges (ASB) present in
|
||||
the power domain. These clock should be enabled during power
|
||||
domain on/off operations.
|
||||
- power-domains: phandle pointing to the parent power domain, for more details
|
||||
see Documentation/devicetree/bindings/power/power_domain.txt
|
||||
|
||||
Deprecated Properties:
|
||||
- clocks
|
||||
- clock-names
|
||||
|
||||
Node of a device using power domains must have a power-domains property
|
||||
defined with a phandle to respective power domain.
|
||||
|
||||
@@ -47,8 +37,6 @@ Example:
|
||||
mfc_pd: power-domain@10044060 {
|
||||
compatible = "samsung,exynos4210-pd";
|
||||
reg = <0x10044060 0x20>;
|
||||
clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MOUT_USER_ACLK333>;
|
||||
clock-names = "oscclk", "clk0";
|
||||
#power-domain-cells = <0>;
|
||||
label = "MFC";
|
||||
};
|
||||
|
||||
@@ -5,6 +5,10 @@ powered up/down by software based on different application scenes to save power.
|
||||
|
||||
Required properties for power domain controller:
|
||||
- compatible: Should be one of the following.
|
||||
"rockchip,px30-power-controller" - for PX30 SoCs.
|
||||
"rockchip,rk3036-power-controller" - for RK3036 SoCs.
|
||||
"rockchip,rk3128-power-controller" - for RK3128 SoCs.
|
||||
"rockchip,rk3228-power-controller" - for RK3228 SoCs.
|
||||
"rockchip,rk3288-power-controller" - for RK3288 SoCs.
|
||||
"rockchip,rk3328-power-controller" - for RK3328 SoCs.
|
||||
"rockchip,rk3366-power-controller" - for RK3366 SoCs.
|
||||
@@ -17,6 +21,10 @@ Required properties for power domain controller:
|
||||
|
||||
Required properties for power domain sub nodes:
|
||||
- reg: index of the power domain, should use macros in:
|
||||
"include/dt-bindings/power/px30-power.h" - for PX30 type power domain.
|
||||
"include/dt-bindings/power/rk3036-power.h" - for RK3036 type power domain.
|
||||
"include/dt-bindings/power/rk3128-power.h" - for RK3128 type power domain.
|
||||
"include/dt-bindings/power/rk3228-power.h" - for RK3228 type power domain.
|
||||
"include/dt-bindings/power/rk3288-power.h" - for RK3288 type power domain.
|
||||
"include/dt-bindings/power/rk3328-power.h" - for RK3328 type power domain.
|
||||
"include/dt-bindings/power/rk3366-power.h" - for RK3366 type power domain.
|
||||
@@ -93,6 +101,10 @@ Node of a device using power domains must have a power-domains property,
|
||||
containing a phandle to the power device node and an index specifying which
|
||||
power domain to use.
|
||||
The index should use macros in:
|
||||
"include/dt-bindings/power/px30-power.h" - for px30 type power domain.
|
||||
"include/dt-bindings/power/rk3036-power.h" - for rk3036 type power domain.
|
||||
"include/dt-bindings/power/rk3128-power.h" - for rk3128 type power domain.
|
||||
"include/dt-bindings/power/rk3128-power.h" - for rk3228 type power domain.
|
||||
"include/dt-bindings/power/rk3288-power.h" - for rk3288 type power domain.
|
||||
"include/dt-bindings/power/rk3328-power.h" - for rk3328 type power domain.
|
||||
"include/dt-bindings/power/rk3366-power.h" - for rk3366 type power domain.
|
||||
|
||||
@@ -33,7 +33,6 @@ config HISILICON_LPC
|
||||
bool "Support for ISA I/O space on HiSilicon Hip06/7"
|
||||
depends on ARM64 && (ARCH_HISI || COMPILE_TEST)
|
||||
select INDIRECT_PIO
|
||||
select MFD_CORE if ACPI
|
||||
help
|
||||
Driver to enable I/O access to devices attached to the Low Pin
|
||||
Count bus on the HiSilicon Hip06/7 SoC.
|
||||
|
||||
@@ -371,8 +371,6 @@ asmlinkage void __naked cci_enable_port_for_self(void)
|
||||
[sizeof_struct_cpu_port] "i" (sizeof(struct cpu_port)),
|
||||
[sizeof_struct_ace_port] "i" (sizeof(struct cci_ace_port)),
|
||||
[offsetof_port_phys] "i" (offsetof(struct cci_ace_port, phys)) );
|
||||
|
||||
unreachable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/logic_pio.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define DRV_NAME "hisi-lpc"
|
||||
@@ -341,15 +341,6 @@ static const struct logic_pio_host_ops hisi_lpc_ops = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
#define MFD_CHILD_NAME_PREFIX DRV_NAME"-"
|
||||
#define MFD_CHILD_NAME_LEN (ACPI_ID_LEN + sizeof(MFD_CHILD_NAME_PREFIX) - 1)
|
||||
|
||||
struct hisi_lpc_mfd_cell {
|
||||
struct mfd_cell_acpi_match acpi_match;
|
||||
char name[MFD_CHILD_NAME_LEN];
|
||||
char pnpid[ACPI_ID_LEN];
|
||||
};
|
||||
|
||||
static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,
|
||||
struct acpi_device *host,
|
||||
struct resource *res)
|
||||
@@ -368,7 +359,7 @@ static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,
|
||||
}
|
||||
|
||||
/*
|
||||
* hisi_lpc_acpi_set_io_res - set the resources for a child's MFD
|
||||
* hisi_lpc_acpi_set_io_res - set the resources for a child
|
||||
* @child: the device node to be updated the I/O resource
|
||||
* @hostdev: the device node associated with host controller
|
||||
* @res: double pointer to be set to the address of translated resources
|
||||
@@ -452,78 +443,122 @@ static int hisi_lpc_acpi_set_io_res(struct device *child,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hisi_lpc_acpi_remove_subdev(struct device *dev, void *unused)
|
||||
{
|
||||
platform_device_unregister(to_platform_device(dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct hisi_lpc_acpi_cell {
|
||||
const char *hid;
|
||||
const char *name;
|
||||
void *pdata;
|
||||
size_t pdata_size;
|
||||
};
|
||||
|
||||
/*
|
||||
* hisi_lpc_acpi_probe - probe children for ACPI FW
|
||||
* @hostdev: LPC host device pointer
|
||||
*
|
||||
* Returns 0 when successful, and a negative value for failure.
|
||||
*
|
||||
* Scan all child devices and create a per-device MFD with
|
||||
* logical PIO translated IO resources.
|
||||
* Create a platform device per child, fixing up the resources
|
||||
* from bus addresses to Logical PIO addresses.
|
||||
*
|
||||
*/
|
||||
static int hisi_lpc_acpi_probe(struct device *hostdev)
|
||||
{
|
||||
struct acpi_device *adev = ACPI_COMPANION(hostdev);
|
||||
struct hisi_lpc_mfd_cell *hisi_lpc_mfd_cells;
|
||||
struct mfd_cell *mfd_cells;
|
||||
struct acpi_device *child;
|
||||
int size, ret, count = 0, cell_num = 0;
|
||||
int ret;
|
||||
|
||||
list_for_each_entry(child, &adev->children, node)
|
||||
cell_num++;
|
||||
|
||||
/* allocate the mfd cell and companion ACPI info, one per child */
|
||||
size = sizeof(*mfd_cells) + sizeof(*hisi_lpc_mfd_cells);
|
||||
mfd_cells = devm_kcalloc(hostdev, cell_num, size, GFP_KERNEL);
|
||||
if (!mfd_cells)
|
||||
return -ENOMEM;
|
||||
|
||||
hisi_lpc_mfd_cells = (struct hisi_lpc_mfd_cell *)&mfd_cells[cell_num];
|
||||
/* Only consider the children of the host */
|
||||
list_for_each_entry(child, &adev->children, node) {
|
||||
struct mfd_cell *mfd_cell = &mfd_cells[count];
|
||||
struct hisi_lpc_mfd_cell *hisi_lpc_mfd_cell =
|
||||
&hisi_lpc_mfd_cells[count];
|
||||
struct mfd_cell_acpi_match *acpi_match =
|
||||
&hisi_lpc_mfd_cell->acpi_match;
|
||||
char *name = hisi_lpc_mfd_cell[count].name;
|
||||
char *pnpid = hisi_lpc_mfd_cell[count].pnpid;
|
||||
struct mfd_cell_acpi_match match = {
|
||||
.pnpid = pnpid,
|
||||
const char *hid = acpi_device_hid(child);
|
||||
const struct hisi_lpc_acpi_cell *cell;
|
||||
struct platform_device *pdev;
|
||||
const struct resource *res;
|
||||
bool found = false;
|
||||
int num_res;
|
||||
|
||||
ret = hisi_lpc_acpi_set_io_res(&child->dev, &adev->dev, &res,
|
||||
&num_res);
|
||||
if (ret) {
|
||||
dev_warn(hostdev, "set resource fail (%d)\n", ret);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
cell = (struct hisi_lpc_acpi_cell []){
|
||||
/* ipmi */
|
||||
{
|
||||
.hid = "IPI0001",
|
||||
.name = "hisi-lpc-ipmi",
|
||||
},
|
||||
/* 8250-compatible uart */
|
||||
{
|
||||
.hid = "HISI1031",
|
||||
.name = "serial8250",
|
||||
.pdata = (struct plat_serial8250_port []) {
|
||||
{
|
||||
.iobase = res->start,
|
||||
.uartclk = 1843200,
|
||||
.iotype = UPIO_PORT,
|
||||
.flags = UPF_BOOT_AUTOCONF,
|
||||
},
|
||||
{}
|
||||
},
|
||||
.pdata_size = 2 *
|
||||
sizeof(struct plat_serial8250_port),
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
/*
|
||||
* For any instances of this host controller (Hip06 and Hip07
|
||||
* are the only chipsets), we would not have multiple slaves
|
||||
* with the same HID. And in any system we would have just one
|
||||
* controller active. So don't worrry about MFD name clashes.
|
||||
*/
|
||||
snprintf(name, MFD_CHILD_NAME_LEN, MFD_CHILD_NAME_PREFIX"%s",
|
||||
acpi_device_hid(child));
|
||||
snprintf(pnpid, ACPI_ID_LEN, "%s", acpi_device_hid(child));
|
||||
|
||||
memcpy(acpi_match, &match, sizeof(*acpi_match));
|
||||
mfd_cell->name = name;
|
||||
mfd_cell->acpi_match = acpi_match;
|
||||
|
||||
ret = hisi_lpc_acpi_set_io_res(&child->dev, &adev->dev,
|
||||
&mfd_cell->resources,
|
||||
&mfd_cell->num_resources);
|
||||
if (ret) {
|
||||
dev_warn(&child->dev, "set resource fail (%d)\n", ret);
|
||||
return ret;
|
||||
for (; cell && cell->name; cell++) {
|
||||
if (!strcmp(cell->hid, hid)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
ret = mfd_add_devices(hostdev, PLATFORM_DEVID_NONE,
|
||||
mfd_cells, cell_num, NULL, 0, NULL);
|
||||
if (ret) {
|
||||
dev_err(hostdev, "failed to add mfd cells (%d)\n", ret);
|
||||
return ret;
|
||||
if (!found) {
|
||||
dev_warn(hostdev,
|
||||
"could not find cell for child device (%s)\n",
|
||||
hid);
|
||||
ret = -ENODEV;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pdev = platform_device_alloc(cell->name, PLATFORM_DEVID_AUTO);
|
||||
if (!pdev) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pdev->dev.parent = hostdev;
|
||||
ACPI_COMPANION_SET(&pdev->dev, child);
|
||||
|
||||
ret = platform_device_add_resources(pdev, res, num_res);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
ret = platform_device_add_data(pdev, cell->pdata,
|
||||
cell->pdata_size);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
ret = platform_device_add(pdev);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
acpi_device_set_enumerated(child);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
device_for_each_child(hostdev, NULL,
|
||||
hisi_lpc_acpi_remove_subdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct acpi_device_id hisi_lpc_acpi_match[] = {
|
||||
|
||||
@@ -117,7 +117,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = handle->perf_ops->add_opps_to_device(handle, cpu_dev);
|
||||
ret = handle->perf_ops->device_opps_add(handle, cpu_dev);
|
||||
if (ret) {
|
||||
dev_warn(cpu_dev, "failed to add opps to the device\n");
|
||||
return ret;
|
||||
@@ -164,7 +164,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
|
||||
/* SCMI allows DVFS request for any domain from any CPU */
|
||||
policy->dvfs_possible_from_any_cpu = true;
|
||||
|
||||
latency = handle->perf_ops->get_transition_latency(handle, cpu_dev);
|
||||
latency = handle->perf_ops->transition_latency_get(handle, cpu_dev);
|
||||
if (!latency)
|
||||
latency = CPUFREQ_ETERNAL;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ struct scmi_msg_resp_base_attributes {
|
||||
* scmi_base_attributes_get() - gets the implementation details
|
||||
* that are associated with the base protocol.
|
||||
*
|
||||
* @handle - SCMI entity handle
|
||||
* @handle: SCMI entity handle
|
||||
*
|
||||
* Return: 0 on success, else appropriate SCMI error.
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ static int scmi_base_attributes_get(const struct scmi_handle *handle)
|
||||
struct scmi_msg_resp_base_attributes *attr_info;
|
||||
struct scmi_revision_info *rev = handle->version;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
SCMI_PROTOCOL_BASE, 0, sizeof(*attr_info), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -49,15 +49,16 @@ static int scmi_base_attributes_get(const struct scmi_handle *handle)
|
||||
rev->num_agents = attr_info->num_agents;
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_base_vendor_id_get() - gets vendor/subvendor identifier ASCII string.
|
||||
*
|
||||
* @handle - SCMI entity handle
|
||||
* @sub_vendor - specify true if sub-vendor ID is needed
|
||||
* @handle: SCMI entity handle
|
||||
* @sub_vendor: specify true if sub-vendor ID is needed
|
||||
*
|
||||
* Return: 0 on success, else appropriate SCMI error.
|
||||
*/
|
||||
@@ -80,7 +81,7 @@ scmi_base_vendor_id_get(const struct scmi_handle *handle, bool sub_vendor)
|
||||
size = ARRAY_SIZE(rev->vendor_id);
|
||||
}
|
||||
|
||||
ret = scmi_one_xfer_init(handle, cmd, SCMI_PROTOCOL_BASE, 0, size, &t);
|
||||
ret = scmi_xfer_get_init(handle, cmd, SCMI_PROTOCOL_BASE, 0, size, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -88,7 +89,8 @@ scmi_base_vendor_id_get(const struct scmi_handle *handle, bool sub_vendor)
|
||||
if (!ret)
|
||||
memcpy(vendor_id, t->rx.buf, size);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -97,7 +99,7 @@ scmi_base_vendor_id_get(const struct scmi_handle *handle, bool sub_vendor)
|
||||
* implementation 32-bit version. The format of the version number is
|
||||
* vendor-specific
|
||||
*
|
||||
* @handle - SCMI entity handle
|
||||
* @handle: SCMI entity handle
|
||||
*
|
||||
* Return: 0 on success, else appropriate SCMI error.
|
||||
*/
|
||||
@@ -109,7 +111,7 @@ scmi_base_implementation_version_get(const struct scmi_handle *handle)
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_revision_info *rev = handle->version;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, BASE_DISCOVER_IMPLEMENT_VERSION,
|
||||
ret = scmi_xfer_get_init(handle, BASE_DISCOVER_IMPLEMENT_VERSION,
|
||||
SCMI_PROTOCOL_BASE, 0, sizeof(*impl_ver), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -120,7 +122,8 @@ scmi_base_implementation_version_get(const struct scmi_handle *handle)
|
||||
rev->impl_ver = le32_to_cpu(*impl_ver);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -128,8 +131,8 @@ scmi_base_implementation_version_get(const struct scmi_handle *handle)
|
||||
* scmi_base_implementation_list_get() - gets the list of protocols it is
|
||||
* OSPM is allowed to access
|
||||
*
|
||||
* @handle - SCMI entity handle
|
||||
* @protocols_imp - pointer to hold the list of protocol identifiers
|
||||
* @handle: SCMI entity handle
|
||||
* @protocols_imp: pointer to hold the list of protocol identifiers
|
||||
*
|
||||
* Return: 0 on success, else appropriate SCMI error.
|
||||
*/
|
||||
@@ -143,7 +146,7 @@ static int scmi_base_implementation_list_get(const struct scmi_handle *handle,
|
||||
u32 tot_num_ret = 0, loop_num_ret;
|
||||
struct device *dev = handle->dev;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, BASE_DISCOVER_LIST_PROTOCOLS,
|
||||
ret = scmi_xfer_get_init(handle, BASE_DISCOVER_LIST_PROTOCOLS,
|
||||
SCMI_PROTOCOL_BASE, sizeof(*num_skip), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -172,16 +175,17 @@ static int scmi_base_implementation_list_get(const struct scmi_handle *handle,
|
||||
tot_num_ret += loop_num_ret;
|
||||
} while (loop_num_ret);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_base_discover_agent_get() - discover the name of an agent
|
||||
*
|
||||
* @handle - SCMI entity handle
|
||||
* @id - Agent identifier
|
||||
* @name - Agent identifier ASCII string
|
||||
* @handle: SCMI entity handle
|
||||
* @id: Agent identifier
|
||||
* @name: Agent identifier ASCII string
|
||||
*
|
||||
* An agent id of 0 is reserved to identify the platform itself.
|
||||
* Generally operating system is represented as "OSPM"
|
||||
@@ -194,7 +198,7 @@ static int scmi_base_discover_agent_get(const struct scmi_handle *handle,
|
||||
int ret;
|
||||
struct scmi_xfer *t;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, BASE_DISCOVER_AGENT,
|
||||
ret = scmi_xfer_get_init(handle, BASE_DISCOVER_AGENT,
|
||||
SCMI_PROTOCOL_BASE, sizeof(__le32),
|
||||
SCMI_MAX_STR_SIZE, &t);
|
||||
if (ret)
|
||||
@@ -206,7 +210,8 @@ static int scmi_base_discover_agent_get(const struct scmi_handle *handle,
|
||||
if (!ret)
|
||||
memcpy(name, t->rx.buf, SCMI_MAX_STR_SIZE);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,13 +125,13 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol)
|
||||
int id, retval;
|
||||
struct scmi_device *scmi_dev;
|
||||
|
||||
id = ida_simple_get(&scmi_bus_id, 1, 0, GFP_KERNEL);
|
||||
if (id < 0)
|
||||
return NULL;
|
||||
|
||||
scmi_dev = kzalloc(sizeof(*scmi_dev), GFP_KERNEL);
|
||||
if (!scmi_dev)
|
||||
goto no_mem;
|
||||
return NULL;
|
||||
|
||||
id = ida_simple_get(&scmi_bus_id, 1, 0, GFP_KERNEL);
|
||||
if (id < 0)
|
||||
goto free_mem;
|
||||
|
||||
scmi_dev->id = id;
|
||||
scmi_dev->protocol_id = protocol;
|
||||
@@ -141,13 +141,15 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol)
|
||||
dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id);
|
||||
|
||||
retval = device_register(&scmi_dev->dev);
|
||||
if (!retval)
|
||||
return scmi_dev;
|
||||
if (retval)
|
||||
goto put_dev;
|
||||
|
||||
return scmi_dev;
|
||||
put_dev:
|
||||
put_device(&scmi_dev->dev);
|
||||
kfree(scmi_dev);
|
||||
no_mem:
|
||||
ida_simple_remove(&scmi_bus_id, id);
|
||||
free_mem:
|
||||
kfree(scmi_dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -171,9 +173,9 @@ int scmi_protocol_register(int protocol_id, scmi_prot_init_fn_t fn)
|
||||
spin_lock(&protocol_lock);
|
||||
ret = idr_alloc(&scmi_protocols, fn, protocol_id, protocol_id + 1,
|
||||
GFP_ATOMIC);
|
||||
spin_unlock(&protocol_lock);
|
||||
if (ret != protocol_id)
|
||||
pr_err("unable to allocate SCMI idr slot, err %d\n", ret);
|
||||
spin_unlock(&protocol_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ static int scmi_clock_protocol_attributes_get(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_clock_protocol_attributes *attr;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
SCMI_PROTOCOL_CLOCK, 0, sizeof(*attr), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -90,7 +90,7 @@ static int scmi_clock_protocol_attributes_get(const struct scmi_handle *handle,
|
||||
ci->max_async_req = attr->max_async_req;
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static int scmi_clock_attributes_get(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_clock_attributes *attr;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, CLOCK_ATTRIBUTES, SCMI_PROTOCOL_CLOCK,
|
||||
ret = scmi_xfer_get_init(handle, CLOCK_ATTRIBUTES, SCMI_PROTOCOL_CLOCK,
|
||||
sizeof(clk_id), sizeof(*attr), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -115,7 +115,7 @@ static int scmi_clock_attributes_get(const struct scmi_handle *handle,
|
||||
else
|
||||
clk->name[0] = '\0';
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
|
||||
struct scmi_msg_clock_describe_rates *clk_desc;
|
||||
struct scmi_msg_resp_clock_describe_rates *rlist;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, CLOCK_DESCRIBE_RATES,
|
||||
ret = scmi_xfer_get_init(handle, CLOCK_DESCRIBE_RATES,
|
||||
SCMI_PROTOCOL_CLOCK, sizeof(*clk_desc), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -186,7 +186,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
|
||||
clk->list.num_rates = tot_rate_cnt;
|
||||
|
||||
err:
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ scmi_clock_rate_get(const struct scmi_handle *handle, u32 clk_id, u64 *value)
|
||||
int ret;
|
||||
struct scmi_xfer *t;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, CLOCK_RATE_GET, SCMI_PROTOCOL_CLOCK,
|
||||
ret = scmi_xfer_get_init(handle, CLOCK_RATE_GET, SCMI_PROTOCOL_CLOCK,
|
||||
sizeof(__le32), sizeof(u64), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -211,7 +211,7 @@ scmi_clock_rate_get(const struct scmi_handle *handle, u32 clk_id, u64 *value)
|
||||
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32;
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_clock_set_rate *cfg;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK,
|
||||
ret = scmi_xfer_get_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK,
|
||||
sizeof(*cfg), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -235,7 +235,7 @@ static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id,
|
||||
|
||||
ret = scmi_do_xfer(handle, t);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ scmi_clock_config_set(const struct scmi_handle *handle, u32 clk_id, u32 config)
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_clock_set_config *cfg;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, CLOCK_CONFIG_SET, SCMI_PROTOCOL_CLOCK,
|
||||
ret = scmi_xfer_get_init(handle, CLOCK_CONFIG_SET, SCMI_PROTOCOL_CLOCK,
|
||||
sizeof(*cfg), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -257,7 +257,7 @@ scmi_clock_config_set(const struct scmi_handle *handle, u32 clk_id, u32 config)
|
||||
|
||||
ret = scmi_do_xfer(handle, t);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2018 ARM Ltd.
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -14,10 +15,10 @@
|
||||
#include <linux/scmi_protocol.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define PROTOCOL_REV_MINOR_BITS 16
|
||||
#define PROTOCOL_REV_MINOR_MASK ((1U << PROTOCOL_REV_MINOR_BITS) - 1)
|
||||
#define PROTOCOL_REV_MAJOR(x) ((x) >> PROTOCOL_REV_MINOR_BITS)
|
||||
#define PROTOCOL_REV_MINOR(x) ((x) & PROTOCOL_REV_MINOR_MASK)
|
||||
#define PROTOCOL_REV_MINOR_MASK GENMASK(15, 0)
|
||||
#define PROTOCOL_REV_MAJOR_MASK GENMASK(31, 16)
|
||||
#define PROTOCOL_REV_MAJOR(x) (u16)(FIELD_GET(PROTOCOL_REV_MAJOR_MASK, (x)))
|
||||
#define PROTOCOL_REV_MINOR(x) (u16)(FIELD_GET(PROTOCOL_REV_MINOR_MASK, (x)))
|
||||
#define MAX_PROTOCOLS_IMP 16
|
||||
#define MAX_OPPS 16
|
||||
|
||||
@@ -50,8 +51,11 @@ struct scmi_msg_resp_prot_version {
|
||||
* @id: The identifier of the command being sent
|
||||
* @protocol_id: The identifier of the protocol used to send @id command
|
||||
* @seq: The token to identify the message. when a message/command returns,
|
||||
* the platform returns the whole message header unmodified including
|
||||
* the token.
|
||||
* the platform returns the whole message header unmodified including
|
||||
* the token
|
||||
* @status: Status of the transfer once it's complete
|
||||
* @poll_completion: Indicate if the transfer needs to be polled for
|
||||
* completion or interrupt mode is used
|
||||
*/
|
||||
struct scmi_msg_hdr {
|
||||
u8 id;
|
||||
@@ -82,18 +86,16 @@ struct scmi_msg {
|
||||
* buffer for the rx path as we use for the tx path.
|
||||
* @done: completion event
|
||||
*/
|
||||
|
||||
struct scmi_xfer {
|
||||
void *con_priv;
|
||||
struct scmi_msg_hdr hdr;
|
||||
struct scmi_msg tx;
|
||||
struct scmi_msg rx;
|
||||
struct completion done;
|
||||
};
|
||||
|
||||
void scmi_one_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer);
|
||||
void scmi_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer);
|
||||
int scmi_do_xfer(const struct scmi_handle *h, struct scmi_xfer *xfer);
|
||||
int scmi_one_xfer_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id,
|
||||
int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id,
|
||||
size_t tx_size, size_t rx_size, struct scmi_xfer **p);
|
||||
int scmi_handle_put(const struct scmi_handle *handle);
|
||||
struct scmi_handle *scmi_handle_get(struct device *dev);
|
||||
|
||||
@@ -29,16 +29,12 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define MSG_ID_SHIFT 0
|
||||
#define MSG_ID_MASK 0xff
|
||||
#define MSG_TYPE_SHIFT 8
|
||||
#define MSG_TYPE_MASK 0x3
|
||||
#define MSG_PROTOCOL_ID_SHIFT 10
|
||||
#define MSG_PROTOCOL_ID_MASK 0xff
|
||||
#define MSG_TOKEN_ID_SHIFT 18
|
||||
#define MSG_TOKEN_ID_MASK 0x3ff
|
||||
#define MSG_XTRACT_TOKEN(header) \
|
||||
(((header) >> MSG_TOKEN_ID_SHIFT) & MSG_TOKEN_ID_MASK)
|
||||
#define MSG_ID_MASK GENMASK(7, 0)
|
||||
#define MSG_TYPE_MASK GENMASK(9, 8)
|
||||
#define MSG_PROTOCOL_ID_MASK GENMASK(17, 10)
|
||||
#define MSG_TOKEN_ID_MASK GENMASK(27, 18)
|
||||
#define MSG_XTRACT_TOKEN(hdr) FIELD_GET(MSG_TOKEN_ID_MASK, (hdr))
|
||||
#define MSG_TOKEN_MAX (MSG_XTRACT_TOKEN(MSG_TOKEN_ID_MASK) + 1)
|
||||
|
||||
enum scmi_error_codes {
|
||||
SCMI_SUCCESS = 0, /* Success */
|
||||
@@ -55,7 +51,7 @@ enum scmi_error_codes {
|
||||
SCMI_ERR_MAX
|
||||
};
|
||||
|
||||
/* List of all SCMI devices active in system */
|
||||
/* List of all SCMI devices active in system */
|
||||
static LIST_HEAD(scmi_list);
|
||||
/* Protection for the entire list */
|
||||
static DEFINE_MUTEX(scmi_list_mutex);
|
||||
@@ -72,7 +68,6 @@ static DEFINE_MUTEX(scmi_list_mutex);
|
||||
struct scmi_xfers_info {
|
||||
struct scmi_xfer *xfer_block;
|
||||
unsigned long *xfer_alloc_table;
|
||||
/* protect transfer allocation */
|
||||
spinlock_t xfer_lock;
|
||||
};
|
||||
|
||||
@@ -98,6 +93,7 @@ struct scmi_desc {
|
||||
* @payload: Transmit/Receive mailbox channel payload area
|
||||
* @dev: Reference to device in the SCMI hierarchy corresponding to this
|
||||
* channel
|
||||
* @handle: Pointer to SCMI entity handle
|
||||
*/
|
||||
struct scmi_chan_info {
|
||||
struct mbox_client cl;
|
||||
@@ -108,7 +104,7 @@ struct scmi_chan_info {
|
||||
};
|
||||
|
||||
/**
|
||||
* struct scmi_info - Structure representing a SCMI instance
|
||||
* struct scmi_info - Structure representing a SCMI instance
|
||||
*
|
||||
* @dev: Device pointer
|
||||
* @desc: SoC description for this instance
|
||||
@@ -117,9 +113,9 @@ struct scmi_chan_info {
|
||||
* implementation version and (sub-)vendor identification.
|
||||
* @minfo: Message info
|
||||
* @tx_idr: IDR object to map protocol id to channel info pointer
|
||||
* @protocols_imp: list of protocols implemented, currently maximum of
|
||||
* @protocols_imp: List of protocols implemented, currently maximum of
|
||||
* MAX_PROTOCOLS_IMP elements allocated by the base protocol
|
||||
* @node: list head
|
||||
* @node: List head
|
||||
* @users: Number of users of this instance
|
||||
*/
|
||||
struct scmi_info {
|
||||
@@ -225,9 +221,7 @@ static void scmi_rx_callback(struct mbox_client *cl, void *m)
|
||||
|
||||
xfer_id = MSG_XTRACT_TOKEN(ioread32(&mem->msg_header));
|
||||
|
||||
/*
|
||||
* Are we even expecting this?
|
||||
*/
|
||||
/* Are we even expecting this? */
|
||||
if (!test_bit(xfer_id, minfo->xfer_alloc_table)) {
|
||||
dev_err(dev, "message for %d is not expected!\n", xfer_id);
|
||||
return;
|
||||
@@ -252,12 +246,14 @@ static void scmi_rx_callback(struct mbox_client *cl, void *m)
|
||||
*
|
||||
* @hdr: pointer to header containing all the information on message id,
|
||||
* protocol id and sequence id.
|
||||
*
|
||||
* Return: 32-bit packed command header to be sent to the platform.
|
||||
*/
|
||||
static inline u32 pack_scmi_header(struct scmi_msg_hdr *hdr)
|
||||
{
|
||||
return ((hdr->id & MSG_ID_MASK) << MSG_ID_SHIFT) |
|
||||
((hdr->seq & MSG_TOKEN_ID_MASK) << MSG_TOKEN_ID_SHIFT) |
|
||||
((hdr->protocol_id & MSG_PROTOCOL_ID_MASK) << MSG_PROTOCOL_ID_SHIFT);
|
||||
return FIELD_PREP(MSG_ID_MASK, hdr->id) |
|
||||
FIELD_PREP(MSG_TOKEN_ID_MASK, hdr->seq) |
|
||||
FIELD_PREP(MSG_PROTOCOL_ID_MASK, hdr->protocol_id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,9 +282,9 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m)
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_one_xfer_get() - Allocate one message
|
||||
* scmi_xfer_get() - Allocate one message
|
||||
*
|
||||
* @handle: SCMI entity handle
|
||||
* @handle: Pointer to SCMI entity handle
|
||||
*
|
||||
* Helper function which is used by various command functions that are
|
||||
* exposed to clients of this driver for allocating a message traffic event.
|
||||
@@ -299,7 +295,7 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m)
|
||||
*
|
||||
* Return: 0 if all went fine, else corresponding error.
|
||||
*/
|
||||
static struct scmi_xfer *scmi_one_xfer_get(const struct scmi_handle *handle)
|
||||
static struct scmi_xfer *scmi_xfer_get(const struct scmi_handle *handle)
|
||||
{
|
||||
u16 xfer_id;
|
||||
struct scmi_xfer *xfer;
|
||||
@@ -328,14 +324,14 @@ static struct scmi_xfer *scmi_one_xfer_get(const struct scmi_handle *handle)
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_one_xfer_put() - Release a message
|
||||
* scmi_xfer_put() - Release a message
|
||||
*
|
||||
* @minfo: transfer info pointer
|
||||
* @xfer: message that was reserved by scmi_one_xfer_get
|
||||
* @handle: Pointer to SCMI entity handle
|
||||
* @xfer: message that was reserved by scmi_xfer_get
|
||||
*
|
||||
* This holds a spinlock to maintain integrity of internal data structures.
|
||||
*/
|
||||
void scmi_one_xfer_put(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
||||
void scmi_xfer_put(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct scmi_info *info = handle_to_scmi_info(handle);
|
||||
@@ -378,12 +374,12 @@ static bool scmi_xfer_done_no_timeout(const struct scmi_chan_info *cinfo,
|
||||
/**
|
||||
* scmi_do_xfer() - Do one transfer
|
||||
*
|
||||
* @info: Pointer to SCMI entity information
|
||||
* @handle: Pointer to SCMI entity handle
|
||||
* @xfer: Transfer to initiate and wait for response
|
||||
*
|
||||
* Return: -ETIMEDOUT in case of no response, if transmit error,
|
||||
* return corresponding error, else if all goes well,
|
||||
* return 0.
|
||||
* return corresponding error, else if all goes well,
|
||||
* return 0.
|
||||
*/
|
||||
int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
||||
{
|
||||
@@ -440,22 +436,22 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_one_xfer_init() - Allocate and initialise one message
|
||||
* scmi_xfer_get_init() - Allocate and initialise one message
|
||||
*
|
||||
* @handle: SCMI entity handle
|
||||
* @handle: Pointer to SCMI entity handle
|
||||
* @msg_id: Message identifier
|
||||
* @msg_prot_id: Protocol identifier for the message
|
||||
* @prot_id: Protocol identifier for the message
|
||||
* @tx_size: transmit message size
|
||||
* @rx_size: receive message size
|
||||
* @p: pointer to the allocated and initialised message
|
||||
*
|
||||
* This function allocates the message using @scmi_one_xfer_get and
|
||||
* This function allocates the message using @scmi_xfer_get and
|
||||
* initialise the header.
|
||||
*
|
||||
* Return: 0 if all went fine with @p pointing to message, else
|
||||
* corresponding error.
|
||||
*/
|
||||
int scmi_one_xfer_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
|
||||
int scmi_xfer_get_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
|
||||
size_t tx_size, size_t rx_size, struct scmi_xfer **p)
|
||||
{
|
||||
int ret;
|
||||
@@ -468,7 +464,7 @@ int scmi_one_xfer_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
|
||||
tx_size > info->desc->max_msg_size)
|
||||
return -ERANGE;
|
||||
|
||||
xfer = scmi_one_xfer_get(handle);
|
||||
xfer = scmi_xfer_get(handle);
|
||||
if (IS_ERR(xfer)) {
|
||||
ret = PTR_ERR(xfer);
|
||||
dev_err(dev, "failed to get free message slot(%d)\n", ret);
|
||||
@@ -482,13 +478,16 @@ int scmi_one_xfer_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
|
||||
xfer->hdr.poll_completion = false;
|
||||
|
||||
*p = xfer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_version_get() - command to get the revision of the SCMI entity
|
||||
*
|
||||
* @handle: Handle to SCMI entity information
|
||||
* @handle: Pointer to SCMI entity handle
|
||||
* @protocol: Protocol identifier for the message
|
||||
* @version: Holds returned version of protocol.
|
||||
*
|
||||
* Updates the SCMI information in the internal data structure.
|
||||
*
|
||||
@@ -501,7 +500,7 @@ int scmi_version_get(const struct scmi_handle *handle, u8 protocol,
|
||||
__le32 *rev_info;
|
||||
struct scmi_xfer *t;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PROTOCOL_VERSION, protocol, 0,
|
||||
ret = scmi_xfer_get_init(handle, PROTOCOL_VERSION, protocol, 0,
|
||||
sizeof(*version), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -512,7 +511,7 @@ int scmi_version_get(const struct scmi_handle *handle, u8 protocol,
|
||||
*version = le32_to_cpu(*rev_info);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -540,12 +539,12 @@ scmi_is_protocol_implemented(const struct scmi_handle *handle, u8 prot_id)
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_handle_get() - Get the SCMI handle for a device
|
||||
* scmi_handle_get() - Get the SCMI handle for a device
|
||||
*
|
||||
* @dev: pointer to device for which we want SCMI handle
|
||||
*
|
||||
* NOTE: The function does not track individual clients of the framework
|
||||
* and is expected to be maintained by caller of SCMI protocol library.
|
||||
* and is expected to be maintained by caller of SCMI protocol library.
|
||||
* scmi_handle_put must be balanced with successful scmi_handle_get
|
||||
*
|
||||
* Return: pointer to handle if successful, NULL on error
|
||||
@@ -576,7 +575,7 @@ struct scmi_handle *scmi_handle_get(struct device *dev)
|
||||
* @handle: handle acquired by scmi_handle_get
|
||||
*
|
||||
* NOTE: The function does not track individual clients of the framework
|
||||
* and is expected to be maintained by caller of SCMI protocol library.
|
||||
* and is expected to be maintained by caller of SCMI protocol library.
|
||||
* scmi_handle_put must be balanced with successful scmi_handle_get
|
||||
*
|
||||
* Return: 0 is successfully released
|
||||
@@ -599,7 +598,7 @@ int scmi_handle_put(const struct scmi_handle *handle)
|
||||
}
|
||||
|
||||
static const struct scmi_desc scmi_generic_desc = {
|
||||
.max_rx_timeout_ms = 30, /* we may increase this if required */
|
||||
.max_rx_timeout_ms = 30, /* We may increase this if required */
|
||||
.max_msg = 20, /* Limited by MBOX_TX_QUEUE_LEN */
|
||||
.max_msg_size = 128,
|
||||
};
|
||||
@@ -621,9 +620,9 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo)
|
||||
struct scmi_xfers_info *info = &sinfo->minfo;
|
||||
|
||||
/* Pre-allocated messages, no more than what hdr.seq can support */
|
||||
if (WARN_ON(desc->max_msg >= (MSG_TOKEN_ID_MASK + 1))) {
|
||||
dev_err(dev, "Maximum message of %d exceeds supported %d\n",
|
||||
desc->max_msg, MSG_TOKEN_ID_MASK + 1);
|
||||
if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) {
|
||||
dev_err(dev, "Maximum message of %d exceeds supported %ld\n",
|
||||
desc->max_msg, MSG_TOKEN_MAX);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -637,8 +636,6 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo)
|
||||
if (!info->xfer_alloc_table)
|
||||
return -ENOMEM;
|
||||
|
||||
bitmap_zero(info->xfer_alloc_table, desc->max_msg);
|
||||
|
||||
/* Pre-initialize the buffer pointer to pre-allocated buffers */
|
||||
for (i = 0, xfer = info->xfer_block; i < desc->max_msg; i++, xfer++) {
|
||||
xfer->rx.buf = devm_kcalloc(dev, sizeof(u8), desc->max_msg_size,
|
||||
@@ -690,11 +687,12 @@ static int scmi_remove(struct platform_device *pdev)
|
||||
list_del(&info->node);
|
||||
mutex_unlock(&scmi_list_mutex);
|
||||
|
||||
if (!ret) {
|
||||
/* Safe to free channels since no more users */
|
||||
ret = idr_for_each(idr, scmi_mbox_free_channel, idr);
|
||||
idr_destroy(&info->tx_idr);
|
||||
}
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Safe to free channels since no more users */
|
||||
ret = idr_for_each(idr, scmi_mbox_free_channel, idr);
|
||||
idr_destroy(&info->tx_idr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -841,7 +839,8 @@ static int scmi_probe(struct platform_device *pdev)
|
||||
if (of_property_read_u32(child, "reg", &prot_id))
|
||||
continue;
|
||||
|
||||
prot_id &= MSG_PROTOCOL_ID_MASK;
|
||||
if (!FIELD_FIT(MSG_PROTOCOL_ID_MASK, prot_id))
|
||||
dev_err(dev, "Out of range protocol %d\n", prot_id);
|
||||
|
||||
if (!scmi_is_protocol_implemented(handle, prot_id)) {
|
||||
dev_err(dev, "SCMI protocol %d not implemented\n",
|
||||
|
||||
@@ -115,7 +115,7 @@ static int scmi_perf_attributes_get(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_perf_attributes *attr;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
SCMI_PROTOCOL_PERF, 0, sizeof(*attr), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -133,7 +133,7 @@ static int scmi_perf_attributes_get(const struct scmi_handle *handle,
|
||||
pi->stats_size = le32_to_cpu(attr->stats_size);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_perf_domain_attributes *attr;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PERF_DOMAIN_ATTRIBUTES,
|
||||
ret = scmi_xfer_get_init(handle, PERF_DOMAIN_ATTRIBUTES,
|
||||
SCMI_PROTOCOL_PERF, sizeof(domain),
|
||||
sizeof(*attr), &t);
|
||||
if (ret)
|
||||
@@ -171,7 +171,7 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||
memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ scmi_perf_describe_levels_get(const struct scmi_handle *handle, u32 domain,
|
||||
struct scmi_msg_perf_describe_levels *dom_info;
|
||||
struct scmi_msg_resp_perf_describe_levels *level_info;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PERF_DESCRIBE_LEVELS,
|
||||
ret = scmi_xfer_get_init(handle, PERF_DESCRIBE_LEVELS,
|
||||
SCMI_PROTOCOL_PERF, sizeof(*dom_info), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -237,7 +237,7 @@ scmi_perf_describe_levels_get(const struct scmi_handle *handle, u32 domain,
|
||||
} while (num_returned && num_remaining);
|
||||
|
||||
perf_dom->opp_count = tot_opp_cnt;
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
|
||||
sort(perf_dom->opp, tot_opp_cnt, sizeof(*opp), opp_cmp_func, NULL);
|
||||
return ret;
|
||||
@@ -250,7 +250,7 @@ static int scmi_perf_limits_set(const struct scmi_handle *handle, u32 domain,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_perf_set_limits *limits;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PERF_LIMITS_SET, SCMI_PROTOCOL_PERF,
|
||||
ret = scmi_xfer_get_init(handle, PERF_LIMITS_SET, SCMI_PROTOCOL_PERF,
|
||||
sizeof(*limits), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -262,7 +262,7 @@ static int scmi_perf_limits_set(const struct scmi_handle *handle, u32 domain,
|
||||
|
||||
ret = scmi_do_xfer(handle, t);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ static int scmi_perf_limits_get(const struct scmi_handle *handle, u32 domain,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_perf_get_limits *limits;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PERF_LIMITS_GET, SCMI_PROTOCOL_PERF,
|
||||
ret = scmi_xfer_get_init(handle, PERF_LIMITS_GET, SCMI_PROTOCOL_PERF,
|
||||
sizeof(__le32), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -288,7 +288,7 @@ static int scmi_perf_limits_get(const struct scmi_handle *handle, u32 domain,
|
||||
*min_perf = le32_to_cpu(limits->min_level);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ static int scmi_perf_level_set(const struct scmi_handle *handle, u32 domain,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_perf_set_level *lvl;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PERF_LEVEL_SET, SCMI_PROTOCOL_PERF,
|
||||
ret = scmi_xfer_get_init(handle, PERF_LEVEL_SET, SCMI_PROTOCOL_PERF,
|
||||
sizeof(*lvl), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -311,7 +311,7 @@ static int scmi_perf_level_set(const struct scmi_handle *handle, u32 domain,
|
||||
|
||||
ret = scmi_do_xfer(handle, t);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ static int scmi_perf_level_get(const struct scmi_handle *handle, u32 domain,
|
||||
int ret;
|
||||
struct scmi_xfer *t;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PERF_LEVEL_GET, SCMI_PROTOCOL_PERF,
|
||||
ret = scmi_xfer_get_init(handle, PERF_LEVEL_GET, SCMI_PROTOCOL_PERF,
|
||||
sizeof(u32), sizeof(u32), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -333,7 +333,7 @@ static int scmi_perf_level_get(const struct scmi_handle *handle, u32 domain,
|
||||
if (!ret)
|
||||
*level = le32_to_cpu(*(__le32 *)t->rx.buf);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -349,8 +349,8 @@ static int scmi_dev_domain_id(struct device *dev)
|
||||
return clkspec.args[0];
|
||||
}
|
||||
|
||||
static int scmi_dvfs_add_opps_to_device(const struct scmi_handle *handle,
|
||||
struct device *dev)
|
||||
static int scmi_dvfs_device_opps_add(const struct scmi_handle *handle,
|
||||
struct device *dev)
|
||||
{
|
||||
int idx, ret, domain;
|
||||
unsigned long freq;
|
||||
@@ -383,7 +383,7 @@ static int scmi_dvfs_add_opps_to_device(const struct scmi_handle *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int scmi_dvfs_get_transition_latency(const struct scmi_handle *handle,
|
||||
static int scmi_dvfs_transition_latency_get(const struct scmi_handle *handle,
|
||||
struct device *dev)
|
||||
{
|
||||
struct perf_dom_info *dom;
|
||||
@@ -432,8 +432,8 @@ static struct scmi_perf_ops perf_ops = {
|
||||
.level_set = scmi_perf_level_set,
|
||||
.level_get = scmi_perf_level_get,
|
||||
.device_domain_id = scmi_dev_domain_id,
|
||||
.get_transition_latency = scmi_dvfs_get_transition_latency,
|
||||
.add_opps_to_device = scmi_dvfs_add_opps_to_device,
|
||||
.transition_latency_get = scmi_dvfs_transition_latency_get,
|
||||
.device_opps_add = scmi_dvfs_device_opps_add,
|
||||
.freq_set = scmi_dvfs_freq_set,
|
||||
.freq_get = scmi_dvfs_freq_get,
|
||||
};
|
||||
|
||||
@@ -63,7 +63,7 @@ static int scmi_power_attributes_get(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_power_attributes *attr;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
SCMI_PROTOCOL_POWER, 0, sizeof(*attr), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -78,7 +78,7 @@ static int scmi_power_attributes_get(const struct scmi_handle *handle,
|
||||
pi->stats_size = le32_to_cpu(attr->stats_size);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ scmi_power_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_power_domain_attributes *attr;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, POWER_DOMAIN_ATTRIBUTES,
|
||||
ret = scmi_xfer_get_init(handle, POWER_DOMAIN_ATTRIBUTES,
|
||||
SCMI_PROTOCOL_POWER, sizeof(domain),
|
||||
sizeof(*attr), &t);
|
||||
if (ret)
|
||||
@@ -109,7 +109,7 @@ scmi_power_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||
memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ scmi_power_state_set(const struct scmi_handle *handle, u32 domain, u32 state)
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_power_set_state *st;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, POWER_STATE_SET, SCMI_PROTOCOL_POWER,
|
||||
ret = scmi_xfer_get_init(handle, POWER_STATE_SET, SCMI_PROTOCOL_POWER,
|
||||
sizeof(*st), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -132,7 +132,7 @@ scmi_power_state_set(const struct scmi_handle *handle, u32 domain, u32 state)
|
||||
|
||||
ret = scmi_do_xfer(handle, t);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ scmi_power_state_get(const struct scmi_handle *handle, u32 domain, u32 *state)
|
||||
int ret;
|
||||
struct scmi_xfer *t;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, POWER_STATE_GET, SCMI_PROTOCOL_POWER,
|
||||
ret = scmi_xfer_get_init(handle, POWER_STATE_GET, SCMI_PROTOCOL_POWER,
|
||||
sizeof(u32), sizeof(u32), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -153,7 +153,7 @@ scmi_power_state_get(const struct scmi_handle *handle, u32 domain, u32 *state)
|
||||
if (!ret)
|
||||
*state = le32_to_cpu(*(__le32 *)t->rx.buf);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ static int scmi_sensor_attributes_get(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_sensor_attributes *attr;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||
SCMI_PROTOCOL_SENSOR, 0, sizeof(*attr), &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -95,7 +95,7 @@ static int scmi_sensor_attributes_get(const struct scmi_handle *handle,
|
||||
si->reg_size = le32_to_cpu(attr->reg_size);
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_sensor_description *buf;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, SENSOR_DESCRIPTION_GET,
|
||||
ret = scmi_xfer_get_init(handle, SENSOR_DESCRIPTION_GET,
|
||||
SCMI_PROTOCOL_SENSOR, sizeof(__le32), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -150,7 +150,7 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
|
||||
*/
|
||||
} while (num_returned && num_remaining);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id)
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_set_sensor_config *cfg;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, SENSOR_CONFIG_SET,
|
||||
ret = scmi_xfer_get_init(handle, SENSOR_CONFIG_SET,
|
||||
SCMI_PROTOCOL_SENSOR, sizeof(*cfg), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -173,7 +173,7 @@ scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id)
|
||||
|
||||
ret = scmi_do_xfer(handle, t);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ static int scmi_sensor_trip_point_set(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_set_sensor_trip_point *trip;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, SENSOR_TRIP_POINT_SET,
|
||||
ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_SET,
|
||||
SCMI_PROTOCOL_SENSOR, sizeof(*trip), 0, &t);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -198,7 +198,7 @@ static int scmi_sensor_trip_point_set(const struct scmi_handle *handle,
|
||||
|
||||
ret = scmi_do_xfer(handle, t);
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_sensor_reading_get *sensor;
|
||||
|
||||
ret = scmi_one_xfer_init(handle, SENSOR_READING_GET,
|
||||
ret = scmi_xfer_get_init(handle, SENSOR_READING_GET,
|
||||
SCMI_PROTOCOL_SENSOR, sizeof(*sensor),
|
||||
sizeof(u64), &t);
|
||||
if (ret)
|
||||
@@ -227,7 +227,7 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle,
|
||||
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32;
|
||||
}
|
||||
|
||||
scmi_one_xfer_put(handle, t);
|
||||
scmi_xfer_put(handle, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Texas Instruments System Control Interface Protocol Driver
|
||||
*
|
||||
* Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Nishanth Menon
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||
* kind, whether express or implied; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
/*
|
||||
* Texas Instruments System Control Interface (TISCI) Protocol
|
||||
*
|
||||
@@ -6,35 +7,6 @@
|
||||
* See: http://processors.wiki.ti.com/index.php/TISCI for details
|
||||
*
|
||||
* Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __TI_SCI_H
|
||||
|
||||
@@ -104,16 +104,6 @@ config MVEBU_DEVBUS
|
||||
Armada 370 and Armada XP. This controller allows to handle flash
|
||||
devices such as NOR, NAND, SRAM, and FPGA.
|
||||
|
||||
config TEGRA20_MC
|
||||
bool "Tegra20 Memory Controller(MC) driver"
|
||||
default y
|
||||
depends on ARCH_TEGRA_2x_SOC
|
||||
help
|
||||
This driver is for the Memory Controller(MC) module available
|
||||
in Tegra20 SoCs, mainly for a address translation fault
|
||||
analysis, especially for IOMMU/GART(Graphics Address
|
||||
Relocation Table) module.
|
||||
|
||||
config FSL_CORENET_CF
|
||||
tristate "Freescale CoreNet Error Reporting"
|
||||
depends on FSL_SOC_BOOKE
|
||||
|
||||
@@ -16,7 +16,6 @@ obj-$(CONFIG_OMAP_GPMC) += omap-gpmc.o
|
||||
obj-$(CONFIG_FSL_CORENET_CF) += fsl-corenet-cf.o
|
||||
obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
|
||||
obj-$(CONFIG_MVEBU_DEVBUS) += mvebu-devbus.o
|
||||
obj-$(CONFIG_TEGRA20_MC) += tegra20-mc.o
|
||||
obj-$(CONFIG_JZ4780_NEMC) += jz4780-nemc.o
|
||||
obj-$(CONFIG_MTK_SMI) += mtk-smi.o
|
||||
obj-$(CONFIG_DA8XX_DDRCTL) += da8xx-ddrctl.o
|
||||
|
||||
@@ -176,7 +176,6 @@ struct private_data {
|
||||
void __iomem *dmem;
|
||||
void __iomem *imem;
|
||||
struct device *dev;
|
||||
unsigned int index;
|
||||
struct mutex lock;
|
||||
};
|
||||
|
||||
@@ -674,10 +673,8 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct private_data *priv;
|
||||
struct device *dpfe_dev;
|
||||
struct init_data init;
|
||||
struct resource *res;
|
||||
u32 index;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
@@ -687,11 +684,6 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
|
||||
mutex_init(&priv->lock);
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
/* Cell index is optional; default to 0 if not present. */
|
||||
ret = of_property_read_u32(dev->of_node, "cell-index", &index);
|
||||
if (ret)
|
||||
index = 0;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-cpu");
|
||||
priv->regs = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(priv->regs)) {
|
||||
@@ -715,37 +707,22 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
|
||||
|
||||
ret = brcmstb_dpfe_download_firmware(pdev, &init);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
dpfe_dev = devm_kzalloc(dev, sizeof(*dpfe_dev), GFP_KERNEL);
|
||||
if (!dpfe_dev) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
priv->dev = dpfe_dev;
|
||||
priv->index = index;
|
||||
|
||||
dpfe_dev->parent = dev;
|
||||
dpfe_dev->groups = dpfe_groups;
|
||||
dpfe_dev->of_node = dev->of_node;
|
||||
dev_set_drvdata(dpfe_dev, priv);
|
||||
dev_set_name(dpfe_dev, "dpfe%u", index);
|
||||
|
||||
ret = device_register(dpfe_dev);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
dev_info(dev, "registered.\n");
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
dev_err(dev, "failed to initialize -- error %d\n", ret);
|
||||
ret = sysfs_create_groups(&pdev->dev.kobj, dpfe_groups);
|
||||
if (!ret)
|
||||
dev_info(dev, "registered.\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int brcmstb_dpfe_remove(struct platform_device *pdev)
|
||||
{
|
||||
sysfs_remove_groups(&pdev->dev.kobj, dpfe_groups);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id brcmstb_dpfe_of_match[] = {
|
||||
{ .compatible = "brcm,dpfe-cpu", },
|
||||
{}
|
||||
@@ -758,6 +735,7 @@ static struct platform_driver brcmstb_dpfe_driver = {
|
||||
.of_match_table = brcmstb_dpfe_of_match,
|
||||
},
|
||||
.probe = brcmstb_dpfe_probe,
|
||||
.remove = brcmstb_dpfe_remove,
|
||||
.resume = brcmstb_dpfe_resume,
|
||||
};
|
||||
|
||||
|
||||
@@ -2060,8 +2060,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
|
||||
* timings.
|
||||
*/
|
||||
name = gpmc_cs_get_name(cs);
|
||||
if (name && child->name && of_node_cmp(child->name, name) == 0)
|
||||
goto no_timings;
|
||||
if (name && of_node_cmp(child->name, name) == 0)
|
||||
goto no_timings;
|
||||
|
||||
ret = gpmc_cs_request(cs, resource_size(&res), &base);
|
||||
if (ret < 0) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user