]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
apalis_imx6: pf0100: reorder and cleanup message printing
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>
Fri, 8 Feb 2019 17:12:20 +0000 (18:12 +0100)
committerStefano Babic <sbabic@denx.de>
Sat, 13 Apr 2019 18:30:08 +0000 (20:30 +0200)
Keep debug code at the end of the function.
Use a one line informational message for the PMIC only.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
board/toradex/apalis_imx6/pf0100.c

index 3a944b3699e4d6ec51e281e4dce96d538f940fa6..8106abf89acb256d77bb4c13c896eb9b3a8c19d1 100644 (file)
@@ -35,7 +35,7 @@ unsigned pmic_init(void)
        uchar bus = 1;
        uchar devid, revid, val;
 
-       puts("PMIC: ");
+       puts("PMIC:  ");
        rc = i2c_get_chip_for_busnum(bus, PFUZE100_I2C_ADDR, 1, &dev);
        if (rc) {
                printf("failed to get device for PMIC at address 0x%x\n",
@@ -51,57 +51,8 @@ unsigned pmic_init(void)
                puts("i2c pmic revid read failed\n");
                return 0;
        }
-       printf("device id: 0x%.2x, revision id: 0x%.2x\n", devid, revid);
+       printf("device id: 0x%.2x, revision id: 0x%.2x", devid, revid);
 
-#ifdef DEBUG
-       {
-               unsigned i, j;
-
-               for (i = 0; i < 16; i++)
-                       printf("\t%x", i);
-               for (j = 0; j < 0x80; ) {
-                       printf("\n%2x", j);
-                       for (i = 0; i < 16; i++) {
-                               dm_i2c_read(dev, j + i, &val, 1);
-                               printf("\t%2x", val);
-                       }
-                       j += 0x10;
-               }
-               printf("\nEXT Page 1");
-
-               val = PFUZE100_PAGE_REGISTER_PAGE1;
-               if (dm_i2c_write(dev, PFUZE100_PAGE_REGISTER, &val, 1)) {
-                       puts("i2c write failed\n");
-                       return 0;
-               }
-
-               for (j = 0x80; j < 0x100; ) {
-                       printf("\n%2x", j);
-                       for (i = 0; i < 16; i++) {
-                               dm_i2c_read(dev, j + i, &val, 1);
-                               printf("\t%2x", val);
-                       }
-                       j += 0x10;
-               }
-               printf("\nEXT Page 2");
-
-               val = PFUZE100_PAGE_REGISTER_PAGE2;
-               if (dm_i2c_write(dev, PFUZE100_PAGE_REGISTER, &val, 1)) {
-                       puts("i2c write failed\n");
-                       return 0;
-               }
-
-               for (j = 0x80; j < 0x100; ) {
-                       printf("\n%2x", j);
-                       for (i = 0; i < 16; i++) {
-                               dm_i2c_read(dev, j + i, &val, 1);
-                               printf("\t%2x", val);
-                       }
-                       j += 0x10;
-               }
-               printf("\n");
-       }
-#endif /* DEBUG */
        /* get device programmed state */
        val = PFUZE100_PAGE_REGISTER_PAGE1;
        if (dm_i2c_write(dev, PFUZE100_PAGE_REGISTER, &val, 1)) {
@@ -131,13 +82,13 @@ unsigned pmic_init(void)
 
        switch (programmed) {
        case 0:
-               printf("PMIC: not programmed\n");
+               puts("not programmed\n");
                break;
        case 3:
-               printf("PMIC: programmed\n");
+               puts("programmed\n");
                break;
        default:
-               printf("PMIC: undefined programming state\n");
+               puts("undefined programming state\n");
                break;
        }
 
@@ -155,6 +106,57 @@ unsigned pmic_init(void)
                if (dm_i2c_write(dev, PFUZE100_SWBSTCTL, &val, 1))
                        puts("i2c write failed\n");
        }
+
+#ifdef DEBUG
+       {
+               unsigned int i, j;
+
+               for (i = 0; i < 16; i++)
+                       printf("\t%x", i);
+               for (j = 0; j < 0x80; ) {
+                       printf("\n%2x", j);
+                       for (i = 0; i < 16; i++) {
+                               dm_i2c_read(dev, j + i, &val, 1);
+                               printf("\t%2x", val);
+                       }
+                       j += 0x10;
+               }
+               printf("\nEXT Page 1");
+
+               val = PFUZE100_PAGE_REGISTER_PAGE1;
+               if (dm_i2c_write(dev, PFUZE100_PAGE_REGISTER, &val, 1)) {
+                       puts("i2c write failed\n");
+                       return 0;
+               }
+
+               for (j = 0x80; j < 0x100; ) {
+                       printf("\n%2x", j);
+                       for (i = 0; i < 16; i++) {
+                               dm_i2c_read(dev, j + i, &val, 1);
+                               printf("\t%2x", val);
+                       }
+                       j += 0x10;
+               }
+               printf("\nEXT Page 2");
+
+               val = PFUZE100_PAGE_REGISTER_PAGE2;
+               if (dm_i2c_write(dev, PFUZE100_PAGE_REGISTER, &val, 1)) {
+                       puts("i2c write failed\n");
+                       return 0;
+               }
+
+               for (j = 0x80; j < 0x100; ) {
+                       printf("\n%2x", j);
+                       for (i = 0; i < 16; i++) {
+                               dm_i2c_read(dev, j + i, &val, 1);
+                               printf("\t%2x", val);
+                       }
+                       j += 0x10;
+               }
+               printf("\n");
+       }
+#endif /* DEBUG */
+
        return programmed;
 }