v1.c (14e77332e74603efab8347c89d3cda447c3b97c9) v1.c (f15cde64b66161bfa74fb58f4e5697d8265b802e)
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 252 unchanged lines hidden (view full) ---

261 nvkm_falcon_mask(falcon, 0x004, mask, mask);
262 /* wait until interrupts are cleared */
263 ret = nvkm_wait_msec(device, 10, falcon->addr + 0x008, mask, 0x0);
264 if (ret < 0)
265 return ret;
266
267 return 0;
268}
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 252 unchanged lines hidden (view full) ---

261 nvkm_falcon_mask(falcon, 0x004, mask, mask);
262 /* wait until interrupts are cleared */
263 ret = nvkm_wait_msec(device, 10, falcon->addr + 0x008, mask, 0x0);
264 if (ret < 0)
265 return ret;
266
267 return 0;
268}
269
270static int
271falcon_v1_wait_idle(struct nvkm_falcon *falcon)
272{
273 struct nvkm_device *device = falcon->owner->device;
274 int ret;
275
276 ret = nvkm_wait_msec(device, 10, falcon->addr + 0x04c, 0xffff, 0x0);
277 if (ret < 0)
278 return ret;
279
280 return 0;
281}
282
283int
284nvkm_falcon_v1_enable(struct nvkm_falcon *falcon)
285{
286 struct nvkm_device *device = falcon->owner->device;
287 int ret;
288
289 ret = nvkm_wait_msec(device, 10, falcon->addr + 0x10c, 0x6, 0x0);
290 if (ret < 0) {
291 nvkm_error(falcon->user, "Falcon mem scrubbing timeout\n");
292 return ret;
293 }
294
295 ret = falcon_v1_wait_idle(falcon);
296 if (ret)
297 return ret;
298
299 /* enable IRQs */
300 nvkm_falcon_wr32(falcon, 0x010, 0xff);
301
302 return 0;
303}
304
305void
306nvkm_falcon_v1_disable(struct nvkm_falcon *falcon)
307{
308 /* disable IRQs and wait for any previous code to complete */
309 nvkm_falcon_wr32(falcon, 0x014, 0xff);
310 falcon_v1_wait_idle(falcon);
311}