Your SlideShare is downloading. ×
How to write Platform Devices and Drivers with FPGA via GPMC
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

How to write Platform Devices and Drivers with FPGA via GPMC


Published on

How to write Platform Devices and Drivers with FPGA via GPMC

How to write Platform Devices and Drivers with FPGA via GPMC

Published in: Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. How to write Platform Devices and Drivers with FPGA via GPMC Bo-Yi Wu 2011.06.15
  • 2. What’s GPMC
    • 全名 General-Purpose Memory Controller
    • the device unified memory controller (UMC) dedicated to interfacing external memory devices.
      • NAND Flash
      • NOR Flash
      • FPGA (*)
    • 如果要更深入研究,請參考 TI 線上 Documentation
  • 3. 寫 GPMC Drive 跟 FPGA 溝通前
  • 4. 必須先瞭解什麼是 Platform Devices 和 Platform Drivers
  • 5. 撰寫 Driver Model 事先預備 Porting Drivers to New Driver Model
    • Driver Binding
    • Bus Types
    • Device Classes
    • Basic Device Structure
    • Managed Device Resource
    • Device Drivers
    • Device Interfaces
    • Platform Devices and Drivers
  • 6. Platform 架構
    • 參考 <linux/platform_device.h> 來瞭解 driver model 如何跟 platform bus 溝通
    • 用在 system-on-chip processors 或者是一些 &quot;legacy&quot; PC interconnects
  • 7. Platform devices
    • 請指定一個名稱用來 Driver Binding ,以及定義該 Devices 需要用到的 addresses 和 IRQs.
    struct platform_device { const char *name; u32 id; struct device dev; u32 num_resources; struct resource *resource; };
  • 8. Platform drivers
    • Platform drivers 走 Driver Model 標準規範,提供 probe 及 remove method ,它們提供 power 管理及關閉提醒等標準
  • 9. struct platform_driver { int (*probe)(struct platform_device *); int (*remove)(struct platform_device *); void (*shutdown)(struct platform_device *); int (*suspend)(struct platform_device *, pm_message_t state); int (*suspend_late)(struct platform_device *, pm_message_t state); int (*resume_early)(struct platform_device *); int (*resume)(struct platform_device *); struct device_driver driver; };
  • 10.
    • Probe 用來偵測特定 Hardware 是否存在,及使用該裝置資源 (clocks 和 device platform_data)
    • 透過底下函式來註冊 Driver
      • int platform_driver_register(struct platform_driver *drv);
    • 過去 Legacy Driver 並不會完全遵守標準 driver model ,這些 driver 會去註冊自己的 platform device ,而不是讓系統來完成註冊
  • 11. 裝置初始化
    • 在大多數的 Platform 設備都必須先註冊 Platform Device
      • 定義 platform_data, resource, 共有多少個 resource 等等
      • platform_device_register
      • platform_add_devices
  • 12. Device Naming 和 Driver Binding
    • 是一個 device id 分為兩個 component:
      • 用來跟 Driver match
      • 裝置編號順序 ( 例如假設有支援多個 NAND 或 NOR Flash) ,如果設定為 -1 表示為獨一無二的裝置
  • 13. Driver binding
    • 在 Driver Core 裡面透過 probe 自動匹對
      • 利用 Device Name and ID 去 match
        • name/id: gpmc_bus.1 或 gpmc_bus
  • 14. board-omap3evm GPMC Device Init Match Driver name GPMC Driver Init GPMC Address IRQ GPMC Clock and Chip Select Define
  • 15. GPMC support functions
    • gpmc_cs_read_reg
    • gpmc_cs_write_reg
    • Please referrer arch/arm/mach-omap2/gpmc.c
  • 16. GPMC Address Mapping
  • 17.
    • Supported Devices
      • .GPMC_CONFIG1_i[11:10]
    • Access Size Adaptation and Device Width
      • .GPMC_CONFIG1_i[13:12]
  • 18. Timing Setting
  • 19. 上面兩張設定如果設定正確,就可以正確看到波形,如果設定錯誤,請準備接收 Kernel Panic
  • 20. 結論
    • Platform Device 和 Platform Driver 區別?
    • GPMC Config_[1-7] 設定方式及規範
    • 實際參考 NAND Driver 程式