From: Albert H. <he...@us...> - 2008-11-15 20:10:18
|
Update of /cvsroot/gc-linux/linux/arch/powerpc/platforms/embedded6xx In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22863/arch/powerpc/platforms/embedded6xx Modified Files: Kconfig Makefile starlet-es.c usbgecko_udbg.c wii.c Added Files: gcnvi_udbg.c gcnvi_udbg.h starlet-gpio.c Removed Files: gamecube.h Log Message: - merge 2.6.27 - add gcnvi_udbg driver - add starlet-gpio driver - add initial SDHC support to rvl-stsd driver - add support for MEM1+MEM2 as normal RAM - enhanced rvl-sthcd device detection --- gamecube.h DELETED --- Index: starlet-es.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/platforms/embedded6xx/starlet-es.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- starlet-es.c 13 Sep 2008 19:42:53 -0000 1.3 +++ starlet-es.c 15 Nov 2008 20:10:14 -0000 1.4 @@ -23,7 +23,7 @@ #define DRV_DESCRIPTION "Nintendo Wii starlet ES driver" #define DRV_AUTHOR "Albert Herranz" -static const char starlet_es_driver_version[] = "0.1i"; +static const char starlet_es_driver_version[] = "0.2i"; #define DBG(fmt, arg...) pr_debug(fmt, ##arg) @@ -344,7 +344,7 @@ */ #define STARLET_ES_IOS_MIN 30 -#define STARLET_ES_IOS_MAX 35 +#define STARLET_ES_IOS_MAX 36 static int starlet_es_find_newest_title(struct starlet_es_device *es_dev, u64 *title, Index: Makefile =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/platforms/embedded6xx/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile 13 Sep 2008 19:42:53 -0000 1.6 +++ Makefile 15 Nov 2008 20:10:14 -0000 1.7 @@ -6,10 +6,14 @@ obj-$(CONFIG_STORCENTER) += storcenter.o obj-$(CONFIG_PPC_HOLLY) += holly.o obj-$(CONFIG_PPC_PRPMC2800) += prpmc2800.o -obj-$(CONFIG_FLIPPER_PIC) += flipper-pic.o +obj-$(CONFIG_PPC_C2K) += c2k.o obj-$(CONFIG_GAMECUBE) += gamecube.o gamecube_dev.o obj-$(CONFIG_WII) += wii.o wii_dev.o \ starlet-ipc.o starlet-malloc.o \ starlet-stm.o starlet-es.o +obj-$(CONFIG_WII_GPIO) += starlet-gpio.o +obj-$(CONFIG_FLIPPER_PIC) += flipper-pic.o obj-$(CONFIG_GAMECUBE_RSW) += gcn-rsw.o obj-$(CONFIG_USBGECKO_UDBG) += usbgecko_udbg.o +obj-$(CONFIG_GAMECUBE_VIDEO_UDBG) += gcnvi_udbg.o + --- NEW FILE: starlet-gpio.c --- /* * arch/powerpc/platforms/embedded6xx/starlet-gpio.c * * Nintendo Wii starlet GPIO driver * Copyright (C) 2008 The GameCube Linux Team * Copyright (C) 2008 Albert Herranz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * */ #include <linux/io.h> #include <linux/kernel.h> #include <linux/of.h> #include <linux/of_gpio.h> #include <linux/of_platform.h> struct stgpio_chip { struct of_mm_gpio_chip mmchip; spinlock_t lock; }; struct stgpio_regs { __be32 data, dir; }; static inline struct stgpio_chip * to_stgpio_chip(struct of_mm_gpio_chip *mm_gc) { return container_of(mm_gc, struct stgpio_chip, mmchip); } static int stgpio_get(struct gpio_chip *gc, unsigned int gpio) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct stgpio_regs __iomem *regs = mm_gc->regs; u32 pin_mask = 1 << (31 - gpio); unsigned int val; val = !!(in_be32(®s->data) & pin_mask); pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); return val; } static void stgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct stgpio_chip *st_gc = to_stgpio_chip(mm_gc); struct stgpio_regs __iomem *regs = mm_gc->regs; u32 pin_mask = 1 << (31 - gpio); u32 data; unsigned long flags; spin_lock_irqsave(&st_gc->lock, flags); data = in_be32(®s->data) & ~pin_mask; if (val) data |= pin_mask; out_be32(®s->data, data); spin_unlock_irqrestore(&st_gc->lock, flags); pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); } static int stgpio_dir_in(struct gpio_chip *gc, unsigned int gpio) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct stgpio_regs __iomem *regs = mm_gc->regs; u32 pin_mask = 1 << (31 - gpio); clrbits32(®s->dir, pin_mask); return 0; } static int stgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct stgpio_regs __iomem *regs = mm_gc->regs; u32 pin_mask = 1 << (31 - gpio); setbits32(®s->dir, pin_mask); stgpio_set(gc, gpio, val); return 0; } int stgpio_add32(struct device_node *np) { struct of_mm_gpio_chip *mm_gc; struct of_gpio_chip *of_gc; struct gpio_chip *gc; struct stgpio_chip *st_gc; st_gc = kzalloc(sizeof(*st_gc), GFP_KERNEL); if (!st_gc) return -ENOMEM; spin_lock_init(&st_gc->lock); mm_gc = &st_gc->mmchip; of_gc = &mm_gc->of_gc; gc = &of_gc->gc; of_gc->gpio_cells = 1; gc->ngpio = 32; gc->direction_input = stgpio_dir_in; gc->direction_output = stgpio_dir_out; gc->get = stgpio_get; gc->set = stgpio_set; return of_mm_gpiochip_add(np, mm_gc); } static int stgpio_init(void) { struct device_node *np; int error; for_each_compatible_node(np, NULL, "nintendo,starlet-gpio") { error = stgpio_add32(np); if (error < 0) printk(KERN_ERR "starlet-gpio: error %d adding gpios" " for %s\n", error, np->full_name); } return 0; /* whatever */ } arch_initcall(stgpio_init); --- NEW FILE: gcnvi_udbg.c --- /* * arch/powerpc/platforms/embedded6xx/gcnvi_udbg.c * * Nintendo GameCube/Wii framebuffer udbg output support. * Copyright (C) 2008 The GameCube Linux Team * Copyright (C) 2008 Albert Herranz * * Based on arch/ppc/platforms/gcn-con.c * * Nintendo GameCube early debug console * Copyright (C) 2004-2005 The GameCube Linux Team * * Based on console.c by tmbinc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * */ #include <linux/io.h> #include <linux/string.h> #include <linux/console.h> #include <linux/font.h> #include <asm/prom.h> #include <asm/udbg.h> #include <mm/mmu_decl.h> #include "gcnvi_udbg.h" /* * Console settings. * */ #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 #define FONT_XSIZE 8 #define FONT_YSIZE 16 #define FONT_XFACTOR 1 #define FONT_YFACTOR 1 #define FONT_XGAP 2 #define FONT_YGAP 0 #define COLOR_WHITE 0xFF80FF80 #define COLOR_BLACK 0x00800080 struct console_data { unsigned char *framebuffer; int xres, yres, stride; const unsigned char *font; int cursor_x, cursor_y; int foreground, background; int border_left, border_right, border_top, border_bottom; int scrolled_lines; }; static struct console_data *default_console = NULL; #if 0 static int console_set_color(int background, int foreground) { default_console->foreground = foreground; default_console->background = background; return 0; } #endif static void console_drawc(struct console_data *con, int x, int y, unsigned char c) { int ax, ay; unsigned long *ptr; unsigned long color, color2x[2]; int bits; x >>= 1; ptr = (unsigned long *)(con->framebuffer + con->stride * y + x * 4); for (ay = 0; ay < FONT_YSIZE; ay++) { #if FONT_XFACTOR == 2 for (ax = 0; ax < 8; ax++) { if ((con->font[c * FONT_YSIZE + ay] << ax) & 0x80) color = con->foreground; else color = con->background; #if FONT_YFACTOR == 2 // pixel doubling: we write u32 ptr[ay * 2 * con->stride / 4 + ax] = color; // line doubling ptr[(ay * 2 + 1) * con->stride / 4 + ax] = color; #else ptr[ay * con->stride / 4 + ax] = color; #endif } #else for (ax = 0; ax < 4; ax++) { bits = (con->font[c * FONT_YSIZE + ay] << (ax * 2)); if (bits & 0x80) color2x[0] = con->foreground; else color2x[0] = con->background; if (bits & 0x40) color2x[1] = con->foreground; else color2x[1] = con->background; ptr[ay * con->stride / 4 + ax] = (color2x[0] & 0xFFFF00FF) | (color2x[1] & 0x0000FF00); } #endif } } static void console_putc(struct console_data *con, char c) { int cnt; unsigned long *ptr; switch (c) { case '\n': con->cursor_y += FONT_YSIZE * FONT_YFACTOR + FONT_YGAP; con->cursor_x = con->border_left; break; default: console_drawc(con, con->cursor_x, con->cursor_y, c); con->cursor_x += FONT_XSIZE * FONT_XFACTOR + FONT_XGAP; if ((con->cursor_x + (FONT_XSIZE * FONT_XFACTOR)) > con->border_right) { con->cursor_y += FONT_YSIZE * FONT_YFACTOR + FONT_YGAP; con->cursor_x = con->border_left; } } if ((con->cursor_y + FONT_YSIZE * FONT_YFACTOR) >= con->border_bottom) { memcpy(con->framebuffer, con->framebuffer + con->stride * (FONT_YSIZE * FONT_YFACTOR + FONT_YGAP), con->stride * con->yres - FONT_YSIZE); cnt = (con->stride * (FONT_YSIZE * FONT_YFACTOR + FONT_YGAP)) / 4; ptr = (unsigned long *)(con->framebuffer + con->stride * (con->yres - FONT_YSIZE)); while (cnt--) *ptr++ = con->background; con->cursor_y -= FONT_YSIZE * FONT_YFACTOR + FONT_YGAP; } } static void console_init(struct console_data *con, void *framebuffer, int xres, int yres, int stride) { int c; unsigned long *p; con->framebuffer = framebuffer; con->xres = xres; con->yres = yres; con->border_left = 0; con->border_top = 0; con->border_right = con->xres; con->border_bottom = con->yres; con->stride = stride; con->cursor_x = con->cursor_y = 0; con->font = font_vga_8x16.data; con->foreground = COLOR_WHITE; con->background = COLOR_BLACK; con->scrolled_lines = 0; /* clear screen */ c = con->xres * con->yres / 2; p = (unsigned long *)con->framebuffer; while (c--) *p++ = con->background; default_console = con; } /* * Video hardware setup. * */ /* Hardware registers */ #define VI_TFBL 0x1c #define VI_TFBR 0x20 #define VI_BFBL 0x24 #define VI_BFBR 0x28 #define VI_DPV 0x2c /* NTSC settings (640x480) */ static const u32 vi_Mode640X480NtscYUV16[32] = { 0x0F060001, 0x476901AD, 0x02EA5140, 0x00030018, 0x00020019, 0x410C410C, 0x40ED40ED, 0x00435A4E, 0x00000000, 0x00435A4E, 0x00000000, 0x00000000, 0x110701AE, 0x10010001, 0x00010001, 0x00010001, 0x00000000, 0x00000000, 0x28500100, 0x1AE771F0, 0x0DB4A574, 0x00C1188E, 0xC4C0CBE2, 0xFCECDECF, 0x13130F08, 0x00080C0F, 0x00FF0000, 0x00000000, 0x02800000, 0x000000FF, 0x00FF00FF, 0x00FF00FF }; static void vi_setup_video(void __iomem * io_base, unsigned long xfb_start) { const u32 *regs = vi_Mode640X480NtscYUV16; int i; /* initialize video registers */ for (i = 0; i < 7; i++) { out_be32(io_base + i * sizeof(__u32), regs[i]); } out_be32(io_base + VI_TFBR, regs[VI_TFBR / sizeof(__u32)]); out_be32(io_base + VI_BFBR, regs[VI_BFBR / sizeof(__u32)]); out_be32(io_base + VI_DPV, regs[VI_DPV / sizeof(__u32)]); for (i = 16; i < 32; i++) { out_be32(io_base + i * sizeof(__u32), regs[i]); } /* set framebuffer address, interlaced mode */ out_be32(io_base + VI_TFBL, 0x10000000 | (xfb_start >> 5)); xfb_start += 2 * SCREEN_WIDTH; /* line length */ out_be32(io_base + VI_BFBL, 0x10000000 | (xfb_start >> 5)); } /* * Retrieves and prepares the virtual address needed to access the hardware. */ static void __iomem *vi_setup_io_base(struct device_node *np) { phys_addr_t paddr; const unsigned int *reg; void *io_base = NULL; reg = of_get_property(np, "reg", NULL); if (reg) { paddr = of_translate_address(np, reg); if (paddr) io_base = ioremap(paddr, reg[1]); } return io_base; } /* * udbg functions. * */ /* OF bindings */ static struct of_device_id gcnvi_udbg_ids[] __initdata = { { .compatible = "nintendo,hollywood-video", }, { .compatible = "nintendo,gamecube-video", }, }; static struct console_data gcnvi_udbg_console; /* * Transmits a character. */ void gcnvi_udbg_putc(char ch) { if (default_console) console_putc(default_console, ch); } /* * Initializes udbg support. */ void __init gcnvi_udbg_init(void) { unsigned long xfb_start = 0, xfb_size = 0; struct device_node *np = NULL; const unsigned long *prop; void *screen_base; void *io_base; for_each_matching_node(np, gcnvi_udbg_ids) { if (np) break; } if (!np) return; prop = of_get_property(np, "xfb-start", NULL); if (prop) { xfb_start = *prop; prop = of_get_property(np, "xfb-size", NULL); if (prop) xfb_size = *prop; } io_base = vi_setup_io_base(np); of_node_put(np); if (!prop || !io_base) return; if (xfb_size < 2 * SCREEN_WIDTH * SCREEN_HEIGHT) return; screen_base = ioremap_nocache(xfb_start, xfb_size); if (!screen_base) return; vi_setup_video(io_base, xfb_start); console_init(&gcnvi_udbg_console, screen_base, SCREEN_WIDTH, SCREEN_HEIGHT, 2 * SCREEN_WIDTH); //udbg_putc = gcnvi_udbg_putc; printk(KERN_INFO "gcnvi_udbg: ready\n"); } Index: usbgecko_udbg.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- usbgecko_udbg.c 4 Apr 2008 19:17:51 -0000 1.2 +++ usbgecko_udbg.c 15 Nov 2008 20:10:14 -0000 1.3 @@ -176,7 +176,7 @@ /* * Transmits a character. */ -static void ug_udbg_putc(char ch) +void ug_udbg_putc(char ch) { ug_putc(ch); } @@ -253,6 +253,7 @@ udbg_putc = ug_udbg_putc; udbg_getc = ug_udbg_getc; udbg_getc_poll = ug_udbg_getc_poll; + printk(KERN_INFO "usbgecko_udbg: ready\n"); } of_node_put(np); --- NEW FILE: gcnvi_udbg.h --- /* * arch/powerpc/platforms/embedded6xx/gcnvi_udbg.h * * Nintendo GameCube/Wii framebuffer udbg output support. * Copyright (C) 2008 The GameCube Linux Team * Copyright (C) 2008 Albert Herranz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * */ #ifndef __GCNVI_UDBG_H #define __GCNVI_UDBG_H #ifdef CONFIG_GAMECUBE_VIDEO_UDBG extern void __init gcnvi_udbg_init(void); #else static inline void __init gcnvi_udbg_init(void) { } #endif /* CONFIG_GAMECUBE_VIDEO_UDBG */ #endif /* __GCNVI_UDBG_H */ Index: Kconfig =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/platforms/embedded6xx/Kconfig,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Kconfig 13 Sep 2008 19:42:53 -0000 1.5 +++ Kconfig 15 Nov 2008 20:10:14 -0000 1.6 @@ -59,22 +59,15 @@ help This option enables support for the Motorola PrPMC2800 board -config GAMECUBE - bool "Nintendo-GameCube" - depends on EMBEDDED6xx - select GAMECUBE_COMMON - help - Select GAMECUBE if configuring for the Nintendo GameCube. - More information at: <http://gc-linux.sourceforge.net/> - -config WII - bool "Nintendo-Wii" +config PPC_C2K + bool "SBS/GEFanuc C2K board" depends on EMBEDDED6xx - select GAMECUBE_COMMON - select PPC_LIB_RHEAP + select MV64X60 + select NOT_COHERENT_CACHE + select MTD_CFI_I4 help - Select WII if configuring for the Nintendo Wii. - More information at: <http://gc-linux.sourceforge.net/> + This option enables support for the GE Fanuc C2K board (formerly + an SBS board). config TSI108_BRIDGE bool @@ -98,6 +91,23 @@ bool "Enable MPC10x store gathering" depends on MPC10X_BRIDGE +config GAMECUBE + bool "Nintendo-GameCube" + depends on EMBEDDED6xx + select GAMECUBE_COMMON + help + Select GAMECUBE if configuring for the Nintendo GameCube. + More information at: <http://gc-linux.sourceforge.net/> + +config WII + bool "Nintendo-Wii" + depends on EMBEDDED6xx + select GAMECUBE_COMMON + select PPC_LIB_RHEAP + help + Select WII if configuring for the Nintendo Wii. + More information at: <http://gc-linux.sourceforge.net/> + config FLIPPER_PIC bool default n @@ -118,11 +128,23 @@ If in doubt, say Y here. -config USBGECKO_UDBG - bool "USB Gecko udbg console for the Nintendo GameCube/Wii" +config GAMECUBE_UDBG + bool "Nintendo GameCube/Wii udbg support" depends on GAMECUBE_COMMON default n help + If you say yes to this option, you will be able to choose between + several udbg drivers available for the Nintendo GameCube/Wii. + + If in doubt, say N here. + +choice + prompt "Nintendo GameCube/Wii udbg drivers" + depends on GAMECUBE_UDBG + +config USBGECKO_UDBG + bool "USB Gecko udbg console for the Nintendo GameCube/Wii" + help If you say yes to this option, support will be included for the USB Gecko adapter as an udbg console. The USB Gecko is an USB serial-to-spi converter that can be plugged @@ -132,4 +154,26 @@ If in doubt, say N here. +config GAMECUBE_VIDEO_UDBG + bool "Nintendo GameCube/Wii framebuffer udbg console" + select FONTS + select FONT_8x16 + help + If you say yes to this option, support will be included for a + framebuffer based udbg console for the Nintendo GameCube/Wii. + + If in doubt, say N here. + +endchoice + +config WII_GPIO + bool "Nintendo Wii GPIO support" + depends on GPIOLIB + default y + help + If you say yes to this option, support will be included for the + Nintendo Wii GPIO lines that control, for example, the sensor + bar IR leds, the front led, or the eject switch of the disk unit. + + If in doubt, say Y here. Index: wii.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/platforms/embedded6xx/wii.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- wii.c 26 Mar 2008 19:51:02 -0000 1.1 +++ wii.c 15 Nov 2008 20:10:14 -0000 1.2 @@ -26,6 +26,7 @@ #include <asm/udbg.h> #include "flipper-pic.h" +#include "gcnvi_udbg.h" #include "usbgecko_udbg.h" @@ -65,6 +66,7 @@ static void __init wii_init_early(void) { ug_udbg_init(); + gcnvi_udbg_init(); } static int __init wii_probe(void) |