Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02e9f870 authored by Rohit Vaswani's avatar Rohit Vaswani
Browse files

msm: pil: Add memory map and unmap function ptrs



Certain platforms require the ability to do custom mapping and
unmapping of firmware  memory regions.  Add map and umap function
pointers to the descriptor, and initialize them to the existing
functions by default if none are specified by the user.

Change-Id: I9ef7cab266e45ba920e7ec20dd281a92909b4f74
Acked-by: default avatarKaushik Sikdar <ksikdar@qti.qualcomm.com>
Signed-off-by: default avatarRohit Vaswani <rvaswani@codeaurora.org>
parent f922f807
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -545,8 +545,8 @@ static int pil_load_seg(struct pil_desc *desc, struct pil_seg *seg)
		snprintf(fw_name, ARRAY_SIZE(fw_name), "%s.b%02d",
				desc->name, num);
		ret = request_firmware_direct(fw_name, desc->dev, seg->paddr,
					      seg->filesz, map_fw_mem,
					      unmap_fw_mem);
					      seg->filesz, desc->map_fw_mem,
					      desc->unmap_fw_mem);
		if (ret < 0) {
			pil_err(desc, "Failed to locate blob %s or blob is too big.\n",
				fw_name);
@@ -822,6 +822,13 @@ int pil_desc_init(struct pil_desc *desc)
	INIT_DELAYED_WORK(&priv->proxy, pil_proxy_unvote_work);
	INIT_LIST_HEAD(&priv->segs);

	/* Make sure mapping functions are set. */
	if (!desc->map_fw_mem)
		desc->map_fw_mem = map_fw_mem;

	if (!desc->unmap_fw_mem)
		desc->unmap_fw_mem = unmap_fw_mem;

	return 0;
err:
	kfree(priv);
+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -27,6 +27,10 @@ struct pil_priv;
 * @priv: DON'T USE - internal only
 * @proxy_unvote_irq: IRQ to trigger a proxy unvote. proxy_timeout
 * is ignored if this is set.
 * @map_fw_mem: Custom function used to map physical address space to virtual.
 * This defaults to ioremap if not specified.
 * @unmap_fw_mem: Custom function used to undo mapping by map_fw_mem.
 * This defaults to iounmap if not specified.
 */
struct pil_desc {
	const char *name;
@@ -38,6 +42,8 @@ struct pil_desc {
#define PIL_SKIP_ENTRY_CHECK	BIT(0)
	struct pil_priv *priv;
	unsigned int proxy_unvote_irq;
	void * (*map_fw_mem)(phys_addr_t phys, size_t size);
	void (*unmap_fw_mem)(void *virt);
};

/**