diff options
Diffstat (limited to 'drivers/staging/fieldbus')
7 files changed, 87 insertions, 20 deletions
diff --git a/drivers/staging/fieldbus/Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt b/drivers/staging/fieldbus/Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt new file mode 100644 index 000000000000..b1f9474f36d5 --- /dev/null +++ b/drivers/staging/fieldbus/Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt @@ -0,0 +1,71 @@ +* Arcx Anybus-S controller + +This chip communicates with the SoC over a parallel bus. It is +expected that its Device Tree node is specified as the child of a node +corresponding to the parallel bus used for communication. + +Required properties: +-------------------- + + - compatible : The following chip-specific string: + "arcx,anybus-controller" + + - reg : three areas: + index 0: bus memory area where the cpld registers are located. + index 1: bus memory area of the first host's dual-port ram. + index 2: bus memory area of the second host's dual-port ram. + + - reset-gpios : the GPIO pin connected to the reset line of the controller. + + - interrupts : two interrupts: + index 0: interrupt connected to the first host + index 1: interrupt connected to the second host + Generic interrupt client node bindings are described in + interrupt-controller/interrupts.txt + +Optional: use of subnodes +------------------------- + +The card connected to a host may need additional properties. These can be +specified in subnodes to the controller node. + +The subnodes are identified by the standard 'reg' property. Which information +exactly can be specified depends on the bindings for the function driver +for the subnode. + +Required controller node properties when using subnodes: +- #address-cells: should be one. +- #size-cells: should be zero. + +Required subnode properties: +- reg: Must contain the host index of the card this subnode describes: + <0> for the first host on the controller + <1> for the second host on the controller + Note that only a single card can be plugged into a host, so the host + index uniquely describes the card location. + +Example of usage: +----------------- + +This example places the bridge on top of the i.MX WEIM parallel bus, see: +Documentation/devicetree/bindings/bus/imx-weim.txt + +&weim { + controller@0,0 { + compatible = "arcx,anybus-controller"; + reg = <0 0 0x100>, <0 0x400000 0x800>, <1 0x400000 0x800>; + reset-gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>; + interrupt-parent = <&gpio1>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>, <5 IRQ_TYPE_LEVEL_LOW>; + /* fsl,weim-cs-timing is a i.MX WEIM bus specific property */ + fsl,weim-cs-timing = <0x024400b1 0x00001010 0x20081100 + 0x00000000 0xa0000240 0x00000000>; + /* optional subnode for a card plugged into the first host */ + #address-cells = <1>; + #size-cells = <0>; + card@0 { + reg = <0>; + /* card specific properties go here */ + }; + }; +}; diff --git a/drivers/staging/fieldbus/anybuss/anybuss-client.h b/drivers/staging/fieldbus/anybuss/anybuss-client.h index 0c4b6a1ffe10..8ee1f1baccf1 100644 --- a/drivers/staging/fieldbus/anybuss/anybuss-client.h +++ b/drivers/staging/fieldbus/anybuss/anybuss-client.h @@ -12,6 +12,9 @@ #include <linux/types.h> #include <linux/poll.h> +/* move to <linux/fieldbus_dev.h> when taking this out of staging */ +#include "../fieldbus_dev.h" + struct anybuss_host; struct anybuss_client { @@ -61,12 +64,6 @@ anybuss_set_drvdata(struct anybuss_client *client, void *data) int anybuss_set_power(struct anybuss_client *client, bool power_on); -enum anybuss_offl_mode { - AB_OFFL_MODE_CLEAR = 0, - AB_OFFL_MODE_FREEZE, - AB_OFFL_MODE_SET -}; - struct anybuss_memcfg { u16 input_io; u16 input_dpram; @@ -76,7 +73,7 @@ struct anybuss_memcfg { u16 output_dpram; u16 output_total; - enum anybuss_offl_mode offl_mode; + enum fieldbus_dev_offl_mode offl_mode; }; int anybuss_start_init(struct anybuss_client *client, diff --git a/drivers/staging/fieldbus/anybuss/arcx-anybus.c b/drivers/staging/fieldbus/anybuss/arcx-anybus.c index 2ecffa42e561..5b8d0bae9ff3 100644 --- a/drivers/staging/fieldbus/anybuss/arcx-anybus.c +++ b/drivers/staging/fieldbus/anybuss/arcx-anybus.c @@ -127,12 +127,10 @@ static const struct regmap_config arcx_regmap_cfg = { static struct regmap *create_parallel_regmap(struct platform_device *pdev, int idx) { - struct resource *res; void __iomem *base; struct device *dev = &pdev->dev; - res = platform_get_resource(pdev, IORESOURCE_MEM, idx + 1); - base = devm_ioremap_resource(dev, res); + base = devm_platform_ioremap_resource(pdev, idx + 1); if (IS_ERR(base)) return ERR_CAST(base); return devm_regmap_init_mmio(dev, base, &arcx_regmap_cfg); @@ -230,7 +228,6 @@ static int controller_probe(struct platform_device *pdev) struct regulator_config config = { }; struct regulator_dev *regulator; int err, id; - struct resource *res; struct anybuss_host *host; u8 status1, cap; @@ -244,8 +241,7 @@ static int controller_probe(struct platform_device *pdev) return PTR_ERR(cd->reset_gpiod); /* CPLD control memory, sits at index 0 */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - cd->cpld_base = devm_ioremap_resource(dev, res); + cd->cpld_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(cd->cpld_base)) { dev_err(dev, "failed to map cpld base address\n"); diff --git a/drivers/staging/fieldbus/anybuss/hms-profinet.c b/drivers/staging/fieldbus/anybuss/hms-profinet.c index 5446843e35f4..31c43a0a5776 100644 --- a/drivers/staging/fieldbus/anybuss/hms-profinet.c +++ b/drivers/staging/fieldbus/anybuss/hms-profinet.c @@ -96,7 +96,7 @@ static int __profi_enable(struct profi_priv *priv) .output_io = 220, .output_dpram = PROFI_DPRAM_SIZE, .output_total = PROFI_DPRAM_SIZE, - .offl_mode = AB_OFFL_MODE_CLEAR, + .offl_mode = FIELDBUS_DEV_OFFL_MODE_CLEAR, }; /* diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index f69dc4930457..549cb7d51af8 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1022,13 +1022,13 @@ int anybuss_start_init(struct anybuss_client *client, }; switch (cfg->offl_mode) { - case AB_OFFL_MODE_CLEAR: + case FIELDBUS_DEV_OFFL_MODE_CLEAR: op_mode = 0; break; - case AB_OFFL_MODE_FREEZE: + case FIELDBUS_DEV_OFFL_MODE_FREEZE: op_mode = OP_MODE_FBFC; break; - case AB_OFFL_MODE_SET: + case FIELDBUS_DEV_OFFL_MODE_SET: op_mode = OP_MODE_FBS; break; default: diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c index f6f5b92ba914..1ba0234cc60d 100644 --- a/drivers/staging/fieldbus/dev_core.c +++ b/drivers/staging/fieldbus/dev_core.c @@ -23,9 +23,6 @@ static dev_t fieldbus_devt; static DEFINE_IDA(fieldbus_ida); static DEFINE_MUTEX(fieldbus_mtx); -static const char ctrl_enabled[] = "enabled"; -static const char ctrl_disabled[] = "disabled"; - static ssize_t online_show(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/drivers/staging/fieldbus/fieldbus_dev.h b/drivers/staging/fieldbus/fieldbus_dev.h index a10fc3b446dc..301dca3b8d71 100644 --- a/drivers/staging/fieldbus/fieldbus_dev.h +++ b/drivers/staging/fieldbus/fieldbus_dev.h @@ -15,6 +15,12 @@ enum fieldbus_dev_type { FIELDBUS_DEV_TYPE_PROFINET, }; +enum fieldbus_dev_offl_mode { + FIELDBUS_DEV_OFFL_MODE_CLEAR = 0, + FIELDBUS_DEV_OFFL_MODE_FREEZE, + FIELDBUS_DEV_OFFL_MODE_SET +}; + /** * struct fieldbus_dev - Fieldbus device * @read_area: [DRIVER] function to read the process data area of the |