Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/samsung Add i2c locators, add a i2c bus indexer...



details:   https://anonhg.NetBSD.org/src/rev/ab393b7168e0
branches:  trunk
changeset: 796010:ab393b7168e0
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri May 16 10:04:58 2014 +0000

description:
Add i2c locators, add a i2c bus indexer and provide function prototype for the
pinset to pindata function.

diffstat:

 sys/arch/arm/samsung/exynos4_loc.c |  23 +++++++++++++++++++++++
 sys/arch/arm/samsung/exynos5_loc.c |  12 ++++++++++++
 sys/arch/arm/samsung/exynos_io.h   |   3 +++
 sys/arch/arm/samsung/exynos_var.h  |  15 +++++++++++++--
 4 files changed, 51 insertions(+), 2 deletions(-)

diffs (126 lines):

diff -r 2f7cc9aef8f8 -r ab393b7168e0 sys/arch/arm/samsung/exynos4_loc.c
--- a/sys/arch/arm/samsung/exynos4_loc.c        Fri May 16 10:02:24 2014 +0000
+++ b/sys/arch/arm/samsung/exynos4_loc.c        Fri May 16 10:04:58 2014 +0000
@@ -265,6 +265,7 @@
 
 static const struct exyo_locators exynos4_locators[] = {
        { "exyogpio", 0, 0, NOPORT, NOINTR, 0 },
+       { "exyoiic", 0, 0, NOPORT, NOINTR, 0 },
        { "mct", OFFANDSIZE(,MCT), NOPORT, IRQ_G0_IRQ, 0 },
        { "exyowdt", OFFANDSIZE(,WDT), NOPORT, IRQ_WDT, 0 },
        { "sscom", OFFANDSIZE(,UART0), 0, IRQ_UART0, 0 },
@@ -278,3 +279,25 @@
        .locators = exynos4_locators,
        .nlocators = __arraycount(exynos4_locators)
 };
+
+
+/* flag signal the use of gpio */
+static const struct exyo_locators exynos4_i2c_locators[] = {
+                                       /* busname, sdabit, slcbit, func */
+       { "iic0", OFFANDSIZE(,I2C0), 0, IRQ_I2C0, 1 , "GPD1", 0, 1, 2 },
+       { "iic1", OFFANDSIZE(,I2C1), 1, IRQ_I2C1, 1 , "GPD1", 2, 3, 2 },
+       { "iic2", OFFANDSIZE(,I2C2), 2, IRQ_I2C2, 1 , "GPA0", 6, 7, 2 },
+       { "iic3", OFFANDSIZE(,I2C3), 3, IRQ_I2C3, 1 , "GPA1", 2, 3, 3 },
+       { "iic4", OFFANDSIZE(,I2C4), 4, IRQ_I2C4, 1 , "GPB",  0, 1, 3 },
+       { "iic5", OFFANDSIZE(,I2C5), 5, IRQ_I2C5, 1 , "GPB",  2, 3, 3 },
+       { "iic6", OFFANDSIZE(,I2C6), 6, IRQ_I2C6, 1 , "GPC1", 3, 4, 4 },
+       { "iic7", OFFANDSIZE(,I2C7), 7, IRQ_I2C7, 1 , "GPD0", 2, 3, 3 },
+       { "iic8", OFFANDSIZE(,I2CHDMI), 8, IRQ_HDMI_I2C, 0 , "", 0, 0, 0 },
+};
+
+
+const struct exyo_locinfo exynos4_i2c_locinfo = {
+       .locators = exynos4_i2c_locators,
+       .nlocators = __arraycount(exynos4_i2c_locators)
+};
+
diff -r 2f7cc9aef8f8 -r ab393b7168e0 sys/arch/arm/samsung/exynos5_loc.c
--- a/sys/arch/arm/samsung/exynos5_loc.c        Fri May 16 10:02:24 2014 +0000
+++ b/sys/arch/arm/samsung/exynos5_loc.c        Fri May 16 10:04:58 2014 +0000
@@ -224,3 +224,15 @@
        .locators = exynos5_locators,
        .nlocators = __arraycount(exynos5_locators)
 };
+
+
+/* flag signal the use of gpio */
+static const struct exyo_locators exynos5_i2c_locators[] = {
+};
+
+
+const struct exyo_locinfo exynos5_i2c_locinfo = {
+       .locators = exynos5_i2c_locators,
+       .nlocators = __arraycount(exynos5_i2c_locators)
+};
+
diff -r 2f7cc9aef8f8 -r ab393b7168e0 sys/arch/arm/samsung/exynos_io.h
--- a/sys/arch/arm/samsung/exynos_io.h  Fri May 16 10:02:24 2014 +0000
+++ b/sys/arch/arm/samsung/exynos_io.h  Fri May 16 10:04:58 2014 +0000
@@ -35,13 +35,16 @@
 
 #include <arm/samsung/exynos_var.h>
 
+
 struct exyo_locinfo {
        const struct exyo_locators *locators;
        size_t nlocators;
 };
 
 extern const struct exyo_locinfo exynos4_locinfo;
+extern const struct exyo_locinfo exynos4_i2c_locinfo;
 extern const struct exyo_locinfo exynos5_locinfo;
+extern const struct exyo_locinfo exynos5_i2c_locinfo;
 
 /* XXXNH needed? */
 #define        NOPORT  EXYOCF_PORT_DEFAULT
diff -r 2f7cc9aef8f8 -r ab393b7168e0 sys/arch/arm/samsung/exynos_var.h
--- a/sys/arch/arm/samsung/exynos_var.h Fri May 16 10:02:24 2014 +0000
+++ b/sys/arch/arm/samsung/exynos_var.h Fri May 16 10:04:58 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_var.h,v 1.8 2014/05/10 20:24:06 reinoud Exp $ */
+/* $NetBSD: exynos_var.h,v 1.9 2014/05/16 10:04:58 reinoud Exp $ */
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -72,6 +72,10 @@
        int loc_port;
        int loc_intr;
        int loc_flags;
+
+       /* for i2c: */
+       const char *loc_gpio_bus;
+       uint8_t loc_sda, loc_slc, loc_func;
 };
 
 #if 0
@@ -97,7 +101,7 @@
 struct exynos_gpio_pinset {
        char pinset_group[10];
        uint8_t pinset_func;
-       uint32_t pinset_mask;
+       uint8_t pinset_mask;
 };
 
 struct exynos_gpio_pindata {
@@ -106,6 +110,11 @@
 };
 
 
+#define EXYNOS_MAX_IIC_BUSSES 9
+struct i2c_controller;
+extern struct i2c_controller *exynos_i2cbus[EXYNOS_MAX_IIC_BUSSES];
+
+
 extern struct bus_space exynos_bs_tag;
 extern struct bus_space exynos_a4x_bs_tag;
 extern struct arm32_bus_dma_tag exynos_bus_dma_tag;
@@ -126,6 +135,8 @@
 extern bool exynos_gpio_pinset_available(const struct exynos_gpio_pinset *);
 extern void exynos_gpio_pinset_acquire(const struct exynos_gpio_pinset *);
 extern void exynos_gpio_pinset_release(const struct exynos_gpio_pinset *);
+extern void exynos_gpio_pinset_to_pindata(const struct exynos_gpio_pinset *,
+       int pinnr, struct exynos_gpio_pindata *);
 extern bool exynos_gpio_pin_reserve(const char *, struct exynos_gpio_pindata *);
 
 static inline void



Home | Main Index | Thread Index | Old Index