Lines Matching +full:ast2500 +full:- +full:lpc +full:- +full:host

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2015-2018, Intel Corporation.
6 #define pr_fmt(fmt) "aspeed-kcs-bmc: " fmt
26 #define DEVICE_NAME "ast-kcs-bmc"
30 /* mapped to lpc-bmc@0 IO space */
56 /* mapped to lpc-host@80 IO space */
76 rc = regmap_read(priv->map, reg, &val); in aspeed_kcs_inb()
87 rc = regmap_write(priv->map, reg, data); in aspeed_kcs_outb()
109 switch (kcs_bmc->channel) { in aspeed_kcs_set_address()
111 regmap_update_bits(priv->map, LPC_HICR4, in aspeed_kcs_set_address()
113 regmap_write(priv->map, LPC_LADR12H, addr >> 8); in aspeed_kcs_set_address()
114 regmap_write(priv->map, LPC_LADR12L, addr & 0xFF); in aspeed_kcs_set_address()
118 regmap_update_bits(priv->map, LPC_HICR4, in aspeed_kcs_set_address()
120 regmap_write(priv->map, LPC_LADR12H, addr >> 8); in aspeed_kcs_set_address()
121 regmap_write(priv->map, LPC_LADR12L, addr & 0xFF); in aspeed_kcs_set_address()
125 regmap_write(priv->map, LPC_LADR3H, addr >> 8); in aspeed_kcs_set_address()
126 regmap_write(priv->map, LPC_LADR3L, addr & 0xFF); in aspeed_kcs_set_address()
130 regmap_write(priv->map, LPC_LADR4, ((addr + 1) << 16) | in aspeed_kcs_set_address()
143 switch (kcs_bmc->channel) { in aspeed_kcs_enable_channel()
146 regmap_update_bits(priv->map, LPC_HICR2, in aspeed_kcs_enable_channel()
148 regmap_update_bits(priv->map, LPC_HICR0, in aspeed_kcs_enable_channel()
151 regmap_update_bits(priv->map, LPC_HICR0, in aspeed_kcs_enable_channel()
153 regmap_update_bits(priv->map, LPC_HICR2, in aspeed_kcs_enable_channel()
160 regmap_update_bits(priv->map, LPC_HICR2, in aspeed_kcs_enable_channel()
162 regmap_update_bits(priv->map, LPC_HICR0, in aspeed_kcs_enable_channel()
165 regmap_update_bits(priv->map, LPC_HICR0, in aspeed_kcs_enable_channel()
167 regmap_update_bits(priv->map, LPC_HICR2, in aspeed_kcs_enable_channel()
174 regmap_update_bits(priv->map, LPC_HICR2, in aspeed_kcs_enable_channel()
176 regmap_update_bits(priv->map, LPC_HICR0, in aspeed_kcs_enable_channel()
178 regmap_update_bits(priv->map, LPC_HICR4, in aspeed_kcs_enable_channel()
181 regmap_update_bits(priv->map, LPC_HICR0, in aspeed_kcs_enable_channel()
183 regmap_update_bits(priv->map, LPC_HICR4, in aspeed_kcs_enable_channel()
185 regmap_update_bits(priv->map, LPC_HICR2, in aspeed_kcs_enable_channel()
192 regmap_update_bits(priv->map, LPC_HICRB, in aspeed_kcs_enable_channel()
196 regmap_update_bits(priv->map, LPC_HICRB, in aspeed_kcs_enable_channel()
219 struct device *dev = &pdev->dev; in aspeed_kcs_config_irq()
246 np = pdev->dev.of_node; in aspeed_kcs_probe_of_v1()
250 dev_err(&pdev->dev, "no valid 'kcs_chan' configured\n"); in aspeed_kcs_probe_of_v1()
251 return ERR_PTR(-EINVAL); in aspeed_kcs_probe_of_v1()
254 kcs = kcs_bmc_alloc(&pdev->dev, sizeof(struct aspeed_kcs_bmc), channel); in aspeed_kcs_probe_of_v1()
256 return ERR_PTR(-ENOMEM); in aspeed_kcs_probe_of_v1()
259 priv->map = syscon_node_to_regmap(pdev->dev.parent->of_node); in aspeed_kcs_probe_of_v1()
260 if (IS_ERR(priv->map)) { in aspeed_kcs_probe_of_v1()
261 dev_err(&pdev->dev, "Couldn't get regmap\n"); in aspeed_kcs_probe_of_v1()
262 return ERR_PTR(-ENODEV); in aspeed_kcs_probe_of_v1()
267 dev_err(&pdev->dev, "no valid 'kcs_addr' configured\n"); in aspeed_kcs_probe_of_v1()
268 return ERR_PTR(-EINVAL); in aspeed_kcs_probe_of_v1()
271 kcs->ioreg = ast_kcs_bmc_ioregs[channel - 1]; in aspeed_kcs_probe_of_v1()
286 return -EINVAL; in aspeed_kcs_calculate_channel()
300 np = pdev->dev.of_node; in aspeed_kcs_probe_of_v2()
305 return ERR_PTR(-EINVAL); in aspeed_kcs_probe_of_v2()
310 return ERR_PTR(-EINVAL); in aspeed_kcs_probe_of_v2()
315 return ERR_PTR(-EINVAL); in aspeed_kcs_probe_of_v2()
322 kcs = kcs_bmc_alloc(&pdev->dev, sizeof(struct aspeed_kcs_bmc), channel); in aspeed_kcs_probe_of_v2()
324 return ERR_PTR(-ENOMEM); in aspeed_kcs_probe_of_v2()
326 kcs->ioreg = ioreg; in aspeed_kcs_probe_of_v2()
329 priv->map = syscon_node_to_regmap(pdev->dev.parent->of_node); in aspeed_kcs_probe_of_v2()
330 if (IS_ERR(priv->map)) { in aspeed_kcs_probe_of_v2()
331 dev_err(&pdev->dev, "Couldn't get regmap\n"); in aspeed_kcs_probe_of_v2()
332 return ERR_PTR(-ENODEV); in aspeed_kcs_probe_of_v2()
335 rc = of_property_read_u32(np, "aspeed,lpc-io-reg", &slave); in aspeed_kcs_probe_of_v2()
346 struct device *dev = &pdev->dev; in aspeed_kcs_probe()
351 np = pdev->dev.of_node; in aspeed_kcs_probe()
352 if (of_device_is_compatible(np, "aspeed,ast2400-kcs-bmc") || in aspeed_kcs_probe()
353 of_device_is_compatible(np, "aspeed,ast2500-kcs-bmc")) in aspeed_kcs_probe()
355 else if (of_device_is_compatible(np, "aspeed,ast2400-kcs-bmc-v2") || in aspeed_kcs_probe()
356 of_device_is_compatible(np, "aspeed,ast2500-kcs-bmc-v2")) in aspeed_kcs_probe()
359 return -EINVAL; in aspeed_kcs_probe()
364 kcs_bmc->io_inputb = aspeed_kcs_inb; in aspeed_kcs_probe()
365 kcs_bmc->io_outputb = aspeed_kcs_outb; in aspeed_kcs_probe()
375 rc = misc_register(&kcs_bmc->miscdev); in aspeed_kcs_probe()
381 dev_dbg(&pdev->dev, in aspeed_kcs_probe()
383 kcs_bmc->channel, kcs_bmc->ioreg.idr, kcs_bmc->ioreg.odr, in aspeed_kcs_probe()
384 kcs_bmc->ioreg.str); in aspeed_kcs_probe()
391 struct kcs_bmc *kcs_bmc = dev_get_drvdata(&pdev->dev); in aspeed_kcs_remove()
393 misc_deregister(&kcs_bmc->miscdev); in aspeed_kcs_remove()
399 { .compatible = "aspeed,ast2400-kcs-bmc" },
400 { .compatible = "aspeed,ast2500-kcs-bmc" },
401 { .compatible = "aspeed,ast2400-kcs-bmc-v2" },
402 { .compatible = "aspeed,ast2500-kcs-bmc-v2" },