Skip to contentSkip to conversation

i2c-imx: change log level for No ACK

PATCH New Eric Bénard 1 participant 6 messages May 25, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 i2c-imx: change log level for No ACK

---
 drivers/i2c/i2c-imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/i2c-imx.c +1 -1
index 03e3785..cc64d94 100644
@@ -214,7 +214,7 @@ static int i2c_imx_acked(struct i2c_adapter *adapter)
 			break;
 
 		if (is_timeout(start, MSECOND)) {
-			dev_err(adapter->dev, "<%s> No ACK\n", __func__);
+			dev_dbg(adapter->dev, "<%s> No ACK\n", __func__);
 			return -EIO;
 		}
 	}
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 2/6 i2c: implement i2c_get_adapter()

From: Sascha Hauer <[email protected]>

---
v2 : add i2c_get_adapter to include/i2c/i2c.h

 drivers/i2c/i2c.c |   24 +++++++++++++++++++++++-
 include/i2c/i2c.h |    2 ++
 2 files changed, 25 insertions(+), 1 deletions(-)
drivers/i2c/i2c.c +23 -1
index 32fd026..1fa114a 100644
@@ -39,7 +39,7 @@ struct boardinfo {
 };
 
 static LIST_HEAD(board_list);
-
+static LIST_HEAD(adapter_list);
 
 /**
  * i2c_transfer - execute a single or combined I2C message
@@ -327,6 +327,23 @@ static void scan_boardinfo(struct i2c_adapter *adapter)
 }
 
 /**
+ *
+ * i2c_get_adapter - get an i2c adapter from its busnum
+ *
+ * @param	busnum	the desired bus number
+ *
+ */
+struct i2c_adapter *i2c_get_adapter(int busnum)
+{
+	struct i2c_adapter *adap;
+
+	list_for_each_entry(adap, &adapter_list, list)
+		if (adap->nr == busnum)
+			return adap;
+	return NULL;
+}
+
+/**
  * i2c_register_master - register I2C master controller
  *
  * @param	master	initialized master, originally from i2c_alloc_master()
@@ -345,6 +362,11 @@ static void scan_boardinfo(struct i2c_adapter *adapter)
  */
 int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
 {
+	if (i2c_get_adapter(adapter->nr))
+		return -EBUSY;
+
+	list_add_tail(&adapter_list, &adapter->list);
+
 	/* populate children from any i2c device tables */
 	scan_boardinfo(adapter);
 
include/i2c/i2c.h +2 -0
index 0760fdc..c031bbb 100644
@@ -66,6 +66,7 @@ struct i2c_adapter {
 	struct device_d		*dev;	/* ptr to device */
 	int			nr;	/* bus number */
 	int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
+	struct list_head	list;
 };
 
 
@@ -120,6 +121,7 @@ static inline int i2c_register_board_info(int busnum,
 }
 #endif
 extern int i2c_add_numbered_adapter(struct i2c_adapter *adapter);
+struct i2c_adapter *i2c_get_adapter(int busnum);
 
 extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
 extern int i2c_master_send(struct i2c_client *client, const char *buf, int count);
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v6 3/6 commands: add i2c commands

theses commands allow low level access to i2c bus and can be useful to setup an i2c device without having to add code, compile and flash barebox.

---
v6 :
add log before exiting when i2c bus doesn't exist
v5 :
updated as per Marc's comments
better error handling in write
better default bus handling in read & write
v4 :
updated as per Sascha and Marc's comments use bus 0 as a default for i2c_read & write replace malloc with xmalloc
fix simple_strtol configuration for parameters
v3 :
enable brain and fix v2
tested on iMX27
v2 :
updated as per Sascha's comments

 commands/Kconfig  |    8 ++
 commands/Makefile |    1 +
 commands/i2c.c    |  214 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 commands/i2c.c
commands/Kconfig +8 -0
index 0c09f91..0ea32d9 100644
@@ -314,4 +314,12 @@ config CMD_UNLZO
 	  Say yes here to get the unlzo command. lzo is a fast compression
 	  algorithm by Markus Franz Xaver Johannes Oberhumer.
 
+config CMD_I2C
+	bool
+	depends on I2C
+	prompt "i2c commands"
+	help
+	  include i2c_probe, i2c_read and i2c_write commands to communicate
+	  on i2c bus.
+
 endmenu
commands/Makefile +1 -0
index 74b0994..3eef5de 100644
@@ -48,3 +48,4 @@ obj-$(CONFIG_CMD_BMP)		+= bmp.o
 obj-$(CONFIG_USB_GADGET_DFU)	+= dfu.o
 obj-$(CONFIG_CMD_GPIO)		+= gpio.o
 obj-$(CONFIG_CMD_UNLZO)		+= unlzo.o
+obj-$(CONFIG_CMD_I2C)		+= i2c.o
commands/i2c.c new file +214 -0

214 lines not on this page · raw message

Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 4/6 eukrea_cpuimx27: add fb support

---
 board/eukrea_cpuimx27/eukrea_cpuimx27.c |   67 ++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 1 deletions(-)
board/eukrea_cpuimx27/eukrea_cpuimx27.c +66 -1
index ef57a96..e40c260 100644
@@ -40,6 +40,7 @@
 #include <asm/io.h>
 #include <mach/imx-nand.h>
 #include <mach/imx-pll.h>
+#include <mach/imxfb.h>
 #include <ns16550.h>
 #include <asm/mmu.h>
 #include <i2c/i2c.h>
@@ -176,6 +177,39 @@ static void eukrea_cpuimx27_mmu_init(void)
 }
 #endif
 
