wowo
    @hangkeke052:我只是觉得,这个UART只作为i2c转换用的话,没必要绕道到用户空间。 其实kernel有一个子系统,是支持这种需求的:serio,类似serial子系统(可以理解为kernel态的串口驱动吧)。 并且kernel中也有类似的例子: drivers/i2c/busses/i2c-taos-evm.c 如果真的要标准,而且不怕麻烦的话,就照着这个做就行了。
    Linux I2C framework(2)_I2C provider  发表时间:2016-10-21 15:59
    hangkeke052
    @wowo:"平常的i2c driver通过读写i2c controller的寄存器,实现i2c的收发,而此处的i2c driver,则是通过读写UART controller的寄存器,实现i2c的收发" 这一句不是很理解,其中的i2c driver 指的是device 的i2c_driver 这个结构体还是指的是platform driver ? https://community.nxp.com/servlet/JiveServlet/showImage/2-842429-166109/pastedImage_1.png 这个是我画的一个草图,对i2c子设备的读写操做只能通过uart向SC18IM700发送特定format 的消息。而发送消息则是open操作 /dev/tty*,那应该是第二种方式?
    Linux I2C framework(2)_I2C provider  发表时间:2016-10-21 15:11
    hangkeke052
    @wowo:"平常的i2c driver通过读写i2c controller的寄存器,实现i2c的收发,而此处的i2c driver,则是通过读写UART controller的寄存器,实现i2c的收发" 这一句不是很理解,其中的i2c driver 指的是device 的i2c_driver 这个结构体还是指的是platform driver ? https://community.nxp.com/servlet/JiveServlet/showImage/2-842429-166109/pastedImage_1.png 这个是我画的一个草图,对i2c子设备的读写操做只能通过uart向SC18IM700发送特定format 的消息。而发送消息则是open操作 /dev/tty*,那应该是第二种方式?
    Linux I2C framework(2)_I2C provider  发表时间:2016-10-21 15:09
    温柔海洋
    @linuxer:谢谢答疑。
    Why Memory Barriers?中文翻译(上)  发表时间:2016-10-21 12:14
    linuxer
    @温柔海洋:其实在新的内核中(我正在读的是4.4.6的代码),arch_is_coherent() 已经消失了,因此我找了旧内核的代码(2.6.23)并简单的看了看。你的推断是对的,如果arch_is_coherent() 等于0,则说明在硬件设计中,有DMA能力的设备并不会“snooping”cache,也就是说,如果打开了cache,那么cpu对dma buffer的访问不会及时的更新到main memory中,可能暂存在cache中,这时候,dma controller访问dma buffer的时候将访问到旧的数据,从而产生了一致性问题。解决这个问题的方法就是设定dma buffer是uncached。
    Why Memory Barriers?中文翻译(上)  发表时间:2016-10-21 11:42
    温柔海洋
    @linuxer:太感谢了,哈哈,在我的内核arch/arm/mm/dma-mapping.c函数__dma_alloc里面 有个arch_is_coherent()函数返回值判断,但是我grep了整个Linux 内核代码树,发现只有arch/arm/include/asm/memory.h里面定义了这个函数: #define arch_is_coherent() 0 如果为0,就代表该arch不是coherent, 即函数__dma_alloc会走__dma_alloc_remap从consistent 区域分配一块虚存区域。 如果该arch为 coherent 的话,会走page_address函数,就是直接返回该物理页面对应的虚存地址即可。 所以是不是比如我的soc芯片是NXP imx6,在厂商的kernel代码包定义arch_is_coherent 返回值为0,就说明该SOC在该kernel里面实现为non-coherent arch.是不是就可以推测出该SOC硬件上无法保证cache一致性?是不是就可以进一步推测出dma_coherent系统函数最后分配操作的内存都是uncached? 因为国内做SOC级别的嵌入式工程师比较多些,对arch coherent 仅仅是熟悉,会灵活运用,知道它对内核态驱动开发产生的影响就行了。所以我比较关注它的实际应用。 最后对于Linuxer这种精通arm arch的人,只能再次膜拜,哈哈。
    Why Memory Barriers?中文翻译(上)  发表时间:2016-10-21 10:27
    linuxer
    @温柔海洋:算了,还是说两句吧,对于第二个问题,arm平台下,dma_alloc_coherent实际分配和操作的dma内存都是uncached,通过这个来保证coherent的吧?我是这么考虑的: ----------------------- 如果在该arm系统中,所有的物理内存都是inner shareable的,而cpu core和dma controller又不在一个inner shareable domain,也就是说,HW 无法维护内存数据访问的一致性,在这种情况下,dma_alloc_coherent函数分配的DMA BUFFER只能是uncached,因为只有这样,才能保证coherence。 当然,如果在ARM系统设计的时候,也可以引入一些HW block,对cpu core上的cache进行嗅探,维护cpu和dma controller数据访问的一致性,那么在这样的系统中,dma_alloc_coherent实际分配和操作的dma内存也可以是cached。
    Why Memory Barriers?中文翻译(上)  发表时间:2016-10-21 00:22
    linuxer
    @温柔海洋:问下arm 体系架构现在还是non-coherent的吗? ---------------------- 我先重复一下你的问题好了,我想你应该问的是:对于一个ARM系统而言,各个cpu core和dma controller对内存的访问是coherent的吗? 这个问题其实是不好回答的,因为arm体系结构只是定义了PE的操作行为,并没有定义DMA controller的行为,因此,我只能说,是否coherent是和具体的系统实现有关,哈哈。 当然,想要理解cpu core、dma controller或者其他的bus master or agent在进行数据访问的时候是否是coherent的,首先需要理解shareable domain的概念。如何划分shareable domain是和系统设计相关,我们假设一个系统的domain分配如下: (1)所有的cpu core属于一个inner shareable domain (2)所有的cpu core和dma controller属于一个outer shareable domain 在ARM architecture中,对一个normal memory location而言,是否是coherent是和它的页表中的shareability attribute的设定相关。 (1)non-shareable。根本不会再多个agent之间共享,不存在coherent的问题。 (2)inner-shareable。说明inner shareable domain中的所有的agent在对该内存进行数据访问的时候,硬件会保证coherent。 (3)outer-shareable。说明outer shareable domain中的所有的agent在对该内存进行数据访问的时候,硬件会保证coherent。 已经有点晚了,另外一个问题,我改天再回答吧!
    Why Memory Barriers?中文翻译(上)  发表时间:2016-10-20 23:58
    狂奔的乌龟
    @wowo:@wowo 1、是各个device driver的probe。 ---关于这个,是在dtsi中配置成pinctrl-names = "default"时才配置吧?如果pinctrl-names配置成其他的名字,在device driver的probe中不配置吧?pinctrl_bind_pins函数如下: dev->pins->default_state = pinctrl_lookup_state(dev->pins->p, PINCTRL_STATE_DEFAULT); ret = pinctrl_select_state(dev->pins->p, dev->pins->default_state); 2、如果我在dtsi中配置pinctrl-names = "idle",那么这个idle的配置什么时候生效呢?
    wowo
    @cracker:1. 是的。 2. 为什么屏幕背光毁灭?我猜在freeze task的时候,有些task主动关的背光,不过具体是怎么回事,你可以再查查。至于suspend失败的原因,应该是电源管理服务的锁----PowerManagerService.WakeLocks(因为你现在在充电)。另外你可以看看这个文件,它有很多统计信息: /sys/kernel/debug/suspend_stats
    Linux电源管理(8)_Wakeup count功能  发表时间:2016-10-20 19:51

共7862条366/787上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 下一页
Copyright @ 2013-2015 蜗窝科技 All rights reserved. Powered by emlog