mmc: meson: add MMC driver for Meson GX (S905)
Subsystems (7)
v7 cover mmc: meson: add MMC driver for Meson GX (S905)
This patch series is a resubmission of the v6 patch series
https://lists.denx.de/pipermail/u-boot/2017-February/281941.html
by Heiner Kallweit.
Patch 1 updates the device tree to a recent Linux version. Patch 2 add a MMC driver for the GXBB SOC
Both patches are unchanged relative to version 6 of the patch series. Patch 3 enables the MMC driver in the Odroid C2 default configuration. This patch had to be rearranged to become applicable again. Patch 4 enables MMC as a boot target for the Odroid C2. This patch is new.
I have tested the patch series against U-Boot v2017.3 and U-Boot master.
Heiner Kallweit (2):
mmc: meson: add MMC driver for Meson GX (S905)
arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux version
Heinrich Schuchardt (2):
Enable new Meson GX MMC driver in Odroid C2 defconfig.
odroid-c2: enable MMC as boot target
arch/arm/dts/meson-gxbb-odroidc2.dts | 147 ++++++- arch/arm/dts/meson-gxbb.dtsi | 718 ++++++++++++++++++++++------------- configs/odroid-c2_defconfig | 5 +- drivers/mmc/Kconfig | 6 + drivers/mmc/Makefile | 1 + include/configs/meson-gxbb-common.h | 2 + 6 files changed, 603 insertions(+), 276 deletions(-)
Signature · 1 line
2.1.4
PATCH v7 1/4 arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux version
As a prerequisite for adding a Meson GX MMC driver update the Meson GXBB / Odroid-C2 device tree in Uboot with the latest version from Linux.
---
v7:
- no changes
v6:
- changed prefix in subject
v5:
- no changes
v4:
- Added SoB of original authors
--- arch/arm/dts/meson-gx.dtsi | 447 ++++++++++++++++++++ arch/arm/dts/meson-gxbb-odroidc2.dts | 147 ++++++- arch/arm/dts/meson-gxbb.dtsi | 718 ++++++++++++++++++++------------ include/dt-bindings/clock/gxbb-aoclkc.h | 66 +++ include/dt-bindings/clock/gxbb-clkc.h | 34 ++ include/dt-bindings/reset/gxbb-aoclkc.h | 66 +++ 6 files changed, 1203 insertions(+), 275 deletions(-) create mode 100644 arch/arm/dts/meson-gx.dtsi create mode 100644 include/dt-bindings/clock/gxbb-aoclkc.h create mode 100644 include/dt-bindings/clock/gxbb-clkc.h create mode 100644 include/dt-bindings/reset/gxbb-aoclkc.h
arch/arm/dts/meson-gx.dtsi new file +447 -0
@@ -0,0 +1,447 @@ +/* + * Copyright (c) 2016 Andreas Färber + * + * Copyright (c) 2016 BayLibre, SAS. + * Author: Neil Armstrong <[email protected]> + * + * Copyright (c) 2016 Endless Computers, Inc. + * Author: Carlo Caione <[email protected]> + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> + +/ { + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + /* 16 MiB reserved for Hardware ROM Firmware */ + hwrom_reserved: hwrom at 0 { + reg = <0x0 0x0 0x0 0x1000000>; + no-map; + }; + + /* 2 MiB reserved for ARM Trusted Firmware (BL31) */ + secmon_reserved: secmon at 10000000 { + reg = <0x0 0x10000000 0x0 0x200000>; + no-map; + }; + }; + + cpus { + #address-cells = <0x2>; + #size-cells = <0x0>; + + cpu0: cpu at 0 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0 0x0>; + enable-method = "psci"; + next-level-cache = <&l2>; + clocks = <&scpi_dvfs 0>; + }; + + cpu1: cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0 0x1>; + enable-method = "psci"; + next-level-cache = <&l2>; + clocks = <&scpi_dvfs 0>; + }; + + cpu2: cpu at 2 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0 0x2>; + enable-method = "psci"; + next-level-cache = <&l2>; + clocks = <&scpi_dvfs 0>; + }; + + cpu3: cpu at 3 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0 0x3>; + enable-method = "psci"; + next-level-cache = <&l2>; + clocks = <&scpi_dvfs 0>; + }; + + l2: l2-cache0 { + compatible = "cache"; + }; + }; + + arm-pmu { + compatible = "arm,cortex-a53-pmu"; + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>; + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; + }; + + psci { + compatible = "arm,psci-0.2"; + method = "smc"; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = <GIC_PPI 13 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 14 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 11 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 10 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>; + }; + + xtal: xtal-clk { + compatible = "fixed-clock"; + clock-frequency = <24000000>; + clock-output-names = "xtal"; + #clock-cells = <0>; + }; + + firmware { + sm: secure-monitor { + compatible = "amlogic,meson-gx-sm", "amlogic,meson-gxbb-sm"; + }; + }; + + efuse: efuse { + compatible = "amlogic,meson-gx-efuse", "amlogic,meson-gxbb-efuse"; + #address-cells = <1>; + #size-cells = <1>; + + sn: sn at 14 { + reg = <0x14 0x10>; + }; + + eth_mac: eth_mac at 34 { + reg = <0x34 0x10>; + }; + + bid: bid at 46 { + reg = <0x46 0x30>; + }; + }; + + scpi { + compatible = "amlogic,meson-gxbb-scpi", "arm,scpi-pre-1.0"; + mboxes = <&mailbox 1 &mailbox 2>; + shmem = <&cpu_scp_lpri &cpu_scp_hpri>; + + scpi_clocks: clocks { + compatible = "arm,scpi-clocks"; + + scpi_dvfs: scpi_clocks at 0 { + compatible = "arm,scpi-dvfs-clocks"; + #clock-cells = <1>; + clock-indices = <0>; + clock-output-names = "vcpu"; + }; + }; + + scpi_sensors: sensors { + compatible = "arm,scpi-sensors"; + #thermal-sensor-cells = <1>; + }; + }; + + soc { + compatible = "simple-bus"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + cbus: cbus at c1100000 { + compatible = "simple-bus"; + reg = <0x0 0xc1100000 0x0 0x100000>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xc1100000 0x0 0x100000>; + + reset: reset-controller at 4404 { + compatible = "amlogic,meson-gx-reset", "amlogic,meson-gxbb-reset"; + reg = <0x0 0x04404 0x0 0x20>; + #reset-cells = <1>; + }; + + uart_A: serial at 84c0 { + compatible = "amlogic,meson-uart"; + reg = <0x0 0x84c0 0x0 0x14>; + interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>; + clocks = <&xtal>; + status = "disabled"; + }; + + uart_B: serial at 84dc { + compatible = "amlogic,meson-uart"; + reg = <0x0 0x84dc 0x0 0x14>; + interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_RISING>; + clocks = <&xtal>; + status = "disabled"; + }; + + i2c_A: i2c at 8500 { + compatible = "amlogic,meson-gxbb-i2c"; + reg = <0x0 0x08500 0x0 0x20>; + interrupts = <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + pwm_ab: pwm at 8550 { + compatible = "amlogic,meson-gx-pwm", "amlogic,meson-gxbb-pwm"; + reg = <0x0 0x08550 0x0 0x10>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm_cd: pwm at 8650 { + compatible = "amlogic,meson-gx-pwm", "amlogic,meson-gxbb-pwm"; + reg = <0x0 0x08650 0x0 0x10>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm_ef: pwm at 86c0 { + compatible = "amlogic,meson-gx-pwm", "amlogic,meson-gxbb-pwm"; + reg = <0x0 0x086c0 0x0 0x10>; + #pwm-cells = <3>; + status = "disabled"; + }; + + uart_C: serial at 8700 { + compatible = "amlogic,meson-uart"; + reg = <0x0 0x8700 0x0 0x14>; + interrupts = <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>; + clocks = <&xtal>; + status = "disabled"; + }; + + i2c_B: i2c at 87c0 { + compatible = "amlogic,meson-gxbb-i2c"; + reg = <0x0 0x087c0 0x0 0x20>; + interrupts = <GIC_SPI 214 IRQ_TYPE_EDGE_RISING>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c_C: i2c at 87e0 { + compatible = "amlogic,meson-gxbb-i2c"; + reg = <0x0 0x087e0 0x0 0x20>; + interrupts = <GIC_SPI 215 IRQ_TYPE_EDGE_RISING>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + watchdog at 98d0 { + compatible = "amlogic,meson-gx-wdt", "amlogic,meson-gxbb-wdt"; + reg = <0x0 0x098d0 0x0 0x10>; + clocks = <&xtal>; + }; + }; + + gic: interrupt-controller at c4301000 { + compatible = "arm,gic-400"; + reg = <0x0 0xc4301000 0 0x1000>, + <0x0 0xc4302000 0 0x2000>, + <0x0 0xc4304000 0 0x2000>, + <0x0 0xc4306000 0 0x2000>; + interrupt-controller; + interrupts = <GIC_PPI 9 + (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>; + #interrupt-cells = <3>; + #address-cells = <0>; + }; + + sram: sram at c8000000 { + compatible = "amlogic,meson-gxbb-sram", "mmio-sram"; + reg = <0x0 0xc8000000 0x0 0x14000>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x0 0xc8000000 0x14000>; + + cpu_scp_lpri: scp-shmem at 0 { + compatible = "amlogic,meson-gxbb-scp-shmem"; + reg = <0x13000 0x400>; + }; + + cpu_scp_hpri: scp-shmem at 200 { + compatible = "amlogic,meson-gxbb-scp-shmem"; + reg = <0x13400 0x400>; + }; + }; + + aobus: aobus at c8100000 { + compatible = "simple-bus"; + reg = <0x0 0xc8100000 0x0 0x100000>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xc8100000 0x0 0x100000>; + + uart_AO: serial at 4c0 { + compatible = "amlogic,meson-uart"; + reg = <0x0 0x004c0 0x0 0x14>; + interrupts = <GIC_SPI 193 IRQ_TYPE_EDGE_RISING>; + clocks = <&xtal>; + status = "disabled"; + }; + + uart_AO_B: serial at 4e0 { + compatible = "amlogic,meson-uart"; + reg = <0x0 0x004e0 0x0 0x14>; + interrupts = <GIC_SPI 197 IRQ_TYPE_EDGE_RISING>; + clocks = <&xtal>; + status = "disabled"; + }; + + ir: ir at 580 { + compatible = "amlogic,meson-gxbb-ir"; + reg = <0x0 0x00580 0x0 0x40>; + interrupts = <GIC_SPI 196 IRQ_TYPE_EDGE_RISING>; + status = "disabled"; + }; + }; + + periphs: periphs at c8834000 { + compatible = "simple-bus"; + reg = <0x0 0xc8834000 0x0 0x2000>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xc8834000 0x0 0x2000>; + + rng { + compatible = "amlogic,meson-rng"; + reg = <0x0 0x0 0x0 0x4>; + }; + }; + + + hiubus: hiubus at c883c000 { + compatible = "simple-bus"; + reg = <0x0 0xc883c000 0x0 0x2000>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xc883c000 0x0 0x2000>; + + mailbox: mailbox at 404 { + compatible = "amlogic,meson-gx-mhu", "amlogic,meson-gxbb-mhu"; + reg = <0 0x404 0 0x4c>; + interrupts = <0 208 IRQ_TYPE_EDGE_RISING>, + <0 209 IRQ_TYPE_EDGE_RISING>, + <0 210 IRQ_TYPE_EDGE_RISING>; + #mbox-cells = <1>; + }; + }; + + ethmac: ethernet at c9410000 { + compatible = "amlogic,meson-gx-dwmac", "amlogic,meson-gxbb-dwmac", "snps,dwmac"; + reg = <0x0 0xc9410000 0x0 0x10000 + 0x0 0xc8834540 0x0 0x4>; + interrupts = <0 8 1>; + interrupt-names = "macirq"; + phy-mode = "rgmii"; + status = "disabled"; + }; + + apb: apb at d0000000 { + compatible = "simple-bus"; + reg = <0x0 0xd0000000 0x0 0x200000>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xd0000000 0x0 0x200000>; + + sd_emmc_a: mmc at 70000 { + compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc"; + reg = <0x0 0x70000 0x0 0x2000>; + interrupts = <GIC_SPI 216 IRQ_TYPE_EDGE_RISING>; + status = "disabled"; + }; + + sd_emmc_b: mmc at 72000 { + compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc"; + reg = <0x0 0x72000 0x0 0x2000>; + interrupts = <GIC_SPI 217 IRQ_TYPE_EDGE_RISING>; + status = "disabled"; + }; + + sd_emmc_c: mmc at 74000 { + compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc"; + reg = <0x0 0x74000 0x0 0x2000>; + interrupts = <GIC_SPI 218 IRQ_TYPE_EDGE_RISING>; + status = "disabled"; + }; + }; + + vpu: vpu at d0100000 { + compatible = "amlogic,meson-gx-vpu"; + reg = <0x0 0xd0100000 0x0 0x100000>, + <0x0 0xc883c000 0x0 0x1000>, + <0x0 0xc8838000 0x0 0x1000>; + reg-names = "vpu", "hhi", "dmc"; + interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>; + #address-cells = <1>; + #size-cells = <0>; + + /* CVBS VDAC output port */ + cvbs_vdac_port: port at 0 { + reg = <0>; + }; + }; + }; +};
arch/arm/dts/meson-gxbb-odroidc2.dts +146 -1
164 lines not on this page · raw message
arch/arm/dts/meson-gxbb.dtsi +444 -274
751 lines not on this page · raw message
include/dt-bindings/clock/gxbb-aoclkc.h new file +66 -0
66 lines not on this page · raw message
include/dt-bindings/clock/gxbb-clkc.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* GXBB clock tree IDs +*/ + +#ifndef __GXBB_CLKC_H +#define __GXBB_CLKC_H + +#define CLKID_CPUCLK 1 +#define CLKID_HDMI_PLL 2 +#define CLKID_FCLK_DIV2 4 +#define CLKID_FCLK_DIV3 5 +#define CLKID_FCLK_DIV4 6 +#define CLKID_CLK81 12 +#define CLKID_MPLL2 15 +#define CLKID_SPI 34 +#define CLKID_I2C 22 +#define CLKID_SAR_ADC 23 +#define CLKID_ETH 36 +#define CLKID_USB0 50 +#define CLKID_USB1 51 +#define CLKID_USB 55 +#define CLKID_HDMI_PCLK 63 +#define CLKID_USB1_DDR_BRIDGE 64 +#define CLKID_USB0_DDR_BRIDGE 65 +#define CLKID_SANA 69 +#define CLKID_GCLK_VENCI_INT0 77 +#define CLKID_AO_I2C 93 +#define CLKID_SD_EMMC_A 94 +#define CLKID_SD_EMMC_B 95 +#define CLKID_SD_EMMC_C 96 +#define CLKID_SAR_ADC_CLK 97 +#define CLKID_SAR_ADC_SEL 98 + +#endif /* __GXBB_CLKC_H */
include/dt-bindings/reset/gxbb-aoclkc.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v7 1/4 arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux version
Quoted 2 lines · Heinrich Schuchardt
As a prerequisite for adding a Meson GX MMC driver update the Meson GXBB / Odroid-C2 device tree in Uboot with the latest
U-Boot
Quoted 1 line
version from Linux.
It's a good idea to indicate which version (or commit) of Linux
Quoted 16 lines
Signed-off-by Neil Armstrong <[email protected]>Signed-off-by Carlo Caione <[email protected]>Signed-off-by Andreas Färber <[email protected]>Signed-off-by Heiner Kallweit <[email protected]>Tested-by Heinrich Schuchardt <[email protected]>Signed-off-by Heinrich Schuchardt <[email protected]>---
v7:
- no changes
v6:
- changed prefix in subject
v5:
- no changes
v4:
- Added SoB of original authors
Quoted 12 lines
--- arch/arm/dts/meson-gx.dtsi | 447 ++++++++++++++++++++ arch/arm/dts/meson-gxbb-odroidc2.dts | 147 ++++++- arch/arm/dts/meson-gxbb.dtsi | 718 ++++++++++++++++++++------------ include/dt-bindings/clock/gxbb-aoclkc.h | 66 +++ include/dt-bindings/clock/gxbb-clkc.h | 34 ++ include/dt-bindings/reset/gxbb-aoclkc.h | 66 +++ 6 files changed, 1203 insertions(+), 275 deletions(-) create mode 100644 arch/arm/dts/meson-gx.dtsi create mode 100644 include/dt-bindings/clock/gxbb-aoclkc.h create mode 100644 include/dt-bindings/clock/gxbb-clkc.h create mode 100644 include/dt-bindings/reset/gxbb-aoclkc.h
PATCH v7 1/4 arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux version
Am 16.04.2017 um 21:33 schrieb Simon Glass:
Quoted 9 lines · Heinrich Schuchardt
Quoted 2 lines
As a prerequisite for adding a Meson GX MMC driver update the Meson GXBB / Odroid-C2 device tree in Uboot with the latest
U-Boot
Quoted 1 line
version from Linux.
It's a good idea to indicate which version (or commit) of Linux
... which I believe I had already pointed out in an earlier version. :(
But another version is merged already.
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg)
PATCH v7 1/4 arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux version
Quoted 7 lines · Andreas Färber
Am 16.04.2017 um 21:33 schrieb Simon Glass:
Quoted 6 lines · Heinrich Schuchardt
Quoted 2 lines
As a prerequisite for adding a Meson GX MMC driver update the Meson GXBB / Odroid-C2 device tree in Uboot with the latest
U-Boot
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
version from Linux.
It's a good idea to indicate which version (or commit) of Linux
... which I believe I had already pointed out in an earlier version. :(
But another version is merged already.
apologized for it. :(
Quoted 4 lines
Regards,
Andreas
PATCH v7 2/4 mmc: meson: add MMC driver for Meson GX (S905)
In reply to Heinrich SchuchardtFrom: Carlo Caione <[email protected]>
This driver implements MMC support on Meson GX (S905) based systems. It's based on Carlo Caione's work, changes:
- BLK support added
- general refactoring
---
v7:
no change
v6:
- remove DM_MMC_OPS from Kconfig dependencies
- address two minor review comments of Jaehoon
--- arch/arm/include/asm/arch-meson/sd_emmc.h | 89 +++++++++ drivers/mmc/Kconfig | 6 + drivers/mmc/Makefile | 1 + drivers/mmc/meson_gx_mmc.c | 291 ++++++++++++++++++++++++++++++ 4 files changed, 387 insertions(+) create mode 100644 arch/arm/include/asm/arch-meson/sd_emmc.h create mode 100644 drivers/mmc/meson_gx_mmc.c
arch/arm/include/asm/arch-meson/sd_emmc.h new file +89 -0
@@ -0,0 +1,89 @@ +/* +* (C) Copyright 2016 Carlo Caione <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __SD_EMMC_H__ +#define __SD_EMMC_H__ + +#include <mmc.h> + +#define SDIO_PORT_A 0 +#define SDIO_PORT_B 1 +#define SDIO_PORT_C 2 + +#define SD_EMMC_CLKSRC_24M 24000000/* 24 MHz */ +#define SD_EMMC_CLKSRC_DIV2 1000000000/* 1 GHz */ + +#define MESON_SD_EMMC_CLOCK 0x00 +#define CLK_MAX_DIV 63 +#define CLK_SRC_24M (0 << 6) +#define CLK_SRC_DIV2 (1 << 6) +#define CLK_CO_PHASE_000 (0 << 8) +#define CLK_CO_PHASE_090 (1 << 8) +#define CLK_CO_PHASE_180 (2 << 8) +#define CLK_CO_PHASE_270 (3 << 8) +#define CLK_TX_PHASE_000 (0 << 10) +#define CLK_TX_PHASE_090 (1 << 10) +#define CLK_TX_PHASE_180 (2 << 10) +#define CLK_TX_PHASE_270 (3 << 10) +#define CLK_ALWAYS_ON BIT(24) + +#define MESON_SD_EMMC_CFG 0x44 +#define CFG_BUS_WIDTH_MASK GENMASK(1, 0) +#define CFG_BUS_WIDTH_1 0 +#define CFG_BUS_WIDTH_4 1 +#define CFG_BUS_WIDTH_8 2 +#define CFG_BL_LEN_MASK GENMASK(7, 4) +#define CFG_BL_LEN_SHIFT 4 +#define CFG_BL_LEN_512 (9 << 4) +#define CFG_RESP_TIMEOUT_MASK GENMASK(11, 8) +#define CFG_RESP_TIMEOUT_256 (8 << 8) +#define CFG_RC_CC_MASK GENMASK(15, 12) +#define CFG_RC_CC_16 (4 << 12) +#define CFG_SDCLK_ALWAYS_ON BIT(18) +#define CFG_AUTO_CLK BIT(23) + +#define MESON_SD_EMMC_STATUS 0x48 +#define STATUS_MASK GENMASK(15, 0) +#define STATUS_ERR_MASK GENMASK(12, 0) +#define STATUS_RXD_ERR_MASK GENMASK(7, 0) +#define STATUS_TXD_ERR BIT(8) +#define STATUS_DESC_ERR BIT(9) +#define STATUS_RESP_ERR BIT(10) +#define STATUS_RESP_TIMEOUT BIT(11) +#define STATUS_DESC_TIMEOUT BIT(12) +#define STATUS_END_OF_CHAIN BIT(13) + +#define MESON_SD_EMMC_IRQ_EN 0x4c + +#define MESON_SD_EMMC_CMD_CFG 0x50 +#define CMD_CFG_LENGTH_MASK GENMASK(8, 0) +#define CMD_CFG_BLOCK_MODE BIT(9) +#define CMD_CFG_R1B BIT(10) +#define CMD_CFG_END_OF_CHAIN BIT(11) +#define CMD_CFG_TIMEOUT_4S (12 << 12) +#define CMD_CFG_NO_RESP BIT(16) +#define CMD_CFG_DATA_IO BIT(18) +#define CMD_CFG_DATA_WR BIT(19) +#define CMD_CFG_RESP_NOCRC BIT(20) +#define CMD_CFG_RESP_128 BIT(21) +#define CMD_CFG_CMD_INDEX_SHIFT 24 +#define CMD_CFG_OWNER BIT(31) + +#define MESON_SD_EMMC_CMD_ARG 0x54 +#define MESON_SD_EMMC_CMD_DAT 0x58 +#define MESON_SD_EMMC_CMD_RSP 0x5c +#define MESON_SD_EMMC_CMD_RSP1 0x60 +#define MESON_SD_EMMC_CMD_RSP2 0x64 +#define MESON_SD_EMMC_CMD_RSP3 0x68 + +struct meson_mmc_platdata { +struct mmc_config cfg; +struct mmc mmc; +void *regbase; +void *w_buf; +}; + +#endif
drivers/mmc/Kconfig +6 -0
@@ -105,6 +105,12 @@ config MMC_DW_SOCFPGA Synopsys DesignWare Memory Card Interface driver. Select this option for platforms based on Altera SOCFPGA. +config MMC_MESON_GX + bool "Meson GX EMMC controller support" + depends on DM_MMC && BLK && ARCH_MESON + help + Support for EMMC host controller on Meson GX ARM SoCs platform (S905) + config MMC_MXC bool "Freescale i.MX21/27/31 or MPC512x Multimedia Card support" help
drivers/mmc/Makefile +1 -0
@@ -29,6 +29,7 @@ ifdef CONFIG_SUPPORT_EMMC_BOOT obj-$(CONFIG_GENERIC_MMC) += mmc_boot.o endif obj-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o +obj-$(CONFIG_MMC_MESON_GX) += meson_gx_mmc.o obj-$(CONFIG_MMC_SPI) += mmc_spi.o obj-$(CONFIG_MVEBU_MMC) += mvebu_mmc.o obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.o
drivers/mmc/meson_gx_mmc.c new file +291 -0
291 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v7 3/4 Enable new Meson GX MMC driver in Odroid C2 defconfig.
In reply to Heinrich SchuchardtThis patch is based on
[U-Boot,v6,3/3] odroid-c2: enable new Meson GX MMC driver in board defconfig by Heiner Kallweit <[email protected]>
---
v7:
- made applicable to current U-boot master
v6:
- no changes
--- configs/odroid-c2_defconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
configs/odroid-c2_defconfig +4 -1
@@ -14,7 +14,10 @@ CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2" # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y CONFIG_NET_RANDOM_ETHADDR=y -# CONFIG_MMC is not set +CONFIG_MMC=y +CONFIG_DM_MMC=y +CONFIG_MMC_MESON_GX=y +CONFIG_CMD_MMC=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y CONFIG_PINCTRL=y
Signature · 1 line
2.1.4
PATCH v7 3/4 Enable new Meson GX MMC driver in Odroid C2 defconfig.
Quoted 6 lines · Heinrich Schuchardt
This patch is based on
[U-Boot,v6,3/3] odroid-c2: enable new Meson GX MMC driver in board defconfig by Heiner Kallweit <[email protected]>CC Heiner Kallweit <[email protected]>Signed-off-by Heinrich Schuchardt <[email protected]>
Quoted 8 lines
---
v7:
- made applicable to current U-boot master
v6:
- no changes--- configs/odroid-c2_defconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
configs/odroid-c2_defconfig CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2" · line 18
Quoted 12 lines
configs/odroid-c2_defconfig +2
-1@@ -14,7 +14,10 @@ CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2" # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y CONFIG_NET_RANDOM_ETHADDR=y -# CONFIG_MMC is not set +CONFIG_MMC=y +CONFIG_DM_MMC=y
This should be the default anyway now.
Quoted 8 lines
configs/odroid-c2_defconfig +2
-1+CONFIG_MMC_MESON_GX=y +CONFIG_CMD_MMC=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y CONFIG_PINCTRL=y --2.1.4
PATCH v7 4/4 odroid-c2: enable MMC as boot target
In reply to Heinrich SchuchardtTo enable booting from MMC the MMC devices 0 and 1 are added to the BOOT_TARGET_DEVICES.
---
v7:
- added this patch to patch series
--- include/configs/meson-gxbb-common.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/meson-gxbb-common.h +2 -0
@@ -39,6 +39,8 @@#include <config_distro_defaults.h> #define BOOT_TARGET_DEVICES (func) \ + func(MMC, mmc, 0) \ + func(MMC, mmc, 1) \ func(DHCP, dhcp, na)#include <config_distro_bootcmd.h>
Signature · 1 line
2.1.4
v7 cover mmc: meson: add MMC driver for Meson GX (S905)
In reply to Heinrich SchuchardtHi Heinrich,
Quoted 12 lines · Heinrich Schuchardt
This patch series is a resubmission of the v6 patch series
https://lists.denx.de/pipermail/u-boot/2017-February/281941.html
by Heiner Kallweit.Patch 1 updates the device tree to a recent Linux version. Patch 2 add a MMC driver for the GXBB SOC
Both patches are unchanged relative to version 6 of the patch series. Patch 3 enables the MMC driver in the Odroid C2 default configuration. This patch had to be rearranged to become applicable again. Patch 4 enables MMC as a boot target for the Odroid C2. This patch is new.
Quoted 1 line
I have tested the patch series against U-Boot v2017.3 and U-Boot master.
Confusing..what patches are correct..
2017-04-12 20:32 Heiner Kallweit * odroid-c2: enable new Meson GX MMC driver in board defconfig 2017-04-12 20:30 Carlo Caione * mmc: meson: add MMC driver for Meson GX (S905) 2017-04-12 20:28 Heiner Kallweit * arm: dts: update Meson GXBB / Odroid-C2 DT with recent Linux version
I have already applied to u-boot-mmc for [PATCH v7 1/3]~[PATCH v7 3/3]. And why this patchset is v7? And i did PR to Tom..
Let me know what is correct..otherwise you will send the patch without applying patches.
Best Regards,
Jaehoon Chung
Quoted 19 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Heiner Kallweit (2):
mmc: meson: add MMC driver for Meson GX (S905)
arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux versionHeinrich Schuchardt (2):
Enable new Meson GX MMC driver in Odroid C2 defconfig.
odroid-c2: enable MMC as boot targetarch/arm/dts/meson-gxbb-odroidc2.dts | 147 ++++++- arch/arm/dts/meson-gxbb.dtsi | 718 ++++++++++++++++++++++------------- configs/odroid-c2_defconfig | 5 +- drivers/mmc/Kconfig | 6 + drivers/mmc/Makefile | 1 + include/configs/meson-gxbb-common.h | 2 + 6 files changed, 603 insertions(+), 276 deletions(-)
v7 cover mmc: meson: add MMC driver for Meson GX (S905)
Quoted 23 lines · Jaehoon Chung
Hi Heinrich,
Quoted 12 lines · Heinrich Schuchardt
This patch series is a resubmission of the v6 patch series
https://lists.denx.de/pipermail/u-boot/2017-February/281941.html
by Heiner Kallweit.Patch 1 updates the device tree to a recent Linux version. Patch 2 add a MMC driver for the GXBB SOC
Both patches are unchanged relative to version 6 of the patch series. Patch 3 enables the MMC driver in the Odroid C2 default configuration. This patch had to be rearranged to become applicable again. Patch 4 enables MMC as a boot target for the Odroid C2. This patch is new.Quoted 1 line
I have tested the patch series against U-Boot v2017.3 and U-Boot master.
Confusing..what patches are correct..
2017-04-12 20:32 Heiner Kallweit * odroid-c2: enable new Meson GX MMC driver in board defconfig 2017-04-12 20:30 Carlo Caione * mmc: meson: add MMC driver for Meson GX (S905) 2017-04-12 20:28 Heiner Kallweit * arm: dts: update Meson GXBB / Odroid-C2 DT with recent Linux version
Quoted 7 lines
I have already applied to u-boot-mmc for [PATCH v7 1/3]~[PATCH v7 3/3]. And why this patchset is v7? And i did PR to Tom..
Let me know what is correct..otherwise you will send the patch without applying patches.
Best Regards,
Jaehoon Chung
Hello Jaehoon,
sorry for creating confusion.
I missed the v7 series by Heiner.
I will resend patch 4/4 as a single patch.
Best regards
Heinrich
Quoted 22 lines
Quoted 20 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Heiner Kallweit (2):
mmc: meson: add MMC driver for Meson GX (S905)
arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux versionHeinrich Schuchardt (2):
Enable new Meson GX MMC driver in Odroid C2 defconfig.
odroid-c2: enable MMC as boot targetarch/arm/dts/meson-gxbb-odroidc2.dts | 147 ++++++- arch/arm/dts/meson-gxbb.dtsi | 718 ++++++++++++++++++++++------------- configs/odroid-c2_defconfig | 5 +- drivers/mmc/Kconfig | 6 + drivers/mmc/Makefile | 1 + include/configs/meson-gxbb-common.h | 2 + 6 files changed, 603 insertions(+), 276 deletions(-)
v7 cover mmc: meson: add MMC driver for Meson GX (S905)
In reply to Heinrich SchuchardtAm 14.04.2017 um 12:26 schrieb Heinrich Schuchardt:
Quoted 4 lines
This patch series is a resubmission of the v6 patch series
https://lists.denx.de/pipermail/u-boot/2017-February/281941.html
by Heiner Kallweit.
A updated version of this series was just applied:
http://git.denx.de/?p=u-boot/u-boot-mmc.git;a=summary
So there's no need at least for patches 1 - 3.
Rgds, Heiner
Quoted 28 lines
Patch 1 updates the device tree to a recent Linux version. Patch 2 add a MMC driver for the GXBB SOC
Both patches are unchanged relative to version 6 of the patch series. Patch 3 enables the MMC driver in the Odroid C2 default configuration. This patch had to be rearranged to become applicable again. Patch 4 enables MMC as a boot target for the Odroid C2. This patch is new.I have tested the patch series against U-Boot v2017.3 and U-Boot master.
Signed-off-by Heinrich Schuchardt <[email protected]>Heiner Kallweit (2):
mmc: meson: add MMC driver for Meson GX (S905)
arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux versionHeinrich Schuchardt (2):
Enable new Meson GX MMC driver in Odroid C2 defconfig.
odroid-c2: enable MMC as boot targetarch/arm/dts/meson-gxbb-odroidc2.dts | 147 ++++++- arch/arm/dts/meson-gxbb.dtsi | 718 ++++++++++++++++++++++------------- configs/odroid-c2_defconfig | 5 +- drivers/mmc/Kconfig | 6 + drivers/mmc/Makefile | 1 + include/configs/meson-gxbb-common.h | 2 + 6 files changed, 603 insertions(+), 276 deletions(-)
v7 cover mmc: meson: add MMC driver for Meson GX (S905)
Hi Heiner,
Quoted 8 lines · Heiner Kallweit
Am 14.04.2017 um 12:26 schrieb Heinrich Schuchardt:
Quoted 4 lines
This patch series is a resubmission of the v6 patch series
https://lists.denx.de/pipermail/u-boot/2017-February/281941.html
by Heiner Kallweit.A updated version of this series was just applied:
http://git.denx.de/?p=u-boot/u-boot-mmc.git;a=summary
So there's no need at least for patches 1 - 3.
Thanks for clarity.
Quoted 35 lines
Rgds, Heiner
Quoted 28 lines
Patch 1 updates the device tree to a recent Linux version. Patch 2 add a MMC driver for the GXBB SOC
Both patches are unchanged relative to version 6 of the patch series. Patch 3 enables the MMC driver in the Odroid C2 default configuration. This patch had to be rearranged to become applicable again. Patch 4 enables MMC as a boot target for the Odroid C2. This patch is new.I have tested the patch series against U-Boot v2017.3 and U-Boot master.
Signed-off-by Heinrich Schuchardt <[email protected]>Heiner Kallweit (2):
mmc: meson: add MMC driver for Meson GX (S905)
arm: dts: update Meson GXBB / Odroid-C2 DT with latest Linux versionHeinrich Schuchardt (2):
Enable new Meson GX MMC driver in Odroid C2 defconfig.
odroid-c2: enable MMC as boot targetarch/arm/dts/meson-gxbb-odroidc2.dts | 147 ++++++- arch/arm/dts/meson-gxbb.dtsi | 718 ++++++++++++++++++++++------------- configs/odroid-c2_defconfig | 5 +- drivers/mmc/Kconfig | 6 + drivers/mmc/Makefile | 1 + include/configs/meson-gxbb-common.h | 2 + 6 files changed, 603 insertions(+), 276 deletions(-)