summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/linux-3.12.70/mtrv1/linux-3.12-eeprom-setup-mtr.patch
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-11-11 16:17:52 -0600
committerJohn Klug <john.klug@multitech.com>2020-11-11 16:17:52 -0600
commit4bb6f26b05450777d14aa96e10783066c2503dc2 (patch)
tree3ed6c4bb86736d28926fd37a3c2b4eb81de44c82 /recipes-kernel/linux/linux-3.12.70/mtrv1/linux-3.12-eeprom-setup-mtr.patch
downloadmeta-multitech-atmel-4bb6f26b05450777d14aa96e10783066c2503dc2.tar.gz
meta-multitech-atmel-4bb6f26b05450777d14aa96e10783066c2503dc2.tar.bz2
meta-multitech-atmel-4bb6f26b05450777d14aa96e10783066c2503dc2.zip
Add new BSP submodule for Atmel Processors.5.3.0b5.3.0a
Diffstat (limited to 'recipes-kernel/linux/linux-3.12.70/mtrv1/linux-3.12-eeprom-setup-mtr.patch')
-rw-r--r--recipes-kernel/linux/linux-3.12.70/mtrv1/linux-3.12-eeprom-setup-mtr.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-3.12.70/mtrv1/linux-3.12-eeprom-setup-mtr.patch b/recipes-kernel/linux/linux-3.12.70/mtrv1/linux-3.12-eeprom-setup-mtr.patch
new file mode 100644
index 0000000..9c77e7f
--- /dev/null
+++ b/recipes-kernel/linux/linux-3.12.70/mtrv1/linux-3.12-eeprom-setup-mtr.patch
@@ -0,0 +1,114 @@
+Index: linux-3.12.27/arch/arm/mach-at91/board-dt-sam9.c
+===================================================================
+--- linux-3.12.27.orig/arch/arm/mach-at91/board-dt-sam9.c 2014-08-26 07:12:26.000000000 -0500
++++ linux-3.12.27/arch/arm/mach-at91/board-dt-sam9.c 2014-09-24 09:56:17.283867487 -0500
+@@ -25,6 +25,36 @@
+ #include "board.h"
+ #include "generic.h"
+
++#include <linux/mts_at24.h>
++
++uint8_t mts_id_eeprom[512];
++
++EXPORT_SYMBOL(mts_id_eeprom);
++
++static void mts_id_eeprom_load(struct memory_accessor *macc, void *context)
++{
++ int tmp;
++
++ memset(mts_id_eeprom, 0, sizeof(mts_id_eeprom));
++
++ tmp = macc->read(macc, mts_id_eeprom, 0, sizeof(mts_id_eeprom));
++ if (tmp != sizeof(mts_id_eeprom)) {
++ printk(KERN_ERR "sam9x5: id eeprom read failed: %d\n", tmp);
++ } else {
++ printk(KERN_INFO "sam9x5: read %d bytes from id eeprom\n", tmp);
++ }
++}
++
++struct mts_eeprom_callback id_eeprom_callback = {
++ .address = 0x56,
++ .index = -1,
++ .setup = mts_id_eeprom_load,
++};
++
++struct mts_eeprom_callback* mts_eeprom_callback_lookup[] = {
++ &id_eeprom_callback,
++ NULL
++};
+
+ static const struct of_device_id irq_of_match[] __initconst = {
+
+Index: linux-3.12.27/drivers/misc/eeprom/at24.c
+===================================================================
+--- linux-3.12.27.orig/drivers/misc/eeprom/at24.c 2014-08-26 07:12:26.000000000 -0500
++++ linux-3.12.27/drivers/misc/eeprom/at24.c 2014-09-23 11:41:52.470331651 -0500
+@@ -24,6 +24,8 @@
+ #include <linux/i2c.h>
+ #include <linux/i2c/at24.h>
+
++#include <linux/mts_at24.h>
++
+ /*
+ * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable.
+ * Differences between different vendor product lines (like Atmel AT24C or
+@@ -473,6 +475,23 @@
+ chip->page_size = be32_to_cpup(val);
+ }
+ }
++
++static void at24_get_setup(struct i2c_client *client,
++ struct at24_platform_data *chip)
++{
++ int i;
++
++ for (i = 0; mts_eeprom_callback_lookup[i] != NULL; i++) {
++ if (mts_eeprom_callback_lookup[i]->address == client->addr) {
++ printk(KERN_INFO "%s: found a match for eeprom at %X\n", __func__, client->addr);
++ chip->setup = mts_eeprom_callback_lookup[i]->setup;
++ if (mts_eeprom_callback_lookup[i]->index > -1) {
++ chip->context = (void*)&mts_eeprom_callback_lookup[i]->index;
++ }
++ break;
++ }
++ }
++}
+ #else
+ static void at24_get_ofdata(struct i2c_client *client,
+ struct at24_platform_data *chip)
+@@ -505,12 +524,14 @@
+ * is recommended anyhow.
+ */
+ chip.page_size = 1;
++ chip.setup = NULL;
++ chip.context = NULL;
+
+ /* update chipdata if OF is present */
+ at24_get_ofdata(client, &chip);
+
+- chip.setup = NULL;
+- chip.context = NULL;
++ /* see if we have a setup callback */
++ at24_get_setup(client, &chip);
+ }
+
+ if (!is_power_of_2(chip.byte_len))
+Index: linux-3.12.27/include/linux/mts_at24.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.12.27/include/linux/mts_at24.h 2014-09-23 11:41:52.470331651 -0500
+@@ -0,0 +1,14 @@
++#ifndef _LINUX_MTSAT24_H
++#define _LINUX_MTSAT24_H
++
++#include <linux/memory.h>
++
++struct mts_eeprom_callback {
++ unsigned short address;
++ int index;
++ void (*setup)(struct memory_accessor *, void *context);
++};
++
++extern struct mts_eeprom_callback* mts_eeprom_callback_lookup[];
++
++#endif /* _LINUX_MTSAT24_H */