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: Xu Yilun <yilun.xu@intel.com> -----BEGIN PGP SIGNATURE----- iIkEABYIADEWIQSgSJpClIeaArXyudb8twOBpKCM2gUCZS6jVxMceWlsdW4ueHVA aW50ZWwuY29tAAoJEPy3A4GkoIzaRpABAPG7BgASy6o2BVgY0A3C3hTRYC8EgHQh UH3sSiZmVLy4AQCX5k3wAb/1Kbk2vIM6/sV/moricxnNFkpzNFR9FCgqDw== =vd9S -----END PGP SIGNATURE----- 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: Xu 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()
This commit is contained in:
commit
931d8c0087
@ -24,7 +24,8 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/spinlock.h>
|
||||
@ -127,18 +128,11 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct altera_hps2fpga_data *priv;
|
||||
const struct of_device_id *of_id;
|
||||
struct fpga_bridge *br;
|
||||
u32 enable;
|
||||
int ret;
|
||||
|
||||
of_id = of_match_device(altera_fpga_of_match, dev);
|
||||
if (!of_id) {
|
||||
dev_err(dev, "failed to match device\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
priv = (struct altera_hps2fpga_data *)of_id->data;
|
||||
priv = (struct altera_hps2fpga_data *)device_get_match_data(dev);
|
||||
|
||||
priv->bridge_reset = of_reset_control_get_exclusive_by_index(dev->of_node,
|
||||
0);
|
||||
|
@ -18,8 +18,7 @@
|
||||
#include <linux/fpga/fpga-mgr.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
@ -72,12 +71,6 @@ static struct altera_ps_data a10_data = {
|
||||
.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[] = {
|
||||
{ .compatible = "altr,fpga-passive-serial", .data = &c5_data },
|
||||
{ .compatible = "altr,fpga-arria10-passive-serial", .data = &a10_data },
|
||||
@ -237,43 +230,16 @@ static const struct fpga_manager_ops altera_ps_ops = {
|
||||
.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)
|
||||
{
|
||||
struct altera_ps_conf *conf;
|
||||
const struct of_device_id *of_id;
|
||||
struct fpga_manager *mgr;
|
||||
|
||||
conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL);
|
||||
if (!conf)
|
||||
return -ENOMEM;
|
||||
|
||||
if (spi->dev.of_node) {
|
||||
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->data = spi_get_device_match_data(spi);
|
||||
conf->spi = spi;
|
||||
conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(conf->config)) {
|
||||
@ -308,9 +274,9 @@ static int altera_ps_probe(struct spi_device *spi)
|
||||
}
|
||||
|
||||
static const struct spi_device_id altera_ps_spi_ids[] = {
|
||||
{ "cyclone-ps-spi", CYCLONE5 },
|
||||
{ "fpga-passive-serial", CYCLONE5 },
|
||||
{ "fpga-arria10-passive-serial", ARRIA10 },
|
||||
{ "cyclone-ps-spi", (uintptr_t)&c5_data },
|
||||
{ "fpga-passive-serial", (uintptr_t)&c5_data },
|
||||
{ "fpga-arria10-passive-serial", (uintptr_t)&a10_data },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, altera_ps_spi_ids);
|
||||
@ -319,7 +285,7 @@ static struct spi_driver altera_ps_driver = {
|
||||
.driver = {
|
||||
.name = "altera-ps-spi",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(of_ef_match),
|
||||
.of_match_table = of_ef_match,
|
||||
},
|
||||
.id_table = altera_ps_spi_ids,
|
||||
.probe = altera_ps_probe,
|
||||
|
@ -48,7 +48,7 @@ static int versal_fpga_probe(struct platform_device *pdev)
|
||||
struct fpga_manager *mgr;
|
||||
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) {
|
||||
dev_err(dev, "no usable DMA configuration\n");
|
||||
return ret;
|
||||
|
@ -10,8 +10,10 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/fpga/fpga-bridge.h>
|
||||
|
||||
#define CTRL_CMD_DECOUPLE BIT(0)
|
||||
@ -81,7 +83,6 @@ static const struct fpga_bridge_ops xlnx_pr_decoupler_br_ops = {
|
||||
.enable_show = xlnx_pr_decoupler_enable_show,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct xlnx_config_data decoupler_config = {
|
||||
.name = "Xilinx PR Decoupler",
|
||||
};
|
||||
@ -100,11 +101,9 @@ static const struct of_device_id 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)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct xlnx_pr_decoupler_data *priv;
|
||||
struct fpga_bridge *br;
|
||||
int err;
|
||||
@ -113,13 +112,7 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev)
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
if (np) {
|
||||
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->ipconfig = device_get_match_data(&pdev->dev);
|
||||
|
||||
priv->io_base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(priv->io_base))
|
||||
@ -174,7 +167,7 @@ static struct platform_driver xlnx_pr_decoupler_driver = {
|
||||
.remove = xlnx_pr_decoupler_remove,
|
||||
.driver = {
|
||||
.name = "xlnx_pr_decoupler",
|
||||
.of_match_table = of_match_ptr(xlnx_pr_decoupler_of_match),
|
||||
.of_match_table = xlnx_pr_decoupler_of_match,
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user