From 5c32de202b622c6ffca541fe3b7153bd8e9f626c Mon Sep 17 00:00:00 2001
From: Vipul Kumar <vipul.kumar@xilinx.com>
Date: Fri, 16 Feb 2018 19:07:21 +0530
Subject: [PATCH] i2c: Added Kconfig support for CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET

This patch added Kconfig support for CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET
and enabled it in respective defconfig.

Signed-off-by: Vipul Kumar <vipulk@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 configs/syzygy_hub_defconfig                  | 1 +
 configs/xilinx_zynqmp_zcu102_rev1_0_defconfig | 1 +
 configs/xilinx_zynqmp_zcu102_revA_defconfig   | 1 +
 configs/xilinx_zynqmp_zcu102_revB_defconfig   | 1 +
 configs/zynq_zybo_defconfig                   | 1 +
 drivers/misc/Kconfig                          | 6 ++++++
 include/configs/syzygy_hub.h                  | 1 -
 include/configs/xilinx_zynqmp_zcu102.h        | 1 -
 include/configs/zynq_zybo.h                   | 1 -
 9 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/configs/syzygy_hub_defconfig b/configs/syzygy_hub_defconfig
index 019088410d..e611498bc3 100644
--- a/configs/syzygy_hub_defconfig
+++ b/configs/syzygy_hub_defconfig
@@ -36,6 +36,7 @@ CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQPL=y
 CONFIG_DM_GPIO=y
 CONFIG_SYS_I2C_ZYNQ=y
+CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0xFA
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ZYNQ=y
 CONFIG_PHY_MARVELL=y
diff --git a/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig b/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig
index 12a0d645ac..02cd71038f 100644
--- a/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig
+++ b/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig
@@ -55,6 +55,7 @@ CONFIG_DM_GPIO=y
 CONFIG_CMD_PCA953X=y
 CONFIG_SYS_I2C_ZYNQ=y
 CONFIG_MISC=y
+CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0x20
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ZYNQ=y
diff --git a/configs/xilinx_zynqmp_zcu102_revA_defconfig b/configs/xilinx_zynqmp_zcu102_revA_defconfig
index b6e8a0e01c..9176e8e702 100644
--- a/configs/xilinx_zynqmp_zcu102_revA_defconfig
+++ b/configs/xilinx_zynqmp_zcu102_revA_defconfig
@@ -55,6 +55,7 @@ CONFIG_DM_GPIO=y
 CONFIG_CMD_PCA953X=y
 CONFIG_SYS_I2C_ZYNQ=y
 CONFIG_MISC=y
+CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0x20
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ZYNQ=y
diff --git a/configs/xilinx_zynqmp_zcu102_revB_defconfig b/configs/xilinx_zynqmp_zcu102_revB_defconfig
index c5bc4cdb63..3c2a865e30 100644
--- a/configs/xilinx_zynqmp_zcu102_revB_defconfig
+++ b/configs/xilinx_zynqmp_zcu102_revB_defconfig
@@ -55,6 +55,7 @@ CONFIG_DM_GPIO=y
 CONFIG_CMD_PCA953X=y
 CONFIG_SYS_I2C_ZYNQ=y
 CONFIG_MISC=y
+CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0x20
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ZYNQ=y
diff --git a/configs/zynq_zybo_defconfig b/configs/zynq_zybo_defconfig
index 57b39a282f..202bf724f3 100644
--- a/configs/zynq_zybo_defconfig
+++ b/configs/zynq_zybo_defconfig
@@ -41,6 +41,7 @@ CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQPL=y
 CONFIG_DM_GPIO=y
 CONFIG_SYS_I2C_ZYNQ=y
+CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0xFA
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ZYNQ=y
 CONFIG_SPI_FLASH=y
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index f1c15cb9fa..d774569cbc 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -214,6 +214,12 @@ config SPL_I2C_EEPROM
 	  This option is an SPL-variant of the I2C_EEPROM option.
 	  See the help of I2C_EEPROM for details.
 
+config ZYNQ_GEM_I2C_MAC_OFFSET
+	hex "Set the I2C MAC offset"
+	default 0x0
+	help
+	  Set the MAC offset for i2C.
+
 if I2C_EEPROM
 
 config SYS_I2C_EEPROM_ADDR
diff --git a/include/configs/syzygy_hub.h b/include/configs/syzygy_hub.h
index 4147b45ef0..19e201f955 100644
--- a/include/configs/syzygy_hub.h
+++ b/include/configs/syzygy_hub.h
@@ -14,7 +14,6 @@
 #define CONFIG_ZYNQ_I2C1
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_ZYNQ_GEM_EEPROM_ADDR    0x57
-#define CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET 0xFA
 
 #define CONFIG_EXTRA_ENV_SETTINGS       \
 	"fit_image=fit.itb\0"		\
diff --git a/include/configs/xilinx_zynqmp_zcu102.h b/include/configs/xilinx_zynqmp_zcu102.h
index 88819c6cc1..0095f61ea3 100644
--- a/include/configs/xilinx_zynqmp_zcu102.h
+++ b/include/configs/xilinx_zynqmp_zcu102.h
@@ -43,7 +43,6 @@
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
 #define CONFIG_ZYNQ_EEPROM_BUS		5
 #define CONFIG_ZYNQ_GEM_EEPROM_ADDR	0x54
-#define CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET	0x20
 
 #include <configs/xilinx_zynqmp.h>
 
diff --git a/include/configs/zynq_zybo.h b/include/configs/zynq_zybo.h
index 808967cee3..a589c92d97 100644
--- a/include/configs/zynq_zybo.h
+++ b/include/configs/zynq_zybo.h
@@ -15,7 +15,6 @@
 #define CONFIG_ZYNQ_I2C1
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
 #define CONFIG_ZYNQ_GEM_EEPROM_ADDR	0x50
-#define CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET	0xFA
 #define CONFIG_DISPLAY
 #define CONFIG_I2C_EDID
 
-- 
2.39.5