Simon Glass | 18d4a11 | 2024-10-23 15:20:12 +0200 | [diff] [blame] | 1 | /** @file |
| 2 | * |
| 3 | * Copyright (c) 2021, ARM Limited. All rights reserved. |
| 4 | * |
| 5 | * SPDX-License-Identifier: BSD-2-Clause-Patent |
| 6 | * |
| 7 | **/ |
| 8 | |
| 9 | #include <asm/arch/acpi/bcm2836_sdhost.h> |
| 10 | #include <asm/arch/acpi/bcm2836_sdio.h> |
| 11 | #include <asm/arch/acpi/bcm2711.h> |
| 12 | |
| 13 | Device (GDV1) { |
| 14 | Name (_HID, "ACPI0004") |
| 15 | Name (_UID, 0x2) |
| 16 | Name (_CCA, 0x0) |
| 17 | |
| 18 | Name (RBUF, ResourceTemplate () |
| 19 | { |
| 20 | MEMORY32FIXED (ReadWrite, 0, MMCHS2_LENGTH, RMEM) |
| 21 | }) |
| 22 | Method (_CRS, 0x0, Serialized) |
| 23 | { |
| 24 | MEMORY32SETBASE (RBUF, RMEM, RBAS, MMCHS2_OFFSET) |
| 25 | Return (^RBUF) |
| 26 | } |
| 27 | |
| 28 | // Translated DMA region for BCM2711 silicon revisions older than C0 |
| 29 | Name (DMTR, ResourceTemplate() { |
| 30 | QWordMemory (ResourceProducer, |
| 31 | , |
| 32 | MinFixed, |
| 33 | MaxFixed, |
| 34 | NonCacheable, |
| 35 | ReadWrite, |
| 36 | 0x0, |
| 37 | 0x00000000C0000000, // MIN |
| 38 | 0x00000000FFFFFFFF, // MAX |
| 39 | 0xFFFFFFFF40000000, // TRA |
| 40 | 0x0000000040000000, // LEN |
| 41 | , |
| 42 | , |
| 43 | ) |
| 44 | }) |
| 45 | |
| 46 | // Non translated DMA region for BCM2711 revisions C0 and newer |
| 47 | Name (DMNT, ResourceTemplate() { |
| 48 | QWordMemory (ResourceProducer, |
| 49 | , |
| 50 | MinFixed, |
| 51 | MaxFixed, |
| 52 | NonCacheable, |
| 53 | ReadWrite, |
| 54 | 0x0, |
| 55 | 0x0000000000000000, // MIN |
| 56 | 0x000000FFFFFFFFFF, // MAX |
| 57 | 0x0000000000000000, // TRA |
| 58 | 0x0000010000000000, // LEN |
| 59 | , |
| 60 | , |
| 61 | ) |
| 62 | }) |
| 63 | |
| 64 | // emmc2 Host Controller. (brcm,bcm2711-emmc2) |
| 65 | Device (SDC3) |
| 66 | { |
| 67 | Name (_HID, "BRCME88C") |
| 68 | Name (_UID, 0x1) |
| 69 | Name (_CCA, 0x0) |
| 70 | Name (_S1D, 0x1) |
| 71 | Name (_S2D, 0x1) |
| 72 | Name (_S3D, 0x1) |
| 73 | Name (_S4D, 0x1) |
| 74 | Name (SDMA, 0x2) |
| 75 | |
| 76 | Name (RBUF, ResourceTemplate () |
| 77 | { |
| 78 | MEMORY32FIXED (ReadWrite, 0, MMCHS2_LENGTH, RMEM) |
| 79 | Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_MMCHS1_INTERRUPT } |
| 80 | }) |
| 81 | Method (_CRS, 0x0, Serialized) |
| 82 | { |
| 83 | MEMORY32SETBASE (RBUF, RMEM, RBAS, MMCHS2_OFFSET) |
| 84 | Return (^RBUF) |
| 85 | } |
| 86 | |
| 87 | // Unfortunately this controller doesn't honor the |
| 88 | // standard SDHCI voltage control registers |
| 89 | // (or at least Linux's standard code can't |
| 90 | // lower the voltage) So, UHS mode is disabled with caps |
| 91 | Name (DSD1, Package () { |
| 92 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), |
| 93 | Package () { |
| 94 | Package () { "sdhci-caps-mask", 0x0000000500080000 }, |
| 95 | } |
| 96 | }) |
| 97 | // Along with disabling UHS, here both SDMA and ADMA2 |
| 98 | // are also disabled until the linux _DMA() mask/translate |
| 99 | // works properly. |
| 100 | Name (DSD2, Package () { |
| 101 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), |
| 102 | Package () { |
| 103 | Package () { "sdhci-caps-mask", 0x0000000504480000 }, |
| 104 | } |
| 105 | }) |
| 106 | Method (_DSD, 0x0, Serialized) |
| 107 | { |
| 108 | // Select one of the sdhci-caps-mask definitions |
| 109 | // depending on whether we also want to disable DMA |
| 110 | if (SDMA == 0) |
| 111 | { |
| 112 | return (^DSD2) |
| 113 | } |
| 114 | else |
| 115 | { |
| 116 | return (^DSD1) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | // |
| 121 | // A child device that represents the |
| 122 | // sd card, which is marked as non-removable. |
| 123 | // |
| 124 | Device (SDMM) |
| 125 | { |
| 126 | Method (_ADR) |
| 127 | { |
| 128 | Return (0) |
| 129 | } |
| 130 | Method (_RMV) // Is removable |
| 131 | { |
| 132 | Return (0) // 0 - fixed |
| 133 | } |
| 134 | } |
| 135 | } //SDC3 |
| 136 | } //GDV1 |