summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu J. Poirier <mathieu.poirier@linaro.org>2011-05-04 13:02:23 -0600
committerMathieu J. Poirier <mathieu.poirier@linaro.org>2011-05-16 13:51:17 -0600
commite96b2e8163c6693ffc46ddbd222e3b169ff835d4 (patch)
tree58f3e802bff4db9d026e39699d1d273b3e046c70
parent446d8193c1b3752bff199d5eba4aaf367d95e9fd (diff)
downloadu-boot-lt-ux500-e96b2e8163c6693ffc46ddbd222e3b169ff835d4.tar.gz
Enabling 3V6 for BGF combo chip.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Conflicts: board/st/u8500/u8500.c
-rw-r--r--board/st/u8500/u8500.c130
1 files changed, 97 insertions, 33 deletions
diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c
index bff0a7937..1685e52e8 100644
--- a/board/st/u8500/u8500.c
+++ b/board/st/u8500/u8500.c
@@ -531,13 +531,98 @@ out:
return ret;
}
#endif
+
+static int snowball_raise_ab8500_gpio26(void)
+{
+ int ret;
+
+ /* For snowball (aka "minikit") we need to raise AB8500's GPIO26 */
+ ret = ab8500_read(AB8500_MISC, AB8500_GPIO_DIR4_REG);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ ret |= 0x2;
+ ret = ab8500_write(AB8500_MISC, AB8500_GPIO_DIR4_REG, ret);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ ret = ab8500_read(AB8500_MISC, AB8500_GPIO_OUT4_REG);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ ret |= 0x2;
+ ret = ab8500_write(AB8500_MISC, AB8500_GPIO_OUT4_REG, ret);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ }
+
+out:
+ return ret;
+}
+
+
+static int snowball_raise_ab8500_gpio16(void)
+{
+ int ret;
+
+ /* selection */
+ ret = ab8500_read(AB8500_MISC, AB8500_GPIO_SEL2_REG);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ ret |= 0x80;
+ ret = ab8500_write(AB8500_MISC, AB8500_GPIO_SEL2_REG, ret);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ /* direction */
+ ret = ab8500_read(AB8500_MISC, AB8500_GPIO_DIR2_REG);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ ret |= 0x80;
+ ret = ab8500_write(AB8500_MISC, AB8500_GPIO_DIR2_REG, ret);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ /* out */
+ ret = ab8500_read(AB8500_MISC, AB8500_GPIO_OUT2_REG);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+ ret |= 0x80;
+ ret = ab8500_write(AB8500_MISC, AB8500_GPIO_OUT2_REG, ret);
+ if (ret < 0) {
+ printf("error at %s:%i\n", __func__, __LINE__);
+ goto out;
+ }
+
+out:
+ return ret;
+}
+
/*
* Called after all initialisation was done.
*/
int board_late_init(void)
{
uchar byte;
- int ret;
#ifdef CONFIG_MMC
uchar byte_array[] = {0x06, 0x06};
#endif
@@ -552,44 +637,23 @@ int board_late_init(void)
setenv("board_id", "1");
if (u8500_is_snowball()) {
- /* For snowball (aka "minikit") we need to raise AB8500's GPIO26 */
- ret = ab8500_read(AB8500_MISC, AB8500_GPIO_DIR4_REG);
- if (ret < 0) {
- printf("error at %s:%i\n", __func__, __LINE__);
- goto out;
- }
+ /* enable 3V3 for LAN controller */
+ if(snowball_raise_ab8500_gpio26() >= 0) {
- ret |= 0x2;
- ret = ab8500_write(AB8500_MISC, AB8500_GPIO_DIR4_REG, ret);
- if (ret < 0) {
- printf("error at %s:%i\n", __func__, __LINE__);
- goto out;
- }
+ /* Turn on FSMC device */
+ writel(0x1, 0x8000f000);
+ writel(0x1, 0x8000f008);
- ret = ab8500_read(AB8500_MISC, AB8500_GPIO_OUT4_REG);
- if (ret < 0) {
- printf("error at %s:%i\n", __func__, __LINE__);
- goto out;
+ /* setup FSMC for LAN controler */
+ writel(0x305b, 0x80000000);
+ /* the default is too slow */
+ writel(0x01010110, 0x80000004);
}
- ret |= 0x2;
- ret = ab8500_write(AB8500_MISC, AB8500_GPIO_OUT4_REG, ret);
- if (ret < 0) {
- printf("error at %s:%i\n", __func__, __LINE__);
- goto out;
- }
-
- /* Turn on FSMC device */
- writel(0x1, 0x8000f000);
- writel(0x1, 0x8000f008);
-
- /* setup FSMC for LAN controler */
- writel(0x305b, 0x80000000);
- /* the default is too slow */
- writel(0x01010110, 0x80000004);
+ /* enable 3V6 for GBF chip */
+ snowball_raise_ab8500_gpio16();
}
-out:
#ifdef CONFIG_MMC
hrefplus_mmc_power_init();