Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 1 | /* |
Kristofer Jonsson | b42bc0b | 2023-01-04 17:09:28 +0100 | [diff] [blame] | 2 | * Copyright 2020-2023 Arm Limited and/or its affiliates |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 3 | * |
| 4 | * This program is free software and is provided to you under the terms of the |
| 5 | * GNU General Public License version 2 as published by the Free Software |
| 6 | * Foundation, and any use by you of this program is subject to the terms |
| 7 | * of such GNU licence. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, you can access it online at |
| 16 | * http://www.gnu.org/licenses/gpl-2.0.html. |
| 17 | * |
| 18 | * SPDX-License-Identifier: GPL-2.0-only |
| 19 | */ |
| 20 | |
| 21 | #ifndef ETHOSU_DEVICE_H |
| 22 | #define ETHOSU_DEVICE_H |
| 23 | |
| 24 | /**************************************************************************** |
| 25 | * Includes |
| 26 | ****************************************************************************/ |
| 27 | |
Davide Grohmann | 35ce6c8 | 2021-06-01 15:03:51 +0200 | [diff] [blame] | 28 | #include "uapi/ethosu.h" |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 29 | #include "ethosu_mailbox.h" |
| 30 | |
| 31 | #include <linux/device.h> |
| 32 | #include <linux/cdev.h> |
| 33 | #include <linux/io.h> |
| 34 | #include <linux/mutex.h> |
Kristofer Jonsson | d779a08 | 2023-01-04 17:09:47 +0100 | [diff] [blame] | 35 | #include <linux/rpmsg.h> |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 36 | |
| 37 | /**************************************************************************** |
| 38 | * Types |
| 39 | ****************************************************************************/ |
| 40 | |
| 41 | /** |
| 42 | * struct ethosu_device - Device structure |
| 43 | */ |
| 44 | struct ethosu_device { |
Kristofer Jonsson | 074ef90 | 2023-01-23 13:05:36 +0100 | [diff] [blame] | 45 | struct device dev; |
Kristofer Jonsson | d779a08 | 2023-01-04 17:09:47 +0100 | [diff] [blame] | 46 | struct rpmsg_device *rpdev; |
| 47 | struct rpmsg_endpoint *ept; |
Kristofer Jonsson | b42bc0b | 2023-01-04 17:09:28 +0100 | [diff] [blame] | 48 | struct cdev cdev; |
Jonny Svärd | 29e4ddb | 2023-03-24 15:58:09 +0100 | [diff] [blame^] | 49 | struct class *class; |
Kristofer Jonsson | b42bc0b | 2023-01-04 17:09:28 +0100 | [diff] [blame] | 50 | struct ethosu_mailbox mailbox; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 51 | }; |
| 52 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 53 | /**************************************************************************** |
| 54 | * Functions |
| 55 | ****************************************************************************/ |
| 56 | |
| 57 | /** |
| 58 | * ethosu_dev_init() - Initialize the device |
| 59 | * |
| 60 | * Return: 0 on success, else error code. |
| 61 | */ |
Kristofer Jonsson | ec47704 | 2023-01-20 13:38:13 +0100 | [diff] [blame] | 62 | int ethosu_dev_init(struct rpmsg_device *rpdev, |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 63 | struct class *class, |
Kristofer Jonsson | d779a08 | 2023-01-04 17:09:47 +0100 | [diff] [blame] | 64 | dev_t devt); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * ethosu_dev_deinit() - Initialize the device |
| 68 | */ |
Kristofer Jonsson | ec47704 | 2023-01-20 13:38:13 +0100 | [diff] [blame] | 69 | void ethosu_dev_deinit(struct rpmsg_device *rpdev); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 70 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 71 | #endif /* ETHOSU_DEVICE_H */ |