blob: 281a5ec819a92f3179e6a1e60d1016cd7643fc3d [file] [log] [blame]
Vladimir Zapolskiy1b154832023-04-21 20:50:33 +03001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Qualcomm Generic Interface (GENI) Serial Engine (SE) Wrapper
4 *
5 * Copyright (C) 2023 Linaro Ltd. <vladimir.zapolskiy@linaro.org>
6 */
7
8#include <common.h>
9#include <dm.h>
10#include <misc.h>
11#include <asm/io.h>
12
13static int geni_se_qup_read(struct udevice *dev, int offset,
14 void *buf, int size)
15{
16 fdt_addr_t base = dev_read_addr(dev);
17
18 if (size != sizeof(u32))
19 return -EINVAL;
20
21 *(u32 *)buf = readl(base + offset);
22
23 return size;
24}
25
26static struct misc_ops geni_se_qup_ops = {
27 .read = geni_se_qup_read,
28};
29
30static const struct udevice_id geni_se_qup_ids[] = {
31 { .compatible = "qcom,geni-se-qup" },
32 {}
33};
34
35U_BOOT_DRIVER(geni_se_qup) = {
36 .name = "geni_se_qup",
37 .id = UCLASS_MISC,
38 .of_match = geni_se_qup_ids,
39 .ops = &geni_se_qup_ops,
40 .flags = DM_FLAG_PRE_RELOC,
41};