Lines Matching full:ocelot
3 * Microsemi Ocelot Switch driver
11 #include "ocelot.h"
13 int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, in __ocelot_bulk_read_ix() argument
19 ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); in __ocelot_bulk_read_ix()
22 return regmap_bulk_read(ocelot->targets[target], addr + offset, in __ocelot_bulk_read_ix()
27 u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset) in __ocelot_read_ix() argument
32 ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); in __ocelot_read_ix()
35 regmap_read(ocelot->targets[target], addr + offset, &val); in __ocelot_read_ix()
40 void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg, in __ocelot_write_ix() argument
46 ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); in __ocelot_write_ix()
49 regmap_write(ocelot->targets[target], addr + offset, val); in __ocelot_write_ix()
53 void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, in __ocelot_rmw_ix() argument
59 ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); in __ocelot_rmw_ix()
62 regmap_update_bits(ocelot->targets[target], addr + offset, mask, val); in __ocelot_rmw_ix()
68 struct ocelot *ocelot = port->ocelot; in ocelot_port_readl() local
74 regmap_read(port->target, ocelot->map[target][reg & REG_MASK], &val); in ocelot_port_readl()
81 struct ocelot *ocelot = port->ocelot; in ocelot_port_writel() local
86 regmap_write(port->target, ocelot->map[target][reg & REG_MASK], val); in ocelot_port_writel()
99 u32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target, in __ocelot_target_read_ix() argument
104 regmap_read(ocelot->targets[target], in __ocelot_target_read_ix()
105 ocelot->map[target][reg] + offset, &val); in __ocelot_target_read_ix()
109 void __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target, in __ocelot_target_write_ix() argument
112 regmap_write(ocelot->targets[target], in __ocelot_target_write_ix()
113 ocelot->map[target][reg] + offset, val); in __ocelot_target_write_ix()
116 int ocelot_regfields_init(struct ocelot *ocelot, in ocelot_regfields_init() argument
131 regfield.reg = ocelot->map[target][reg & REG_MASK]; in ocelot_regfields_init()
137 ocelot->regfields[i] = in ocelot_regfields_init()
138 devm_regmap_field_alloc(ocelot->dev, in ocelot_regfields_init()
139 ocelot->targets[target], in ocelot_regfields_init()
142 if (IS_ERR(ocelot->regfields[i])) in ocelot_regfields_init()
143 return PTR_ERR(ocelot->regfields[i]); in ocelot_regfields_init()
156 struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res) in ocelot_regmap_init() argument
160 regs = devm_ioremap_resource(ocelot->dev, res); in ocelot_regmap_init()
166 return devm_regmap_init_mmio(ocelot->dev, regs, &ocelot_regmap_config); in ocelot_regmap_init()