Skip to content

Commit

Permalink
this isn't right yet, need to find datasheets, and this switch needs …
Browse files Browse the repository at this point in the history
…a lot more cases
  • Loading branch information
Bluefooted Boobie committed Dec 23, 2024
1 parent eef7002 commit 2764615
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions bcm283x/gpio.go
Original file line number Diff line number Diff line change
Expand Up @@ -1338,21 +1338,24 @@ func (d *driverGPIO) Init() (bool, error) {
// Let's play safe here.
dTCompatible := strings.Join(distro.DTCompatible(), " ")
// Reference: https://www.raspberrypi.org/documentation/hardware/raspberrypi/peripheral_addresses.md
if strings.Contains(dTCompatible, "bcm2708") ||
strings.Contains(dTCompatible, "bcm2835") {
switch {
case strings.Contains(dTCompatible, "bcm2708"), strings.Contains(dTCompatible, "bcm2835"):

Check warning on line 1342 in bcm283x/gpio.go

View check run for this annotation

Codecov / codecov/patch

bcm283x/gpio.go#L1341-L1342

Added lines #L1341 - L1342 were not covered by tests
// RPi0/1.
d.baseAddr = 0x20000000
d.dramBus = 0x40000000
d.useLegacyPull = true
} else if strings.Contains(dTCompatible, "bcm2709") ||
strings.Contains(dTCompatible, "bcm2836") ||
strings.Contains(dTCompatible, "bcm2710") ||
strings.Contains(dTCompatible, "bcm2837") {
case strings.Contains(dTCompatible, "bcm2709"), strings.Contains(dTCompatible, "bcm2836"), strings.Contains(dTCompatible, "bcm2710"), strings.Contains(dTCompatible, "bcm2837"):

Check warning on line 1347 in bcm283x/gpio.go

View check run for this annotation

Codecov / codecov/patch

bcm283x/gpio.go#L1347

Added line #L1347 was not covered by tests
// RPi2+
d.baseAddr = 0x3F000000
d.dramBus = 0xC0000000
d.useLegacyPull = true
} else {
case strings.Contains(dTCompatible, "bcm2712"):
// RPi5
d.baseAddr = 0xFE000000
d.dramBus = 0xC0000000
d.useLegacyPull = false
mapping = mapping2711
default:

Check warning on line 1358 in bcm283x/gpio.go

View check run for this annotation

Codecov / codecov/patch

bcm283x/gpio.go#L1352-L1358

Added lines #L1352 - L1358 were not covered by tests
// RPi4B+
d.baseAddr = 0xFE000000
d.dramBus = 0xC0000000
Expand All @@ -1370,6 +1373,7 @@ func (d *driverGPIO) Init() (bool, error) {
// virtual address space starting at address 0xF2000000. Thus a peripheral
// advertised here at bus address 0x7Ennnnnn is available in the ARM kenel at
// virtual address 0xF2nnnnnn.

d.gpioBaseAddr = d.baseAddr + 0x200000

// Mark the right pins as available even if the memory map fails so they can
Expand Down

0 comments on commit 2764615

Please sign in to comment.