diff mbox series

[3/5] powerpc/boot: Remove support for Marvell mv64x60 i2c controller

Message ID 20180406011720.7728-4-mgreer@animalcreek.com (mailing list archive)
State Accepted
Commit 6bf17a83e6e5980313f88ce3ed937894d9a7a956
Headers show
Series powerpc: Remove support for Marvell mv64x60 hostbridges | expand

Commit Message

Mark Greer April 6, 2018, 1:17 a.m. UTC
There are no longer any platforms that use Marvell's mv64x60's i2c
controller so remove its driver.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
 arch/powerpc/boot/Makefile      |   2 +-
 arch/powerpc/boot/mv64x60_i2c.c | 204 ----------------------------------------
 2 files changed, 1 insertion(+), 205 deletions(-)
 delete mode 100644 arch/powerpc/boot/mv64x60_i2c.c

Comments

Dale Farnsworth April 6, 2018, 4:37 p.m. UTC | #1
Acked-by: Dale Farnsworth <dale@farnsworth.org>

On Thu, Apr 5, 2018 at 6:17 PM, Mark Greer <mgreer@animalcreek.com> wrote:

> There are no longer any platforms that use Marvell's mv64x60's i2c
> controller so remove its driver.
>
> Signed-off-by: Mark Greer <mgreer@animalcreek.com>
> ---
>  arch/powerpc/boot/Makefile      |   2 +-
>  arch/powerpc/boot/mv64x60_i2c.c | 204 ------------------------------
> ----------
>  2 files changed, 1 insertion(+), 205 deletions(-)
>  delete mode 100644 arch/powerpc/boot/mv64x60_i2c.c
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 58f2dbfba275..bf6a46055ba7 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -120,7 +120,7 @@ src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
>  src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
>  src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c
>  src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
> -src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c
> fsl-soc.c
> +src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c ugecon.c fsl-soc.c
>  src-wlib-$(CONFIG_XILINX_VIRTEX) += uartlite.c
>  src-wlib-$(CONFIG_CPM) += cpm-serial.c
>
> diff --git a/arch/powerpc/boot/mv64x60_i2c.c b/arch/powerpc/boot/mv64x60_
> i2c.c
> deleted file mode 100644
> index 52a3212b6638..000000000000
> --- a/arch/powerpc/boot/mv64x60_i2c.c
> +++ /dev/null
> @@ -1,204 +0,0 @@
> -/*
> - * Bootloader version of the i2c driver for the MV64x60.
> - *
> - * Author: Dale Farnsworth <dfarnsworth@mvista.com>
> - * Maintained by: Mark A. Greer <mgreer@mvista.com>
> - *
> - * 2003, 2007 (c) MontaVista, Software, Inc.  This file is licensed under
> - * the terms of the GNU General Public License version 2.  This program is
> - * licensed "as is" without any warranty of any kind, whether express or
> - * implied.
> - */
> -
> -#include <stdarg.h>
> -#include <stddef.h>
> -#include "types.h"
> -#include "elf.h"
> -#include "page.h"
> -#include "string.h"
> -#include "stdio.h"
> -#include "io.h"
> -#include "ops.h"
> -#include "mv64x60.h"
> -
> -/* Register defines */
> -#define MV64x60_I2C_REG_SLAVE_ADDR                     0x00
> -#define MV64x60_I2C_REG_DATA                           0x04
> -#define MV64x60_I2C_REG_CONTROL                                0x08
> -#define MV64x60_I2C_REG_STATUS                         0x0c
> -#define MV64x60_I2C_REG_BAUD                           0x0c
> -#define MV64x60_I2C_REG_EXT_SLAVE_ADDR                 0x10
> -#define MV64x60_I2C_REG_SOFT_RESET                     0x1c
> -
> -#define MV64x60_I2C_CONTROL_ACK                                0x04
> -#define MV64x60_I2C_CONTROL_IFLG                       0x08
> -#define MV64x60_I2C_CONTROL_STOP                       0x10
> -#define MV64x60_I2C_CONTROL_START                      0x20
> -#define MV64x60_I2C_CONTROL_TWSIEN                     0x40
> -#define MV64x60_I2C_CONTROL_INTEN                      0x80
> -
> -#define MV64x60_I2C_STATUS_BUS_ERR                     0x00
> -#define MV64x60_I2C_STATUS_MAST_START                  0x08
> -#define MV64x60_I2C_STATUS_MAST_REPEAT_START           0x10
> -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_ACK            0x18
> -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_NO_ACK         0x20
> -#define MV64x60_I2C_STATUS_MAST_WR_ACK                 0x28
> -#define MV64x60_I2C_STATUS_MAST_WR_NO_ACK              0x30
> -#define MV64x60_I2C_STATUS_MAST_LOST_ARB               0x38
> -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_ACK            0x40
> -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_NO_ACK         0x48
> -#define MV64x60_I2C_STATUS_MAST_RD_DATA_ACK            0x50
> -#define MV64x60_I2C_STATUS_MAST_RD_DATA_NO_ACK         0x58
> -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_2_ACK          0xd0
> -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_2_NO_ACK       0xd8
> -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_2_ACK          0xe0
> -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_2_NO_ACK       0xe8
> -#define MV64x60_I2C_STATUS_NO_STATUS                   0xf8
> -
> -static u8 *ctlr_base;
> -
> -static int mv64x60_i2c_wait_for_status(int wanted)
> -{
> -       int i;
> -       int status;
> -
> -       for (i=0; i<1000; i++) {
> -               udelay(10);
> -               status = in_le32((u32 *)(ctlr_base +
> MV64x60_I2C_REG_STATUS))
> -                       & 0xff;
> -               if (status == wanted)
> -                       return status;
> -       }
> -       return -status;
> -}
> -
> -static int mv64x60_i2c_control(int control, int status)
> -{
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control &
> 0xff);
> -       return mv64x60_i2c_wait_for_status(status);
> -}
> -
> -static int mv64x60_i2c_read_byte(int control, int status)
> -{
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control &
> 0xff);
> -       if (mv64x60_i2c_wait_for_status(status) < 0)
> -               return -1;
> -       return in_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA)) & 0xff;
> -}
> -
> -static int mv64x60_i2c_write_byte(int data, int control, int status)
> -{
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA), data & 0xff);
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control &
> 0xff);
> -       return mv64x60_i2c_wait_for_status(status);
> -}
> -
> -int mv64x60_i2c_read(u32 devaddr, u8 *buf, u32 offset, u32 offset_size,
> -                u32 count)
> -{
> -       int i;
> -       int data;
> -       int control;
> -       int status;
> -
> -       if (ctlr_base == NULL)
> -               return -1;
> -
> -       /* send reset */
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_SOFT_RESET), 0);
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_SLAVE_ADDR), 0);
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_EXT_SLAVE_ADDR), 0);
> -       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_BAUD), (4 << 3) |
> 0x4);
> -
> -       if (mv64x60_i2c_control(MV64x60_I2C_CONTROL_TWSIEN,
> -                               MV64x60_I2C_STATUS_NO_STATUS) < 0)
> -               return -1;
> -
> -       /* send start */
> -       control = MV64x60_I2C_CONTROL_START | MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_MAST_START;
> -       if (mv64x60_i2c_control(control, status) < 0)
> -               return -1;
> -
> -       /* select device for writing */
> -       data = devaddr & ~0x1;
> -       control = MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_MAST_WR_ADDR_ACK;
> -       if (mv64x60_i2c_write_byte(data, control, status) < 0)
> -               return -1;
> -
> -       /* send offset of data */
> -       control = MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_MAST_WR_ACK;
> -       if (offset_size > 1) {
> -               if (mv64x60_i2c_write_byte(offset >> 8, control, status) <
> 0)
> -                       return -1;
> -       }
> -       if (mv64x60_i2c_write_byte(offset, control, status) < 0)
> -               return -1;
> -
> -       /* resend start */
> -       control = MV64x60_I2C_CONTROL_START | MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_MAST_REPEAT_START;
> -       if (mv64x60_i2c_control(control, status) < 0)
> -               return -1;
> -
> -       /* select device for reading */
> -       data = devaddr | 0x1;
> -       control = MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_MAST_RD_ADDR_ACK;
> -       if (mv64x60_i2c_write_byte(data, control, status) < 0)
> -               return -1;
> -
> -       /* read all but last byte of data */
> -       control = MV64x60_I2C_CONTROL_ACK | MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_MAST_RD_DATA_ACK;
> -
> -       for (i=1; i<count; i++) {
> -               data = mv64x60_i2c_read_byte(control, status);
> -               if (data < 0) {
> -                       printf("errors on iteration %d\n", i);
> -                       return -1;
> -               }
> -               *buf++ = data;
> -       }
> -
> -       /* read last byte of data */
> -       control = MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_MAST_RD_DATA_NO_ACK;
> -       data = mv64x60_i2c_read_byte(control, status);
> -       if (data < 0)
> -               return -1;
> -       *buf++ = data;
> -
> -       /* send stop */
> -       control = MV64x60_I2C_CONTROL_STOP | MV64x60_I2C_CONTROL_TWSIEN;
> -       status = MV64x60_I2C_STATUS_NO_STATUS;
> -       if (mv64x60_i2c_control(control, status) < 0)
> -               return -1;
> -
> -       return count;
> -}
> -
> -int mv64x60_i2c_open(void)
> -{
> -       u32 v;
> -       void *devp;
> -
> -       devp = find_node_by_compatible(NULL, "marvell,mv64360-i2c");
> -       if (devp == NULL)
> -               goto err_out;
> -       if (getprop(devp, "virtual-reg", &v, sizeof(v)) != sizeof(v))
> -               goto err_out;
> -
> -       ctlr_base = (u8 *)v;
> -       return 0;
> -
> -err_out:
> -       return -1;
> -}
> -
> -void mv64x60_i2c_close(void)
> -{
> -       ctlr_base = NULL;
> -}
> --
> 2.16.2
>
>
<div dir="ltr">Acked-by: Dale Farnsworth &lt;<a href="mailto:dale@farnsworth.org">dale@farnsworth.org</a>&gt;<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 5, 2018 at 6:17 PM, Mark Greer <span dir="ltr">&lt;<a href="mailto:mgreer@animalcreek.com" target="_blank">mgreer@animalcreek.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There are no longer any platforms that use Marvell&#39;s mv64x60&#39;s i2c<br>
controller so remove its driver.<br>
<br>
Signed-off-by: Mark Greer &lt;<a href="mailto:mgreer@animalcreek.com">mgreer@animalcreek.com</a>&gt;<br>
---<br>
 arch/powerpc/boot/Makefile      |   2 +-<br>
 arch/powerpc/boot/mv64x60_i2c.<wbr>c | 204 ------------------------------<wbr>----------<br>
 2 files changed, 1 insertion(+), 205 deletions(-)<br>
 delete mode 100644 arch/powerpc/boot/mv64x60_i2c.<wbr>c<br>
