Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/arch/arm/cpu/armv7/am33xx/clock_am33xx.c b/arch/arm/cpu/armv7/am33xx/clock_am33xx.c
- index 92142c8..8724366 100644
- --- a/arch/arm/cpu/armv7/am33xx/clock_am33xx.c
- +++ b/arch/arm/cpu/armv7/am33xx/clock_am33xx.c
- @@ -147,6 +147,7 @@ void enable_basic_clocks(void)
- &cmper->i2c1clkctrl,
- &cmper->cpgmac0clkctrl,
- &cmper->spi0clkctrl,
- + &cmper->spi1clkctrl,
- &cmrtc->rtcclkctrl,
- &cmper->usb0clkctrl,
- &cmper->emiffwclkctrl,
- diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
- index 49d95cf..c8d4aed 100644
- --- a/board/ti/am335x/board.c
- +++ b/board/ti/am335x/board.c
- @@ -24,6 +24,7 @@
- #include <asm/emif.h>
- #include <asm/gpio.h>
- #include <i2c.h>
- +#include <spi.h>
- #include <miiphy.h>
- #include <cpsw.h>
- #include <power/tps65217.h>
- @@ -37,6 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
- /* GPIO that controls power to DDR on EVM-SK */
- #define GPIO_DDR_VTT_EN 7
- +#define GPIO_ENABLE_PIN 20
- #if defined(CONFIG_SPL_BUILD) || \
- (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_DM_ETH))
- @@ -229,6 +231,13 @@ void am33xx_spl_board_init(void)
- if (read_eeprom(&header) < 0)
- puts("Could not get board ID.\n");
- +#ifdef CONFIG_DISABLE_REPLICAPE_STEPPERS
- + enable_spi1_pin_mux();
- +#endif
- +
- +#ifdef CONFIG_REPLICAPE_SET_DISABLE_PIN
- + enable_enable_pin_mux();
- +#endif
- /* Get the frequency */
- dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
- @@ -476,6 +485,49 @@ void sdram_init(void)
- }
- #endif
- +
- +/* Disable steppers from u-boot*/
- +#ifdef CONFIG_DISABLE_REPLICAPE_STEPPERS
- +void spi_disable_steppers(void){
- + struct spi_slave *slave;
- + int ret = 0;
- + int bus = 1;
- + int cs = 1;
- + int mode = 0;
- + int bitlen = 40;
- +
- + uchar dout[5] = {0xFF};
- + uchar din[5] = {0xFF};
- +
- + printf("Replicape steppers disabled\n");
- +
- + slave = spi_setup_slave(bus, cs, 1000000, mode);
- + if (!slave) {
- + printf("Invalid device %d:%d\n", bus, cs);
- + return;
- + }
- +
- + ret = spi_claim_bus(slave);
- + if (ret)
- + goto done;
- + ret = spi_xfer(slave, bitlen, dout, din,
- + SPI_XFER_BEGIN | SPI_XFER_END);
- + if (ret) {
- + printf("Error %d during SPI transaction\n", ret);
- + }
- +done:
- + spi_release_bus(slave);
- +}
- +#endif
- +
- +#ifdef CONFIG_REPLICAPE_SET_DISABLE_PIN
- +void set_enable_pin(void){
- + printf("Replicape enable pin set high\n");
- + gpio_request(GPIO_ENABLE_PIN, "gpio_enable_pin");
- + gpio_direction_output(GPIO_ENABLE_PIN, 1);
- +}
- +#endif
- +
- /*
- * Basic board specific setup. Pinmux has been handled already.
- */
- @@ -483,6 +535,12 @@ int board_init(void)
- {
- u32 sys_reboot;
- +#ifdef CONFIG_DISABLE_REPLICAPE_STEPPERS
- + spi_disable_steppers();
- +#endif
- +#ifdef CONFIG_REPLICAPE_SET_DISABLE_PIN
- + set_enable_pin();
- +#endif
- sys_reboot = readl(PRM_RSTST);
- if (sys_reboot & (1 << 9))
- puts("Reset Source: IcePick reset has occurred.\n");
- diff --git a/board/ti/am335x/board.h b/board/ti/am335x/board.h
- index bc700d5..d83fcb9 100644
- --- a/board/ti/am335x/board.h
- +++ b/board/ti/am335x/board.h
- @@ -73,5 +73,8 @@ void enable_uart3_pin_mux(void);
- void enable_uart4_pin_mux(void);
- void enable_uart5_pin_mux(void);
- void enable_i2c0_pin_mux(void);
- +#ifdef CONFIG_DISABLE_REPLICAPE_STEPPERS
- +void enable_spi1_pin_mux(void);
- +#endif
- void enable_board_pin_mux(struct am335x_baseboard_id *header);
- #endif
- diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
- index 79ed02f..007215e 100644
- --- a/board/ti/am335x/mux.c
- +++ b/board/ti/am335x/mux.c
- @@ -129,6 +129,21 @@ static struct module_pin_mux spi0_pin_mux[] = {
- {-1},
- };
- +static struct module_pin_mux spi1_pin_mux[] = {
- + {OFFSET(mcasp0_aclkx), (MODE(3) | RXACTIVE | PULLUDEN)}, /* SPI1_SCLK */
- + {OFFSET(mcasp0_fsx), (MODE(3) | RXACTIVE | PULLUDEN | PULLUP_EN)}, /* SPI1_D0 */
- + {OFFSET(mcasp0_axr0), (MODE(3) | RXACTIVE | PULLUDEN)}, /* SPI1_D1 */
- + {OFFSET(ecap0_in_pwm0_out), (MODE(2) | RXACTIVE | PULLUDEN | PULLUP_EN)}, /* SPI1_CS1 */
- + {-1},
- +};
- +
- +static struct module_pin_mux enable_pin_mux[] = {
- + {OFFSET(xdma_event_intr1), (MODE(7) | RXACTIVE | PULLUDEN)}, /* ENABLE */
- + {-1},
- +};
- +
- +
- +
- static struct module_pin_mux gpio0_7_pin_mux[] = {
- {OFFSET(ecap0_in_pwm0_out), (MODE(7) | PULLUDEN)}, /* GPIO0_7 */
- {-1},
- @@ -278,6 +293,16 @@ void enable_i2c0_pin_mux(void)
- configure_module_pin_mux(i2c0_pin_mux);
- }
- +void enable_spi1_pin_mux(void)
- +{
- + configure_module_pin_mux(spi1_pin_mux);
- +}
- +
- +void enable_enable_pin_mux(void)
- +{
- + configure_module_pin_mux(enable_pin_mux);
- +}
- +
- /*
- * The AM335x GP EVM, if daughter card(s) are connected, can have 8
- * different profiles. These profiles determine what peripherals are
- diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
- index e3402c4..e9d623f 100644
- --- a/include/configs/am335x_evm.h
- +++ b/include/configs/am335x_evm.h
- @@ -18,6 +18,8 @@
- #include <configs/ti_am335x_common.h>
- #define CONFIG_ENV_IS_NOWHERE
- +#define CONFIG_DISABLE_REPLICAPE_STEPPERS
- +#define CONFIG_REPLICAPE_SET_DISABLE_PIN
- /* Don't override the distro default bootdelay */
- #undef CONFIG_BOOTDELAY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement