summaryrefslogtreecommitdiff
path: root/drivers/edgetpu/abrolhos-platform.h
blob: 068a23f8ec033923b4f4f8da59804f6b8e177a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Abrolhos device driver for the Google EdgeTPU ML accelerator.
 *
 * Copyright (C) 2019 Google, Inc.
 */
#ifndef __ABROLHOS_PLATFORM_H__
#define __ABROLHOS_PLATFORM_H__

#include <linux/device.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/types.h>
#include <soc/google/bcl.h>
#include <soc/google/bts.h>
#include <soc/google/exynos_pm_qos.h>

#include "abrolhos-debug-dump.h"
#include "abrolhos-pm.h"
#include "edgetpu-internal.h"

#define to_abrolhos_dev(etdev)                                                 \
	container_of(etdev, struct abrolhos_platform_dev, edgetpu_dev)

struct abrolhos_platform_pwr {
	struct mutex policy_lock;
	enum tpu_pwr_state curr_policy;
	struct mutex state_lock;
	u64 min_state;
	u64 requested_state;
	/* INT/MIF requests for memory bandwidth */
	struct exynos_pm_qos_request int_min;
	struct exynos_pm_qos_request mif_min;
	/* BTS */
	unsigned int performance_scenario;
	int scenario_count;
	struct mutex scenario_lock;
};

struct abrolhos_platform_dev {
	struct edgetpu_dev edgetpu_dev;
	struct abrolhos_platform_pwr platform_pwr;
	int irq;
	phys_addr_t fw_region_paddr;
	size_t fw_region_size;
	void *shared_mem_vaddr;
	phys_addr_t shared_mem_paddr;
	size_t shared_mem_size;
	struct device *gsa_dev;
	void __iomem *ssmt_base;
	struct edgetpu_coherent_mem log_mem;
	struct edgetpu_coherent_mem trace_mem;
	struct abrolhos_sscd_info sscd_info;
#if IS_ENABLED(CONFIG_GOOGLE_BCL)
	struct bcl_device *bcl_dev;
#endif
	/* Protects TZ Mailbox client pointer */
	struct mutex tz_mailbox_lock;
	/* TZ mailbox client */
	struct edgetpu_client *secure_client;
};

#endif /* __ABROLHOS_PLATFORM_H__ */