Skip to contentSkip to conversation

goldfish: rebase/resend versus current -next

PATCH In review Alan Cox 3 participants 15 messages Jan 9, 2013 – Mar 10, 2014

Subsystems (8)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

cover goldfish: rebase/resend versus current -next

And added the pipe driver

---

Arve Hjønnevåg (4):
goldfish: tty driver
goldfish: framebuffer
goldfish: real time clock
goldfish: NAND flash driver

Brian Swetland (1):
goldfish: virtual input event driver

David 'Digit' Turner (1):
goldfish: add QEMU pipe driver

Jun Nakajima (2):
goldfish: definitions for Goldfish on x86 platforms
goldfish: add the goldfish virtual bus

Mike Lockwood (2):
goldfish: emulated MMC device
goldfish: power device

 arch/x86/Kconfig                          |   12 +
 arch/x86/include/asm/goldfish.h           |   40 ++
 drivers/input/keyboard/Kconfig            |   11 +
 drivers/input/keyboard/Makefile           |    1 
 drivers/input/keyboard/goldfish_events.c  |  199 +++++++++
 drivers/mmc/host/Kconfig                  |    7 
 drivers/mmc/host/Makefile                 |    1 
 drivers/mmc/host/goldfish.c               |  577 +++++++++++++++++++++++++++
 drivers/mtd/devices/Kconfig               |    7 
 drivers/mtd/devices/Makefile              |    3 
 drivers/mtd/devices/goldfish_nand.c       |  475 ++++++++++++++++++++++
 drivers/mtd/devices/goldfish_nand_reg.h   |   72 +++
 drivers/platform/Kconfig                  |    4 
 drivers/platform/Makefile                 |    1 
 drivers/platform/goldfish/Kconfig         |    5 
 drivers/platform/goldfish/Makefile        |    5 
 drivers/platform/goldfish/goldfish_pipe.c |  631 +++++++++++++++++++++++++++++
 drivers/platform/goldfish/pdev_bus.c      |  265 ++++++++++++
 drivers/power/Kconfig                     |    8 
 drivers/power/Makefile                    |    1 
 drivers/power/goldfish_battery.c          |  262 ++++++++++++
 drivers/rtc/Kconfig                       |    9 
 drivers/rtc/Makefile                      |    1 
 drivers/rtc/rtc-goldfish.c                |  144 +++++++
 drivers/tty/Kconfig                       |    6 
 drivers/tty/Makefile                      |    1 
 drivers/tty/goldfish.c                    |  340 ++++++++++++++++
 drivers/video/Kconfig                     |    9 
 drivers/video/Makefile                    |    1 
 drivers/video/goldfishfb.c                |  326 +++++++++++++++
 30 files changed, 3422 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/include/asm/goldfish.h
 create mode 100644 drivers/input/keyboard/goldfish_events.c
 create mode 100644 drivers/mmc/host/goldfish.c
 create mode 100644 drivers/mtd/devices/goldfish_nand.c
 create mode 100644 drivers/mtd/devices/goldfish_nand_reg.h
 create mode 100644 drivers/platform/goldfish/Kconfig
 create mode 100644 drivers/platform/goldfish/Makefile
 create mode 100644 drivers/platform/goldfish/goldfish_pipe.c
 create mode 100644 drivers/platform/goldfish/pdev_bus.c
 create mode 100644 drivers/power/goldfish_battery.c
 create mode 100644 drivers/rtc/rtc-goldfish.c
 create mode 100644 drivers/tty/goldfish.c
 create mode 100644 drivers/video/goldfishfb.c
Signature · 1 line
Moo
author
#1 lore raw

PATCH 1/10 goldfish: definitions for Goldfish on x86 platforms

From: Jun Nakajima <[email protected]>

Based on code by Jun Nakajima but stripped of all the old x86 mach-foo stuff and turned into a single include file for the Goldfish virtual bus layer

[Ported to 3.7 and reorganised so that we can keep most of the code
shared properly]

---

 arch/x86/Kconfig                |   12 ++++++++++++
 arch/x86/include/asm/goldfish.h |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 arch/x86/include/asm/goldfish.h
arch/x86/Kconfig +12 -0
index 8c185d0..86859ec 100644
@@ -322,6 +322,10 @@ config X86_BIGSMP
 	---help---
 	  This option is needed for the systems that have more than 8 CPUs
 
+config GOLDFISH
+       def_bool y
+       depends on X86_GOLDFISH
+
 if X86_32
 config X86_EXTENDED_PLATFORM
 	bool "Support for extended (non-PC) x86 platforms"
