From 2ad853c3485e08612bb7725ba50d35b679978ebc Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Thu, 15 Jul 2010 13:43:10 -0700 Subject: ARMV7: Add pad mux support for OMAP4 Add functional multiplexing support for OMAP4 pads. Configure all the pads for the OMAP4430 SDP and OMAP4 Panda boards Signed-off-by: Steve Sakoman Signed-off-by: Aneesh V Signed-off-by: Sandeep Paulraj --- include/configs/omap4_panda.h | 1 + include/configs/omap4_sdp4430.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h index b1e40a38f61..0c5ef7b78a5 100644 --- a/include/configs/omap4_panda.h +++ b/include/configs/omap4_panda.h @@ -35,6 +35,7 @@ #define CONFIG_OMAP44XX 1 /* which is a 44XX */ #define CONFIG_OMAP4430 1 /* which is in a 4430 */ #define CONFIG_PANDA 1 /* working with Panda */ +#define CONFIG_ARCH_CPU_INIT /* Get CPU defs */ #include diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index 81215544480..ede7691d18a 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -36,6 +36,7 @@ #define CONFIG_OMAP44XX 1 /* which is a 44XX */ #define CONFIG_OMAP4430 1 /* which is in a 4430 */ #define CONFIG_4430SDP 1 /* working with SDP */ +#define CONFIG_ARCH_CPU_INIT /* Get CPU defs */ #include -- cgit v1.3.1 From 674e0b217f794800048d80de09a71255b890a53e Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Tue, 20 Jul 2010 14:56:07 -0700 Subject: ARMV7: Fix udelay for OMAP4 The OMAP4 x-load code sets gptimer1 clock source to 32Khz. This isn't acceptable for udelay. This patch changes from gptimer1 to gptimer2, which uses sys_clk at 38.4 Mhz. Signed-off-by: Steve Sakoman Signed-off-by: Sandeep Paulraj --- arch/arm/cpu/armv7/omap-common/timer.c | 9 --------- include/configs/omap4_panda.h | 2 +- include/configs/omap4_sdp4430.h | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/arch/arm/cpu/armv7/omap-common/timer.c b/arch/arm/cpu/armv7/omap-common/timer.c index 69e285ff1dd..6b8cf7ba2dc 100644 --- a/arch/arm/cpu/armv7/omap-common/timer.c +++ b/arch/arm/cpu/armv7/omap-common/timer.c @@ -41,12 +41,8 @@ static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE; /* * Nothing really to do with interrupts, just starts up a counter. - * We run the counter with 13MHz, divided by 8, resulting in timer - * frequency of 1.625MHz. With 32bit counter register, counter - * overflows in ~44min */ -/* 13MHz / 8 = 1.625MHz */ #define TIMER_CLOCK (V_SCLK / (2 << CONFIG_SYS_PTV)) #define TIMER_LOAD_VAL 0xffffffff @@ -84,11 +80,6 @@ void set_timer(ulong t) /* delay x useconds */ void __udelay(unsigned long usec) { -#if defined(CONFIG_OMAP44XX) - /* TODO temporary hack until OMAP4 clock setup routines are present */ - if (usec > 1000) - usec = usec/1000; -#endif long tmo = usec * (TIMER_CLOCK / 1000) / 1000; unsigned long now, last = readl(&timer_base->tcrr); diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h index 0c5ef7b78a5..0fb1ad30d28 100644 --- a/include/configs/omap4_panda.h +++ b/include/configs/omap4_panda.h @@ -196,7 +196,7 @@ #define CONFIG_SYS_LOAD_ADDR 0x80000000 /* Use General purpose timer 1 */ -#define CONFIG_SYS_TIMERBASE GPT1_BASE +#define CONFIG_SYS_TIMERBASE GPT2_BASE #define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ #define CONFIG_SYS_HZ 1000 diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index ede7691d18a..ef5272b494d 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -197,7 +197,7 @@ #define CONFIG_SYS_LOAD_ADDR 0x80000000 /* Use General purpose timer 1 */ -#define CONFIG_SYS_TIMERBASE GPT1_BASE +#define CONFIG_SYS_TIMERBASE GPT2_BASE #define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ #define CONFIG_SYS_HZ 1000 -- cgit v1.3.1 From 516799f6777caab2151ed276a3c198940962f06a Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Thu, 15 Jul 2010 12:53:42 -0700 Subject: ARMV7: Add support for the TWL6030 I2C power chip used in OMAP4 systems This patch add the basic infrastructure for the TWL6030 driver and enables support in the two existing OMAP4 boards, Panda and OMAP4430 SDP Signed-off-by: Steve Sakoman Signed-off-by: Sandeep Paulraj --- drivers/power/Makefile | 1 + drivers/power/twl6030.c | 78 +++++++++++++++++++++++++++++++++++ include/configs/omap4_panda.h | 3 ++ include/configs/omap4_sdp4430.h | 3 ++ include/twl6030.h | 91 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 176 insertions(+) create mode 100644 drivers/power/twl6030.c create mode 100644 include/twl6030.h (limited to 'include') diff --git a/drivers/power/Makefile b/drivers/power/Makefile index dd0651466fd..db531738379 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile @@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk LIB := $(obj)libpower.a COBJS-$(CONFIG_TWL4030_POWER) += twl4030.o +COBJS-$(CONFIG_TWL6030_POWER) += twl6030.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c new file mode 100644 index 00000000000..cf1da6b6a23 --- /dev/null +++ b/drivers/power/twl6030.c @@ -0,0 +1,78 @@ +/* + * (C) Copyright 2010 + * Texas Instruments, + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program 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 program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#include +#ifdef CONFIG_TWL6030_POWER + +#include + +/* Functions to read and write from TWL6030 */ +static inline int twl6030_i2c_write_u8(u8 chip_no, u8 val, u8 reg) +{ + return i2c_write(chip_no, reg, 1, &val, 1); +} + +static inline int twl6030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg) +{ + return i2c_read(chip_no, reg, 1, val, 1); +} + +void twl6030_start_usb_charging(void) +{ + twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_VICHRG_1500, + CHARGERUSB_VICHRG); + twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_CIN_LIMIT_NONE, + CHARGERUSB_CINLIMIT); + twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, MBAT_TEMP, + CONTROLLER_INT_MASK); + twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, MASK_MCHARGERUSB_THMREG, + CHARGERUSB_INT_MASK); + twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_VOREG_4P0, + CHARGERUSB_VOREG); + twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_CTRL2_VITERM_100, + CHARGERUSB_CTRL2); + /* Enable USB charging */ + twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CONTROLLER_CTRL1_EN_CHARGER, + CONTROLLER_CTRL1); + return; +} + +void twl6030_init_battery_charging(void) +{ + twl6030_start_usb_charging(); + return; +} + +void twl6030_usb_device_settings() +{ + u8 data = 0; + + /* Select APP Group and set state to ON */ + twl6030_i2c_write_u8(TWL6030_CHIP_PM, 0x21, VUSB_CFG_STATE); + + twl6030_i2c_read_u8(TWL6030_CHIP_PM, &data, MISC2); + data |= 0x10; + + /* Select the input supply for VBUS regulator */ + twl6030_i2c_write_u8(TWL6030_CHIP_PM, data, MISC2); +} +#endif diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h index 0fb1ad30d28..4bec00bf0ed 100644 --- a/include/configs/omap4_panda.h +++ b/include/configs/omap4_panda.h @@ -103,6 +103,9 @@ #define CONFIG_DRIVER_OMAP34XX_I2C 1 #define CONFIG_I2C_MULTI_BUS 1 +/* TWL6030 */ +#define CONFIG_TWL6030_POWER 1 + /* MMC */ #define CONFIG_MMC 1 #define CONFIG_OMAP3_MMC 1 diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index ef5272b494d..c18e71a3c23 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -104,6 +104,9 @@ #define CONFIG_DRIVER_OMAP34XX_I2C 1 #define CONFIG_I2C_MULTI_BUS 1 +/* TWL6030 */ +#define CONFIG_TWL6030_POWER 1 + /* MMC */ #define CONFIG_MMC 1 #define CONFIG_OMAP3_MMC 1 diff --git a/include/twl6030.h b/include/twl6030.h new file mode 100644 index 00000000000..54923ab2e4b --- /dev/null +++ b/include/twl6030.h @@ -0,0 +1,91 @@ +/* + * (C) Copyright 2010 + * Texas Instruments, + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program 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 program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include + +/* I2C chip addresses */ +#define TWL6030_CHIP_PM 0x48 + +#define TWL6030_CHIP_USB 0x49 +#define TWL6030_CHIP_ADC 0x49 +#define TWL6030_CHIP_CHARGER 0x49 +#define TWL6030_CHIP_PWM 0x49 + +/* Battery CHARGER REGISTERS */ +#define CONTROLLER_INT_MASK 0xE0 +#define CONTROLLER_CTRL1 0xE1 +#define CONTROLLER_WDG 0xE2 +#define CONTROLLER_STAT1 0xE3 +#define CHARGERUSB_INT_STATUS 0xE4 +#define CHARGERUSB_INT_MASK 0xE5 +#define CHARGERUSB_STATUS_INT1 0xE6 +#define CHARGERUSB_STATUS_INT2 0xE7 +#define CHARGERUSB_CTRL1 0xE8 +#define CHARGERUSB_CTRL2 0xE9 +#define CHARGERUSB_CTRL3 0xEA +#define CHARGERUSB_STAT1 0xEB +#define CHARGERUSB_VOREG 0xEC +#define CHARGERUSB_VICHRG 0xED +#define CHARGERUSB_CINLIMIT 0xEE +#define CHARGERUSB_CTRLLIMIT1 0xEF + +/* CHARGERUSB_VICHRG */ +#define CHARGERUSB_VICHRG_500 0x4 +#define CHARGERUSB_VICHRG_1500 0xE +/* CHARGERUSB_CINLIMIT */ +#define CHARGERUSB_CIN_LIMIT_100 0x1 +#define CHARGERUSB_CIN_LIMIT_300 0x5 +#define CHARGERUSB_CIN_LIMIT_500 0x9 +#define CHARGERUSB_CIN_LIMIT_NONE 0xF +/* CONTROLLER_INT_MASK */ +#define MVAC_FAULT (1 << 6) +#define MAC_EOC (1 << 5) +#define MBAT_REMOVED (1 << 4) +#define MFAULT_WDG (1 << 3) +#define MBAT_TEMP (1 << 2) +#define MVBUS_DET (1 << 1) +#define MVAC_DET (1 << 0) +/* CHARGERUSB_INT_MASK */ +#define MASK_MCURRENT_TERM (1 << 3) +#define MASK_MCHARGERUSB_STAT (1 << 2) +#define MASK_MCHARGERUSB_THMREG (1 << 1) +#define MASK_MCHARGERUSB_FAULT (1 << 0) +/* CHARGERUSB_VOREG */ +#define CHARGERUSB_VOREG_3P52 0x01 +#define CHARGERUSB_VOREG_4P0 0x19 +#define CHARGERUSB_VOREG_4P2 0x23 +#define CHARGERUSB_VOREG_4P76 0x3F +/* CHARGERUSB_CTRL2 */ +#define CHARGERUSB_CTRL2_VITERM_50 (0 << 5) +#define CHARGERUSB_CTRL2_VITERM_100 (1 << 5) +#define CHARGERUSB_CTRL2_VITERM_150 (2 << 5) +/* CONTROLLER_CTRL1 */ +#define CONTROLLER_CTRL1_EN_CHARGER (1 << 4) +#define CONTROLLER_CTRL1_SEL_CHARGER (1 << 3) + +#define VUSB_CFG_STATE 0xA2 +#define MISC2 0xE5 + +void twl6030_init_battery_charging(void); +void twl6030_usb_device_settings(void); -- cgit v1.3.1 From 325abab7c12782235def2d00806dc39fe1c810e0 Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Fri, 25 Jun 2010 12:44:33 -0700 Subject: ARMV7: Enable musb driver and usbtty on OMAP4430 SDP Signed-off-by: Steve Sakoman Signed-off-by: Sandeep Paulraj --- include/configs/omap4_sdp4430.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index c18e71a3c23..e9909f91b10 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -113,6 +113,20 @@ #define CONFIG_SYS_MMC_SET_DEV 1 #define CONFIG_DOS_PARTITION 1 +/* USB */ +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 + +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "SDP4430" + /* Flash */ #define CONFIG_SYS_NO_FLASH 1 @@ -146,6 +160,7 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x82000000\0" \ "console=ttyS2,115200n8\0" \ + "usbtty=cdc_acm\0" \ "mmcdev=1\0" \ "mmcroot=/dev/mmcblk0p2 rw\0" \ "mmcrootfstype=ext3 rootwait\0" \ -- cgit v1.3.1 From cbd7b09cb3a3841710b31b5d1b208a4cceae433c Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Fri, 25 Jun 2010 12:52:01 -0700 Subject: ARMV7: Enable musb driver and usbtty on OMAP4 Panda Signed-off-by: Steve Sakoman Signed-off-by: Sandeep Paulraj --- include/configs/omap4_panda.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h index 4bec00bf0ed..1d76467277d 100644 --- a/include/configs/omap4_panda.h +++ b/include/configs/omap4_panda.h @@ -112,6 +112,20 @@ #define CONFIG_SYS_MMC_SET_DEV 1 #define CONFIG_DOS_PARTITION 1 +/* USB */ +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 + +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "OMAP4 Panda" + /* Flash */ #define CONFIG_SYS_NO_FLASH 1 @@ -145,6 +159,7 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x82000000\0" \ "console=ttyS2,115200n8\0" \ + "usbtty=cdc_acm\0" \ "mmcdev=1\0" \ "mmcroot=/dev/mmcblk0p2 rw\0" \ "mmcrootfstype=ext3 rootwait\0" \ -- cgit v1.3.1 From 1b03eede4fed47c6af7df84b0f7b621ff3e3bb40 Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Wed, 7 Jul 2010 15:25:25 -0700 Subject: ARMV7: Update default environment for OMAP4 boards Specify vram on command line, remove erroneous call to nandboot in the boot script, add CONFIG_BOOTDELAY Signed-off-by: Steve Sakoman Acked-by: Nishanth Menon Signed-off-by: Sandeep Paulraj --- include/configs/omap4_panda.h | 5 ++++- include/configs/omap4_sdp4430.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h index 1d76467277d..a0d27a437d5 100644 --- a/include/configs/omap4_panda.h +++ b/include/configs/omap4_panda.h @@ -153,6 +153,8 @@ * Environment setup */ +#define CONFIG_BOOTDELAY 3 + /* allow overwriting serial config and ethaddr */ #define CONFIG_ENV_OVERWRITE @@ -160,10 +162,12 @@ "loadaddr=0x82000000\0" \ "console=ttyS2,115200n8\0" \ "usbtty=cdc_acm\0" \ + "vram=16M\0" \ "mmcdev=1\0" \ "mmcroot=/dev/mmcblk0p2 rw\0" \ "mmcrootfstype=ext3 rootwait\0" \ "mmcargs=setenv bootargs console=${console} " \ + "vram=${vram} " \ "root=${mmcroot} " \ "rootfstype=${mmcrootfstype}\0" \ "loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \ @@ -181,7 +185,6 @@ "else " \ "if run loaduimage; then " \ "run mmcboot; " \ - "else run nandboot; " \ "fi; " \ "fi; " \ "fi" diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index e9909f91b10..d5439f988a3 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -154,6 +154,8 @@ * Environment setup */ +#define CONFIG_BOOTDELAY 3 + /* allow overwriting serial config and ethaddr */ #define CONFIG_ENV_OVERWRITE @@ -161,10 +163,12 @@ "loadaddr=0x82000000\0" \ "console=ttyS2,115200n8\0" \ "usbtty=cdc_acm\0" \ + "vram=16M\0" \ "mmcdev=1\0" \ "mmcroot=/dev/mmcblk0p2 rw\0" \ "mmcrootfstype=ext3 rootwait\0" \ "mmcargs=setenv bootargs console=${console} " \ + "vram=${vram} " \ "root=${mmcroot} " \ "rootfstype=${mmcrootfstype}\0" \ "loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \ @@ -182,7 +186,6 @@ "else " \ "if run loaduimage; then " \ "run mmcboot; " \ - "else run nandboot; " \ "fi; " \ "fi; " \ "fi" -- cgit v1.3.1