1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2021-2022 Digiteq Automotive
4 * author: Martin Tuma <martin.tuma@digiteqautomotive.com>
7 #include <linux/ioport.h>
10 int mgb4_regs_map(struct resource
*res
, struct mgb4_regs
*regs
)
12 regs
->mapbase
= res
->start
;
13 regs
->mapsize
= resource_size(res
);
15 if (!request_mem_region(regs
->mapbase
, regs
->mapsize
, res
->name
))
17 regs
->membase
= ioremap(regs
->mapbase
, regs
->mapsize
);
19 release_mem_region(regs
->mapbase
, regs
->mapsize
);
26 void mgb4_regs_free(struct mgb4_regs
*regs
)
28 iounmap(regs
->membase
);
29 release_mem_region(regs
->mapbase
, regs
->mapsize
);