summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-23 18:59:13 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-24 13:17:17 +0200
commitd938ae692cfc720210236eccd7910abe15c761c0 (patch)
tree1826a2135820122c17a3beb43a78e03e4b4eea77
parentbe5fadff942ad83aec9a73f34cf39f55bca13a80 (diff)
downloadrockbox-d938ae6.tar.gz
rockbox-d938ae6.zip
imx233: fix ocotop/debug and usb-core for stmp3600
Currently we don't know where the serial number is stored on the stmp3600. It is probably using the laser fuses but this needs to be investigated Change-Id: I1ac25e38b8f65635abb68788ceb65df0a740dabd
-rw-r--r--firmware/target/arm/imx233/debug-imx233.c25
-rw-r--r--firmware/target/arm/imx233/ocotp-imx233.h17
-rw-r--r--firmware/usbstack/usb_core.c3
3 files changed, 36 insertions, 9 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index 76f2c6b066..84d68a780d 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -537,13 +537,13 @@ bool dbg_hw_info_pinctrl(void)
}
}
-#if IMX233_SUBTARGET >= 3700
struct
{
const char *name;
volatile uint32_t *addr;
} dbg_ocotp[] =
{
+#if IMX233_SUBTARGET >= 3700
#define E(n,v) { .name = n, .addr = &v }
E("CUST0", HW_OCOTP_CUSTn(0)), E("CUST1", HW_OCOTP_CUSTn(1)),
E("CUST2", HW_OCOTP_CUSTn(2)), E("CUST0", HW_OCOTP_CUSTn(3)),
@@ -559,6 +559,23 @@ struct
E("ROM2", HW_OCOTP_ROMn(2)), E("ROM3", HW_OCOTP_ROMn(3)),
E("ROM4", HW_OCOTP_ROMn(4)), E("ROM5", HW_OCOTP_ROMn(5)),
E("ROM6", HW_OCOTP_ROMn(6)), E("ROM7", HW_OCOTP_ROMn(7)),
+#undef E
+#else
+#define E(n,v) { .name = n, .addr = &v }
+ E("LASERFUSE0", HW_RTC_LASERFUSEn(0)),
+ E("LASERFUSE1", HW_RTC_LASERFUSEn(1)),
+ E("LASERFUSE2", HW_RTC_LASERFUSEn(2)),
+ E("LASERFUSE3", HW_RTC_LASERFUSEn(3)),
+ E("LASERFUSE4", HW_RTC_LASERFUSEn(4)),
+ E("LASERFUSE5", HW_RTC_LASERFUSEn(5)),
+ E("LASERFUSE6", HW_RTC_LASERFUSEn(6)),
+ E("LASERFUSE7", HW_RTC_LASERFUSEn(7)),
+ E("LASERFUSE8", HW_RTC_LASERFUSEn(8)),
+ E("LASERFUSE9", HW_RTC_LASERFUSEn(9)),
+ E("LASERFUSE10", HW_RTC_LASERFUSEn(10)),
+ E("LASERFUSE11", HW_RTC_LASERFUSEn(11)),
+#undef E
+#endif
};
bool dbg_hw_info_ocotp(void)
@@ -608,12 +625,6 @@ bool dbg_hw_info_ocotp(void)
yield();
}
}
-#else
-bool dbg_hw_info_ocotp(void)
-{
- return true;
-}
-#endif
bool dbg_hw_info_pwm(void)
{
diff --git a/firmware/target/arm/imx233/ocotp-imx233.h b/firmware/target/arm/imx233/ocotp-imx233.h
index 635d7c9267..0827ea0d19 100644
--- a/firmware/target/arm/imx233/ocotp-imx233.h
+++ b/firmware/target/arm/imx233/ocotp-imx233.h
@@ -24,9 +24,12 @@
#include "config.h"
#include "system.h"
-#include "regs/regs-ocotp.h"
+/** STMP3700 and over have OCOTP registers
+ * where STMP3600 has laser fuses. */
#if IMX233_SUBTARGET >= 3700
+#include "regs/regs-ocotp.h"
+
#define IMX233_NUM_OCOTP_CUST 4
#define IMX233_NUM_OCOTP_CRYPTO 4
#define IMX233_NUM_OCOTP_HWCAP 6
@@ -53,6 +56,18 @@ static inline uint32_t imx233_ocotp_read(volatile uint32_t *reg)
imx233_ocotp_open_banks(false);
return val;
}
+#else
+#include "regs/regs-rtc.h"
+
+#define IMX233_NUM_OCOTP_LASERFUSE 12
+
+static inline uint32_t imx233_ocotp_read(volatile uint32_t *reg)
+{
+ BF_WR_V(RTC_UNLOCK, KEY, VAL);
+ uint32_t val = *reg;
+ BF_WR(RTC_UNLOCK, KEY, 0);
+ return val;
+}
#endif
#endif /* OCOTP_IMX233_H */
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index dbc9367dfb..406f2a71e4 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -333,7 +333,8 @@ static void set_serial_descriptor(void)
}
usb_string_iSerial.bLength = 36 + (2 * AS3514_UID_LEN);
}
-#elif (CONFIG_CPU == IMX233)
+#elif (CONFIG_CPU == IMX233) && IMX233_SUBTARGET >= 3700
+// FIXME where is the STMP3600 serial number stored ?
static void set_serial_descriptor(void)
{
short* p = &usb_string_iSerial.wString[1];