element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development AXI-LIte + Linux
  • Forums
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Avnet Boards Forums requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 2 replies
  • Subscribers 43 subscribers
  • Views 170 views
  • Users 0 members are here
Related

AXI-LIte + Linux

Former Member
Former Member over 9 years ago

Hi all;
We have modified the DEMO project (Zedboard) and have added our IP which has a register with Axi-Lite communication (Slave with ap_hs communication). This IP is connected to Axi-Interconnect-0 and its direction is 0x43100000.
However, we had never problem with communication in "standalone" but when we use linux, we couldn't communicate with that register.
Mi question is: do we have to modify the DeviceTree.tdb and add IP?
In xilinx forum we saw that we can use mmap for read and write in the gpio, and in this case can we use mmap for this? One member of this forum mentions: ioremap must be used to read and write (physical address to a virtual address).
http://forums.xilinx.com/t5/Embedded-Linux/ZC702-How-to-access-custom-PL-logic-from-Linux-Kernel-Module/td-p/234874
Then, if we can use mmap and ioremap how can we use ioremap and mmap?

Any advice will be very helpful.
Ty a lot.
Paco

  • Reply
  • Cancel
  • Cancel
  • zedhed
    0 zedhed over 9 years ago

    Hi Peaceo,

    This can be done without having to resort to mmap() but you will need to add a device tree entry for your custom device.

    Here is the device tree entry for my LED brightness driver that accesses a PL AXI-Lite hardware controller at 0x41200000:

    led-brightness@412000000 {
        compatible = "avnet,led-brightness";
        reg = <0x41200000 0x20>;
    };

    Now in my driver, I have a platform device that I can later use to get the physical address of the I/O
    registers from the platform definition.

    /* platform device structures */
    struct platform_device *pdev;

    I also have the following lines in my probe function to retrieve the physical address space for my device instance within the platform definition.  Then this IO region is requested and ioremapped for read/write use:

    /* Obtain the memory resource for this device */
    led_brightness_dev->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);

    led_brightness_dev->mem = request_mem_region(led_brightness_dev->mem->start, resource_size(led_brightness_dev->mem), pdev->name);

    led_brightness_dev->iobase = ioremap(led_brightness_dev->mem->start, resource_size(led_brightness_dev->mem));

    Now in my write function, I can write into the remapped memory space and hit the slave hardware controller:

    writel((value * LED_BRIGHTNESS_FACTOR), dev->iobase);

    It may not be the most elegant way to accomplish this but it takes advantage of the device tree which can be really helpful if the hardware guys start switching the PL memory map around on you ;)

    Regards,

    -Kevin

    • Cancel
    • Up 0 Down
    • Reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago in reply to zedhed

    hi
    i am trying to access pl logic in which dipswitch and led are configured in [C_BASEADDR = 0x41200000+0x00 CHANNEL 1 AXI GPIO DATA REGISTER]
    here logic is created for 4 bits of CHANNEL 1 AXI GPIO DATA REGISTER,which is like


    axi_gpio_0_GPIO_IO_pin[0]        u00E8 LED DS19

    axi_gpio_0_GPIO_IO_pin[1]        u00E8 LED DS20

    axi_gpio_0_GPIO_IO_pin[2]        u00E8 DIP SWITCH SW12

    axi_gpio_0_GPIO_IO_pin[3]        u00E8 DIP SWITCH SW12

    in this i want to glow led with switch through ioremap
    can anyone tell how it can be done
    i did ioremap of physical address(C_BASEADDR = 0x41200000)+offset(0x00) and then tried to write value in virtual address which i got but not able to see led glowing.

    • Cancel
    • Up 0 Down
    • Reply
    • Verify Answer
    • Cancel
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube