/* SYSCON driver is designed to use 32-bit wide registers */ #define SYSCON_REG_SIZE (4) #define SYSCON_REG_BITS (SYSCON_REG_SIZE * 8)
/** * struct syscon_gpio_data - Configuration for the device. * @flags: Set of GPIO_SYSCON_FEAT_ flags: * GPIO_SYSCON_FEAT_IN: GPIOs supports input, * GPIO_SYSCON_FEAT_OUT: GPIOs supports output, * GPIO_SYSCON_FEAT_DIR: GPIOs supports switch direction. * @bit_count: Number of bits used as GPIOs. * @dat_bit_offset: Offset (in bits) to the first GPIO bit. * @dir_bit_offset: Optional offset (in bits) to the first bit to switch * GPIO direction (Used with GPIO_SYSCON_FEAT_DIR flag). * @set: HW specific callback to assigns output value * for signal "offset"
*/
struct syscon_gpio_data { unsignedint flags; unsignedint bit_count; unsignedint dat_bit_offset; unsignedint dir_bit_offset; int (*set)(struct gpio_chip *chip, unsignedint offset, int value);
};
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM;
priv->data = of_device_get_match_data(dev);
priv->syscon = syscon_regmap_lookup_by_phandle(np, "gpio,syscon-dev"); if (IS_ERR(priv->syscon) && np->parent) {
priv->syscon = syscon_node_to_regmap(np->parent);
use_parent_regmap = true;
} if (IS_ERR(priv->syscon)) return PTR_ERR(priv->syscon);
if (!use_parent_regmap) {
ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1,
&priv->dreg_offset); if (ret)
dev_err(dev, "can't read the data register offset!\n");
priv->dreg_offset <<= 3;
ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2,
&priv->dir_reg_offset); if (ret)
dev_dbg(dev, "can't read the dir register offset!\n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.