Skip to content

Instantly share code, notes, and snippets.

@checko
Created April 23, 2013 03:44
Show Gist options
  • Save checko/5440708 to your computer and use it in GitHub Desktop.
Save checko/5440708 to your computer and use it in GitHub Desktop.
diff --git a/common/Makefile b/common/Makefile
index ad7cb4f..8eee015 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -168,6 +168,8 @@ COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o
COBJS-$(CONFIG_UPDATE_TFTP) += update.o
COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
+COBJS-y += cmd_pmic.o
+
COBJS := $(sort $(COBJS-y))
SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/include/configs/mx51_bbg_android.h b/include/configs/mx51_bbg_android.h
index 576fe89..095db74 100644
--- a/include/configs/mx51_bbg_android.h
+++ b/include/configs/mx51_bbg_android.h
@@ -83,6 +83,49 @@
#define CONFIG_NET_RETRY_COUNT 100
#define CONFIG_CMD_I2C
+#define CONFIG_CMD_CLOCK
+#define CONFIG_REF_CLK_FREQ CONFIG_MX51_HCLK_FREQ
+
+/*
+ * FUSE Configs
+ * */
+#ifdef CONFIG_CMD_IIM
+ #define CONFIG_IMX_IIM
+ #define IMX_IIM_BASE IIM_BASE_ADDR
+ #define CONFIG_IIM_MAC_BANK 1
+ #define CONFIG_IIM_MAC_ROW 9
+#endif
+
+/*
+ * SPI Configs
+ * */
+#ifdef CONFIG_CMD_SF
+ #define CONFIG_FSL_SF 1
+ #define CONFIG_SPI_FLASH_IMX_ATMEL 1
+ #define CONFIG_SPI_FLASH_CS 1
+ #define CONFIG_IMX_ECSPI
+ #define IMX_CSPI_VER_2_3 1
+ #define CONFIG_IMX_SPI_PMIC
+ #define CONFIG_IMX_SPI_PMIC_CS 0
+
+ #define MAX_SPI_BYTES (64 * 4)
+#endif
+
+/*
+ * MMC Configs
+ * */
+#ifdef CONFIG_CMD_MMC
+ #define CONFIG_MMC 1
+ #define CONFIG_GENERIC_MMC
+ #define CONFIG_IMX_MMC
+ #define CONFIG_SYS_FSL_ESDHC_NUM 2
+ #define CONFIG_SYS_FSL_ESDHC_ADDR 0
+ #define CONFIG_SYS_MMC_ENV_DEV 0
+ #define CONFIG_DOS_PARTITION 1
+ #define CONFIG_CMD_FAT 1
+ #define CONFIG_DYNAMIC_MMC_DEVNO
+#endif
+
#include <linux/types.h>
#include <command.h>
#include <common.h>
#include <imx_spi.h>
#include <asm/arch/imx_spi_pmic.h>
int do_pmicops(cmd_tbl_t *cmdtp,int flag,int argc,char *argv[])
{
int rc=0;
u32 reg;
u32 val;
struct spi_slave *slave;
slave = spi_pmic_probe();
switch(argc) {
case 1:
printf("nothing\n");
break;
case 2:
reg = simple_strtoul(argv[1],NULL,10);
val = pmic_reg(slave,reg,0,0);
printf("reg%d = %X\n",reg,val);
break;
case 3:
reg = simple_strtoul(argv[1],NULL,10);
val = simple_strtoul(argv[2],NULL,16);
pmic_reg(slave,reg,val,1);
printf("write reg%d = %X\n",reg,val);
break;
default:
rc=1;
printf("Too much parameters.\n");
break;
}
spi_pmic_free(slave);
return rc;
}
U_BOOT_CMD(pmic,3,1,do_pmicops,
"PMIC sub system",
"Read/Write pmic\n"
"pmic regno : read regno\n"
"pmic regno value(0x..) : write value to regno");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment