Lines Matching +full:mem +full:- +full:base
1 // SPDX-License-Identifier: GPL-2.0-only
14 #include "mcb-internal.h"
18 struct resource *mem; member
19 void __iomem *base; member
28 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in mcb_lpc_probe()
30 return -ENOMEM; in mcb_lpc_probe()
32 priv->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); in mcb_lpc_probe()
33 if (!priv->mem) { in mcb_lpc_probe()
34 dev_err(&pdev->dev, "No Memory resource\n"); in mcb_lpc_probe()
35 return -ENODEV; in mcb_lpc_probe()
38 res = devm_request_mem_region(&pdev->dev, priv->mem->start, in mcb_lpc_probe()
39 resource_size(priv->mem), in mcb_lpc_probe()
42 dev_err(&pdev->dev, "Failed to request IO memory\n"); in mcb_lpc_probe()
43 return -EBUSY; in mcb_lpc_probe()
46 priv->base = devm_ioremap(&pdev->dev, priv->mem->start, in mcb_lpc_probe()
47 resource_size(priv->mem)); in mcb_lpc_probe()
48 if (!priv->base) { in mcb_lpc_probe()
49 dev_err(&pdev->dev, "Cannot ioremap\n"); in mcb_lpc_probe()
50 return -ENOMEM; in mcb_lpc_probe()
55 priv->bus = mcb_alloc_bus(&pdev->dev); in mcb_lpc_probe()
56 if (IS_ERR(priv->bus)) in mcb_lpc_probe()
57 return PTR_ERR(priv->bus); in mcb_lpc_probe()
59 ret = chameleon_parse_cells(priv->bus, priv->mem->start, priv->base); in mcb_lpc_probe()
68 devm_iounmap(&pdev->dev, priv->base); in mcb_lpc_probe()
69 devm_release_mem_region(&pdev->dev, priv->mem->start, resource_size(priv->mem)); in mcb_lpc_probe()
72 res = devm_request_mem_region(&pdev->dev, priv->mem->start, in mcb_lpc_probe()
76 dev_err(&pdev->dev, "Failed to request PCI memory\n"); in mcb_lpc_probe()
77 ret = -EBUSY; in mcb_lpc_probe()
81 priv->base = devm_ioremap(&pdev->dev, priv->mem->start, table_size); in mcb_lpc_probe()
82 if (!priv->base) { in mcb_lpc_probe()
83 dev_err(&pdev->dev, "Cannot ioremap\n"); in mcb_lpc_probe()
84 ret = -ENOMEM; in mcb_lpc_probe()
91 mcb_bus_add_devices(priv->bus); in mcb_lpc_probe()
96 mcb_release_bus(priv->bus); in mcb_lpc_probe()
104 mcb_release_bus(priv->bus); in mcb_lpc_remove()
111 struct resource *res = id->driver_data; in mcb_lpc_create_platform_device()
114 mcb_lpc_pdev = platform_device_alloc("mcb-lpc", -1); in mcb_lpc_create_platform_device()
116 return -ENOMEM; in mcb_lpc_create_platform_device()
138 .name = "mcb-lpc",
170 return -ENODEV; in mcb_lpc_init()