+#ifdef CONFIG_DRIVER_VIDEO_IMX
+static struct imx_fb_videomode imxfb_mode = {
+	.mode = {
+		.name		= "CMO-QVGA",
+		.refresh	= 60,
+		.xres		= 320,
+		.yres		= 240,
+		.pixclock	= 156000,
+		.hsync_len	= 30,
+		.left_margin	= 38,
+		.right_margin	= 20,
+		.vsync_len	= 3,
+		.upper_margin	= 15,
+		.lower_margin	= 4,
+	},
+	.pcr		= 0xFAD08B80,
+	.bpp		= 16,};
+
+static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = {
+	.mode	= &imxfb_mode,
+	.pwmr	= 0x00A903FF,
+	.lscr1	= 0x00120300,
+	.dmacr	= 0x00020010,
+};
+
+static struct device_d imxfb_dev = {
+	.name		= "imxfb",
+	.map_base	= 0x10021000,
+	.size		= 0x1000,
+	.platform_data	= &eukrea_cpuimx27_fb_data,
+};
+#endif
+
 static int eukrea_cpuimx27_devices_init(void)
 {
 	char *envdev = "no";
@@ -208,6 +242,31 @@ static int eukrea_cpuimx27_devices_init(void)
 		PE14_PF_UART1_CTS,
 		PE15_PF_UART1_RTS,
 #endif
+#ifdef CONFIG_DRIVER_VIDEO_IMX
+		PA5_PF_LSCLK,
+		PA6_PF_LD0,
+		PA7_PF_LD1,
+		PA8_PF_LD2,
+		PA9_PF_LD3,
+		PA10_PF_LD4,
+		PA11_PF_LD5,
+		PA12_PF_LD6,
+		PA13_PF_LD7,
+		PA14_PF_LD8,
+		PA15_PF_LD9,
+		PA16_PF_LD10,
+		PA17_PF_LD11,
+		PA18_PF_LD12,
+		PA19_PF_LD13,
+		PA20_PF_LD14,
+		PA21_PF_LD15,
+		PA22_PF_LD16,
+		PA23_PF_LD17,
+		PA28_PF_HSYNC,
+		PA29_PF_VSYNC,
+		PA31_PF_OE_ACD,
+		GPIO_PORTE | 5 | GPIO_GPIO | GPIO_OUT,
+#endif
 	};
 
 	eukrea_cpuimx27_mmu_init();
