| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * lpc_sch.c - LPC interface for Intel Poulsbo SCH |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * Copyright (c) 2010 CompuLab Ltd |
|---|
| 10 | 11 | * Copyright (c) 2014 Intel Corp. |
|---|
| 11 | 12 | * Author: Denis Turischev <denis@compulab.co.il> |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | | - * it under the terms of the GNU General Public License 2 as published |
|---|
| 15 | | - * by the Free Software Foundation. |
|---|
| 16 | | - * |
|---|
| 17 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 18 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 19 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 20 | | - * GNU General Public License for more details. |
|---|
| 21 | 13 | */ |
|---|
| 22 | 14 | |
|---|
| 23 | 15 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 30 | 22 | #define SMBASE 0x40 |
|---|
| 31 | 23 | #define SMBUS_IO_SIZE 64 |
|---|
| 32 | 24 | |
|---|
| 33 | | -#define GPIOBASE 0x44 |
|---|
| 25 | +#define GPIO_BASE 0x44 |
|---|
| 34 | 26 | #define GPIO_IO_SIZE 64 |
|---|
| 35 | 27 | #define GPIO_IO_SIZE_CENTERTON 128 |
|---|
| 36 | | - |
|---|
| 37 | | -/* Intel Quark X1000 GPIO IRQ Number */ |
|---|
| 38 | | -#define GPIO_IRQ_QUARK_X1000 9 |
|---|
| 39 | 28 | |
|---|
| 40 | 29 | #define WDTBASE 0x84 |
|---|
| 41 | 30 | #define WDT_IO_SIZE 64 |
|---|
| .. | .. |
|---|
| 51 | 40 | unsigned int io_size_smbus; |
|---|
| 52 | 41 | unsigned int io_size_gpio; |
|---|
| 53 | 42 | unsigned int io_size_wdt; |
|---|
| 54 | | - int irq_gpio; |
|---|
| 55 | 43 | }; |
|---|
| 56 | 44 | |
|---|
| 57 | 45 | static struct lpc_sch_info sch_chipset_info[] = { |
|---|
| 58 | 46 | [LPC_SCH] = { |
|---|
| 59 | 47 | .io_size_smbus = SMBUS_IO_SIZE, |
|---|
| 60 | 48 | .io_size_gpio = GPIO_IO_SIZE, |
|---|
| 61 | | - .irq_gpio = -1, |
|---|
| 62 | 49 | }, |
|---|
| 63 | 50 | [LPC_ITC] = { |
|---|
| 64 | 51 | .io_size_smbus = SMBUS_IO_SIZE, |
|---|
| 65 | 52 | .io_size_gpio = GPIO_IO_SIZE, |
|---|
| 66 | 53 | .io_size_wdt = WDT_IO_SIZE, |
|---|
| 67 | | - .irq_gpio = -1, |
|---|
| 68 | 54 | }, |
|---|
| 69 | 55 | [LPC_CENTERTON] = { |
|---|
| 70 | 56 | .io_size_smbus = SMBUS_IO_SIZE, |
|---|
| 71 | 57 | .io_size_gpio = GPIO_IO_SIZE_CENTERTON, |
|---|
| 72 | 58 | .io_size_wdt = WDT_IO_SIZE, |
|---|
| 73 | | - .irq_gpio = -1, |
|---|
| 74 | 59 | }, |
|---|
| 75 | 60 | [LPC_QUARK_X1000] = { |
|---|
| 76 | 61 | .io_size_gpio = GPIO_IO_SIZE, |
|---|
| 77 | | - .irq_gpio = GPIO_IRQ_QUARK_X1000, |
|---|
| 78 | 62 | .io_size_wdt = WDT_IO_SIZE, |
|---|
| 79 | 63 | }, |
|---|
| 80 | 64 | }; |
|---|
| .. | .. |
|---|
| 121 | 105 | } |
|---|
| 122 | 106 | |
|---|
| 123 | 107 | static int lpc_sch_populate_cell(struct pci_dev *pdev, int where, |
|---|
| 124 | | - const char *name, int size, int irq, |
|---|
| 125 | | - int id, struct mfd_cell *cell) |
|---|
| 108 | + const char *name, int size, int id, |
|---|
| 109 | + struct mfd_cell *cell) |
|---|
| 126 | 110 | { |
|---|
| 127 | 111 | struct resource *res; |
|---|
| 128 | 112 | int ret; |
|---|
| 129 | 113 | |
|---|
| 130 | | - res = devm_kcalloc(&pdev->dev, 2, sizeof(*res), GFP_KERNEL); |
|---|
| 114 | + res = devm_kzalloc(&pdev->dev, sizeof(*res), GFP_KERNEL); |
|---|
| 131 | 115 | if (!res) |
|---|
| 132 | 116 | return -ENOMEM; |
|---|
| 133 | 117 | |
|---|
| .. | .. |
|---|
| 143 | 127 | cell->ignore_resource_conflicts = true; |
|---|
| 144 | 128 | cell->id = id; |
|---|
| 145 | 129 | |
|---|
| 146 | | - /* Check if we need to add an IRQ resource */ |
|---|
| 147 | | - if (irq < 0) |
|---|
| 148 | | - return 0; |
|---|
| 149 | | - |
|---|
| 150 | | - res++; |
|---|
| 151 | | - |
|---|
| 152 | | - res->start = irq; |
|---|
| 153 | | - res->end = irq; |
|---|
| 154 | | - res->flags = IORESOURCE_IRQ; |
|---|
| 155 | | - |
|---|
| 156 | | - cell->num_resources++; |
|---|
| 157 | | - |
|---|
| 158 | 130 | return 0; |
|---|
| 159 | 131 | } |
|---|
| 160 | 132 | |
|---|
| .. | .. |
|---|
| 166 | 138 | int ret; |
|---|
| 167 | 139 | |
|---|
| 168 | 140 | ret = lpc_sch_populate_cell(dev, SMBASE, "isch_smbus", |
|---|
| 169 | | - info->io_size_smbus, -1, |
|---|
| 141 | + info->io_size_smbus, |
|---|
| 170 | 142 | id->device, &lpc_sch_cells[cells]); |
|---|
| 171 | 143 | if (ret < 0) |
|---|
| 172 | 144 | return ret; |
|---|
| 173 | 145 | if (ret == 0) |
|---|
| 174 | 146 | cells++; |
|---|
| 175 | 147 | |
|---|
| 176 | | - ret = lpc_sch_populate_cell(dev, GPIOBASE, "sch_gpio", |
|---|
| 177 | | - info->io_size_gpio, info->irq_gpio, |
|---|
| 148 | + ret = lpc_sch_populate_cell(dev, GPIO_BASE, "sch_gpio", |
|---|
| 149 | + info->io_size_gpio, |
|---|
| 178 | 150 | id->device, &lpc_sch_cells[cells]); |
|---|
| 179 | 151 | if (ret < 0) |
|---|
| 180 | 152 | return ret; |
|---|
| .. | .. |
|---|
| 182 | 154 | cells++; |
|---|
| 183 | 155 | |
|---|
| 184 | 156 | ret = lpc_sch_populate_cell(dev, WDTBASE, "ie6xx_wdt", |
|---|
| 185 | | - info->io_size_wdt, -1, |
|---|
| 157 | + info->io_size_wdt, |
|---|
| 186 | 158 | id->device, &lpc_sch_cells[cells]); |
|---|
| 187 | 159 | if (ret < 0) |
|---|
| 188 | 160 | return ret; |
|---|