<br>
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile<br>
index 58f2dbfba275..bf6a46055ba7 100644<br>
--- a/arch/powerpc/boot/Makefile<br>
+++ b/arch/powerpc/boot/Makefile<br>
@@ -120,7 +120,7 @@ src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c<br>
 src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c<br>
 src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c<br>
 src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c<br>
-src-wlib-$(CONFIG_<wbr>EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c<br>
+src-wlib-$(CONFIG_<wbr>EMBEDDED6xx) += mv64x60.c ugecon.c fsl-soc.c<br>
 src-wlib-$(CONFIG_XILINX_<wbr>VIRTEX) += uartlite.c<br>
 src-wlib-$(CONFIG_CPM) += cpm-serial.c<br>
<br>
diff --git a/arch/powerpc/boot/mv64x60_<wbr>i2c.c b/arch/powerpc/boot/mv64x60_<wbr>i2c.c<br>
deleted file mode 100644<br>
index 52a3212b6638..000000000000<br>
--- a/arch/powerpc/boot/mv64x60_<wbr>i2c.c<br>
+++ /dev/null<br>
@@ -1,204 +0,0 @@<br>
-/*<br>
- * Bootloader version of the i2c driver for the MV64x60.<br>
- *<br>
- * Author: Dale Farnsworth &lt;<a href="mailto:dfarnsworth@mvista.com">dfarnsworth@mvista.com</a>&gt;<br>
- * Maintained by: Mark A. Greer &lt;<a href="mailto:mgreer@mvista.com">mgreer@mvista.com</a>&gt;<br>
- *<br>
- * 2003, 2007 (c) MontaVista, Software, Inc.  This file is licensed under<br>
- * the terms of the GNU General Public License version 2.  This program is<br>
- * licensed &quot;as is&quot; without any warranty of any kind, whether express or<br>
- * implied.<br>
- */<br>
-<br>
-#include &lt;stdarg.h&gt;<br>
-#include &lt;stddef.h&gt;<br>
-#include &quot;types.h&quot;<br>
-#include &quot;elf.h&quot;<br>
-#include &quot;page.h&quot;<br>
-#include &quot;string.h&quot;<br>
-#include &quot;stdio.h&quot;<br>
-#include &quot;io.h&quot;<br>
-#include &quot;ops.h&quot;<br>
-#include &quot;mv64x60.h&quot;<br>
-<br>
-/* Register defines */<br>
-#define MV64x60_I2C_REG_SLAVE_ADDR                     0x00<br>
-#define MV64x60_I2C_REG_DATA                           0x04<br>
-#define MV64x60_I2C_REG_CONTROL                                0x08<br>
-#define MV64x60_I2C_REG_STATUS                         0x0c<br>
-#define MV64x60_I2C_REG_BAUD                           0x0c<br>
-#define MV64x60_I2C_REG_EXT_SLAVE_ADDR                 0x10<br>
-#define MV64x60_I2C_REG_SOFT_RESET                     0x1c<br>
-<br>
-#define MV64x60_I2C_CONTROL_ACK                                0x04<br>
-#define MV64x60_I2C_CONTROL_IFLG                       0x08<br>
-#define MV64x60_I2C_CONTROL_STOP                       0x10<br>
-#define MV64x60_I2C_CONTROL_START                      0x20<br>
-#define MV64x60_I2C_CONTROL_TWSIEN                     0x40<br>
-#define MV64x60_I2C_CONTROL_INTEN                      0x80<br>
-<br>
-#define MV64x60_I2C_STATUS_BUS_ERR                     0x00<br>
-#define MV64x60_I2C_STATUS_MAST_START                  0x08<br>
-#define MV64x60_I2C_STATUS_MAST_<wbr>REPEAT_START           0x10<br>
-#define MV64x60_I2C_STATUS_MAST_WR_<wbr>ADDR_ACK            0x18<br>
-#define MV64x60_I2C_STATUS_MAST_WR_<wbr>ADDR_NO_ACK         0x20<br>
-#define MV64x60_I2C_STATUS_MAST_WR_ACK                 0x28<br>
-#define MV64x60_I2C_STATUS_MAST_WR_NO_<wbr>ACK              0x30<br>
-#define MV64x60_I2C_STATUS_MAST_LOST_<wbr>ARB               0x38<br>
-#define MV64x60_I2C_STATUS_MAST_RD_<wbr>ADDR_ACK            0x40<br>
-#define MV64x60_I2C_STATUS_MAST_RD_<wbr>ADDR_NO_ACK         0x48<br>
-#define MV64x60_I2C_STATUS_MAST_RD_<wbr>DATA_ACK            0x50<br>
-#define MV64x60_I2C_STATUS_MAST_RD_<wbr>DATA_NO_ACK         0x58<br>
-#define MV64x60_I2C_STATUS_MAST_WR_<wbr>ADDR_2_ACK          0xd0<br>
-#define MV64x60_I2C_STATUS_MAST_WR_<wbr>ADDR_2_NO_ACK       0xd8<br>
-#define MV64x60_I2C_STATUS_MAST_RD_<wbr>ADDR_2_ACK          0xe0<br>
-#define MV64x60_I2C_STATUS_MAST_RD_<wbr>ADDR_2_NO_ACK       0xe8<br>
-#define MV64x60_I2C_STATUS_NO_STATUS                   0xf8<br>
-<br>
-static u8 *ctlr_base;<br>
-<br>
-static int mv64x60_i2c_wait_for_status(<wbr>int wanted)<br>
-{<br>
-       int i;<br>
-       int status;<br>
-<br>
-       for (i=0; i&lt;1000; i++) {<br>
-               udelay(10);<br>
-               status = in_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_STATUS))<br>
-                       &amp; 0xff;<br>
-               if (status == wanted)<br>
-                       return status;<br>
-       }<br>
-       return -status;<br>
-}<br>
-<br>
-static int mv64x60_i2c_control(int control, int status)<br>
-{<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control &amp; 0xff);<br>
-       return mv64x60_i2c_wait_for_status(<wbr>status);<br>
-}<br>
-<br>
-static int mv64x60_i2c_read_byte(int control, int status)<br>
-{<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control &amp; 0xff);<br>
-       if (mv64x60_i2c_wait_for_status(<wbr>status) &lt; 0)<br>
-               return -1;<br>
-       return in_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA)) &amp; 0xff;<br>
-}<br>
-<br>
-static int mv64x60_i2c_write_byte(int data, int control, int status)<br>
-{<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA), data &amp; 0xff);<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control &amp; 0xff);<br>
-       return mv64x60_i2c_wait_for_status(<wbr>status);<br>
-}<br>
-<br>
-int mv64x60_i2c_read(u32 devaddr, u8 *buf, u32 offset, u32 offset_size,<br>
-                u32 count)<br>
-{<br>
-       int i;<br>
-       int data;<br>
-       int control;<br>
-       int status;<br>
-<br>
-       if (ctlr_base == NULL)<br>
-               return -1;<br>
-<br>
-       /* send reset */<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_SOFT_RESET), 0);<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_SLAVE_ADDR), 0);<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_EXT_SLAVE_<wbr>ADDR), 0);<br>
-       out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_BAUD), (4 &lt;&lt; 3) | 0x4);<br>
-<br>
-       if (mv64x60_i2c_control(MV64x60_<wbr>I2C_CONTROL_TWSIEN,<br>
-                               MV64x60_I2C_STATUS_NO_STATUS) &lt; 0)<br>
-               return -1;<br>
-<br>
-       /* send start */<br>
-       control = MV64x60_I2C_CONTROL_START | MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_MAST_START;<br>
-       if (mv64x60_i2c_control(control, status) &lt; 0)<br>
-               return -1;<br>
-<br>
-       /* select device for writing */<br>
-       data = devaddr &amp; ~0x1;<br>
-       control = MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_MAST_WR_<wbr>ADDR_ACK;<br>
-       if (mv64x60_i2c_write_byte(data, control, status) &lt; 0)<br>
-               return -1;<br>
-<br>
-       /* send offset of data */<br>
-       control = MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_MAST_WR_<wbr>ACK;<br>
-       if (offset_size &gt; 1) {<br>
-               if (mv64x60_i2c_write_byte(offset &gt;&gt; 8, control, status) &lt; 0)<br>
-                       return -1;<br>
-       }<br>
-       if (mv64x60_i2c_write_byte(<wbr>offset, control, status) &lt; 0)<br>
-               return -1;<br>
-<br>
-       /* resend start */<br>
-       control = MV64x60_I2C_CONTROL_START | MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_MAST_<wbr>REPEAT_START;<br>
-       if (mv64x60_i2c_control(control, status) &lt; 0)<br>
-               return -1;<br>
-<br>
-       /* select device for reading */<br>
-       data = devaddr | 0x1;<br>
-       control = MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_MAST_RD_<wbr>ADDR_ACK;<br>
-       if (mv64x60_i2c_write_byte(data, control, status) &lt; 0)<br>
-               return -1;<br>
-<br>
-       /* read all but last byte of data */<br>
-       control = MV64x60_I2C_CONTROL_ACK | MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_MAST_RD_<wbr>DATA_ACK;<br>
-<br>
-       for (i=1; i&lt;count; i++) {<br>
-               data = mv64x60_i2c_read_byte(control, status);<br>
-               if (data &lt; 0) {<br>
-                       printf(&quot;errors on iteration %d\n&quot;, i);<br>
-                       return -1;<br>
-               }<br>
-               *buf++ = data;<br>
-       }<br>
-<br>
-       /* read last byte of data */<br>
-       control = MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_MAST_RD_<wbr>DATA_NO_ACK;<br>
-       data = mv64x60_i2c_read_byte(control, status);<br>
-       if (data &lt; 0)<br>
-               return -1;<br>
-       *buf++ = data;<br>
-<br>
-       /* send stop */<br>
-       control = MV64x60_I2C_CONTROL_STOP | MV64x60_I2C_CONTROL_TWSIEN;<br>
-       status = MV64x60_I2C_STATUS_NO_STATUS;<br>
-       if (mv64x60_i2c_control(control, status) &lt; 0)<br>
-               return -1;<br>
-<br>
-       return count;<br>
-}<br>
-<br>
-int mv64x60_i2c_open(void)<br>
-{<br>
-       u32 v;<br>
-       void *devp;<br>
-<br>
-       devp = find_node_by_compatible(NULL, &quot;marvell,mv64360-i2c&quot;);<br>
-       if (devp == NULL)<br>
-               goto err_out;<br>
-       if (getprop(devp, &quot;virtual-reg&quot;, &amp;v, sizeof(v)) != sizeof(v))<br>
-               goto err_out;<br>
-<br>
-       ctlr_base = (u8 *)v;<br>
-       return 0;<br>
-<br>
-err_out:<br>
-       return -1;<br>
-}<br>
-<br>
-void mv64x60_i2c_close(void)<br>
-{<br>
-       ctlr_base = NULL;<br>
-}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.16.2<br>
<br>
</font></span></blockquote></div><br></div></div>
diff mbox series

