forked from Minki/linux
Davinci: jtag_id - use ioremap()
This patch replaces the jtag id base info in davinci_soc_info with a physical address which is then ioremap()ed within common code. This patch (in combination with a similar change for PSC) will allow us to eliminate the SYSCFG nastiness in DA8xx code. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
This commit is contained in:
parent
db6db5d847
commit
3347db8392
@ -37,26 +37,43 @@ void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context)
|
||||
pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
|
||||
}
|
||||
|
||||
static struct davinci_id * __init davinci_get_id(u32 jtag_id)
|
||||
static int __init davinci_init_id(struct davinci_soc_info *soc_info)
|
||||
{
|
||||
int i;
|
||||
struct davinci_id *dip;
|
||||
u8 variant = (jtag_id & 0xf0000000) >> 28;
|
||||
u16 part_no = (jtag_id & 0x0ffff000) >> 12;
|
||||
int i;
|
||||
struct davinci_id *dip;
|
||||
u8 variant;
|
||||
u16 part_no;
|
||||
void __iomem *base;
|
||||
|
||||
for (i = 0, dip = davinci_soc_info.ids; i < davinci_soc_info.ids_num;
|
||||
base = ioremap(soc_info->jtag_id_reg, SZ_4K);
|
||||
if (!base) {
|
||||
pr_err("Unable to map JTAG ID register\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
soc_info->jtag_id = __raw_readl(base);
|
||||
iounmap(base);
|
||||
|
||||
variant = (soc_info->jtag_id & 0xf0000000) >> 28;
|
||||
part_no = (soc_info->jtag_id & 0x0ffff000) >> 12;
|
||||
|
||||
for (i = 0, dip = soc_info->ids; i < soc_info->ids_num;
|
||||
i++, dip++)
|
||||
/* Don't care about the manufacturer right now */
|
||||
if ((dip->part_no == part_no) && (dip->variant == variant))
|
||||
return dip;
|
||||
if ((dip->part_no == part_no) && (dip->variant == variant)) {
|
||||
soc_info->cpu_id = dip->cpu_id;
|
||||
pr_info("DaVinci %s variant 0x%x\n", dip->name,
|
||||
dip->variant);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
pr_err("Unknown DaVinci JTAG ID 0x%x\n", soc_info->jtag_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
void __init davinci_common_init(struct davinci_soc_info *soc_info)
|
||||
{
|
||||
int ret;
|
||||
struct davinci_id *dip;
|
||||
|
||||
if (!soc_info) {
|
||||
ret = -EINVAL;
|
||||
@ -84,18 +101,9 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
|
||||
* We want to check CPU revision early for cpu_is_xxxx() macros.
|
||||
* IO space mapping must be initialized before we can do that.
|
||||
*/
|
||||
davinci_soc_info.jtag_id = __raw_readl(davinci_soc_info.jtag_id_base);
|
||||
|
||||
dip = davinci_get_id(davinci_soc_info.jtag_id);
|
||||
if (!dip) {
|
||||
ret = -EINVAL;
|
||||
pr_err("Unknown DaVinci JTAG ID 0x%x\n",
|
||||
davinci_soc_info.jtag_id);
|
||||
ret = davinci_init_id(&davinci_soc_info);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
davinci_soc_info.cpu_id = dip->cpu_id;
|
||||
pr_info("DaVinci %s variant 0x%x\n", dip->name, dip->variant);
|
||||
|
||||
if (davinci_soc_info.cpu_clks) {
|
||||
ret = davinci_clk_init(davinci_soc_info.cpu_clks);
|
||||
|
@ -1188,6 +1188,7 @@ static struct davinci_timer_info da830_timer_info = {
|
||||
static struct davinci_soc_info davinci_soc_info_da830 = {
|
||||
.io_desc = da830_io_desc,
|
||||
.io_desc_num = ARRAY_SIZE(da830_io_desc),
|
||||
.jtag_id_reg = DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
|
||||
.ids = da830_ids,
|
||||
.ids_num = ARRAY_SIZE(da830_ids),
|
||||
.cpu_clks = da830_clks,
|
||||
@ -1215,8 +1216,6 @@ void __init da830_init(void)
|
||||
if (WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module"))
|
||||
return;
|
||||
|
||||
davinci_soc_info_da830.jtag_id_base =
|
||||
DA8XX_SYSCFG0_VIRT(DA8XX_JTAG_ID_REG);
|
||||
davinci_soc_info_da830.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120);
|
||||
|
||||
davinci_common_init(&davinci_soc_info_da830);
|
||||
|
@ -1073,6 +1073,7 @@ no_ddrpll_mem:
|
||||
static struct davinci_soc_info davinci_soc_info_da850 = {
|
||||
.io_desc = da850_io_desc,
|
||||
.io_desc_num = ARRAY_SIZE(da850_io_desc),
|
||||
.jtag_id_reg = DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
|
||||
.ids = da850_ids,
|
||||
.ids_num = ARRAY_SIZE(da850_ids),
|
||||
.cpu_clks = da850_clks,
|
||||
@ -1108,8 +1109,6 @@ void __init da850_init(void)
|
||||
if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module"))
|
||||
return;
|
||||
|
||||
davinci_soc_info_da850.jtag_id_base =
|
||||
DA8XX_SYSCFG0_VIRT(DA8XX_JTAG_ID_REG);
|
||||
davinci_soc_info_da850.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120);
|
||||
|
||||
davinci_common_init(&davinci_soc_info_da850);
|
||||
|
@ -840,7 +840,7 @@ static struct platform_device dm355_serial_device = {
|
||||
static struct davinci_soc_info davinci_soc_info_dm355 = {
|
||||
.io_desc = dm355_io_desc,
|
||||
.io_desc_num = ARRAY_SIZE(dm355_io_desc),
|
||||
.jtag_id_base = IO_ADDRESS(0x01c40028),
|
||||
.jtag_id_reg = 0x01c40028,
|
||||
.ids = dm355_ids,
|
||||
.ids_num = ARRAY_SIZE(dm355_ids),
|
||||
.cpu_clks = dm355_clks,
|
||||
|
@ -1045,7 +1045,7 @@ static struct platform_device dm365_serial_device = {
|
||||
static struct davinci_soc_info davinci_soc_info_dm365 = {
|
||||
.io_desc = dm365_io_desc,
|
||||
.io_desc_num = ARRAY_SIZE(dm365_io_desc),
|
||||
.jtag_id_base = IO_ADDRESS(0x01c40028),
|
||||
.jtag_id_reg = 0x01c40028,
|
||||
.ids = dm365_ids,
|
||||
.ids_num = ARRAY_SIZE(dm365_ids),
|
||||
.cpu_clks = dm365_clks,
|
||||
|
@ -731,7 +731,7 @@ static struct platform_device dm644x_serial_device = {
|
||||
static struct davinci_soc_info davinci_soc_info_dm644x = {
|
||||
.io_desc = dm644x_io_desc,
|
||||
.io_desc_num = ARRAY_SIZE(dm644x_io_desc),
|
||||
.jtag_id_base = IO_ADDRESS(0x01c40028),
|
||||
.jtag_id_reg = 0x01c40028,
|
||||
.ids = dm644x_ids,
|
||||
.ids_num = ARRAY_SIZE(dm644x_ids),
|
||||
.cpu_clks = dm644x_clks,
|
||||
|
@ -815,7 +815,7 @@ static struct platform_device dm646x_serial_device = {
|
||||
static struct davinci_soc_info davinci_soc_info_dm646x = {
|
||||
.io_desc = dm646x_io_desc,
|
||||
.io_desc_num = ARRAY_SIZE(dm646x_io_desc),
|
||||
.jtag_id_base = IO_ADDRESS(0x01c40028),
|
||||
.jtag_id_reg = 0x01c40028,
|
||||
.ids = dm646x_ids,
|
||||
.ids_num = ARRAY_SIZE(dm646x_ids),
|
||||
.cpu_clks = dm646x_clks,
|
||||
|
@ -45,7 +45,7 @@ struct davinci_soc_info {
|
||||
unsigned long io_desc_num;
|
||||
u32 cpu_id;
|
||||
u32 jtag_id;
|
||||
void __iomem *jtag_id_base;
|
||||
u32 jtag_id_reg;
|
||||
struct davinci_id *ids;
|
||||
unsigned long ids_num;
|
||||
struct clk_lookup *cpu_clks;
|
||||
|
Loading…
Reference in New Issue
Block a user