@@ -404,6 +408,14 @@ config X86_UV
 # Following is an alphabetically sorted list of 32 bit extended platforms
 # Please maintain the alphabetic order if and when there are additions
 
+config X86_GOLDFISH
+       bool "Goldfish (Virtual Platform)"
+       depends on X86_32
+       ---help---
+	 Enable support for the Goldfish virtual platform used primarily
+	 for Android development. Unless you are building for the Android
+	 Goldfish emulator say N here.
+
 config X86_INTEL_CE
 	bool "CE4100 TV platform"
 	depends on PCI
arch/x86/include/asm/goldfish.h new file +33 -0
new file mode 100644
index 0000000..8d2c559
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007 Google, Inc.
+ * Copyright (C) 2012 Intel, Corp.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __X86_ARCH_HARDWARE_H
+#define __X86_ARCH_HARDWARE_H
+
+/*
+ * Where in virtual memory the IO devices (timers, system controllers
+ * and so on)
+ */
+
+#define GOLDFISH_IO_SIZE	0x00800000	/* How much? */
+#define GOLDFISH_IO_START	0xff000000	/* PA of IO */
+
+#define GOLDFISH_PDEV_BUS_BASE	(0x1000)
+#define GOLDFISH_PDEV_BUS_END	(0x100)
+#define GOLDFISH_PDEV_BUS_IRQ	(4)
+
+#define GOLDFISH_TTY_BASE	(0x2000)
+
+#endif
author
#2 lore raw

PATCH 2/10 goldfish: add the goldfish virtual bus

In reply to Alan Cox

From: Jun Nakajima <[email protected]>

This imports the current Google code and cleans it up slightly to use pr_ and to properly request its resources.

Goldfish is an emulator used for Android development. It has a virtual bus where the emulator passes platform device information to the guest which then creates the appropriate devices.

This part of the emulation is not architecture specific so should not be hiding in architecture trees as it does in the Google Android tree. The constants it uses do depend on the platform and so live in arch/goldfish.h

---

 drivers/platform/Makefile            |    1 
 drivers/platform/goldfish/Makefile   |    4 +
 drivers/platform/goldfish/pdev_bus.c |  265 ++++++++++++++++++++++++++++++++++
 3 files changed, 270 insertions(+)
 create mode 100644 drivers/platform/goldfish/Makefile
 create mode 100644 drivers/platform/goldfish/pdev_bus.c
drivers/platform/Makefile +1 -0
index b17c16c..8a44a4c 100644
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_X86)		+= x86/
 obj-$(CONFIG_OLPC)		+= olpc/
+obj-$(CONFIG_GOLDFISH)		+= goldfish/
drivers/platform/goldfish/Makefile new file +4 -0
new file mode 100644
index 0000000..6c591f6
@@ -0,0 +1,4 @@
+#
+# Makefile for Goldfish platform specific drivers
+#
+obj-$(CONFIG_GOLDFISH)	+=	pdev_bus.o
drivers/platform/goldfish/pdev_bus.c new file +265 -0

265 lines not on this page · raw message

#3 lore raw

Re: [PATCH 02/10] goldfish: add the goldfish virtual bus

Quoted 5 lines · Alan Cox

From: Jun Nakajima <[email protected]>

This imports the current Google code and cleans it up slightly to use pr_ and to properly request its resources.

Quoted 7 lines

Goldfish is an emulator used for Android development. It has a virtual bus where the emulator passes platform device information to the guest which then creates the appropriate devices.

This part of the emulation is not architecture specific so should not be hiding in architecture trees as it does in the Google Android tree. The constants it uses do depend on the platform and so live in arch/goldfish.h

Ah, quite nice.

Quoted 4 lines
 drivers/platform/Makefile            |    1 
 drivers/platform/goldfish/Makefile   |    4 +
 drivers/platform/goldfish/pdev_bus.c |  265 ++++++++++++++++++++++++++++++++++
 3 files changed, 270 insertions(+)

Maybe drivers/bus would be more appropriate though. Every platform handles platforms differently, and x86 seems to be the only one that likes the model of putting stuff under drivers/platform.

Quoted 4 lines
drivers/platform/goldfish/pdev_bus.c new file +4 -0
+static int __devexit goldfish_pdev_bus_remove(struct platform_device *pdev)
+{
+	free_irq(pdev_bus_irq, pdev);
+	release_region(pdev_bus_addr, GOLDFISH_IO_SIZE);

drivers/platform/goldfish/pdev_bus.c line 226

Quoted 10 lines
drivers/platform/goldfish/pdev_bus.c new file +10 -0
+	return 0;
+}
+
+static struct platform_driver goldfish_pdev_bus_driver = {
+	.probe = goldfish_pdev_bus_probe,
+	.remove = __devexit_p(goldfish_pdev_bus_remove),
+	.driver = {
+		.name = "goldfish_pdev_bus"
+	}
+};

__devinit/__devexit are going away, so you can skip adding them for new code.

drivers/platform/goldfish/pdev_bus.c line 239

Quoted 13 lines
drivers/platform/goldfish/pdev_bus.c new file +13 -0
+
+static int __init goldfish_pdev_bus_init(void)
+{
+	return platform_driver_register(&goldfish_pdev_bus_driver);
+}
+
+static void __exit goldfish_pdev_bus_exit(void)
+{
+	platform_driver_unregister(&goldfish_pdev_bus_driver);
+}
+
+module_init(goldfish_pdev_bus_init);
+module_exit(goldfish_pdev_bus_exit);

The module_platform_driver() macro takes care of this.

Quoted 15 lines
drivers/platform/goldfish/pdev_bus.c new file +15 -0
+static struct resource goldfish_pdev_bus_resources[] = {
+	{
+		.start  = GOLDFISH_PDEV_BUS_BASE,
+		.end    = GOLDFISH_PDEV_BUS_BASE + GOLDFISH_PDEV_BUS_END - 1,
+		.flags  = IORESOURCE_IO,
+	},
+	{
+		.start	= GOLDFISH_PDEV_BUS_IRQ,
+		.end	= GOLDFISH_PDEV_BUS_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device goldfish_pdev_bus_device = {
+	.name = "goldfish_pdev_bus",

drivers/platform/goldfish/pdev_bus.c line 265

Quoted 10 lines
drivers/platform/goldfish/pdev_bus.c new file +10 -0
+	.id = -1,
+	.num_resources = ARRAY_SIZE(goldfish_pdev_bus_resources),
+	.resource = goldfish_pdev_bus_resources
+};
+
+static int __init goldfish_init(void)
+{
+	return platform_device_register(&goldfish_pdev_bus_device);
+}
+device_initcall(goldfish_init);

This is the part that I think should actually be part of the architecture tree. That way, no architecture specific header files will be necessary, and it's possible to create the platform device differently, e.g. from devicetree on architectures that support it, or from ACPI.

Note that statically declaring a platform device is not recommended any more, a call to platform_device_register_simple() makes this code simpler and smaller, and allows proper reference counting on the device.

Arnd

author
#4 lore raw

Re: [PATCH 02/10] goldfish: add the goldfish virtual bus

Quoted 3 lines

Maybe drivers/bus would be more appropriate though. Every platform handles platforms differently, and x86 seems to be the only one that likes the model of putting stuff under drivers/platform.

I'm fine with that and I agree - it is a bus.

Quoted 2 lines

__devinit/__devexit are going away, so you can skip adding them for new code.

I'll strip those out of the upstream version

Quoted 4 lines

drivers/platform/goldfish/pdev_bus.c line 239

Quoted 2 lines
drivers/platform/goldfish/pdev_bus.c new file +2 -0
+module_init(goldfish_pdev_bus_init);
+module_exit(goldfish_pdev_bus_exit);

The module_platform_driver() macro takes care of this.

Will change to that.

Quoted 22 lines
Quoted 22 lines
drivers/platform/goldfish/pdev_bus.c new file +4 -0
+static struct resource goldfish_pdev_bus_resources[] = {
+	{
+		.start  = GOLDFISH_PDEV_BUS_BASE,
+		.end    = GOLDFISH_PDEV_BUS_BASE +

GOLDFISH_PDEV_BUS_END - 1,

drivers/platform/goldfish/pdev_bus.c new file +16 -0
+		.flags  = IORESOURCE_IO,
+	},
+	{
+		.start	= GOLDFISH_PDEV_BUS_IRQ,
+		.end	= GOLDFISH_PDEV_BUS_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device goldfish_pdev_bus_device = {
+	.name = "goldfish_pdev_bus",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(goldfish_pdev_bus_resources),
+	.resource = goldfish_pdev_bus_resources
+};
+
Quoted 8 lines

drivers/platform/goldfish/pdev_bus.c line 265

Quoted 5 lines
drivers/platform/goldfish/pdev_bus.c new file +5 -0
+static int __init goldfish_init(void)
+{
+	return platform_device_register(&goldfish_pdev_bus_device);
+}
+device_initcall(goldfish_init);

This is the part that I think should actually be part of the architecture tree.

Thinking about it a bit I agree. We still end up needing an architectural header for early console and the like eventually but it does eliminate much of the rest.

I'll rework it that way.

Alan

author
#5 lore raw

PATCH 3/10 goldfish: tty driver

In reply to Alan Cox

From: Arve Hjønnevåg <[email protected]>

This provides a console driver for the Goldfish virtual platform. The original is from Arve with changes from Jun Nakajima and Tom Keel. This has been then been ported to the current kernel and to the tty port mechanism by Alan Cox. In the process it gained proper POSIX semantics and vhangup works. The default name is not ttyS as this belongs to the 8250 driver. Instead ttyGFx is now used.

In the normal usage case the first port serves as a kernel logging console and the second one carries various other data streams for the emulation.

[Cleaned up to handle x86]
[Moved to 3.7 and chunks rewritten to use tty_port layer]

---

 drivers/tty/Kconfig    |    6 +
 drivers/tty/Makefile   |    1 
 drivers/tty/goldfish.c |  340 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 347 insertions(+)
 create mode 100644 drivers/tty/goldfish.c
drivers/tty/Kconfig +6 -0
index 0ecf22b..89a1007 100644
@@ -388,3 +388,9 @@ config PPC_EARLY_DEBUG_EHV_BC_HANDLE
 	  If the number you specify is not a valid byte channel handle, then
 	  there simply will be no early console output.  This is true also
 	  if you don't boot under a hypervisor at all.
+
+config GOLDFISH_TTY
+	tristate "Goldfish TTY Driver"
+	depends on GOLDFISH
+	help
+	  Console and system TTY driver for the Goldfish virtual platform.
drivers/tty/Makefile +1 -0
index 2953059..f8e59ae 100644
@@ -27,5 +27,6 @@ obj-$(CONFIG_SYNCLINK_GT)	+= synclink_gt.o
 obj-$(CONFIG_SYNCLINKMP)	+= synclinkmp.o
 obj-$(CONFIG_SYNCLINK)		+= synclink.o
 obj-$(CONFIG_PPC_EPAPR_HV_BYTECHAN) += ehv_bytechan.o
+obj-$(CONFIG_GOLDFISH_TTY)	+= goldfish.o
 
 obj-y += ipwireless/
drivers/tty/goldfish.c new file +340 -0

340 lines not on this page · raw message

#6 lore raw

Re: [PATCH 03/10] goldfish: tty driver

Quoted 7 lines · Alan Cox
drivers/tty/goldfish.c new file +6 -0
+static int __devinit goldfish_tty_probe(struct platform_device *pdev)
+{
+       struct goldfish_tty *qtty;
...
+
+static int __init goldfish_tty_init(void)
+{

drivers/tty/goldfish.c line 340

Quoted 10 lines
drivers/tty/goldfish.c new file +10 -0
+       return platform_driver_register(&goldfish_tty_platform_driver);
+}
+
+static void __exit goldfish_tty_exit(void)
+{
+       platform_driver_unregister(&goldfish_tty_platform_driver);
+}
+
+module_init(goldfish_tty_init);
+module_exit(goldfish_tty_exit);

The same comments on __devinit/__devexit and module_platform_driver that I made on the bus driver apparently apply on this patch and some of the others.

Arnd

author
#7 lore raw

PATCH 4/10 goldfish: virtual input event driver

In reply to Alan Cox

From: Brian Swetland <[email protected]>

This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!)

As with the other submissions this driver is cross architecture.

[Tided up to work on x86]
[Ported to 3.4]
[Cleaned up for 3.7 and submission]

---

 drivers/input/keyboard/Kconfig           |   11 ++
 drivers/input/keyboard/Makefile          |    1 
 drivers/input/keyboard/goldfish_events.c |  199 ++++++++++++++++++++++++++++++
 3 files changed, 211 insertions(+)
 create mode 100644 drivers/input/keyboard/goldfish_events.c
drivers/input/keyboard/Kconfig +11 -0
index 5a240c6..df884b8 100644
@@ -479,6 +479,17 @@ config KEYBOARD_SAMSUNG
 	  To compile this driver as a module, choose M here: the
 	  module will be called samsung-keypad.
 
+config KEYBOARD_GOLDFISH_EVENTS
+	depends on GOLDFISH
+	tristate "Generic Input Event device for Goldfish"
+	help
+	  Say Y here to get an input event device for the Goldfish virtual
+	  device emulator.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called goldfish-events.
+
+
 config KEYBOARD_STOWAWAY
 	tristate "Stowaway keyboard"
 	select SERIO
drivers/input/keyboard/Makefile +1 -0
index 44e7600..49b1645 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_ATKBD)		+= atkbd.o
 obj-$(CONFIG_KEYBOARD_BFIN)		+= bf54x-keys.o
 obj-$(CONFIG_KEYBOARD_DAVINCI)		+= davinci_keyscan.o
 obj-$(CONFIG_KEYBOARD_EP93XX)		+= ep93xx_keypad.o
+obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS)	+= goldfish_events.o
 obj-$(CONFIG_KEYBOARD_GPIO)		+= gpio_keys.o
 obj-$(CONFIG_KEYBOARD_GPIO_POLLED)	+= gpio_keys_polled.o
 obj-$(CONFIG_KEYBOARD_TCA6416)		+= tca6416-keypad.o
drivers/input/keyboard/goldfish_events.c new file +199 -0

199 lines not on this page · raw message

author
#8 lore raw

PATCH 5/10 goldfish: framebuffer

In reply to Alan Cox

From: Arve Hjønnevåg <[email protected]>

Framebuffer support for the Goldfish emulator. This takes the Google emulator and applies the x86 cleanups as well as moving the blank methods to the usual Linux place and dropping the Android early suspend logic (for now at least, that can be looked at as Android and upstream converge). Dropped various oddities like setting MTRRs on a virtual frame buffer emulation...

With the drivers so far you can now boot a Linux initrd and have fun.

[cleaned up to handle x86]
[ported to 3.4]
[cleaned up for style and 3.7, moved blank methods]

---

 drivers/video/Kconfig      |    9 +
 drivers/video/Makefile     |    1 
 drivers/video/goldfishfb.c |  326 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 336 insertions(+)
 create mode 100644 drivers/video/goldfishfb.c
drivers/video/Kconfig +9 -0
index e7068c5..a913997 100644
@@ -2183,6 +2183,15 @@ config FB_XILINX
 	  framebuffer. ML300 carries a 640*480 LCD display on the board,
 	  ML403 uses a standard DB15 VGA connector.
 
+config FB_GOLDFISH
+	tristate "Goldfish Framebuffer"
+	depends on FB
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
+	---help---
+	  Framebuffer driver for Goldfish Virtual Platform
+
 config FB_COBALT
 	tristate "Cobalt server LCD frame buffer support"
 	depends on FB && (MIPS_COBALT || MIPS_SEAD3)
drivers/video/Makefile +1 -0
index 768a137..3363f67 100644
@@ -98,6 +98,7 @@ obj-$(CONFIG_FB_ATMEL)		  += atmel_lcdfb.o
 obj-$(CONFIG_FB_PVR2)             += pvr2fb.o
 obj-$(CONFIG_FB_VOODOO1)          += sstfb.o
 obj-$(CONFIG_FB_ARMCLCD)	  += amba-clcd.o
+obj-$(CONFIG_FB_GOLDFISH)         += goldfishfb.o
 obj-$(CONFIG_FB_68328)            += 68328fb.o
 obj-$(CONFIG_FB_GBE)              += gbefb.o
 obj-$(CONFIG_FB_CIRRUS)		  += cirrusfb.o
drivers/video/goldfishfb.c new file +326 -0

326 lines not on this page · raw message

author
#9 lore raw

PATCH 6/10 goldfish: emulated MMC device

In reply to Alan Cox

From: Mike Lockwood <[email protected]>

This driver handles the virtual MMC device present in the Goldfish emulator. The patch folds together initial work from Mike Lockwood and patches by San Mehat, Jun Nakajima and Tom Keel <[email protected]> plus cleanups by Alan Cox to get it all into 3.6 shape.

[cleaned up and x86 support added]
[Moved to 3.4]
[Moved to 3.7]

---

 drivers/mmc/host/Kconfig    |    7 +
 drivers/mmc/host/Makefile   |    1 
 drivers/mmc/host/goldfish.c |  577 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 585 insertions(+)
 create mode 100644 drivers/mmc/host/goldfish.c
drivers/mmc/host/Kconfig +7 -0
index cc8a8fa..f5d308d 100644
@@ -361,6 +361,13 @@ config MMC_DAVINCI
           If you have an DAVINCI board with a Multimedia Card slot,
           say Y or M here.  If unsure, say N.
 
+config MMC_GOLDFISH
+	tristate "goldfish qemu Multimedia Card Interface support"
+	depends on GOLDFISH
+	help
+	  This selects the Goldfish Multimedia card Interface emulation
+	  found on the Goldfish Android virtual device emulation.
+
 config MMC_SPI
 	tristate "MMC/SD/SDIO over SPI"
 	depends on SPI_MASTER && !HIGHMEM && HAS_DMA
drivers/mmc/host/Makefile +1 -0
index e4e218c..2ad0e16 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_MMC_TIFM_SD)	+= tifm_sd.o
 obj-$(CONFIG_MMC_MSM)		+= msm_sdcc.o
 obj-$(CONFIG_MMC_MVSDIO)	+= mvsdio.o
 obj-$(CONFIG_MMC_DAVINCI)       += davinci_mmc.o
+obj-$(CONFIG_MMC_GOLDFISH)	+= goldfish.o
 obj-$(CONFIG_MMC_SPI)		+= mmc_spi.o
 ifeq ($(CONFIG_OF),y)
 obj-$(CONFIG_MMC_SPI)		+= of_mmc_spi.o
drivers/mmc/host/goldfish.c new file +577 -0

577 lines not on this page · raw message

author
#10 lore raw

PATCH 7/10 goldfish: power device

In reply to Alan Cox

From: Mike Lockwood <[email protected]>

Add the emulated power driver for the Goldfish platform.

This folds together the code from the Google tree, Jun Nakajima's cleanups and x86 porting work, and then a tidy up to pass checkpatch.

[cleanup and x86 support]
[ported to 3.4]
[ported to 3.7 and final tidy]

---

 drivers/power/Kconfig            |    8 +
 drivers/power/Makefile           |    1 
 drivers/power/goldfish_battery.c |  262 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 270 insertions(+), 1 deletion(-)
 create mode 100644 drivers/power/goldfish_battery.c
drivers/power/Kconfig +7 -1
index 9f45e2f..0c5208d 100644
@@ -346,8 +346,14 @@ config AB8500_BM
 	help
 	  Say Y to include support for AB8500 battery management.
 
-source "drivers/power/reset/Kconfig"
+config BATTERY_GOLDFISH
+	tristate "Goldfish battery driver"
+	depends on GOLDFISH
+	help
+	  Say Y to enable support for the battery and AC power in the
+	  Goldfish emulator.
 
+source "drivers/power/reset/Kconfig"
 endif # POWER_SUPPLY
 
 source "drivers/power/avs/Kconfig"
drivers/power/Makefile +1 -0
index b11e0c7..a9f5c06 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_BATTERY_DS2760)	+= ds2760_battery.o
 obj-$(CONFIG_BATTERY_DS2780)	+= ds2780_battery.o
 obj-$(CONFIG_BATTERY_DS2781)	+= ds2781_battery.o
 obj-$(CONFIG_BATTERY_DS2782)	+= ds2782_battery.o
+obj-$(CONFIG_BATTERY_GOLDFISH)	+= goldfish_battery.o
 obj-$(CONFIG_BATTERY_PMU)	+= pmu_battery.o
 obj-$(CONFIG_BATTERY_OLPC)	+= olpc_battery.o
 obj-$(CONFIG_BATTERY_TOSA)	+= tosa_battery.o
drivers/power/goldfish_battery.c new file +262 -0

262 lines not on this page · raw message

author
#11 lore raw

PATCH 8/10 goldfish: real time clock

In reply to Alan Cox

From: Arve Hjønnevåg <[email protected]>

Gets the current time from the host. Alarms are not supported yet.

[Ported to 3.4]
[Cleaned up to use ioremap, types, unload etc]

---

 arch/x86/include/asm/goldfish.h |    7 ++
 drivers/rtc/Kconfig             |    9 ++
 drivers/rtc/Makefile            |    1 
 drivers/rtc/rtc-goldfish.c      |  144 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 161 insertions(+)
 create mode 100644 drivers/rtc/rtc-goldfish.c
arch/x86/include/asm/goldfish.h +7 -0
index 8d2c559..63fd315 100644
@@ -30,4 +30,11 @@
 
 #define GOLDFISH_TTY_BASE	(0x2000)
 
+#define GOLDFISH_TIME_LOW		0x00
+#define GOLDFISH_TIME_HIGH		0x04
+#define GOLDFISH_ALARM_LOW		0x08
+#define GOLDFISH_ALARM_HIGH		0x0C
+#define GOLDFISH_CLEAR_TIMER_INT	0x10
+#define GOLDFISH_CLEAR_ALARM		0x14
+
 #endif
