ipa_reg.c (797B)
1// SPDX-License-Identifier: GPL-2.0 2 3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 4 * Copyright (C) 2019-2020 Linaro Ltd. 5 */ 6 7#include <linux/io.h> 8 9#include "ipa.h" 10#include "ipa_reg.h" 11 12int ipa_reg_init(struct ipa *ipa) 13{ 14 struct device *dev = &ipa->pdev->dev; 15 struct resource *res; 16 17 /* Setup IPA register memory */ 18 res = platform_get_resource_byname(ipa->pdev, IORESOURCE_MEM, 19 "ipa-reg"); 20 if (!res) { 21 dev_err(dev, "DT error getting \"ipa-reg\" memory property\n"); 22 return -ENODEV; 23 } 24 25 ipa->reg_virt = ioremap(res->start, resource_size(res)); 26 if (!ipa->reg_virt) { 27 dev_err(dev, "unable to remap \"ipa-reg\" memory\n"); 28 return -ENOMEM; 29 } 30 ipa->reg_addr = res->start; 31 32 return 0; 33} 34 35void ipa_reg_exit(struct ipa *ipa) 36{ 37 iounmap(ipa->reg_virt); 38}