aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-07-11 14:56:54 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-07-11 14:56:54 +0000
commitbe1b8cc75cb7bbd65f9aad2224208091706b01a6 (patch)
tree67cd13e860361ce3a0b8c888f9e92594a890e318 /target/linux/ar71xx
parent55f1f3e71982adf31c3b2c48e21de01f4ebbaae3 (diff)
downloadupstream-be1b8cc75cb7bbd65f9aad2224208091706b01a6.tar.gz
upstream-be1b8cc75cb7bbd65f9aad2224208091706b01a6.tar.bz2
upstream-be1b8cc75cb7bbd65f9aad2224208091706b01a6.zip
[ar71xx] add definitions for some magic values in the spi_vsc7385 driver
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16779 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/drivers/spi/spi_vsc7385.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/target/linux/ar71xx/files/drivers/spi/spi_vsc7385.c b/target/linux/ar71xx/files/drivers/spi/spi_vsc7385.c
index c270b0f05a..14952c663b 100644
--- a/target/linux/ar71xx/files/drivers/spi/spi_vsc7385.c
+++ b/target/linux/ar71xx/files/drivers/spi/spi_vsc7385.c
@@ -102,6 +102,13 @@
#define VSC73XX_ICPU_CTRL_CLK_EN (1 << 1)
#define VSC73XX_ICPU_CTRL_SRST (1 << 0)
+#define VSC73XX_ICPU_CHIPID_ID_SHIFT 12
+#define VSC73XX_ICPU_CHIPID_ID_MASK 0xffff
+#define VSC73XX_ICPU_CHIPID_REV_SHIFT 28
+#define VSC73XX_ICPU_CHIPID_REV_MASK 0xf
+#define VSC73XX_ICPU_CHIPID_ID_7385 0x7385
+#define VSC73XX_ICPU_CHIPID_ID_7395 0x7395
+
#define VSC73XX_CMD_MODE_READ 0
#define VSC73XX_CMD_MODE_WRITE 1
#define VSC73XX_CMD_MODE_SHIFT 4
@@ -494,16 +501,18 @@ static int vsc7385_detect(struct vsc7385 *vsc)
return err;
}
- id = (t >> 12) & 0xffff;
+ id = (t >> VSC73XX_ICPU_CHIPID_ID_SHIFT) & VSC73XX_ICPU_CHIPID_ID_MASK;
switch (id) {
- case 0x7385:
+ case VSC73XX_ICPU_CHIPID_ID_7385:
+ case VSC73XX_ICPU_CHIPID_ID_7395:
break;
default:
dev_err(&spi->dev, "unsupported chip, id=%04x\n", id);
return -ENODEV;
}
- rev = (t >> 28) & 0xf;
+ rev = (t >> VSC73XX_ICPU_CHIPID_REV_SHIFT) &
+ VSC73XX_ICPU_CHIPID_REV_MASK;
dev_info(&spi->dev, "VSC%04X (rev. %d) switch found \n", id, rev);
return 0;