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.

Query related to HDQ interface with BQ27545

Other Parts Discussed in Thread: BQ27000

Hi,

I am working on OMAP4470 (Kernel version is 3.0.31) and facing problem with HDQ one wire communication with BQ27545, Below are details:

1. The battery fuel gauge IC BQ27545 is inside battery pack and connected to OMAP through HDQ line.

2. I have enabled the HDQ interface by enabling below configuration:

     CONFIG_W1=y

    CONFIG_HDQ_MASTER_OMAP=y

    CONFIG_W1_SLAVE_BQ27000=y

    CONFIG_BATTERY_BQ27x00=y

    CONFIG_BATTERY_BQ27X00_PLATFORM=y

3. Below are the problems:

    a. In omap_hdq.c file in probe hardware version was showing REV 0.0, for this I modified __raw_readb() call to __raw_readl() in hdq_reg_in() function in omap_hdq.c file
        After this it is working and I am seeing REV 0.7 in logs.

    b. The irq was initially failing (IRQ -58) because irq 58 is used for mailbox and HDQ.

        What is required to do this? I have opened IRQ-58 for HDQ is share mode. Is it correct? How we can change mailbox interrupt?

    c. The HDQ ISR is not hitting and due to this hdq_data->hdq_irqstatus flag is always zero. Also below message I found in log

                w1_master_driver w1 bus master: Family 1 for 01.000000000000.3d is not registered.

        Is there any problem?

    d. I have done below changes to configure hdq_sdi line in board file, Is it correct?

        omap_mux_init_signal("hdq_sio.hdq_sio", OMAP_MUX_MODE0 | OMAP_PIN_INPUT);


     e. After doing HDQ initialization the PRESENCEDETECT bit still shows 0 in HDQ_CTRL_STATUS register.

         Is my hdq_sio line configuration is correct?


Please help me to solve this issue and let me know if need more information to suggest on this query.

Thanks and Regards,

Raviraj

  • Hi,

    HDQ is currently no realy supported on OMAP4xxx devices. I just get OneWire working for me.
    Hint: You should use some defines based on your platform or the OMAP version for the changes .

    1. Change the resources for OMAP4xxx devices located in arch/arm/mach-omap2/devices to the following:

    static struct resource omap_hdq_resources[] = {
        {
            .start        = OMAP_HDQ_BASE,
            .end        = OMAP_HDQ_BASE + 0x1C,
            .flags        = IORESOURCE_MEM,
        },
        {
            .start        = OMAP44XX_IRQ_HDQ,
            .flags        = IORESOURCE_IRQ,
        },
    };

    2. Change the configuration of the pad located in arch/arm/mach-omap2/board-44xx-tablet to:

    static struct omap_board_mux board_mux[] __initdata = {
            OMAP4_MUX(HDQ_SIO, OMAP_MUX_MODE0 | OMAP_INPUT_EN),

    Only valid if there is an external PULL-up resistor (which is the best solution because of the electrical requirements).
    Otherwise use:
            OMAP4_MUX(HDQ_SIO, OMAP_MUX_MODE0 | OMAP_PULL_ENA | OMAP_INPUT_EN)

    3. configure and activate HDQ clocks (hdq1w_ick and hdq1w_fck) in clock44xx_data.c (seams to be done)

    4. set access to W1 registers to  __raw_readl or __raw_writel (functions  hdq_reg_in, hdq_reg_out, hdq_reg_merge)

    Regards,
    Roman

  • about 4:

    /* HDQ register I/O routines */
    static inline u8 hdq_reg_in(struct hdq_data *hdq_data, u32 offset)
    {
    return __raw_readl(hdq_data->hdq_base + offset);
    }

    static inline void hdq_reg_out(struct hdq_data *hdq_data, u32 offset, u8 val)
    {
    __raw_writel(val, hdq_data->hdq_base + offset);
    }

    static inline u8 hdq_reg_merge(struct hdq_data *hdq_data, u32 offset,
    u8 val, u8 mask)
    {
    u8 new_val = (__raw_readl(hdq_data->hdq_base + offset) & ~mask)
    | (val & mask);
    __raw_writel(new_val, hdq_data->hdq_base + offset);

    return new_val;
    }  

    LIKE THIS?