Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions board/sunxi/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <dm.h>
#include <env.h>
#include <hang.h>
#include <i2c.h>
#include <image.h>
#include <init.h>
#include <log.h>
Expand Down Expand Up @@ -920,6 +921,27 @@ static void bluetooth_dt_fixup(void *blob)
"local-bd-address", bdaddr, ETH_ALEN, 1);
}

#define PINEPHONE_LIS3MDL_I2C_ADDR 0x1E
#define PINEPHONE_LIS3MDL_I2C_BUS 1 /* I2C1 */

static void board_dt_fixup(void *blob)
{
struct udevice *bus, *dev;

if (IS_ENABLED(CONFIG_PINEPHONE_DT_SELECTION) &&
!fdt_node_check_compatible(blob, 0, "pine64,pinephone-1.2")) {
if (!uclass_get_device_by_seq(UCLASS_I2C, PINEPHONE_LIS3MDL_I2C_BUS, &bus)) {
dm_i2c_probe(bus, PINEPHONE_LIS3MDL_I2C_ADDR, 0, &dev);
fdt_set_status_by_compatible(
blob, "st,lis3mdl-magn",
dev ? FDT_STATUS_OKAY : FDT_STATUS_DISABLED);
fdt_set_status_by_compatible(
blob, "voltafield,af8133j",
dev ? FDT_STATUS_DISABLED : FDT_STATUS_OKAY);
}
}
}

int ft_board_setup(void *blob, struct bd_info *bd)
{
int __maybe_unused r;
Expand All @@ -933,6 +955,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
fdt_fixup_ethernet(blob);

bluetooth_dt_fixup(blob);
board_dt_fixup(blob);

#ifdef CONFIG_VIDEO_DT_SIMPLEFB
r = sunxi_simplefb_setup(blob);
Expand Down
1 change: 1 addition & 0 deletions configs/pinephone_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2
CONFIG_PINEPHONE_DT_SELECTION=y
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
CONFIG_OF_LIST="sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.2"
CONFIG_SYS_I2C_MVTWSI=y
CONFIG_LED_STATUS=y
CONFIG_LED_STATUS_GPIO=y
CONFIG_LED_STATUS0=y
Expand Down