mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
Allwinner driver changes for 4.14
Usual driver changes: - SUNXI_RSB bus driver enabled by default for ARM64 - Support for SRAM controller and SRAM C block on the A64 added -----BEGIN PGP SIGNATURE----- iQJCBAABCgAsFiEE2nN1m/hhnkhOWjtHOJpUIZwPJDAFAlmXuVkOHHdlbnNAY3Np ZS5vcmcACgkQOJpUIZwPJDABghAAynR1zup2Fk1O3vC/49/oqojoFDoMar9ZOEpe Aw/kMphhVUSyedVpNjef1bfu2TYfXxl/bD56T3oQbNLIHM7A7sW2Ay/blt+5/tOz v0QiCY+y3nGpP49TOp6NSgoFb8H75xh09HDzey+ETWA34NV8ywz7dCry1XJ4Taln IIULlsWJJkfefJB0fcWULG/omGArqM9SiZnXnwPaf+3D1wZTFh3X/vjkVq5tewOf To/kLZNE4C5mubcXqurDRNiomzQpnbGD54ZYfnK+F1W/PdJoOrwsMRwEAGe0+zOI wehMKvd2cOgt1lnLt5fsEESNGr8T/5gdPB1JNP437+DP1uou0KBdmZKTwTx0eYI/ YADxSqGVVpF9UVrMYDGK2sBTfhcKFCo8I6Xw9yfLraVY4Gs3uzAAe2MtDgTYITrO H3jHsmt6bqDrWgYDG3kzbFvKDyn5+uB6UgZ67Reg5eP+XcubAj7UEQEu8oliRz1V qOu4YbO0tkqnYCeotq3yEGEVbSr9KQ+M2MUR/5pdyRgjqg7ZueppmDh9DqD9Ene+ v/hiI4M+TpdpOLuywYsctDRYWEjnUSeIrxy3HJSRXqH+LMzhxm9KL2jHQy6EcICv ALaGhyEtnstDrI61hgG/di/jq7TjL8LHL9lubxrbt8Eiq+52hJy5EmPexq5YQM/1 raOLKkQ= =i+D6 -----END PGP SIGNATURE----- Merge tag 'sunxi-drivers-for-4.14' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into next/drivers Pull "Allwinner driver changes for 4.14" from Chen-Yu Tsai: Usual driver changes: - SUNXI_RSB bus driver enabled by default for ARM64 - Support for SRAM controller and SRAM C block on the A64 added * tag 'sunxi-drivers-for-4.14' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux: drivers: soc: sunxi: add support for A64 and its SRAM C drivers: soc: sunxi: add support for remapping func value to reg value drivers: soc: sunxi: fix error processing on base address when claiming dt-bindings: add binding for Allwinner A64 SRAM controller and SRAM C bus: sunxi-rsb: Enable by default for ARM64
This commit is contained in:
commit
2e9a41dca3
@ -9,7 +9,9 @@ Controller Node
|
||||
---------------
|
||||
|
||||
Required properties:
|
||||
- compatible : "allwinner,sun4i-a10-sram-controller"
|
||||
- compatible : should be:
|
||||
- "allwinner,sun4i-a10-sram-controller"
|
||||
- "allwinner,sun50i-a64-sram-controller"
|
||||
- reg : sram controller register offset + length
|
||||
|
||||
SRAM nodes
|
||||
@ -22,10 +24,13 @@ Each SRAM will have SRAM sections that are going to be handled by the
|
||||
SRAM controller as subnodes. These sections are represented following
|
||||
once again the representation described in the mmio-sram binding.
|
||||
|
||||
The valid sections compatible are:
|
||||
The valid sections compatible for A10 are:
|
||||
- allwinner,sun4i-a10-sram-a3-a4
|
||||
- allwinner,sun4i-a10-sram-d
|
||||
|
||||
The valid sections compatible for A64 are:
|
||||
- allwinner,sun50i-a64-sram-c
|
||||
|
||||
Devices using SRAM sections
|
||||
---------------------------
|
||||
|
||||
|
@ -132,7 +132,7 @@ config SIMPLE_PM_BUS
|
||||
|
||||
config SUNXI_RSB
|
||||
tristate "Allwinner sunXi Reduced Serial Bus Driver"
|
||||
default MACH_SUN8I || MACH_SUN9I
|
||||
default MACH_SUN8I || MACH_SUN9I || ARM64
|
||||
depends on ARCH_SUNXI
|
||||
select REGMAP
|
||||
help
|
||||
|
@ -23,6 +23,7 @@
|
||||
struct sunxi_sram_func {
|
||||
char *func;
|
||||
u8 val;
|
||||
u32 reg_val;
|
||||
};
|
||||
|
||||
struct sunxi_sram_data {
|
||||
@ -39,10 +40,11 @@ struct sunxi_sram_desc {
|
||||
bool claimed;
|
||||
};
|
||||
|
||||
#define SUNXI_SRAM_MAP(_val, _func) \
|
||||
#define SUNXI_SRAM_MAP(_reg_val, _val, _func) \
|
||||
{ \
|
||||
.func = _func, \
|
||||
.val = _val, \
|
||||
.reg_val = _reg_val, \
|
||||
}
|
||||
|
||||
#define SUNXI_SRAM_DATA(_name, _reg, _off, _width, ...) \
|
||||
@ -57,14 +59,20 @@ struct sunxi_sram_desc {
|
||||
|
||||
static struct sunxi_sram_desc sun4i_a10_sram_a3_a4 = {
|
||||
.data = SUNXI_SRAM_DATA("A3-A4", 0x4, 0x4, 2,
|
||||
SUNXI_SRAM_MAP(0, "cpu"),
|
||||
SUNXI_SRAM_MAP(1, "emac")),
|
||||
SUNXI_SRAM_MAP(0, 0, "cpu"),
|
||||
SUNXI_SRAM_MAP(1, 1, "emac")),
|
||||
};
|
||||
|
||||
static struct sunxi_sram_desc sun4i_a10_sram_d = {
|
||||
.data = SUNXI_SRAM_DATA("D", 0x4, 0x0, 1,
|
||||
SUNXI_SRAM_MAP(0, "cpu"),
|
||||
SUNXI_SRAM_MAP(1, "usb-otg")),
|
||||
SUNXI_SRAM_MAP(0, 0, "cpu"),
|
||||
SUNXI_SRAM_MAP(1, 1, "usb-otg")),
|
||||
};
|
||||
|
||||
static struct sunxi_sram_desc sun50i_a64_sram_c = {
|
||||
.data = SUNXI_SRAM_DATA("C", 0x4, 24, 1,
|
||||
SUNXI_SRAM_MAP(0, 1, "cpu"),
|
||||
SUNXI_SRAM_MAP(1, 0, "de2")),
|
||||
};
|
||||
|
||||
static const struct of_device_id sunxi_sram_dt_ids[] = {
|
||||
@ -76,6 +84,10 @@ static const struct of_device_id sunxi_sram_dt_ids[] = {
|
||||
.compatible = "allwinner,sun4i-a10-sram-d",
|
||||
.data = &sun4i_a10_sram_d.data,
|
||||
},
|
||||
{
|
||||
.compatible = "allwinner,sun50i-a64-sram-c",
|
||||
.data = &sun50i_a64_sram_c.data,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
@ -121,7 +133,8 @@ static int sunxi_sram_show(struct seq_file *s, void *data)
|
||||
|
||||
for (func = sram_data->func; func->func; func++) {
|
||||
seq_printf(s, "\t\t%s%c\n", func->func,
|
||||
func->val == val ? '*' : ' ');
|
||||
func->reg_val == val ?
|
||||
'*' : ' ');
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,10 +162,13 @@ static inline struct sunxi_sram_desc *to_sram_desc(const struct sunxi_sram_data
|
||||
}
|
||||
|
||||
static const struct sunxi_sram_data *sunxi_sram_of_parse(struct device_node *node,
|
||||
unsigned int *value)
|
||||
unsigned int *reg_value)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
const struct sunxi_sram_data *data;
|
||||
struct sunxi_sram_func *func;
|
||||
struct of_phandle_args args;
|
||||
u8 val;
|
||||
int ret;
|
||||
|
||||
ret = of_parse_phandle_with_fixed_args(node, "allwinner,sram", 1, 0,
|
||||
@ -165,8 +181,7 @@ static const struct sunxi_sram_data *sunxi_sram_of_parse(struct device_node *nod
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (value)
|
||||
*value = args.args[0];
|
||||
val = args.args[0];
|
||||
|
||||
match = of_match_node(sunxi_sram_dt_ids, args.np);
|
||||
if (!match) {
|
||||
@ -174,6 +189,26 @@ static const struct sunxi_sram_data *sunxi_sram_of_parse(struct device_node *nod
|
||||
goto err;
|
||||
}
|
||||
|
||||
data = match->data;
|
||||
if (!data) {
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
};
|
||||
|
||||
for (func = data->func; func->func; func++) {
|
||||
if (val == func->val) {
|
||||
if (reg_value)
|
||||
*reg_value = func->reg_val;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!func->func) {
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
of_node_put(args.np);
|
||||
return match->data;
|
||||
|
||||
@ -190,6 +225,9 @@ int sunxi_sram_claim(struct device *dev)
|
||||
u32 val, mask;
|
||||
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
if (!base)
|
||||
return -EPROBE_DEFER;
|
||||
|
||||
if (!dev || !dev->of_node)
|
||||
@ -267,6 +305,7 @@ static int sunxi_sram_probe(struct platform_device *pdev)
|
||||
|
||||
static const struct of_device_id sunxi_sram_dt_match[] = {
|
||||
{ .compatible = "allwinner,sun4i-a10-sram-controller" },
|
||||
{ .compatible = "allwinner,sun50i-a64-sram-controller" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sunxi_sram_dt_match);
|
||||
|
Loading…
Reference in New Issue
Block a user