Skip to contentSkip to conversation

misc/eeprom: add driver for microwire 93xx46 EEPROMs

PATCH New Anatolij Gustschin 1 participant 2 messages Jun 6, 2011 Char and misc drivers

lore
Share & tools
lore
#1 lore raw

PATCH 2/2 misc/eeprom: add eeprom access driver for digsy_mtc board

In reply to Anatolij Gustschin

Both displays on digsy_mtc board obtain their configuration from microwire EEPROMs which are connected to the SoC over GPIO lines. We need an easy way to access the EEPROMs to write the needed display configuration or to read out the currently programmed configuration. The generic eeprom_93xx46 SPI driver added by previous patch allows EEPROM access over sysfs. Using the simple driver added by this patch we provide used GPIO interface and access control description on the board for generic eeprom_93xx46 driver and spi_gpio driver.

---
 drivers/misc/eeprom/Kconfig            |   12 +++++
 drivers/misc/eeprom/Makefile           |    1 +
 drivers/misc/eeprom/digsy_mtc_eeprom.c |   85 ++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/eeprom/digsy_mtc_eeprom.c
drivers/misc/eeprom/Kconfig +12 -0
index 620de28..26cf12c 100644
@@ -83,4 +83,16 @@ config EEPROM_93XX46
 
 	  If unsure, say N.
 
+config EEPROM_DIGSY_MTC_CFG
+	bool "DigsyMTC display configuration EEPROMs device"
+	depends on PPC_MPC5200_GPIO && GPIOLIB && SPI_GPIO
+	help
+	  This option enables access to display configuration EEPROMs
+	  on digsy_mtc board. You have to additionally select Microwire
+	  EEPROM 93XX46 driver. sysfs entries will be created for that
+	  EEPROM allowing to read/write the configuration data or to
+	  erase the whole EEPROM.
+
+	  If unsure, say N.
+
 endmenu
drivers/misc/eeprom/Makefile +1 -0
index ec55aad..fc1e81d 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_EEPROM_LEGACY)	+= eeprom.o
 obj-$(CONFIG_EEPROM_MAX6875)	+= max6875.o
 obj-$(CONFIG_EEPROM_93CX6)	+= eeprom_93cx6.o
 obj-$(CONFIG_EEPROM_93XX46)	+= eeprom_93xx46.o
+obj-$(CONFIG_EEPROM_DIGSY_MTC_CFG) += digsy_mtc_eeprom.o
drivers/misc/eeprom/digsy_mtc_eeprom.c new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
1.7.1
#0 lore raw

PATCH 1/2 misc/eeprom: add driver for microwire 93xx46 EEPROMs

Add EEPROM driver for 93xx46 chips. It can also be used with spi_gpio driver to access 93xx46 EEPROMs connected over GPIO lines. This driver supports read/write/erase access to the EEPROM chips over sysfs files.

---
 drivers/misc/eeprom/Kconfig         |   13 +
 drivers/misc/eeprom/Makefile        |    1 +
 drivers/misc/eeprom/eeprom_93xx46.c |  410 +++++++++++++++++++++++++++++++++++
 include/linux/eeprom_93xx46.h       |   18 ++
 4 files changed, 442 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/eeprom/eeprom_93xx46.c
 create mode 100644 include/linux/eeprom_93xx46.h
drivers/misc/eeprom/Kconfig +13 -0
index 9118613..620de28 100644
@@ -70,4 +70,17 @@ config EEPROM_93CX6
 
 	  If unsure, say N.
 
+config EEPROM_93XX46
+	tristate "Microwire EEPROM 93XX46 support"
+	depends on SPI && SYSFS
+	help
+	  Driver for the microwire EEPROM chipsets 93xx46x. The driver
+	  supports both read and write commands and also the command to
+	  erase the whole EEPROM.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called eeprom_93xx46.
+
+	  If unsure, say N.
+
 endmenu
drivers/misc/eeprom/Makefile +1 -0
index df3d68f..ec55aad 100644
@@ -3,3 +3,4 @@ obj-$(CONFIG_EEPROM_AT25)	+= at25.o
 obj-$(CONFIG_EEPROM_LEGACY)	+= eeprom.o
 obj-$(CONFIG_EEPROM_MAX6875)	+= max6875.o
 obj-$(CONFIG_EEPROM_93CX6)	+= eeprom_93cx6.o
+obj-$(CONFIG_EEPROM_93XX46)	+= eeprom_93xx46.o
drivers/misc/eeprom/eeprom_93xx46.c new file +410 -0

410 lines not on this page · raw message

include/linux/eeprom_93xx46.h new file +18 -0
new file mode 100644
index 0000000..0679181
@@ -0,0 +1,18 @@
+/*
+ * Module: eeprom_93xx46
+ * platform description for 93xx46 EEPROMs.
+ */
+
+struct eeprom_93xx46_platform_data {
+	unsigned char	flags;
+#define EE_ADDR8	0x01		/*  8 bit addr. cfg */
+#define EE_ADDR16	0x02		/* 16 bit addr. cfg */
+#define EE_READONLY	0x08		/* forbid writing */
+
+	/*
+	 * optional hooks to control additional logic
+	 * before and after spi transfer.
+	 */
+	void (*prepare)(void *);
+	void (*finish)(void *);
+};
Signature · 1 line
1.7.1