aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@mvista.com>2010-05-02 13:27:05 -0400
committerKumar Gala <galak@kernel.crashing.org>2010-05-17 11:55:32 -0400
commit6971df4f5b0e5b6955c03e8d51bad5d50463f98f (patch)
tree4057eb1497c8261cfdc4ada9d7fa15efa934a99c /arch
parent0aedc0085146131da5b04476aab21834b1403b31 (diff)
powerpc/83xx: Add MCU LEDs support for MPC837xRDB and MPC8315RDB boards
There are two front-panel LEDs on MPC837xRDB and MPC8315RDB boards: PWR and HDD. After adding appropriate nodes we can program these LEDs from kernel and user space. Signed-off-by: Anton Vorontsov <avorontsov@mvista.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts14
-rw-r--r--arch/powerpc/boot/dts/mpc8377_rdb.dts14
-rw-r--r--arch/powerpc/boot/dts/mpc8378_rdb.dts14
-rw-r--r--arch/powerpc/boot/dts/mpc8379_rdb.dts14
-rw-r--r--arch/powerpc/platforms/83xx/mpc831x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_rdb.c1
6 files changed, 58 insertions, 0 deletions
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 508b770d3dd6..4dd08c322979 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -463,4 +463,18 @@
463 0 0x00800000>; 463 0 0x00800000>;
464 }; 464 };
465 }; 465 };
466
467 leds {
468 compatible = "gpio-leds";
469
470 pwr {
471 gpios = <&mcu_pio 0 0>;
472 default-state = "on";
473 };
474
475 hdd {
476 gpios = <&mcu_pio 1 0>;
477 linux,default-trigger = "ide-disk";
478 };
479 };
466}; 480};
diff --git a/arch/powerpc/boot/dts/mpc8377_rdb.dts b/arch/powerpc/boot/dts/mpc8377_rdb.dts
index 9e2264b10008..dbc1b988b29d 100644
--- a/arch/powerpc/boot/dts/mpc8377_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8377_rdb.dts
@@ -486,4 +486,18 @@
486 0 0x00800000>; 486 0 0x00800000>;
487 }; 487 };
488 }; 488 };
489
490 leds {
491 compatible = "gpio-leds";
492
493 pwr {
494 gpios = <&mcu_pio 0 0>;
495 default-state = "on";
496 };
497
498 hdd {
499 gpios = <&mcu_pio 1 0>;
500 linux,default-trigger = "ide-disk";
501 };
502 };
489}; 503};
diff --git a/arch/powerpc/boot/dts/mpc8378_rdb.dts b/arch/powerpc/boot/dts/mpc8378_rdb.dts
index 4e6a1a407bbd..3447eb9f6e88 100644
--- a/arch/powerpc/boot/dts/mpc8378_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8378_rdb.dts
@@ -470,4 +470,18 @@
470 0 0x00800000>; 470 0 0x00800000>;
471 }; 471 };
472 }; 472 };
473
474 leds {
475 compatible = "gpio-leds";
476
477 pwr {
478 gpios = <&mcu_pio 0 0>;
479 default-state = "on";
480 };
481
482 hdd {
483 gpios = <&mcu_pio 1 0>;
484 linux,default-trigger = "ide-disk";
485 };
486 };
473}; 487};
diff --git a/arch/powerpc/boot/dts/mpc8379_rdb.dts b/arch/powerpc/boot/dts/mpc8379_rdb.dts
index 72336d504528..15560c619b04 100644
--- a/arch/powerpc/boot/dts/mpc8379_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8379_rdb.dts
@@ -436,4 +436,18 @@
436 compatible = "fsl,mpc8349-pci"; 436 compatible = "fsl,mpc8349-pci";
437 device_type = "pci"; 437 device_type = "pci";
438 }; 438 };
439
440 leds {
441 compatible = "gpio-leds";
442
443 pwr {
444 gpios = <&mcu_pio 0 0>;
445 default-state = "on";
446 };
447
448 hdd {
449 gpios = <&mcu_pio 1 0>;
450 linux,default-trigger = "ide-disk";
451 };
452 };
439}; 453};
diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
index 0b4f883b20eb..ae525e4745d2 100644
--- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
@@ -74,6 +74,7 @@ static int __init mpc831x_rdb_probe(void)
74static struct of_device_id __initdata of_bus_ids[] = { 74static struct of_device_id __initdata of_bus_ids[] = {
75 { .compatible = "simple-bus" }, 75 { .compatible = "simple-bus" },
76 { .compatible = "gianfar" }, 76 { .compatible = "gianfar" },
77 { .compatible = "gpio-leds", },
77 {}, 78 {},
78}; 79};
79 80
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
index a1908d261240..e00801c42540 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
@@ -72,6 +72,7 @@ static struct of_device_id mpc837x_ids[] = {
72 { .compatible = "soc", }, 72 { .compatible = "soc", },
73 { .compatible = "simple-bus", }, 73 { .compatible = "simple-bus", },
74 { .compatible = "gianfar", }, 74 { .compatible = "gianfar", },
75 { .compatible = "gpio-leds", },
75 {}, 76 {},
76}; 77};
77 78
pt">= lh; return 0; } /** * find_good_lh - find a good log header * @jd: the journal * @blk: the segment to start searching from * @lh: the log header to fill in * @forward: if true search forward in the log, else search backward * * Call get_log_header() to get a log header for a segment, but if the * segment is bad, either scan forward or backward until we find a good one. * * Returns: errno */ static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk, struct gfs2_log_header_host *head) { unsigned int orig_blk = *blk; int error; for (;;) { error = get_log_header(jd, *blk, head); if (error <= 0) return error; if (++*blk == jd->jd_blocks) *blk = 0; if (*blk == orig_blk) { gfs2_consist_inode(GFS2_I(jd->jd_inode)); return -EIO; } } } /** * jhead_scan - make sure we've found the head of the log * @jd: the journal * @head: this is filled in with the log descriptor of the head * * At this point, seg and lh should be either the head of the log or just * before. Scan forward until we find the head. * * Returns: errno */ static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) { unsigned int blk = head->lh_blkno; struct gfs2_log_header_host lh; int error; for (;;) { if (++blk == jd->jd_blocks) blk = 0; error = get_log_header(jd, blk, &lh); if (error < 0) return error; if (error == 1) continue; if (lh.lh_sequence == head->lh_sequence) { gfs2_consist_inode(GFS2_I(jd->jd_inode)); return -EIO; } if (lh.lh_sequence < head->lh_sequence) break; *head = lh; } return 0; } /** * gfs2_find_jhead - find the head of a log * @jd: the journal * @head: the log descriptor for the head of the log is returned here * * Do a binary search of a journal and find the valid log entry with the * highest sequence number. (i.e. the log head) * * Returns: errno */ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) { struct gfs2_log_header_host lh_1, lh_m; u32 blk_1, blk_2, blk_m; int error; blk_1 = 0; blk_2 = jd->jd_blocks - 1; for (;;) { blk_m = (blk_1 + blk_2) / 2; error = find_good_lh(jd, &blk_1, &lh_1); if (error) return error; error = find_good_lh(jd, &blk_m, &lh_m); if (error) return error; if (blk_1 == blk_m || blk_m == blk_2) break; if (lh_1.lh_sequence <= lh_m.lh_sequence) blk_1 = blk_m; else blk_2 = blk_m; } error = jhead_scan(jd, &lh_1); if (error) return error; *head = lh_1; return error; } /** * foreach_descriptor - go through the active part of the log * @jd: the journal * @start: the first log header in the active region * @end: the last log header (don't process the contents of this entry)) * * Call a given function once for every log descriptor in the active * portion of the log. * * Returns: errno */ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, unsigned int end, int pass) { struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); struct buffer_head *bh; struct gfs2_log_descriptor *ld; int error = 0; u32 length; __be64 *ptr; unsigned int offset = sizeof(struct gfs2_log_descriptor); offset += sizeof(__be64) - 1; offset &= ~(sizeof(__be64) - 1); while (start != end) { error = gfs2_replay_read_block(jd, start, &bh); if (error) return error; if (gfs2_meta_check(sdp, bh)) { brelse(bh); return -EIO; } ld = (struct gfs2_log_descriptor *)bh->b_data; length = be32_to_cpu(ld->ld_length); if (be32_to_cpu(ld->ld_header.mh_type) == GFS2_METATYPE_LH) { struct gfs2_log_header_host lh; error = get_log_header(jd, start, &lh); if (!error) { gfs2_replay_incr_blk(sdp, &start); brelse(bh); continue; } if (error == 1) { gfs2_consist_inode(GFS2_I(jd->jd_inode)); error = -EIO; } brelse(bh); return error; } else if (gfs2_metatype_check(sdp, bh, GFS2_METATYPE_LD)) { brelse(bh); return -EIO; } ptr = (__be64 *)(bh->b_data + offset); error = lops_scan_elements(jd, start, ld, ptr, pass); if (error) { brelse(bh); return error; } while (length--) gfs2_replay_incr_blk(sdp, &start); brelse(bh); } return 0; } /** * clean_journal - mark a dirty journal as being clean * @sdp: the filesystem * @jd: the journal * @gl: the journal's glock * @head: the head journal to start from * * Returns: errno */ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head) { struct gfs2_inode *ip = GFS2_I(jd->jd_inode); struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); unsigned int lblock; struct gfs2_log_header *lh; u32 hash; struct buffer_head *bh; int error; struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; lblock = head->lh_blkno; gfs2_replay_incr_blk(sdp, &lblock); bh_map.b_size = 1 << ip->i_inode.i_blkbits; error = gfs2_block_map(&ip->i_inode, lblock, &bh_map, 0); if (error) return error; if (!bh_map.b_blocknr) { gfs2_consist_inode(ip); return -EIO; } bh = sb_getblk(sdp->sd_vfs, bh_map.b_blocknr); lock_buffer(bh); memset(bh->b_data, 0, bh->b_size); set_buffer_uptodate(bh); clear_buffer_dirty(bh); unlock_buffer(bh); lh = (struct gfs2_log_header *)bh->b_data; memset(lh, 0, sizeof(struct gfs2_log_header)); lh->lh_header.mh_magic = cpu_to_be32(GFS2_MAGIC); lh->lh_header.mh_type = cpu_to_be32(GFS2_METATYPE_LH); lh->lh_header.__pad0 = cpu_to_be64(0); lh->lh_header.mh_format = cpu_to_be32(GFS2_FORMAT_LH); lh->lh_header.mh_jid = cpu_to_be32(sdp->sd_jdesc->jd_jid); lh->lh_sequence = cpu_to_be64(head->lh_sequence + 1); lh->lh_flags = cpu_to_be32(GFS2_LOG_HEAD_UNMOUNT); lh->lh_blkno = cpu_to_be32(lblock); hash = gfs2_disk_hash((const char *)lh, sizeof(struct gfs2_log_header)); lh->lh_hash = cpu_to_be32(hash); set_buffer_dirty(bh); if (sync_dirty_buffer(bh)) gfs2_io_error_bh(sdp, bh); brelse(bh); return error; } static void gfs2_recovery_done(struct gfs2_sbd *sdp, unsigned int jid, unsigned int message) { char env_jid[20]; char env_status[20]; char *envp[] = { env_jid, env_status, NULL }; struct lm_lockstruct *ls = &sdp->sd_lockstruct; ls->ls_recover_jid_done = jid; ls->ls_recover_jid_status = message;