From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH u-boot sunxi 07/12] sunxi: Add i2c support
Date: Tue, 18 Mar 2014 08:54:41 +0100 [thread overview]
Message-ID: <5327FBC1.70206@denx.de> (raw)
In-Reply-To: <1395097256-7593-8-git-send-email-hdegoede@redhat.com>
Hello Hans,
Am 18.03.2014 00:00, schrieb Hans de Goede:
> From: Henrik Nordstrom<henrik@henriknordstrom.net>
>
> Based linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in
> ldscripts" vs v2014.01.
>
> As well as the following signed-off-by the sunxi branch shows commits to
> the sunxi_i2c.c file by:
>
> Stefan Roese<sr@denx.de>
>
> Signed-off-by: Henrik Nordstrom<henrik@henriknordstrom.net>
> Signed-off-by: Oliver Schinagl<oliver@schinagl.nl>
> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
> ---
> arch/arm/cpu/armv7/sunxi/board.c | 6 +
> arch/arm/include/asm/arch-sunxi/i2c.h | 169 ++++++++++++++++++++++
> drivers/i2c/Makefile | 1 +
> drivers/i2c/sunxi_i2c.c | 260 ++++++++++++++++++++++++++++++++++
> include/configs/sunxi-common.h | 8 ++
> 5 files changed, 444 insertions(+)
> create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
> create mode 100644 drivers/i2c/sunxi_i2c.c
>
[...]
> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
> index fa3a875..2a44db4 100644
> --- a/drivers/i2c/Makefile
> +++ b/drivers/i2c/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o
> obj-$(CONFIG_TSI108_I2C) += tsi108_i2c.o
> obj-$(CONFIG_U8500_I2C) += u8500_i2c.o
> obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o
> +obj-$(CONFIG_SUNXI_I2C) += sunxi_i2c.o
please use:
CONFIG_SYS_I2C_SUNXI
> obj-$(CONFIG_SYS_I2C) += i2c_core.o
> obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
> obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o
> diff --git a/drivers/i2c/sunxi_i2c.c b/drivers/i2c/sunxi_i2c.c
> new file mode 100644
> index 0000000..9a542f6
> --- /dev/null
> +++ b/drivers/i2c/sunxi_i2c.c
> @@ -0,0 +1,260 @@
> +/*
> + * (C) Copyright 2012 Henrik Nordstrom<henrik@henriknordstrom.net>
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include<common.h>
> +#include<i2c.h>
> +#include<asm/io.h>
> +#include<asm/arch/clock.h>
> +#include<asm/arch/cpu.h>
> +#include<asm/arch/gpio.h>
> +#include<asm/arch/i2c.h>
> +
> +static struct i2c __attribute__ ((section(".data"))) *i2c_base =
> + (struct i2c *)0x1c2ac00;
Please no magic numbers, use a define instead.
> +void i2c_init(int speed, int slaveaddr)
[...]
> +int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
> +{
> + int rc = i2c_do_write(chip, addr, alen, buffer, len);
> +
> + i2c_stop();
> +
> + return rc;
> +}
Please update to the new i2c multibus/multiadpater framework
Dummy question, there is another "twi" driver in drivers/i2c
bfin-twi_i2c.c
are they compatible?
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index fe41b89..1f2bcb5 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -176,6 +176,14 @@
> #undef CONFIG_CMD_NET
> #undef CONFIG_CMD_NFS
>
> +/* I2C */
> +#define CONFIG_SPL_I2C_SUPPORT
> +#define CONFIG_SYS_I2C_SPEED 400000
> +#define CONFIG_HARD_I2C
NACK, please use no longer HARD_I2C, switch instead to
CONFIG_SYS_I2C
> +#define CONFIG_SUNXI_I2C
> +#define CONFIG_SYS_I2C_SLAVE 0x7f
> +#define CONFIG_CMD_I2C
> +
> #ifndef CONFIG_CONS_INDEX
> #define CONFIG_CONS_INDEX 1 /* UART0 */
> #endif
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2014-03-18 7:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 23:00 [U-Boot] [PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 01/12] sunxi: Implement reset_cpu Hans de Goede
2014-03-18 10:25 ` Ian Campbell
2014-03-22 16:16 ` Hans de Goede
2014-03-22 17:17 ` Ian Campbell
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 02/12] sunxi: FIXUP: sunxi: initial generic sun7i cpu, board and start of day support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 03/12] sunxi: FIXUP: sunxi: initial sun7i clocks and timer support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 04/12] sunxi: FIXUP: sunxi: initial sun7i dram setup support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 05/12] sunxi: Add sun4i support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 06/12] sunxi: Add sun5i support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 07/12] sunxi: Add i2c support Hans de Goede
2014-03-18 7:54 ` Heiko Schocher [this message]
2014-05-03 15:46 ` Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 08/12] sunxi: Add axp209 pmic support Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 09/12] sunxi: Add axp152 " Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 10/12] sunxi: fast MBUS support on sun7i Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 11/12] net: Rename and cleanup sunxi (Allwinner) emac driver Hans de Goede
2014-03-17 23:00 ` [U-Boot] [PATCH u-boot sunxi 12/12] sunxi: enable emac for sun4i and sun5i Hans de Goede
2014-03-18 20:52 ` [U-Boot] [PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support Ian Campbell
2014-03-20 12:49 ` [U-Boot] [PATCH] sun5i: Add A13-OLinuXinoM support Tom Rini
2014-06-09 6:50 ` Albert ARIBAUD
2014-06-09 7:56 ` Hans de Goede
2014-06-10 7:25 ` Albert ARIBAUD
2014-06-10 7:48 ` Hans de Goede
2014-06-10 8:34 ` Albert ARIBAUD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5327FBC1.70206@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox