static char __init *ar5312_flash_limit(void)
{
u32 ctl;
- /*
+ /*
* Configure flash bank 0.
* Assume 8M window size. Flash will be aliased if it's smaller
*/
(sysRegRead(AR531X_FLASHCTL0) & FLASHCTL_MW);
sysRegWrite(AR531X_FLASHCTL0, ctl);
-
+
/* Disable other flash banks */
sysRegWrite(AR531X_FLASHCTL1,
sysRegRead(AR531X_FLASHCTL1) & ~(FLASHCTL_E | FLASHCTL_AC));
static struct ar531x_config __init *init_wmac(int unit)
{
struct ar531x_config *config;
-
+
config = (struct ar531x_config *) kzalloc(sizeof(struct ar531x_config), GFP_KERNEL);
config->board = board_config;
config->radio = radio_config;
return config;
}
-
+
int __init ar5312_init_devices(void)
{
struct ar531x_boarddata *bcfg;
ar531x_find_config(ar5312_flash_limit());
bcfg = (struct ar531x_boarddata *) board_config;
-
+
/*
* Chip IDs and hardware detection for some Atheros
* models are really broken!
- *
+ *
* Atheros uses a disabled WMAC0 and Silicon ID of AR5312
- * as indication for AR2312, which is otherwise
+ * as indication for AR2312, which is otherwise
* indistinguishable from the real AR5312.
*/
if (radio_config) {
/* AR2313 has CPU minor rev. 10 */
if ((current_cpu_data.processor_id & 0xff) == 0x0a)
mips_machtype = MACH_ATHEROS_AR2313;
-
+
/* AR2312 shares the same Silicon ID as AR5312 */
else if (bcfg->config & BD_ISCASPER)
mips_machtype = MACH_ATHEROS_AR2312;
-
+
/* Everything else is probably AR5312 or compatible */
else
mips_machtype = MACH_ATHEROS_AR5312;
ar5312_devs[dev++] = &ar5312_physmap_flash;
+#ifdef CONFIG_LEDS_GPIO
ar5312_leds[0].gpio = bcfg->sysLedGpio;
ar5312_devs[dev++] = &ar5312_gpio_leds;
+#endif
if (!memcmp(bcfg->enet0Mac, "\xff\xff\xff\xff\xff\xff", 6))
memcpy(bcfg->enet0Mac, bcfg->enet1Mac, 6);
5
};
-
+
static unsigned int __init ar5312_cpu_frequency(void)
{
unsigned int result;
multiplier_shift = AR5312_CLOCKCTL1_MULTIPLIER_SHIFT;
doubler_mask = AR5312_CLOCKCTL1_DOUBLER_MASK;
}
-
+
/*
* Clocking is derived from a fixed 40MHz input clock.
*
* flash, Timer, Watchdog Timer)
*
* cntFreq = cpuFreq / 2 (use for CPU count/compare)
- *
+ *
* So, for example, with a PLL multiplier of 5, we have
- *
+ *
* cpuFreq = 200MHz
* sysFreq = 50MHz
* cntFreq = 100MHz
preDivideSelect = (clockCtl1 & predivide_mask) >> predivide_shift;
preDivisor = CLOCKCTL1_PREDIVIDE_TABLE[preDivideSelect];
multiplier = (clockCtl1 & multiplier_mask) >> multiplier_shift;
-
+
if (clockCtl1 & doubler_mask) {
multiplier = multiplier << 1;
}
+ (bank1AC ? (1 << (bank1AC+1)) : 0);
memsize <<= 20;
add_memory_region(0, memsize, BOOT_MEM_RAM);
-
+
/* Initialize it to AR5312 for now. Real detection will be done
* in ar5312_init_devices() */
mips_machtype = MACH_ATHEROS_AR5312;
(1 << 4) | SPI_CTL_START;
spiflash_regwrite32(SPI_FLASH_CTL, reg);
-
+
do {
reg = spiflash_regread32(SPI_FLASH_CTL);
} while (reg & SPI_CTL_BUSY);
config->radio = radio_config;
config->unit = 0;
config->tag = (u_int16_t) (sysRegRead(AR5315_SREV) & AR5315_REV_CHIP);
-
+
ar5315_eth_data.board_config = board_config;
ar5315_eth_data.macaddr = bcfg->enet0Mac;
ar5315_wmac.dev.platform_data = config;
- ar5315_leds[0].gpio = bcfg->sysLedGpio;
-
ar5315_devs[dev++] = &ar5315_eth;
ar5315_devs[dev++] = &ar5315_wmac;
ar5315_devs[dev++] = &ar5315_spiflash;
+
+#ifdef CONFIG_LEDS_GPIO
+ ar5315_leds[0].gpio = bcfg->sysLedGpio;
ar5315_devs[dev++] = &ar5315_gpio_leds;
+#endif
return platform_add_devices(ar5315_devs, dev);
}
/* reset the system */
sysRegWrite(AR5315_COLD_RESET,AR5317_RESET_SYSTEM);
- /*
+ /*
* Cold reset does not work on the AR2315/6, use the GPIO reset bits a workaround.
*/
gpio_direction_output(AR5315_RESET_GPIO, 0);
clkDiv = 1;
break;
}
- cpuDiv = (clockCtl & CPUCLK_CLK_DIV_M) >> CPUCLK_CLK_DIV_S;
+ cpuDiv = (clockCtl & CPUCLK_CLK_DIV_M) >> CPUCLK_CLK_DIV_S;
cpuDiv = cpuDiv * 2 ?: 1;
return (pllcOut/(clkDiv * cpuDiv));
}
-
+
static inline unsigned int ar5315_cpu_frequency(void)
{
return ar5315_sys_clk(sysRegRead(AR5315_CPUCLK));