@@ -217,7 +276,7 @@ static int eukrea_cpuimx27_devices_init(void)
 	CS0L = 0xA0330D01;
 	CS0A = 0x002208C0;
 
-	/* initizalize gpios */
+	/* initialize gpios */
 	for (i = 0; i < ARRAY_SIZE(mode); i++)
 		imx_gpio_mode(mode[i]);
 
@@ -239,6 +298,12 @@ static int eukrea_cpuimx27_devices_init(void)
 
 	printf("Using environment in %s Flash\n", envdev);
 
+#ifdef CONFIG_DRIVER_VIDEO_IMX
+	register_device(&imxfb_dev);
+	gpio_direction_output(GPIO_PORTE | 5, 0);
+	gpio_set_value(GPIO_PORTE | 5, 1);
+#endif
+
 	armlinux_add_dram(&sdram_dev);
 	armlinux_set_bootparams((void *)0xa0000100);
 	armlinux_set_architecture(MACH_TYPE_CPUIMX27);
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 5/6 eukrea_cpuimx27: update env

---
 board/eukrea_cpuimx27/env/bin/boot |   10 +++++++---
 board/eukrea_cpuimx27/env/config   |   14 +++++++-------
 2 files changed, 14 insertions(+), 10 deletions(-)
board/eukrea_cpuimx27/env/bin/boot +7 -3
index 7bbff2d..7272e56 100644
@@ -17,10 +17,14 @@ if [ x$1 = xnor ]; then
 	kernel=nor
 fi
 
-if [ x$ip = xdhcp ]; then
-	bootargs="$bootargs ip=dhcp"
+if [ x$root = xnet ]; then
+	if [ x$ip = xdhcp ]; then
+		bootargs="$bootargs ip=dhcp"
+	else
+		bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
+	fi
 else
-	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
+	bootargs="$bootargs ip=off"
 fi
 
 if [ x$root = xnand ]; then
board/eukrea_cpuimx27/env/config +7 -7
index 183787e..505ada3 100644
@@ -4,16 +4,16 @@
 kernel=nor
 root=nor
 
-uimage=cpuimx27/uImage
-jffs2=cpuimx27/rootfs.jffs2
+uimage=mx27/uImage
+jffs2=mx27/rootfs.jffs2
 
-autoboot_timeout=3
+autoboot_timeout=1
 
-# TFP410-SVGA TFP410-VGA CMO-QVGA Optrex-WVGA Sharp-QVGA-EK
+# DVI-SVGA DVI-VGA CMO-QVGA
 video="CMO-QVGA"
-bootargs="console=ttymxc0,115200 fec_mac=$eth0.ethaddr rtc-pcf8563.probe=0,0x51 video=mxcfb:$video"
+bootargs="console=ttymxc0,115200 fec_mac=$eth0.ethaddr video=mxcfb:$video"
 
-nor_parts="256k(barebox)ro,128k(bareboxenv),1792k(kernel),-(root)"
+nor_parts="256k(barebox)ro,128k(bareboxenv),2176k(kernel),-(root)"
 rootpart_nor="/dev/mtdblock3"
 
 nand_parts="-(nand)"
@@ -28,4 +28,4 @@ ip=dhcp
 #eth0.ipaddr=a.b.c.d
 #eth0.netmask=a.b.c.d
 #eth0.gateway=a.b.c.d
-eth0.serverip=192.168.1.15
+#eth0.serverip=a.b.c.d
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 6/6 eukrea_cpuimx27: update defconfig

---
 arch/arm/configs/eukrea_cpuimx27_defconfig |   79 ++++++++++++++++-----------
 1 files changed, 47 insertions(+), 32 deletions(-)
arch/arm/configs/eukrea_cpuimx27_defconfig +47 -32
index b1624de..3b92c37 100644
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# barebox version: 2.0.0-rc10
-# Fri Dec 18 11:47:22 2009
+# barebox version: 2010.05.0
+# Tue May 25 09:57:55 2010
 #
 # CONFIG_BOARD_LINKER_SCRIPT is not set
 CONFIG_GENERIC_LINKER_SCRIPT=y
