Commit 8a16ff45 authored by Kevin Hilman's avatar Kevin Hilman

davinci: eeprom: use new memory accessor interface

Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent be9ffcc4
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/memory.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pcf857x.h> #include <linux/i2c/pcf857x.h>
...@@ -412,17 +413,17 @@ static struct pcf857x_platform_data pcf_data_u35 = { ...@@ -412,17 +413,17 @@ static struct pcf857x_platform_data pcf_data_u35 = {
* - 0x0039, 1 byte NTSC vs PAL (bit 0x80 == PAL) * - 0x0039, 1 byte NTSC vs PAL (bit 0x80 == PAL)
* - ... newer boards may have more * - ... newer boards may have more
*/ */
static struct at24_iface *at24_if; static struct memory_accessor *at24_mem_acc;
static int at24_setup(struct at24_iface *iface, void *context) static int at24_setup(struct memory_accessor *mem_acc, void *context)
{ {
DECLARE_MAC_BUF(mac_str); DECLARE_MAC_BUF(mac_str);
char mac_addr[6]; char mac_addr[6];
at24_if = iface; at24_mem_acc = mem_acc;
/* Read MAC addr from EEPROM */ /* Read MAC addr from EEPROM */
if (at24_if->read(at24_if, mac_addr, 0x7f00, 6) == 6) { if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, 6) == 6) {
printk(KERN_INFO "Read MAC addr from EEPROM: %s\n", printk(KERN_INFO "Read MAC addr from EEPROM: %s\n",
print_mac(mac_str, mac_addr)); print_mac(mac_str, mac_addr));
...@@ -441,16 +442,16 @@ static struct at24_platform_data eeprom_info = { ...@@ -441,16 +442,16 @@ static struct at24_platform_data eeprom_info = {
int dm6446evm_eeprom_read(void *buf, off_t off, size_t count) int dm6446evm_eeprom_read(void *buf, off_t off, size_t count)
{ {
if (at24_if) if (at24_mem_acc)
return at24_if->read(at24_if, buf, off, count); return at24_mem_acc->read(at24_mem_acc, buf, off, count);
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(dm6446evm_eeprom_read); EXPORT_SYMBOL(dm6446evm_eeprom_read);
int dm6446evm_eeprom_write(void *buf, off_t off, size_t count) int dm6446evm_eeprom_write(void *buf, off_t off, size_t count)
{ {
if (at24_if) if (at24_mem_acc)
return at24_if->write(at24_if, buf, off, count); return at24_mem_acc->write(at24_mem_acc, buf, off, count);
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(dm6446evm_eeprom_write); EXPORT_SYMBOL(dm6446evm_eeprom_write);
......
...@@ -62,17 +62,17 @@ static struct davinci_uart_config uart_config __initdata = { ...@@ -62,17 +62,17 @@ static struct davinci_uart_config uart_config __initdata = {
* - 0x7f00, 6 bytes Ethernet Address * - 0x7f00, 6 bytes Ethernet Address
* - ... newer boards may have more * - ... newer boards may have more
*/ */
static struct at24_iface *at24_if; static struct memory_accessor *at24_mem_acc;
static int at24_setup(struct at24_iface *iface, void *context) static int at24_setup(struct memory_accessor *mem_acc, void *context)
{ {
DECLARE_MAC_BUF(mac_str); DECLARE_MAC_BUF(mac_str);
char mac_addr[6]; char mac_addr[6];
at24_if = iface; at24_mem_acc = mem_acc;
/* Read MAC addr from EEPROM */ /* Read MAC addr from EEPROM */
if (at24_if->read(at24_if, mac_addr, 0x7f00, 6) == 6) { if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, 6) == 6) {
printk(KERN_INFO "Read MAC addr from EEPROM: %s\n", printk(KERN_INFO "Read MAC addr from EEPROM: %s\n",
print_mac(mac_str, mac_addr)); print_mac(mac_str, mac_addr));
...@@ -89,16 +89,16 @@ static struct at24_platform_data eeprom_info = { ...@@ -89,16 +89,16 @@ static struct at24_platform_data eeprom_info = {
int dm646xevm_eeprom_read(void *buf, off_t off, size_t count) int dm646xevm_eeprom_read(void *buf, off_t off, size_t count)
{ {
if (at24_if) if (at24_mem_acc)
return at24_if->read(at24_if, buf, off, count); return at24_mem_acc->read(at24_mem_acc, buf, off, count);
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(dm646xevm_eeprom_read); EXPORT_SYMBOL(dm646xevm_eeprom_read);
int dm646xevm_eeprom_write(void *buf, off_t off, size_t count) int dm646xevm_eeprom_write(void *buf, off_t off, size_t count)
{ {
if (at24_if) if (at24_mem_acc)
return at24_if->write(at24_if, buf, off, count); return at24_mem_acc->write(at24_mem_acc, buf, off, count);
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(dm646xevm_eeprom_write); EXPORT_SYMBOL(dm646xevm_eeprom_write);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment