[PATCH 3/4] at91sam9x5ek: add fixup for cogent cpu module
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Wed Oct 31 14:22:03 EDT 2012
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 at 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
More information about the barebox
mailing list