1 From 68e332146b6f0a1d2a4514810986a7cf3c3117e3 Mon Sep 17 00:00:00 2001
2 From: Pankaj Bansal <pankaj.bansal@nxp.com>
3 Date: Thu, 28 Feb 2019 17:22:28 +0530
4 Subject: [PATCH] drivers: soc: fsl: add qixis driver
6 FPGA on LX2160AQDS/LX2160ARDB connected on I2C bus, so add qixis driver
7 which is basically an i2c client driver to control FPGA.
9 Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
11 drivers/soc/fsl/Kconfig | 11 +++++
12 drivers/soc/fsl/Makefile | 1 +
13 drivers/soc/fsl/qixis_ctrl.c | 105 +++++++++++++++++++++++++++++++++++++++++++
14 3 files changed, 117 insertions(+)
15 create mode 100644 drivers/soc/fsl/qixis_ctrl.c
17 --- a/drivers/soc/fsl/Kconfig
18 +++ b/drivers/soc/fsl/Kconfig
19 @@ -40,4 +40,15 @@ config DPAA2_CONSOLE
20 /dev/dpaa2_mc_console and /dev/dpaa2_aiop_console,
21 which can be used to dump the Management Complex and AIOP
25 + tristate "QIXIS system controller driver"
31 + Say y here to enable QIXIS system controller api. The qixis driver
32 + provides FPGA functions to control system.
35 --- a/drivers/soc/fsl/Makefile
36 +++ b/drivers/soc/fsl/Makefile
38 obj-$(CONFIG_FSL_DPAA) += qbman/
39 obj-$(CONFIG_QUICC_ENGINE) += qe/
40 obj-$(CONFIG_CPM) += qe/
41 +obj-$(CONFIG_FSL_QIXIS) += qixis_ctrl.o
42 obj-$(CONFIG_FSL_GUTS) += guts.o
43 obj-$(CONFIG_FSL_MC_DPIO) += dpio/
44 obj-$(CONFIG_DPAA2_CONSOLE) += dpaa2-console.o
46 +++ b/drivers/soc/fsl/qixis_ctrl.c
48 +// SPDX-License-Identifier: GPL-2.0+
50 +/* Freescale QIXIS system controller driver.
52 + * Copyright 2015 Freescale Semiconductor, Inc.
53 + * Copyright 2018-2019 NXP
56 +#include <linux/err.h>
57 +#include <linux/i2c.h>
58 +#include <linux/module.h>
59 +#include <linux/mfd/core.h>
60 +#include <linux/of.h>
61 +#include <linux/regmap.h>
64 +struct fsl_qixis_regs {
65 + u8 id; /* Identification Registers */
66 + u8 version; /* Version Register */
67 + u8 qixis_ver; /* QIXIS Version Register */
72 + struct regmap *regmap;
75 +static struct regmap_config qixis_regmap_config = {
80 +static const struct mfd_cell fsl_qixis_devs[] = {
83 + .of_compatible = "reg-mux",
87 +static int fsl_qixis_i2c_probe(struct i2c_client *client)
89 + struct qixis_priv *priv;
93 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
96 + priv = devm_kzalloc(&client->dev, sizeof(struct qixis_priv),
101 + priv->regmap = regmap_init_i2c(client, &qixis_regmap_config);
102 + regmap_read(priv->regmap, offsetof(struct fsl_qixis_regs, qixis_ver),
104 + pr_info("Freescale QIXIS Version: 0x%08x\n", qver);
106 + i2c_set_clientdata(client, priv);
108 + if (of_device_is_compatible(client->dev.of_node, "simple-mfd"))
109 + ret = devm_mfd_add_devices(&client->dev, -1, fsl_qixis_devs,
110 + ARRAY_SIZE(fsl_qixis_devs), NULL, 0,
117 + regmap_exit(priv->regmap);
122 +static int fsl_qixis_i2c_remove(struct i2c_client *client)
124 + struct qixis_priv *priv;
126 + priv = i2c_get_clientdata(client);
127 + regmap_exit(priv->regmap);
132 +static const struct of_device_id fsl_qixis_i2c_of_match[] = {
133 + { .compatible = "fsl,fpga-qixis-i2c" },
136 +MODULE_DEVICE_TABLE(of, fsl_qixis_i2c_of_match);
138 +static struct i2c_driver fsl_qixis_i2c_driver = {
140 + .name = "qixis_ctrl_i2c",
141 + .owner = THIS_MODULE,
142 + .of_match_table = of_match_ptr(fsl_qixis_i2c_of_match),
144 + .probe_new = fsl_qixis_i2c_probe,
145 + .remove = fsl_qixis_i2c_remove,
147 +module_i2c_driver(fsl_qixis_i2c_driver);
149 +MODULE_AUTHOR("Wang Dongsheng <dongsheng.wang@freescale.com>");
150 +MODULE_DESCRIPTION("Freescale QIXIS system controller driver");
151 +MODULE_LICENSE("GPL");