Commit Graph

28 Commits

Author SHA1 Message Date
Joseph Chen e6b2bd8785 irq: irq-gpio-switch: correct usage of strstr()
Fix gpio interrupt register with wrong gpio bank.

(Fixes: 8db677370c irq: irq-gpio-switch: add gpio alias name support)

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia60e55a134cfab19ed015796486417e0699bd087
2020-12-18 18:02:39 +08:00
Joseph Chen 8db677370c irq: irq-gpio-switch: add gpio alias name support
Before the patch, we get gpio index(0,1,2..) depends on gpio
fdt node name, such as: gpio0@..., gpio1@..., etc.

But from RK3568, we add gpio alias to indicate gpio index
information and index is removed from gpio node name, ie:
gpio@fdd60000, gpio@fe740000, etc.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I56e45941f9572fbc6a5a5916896e12f6eff9dcf3
2020-11-14 15:32:03 +08:00
Joseph Chen 275a49e3fb irq: gicv3: use cpu interface system registers for gicc read/write
RK3568 only support cpu interface system registers access.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ie89380e49ee61afe57560dcc4eba6233f2aca3f2
2020-10-28 21:23:07 +08:00
Joseph Chen e59905bf16 irq: use CONFIG_ROCKCHIP_GPIO_V2 instead of CONFIG_IRQ2GPIO_V2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id8b232efce483501053bcbd779a444d395c061fc
2020-05-28 19:20:09 +08:00
shengfei Xu c2bb46e4a5 irq: gicv3: Enables Group 1 interrupts for the current Security state
When a CPU enters a low power state, the registers ICC_IGRPEN1_EL1 is lost.
It need to re-initialise.

Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I62d9eed2b29190134d95ebd153f21aa764c4ab3b
2020-05-20 09:08:34 +08:00
Joseph Chen 0fdee37b0a drivers: irq: add irq to gpio v2 transfer support
Some platform with new GPIO IP implements the low/high
registers with write mask. This configure handles it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I855357d29e7fba072b867c06a31a049462ebf6ff
2020-03-25 21:12:49 +08:00
Joseph Chen 25c13168fe irq: virq: add parent irq enable/disable management
- disable virq chip by default;
- fix bank->use_count little than 0;

Change-Id: I69aa07cc2924dab40eea6524588869361ad8cf66
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-10-23 11:12:30 +08:00
Joseph Chen eca6f1ffbf irq: gicv2: fix GIC not response to USB OTG IRQ
It handles the issue when the bootflow without Miniloader,
i.e. Maskrom => Trust(optional) => U-Boot.

Change-Id: I445225d5cce9abd2117ef468f15774e3fa57e16d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-09-19 15:36:45 +08:00
Joseph Chen 92f4f0904b irq: add "dump_irqs" command support
Change-Id: Ia20bc3b0f4dc600f311ba3de0e75714b5d4c002c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 17:26:04 +08:00
Joseph Chen ae63f11992 irq: add trigger count and enable/disable stat
Change-Id: I3f29c4e3e420be0fe545a2f55f238345a17eaa6a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 17:26:04 +08:00
Joseph Chen 2c4e90c1f8 irq: add irq_handler_enable_suspend_only() interface
Change-Id: I3cda4c3a4ce5928be32eaa8b65ccd4e16946c116
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 17:26:04 +08:00
Joseph Chen 4176611909 irq: add virq irq-chip support
This patch support the device to add its interrupt controller as "irq chip"
into generic interrupt framework, the other driver can request its child
interrupt like a real hardware irq.

Example for PMIC:
    GIC-\
        |- ...
        |- GPIO-\
                |- ...
                |- PMIC-\
                        |_ virq_0
                        |_ virq_1
                        |_ virq_2
                        |...
                        |_ virq_n

Change-Id: I17716f3db494a85fc22b23ff18042771a6116da8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 17:26:04 +08:00
Joseph Chen cf34425241 irq: clean up code
Change-Id: I51c2713b7c42fa798fee6971a2c91d867042ef70
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 17:26:04 +08:00
Joseph Chen a5e3baaa93 irq: disable all gpio interrupt by default
Enable gpio irq only when child pin irq is request.

Change-Id: I429839c7dcdcb90cfe58738eeb36c7445fb0152b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-05 16:39:54 +08:00
Joseph Chen 269512fdf6 irq: clean up code
- using IRQ_X() to print message;
- update some comment;
- rename some function;
- add more strict irq sanity;

