mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-28 12:25:31 +00:00
Drivers for 4.10:
- few fixes for the memory drivers - minimal security module driver - support for the Secure SRAM -----BEGIN PGP SIGNATURE----- iQIcBAABCgAGBQJYKgVyAAoJENiigzvaE+LCklUP/imbZ7nV0IVxiajDDPSNSkho 1Bu+0TV0DZJ0tx055suKS9uC9zWGEdSJhbvKZdjixB2TC4DAVDZO0Xx2Gj+Ux2HP wiMgtDfvgSyFjp6PGWo/sspgAM/WbA7G7x/f0x7JCE8TpyrqEnN0bbiabH7L6X2g K8u2KEywQdg/lOgr177fwFSwBlOx0BaHodvrXNqI58VQGNpcqv0l/8TgiPPdY0w9 fhg1JCvkZtDbAYgDmCvenGGF0IskjAWwi9fCXL+hsKurLYrS5udFFZLUvnFieKtN 4zTyzb8LtD9EUuawK6fGe5wHo786A4VCX2fQ7lKYyBT4ysJ7baeTfZGK3XGn0one BVlyeLVZw4p65esx12fEkB2Nm7YSlKp64Jd/8wYPW5doSd/HaPG9MbWeVlRhmQYr f5Frn2oiBbkh414LjpARkDY2ZY1fmqVfLZ6A3FUktIsocULDMEa3rzNAG0VQyAlx 9PnW05/HQnVVhtmfv9+wgMVH5ZJmQLZnkmgX35mjoo5cRvpBqxsif/3Ul0lGb4Y3 IZDIVBiZpnBPF9OpJ+cTexOsXT/UVcHpjOT7MT72NprVF0OpfkI5TSa79eQX6bmD TiabMkE5RmVkaQVuIlErut0gxvGl72N93F3LDDP1ZYWaYmU4u/JirImuhw/e+U5v 00JrVYaM6TDahSl2PMO6 =/UOn -----END PGP SIGNATURE----- Merge tag 'at91-ab-4.10-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux into next/drivers Drivers for 4.10: - few fixes for the memory drivers - minimal security module driver - support for the Secure SRAM * tag 'at91-ab-4.10-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: misc: sram: add Atmel securam support misc: sram: document new compatible ARM: at91: add secumod register definitions Documentation: dt: atmel-at91: Document secumod bindings memory: atmel-sdramc: use builtin_platform_driver to simplify the code memory: atmel-ebi: fix return value check in at91_ebi_dev_disable() Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
commit
555b2b5d25
@ -225,3 +225,19 @@ required properties:
|
||||
compatible = "atmel,sama5d3-sfr", "syscon";
|
||||
reg = <0xf0038000 0x60>;
|
||||
};
|
||||
|
||||
Security Module (SECUMOD)
|
||||
|
||||
The Security Module macrocell provides all necessary secure functions to avoid
|
||||
voltage, temperature, frequency and mechanical attacks on the chip. It also
|
||||
embeds secure memories that can be scrambled
|
||||
|
||||
required properties:
|
||||
- compatible: Should be "atmel,<chip>-secumod", "syscon".
|
||||
<chip> can be "sama5d2".
|
||||
- reg: Should contain registers location and length
|
||||
|
||||
secumod@fc040000 {
|
||||
compatible = "atmel,sama5d2-secumod", "syscon";
|
||||
reg = <0xfc040000 0x100>;
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ Simple IO memory regions to be managed by the genalloc API.
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : mmio-sram
|
||||
- compatible : mmio-sram or atmel,sama5d2-securam
|
||||
|
||||
- reg : SRAM iomem address range
|
||||
|
||||
|
@ -657,7 +657,7 @@ static int at91_ebi_dev_disable(struct at91_ebi *ebi, struct device_node *np)
|
||||
return -ENOMEM;
|
||||
|
||||
newprop->value = devm_kstrdup(dev, "disabled", GFP_KERNEL);
|
||||
if (!newprop->name)
|
||||
if (!newprop->value)
|
||||
return -ENOMEM;
|
||||
|
||||
newprop->length = sizeof("disabled");
|
||||
|
@ -85,8 +85,4 @@ static struct platform_driver atmel_ramc_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __init atmel_ramc_init(void)
|
||||
{
|
||||
return platform_driver_register(&atmel_ramc_driver);
|
||||
}
|
||||
device_initcall(atmel_ramc_init);
|
||||
builtin_platform_driver(atmel_ramc_driver);
|
||||
|
@ -19,12 +19,17 @@
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/genalloc.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/list_sort.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <soc/at91/atmel-secumod.h>
|
||||
|
||||
#define SRAM_GRANULARITY 32
|
||||
|
||||
@ -334,12 +339,35 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int atmel_securam_wait(void)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
u32 val;
|
||||
|
||||
regmap = syscon_regmap_lookup_by_compatible("atmel,sama5d2-secumod");
|
||||
if (IS_ERR(regmap))
|
||||
return -ENODEV;
|
||||
|
||||
return regmap_read_poll_timeout(regmap, AT91_SECUMOD_RAMRDY, val,
|
||||
val & AT91_SECUMOD_RAMRDY_READY,
|
||||
10000, 500000);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id sram_dt_ids[] = {
|
||||
{ .compatible = "mmio-sram" },
|
||||
{ .compatible = "atmel,sama5d2-securam", .data = atmel_securam_wait },
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
||||
static int sram_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct sram_dev *sram;
|
||||
struct resource *res;
|
||||
size_t size;
|
||||
int ret;
|
||||
int (*init_func)(void);
|
||||
|
||||
sram = devm_kzalloc(&pdev->dev, sizeof(*sram), GFP_KERNEL);
|
||||
if (!sram)
|
||||
@ -384,6 +412,13 @@ static int sram_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, sram);
|
||||
|
||||
init_func = of_device_get_match_data(&pdev->dev);
|
||||
if (init_func) {
|
||||
ret = init_func();
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_dbg(sram->dev, "SRAM pool: %zu KiB @ 0x%p\n",
|
||||
gen_pool_size(sram->pool) / 1024, sram->virt_base);
|
||||
|
||||
@ -405,13 +440,6 @@ static int sram_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id sram_dt_ids[] = {
|
||||
{ .compatible = "mmio-sram" },
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct platform_driver sram_driver = {
|
||||
.driver = {
|
||||
.name = "sram",
|
||||
|
19
include/soc/at91/atmel-secumod.h
Normal file
19
include/soc/at91/atmel-secumod.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Atmel Security Module register offsets and bit definitions.
|
||||
*
|
||||
* Copyright (C) 2016 Atmel
|
||||
*
|
||||
* Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_SOC_AT91_ATMEL_SECUMOD_H
|
||||
#define _LINUX_SOC_AT91_ATMEL_SECUMOD_H
|
||||
|
||||
#define AT91_SECUMOD_RAMRDY 0x14
|
||||
#define AT91_SECUMOD_RAMRDY_READY BIT(0)
|
||||
|
||||
#endif /* _LINUX_SOC_AT91_ATMEL_SECUMOD_H */
|
Loading…
Reference in New Issue
Block a user