diff options
author | Alex Elder <elder@linaro.org> | 2020-03-05 22:28:17 -0600 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-08 22:07:09 -0700 |
commit | cdf2e9419dd91475962627d7b7f72f2393a09fce (patch) | |
tree | 5511ef73eb329005382e716ccb36a09ddfa3b62d /drivers/net/ipa/ipa_reg.c | |
parent | fc39c40a15a6cd857af8769bc276d4ef35e241ce (diff) | |
download | linux-cdf2e9419dd91475962627d7b7f72f2393a09fce.tar.gz linux-cdf2e9419dd91475962627d7b7f72f2393a09fce.tar.bz2 linux-cdf2e9419dd91475962627d7b7f72f2393a09fce.zip |
soc: qcom: ipa: main code
This patch includes three source files that represent some basic "main
program" code for the IPA driver. They are:
- "ipa.h" defines the top-level IPA structure which represents an IPA
device throughout the code.
- "ipa_main.c" contains the platform driver probe function, along with
some general code used during initialization.
- "ipa_reg.h" defines the offsets of the 32-bit registers used for the
IPA device, along with masks that define the position and width of
fields within these registers.
- "version.h" defines some symbolic IPA version numbers.
Each file includes some documentation that provides a little more
overview of how the code is organized and used.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipa/ipa_reg.c')
-rw-r--r-- | drivers/net/ipa/ipa_reg.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/ipa/ipa_reg.c b/drivers/net/ipa/ipa_reg.c new file mode 100644 index 000000000000..e6147a1cd787 --- /dev/null +++ b/drivers/net/ipa/ipa_reg.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. + * Copyright (C) 2019-2020 Linaro Ltd. + */ + +#include <linux/io.h> + +#include "ipa.h" +#include "ipa_reg.h" + +int ipa_reg_init(struct ipa *ipa) +{ + struct device *dev = &ipa->pdev->dev; + struct resource *res; + + /* Setup IPA register memory */ + res = platform_get_resource_byname(ipa->pdev, IORESOURCE_MEM, + "ipa-reg"); + if (!res) { + dev_err(dev, "DT error getting \"ipa-reg\" memory property\n"); + return -ENODEV; + } + + ipa->reg_virt = ioremap(res->start, resource_size(res)); + if (!ipa->reg_virt) { + dev_err(dev, "unable to remap \"ipa-reg\" memory\n"); + return -ENOMEM; + } + ipa->reg_addr = res->start; + + return 0; +} + +void ipa_reg_exit(struct ipa *ipa) +{ + iounmap(ipa->reg_virt); +} |