Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 81395
b: refs/heads/master
c: 59a0ea5
h: refs/heads/master
i:
  81393: d7ab3d1
  81391: 2ecfe7d
v: v3
  • Loading branch information
Anton Vorontsov authored and Kumar Gala committed Jan 28, 2008
1 parent e08ba3f commit f3d786f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0a2f82da949283027a7da6a8b2a70ada46e7b55
refs/heads/master: 59a0ea5091d309fa8338954b84cf5307dbd83ec9
46 changes: 33 additions & 13 deletions trunk/arch/powerpc/sysdev/fsl_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ phys_addr_t get_immrbase(void)

EXPORT_SYMBOL(get_immrbase);

#if defined(CONFIG_CPM2) || defined(CONFIG_8xx)
#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx)

static u32 brgfreq = -1;

Expand All @@ -100,11 +100,21 @@ u32 get_brgfreq(void)

/* Legacy device binding -- will go away when no users are left. */
node = of_find_node_by_type(NULL, "cpm");
if (!node)
node = of_find_compatible_node(NULL, NULL, "fsl,qe");
if (!node)
node = of_find_node_by_type(NULL, "qe");

if (node) {
prop = of_get_property(node, "brg-frequency", &size);
if (prop && size == 4)
brgfreq = *prop;

if (brgfreq == -1 || brgfreq == 0) {
prop = of_get_property(node, "bus-frequency", &size);
if (prop && size == 4)
brgfreq = *prop / 2;
}
of_node_put(node);
}

Expand Down Expand Up @@ -1273,22 +1283,32 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
{
struct device_node *np;
unsigned int i;
const u32 *sysclk;
u32 sysclk = -1;

/* SPI controller is either clocked from QE or SoC clock */
np = of_find_compatible_node(NULL, NULL, "fsl,qe");
if (!np)
np = of_find_node_by_type(NULL, "qe");
#ifdef CONFIG_QUICC_ENGINE
sysclk = get_brgfreq();
#endif
if (sysclk == -1) {
const u32 *freq;
int size;

if (!np)
np = of_find_node_by_type(NULL, "soc");
if (!np)
return -ENODEV;

freq = of_get_property(np, "clock-frequency", &size);
if (!freq || size != sizeof(*freq) || *freq == 0) {
freq = of_get_property(np, "bus-frequency", &size);
if (!freq || size != sizeof(*freq) || *freq == 0) {
of_node_put(np);
return -ENODEV;
}
}

if (!np)
return -ENODEV;

sysclk = of_get_property(np, "bus-frequency", NULL);
if (!sysclk)
return -ENODEV;
sysclk = *freq;
of_node_put(np);
}

for (np = NULL, i = 1;
(np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
Expand All @@ -1305,7 +1325,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,

memset(res, 0, sizeof(res));

pdata.sysclk = *sysclk;
pdata.sysclk = sysclk;

prop = of_get_property(np, "reg", NULL);
if (!prop)
Expand Down
6 changes: 1 addition & 5 deletions trunk/drivers/spi/spi_mpc83xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
mpc83xx_spi->qe_mode = pdata->qe_mode;
mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;

if (mpc83xx_spi->qe_mode)
mpc83xx_spi->spibrg = pdata->sysclk / 2;
else
mpc83xx_spi->spibrg = pdata->sysclk;
mpc83xx_spi->spibrg = pdata->sysclk;

mpc83xx_spi->rx_shift = 0;
mpc83xx_spi->tx_shift = 0;
Expand Down

0 comments on commit f3d786f

Please sign in to comment.