Skip to content

Instantly share code, notes, and snippets.

@jadonk
Last active February 4, 2018 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jadonk/53ae22d550021bf32a299acbd7b546aa to your computer and use it in GitHub Desktop.
Save jadonk/53ae22d550021bf32a299acbd7b546aa to your computer and use it in GitHub Desktop.
sudo apt-get update
sudo apt-get install linux-headers-`uname -r`
cd
mkdir linux
cd linux/
git init
git config core.sparsecheckout true
git remote add origin https://github.com/beagleboard/linux
echo drivers/mmc/host > .git/info/sparse-checkout
git fetch origin/4.9 --depth 1
git checkout 4.9
cd drivers/mmc/host
CONFIG_MMC_SPI=m make -C /lib/modules/`uname -r`/build M=$PWD
sudo make -C /lib/modules/`uname -r`/build M=$PWD INSTALL_MOD_DIR=kernel/drivers/mmc/host modules_install
sudo /opt/scripts/tools/developers/update_initrd.sh
cd /opt/source/bb.org-overlays
echo <<EOF > src/arm/PB-SPI1-MICROSD-CLICK.dts
/*
* Copyright (C) 2018 Texas Instruments, Jason Kridner <jdk@ti.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* https://www.mikroe.com/microsd-click
* https://download.mikroe.com/documents/add-on-boards/click/microsd/microsd-click-schematic.pdf
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@0 {
target = <&ocp>;
__overlay__ {
P1_36_pinmux { status = "disabled"; }; /* CD - gpio3_14*/
P2_25_pinmux { status = "disabled"; }; /* MOSI - gpio1_9 */
P2_27_pinmux { status = "disabled"; }; /* MISO - gpio1_8 */
P2_29_pinmux { status = "disabled"; }; /* CLK - gpio0_7 */
P2_31_pinmux { status = "disabled"; }; /* CS - gpio0_19 */
cape-universal { status = "disabled"; };
cape-universal@1 { status = "disabled"; };
};
};
fragment@1 {
target = <&spi1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
channel@0 {
status = "disabled";
};
channel@1 {
status = "disabled";
};
mikroe_microsd: mikroe_microsd@0{
compatible = "mmc-spi-slot";
pinctrl-names = "default";
pinctrl-0 = <
&P2_31_spi_cs_pin
&P2_29_spi_sclk_pin
&P2_27_spi_pin
&P2_25_spi_pin
&P1_36_gpio_pin
>;
reg = <1>;
gpios = <&gpio3 14 0>;
voltage-ranges = <3300 3300>;
spi-max-frequency = <50000000>;
interrupts = <&gpio3>;
interrupt-parent = <14 IRQ_TYPE_EDGE_BOTH>;
};
};
};
};
make
sudo make install
sudo perl -i -pe 's/^#(.*)<file0>/$1PB-SPI1-MICROSD-CLICK/;' /boot/uEnv.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment