]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/cpu/mpc5xxx/i2c.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[karo-tx-uboot.git] / arch / powerpc / cpu / mpc5xxx / i2c.c
index 9fb330f82fcc39397c2c8e35da1d1488d8379b13..73601ae184a2fdaa33fe55790e5689426b808ab6 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2003
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -100,14 +84,11 @@ static int wait_for_bb(void)
        status = mpc_reg_in(&regs->msr);
 
        while (timeout-- && (status & I2C_BB)) {
-#if 1
-               volatile int temp;
                mpc_reg_out(&regs->mcr, I2C_STA, I2C_STA);
-               temp = mpc_reg_in(&regs->mdr);
+               (void)mpc_reg_in(&regs->mdr);
                mpc_reg_out(&regs->mcr, 0, I2C_STA);
                mpc_reg_out(&regs->mcr, 0, 0);
                mpc_reg_out(&regs->mcr, I2C_EN, 0);
-#endif
                udelay(15);
                status = mpc_reg_in(&regs->msr);
        }
@@ -313,7 +294,7 @@ static int mpc_get_fdr(int speed)
                        {126, 128}
                };
 
-               ipb = gd->ipb_clk;
+               ipb = gd->arch.ipb_clk;
                for (i = 7; i >= 0; i--) {
                        for (j = 7; j >= 0; j--) {
                                scl = 2 * (scltap[j].scl2tap +
@@ -332,8 +313,7 @@ static int mpc_get_fdr(int speed)
                if (gd->flags & GD_FLG_RELOC) {
                        fdr = divider;
                } else {
-                       if (gd->have_console)
-                               printf("%ld kHz, ", best_speed / 1000);
+                       printf("%ld kHz, ", best_speed / 1000);
                        return divider;
                }
        }
@@ -374,34 +354,29 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len)
        xaddr[3] =  addr        & 0xFF;
 
        if (wait_for_bb()) {
-               if (gd->have_console)
-                       printf("i2c_read: bus is busy\n");
+               printf("i2c_read: bus is busy\n");
                goto Done;
        }
 
        mpc_reg_out(&regs->mcr, I2C_STA, I2C_STA);
        if (do_address(chip, 0)) {
-               if (gd->have_console)
-                       printf("i2c_read: failed to address chip\n");
+               printf("i2c_read: failed to address chip\n");
                goto Done;
        }
 
        if (send_bytes(chip, &xaddr[4-alen], alen)) {
-               if (gd->have_console)
-                       printf("i2c_read: send_bytes failed\n");
+               printf("i2c_read: send_bytes failed\n");
                goto Done;
        }
 
        mpc_reg_out(&regs->mcr, I2C_RSTA, I2C_RSTA);
        if (do_address(chip, 1)) {
-               if (gd->have_console)
-                       printf("i2c_read: failed to address chip\n");
+               printf("i2c_read: failed to address chip\n");
                goto Done;
        }
 
        if (receive_bytes(chip, (char *)buf, len)) {
-               if (gd->have_console)
-                       printf("i2c_read: receive_bytes failed\n");
+               printf("i2c_read: receive_bytes failed\n");
                goto Done;
        }
 
@@ -423,27 +398,23 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
        xaddr[3] =  addr        & 0xFF;
 
        if (wait_for_bb()) {
-               if (gd->have_console)
-                       printf("i2c_write: bus is busy\n");
+               printf("i2c_write: bus is busy\n");
                goto Done;
        }
 
        mpc_reg_out(&regs->mcr, I2C_STA, I2C_STA);
        if (do_address(chip, 0)) {
-               if (gd->have_console)
-                       printf("i2c_write: failed to address chip\n");
+               printf("i2c_write: failed to address chip\n");
                goto Done;
        }
 
        if (send_bytes(chip, &xaddr[4-alen], alen)) {
-               if (gd->have_console)
-                       printf("i2c_write: send_bytes failed\n");
+               printf("i2c_write: send_bytes failed\n");
                goto Done;
        }
 
        if (send_bytes(chip, (char *)buf, len)) {
-               if (gd->have_console)
-                       printf("i2c_write: send_bytes failed\n");
+               printf("i2c_write: send_bytes failed\n");
                goto Done;
        }