mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-27 06:50:37 +00:00

Microchip Azurite ZL3073x represents chip family providing DPLL and optionally PHC (PTP) functionality. The chips can be connected be connected over I2C or SPI bus. They have the following characteristics: * up to 5 separate DPLL units (channels) * 5 synthesizers * 10 input pins (references) * 10 outputs * 20 output pins (output pin pair shares one output) * Each reference and output can operate in either differential or single-ended mode (differential mode uses 2 pins) * Each output is connected to one of the synthesizers * Each synthesizer is driven by one of the DPLL unit The device uses 7-bit addresses and 8-bits values. It exposes 8-, 16-, 32- and 48-bits registers in address range <0x000,0x77F>. Due to 7bit addressing, the range is organized into pages of 128 bytes, with each page containing a page selector register at address 0x7F. For reading/writing multi-byte registers, the device supports bulk transfers. Add basic functionality to access device registers, probe functionality both I2C and SPI cases and add devlink support to provide info and to set clock ID parameter. Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Link: https://patch.msgid.link/20250704182202.1641943-6-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
77 lines
2.0 KiB
C
77 lines
2.0 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#include <linux/dev_printk.h>
|
|
#include <linux/err.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include "core.h"
|
|
|
|
static int zl3073x_spi_probe(struct spi_device *spi)
|
|
{
|
|
struct device *dev = &spi->dev;
|
|
struct zl3073x_dev *zldev;
|
|
|
|
zldev = zl3073x_devm_alloc(dev);
|
|
if (IS_ERR(zldev))
|
|
return PTR_ERR(zldev);
|
|
|
|
zldev->regmap = devm_regmap_init_spi(spi, &zl3073x_regmap_config);
|
|
if (IS_ERR(zldev->regmap))
|
|
return dev_err_probe(dev, PTR_ERR(zldev->regmap),
|
|
"Failed to initialize regmap\n");
|
|
|
|
return zl3073x_dev_probe(zldev, spi_get_device_match_data(spi));
|
|
}
|
|
|
|
static const struct spi_device_id zl3073x_spi_id[] = {
|
|
{
|
|
.name = "zl30731",
|
|
.driver_data = (kernel_ulong_t)&zl30731_chip_info
|
|
},
|
|
{
|
|
.name = "zl30732",
|
|
.driver_data = (kernel_ulong_t)&zl30732_chip_info,
|
|
},
|
|
{
|
|
.name = "zl30733",
|
|
.driver_data = (kernel_ulong_t)&zl30733_chip_info,
|
|
},
|
|
{
|
|
.name = "zl30734",
|
|
.driver_data = (kernel_ulong_t)&zl30734_chip_info,
|
|
},
|
|
{
|
|
.name = "zl30735",
|
|
.driver_data = (kernel_ulong_t)&zl30735_chip_info,
|
|
},
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(spi, zl3073x_spi_id);
|
|
|
|
static const struct of_device_id zl3073x_spi_of_match[] = {
|
|
{ .compatible = "microchip,zl30731", .data = &zl30731_chip_info },
|
|
{ .compatible = "microchip,zl30732", .data = &zl30732_chip_info },
|
|
{ .compatible = "microchip,zl30733", .data = &zl30733_chip_info },
|
|
{ .compatible = "microchip,zl30734", .data = &zl30734_chip_info },
|
|
{ .compatible = "microchip,zl30735", .data = &zl30735_chip_info },
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, zl3073x_spi_of_match);
|
|
|
|
static struct spi_driver zl3073x_spi_driver = {
|
|
.driver = {
|
|
.name = "zl3073x-spi",
|
|
.of_match_table = zl3073x_spi_of_match,
|
|
},
|
|
.probe = zl3073x_spi_probe,
|
|
.id_table = zl3073x_spi_id,
|
|
};
|
|
module_spi_driver(zl3073x_spi_driver);
|
|
|
|
MODULE_AUTHOR("Ivan Vecera <ivecera@redhat.com>");
|
|
MODULE_DESCRIPTION("Microchip ZL3073x SPI driver");
|
|
MODULE_IMPORT_NS("ZL3073X");
|
|
MODULE_LICENSE("GPL");
|