Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
platform: fsm9010: Bring up on ASIC
Browse files Browse the repository at this point in the history
- Enable SDHC controller at 200 MHz
- Enable UART
- Enable USB3 with HS PHY
- Fixed memory map

Change-Id: If655edbc2e7a6c1e6f55c1ac8299046621e47d7e
  • Loading branch information
Channagoud Kadabi committed Jan 23, 2015
1 parent 77ec803 commit 196b27c
Show file tree
Hide file tree
Showing 10 changed files with 474 additions and 82 deletions.
87 changes: 76 additions & 11 deletions platform/fsm9010/acpuclock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -149,14 +149,14 @@ void clock_config_mmc(uint32_t interface, uint32_t freq)
}
else
{
dprintf(CRITICAL, "sdc frequency (%d) is not supported\n", freq);
dprintf(CRITICAL, "sdc frequency (%u) is not supported\n", freq);
ret = 0;
ASSERT(0);
}


if(ret)
{
dprintf(CRITICAL, "failed to set sdc1_core_clk ret = %d\n", ret);
dprintf(CRITICAL, "failed to set sdc%u_core_clk ret = %d\n", interface, ret);
ASSERT(0);
}

Expand All @@ -170,21 +170,23 @@ void clock_config_mmc(uint32_t interface, uint32_t freq)
void clock_config_uart_dm(uint8_t id)
{
int ret;
char str[256];
char iclk[64];
char cclk[64];

snprintf(iclk, sizeof(iclk), "uart%u_iface_clk", id);
snprintf(cclk, sizeof(cclk), "uart%u_core_clk", id);

sprintf(str, "uart%d_iface_clk", id);
ret = clk_get_set_enable(str, 0, 1);
ret = clk_get_set_enable(iclk, 0, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set uart2_iface_clk ret = %d\n", ret);
dprintf(CRITICAL, "failed to set uart%u_iface_clk ret = %d\n", id, ret);
ASSERT(0);
}

sprintf(str, "uart%d_core_clk", id);
ret = clk_get_set_enable(str, 7372800, 1);
ret = clk_get_set_enable(cclk, 7372800, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set uart1_core_clk ret = %d\n", ret);
dprintf(CRITICAL, "failed to set uart%u_core_clk ret = %d\n", id, ret);
ASSERT(0);
}
}
Expand Down Expand Up @@ -343,3 +345,66 @@ void clock_config_blsp_i2c(uint8_t blsp_id, uint8_t qup_id)
return;
}
}

/* enables usb30 clocks */
void clock_usb30_init(void)
{
int ret;

ret = clk_get_set_enable("usb30_iface_clk", 0, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set usb30_iface_clk. ret = %d\n", ret);
ASSERT(0);
}

ret = clk_get_set_enable("usb30_master_clk", 125000000, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set usb30_master_clk. ret = %d\n", ret);
ASSERT(0);
}

ret = clk_get_set_enable("usb30_phy_aux_clk", 1200000, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set usb30_phy_aux_clk. ret = %d\n", ret);
ASSERT(0);
}

ret = clk_get_set_enable("usb30_mock_utmi_clk", 60000000, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set usb30_mock_utmi_clk ret = %d\n", ret);
ASSERT(0);
}

ret = clk_get_set_enable("usb30_sleep_clk", 0, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set usb30_sleep_clk ret = %d\n", ret);
ASSERT(0);
}

ret = clk_get_set_enable("usb_phy_cfg_ahb2phy_clk", 0, 1);
if(ret)
{
dprintf(CRITICAL, "failed to enable usb_phy_cfg_ahb2phy_clk = %d\n", ret);
ASSERT(0);
}
}

void clock_bumpup_pipe3_clk()
{
int ret = 0;

ret = clk_get_set_enable("usb30_pipe_clk", 0, 1);
if(ret)
{
dprintf(CRITICAL, "failed to set usb30_pipe_clk. ret = %d\n", ret);
ASSERT(0);
}

return;
}

172 changes: 171 additions & 1 deletion platform/fsm9010/fsm9010-clock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -49,6 +49,11 @@ struct clk_freq_tbl rcg_dummy_freq = F_END;


/* Clock Operations */
static struct clk_ops clk_ops_rst =
{
.reset = clock_lib2_reset_clk_reset,
};

static struct clk_ops clk_ops_branch =
{
.enable = clock_lib2_branch_clk_enable,
Expand Down Expand Up @@ -357,6 +362,160 @@ static struct branch_clk gcc_usb_hs_ahb_clk =
},
};

/* USB30 Clocks */

static struct branch_clk gcc_sys_noc_usb30_axi_clk = {
.cbcr_reg = (uint32_t *) GCC_SYS_NOC_USB3_AXI_CBCR,
.has_sibling = 1,

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

static struct branch_clk gcc_usb2b_phy_sleep_clk = {
.cbcr_reg = (uint32_t *) GCC_USB2A_PHY_SLEEP_CBCR,
.bcr_reg = (uint32_t *) GCC_USB2A_PHY_BCR,
.has_sibling = 1,

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

static struct clk_freq_tbl ftbl_gcc_usb30_master_clk[] = {
F( 125000000, gpll0, 1, 5, 24),
F_END
};

static struct rcg_clk usb30_master_clk_src = {
.cmd_reg = (uint32_t *) GCC_USB30_MASTER_CMD_RCGR,
.cfg_reg = (uint32_t *) GCC_USB30_MASTER_CFG_RCGR,
.m_reg = (uint32_t *) GCC_USB30_MASTER_M,
.n_reg = (uint32_t *) GCC_USB30_MASTER_N,
.d_reg = (uint32_t *) GCC_USB30_MASTER_D,

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

.c = {
.dbg_name = "usb30_master_clk_src",
.ops = &clk_ops_rcg,
},
};

static struct branch_clk gcc_usb30_master_clk = {
.cbcr_reg = (uint32_t *) GCC_USB30_MASTER_CBCR,
.bcr_reg = (uint32_t *) GCC_USB30_BCR,
.parent = &usb30_master_clk_src.c,

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

static struct clk_freq_tbl ftbl_gcc_usb30_mock_utmi_clk_src[] = {
F( 60000000, gpll0, 10, 0, 0),
F_END
};

static struct rcg_clk usb30_mock_utmi_clk_src = {
.cmd_reg = (uint32_t *) GCC_USB30_MOCK_UTMI_CMD_RCGR,
.cfg_reg = (uint32_t *) GCC_USB30_MOCK_UTMI_CFG_RCGR,
.set_rate = clock_lib2_rcg_set_rate_hid,
.freq_tbl = ftbl_gcc_usb30_mock_utmi_clk_src,
.current_freq = &rcg_dummy_freq,

.c = {
.dbg_name = "usb30_mock_utmi_clk_src",
.ops = &clk_ops_rcg,
},
};

static struct branch_clk gcc_usb30_mock_utmi_clk = {
.cbcr_reg = (uint32_t *) GCC_USB30_MOCK_UTMI_CBCR,
.has_sibling = 0,
.parent = &usb30_mock_utmi_clk_src.c,

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

static struct branch_clk gcc_usb30_sleep_clk = {
.cbcr_reg = (uint32_t *) GCC_USB30_SLEEP_CBCR,
.has_sibling = 1,

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

static struct clk_freq_tbl ftbl_gcc_usb30_phy_aux_clk_src[] = {
F( 1200000, cxo, 16, 0, 0),
F_END
};

static struct rcg_clk usb30_phy_aux_clk_src = {
.cmd_reg = (uint32_t *) GCC_USB3_PHY_AUX_CMD_RCGR,
.cfg_reg = (uint32_t *) GCC_USB3_PHY_AUX_CFG_RCGR,
.set_rate = clock_lib2_rcg_set_rate_hid,
.freq_tbl = ftbl_gcc_usb30_phy_aux_clk_src,
.current_freq = &rcg_dummy_freq,

.c = {
.dbg_name = "usb30_phy_aux_clk_src",
.ops = &clk_ops_rcg,
},
};

static struct branch_clk gcc_usb30_phy_aux_clk = {
.cbcr_reg = (uint32_t *) GCC_USB3_PHY_AUX_CBCR,
.has_sibling = 0,
.parent = &usb30_phy_aux_clk_src.c,

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

static struct branch_clk gcc_usb30_pipe_clk = {
.bcr_reg = (uint32_t *) GCC_USB3_PHY_PHY_BCR,
.cbcr_reg = (uint32_t *) GCC_USB3_PHY_PIPE_CBCR,
.has_sibling = 1,

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

static struct reset_clk gcc_usb30_phy_reset = {
.bcr_reg = (uint32_t ) GCC_USB3_PHY_BCR,

.c = {
.dbg_name = "usb30_phy_reset",
.ops = &clk_ops_rst,
},
};

static struct branch_clk gcc_usb_phy_cfg_ahb2phy_clk = {
.cbcr_reg = (uint32_t *) GCC_USB_HS_PHY_CFG_AHB_CBCR,
.has_sibling = 1,

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

/* CE Clocks */
static struct clk_freq_tbl ftbl_gcc_ce2_clk[] = {
F( 50000000, gpll0, 12, 0, 0),
Expand Down Expand Up @@ -481,6 +640,17 @@ static struct clk_lookup msm_clocks_fsm9010[] =
CLK_LOOKUP("usb_iface_clk", gcc_usb_hs_ahb_clk.c),
CLK_LOOKUP("usb_core_clk", gcc_usb_hs_system_clk.c),

CLK_LOOKUP("usb2b_phy_sleep_clk", gcc_usb2b_phy_sleep_clk.c),
CLK_LOOKUP("usb30_master_clk", gcc_usb30_master_clk.c),
CLK_LOOKUP("usb30_iface_clk", gcc_sys_noc_usb30_axi_clk.c),
CLK_LOOKUP("usb30_mock_utmi_clk", gcc_usb30_mock_utmi_clk.c),
CLK_LOOKUP("usb30_sleep_clk", gcc_usb30_sleep_clk.c),
CLK_LOOKUP("usb30_phy_aux_clk", gcc_usb30_phy_aux_clk.c),
CLK_LOOKUP("usb30_pipe_clk", gcc_usb30_pipe_clk.c),
CLK_LOOKUP("usb30_phy_reset", gcc_usb30_phy_reset.c),

CLK_LOOKUP("usb_phy_cfg_ahb2phy_clk", gcc_usb_phy_cfg_ahb2phy_clk.c),

CLK_LOOKUP("ce2_ahb_clk", gcc_ce2_ahb_clk.c),
CLK_LOOKUP("ce2_axi_clk", gcc_ce2_axi_clk.c),
CLK_LOOKUP("ce2_core_clk", gcc_ce2_clk.c),
Expand Down
19 changes: 10 additions & 9 deletions platform/fsm9010/gpio.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -57,23 +57,24 @@ void gpio_config_uart_dm(uint8_t id)
static struct {
unsigned int gpio_tx;
unsigned int gpio_rx;
unsigned int function;
} gpio_table[] = {
{ 12, 13 },
{ 4, 5 },
{ 8, 6 },
{ 10, 11 },
{ 8, 6, 3 },
{ 4, 5, 2 },
{ 12, 13, 2 },
{ 10, 11, 1 },
};

if (id >= ARRAY_SIZE(gpio_table))
return;

/* configure rx gpio */
gpio_tlmm_config(gpio_table[id].gpio_rx, 2, GPIO_INPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);
gpio_tlmm_config(gpio_table[id].gpio_rx, gpio_table[id].function,
GPIO_INPUT, GPIO_NO_PULL, GPIO_8MA, GPIO_DISABLE);

/* configure tx gpio */
gpio_tlmm_config(gpio_table[id].gpio_tx, 2, GPIO_OUTPUT, GPIO_NO_PULL,
GPIO_8MA, GPIO_DISABLE);
gpio_tlmm_config(gpio_table[id].gpio_tx, gpio_table[id].function,
GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA, GPIO_DISABLE);
}

void gpio_config_blsp_i2c(uint8_t blsp_id, uint8_t qup_id)
Expand Down
5 changes: 3 additions & 2 deletions platform/fsm9010/include/platform/clock.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -32,7 +32,7 @@
#include <clock.h>
#include <clock_lib2.h>

#define UART_DM_CLK_RX_TX_BIT_RATE 0x99
#define UART_DM_CLK_RX_TX_BIT_RATE 0xcc

void platform_clock_init(void);

Expand All @@ -43,5 +43,6 @@ void hsusb_clock_init(void);
void clock_config_ce(uint8_t instance);
void clock_ce_enable(uint8_t instance);
void clock_ce_disable(uint8_t instance);
void clock_usb30_init(void);

#endif
Loading

0 comments on commit 196b27c

Please sign in to comment.