Lines Matching +full:rc +full:- +full:map +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0
7 #define pr_fmt(fmt) "nuvoton-kcs-bmc: " fmt
22 #define DEVICE_NAME "npcm-kcs-bmc"
51 * Registers in this module are 8 bits. An 8-bit register must be accessed
52 * by an 8-bit read or write.
71 struct regmap *map; member
91 int rc; in npcm7xx_kcs_inb() local
93 rc = regmap_read(priv->map, reg, &val); in npcm7xx_kcs_inb()
94 WARN(rc != 0, "regmap_read() failed: %d\n", rc); in npcm7xx_kcs_inb()
96 return rc == 0 ? (u8)val : 0; in npcm7xx_kcs_inb()
102 int rc; in npcm7xx_kcs_outb() local
104 rc = regmap_write(priv->map, reg, data); in npcm7xx_kcs_outb()
105 WARN(rc != 0, "regmap_write() failed: %d\n", rc); in npcm7xx_kcs_outb()
111 int rc; in npcm7xx_kcs_updateb() local
113 rc = regmap_update_bits(priv->map, reg, mask, data); in npcm7xx_kcs_updateb()
114 WARN(rc != 0, "regmap_update_bits() failed: %d\n", rc); in npcm7xx_kcs_updateb()
121 regmap_update_bits(priv->map, priv->reg->ie, KCS_IE_IRQE | KCS_IE_HIRQE, in npcm7xx_kcs_enable_channel()
130 regmap_update_bits(priv->map, priv->reg->ctl, KCS_CTL_OBEIE, in npcm7xx_kcs_irq_mask_update()
134 regmap_update_bits(priv->map, priv->reg->ctl, KCS_CTL_IBFIE, in npcm7xx_kcs_irq_mask_update()
148 struct device *dev = &pdev->dev; in npcm7xx_kcs_config_irq()
168 struct device *dev = &pdev->dev; in npcm7xx_kcs_probe()
172 int rc; in npcm7xx_kcs_probe() local
174 rc = of_property_read_u32(dev->of_node, "kcs_chan", &chan); in npcm7xx_kcs_probe()
175 if (rc != 0 || chan == 0 || chan > KCS_CHANNEL_MAX) { in npcm7xx_kcs_probe()
177 return -ENODEV; in npcm7xx_kcs_probe()
180 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in npcm7xx_kcs_probe()
182 return -ENOMEM; in npcm7xx_kcs_probe()
184 priv->map = syscon_node_to_regmap(dev->parent->of_node); in npcm7xx_kcs_probe()
185 if (IS_ERR(priv->map)) { in npcm7xx_kcs_probe()
187 return -ENODEV; in npcm7xx_kcs_probe()
189 priv->reg = &npcm7xx_kcs_reg_tbl[chan - 1]; in npcm7xx_kcs_probe()
191 kcs_bmc = &priv->kcs_bmc; in npcm7xx_kcs_probe()
192 kcs_bmc->dev = &pdev->dev; in npcm7xx_kcs_probe()
193 kcs_bmc->channel = chan; in npcm7xx_kcs_probe()
194 kcs_bmc->ioreg.idr = priv->reg->dib; in npcm7xx_kcs_probe()
195 kcs_bmc->ioreg.odr = priv->reg->dob; in npcm7xx_kcs_probe()
196 kcs_bmc->ioreg.str = priv->reg->sts; in npcm7xx_kcs_probe()
197 kcs_bmc->ops = &npcm7xx_kcs_ops; in npcm7xx_kcs_probe()
201 rc = npcm7xx_kcs_config_irq(kcs_bmc, pdev); in npcm7xx_kcs_probe()
202 if (rc) in npcm7xx_kcs_probe()
203 return rc; in npcm7xx_kcs_probe()
208 rc = kcs_bmc_add_device(kcs_bmc); in npcm7xx_kcs_probe()
209 if (rc) { in npcm7xx_kcs_probe()
210 dev_warn(&pdev->dev, "Failed to register channel %d: %d\n", kcs_bmc->channel, rc); in npcm7xx_kcs_probe()
211 return rc; in npcm7xx_kcs_probe()
216 kcs_bmc->ioreg.idr, kcs_bmc->ioreg.odr, kcs_bmc->ioreg.str); in npcm7xx_kcs_probe()
224 struct kcs_bmc_device *kcs_bmc = &priv->kcs_bmc; in npcm7xx_kcs_remove()
233 { .compatible = "nuvoton,npcm750-kcs-bmc" },
240 .name = DEVICE_NAME,