Change-Id: If5432818d4bc12fc1aa0b8aca6898bbf79dfa9fb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 14:29:34 +08:00
Joseph Chen 8696cc3875 irq: add irq busy validation
return -EBUSY when this irq is occupied.

Change-Id: I75ad6c0b13e167762cab2b8f9a2b786e588b2ade
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 09:59:46 +08:00
Joseph Chen 79d3f33751 irq: gic v2/v3: support set target cpu by mpidr dynamiclly
Change-Id: I4a45ad1d81ab9b2e8ae958e6307030200bb405f1
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 09:59:46 +08:00
Joseph Chen c15709b516 irq: init IRQ_STACK_START_IN
IRQ_STACK_START_IN is default 0x0badc0de which is a invalid address,
this patch makes all exceptions routine work normally.

Change-Id: I3f4d75b90d840f7ea1cb7a2e1cbc7ad452aef15b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-01 11:53:47 +08:00
Joseph Chen c563adc74e rockchip: add interrupt debugger to dump pt_regs
We install a timer interrupt and dump pt_regs when
the timeout event trigger. This help us to know cpu
state when system hang.

Change-Id: I91aa2322036ae83ac8b9cd299bef9b521995d85b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-06-13 10:56:38 +08:00
Jason Zhu 86457e1608 drivers: irq: fix compile warning
In the function gpio_get_intr_type, 'type' may be
used uninitialized if not add default process.

Change-Id: I917fecc2ed06cc844c30c93508084f32608edf6f
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-03-09 09:04:40 +08:00
Joseph Chen c234b81e6a irq; support irq revert trigger type and get gpio level
Change-Id: Ib897bb37c518429c595903bb8f2cfd9fcea9aa78
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-30 17:25:14 +08:00
Joseph Chen a1b32c2412 irq: clean up code
remove unused code and fix compile warning.

Change-Id: I912eff25bf60da925791b889f08e91d4fcb61893
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-12-28 15:23:35 +08:00
Joseph Chen ed837edf98 irq: support irq suspend and resume
U-Boot will support cpu suspend/resume, cpu and logic may
lose power, this patch guarantees gic works normally.

Change-Id: I8ebee881fa27fea075502f962f9faabaa8264f67
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-12-05 09:34:48 +08:00
Joseph Chen 5db1153e4b drivers: irq: support convert gpio to irq by gpio fdt phandle
add funtion: phandle_gpio_to_irq(u32 gpio_phandle, u32 pin)

Change-Id: Iec2d1ed08138c2476bb13deb16ca06960fadd60d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-23 09:28:07 +08:00
Joseph Chen 0e508c4fef drivers: irq: disable irq before free irq handler
It makes irq handler free safely

Change-Id: Id3af8956d5681881301e658a1adb9ca3aba97f79
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-23 09:27:58 +08:00
Joseph Chen 42865eb5ad drivers: irq: deliver both irq and private data to irq handler
gic irq handler only need private data, while gpio irq(parent bank)
handler needs private data and irq number for getting gpio bank and
pin information. So we need deliver both of them to the irq handler.

This patch fixes the legacy code issue.

Change-Id: I1917b588a867e807cbd15e2e4101ae259cf4a40f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-12 09:41:08 +08:00
Joseph Chen dbcd148475 drivers: irq: malloc a temporary string for strtok
strtok will update original input string.

Change-Id: I9c81a72045f057c8a7d17f688e2d9f70dd849880
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-12 09:41:08 +08:00
Joseph Chen 4e6670fe63 drivers: add irq interrupt framework support
This patch add support for IRQ interrupt, FIQ not included.
It will be enabled when you select CONFIG_GICV2 or CONFIG_GICV3.

The framework support gic interrupt and gpio interrupt, relative APIs
are provided in: ./include/irq-platform.h

If you'd like to add a new platform support into interrupt framework,
please follow the steps:
1. add relative definitions in the file like other platforms:
   	./include/irq-platform.h

2. add GICD, GICC and GICR(for GICV3) base address definitions in the
   rkxxx-common.h, they are needed in: arch/arm/cpu/armv8/start.S;

3. enable CONFIG_GICV2 or CONFIG_GICV3.

Notice:
1. the framework is initialize in function 'interrupt_init()' of
   _sequence_r[]. So you should not request irqs too early.

2. IRQ stack size is configured by CONFIG_IRQ_STACK_SIZE, the default
   value is 8KB when CONFIG_IRQ_STACK_SIZE is absent.

Change-Id: I3d9e29873c9d64cd28aabd13a61111438c5902b0
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-09-27 10:34:17 +08:00