Changeset 3164


Ignore:
Timestamp:
Aug 13, 2012, 9:20:21 PM (3 years ago)
Author:
wmb
Message:

SDHCI driver - Use new device tree layout for SDHCI nodes to support Linux SDHCI instantiation via the device tree. I made a cursory attempt to avoid breaking the XO-1 and XO-1.5 builds.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/olpc/1.75/sdhci.fth

    r3130 r3164  
    11fload ${BP}/cpu/arm/olpc/emmc.fth
    22
    3 \ Device node for internal microSD
     3\ Device node for external SD
    44dev /sd
    55   new-device
    6       1 encode-int " reg" property
    7       fload ${BP}/dev/mmc/sdhci/sdmmc.fth
    8       fload ${BP}/dev/mmc/sdhci/selftest.fth
    9       " external" " slot-name" string-property
     6      h# d428.0000 h# 800 reg
     7      8 encode-int " bus-width" property
     8      " mrvl,pxav3-mmc" encode-string  " compatible" property
     9      d# 31 encode-int " clk-delay-cycles" property
     10      fload ${BP}/dev/mmc/sdhci/slot.fth
     11      d# 39 " interrupts" integer-property
     12
     13      " /pmua" encode-phandle 3 encode-int encode+ " clocks" property
     14      " PXA-SDHCLK" " clock-names" string-property
     15      d# 40 encode-int  1 encode-int encode+  " power-delay-ms" property
     16
     17      new-device
     18         fload ${BP}/dev/mmc/sdhci/sdmmc.fth
     19         fload ${BP}/dev/mmc/sdhci/selftest.fth
     20         " external" " slot-name" string-property
     21      finish-device
    1022   finish-device
    1123device-end
    1224
    13 devalias int /sd/disk@3
    14 devalias ext /sd/disk@1
     25\ mmc1 is set in common code, always to the WLAN device
     26devalias mmc0 /sd/sdhci@d4281000  \ Primary boot device
     27devalias mmc2 /sd/sdhci@d4280000  \ External SD
     28
     29devalias int /sd/sdhci@d4281000/disk
     30devalias ext /sd/sdhci@d4280000/disk
  • cpu/arm/olpc/3.0/sdhci.fth

    r3130 r3164  
    11fload ${BP}/cpu/arm/olpc/emmc.fth
    2 devalias int /sd/disk@3
     2devalias int /sd/sdhci@d4281000/disk
     3devalias mmc0 /sd/sdhci@d4281000
  • cpu/arm/olpc/cl4/sdhci.fth

    r3130 r3164  
    1 dev /sd
     1dev /sd  \ MMC1 - External SD
    22   new-device
    3    1 encode-int " reg" property
    4    fload ${BP}/dev/mmc/sdhci/sdmmc.fth
    5    fload ${BP}/dev/mmc/sdhci/selftest.fth
    6    " external" " slot-name" string-property
     3      h# d428.0000 h# 800 reg
     4      8 encode-int " bus-width" property
     5      " sdhci-pxav3" +compatible
     6      " mrvl,pxav3-mmc" +compatible
     7      d# 31 encode-int " clk-delay-cycles" property
     8      fload ${BP}/dev/mmc/sdhci/slot.fth
     9      d# 39 " interrupts" integer-property
     10
     11      " /pmua" encode-phandle 3 encode-int encode+ " clocks" property
     12      " PXA-SDHCLK" " clock-names" string-property
     13      d# 40 encode-int  1 encode-int encode+  " power-delay-ms" property
     14      \ Active low
     15      " /gpio" encode-phandle  d# 31 encode-int encode+  1 encode-int encode+  " cd-gpios"  property
     16
     17      new-device
     18         fload ${BP}/dev/mmc/sdhci/sdmmc.fth
     19         fload ${BP}/dev/mmc/sdhci/selftest.fth
     20         " external" " slot-name" string-property
     21      finish-device
    722   finish-device
    823device-end
    924
    10 dev /sd
     25dev /sd  \ MMC5 - internal micro-SD
    1126   new-device
    12    5 encode-int " reg" property
    13    fload ${BP}/dev/mmc/sdhci/sdmmc.fth
    14    fload ${BP}/dev/mmc/sdhci/selftest.fth
    15    " internal" " slot-name" string-property
     27      h# d421.7000 h# 800 reg
     28
     29      8 encode-int " bus-width" property
     30      " sdhci-pxav3" +compatible
     31      " mrvl,pxav3-mmc" +compatible
     32      d# 31 encode-int " clk-delay-cycles" property
     33      fload ${BP}/dev/mmc/sdhci/slot.fth
     34      " /interrupt-controller/interrupt-controller@184" encode-phandle " interrupt-parent" property
     35      d# 0 " interrupts" integer-property
     36
     37      " /pmua" encode-phandle d# 27 encode-int encode+ " clocks" property
     38      " PXA-SDHCLK" " clock-names" string-property
     39      d# 40 encode-int  1 encode-int encode+  " power-delay-ms" property
     40      0 0 " broken-cd" property
     41
     42      new-device
     43         fload ${BP}/dev/mmc/sdhci/sdmmc.fth
     44         fload ${BP}/dev/mmc/sdhci/selftest.fth
     45         " internal" " slot-name" string-property
     46      finish-device
    1647   finish-device
    1748device-end
    1849
    19 devalias ext     /sd/disk@1
    20 \ 2 is WLAN
    21 devalias int     /sd/disk@3
    22 devalias emmc    /sd/disk@3
     50\ mmc1 is set in common code, always to the WLAN device
     51devalias mmc2    /sd/sdhci@d4280000       \ External SD
     52
     53devalias ext     /sd/sdhci@d4280000/disk
     54\ MMC2 @d4280800 is WLAN
     55devalias emmc    /sd/sdhci@d4281000/disk
    2356\ Nothing on channel 4
    24 devalias int-sd  /sd/disk@5
     57devalias int-sd  /sd/sdhci@d4217000/disk
    2558
    2659stand-init:
    27    boot-dev-sel-gpio# gpio-pin@  0=  if
    28       " int" " /sd/disk@5"  $devalias
     60   \ The BOOT_DEV_SEL strap lets you choose either eMMC or microSD, both internal,
     61   \ as the primary boot device.
     62   boot-dev-sel-gpio# gpio-pin@  if
     63      " int"  " /sd/sdhci@d4281000/disk" $devalias  \ eMMC
     64      " mmc0" " /sd/sdhci@d4281000" $devalias  \ eMMC is primary storage
     65      " mmc3" " /sd/sdhci@d4217000" $devalias  \ Micro-SD is auxiliary device
     66   else
     67      " int"  " /sd/sdhci@d4217000/disk" $devalias  \ micro-SD
     68      " mmc0" " /sd/sdhci@d4217000" $devalias  \ Micro-SD is primary storage
     69      " mmc3" " /sd/sdhci@d4281000" $devalias  \ eMMC is auxiliary storage
    2970   then
    3071;
  • cpu/arm/olpc/sdhci.fth

    r3111 r3164  
    11purpose: Load file for SDHCI (Secure Digital Host Controller Interface)
    22
    3 0 0  " d4280000"  " /"  begin-package
     30 0  " "  " /"  begin-package
    44
    55   fload ${BP}/cpu/arm/olpc/sdregs.fth
    66   fload ${BP}/dev/mmc/sdhci/sdhci.fth
     7
     8   " simple-bus" +compatible
     9   h# d4280000 encode-int  h# d4280000 encode-int encode+  h# 2000 encode-int encode+ 
     10   h# d4217000 encode-int encode+  h# d4217000 encode-int encode+  h# 800 encode-int encode+ 
     11" ranges" property
     12   1 " #address-cells" integer-property
     13   1 " #size-cells" integer-property
    714
    815   d# 1 to power-off-time  \ A2 and A3 have turn-off clamps
     
    1118   hex
    1219   : olpc-card-inserted?  ( -- flag )
    13       slot 1 =  if  d# 31 gpio-pin@ 0=  else  true  then
     20      base-addr h# d428.0000 =  if  d# 31 gpio-pin@ 0=  else  true  then
    1421   ;
    1522   ' olpc-card-inserted? to card-inserted?
    1623
    17    \ Slot:power_GPIO - 1:35, 2:34, 3:33
     24   \ Base-addr:power_GPIO - 1:35, 2:34, 3:33
    1825   : gpio-power-on  ( -- )
    1926      sdhci-card-power-on
    2027[ifdef] en-emmc-pwr-gpio#
    21       slot 3 =  if  en-emmc-pwr-gpio# gpio-clr  then
     28      base-addr h# d428.1000 =  if  en-emmc-pwr-gpio# gpio-clr  then
    2229[then]
    2330[ifdef] en-wlan-pwr-gpio#
    24       slot 2 =  if  en-wlan-pwr-gpio# gpio-set  then
     31      base-addr h# d428.0800 =  if  en-wlan-pwr-gpio# gpio-set  then
    2532[then]
    2633   ;
     
    2936   : gpio-power-off  ( -- )
    3037[ifdef] en-emmc-pwr-gpio#
    31       slot 3 =  if  en-emmc-pwr-gpio# gpio-set  then
     38      base-addr h# d428.1000 =  if  en-emmc-pwr-gpio# gpio-set  then
    3239[then]
    3340[ifdef] en-wlan-pwr-gpio#
    34       slot 2 =  if  en-wlan-pwr-gpio# gpio-clr  then
     41      base-addr h# d428.0800 =  if  en-wlan-pwr-gpio# gpio-clr  then
    3542[then]
    3643      sdhci-card-power-off
     
    3845   ' gpio-power-off to card-power-off
    3946
    40    new-device
    41       2 encode-int " reg" property
    42       fload ${BP}/dev/mmc/sdhci/mv8686/loadpkg.fth
     47   new-device  \ MMC2 - WLAN
     48      h# d428.0800 h# 800 reg
     49      8 encode-int " bus-width" property
     50      " sdhci-pxav3" +compatible
     51      " mrvl,pxav3-mmc" +compatible
     52      d# 31 encode-int " clk-delay-cycles" property
     53      0 0  " non-removable" property
     54      d# 52 " interrupts" integer-property
     55
     56      " /pmua" encode-phandle 4 encode-int encode+ " clocks" property
     57      " PXA-SDHCLK" " clock-names" string-property
     58      d# 50 encode-int  d# 500 encode-int encode+  " power-delay-ms" property
     59      0 0 " broken-cd" property
     60[ifdef] en-wlan-pwr-gpio#
     61      \ Active high
     62      " /gpio" encode-phandle  en-wlan-pwr-gpio# encode-int encode+  0 encode-int encode+  " power-gpios" property
     63[then]
     64
     65      fload ${BP}/dev/mmc/sdhci/slot.fth
     66      new-device
     67         fload ${BP}/dev/mmc/sdhci/mv8686/loadpkg.fth
     68      finish-device
    4369   finish-device
    4470
    45    new-device
    46       3 encode-int " reg" property
    47       fload ${BP}/dev/mmc/sdhci/sdmmc.fth
    48       fload ${BP}/dev/mmc/sdhci/selftest.fth
    49       " internal" " slot-name" string-property
     71   new-device  \ MMC3 - Internal eMMC
     72      h# d428.1000 h# 800 reg
     73      0 0  " non-removable" property
     74      8 encode-int " bus-width" property
     75      " sdhci-pxav3" +compatible
     76      " mrvl,pxav3-mmc" +compatible
     77      d# 31 encode-int " clk-delay-cycles" property
     78      d# 53 " interrupts" integer-property
     79
     80      " /pmua" encode-phandle d# 14 encode-int encode+ " clocks" property
     81      " PXA-SDHCLK" " clock-names" string-property
     82      d# 40 encode-int  1 encode-int encode+  " power-delay-ms" property
     83      0 0 " broken-cd" property
     84[ifdef] en-emmc-pwr-gpio#
     85      \ Active low
     86      " /gpio" encode-phandle  en-emmc-pwr-gpio# encode-int encode+  1 encode-int encode+  " power-gpios"  property
     87[then]
     88
     89      fload ${BP}/dev/mmc/sdhci/slot.fth
     90      new-device
     91         fload ${BP}/dev/mmc/sdhci/sdmmc.fth
     92         fload ${BP}/dev/mmc/sdhci/selftest.fth
     93         " internal" " slot-name" string-property
     94      finish-device
    5095   finish-device
    5196
    5297end-package
     98
     99\ mmc0 is the internal storage device, which may depend on BOOT_DEV_SEL, so its
     100\ devalias is set in platform-dependent code
     101
     102\ The WLAN device is always mmc1
     103devalias mmc1 /sd/sdhci@d4280800
    53104
    54105stand-init: SDHC clocks
  • cpu/arm/olpc/sdregs.fth

    r3108 r3164  
    221 value #slots
    33
    4 0 instance value slot
     40 instance value base-addr
    550 instance value chip
    66
    7 my-space /regs  reg
    8 
     7: set-slot-address  ( slot-address -- )  to base-addr  ;
    98: map-regs  ( -- )
    109   chip  if  exit  then
    11    slot 5 =  if
    12       h# d421.7000
    13    else
    14       slot 1-  h# 800 *  my-space +
    15    then
    16    /regs " map-in" $call-parent
     10   base-addr /regs " map-in" $call-parent
    1711   to chip
    1812;
  • dev/mmc/sdhci/pciregs.fth

    r1828 r3164  
    2828: my-w!  ( w offset -- )  my-space + " config-w!" $call-parent  ;
    2929
     30: set-slot-address  ( slot-address -- )  to slot  ;
    3031: map-regs  ( -- )
    3132   chip  if  exit  then
  • dev/mmc/sdhci/sdhci.fth

    r3163 r3164  
    2727
    2828external
    29 : set-address  ( rca slot -- )  to slot  to rca  map-regs  ;
     29: set-address  ( rca base-addr -- )  set-slot-address  to rca  map-regs  ;
    3030: get-address  ( -- rca )       rca  ;
    3131: decode-unit  ( addr len -- lun )  push-hex  $number  if  0  then  pop-base  ;
     
    895895   intstat-on
    896896   card-power-off
    897    slot 1 = if power-off-time else d# 20 then
     897   power-off-time
    898898   ms
    899899   card-power-on  d# 40 ms  \ This delay is just a guess (20 was barely too slow for a Via board)
Note: See TracChangeset for help on using the changeset viewer.