drivers/rtc/Kconfig +9 -0
index e4dfa5e..4f7f835 100644
@@ -982,6 +982,15 @@ config RTC_DRV_BFIN
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-bfin.
 
+config RTC_DRV_GOLDFISH
+	tristate "GOLDFISH"
+	depends on GOLDFISH
+	help
+	  RTC driver for Goldfish Virtual Platform
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-goldfish.
+
 config RTC_DRV_RS5C313
 	tristate "Ricoh RS5C313"
 	depends on SH_LANDISK
drivers/rtc/Makefile +1 -0
index b1715e9..03401e4 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_RTC_DRV_EM3027)	+= rtc-em3027.o
 obj-$(CONFIG_RTC_DRV_EP93XX)	+= rtc-ep93xx.o
 obj-$(CONFIG_RTC_DRV_FM3130)	+= rtc-fm3130.o
 obj-$(CONFIG_RTC_DRV_GENERIC)	+= rtc-generic.o
+obj-$(CONFIG_RTC_DRV_GOLDFISH)	+= rtc-goldfish.o
 obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o
 obj-$(CONFIG_RTC_DRV_IMXDI)	+= rtc-imxdi.o
 obj-$(CONFIG_RTC_DRV_ISL1208)	+= rtc-isl1208.o
drivers/rtc/rtc-goldfish.c new file +144 -0

