Remove the i2c "size" locator and corresponding property / attach arg.

It was a hack meant only for EEPROMs, which have another way to specify
size in the config directive ("flag" paramter), as well as a better way
to detect size based on "compatible" string.
This commit is contained in:
thorpej 2018-06-26 06:34:55 +00:00
parent c61b43cf75
commit 067d2463e3
4 changed files with 8 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: at24cxx.c,v 1.29 2018/06/26 06:21:23 thorpej Exp $ */
/* $NetBSD: at24cxx.c,v 1.30 2018/06/26 06:34:55 thorpej Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.29 2018/06/26 06:21:23 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.30 2018/06/26 06:34:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -169,8 +169,6 @@ seeprom_attach(device_t parent, device_t self, void *aux)
*/
if (device_cfdata(self)->cf_flags)
sc->sc_size = (device_cfdata(self)->cf_flags << 7);
else
sc->sc_size = ia->ia_size;
if (sc->sc_size <= 0 && ia->ia_ncompat > 0) {
if (iic_compatible_match(ia, compat_data, &dce))

View File

@ -1,10 +1,10 @@
# $NetBSD: files.i2c,v 1.92 2018/05/27 05:31:20 thorpej Exp $
# $NetBSD: files.i2c,v 1.93 2018/06/26 06:34:55 thorpej Exp $
obsolete defflag opt_i2cbus.h I2C_SCAN
define i2cbus { }
define i2cexec
device iic { [addr = -1], [size = -1] } : i2c_bitbang
device iic { [addr = -1] } : i2c_bitbang
attach iic at i2cbus
file dev/i2c/i2c.c iic
file dev/i2c/i2c_exec.c iic | i2cbus | i2cexec

View File

@ -1,4 +1,4 @@
/* $NetBSD: i2c.c,v 1.65 2018/06/26 04:32:35 thorpej Exp $ */
/* $NetBSD: i2c.c,v 1.66 2018/06/26 06:34:55 thorpej Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -40,7 +40,7 @@
#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.65 2018/06/26 04:32:35 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.66 2018/06/26 06:34:55 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -285,7 +285,6 @@ iic_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
}
ia.ia_tag = sc->sc_tag;
ia.ia_size = cf->cf_loc[IICCF_SIZE];
ia.ia_type = sc->sc_type;
ia.ia_name = NULL;
@ -441,7 +440,7 @@ iic_attach(device_t parent, device_t self, void *aux)
unsigned int i, count;
prop_dictionary_t dev;
prop_data_t cdata;
uint32_t addr, size;
uint32_t addr;
uint64_t cookie;
const char *name;
struct i2c_attach_args ia;
@ -462,10 +461,6 @@ iic_attach(device_t parent, device_t self, void *aux)
if (!prop_dictionary_get_uint64(dev, "cookie", &cookie))
cookie = 0;
loc[IICCF_ADDR] = addr;
if (prop_dictionary_get_uint32(dev, "size", &size))
loc[IICCF_SIZE] = size;
else
size = loc[IICCF_SIZE] = IICCF_SIZE_DEFAULT;
memset(&ia, 0, sizeof ia);
ia.ia_addr = addr;
@ -473,7 +468,6 @@ iic_attach(device_t parent, device_t self, void *aux)
ia.ia_tag = ic;
ia.ia_name = name;
ia.ia_cookie = cookie;
ia.ia_size = size;
ia.ia_prop = dev;
buf = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: i2cvar.h,v 1.16 2018/06/26 04:32:35 thorpej Exp $ */
/* $NetBSD: i2cvar.h,v 1.17 2018/06/26 06:34:55 thorpej Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -133,7 +133,6 @@ struct i2cbus_attach_args {
struct i2c_attach_args {
i2c_tag_t ia_tag; /* our controller */
i2c_addr_t ia_addr; /* address of device */
int ia_size; /* size (for EEPROMs) */
int ia_type; /* bus type */
/* only set if using direct config */
const char * ia_name; /* name of the device */