mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 21:24:00 +08:00
f822e60085
Add R-Car D3 (r8a77995) support to the Renesas-specific SoC drivers - SoC identification - System controller - Reset controller -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJZf0DrAAoJENfPZGlqN0++LacP/jcymVeUMDpkkPTcoM6b37Qq ADSDdiR+1Szu29wtfNDTFUoAlh4UvlpAN93GGJLZ/iYsMDyZYIhcUhnE4l119fdy 6iMwDhctXHlQ8VNhY0Z9MUXZyyN2Fu/9L2ZDJ2briM2xoNiMgdUYvMlsZI8ZaN1/ JRmfP+lzCM25Rkdi9sLYolj8szaxbW9RgLBgvXD7ERJ5bsJRKGs6aDrJ2AXMZpwn BVOeughlPTxvv+NVFA1qZXWh63/7RjW5t6OMgHw3eNOABKv+o5YfdqOZAa8PHgn9 LhNAkR90Il9hsGesWwHMKPuCgGHE0R/2nQppWM0xBWO/HfMRnpx8DEt+em/Kjpep uxex+bqMOJB0GksVWPM73ci1CQmQxKS6xrTXeTE9kiN+6WD+b0Fsntoz2XN62uJO df0z46N6T3I4jFc00vOBnXxCdgDCBCJLxtU8NFg8jzmGP+NkKxxYiwCEs1auKlLF CUVX+o8H4V9FKnD3h0/mNsNyw/gCw6TWXlyr/Ba6AjBuZ8TghhMjQ+zbY+xCN9sb IFONbr69pVBJ9N2ssGWdf2iLfa+JNcaJdEPZUkumgUlZ9M5RgS+yg3YoTFtlAO6R JN2uP1E20qBLlrvAu7pv9HQEim80RyDT2DU2a1qFNx32vhqfl6g3sccJJvGpzodj 7y7per6KkpvUGrck0kAI =AO// -----END PGP SIGNATURE----- Merge tag 'renesas-drivers-for-v4.14' of https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/drivers Pull "Renesas ARM Based SoC Drivers Updates for v4.14" from Simon Horman: Add R-Car D3 (r8a77995) support to the Renesas-specific SoC drivers - SoC identification - System controller - Reset controller * tag 'renesas-drivers-for-v4.14' of https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: soc: renesas: rcar-rst: Add support for R-Car D3 soc: renesas: rcar-sysc: Add support for R-Car D3 power areas soc: renesas: Add r8a77995 SYSC PM Domain Binding Definitions soc: renesas: Identify R-Car D3
94 lines
2.4 KiB
C
94 lines
2.4 KiB
C
/*
|
|
* R-Car Gen1 RESET/WDT, R-Car Gen2, Gen3, and RZ/G RST Driver
|
|
*
|
|
* Copyright (C) 2016 Glider bvba
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
|
|
#include <linux/err.h>
|
|
#include <linux/io.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/soc/renesas/rcar-rst.h>
|
|
|
|
struct rst_config {
|
|
unsigned int modemr; /* Mode Monitoring Register Offset */
|
|
};
|
|
|
|
static const struct rst_config rcar_rst_gen1 __initconst = {
|
|
.modemr = 0x20,
|
|
};
|
|
|
|
static const struct rst_config rcar_rst_gen2 __initconst = {
|
|
.modemr = 0x60,
|
|
};
|
|
|
|
static const struct of_device_id rcar_rst_matches[] __initconst = {
|
|
/* RZ/G is handled like R-Car Gen2 */
|
|
{ .compatible = "renesas,r8a7743-rst", .data = &rcar_rst_gen2 },
|
|
{ .compatible = "renesas,r8a7745-rst", .data = &rcar_rst_gen2 },
|
|
/* R-Car Gen1 */
|
|
{ .compatible = "renesas,r8a7778-reset-wdt", .data = &rcar_rst_gen1 },
|
|
{ .compatible = "renesas,r8a7779-reset-wdt", .data = &rcar_rst_gen1 },
|
|
/* R-Car Gen2 */
|
|
{ .compatible = "renesas,r8a7790-rst", .data = &rcar_rst_gen2 },
|
|
{ .compatible = "renesas,r8a7791-rst", .data = &rcar_rst_gen2 },
|
|
{ .compatible = "renesas,r8a7792-rst", .data = &rcar_rst_gen2 },
|
|
{ .compatible = "renesas,r8a7793-rst", .data = &rcar_rst_gen2 },
|
|
{ .compatible = "renesas,r8a7794-rst", .data = &rcar_rst_gen2 },
|
|
/* R-Car Gen3 is handled like R-Car Gen2 */
|
|
{ .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen2 },
|
|
{ .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen2 },
|
|
{ .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen2 },
|
|
{ /* sentinel */ }
|
|
};
|
|
|
|
static void __iomem *rcar_rst_base __initdata;
|
|
static u32 saved_mode __initdata;
|
|
|
|
static int __init rcar_rst_init(void)
|
|
{
|
|
const struct of_device_id *match;
|
|
const struct rst_config *cfg;
|
|
struct device_node *np;
|
|
void __iomem *base;
|
|
int error = 0;
|
|
|
|
np = of_find_matching_node_and_match(NULL, rcar_rst_matches, &match);
|
|
if (!np)
|
|
return -ENODEV;
|
|
|
|
base = of_iomap(np, 0);
|
|
if (!base) {
|
|
pr_warn("%pOF: Cannot map regs\n", np);
|
|
error = -ENOMEM;
|
|
goto out_put;
|
|
}
|
|
|
|
rcar_rst_base = base;
|
|
cfg = match->data;
|
|
saved_mode = ioread32(base + cfg->modemr);
|
|
|
|
pr_debug("%pOF: MODE = 0x%08x\n", np, saved_mode);
|
|
|
|
out_put:
|
|
of_node_put(np);
|
|
return error;
|
|
}
|
|
|
|
int __init rcar_rst_read_mode_pins(u32 *mode)
|
|
{
|
|
int error;
|
|
|
|
if (!rcar_rst_base) {
|
|
error = rcar_rst_init();
|
|
if (error)
|
|
return error;
|
|
}
|
|
|
|
*mode = saved_mode;
|
|
return 0;
|
|
}
|