| 1 | --- a/cppi_cpaal5.c |
| 2 | +++ b/cppi_cpaal5.c |
| 3 | @@ -360,7 +360,7 @@ static int halRxReturn(HAL_RECEIVEINFO * |
| 4 | { |
| 5 | /* malloc failed, add this RCB to Needs Buffer List */ |
| 6 | TempRcb->FragCount = 1; /*MJH+030417*/ |
| 7 | - (HAL_RCB *)TempRcb->Eop = TempRcb; /* GSG +030430 */ |
| 8 | + TempRcb->Eop = TempRcb; /* GSG +030430 */ |
| 9 | |
| 10 | if(HalDev->NeedsCount < MAX_NEEDS) /* +MJH 030410 */ |
| 11 | { /* +MJH 030410 */ |
| 12 | --- a/dsl_hal_api.c |
| 13 | +++ b/dsl_hal_api.c |
| 14 | @@ -273,15 +273,15 @@ |
| 15 | * 09/15/07 CPH CQ11466 Added EFM support |
| 16 | * 09/27/07 EYin CQ11929: Added NFEC/INP/Lp/Rp reporting for only ADSL2/2+ mode. |
| 17 | ******************************************************************************/ |
| 18 | -#include <dev_host_interface.h> |
| 19 | -#include <dsl_hal_register.h> |
| 20 | -#include <dsl_hal_support.h> |
| 21 | +#include "dev_host_interface.h" |
| 22 | +#include "dsl_hal_register.h" |
| 23 | +#include "dsl_hal_support.h" |
| 24 | |
| 25 | #ifndef NO_ADV_STATS |
| 26 | -#include <dsl_hal_logtable.h> |
| 27 | +#include "dsl_hal_logtable.h" |
| 28 | #endif |
| 29 | |
| 30 | -#include <dsl_hal_version.h> |
| 31 | +#include "dsl_hal_version.h" |
| 32 | |
| 33 | // UR8_MERGE_START CQ11054 Jack Zhang |
| 34 | static unsigned int highprecision_selected = 0; //By default we use low precision for backward compt. |
| 35 | --- a/dsl_hal_support.c |
| 36 | +++ b/dsl_hal_support.c |
| 37 | @@ -142,9 +142,9 @@ |
| 38 | * UR8_MERGE_START_END CQ11922 Tim |
| 39 | * 04Sep07 0.14.00 Tim CQ11922: Added support for new scratchram for INP NDR tables |
| 40 | *******************************************************************************/ |
| 41 | -#include <dev_host_interface.h> |
| 42 | -#include <dsl_hal_register.h> |
| 43 | -#include <dsl_hal_support.h> |
| 44 | +#include "dev_host_interface.h" |
| 45 | +#include "dsl_hal_register.h" |
| 46 | +#include "dsl_hal_support.h" |
| 47 | |
| 48 | #define NUM_READ_RETRIES 3 |
| 49 | static unsigned int dslhal_support_adsl2ByteSwap32(unsigned int in32Bits); |
| 50 | --- a/dsl_hal_support.h |
| 51 | +++ b/dsl_hal_support.h |
| 52 | @@ -49,7 +49,7 @@ |
| 53 | * 04Nov05 0.11.00 CPH Fixed T1413 mode got Zero DS/US rate when DSL_BIT_TMODE is set. |
| 54 | *******************************************************************************/ |
| 55 | |
| 56 | -#include <dsl_hal_api.h> |
| 57 | +#include "dsl_hal_api.h" |
| 58 | |
| 59 | #define virtual2Physical(a) (((int)a)&~0xe0000000) |
| 60 | /* External Function Prototype Declarations */ |
| 61 | --- a/Makefile |
| 62 | +++ b/Makefile |
| 63 | @@ -1,18 +1,9 @@ |
| 64 | -# File: drivers/atm/ti_evm3/Makefile |
| 65 | # |
| 66 | -# Makefile for the Texas Instruments EVM3 ADSL/ATM driver. |
| 67 | +# Makefile for the TIATM device driver. |
| 68 | # |
| 69 | -# |
| 70 | -# Copyright (c) 2000 Texas Instruments Incorporated. |
| 71 | -# Jeff Harrell (jharrell@telogy.com) |
| 72 | -# Viren Balar (vbalar@ti.com) |
| 73 | -# Victor Wells (vwells@telogy.com) |
| 74 | -# |
| 75 | -include $(TOPDIR)/Rules.make |
| 76 | - |
| 77 | - |
| 78 | - |
| 79 | - |
| 80 | - |
| 81 | - |
| 82 | |
| 83 | +CONFIG_SANGAM_ATM=m |
| 84 | +#EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT |
| 85 | +EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -DNO_ACT -D__NO__VOICE_PATCH__ -DEL |
| 86 | +obj-$(CONFIG_SANGAM_ATM) := tiatm.o |
| 87 | +tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o |
| 88 | --- a/tn7atm.c |
| 89 | +++ b/tn7atm.c |
| 90 | @@ -66,7 +66,6 @@ |
| 91 | * 09/18/07 CPH CQ11466 Added EFM Support |
| 92 | *********************************************************************************************/ |
| 93 | |
| 94 | -#include <linux/config.h> |
| 95 | #include <linux/kernel.h> |
| 96 | #include <linux/module.h> |
| 97 | #include <linux/init.h> |
| 98 | @@ -74,11 +73,14 @@ |
| 99 | #include <linux/delay.h> |
| 100 | #include <linux/spinlock.h> |
| 101 | #include <linux/smp_lock.h> |
| 102 | -#include <asm/io.h> |
| 103 | -#include <asm/mips-boards/prom.h> |
| 104 | #include <linux/proc_fs.h> |
| 105 | #include <linux/string.h> |
| 106 | #include <linux/ctype.h> |
| 107 | + |
| 108 | +#include <asm/io.h> |
| 109 | +#include <asm/ar7/ar7.h> |
| 110 | +#include <asm/ar7/prom.h> |
| 111 | + |
| 112 | #include "dsl_hal_api.h" |
| 113 | #ifdef AR7_EFM |
| 114 | #include "tn7efm.h" |
| 115 | @@ -90,6 +92,7 @@ |
| 116 | #include "dsl_hal_register.h" |
| 117 | |
| 118 | #ifdef MODULE |
| 119 | +MODULE_LICENSE("GPL"); |
| 120 | MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver"); |
| 121 | MODULE_AUTHOR ("Zhicheng Tang"); |
| 122 | #endif |
| 123 | @@ -108,9 +111,9 @@ MODULE_AUTHOR ("Zhicheng Tang"); |
| 124 | |
| 125 | /*end of externs */ |
| 126 | |
| 127 | -#ifndef TI_STATIC_ALLOCATIONS |
| 128 | -#define TI_STATIC_ALLOCATIONS |
| 129 | -#endif |
| 130 | +//#ifndef TI_STATIC_ALLOCATIONS |
| 131 | +//#define TI_STATIC_ALLOCATIONS |
| 132 | +//#endif |
| 133 | |
| 134 | #define tn7atm_kfree_skb(x) dev_kfree_skb(x) |
| 135 | |
| 136 | @@ -135,7 +138,7 @@ static int EnableQoS = FALSE; |
| 137 | /* prototypes */ |
| 138 | static int tn7atm_set_can_support_adsl2 (int can); |
| 139 | |
| 140 | -static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci); |
| 141 | +static int tn7atm_open (struct atm_vcc *vcc); |
| 142 | |
| 143 | void tn7atm_close (struct atm_vcc *vcc); |
| 144 | |
| 145 | @@ -298,13 +301,12 @@ static const struct atmdev_ops tn7atm_op |
| 146 | getsockopt: NULL, |
| 147 | setsockopt: NULL, |
| 148 | send: tn7atm_send, |
| 149 | - sg_send: NULL, |
| 150 | phy_put: NULL, |
| 151 | phy_get: NULL, |
| 152 | change_qos: tn7atm_change_qos, |
| 153 | }; |
| 154 | |
| 155 | -const char drv_proc_root_folder[] = "avalanche/"; |
| 156 | +const char drv_proc_root_folder[] = "avalanche"; |
| 157 | static struct proc_dir_entry *root_proc_dir_entry = NULL; |
| 158 | #define DRV_PROC_MODE 0644 |
| 159 | static int proc_root_already_exists = TRUE; |
| 160 | @@ -626,56 +628,6 @@ static int turbodsl_check_priority_type( |
| 161 | |
| 162 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 163 | * |
| 164 | - * Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci) |
| 165 | - * |
| 166 | - * Description: retrieve VPI/VCI for connection |
| 167 | - * |
| 168 | - *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 169 | -static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci) |
| 170 | -{ |
| 171 | - struct atm_vcc *walk; |
| 172 | - |
| 173 | - /* |
| 174 | - * find a free VPI |
| 175 | - */ |
| 176 | - if (*vpi == ATM_VPI_ANY) |
| 177 | - { |
| 178 | - |
| 179 | - for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next) |
| 180 | - { |
| 181 | - |
| 182 | - if ((walk->vci == *vci) && (walk->vpi == *vpi)) |
| 183 | - { |
| 184 | - (*vpi)++; |
| 185 | - walk = vcc->dev->vccs; |
| 186 | - } |
| 187 | - } |
| 188 | - } |
| 189 | - |
| 190 | - /* |
| 191 | - * find a free VCI |
| 192 | - */ |
| 193 | - if (*vci == ATM_VCI_ANY) |
| 194 | - { |
| 195 | - |
| 196 | - for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk; |
| 197 | - walk = walk->next) |
| 198 | - { |
| 199 | - |
| 200 | - if ((walk->vpi = *vpi) && (walk->vci == *vci)) |
| 201 | - { |
| 202 | - *vci = walk->vci + 1; |
| 203 | - walk = vcc->dev->vccs; |
| 204 | - } |
| 205 | - } |
| 206 | - } |
| 207 | - |
| 208 | - return 0; |
| 209 | -} |
| 210 | - |
| 211 | - |
| 212 | -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 213 | - * |
| 214 | * Function: int tn7atm_sar_irq(void) |
| 215 | * |
| 216 | * Description: tnetd73xx SAR interrupt. |
| 217 | @@ -766,7 +718,7 @@ static int __init tn7atm_irq_request (st |
| 218 | |
| 219 | priv->sar_irq = LNXINTNUM (ATM_SAR_INT); /* Interrupt line # */ |
| 220 | |
| 221 | - if (request_irq (priv->sar_irq, tn7atm_sar_irq, SA_INTERRUPT, "SAR ", dev)) |
| 222 | + if (request_irq (priv->sar_irq, tn7atm_sar_irq, IRQF_DISABLED, "SAR ", dev)) |
| 223 | printk ("Could not register tn7atm_sar_irq\n"); |
| 224 | |
| 225 | /* |
| 226 | @@ -777,8 +729,8 @@ static int __init tn7atm_irq_request (st |
| 227 | { |
| 228 | def_sar_inter_pace = os_atoi (ptr); |
| 229 | } |
| 230 | - avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM, |
| 231 | - def_sar_inter_pace); |
| 232 | + /* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM, |
| 233 | + def_sar_inter_pace); */ |
| 234 | |
| 235 | |
| 236 | #ifdef AR7_EFM |
| 237 | @@ -790,7 +742,7 @@ static int __init tn7atm_irq_request (st |
| 238 | * Reigster Receive interrupt A |
| 239 | */ |
| 240 | priv->dsl_irq = LNXINTNUM (ATM_DSL_INT); /* Interrupt line # */ |
| 241 | - if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, SA_INTERRUPT, "DSL ", dev)) |
| 242 | + if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, IRQF_DISABLED, "DSL ", dev)) |
| 243 | printk ("Could not register tn7atm_dsl_irq\n"); |
| 244 | |
| 245 | /***** VRB Tasklet Mode ****/ |
| 246 | @@ -958,11 +910,15 @@ static int __init tn7atm_get_ESI (struct |
| 247 | #define ATM_VBR_RT 5 |
| 248 | #endif |
| 249 | |
| 250 | -int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci) |
| 251 | +int tn7atm_open (struct atm_vcc *vcc) |
| 252 | { |
| 253 | tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm; |
| 254 | int rc; |
| 255 | //int flags; |
| 256 | + tn7atm_activate_vc_parm.pcr = 0x20000; |
| 257 | + tn7atm_activate_vc_parm.scr = 0x20000; |
| 258 | + tn7atm_activate_vc_parm.mbs = 0x20000; |
| 259 | + tn7atm_activate_vc_parm.cdvt = 10000; |
| 260 | |
| 261 | dgprintf(1, "tn7atm_open()\n"); |
| 262 | |
| 263 | @@ -974,24 +930,18 @@ int tn7atm_open (struct atm_vcc *vcc, sh |
| 264 | return -1; |
| 265 | } |
| 266 | |
| 267 | - MOD_INC_USE_COUNT; |
| 268 | +// MOD_INC_USE_COUNT; |
| 269 | |
| 270 | - /* find a free VPI/VCI */ |
| 271 | - tn7atm_walk_vccs(vcc, &vpi, &vci); |
| 272 | - |
| 273 | - vcc->vpi = vpi; |
| 274 | - vcc->vci = vci; |
| 275 | - |
| 276 | - if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC)) |
| 277 | + if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC)) |
| 278 | { |
| 279 | - MOD_DEC_USE_COUNT; |
| 280 | +// MOD_DEC_USE_COUNT; |
| 281 | return -EBUSY; |
| 282 | } |
| 283 | |
| 284 | - tn7atm_activate_vc_parm.vpi = vpi; |
| 285 | - tn7atm_activate_vc_parm.vci = vci; |
| 286 | + tn7atm_activate_vc_parm.vpi = vcc->vpi; |
| 287 | + tn7atm_activate_vc_parm.vci = vcc->vci; |
| 288 | |
| 289 | - if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI)) |
| 290 | + if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI)) |
| 291 | { |
| 292 | /* always use (max_dma_chan+1) for clear eoc */ |
| 293 | tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN; |
| 294 | @@ -999,7 +949,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh |
| 295 | /* check to see whether clear eoc is opened or not */ |
| 296 | if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse) |
| 297 | { |
| 298 | - MOD_DEC_USE_COUNT; |
| 299 | +// MOD_DEC_USE_COUNT; |
| 300 | printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan); |
| 301 | return -EBUSY; |
| 302 | } |
| 303 | @@ -1008,7 +958,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh |
| 304 | if (rc) |
| 305 | { |
| 306 | printk("tn7atm_open: failed to setup clear_eoc\n"); |
| 307 | - MOD_DEC_USE_COUNT; |
| 308 | +// MOD_DEC_USE_COUNT; |
| 309 | return -EBUSY; |
| 310 | } |
| 311 | tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan); |
| 312 | @@ -1017,17 +967,17 @@ int tn7atm_open (struct atm_vcc *vcc, sh |
| 313 | } |
| 314 | else /* PVC channel setup */ |
| 315 | { |
| 316 | - if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI)) |
| 317 | + if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI)) |
| 318 | { |
| 319 | tn7atm_activate_vc_parm.chan = 14; /* always use chan 14 for MII PVC-base romote mgmt */ |
| 320 | } |
| 321 | else |
| 322 | { |
| 323 | - rc = tn7atm_lut_find(vpi, vci); |
| 324 | + rc = tn7atm_lut_find(vcc->vpi, vcc->vci); |
| 325 | /* check to see whether PVC is opened or not */ |
| 326 | if(ATM_NO_DMA_CHAN != rc) |
| 327 | { |
| 328 | - MOD_DEC_USE_COUNT; |
| 329 | +// MOD_DEC_USE_COUNT; |
| 330 | printk("PVC already opened. dmachan = %d\n", rc); |
| 331 | return -EBUSY; |
| 332 | } |
| 333 | @@ -1059,6 +1009,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh |
| 334 | tn7atm_activate_vc_parm.priority = 2; |
| 335 | break; |
| 336 | |
| 337 | +#if 0 |
| 338 | case ATM_VBR: /* Variable Bit Rate-Non RealTime*/ |
| 339 | tn7atm_activate_vc_parm.qos = 1; |
| 340 | tn7atm_activate_vc_parm.priority = 1; |
| 341 | @@ -1080,6 +1031,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh |
| 342 | tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr; |
| 343 | tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv; |
| 344 | break; |
| 345 | +#endif |
| 346 | |
| 347 | default: |
| 348 | tn7atm_activate_vc_parm.qos = 2; |
| 349 | @@ -1107,7 +1059,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh |
| 350 | if (rc < 0) |
| 351 | { |
| 352 | printk("failed to activate hw channel\n"); |
| 353 | - MOD_DEC_USE_COUNT; |
| 354 | +// MOD_DEC_USE_COUNT; |
| 355 | tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan); |
| 356 | //spin_unlock_irqrestore(&chan_init_lock, flags); |
| 357 | return -EBUSY; |
| 358 | @@ -1197,7 +1149,7 @@ void tn7atm_close (struct atm_vcc *vcc) |
| 359 | tn7atm_lut_clear (vcc, dmachan); |
| 360 | //spin_unlock_irqrestore (&closeLock, closeFlag); |
| 361 | |
| 362 | - MOD_DEC_USE_COUNT; |
| 363 | +// MOD_DEC_USE_COUNT; |
| 364 | |
| 365 | dgprintf (1, "Leave tn7atm_close\n"); |
| 366 | } |
| 367 | @@ -1630,8 +1582,7 @@ int tn7atm_receive (void *os_dev, int ch |
| 368 | * firewall is on */ |
| 369 | |
| 370 | dgprintf (3, "pushing the skb...\n"); |
| 371 | - |
| 372 | - skb->stamp = vcc->timestamp = xtime; |
| 373 | + __net_timestamp(skb); |
| 374 | |
| 375 | xdump ((unsigned char *) skb->data, skb->len, 5); |
| 376 | |
| 377 | @@ -1854,8 +1805,7 @@ printk("!!!free atm irq: tn7atm_exit\n") |
| 378 | |
| 379 | kfree (dev->dev_data); |
| 380 | |
| 381 | - // atm_dev_deregister (dev); |
| 382 | - shutdown_atm_dev (dev); |
| 383 | + atm_dev_deregister (dev); |
| 384 | |
| 385 | /* |
| 386 | * remove proc entries |
| 387 | @@ -2086,9 +2036,6 @@ static int __init tn7atm_detect (void) |
| 388 | * Set up proc entry for atm stats |
| 389 | */ |
| 390 | |
| 391 | - if (tn7atm_xlate_proc_name |
| 392 | - (drv_proc_root_folder, &root_proc_dir_entry, &residual)) |
| 393 | - { |
| 394 | printk ("Creating new root folder %s in the proc for the driver stats \n", |
| 395 | drv_proc_root_folder); |
| 396 | root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL); |
| 397 | @@ -2098,7 +2045,6 @@ static int __init tn7atm_detect (void) |
| 398 | return -ENOMEM; |
| 399 | } |
| 400 | proc_root_already_exists = FALSE; |
| 401 | - } |
| 402 | |
| 403 | |
| 404 | /* |
| 405 | @@ -2731,7 +2677,5 @@ int tn7atm_proc_turbodsl_write(struct fi |
| 406 | return count; |
| 407 | } |
| 408 | |
| 409 | -#ifdef MODULE |
| 410 | module_init (tn7atm_detect); |
| 411 | module_exit (tn7atm_exit); |
| 412 | -#endif /* MODULE */ |
| 413 | --- a/tn7atm.h |
| 414 | +++ b/tn7atm.h |
| 415 | @@ -20,7 +20,8 @@ |
| 416 | //#include "mips_support.h" |
| 417 | #include <linux/list.h> |
| 418 | |
| 419 | -#include <linux/config.h> |
| 420 | +#define MIPS_EXCEPTION_OFFSET 8 |
| 421 | +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET) |
| 422 | |
| 423 | #ifdef CONFIG_MODVERSIONS |
| 424 | #include <linux/modversions.h> |
| 425 | --- a/tn7dsl.c |
| 426 | +++ b/tn7dsl.c |
| 427 | @@ -102,7 +102,6 @@ |
| 428 | * UR8_MERGE_END CQ11813 |
| 429 | * 09/18/07 CPH CQ11466: Added EFM support. |
| 430 | *********************************************************************************************/ |
| 431 | -#include <linux/config.h> |
| 432 | #include <linux/kernel.h> |
| 433 | #include <linux/module.h> |
| 434 | #include <linux/init.h> |
| 435 | @@ -110,8 +109,6 @@ |
| 436 | #include <linux/delay.h> |
| 437 | #include <linux/spinlock.h> |
| 438 | #include <linux/smp_lock.h> |
| 439 | -#include <asm/io.h> |
| 440 | -#include <asm/mips-boards/prom.h> |
| 441 | #include <linux/proc_fs.h> |
| 442 | #include <linux/string.h> |
| 443 | #include <linux/ctype.h> |
| 444 | @@ -119,6 +116,12 @@ |
| 445 | #include <linux/timer.h> |
| 446 | #include <linux/vmalloc.h> |
| 447 | #include <linux/file.h> |
| 448 | +#include <linux/firmware.h> |
| 449 | + |
| 450 | +#include <asm/io.h> |
| 451 | +#include <asm/ar7/ar7.h> |
| 452 | +#include <asm/ar7/prom.h> |
| 453 | + |
| 454 | /* Modules specific header files */ |
| 455 | #ifdef AR7_EFM |
| 456 | #include "tn7efm.h" |
| 457 | @@ -185,7 +188,7 @@ led_reg_t ledreg[2]; |
| 458 | static struct led_funcs ledreg[2]; |
| 459 | #endif |
| 460 | |
| 461 | -#define DEV_DSLMOD 1 |
| 462 | +#define DEV_DSLMOD CTL_UNNUMBERED |
| 463 | #define MAX_STR_SIZE 256 |
| 464 | #define DSL_MOD_SIZE 256 |
| 465 | |
| 466 | @@ -316,7 +319,7 @@ static PITIDSLHW_T pIhw; |
| 467 | static volatile int bshutdown; |
| 468 | static char info[MAX_STR_SIZE]; |
| 469 | /* Used for DSL Polling enable */ |
| 470 | -static DECLARE_MUTEX_LOCKED (adsl_sem_overlay); |
| 471 | +static struct semaphore adsl_sem_overlay; |
| 472 | |
| 473 | //kthread_t overlay_thread; |
| 474 | /* end of module wide declars */ |
| 475 | @@ -369,6 +372,14 @@ int os_atoih (const char *pstr) |
| 476 | return val; |
| 477 | } |
| 478 | |
| 479 | +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num, |
| 480 | + unsigned int pace_value) |
| 481 | +{ |
| 482 | + printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value); |
| 483 | + return 0; |
| 484 | +} |
| 485 | + |
| 486 | + |
| 487 | int os_atoi(const char *pStr) |
| 488 | { |
| 489 | int MulNeg = (*pStr == '-' ? -1 : 1); |
| 490 | @@ -405,39 +416,6 @@ void dprintf (int uDbgLevel, char *szFmt |
| 491 | #endif |
| 492 | } |
| 493 | |
| 494 | -int strcmp(const char *s1, const char *s2) |
| 495 | -{ |
| 496 | - |
| 497 | - int size = strlen(s1); |
| 498 | - |
| 499 | - return(strncmp(s1, s2, size)); |
| 500 | -} |
| 501 | - |
| 502 | -int strncmp(const char *s1, const char *s2, size_t size) |
| 503 | -{ |
| 504 | - int i = 0; |
| 505 | - int max_size = (int)size; |
| 506 | - |
| 507 | - while((s1[i] != 0) && i < max_size) |
| 508 | - { |
| 509 | - if(s2[i] == 0) |
| 510 | - { |
| 511 | - return -1; |
| 512 | - } |
| 513 | - if(s1[i] != s2[i]) |
| 514 | - { |
| 515 | - return 1; |
| 516 | - } |
| 517 | - i++; |
| 518 | - } |
| 519 | - if(s2[i] != 0) |
| 520 | - { |
| 521 | - return 1; |
| 522 | - } |
| 523 | - |
| 524 | - return 0; |
| 525 | -} |
| 526 | - |
| 527 | // * UR8_MERGE_START CQ10640 Jack Zhang |
| 528 | int tn7dsl_dump_dsp_memory(char *input_str) //cph99 |
| 529 | { |
| 530 | @@ -487,144 +465,78 @@ unsigned int shim_osGetCpuFrequency(void |
| 531 | return CpuFrequency; |
| 532 | } |
| 533 | |
| 534 | -int shim_osLoadFWImage(unsigned char *ptr) |
| 535 | +static void avsar_release(struct device *dev) |
| 536 | { |
| 537 | - unsigned int bytesRead; |
| 538 | - mm_segment_t oldfs; |
| 539 | - static struct file *filp; |
| 540 | - unsigned int imageLength=0x5ffff; |
| 541 | - |
| 542 | -#ifdef AR7_EFM |
| 543 | - int dp_alt=0; |
| 544 | - char *ptr1=NULL; |
| 545 | -#ifdef EFM_DEBUG |
| 546 | - char *ptr2=NULL; |
| 547 | - char *ptr3=NULL; |
| 548 | -#endif |
| 549 | - |
| 550 | - if ((ptr1 = prom_getenv("DSL_DP_ALT")) != NULL) |
| 551 | - { |
| 552 | - dp_alt=os_atoi(ptr1); |
| 553 | - if (dp_alt==1) |
| 554 | - { |
| 555 | - filp = filp_open(DSP_DEBUG_FIRMWARE_PATH,00,O_RDONLY); |
| 556 | - if (!IS_ERR(filp)) |
| 557 | - { |
| 558 | - strcpy (DSP_FIRMWARE_PATH, DSP_DEBUG_FIRMWARE_PATH); |
| 559 | - } |
| 560 | - } |
| 561 | -#ifdef EFM_DEBUG |
| 562 | - else if (dp_alt==2) |
| 563 | - { |
| 564 | - if ((ptr2 = prom_getenv("DSL_DP")) != NULL) |
| 565 | - { |
| 566 | - if (!strncmp(ptr2, "DSL_DP", 6)) |
| 567 | - { // indirect naming |
| 568 | - if ((ptr3 = prom_getenv(ptr2)) != NULL) |
| 569 | - filp = filp_open(ptr3,00,O_RDONLY); |
| 570 | - ptr2 = ptr3; // redirect ptr2 to ptr3 |
| 571 | - } |
| 572 | - |
| 573 | - filp = filp_open(ptr2,00,O_RDONLY); |
| 574 | - if (!IS_ERR(filp)) |
| 575 | - { |
| 576 | - strcpy (DSP_FIRMWARE_PATH, ptr2); |
| 577 | - } |
| 578 | - } |
| 579 | - } |
| 580 | - printk("dp_path=%s\n", DSP_FIRMWARE_PATH); |
| 581 | -#endif |
| 582 | - } |
| 583 | -#endif |
| 584 | - |
| 585 | - dgprintf(4, "tn7dsl_read_dsp()\n"); |
| 586 | - |
| 587 | - dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH); |
| 588 | - |
| 589 | - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY); |
| 590 | - if(IS_ERR(filp)) |
| 591 | - { |
| 592 | - printk("Failed: Could not open DSP binary file\n"); |
| 593 | - return -1; |
| 594 | - } |
| 595 | - |
| 596 | - if (filp->f_dentry != NULL) |
| 597 | - { |
| 598 | - if (filp->f_dentry->d_inode != NULL) |
| 599 | - { |
| 600 | - printk ("DSP binary filesize = %d bytes\n", |
| 601 | - (int) filp->f_dentry->d_inode->i_size); |
| 602 | - imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200; |
| 603 | - } |
| 604 | - } |
| 605 | - |
| 606 | - if (filp->f_op->read==NULL) |
| 607 | - return -1; /* File(system) doesn't allow reads */ |
| 608 | - |
| 609 | - /* |
| 610 | - * Disable parameter checking |
| 611 | - */ |
| 612 | - oldfs = get_fs(); |
| 613 | - set_fs(KERNEL_DS); |
| 614 | - |
| 615 | - /* |
| 616 | - * Now read bytes from postion "StartPos" |
| 617 | - */ |
| 618 | - filp->f_pos = 0; |
| 619 | - |
| 620 | - bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos); |
| 621 | - |
| 622 | - dgprintf(4,"file length = %d\n", bytesRead); |
| 623 | - |
| 624 | - set_fs(oldfs); |
| 625 | - |
| 626 | - /* |
| 627 | - * Close the file |
| 628 | - */ |
| 629 | - fput(filp); |
| 630 | - |
| 631 | - return bytesRead; |
| 632 | + printk(KERN_DEBUG "avsar firmware released\n"); |
| 633 | } |
| 634 | |
| 635 | +static struct device avsar = { |
| 636 | + .bus_id = "vlynq", |
| 637 | + .release = avsar_release, |
| 638 | +}; |
| 639 | |
| 640 | -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset, |
| 641 | - unsigned int secLength) |
| 642 | +int shim_osLoadFWImage(unsigned char *ptr) |
| 643 | { |
| 644 | - unsigned int bytesRead; |
| 645 | - mm_segment_t oldfs; |
| 646 | - struct file *filp; |
| 647 | - |
| 648 | - dgprintf(4,"shim_read_overlay_page\n"); |
| 649 | - //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength); |
| 650 | + const struct firmware *fw_entry; |
| 651 | + size_t size; |
| 652 | |
| 653 | - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY); |
| 654 | - if(filp ==NULL) |
| 655 | - { |
| 656 | - printk("Failed: Could not open DSP binary file\n"); |
| 657 | - return -1; |
| 658 | - } |
| 659 | - |
| 660 | - if (filp->f_op->read==NULL) |
| 661 | - return -1; /* File(system) doesn't allow reads */ |
| 662 | - |
| 663 | - /* |
| 664 | - * Now read bytes from postion "StartPos" |
| 665 | - */ |
| 666 | + printk("requesting firmware image \"ar0700xx.bin\"\n"); |
| 667 | + if(device_register(&avsar) < 0) { |
| 668 | + printk(KERN_ERR |
| 669 | + "avsar: device_register fails\n"); |
| 670 | + return -1; |
| 671 | + } |
| 672 | + |
| 673 | + if (request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) { |
| 674 | + printk(KERN_ERR |
| 675 | + "avsar: Firmware not available\n"); |
| 676 | + device_unregister(&avsar); |
| 677 | + return -1; |
| 678 | + } |
| 679 | + size = fw_entry->size; |
| 680 | + device_unregister(&avsar); |
| 681 | + if (size > 0x6ffff) { |
| 682 | + printk(KERN_ERR |
| 683 | + "avsar: Firmware too big (%d bytes)\n", size); |
| 684 | + release_firmware(fw_entry); |
| 685 | + return -1; |
| 686 | + } |
| 687 | + memcpy(ptr, fw_entry->data, size); |
| 688 | + release_firmware(fw_entry); |
| 689 | + return size; |
| 690 | +} |
| 691 | + |
| 692 | +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength) |
| 693 | +{ |
| 694 | + const struct firmware *fw_entry; |
| 695 | + |
| 696 | + printk("requesting firmware image \"ar0700xx.bin\"\n"); |
| 697 | + if (device_register(&avsar) < 0) { |
| 698 | + printk(KERN_ERR |
| 699 | + "avsar: device_register fails\n"); |
| 700 | + return -1; |
| 701 | + } |
| 702 | + |
| 703 | + if (request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) { |
| 704 | + printk(KERN_ERR |
| 705 | + "avsar: Firmware not available\n"); |
| 706 | + device_unregister(&avsar); |
| 707 | + return -1; |
| 708 | + } |
| 709 | + |
| 710 | + device_unregister(&avsar); |
| 711 | + if (fw_entry->size > secLength) { |
| 712 | + printk(KERN_ERR |
| 713 | + "avsar: Firmware too big (%d bytes)\n", fw_entry->size); |
| 714 | + release_firmware(fw_entry); |
| 715 | + return -1; |
| 716 | + } |
| 717 | + memcpy(ptr + secOffset, fw_entry->data, secLength); |
| 718 | + release_firmware(fw_entry); |
| 719 | + return secLength; |
| 720 | +} |
| 721 | |
| 722 | - if(filp->f_op->llseek) |
| 723 | - filp->f_op->llseek(filp,secOffset, 0); |
| 724 | - oldfs = get_fs(); |
| 725 | - set_fs(KERNEL_DS); |
| 726 | - filp->f_pos = secOffset; |
| 727 | - bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos); |
| 728 | |
| 729 | - set_fs(oldfs); |
| 730 | - /* |
| 731 | - * Close the file |
| 732 | - */ |
| 733 | - fput(filp); |
| 734 | - return bytesRead; |
| 735 | -} |
| 736 | |
| 737 | int shim_osLoadDebugFWImage(unsigned char *ptr) |
| 738 | { |
| 739 | @@ -3287,6 +3199,7 @@ int tn7dsl_init(void *priv) |
| 740 | int high_precision_selected = 0; |
| 741 | // UR8_MERGE_END CQ11054* |
| 742 | |
| 743 | + sema_init(&adsl_sem_overlay, 0); |
| 744 | /* |
| 745 | * start dsl |
| 746 | */ |
| 747 | @@ -3665,7 +3578,7 @@ static int dslmod_sysctl(ctl_table *ctl, |
| 748 | */ |
| 749 | if(write) |
| 750 | { |
| 751 | - ret = proc_dostring(ctl, write, filp, buffer, lenp); |
| 752 | + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0); |
| 753 | |
| 754 | switch (ctl->ctl_name) |
| 755 | { |
| 756 | @@ -3751,14 +3664,14 @@ static int dslmod_sysctl(ctl_table *ctl, |
| 757 | else |
| 758 | { |
| 759 | len += sprintf(info+len, mod_req); |
| 760 | - ret = proc_dostring(ctl, write, filp, buffer, lenp); |
| 761 | + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0); |
| 762 | } |
| 763 | return ret; |
| 764 | } |
| 765 | |
| 766 | |
| 767 | ctl_table dslmod_table[] = { |
| 768 | - {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, &dslmod_sysctl} |
| 769 | + {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string} |
| 770 | , |
| 771 | {0} |
| 772 | }; |
| 773 | @@ -3781,8 +3694,7 @@ void tn7dsl_dslmod_sysctl_register(void) |
| 774 | if (initialized == 1) |
| 775 | return; |
| 776 | |
| 777 | - dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1); |
| 778 | - dslmod_root_table->child->de->owner = THIS_MODULE; |
| 779 | + dslmod_sysctl_header = register_sysctl_table(dslmod_root_table); |
| 780 | |
| 781 | /* |
| 782 | * set the defaults |
| 783 | --- a/tn7sar.c |
| 784 | +++ b/tn7sar.c |
| 785 | @@ -43,7 +43,6 @@ |
| 786 | * 09/18/07 CPH CQ11466: Added EFM support. |
| 787 | *******************************************************************************/ |
| 788 | |
| 789 | -#include <linux/config.h> |
| 790 | #include <linux/kernel.h> |
| 791 | #include <linux/module.h> |
| 792 | #include <linux/init.h> |
| 793 | @@ -51,12 +50,13 @@ |
| 794 | #include <linux/delay.h> |
| 795 | #include <linux/spinlock.h> |
| 796 | #include <linux/smp_lock.h> |
| 797 | -#include <asm/io.h> |
| 798 | -#include <asm/mips-boards/prom.h> |
| 799 | #include <linux/proc_fs.h> |
| 800 | #include <linux/string.h> |
| 801 | #include <linux/ctype.h> |
| 802 | |
| 803 | +#include <asm/io.h> |
| 804 | +#include <asm/ar7/ar7.h> |
| 805 | +#include <asm/ar7/prom.h> |
| 806 | |
| 807 | #define _CPHAL_AAL5 |
| 808 | #define _CPHAL_SAR |
| 809 | |