Patch

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 58f2dbfba275..bf6a46055ba7 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -120,7 +120,7 @@  src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
 src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
 src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c
 src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
-src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c
+src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c ugecon.c fsl-soc.c
 src-wlib-$(CONFIG_XILINX_VIRTEX) += uartlite.c
 src-wlib-$(CONFIG_CPM) += cpm-serial.c
 
diff --git a/arch/powerpc/boot/mv64x60_i2c.c b/arch/powerpc/boot/mv64x60_i2c.c
deleted file mode 100644
index 52a3212b6638..000000000000
--- a/arch/powerpc/boot/mv64x60_i2c.c
+++ /dev/null
@@ -1,204 +0,0 @@ 
-/*
- * Bootloader version of the i2c driver for the MV64x60.
- *
- * Author: Dale Farnsworth <dfarnsworth@mvista.com>
- * Maintained by: Mark A. Greer <mgreer@mvista.com>
- *
- * 2003, 2007 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program is
- * licensed "as is" without any warranty of any kind, whether express or
- * implied.
- */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include "types.h"
-#include "elf.h"
-#include "page.h"
-#include "string.h"
-#include "stdio.h"
-#include "io.h"
-#include "ops.h"
-#include "mv64x60.h"
-
-/* Register defines */
-#define MV64x60_I2C_REG_SLAVE_ADDR			0x00
-#define MV64x60_I2C_REG_DATA				0x04
-#define MV64x60_I2C_REG_CONTROL				0x08
-#define MV64x60_I2C_REG_STATUS				0x0c
-#define MV64x60_I2C_REG_BAUD				0x0c
-#define MV64x60_I2C_REG_EXT_SLAVE_ADDR			0x10
-#define MV64x60_I2C_REG_SOFT_RESET			0x1c
-
-#define MV64x60_I2C_CONTROL_ACK				0x04
-#define MV64x60_I2C_CONTROL_IFLG			0x08
-#define MV64x60_I2C_CONTROL_STOP			0x10
-#define MV64x60_I2C_CONTROL_START			0x20
-#define MV64x60_I2C_CONTROL_TWSIEN			0x40
-#define MV64x60_I2C_CONTROL_INTEN			0x80
-
-#define MV64x60_I2C_STATUS_BUS_ERR			0x00
-#define MV64x60_I2C_STATUS_MAST_START			0x08
-#define MV64x60_I2C_STATUS_MAST_REPEAT_START		0x10
-#define MV64x60_I2C_STATUS_MAST_WR_ADDR_ACK		0x18
-#define MV64x60_I2C_STATUS_MAST_WR_ADDR_NO_ACK		0x20
-#define MV64x60_I2C_STATUS_MAST_WR_ACK			0x28
-#define MV64x60_I2C_STATUS_MAST_WR_NO_ACK		0x30
-#define MV64x60_I2C_STATUS_MAST_LOST_ARB		0x38
-#define MV64x60_I2C_STATUS_MAST_RD_ADDR_ACK		0x40
-#define MV64x60_I2C_STATUS_MAST_RD_ADDR_NO_ACK		0x48
-#define MV64x60_I2C_STATUS_MAST_RD_DATA_ACK		0x50
-#define MV64x60_I2C_STATUS_MAST_RD_DATA_NO_ACK		0x58
-#define MV64x60_I2C_STATUS_MAST_WR_ADDR_2_ACK		0xd0
-#define MV64x60_I2C_STATUS_MAST_WR_ADDR_2_NO_ACK	0xd8
-#define MV64x60_I2C_STATUS_MAST_RD_ADDR_2_ACK		0xe0
-#define MV64x60_I2C_STATUS_MAST_RD_ADDR_2_NO_ACK	0xe8
-#define MV64x60_I2C_STATUS_NO_STATUS			0xf8
-
-static u8 *ctlr_base;
-
-static int mv64x60_i2c_wait_for_status(int wanted)
-{
-	int i;
-	int status;
-
-	for (i=0; i<1000; i++) {
-		udelay(10);
-		status = in_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_STATUS))
-			& 0xff;
-		if (status == wanted)
-			return status;
-	}
-	return -status;
-}
-
-static int mv64x60_i2c_control(int control, int status)
-{
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control & 0xff);
-	return mv64x60_i2c_wait_for_status(status);
-}
-
-static int mv64x60_i2c_read_byte(int control, int status)
-{
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control & 0xff);
-	if (mv64x60_i2c_wait_for_status(status) < 0)
-		return -1;
-	return in_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA)) & 0xff;
-}
-
-static int mv64x60_i2c_write_byte(int data, int control, int status)
-{
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA), data & 0xff);
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control & 0xff);
-	return mv64x60_i2c_wait_for_status(status);
-}
-
-int mv64x60_i2c_read(u32 devaddr, u8 *buf, u32 offset, u32 offset_size,
-		 u32 count)
-{
-	int i;
-	int data;
-	int control;
-	int status;
-
-	if (ctlr_base == NULL)
-		return -1;
-
-	/* send reset */
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_SOFT_RESET), 0);
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_SLAVE_ADDR), 0);
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_EXT_SLAVE_ADDR), 0);
-	out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_BAUD), (4 << 3) | 0x4);
-
-	if (mv64x60_i2c_control(MV64x60_I2C_CONTROL_TWSIEN,
-				MV64x60_I2C_STATUS_NO_STATUS) < 0)
-		return -1;
-
-	/* send start */
-	control = MV64x60_I2C_CONTROL_START | MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_MAST_START;
-	if (mv64x60_i2c_control(control, status) < 0)
-		return -1;
-
-	/* select device for writing */
-	data = devaddr & ~0x1;
-	control = MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_MAST_WR_ADDR_ACK;
-	if (mv64x60_i2c_write_byte(data, control, status) < 0)
-		return -1;
-
-	/* send offset of data */
-	control = MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_MAST_WR_ACK;
-	if (offset_size > 1) {
-		if (mv64x60_i2c_write_byte(offset >> 8, control, status) < 0)
-			return -1;
-	}
-	if (mv64x60_i2c_write_byte(offset, control, status) < 0)
-		return -1;
-
-	/* resend start */
-	control = MV64x60_I2C_CONTROL_START | MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_MAST_REPEAT_START;
-	if (mv64x60_i2c_control(control, status) < 0)
-		return -1;
-
-	/* select device for reading */
-	data = devaddr | 0x1;
-	control = MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_MAST_RD_ADDR_ACK;
-	if (mv64x60_i2c_write_byte(data, control, status) < 0)
-		return -1;
-
-	/* read all but last byte of data */
-	control = MV64x60_I2C_CONTROL_ACK | MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_MAST_RD_DATA_ACK;
-
-	for (i=1; i<count; i++) {
-		data = mv64x60_i2c_read_byte(control, status);
-		if (data < 0) {
-			printf("errors on iteration %d\n", i);
-			return -1;
-		}
-		*buf++ = data;
-	}
-
-	/* read last byte of data */
-	control = MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_MAST_RD_DATA_NO_ACK;
-	data = mv64x60_i2c_read_byte(control, status);
-	if (data < 0)
-		return -1;
-	*buf++ = data;
-
-	/* send stop */
-	control = MV64x60_I2C_CONTROL_STOP | MV64x60_I2C_CONTROL_TWSIEN;
-	status = MV64x60_I2C_STATUS_NO_STATUS;
-	if (mv64x60_i2c_control(control, status) < 0)
-		return -1;
-
-	return count;
-}
-
-int mv64x60_i2c_open(void)
-{
-	u32 v;
-	void *devp;
-
-	devp = find_node_by_compatible(NULL, "marvell,mv64360-i2c");
-	if (devp == NULL)
-		goto err_out;
-	if (getprop(devp, "virtual-reg", &v, sizeof(v)) != sizeof(v))
-		goto err_out;
-
-	ctlr_base = (u8 *)v;
-	return 0;
-
-err_out:
-	return -1;
-}
-
-void mv64x60_i2c_close(void)
-{
-	ctlr_base = NULL;
-}