Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revisionBoth sides next revision
toh:tp-link:tl-mr3420:deep.mmc.hack [2018/07/01 14:58] – added some info deoptimtoh:tp-link:tl-mr3420:deep.mmc.hack [2018/07/02 07:56] – minor addings/changes deoptim
Line 521: Line 521:
  
 </code></hidden> </code></hidden>
-\\ 
 \\ \\
 == Switching GPIO0 to CS1 on AR71XX SoC: == == Switching GPIO0 to CS1 on AR71XX SoC: ==
Line 530: Line 529:
 </code> </code>
 </hidden> </hidden>
 +\\
 == Switching GPIO0 to CS1 on AR724X SoC: == == Switching GPIO0 to CS1 on AR724X SoC: ==
 <hidden Instruction for old Openwrt (including LEDE project)> <hidden Instruction for old Openwrt (including LEDE project)>
Line 566: Line 565:
 </hidden> </hidden>
 **Note:** Already used in the example above. **Note:** Already used in the example above.
 +\\
 == Turn off UART and switching GPIO9(Rx) to CS1 on AR933X SoC: == == Turn off UART and switching GPIO9(Rx) to CS1 on AR933X SoC: ==
 <hidden Instruction for old Openwrt (including LEDE project)> <hidden Instruction for old Openwrt (including LEDE project)>
Line 575: Line 575:
 </code> </code>
 </hidden> </hidden>
 +\\
 == Configure GPIO11 to CS1 on AR934X SoC: == == Configure GPIO11 to CS1 on AR934X SoC: ==
 <hidden Instruction for old Openwrt (including LEDE project)> <hidden Instruction for old Openwrt (including LEDE project)>
Line 733: Line 733:
  
 </code></hidden> </code></hidden>
-// We could use GPIO to IRQ event as card detection (implemented in ''mmc_spi'' module) or GPIO to IRQ event as new hotplug SPI-device (implemented in standart SPI bus driver) - but in all this cases, it was found that it not support hotplug detection with **removing** the SD-card or SPI-device via the IRQ trigger.\\+<hidden Patch for Openwrt (4.14+, ath79 platform, dts files)><code diff> 
 +diff --git a/target/linux/ath79/dts/ar7241_tp-link.dtsi b/target/linux/ath79/dts/ar7241_tp-link.dtsi 
 +index 3846d811ac..d99bafcb2b 100644 
 +--- a/target/linux/ath79/dts/ar7241_tp-link.dtsi 
 ++++ b/target/linux/ath79/dts/ar7241_tp-link.dtsi 
 +@@ -22,13 +22,18 @@ 
 +  gpios = <&gpio 11 GPIO_ACTIVE_LOW>; 
 +  debounce-interval = <60>; 
 +  }; 
 +
 +  qss { 
 +  label = "qss"; 
 +  linux,code = <KEY_WPS_BUTTON>; 
 +  gpios = <&gpio 12 GPIO_ACTIVE_LOW>; 
 +  debounce-interval = <60>; 
 +  }; 
 ++ mmc { 
 ++ label = "mmc"; 
 ++ linux,code = <BTN_0>; 
 ++ gpios = <&gpio 18 GPIO_ACTIVE_LOW>; 
 ++ debounce-interval = <60>; 
 ++ }; 
 +  }; 
 +  
 +  gpio_leds: gpio-leds { 
 +@@ -48,7 +53,12 @@ 
 +  
 + &spi { 
 +  status = "okay"; 
 +- num-cs = <1>; 
 ++ num-cs = <2>; 
 ++ /* 
 ++ * Where first parameter <0> is default CS0 pin for flash 
 ++ * and second parameter is GPIO Number for sdcard. 
 ++ */ 
 ++ cs-gpios = <0>, <&gpio 7 GPIO_ACTIVE_HIGH>; 
 +  
 +  flash@0 { 
 +  #address-cells = <1>; 
 +@@ -80,6 +90,30 @@ 
 +  }; 
 +  }; 
 +  }; 
 +
 ++ sdcard@0 { 
 ++ compatible = "mmc-spi-slot"; 
 ++ reg = <1>; 
 ++ /* 
 ++ * If you need to use GPIO18 as Card Detect and 
 ++ * IRQ trigger (as standard implementation) - just 
 ++ * uncomment line below (but don't forget delete 
 ++ * the equivalent gpio-key). We don't use this 
 ++ * property because it doesn't detect removing of 
 ++ * SD Card. 
 ++ */ 
 ++ //gpios = <&gpio 18 GPIO_ACTIVE_LOW>; 
 ++ /* 
 ++ * By default, Card Detect use "active low" state. 
 ++ * Using the "cd-inverted" property means, that the 
 ++ * CD line is active high, i.e. it is high, when a 
 ++ * card is inserted. 
 ++ * (uncomment line below to enable this option) 
 ++ */ 
 ++ //cd-inverted; 
 ++ spi-max-frequency = <25000000>; 
 ++ voltage-ranges = <3200 3400>; 
 ++ }; 
 + }; 
 +  
 + &pcie { 
 + 
 +</code></hidden> 
 +// We could use GPIO to IRQ event as card detection (implemented in ''mmc_spi'' module) or GPIO to IRQ event as new hotplug SPI-device (implemented in standart SPI bus driver) - but in all this cases, it was found that it not support hotplug detection with **removing** the SD-card or SPI-device via the IRQ trigger. IRQ trigger needed if your gpio controller could be in sleep/idle state (and those CD gpio switch could be ignored by the system) - in that cause use standard implementation(not buttons).\\
    Or FIXME   //    Or FIXME   //
  
 The solution was found without the use of IRQ trigger: The solution was found without the use of IRQ trigger:
 **After build and compiling** the firmware, we just added additional button with the name **''mmc''**.\\ **After build and compiling** the firmware, we just added additional button with the name **''mmc''**.\\
-Next, you need to [[docs:guide-user:hardware:hardware.button#using.atheros.00-button.uci|create a configuration]] for the button **''mmc''**:+Next, you need to [[docs:guide-user:hardware:hardware.button#using.atheros.00-button.uci|create a configuration(/etc/hotplug.d/button/00-button)]] for the button **''mmc''**:
 <code bash> <code bash>
 uci add system button uci add system button
-uci set system.@button[-1].button=mmc+uci set system.@button[-1].button=BTN_0
 uci set system.@button[-1].action=pressed uci set system.@button[-1].action=pressed
 uci set system.@button[-1].handler='echo "spi0.1" > /sys/bus/spi/drivers/mmc_spi/unbind' uci set system.@button[-1].handler='echo "spi0.1" > /sys/bus/spi/drivers/mmc_spi/unbind'
 uci add system button uci add system button
-uci set system.@button[-1].button=mmc+uci set system.@button[-1].button=BTN_0
 uci set system.@button[-1].action=released uci set system.@button[-1].action=released
 uci set system.@button[-1].handler='echo "spi0.1" > /sys/bus/spi/drivers/mmc_spi/bind' uci set system.@button[-1].handler='echo "spi0.1" > /sys/bus/spi/drivers/mmc_spi/bind'
  • Last modified: 2021/10/15 09:06
  • by bobafetthotmail