Add support for the MT41K128M16JT125K memory modules
Subsystems (3)
PATCH v2 1/3 Add support for the MT41K128M16JT125K memory modules
From: Sjoerd Simons <[email protected]>
Add configuration for the MT41K128M16JT125K memory modules as used on the Bosch Guardian device.
Based on a patch by:
Govindaraji Sivanantham <[email protected]>
---
Changes in v2: None
arch/arm/include/asm/arch-am33xx/ddr_defs.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/include/asm/arch-am33xx/ddr_defs.h +16 -0
@@ -84,6 +84,22 @@#define MT41K128MJT187E_PHY_FIFO_WE 0x100#define MT41K128MJT187E_IOCTRL_VALUE 0x18B +/* Micron MT41K128M16JT-125 IT:K (256 MB) at 400MHz */ +#define MT41K128M16JT125K_EMIF_READ_LATENCY 0x07 +#define MT41K128M16JT125K_EMIF_TIM1 0x0AAAD4DB +#define MT41K128M16JT125K_EMIF_TIM2 0x2A437FDA +#define MT41K128M16JT125K_EMIF_TIM3 0x501F83FF +#define MT41K128M16JT125K_EMIF_SDCFG 0x61A052B2 +#define MT41K128M16JT125K_EMIF_SDREF 0x00000C30 +#define MT41K128M16JT125K_ZQ_CFG 0x50074BE4 +#define MT41K128M16JT125K_RATIO 0x80 +#define MT41K128M16JT125K_INVERT_CLKOUT 0x0 +#define MT41K128M16JT125K_RD_DQS 0x38 +#define MT41K128M16JT125K_WR_DQS 0x46 +#define MT41K128M16JT125K_PHY_WR_DATA 0x7D +#define MT41K128M16JT125K_PHY_FIFO_WE 0x9B +#define MT41K128M16JT125K_IOCTRL_VALUE 0x18B +/* Micron MT41J64M16JT-125 */ #define MT41J64MJT125_EMIF_SDCFG 0x61C04A32
Signature · 1 line
2.20.1
PATCH v2 2/3 env: Don't check CONFIG_ENV_OFFSET_REDUND for SPL build
When booting using an SPL on am335x, if we want to support booting with the boot ROM loader via USB (which uses RNDIS, making bootp and tftp calls) we need to enable gadget eth in the SPL to load the main U-Boot image. To enable CONFIG_SPL_ETH_SUPPORT, we must enable CONFIG_SPL_ENV_SUPPORT as the environment is used by the eth support, but we don't actually need to have environment variables saved in the SPL environment. We do however have environment variables saved in the main U-Boot image and enable CONFIG_ENV_OFFSET_REDUND (we are storing in raw NAND). In such instances, even with the build config enabling both CONFIG_CMD_SAVEENV and CONFIG_CMD_NAND, these options aren't set when building the SPL, but CONFIG_ENV_OFFSET_REDUND still is.
Don't check this configuration option for SPL builds to enable the above configuration.
---
Changes in v2:
- Reword commit message to better describe the issue
env/nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
env/nand.c +1 -1
@@ -26,7 +26,7 @@#if defined(CONFIG_CMD_SAVEENV ) && defined(CONFIG_CMD_NAND ) && \ !defined(CONFIG_SPL_BUILD )#define CMD_SAVEENV -#elif defined(CONFIG_ENV_OFFSET_REDUND ) +#elif defined(CONFIG_ENV_OFFSET_REDUND ) && !defined(CONFIG_SPL_BUILD )#error CONFIG_ENV_OFFSET_REDUND must have CONFIG_CMD_SAVEENV & CONFIG_CMD_NAND#endif
Signature · 1 line
2.20.1
PATCH v2 2/3 env: Don't check CONFIG_ENV_OFFSET_REDUND for SPL build
Quoted 12 lines · Martyn Welch
When booting using an SPL on am335x, if we want to support booting with the boot ROM loader via USB (which uses RNDIS, making bootp and tftp calls) we need to enable gadget eth in the SPL to load the main U-Boot image. To enable
CONFIG_SPL_ETH_SUPPORT, we must enableCONFIG_SPL_ENV_SUPPORTas the environment is used by the eth support, but we don't actually need to have environment variables saved in the SPL environment. We do however have environment variables saved in the main U-Boot image and enableCONFIG_ENV_OFFSET_REDUND(we are storing in raw NAND). In such instances, even with the build config enabling bothCONFIG_CMD_SAVEENVandCONFIG_CMD_NAND, these options aren't set when building the SPL, butCONFIG_ENV_OFFSET_REDUNDstill is.
Quoted 5 lines
Don't check this configuration option for SPL builds to enable the above configuration.
Signed-off-by Martyn Welch <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190222/0c302fc3/attachment.sig>
PATCH v2 3/3 am335x, guardian: Add support for the bosch guardian board
In reply to Martyn WelchFrom: Sjoerd Simons <[email protected]>
Add support for the Bosch Guardian board.
CPU : AM335X-GP rev 2.1 Model: Bosch AM335x Guardian I2C: ready DRAM: 256 MiB NAND: 512 MiB MMC: OMAP SD/MMC: 0
---
Changes in v2:
- Correct guard #ifdef naming in board config header
- Remove missed cruft from board files
arch/arm/Kconfig | 1 + arch/arm/dts/am335x-guardian-u-boot.dtsi | 66 +++ arch/arm/dts/am335x-guardian.dts | 511 +++++++++++++++++++++++ arch/arm/mach-omap2/am33xx/Kconfig | 7 + board/bosch/guardian/Kconfig | 15 + board/bosch/guardian/MAINTAINERS | 6 + board/bosch/guardian/Makefile | 12 + board/bosch/guardian/board.c | 186 +++++++++ board/bosch/guardian/board.h | 17 + board/bosch/guardian/mux.c | 99 +++++ configs/am335x_guardian_defconfig | 90 ++++ include/configs/am335x_guardian.h | 111 +++++ 12 files changed, 1121 insertions(+) create mode 100644 arch/arm/dts/am335x-guardian-u-boot.dtsi create mode 100644 arch/arm/dts/am335x-guardian.dts create mode 100644 board/bosch/guardian/Kconfig create mode 100644 board/bosch/guardian/MAINTAINERS create mode 100644 board/bosch/guardian/Makefile create mode 100644 board/bosch/guardian/board.c create mode 100644 board/bosch/guardian/board.h create mode 100644 board/bosch/guardian/mux.c create mode 100644 configs/am335x_guardian_defconfig create mode 100644 include/configs/am335x_guardian.h
arch/arm/Kconfig +1 -0
@@ -1524,6 +1524,7 @@ source "arch/arm/cpu/armv8/Kconfig" source "arch/arm/mach-imx/Kconfig" source "board/bosch/shc/Kconfig" +source "board/bosch/guardian/Kconfig" source "board/CarMediaLab/flea3/Kconfig" source "board/Marvell/aspenite/Kconfig" source "board/Marvell/gplugd/Kconfig"
arch/arm/dts/am335x-guardian-u-boot.dtsi new file +66 -0
66 lines not on this page · raw message
arch/arm/dts/am335x-guardian.dts new file +511 -0
511 lines not on this page · raw message
arch/arm/mach-omap2/am33xx/Kconfig +7 -0
@@ -87,6 +87,13 @@ config TARGET_AM335X_SHC imply CMD_DM imply CMD_SPL +config TARGET_AM335X_GUARDIAN + bool "Support am335x based guardian board from bosch" + select DM + select DM_SERIAL + select DM_GPIO + select DM_USB + config TARGET_AM335X_SL50 bool "Support am335x_sl50" select BOARD_LATE_INIT
board/bosch/guardian/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_AM335X_GUARDIAN + +config SYS_BOARD + default "guardian" + +config SYS_VENDOR + default "bosch" + +config SYS_SOC + default "am33xx" + +config SYS_CONFIG_NAME + default "am335x_guardian" + +endif
board/bosch/guardian/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +Guardian BOARD +M: Sjoerd Simons <[email protected]> +S: Maintained +F: board/bosch/guardian/ +F: include/configs/am335x_guardian.h +F: configs/am335x_guardian_defconfig
board/bosch/guardian/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Makefile +# +# Copyright (C) 2018 Robert Bosch Power Tools GmbH +# + +ifeq ($(CONFIG_SKIP_LOWLEVEL_INIT),) +obj-y := mux.o +endif + +obj-y += board.o
board/bosch/guardian/board.c new file +186 -0
186 lines not on this page · raw message
board/bosch/guardian/board.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* board.h +* +* Board header for Bosch Guardian +* +* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ +* Copyright (C) 2018 Robert Bosch Power Tools GmbH +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +void enable_uart0_pin_mux (void ); +void enable_i2c0_pin_mux (void ); +void enable_board_pin_mux (void ); +#endif
board/bosch/guardian/mux.c new file +99 -0
99 lines not on this page · raw message
configs/am335x_guardian_defconfig new file +90 -0
90 lines not on this page · raw message
include/configs/am335x_guardian.h new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v2 3/3 am335x, guardian: Add support for the bosch guardian board
Quoted 11 lines · Martyn Welch
From: Sjoerd Simons <[email protected]>
Add support for the Bosch Guardian board.
CPU : AM335X-GP rev 2.1 Model: Bosch AM335x Guardian I2C: ready DRAM: 256 MiB NAND: 512 MiB MMC: OMAP SD/MMC: 0
Quoted 3 lines
Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Martyn Welch <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190222/5e91edc0/attachment.sig>
PATCH v2 3/3 am335x, guardian: Add support for the bosch guardian board
In reply to Martyn WelchQuoted 56 lines · Martyn Welch
From: Sjoerd Simons <[email protected]>
Add support for the Bosch Guardian board.
CPU : AM335X-GP rev 2.1 Model: Bosch AM335x Guardian I2C: ready DRAM: 256 MiB NAND: 512 MiB MMC: OMAP SD/MMC: 0Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Martyn Welch <[email protected]>---
Changes in v2:
- Correct guard #ifdef naming in board config header
- Remove missed cruft from board filesarch/arm/Kconfig | 1 + arch/arm/dts/am335x-guardian-u-boot.dtsi | 66 +++ arch/arm/dts/am335x-guardian.dts | 511 +++++++++++++++++++++++ arch/arm/mach-omap2/am33xx/Kconfig | 7 + board/bosch/guardian/Kconfig | 15 + board/bosch/guardian/MAINTAINERS | 6 + board/bosch/guardian/Makefile | 12 + board/bosch/guardian/board.c | 186 +++++++++ board/bosch/guardian/board.h | 17 + board/bosch/guardian/mux.c | 99 +++++ configs/am335x_guardian_defconfig | 90 ++++ include/configs/am335x_guardian.h | 111 +++++ 12 files changed, 1121 insertions(+) create mode 100644 arch/arm/dts/am335x-guardian-u-boot.dtsi create mode 100644 arch/arm/dts/am335x-guardian.dts create mode 100644 board/bosch/guardian/Kconfig create mode 100644 board/bosch/guardian/MAINTAINERS create mode 100644 board/bosch/guardian/Makefile create mode 100644 board/bosch/guardian/board.c create mode 100644 board/bosch/guardian/board.h create mode 100644 board/bosch/guardian/mux.c create mode 100644 configs/am335x_guardian_defconfig create mode 100644 include/configs/am335x_guardian.harch/arm/Kconfig +1
-0@@ -1524,6 +1524,7 @@ source "arch/arm/cpu/armv8/Kconfig" source "arch/arm/mach-imx/Kconfig" source "board/bosch/shc/Kconfig" +source "board/bosch/guardian/Kconfig" source "board/CarMediaLab/flea3/Kconfig" source "board/Marvell/aspenite/Kconfig" source "board/Marvell/gplugd/Kconfig"
[...]
Quoted 31 lines
arch/arm/dts/am335x-guardian.dts new file +25
-0@@ -0,0 +1,511 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (C) 2018 Robert Bosch Power Tools GmbH + */ +/dts-v1/; + +#include "am33xx.dtsi" +#include <dt-bindings/input/input.h> +#include <dt-bindings/interrupt-controller/irq.h> + +/ { + model = "Bosch AM335x Guardian"; + compatible = "bosch,am335x-guardian", "ti,am33xx"; + + chosen { + stdout-path = &uart0; + tick-timer = &timer2; + }; + + cpus { + cpu at 0 { + cpu0-supply = <&dcdc2_reg>; + }; + };
arch/arm/dts/am335x-guardian.dts line 35
Quoted 10 lines
arch/arm/dts/am335x-guardian.dts new file +10
-0+ + memory at 80000000 { + device_type = "memory"; + reg = <0x80000000 0x10000000>; /* 256 MB */ + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>;
The properties #address-cells and #size-cells can be removed as the only child node does not have a reg property.
Quoted 31 lines
arch/arm/dts/am335x-guardian.dts new file +31
-0+ pinctrl-names = "default"; + pinctrl-0 = <&gpio_keys_pins>; + + button21 { + label = "guardian-power-button"; + linux,code = <KEY_POWER>; + gpios = <&gpio2 21 0>; + wakeup-source; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&leds_pins>; + + led1 { + label = "green:heartbeat"; + gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + default-state = "off"; + }; + + led2 { + label = "green:mmc0"; + gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mmc0"; + default-state = "off"; + }; + }; +
[...]
Quoted 33 lines
board/bosch/guardian/board.c new file +27
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* board.c +* +* Board functions for Bosch Guardian +* +* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ +* Copyright (C) 2018 Robert Bosch Power Tools GmbH +*/ + +#include <common.h> +#include <errno.h> +#include <spl.h> +#include <asm/arch/cpu.h> +#include <asm/arch/hardware.h> +#include <asm/arch/omap.h> +#include <asm/arch/ddr_defs.h> +#include <asm/arch/clock.h> +#include <asm/arch/gpio.h> +#include <asm/arch/mmc_host_def.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/mem.h> +#include <asm/io.h> +#include <asm/emif.h> +#include <asm/gpio.h> +#include <dm.h> +#include <i2c.h>
board/bosch/guardian/board.c line 37
Quoted 10 lines
board/bosch/guardian/board.c new file +10
-0+#include <miiphy.h> +#include <cpsw.h> +#include <panel.h> +#include <power/tps65217.h> +#include <power/tps65910.h> +#include <environment.h> +#include <watchdog.h> +#include <environment.h> +#include "board.h" +
The suggested order of include files is:
<common.h>
<others.h>
<asm/...>
<arch/arm/...>
<linux/...>
"local.h"
Quoted 184 lines
board/bosch/guardian/board.c new file +149
-0+DECLARE_GLOBAL_DATA_PTR ; + +#ifndef CONFIG_SKIP_LOWLEVEL_INIT +static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE ; + +static const struct ddr_data ddr3_data = { + .datardsratio0 =MT41K128M16JT125K_RD_DQS , + .datawdsratio0 =MT41K128M16JT125K_WR_DQS , + .datafwsratio0 =MT41K128M16JT125K_PHY_FIFO_WE , + .datawrsratio0 =MT41K128M16JT125K_PHY_WR_DATA , +}; + +static const struct cmd_control ddr3_cmd_ctrl_data = { + .cmd0csratio =MT41K128M16JT125K_RATIO , + .cmd0iclkout =MT41K128M16JT125K_INVERT_CLKOUT , + + .cmd1csratio =MT41K128M16JT125K_RATIO , + .cmd1iclkout =MT41K128M16JT125K_INVERT_CLKOUT , + + .cmd2csratio =MT41K128M16JT125K_RATIO , + .cmd2iclkout =MT41K128M16JT125K_INVERT_CLKOUT , +}; + +static struct emif_regs ddr3_emif_reg_data = { + .sdram_config =MT41K128M16JT125K_EMIF_SDCFG , + .ref_ctrl =MT41K128M16JT125K_EMIF_SDREF , + .sdram_tim1 =MT41K128M16JT125K_EMIF_TIM1 , + .sdram_tim2 =MT41K128M16JT125K_EMIF_TIM2 , + .sdram_tim3 =MT41K128M16JT125K_EMIF_TIM3 , + .zq_config =MT41K128M16JT125K_ZQ_CFG , + .emif_ddr_phy_ctlr_1 =MT41K128M16JT125K_EMIF_READ_LATENCY , +}; + +#define OSC (V_OSCK / 1000000) +const struct dpll_params dpll_ddr = { +400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; + +void am33xx_spl_board_init (void ) +{ +int mpu_vdd; +int usb_cur_lim; + +/* Get the frequency */ + dpll_mpu_opp100.m =am335x_get_efuse_mpu_max_freq (cdev); + +if (i2c_probe (TPS65217_CHIP_PM )) +return ; + +/* +* Increase USB current limit to 1300mA or 1800mA and set +* the MPU voltage controller as needed. +*/ +if (dpll_mpu_opp100.m ==MPUPLL_M_1000 ) { + usb_cur_lim =TPS65217_USB_INPUT_CUR_LIMIT_1800MA ; + mpu_vdd =TPS65217_DCDC_VOLT_SEL_1325MV ; + }else { + usb_cur_lim =TPS65217_USB_INPUT_CUR_LIMIT_1300MA ; + mpu_vdd =TPS65217_DCDC_VOLT_SEL_1275MV ; + } + +if (tps65217_reg_write (TPS65217_PROT_LEVEL_NONE , +TPS65217_POWER_PATH , + usb_cur_lim, +TPS65217_USB_INPUT_CUR_LIMIT_MASK )) +puts ("tps65217_reg_write failure\n" ); + +/* Set DCDC3 (CORE) voltage to 1.125V */ +if (tps65217_voltage_update (TPS65217_DEFDCDC3 , +TPS65217_DCDC_VOLT_SEL_1125MV )) { +puts ("tps65217_voltage_update failure\n" ); +return ; + } + +/* Set CORE Frequencies to OPP100 */ +do_setup_dpll (&dpll_core_regs, &dpll_core_opp100); + +/* Set DCDC2 (MPU) voltage */ +if (tps65217_voltage_update (TPS65217_DEFDCDC2 , mpu_vdd)) { +puts ("tps65217_voltage_update failure\n" ); +return ; + } + +/* +* Set LDO3 to 1.8V and LDO4 to 3.3V +*/ +if (tps65217_reg_write (TPS65217_PROT_LEVEL_2 , +TPS65217_DEFLS1 , +TPS65217_LDO_VOLTAGE_OUT_1_8 , +TPS65217_LDO_MASK )) +puts ("tps65217_reg_write failure\n" ); + +if (tps65217_reg_write (TPS65217_PROT_LEVEL_2 , +TPS65217_DEFLS2 , +TPS65217_LDO_VOLTAGE_OUT_3_3 , +TPS65217_LDO_MASK )) +puts ("tps65217_reg_write failure\n" ); + +/* Set MPU Frequency to what we detected now that voltages are set */ +do_setup_dpll (&dpll_mpu_regs, &dpll_mpu_opp100); +} + +const struct dpll_params *get_dpll_ddr_params (void ) +{ +enable_i2c0_pin_mux (); +i2c_init (CONFIG_SYS_OMAP24_I2C_SPEED ,CONFIG_SYS_OMAP24_I2C_SLAVE ); + +return &dpll_ddr; +} + +void set_uart_mux_conf (void ) +{ +enable_uart0_pin_mux (); +} + +void set_mux_conf_regs (void ) +{ +enable_board_pin_mux (); +} + +const struct ctrl_ioregs ioregs = { + .cm0ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .cm1ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .cm2ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .dt0ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .dt1ioctl =MT41K128M16JT125K_IOCTRL_VALUE , +}; + +void sdram_init (void ) +{ +config_ddr (400 , &ioregs, + &ddr3_data, + &ddr3_cmd_ctrl_data, + &ddr3_emif_reg_data,0 ); +} +#endif + +int board_init (void ) +{ +#if defined(CONFIG_HW_WATCHDOG ) +hw_watchdog_init (); +#endif + + gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; + +#ifdef CONFIG_NAND +gpmc_init (); +#endif +return 0 ; +}board/bosch/guardian/board.h new file +17
-0@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* board.h +* +* Board header for Bosch Guardian +* +* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ +* Copyright (C) 2018 Robert Bosch Power Tools GmbH +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +void enable_uart0_pin_mux (void ); +void enable_i2c0_pin_mux (void ); +void enable_board_pin_mux (void ); +#endif board/bosch/guardian/mux.c new file +6
-0@@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* mux.c +* +* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ +* Copyright (C) 2018 Robert Bosch Power Tools GmbH
board/bosch/guardian/mux.c line 16
Quoted 10 lines
board/bosch/guardian/mux.c new file +10
-0+*/ + +#include <common.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/hardware.h> +#include <asm/arch/mux.h> +#include <asm/io.h> +#include <i2c.h> +#include "board.h" +
Order of include files (same as above).
Quoted 73 lines
board/bosch/guardian/mux.c new file +73
-0+static struct module_pin_mux uart0_pin_mux[] = { + {OFFSET (uart0_rxd), (MODE (0 ) |PULLUP_EN |RXACTIVE )}, + {OFFSET (uart0_txd), (MODE (0 ) |PULLUDEN )}, + {-1 }, +}; + +static struct module_pin_mux i2c0_pin_mux[] = { + {OFFSET (i2c0_sda), (MODE (0 ) |RXACTIVE |PULLUDEN |SLEWCTRL )}, + {OFFSET (i2c0_scl), (MODE (0 ) |RXACTIVE |PULLUDEN |SLEWCTRL )}, + {-1 }, +}; + +static struct module_pin_mux adc_voltages_en[] = { + {OFFSET (mcasp0_ahclkx), (MODE (7 ) |PULLUP_EN )}, + {-1 }, +}; + +static struct module_pin_mux asp_power_en[] = { + {OFFSET (mcasp0_aclkx), (MODE (7 ) |PULLUP_EN )}, + {-1 }, +}; + +static struct module_pin_mux switch_off_3v6_pin_mux[] = { + {OFFSET (mii1_txd0), (MODE (7 ) |PULLUP_EN )}, +/* +* The uart1 lines are made floating inputs, based on the Guardian +* A2 Sample Power Supply Schematics +*/ + {OFFSET (uart1_rxd), (MODE (7 ) |PULLUDDIS )}, + {OFFSET (uart1_txd), (MODE (7 ) |PULLUDDIS )}, + {-1 }, +}; + +#ifdef CONFIG_NAND +static struct module_pin_mux nand_pin_mux[] = { + {OFFSET (gpmc_ad0), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad1), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad2), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad3), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad4), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad5), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad6), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad7), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT + {OFFSET (gpmc_ad8), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad9), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad10), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad11), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad12), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad13), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad14), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad15), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, +#endif + {OFFSET (gpmc_wait0), (MODE (0 ) |PULLUP_EN |RXACTIVE )}, + {OFFSET (gpmc_wpn), (MODE (7 ) |PULLUP_EN )}, + {OFFSET (gpmc_csn0), (MODE (0 ) |PULLUP_EN )}, + {OFFSET (gpmc_wen), (MODE (0 ) |PULLDOWN_EN )}, + {OFFSET (gpmc_oen_ren), (MODE (0 ) |PULLDOWN_EN )}, + {OFFSET (gpmc_advn_ale), (MODE (0 ) |PULLDOWN_EN )}, + {OFFSET (gpmc_be0n_cle), (MODE (0 ) |PULLDOWN_EN )}, + {-1 }, +}; +#endif + +void enable_uart0_pin_mux (void ) +{ +configure_module_pin_mux (uart0_pin_mux); +} + +void enable_i2c0_pin_mux (void ) +{ +configure_module_pin_mux (i2c0_pin_mux); +}
board/bosch/guardian/mux.c line 99
Quoted 10 lines
board/bosch/guardian/mux.c new file +10
-0+ +void enable_board_pin_mux (void ) +{ +#ifdef CONFIG_NAND +configure_module_pin_mux (nand_pin_mux); +#endif +configure_module_pin_mux (adc_voltages_en); +configure_module_pin_mux (asp_power_en); +configure_module_pin_mux (switch_off_3v6_pin_mux); +}
regards, Felix
PATCH v2 3/3 am335x, guardian: Add support for the bosch guardian board
In reply to Martyn WelchOn 22.02.19 18:52, Martyn Welch wrote:
Same post as some minutes ago but with correct sender, sorry.
Quoted 56 lines
From: Sjoerd Simons <[email protected]>
Add support for the Bosch Guardian board.
CPU : AM335X-GP rev 2.1 Model: Bosch AM335x Guardian I2C: ready DRAM: 256 MiB NAND: 512 MiB MMC: OMAP SD/MMC: 0Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Martyn Welch <[email protected]>---
Changes in v2:
- Correct guard #ifdef naming in board config header
- Remove missed cruft from board filesarch/arm/Kconfig | 1 + arch/arm/dts/am335x-guardian-u-boot.dtsi | 66 +++ arch/arm/dts/am335x-guardian.dts | 511 +++++++++++++++++++++++ arch/arm/mach-omap2/am33xx/Kconfig | 7 + board/bosch/guardian/Kconfig | 15 + board/bosch/guardian/MAINTAINERS | 6 + board/bosch/guardian/Makefile | 12 + board/bosch/guardian/board.c | 186 +++++++++ board/bosch/guardian/board.h | 17 + board/bosch/guardian/mux.c | 99 +++++ configs/am335x_guardian_defconfig | 90 ++++ include/configs/am335x_guardian.h | 111 +++++ 12 files changed, 1121 insertions(+) create mode 100644 arch/arm/dts/am335x-guardian-u-boot.dtsi create mode 100644 arch/arm/dts/am335x-guardian.dts create mode 100644 board/bosch/guardian/Kconfig create mode 100644 board/bosch/guardian/MAINTAINERS create mode 100644 board/bosch/guardian/Makefile create mode 100644 board/bosch/guardian/board.c create mode 100644 board/bosch/guardian/board.h create mode 100644 board/bosch/guardian/mux.c create mode 100644 configs/am335x_guardian_defconfig create mode 100644 include/configs/am335x_guardian.harch/arm/Kconfig +1
-0@@ -1524,6 +1524,7 @@ source "arch/arm/cpu/armv8/Kconfig" source "arch/arm/mach-imx/Kconfig" source "board/bosch/shc/Kconfig" +source "board/bosch/guardian/Kconfig" source "board/CarMediaLab/flea3/Kconfig" source "board/Marvell/aspenite/Kconfig" source "board/Marvell/gplugd/Kconfig"
[...]
Quoted 31 lines
arch/arm/dts/am335x-guardian.dts new file +25
-0@@ -0,0 +1,511 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (C) 2018 Robert Bosch Power Tools GmbH + */ +/dts-v1/; + +#include "am33xx.dtsi" +#include <dt-bindings/input/input.h> +#include <dt-bindings/interrupt-controller/irq.h> + +/ { + model = "Bosch AM335x Guardian"; + compatible = "bosch,am335x-guardian", "ti,am33xx"; + + chosen { + stdout-path = &uart0; + tick-timer = &timer2; + }; + + cpus { + cpu at 0 { + cpu0-supply = <&dcdc2_reg>; + }; + };
arch/arm/dts/am335x-guardian.dts line 35
Quoted 10 lines
arch/arm/dts/am335x-guardian.dts new file +10
-0+ + memory at 80000000 { + device_type = "memory"; + reg = <0x80000000 0x10000000>; /* 256 MB */ + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>;
The properties #address-cells and #size-cells can be removed as the only child node does not have a reg property.
Quoted 31 lines
arch/arm/dts/am335x-guardian.dts new file +31
-0+ pinctrl-names = "default"; + pinctrl-0 = <&gpio_keys_pins>; + + button21 { + label = "guardian-power-button"; + linux,code = <KEY_POWER>; + gpios = <&gpio2 21 0>; + wakeup-source; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&leds_pins>; + + led1 { + label = "green:heartbeat"; + gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + default-state = "off"; + }; + + led2 { + label = "green:mmc0"; + gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mmc0"; + default-state = "off"; + }; + }; +
[...]
Quoted 33 lines
board/bosch/guardian/board.c new file +27
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* board.c +* +* Board functions for Bosch Guardian +* +* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ +* Copyright (C) 2018 Robert Bosch Power Tools GmbH +*/ + +#include <common.h> +#include <errno.h> +#include <spl.h> +#include <asm/arch/cpu.h> +#include <asm/arch/hardware.h> +#include <asm/arch/omap.h> +#include <asm/arch/ddr_defs.h> +#include <asm/arch/clock.h> +#include <asm/arch/gpio.h> +#include <asm/arch/mmc_host_def.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/mem.h> +#include <asm/io.h> +#include <asm/emif.h> +#include <asm/gpio.h> +#include <dm.h> +#include <i2c.h>
board/bosch/guardian/board.c line 37
Quoted 10 lines
board/bosch/guardian/board.c new file +10
-0+#include <miiphy.h> +#include <cpsw.h> +#include <panel.h> +#include <power/tps65217.h> +#include <power/tps65910.h> +#include <environment.h> +#include <watchdog.h> +#include <environment.h> +#include "board.h" +
The suggested order of include files is:
<common.h>
<others.h>
<asm/...>
<arch/arm/...>
<linux/...>
"local.h"
Quoted 184 lines
board/bosch/guardian/board.c new file +149
-0+DECLARE_GLOBAL_DATA_PTR ; + +#ifndef CONFIG_SKIP_LOWLEVEL_INIT +static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE ; + +static const struct ddr_data ddr3_data = { + .datardsratio0 =MT41K128M16JT125K_RD_DQS , + .datawdsratio0 =MT41K128M16JT125K_WR_DQS , + .datafwsratio0 =MT41K128M16JT125K_PHY_FIFO_WE , + .datawrsratio0 =MT41K128M16JT125K_PHY_WR_DATA , +}; + +static const struct cmd_control ddr3_cmd_ctrl_data = { + .cmd0csratio =MT41K128M16JT125K_RATIO , + .cmd0iclkout =MT41K128M16JT125K_INVERT_CLKOUT , + + .cmd1csratio =MT41K128M16JT125K_RATIO , + .cmd1iclkout =MT41K128M16JT125K_INVERT_CLKOUT , + + .cmd2csratio =MT41K128M16JT125K_RATIO , + .cmd2iclkout =MT41K128M16JT125K_INVERT_CLKOUT , +}; + +static struct emif_regs ddr3_emif_reg_data = { + .sdram_config =MT41K128M16JT125K_EMIF_SDCFG , + .ref_ctrl =MT41K128M16JT125K_EMIF_SDREF , + .sdram_tim1 =MT41K128M16JT125K_EMIF_TIM1 , + .sdram_tim2 =MT41K128M16JT125K_EMIF_TIM2 , + .sdram_tim3 =MT41K128M16JT125K_EMIF_TIM3 , + .zq_config =MT41K128M16JT125K_ZQ_CFG , + .emif_ddr_phy_ctlr_1 =MT41K128M16JT125K_EMIF_READ_LATENCY , +}; + +#define OSC (V_OSCK / 1000000) +const struct dpll_params dpll_ddr = { +400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; + +void am33xx_spl_board_init (void ) +{ +int mpu_vdd; +int usb_cur_lim; + +/* Get the frequency */ + dpll_mpu_opp100.m =am335x_get_efuse_mpu_max_freq (cdev); + +if (i2c_probe (TPS65217_CHIP_PM )) +return ; + +/* +* Increase USB current limit to 1300mA or 1800mA and set +* the MPU voltage controller as needed. +*/ +if (dpll_mpu_opp100.m ==MPUPLL_M_1000 ) { + usb_cur_lim =TPS65217_USB_INPUT_CUR_LIMIT_1800MA ; + mpu_vdd =TPS65217_DCDC_VOLT_SEL_1325MV ; + }else { + usb_cur_lim =TPS65217_USB_INPUT_CUR_LIMIT_1300MA ; + mpu_vdd =TPS65217_DCDC_VOLT_SEL_1275MV ; + } + +if (tps65217_reg_write (TPS65217_PROT_LEVEL_NONE , +TPS65217_POWER_PATH , + usb_cur_lim, +TPS65217_USB_INPUT_CUR_LIMIT_MASK )) +puts ("tps65217_reg_write failure\n" ); + +/* Set DCDC3 (CORE) voltage to 1.125V */ +if (tps65217_voltage_update (TPS65217_DEFDCDC3 , +TPS65217_DCDC_VOLT_SEL_1125MV )) { +puts ("tps65217_voltage_update failure\n" ); +return ; + } + +/* Set CORE Frequencies to OPP100 */ +do_setup_dpll (&dpll_core_regs, &dpll_core_opp100); + +/* Set DCDC2 (MPU) voltage */ +if (tps65217_voltage_update (TPS65217_DEFDCDC2 , mpu_vdd)) { +puts ("tps65217_voltage_update failure\n" ); +return ; + } + +/* +* Set LDO3 to 1.8V and LDO4 to 3.3V +*/ +if (tps65217_reg_write (TPS65217_PROT_LEVEL_2 , +TPS65217_DEFLS1 , +TPS65217_LDO_VOLTAGE_OUT_1_8 , +TPS65217_LDO_MASK )) +puts ("tps65217_reg_write failure\n" ); + +if (tps65217_reg_write (TPS65217_PROT_LEVEL_2 , +TPS65217_DEFLS2 , +TPS65217_LDO_VOLTAGE_OUT_3_3 , +TPS65217_LDO_MASK )) +puts ("tps65217_reg_write failure\n" ); + +/* Set MPU Frequency to what we detected now that voltages are set */ +do_setup_dpll (&dpll_mpu_regs, &dpll_mpu_opp100); +} + +const struct dpll_params *get_dpll_ddr_params (void ) +{ +enable_i2c0_pin_mux (); +i2c_init (CONFIG_SYS_OMAP24_I2C_SPEED ,CONFIG_SYS_OMAP24_I2C_SLAVE ); + +return &dpll_ddr; +} + +void set_uart_mux_conf (void ) +{ +enable_uart0_pin_mux (); +} + +void set_mux_conf_regs (void ) +{ +enable_board_pin_mux (); +} + +const struct ctrl_ioregs ioregs = { + .cm0ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .cm1ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .cm2ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .dt0ioctl =MT41K128M16JT125K_IOCTRL_VALUE , + .dt1ioctl =MT41K128M16JT125K_IOCTRL_VALUE , +}; + +void sdram_init (void ) +{ +config_ddr (400 , &ioregs, + &ddr3_data, + &ddr3_cmd_ctrl_data, + &ddr3_emif_reg_data,0 ); +} +#endif + +int board_init (void ) +{ +#if defined(CONFIG_HW_WATCHDOG ) +hw_watchdog_init (); +#endif + + gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; + +#ifdef CONFIG_NAND +gpmc_init (); +#endif +return 0 ; +}board/bosch/guardian/board.h new file +17
-0@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* board.h +* +* Board header for Bosch Guardian +* +* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ +* Copyright (C) 2018 Robert Bosch Power Tools GmbH +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +void enable_uart0_pin_mux (void ); +void enable_i2c0_pin_mux (void ); +void enable_board_pin_mux (void ); +#endif board/bosch/guardian/mux.c new file +6
-0@@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* mux.c +* +* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ +* Copyright (C) 2018 Robert Bosch Power Tools GmbH
board/bosch/guardian/mux.c line 16
Quoted 10 lines
board/bosch/guardian/mux.c new file +10
-0+*/ + +#include <common.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/hardware.h> +#include <asm/arch/mux.h> +#include <asm/io.h> +#include <i2c.h> +#include "board.h" +
Order of include files (same as above).
Quoted 73 lines
board/bosch/guardian/mux.c new file +73
-0+static struct module_pin_mux uart0_pin_mux[] = { + {OFFSET (uart0_rxd), (MODE (0 ) |PULLUP_EN |RXACTIVE )}, + {OFFSET (uart0_txd), (MODE (0 ) |PULLUDEN )}, + {-1 }, +}; + +static struct module_pin_mux i2c0_pin_mux[] = { + {OFFSET (i2c0_sda), (MODE (0 ) |RXACTIVE |PULLUDEN |SLEWCTRL )}, + {OFFSET (i2c0_scl), (MODE (0 ) |RXACTIVE |PULLUDEN |SLEWCTRL )}, + {-1 }, +}; + +static struct module_pin_mux adc_voltages_en[] = { + {OFFSET (mcasp0_ahclkx), (MODE (7 ) |PULLUP_EN )}, + {-1 }, +}; + +static struct module_pin_mux asp_power_en[] = { + {OFFSET (mcasp0_aclkx), (MODE (7 ) |PULLUP_EN )}, + {-1 }, +}; + +static struct module_pin_mux switch_off_3v6_pin_mux[] = { + {OFFSET (mii1_txd0), (MODE (7 ) |PULLUP_EN )}, +/* +* The uart1 lines are made floating inputs, based on the Guardian +* A2 Sample Power Supply Schematics +*/ + {OFFSET (uart1_rxd), (MODE (7 ) |PULLUDDIS )}, + {OFFSET (uart1_txd), (MODE (7 ) |PULLUDDIS )}, + {-1 }, +}; + +#ifdef CONFIG_NAND +static struct module_pin_mux nand_pin_mux[] = { + {OFFSET (gpmc_ad0), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad1), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad2), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad3), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad4), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad5), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad6), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad7), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT + {OFFSET (gpmc_ad8), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad9), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad10), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad11), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad12), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad13), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad14), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, + {OFFSET (gpmc_ad15), (MODE (0 ) |PULLUDDIS |RXACTIVE )}, +#endif + {OFFSET (gpmc_wait0), (MODE (0 ) |PULLUP_EN |RXACTIVE )}, + {OFFSET (gpmc_wpn), (MODE (7 ) |PULLUP_EN )}, + {OFFSET (gpmc_csn0), (MODE (0 ) |PULLUP_EN )}, + {OFFSET (gpmc_wen), (MODE (0 ) |PULLDOWN_EN )}, + {OFFSET (gpmc_oen_ren), (MODE (0 ) |PULLDOWN_EN )}, + {OFFSET (gpmc_advn_ale), (MODE (0 ) |PULLDOWN_EN )}, + {OFFSET (gpmc_be0n_cle), (MODE (0 ) |PULLDOWN_EN )}, + {-1 }, +}; +#endif + +void enable_uart0_pin_mux (void ) +{ +configure_module_pin_mux (uart0_pin_mux); +} + +void enable_i2c0_pin_mux (void ) +{ +configure_module_pin_mux (i2c0_pin_mux); +}
board/bosch/guardian/mux.c line 99
Quoted 10 lines
board/bosch/guardian/mux.c new file +10
-0+ +void enable_board_pin_mux (void ) +{ +#ifdef CONFIG_NAND +configure_module_pin_mux (nand_pin_mux); +#endif +configure_module_pin_mux (adc_voltages_en); +configure_module_pin_mux (asp_power_en); +configure_module_pin_mux (switch_off_3v6_pin_mux); +}
regards, Felix