Module Name: src Committed By: rkujawa Date: Wed May 1 12:25:31 UTC 2013
Modified Files: src/sys/dev/marvell: gttwsi.c gttwsireg.h Log Message: TWSI controller on Armada XP is a bit different. Support that. Obtained from Marvell, Semihalf. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/gttwsi.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gttwsireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/marvell/gttwsi.c diff -u src/sys/dev/marvell/gttwsi.c:1.6 src/sys/dev/marvell/gttwsi.c:1.7 --- src/sys/dev/marvell/gttwsi.c:1.6 Sat Jul 21 04:21:14 2012 +++ src/sys/dev/marvell/gttwsi.c Wed May 1 12:25:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi.c,v 1.6 2012/07/21 04:21:14 kiyohara Exp $ */ +/* $NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.6 2012/07/21 04:21:14 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $"); #include "locators.h" #include <sys/param.h> @@ -86,6 +86,8 @@ __KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1 #include <dev/marvell/marvellvar.h> #include <dev/marvell/gttwsireg.h> +#include "opt_mvsoc.h" + struct gttwsi_softc { device_t sc_dev; bus_space_tag_t sc_bust; @@ -341,8 +343,13 @@ gttwsi_read_byte(void *v, uint8_t *valp, error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, flags); if (!error) *valp = RREG(sc, TWSI_DATA); - if (flags & I2C_F_LAST) + if (flags & I2C_F_LAST) { +#if defined(ARMADAXP) + error = gttwsi_send_stop(sc, flags); +#else WREG(sc, TWSI_CONTROL, 0); +#endif + } return error; } @@ -352,6 +359,10 @@ gttwsi_write_byte(void *v, uint8_t val, struct gttwsi_softc *sc = v; WREG(sc, TWSI_DATA, val); +#if defined(ARMADAXP) + if (flags & I2C_F_LAST) + gttwsi_send_stop(sc, flags); +#endif return gttwsi_wait(sc, 0, STAT_MTDB_AR, flags); } @@ -391,6 +402,7 @@ gttwsi_wait(struct gttwsi_softc *sc, uin return EIO; } +#ifndef ARMADAXP if (flags & I2C_F_STOP) switch (expect) { case STAT_SCT: @@ -401,6 +413,7 @@ gttwsi_wait(struct gttwsi_softc *sc, uin default: error = gttwsi_send_stop(sc, flags); } +#endif return error; } Index: src/sys/dev/marvell/gttwsireg.h diff -u src/sys/dev/marvell/gttwsireg.h:1.2 src/sys/dev/marvell/gttwsireg.h:1.3 --- src/sys/dev/marvell/gttwsireg.h:1.2 Sat Jul 21 04:23:16 2012 +++ src/sys/dev/marvell/gttwsireg.h Wed May 1 12:25:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsireg.h,v 1.2 2012/07/21 04:23:16 kiyohara Exp $ */ +/* $NetBSD: gttwsireg.h,v 1.3 2013/05/01 12:25:31 rkujawa Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. @@ -74,7 +74,12 @@ #define TWSI_RETRY_COUNT 1000 /* retry loop count */ #define TWSI_RETRY_DELAY 1 /* retry delay */ #define TWSI_STAT_DELAY 1 /* poll status delay */ +#ifdef ARMADAXP +#define TWSI_READ_DELAY 15 /* read delay */ +#define TWSI_WRITE_DELAY 15 /* write delay */ +#else #define TWSI_READ_DELAY 2 /* read delay */ #define TWSI_WRITE_DELAY 2 /* write delay */ +#endif /* ARMADAXP */ #endif /* _GTTWSIREG_H_ */