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

2018-04-06 Thread Dale Farnsworth
Acked-by: Dale Farnsworth 

On Thu, Apr 5, 2018 at 6:17 PM, Mark Greer  wrote:

> There are no longer any platforms that use Marvell's mv64x60's i2c
> controller so remove its driver.
>
> Signed-off-by: Mark Greer 
> ---
>  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..
> --- 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 
> - * Maintained by: Mark A. Greer 
> - *
> - * 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 
> -#include 
> -#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_CONTROL0x08
> -#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_ACK0x04
> -#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_ACK0x18
> -#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_ACK0x40
> -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_NO_ACK 0x48
> -#define MV64x60_I2C_STATUS_MAST_RD_DATA_ACK0x50
> -#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_R

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

2018-04-05 Thread Mark Greer
There are no longer any platforms that use Marvell's mv64x60's i2c
controller so remove its driver.

Signed-off-by: Mark Greer 
---
 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..
--- 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 
- * Maintained by: Mark A. Greer 
- *
- * 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 
-#include 
-#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_CONTROL0x08
-#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_ACK0x04
-#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_ACK0x18
-#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_ACK0x40
-#define MV64x60_I2C_STATUS_MAST_RD_ADDR_NO_ACK 0x48
-#define MV64x60_I2C_STATUS_MAST_RD_DATA_ACK0x50
-#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