144 lines not on this page · raw message

author
#12 lore raw

PATCH 9/10 goldfish: add QEMU pipe driver

In reply to Alan Cox

From: David 'Digit' Turner <[email protected]>

A QEMU pipe is a very fast communication channel between the guest system and the emulator. Usage from the guest is simply something like;

  // connect to special device
  fd = open("/dev/qemu_pipe", O_RDWR);

// tell which service we want to talk to (must be zero-terminated) write(fd, "pipeName", strlen("pipeName")+1);

// do read()/write() through fd now
...

  // close channel
  close(fd);
[Added support for parameter buffers for speed]
[Ported to 3.6]
[Ported to 3.7, moved to platform/goldfish]

---

 drivers/platform/Kconfig                  |    4 
 drivers/platform/goldfish/Kconfig         |    5 
 drivers/platform/goldfish/Makefile        |    1 
 drivers/platform/goldfish/goldfish_pipe.c |  631 +++++++++++++++++++++++++++++
 4 files changed, 641 insertions(+)
 create mode 100644 drivers/platform/goldfish/Kconfig
 create mode 100644 drivers/platform/goldfish/goldfish_pipe.c
drivers/platform/Kconfig +4 -0
index 8390dca..69616ae 100644
@@ -1,3 +1,7 @@
 if X86
 source "drivers/platform/x86/Kconfig"
 endif
+if GOLDFISH
+source "drivers/platform/goldfish/Kconfig"
+endif
+
drivers/platform/goldfish/Kconfig new file +5 -0
new file mode 100644
index 0000000..635ef25
@@ -0,0 +1,5 @@
+config GOLDFISH_PIPE
+	tristate "Goldfish virtual device for QEMU pipes"
+	---help---
+	  This is a virtual device to drive the QEMU pipe interface used by
+	  the Goldfish Android Virtual Device.
drivers/platform/goldfish/Makefile +1 -0
index 6c591f6..a002239 100644
@@ -2,3 +2,4 @@
 # Makefile for Goldfish platform specific drivers
 #
 obj-$(CONFIG_GOLDFISH)	+=	pdev_bus.o
+obj-$(CONFIG_GOLDFISH_PIPE)	+= goldfish_pipe.o
drivers/platform/goldfish/goldfish_pipe.c new file +631 -0

631 lines not on this page · raw message

author
#13 lore raw

PATCH 10/10 goldfish: NAND flash driver

In reply to Alan Cox

From: Arve Hjønnevåg <[email protected]>

Fold together the NAND driver for Goldfish from Arve with cleanups by Jun Nakajima and a tidy up to 3.7 and checkpatch.

[Ported to handle x86]
[Ported to 3.4]
[Ported to 3.7 and tided for checkpatch etc]

---

 drivers/mtd/devices/Kconfig             |    7 
 drivers/mtd/devices/Makefile            |    3 
 drivers/mtd/devices/goldfish_nand.c     |  475 +++++++++++++++++++++++++++++++
 drivers/mtd/devices/goldfish_nand_reg.h |   72 +++++
 4 files changed, 556 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mtd/devices/goldfish_nand.c
 create mode 100644 drivers/mtd/devices/goldfish_nand_reg.h
drivers/mtd/devices/Kconfig +7 -0
index c187342..7edecf0 100644
@@ -342,4 +342,11 @@ config MTD_DOCPROBE_55AA
 	  LinuxBIOS or if you need to recover a DiskOnChip Millennium on which
 	  you have managed to wipe the first block.
 
+config MTD_GOLDFISH_NAND
+	tristate "Goldfish NAND device"
+	depends on GOLDFISH
+	help
+	  Drives the emulated NAND flash device on the Google Goldfish
+	  Android virtual device.
+
 endmenu
drivers/mtd/devices/Makefile +2 -1
index 395733a..36d4791 100644
@@ -20,5 +20,6 @@ obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
 obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
 obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
 obj-$(CONFIG_MTD_BCM47XXSFLASH)	+= bcm47xxsflash.o
+obj-$(CONFIG_MTD_GOLDFISH_NAND)	+= goldfish_nand.o
 
-CFLAGS_docg3.o			+= -I$(src)
\ No newline at end of file
+CFLAGS_docg3.o			+= -I$(src)
drivers/mtd/devices/goldfish_nand.c new file +475 -0

475 lines not on this page · raw message

drivers/mtd/devices/goldfish_nand_reg.h new file +72 -0

72 lines not on this page · raw message

#14 lore raw
In reply to Alan Cox

Hi Alan,

I'm currently trying to build and run a recent kernel with x86 goldfish and failing. The android emulator itself is running, I can also build and run 3.4-based Google x86 goldfish branch, but not current (vanilla) kernels. Did you run tests yourself? Do you remember, what was needed - just the mainline kernel with these patches or any additional ones? Have you got a kernel configuration and command line? Any idea what the last working kernel version was?

Thanks
Guennadi

Quoted 61 lines · Alan Cox

And added the pipe driver

---

Arve Hjønnevåg (4):
goldfish: tty driver
goldfish: framebuffer
goldfish: real time clock
goldfish: NAND flash driver

Brian Swetland (1):
goldfish: virtual input event driver

David 'Digit' Turner (1):
goldfish: add QEMU pipe driver

Jun Nakajima (2):
goldfish: definitions for Goldfish on x86 platforms
goldfish: add the goldfish virtual bus

Mike Lockwood (2):
goldfish: emulated MMC device
goldfish: power device

 arch/x86/Kconfig                          |   12 +
 arch/x86/include/asm/goldfish.h           |   40 ++
 drivers/input/keyboard/Kconfig            |   11 +
 drivers/input/keyboard/Makefile           |    1 
 drivers/input/keyboard/goldfish_events.c  |  199 +++++++++
 drivers/mmc/host/Kconfig                  |    7 
 drivers/mmc/host/Makefile                 |    1 
 drivers/mmc/host/goldfish.c               |  577 +++++++++++++++++++++++++++
 drivers/mtd/devices/Kconfig               |    7 
 drivers/mtd/devices/Makefile              |    3 
 drivers/mtd/devices/goldfish_nand.c       |  475 ++++++++++++++++++++++
 drivers/mtd/devices/goldfish_nand_reg.h   |   72 +++
 drivers/platform/Kconfig                  |    4 
 drivers/platform/Makefile                 |    1 
 drivers/platform/goldfish/Kconfig         |    5 
 drivers/platform/goldfish/Makefile        |    5 
 drivers/platform/goldfish/goldfish_pipe.c |  631 +++++++++++++++++++++++++++++
 drivers/platform/goldfish/pdev_bus.c      |  265 ++++++++++++
 drivers/power/Kconfig                     |    8 
 drivers/power/Makefile                    |    1 
 drivers/power/goldfish_battery.c          |  262 ++++++++++++
 drivers/rtc/Kconfig                       |    9 
 drivers/rtc/Makefile                      |    1 
 drivers/rtc/rtc-goldfish.c                |  144 +++++++
 drivers/tty/Kconfig                       |    6 
 drivers/tty/Makefile                      |    1 
 drivers/tty/goldfish.c                    |  340 ++++++++++++++++
 drivers/video/Kconfig                     |    9 
 drivers/video/Makefile                    |    1 
 drivers/video/goldfishfb.c                |  326 +++++++++++++++
 30 files changed, 3422 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/include/asm/goldfish.h
 create mode 100644 drivers/input/keyboard/goldfish_events.c
 create mode 100644 drivers/mmc/host/goldfish.c
 create mode 100644 drivers/mtd/devices/goldfish_nand.c
 create mode 100644 drivers/mtd/devices/goldfish_nand_reg.h
Quoted 17 lines
 create mode 100644 drivers/platform/goldfish/Kconfig
 create mode 100644 drivers/platform/goldfish/Makefile
 create mode 100644 drivers/platform/goldfish/goldfish_pipe.c
 create mode 100644 drivers/platform/goldfish/pdev_bus.c
 create mode 100644 drivers/power/goldfish_battery.c
 create mode 100644 drivers/rtc/rtc-goldfish.c
 create mode 100644 drivers/tty/goldfish.c
 create mode 100644 drivers/video/goldfishfb.c
Signature · 6 lines
Moo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/