diff options
author | merge <null@invalid> | 2009-01-22 13:55:32 +0000 |
---|---|---|
committer | Andy Green <agreen@octopus.localdomain> | 2009-01-22 13:55:32 +0000 |
commit | aa6f5ffbdba45aa8e19e5048648fc6c7b25376d3 (patch) | |
tree | fbb786d0ac6f8a774fd834e9ce951197e60fbffa /drivers/staging/agnx/table.c | |
parent | f2d78193eae5dccd3d588d2c8ea0866efc368332 (diff) |
MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141
pending-tracking-hist top was MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141 / fdf777a63bcb59e0dfd78bfe2c6242e01f6d4eb9 ... parent commitmessage:
From: merge <null@invalid>
MERGE-via-stable-tracking-hist-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040
stable-tracking-hist top was MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 / 90463bfd2d5a3c8b52f6e6d71024a00e052b0ced ... parent commitmessage:
From: merge <null@invalid>
MERGE-via-mokopatches-tracking-hist-fix-stray-endmenu-patch
mokopatches-tracking-hist top was fix-stray-endmenu-patch / 3630e0be570de8057e7f8d2fe501ed353cdf34e6 ... parent commitmessage:
From: Andy Green <andy@openmoko.com>
fix-stray-endmenu.patch
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/staging/agnx/table.c')
-rw-r--r-- | drivers/staging/agnx/table.c | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/drivers/staging/agnx/table.c b/drivers/staging/agnx/table.c new file mode 100644 index 00000000000..c60048487b5 --- /dev/null +++ b/drivers/staging/agnx/table.c @@ -0,0 +1,168 @@ +#include <linux/pci.h> +#include <linux/delay.h> +#include "agnx.h" +#include "debug.h" +#include "phy.h" + +static const u32 +tx_fir_table[] = { 0x19, 0x5d, 0xce, 0x151, 0x1c3, 0x1ff, 0x1ea, 0x17c, 0xcf, + 0x19, 0x38e, 0x350, 0x362, 0x3ad, 0x5, 0x44, 0x59, 0x49, + 0x21, 0x3f7, 0x3e0, 0x3e3, 0x3f3, 0x0 }; + +void tx_fir_table_init(struct agnx_priv *priv) +{ + void __iomem *ctl = priv->ctl; + int i; + + for (i = 0; i < ARRAY_SIZE(tx_fir_table); i++) + iowrite32(tx_fir_table[i], ctl + AGNX_FIR_BASE + i*4); +} /* fir_table_setup */ + + +static const u32 +gain_table[] = { 0x8, 0x8, 0xf, 0x13, 0x17, 0x1b, 0x1f, 0x23, 0x27, 0x2b, + 0x2f, 0x33, 0x37, 0x3b, 0x3f, 0x43, 0x47, 0x4b, 0x4f, + 0x53, 0x57, 0x5b, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f }; + +void gain_table_init(struct agnx_priv *priv) +{ + void __iomem *ctl = priv->ctl; + int i; + + for (i = 0; i < ARRAY_SIZE(gain_table); i++) { + iowrite32(gain_table[i], ctl + AGNX_GAIN_TABLE + i*4); + iowrite32(gain_table[i], ctl + AGNX_GAIN_TABLE + i*4 + 0x80); + } +} /* gain_table_init */ + +void monitor_gain_table_init(struct agnx_priv *priv) +{ + void __iomem *ctl = priv->ctl; + unsigned int i; + + for (i = 0; i < 0x44; i += 4) { + iowrite32(0x61, ctl + AGNX_MONGCR_BASE + i); + iowrite32(0x61, ctl + AGNX_MONGCR_BASE + 0x200 + i); + } + for (i = 0x44; i < 0x64; i += 4) { + iowrite32(0x6e, ctl + AGNX_MONGCR_BASE + i); + iowrite32(0x6e, ctl + AGNX_MONGCR_BASE + 0x200 + i); + } + for (i = 0x64; i < 0x94; i += 4) { + iowrite32(0x7a, ctl + AGNX_MONGCR_BASE + i); + iowrite32(0x7a, ctl + AGNX_MONGCR_BASE + 0x200 + i); + } + for (i = 0x94; i < 0xdc; i += 4) { + iowrite32(0x87, ctl + AGNX_MONGCR_BASE + i); + iowrite32(0x87, ctl + AGNX_MONGCR_BASE + 0x200 + i); + } + for (i = 0xdc; i < 0x148; i += 4) { + iowrite32(0x95, ctl + AGNX_MONGCR_BASE + i); + iowrite32(0x95, ctl + AGNX_MONGCR_BASE + 0x200 + i); + } + for (i = 0x148; i < 0x1e8; i += 4) { + iowrite32(0xa2, ctl + AGNX_MONGCR_BASE + i); + iowrite32(0xa2, ctl + AGNX_MONGCR_BASE + 0x200 + i); + } + for (i = 0x1e8; i <= 0x1fc; i += 4) { + iowrite32(0xb0, ctl + AGNX_MONGCR_BASE + i); + iowrite32(0xb0, ctl + AGNX_MONGCR_BASE + 0x200 + i); + } +} /* monitor_gain_table_init */ + + +void routing_table_init(struct agnx_priv *priv) +{ + void __iomem *ctl = priv->ctl; + unsigned int type, subtype; + u32 reg; + + disable_receiver(priv); + + for ( type = 0; type < 0x3; type++ ) { + for (subtype = 0; subtype < 0x10; subtype++) { + /* 1. Set Routing table to R/W and to Return status on Read */ + reg = (type << ROUTAB_TYPE_SHIFT) | + (subtype << ROUTAB_SUBTYPE_SHIFT); + reg |= (1 << ROUTAB_RW_SHIFT) | (1 << ROUTAB_STATUS_SHIFT); + if (type == ROUTAB_TYPE_DATA) { + /* NULL goes to RFP */ + if (subtype == ROUTAB_SUBTYPE_NULL) +// reg |= ROUTAB_ROUTE_RFP; + reg |= ROUTAB_ROUTE_CPU; + /* QOS NULL goes to CPU */ + else if (subtype == ROUTAB_SUBTYPE_QOSNULL) + reg |= ROUTAB_ROUTE_CPU; + /* All Data and QOS data subtypes go to Encryption */ + else if ((subtype == ROUTAB_SUBTYPE_DATA) || + (subtype == ROUTAB_SUBTYPE_DATAACK) || + (subtype == ROUTAB_SUBTYPE_DATAPOLL) || + (subtype == ROUTAB_SUBTYPE_DATAPOLLACK) || + (subtype == ROUTAB_SUBTYPE_QOSDATA) || + (subtype == ROUTAB_SUBTYPE_QOSDATAACK) || + (subtype == ROUTAB_SUBTYPE_QOSDATAPOLL) || + (subtype == ROUTAB_SUBTYPE_QOSDATAACKPOLL)) + reg |= ROUTAB_ROUTE_ENCRY; +// reg |= ROUTAB_ROUTE_CPU; + /*Drop NULL and QOS NULL ack, poll and poll ack*/ + else if ((subtype == ROUTAB_SUBTYPE_NULLACK) || + (subtype == ROUTAB_SUBTYPE_QOSNULLACK) || + (subtype == ROUTAB_SUBTYPE_NULLPOLL) || + (subtype == ROUTAB_SUBTYPE_QOSNULLPOLL) || + (subtype == ROUTAB_SUBTYPE_NULLPOLLACK) || + (subtype == ROUTAB_SUBTYPE_QOSNULLPOLLACK)) +// reg |= ROUTAB_ROUTE_DROP; + reg |= ROUTAB_ROUTE_CPU; + } + else + reg |= (ROUTAB_ROUTE_CPU); + iowrite32(reg, ctl + AGNX_RXM_ROUTAB); + /* Check to verify that the status bit cleared */ + routing_table_delay(); + } + } + enable_receiver(priv); +} /* routing_table_init */ + +void tx_engine_lookup_tbl_init(struct agnx_priv *priv) +{ + void __iomem *data = priv->data; + unsigned int i; + + for (i = 0; i <= 28; i += 4) + iowrite32(0xb00c, data + AGNX_ENGINE_LOOKUP_TBL + i); + for (i = 32; i <= 120; i += 8) { + iowrite32(0x1e58, data + AGNX_ENGINE_LOOKUP_TBL + i); + iowrite32(0xb00c, data + AGNX_ENGINE_LOOKUP_TBL + i + 4); + } + + for (i = 128; i <= 156; i += 4) + iowrite32(0x980c, data + AGNX_ENGINE_LOOKUP_TBL + i); + for (i = 160; i <= 248; i += 8) { + iowrite32(0x1858, data + AGNX_ENGINE_LOOKUP_TBL + i); + iowrite32(0x980c, data + AGNX_ENGINE_LOOKUP_TBL + i + 4); + } + + for (i = 256; i <= 284; i += 4) + iowrite32(0x980c, data + AGNX_ENGINE_LOOKUP_TBL + i); + for (i = 288; i <= 376; i += 8) { + iowrite32(0x1a58, data + AGNX_ENGINE_LOOKUP_TBL + i); + iowrite32(0x1858, data + AGNX_ENGINE_LOOKUP_TBL + i + 4); + } + + for (i = 512; i <= 540; i += 4) + iowrite32(0xc00c, data + AGNX_ENGINE_LOOKUP_TBL + i); + for (i = 544; i <= 632; i += 8) { + iowrite32(0x2058, data + AGNX_ENGINE_LOOKUP_TBL + i); + iowrite32(0xc00c, data + AGNX_ENGINE_LOOKUP_TBL + i + 4); + } + + for (i = 640; i <= 668; i += 4) + iowrite32(0xc80c, data + AGNX_ENGINE_LOOKUP_TBL + i); + for (i = 672; i <= 764; i += 8) { + iowrite32(0x2258, data + AGNX_ENGINE_LOOKUP_TBL + i); + iowrite32(0xc80c, data + AGNX_ENGINE_LOOKUP_TBL + i + 4); + } +} + |