Lines Matching +full:a +full:- +full:z
1 // SPDX-License-Identifier: GPL-2.0
3 * I2C driver for stand-alone PCF8584 style adapters on Zorro cards
8 * There has been a modern community re-print of this design in 2019:
11 * The card is basically a Philips PCF8584 connected straight to the
17 * This started as a fork of i2c-elektor.c and has evolved since.
18 * Thanks go to its authors for providing a base to grow on.
23 * As it turns out, i2c-algo-pcf is really written with i2c-elektor's
24 * edge-triggered ISA interrupts in mind, while the Amiga's Zorro bus has
25 * level-triggered interrupts. This means that once an interrupt occurs, we
29 * However, because of the PCF8584's host-side protocol, there is no good
32 * pin. This entails re-designing the core of i2c-algo-pcf in the future.
44 #include <linux/i2c-algo-pcf.h>
50 #include "../algos/i2c-algo-pcf.h"
61 * Functions called by i2c-algo-pcf
67 u8 __iomem *address = ctl ? i2c->reg_s1 : i2c->reg_s0; in icy_pcf_setpcf()
76 u8 __iomem *address = ctl ? i2c->reg_s1 : i2c->reg_s0; in icy_pcf_getpcf()
97 * Main i2c-icy part
108 * temp3 will be measured using a PCB loop next the chip.
113 PROPERTY_ENTRY_U32_ARRAY("lltc,meas-mode", icy_ltc2990_meas_mode),
121 static int icy_probe(struct zorro_dev *z, in icy_probe() argument
131 i2c = devm_kzalloc(&z->dev, sizeof(*i2c), GFP_KERNEL); in icy_probe()
133 return -ENOMEM; in icy_probe()
135 algo_data = devm_kzalloc(&z->dev, sizeof(*algo_data), GFP_KERNEL); in icy_probe()
137 return -ENOMEM; in icy_probe()
139 dev_set_drvdata(&z->dev, i2c); in icy_probe()
140 i2c->adapter.dev.parent = &z->dev; in icy_probe()
141 i2c->adapter.owner = THIS_MODULE; in icy_probe()
142 /* i2c->adapter.algo assigned by i2c_pcf_add_bus() */ in icy_probe()
143 i2c->adapter.algo_data = algo_data; in icy_probe()
144 strscpy(i2c->adapter.name, "ICY I2C Zorro adapter", in icy_probe()
145 sizeof(i2c->adapter.name)); in icy_probe()
147 if (!devm_request_mem_region(&z->dev, in icy_probe()
148 z->resource.start, in icy_probe()
149 4, i2c->adapter.name)) in icy_probe()
150 return -ENXIO; in icy_probe()
153 i2c->reg_s0 = ZTWO_VADDR(z->resource.start); in icy_probe()
154 i2c->reg_s1 = ZTWO_VADDR(z->resource.start + 2); in icy_probe()
156 algo_data->data = i2c; in icy_probe()
157 algo_data->setpcf = icy_pcf_setpcf; in icy_probe()
158 algo_data->getpcf = icy_pcf_getpcf; in icy_probe()
159 algo_data->getown = icy_pcf_getown; in icy_probe()
160 algo_data->getclock = icy_pcf_getclock; in icy_probe()
161 algo_data->waitforpin = icy_pcf_waitforpin; in icy_probe()
163 if (i2c_pcf_add_bus(&i2c->adapter)) { in icy_probe()
164 dev_err(&z->dev, "i2c_pcf_add_bus() failed\n"); in icy_probe()
165 return -ENXIO; in icy_probe()
168 dev_info(&z->dev, "ICY I2C controller at %pa, IRQ not implemented\n", in icy_probe()
169 &z->resource.start); in icy_probe()
180 i2c->ltc2990_client = i2c_new_scanned_device(&i2c->adapter, in icy_probe()
187 static void icy_remove(struct zorro_dev *z) in icy_remove() argument
189 struct icy_i2c *i2c = dev_get_drvdata(&z->dev); in icy_remove()
191 i2c_unregister_device(i2c->ltc2990_client); in icy_remove()
192 i2c_del_adapter(&i2c->adapter); in icy_remove()
203 .name = "i2c-icy",