Commit 931d8c00 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'fpga-for-6.7-rc1' of...

Merge tag 'fpga-for-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga into char-misc-next

Xu writes:

FPGA Manager changes for 6.7-rc1

- Rob's change uses device_get_match_data/spi_get_device_match_data() to
get the driver match data for several drivers.
- Nava's change sets 44-bit DMA mask for versal fpga.

All patches have been reviewed on the mailing list, and have been in the
last linux-next releases (as part of our for-next branch).
Signed-off-by: default avatarXu Yilun <yilun.xu@intel.com>

* tag 'fpga-for-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga:
  fpga: versal: Add support for 44-bit DMA operations
  fpga: altera-ps-spi: Use spi_get_device_match_data()
  fpga: Use device_get_match_data()
parents 5f19ca4e d79eed22
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_platform.h> #include <linux/of.h>
#include <linux/property.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -127,18 +128,11 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev) ...@@ -127,18 +128,11 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct altera_hps2fpga_data *priv; struct altera_hps2fpga_data *priv;
const struct of_device_id *of_id;
struct fpga_bridge *br; struct fpga_bridge *br;
u32 enable; u32 enable;
int ret; int ret;
of_id = of_match_device(altera_fpga_of_match, dev); priv = (struct altera_hps2fpga_data *)device_get_match_data(dev);
if (!of_id) {
dev_err(dev, "failed to match device\n");
return -ENODEV;
}
priv = (struct altera_hps2fpga_data *)of_id->data;
priv->bridge_reset = of_reset_control_get_exclusive_by_index(dev->of_node, priv->bridge_reset = of_reset_control_get_exclusive_by_index(dev->of_node,
0); 0);
......
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
#include <linux/fpga/fpga-mgr.h> #include <linux/fpga/fpga-mgr.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_gpio.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/sizes.h> #include <linux/sizes.h>
...@@ -72,12 +71,6 @@ static struct altera_ps_data a10_data = { ...@@ -72,12 +71,6 @@ static struct altera_ps_data a10_data = {
.t_st2ck_us = 10, /* min(t_ST2CK) */ .t_st2ck_us = 10, /* min(t_ST2CK) */
}; };
/* Array index is enum altera_ps_devtype */
static const struct altera_ps_data *altera_ps_data_map[] = {
&c5_data,
&a10_data,
};
static const struct of_device_id of_ef_match[] = { static const struct of_device_id of_ef_match[] = {
{ .compatible = "altr,fpga-passive-serial", .data = &c5_data }, { .compatible = "altr,fpga-passive-serial", .data = &c5_data },
{ .compatible = "altr,fpga-arria10-passive-serial", .data = &a10_data }, { .compatible = "altr,fpga-arria10-passive-serial", .data = &a10_data },
...@@ -237,43 +230,16 @@ static const struct fpga_manager_ops altera_ps_ops = { ...@@ -237,43 +230,16 @@ static const struct fpga_manager_ops altera_ps_ops = {
.write_complete = altera_ps_write_complete, .write_complete = altera_ps_write_complete,
}; };
static const struct altera_ps_data *id_to_data(const struct spi_device_id *id)
{
kernel_ulong_t devtype = id->driver_data;
const struct altera_ps_data *data;
/* someone added a altera_ps_devtype without adding to the map array */
if (devtype >= ARRAY_SIZE(altera_ps_data_map))
return NULL;
data = altera_ps_data_map[devtype];
if (!data || data->devtype != devtype)
return NULL;
return data;
}
static int altera_ps_probe(struct spi_device *spi) static int altera_ps_probe(struct spi_device *spi)
{ {
struct altera_ps_conf *conf; struct altera_ps_conf *conf;
const struct of_device_id *of_id;
struct fpga_manager *mgr; struct fpga_manager *mgr;
conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL); conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL);
if (!conf) if (!conf)
return -ENOMEM; return -ENOMEM;
if (spi->dev.of_node) { conf->data = spi_get_device_match_data(spi);
of_id = of_match_device(of_ef_match, &spi->dev);
if (!of_id)
return -ENODEV;
conf->data = of_id->data;
} else {
conf->data = id_to_data(spi_get_device_id(spi));
if (!conf->data)
return -ENODEV;
}
conf->spi = spi; conf->spi = spi;
conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_LOW); conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_LOW);
if (IS_ERR(conf->config)) { if (IS_ERR(conf->config)) {
...@@ -308,9 +274,9 @@ static int altera_ps_probe(struct spi_device *spi) ...@@ -308,9 +274,9 @@ static int altera_ps_probe(struct spi_device *spi)
} }
static const struct spi_device_id altera_ps_spi_ids[] = { static const struct spi_device_id altera_ps_spi_ids[] = {
{ "cyclone-ps-spi", CYCLONE5 }, { "cyclone-ps-spi", (uintptr_t)&c5_data },
{ "fpga-passive-serial", CYCLONE5 }, { "fpga-passive-serial", (uintptr_t)&c5_data },
{ "fpga-arria10-passive-serial", ARRIA10 }, { "fpga-arria10-passive-serial", (uintptr_t)&a10_data },
{} {}
}; };
MODULE_DEVICE_TABLE(spi, altera_ps_spi_ids); MODULE_DEVICE_TABLE(spi, altera_ps_spi_ids);
...@@ -319,7 +285,7 @@ static struct spi_driver altera_ps_driver = { ...@@ -319,7 +285,7 @@ static struct spi_driver altera_ps_driver = {
.driver = { .driver = {
.name = "altera-ps-spi", .name = "altera-ps-spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(of_ef_match), .of_match_table = of_ef_match,
}, },
.id_table = altera_ps_spi_ids, .id_table = altera_ps_spi_ids,
.probe = altera_ps_probe, .probe = altera_ps_probe,
......
...@@ -48,7 +48,7 @@ static int versal_fpga_probe(struct platform_device *pdev) ...@@ -48,7 +48,7 @@ static int versal_fpga_probe(struct platform_device *pdev)
struct fpga_manager *mgr; struct fpga_manager *mgr;
int ret; int ret;
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
if (ret < 0) { if (ret < 0) {
dev_err(dev, "no usable DMA configuration\n"); dev_err(dev, "no usable DMA configuration\n");
return ret; return ret;
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/of_device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/fpga/fpga-bridge.h> #include <linux/fpga/fpga-bridge.h>
#define CTRL_CMD_DECOUPLE BIT(0) #define CTRL_CMD_DECOUPLE BIT(0)
...@@ -81,7 +83,6 @@ static const struct fpga_bridge_ops xlnx_pr_decoupler_br_ops = { ...@@ -81,7 +83,6 @@ static const struct fpga_bridge_ops xlnx_pr_decoupler_br_ops = {
.enable_show = xlnx_pr_decoupler_enable_show, .enable_show = xlnx_pr_decoupler_enable_show,
}; };
#ifdef CONFIG_OF
static const struct xlnx_config_data decoupler_config = { static const struct xlnx_config_data decoupler_config = {
.name = "Xilinx PR Decoupler", .name = "Xilinx PR Decoupler",
}; };
...@@ -100,11 +101,9 @@ static const struct of_device_id xlnx_pr_decoupler_of_match[] = { ...@@ -100,11 +101,9 @@ static const struct of_device_id xlnx_pr_decoupler_of_match[] = {
{}, {},
}; };
MODULE_DEVICE_TABLE(of, xlnx_pr_decoupler_of_match); MODULE_DEVICE_TABLE(of, xlnx_pr_decoupler_of_match);
#endif
static int xlnx_pr_decoupler_probe(struct platform_device *pdev) static int xlnx_pr_decoupler_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node;
struct xlnx_pr_decoupler_data *priv; struct xlnx_pr_decoupler_data *priv;
struct fpga_bridge *br; struct fpga_bridge *br;
int err; int err;
...@@ -113,13 +112,7 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev) ...@@ -113,13 +112,7 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
if (np) { priv->ipconfig = device_get_match_data(&pdev->dev);
const struct of_device_id *match;
match = of_match_node(xlnx_pr_decoupler_of_match, np);
if (match && match->data)
priv->ipconfig = match->data;
}
priv->io_base = devm_platform_ioremap_resource(pdev, 0); priv->io_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->io_base)) if (IS_ERR(priv->io_base))
...@@ -174,7 +167,7 @@ static struct platform_driver xlnx_pr_decoupler_driver = { ...@@ -174,7 +167,7 @@ static struct platform_driver xlnx_pr_decoupler_driver = {
.remove = xlnx_pr_decoupler_remove, .remove = xlnx_pr_decoupler_remove,
.driver = { .driver = {
.name = "xlnx_pr_decoupler", .name = "xlnx_pr_decoupler",
.of_match_table = of_match_ptr(xlnx_pr_decoupler_of_match), .of_match_table = xlnx_pr_decoupler_of_match,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment