Skip to content

Commit

Permalink
msm8916: Add clocks and GPIOs for blsp1_uart1
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-gh authored and Junak committed Aug 1, 2020
1 parent 040361b commit d8b0d75
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
24 changes: 17 additions & 7 deletions platform/msm8916/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,26 @@ uint32_t gpio_status(uint32_t gpio)
return readl(GPIO_IN_OUT_ADDR(gpio)) & GPIO_IN;
}

/* Configure gpio for blsp uart 2 */
/* Configure gpio for blsp uart 1 or 2 */
void gpio_config_uart_dm(uint8_t id)
{
/* configure rx gpio */
gpio_tlmm_config(5, 2, GPIO_INPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);
if (id == 1) {
/* configure rx gpio */
gpio_tlmm_config(1, 2, GPIO_INPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);

/* configure tx gpio */
gpio_tlmm_config(4, 2, GPIO_OUTPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);
/* configure tx gpio */
gpio_tlmm_config(0, 2, GPIO_OUTPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);
} else {
/* configure rx gpio */
gpio_tlmm_config(5, 2, GPIO_INPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);

/* configure tx gpio */
gpio_tlmm_config(4, 2, GPIO_OUTPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);
}
}

void gpio_config_blsp_i2c(uint8_t blsp_id, uint8_t qup_id)
Expand Down
6 changes: 6 additions & 0 deletions platform/msm8916/include/platform/iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@

/* UART */
#define BLSP1_AHB_CBCR (CLK_CTL_BASE + 0x1008)
#define BLSP1_UART1_APPS_CBCR (CLK_CTL_BASE + 0x203C)
#define BLSP1_UART1_APPS_CMD_RCGR (CLK_CTL_BASE + 0x2044)
#define BLSP1_UART1_APPS_CFG_RCGR (CLK_CTL_BASE + 0x2048)
#define BLSP1_UART1_APPS_M (CLK_CTL_BASE + 0x204C)
#define BLSP1_UART1_APPS_N (CLK_CTL_BASE + 0x2050)
#define BLSP1_UART1_APPS_D (CLK_CTL_BASE + 0x2054)
#define BLSP1_UART2_APPS_CBCR (CLK_CTL_BASE + 0x302C)
#define BLSP1_UART2_APPS_CMD_RCGR (CLK_CTL_BASE + 0x3034)
#define BLSP1_UART2_APPS_CFG_RCGR (CLK_CTL_BASE + 0x3038)
Expand Down
32 changes: 32 additions & 0 deletions platform/msm8916/msm8916-clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,35 @@ static struct clk_freq_tbl ftbl_gcc_blsp1_2_uart1_6_apps_clk[] =
F_END
};

static struct rcg_clk blsp1_uart1_apps_clk_src =
{
.cmd_reg = (uint32_t *) BLSP1_UART1_APPS_CMD_RCGR,
.cfg_reg = (uint32_t *) BLSP1_UART1_APPS_CFG_RCGR,
.m_reg = (uint32_t *) BLSP1_UART1_APPS_M,
.n_reg = (uint32_t *) BLSP1_UART1_APPS_N,
.d_reg = (uint32_t *) BLSP1_UART1_APPS_D,

.set_rate = clock_lib2_rcg_set_rate_mnd,
.freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
.current_freq = &rcg_dummy_freq,

.c = {
.dbg_name = "blsp1_uart1_apps_clk",
.ops = &clk_ops_rcg_mnd,
},
};

static struct branch_clk gcc_blsp1_uart1_apps_clk =
{
.cbcr_reg = (uint32_t *) BLSP1_UART1_APPS_CBCR,
.parent = &blsp1_uart1_apps_clk_src.c,

.c = {
.dbg_name = "gcc_blsp1_uart1_apps_clk",
.ops = &clk_ops_branch,
},
};

static struct rcg_clk blsp1_uart2_apps_clk_src =
{
.cmd_reg = (uint32_t *) BLSP1_UART2_APPS_CMD_RCGR,
Expand Down Expand Up @@ -596,6 +625,9 @@ static struct clk_lookup msm_clocks_8916[] =
CLK_LOOKUP("sdc2_iface_clk", gcc_sdcc2_ahb_clk.c),
CLK_LOOKUP("sdc2_core_clk", gcc_sdcc2_apps_clk.c),

CLK_LOOKUP("uart1_iface_clk", gcc_blsp1_ahb_clk.c),
CLK_LOOKUP("uart1_core_clk", gcc_blsp1_uart1_apps_clk.c),

CLK_LOOKUP("uart2_iface_clk", gcc_blsp1_ahb_clk.c),
CLK_LOOKUP("uart2_core_clk", gcc_blsp1_uart2_apps_clk.c),

Expand Down

0 comments on commit d8b0d75

Please sign in to comment.