mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-10-30 07:38:52 +01:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
3
arch/xtensa/platforms/s6105/Makefile
Normal file
3
arch/xtensa/platforms/s6105/Makefile
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Makefile for the Stretch S6105 eval board
|
||||
|
||||
obj-y := setup.o device.o
|
||||
161
arch/xtensa/platforms/s6105/device.c
Normal file
161
arch/xtensa/platforms/s6105/device.c
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* s6105 platform devices
|
||||
*
|
||||
* Copyright (c) 2009 emlix GmbH
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/serial_8250.h>
|
||||
|
||||
#include <variant/hardware.h>
|
||||
#include <variant/dmac.h>
|
||||
|
||||
#include <platform/gpio.h>
|
||||
|
||||
#define GPIO3_INTNUM 3
|
||||
#define UART_INTNUM 4
|
||||
#define GMAC_INTNUM 5
|
||||
|
||||
static const signed char gpio3_irq_mappings[] = {
|
||||
S6_INTC_GPIO(3),
|
||||
-1
|
||||
};
|
||||
|
||||
static const signed char uart_irq_mappings[] = {
|
||||
S6_INTC_UART(0),
|
||||
S6_INTC_UART(1),
|
||||
-1,
|
||||
};
|
||||
|
||||
static const signed char gmac_irq_mappings[] = {
|
||||
S6_INTC_GMAC_STAT,
|
||||
S6_INTC_GMAC_ERR,
|
||||
S6_INTC_DMA_HOSTTERMCNT(0),
|
||||
S6_INTC_DMA_HOSTTERMCNT(1),
|
||||
-1
|
||||
};
|
||||
|
||||
const signed char *platform_irq_mappings[NR_IRQS] = {
|
||||
[GPIO3_INTNUM] = gpio3_irq_mappings,
|
||||
[UART_INTNUM] = uart_irq_mappings,
|
||||
[GMAC_INTNUM] = gmac_irq_mappings,
|
||||
};
|
||||
|
||||
static struct plat_serial8250_port serial_platform_data[] = {
|
||||
{
|
||||
.membase = (void *)S6_REG_UART + 0x0000,
|
||||
.mapbase = S6_REG_UART + 0x0000,
|
||||
.irq = UART_INTNUM,
|
||||
.uartclk = S6_SCLK,
|
||||
.regshift = 2,
|
||||
.iotype = SERIAL_IO_MEM,
|
||||
.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
|
||||
},
|
||||
{
|
||||
.membase = (void *)S6_REG_UART + 0x1000,
|
||||
.mapbase = S6_REG_UART + 0x1000,
|
||||
.irq = UART_INTNUM,
|
||||
.uartclk = S6_SCLK,
|
||||
.regshift = 2,
|
||||
.iotype = SERIAL_IO_MEM,
|
||||
.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
|
||||
static struct resource s6_gmac_resource[] = {
|
||||
{
|
||||
.name = "mem",
|
||||
.start = (resource_size_t)S6_REG_GMAC,
|
||||
.end = (resource_size_t)S6_REG_GMAC + 0x10000 - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.name = "dma",
|
||||
.start = (resource_size_t)
|
||||
DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACTX),
|
||||
.end = (resource_size_t)
|
||||
DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACTX) + 0x100 - 1,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
{
|
||||
.name = "dma",
|
||||
.start = (resource_size_t)
|
||||
DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACRX),
|
||||
.end = (resource_size_t)
|
||||
DMA_CHNL(S6_REG_HIFDMA, S6_HIFDMA_GMACRX) + 0x100 - 1,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
{
|
||||
.name = "io",
|
||||
.start = (resource_size_t)S6_MEM_GMAC,
|
||||
.end = (resource_size_t)S6_MEM_GMAC + 0x2000000 - 1,
|
||||
.flags = IORESOURCE_IO,
|
||||
},
|
||||
{
|
||||
.name = "irq",
|
||||
.start = (resource_size_t)GMAC_INTNUM,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
{
|
||||
.name = "irq",
|
||||
.start = (resource_size_t)PHY_POLL,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init prepare_phy_irq(int pin)
|
||||
{
|
||||
int irq;
|
||||
if (gpio_request(pin, "s6gmac_phy") < 0)
|
||||
goto fail;
|
||||
if (gpio_direction_input(pin) < 0)
|
||||
goto free;
|
||||
irq = gpio_to_irq(pin);
|
||||
if (irq < 0)
|
||||
goto free;
|
||||
if (irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW) < 0)
|
||||
goto free;
|
||||
return irq;
|
||||
free:
|
||||
gpio_free(pin);
|
||||
fail:
|
||||
return PHY_POLL;
|
||||
}
|
||||
|
||||
static struct platform_device platform_devices[] = {
|
||||
{
|
||||
.name = "serial8250",
|
||||
.id = PLAT8250_DEV_PLATFORM,
|
||||
.dev = {
|
||||
.platform_data = serial_platform_data,
|
||||
},
|
||||
},
|
||||
{
|
||||
.name = "s6gmac",
|
||||
.id = 0,
|
||||
.resource = s6_gmac_resource,
|
||||
.num_resources = ARRAY_SIZE(s6_gmac_resource),
|
||||
},
|
||||
{
|
||||
I2C_BOARD_INFO("m41t62", S6I2C_ADDR_M41T62),
|
||||
},
|
||||
};
|
||||
|
||||
static int __init device_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
s6_gmac_resource[5].start = prepare_phy_irq(GPIO_PHY_IRQ);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(platform_devices); i++)
|
||||
platform_device_register(&platform_devices[i]);
|
||||
return 0;
|
||||
}
|
||||
arch_initcall_sync(device_init);
|
||||
27
arch/xtensa/platforms/s6105/include/platform/gpio.h
Normal file
27
arch/xtensa/platforms/s6105/include/platform/gpio.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef __ASM_XTENSA_S6105_GPIO_H
|
||||
#define __ASM_XTENSA_S6105_GPIO_H
|
||||
|
||||
#define GPIO_BP_TEMP_ALARM 0
|
||||
#define GPIO_PB_RESET_IN 1
|
||||
#define GPIO_EXP_IRQ 2
|
||||
#define GPIO_TRIGGER_IRQ 3
|
||||
#define GPIO_RTC_IRQ 4
|
||||
#define GPIO_PHY_IRQ 5
|
||||
#define GPIO_IMAGER_RESET 6
|
||||
#define GPIO_SD_IRQ 7
|
||||
#define GPIO_MINI_BOOT_INH 8
|
||||
#define GPIO_BOARD_RESET 9
|
||||
#define GPIO_EXP_PRESENT 10
|
||||
#define GPIO_LED1_NGREEN 12
|
||||
#define GPIO_LED1_RED 13
|
||||
#define GPIO_LED0_NGREEN 14
|
||||
#define GPIO_LED0_NRED 15
|
||||
#define GPIO_SPI_CS0 16
|
||||
#define GPIO_SPI_CS1 17
|
||||
#define GPIO_SPI_CS3 19
|
||||
#define GPIO_SPI_CS4 20
|
||||
#define GPIO_SD_WP 21
|
||||
#define GPIO_BP_RESET 22
|
||||
#define GPIO_ALARM_OUT 23
|
||||
|
||||
#endif /* __ASM_XTENSA_S6105_GPIO_H */
|
||||
11
arch/xtensa/platforms/s6105/include/platform/hardware.h
Normal file
11
arch/xtensa/platforms/s6105/include/platform/hardware.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef __XTENSA_S6105_HARDWARE_H
|
||||
#define __XTENSA_S6105_HARDWARE_H
|
||||
|
||||
#define PLATFORM_DEFAULT_MEM_START 0x40000000
|
||||
#define PLATFORM_DEFAULT_MEM_SIZE 0x08000000
|
||||
|
||||
#define MAX_DMA_ADDRESS 0
|
||||
|
||||
#define KERNELOFFSET (PLATFORM_DEFAULT_MEM_START + 0x1000)
|
||||
|
||||
#endif /* __XTENSA_S6105_HARDWARE_H */
|
||||
8
arch/xtensa/platforms/s6105/include/platform/serial.h
Normal file
8
arch/xtensa/platforms/s6105/include/platform/serial.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __ASM_XTENSA_S6105_SERIAL_H
|
||||
#define __ASM_XTENSA_S6105_SERIAL_H
|
||||
|
||||
#include <variant/hardware.h>
|
||||
|
||||
#define BASE_BAUD (S6_SCLK / 16)
|
||||
|
||||
#endif /* __ASM_XTENSA_S6105_SERIAL_H */
|
||||
73
arch/xtensa/platforms/s6105/setup.c
Normal file
73
arch/xtensa/platforms/s6105/setup.c
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* s6105 control routines
|
||||
*
|
||||
* Copyright (c) 2009 emlix GmbH
|
||||
*/
|
||||
#include <linux/irq.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <asm/bootparam.h>
|
||||
|
||||
#include <variant/hardware.h>
|
||||
#include <variant/gpio.h>
|
||||
|
||||
#include <platform/gpio.h>
|
||||
|
||||
void platform_halt(void)
|
||||
{
|
||||
local_irq_disable();
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
void platform_power_off(void)
|
||||
{
|
||||
platform_halt();
|
||||
}
|
||||
|
||||
void platform_restart(void)
|
||||
{
|
||||
platform_halt();
|
||||
}
|
||||
|
||||
void __init platform_setup(char **cmdline)
|
||||
{
|
||||
unsigned long reg;
|
||||
|
||||
reg = readl(S6_REG_GREG1 + S6_GREG1_PLLSEL);
|
||||
reg &= ~(S6_GREG1_PLLSEL_GMAC_MASK << S6_GREG1_PLLSEL_GMAC |
|
||||
S6_GREG1_PLLSEL_GMII_MASK << S6_GREG1_PLLSEL_GMII);
|
||||
reg |= S6_GREG1_PLLSEL_GMAC_125MHZ << S6_GREG1_PLLSEL_GMAC |
|
||||
S6_GREG1_PLLSEL_GMII_125MHZ << S6_GREG1_PLLSEL_GMII;
|
||||
writel(reg, S6_REG_GREG1 + S6_GREG1_PLLSEL);
|
||||
|
||||
reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
|
||||
reg &= ~(1 << S6_GREG1_BLOCK_SB);
|
||||
reg &= ~(1 << S6_GREG1_BLOCK_GMAC);
|
||||
writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);
|
||||
|
||||
reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
|
||||
reg |= 1 << S6_GREG1_BLOCK_SB;
|
||||
reg |= 1 << S6_GREG1_BLOCK_GMAC;
|
||||
writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);
|
||||
|
||||
printk(KERN_NOTICE "S6105 on Stretch S6000 - "
|
||||
"Copyright (C) 2009 emlix GmbH <info@emlix.com>\n");
|
||||
}
|
||||
|
||||
void __init platform_init(bp_tag_t *first)
|
||||
{
|
||||
s6_gpio_init(0);
|
||||
gpio_request(GPIO_LED1_NGREEN, "led1_green");
|
||||
gpio_request(GPIO_LED1_RED, "led1_red");
|
||||
gpio_direction_output(GPIO_LED1_NGREEN, 1);
|
||||
}
|
||||
|
||||
void platform_heartbeat(void)
|
||||
{
|
||||
static unsigned int c;
|
||||
|
||||
if (!(++c & 0x4F))
|
||||
gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue