mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support
@ 2012-10-31 16:52 Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22 ` [PATCH 1/4] at91sam9x5ek: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD
  2012-11-01 15:30 ` [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support Sascha Hauer
  0 siblings, 2 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-31 16:52 UTC (permalink / raw)
  To: barebox; +Cc: ludovic.desroches

HI,

	This patch serie add the 1-wire support to the at91sam9x5ek

	on sam9x5ek we have on each module and motherboard a 1-wire eeprom
	that describe the hardware revision and type

	And on the Cogent Cpu Module we have some difference with teh others
	modules and some bug

	So fix

	Also use the 1-wire to generate a local mac address

	This patch series depends on the pm9g45/pm9263/pm9261 v3

The following changes since commit 7fb0cb2ce2f7800341ab8de711dccbd2c4753c84:

  pm9261: use w1 serial number to generate local mac address (2012-10-30 13:44:54 +0800)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git delivery/at91sam9x5ek_w1

for you to fetch changes up to 4e088306b778a5f14c2503be54b061e60e27e6a0:

  at91sam9x5ek: use w1 serial number to generate local mac address (2012-10-31 09:33:38 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (4):
      at91sam9x5ek: add 1-wire support
      at91sam9x5ek: add hw detection support
      at91sam9x5ek: add fixup for cogent cpu module
      at91sam9x5ek: use w1 serial number to generate local mac address

 arch/arm/boards/at91sam9x5ek/Makefile     |    1 +
 arch/arm/boards/at91sam9x5ek/env/config   |    1 +
 arch/arm/boards/at91sam9x5ek/hw_version.c |  272 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/boards/at91sam9x5ek/hw_version.h |   34 ++++++++++++++++++++++++++++
 arch/arm/boards/at91sam9x5ek/init.c       |   38 +++++++++++++++++++++++++++++++-
 arch/arm/configs/at91sam9x5ek_defconfig   |    4 ++++
 6 files changed, 349 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/at91sam9x5ek/hw_version.c
 create mode 100644 arch/arm/boards/at91sam9x5ek/hw_version.h

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] at91sam9x5ek: add 1-wire support
  2012-10-31 16:52 [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-31 18:22 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22   ` [PATCH 2/4] at91sam9x5ek: add hw detection support Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 more replies)
  2012-11-01 15:30 ` [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support Sascha Hauer
  1 sibling, 3 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-31 18:22 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9x5ek/init.c     |   14 ++++++++++++++
 arch/arm/configs/at91sam9x5ek_defconfig |    4 ++++
 2 files changed, 18 insertions(+)

diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c
index 58c945c..471169e 100644
--- a/arch/arm/boards/at91sam9x5ek/init.c
+++ b/arch/arm/boards/at91sam9x5ek/init.c
@@ -38,6 +38,12 @@
 #include <mach/at91_rstc.h>
 #include <gpio_keys.h>
 #include <readkey.h>
+#include <linux/w1-gpio.h>
+
+struct w1_gpio_platform_data w1_pdata = {
+	.pin = AT91_PIN_PB18,
+	.is_open_drain = 0,
+};
 
 static struct atmel_nand_data nand_pdata = {
 	.ale		= 21,
@@ -130,8 +136,16 @@ static int at91sam9x5ek_mem_init(void)
 }
 mem_initcall(at91sam9x5ek_mem_init);
 
+static void ek_add_device_w1(void)
+{
+	at91_set_gpio_input(w1_pdata.pin, 0);
+	at91_set_multi_drive(w1_pdata.pin, 1);
+	add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata);
+}
+
 static int at91sam9x5ek_devices_init(void)
 {
+	ek_add_device_w1();
 	ek_add_device_nand();
 	at91_add_device_eth(0, &macb_pdata);
 	at91_add_device_usbh_ohci(&ek_usbh_data);
diff --git a/arch/arm/configs/at91sam9x5ek_defconfig b/arch/arm/configs/at91sam9x5ek_defconfig
index cda360d..6315d9f 100644
--- a/arch/arm/configs/at91sam9x5ek_defconfig
+++ b/arch/arm/configs/at91sam9x5ek_defconfig
@@ -65,6 +65,10 @@ CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_LED_TRIGGERS=y
 CONFIG_KEYBOARD_GPIO=y
+CONFIG_W1=y
+CONFIG_W1_MASTER_GPIO=y
+CONFIG_W1_SLAVE_DS2431=y
+CONFIG_W1_SLAVE_DS2433=y
 CONFIG_FS_FAT=y
 CONFIG_FS_FAT_WRITE=y
 CONFIG_FS_FAT_LFN=y
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] at91sam9x5ek: add hw detection support
  2012-10-31 18:22 ` [PATCH 1/4] at91sam9x5ek: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-31 18:22   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22   ` [PATCH 3/4] at91sam9x5ek: add fixup for cogent cpu module Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22   ` [PATCH 4/4] at91sam9x5ek: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD
  2 siblings, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-31 18:22 UTC (permalink / raw)
  To: barebox

for bootp specify the module version via client_id as
%{BOARD}-%{VERISON}

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9x5ek/Makefile     |    1 +
 arch/arm/boards/at91sam9x5ek/env/config   |    1 +
 arch/arm/boards/at91sam9x5ek/hw_version.c |  240 +++++++++++++++++++++++++++++
 arch/arm/boards/at91sam9x5ek/hw_version.h |   34 ++++
 arch/arm/boards/at91sam9x5ek/init.c       |    4 +
 5 files changed, 280 insertions(+)
 create mode 100644 arch/arm/boards/at91sam9x5ek/hw_version.c
 create mode 100644 arch/arm/boards/at91sam9x5ek/hw_version.h

diff --git a/arch/arm/boards/at91sam9x5ek/Makefile b/arch/arm/boards/at91sam9x5ek/Makefile
index eb072c0..f2acf20 100644
--- a/arch/arm/boards/at91sam9x5ek/Makefile
+++ b/arch/arm/boards/at91sam9x5ek/Makefile
@@ -1 +1,2 @@
 obj-y += init.o
+obj-y += hw_version.o
diff --git a/arch/arm/boards/at91sam9x5ek/env/config b/arch/arm/boards/at91sam9x5ek/env/config
index 8b655e2..19457be 100644
--- a/arch/arm/boards/at91sam9x5ek/env/config
+++ b/arch/arm/boards/at91sam9x5ek/env/config
@@ -4,6 +4,7 @@
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
 global.dhcp.vendor_id=barebox-at91sam9x5ek
+global.dhcp.client_id="${at91sam9x5cm.board}-${at91sam9x5cm.vendor}"
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
diff --git a/arch/arm/boards/at91sam9x5ek/hw_version.c b/arch/arm/boards/at91sam9x5ek/hw_version.c
new file mode 100644
index 0000000..709fd68
--- /dev/null
+++ b/arch/arm/boards/at91sam9x5ek/hw_version.c
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ *
+ */
+
+#include <common.h>
+#include <fs.h>
+#include <fcntl.h>
+#include <libbb.h>
+#include <asm/armlinux.h>
+
+#include "hw_version.h"
+
+enum board_type {
+	BOARD_TYPE_EK,
+	BOARD_TYPE_DM,
+	BOARD_TYPE_CPU,
+};
+
+static struct board_info {
+	char *name;
+	enum board_type type;
+	unsigned char id;
+} board_list[] = {
+	{"SAM9x5-EK",		BOARD_TYPE_EK,		0},
+	{"SAM9x5-DM",		BOARD_TYPE_DM,		1},
+	{"SAM9G15-CM",		BOARD_TYPE_CPU,		2},
+	{"SAM9G25-CM",		BOARD_TYPE_CPU,		3},
+	{"SAM9G35-CM",		BOARD_TYPE_CPU,		4},
+	{"SAM9X25-CM",		BOARD_TYPE_CPU,		5},
+	{"SAM9X35-CM",		BOARD_TYPE_CPU,		6},
+	{"PDA-DM",		BOARD_TYPE_DM,		7},
+};
+
+static struct board_info* get_board_info_by_name(const char *name)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(board_list); i++)
+		if (strcmp(name, board_list[i].name) == 0)
+			return &board_list[i];
+
+	return NULL;
+}
+
+static struct vendor_info {
+	char *name;
+	enum vendor_id id;
+} vendor_list[] = {
+	{"EMBEST",		VENDOR_EMBEST},
+	{"FLEX",		VENDOR_FLEX},
+	{"RONETIX",		VENDOR_RONETIX},
+	{"COGENT",		VENDOR_COGENT},
+	{"PDA",			VENDOR_PDA},
+};
+
+static struct vendor_info* get_vendor_info_by_name(const char *name)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(vendor_list); i++)
+		if (strcmp(name, vendor_list[i].name) == 0)
+			return &vendor_list[i];
+
+	return NULL;
+}
+
+#define BOARD_NAME_LEN			12
+#define VENDOR_NAME_LEN			10
+#define VENDOR_COUNTRY_LEN		2
+
+struct one_wire_info {
+	u8 total_bytes;
+	u8 vendor_name[VENDOR_NAME_LEN];
+	u8 vendor_country[VENDOR_COUNTRY_LEN];
+	u8 board_name[BOARD_NAME_LEN];
+	u8 year;
+	u8 week;
+	u8 revision_code;
+	u8 revision_id;
+	u8 reserved;
+	u8 checksum_l;
+	u8 checksum_h;
+}__attribute__ ((packed));
+
+static int at91sam9x5ek_read_w1(const char *file, struct one_wire_info *info)
+{
+	int fd;
+	int ret;
+
+	fd = open(file, O_RDONLY);
+	if (fd < 0) {
+		ret = fd;
+		goto err;
+	}
+
+	ret = read_full(fd, info, sizeof(*info));
+	if (ret < 0)
+		goto err_open;
+
+	if (ret < sizeof(*info)) {
+		ret =  -EINVAL;
+		goto err_open;
+	}
+
+	pr_debug("total_bytes = %d\n", info->total_bytes);
+	pr_debug("vendor_name = %s\n", info->vendor_name);
+	pr_debug("vendor_country = %.2s\n", info->vendor_country);
+	pr_debug("board_name = %s\n", info->board_name);
+	pr_debug("year = %d\n", info->year);
+	pr_debug("week = %d\n", info->week);
+	pr_debug("revision_code = %x\n", info->revision_code);
+	pr_debug("revision_id = %x\n", info->revision_id);
+	pr_debug("reserved = %x\n", info->reserved);
+	pr_debug("checksum_l = %x\n", info->checksum_l);
+	pr_debug("checksum_h = %x\n", info->checksum_h);
+
+	ret = 0;
+
+err_open:
+	close(fd);
+err:
+	if (ret)
+		pr_err("can not read 1-wire %s (%s)\n", file, strerror(ret));
+	return ret;
+}
+
+static u32 sn = 0;
+static u32 rev = 0;
+
+bool at91sam9x5ek_cm_is_vendor(enum vendor_id vid)
+{
+	return ((sn >> 5) & 0x1f) == vid;
+}
+
+bool at91sam9x5ek_ek_is_vendor(enum vendor_id vid)
+{
+	return ((sn >> 15) & 0x1f) == vid;
+}
+
+bool at91sam9x5ek_dm_is_vendor(enum vendor_id vid)
+{
+	return ((sn >> 25) & 0x1f) == vid;
+}
+
+static void at91sam9x5ek_devices_detect_one(const char *name)
+{
+	struct one_wire_info info;
+	struct board_info* binfo;
+	struct vendor_info* vinfo;
+	struct device_d *dev = NULL;
+	char str[16];
+	u8 vendor_id = 0;
+
+	if (at91sam9x5ek_read_w1(name, &info))
+		return;
+
+	binfo = get_board_info_by_name(info.board_name);
+
+	if (!binfo) {
+		pr_err("board %s no supported\n", info.board_name);
+		return;
+	}
+
+	vinfo = get_vendor_info_by_name(info.vendor_name);
+	if (vinfo)
+		vendor_id = vinfo->id;
+
+	switch (binfo->type) {
+	case BOARD_TYPE_CPU:
+		dev = add_generic_device_res("at91sam9x5cm", DEVICE_ID_SINGLE, NULL, 0, NULL);
+		if (!dev)
+			return;
+		sn  |= (binfo->id & 0x1f);
+		sn  |= ((vendor_id & 0x1f) << 5);
+		rev |= (info.revision_code - 'A');
+		rev |= (((info.revision_id - '0') & 0x3) << 15);
+		pr_info("CM");
+		break;
+	case BOARD_TYPE_EK:
+		dev = add_generic_device_res("at91sam9x5ek", DEVICE_ID_SINGLE, NULL, 0, NULL);
+		if (!dev)
+			return;
+		sn  |= ((binfo->id & 0x1f) << 20);
+		sn  |= ((vendor_id & 0x1f) << 25);
+		rev |= ((info.revision_code - 'A') << 10);
+		rev |= (((info.revision_id - '0') & 0x3) << 21);
+		pr_info("EK");
+		break;
+	case BOARD_TYPE_DM:
+		dev = add_generic_device_res("at91sam9x5dm", DEVICE_ID_SINGLE, NULL, 0, NULL);
+		if (!dev)
+			return;
+		sn  |= ((binfo->id & 0x1f) << 10);
+		sn  |= ((vendor_id & 0x1f) << 15);
+		rev |= ((info.revision_code - 'A') << 5);
+		rev |= (((info.revision_id - '0') & 0x3) << 18);
+		pr_info("DM");
+		break;
+	}
+
+	pr_info(": %s [%c%c] from %s\n",
+		info.board_name, info.revision_code, info.revision_id,
+		info.vendor_name);
+
+	dev_add_param_fixed(dev, "vendor", info.vendor_name);
+	dev_add_param_fixed(dev, "board", info.board_name);
+	sprintf(str, "%.2s", info.vendor_country);
+	dev_add_param_fixed(dev, "country", str);
+	sprintf(str, "%d", info.year);
+	dev_add_param_fixed(dev, "year", str);
+	sprintf(str, "%d", info.week);
+	dev_add_param_fixed(dev, "week", str);
+	sprintf(str, "%c", info.revision_code);
+	dev_add_param_fixed(dev, "revision_code", str);
+	sprintf(str, "%c", info.revision_id);
+	dev_add_param_fixed(dev, "revision_id", str);
+}
+
+void at91sam9x5ek_devices_detect_hw(void)
+{
+	at91sam9x5ek_devices_detect_one("/dev/ds24310");
+	at91sam9x5ek_devices_detect_one("/dev/ds24311");
+	at91sam9x5ek_devices_detect_one("/dev/ds24330");
+
+	pr_info("sn: 0x%x, rev: 0x%x\n", sn, rev);
+	armlinux_set_revision(rev);
+	armlinux_set_serial(sn);
+}
diff --git a/arch/arm/boards/at91sam9x5ek/hw_version.h b/arch/arm/boards/at91sam9x5ek/hw_version.h
new file mode 100644
index 0000000..91fd429
--- /dev/null
+++ b/arch/arm/boards/at91sam9x5ek/hw_version.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ *
+ */
+
+#ifndef __HW_REVISION_H__
+#define __HW_REVISION_H__
+
+enum vendor_id {
+	VENDOR_UNKNOWN	= 0,
+	VENDOR_EMBEST	= 1,
+	VENDOR_FLEX	= 2,
+	VENDOR_RONETIX	= 3,
+	VENDOR_COGENT	= 4,
+	VENDOR_PDA	= 5,
+};
+
+bool at91sam9x5ek_cm_is_vendor(enum vendor_id vid);
+bool at91sam9x5ek_ek_is_vendor(enum vendor_id vid);
+bool at91sam9x5ek_dm_is_vendor(enum vendor_id vid);
+void at91sam9x5ek_devices_detect_hw(void);
+
+#endif /* __HW_REVISION_H__ */
diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c
index 471169e..7ba1e25 100644
--- a/arch/arm/boards/at91sam9x5ek/init.c
+++ b/arch/arm/boards/at91sam9x5ek/init.c
@@ -40,6 +40,8 @@
 #include <readkey.h>
 #include <linux/w1-gpio.h>
 
+#include "hw_version.h"
+
 struct w1_gpio_platform_data w1_pdata = {
 	.pin = AT91_PIN_PB18,
 	.is_open_drain = 0,
@@ -141,6 +143,8 @@ static void ek_add_device_w1(void)
 	at91_set_gpio_input(w1_pdata.pin, 0);
 	at91_set_multi_drive(w1_pdata.pin, 1);
 	add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata);
+
+	at91sam9x5ek_devices_detect_hw();
 }
 
 static int at91sam9x5ek_devices_init(void)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] at91sam9x5ek: add fixup for cogent cpu module
  2012-10-31 18:22 ` [PATCH 1/4] at91sam9x5ek: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22   ` [PATCH 2/4] at91sam9x5ek: add hw detection support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-31 18:22   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22   ` [PATCH 4/4] at91sam9x5ek: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD
  2 siblings, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-31 18:22 UTC (permalink / raw)
  To: barebox

The modules from cogent use a 1.8V nand
And have the mci card detect broken as they use the flash vdd as vdd for the
cd which need > 2V

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9x5ek/hw_version.c |   32 +++++++++++++++++++++++++++++
 arch/arm/boards/at91sam9x5ek/init.c       |    9 ++++++++
 2 files changed, 41 insertions(+)

diff --git a/arch/arm/boards/at91sam9x5ek/hw_version.c b/arch/arm/boards/at91sam9x5ek/hw_version.c
index 709fd68..47c640a 100644
--- a/arch/arm/boards/at91sam9x5ek/hw_version.c
+++ b/arch/arm/boards/at91sam9x5ek/hw_version.c
@@ -19,6 +19,8 @@
 #include <fcntl.h>
 #include <libbb.h>
 #include <asm/armlinux.h>
+#include <of.h>
+#include <libfdt.h>
 
 #include "hw_version.h"
 
@@ -228,6 +230,33 @@ static void at91sam9x5ek_devices_detect_one(const char *name)
 	dev_add_param_fixed(dev, "revision_id", str);
 }
 
+#define NODE_NAME_LEN  128
+
+static int cm_cogent_fixup(struct fdt_header *fdt)
+{
+	int off, ret;
+	char node_name[NODE_NAME_LEN];
+
+	off = fdt_node_offset_by_compatible(fdt, -1, "atmel,hsmci");
+
+	while (off != -FDT_ERR_NOTFOUND) {
+		off = fdt_subnode_offset(fdt, off, "slot");
+		fdt_get_path(fdt, off, node_name, NODE_NAME_LEN);
+		ret = fdt_setprop(fdt, off, "broken-cd", NULL, 0);
+		if (ret < 0) {
+			pr_err("error %d while adding broken-cd property to node %s\n",
+				ret, node_name);
+			return ret;
+		} else {
+			pr_debug("add broken-cd property to node %s\n", node_name);
+		}
+
+		off = fdt_node_offset_by_compatible(fdt, off, "atmel,hsmci");
+	}
+
+	return 0;
+}
+
 void at91sam9x5ek_devices_detect_hw(void)
 {
 	at91sam9x5ek_devices_detect_one("/dev/ds24310");
@@ -237,4 +266,7 @@ void at91sam9x5ek_devices_detect_hw(void)
 	pr_info("sn: 0x%x, rev: 0x%x\n", sn, rev);
 	armlinux_set_revision(rev);
 	armlinux_set_serial(sn);
+
+	if (at91sam9x5ek_cm_is_vendor(VENDOR_COGENT))
+		of_register_fixup(cm_cogent_fixup);
 }
diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c
index 7ba1e25..b3d7ab2 100644
--- a/arch/arm/boards/at91sam9x5ek/init.c
+++ b/arch/arm/boards/at91sam9x5ek/init.c
@@ -36,6 +36,7 @@
 #include <mach/io.h>
 #include <mach/at91_pmc.h>
 #include <mach/at91_rstc.h>
+#include <mach/at91sam9x5_matrix.h>
 #include <gpio_keys.h>
 #include <readkey.h>
 #include <linux/w1-gpio.h>
@@ -88,6 +89,14 @@ static void ek_add_device_nand(void)
 	/* configure chip-select 3 (NAND) */
 	sam9_smc_configure(3, &cm_nand_smc_config);
 
+	if (at91sam9x5ek_cm_is_vendor(VENDOR_COGENT)) {
+		unsigned long csa;
+
+		csa = at91_sys_read(AT91_MATRIX_EBICSA);
+		csa |= AT91_MATRIX_EBI_VDDIOMSEL_1_8V;
+		at91_sys_write(AT91_MATRIX_EBICSA, csa);
+	}
+
 	at91_add_device_nand(&nand_pdata);
 }
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] at91sam9x5ek: use w1 serial number to generate local mac address
  2012-10-31 18:22 ` [PATCH 1/4] at91sam9x5ek: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22   ` [PATCH 2/4] at91sam9x5ek: add hw detection support Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22   ` [PATCH 3/4] at91sam9x5ek: add fixup for cogent cpu module Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-31 18:22   ` Jean-Christophe PLAGNIOL-VILLARD
  2 siblings, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-31 18:22 UTC (permalink / raw)
  To: barebox

The OUI will be 'tml' => 76:6D:6C

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9x5ek/init.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c
index b3d7ab2..78f7349 100644
--- a/arch/arm/boards/at91sam9x5ek/init.c
+++ b/arch/arm/boards/at91sam9x5ek/init.c
@@ -40,6 +40,7 @@
 #include <gpio_keys.h>
 #include <readkey.h>
 #include <linux/w1-gpio.h>
+#include <w1_mac_address.h>
 
 #include "hw_version.h"
 
@@ -105,6 +106,14 @@ static struct at91_ether_platform_data macb_pdata = {
 	.phy_addr = 0,
 };
 
+static void ek_add_device_eth(void)
+{
+	if (w1_local_mac_address_register(0, "tml", "w1-2d-0"))
+		w1_local_mac_address_register(0, "tml", "w1-23-0");
+
+	at91_add_device_eth(0, &macb_pdata);
+}
+
 /*
  * USB Host port
  */
@@ -160,7 +169,7 @@ static int at91sam9x5ek_devices_init(void)
 {
 	ek_add_device_w1();
 	ek_add_device_nand();
-	at91_add_device_eth(0, &macb_pdata);
+	ek_add_device_eth();
 	at91_add_device_usbh_ohci(&ek_usbh_data);
 	ek_add_led();
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support
  2012-10-31 16:52 [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support Jean-Christophe PLAGNIOL-VILLARD
  2012-10-31 18:22 ` [PATCH 1/4] at91sam9x5ek: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-01 15:30 ` Sascha Hauer
  1 sibling, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2012-11-01 15:30 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox, ludovic.desroches

On Wed, Oct 31, 2012 at 05:52:40PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> HI,
> 
> 	This patch serie add the 1-wire support to the at91sam9x5ek
> 
> 	on sam9x5ek we have on each module and motherboard a 1-wire eeprom
> 	that describe the hardware revision and type
> 
> 	And on the Cogent Cpu Module we have some difference with teh others
> 	modules and some bug
> 
> 	So fix
> 
> 	Also use the 1-wire to generate a local mac address
> 
> 	This patch series depends on the pm9g45/pm9263/pm9261 v3
> 
> The following changes since commit 7fb0cb2ce2f7800341ab8de711dccbd2c4753c84:
> 
>   pm9261: use w1 serial number to generate local mac address (2012-10-30 13:44:54 +0800)
> 
> are available in the git repository at:
> 
>   git://git.jcrosoft.org/barebox.git delivery/at91sam9x5ek_w1
> 
> for you to fetch changes up to 4e088306b778a5f14c2503be54b061e60e27e6a0:
> 
>   at91sam9x5ek: use w1 serial number to generate local mac address (2012-10-31 09:33:38 +0800)

Also applied

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-01 15:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-31 16:52 [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support Jean-Christophe PLAGNIOL-VILLARD
2012-10-31 18:22 ` [PATCH 1/4] at91sam9x5ek: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD
2012-10-31 18:22   ` [PATCH 2/4] at91sam9x5ek: add hw detection support Jean-Christophe PLAGNIOL-VILLARD
2012-10-31 18:22   ` [PATCH 3/4] at91sam9x5ek: add fixup for cogent cpu module Jean-Christophe PLAGNIOL-VILLARD
2012-10-31 18:22   ` [PATCH 4/4] at91sam9x5ek: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD
2012-11-01 15:30 ` [PATCH 0/4] at91sam9x5ek: add 1-wire support and hardware detection support Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox