Skip to contentSkip to conversation

Add support for the Intel CE4100

PATCH In review [email protected] 5 participants 25 messages Nov 9, 2010 – Dec 6, 2010

Subsystems (6)
Documentation x86 USB PCI +2 more subsystems
lore
Share & tools
lore
#0 lore raw

cover Add support for the Intel CE4100

From: Dirk Brandewie <[email protected]>

This patch set adds support for the Intel CE4100 SOC. The CE4100 is an SOC specialized for media applications. The CE4100 development platform does not have a traditionial PC BIOS. The early setup of the platform uses the same method as the Moorestown platform.

Dirk Brandewie (5):
ce4100: add PCI register emulation for CE4100 serial/ce4100: Add PCI UART support for the ce4100
ce4100: Add errata fixes for UART on CE4100
x86: ce4100: Add reboot_fixup() for CE4100
ce4100: Add support for CE4100 EHCI IP block to EHCI driver

Thomas Gleixner (1):
x86: Add CE4100 platform support

 Documentation/x86/boot.txt         |    1 +
 arch/x86/Kconfig                   |   12 ++
 arch/x86/include/asm/bootparam.h   |    1 +
 arch/x86/include/asm/setup.h       |    6 +
 arch/x86/kernel/Makefile           |    2 +
 arch/x86/kernel/ce4100.c           |  132 ++++++++++++++
 arch/x86/kernel/head32.c           |    3 +
 arch/x86/kernel/reboot_fixups_32.c |   11 ++
 arch/x86/pci/Makefile              |    1 +
 arch/x86/pci/ce4100.c              |  333 ++++++++++++++++++++++++++++++++++++
 drivers/serial/8250_pci.c          |   35 ++++
 drivers/usb/host/ehci-pci.c        |    4 +
 include/linux/pci_ids.h            |    3 +
 13 files changed, 544 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/kernel/ce4100.c
 create mode 100644 arch/x86/pci/ce4100.c
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 3/6 serial/ce4100: Add PCI UART support for the ce4100

From: Dirk Brandewie <[email protected]>

This patch adds support for the PCI UART on the ce4100.

---
 drivers/serial/8250_pci.c |   35 +++++++++++++++++++++++++++++++++++
 include/linux/pci_ids.h   |    1 +
 2 files changed, 36 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +35 -0
index 53be4d3..f98da48 100644
@@ -957,6 +957,22 @@ pci_default_setup(struct serial_private *priv,
 	return setup_port(priv, port, bar, offset, board->reg_shift);
 }
 
+static int
+ce4100_serial_setup(struct serial_private *priv,
+		  const struct pciserial_board *board,
+		  struct uart_port *port, int idx)
+{
+	int ret;
+
+	ret = setup_port(priv, port, 0, 0, board->reg_shift);
+	port->iotype = UPIO_MEM32;
+	port->type = PORT_XSCALE;
+	port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
+	port->regshift = 2;
+
+	return ret;
+}
+
 static int skip_tx_en_setup(struct serial_private *priv,
 			const struct pciserial_board *board,
 			struct uart_port *port, int idx)
@@ -1072,6 +1088,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= skip_tx_en_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_CE4100_UART,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= ce4100_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
@@ -1592,6 +1615,7 @@ enum pci_board_num_t {
 	pbn_ADDIDATA_PCIe_2_3906250,
 	pbn_ADDIDATA_PCIe_4_3906250,
 	pbn_ADDIDATA_PCIe_8_3906250,
+	pbn_ce4100_1_115200,
 };
 
 /*
@@ -2281,6 +2305,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
 		.uart_offset	= 0x200,
 		.first_offset	= 0x1000,
 	},
+	[pbn_ce4100_1_115200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 1,
+		.base_baud	= 921600,
+		.reg_shift      = 2,
+	},
 };
 
 static const struct pci_device_id softmodem_blacklist[] = {
@@ -3760,6 +3790,11 @@ static struct pci_device_id serial_pci_tbl[] = {
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
 		0xA000, 0x3004,
 		0, 0, pbn_b0_bt_4_115200 },
+	/* Intel CE4100 */
+	{	PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
+		PCI_ANY_ID,  PCI_ANY_ID, 0, 0,
+		pbn_ce4100_1_115200 },
+
 
 	/*
 	 * These entries match devices with class COMMUNICATION_SERIAL,
include/linux/pci_ids.h +1 -0
index c6bcfe9..8fc40b6 100644
@@ -2629,6 +2629,7 @@
 #define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_ADDR_REV2  0x2db1
 #define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_RANK_REV2  0x2db2
 #define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_TC_REV2    0x2db3
+#define PCI_DEVICE_ID_INTEL_CE4100_UART	0x2e66
 #define PCI_DEVICE_ID_INTEL_82855PM_HB	0x3340
 #define PCI_DEVICE_ID_INTEL_IOAT_TBG4	0x3429
 #define PCI_DEVICE_ID_INTEL_IOAT_TBG5	0x342a
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/6 ce4100: add PCI register emulation for CE4100

In reply to [email protected]

From: Dirk Brandewie <[email protected]>

This patch access methods for PCI registers that mis-behave on the CE4100. Each register can be assigned a private init, read and write routine. The exception to this is the bridge device. The bridge device is the only device on bus zero (0) that requires any fixup so it is a special case.

---
 arch/x86/pci/Makefile |    1 +
 arch/x86/pci/ce4100.c |  333 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 334 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/pci/ce4100.c
arch/x86/pci/Makefile +1 -0
index effd96e..6b8759f 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_PCI_OLPC)		+= olpc.o
 obj-$(CONFIG_PCI_XEN)		+= xen.o
 
 obj-y				+= fixup.o
+obj-$(CONFIG_X86_INTEL_CE)      += ce4100.o
 obj-$(CONFIG_ACPI)		+= acpi.o
 obj-y				+= legacy.o irq.o
 
arch/x86/pci/ce4100.c new file +333 -0

333 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#9 lore raw

PATCH 4/6 ce4100: Add errata fixes for UART on CE4100

In reply to [email protected]

From: Dirk Brandewie <[email protected]>

This patch enables the UART on the CE4100. The UART has a couple of issues that need to be worked around. First the UART is mostly PC compatible except that it is clocked eight times faster than a standard PC so the default configuration provided in arch/x86/include/asm/serial.h needs to be overridden. Second the TX interrupt may not be set correctly all the time. Lastly accessing the UART via I/O space for early_prink() hangs the chip when the IOAPIC is enabled.

A custom mem_serial_in() is provided to work around the TX interrupt issue. The configuration issues are dealt with in the call back registered with the 8250 driver via serial8250_set_isa_configurator()

---
 arch/x86/kernel/ce4100.c |   92 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 89 insertions(+), 3 deletions(-)
arch/x86/kernel/ce4100.c +89 -3
index b8f1c48..d2c0d51 100644
@@ -12,25 +12,111 @@
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/serial_reg.h>
+#include <linux/serial_8250.h>
 
 #include <asm/setup.h>
-
+#include <asm/io.h>
 
 static int ce4100_i8042_detect(void)
 {
 	return 0;
 }
 
-static void __init sdv_arch_setup(void)
+static void __init sdv_find_smp_config(void)
 {
+}
+
+#ifdef CONFIG_SERIAL_8250
+
 
+static unsigned int mem_serial_in(struct uart_port *p, int offset)
+{
+	offset = offset << p->regshift;
+	return readl(p->membase + offset);
 }
 
+/*
+ * The UART Tx interrupts are not set under some conditions and therefore serial
+ * transmission hangs. This is a silicon issue and has not been root caused. The
+ * workaround for this silicon issue checks UART_LSR_THRE bit and UART_LSR_TEMT
+ * bit of LSR register in interrupt handler to see whether at least one of these
+ * two bits is set, if so then process the transmit request. If this workaround
+ * is not applied, then the serial transmission may hang. This workaround is for
+ * errata number 9 in Errata - B step.
+*/
 
-static void __init sdv_find_smp_config(void)
+static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
+{
+	unsigned int ret, ier, lsr;
+
+	if (offset == UART_IIR) {
+		offset = offset << p->regshift;
+		ret = readl(p->membase + offset);
+		if (ret & UART_IIR_NO_INT) {
+			/* see if the TX interrupt should have really set */
+			ier = mem_serial_in(p, UART_IER);
+			/* see if the UART's XMIT interrupt is enabled */
+			if (ier & UART_IER_THRI) {
+				lsr = mem_serial_in(p, UART_LSR);
+				/* now check to see if the UART should be
+				   generating an interrupt (but isn't) */
+				if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
+					ret &= ~UART_IIR_NO_INT;
+			}
+		}
+	} else
+		ret =  mem_serial_in(p, offset);
+	return ret;
+}
+
+static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
+{
+	offset = offset << p->regshift;
+	writel(value, p->membase + offset);
+}
+
+static void ce4100_serial_fixup(int port, struct uart_port *up,
+	unsigned short *capabilites)
+{
+#ifdef CONFIG_EARLY_PRINTK
+	/*
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;
+		set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
+				up->mapbase & PAGE_MASK);
+		up->membase =
+			(void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
+		up->membase += up->mapbase & ~PAGE_MASK;
+		up->iotype   = UPIO_MEM32;
+		up->regshift = 2;
+	}
+#endif
+	up->iobase = 0;
+	up->serial_in = ce4100_mem_serial_in;
+	up->serial_out = ce4100_mem_serial_out;
+
+	*capabilites |= (1 << 12);
+}
+
+static __init void sdv_serial_fixup(void)
 {
+	serial8250_set_isa_configurator(ce4100_serial_fixup);
 }
 
+#else
+static inline void sdv_serial_fixup(void);
+#endif
+
+static void __init sdv_arch_setup(void)
+{
+	sdv_serial_fixup();
+}
 
 /*
  * CE4100 specific x86_init function overrides and early setup
Signature · 1 line
1.7.2.3
#17 lore raw

PATCH 5/6 x86: ce4100: Add reboot_fixup() for CE4100

In reply to [email protected]

From: Dirk Brandewie <[email protected]>

This patch adds the CE4100 reboot fixup to reboot_fixups_32.c

---
 arch/x86/Kconfig                   |    1 +
 arch/x86/kernel/reboot_fixups_32.c |   11 +++++++++++
 include/linux/pci_ids.h            |    1 +
 3 files changed, 13 insertions(+), 0 deletions(-)
arch/x86/Kconfig +1 -0
index 84236c9..d9f3fcf 100644
@@ -383,6 +383,7 @@ config X86_INTEL_CE
 	depends on PCI_GODIRECT
 	depends on X86_32
 	depends on X86_EXTENDED_PLATFORM
+	select X86_REBOOTFIXUPS
 	---help---
 	  Select for the Intel CE media processor (CE4100) SOC.
 	  This option compiles in support for the CE4100 SOC for settop
arch/x86/kernel/reboot_fixups_32.c +11 -0
index fda313e..1bb5531 100644
@@ -43,6 +43,16 @@ static void rdc321x_reset(struct pci_dev *dev)
 	outb(1, 0x92);
 }
 
+static void ce4100_reset(struct pci_dev *dev)
+{
+	int i;
+
+	for (i = 0; i < 10; i++) {
+		outb(0x2, 0xcf9);
+		udelay(50);
+	}
+}
+
 struct device_fixup {
 	unsigned int vendor;
 	unsigned int device;
@@ -54,6 +64,7 @@ static const struct device_fixup fixups_table[] = {
 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset },
 { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE, cs5530a_warm_reset },
 { PCI_VENDOR_ID_RDC, PCI_DEVICE_ID_RDC_R6030, rdc321x_reset },
+{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100, ce4100_reset },
 };
 
 /*
include/linux/pci_ids.h +1 -0
index 8fc40b6..84f7130 100644
@@ -2434,6 +2434,7 @@
 #define PCI_DEVICE_ID_INTEL_82375	0x0482
 #define PCI_DEVICE_ID_INTEL_82424	0x0483
 #define PCI_DEVICE_ID_INTEL_82378	0x0484
+#define PCI_DEVICE_ID_INTEL_CE4100	0x0708
 #define PCI_DEVICE_ID_INTEL_MRST_SD0	0x0807
 #define PCI_DEVICE_ID_INTEL_MRST_SD1	0x0808
 #define PCI_DEVICE_ID_INTEL_MFD_SD	0x0820
Signature · 1 line
1.7.2.3
#18 lore raw

PATCH 6/6 ce4100: Add support for CE4100 EHCI IP block to EHCI driver

In reply to [email protected]

From: Dirk Brandewie <[email protected]>

This patch adds support for the EHCI IP block present on the Intel CE4100.

---
 drivers/usb/host/ehci-pci.c |    4 ++++
 include/linux/pci_ids.h     |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-pci.c +4 -0
index a1e8d27..724da36 100644
@@ -124,6 +124,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
 			ehci_info(ehci, "disable lpm for langwell/penwell\n");
 			ehci->has_lpm = 0;
 		}
+		if (pdev->device == PCI_DEVICE_ID_INTEL_CE4100_USB) {
+			hcd->has_tt = 1;
+			tdi_reset(ehci);
+		}
 		break;
 	case PCI_VENDOR_ID_TDI:
 		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
include/linux/pci_ids.h +1 -0
index 84f7130..7790f40 100644
@@ -2631,6 +2631,7 @@
 #define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_RANK_REV2  0x2db2
 #define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_TC_REV2    0x2db3
 #define PCI_DEVICE_ID_INTEL_CE4100_UART	0x2e66
+#define PCI_DEVICE_ID_INTEL_CE4100_USB	0x2e70
 #define PCI_DEVICE_ID_INTEL_82855PM_HB	0x3340
 #define PCI_DEVICE_ID_INTEL_IOAT_TBG4	0x3429
 #define PCI_DEVICE_ID_INTEL_IOAT_TBG5	0x342a
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/6 x86: Add CE4100 platform support

In reply to [email protected]

From: Thomas Gleixner <[email protected]>

Add CE4100 platform support. CE4100 needs early setup like moorestown.

---
 Documentation/x86/boot.txt       |    1 +
 arch/x86/Kconfig                 |   11 +++++++++
 arch/x86/include/asm/bootparam.h |    1 +
 arch/x86/include/asm/setup.h     |    6 +++++
 arch/x86/kernel/Makefile         |    2 +
 arch/x86/kernel/ce4100.c         |   46 ++++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/head32.c         |    3 ++
 7 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/kernel/ce4100.c
Documentation/x86/boot.txt +1 -0
index 30b43e1..bdeb81c 100644
@@ -600,6 +600,7 @@ Protocol:	2.07+
   0x00000001	lguest
   0x00000002	Xen
   0x00000003	Moorestown MID
+  0x00000004	CE4100 TV Platform
 
 Field name:	hardware_subarch_data
 Type:		write (subarch-dependent)
arch/x86/Kconfig +11 -0
index e832768..84236c9 100644
@@ -377,6 +377,17 @@ config X86_ELAN
 
 	  If unsure, choose "PC-compatible" instead.
 
+config X86_INTEL_CE
+	bool "CE4100 TV platform"
+	depends on PCI
+	depends on PCI_GODIRECT
+	depends on X86_32
+	depends on X86_EXTENDED_PLATFORM
+	---help---
+	  Select for the Intel CE media processor (CE4100) SOC.
+	  This option compiles in support for the CE4100 SOC for settop
+	  boxes and media devices.
+
 config X86_MRST
        bool "Moorestown MID platform"
 	depends on PCI
arch/x86/include/asm/bootparam.h +1 -0
index 8e62185..c8bfe63 100644
@@ -124,6 +124,7 @@ enum {
 	X86_SUBARCH_LGUEST,
 	X86_SUBARCH_XEN,
 	X86_SUBARCH_MRST,
+	X86_SUBARCH_CE4100,
 	X86_NR_SUBARCHS,
 };
 
arch/x86/include/asm/setup.h +6 -0
index d6763b1..db8aa19 100644
@@ -53,6 +53,12 @@ extern void x86_mrst_early_setup(void);
 static inline void x86_mrst_early_setup(void) { }
 #endif
 
+#ifdef CONFIG_X86_INTEL_CE
+extern void x86_ce4100_early_setup(void);
+#else
+static inline void x86_ce4100_early_setup(void) { }
+#endif
+
 #ifndef _SETUP
 
 /*
arch/x86/kernel/Makefile +2 -0
index 9e13763..3cb25ab 100644
@@ -101,6 +101,8 @@ obj-$(CONFIG_PARAVIRT_CLOCK)	+= pvclock.o
 
 obj-$(CONFIG_PCSPKR_PLATFORM)	+= pcspeaker.o
 
+obj-$(CONFIG_X86_INTEL_CE)	+= ce4100.o
+
 microcode-y				:= microcode_core.o
 microcode-$(CONFIG_MICROCODE_INTEL)	+= microcode_intel.o
 microcode-$(CONFIG_MICROCODE_AMD)	+= microcode_amd.o
arch/x86/kernel/ce4100.c new file +46 -0

46 lines not on this page · raw message

arch/x86/kernel/head32.c +3 -0
index 7633101..7f138b3 100644
@@ -61,6 +61,9 @@ void __init i386_start_kernel(void)
 	case X86_SUBARCH_MRST:
 		x86_mrst_early_setup();
 		break;
+	case X86_SUBARCH_CE4100:
+		x86_ce4100_early_setup();
+		break;
 	default:
 		i386_default_early_setup();
 		break;
Signature · 1 line
1.7.2.3
#5 lore raw

Re: [PATCH 3/6] serial/ce4100: Add PCI UART support for the ce4100

In reply to [email protected]
Quoted 9 lines · On Tue, Nov 09, 2010 at 12:08:06PM -0800, [email protected] wrote:

From: Dirk Brandewie <[email protected]>

This patch adds support for the PCI UART on the ce4100.

---
 drivers/serial/8250_pci.c |   35 +++++++++++++++++++++++++++++++++++
 include/linux/pci_ids.h   |    1 +

You did read the top of pci_ids.h right? Why are you adding new ids that are only used by one file?

Please don't do that.

thanks,

greg k-h

#6 lore raw

Re: [PATCH 3/6] serial/ce4100: Add PCI UART support for the ce4100

Quoted 5 lines · Greg KH
Quoted 4 lines · On Tue, Nov 09, 2010 at 12:08:06PM -0800, [email protected] wrote:

From: Dirk Brandewie<[email protected]>

This patch adds support for the PCI UART on the ce4100.

Quoted 9 lines
Quoted 5 lines
---
  drivers/serial/8250_pci.c |   35 +++++++++++++++++++++++++++++++++++
  include/linux/pci_ids.h   |    1 +

You did read the top of pci_ids.h right? Why are you adding new ids that are only used by one file?

I have now. Here is a replacement patch for the UART. I will update the USB patch as well.

--Dirk

Subject: [PATCH] serial/ce4100: Add PCI UART support for the ce4100

This patch adds support for the PCI UART on the ce4100.

---
 drivers/serial/8250_pci.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +35 -0
index 53be4d3..12e6f81 100644
@@ -957,6 +957,22 @@ pci_default_setup(struct serial_private *priv,
 	return setup_port(priv, port, bar, offset, board->reg_shift);
 }
 
+static int
+ce4100_serial_setup(struct serial_private *priv,
+		  const struct pciserial_board *board,
+		  struct uart_port *port, int idx)
+{
+	int ret;
+
+	ret = setup_port(priv, port, 0, 0, board->reg_shift);
+	port->iotype = UPIO_MEM32;
+	port->type = PORT_XSCALE;
+	port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
+	port->regshift = 2;
+
+	return ret;
+}
+
 static int skip_tx_en_setup(struct serial_private *priv,
 			const struct pciserial_board *board,
 			struct uart_port *port, int idx)
@@ -1072,6 +1088,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= skip_tx_en_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= 0x2e66,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= ce4100_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
@@ -1592,6 +1615,7 @@ enum pci_board_num_t {
 	pbn_ADDIDATA_PCIe_2_3906250,
 	pbn_ADDIDATA_PCIe_4_3906250,
 	pbn_ADDIDATA_PCIe_8_3906250,
+	pbn_ce4100_1_115200,
 };
 
 /*
@@ -2281,6 +2305,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
 		.uart_offset	= 0x200,
 		.first_offset	= 0x1000,
 	},
+	[pbn_ce4100_1_115200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 1,
+		.base_baud	= 921600,
+		.reg_shift      = 2,
+	},
 };
 
 static const struct pci_device_id softmodem_blacklist[] = {
@@ -3760,6 +3790,11 @@ static struct pci_device_id serial_pci_tbl[] = {
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
 		0xA000, 0x3004,
 		0, 0, pbn_b0_bt_4_115200 },
+	/* Intel CE4100 */
+	{	PCI_VENDOR_ID_INTEL, 0x2e66,
+		PCI_ANY_ID,  PCI_ANY_ID, 0, 0,
+		pbn_ce4100_1_115200 },
+
 
 	/*
 	 * These entries match devices with class COMMUNICATION_SERIAL,
Signature · 1 line
1.7.2.3
#19 lore raw

Re: [PATCH 6/6] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

In reply to [email protected]

In a previous patch in this series GregKH asked that the PCI ID not be added to pci_ids.h for ID's that are only used by a single file.
Here is an updated version of the EHCI controller patch.

Subject: [PATCH] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

This patch adds support for the EHCI IP block present on the Intel CE4100.

---
 drivers/usb/host/ehci-pci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-pci.c +4 -0
index a1e8d27..da2b196 100644
@@ -124,6 +124,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
 			ehci_info(ehci, "disable lpm for langwell/penwell\n");
 			ehci->has_lpm = 0;
 		}
+		if (pdev->device == 0x2e70) {
+			hcd->has_tt = 1;
+			tdi_reset(ehci);
+		}
 		break;
 	case PCI_VENDOR_ID_TDI:
 		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
Signature · 1 line
1.7.2.3
maintainer
#20 lore raw

Re: [PATCH 6/6] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

Quoted 21 lines · Dirk Brandewie

In a previous patch in this series GregKH asked that the PCI ID not be added to pci_ids.h for ID's that are only used by a single file.
Here is an updated version of the EHCI controller patch.

Subject: [PATCH] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

This patch adds support for the EHCI IP block present on the Intel CE4100.

---
 drivers/usb/host/ehci-pci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-pci.c +0 -0
index a1e8d27..da2b196 100644

drivers/usb/host/ehci-pci.c static int ehci_pci_setup(struct usb_hcd *hcd) · line 130

Quoted 7 lines
drivers/usb/host/ehci-pci.c +4 -0
@@ -124,6 +124,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
 			ehci_info(ehci, "disable lpm for langwell/penwell\n");
 			ehci->has_lpm = 0;
 		}
+		if (pdev->device == 0x2e70) {
+			hcd->has_tt = 1;
+			tdi_reset(ehci);
+		}

I think Greg meant that it's okay to use a symbolic constant for the PCI ID (it helps tell people what hardware is being handled). Just don't add that constant to the pci_ids.h file.

Alan Stern

#21 lore raw

Re: [PATCH 6/6] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

Hello.

Quoted 16 lines · Alan Stern
Quoted 15 lines

In a previous patch in this series GregKH asked that the PCI ID not be added to pci_ids.h for ID's that are only used by a single file.
Here is an updated version of the EHCI controller patch.

Subject: [PATCH] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

This patch adds support for the EHCI IP block present on the Intel CE4100.

---
  drivers/usb/host/ehci-pci.c |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)
Quoted 16 lines

drivers/usb/host/ehci-pci.c static int ehci_pci_setup(struct usb_hcd *hcd) · line 130

Quoted 12 lines
drivers/usb/host/ehci-pci.c +4 -0
index a1e8d27..da2b196 100644
@@ -124,6 +124,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
  			ehci_info(ehci, "disable lpm for langwell/penwell\n");
  			ehci->has_lpm = 0;
  		}
+		if (pdev->device == 0x2e70) {
+			hcd->has_tt = 1;
+			tdi_reset(ehci);
+		}

I think Greg meant that it's okay to use a symbolic constant for the PCI ID (it helps tell people what hardware is being handled). Just don't add that constant to the pci_ids.h file.

Or at least you need a comment naming the hardware that this ID belongs to.

Quoted 1 line

Alan Stern

WBR, Sergei

#10 lore raw

Re: [PATCH 4/6] ce4100: Add errata fixes for UART on CE4100

In reply to [email protected]
Quoted 97 lines · On Tue, 9 Nov 2010, [email protected] wrote:

From: Dirk Brandewie <[email protected]>

This patch enables the UART on the CE4100. The UART has a couple of issues that need to be worked around. First the UART is mostly PC compatible except that it is clocked eight times faster than a standard PC so the default configuration provided in arch/x86/include/asm/serial.h needs to be overridden. Second the TX interrupt may not be set correctly all the time. Lastly accessing the UART via I/O space for early_prink() hangs the chip when the IOAPIC is enabled.

A custom mem_serial_in() is provided to work around the TX interrupt issue. The configuration issues are dealt with in the call back registered with the 8250 driver via serial8250_set_isa_configurator()

---
 arch/x86/kernel/ce4100.c |   92 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 89 insertions(+), 3 deletions(-)
arch/x86/kernel/ce4100.c +53 -3
index b8f1c48..d2c0d51 100644
@@ -12,25 +12,111 @@
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/serial_reg.h>
+#include <linux/serial_8250.h>
 
 #include <asm/setup.h>
-
+#include <asm/io.h>
 
 static int ce4100_i8042_detect(void)
 {
 	return 0;
 }
 
-static void __init sdv_arch_setup(void)
+static void __init sdv_find_smp_config(void)
 {
+}
+
+#ifdef CONFIG_SERIAL_8250
+
 
+static unsigned int mem_serial_in(struct uart_port *p, int offset)
+{
+	offset = offset << p->regshift;
+	return readl(p->membase + offset);
 }
 
+/*
+ * The UART Tx interrupts are not set under some conditions and therefore serial
+ * transmission hangs. This is a silicon issue and has not been root caused. The
+ * workaround for this silicon issue checks UART_LSR_THRE bit and UART_LSR_TEMT
+ * bit of LSR register in interrupt handler to see whether at least one of these
+ * two bits is set, if so then process the transmit request. If this workaround
+ * is not applied, then the serial transmission may hang. This workaround is for
+ * errata number 9 in Errata - B step.
+*/
 
-static void __init sdv_find_smp_config(void)
+static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
+{
+	unsigned int ret, ier, lsr;
+
+	if (offset == UART_IIR) {
+		offset = offset << p->regshift;
+		ret = readl(p->membase + offset);
+		if (ret & UART_IIR_NO_INT) {
+			/* see if the TX interrupt should have really set */
+			ier = mem_serial_in(p, UART_IER);
+			/* see if the UART's XMIT interrupt is enabled */
+			if (ier & UART_IER_THRI) {
+				lsr = mem_serial_in(p, UART_LSR);
+				/* now check to see if the UART should be
+				   generating an interrupt (but isn't) */
+				if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
+					ret &= ~UART_IIR_NO_INT;
+			}
+		}
+	} else
+		ret =  mem_serial_in(p, offset);
+	return ret;
+}
+
+static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
+{
+	offset = offset << p->regshift;
+	writel(value, p->membase + offset);
+}
+
+static void ce4100_serial_fixup(int port, struct uart_port *up,
+	unsigned short *capabilites)

arch/x86/kernel/ce4100.c line 90

Quoted 10 lines
arch/x86/kernel/ce4100.c +10 -0
+{
+#ifdef CONFIG_EARLY_PRINTK
+	/*
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;

What does the uartclk, mapbase fixups in the CONFIG_EARLY_PRINTK=n case ?

Quoted 5 lines
arch/x86/kernel/ce4100.c +5 -0
+		set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
+				up->mapbase & PAGE_MASK);
+		up->membase =
+			(void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
+		up->membase += up->mapbase & ~PAGE_MASK;

arch/x86/kernel/ce4100.c line 105

Quoted 10 lines
arch/x86/kernel/ce4100.c +10 -0
+		up->iotype   = UPIO_MEM32;
+		up->regshift = 2;
+	}
+#endif
+	up->iobase = 0;
+	up->serial_in = ce4100_mem_serial_in;
+	up->serial_out = ce4100_mem_serial_out;
+
+	*capabilites |= (1 << 12);
+}

Thanks,

tglx

#11 lore raw

Re: [PATCH 4/6] ce4100: Add errata fixes for UART on CE4100

Quoted 12 lines · Thomas Gleixner

arch/x86/kernel/ce4100.c line 90

Quoted 9 lines
arch/x86/kernel/ce4100.c +7 -0
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;

What does the uartclk, mapbase fixups in the CONFIG_EARLY_PRINTK=n case ?

This is setup in the PCI driver patch #3 in the series

Quoted 19 lines
Quoted 5 lines
arch/x86/kernel/ce4100.c +5 -0
+		set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
+				up->mapbase&  PAGE_MASK);
+		up->membase =
+			(void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
+		up->membase += up->mapbase&  ~PAGE_MASK;

arch/x86/kernel/ce4100.c line 105

Quoted 10 lines
arch/x86/kernel/ce4100.c +10 -0
+		up->iotype   = UPIO_MEM32;
+		up->regshift = 2;
+	}
+#endif
+	up->iobase = 0;
+	up->serial_in = ce4100_mem_serial_in;
+	up->serial_out = ce4100_mem_serial_out;
+
+	*capabilites |= (1<<  12);
+}

Thanks,

tglx

#12 lore raw

Re: [PATCH 4/6] ce4100: Add errata fixes for UART on CE4100

Quoted 13 lines · Dirk Brandewie
Quoted 12 lines · Thomas Gleixner

arch/x86/kernel/ce4100.c line 90

Quoted 9 lines
arch/x86/kernel/ce4100.c +7 -0
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;

What does the uartclk, mapbase fixups in the CONFIG_EARLY_PRINTK=n case ?

Quoted 1 line

This is setup in the PCI driver patch #3 in the series

I just can't find it there, that's why I'm asking :)

Thanks,

tglx

#3 lore raw

Re: [PATCH 2/6] ce4100: add PCI register emulation for CE4100

In reply to [email protected]
Quoted 9 lines · On Tue, 9 Nov 2010, [email protected] wrote:
arch/x86/pci/ce4100.c new file +9 -0
+
+static int ce4100_conf_read(unsigned int seg, unsigned int bus,
+			  unsigned int devfn, int reg, int len, u32 *value)
+{
+	int retval = 1;
+	int i;
+
+	if (bus == 0 && (PCI_DEVFN(1, 0) == devfn))
+		retval = bridge_read(devfn, reg, len, value);

arch/x86/pci/ce4100.c line 279

Quoted 10 lines
arch/x86/pci/ce4100.c new file +10 -0
+
+	if (bus == 1) {
+		for (i = 0; i < num_bus1_fixups; i++) {
+			if (bus1_fixups[i].dev_func == devfn &&
+				bus1_fixups[i].reg == (reg & ~3) &&
+				bus1_fixups[i].read) {
+				bus1_fixups[i].read(&(bus1_fixups[i]),
+					value);
+				extract_bytes(value, reg, len);
+				retval = 0;

Shouldn't we return 0 here and be done ?

Quoted 14 lines
arch/x86/pci/ce4100.c new file +14 -0
+			}
+		}
+	}
+	if (retval)
+		retval = pci_direct_conf1.read(seg, bus, devfn, reg,
+					len, value);
+	return retval;
+}
+
+
+static int ce4100_conf_write(unsigned int seg, unsigned int bus,
+			   unsigned int devfn, int reg, int len, u32 value)
+{
+	int retval = 1;

arch/x86/pci/ce4100.c line 303

Quoted 10 lines
arch/x86/pci/ce4100.c new file +10 -0
+	int i;
+
+	if (bus == 1) {
+		for (i = 0; i < num_bus1_fixups; i++) {
+			if (bus1_fixups[i].dev_func == devfn &&
+				bus1_fixups[i].reg == (reg & ~3) &&
+				bus1_fixups[i].write) {
+				bus1_fixups[i].write(&(bus1_fixups[i]),
+					value);
+				retval = 0;

Ditto

arch/x86/pci/ce4100.c line 311

Quoted 8 lines
arch/x86/pci/ce4100.c new file +8 -0
+			}
+		}
+	}
+
+	/* Discard writes to A/V bridge BAR. */
+	if (bus == 0 && PCI_DEVFN(1, 0) == devfn &&
+		((reg & ~3) == PCI_BASE_ADDRESS_0))
+		retval = 0;

Ditto

arch/x86/pci/ce4100.c line 317

Quoted 6 lines
arch/x86/pci/ce4100.c new file +6 -0
+
+	if (retval)
+		retval = pci_direct_conf1.write(seg, bus, devfn, reg,
+						len, value);
+	return retval;
+}

It took me some time to grok the above retval magic. I'd rather write it this way:

+static int ce4100_conf_read(unsigned int seg, unsigned int bus,
+ unsigned int devfn, int reg, int len, u32 *value)
+{
+ int i;
+
+ if (bus == 1) {
+ for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) {
+ if (bus1_fixups[i].dev_func == devfn &&
+ bus1_fixups[i].reg == (reg & ~3) &&
+ bus1_fixups[i].read) {
+ bus1_fixups[i].read(&(bus1_fixups[i]),
+ value);
+ extract_bytes(value, reg, len);
+ return 0;
+ }
+ }
+ }
+
+ if (bus == 0 && (PCI_DEVFN(1, 0) == devfn) &&
+ !bridge_read(devfn, reg, len, value))
+ return 0;
+
+ return pci_direct_conf1.read(seg, bus, devfn, reg, len, value);
+}
+
+static int ce4100_conf_write(unsigned int seg, unsigned int bus,
+ unsigned int devfn, int reg, int len, u32 value)
+{
+ int i;
+
+ if (bus == 1) {
+ for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) {
+ if (bus1_fixups[i].dev_func == devfn &&
+ bus1_fixups[i].reg == (reg & ~3) &&
+ bus1_fixups[i].write) {
+ bus1_fixups[i].write(&(bus1_fixups[i]),
+ value);
+ return 0;
+ }
+ }
+ }
+
+ /* Discard writes to A/V bridge BAR. */
+ if (bus == 0 && PCI_DEVFN(1, 0) == devfn &&
+ ((reg & ~3) == PCI_BASE_ADDRESS_0))
+ return 0;
+
+ return pci_direct_conf1.write(seg, bus, devfn, reg, len, value);
+}

Thanks,

tglx

#13 lore raw

Re: [PATCH 4/6] ce4100: Add errata fixes for UART on CE4100

In reply to Thomas Gleixner
Quoted 15 lines · Thomas Gleixner
Quoted 13 lines · Dirk Brandewie
Quoted 12 lines · Thomas Gleixner

arch/x86/kernel/ce4100.c line 90

Quoted 9 lines
arch/x86/kernel/ce4100.c +7 -0
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;

What does the uartclk, mapbase fixups in the CONFIG_EARLY_PRINTK=n case ?

Quoted 3 lines
Quoted 1 line

This is setup in the PCI driver patch #3 in the series

I just can't find it there, that's why I'm asking :)

The weird clock is dealt with in:
+ [pbn_ce4100_1_115200] = {
+ .flags = FL_BASE0,
+ .num_ports = 1,
+ .base_baud = 921600,
+ .reg_shift = 2,
+ },

That map base is setup in the generic pci driver in setup_port(). I didn't need to do anything special. --Dirk

Quoted 4 lines

Thanks,

tglx

#14 lore raw

Re: [PATCH 4/6] ce4100: Add errata fixes for UART on CE4100

Quoted 28 lines · Dirk Brandewie
Quoted 16 lines · Thomas Gleixner
Quoted 14 lines · Dirk Brandewie
Quoted 13 lines · Thomas Gleixner

arch/x86/kernel/ce4100.c line 90

Quoted 9 lines
arch/x86/kernel/ce4100.c +7 -0
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;

What does the uartclk, mapbase fixups in the CONFIG_EARLY_PRINTK=n
case ?

Quoted 3 lines
Quoted 1 line

This is setup in the PCI driver patch #3 in the series

I just can't find it there, that's why I'm asking :)

The weird clock is dealt with in:

(quoted diff) +6 -0
+	[pbn_ce4100_1_115200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 1,
+		.base_baud	= 921600,
+		.reg_shift      = 2,
+	},
Quoted 2 lines

That map base is setup in the generic pci driver in setup_port(). I didn't need to do anything special.

Thanks for the clarification.

tglx

#22 lore raw

Re: [PATCH 6/6] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

In reply to Sergei Shtylyov
Quoted 37 lines · Sergei Shtylyov

Hello.

Quoted 16 lines · Alan Stern
Quoted 15 lines

In a previous patch in this series GregKH asked that the PCI ID not be added to pci_ids.h for ID's that are only used by a single file.
Here is an updated version of the EHCI controller patch.

Subject: [PATCH] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

This patch adds support for the EHCI IP block present on the Intel CE4100.

---
 drivers/usb/host/ehci-pci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Quoted 16 lines

drivers/usb/host/ehci-pci.c static int ehci_pci_setup(struct usb_hcd *hcd) · line 130

Quoted 12 lines
drivers/usb/host/ehci-pci.c +4 -0
index a1e8d27..da2b196 100644
@@ -124,6 +124,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
 			ehci_info(ehci, "disable lpm for langwell/penwell\n");
 			ehci->has_lpm = 0;
 		}
+		if (pdev->device == 0x2e70) {
+			hcd->has_tt = 1;
+			tdi_reset(ehci);
+		}

I think Greg meant that it's okay to use a symbolic constant for the PCI ID (it helps tell people what hardware is being handled). Just don't add that constant to the pci_ids.h file.

Quoted 1 line

Or at least you need a comment naming the hardware that this ID belongs to.

I agree, something a bit better than just the device id might be nice here.

Dirk, care to redo this one and your serial one, with that idea?

thanks,

greg k-h

#23 lore raw

Re: [PATCH 6/6] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

Quoted 38 lines · Greg KH
Quoted 37 lines · Sergei Shtylyov

Hello.

Quoted 32 lines · Alan Stern
Quoted 21 lines

In a previous patch in this series GregKH asked that the PCI ID not be added to pci_ids.h for ID's that are only used by a single file.
Here is an updated version of the EHCI controller patch.

Subject: [PATCH] ce4100: Add support for CE4100 EHCI IP block to EHCI driver

This patch adds support for the EHCI IP block present on the Intel CE4100.

---
  drivers/usb/host/ehci-pci.c |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-pci.c +0 -0
index a1e8d27..da2b196 100644

drivers/usb/host/ehci-pci.c static int ehci_pci_setup(struct usb_hcd *hcd) · line 130

Quoted 7 lines
drivers/usb/host/ehci-pci.c +4 -0
@@ -124,6 +124,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
  			ehci_info(ehci, "disable lpm for langwell/penwell\n");
  			ehci->has_lpm = 0;
  		}
+		if (pdev->device == 0x2e70) {
+			hcd->has_tt = 1;
+			tdi_reset(ehci);
+		}

I think Greg meant that it's okay to use a symbolic constant for the PCI ID (it helps tell people what hardware is being handled). Just don't add that constant to the pci_ids.h file.

Quoted 7 lines
Quoted 1 line

Or at least you need a comment naming the hardware that this ID belongs to.

I agree, something a bit better than just the device id might be nice here.

Dirk, care to redo this one and your serial one, with that idea?

Yes, sorry for slow turn around been pulled in other random directions the last few days

--Dirk

#8 lore raw

PATCH 1/1 serial/ce4100: Add PCI UART support for the ce4100

In reply to [email protected]

From: Dirk Brandewie <[email protected]>

This patch adds support for the PCI UART on the ce4100.

---
 drivers/serial/8250_pci.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +36 -0
index 53be4d3..e30356d 100644
@@ -957,6 +957,22 @@ pci_default_setup(struct serial_private *priv,
 	return setup_port(priv, port, bar, offset, board->reg_shift);
 }
 
+static int
+ce4100_serial_setup(struct serial_private *priv,
+		  const struct pciserial_board *board,
+		  struct uart_port *port, int idx)
+{
+	int ret;
+
+	ret = setup_port(priv, port, 0, 0, board->reg_shift);
+	port->iotype = UPIO_MEM32;
+	port->type = PORT_XSCALE;
+	port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
+	port->regshift = 2;
+
+	return ret;
+}
+
 static int skip_tx_en_setup(struct serial_private *priv,
 			const struct pciserial_board *board,
 			struct uart_port *port, int idx)
@@ -981,6 +997,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
 #define PCI_SUBDEVICE_ID_POCTAL232	0x0308
 #define PCI_SUBDEVICE_ID_POCTAL422	0x0408
 #define PCI_VENDOR_ID_ADVANTECH		0x13fe
+#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
 #define PCI_DEVICE_ID_ADVANTECH_PCI3620	0x3620
 #define PCI_DEVICE_ID_TITAN_200I	0x8028
 #define PCI_DEVICE_ID_TITAN_400I	0x8048
@@ -1072,6 +1089,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= skip_tx_en_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_CE4100_UART,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= ce4100_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
@@ -1592,6 +1616,7 @@ enum pci_board_num_t {
 	pbn_ADDIDATA_PCIe_2_3906250,
 	pbn_ADDIDATA_PCIe_4_3906250,
 	pbn_ADDIDATA_PCIe_8_3906250,
+	pbn_ce4100_1_115200,
 };
 
 /*
@@ -2281,6 +2306,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
 		.uart_offset	= 0x200,
 		.first_offset	= 0x1000,
 	},
+	[pbn_ce4100_1_115200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 1,
+		.base_baud	= 921600,
+		.reg_shift      = 2,
+	},
 };
 
 static const struct pci_device_id softmodem_blacklist[] = {
@@ -3760,6 +3791,11 @@ static struct pci_device_id serial_pci_tbl[] = {
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
 		0xA000, 0x3004,
 		0, 0, pbn_b0_bt_4_115200 },
+	/* Intel CE4100 */
+	{	PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
+		PCI_ANY_ID,  PCI_ANY_ID, 0, 0,
+		pbn_ce4100_1_115200 },
+
 
 	/*
 	 * These entries match devices with class COMMUNICATION_SERIAL,
Signature · 1 line
1.7.2.3
#24 lore raw

PATCH 1/1 ce4100: Add support for CE4100 EHCI IP block to EHCI driver

In reply to [email protected]

From: Dirk Brandewie <[email protected]>

This patch adds support for the EHCI IP block present on the Intel CE4100.

---
 drivers/usb/host/ehci-pci.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-pci.c +7 -0
index a1e8d27..56c78e9 100644
@@ -22,6 +22,9 @@
 #error "This file is PCI bus glue.  CONFIG_PCI must be defined."
 #endif
 
+/* defined here to avoid adding to pci_ids.h for single instance use */
+#define PCI_DEVICE_ID_INTEL_CE4100_USB	0x2e70
+
 /*-------------------------------------------------------------------------*/
 
 /* called after powerup, by probe or system-pm "wakeup" */
@@ -124,6 +127,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
 			ehci_info(ehci, "disable lpm for langwell/penwell\n");
 			ehci->has_lpm = 0;
 		}
+		if (pdev->device == PCI_DEVICE_ID_INTEL_CE4100_USB) {
+			hcd->has_tt = 1;
+			tdi_reset(ehci);
+		}
 		break;
 	case PCI_VENDOR_ID_TDI:
 		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
Signature · 1 line
1.7.2.3
#15 lore raw

PATCH 1/1 ce4100: Add errata fixes for UART on CE4100

In reply to [email protected]

From: Dirk Brandewie <[email protected]>

This patch enables the UART on the CE4100. The UART has a couple of issues that need to be worked around. First the UART is mostly PC compatible except that it is clocked eight times faster than a standard PC so the default configuration provided in arch/x86/include/asm/serial.h needs to be overridden. Second the TX interrupt may not be set correctly all the time. Lastly accessing the UART via I/O space for early_prink() hangs the chip when the IOAPIC is enabled.

A custom mem_serial_in() is provided to work around the TX interrupt issue. The configuration issues are dealt with in the call back registered with the 8250 driver via serial8250_set_isa_configurator()

---
 arch/x86/platform/ce4100/ce4100.c |   92 +++++++++++++++++++++++++++++++++++-
 1 files changed, 89 insertions(+), 3 deletions(-)
arch/x86/platform/ce4100/ce4100.c +89 -3
index b8f1c48..d2c0d51 100644
@@ -12,25 +12,111 @@
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/serial_reg.h>
+#include <linux/serial_8250.h>
 
 #include <asm/setup.h>
-
+#include <asm/io.h>
 
 static int ce4100_i8042_detect(void)
 {
 	return 0;
 }
 
-static void __init sdv_arch_setup(void)
+static void __init sdv_find_smp_config(void)
 {
+}
+
+#ifdef CONFIG_SERIAL_8250
+
 
+static unsigned int mem_serial_in(struct uart_port *p, int offset)
+{
+	offset = offset << p->regshift;
+	return readl(p->membase + offset);
 }
 
+/*
+ * The UART Tx interrupts are not set under some conditions and therefore serial
+ * transmission hangs. This is a silicon issue and has not been root caused. The
+ * workaround for this silicon issue checks UART_LSR_THRE bit and UART_LSR_TEMT
+ * bit of LSR register in interrupt handler to see whether at least one of these
+ * two bits is set, if so then process the transmit request. If this workaround
+ * is not applied, then the serial transmission may hang. This workaround is for
+ * errata number 9 in Errata - B step.
+*/
 
-static void __init sdv_find_smp_config(void)
+static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
+{
+	unsigned int ret, ier, lsr;
+
+	if (offset == UART_IIR) {
+		offset = offset << p->regshift;
+		ret = readl(p->membase + offset);
+		if (ret & UART_IIR_NO_INT) {
+			/* see if the TX interrupt should have really set */
+			ier = mem_serial_in(p, UART_IER);
+			/* see if the UART's XMIT interrupt is enabled */
+			if (ier & UART_IER_THRI) {
+				lsr = mem_serial_in(p, UART_LSR);
+				/* now check to see if the UART should be
+				   generating an interrupt (but isn't) */
+				if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
+					ret &= ~UART_IIR_NO_INT;
+			}
+		}
+	} else
+		ret =  mem_serial_in(p, offset);
+	return ret;
+}
+
+static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
+{
+	offset = offset << p->regshift;
+	writel(value, p->membase + offset);
+}
+
+static void ce4100_serial_fixup(int port, struct uart_port *up,
+	unsigned short *capabilites)
+{
+#ifdef CONFIG_EARLY_PRINTK
+	/*
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;
+		set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
+				up->mapbase & PAGE_MASK);
+		up->membase =
+			(void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
+		up->membase += up->mapbase & ~PAGE_MASK;
+		up->iotype   = UPIO_MEM32;
+		up->regshift = 2;
+	}
+#endif
+	up->iobase = 0;
+	up->serial_in = ce4100_mem_serial_in;
+	up->serial_out = ce4100_mem_serial_out;
+
+	*capabilites |= (1 << 12);
+}
+
+static __init void sdv_serial_fixup(void)
 {
+	serial8250_set_isa_configurator(ce4100_serial_fixup);
 }
 
+#else
+static inline void sdv_serial_fixup(void);
+#endif
+
+static void __init sdv_arch_setup(void)
+{
+	sdv_serial_fixup();
+}
 
 /*
  * CE4100 specific x86_init function overrides and early setup
Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 1/1 serial/ce4100: Add PCI UART support for the ce4100

In reply to Greg KH

From: Dirk Brandewie <[email protected]>

This patch adds support for the PCI UART on the ce4100.

---
 drivers/serial/8250_pci.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +36 -0
index 842e3b2..8b8930f 100644
@@ -957,6 +957,22 @@ pci_default_setup(struct serial_private *priv,
 	return setup_port(priv, port, bar, offset, board->reg_shift);
 }
 
+static int
+ce4100_serial_setup(struct serial_private *priv,
+		  const struct pciserial_board *board,
+		  struct uart_port *port, int idx)
+{
+	int ret;
+
+	ret = setup_port(priv, port, 0, 0, board->reg_shift);
+	port->iotype = UPIO_MEM32;
+	port->type = PORT_XSCALE;
+	port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
+	port->regshift = 2;
+
+	return ret;
+}
+
 static int skip_tx_en_setup(struct serial_private *priv,
 			const struct pciserial_board *board,
 			struct uart_port *port, int idx)
@@ -981,6 +997,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
 #define PCI_SUBDEVICE_ID_POCTAL232	0x0308
 #define PCI_SUBDEVICE_ID_POCTAL422	0x0408
 #define PCI_VENDOR_ID_ADVANTECH		0x13fe
+#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
 #define PCI_DEVICE_ID_ADVANTECH_PCI3620	0x3620
 #define PCI_DEVICE_ID_TITAN_200I	0x8028
 #define PCI_DEVICE_ID_TITAN_400I	0x8048
@@ -1072,6 +1089,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= skip_tx_en_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_CE4100_UART,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= ce4100_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
@@ -1592,6 +1616,7 @@ enum pci_board_num_t {
 	pbn_ADDIDATA_PCIe_2_3906250,
 	pbn_ADDIDATA_PCIe_4_3906250,
 	pbn_ADDIDATA_PCIe_8_3906250,
+	pbn_ce4100_1_115200,
 };
 
 /*
@@ -2281,6 +2306,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
 		.uart_offset	= 0x200,
 		.first_offset	= 0x1000,
 	},
+	[pbn_ce4100_1_115200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 1,
+		.base_baud	= 921600,
+		.reg_shift      = 2,
+	},
 };
 
 static const struct pci_device_id softmodem_blacklist[] = {
@@ -3765,6 +3796,11 @@ static struct pci_device_id serial_pci_tbl[] = {
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
 		0xA000, 0x3004,
 		0, 0, pbn_b0_bt_4_115200 },
+	/* Intel CE4100 */
+	{	PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
+		PCI_ANY_ID,  PCI_ANY_ID, 0, 0,
+		pbn_ce4100_1_115200 },
+
 
 	/*
 	 * These entries match devices with class COMMUNICATION_SERIAL,
Signature · 1 line
1.7.2.3
#16 lore raw

[tip:x86/platform] ce4100: Add errata fixes for UART on CE4100

In reply to [email protected]
Commit-ID:  5ec6960f6f0c7be9cc6e5506fdf0070add3b6e08
Gitweb:     http://git.kernel.org/tip/5ec6960f6f0c7be9cc6e5506fdf0070add3b6e08
Author:     Dirk Brandewie <[email protected]>
AuthorDate: Mon, 22 Nov 2010 06:28:48 -0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 6 Dec 2010 15:58:26 +0100

ce4100: Add errata fixes for UART on CE4100

This patch enables the UART on the CE4100. The UART has a couple of issues that need to be worked around. First the UART is mostly PC compatible except that it is clocked eight times faster than a standard PC so the default configuration provided in arch/x86/include/asm/serial.h needs to be overridden. Second the TX interrupt may not be set correctly all the time. Lastly accessing the UART via I/O space for early_prink() hangs the chip when the IOAPIC is enabled.

A custom mem_serial_in() is provided to work around the TX interrupt issue. The configuration issues are dealt with in the call back registered with the 8250 driver via serial8250_set_isa_configurator()

LKML-Reference: <[email protected]>

---
 arch/x86/platform/ce4100/ce4100.c |   94 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 92 insertions(+), 2 deletions(-)
arch/x86/platform/ce4100/ce4100.c +92 -2
index 0ede12b..d2c0d51 100644
@@ -12,20 +12,110 @@
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/serial_reg.h>
+#include <linux/serial_8250.h>
 
 #include <asm/setup.h>
+#include <asm/io.h>
 
 static int ce4100_i8042_detect(void)
 {
 	return 0;
 }
 
-static void __init sdv_arch_setup(void)
+static void __init sdv_find_smp_config(void)
 {
 }
 
-static void __init sdv_find_smp_config(void)
+#ifdef CONFIG_SERIAL_8250
+
+
+static unsigned int mem_serial_in(struct uart_port *p, int offset)
+{
+	offset = offset << p->regshift;
+	return readl(p->membase + offset);
+}
+
+/*
+ * The UART Tx interrupts are not set under some conditions and therefore serial
+ * transmission hangs. This is a silicon issue and has not been root caused. The
+ * workaround for this silicon issue checks UART_LSR_THRE bit and UART_LSR_TEMT
+ * bit of LSR register in interrupt handler to see whether at least one of these
+ * two bits is set, if so then process the transmit request. If this workaround
+ * is not applied, then the serial transmission may hang. This workaround is for
+ * errata number 9 in Errata - B step.
+*/
+
+static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
+{
+	unsigned int ret, ier, lsr;
+
+	if (offset == UART_IIR) {
+		offset = offset << p->regshift;
+		ret = readl(p->membase + offset);
+		if (ret & UART_IIR_NO_INT) {
+			/* see if the TX interrupt should have really set */
+			ier = mem_serial_in(p, UART_IER);
+			/* see if the UART's XMIT interrupt is enabled */
+			if (ier & UART_IER_THRI) {
+				lsr = mem_serial_in(p, UART_LSR);
+				/* now check to see if the UART should be
+				   generating an interrupt (but isn't) */
+				if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
+					ret &= ~UART_IIR_NO_INT;
+			}
+		}
+	} else
+		ret =  mem_serial_in(p, offset);
+	return ret;
+}
+
+static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
+{
+	offset = offset << p->regshift;
+	writel(value, p->membase + offset);
+}
+
+static void ce4100_serial_fixup(int port, struct uart_port *up,
+	unsigned short *capabilites)
+{
+#ifdef CONFIG_EARLY_PRINTK
+	/*
+	 * Over ride the legacy port configuration that comes from
+	 * asm/serial.h. Using the ioport driver then switching to the
+	 * PCI memmaped driver hangs the IOAPIC
+	 */
+	if (up->iotype !=  UPIO_MEM32) {
+		up->uartclk  = 14745600;
+		up->mapbase = 0xdffe0200;
+		set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
+				up->mapbase & PAGE_MASK);
+		up->membase =
+			(void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
+		up->membase += up->mapbase & ~PAGE_MASK;
+		up->iotype   = UPIO_MEM32;
+		up->regshift = 2;
+	}
+#endif
+	up->iobase = 0;
+	up->serial_in = ce4100_mem_serial_in;
+	up->serial_out = ce4100_mem_serial_out;
+
+	*capabilites |= (1 << 12);
+}
+
+static __init void sdv_serial_fixup(void)
+{
+	serial8250_set_isa_configurator(ce4100_serial_fixup);
+}
+
+#else
+static inline void sdv_serial_fixup(void);
+#endif
+
+static void __init sdv_arch_setup(void)
 {
+	sdv_serial_fixup();
 }
 
 /*