Lines Matching +full:stand +full:- +full:alone

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:
17 * This started as a fork of i2c-elektor.c and has evolved since.
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"
62 * Functions called by i2c-algo-pcf
68 u8 __iomem *address = ctl ? i2c->reg_s1 : i2c->reg_s0; in icy_pcf_setpcf()
77 u8 __iomem *address = ctl ? i2c->reg_s1 : i2c->reg_s0; in icy_pcf_getpcf()
98 * Main i2c-icy part
114 PROPERTY_ENTRY_U32_ARRAY("lltc,meas-mode", icy_ltc2990_meas_mode),
128 i2c = devm_kzalloc(&z->dev, sizeof(*i2c), GFP_KERNEL); in icy_probe()
130 return -ENOMEM; in icy_probe()
132 algo_data = devm_kzalloc(&z->dev, sizeof(*algo_data), GFP_KERNEL); in icy_probe()
134 return -ENOMEM; in icy_probe()
136 dev_set_drvdata(&z->dev, i2c); in icy_probe()
137 i2c->adapter.dev.parent = &z->dev; in icy_probe()
138 i2c->adapter.owner = THIS_MODULE; in icy_probe()
139 /* i2c->adapter.algo assigned by i2c_pcf_add_bus() */ in icy_probe()
140 i2c->adapter.algo_data = algo_data; in icy_probe()
141 strlcpy(i2c->adapter.name, "ICY I2C Zorro adapter", in icy_probe()
142 sizeof(i2c->adapter.name)); in icy_probe()
144 if (!devm_request_mem_region(&z->dev, in icy_probe()
145 z->resource.start, in icy_probe()
146 4, i2c->adapter.name)) in icy_probe()
147 return -ENXIO; in icy_probe()
150 i2c->reg_s0 = ZTWO_VADDR(z->resource.start); in icy_probe()
151 i2c->reg_s1 = ZTWO_VADDR(z->resource.start + 2); in icy_probe()
153 algo_data->data = i2c; in icy_probe()
154 algo_data->setpcf = icy_pcf_setpcf; in icy_probe()
155 algo_data->getpcf = icy_pcf_getpcf; in icy_probe()
156 algo_data->getown = icy_pcf_getown; in icy_probe()
157 algo_data->getclock = icy_pcf_getclock; in icy_probe()
158 algo_data->waitforpin = icy_pcf_waitforpin; in icy_probe()
160 if (i2c_pcf_add_bus(&i2c->adapter)) { in icy_probe()
161 dev_err(&z->dev, "i2c_pcf_add_bus() failed\n"); in icy_probe()
162 return -ENXIO; in icy_probe()
165 dev_info(&z->dev, "ICY I2C controller at %pa, IRQ not implemented\n", in icy_probe()
166 &z->resource.start); in icy_probe()
179 dev_info(&z->dev, "Failed to create fwnode for LTC2990, error: %ld\n", in icy_probe()
187 i2c->ltc2990_fwnode = new_fwnode; in icy_probe()
190 i2c->ltc2990_client = in icy_probe()
191 i2c_new_scanned_device(&i2c->adapter, in icy_probe()
202 struct icy_i2c *i2c = dev_get_drvdata(&z->dev); in icy_remove()
204 i2c_unregister_device(i2c->ltc2990_client); in icy_remove()
205 fwnode_remove_software_node(i2c->ltc2990_fwnode); in icy_remove()
207 i2c_del_adapter(&i2c->adapter); in icy_remove()
218 .name = "i2c-icy",