Commit 27f25ce6 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

fixed vsc330x.c

parent 1436d5e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,12 +5,12 @@
			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.1636449201" moduleId="org.eclipse.cdt.core.settings" name="Default">
				<externalSettings/>
				<extensions>
					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
				</extensions>
			</storageModule>
			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+6 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/of.h>

#define DRV_VERSION "1.0"

/* TODO: Descriptions from vsc3312 - check differences */
#define I2C_PAGE_CONNECTION        0x00	/* When written to I2C_CURRENT_PAGE, makes registers 0..0xf control corresponding output (0..0xf) source
					   (input number) bit 4 (+0x10) - turn output off, bits 3:0 - source */
@@ -99,7 +100,7 @@
#define I2C_INTERFACE_MODE         0x79
#define I2C_INTERFACE_MODE_DATA    0x02	/* i2c (1 - 4-wire)  */
#define I2C_SOFTWARE_RESET         0x7a
#define I2C_SOFTWARE_RESET_DATA    0x10	/* to reset, 0 - normal  */
//#define I2C_SOFTWARE_RESET_DATA    0x10 /* to reset, 0 - normal  */ not used - but number 4 is used instead
#define I2C_CURRENT_PAGE           0x7f
#define PORT_PEFIX                 "port_"
#define ALL_PORTS                  "all"
@@ -650,7 +651,10 @@ static int _init_device(struct i2c_client *client, int address_mode_data)
	int rc;
    if (((rc=write_reg(client, I2C_INTERFACE_MODE, I2C_INTERFACE_MODE_DATA)))<0) return rc;
    if (address_mode_data >=0){ /* only write if needed, 3304 needs, 3312 - does not, 3308 - ? */
        if (((rc=write_reg(client, I2C_SOFTWARE_RESET_DATA, address_mode_data)))<0) return rc;
//        if (((rc=write_reg(client, I2C_SOFTWARE_RESET_DATA, address_mode_data)))<0) return rc;
// this bug caused me to assemble a new board, urgently find vsc3304 chip,spend several days trying to troubleshoot...
// Just five extra characters!
        if (((rc=write_reg(client, I2C_SOFTWARE_RESET, address_mode_data)))<0) return rc;
    }
    if (((rc=write_reg(client, I2C_CURRENT_PAGE, 0)))<0) return rc;
	return 0;