@@ -12,6 +12,7 @@ CONFIG_ARM=y
 #
 # CONFIG_ARCH_AT91 is not set
 # CONFIG_ARCH_AT91RM9200 is not set
+# CONFIG_ARCH_EP93XX is not set
 CONFIG_ARCH_IMX=y
 # CONFIG_ARCH_NETX is not set
 # CONFIG_ARCH_OMAP is not set
@@ -46,7 +47,7 @@ CONFIG_MACH_EUKREA_CPUIMX27=y
 # CONFIG_MACH_PCM038 is not set
 
 #
-# Board specific settings
+# Board specific settings       
 #
 CONFIG_EUKREA_CPUIMX27_SDRAM_128MB=y
 # CONFIG_EUKREA_CPUIMX27_SDRAM_256MB is not set
@@ -58,18 +59,15 @@ CONFIG_EUKREA_CPUIMX27_QUART1=y
 # CONFIG_EUKREA_CPUIMX27_QUART4 is not set
 
 #
-# i.MX specific settings
+# i.MX specific settings        
 #
 CONFIG_IMX_CLKO=y
 # CONFIG_AEABI is not set
 
 #
-# Arm specific settings
+# Arm specific settings         
 #
 CONFIG_CMD_ARM_CPUINFO=y
-CONFIG_CMDLINE_TAG=y
-CONFIG_SETUP_MEMORY_TAGS=y
-# CONFIG_INITRD_TAG is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_GREGORIAN_CALENDER=y
 CONFIG_HAS_KALLSYMS=y
@@ -79,12 +77,12 @@ CONFIG_ENV_HANDLING=y
 CONFIG_GENERIC_GPIO=y
 
 #
-# General Settings
+# General Settings              
 #
 CONFIG_LOCALVERSION_AUTO=y
 
 #
-# memory layout
+# memory layout                 
 #
 CONFIG_HAVE_MMU=y
 CONFIG_MMU=y
@@ -108,6 +106,7 @@ CONFIG_SHELL_HUSH=y
 # CONFIG_SHELL_SIMPLE is not set
 CONFIG_GLOB=y
 CONFIG_PROMPT_HUSH_PS2="> "
+CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_DYNAMIC_CRC_TABLE=y
@@ -122,7 +121,7 @@ CONFIG_DEFAULT_ENVIRONMENT=y
 CONFIG_DEFAULT_ENVIRONMENT_PATH="board/eukrea_cpuimx27/env"
 
 #
-# Debugging
+# Debugging                     
 #
 # CONFIG_DEBUG_INFO is not set
 # CONFIG_ENABLE_FLASH_NOISE is not set
@@ -130,11 +129,11 @@ CONFIG_DEFAULT_ENVIRONMENT_PATH="board/eukrea_cpuimx27/env"
 # CONFIG_ENABLE_DEVICE_NOISE is not set
 
 #
-# Commands
+# Commands                      
 #
 
 #
-# scripting
+# scripting                     
 #
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
@@ -147,7 +146,7 @@ CONFIG_CMD_TRUE=y
 CONFIG_CMD_FALSE=y
 
 #
-# file commands
+# file commands                 
 #
 CONFIG_CMD_LS=y
 CONFIG_CMD_RM=y
@@ -161,13 +160,14 @@ CONFIG_CMD_MOUNT=y
 CONFIG_CMD_UMOUNT=y
 
 #
-# console
+# console                       
 #
 CONFIG_CMD_CLEAR=y
 CONFIG_CMD_ECHO=y
+CONFIG_CMD_ECHO_E=y
 
 #
-# memory
+# memory                        
 #
 # CONFIG_CMD_LOADB is not set
 CONFIG_CMD_MEMINFO=y
@@ -176,19 +176,20 @@ CONFIG_CMD_MTEST=y
 # CONFIG_CMD_MTEST_ALTERNATIVE is not set
 
 #
-# flash
+# flash                         
 #
 CONFIG_CMD_FLASH=y
 
 #
