| 1 |
|
| 2 |
|
| 3 |
#include <device/device.h> |
| 4 |
#include <device/smbus.h> |
| 5 |
#include <console/console.h> |
| 6 |
|
| 7 |
static void at24rf08c_init(struct device *dev) |
| 8 |
{ |
| 9 |
int i, j; |
| 10 |
|
| 11 |
if (!dev->enabled) |
| 12 |
return; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
if (dev->path.type != DEVICE_PATH_I2C || dev->path.i2c.device != 0x5c) |
| 17 |
return; |
| 18 |
|
| 19 |
printk(BIOS_DEBUG, "Locking EEPROM RFID\n"); |
| 20 |
|
| 21 |
for (i = 0; i < 8; i++) { |
| 22 |
|
| 23 |
|
| 24 |
for (j = 0; j < 100; j++) |
| 25 |
if (smbus_write_byte(dev, i, 0x0f) >= 0) |
| 26 |
break; |
| 27 |
} |
| 28 |
|
| 29 |
printk(BIOS_DEBUG, "init EEPROM done\n"); |
| 30 |
} |
| 31 |
|
| 32 |
static struct device_operations at24rf08c_operations = { |
| 33 |
.read_resources = noop_read_resources, |
| 34 |
.set_resources = noop_set_resources, |
| 35 |
.init = at24rf08c_init, |
| 36 |
}; |
| 37 |
|
| 38 |
static void enable_dev(struct device *dev) |
| 39 |
{ |
| 40 |
dev->ops = &at24rf08c_operations; |
| 41 |
} |
| 42 |
|
| 43 |
struct chip_operations drivers_i2c_at24rf08c_ops = { |
| 44 |
.name = "AT24RF08C", |
| 45 |
.enable_dev = enable_dev, |
| 46 |
}; |