aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x/dns323-setup.c
diff options
context:
space:
mode:
authorMatt Palmer <mpalmer@hezmatt.org>2008-10-22 04:16:36 -0400
committerNicolas Pitre <nico@cam.org>2008-12-11 16:38:56 -0500
commitf93e4159b14c5edbaae9916d42ad685aa2f927d1 (patch)
tree97e353318f529f2488ea4c38cfaf1a01940e8acd /arch/arm/mach-orion5x/dns323-setup.c
parenta93f44c1751ef1afddd4b76058fb3a2f55fe774c (diff)
[ARM] DNS323: Initialise 88F5182 correctly
The 88F5182 found in the DNS-323 rev B1 (and some other devices, such as the CH3SNAS) require different initialisation of the SATA controller and MPP registers. Tested on a DNS-323 rev B1. Signed-off-by: Matt Palmer <mpalmer@hezmatt.org>
Diffstat (limited to 'arch/arm/mach-orion5x/dns323-setup.c')
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c65
1 files changed, 61 insertions, 4 deletions
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 4053bd354766..0722d6510df1 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -21,6 +21,7 @@
21#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/ata_platform.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
25#include <asm/gpio.h> 26#include <asm/gpio.h>
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -64,9 +65,21 @@ static struct hw_pci dns323_pci __initdata = {
64 .map_irq = dns323_pci_map_irq, 65 .map_irq = dns323_pci_map_irq,
65}; 66};
66 67
68static int __init dns323_dev_id(void)
69{
70 u32 dev, rev;
71
72 orion5x_pcie_id(&dev, &rev);
73
74 return dev;
75}
76
67static int __init dns323_pci_init(void) 77static int __init dns323_pci_init(void)
68{ 78{
69 if (machine_is_dns323()) 79 /* The 5182 doesn't really use it's PCI bus, and initialising PCI
80 * gets in the way of initialising the SATA controller.
81 */
82 if (machine_is_dns323() && dns323_dev_id() != MV88F5182_DEV_ID)
70 pci_common_init(&dns323_pci); 83 pci_common_init(&dns323_pci);
71 84
72 return 0; 85 return 0;
@@ -283,10 +296,17 @@ static struct platform_device dns323_button_device = {
283 }, 296 },
284}; 297};
285 298
299/*****************************************************************************
300 * SATA
301 */
302static struct mv_sata_platform_data dns323_sata_data = {
303 .n_ports = 2,
304};
305
286/**************************************************************************** 306/****************************************************************************
287 * General Setup 307 * General Setup
288 */ 308 */
289static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = { 309static struct orion5x_mpp_mode dns323_mv88f5181_mpp_modes[] __initdata = {
290 { 0, MPP_PCIE_RST_OUTn }, 310 { 0, MPP_PCIE_RST_OUTn },
291 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ 311 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
292 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ 312 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
@@ -310,6 +330,30 @@ static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = {
310 { -1 }, 330 { -1 },
311}; 331};
312 332
333static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = {
334 { 0, MPP_UNUSED },
335 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
336 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
337 { 3, MPP_UNUSED },
338 { 4, MPP_GPIO }, /* power button LED */
339 { 5, MPP_GPIO }, /* power button LED */
340 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */
341 { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */
342 { 8, MPP_GPIO }, /* triggers power off */
343 { 9, MPP_GPIO }, /* power button switch */
344 { 10, MPP_GPIO }, /* reset button switch */
345 { 11, MPP_UNUSED },
346 { 12, MPP_SATA_LED },
347 { 13, MPP_SATA_LED },
348 { 14, MPP_SATA_LED },
349 { 15, MPP_SATA_LED },
350 { 16, MPP_UNUSED },
351 { 17, MPP_UNUSED },
352 { 18, MPP_UNUSED },
353 { 19, MPP_UNUSED },
354 { -1 },
355};
356
313/* 357/*
314 * On the DNS-323 the following devices are attached via I2C: 358 * On the DNS-323 the following devices are attached via I2C:
315 * 359 *
@@ -340,8 +384,15 @@ static void __init dns323_init(void)
340 /* Setup basic Orion functions. Need to be called early. */ 384 /* Setup basic Orion functions. Need to be called early. */
341 orion5x_init(); 385 orion5x_init();
342 386
343 orion5x_mpp_conf(dns323_mpp_modes); 387 /* Just to be tricky, the 5182 has a completely different
344 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */ 388 * set of MPP modes to the 5181.
389 */
390 if (dns323_dev_id() == MV88F5182_DEV_ID)
391 orion5x_mpp_conf(dns323_mv88f5182_mpp_modes);
392 else {
393 orion5x_mpp_conf(dns323_mv88f5181_mpp_modes);
394 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
395 }
345 396
346 /* setup flash mapping 397 /* setup flash mapping
347 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 398 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
@@ -367,6 +418,12 @@ static void __init dns323_init(void)
367 orion5x_i2c_init(); 418 orion5x_i2c_init();
368 orion5x_uart0_init(); 419 orion5x_uart0_init();
369 420
421 /* The 5182 has it's SATA controller on-chip, and needs it's own little
422 * init routine.
423 */
424 if (dns323_dev_id() == MV88F5182_DEV_ID)
425 orion5x_sata_init(&dns323_sata_data);
426
370 /* register dns323 specific power-off method */ 427 /* register dns323 specific power-off method */
371 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || 428 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
372 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) 429 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)