-# booting
+# booting                       
 #
 CONFIG_CMD_BOOTM=y
 # CONFIG_CMD_BOOTM_ZLIB is not set
 # CONFIG_CMD_BOOTM_BZLIB is not set
-# CONFIG_CMD_BOOTM_SHOW_TYPE is not set
+CONFIG_CMD_BOOTM_SHOW_TYPE=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_BOOTU=y
+# CONFIG_CMD_LINUX16 is not set
 CONFIG_CMD_RESET=y
 CONFIG_CMD_GO=y
 CONFIG_CMD_TIMEOUT=y
@@ -197,7 +198,10 @@ CONFIG_CMD_TEST=y
 CONFIG_CMD_VERSION=y
 CONFIG_CMD_HELP=y
 CONFIG_CMD_DEVINFO=y
+CONFIG_CMD_BMP=y
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_UNLZO=y
+CONFIG_CMD_I2C=y
 CONFIG_NET=y
 CONFIG_NET_DHCP=y
 # CONFIG_NET_RARP is not set
@@ -206,11 +210,11 @@ CONFIG_NET_PING=y
 CONFIG_NET_TFTP=y
 
 #
-# Drivers
+# Drivers                       
 #
 
 #
-# serial drivers
+# serial drivers                
 #
 # CONFIG_DRIVER_SERIAL_ARM_DCC is not set
 CONFIG_DRIVER_SERIAL_IMX=y
@@ -218,27 +222,33 @@ CONFIG_DRIVER_SERIAL_NS16550=y
 CONFIG_MIIPHY=y
 
 #
-# Network drivers
+# Network drivers               
 #
 # CONFIG_DRIVER_NET_SMC911X is not set
 # CONFIG_DRIVER_NET_SMC91111 is not set
 CONFIG_DRIVER_NET_FEC_IMX=y
 
 #
-# SPI drivers
+# SPI drivers                   
 #
-CONFIG_SPI=y
-CONFIG_DRIVER_SPI_IMX=y
-CONFIG_DRIVER_SPI_MC13783=y
-# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+CONFIG_I2C=y
+CONFIG_DRIVER_I2C_IMX=y
+# CONFIG_DRIVER_I2C_MC13892 is not set
+# CONFIG_DRIVER_I2C_MC9SDZ60 is not set
+CONFIG_DRIVER_I2C_LP3972=y
 
 #
-# flash drivers
+# flash drivers                 
 #
 CONFIG_HAS_CFI=y
 CONFIG_DRIVER_CFI=y
-# CONFIG_DRIVER_CFI_NEW is not set
-CONFIG_DRIVER_CFI_OLD=y
+CONFIG_DRIVER_CFI_INTEL=y
+# CONFIG_DRIVER_CFI_AMD is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+CONFIG_DRIVER_CFI_BANK_WIDTH_2=y
+# CONFIG_DRIVER_CFI_BANK_WIDTH_4 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_8 is not set
 CONFIG_CFI_BUFFER_WRITE=y
 CONFIG_NAND=y
 CONFIG_NAND_IMX=y
@@ -246,15 +256,20 @@ CONFIG_NAND_IMX=y
 # CONFIG_MTD_NAND_VERIFY_WRITE is not set
 # CONFIG_MTD_NAND_ECC_SMC is not set
 CONFIG_MTD_NAND_IDS=y
+# CONFIG_ATA is not set
 # CONFIG_USB is not set
 # CONFIG_USB_GADGET is not set
-# CONFIG_VIDEO is not set
+CONFIG_VIDEO=y
+CONFIG_DRIVER_VIDEO_IMX=y
+# CONFIG_IMXFB_DRIVER_VIDEO_IMX_OVERLAY is not set
 
 #
-# Filesystem support
+# Filesystem support            
 #
 # CONFIG_FS_CRAMFS is not set
 CONFIG_FS_RAMFS=y
 CONFIG_FS_DEVFS=y
 CONFIG_CRC32=y
 # CONFIG_GENERIC_FIND_NEXT_BIT is not set
+CONFIG_PROCESS_ESCAPE_SEQUENCE=y
+CONFIG_LZO_DECOMPRESS=y
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox