]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - board/esd/cpci750/i2c.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[karo-tx-uboot.git] / board / esd / cpci750 / i2c.c
index d95567f7df943d61ab1de123658b42695a422b06..bad0dac05d479f000aff9484a7f5ee61c26a5136 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2000
  * 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+
  *
  * Hacked for the DB64360 board by Ingo.Assmus@keymile.com
  * extra improvments by Brain Waite
@@ -27,6 +11,7 @@
 #include <common.h>
 #include <mpc8xx.h>
 #include <malloc.h>
+#include <i2c.h>
 #include "../../Marvell/include/mv_gen_reg.h"
 #include "../../Marvell/include/core.h"
 
@@ -41,7 +26,7 @@
 
 /* Assuming that there is only one master on the bus (us) */
 
-static void i2c_init (int speed, int slaveaddr)
+void i2c_init (int speed, int slaveaddr)
 {
        unsigned int n, m, freq, margin, power;
        unsigned int actualN = 0, actualM = 0;
@@ -375,7 +360,7 @@ i2c_set_dev_offset (uchar dev_addr, unsigned int offset, int ten_bit,
        return 0;               /* sucessful completion */
 }
 
-uchar
+int
 i2c_read (uchar dev_addr, unsigned int offset, int alen, uchar * data,
          int len)
 {
@@ -384,7 +369,8 @@ i2c_read (uchar dev_addr, unsigned int offset, int alen, uchar * data,
 
        DP (puts ("i2c_read\n"));
 
-       i2c_init (i2cFreq, 0);  /* set the i2c frequency */
+       /* set the i2c frequency */
+       i2c_init (i2cFreq, CONFIG_SYS_I2C_SLAVE);
 
        status = i2c_set_dev_offset (dev_addr, offset, 0, alen);        /* send the slave address + offset */
        if (status) {
@@ -423,7 +409,7 @@ void i2c_stop (void)
 }
 
 
-uchar
+int
 i2c_write (uchar dev_addr, unsigned int offset, int alen, uchar * data,
           int len)
 {
@@ -432,7 +418,8 @@ i2c_write (uchar dev_addr, unsigned int offset, int alen, uchar * data,
 
        DP (puts ("i2c_write\n"));
 
-       i2c_init (i2cFreq, 0);  /* set the i2c frequency */
+       /* set the i2c frequency */
+       i2c_init (i2cFreq, CONFIG_SYS_I2C_SLAVE);
 
        status = i2c_set_dev_offset (dev_addr, offset, 0, alen);        /* send the slave address + offset */
        if (status) {
@@ -468,7 +455,8 @@ int i2c_probe (uchar chip)
 
        DP (puts ("i2c_probe\n"));
 
-       i2c_init (i2cFreq, 0);  /* set the i2c frequency */
+       /* set the i2c frequency */
+       i2c_init (i2cFreq, CONFIG_SYS_I2C_SLAVE);
 
        status = i2c_set_dev_offset (chip, 0, 0, 0);    /* send the slave address + no offset */
        if (status) {