Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meta-elphel393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
meta-elphel393
Commits
69e85632
Commit
69e85632
authored
Nov 28, 2013
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added initial configuration of vsc330x from the device tree
parent
eacb7d5e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
13 deletions
+120
-13
elphel393.dts
conf/machine/boards/elphel393/elphel393.dts
+36
-7
vsc3304.patch
recipes-kernel/linux/linux-xlnx/vsc3304.patch
+84
-6
No files found.
conf/machine/boards/elphel393/elphel393.dts
View file @
69e85632
...
@@ -146,6 +146,35 @@
...
@@ -146,6 +146,35 @@
vsc330x
@
1
{
vsc330x
@
1
{
compatible
=
"vsc,vsc3304"
;
compatible
=
"vsc,vsc3304"
;
reg
=
<
0x01
>;
reg
=
<
0x01
>;
vsc330x
,
configuration_name
=
"elphel393: from external"
;
/*
configuration
below
is
for
external
eSATA
host
accessing
SSD
.
Will
chnage
*
when
the
SATA
controller
code
will
be
operational
*
TODO
:
specify
optimal
drive
strength
,
pre
-
emphasis
,
etc
.
*
All
parameters
are
exported
to
sysfs
for
run
-
time
modification
*/
vsc330x
,
configuration_data
=<
0x11080101
/*
page
0x11
,
register
0x08
,
data
=
0x1
(
inverted
input
),
write
enabled
mask
=
0x1
*/
0x11090001
0x110a0101
0x110b0101
0x110e0001
0x110f0101
0x230a0b1f
/*
set
output
mode
for
port
10
as
non
-
inverted
,
forwarding
OOB
enabled
*/
0x230b151f
/*
set
output
mode
for
port
11
as
inverted
,
forwarding
OOB
enabled
*/
0x230c151f
0x230d0b1f
0x230e151f
0x230f151f
0xff750101
/*
freeze
configuration
to
enable
simultaneous
modification
*/
0x110e0002
/*
enable
channel
14
input
*/
0x11090002
/*
enable
channel
9
input
*/
0x000b091f
/*
connect
port
11
output
to
input
9
*/
0x000c0e1f
/*
connect
port
12
output
to
input
14
*/
0xff750001
/*
un
-
freeze
configuration
to
apply
connection
modifications
*/
>;
};
};
}
;
}
;
...
...
recipes-kernel/linux/linux-xlnx/vsc3304.patch
View file @
69e85632
Index: git/drivers/misc/Kconfig
Index: git/drivers/misc/Kconfig
===================================================================
===================================================================
--- git.orig/drivers/misc/Kconfig 2013-11-2
6 16:00:21.216686641
-0700
--- git.orig/drivers/misc/Kconfig 2013-11-2
7 23:29:14.793862172
-0700
+++ git/drivers/misc/Kconfig 2013-11-2
6 16:00:24.260686672
-0700
+++ git/drivers/misc/Kconfig 2013-11-2
7 23:29:17.897862204
-0700
@@ -549,6 +549,13 @@
@@ -549,6 +549,13 @@
their requirements.
their requirements.
...
@@ -18,8 +18,8 @@ Index: git/drivers/misc/Kconfig
...
@@ -18,8 +18,8 @@ Index: git/drivers/misc/Kconfig
source "drivers/misc/eeprom/Kconfig"
source "drivers/misc/eeprom/Kconfig"
Index: git/drivers/misc/Makefile
Index: git/drivers/misc/Makefile
===================================================================
===================================================================
--- git.orig/drivers/misc/Makefile 2013-11-2
6 16:00:21.216686641
-0700
--- git.orig/drivers/misc/Makefile 2013-11-2
7 23:29:14.793862172
-0700
+++ git/drivers/misc/Makefile 2013-11-2
6 16:00:24.260686672
-0700
+++ git/drivers/misc/Makefile 2013-11-2
7 23:29:17.897862204
-0700
@@ -55,3 +55,4 @@
@@ -55,3 +55,4 @@
obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o
obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o
obj-$(CONFIG_SRAM) += sram.o
obj-$(CONFIG_SRAM) += sram.o
...
@@ -28,8 +28,8 @@ Index: git/drivers/misc/Makefile
...
@@ -28,8 +28,8 @@ Index: git/drivers/misc/Makefile
Index: git/drivers/misc/vsc330x.c
Index: git/drivers/misc/vsc330x.c
===================================================================
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ git/drivers/misc/vsc330x.c 2013-11-2
7 16:34:08.697603838
-0700
+++ git/drivers/misc/vsc330x.c 2013-11-2
8 00:46:10.785910050
-0700
@@ -0,0 +1,
794
@@
@@ -0,0 +1,
872
@@
+/*!***************************************************************************
+/*!***************************************************************************
+ *! FILE NAME : vsc330x.c
+ *! FILE NAME : vsc330x.c
+ *! DESCRIPTION: control of the VSC3304 4x4 crosspoint switch
+ *! DESCRIPTION: control of the VSC3304 4x4 crosspoint switch
...
@@ -57,6 +57,7 @@ Index: git/drivers/misc/vsc330x.c
...
@@ -57,6 +57,7 @@ Index: git/drivers/misc/vsc330x.c
+#include <linux/slab.h>
+#include <linux/slab.h>
+#include <linux/mutex.h>
+#include <linux/mutex.h>
+#include <linux/string.h>
+#include <linux/string.h>
+#include <linux/of.h>
+
+
+#define DRV_VERSION "1.0"
+#define DRV_VERSION "1.0"
+/* TODO: Descriptions from vsc3312 - check differences */
+/* TODO: Descriptions from vsc3312 - check differences */
...
@@ -762,6 +763,82 @@ Index: git/drivers/misc/vsc330x.c
...
@@ -762,6 +763,82 @@ Index: git/drivers/misc/vsc330x.c
+ return write_field(client, reg, val, ls_bit_num, width);
+ return write_field(client, reg, val, ls_bit_num, width);
+}
+}
+
+
+static int write_with_mask(struct i2c_client *client, u8 reg, u8 val, u8 mask)
+{
+ int rc;
+ dev_dbg(&client->dev,"reg=0x%x, val=0x%x, mask=0x%x\n", (int) reg, (int) val, (int) mask);
+ if (val !=0xff){
+ if (((rc=read_reg(client, reg)))<0) return rc;
+ val=((val ^ rc) & mask)^ rc;
+ }
+ return write_reg(client, reg, rc);
+}
+
+static int write_page_with_mask(struct i2c_client *client, int page, u8 reg, u8 val , u8 mask)
+{
+ int rc;
+ struct vsc330x_data_t *clientdata = i2c_get_clientdata(client);
+ dev_dbg(&client->dev,"page=0x%x (last was 0x%x), reg=0x%x, val=0x%x, mask=0x%x\n",
+ page,clientdata->last_page, (int) reg, (int) val,(int) mask);
+ if ((page>=0) && (clientdata->last_page!=page)) {
+ if (((rc=write_reg(client, I2C_CURRENT_PAGE, page)))<0) return rc;
+ clientdata->last_page=page;
+ }
+ return write_with_mask(client, reg, val, mask);
+}
+
+
+
+static void vsc330x_init_of(struct i2c_client *client)
+{
+// struct device *dev=&client->dev;
+ const __be32 * config_data;
+ struct device_node *node = client->dev.of_node;
+ int len,i,rc;
+ struct vsc330x_setup_data {
+ u8 page;
+ u8 reg;
+ u8 data;
+ u8 mask;
+ };
+ struct vsc330x_setup_data setup_data;
+ __be32 * setup_data_be32= (__be32 *) &setup_data;
+
+
+ const char * config_name;
+ if (node) {
+
+ config_name = of_get_property(client->dev.of_node, "vsc330x,configuration_name", &len);
+ if (config_name){
+ dev_info(&client->dev,"Initializing %s registers for \"%s\"\n",client->name,config_name);
+ }
+ config_data = of_get_property(client->dev.of_node, "vsc330x,configuration_data", &len);
+ if (config_data){
+ len /= sizeof(*config_data);
+ dev_dbg(&client->dev,"Read %d values\n",len);
+ for (i=0;i<len;i++){
+ dev_dbg(&client->dev,"0x%08x (0x%08x)\n", config_data[i],be32_to_cpup(config_data+i));
+ *setup_data_be32=config_data[i];
+ dev_dbg(&client->dev,"page=0x%02x, reg=0x%02x, data=0x%02x, mask=0x%02x \n",
+ (int)setup_data.page, (int)setup_data.reg,(int)setup_data.data,(int)setup_data.mask);
+ if (((rc=write_page_with_mask(client, (setup_data.page==0xff)?-1:setup_data.page, setup_data.reg,
+ setup_data.dataroot , setup_data.mask)))<0) return rc;
+ }
+ } else {
+ dev_info(&client->dev,"'vsc330x,configuration_data' not found\n");
+ }
+ } else {
+ dev_info(&client->dev,"Device tree data not found for %s\n",client->name);
+ }
+}
+/*
+ dev_info(&client->dev,
+
+ */
+
+
+
+
+static int vsc330x_i2c_probe(struct i2c_client *client,
+static int vsc330x_i2c_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+ const struct i2c_device_id *id)
+{
+{
...
@@ -785,6 +862,7 @@ Index: git/drivers/misc/vsc330x.c
...
@@ -785,6 +862,7 @@ Index: git/drivers/misc/vsc330x.c
+ rc = vsc330x_sysfs_register(&client->dev);
+ rc = vsc330x_sysfs_register(&client->dev);
+ if (rc)
+ if (rc)
+ goto exit;
+ goto exit;
+ vsc330x_init_of(client);
+ return 0; /* found OK*/
+ return 0; /* found OK*/
+wr_err:
+wr_err:
+ rc = -EIO;
+ rc = -EIO;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment