mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
ODROID-N2/C4: Amlogic i2c master pinctrl for odroid.
Change-Id: I3a1a931769104de99f87e013a0e488304fdf2c38
This commit is contained in:
@@ -572,9 +572,10 @@
|
||||
|
||||
&i2c2 {
|
||||
status = "okay";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default","gpio_periphs";
|
||||
/* 40 Pin Header : SDA(GPIOX.17->3 Pin), SCL(GPIOX.18->5 Pin) */
|
||||
pinctrl-0 = <&i2c2_master_pins1>;
|
||||
pinctrl-1 = <&i2c2_to_gpiox>;
|
||||
/* default 400k */
|
||||
clock-frequency = <400000>;
|
||||
};
|
||||
|
||||
@@ -312,8 +312,9 @@
|
||||
|
||||
&i2c3 {
|
||||
status = "okay";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default","gpio_periphs";
|
||||
pinctrl-0 = <&i2c3_master_pins2>;
|
||||
pinctrl-1 = <&i2c3_to_gpioa>;
|
||||
clock-frequency = <100000>; /* default 100k */
|
||||
|
||||
pcf8563: rtc@51 {
|
||||
@@ -527,11 +528,27 @@
|
||||
drive-strength = <2>;
|
||||
};
|
||||
};
|
||||
i2c2_to_gpiox:i2c2_gpiox {
|
||||
mux {
|
||||
groups = "GPIOX_17",
|
||||
"GPIOX_18";
|
||||
function = "gpio_periphs";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
i2c3_master_pins2:i2c3_pins2 {
|
||||
mux {
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
i2c3_to_gpioa:i2c3_gpioa {
|
||||
mux {
|
||||
groups = "GPIOA_14",
|
||||
"GPIOA_15";
|
||||
function = "gpio_periphs";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
spdifout: spdifout {
|
||||
mux {/* GPIOA_11 */
|
||||
groups = "spdif_out_a11";
|
||||
|
||||
@@ -161,8 +161,17 @@
|
||||
|
||||
&i2c2 {
|
||||
status = "okay";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default","gpio_periphs";
|
||||
pinctrl-0 = <&i2c2_master_pins1>;
|
||||
pinctrl-1 = <&i2c2_to_gpiox>;
|
||||
clock-frequency = <100000>; /* default 100k */
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
status = "okay";
|
||||
pinctrl-names = "default","gpio_periphs";
|
||||
pinctrl-0 = <&i2c3_master_pins2>;
|
||||
pinctrl-1 = <&i2c3_to_gpioa>;
|
||||
clock-frequency = <100000>; /* default 100k */
|
||||
};
|
||||
|
||||
@@ -219,11 +228,33 @@
|
||||
};
|
||||
|
||||
&pinctrl_periphs {
|
||||
i2c2_master_pins1: i2c2_pins1 {
|
||||
mux {
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
i2c2_to_gpiox:i2c2_gpiox {
|
||||
mux {
|
||||
groups = "GPIOX_17",
|
||||
"GPIOX_18";
|
||||
function = "gpio_periphs";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
i2c3_master_pins2:i2c3_pins2 {
|
||||
mux {
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
i2c3_to_gpioa:i2c3_gpioa {
|
||||
mux {
|
||||
groups = "GPIOA_14",
|
||||
"GPIOA_15";
|
||||
function = "gpio_periphs";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
|
||||
pwmcd_to_gpios:pwmcd_gpio {
|
||||
mux {
|
||||
groups = "GPIOX_5", "GPIOX_6";
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/types.h>
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#endif
|
||||
|
||||
/* Meson I2C register map */
|
||||
#define REG_CTRL 0x00
|
||||
@@ -116,6 +119,9 @@ struct meson_i2c {
|
||||
|
||||
int retain_fastmode;
|
||||
struct meson_i2c_data *data;
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
struct pinctrl *pinctrl;
|
||||
#endif
|
||||
};
|
||||
|
||||
static void meson_i2c_set_mask(struct meson_i2c *i2c, int reg, u32 mask,
|
||||
@@ -558,6 +564,10 @@ static int meson_i2c_probe(struct platform_device *pdev)
|
||||
i2c->dev = &pdev->dev;
|
||||
platform_set_drvdata(pdev, i2c);
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
i2c->pinctrl = NULL;
|
||||
#endif
|
||||
|
||||
spin_lock_init(&i2c->lock);
|
||||
init_completion(&i2c->done);
|
||||
|
||||
@@ -594,6 +604,14 @@ static int meson_i2c_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
i2c->pinctrl = devm_pinctrl_get_select(&pdev->dev, "default");
|
||||
if (IS_ERR(i2c->pinctrl)) {
|
||||
i2c->pinctrl = NULL;
|
||||
dev_err(&pdev->dev, "i2c pinmux : can't get i2c_pins\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
strlcpy(i2c->adap.name, "Meson I2C adapter",
|
||||
sizeof(i2c->adap.name));
|
||||
i2c->adap.owner = THIS_MODULE;
|
||||
@@ -631,6 +649,18 @@ static int meson_i2c_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct meson_i2c *i2c = platform_get_drvdata(pdev);
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
struct device *dev = &pdev->dev;
|
||||
|
||||
sysfs_remove_file(&dev->kobj, &dev_attr_speed.attr);
|
||||
|
||||
if (i2c->pinctrl)
|
||||
devm_pinctrl_put(i2c->pinctrl);
|
||||
|
||||
i2c->pinctrl = devm_pinctrl_get_select(&pdev->dev, "gpio_periphs");
|
||||
devm_pinctrl_put(i2c->pinctrl);
|
||||
i2c->pinctrl = NULL;
|
||||
#endif
|
||||
i2c_del_adapter(&i2c->adap);
|
||||
clk_unprepare(i2c->clk);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user