This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

in u-boot u-boot-2014.07-g7e537bf hardware Access macro

Other Parts Discussed in Thread: AM3358

Dear sir,


#define SOC_PRCM_REGS                               (0x44E00000)
#define SOC_CM_PER_REGS                          (SOC_PRCM_REGS + CM_PER_L3_CLKCTRL)
#define CM_PER_L3_CLKCTRL_MODULEMODE_ENABLE       (0x2u)


 In AM3358 uboot u-boot-2013.10-ti2013.12.01 for Hardware access we can use

 #define HWREG(x)     (*((volatile unsigned long *)(x)))  

 So we can OR AND any value example


HWREG(SOC_CM_PER_REGS + CM_PER_L3_CLKCTRL) |= CM_PER_L3_CLKCTRL_MODULEMODE_ENABLE;

(HWREG(0x44E00000 + 0) |= 0x2u));


(HWREG(SOC_CM_PER_REGS + CM_PER_L3_CLKCTRL) & CM_PER_L3_CLKCTRL_MODULEMODE));

(HWREG(0x44E00000 + 0) & 0x1u));

if want to perform such type of opration in u-boot u-boot-2014.07-g7e537bf as below MACRO

#define writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b))

then how i can perform plese elaborate this hardware access fuction with example.


Thanks & Regards,
Gautam  

  • Hi Gautam,

    You can find an example how to use readl() & writel() functions in arch/arm/cpu/armv7/am33xx/board.c file:
    regval = readl(&uart_base->uartsyscfg);
    regval |= UART_RESET;
    writel(regval, &uart_base->uartsyscfg);

    You can also use the __raw_readl() & __raw_writel() fucntions, as an example you can check the _set_gpio_direction(), _get_gpio_direction() & _set_gpio_dataout() functions in drvires/gpio/omap-gpio.c.

    Best Regards,
    Yordan