Commit 32feb948 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Sekhar Nori
Browse files

ARM: davinci: mityomapl138: use cell nvmem lookup for mac address



We now support nvmem lookups and cell definitions for machine code.
Add relevant data structures for the mac-address stored in at24 EEPROM.

Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent c85efcc6
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/console.h>
#include <linux/platform_device.h>
#include <linux/mtd/partitions.h>
#include <linux/nvmem-provider.h>
#include <linux/regulator/machine.h>
#include <linux/i2c.h>
#include <linux/platform_data/at24.h>
@@ -161,6 +162,31 @@ bad_config:
	mityomapl138_cpufreq_init(partnum);
}

/*
 * We don't define a cell for factory config as it will be accessed from the
 * board file using the nvmem notifier chain.
 */
static struct nvmem_cell_info mityomapl138_nvmem_cells[] = {
	{
		.name		= "macaddr",
		.offset		= 0x64,
		.bytes		= ETH_ALEN,
	}
};

static struct nvmem_cell_table mityomapl138_nvmem_cell_table = {
	.nvmem_name	= "1-00500",
	.cells		= mityomapl138_nvmem_cells,
	.ncells		= ARRAY_SIZE(mityomapl138_nvmem_cells),
};

static struct nvmem_cell_lookup mityomapl138_nvmem_cell_lookup = {
	.nvmem_name	= "1-00500",
	.cell_name	= "macaddr",
	.dev_id		= "davinci_emac.1",
	.con_id		= "mac-address",
};

static struct at24_platform_data mityomapl138_fd_chip = {
	.byte_len	= 256,
	.page_size	= 8,
@@ -543,6 +569,9 @@ static void __init mityomapl138_init(void)

	davinci_serial_init(da8xx_serial_device);

	nvmem_add_cell_table(&mityomapl138_nvmem_cell_table);
	nvmem_add_cell_lookups(&mityomapl138_nvmem_cell_lookup, 1);

	ret = da8xx_register_i2c(0, &mityomap_i2c_0_pdata);
	if (ret)
		pr_warn("i2c0 registration failed: %d\n", ret);