diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2015-09-08 01:01:14 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2015-09-08 01:01:14 -0300 |
commit | e5fd91f1ef340da553f7a79da9540c3db711c937 (patch) | |
tree | b11842027dc6641da63f4bcc524f8678263304a3 /drivers/pinctrl/berlin | |
parent | 2a9b0348e685a63d97486f6749622b61e9e3292f (diff) |
Linux-libre 4.2-gnu
Diffstat (limited to 'drivers/pinctrl/berlin')
-rw-r--r-- | drivers/pinctrl/berlin/berlin-bg2.c | 44 | ||||
-rw-r--r-- | drivers/pinctrl/berlin/berlin-bg2cd.c | 34 | ||||
-rw-r--r-- | drivers/pinctrl/berlin/berlin-bg2q.c | 42 | ||||
-rw-r--r-- | drivers/pinctrl/berlin/berlin.c | 13 |
4 files changed, 35 insertions, 98 deletions
diff --git a/drivers/pinctrl/berlin/berlin-bg2.c b/drivers/pinctrl/berlin/berlin-bg2.c index b71a6fffe..274c5535b 100644 --- a/drivers/pinctrl/berlin/berlin-bg2.c +++ b/drivers/pinctrl/berlin/berlin-bg2.c @@ -20,24 +20,24 @@ static const struct berlin_desc_group berlin2_soc_pinctrl_groups[] = { /* G */ BERLIN_PINCTRL_GROUP("G0", 0x00, 0x1, 0x00, - BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), BERLIN_PINCTRL_GROUP("G1", 0x00, 0x2, 0x01, - BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS1n */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), BERLIN_PINCTRL_FUNCTION(0x2, "usb1")), BERLIN_PINCTRL_GROUP("G2", 0x00, 0x2, 0x02, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS2n */ BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), BERLIN_PINCTRL_FUNCTION(0x3, "i2s0")), BERLIN_PINCTRL_GROUP("G3", 0x00, 0x2, 0x04, BERLIN_PINCTRL_FUNCTION(0x0, "soc"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS3n */ BERLIN_PINCTRL_FUNCTION(0x2, "gpio"), BERLIN_PINCTRL_FUNCTION(0x3, "i2s1")), BERLIN_PINCTRL_GROUP("G4", 0x00, 0x2, 0x06, - BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK/SDI/SDO */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), BERLIN_PINCTRL_FUNCTION(0x2, "pwm")), BERLIN_PINCTRL_GROUP("G5", 0x00, 0x3, 0x08, @@ -163,15 +163,15 @@ static const struct berlin_desc_group berlin2_sysmgr_pinctrl_groups[] = { /* GSM */ BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS0n */ BERLIN_PINCTRL_FUNCTION(0x2, "eth1")), BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS1n */ BERLIN_PINCTRL_FUNCTION(0x2, "eth1")), BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04, BERLIN_PINCTRL_FUNCTION(0x0, "twsi2"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2")), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2")), /* SS2n/SS3n */ BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), BERLIN_PINCTRL_FUNCTION(0x1, "uart0"), /* CTS/RTS */ @@ -187,7 +187,7 @@ static const struct berlin_desc_group berlin2_sysmgr_pinctrl_groups[] = { BERLIN_PINCTRL_FUNCTION(0x3, "twsi3")), BERLIN_PINCTRL_GROUP("GSM6", 0x40, 0x2, 0x0c, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* CLK/SDO */ BERLIN_PINCTRL_FUNCTION(0x1, "clki")), BERLIN_PINCTRL_GROUP("GSM7", 0x40, 0x1, 0x0e, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), @@ -218,11 +218,11 @@ static const struct berlin_pinctrl_desc berlin2_sysmgr_pinctrl_data = { static const struct of_device_id berlin2_pinctrl_match[] = { { - .compatible = "marvell,berlin2-chip-ctrl", + .compatible = "marvell,berlin2-soc-pinctrl", .data = &berlin2_soc_pinctrl_data }, { - .compatible = "marvell,berlin2-system-ctrl", + .compatible = "marvell,berlin2-system-pinctrl", .data = &berlin2_sysmgr_pinctrl_data }, {} @@ -233,28 +233,6 @@ static int berlin2_pinctrl_probe(struct platform_device *pdev) { const struct of_device_id *match = of_match_device(berlin2_pinctrl_match, &pdev->dev); - struct regmap_config *rmconfig; - struct regmap *regmap; - struct resource *res; - void __iomem *base; - - rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL); - if (!rmconfig) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); - - rmconfig->reg_bits = 32, - rmconfig->val_bits = 32, - rmconfig->reg_stride = 4, - rmconfig->max_register = resource_size(res); - - regmap = devm_regmap_init_mmio(&pdev->dev, base, rmconfig); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); return berlin_pinctrl_probe(pdev, match->data); } diff --git a/drivers/pinctrl/berlin/berlin-bg2cd.c b/drivers/pinctrl/berlin/berlin-bg2cd.c index 19ac5a22c..0cb793a35 100644 --- a/drivers/pinctrl/berlin/berlin-bg2cd.c +++ b/drivers/pinctrl/berlin/berlin-bg2cd.c @@ -68,17 +68,17 @@ static const struct berlin_desc_group berlin2cd_soc_pinctrl_groups[] = { BERLIN_PINCTRL_FUNCTION(0x1, "twsi1"), BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), BERLIN_PINCTRL_GROUP("G8", 0x00, 0x3, 0x10, - BERLIN_PINCTRL_FUNCTION(0x0, "ss0"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), BERLIN_PINCTRL_GROUP("G9", 0x00, 0x3, 0x13, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS1n/SS2n */ BERLIN_PINCTRL_FUNCTION(0x2, "twsi0")), BERLIN_PINCTRL_GROUP("G10", 0x00, 0x2, 0x16, - BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), BERLIN_PINCTRL_GROUP("G11", 0x00, 0x2, 0x18, - BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SDI/SDO */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), BERLIN_PINCTRL_GROUP("G12", 0x00, 0x3, 0x1a, BERLIN_PINCTRL_FUNCTION(0x0, "usb1"), @@ -161,11 +161,11 @@ static const struct berlin_pinctrl_desc berlin2cd_sysmgr_pinctrl_data = { static const struct of_device_id berlin2cd_pinctrl_match[] = { { - .compatible = "marvell,berlin2cd-chip-ctrl", + .compatible = "marvell,berlin2cd-soc-pinctrl", .data = &berlin2cd_soc_pinctrl_data }, { - .compatible = "marvell,berlin2cd-system-ctrl", + .compatible = "marvell,berlin2cd-system-pinctrl", .data = &berlin2cd_sysmgr_pinctrl_data }, {} @@ -176,28 +176,6 @@ static int berlin2cd_pinctrl_probe(struct platform_device *pdev) { const struct of_device_id *match = of_match_device(berlin2cd_pinctrl_match, &pdev->dev); - struct regmap_config *rmconfig; - struct regmap *regmap; - struct resource *res; - void __iomem *base; - - rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL); - if (!rmconfig) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); - - rmconfig->reg_bits = 32, - rmconfig->val_bits = 32, - rmconfig->reg_stride = 4, - rmconfig->max_register = resource_size(res); - - regmap = devm_regmap_init_mmio(&pdev->dev, base, rmconfig); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); return berlin_pinctrl_probe(pdev, match->data); } diff --git a/drivers/pinctrl/berlin/berlin-bg2q.c b/drivers/pinctrl/berlin/berlin-bg2q.c index bd9662e57..a466054a8 100644 --- a/drivers/pinctrl/berlin/berlin-bg2q.c +++ b/drivers/pinctrl/berlin/berlin-bg2q.c @@ -59,21 +59,21 @@ static const struct berlin_desc_group berlin2q_soc_pinctrl_groups[] = { BERLIN_PINCTRL_FUNCTION(0x2, "gpio"), BERLIN_PINCTRL_FUNCTION(0x3, "eddc")), BERLIN_PINCTRL_GROUP("G8", 0x18, 0x3, 0x18, - BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK/SDI/SDO */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), BERLIN_PINCTRL_GROUP("G9", 0x18, 0x3, 0x1b, - BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n/SS1n */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), BERLIN_PINCTRL_FUNCTION(0x5, "sata")), BERLIN_PINCTRL_GROUP("G10", 0x1c, 0x3, 0x00, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS2n */ BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"), BERLIN_PINCTRL_FUNCTION(0x4, "pwm"), BERLIN_PINCTRL_FUNCTION(0x5, "sata")), BERLIN_PINCTRL_GROUP("G11", 0x1c, 0x3, 0x03, BERLIN_PINCTRL_FUNCTION(0x0, "jtag"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS3n */ BERLIN_PINCTRL_FUNCTION(0x2, "gpio"), BERLIN_PINCTRL_FUNCTION(0x3, "i2s1"), BERLIN_PINCTRL_FUNCTION(0x4, "pwm"), @@ -301,19 +301,19 @@ static const struct berlin_desc_group berlin2q_sysmgr_pinctrl_groups[] = { /* GSM */ BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS0n */ BERLIN_PINCTRL_FUNCTION(0x2, "eth1")), BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS1n */ BERLIN_PINCTRL_FUNCTION(0x2, "eth1")), BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS2n/SS3n */ BERLIN_PINCTRL_FUNCTION(0x2, "eddc")), BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), - BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), + BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* CLK/SDO */ BERLIN_PINCTRL_FUNCTION(0x2, "eddc")), BERLIN_PINCTRL_GROUP("GSM4", 0x40, 0x1, 0x08, BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), @@ -380,11 +380,11 @@ static const struct berlin_pinctrl_desc berlin2q_sysmgr_pinctrl_data = { static const struct of_device_id berlin2q_pinctrl_match[] = { { - .compatible = "marvell,berlin2q-chip-ctrl", + .compatible = "marvell,berlin2q-soc-pinctrl", .data = &berlin2q_soc_pinctrl_data, }, { - .compatible = "marvell,berlin2q-system-ctrl", + .compatible = "marvell,berlin2q-system-pinctrl", .data = &berlin2q_sysmgr_pinctrl_data, }, {} @@ -395,28 +395,6 @@ static int berlin2q_pinctrl_probe(struct platform_device *pdev) { const struct of_device_id *match = of_match_device(berlin2q_pinctrl_match, &pdev->dev); - struct regmap_config *rmconfig; - struct regmap *regmap; - struct resource *res; - void __iomem *base; - - rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL); - if (!rmconfig) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); - - rmconfig->reg_bits = 32, - rmconfig->val_bits = 32, - rmconfig->reg_stride = 4, - rmconfig->max_register = resource_size(res); - - regmap = devm_regmap_init_mmio(&pdev->dev, base, rmconfig); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); return berlin_pinctrl_probe(pdev, match->data); } diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c index 7f0b0f932..f49580617 100644 --- a/drivers/pinctrl/berlin/berlin.c +++ b/drivers/pinctrl/berlin/berlin.c @@ -11,6 +11,7 @@ */ #include <linux/io.h> +#include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> @@ -295,13 +296,15 @@ int berlin_pinctrl_probe(struct platform_device *pdev, const struct berlin_pinctrl_desc *desc) { struct device *dev = &pdev->dev; + struct device_node *parent_np = of_get_parent(dev->of_node); struct berlin_pinctrl *pctrl; struct regmap *regmap; int ret; - regmap = dev_get_regmap(&pdev->dev, NULL); - if (!regmap) - return -ENODEV; + regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); if (!pctrl) @@ -320,9 +323,9 @@ int berlin_pinctrl_probe(struct platform_device *pdev, } pctrl->pctrl_dev = pinctrl_register(&berlin_pctrl_desc, dev, pctrl); - if (!pctrl->pctrl_dev) { + if (IS_ERR(pctrl->pctrl_dev)) { dev_err(dev, "failed to register pinctrl driver\n"); - return -EINVAL; + return PTR_ERR(pctrl->pctrl_dev); } return 0; |