From a80c2f0118d5ed71ab9232bd08ac6400a215239f Mon Sep 17 00:00:00 2001 From: Venkat Raju Sana Date: Thu, 11 Oct 2018 11:37:25 -0700 Subject: [PATCH] ipq6018: Enable i2c subsytem Change-Id: Ia727b07803f738588241b8406f125ec3f9ac1472 Signed-off-by: Venkat Raju Sana --- arch/arm/dts/ipq6018-emulation.dts | 27 +++++++++++++++++++++++++ arch/arm/include/asm/arch-ipq6018/clk.h | 22 ++++++++++++++++++++ board/qca/arm/ipq6018/Makefile | 1 + board/qca/arm/ipq6018/clock.c | 23 +++++++++++++++++++++ include/configs/ipq6018.h | 6 ++++++ 5 files changed, 79 insertions(+) create mode 100644 arch/arm/include/asm/arch-ipq6018/clk.h create mode 100644 board/qca/arm/ipq6018/clock.c diff --git a/arch/arm/dts/ipq6018-emulation.dts b/arch/arm/dts/ipq6018-emulation.dts index 14c590a1e1..7829181d94 100644 --- a/arch/arm/dts/ipq6018-emulation.dts +++ b/arch/arm/dts/ipq6018-emulation.dts @@ -21,6 +21,7 @@ aliases { console = "/serial@78af000"; mmc = "/sdhci@7804000"; + i2c0 = "/i2c@78b6000"; }; serial@78af000 { compatible = "qca,ipq-uartdm"; @@ -47,4 +48,30 @@ compatible = "qcom,sdhci-msm"; }; + + i2c0: i2c@78b6000 { + compatible = "qcom,qup-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x78b6000 0x600>; + clock-frequency = <400000>; + + i2c_gpio { + gpio1 { + gpio = <42>; + func = <2>; + pull = ; + drvstr = ; + oe = ; + }; + + gpio2 { + gpio = <43>; + func = <2>; + pull = ; + drvstr = ; + oe = ; + }; + }; + }; }; diff --git a/arch/arm/include/asm/arch-ipq6018/clk.h b/arch/arm/include/asm/arch-ipq6018/clk.h new file mode 100644 index 0000000000..948d067172 --- /dev/null +++ b/arch/arm/include/asm/arch-ipq6018/clk.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2015-2016, 2018 The Linux Foundation. All rights reserved. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + + * 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. + */ + +#ifndef IPQ6018_CLK_H +#define IPQ6018_CLK_H + +/* I2C clocks configuration */ +#ifdef CONFIG_IPQ6018_I2C +void i2c_clock_config(void); +#endif + +#endif /*IPQ6018_CLK_H*/ diff --git a/board/qca/arm/ipq6018/Makefile b/board/qca/arm/ipq6018/Makefile index a31992ebf4..aac7e1c675 100644 --- a/board/qca/arm/ipq6018/Makefile +++ b/board/qca/arm/ipq6018/Makefile @@ -1,4 +1,5 @@ ccflags-y += -I$(srctree)/board/qca/arm/ipq6018 cppflags-y += -I$(srctree)/board/qca/arm/ipq6018 obj-y := ipq6018.o +obj-y += clock.o diff --git a/board/qca/arm/ipq6018/clock.c b/board/qca/arm/ipq6018/clock.c new file mode 100644 index 0000000000..2c445c41bc --- /dev/null +++ b/board/qca/arm/ipq6018/clock.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2015-2016, 2018 The Linux Foundation. All rights reserved. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + + * 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. + */ + +#include +#include + +#ifdef CONFIG_IPQ6018_I2C +void i2c_clock_config(void) +{ + return; +} +#endif + diff --git a/include/configs/ipq6018.h b/include/configs/ipq6018.h index da85c44eb5..25a6199d55 100644 --- a/include/configs/ipq6018.h +++ b/include/configs/ipq6018.h @@ -64,6 +64,12 @@ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE -\ CONFIG_SYS_MALLOC_LEN - CONFIG_ENV_SIZE -\ GENERATED_BD_INFO_SIZE) +#define CONFIG_IPQ6018_I2C 1 +#ifdef CONFIG_IPQ6018_I2C +#define CONFIG_SYS_I2C_QUP +#define CONFIG_CMD_I2C +#define CONFIG_DM_I2C +#endif #define CONFIG_SYS_MAXARGS 16 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \