mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
gdsys: drivers: Add gdsys_rxaui_ctrl driver
Add a driver for RXAUI control on IHS FPGAs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
f0bcbe6c18
commit
86da8c12ef
3 changed files with 82 additions and 1 deletions
|
@ -263,5 +263,9 @@ config SYS_I2C_EEPROM_ADDR_OVERFLOW
|
|||
|
||||
endif
|
||||
|
||||
|
||||
config GDSYS_RXAUI_CTRL
|
||||
bool "Enable gdsys RXAUI control driver"
|
||||
depends on MISC
|
||||
help
|
||||
Support gdsys FPGA's RXAUI control.
|
||||
endmenu
|
||||
|
|
|
@ -52,3 +52,4 @@ obj-$(CONFIG_QFW) += qfw.o
|
|||
obj-$(CONFIG_ROCKCHIP_EFUSE) += rockchip-efuse.o
|
||||
obj-$(CONFIG_STM32_RCC) += stm32_rcc.o
|
||||
obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o
|
||||
obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
|
||||
|
|
76
drivers/misc/gdsys_rxaui_ctrl.c
Normal file
76
drivers/misc/gdsys_rxaui_ctrl.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* (C) Copyright 2015
|
||||
* Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
|
||||
*
|
||||
* (C) Copyright 2017
|
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <regmap.h>
|
||||
#include <misc.h>
|
||||
|
||||
struct gdsys_rxaui_ctrl_regs {
|
||||
u16 gen_cnt;
|
||||
u16 err_cnt;
|
||||
u16 succ_cnt;
|
||||
u16 status;
|
||||
u16 ctrl_0;
|
||||
u16 ctrl_1;
|
||||
};
|
||||
|
||||
#define rxaui_ctrl_set(map, member, val) \
|
||||
regmap_set(map, struct gdsys_rxaui_ctrl_regs, member, val)
|
||||
|
||||
#define rxaui_ctrl_get(map, member, valp) \
|
||||
regmap_get(map, struct gdsys_rxaui_ctrl_regs, member, valp)
|
||||
|
||||
struct gdsys_rxaui_ctrl_priv {
|
||||
struct regmap *map;
|
||||
};
|
||||
|
||||
int gdsys_rxaui_set_polarity_inversion(struct udevice *dev, bool val)
|
||||
{
|
||||
struct gdsys_rxaui_ctrl_priv *priv = dev_get_priv(dev);
|
||||
u16 state;
|
||||
|
||||
rxaui_ctrl_get(priv->map, ctrl_1, &state);
|
||||
|
||||
if (val)
|
||||
state |= ~0x7800;
|
||||
else
|
||||
state &= ~0x7800;
|
||||
|
||||
rxaui_ctrl_set(priv->map, ctrl_1, state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct misc_ops gdsys_rxaui_ctrl_ops = {
|
||||
.set_enabled = gdsys_rxaui_set_polarity_inversion,
|
||||
};
|
||||
|
||||
int gdsys_rxaui_ctrl_probe(struct udevice *dev)
|
||||
{
|
||||
struct gdsys_rxaui_ctrl_priv *priv = dev_get_priv(dev);
|
||||
|
||||
regmap_init_mem(dev, &priv->map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct udevice_id gdsys_rxaui_ctrl_ids[] = {
|
||||
{ .compatible = "gdsys,rxaui_ctrl" },
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(gdsys_rxaui_ctrl) = {
|
||||
.name = "gdsys_rxaui_ctrl",
|
||||
.id = UCLASS_MISC,
|
||||
.ops = &gdsys_rxaui_ctrl_ops,
|
||||
.of_match = gdsys_rxaui_ctrl_ids,
|
||||
.probe = gdsys_rxaui_ctrl_probe,
|
||||
.priv_auto_alloc_size = sizeof(struct gdsys_rxaui_ctrl_priv),
|
||||
};
|
Loading…
Add table
Reference in a new issue